mirror of
https://github.com/Swatinem/rust-cache.git
synced 2024-11-26 17:56:08 +08:00
dep: Use smol-toml
instead of toml
(#164)
Fixed #162 #163 The former is listed on https://github.com/toml-lang/toml/wiki#implementations and is toml 1.0 compliant. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
578b235f6e
commit
ab6b2769d1
5025
dist/restore/index.js
vendored
5025
dist/restore/index.js
vendored
File diff suppressed because it is too large
Load Diff
5025
dist/save/index.js
vendored
5025
dist/save/index.js
vendored
File diff suppressed because it is too large
Load Diff
14
package-lock.json
generated
14
package-lock.json
generated
@ -15,7 +15,7 @@
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/glob": "^0.4.0",
|
||||
"@actions/io": "^1.1.3",
|
||||
"toml": "^3.0.0"
|
||||
"smol-toml": "^1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vercel/ncc": "^0.36.1",
|
||||
@ -511,10 +511,14 @@
|
||||
"semver": "bin/semver.js"
|
||||
}
|
||||
},
|
||||
"node_modules/toml": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/toml/-/toml-3.0.0.tgz",
|
||||
"integrity": "sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w=="
|
||||
"node_modules/smol-toml": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.1.1.tgz",
|
||||
"integrity": "sha512-qyYMygHyDKiy82iiKTH/zXr0DZmEpsou0AMZnkXdYhA/0LhPLoZ/xHaOBrbecLbAJ/Gd5KhMWWH8TXtgv1g+DQ==",
|
||||
"engines": {
|
||||
"node": ">= 18",
|
||||
"pnpm": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/tr46": {
|
||||
"version": "0.0.3",
|
||||
|
@ -28,7 +28,7 @@
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/glob": "^0.4.0",
|
||||
"@actions/io": "^1.1.3",
|
||||
"toml": "^3.0.0"
|
||||
"smol-toml": "^1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vercel/ncc": "^0.36.1",
|
||||
|
@ -5,7 +5,7 @@ import fs from "fs";
|
||||
import fs_promises from "fs/promises";
|
||||
import os from "os";
|
||||
import path from "path";
|
||||
import * as toml from "toml";
|
||||
import * as toml from "smol-toml";
|
||||
|
||||
import { getCargoBins } from "./cleanup";
|
||||
import { CacheProvider, getCmdOutput } from "./utils";
|
||||
@ -147,12 +147,13 @@ export class CacheConfig {
|
||||
for (const cargo_manifest of cargo_manifests) {
|
||||
try {
|
||||
const content = await fs_promises.readFile(cargo_manifest, { encoding: "utf8" });
|
||||
const parsed = toml.parse(content);
|
||||
// Use any since TomlPrimitive is not exposed
|
||||
const parsed = toml.parse(content) as { [key: string]: any };
|
||||
|
||||
if ("package" in parsed) {
|
||||
const pack = parsed.package;
|
||||
if ("version" in pack) {
|
||||
pack.version = "0.0.0";
|
||||
pack["version"] = "0.0.0";
|
||||
}
|
||||
}
|
||||
|
||||
@ -205,7 +206,7 @@ export class CacheConfig {
|
||||
|
||||
// Package without `[[package]].source` and `[[package]].checksum`
|
||||
// are the one with `path = "..."` to crates within the workspace.
|
||||
const packages = parsed.package.filter((p: any) => "source" in p || "checksum" in p);
|
||||
const packages = (parsed.package as any[]).filter((p: any) => "source" in p || "checksum" in p);
|
||||
|
||||
hasher.update(JSON.stringify(packages));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user