@zalkera/cli 0.25.0 → 0.26.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/dist/main.js +118 -65
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -2514,6 +2514,124 @@ init_notice();
|
|
|
2514
2514
|
// ../core/dist/sidebarPlan.js
|
|
2515
2515
|
init_notice();
|
|
2516
2516
|
|
|
2517
|
+
// ../core/dist/serverNormalization.js
|
|
2518
|
+
var EXCLUDED_PREFIXES2 = [".git/", "node_modules/", ".github/workflows/"];
|
|
2519
|
+
var SECRET_FILE_NAMES = /* @__PURE__ */ new Set([
|
|
2520
|
+
"authorized_keys",
|
|
2521
|
+
"known_hosts",
|
|
2522
|
+
"netrc",
|
|
2523
|
+
"htpasswd",
|
|
2524
|
+
"shadow",
|
|
2525
|
+
"credentials",
|
|
2526
|
+
"credentials.json",
|
|
2527
|
+
"credentials.yml",
|
|
2528
|
+
"credentials.yaml",
|
|
2529
|
+
"secrets.json",
|
|
2530
|
+
"secrets.yml",
|
|
2531
|
+
"secrets.yaml",
|
|
2532
|
+
"database.yml",
|
|
2533
|
+
"database.yaml",
|
|
2534
|
+
"wp-config.php"
|
|
2535
|
+
]);
|
|
2536
|
+
var SECRET_BASE_NAMES = /* @__PURE__ */ new Set([
|
|
2537
|
+
"id_rsa",
|
|
2538
|
+
"id_dsa",
|
|
2539
|
+
"id_ecdsa",
|
|
2540
|
+
"id_ed25519",
|
|
2541
|
+
"id_ecdsa_sk",
|
|
2542
|
+
"id_ed25519_sk"
|
|
2543
|
+
]);
|
|
2544
|
+
var SECRET_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
2545
|
+
"pem",
|
|
2546
|
+
"key",
|
|
2547
|
+
"p12",
|
|
2548
|
+
"pfx",
|
|
2549
|
+
"jks",
|
|
2550
|
+
"keystore",
|
|
2551
|
+
"kdbx",
|
|
2552
|
+
"ppk",
|
|
2553
|
+
"ovpn",
|
|
2554
|
+
"env",
|
|
2555
|
+
"tfstate",
|
|
2556
|
+
"tfvars",
|
|
2557
|
+
"gpg",
|
|
2558
|
+
"pgp"
|
|
2559
|
+
]);
|
|
2560
|
+
var ENV_KEEP_SUFFIXES = [".example", ".sample", ".template"];
|
|
2561
|
+
var SERVER_NORMALIZATION_SETS = {
|
|
2562
|
+
prefixes: EXCLUDED_PREFIXES2,
|
|
2563
|
+
secretFileNames: [...SECRET_FILE_NAMES],
|
|
2564
|
+
secretBaseNames: [...SECRET_BASE_NAMES],
|
|
2565
|
+
secretExtensions: [...SECRET_EXTENSIONS],
|
|
2566
|
+
envKeepSuffixes: ENV_KEEP_SUFFIXES
|
|
2567
|
+
};
|
|
2568
|
+
|
|
2569
|
+
// ../core/dist/workdir.js
|
|
2570
|
+
init_errors();
|
|
2571
|
+
import { createReadStream as createReadStream2 } from "node:fs";
|
|
2572
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
2573
|
+
import { lstat as lstat3, readdir as readdir3 } from "node:fs/promises";
|
|
2574
|
+
import { join as join13, sep as sep6 } from "node:path";
|
|
2575
|
+
async function hashWorkdir(root, options = {}) {
|
|
2576
|
+
const manifest = {};
|
|
2577
|
+
const cap = Math.min(options.maxEntries ?? MAX_ENTRIES, MAX_ENTRIES);
|
|
2578
|
+
let seen = 0;
|
|
2579
|
+
async function walk(dir, prefix) {
|
|
2580
|
+
const entries = await readdir3(dir, { withFileTypes: true }).catch((error) => {
|
|
2581
|
+
if (error?.code === "ENOENT")
|
|
2582
|
+
return [];
|
|
2583
|
+
throw error;
|
|
2584
|
+
});
|
|
2585
|
+
for (const item of entries) {
|
|
2586
|
+
const relative5 = prefix === "" ? item.name : `${prefix}/${item.name}`;
|
|
2587
|
+
if (isExcludedEntry(relative5))
|
|
2588
|
+
continue;
|
|
2589
|
+
if (item.isSymbolicLink())
|
|
2590
|
+
continue;
|
|
2591
|
+
if (item.isDirectory()) {
|
|
2592
|
+
await walk(join13(dir, item.name), relative5);
|
|
2593
|
+
continue;
|
|
2594
|
+
}
|
|
2595
|
+
if (!item.isFile())
|
|
2596
|
+
continue;
|
|
2597
|
+
seen += 1;
|
|
2598
|
+
if (seen > cap) {
|
|
2599
|
+
throw new DevtoolsError("LOCAL_TOO_LARGE", `\uC774 \uD3F4\uB354\uC758 \uD30C\uC77C\uC774 \uB108\uBB34 \uB9CE\uC2B5\uB2C8\uB2E4(${cap}\uAC1C \uCD08\uACFC).`, "\uC0AC\uC774\uD2B8 \uD3F4\uB354\uAC00 \uC544\uB2CC \uACF3\uC744 \uAC00\uB9AC\uD0A4\uACE0 \uC788\uC9C0 \uC54A\uC740\uC9C0 \uD655\uC778\uD574 \uC8FC\uC138\uC694.");
|
|
2600
|
+
}
|
|
2601
|
+
manifest[relative5] = { sha256: await hashFile(join13(dir, item.name)) };
|
|
2602
|
+
}
|
|
2603
|
+
}
|
|
2604
|
+
await walk(root, "");
|
|
2605
|
+
return manifest;
|
|
2606
|
+
}
|
|
2607
|
+
async function hashFile(path) {
|
|
2608
|
+
const hash = createHash6("sha256");
|
|
2609
|
+
for await (const chunk of createReadStream2(path))
|
|
2610
|
+
hash.update(chunk);
|
|
2611
|
+
return hash.digest("hex");
|
|
2612
|
+
}
|
|
2613
|
+
async function resolveExisting(root, path) {
|
|
2614
|
+
if (path === "" || path.includes("\0"))
|
|
2615
|
+
return null;
|
|
2616
|
+
const segments = path.split("/").filter((s) => s !== "");
|
|
2617
|
+
if (segments.length === 0)
|
|
2618
|
+
return null;
|
|
2619
|
+
if (segments.some((s) => s === "." || s === ".." || s.includes(sep6)))
|
|
2620
|
+
return null;
|
|
2621
|
+
let current = root;
|
|
2622
|
+
for (const part of segments) {
|
|
2623
|
+
const next = join13(current, part);
|
|
2624
|
+
const info = await lstat3(next).catch(() => null);
|
|
2625
|
+
if (!info || info.isSymbolicLink())
|
|
2626
|
+
return null;
|
|
2627
|
+
current = next;
|
|
2628
|
+
}
|
|
2629
|
+
return current;
|
|
2630
|
+
}
|
|
2631
|
+
|
|
2632
|
+
// ../core/dist/folderVersion.js
|
|
2633
|
+
var TEMPLATE_SCAN_MAX_BYTES = 256 * 1024;
|
|
2634
|
+
|
|
2517
2635
|
// ../core/dist/pullPlan.js
|
|
2518
2636
|
function planPull(input) {
|
|
2519
2637
|
const { incoming, ledger, local } = input;
|
|
@@ -2593,71 +2711,6 @@ function trimPaths(paths, cap = PATH_LIST_CAP, all = false) {
|
|
|
2593
2711
|
import { lstat as lstat4, mkdir as mkdir5, readFile as readFile5, realpath as realpath2, rename as rename2, rmdir, stat as stat3, unlink, writeFile as writeFile7 } from "node:fs/promises";
|
|
2594
2712
|
init_errors();
|
|
2595
2713
|
import { basename as basename2, dirname as dirname2, join as join14, relative as relative4, resolve as resolve6, sep as sep7 } from "node:path";
|
|
2596
|
-
|
|
2597
|
-
// ../core/dist/workdir.js
|
|
2598
|
-
init_errors();
|
|
2599
|
-
import { createReadStream as createReadStream2 } from "node:fs";
|
|
2600
|
-
import { createHash as createHash6 } from "node:crypto";
|
|
2601
|
-
import { lstat as lstat3, readdir as readdir3 } from "node:fs/promises";
|
|
2602
|
-
import { join as join13, sep as sep6 } from "node:path";
|
|
2603
|
-
async function hashWorkdir(root, options = {}) {
|
|
2604
|
-
const manifest = {};
|
|
2605
|
-
const cap = Math.min(options.maxEntries ?? MAX_ENTRIES, MAX_ENTRIES);
|
|
2606
|
-
let seen = 0;
|
|
2607
|
-
async function walk(dir, prefix) {
|
|
2608
|
-
const entries = await readdir3(dir, { withFileTypes: true }).catch((error) => {
|
|
2609
|
-
if (error?.code === "ENOENT")
|
|
2610
|
-
return [];
|
|
2611
|
-
throw error;
|
|
2612
|
-
});
|
|
2613
|
-
for (const item of entries) {
|
|
2614
|
-
const relative5 = prefix === "" ? item.name : `${prefix}/${item.name}`;
|
|
2615
|
-
if (isExcludedEntry(relative5))
|
|
2616
|
-
continue;
|
|
2617
|
-
if (item.isSymbolicLink())
|
|
2618
|
-
continue;
|
|
2619
|
-
if (item.isDirectory()) {
|
|
2620
|
-
await walk(join13(dir, item.name), relative5);
|
|
2621
|
-
continue;
|
|
2622
|
-
}
|
|
2623
|
-
if (!item.isFile())
|
|
2624
|
-
continue;
|
|
2625
|
-
seen += 1;
|
|
2626
|
-
if (seen > cap) {
|
|
2627
|
-
throw new DevtoolsError("LOCAL_TOO_LARGE", `\uC774 \uD3F4\uB354\uC758 \uD30C\uC77C\uC774 \uB108\uBB34 \uB9CE\uC2B5\uB2C8\uB2E4(${cap}\uAC1C \uCD08\uACFC).`, "\uC0AC\uC774\uD2B8 \uD3F4\uB354\uAC00 \uC544\uB2CC \uACF3\uC744 \uAC00\uB9AC\uD0A4\uACE0 \uC788\uC9C0 \uC54A\uC740\uC9C0 \uD655\uC778\uD574 \uC8FC\uC138\uC694.");
|
|
2628
|
-
}
|
|
2629
|
-
manifest[relative5] = { sha256: await hashFile(join13(dir, item.name)) };
|
|
2630
|
-
}
|
|
2631
|
-
}
|
|
2632
|
-
await walk(root, "");
|
|
2633
|
-
return manifest;
|
|
2634
|
-
}
|
|
2635
|
-
async function hashFile(path) {
|
|
2636
|
-
const hash = createHash6("sha256");
|
|
2637
|
-
for await (const chunk of createReadStream2(path))
|
|
2638
|
-
hash.update(chunk);
|
|
2639
|
-
return hash.digest("hex");
|
|
2640
|
-
}
|
|
2641
|
-
async function resolveExisting(root, path) {
|
|
2642
|
-
if (path === "" || path.includes("\0"))
|
|
2643
|
-
return null;
|
|
2644
|
-
const segments = path.split("/").filter((s) => s !== "");
|
|
2645
|
-
if (segments.length === 0)
|
|
2646
|
-
return null;
|
|
2647
|
-
if (segments.some((s) => s === "." || s === ".." || s.includes(sep6)))
|
|
2648
|
-
return null;
|
|
2649
|
-
let current = root;
|
|
2650
|
-
for (const part of segments) {
|
|
2651
|
-
const next = join13(current, part);
|
|
2652
|
-
const info = await lstat3(next).catch(() => null);
|
|
2653
|
-
if (!info || info.isSymbolicLink())
|
|
2654
|
-
return null;
|
|
2655
|
-
current = next;
|
|
2656
|
-
}
|
|
2657
|
-
return current;
|
|
2658
|
-
}
|
|
2659
|
-
|
|
2660
|
-
// ../core/dist/pull.js
|
|
2661
2714
|
var SAVED_SUFFIX = ".zalkera-saved";
|
|
2662
2715
|
async function pullSiteSource(options) {
|
|
2663
2716
|
const report = options.onProgress ?? (() => {
|