@csark0812/skeleton 1.5.6 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -8
- package/dist/cli.js +3346 -1681
- package/dist/hooks/customize-on-skill-read.js +954 -95
- package/dist/plugin-types.d.ts +19 -3
- package/dist/plugin-types.js +4 -3
- package/package.json +2 -1
- package/schemas/config.schema.json +57 -9
- package/templates/skeleton-init/config.yaml +5 -4
- package/templates/skeleton-init/skeleton.toml +37 -0
- package/templates/skeleton-init/registry.md +0 -10
|
@@ -7693,7 +7693,7 @@ var require_stringify = __commonJS((exports) => {
|
|
|
7693
7693
|
props.push(doc.directives.tagString(tag));
|
|
7694
7694
|
return props.join(" ");
|
|
7695
7695
|
}
|
|
7696
|
-
function
|
|
7696
|
+
function stringify2(item, ctx, onComment, onChompKeep) {
|
|
7697
7697
|
if (identity.isPair(item))
|
|
7698
7698
|
return item.toString(ctx, onComment, onChompKeep);
|
|
7699
7699
|
if (identity.isAlias(item)) {
|
|
@@ -7722,14 +7722,14 @@ var require_stringify = __commonJS((exports) => {
|
|
|
7722
7722
|
${ctx.indent}${str}`;
|
|
7723
7723
|
}
|
|
7724
7724
|
exports.createStringifyContext = createStringifyContext;
|
|
7725
|
-
exports.stringify =
|
|
7725
|
+
exports.stringify = stringify2;
|
|
7726
7726
|
});
|
|
7727
7727
|
|
|
7728
7728
|
// node_modules/yaml/dist/stringify/stringifyPair.js
|
|
7729
7729
|
var require_stringifyPair = __commonJS((exports) => {
|
|
7730
7730
|
var identity = require_identity();
|
|
7731
7731
|
var Scalar = require_Scalar();
|
|
7732
|
-
var
|
|
7732
|
+
var stringify2 = require_stringify();
|
|
7733
7733
|
var stringifyComment = require_stringifyComment();
|
|
7734
7734
|
function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
|
7735
7735
|
const { allNullValues, doc, indent, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx;
|
|
@@ -7751,7 +7751,7 @@ var require_stringifyPair = __commonJS((exports) => {
|
|
|
7751
7751
|
});
|
|
7752
7752
|
let keyCommentDone = false;
|
|
7753
7753
|
let chompKeep = false;
|
|
7754
|
-
let str =
|
|
7754
|
+
let str = stringify2.stringify(key, ctx, () => keyCommentDone = true, () => chompKeep = true);
|
|
7755
7755
|
if (!explicitKey && !ctx.inFlow && str.length > 1024) {
|
|
7756
7756
|
if (simpleKeys)
|
|
7757
7757
|
throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
|
|
@@ -7803,7 +7803,7 @@ ${indent}:`;
|
|
|
7803
7803
|
ctx.indent = ctx.indent.substring(2);
|
|
7804
7804
|
}
|
|
7805
7805
|
let valueCommentDone = false;
|
|
7806
|
-
const valueStr =
|
|
7806
|
+
const valueStr = stringify2.stringify(value, ctx, () => valueCommentDone = true, () => chompKeep = true);
|
|
7807
7807
|
let ws = " ";
|
|
7808
7808
|
if (keyComment || vsb || vcb) {
|
|
7809
7809
|
ws = vsb ? `
|
|
@@ -7941,7 +7941,7 @@ var require_merge = __commonJS((exports) => {
|
|
|
7941
7941
|
var require_addPairToJSMap = __commonJS((exports) => {
|
|
7942
7942
|
var log = require_log();
|
|
7943
7943
|
var merge = require_merge();
|
|
7944
|
-
var
|
|
7944
|
+
var stringify2 = require_stringify();
|
|
7945
7945
|
var identity = require_identity();
|
|
7946
7946
|
var toJS = require_toJS();
|
|
7947
7947
|
function addPairToJSMap(ctx, map, { key, value }) {
|
|
@@ -7977,7 +7977,7 @@ var require_addPairToJSMap = __commonJS((exports) => {
|
|
|
7977
7977
|
if (typeof jsKey !== "object")
|
|
7978
7978
|
return String(jsKey);
|
|
7979
7979
|
if (identity.isNode(key) && ctx?.doc) {
|
|
7980
|
-
const strCtx =
|
|
7980
|
+
const strCtx = stringify2.createStringifyContext(ctx.doc, {});
|
|
7981
7981
|
strCtx.anchors = new Set;
|
|
7982
7982
|
for (const node of ctx.anchors.keys())
|
|
7983
7983
|
strCtx.anchors.add(node.anchor);
|
|
@@ -8039,12 +8039,12 @@ var require_Pair = __commonJS((exports) => {
|
|
|
8039
8039
|
// node_modules/yaml/dist/stringify/stringifyCollection.js
|
|
8040
8040
|
var require_stringifyCollection = __commonJS((exports) => {
|
|
8041
8041
|
var identity = require_identity();
|
|
8042
|
-
var
|
|
8042
|
+
var stringify2 = require_stringify();
|
|
8043
8043
|
var stringifyComment = require_stringifyComment();
|
|
8044
8044
|
function stringifyCollection(collection, ctx, options) {
|
|
8045
8045
|
const flow = ctx.inFlow ?? collection.flow;
|
|
8046
|
-
const
|
|
8047
|
-
return
|
|
8046
|
+
const stringify3 = flow ? stringifyFlowCollection : stringifyBlockCollection;
|
|
8047
|
+
return stringify3(collection, ctx, options);
|
|
8048
8048
|
}
|
|
8049
8049
|
function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, flowChars, itemIndent, onChompKeep, onComment }) {
|
|
8050
8050
|
const { indent, options: { commentString } } = ctx;
|
|
@@ -8069,7 +8069,7 @@ var require_stringifyCollection = __commonJS((exports) => {
|
|
|
8069
8069
|
}
|
|
8070
8070
|
}
|
|
8071
8071
|
chompKeep = false;
|
|
8072
|
-
let str2 =
|
|
8072
|
+
let str2 = stringify2.stringify(item, itemCtx, () => comment2 = null, () => chompKeep = true);
|
|
8073
8073
|
if (comment2)
|
|
8074
8074
|
str2 += stringifyComment.lineComment(str2, itemIndent, commentString(comment2));
|
|
8075
8075
|
if (chompKeep && comment2)
|
|
@@ -8138,7 +8138,7 @@ ${indent}${line}` : `
|
|
|
8138
8138
|
}
|
|
8139
8139
|
if (comment)
|
|
8140
8140
|
reqNewline = true;
|
|
8141
|
-
let str =
|
|
8141
|
+
let str = stringify2.stringify(item, itemCtx, () => comment = null);
|
|
8142
8142
|
reqNewline || (reqNewline = lines.length > linesAtValue || str.includes(`
|
|
8143
8143
|
`));
|
|
8144
8144
|
if (i < items.length - 1) {
|
|
@@ -9379,7 +9379,7 @@ var require_Schema = __commonJS((exports) => {
|
|
|
9379
9379
|
// node_modules/yaml/dist/stringify/stringifyDocument.js
|
|
9380
9380
|
var require_stringifyDocument = __commonJS((exports) => {
|
|
9381
9381
|
var identity = require_identity();
|
|
9382
|
-
var
|
|
9382
|
+
var stringify2 = require_stringify();
|
|
9383
9383
|
var stringifyComment = require_stringifyComment();
|
|
9384
9384
|
function stringifyDocument(doc, options) {
|
|
9385
9385
|
const lines = [];
|
|
@@ -9394,7 +9394,7 @@ var require_stringifyDocument = __commonJS((exports) => {
|
|
|
9394
9394
|
}
|
|
9395
9395
|
if (hasDirectives)
|
|
9396
9396
|
lines.push("---");
|
|
9397
|
-
const ctx =
|
|
9397
|
+
const ctx = stringify2.createStringifyContext(doc, options);
|
|
9398
9398
|
const { commentString } = ctx.options;
|
|
9399
9399
|
if (doc.commentBefore) {
|
|
9400
9400
|
if (lines.length !== 1)
|
|
@@ -9416,7 +9416,7 @@ var require_stringifyDocument = __commonJS((exports) => {
|
|
|
9416
9416
|
contentComment = doc.contents.comment;
|
|
9417
9417
|
}
|
|
9418
9418
|
const onChompKeep = contentComment ? undefined : () => chompKeep = true;
|
|
9419
|
-
let body =
|
|
9419
|
+
let body = stringify2.stringify(doc.contents, ctx, () => contentComment = null, onChompKeep);
|
|
9420
9420
|
if (contentComment)
|
|
9421
9421
|
body += stringifyComment.lineComment(body, "", commentString(contentComment));
|
|
9422
9422
|
if ((body[0] === "|" || body[0] === ">") && lines[lines.length - 1] === "---") {
|
|
@@ -9424,7 +9424,7 @@ var require_stringifyDocument = __commonJS((exports) => {
|
|
|
9424
9424
|
} else
|
|
9425
9425
|
lines.push(body);
|
|
9426
9426
|
} else {
|
|
9427
|
-
lines.push(
|
|
9427
|
+
lines.push(stringify2.stringify(doc.contents, ctx));
|
|
9428
9428
|
}
|
|
9429
9429
|
if (doc.directives?.docEnd) {
|
|
9430
9430
|
if (doc.comment) {
|
|
@@ -11443,7 +11443,7 @@ var require_cst_scalar = __commonJS((exports) => {
|
|
|
11443
11443
|
|
|
11444
11444
|
// node_modules/yaml/dist/parse/cst-stringify.js
|
|
11445
11445
|
var require_cst_stringify = __commonJS((exports) => {
|
|
11446
|
-
var
|
|
11446
|
+
var stringify2 = (cst) => ("type" in cst) ? stringifyToken(cst) : stringifyItem(cst);
|
|
11447
11447
|
function stringifyToken(token) {
|
|
11448
11448
|
switch (token.type) {
|
|
11449
11449
|
case "block-scalar": {
|
|
@@ -11496,7 +11496,7 @@ var require_cst_stringify = __commonJS((exports) => {
|
|
|
11496
11496
|
res += stringifyToken(value);
|
|
11497
11497
|
return res;
|
|
11498
11498
|
}
|
|
11499
|
-
exports.stringify =
|
|
11499
|
+
exports.stringify = stringify2;
|
|
11500
11500
|
});
|
|
11501
11501
|
|
|
11502
11502
|
// node_modules/yaml/dist/parse/cst-visit.js
|
|
@@ -13187,7 +13187,7 @@ var require_public_api = __commonJS((exports) => {
|
|
|
13187
13187
|
}
|
|
13188
13188
|
return doc;
|
|
13189
13189
|
}
|
|
13190
|
-
function
|
|
13190
|
+
function parse2(src, reviver, options) {
|
|
13191
13191
|
let _reviver = undefined;
|
|
13192
13192
|
if (typeof reviver === "function") {
|
|
13193
13193
|
_reviver = reviver;
|
|
@@ -13206,7 +13206,7 @@ var require_public_api = __commonJS((exports) => {
|
|
|
13206
13206
|
}
|
|
13207
13207
|
return doc.toJS(Object.assign({ reviver: _reviver }, options));
|
|
13208
13208
|
}
|
|
13209
|
-
function
|
|
13209
|
+
function stringify2(value, replacer, options) {
|
|
13210
13210
|
let _replacer = null;
|
|
13211
13211
|
if (typeof replacer === "function" || Array.isArray(replacer)) {
|
|
13212
13212
|
_replacer = replacer;
|
|
@@ -13228,17 +13228,20 @@ var require_public_api = __commonJS((exports) => {
|
|
|
13228
13228
|
return value.toString(options);
|
|
13229
13229
|
return new Document.Document(value, _replacer, options).toString(options);
|
|
13230
13230
|
}
|
|
13231
|
-
exports.parse =
|
|
13231
|
+
exports.parse = parse2;
|
|
13232
13232
|
exports.parseAllDocuments = parseAllDocuments;
|
|
13233
13233
|
exports.parseDocument = parseDocument;
|
|
13234
|
-
exports.stringify =
|
|
13234
|
+
exports.stringify = stringify2;
|
|
13235
13235
|
});
|
|
13236
13236
|
|
|
13237
13237
|
// src/hooks/customize-on-skill-read.ts
|
|
13238
|
-
import { readFileSync as
|
|
13238
|
+
import { readFileSync as readFileSync3 } from "node:fs";
|
|
13239
|
+
import process3 from "node:process";
|
|
13240
|
+
|
|
13241
|
+
// src/hooks/run.ts
|
|
13242
|
+
import process2 from "node:process";
|
|
13239
13243
|
|
|
13240
13244
|
// src/audit/core/shared.ts
|
|
13241
|
-
var REGISTRY_REL_PATH = ".skeleton/registry.md";
|
|
13242
13245
|
var REGISTRY_DIR_REL = ".skeleton";
|
|
13243
13246
|
function normalizeRelPath(p) {
|
|
13244
13247
|
let out = p.replace(/\\/g, "/");
|
|
@@ -13305,15 +13308,893 @@ function slugFromPath(filePath, workspaceRoot) {
|
|
|
13305
13308
|
}
|
|
13306
13309
|
|
|
13307
13310
|
// src/customize/resolve.ts
|
|
13308
|
-
import { existsSync as
|
|
13309
|
-
import { basename, join as
|
|
13311
|
+
import { existsSync as existsSync3, readFileSync as readFileSync2 } from "node:fs";
|
|
13312
|
+
import { basename, join as join3, relative as relative2 } from "node:path";
|
|
13310
13313
|
|
|
13311
13314
|
// src/audit/config/load.ts
|
|
13312
13315
|
var import_ajv = __toESM(require_ajv(), 1);
|
|
13313
13316
|
import { existsSync as existsSync2, readFileSync } from "node:fs";
|
|
13314
13317
|
import { dirname, join as join2 } from "node:path";
|
|
13318
|
+
import process from "node:process";
|
|
13315
13319
|
import { fileURLToPath } from "node:url";
|
|
13316
13320
|
|
|
13321
|
+
// node_modules/smol-toml/dist/date.js
|
|
13322
|
+
/*!
|
|
13323
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
13324
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
13325
|
+
*
|
|
13326
|
+
* Redistribution and use in source and binary forms, with or without
|
|
13327
|
+
* modification, are permitted provided that the following conditions are met:
|
|
13328
|
+
*
|
|
13329
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
13330
|
+
* list of conditions and the following disclaimer.
|
|
13331
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13332
|
+
* this list of conditions and the following disclaimer in the
|
|
13333
|
+
* documentation and/or other materials provided with the distribution.
|
|
13334
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
13335
|
+
* may be used to endorse or promote products derived from this software without
|
|
13336
|
+
* specific prior written permission.
|
|
13337
|
+
*
|
|
13338
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
13339
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
13340
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
13341
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
13342
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
13343
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
13344
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
13345
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
13346
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
13347
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
13348
|
+
*/
|
|
13349
|
+
var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
|
|
13350
|
+
|
|
13351
|
+
class TomlDate extends Date {
|
|
13352
|
+
#hasDate = false;
|
|
13353
|
+
#hasTime = false;
|
|
13354
|
+
#offset = null;
|
|
13355
|
+
constructor(date) {
|
|
13356
|
+
let hasDate = true;
|
|
13357
|
+
let hasTime = true;
|
|
13358
|
+
let offset = "Z";
|
|
13359
|
+
if (typeof date === "string") {
|
|
13360
|
+
let match = date.match(DATE_TIME_RE);
|
|
13361
|
+
if (match) {
|
|
13362
|
+
if (!match[1]) {
|
|
13363
|
+
hasDate = false;
|
|
13364
|
+
date = `0000-01-01T${date}`;
|
|
13365
|
+
}
|
|
13366
|
+
hasTime = !!match[2];
|
|
13367
|
+
hasTime && date[10] === " " && (date = date.replace(" ", "T"));
|
|
13368
|
+
if (match[2] && +match[2] > 23) {
|
|
13369
|
+
date = "";
|
|
13370
|
+
} else {
|
|
13371
|
+
offset = match[3] || null;
|
|
13372
|
+
date = date.toUpperCase();
|
|
13373
|
+
if (!offset && hasTime)
|
|
13374
|
+
date += "Z";
|
|
13375
|
+
}
|
|
13376
|
+
} else {
|
|
13377
|
+
date = "";
|
|
13378
|
+
}
|
|
13379
|
+
}
|
|
13380
|
+
super(date);
|
|
13381
|
+
if (!isNaN(this.getTime())) {
|
|
13382
|
+
this.#hasDate = hasDate;
|
|
13383
|
+
this.#hasTime = hasTime;
|
|
13384
|
+
this.#offset = offset;
|
|
13385
|
+
}
|
|
13386
|
+
}
|
|
13387
|
+
isDateTime() {
|
|
13388
|
+
return this.#hasDate && this.#hasTime;
|
|
13389
|
+
}
|
|
13390
|
+
isLocal() {
|
|
13391
|
+
return !this.#hasDate || !this.#hasTime || !this.#offset;
|
|
13392
|
+
}
|
|
13393
|
+
isDate() {
|
|
13394
|
+
return this.#hasDate && !this.#hasTime;
|
|
13395
|
+
}
|
|
13396
|
+
isTime() {
|
|
13397
|
+
return this.#hasTime && !this.#hasDate;
|
|
13398
|
+
}
|
|
13399
|
+
isValid() {
|
|
13400
|
+
return this.#hasDate || this.#hasTime;
|
|
13401
|
+
}
|
|
13402
|
+
toISOString() {
|
|
13403
|
+
let iso = super.toISOString();
|
|
13404
|
+
if (this.isDate())
|
|
13405
|
+
return iso.slice(0, 10);
|
|
13406
|
+
if (this.isTime())
|
|
13407
|
+
return iso.slice(11, 23);
|
|
13408
|
+
if (this.#offset === null)
|
|
13409
|
+
return iso.slice(0, -1);
|
|
13410
|
+
if (this.#offset === "Z")
|
|
13411
|
+
return iso;
|
|
13412
|
+
let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
|
|
13413
|
+
offset = this.#offset[0] === "-" ? offset : -offset;
|
|
13414
|
+
let offsetDate = new Date(this.getTime() - offset * 60000);
|
|
13415
|
+
return offsetDate.toISOString().slice(0, -1) + this.#offset;
|
|
13416
|
+
}
|
|
13417
|
+
static wrapAsOffsetDateTime(jsDate, offset = "Z") {
|
|
13418
|
+
let date = new TomlDate(jsDate);
|
|
13419
|
+
date.#offset = offset;
|
|
13420
|
+
return date;
|
|
13421
|
+
}
|
|
13422
|
+
static wrapAsLocalDateTime(jsDate) {
|
|
13423
|
+
let date = new TomlDate(jsDate);
|
|
13424
|
+
date.#offset = null;
|
|
13425
|
+
return date;
|
|
13426
|
+
}
|
|
13427
|
+
static wrapAsLocalDate(jsDate) {
|
|
13428
|
+
let date = new TomlDate(jsDate);
|
|
13429
|
+
date.#hasTime = false;
|
|
13430
|
+
date.#offset = null;
|
|
13431
|
+
return date;
|
|
13432
|
+
}
|
|
13433
|
+
static wrapAsLocalTime(jsDate) {
|
|
13434
|
+
let date = new TomlDate(jsDate);
|
|
13435
|
+
date.#hasDate = false;
|
|
13436
|
+
date.#offset = null;
|
|
13437
|
+
return date;
|
|
13438
|
+
}
|
|
13439
|
+
}
|
|
13440
|
+
|
|
13441
|
+
// node_modules/smol-toml/dist/error.js
|
|
13442
|
+
/*!
|
|
13443
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
13444
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
13445
|
+
*
|
|
13446
|
+
* Redistribution and use in source and binary forms, with or without
|
|
13447
|
+
* modification, are permitted provided that the following conditions are met:
|
|
13448
|
+
*
|
|
13449
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
13450
|
+
* list of conditions and the following disclaimer.
|
|
13451
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13452
|
+
* this list of conditions and the following disclaimer in the
|
|
13453
|
+
* documentation and/or other materials provided with the distribution.
|
|
13454
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
13455
|
+
* may be used to endorse or promote products derived from this software without
|
|
13456
|
+
* specific prior written permission.
|
|
13457
|
+
*
|
|
13458
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
13459
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
13460
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
13461
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
13462
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
13463
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
13464
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
13465
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
13466
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
13467
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
13468
|
+
*/
|
|
13469
|
+
function getLineColFromPtr(string, ptr) {
|
|
13470
|
+
let lines = string.slice(0, ptr).split(/\r\n|\n|\r/g);
|
|
13471
|
+
return [lines.length, lines.pop().length + 1];
|
|
13472
|
+
}
|
|
13473
|
+
function makeCodeBlock(string, line, column) {
|
|
13474
|
+
let lines = string.split(/\r\n|\n|\r/g);
|
|
13475
|
+
let codeblock = "";
|
|
13476
|
+
let numberLen = (Math.log10(line + 1) | 0) + 1;
|
|
13477
|
+
for (let i = line - 1;i <= line + 1; i++) {
|
|
13478
|
+
let l = lines[i - 1];
|
|
13479
|
+
if (!l)
|
|
13480
|
+
continue;
|
|
13481
|
+
codeblock += i.toString().padEnd(numberLen, " ");
|
|
13482
|
+
codeblock += ": ";
|
|
13483
|
+
codeblock += l;
|
|
13484
|
+
codeblock += `
|
|
13485
|
+
`;
|
|
13486
|
+
if (i === line) {
|
|
13487
|
+
codeblock += " ".repeat(numberLen + column + 2);
|
|
13488
|
+
codeblock += `^
|
|
13489
|
+
`;
|
|
13490
|
+
}
|
|
13491
|
+
}
|
|
13492
|
+
return codeblock;
|
|
13493
|
+
}
|
|
13494
|
+
|
|
13495
|
+
class TomlError extends Error {
|
|
13496
|
+
line;
|
|
13497
|
+
column;
|
|
13498
|
+
codeblock;
|
|
13499
|
+
constructor(message, options) {
|
|
13500
|
+
const [line, column] = getLineColFromPtr(options.toml, options.ptr);
|
|
13501
|
+
const codeblock = makeCodeBlock(options.toml, line, column);
|
|
13502
|
+
super(`Invalid TOML document: ${message}
|
|
13503
|
+
|
|
13504
|
+
${codeblock}`, options);
|
|
13505
|
+
this.line = line;
|
|
13506
|
+
this.column = column;
|
|
13507
|
+
this.codeblock = codeblock;
|
|
13508
|
+
}
|
|
13509
|
+
}
|
|
13510
|
+
|
|
13511
|
+
// node_modules/smol-toml/dist/util.js
|
|
13512
|
+
/*!
|
|
13513
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
13514
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
13515
|
+
*
|
|
13516
|
+
* Redistribution and use in source and binary forms, with or without
|
|
13517
|
+
* modification, are permitted provided that the following conditions are met:
|
|
13518
|
+
*
|
|
13519
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
13520
|
+
* list of conditions and the following disclaimer.
|
|
13521
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13522
|
+
* this list of conditions and the following disclaimer in the
|
|
13523
|
+
* documentation and/or other materials provided with the distribution.
|
|
13524
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
13525
|
+
* may be used to endorse or promote products derived from this software without
|
|
13526
|
+
* specific prior written permission.
|
|
13527
|
+
*
|
|
13528
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
13529
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
13530
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
13531
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
13532
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
13533
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
13534
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
13535
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
13536
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
13537
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
13538
|
+
*/
|
|
13539
|
+
function indexOfNewline(str, start = 0) {
|
|
13540
|
+
let idx = str.indexOf(`
|
|
13541
|
+
`, start);
|
|
13542
|
+
if (str.charCodeAt(idx - 1) === 13)
|
|
13543
|
+
idx--;
|
|
13544
|
+
return idx;
|
|
13545
|
+
}
|
|
13546
|
+
function skipComment(ctx) {
|
|
13547
|
+
for (;ctx.p < ctx.s.length; ctx.p++) {
|
|
13548
|
+
let c = ctx.s.charCodeAt(ctx.p);
|
|
13549
|
+
if (c === 10)
|
|
13550
|
+
break;
|
|
13551
|
+
if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
|
|
13552
|
+
ctx.p++;
|
|
13553
|
+
break;
|
|
13554
|
+
}
|
|
13555
|
+
if (c < 32 && c !== 9 || c === 127) {
|
|
13556
|
+
throw new TomlError("control characters are not allowed in comments", {
|
|
13557
|
+
toml: ctx.s,
|
|
13558
|
+
ptr: ctx.p
|
|
13559
|
+
});
|
|
13560
|
+
}
|
|
13561
|
+
}
|
|
13562
|
+
}
|
|
13563
|
+
function skipVoid(ctx, banNewLines, banComments) {
|
|
13564
|
+
let c;
|
|
13565
|
+
while (true) {
|
|
13566
|
+
while ((c = ctx.s.charCodeAt(ctx.p)) === 32 || c === 9 || !banNewLines && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10))
|
|
13567
|
+
ctx.p++;
|
|
13568
|
+
if (banComments || c !== 35)
|
|
13569
|
+
break;
|
|
13570
|
+
skipComment(ctx);
|
|
13571
|
+
}
|
|
13572
|
+
}
|
|
13573
|
+
function skipUntil(ctx, sep, end) {
|
|
13574
|
+
let ptr = ctx.p;
|
|
13575
|
+
if (!end) {
|
|
13576
|
+
ptr = indexOfNewline(ctx.s, ptr);
|
|
13577
|
+
ctx.p = ptr < 0 ? ctx.s.length : ptr;
|
|
13578
|
+
return;
|
|
13579
|
+
}
|
|
13580
|
+
for (;ctx.p < ctx.s.length; ctx.p++) {
|
|
13581
|
+
let c = ctx.s.charCodeAt(ctx.p);
|
|
13582
|
+
if (c === 35) {
|
|
13583
|
+
skipComment(ctx);
|
|
13584
|
+
} else if (c === end || c === sep) {
|
|
13585
|
+
return;
|
|
13586
|
+
}
|
|
13587
|
+
}
|
|
13588
|
+
throw new TomlError("cannot find end of structure", {
|
|
13589
|
+
toml: ctx.s,
|
|
13590
|
+
ptr
|
|
13591
|
+
});
|
|
13592
|
+
}
|
|
13593
|
+
|
|
13594
|
+
// node_modules/smol-toml/dist/primitive.js
|
|
13595
|
+
/*!
|
|
13596
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
13597
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
13598
|
+
*
|
|
13599
|
+
* Redistribution and use in source and binary forms, with or without
|
|
13600
|
+
* modification, are permitted provided that the following conditions are met:
|
|
13601
|
+
*
|
|
13602
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
13603
|
+
* list of conditions and the following disclaimer.
|
|
13604
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13605
|
+
* this list of conditions and the following disclaimer in the
|
|
13606
|
+
* documentation and/or other materials provided with the distribution.
|
|
13607
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
13608
|
+
* may be used to endorse or promote products derived from this software without
|
|
13609
|
+
* specific prior written permission.
|
|
13610
|
+
*
|
|
13611
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
13612
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
13613
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
13614
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
13615
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
13616
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
13617
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
13618
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
13619
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
13620
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
13621
|
+
*/
|
|
13622
|
+
var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
|
|
13623
|
+
var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
|
|
13624
|
+
var LEADING_ZERO = /^[+-]?0[0-9_]/;
|
|
13625
|
+
function parseString(ctx) {
|
|
13626
|
+
let start = ctx.p;
|
|
13627
|
+
let c = ctx.s.charCodeAt(ctx.p++);
|
|
13628
|
+
let first = c;
|
|
13629
|
+
let isLiteral = c === 39;
|
|
13630
|
+
let isMultiline = c === ctx.s.charCodeAt(ctx.p) && c === ctx.s.charCodeAt(ctx.p + 1);
|
|
13631
|
+
if (isMultiline) {
|
|
13632
|
+
if ((c = ctx.s.charCodeAt(ctx.p += 2)) === 10)
|
|
13633
|
+
ctx.p++;
|
|
13634
|
+
else if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)
|
|
13635
|
+
ctx.p += 2;
|
|
13636
|
+
}
|
|
13637
|
+
let parsed = "";
|
|
13638
|
+
let sliceStart = ctx.p;
|
|
13639
|
+
let state = 0;
|
|
13640
|
+
for (;ctx.p < ctx.s.length; ctx.p++) {
|
|
13641
|
+
c = ctx.s.charCodeAt(ctx.p);
|
|
13642
|
+
if (isMultiline && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) {
|
|
13643
|
+
state = state && 3;
|
|
13644
|
+
} else if (c < 32 && c !== 9 || c === 127) {
|
|
13645
|
+
throw new TomlError("control characters are not allowed in strings", {
|
|
13646
|
+
toml: ctx.s,
|
|
13647
|
+
ptr: ctx.p
|
|
13648
|
+
});
|
|
13649
|
+
} else if ((!state || state === 3) && c === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
|
|
13650
|
+
if (isMultiline) {
|
|
13651
|
+
if (ctx.s.charCodeAt(ctx.p + 3) === first)
|
|
13652
|
+
ctx.p++;
|
|
13653
|
+
if (ctx.s.charCodeAt(ctx.p + 3) === first)
|
|
13654
|
+
ctx.p++;
|
|
13655
|
+
}
|
|
13656
|
+
if (!state)
|
|
13657
|
+
parsed += ctx.s.slice(sliceStart, ctx.p);
|
|
13658
|
+
ctx.p += isMultiline ? 3 : 1;
|
|
13659
|
+
return parsed;
|
|
13660
|
+
} else if (!state) {
|
|
13661
|
+
if (!isLiteral && c === 92) {
|
|
13662
|
+
parsed += ctx.s.slice(sliceStart, sliceStart = ctx.p);
|
|
13663
|
+
state = 1;
|
|
13664
|
+
}
|
|
13665
|
+
} else if (state === 1) {
|
|
13666
|
+
if (c === 120 || c === 117 || c === 85) {
|
|
13667
|
+
let value = 0;
|
|
13668
|
+
let len = c === 120 ? 2 : c === 117 ? 4 : 8;
|
|
13669
|
+
for (let j = 0;j < len; j++, ctx.p++) {
|
|
13670
|
+
let hex = ctx.s.charCodeAt(ctx.p + 1);
|
|
13671
|
+
let digit = hex >= 48 && hex <= 57 ? hex - 48 : hex >= 65 && hex <= 70 ? hex - 65 + 10 : hex >= 97 && hex <= 102 ? hex - 97 + 10 : -1;
|
|
13672
|
+
if (digit < 0)
|
|
13673
|
+
throw new TomlError("invalid non-hex character in unicode escape", { toml: ctx.s, ptr: ctx.p + 1 });
|
|
13674
|
+
value = value << 4 | digit;
|
|
13675
|
+
}
|
|
13676
|
+
if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) {
|
|
13677
|
+
throw new TomlError("invalid unicode escape", { toml: ctx.s, ptr: ctx.p });
|
|
13678
|
+
}
|
|
13679
|
+
parsed += String.fromCodePoint(value);
|
|
13680
|
+
sliceStart = ctx.p + 1;
|
|
13681
|
+
state = 0;
|
|
13682
|
+
} else if (c === 32 || c === 9) {
|
|
13683
|
+
state = 2;
|
|
13684
|
+
} else {
|
|
13685
|
+
if (c === 98)
|
|
13686
|
+
parsed += "\b";
|
|
13687
|
+
else if (c === 116)
|
|
13688
|
+
parsed += "\t";
|
|
13689
|
+
else if (c === 110)
|
|
13690
|
+
parsed += `
|
|
13691
|
+
`;
|
|
13692
|
+
else if (c === 102)
|
|
13693
|
+
parsed += "\f";
|
|
13694
|
+
else if (c === 114)
|
|
13695
|
+
parsed += "\r";
|
|
13696
|
+
else if (c === 101)
|
|
13697
|
+
parsed += "\x1B";
|
|
13698
|
+
else if (c === 34)
|
|
13699
|
+
parsed += '"';
|
|
13700
|
+
else if (c === 92)
|
|
13701
|
+
parsed += "\\";
|
|
13702
|
+
else
|
|
13703
|
+
throw new TomlError("unrecognized escape sequence", { toml: ctx.s, ptr: ctx.p });
|
|
13704
|
+
sliceStart = ctx.p + 1;
|
|
13705
|
+
state = 0;
|
|
13706
|
+
}
|
|
13707
|
+
} else if (c !== 32 && c !== 9) {
|
|
13708
|
+
if (state === 2) {
|
|
13709
|
+
throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
|
|
13710
|
+
toml: ctx.s,
|
|
13711
|
+
ptr: sliceStart
|
|
13712
|
+
});
|
|
13713
|
+
}
|
|
13714
|
+
state = !isLiteral && c === 92 ? 1 : 0;
|
|
13715
|
+
sliceStart = ctx.p;
|
|
13716
|
+
}
|
|
13717
|
+
}
|
|
13718
|
+
throw new TomlError("unfinished string", { toml: ctx.s, ptr: start });
|
|
13719
|
+
}
|
|
13720
|
+
function sliceAndTrimEndOf(ctx, start, end) {
|
|
13721
|
+
let value = ctx.s.slice(start, end);
|
|
13722
|
+
let commentIdx = value.indexOf("#");
|
|
13723
|
+
if (commentIdx > 0) {
|
|
13724
|
+
skipComment({ s: value, p: commentIdx, d: 0 });
|
|
13725
|
+
value = value.slice(0, commentIdx);
|
|
13726
|
+
}
|
|
13727
|
+
return value.trimEnd();
|
|
13728
|
+
}
|
|
13729
|
+
function parseValue(ctx, integersAsBigInt, end) {
|
|
13730
|
+
let ptr = ctx.p;
|
|
13731
|
+
let err = { toml: ctx.s, ptr };
|
|
13732
|
+
skipUntil(ctx, 44, end);
|
|
13733
|
+
let value = sliceAndTrimEndOf(ctx, ptr, ctx.p);
|
|
13734
|
+
if (!value)
|
|
13735
|
+
throw new TomlError("incomplete declaration: value expected", err);
|
|
13736
|
+
if (value === "-inf")
|
|
13737
|
+
return -Infinity;
|
|
13738
|
+
if (value === "inf" || value === "+inf")
|
|
13739
|
+
return Infinity;
|
|
13740
|
+
if (value === "nan" || value === "+nan" || value === "-nan")
|
|
13741
|
+
return NaN;
|
|
13742
|
+
if (value === "-0")
|
|
13743
|
+
return integersAsBigInt ? 0n : 0;
|
|
13744
|
+
let isInt = INT_REGEX.test(value);
|
|
13745
|
+
if (isInt || FLOAT_REGEX.test(value)) {
|
|
13746
|
+
if (LEADING_ZERO.test(value)) {
|
|
13747
|
+
throw new TomlError("leading zeroes are not allowed", err);
|
|
13748
|
+
}
|
|
13749
|
+
value = value.replace(/_/g, "");
|
|
13750
|
+
let numeric = +value;
|
|
13751
|
+
if (isNaN(numeric)) {
|
|
13752
|
+
throw new TomlError("invalid number", err);
|
|
13753
|
+
}
|
|
13754
|
+
if (isInt) {
|
|
13755
|
+
if ((isInt = !Number.isSafeInteger(numeric)) && !integersAsBigInt) {
|
|
13756
|
+
throw new TomlError("integer value cannot be represented losslessly", err);
|
|
13757
|
+
}
|
|
13758
|
+
if (isInt || integersAsBigInt === true)
|
|
13759
|
+
numeric = BigInt(value);
|
|
13760
|
+
}
|
|
13761
|
+
return numeric;
|
|
13762
|
+
}
|
|
13763
|
+
const date = new TomlDate(value);
|
|
13764
|
+
if (!date.isValid())
|
|
13765
|
+
throw new TomlError("invalid value", err);
|
|
13766
|
+
return date;
|
|
13767
|
+
}
|
|
13768
|
+
|
|
13769
|
+
// node_modules/smol-toml/dist/extract.js
|
|
13770
|
+
/*!
|
|
13771
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
13772
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
13773
|
+
*
|
|
13774
|
+
* Redistribution and use in source and binary forms, with or without
|
|
13775
|
+
* modification, are permitted provided that the following conditions are met:
|
|
13776
|
+
*
|
|
13777
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
13778
|
+
* list of conditions and the following disclaimer.
|
|
13779
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13780
|
+
* this list of conditions and the following disclaimer in the
|
|
13781
|
+
* documentation and/or other materials provided with the distribution.
|
|
13782
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
13783
|
+
* may be used to endorse or promote products derived from this software without
|
|
13784
|
+
* specific prior written permission.
|
|
13785
|
+
*
|
|
13786
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
13787
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
13788
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
13789
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
13790
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
13791
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
13792
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
13793
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
13794
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
13795
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
13796
|
+
*/
|
|
13797
|
+
function extractValue(ctx, end, integersAsBigInt) {
|
|
13798
|
+
let ptr = ctx.p;
|
|
13799
|
+
let c = ctx.s.charCodeAt(ptr);
|
|
13800
|
+
if (c === 91 || c === 123) {
|
|
13801
|
+
if (!ctx.d--) {
|
|
13802
|
+
throw new TomlError("document contains excessively nested structures. aborting.", {
|
|
13803
|
+
toml: ctx.s,
|
|
13804
|
+
ptr
|
|
13805
|
+
});
|
|
13806
|
+
}
|
|
13807
|
+
let value = c === 91 ? parseArray(ctx, integersAsBigInt) : parseInlineTable(ctx, integersAsBigInt);
|
|
13808
|
+
ctx.d++;
|
|
13809
|
+
return value;
|
|
13810
|
+
}
|
|
13811
|
+
if (c === 34 || c === 39) {
|
|
13812
|
+
return parseString(ctx);
|
|
13813
|
+
}
|
|
13814
|
+
if (c === 116) {
|
|
13815
|
+
if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101)
|
|
13816
|
+
throw new TomlError("invalid value", { toml: ctx.s, ptr });
|
|
13817
|
+
ctx.p++;
|
|
13818
|
+
return true;
|
|
13819
|
+
}
|
|
13820
|
+
if (c === 102) {
|
|
13821
|
+
if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 108 || ctx.s.charCodeAt(++ctx.p) !== 115 || ctx.s.charCodeAt(++ctx.p) !== 101)
|
|
13822
|
+
throw new TomlError("invalid value", { toml: ctx.s, ptr });
|
|
13823
|
+
ctx.p++;
|
|
13824
|
+
return false;
|
|
13825
|
+
}
|
|
13826
|
+
return parseValue(ctx, integersAsBigInt, end);
|
|
13827
|
+
}
|
|
13828
|
+
|
|
13829
|
+
// node_modules/smol-toml/dist/struct.js
|
|
13830
|
+
/*!
|
|
13831
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
13832
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
13833
|
+
*
|
|
13834
|
+
* Redistribution and use in source and binary forms, with or without
|
|
13835
|
+
* modification, are permitted provided that the following conditions are met:
|
|
13836
|
+
*
|
|
13837
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
13838
|
+
* list of conditions and the following disclaimer.
|
|
13839
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13840
|
+
* this list of conditions and the following disclaimer in the
|
|
13841
|
+
* documentation and/or other materials provided with the distribution.
|
|
13842
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
13843
|
+
* may be used to endorse or promote products derived from this software without
|
|
13844
|
+
* specific prior written permission.
|
|
13845
|
+
*
|
|
13846
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
13847
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
13848
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
13849
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
13850
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
13851
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
13852
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
13853
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
13854
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
13855
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
13856
|
+
*/
|
|
13857
|
+
var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
|
|
13858
|
+
function parseKey(ctx, end = "=") {
|
|
13859
|
+
let start = ctx.p;
|
|
13860
|
+
let dot = start - 1;
|
|
13861
|
+
let parsed = [];
|
|
13862
|
+
let endPtr = ctx.s.indexOf(end, start);
|
|
13863
|
+
if (endPtr < 0) {
|
|
13864
|
+
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
13865
|
+
toml: ctx.s,
|
|
13866
|
+
ptr: start
|
|
13867
|
+
});
|
|
13868
|
+
}
|
|
13869
|
+
do {
|
|
13870
|
+
let c = ctx.s.charCodeAt(ctx.p = ++dot);
|
|
13871
|
+
if (c !== 32 && c !== 9) {
|
|
13872
|
+
if (c === 34 || c === 39) {
|
|
13873
|
+
if (c === ctx.s.charCodeAt(ctx.p + 1) && c === ctx.s.charCodeAt(ctx.p + 2)) {
|
|
13874
|
+
throw new TomlError("multiline strings are not allowed in keys", {
|
|
13875
|
+
toml: ctx.s,
|
|
13876
|
+
ptr: ctx.p
|
|
13877
|
+
});
|
|
13878
|
+
}
|
|
13879
|
+
let part = parseString(ctx);
|
|
13880
|
+
dot = ctx.s.indexOf(".", ctx.p);
|
|
13881
|
+
let strEnd = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
13882
|
+
let newLine = indexOfNewline(strEnd);
|
|
13883
|
+
if (newLine > -1) {
|
|
13884
|
+
throw new TomlError("newlines are not allowed in keys", {
|
|
13885
|
+
toml: ctx.s,
|
|
13886
|
+
ptr: newLine
|
|
13887
|
+
});
|
|
13888
|
+
}
|
|
13889
|
+
if (strEnd.trimStart()) {
|
|
13890
|
+
throw new TomlError("found extra tokens after the string part", {
|
|
13891
|
+
toml: ctx.s,
|
|
13892
|
+
ptr: ctx.p
|
|
13893
|
+
});
|
|
13894
|
+
}
|
|
13895
|
+
if (endPtr < ctx.p) {
|
|
13896
|
+
endPtr = ctx.s.indexOf(end, ctx.p);
|
|
13897
|
+
if (endPtr < 0) {
|
|
13898
|
+
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
13899
|
+
toml: ctx.s,
|
|
13900
|
+
ptr: start
|
|
13901
|
+
});
|
|
13902
|
+
}
|
|
13903
|
+
}
|
|
13904
|
+
parsed.push(part);
|
|
13905
|
+
} else {
|
|
13906
|
+
dot = ctx.s.indexOf(".", ctx.p);
|
|
13907
|
+
let part = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
13908
|
+
if (!KEY_PART_RE.test(part)) {
|
|
13909
|
+
throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
|
|
13910
|
+
toml: ctx.s,
|
|
13911
|
+
ptr: ctx.p
|
|
13912
|
+
});
|
|
13913
|
+
}
|
|
13914
|
+
parsed.push(part.trimEnd());
|
|
13915
|
+
}
|
|
13916
|
+
}
|
|
13917
|
+
} while (dot + 1 && dot < endPtr);
|
|
13918
|
+
ctx.p = endPtr + 1;
|
|
13919
|
+
skipVoid(ctx, true, true);
|
|
13920
|
+
return parsed;
|
|
13921
|
+
}
|
|
13922
|
+
function parseInlineTable(ctx, integersAsBigInt) {
|
|
13923
|
+
let res = {};
|
|
13924
|
+
let seen = new Set;
|
|
13925
|
+
let c;
|
|
13926
|
+
ctx.p++;
|
|
13927
|
+
while (ctx.p < ctx.s.length) {
|
|
13928
|
+
skipVoid(ctx);
|
|
13929
|
+
if ((c = ctx.s.charCodeAt(ctx.p)) === 125) {
|
|
13930
|
+
ctx.p++;
|
|
13931
|
+
return res;
|
|
13932
|
+
}
|
|
13933
|
+
let k;
|
|
13934
|
+
let t = res;
|
|
13935
|
+
let hasOwn = false;
|
|
13936
|
+
let p = ctx.p;
|
|
13937
|
+
let key = parseKey(ctx);
|
|
13938
|
+
for (let i = 0;i < key.length; i++) {
|
|
13939
|
+
if (i)
|
|
13940
|
+
t = hasOwn ? t[k] : t[k] = {};
|
|
13941
|
+
k = key[i];
|
|
13942
|
+
if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k]))) {
|
|
13943
|
+
throw new TomlError("trying to redefine an already defined value", {
|
|
13944
|
+
toml: ctx.s,
|
|
13945
|
+
ptr: p
|
|
13946
|
+
});
|
|
13947
|
+
}
|
|
13948
|
+
if (!hasOwn && k === "__proto__") {
|
|
13949
|
+
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
13950
|
+
}
|
|
13951
|
+
}
|
|
13952
|
+
if (hasOwn) {
|
|
13953
|
+
throw new TomlError("trying to redefine an already defined value", {
|
|
13954
|
+
toml: ctx.s,
|
|
13955
|
+
ptr: ctx.p
|
|
13956
|
+
});
|
|
13957
|
+
}
|
|
13958
|
+
let value = extractValue(ctx, 125, integersAsBigInt);
|
|
13959
|
+
seen.add(t[k] = value);
|
|
13960
|
+
skipVoid(ctx);
|
|
13961
|
+
if ((c = ctx.s.charCodeAt(ctx.p++)) === 125) {
|
|
13962
|
+
return res;
|
|
13963
|
+
}
|
|
13964
|
+
if (c !== 44) {
|
|
13965
|
+
throw new TomlError("expected comma or end of structure", { toml: ctx.s, ptr: ctx.p - 1 });
|
|
13966
|
+
}
|
|
13967
|
+
}
|
|
13968
|
+
throw new TomlError("unfinished table encountered", {
|
|
13969
|
+
toml: ctx.s,
|
|
13970
|
+
ptr: ctx.p
|
|
13971
|
+
});
|
|
13972
|
+
}
|
|
13973
|
+
function parseArray(ctx, integersAsBigInt) {
|
|
13974
|
+
let res = [];
|
|
13975
|
+
let c;
|
|
13976
|
+
ctx.p++;
|
|
13977
|
+
while (ctx.p < ctx.s.length) {
|
|
13978
|
+
skipVoid(ctx);
|
|
13979
|
+
if ((c = ctx.s.charCodeAt(ctx.p)) === 93) {
|
|
13980
|
+
ctx.p++;
|
|
13981
|
+
return res;
|
|
13982
|
+
}
|
|
13983
|
+
res.push(extractValue(ctx, 93, integersAsBigInt));
|
|
13984
|
+
skipVoid(ctx);
|
|
13985
|
+
if ((c = ctx.s.charCodeAt(ctx.p++)) === 93) {
|
|
13986
|
+
return res;
|
|
13987
|
+
}
|
|
13988
|
+
if (c !== 44) {
|
|
13989
|
+
throw new TomlError("expected comma or end of structure", { toml: ctx.s, ptr: ctx.p - 1 });
|
|
13990
|
+
}
|
|
13991
|
+
}
|
|
13992
|
+
throw new TomlError("unfinished array encountered", {
|
|
13993
|
+
toml: ctx.s,
|
|
13994
|
+
ptr: ctx.p
|
|
13995
|
+
});
|
|
13996
|
+
}
|
|
13997
|
+
|
|
13998
|
+
// node_modules/smol-toml/dist/parse.js
|
|
13999
|
+
/*!
|
|
14000
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
14001
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
14002
|
+
*
|
|
14003
|
+
* Redistribution and use in source and binary forms, with or without
|
|
14004
|
+
* modification, are permitted provided that the following conditions are met:
|
|
14005
|
+
*
|
|
14006
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
14007
|
+
* list of conditions and the following disclaimer.
|
|
14008
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
14009
|
+
* this list of conditions and the following disclaimer in the
|
|
14010
|
+
* documentation and/or other materials provided with the distribution.
|
|
14011
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
14012
|
+
* may be used to endorse or promote products derived from this software without
|
|
14013
|
+
* specific prior written permission.
|
|
14014
|
+
*
|
|
14015
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
14016
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
14017
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
14018
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
14019
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
14020
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
14021
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
14022
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
14023
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
14024
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
14025
|
+
*/
|
|
14026
|
+
function peekTable(key, table, meta, type) {
|
|
14027
|
+
let t = table;
|
|
14028
|
+
let m = meta;
|
|
14029
|
+
let k;
|
|
14030
|
+
let hasOwn = false;
|
|
14031
|
+
let state;
|
|
14032
|
+
for (let i = 0;i < key.length; i++) {
|
|
14033
|
+
if (i) {
|
|
14034
|
+
t = hasOwn ? t[k] : t[k] = {};
|
|
14035
|
+
m = (state = m[k]).c;
|
|
14036
|
+
if (type === 0 && (state.t === 1 || state.t === 2)) {
|
|
14037
|
+
return null;
|
|
14038
|
+
}
|
|
14039
|
+
if (state.t === 2) {
|
|
14040
|
+
let l = t.length - 1;
|
|
14041
|
+
t = t[l];
|
|
14042
|
+
m = m[l].c;
|
|
14043
|
+
}
|
|
14044
|
+
}
|
|
14045
|
+
k = key[i];
|
|
14046
|
+
if ((hasOwn = Object.hasOwn(t, k)) && m[k]?.t === 0 && m[k]?.d) {
|
|
14047
|
+
return null;
|
|
14048
|
+
}
|
|
14049
|
+
if (!hasOwn) {
|
|
14050
|
+
if (k === "__proto__") {
|
|
14051
|
+
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
14052
|
+
Object.defineProperty(m, k, { enumerable: true, configurable: true, writable: true });
|
|
14053
|
+
}
|
|
14054
|
+
m[k] = {
|
|
14055
|
+
t: i < key.length - 1 && type === 2 ? 3 : type,
|
|
14056
|
+
d: false,
|
|
14057
|
+
i: 0,
|
|
14058
|
+
c: {}
|
|
14059
|
+
};
|
|
14060
|
+
}
|
|
14061
|
+
}
|
|
14062
|
+
state = m[k];
|
|
14063
|
+
if (state.t !== type && !(type === 1 && state.t === 3)) {
|
|
14064
|
+
return null;
|
|
14065
|
+
}
|
|
14066
|
+
if (type === 2) {
|
|
14067
|
+
if (!state.d) {
|
|
14068
|
+
state.d = true;
|
|
14069
|
+
t[k] = [];
|
|
14070
|
+
}
|
|
14071
|
+
t[k].push(t = {});
|
|
14072
|
+
state.c[state.i++] = state = { t: 1, d: false, i: 0, c: {} };
|
|
14073
|
+
}
|
|
14074
|
+
if (state.d) {
|
|
14075
|
+
return null;
|
|
14076
|
+
}
|
|
14077
|
+
state.d = true;
|
|
14078
|
+
if (type === 1) {
|
|
14079
|
+
t = hasOwn ? t[k] : t[k] = {};
|
|
14080
|
+
} else if (type === 0 && hasOwn) {
|
|
14081
|
+
return null;
|
|
14082
|
+
}
|
|
14083
|
+
return [k, t, state.c];
|
|
14084
|
+
}
|
|
14085
|
+
function parse(toml, { maxDepth = 1000, integersAsBigInt } = {}) {
|
|
14086
|
+
let ctx = { s: toml, p: 0, d: maxDepth };
|
|
14087
|
+
let res = {};
|
|
14088
|
+
let meta = {};
|
|
14089
|
+
let tmp;
|
|
14090
|
+
let tbl = res;
|
|
14091
|
+
let m = meta;
|
|
14092
|
+
skipVoid(ctx);
|
|
14093
|
+
while (ctx.p < toml.length) {
|
|
14094
|
+
if (toml.charCodeAt(ctx.p) === 91) {
|
|
14095
|
+
let isTableArray = toml.charCodeAt(++ctx.p) === 91;
|
|
14096
|
+
tmp = ctx.p += +isTableArray;
|
|
14097
|
+
let k = parseKey(ctx, "]");
|
|
14098
|
+
if (isTableArray) {
|
|
14099
|
+
if (toml.charCodeAt(ctx.p - 1) !== 93) {
|
|
14100
|
+
throw new TomlError("expected end of table declaration", {
|
|
14101
|
+
toml,
|
|
14102
|
+
ptr: ctx.p - 1
|
|
14103
|
+
});
|
|
14104
|
+
}
|
|
14105
|
+
ctx.p++;
|
|
14106
|
+
}
|
|
14107
|
+
let p = peekTable(k, res, meta, isTableArray ? 2 : 1);
|
|
14108
|
+
if (!p) {
|
|
14109
|
+
throw new TomlError("trying to redefine an already defined table or value", {
|
|
14110
|
+
toml,
|
|
14111
|
+
ptr: tmp
|
|
14112
|
+
});
|
|
14113
|
+
}
|
|
14114
|
+
m = p[2];
|
|
14115
|
+
tbl = p[1];
|
|
14116
|
+
} else {
|
|
14117
|
+
tmp = ctx.p;
|
|
14118
|
+
let k = parseKey(ctx);
|
|
14119
|
+
let p = peekTable(k, tbl, m, 0);
|
|
14120
|
+
if (!p) {
|
|
14121
|
+
throw new TomlError("trying to redefine an already defined table or value", {
|
|
14122
|
+
toml,
|
|
14123
|
+
ptr: tmp
|
|
14124
|
+
});
|
|
14125
|
+
}
|
|
14126
|
+
p[1][p[0]] = extractValue(ctx, undefined, integersAsBigInt);
|
|
14127
|
+
}
|
|
14128
|
+
skipVoid(ctx, true);
|
|
14129
|
+
if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && tmp !== 13) {
|
|
14130
|
+
throw new TomlError("each key-value declaration must be followed by an end-of-line", {
|
|
14131
|
+
toml,
|
|
14132
|
+
ptr: ctx.p
|
|
14133
|
+
});
|
|
14134
|
+
}
|
|
14135
|
+
skipVoid(ctx);
|
|
14136
|
+
}
|
|
14137
|
+
return res;
|
|
14138
|
+
}
|
|
14139
|
+
|
|
14140
|
+
// node_modules/smol-toml/dist/stringify.js
|
|
14141
|
+
/*!
|
|
14142
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
14143
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
14144
|
+
*
|
|
14145
|
+
* Redistribution and use in source and binary forms, with or without
|
|
14146
|
+
* modification, are permitted provided that the following conditions are met:
|
|
14147
|
+
*
|
|
14148
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
14149
|
+
* list of conditions and the following disclaimer.
|
|
14150
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
14151
|
+
* this list of conditions and the following disclaimer in the
|
|
14152
|
+
* documentation and/or other materials provided with the distribution.
|
|
14153
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
14154
|
+
* may be used to endorse or promote products derived from this software without
|
|
14155
|
+
* specific prior written permission.
|
|
14156
|
+
*
|
|
14157
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
14158
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
14159
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
14160
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
14161
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
14162
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
14163
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
14164
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
14165
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
14166
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
14167
|
+
*/
|
|
14168
|
+
|
|
14169
|
+
// node_modules/smol-toml/dist/index.js
|
|
14170
|
+
/*!
|
|
14171
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
14172
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
14173
|
+
*
|
|
14174
|
+
* Redistribution and use in source and binary forms, with or without
|
|
14175
|
+
* modification, are permitted provided that the following conditions are met:
|
|
14176
|
+
*
|
|
14177
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
14178
|
+
* list of conditions and the following disclaimer.
|
|
14179
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
14180
|
+
* this list of conditions and the following disclaimer in the
|
|
14181
|
+
* documentation and/or other materials provided with the distribution.
|
|
14182
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
14183
|
+
* may be used to endorse or promote products derived from this software without
|
|
14184
|
+
* specific prior written permission.
|
|
14185
|
+
*
|
|
14186
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
14187
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
14188
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
14189
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
14190
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
14191
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
14192
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
14193
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
14194
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
14195
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
14196
|
+
*/
|
|
14197
|
+
|
|
13317
14198
|
// node_modules/yaml/dist/index.js
|
|
13318
14199
|
var composer = require_composer();
|
|
13319
14200
|
var Document = require_Document();
|
|
@@ -13383,6 +14264,8 @@ var SCHEMA_CANDIDATES = [
|
|
|
13383
14264
|
join2(dirname(fileURLToPath(import.meta.url)), "../schemas/config.schema.json"),
|
|
13384
14265
|
join2(dirname(fileURLToPath(import.meta.url)), "../../schemas/config.schema.json")
|
|
13385
14266
|
];
|
|
14267
|
+
var ROOT_CONFIG_TOML = "skeleton.toml";
|
|
14268
|
+
var LEGACY_CONFIG_YAML = join2(".skeleton", "config.yaml");
|
|
13386
14269
|
function resolveSchemaPath() {
|
|
13387
14270
|
for (const candidate of SCHEMA_CANDIDATES) {
|
|
13388
14271
|
if (existsSync2(candidate))
|
|
@@ -13397,99 +14280,75 @@ var COVERAGE_BUILTIN_EXCLUDES = [
|
|
|
13397
14280
|
"**/fixtures/**",
|
|
13398
14281
|
"templates/**"
|
|
13399
14282
|
];
|
|
14283
|
+
function hasConfigMarker(dir) {
|
|
14284
|
+
return existsSync2(join2(dir, ROOT_CONFIG_TOML)) || existsSync2(join2(dir, LEGACY_CONFIG_YAML));
|
|
14285
|
+
}
|
|
13400
14286
|
function findRepoRoot(startDir = process.cwd()) {
|
|
13401
14287
|
let dir = startDir;
|
|
13402
14288
|
while (true) {
|
|
13403
|
-
if (
|
|
14289
|
+
if (hasConfigMarker(dir))
|
|
13404
14290
|
return dir;
|
|
13405
14291
|
const parent = dirname(dir);
|
|
13406
14292
|
if (parent === dir) {
|
|
13407
|
-
throw new Error(
|
|
14293
|
+
throw new Error(`No ${ROOT_CONFIG_TOML} or ${LEGACY_CONFIG_YAML} found — run skeleton init or create config manually`);
|
|
13408
14294
|
}
|
|
13409
14295
|
dir = parent;
|
|
13410
14296
|
}
|
|
13411
14297
|
}
|
|
13412
|
-
function validateConfig(raw) {
|
|
14298
|
+
function validateConfig(raw, sourceLabel) {
|
|
13413
14299
|
const schema = JSON.parse(readFileSync(resolveSchemaPath(), "utf8"));
|
|
13414
14300
|
const ajv = new import_ajv.default({ allErrors: true, strict: false });
|
|
13415
14301
|
const validate = ajv.compile(schema);
|
|
13416
14302
|
if (!validate(raw)) {
|
|
13417
14303
|
const detail = validate.errors?.map((e) => `${e.instancePath || "/"} ${e.message}`).join("; ");
|
|
13418
|
-
throw new Error(`Invalid
|
|
14304
|
+
throw new Error(`Invalid ${sourceLabel}: ${detail ?? "schema validation failed"}`);
|
|
13419
14305
|
}
|
|
13420
14306
|
const config = raw;
|
|
13421
14307
|
validateDraftPathPrefixes(config.draftPathPrefixes);
|
|
13422
14308
|
return config;
|
|
13423
14309
|
}
|
|
13424
|
-
function
|
|
13425
|
-
const
|
|
13426
|
-
|
|
13427
|
-
|
|
13428
|
-
|
|
13429
|
-
|
|
13430
|
-
|
|
13431
|
-
}
|
|
13432
|
-
|
|
13433
|
-
|
|
13434
|
-
|
|
13435
|
-
|
|
13436
|
-
|
|
13437
|
-
|
|
13438
|
-
|
|
13439
|
-
|
|
13440
|
-
|
|
13441
|
-
|
|
13442
|
-
}
|
|
13443
|
-
const content = readFileSync2(abs, "utf8");
|
|
13444
|
-
const hasTableHeader = REGISTRY_TABLE_HEADER_RE.test(content);
|
|
13445
|
-
const paths = [];
|
|
13446
|
-
for (const line of content.split(`
|
|
13447
|
-
`)) {
|
|
13448
|
-
const match = REGISTRY_TABLE_ROW_RE.exec(line);
|
|
13449
|
-
if (!match?.[1])
|
|
13450
|
-
continue;
|
|
13451
|
-
const linkTarget = match[1].trim();
|
|
13452
|
-
if (linkTarget.startsWith("#"))
|
|
13453
|
-
continue;
|
|
13454
|
-
const resolved = resolve(join3(root, REGISTRY_DIR_REL), linkTarget);
|
|
13455
|
-
paths.push(normalizeRelPath(relative2(root, resolved)));
|
|
14310
|
+
function loadConfigDetailed(root) {
|
|
14311
|
+
const tomlPath = join2(root, ROOT_CONFIG_TOML);
|
|
14312
|
+
const yamlPath = join2(root, LEGACY_CONFIG_YAML);
|
|
14313
|
+
const hasToml = existsSync2(tomlPath);
|
|
14314
|
+
const hasYaml = existsSync2(yamlPath);
|
|
14315
|
+
if (!(hasToml || hasYaml)) {
|
|
14316
|
+
throw new Error(`Missing ${ROOT_CONFIG_TOML} (or legacy ${LEGACY_CONFIG_YAML})`);
|
|
14317
|
+
}
|
|
14318
|
+
if (hasToml && hasYaml) {
|
|
14319
|
+
console.error(`warning: both ${ROOT_CONFIG_TOML} and ${LEGACY_CONFIG_YAML} exist — using ${ROOT_CONFIG_TOML}; legacy YAML is ignored`);
|
|
14320
|
+
}
|
|
14321
|
+
if (hasToml) {
|
|
14322
|
+
const raw2 = parse(readFileSync(tomlPath, "utf8"));
|
|
14323
|
+
return {
|
|
14324
|
+
config: validateConfig(raw2, ROOT_CONFIG_TOML),
|
|
14325
|
+
source: "toml",
|
|
14326
|
+
warnedDual: hasToml && hasYaml
|
|
14327
|
+
};
|
|
13456
14328
|
}
|
|
13457
|
-
|
|
14329
|
+
const raw = $parse(readFileSync(yamlPath, "utf8"));
|
|
14330
|
+
return {
|
|
14331
|
+
config: validateConfig(raw, LEGACY_CONFIG_YAML),
|
|
14332
|
+
source: "yaml"
|
|
14333
|
+
};
|
|
13458
14334
|
}
|
|
13459
|
-
function
|
|
13460
|
-
return
|
|
14335
|
+
function loadConfig(root) {
|
|
14336
|
+
return loadConfigDetailed(root).config;
|
|
13461
14337
|
}
|
|
13462
14338
|
|
|
13463
14339
|
// src/customize/resolve.ts
|
|
13464
14340
|
function customizeDir(root) {
|
|
13465
|
-
return
|
|
14341
|
+
return join3(root, REGISTRY_DIR_REL, "customize");
|
|
13466
14342
|
}
|
|
13467
14343
|
function customizePathForSlug(root, slug) {
|
|
13468
|
-
return
|
|
13469
|
-
}
|
|
13470
|
-
function findCustomizeViaRegistry(root, slug) {
|
|
13471
|
-
for (const rel of parseRegistryPaths(root)) {
|
|
13472
|
-
const expected = `${REGISTRY_DIR_REL}/customize/${slug}.md`;
|
|
13473
|
-
if (normalizeRelPath(rel) === expected && existsSync4(join4(root, rel))) {
|
|
13474
|
-
return rel;
|
|
13475
|
-
}
|
|
13476
|
-
}
|
|
13477
|
-
return null;
|
|
14344
|
+
return join3(customizeDir(root), `${slug}.md`);
|
|
13478
14345
|
}
|
|
13479
14346
|
function resolveSlugFile(root, slug) {
|
|
13480
14347
|
const direct = customizePathForSlug(root, slug);
|
|
13481
|
-
if (
|
|
13482
|
-
return {
|
|
13483
|
-
content: readFileSync3(direct, "utf8"),
|
|
13484
|
-
path: normalizeRelPath(relative3(root, direct))
|
|
13485
|
-
};
|
|
13486
|
-
}
|
|
13487
|
-
const registryPath = findCustomizeViaRegistry(root, slug);
|
|
13488
|
-
if (registryPath) {
|
|
13489
|
-
const abs = join4(root, registryPath);
|
|
14348
|
+
if (existsSync3(direct)) {
|
|
13490
14349
|
return {
|
|
13491
|
-
content:
|
|
13492
|
-
path:
|
|
14350
|
+
content: readFileSync2(direct, "utf8"),
|
|
14351
|
+
path: normalizeRelPath(relative2(root, direct))
|
|
13493
14352
|
};
|
|
13494
14353
|
}
|
|
13495
14354
|
return { content: null, path: null };
|
|
@@ -13510,22 +14369,22 @@ function readAlwaysInclude(root, basenames, skipBasename) {
|
|
|
13510
14369
|
const file = basename(name);
|
|
13511
14370
|
if (skipBasename && file === skipBasename)
|
|
13512
14371
|
continue;
|
|
13513
|
-
const abs =
|
|
13514
|
-
if (!
|
|
14372
|
+
const abs = join3(dir, file);
|
|
14373
|
+
if (!existsSync3(abs))
|
|
13515
14374
|
continue;
|
|
13516
|
-
parts.push(
|
|
13517
|
-
paths.push(normalizeRelPath(
|
|
14375
|
+
parts.push(readFileSync2(abs, "utf8").trimEnd());
|
|
14376
|
+
paths.push(normalizeRelPath(relative2(root, abs)));
|
|
13518
14377
|
}
|
|
13519
14378
|
return { parts, paths };
|
|
13520
14379
|
}
|
|
13521
14380
|
function resolveCustomize(root, slug) {
|
|
13522
14381
|
const slugFile = resolveSlugFile(root, slug);
|
|
13523
14382
|
const alwaysNames = alwaysIncludeBasenames(root);
|
|
13524
|
-
const skip = slugFile.path
|
|
14383
|
+
const skip = slugFile.path !== null && slugFile.path !== undefined ? basename(slugFile.path) : null;
|
|
13525
14384
|
const always = readAlwaysInclude(root, alwaysNames, skip);
|
|
13526
14385
|
const parts = [];
|
|
13527
14386
|
const included = [];
|
|
13528
|
-
if (slugFile.content
|
|
14387
|
+
if (slugFile.content !== null && slugFile.content !== undefined && slugFile.content.trim().length > 0) {
|
|
13529
14388
|
parts.push(slugFile.content.trimEnd());
|
|
13530
14389
|
if (slugFile.path)
|
|
13531
14390
|
included.push(slugFile.path);
|
|
@@ -13583,7 +14442,7 @@ function extractSkillSlug(payload) {
|
|
|
13583
14442
|
}
|
|
13584
14443
|
const path = extractPath(payload);
|
|
13585
14444
|
if (path)
|
|
13586
|
-
return slugFromPath(path,
|
|
14445
|
+
return slugFromPath(path, process2.cwd());
|
|
13587
14446
|
return null;
|
|
13588
14447
|
}
|
|
13589
14448
|
function cursorResponse(content) {
|
|
@@ -13635,4 +14494,4 @@ Customize override for /${slug} (from ${from}):
|
|
|
13635
14494
|
}
|
|
13636
14495
|
|
|
13637
14496
|
// src/hooks/customize-on-skill-read.ts
|
|
13638
|
-
|
|
14497
|
+
process3.stdout.write(runCustomizeHook(readFileSync3(0, "utf8")));
|