vite-plus 0.2.7 → 0.2.9
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/AGENTS.md +7 -0
- package/LICENSE +5 -1
- package/README.md +9 -3
- package/bin/vpr +3 -2
- package/binding/index.cjs +193 -80
- package/binding/index.d.cts +106 -11
- package/dist/agent-DQU8uS6P.js +416 -0
- package/dist/bin.js +1388 -23
- package/dist/{cli-truncate-BVOlIIPy.js → cli-truncate-Bg3RDXpi.js} +0 -2
- package/dist/client/bundledDevClient.mjs +1 -0
- package/dist/config/bin.js +32 -133
- package/dist/{constants-BsuzPowC.js → constants-CG513DRa.js} +10 -2
- package/dist/create/bin.js +255 -268
- package/dist/{define-config-C2KfLHpC.js → define-config-CV4bQG_8.js} +3 -3
- package/dist/{define-config-eLQH9us2.d.ts → define-config-DWoAkNdp.d.ts} +16 -0
- package/dist/{define-config-DLh9fE95.cjs → define-config-DyNLA_f0.cjs} +1 -1
- package/dist/define-config.cjs +1 -1
- package/dist/define-config.d.ts +1 -1
- package/dist/define-config.js +1 -1
- package/dist/{dist-CKz3vcoG.js → dist-BDYZP12R.js} +196 -157
- package/dist/dist-Dqv1-Clg.js +3 -0
- package/dist/{agent-CPwWJ4qf.js → editor-g4PosU99.js} +819 -628
- package/dist/hooks/bin.d.ts +1 -0
- package/dist/hooks/bin.js +130 -0
- package/dist/hooks-pNCBWtFT.js +570 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{json-DiRs8ceZ.js → json-qlK6UH0r.js} +40 -38
- package/dist/migration/bin.js +65 -58
- package/dist/{oxlint-plugin-config-Bxgc4cwF.js → oxlint-plugin-config-BEZ9IUf7.js} +1 -1
- package/dist/oxlint-plugin.js +1 -1
- package/dist/pack-bin.js +1 -1
- package/dist/{package-Ds3uThLb.js → package-B4T8RGMG.js} +2 -2
- package/dist/{tsconfig-Jia2vgMG.js → prompts-CHz_98bJ.js} +169 -219
- package/dist/{resolve-vite-config-BiuLZnn8.js → resolve-vite-config-Dmeyeyj-.js} +2 -9
- package/dist/{rolldown-runtime-C7HZzL1F.js → rolldown-runtime-CMFfr-1z.js} +1 -1
- package/dist/staged/bin.js +241 -226
- package/dist/terminal-Bz-ps6rJ.js +128 -0
- package/dist/test/browser/providers/playwright/context.d.ts +1 -1
- package/dist/test/browser/providers/playwright.d.ts +6 -6
- package/dist/test/browser/providers/preview/context.d.ts +1 -1
- package/dist/test/browser/providers/preview.d.ts +4 -4
- package/dist/test/browser/providers/webdriverio/context.d.ts +1 -1
- package/dist/test/browser/providers/webdriverio.d.ts +6 -6
- package/dist/test/browser-playwright/context.d.ts +1 -1
- package/dist/test/browser-playwright.d.ts +6 -6
- package/dist/test/browser-preview/context.d.ts +1 -1
- package/dist/test/browser-preview.d.ts +4 -4
- package/dist/test/browser-webdriverio/context.d.ts +1 -1
- package/dist/test/browser-webdriverio.d.ts +6 -6
- package/dist/test/context.d.ts +3 -3
- package/dist/test/locators.d.ts +1 -1
- package/dist/toolchain.d.ts +25 -0
- package/dist/toolchain.js +194 -0
- package/dist/toolchain.json +193 -0
- package/dist/tsconfig-7v_BHagU.js +151 -0
- package/dist/{tsgolint-path-B-yOos8p.js → tsgolint-path-CbDReEOx.js} +5 -3
- package/dist/tsgolint-path.js +1 -1
- package/dist/version.js +6 -6
- package/dist/versions.d.ts +3 -3
- package/dist/versions.js +6 -6
- package/docs/config/index.md +13 -0
- package/docs/config/staged.md +2 -1
- package/docs/guide/ci.md +37 -4
- package/docs/guide/commit-hooks.md +112 -21
- package/docs/guide/create.md +7 -4
- package/docs/guide/env.md +8 -4
- package/docs/guide/fmt.md +2 -2
- package/docs/guide/github-actions-cache.md +5 -1
- package/docs/guide/ide-integration.md +61 -2
- package/docs/guide/index.md +4 -2
- package/docs/guide/install.md +27 -0
- package/docs/guide/installer-env-vars.md +14 -3
- package/docs/guide/lint.md +3 -1
- package/docs/guide/migrate.md +49 -4
- package/docs/guide/monorepo.md +98 -10
- package/docs/guide/troubleshooting.md +12 -3
- package/docs/guide/upgrade.md +27 -4
- package/docs/package.json +1 -1
- package/docs/pnpm-workspace.yaml +7 -0
- package/docs/vite.config.ts +3 -0
- package/package.json +21 -23
- package/rules/vite-tools.yml +0 -7
- package/dist/dist-CtM2JRbM.js +0 -3
- package/dist/editor-BbT1lTNc.js +0 -675
- package/dist/help-YP84FSEz.js +0 -61
- package/dist/terminal-uTv0ZaMr.js +0 -33
- package/dist/{log-update-DHZRyJ2m.js → log-update-CoW8Z4Dl.js} +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { o as VITEST_VERSION, r as CONFIG_METADATA_ENV } from "./constants-
|
|
1
|
+
import { o as VITEST_VERSION, r as CONFIG_METADATA_ENV } from "./constants-CG513DRa.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { readFileSync } from "node:fs";
|
|
5
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { readFileSync } from "node:fs";
|
|
6
6
|
import { defineConfig, defineProject } from "vitest/config";
|
|
7
|
-
//#region ../../node_modules/.pnpm/tsdown@0.22.14_@arethetypeswrong+core@0.18.2_@tsdown+css@0.22.14_@tsdown+exe@0.22.14_@
|
|
7
|
+
//#region ../../node_modules/.pnpm/tsdown@0.22.14_@arethetypeswrong+core@0.18.2_@tsdown+css@0.22.14_@tsdown+exe@0.22.14_@t_8361ec2a4d03114085b1954a2fc42e35/node_modules/tsdown/esm-shims.js
|
|
8
8
|
const getFilename = () => fileURLToPath(import.meta.url);
|
|
9
9
|
const getDirname = () => path.dirname(getFilename());
|
|
10
10
|
const __dirname = /* @__PURE__ */ getDirname();
|
|
@@ -195,6 +195,22 @@ declare module '@voidzero-dev/vite-plus-core' {
|
|
|
195
195
|
lint?: boolean;
|
|
196
196
|
};
|
|
197
197
|
pack?: PackUserConfig | PackUserConfig[];
|
|
198
|
+
/**
|
|
199
|
+
* Default target directory for `vp dev` / `build` / `preview` / `pack`
|
|
200
|
+
* when invoked bare in the directory containing this config (an implicit
|
|
201
|
+
* `vp -C <dir>`). A string targets all four commands; an object maps
|
|
202
|
+
* commands individually, and a command absent from the object falls
|
|
203
|
+
* through to the normal picker/listing resolution. Paths are relative to
|
|
204
|
+
* the config file's directory. vp reads them without executing the
|
|
205
|
+
* config, so this also works at roots with no vite-plus dependency; the
|
|
206
|
+
* static read is why the values must stay plain string literals.
|
|
207
|
+
*/
|
|
208
|
+
defaultPackage?: string | {
|
|
209
|
+
dev?: string;
|
|
210
|
+
build?: string;
|
|
211
|
+
preview?: string;
|
|
212
|
+
pack?: string;
|
|
213
|
+
};
|
|
198
214
|
run?: RunConfig;
|
|
199
215
|
staged?: StagedConfig;
|
|
200
216
|
/**
|
|
@@ -37,7 +37,7 @@ let node_module = require("node:module");
|
|
|
37
37
|
let node_url = require("node:url");
|
|
38
38
|
let vitest_config = require("vitest/config");
|
|
39
39
|
//#region package.json
|
|
40
|
-
var version = "0.2.
|
|
40
|
+
var version = "0.2.9", VITE_PLUS_VERSION, VITEST_VERSION, CONFIG_METADATA_ENV;
|
|
41
41
|
var init_constants = __esmMin((() => {
|
|
42
42
|
VITE_PLUS_VERSION = process.env.VP_VERSION || version;
|
|
43
43
|
VITEST_VERSION = "4.1.10";
|
package/dist/define-config.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_define_config = require("./define-config-
|
|
2
|
+
const require_define_config = require("./define-config-DyNLA_f0.cjs");
|
|
3
3
|
require_define_config.init_define_config();
|
|
4
4
|
exports.AUTO_INLINE_DEPS = require_define_config.AUTO_INLINE_DEPS;
|
|
5
5
|
exports.assertCoverageProviderVersionMatch = require_define_config.assertCoverageProviderVersionMatch;
|
package/dist/define-config.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as defineConfig, c as lazyPlugins, i as computeAutoInlineList, l as resolveCoverageProviderToCheck, n as assertCoverageProviderVersionMatch, o as defineProject, r as checkCoverageProviderVersion, s as isVitestFamilySpecifier, t as AUTO_INLINE_DEPS, u as withConfigMetadataResolution } from "./define-config-
|
|
1
|
+
import { a as defineConfig, c as lazyPlugins, i as computeAutoInlineList, l as resolveCoverageProviderToCheck, n as assertCoverageProviderVersionMatch, o as defineProject, r as checkCoverageProviderVersion, s as isVitestFamilySpecifier, t as AUTO_INLINE_DEPS, u as withConfigMetadataResolution } from "./define-config-DWoAkNdp.js";
|
|
2
2
|
export { AUTO_INLINE_DEPS, assertCoverageProviderVersionMatch, checkCoverageProviderVersion, computeAutoInlineList, defineConfig, defineProject, isVitestFamilySpecifier, lazyPlugins, resolveCoverageProviderToCheck, withConfigMetadataResolution };
|
package/dist/define-config.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as defineConfig, c as lazyPlugins, i as computeAutoInlineList, l as resolveCoverageProviderToCheck, n as assertCoverageProviderVersionMatch, o as defineProject, r as checkCoverageProviderVersion, s as isVitestFamilySpecifier, t as AUTO_INLINE_DEPS, u as withConfigMetadataResolution } from "./define-config-
|
|
1
|
+
import { a as defineConfig, c as lazyPlugins, i as computeAutoInlineList, l as resolveCoverageProviderToCheck, n as assertCoverageProviderVersionMatch, o as defineProject, r as checkCoverageProviderVersion, s as isVitestFamilySpecifier, t as AUTO_INLINE_DEPS, u as withConfigMetadataResolution } from "./define-config-CV4bQG_8.js";
|
|
2
2
|
export { AUTO_INLINE_DEPS, assertCoverageProviderVersionMatch, checkCoverageProviderVersion, computeAutoInlineList, defineConfig, defineProject, isVitestFamilySpecifier, lazyPlugins, resolveCoverageProviderToCheck, withConfigMetadataResolution };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as __require, t as __commonJSMin } from "./rolldown-runtime-
|
|
1
|
+
import { n as __require, t as __commonJSMin } from "./rolldown-runtime-CMFfr-1z.js";
|
|
2
2
|
//#region ../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/nodes/identity.js
|
|
3
3
|
var require_identity = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4
4
|
const ALIAS = Symbol.for("yaml.alias");
|
|
@@ -227,9 +227,10 @@ var require_visit = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
227
227
|
function replaceNode(key, path, node) {
|
|
228
228
|
const parent = path[path.length - 1];
|
|
229
229
|
if (identity.isCollection(parent)) parent.items[key] = node;
|
|
230
|
-
else if (identity.isPair(parent))
|
|
231
|
-
|
|
232
|
-
|
|
230
|
+
else if (identity.isPair(parent)) {
|
|
231
|
+
if (key === "key") parent.key = node;
|
|
232
|
+
else parent.value = node;
|
|
233
|
+
} else if (identity.isDocument(parent)) parent.contents = node;
|
|
233
234
|
else {
|
|
234
235
|
const pt = identity.isAlias(parent) ? "alias" : "scalar";
|
|
235
236
|
throw new Error(`Cannot replace node with ${pt} parent`);
|
|
@@ -286,7 +287,6 @@ var require_directives = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
286
287
|
version: "1.2"
|
|
287
288
|
};
|
|
288
289
|
this.tags = Object.assign({}, Directives.defaultTags);
|
|
289
|
-
break;
|
|
290
290
|
}
|
|
291
291
|
return res;
|
|
292
292
|
}
|
|
@@ -481,30 +481,32 @@ var require_applyReviver = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
481
481
|
* Includes extensions for handling Map and Set objects.
|
|
482
482
|
*/
|
|
483
483
|
function applyReviver(reviver, obj, key, val) {
|
|
484
|
-
if (val && typeof val === "object")
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
const
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
484
|
+
if (val && typeof val === "object") {
|
|
485
|
+
if (Array.isArray(val)) for (let i = 0, len = val.length; i < len; ++i) {
|
|
486
|
+
const v0 = val[i];
|
|
487
|
+
const v1 = applyReviver(reviver, val, String(i), v0);
|
|
488
|
+
if (v1 === void 0) delete val[i];
|
|
489
|
+
else if (v1 !== v0) val[i] = v1;
|
|
490
|
+
}
|
|
491
|
+
else if (val instanceof Map) for (const k of Array.from(val.keys())) {
|
|
492
|
+
const v0 = val.get(k);
|
|
493
|
+
const v1 = applyReviver(reviver, val, k, v0);
|
|
494
|
+
if (v1 === void 0) val.delete(k);
|
|
495
|
+
else if (v1 !== v0) val.set(k, v1);
|
|
496
|
+
}
|
|
497
|
+
else if (val instanceof Set) for (const v0 of Array.from(val)) {
|
|
498
|
+
const v1 = applyReviver(reviver, val, v0, v0);
|
|
499
|
+
if (v1 === void 0) val.delete(v0);
|
|
500
|
+
else if (v1 !== v0) {
|
|
501
|
+
val.delete(v0);
|
|
502
|
+
val.add(v1);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
else for (const [k, v0] of Object.entries(val)) {
|
|
506
|
+
const v1 = applyReviver(reviver, val, k, v0);
|
|
507
|
+
if (v1 === void 0) delete val[k];
|
|
508
|
+
else if (v1 !== v0) val[k] = v1;
|
|
509
|
+
}
|
|
508
510
|
}
|
|
509
511
|
return reviver.call(obj, key, val);
|
|
510
512
|
}
|
|
@@ -925,8 +927,10 @@ var require_foldFlowLines = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
925
927
|
const folds = [];
|
|
926
928
|
const escapedFolds = {};
|
|
927
929
|
let end = lineWidth - indent.length;
|
|
928
|
-
if (typeof indentAtStart === "number")
|
|
929
|
-
|
|
930
|
+
if (typeof indentAtStart === "number") {
|
|
931
|
+
if (indentAtStart > lineWidth - Math.max(2, minContentWidth)) folds.push(0);
|
|
932
|
+
else end = lineWidth - indentAtStart;
|
|
933
|
+
}
|
|
930
934
|
let split = void 0;
|
|
931
935
|
let prev = void 0;
|
|
932
936
|
let overflow = false;
|
|
@@ -963,23 +967,25 @@ var require_foldFlowLines = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
963
967
|
const next = text[i + 1];
|
|
964
968
|
if (next && next !== " " && next !== "\n" && next !== " ") split = i;
|
|
965
969
|
}
|
|
966
|
-
if (i >= end)
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
prev
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
970
|
+
if (i >= end) {
|
|
971
|
+
if (split) {
|
|
972
|
+
folds.push(split);
|
|
973
|
+
end = split + endStep;
|
|
974
|
+
split = void 0;
|
|
975
|
+
} else if (mode === FOLD_QUOTED) {
|
|
976
|
+
while (prev === " " || prev === " ") {
|
|
977
|
+
prev = ch;
|
|
978
|
+
ch = text[i += 1];
|
|
979
|
+
overflow = true;
|
|
980
|
+
}
|
|
981
|
+
const j = i > escEnd + 1 ? i - 2 : escStart - 1;
|
|
982
|
+
if (escapedFolds[j]) return text;
|
|
983
|
+
folds.push(j);
|
|
984
|
+
escapedFolds[j] = true;
|
|
985
|
+
end = j + endStep;
|
|
986
|
+
split = void 0;
|
|
987
|
+
} else overflow = true;
|
|
988
|
+
}
|
|
983
989
|
}
|
|
984
990
|
prev = ch;
|
|
985
991
|
}
|
|
@@ -1459,8 +1465,10 @@ var require_log = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1459
1465
|
if (logLevel === "debug") console.log(...messages);
|
|
1460
1466
|
}
|
|
1461
1467
|
function warn(logLevel, warning) {
|
|
1462
|
-
if (logLevel === "debug" || logLevel === "warn")
|
|
1463
|
-
|
|
1468
|
+
if (logLevel === "debug" || logLevel === "warn") {
|
|
1469
|
+
if (typeof node_process$2.emitWarning === "function") node_process$2.emitWarning(warning);
|
|
1470
|
+
else console.warn(warning);
|
|
1471
|
+
}
|
|
1464
1472
|
}
|
|
1465
1473
|
exports.debug = debug;
|
|
1466
1474
|
exports.warn = warn;
|
|
@@ -2287,11 +2295,12 @@ var require_pairs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2287
2295
|
if (iterable && Symbol.iterator in Object(iterable)) for (let it of iterable) {
|
|
2288
2296
|
if (typeof replacer === "function") it = replacer.call(iterable, String(i++), it);
|
|
2289
2297
|
let key, value;
|
|
2290
|
-
if (Array.isArray(it))
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2298
|
+
if (Array.isArray(it)) {
|
|
2299
|
+
if (it.length === 2) {
|
|
2300
|
+
key = it[0];
|
|
2301
|
+
value = it[1];
|
|
2302
|
+
} else throw new TypeError(`Expected [key, value] tuple: ${it}`);
|
|
2303
|
+
} else if (it && it instanceof Object) {
|
|
2295
2304
|
const keys = Object.keys(it);
|
|
2296
2305
|
if (keys.length === 1) {
|
|
2297
2306
|
key = keys[0];
|
|
@@ -2367,8 +2376,10 @@ var require_omap = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2367
2376
|
resolve(seq, onError) {
|
|
2368
2377
|
const pairs$1 = pairs.resolvePairs(seq, onError);
|
|
2369
2378
|
const seenKeys = [];
|
|
2370
|
-
for (const { key } of pairs$1.items) if (identity.isScalar(key))
|
|
2371
|
-
|
|
2379
|
+
for (const { key } of pairs$1.items) if (identity.isScalar(key)) {
|
|
2380
|
+
if (seenKeys.includes(key.value)) onError(`Ordered maps must not include duplicate keys: ${key.value}`);
|
|
2381
|
+
else seenKeys.push(key.value);
|
|
2382
|
+
}
|
|
2372
2383
|
return Object.assign(new YAMLOMap(), pairs$1);
|
|
2373
2384
|
},
|
|
2374
2385
|
createNode: (schema, iterable, ctx) => YAMLOMap.from(schema, iterable, ctx)
|
|
@@ -2464,9 +2475,7 @@ var require_int = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2464
2475
|
case 8:
|
|
2465
2476
|
str = `0o${str}`;
|
|
2466
2477
|
break;
|
|
2467
|
-
case 16:
|
|
2468
|
-
str = `0x${str}`;
|
|
2469
|
-
break;
|
|
2478
|
+
case 16: str = `0x${str}`;
|
|
2470
2479
|
}
|
|
2471
2480
|
const n = BigInt(str);
|
|
2472
2481
|
return sign === "-" ? BigInt(-1) * n : n;
|
|
@@ -2581,9 +2590,10 @@ var require_set = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2581
2590
|
tag: "tag:yaml.org,2002:set",
|
|
2582
2591
|
createNode: (schema, iterable, ctx) => YAMLSet.from(schema, iterable, ctx),
|
|
2583
2592
|
resolve(map, onError) {
|
|
2584
|
-
if (identity.isMap(map))
|
|
2585
|
-
|
|
2586
|
-
|
|
2593
|
+
if (identity.isMap(map)) {
|
|
2594
|
+
if (map.hasAllNullValues(true)) return Object.assign(new YAMLSet(), map);
|
|
2595
|
+
else onError("Set items must all have null values");
|
|
2596
|
+
} else onError("Expected a mapping for this tag");
|
|
2587
2597
|
return map;
|
|
2588
2598
|
}
|
|
2589
2599
|
};
|
|
@@ -2775,10 +2785,12 @@ var require_tags = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2775
2785
|
const schemaTags = schemas.get(schemaName);
|
|
2776
2786
|
if (schemaTags && !customTags) return addMergeTag && !schemaTags.includes(merge.merge) ? schemaTags.concat(merge.merge) : schemaTags.slice();
|
|
2777
2787
|
let tags = schemaTags;
|
|
2778
|
-
if (!tags)
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2788
|
+
if (!tags) {
|
|
2789
|
+
if (Array.isArray(customTags)) tags = [];
|
|
2790
|
+
else {
|
|
2791
|
+
const keys = Array.from(schemas.keys()).filter((key) => key !== "yaml11").map((key) => JSON.stringify(key)).join(", ");
|
|
2792
|
+
throw new Error(`Unknown schema "${schemaName}"; use one of ${keys} or define customTags array`);
|
|
2793
|
+
}
|
|
2782
2794
|
}
|
|
2783
2795
|
if (Array.isArray(customTags)) for (const tag of customTags) tags = tags.concat(tag);
|
|
2784
2796
|
else if (typeof customTags === "function") tags = customTags(tags.slice());
|
|
@@ -2867,14 +2879,15 @@ var require_stringifyDocument = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2867
2879
|
if ((body[0] === "|" || body[0] === ">") && lines[lines.length - 1] === "---") lines[lines.length - 1] = `--- ${body}`;
|
|
2868
2880
|
else lines.push(body);
|
|
2869
2881
|
} else lines.push(stringify.stringify(doc.contents, ctx));
|
|
2870
|
-
if (doc.directives?.docEnd)
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2882
|
+
if (doc.directives?.docEnd) {
|
|
2883
|
+
if (doc.comment) {
|
|
2884
|
+
const cs = commentString(doc.comment);
|
|
2885
|
+
if (cs.includes("\n")) {
|
|
2886
|
+
lines.push("...");
|
|
2887
|
+
lines.push(stringifyComment.indentComment(cs, ""));
|
|
2888
|
+
} else lines.push(`... ${cs}`);
|
|
2889
|
+
} else lines.push("...");
|
|
2890
|
+
} else {
|
|
2878
2891
|
let dc = doc.comment;
|
|
2879
2892
|
if (dc && chompKeep) dc = dc.replace(/^\n+/, "");
|
|
2880
2893
|
if (dc) {
|
|
@@ -3413,8 +3426,10 @@ var require_resolve_block_map = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3413
3426
|
}
|
|
3414
3427
|
if (!keyProps.anchor && !keyProps.tag && !sep) {
|
|
3415
3428
|
commentEnd = keyProps.end;
|
|
3416
|
-
if (keyProps.comment)
|
|
3417
|
-
|
|
3429
|
+
if (keyProps.comment) {
|
|
3430
|
+
if (map.comment) map.comment += "\n" + keyProps.comment;
|
|
3431
|
+
else map.comment = keyProps.comment;
|
|
3432
|
+
}
|
|
3418
3433
|
continue;
|
|
3419
3434
|
}
|
|
3420
3435
|
if (keyProps.newlineAfterProp || utilContainsNewline.containsNewline(key)) onError(key ?? start[start.length - 1], "MULTILINE_IMPLICIT_KEY", "Implicit keys need to be on a single line");
|
|
@@ -3447,8 +3462,10 @@ var require_resolve_block_map = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3447
3462
|
map.items.push(pair);
|
|
3448
3463
|
} else {
|
|
3449
3464
|
if (implicitKey) onError(keyNode.range, "MISSING_CHAR", "Implicit map keys need to be followed by map values");
|
|
3450
|
-
if (valueProps.comment)
|
|
3451
|
-
|
|
3465
|
+
if (valueProps.comment) {
|
|
3466
|
+
if (keyNode.comment) keyNode.comment += "\n" + valueProps.comment;
|
|
3467
|
+
else keyNode.comment = valueProps.comment;
|
|
3468
|
+
}
|
|
3452
3469
|
const pair = new Pair.Pair(keyNode);
|
|
3453
3470
|
if (ctx.options.keepSourceTokens) pair.srcToken = collItem;
|
|
3454
3471
|
map.items.push(pair);
|
|
@@ -3485,12 +3502,15 @@ var require_resolve_block_seq = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3485
3502
|
parentIndent: bs.indent,
|
|
3486
3503
|
startOnNewline: true
|
|
3487
3504
|
});
|
|
3488
|
-
if (!props.found)
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3505
|
+
if (!props.found) {
|
|
3506
|
+
if (props.anchor || props.tag || value) {
|
|
3507
|
+
if (value?.type === "block-seq") onError(props.end, "BAD_INDENT", "All sequence items must start at the same column");
|
|
3508
|
+
else onError(offset, "MISSING_CHAR", "Sequence item without - indicator");
|
|
3509
|
+
} else {
|
|
3510
|
+
commentEnd = props.end;
|
|
3511
|
+
if (props.comment) seq.comment = props.comment;
|
|
3512
|
+
continue;
|
|
3513
|
+
}
|
|
3494
3514
|
}
|
|
3495
3515
|
const node = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, start, null, props, onError);
|
|
3496
3516
|
if (ctx.schema.compat) utilFlowIndentCheck.flowIndentCheck(bs.indent, value, onError);
|
|
@@ -3582,8 +3602,10 @@ var require_resolve_flow_collection = /* @__PURE__ */ __commonJSMin(((exports) =
|
|
|
3582
3602
|
if (!props.anchor && !props.tag && !sep && !value) {
|
|
3583
3603
|
if (i === 0 && props.comma) onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
|
|
3584
3604
|
else if (i < fc.items.length - 1) onError(props.start, "UNEXPECTED_TOKEN", `Unexpected empty item in ${fcName}`);
|
|
3585
|
-
if (props.comment)
|
|
3586
|
-
|
|
3605
|
+
if (props.comment) {
|
|
3606
|
+
if (coll.comment) coll.comment += "\n" + props.comment;
|
|
3607
|
+
else coll.comment = props.comment;
|
|
3608
|
+
}
|
|
3587
3609
|
offset = props.end;
|
|
3588
3610
|
continue;
|
|
3589
3611
|
}
|
|
@@ -3643,13 +3665,17 @@ var require_resolve_flow_collection = /* @__PURE__ */ __commonJSMin(((exports) =
|
|
|
3643
3665
|
}
|
|
3644
3666
|
if (props.start < valueProps.found.offset - 1024) onError(valueProps.found, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit flow sequence key");
|
|
3645
3667
|
}
|
|
3646
|
-
} else if (value)
|
|
3647
|
-
|
|
3668
|
+
} else if (value) {
|
|
3669
|
+
if ("source" in value && value.source?.[0] === ":") onError(value, "MISSING_CHAR", `Missing space after : in ${fcName}`);
|
|
3670
|
+
else onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
|
|
3671
|
+
}
|
|
3648
3672
|
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep, null, valueProps, onError) : null;
|
|
3649
3673
|
if (valueNode) {
|
|
3650
3674
|
if (isBlock(value)) onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
3651
|
-
} else if (valueProps.comment)
|
|
3652
|
-
|
|
3675
|
+
} else if (valueProps.comment) {
|
|
3676
|
+
if (keyNode.comment) keyNode.comment += "\n" + valueProps.comment;
|
|
3677
|
+
else keyNode.comment = valueProps.comment;
|
|
3678
|
+
}
|
|
3653
3679
|
const pair = new Pair.Pair(keyNode, valueNode);
|
|
3654
3680
|
if (ctx.options.keepSourceTokens) pair.srcToken = collItem;
|
|
3655
3681
|
if (isMap) {
|
|
@@ -3683,8 +3709,10 @@ var require_resolve_flow_collection = /* @__PURE__ */ __commonJSMin(((exports) =
|
|
|
3683
3709
|
}
|
|
3684
3710
|
if (ee.length > 0) {
|
|
3685
3711
|
const end = resolveEnd.resolveEnd(ee, cePos, ctx.options.strict, onError);
|
|
3686
|
-
if (end.comment)
|
|
3687
|
-
|
|
3712
|
+
if (end.comment) {
|
|
3713
|
+
if (coll.comment) coll.comment += "\n" + end.comment;
|
|
3714
|
+
else coll.comment = end.comment;
|
|
3715
|
+
}
|
|
3688
3716
|
coll.range = [
|
|
3689
3717
|
fc.offset,
|
|
3690
3718
|
cePos,
|
|
@@ -3832,9 +3860,10 @@ var require_resolve_block_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3832
3860
|
value += sep + indent.slice(trimIndent) + content;
|
|
3833
3861
|
sep = "\n";
|
|
3834
3862
|
prevMoreIndented = true;
|
|
3835
|
-
} else if (content === "")
|
|
3836
|
-
|
|
3837
|
-
|
|
3863
|
+
} else if (content === "") {
|
|
3864
|
+
if (sep === "\n") value += "\n";
|
|
3865
|
+
else sep = "\n";
|
|
3866
|
+
} else {
|
|
3838
3867
|
value += sep + content;
|
|
3839
3868
|
sep = " ";
|
|
3840
3869
|
prevMoreIndented = false;
|
|
@@ -3995,9 +4024,7 @@ var require_resolve_flow_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3995
4024
|
badChar = `block scalar indicator ${source[0]}`;
|
|
3996
4025
|
break;
|
|
3997
4026
|
case "@":
|
|
3998
|
-
case "`":
|
|
3999
|
-
badChar = `reserved character ${source[0]}`;
|
|
4000
|
-
break;
|
|
4027
|
+
case "`": badChar = `reserved character ${source[0]}`;
|
|
4001
4028
|
}
|
|
4002
4029
|
if (badChar) onError(0, "BAD_SCALAR_START", `Plain value cannot start with ${badChar}`);
|
|
4003
4030
|
return foldLines(source);
|
|
@@ -4029,9 +4056,10 @@ var require_resolve_flow_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4029
4056
|
let pos = first.lastIndex;
|
|
4030
4057
|
line.lastIndex = pos;
|
|
4031
4058
|
while (match = line.exec(source)) {
|
|
4032
|
-
if (match[1] === "")
|
|
4033
|
-
|
|
4034
|
-
|
|
4059
|
+
if (match[1] === "") {
|
|
4060
|
+
if (sep === "\n") res += sep;
|
|
4061
|
+
else sep = "\n";
|
|
4062
|
+
} else {
|
|
4035
4063
|
res += sep + match[1];
|
|
4036
4064
|
sep = " ";
|
|
4037
4065
|
}
|
|
@@ -4167,8 +4195,10 @@ var require_compose_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4167
4195
|
function findScalarTagByName(schema, value, tagName, tagToken, onError) {
|
|
4168
4196
|
if (tagName === "!") return schema[identity.SCALAR];
|
|
4169
4197
|
const matchWithTest = [];
|
|
4170
|
-
for (const tag of schema.tags) if (!tag.collection && tag.tag === tagName)
|
|
4171
|
-
|
|
4198
|
+
for (const tag of schema.tags) if (!tag.collection && tag.tag === tagName) {
|
|
4199
|
+
if (tag.default && tag.test) matchWithTest.push(tag);
|
|
4200
|
+
else return tag;
|
|
4201
|
+
}
|
|
4172
4202
|
for (const tag of matchWithTest) if (tag.test?.test(value)) return tag;
|
|
4173
4203
|
const kt = schema.knownTags[tagName];
|
|
4174
4204
|
if (kt && !kt.collection) {
|
|
@@ -4266,8 +4296,10 @@ var require_compose_node = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4266
4296
|
if (anchor && node.anchor === "") onError(anchor, "BAD_ALIAS", "Anchor cannot be an empty string");
|
|
4267
4297
|
if (atKey && ctx.options.stringKeys && (!identity.isScalar(node) || typeof node.value !== "string" || node.tag && node.tag !== "tag:yaml.org,2002:str")) onError(tag ?? token, "NON_STRING_KEY", "With stringKeys, all keys must be strings");
|
|
4268
4298
|
if (spaceBefore) node.spaceBefore = true;
|
|
4269
|
-
if (comment)
|
|
4270
|
-
|
|
4299
|
+
if (comment) {
|
|
4300
|
+
if (token.type === "scalar" && token.source === "") node.comment = comment;
|
|
4301
|
+
else node.commentBefore = comment;
|
|
4302
|
+
}
|
|
4271
4303
|
if (ctx.options.keepSourceTokens && isSrcToken) node.srcToken = token;
|
|
4272
4304
|
return node;
|
|
4273
4305
|
}
|
|
@@ -5456,11 +5488,13 @@ var require_lexer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5456
5488
|
end = i;
|
|
5457
5489
|
} else if (isEmpty(ch)) {
|
|
5458
5490
|
let next = this.buffer[i + 1];
|
|
5459
|
-
if (ch === "\r")
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5491
|
+
if (ch === "\r") {
|
|
5492
|
+
if (next === "\n") {
|
|
5493
|
+
i += 1;
|
|
5494
|
+
ch = "\n";
|
|
5495
|
+
next = this.buffer[i + 1];
|
|
5496
|
+
} else end = i;
|
|
5497
|
+
}
|
|
5464
5498
|
if (next === "#" || inFlow && flowIndicatorChars.has(next)) break;
|
|
5465
5499
|
if (ch === "\n") {
|
|
5466
5500
|
const cs = this.continueScalar(i + 1);
|
|
@@ -5677,9 +5711,10 @@ var require_parser = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5677
5711
|
for (const it of fc.items) if (it.sep && !it.value && !includesToken(it.start, "explicit-key-ind") && !includesToken(it.sep, "map-value-ind")) {
|
|
5678
5712
|
if (it.key) it.value = it.key;
|
|
5679
5713
|
delete it.key;
|
|
5680
|
-
if (isFlowToken(it.value))
|
|
5681
|
-
|
|
5682
|
-
|
|
5714
|
+
if (isFlowToken(it.value)) {
|
|
5715
|
+
if (it.value.end) arrayPushArray(it.value.end, it.sep);
|
|
5716
|
+
else it.value.end = it.sep;
|
|
5717
|
+
} else arrayPushArray(it.start, it.sep);
|
|
5683
5718
|
delete it.sep;
|
|
5684
5719
|
}
|
|
5685
5720
|
}
|
|
@@ -6114,58 +6149,60 @@ var require_parser = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
6114
6149
|
this.onKeyLine = true;
|
|
6115
6150
|
return;
|
|
6116
6151
|
case "map-value-ind":
|
|
6117
|
-
if (it.explicitKey)
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
});
|
|
6121
|
-
else {
|
|
6122
|
-
const start = getFirstKeyStartProps(it.start);
|
|
6123
|
-
this.stack.push({
|
|
6124
|
-
type: "block-map",
|
|
6125
|
-
offset: this.offset,
|
|
6126
|
-
indent: this.indent,
|
|
6127
|
-
items: [{
|
|
6128
|
-
start,
|
|
6152
|
+
if (it.explicitKey) {
|
|
6153
|
+
if (!it.sep) {
|
|
6154
|
+
if (includesToken(it.start, "newline")) Object.assign(it, {
|
|
6129
6155
|
key: null,
|
|
6130
6156
|
sep: [this.sourceToken]
|
|
6131
|
-
}
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6157
|
+
});
|
|
6158
|
+
else {
|
|
6159
|
+
const start = getFirstKeyStartProps(it.start);
|
|
6160
|
+
this.stack.push({
|
|
6161
|
+
type: "block-map",
|
|
6162
|
+
offset: this.offset,
|
|
6163
|
+
indent: this.indent,
|
|
6164
|
+
items: [{
|
|
6165
|
+
start,
|
|
6166
|
+
key: null,
|
|
6167
|
+
sep: [this.sourceToken]
|
|
6168
|
+
}]
|
|
6169
|
+
});
|
|
6170
|
+
}
|
|
6171
|
+
} else if (it.value) map.items.push({
|
|
6172
|
+
start: [],
|
|
6145
6173
|
key: null,
|
|
6146
6174
|
sep: [this.sourceToken]
|
|
6147
|
-
}
|
|
6148
|
-
|
|
6149
|
-
else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
|
|
6150
|
-
const start = getFirstKeyStartProps(it.start);
|
|
6151
|
-
const key = it.key;
|
|
6152
|
-
const sep = it.sep;
|
|
6153
|
-
sep.push(this.sourceToken);
|
|
6154
|
-
delete it.key;
|
|
6155
|
-
delete it.sep;
|
|
6156
|
-
this.stack.push({
|
|
6175
|
+
});
|
|
6176
|
+
else if (includesToken(it.sep, "map-value-ind")) this.stack.push({
|
|
6157
6177
|
type: "block-map",
|
|
6158
6178
|
offset: this.offset,
|
|
6159
6179
|
indent: this.indent,
|
|
6160
6180
|
items: [{
|
|
6161
6181
|
start,
|
|
6162
|
-
key,
|
|
6163
|
-
sep
|
|
6182
|
+
key: null,
|
|
6183
|
+
sep: [this.sourceToken]
|
|
6164
6184
|
}]
|
|
6165
6185
|
});
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6186
|
+
else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
|
|
6187
|
+
const start = getFirstKeyStartProps(it.start);
|
|
6188
|
+
const key = it.key;
|
|
6189
|
+
const sep = it.sep;
|
|
6190
|
+
sep.push(this.sourceToken);
|
|
6191
|
+
delete it.key;
|
|
6192
|
+
delete it.sep;
|
|
6193
|
+
this.stack.push({
|
|
6194
|
+
type: "block-map",
|
|
6195
|
+
offset: this.offset,
|
|
6196
|
+
indent: this.indent,
|
|
6197
|
+
items: [{
|
|
6198
|
+
start,
|
|
6199
|
+
key,
|
|
6200
|
+
sep
|
|
6201
|
+
}]
|
|
6202
|
+
});
|
|
6203
|
+
} else if (start.length > 0) it.sep = it.sep.concat(start, this.sourceToken);
|
|
6204
|
+
else it.sep.push(this.sourceToken);
|
|
6205
|
+
} else if (!it.sep) Object.assign(it, {
|
|
6169
6206
|
key: null,
|
|
6170
6207
|
sep: [this.sourceToken]
|
|
6171
6208
|
});
|
|
@@ -6538,8 +6575,10 @@ var require_public_api = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
6538
6575
|
const doc = parseDocument(src, options);
|
|
6539
6576
|
if (!doc) return null;
|
|
6540
6577
|
doc.warnings.forEach((warning) => log.warn(doc.options.logLevel, warning));
|
|
6541
|
-
if (doc.errors.length > 0)
|
|
6542
|
-
|
|
6578
|
+
if (doc.errors.length > 0) {
|
|
6579
|
+
if (doc.options.logLevel !== "silent") throw doc.errors[0];
|
|
6580
|
+
else doc.errors = [];
|
|
6581
|
+
}
|
|
6543
6582
|
return doc.toJS(Object.assign({ reviver: _reviver }, options));
|
|
6544
6583
|
}
|
|
6545
6584
|
function stringify(value, replacer, options) {
|