@fluid-app/fluid-cli 0.1.356 → 0.1.357
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/bin/fluid.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { A as primeIdentityProfile, C as updateConfig, E as getConfigDir, F as resolveIdentityUrl, G as sendMfa, H as fetchUserCompanies, J as validateToken, K as signup, M as sessionFacts, N as signInWithBrowser, O as describeIdentityError, P as signOutIdentity, R as isIdentityProfile, S as readConfig, T as isStrictConfig, U as getFluidApiBase, V as confirmMfa, W as redeemIdentityLink, _ as getAuthToken, b as resolveCredentialSource, c as inputsModeActive, ct as filterCatalog, dt as visibleSubcommands, ft as walkCommands, g as getActiveProfile, k as identityToken, l as registerInputsHook, lt as rootCommand, q as switchCompany, s as exitOnInputsError, u as createInputsReader, ut as visibleOptions, w as writeConfig, z as FLUID_API_ERROR } from "../hook-
|
|
2
|
+
import { A as primeIdentityProfile, C as updateConfig, E as getConfigDir, F as resolveIdentityUrl, G as sendMfa, H as fetchUserCompanies, J as validateToken, K as signup, M as sessionFacts, N as signInWithBrowser, O as describeIdentityError, P as signOutIdentity, R as isIdentityProfile, S as readConfig, T as isStrictConfig, U as getFluidApiBase, V as confirmMfa, W as redeemIdentityLink, _ as getAuthToken, b as resolveCredentialSource, c as inputsModeActive, ct as filterCatalog, dt as visibleSubcommands, ft as walkCommands, g as getActiveProfile, k as identityToken, l as registerInputsHook, lt as rootCommand, q as switchCompany, s as exitOnInputsError, u as createInputsReader, ut as visibleOptions, w as writeConfig, z as FLUID_API_ERROR } from "../hook-jDkZbqMt.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
@@ -3400,8 +3400,15 @@ function normalizeIgnore(ignore) {
|
|
|
3400
3400
|
}
|
|
3401
3401
|
return [...out].sort(compare);
|
|
3402
3402
|
}
|
|
3403
|
-
function ignoreKey(ignore) {
|
|
3404
|
-
return JSON.stringify(
|
|
3403
|
+
function ignoreKey(ignore, skipDotNames = false) {
|
|
3404
|
+
return skipDotNames ? JSON.stringify({
|
|
3405
|
+
ignore,
|
|
3406
|
+
skipDotNames: true
|
|
3407
|
+
}) : JSON.stringify(ignore);
|
|
3408
|
+
}
|
|
3409
|
+
function normalizeSkipDotNames(value) {
|
|
3410
|
+
if (value === void 0 || typeof value === "boolean") return value === true;
|
|
3411
|
+
throw new Error(`Invalid tree skipDotNames: ${JSON.stringify(value) ?? String(value)}`);
|
|
3405
3412
|
}
|
|
3406
3413
|
function compare(a, b) {
|
|
3407
3414
|
return a < b ? -1 : a > b ? 1 : 0;
|
|
@@ -3430,14 +3437,16 @@ function isIgnored(rel, ignore) {
|
|
|
3430
3437
|
* Lists the regular files under an already canonical root as sorted
|
|
3431
3438
|
* "/"-separated relative paths. Symlink entries are skipped at list time in
|
|
3432
3439
|
* every mode. Throws if a directory being walked is not its own canonical
|
|
3433
|
-
* path.
|
|
3440
|
+
* path. With skipDotNames, every entry whose name starts with "." is skipped
|
|
3441
|
+
* before its directory is read.
|
|
3434
3442
|
*/
|
|
3435
|
-
function listTreeFiles(root, ignore) {
|
|
3443
|
+
function listTreeFiles(root, ignore, skipDotNames = false) {
|
|
3436
3444
|
const out = [];
|
|
3437
3445
|
const walk = (dir, relDir) => {
|
|
3438
3446
|
assertCanonicalDir(dir);
|
|
3439
3447
|
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
3440
3448
|
const rel = relDir === "" ? entry.name : `${relDir}/${entry.name}`;
|
|
3449
|
+
if (skipDotNames && entry.name.startsWith(".")) continue;
|
|
3441
3450
|
if (isIgnored(rel, ignore)) continue;
|
|
3442
3451
|
if (entry.isDirectory()) walk(join(dir, entry.name), rel);
|
|
3443
3452
|
else if (entry.isFile()) out.push(rel);
|
|
@@ -3471,8 +3480,8 @@ function readTreeFileFromDisk(root, rel) {
|
|
|
3471
3480
|
}
|
|
3472
3481
|
//#endregion
|
|
3473
3482
|
//#region src/inputs/snapshot.ts
|
|
3474
|
-
function treeKey(root, ignore) {
|
|
3475
|
-
return `${root}\0${ignoreKey(ignore)}`;
|
|
3483
|
+
function treeKey(root, ignore, skipDotNames = false) {
|
|
3484
|
+
return `${root}\0${ignoreKey(ignore, skipDotNames)}`;
|
|
3476
3485
|
}
|
|
3477
3486
|
function sha256(data) {
|
|
3478
3487
|
return createHash("sha256").update(data).digest("hex");
|
|
@@ -3510,9 +3519,10 @@ function resolveInputs(specs, cwd = process.cwd()) {
|
|
|
3510
3519
|
if (spec.kind !== "tree" || typeof spec.path !== "string") throw new Error("Invalid tree input spec");
|
|
3511
3520
|
const { lexical, canonical: root } = canonicalPath(spec.path, cwd);
|
|
3512
3521
|
const ignore = normalizeIgnore(spec.ignore);
|
|
3522
|
+
const skipDot = normalizeSkipDotNames(spec.skipDotNames);
|
|
3513
3523
|
const members = /* @__PURE__ */ new Map();
|
|
3514
3524
|
const files = [];
|
|
3515
|
-
for (const rel of listTreeFiles(root, ignore)) {
|
|
3525
|
+
for (const rel of listTreeFiles(root, ignore, skipDot)) {
|
|
3516
3526
|
const content = readTreeFileFromDisk(root, rel);
|
|
3517
3527
|
members.set(rel, content);
|
|
3518
3528
|
files.push({
|
|
@@ -3523,11 +3533,12 @@ function resolveInputs(specs, cwd = process.cwd()) {
|
|
|
3523
3533
|
}
|
|
3524
3534
|
snapshot.treeAliases.set(lexical, root);
|
|
3525
3535
|
snapshot.treeAliases.set(root, root);
|
|
3526
|
-
snapshot.trees.set(treeKey(root, ignore), members);
|
|
3536
|
+
snapshot.trees.set(treeKey(root, ignore, skipDot), members);
|
|
3527
3537
|
entries.push({
|
|
3528
3538
|
kind: "tree",
|
|
3529
3539
|
path: root,
|
|
3530
3540
|
ignore,
|
|
3541
|
+
...skipDot ? { skipDotNames: true } : {},
|
|
3531
3542
|
files
|
|
3532
3543
|
});
|
|
3533
3544
|
}
|
|
@@ -3538,7 +3549,7 @@ function resolveInputs(specs, cwd = process.cwd()) {
|
|
|
3538
3549
|
});
|
|
3539
3550
|
}
|
|
3540
3551
|
function sortKey(entry) {
|
|
3541
|
-
const id = entry.kind === "ref" ? entry.name : entry.kind === "tree" ? `${entry.path}\0${ignoreKey(entry.ignore)}` : entry.path;
|
|
3552
|
+
const id = entry.kind === "ref" ? entry.name : entry.kind === "tree" ? `${entry.path}\0${ignoreKey(entry.ignore, entry.skipDotNames === true)}` : entry.path;
|
|
3542
3553
|
return `${entry.kind}\0${id}`;
|
|
3543
3554
|
}
|
|
3544
3555
|
function canonicalEntries(entries) {
|
|
@@ -3552,6 +3563,7 @@ function canonicalEntries(entries) {
|
|
|
3552
3563
|
kind: "tree",
|
|
3553
3564
|
path: e.path,
|
|
3554
3565
|
ignore: [...e.ignore],
|
|
3566
|
+
...e.skipDotNames === true ? { skipDotNames: true } : {},
|
|
3555
3567
|
files: e.files.map((f) => ({
|
|
3556
3568
|
path: f.path,
|
|
3557
3569
|
sha256: f.sha256,
|
|
@@ -3597,9 +3609,9 @@ function declaredKey(path, snapshot) {
|
|
|
3597
3609
|
function bytes(content, encoding) {
|
|
3598
3610
|
return encoding ? content.toString(encoding) : Buffer.from(content);
|
|
3599
3611
|
}
|
|
3600
|
-
function snapshotTree(rootPath, ignore, snapshot) {
|
|
3612
|
+
function snapshotTree(rootPath, ignore, skipDot, snapshot) {
|
|
3601
3613
|
const root = snapshot.treeAliases.get(lexicalPath(rootPath)) ?? rootPath;
|
|
3602
|
-
const members = snapshot.trees.get(treeKey(root, ignore));
|
|
3614
|
+
const members = snapshot.trees.get(treeKey(root, ignore, skipDot));
|
|
3603
3615
|
if (!members) throw new InputsUndeclaredError(rootPath);
|
|
3604
3616
|
return {
|
|
3605
3617
|
root,
|
|
@@ -3608,31 +3620,32 @@ function snapshotTree(rootPath, ignore, snapshot) {
|
|
|
3608
3620
|
}
|
|
3609
3621
|
function openTree(rootPath, options) {
|
|
3610
3622
|
const ignore = normalizeIgnore(options?.ignore);
|
|
3623
|
+
const skipDot = normalizeSkipDotNames(options?.skipDotNames);
|
|
3611
3624
|
let disk;
|
|
3612
3625
|
const fromDisk = () => {
|
|
3613
3626
|
if (!disk) {
|
|
3614
3627
|
const root = canonicalPath(rootPath).canonical;
|
|
3615
3628
|
disk = {
|
|
3616
3629
|
root,
|
|
3617
|
-
known: new Set(listTreeFiles(root, ignore))
|
|
3630
|
+
known: new Set(listTreeFiles(root, ignore, skipDot))
|
|
3618
3631
|
};
|
|
3619
3632
|
}
|
|
3620
3633
|
return disk;
|
|
3621
3634
|
};
|
|
3622
|
-
if (activeSnapshot) snapshotTree(rootPath, ignore, activeSnapshot);
|
|
3635
|
+
if (activeSnapshot) snapshotTree(rootPath, ignore, skipDot, activeSnapshot);
|
|
3623
3636
|
else fromDisk();
|
|
3624
3637
|
return {
|
|
3625
3638
|
get root() {
|
|
3626
|
-
return activeSnapshot ? snapshotTree(rootPath, ignore, activeSnapshot).root : fromDisk().root;
|
|
3639
|
+
return activeSnapshot ? snapshotTree(rootPath, ignore, skipDot, activeSnapshot).root : fromDisk().root;
|
|
3627
3640
|
},
|
|
3628
3641
|
list() {
|
|
3629
|
-
if (activeSnapshot) return [...snapshotTree(rootPath, ignore, activeSnapshot).members.keys()];
|
|
3642
|
+
if (activeSnapshot) return [...snapshotTree(rootPath, ignore, skipDot, activeSnapshot).members.keys()];
|
|
3630
3643
|
return [...fromDisk().known];
|
|
3631
3644
|
},
|
|
3632
3645
|
readFile(rel, encoding) {
|
|
3633
3646
|
const missing = () => new InputsUndeclaredError(`${rootPath}/${rel}`);
|
|
3634
3647
|
if (activeSnapshot) {
|
|
3635
|
-
const content = snapshotTree(rootPath, ignore, activeSnapshot).members.get(rel);
|
|
3648
|
+
const content = snapshotTree(rootPath, ignore, skipDot, activeSnapshot).members.get(rel);
|
|
3636
3649
|
if (!content) throw missing();
|
|
3637
3650
|
return bytes(content, encoding);
|
|
3638
3651
|
}
|
|
@@ -3774,4 +3787,4 @@ function exitOnInputsError(error, io = processIo) {
|
|
|
3774
3787
|
//#endregion
|
|
3775
3788
|
export { isNodeError as $, primeIdentityProfile as A, SIGNUP_ERROR as B, updateConfig as C, getConfigFilePath as D, getConfigDir as E, resolveIdentityUrl as F, sendMfa as G, fetchUserCompanies as H, createFetchClient as I, validateToken as J, signup as K, createDefaultConfig as L, sessionFacts as M, signInWithBrowser as N, describeIdentityError as O, signOutIdentity as P, isFailure as Q, isIdentityProfile as R, readConfig as S, isStrictConfig as T, getFluidApiBase as U, confirmMfa as V, redeemIdentityLink as W, getErrorMessage$1 as X, failure as Y, isError as Z, getAuthToken as _, INPUTS_UNDECLARED_CODE as a, tryCatchAsync as at, resolveCredentialSource as b, inputsModeActive as c, filterCatalog as ct, setActiveSnapshot as d, visibleSubcommands as dt, isSuccess as et, inInternalRead as f, walkCommands as ft, getActiveProfile as g, declareInputs as h, INPUTS_MODE_ENV as i, tryCatch as it, profileAccessToken as j, identityToken as k, registerInputsHook as l, rootCommand as lt, withInternalReadsAsync as m, INPUTS_MISMATCH_CODE as n, mapResult as nt, INPUTS_UNDECLARED_EXIT as o, unwrap as ot, withInternalReads as p, describeCommand as pt, switchCompany as q, INPUTS_MISMATCH_EXIT as r, success as rt, exitOnInputsError as s, unwrapOr as st, INPUTS_EXPECT_ENV as t, mapError as tt, createInputsReader as u, visibleOptions as ut, getAuthTokenAsync as v, writeConfig as w, findProjectConfig as x, listProfileNames as y, FLUID_API_ERROR as z };
|
|
3776
3789
|
|
|
3777
|
-
//# sourceMappingURL=hook-
|
|
3790
|
+
//# sourceMappingURL=hook-jDkZbqMt.mjs.map
|