contentbit 0.7.2 → 1.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +2134 -350
- package/dist/command-config.d.ts +25 -0
- package/dist/command-config.d.ts.map +1 -0
- package/dist/commands/adopt.d.ts.map +1 -1
- package/dist/commands/brief.d.ts +1 -1
- package/dist/commands/brief.d.ts.map +1 -1
- package/dist/commands/doctor.d.ts +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/init-targets.d.ts.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/links.d.ts +1 -1
- package/dist/commands/links.d.ts.map +1 -1
- package/dist/commands/snapshot.d.ts +12 -0
- package/dist/commands/snapshot.d.ts.map +1 -0
- package/dist/commands/studio.d.ts +1 -1
- package/dist/commands/studio.d.ts.map +1 -1
- package/dist/commands/validate.d.ts +1 -1
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/run.d.ts +1 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +2133 -349
- package/package.json +5 -4
- package/dist/script-defaults.d.ts +0 -14
- package/dist/script-defaults.d.ts.map +0 -1
package/dist/run.js
CHANGED
|
@@ -3189,9 +3189,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3189
3189
|
* @param {string} [path]
|
|
3190
3190
|
* @return {(string|null|Command)}
|
|
3191
3191
|
*/
|
|
3192
|
-
executableDir(
|
|
3193
|
-
if (
|
|
3194
|
-
this._executableDir =
|
|
3192
|
+
executableDir(path4) {
|
|
3193
|
+
if (path4 === void 0) return this._executableDir;
|
|
3194
|
+
this._executableDir = path4;
|
|
3195
3195
|
return this;
|
|
3196
3196
|
}
|
|
3197
3197
|
/**
|
|
@@ -3452,8 +3452,8 @@ function formatDiagnosticForCli(diagnostic, file2) {
|
|
|
3452
3452
|
return lines.join("\n");
|
|
3453
3453
|
}
|
|
3454
3454
|
function displayPath(file2) {
|
|
3455
|
-
const
|
|
3456
|
-
if (
|
|
3455
|
+
const path4 = relative(process.cwd(), file2);
|
|
3456
|
+
if (path4 && !path4.startsWith("..") && !isAbsolute(path4)) return path4;
|
|
3457
3457
|
return file2;
|
|
3458
3458
|
}
|
|
3459
3459
|
function severityLabel(severity) {
|
|
@@ -3485,6 +3485,15 @@ var init_cli_format = __esm({
|
|
|
3485
3485
|
}
|
|
3486
3486
|
});
|
|
3487
3487
|
|
|
3488
|
+
// ../core/dist/version.js
|
|
3489
|
+
var VERSION;
|
|
3490
|
+
var init_version = __esm({
|
|
3491
|
+
"../core/dist/version.js"() {
|
|
3492
|
+
"use strict";
|
|
3493
|
+
VERSION = "1.0.0-rc.0";
|
|
3494
|
+
}
|
|
3495
|
+
});
|
|
3496
|
+
|
|
3488
3497
|
// ../core/dist/props.js
|
|
3489
3498
|
function parseProps(raw, position, rawStart = position.start) {
|
|
3490
3499
|
const props = {};
|
|
@@ -4339,7 +4348,8 @@ function validateDocument(parsed, registry2, options = {}) {
|
|
|
4339
4348
|
position: node.openPosition
|
|
4340
4349
|
});
|
|
4341
4350
|
}
|
|
4342
|
-
|
|
4351
|
+
const knownPropsValid = reportUnknownProps(node, def, report);
|
|
4352
|
+
if (!knownPropsValid)
|
|
4343
4353
|
valid = false;
|
|
4344
4354
|
if (def.props) {
|
|
4345
4355
|
const result = def.props.safeParse(node.props);
|
|
@@ -4348,8 +4358,9 @@ function validateDocument(parsed, registry2, options = {}) {
|
|
|
4348
4358
|
} else {
|
|
4349
4359
|
valid = false;
|
|
4350
4360
|
for (const issue2 of result.error.issues) {
|
|
4351
|
-
if (issue2.code === "unrecognized_keys")
|
|
4361
|
+
if (issue2.code === "unrecognized_keys" && issue2.path.length === 0 && !knownPropsValid) {
|
|
4352
4362
|
continue;
|
|
4363
|
+
}
|
|
4353
4364
|
const prop = typeof issue2.path[0] === "string" && issue2.path[0].length > 0 ? issue2.path[0] : void 0;
|
|
4354
4365
|
report({
|
|
4355
4366
|
code: "CB_PROPS_INVALID",
|
|
@@ -4737,10 +4748,10 @@ function mergeDefs(...defs) {
|
|
|
4737
4748
|
function cloneDef(schema) {
|
|
4738
4749
|
return mergeDefs(schema._zod.def);
|
|
4739
4750
|
}
|
|
4740
|
-
function getElementAtPath(obj,
|
|
4741
|
-
if (!
|
|
4751
|
+
function getElementAtPath(obj, path4) {
|
|
4752
|
+
if (!path4)
|
|
4742
4753
|
return obj;
|
|
4743
|
-
return
|
|
4754
|
+
return path4.reduce((acc, key) => acc?.[key], obj);
|
|
4744
4755
|
}
|
|
4745
4756
|
function promiseAllObject(promisesObj) {
|
|
4746
4757
|
const keys = Object.keys(promisesObj);
|
|
@@ -5068,11 +5079,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
5068
5079
|
}
|
|
5069
5080
|
return false;
|
|
5070
5081
|
}
|
|
5071
|
-
function prefixIssues(
|
|
5082
|
+
function prefixIssues(path4, issues) {
|
|
5072
5083
|
return issues.map((iss) => {
|
|
5073
5084
|
var _a3;
|
|
5074
5085
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
5075
|
-
iss.path.unshift(
|
|
5086
|
+
iss.path.unshift(path4);
|
|
5076
5087
|
return iss;
|
|
5077
5088
|
});
|
|
5078
5089
|
}
|
|
@@ -5289,16 +5300,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
5289
5300
|
}
|
|
5290
5301
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
5291
5302
|
const fieldErrors = { _errors: [] };
|
|
5292
|
-
const processError = (error52,
|
|
5303
|
+
const processError = (error52, path4 = []) => {
|
|
5293
5304
|
for (const issue2 of error52.issues) {
|
|
5294
5305
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
5295
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
5306
|
+
issue2.errors.map((issues) => processError({ issues }, [...path4, ...issue2.path]));
|
|
5296
5307
|
} else if (issue2.code === "invalid_key") {
|
|
5297
|
-
processError({ issues: issue2.issues }, [...
|
|
5308
|
+
processError({ issues: issue2.issues }, [...path4, ...issue2.path]);
|
|
5298
5309
|
} else if (issue2.code === "invalid_element") {
|
|
5299
|
-
processError({ issues: issue2.issues }, [...
|
|
5310
|
+
processError({ issues: issue2.issues }, [...path4, ...issue2.path]);
|
|
5300
5311
|
} else {
|
|
5301
|
-
const fullpath = [...
|
|
5312
|
+
const fullpath = [...path4, ...issue2.path];
|
|
5302
5313
|
if (fullpath.length === 0) {
|
|
5303
5314
|
fieldErrors._errors.push(mapper(issue2));
|
|
5304
5315
|
} else {
|
|
@@ -5325,17 +5336,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
5325
5336
|
}
|
|
5326
5337
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
5327
5338
|
const result = { errors: [] };
|
|
5328
|
-
const processError = (error52,
|
|
5339
|
+
const processError = (error52, path4 = []) => {
|
|
5329
5340
|
var _a3, _b;
|
|
5330
5341
|
for (const issue2 of error52.issues) {
|
|
5331
5342
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
5332
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
5343
|
+
issue2.errors.map((issues) => processError({ issues }, [...path4, ...issue2.path]));
|
|
5333
5344
|
} else if (issue2.code === "invalid_key") {
|
|
5334
|
-
processError({ issues: issue2.issues }, [...
|
|
5345
|
+
processError({ issues: issue2.issues }, [...path4, ...issue2.path]);
|
|
5335
5346
|
} else if (issue2.code === "invalid_element") {
|
|
5336
|
-
processError({ issues: issue2.issues }, [...
|
|
5347
|
+
processError({ issues: issue2.issues }, [...path4, ...issue2.path]);
|
|
5337
5348
|
} else {
|
|
5338
|
-
const fullpath = [...
|
|
5349
|
+
const fullpath = [...path4, ...issue2.path];
|
|
5339
5350
|
if (fullpath.length === 0) {
|
|
5340
5351
|
result.errors.push(mapper(issue2));
|
|
5341
5352
|
continue;
|
|
@@ -5367,8 +5378,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
5367
5378
|
}
|
|
5368
5379
|
function toDotPath(_path) {
|
|
5369
5380
|
const segs = [];
|
|
5370
|
-
const
|
|
5371
|
-
for (const seg of
|
|
5381
|
+
const path4 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
5382
|
+
for (const seg of path4) {
|
|
5372
5383
|
if (typeof seg === "number")
|
|
5373
5384
|
segs.push(`[${seg}]`);
|
|
5374
5385
|
else if (typeof seg === "symbol")
|
|
@@ -15785,13 +15796,13 @@ function _stringbool(Classes, _params) {
|
|
|
15785
15796
|
return codec2;
|
|
15786
15797
|
}
|
|
15787
15798
|
// @__NO_SIDE_EFFECTS__
|
|
15788
|
-
function _stringFormat(Class2,
|
|
15799
|
+
function _stringFormat(Class2, format2, fnOrRegex, _params = {}) {
|
|
15789
15800
|
const params = normalizeParams(_params);
|
|
15790
15801
|
const def = {
|
|
15791
15802
|
...normalizeParams(_params),
|
|
15792
15803
|
check: "string_format",
|
|
15793
15804
|
type: "string",
|
|
15794
|
-
format,
|
|
15805
|
+
format: format2,
|
|
15795
15806
|
fn: typeof fnOrRegex === "function" ? fnOrRegex : (val) => fnOrRegex.test(val),
|
|
15796
15807
|
...params
|
|
15797
15808
|
};
|
|
@@ -16234,16 +16245,16 @@ var init_json_schema_processors = __esm({
|
|
|
16234
16245
|
stringProcessor = (schema, ctx, _json, _params) => {
|
|
16235
16246
|
const json2 = _json;
|
|
16236
16247
|
json2.type = "string";
|
|
16237
|
-
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
16248
|
+
const { minimum, maximum, format: format2, patterns, contentEncoding } = schema._zod.bag;
|
|
16238
16249
|
if (typeof minimum === "number")
|
|
16239
16250
|
json2.minLength = minimum;
|
|
16240
16251
|
if (typeof maximum === "number")
|
|
16241
16252
|
json2.maxLength = maximum;
|
|
16242
|
-
if (
|
|
16243
|
-
json2.format = formatMap[
|
|
16253
|
+
if (format2) {
|
|
16254
|
+
json2.format = formatMap[format2] ?? format2;
|
|
16244
16255
|
if (json2.format === "")
|
|
16245
16256
|
delete json2.format;
|
|
16246
|
-
if (
|
|
16257
|
+
if (format2 === "time") {
|
|
16247
16258
|
delete json2.format;
|
|
16248
16259
|
}
|
|
16249
16260
|
}
|
|
@@ -16265,8 +16276,8 @@ var init_json_schema_processors = __esm({
|
|
|
16265
16276
|
};
|
|
16266
16277
|
numberProcessor = (schema, ctx, _json, _params) => {
|
|
16267
16278
|
const json2 = _json;
|
|
16268
|
-
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
16269
|
-
if (typeof
|
|
16279
|
+
const { minimum, maximum, format: format2, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
16280
|
+
if (typeof format2 === "string" && format2.includes("int"))
|
|
16270
16281
|
json2.type = "integer";
|
|
16271
16282
|
else
|
|
16272
16283
|
json2.type = "number";
|
|
@@ -17563,8 +17574,8 @@ function e1642(params) {
|
|
|
17563
17574
|
function jwt(params) {
|
|
17564
17575
|
return _jwt(ZodJWT, params);
|
|
17565
17576
|
}
|
|
17566
|
-
function stringFormat(
|
|
17567
|
-
return _stringFormat(ZodCustomStringFormat,
|
|
17577
|
+
function stringFormat(format2, fnOrRegex, _params = {}) {
|
|
17578
|
+
return _stringFormat(ZodCustomStringFormat, format2, fnOrRegex, _params);
|
|
17568
17579
|
}
|
|
17569
17580
|
function hostname2(_params) {
|
|
17570
17581
|
return _stringFormat(ZodCustomStringFormat, "hostname", regexes_exports.hostname, _params);
|
|
@@ -17574,11 +17585,11 @@ function hex2(_params) {
|
|
|
17574
17585
|
}
|
|
17575
17586
|
function hash(alg, params) {
|
|
17576
17587
|
const enc = params?.enc ?? "hex";
|
|
17577
|
-
const
|
|
17578
|
-
const regex = regexes_exports[
|
|
17588
|
+
const format2 = `${alg}_${enc}`;
|
|
17589
|
+
const regex = regexes_exports[format2];
|
|
17579
17590
|
if (!regex)
|
|
17580
|
-
throw new Error(`Unrecognized hash format: ${
|
|
17581
|
-
return _stringFormat(ZodCustomStringFormat,
|
|
17591
|
+
throw new Error(`Unrecognized hash format: ${format2}`);
|
|
17592
|
+
return _stringFormat(ZodCustomStringFormat, format2, regex, params);
|
|
17582
17593
|
}
|
|
17583
17594
|
function number2(params) {
|
|
17584
17595
|
return _number(ZodNumber, params);
|
|
@@ -18798,13 +18809,13 @@ function resolveRef(ref, ctx) {
|
|
|
18798
18809
|
if (!ref.startsWith("#")) {
|
|
18799
18810
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
18800
18811
|
}
|
|
18801
|
-
const
|
|
18802
|
-
if (
|
|
18812
|
+
const path4 = ref.slice(1).split("/").filter(Boolean);
|
|
18813
|
+
if (path4.length === 0) {
|
|
18803
18814
|
return ctx.rootSchema;
|
|
18804
18815
|
}
|
|
18805
18816
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
18806
|
-
if (
|
|
18807
|
-
const key =
|
|
18817
|
+
if (path4[0] === defsKey) {
|
|
18818
|
+
const key = path4[1];
|
|
18808
18819
|
if (!key || !ctx.defs[key]) {
|
|
18809
18820
|
throw new Error(`Reference not found: ${ref}`);
|
|
18810
18821
|
}
|
|
@@ -18896,52 +18907,52 @@ function convertBaseSchema(schema, ctx) {
|
|
|
18896
18907
|
case "string": {
|
|
18897
18908
|
let stringSchema = z.string();
|
|
18898
18909
|
if (schema.format) {
|
|
18899
|
-
const
|
|
18900
|
-
if (
|
|
18910
|
+
const format2 = schema.format;
|
|
18911
|
+
if (format2 === "email") {
|
|
18901
18912
|
stringSchema = stringSchema.check(z.email());
|
|
18902
|
-
} else if (
|
|
18913
|
+
} else if (format2 === "uri" || format2 === "uri-reference") {
|
|
18903
18914
|
stringSchema = stringSchema.check(z.url());
|
|
18904
|
-
} else if (
|
|
18915
|
+
} else if (format2 === "uuid" || format2 === "guid") {
|
|
18905
18916
|
stringSchema = stringSchema.check(z.uuid());
|
|
18906
|
-
} else if (
|
|
18917
|
+
} else if (format2 === "date-time") {
|
|
18907
18918
|
stringSchema = stringSchema.check(z.iso.datetime());
|
|
18908
|
-
} else if (
|
|
18919
|
+
} else if (format2 === "date") {
|
|
18909
18920
|
stringSchema = stringSchema.check(z.iso.date());
|
|
18910
|
-
} else if (
|
|
18921
|
+
} else if (format2 === "time") {
|
|
18911
18922
|
stringSchema = stringSchema.check(z.iso.time());
|
|
18912
|
-
} else if (
|
|
18923
|
+
} else if (format2 === "duration") {
|
|
18913
18924
|
stringSchema = stringSchema.check(z.iso.duration());
|
|
18914
|
-
} else if (
|
|
18925
|
+
} else if (format2 === "ipv4") {
|
|
18915
18926
|
stringSchema = stringSchema.check(z.ipv4());
|
|
18916
|
-
} else if (
|
|
18927
|
+
} else if (format2 === "ipv6") {
|
|
18917
18928
|
stringSchema = stringSchema.check(z.ipv6());
|
|
18918
|
-
} else if (
|
|
18929
|
+
} else if (format2 === "mac") {
|
|
18919
18930
|
stringSchema = stringSchema.check(z.mac());
|
|
18920
|
-
} else if (
|
|
18931
|
+
} else if (format2 === "cidr") {
|
|
18921
18932
|
stringSchema = stringSchema.check(z.cidrv4());
|
|
18922
|
-
} else if (
|
|
18933
|
+
} else if (format2 === "cidr-v6") {
|
|
18923
18934
|
stringSchema = stringSchema.check(z.cidrv6());
|
|
18924
|
-
} else if (
|
|
18935
|
+
} else if (format2 === "base64") {
|
|
18925
18936
|
stringSchema = stringSchema.check(z.base64());
|
|
18926
|
-
} else if (
|
|
18937
|
+
} else if (format2 === "base64url") {
|
|
18927
18938
|
stringSchema = stringSchema.check(z.base64url());
|
|
18928
|
-
} else if (
|
|
18939
|
+
} else if (format2 === "e164") {
|
|
18929
18940
|
stringSchema = stringSchema.check(z.e164());
|
|
18930
|
-
} else if (
|
|
18941
|
+
} else if (format2 === "jwt") {
|
|
18931
18942
|
stringSchema = stringSchema.check(z.jwt());
|
|
18932
|
-
} else if (
|
|
18943
|
+
} else if (format2 === "emoji") {
|
|
18933
18944
|
stringSchema = stringSchema.check(z.emoji());
|
|
18934
|
-
} else if (
|
|
18945
|
+
} else if (format2 === "nanoid") {
|
|
18935
18946
|
stringSchema = stringSchema.check(z.nanoid());
|
|
18936
|
-
} else if (
|
|
18947
|
+
} else if (format2 === "cuid") {
|
|
18937
18948
|
stringSchema = stringSchema.check(z.cuid());
|
|
18938
|
-
} else if (
|
|
18949
|
+
} else if (format2 === "cuid2") {
|
|
18939
18950
|
stringSchema = stringSchema.check(z.cuid2());
|
|
18940
|
-
} else if (
|
|
18951
|
+
} else if (format2 === "ulid") {
|
|
18941
18952
|
stringSchema = stringSchema.check(z.ulid());
|
|
18942
|
-
} else if (
|
|
18953
|
+
} else if (format2 === "xid") {
|
|
18943
18954
|
stringSchema = stringSchema.check(z.xid());
|
|
18944
|
-
} else if (
|
|
18955
|
+
} else if (format2 === "ksuid") {
|
|
18945
18956
|
stringSchema = stringSchema.check(z.ksuid());
|
|
18946
18957
|
}
|
|
18947
18958
|
}
|
|
@@ -19650,7 +19661,7 @@ function buildLinkIndex(inputs, options = {}) {
|
|
|
19650
19661
|
const pages = /* @__PURE__ */ new Map();
|
|
19651
19662
|
const aliases = /* @__PURE__ */ new Map();
|
|
19652
19663
|
const aliasEntries = [];
|
|
19653
|
-
for (const { path:
|
|
19664
|
+
for (const { path: path4, data } of inputs) {
|
|
19654
19665
|
const parsed = parseLinkFrontmatter(data, resolvedOptions);
|
|
19655
19666
|
if (!parsed.ok || parsed.value === null)
|
|
19656
19667
|
continue;
|
|
@@ -19659,7 +19670,7 @@ function buildLinkIndex(inputs, options = {}) {
|
|
|
19659
19670
|
slug: fm.slug,
|
|
19660
19671
|
key: fm.key,
|
|
19661
19672
|
locale: effectiveLocale(fm, resolvedOptions),
|
|
19662
|
-
path:
|
|
19673
|
+
path: path4,
|
|
19663
19674
|
title: fm.title,
|
|
19664
19675
|
keywords: fm.keywords,
|
|
19665
19676
|
linksTo: [],
|
|
@@ -19750,41 +19761,41 @@ function validateLinks(inputs, options = {}) {
|
|
|
19750
19761
|
const seenSlug = /* @__PURE__ */ new Map();
|
|
19751
19762
|
const seenKey = /* @__PURE__ */ new Map();
|
|
19752
19763
|
const seenAlias = /* @__PURE__ */ new Map();
|
|
19753
|
-
for (const { path:
|
|
19764
|
+
for (const { path: path4, data } of inputs) {
|
|
19754
19765
|
const parsed = parseLinkFrontmatter(data, resolvedOptions);
|
|
19755
19766
|
if (!parsed.ok) {
|
|
19756
19767
|
for (const e of parsed.errors)
|
|
19757
|
-
out.push(diag(
|
|
19768
|
+
out.push(diag(path4, "CB_LINK_SHAPE", "error", `invalid link frontmatter: ${e}`));
|
|
19758
19769
|
continue;
|
|
19759
19770
|
}
|
|
19760
19771
|
if (parsed.value === null)
|
|
19761
19772
|
continue;
|
|
19762
19773
|
const fm = parsed.value;
|
|
19763
19774
|
const locale = effectiveLocale(fm, resolvedOptions);
|
|
19764
|
-
validInputs.push({ path:
|
|
19775
|
+
validInputs.push({ path: path4, fm });
|
|
19765
19776
|
const slugKey = scopedKey(fm.slug, locale, resolvedOptions);
|
|
19766
19777
|
const prior = seenSlug.get(slugKey);
|
|
19767
19778
|
if (prior)
|
|
19768
|
-
out.push(diag(
|
|
19779
|
+
out.push(diag(path4, "CB_SLUG_DUPLICATE", "error", `slug "${fm.slug}" also used by ${prior}`));
|
|
19769
19780
|
else
|
|
19770
|
-
seenSlug.set(slugKey,
|
|
19781
|
+
seenSlug.set(slugKey, path4);
|
|
19771
19782
|
if (usesKeyResolution(resolvedOptions) && !fm.key) {
|
|
19772
|
-
out.push(diag(
|
|
19783
|
+
out.push(diag(path4, "CB_KEY_MISSING", "error", `page "${fm.slug}" is missing key`));
|
|
19773
19784
|
}
|
|
19774
19785
|
if (fm.key) {
|
|
19775
19786
|
const keyKey = scopedKey(fm.key, locale, resolvedOptions);
|
|
19776
19787
|
const priorKey = seenKey.get(keyKey);
|
|
19777
19788
|
if (priorKey)
|
|
19778
|
-
out.push(diag(
|
|
19789
|
+
out.push(diag(path4, "CB_KEY_DUPLICATE", "error", `key "${fm.key}" also used by ${priorKey}`));
|
|
19779
19790
|
else
|
|
19780
|
-
seenKey.set(keyKey,
|
|
19791
|
+
seenKey.set(keyKey, path4);
|
|
19781
19792
|
}
|
|
19782
19793
|
for (const alias of fm.aliases ?? []) {
|
|
19783
19794
|
const aliasKey = scopedKey(alias, locale, resolvedOptions);
|
|
19784
19795
|
if (seenAlias.has(aliasKey))
|
|
19785
|
-
out.push(diag(
|
|
19796
|
+
out.push(diag(path4, "CB_ALIAS_CONFLICT", "error", `alias "${alias}" already declared by ${seenAlias.get(aliasKey)}`));
|
|
19786
19797
|
else
|
|
19787
|
-
seenAlias.set(aliasKey,
|
|
19798
|
+
seenAlias.set(aliasKey, path4);
|
|
19788
19799
|
}
|
|
19789
19800
|
}
|
|
19790
19801
|
const ambiguousPageKeys = ambiguousValidationPageKeys(validInputs, resolvedOptions);
|
|
@@ -20312,9 +20323,9 @@ function pageToFrontmatter(page) {
|
|
|
20312
20323
|
function stringArray2(value) {
|
|
20313
20324
|
return Array.isArray(value) && value.every((item) => typeof item === "string") ? value : void 0;
|
|
20314
20325
|
}
|
|
20315
|
-
function getPath(record2,
|
|
20326
|
+
function getPath(record2, path4) {
|
|
20316
20327
|
let current = record2;
|
|
20317
|
-
for (const part of
|
|
20328
|
+
for (const part of path4.split(".")) {
|
|
20318
20329
|
if (!current || typeof current !== "object")
|
|
20319
20330
|
return void 0;
|
|
20320
20331
|
current = current[part];
|
|
@@ -20360,8 +20371,8 @@ function findPlannedByPath(byId, filePath) {
|
|
|
20360
20371
|
function pathMatches(configId, filePath) {
|
|
20361
20372
|
return filePath === configId || filePath.endsWith(`/${configId}`);
|
|
20362
20373
|
}
|
|
20363
|
-
function normalizePath(
|
|
20364
|
-
return
|
|
20374
|
+
function normalizePath(path4) {
|
|
20375
|
+
return path4.replaceAll("\\", "/").replace(/^\.\/+/, "");
|
|
20365
20376
|
}
|
|
20366
20377
|
function seoPageId(facts, identity) {
|
|
20367
20378
|
return facts.locale ? `${identity}:${facts.locale}` : identity;
|
|
@@ -20627,14 +20638,15 @@ function resolveContentLink(url2, sourcePath, byRoute) {
|
|
|
20627
20638
|
if (rawPath === "") {
|
|
20628
20639
|
return { path: normalizePath2(sourcePath), ...anchor ? { anchor } : {}, kind: "markdown" };
|
|
20629
20640
|
}
|
|
20630
|
-
|
|
20641
|
+
const decodedPath = decodeUriComponent(rawPath);
|
|
20642
|
+
if (isRelativeMarkdownPath(decodedPath)) {
|
|
20631
20643
|
return {
|
|
20632
|
-
path: joinPath(dirname(sourcePath),
|
|
20644
|
+
path: joinPath(dirname(sourcePath), decodedPath),
|
|
20633
20645
|
...anchor ? { anchor } : {},
|
|
20634
20646
|
kind: "markdown"
|
|
20635
20647
|
};
|
|
20636
20648
|
}
|
|
20637
|
-
if (hasFileExtension(
|
|
20649
|
+
if (hasFileExtension(decodedPath))
|
|
20638
20650
|
return void 0;
|
|
20639
20651
|
const destination = routeTarget(rawPath, byRoute);
|
|
20640
20652
|
return {
|
|
@@ -20644,7 +20656,7 @@ function resolveContentLink(url2, sourcePath, byRoute) {
|
|
|
20644
20656
|
};
|
|
20645
20657
|
}
|
|
20646
20658
|
function isRelativeMarkdownPath(value) {
|
|
20647
|
-
return
|
|
20659
|
+
return /\.mdx?$/i.test(value);
|
|
20648
20660
|
}
|
|
20649
20661
|
function hasFileExtension(value) {
|
|
20650
20662
|
return /\/[^/]+\.[a-z\d]+$/i.test(`/${value}`);
|
|
@@ -20693,8 +20705,8 @@ function normalizedFrontmatterString(value) {
|
|
|
20693
20705
|
const normalized = value.trim().replace(/\s+/g, " ").toLocaleLowerCase();
|
|
20694
20706
|
return normalized || void 0;
|
|
20695
20707
|
}
|
|
20696
|
-
function dirname(
|
|
20697
|
-
const normalized = normalizePath2(
|
|
20708
|
+
function dirname(path4) {
|
|
20709
|
+
const normalized = normalizePath2(path4);
|
|
20698
20710
|
const index = normalized.lastIndexOf("/");
|
|
20699
20711
|
return index <= 0 ? normalized.startsWith("/") ? "/" : "" : normalized.slice(0, index);
|
|
20700
20712
|
}
|
|
@@ -20712,8 +20724,8 @@ function joinPath(base, target) {
|
|
|
20712
20724
|
}
|
|
20713
20725
|
return `${absolute || base.startsWith("/") ? "/" : ""}${normalized.join("/")}`;
|
|
20714
20726
|
}
|
|
20715
|
-
function normalizePath2(
|
|
20716
|
-
return joinPath("",
|
|
20727
|
+
function normalizePath2(path4) {
|
|
20728
|
+
return joinPath("", path4.replaceAll("\\", "/"));
|
|
20717
20729
|
}
|
|
20718
20730
|
function decodeUriComponent(value) {
|
|
20719
20731
|
try {
|
|
@@ -20912,6 +20924,205 @@ var init_project_scan = __esm({
|
|
|
20912
20924
|
}
|
|
20913
20925
|
});
|
|
20914
20926
|
|
|
20927
|
+
// ../core/dist/page-discovery.js
|
|
20928
|
+
function discoverContentPageFacts(input, options = {}) {
|
|
20929
|
+
const authored = readContentPageFacts(input.frontmatter, options);
|
|
20930
|
+
const key = stringFact(authored, "key", configuredSource(input.frontmatter, "key", options.keyField));
|
|
20931
|
+
const authoredSlug = stringFact(authored, "slug", configuredSource(input.frontmatter, "slug", options.slugField));
|
|
20932
|
+
const slug = authoredSlug ?? pathSlugFact(input.path);
|
|
20933
|
+
const title = stringFact(authored, "title", "frontmatter") ?? headingTitleFact(input.stats) ?? pathTitleFact(input.path);
|
|
20934
|
+
return {
|
|
20935
|
+
identity: key ?? authoredSlug ?? exactPathFact(input.path),
|
|
20936
|
+
title,
|
|
20937
|
+
slug,
|
|
20938
|
+
...key ? { key } : {},
|
|
20939
|
+
...optionalStringFact(authored, input.frontmatter, options, "locale"),
|
|
20940
|
+
...optionalStringFact(authored, input.frontmatter, options, "description"),
|
|
20941
|
+
...optionalStringFact(authored, input.frontmatter, options, "type"),
|
|
20942
|
+
...optionalStringFact(authored, input.frontmatter, options, "intent"),
|
|
20943
|
+
...authored.keywords ? { keywords: exactFact(authored.keywords, "frontmatter") } : {},
|
|
20944
|
+
...authored.linksTo ? { linksTo: exactFact(authored.linksTo, "frontmatter") } : {}
|
|
20945
|
+
};
|
|
20946
|
+
}
|
|
20947
|
+
function optionalStringFact(facts, frontmatter, options, field) {
|
|
20948
|
+
const configured = field === "locale" ? options.localeField : void 0;
|
|
20949
|
+
const fact = stringFact(facts, field, configuredSource(frontmatter, field, configured));
|
|
20950
|
+
return fact ? { [field]: fact } : {};
|
|
20951
|
+
}
|
|
20952
|
+
function stringFact(facts, field, source) {
|
|
20953
|
+
const value = facts[field];
|
|
20954
|
+
return typeof value === "string" ? exactFact(value, source) : void 0;
|
|
20955
|
+
}
|
|
20956
|
+
function exactFact(value, source) {
|
|
20957
|
+
return { value, source, confidence: "exact" };
|
|
20958
|
+
}
|
|
20959
|
+
function exactPathFact(value) {
|
|
20960
|
+
return { value, source: "path", confidence: "exact" };
|
|
20961
|
+
}
|
|
20962
|
+
function headingTitleFact(stats) {
|
|
20963
|
+
const heading = stats.outline.find((entry) => entry.level === 1);
|
|
20964
|
+
return heading ? { value: heading.text, source: "document", confidence: "likely" } : void 0;
|
|
20965
|
+
}
|
|
20966
|
+
function pathSlugFact(path4) {
|
|
20967
|
+
return { value: slugFromPath(path4), source: "path", confidence: "guess" };
|
|
20968
|
+
}
|
|
20969
|
+
function pathTitleFact(path4) {
|
|
20970
|
+
return { value: titleFromPath(path4), source: "path", confidence: "guess" };
|
|
20971
|
+
}
|
|
20972
|
+
function configuredSource(frontmatter, canonical, configured) {
|
|
20973
|
+
if (!(canonical in frontmatter) && configured && configured in frontmatter)
|
|
20974
|
+
return "config";
|
|
20975
|
+
return "frontmatter";
|
|
20976
|
+
}
|
|
20977
|
+
function slugFromPath(path4) {
|
|
20978
|
+
return filenameFromPath(path4).toLocaleLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/[^\p{L}\p{N}]+/gu, "-").replace(/^-+|-+$/g, "");
|
|
20979
|
+
}
|
|
20980
|
+
function titleFromPath(path4) {
|
|
20981
|
+
return filenameFromPath(path4).replace(/[-_]+/g, " ").replace(/\b\p{L}/gu, (letter) => letter.toUpperCase());
|
|
20982
|
+
}
|
|
20983
|
+
function filenameFromPath(path4) {
|
|
20984
|
+
return path4.slice(Math.max(path4.lastIndexOf("/"), path4.lastIndexOf("\\")) + 1).replace(/\.mdx?$/i, "");
|
|
20985
|
+
}
|
|
20986
|
+
var init_page_discovery = __esm({
|
|
20987
|
+
"../core/dist/page-discovery.js"() {
|
|
20988
|
+
"use strict";
|
|
20989
|
+
init_page_facts();
|
|
20990
|
+
}
|
|
20991
|
+
});
|
|
20992
|
+
|
|
20993
|
+
// ../core/dist/project-discovery.js
|
|
20994
|
+
function discoverContentProject(files, options = {}) {
|
|
20995
|
+
const { root, ...linkOptions } = options;
|
|
20996
|
+
const pages = files.map((file2) => {
|
|
20997
|
+
const path4 = projectRelativePath(file2.path, root);
|
|
20998
|
+
const discovered = discoverContentPageFacts(file2, linkOptions);
|
|
20999
|
+
const facts = {
|
|
21000
|
+
...discovered,
|
|
21001
|
+
identity: discovered.identity.source === "path" ? { ...discovered.identity, value: path4 } : discovered.identity,
|
|
21002
|
+
...discovered.type ? { family: { ...discovered.type } } : {}
|
|
21003
|
+
};
|
|
21004
|
+
return { sourcePath: file2.path, path: path4, facts };
|
|
21005
|
+
});
|
|
21006
|
+
const inferablePages = pages.filter((page) => isProjectRelativePath(page.path));
|
|
21007
|
+
inferPathLocales(inferablePages);
|
|
21008
|
+
inferPathFamilies(inferablePages);
|
|
21009
|
+
return {
|
|
21010
|
+
pages,
|
|
21011
|
+
families: summarizeFacts(pages, "family"),
|
|
21012
|
+
locales: summarizeFacts(pages, "locale")
|
|
21013
|
+
};
|
|
21014
|
+
}
|
|
21015
|
+
function inferPathLocales(pages) {
|
|
21016
|
+
const candidates = /* @__PURE__ */ new Map();
|
|
21017
|
+
for (const page of pages) {
|
|
21018
|
+
const segments = pathSegments(page.path);
|
|
21019
|
+
for (let position = 0; position < segments.length - 1; position++) {
|
|
21020
|
+
const locale = segments[position];
|
|
21021
|
+
if (!isLocaleCandidate(locale))
|
|
21022
|
+
continue;
|
|
21023
|
+
const tail = segments.slice(position + 1).join("/");
|
|
21024
|
+
const key = `${position}\0${tail}`;
|
|
21025
|
+
const entry = candidates.get(key) ?? { position, locales: /* @__PURE__ */ new Set() };
|
|
21026
|
+
entry.locales.add(locale);
|
|
21027
|
+
candidates.set(key, entry);
|
|
21028
|
+
}
|
|
21029
|
+
}
|
|
21030
|
+
const supportedPositions = /* @__PURE__ */ new Map();
|
|
21031
|
+
for (const candidate of candidates.values()) {
|
|
21032
|
+
if (candidate.locales.size < 2)
|
|
21033
|
+
continue;
|
|
21034
|
+
supportedPositions.set(candidate.position, (supportedPositions.get(candidate.position) ?? 0) + 1);
|
|
21035
|
+
}
|
|
21036
|
+
const localePositions = new Set([...supportedPositions].filter(([, siblings]) => siblings >= MIN_LOCALE_SIBLINGS).map(([position]) => position));
|
|
21037
|
+
if (localePositions.size === 0)
|
|
21038
|
+
return;
|
|
21039
|
+
const localeGroups = new Set([...candidates].filter(([, candidate]) => candidate.locales.size >= 2 && localePositions.has(candidate.position)).map(([key]) => key));
|
|
21040
|
+
for (const page of pages) {
|
|
21041
|
+
if (page.facts.locale)
|
|
21042
|
+
continue;
|
|
21043
|
+
const segments = pathSegments(page.path);
|
|
21044
|
+
const position = [...localePositions].find((candidate) => {
|
|
21045
|
+
const locale = segments[candidate];
|
|
21046
|
+
if (!isLocaleCandidate(locale))
|
|
21047
|
+
return false;
|
|
21048
|
+
const tail = segments.slice(candidate + 1).join("/");
|
|
21049
|
+
return localeGroups.has(`${candidate}\0${tail}`);
|
|
21050
|
+
});
|
|
21051
|
+
if (position === void 0)
|
|
21052
|
+
continue;
|
|
21053
|
+
page.facts.locale = pathFact(segments[position]);
|
|
21054
|
+
}
|
|
21055
|
+
}
|
|
21056
|
+
function inferPathFamilies(pages) {
|
|
21057
|
+
const candidates = /* @__PURE__ */ new Map();
|
|
21058
|
+
const candidateByPath = /* @__PURE__ */ new Map();
|
|
21059
|
+
for (const page of pages) {
|
|
21060
|
+
if (page.facts.family)
|
|
21061
|
+
continue;
|
|
21062
|
+
const locale = page.facts.locale?.value.toLocaleLowerCase();
|
|
21063
|
+
const candidate = pathSegments(page.path).slice(0, -1).find((segment) => !FAMILY_WRAPPERS.has(segment.toLocaleLowerCase()) && segment.toLocaleLowerCase() !== locale);
|
|
21064
|
+
if (!candidate)
|
|
21065
|
+
continue;
|
|
21066
|
+
candidateByPath.set(page.path, candidate);
|
|
21067
|
+
candidates.set(candidate, (candidates.get(candidate) ?? 0) + 1);
|
|
21068
|
+
}
|
|
21069
|
+
for (const page of pages) {
|
|
21070
|
+
if (page.facts.family)
|
|
21071
|
+
continue;
|
|
21072
|
+
const candidate = candidateByPath.get(page.path);
|
|
21073
|
+
if (!candidate || (candidates.get(candidate) ?? 0) < MIN_FAMILY_FILES)
|
|
21074
|
+
continue;
|
|
21075
|
+
page.facts.family = pathFact(candidate);
|
|
21076
|
+
}
|
|
21077
|
+
}
|
|
21078
|
+
function summarizeFacts(pages, field) {
|
|
21079
|
+
const counts = /* @__PURE__ */ new Map();
|
|
21080
|
+
for (const page of pages) {
|
|
21081
|
+
const value = page.facts[field]?.value;
|
|
21082
|
+
if (value)
|
|
21083
|
+
counts.set(value, (counts.get(value) ?? 0) + 1);
|
|
21084
|
+
}
|
|
21085
|
+
return [...counts].map(([id, files]) => ({ id, files })).sort((a, b) => a.id.localeCompare(b.id));
|
|
21086
|
+
}
|
|
21087
|
+
function pathFact(value) {
|
|
21088
|
+
return { value, source: "path", confidence: "likely" };
|
|
21089
|
+
}
|
|
21090
|
+
function isLocaleCandidate(value) {
|
|
21091
|
+
return Boolean(value && /^[a-z]{2}(?:-[a-z0-9]{2,8})*$/i.test(value));
|
|
21092
|
+
}
|
|
21093
|
+
function isProjectRelativePath(path4) {
|
|
21094
|
+
return !path4.startsWith("/") && !/^[a-z]:/i.test(path4) && !path4.split("/").includes("..");
|
|
21095
|
+
}
|
|
21096
|
+
function pathSegments(path4) {
|
|
21097
|
+
return path4.split("/").filter(Boolean);
|
|
21098
|
+
}
|
|
21099
|
+
function projectRelativePath(path4, root) {
|
|
21100
|
+
const normalizedPath = normalizePath3(path4);
|
|
21101
|
+
if (!root)
|
|
21102
|
+
return trimRelativePrefix(normalizedPath);
|
|
21103
|
+
const normalizedRoot = normalizePath3(root).replace(/\/$/, "");
|
|
21104
|
+
if (normalizedPath.startsWith(`${normalizedRoot}/`)) {
|
|
21105
|
+
return normalizedPath.slice(normalizedRoot.length + 1);
|
|
21106
|
+
}
|
|
21107
|
+
return trimRelativePrefix(normalizedPath);
|
|
21108
|
+
}
|
|
21109
|
+
function normalizePath3(path4) {
|
|
21110
|
+
return path4.replaceAll("\\", "/").replace(/\/+/g, "/");
|
|
21111
|
+
}
|
|
21112
|
+
function trimRelativePrefix(path4) {
|
|
21113
|
+
return path4.startsWith("./") ? path4.slice(2) : path4;
|
|
21114
|
+
}
|
|
21115
|
+
var FAMILY_WRAPPERS, MIN_FAMILY_FILES, MIN_LOCALE_SIBLINGS;
|
|
21116
|
+
var init_project_discovery = __esm({
|
|
21117
|
+
"../core/dist/project-discovery.js"() {
|
|
21118
|
+
"use strict";
|
|
21119
|
+
init_page_discovery();
|
|
21120
|
+
FAMILY_WRAPPERS = /* @__PURE__ */ new Set(["app", "content", "pages", "routes", "src"]);
|
|
21121
|
+
MIN_FAMILY_FILES = 2;
|
|
21122
|
+
MIN_LOCALE_SIBLINGS = 2;
|
|
21123
|
+
}
|
|
21124
|
+
});
|
|
21125
|
+
|
|
20915
21126
|
// ../core/dist/position.js
|
|
20916
21127
|
function bodyLineRange(node, bodyLineIndex) {
|
|
20917
21128
|
const bodyLines = node.body.split("\n");
|
|
@@ -21264,9 +21475,11 @@ var init_render_markdown = __esm({
|
|
|
21264
21475
|
var init_dist = __esm({
|
|
21265
21476
|
"../core/dist/index.js"() {
|
|
21266
21477
|
"use strict";
|
|
21478
|
+
init_version();
|
|
21267
21479
|
init_frontmatter();
|
|
21268
21480
|
init_analyze();
|
|
21269
21481
|
init_project_scan();
|
|
21482
|
+
init_project_discovery();
|
|
21270
21483
|
init_link_graph();
|
|
21271
21484
|
init_seo();
|
|
21272
21485
|
init_registry();
|
|
@@ -21600,8 +21813,9 @@ var init_dist2 = __esm({
|
|
|
21600
21813
|
});
|
|
21601
21814
|
|
|
21602
21815
|
// ../project/dist/index.js
|
|
21816
|
+
import { createHash } from "node:crypto";
|
|
21603
21817
|
import { readFile } from "node:fs/promises";
|
|
21604
|
-
import { isAbsolute as isAbsolute2, join } from "node:path";
|
|
21818
|
+
import { isAbsolute as isAbsolute2, join, relative as relative2 } from "node:path";
|
|
21605
21819
|
import { pathToFileURL } from "node:url";
|
|
21606
21820
|
import { glob } from "tinyglobby";
|
|
21607
21821
|
async function resolveContentFiles(positionals, cmd, options = {}) {
|
|
@@ -21649,7 +21863,7 @@ async function loadContentProject(input) {
|
|
|
21649
21863
|
cwd: input.cwd,
|
|
21650
21864
|
includeGenericBlocks: input.includeGenericBlocks
|
|
21651
21865
|
});
|
|
21652
|
-
const sources = await Promise.all(files.map(async (
|
|
21866
|
+
const sources = await Promise.all(files.map(async (path4) => ({ path: path4, source: await readFile(path4, "utf8") })));
|
|
21653
21867
|
const linkOptions = input.linkOptions ?? {};
|
|
21654
21868
|
const scan = scanContentProject(sources, registry2, {
|
|
21655
21869
|
linkOptions,
|
|
@@ -21657,7 +21871,118 @@ async function loadContentProject(input) {
|
|
|
21657
21871
|
});
|
|
21658
21872
|
return { files, registry: registry2, sources, linkOptions, scan };
|
|
21659
21873
|
}
|
|
21660
|
-
|
|
21874
|
+
async function inspectContentProject(input) {
|
|
21875
|
+
const root = input.cwd ?? process.cwd();
|
|
21876
|
+
const project = await loadContentProject({ ...input, cmd: "snapshot" });
|
|
21877
|
+
const discovery = discoverContentProject(project.scan.files, {
|
|
21878
|
+
root,
|
|
21879
|
+
...project.linkOptions
|
|
21880
|
+
});
|
|
21881
|
+
const discoveredBySource = new Map(discovery.pages.map((page) => [page.sourcePath, page]));
|
|
21882
|
+
const sourcePaths = [
|
|
21883
|
+
.../* @__PURE__ */ new Set([...project.files, ...project.scan.findings.map((finding2) => finding2.file)])
|
|
21884
|
+
].filter(isAbsolute2).sort((a, b) => b.length - a.length);
|
|
21885
|
+
const findings = project.scan.findings.map((finding2) => ({
|
|
21886
|
+
...finding2,
|
|
21887
|
+
file: portablePath(finding2.file, root),
|
|
21888
|
+
message: portableText(finding2.message, root, sourcePaths),
|
|
21889
|
+
...finding2.hint ? { hint: portableText(finding2.hint, root, sourcePaths) } : {}
|
|
21890
|
+
}));
|
|
21891
|
+
let words = 0;
|
|
21892
|
+
let blocks = 0;
|
|
21893
|
+
let links = 0;
|
|
21894
|
+
const pages = project.scan.files.map((file2) => {
|
|
21895
|
+
const discovered = discoveredBySource.get(file2.path);
|
|
21896
|
+
if (!discovered)
|
|
21897
|
+
throw new Error(`Missing discovered page for ${file2.path}`);
|
|
21898
|
+
words += file2.stats.length.words;
|
|
21899
|
+
blocks += file2.stats.blocks.total;
|
|
21900
|
+
links += file2.stats.links.total;
|
|
21901
|
+
const pageFindings = summarizeContentProjectFindings(file2.findings);
|
|
21902
|
+
const path4 = portablePath(file2.path, root);
|
|
21903
|
+
return {
|
|
21904
|
+
path: path4,
|
|
21905
|
+
contentHash: createHash("sha256").update(file2.source).digest("hex"),
|
|
21906
|
+
facts: {
|
|
21907
|
+
...discovered.facts,
|
|
21908
|
+
identity: discovered.facts.identity.source === "path" ? { ...discovered.facts.identity, value: path4 } : discovered.facts.identity
|
|
21909
|
+
},
|
|
21910
|
+
stats: {
|
|
21911
|
+
bytes: file2.stats.file.bytes,
|
|
21912
|
+
words: file2.stats.length.words,
|
|
21913
|
+
readingMinutes: file2.stats.length.readingMinutes,
|
|
21914
|
+
outline: file2.stats.outline,
|
|
21915
|
+
blocks: { total: file2.stats.blocks.total, byName: file2.stats.blocks.byName },
|
|
21916
|
+
links: {
|
|
21917
|
+
total: file2.stats.links.total,
|
|
21918
|
+
internal: file2.stats.links.internal,
|
|
21919
|
+
external: file2.stats.links.external
|
|
21920
|
+
},
|
|
21921
|
+
images: file2.stats.images
|
|
21922
|
+
},
|
|
21923
|
+
findings: pageFindings,
|
|
21924
|
+
status: snapshotStatus(pageFindings)
|
|
21925
|
+
};
|
|
21926
|
+
});
|
|
21927
|
+
const graph = snapshotGraph(project.scan, root);
|
|
21928
|
+
return {
|
|
21929
|
+
schemaVersion: CONTENT_PROJECT_SNAPSHOT_SCHEMA_VERSION,
|
|
21930
|
+
...input.revision ? { revision: input.revision } : {},
|
|
21931
|
+
summary: {
|
|
21932
|
+
files: pages.length,
|
|
21933
|
+
words,
|
|
21934
|
+
blocks,
|
|
21935
|
+
links,
|
|
21936
|
+
findings: project.scan.summary
|
|
21937
|
+
},
|
|
21938
|
+
pages,
|
|
21939
|
+
families: discovery.families,
|
|
21940
|
+
locales: discovery.locales,
|
|
21941
|
+
findings,
|
|
21942
|
+
...graph ? { graph } : {},
|
|
21943
|
+
...project.scan.seo ? {
|
|
21944
|
+
seo: {
|
|
21945
|
+
schemaVersion: project.scan.seo.schemaVersion,
|
|
21946
|
+
pages: project.scan.seo.pages.length,
|
|
21947
|
+
existing: project.scan.seo.pages.filter((page) => page.source === "existing").length,
|
|
21948
|
+
planned: project.scan.seo.pages.filter((page) => page.source === "planned").length,
|
|
21949
|
+
findings: project.scan.seo.findings.length
|
|
21950
|
+
}
|
|
21951
|
+
} : {}
|
|
21952
|
+
};
|
|
21953
|
+
}
|
|
21954
|
+
function snapshotGraph(scan, root) {
|
|
21955
|
+
if (!scan.linkIndex)
|
|
21956
|
+
return void 0;
|
|
21957
|
+
const graph = createLinkGraphView(scan.linkIndex, scan.linkDiagnostics ?? []);
|
|
21958
|
+
return {
|
|
21959
|
+
summary: graph.summary,
|
|
21960
|
+
nodes: graph.nodes.map((node) => ({ ...node, path: portablePath(node.path, root) })),
|
|
21961
|
+
edges: graph.edges
|
|
21962
|
+
};
|
|
21963
|
+
}
|
|
21964
|
+
function snapshotStatus(summary) {
|
|
21965
|
+
if (summary.errors > 0)
|
|
21966
|
+
return "error";
|
|
21967
|
+
if (summary.warnings > 0)
|
|
21968
|
+
return "warning";
|
|
21969
|
+
if (summary.suggestions > 0)
|
|
21970
|
+
return "suggestion";
|
|
21971
|
+
return "healthy";
|
|
21972
|
+
}
|
|
21973
|
+
function portablePath(path4, root) {
|
|
21974
|
+
const value = isAbsolute2(path4) ? relative2(root, path4) : path4;
|
|
21975
|
+
return value.replaceAll("\\", "/");
|
|
21976
|
+
}
|
|
21977
|
+
function portableText(value, root, sourcePaths) {
|
|
21978
|
+
let normalized = value.replaceAll("\\", "/");
|
|
21979
|
+
for (const path4 of sourcePaths) {
|
|
21980
|
+
normalized = normalized.replaceAll(path4.replaceAll("\\", "/"), portablePath(path4, root));
|
|
21981
|
+
}
|
|
21982
|
+
const normalizedRoot = root.replaceAll("\\", "/").replace(/\/$/, "");
|
|
21983
|
+
return normalized.replaceAll(`${normalizedRoot}/`, "");
|
|
21984
|
+
}
|
|
21985
|
+
var ProjectLoadError, CONTENT_PROJECT_SNAPSHOT_SCHEMA_VERSION;
|
|
21661
21986
|
var init_dist3 = __esm({
|
|
21662
21987
|
"../project/dist/index.js"() {
|
|
21663
21988
|
"use strict";
|
|
@@ -21671,6 +21996,7 @@ var init_dist3 = __esm({
|
|
|
21671
21996
|
this.name = "ProjectLoadError";
|
|
21672
21997
|
}
|
|
21673
21998
|
};
|
|
21999
|
+
CONTENT_PROJECT_SNAPSHOT_SCHEMA_VERSION = "contentbit.project-snapshot.v1";
|
|
21674
22000
|
}
|
|
21675
22001
|
});
|
|
21676
22002
|
|
|
@@ -21714,7 +22040,7 @@ __export(agents_exports, {
|
|
|
21714
22040
|
});
|
|
21715
22041
|
import { existsSync, readFileSync } from "node:fs";
|
|
21716
22042
|
import { mkdir, readFile as readFile2, writeFile } from "node:fs/promises";
|
|
21717
|
-
import { dirname as dirname2, join as join2, relative as
|
|
22043
|
+
import { dirname as dirname2, join as join2, relative as relative3, resolve, sep } from "node:path";
|
|
21718
22044
|
function upsertBlock(existing, block = AGENTS_MD_BLOCK) {
|
|
21719
22045
|
const start = existing.indexOf(START);
|
|
21720
22046
|
const end = existing.indexOf(END);
|
|
@@ -21737,19 +22063,19 @@ function rootPointerBlock(packagePath) {
|
|
|
21737
22063
|
END
|
|
21738
22064
|
].join("\n");
|
|
21739
22065
|
}
|
|
21740
|
-
async function readTextIfExists(
|
|
22066
|
+
async function readTextIfExists(path4) {
|
|
21741
22067
|
try {
|
|
21742
|
-
return await readFile2(
|
|
22068
|
+
return await readFile2(path4, "utf8");
|
|
21743
22069
|
} catch {
|
|
21744
22070
|
return "";
|
|
21745
22071
|
}
|
|
21746
22072
|
}
|
|
21747
|
-
function isWorkspaceRoot(
|
|
21748
|
-
if (existsSync(join2(
|
|
21749
|
-
if (existsSync(join2(
|
|
21750
|
-
if (existsSync(join2(
|
|
22073
|
+
function isWorkspaceRoot(path4) {
|
|
22074
|
+
if (existsSync(join2(path4, "pnpm-workspace.yaml"))) return true;
|
|
22075
|
+
if (existsSync(join2(path4, "lerna.json"))) return true;
|
|
22076
|
+
if (existsSync(join2(path4, "nx.json"))) return true;
|
|
21751
22077
|
try {
|
|
21752
|
-
const pkg = JSON.parse(readFileSync(join2(
|
|
22078
|
+
const pkg = JSON.parse(readFileSync(join2(path4, "package.json"), "utf8"));
|
|
21753
22079
|
return Array.isArray(pkg.workspaces) || typeof pkg.workspaces === "object";
|
|
21754
22080
|
} catch {
|
|
21755
22081
|
return false;
|
|
@@ -21765,7 +22091,7 @@ function findMonorepoRoot(cwd) {
|
|
|
21765
22091
|
return void 0;
|
|
21766
22092
|
}
|
|
21767
22093
|
function displayRelative(from, to) {
|
|
21768
|
-
const rel =
|
|
22094
|
+
const rel = relative3(from, to) || ".";
|
|
21769
22095
|
return rel.split(sep).join("/");
|
|
21770
22096
|
}
|
|
21771
22097
|
async function writeRootPointerIfNeeded(cwd, io) {
|
|
@@ -21780,8 +22106,8 @@ async function writeRootPointerIfNeeded(cwd, io) {
|
|
|
21780
22106
|
`${created ? "created" : "updated"}: ${displayRelative(cwd, rootAgentsPath)} (contentbit root pointer)`
|
|
21781
22107
|
);
|
|
21782
22108
|
}
|
|
21783
|
-
async function checkBlockStatus(
|
|
21784
|
-
const existing = await readTextIfExists(
|
|
22109
|
+
async function checkBlockStatus(path4, block, label, io) {
|
|
22110
|
+
const existing = await readTextIfExists(path4);
|
|
21785
22111
|
if (existing === "") {
|
|
21786
22112
|
io.stdout(`would create: ${label}`);
|
|
21787
22113
|
return;
|
|
@@ -21819,8 +22145,8 @@ async function checkAgentIntegration(cwd, options, io) {
|
|
|
21819
22145
|
}
|
|
21820
22146
|
if (claude) {
|
|
21821
22147
|
for (const [name, content] of SKILLS) {
|
|
21822
|
-
const
|
|
21823
|
-
const installed = await readTextIfExists(
|
|
22148
|
+
const path4 = join2(cwd, ".claude/skills", name, "SKILL.md");
|
|
22149
|
+
const installed = await readTextIfExists(path4);
|
|
21824
22150
|
const shippedVersion = skillVersion(content) ?? "unknown";
|
|
21825
22151
|
if (installed === "") {
|
|
21826
22152
|
io.stdout(`would install: .claude/skills/${name}/SKILL.md (version ${shippedVersion})`);
|
|
@@ -21855,10 +22181,10 @@ async function installAgentIntegration(cwd, options, io) {
|
|
|
21855
22181
|
const claude = options.claude ?? claudeDirExists;
|
|
21856
22182
|
const agentsMd = options.agentsMd ?? true;
|
|
21857
22183
|
if (agentsMd) {
|
|
21858
|
-
const
|
|
21859
|
-
const existing = await readTextIfExists(
|
|
22184
|
+
const path4 = join2(cwd, "AGENTS.md");
|
|
22185
|
+
const existing = await readTextIfExists(path4);
|
|
21860
22186
|
const created = existing === "";
|
|
21861
|
-
await writeFile(
|
|
22187
|
+
await writeFile(path4, upsertBlock(existing), "utf8");
|
|
21862
22188
|
io.stdout(`${created ? "created" : "updated"}: AGENTS.md (contentbit block)`);
|
|
21863
22189
|
await writeRootPointerIfNeeded(cwd, io);
|
|
21864
22190
|
}
|
|
@@ -21993,7 +22319,7 @@ function detectFramework(cwd, deps) {
|
|
|
21993
22319
|
if (existsSync2(join3(cwd, appDir))) {
|
|
21994
22320
|
return {
|
|
21995
22321
|
framework: "next",
|
|
21996
|
-
componentPath: "components/content-blocks.tsx",
|
|
22322
|
+
componentPath: appDir === "src/app" ? "src/components/content-blocks.tsx" : "components/content-blocks.tsx",
|
|
21997
22323
|
pagePath: `${appDir}/example/page.tsx`
|
|
21998
22324
|
};
|
|
21999
22325
|
}
|
|
@@ -22100,8 +22426,7 @@ function ExamplePage() {
|
|
|
22100
22426
|
`;
|
|
22101
22427
|
NEXT_PAGE = `import { readFile } from 'node:fs/promises'
|
|
22102
22428
|
|
|
22103
|
-
|
|
22104
|
-
import { Content } from '@/components/content-blocks'
|
|
22429
|
+
import { Content } from '../../components/content-blocks'
|
|
22105
22430
|
|
|
22106
22431
|
export default async function ExamplePage() {
|
|
22107
22432
|
const source = await readFile('content/example.md', 'utf8')
|
|
@@ -22201,10 +22526,10 @@ function dlxCommand(pm) {
|
|
|
22201
22526
|
return ["npx", ["--yes"]];
|
|
22202
22527
|
}
|
|
22203
22528
|
function runInstall(pm, args, cwd) {
|
|
22204
|
-
return new Promise((
|
|
22529
|
+
return new Promise((resolve5) => {
|
|
22205
22530
|
const child = spawn(pm, args, { cwd, stdio: "inherit", shell: process.platform === "win32" });
|
|
22206
|
-
child.on("close", (code) =>
|
|
22207
|
-
child.on("error", () =>
|
|
22531
|
+
child.on("close", (code) => resolve5(code ?? 1));
|
|
22532
|
+
child.on("error", () => resolve5(1));
|
|
22208
22533
|
});
|
|
22209
22534
|
}
|
|
22210
22535
|
async function installStyledPack(cwd, pack, noInstall, io) {
|
|
@@ -22227,13 +22552,13 @@ async function installStyledPack(cwd, pack, noInstall, io) {
|
|
|
22227
22552
|
if (code !== 0) io.stderr("styled pack install failed; falling back to the headless renderer");
|
|
22228
22553
|
return code === 0;
|
|
22229
22554
|
}
|
|
22230
|
-
async function scaffold(
|
|
22555
|
+
async function scaffold(path4, content) {
|
|
22231
22556
|
try {
|
|
22232
|
-
await readFile3(
|
|
22557
|
+
await readFile3(path4, "utf8");
|
|
22233
22558
|
return "skipped";
|
|
22234
22559
|
} catch {
|
|
22235
|
-
await mkdir2(join4(
|
|
22236
|
-
await writeFile2(
|
|
22560
|
+
await mkdir2(join4(path4, ".."), { recursive: true });
|
|
22561
|
+
await writeFile2(path4, content, "utf8");
|
|
22237
22562
|
return "created";
|
|
22238
22563
|
}
|
|
22239
22564
|
}
|
|
@@ -22297,9 +22622,11 @@ async function initCommand(input, io) {
|
|
|
22297
22622
|
} else {
|
|
22298
22623
|
md = choices[0];
|
|
22299
22624
|
}
|
|
22300
|
-
const
|
|
22625
|
+
const atCliVersion = (name) => name === "contentbit" || name.startsWith("@contentbit/") ? `${name}@${VERSION}` : name;
|
|
22626
|
+
const runtime = adapter.runtimeDependencies(md).map(atCliVersion);
|
|
22627
|
+
const dev = ["contentbit", "@contentbit/studio"].map(atCliVersion);
|
|
22301
22628
|
if (input.noInstall) {
|
|
22302
|
-
io.stdout(`skipped install: ${runtime.join(" ")} +
|
|
22629
|
+
io.stdout(`skipped install: ${runtime.join(" ")} + ${dev.join(" ")} (dev)`);
|
|
22303
22630
|
} else {
|
|
22304
22631
|
const pm2 = detectPackageManager(cwd);
|
|
22305
22632
|
io.stdout(`installing with ${pm2}: ${runtime.join(" ")}`);
|
|
@@ -22307,7 +22634,7 @@ async function initCommand(input, io) {
|
|
|
22307
22634
|
io.stderr("install failed");
|
|
22308
22635
|
return 1;
|
|
22309
22636
|
}
|
|
22310
|
-
if (await runInstall(pm2, installArgs(pm2, true,
|
|
22637
|
+
if (await runInstall(pm2, installArgs(pm2, true, dev), cwd) !== 0) {
|
|
22311
22638
|
io.stderr("install failed");
|
|
22312
22639
|
return 1;
|
|
22313
22640
|
}
|
|
@@ -22383,6 +22710,7 @@ var REGISTRY_TEMPLATE, EXAMPLE_CONTENT, RELATED_CONTENT, SEO_CONFIG_TEMPLATE;
|
|
|
22383
22710
|
var init_init = __esm({
|
|
22384
22711
|
"src/commands/init.ts"() {
|
|
22385
22712
|
"use strict";
|
|
22713
|
+
init_dist();
|
|
22386
22714
|
init_load_registry();
|
|
22387
22715
|
init_agents();
|
|
22388
22716
|
init_init_targets();
|
|
@@ -22572,18 +22900,26 @@ async function adoptCommand(input, io) {
|
|
|
22572
22900
|
const scan = scanContentProject(project.sources, project.registry, {
|
|
22573
22901
|
linkOptions: { resolve: linkResolve }
|
|
22574
22902
|
});
|
|
22575
|
-
const report = createAdoptionReport(
|
|
22903
|
+
const report = createAdoptionReport(
|
|
22904
|
+
globs,
|
|
22905
|
+
project.files.length,
|
|
22906
|
+
scan.findings,
|
|
22907
|
+
scan.files,
|
|
22908
|
+
process.cwd()
|
|
22909
|
+
);
|
|
22576
22910
|
if (input.json) io.stdout(JSON.stringify(report, null, 2));
|
|
22577
22911
|
else io.stdout(formatAdoptionReport(report));
|
|
22578
22912
|
return 0;
|
|
22579
22913
|
}
|
|
22580
|
-
function createAdoptionReport(globs, files, findings, scannedFiles) {
|
|
22914
|
+
function createAdoptionReport(globs, files, findings, scannedFiles, root) {
|
|
22581
22915
|
const frontmatters = scannedFiles.map((file2) => file2.frontmatter);
|
|
22582
22916
|
const frontmatter = countFrontmatter(frontmatters);
|
|
22583
22917
|
const links = inferLinkResolution(frontmatters);
|
|
22584
22918
|
const pageTypes = valuesForField(frontmatters, "type");
|
|
22585
22919
|
const contracts = inferContracts(scannedFiles, pageTypes);
|
|
22586
22920
|
const localeCoverage = coverageByKey(frontmatters);
|
|
22921
|
+
const discovery = discoverContentProject(scannedFiles, { root });
|
|
22922
|
+
const pages = discovery.pages.map((page) => ({ path: page.path, facts: page.facts }));
|
|
22587
22923
|
const contentbitConfig = contentbitConfigProposal(globs, links);
|
|
22588
22924
|
const seoConfig = contracts.length > 0 ? seoConfigProposal(contracts) : void 0;
|
|
22589
22925
|
return {
|
|
@@ -22591,12 +22927,20 @@ function createAdoptionReport(globs, files, findings, scannedFiles) {
|
|
|
22591
22927
|
dryRun: true,
|
|
22592
22928
|
files,
|
|
22593
22929
|
frontmatter,
|
|
22594
|
-
inferred: {
|
|
22930
|
+
inferred: {
|
|
22931
|
+
content: globs,
|
|
22932
|
+
links: { resolve: links },
|
|
22933
|
+
pageTypes,
|
|
22934
|
+
families: discovery.families,
|
|
22935
|
+
locales: discovery.locales,
|
|
22936
|
+
contracts
|
|
22937
|
+
},
|
|
22595
22938
|
localeCoverage,
|
|
22939
|
+
pages,
|
|
22596
22940
|
findings,
|
|
22597
22941
|
proposals: {
|
|
22598
22942
|
contentbitConfig,
|
|
22599
|
-
frontmatter: frontmatterProposals(scannedFiles),
|
|
22943
|
+
frontmatter: frontmatterProposals(scannedFiles, discovery.pages),
|
|
22600
22944
|
...seoConfig ? { seoConfig } : {}
|
|
22601
22945
|
}
|
|
22602
22946
|
};
|
|
@@ -22665,36 +23009,31 @@ function primaryKeyword(frontmatter) {
|
|
|
22665
23009
|
if (!keywords || typeof keywords !== "object" || Array.isArray(keywords)) return void 0;
|
|
22666
23010
|
return stringValue2(keywords.primary);
|
|
22667
23011
|
}
|
|
22668
|
-
function frontmatterProposals(files) {
|
|
23012
|
+
function frontmatterProposals(files, pages) {
|
|
22669
23013
|
const proposals = [];
|
|
22670
23014
|
for (const file2 of files) {
|
|
23015
|
+
const discovered = pages.find((page) => page.sourcePath === file2.path)?.facts;
|
|
23016
|
+
if (!discovered) continue;
|
|
22671
23017
|
const add = {};
|
|
22672
|
-
if (!stringValue2(file2.frontmatter.slug)) add.slug =
|
|
23018
|
+
if (!stringValue2(file2.frontmatter.slug)) add.slug = discovered.slug.value;
|
|
22673
23019
|
if (!stringValue2(file2.frontmatter.title)) {
|
|
22674
|
-
add.title =
|
|
23020
|
+
add.title = discovered.title.value;
|
|
22675
23021
|
}
|
|
22676
23022
|
if (Object.keys(add).length > 0) proposals.push({ path: file2.path, add });
|
|
22677
23023
|
}
|
|
22678
23024
|
return proposals;
|
|
22679
23025
|
}
|
|
22680
|
-
function slugFromPath(path2) {
|
|
22681
|
-
return titleFromPath(path2).toLocaleLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/[^\p{L}\p{N}]+/gu, "-").replace(/^-+|-+$/g, "");
|
|
22682
|
-
}
|
|
22683
|
-
function titleFromPath(path2) {
|
|
22684
|
-
const filename = path2.slice(path2.lastIndexOf("/") + 1).replace(/\.mdx?$/i, "");
|
|
22685
|
-
return filename.replace(/[-_]+/g, " ").replace(/\b\p{L}/gu, (letter) => letter.toUpperCase());
|
|
22686
|
-
}
|
|
22687
23026
|
function stringValue2(value) {
|
|
22688
23027
|
return typeof value === "string" && value.trim() !== "" ? value.trim() : void 0;
|
|
22689
23028
|
}
|
|
22690
|
-
function contentbitConfigProposal(globs,
|
|
23029
|
+
function contentbitConfigProposal(globs, resolve5) {
|
|
22691
23030
|
const content = globs.length === 1 ? singleQuoted(globs[0]) : `[${globs.map(singleQuoted).join(", ")}]`;
|
|
22692
23031
|
return `import { defineContentConfig } from '@contentbit/core'
|
|
22693
23032
|
|
|
22694
23033
|
export default defineContentConfig({
|
|
22695
23034
|
content: ${content},
|
|
22696
23035
|
links: {
|
|
22697
|
-
resolve: '${
|
|
23036
|
+
resolve: '${resolve5}',
|
|
22698
23037
|
},
|
|
22699
23038
|
})
|
|
22700
23039
|
`;
|
|
@@ -22794,10 +23133,10 @@ var init_adopt = __esm({
|
|
|
22794
23133
|
// src/link-options.ts
|
|
22795
23134
|
function linkResolverOptions(values) {
|
|
22796
23135
|
const out = {};
|
|
22797
|
-
const
|
|
22798
|
-
if (
|
|
22799
|
-
if (!isResolveMode(
|
|
22800
|
-
out.resolve =
|
|
23136
|
+
const resolve5 = stringValue3(values.linkResolve ?? values["link-resolve"]);
|
|
23137
|
+
if (resolve5) {
|
|
23138
|
+
if (!isResolveMode(resolve5)) throw new Error(`invalid --link-resolve ${resolve5}`);
|
|
23139
|
+
out.resolve = resolve5;
|
|
22801
23140
|
}
|
|
22802
23141
|
const localeField = stringValue3(values.localeField ?? values["locale-field"]);
|
|
22803
23142
|
const slugField = stringValue3(values.slugField ?? values["slug-field"]);
|
|
@@ -22826,17 +23165,17 @@ import { existsSync as existsSync4 } from "node:fs";
|
|
|
22826
23165
|
import { dirname as dirname3, isAbsolute as isAbsolute3, join as join5, resolve as resolve2 } from "node:path";
|
|
22827
23166
|
import { pathToFileURL as pathToFileURL2 } from "node:url";
|
|
22828
23167
|
async function loadContentbitConfig(startDir = process.cwd(), explicitPath) {
|
|
22829
|
-
const
|
|
22830
|
-
if (!
|
|
22831
|
-
const mod = await import(pathToFileURL2(
|
|
23168
|
+
const path4 = explicitPath ? isAbsolute3(explicitPath) ? explicitPath : resolve2(startDir, explicitPath) : findConfig(startDir);
|
|
23169
|
+
if (!path4) return void 0;
|
|
23170
|
+
const mod = await import(pathToFileURL2(path4).href);
|
|
22832
23171
|
if (!mod.default || typeof mod.default !== "object") {
|
|
22833
|
-
throw new Error(`Contentbit config must default-export a config object: ${
|
|
23172
|
+
throw new Error(`Contentbit config must default-export a config object: ${path4}`);
|
|
22834
23173
|
}
|
|
22835
|
-
const content = normalizeContent(mod.default.content,
|
|
23174
|
+
const content = normalizeContent(mod.default.content, path4);
|
|
22836
23175
|
return {
|
|
22837
23176
|
config: { ...mod.default, content },
|
|
22838
|
-
cwd: dirname3(
|
|
22839
|
-
path:
|
|
23177
|
+
cwd: dirname3(path4),
|
|
23178
|
+
path: path4
|
|
22840
23179
|
};
|
|
22841
23180
|
}
|
|
22842
23181
|
function findConfig(startDir) {
|
|
@@ -22851,11 +23190,11 @@ function findConfig(startDir) {
|
|
|
22851
23190
|
current = parent;
|
|
22852
23191
|
}
|
|
22853
23192
|
}
|
|
22854
|
-
function normalizeContent(value,
|
|
23193
|
+
function normalizeContent(value, path4) {
|
|
22855
23194
|
const content = typeof value === "string" ? [value] : value;
|
|
22856
23195
|
if (!Array.isArray(content) || content.length === 0 || content.some((item) => typeof item !== "string" || item.length === 0)) {
|
|
22857
23196
|
throw new Error(
|
|
22858
|
-
`Contentbit config "content" must be a non-empty string or string array: ${
|
|
23197
|
+
`Contentbit config "content" must be a non-empty string or string array: ${path4}`
|
|
22859
23198
|
);
|
|
22860
23199
|
}
|
|
22861
23200
|
return content;
|
|
@@ -22873,10 +23212,56 @@ var init_project_config = __esm({
|
|
|
22873
23212
|
}
|
|
22874
23213
|
});
|
|
22875
23214
|
|
|
22876
|
-
// src/
|
|
23215
|
+
// src/seo-config.ts
|
|
22877
23216
|
import { existsSync as existsSync5 } from "node:fs";
|
|
23217
|
+
import { isAbsolute as isAbsolute4, join as join6 } from "node:path";
|
|
23218
|
+
import { pathToFileURL as pathToFileURL3 } from "node:url";
|
|
23219
|
+
async function loadSeoConfig(input = {}) {
|
|
23220
|
+
if (input.noSeo) return {};
|
|
23221
|
+
const cwd = input.cwd ?? process.cwd();
|
|
23222
|
+
const path4 = input.seoConfig ? isAbsolute4(input.seoConfig) ? input.seoConfig : join6(cwd, input.seoConfig) : join6(cwd, DEFAULT_SEO_CONFIG);
|
|
23223
|
+
if (!input.seoConfig && !existsSync5(path4)) return {};
|
|
23224
|
+
const mod = await import(pathToFileURL3(path4).href);
|
|
23225
|
+
if (mod.default === void 0) {
|
|
23226
|
+
throw new Error(`SEO config must default-export a config object: ${path4}`);
|
|
23227
|
+
}
|
|
23228
|
+
return { config: mod.default, path: path4 };
|
|
23229
|
+
}
|
|
23230
|
+
var DEFAULT_SEO_CONFIG;
|
|
23231
|
+
var init_seo_config = __esm({
|
|
23232
|
+
"src/seo-config.ts"() {
|
|
23233
|
+
"use strict";
|
|
23234
|
+
DEFAULT_SEO_CONFIG = "contentbit.seo.config.ts";
|
|
23235
|
+
}
|
|
23236
|
+
});
|
|
23237
|
+
|
|
23238
|
+
// src/command-config.ts
|
|
23239
|
+
import { existsSync as existsSync6 } from "node:fs";
|
|
22878
23240
|
import { readFile as readFile4 } from "node:fs/promises";
|
|
22879
|
-
import { dirname as dirname4, isAbsolute as
|
|
23241
|
+
import { dirname as dirname4, isAbsolute as isAbsolute5, join as join7, resolve as resolve3 } from "node:path";
|
|
23242
|
+
async function resolveContentCommandConfig(command, input, startDir = process.cwd()) {
|
|
23243
|
+
const defaults = await discoverContentCommandDefaults(command, input.globs, startDir);
|
|
23244
|
+
const links = {
|
|
23245
|
+
linkResolve: input.linkResolve ?? defaults.linkResolve,
|
|
23246
|
+
localeField: input.localeField ?? defaults.localeField,
|
|
23247
|
+
slugField: input.slugField ?? defaults.slugField,
|
|
23248
|
+
keyField: input.keyField ?? defaults.keyField,
|
|
23249
|
+
defaultLocale: input.defaultLocale ?? defaults.defaultLocale
|
|
23250
|
+
};
|
|
23251
|
+
const seo = {
|
|
23252
|
+
cwd: defaults.cwd,
|
|
23253
|
+
seoConfig: input.seoConfig ?? defaults.seoConfig,
|
|
23254
|
+
noSeo: input.noSeo ?? (input.seoConfig ? false : defaults.noSeo)
|
|
23255
|
+
};
|
|
23256
|
+
return {
|
|
23257
|
+
globs: defaults.globs,
|
|
23258
|
+
cwd: defaults.cwd,
|
|
23259
|
+
registry: input.registry ?? defaults.registry,
|
|
23260
|
+
includeGenericBlocks: !(input.noGenericBlocks || defaults.noGenericBlocks),
|
|
23261
|
+
resolveLinkOptions: () => linkResolverOptions(links),
|
|
23262
|
+
loadSeo: () => loadSeoConfig(seo)
|
|
23263
|
+
};
|
|
23264
|
+
}
|
|
22880
23265
|
async function discoverContentCommandDefaults(command, explicitGlobs, startDir = process.cwd()) {
|
|
22881
23266
|
const loadedConfig = await loadContentbitConfig(startDir);
|
|
22882
23267
|
const configDefaults = loadedConfig ? {
|
|
@@ -22905,15 +23290,15 @@ async function discoverContentCommandDefaults(command, explicitGlobs, startDir =
|
|
|
22905
23290
|
source: `${found.packageJson}#scripts.${found.scriptName}`
|
|
22906
23291
|
};
|
|
22907
23292
|
}
|
|
22908
|
-
function resolveConfigPath(cwd,
|
|
22909
|
-
if (!
|
|
22910
|
-
return
|
|
23293
|
+
function resolveConfigPath(cwd, path4) {
|
|
23294
|
+
if (!path4) return void 0;
|
|
23295
|
+
return isAbsolute5(path4) ? path4 : resolve3(cwd, path4);
|
|
22911
23296
|
}
|
|
22912
23297
|
async function findPackageScript(command, startDir) {
|
|
22913
23298
|
let current = resolve3(startDir);
|
|
22914
23299
|
while (true) {
|
|
22915
|
-
const packageJson =
|
|
22916
|
-
if (
|
|
23300
|
+
const packageJson = join7(current, "package.json");
|
|
23301
|
+
if (existsSync6(packageJson)) {
|
|
22917
23302
|
const scripts = await packageScripts(packageJson);
|
|
22918
23303
|
for (const name of SCRIPT_CANDIDATES[command]) {
|
|
22919
23304
|
const script = scripts[name];
|
|
@@ -22930,9 +23315,9 @@ async function findPackageScript(command, startDir) {
|
|
|
22930
23315
|
current = parent;
|
|
22931
23316
|
}
|
|
22932
23317
|
}
|
|
22933
|
-
async function packageScripts(
|
|
23318
|
+
async function packageScripts(path4) {
|
|
22934
23319
|
try {
|
|
22935
|
-
const pkg = JSON.parse(await readFile4(
|
|
23320
|
+
const pkg = JSON.parse(await readFile4(path4, "utf8"));
|
|
22936
23321
|
const out = {};
|
|
22937
23322
|
for (const [name, value] of Object.entries(pkg.scripts ?? {})) {
|
|
22938
23323
|
if (typeof value === "string") out[name] = value;
|
|
@@ -23039,17 +23424,20 @@ function splitShellArgs(input) {
|
|
|
23039
23424
|
return args;
|
|
23040
23425
|
}
|
|
23041
23426
|
var SCRIPT_CANDIDATES;
|
|
23042
|
-
var
|
|
23043
|
-
"src/
|
|
23427
|
+
var init_command_config = __esm({
|
|
23428
|
+
"src/command-config.ts"() {
|
|
23044
23429
|
"use strict";
|
|
23430
|
+
init_link_options();
|
|
23045
23431
|
init_project_config();
|
|
23432
|
+
init_seo_config();
|
|
23046
23433
|
SCRIPT_CANDIDATES = {
|
|
23047
23434
|
validate: ["content:check", "content:validate"],
|
|
23048
23435
|
doctor: ["content:doctor", "content:check"],
|
|
23049
23436
|
studio: ["studio", "content:studio", "content:check"],
|
|
23050
23437
|
links: ["content:links", "content:check"],
|
|
23051
23438
|
stats: ["content:stats", "content:check"],
|
|
23052
|
-
brief: ["content:brief", "content:check"]
|
|
23439
|
+
brief: ["content:brief", "content:check"],
|
|
23440
|
+
snapshot: ["content:snapshot", "content:check"]
|
|
23053
23441
|
};
|
|
23054
23442
|
}
|
|
23055
23443
|
});
|
|
@@ -23060,20 +23448,14 @@ __export(validate_exports, {
|
|
|
23060
23448
|
validateCommand: () => validateCommand
|
|
23061
23449
|
});
|
|
23062
23450
|
async function validateCommand(input, io) {
|
|
23063
|
-
const
|
|
23064
|
-
const linkOptions =
|
|
23065
|
-
linkResolve: input.linkResolve ?? defaults.linkResolve,
|
|
23066
|
-
localeField: input.localeField ?? defaults.localeField,
|
|
23067
|
-
slugField: input.slugField ?? defaults.slugField,
|
|
23068
|
-
keyField: input.keyField ?? defaults.keyField,
|
|
23069
|
-
defaultLocale: input.defaultLocale ?? defaults.defaultLocale
|
|
23070
|
-
});
|
|
23451
|
+
const config2 = await resolveContentCommandConfig("validate", input);
|
|
23452
|
+
const linkOptions = config2.resolveLinkOptions();
|
|
23071
23453
|
const { files, scan } = await loadContentProject2({
|
|
23072
23454
|
cmd: "validate",
|
|
23073
|
-
positionals:
|
|
23074
|
-
cwd:
|
|
23075
|
-
registry:
|
|
23076
|
-
includeGenericBlocks:
|
|
23455
|
+
positionals: config2.globs,
|
|
23456
|
+
cwd: config2.cwd,
|
|
23457
|
+
registry: config2.registry,
|
|
23458
|
+
includeGenericBlocks: config2.includeGenericBlocks,
|
|
23077
23459
|
linkOptions,
|
|
23078
23460
|
scan: { includeStatsFindings: false, includeIntegrityFindings: false }
|
|
23079
23461
|
});
|
|
@@ -23115,33 +23497,9 @@ function diagnosticFromFinding(finding2) {
|
|
|
23115
23497
|
var init_validate2 = __esm({
|
|
23116
23498
|
"src/commands/validate.ts"() {
|
|
23117
23499
|
"use strict";
|
|
23500
|
+
init_command_config();
|
|
23118
23501
|
init_cli_format();
|
|
23119
23502
|
init_content_project();
|
|
23120
|
-
init_link_options();
|
|
23121
|
-
init_script_defaults();
|
|
23122
|
-
}
|
|
23123
|
-
});
|
|
23124
|
-
|
|
23125
|
-
// src/seo-config.ts
|
|
23126
|
-
import { existsSync as existsSync6 } from "node:fs";
|
|
23127
|
-
import { isAbsolute as isAbsolute5, join as join7 } from "node:path";
|
|
23128
|
-
import { pathToFileURL as pathToFileURL3 } from "node:url";
|
|
23129
|
-
async function loadSeoConfig(input = {}) {
|
|
23130
|
-
if (input.noSeo) return {};
|
|
23131
|
-
const cwd = input.cwd ?? process.cwd();
|
|
23132
|
-
const path2 = input.seoConfig ? isAbsolute5(input.seoConfig) ? input.seoConfig : join7(cwd, input.seoConfig) : join7(cwd, DEFAULT_SEO_CONFIG);
|
|
23133
|
-
if (!input.seoConfig && !existsSync6(path2)) return {};
|
|
23134
|
-
const mod = await import(pathToFileURL3(path2).href);
|
|
23135
|
-
if (mod.default === void 0) {
|
|
23136
|
-
throw new Error(`SEO config must default-export a config object: ${path2}`);
|
|
23137
|
-
}
|
|
23138
|
-
return { config: mod.default, path: path2 };
|
|
23139
|
-
}
|
|
23140
|
-
var DEFAULT_SEO_CONFIG;
|
|
23141
|
-
var init_seo_config = __esm({
|
|
23142
|
-
"src/seo-config.ts"() {
|
|
23143
|
-
"use strict";
|
|
23144
|
-
DEFAULT_SEO_CONFIG = "contentbit.seo.config.ts";
|
|
23145
23503
|
}
|
|
23146
23504
|
});
|
|
23147
23505
|
|
|
@@ -23164,30 +23522,20 @@ async function doctorCommand(input, io) {
|
|
|
23164
23522
|
return watchDoctor(input, io, first.files);
|
|
23165
23523
|
}
|
|
23166
23524
|
async function doctorOnce(input, io) {
|
|
23167
|
-
const
|
|
23525
|
+
const config2 = await resolveContentCommandConfig("doctor", input);
|
|
23168
23526
|
const minSectionWords = parseMinSectionWords(input.minSectionWords);
|
|
23169
23527
|
if (minSectionWords === null) {
|
|
23170
23528
|
io.stderr("doctor: --min-section-words must be a non-negative integer.");
|
|
23171
23529
|
return { exitCode: 2, files: [] };
|
|
23172
23530
|
}
|
|
23173
|
-
const includeGenericBlocks =
|
|
23174
|
-
const linkOptions =
|
|
23175
|
-
|
|
23176
|
-
localeField: input.localeField ?? defaults.localeField,
|
|
23177
|
-
slugField: input.slugField ?? defaults.slugField,
|
|
23178
|
-
keyField: input.keyField ?? defaults.keyField,
|
|
23179
|
-
defaultLocale: input.defaultLocale ?? defaults.defaultLocale
|
|
23180
|
-
});
|
|
23181
|
-
const seoConfig = await loadSeoConfig({
|
|
23182
|
-
cwd: defaults.cwd,
|
|
23183
|
-
seoConfig: input.seoConfig ?? defaults.seoConfig,
|
|
23184
|
-
noSeo: input.noSeo ?? defaults.noSeo
|
|
23185
|
-
});
|
|
23531
|
+
const includeGenericBlocks = config2.includeGenericBlocks;
|
|
23532
|
+
const linkOptions = config2.resolveLinkOptions();
|
|
23533
|
+
const seoConfig = await config2.loadSeo();
|
|
23186
23534
|
const { files, scan } = await loadContentProject2({
|
|
23187
23535
|
cmd: "doctor",
|
|
23188
|
-
positionals:
|
|
23189
|
-
cwd:
|
|
23190
|
-
registry:
|
|
23536
|
+
positionals: config2.globs,
|
|
23537
|
+
cwd: config2.cwd,
|
|
23538
|
+
registry: config2.registry,
|
|
23191
23539
|
includeGenericBlocks,
|
|
23192
23540
|
linkOptions,
|
|
23193
23541
|
scan: { minSectionWords, seoConfig: seoConfig.config, seoConfigPath: seoConfig.path }
|
|
@@ -23212,8 +23560,8 @@ async function doctorOnce(input, io) {
|
|
|
23212
23560
|
io.stdout(
|
|
23213
23561
|
formatReport(
|
|
23214
23562
|
report,
|
|
23215
|
-
|
|
23216
|
-
|
|
23563
|
+
config2.globs,
|
|
23564
|
+
config2.registry,
|
|
23217
23565
|
includeGenericBlocks,
|
|
23218
23566
|
linkOptions,
|
|
23219
23567
|
hasAliases(scan.linkInputs)
|
|
@@ -23265,12 +23613,12 @@ async function watchDoctor(input, io, initialFiles) {
|
|
|
23265
23613
|
}
|
|
23266
23614
|
}
|
|
23267
23615
|
io.stdout("\nWatching for changes\u2026 Press Ctrl+C to stop.");
|
|
23268
|
-
return new Promise((
|
|
23616
|
+
return new Promise((resolve5) => {
|
|
23269
23617
|
const stop = () => {
|
|
23270
23618
|
close();
|
|
23271
23619
|
process.off("SIGINT", stop);
|
|
23272
23620
|
process.off("SIGTERM", stop);
|
|
23273
|
-
|
|
23621
|
+
resolve5(0);
|
|
23274
23622
|
};
|
|
23275
23623
|
process.once("SIGINT", stop);
|
|
23276
23624
|
process.once("SIGTERM", stop);
|
|
@@ -23334,16 +23682,16 @@ async function skillDriftFindings(files) {
|
|
|
23334
23682
|
for (const skill of SHIPPED_SKILLS) {
|
|
23335
23683
|
const shipped = skillVersion2(skill.content);
|
|
23336
23684
|
if (!shipped.value) continue;
|
|
23337
|
-
const
|
|
23338
|
-
if (!existsSync7(
|
|
23339
|
-
const installedContent = await readFile5(
|
|
23685
|
+
const path4 = join8(root, ".claude/skills", skill.name, "SKILL.md");
|
|
23686
|
+
if (!existsSync7(path4)) continue;
|
|
23687
|
+
const installedContent = await readFile5(path4, "utf8");
|
|
23340
23688
|
const installed = skillVersion2(installedContent);
|
|
23341
23689
|
if (installed.value === shipped.value) continue;
|
|
23342
23690
|
findings.push({
|
|
23343
23691
|
severity: "warning",
|
|
23344
23692
|
source: "agents",
|
|
23345
23693
|
code: "CB_SKILL_DRIFT",
|
|
23346
|
-
file:
|
|
23694
|
+
file: path4,
|
|
23347
23695
|
line: installed.line ?? 1,
|
|
23348
23696
|
column: 1,
|
|
23349
23697
|
message: `${skill.name} skill is stale (installed version ${installed.value ?? "unknown"}, package ships ${shipped.value}).`,
|
|
@@ -23501,10 +23849,8 @@ var init_doctor = __esm({
|
|
|
23501
23849
|
"use strict";
|
|
23502
23850
|
init_dist();
|
|
23503
23851
|
init_cli_format();
|
|
23852
|
+
init_command_config();
|
|
23504
23853
|
init_content_project();
|
|
23505
|
-
init_link_options();
|
|
23506
|
-
init_seo_config();
|
|
23507
|
-
init_script_defaults();
|
|
23508
23854
|
init_SKILL();
|
|
23509
23855
|
init_SKILL2();
|
|
23510
23856
|
SHIPPED_SKILLS = [
|
|
@@ -23521,35 +23867,25 @@ __export(brief_exports, {
|
|
|
23521
23867
|
});
|
|
23522
23868
|
import { glob as glob2 } from "tinyglobby";
|
|
23523
23869
|
async function briefCommand(input, io) {
|
|
23524
|
-
const
|
|
23525
|
-
const seoConfig = await
|
|
23526
|
-
cwd: defaults.cwd,
|
|
23527
|
-
seoConfig: input.seoConfig ?? defaults.seoConfig,
|
|
23528
|
-
noSeo: defaults.noSeo
|
|
23529
|
-
});
|
|
23870
|
+
const config2 = await resolveContentCommandConfig("brief", input);
|
|
23871
|
+
const seoConfig = await config2.loadSeo();
|
|
23530
23872
|
if (!seoConfig.config) {
|
|
23531
23873
|
io.stderr(
|
|
23532
23874
|
"brief: no SEO config found. Add contentbit.seo.config.ts or pass --seo-config <path>."
|
|
23533
23875
|
);
|
|
23534
23876
|
return 2;
|
|
23535
23877
|
}
|
|
23536
|
-
const includeGenericBlocks =
|
|
23537
|
-
const globs =
|
|
23878
|
+
const includeGenericBlocks = config2.includeGenericBlocks;
|
|
23879
|
+
const globs = config2.globs.length > 0 ? config2.globs : await defaultBriefGlobs(config2.cwd);
|
|
23538
23880
|
const { scan } = await loadContentProject2({
|
|
23539
23881
|
cmd: "brief",
|
|
23540
23882
|
positionals: globs,
|
|
23541
|
-
cwd:
|
|
23542
|
-
registry:
|
|
23883
|
+
cwd: config2.cwd,
|
|
23884
|
+
registry: config2.registry,
|
|
23543
23885
|
includeGenericBlocks,
|
|
23544
|
-
linkOptions:
|
|
23545
|
-
linkResolve: input.linkResolve ?? defaults.linkResolve,
|
|
23546
|
-
localeField: input.localeField ?? defaults.localeField,
|
|
23547
|
-
slugField: input.slugField ?? defaults.slugField,
|
|
23548
|
-
keyField: input.keyField ?? defaults.keyField,
|
|
23549
|
-
defaultLocale: input.defaultLocale ?? defaults.defaultLocale
|
|
23550
|
-
}),
|
|
23886
|
+
linkOptions: config2.resolveLinkOptions(),
|
|
23551
23887
|
scan: { seoConfig: seoConfig.config, seoConfigPath: seoConfig.path },
|
|
23552
|
-
allowEmpty:
|
|
23888
|
+
allowEmpty: true
|
|
23553
23889
|
});
|
|
23554
23890
|
if (!scan.seo) {
|
|
23555
23891
|
io.stderr("brief: SEO scan did not produce a result.");
|
|
@@ -23580,93 +23916,1499 @@ var init_brief = __esm({
|
|
|
23580
23916
|
"src/commands/brief.ts"() {
|
|
23581
23917
|
"use strict";
|
|
23582
23918
|
init_dist();
|
|
23919
|
+
init_command_config();
|
|
23583
23920
|
init_content_project();
|
|
23584
|
-
init_link_options();
|
|
23585
|
-
init_seo_config();
|
|
23586
|
-
init_script_defaults();
|
|
23587
23921
|
DEFAULT_BRIEF_GLOBS = ["content/**/*.{md,mdx}"];
|
|
23588
23922
|
}
|
|
23589
23923
|
});
|
|
23590
23924
|
|
|
23591
|
-
//
|
|
23592
|
-
|
|
23593
|
-
|
|
23594
|
-
|
|
23595
|
-
|
|
23596
|
-
|
|
23597
|
-
|
|
23598
|
-
|
|
23599
|
-
|
|
23600
|
-
|
|
23601
|
-
|
|
23602
|
-
|
|
23603
|
-
|
|
23604
|
-
|
|
23605
|
-
|
|
23606
|
-
|
|
23925
|
+
// ../../node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/lib/errors.js
|
|
23926
|
+
import v8 from "node:v8";
|
|
23927
|
+
import assert2 from "node:assert";
|
|
23928
|
+
import { format, inspect } from "node:util";
|
|
23929
|
+
function formatList(array2, type = "and") {
|
|
23930
|
+
return array2.length < 3 ? array2.join(` ${type} `) : `${array2.slice(0, -1).join(", ")}, ${type} ${array2[array2.length - 1]}`;
|
|
23931
|
+
}
|
|
23932
|
+
function createError(sym, value, constructor) {
|
|
23933
|
+
messages.set(sym, value);
|
|
23934
|
+
return makeNodeErrorWithCode(constructor, sym);
|
|
23935
|
+
}
|
|
23936
|
+
function makeNodeErrorWithCode(Base, key) {
|
|
23937
|
+
return NodeError;
|
|
23938
|
+
function NodeError(...parameters) {
|
|
23939
|
+
const limit = Error.stackTraceLimit;
|
|
23940
|
+
if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0;
|
|
23941
|
+
const error51 = new Base();
|
|
23942
|
+
if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = limit;
|
|
23943
|
+
const message = getMessage(key, parameters, error51);
|
|
23944
|
+
Object.defineProperties(error51, {
|
|
23945
|
+
// Note: no need to implement `kIsNodeError` symbol, would be hard,
|
|
23946
|
+
// probably.
|
|
23947
|
+
message: {
|
|
23948
|
+
value: message,
|
|
23949
|
+
enumerable: false,
|
|
23950
|
+
writable: true,
|
|
23951
|
+
configurable: true
|
|
23952
|
+
},
|
|
23953
|
+
toString: {
|
|
23954
|
+
/** @this {Error} */
|
|
23955
|
+
value() {
|
|
23956
|
+
return `${this.name} [${key}]: ${this.message}`;
|
|
23957
|
+
},
|
|
23958
|
+
enumerable: false,
|
|
23959
|
+
writable: true,
|
|
23960
|
+
configurable: true
|
|
23961
|
+
}
|
|
23962
|
+
});
|
|
23963
|
+
captureLargerStackTrace(error51);
|
|
23964
|
+
error51.code = key;
|
|
23965
|
+
return error51;
|
|
23607
23966
|
}
|
|
23608
|
-
|
|
23609
|
-
|
|
23610
|
-
cwd: defaults.cwd,
|
|
23611
|
-
seoConfig: input.seoConfig ?? defaults.seoConfig,
|
|
23612
|
-
noSeo: input.noSeo ?? defaults.noSeo
|
|
23613
|
-
});
|
|
23614
|
-
let startStudio;
|
|
23967
|
+
}
|
|
23968
|
+
function isErrorStackTraceLimitWritable() {
|
|
23615
23969
|
try {
|
|
23616
|
-
|
|
23617
|
-
|
|
23618
|
-
} catch (error51) {
|
|
23619
|
-
if (isMissingStudio(error51)) {
|
|
23620
|
-
throw new Error(
|
|
23621
|
-
"Studio is installed separately to keep the base CLI lightweight. Install it with your package manager, for example: pnpm add -D @contentbit/studio"
|
|
23622
|
-
);
|
|
23970
|
+
if (v8.startupSnapshot.isBuildingSnapshot()) {
|
|
23971
|
+
return false;
|
|
23623
23972
|
}
|
|
23624
|
-
|
|
23973
|
+
} catch {
|
|
23625
23974
|
}
|
|
23626
|
-
const
|
|
23627
|
-
|
|
23628
|
-
|
|
23629
|
-
|
|
23630
|
-
|
|
23631
|
-
|
|
23632
|
-
|
|
23633
|
-
|
|
23634
|
-
|
|
23635
|
-
|
|
23636
|
-
|
|
23637
|
-
|
|
23638
|
-
|
|
23639
|
-
|
|
23640
|
-
|
|
23641
|
-
|
|
23642
|
-
|
|
23643
|
-
|
|
23644
|
-
|
|
23645
|
-
|
|
23646
|
-
|
|
23647
|
-
|
|
23648
|
-
|
|
23649
|
-
|
|
23650
|
-
|
|
23651
|
-
|
|
23652
|
-
|
|
23653
|
-
|
|
23975
|
+
const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
|
|
23976
|
+
if (desc === void 0) {
|
|
23977
|
+
return Object.isExtensible(Error);
|
|
23978
|
+
}
|
|
23979
|
+
return own.call(desc, "writable") && desc.writable !== void 0 ? desc.writable : desc.set !== void 0;
|
|
23980
|
+
}
|
|
23981
|
+
function hideStackFrames(wrappedFunction) {
|
|
23982
|
+
const hidden = nodeInternalPrefix + wrappedFunction.name;
|
|
23983
|
+
Object.defineProperty(wrappedFunction, "name", { value: hidden });
|
|
23984
|
+
return wrappedFunction;
|
|
23985
|
+
}
|
|
23986
|
+
function getMessage(key, parameters, self) {
|
|
23987
|
+
const message = messages.get(key);
|
|
23988
|
+
assert2.ok(message !== void 0, "expected `message` to be found");
|
|
23989
|
+
if (typeof message === "function") {
|
|
23990
|
+
assert2.ok(
|
|
23991
|
+
message.length <= parameters.length,
|
|
23992
|
+
// Default options do not count.
|
|
23993
|
+
`Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`
|
|
23994
|
+
);
|
|
23995
|
+
return Reflect.apply(message, self, parameters);
|
|
23996
|
+
}
|
|
23997
|
+
const regex = /%[dfijoOs]/g;
|
|
23998
|
+
let expectedLength = 0;
|
|
23999
|
+
while (regex.exec(message) !== null) expectedLength++;
|
|
24000
|
+
assert2.ok(
|
|
24001
|
+
expectedLength === parameters.length,
|
|
24002
|
+
`Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`
|
|
23654
24003
|
);
|
|
23655
|
-
|
|
23656
|
-
|
|
23657
|
-
|
|
23658
|
-
process.once("SIGINT", close);
|
|
23659
|
-
process.once("SIGTERM", close);
|
|
23660
|
-
await server.closed;
|
|
23661
|
-
process.off("SIGINT", close);
|
|
23662
|
-
process.off("SIGTERM", close);
|
|
23663
|
-
return 0;
|
|
23664
|
-
}
|
|
23665
|
-
function isMissingStudio(error51) {
|
|
23666
|
-
return error51 instanceof Error && "code" in error51 && error51.code === "ERR_MODULE_NOT_FOUND" && error51.message.includes("@contentbit/studio");
|
|
24004
|
+
if (parameters.length === 0) return message;
|
|
24005
|
+
parameters.unshift(message);
|
|
24006
|
+
return Reflect.apply(format, null, parameters);
|
|
23667
24007
|
}
|
|
23668
|
-
function
|
|
23669
|
-
if (value ===
|
|
24008
|
+
function determineSpecificType(value) {
|
|
24009
|
+
if (value === null || value === void 0) {
|
|
24010
|
+
return String(value);
|
|
24011
|
+
}
|
|
24012
|
+
if (typeof value === "function" && value.name) {
|
|
24013
|
+
return `function ${value.name}`;
|
|
24014
|
+
}
|
|
24015
|
+
if (typeof value === "object") {
|
|
24016
|
+
if (value.constructor && value.constructor.name) {
|
|
24017
|
+
return `an instance of ${value.constructor.name}`;
|
|
24018
|
+
}
|
|
24019
|
+
return `${inspect(value, { depth: -1 })}`;
|
|
24020
|
+
}
|
|
24021
|
+
let inspected = inspect(value, { colors: false });
|
|
24022
|
+
if (inspected.length > 28) {
|
|
24023
|
+
inspected = `${inspected.slice(0, 25)}...`;
|
|
24024
|
+
}
|
|
24025
|
+
return `type ${typeof value} (${inspected})`;
|
|
24026
|
+
}
|
|
24027
|
+
var own, classRegExp, kTypes, codes, messages, nodeInternalPrefix, userStackTraceLimit, captureLargerStackTrace;
|
|
24028
|
+
var init_errors3 = __esm({
|
|
24029
|
+
"../../node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/lib/errors.js"() {
|
|
24030
|
+
own = {}.hasOwnProperty;
|
|
24031
|
+
classRegExp = /^([A-Z][a-z\d]*)+$/;
|
|
24032
|
+
kTypes = /* @__PURE__ */ new Set([
|
|
24033
|
+
"string",
|
|
24034
|
+
"function",
|
|
24035
|
+
"number",
|
|
24036
|
+
"object",
|
|
24037
|
+
// Accept 'Function' and 'Object' as alternative to the lower cased version.
|
|
24038
|
+
"Function",
|
|
24039
|
+
"Object",
|
|
24040
|
+
"boolean",
|
|
24041
|
+
"bigint",
|
|
24042
|
+
"symbol"
|
|
24043
|
+
]);
|
|
24044
|
+
codes = {};
|
|
24045
|
+
messages = /* @__PURE__ */ new Map();
|
|
24046
|
+
nodeInternalPrefix = "__node_internal_";
|
|
24047
|
+
codes.ERR_INVALID_ARG_TYPE = createError(
|
|
24048
|
+
"ERR_INVALID_ARG_TYPE",
|
|
24049
|
+
/**
|
|
24050
|
+
* @param {string} name
|
|
24051
|
+
* @param {Array<string> | string} expected
|
|
24052
|
+
* @param {unknown} actual
|
|
24053
|
+
*/
|
|
24054
|
+
(name, expected, actual) => {
|
|
24055
|
+
assert2.ok(typeof name === "string", "'name' must be a string");
|
|
24056
|
+
if (!Array.isArray(expected)) {
|
|
24057
|
+
expected = [expected];
|
|
24058
|
+
}
|
|
24059
|
+
let message = "The ";
|
|
24060
|
+
if (name.endsWith(" argument")) {
|
|
24061
|
+
message += `${name} `;
|
|
24062
|
+
} else {
|
|
24063
|
+
const type = name.includes(".") ? "property" : "argument";
|
|
24064
|
+
message += `"${name}" ${type} `;
|
|
24065
|
+
}
|
|
24066
|
+
message += "must be ";
|
|
24067
|
+
const types = [];
|
|
24068
|
+
const instances = [];
|
|
24069
|
+
const other = [];
|
|
24070
|
+
for (const value of expected) {
|
|
24071
|
+
assert2.ok(
|
|
24072
|
+
typeof value === "string",
|
|
24073
|
+
"All expected entries have to be of type string"
|
|
24074
|
+
);
|
|
24075
|
+
if (kTypes.has(value)) {
|
|
24076
|
+
types.push(value.toLowerCase());
|
|
24077
|
+
} else if (classRegExp.exec(value) === null) {
|
|
24078
|
+
assert2.ok(
|
|
24079
|
+
value !== "object",
|
|
24080
|
+
'The value "object" should be written as "Object"'
|
|
24081
|
+
);
|
|
24082
|
+
other.push(value);
|
|
24083
|
+
} else {
|
|
24084
|
+
instances.push(value);
|
|
24085
|
+
}
|
|
24086
|
+
}
|
|
24087
|
+
if (instances.length > 0) {
|
|
24088
|
+
const pos = types.indexOf("object");
|
|
24089
|
+
if (pos !== -1) {
|
|
24090
|
+
types.slice(pos, 1);
|
|
24091
|
+
instances.push("Object");
|
|
24092
|
+
}
|
|
24093
|
+
}
|
|
24094
|
+
if (types.length > 0) {
|
|
24095
|
+
message += `${types.length > 1 ? "one of type" : "of type"} ${formatList(
|
|
24096
|
+
types,
|
|
24097
|
+
"or"
|
|
24098
|
+
)}`;
|
|
24099
|
+
if (instances.length > 0 || other.length > 0) message += " or ";
|
|
24100
|
+
}
|
|
24101
|
+
if (instances.length > 0) {
|
|
24102
|
+
message += `an instance of ${formatList(instances, "or")}`;
|
|
24103
|
+
if (other.length > 0) message += " or ";
|
|
24104
|
+
}
|
|
24105
|
+
if (other.length > 0) {
|
|
24106
|
+
if (other.length > 1) {
|
|
24107
|
+
message += `one of ${formatList(other, "or")}`;
|
|
24108
|
+
} else {
|
|
24109
|
+
if (other[0].toLowerCase() !== other[0]) message += "an ";
|
|
24110
|
+
message += `${other[0]}`;
|
|
24111
|
+
}
|
|
24112
|
+
}
|
|
24113
|
+
message += `. Received ${determineSpecificType(actual)}`;
|
|
24114
|
+
return message;
|
|
24115
|
+
},
|
|
24116
|
+
TypeError
|
|
24117
|
+
);
|
|
24118
|
+
codes.ERR_INVALID_MODULE_SPECIFIER = createError(
|
|
24119
|
+
"ERR_INVALID_MODULE_SPECIFIER",
|
|
24120
|
+
/**
|
|
24121
|
+
* @param {string} request
|
|
24122
|
+
* @param {string} reason
|
|
24123
|
+
* @param {string} [base]
|
|
24124
|
+
*/
|
|
24125
|
+
(request, reason, base = void 0) => {
|
|
24126
|
+
return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`;
|
|
24127
|
+
},
|
|
24128
|
+
TypeError
|
|
24129
|
+
);
|
|
24130
|
+
codes.ERR_INVALID_PACKAGE_CONFIG = createError(
|
|
24131
|
+
"ERR_INVALID_PACKAGE_CONFIG",
|
|
24132
|
+
/**
|
|
24133
|
+
* @param {string} path
|
|
24134
|
+
* @param {string} [base]
|
|
24135
|
+
* @param {string} [message]
|
|
24136
|
+
*/
|
|
24137
|
+
(path4, base, message) => {
|
|
24138
|
+
return `Invalid package config ${path4}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
|
|
24139
|
+
},
|
|
24140
|
+
Error
|
|
24141
|
+
);
|
|
24142
|
+
codes.ERR_INVALID_PACKAGE_TARGET = createError(
|
|
24143
|
+
"ERR_INVALID_PACKAGE_TARGET",
|
|
24144
|
+
/**
|
|
24145
|
+
* @param {string} packagePath
|
|
24146
|
+
* @param {string} key
|
|
24147
|
+
* @param {unknown} target
|
|
24148
|
+
* @param {boolean} [isImport=false]
|
|
24149
|
+
* @param {string} [base]
|
|
24150
|
+
*/
|
|
24151
|
+
(packagePath, key, target, isImport = false, base = void 0) => {
|
|
24152
|
+
const relatedError = typeof target === "string" && !isImport && target.length > 0 && !target.startsWith("./");
|
|
24153
|
+
if (key === ".") {
|
|
24154
|
+
assert2.ok(isImport === false);
|
|
24155
|
+
return `Invalid "exports" main target ${JSON.stringify(target)} defined in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? '; targets must start with "./"' : ""}`;
|
|
24156
|
+
}
|
|
24157
|
+
return `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify(
|
|
24158
|
+
target
|
|
24159
|
+
)} defined for '${key}' in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? '; targets must start with "./"' : ""}`;
|
|
24160
|
+
},
|
|
24161
|
+
Error
|
|
24162
|
+
);
|
|
24163
|
+
codes.ERR_MODULE_NOT_FOUND = createError(
|
|
24164
|
+
"ERR_MODULE_NOT_FOUND",
|
|
24165
|
+
/**
|
|
24166
|
+
* @param {string} path
|
|
24167
|
+
* @param {string} base
|
|
24168
|
+
* @param {boolean} [exactUrl]
|
|
24169
|
+
*/
|
|
24170
|
+
(path4, base, exactUrl = false) => {
|
|
24171
|
+
return `Cannot find ${exactUrl ? "module" : "package"} '${path4}' imported from ${base}`;
|
|
24172
|
+
},
|
|
24173
|
+
Error
|
|
24174
|
+
);
|
|
24175
|
+
codes.ERR_NETWORK_IMPORT_DISALLOWED = createError(
|
|
24176
|
+
"ERR_NETWORK_IMPORT_DISALLOWED",
|
|
24177
|
+
"import of '%s' by %s is not supported: %s",
|
|
24178
|
+
Error
|
|
24179
|
+
);
|
|
24180
|
+
codes.ERR_PACKAGE_IMPORT_NOT_DEFINED = createError(
|
|
24181
|
+
"ERR_PACKAGE_IMPORT_NOT_DEFINED",
|
|
24182
|
+
/**
|
|
24183
|
+
* @param {string} specifier
|
|
24184
|
+
* @param {string} packagePath
|
|
24185
|
+
* @param {string} base
|
|
24186
|
+
*/
|
|
24187
|
+
(specifier, packagePath, base) => {
|
|
24188
|
+
return `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath}package.json` : ""} imported from ${base}`;
|
|
24189
|
+
},
|
|
24190
|
+
TypeError
|
|
24191
|
+
);
|
|
24192
|
+
codes.ERR_PACKAGE_PATH_NOT_EXPORTED = createError(
|
|
24193
|
+
"ERR_PACKAGE_PATH_NOT_EXPORTED",
|
|
24194
|
+
/**
|
|
24195
|
+
* @param {string} packagePath
|
|
24196
|
+
* @param {string} subpath
|
|
24197
|
+
* @param {string} [base]
|
|
24198
|
+
*/
|
|
24199
|
+
(packagePath, subpath, base = void 0) => {
|
|
24200
|
+
if (subpath === ".")
|
|
24201
|
+
return `No "exports" main defined in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
|
|
24202
|
+
return `Package subpath '${subpath}' is not defined by "exports" in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
|
|
24203
|
+
},
|
|
24204
|
+
Error
|
|
24205
|
+
);
|
|
24206
|
+
codes.ERR_UNSUPPORTED_DIR_IMPORT = createError(
|
|
24207
|
+
"ERR_UNSUPPORTED_DIR_IMPORT",
|
|
24208
|
+
"Directory import '%s' is not supported resolving ES modules imported from %s",
|
|
24209
|
+
Error
|
|
24210
|
+
);
|
|
24211
|
+
codes.ERR_UNSUPPORTED_RESOLVE_REQUEST = createError(
|
|
24212
|
+
"ERR_UNSUPPORTED_RESOLVE_REQUEST",
|
|
24213
|
+
'Failed to resolve module specifier "%s" from "%s": Invalid relative URL or base scheme is not hierarchical.',
|
|
24214
|
+
TypeError
|
|
24215
|
+
);
|
|
24216
|
+
codes.ERR_UNKNOWN_FILE_EXTENSION = createError(
|
|
24217
|
+
"ERR_UNKNOWN_FILE_EXTENSION",
|
|
24218
|
+
/**
|
|
24219
|
+
* @param {string} extension
|
|
24220
|
+
* @param {string} path
|
|
24221
|
+
*/
|
|
24222
|
+
(extension, path4) => {
|
|
24223
|
+
return `Unknown file extension "${extension}" for ${path4}`;
|
|
24224
|
+
},
|
|
24225
|
+
TypeError
|
|
24226
|
+
);
|
|
24227
|
+
codes.ERR_INVALID_ARG_VALUE = createError(
|
|
24228
|
+
"ERR_INVALID_ARG_VALUE",
|
|
24229
|
+
/**
|
|
24230
|
+
* @param {string} name
|
|
24231
|
+
* @param {unknown} value
|
|
24232
|
+
* @param {string} [reason='is invalid']
|
|
24233
|
+
*/
|
|
24234
|
+
(name, value, reason = "is invalid") => {
|
|
24235
|
+
let inspected = inspect(value);
|
|
24236
|
+
if (inspected.length > 128) {
|
|
24237
|
+
inspected = `${inspected.slice(0, 128)}...`;
|
|
24238
|
+
}
|
|
24239
|
+
const type = name.includes(".") ? "property" : "argument";
|
|
24240
|
+
return `The ${type} '${name}' ${reason}. Received ${inspected}`;
|
|
24241
|
+
},
|
|
24242
|
+
TypeError
|
|
24243
|
+
// Note: extra classes have been shaken out.
|
|
24244
|
+
// , RangeError
|
|
24245
|
+
);
|
|
24246
|
+
captureLargerStackTrace = hideStackFrames(
|
|
24247
|
+
/**
|
|
24248
|
+
* @param {Error} error
|
|
24249
|
+
* @returns {Error}
|
|
24250
|
+
*/
|
|
24251
|
+
// @ts-expect-error: fine
|
|
24252
|
+
function(error51) {
|
|
24253
|
+
const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
|
|
24254
|
+
if (stackTraceLimitIsWritable) {
|
|
24255
|
+
userStackTraceLimit = Error.stackTraceLimit;
|
|
24256
|
+
Error.stackTraceLimit = Number.POSITIVE_INFINITY;
|
|
24257
|
+
}
|
|
24258
|
+
Error.captureStackTrace(error51);
|
|
24259
|
+
if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit;
|
|
24260
|
+
return error51;
|
|
24261
|
+
}
|
|
24262
|
+
);
|
|
24263
|
+
}
|
|
24264
|
+
});
|
|
24265
|
+
|
|
24266
|
+
// ../../node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/lib/package-json-reader.js
|
|
24267
|
+
import fs2 from "node:fs";
|
|
24268
|
+
import path2 from "node:path";
|
|
24269
|
+
import { fileURLToPath } from "node:url";
|
|
24270
|
+
function read(jsonPath, { base, specifier }) {
|
|
24271
|
+
const existing = cache.get(jsonPath);
|
|
24272
|
+
if (existing) {
|
|
24273
|
+
return existing;
|
|
24274
|
+
}
|
|
24275
|
+
let string4;
|
|
24276
|
+
try {
|
|
24277
|
+
string4 = fs2.readFileSync(path2.toNamespacedPath(jsonPath), "utf8");
|
|
24278
|
+
} catch (error51) {
|
|
24279
|
+
const exception = (
|
|
24280
|
+
/** @type {ErrnoException} */
|
|
24281
|
+
error51
|
|
24282
|
+
);
|
|
24283
|
+
if (exception.code !== "ENOENT") {
|
|
24284
|
+
throw exception;
|
|
24285
|
+
}
|
|
24286
|
+
}
|
|
24287
|
+
const result = {
|
|
24288
|
+
exists: false,
|
|
24289
|
+
pjsonPath: jsonPath,
|
|
24290
|
+
main: void 0,
|
|
24291
|
+
name: void 0,
|
|
24292
|
+
type: "none",
|
|
24293
|
+
// Ignore unknown types for forwards compatibility
|
|
24294
|
+
exports: void 0,
|
|
24295
|
+
imports: void 0
|
|
24296
|
+
};
|
|
24297
|
+
if (string4 !== void 0) {
|
|
24298
|
+
let parsed;
|
|
24299
|
+
try {
|
|
24300
|
+
parsed = JSON.parse(string4);
|
|
24301
|
+
} catch (error_) {
|
|
24302
|
+
const cause = (
|
|
24303
|
+
/** @type {ErrnoException} */
|
|
24304
|
+
error_
|
|
24305
|
+
);
|
|
24306
|
+
const error51 = new ERR_INVALID_PACKAGE_CONFIG(
|
|
24307
|
+
jsonPath,
|
|
24308
|
+
(base ? `"${specifier}" from ` : "") + fileURLToPath(base || specifier),
|
|
24309
|
+
cause.message
|
|
24310
|
+
);
|
|
24311
|
+
error51.cause = cause;
|
|
24312
|
+
throw error51;
|
|
24313
|
+
}
|
|
24314
|
+
result.exists = true;
|
|
24315
|
+
if (hasOwnProperty.call(parsed, "name") && typeof parsed.name === "string") {
|
|
24316
|
+
result.name = parsed.name;
|
|
24317
|
+
}
|
|
24318
|
+
if (hasOwnProperty.call(parsed, "main") && typeof parsed.main === "string") {
|
|
24319
|
+
result.main = parsed.main;
|
|
24320
|
+
}
|
|
24321
|
+
if (hasOwnProperty.call(parsed, "exports")) {
|
|
24322
|
+
result.exports = parsed.exports;
|
|
24323
|
+
}
|
|
24324
|
+
if (hasOwnProperty.call(parsed, "imports")) {
|
|
24325
|
+
result.imports = parsed.imports;
|
|
24326
|
+
}
|
|
24327
|
+
if (hasOwnProperty.call(parsed, "type") && (parsed.type === "commonjs" || parsed.type === "module")) {
|
|
24328
|
+
result.type = parsed.type;
|
|
24329
|
+
}
|
|
24330
|
+
}
|
|
24331
|
+
cache.set(jsonPath, result);
|
|
24332
|
+
return result;
|
|
24333
|
+
}
|
|
24334
|
+
function getPackageScopeConfig(resolved) {
|
|
24335
|
+
let packageJSONUrl = new URL("package.json", resolved);
|
|
24336
|
+
while (true) {
|
|
24337
|
+
const packageJSONPath2 = packageJSONUrl.pathname;
|
|
24338
|
+
if (packageJSONPath2.endsWith("node_modules/package.json")) {
|
|
24339
|
+
break;
|
|
24340
|
+
}
|
|
24341
|
+
const packageConfig = read(fileURLToPath(packageJSONUrl), {
|
|
24342
|
+
specifier: resolved
|
|
24343
|
+
});
|
|
24344
|
+
if (packageConfig.exists) {
|
|
24345
|
+
return packageConfig;
|
|
24346
|
+
}
|
|
24347
|
+
const lastPackageJSONUrl = packageJSONUrl;
|
|
24348
|
+
packageJSONUrl = new URL("../package.json", packageJSONUrl);
|
|
24349
|
+
if (packageJSONUrl.pathname === lastPackageJSONUrl.pathname) {
|
|
24350
|
+
break;
|
|
24351
|
+
}
|
|
24352
|
+
}
|
|
24353
|
+
const packageJSONPath = fileURLToPath(packageJSONUrl);
|
|
24354
|
+
return {
|
|
24355
|
+
pjsonPath: packageJSONPath,
|
|
24356
|
+
exists: false,
|
|
24357
|
+
type: "none"
|
|
24358
|
+
};
|
|
24359
|
+
}
|
|
24360
|
+
function getPackageType(url2) {
|
|
24361
|
+
return getPackageScopeConfig(url2).type;
|
|
24362
|
+
}
|
|
24363
|
+
var hasOwnProperty, ERR_INVALID_PACKAGE_CONFIG, cache;
|
|
24364
|
+
var init_package_json_reader = __esm({
|
|
24365
|
+
"../../node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/lib/package-json-reader.js"() {
|
|
24366
|
+
init_errors3();
|
|
24367
|
+
hasOwnProperty = {}.hasOwnProperty;
|
|
24368
|
+
({ ERR_INVALID_PACKAGE_CONFIG } = codes);
|
|
24369
|
+
cache = /* @__PURE__ */ new Map();
|
|
24370
|
+
}
|
|
24371
|
+
});
|
|
24372
|
+
|
|
24373
|
+
// ../../node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/lib/get-format.js
|
|
24374
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
24375
|
+
function mimeToFormat(mime) {
|
|
24376
|
+
if (mime && /\s*(text|application)\/javascript\s*(;\s*charset=utf-?8\s*)?/i.test(mime))
|
|
24377
|
+
return "module";
|
|
24378
|
+
if (mime === "application/json") return "json";
|
|
24379
|
+
return null;
|
|
24380
|
+
}
|
|
24381
|
+
function getDataProtocolModuleFormat(parsed) {
|
|
24382
|
+
const { 1: mime } = /^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec(
|
|
24383
|
+
parsed.pathname
|
|
24384
|
+
) || [null, null, null];
|
|
24385
|
+
return mimeToFormat(mime);
|
|
24386
|
+
}
|
|
24387
|
+
function extname(url2) {
|
|
24388
|
+
const pathname = url2.pathname;
|
|
24389
|
+
let index = pathname.length;
|
|
24390
|
+
while (index--) {
|
|
24391
|
+
const code = pathname.codePointAt(index);
|
|
24392
|
+
if (code === 47) {
|
|
24393
|
+
return "";
|
|
24394
|
+
}
|
|
24395
|
+
if (code === 46) {
|
|
24396
|
+
return pathname.codePointAt(index - 1) === 47 ? "" : pathname.slice(index);
|
|
24397
|
+
}
|
|
24398
|
+
}
|
|
24399
|
+
return "";
|
|
24400
|
+
}
|
|
24401
|
+
function getFileProtocolModuleFormat(url2, _context, ignoreErrors) {
|
|
24402
|
+
const value = extname(url2);
|
|
24403
|
+
if (value === ".js") {
|
|
24404
|
+
const packageType = getPackageType(url2);
|
|
24405
|
+
if (packageType !== "none") {
|
|
24406
|
+
return packageType;
|
|
24407
|
+
}
|
|
24408
|
+
return "commonjs";
|
|
24409
|
+
}
|
|
24410
|
+
if (value === "") {
|
|
24411
|
+
const packageType = getPackageType(url2);
|
|
24412
|
+
if (packageType === "none" || packageType === "commonjs") {
|
|
24413
|
+
return "commonjs";
|
|
24414
|
+
}
|
|
24415
|
+
return "module";
|
|
24416
|
+
}
|
|
24417
|
+
const format2 = extensionFormatMap[value];
|
|
24418
|
+
if (format2) return format2;
|
|
24419
|
+
if (ignoreErrors) {
|
|
24420
|
+
return void 0;
|
|
24421
|
+
}
|
|
24422
|
+
const filepath = fileURLToPath2(url2);
|
|
24423
|
+
throw new ERR_UNKNOWN_FILE_EXTENSION(value, filepath);
|
|
24424
|
+
}
|
|
24425
|
+
function getHttpProtocolModuleFormat() {
|
|
24426
|
+
}
|
|
24427
|
+
function defaultGetFormatWithoutErrors(url2, context) {
|
|
24428
|
+
const protocol = url2.protocol;
|
|
24429
|
+
if (!hasOwnProperty2.call(protocolHandlers, protocol)) {
|
|
24430
|
+
return null;
|
|
24431
|
+
}
|
|
24432
|
+
return protocolHandlers[protocol](url2, context, true) || null;
|
|
24433
|
+
}
|
|
24434
|
+
var ERR_UNKNOWN_FILE_EXTENSION, hasOwnProperty2, extensionFormatMap, protocolHandlers;
|
|
24435
|
+
var init_get_format = __esm({
|
|
24436
|
+
"../../node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/lib/get-format.js"() {
|
|
24437
|
+
init_package_json_reader();
|
|
24438
|
+
init_errors3();
|
|
24439
|
+
({ ERR_UNKNOWN_FILE_EXTENSION } = codes);
|
|
24440
|
+
hasOwnProperty2 = {}.hasOwnProperty;
|
|
24441
|
+
extensionFormatMap = {
|
|
24442
|
+
// @ts-expect-error: hush.
|
|
24443
|
+
__proto__: null,
|
|
24444
|
+
".cjs": "commonjs",
|
|
24445
|
+
".js": "module",
|
|
24446
|
+
".json": "json",
|
|
24447
|
+
".mjs": "module"
|
|
24448
|
+
};
|
|
24449
|
+
protocolHandlers = {
|
|
24450
|
+
// @ts-expect-error: hush.
|
|
24451
|
+
__proto__: null,
|
|
24452
|
+
"data:": getDataProtocolModuleFormat,
|
|
24453
|
+
"file:": getFileProtocolModuleFormat,
|
|
24454
|
+
"http:": getHttpProtocolModuleFormat,
|
|
24455
|
+
"https:": getHttpProtocolModuleFormat,
|
|
24456
|
+
"node:"() {
|
|
24457
|
+
return "builtin";
|
|
24458
|
+
}
|
|
24459
|
+
};
|
|
24460
|
+
}
|
|
24461
|
+
});
|
|
24462
|
+
|
|
24463
|
+
// ../../node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/lib/utils.js
|
|
24464
|
+
function getDefaultConditions() {
|
|
24465
|
+
return DEFAULT_CONDITIONS;
|
|
24466
|
+
}
|
|
24467
|
+
function getDefaultConditionsSet() {
|
|
24468
|
+
return DEFAULT_CONDITIONS_SET;
|
|
24469
|
+
}
|
|
24470
|
+
function getConditionsSet(conditions) {
|
|
24471
|
+
if (conditions !== void 0 && conditions !== getDefaultConditions()) {
|
|
24472
|
+
if (!Array.isArray(conditions)) {
|
|
24473
|
+
throw new ERR_INVALID_ARG_VALUE(
|
|
24474
|
+
"conditions",
|
|
24475
|
+
conditions,
|
|
24476
|
+
"expected an array"
|
|
24477
|
+
);
|
|
24478
|
+
}
|
|
24479
|
+
return new Set(conditions);
|
|
24480
|
+
}
|
|
24481
|
+
return getDefaultConditionsSet();
|
|
24482
|
+
}
|
|
24483
|
+
var ERR_INVALID_ARG_VALUE, DEFAULT_CONDITIONS, DEFAULT_CONDITIONS_SET;
|
|
24484
|
+
var init_utils = __esm({
|
|
24485
|
+
"../../node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/lib/utils.js"() {
|
|
24486
|
+
init_errors3();
|
|
24487
|
+
({ ERR_INVALID_ARG_VALUE } = codes);
|
|
24488
|
+
DEFAULT_CONDITIONS = Object.freeze(["node", "import"]);
|
|
24489
|
+
DEFAULT_CONDITIONS_SET = new Set(DEFAULT_CONDITIONS);
|
|
24490
|
+
}
|
|
24491
|
+
});
|
|
24492
|
+
|
|
24493
|
+
// ../../node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/lib/resolve.js
|
|
24494
|
+
import assert3 from "node:assert";
|
|
24495
|
+
import { statSync, realpathSync } from "node:fs";
|
|
24496
|
+
import process4 from "node:process";
|
|
24497
|
+
import { fileURLToPath as fileURLToPath3, pathToFileURL as pathToFileURL4 } from "node:url";
|
|
24498
|
+
import path3 from "node:path";
|
|
24499
|
+
import { builtinModules } from "node:module";
|
|
24500
|
+
function emitInvalidSegmentDeprecation(target, request, match, packageJsonUrl, internal, base, isTarget) {
|
|
24501
|
+
if (process4.noDeprecation) {
|
|
24502
|
+
return;
|
|
24503
|
+
}
|
|
24504
|
+
const pjsonPath = fileURLToPath3(packageJsonUrl);
|
|
24505
|
+
const double = doubleSlashRegEx.exec(isTarget ? target : request) !== null;
|
|
24506
|
+
process4.emitWarning(
|
|
24507
|
+
`Use of deprecated ${double ? "double slash" : "leading or trailing slash matching"} resolving "${target}" for module request "${request}" ${request === match ? "" : `matched to "${match}" `}in the "${internal ? "imports" : "exports"}" field module resolution of the package at ${pjsonPath}${base ? ` imported from ${fileURLToPath3(base)}` : ""}.`,
|
|
24508
|
+
"DeprecationWarning",
|
|
24509
|
+
"DEP0166"
|
|
24510
|
+
);
|
|
24511
|
+
}
|
|
24512
|
+
function emitLegacyIndexDeprecation(url2, packageJsonUrl, base, main) {
|
|
24513
|
+
if (process4.noDeprecation) {
|
|
24514
|
+
return;
|
|
24515
|
+
}
|
|
24516
|
+
const format2 = defaultGetFormatWithoutErrors(url2, { parentURL: base.href });
|
|
24517
|
+
if (format2 !== "module") return;
|
|
24518
|
+
const urlPath = fileURLToPath3(url2.href);
|
|
24519
|
+
const packagePath = fileURLToPath3(new URL(".", packageJsonUrl));
|
|
24520
|
+
const basePath = fileURLToPath3(base);
|
|
24521
|
+
if (!main) {
|
|
24522
|
+
process4.emitWarning(
|
|
24523
|
+
`No "main" or "exports" field defined in the package.json for ${packagePath} resolving the main entry point "${urlPath.slice(
|
|
24524
|
+
packagePath.length
|
|
24525
|
+
)}", imported from ${basePath}.
|
|
24526
|
+
Default "index" lookups for the main are deprecated for ES modules.`,
|
|
24527
|
+
"DeprecationWarning",
|
|
24528
|
+
"DEP0151"
|
|
24529
|
+
);
|
|
24530
|
+
} else if (path3.resolve(packagePath, main) !== urlPath) {
|
|
24531
|
+
process4.emitWarning(
|
|
24532
|
+
`Package ${packagePath} has a "main" field set to "${main}", excluding the full filename and extension to the resolved file at "${urlPath.slice(
|
|
24533
|
+
packagePath.length
|
|
24534
|
+
)}", imported from ${basePath}.
|
|
24535
|
+
Automatic extension resolution of the "main" field is deprecated for ES modules.`,
|
|
24536
|
+
"DeprecationWarning",
|
|
24537
|
+
"DEP0151"
|
|
24538
|
+
);
|
|
24539
|
+
}
|
|
24540
|
+
}
|
|
24541
|
+
function tryStatSync(path4) {
|
|
24542
|
+
try {
|
|
24543
|
+
return statSync(path4);
|
|
24544
|
+
} catch {
|
|
24545
|
+
}
|
|
24546
|
+
}
|
|
24547
|
+
function fileExists(url2) {
|
|
24548
|
+
const stats = statSync(url2, { throwIfNoEntry: false });
|
|
24549
|
+
const isFile = stats ? stats.isFile() : void 0;
|
|
24550
|
+
return isFile === null || isFile === void 0 ? false : isFile;
|
|
24551
|
+
}
|
|
24552
|
+
function legacyMainResolve(packageJsonUrl, packageConfig, base) {
|
|
24553
|
+
let guess;
|
|
24554
|
+
if (packageConfig.main !== void 0) {
|
|
24555
|
+
guess = new URL(packageConfig.main, packageJsonUrl);
|
|
24556
|
+
if (fileExists(guess)) return guess;
|
|
24557
|
+
const tries2 = [
|
|
24558
|
+
`./${packageConfig.main}.js`,
|
|
24559
|
+
`./${packageConfig.main}.json`,
|
|
24560
|
+
`./${packageConfig.main}.node`,
|
|
24561
|
+
`./${packageConfig.main}/index.js`,
|
|
24562
|
+
`./${packageConfig.main}/index.json`,
|
|
24563
|
+
`./${packageConfig.main}/index.node`
|
|
24564
|
+
];
|
|
24565
|
+
let i2 = -1;
|
|
24566
|
+
while (++i2 < tries2.length) {
|
|
24567
|
+
guess = new URL(tries2[i2], packageJsonUrl);
|
|
24568
|
+
if (fileExists(guess)) break;
|
|
24569
|
+
guess = void 0;
|
|
24570
|
+
}
|
|
24571
|
+
if (guess) {
|
|
24572
|
+
emitLegacyIndexDeprecation(
|
|
24573
|
+
guess,
|
|
24574
|
+
packageJsonUrl,
|
|
24575
|
+
base,
|
|
24576
|
+
packageConfig.main
|
|
24577
|
+
);
|
|
24578
|
+
return guess;
|
|
24579
|
+
}
|
|
24580
|
+
}
|
|
24581
|
+
const tries = ["./index.js", "./index.json", "./index.node"];
|
|
24582
|
+
let i = -1;
|
|
24583
|
+
while (++i < tries.length) {
|
|
24584
|
+
guess = new URL(tries[i], packageJsonUrl);
|
|
24585
|
+
if (fileExists(guess)) break;
|
|
24586
|
+
guess = void 0;
|
|
24587
|
+
}
|
|
24588
|
+
if (guess) {
|
|
24589
|
+
emitLegacyIndexDeprecation(guess, packageJsonUrl, base, packageConfig.main);
|
|
24590
|
+
return guess;
|
|
24591
|
+
}
|
|
24592
|
+
throw new ERR_MODULE_NOT_FOUND(
|
|
24593
|
+
fileURLToPath3(new URL(".", packageJsonUrl)),
|
|
24594
|
+
fileURLToPath3(base)
|
|
24595
|
+
);
|
|
24596
|
+
}
|
|
24597
|
+
function finalizeResolution(resolved, base, preserveSymlinks) {
|
|
24598
|
+
if (encodedSeparatorRegEx.exec(resolved.pathname) !== null) {
|
|
24599
|
+
throw new ERR_INVALID_MODULE_SPECIFIER(
|
|
24600
|
+
resolved.pathname,
|
|
24601
|
+
'must not include encoded "/" or "\\" characters',
|
|
24602
|
+
fileURLToPath3(base)
|
|
24603
|
+
);
|
|
24604
|
+
}
|
|
24605
|
+
let filePath;
|
|
24606
|
+
try {
|
|
24607
|
+
filePath = fileURLToPath3(resolved);
|
|
24608
|
+
} catch (error51) {
|
|
24609
|
+
const cause = (
|
|
24610
|
+
/** @type {ErrnoException} */
|
|
24611
|
+
error51
|
|
24612
|
+
);
|
|
24613
|
+
Object.defineProperty(cause, "input", { value: String(resolved) });
|
|
24614
|
+
Object.defineProperty(cause, "module", { value: String(base) });
|
|
24615
|
+
throw cause;
|
|
24616
|
+
}
|
|
24617
|
+
const stats = tryStatSync(
|
|
24618
|
+
filePath.endsWith("/") ? filePath.slice(-1) : filePath
|
|
24619
|
+
);
|
|
24620
|
+
if (stats && stats.isDirectory()) {
|
|
24621
|
+
const error51 = new ERR_UNSUPPORTED_DIR_IMPORT(filePath, fileURLToPath3(base));
|
|
24622
|
+
error51.url = String(resolved);
|
|
24623
|
+
throw error51;
|
|
24624
|
+
}
|
|
24625
|
+
if (!stats || !stats.isFile()) {
|
|
24626
|
+
const error51 = new ERR_MODULE_NOT_FOUND(
|
|
24627
|
+
filePath || resolved.pathname,
|
|
24628
|
+
base && fileURLToPath3(base),
|
|
24629
|
+
true
|
|
24630
|
+
);
|
|
24631
|
+
error51.url = String(resolved);
|
|
24632
|
+
throw error51;
|
|
24633
|
+
}
|
|
24634
|
+
if (!preserveSymlinks) {
|
|
24635
|
+
const real = realpathSync(filePath);
|
|
24636
|
+
const { search, hash: hash2 } = resolved;
|
|
24637
|
+
resolved = pathToFileURL4(real + (filePath.endsWith(path3.sep) ? "/" : ""));
|
|
24638
|
+
resolved.search = search;
|
|
24639
|
+
resolved.hash = hash2;
|
|
24640
|
+
}
|
|
24641
|
+
return resolved;
|
|
24642
|
+
}
|
|
24643
|
+
function importNotDefined(specifier, packageJsonUrl, base) {
|
|
24644
|
+
return new ERR_PACKAGE_IMPORT_NOT_DEFINED(
|
|
24645
|
+
specifier,
|
|
24646
|
+
packageJsonUrl && fileURLToPath3(new URL(".", packageJsonUrl)),
|
|
24647
|
+
fileURLToPath3(base)
|
|
24648
|
+
);
|
|
24649
|
+
}
|
|
24650
|
+
function exportsNotFound(subpath, packageJsonUrl, base) {
|
|
24651
|
+
return new ERR_PACKAGE_PATH_NOT_EXPORTED(
|
|
24652
|
+
fileURLToPath3(new URL(".", packageJsonUrl)),
|
|
24653
|
+
subpath,
|
|
24654
|
+
base && fileURLToPath3(base)
|
|
24655
|
+
);
|
|
24656
|
+
}
|
|
24657
|
+
function throwInvalidSubpath(request, match, packageJsonUrl, internal, base) {
|
|
24658
|
+
const reason = `request is not a valid match in pattern "${match}" for the "${internal ? "imports" : "exports"}" resolution of ${fileURLToPath3(packageJsonUrl)}`;
|
|
24659
|
+
throw new ERR_INVALID_MODULE_SPECIFIER(
|
|
24660
|
+
request,
|
|
24661
|
+
reason,
|
|
24662
|
+
base && fileURLToPath3(base)
|
|
24663
|
+
);
|
|
24664
|
+
}
|
|
24665
|
+
function invalidPackageTarget(subpath, target, packageJsonUrl, internal, base) {
|
|
24666
|
+
target = typeof target === "object" && target !== null ? JSON.stringify(target, null, "") : `${target}`;
|
|
24667
|
+
return new ERR_INVALID_PACKAGE_TARGET(
|
|
24668
|
+
fileURLToPath3(new URL(".", packageJsonUrl)),
|
|
24669
|
+
subpath,
|
|
24670
|
+
target,
|
|
24671
|
+
internal,
|
|
24672
|
+
base && fileURLToPath3(base)
|
|
24673
|
+
);
|
|
24674
|
+
}
|
|
24675
|
+
function resolvePackageTargetString(target, subpath, match, packageJsonUrl, base, pattern, internal, isPathMap, conditions) {
|
|
24676
|
+
if (subpath !== "" && !pattern && target[target.length - 1] !== "/")
|
|
24677
|
+
throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);
|
|
24678
|
+
if (!target.startsWith("./")) {
|
|
24679
|
+
if (internal && !target.startsWith("../") && !target.startsWith("/")) {
|
|
24680
|
+
let isURL2 = false;
|
|
24681
|
+
try {
|
|
24682
|
+
new URL(target);
|
|
24683
|
+
isURL2 = true;
|
|
24684
|
+
} catch {
|
|
24685
|
+
}
|
|
24686
|
+
if (!isURL2) {
|
|
24687
|
+
const exportTarget = pattern ? RegExpPrototypeSymbolReplace.call(
|
|
24688
|
+
patternRegEx,
|
|
24689
|
+
target,
|
|
24690
|
+
() => subpath
|
|
24691
|
+
) : target + subpath;
|
|
24692
|
+
return packageResolve(exportTarget, packageJsonUrl, conditions);
|
|
24693
|
+
}
|
|
24694
|
+
}
|
|
24695
|
+
throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);
|
|
24696
|
+
}
|
|
24697
|
+
if (invalidSegmentRegEx.exec(target.slice(2)) !== null) {
|
|
24698
|
+
if (deprecatedInvalidSegmentRegEx.exec(target.slice(2)) === null) {
|
|
24699
|
+
if (!isPathMap) {
|
|
24700
|
+
const request = pattern ? match.replace("*", () => subpath) : match + subpath;
|
|
24701
|
+
const resolvedTarget = pattern ? RegExpPrototypeSymbolReplace.call(
|
|
24702
|
+
patternRegEx,
|
|
24703
|
+
target,
|
|
24704
|
+
() => subpath
|
|
24705
|
+
) : target;
|
|
24706
|
+
emitInvalidSegmentDeprecation(
|
|
24707
|
+
resolvedTarget,
|
|
24708
|
+
request,
|
|
24709
|
+
match,
|
|
24710
|
+
packageJsonUrl,
|
|
24711
|
+
internal,
|
|
24712
|
+
base,
|
|
24713
|
+
true
|
|
24714
|
+
);
|
|
24715
|
+
}
|
|
24716
|
+
} else {
|
|
24717
|
+
throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);
|
|
24718
|
+
}
|
|
24719
|
+
}
|
|
24720
|
+
const resolved = new URL(target, packageJsonUrl);
|
|
24721
|
+
const resolvedPath = resolved.pathname;
|
|
24722
|
+
const packagePath = new URL(".", packageJsonUrl).pathname;
|
|
24723
|
+
if (!resolvedPath.startsWith(packagePath))
|
|
24724
|
+
throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);
|
|
24725
|
+
if (subpath === "") return resolved;
|
|
24726
|
+
if (invalidSegmentRegEx.exec(subpath) !== null) {
|
|
24727
|
+
const request = pattern ? match.replace("*", () => subpath) : match + subpath;
|
|
24728
|
+
if (deprecatedInvalidSegmentRegEx.exec(subpath) === null) {
|
|
24729
|
+
if (!isPathMap) {
|
|
24730
|
+
const resolvedTarget = pattern ? RegExpPrototypeSymbolReplace.call(
|
|
24731
|
+
patternRegEx,
|
|
24732
|
+
target,
|
|
24733
|
+
() => subpath
|
|
24734
|
+
) : target;
|
|
24735
|
+
emitInvalidSegmentDeprecation(
|
|
24736
|
+
resolvedTarget,
|
|
24737
|
+
request,
|
|
24738
|
+
match,
|
|
24739
|
+
packageJsonUrl,
|
|
24740
|
+
internal,
|
|
24741
|
+
base,
|
|
24742
|
+
false
|
|
24743
|
+
);
|
|
24744
|
+
}
|
|
24745
|
+
} else {
|
|
24746
|
+
throwInvalidSubpath(request, match, packageJsonUrl, internal, base);
|
|
24747
|
+
}
|
|
24748
|
+
}
|
|
24749
|
+
if (pattern) {
|
|
24750
|
+
return new URL(
|
|
24751
|
+
RegExpPrototypeSymbolReplace.call(
|
|
24752
|
+
patternRegEx,
|
|
24753
|
+
resolved.href,
|
|
24754
|
+
() => subpath
|
|
24755
|
+
)
|
|
24756
|
+
);
|
|
24757
|
+
}
|
|
24758
|
+
return new URL(subpath, resolved);
|
|
24759
|
+
}
|
|
24760
|
+
function isArrayIndex(key) {
|
|
24761
|
+
const keyNumber = Number(key);
|
|
24762
|
+
if (`${keyNumber}` !== key) return false;
|
|
24763
|
+
return keyNumber >= 0 && keyNumber < 4294967295;
|
|
24764
|
+
}
|
|
24765
|
+
function resolvePackageTarget(packageJsonUrl, target, subpath, packageSubpath, base, pattern, internal, isPathMap, conditions) {
|
|
24766
|
+
if (typeof target === "string") {
|
|
24767
|
+
return resolvePackageTargetString(
|
|
24768
|
+
target,
|
|
24769
|
+
subpath,
|
|
24770
|
+
packageSubpath,
|
|
24771
|
+
packageJsonUrl,
|
|
24772
|
+
base,
|
|
24773
|
+
pattern,
|
|
24774
|
+
internal,
|
|
24775
|
+
isPathMap,
|
|
24776
|
+
conditions
|
|
24777
|
+
);
|
|
24778
|
+
}
|
|
24779
|
+
if (Array.isArray(target)) {
|
|
24780
|
+
const targetList = target;
|
|
24781
|
+
if (targetList.length === 0) return null;
|
|
24782
|
+
let lastException;
|
|
24783
|
+
let i = -1;
|
|
24784
|
+
while (++i < targetList.length) {
|
|
24785
|
+
const targetItem = targetList[i];
|
|
24786
|
+
let resolveResult;
|
|
24787
|
+
try {
|
|
24788
|
+
resolveResult = resolvePackageTarget(
|
|
24789
|
+
packageJsonUrl,
|
|
24790
|
+
targetItem,
|
|
24791
|
+
subpath,
|
|
24792
|
+
packageSubpath,
|
|
24793
|
+
base,
|
|
24794
|
+
pattern,
|
|
24795
|
+
internal,
|
|
24796
|
+
isPathMap,
|
|
24797
|
+
conditions
|
|
24798
|
+
);
|
|
24799
|
+
} catch (error51) {
|
|
24800
|
+
const exception = (
|
|
24801
|
+
/** @type {ErrnoException} */
|
|
24802
|
+
error51
|
|
24803
|
+
);
|
|
24804
|
+
lastException = exception;
|
|
24805
|
+
if (exception.code === "ERR_INVALID_PACKAGE_TARGET") continue;
|
|
24806
|
+
throw error51;
|
|
24807
|
+
}
|
|
24808
|
+
if (resolveResult === void 0) continue;
|
|
24809
|
+
if (resolveResult === null) {
|
|
24810
|
+
lastException = null;
|
|
24811
|
+
continue;
|
|
24812
|
+
}
|
|
24813
|
+
return resolveResult;
|
|
24814
|
+
}
|
|
24815
|
+
if (lastException === void 0 || lastException === null) {
|
|
24816
|
+
return null;
|
|
24817
|
+
}
|
|
24818
|
+
throw lastException;
|
|
24819
|
+
}
|
|
24820
|
+
if (typeof target === "object" && target !== null) {
|
|
24821
|
+
const keys = Object.getOwnPropertyNames(target);
|
|
24822
|
+
let i = -1;
|
|
24823
|
+
while (++i < keys.length) {
|
|
24824
|
+
const key = keys[i];
|
|
24825
|
+
if (isArrayIndex(key)) {
|
|
24826
|
+
throw new ERR_INVALID_PACKAGE_CONFIG2(
|
|
24827
|
+
fileURLToPath3(packageJsonUrl),
|
|
24828
|
+
base,
|
|
24829
|
+
'"exports" cannot contain numeric property keys.'
|
|
24830
|
+
);
|
|
24831
|
+
}
|
|
24832
|
+
}
|
|
24833
|
+
i = -1;
|
|
24834
|
+
while (++i < keys.length) {
|
|
24835
|
+
const key = keys[i];
|
|
24836
|
+
if (key === "default" || conditions && conditions.has(key)) {
|
|
24837
|
+
const conditionalTarget = (
|
|
24838
|
+
/** @type {unknown} */
|
|
24839
|
+
target[key]
|
|
24840
|
+
);
|
|
24841
|
+
const resolveResult = resolvePackageTarget(
|
|
24842
|
+
packageJsonUrl,
|
|
24843
|
+
conditionalTarget,
|
|
24844
|
+
subpath,
|
|
24845
|
+
packageSubpath,
|
|
24846
|
+
base,
|
|
24847
|
+
pattern,
|
|
24848
|
+
internal,
|
|
24849
|
+
isPathMap,
|
|
24850
|
+
conditions
|
|
24851
|
+
);
|
|
24852
|
+
if (resolveResult === void 0) continue;
|
|
24853
|
+
return resolveResult;
|
|
24854
|
+
}
|
|
24855
|
+
}
|
|
24856
|
+
return null;
|
|
24857
|
+
}
|
|
24858
|
+
if (target === null) {
|
|
24859
|
+
return null;
|
|
24860
|
+
}
|
|
24861
|
+
throw invalidPackageTarget(
|
|
24862
|
+
packageSubpath,
|
|
24863
|
+
target,
|
|
24864
|
+
packageJsonUrl,
|
|
24865
|
+
internal,
|
|
24866
|
+
base
|
|
24867
|
+
);
|
|
24868
|
+
}
|
|
24869
|
+
function isConditionalExportsMainSugar(exports, packageJsonUrl, base) {
|
|
24870
|
+
if (typeof exports === "string" || Array.isArray(exports)) return true;
|
|
24871
|
+
if (typeof exports !== "object" || exports === null) return false;
|
|
24872
|
+
const keys = Object.getOwnPropertyNames(exports);
|
|
24873
|
+
let isConditionalSugar = false;
|
|
24874
|
+
let i = 0;
|
|
24875
|
+
let keyIndex = -1;
|
|
24876
|
+
while (++keyIndex < keys.length) {
|
|
24877
|
+
const key = keys[keyIndex];
|
|
24878
|
+
const currentIsConditionalSugar = key === "" || key[0] !== ".";
|
|
24879
|
+
if (i++ === 0) {
|
|
24880
|
+
isConditionalSugar = currentIsConditionalSugar;
|
|
24881
|
+
} else if (isConditionalSugar !== currentIsConditionalSugar) {
|
|
24882
|
+
throw new ERR_INVALID_PACKAGE_CONFIG2(
|
|
24883
|
+
fileURLToPath3(packageJsonUrl),
|
|
24884
|
+
base,
|
|
24885
|
+
`"exports" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.`
|
|
24886
|
+
);
|
|
24887
|
+
}
|
|
24888
|
+
}
|
|
24889
|
+
return isConditionalSugar;
|
|
24890
|
+
}
|
|
24891
|
+
function emitTrailingSlashPatternDeprecation(match, pjsonUrl, base) {
|
|
24892
|
+
if (process4.noDeprecation) {
|
|
24893
|
+
return;
|
|
24894
|
+
}
|
|
24895
|
+
const pjsonPath = fileURLToPath3(pjsonUrl);
|
|
24896
|
+
if (emittedPackageWarnings.has(pjsonPath + "|" + match)) return;
|
|
24897
|
+
emittedPackageWarnings.add(pjsonPath + "|" + match);
|
|
24898
|
+
process4.emitWarning(
|
|
24899
|
+
`Use of deprecated trailing slash pattern mapping "${match}" in the "exports" field module resolution of the package at ${pjsonPath}${base ? ` imported from ${fileURLToPath3(base)}` : ""}. Mapping specifiers ending in "/" is no longer supported.`,
|
|
24900
|
+
"DeprecationWarning",
|
|
24901
|
+
"DEP0155"
|
|
24902
|
+
);
|
|
24903
|
+
}
|
|
24904
|
+
function packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, base, conditions) {
|
|
24905
|
+
let exports = packageConfig.exports;
|
|
24906
|
+
if (isConditionalExportsMainSugar(exports, packageJsonUrl, base)) {
|
|
24907
|
+
exports = { ".": exports };
|
|
24908
|
+
}
|
|
24909
|
+
if (own2.call(exports, packageSubpath) && !packageSubpath.includes("*") && !packageSubpath.endsWith("/")) {
|
|
24910
|
+
const target = exports[packageSubpath];
|
|
24911
|
+
const resolveResult = resolvePackageTarget(
|
|
24912
|
+
packageJsonUrl,
|
|
24913
|
+
target,
|
|
24914
|
+
"",
|
|
24915
|
+
packageSubpath,
|
|
24916
|
+
base,
|
|
24917
|
+
false,
|
|
24918
|
+
false,
|
|
24919
|
+
false,
|
|
24920
|
+
conditions
|
|
24921
|
+
);
|
|
24922
|
+
if (resolveResult === null || resolveResult === void 0) {
|
|
24923
|
+
throw exportsNotFound(packageSubpath, packageJsonUrl, base);
|
|
24924
|
+
}
|
|
24925
|
+
return resolveResult;
|
|
24926
|
+
}
|
|
24927
|
+
let bestMatch = "";
|
|
24928
|
+
let bestMatchSubpath = "";
|
|
24929
|
+
const keys = Object.getOwnPropertyNames(exports);
|
|
24930
|
+
let i = -1;
|
|
24931
|
+
while (++i < keys.length) {
|
|
24932
|
+
const key = keys[i];
|
|
24933
|
+
const patternIndex = key.indexOf("*");
|
|
24934
|
+
if (patternIndex !== -1 && packageSubpath.startsWith(key.slice(0, patternIndex))) {
|
|
24935
|
+
if (packageSubpath.endsWith("/")) {
|
|
24936
|
+
emitTrailingSlashPatternDeprecation(
|
|
24937
|
+
packageSubpath,
|
|
24938
|
+
packageJsonUrl,
|
|
24939
|
+
base
|
|
24940
|
+
);
|
|
24941
|
+
}
|
|
24942
|
+
const patternTrailer = key.slice(patternIndex + 1);
|
|
24943
|
+
if (packageSubpath.length >= key.length && packageSubpath.endsWith(patternTrailer) && patternKeyCompare(bestMatch, key) === 1 && key.lastIndexOf("*") === patternIndex) {
|
|
24944
|
+
bestMatch = key;
|
|
24945
|
+
bestMatchSubpath = packageSubpath.slice(
|
|
24946
|
+
patternIndex,
|
|
24947
|
+
packageSubpath.length - patternTrailer.length
|
|
24948
|
+
);
|
|
24949
|
+
}
|
|
24950
|
+
}
|
|
24951
|
+
}
|
|
24952
|
+
if (bestMatch) {
|
|
24953
|
+
const target = (
|
|
24954
|
+
/** @type {unknown} */
|
|
24955
|
+
exports[bestMatch]
|
|
24956
|
+
);
|
|
24957
|
+
const resolveResult = resolvePackageTarget(
|
|
24958
|
+
packageJsonUrl,
|
|
24959
|
+
target,
|
|
24960
|
+
bestMatchSubpath,
|
|
24961
|
+
bestMatch,
|
|
24962
|
+
base,
|
|
24963
|
+
true,
|
|
24964
|
+
false,
|
|
24965
|
+
packageSubpath.endsWith("/"),
|
|
24966
|
+
conditions
|
|
24967
|
+
);
|
|
24968
|
+
if (resolveResult === null || resolveResult === void 0) {
|
|
24969
|
+
throw exportsNotFound(packageSubpath, packageJsonUrl, base);
|
|
24970
|
+
}
|
|
24971
|
+
return resolveResult;
|
|
24972
|
+
}
|
|
24973
|
+
throw exportsNotFound(packageSubpath, packageJsonUrl, base);
|
|
24974
|
+
}
|
|
24975
|
+
function patternKeyCompare(a, b) {
|
|
24976
|
+
const aPatternIndex = a.indexOf("*");
|
|
24977
|
+
const bPatternIndex = b.indexOf("*");
|
|
24978
|
+
const baseLengthA = aPatternIndex === -1 ? a.length : aPatternIndex + 1;
|
|
24979
|
+
const baseLengthB = bPatternIndex === -1 ? b.length : bPatternIndex + 1;
|
|
24980
|
+
if (baseLengthA > baseLengthB) return -1;
|
|
24981
|
+
if (baseLengthB > baseLengthA) return 1;
|
|
24982
|
+
if (aPatternIndex === -1) return 1;
|
|
24983
|
+
if (bPatternIndex === -1) return -1;
|
|
24984
|
+
if (a.length > b.length) return -1;
|
|
24985
|
+
if (b.length > a.length) return 1;
|
|
24986
|
+
return 0;
|
|
24987
|
+
}
|
|
24988
|
+
function packageImportsResolve(name, base, conditions) {
|
|
24989
|
+
if (name === "#" || name.startsWith("#/") || name.endsWith("/")) {
|
|
24990
|
+
const reason = "is not a valid internal imports specifier name";
|
|
24991
|
+
throw new ERR_INVALID_MODULE_SPECIFIER(name, reason, fileURLToPath3(base));
|
|
24992
|
+
}
|
|
24993
|
+
let packageJsonUrl;
|
|
24994
|
+
const packageConfig = getPackageScopeConfig(base);
|
|
24995
|
+
if (packageConfig.exists) {
|
|
24996
|
+
packageJsonUrl = pathToFileURL4(packageConfig.pjsonPath);
|
|
24997
|
+
const imports = packageConfig.imports;
|
|
24998
|
+
if (imports) {
|
|
24999
|
+
if (own2.call(imports, name) && !name.includes("*")) {
|
|
25000
|
+
const resolveResult = resolvePackageTarget(
|
|
25001
|
+
packageJsonUrl,
|
|
25002
|
+
imports[name],
|
|
25003
|
+
"",
|
|
25004
|
+
name,
|
|
25005
|
+
base,
|
|
25006
|
+
false,
|
|
25007
|
+
true,
|
|
25008
|
+
false,
|
|
25009
|
+
conditions
|
|
25010
|
+
);
|
|
25011
|
+
if (resolveResult !== null && resolveResult !== void 0) {
|
|
25012
|
+
return resolveResult;
|
|
25013
|
+
}
|
|
25014
|
+
} else {
|
|
25015
|
+
let bestMatch = "";
|
|
25016
|
+
let bestMatchSubpath = "";
|
|
25017
|
+
const keys = Object.getOwnPropertyNames(imports);
|
|
25018
|
+
let i = -1;
|
|
25019
|
+
while (++i < keys.length) {
|
|
25020
|
+
const key = keys[i];
|
|
25021
|
+
const patternIndex = key.indexOf("*");
|
|
25022
|
+
if (patternIndex !== -1 && name.startsWith(key.slice(0, -1))) {
|
|
25023
|
+
const patternTrailer = key.slice(patternIndex + 1);
|
|
25024
|
+
if (name.length >= key.length && name.endsWith(patternTrailer) && patternKeyCompare(bestMatch, key) === 1 && key.lastIndexOf("*") === patternIndex) {
|
|
25025
|
+
bestMatch = key;
|
|
25026
|
+
bestMatchSubpath = name.slice(
|
|
25027
|
+
patternIndex,
|
|
25028
|
+
name.length - patternTrailer.length
|
|
25029
|
+
);
|
|
25030
|
+
}
|
|
25031
|
+
}
|
|
25032
|
+
}
|
|
25033
|
+
if (bestMatch) {
|
|
25034
|
+
const target = imports[bestMatch];
|
|
25035
|
+
const resolveResult = resolvePackageTarget(
|
|
25036
|
+
packageJsonUrl,
|
|
25037
|
+
target,
|
|
25038
|
+
bestMatchSubpath,
|
|
25039
|
+
bestMatch,
|
|
25040
|
+
base,
|
|
25041
|
+
true,
|
|
25042
|
+
true,
|
|
25043
|
+
false,
|
|
25044
|
+
conditions
|
|
25045
|
+
);
|
|
25046
|
+
if (resolveResult !== null && resolveResult !== void 0) {
|
|
25047
|
+
return resolveResult;
|
|
25048
|
+
}
|
|
25049
|
+
}
|
|
25050
|
+
}
|
|
25051
|
+
}
|
|
25052
|
+
}
|
|
25053
|
+
throw importNotDefined(name, packageJsonUrl, base);
|
|
25054
|
+
}
|
|
25055
|
+
function parsePackageName(specifier, base) {
|
|
25056
|
+
let separatorIndex = specifier.indexOf("/");
|
|
25057
|
+
let validPackageName = true;
|
|
25058
|
+
let isScoped = false;
|
|
25059
|
+
if (specifier[0] === "@") {
|
|
25060
|
+
isScoped = true;
|
|
25061
|
+
if (separatorIndex === -1 || specifier.length === 0) {
|
|
25062
|
+
validPackageName = false;
|
|
25063
|
+
} else {
|
|
25064
|
+
separatorIndex = specifier.indexOf("/", separatorIndex + 1);
|
|
25065
|
+
}
|
|
25066
|
+
}
|
|
25067
|
+
const packageName = separatorIndex === -1 ? specifier : specifier.slice(0, separatorIndex);
|
|
25068
|
+
if (invalidPackageNameRegEx.exec(packageName) !== null) {
|
|
25069
|
+
validPackageName = false;
|
|
25070
|
+
}
|
|
25071
|
+
if (!validPackageName) {
|
|
25072
|
+
throw new ERR_INVALID_MODULE_SPECIFIER(
|
|
25073
|
+
specifier,
|
|
25074
|
+
"is not a valid package name",
|
|
25075
|
+
fileURLToPath3(base)
|
|
25076
|
+
);
|
|
25077
|
+
}
|
|
25078
|
+
const packageSubpath = "." + (separatorIndex === -1 ? "" : specifier.slice(separatorIndex));
|
|
25079
|
+
return { packageName, packageSubpath, isScoped };
|
|
25080
|
+
}
|
|
25081
|
+
function packageResolve(specifier, base, conditions) {
|
|
25082
|
+
if (builtinModules.includes(specifier)) {
|
|
25083
|
+
return new URL("node:" + specifier);
|
|
25084
|
+
}
|
|
25085
|
+
const { packageName, packageSubpath, isScoped } = parsePackageName(
|
|
25086
|
+
specifier,
|
|
25087
|
+
base
|
|
25088
|
+
);
|
|
25089
|
+
const packageConfig = getPackageScopeConfig(base);
|
|
25090
|
+
if (packageConfig.exists) {
|
|
25091
|
+
const packageJsonUrl2 = pathToFileURL4(packageConfig.pjsonPath);
|
|
25092
|
+
if (packageConfig.name === packageName && packageConfig.exports !== void 0 && packageConfig.exports !== null) {
|
|
25093
|
+
return packageExportsResolve(
|
|
25094
|
+
packageJsonUrl2,
|
|
25095
|
+
packageSubpath,
|
|
25096
|
+
packageConfig,
|
|
25097
|
+
base,
|
|
25098
|
+
conditions
|
|
25099
|
+
);
|
|
25100
|
+
}
|
|
25101
|
+
}
|
|
25102
|
+
let packageJsonUrl = new URL(
|
|
25103
|
+
"./node_modules/" + packageName + "/package.json",
|
|
25104
|
+
base
|
|
25105
|
+
);
|
|
25106
|
+
let packageJsonPath = fileURLToPath3(packageJsonUrl);
|
|
25107
|
+
let lastPath;
|
|
25108
|
+
do {
|
|
25109
|
+
const stat = tryStatSync(packageJsonPath.slice(0, -13));
|
|
25110
|
+
if (!stat || !stat.isDirectory()) {
|
|
25111
|
+
lastPath = packageJsonPath;
|
|
25112
|
+
packageJsonUrl = new URL(
|
|
25113
|
+
(isScoped ? "../../../../node_modules/" : "../../../node_modules/") + packageName + "/package.json",
|
|
25114
|
+
packageJsonUrl
|
|
25115
|
+
);
|
|
25116
|
+
packageJsonPath = fileURLToPath3(packageJsonUrl);
|
|
25117
|
+
continue;
|
|
25118
|
+
}
|
|
25119
|
+
const packageConfig2 = read(packageJsonPath, { base, specifier });
|
|
25120
|
+
if (packageConfig2.exports !== void 0 && packageConfig2.exports !== null) {
|
|
25121
|
+
return packageExportsResolve(
|
|
25122
|
+
packageJsonUrl,
|
|
25123
|
+
packageSubpath,
|
|
25124
|
+
packageConfig2,
|
|
25125
|
+
base,
|
|
25126
|
+
conditions
|
|
25127
|
+
);
|
|
25128
|
+
}
|
|
25129
|
+
if (packageSubpath === ".") {
|
|
25130
|
+
return legacyMainResolve(packageJsonUrl, packageConfig2, base);
|
|
25131
|
+
}
|
|
25132
|
+
return new URL(packageSubpath, packageJsonUrl);
|
|
25133
|
+
} while (packageJsonPath.length !== lastPath.length);
|
|
25134
|
+
throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath3(base), false);
|
|
25135
|
+
}
|
|
25136
|
+
function isRelativeSpecifier(specifier) {
|
|
25137
|
+
if (specifier[0] === ".") {
|
|
25138
|
+
if (specifier.length === 1 || specifier[1] === "/") return true;
|
|
25139
|
+
if (specifier[1] === "." && (specifier.length === 2 || specifier[2] === "/")) {
|
|
25140
|
+
return true;
|
|
25141
|
+
}
|
|
25142
|
+
}
|
|
25143
|
+
return false;
|
|
25144
|
+
}
|
|
25145
|
+
function shouldBeTreatedAsRelativeOrAbsolutePath(specifier) {
|
|
25146
|
+
if (specifier === "") return false;
|
|
25147
|
+
if (specifier[0] === "/") return true;
|
|
25148
|
+
return isRelativeSpecifier(specifier);
|
|
25149
|
+
}
|
|
25150
|
+
function moduleResolve(specifier, base, conditions, preserveSymlinks) {
|
|
25151
|
+
if (conditions === void 0) {
|
|
25152
|
+
conditions = getConditionsSet();
|
|
25153
|
+
}
|
|
25154
|
+
const protocol = base.protocol;
|
|
25155
|
+
const isData = protocol === "data:";
|
|
25156
|
+
const isRemote = isData || protocol === "http:" || protocol === "https:";
|
|
25157
|
+
let resolved;
|
|
25158
|
+
if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) {
|
|
25159
|
+
try {
|
|
25160
|
+
resolved = new URL(specifier, base);
|
|
25161
|
+
} catch (error_) {
|
|
25162
|
+
const error51 = new ERR_UNSUPPORTED_RESOLVE_REQUEST(specifier, base);
|
|
25163
|
+
error51.cause = error_;
|
|
25164
|
+
throw error51;
|
|
25165
|
+
}
|
|
25166
|
+
} else if (protocol === "file:" && specifier[0] === "#") {
|
|
25167
|
+
resolved = packageImportsResolve(specifier, base, conditions);
|
|
25168
|
+
} else {
|
|
25169
|
+
try {
|
|
25170
|
+
resolved = new URL(specifier);
|
|
25171
|
+
} catch (error_) {
|
|
25172
|
+
if (isRemote && !builtinModules.includes(specifier)) {
|
|
25173
|
+
const error51 = new ERR_UNSUPPORTED_RESOLVE_REQUEST(specifier, base);
|
|
25174
|
+
error51.cause = error_;
|
|
25175
|
+
throw error51;
|
|
25176
|
+
}
|
|
25177
|
+
resolved = packageResolve(specifier, base, conditions);
|
|
25178
|
+
}
|
|
25179
|
+
}
|
|
25180
|
+
assert3.ok(resolved !== void 0, "expected to be defined");
|
|
25181
|
+
if (resolved.protocol !== "file:") {
|
|
25182
|
+
return resolved;
|
|
25183
|
+
}
|
|
25184
|
+
return finalizeResolution(resolved, base, preserveSymlinks);
|
|
25185
|
+
}
|
|
25186
|
+
function checkIfDisallowedImport(specifier, parsed, parsedParentURL) {
|
|
25187
|
+
if (parsedParentURL) {
|
|
25188
|
+
const parentProtocol = parsedParentURL.protocol;
|
|
25189
|
+
if (parentProtocol === "http:" || parentProtocol === "https:") {
|
|
25190
|
+
if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) {
|
|
25191
|
+
const parsedProtocol = parsed?.protocol;
|
|
25192
|
+
if (parsedProtocol && parsedProtocol !== "https:" && parsedProtocol !== "http:") {
|
|
25193
|
+
throw new ERR_NETWORK_IMPORT_DISALLOWED(
|
|
25194
|
+
specifier,
|
|
25195
|
+
parsedParentURL,
|
|
25196
|
+
"remote imports cannot import from a local location."
|
|
25197
|
+
);
|
|
25198
|
+
}
|
|
25199
|
+
return { url: parsed?.href || "" };
|
|
25200
|
+
}
|
|
25201
|
+
if (builtinModules.includes(specifier)) {
|
|
25202
|
+
throw new ERR_NETWORK_IMPORT_DISALLOWED(
|
|
25203
|
+
specifier,
|
|
25204
|
+
parsedParentURL,
|
|
25205
|
+
"remote imports cannot import from a local location."
|
|
25206
|
+
);
|
|
25207
|
+
}
|
|
25208
|
+
throw new ERR_NETWORK_IMPORT_DISALLOWED(
|
|
25209
|
+
specifier,
|
|
25210
|
+
parsedParentURL,
|
|
25211
|
+
"only relative and absolute specifiers are supported."
|
|
25212
|
+
);
|
|
25213
|
+
}
|
|
25214
|
+
}
|
|
25215
|
+
}
|
|
25216
|
+
function isURL(self) {
|
|
25217
|
+
return Boolean(
|
|
25218
|
+
self && typeof self === "object" && "href" in self && typeof self.href === "string" && "protocol" in self && typeof self.protocol === "string" && self.href && self.protocol
|
|
25219
|
+
);
|
|
25220
|
+
}
|
|
25221
|
+
function throwIfInvalidParentURL(parentURL) {
|
|
25222
|
+
if (parentURL === void 0) {
|
|
25223
|
+
return;
|
|
25224
|
+
}
|
|
25225
|
+
if (typeof parentURL !== "string" && !isURL(parentURL)) {
|
|
25226
|
+
throw new codes.ERR_INVALID_ARG_TYPE(
|
|
25227
|
+
"parentURL",
|
|
25228
|
+
["string", "URL"],
|
|
25229
|
+
parentURL
|
|
25230
|
+
);
|
|
25231
|
+
}
|
|
25232
|
+
}
|
|
25233
|
+
function defaultResolve(specifier, context = {}) {
|
|
25234
|
+
const { parentURL } = context;
|
|
25235
|
+
assert3.ok(parentURL !== void 0, "expected `parentURL` to be defined");
|
|
25236
|
+
throwIfInvalidParentURL(parentURL);
|
|
25237
|
+
let parsedParentURL;
|
|
25238
|
+
if (parentURL) {
|
|
25239
|
+
try {
|
|
25240
|
+
parsedParentURL = new URL(parentURL);
|
|
25241
|
+
} catch {
|
|
25242
|
+
}
|
|
25243
|
+
}
|
|
25244
|
+
let parsed;
|
|
25245
|
+
let protocol;
|
|
25246
|
+
try {
|
|
25247
|
+
parsed = shouldBeTreatedAsRelativeOrAbsolutePath(specifier) ? new URL(specifier, parsedParentURL) : new URL(specifier);
|
|
25248
|
+
protocol = parsed.protocol;
|
|
25249
|
+
if (protocol === "data:") {
|
|
25250
|
+
return { url: parsed.href, format: null };
|
|
25251
|
+
}
|
|
25252
|
+
} catch {
|
|
25253
|
+
}
|
|
25254
|
+
const maybeReturn = checkIfDisallowedImport(
|
|
25255
|
+
specifier,
|
|
25256
|
+
parsed,
|
|
25257
|
+
parsedParentURL
|
|
25258
|
+
);
|
|
25259
|
+
if (maybeReturn) return maybeReturn;
|
|
25260
|
+
if (protocol === void 0 && parsed) {
|
|
25261
|
+
protocol = parsed.protocol;
|
|
25262
|
+
}
|
|
25263
|
+
if (protocol === "node:") {
|
|
25264
|
+
return { url: specifier };
|
|
25265
|
+
}
|
|
25266
|
+
if (parsed && parsed.protocol === "node:") return { url: specifier };
|
|
25267
|
+
const conditions = getConditionsSet(context.conditions);
|
|
25268
|
+
const url2 = moduleResolve(specifier, new URL(parentURL), conditions, false);
|
|
25269
|
+
return {
|
|
25270
|
+
// Do NOT cast `url` to a string: that will work even when there are real
|
|
25271
|
+
// problems, silencing them
|
|
25272
|
+
url: url2.href,
|
|
25273
|
+
format: defaultGetFormatWithoutErrors(url2, { parentURL })
|
|
25274
|
+
};
|
|
25275
|
+
}
|
|
25276
|
+
var RegExpPrototypeSymbolReplace, ERR_NETWORK_IMPORT_DISALLOWED, ERR_INVALID_MODULE_SPECIFIER, ERR_INVALID_PACKAGE_CONFIG2, ERR_INVALID_PACKAGE_TARGET, ERR_MODULE_NOT_FOUND, ERR_PACKAGE_IMPORT_NOT_DEFINED, ERR_PACKAGE_PATH_NOT_EXPORTED, ERR_UNSUPPORTED_DIR_IMPORT, ERR_UNSUPPORTED_RESOLVE_REQUEST, own2, invalidSegmentRegEx, deprecatedInvalidSegmentRegEx, invalidPackageNameRegEx, patternRegEx, encodedSeparatorRegEx, emittedPackageWarnings, doubleSlashRegEx;
|
|
25277
|
+
var init_resolve = __esm({
|
|
25278
|
+
"../../node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/lib/resolve.js"() {
|
|
25279
|
+
init_get_format();
|
|
25280
|
+
init_errors3();
|
|
25281
|
+
init_package_json_reader();
|
|
25282
|
+
init_utils();
|
|
25283
|
+
RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace];
|
|
25284
|
+
({
|
|
25285
|
+
ERR_NETWORK_IMPORT_DISALLOWED,
|
|
25286
|
+
ERR_INVALID_MODULE_SPECIFIER,
|
|
25287
|
+
ERR_INVALID_PACKAGE_CONFIG: ERR_INVALID_PACKAGE_CONFIG2,
|
|
25288
|
+
ERR_INVALID_PACKAGE_TARGET,
|
|
25289
|
+
ERR_MODULE_NOT_FOUND,
|
|
25290
|
+
ERR_PACKAGE_IMPORT_NOT_DEFINED,
|
|
25291
|
+
ERR_PACKAGE_PATH_NOT_EXPORTED,
|
|
25292
|
+
ERR_UNSUPPORTED_DIR_IMPORT,
|
|
25293
|
+
ERR_UNSUPPORTED_RESOLVE_REQUEST
|
|
25294
|
+
} = codes);
|
|
25295
|
+
own2 = {}.hasOwnProperty;
|
|
25296
|
+
invalidSegmentRegEx = /(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))?(\\|\/|$)/i;
|
|
25297
|
+
deprecatedInvalidSegmentRegEx = /(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))(\\|\/|$)/i;
|
|
25298
|
+
invalidPackageNameRegEx = /^\.|%|\\/;
|
|
25299
|
+
patternRegEx = /\*/g;
|
|
25300
|
+
encodedSeparatorRegEx = /%2f|%5c/i;
|
|
25301
|
+
emittedPackageWarnings = /* @__PURE__ */ new Set();
|
|
25302
|
+
doubleSlashRegEx = /[/\\]{2}/;
|
|
25303
|
+
}
|
|
25304
|
+
});
|
|
25305
|
+
|
|
25306
|
+
// ../../node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/index.js
|
|
25307
|
+
function resolve4(specifier, parent) {
|
|
25308
|
+
if (!parent) {
|
|
25309
|
+
throw new Error(
|
|
25310
|
+
"Please pass `parent`: `import-meta-resolve` cannot ponyfill that"
|
|
25311
|
+
);
|
|
25312
|
+
}
|
|
25313
|
+
try {
|
|
25314
|
+
return defaultResolve(specifier, { parentURL: parent }).url;
|
|
25315
|
+
} catch (error51) {
|
|
25316
|
+
const exception = (
|
|
25317
|
+
/** @type {ErrnoException} */
|
|
25318
|
+
error51
|
|
25319
|
+
);
|
|
25320
|
+
if ((exception.code === "ERR_UNSUPPORTED_DIR_IMPORT" || exception.code === "ERR_MODULE_NOT_FOUND") && typeof exception.url === "string") {
|
|
25321
|
+
return exception.url;
|
|
25322
|
+
}
|
|
25323
|
+
throw error51;
|
|
25324
|
+
}
|
|
25325
|
+
}
|
|
25326
|
+
var init_import_meta_resolve = __esm({
|
|
25327
|
+
"../../node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/index.js"() {
|
|
25328
|
+
init_resolve();
|
|
25329
|
+
}
|
|
25330
|
+
});
|
|
25331
|
+
|
|
25332
|
+
// src/commands/studio.ts
|
|
25333
|
+
var studio_exports = {};
|
|
25334
|
+
__export(studio_exports, {
|
|
25335
|
+
studioCommand: () => studioCommand
|
|
25336
|
+
});
|
|
25337
|
+
import { join as join9 } from "node:path";
|
|
25338
|
+
import { pathToFileURL as pathToFileURL5 } from "node:url";
|
|
25339
|
+
async function studioCommand(input, io) {
|
|
25340
|
+
const config2 = await resolveContentCommandConfig("studio", input);
|
|
25341
|
+
const port = parsePort(input.port);
|
|
25342
|
+
if (port === null) {
|
|
25343
|
+
io.stderr("studio: --port must be an integer between 0 and 65535.");
|
|
25344
|
+
return 2;
|
|
25345
|
+
}
|
|
25346
|
+
const minSectionWords = parseMinSectionWords2(input.minSectionWords);
|
|
25347
|
+
if (minSectionWords === null) {
|
|
25348
|
+
io.stderr("studio: --min-section-words must be a non-negative integer.");
|
|
25349
|
+
return 2;
|
|
25350
|
+
}
|
|
25351
|
+
await resolveContentFiles2(config2.globs, "studio", { cwd: config2.cwd });
|
|
25352
|
+
const seoConfig = await config2.loadSeo();
|
|
25353
|
+
let studioUrl;
|
|
25354
|
+
try {
|
|
25355
|
+
studioUrl = resolve4(
|
|
25356
|
+
"@contentbit/studio",
|
|
25357
|
+
pathToFileURL5(join9(config2.cwd ?? process.cwd(), "package.json")).href
|
|
25358
|
+
);
|
|
25359
|
+
} catch (error51) {
|
|
25360
|
+
if (!isMissingStudio(error51)) throw error51;
|
|
25361
|
+
}
|
|
25362
|
+
let startStudio;
|
|
25363
|
+
try {
|
|
25364
|
+
;
|
|
25365
|
+
({ startStudio } = await (studioUrl ? import(studioUrl) : import("@contentbit/studio")));
|
|
25366
|
+
} catch (error51) {
|
|
25367
|
+
if (!studioUrl && isMissingStudio(error51)) {
|
|
25368
|
+
throw new Error(
|
|
25369
|
+
"Studio is installed separately to keep the base CLI lightweight. Install it with your package manager, for example: pnpm add -D @contentbit/studio"
|
|
25370
|
+
);
|
|
25371
|
+
}
|
|
25372
|
+
throw error51;
|
|
25373
|
+
}
|
|
25374
|
+
const studioOptions = {
|
|
25375
|
+
globs: config2.globs,
|
|
25376
|
+
cwd: config2.cwd,
|
|
25377
|
+
registryPath: config2.registry,
|
|
25378
|
+
includeGenericBlocks: config2.includeGenericBlocks,
|
|
25379
|
+
host: input.host,
|
|
25380
|
+
...port !== void 0 ? { port } : {},
|
|
25381
|
+
open: !input.noOpen,
|
|
25382
|
+
linkOptions: config2.resolveLinkOptions(),
|
|
25383
|
+
minSectionWords,
|
|
25384
|
+
seoConfig: seoConfig.config,
|
|
25385
|
+
seoConfigPath: seoConfig.path
|
|
25386
|
+
};
|
|
25387
|
+
const server = await startStudio(studioOptions);
|
|
25388
|
+
io.stdout(
|
|
25389
|
+
[
|
|
25390
|
+
section("contentbit studio"),
|
|
25391
|
+
...formatRows([
|
|
25392
|
+
{ label: "URL", value: server.url, tone: "info" },
|
|
25393
|
+
{ label: "Stop", value: "Ctrl+C" }
|
|
25394
|
+
])
|
|
25395
|
+
].join("\n")
|
|
25396
|
+
);
|
|
25397
|
+
const close = () => {
|
|
25398
|
+
void server.close();
|
|
25399
|
+
};
|
|
25400
|
+
process.once("SIGINT", close);
|
|
25401
|
+
process.once("SIGTERM", close);
|
|
25402
|
+
await server.closed;
|
|
25403
|
+
process.off("SIGINT", close);
|
|
25404
|
+
process.off("SIGTERM", close);
|
|
25405
|
+
return 0;
|
|
25406
|
+
}
|
|
25407
|
+
function isMissingStudio(error51) {
|
|
25408
|
+
return error51 instanceof Error && "code" in error51 && error51.code === "ERR_MODULE_NOT_FOUND" && error51.message.includes("@contentbit/studio");
|
|
25409
|
+
}
|
|
25410
|
+
function parsePort(value) {
|
|
25411
|
+
if (value === void 0) return void 0;
|
|
23670
25412
|
if (!/^\d+$/.test(value)) return null;
|
|
23671
25413
|
const port = Number(value);
|
|
23672
25414
|
return port >= 0 && port <= 65535 ? port : null;
|
|
@@ -23679,11 +25421,38 @@ function parseMinSectionWords2(value) {
|
|
|
23679
25421
|
var init_studio = __esm({
|
|
23680
25422
|
"src/commands/studio.ts"() {
|
|
23681
25423
|
"use strict";
|
|
25424
|
+
init_command_config();
|
|
25425
|
+
init_import_meta_resolve();
|
|
23682
25426
|
init_cli_format();
|
|
23683
25427
|
init_content_project();
|
|
23684
|
-
|
|
23685
|
-
|
|
23686
|
-
|
|
25428
|
+
}
|
|
25429
|
+
});
|
|
25430
|
+
|
|
25431
|
+
// src/commands/snapshot.ts
|
|
25432
|
+
var snapshot_exports = {};
|
|
25433
|
+
__export(snapshot_exports, {
|
|
25434
|
+
snapshotCommand: () => snapshotCommand
|
|
25435
|
+
});
|
|
25436
|
+
async function snapshotCommand(input, io) {
|
|
25437
|
+
const config2 = await resolveContentCommandConfig("snapshot", input);
|
|
25438
|
+
const seoConfig = await config2.loadSeo();
|
|
25439
|
+
const snapshot = await inspectContentProject({
|
|
25440
|
+
positionals: config2.globs,
|
|
25441
|
+
cwd: config2.cwd,
|
|
25442
|
+
registry: config2.registry,
|
|
25443
|
+
includeGenericBlocks: config2.includeGenericBlocks,
|
|
25444
|
+
linkOptions: config2.resolveLinkOptions(),
|
|
25445
|
+
scan: { seoConfig: seoConfig.config, seoConfigPath: seoConfig.path },
|
|
25446
|
+
revision: input.revision
|
|
25447
|
+
});
|
|
25448
|
+
io.stdout(JSON.stringify(snapshot, null, 2));
|
|
25449
|
+
return 0;
|
|
25450
|
+
}
|
|
25451
|
+
var init_snapshot = __esm({
|
|
25452
|
+
"src/commands/snapshot.ts"() {
|
|
25453
|
+
"use strict";
|
|
25454
|
+
init_dist3();
|
|
25455
|
+
init_command_config();
|
|
23687
25456
|
}
|
|
23688
25457
|
});
|
|
23689
25458
|
|
|
@@ -23694,14 +25463,14 @@ __export(stats_exports, {
|
|
|
23694
25463
|
});
|
|
23695
25464
|
import { readFile as readFile6 } from "node:fs/promises";
|
|
23696
25465
|
async function statsCommand(input, io) {
|
|
23697
|
-
const
|
|
23698
|
-
const all = input.noValidate ? await statsOnly(
|
|
25466
|
+
const config2 = await resolveContentCommandConfig("stats", input);
|
|
25467
|
+
const all = input.noValidate ? await statsOnly(config2.globs, config2.cwd) : await statsWithValidation(
|
|
23699
25468
|
{
|
|
23700
|
-
registry:
|
|
23701
|
-
|
|
23702
|
-
cwd:
|
|
25469
|
+
registry: config2.registry,
|
|
25470
|
+
includeGenericBlocks: config2.includeGenericBlocks,
|
|
25471
|
+
cwd: config2.cwd
|
|
23703
25472
|
},
|
|
23704
|
-
|
|
25473
|
+
config2.globs
|
|
23705
25474
|
);
|
|
23706
25475
|
io.stdout(JSON.stringify(all.length === 1 ? all[0] : all, null, 2));
|
|
23707
25476
|
return 0;
|
|
@@ -23712,7 +25481,7 @@ async function statsWithValidation(input, positionals) {
|
|
|
23712
25481
|
positionals,
|
|
23713
25482
|
cwd: input.cwd,
|
|
23714
25483
|
registry: input.registry,
|
|
23715
|
-
includeGenericBlocks:
|
|
25484
|
+
includeGenericBlocks: input.includeGenericBlocks,
|
|
23716
25485
|
linkOptions: {}
|
|
23717
25486
|
});
|
|
23718
25487
|
return scan.files.map((file2) => {
|
|
@@ -23735,8 +25504,8 @@ var init_stats = __esm({
|
|
|
23735
25504
|
"src/commands/stats.ts"() {
|
|
23736
25505
|
"use strict";
|
|
23737
25506
|
init_dist();
|
|
25507
|
+
init_command_config();
|
|
23738
25508
|
init_content_project();
|
|
23739
|
-
init_script_defaults();
|
|
23740
25509
|
}
|
|
23741
25510
|
});
|
|
23742
25511
|
|
|
@@ -23846,10 +25615,10 @@ var init_docs = __esm({
|
|
|
23846
25615
|
import { readFile as readFile8 } from "node:fs/promises";
|
|
23847
25616
|
async function collectLinkInputs(files) {
|
|
23848
25617
|
const inputs = [];
|
|
23849
|
-
for (const
|
|
23850
|
-
const source = await readFile8(
|
|
25618
|
+
for (const path4 of files) {
|
|
25619
|
+
const source = await readFile8(path4, "utf8");
|
|
23851
25620
|
const fm = extractFrontmatter(source);
|
|
23852
|
-
inputs.push({ path:
|
|
25621
|
+
inputs.push({ path: path4, data: fm?.data ?? {} });
|
|
23853
25622
|
}
|
|
23854
25623
|
return inputs;
|
|
23855
25624
|
}
|
|
@@ -23866,18 +25635,12 @@ __export(links_exports, {
|
|
|
23866
25635
|
linksCommand: () => linksCommand
|
|
23867
25636
|
});
|
|
23868
25637
|
import { mkdir as mkdir3, readFile as readFile9 } from "node:fs/promises";
|
|
23869
|
-
import { dirname as dirname6, join as
|
|
25638
|
+
import { dirname as dirname6, join as join10 } from "node:path";
|
|
23870
25639
|
async function linksCommand(input, io) {
|
|
23871
|
-
const
|
|
23872
|
-
const files = await resolveContentFiles2(
|
|
25640
|
+
const config2 = await resolveContentCommandConfig("links", input);
|
|
25641
|
+
const files = await resolveContentFiles2(config2.globs, "links", { cwd: config2.cwd });
|
|
23873
25642
|
const inputs = await collectLinkInputs(files);
|
|
23874
|
-
const linkOptions =
|
|
23875
|
-
linkResolve: input.linkResolve ?? defaults.linkResolve,
|
|
23876
|
-
localeField: input.localeField ?? defaults.localeField,
|
|
23877
|
-
slugField: input.slugField ?? defaults.slugField,
|
|
23878
|
-
keyField: input.keyField ?? defaults.keyField,
|
|
23879
|
-
defaultLocale: input.defaultLocale ?? defaults.defaultLocale
|
|
23880
|
-
});
|
|
25643
|
+
const linkOptions = config2.resolveLinkOptions();
|
|
23881
25644
|
let errors = 0;
|
|
23882
25645
|
let warnings = 0;
|
|
23883
25646
|
for (const { file: file2, diagnostic } of validateLinks(inputs, linkOptions)) {
|
|
@@ -23917,7 +25680,7 @@ async function linksCommand(input, io) {
|
|
|
23917
25680
|
}
|
|
23918
25681
|
}
|
|
23919
25682
|
}
|
|
23920
|
-
const outPath = input.out ??
|
|
25683
|
+
const outPath = input.out ?? join10(config2.cwd ?? process.cwd(), ".contentbit", "link-index.json");
|
|
23921
25684
|
await mkdir3(dirname6(outPath), { recursive: true });
|
|
23922
25685
|
await io.writeFile(outPath, JSON.stringify(serializeLinkIndex(index), null, 2) + "\n");
|
|
23923
25686
|
const graph = linkGraphSummary(index);
|
|
@@ -23945,11 +25708,10 @@ var init_links2 = __esm({
|
|
|
23945
25708
|
"src/commands/links.ts"() {
|
|
23946
25709
|
"use strict";
|
|
23947
25710
|
init_dist();
|
|
25711
|
+
init_command_config();
|
|
23948
25712
|
init_cli_format();
|
|
23949
25713
|
init_content_project();
|
|
23950
|
-
init_link_options();
|
|
23951
25714
|
init_links_io();
|
|
23952
|
-
init_script_defaults();
|
|
23953
25715
|
}
|
|
23954
25716
|
});
|
|
23955
25717
|
|
|
@@ -24133,6 +25895,26 @@ function createProgram(io, setExitCode) {
|
|
|
24133
25895
|
)
|
|
24134
25896
|
);
|
|
24135
25897
|
});
|
|
25898
|
+
const snapshot = program2.command("snapshot").description("print a portable project snapshot as JSON").argument("[globs...]", "Content files or quoted globs; defaults to project config").option("--registry <module>", "Load custom block definitions from this module").option("--no-generic-blocks", "Do not include the built-in generic block pack").option("--seo-config <module>", "Load SEO contracts from this module").option("--no-seo", "Disable SEO config discovery and findings").option("--revision <id>", "Attach a Git revision or other source identifier");
|
|
25899
|
+
addLinkOptions(snapshot);
|
|
25900
|
+
snapshot.action(async (globs, rawOptions) => {
|
|
25901
|
+
const options = optionsFrom(rawOptions);
|
|
25902
|
+
const { snapshotCommand: snapshotCommand2 } = await Promise.resolve().then(() => (init_snapshot(), snapshot_exports));
|
|
25903
|
+
setExitCode(
|
|
25904
|
+
await snapshotCommand2(
|
|
25905
|
+
{
|
|
25906
|
+
globs,
|
|
25907
|
+
registry: options.registry,
|
|
25908
|
+
noGenericBlocks: options.genericBlocks === false,
|
|
25909
|
+
seoConfig: options.seoConfig,
|
|
25910
|
+
noSeo: options.seo === false ? true : void 0,
|
|
25911
|
+
revision: options.revision,
|
|
25912
|
+
...linkOptionsFrom(options)
|
|
25913
|
+
},
|
|
25914
|
+
io
|
|
25915
|
+
)
|
|
25916
|
+
);
|
|
25917
|
+
});
|
|
24136
25918
|
program2.command("stats").description("print document stats as JSON").argument("[globs...]", "Content files or quoted globs; defaults to project config").option("--registry <module>", "Load custom block definitions from this module").option("--no-generic-blocks", "Do not include the built-in generic block pack").option("--no-validate", "Analyze Markdown without loading or validating blocks").action(async (globs, rawOptions) => {
|
|
24137
25919
|
const options = optionsFrom(rawOptions);
|
|
24138
25920
|
const { statsCommand: statsCommand2 } = await Promise.resolve().then(() => (init_stats(), stats_exports));
|
|
@@ -24287,6 +26069,7 @@ Commands:
|
|
|
24287
26069
|
brief print an agent-ready SEO brief
|
|
24288
26070
|
doctor inspect content health and repair suggestions
|
|
24289
26071
|
studio browse content locally
|
|
26072
|
+
snapshot print a portable project snapshot as JSON
|
|
24290
26073
|
stats print document stats as JSON
|
|
24291
26074
|
render render one file to plain Markdown
|
|
24292
26075
|
instructions print LLM authoring instructions
|
|
@@ -24304,6 +26087,7 @@ Common:
|
|
|
24304
26087
|
brief <key-or-slug> [globs...] [--registry <module.ts>] [--no-generic-blocks] [--seo-config <module.ts>] [--json]
|
|
24305
26088
|
doctor [globs...] [--watch] [--registry <module.ts>] [--no-generic-blocks] [--strict-warnings] [--strict-seo] [--seo-config <module.ts>] [--no-seo] [--json] [--min-section-words <n>] [--link-resolve <mode>]
|
|
24306
26089
|
studio [globs...] [--registry <module.ts>] [--port <n>] [--host <host>] [--no-open] [--no-generic-blocks] [--seo-config <module.ts>] [--no-seo] [--link-resolve <mode>]
|
|
26090
|
+
snapshot [globs...] [--registry <module.ts>] [--no-generic-blocks] [--seo-config <module.ts>] [--no-seo] [--revision <id>] [--link-resolve <mode>]
|
|
24307
26091
|
stats <globs...> [--registry <module.ts>] [--no-generic-blocks] [--no-validate]
|
|
24308
26092
|
render <file> [--target markdown] [--registry <module.ts>] [--no-generic-blocks] [--out <file>]
|
|
24309
26093
|
instructions [--audience llm|human] [--no-examples] [--registry <module.ts>] [--no-generic-blocks] [--out <file>]
|