fimo 0.7.0-experimental.4 → 0.7.0-experimental.6
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/cli/bundle.json +1 -1
- package/dist/cli/index.js +827 -464
- package/dist/runtime/strapi/client.d.ts +26 -0
- package/dist/runtime/strapi/client.d.ts.map +1 -0
- package/dist/runtime/strapi/client.js +88 -0
- package/dist/runtime/strapi/client.test.d.ts +2 -0
- package/dist/runtime/strapi/client.test.d.ts.map +1 -0
- package/dist/runtime/strapi/client.test.js +64 -0
- package/dist/runtime/strapi/index.d.ts +5 -0
- package/dist/runtime/strapi/index.d.ts.map +1 -0
- package/dist/runtime/strapi/index.js +6 -0
- package/dist/runtime/strapi/reshape.d.ts +28 -0
- package/dist/runtime/strapi/reshape.d.ts.map +1 -0
- package/dist/runtime/strapi/reshape.js +79 -0
- package/dist/runtime/strapi/reshape.test.d.ts +2 -0
- package/dist/runtime/strapi/reshape.test.d.ts.map +1 -0
- package/dist/runtime/strapi/reshape.test.js +33 -0
- package/dist/scripts/cms/example-content.js +22 -1
- package/dist/scripts/cms/example-content.test.js +11 -2
- package/dist/scripts/cms/strapi/detect.js +1 -0
- package/dist/scripts/cms/strapi/index.js +8 -0
- package/dist/scripts/cms/strapi/schema-map.js +11 -0
- package/dist/scripts/cms/strapi/schema-map.test.js +4 -0
- package/dist/scripts/cms/strapi/wire-client.d.ts +15 -0
- package/dist/scripts/cms/strapi/wire-client.js +107 -0
- package/dist/scripts/cms/strapi/wire-client.test.d.ts +1 -0
- package/dist/scripts/cms/strapi/wire-client.test.js +51 -0
- package/dist/scripts/cms/strapi/wiring.d.ts +17 -0
- package/dist/scripts/cms/strapi/wiring.js +36 -0
- package/dist/scripts/cms/strapi/wiring.test.d.ts +1 -0
- package/dist/scripts/cms/strapi/wiring.test.js +27 -0
- package/dist/scripts/cms/types.d.ts +18 -0
- package/package.json +5 -1
- package/templates/react-router/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -1984,8 +1984,8 @@ var require_command = __commonJS({
|
|
|
1984
1984
|
"../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/command.js"(exports2) {
|
|
1985
1985
|
var EventEmitter = __require("node:events").EventEmitter;
|
|
1986
1986
|
var childProcess2 = __require("node:child_process");
|
|
1987
|
-
var
|
|
1988
|
-
var
|
|
1987
|
+
var path62 = __require("node:path");
|
|
1988
|
+
var fs57 = __require("node:fs");
|
|
1989
1989
|
var process8 = __require("node:process");
|
|
1990
1990
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
1991
1991
|
var { CommanderError: CommanderError2 } = require_error();
|
|
@@ -2969,7 +2969,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2969
2969
|
* @param {string} subcommandName
|
|
2970
2970
|
*/
|
|
2971
2971
|
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
2972
|
-
if (
|
|
2972
|
+
if (fs57.existsSync(executableFile)) return;
|
|
2973
2973
|
const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
|
|
2974
2974
|
const executableMissing = `'${executableFile}' does not exist
|
|
2975
2975
|
- if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
@@ -2987,11 +2987,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2987
2987
|
let launchWithNode = false;
|
|
2988
2988
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
2989
2989
|
function findFile(baseDir, baseName) {
|
|
2990
|
-
const localBin =
|
|
2991
|
-
if (
|
|
2992
|
-
if (sourceExt.includes(
|
|
2990
|
+
const localBin = path62.resolve(baseDir, baseName);
|
|
2991
|
+
if (fs57.existsSync(localBin)) return localBin;
|
|
2992
|
+
if (sourceExt.includes(path62.extname(baseName))) return void 0;
|
|
2993
2993
|
const foundExt = sourceExt.find(
|
|
2994
|
-
(ext) =>
|
|
2994
|
+
(ext) => fs57.existsSync(`${localBin}${ext}`)
|
|
2995
2995
|
);
|
|
2996
2996
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
2997
2997
|
return void 0;
|
|
@@ -3004,21 +3004,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3004
3004
|
if (this._scriptPath) {
|
|
3005
3005
|
let resolvedScriptPath;
|
|
3006
3006
|
try {
|
|
3007
|
-
resolvedScriptPath =
|
|
3007
|
+
resolvedScriptPath = fs57.realpathSync(this._scriptPath);
|
|
3008
3008
|
} catch {
|
|
3009
3009
|
resolvedScriptPath = this._scriptPath;
|
|
3010
3010
|
}
|
|
3011
|
-
executableDir =
|
|
3012
|
-
|
|
3011
|
+
executableDir = path62.resolve(
|
|
3012
|
+
path62.dirname(resolvedScriptPath),
|
|
3013
3013
|
executableDir
|
|
3014
3014
|
);
|
|
3015
3015
|
}
|
|
3016
3016
|
if (executableDir) {
|
|
3017
3017
|
let localFile = findFile(executableDir, executableFile);
|
|
3018
3018
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
3019
|
-
const legacyName =
|
|
3019
|
+
const legacyName = path62.basename(
|
|
3020
3020
|
this._scriptPath,
|
|
3021
|
-
|
|
3021
|
+
path62.extname(this._scriptPath)
|
|
3022
3022
|
);
|
|
3023
3023
|
if (legacyName !== this._name) {
|
|
3024
3024
|
localFile = findFile(
|
|
@@ -3029,7 +3029,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3029
3029
|
}
|
|
3030
3030
|
executableFile = localFile || executableFile;
|
|
3031
3031
|
}
|
|
3032
|
-
launchWithNode = sourceExt.includes(
|
|
3032
|
+
launchWithNode = sourceExt.includes(path62.extname(executableFile));
|
|
3033
3033
|
let proc;
|
|
3034
3034
|
if (process8.platform !== "win32") {
|
|
3035
3035
|
if (launchWithNode) {
|
|
@@ -3877,7 +3877,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3877
3877
|
* @return {Command}
|
|
3878
3878
|
*/
|
|
3879
3879
|
nameFromFilename(filename) {
|
|
3880
|
-
this._name =
|
|
3880
|
+
this._name = path62.basename(filename, path62.extname(filename));
|
|
3881
3881
|
return this;
|
|
3882
3882
|
}
|
|
3883
3883
|
/**
|
|
@@ -3891,9 +3891,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3891
3891
|
* @param {string} [path]
|
|
3892
3892
|
* @return {(string|null|Command)}
|
|
3893
3893
|
*/
|
|
3894
|
-
executableDir(
|
|
3895
|
-
if (
|
|
3896
|
-
this._executableDir =
|
|
3894
|
+
executableDir(path63) {
|
|
3895
|
+
if (path63 === void 0) return this._executableDir;
|
|
3896
|
+
this._executableDir = path63;
|
|
3897
3897
|
return this;
|
|
3898
3898
|
}
|
|
3899
3899
|
/**
|
|
@@ -4227,7 +4227,7 @@ function detectFramework(cwd) {
|
|
|
4227
4227
|
}
|
|
4228
4228
|
function findAdoptableApps(rootDir) {
|
|
4229
4229
|
const apps2 = [];
|
|
4230
|
-
const
|
|
4230
|
+
const walk2 = /* @__PURE__ */ __name((dir, depth) => {
|
|
4231
4231
|
if (depth > MAX_SCAN_DEPTH) {
|
|
4232
4232
|
return;
|
|
4233
4233
|
}
|
|
@@ -4246,11 +4246,11 @@ function findAdoptableApps(rootDir) {
|
|
|
4246
4246
|
}
|
|
4247
4247
|
for (const entry of entries2) {
|
|
4248
4248
|
if (entry.isDirectory() && !WORKSPACE_SKIP.has(entry.name) && !entry.name.startsWith(".")) {
|
|
4249
|
-
|
|
4249
|
+
walk2(join(dir, entry.name), depth + 1);
|
|
4250
4250
|
}
|
|
4251
4251
|
}
|
|
4252
4252
|
}, "walk");
|
|
4253
|
-
|
|
4253
|
+
walk2(rootDir, 0);
|
|
4254
4254
|
return apps2.sort((a, b) => {
|
|
4255
4255
|
const depthA = a.relDir.split("/").length;
|
|
4256
4256
|
const depthB = b.relDir.split("/").length;
|
|
@@ -6698,17 +6698,17 @@ var require_visit = __commonJS({
|
|
|
6698
6698
|
visit2.BREAK = BREAK;
|
|
6699
6699
|
visit2.SKIP = SKIP;
|
|
6700
6700
|
visit2.REMOVE = REMOVE;
|
|
6701
|
-
function visit_(key, node, visitor,
|
|
6702
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
6701
|
+
function visit_(key, node, visitor, path62) {
|
|
6702
|
+
const ctrl = callVisitor(key, node, visitor, path62);
|
|
6703
6703
|
if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
|
|
6704
|
-
replaceNode(key,
|
|
6705
|
-
return visit_(key, ctrl, visitor,
|
|
6704
|
+
replaceNode(key, path62, ctrl);
|
|
6705
|
+
return visit_(key, ctrl, visitor, path62);
|
|
6706
6706
|
}
|
|
6707
6707
|
if (typeof ctrl !== "symbol") {
|
|
6708
6708
|
if (identity2.isCollection(node)) {
|
|
6709
|
-
|
|
6709
|
+
path62 = Object.freeze(path62.concat(node));
|
|
6710
6710
|
for (let i = 0; i < node.items.length; ++i) {
|
|
6711
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
6711
|
+
const ci = visit_(i, node.items[i], visitor, path62);
|
|
6712
6712
|
if (typeof ci === "number")
|
|
6713
6713
|
i = ci - 1;
|
|
6714
6714
|
else if (ci === BREAK)
|
|
@@ -6719,13 +6719,13 @@ var require_visit = __commonJS({
|
|
|
6719
6719
|
}
|
|
6720
6720
|
}
|
|
6721
6721
|
} else if (identity2.isPair(node)) {
|
|
6722
|
-
|
|
6723
|
-
const ck = visit_("key", node.key, visitor,
|
|
6722
|
+
path62 = Object.freeze(path62.concat(node));
|
|
6723
|
+
const ck = visit_("key", node.key, visitor, path62);
|
|
6724
6724
|
if (ck === BREAK)
|
|
6725
6725
|
return BREAK;
|
|
6726
6726
|
else if (ck === REMOVE)
|
|
6727
6727
|
node.key = null;
|
|
6728
|
-
const cv = visit_("value", node.value, visitor,
|
|
6728
|
+
const cv = visit_("value", node.value, visitor, path62);
|
|
6729
6729
|
if (cv === BREAK)
|
|
6730
6730
|
return BREAK;
|
|
6731
6731
|
else if (cv === REMOVE)
|
|
@@ -6748,17 +6748,17 @@ var require_visit = __commonJS({
|
|
|
6748
6748
|
visitAsync.BREAK = BREAK;
|
|
6749
6749
|
visitAsync.SKIP = SKIP;
|
|
6750
6750
|
visitAsync.REMOVE = REMOVE;
|
|
6751
|
-
async function visitAsync_(key, node, visitor,
|
|
6752
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
6751
|
+
async function visitAsync_(key, node, visitor, path62) {
|
|
6752
|
+
const ctrl = await callVisitor(key, node, visitor, path62);
|
|
6753
6753
|
if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
|
|
6754
|
-
replaceNode(key,
|
|
6755
|
-
return visitAsync_(key, ctrl, visitor,
|
|
6754
|
+
replaceNode(key, path62, ctrl);
|
|
6755
|
+
return visitAsync_(key, ctrl, visitor, path62);
|
|
6756
6756
|
}
|
|
6757
6757
|
if (typeof ctrl !== "symbol") {
|
|
6758
6758
|
if (identity2.isCollection(node)) {
|
|
6759
|
-
|
|
6759
|
+
path62 = Object.freeze(path62.concat(node));
|
|
6760
6760
|
for (let i = 0; i < node.items.length; ++i) {
|
|
6761
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
6761
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path62);
|
|
6762
6762
|
if (typeof ci === "number")
|
|
6763
6763
|
i = ci - 1;
|
|
6764
6764
|
else if (ci === BREAK)
|
|
@@ -6769,13 +6769,13 @@ var require_visit = __commonJS({
|
|
|
6769
6769
|
}
|
|
6770
6770
|
}
|
|
6771
6771
|
} else if (identity2.isPair(node)) {
|
|
6772
|
-
|
|
6773
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
6772
|
+
path62 = Object.freeze(path62.concat(node));
|
|
6773
|
+
const ck = await visitAsync_("key", node.key, visitor, path62);
|
|
6774
6774
|
if (ck === BREAK)
|
|
6775
6775
|
return BREAK;
|
|
6776
6776
|
else if (ck === REMOVE)
|
|
6777
6777
|
node.key = null;
|
|
6778
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
6778
|
+
const cv = await visitAsync_("value", node.value, visitor, path62);
|
|
6779
6779
|
if (cv === BREAK)
|
|
6780
6780
|
return BREAK;
|
|
6781
6781
|
else if (cv === REMOVE)
|
|
@@ -6804,24 +6804,24 @@ var require_visit = __commonJS({
|
|
|
6804
6804
|
return visitor;
|
|
6805
6805
|
}
|
|
6806
6806
|
__name(initVisitor, "initVisitor");
|
|
6807
|
-
function callVisitor(key, node, visitor,
|
|
6807
|
+
function callVisitor(key, node, visitor, path62) {
|
|
6808
6808
|
if (typeof visitor === "function")
|
|
6809
|
-
return visitor(key, node,
|
|
6809
|
+
return visitor(key, node, path62);
|
|
6810
6810
|
if (identity2.isMap(node))
|
|
6811
|
-
return visitor.Map?.(key, node,
|
|
6811
|
+
return visitor.Map?.(key, node, path62);
|
|
6812
6812
|
if (identity2.isSeq(node))
|
|
6813
|
-
return visitor.Seq?.(key, node,
|
|
6813
|
+
return visitor.Seq?.(key, node, path62);
|
|
6814
6814
|
if (identity2.isPair(node))
|
|
6815
|
-
return visitor.Pair?.(key, node,
|
|
6815
|
+
return visitor.Pair?.(key, node, path62);
|
|
6816
6816
|
if (identity2.isScalar(node))
|
|
6817
|
-
return visitor.Scalar?.(key, node,
|
|
6817
|
+
return visitor.Scalar?.(key, node, path62);
|
|
6818
6818
|
if (identity2.isAlias(node))
|
|
6819
|
-
return visitor.Alias?.(key, node,
|
|
6819
|
+
return visitor.Alias?.(key, node, path62);
|
|
6820
6820
|
return void 0;
|
|
6821
6821
|
}
|
|
6822
6822
|
__name(callVisitor, "callVisitor");
|
|
6823
|
-
function replaceNode(key,
|
|
6824
|
-
const parent2 =
|
|
6823
|
+
function replaceNode(key, path62, node) {
|
|
6824
|
+
const parent2 = path62[path62.length - 1];
|
|
6825
6825
|
if (identity2.isCollection(parent2)) {
|
|
6826
6826
|
parent2.items[key] = node;
|
|
6827
6827
|
} else if (identity2.isPair(parent2)) {
|
|
@@ -7453,10 +7453,10 @@ var require_Collection = __commonJS({
|
|
|
7453
7453
|
var createNode = require_createNode();
|
|
7454
7454
|
var identity2 = require_identity();
|
|
7455
7455
|
var Node2 = require_Node();
|
|
7456
|
-
function collectionFromPath(schema,
|
|
7456
|
+
function collectionFromPath(schema, path62, value) {
|
|
7457
7457
|
let v = value;
|
|
7458
|
-
for (let i =
|
|
7459
|
-
const k =
|
|
7458
|
+
for (let i = path62.length - 1; i >= 0; --i) {
|
|
7459
|
+
const k = path62[i];
|
|
7460
7460
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
7461
7461
|
const a = [];
|
|
7462
7462
|
a[k] = v;
|
|
@@ -7476,7 +7476,7 @@ var require_Collection = __commonJS({
|
|
|
7476
7476
|
});
|
|
7477
7477
|
}
|
|
7478
7478
|
__name(collectionFromPath, "collectionFromPath");
|
|
7479
|
-
var isEmptyPath = /* @__PURE__ */ __name((
|
|
7479
|
+
var isEmptyPath = /* @__PURE__ */ __name((path62) => path62 == null || typeof path62 === "object" && !!path62[Symbol.iterator]().next().done, "isEmptyPath");
|
|
7480
7480
|
var Collection = class extends Node2.NodeBase {
|
|
7481
7481
|
static {
|
|
7482
7482
|
__name(this, "Collection");
|
|
@@ -7509,11 +7509,11 @@ var require_Collection = __commonJS({
|
|
|
7509
7509
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
7510
7510
|
* that already exists in the map.
|
|
7511
7511
|
*/
|
|
7512
|
-
addIn(
|
|
7513
|
-
if (isEmptyPath(
|
|
7512
|
+
addIn(path62, value) {
|
|
7513
|
+
if (isEmptyPath(path62))
|
|
7514
7514
|
this.add(value);
|
|
7515
7515
|
else {
|
|
7516
|
-
const [key, ...rest] =
|
|
7516
|
+
const [key, ...rest] = path62;
|
|
7517
7517
|
const node = this.get(key, true);
|
|
7518
7518
|
if (identity2.isCollection(node))
|
|
7519
7519
|
node.addIn(rest, value);
|
|
@@ -7527,8 +7527,8 @@ var require_Collection = __commonJS({
|
|
|
7527
7527
|
* Removes a value from the collection.
|
|
7528
7528
|
* @returns `true` if the item was found and removed.
|
|
7529
7529
|
*/
|
|
7530
|
-
deleteIn(
|
|
7531
|
-
const [key, ...rest] =
|
|
7530
|
+
deleteIn(path62) {
|
|
7531
|
+
const [key, ...rest] = path62;
|
|
7532
7532
|
if (rest.length === 0)
|
|
7533
7533
|
return this.delete(key);
|
|
7534
7534
|
const node = this.get(key, true);
|
|
@@ -7542,8 +7542,8 @@ var require_Collection = __commonJS({
|
|
|
7542
7542
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
7543
7543
|
* `true` (collections are always returned intact).
|
|
7544
7544
|
*/
|
|
7545
|
-
getIn(
|
|
7546
|
-
const [key, ...rest] =
|
|
7545
|
+
getIn(path62, keepScalar) {
|
|
7546
|
+
const [key, ...rest] = path62;
|
|
7547
7547
|
const node = this.get(key, true);
|
|
7548
7548
|
if (rest.length === 0)
|
|
7549
7549
|
return !keepScalar && identity2.isScalar(node) ? node.value : node;
|
|
@@ -7561,8 +7561,8 @@ var require_Collection = __commonJS({
|
|
|
7561
7561
|
/**
|
|
7562
7562
|
* Checks if the collection includes a value with the key `key`.
|
|
7563
7563
|
*/
|
|
7564
|
-
hasIn(
|
|
7565
|
-
const [key, ...rest] =
|
|
7564
|
+
hasIn(path62) {
|
|
7565
|
+
const [key, ...rest] = path62;
|
|
7566
7566
|
if (rest.length === 0)
|
|
7567
7567
|
return this.has(key);
|
|
7568
7568
|
const node = this.get(key, true);
|
|
@@ -7572,8 +7572,8 @@ var require_Collection = __commonJS({
|
|
|
7572
7572
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
7573
7573
|
* boolean to add/remove the item from the set.
|
|
7574
7574
|
*/
|
|
7575
|
-
setIn(
|
|
7576
|
-
const [key, ...rest] =
|
|
7575
|
+
setIn(path62, value) {
|
|
7576
|
+
const [key, ...rest] = path62;
|
|
7577
7577
|
if (rest.length === 0) {
|
|
7578
7578
|
this.set(key, value);
|
|
7579
7579
|
} else {
|
|
@@ -10150,9 +10150,9 @@ var require_Document = __commonJS({
|
|
|
10150
10150
|
this.contents.add(value);
|
|
10151
10151
|
}
|
|
10152
10152
|
/** Adds a value to the document. */
|
|
10153
|
-
addIn(
|
|
10153
|
+
addIn(path62, value) {
|
|
10154
10154
|
if (assertCollection(this.contents))
|
|
10155
|
-
this.contents.addIn(
|
|
10155
|
+
this.contents.addIn(path62, value);
|
|
10156
10156
|
}
|
|
10157
10157
|
/**
|
|
10158
10158
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -10227,14 +10227,14 @@ var require_Document = __commonJS({
|
|
|
10227
10227
|
* Removes a value from the document.
|
|
10228
10228
|
* @returns `true` if the item was found and removed.
|
|
10229
10229
|
*/
|
|
10230
|
-
deleteIn(
|
|
10231
|
-
if (Collection.isEmptyPath(
|
|
10230
|
+
deleteIn(path62) {
|
|
10231
|
+
if (Collection.isEmptyPath(path62)) {
|
|
10232
10232
|
if (this.contents == null)
|
|
10233
10233
|
return false;
|
|
10234
10234
|
this.contents = null;
|
|
10235
10235
|
return true;
|
|
10236
10236
|
}
|
|
10237
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
10237
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path62) : false;
|
|
10238
10238
|
}
|
|
10239
10239
|
/**
|
|
10240
10240
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -10249,10 +10249,10 @@ var require_Document = __commonJS({
|
|
|
10249
10249
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
10250
10250
|
* `true` (collections are always returned intact).
|
|
10251
10251
|
*/
|
|
10252
|
-
getIn(
|
|
10253
|
-
if (Collection.isEmptyPath(
|
|
10252
|
+
getIn(path62, keepScalar) {
|
|
10253
|
+
if (Collection.isEmptyPath(path62))
|
|
10254
10254
|
return !keepScalar && identity2.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
10255
|
-
return identity2.isCollection(this.contents) ? this.contents.getIn(
|
|
10255
|
+
return identity2.isCollection(this.contents) ? this.contents.getIn(path62, keepScalar) : void 0;
|
|
10256
10256
|
}
|
|
10257
10257
|
/**
|
|
10258
10258
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -10263,10 +10263,10 @@ var require_Document = __commonJS({
|
|
|
10263
10263
|
/**
|
|
10264
10264
|
* Checks if the document includes a value at `path`.
|
|
10265
10265
|
*/
|
|
10266
|
-
hasIn(
|
|
10267
|
-
if (Collection.isEmptyPath(
|
|
10266
|
+
hasIn(path62) {
|
|
10267
|
+
if (Collection.isEmptyPath(path62))
|
|
10268
10268
|
return this.contents !== void 0;
|
|
10269
|
-
return identity2.isCollection(this.contents) ? this.contents.hasIn(
|
|
10269
|
+
return identity2.isCollection(this.contents) ? this.contents.hasIn(path62) : false;
|
|
10270
10270
|
}
|
|
10271
10271
|
/**
|
|
10272
10272
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -10283,13 +10283,13 @@ var require_Document = __commonJS({
|
|
|
10283
10283
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
10284
10284
|
* boolean to add/remove the item from the set.
|
|
10285
10285
|
*/
|
|
10286
|
-
setIn(
|
|
10287
|
-
if (Collection.isEmptyPath(
|
|
10286
|
+
setIn(path62, value) {
|
|
10287
|
+
if (Collection.isEmptyPath(path62)) {
|
|
10288
10288
|
this.contents = value;
|
|
10289
10289
|
} else if (this.contents == null) {
|
|
10290
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
10290
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path62), value);
|
|
10291
10291
|
} else if (assertCollection(this.contents)) {
|
|
10292
|
-
this.contents.setIn(
|
|
10292
|
+
this.contents.setIn(path62, value);
|
|
10293
10293
|
}
|
|
10294
10294
|
}
|
|
10295
10295
|
/**
|
|
@@ -12301,9 +12301,9 @@ var require_cst_visit = __commonJS({
|
|
|
12301
12301
|
visit2.BREAK = BREAK;
|
|
12302
12302
|
visit2.SKIP = SKIP;
|
|
12303
12303
|
visit2.REMOVE = REMOVE;
|
|
12304
|
-
visit2.itemAtPath = (cst,
|
|
12304
|
+
visit2.itemAtPath = (cst, path62) => {
|
|
12305
12305
|
let item = cst;
|
|
12306
|
-
for (const [field, index2] of
|
|
12306
|
+
for (const [field, index2] of path62) {
|
|
12307
12307
|
const tok = item?.[field];
|
|
12308
12308
|
if (tok && "items" in tok) {
|
|
12309
12309
|
item = tok.items[index2];
|
|
@@ -12312,23 +12312,23 @@ var require_cst_visit = __commonJS({
|
|
|
12312
12312
|
}
|
|
12313
12313
|
return item;
|
|
12314
12314
|
};
|
|
12315
|
-
visit2.parentCollection = (cst,
|
|
12316
|
-
const parent2 = visit2.itemAtPath(cst,
|
|
12317
|
-
const field =
|
|
12315
|
+
visit2.parentCollection = (cst, path62) => {
|
|
12316
|
+
const parent2 = visit2.itemAtPath(cst, path62.slice(0, -1));
|
|
12317
|
+
const field = path62[path62.length - 1][0];
|
|
12318
12318
|
const coll = parent2?.[field];
|
|
12319
12319
|
if (coll && "items" in coll)
|
|
12320
12320
|
return coll;
|
|
12321
12321
|
throw new Error("Parent collection not found");
|
|
12322
12322
|
};
|
|
12323
|
-
function _visit(
|
|
12324
|
-
let ctrl = visitor(item,
|
|
12323
|
+
function _visit(path62, item, visitor) {
|
|
12324
|
+
let ctrl = visitor(item, path62);
|
|
12325
12325
|
if (typeof ctrl === "symbol")
|
|
12326
12326
|
return ctrl;
|
|
12327
12327
|
for (const field of ["key", "value"]) {
|
|
12328
12328
|
const token = item[field];
|
|
12329
12329
|
if (token && "items" in token) {
|
|
12330
12330
|
for (let i = 0; i < token.items.length; ++i) {
|
|
12331
|
-
const ci = _visit(Object.freeze(
|
|
12331
|
+
const ci = _visit(Object.freeze(path62.concat([[field, i]])), token.items[i], visitor);
|
|
12332
12332
|
if (typeof ci === "number")
|
|
12333
12333
|
i = ci - 1;
|
|
12334
12334
|
else if (ci === BREAK)
|
|
@@ -12339,10 +12339,10 @@ var require_cst_visit = __commonJS({
|
|
|
12339
12339
|
}
|
|
12340
12340
|
}
|
|
12341
12341
|
if (typeof ctrl === "function" && field === "key")
|
|
12342
|
-
ctrl = ctrl(item,
|
|
12342
|
+
ctrl = ctrl(item, path62);
|
|
12343
12343
|
}
|
|
12344
12344
|
}
|
|
12345
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
12345
|
+
return typeof ctrl === "function" ? ctrl(item, path62) : ctrl;
|
|
12346
12346
|
}
|
|
12347
12347
|
__name(_visit, "_visit");
|
|
12348
12348
|
exports2.visit = visit2;
|
|
@@ -13664,14 +13664,14 @@ var require_parser = __commonJS({
|
|
|
13664
13664
|
case "scalar":
|
|
13665
13665
|
case "single-quoted-scalar":
|
|
13666
13666
|
case "double-quoted-scalar": {
|
|
13667
|
-
const
|
|
13667
|
+
const fs57 = this.flowScalar(this.type);
|
|
13668
13668
|
if (atNextItem || it2.value) {
|
|
13669
|
-
map3.items.push({ start, key:
|
|
13669
|
+
map3.items.push({ start, key: fs57, sep: [] });
|
|
13670
13670
|
this.onKeyLine = true;
|
|
13671
13671
|
} else if (it2.sep) {
|
|
13672
|
-
this.stack.push(
|
|
13672
|
+
this.stack.push(fs57);
|
|
13673
13673
|
} else {
|
|
13674
|
-
Object.assign(it2, { key:
|
|
13674
|
+
Object.assign(it2, { key: fs57, sep: [] });
|
|
13675
13675
|
this.onKeyLine = true;
|
|
13676
13676
|
}
|
|
13677
13677
|
return;
|
|
@@ -13799,13 +13799,13 @@ var require_parser = __commonJS({
|
|
|
13799
13799
|
case "scalar":
|
|
13800
13800
|
case "single-quoted-scalar":
|
|
13801
13801
|
case "double-quoted-scalar": {
|
|
13802
|
-
const
|
|
13802
|
+
const fs57 = this.flowScalar(this.type);
|
|
13803
13803
|
if (!it2 || it2.value)
|
|
13804
|
-
fc.items.push({ start: [], key:
|
|
13804
|
+
fc.items.push({ start: [], key: fs57, sep: [] });
|
|
13805
13805
|
else if (it2.sep)
|
|
13806
|
-
this.stack.push(
|
|
13806
|
+
this.stack.push(fs57);
|
|
13807
13807
|
else
|
|
13808
|
-
Object.assign(it2, { key:
|
|
13808
|
+
Object.assign(it2, { key: fs57, sep: [] });
|
|
13809
13809
|
return;
|
|
13810
13810
|
}
|
|
13811
13811
|
case "flow-map-end":
|
|
@@ -14744,9 +14744,9 @@ var init_skill_DRd1jW7a = __esm({
|
|
|
14744
14744
|
if (!(await Promise.all(entries2.map((entry) => writeSkillFiles(resolved, entry, baseDir)))).some(Boolean)) throw new Error(`Failed to fetch any skill files from well-known index at ${inputUrl}`);
|
|
14745
14745
|
return baseDir;
|
|
14746
14746
|
}, "fetchWellKnownSkills");
|
|
14747
|
-
readJsonObjectIfExists = /* @__PURE__ */ __name(async (
|
|
14747
|
+
readJsonObjectIfExists = /* @__PURE__ */ __name(async (path62) => {
|
|
14748
14748
|
try {
|
|
14749
|
-
const content2 = await readFile(
|
|
14749
|
+
const content2 = await readFile(path62, "utf-8");
|
|
14750
14750
|
const parsed = JSON.parse(content2);
|
|
14751
14751
|
return isPlainObject2(parsed) ? parsed : null;
|
|
14752
14752
|
} catch {
|
|
@@ -14941,16 +14941,16 @@ var init_skill_DRd1jW7a = __esm({
|
|
|
14941
14941
|
if (isGlobal) return agent.globalSkillsDir ?? join3(baseDir, agent.skillsDir);
|
|
14942
14942
|
return join3(baseDir, agent.skillsDir);
|
|
14943
14943
|
}, "getSkillAgentBaseDir");
|
|
14944
|
-
cleanAndCreateDirectory = /* @__PURE__ */ __name(async (
|
|
14945
|
-
await rm(
|
|
14944
|
+
cleanAndCreateDirectory = /* @__PURE__ */ __name(async (path62) => {
|
|
14945
|
+
await rm(path62, {
|
|
14946
14946
|
recursive: true,
|
|
14947
14947
|
force: true
|
|
14948
14948
|
}).catch(() => void 0);
|
|
14949
|
-
await mkdir(
|
|
14949
|
+
await mkdir(path62, { recursive: true });
|
|
14950
14950
|
}, "cleanAndCreateDirectory");
|
|
14951
14951
|
resolveSymlinkTarget = /* @__PURE__ */ __name((linkPath, linkTarget) => resolve(dirname(linkPath), linkTarget), "resolveSymlinkTarget");
|
|
14952
|
-
resolveParentSymlinks = /* @__PURE__ */ __name(async (
|
|
14953
|
-
const resolved = resolve(
|
|
14952
|
+
resolveParentSymlinks = /* @__PURE__ */ __name(async (path62) => {
|
|
14953
|
+
const resolved = resolve(path62);
|
|
14954
14954
|
const parentDir = dirname(resolved);
|
|
14955
14955
|
const name = basename(resolved);
|
|
14956
14956
|
try {
|
|
@@ -19364,17 +19364,17 @@ function listReferenceDocs(skillDir) {
|
|
|
19364
19364
|
return [];
|
|
19365
19365
|
}
|
|
19366
19366
|
const out = [];
|
|
19367
|
-
const
|
|
19367
|
+
const walk2 = /* @__PURE__ */ __name((cur, prefix) => {
|
|
19368
19368
|
for (const entry of fs7.readdirSync(cur, { withFileTypes: true })) {
|
|
19369
19369
|
const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
19370
19370
|
if (entry.isDirectory()) {
|
|
19371
|
-
|
|
19371
|
+
walk2(path7.join(cur, entry.name), rel);
|
|
19372
19372
|
} else if (entry.isFile() && entry.name.endsWith(".md")) {
|
|
19373
19373
|
out.push(rel.slice(0, -".md".length));
|
|
19374
19374
|
}
|
|
19375
19375
|
}
|
|
19376
19376
|
}, "walk");
|
|
19377
|
-
|
|
19377
|
+
walk2(refsDir, "");
|
|
19378
19378
|
return out.sort();
|
|
19379
19379
|
}
|
|
19380
19380
|
function discoverBundledSkills() {
|
|
@@ -19855,8 +19855,8 @@ function formatZodIssues(parsed) {
|
|
|
19855
19855
|
return null;
|
|
19856
19856
|
}
|
|
19857
19857
|
return issues.map((issue2) => {
|
|
19858
|
-
const { path:
|
|
19859
|
-
const prefix = Array.isArray(
|
|
19858
|
+
const { path: path62, message } = issue2;
|
|
19859
|
+
const prefix = Array.isArray(path62) && path62.length > 0 ? `${path62.join(".")}: ` : "";
|
|
19860
19860
|
return `${prefix}${typeof message === "string" ? message : "Invalid value"}`;
|
|
19861
19861
|
}).join("; ");
|
|
19862
19862
|
}
|
|
@@ -19877,11 +19877,11 @@ var init_api = __esm({
|
|
|
19877
19877
|
method;
|
|
19878
19878
|
path;
|
|
19879
19879
|
detail;
|
|
19880
|
-
constructor(method,
|
|
19881
|
-
super(`API ${method} ${
|
|
19880
|
+
constructor(method, path62, status, detail) {
|
|
19881
|
+
super(`API ${method} ${path62} failed: ${status} ${detail}`);
|
|
19882
19882
|
this.name = "ApiRequestError";
|
|
19883
19883
|
this.method = method;
|
|
19884
|
-
this.path =
|
|
19884
|
+
this.path = path62;
|
|
19885
19885
|
this.status = status;
|
|
19886
19886
|
this.detail = detail;
|
|
19887
19887
|
}
|
|
@@ -19982,7 +19982,7 @@ var init_api = __esm({
|
|
|
19982
19982
|
resolveAuthToken() {
|
|
19983
19983
|
return process.env.FIMO_API_TOKEN?.trim() || requireToken(this.cfg);
|
|
19984
19984
|
}
|
|
19985
|
-
async request(
|
|
19985
|
+
async request(path62, init = {}, opts = {}) {
|
|
19986
19986
|
const token = this.resolveAuthToken();
|
|
19987
19987
|
const headers = new Headers(init.headers);
|
|
19988
19988
|
headers.set("Authorization", `Bearer ${token}`);
|
|
@@ -19992,7 +19992,7 @@ var init_api = __esm({
|
|
|
19992
19992
|
if (this.env && !headers.has(FIMO_ENV_HEADER)) {
|
|
19993
19993
|
headers.set(FIMO_ENV_HEADER, this.env);
|
|
19994
19994
|
}
|
|
19995
|
-
const response = await fimoFetch(`${this.cfg.apiUrl}${
|
|
19995
|
+
const response = await fimoFetch(`${this.cfg.apiUrl}${path62}`, { ...init, headers });
|
|
19996
19996
|
if (response.status === 401) {
|
|
19997
19997
|
throwUnauthorized(this.cfg, response.status);
|
|
19998
19998
|
}
|
|
@@ -20001,21 +20001,21 @@ var init_api = __esm({
|
|
|
20001
20001
|
}
|
|
20002
20002
|
if (!response.ok) {
|
|
20003
20003
|
const error45 = await this.formatError(response);
|
|
20004
|
-
throw new ApiRequestError(init.method ?? "GET",
|
|
20004
|
+
throw new ApiRequestError(init.method ?? "GET", path62, response.status, error45);
|
|
20005
20005
|
}
|
|
20006
20006
|
if (response.status === 204) {
|
|
20007
20007
|
return void 0;
|
|
20008
20008
|
}
|
|
20009
20009
|
return await response.json();
|
|
20010
20010
|
}
|
|
20011
|
-
async rawRequest(
|
|
20011
|
+
async rawRequest(path62, init = {}) {
|
|
20012
20012
|
const token = this.resolveAuthToken();
|
|
20013
20013
|
const headers = new Headers(init.headers);
|
|
20014
20014
|
headers.set("Authorization", `Bearer ${token}`);
|
|
20015
20015
|
if (this.env && !headers.has(FIMO_ENV_HEADER)) {
|
|
20016
20016
|
headers.set(FIMO_ENV_HEADER, this.env);
|
|
20017
20017
|
}
|
|
20018
|
-
const response = await fimoFetch(`${this.cfg.apiUrl}${
|
|
20018
|
+
const response = await fimoFetch(`${this.cfg.apiUrl}${path62}`, { ...init, headers });
|
|
20019
20019
|
if (response.status === 401) {
|
|
20020
20020
|
throwUnauthorized(this.cfg, response.status);
|
|
20021
20021
|
}
|
|
@@ -20024,7 +20024,7 @@ var init_api = __esm({
|
|
|
20024
20024
|
}
|
|
20025
20025
|
if (!response.ok) {
|
|
20026
20026
|
const error45 = await this.formatError(response);
|
|
20027
|
-
throw new Error(`API ${init.method ?? "GET"} ${
|
|
20027
|
+
throw new Error(`API ${init.method ?? "GET"} ${path62} failed: ${response.status} ${error45}`);
|
|
20028
20028
|
}
|
|
20029
20029
|
return response;
|
|
20030
20030
|
}
|
|
@@ -20360,8 +20360,8 @@ var init_api = __esm({
|
|
|
20360
20360
|
// ── Per-surface lazy-fetch (V3 §20.4) ────────────────────────────────
|
|
20361
20361
|
// One method per surface — all share the same `(projectId, env, against?, …key)`
|
|
20362
20362
|
// shape. The drill-in renderers in `utils/format/drill/*` consume these.
|
|
20363
|
-
async getCodeFileDiff(projectId, env2,
|
|
20364
|
-
const qs = lazyFetchQs(opts.against, { path:
|
|
20363
|
+
async getCodeFileDiff(projectId, env2, path62, opts = {}) {
|
|
20364
|
+
const qs = lazyFetchQs(opts.against, { path: path62 });
|
|
20365
20365
|
const body = await this.request(
|
|
20366
20366
|
`/api/management/projects/${projectId}/envs/${encodeURIComponent(env2)}/diff/code/file?${qs}`
|
|
20367
20367
|
);
|
|
@@ -20382,38 +20382,38 @@ var init_api = __esm({
|
|
|
20382
20382
|
}
|
|
20383
20383
|
async getContentRowDiff(projectId, env2, collection, rowId, opts = {}) {
|
|
20384
20384
|
const qs = lazyFetchQs(opts.against);
|
|
20385
|
-
const
|
|
20386
|
-
const body = await this.request(qs ? `${
|
|
20385
|
+
const path62 = `/api/management/projects/${projectId}/envs/${encodeURIComponent(env2)}/diff/content/${encodeURIComponent(collection)}/${encodeURIComponent(rowId)}`;
|
|
20386
|
+
const body = await this.request(qs ? `${path62}?${qs}` : path62);
|
|
20387
20387
|
return body.data;
|
|
20388
20388
|
}
|
|
20389
20389
|
async getSchemaTypeDiff(projectId, env2, typeName, opts = {}) {
|
|
20390
20390
|
const qs = lazyFetchQs(opts.against);
|
|
20391
|
-
const
|
|
20392
|
-
const body = await this.request(qs ? `${
|
|
20391
|
+
const path62 = `/api/management/projects/${projectId}/envs/${encodeURIComponent(env2)}/diff/schemas/${encodeURIComponent(typeName)}`;
|
|
20392
|
+
const body = await this.request(qs ? `${path62}?${qs}` : path62);
|
|
20393
20393
|
return body.data;
|
|
20394
20394
|
}
|
|
20395
20395
|
async getAssetDiff(projectId, env2, assetId, opts = {}) {
|
|
20396
20396
|
const qs = lazyFetchQs(opts.against);
|
|
20397
|
-
const
|
|
20398
|
-
const body = await this.request(qs ? `${
|
|
20397
|
+
const path62 = `/api/management/projects/${projectId}/envs/${encodeURIComponent(env2)}/diff/assets/${encodeURIComponent(assetId)}`;
|
|
20398
|
+
const body = await this.request(qs ? `${path62}?${qs}` : path62);
|
|
20399
20399
|
return body.data;
|
|
20400
20400
|
}
|
|
20401
20401
|
async getTranslationRowDiff(projectId, env2, locale, key, opts = {}) {
|
|
20402
20402
|
const qs = lazyFetchQs(opts.against);
|
|
20403
|
-
const
|
|
20404
|
-
const body = await this.request(qs ? `${
|
|
20403
|
+
const path62 = `/api/management/projects/${projectId}/envs/${encodeURIComponent(env2)}/diff/translations/${encodeURIComponent(locale)}/${encodeURIComponent(key)}`;
|
|
20404
|
+
const body = await this.request(qs ? `${path62}?${qs}` : path62);
|
|
20405
20405
|
return body.data;
|
|
20406
20406
|
}
|
|
20407
20407
|
async getFormSchemaDiff(projectId, env2, formName, opts = {}) {
|
|
20408
20408
|
const qs = lazyFetchQs(opts.against);
|
|
20409
|
-
const
|
|
20410
|
-
const body = await this.request(qs ? `${
|
|
20409
|
+
const path62 = `/api/management/projects/${projectId}/envs/${encodeURIComponent(env2)}/diff/forms/${encodeURIComponent(formName)}`;
|
|
20410
|
+
const body = await this.request(qs ? `${path62}?${qs}` : path62);
|
|
20411
20411
|
return body.data;
|
|
20412
20412
|
}
|
|
20413
20413
|
async getActivationDiff(projectId, env2, agentName, triggerIndex, opts = {}) {
|
|
20414
20414
|
const qs = lazyFetchQs(opts.against);
|
|
20415
|
-
const
|
|
20416
|
-
const body = await this.request(qs ? `${
|
|
20415
|
+
const path62 = `/api/management/projects/${projectId}/envs/${encodeURIComponent(env2)}/diff/activations/${encodeURIComponent(agentName)}/${triggerIndex}`;
|
|
20416
|
+
const body = await this.request(qs ? `${path62}?${qs}` : path62);
|
|
20417
20417
|
return body.data;
|
|
20418
20418
|
}
|
|
20419
20419
|
/** Merge `from` → `env` via the M09 engine. */
|
|
@@ -20825,6 +20825,18 @@ var init_api = __esm({
|
|
|
20825
20825
|
});
|
|
20826
20826
|
return body.data;
|
|
20827
20827
|
}
|
|
20828
|
+
/** Upsert a SINGLETON's single document (collections use createEntriesBatch). */
|
|
20829
|
+
async putDocument(projectId, typeName, data2, options = {}) {
|
|
20830
|
+
const query = options.locale ? `?locale=${encodeURIComponent(options.locale)}` : "";
|
|
20831
|
+
const body = await this.request(
|
|
20832
|
+
this.tenantPath(projectId, `/documents/${typeName}${query}`),
|
|
20833
|
+
{
|
|
20834
|
+
method: "PUT",
|
|
20835
|
+
body: JSON.stringify({ data: data2 })
|
|
20836
|
+
}
|
|
20837
|
+
);
|
|
20838
|
+
return body.data;
|
|
20839
|
+
}
|
|
20828
20840
|
async updateEntry(projectId, typeName, id, data2) {
|
|
20829
20841
|
const body = await this.request(this.tenantPath(projectId, `/entries/${typeName}/${id}`), {
|
|
20830
20842
|
method: "PUT",
|
|
@@ -21090,17 +21102,17 @@ var require_visit2 = __commonJS({
|
|
|
21090
21102
|
visit2.BREAK = BREAK;
|
|
21091
21103
|
visit2.SKIP = SKIP;
|
|
21092
21104
|
visit2.REMOVE = REMOVE;
|
|
21093
|
-
function visit_(key, node, visitor,
|
|
21094
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
21105
|
+
function visit_(key, node, visitor, path62) {
|
|
21106
|
+
const ctrl = callVisitor(key, node, visitor, path62);
|
|
21095
21107
|
if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
|
|
21096
|
-
replaceNode(key,
|
|
21097
|
-
return visit_(key, ctrl, visitor,
|
|
21108
|
+
replaceNode(key, path62, ctrl);
|
|
21109
|
+
return visit_(key, ctrl, visitor, path62);
|
|
21098
21110
|
}
|
|
21099
21111
|
if (typeof ctrl !== "symbol") {
|
|
21100
21112
|
if (identity2.isCollection(node)) {
|
|
21101
|
-
|
|
21113
|
+
path62 = Object.freeze(path62.concat(node));
|
|
21102
21114
|
for (let i = 0; i < node.items.length; ++i) {
|
|
21103
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
21115
|
+
const ci = visit_(i, node.items[i], visitor, path62);
|
|
21104
21116
|
if (typeof ci === "number")
|
|
21105
21117
|
i = ci - 1;
|
|
21106
21118
|
else if (ci === BREAK)
|
|
@@ -21111,13 +21123,13 @@ var require_visit2 = __commonJS({
|
|
|
21111
21123
|
}
|
|
21112
21124
|
}
|
|
21113
21125
|
} else if (identity2.isPair(node)) {
|
|
21114
|
-
|
|
21115
|
-
const ck = visit_("key", node.key, visitor,
|
|
21126
|
+
path62 = Object.freeze(path62.concat(node));
|
|
21127
|
+
const ck = visit_("key", node.key, visitor, path62);
|
|
21116
21128
|
if (ck === BREAK)
|
|
21117
21129
|
return BREAK;
|
|
21118
21130
|
else if (ck === REMOVE)
|
|
21119
21131
|
node.key = null;
|
|
21120
|
-
const cv = visit_("value", node.value, visitor,
|
|
21132
|
+
const cv = visit_("value", node.value, visitor, path62);
|
|
21121
21133
|
if (cv === BREAK)
|
|
21122
21134
|
return BREAK;
|
|
21123
21135
|
else if (cv === REMOVE)
|
|
@@ -21140,17 +21152,17 @@ var require_visit2 = __commonJS({
|
|
|
21140
21152
|
visitAsync.BREAK = BREAK;
|
|
21141
21153
|
visitAsync.SKIP = SKIP;
|
|
21142
21154
|
visitAsync.REMOVE = REMOVE;
|
|
21143
|
-
async function visitAsync_(key, node, visitor,
|
|
21144
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
21155
|
+
async function visitAsync_(key, node, visitor, path62) {
|
|
21156
|
+
const ctrl = await callVisitor(key, node, visitor, path62);
|
|
21145
21157
|
if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
|
|
21146
|
-
replaceNode(key,
|
|
21147
|
-
return visitAsync_(key, ctrl, visitor,
|
|
21158
|
+
replaceNode(key, path62, ctrl);
|
|
21159
|
+
return visitAsync_(key, ctrl, visitor, path62);
|
|
21148
21160
|
}
|
|
21149
21161
|
if (typeof ctrl !== "symbol") {
|
|
21150
21162
|
if (identity2.isCollection(node)) {
|
|
21151
|
-
|
|
21163
|
+
path62 = Object.freeze(path62.concat(node));
|
|
21152
21164
|
for (let i = 0; i < node.items.length; ++i) {
|
|
21153
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
21165
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path62);
|
|
21154
21166
|
if (typeof ci === "number")
|
|
21155
21167
|
i = ci - 1;
|
|
21156
21168
|
else if (ci === BREAK)
|
|
@@ -21161,13 +21173,13 @@ var require_visit2 = __commonJS({
|
|
|
21161
21173
|
}
|
|
21162
21174
|
}
|
|
21163
21175
|
} else if (identity2.isPair(node)) {
|
|
21164
|
-
|
|
21165
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
21176
|
+
path62 = Object.freeze(path62.concat(node));
|
|
21177
|
+
const ck = await visitAsync_("key", node.key, visitor, path62);
|
|
21166
21178
|
if (ck === BREAK)
|
|
21167
21179
|
return BREAK;
|
|
21168
21180
|
else if (ck === REMOVE)
|
|
21169
21181
|
node.key = null;
|
|
21170
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
21182
|
+
const cv = await visitAsync_("value", node.value, visitor, path62);
|
|
21171
21183
|
if (cv === BREAK)
|
|
21172
21184
|
return BREAK;
|
|
21173
21185
|
else if (cv === REMOVE)
|
|
@@ -21196,24 +21208,24 @@ var require_visit2 = __commonJS({
|
|
|
21196
21208
|
return visitor;
|
|
21197
21209
|
}
|
|
21198
21210
|
__name(initVisitor, "initVisitor");
|
|
21199
|
-
function callVisitor(key, node, visitor,
|
|
21211
|
+
function callVisitor(key, node, visitor, path62) {
|
|
21200
21212
|
if (typeof visitor === "function")
|
|
21201
|
-
return visitor(key, node,
|
|
21213
|
+
return visitor(key, node, path62);
|
|
21202
21214
|
if (identity2.isMap(node))
|
|
21203
|
-
return visitor.Map?.(key, node,
|
|
21215
|
+
return visitor.Map?.(key, node, path62);
|
|
21204
21216
|
if (identity2.isSeq(node))
|
|
21205
|
-
return visitor.Seq?.(key, node,
|
|
21217
|
+
return visitor.Seq?.(key, node, path62);
|
|
21206
21218
|
if (identity2.isPair(node))
|
|
21207
|
-
return visitor.Pair?.(key, node,
|
|
21219
|
+
return visitor.Pair?.(key, node, path62);
|
|
21208
21220
|
if (identity2.isScalar(node))
|
|
21209
|
-
return visitor.Scalar?.(key, node,
|
|
21221
|
+
return visitor.Scalar?.(key, node, path62);
|
|
21210
21222
|
if (identity2.isAlias(node))
|
|
21211
|
-
return visitor.Alias?.(key, node,
|
|
21223
|
+
return visitor.Alias?.(key, node, path62);
|
|
21212
21224
|
return void 0;
|
|
21213
21225
|
}
|
|
21214
21226
|
__name(callVisitor, "callVisitor");
|
|
21215
|
-
function replaceNode(key,
|
|
21216
|
-
const parent2 =
|
|
21227
|
+
function replaceNode(key, path62, node) {
|
|
21228
|
+
const parent2 = path62[path62.length - 1];
|
|
21217
21229
|
if (identity2.isCollection(parent2)) {
|
|
21218
21230
|
parent2.items[key] = node;
|
|
21219
21231
|
} else if (identity2.isPair(parent2)) {
|
|
@@ -21843,10 +21855,10 @@ var require_Collection2 = __commonJS({
|
|
|
21843
21855
|
var createNode = require_createNode2();
|
|
21844
21856
|
var identity2 = require_identity2();
|
|
21845
21857
|
var Node2 = require_Node2();
|
|
21846
|
-
function collectionFromPath(schema,
|
|
21858
|
+
function collectionFromPath(schema, path62, value) {
|
|
21847
21859
|
let v = value;
|
|
21848
|
-
for (let i =
|
|
21849
|
-
const k =
|
|
21860
|
+
for (let i = path62.length - 1; i >= 0; --i) {
|
|
21861
|
+
const k = path62[i];
|
|
21850
21862
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
21851
21863
|
const a = [];
|
|
21852
21864
|
a[k] = v;
|
|
@@ -21866,7 +21878,7 @@ var require_Collection2 = __commonJS({
|
|
|
21866
21878
|
});
|
|
21867
21879
|
}
|
|
21868
21880
|
__name(collectionFromPath, "collectionFromPath");
|
|
21869
|
-
var isEmptyPath = /* @__PURE__ */ __name((
|
|
21881
|
+
var isEmptyPath = /* @__PURE__ */ __name((path62) => path62 == null || typeof path62 === "object" && !!path62[Symbol.iterator]().next().done, "isEmptyPath");
|
|
21870
21882
|
var Collection = class extends Node2.NodeBase {
|
|
21871
21883
|
static {
|
|
21872
21884
|
__name(this, "Collection");
|
|
@@ -21899,11 +21911,11 @@ var require_Collection2 = __commonJS({
|
|
|
21899
21911
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
21900
21912
|
* that already exists in the map.
|
|
21901
21913
|
*/
|
|
21902
|
-
addIn(
|
|
21903
|
-
if (isEmptyPath(
|
|
21914
|
+
addIn(path62, value) {
|
|
21915
|
+
if (isEmptyPath(path62))
|
|
21904
21916
|
this.add(value);
|
|
21905
21917
|
else {
|
|
21906
|
-
const [key, ...rest] =
|
|
21918
|
+
const [key, ...rest] = path62;
|
|
21907
21919
|
const node = this.get(key, true);
|
|
21908
21920
|
if (identity2.isCollection(node))
|
|
21909
21921
|
node.addIn(rest, value);
|
|
@@ -21917,8 +21929,8 @@ var require_Collection2 = __commonJS({
|
|
|
21917
21929
|
* Removes a value from the collection.
|
|
21918
21930
|
* @returns `true` if the item was found and removed.
|
|
21919
21931
|
*/
|
|
21920
|
-
deleteIn(
|
|
21921
|
-
const [key, ...rest] =
|
|
21932
|
+
deleteIn(path62) {
|
|
21933
|
+
const [key, ...rest] = path62;
|
|
21922
21934
|
if (rest.length === 0)
|
|
21923
21935
|
return this.delete(key);
|
|
21924
21936
|
const node = this.get(key, true);
|
|
@@ -21932,8 +21944,8 @@ var require_Collection2 = __commonJS({
|
|
|
21932
21944
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
21933
21945
|
* `true` (collections are always returned intact).
|
|
21934
21946
|
*/
|
|
21935
|
-
getIn(
|
|
21936
|
-
const [key, ...rest] =
|
|
21947
|
+
getIn(path62, keepScalar) {
|
|
21948
|
+
const [key, ...rest] = path62;
|
|
21937
21949
|
const node = this.get(key, true);
|
|
21938
21950
|
if (rest.length === 0)
|
|
21939
21951
|
return !keepScalar && identity2.isScalar(node) ? node.value : node;
|
|
@@ -21951,8 +21963,8 @@ var require_Collection2 = __commonJS({
|
|
|
21951
21963
|
/**
|
|
21952
21964
|
* Checks if the collection includes a value with the key `key`.
|
|
21953
21965
|
*/
|
|
21954
|
-
hasIn(
|
|
21955
|
-
const [key, ...rest] =
|
|
21966
|
+
hasIn(path62) {
|
|
21967
|
+
const [key, ...rest] = path62;
|
|
21956
21968
|
if (rest.length === 0)
|
|
21957
21969
|
return this.has(key);
|
|
21958
21970
|
const node = this.get(key, true);
|
|
@@ -21962,8 +21974,8 @@ var require_Collection2 = __commonJS({
|
|
|
21962
21974
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
21963
21975
|
* boolean to add/remove the item from the set.
|
|
21964
21976
|
*/
|
|
21965
|
-
setIn(
|
|
21966
|
-
const [key, ...rest] =
|
|
21977
|
+
setIn(path62, value) {
|
|
21978
|
+
const [key, ...rest] = path62;
|
|
21967
21979
|
if (rest.length === 0) {
|
|
21968
21980
|
this.set(key, value);
|
|
21969
21981
|
} else {
|
|
@@ -24528,9 +24540,9 @@ var require_Document2 = __commonJS({
|
|
|
24528
24540
|
this.contents.add(value);
|
|
24529
24541
|
}
|
|
24530
24542
|
/** Adds a value to the document. */
|
|
24531
|
-
addIn(
|
|
24543
|
+
addIn(path62, value) {
|
|
24532
24544
|
if (assertCollection(this.contents))
|
|
24533
|
-
this.contents.addIn(
|
|
24545
|
+
this.contents.addIn(path62, value);
|
|
24534
24546
|
}
|
|
24535
24547
|
/**
|
|
24536
24548
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -24605,14 +24617,14 @@ var require_Document2 = __commonJS({
|
|
|
24605
24617
|
* Removes a value from the document.
|
|
24606
24618
|
* @returns `true` if the item was found and removed.
|
|
24607
24619
|
*/
|
|
24608
|
-
deleteIn(
|
|
24609
|
-
if (Collection.isEmptyPath(
|
|
24620
|
+
deleteIn(path62) {
|
|
24621
|
+
if (Collection.isEmptyPath(path62)) {
|
|
24610
24622
|
if (this.contents == null)
|
|
24611
24623
|
return false;
|
|
24612
24624
|
this.contents = null;
|
|
24613
24625
|
return true;
|
|
24614
24626
|
}
|
|
24615
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
24627
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path62) : false;
|
|
24616
24628
|
}
|
|
24617
24629
|
/**
|
|
24618
24630
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -24627,10 +24639,10 @@ var require_Document2 = __commonJS({
|
|
|
24627
24639
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
24628
24640
|
* `true` (collections are always returned intact).
|
|
24629
24641
|
*/
|
|
24630
|
-
getIn(
|
|
24631
|
-
if (Collection.isEmptyPath(
|
|
24642
|
+
getIn(path62, keepScalar) {
|
|
24643
|
+
if (Collection.isEmptyPath(path62))
|
|
24632
24644
|
return !keepScalar && identity2.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
24633
|
-
return identity2.isCollection(this.contents) ? this.contents.getIn(
|
|
24645
|
+
return identity2.isCollection(this.contents) ? this.contents.getIn(path62, keepScalar) : void 0;
|
|
24634
24646
|
}
|
|
24635
24647
|
/**
|
|
24636
24648
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -24641,10 +24653,10 @@ var require_Document2 = __commonJS({
|
|
|
24641
24653
|
/**
|
|
24642
24654
|
* Checks if the document includes a value at `path`.
|
|
24643
24655
|
*/
|
|
24644
|
-
hasIn(
|
|
24645
|
-
if (Collection.isEmptyPath(
|
|
24656
|
+
hasIn(path62) {
|
|
24657
|
+
if (Collection.isEmptyPath(path62))
|
|
24646
24658
|
return this.contents !== void 0;
|
|
24647
|
-
return identity2.isCollection(this.contents) ? this.contents.hasIn(
|
|
24659
|
+
return identity2.isCollection(this.contents) ? this.contents.hasIn(path62) : false;
|
|
24648
24660
|
}
|
|
24649
24661
|
/**
|
|
24650
24662
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -24661,13 +24673,13 @@ var require_Document2 = __commonJS({
|
|
|
24661
24673
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
24662
24674
|
* boolean to add/remove the item from the set.
|
|
24663
24675
|
*/
|
|
24664
|
-
setIn(
|
|
24665
|
-
if (Collection.isEmptyPath(
|
|
24676
|
+
setIn(path62, value) {
|
|
24677
|
+
if (Collection.isEmptyPath(path62)) {
|
|
24666
24678
|
this.contents = value;
|
|
24667
24679
|
} else if (this.contents == null) {
|
|
24668
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
24680
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path62), value);
|
|
24669
24681
|
} else if (assertCollection(this.contents)) {
|
|
24670
|
-
this.contents.setIn(
|
|
24682
|
+
this.contents.setIn(path62, value);
|
|
24671
24683
|
}
|
|
24672
24684
|
}
|
|
24673
24685
|
/**
|
|
@@ -26671,9 +26683,9 @@ var require_cst_visit2 = __commonJS({
|
|
|
26671
26683
|
visit2.BREAK = BREAK;
|
|
26672
26684
|
visit2.SKIP = SKIP;
|
|
26673
26685
|
visit2.REMOVE = REMOVE;
|
|
26674
|
-
visit2.itemAtPath = (cst,
|
|
26686
|
+
visit2.itemAtPath = (cst, path62) => {
|
|
26675
26687
|
let item = cst;
|
|
26676
|
-
for (const [field, index2] of
|
|
26688
|
+
for (const [field, index2] of path62) {
|
|
26677
26689
|
const tok = item?.[field];
|
|
26678
26690
|
if (tok && "items" in tok) {
|
|
26679
26691
|
item = tok.items[index2];
|
|
@@ -26682,23 +26694,23 @@ var require_cst_visit2 = __commonJS({
|
|
|
26682
26694
|
}
|
|
26683
26695
|
return item;
|
|
26684
26696
|
};
|
|
26685
|
-
visit2.parentCollection = (cst,
|
|
26686
|
-
const parent2 = visit2.itemAtPath(cst,
|
|
26687
|
-
const field =
|
|
26697
|
+
visit2.parentCollection = (cst, path62) => {
|
|
26698
|
+
const parent2 = visit2.itemAtPath(cst, path62.slice(0, -1));
|
|
26699
|
+
const field = path62[path62.length - 1][0];
|
|
26688
26700
|
const coll = parent2?.[field];
|
|
26689
26701
|
if (coll && "items" in coll)
|
|
26690
26702
|
return coll;
|
|
26691
26703
|
throw new Error("Parent collection not found");
|
|
26692
26704
|
};
|
|
26693
|
-
function _visit(
|
|
26694
|
-
let ctrl = visitor(item,
|
|
26705
|
+
function _visit(path62, item, visitor) {
|
|
26706
|
+
let ctrl = visitor(item, path62);
|
|
26695
26707
|
if (typeof ctrl === "symbol")
|
|
26696
26708
|
return ctrl;
|
|
26697
26709
|
for (const field of ["key", "value"]) {
|
|
26698
26710
|
const token = item[field];
|
|
26699
26711
|
if (token && "items" in token) {
|
|
26700
26712
|
for (let i = 0; i < token.items.length; ++i) {
|
|
26701
|
-
const ci = _visit(Object.freeze(
|
|
26713
|
+
const ci = _visit(Object.freeze(path62.concat([[field, i]])), token.items[i], visitor);
|
|
26702
26714
|
if (typeof ci === "number")
|
|
26703
26715
|
i = ci - 1;
|
|
26704
26716
|
else if (ci === BREAK)
|
|
@@ -26709,10 +26721,10 @@ var require_cst_visit2 = __commonJS({
|
|
|
26709
26721
|
}
|
|
26710
26722
|
}
|
|
26711
26723
|
if (typeof ctrl === "function" && field === "key")
|
|
26712
|
-
ctrl = ctrl(item,
|
|
26724
|
+
ctrl = ctrl(item, path62);
|
|
26713
26725
|
}
|
|
26714
26726
|
}
|
|
26715
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
26727
|
+
return typeof ctrl === "function" ? ctrl(item, path62) : ctrl;
|
|
26716
26728
|
}
|
|
26717
26729
|
__name(_visit, "_visit");
|
|
26718
26730
|
exports2.visit = visit2;
|
|
@@ -28016,14 +28028,14 @@ var require_parser3 = __commonJS({
|
|
|
28016
28028
|
case "scalar":
|
|
28017
28029
|
case "single-quoted-scalar":
|
|
28018
28030
|
case "double-quoted-scalar": {
|
|
28019
|
-
const
|
|
28031
|
+
const fs57 = this.flowScalar(this.type);
|
|
28020
28032
|
if (atNextItem || it2.value) {
|
|
28021
|
-
map3.items.push({ start, key:
|
|
28033
|
+
map3.items.push({ start, key: fs57, sep: [] });
|
|
28022
28034
|
this.onKeyLine = true;
|
|
28023
28035
|
} else if (it2.sep) {
|
|
28024
|
-
this.stack.push(
|
|
28036
|
+
this.stack.push(fs57);
|
|
28025
28037
|
} else {
|
|
28026
|
-
Object.assign(it2, { key:
|
|
28038
|
+
Object.assign(it2, { key: fs57, sep: [] });
|
|
28027
28039
|
this.onKeyLine = true;
|
|
28028
28040
|
}
|
|
28029
28041
|
return;
|
|
@@ -28151,13 +28163,13 @@ var require_parser3 = __commonJS({
|
|
|
28151
28163
|
case "scalar":
|
|
28152
28164
|
case "single-quoted-scalar":
|
|
28153
28165
|
case "double-quoted-scalar": {
|
|
28154
|
-
const
|
|
28166
|
+
const fs57 = this.flowScalar(this.type);
|
|
28155
28167
|
if (!it2 || it2.value)
|
|
28156
|
-
fc.items.push({ start: [], key:
|
|
28168
|
+
fc.items.push({ start: [], key: fs57, sep: [] });
|
|
28157
28169
|
else if (it2.sep)
|
|
28158
|
-
this.stack.push(
|
|
28170
|
+
this.stack.push(fs57);
|
|
28159
28171
|
else
|
|
28160
|
-
Object.assign(it2, { key:
|
|
28172
|
+
Object.assign(it2, { key: fs57, sep: [] });
|
|
28161
28173
|
return;
|
|
28162
28174
|
}
|
|
28163
28175
|
case "flow-map-end":
|
|
@@ -28724,10 +28736,10 @@ function mergeDefs(...defs) {
|
|
|
28724
28736
|
function cloneDef(schema) {
|
|
28725
28737
|
return mergeDefs(schema._zod.def);
|
|
28726
28738
|
}
|
|
28727
|
-
function getElementAtPath(obj,
|
|
28728
|
-
if (!
|
|
28739
|
+
function getElementAtPath(obj, path62) {
|
|
28740
|
+
if (!path62)
|
|
28729
28741
|
return obj;
|
|
28730
|
-
return
|
|
28742
|
+
return path62.reduce((acc, key) => acc?.[key], obj);
|
|
28731
28743
|
}
|
|
28732
28744
|
function promiseAllObject(promisesObj) {
|
|
28733
28745
|
const keys = Object.keys(promisesObj);
|
|
@@ -29017,11 +29029,11 @@ function aborted(x, startIndex = 0) {
|
|
|
29017
29029
|
}
|
|
29018
29030
|
return false;
|
|
29019
29031
|
}
|
|
29020
|
-
function prefixIssues(
|
|
29032
|
+
function prefixIssues(path62, issues) {
|
|
29021
29033
|
return issues.map((iss) => {
|
|
29022
29034
|
var _a5;
|
|
29023
29035
|
(_a5 = iss).path ?? (_a5.path = []);
|
|
29024
|
-
iss.path.unshift(
|
|
29036
|
+
iss.path.unshift(path62);
|
|
29025
29037
|
return iss;
|
|
29026
29038
|
});
|
|
29027
29039
|
}
|
|
@@ -29303,7 +29315,7 @@ function treeifyError(error45, _mapper) {
|
|
|
29303
29315
|
return issue2.message;
|
|
29304
29316
|
};
|
|
29305
29317
|
const result = { errors: [] };
|
|
29306
|
-
const processError = /* @__PURE__ */ __name((error46,
|
|
29318
|
+
const processError = /* @__PURE__ */ __name((error46, path62 = []) => {
|
|
29307
29319
|
var _a5, _b;
|
|
29308
29320
|
for (const issue2 of error46.issues) {
|
|
29309
29321
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
@@ -29313,7 +29325,7 @@ function treeifyError(error45, _mapper) {
|
|
|
29313
29325
|
} else if (issue2.code === "invalid_element") {
|
|
29314
29326
|
processError({ issues: issue2.issues }, issue2.path);
|
|
29315
29327
|
} else {
|
|
29316
|
-
const fullpath = [...
|
|
29328
|
+
const fullpath = [...path62, ...issue2.path];
|
|
29317
29329
|
if (fullpath.length === 0) {
|
|
29318
29330
|
result.errors.push(mapper(issue2));
|
|
29319
29331
|
continue;
|
|
@@ -29345,8 +29357,8 @@ function treeifyError(error45, _mapper) {
|
|
|
29345
29357
|
}
|
|
29346
29358
|
function toDotPath(_path) {
|
|
29347
29359
|
const segs = [];
|
|
29348
|
-
const
|
|
29349
|
-
for (const seg of
|
|
29360
|
+
const path62 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
29361
|
+
for (const seg of path62) {
|
|
29350
29362
|
if (typeof seg === "number")
|
|
29351
29363
|
segs.push(`[${seg}]`);
|
|
29352
29364
|
else if (typeof seg === "symbol")
|
|
@@ -46733,11 +46745,11 @@ function ParseErr(message, str, indx) {
|
|
|
46733
46745
|
message += " at line " + lineNo + " col " + colNo + ":\n\n " + str.split(/\n/)[lineNo - 1] + "\n " + Array(colNo).join(" ") + "^";
|
|
46734
46746
|
throw new EtaParseError(message);
|
|
46735
46747
|
}
|
|
46736
|
-
function RuntimeErr(originalError, str, lineNo,
|
|
46748
|
+
function RuntimeErr(originalError, str, lineNo, path62) {
|
|
46737
46749
|
const lines = str.split("\n");
|
|
46738
46750
|
const start = Math.max(lineNo - 3, 0);
|
|
46739
46751
|
const end2 = Math.min(lines.length, lineNo + 3);
|
|
46740
|
-
const filename =
|
|
46752
|
+
const filename = path62;
|
|
46741
46753
|
const context = lines.slice(start, end2).map(function(line, i) {
|
|
46742
46754
|
const curr = i + start + 1;
|
|
46743
46755
|
return (curr == lineNo ? " >> " : " ") + curr + "| " + line;
|
|
@@ -47068,13 +47080,13 @@ function renderStringAsync(template, data2) {
|
|
|
47068
47080
|
});
|
|
47069
47081
|
return renderAsync.call(this, templateFn, data2);
|
|
47070
47082
|
}
|
|
47071
|
-
function readFile2(
|
|
47083
|
+
function readFile2(path62) {
|
|
47072
47084
|
let res = "";
|
|
47073
47085
|
try {
|
|
47074
|
-
res = fs21.readFileSync(
|
|
47086
|
+
res = fs21.readFileSync(path62, "utf8");
|
|
47075
47087
|
} catch (err) {
|
|
47076
47088
|
if ((err == null ? void 0 : err.code) === "ENOENT") {
|
|
47077
|
-
throw new EtaFileResolutionError(`Could not find template: ${
|
|
47089
|
+
throw new EtaFileResolutionError(`Could not find template: ${path62}`);
|
|
47078
47090
|
} else {
|
|
47079
47091
|
throw err;
|
|
47080
47092
|
}
|
|
@@ -47351,9 +47363,9 @@ function getFormFiles(formsDir) {
|
|
|
47351
47363
|
}
|
|
47352
47364
|
return readdirSync3(formsDir).filter((f) => f.endsWith(".json")).map((f) => join8(formsDir, f));
|
|
47353
47365
|
}
|
|
47354
|
-
function readForm(
|
|
47366
|
+
function readForm(path62) {
|
|
47355
47367
|
try {
|
|
47356
|
-
return JSON.parse(readFileSync7(
|
|
47368
|
+
return JSON.parse(readFileSync7(path62, "utf-8"));
|
|
47357
47369
|
} catch {
|
|
47358
47370
|
return null;
|
|
47359
47371
|
}
|
|
@@ -47472,9 +47484,9 @@ function getSchemaFiles(schemasDir) {
|
|
|
47472
47484
|
}
|
|
47473
47485
|
return readdirSync4(schemasDir).filter((f) => f.endsWith(".json")).map((f) => join9(schemasDir, f));
|
|
47474
47486
|
}
|
|
47475
|
-
function readSchema(
|
|
47487
|
+
function readSchema(path62) {
|
|
47476
47488
|
try {
|
|
47477
|
-
return JSON.parse(readFileSync8(
|
|
47489
|
+
return JSON.parse(readFileSync8(path62, "utf-8"));
|
|
47478
47490
|
} catch {
|
|
47479
47491
|
return null;
|
|
47480
47492
|
}
|
|
@@ -48950,7 +48962,7 @@ function pushRoute(routes, parts) {
|
|
|
48950
48962
|
}
|
|
48951
48963
|
function discoverAstroRoutes(pagesDir) {
|
|
48952
48964
|
const routes = [];
|
|
48953
|
-
const
|
|
48965
|
+
const walk2 = /* @__PURE__ */ __name((dir, segments) => {
|
|
48954
48966
|
let entries2;
|
|
48955
48967
|
try {
|
|
48956
48968
|
entries2 = readdirSync8(dir);
|
|
@@ -48966,7 +48978,7 @@ function discoverAstroRoutes(pagesDir) {
|
|
|
48966
48978
|
continue;
|
|
48967
48979
|
}
|
|
48968
48980
|
if (isDir) {
|
|
48969
|
-
|
|
48981
|
+
walk2(full, [...segments, toSegment(entry)]);
|
|
48970
48982
|
continue;
|
|
48971
48983
|
}
|
|
48972
48984
|
if (!PAGE_EXT.test(entry) || entry.startsWith("_")) {
|
|
@@ -48976,7 +48988,7 @@ function discoverAstroRoutes(pagesDir) {
|
|
|
48976
48988
|
pushRoute(routes, base === "index" ? segments : [...segments, toSegment(base)]);
|
|
48977
48989
|
}
|
|
48978
48990
|
}, "walk");
|
|
48979
|
-
|
|
48991
|
+
walk2(pagesDir, []);
|
|
48980
48992
|
routes.sort((a, b) => a.path.localeCompare(b.path));
|
|
48981
48993
|
return routes;
|
|
48982
48994
|
}
|
|
@@ -49316,7 +49328,7 @@ function scanScriptCollections(scriptCode, originalCode, relPath) {
|
|
|
49316
49328
|
const base = originalCode.indexOf(scriptCode);
|
|
49317
49329
|
const codeForLines = base >= 0 ? originalCode : scriptCode;
|
|
49318
49330
|
const scriptOffset = base >= 0 ? base : 0;
|
|
49319
|
-
const
|
|
49331
|
+
const walk2 = /* @__PURE__ */ __name((node) => {
|
|
49320
49332
|
if (!node || typeof node !== "object") {
|
|
49321
49333
|
return;
|
|
49322
49334
|
}
|
|
@@ -49325,13 +49337,13 @@ function scanScriptCollections(scriptCode, originalCode, relPath) {
|
|
|
49325
49337
|
}
|
|
49326
49338
|
for (const value of Object.values(node)) {
|
|
49327
49339
|
if (Array.isArray(value)) {
|
|
49328
|
-
value.forEach(
|
|
49340
|
+
value.forEach(walk2);
|
|
49329
49341
|
} else if (value && typeof value === "object" && value.type) {
|
|
49330
|
-
|
|
49342
|
+
walk2(value);
|
|
49331
49343
|
}
|
|
49332
49344
|
}
|
|
49333
49345
|
}, "walk");
|
|
49334
|
-
|
|
49346
|
+
walk2(program2);
|
|
49335
49347
|
return collections;
|
|
49336
49348
|
}
|
|
49337
49349
|
function foreignI18nBinding(ast) {
|
|
@@ -49607,7 +49619,7 @@ function scanDataJson(relPath, raw) {
|
|
|
49607
49619
|
return null;
|
|
49608
49620
|
}
|
|
49609
49621
|
const found = { file: relPath, strings: 0, samples: [], collections: [] };
|
|
49610
|
-
const
|
|
49622
|
+
const walk2 = /* @__PURE__ */ __name((node, jsonPath, key) => {
|
|
49611
49623
|
if (typeof node === "string") {
|
|
49612
49624
|
if (isProseValue(key, node)) {
|
|
49613
49625
|
found.strings += 1;
|
|
@@ -49651,16 +49663,16 @@ function scanDataJson(relPath, raw) {
|
|
|
49651
49663
|
});
|
|
49652
49664
|
}
|
|
49653
49665
|
}
|
|
49654
|
-
node.forEach((entry, index2) =>
|
|
49666
|
+
node.forEach((entry, index2) => walk2(entry, `${jsonPath}[${index2}]`, key));
|
|
49655
49667
|
return;
|
|
49656
49668
|
}
|
|
49657
49669
|
if (node && typeof node === "object") {
|
|
49658
49670
|
for (const [childKey, child] of Object.entries(node)) {
|
|
49659
|
-
|
|
49671
|
+
walk2(child, jsonPath ? `${jsonPath}.${childKey}` : childKey, childKey);
|
|
49660
49672
|
}
|
|
49661
49673
|
}
|
|
49662
49674
|
}, "walk");
|
|
49663
|
-
|
|
49675
|
+
walk2(parsed, "", "");
|
|
49664
49676
|
return found.strings >= 3 || found.collections.length > 0 ? found : null;
|
|
49665
49677
|
}
|
|
49666
49678
|
function dataFileLabelKeys(raw, prefix, filePath = "") {
|
|
@@ -49671,7 +49683,7 @@ function dataFileLabelKeys(raw, prefix, filePath = "") {
|
|
|
49671
49683
|
return [];
|
|
49672
49684
|
}
|
|
49673
49685
|
const keys = [];
|
|
49674
|
-
const
|
|
49686
|
+
const walk2 = /* @__PURE__ */ __name((node, jsonPath, key) => {
|
|
49675
49687
|
if (typeof node === "string") {
|
|
49676
49688
|
if (isProseValue(key, node)) {
|
|
49677
49689
|
keys.push(`${prefix}${jsonPath}`);
|
|
@@ -49679,16 +49691,16 @@ function dataFileLabelKeys(raw, prefix, filePath = "") {
|
|
|
49679
49691
|
return;
|
|
49680
49692
|
}
|
|
49681
49693
|
if (Array.isArray(node)) {
|
|
49682
|
-
node.forEach((entry, index2) =>
|
|
49694
|
+
node.forEach((entry, index2) => walk2(entry, `${jsonPath}.${index2}`, key));
|
|
49683
49695
|
return;
|
|
49684
49696
|
}
|
|
49685
49697
|
if (node && typeof node === "object") {
|
|
49686
49698
|
for (const [childKey, child] of Object.entries(node)) {
|
|
49687
|
-
|
|
49699
|
+
walk2(child, jsonPath ? `${jsonPath}.${childKey}` : childKey, childKey);
|
|
49688
49700
|
}
|
|
49689
49701
|
}
|
|
49690
49702
|
}, "walk");
|
|
49691
|
-
|
|
49703
|
+
walk2(parsed, "", "");
|
|
49692
49704
|
return keys;
|
|
49693
49705
|
}
|
|
49694
49706
|
function collectDataFiles(dir, out = []) {
|
|
@@ -49773,7 +49785,7 @@ function scanExternalSources(rootDir, dirs) {
|
|
|
49773
49785
|
} catch {
|
|
49774
49786
|
continue;
|
|
49775
49787
|
}
|
|
49776
|
-
const
|
|
49788
|
+
const walk2 = /* @__PURE__ */ __name((node) => {
|
|
49777
49789
|
if (!node || typeof node !== "object") {
|
|
49778
49790
|
return;
|
|
49779
49791
|
}
|
|
@@ -49804,14 +49816,14 @@ function scanExternalSources(rootDir, dirs) {
|
|
|
49804
49816
|
const child = node[key];
|
|
49805
49817
|
if (Array.isArray(child)) {
|
|
49806
49818
|
for (const item of child) {
|
|
49807
|
-
|
|
49819
|
+
walk2(item);
|
|
49808
49820
|
}
|
|
49809
49821
|
} else if (typeof child === "object" && child !== null) {
|
|
49810
|
-
|
|
49822
|
+
walk2(child);
|
|
49811
49823
|
}
|
|
49812
49824
|
}
|
|
49813
49825
|
}, "walk");
|
|
49814
|
-
|
|
49826
|
+
walk2(ast);
|
|
49815
49827
|
}
|
|
49816
49828
|
}
|
|
49817
49829
|
const sources = [...byHost.entries()].map(([host, bucket]) => ({
|
|
@@ -50399,21 +50411,21 @@ function relativeImport(fromFile, toFile) {
|
|
|
50399
50411
|
}
|
|
50400
50412
|
function pageFilesUnder(dir) {
|
|
50401
50413
|
const out = [];
|
|
50402
|
-
const
|
|
50414
|
+
const walk2 = /* @__PURE__ */ __name((current) => {
|
|
50403
50415
|
for (const entry of fs36.readdirSync(current, { withFileTypes: true })) {
|
|
50404
50416
|
if (entry.name === "node_modules" || entry.name.startsWith(".")) {
|
|
50405
50417
|
continue;
|
|
50406
50418
|
}
|
|
50407
50419
|
const full = path38.join(current, entry.name);
|
|
50408
50420
|
if (entry.isDirectory()) {
|
|
50409
|
-
|
|
50421
|
+
walk2(full);
|
|
50410
50422
|
} else if (/\.(tsx|jsx|js)$/.test(entry.name)) {
|
|
50411
50423
|
out.push(full);
|
|
50412
50424
|
}
|
|
50413
50425
|
}
|
|
50414
50426
|
}, "walk");
|
|
50415
50427
|
if (fs36.existsSync(dir)) {
|
|
50416
|
-
|
|
50428
|
+
walk2(dir);
|
|
50417
50429
|
}
|
|
50418
50430
|
return out;
|
|
50419
50431
|
}
|
|
@@ -50634,7 +50646,7 @@ function segmentToPath(segment) {
|
|
|
50634
50646
|
}
|
|
50635
50647
|
function discoverNextRoutes(appDir) {
|
|
50636
50648
|
const routes = [];
|
|
50637
|
-
const
|
|
50649
|
+
const walk2 = /* @__PURE__ */ __name((dir, segments) => {
|
|
50638
50650
|
let entries2;
|
|
50639
50651
|
try {
|
|
50640
50652
|
entries2 = readdirSync10(dir);
|
|
@@ -50666,16 +50678,16 @@ function discoverNextRoutes(appDir) {
|
|
|
50666
50678
|
if (mapped === null) {
|
|
50667
50679
|
continue;
|
|
50668
50680
|
}
|
|
50669
|
-
|
|
50681
|
+
walk2(full, [...segments, mapped]);
|
|
50670
50682
|
}
|
|
50671
50683
|
}, "walk");
|
|
50672
|
-
|
|
50684
|
+
walk2(appDir, []);
|
|
50673
50685
|
return routes.sort((a, b) => a.path.localeCompare(b.path));
|
|
50674
50686
|
}
|
|
50675
50687
|
function discoverNextPagesRoutes(pagesDir) {
|
|
50676
50688
|
const routes = [];
|
|
50677
50689
|
const toSegment4 = /* @__PURE__ */ __name((name) => name.replace(/^\[\.\.\.(.+)\]$/, ":$1").replace(/^\[\[\.\.\.(.+)\]\]$/, ":$1").replace(/^\[(.+)\]$/, ":$1"), "toSegment");
|
|
50678
|
-
const
|
|
50690
|
+
const walk2 = /* @__PURE__ */ __name((dir, segments) => {
|
|
50679
50691
|
let entries2;
|
|
50680
50692
|
try {
|
|
50681
50693
|
entries2 = readdirSync10(dir);
|
|
@@ -50692,7 +50704,7 @@ function discoverNextPagesRoutes(pagesDir) {
|
|
|
50692
50704
|
}
|
|
50693
50705
|
if (isDir) {
|
|
50694
50706
|
if (!(segments.length === 0 && PAGES_SKIP.has(entry))) {
|
|
50695
|
-
|
|
50707
|
+
walk2(full, [...segments, toSegment4(entry)]);
|
|
50696
50708
|
}
|
|
50697
50709
|
continue;
|
|
50698
50710
|
}
|
|
@@ -50713,7 +50725,7 @@ function discoverNextPagesRoutes(pagesDir) {
|
|
|
50713
50725
|
});
|
|
50714
50726
|
}
|
|
50715
50727
|
}, "walk");
|
|
50716
|
-
|
|
50728
|
+
walk2(pagesDir, []);
|
|
50717
50729
|
routes.sort((a, b) => a.path.localeCompare(b.path));
|
|
50718
50730
|
return routes;
|
|
50719
50731
|
}
|
|
@@ -50906,7 +50918,7 @@ function pushRoute2(routes, parts) {
|
|
|
50906
50918
|
}
|
|
50907
50919
|
function discoverNuxtRoutes(pagesDir) {
|
|
50908
50920
|
const routes = [];
|
|
50909
|
-
const
|
|
50921
|
+
const walk2 = /* @__PURE__ */ __name((dir, segments) => {
|
|
50910
50922
|
let entries2;
|
|
50911
50923
|
try {
|
|
50912
50924
|
entries2 = readdirSync11(dir);
|
|
@@ -50922,7 +50934,7 @@ function discoverNuxtRoutes(pagesDir) {
|
|
|
50922
50934
|
continue;
|
|
50923
50935
|
}
|
|
50924
50936
|
if (isDir) {
|
|
50925
|
-
|
|
50937
|
+
walk2(full, [...segments, toSegment2(entry)]);
|
|
50926
50938
|
continue;
|
|
50927
50939
|
}
|
|
50928
50940
|
if (!entry.endsWith(".vue")) {
|
|
@@ -50932,7 +50944,7 @@ function discoverNuxtRoutes(pagesDir) {
|
|
|
50932
50944
|
pushRoute2(routes, base === "index" ? segments : [...segments, toSegment2(base)]);
|
|
50933
50945
|
}
|
|
50934
50946
|
}, "walk");
|
|
50935
|
-
|
|
50947
|
+
walk2(pagesDir, []);
|
|
50936
50948
|
routes.sort((a, b) => a.path.localeCompare(b.path));
|
|
50937
50949
|
return routes;
|
|
50938
50950
|
}
|
|
@@ -51036,7 +51048,7 @@ function pushRoute4(routes, parts) {
|
|
|
51036
51048
|
}
|
|
51037
51049
|
function discoverSvelteKitRoutes(routesDir) {
|
|
51038
51050
|
const routes = [];
|
|
51039
|
-
const
|
|
51051
|
+
const walk2 = /* @__PURE__ */ __name((dir, segments) => {
|
|
51040
51052
|
let entries2;
|
|
51041
51053
|
try {
|
|
51042
51054
|
entries2 = readdirSync13(dir);
|
|
@@ -51050,14 +51062,14 @@ function discoverSvelteKitRoutes(routesDir) {
|
|
|
51050
51062
|
const full = join18(dir, entry);
|
|
51051
51063
|
try {
|
|
51052
51064
|
if (statSync9(full).isDirectory()) {
|
|
51053
|
-
|
|
51065
|
+
walk2(full, [...segments, toSegment3(entry)]);
|
|
51054
51066
|
}
|
|
51055
51067
|
} catch {
|
|
51056
51068
|
continue;
|
|
51057
51069
|
}
|
|
51058
51070
|
}
|
|
51059
51071
|
}, "walk");
|
|
51060
|
-
|
|
51072
|
+
walk2(routesDir, []);
|
|
51061
51073
|
routes.sort((a, b) => a.path.localeCompare(b.path));
|
|
51062
51074
|
return routes;
|
|
51063
51075
|
}
|
|
@@ -51260,7 +51272,7 @@ import { join as join21 } from "node:path";
|
|
|
51260
51272
|
function discoverReactRouterDomRoutes(rootDir) {
|
|
51261
51273
|
const srcDir = join21(rootDir, "src");
|
|
51262
51274
|
const files = [];
|
|
51263
|
-
const
|
|
51275
|
+
const walk2 = /* @__PURE__ */ __name((dir) => {
|
|
51264
51276
|
let entries2;
|
|
51265
51277
|
try {
|
|
51266
51278
|
entries2 = readdirSync14(dir);
|
|
@@ -51279,13 +51291,13 @@ function discoverReactRouterDomRoutes(rootDir) {
|
|
|
51279
51291
|
continue;
|
|
51280
51292
|
}
|
|
51281
51293
|
if (isDir) {
|
|
51282
|
-
|
|
51294
|
+
walk2(full);
|
|
51283
51295
|
} else if (ROUTE_SOURCE.test(entry)) {
|
|
51284
51296
|
files.push(full);
|
|
51285
51297
|
}
|
|
51286
51298
|
}
|
|
51287
51299
|
}, "walk");
|
|
51288
|
-
|
|
51300
|
+
walk2(srcDir);
|
|
51289
51301
|
const routes = /* @__PURE__ */ new Map();
|
|
51290
51302
|
for (const file2 of files) {
|
|
51291
51303
|
let code2;
|
|
@@ -51300,21 +51312,21 @@ function discoverReactRouterDomRoutes(rootDir) {
|
|
|
51300
51312
|
const paths = [
|
|
51301
51313
|
...[...code2.matchAll(/<Route\b[^>]*\bpath\s*=\s*(?:"([^"]+)"|'([^']+)'|\{\s*(?:"([^"]+)"|'([^']+)')\s*\})/g)],
|
|
51302
51314
|
...[...code2.matchAll(/\bpath\s*:\s*(?:"([^"]+)"|'([^']+)')/g)]
|
|
51303
|
-
].map((match) => match.slice(1).find(Boolean)).filter((
|
|
51315
|
+
].map((match) => match.slice(1).find(Boolean)).filter((path62) => typeof path62 === "string");
|
|
51304
51316
|
for (const raw of paths) {
|
|
51305
51317
|
if (!raw.startsWith("/") || raw.includes("*")) {
|
|
51306
51318
|
continue;
|
|
51307
51319
|
}
|
|
51308
|
-
const
|
|
51309
|
-
if (routes.has(
|
|
51320
|
+
const path62 = raw !== "/" && raw.endsWith("/") ? raw.slice(0, -1) : raw;
|
|
51321
|
+
if (routes.has(path62)) {
|
|
51310
51322
|
continue;
|
|
51311
51323
|
}
|
|
51312
|
-
const parts =
|
|
51324
|
+
const parts = path62.split("/").filter(Boolean);
|
|
51313
51325
|
const lastStatic = [...parts].reverse().find((part) => !part.startsWith(":"));
|
|
51314
|
-
routes.set(
|
|
51315
|
-
id:
|
|
51316
|
-
path:
|
|
51317
|
-
label:
|
|
51326
|
+
routes.set(path62, {
|
|
51327
|
+
id: path62 === "/" ? "home" : parts.map((part) => part.replace(/^:/, "")).join("-"),
|
|
51328
|
+
path: path62,
|
|
51329
|
+
label: path62 === "/" ? "Home" : titleCase6(lastStatic ?? parts[parts.length - 1] ?? path62)
|
|
51318
51330
|
});
|
|
51319
51331
|
}
|
|
51320
51332
|
}
|
|
@@ -51607,11 +51619,17 @@ whole migration loop; the deterministic CLI does the heavy lifting.
|
|
|
51607
51619
|
env keys, and detects collections and external data sources. Recover
|
|
51608
51620
|
mechanical failures yourself (missing install, pnpm minimumReleaseAge
|
|
51609
51621
|
policy, broken dev script) and re-run it.
|
|
51610
|
-
2. That command REGENERATES this file with the full work order. Re-read it
|
|
51611
|
-
|
|
51612
|
-
|
|
51613
|
-
|
|
51614
|
-
|
|
51622
|
+
2. That command REGENERATES this file with the full work order. Re-read it and
|
|
51623
|
+
continue with the regenerated version.
|
|
51624
|
+
- If it reports a CMS scaffold available (e.g. Strapi detected), ask the user
|
|
51625
|
+
ONE question: bring the CMS content model + example content into Fimo now so
|
|
51626
|
+
the site runs on Fimo? If yes, run \`npx fimo migrate --scaffold-cms\` \u2014 that
|
|
51627
|
+
creates the content types + example content in Fimo AND wires the whole
|
|
51628
|
+
site's reads to Fimo (no manual wiring, no per-view work; unscaffolded types
|
|
51629
|
+
keep reading the CMS). Then \`pnpm dev\` shows the site on Fimo. If they'd
|
|
51630
|
+
rather keep the CMS live, skip it.
|
|
51631
|
+
- For any other DEFAULTED external data source, ask the user, then update
|
|
51632
|
+
\`.fimo/migration/manifest.json\` and re-run \`npx fimo migrate\`.
|
|
51615
51633
|
3. Loop \`npx fimo migrate wrap --check\` after every batch of fixes until it
|
|
51616
51634
|
exits 0 \u2014 that is the only definition of done.
|
|
51617
51635
|
4. Never run \`npx fimo deploy\` or \`fimo publish\` yourself: report the
|
|
@@ -51715,27 +51733,17 @@ This is FAKE content so the model is editable in Fimo immediately \u2014 the rea
|
|
|
51715
51733
|
${machine.cmsScaffold.cms} content is NOT migrated (that is a separate, later
|
|
51716
51734
|
step). Do NOT re-create these schemas, do NOT hand-wrap this content, and do NOT
|
|
51717
51735
|
delete the example entries.
|
|
51718
|
-
${machine.
|
|
51719
|
-
|
|
51720
|
-
|
|
51721
|
-
|
|
51722
|
-
|
|
51723
|
-
|
|
51724
|
-
|
|
51725
|
-
|
|
51726
|
-
|
|
51727
|
-
|
|
51728
|
-
|
|
51729
|
-
3. LIST views ONLY. Leave DETAIL pages and any dynamic-zone / page-builder reads
|
|
51730
|
-
on ${machine.cmsScaffold.cms} \u2014 the helper covers flat list fields, not those.
|
|
51731
|
-
4. The helper flattens richtext to plain text and passes media/scalars through;
|
|
51732
|
-
if a list component reads a shape it doesn't get (a populated relation, a
|
|
51733
|
-
nested media object), adjust that component or the helper \u2014 this last mile is
|
|
51734
|
-
judgment, not mechanical.
|
|
51735
|
-
5. Add a parity ignore for the rewired list routes (they now render example
|
|
51736
|
-
content where the pre-wrap baseline was empty) under \`wrap.parityIgnores\` in
|
|
51737
|
-
\`.fimo/migration/manifest.json\`.
|
|
51738
|
-
` : ""}Report the scaffolded counts in \xA78.
|
|
51736
|
+
${machine.cmsWired?.wired ? `
|
|
51737
|
+
The machine WIRED your site's ${machine.cmsScaffold.cms} reads to Fimo \u2014 it swapped the
|
|
51738
|
+
client's fetch for the fimo/strapi adapter, so the WHOLE site now renders this
|
|
51739
|
+
scaffolded content from Fimo. Run \`pnpm dev\` (with your Fimo tenant reachable) to
|
|
51740
|
+
see it. Do NOT re-wire the client or the fetch. Any content type that was not
|
|
51741
|
+
scaffolded falls through to ${machine.cmsScaffold.cms} automatically.
|
|
51742
|
+
` : `
|
|
51743
|
+
The machine could NOT auto-wire the ${machine.cmsScaffold.cms} client. Wire
|
|
51744
|
+
\`fimoStrapiFetch\` (from the generated \`fimo-strapi\` module) into the client's
|
|
51745
|
+
fetch so the site reads this scaffolded content from Fimo.
|
|
51746
|
+
`}Report the scaffolded counts in \xA78.
|
|
51739
51747
|
` : ""}${machine.cmsScaffoldAvailable ? `
|
|
51740
51748
|
## ${machine.cmsScaffoldAvailable.cms} detected \u2014 scaffold available (NOT done)
|
|
51741
51749
|
|
|
@@ -52662,7 +52670,7 @@ function renderInitSuccess(ctx, args) {
|
|
|
52662
52670
|
if (args.adopted) {
|
|
52663
52671
|
lines.push(`Next: ask your coding agent to migrate the content \u2014 paste this prompt:`);
|
|
52664
52672
|
lines.push("");
|
|
52665
|
-
lines.push(` ${p2.cyan(
|
|
52673
|
+
lines.push(` ${p2.cyan("Migrate this site to Fimo (follow .fimo/migration/wrap/agent-prompt.md)")}`);
|
|
52666
52674
|
lines.push("");
|
|
52667
52675
|
lines.push(
|
|
52668
52676
|
`${p2.dim("(or run")} ${p2.cyan("npx fimo migrate")} ${p2.dim("yourself)")} \u2014 then ${p2.cyan("npx fimo deploy")} to see it in your Fimo Studio preview.`
|
|
@@ -74187,14 +74195,14 @@ var require_util = __commonJS({
|
|
|
74187
74195
|
}
|
|
74188
74196
|
const port = url2.port != null ? url2.port : url2.protocol === "https:" ? 443 : 80;
|
|
74189
74197
|
let origin = url2.origin != null ? url2.origin : `${url2.protocol || ""}//${url2.hostname || ""}:${port}`;
|
|
74190
|
-
let
|
|
74198
|
+
let path62 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
|
|
74191
74199
|
if (origin[origin.length - 1] === "/") {
|
|
74192
74200
|
origin = origin.slice(0, origin.length - 1);
|
|
74193
74201
|
}
|
|
74194
|
-
if (
|
|
74195
|
-
|
|
74202
|
+
if (path62 && path62[0] !== "/") {
|
|
74203
|
+
path62 = `/${path62}`;
|
|
74196
74204
|
}
|
|
74197
|
-
return new URL(`${origin}${
|
|
74205
|
+
return new URL(`${origin}${path62}`);
|
|
74198
74206
|
}
|
|
74199
74207
|
if (!isHttpOrHttpsPrefixed(url2.origin || url2.protocol)) {
|
|
74200
74208
|
throw new InvalidArgumentError2("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
@@ -75054,9 +75062,9 @@ var require_diagnostics = __commonJS({
|
|
|
75054
75062
|
"undici:client:sendHeaders",
|
|
75055
75063
|
(evt) => {
|
|
75056
75064
|
const {
|
|
75057
|
-
request: { method, path:
|
|
75065
|
+
request: { method, path: path62, origin }
|
|
75058
75066
|
} = evt;
|
|
75059
|
-
debugLog("sending request to %s %s%s", method, origin,
|
|
75067
|
+
debugLog("sending request to %s %s%s", method, origin, path62);
|
|
75060
75068
|
}
|
|
75061
75069
|
);
|
|
75062
75070
|
}
|
|
@@ -75075,14 +75083,14 @@ var require_diagnostics = __commonJS({
|
|
|
75075
75083
|
"undici:request:headers",
|
|
75076
75084
|
(evt) => {
|
|
75077
75085
|
const {
|
|
75078
|
-
request: { method, path:
|
|
75086
|
+
request: { method, path: path62, origin },
|
|
75079
75087
|
response: { statusCode }
|
|
75080
75088
|
} = evt;
|
|
75081
75089
|
debugLog(
|
|
75082
75090
|
"received response to %s %s%s - HTTP %d",
|
|
75083
75091
|
method,
|
|
75084
75092
|
origin,
|
|
75085
|
-
|
|
75093
|
+
path62,
|
|
75086
75094
|
statusCode
|
|
75087
75095
|
);
|
|
75088
75096
|
}
|
|
@@ -75091,23 +75099,23 @@ var require_diagnostics = __commonJS({
|
|
|
75091
75099
|
"undici:request:trailers",
|
|
75092
75100
|
(evt) => {
|
|
75093
75101
|
const {
|
|
75094
|
-
request: { method, path:
|
|
75102
|
+
request: { method, path: path62, origin }
|
|
75095
75103
|
} = evt;
|
|
75096
|
-
debugLog("trailers received from %s %s%s", method, origin,
|
|
75104
|
+
debugLog("trailers received from %s %s%s", method, origin, path62);
|
|
75097
75105
|
}
|
|
75098
75106
|
);
|
|
75099
75107
|
diagnosticsChannel.subscribe(
|
|
75100
75108
|
"undici:request:error",
|
|
75101
75109
|
(evt) => {
|
|
75102
75110
|
const {
|
|
75103
|
-
request: { method, path:
|
|
75111
|
+
request: { method, path: path62, origin },
|
|
75104
75112
|
error: error45
|
|
75105
75113
|
} = evt;
|
|
75106
75114
|
debugLog(
|
|
75107
75115
|
"request to %s %s%s errored - %s",
|
|
75108
75116
|
method,
|
|
75109
75117
|
origin,
|
|
75110
|
-
|
|
75118
|
+
path62,
|
|
75111
75119
|
error45.message
|
|
75112
75120
|
);
|
|
75113
75121
|
}
|
|
@@ -75215,7 +75223,7 @@ var require_request = __commonJS({
|
|
|
75215
75223
|
__name(this, "Request");
|
|
75216
75224
|
}
|
|
75217
75225
|
constructor(origin, {
|
|
75218
|
-
path:
|
|
75226
|
+
path: path62,
|
|
75219
75227
|
method,
|
|
75220
75228
|
body,
|
|
75221
75229
|
headers,
|
|
@@ -75232,11 +75240,11 @@ var require_request = __commonJS({
|
|
|
75232
75240
|
maxRedirections,
|
|
75233
75241
|
typeOfService
|
|
75234
75242
|
}, handler) {
|
|
75235
|
-
if (typeof
|
|
75243
|
+
if (typeof path62 !== "string") {
|
|
75236
75244
|
throw new InvalidArgumentError2("path must be a string");
|
|
75237
|
-
} else if (
|
|
75245
|
+
} else if (path62[0] !== "/" && !(path62.startsWith("http://") || path62.startsWith("https://")) && method !== "CONNECT") {
|
|
75238
75246
|
throw new InvalidArgumentError2("path must be an absolute URL or start with a slash");
|
|
75239
|
-
} else if (invalidPathRegex.test(
|
|
75247
|
+
} else if (invalidPathRegex.test(path62)) {
|
|
75240
75248
|
throw new InvalidArgumentError2("invalid request path");
|
|
75241
75249
|
}
|
|
75242
75250
|
if (typeof method !== "string") {
|
|
@@ -75311,7 +75319,7 @@ var require_request = __commonJS({
|
|
|
75311
75319
|
this.completed = false;
|
|
75312
75320
|
this.aborted = false;
|
|
75313
75321
|
this.upgrade = upgrade || null;
|
|
75314
|
-
this.path = query ? serializePathWithQuery(
|
|
75322
|
+
this.path = query ? serializePathWithQuery(path62, query) : path62;
|
|
75315
75323
|
this.origin = origin;
|
|
75316
75324
|
this.protocol = getProtocolFromUrlString(origin);
|
|
75317
75325
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
@@ -80503,7 +80511,7 @@ var require_client_h1 = __commonJS({
|
|
|
80503
80511
|
}
|
|
80504
80512
|
__name(shouldSendContentLength, "shouldSendContentLength");
|
|
80505
80513
|
function writeH1(client, request) {
|
|
80506
|
-
const { method, path:
|
|
80514
|
+
const { method, path: path62, host, upgrade, blocking, reset } = request;
|
|
80507
80515
|
let { body, headers, contentLength } = request;
|
|
80508
80516
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
80509
80517
|
if (util.isFormDataLike(body)) {
|
|
@@ -80572,7 +80580,7 @@ var require_client_h1 = __commonJS({
|
|
|
80572
80580
|
if (socket.setTypeOfService) {
|
|
80573
80581
|
socket.setTypeOfService(request.typeOfService);
|
|
80574
80582
|
}
|
|
80575
|
-
let header = `${method} ${
|
|
80583
|
+
let header = `${method} ${path62} HTTP/1.1\r
|
|
80576
80584
|
`;
|
|
80577
80585
|
if (typeof host === "string") {
|
|
80578
80586
|
header += `host: ${host}\r
|
|
@@ -81251,7 +81259,7 @@ var require_client_h2 = __commonJS({
|
|
|
81251
81259
|
function writeH2(client, request) {
|
|
81252
81260
|
const requestTimeout = request.bodyTimeout ?? client[kBodyTimeout];
|
|
81253
81261
|
const session = client[kHTTP2Session];
|
|
81254
|
-
const { method, path:
|
|
81262
|
+
const { method, path: path62, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request;
|
|
81255
81263
|
let { body } = request;
|
|
81256
81264
|
if (upgrade != null && upgrade !== "websocket") {
|
|
81257
81265
|
util.errorRequest(client, request, new InvalidArgumentError2(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
|
|
@@ -81319,7 +81327,7 @@ var require_client_h2 = __commonJS({
|
|
|
81319
81327
|
}
|
|
81320
81328
|
headers[HTTP2_HEADER_METHOD] = "CONNECT";
|
|
81321
81329
|
headers[HTTP2_HEADER_PROTOCOL] = "websocket";
|
|
81322
|
-
headers[HTTP2_HEADER_PATH] =
|
|
81330
|
+
headers[HTTP2_HEADER_PATH] = path62;
|
|
81323
81331
|
if (protocol === "ws:" || protocol === "wss:") {
|
|
81324
81332
|
headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
|
|
81325
81333
|
} else {
|
|
@@ -81360,7 +81368,7 @@ var require_client_h2 = __commonJS({
|
|
|
81360
81368
|
stream.setTimeout(requestTimeout);
|
|
81361
81369
|
return true;
|
|
81362
81370
|
}
|
|
81363
|
-
headers[HTTP2_HEADER_PATH] =
|
|
81371
|
+
headers[HTTP2_HEADER_PATH] = path62;
|
|
81364
81372
|
headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
|
|
81365
81373
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
81366
81374
|
if (body && typeof body.read === "function") {
|
|
@@ -83723,10 +83731,10 @@ var require_proxy_agent = __commonJS({
|
|
|
83723
83731
|
};
|
|
83724
83732
|
const {
|
|
83725
83733
|
origin,
|
|
83726
|
-
path:
|
|
83734
|
+
path: path62 = "/",
|
|
83727
83735
|
headers = {}
|
|
83728
83736
|
} = opts;
|
|
83729
|
-
opts.path = origin +
|
|
83737
|
+
opts.path = origin + path62;
|
|
83730
83738
|
if (!("host" in headers) && !("Host" in headers)) {
|
|
83731
83739
|
const { host } = new URL(origin);
|
|
83732
83740
|
headers.host = host;
|
|
@@ -85862,21 +85870,21 @@ var require_mock_utils = __commonJS({
|
|
|
85862
85870
|
return normalizedQp;
|
|
85863
85871
|
}
|
|
85864
85872
|
__name(normalizeSearchParams, "normalizeSearchParams");
|
|
85865
|
-
function safeUrl(
|
|
85866
|
-
if (typeof
|
|
85867
|
-
return
|
|
85873
|
+
function safeUrl(path62) {
|
|
85874
|
+
if (typeof path62 !== "string") {
|
|
85875
|
+
return path62;
|
|
85868
85876
|
}
|
|
85869
|
-
const pathSegments =
|
|
85877
|
+
const pathSegments = path62.split("?", 3);
|
|
85870
85878
|
if (pathSegments.length !== 2) {
|
|
85871
|
-
return
|
|
85879
|
+
return path62;
|
|
85872
85880
|
}
|
|
85873
85881
|
const qp = new URLSearchParams(pathSegments.pop());
|
|
85874
85882
|
qp.sort();
|
|
85875
85883
|
return [...pathSegments, qp.toString()].join("?");
|
|
85876
85884
|
}
|
|
85877
85885
|
__name(safeUrl, "safeUrl");
|
|
85878
|
-
function matchKey(mockDispatch2, { path:
|
|
85879
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
85886
|
+
function matchKey(mockDispatch2, { path: path62, method, body, headers }) {
|
|
85887
|
+
const pathMatch = matchValue(mockDispatch2.path, path62);
|
|
85880
85888
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
85881
85889
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
85882
85890
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -85903,8 +85911,8 @@ var require_mock_utils = __commonJS({
|
|
|
85903
85911
|
const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
|
|
85904
85912
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
85905
85913
|
const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
|
|
85906
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
85907
|
-
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(
|
|
85914
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path62, ignoreTrailingSlash }) => {
|
|
85915
|
+
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path62)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path62), resolvedPath);
|
|
85908
85916
|
});
|
|
85909
85917
|
if (matchedMockDispatches.length === 0) {
|
|
85910
85918
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
@@ -85946,20 +85954,20 @@ var require_mock_utils = __commonJS({
|
|
|
85946
85954
|
}
|
|
85947
85955
|
}
|
|
85948
85956
|
__name(deleteMockDispatch, "deleteMockDispatch");
|
|
85949
|
-
function removeTrailingSlash(
|
|
85950
|
-
while (
|
|
85951
|
-
|
|
85957
|
+
function removeTrailingSlash(path62) {
|
|
85958
|
+
while (path62.endsWith("/")) {
|
|
85959
|
+
path62 = path62.slice(0, -1);
|
|
85952
85960
|
}
|
|
85953
|
-
if (
|
|
85954
|
-
|
|
85961
|
+
if (path62.length === 0) {
|
|
85962
|
+
path62 = "/";
|
|
85955
85963
|
}
|
|
85956
|
-
return
|
|
85964
|
+
return path62;
|
|
85957
85965
|
}
|
|
85958
85966
|
__name(removeTrailingSlash, "removeTrailingSlash");
|
|
85959
85967
|
function buildKey(opts) {
|
|
85960
|
-
const { path:
|
|
85968
|
+
const { path: path62, method, body, headers, query } = opts;
|
|
85961
85969
|
return {
|
|
85962
|
-
path:
|
|
85970
|
+
path: path62,
|
|
85963
85971
|
method,
|
|
85964
85972
|
body,
|
|
85965
85973
|
headers,
|
|
@@ -86686,10 +86694,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
86686
86694
|
}
|
|
86687
86695
|
format(pendingInterceptors) {
|
|
86688
86696
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
86689
|
-
({ method, path:
|
|
86697
|
+
({ method, path: path62, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
86690
86698
|
Method: method,
|
|
86691
86699
|
Origin: origin,
|
|
86692
|
-
Path:
|
|
86700
|
+
Path: path62,
|
|
86693
86701
|
"Status code": statusCode,
|
|
86694
86702
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
86695
86703
|
Invocations: timesInvoked,
|
|
@@ -86774,9 +86782,9 @@ var require_mock_agent = __commonJS({
|
|
|
86774
86782
|
const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
|
|
86775
86783
|
const dispatchOpts = { ...opts };
|
|
86776
86784
|
if (acceptNonStandardSearchParameters && dispatchOpts.path) {
|
|
86777
|
-
const [
|
|
86785
|
+
const [path62, searchParams] = dispatchOpts.path.split("?");
|
|
86778
86786
|
const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
|
|
86779
|
-
dispatchOpts.path = `${
|
|
86787
|
+
dispatchOpts.path = `${path62}?${normalizedSearchParams}`;
|
|
86780
86788
|
}
|
|
86781
86789
|
return this[kAgent].dispatch(dispatchOpts, handler);
|
|
86782
86790
|
}
|
|
@@ -87189,12 +87197,12 @@ var require_snapshot_recorder = __commonJS({
|
|
|
87189
87197
|
* @return {Promise<void>} - Resolves when snapshots are loaded
|
|
87190
87198
|
*/
|
|
87191
87199
|
async loadSnapshots(filePath) {
|
|
87192
|
-
const
|
|
87193
|
-
if (!
|
|
87200
|
+
const path62 = filePath || this.#snapshotPath;
|
|
87201
|
+
if (!path62) {
|
|
87194
87202
|
throw new InvalidArgumentError2("Snapshot path is required");
|
|
87195
87203
|
}
|
|
87196
87204
|
try {
|
|
87197
|
-
const data2 = await readFile4(resolve8(
|
|
87205
|
+
const data2 = await readFile4(resolve8(path62), "utf8");
|
|
87198
87206
|
const parsed = JSON.parse(data2);
|
|
87199
87207
|
if (Array.isArray(parsed)) {
|
|
87200
87208
|
this.#snapshots.clear();
|
|
@@ -87208,7 +87216,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
87208
87216
|
if (error45.code === "ENOENT") {
|
|
87209
87217
|
this.#snapshots.clear();
|
|
87210
87218
|
} else {
|
|
87211
|
-
throw new UndiciError(`Failed to load snapshots from ${
|
|
87219
|
+
throw new UndiciError(`Failed to load snapshots from ${path62}`, { cause: error45 });
|
|
87212
87220
|
}
|
|
87213
87221
|
}
|
|
87214
87222
|
}
|
|
@@ -87219,11 +87227,11 @@ var require_snapshot_recorder = __commonJS({
|
|
|
87219
87227
|
* @returns {Promise<void>} - Resolves when snapshots are saved
|
|
87220
87228
|
*/
|
|
87221
87229
|
async saveSnapshots(filePath) {
|
|
87222
|
-
const
|
|
87223
|
-
if (!
|
|
87230
|
+
const path62 = filePath || this.#snapshotPath;
|
|
87231
|
+
if (!path62) {
|
|
87224
87232
|
throw new InvalidArgumentError2("Snapshot path is required");
|
|
87225
87233
|
}
|
|
87226
|
-
const resolvedPath = resolve8(
|
|
87234
|
+
const resolvedPath = resolve8(path62);
|
|
87227
87235
|
await mkdir2(dirname10(resolvedPath), { recursive: true });
|
|
87228
87236
|
const data2 = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
|
|
87229
87237
|
hash: hash2,
|
|
@@ -87862,15 +87870,15 @@ var require_redirect_handler = __commonJS({
|
|
|
87862
87870
|
return;
|
|
87863
87871
|
}
|
|
87864
87872
|
const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
87865
|
-
const
|
|
87866
|
-
const redirectUrlString = `${origin}${
|
|
87873
|
+
const path62 = search ? `${pathname}${search}` : pathname;
|
|
87874
|
+
const redirectUrlString = `${origin}${path62}`;
|
|
87867
87875
|
for (const historyUrl of this.history) {
|
|
87868
87876
|
if (historyUrl.toString() === redirectUrlString) {
|
|
87869
87877
|
throw new InvalidArgumentError2(`Redirect loop detected. Cannot redirect to ${origin}. This typically happens when using a Client or Pool with cross-origin redirects. Use an Agent for cross-origin redirects.`);
|
|
87870
87878
|
}
|
|
87871
87879
|
}
|
|
87872
87880
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
87873
|
-
this.opts.path =
|
|
87881
|
+
this.opts.path = path62;
|
|
87874
87882
|
this.opts.origin = origin;
|
|
87875
87883
|
this.opts.query = null;
|
|
87876
87884
|
}
|
|
@@ -94201,11 +94209,11 @@ var require_fetch = __commonJS({
|
|
|
94201
94209
|
function dispatch({ body }) {
|
|
94202
94210
|
const url2 = requestCurrentURL(request);
|
|
94203
94211
|
const agent = fetchParams.controller.dispatcher;
|
|
94204
|
-
const
|
|
94212
|
+
const path62 = url2.pathname + url2.search;
|
|
94205
94213
|
const hasTrailingQuestionMark = url2.search.length === 0 && url2.href[url2.href.length - url2.hash.length - 1] === "?";
|
|
94206
94214
|
return new Promise((resolve8, reject) => agent.dispatch(
|
|
94207
94215
|
{
|
|
94208
|
-
path: hasTrailingQuestionMark ? `${
|
|
94216
|
+
path: hasTrailingQuestionMark ? `${path62}?` : path62,
|
|
94209
94217
|
origin: url2.origin,
|
|
94210
94218
|
method: request.method,
|
|
94211
94219
|
body: agent.isMockActive ? request.body && (request.body.source || request.body.stream) : body,
|
|
@@ -95165,9 +95173,9 @@ var require_util4 = __commonJS({
|
|
|
95165
95173
|
}
|
|
95166
95174
|
}
|
|
95167
95175
|
__name(validateCookieValue, "validateCookieValue");
|
|
95168
|
-
function validateCookiePath(
|
|
95169
|
-
for (let i = 0; i <
|
|
95170
|
-
const code2 =
|
|
95176
|
+
function validateCookiePath(path62) {
|
|
95177
|
+
for (let i = 0; i < path62.length; ++i) {
|
|
95178
|
+
const code2 = path62.charCodeAt(i);
|
|
95171
95179
|
if (code2 < 32 || // exclude CTLs (0-31)
|
|
95172
95180
|
code2 === 127 || // DEL
|
|
95173
95181
|
code2 === 59) {
|
|
@@ -98415,11 +98423,11 @@ var require_undici = __commonJS({
|
|
|
98415
98423
|
if (typeof opts.path !== "string") {
|
|
98416
98424
|
throw new InvalidArgumentError2("invalid opts.path");
|
|
98417
98425
|
}
|
|
98418
|
-
let
|
|
98426
|
+
let path62 = opts.path;
|
|
98419
98427
|
if (!opts.path.startsWith("/")) {
|
|
98420
|
-
|
|
98428
|
+
path62 = `/${path62}`;
|
|
98421
98429
|
}
|
|
98422
|
-
url2 = new URL(util.parseOrigin(url2).origin +
|
|
98430
|
+
url2 = new URL(util.parseOrigin(url2).origin + path62);
|
|
98423
98431
|
} else {
|
|
98424
98432
|
if (!opts) {
|
|
98425
98433
|
opts = typeof url2 === "object" ? url2 : {};
|
|
@@ -102015,6 +102023,18 @@ function richTextDoc(text3) {
|
|
|
102015
102023
|
content: [{ type: "paragraph", content: [{ type: "text", text: text3 }] }]
|
|
102016
102024
|
};
|
|
102017
102025
|
}
|
|
102026
|
+
function placeholderMedia(label) {
|
|
102027
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="630"><rect width="100%" height="100%" fill="#e5e7eb"/><text x="50%" y="50%" font-family="sans-serif" font-size="44" fill="#9ca3af" text-anchor="middle" dominant-baseline="middle">${label}</text></svg>`;
|
|
102028
|
+
return {
|
|
102029
|
+
source: "local",
|
|
102030
|
+
url: `data:image/svg+xml;utf8,${encodeURIComponent(svg)}`,
|
|
102031
|
+
alt: `${label} placeholder`,
|
|
102032
|
+
width: 1200,
|
|
102033
|
+
height: 630,
|
|
102034
|
+
mime: "image/svg+xml",
|
|
102035
|
+
name: "placeholder.svg"
|
|
102036
|
+
};
|
|
102037
|
+
}
|
|
102018
102038
|
function exampleDate(n) {
|
|
102019
102039
|
return new Date(Date.UTC(2024, 0, n)).toISOString().slice(0, 10);
|
|
102020
102040
|
}
|
|
@@ -102038,6 +102058,10 @@ function generateExampleSeed(schema, options = {}) {
|
|
|
102038
102058
|
row2.slug = `${kebabCase(schema.name)}-example-${i}`;
|
|
102039
102059
|
}
|
|
102040
102060
|
for (const [field, def] of Object.entries(schema.fields)) {
|
|
102061
|
+
if (schema.examples && field in schema.examples) {
|
|
102062
|
+
row2[field] = schema.examples[field];
|
|
102063
|
+
continue;
|
|
102064
|
+
}
|
|
102041
102065
|
switch (def.type) {
|
|
102042
102066
|
case "string":
|
|
102043
102067
|
row2[field] = `${humanize(field)} example ${i}${localeSuffix}`;
|
|
@@ -102058,6 +102082,7 @@ function generateExampleSeed(schema, options = {}) {
|
|
|
102058
102082
|
row2[field] = {};
|
|
102059
102083
|
break;
|
|
102060
102084
|
case "media":
|
|
102085
|
+
row2[field] = placeholderMedia(humanize(field));
|
|
102061
102086
|
break;
|
|
102062
102087
|
case "reference": {
|
|
102063
102088
|
const value = exampleReferenceSlug(def);
|
|
@@ -102087,6 +102112,7 @@ var init_example_content = __esm({
|
|
|
102087
102112
|
__name(kebabCase, "kebabCase");
|
|
102088
102113
|
__name(humanize, "humanize");
|
|
102089
102114
|
__name(richTextDoc, "richTextDoc");
|
|
102115
|
+
__name(placeholderMedia, "placeholderMedia");
|
|
102090
102116
|
__name(exampleDate, "exampleDate");
|
|
102091
102117
|
__name(exampleReferenceSlug, "exampleReferenceSlug");
|
|
102092
102118
|
__name(generateExampleSeed, "generateExampleSeed");
|
|
@@ -102112,6 +102138,12 @@ function extractSchemaTypeNames(raw) {
|
|
|
102112
102138
|
}
|
|
102113
102139
|
return names;
|
|
102114
102140
|
}
|
|
102141
|
+
function withoutReferences(fields) {
|
|
102142
|
+
return Object.fromEntries(Object.entries(fields).filter(([, def]) => def.type !== "reference"));
|
|
102143
|
+
}
|
|
102144
|
+
function hasReferences(fields) {
|
|
102145
|
+
return Object.values(fields).some((def) => def.type === "reference");
|
|
102146
|
+
}
|
|
102115
102147
|
function orderByDependency(schemas3) {
|
|
102116
102148
|
const byName = new Map(schemas3.map((schema) => [schema.name, schema]));
|
|
102117
102149
|
const visited = /* @__PURE__ */ new Set();
|
|
@@ -102152,10 +102184,12 @@ async function scaffoldCms(opts) {
|
|
|
102152
102184
|
let skipped = 0;
|
|
102153
102185
|
const failures = [];
|
|
102154
102186
|
const usedLocales = /* @__PURE__ */ new Set();
|
|
102187
|
+
const created = /* @__PURE__ */ new Set();
|
|
102155
102188
|
try {
|
|
102156
102189
|
for (const schema of ordered) {
|
|
102157
102190
|
if (existingTypes.has(schema.name) && !force) {
|
|
102158
102191
|
skipped += 1;
|
|
102192
|
+
created.add(schema.name);
|
|
102159
102193
|
continue;
|
|
102160
102194
|
}
|
|
102161
102195
|
if (force) {
|
|
@@ -102166,30 +102200,54 @@ async function scaffoldCms(opts) {
|
|
|
102166
102200
|
name: schema.name,
|
|
102167
102201
|
label: schema.label,
|
|
102168
102202
|
isSingleton: schema.isSingleton,
|
|
102169
|
-
fields: schema.fields
|
|
102203
|
+
fields: withoutReferences(schema.fields)
|
|
102170
102204
|
});
|
|
102171
102205
|
schemasCreated += 1;
|
|
102206
|
+
created.add(schema.name);
|
|
102172
102207
|
} catch (error45) {
|
|
102173
102208
|
failures.push({ type: schema.name, stage: "schema", message: errorMessage3(error45) });
|
|
102174
102209
|
}
|
|
102175
102210
|
}
|
|
102176
102211
|
for (const schema of ordered) {
|
|
102212
|
+
if (!created.has(schema.name) || existingTypes.has(schema.name) && !force || !hasReferences(schema.fields)) {
|
|
102213
|
+
continue;
|
|
102214
|
+
}
|
|
102215
|
+
try {
|
|
102216
|
+
await api.updateSchema(ctx.projectId, schema.name, {
|
|
102217
|
+
name: schema.name,
|
|
102218
|
+
label: schema.label,
|
|
102219
|
+
isSingleton: schema.isSingleton,
|
|
102220
|
+
fields: schema.fields
|
|
102221
|
+
});
|
|
102222
|
+
} catch (error45) {
|
|
102223
|
+
failures.push({ type: schema.name, stage: "schema", message: `references: ${errorMessage3(error45)}` });
|
|
102224
|
+
}
|
|
102225
|
+
}
|
|
102226
|
+
for (const schema of ordered) {
|
|
102227
|
+
if (!created.has(schema.name)) {
|
|
102228
|
+
continue;
|
|
102229
|
+
}
|
|
102177
102230
|
const seedLocales = schema.localized && locales.length > 0 ? locales : [void 0];
|
|
102178
102231
|
for (const locale of seedLocales) {
|
|
102179
102232
|
const seed = generateExampleSeed(schema, { count, locale });
|
|
102180
102233
|
try {
|
|
102181
|
-
|
|
102182
|
-
|
|
102183
|
-
|
|
102184
|
-
|
|
102185
|
-
|
|
102186
|
-
|
|
102187
|
-
|
|
102188
|
-
|
|
102189
|
-
type: schema.name,
|
|
102190
|
-
stage: "entries",
|
|
102191
|
-
message: `${result.failed.length} entry(ies) rejected${locale ? ` (${locale})` : ""}: ${result.failed[0]?.message ?? result.failed[0]?.code ?? "unknown"}`
|
|
102234
|
+
if (schema.isSingleton) {
|
|
102235
|
+
await api.putDocument(ctx.projectId, schema.name, seed.rows[0] ?? {}, locale ? { locale } : {});
|
|
102236
|
+
entriesCreated += 1;
|
|
102237
|
+
} else {
|
|
102238
|
+
const result = await api.createEntriesBatch(ctx.projectId, schema.name, {
|
|
102239
|
+
entries: seed.rows.map((data2) => ({ data: data2 })),
|
|
102240
|
+
...locale ? { locale } : {},
|
|
102241
|
+
...Object.keys(seed.references).length > 0 ? { references: seed.references } : {}
|
|
102192
102242
|
});
|
|
102243
|
+
entriesCreated += result.created?.length ?? 0;
|
|
102244
|
+
if (result.failed && result.failed.length > 0) {
|
|
102245
|
+
failures.push({
|
|
102246
|
+
type: schema.name,
|
|
102247
|
+
stage: "entries",
|
|
102248
|
+
message: `${result.failed.length} entry(ies) rejected${locale ? ` (${locale})` : ""}: ${result.failed[0]?.message ?? result.failed[0]?.code ?? "unknown"}`
|
|
102249
|
+
});
|
|
102250
|
+
}
|
|
102193
102251
|
}
|
|
102194
102252
|
if (locale) {
|
|
102195
102253
|
usedLocales.add(locale);
|
|
@@ -102219,6 +102277,8 @@ var init_cms_scaffold = __esm({
|
|
|
102219
102277
|
init_dist();
|
|
102220
102278
|
init_example_content();
|
|
102221
102279
|
__name(extractSchemaTypeNames, "extractSchemaTypeNames");
|
|
102280
|
+
__name(withoutReferences, "withoutReferences");
|
|
102281
|
+
__name(hasReferences, "hasReferences");
|
|
102222
102282
|
__name(orderByDependency, "orderByDependency");
|
|
102223
102283
|
__name(scaffoldCms, "scaffoldCms");
|
|
102224
102284
|
}
|
|
@@ -102328,9 +102388,9 @@ async function localCodeSurface(cwd) {
|
|
|
102328
102388
|
const lines = out.split("\n").filter(Boolean);
|
|
102329
102389
|
const items = lines.map((line) => {
|
|
102330
102390
|
const code2 = line.slice(0, 2);
|
|
102331
|
-
const
|
|
102391
|
+
const path62 = line.slice(3).trim();
|
|
102332
102392
|
const verb = code2.startsWith("A") || code2.startsWith("?") ? "added" : code2.startsWith("D") ? "removed" : "changed";
|
|
102333
|
-
return { verb, key:
|
|
102393
|
+
return { verb, key: path62, origin: "local-uncommitted" };
|
|
102334
102394
|
});
|
|
102335
102395
|
return {
|
|
102336
102396
|
surface: "code",
|
|
@@ -102444,8 +102504,8 @@ var init_status = __esm({
|
|
|
102444
102504
|
|
|
102445
102505
|
// src/cli/index.ts
|
|
102446
102506
|
init_dist();
|
|
102447
|
-
import
|
|
102448
|
-
import
|
|
102507
|
+
import fs56 from "node:fs";
|
|
102508
|
+
import path61 from "node:path";
|
|
102449
102509
|
|
|
102450
102510
|
// ../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/esm.mjs
|
|
102451
102511
|
var import_index = __toESM(require_commander(), 1);
|
|
@@ -102638,8 +102698,8 @@ function parseYamlStrict(text3, file2, bundlePath) {
|
|
|
102638
102698
|
}
|
|
102639
102699
|
__name(parseYamlStrict, "parseYamlStrict");
|
|
102640
102700
|
function formatZodIssue(issue2) {
|
|
102641
|
-
const
|
|
102642
|
-
return `${
|
|
102701
|
+
const path62 = issue2.path.length === 0 ? "(root)" : issue2.path.join(".");
|
|
102702
|
+
return `${path62}: ${issue2.message}`;
|
|
102643
102703
|
}
|
|
102644
102704
|
__name(formatZodIssue, "formatZodIssue");
|
|
102645
102705
|
async function parseBundle(bundlePath, opts = {}) {
|
|
@@ -111018,15 +111078,15 @@ function flattenMessages(messages, prefix = "") {
|
|
|
111018
111078
|
return { flat, skipped };
|
|
111019
111079
|
}
|
|
111020
111080
|
for (const [key, value] of Object.entries(messages)) {
|
|
111021
|
-
const
|
|
111081
|
+
const path62 = prefix ? `${prefix}.${key}` : key;
|
|
111022
111082
|
if (typeof value === "string") {
|
|
111023
|
-
flat[
|
|
111083
|
+
flat[path62] = value;
|
|
111024
111084
|
} else if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
111025
|
-
const nested = flattenMessages(value,
|
|
111085
|
+
const nested = flattenMessages(value, path62);
|
|
111026
111086
|
Object.assign(flat, nested.flat);
|
|
111027
111087
|
skipped.push(...nested.skipped);
|
|
111028
111088
|
} else {
|
|
111029
|
-
skipped.push(
|
|
111089
|
+
skipped.push(path62);
|
|
111030
111090
|
}
|
|
111031
111091
|
}
|
|
111032
111092
|
return { flat, skipped };
|
|
@@ -111059,7 +111119,7 @@ function findMessageStore(cwd, explicitDir) {
|
|
|
111059
111119
|
__name(findMessageStore, "findMessageStore");
|
|
111060
111120
|
function isI18nFimoWired(cwd) {
|
|
111061
111121
|
const skip = /* @__PURE__ */ new Set(["node_modules", ".git", ".next", ".nuxt", "dist", "build", ".fimo"]);
|
|
111062
|
-
const
|
|
111122
|
+
const walk2 = /* @__PURE__ */ __name((dir, depth) => {
|
|
111063
111123
|
if (depth > 4) {
|
|
111064
111124
|
return false;
|
|
111065
111125
|
}
|
|
@@ -111072,7 +111132,7 @@ function isI18nFimoWired(cwd) {
|
|
|
111072
111132
|
for (const entry of entries2) {
|
|
111073
111133
|
const full = path36.join(dir, entry.name);
|
|
111074
111134
|
if (entry.isDirectory()) {
|
|
111075
|
-
if (!skip.has(entry.name) && !entry.name.startsWith(".") &&
|
|
111135
|
+
if (!skip.has(entry.name) && !entry.name.startsWith(".") && walk2(full, depth + 1)) {
|
|
111076
111136
|
return true;
|
|
111077
111137
|
}
|
|
111078
111138
|
} else if (/\.(tsx?|jsx?|mjs)$/.test(entry.name)) {
|
|
@@ -111086,7 +111146,7 @@ function isI18nFimoWired(cwd) {
|
|
|
111086
111146
|
}
|
|
111087
111147
|
return false;
|
|
111088
111148
|
}, "walk");
|
|
111089
|
-
return
|
|
111149
|
+
return walk2(cwd, 0);
|
|
111090
111150
|
}
|
|
111091
111151
|
__name(isI18nFimoWired, "isI18nFimoWired");
|
|
111092
111152
|
function collectMessageRecords(storeDir) {
|
|
@@ -114485,13 +114545,13 @@ async function schemaAdoptDraftsCommand(options, cmd) {
|
|
|
114485
114545
|
renameCallSites(dir);
|
|
114486
114546
|
}
|
|
114487
114547
|
}
|
|
114488
|
-
const
|
|
114548
|
+
const hasReferences2 = adoption.kept.some(
|
|
114489
114549
|
(schema) => Object.values(schema.fields).some(
|
|
114490
114550
|
(def) => def && typeof def === "object" && def.type === "reference"
|
|
114491
114551
|
)
|
|
114492
114552
|
);
|
|
114493
|
-
await pushAllSchemas(ctx, api, cwd, void 0, { tolerateUnknownTargets:
|
|
114494
|
-
if (
|
|
114553
|
+
await pushAllSchemas(ctx, api, cwd, void 0, { tolerateUnknownTargets: hasReferences2 });
|
|
114554
|
+
if (hasReferences2) {
|
|
114495
114555
|
await pushAllSchemas(ctx, api, cwd);
|
|
114496
114556
|
}
|
|
114497
114557
|
const summary2 = {
|
|
@@ -114614,8 +114674,8 @@ init_dist6();
|
|
|
114614
114674
|
init_dist();
|
|
114615
114675
|
init_apply_wrap_templates();
|
|
114616
114676
|
init_apply_wrap();
|
|
114617
|
-
import
|
|
114618
|
-
import
|
|
114677
|
+
import fs52 from "node:fs";
|
|
114678
|
+
import path57 from "node:path";
|
|
114619
114679
|
|
|
114620
114680
|
// src/scripts/cms/strapi/detect.ts
|
|
114621
114681
|
import { existsSync as existsSync13, readdirSync as readdirSync15, readFileSync as readFileSync17, statSync as statSync11 } from "node:fs";
|
|
@@ -114673,7 +114733,7 @@ function scanSourceSignals(frontendDir) {
|
|
|
114673
114733
|
let scanned = 0;
|
|
114674
114734
|
let uid = false;
|
|
114675
114735
|
let env2 = false;
|
|
114676
|
-
const
|
|
114736
|
+
const walk2 = /* @__PURE__ */ __name((dir) => {
|
|
114677
114737
|
if (scanned >= MAX_FILES_SCANNED || uid && env2) {
|
|
114678
114738
|
return;
|
|
114679
114739
|
}
|
|
@@ -114683,7 +114743,7 @@ function scanSourceSignals(frontendDir) {
|
|
|
114683
114743
|
}
|
|
114684
114744
|
if (entry.isDirectory()) {
|
|
114685
114745
|
if (!SKIP_DIRS4.has(entry.name) && !entry.name.startsWith(".")) {
|
|
114686
|
-
|
|
114746
|
+
walk2(join23(dir, entry.name));
|
|
114687
114747
|
}
|
|
114688
114748
|
continue;
|
|
114689
114749
|
}
|
|
@@ -114703,7 +114763,7 @@ function scanSourceSignals(frontendDir) {
|
|
|
114703
114763
|
}
|
|
114704
114764
|
}
|
|
114705
114765
|
}, "walk");
|
|
114706
|
-
|
|
114766
|
+
walk2(root2);
|
|
114707
114767
|
return { uid, env: env2 };
|
|
114708
114768
|
}
|
|
114709
114769
|
__name(scanSourceSignals, "scanSourceSignals");
|
|
@@ -114779,6 +114839,7 @@ function detectStrapi(frontendDir) {
|
|
|
114779
114839
|
cms: "Strapi",
|
|
114780
114840
|
host: "Strapi",
|
|
114781
114841
|
appDir,
|
|
114842
|
+
clientDir: libModule,
|
|
114782
114843
|
evidence,
|
|
114783
114844
|
locales: []
|
|
114784
114845
|
};
|
|
@@ -114919,10 +114980,16 @@ function mapSchema(raw, uidToName) {
|
|
|
114919
114980
|
const info = raw.schema.info ?? {};
|
|
114920
114981
|
const name = uidToName.get(raw.uid);
|
|
114921
114982
|
const fields = {};
|
|
114983
|
+
const examples = {};
|
|
114922
114984
|
for (const [field, attr2] of Object.entries(raw.schema.attributes ?? {})) {
|
|
114923
114985
|
const mapped = mapAttribute(field, attr2, uidToName);
|
|
114924
114986
|
if (mapped) {
|
|
114925
114987
|
fields[field] = mapped;
|
|
114988
|
+
if (attr2.type === "dynamiczone" || attr2.type === "component" && attr2.repeatable) {
|
|
114989
|
+
examples[field] = [];
|
|
114990
|
+
} else if (attr2.type === "component") {
|
|
114991
|
+
examples[field] = {};
|
|
114992
|
+
}
|
|
114926
114993
|
}
|
|
114927
114994
|
}
|
|
114928
114995
|
return {
|
|
@@ -114931,6 +114998,7 @@ function mapSchema(raw, uidToName) {
|
|
|
114931
114998
|
isSingleton: raw.schema.kind === "singleType",
|
|
114932
114999
|
localized: raw.schema.pluginOptions?.i18n?.localized === true,
|
|
114933
115000
|
fields,
|
|
115001
|
+
...Object.keys(examples).length > 0 ? { examples } : {},
|
|
114934
115002
|
sourceUid: raw.uid,
|
|
114935
115003
|
sourcePath: `/${info.pluralName ?? raw.contentTypeName}`
|
|
114936
115004
|
};
|
|
@@ -114984,6 +115052,158 @@ function readStrapiSchemas(strapiAppDir) {
|
|
|
114984
115052
|
}
|
|
114985
115053
|
__name(readStrapiSchemas, "readStrapiSchemas");
|
|
114986
115054
|
|
|
115055
|
+
// src/scripts/cms/strapi/wire-client.ts
|
|
115056
|
+
import fs51 from "node:fs";
|
|
115057
|
+
import path56 from "node:path";
|
|
115058
|
+
import { parseSync as parseSync8 } from "oxc-parser";
|
|
115059
|
+
|
|
115060
|
+
// src/scripts/cms/strapi/wiring.ts
|
|
115061
|
+
function strapiWiring(schemas3) {
|
|
115062
|
+
const types = {};
|
|
115063
|
+
const singletons = [];
|
|
115064
|
+
for (const schema of schemas3) {
|
|
115065
|
+
const pluralName = schema.sourcePath.replace(/^\/+/, "");
|
|
115066
|
+
if (pluralName) {
|
|
115067
|
+
types[pluralName] = schema.name;
|
|
115068
|
+
}
|
|
115069
|
+
if (schema.isSingleton) {
|
|
115070
|
+
singletons.push(schema.name);
|
|
115071
|
+
}
|
|
115072
|
+
}
|
|
115073
|
+
return { types, singletons };
|
|
115074
|
+
}
|
|
115075
|
+
__name(strapiWiring, "strapiWiring");
|
|
115076
|
+
function renderFimoStrapiModule(schemas3) {
|
|
115077
|
+
const { types, singletons } = strapiWiring(schemas3);
|
|
115078
|
+
const typeEntries = Object.entries(types).map(([pluralName, typeName]) => ` '${pluralName}': '${typeName}',`).join("\n");
|
|
115079
|
+
return `// AUTO-GENERATED by \`fimo migrate --scaffold-cms\`. Serves this site's Strapi
|
|
115080
|
+
// content reads from Fimo (scaffolded example content) through fimo/strapi.
|
|
115081
|
+
// The migration points the CMS client's fetch at \`fimoStrapiFetch\`; reads for
|
|
115082
|
+
// scaffolded types resolve from Fimo, everything else falls through to Strapi.
|
|
115083
|
+
import { createFimoStrapiFetch } from 'fimo/strapi';
|
|
115084
|
+
|
|
115085
|
+
// Strapi REST path (pluralName) -> Fimo type name.
|
|
115086
|
+
const TYPES: Record<string, string> = {
|
|
115087
|
+
${typeEntries}
|
|
115088
|
+
};
|
|
115089
|
+
|
|
115090
|
+
const SINGLETONS = [${singletons.map((name) => `'${name}'`).join(", ")}];
|
|
115091
|
+
|
|
115092
|
+
export const fimoStrapiFetch = createFimoStrapiFetch({ types: TYPES, singletons: SINGLETONS });
|
|
115093
|
+
`;
|
|
115094
|
+
}
|
|
115095
|
+
__name(renderFimoStrapiModule, "renderFimoStrapiModule");
|
|
115096
|
+
|
|
115097
|
+
// src/scripts/cms/strapi/wire-client.ts
|
|
115098
|
+
function walk(node, visit2) {
|
|
115099
|
+
if (!node || typeof node !== "object") {
|
|
115100
|
+
return;
|
|
115101
|
+
}
|
|
115102
|
+
if (Array.isArray(node)) {
|
|
115103
|
+
for (const child of node) {
|
|
115104
|
+
walk(child, visit2);
|
|
115105
|
+
}
|
|
115106
|
+
return;
|
|
115107
|
+
}
|
|
115108
|
+
const record2 = node;
|
|
115109
|
+
if (typeof record2.type === "string") {
|
|
115110
|
+
visit2(record2);
|
|
115111
|
+
}
|
|
115112
|
+
for (const [key, value] of Object.entries(record2)) {
|
|
115113
|
+
if (key !== "type" && value && typeof value === "object") {
|
|
115114
|
+
walk(value, visit2);
|
|
115115
|
+
}
|
|
115116
|
+
}
|
|
115117
|
+
}
|
|
115118
|
+
__name(walk, "walk");
|
|
115119
|
+
function bareFetchCallees(filePath, code2) {
|
|
115120
|
+
let program2;
|
|
115121
|
+
try {
|
|
115122
|
+
program2 = parseSync8(filePath, code2).program;
|
|
115123
|
+
} catch {
|
|
115124
|
+
return [];
|
|
115125
|
+
}
|
|
115126
|
+
const spans = [];
|
|
115127
|
+
walk(program2, (n) => {
|
|
115128
|
+
if (n.type === "CallExpression" && n.callee?.type === "Identifier" && n.callee.name === "fetch") {
|
|
115129
|
+
spans.push({ start: n.callee.start, end: n.callee.end });
|
|
115130
|
+
}
|
|
115131
|
+
});
|
|
115132
|
+
return spans;
|
|
115133
|
+
}
|
|
115134
|
+
__name(bareFetchCallees, "bareFetchCallees");
|
|
115135
|
+
function applyReplacements(code2, edits) {
|
|
115136
|
+
let next2 = code2;
|
|
115137
|
+
for (const edit of [...edits].sort((a, b) => b.start - a.start)) {
|
|
115138
|
+
next2 = next2.slice(0, edit.start) + edit.text + next2.slice(edit.end);
|
|
115139
|
+
}
|
|
115140
|
+
return next2;
|
|
115141
|
+
}
|
|
115142
|
+
__name(applyReplacements, "applyReplacements");
|
|
115143
|
+
function relativeImport2(fromFile, toFile) {
|
|
115144
|
+
const rel = path56.relative(path56.dirname(fromFile), toFile).replace(/\.tsx?$/, "").split(path56.sep).join("/");
|
|
115145
|
+
return rel.startsWith(".") ? rel : `./${rel}`;
|
|
115146
|
+
}
|
|
115147
|
+
__name(relativeImport2, "relativeImport");
|
|
115148
|
+
function sourceFiles(dir) {
|
|
115149
|
+
const out = [];
|
|
115150
|
+
const walkDir2 = /* @__PURE__ */ __name((current) => {
|
|
115151
|
+
for (const entry of fs51.readdirSync(current, { withFileTypes: true })) {
|
|
115152
|
+
if (entry.name === "node_modules" || entry.name.startsWith(".")) {
|
|
115153
|
+
continue;
|
|
115154
|
+
}
|
|
115155
|
+
const full = path56.join(current, entry.name);
|
|
115156
|
+
if (entry.isDirectory()) {
|
|
115157
|
+
walkDir2(full);
|
|
115158
|
+
} else if (/\.(tsx?|jsx?|mjs)$/.test(entry.name)) {
|
|
115159
|
+
out.push(full);
|
|
115160
|
+
}
|
|
115161
|
+
}
|
|
115162
|
+
}, "walkDir");
|
|
115163
|
+
if (fs51.existsSync(dir)) {
|
|
115164
|
+
walkDir2(dir);
|
|
115165
|
+
}
|
|
115166
|
+
return out;
|
|
115167
|
+
}
|
|
115168
|
+
__name(sourceFiles, "sourceFiles");
|
|
115169
|
+
function wireStrapiClient(cwd, clientDir, schemas3) {
|
|
115170
|
+
const changes = [];
|
|
115171
|
+
const warnings = [];
|
|
115172
|
+
if (!fs51.existsSync(clientDir)) {
|
|
115173
|
+
return { changes, warnings: [`CMS client directory not found: ${path56.relative(cwd, clientDir)}`], wired: false };
|
|
115174
|
+
}
|
|
115175
|
+
const modulePath = path56.join(clientDir, "fimo-strapi.ts");
|
|
115176
|
+
fs51.writeFileSync(modulePath, renderFimoStrapiModule(schemas3));
|
|
115177
|
+
changes.push(`generated ${path56.relative(cwd, modulePath)}`);
|
|
115178
|
+
let swapped = 0;
|
|
115179
|
+
for (const file2 of sourceFiles(clientDir)) {
|
|
115180
|
+
if (path56.resolve(file2) === path56.resolve(modulePath)) {
|
|
115181
|
+
continue;
|
|
115182
|
+
}
|
|
115183
|
+
const code2 = fs51.readFileSync(file2, "utf8");
|
|
115184
|
+
const spans = bareFetchCallees(file2, code2);
|
|
115185
|
+
if (spans.length === 0) {
|
|
115186
|
+
continue;
|
|
115187
|
+
}
|
|
115188
|
+
let next2 = applyReplacements(
|
|
115189
|
+
code2,
|
|
115190
|
+
spans.map((span) => ({ ...span, text: "fimoStrapiFetch" }))
|
|
115191
|
+
);
|
|
115192
|
+
next2 = `import { fimoStrapiFetch } from '${relativeImport2(file2, modulePath)}';
|
|
115193
|
+
${next2}`;
|
|
115194
|
+
fs51.writeFileSync(file2, next2);
|
|
115195
|
+
swapped += spans.length;
|
|
115196
|
+
changes.push(`rewired ${path56.relative(cwd, file2)}: ${spans.length} fetch call(s) \u2192 fimoStrapiFetch`);
|
|
115197
|
+
}
|
|
115198
|
+
if (swapped === 0) {
|
|
115199
|
+
warnings.push(
|
|
115200
|
+
`No bare fetch() call found under ${path56.relative(cwd, clientDir)} \u2014 wire fimoStrapiFetch into the client manually.`
|
|
115201
|
+
);
|
|
115202
|
+
}
|
|
115203
|
+
return { changes, warnings, wired: swapped > 0 };
|
|
115204
|
+
}
|
|
115205
|
+
__name(wireStrapiClient, "wireStrapiClient");
|
|
115206
|
+
|
|
114987
115207
|
// src/scripts/cms/strapi/index.ts
|
|
114988
115208
|
function strapiConnector(frontendDir) {
|
|
114989
115209
|
const detection = detectStrapi(frontendDir);
|
|
@@ -114993,7 +115213,12 @@ function strapiConnector(frontendDir) {
|
|
|
114993
115213
|
return {
|
|
114994
115214
|
detection,
|
|
114995
115215
|
readSchemas: /* @__PURE__ */ __name(() => detection.appDir ? readStrapiSchemas(detection.appDir) : [], "readSchemas"),
|
|
114996
|
-
renderListSource: /* @__PURE__ */ __name((schemas3, serverImport) => schemas3.length > 0 ? renderStrapiListSource(schemas3, serverImport) : null, "renderListSource")
|
|
115216
|
+
renderListSource: /* @__PURE__ */ __name((schemas3, serverImport) => schemas3.length > 0 ? renderStrapiListSource(schemas3, serverImport) : null, "renderListSource"),
|
|
115217
|
+
wireClient: /* @__PURE__ */ __name((cwd, schemas3) => detection.clientDir ? wireStrapiClient(cwd, detection.clientDir, schemas3) : {
|
|
115218
|
+
changes: [],
|
|
115219
|
+
warnings: ["No Strapi client directory detected \u2014 wire fimoStrapiFetch manually."],
|
|
115220
|
+
wired: false
|
|
115221
|
+
}, "wireClient")
|
|
114997
115222
|
};
|
|
114998
115223
|
}
|
|
114999
115224
|
__name(strapiConnector, "strapiConnector");
|
|
@@ -115321,6 +115546,105 @@ init_wiring();
|
|
|
115321
115546
|
init_scan_wrappable();
|
|
115322
115547
|
init_fimo_dep();
|
|
115323
115548
|
init_color();
|
|
115549
|
+
|
|
115550
|
+
// src/cli/utils/wrap-dashboard.ts
|
|
115551
|
+
var CHARS = {
|
|
115552
|
+
unicode: { h: "\u2500", v: "\u2502", tl: "\u250C", tr: "\u2510", bl: "\u2514", br: "\u2518", ok: "\u2713", warn: "\u26A0", skip: "\xB7", fail: "\u2717" },
|
|
115553
|
+
ascii: { h: "-", v: "|", tl: "+", tr: "+", bl: "+", br: "+", ok: "v", warn: "!", skip: "-", fail: "x" }
|
|
115554
|
+
};
|
|
115555
|
+
function formatDuration2(ms) {
|
|
115556
|
+
if (ms < 1e3) {
|
|
115557
|
+
return `${Math.round(ms)}ms`;
|
|
115558
|
+
}
|
|
115559
|
+
if (ms < 6e4) {
|
|
115560
|
+
return `${(ms / 1e3).toFixed(1)}s`;
|
|
115561
|
+
}
|
|
115562
|
+
const sec = Math.round(ms / 1e3);
|
|
115563
|
+
return `${Math.floor(sec / 60)}m ${sec % 60}s`;
|
|
115564
|
+
}
|
|
115565
|
+
__name(formatDuration2, "formatDuration");
|
|
115566
|
+
var ANSI2 = /\[[0-9;]*m/g;
|
|
115567
|
+
function visibleLength(text3) {
|
|
115568
|
+
return text3.replace(new RegExp(String.fromCharCode(27), "g"), "").replace(ANSI2, "").length;
|
|
115569
|
+
}
|
|
115570
|
+
__name(visibleLength, "visibleLength");
|
|
115571
|
+
function pad2(text3, width) {
|
|
115572
|
+
const len = visibleLength(text3);
|
|
115573
|
+
return len >= width ? text3 : text3 + " ".repeat(width - len);
|
|
115574
|
+
}
|
|
115575
|
+
__name(pad2, "pad");
|
|
115576
|
+
function renderWrapDashboard(input) {
|
|
115577
|
+
const c2 = input.ascii ? CHARS.ascii : CHARS.unicode;
|
|
115578
|
+
const paintOk = input.colors?.ok ?? ((s) => s);
|
|
115579
|
+
const paintWarn = input.colors?.warn ?? ((s) => s);
|
|
115580
|
+
const paintFail = input.colors?.fail ?? ((s) => s);
|
|
115581
|
+
const stepGlyph = /* @__PURE__ */ __name((s) => s === "ok" ? paintOk(c2.ok) : s === "warn" ? paintWarn(c2.warn) : c2.skip, "stepGlyph");
|
|
115582
|
+
const gateGlyph = /* @__PURE__ */ __name((s) => s === "ok" ? paintOk(c2.ok) : s === "warn" ? paintWarn(c2.warn) : paintFail(c2.fail), "gateGlyph");
|
|
115583
|
+
const rows = input.steps.map((s) => ({
|
|
115584
|
+
label: s.label,
|
|
115585
|
+
status: stepGlyph(s.status),
|
|
115586
|
+
time: formatDuration2(s.ms),
|
|
115587
|
+
detail: s.detail
|
|
115588
|
+
}));
|
|
115589
|
+
const wLabel = Math.max(4, ...rows.map((r) => visibleLength(r.label)));
|
|
115590
|
+
const wStatus = Math.max(1, ...rows.map((r) => visibleLength(r.status)));
|
|
115591
|
+
const wTime = Math.max(4, ...rows.map((r) => visibleLength(r.time)));
|
|
115592
|
+
const stepLine = /* @__PURE__ */ __name((r) => `${pad2(r.label, wLabel)} ${pad2(r.status, wStatus)} ${pad2(r.time, wTime)} ${r.detail}`.trimEnd(), "stepLine");
|
|
115593
|
+
const headerLine = `${pad2("STEP", wLabel)} ${pad2("", wStatus)} ${pad2("TIME", wTime)} DETAIL`;
|
|
115594
|
+
const rule = /* @__PURE__ */ __name(() => "", "rule");
|
|
115595
|
+
const gatesLine = input.gates.length > 0 ? `${input.gates.map((g) => `${g.label} ${gateGlyph(g.status)}`).join(" ")} total ${formatDuration2(input.totalMs)}` : `total ${formatDuration2(input.totalMs)}`;
|
|
115596
|
+
const body = [headerLine, null, ...rows.map(stepLine), null, gatesLine];
|
|
115597
|
+
const inner = Math.max(
|
|
115598
|
+
input.title.length + input.verdict.length + 6,
|
|
115599
|
+
...body.filter((l) => l !== null).map((l) => visibleLength(l))
|
|
115600
|
+
);
|
|
115601
|
+
const line = /* @__PURE__ */ __name((content2) => `${c2.v} ${pad2(content2, inner)} ${c2.v}`, "line");
|
|
115602
|
+
const divider = `${c2.v} ${c2.h.repeat(inner)} ${c2.v}`;
|
|
115603
|
+
const midFill = Math.max(1, inner - input.title.length - input.verdict.length - 4);
|
|
115604
|
+
const top = `${c2.tl}${c2.h} ${input.title} ${c2.h.repeat(midFill)} ${input.verdict} ${c2.h}${c2.tr}`;
|
|
115605
|
+
const bottom = `${c2.bl}${c2.h.repeat(inner + 2)}${c2.br}`;
|
|
115606
|
+
const out = [top];
|
|
115607
|
+
for (const entry of body) {
|
|
115608
|
+
out.push(entry === null ? divider : line(entry));
|
|
115609
|
+
}
|
|
115610
|
+
out.push(bottom);
|
|
115611
|
+
if (input.findings.length > 0) {
|
|
115612
|
+
out.push(" Findings");
|
|
115613
|
+
for (const finding of input.findings) {
|
|
115614
|
+
out.push(` ${paintWarn(c2.warn)} ${finding}`);
|
|
115615
|
+
}
|
|
115616
|
+
}
|
|
115617
|
+
if (input.reportPath) {
|
|
115618
|
+
out.push(` ${input.ascii ? "->" : "\u2192"} ${input.reportPath}`);
|
|
115619
|
+
}
|
|
115620
|
+
void rule;
|
|
115621
|
+
return out.join("\n");
|
|
115622
|
+
}
|
|
115623
|
+
__name(renderWrapDashboard, "renderWrapDashboard");
|
|
115624
|
+
var StepTimer = class {
|
|
115625
|
+
static {
|
|
115626
|
+
__name(this, "StepTimer");
|
|
115627
|
+
}
|
|
115628
|
+
last;
|
|
115629
|
+
start;
|
|
115630
|
+
recorded = [];
|
|
115631
|
+
constructor(now) {
|
|
115632
|
+
this.last = now;
|
|
115633
|
+
this.start = now;
|
|
115634
|
+
}
|
|
115635
|
+
mark(now, label, status, detail) {
|
|
115636
|
+
this.recorded.push({ label, status, ms: now - this.last, detail });
|
|
115637
|
+
this.last = now;
|
|
115638
|
+
}
|
|
115639
|
+
steps() {
|
|
115640
|
+
return this.recorded;
|
|
115641
|
+
}
|
|
115642
|
+
totalMs(now) {
|
|
115643
|
+
return now - this.start;
|
|
115644
|
+
}
|
|
115645
|
+
};
|
|
115646
|
+
|
|
115647
|
+
// src/cli/commands/migrate-wrap.ts
|
|
115324
115648
|
init_scaffold_project();
|
|
115325
115649
|
init_wrap_prompts();
|
|
115326
115650
|
function detectProjectPackageManager(cwd) {
|
|
@@ -115332,7 +115656,7 @@ function detectProjectPackageManager(cwd) {
|
|
|
115332
115656
|
["package-lock.json", "npm"]
|
|
115333
115657
|
];
|
|
115334
115658
|
for (const [lockfile, pm] of byLockfile) {
|
|
115335
|
-
if (
|
|
115659
|
+
if (fs52.existsSync(path57.join(cwd, lockfile))) {
|
|
115336
115660
|
return pm;
|
|
115337
115661
|
}
|
|
115338
115662
|
}
|
|
@@ -115340,7 +115664,7 @@ function detectProjectPackageManager(cwd) {
|
|
|
115340
115664
|
}
|
|
115341
115665
|
__name(detectProjectPackageManager, "detectProjectPackageManager");
|
|
115342
115666
|
function readWrapExemptions(cwd) {
|
|
115343
|
-
const manifest = readJson2(
|
|
115667
|
+
const manifest = readJson2(path57.join(cwd, ".fimo", "migration", "manifest.json"));
|
|
115344
115668
|
const raw = manifest?.wrap?.exemptions;
|
|
115345
115669
|
if (!Array.isArray(raw)) {
|
|
115346
115670
|
return [];
|
|
@@ -115351,7 +115675,7 @@ function readWrapExemptions(cwd) {
|
|
|
115351
115675
|
}
|
|
115352
115676
|
__name(readWrapExemptions, "readWrapExemptions");
|
|
115353
115677
|
function readDataFileDecisions(cwd) {
|
|
115354
|
-
const manifest = readJson2(
|
|
115678
|
+
const manifest = readJson2(path57.join(cwd, ".fimo", "migration", "manifest.json"));
|
|
115355
115679
|
const raw = manifest?.wrap?.dataFiles;
|
|
115356
115680
|
if (!Array.isArray(raw)) {
|
|
115357
115681
|
return [];
|
|
@@ -115362,7 +115686,7 @@ function readDataFileDecisions(cwd) {
|
|
|
115362
115686
|
}
|
|
115363
115687
|
__name(readDataFileDecisions, "readDataFileDecisions");
|
|
115364
115688
|
function readParityIgnores(cwd) {
|
|
115365
|
-
const manifest = readJson2(
|
|
115689
|
+
const manifest = readJson2(path57.join(cwd, ".fimo", "migration", "manifest.json"));
|
|
115366
115690
|
const raw = manifest?.wrap?.parityIgnores;
|
|
115367
115691
|
if (!Array.isArray(raw)) {
|
|
115368
115692
|
return { patterns: [], routes: [] };
|
|
@@ -115377,7 +115701,7 @@ function readParityIgnores(cwd) {
|
|
|
115377
115701
|
}
|
|
115378
115702
|
__name(readParityIgnores, "readParityIgnores");
|
|
115379
115703
|
function readDataSourceDecisions(cwd) {
|
|
115380
|
-
const manifest = readJson2(
|
|
115704
|
+
const manifest = readJson2(path57.join(cwd, ".fimo", "migration", "manifest.json"));
|
|
115381
115705
|
const raw = manifest?.wrap?.dataSources;
|
|
115382
115706
|
if (!Array.isArray(raw)) {
|
|
115383
115707
|
return [];
|
|
@@ -115388,11 +115712,11 @@ function readDataSourceDecisions(cwd) {
|
|
|
115388
115712
|
}
|
|
115389
115713
|
__name(readDataSourceDecisions, "readDataSourceDecisions");
|
|
115390
115714
|
function writeDataSourceDecisions(cwd, records) {
|
|
115391
|
-
const manifestPath =
|
|
115715
|
+
const manifestPath = path57.join(cwd, ".fimo", "migration", "manifest.json");
|
|
115392
115716
|
const manifest = readJson2(manifestPath) ?? {};
|
|
115393
115717
|
manifest.wrap = { ...manifest.wrap ?? {}, dataSources: records };
|
|
115394
|
-
|
|
115395
|
-
|
|
115718
|
+
fs52.mkdirSync(path57.dirname(manifestPath), { recursive: true });
|
|
115719
|
+
fs52.writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}
|
|
115396
115720
|
`);
|
|
115397
115721
|
}
|
|
115398
115722
|
__name(writeDataSourceDecisions, "writeDataSourceDecisions");
|
|
@@ -115557,7 +115881,7 @@ function resolveExcludedSections(cwd, config2, appDir) {
|
|
|
115557
115881
|
);
|
|
115558
115882
|
const sections = [];
|
|
115559
115883
|
try {
|
|
115560
|
-
for (const entry of
|
|
115884
|
+
for (const entry of fs52.readdirSync(path57.join(cwd, appDir))) {
|
|
115561
115885
|
const clean = entry.replace(/^\(|\)$/g, "").toLowerCase();
|
|
115562
115886
|
if (BACKOFFICE_SEGMENTS.has(clean) && !include.has(entry) && !include.has(`/${entry}`)) {
|
|
115563
115887
|
sections.push(entry);
|
|
@@ -115606,12 +115930,12 @@ async function syncProjectEnvKeys(cwd, options) {
|
|
|
115606
115930
|
const local = {};
|
|
115607
115931
|
let found = false;
|
|
115608
115932
|
for (const filename of [".env", ".env.local"]) {
|
|
115609
|
-
const filePath =
|
|
115610
|
-
if (!
|
|
115933
|
+
const filePath = path57.join(cwd, filename);
|
|
115934
|
+
if (!fs52.existsSync(filePath)) {
|
|
115611
115935
|
continue;
|
|
115612
115936
|
}
|
|
115613
115937
|
found = true;
|
|
115614
|
-
Object.assign(local, parseEnvFile(
|
|
115938
|
+
Object.assign(local, parseEnvFile(fs52.readFileSync(filePath, "utf8")));
|
|
115615
115939
|
}
|
|
115616
115940
|
if (!found) {
|
|
115617
115941
|
return { skipped: "no-env-files" };
|
|
@@ -115715,7 +116039,7 @@ function renderSeedingSection(seeding) {
|
|
|
115715
116039
|
__name(renderSeedingSection, "renderSeedingSection");
|
|
115716
116040
|
function readJson2(filePath) {
|
|
115717
116041
|
try {
|
|
115718
|
-
return JSON.parse(
|
|
116042
|
+
return JSON.parse(fs52.readFileSync(filePath, "utf8"));
|
|
115719
116043
|
} catch {
|
|
115720
116044
|
return null;
|
|
115721
116045
|
}
|
|
@@ -115742,7 +116066,7 @@ function checkRootWiring(cwd, detection) {
|
|
|
115742
116066
|
}
|
|
115743
116067
|
const present = marker.files.some((file2) => {
|
|
115744
116068
|
try {
|
|
115745
|
-
return marker.marker.test(
|
|
116069
|
+
return marker.marker.test(fs52.readFileSync(path57.join(cwd, file2), "utf8"));
|
|
115746
116070
|
} catch {
|
|
115747
116071
|
return false;
|
|
115748
116072
|
}
|
|
@@ -115765,8 +116089,8 @@ function ensureWrapWiring(cwd, framework) {
|
|
|
115765
116089
|
}
|
|
115766
116090
|
__name(ensureWrapWiring, "ensureWrapWiring");
|
|
115767
116091
|
async function migrateWrapCommand(options) {
|
|
115768
|
-
const cwd = options.cwd ?
|
|
115769
|
-
const configPath =
|
|
116092
|
+
const cwd = options.cwd ? path57.resolve(options.cwd) : process.cwd();
|
|
116093
|
+
const configPath = path57.join(cwd, "fimo-config.json");
|
|
115770
116094
|
const config2 = readJson2(configPath);
|
|
115771
116095
|
if (!config2) {
|
|
115772
116096
|
ui.error({
|
|
@@ -115799,11 +116123,12 @@ async function migrateWrapCommand(options) {
|
|
|
115799
116123
|
}
|
|
115800
116124
|
config2.routes = routes;
|
|
115801
116125
|
routeCount = Object.keys(routes).length;
|
|
115802
|
-
|
|
116126
|
+
fs52.writeFileSync(configPath, `${JSON.stringify(config2, null, 2)}
|
|
115803
116127
|
`);
|
|
115804
116128
|
}
|
|
115805
116129
|
const excludedSections = resolveExcludedSections(cwd, config2, detection.appDir ?? detection.pagesDir);
|
|
115806
116130
|
const i18nFimoWired = isI18nFimoWired(cwd);
|
|
116131
|
+
const stepTimer = new StepTimer(Date.now());
|
|
115807
116132
|
let scan = scanWrappable(cwd, {
|
|
115808
116133
|
i18nFimoWired,
|
|
115809
116134
|
excludePrefixes: excludedSections.prefixes,
|
|
@@ -115811,6 +116136,7 @@ async function migrateWrapCommand(options) {
|
|
|
115811
116136
|
keepInternal: !options.check
|
|
115812
116137
|
});
|
|
115813
116138
|
let coverage = { wrappable: scan.items.length, wrapped: scan.wrappedCount };
|
|
116139
|
+
stepTimer.mark(Date.now(), "Scan", "ok", `${scan.filesScanned} files \xB7 ${coverage.wrappable} to wrap`);
|
|
115814
116140
|
const cmsConnector = detectCms(cwd);
|
|
115815
116141
|
const cmsSchemas = cmsConnector ? cmsConnector.readSchemas() : [];
|
|
115816
116142
|
const scaffoldableHosts = cmsConnector && cmsSchemas.length > 0 ? /* @__PURE__ */ new Set([cmsConnector.detection.host]) : /* @__PURE__ */ new Set();
|
|
@@ -115844,7 +116170,7 @@ async function migrateWrapCommand(options) {
|
|
|
115844
116170
|
let parity = { skipped: "disabled" };
|
|
115845
116171
|
if (options.parity !== false) {
|
|
115846
116172
|
const planHasParityPointer = Boolean(
|
|
115847
|
-
readJson2(
|
|
116173
|
+
readJson2(path57.join(cwd, ".fimo", "migration", "plan.json"))?.parity
|
|
115848
116174
|
);
|
|
115849
116175
|
const paritySp = spinner("Verifying render parity (booting your dev server)");
|
|
115850
116176
|
const parityIgnores = readParityIgnores(cwd);
|
|
@@ -115862,7 +116188,7 @@ async function migrateWrapCommand(options) {
|
|
|
115862
116188
|
const dataFileKeys = dataFileDecisions.filter((decision) => decision.decision === "labels" && typeof decision.labelPrefix === "string").flatMap((decision) => {
|
|
115863
116189
|
try {
|
|
115864
116190
|
return dataFileLabelKeys(
|
|
115865
|
-
|
|
116191
|
+
fs52.readFileSync(path57.join(cwd, decision.file), "utf8"),
|
|
115866
116192
|
decision.labelPrefix,
|
|
115867
116193
|
decision.file
|
|
115868
116194
|
);
|
|
@@ -115990,6 +116316,7 @@ ${error45.stderrTail.slice(-800)}` : "";
|
|
|
115990
116316
|
);
|
|
115991
116317
|
}
|
|
115992
116318
|
}
|
|
116319
|
+
stepTimer.mark(Date.now(), "Baseline", parityNote ? "ok" : "skip", parityNote ?? "not captured");
|
|
115993
116320
|
const effectiveDetection = {
|
|
115994
116321
|
...detection,
|
|
115995
116322
|
framework: framework ?? detection.framework
|
|
@@ -116008,10 +116335,10 @@ ${error45.stderrTail.slice(-800)}` : "";
|
|
|
116008
116335
|
runSp?.update("Applying safe wrap transforms");
|
|
116009
116336
|
applied = jsxWrapperModule ? applyWrap(cwd, { excludePrefixes: excludedSections.prefixes, importModule: jsxWrapperModule }) : applyTemplateWrap(cwd, { style: templateWrapStyle, excludePrefixes: excludedSections.prefixes });
|
|
116010
116337
|
if (Object.keys(applied.labels).length > 0) {
|
|
116011
|
-
const labelsPath =
|
|
116012
|
-
|
|
116338
|
+
const labelsPath = path57.join(cwd, ".fimo", "migration", "labels.json");
|
|
116339
|
+
fs52.mkdirSync(path57.dirname(labelsPath), { recursive: true });
|
|
116013
116340
|
const existing = readJson2(labelsPath) ?? {};
|
|
116014
|
-
|
|
116341
|
+
fs52.writeFileSync(labelsPath, `${JSON.stringify({ ...existing, ...applied.labels }, null, 2)}
|
|
116015
116342
|
`);
|
|
116016
116343
|
}
|
|
116017
116344
|
scan = scanWrappable(cwd, {
|
|
@@ -116029,11 +116356,17 @@ ${error45.stderrTail.slice(-800)}` : "";
|
|
|
116029
116356
|
}
|
|
116030
116357
|
}
|
|
116031
116358
|
}
|
|
116359
|
+
stepTimer.mark(
|
|
116360
|
+
Date.now(),
|
|
116361
|
+
"Apply",
|
|
116362
|
+
applied ? "ok" : "skip",
|
|
116363
|
+
applied ? `${applied.applied.length} auto-wrapped` : "no codemod applied"
|
|
116364
|
+
);
|
|
116032
116365
|
runSp?.update("Seeding migrated content");
|
|
116033
116366
|
let contentSeed = null;
|
|
116034
116367
|
let i18nIngest = null;
|
|
116035
116368
|
let cmsScaffold = null;
|
|
116036
|
-
let
|
|
116369
|
+
let cmsWired = null;
|
|
116037
116370
|
if (!options.check) {
|
|
116038
116371
|
try {
|
|
116039
116372
|
const { bootstrapProjectCommand: bootstrapProjectCommand2 } = await Promise.resolve().then(() => (init_project_context(), project_context_exports));
|
|
@@ -116054,7 +116387,7 @@ ${error45.stderrTail.slice(-800)}` : "";
|
|
|
116054
116387
|
configured2.add(locale);
|
|
116055
116388
|
}
|
|
116056
116389
|
config2.i18n = { ...config2.i18n, locales: [...configured2] };
|
|
116057
|
-
|
|
116390
|
+
fs52.writeFileSync(configPath, `${JSON.stringify(config2, null, 2)}
|
|
116058
116391
|
`);
|
|
116059
116392
|
}
|
|
116060
116393
|
}
|
|
@@ -116075,8 +116408,8 @@ ${error45.stderrTail.slice(-800)}` : "";
|
|
|
116075
116408
|
force: options.force,
|
|
116076
116409
|
existingTypes
|
|
116077
116410
|
});
|
|
116078
|
-
|
|
116079
|
-
|
|
116411
|
+
fs52.writeFileSync(
|
|
116412
|
+
path57.join(cwd, ".fimo", "migration", "cms-scaffold.json"),
|
|
116080
116413
|
`${JSON.stringify(cmsScaffold, null, 2)}
|
|
116081
116414
|
`
|
|
116082
116415
|
);
|
|
@@ -116086,12 +116419,10 @@ ${error45.stderrTail.slice(-800)}` : "";
|
|
|
116086
116419
|
`${cmsScaffold.cms} scaffold: ${cmsScaffold.failures.length} issue(s) \u2014 see .fimo/migration/cms-scaffold.json (e.g. ${first2.type}: ${first2.message})`
|
|
116087
116420
|
);
|
|
116088
116421
|
}
|
|
116089
|
-
const
|
|
116090
|
-
if (
|
|
116091
|
-
|
|
116092
|
-
|
|
116093
|
-
fs51.writeFileSync(helperAbs, listSource);
|
|
116094
|
-
cmsListHelperPath = path56.relative(cwd, helperAbs);
|
|
116422
|
+
const wired = cmsConnector?.wireClient?.(cwd, cmsSchemas);
|
|
116423
|
+
if (wired) {
|
|
116424
|
+
cmsWired = wired;
|
|
116425
|
+
parityWarnings.push(...wired.warnings);
|
|
116095
116426
|
}
|
|
116096
116427
|
for (const source of scaffoldTargets) {
|
|
116097
116428
|
source.scaffolded = true;
|
|
@@ -116101,9 +116432,15 @@ ${error45.stderrTail.slice(-800)}` : "";
|
|
|
116101
116432
|
} catch {
|
|
116102
116433
|
}
|
|
116103
116434
|
}
|
|
116104
|
-
const migrationDir =
|
|
116105
|
-
const wrapDir =
|
|
116106
|
-
|
|
116435
|
+
const migrationDir = path57.join(cwd, ".fimo", "migration");
|
|
116436
|
+
const wrapDir = path57.join(migrationDir, "wrap");
|
|
116437
|
+
fs52.mkdirSync(wrapDir, { recursive: true });
|
|
116438
|
+
stepTimer.mark(
|
|
116439
|
+
Date.now(),
|
|
116440
|
+
"Seed",
|
|
116441
|
+
cmsScaffold && cmsScaffold.failures.length > 0 ? "warn" : "ok",
|
|
116442
|
+
`${contentSeed?.seeded ?? 0} labels${cmsScaffold ? `, ${cmsScaffold.schemas} CMS types` : ""}`
|
|
116443
|
+
);
|
|
116107
116444
|
let schemaDrafts = options.check ? [] : writeSchemaDrafts(cwd, scan);
|
|
116108
116445
|
let stagedRows = options.check ? 0 : writeRowsStaging(cwd, scan, schemaDrafts);
|
|
116109
116446
|
let collectionRewire = null;
|
|
@@ -116153,14 +116490,14 @@ ${error45.stderrTail.slice(-800)}` : "";
|
|
|
116153
116490
|
collections: scan.collections,
|
|
116154
116491
|
dataFiles: scan.dataFiles
|
|
116155
116492
|
};
|
|
116156
|
-
const planPath =
|
|
116157
|
-
|
|
116493
|
+
const planPath = path57.join(migrationDir, "plan.json");
|
|
116494
|
+
fs52.writeFileSync(planPath, `${JSON.stringify(plan, null, 2)}
|
|
116158
116495
|
`);
|
|
116159
116496
|
const cmsScaffoldAvailable = cmsConnector && cmsSchemas.length > 0 && !dataSources.some(
|
|
116160
116497
|
(source) => source.host === cmsConnector.detection.host && source.decision === "ingest" && source.contentState === "example"
|
|
116161
116498
|
) ? { cms: cmsConnector.detection.cms, types: cmsSchemas.length } : void 0;
|
|
116162
|
-
const promptPath =
|
|
116163
|
-
|
|
116499
|
+
const promptPath = path57.join(wrapDir, "agent-prompt.md");
|
|
116500
|
+
fs52.writeFileSync(
|
|
116164
116501
|
promptPath,
|
|
116165
116502
|
renderAgentPrompt(framework ?? "js", coverage, scan, dataSources, {
|
|
116166
116503
|
applied: applied ? applied.applied.length : 0,
|
|
@@ -116173,7 +116510,7 @@ ${error45.stderrTail.slice(-800)}` : "";
|
|
|
116173
116510
|
i18nWired: i18nFimoWired,
|
|
116174
116511
|
cmsScaffold: cmsScaffold ?? void 0,
|
|
116175
116512
|
cmsScaffoldAvailable,
|
|
116176
|
-
|
|
116513
|
+
cmsWired: cmsWired ?? void 0,
|
|
116177
116514
|
wiring: wiringStatus ? {
|
|
116178
116515
|
present: wiringStatus.present,
|
|
116179
116516
|
hint: wiringStatus.hint,
|
|
@@ -116187,7 +116524,7 @@ ${error45.stderrTail.slice(-800)}` : "";
|
|
|
116187
116524
|
baseline: ".fimo/migration/parity-baseline.json",
|
|
116188
116525
|
capturedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
116189
116526
|
};
|
|
116190
|
-
|
|
116527
|
+
fs52.writeFileSync(planPath, `${JSON.stringify(plan, null, 2)}
|
|
116191
116528
|
`);
|
|
116192
116529
|
}
|
|
116193
116530
|
if (runSp) {
|
|
@@ -116198,7 +116535,7 @@ ${error45.stderrTail.slice(-800)}` : "";
|
|
|
116198
116535
|
runSp.stop();
|
|
116199
116536
|
}
|
|
116200
116537
|
const dependencyChanged = wiring.changes.some((change) => change.startsWith("added"));
|
|
116201
|
-
const promptRel =
|
|
116538
|
+
const promptRel = path57.relative(cwd, promptPath);
|
|
116202
116539
|
const data2 = {
|
|
116203
116540
|
framework,
|
|
116204
116541
|
routes: routeCount,
|
|
@@ -116208,7 +116545,7 @@ ${error45.stderrTail.slice(-800)}` : "";
|
|
|
116208
116545
|
applied: applied ? { count: applied.applied.length, files: applied.filesChanged } : null,
|
|
116209
116546
|
env_sync: envSync,
|
|
116210
116547
|
package_manager: pm,
|
|
116211
|
-
plan_path:
|
|
116548
|
+
plan_path: path57.relative(cwd, planPath),
|
|
116212
116549
|
prompt_path: promptRel
|
|
116213
116550
|
};
|
|
116214
116551
|
if ("skipped" in envSync && envSync.skipped === "unavailable") {
|
|
@@ -116216,6 +116553,9 @@ ${error45.stderrTail.slice(-800)}` : "";
|
|
|
116216
116553
|
`Could not import your env keys into the project (${envSync.error ?? "unknown"}) \u2014 pages with server-side external fetches may hang in the sandbox. Import manually with npx fimo secrets set / vars set.`
|
|
116217
116554
|
);
|
|
116218
116555
|
}
|
|
116556
|
+
stepTimer.mark(Date.now(), "Finalize", "ok", `${schemaDrafts.length} draft(s)`);
|
|
116557
|
+
const dashboardSteps = stepTimer.steps();
|
|
116558
|
+
const dashboardTotalMs = stepTimer.totalMs(Date.now());
|
|
116219
116559
|
ui.result({
|
|
116220
116560
|
command: "migrate wrap",
|
|
116221
116561
|
data: data2,
|
|
@@ -116223,6 +116563,19 @@ ${error45.stderrTail.slice(-800)}` : "";
|
|
|
116223
116563
|
const p2 = ctx.color ? palette : makeColorPalette({ forceDisable: true });
|
|
116224
116564
|
const rootWiringDone = !wiringStatus || wiringStatus.present || scan.wrappedCount === 0;
|
|
116225
116565
|
const migrationComplete = coverage.wrappable === 0 && !dependencyChanged && rootWiringDone && structuredWorkLeft === 0;
|
|
116566
|
+
const dashboard = renderWrapDashboard({
|
|
116567
|
+
title: "Migration to Fimo \xB7 wrap in place",
|
|
116568
|
+
verdict: migrationComplete ? "complete" : "in progress",
|
|
116569
|
+
steps: dashboardSteps,
|
|
116570
|
+
gates: [
|
|
116571
|
+
{ label: "Coverage", status: coverage.wrappable === 0 ? "ok" : "warn" },
|
|
116572
|
+
{ label: "Wiring", status: rootWiringDone ? "ok" : "warn" }
|
|
116573
|
+
],
|
|
116574
|
+
totalMs: dashboardTotalMs,
|
|
116575
|
+
findings: parityWarnings.slice(0, 5),
|
|
116576
|
+
colors: ctx.color ? { ok: p2.green, warn: p2.yellow, fail: p2.red } : void 0,
|
|
116577
|
+
ascii: ctx.ascii
|
|
116578
|
+
});
|
|
116226
116579
|
const facts = [
|
|
116227
116580
|
["Files scanned", String(scan.filesScanned)],
|
|
116228
116581
|
...migrationComplete ? [] : [["Content to migrate", String(coverage.wrappable)]],
|
|
@@ -116279,13 +116632,19 @@ ${error45.stderrTail.slice(-800)}` : "";
|
|
|
116279
116632
|
`${cmsScaffold.schemas} type(s), ${cmsScaffold.entries} example entr${cmsScaffold.entries === 1 ? "y" : "ies"}${cmsScaffold.locales.length > 0 ? ` (${cmsScaffold.locales.join(", ")})` : ""}${cmsScaffold.skipped > 0 ? `, ${cmsScaffold.skipped} existing` : ""}${cmsScaffold.failures.length > 0 ? `, ${cmsScaffold.failures.length} issue(s)` : ""}`
|
|
116280
116633
|
]
|
|
116281
116634
|
] : [],
|
|
116635
|
+
...cmsWired ? [
|
|
116636
|
+
[
|
|
116637
|
+
`${cmsScaffold?.cms ?? "CMS"} reads`,
|
|
116638
|
+
cmsWired.wired ? "wired to Fimo (whole site reads scaffolded content)" : "not auto-wired (see prompt)"
|
|
116639
|
+
]
|
|
116640
|
+
] : [],
|
|
116282
116641
|
...!("skipped" in envSync) ? [
|
|
116283
116642
|
[
|
|
116284
116643
|
"Env keys",
|
|
116285
116644
|
envSync.imported.length > 0 ? `${envSync.imported.length} imported (${envSync.imported.filter((e) => e.kind === "secret").length} secrets)` : "already synced"
|
|
116286
116645
|
]
|
|
116287
116646
|
] : [],
|
|
116288
|
-
["Migration plan",
|
|
116647
|
+
["Migration plan", path57.relative(cwd, planPath)]
|
|
116289
116648
|
];
|
|
116290
116649
|
const factWidth = Math.max(...facts.map(([label]) => label.length));
|
|
116291
116650
|
const factLines = facts.map(([label, value]) => ` ${p2.dim(label.padEnd(factWidth))} ${p2.cyan(value)}`);
|
|
@@ -116293,6 +116652,8 @@ ${error45.stderrTail.slice(-800)}` : "";
|
|
|
116293
116652
|
const check2 = ctx.ascii ? "[ok]" : "\u2713";
|
|
116294
116653
|
const shipStep = `${p2.cyan("npx fimo deploy")} ${p2.dim("then edit your content live in your Fimo Studio")}`;
|
|
116295
116654
|
return [
|
|
116655
|
+
dashboard,
|
|
116656
|
+
"",
|
|
116296
116657
|
...factLines,
|
|
116297
116658
|
"",
|
|
116298
116659
|
`${p2.green(`${check2} Migration complete!`)} Every piece of content on your site is editable from Fimo.`,
|
|
@@ -116313,6 +116674,8 @@ ${error45.stderrTail.slice(-800)}` : "";
|
|
|
116313
116674
|
const headline = coverage.wrappable > 0 ? `${p2.bold("Your site is connected.")}
|
|
116314
116675
|
The migration will make ${p2.cyan(String(coverage.wrappable))} piece(s) of content editable from Fimo \u2014 the migration plan lists every one (file and line).` : p2.bold("Your site is connected and fully migrated: every scanned piece of content is editable from Fimo.");
|
|
116315
116676
|
return [
|
|
116677
|
+
dashboard,
|
|
116678
|
+
"",
|
|
116316
116679
|
headline,
|
|
116317
116680
|
"",
|
|
116318
116681
|
...factLines,
|
|
@@ -116327,15 +116690,15 @@ The migration will make ${p2.cyan(String(coverage.wrappable))} piece(s) of conte
|
|
|
116327
116690
|
}
|
|
116328
116691
|
__name(migrateWrapCommand, "migrateWrapCommand");
|
|
116329
116692
|
var ANSI_PATTERN2 = /\[[0-9;]*m/g;
|
|
116330
|
-
function
|
|
116693
|
+
function visibleLength2(line) {
|
|
116331
116694
|
return line.replace(ANSI_PATTERN2, "").length;
|
|
116332
116695
|
}
|
|
116333
|
-
__name(
|
|
116696
|
+
__name(visibleLength2, "visibleLength");
|
|
116334
116697
|
function renderStepsBox(steps, ascii, p2, opts = {}) {
|
|
116335
116698
|
const glyphs = ascii ? { tl: "+", tr: "+", bl: "+", br: "+", h: "-", v: "|" } : { tl: "\u256D", tr: "\u256E", bl: "\u2570", br: "\u256F", h: "\u2500", v: "\u2502" };
|
|
116336
116699
|
const title = opts.title ?? "Next steps";
|
|
116337
116700
|
const lines = steps.map((step, index2) => opts.numbered === false ? step : `${index2 + 1}. ${step}`);
|
|
116338
|
-
const innerWidth = Math.max(...lines.map(
|
|
116701
|
+
const innerWidth = Math.max(...lines.map(visibleLength2), title.length + 2) + 4;
|
|
116339
116702
|
const top = p2.dim(`${glyphs.tl}${glyphs.h} `) + p2.bold(title) + p2.dim(` ${glyphs.h.repeat(Math.max(1, innerWidth - title.length - 3))}${glyphs.tr}`);
|
|
116340
116703
|
const bottom = `${glyphs.bl}${glyphs.h.repeat(innerWidth)}${glyphs.br}`;
|
|
116341
116704
|
const empty2 = `${glyphs.v}${" ".repeat(innerWidth)}${glyphs.v}`;
|
|
@@ -116343,7 +116706,7 @@ function renderStepsBox(steps, ascii, p2, opts = {}) {
|
|
|
116343
116706
|
top,
|
|
116344
116707
|
p2.dim(empty2),
|
|
116345
116708
|
...lines.map(
|
|
116346
|
-
(line) => `${p2.dim(glyphs.v)} ${line}${" ".repeat(Math.max(0, innerWidth -
|
|
116709
|
+
(line) => `${p2.dim(glyphs.v)} ${line}${" ".repeat(Math.max(0, innerWidth - visibleLength2(line) - 2))}${p2.dim(glyphs.v)}`
|
|
116347
116710
|
),
|
|
116348
116711
|
p2.dim(empty2),
|
|
116349
116712
|
p2.dim(bottom)
|
|
@@ -116664,8 +117027,8 @@ init_dist();
|
|
|
116664
117027
|
init_api();
|
|
116665
117028
|
init_config2();
|
|
116666
117029
|
init_project();
|
|
116667
|
-
import
|
|
116668
|
-
import
|
|
117030
|
+
import fs53 from "node:fs";
|
|
117031
|
+
import path58 from "node:path";
|
|
116669
117032
|
function registerProjectSecretsCommands(program2) {
|
|
116670
117033
|
const vars = program2.command("vars").description("Manage project variables");
|
|
116671
117034
|
vars.command("list").description("List project variables").option("--project <id>", "Project id (defaults to .fimo.settings.json projectId)").option("-C, --cwd <dir>", "Project directory").action((opts) => listCommand2("variable", opts));
|
|
@@ -116777,10 +117140,10 @@ async function writePulledVars(api, projectRoot, projectId, file2) {
|
|
|
116777
117140
|
const rows = (await api.listProjectSecretEntries(projectId, { kind: "variable" })).filter(
|
|
116778
117141
|
(row2) => row2.exposure === "public"
|
|
116779
117142
|
);
|
|
116780
|
-
const target =
|
|
116781
|
-
const existing =
|
|
117143
|
+
const target = path58.resolve(projectRoot, file2);
|
|
117144
|
+
const existing = fs53.existsSync(target) ? fs53.readFileSync(target, "utf8") : "";
|
|
116782
117145
|
const body = mergeEnvFile(existing, rows);
|
|
116783
|
-
|
|
117146
|
+
fs53.writeFileSync(target, body);
|
|
116784
117147
|
return { path: target, written: rows.length };
|
|
116785
117148
|
}
|
|
116786
117149
|
__name(writePulledVars, "writePulledVars");
|
|
@@ -116848,19 +117211,19 @@ init_auth();
|
|
|
116848
117211
|
init_config2();
|
|
116849
117212
|
init_auth_errors();
|
|
116850
117213
|
init_interactive();
|
|
116851
|
-
import
|
|
116852
|
-
import
|
|
117214
|
+
import fs54 from "node:fs";
|
|
117215
|
+
import path59 from "node:path";
|
|
116853
117216
|
function resolveCwd2(options) {
|
|
116854
|
-
return options.cwd ?
|
|
117217
|
+
return options.cwd ? path59.resolve(options.cwd) : process.cwd();
|
|
116855
117218
|
}
|
|
116856
117219
|
__name(resolveCwd2, "resolveCwd");
|
|
116857
117220
|
function readLocalConfig(options) {
|
|
116858
117221
|
const cwd = resolveCwd2(options);
|
|
116859
|
-
const settingsPath =
|
|
116860
|
-
if (!
|
|
117222
|
+
const settingsPath = path59.join(cwd, ".fimo.settings.json");
|
|
117223
|
+
if (!fs54.existsSync(settingsPath)) {
|
|
116861
117224
|
return null;
|
|
116862
117225
|
}
|
|
116863
|
-
return JSON.parse(
|
|
117226
|
+
return JSON.parse(fs54.readFileSync(settingsPath, "utf-8"));
|
|
116864
117227
|
}
|
|
116865
117228
|
__name(readLocalConfig, "readLocalConfig");
|
|
116866
117229
|
function resolveProjectId5(argv, options, command) {
|
|
@@ -116972,11 +117335,11 @@ async function projectsRenameCommand(nameArg, projectIdArg, options) {
|
|
|
116972
117335
|
});
|
|
116973
117336
|
return;
|
|
116974
117337
|
}
|
|
116975
|
-
const configPath =
|
|
117338
|
+
const configPath = path59.join(cwd, "fimo-config.json");
|
|
116976
117339
|
let config2 = {};
|
|
116977
|
-
if (
|
|
117340
|
+
if (fs54.existsSync(configPath)) {
|
|
116978
117341
|
try {
|
|
116979
|
-
config2 = JSON.parse(
|
|
117342
|
+
config2 = JSON.parse(fs54.readFileSync(configPath, "utf-8"));
|
|
116980
117343
|
} catch (error45) {
|
|
116981
117344
|
ui.error({
|
|
116982
117345
|
command: "projects rename",
|
|
@@ -116988,7 +117351,7 @@ async function projectsRenameCommand(nameArg, projectIdArg, options) {
|
|
|
116988
117351
|
}
|
|
116989
117352
|
const seo = config2.seo ?? {};
|
|
116990
117353
|
config2.seo = { ...seo, siteName: name };
|
|
116991
|
-
|
|
117354
|
+
fs54.writeFileSync(configPath, JSON.stringify(config2, null, 2) + "\n");
|
|
116992
117355
|
ui.ok({
|
|
116993
117356
|
command: "projects rename",
|
|
116994
117357
|
headline: `Renamed to "${name}".`,
|
|
@@ -117208,12 +117571,12 @@ __name(resolveCurrentCliUser, "resolveCurrentCliUser");
|
|
|
117208
117571
|
init_dist();
|
|
117209
117572
|
init_agents();
|
|
117210
117573
|
init_scaffold();
|
|
117211
|
-
import
|
|
117212
|
-
import
|
|
117574
|
+
import fs55 from "node:fs";
|
|
117575
|
+
import path60 from "node:path";
|
|
117213
117576
|
async function rulesSyncCommand(options = {}) {
|
|
117214
|
-
const cwd =
|
|
117215
|
-
const agentsMdPath =
|
|
117216
|
-
if (!
|
|
117577
|
+
const cwd = path60.resolve(options.cwd ?? process.cwd());
|
|
117578
|
+
const agentsMdPath = path60.join(cwd, "AGENTS.md");
|
|
117579
|
+
if (!fs55.existsSync(agentsMdPath)) {
|
|
117217
117580
|
ui.error({
|
|
117218
117581
|
command: "rules sync",
|
|
117219
117582
|
code: "NO_AGENTS_MD",
|
|
@@ -117658,7 +118021,7 @@ init_version();
|
|
|
117658
118021
|
function computeVersionString() {
|
|
117659
118022
|
let pkgVersion = "0.0.0";
|
|
117660
118023
|
try {
|
|
117661
|
-
const pkg = JSON.parse(
|
|
118024
|
+
const pkg = JSON.parse(fs56.readFileSync(path61.join(CLI_ROOT, "package.json"), "utf8"));
|
|
117662
118025
|
if (typeof pkg.version === "string" && pkg.version.length > 0) {
|
|
117663
118026
|
pkgVersion = pkg.version;
|
|
117664
118027
|
}
|
|
@@ -117666,7 +118029,7 @@ function computeVersionString() {
|
|
|
117666
118029
|
}
|
|
117667
118030
|
let releaseId;
|
|
117668
118031
|
try {
|
|
117669
|
-
const release = JSON.parse(
|
|
118032
|
+
const release = JSON.parse(fs56.readFileSync(path61.join(CLI_ROOT, "release.json"), "utf8"));
|
|
117670
118033
|
if (typeof release.id === "string" && release.id.length > 0) {
|
|
117671
118034
|
releaseId = release.id;
|
|
117672
118035
|
}
|
|
@@ -117728,8 +118091,8 @@ var migrate = program.command("migrate").description("Prepare agent-ready migrat
|
|
|
117728
118091
|
(value, prev2 = []) => [...prev2, value]
|
|
117729
118092
|
).option("--mode <mode>", "Project skill install method for newly created projects: symlink | copy").option("--max-pages <n>", "Maximum number of HTML pages to crawl (default 12)").option("--max-assets <n>", "Maximum media assets to download into the migration pack (default 40)").option("--download-media", "Download detected media assets into the migration pack").option("--no-download-media", "Skip downloading detected media assets").option("--route <path>", 'Limit the refinement pack to one route (for example "/contact")').action((url2, dir, options) => {
|
|
117730
118093
|
if (!url2) {
|
|
117731
|
-
const cwd = options.cwd ?
|
|
117732
|
-
if (
|
|
118094
|
+
const cwd = options.cwd ? path61.resolve(options.cwd) : process.cwd();
|
|
118095
|
+
if (fs56.existsSync(path61.join(cwd, "fimo-config.json")) || detectFramework(cwd).framework) {
|
|
117733
118096
|
return migrateWrapCommand({ cwd: options.cwd, apply: options.apply !== false, timeout: options.timeout });
|
|
117734
118097
|
}
|
|
117735
118098
|
migrate.help();
|