@fantasticit/sumi 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/adapters.d.ts +2 -0
- package/dist/adapters.js +23 -4
- package/dist/adapters.js.map +1 -1
- package/dist/agents.js +34 -12
- package/dist/agents.js.map +1 -1
- package/dist/cli.js +14 -13
- package/dist/cli.js.map +1 -1
- package/dist/context.js +12 -3
- package/dist/context.js.map +1 -1
- package/dist/doctor-wiring.d.ts +6 -3
- package/dist/doctor-wiring.js +25 -15
- package/dist/doctor-wiring.js.map +1 -1
- package/dist/hook-routing.d.ts +13 -4
- package/dist/hook-routing.js +81 -25
- package/dist/hook-routing.js.map +1 -1
- package/dist/instructions.d.ts +1 -1
- package/dist/instructions.js +4 -4
- package/dist/instructions.js.map +1 -1
- package/dist/launcher.cjs +161 -151
- package/dist/launcher.js +6 -2
- package/dist/launcher.js.map +1 -1
- package/dist/scaffold-commands.js +4 -3
- package/dist/scaffold-commands.js.map +1 -1
- package/dist/task.js +39 -12
- package/dist/task.js.map +1 -1
- package/dist/vendor.js +1 -1
- package/dist/vendor.js.map +1 -1
- package/node_modules/@sumi/create/README.md +12 -10
- package/node_modules/@sumi/create/dist/scaffold.js +26 -4
- package/node_modules/@sumi/create/dist/scaffold.js.map +1 -1
- package/node_modules/@sumi/create/package.json +2 -2
- package/node_modules/@sumi/create/template/.editorconfig +4 -0
- package/node_modules/@sumi/create/template/.prettierignore +1 -0
- package/node_modules/@sumi/create/template/AGENTS.md +3 -2
- package/node_modules/@sumi/create/template/control/config.yaml +1 -0
- package/node_modules/@sumi/create/template/control/flows/check.flow.yaml +5 -0
- package/node_modules/@sumi/create/template/control/plugins/security-audit-scan/instructions/security-audit-scan.md +157 -0
- package/node_modules/@sumi/create/template/control/plugins/security-audit-scan/plugin.yaml +6 -0
- package/node_modules/@sumi/create/template/control/rubrics/architecture.yaml +1 -0
- package/node_modules/@sumi/create/template/control/rubrics/clean-code.yaml +5 -0
- package/node_modules/@sumi/create/template/control/rubrics/security.yaml +20 -0
- package/node_modules/@sumi/create/template/control/rules/codecheck-catalog.json +1171 -0
- package/node_modules/@sumi/create/template/control/rules/codecheck.md +62 -0
- package/node_modules/@sumi/create/template/control/rules/development.md +1 -0
- package/node_modules/@sumi/create/template/control/rules/git-workflow.md +98 -0
- package/node_modules/@sumi/create/template/control/rules/security/README.md +24 -0
- package/node_modules/@sumi/create/template/control/rules/security/references/api-auth-scan.md +201 -0
- package/node_modules/@sumi/create/template/control/rules/security/references/crypto-weakness-scan.md +83 -0
- package/node_modules/@sumi/create/template/control/rules/security/references/csv-injection-scan.md +96 -0
- package/node_modules/@sumi/create/template/control/rules/security/references/debug-menu-crack-tools-scan.md +40 -0
- package/node_modules/@sumi/create/template/control/rules/security/references/dos-attack-scan.md +153 -0
- package/node_modules/@sumi/create/template/control/rules/security/references/file-upload-security-scan.md +55 -0
- package/node_modules/@sumi/create/template/control/rules/security/references/insecure-protocol-scan.md +29 -0
- package/node_modules/@sumi/create/template/control/rules/security/references/log-injection-scan.md +44 -0
- package/node_modules/@sumi/create/template/control/rules/security/references/logging-security-policy.md +208 -0
- package/node_modules/@sumi/create/template/control/rules/security/references/nodejs-dangerous-apis-scan.md +78 -0
- package/node_modules/@sumi/create/template/control/rules/security/references/postmessage-scan.md +34 -0
- package/node_modules/@sumi/create/template/control/rules/security/references/public-address-scan.md +53 -0
- package/node_modules/@sumi/create/template/control/rules/security/references/redis-sensitive-scan.md +77 -0
- package/node_modules/@sumi/create/template/control/rules/security/references/redos-scan.md +30 -0
- package/node_modules/@sumi/create/template/control/rules/security/references/scenarios-catalog.md +268 -0
- package/node_modules/@sumi/create/template/control/rules/security/references/sensitive-data-taxonomy.md +50 -0
- package/node_modules/@sumi/create/template/control/rules/security/references/sha-hash-scan.md +105 -0
- package/node_modules/@sumi/create/template/control/rules/security/references/storage-secrets-scan.md +45 -0
- package/node_modules/@sumi/create/template/control/rules/security/references/tls-cipher-protocol-scan.md +103 -0
- package/node_modules/@sumi/create/template/control/rules/security/references/xss-scan-methodology.md +252 -0
- package/node_modules/@sumi/create/template/eslint.config.mjs +157 -2
- package/node_modules/@sumi/create/template/gitignore +1 -0
- package/node_modules/@sumi/create/template/init/AGENTS.md +3 -2
- package/node_modules/@sumi/create/template/init/control/flows/change.flow.yaml +18 -0
- package/node_modules/@sumi/create/template/init/control/plugins/security-audit-scan/instructions/security-audit-scan.md +157 -0
- package/node_modules/@sumi/create/template/init/control/plugins/security-audit-scan/plugin.yaml +6 -0
- package/node_modules/@sumi/create/template/init/control/rubrics/architecture.yaml +2 -1
- package/node_modules/@sumi/create/template/init/control/rubrics/business-impact.yaml +6 -0
- package/node_modules/@sumi/kernel/dist/brief.js +6 -7
- package/node_modules/@sumi/kernel/dist/brief.js.map +1 -1
- package/node_modules/@sumi/kernel/dist/engine.js +12 -6
- package/node_modules/@sumi/kernel/dist/engine.js.map +1 -1
- package/node_modules/@sumi/kernel/dist/flow.js +5 -1
- package/node_modules/@sumi/kernel/dist/flow.js.map +1 -1
- package/node_modules/@sumi/kernel/dist/record.d.ts +1 -1
- package/node_modules/@sumi/kernel/dist/record.js +11 -2
- package/node_modules/@sumi/kernel/dist/record.js.map +1 -1
- package/node_modules/@sumi/kernel/dist/runner.js +24 -0
- package/node_modules/@sumi/kernel/dist/runner.js.map +1 -1
- package/node_modules/@sumi/kernel/dist/scope.d.ts +2 -0
- package/node_modules/@sumi/kernel/dist/scope.js +12 -2
- package/node_modules/@sumi/kernel/dist/scope.js.map +1 -1
- package/node_modules/@sumi/kernel/package.json +2 -2
- package/node_modules/@sumi/plugin-sdk/README.md +1 -1
- package/node_modules/@sumi/plugin-sdk/dist/git.d.ts +2 -2
- package/node_modules/@sumi/plugin-sdk/dist/git.js +3 -3
- package/node_modules/@sumi/plugin-sdk/dist/git.js.map +1 -1
- package/node_modules/@sumi/plugin-sdk/dist/index.d.ts +1 -0
- package/node_modules/@sumi/plugin-sdk/dist/index.js +1 -0
- package/node_modules/@sumi/plugin-sdk/dist/index.js.map +1 -1
- package/node_modules/@sumi/plugin-sdk/dist/project.d.ts +7 -0
- package/node_modules/@sumi/plugin-sdk/dist/project.js +27 -1
- package/node_modules/@sumi/plugin-sdk/dist/project.js.map +1 -1
- package/node_modules/@sumi/plugin-sdk/dist/protocol.d.ts +4 -2
- package/node_modules/@sumi/plugin-sdk/dist/protocol.js +8 -7
- package/node_modules/@sumi/plugin-sdk/dist/protocol.js.map +1 -1
- package/node_modules/@sumi/plugin-sdk/dist/session-context.d.ts +2 -0
- package/node_modules/@sumi/plugin-sdk/dist/session-context.js +5 -1
- package/node_modules/@sumi/plugin-sdk/dist/session-context.js.map +1 -1
- package/node_modules/@sumi/plugin-sdk/dist/shell.d.ts +28 -4
- package/node_modules/@sumi/plugin-sdk/dist/shell.js +187 -34
- package/node_modules/@sumi/plugin-sdk/dist/shell.js.map +1 -1
- package/node_modules/@sumi/plugin-sdk/dist/snapshot.d.ts +2 -0
- package/node_modules/@sumi/plugin-sdk/dist/snapshot.js +18 -6
- package/node_modules/@sumi/plugin-sdk/dist/snapshot.js.map +1 -1
- package/node_modules/@sumi/plugin-sdk/dist/validate.js +17 -0
- package/node_modules/@sumi/plugin-sdk/dist/validate.js.map +1 -1
- package/node_modules/@sumi/plugin-sdk/dist/worktrees.d.ts +6 -0
- package/node_modules/@sumi/plugin-sdk/dist/worktrees.js +25 -0
- package/node_modules/@sumi/plugin-sdk/dist/worktrees.js.map +1 -0
- package/node_modules/@sumi/plugin-sdk/package.json +1 -1
- package/node_modules/@sumi/plugins-core/README.md +1 -1
- package/node_modules/@sumi/plugins-core/dist/plugins/control-docs.js +18 -0
- package/node_modules/@sumi/plugins-core/dist/plugins/control-docs.js.map +1 -1
- package/node_modules/@sumi/plugins-core/dist/plugins/test-affected.js +116 -9
- package/node_modules/@sumi/plugins-core/dist/plugins/test-affected.js.map +1 -1
- package/node_modules/@sumi/plugins-core/dist/test-checkpoints.d.ts +5 -0
- package/node_modules/@sumi/plugins-core/dist/test-checkpoints.js +12 -8
- package/node_modules/@sumi/plugins-core/dist/test-checkpoints.js.map +1 -1
- package/node_modules/@sumi/plugins-core/dist/test-incremental.d.ts +38 -0
- package/node_modules/@sumi/plugins-core/dist/test-incremental.js +92 -0
- package/node_modules/@sumi/plugins-core/dist/test-incremental.js.map +1 -0
- package/node_modules/@sumi/plugins-core/instructions/adopt.md +1 -1
- package/node_modules/@sumi/plugins-core/package.json +2 -2
- package/node_modules/@sumi/plugins-governance/README.md +16 -30
- package/node_modules/@sumi/plugins-governance/dist/checkout.js +14 -6
- package/node_modules/@sumi/plugins-governance/dist/checkout.js.map +1 -1
- package/node_modules/@sumi/plugins-governance/dist/commands/gate.js +13 -52
- package/node_modules/@sumi/plugins-governance/dist/commands/gate.js.map +1 -1
- package/node_modules/@sumi/plugins-governance/dist/guard.js +82 -95
- package/node_modules/@sumi/plugins-governance/dist/guard.js.map +1 -1
- package/node_modules/@sumi/plugins-governance/dist/plugins/protected-paths.js +10 -4
- package/node_modules/@sumi/plugins-governance/dist/plugins/protected-paths.js.map +1 -1
- package/node_modules/@sumi/plugins-governance/dist/pr-report-markers.d.ts +1 -1
- package/node_modules/@sumi/plugins-governance/dist/pr-report-markers.js +1 -1
- package/node_modules/@sumi/plugins-governance/dist/protected.d.ts +2 -2
- package/node_modules/@sumi/plugins-governance/dist/protected.js +22 -6
- package/node_modules/@sumi/plugins-governance/dist/protected.js.map +1 -1
- package/node_modules/@sumi/plugins-governance/dist/push-base.d.ts +3 -0
- package/node_modules/@sumi/plugins-governance/dist/push-base.js +13 -1
- package/node_modules/@sumi/plugins-governance/dist/push-base.js.map +1 -1
- package/node_modules/@sumi/plugins-governance/dist/semantic.d.ts +1 -1
- package/node_modules/@sumi/plugins-governance/dist/semantic.js +20 -8
- package/node_modules/@sumi/plugins-governance/dist/semantic.js.map +1 -1
- package/node_modules/@sumi/plugins-governance/dist/state.d.ts +0 -46
- package/node_modules/@sumi/plugins-governance/dist/state.js +9 -148
- package/node_modules/@sumi/plugins-governance/dist/state.js.map +1 -1
- package/node_modules/@sumi/plugins-governance/instructions/push.md +6 -5
- package/node_modules/@sumi/plugins-governance/package.json +2 -2
- package/node_modules/@sumi/plugins-governance/sumi-plugins.yaml +2 -4
- package/node_modules/@sumi/plugins-openspec/dist/plugins/impact-consistency.js +2 -35
- package/node_modules/@sumi/plugins-openspec/dist/plugins/impact-consistency.js.map +1 -1
- package/node_modules/@sumi/plugins-openspec/package.json +4 -4
- package/node_modules/@sumi/plugins-precedent/README.md +5 -5
- package/node_modules/@sumi/plugins-precedent/dist/after-edit-context.js +1 -1
- package/node_modules/@sumi/plugins-precedent/dist/after-edit-context.js.map +1 -1
- package/node_modules/@sumi/plugins-precedent/dist/commands/context.js +7 -5
- package/node_modules/@sumi/plugins-precedent/dist/commands/context.js.map +1 -1
- package/node_modules/@sumi/plugins-precedent/dist/commands/on-prompt-context.js +7 -3
- package/node_modules/@sumi/plugins-precedent/dist/commands/on-prompt-context.js.map +1 -1
- package/node_modules/@sumi/plugins-precedent/dist/impact.js +4 -3
- package/node_modules/@sumi/plugins-precedent/dist/impact.js.map +1 -1
- package/node_modules/@sumi/plugins-precedent/dist/plugins/harvest.js +17 -32
- package/node_modules/@sumi/plugins-precedent/dist/plugins/harvest.js.map +1 -1
- package/node_modules/@sumi/plugins-precedent/dist/plugins/planner.js +4 -7
- package/node_modules/@sumi/plugins-precedent/dist/plugins/planner.js.map +1 -1
- package/node_modules/@sumi/plugins-precedent/dist/plugins/selftest.js +4 -3
- package/node_modules/@sumi/plugins-precedent/dist/plugins/selftest.js.map +1 -1
- package/node_modules/@sumi/plugins-precedent/instructions/distill.md +0 -1
- package/node_modules/@sumi/plugins-precedent/package.json +3 -3
- package/node_modules/@sumi/plugins-review/README.md +25 -19
- package/node_modules/@sumi/plugins-review/dist/command-hint.d.ts +4 -0
- package/node_modules/@sumi/plugins-review/dist/command-hint.js +6 -0
- package/node_modules/@sumi/plugins-review/dist/command-hint.js.map +1 -1
- package/node_modules/@sumi/plugins-review/dist/commands/model-recheck.js +13 -7
- package/node_modules/@sumi/plugins-review/dist/commands/model-recheck.js.map +1 -1
- package/node_modules/@sumi/plugins-review/dist/commands/submit.js +4 -3
- package/node_modules/@sumi/plugins-review/dist/commands/submit.js.map +1 -1
- package/node_modules/@sumi/plugins-review/dist/dispute.d.ts +4 -3
- package/node_modules/@sumi/plugins-review/dist/dispute.js +10 -26
- package/node_modules/@sumi/plugins-review/dist/dispute.js.map +1 -1
- package/node_modules/@sumi/plugins-review/dist/model-execution.d.ts +9 -2
- package/node_modules/@sumi/plugins-review/dist/model-execution.js +174 -40
- package/node_modules/@sumi/plugins-review/dist/model-execution.js.map +1 -1
- package/node_modules/@sumi/plugins-review/dist/plugins/independent-recheck.js +32 -31
- package/node_modules/@sumi/plugins-review/dist/plugins/independent-recheck.js.map +1 -1
- package/node_modules/@sumi/plugins-review/dist/plugins/rubric.js +11 -35
- package/node_modules/@sumi/plugins-review/dist/plugins/rubric.js.map +1 -1
- package/node_modules/@sumi/plugins-review/dist/recheck.d.ts +7 -2
- package/node_modules/@sumi/plugins-review/dist/recheck.js +14 -6
- package/node_modules/@sumi/plugins-review/dist/recheck.js.map +1 -1
- package/node_modules/@sumi/plugins-review/dist/review-evidence.js +4 -4
- package/node_modules/@sumi/plugins-review/dist/review-evidence.js.map +1 -1
- package/node_modules/@sumi/plugins-review/dist/review.d.ts +12 -3
- package/node_modules/@sumi/plugins-review/dist/review.js +44 -12
- package/node_modules/@sumi/plugins-review/dist/review.js.map +1 -1
- package/node_modules/@sumi/plugins-review/dist/submission.js +7 -3
- package/node_modules/@sumi/plugins-review/dist/submission.js.map +1 -1
- package/node_modules/@sumi/plugins-review/dist/upgrade-flow-plan.js +12 -4
- package/node_modules/@sumi/plugins-review/dist/upgrade-flow-plan.js.map +1 -1
- package/node_modules/@sumi/plugins-review/dist/upgrade-flow-render.js +1 -1
- package/node_modules/@sumi/plugins-review/dist/upgrade-flow-render.js.map +1 -1
- package/node_modules/@sumi/plugins-review/dist/upgrade.js +3 -1
- package/node_modules/@sumi/plugins-review/dist/upgrade.js.map +1 -1
- package/node_modules/@sumi/plugins-review/dist/validation-receipt.js +30 -3
- package/node_modules/@sumi/plugins-review/dist/validation-receipt.js.map +1 -1
- package/node_modules/@sumi/plugins-review/package.json +5 -5
- package/node_modules/@sumi/plugins-review/sumi-plugins.yaml +2 -2
- package/package.json +10 -10
- package/node_modules/@sumi/plugins-governance/dist/commands/approve.d.ts +0 -1
- package/node_modules/@sumi/plugins-governance/dist/commands/approve.js +0 -29
- package/node_modules/@sumi/plugins-governance/dist/commands/approve.js.map +0 -1
- package/node_modules/@sumi/plugins-governance/dist/commands/unlock.d.ts +0 -1
- package/node_modules/@sumi/plugins-governance/dist/commands/unlock.js +0 -23
- package/node_modules/@sumi/plugins-governance/dist/commands/unlock.js.map +0 -1
package/dist/launcher.cjs
CHANGED
|
@@ -7363,22 +7363,34 @@ var require_dist = __commonJS({
|
|
|
7363
7363
|
// src/launcher.ts
|
|
7364
7364
|
var import_node_child_process = require("node:child_process");
|
|
7365
7365
|
var import_node_crypto4 = require("node:crypto");
|
|
7366
|
-
var
|
|
7367
|
-
var
|
|
7366
|
+
var import_node_fs11 = require("node:fs");
|
|
7367
|
+
var import_node_path14 = require("node:path");
|
|
7368
|
+
|
|
7369
|
+
// ../plugin-sdk/dist/project.js
|
|
7370
|
+
var import_node_fs = require("node:fs");
|
|
7371
|
+
var import_node_path = require("node:path");
|
|
7372
|
+
var CONFIG_FILES = ["control/config.yaml", "sumi.config.yaml"];
|
|
7373
|
+
function configFile(root) {
|
|
7374
|
+
return CONFIG_FILES.find((f2) => (0, import_node_fs.existsSync)((0, import_node_path.join)(root, f2))) ?? null;
|
|
7375
|
+
}
|
|
7376
|
+
var PUBLISHED_CLI_PACKAGE = "@fantasticit/sumi";
|
|
7377
|
+
var CLI_PACKAGE_NAMES = ["@sumi/cli", PUBLISHED_CLI_PACKAGE];
|
|
7378
|
+
|
|
7379
|
+
// src/launcher.ts
|
|
7368
7380
|
var import_yaml = __toESM(require_dist(), 1);
|
|
7369
7381
|
|
|
7370
7382
|
// src/runtime-manifest.ts
|
|
7371
7383
|
var import_node_crypto2 = require("node:crypto");
|
|
7372
|
-
var
|
|
7373
|
-
var
|
|
7384
|
+
var import_node_fs3 = require("node:fs");
|
|
7385
|
+
var import_node_path3 = require("node:path");
|
|
7374
7386
|
|
|
7375
7387
|
// src/build-identity.ts
|
|
7376
7388
|
var import_node_crypto = require("node:crypto");
|
|
7377
|
-
var
|
|
7378
|
-
var
|
|
7389
|
+
var import_node_fs2 = require("node:fs");
|
|
7390
|
+
var import_node_path2 = require("node:path");
|
|
7379
7391
|
var BUILD_ID_PATTERN = /^sha256:[0-9a-f]{64}$/;
|
|
7380
7392
|
function payload(path, relative) {
|
|
7381
|
-
const content = (0,
|
|
7393
|
+
const content = (0, import_node_fs2.readFileSync)(path);
|
|
7382
7394
|
if (relative !== "package.json") return content;
|
|
7383
7395
|
const manifest = JSON.parse(content.toString("utf8"));
|
|
7384
7396
|
delete manifest.sumiBuild;
|
|
@@ -7389,9 +7401,9 @@ function buildIdentity(root) {
|
|
|
7389
7401
|
const hash = (0, import_node_crypto.createHash)("sha256");
|
|
7390
7402
|
const entries = [];
|
|
7391
7403
|
const walk = (dir, prefix = "") => {
|
|
7392
|
-
for (const entry of (0,
|
|
7404
|
+
for (const entry of (0, import_node_fs2.readdirSync)(dir, { withFileTypes: true })) {
|
|
7393
7405
|
const relative = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
7394
|
-
const path = (0,
|
|
7406
|
+
const path = (0, import_node_path2.join)(dir, entry.name);
|
|
7395
7407
|
if (entry.isDirectory() && entry.name === ".bin" && (prefix === "node_modules" || prefix.endsWith("/node_modules"))) continue;
|
|
7396
7408
|
if (entry.isDirectory()) walk(path, relative);
|
|
7397
7409
|
else entries.push(relative);
|
|
@@ -7400,10 +7412,10 @@ function buildIdentity(root) {
|
|
|
7400
7412
|
walk(root);
|
|
7401
7413
|
entries.sort();
|
|
7402
7414
|
for (const relative of entries) {
|
|
7403
|
-
const path = (0,
|
|
7404
|
-
const stat = (0,
|
|
7415
|
+
const path = (0, import_node_path2.join)(root, ...relative.split("/"));
|
|
7416
|
+
const stat = (0, import_node_fs2.lstatSync)(path);
|
|
7405
7417
|
if (stat.isSymbolicLink()) {
|
|
7406
|
-
const target = Buffer.from((0,
|
|
7418
|
+
const target = Buffer.from((0, import_node_fs2.readlinkSync)(path));
|
|
7407
7419
|
hash.update(`link\0${relative}\0${target.length}\0`);
|
|
7408
7420
|
hash.update(target);
|
|
7409
7421
|
} else if (stat.isFile()) {
|
|
@@ -7418,17 +7430,13 @@ function buildIdentity(root) {
|
|
|
7418
7430
|
return `sha256:${hash.digest("hex")}`;
|
|
7419
7431
|
}
|
|
7420
7432
|
|
|
7421
|
-
// ../plugin-sdk/dist/project.js
|
|
7422
|
-
var PUBLISHED_CLI_PACKAGE = "@fantasticit/sumi";
|
|
7423
|
-
var CLI_PACKAGE_NAMES = ["@sumi/cli", PUBLISHED_CLI_PACKAGE];
|
|
7424
|
-
|
|
7425
7433
|
// src/runtime-manifest.ts
|
|
7426
7434
|
var VENDOR_DIR = "control/vendor";
|
|
7427
7435
|
var RUNTIME_MANIFEST = `${VENDOR_DIR}/sumi-runtime.json`;
|
|
7428
7436
|
var SHA256_PATTERN = /^[0-9a-f]{64}$/;
|
|
7429
7437
|
var ARCHIVE_PATTERN = /^control\/vendor\/sumi-cli-[^/\\]+\.tgz$/;
|
|
7430
7438
|
function fileSha256(path) {
|
|
7431
|
-
return (0, import_node_crypto2.createHash)("sha256").update((0,
|
|
7439
|
+
return (0, import_node_crypto2.createHash)("sha256").update((0, import_node_fs3.readFileSync)(path)).digest("hex");
|
|
7432
7440
|
}
|
|
7433
7441
|
function parseRuntimeManifest(value, repo) {
|
|
7434
7442
|
if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error("runtime \u6E05\u5355\u5FC5\u987B\u662F JSON \u5BF9\u8C61");
|
|
@@ -7449,12 +7457,12 @@ function parseRuntimeManifest(value, repo) {
|
|
|
7449
7457
|
archiveSha256: typeof input.archiveSha256 === "string" ? input.archiveSha256 : "",
|
|
7450
7458
|
...identity
|
|
7451
7459
|
};
|
|
7452
|
-
if (!ARCHIVE_PATTERN.test(manifest.archive) || (0,
|
|
7460
|
+
if (!ARCHIVE_PATTERN.test(manifest.archive) || (0, import_node_path3.isAbsolute)(manifest.archive) || manifest.archive.split("/").includes("..")) {
|
|
7453
7461
|
throw new Error(`runtime \u5B89\u88C5\u5305\u8DEF\u5F84\u65E0\u6548\uFF1A${manifest.archive || "(\u7F3A\u5931)"}`);
|
|
7454
7462
|
}
|
|
7455
7463
|
if (!SHA256_PATTERN.test(manifest.archiveSha256)) throw new Error("runtime \u5B89\u88C5\u5305 SHA-256 \u65E0\u6548\u6216\u7F3A\u5931");
|
|
7456
|
-
const archive = (0,
|
|
7457
|
-
const vendor = (0,
|
|
7464
|
+
const archive = (0, import_node_path3.resolve)(repo, ...manifest.archive.split("/"));
|
|
7465
|
+
const vendor = (0, import_node_path3.resolve)(repo, "control/vendor");
|
|
7458
7466
|
if (archive !== vendor && !archive.startsWith(`${vendor}/`) && !archive.startsWith(`${vendor}\\`)) {
|
|
7459
7467
|
throw new Error(`runtime \u5B89\u88C5\u5305\u8D8A\u754C\uFF1A${manifest.archive}`);
|
|
7460
7468
|
}
|
|
@@ -7470,13 +7478,13 @@ function safeArchiveEntry(path) {
|
|
|
7470
7478
|
function safeLinkTarget(entryPath, target) {
|
|
7471
7479
|
const normalized = target.replaceAll("\\", "/");
|
|
7472
7480
|
if (!normalized || normalized.startsWith("/") || /^[A-Za-z]:/.test(normalized)) return false;
|
|
7473
|
-
const resolved =
|
|
7481
|
+
const resolved = import_node_path3.posix.normalize(import_node_path3.posix.join(import_node_path3.posix.dirname(entryPath.replaceAll("\\", "/")), normalized));
|
|
7474
7482
|
return resolved === "package" || resolved.startsWith("package/");
|
|
7475
7483
|
}
|
|
7476
7484
|
|
|
7477
7485
|
// src/runtime-package.ts
|
|
7478
|
-
var
|
|
7479
|
-
var
|
|
7486
|
+
var import_node_fs10 = require("node:fs");
|
|
7487
|
+
var import_node_path13 = require("node:path");
|
|
7480
7488
|
|
|
7481
7489
|
// ../../node_modules/.pnpm/tar@7.5.22/node_modules/tar/dist/esm/index.min.js
|
|
7482
7490
|
var import_events = __toESM(require("events"), 1);
|
|
@@ -7484,35 +7492,35 @@ var import_fs = __toESM(require("fs"), 1);
|
|
|
7484
7492
|
var import_node_events = require("node:events");
|
|
7485
7493
|
var import_node_stream = __toESM(require("node:stream"), 1);
|
|
7486
7494
|
var import_node_string_decoder = require("node:string_decoder");
|
|
7487
|
-
var
|
|
7488
|
-
var
|
|
7495
|
+
var import_node_path4 = __toESM(require("node:path"), 1);
|
|
7496
|
+
var import_node_fs4 = __toESM(require("node:fs"), 1);
|
|
7489
7497
|
var import_path = require("path");
|
|
7490
7498
|
var import_events2 = require("events");
|
|
7491
7499
|
var import_assert = __toESM(require("assert"), 1);
|
|
7492
7500
|
var import_buffer = require("buffer");
|
|
7493
7501
|
var Ps = __toESM(require("zlib"), 1);
|
|
7494
7502
|
var import_zlib = __toESM(require("zlib"), 1);
|
|
7495
|
-
var import_node_path4 = require("node:path");
|
|
7496
7503
|
var import_node_path5 = require("node:path");
|
|
7504
|
+
var import_node_path6 = require("node:path");
|
|
7497
7505
|
var import_fs2 = __toESM(require("fs"), 1);
|
|
7498
7506
|
var import_fs3 = __toESM(require("fs"), 1);
|
|
7499
7507
|
var import_path2 = __toESM(require("path"), 1);
|
|
7500
|
-
var
|
|
7508
|
+
var import_node_path7 = require("node:path");
|
|
7501
7509
|
var import_path3 = __toESM(require("path"), 1);
|
|
7502
|
-
var
|
|
7510
|
+
var import_node_fs5 = __toESM(require("node:fs"), 1);
|
|
7503
7511
|
var import_node_assert = __toESM(require("node:assert"), 1);
|
|
7504
7512
|
var import_node_crypto3 = require("node:crypto");
|
|
7505
|
-
var import_node_fs5 = __toESM(require("node:fs"), 1);
|
|
7506
|
-
var import_node_path7 = __toESM(require("node:path"), 1);
|
|
7507
|
-
var import_fs4 = __toESM(require("fs"), 1);
|
|
7508
7513
|
var import_node_fs6 = __toESM(require("node:fs"), 1);
|
|
7509
7514
|
var import_node_path8 = __toESM(require("node:path"), 1);
|
|
7515
|
+
var import_fs4 = __toESM(require("fs"), 1);
|
|
7510
7516
|
var import_node_fs7 = __toESM(require("node:fs"), 1);
|
|
7511
|
-
var import_promises = __toESM(require("node:fs/promises"), 1);
|
|
7512
7517
|
var import_node_path9 = __toESM(require("node:path"), 1);
|
|
7513
|
-
var import_node_path10 = require("node:path");
|
|
7514
7518
|
var import_node_fs8 = __toESM(require("node:fs"), 1);
|
|
7515
|
-
var
|
|
7519
|
+
var import_promises = __toESM(require("node:fs/promises"), 1);
|
|
7520
|
+
var import_node_path10 = __toESM(require("node:path"), 1);
|
|
7521
|
+
var import_node_path11 = require("node:path");
|
|
7522
|
+
var import_node_fs9 = __toESM(require("node:fs"), 1);
|
|
7523
|
+
var import_node_path12 = __toESM(require("node:path"), 1);
|
|
7516
7524
|
var zr = Object.defineProperty;
|
|
7517
7525
|
var Ur = (s3, t) => {
|
|
7518
7526
|
for (var e in t) zr(s3, e, { get: t[e], enumerable: true });
|
|
@@ -8406,12 +8414,12 @@ var F = class {
|
|
|
8406
8414
|
}
|
|
8407
8415
|
};
|
|
8408
8416
|
var mn = (s3, t) => {
|
|
8409
|
-
let i = s3, r = "", n, o =
|
|
8417
|
+
let i = s3, r = "", n, o = import_node_path5.posix.parse(s3).root || ".";
|
|
8410
8418
|
if (Buffer.byteLength(i) < 100) n = [i, r, false];
|
|
8411
8419
|
else {
|
|
8412
|
-
r =
|
|
8420
|
+
r = import_node_path5.posix.dirname(i), i = import_node_path5.posix.basename(i);
|
|
8413
8421
|
do
|
|
8414
|
-
Buffer.byteLength(i) <= 100 && Buffer.byteLength(r) <= t ? n = [i, r, false] : Buffer.byteLength(i) > 100 && Buffer.byteLength(r) <= t ? n = [i.slice(0, 99), r, true] : (i =
|
|
8422
|
+
Buffer.byteLength(i) <= 100 && Buffer.byteLength(r) <= t ? n = [i, r, false] : Buffer.byteLength(i) > 100 && Buffer.byteLength(r) <= t ? n = [i.slice(0, 99), r, true] : (i = import_node_path5.posix.join(import_node_path5.posix.basename(r), i), r = import_node_path5.posix.dirname(r));
|
|
8415
8423
|
while (r !== o && n === void 0);
|
|
8416
8424
|
n || (n = [s3.slice(0, 99), "", true]);
|
|
8417
8425
|
}
|
|
@@ -8457,7 +8465,7 @@ var ft = class s {
|
|
|
8457
8465
|
if (t === "") return Buffer.allocUnsafe(0);
|
|
8458
8466
|
let e = Buffer.byteLength(t), i = 512 * Math.ceil(1 + e / 512), r = Buffer.allocUnsafe(i);
|
|
8459
8467
|
for (let n = 0; n < 512; n++) r[n] = 0;
|
|
8460
|
-
new F({ path: ("PaxHeader/" + (0,
|
|
8468
|
+
new F({ path: ("PaxHeader/" + (0, import_node_path6.basename)(this.path ?? "")).slice(0, 99), mode: this.mode || 420, uid: this.uid, gid: this.gid, size: e, mtime: this.mtime, type: this.global ? "GlobalExtendedHeader" : "ExtendedHeader", linkpath: "", uname: this.uname || "", gname: this.gname || "", devmaj: 0, devmin: 0, atime: this.atime, ctime: this.ctime }).encode(r), r.write(t, 512, e, "utf8");
|
|
8461
8469
|
for (let n = e + 512; n < r.length; n++) r[n] = 0;
|
|
8462
8470
|
return r;
|
|
8463
8471
|
}
|
|
@@ -8883,15 +8891,15 @@ var Qi = (s3, t) => {
|
|
|
8883
8891
|
var Mn = (s3) => {
|
|
8884
8892
|
let t = new rt(s3), e = s3.file, i;
|
|
8885
8893
|
try {
|
|
8886
|
-
i =
|
|
8887
|
-
let r =
|
|
8894
|
+
i = import_node_fs4.default.openSync(e, "r");
|
|
8895
|
+
let r = import_node_fs4.default.fstatSync(i), n = s3.maxReadSize || 16 * 1024 * 1024;
|
|
8888
8896
|
if (r.size < n) {
|
|
8889
|
-
let o = Buffer.allocUnsafe(r.size), h =
|
|
8897
|
+
let o = Buffer.allocUnsafe(r.size), h = import_node_fs4.default.readSync(i, o, 0, r.size, 0);
|
|
8890
8898
|
t.end(h === o.byteLength ? o : o.subarray(0, h));
|
|
8891
8899
|
} else {
|
|
8892
8900
|
let o = 0, h = Buffer.allocUnsafe(n);
|
|
8893
8901
|
for (; o < r.size; ) {
|
|
8894
|
-
let a =
|
|
8902
|
+
let a = import_node_fs4.default.readSync(i, h, 0, n, o);
|
|
8895
8903
|
if (a === 0) break;
|
|
8896
8904
|
o += a, t.write(h.subarray(0, a));
|
|
8897
8905
|
}
|
|
@@ -8899,7 +8907,7 @@ var Mn = (s3) => {
|
|
|
8899
8907
|
}
|
|
8900
8908
|
} finally {
|
|
8901
8909
|
if (typeof i == "number") try {
|
|
8902
|
-
|
|
8910
|
+
import_node_fs4.default.closeSync(i);
|
|
8903
8911
|
} catch {
|
|
8904
8912
|
}
|
|
8905
8913
|
}
|
|
@@ -8907,7 +8915,7 @@ var Mn = (s3) => {
|
|
|
8907
8915
|
var Bn = (s3, t) => {
|
|
8908
8916
|
let e = new rt(s3), i = s3.maxReadSize || 16 * 1024 * 1024, r = s3.file;
|
|
8909
8917
|
return new Promise((o, h) => {
|
|
8910
|
-
e.on("error", h), e.on("end", o),
|
|
8918
|
+
e.on("error", h), e.on("end", o), import_node_fs4.default.stat(r, (a, l) => {
|
|
8911
8919
|
if (a) h(a);
|
|
8912
8920
|
else {
|
|
8913
8921
|
let c = new _t(r, { readSize: i, size: l.size });
|
|
@@ -8920,7 +8928,7 @@ var Ct = K(Mn, Bn, (s3) => new rt(s3), (s3) => new rt(s3), (s3, t) => {
|
|
|
8920
8928
|
t?.length && Qi(s3, t), s3.noResume || vn(s3);
|
|
8921
8929
|
});
|
|
8922
8930
|
var Ji = (s3, t, e) => (s3 &= 4095, e && (s3 = (s3 | 384) & -19), t && (s3 & 256 && (s3 |= 64), s3 & 32 && (s3 |= 8), s3 & 4 && (s3 |= 1)), s3);
|
|
8923
|
-
var { isAbsolute: zn, parse: qs } =
|
|
8931
|
+
var { isAbsolute: zn, parse: qs } = import_node_path7.win32;
|
|
8924
8932
|
var ce = (s3) => {
|
|
8925
8933
|
let t = "", e = qs(s3);
|
|
8926
8934
|
for (; zn(s3) || e.root; ) {
|
|
@@ -9629,11 +9637,11 @@ var $n = (s3, t) => {
|
|
|
9629
9637
|
};
|
|
9630
9638
|
var fr = (s3, t) => {
|
|
9631
9639
|
t.forEach((e) => {
|
|
9632
|
-
e.charAt(0) === "@" ? Ct({ file:
|
|
9640
|
+
e.charAt(0) === "@" ? Ct({ file: import_node_path4.default.resolve(s3.cwd, e.slice(1)), sync: true, noResume: true, onReadEntry: (i) => s3.add(i) }) : s3.add(e);
|
|
9633
9641
|
}), s3.end();
|
|
9634
9642
|
};
|
|
9635
9643
|
var dr = async (s3, t) => {
|
|
9636
|
-
for (let e of t) e.charAt(0) === "@" ? await Ct({ file:
|
|
9644
|
+
for (let e of t) e.charAt(0) === "@" ? await Ct({ file: import_node_path4.default.resolve(String(s3.cwd), e.slice(1)), noResume: true, onReadEntry: (i) => {
|
|
9637
9645
|
s3.add(i);
|
|
9638
9646
|
} }) : s3.add(e);
|
|
9639
9647
|
s3.end();
|
|
@@ -9660,29 +9668,29 @@ var mr = !Er && typeof ur == "number" ? ur | Sr | wr | yr : null;
|
|
|
9660
9668
|
var ms = mr !== null ? () => mr : jn ? (s3) => s3 < to ? eo : "w" : () => "w";
|
|
9661
9669
|
var ps = (s3, t, e) => {
|
|
9662
9670
|
try {
|
|
9663
|
-
return
|
|
9671
|
+
return import_node_fs7.default.lchownSync(s3, t, e);
|
|
9664
9672
|
} catch (i) {
|
|
9665
9673
|
if (i?.code !== "ENOENT") throw i;
|
|
9666
9674
|
}
|
|
9667
9675
|
};
|
|
9668
9676
|
var Ei = (s3, t, e, i) => {
|
|
9669
|
-
|
|
9677
|
+
import_node_fs7.default.lchown(s3, t, e, (r) => {
|
|
9670
9678
|
i(r && r?.code !== "ENOENT" ? r : null);
|
|
9671
9679
|
});
|
|
9672
9680
|
};
|
|
9673
9681
|
var io = (s3, t, e, i, r) => {
|
|
9674
|
-
if (t.isDirectory()) Es(
|
|
9682
|
+
if (t.isDirectory()) Es(import_node_path9.default.resolve(s3, t.name), e, i, (n) => {
|
|
9675
9683
|
if (n) return r(n);
|
|
9676
|
-
let o =
|
|
9684
|
+
let o = import_node_path9.default.resolve(s3, t.name);
|
|
9677
9685
|
Ei(o, e, i, r);
|
|
9678
9686
|
});
|
|
9679
9687
|
else {
|
|
9680
|
-
let n =
|
|
9688
|
+
let n = import_node_path9.default.resolve(s3, t.name);
|
|
9681
9689
|
Ei(n, e, i, r);
|
|
9682
9690
|
}
|
|
9683
9691
|
};
|
|
9684
9692
|
var Es = (s3, t, e, i) => {
|
|
9685
|
-
|
|
9693
|
+
import_node_fs7.default.readdir(s3, { withFileTypes: true }, (r, n) => {
|
|
9686
9694
|
if (r) {
|
|
9687
9695
|
if (r.code === "ENOENT") return i();
|
|
9688
9696
|
if (r.code !== "ENOTDIR" && r.code !== "ENOTSUP") return i(r);
|
|
@@ -9698,12 +9706,12 @@ var Es = (s3, t, e, i) => {
|
|
|
9698
9706
|
});
|
|
9699
9707
|
};
|
|
9700
9708
|
var so = (s3, t, e, i) => {
|
|
9701
|
-
t.isDirectory() && ws(
|
|
9709
|
+
t.isDirectory() && ws(import_node_path9.default.resolve(s3, t.name), e, i), ps(import_node_path9.default.resolve(s3, t.name), e, i);
|
|
9702
9710
|
};
|
|
9703
9711
|
var ws = (s3, t, e) => {
|
|
9704
9712
|
let i;
|
|
9705
9713
|
try {
|
|
9706
|
-
i =
|
|
9714
|
+
i = import_node_fs7.default.readdirSync(s3, { withFileTypes: true });
|
|
9707
9715
|
} catch (r) {
|
|
9708
9716
|
let n = r;
|
|
9709
9717
|
if (n?.code === "ENOENT") return;
|
|
@@ -9737,32 +9745,32 @@ var St = class extends Error {
|
|
|
9737
9745
|
}
|
|
9738
9746
|
};
|
|
9739
9747
|
var no = (s3, t) => {
|
|
9740
|
-
|
|
9748
|
+
import_node_fs8.default.stat(s3, (e, i) => {
|
|
9741
9749
|
(e || !i.isDirectory()) && (e = new Se(s3, e?.code || "ENOTDIR")), t(e);
|
|
9742
9750
|
});
|
|
9743
9751
|
};
|
|
9744
9752
|
var gr = (s3, t, e) => {
|
|
9745
9753
|
s3 = f(s3);
|
|
9746
9754
|
let i = t.umask ?? 18, r = t.mode | 448, n = (r & i) !== 0, o = t.uid, h = t.gid, a = typeof o == "number" && typeof h == "number" && (o !== t.processUid || h !== t.processGid), l = t.preserve, c = t.unlink, d = f(t.cwd), y = (E, x) => {
|
|
9747
|
-
E ? e(E) : x && a ? Es(x, o, h, (Le) => y(Le)) : n ?
|
|
9755
|
+
E ? e(E) : x && a ? Es(x, o, h, (Le) => y(Le)) : n ? import_node_fs8.default.chmod(s3, r, e) : e();
|
|
9748
9756
|
};
|
|
9749
9757
|
if (s3 === d) return no(s3, y);
|
|
9750
9758
|
if (l) return import_promises.default.mkdir(s3, { mode: r, recursive: true }).then((E) => y(null, E ?? void 0), y);
|
|
9751
|
-
let D = f(
|
|
9759
|
+
let D = f(import_node_path10.default.relative(d, s3)).split("/");
|
|
9752
9760
|
Ss(d, D, r, c, d, void 0, y);
|
|
9753
9761
|
};
|
|
9754
9762
|
var Ss = (s3, t, e, i, r, n, o) => {
|
|
9755
9763
|
if (t.length === 0) return o(null, n);
|
|
9756
|
-
let h = t.shift(), a = f(
|
|
9757
|
-
|
|
9764
|
+
let h = t.shift(), a = f(import_node_path10.default.resolve(s3 + "/" + h));
|
|
9765
|
+
import_node_fs8.default.mkdir(a, e, br(a, t, e, i, r, n, o));
|
|
9758
9766
|
};
|
|
9759
9767
|
var br = (s3, t, e, i, r, n, o) => (h) => {
|
|
9760
|
-
h ?
|
|
9768
|
+
h ? import_node_fs8.default.lstat(s3, (a, l) => {
|
|
9761
9769
|
if (a) a.path = a.path && f(a.path), o(a);
|
|
9762
9770
|
else if (l.isDirectory()) Ss(s3, t, e, i, r, n, o);
|
|
9763
|
-
else if (i)
|
|
9771
|
+
else if (i) import_node_fs8.default.unlink(s3, (c) => {
|
|
9764
9772
|
if (c) return o(c);
|
|
9765
|
-
|
|
9773
|
+
import_node_fs8.default.mkdir(s3, e, br(s3, t, e, i, r, n, o));
|
|
9766
9774
|
});
|
|
9767
9775
|
else {
|
|
9768
9776
|
if (l.isSymbolicLink()) return o(new St(s3, s3 + "/" + t.join("/")));
|
|
@@ -9773,7 +9781,7 @@ var br = (s3, t, e, i, r, n, o) => (h) => {
|
|
|
9773
9781
|
var oo = (s3) => {
|
|
9774
9782
|
let t = false, e;
|
|
9775
9783
|
try {
|
|
9776
|
-
t =
|
|
9784
|
+
t = import_node_fs8.default.statSync(s3).isDirectory();
|
|
9777
9785
|
} catch (i) {
|
|
9778
9786
|
e = i?.code;
|
|
9779
9787
|
} finally {
|
|
@@ -9783,20 +9791,20 @@ var oo = (s3) => {
|
|
|
9783
9791
|
var _r = (s3, t) => {
|
|
9784
9792
|
s3 = f(s3);
|
|
9785
9793
|
let e = t.umask ?? 18, i = t.mode | 448, r = (i & e) !== 0, n = t.uid, o = t.gid, h = typeof n == "number" && typeof o == "number" && (n !== t.processUid || o !== t.processGid), a = t.preserve, l = t.unlink, c = f(t.cwd), d = (E) => {
|
|
9786
|
-
E && h && ws(E, n, o), r &&
|
|
9794
|
+
E && h && ws(E, n, o), r && import_node_fs8.default.chmodSync(s3, i);
|
|
9787
9795
|
};
|
|
9788
9796
|
if (s3 === c) return oo(c), d();
|
|
9789
|
-
if (a) return d(
|
|
9790
|
-
let T = f(
|
|
9797
|
+
if (a) return d(import_node_fs8.default.mkdirSync(s3, { mode: i, recursive: true }) ?? void 0);
|
|
9798
|
+
let T = f(import_node_path10.default.relative(c, s3)).split("/"), D;
|
|
9791
9799
|
for (let E = T.shift(), x = c; E && (x += "/" + E); E = T.shift()) {
|
|
9792
|
-
x = f(
|
|
9800
|
+
x = f(import_node_path10.default.resolve(x));
|
|
9793
9801
|
try {
|
|
9794
|
-
|
|
9802
|
+
import_node_fs8.default.mkdirSync(x, i), D = D || x;
|
|
9795
9803
|
} catch {
|
|
9796
|
-
let Le =
|
|
9804
|
+
let Le = import_node_fs8.default.lstatSync(x);
|
|
9797
9805
|
if (Le.isDirectory()) continue;
|
|
9798
9806
|
if (l) {
|
|
9799
|
-
|
|
9807
|
+
import_node_fs8.default.unlinkSync(x), import_node_fs8.default.mkdirSync(x, i), D = D || x;
|
|
9800
9808
|
continue;
|
|
9801
9809
|
} else if (Le.isSymbolicLink()) return new St(x, x + "/" + T.join("/"));
|
|
9802
9810
|
}
|
|
@@ -9818,14 +9826,14 @@ var ho = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform;
|
|
|
9818
9826
|
var ao = ho === "win32";
|
|
9819
9827
|
var lo = (s3) => s3.split("/").slice(0, -1).reduce((e, i) => {
|
|
9820
9828
|
let r = e.at(-1);
|
|
9821
|
-
return r !== void 0 && (i = (0,
|
|
9829
|
+
return r !== void 0 && (i = (0, import_node_path11.join)(r, i)), e.push(i || "/"), e;
|
|
9822
9830
|
}, []);
|
|
9823
9831
|
var yi = class {
|
|
9824
9832
|
#t = /* @__PURE__ */ new Map();
|
|
9825
9833
|
#i = /* @__PURE__ */ new Map();
|
|
9826
9834
|
#s = /* @__PURE__ */ new Set();
|
|
9827
9835
|
reserve(t, e) {
|
|
9828
|
-
t = ao ? ["win32 parallelization disabled"] : t.map((r) => mt((0,
|
|
9836
|
+
t = ao ? ["win32 parallelization disabled"] : t.map((r) => mt((0, import_node_path11.join)(Tr(r))));
|
|
9829
9837
|
let i = new Set(t.map((r) => lo(r)).reduce((r, n) => r.concat(n)));
|
|
9830
9838
|
this.#i.set(e, { dirs: i, paths: t });
|
|
9831
9839
|
for (let r of t) {
|
|
@@ -9915,17 +9923,17 @@ var fo = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform;
|
|
|
9915
9923
|
var Te = fo === "win32";
|
|
9916
9924
|
var uo = 1024;
|
|
9917
9925
|
var mo = (s3, t) => {
|
|
9918
|
-
if (!Te) return
|
|
9926
|
+
if (!Te) return import_node_fs6.default.unlink(s3, t);
|
|
9919
9927
|
let e = s3 + ".DELETE." + (0, import_node_crypto3.randomBytes)(16).toString("hex");
|
|
9920
|
-
|
|
9928
|
+
import_node_fs6.default.rename(s3, e, (i) => {
|
|
9921
9929
|
if (i) return t(i);
|
|
9922
|
-
|
|
9930
|
+
import_node_fs6.default.unlink(e, t);
|
|
9923
9931
|
});
|
|
9924
9932
|
};
|
|
9925
9933
|
var po = (s3) => {
|
|
9926
|
-
if (!Te) return
|
|
9934
|
+
if (!Te) return import_node_fs6.default.unlinkSync(s3);
|
|
9927
9935
|
let t = s3 + ".DELETE." + (0, import_node_crypto3.randomBytes)(16).toString("hex");
|
|
9928
|
-
|
|
9936
|
+
import_node_fs6.default.renameSync(s3, t), import_node_fs6.default.unlinkSync(t);
|
|
9929
9937
|
};
|
|
9930
9938
|
var vr = (s3, t, e) => s3 !== void 0 && s3 === s3 >>> 0 ? s3 : t !== void 0 && t === t >>> 0 ? t : e;
|
|
9931
9939
|
var Xt = class extends rt {
|
|
@@ -9965,7 +9973,7 @@ var Xt = class extends rt {
|
|
|
9965
9973
|
if (t.preserveOwner) throw new TypeError("cannot preserve owner in archive and also set owner explicitly");
|
|
9966
9974
|
this.uid = t.uid, this.gid = t.gid, this.setOwner = true;
|
|
9967
9975
|
} else this.uid = void 0, this.gid = void 0, this.setOwner = false;
|
|
9968
|
-
this.preserveOwner = t.preserveOwner === void 0 && typeof t.uid != "number" ? process.getuid?.() === 0 : !!t.preserveOwner, this.processUid = (this.preserveOwner || this.setOwner) && process.getuid ? process.getuid() : void 0, this.processGid = (this.preserveOwner || this.setOwner) && process.getgid ? process.getgid() : void 0, this.maxDepth = typeof t.maxDepth == "number" ? t.maxDepth : uo, this.forceChown = t.forceChown === true, this.win32 = !!t.win32 || Te, this.newer = !!t.newer, this.keep = !!t.keep, this.noMtime = !!t.noMtime, this.preservePaths = !!t.preservePaths, this.unlink = !!t.unlink, this.cwd = f(
|
|
9976
|
+
this.preserveOwner = t.preserveOwner === void 0 && typeof t.uid != "number" ? process.getuid?.() === 0 : !!t.preserveOwner, this.processUid = (this.preserveOwner || this.setOwner) && process.getuid ? process.getuid() : void 0, this.processGid = (this.preserveOwner || this.setOwner) && process.getgid ? process.getgid() : void 0, this.maxDepth = typeof t.maxDepth == "number" ? t.maxDepth : uo, this.forceChown = t.forceChown === true, this.win32 = !!t.win32 || Te, this.newer = !!t.newer, this.keep = !!t.keep, this.noMtime = !!t.noMtime, this.preservePaths = !!t.preservePaths, this.unlink = !!t.unlink, this.cwd = f(import_node_path8.default.resolve(t.cwd || process.cwd())), this.strip = Number(t.strip) || 0, this.processUmask = this.chmod ? typeof t.processUmask == "number" ? t.processUmask : Lr() : 0, this.umask = typeof t.umask == "number" ? t.umask : this.processUmask, this.dmode = t.dmode || 511 & ~this.umask, this.fmode = t.fmode || 438 & ~this.umask, this.on("entry", (e) => this[Dr](e));
|
|
9969
9977
|
}
|
|
9970
9978
|
warn(t, e, i = {}) {
|
|
9971
9979
|
return (t === "TAR_BAD_ARCHIVE" || t === "TAR_ABORT") && (i.recoverable = false), super.warn(t, e, i);
|
|
@@ -9979,7 +9987,7 @@ var Xt = class extends rt {
|
|
|
9979
9987
|
let [n, o] = ce(i), h = o.replaceAll(/\\/g, "/").split("/");
|
|
9980
9988
|
if (h.includes("..") || Te && /^[a-z]:\.\.$/i.test(h[0] ?? "")) {
|
|
9981
9989
|
if (e === "path" || r === "Link") return this.warn("TAR_ENTRY_ERROR", `${e} contains '..'`, { entry: t, [e]: i }), false;
|
|
9982
|
-
let a =
|
|
9990
|
+
let a = import_node_path8.default.posix.dirname(t.path), l = import_node_path8.default.posix.normalize(import_node_path8.default.posix.join(a, h.join("/")));
|
|
9983
9991
|
if (l.startsWith("../") || l === "..") return this.warn("TAR_ENTRY_ERROR", `${e} escapes extraction directory`, { entry: t, [e]: i }), false;
|
|
9984
9992
|
}
|
|
9985
9993
|
return n && (t[e] = String(o), this.warn("TAR_ENTRY_INFO", `stripping ${n} from absolute ${e}`, { entry: t, [e]: i })), true;
|
|
@@ -9997,12 +10005,12 @@ var Xt = class extends rt {
|
|
|
9997
10005
|
}
|
|
9998
10006
|
if (isFinite(this.maxDepth) && i.length > this.maxDepth) return this.warn("TAR_ENTRY_ERROR", "path excessively deep", { entry: t, path: e, depth: i.length, maxDepth: this.maxDepth }), false;
|
|
9999
10007
|
if (!this[Rs](t, "path") || !this[Rs](t, "linkpath")) return false;
|
|
10000
|
-
if (t.absolute =
|
|
10008
|
+
if (t.absolute = import_node_path8.default.isAbsolute(t.path) ? f(import_node_path8.default.resolve(t.path)) : f(import_node_path8.default.resolve(this.cwd, t.path)), !this.preservePaths && typeof t.absolute == "string" && t.absolute.indexOf(this.cwd + "/") !== 0 && t.absolute !== this.cwd) return this.warn("TAR_ENTRY_ERROR", "path escaped extraction target", { entry: t, path: f(t.path), resolvedPath: t.absolute, cwd: this.cwd }), false;
|
|
10001
10009
|
if (t.absolute === this.cwd && t.type !== "Directory" && t.type !== "GNUDumpDir") return false;
|
|
10002
10010
|
if (this.win32) {
|
|
10003
|
-
let { root: r } =
|
|
10011
|
+
let { root: r } = import_node_path8.default.win32.parse(String(t.absolute));
|
|
10004
10012
|
t.absolute = r + ts(String(t.absolute).slice(r.length));
|
|
10005
|
-
let { root: n } =
|
|
10013
|
+
let { root: n } = import_node_path8.default.win32.parse(t.path);
|
|
10006
10014
|
t.path = n + ts(t.path.slice(n.length));
|
|
10007
10015
|
}
|
|
10008
10016
|
return true;
|
|
@@ -10041,16 +10049,16 @@ var Xt = class extends rt {
|
|
|
10041
10049
|
[Ts](t, e) {
|
|
10042
10050
|
let i = typeof t.mode == "number" ? t.mode & 4095 : this.fmode, r = new et(String(t.absolute), { flags: ms(t.size), mode: i, autoClose: false });
|
|
10043
10051
|
r.on("error", (a) => {
|
|
10044
|
-
r.fd &&
|
|
10052
|
+
r.fd && import_node_fs6.default.close(r.fd, () => {
|
|
10045
10053
|
}), r.write = () => true, this[O](a, t), e();
|
|
10046
10054
|
});
|
|
10047
10055
|
let n = 1, o = (a) => {
|
|
10048
10056
|
if (a) {
|
|
10049
|
-
r.fd &&
|
|
10057
|
+
r.fd && import_node_fs6.default.close(r.fd, () => {
|
|
10050
10058
|
}), this[O](a, t), e();
|
|
10051
10059
|
return;
|
|
10052
10060
|
}
|
|
10053
|
-
--n === 0 && r.fd !== void 0 &&
|
|
10061
|
+
--n === 0 && r.fd !== void 0 && import_node_fs6.default.close(r.fd, (l) => {
|
|
10054
10062
|
l ? this[O](l, t) : this[$t](), e();
|
|
10055
10063
|
});
|
|
10056
10064
|
};
|
|
@@ -10059,12 +10067,12 @@ var Xt = class extends rt {
|
|
|
10059
10067
|
if (typeof l == "number" && t.mtime && !this.noMtime) {
|
|
10060
10068
|
n++;
|
|
10061
10069
|
let c = t.atime || /* @__PURE__ */ new Date(), d = t.mtime;
|
|
10062
|
-
|
|
10070
|
+
import_node_fs6.default.futimes(l, c, d, (y) => y ? import_node_fs6.default.utimes(a, c, d, (T) => o(T && y)) : o());
|
|
10063
10071
|
}
|
|
10064
10072
|
if (typeof l == "number" && this[ge](t)) {
|
|
10065
10073
|
n++;
|
|
10066
10074
|
let c = this[be](t), d = this[_e](t);
|
|
10067
|
-
typeof c == "number" && typeof d == "number" &&
|
|
10075
|
+
typeof c == "number" && typeof d == "number" && import_node_fs6.default.fchown(l, c, d, (y) => y ? import_node_fs6.default.chown(a, c, d, (T) => o(T && y)) : o());
|
|
10068
10076
|
}
|
|
10069
10077
|
o();
|
|
10070
10078
|
});
|
|
@@ -10083,20 +10091,20 @@ var Xt = class extends rt {
|
|
|
10083
10091
|
let n = 1, o = () => {
|
|
10084
10092
|
--n === 0 && (e(), this[$t](), t.resume());
|
|
10085
10093
|
};
|
|
10086
|
-
t.mtime && !this.noMtime && (n++,
|
|
10094
|
+
t.mtime && !this.noMtime && (n++, import_node_fs6.default.utimes(String(t.absolute), t.atime || /* @__PURE__ */ new Date(), t.mtime, o)), this[ge](t) && (n++, import_node_fs6.default.chown(String(t.absolute), Number(this[be](t)), Number(this[_e](t)), o)), o();
|
|
10087
10095
|
});
|
|
10088
10096
|
}
|
|
10089
10097
|
[Cr](t) {
|
|
10090
10098
|
t.unsupported = true, this.warn("TAR_ENTRY_UNSUPPORTED", `unsupported entry type: ${t.type}`, { entry: t }), t.resume();
|
|
10091
10099
|
}
|
|
10092
10100
|
[Ar](t, e) {
|
|
10093
|
-
let i = f(
|
|
10101
|
+
let i = f(import_node_path8.default.relative(this.cwd, import_node_path8.default.resolve(import_node_path8.default.dirname(String(t.absolute)), String(t.linkpath)))).split("/");
|
|
10094
10102
|
this[Re](t, this.cwd, i, () => this[gi](t, String(t.linkpath), "symlink", e), (r) => {
|
|
10095
10103
|
this[O](r, t), e();
|
|
10096
10104
|
});
|
|
10097
10105
|
}
|
|
10098
10106
|
[Ir](t, e) {
|
|
10099
|
-
let i = f(
|
|
10107
|
+
let i = f(import_node_path8.default.resolve(this.cwd, String(t.linkpath))), r = f(String(t.linkpath)).split("/");
|
|
10100
10108
|
this[Re](t, this.cwd, r, () => this[gi](t, i, "link", e), (n) => {
|
|
10101
10109
|
this[O](n, t), e();
|
|
10102
10110
|
});
|
|
@@ -10104,10 +10112,10 @@ var Xt = class extends rt {
|
|
|
10104
10112
|
[Re](t, e, i, r, n) {
|
|
10105
10113
|
let o = i.shift();
|
|
10106
10114
|
if (this.preservePaths || o === void 0) return r();
|
|
10107
|
-
let h =
|
|
10108
|
-
|
|
10115
|
+
let h = import_node_path8.default.resolve(e, o);
|
|
10116
|
+
import_node_fs6.default.lstat(h, (a, l) => {
|
|
10109
10117
|
if (a) return r();
|
|
10110
|
-
if (l?.isSymbolicLink()) return n(new St(h,
|
|
10118
|
+
if (l?.isSymbolicLink()) return n(new St(h, import_node_path8.default.resolve(h, i.join("/"))));
|
|
10111
10119
|
this[Re](t, h, i, r, n);
|
|
10112
10120
|
});
|
|
10113
10121
|
}
|
|
@@ -10141,7 +10149,7 @@ var Xt = class extends rt {
|
|
|
10141
10149
|
});
|
|
10142
10150
|
}, n = () => {
|
|
10143
10151
|
if (t.absolute !== this.cwd) {
|
|
10144
|
-
let h = f(
|
|
10152
|
+
let h = f(import_node_path8.default.dirname(String(t.absolute)));
|
|
10145
10153
|
if (h !== this.cwd) return this[yt](h, this.dmode, (a) => {
|
|
10146
10154
|
if (a) {
|
|
10147
10155
|
this[O](a, t), i();
|
|
@@ -10152,7 +10160,7 @@ var Xt = class extends rt {
|
|
|
10152
10160
|
}
|
|
10153
10161
|
o();
|
|
10154
10162
|
}, o = () => {
|
|
10155
|
-
|
|
10163
|
+
import_node_fs6.default.lstat(String(t.absolute), (h, a) => {
|
|
10156
10164
|
if (a && (this.keep || this.newer && a.mtime > (t.mtime ?? a.mtime))) {
|
|
10157
10165
|
this[Ls](t), i();
|
|
10158
10166
|
return;
|
|
@@ -10161,9 +10169,9 @@ var Xt = class extends rt {
|
|
|
10161
10169
|
if (a.isDirectory()) {
|
|
10162
10170
|
if (t.type === "Directory") {
|
|
10163
10171
|
let l = this.chmod && t.mode && (a.mode & 4095) !== t.mode, c = (d) => this[P](d ?? null, t, i);
|
|
10164
|
-
return l ?
|
|
10172
|
+
return l ? import_node_fs6.default.chmod(String(t.absolute), Number(t.mode), c) : c();
|
|
10165
10173
|
}
|
|
10166
|
-
if (t.absolute !== this.cwd) return
|
|
10174
|
+
if (t.absolute !== this.cwd) return import_node_fs6.default.rmdir(String(t.absolute), (l) => this[P](l ?? null, t, i));
|
|
10167
10175
|
}
|
|
10168
10176
|
if (t.absolute === this.cwd) return this[P](null, t, i);
|
|
10169
10177
|
mo(String(t.absolute), (l) => this[P](l ?? null, t, i));
|
|
@@ -10191,7 +10199,7 @@ var Xt = class extends rt {
|
|
|
10191
10199
|
}
|
|
10192
10200
|
}
|
|
10193
10201
|
[gi](t, e, i, r) {
|
|
10194
|
-
|
|
10202
|
+
import_node_fs6.default[i](e, String(t.absolute), (n) => {
|
|
10195
10203
|
n ? this[O](n, t) : (this[$t](), t.resume()), r();
|
|
10196
10204
|
});
|
|
10197
10205
|
}
|
|
@@ -10216,23 +10224,23 @@ var xe = class extends Xt {
|
|
|
10216
10224
|
this[Oe] = true;
|
|
10217
10225
|
}
|
|
10218
10226
|
if (t.absolute !== this.cwd) {
|
|
10219
|
-
let n = f(
|
|
10227
|
+
let n = f(import_node_path8.default.dirname(String(t.absolute)));
|
|
10220
10228
|
if (n !== this.cwd) {
|
|
10221
10229
|
let o = this[yt](n, this.dmode);
|
|
10222
10230
|
if (o) return this[O](o, t);
|
|
10223
10231
|
}
|
|
10224
10232
|
}
|
|
10225
|
-
let [e, i] = ye(() =>
|
|
10233
|
+
let [e, i] = ye(() => import_node_fs6.default.lstatSync(String(t.absolute)));
|
|
10226
10234
|
if (i && (this.keep || this.newer && i.mtime > (t.mtime ?? i.mtime))) return this[Ls](t);
|
|
10227
10235
|
if (e || this[Os](t, i)) return this[P](null, t);
|
|
10228
10236
|
if (i.isDirectory()) {
|
|
10229
10237
|
if (t.type === "Directory") {
|
|
10230
10238
|
let o = this.chmod && t.mode && (i.mode & 4095) !== t.mode, [h] = o ? ye(() => {
|
|
10231
|
-
|
|
10239
|
+
import_node_fs6.default.chmodSync(String(t.absolute), Number(t.mode));
|
|
10232
10240
|
}) : [];
|
|
10233
10241
|
return this[P](h, t);
|
|
10234
10242
|
}
|
|
10235
|
-
let [n] = ye(() =>
|
|
10243
|
+
let [n] = ye(() => import_node_fs6.default.rmdirSync(String(t.absolute)));
|
|
10236
10244
|
this[P](n, t);
|
|
10237
10245
|
}
|
|
10238
10246
|
let [r] = t.absolute === this.cwd ? [] : ye(() => po(String(t.absolute)));
|
|
@@ -10242,21 +10250,21 @@ var xe = class extends Xt {
|
|
|
10242
10250
|
let i = typeof t.mode == "number" ? t.mode & 4095 : this.fmode, r = (h) => {
|
|
10243
10251
|
let a;
|
|
10244
10252
|
try {
|
|
10245
|
-
|
|
10253
|
+
import_node_fs6.default.closeSync(n);
|
|
10246
10254
|
} catch (l) {
|
|
10247
10255
|
a = l;
|
|
10248
10256
|
}
|
|
10249
10257
|
(h || a) && this[O](h || a, t), e();
|
|
10250
10258
|
}, n;
|
|
10251
10259
|
try {
|
|
10252
|
-
n =
|
|
10260
|
+
n = import_node_fs6.default.openSync(String(t.absolute), ms(t.size), i);
|
|
10253
10261
|
} catch (h) {
|
|
10254
10262
|
return r(h);
|
|
10255
10263
|
}
|
|
10256
10264
|
let o = this.transform && this.transform(t) || t;
|
|
10257
10265
|
o !== t && (o.on("error", (h) => this[O](h, t)), t.pipe(o)), o.on("data", (h) => {
|
|
10258
10266
|
try {
|
|
10259
|
-
|
|
10267
|
+
import_node_fs6.default.writeSync(n, h, 0, h.length);
|
|
10260
10268
|
} catch (a) {
|
|
10261
10269
|
r(a);
|
|
10262
10270
|
}
|
|
@@ -10265,10 +10273,10 @@ var xe = class extends Xt {
|
|
|
10265
10273
|
if (t.mtime && !this.noMtime) {
|
|
10266
10274
|
let a = t.atime || /* @__PURE__ */ new Date(), l = t.mtime;
|
|
10267
10275
|
try {
|
|
10268
|
-
|
|
10276
|
+
import_node_fs6.default.futimesSync(n, a, l);
|
|
10269
10277
|
} catch (c) {
|
|
10270
10278
|
try {
|
|
10271
|
-
|
|
10279
|
+
import_node_fs6.default.utimesSync(String(t.absolute), a, l);
|
|
10272
10280
|
} catch {
|
|
10273
10281
|
h = c;
|
|
10274
10282
|
}
|
|
@@ -10277,10 +10285,10 @@ var xe = class extends Xt {
|
|
|
10277
10285
|
if (this[ge](t)) {
|
|
10278
10286
|
let a = this[be](t), l = this[_e](t);
|
|
10279
10287
|
try {
|
|
10280
|
-
|
|
10288
|
+
import_node_fs6.default.fchownSync(n, Number(a), Number(l));
|
|
10281
10289
|
} catch (c) {
|
|
10282
10290
|
try {
|
|
10283
|
-
|
|
10291
|
+
import_node_fs6.default.chownSync(String(t.absolute), Number(a), Number(l));
|
|
10284
10292
|
} catch {
|
|
10285
10293
|
h = h || c;
|
|
10286
10294
|
}
|
|
@@ -10296,11 +10304,11 @@ var xe = class extends Xt {
|
|
|
10296
10304
|
return;
|
|
10297
10305
|
}
|
|
10298
10306
|
if (t.mtime && !this.noMtime) try {
|
|
10299
|
-
|
|
10307
|
+
import_node_fs6.default.utimesSync(String(t.absolute), t.atime || /* @__PURE__ */ new Date(), t.mtime);
|
|
10300
10308
|
} catch {
|
|
10301
10309
|
}
|
|
10302
10310
|
if (this[ge](t)) try {
|
|
10303
|
-
|
|
10311
|
+
import_node_fs6.default.chownSync(String(t.absolute), Number(this[be](t)), Number(this[_e](t)));
|
|
10304
10312
|
} catch {
|
|
10305
10313
|
}
|
|
10306
10314
|
e(), t.resume();
|
|
@@ -10316,30 +10324,30 @@ var xe = class extends Xt {
|
|
|
10316
10324
|
if (this.preservePaths || i.length === 0) return r();
|
|
10317
10325
|
let o = e;
|
|
10318
10326
|
for (let h of i) {
|
|
10319
|
-
o =
|
|
10320
|
-
let [a, l] = ye(() =>
|
|
10327
|
+
o = import_node_path8.default.resolve(o, h);
|
|
10328
|
+
let [a, l] = ye(() => import_node_fs6.default.lstatSync(o));
|
|
10321
10329
|
if (a) return r();
|
|
10322
|
-
if (l.isSymbolicLink()) return n(new St(o,
|
|
10330
|
+
if (l.isSymbolicLink()) return n(new St(o, import_node_path8.default.resolve(e, i.join("/"))));
|
|
10323
10331
|
}
|
|
10324
10332
|
r();
|
|
10325
10333
|
}
|
|
10326
10334
|
[gi](t, e, i, r) {
|
|
10327
10335
|
let n = `${i}Sync`;
|
|
10328
10336
|
try {
|
|
10329
|
-
|
|
10337
|
+
import_node_fs6.default[n](e, String(t.absolute)), r(), t.resume();
|
|
10330
10338
|
} catch (o) {
|
|
10331
10339
|
return this[O](o, t);
|
|
10332
10340
|
}
|
|
10333
10341
|
}
|
|
10334
10342
|
};
|
|
10335
10343
|
var Eo = (s3) => {
|
|
10336
|
-
let t = new xe(s3), e = s3.file, i =
|
|
10344
|
+
let t = new xe(s3), e = s3.file, i = import_node_fs5.default.statSync(e), r = s3.maxReadSize || 16 * 1024 * 1024;
|
|
10337
10345
|
new Be(e, { readSize: r, size: i.size }).pipe(t);
|
|
10338
10346
|
};
|
|
10339
10347
|
var wo = (s3, t) => {
|
|
10340
10348
|
let e = new Xt(s3), i = s3.maxReadSize || 16 * 1024 * 1024, r = s3.file;
|
|
10341
10349
|
return new Promise((o, h) => {
|
|
10342
|
-
e.on("error", h), e.on("close", o),
|
|
10350
|
+
e.on("error", h), e.on("close", o), import_node_fs5.default.stat(r, (a, l) => {
|
|
10343
10351
|
if (a) h(a);
|
|
10344
10352
|
else {
|
|
10345
10353
|
let c = new _t(r, { readSize: i, size: l.size });
|
|
@@ -10355,15 +10363,15 @@ var yo = (s3, t) => {
|
|
|
10355
10363
|
let e = new kt(s3), i = true, r, n;
|
|
10356
10364
|
try {
|
|
10357
10365
|
try {
|
|
10358
|
-
r =
|
|
10366
|
+
r = import_node_fs9.default.openSync(s3.file, "r+");
|
|
10359
10367
|
} catch (a) {
|
|
10360
|
-
if (a?.code === "ENOENT") r =
|
|
10368
|
+
if (a?.code === "ENOENT") r = import_node_fs9.default.openSync(s3.file, "w+");
|
|
10361
10369
|
else throw a;
|
|
10362
10370
|
}
|
|
10363
|
-
let o =
|
|
10371
|
+
let o = import_node_fs9.default.fstatSync(r), h = Buffer.alloc(512);
|
|
10364
10372
|
t: for (n = 0; n < o.size; n += 512) {
|
|
10365
10373
|
for (let c = 0, d = 0; c < 512; c += d) {
|
|
10366
|
-
if (d =
|
|
10374
|
+
if (d = import_node_fs9.default.readSync(r, h, c, h.length - c, n + c), n === 0 && h[0] === 31 && h[1] === 139) throw new Error("cannot append to compressed archives");
|
|
10367
10375
|
if (!d) break t;
|
|
10368
10376
|
}
|
|
10369
10377
|
let a = new F(h);
|
|
@@ -10375,7 +10383,7 @@ var yo = (s3, t) => {
|
|
|
10375
10383
|
i = false, Ro(s3, e, n, r, t);
|
|
10376
10384
|
} finally {
|
|
10377
10385
|
if (i) try {
|
|
10378
|
-
|
|
10386
|
+
import_node_fs9.default.closeSync(r);
|
|
10379
10387
|
} catch {
|
|
10380
10388
|
}
|
|
10381
10389
|
}
|
|
@@ -10388,29 +10396,29 @@ var go = (s3, t) => {
|
|
|
10388
10396
|
t = Array.from(t);
|
|
10389
10397
|
let e = new wt(s3), i = (n, o, h) => {
|
|
10390
10398
|
let a = (T, D) => {
|
|
10391
|
-
T ?
|
|
10399
|
+
T ? import_node_fs9.default.close(n, (E) => h(T)) : h(null, D);
|
|
10392
10400
|
}, l = 0;
|
|
10393
10401
|
if (o === 0) return a(null, 0);
|
|
10394
10402
|
let c = 0, d = Buffer.alloc(512), y = (T, D) => {
|
|
10395
10403
|
if (T || D === void 0) return a(T);
|
|
10396
|
-
if (c += D, c < 512 && D) return
|
|
10404
|
+
if (c += D, c < 512 && D) return import_node_fs9.default.read(n, d, c, d.length - c, l + c, y);
|
|
10397
10405
|
if (l === 0 && d[0] === 31 && d[1] === 139) return a(new Error("cannot append to compressed archives"));
|
|
10398
10406
|
if (c < 512) return a(null, l);
|
|
10399
10407
|
let E = new F(d);
|
|
10400
10408
|
if (!E.cksumValid) return a(null, l);
|
|
10401
10409
|
let x = 512 * Math.ceil((E.size ?? 0) / 512);
|
|
10402
10410
|
if (l + x + 512 > o || (l += x + 512, l >= o)) return a(null, l);
|
|
10403
|
-
s3.mtimeCache && E.mtime && s3.mtimeCache.set(String(E.path), E.mtime), c = 0,
|
|
10411
|
+
s3.mtimeCache && E.mtime && s3.mtimeCache.set(String(E.path), E.mtime), c = 0, import_node_fs9.default.read(n, d, 0, 512, l, y);
|
|
10404
10412
|
};
|
|
10405
|
-
|
|
10413
|
+
import_node_fs9.default.read(n, d, 0, 512, l, y);
|
|
10406
10414
|
};
|
|
10407
10415
|
return new Promise((n, o) => {
|
|
10408
10416
|
e.on("error", o);
|
|
10409
10417
|
let h = "r+", a = (l, c) => {
|
|
10410
|
-
if (l && l.code === "ENOENT" && h === "r+") return h = "w+",
|
|
10418
|
+
if (l && l.code === "ENOENT" && h === "r+") return h = "w+", import_node_fs9.default.open(s3.file, h, a);
|
|
10411
10419
|
if (l || !c) return o(l);
|
|
10412
|
-
|
|
10413
|
-
if (d) return
|
|
10420
|
+
import_node_fs9.default.fstat(c, (d, y) => {
|
|
10421
|
+
if (d) return import_node_fs9.default.close(c, () => o(d));
|
|
10414
10422
|
i(c, y.size, (T, D) => {
|
|
10415
10423
|
if (T) return o(T);
|
|
10416
10424
|
let E = new et(s3.file, { fd: c, start: D });
|
|
@@ -10418,16 +10426,16 @@ var go = (s3, t) => {
|
|
|
10418
10426
|
});
|
|
10419
10427
|
});
|
|
10420
10428
|
};
|
|
10421
|
-
|
|
10429
|
+
import_node_fs9.default.open(s3.file, h, a);
|
|
10422
10430
|
});
|
|
10423
10431
|
};
|
|
10424
10432
|
var bo = (s3, t) => {
|
|
10425
10433
|
t.forEach((e) => {
|
|
10426
|
-
e.charAt(0) === "@" ? Ct({ file:
|
|
10434
|
+
e.charAt(0) === "@" ? Ct({ file: import_node_path12.default.resolve(s3.cwd, e.slice(1)), sync: true, noResume: true, onReadEntry: (i) => s3.add(i) }) : s3.add(e);
|
|
10427
10435
|
}), s3.end();
|
|
10428
10436
|
};
|
|
10429
10437
|
var _o = async (s3, t) => {
|
|
10430
|
-
for (let e of t) e.charAt(0) === "@" ? await Ct({ file:
|
|
10438
|
+
for (let e of t) e.charAt(0) === "@" ? await Ct({ file: import_node_path12.default.resolve(String(s3.cwd), e.slice(1)), noResume: true, onReadEntry: (i) => s3.add(i) }) : s3.add(e);
|
|
10431
10439
|
s3.end();
|
|
10432
10440
|
};
|
|
10433
10441
|
var vt = K(yo, go, () => {
|
|
@@ -10479,7 +10487,7 @@ async function extractRuntimePackage(archive, destination) {
|
|
|
10479
10487
|
if (violation) throw violation;
|
|
10480
10488
|
}
|
|
10481
10489
|
function validateRuntimeTree(root, expected) {
|
|
10482
|
-
const pkg = JSON.parse((0,
|
|
10490
|
+
const pkg = JSON.parse((0, import_node_fs10.readFileSync)((0, import_node_path13.join)(root, "package.json"), "utf8"));
|
|
10483
10491
|
if (!CLI_PACKAGE_NAMES.includes(pkg.name ?? "") || !pkg.version || !pkg.sumiBuild || !BUILD_ID_PATTERN.test(pkg.sumiBuild)) {
|
|
10484
10492
|
throw new Error("\u9700\u8981\u542B\u6784\u5EFA\u8EAB\u4EFD\u7684 pnpm pack:cli \u4EA7\u7269");
|
|
10485
10493
|
}
|
|
@@ -10493,58 +10501,60 @@ function validateRuntimeTree(root, expected) {
|
|
|
10493
10501
|
|
|
10494
10502
|
// src/launcher.ts
|
|
10495
10503
|
function projectRoot(scriptPath) {
|
|
10496
|
-
return (0,
|
|
10504
|
+
return (0, import_node_path14.resolve)((0, import_node_path14.dirname)(scriptPath), "../..");
|
|
10497
10505
|
}
|
|
10498
10506
|
function readManifest(repo) {
|
|
10499
|
-
const path = (0,
|
|
10507
|
+
const path = (0, import_node_path14.join)(repo, RUNTIME_MANIFEST);
|
|
10500
10508
|
let value;
|
|
10501
10509
|
try {
|
|
10502
|
-
value = JSON.parse((0,
|
|
10510
|
+
value = JSON.parse((0, import_node_fs11.readFileSync)(path, "utf8"));
|
|
10503
10511
|
} catch (error) {
|
|
10504
10512
|
throw new Error(`\u65E0\u6CD5\u8BFB\u53D6 runtime \u6E05\u5355 ${RUNTIME_MANIFEST}\uFF1A${error.message}`);
|
|
10505
10513
|
}
|
|
10506
10514
|
const manifest = parseRuntimeManifest(value, repo);
|
|
10507
|
-
const
|
|
10515
|
+
const configPath = configFile(repo);
|
|
10516
|
+
if (!configPath) throw new Error(`\u7F3A\u5C11\u9879\u76EE\u914D\u7F6E ${CONFIG_FILES[0]}`);
|
|
10517
|
+
const config = (0, import_yaml.parse)((0, import_node_fs11.readFileSync)((0, import_node_path14.join)(repo, configPath), "utf8"));
|
|
10508
10518
|
if (config.sumi !== manifest.version || config.sumiBuild !== manifest.build) {
|
|
10509
|
-
throw new Error(`runtime \u6E05\u5355\u4E0E
|
|
10519
|
+
throw new Error(`runtime \u6E05\u5355\u4E0E ${configPath} \u4E0D\u4E00\u81F4\uFF1A${manifest.version}\uFF08${manifest.build}\uFF09`);
|
|
10510
10520
|
}
|
|
10511
10521
|
return manifest;
|
|
10512
10522
|
}
|
|
10513
10523
|
function validRuntime(root, manifest) {
|
|
10514
10524
|
try {
|
|
10515
10525
|
validateRuntimeTree(root, { version: manifest.version, build: manifest.build });
|
|
10516
|
-
return (0,
|
|
10526
|
+
return (0, import_node_fs11.existsSync)((0, import_node_path14.join)(root, "dist/bin.js"));
|
|
10517
10527
|
} catch {
|
|
10518
10528
|
return false;
|
|
10519
10529
|
}
|
|
10520
10530
|
}
|
|
10521
10531
|
async function prepareRuntime(repo, manifest = readManifest(repo)) {
|
|
10522
|
-
const archive = (0,
|
|
10523
|
-
if (!(0,
|
|
10532
|
+
const archive = (0, import_node_path14.resolve)(repo, ...manifest.archive.split("/"));
|
|
10533
|
+
if (!(0, import_node_fs11.existsSync)(archive)) throw new Error(`\u627E\u4E0D\u5230\u9879\u76EE Sumi \u5B89\u88C5\u5305\uFF1A${manifest.archive}`);
|
|
10524
10534
|
const archiveSha = fileSha256(archive);
|
|
10525
10535
|
if (archiveSha !== manifest.archiveSha256) {
|
|
10526
10536
|
throw new Error(`\u9879\u76EE Sumi \u5B89\u88C5\u5305 SHA-256 \u4E0D\u5339\u914D\uFF1A\u58F0\u660E ${manifest.archiveSha256}\uFF0C\u5B9E\u9645 ${archiveSha}`);
|
|
10527
10537
|
}
|
|
10528
10538
|
const hex = manifest.build.slice("sha256:".length);
|
|
10529
|
-
const runtimeRoot = (0,
|
|
10530
|
-
const final = (0,
|
|
10539
|
+
const runtimeRoot = (0, import_node_path14.join)(repo, ".sumi/runtime");
|
|
10540
|
+
const final = (0, import_node_path14.join)(runtimeRoot, hex);
|
|
10531
10541
|
if (validRuntime(final, manifest)) return final;
|
|
10532
|
-
(0,
|
|
10533
|
-
(0,
|
|
10534
|
-
const temporary = (0,
|
|
10542
|
+
(0, import_node_fs11.rmSync)(final, { recursive: true, force: true });
|
|
10543
|
+
(0, import_node_fs11.mkdirSync)(runtimeRoot, { recursive: true });
|
|
10544
|
+
const temporary = (0, import_node_fs11.mkdtempSync)((0, import_node_path14.join)(runtimeRoot, `.tmp-${hex}-${process.pid}-${(0, import_node_crypto4.randomBytes)(3).toString("hex")}-`));
|
|
10535
10545
|
try {
|
|
10536
10546
|
await extractRuntimePackage(archive, temporary);
|
|
10537
|
-
const extracted = (0,
|
|
10547
|
+
const extracted = (0, import_node_path14.join)(temporary, "package");
|
|
10538
10548
|
if (!validRuntime(extracted, manifest)) throw new Error("\u89E3\u5305\u540E\u7684 Sumi runtime \u7248\u672C\u6216\u6784\u5EFA\u8EAB\u4EFD\u65E0\u6548");
|
|
10539
10549
|
try {
|
|
10540
|
-
(0,
|
|
10550
|
+
(0, import_node_fs11.renameSync)(extracted, final);
|
|
10541
10551
|
} catch (error) {
|
|
10542
10552
|
if (!validRuntime(final, manifest)) throw error;
|
|
10543
10553
|
}
|
|
10544
10554
|
if (!validRuntime(final, manifest)) throw new Error("Sumi runtime \u539F\u5B50\u5B89\u88C5\u540E\u6821\u9A8C\u5931\u8D25");
|
|
10545
10555
|
return final;
|
|
10546
10556
|
} finally {
|
|
10547
|
-
(0,
|
|
10557
|
+
(0, import_node_fs11.rmSync)(temporary, { recursive: true, force: true });
|
|
10548
10558
|
}
|
|
10549
10559
|
}
|
|
10550
10560
|
function exitCode(code, signal) {
|
|
@@ -10555,7 +10565,7 @@ function exitCode(code, signal) {
|
|
|
10555
10565
|
async function runLauncher(args = process.argv.slice(2), scriptPath = __filename) {
|
|
10556
10566
|
const repo = projectRoot(scriptPath);
|
|
10557
10567
|
const runtime = await prepareRuntime(repo);
|
|
10558
|
-
const child = (0, import_node_child_process.spawn)(process.execPath, [(0,
|
|
10568
|
+
const child = (0, import_node_child_process.spawn)(process.execPath, [(0, import_node_path14.join)(runtime, "dist/bin.js"), ...args], {
|
|
10559
10569
|
cwd: process.cwd(),
|
|
10560
10570
|
stdio: "inherit",
|
|
10561
10571
|
windowsHide: true
|