@savvy-web/changelog 0.1.0 → 0.1.1
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/index.cjs +1582 -172
- package/index.d.cts +7 -19504
- package/index.d.ts +7 -19504
- package/index.js +1600 -174
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -3592,7 +3592,7 @@ const Order$1 = number;
|
|
|
3592
3592
|
* @since 2.0.0
|
|
3593
3593
|
* @category constructors
|
|
3594
3594
|
*/
|
|
3595
|
-
const parse$
|
|
3595
|
+
const parse$4 = (s) => {
|
|
3596
3596
|
if (s === "NaN") return some$1(NaN);
|
|
3597
3597
|
if (s === "Infinity") return some$1(Infinity);
|
|
3598
3598
|
if (s === "-Infinity") return some$1(-Infinity);
|
|
@@ -12585,7 +12585,7 @@ const set = /*#__PURE__*/ dual(2, (self, value) => self.modify(() => [void 0, va
|
|
|
12585
12585
|
/** @internal */
|
|
12586
12586
|
const getAndSet$1 = /*#__PURE__*/ dual(2, (self, value) => self.modify((a) => [a, value]));
|
|
12587
12587
|
/** @internal */
|
|
12588
|
-
const modify = /*#__PURE__*/ dual(2, (self, f) => self.modify(f));
|
|
12588
|
+
const modify$1 = /*#__PURE__*/ dual(2, (self, f) => self.modify(f));
|
|
12589
12589
|
/** @internal */
|
|
12590
12590
|
const update$1 = /*#__PURE__*/ dual(2, (self, f) => self.modify((a) => [void 0, f(a)]));
|
|
12591
12591
|
|
|
@@ -17634,7 +17634,7 @@ var MemoMapImpl = class {
|
|
|
17634
17634
|
const resource = uninterruptibleMask$2((restore) => pipe$1(scopeMake(), flatMap$4((innerScope) => pipe$1(restore(flatMap$4(makeBuilder(layer, innerScope, true), (f) => diffFiberRefs(f(this)))), exit$3, flatMap$4((exit) => {
|
|
17635
17635
|
switch (exit._tag) {
|
|
17636
17636
|
case OP_FAILURE: return pipe$1(deferredFailCause(deferred, exit.effect_instruction_i0), zipRight$2(scopeClose(innerScope, exit)), zipRight$2(failCause$4(exit.effect_instruction_i0)));
|
|
17637
|
-
case OP_SUCCESS: return pipe$1(set(finalizerRef, (exit) => pipe$1(scopeClose(innerScope, exit), whenEffect(modify(observers, (n) => [n === 1, n - 1])), asVoid)), zipRight$2(update$1(observers, (n) => n + 1)), zipRight$2(scopeAddFinalizerExit(scope, (exit) => pipe$1(sync$3(() => map.delete(layer)), zipRight$2(get(finalizerRef)), flatMap$4((finalizer) => finalizer(exit))))), zipRight$2(deferredSucceed(deferred, exit.effect_instruction_i0)), as$1(exit.effect_instruction_i0[1]));
|
|
17637
|
+
case OP_SUCCESS: return pipe$1(set(finalizerRef, (exit) => pipe$1(scopeClose(innerScope, exit), whenEffect(modify$1(observers, (n) => [n === 1, n - 1])), asVoid)), zipRight$2(update$1(observers, (n) => n + 1)), zipRight$2(scopeAddFinalizerExit(scope, (exit) => pipe$1(sync$3(() => map.delete(layer)), zipRight$2(get(finalizerRef)), flatMap$4((finalizer) => finalizer(exit))))), zipRight$2(deferredSucceed(deferred, exit.effect_instruction_i0)), as$1(exit.effect_instruction_i0[1]));
|
|
17638
17638
|
}
|
|
17639
17639
|
})))));
|
|
17640
17640
|
const memoized = [pipe$1(deferredAwait(deferred), onExit$1(exitMatchEffect({
|
|
@@ -24792,7 +24792,7 @@ const nonNegative = (annotations) => greaterThanOrEqualTo(0, {
|
|
|
24792
24792
|
function parseNumber(self) {
|
|
24793
24793
|
return transformOrFail(self, Number$, {
|
|
24794
24794
|
strict: false,
|
|
24795
|
-
decode: (i, _, ast) => fromOption(parse$
|
|
24795
|
+
decode: (i, _, ast) => fromOption(parse$4(i), () => new Type(ast, i, `Unable to decode ${JSON.stringify(i)} into a number`)),
|
|
24796
24796
|
encode: (a) => succeed(String(a))
|
|
24797
24797
|
});
|
|
24798
24798
|
}
|
|
@@ -26275,7 +26275,7 @@ const ChangesetConfigLive = effect$1(ChangesetConfig, gen(function* () {
|
|
|
26275
26275
|
}));
|
|
26276
26276
|
|
|
26277
26277
|
//#endregion
|
|
26278
|
-
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.
|
|
26278
|
+
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/errors/CatalogAssemblyError.js
|
|
26279
26279
|
/**
|
|
26280
26280
|
* Base constant for {@link CatalogAssemblyError}.
|
|
26281
26281
|
*
|
|
@@ -26303,7 +26303,7 @@ var CatalogAssemblyError = class extends CatalogAssemblyErrorBase {
|
|
|
26303
26303
|
};
|
|
26304
26304
|
|
|
26305
26305
|
//#endregion
|
|
26306
|
-
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.
|
|
26306
|
+
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/errors/CatalogResolutionError.js
|
|
26307
26307
|
/**
|
|
26308
26308
|
* Base constant for {@link CatalogResolutionError}.
|
|
26309
26309
|
*
|
|
@@ -26330,7 +26330,7 @@ var CatalogResolutionError = class extends CatalogResolutionErrorBase {
|
|
|
26330
26330
|
};
|
|
26331
26331
|
|
|
26332
26332
|
//#endregion
|
|
26333
|
-
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.
|
|
26333
|
+
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/errors/GitReadError.js
|
|
26334
26334
|
/**
|
|
26335
26335
|
* Base constant for {@link GitReadError}.
|
|
26336
26336
|
*
|
|
@@ -26356,7 +26356,7 @@ var GitReadError = class extends GitReadErrorBase {
|
|
|
26356
26356
|
};
|
|
26357
26357
|
|
|
26358
26358
|
//#endregion
|
|
26359
|
-
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.
|
|
26359
|
+
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/errors/PackageNotFoundError.js
|
|
26360
26360
|
/**
|
|
26361
26361
|
* Base constant for {@link PackageNotFoundError}.
|
|
26362
26362
|
*
|
|
@@ -26408,7 +26408,7 @@ var PackageNotFoundError = class extends PackageNotFoundErrorBase {
|
|
|
26408
26408
|
};
|
|
26409
26409
|
|
|
26410
26410
|
//#endregion
|
|
26411
|
-
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.
|
|
26411
|
+
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/errors/WorkspaceDiscoveryError.js
|
|
26412
26412
|
/**
|
|
26413
26413
|
* Base constant for {@link WorkspaceDiscoveryError}.
|
|
26414
26414
|
*
|
|
@@ -26460,7 +26460,7 @@ var WorkspaceDiscoveryError = class extends WorkspaceDiscoveryErrorBase {
|
|
|
26460
26460
|
};
|
|
26461
26461
|
|
|
26462
26462
|
//#endregion
|
|
26463
|
-
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.
|
|
26463
|
+
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/errors/WorkspaceRootNotFoundError.js
|
|
26464
26464
|
/**
|
|
26465
26465
|
* Base constant for {@link WorkspaceRootNotFoundError}.
|
|
26466
26466
|
*
|
|
@@ -26511,7 +26511,7 @@ var WorkspaceRootNotFoundError = class extends WorkspaceRootNotFoundErrorBase {
|
|
|
26511
26511
|
};
|
|
26512
26512
|
|
|
26513
26513
|
//#endregion
|
|
26514
|
-
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.
|
|
26514
|
+
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/services/WorkspaceDiscovery.js
|
|
26515
26515
|
/**
|
|
26516
26516
|
* Service for discovering workspace packages in a monorepo.
|
|
26517
26517
|
*
|
|
@@ -26562,7 +26562,7 @@ var WorkspaceRootNotFoundError = class extends WorkspaceRootNotFoundErrorBase {
|
|
|
26562
26562
|
var WorkspaceDiscovery = class extends Tag("@spencerbeggs/workspaces-effect/WorkspaceDiscovery")() {};
|
|
26563
26563
|
|
|
26564
26564
|
//#endregion
|
|
26565
|
-
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.
|
|
26565
|
+
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/services/WorkspaceRoot.js
|
|
26566
26566
|
/**
|
|
26567
26567
|
* Service for finding the workspace root directory.
|
|
26568
26568
|
*
|
|
@@ -26610,7 +26610,7 @@ var WorkspaceDiscovery = class extends Tag("@spencerbeggs/workspaces-effect/Work
|
|
|
26610
26610
|
var WorkspaceRoot = class extends Tag("@spencerbeggs/workspaces-effect/WorkspaceRoot")() {};
|
|
26611
26611
|
|
|
26612
26612
|
//#endregion
|
|
26613
|
-
//#region ../../node_modules/.pnpm/yaml-effect@0.7.
|
|
26613
|
+
//#region ../../node_modules/.pnpm/yaml-effect@0.7.2_effect@3.21.4/node_modules/yaml-effect/errors/YamlComposerError.js
|
|
26614
26614
|
/**
|
|
26615
26615
|
* YAML composer error type.
|
|
26616
26616
|
*
|
|
@@ -26669,7 +26669,7 @@ var YamlComposerError = class extends YamlComposerErrorBase {
|
|
|
26669
26669
|
};
|
|
26670
26670
|
|
|
26671
26671
|
//#endregion
|
|
26672
|
-
//#region ../../node_modules/.pnpm/yaml-effect@0.7.
|
|
26672
|
+
//#region ../../node_modules/.pnpm/yaml-effect@0.7.2_effect@3.21.4/node_modules/yaml-effect/errors/YamlErrorDetail.js
|
|
26673
26673
|
/**
|
|
26674
26674
|
* YAML error detail schema and error code types.
|
|
26675
26675
|
*
|
|
@@ -26723,7 +26723,7 @@ var YamlErrorDetail = class extends Class("YamlErrorDetail")({
|
|
|
26723
26723
|
}) {};
|
|
26724
26724
|
|
|
26725
26725
|
//#endregion
|
|
26726
|
-
//#region ../../node_modules/.pnpm/yaml-effect@0.7.
|
|
26726
|
+
//#region ../../node_modules/.pnpm/yaml-effect@0.7.2_effect@3.21.4/node_modules/yaml-effect/schemas/CstNode.js
|
|
26727
26727
|
/**
|
|
26728
26728
|
* YAML CST node schema and node type literal union.
|
|
26729
26729
|
*
|
|
@@ -26760,7 +26760,7 @@ var CstNode = class CstNode extends Class("CstNode")({
|
|
|
26760
26760
|
}) {};
|
|
26761
26761
|
|
|
26762
26762
|
//#endregion
|
|
26763
|
-
//#region ../../node_modules/.pnpm/yaml-effect@0.7.
|
|
26763
|
+
//#region ../../node_modules/.pnpm/yaml-effect@0.7.2_effect@3.21.4/node_modules/yaml-effect/schemas/YamlShared.js
|
|
26764
26764
|
/**
|
|
26765
26765
|
* Shared YAML structural types used across the parse/stringify/format pipeline.
|
|
26766
26766
|
*
|
|
@@ -26835,7 +26835,7 @@ var YamlEdit = class extends Class("YamlEdit")({
|
|
|
26835
26835
|
}) {};
|
|
26836
26836
|
|
|
26837
26837
|
//#endregion
|
|
26838
|
-
//#region ../../node_modules/.pnpm/yaml-effect@0.7.
|
|
26838
|
+
//#region ../../node_modules/.pnpm/yaml-effect@0.7.2_effect@3.21.4/node_modules/yaml-effect/schemas/YamlAstNodes.js
|
|
26839
26839
|
/**
|
|
26840
26840
|
* Internal module defining all mutually-referential YAML AST node schemas in
|
|
26841
26841
|
* one place to avoid circular import cycles between individual schema files.
|
|
@@ -27047,7 +27047,7 @@ var YamlSeq = class extends TaggedClass()("YamlSeq", {
|
|
|
27047
27047
|
}) {};
|
|
27048
27048
|
|
|
27049
27049
|
//#endregion
|
|
27050
|
-
//#region ../../node_modules/.pnpm/yaml-effect@0.7.
|
|
27050
|
+
//#region ../../node_modules/.pnpm/yaml-effect@0.7.2_effect@3.21.4/node_modules/yaml-effect/schemas/YamlDocument.js
|
|
27051
27051
|
/**
|
|
27052
27052
|
* YAML document and directive schemas.
|
|
27053
27053
|
*
|
|
@@ -27126,7 +27126,7 @@ var YamlDocument = class extends Class("YamlDocument")({
|
|
|
27126
27126
|
}) {};
|
|
27127
27127
|
|
|
27128
27128
|
//#endregion
|
|
27129
|
-
//#region ../../node_modules/.pnpm/yaml-effect@0.7.
|
|
27129
|
+
//#region ../../node_modules/.pnpm/yaml-effect@0.7.2_effect@3.21.4/node_modules/yaml-effect/schemas/YamlToken.js
|
|
27130
27130
|
/**
|
|
27131
27131
|
* YAML token schema and token kind literal union.
|
|
27132
27132
|
*
|
|
@@ -27162,7 +27162,7 @@ var YamlToken = class extends Class("YamlToken")({
|
|
|
27162
27162
|
}) {};
|
|
27163
27163
|
|
|
27164
27164
|
//#endregion
|
|
27165
|
-
//#region ../../node_modules/.pnpm/yaml-effect@0.7.
|
|
27165
|
+
//#region ../../node_modules/.pnpm/yaml-effect@0.7.2_effect@3.21.4/node_modules/yaml-effect/utils/lexer.js
|
|
27166
27166
|
/**
|
|
27167
27167
|
* YAML 1.2 lexer — tokenizes raw YAML text into a stream of {@link YamlToken} values.
|
|
27168
27168
|
*
|
|
@@ -27192,7 +27192,7 @@ var YamlToken = class extends Class("YamlToken")({
|
|
|
27192
27192
|
*
|
|
27193
27193
|
* @public
|
|
27194
27194
|
*/
|
|
27195
|
-
function createScanner$
|
|
27195
|
+
function createScanner$2(text) {
|
|
27196
27196
|
let pos = 0;
|
|
27197
27197
|
let line = 0;
|
|
27198
27198
|
let col = 0;
|
|
@@ -28143,7 +28143,7 @@ function createScanner$1(text) {
|
|
|
28143
28143
|
* @public
|
|
28144
28144
|
*/
|
|
28145
28145
|
function lex(text) {
|
|
28146
|
-
return unfold(createScanner$
|
|
28146
|
+
return unfold(createScanner$2(text), (scanner) => {
|
|
28147
28147
|
const kind = scanner.scan();
|
|
28148
28148
|
if (kind === null) return none$4();
|
|
28149
28149
|
const token = new YamlToken({
|
|
@@ -28168,7 +28168,7 @@ function lexAll(text) {
|
|
|
28168
28168
|
}
|
|
28169
28169
|
|
|
28170
28170
|
//#endregion
|
|
28171
|
-
//#region ../../node_modules/.pnpm/yaml-effect@0.7.
|
|
28171
|
+
//#region ../../node_modules/.pnpm/yaml-effect@0.7.2_effect@3.21.4/node_modules/yaml-effect/utils/parser.js
|
|
28172
28172
|
/**
|
|
28173
28173
|
* YAML 1.2 CST parser — transforms a token stream into a Concrete Syntax Tree.
|
|
28174
28174
|
*
|
|
@@ -28814,7 +28814,7 @@ function parseCSTAll(text) {
|
|
|
28814
28814
|
}
|
|
28815
28815
|
|
|
28816
28816
|
//#endregion
|
|
28817
|
-
//#region ../../node_modules/.pnpm/yaml-effect@0.7.
|
|
28817
|
+
//#region ../../node_modules/.pnpm/yaml-effect@0.7.2_effect@3.21.4/node_modules/yaml-effect/utils/composer.js
|
|
28818
28818
|
/**
|
|
28819
28819
|
* YAML 1.2 Composer — transforms CST nodes into AST nodes with typed values.
|
|
28820
28820
|
*
|
|
@@ -28823,16 +28823,29 @@ function parseCSTAll(text) {
|
|
|
28823
28823
|
*
|
|
28824
28824
|
* @packageDocumentation
|
|
28825
28825
|
*/
|
|
28826
|
+
let lineStartsText;
|
|
28827
|
+
let lineStartsCache = [];
|
|
28828
|
+
function getLineStarts(text) {
|
|
28829
|
+
if (lineStartsText === text) return lineStartsCache;
|
|
28830
|
+
const starts = [0];
|
|
28831
|
+
for (let i = 0; i < text.length; i++) if (text[i] === "\n") starts.push(i + 1);
|
|
28832
|
+
lineStartsText = text;
|
|
28833
|
+
lineStartsCache = starts;
|
|
28834
|
+
return starts;
|
|
28835
|
+
}
|
|
28826
28836
|
function lineCol(text, offset) {
|
|
28827
|
-
|
|
28828
|
-
|
|
28829
|
-
|
|
28830
|
-
|
|
28831
|
-
|
|
28832
|
-
|
|
28837
|
+
const starts = getLineStarts(text);
|
|
28838
|
+
const pos = Math.min(Math.max(offset, 0), text.length);
|
|
28839
|
+
let lo = 0;
|
|
28840
|
+
let hi = starts.length - 1;
|
|
28841
|
+
while (lo < hi) {
|
|
28842
|
+
const mid = lo + hi + 1 >> 1;
|
|
28843
|
+
if (starts[mid] <= pos) lo = mid;
|
|
28844
|
+
else hi = mid - 1;
|
|
28845
|
+
}
|
|
28833
28846
|
return {
|
|
28834
|
-
line,
|
|
28835
|
-
column
|
|
28847
|
+
line: lo,
|
|
28848
|
+
column: pos - starts[lo]
|
|
28836
28849
|
};
|
|
28837
28850
|
}
|
|
28838
28851
|
const NULL_RE = /^(?:null|Null|NULL|~)$/;
|
|
@@ -32276,7 +32289,7 @@ function parseDocument(text, options) {
|
|
|
32276
32289
|
*
|
|
32277
32290
|
* @public
|
|
32278
32291
|
*/
|
|
32279
|
-
function parse$
|
|
32292
|
+
function parse$3(text, options) {
|
|
32280
32293
|
const uniqueKeys = options?.uniqueKeys ?? true;
|
|
32281
32294
|
return parseDocument(text, options).pipe(flatMap$2((doc) => {
|
|
32282
32295
|
if (uniqueKeys) {
|
|
@@ -32292,14 +32305,14 @@ function parse$2(text, options) {
|
|
|
32292
32305
|
}
|
|
32293
32306
|
|
|
32294
32307
|
//#endregion
|
|
32295
|
-
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.
|
|
32308
|
+
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/catalog/workspace-manifest.js
|
|
32296
32309
|
/**
|
|
32297
32310
|
* Parse a pnpm-workspace.yaml text into its catalog/config-dependency/packages
|
|
32298
32311
|
* slice. Pure with respect to the filesystem.
|
|
32299
32312
|
*
|
|
32300
32313
|
* @public
|
|
32301
32314
|
*/
|
|
32302
|
-
const workspaceManifestFromYaml = (content) => parse$
|
|
32315
|
+
const workspaceManifestFromYaml = (content) => parse$3(content).pipe(mapError$1((e) => new CatalogAssemblyError({
|
|
32303
32316
|
source: "manifest",
|
|
32304
32317
|
reason: `invalid yaml: ${String(e)}`
|
|
32305
32318
|
})), map$5((parsed) => {
|
|
@@ -32368,7 +32381,7 @@ function checkDefaultCatalogIsDefinedOnce(manifest) {
|
|
|
32368
32381
|
}
|
|
32369
32382
|
|
|
32370
32383
|
//#endregion
|
|
32371
|
-
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.
|
|
32384
|
+
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/catalog/assemble.js
|
|
32372
32385
|
/** Merge catalog sources; later sources win per dependency within a catalog. */
|
|
32373
32386
|
function mergeCatalogs(...sources) {
|
|
32374
32387
|
const result = {};
|
|
@@ -32453,7 +32466,7 @@ function resolveFromCatalog(catalogs, wantedDependency) {
|
|
|
32453
32466
|
}
|
|
32454
32467
|
|
|
32455
32468
|
//#endregion
|
|
32456
|
-
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.
|
|
32469
|
+
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/catalog/resolve.js
|
|
32457
32470
|
const DEP_FIELDS = [
|
|
32458
32471
|
"dependencies",
|
|
32459
32472
|
"devDependencies",
|
|
@@ -32524,7 +32537,7 @@ function resolveManifest(catalogs, workspaceVersions, manifest) {
|
|
|
32524
32537
|
}
|
|
32525
32538
|
|
|
32526
32539
|
//#endregion
|
|
32527
|
-
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.
|
|
32540
|
+
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/schemas/CatalogSet.js
|
|
32528
32541
|
/**
|
|
32529
32542
|
* An immutable, fully-normalized catalog collection with the one
|
|
32530
32543
|
* resolution semantic shared by live and point-in-time resolution.
|
|
@@ -32615,7 +32628,7 @@ var CatalogSet = class CatalogSet extends Class("CatalogSet")({ entries: Record(
|
|
|
32615
32628
|
};
|
|
32616
32629
|
|
|
32617
32630
|
//#endregion
|
|
32618
|
-
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.
|
|
32631
|
+
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/point-in-time/worktree-catalogs.js
|
|
32619
32632
|
/**
|
|
32620
32633
|
* The ONE code path that reads the working tree's catalog sources
|
|
32621
32634
|
* (`pnpm-workspace.yaml` + `pnpm-lock.yaml`). Consumed by
|
|
@@ -32632,7 +32645,7 @@ var CatalogSet = class CatalogSet extends Class("CatalogSet")({ entries: Record(
|
|
|
32632
32645
|
*
|
|
32633
32646
|
* @internal
|
|
32634
32647
|
*/
|
|
32635
|
-
const lockfileCatalogsFromText = (text) => parse$
|
|
32648
|
+
const lockfileCatalogsFromText = (text) => parse$3(text).pipe(map$5((parsed) => CatalogSet.fromLockfileCatalogs(parsed?.catalogs)), orElseSucceed(() => CatalogSet.empty()));
|
|
32636
32649
|
/**
|
|
32637
32650
|
* Read the working tree's catalog state at `root`.
|
|
32638
32651
|
*
|
|
@@ -34171,7 +34184,7 @@ minimatch.escape = escape;
|
|
|
34171
34184
|
minimatch.unescape = unescape;
|
|
34172
34185
|
|
|
34173
34186
|
//#endregion
|
|
34174
|
-
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.
|
|
34187
|
+
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/schemas/core.js
|
|
34175
34188
|
/**
|
|
34176
34189
|
* Schema for supported package manager identifiers.
|
|
34177
34190
|
*
|
|
@@ -34499,7 +34512,1302 @@ var WorkspaceInfo = class extends Class("WorkspaceInfo")({
|
|
|
34499
34512
|
}) {};
|
|
34500
34513
|
|
|
34501
34514
|
//#endregion
|
|
34502
|
-
//#region ../../node_modules/.pnpm/
|
|
34515
|
+
//#region ../../node_modules/.pnpm/jsonc-effect@0.3.1_effect@3.21.4/node_modules/jsonc-effect/errors.js
|
|
34516
|
+
/**
|
|
34517
|
+
* JSONC error types using Effect's Data.TaggedError pattern.
|
|
34518
|
+
*
|
|
34519
|
+
* @packageDocumentation
|
|
34520
|
+
*/
|
|
34521
|
+
/**
|
|
34522
|
+
* Error codes representing specific JSONC parse failures.
|
|
34523
|
+
*
|
|
34524
|
+
* @remarks
|
|
34525
|
+
* Each code maps to a distinct syntactic error the parser can encounter,
|
|
34526
|
+
* from invalid symbols and number formats to missing delimiters and
|
|
34527
|
+
* unexpected end-of-input conditions.
|
|
34528
|
+
*
|
|
34529
|
+
* @see {@link JsoncParseErrorDetail} — carries one of these codes alongside
|
|
34530
|
+
* position information
|
|
34531
|
+
*
|
|
34532
|
+
* @public
|
|
34533
|
+
*/
|
|
34534
|
+
const JsoncParseErrorCode = Literal("InvalidSymbol", "InvalidNumberFormat", "PropertyNameExpected", "ValueExpected", "ColonExpected", "CommaExpected", "CloseBraceExpected", "CloseBracketExpected", "EndOfFileExpected", "InvalidCommentToken", "UnexpectedEndOfComment", "UnexpectedEndOfString", "UnexpectedEndOfNumber", "InvalidUnicode", "InvalidEscapeCharacter", "InvalidCharacter");
|
|
34535
|
+
/**
|
|
34536
|
+
* Detail for a single parse error, including the error code, a human-readable
|
|
34537
|
+
* message, and the exact position within the source document.
|
|
34538
|
+
*
|
|
34539
|
+
* @remarks
|
|
34540
|
+
* - `code` — a {@link (JsoncParseErrorCode:type)} identifying the error kind.
|
|
34541
|
+
* - `message` — a descriptive message suitable for display.
|
|
34542
|
+
* - `offset` — zero-based character offset where the error occurred.
|
|
34543
|
+
* - `length` — character length of the problematic span.
|
|
34544
|
+
* - `startLine` — zero-based line number of the error.
|
|
34545
|
+
* - `startCharacter` — zero-based column within `startLine`.
|
|
34546
|
+
*
|
|
34547
|
+
* @see {@link JsoncParseError} — aggregates an array of these details
|
|
34548
|
+
*
|
|
34549
|
+
* @example
|
|
34550
|
+
* ```ts
|
|
34551
|
+
* import { JsoncParseErrorDetail } from "jsonc-effect";
|
|
34552
|
+
*
|
|
34553
|
+
* const detail = new JsoncParseErrorDetail({
|
|
34554
|
+
* code: "ValueExpected",
|
|
34555
|
+
* message: "Value expected",
|
|
34556
|
+
* offset: 5,
|
|
34557
|
+
* length: 1,
|
|
34558
|
+
* startLine: 0,
|
|
34559
|
+
* startCharacter: 5,
|
|
34560
|
+
* });
|
|
34561
|
+
*
|
|
34562
|
+
* console.log(detail.code); // "ValueExpected"
|
|
34563
|
+
* console.log(detail.offset); // 5
|
|
34564
|
+
* ```
|
|
34565
|
+
*
|
|
34566
|
+
* @public
|
|
34567
|
+
*/
|
|
34568
|
+
var JsoncParseErrorDetail = class extends Class("JsoncParseErrorDetail")({
|
|
34569
|
+
code: JsoncParseErrorCode,
|
|
34570
|
+
message: String$,
|
|
34571
|
+
offset: Number$,
|
|
34572
|
+
length: Number$,
|
|
34573
|
+
startLine: Number$,
|
|
34574
|
+
startCharacter: Number$
|
|
34575
|
+
}) {};
|
|
34576
|
+
/**
|
|
34577
|
+
* Base class for {@link JsoncParseError}; not intended to be constructed or
|
|
34578
|
+
* caught directly — use `JsoncParseError` instead.
|
|
34579
|
+
*
|
|
34580
|
+
* @privateRemarks
|
|
34581
|
+
* The `*Base` pattern is required because `Data.TaggedError` produces complex
|
|
34582
|
+
* type signatures involving intersection types and branded generics that
|
|
34583
|
+
* api-extractor cannot roll up into a single `.d.ts` bundle. Exporting the
|
|
34584
|
+
* base separately lets the public `JsoncParseError` class extend it with
|
|
34585
|
+
* concrete fields, giving api-extractor a simple class declaration to work
|
|
34586
|
+
* with. It is tagged `@public` (rather than `@internal`) because it appears
|
|
34587
|
+
* in `JsoncParseError`'s heritage clause in the public `.d.ts`, and API
|
|
34588
|
+
* Extractor requires release tags to be compatible across a signature.
|
|
34589
|
+
*
|
|
34590
|
+
* @public
|
|
34591
|
+
*/
|
|
34592
|
+
const JsoncParseErrorBase = TaggedError("JsoncParseError");
|
|
34593
|
+
/**
|
|
34594
|
+
* Error raised when JSONC parsing encounters one or more syntax errors.
|
|
34595
|
+
*
|
|
34596
|
+
* @remarks
|
|
34597
|
+
* Contains the full source `text`, the `options` used for parsing, and an
|
|
34598
|
+
* `errors` array of {@link JsoncParseErrorDetail} instances with precise
|
|
34599
|
+
* position information for each problem found.
|
|
34600
|
+
*
|
|
34601
|
+
* @see {@link parse} — may fail with this error
|
|
34602
|
+
* @see {@link parseTree} — may fail with this error
|
|
34603
|
+
*
|
|
34604
|
+
* @example Catching with `Effect.catchTag`
|
|
34605
|
+
* ```ts
|
|
34606
|
+
* import { Effect } from "effect";
|
|
34607
|
+
* import { parse } from "jsonc-effect";
|
|
34608
|
+
*
|
|
34609
|
+
* const program = parse("{ invalid }").pipe(
|
|
34610
|
+
* Effect.catchTag("JsoncParseError", (e) => {
|
|
34611
|
+
* console.error(e.errors); // Array of JsoncParseErrorDetail
|
|
34612
|
+
* return Effect.succeed({});
|
|
34613
|
+
* }),
|
|
34614
|
+
* );
|
|
34615
|
+
* ```
|
|
34616
|
+
*
|
|
34617
|
+
* @example Inspecting error details
|
|
34618
|
+
* ```ts
|
|
34619
|
+
* import { Effect } from "effect";
|
|
34620
|
+
* import { parse } from "jsonc-effect";
|
|
34621
|
+
*
|
|
34622
|
+
* const program = parse("{ invalid }").pipe(
|
|
34623
|
+
* Effect.catchTag("JsoncParseError", (e) => {
|
|
34624
|
+
* for (const detail of e.errors) {
|
|
34625
|
+
* console.error(
|
|
34626
|
+
* `[${detail.code}] ${detail.message} at line ${detail.startLine}:${detail.startCharacter}`,
|
|
34627
|
+
* );
|
|
34628
|
+
* }
|
|
34629
|
+
* return Effect.succeed({});
|
|
34630
|
+
* }),
|
|
34631
|
+
* );
|
|
34632
|
+
* ```
|
|
34633
|
+
*
|
|
34634
|
+
* @public
|
|
34635
|
+
*/
|
|
34636
|
+
var JsoncParseError = class extends JsoncParseErrorBase {
|
|
34637
|
+
get message() {
|
|
34638
|
+
const count = this.errors.length;
|
|
34639
|
+
return `JSONC parse failed with ${count} error${count !== 1 ? "s" : ""}: ${this.errors.map((e) => e.message).join("; ")}`;
|
|
34640
|
+
}
|
|
34641
|
+
};
|
|
34642
|
+
/**
|
|
34643
|
+
* Base class for {@link JsoncNodeNotFoundError}; not intended to be
|
|
34644
|
+
* constructed or caught directly — use `JsoncNodeNotFoundError` instead.
|
|
34645
|
+
*
|
|
34646
|
+
* @privateRemarks
|
|
34647
|
+
* Uses the same `*Base` pattern as {@link JsoncParseErrorBase} to work
|
|
34648
|
+
* around api-extractor's inability to roll up the complex type produced
|
|
34649
|
+
* by `Data.TaggedError` into a single `.d.ts` declaration. Tagged `@public`
|
|
34650
|
+
* for the same heritage-clause-compatibility reason as `JsoncParseErrorBase`.
|
|
34651
|
+
*
|
|
34652
|
+
* @public
|
|
34653
|
+
*/
|
|
34654
|
+
const JsoncNodeNotFoundErrorBase = TaggedError("JsoncNodeNotFoundError");
|
|
34655
|
+
/**
|
|
34656
|
+
* Base class for {@link JsoncModificationError}; not intended to be
|
|
34657
|
+
* constructed or caught directly — use `JsoncModificationError` instead.
|
|
34658
|
+
*
|
|
34659
|
+
* @privateRemarks
|
|
34660
|
+
* Uses the same `*Base` pattern as {@link JsoncParseErrorBase} to work
|
|
34661
|
+
* around api-extractor's inability to roll up the complex type produced
|
|
34662
|
+
* by `Data.TaggedError` into a single `.d.ts` declaration. Tagged `@public`
|
|
34663
|
+
* for the same heritage-clause-compatibility reason as `JsoncParseErrorBase`.
|
|
34664
|
+
*
|
|
34665
|
+
* @public
|
|
34666
|
+
*/
|
|
34667
|
+
const JsoncModificationErrorBase = TaggedError("JsoncModificationError");
|
|
34668
|
+
/**
|
|
34669
|
+
* Error raised when {@link modify} produces invalid edits or encounters
|
|
34670
|
+
* an unsupported modification scenario.
|
|
34671
|
+
*
|
|
34672
|
+
* @remarks
|
|
34673
|
+
* Contains the `path` where modification was attempted and a `reason`
|
|
34674
|
+
* string explaining why it failed.
|
|
34675
|
+
*
|
|
34676
|
+
* @see {@link modify} — may fail with this error
|
|
34677
|
+
*
|
|
34678
|
+
* @example
|
|
34679
|
+
* ```ts
|
|
34680
|
+
* import { Effect } from "effect";
|
|
34681
|
+
* import { modify } from "jsonc-effect";
|
|
34682
|
+
*
|
|
34683
|
+
* const program = modify("{}", ["deep", "path"], 42).pipe(
|
|
34684
|
+
* Effect.catchTag("JsoncModificationError", (e) => {
|
|
34685
|
+
* console.error(`Failed at [${e.path.join(", ")}]: ${e.reason}`);
|
|
34686
|
+
* return Effect.succeed([]);
|
|
34687
|
+
* }),
|
|
34688
|
+
* );
|
|
34689
|
+
* ```
|
|
34690
|
+
*
|
|
34691
|
+
* @public
|
|
34692
|
+
*/
|
|
34693
|
+
var JsoncModificationError = class extends JsoncModificationErrorBase {
|
|
34694
|
+
get message() {
|
|
34695
|
+
return `Modification failed at path [${this.path.join(", ")}]: ${this.reason}`;
|
|
34696
|
+
}
|
|
34697
|
+
};
|
|
34698
|
+
|
|
34699
|
+
//#endregion
|
|
34700
|
+
//#region ../../node_modules/.pnpm/jsonc-effect@0.3.1_effect@3.21.4/node_modules/jsonc-effect/scanner.js
|
|
34701
|
+
const isWhitespace = (ch) => ch === 32 || ch === 9 || ch === 11 || ch === 12 || ch === 160 || ch === 65279;
|
|
34702
|
+
const isLineBreak$1 = (ch) => ch === 10 || ch === 13 || ch === 8232 || ch === 8233;
|
|
34703
|
+
const isDigit$1 = (ch) => ch >= 48 && ch <= 57;
|
|
34704
|
+
/**
|
|
34705
|
+
* Create a stateful {@link JsoncScanner} for the given JSONC string.
|
|
34706
|
+
*
|
|
34707
|
+
* @param text - JSONC string to tokenize
|
|
34708
|
+
* @param ignoreTrivia - If `true`, the scanner automatically skips whitespace,
|
|
34709
|
+
* line-break, and comment tokens so that only structural tokens are returned
|
|
34710
|
+
* (default: `false`).
|
|
34711
|
+
* @returns A stateful {@link JsoncScanner} positioned before the first token.
|
|
34712
|
+
*
|
|
34713
|
+
* @remarks
|
|
34714
|
+
* When `ignoreTrivia` is `true` the scanner is suitable for building parsers
|
|
34715
|
+
* that only care about structural tokens (`OpenBrace`, `String`, `Number`,
|
|
34716
|
+
* etc.). Set it to `false` (the default) when you need to preserve comments
|
|
34717
|
+
* or whitespace — for example in a formatter or a comment-stripping pass.
|
|
34718
|
+
*
|
|
34719
|
+
* @see {@link JsoncScanner} — the interface returned by this factory
|
|
34720
|
+
* @see {@link parse} — higher-level API that uses a scanner internally
|
|
34721
|
+
*
|
|
34722
|
+
* @example
|
|
34723
|
+
* Tokenizing a JSONC string and printing each token:
|
|
34724
|
+
* ```ts
|
|
34725
|
+
* import type { JsoncSyntaxKind } from "jsonc-effect";
|
|
34726
|
+
* import { createScanner } from "jsonc-effect";
|
|
34727
|
+
*
|
|
34728
|
+
* const scanner = createScanner('{ "name": "jsonc" }', true);
|
|
34729
|
+
* let kind: JsoncSyntaxKind;
|
|
34730
|
+
* do {
|
|
34731
|
+
* kind = scanner.scan();
|
|
34732
|
+
* console.log(kind, scanner.getTokenValue());
|
|
34733
|
+
* } while (kind !== "EOF");
|
|
34734
|
+
* ```
|
|
34735
|
+
*
|
|
34736
|
+
* @privateRemarks
|
|
34737
|
+
* Ported from Microsoft's jsonc-parser (MIT), adapted to use string literal
|
|
34738
|
+
* token types instead of numeric enums.
|
|
34739
|
+
*
|
|
34740
|
+
* @public
|
|
34741
|
+
*/
|
|
34742
|
+
const createScanner$1 = (text, ignoreTrivia = false) => {
|
|
34743
|
+
const len = text.length;
|
|
34744
|
+
let pos = 0;
|
|
34745
|
+
let tokenOffset = 0;
|
|
34746
|
+
let token = "Unknown";
|
|
34747
|
+
let tokenValue = "";
|
|
34748
|
+
let tokenError = "None";
|
|
34749
|
+
let lineNumber = 0;
|
|
34750
|
+
let lineStartOffset = 0;
|
|
34751
|
+
let tokenStartLine = 0;
|
|
34752
|
+
let tokenStartCharacter = 0;
|
|
34753
|
+
const scanHexDigits = (count) => {
|
|
34754
|
+
let value = 0;
|
|
34755
|
+
for (let i = 0; i < count; i++) {
|
|
34756
|
+
if (pos >= len) return -1;
|
|
34757
|
+
const ch = text.charCodeAt(pos);
|
|
34758
|
+
if (ch >= 48 && ch <= 57) value = value * 16 + (ch - 48);
|
|
34759
|
+
else if (ch >= 65 && ch <= 70) value = value * 16 + (ch - 65 + 10);
|
|
34760
|
+
else if (ch >= 97 && ch <= 102) value = value * 16 + (ch - 97 + 10);
|
|
34761
|
+
else return -1;
|
|
34762
|
+
pos++;
|
|
34763
|
+
}
|
|
34764
|
+
return value;
|
|
34765
|
+
};
|
|
34766
|
+
const scanString = () => {
|
|
34767
|
+
let result = "";
|
|
34768
|
+
pos++;
|
|
34769
|
+
let start = pos;
|
|
34770
|
+
while (pos < len) {
|
|
34771
|
+
const ch = text.charCodeAt(pos);
|
|
34772
|
+
if (ch === 34) {
|
|
34773
|
+
result += text.substring(start, pos);
|
|
34774
|
+
pos++;
|
|
34775
|
+
return result;
|
|
34776
|
+
}
|
|
34777
|
+
if (ch === 92) {
|
|
34778
|
+
result += text.substring(start, pos);
|
|
34779
|
+
pos++;
|
|
34780
|
+
if (pos >= len) {
|
|
34781
|
+
tokenError = "UnexpectedEndOfString";
|
|
34782
|
+
return result;
|
|
34783
|
+
}
|
|
34784
|
+
const escaped = text.charCodeAt(pos);
|
|
34785
|
+
pos++;
|
|
34786
|
+
switch (escaped) {
|
|
34787
|
+
case 34:
|
|
34788
|
+
result += "\"";
|
|
34789
|
+
break;
|
|
34790
|
+
case 92:
|
|
34791
|
+
result += "\\";
|
|
34792
|
+
break;
|
|
34793
|
+
case 47:
|
|
34794
|
+
result += "/";
|
|
34795
|
+
break;
|
|
34796
|
+
case 98:
|
|
34797
|
+
result += "\b";
|
|
34798
|
+
break;
|
|
34799
|
+
case 102:
|
|
34800
|
+
result += "\f";
|
|
34801
|
+
break;
|
|
34802
|
+
case 110:
|
|
34803
|
+
result += "\n";
|
|
34804
|
+
break;
|
|
34805
|
+
case 114:
|
|
34806
|
+
result += "\r";
|
|
34807
|
+
break;
|
|
34808
|
+
case 116:
|
|
34809
|
+
result += " ";
|
|
34810
|
+
break;
|
|
34811
|
+
case 117: {
|
|
34812
|
+
const value = scanHexDigits(4);
|
|
34813
|
+
if (value >= 0) result += String.fromCharCode(value);
|
|
34814
|
+
else tokenError = "InvalidUnicode";
|
|
34815
|
+
break;
|
|
34816
|
+
}
|
|
34817
|
+
default:
|
|
34818
|
+
tokenError = "InvalidEscapeCharacter";
|
|
34819
|
+
break;
|
|
34820
|
+
}
|
|
34821
|
+
start = pos;
|
|
34822
|
+
} else if (isLineBreak$1(ch)) {
|
|
34823
|
+
tokenError = "UnexpectedEndOfString";
|
|
34824
|
+
return result + text.substring(start, pos);
|
|
34825
|
+
} else pos++;
|
|
34826
|
+
}
|
|
34827
|
+
tokenError = "UnexpectedEndOfString";
|
|
34828
|
+
return result + text.substring(start, pos);
|
|
34829
|
+
};
|
|
34830
|
+
const scanNumber = () => {
|
|
34831
|
+
const start = pos;
|
|
34832
|
+
if (text.charCodeAt(pos) === 45) pos++;
|
|
34833
|
+
if (text.charCodeAt(pos) === 48) pos++;
|
|
34834
|
+
else {
|
|
34835
|
+
if (!isDigit$1(text.charCodeAt(pos))) {
|
|
34836
|
+
tokenError = "UnexpectedEndOfNumber";
|
|
34837
|
+
return text.substring(start, pos);
|
|
34838
|
+
}
|
|
34839
|
+
pos++;
|
|
34840
|
+
while (pos < len && isDigit$1(text.charCodeAt(pos))) pos++;
|
|
34841
|
+
}
|
|
34842
|
+
if (pos < len && text.charCodeAt(pos) === 46) {
|
|
34843
|
+
pos++;
|
|
34844
|
+
if (!isDigit$1(text.charCodeAt(pos))) {
|
|
34845
|
+
tokenError = "UnexpectedEndOfNumber";
|
|
34846
|
+
return text.substring(start, pos);
|
|
34847
|
+
}
|
|
34848
|
+
pos++;
|
|
34849
|
+
while (pos < len && isDigit$1(text.charCodeAt(pos))) pos++;
|
|
34850
|
+
}
|
|
34851
|
+
if (pos < len && (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101)) {
|
|
34852
|
+
pos++;
|
|
34853
|
+
if (pos < len && (text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45)) pos++;
|
|
34854
|
+
if (!isDigit$1(text.charCodeAt(pos))) {
|
|
34855
|
+
tokenError = "UnexpectedEndOfNumber";
|
|
34856
|
+
return text.substring(start, pos);
|
|
34857
|
+
}
|
|
34858
|
+
pos++;
|
|
34859
|
+
while (pos < len && isDigit$1(text.charCodeAt(pos))) pos++;
|
|
34860
|
+
}
|
|
34861
|
+
return text.substring(start, pos);
|
|
34862
|
+
};
|
|
34863
|
+
const scan = () => {
|
|
34864
|
+
tokenValue = "";
|
|
34865
|
+
tokenError = "None";
|
|
34866
|
+
if (pos >= len) {
|
|
34867
|
+
tokenOffset = len;
|
|
34868
|
+
tokenStartLine = lineNumber;
|
|
34869
|
+
tokenStartCharacter = pos - lineStartOffset;
|
|
34870
|
+
token = "EOF";
|
|
34871
|
+
return token;
|
|
34872
|
+
}
|
|
34873
|
+
let ch = text.charCodeAt(pos);
|
|
34874
|
+
if (isWhitespace(ch)) {
|
|
34875
|
+
tokenOffset = pos;
|
|
34876
|
+
tokenStartLine = lineNumber;
|
|
34877
|
+
tokenStartCharacter = pos - lineStartOffset;
|
|
34878
|
+
do {
|
|
34879
|
+
pos++;
|
|
34880
|
+
ch = pos < len ? text.charCodeAt(pos) : 0;
|
|
34881
|
+
} while (isWhitespace(ch));
|
|
34882
|
+
tokenValue = text.substring(tokenOffset, pos);
|
|
34883
|
+
if (ignoreTrivia) return scan();
|
|
34884
|
+
token = "Trivia";
|
|
34885
|
+
return token;
|
|
34886
|
+
}
|
|
34887
|
+
if (isLineBreak$1(ch)) {
|
|
34888
|
+
tokenOffset = pos;
|
|
34889
|
+
tokenStartLine = lineNumber;
|
|
34890
|
+
tokenStartCharacter = pos - lineStartOffset;
|
|
34891
|
+
pos++;
|
|
34892
|
+
if (ch === 13 && pos < len && text.charCodeAt(pos) === 10) pos++;
|
|
34893
|
+
lineNumber++;
|
|
34894
|
+
lineStartOffset = pos;
|
|
34895
|
+
tokenValue = text.substring(tokenOffset, pos);
|
|
34896
|
+
if (ignoreTrivia) return scan();
|
|
34897
|
+
token = "LineBreak";
|
|
34898
|
+
return token;
|
|
34899
|
+
}
|
|
34900
|
+
tokenOffset = pos;
|
|
34901
|
+
tokenStartLine = lineNumber;
|
|
34902
|
+
tokenStartCharacter = pos - lineStartOffset;
|
|
34903
|
+
switch (ch) {
|
|
34904
|
+
case 123:
|
|
34905
|
+
pos++;
|
|
34906
|
+
tokenValue = "{";
|
|
34907
|
+
token = "OpenBrace";
|
|
34908
|
+
return token;
|
|
34909
|
+
case 125:
|
|
34910
|
+
pos++;
|
|
34911
|
+
tokenValue = "}";
|
|
34912
|
+
token = "CloseBrace";
|
|
34913
|
+
return token;
|
|
34914
|
+
case 91:
|
|
34915
|
+
pos++;
|
|
34916
|
+
tokenValue = "[";
|
|
34917
|
+
token = "OpenBracket";
|
|
34918
|
+
return token;
|
|
34919
|
+
case 93:
|
|
34920
|
+
pos++;
|
|
34921
|
+
tokenValue = "]";
|
|
34922
|
+
token = "CloseBracket";
|
|
34923
|
+
return token;
|
|
34924
|
+
case 58:
|
|
34925
|
+
pos++;
|
|
34926
|
+
tokenValue = ":";
|
|
34927
|
+
token = "Colon";
|
|
34928
|
+
return token;
|
|
34929
|
+
case 44:
|
|
34930
|
+
pos++;
|
|
34931
|
+
tokenValue = ",";
|
|
34932
|
+
token = "Comma";
|
|
34933
|
+
return token;
|
|
34934
|
+
case 34:
|
|
34935
|
+
tokenValue = scanString();
|
|
34936
|
+
token = "String";
|
|
34937
|
+
return token;
|
|
34938
|
+
case 47: {
|
|
34939
|
+
const nextCh = pos + 1 < len ? text.charCodeAt(pos + 1) : 0;
|
|
34940
|
+
if (nextCh === 47) {
|
|
34941
|
+
pos += 2;
|
|
34942
|
+
while (pos < len && !isLineBreak$1(text.charCodeAt(pos))) pos++;
|
|
34943
|
+
tokenValue = text.substring(tokenOffset, pos);
|
|
34944
|
+
if (ignoreTrivia) return scan();
|
|
34945
|
+
token = "LineComment";
|
|
34946
|
+
return token;
|
|
34947
|
+
}
|
|
34948
|
+
if (nextCh === 42) {
|
|
34949
|
+
pos += 2;
|
|
34950
|
+
const safeLen = len - 1;
|
|
34951
|
+
let commentClosed = false;
|
|
34952
|
+
while (pos < safeLen) {
|
|
34953
|
+
const cch = text.charCodeAt(pos);
|
|
34954
|
+
if (isLineBreak$1(cch)) {
|
|
34955
|
+
if (cch === 13 && pos + 1 < len && text.charCodeAt(pos + 1) === 10) pos++;
|
|
34956
|
+
pos++;
|
|
34957
|
+
lineNumber++;
|
|
34958
|
+
lineStartOffset = pos;
|
|
34959
|
+
} else if (cch === 42 && text.charCodeAt(pos + 1) === 47) {
|
|
34960
|
+
pos += 2;
|
|
34961
|
+
commentClosed = true;
|
|
34962
|
+
break;
|
|
34963
|
+
} else pos++;
|
|
34964
|
+
}
|
|
34965
|
+
if (!commentClosed) {
|
|
34966
|
+
pos = len;
|
|
34967
|
+
tokenError = "UnexpectedEndOfComment";
|
|
34968
|
+
}
|
|
34969
|
+
tokenValue = text.substring(tokenOffset, pos);
|
|
34970
|
+
if (ignoreTrivia) return scan();
|
|
34971
|
+
token = "BlockComment";
|
|
34972
|
+
return token;
|
|
34973
|
+
}
|
|
34974
|
+
pos++;
|
|
34975
|
+
tokenValue = text.substring(tokenOffset, pos);
|
|
34976
|
+
token = "Unknown";
|
|
34977
|
+
tokenError = "InvalidCharacter";
|
|
34978
|
+
return token;
|
|
34979
|
+
}
|
|
34980
|
+
case 45:
|
|
34981
|
+
if (pos + 1 < len && isDigit$1(text.charCodeAt(pos + 1))) {
|
|
34982
|
+
tokenValue = scanNumber();
|
|
34983
|
+
token = "Number";
|
|
34984
|
+
return token;
|
|
34985
|
+
}
|
|
34986
|
+
pos++;
|
|
34987
|
+
tokenValue = "-";
|
|
34988
|
+
token = "Unknown";
|
|
34989
|
+
tokenError = "InvalidSymbol";
|
|
34990
|
+
return token;
|
|
34991
|
+
default:
|
|
34992
|
+
if (isDigit$1(ch)) {
|
|
34993
|
+
tokenValue = scanNumber();
|
|
34994
|
+
token = "Number";
|
|
34995
|
+
return token;
|
|
34996
|
+
}
|
|
34997
|
+
if (ch >= 97 && ch <= 122) {
|
|
34998
|
+
const start = pos;
|
|
34999
|
+
pos++;
|
|
35000
|
+
while (pos < len) {
|
|
35001
|
+
const kch = text.charCodeAt(pos);
|
|
35002
|
+
if (kch >= 97 && kch <= 122) pos++;
|
|
35003
|
+
else break;
|
|
35004
|
+
}
|
|
35005
|
+
tokenValue = text.substring(start, pos);
|
|
35006
|
+
switch (tokenValue) {
|
|
35007
|
+
case "true":
|
|
35008
|
+
token = "True";
|
|
35009
|
+
return token;
|
|
35010
|
+
case "false":
|
|
35011
|
+
token = "False";
|
|
35012
|
+
return token;
|
|
35013
|
+
case "null":
|
|
35014
|
+
token = "Null";
|
|
35015
|
+
return token;
|
|
35016
|
+
default:
|
|
35017
|
+
token = "Unknown";
|
|
35018
|
+
tokenError = "InvalidSymbol";
|
|
35019
|
+
return token;
|
|
35020
|
+
}
|
|
35021
|
+
}
|
|
35022
|
+
pos++;
|
|
35023
|
+
tokenValue = text.substring(tokenOffset, pos);
|
|
35024
|
+
token = "Unknown";
|
|
35025
|
+
tokenError = "InvalidCharacter";
|
|
35026
|
+
return token;
|
|
35027
|
+
}
|
|
35028
|
+
};
|
|
35029
|
+
return {
|
|
35030
|
+
scan,
|
|
35031
|
+
getToken: () => token,
|
|
35032
|
+
getTokenValue: () => tokenValue,
|
|
35033
|
+
getTokenOffset: () => tokenOffset,
|
|
35034
|
+
getTokenLength: () => pos - tokenOffset,
|
|
35035
|
+
getTokenStartLine: () => tokenStartLine,
|
|
35036
|
+
getTokenStartCharacter: () => tokenStartCharacter,
|
|
35037
|
+
getTokenError: () => tokenError,
|
|
35038
|
+
getPosition: () => pos,
|
|
35039
|
+
setPosition: (newPos) => {
|
|
35040
|
+
pos = newPos;
|
|
35041
|
+
tokenValue = "";
|
|
35042
|
+
token = "Unknown";
|
|
35043
|
+
tokenError = "None";
|
|
35044
|
+
}
|
|
35045
|
+
};
|
|
35046
|
+
};
|
|
35047
|
+
|
|
35048
|
+
//#endregion
|
|
35049
|
+
//#region ../../node_modules/.pnpm/jsonc-effect@0.3.1_effect@3.21.4/node_modules/jsonc-effect/parse.js
|
|
35050
|
+
/**
|
|
35051
|
+
* JSONC Parser — converts token stream into JavaScript values or AST nodes.
|
|
35052
|
+
*
|
|
35053
|
+
* Pure Effect implementation using recursive descent parsing.
|
|
35054
|
+
* Reference: Microsoft's jsonc-parser parser design (MIT).
|
|
35055
|
+
*
|
|
35056
|
+
* @packageDocumentation
|
|
35057
|
+
*/
|
|
35058
|
+
/**
|
|
35059
|
+
* Parse a JSONC string into a JavaScript value.
|
|
35060
|
+
*
|
|
35061
|
+
* @param text - JSONC string to parse
|
|
35062
|
+
* @param options - Optional {@link JsoncParseOptions} controlling comment and
|
|
35063
|
+
* trailing-comma handling.
|
|
35064
|
+
* @returns `Effect<unknown, JsoncParseError>` — succeeds with the parsed value
|
|
35065
|
+
* or fails with a {@link JsoncParseError} containing every error encountered.
|
|
35066
|
+
*
|
|
35067
|
+
* @remarks
|
|
35068
|
+
* The return type is `unknown` (not `any`) so consumers are forced to narrow
|
|
35069
|
+
* the result, which is safer in Effect pipelines. By default
|
|
35070
|
+
* `allowTrailingComma` is `true`, matching common JSONC conventions used in
|
|
35071
|
+
* VS Code settings and `tsconfig.json`.
|
|
35072
|
+
*
|
|
35073
|
+
* @see {@link parseTree} — parse into an AST instead of a plain value
|
|
35074
|
+
* @see {@link JsoncParseOptions} — available parse options
|
|
35075
|
+
* @see {@link JsoncParseError} — the tagged error type on the failure channel
|
|
35076
|
+
*
|
|
35077
|
+
* @example
|
|
35078
|
+
* Basic parsing:
|
|
35079
|
+
* ```ts
|
|
35080
|
+
* import { Effect } from "effect";
|
|
35081
|
+
* import { parse } from "jsonc-effect";
|
|
35082
|
+
*
|
|
35083
|
+
* const value = Effect.runSync(parse('{ "key": 42 }'));
|
|
35084
|
+
* console.log(value); // { key: 42 }
|
|
35085
|
+
* ```
|
|
35086
|
+
*
|
|
35087
|
+
* @example
|
|
35088
|
+
* Parsing with options:
|
|
35089
|
+
* ```ts
|
|
35090
|
+
* import { Effect } from "effect";
|
|
35091
|
+
* import { parse } from "jsonc-effect";
|
|
35092
|
+
*
|
|
35093
|
+
* const value = Effect.runSync(
|
|
35094
|
+
* parse('{ "key": 42 }', { disallowComments: true }),
|
|
35095
|
+
* );
|
|
35096
|
+
* ```
|
|
35097
|
+
*
|
|
35098
|
+
* @example
|
|
35099
|
+
* Error handling with `catchTag`:
|
|
35100
|
+
* ```ts
|
|
35101
|
+
* import { Effect } from "effect";
|
|
35102
|
+
* import { parse } from "jsonc-effect";
|
|
35103
|
+
*
|
|
35104
|
+
* const program = parse("{ bad }").pipe(
|
|
35105
|
+
* Effect.catchTag("JsoncParseError", (err) =>
|
|
35106
|
+
* Effect.succeed({ fallback: true, errors: err.errors }),
|
|
35107
|
+
* ),
|
|
35108
|
+
* );
|
|
35109
|
+
*
|
|
35110
|
+
* const result = Effect.runSync(program);
|
|
35111
|
+
* console.log(result);
|
|
35112
|
+
* ```
|
|
35113
|
+
*
|
|
35114
|
+
* @example
|
|
35115
|
+
* Using `Effect.gen`:
|
|
35116
|
+
* ```ts
|
|
35117
|
+
* import { Effect } from "effect";
|
|
35118
|
+
* import { parse } from "jsonc-effect";
|
|
35119
|
+
*
|
|
35120
|
+
* const program = Effect.gen(function* () {
|
|
35121
|
+
* const config = yield* parse('{ "port": 3000 }');
|
|
35122
|
+
* return config;
|
|
35123
|
+
* });
|
|
35124
|
+
*
|
|
35125
|
+
* const result = Effect.runSync(program);
|
|
35126
|
+
* console.log(result); // { port: 3000 }
|
|
35127
|
+
* ```
|
|
35128
|
+
*
|
|
35129
|
+
* @privateRemarks
|
|
35130
|
+
* Uses {@link createScanner} internally with a recursive descent parser.
|
|
35131
|
+
* The scanner is created with `ignoreTrivia = false` so the parser can
|
|
35132
|
+
* report comment-related errors when `disallowComments` is set.
|
|
35133
|
+
*
|
|
35134
|
+
* @public
|
|
35135
|
+
*/
|
|
35136
|
+
const parse$2 = (text, options) => sync$2(() => parseInternal(text, options ?? {}, false)).pipe(flatMap$2(({ value, errors }) => {
|
|
35137
|
+
if (errors.length > 0) return fail$2(new JsoncParseError({
|
|
35138
|
+
errors,
|
|
35139
|
+
text,
|
|
35140
|
+
...options !== void 0 ? { options } : {}
|
|
35141
|
+
}));
|
|
35142
|
+
return succeed$3(value);
|
|
35143
|
+
}));
|
|
35144
|
+
function parseInternal(text, options, buildTree) {
|
|
35145
|
+
const scanner = createScanner$1(text, false);
|
|
35146
|
+
const errors = [];
|
|
35147
|
+
const disallowComments = options.disallowComments ?? false;
|
|
35148
|
+
const allowTrailingComma = options.allowTrailingComma ?? true;
|
|
35149
|
+
const allowEmptyContent = options.allowEmptyContent ?? false;
|
|
35150
|
+
let currentToken = "Unknown";
|
|
35151
|
+
function token() {
|
|
35152
|
+
return currentToken;
|
|
35153
|
+
}
|
|
35154
|
+
function scanNext() {
|
|
35155
|
+
for (;;) {
|
|
35156
|
+
currentToken = scanner.scan();
|
|
35157
|
+
switch (scanner.getTokenError()) {
|
|
35158
|
+
case "InvalidUnicode":
|
|
35159
|
+
handleError("InvalidUnicode");
|
|
35160
|
+
break;
|
|
35161
|
+
case "InvalidEscapeCharacter":
|
|
35162
|
+
handleError("InvalidEscapeCharacter");
|
|
35163
|
+
break;
|
|
35164
|
+
case "UnexpectedEndOfNumber":
|
|
35165
|
+
handleError("InvalidNumberFormat");
|
|
35166
|
+
break;
|
|
35167
|
+
case "UnexpectedEndOfComment":
|
|
35168
|
+
handleError("UnexpectedEndOfComment");
|
|
35169
|
+
break;
|
|
35170
|
+
case "UnexpectedEndOfString":
|
|
35171
|
+
handleError("UnexpectedEndOfString");
|
|
35172
|
+
break;
|
|
35173
|
+
case "InvalidCharacter":
|
|
35174
|
+
handleError("InvalidCharacter");
|
|
35175
|
+
break;
|
|
35176
|
+
}
|
|
35177
|
+
switch (currentToken) {
|
|
35178
|
+
case "LineComment":
|
|
35179
|
+
case "BlockComment":
|
|
35180
|
+
if (disallowComments) handleError("InvalidCommentToken");
|
|
35181
|
+
break;
|
|
35182
|
+
case "Trivia":
|
|
35183
|
+
case "LineBreak": break;
|
|
35184
|
+
default: return currentToken;
|
|
35185
|
+
}
|
|
35186
|
+
}
|
|
35187
|
+
}
|
|
35188
|
+
function tokenEnd() {
|
|
35189
|
+
return scanner.getTokenOffset() + scanner.getTokenLength();
|
|
35190
|
+
}
|
|
35191
|
+
function handleError(code, skipUntilAfter = [], skipUntil = []) {
|
|
35192
|
+
errors.push(new JsoncParseErrorDetail({
|
|
35193
|
+
code,
|
|
35194
|
+
message: formatError(code, scanner.getTokenOffset()),
|
|
35195
|
+
offset: scanner.getTokenOffset(),
|
|
35196
|
+
length: scanner.getTokenLength(),
|
|
35197
|
+
startLine: scanner.getTokenStartLine(),
|
|
35198
|
+
startCharacter: scanner.getTokenStartCharacter()
|
|
35199
|
+
}));
|
|
35200
|
+
if (skipUntilAfter.length > 0 || skipUntil.length > 0) {
|
|
35201
|
+
let t = token();
|
|
35202
|
+
while (t !== "EOF") {
|
|
35203
|
+
if (skipUntilAfter.includes(t)) {
|
|
35204
|
+
scanNext();
|
|
35205
|
+
break;
|
|
35206
|
+
}
|
|
35207
|
+
if (skipUntil.includes(t)) break;
|
|
35208
|
+
t = scanNext();
|
|
35209
|
+
}
|
|
35210
|
+
}
|
|
35211
|
+
}
|
|
35212
|
+
function parseValue() {
|
|
35213
|
+
switch (token()) {
|
|
35214
|
+
case "OpenBracket": return parseArray();
|
|
35215
|
+
case "OpenBrace": return parseObject();
|
|
35216
|
+
case "String": return parseString();
|
|
35217
|
+
case "Number": return parseNumber();
|
|
35218
|
+
case "True":
|
|
35219
|
+
scanNext();
|
|
35220
|
+
return true;
|
|
35221
|
+
case "False":
|
|
35222
|
+
scanNext();
|
|
35223
|
+
return false;
|
|
35224
|
+
case "Null":
|
|
35225
|
+
scanNext();
|
|
35226
|
+
return null;
|
|
35227
|
+
default: return;
|
|
35228
|
+
}
|
|
35229
|
+
}
|
|
35230
|
+
function parseString() {
|
|
35231
|
+
const value = scanner.getTokenValue();
|
|
35232
|
+
scanNext();
|
|
35233
|
+
return value;
|
|
35234
|
+
}
|
|
35235
|
+
function parseNumber() {
|
|
35236
|
+
const value = Number.parseFloat(scanner.getTokenValue());
|
|
35237
|
+
scanNext();
|
|
35238
|
+
return value;
|
|
35239
|
+
}
|
|
35240
|
+
function parseArray() {
|
|
35241
|
+
scanNext();
|
|
35242
|
+
const arr = [];
|
|
35243
|
+
let needsComma = false;
|
|
35244
|
+
while (token() !== "CloseBracket" && token() !== "EOF") {
|
|
35245
|
+
if (token() === "Comma") {
|
|
35246
|
+
if (!needsComma) handleError("ValueExpected");
|
|
35247
|
+
scanNext();
|
|
35248
|
+
if (token() === "CloseBracket" && allowTrailingComma) break;
|
|
35249
|
+
} else if (needsComma) handleError("CommaExpected");
|
|
35250
|
+
const value = parseValue();
|
|
35251
|
+
if (value === void 0) handleError("ValueExpected", [], ["CloseBracket", "Comma"]);
|
|
35252
|
+
else arr.push(value);
|
|
35253
|
+
needsComma = true;
|
|
35254
|
+
}
|
|
35255
|
+
if (token() !== "CloseBracket") handleError("CloseBracketExpected");
|
|
35256
|
+
else scanNext();
|
|
35257
|
+
return arr;
|
|
35258
|
+
}
|
|
35259
|
+
function parseObject() {
|
|
35260
|
+
scanNext();
|
|
35261
|
+
const obj = {};
|
|
35262
|
+
let needsComma = false;
|
|
35263
|
+
while (token() !== "CloseBrace" && token() !== "EOF") {
|
|
35264
|
+
if (token() === "Comma") {
|
|
35265
|
+
if (!needsComma) handleError("PropertyNameExpected");
|
|
35266
|
+
scanNext();
|
|
35267
|
+
if (token() === "CloseBrace" && allowTrailingComma) break;
|
|
35268
|
+
} else if (needsComma) handleError("CommaExpected");
|
|
35269
|
+
if (token() !== "String") {
|
|
35270
|
+
handleError("PropertyNameExpected", [], ["CloseBrace", "Comma"]);
|
|
35271
|
+
continue;
|
|
35272
|
+
}
|
|
35273
|
+
const key = scanner.getTokenValue();
|
|
35274
|
+
scanNext();
|
|
35275
|
+
if (token() !== "Colon") {
|
|
35276
|
+
handleError("ColonExpected", [], ["CloseBrace", "Comma"]);
|
|
35277
|
+
continue;
|
|
35278
|
+
}
|
|
35279
|
+
scanNext();
|
|
35280
|
+
const value = parseValue();
|
|
35281
|
+
if (value === void 0) handleError("ValueExpected", [], ["CloseBrace", "Comma"]);
|
|
35282
|
+
else obj[key] = value;
|
|
35283
|
+
needsComma = true;
|
|
35284
|
+
}
|
|
35285
|
+
if (token() !== "CloseBrace") handleError("CloseBraceExpected");
|
|
35286
|
+
else scanNext();
|
|
35287
|
+
return obj;
|
|
35288
|
+
}
|
|
35289
|
+
function parseValueTree() {
|
|
35290
|
+
switch (token()) {
|
|
35291
|
+
case "OpenBracket": return parseArrayTree();
|
|
35292
|
+
case "OpenBrace": return parseObjectTree();
|
|
35293
|
+
case "String": {
|
|
35294
|
+
const node = {
|
|
35295
|
+
type: "string",
|
|
35296
|
+
offset: scanner.getTokenOffset(),
|
|
35297
|
+
length: 0,
|
|
35298
|
+
value: scanner.getTokenValue()
|
|
35299
|
+
};
|
|
35300
|
+
const end = tokenEnd();
|
|
35301
|
+
scanNext();
|
|
35302
|
+
node.length = end - node.offset;
|
|
35303
|
+
return node;
|
|
35304
|
+
}
|
|
35305
|
+
case "Number": {
|
|
35306
|
+
const node = {
|
|
35307
|
+
type: "number",
|
|
35308
|
+
offset: scanner.getTokenOffset(),
|
|
35309
|
+
length: 0,
|
|
35310
|
+
value: Number.parseFloat(scanner.getTokenValue())
|
|
35311
|
+
};
|
|
35312
|
+
const end = tokenEnd();
|
|
35313
|
+
scanNext();
|
|
35314
|
+
node.length = end - node.offset;
|
|
35315
|
+
return node;
|
|
35316
|
+
}
|
|
35317
|
+
case "True": {
|
|
35318
|
+
const node = {
|
|
35319
|
+
type: "boolean",
|
|
35320
|
+
offset: scanner.getTokenOffset(),
|
|
35321
|
+
length: 0,
|
|
35322
|
+
value: true
|
|
35323
|
+
};
|
|
35324
|
+
const end = tokenEnd();
|
|
35325
|
+
scanNext();
|
|
35326
|
+
node.length = end - node.offset;
|
|
35327
|
+
return node;
|
|
35328
|
+
}
|
|
35329
|
+
case "False": {
|
|
35330
|
+
const node = {
|
|
35331
|
+
type: "boolean",
|
|
35332
|
+
offset: scanner.getTokenOffset(),
|
|
35333
|
+
length: 0,
|
|
35334
|
+
value: false
|
|
35335
|
+
};
|
|
35336
|
+
const end = tokenEnd();
|
|
35337
|
+
scanNext();
|
|
35338
|
+
node.length = end - node.offset;
|
|
35339
|
+
return node;
|
|
35340
|
+
}
|
|
35341
|
+
case "Null": {
|
|
35342
|
+
const node = {
|
|
35343
|
+
type: "null",
|
|
35344
|
+
offset: scanner.getTokenOffset(),
|
|
35345
|
+
length: 0,
|
|
35346
|
+
value: null
|
|
35347
|
+
};
|
|
35348
|
+
const end = tokenEnd();
|
|
35349
|
+
scanNext();
|
|
35350
|
+
node.length = end - node.offset;
|
|
35351
|
+
return node;
|
|
35352
|
+
}
|
|
35353
|
+
default: return;
|
|
35354
|
+
}
|
|
35355
|
+
}
|
|
35356
|
+
function parseArrayTree() {
|
|
35357
|
+
const node = {
|
|
35358
|
+
type: "array",
|
|
35359
|
+
offset: scanner.getTokenOffset(),
|
|
35360
|
+
length: 0,
|
|
35361
|
+
children: []
|
|
35362
|
+
};
|
|
35363
|
+
scanNext();
|
|
35364
|
+
let needsComma = false;
|
|
35365
|
+
while (token() !== "CloseBracket" && token() !== "EOF") {
|
|
35366
|
+
if (token() === "Comma") {
|
|
35367
|
+
if (!needsComma) handleError("ValueExpected");
|
|
35368
|
+
scanNext();
|
|
35369
|
+
if (token() === "CloseBracket" && allowTrailingComma) break;
|
|
35370
|
+
} else if (needsComma) handleError("CommaExpected");
|
|
35371
|
+
const child = parseValueTree();
|
|
35372
|
+
if (child) node.children.push(child);
|
|
35373
|
+
else handleError("ValueExpected", [], ["CloseBracket", "Comma"]);
|
|
35374
|
+
needsComma = true;
|
|
35375
|
+
}
|
|
35376
|
+
let end;
|
|
35377
|
+
if (token() !== "CloseBracket") {
|
|
35378
|
+
handleError("CloseBracketExpected");
|
|
35379
|
+
end = scanner.getTokenOffset();
|
|
35380
|
+
} else {
|
|
35381
|
+
end = tokenEnd();
|
|
35382
|
+
scanNext();
|
|
35383
|
+
}
|
|
35384
|
+
node.length = end - node.offset;
|
|
35385
|
+
return node;
|
|
35386
|
+
}
|
|
35387
|
+
function parseObjectTree() {
|
|
35388
|
+
const node = {
|
|
35389
|
+
type: "object",
|
|
35390
|
+
offset: scanner.getTokenOffset(),
|
|
35391
|
+
length: 0,
|
|
35392
|
+
children: []
|
|
35393
|
+
};
|
|
35394
|
+
scanNext();
|
|
35395
|
+
let needsComma = false;
|
|
35396
|
+
while (token() !== "CloseBrace" && token() !== "EOF") {
|
|
35397
|
+
if (token() === "Comma") {
|
|
35398
|
+
if (!needsComma) handleError("PropertyNameExpected");
|
|
35399
|
+
scanNext();
|
|
35400
|
+
if (token() === "CloseBrace" && allowTrailingComma) break;
|
|
35401
|
+
} else if (needsComma) handleError("CommaExpected");
|
|
35402
|
+
if (token() !== "String") {
|
|
35403
|
+
handleError("PropertyNameExpected", [], ["CloseBrace", "Comma"]);
|
|
35404
|
+
continue;
|
|
35405
|
+
}
|
|
35406
|
+
const property = {
|
|
35407
|
+
type: "property",
|
|
35408
|
+
offset: scanner.getTokenOffset(),
|
|
35409
|
+
length: 0,
|
|
35410
|
+
children: []
|
|
35411
|
+
};
|
|
35412
|
+
const keyNode = {
|
|
35413
|
+
type: "string",
|
|
35414
|
+
offset: scanner.getTokenOffset(),
|
|
35415
|
+
length: 0,
|
|
35416
|
+
value: scanner.getTokenValue()
|
|
35417
|
+
};
|
|
35418
|
+
const keyEnd = tokenEnd();
|
|
35419
|
+
scanNext();
|
|
35420
|
+
keyNode.length = keyEnd - keyNode.offset;
|
|
35421
|
+
property.children.push(keyNode);
|
|
35422
|
+
if (token() !== "Colon") {
|
|
35423
|
+
handleError("ColonExpected", [], ["CloseBrace", "Comma"]);
|
|
35424
|
+
property.length = scanner.getTokenOffset() - property.offset;
|
|
35425
|
+
node.children.push(property);
|
|
35426
|
+
continue;
|
|
35427
|
+
}
|
|
35428
|
+
property.colonOffset = scanner.getTokenOffset();
|
|
35429
|
+
scanNext();
|
|
35430
|
+
const valueNode = parseValueTree();
|
|
35431
|
+
if (valueNode) {
|
|
35432
|
+
property.children.push(valueNode);
|
|
35433
|
+
property.length = valueNode.offset + valueNode.length - property.offset;
|
|
35434
|
+
} else {
|
|
35435
|
+
handleError("ValueExpected", [], ["CloseBrace", "Comma"]);
|
|
35436
|
+
property.length = scanner.getTokenOffset() - property.offset;
|
|
35437
|
+
}
|
|
35438
|
+
node.children.push(property);
|
|
35439
|
+
needsComma = true;
|
|
35440
|
+
}
|
|
35441
|
+
let end;
|
|
35442
|
+
if (token() !== "CloseBrace") {
|
|
35443
|
+
handleError("CloseBraceExpected");
|
|
35444
|
+
end = scanner.getTokenOffset();
|
|
35445
|
+
} else {
|
|
35446
|
+
end = tokenEnd();
|
|
35447
|
+
scanNext();
|
|
35448
|
+
}
|
|
35449
|
+
node.length = end - node.offset;
|
|
35450
|
+
return node;
|
|
35451
|
+
}
|
|
35452
|
+
scanNext();
|
|
35453
|
+
if (buildTree) {
|
|
35454
|
+
const root = parseValueTree();
|
|
35455
|
+
if (token() !== "EOF") handleError("EndOfFileExpected");
|
|
35456
|
+
if (!root && !allowEmptyContent) handleError("ValueExpected");
|
|
35457
|
+
return {
|
|
35458
|
+
value: void 0,
|
|
35459
|
+
root,
|
|
35460
|
+
errors
|
|
35461
|
+
};
|
|
35462
|
+
}
|
|
35463
|
+
const value = parseValue();
|
|
35464
|
+
if (token() !== "EOF") handleError("EndOfFileExpected");
|
|
35465
|
+
if (value === void 0 && !allowEmptyContent) handleError("ValueExpected");
|
|
35466
|
+
return {
|
|
35467
|
+
value,
|
|
35468
|
+
root: void 0,
|
|
35469
|
+
errors
|
|
35470
|
+
};
|
|
35471
|
+
}
|
|
35472
|
+
function formatError(code, offset) {
|
|
35473
|
+
switch (code) {
|
|
35474
|
+
case "InvalidSymbol": return `Invalid symbol at offset ${offset}`;
|
|
35475
|
+
case "InvalidNumberFormat": return `Invalid number format at offset ${offset}`;
|
|
35476
|
+
case "PropertyNameExpected": return `Property name expected at offset ${offset}`;
|
|
35477
|
+
case "ValueExpected": return `Value expected at offset ${offset}`;
|
|
35478
|
+
case "ColonExpected": return `Colon expected at offset ${offset}`;
|
|
35479
|
+
case "CommaExpected": return `Comma expected at offset ${offset}`;
|
|
35480
|
+
case "CloseBraceExpected": return `Close brace expected at offset ${offset}`;
|
|
35481
|
+
case "CloseBracketExpected": return `Close bracket expected at offset ${offset}`;
|
|
35482
|
+
case "EndOfFileExpected": return `End of file expected at offset ${offset}`;
|
|
35483
|
+
case "InvalidCommentToken": return `Comments not allowed at offset ${offset}`;
|
|
35484
|
+
case "UnexpectedEndOfComment": return `Unexpected end of comment at offset ${offset}`;
|
|
35485
|
+
case "UnexpectedEndOfString": return `Unexpected end of string at offset ${offset}`;
|
|
35486
|
+
case "UnexpectedEndOfNumber": return `Unexpected end of number at offset ${offset}`;
|
|
35487
|
+
case "InvalidUnicode": return `Invalid unicode escape at offset ${offset}`;
|
|
35488
|
+
case "InvalidEscapeCharacter": return `Invalid escape character at offset ${offset}`;
|
|
35489
|
+
case "InvalidCharacter": return `Invalid character at offset ${offset}`;
|
|
35490
|
+
default: return `Parse error at offset ${offset}`;
|
|
35491
|
+
}
|
|
35492
|
+
}
|
|
35493
|
+
|
|
35494
|
+
//#endregion
|
|
35495
|
+
//#region ../../node_modules/.pnpm/jsonc-effect@0.3.1_effect@3.21.4/node_modules/jsonc-effect/format.js
|
|
35496
|
+
/**
|
|
35497
|
+
* Apply an array of text edits to JSONC source text.
|
|
35498
|
+
*
|
|
35499
|
+
* This is a {@link https://effect.website/docs/function-dual | Function.dual}
|
|
35500
|
+
* that supports both data-first and data-last (pipeline) usage.
|
|
35501
|
+
*
|
|
35502
|
+
* @param text - The original JSONC source text.
|
|
35503
|
+
* @param edits - A read-only array of {@link JsoncEdit} objects, typically
|
|
35504
|
+
* produced by {@link format} or {@link modify}.
|
|
35505
|
+
* @returns An `Effect` that succeeds with the edited string.
|
|
35506
|
+
*
|
|
35507
|
+
* @remarks
|
|
35508
|
+
* Edits are sorted in reverse offset order before application so that
|
|
35509
|
+
* earlier edits do not shift the offsets of later ones. The original `edits`
|
|
35510
|
+
* array is not mutated.
|
|
35511
|
+
*
|
|
35512
|
+
* @see {@link format} to compute formatting edits.
|
|
35513
|
+
* @see {@link modify} to compute structural edits (insert, replace, remove).
|
|
35514
|
+
*
|
|
35515
|
+
* @example Data-first usage
|
|
35516
|
+
* ```ts
|
|
35517
|
+
* import { Effect } from "effect";
|
|
35518
|
+
* import { format, applyEdits } from "jsonc-effect";
|
|
35519
|
+
*
|
|
35520
|
+
* const input = '{"a":1}';
|
|
35521
|
+
* const edits = Effect.runSync(format(input));
|
|
35522
|
+
* const result: string = Effect.runSync(applyEdits(input, edits));
|
|
35523
|
+
* ```
|
|
35524
|
+
*
|
|
35525
|
+
* @example Pipeline with modify
|
|
35526
|
+
* ```ts
|
|
35527
|
+
* import { Effect, pipe } from "effect";
|
|
35528
|
+
* import { modify, applyEdits } from "jsonc-effect";
|
|
35529
|
+
*
|
|
35530
|
+
* const input = '{ "a": 1 }';
|
|
35531
|
+
* const result = pipe(
|
|
35532
|
+
* input,
|
|
35533
|
+
* modify(["a"], 42),
|
|
35534
|
+
* Effect.flatMap((edits) => applyEdits(input, edits)),
|
|
35535
|
+
* Effect.runSync,
|
|
35536
|
+
* );
|
|
35537
|
+
* ```
|
|
35538
|
+
*
|
|
35539
|
+
* @public
|
|
35540
|
+
*/
|
|
35541
|
+
const applyEdits$1 = dual(2, (text, edits) => sync$2(() => {
|
|
35542
|
+
const sorted = [...edits].sort((a, b) => b.offset - a.offset);
|
|
35543
|
+
let result = text;
|
|
35544
|
+
for (const edit of sorted) result = result.substring(0, edit.offset) + edit.content + result.substring(edit.offset + edit.length);
|
|
35545
|
+
return result;
|
|
35546
|
+
}));
|
|
35547
|
+
/**
|
|
35548
|
+
* Compute edits to insert, replace, or remove a value at a JSON path.
|
|
35549
|
+
*
|
|
35550
|
+
* This is a {@link https://effect.website/docs/function-dual | Function.dual}
|
|
35551
|
+
* that supports both data-first and data-last (pipeline) usage.
|
|
35552
|
+
*
|
|
35553
|
+
* @param text - The JSONC source text to modify.
|
|
35554
|
+
* @param path - A {@link (JsoncPath:type)} (array of string keys and numeric indices)
|
|
35555
|
+
* identifying the target location in the JSON structure.
|
|
35556
|
+
* @param value - The value to set. Pass `undefined` to remove the
|
|
35557
|
+
* property or array element at the given path.
|
|
35558
|
+
* @param options - Optional object with `formattingOptions` controlling
|
|
35559
|
+
* indent size, tabs vs. spaces, and EOL style for generated text.
|
|
35560
|
+
* @returns An `Effect` that succeeds with a read-only array of
|
|
35561
|
+
* {@link JsoncEdit} objects, or fails with a
|
|
35562
|
+
* {@link JsoncModificationError} if the path cannot be navigated.
|
|
35563
|
+
*
|
|
35564
|
+
* @remarks
|
|
35565
|
+
* Setting `value` to `undefined` removes the targeted property or element,
|
|
35566
|
+
* including its surrounding comma. When inserting a new property into an
|
|
35567
|
+
* object, it is appended after the last existing property.
|
|
35568
|
+
*
|
|
35569
|
+
* @see {@link applyEdits} to apply the returned edits to the source text.
|
|
35570
|
+
* @see {@link JsoncModificationError} for the error type on navigation failure.
|
|
35571
|
+
*
|
|
35572
|
+
* @example Update an existing property
|
|
35573
|
+
* ```ts
|
|
35574
|
+
* import { Effect } from "effect";
|
|
35575
|
+
* import { modify, applyEdits } from "jsonc-effect";
|
|
35576
|
+
*
|
|
35577
|
+
* const input = '{ "a": 1 }';
|
|
35578
|
+
* const edits = Effect.runSync(modify(input, ["a"], 2));
|
|
35579
|
+
* const result: string = Effect.runSync(applyEdits(input, edits));
|
|
35580
|
+
* ```
|
|
35581
|
+
*
|
|
35582
|
+
* @example Insert a new property
|
|
35583
|
+
* ```ts
|
|
35584
|
+
* import { Effect } from "effect";
|
|
35585
|
+
* import { modify, applyEdits } from "jsonc-effect";
|
|
35586
|
+
*
|
|
35587
|
+
* const input = '{ "a": 1 }';
|
|
35588
|
+
* const edits = Effect.runSync(modify(input, ["b"], "hello"));
|
|
35589
|
+
* const result: string = Effect.runSync(applyEdits(input, edits));
|
|
35590
|
+
* ```
|
|
35591
|
+
*
|
|
35592
|
+
* @example Remove a property
|
|
35593
|
+
* ```ts
|
|
35594
|
+
* import { Effect } from "effect";
|
|
35595
|
+
* import { modify, applyEdits } from "jsonc-effect";
|
|
35596
|
+
*
|
|
35597
|
+
* const input = '{ "a": 1, "b": 2 }';
|
|
35598
|
+
* const edits = Effect.runSync(modify(input, ["a"], undefined));
|
|
35599
|
+
* const result: string = Effect.runSync(applyEdits(input, edits));
|
|
35600
|
+
* ```
|
|
35601
|
+
*
|
|
35602
|
+
* @example Pipeline (data-last) usage
|
|
35603
|
+
* ```ts
|
|
35604
|
+
* import { Effect, pipe } from "effect";
|
|
35605
|
+
* import { modify, applyEdits } from "jsonc-effect";
|
|
35606
|
+
*
|
|
35607
|
+
* const input = '{ "a": 1 }';
|
|
35608
|
+
* const result = pipe(
|
|
35609
|
+
* input,
|
|
35610
|
+
* modify(["a"], 42),
|
|
35611
|
+
* Effect.flatMap((edits) => applyEdits(input, edits)),
|
|
35612
|
+
* Effect.runSync,
|
|
35613
|
+
* );
|
|
35614
|
+
* ```
|
|
35615
|
+
*
|
|
35616
|
+
* @privateRemarks
|
|
35617
|
+
* Uses its own scanner-based navigation to locate the target path rather
|
|
35618
|
+
* than building a full AST via `parseTree`. This keeps the implementation
|
|
35619
|
+
* lightweight and avoids an intermediate allocation.
|
|
35620
|
+
*
|
|
35621
|
+
* @public
|
|
35622
|
+
*/
|
|
35623
|
+
const modify = dual((args) => typeof args[0] === "string" && Array.isArray(args[1]), (text, path, value, options) => try_({
|
|
35624
|
+
try: () => modifyImpl(text, path, value, options?.formattingOptions),
|
|
35625
|
+
catch: (e) => new JsoncModificationError({
|
|
35626
|
+
path,
|
|
35627
|
+
reason: String(e)
|
|
35628
|
+
})
|
|
35629
|
+
}));
|
|
35630
|
+
function modifyImpl(text, path, value, formattingOptions) {
|
|
35631
|
+
const opts = {
|
|
35632
|
+
tabSize: formattingOptions?.tabSize ?? 2,
|
|
35633
|
+
insertSpaces: formattingOptions?.insertSpaces ?? true,
|
|
35634
|
+
eol: formattingOptions?.eol ?? "\n"
|
|
35635
|
+
};
|
|
35636
|
+
const indentUnit = opts.insertSpaces ? " ".repeat(opts.tabSize) : " ";
|
|
35637
|
+
if (path.length === 0) {
|
|
35638
|
+
const content = value === void 0 ? "" : JSON.stringify(value, null, opts.tabSize);
|
|
35639
|
+
return [{
|
|
35640
|
+
offset: 0,
|
|
35641
|
+
length: text.length,
|
|
35642
|
+
content
|
|
35643
|
+
}];
|
|
35644
|
+
}
|
|
35645
|
+
const scanner = createScanner$1(text, true);
|
|
35646
|
+
let currentToken = scanner.scan();
|
|
35647
|
+
function tokenEnd() {
|
|
35648
|
+
return scanner.getTokenOffset() + scanner.getTokenLength();
|
|
35649
|
+
}
|
|
35650
|
+
function skipValue() {
|
|
35651
|
+
switch (currentToken) {
|
|
35652
|
+
case "OpenBrace": {
|
|
35653
|
+
let end = tokenEnd();
|
|
35654
|
+
currentToken = scanner.scan();
|
|
35655
|
+
let first = true;
|
|
35656
|
+
while (currentToken !== "CloseBrace" && currentToken !== "EOF") {
|
|
35657
|
+
if (!first && currentToken === "Comma") currentToken = scanner.scan();
|
|
35658
|
+
if (currentToken === "String") {
|
|
35659
|
+
currentToken = scanner.scan();
|
|
35660
|
+
if (currentToken === "Colon") {
|
|
35661
|
+
currentToken = scanner.scan();
|
|
35662
|
+
end = skipValue();
|
|
35663
|
+
}
|
|
35664
|
+
} else {
|
|
35665
|
+
end = tokenEnd();
|
|
35666
|
+
currentToken = scanner.scan();
|
|
35667
|
+
}
|
|
35668
|
+
first = false;
|
|
35669
|
+
}
|
|
35670
|
+
if (currentToken === "CloseBrace") {
|
|
35671
|
+
end = tokenEnd();
|
|
35672
|
+
currentToken = scanner.scan();
|
|
35673
|
+
}
|
|
35674
|
+
return end;
|
|
35675
|
+
}
|
|
35676
|
+
case "OpenBracket": {
|
|
35677
|
+
let end = tokenEnd();
|
|
35678
|
+
currentToken = scanner.scan();
|
|
35679
|
+
let first = true;
|
|
35680
|
+
while (currentToken !== "CloseBracket" && currentToken !== "EOF") {
|
|
35681
|
+
if (!first && currentToken === "Comma") currentToken = scanner.scan();
|
|
35682
|
+
end = skipValue();
|
|
35683
|
+
first = false;
|
|
35684
|
+
}
|
|
35685
|
+
if (currentToken === "CloseBracket") {
|
|
35686
|
+
end = tokenEnd();
|
|
35687
|
+
currentToken = scanner.scan();
|
|
35688
|
+
}
|
|
35689
|
+
return end;
|
|
35690
|
+
}
|
|
35691
|
+
default: {
|
|
35692
|
+
const end = tokenEnd();
|
|
35693
|
+
currentToken = scanner.scan();
|
|
35694
|
+
return end;
|
|
35695
|
+
}
|
|
35696
|
+
}
|
|
35697
|
+
}
|
|
35698
|
+
let depth = 0;
|
|
35699
|
+
for (const segment of path) {
|
|
35700
|
+
depth++;
|
|
35701
|
+
if (typeof segment === "string") {
|
|
35702
|
+
if (currentToken !== "OpenBrace") throw new Error(`Expected object at depth ${depth}`);
|
|
35703
|
+
currentToken = scanner.scan();
|
|
35704
|
+
let found = false;
|
|
35705
|
+
let lastValueEnd = scanner.getTokenOffset();
|
|
35706
|
+
let isFirst = true;
|
|
35707
|
+
while (currentToken !== "CloseBrace" && currentToken !== "EOF") {
|
|
35708
|
+
if (!isFirst && currentToken === "Comma") currentToken = scanner.scan();
|
|
35709
|
+
if (currentToken === "String") {
|
|
35710
|
+
const key = scanner.getTokenValue();
|
|
35711
|
+
currentToken = scanner.scan();
|
|
35712
|
+
if (currentToken === "Colon") currentToken = scanner.scan();
|
|
35713
|
+
if (key === segment) {
|
|
35714
|
+
found = true;
|
|
35715
|
+
if (depth === path.length) {
|
|
35716
|
+
const valueStart = scanner.getTokenOffset();
|
|
35717
|
+
const prevEnd = valueStart;
|
|
35718
|
+
const valueEnd = skipValue();
|
|
35719
|
+
if (value === void 0) {
|
|
35720
|
+
let removeStart = valueStart;
|
|
35721
|
+
let removeEnd = valueEnd;
|
|
35722
|
+
const keyStart = text.substring(0, valueStart).lastIndexOf(`"${segment}"`);
|
|
35723
|
+
if (keyStart >= 0) removeStart = keyStart;
|
|
35724
|
+
const commaPosBefore = text.substring(0, removeStart).trimEnd().lastIndexOf(",");
|
|
35725
|
+
if (commaPosBefore >= 0) removeStart = commaPosBefore;
|
|
35726
|
+
else {
|
|
35727
|
+
const trimmedAfter = text.substring(removeEnd).match(/^(\s*,)/);
|
|
35728
|
+
if (trimmedAfter) removeEnd += trimmedAfter[1].length;
|
|
35729
|
+
}
|
|
35730
|
+
return [{
|
|
35731
|
+
offset: removeStart,
|
|
35732
|
+
length: removeEnd - removeStart,
|
|
35733
|
+
content: ""
|
|
35734
|
+
}];
|
|
35735
|
+
}
|
|
35736
|
+
const serialized = JSON.stringify(value, null, opts.tabSize);
|
|
35737
|
+
return [{
|
|
35738
|
+
offset: prevEnd,
|
|
35739
|
+
length: valueEnd - prevEnd,
|
|
35740
|
+
content: serialized
|
|
35741
|
+
}];
|
|
35742
|
+
}
|
|
35743
|
+
break;
|
|
35744
|
+
}
|
|
35745
|
+
lastValueEnd = skipValue();
|
|
35746
|
+
} else {
|
|
35747
|
+
currentToken = scanner.scan();
|
|
35748
|
+
lastValueEnd = scanner.getTokenOffset();
|
|
35749
|
+
}
|
|
35750
|
+
isFirst = false;
|
|
35751
|
+
}
|
|
35752
|
+
if (!found && depth === path.length && value !== void 0) {
|
|
35753
|
+
const indent = indentUnit.repeat(depth);
|
|
35754
|
+
const serialized = JSON.stringify(value, null, opts.tabSize);
|
|
35755
|
+
const insertText = isFirst ? `${opts.eol}${indent}"${segment}": ${serialized}${opts.eol}${indentUnit.repeat(depth - 1)}` : `,${opts.eol}${indent}"${segment}": ${serialized}`;
|
|
35756
|
+
return [{
|
|
35757
|
+
offset: lastValueEnd,
|
|
35758
|
+
length: 0,
|
|
35759
|
+
content: insertText
|
|
35760
|
+
}];
|
|
35761
|
+
}
|
|
35762
|
+
} else {
|
|
35763
|
+
if (currentToken !== "OpenBracket") throw new Error(`Expected array at depth ${depth}`);
|
|
35764
|
+
currentToken = scanner.scan();
|
|
35765
|
+
let idx = 0;
|
|
35766
|
+
let lastEnd = scanner.getTokenOffset();
|
|
35767
|
+
while (currentToken !== "CloseBracket" && currentToken !== "EOF") {
|
|
35768
|
+
if (idx > 0 && currentToken === "Comma") currentToken = scanner.scan();
|
|
35769
|
+
if (idx === segment) {
|
|
35770
|
+
if (depth === path.length) {
|
|
35771
|
+
const valueStart = scanner.getTokenOffset();
|
|
35772
|
+
const valueEnd = skipValue();
|
|
35773
|
+
if (value === void 0) {
|
|
35774
|
+
let removeEnd = valueEnd;
|
|
35775
|
+
if (text.substring(removeEnd).trimStart().startsWith(",")) removeEnd = text.indexOf(",", removeEnd) + 1;
|
|
35776
|
+
return [{
|
|
35777
|
+
offset: valueStart,
|
|
35778
|
+
length: removeEnd - valueStart,
|
|
35779
|
+
content: ""
|
|
35780
|
+
}];
|
|
35781
|
+
}
|
|
35782
|
+
const serialized = JSON.stringify(value, null, opts.tabSize);
|
|
35783
|
+
return [{
|
|
35784
|
+
offset: valueStart,
|
|
35785
|
+
length: valueEnd - valueStart,
|
|
35786
|
+
content: serialized
|
|
35787
|
+
}];
|
|
35788
|
+
}
|
|
35789
|
+
break;
|
|
35790
|
+
}
|
|
35791
|
+
lastEnd = skipValue();
|
|
35792
|
+
idx++;
|
|
35793
|
+
}
|
|
35794
|
+
if (idx <= segment && depth === path.length && value !== void 0) {
|
|
35795
|
+
const indent = indentUnit.repeat(depth);
|
|
35796
|
+
const serialized = JSON.stringify(value, null, opts.tabSize);
|
|
35797
|
+
const insertText = idx === 0 ? `${opts.eol}${indent}${serialized}${opts.eol}${indentUnit.repeat(depth - 1)}` : `,${opts.eol}${indent}${serialized}`;
|
|
35798
|
+
return [{
|
|
35799
|
+
offset: lastEnd,
|
|
35800
|
+
length: 0,
|
|
35801
|
+
content: insertText
|
|
35802
|
+
}];
|
|
35803
|
+
}
|
|
35804
|
+
}
|
|
35805
|
+
}
|
|
35806
|
+
return [];
|
|
35807
|
+
}
|
|
35808
|
+
|
|
35809
|
+
//#endregion
|
|
35810
|
+
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/schemas/WorkspaceStateSnapshot.js
|
|
34503
35811
|
const DepRecord = optionalWith(Record({
|
|
34504
35812
|
key: String$,
|
|
34505
35813
|
value: String$
|
|
@@ -34569,7 +35877,7 @@ var WorkspaceStateSnapshot = class extends Class("WorkspaceStateSnapshot")({
|
|
|
34569
35877
|
};
|
|
34570
35878
|
|
|
34571
35879
|
//#endregion
|
|
34572
|
-
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.
|
|
35880
|
+
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/services/PointInTimeWorkspace.js
|
|
34573
35881
|
/**
|
|
34574
35882
|
* Service for reading a monorepo's workspace state at a specific moment: any
|
|
34575
35883
|
* git ref (via `git show`/`git ls-tree`, without checking the ref out) or the
|
|
@@ -34597,7 +35905,7 @@ var WorkspaceStateSnapshot = class extends Class("WorkspaceStateSnapshot")({
|
|
|
34597
35905
|
var PointInTimeWorkspace = class extends Tag("@spencerbeggs/workspaces-effect/PointInTimeWorkspace")() {};
|
|
34598
35906
|
|
|
34599
35907
|
//#endregion
|
|
34600
|
-
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.
|
|
35908
|
+
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/discovery/glob-core.js
|
|
34601
35909
|
const normalize$2 = (pattern) => pattern.replace(/\/\*\*$/, "/*");
|
|
34602
35910
|
const toRegex = (glob) => new RegExp(`^${glob.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]")}$`);
|
|
34603
35911
|
/**
|
|
@@ -34641,7 +35949,7 @@ const compileWorkspaceGlobs = (patterns) => {
|
|
|
34641
35949
|
};
|
|
34642
35950
|
|
|
34643
35951
|
//#endregion
|
|
34644
|
-
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.
|
|
35952
|
+
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/point-in-time/git.js
|
|
34645
35953
|
/**
|
|
34646
35954
|
* Stderr shapes that mean "the path is not present at this ref" rather than
|
|
34647
35955
|
* "the git command failed."
|
|
@@ -34734,7 +36042,7 @@ const makeGitReader = (executor, options) => {
|
|
|
34734
36042
|
};
|
|
34735
36043
|
|
|
34736
36044
|
//#endregion
|
|
34737
|
-
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.
|
|
36045
|
+
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/PointInTimeWorkspaceLive.js
|
|
34738
36046
|
/**
|
|
34739
36047
|
* Live layer for the {@link PointInTimeWorkspace} service.
|
|
34740
36048
|
*
|
|
@@ -34789,7 +36097,7 @@ const packageSnapshotFromJson = (text, relativePath) => {
|
|
|
34789
36097
|
*
|
|
34790
36098
|
* @internal
|
|
34791
36099
|
*/
|
|
34792
|
-
const lockfileCatalogsAtRef = (text) => isNone(text) ? succeed$3(CatalogSet.empty()) : parse$
|
|
36100
|
+
const lockfileCatalogsAtRef = (text) => isNone(text) ? succeed$3(CatalogSet.empty()) : parse$3(text.value).pipe(map$5((parsed) => CatalogSet.fromLockfileCatalogs(parsed?.catalogs)), orElseSucceed(() => CatalogSet.empty()));
|
|
34793
36101
|
/**
|
|
34794
36102
|
* Live layer for the {@link PointInTimeWorkspace} service.
|
|
34795
36103
|
*
|
|
@@ -34876,7 +36184,7 @@ const PointInTimeWorkspaceLive = effect$1(PointInTimeWorkspace, gen(function* ()
|
|
|
34876
36184
|
}));
|
|
34877
36185
|
|
|
34878
36186
|
//#endregion
|
|
34879
|
-
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.
|
|
36187
|
+
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/schemas/publish.js
|
|
34880
36188
|
/**
|
|
34881
36189
|
* Schema for package publish targets.
|
|
34882
36190
|
*
|
|
@@ -34920,7 +36228,7 @@ var PublishTarget = class extends Class("PublishTarget")({
|
|
|
34920
36228
|
}) {};
|
|
34921
36229
|
|
|
34922
36230
|
//#endregion
|
|
34923
|
-
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.
|
|
36231
|
+
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/services/PublishabilityDetector.js
|
|
34924
36232
|
/**
|
|
34925
36233
|
* Service for detecting whether a workspace package is publishable and
|
|
34926
36234
|
* identifying its publish targets (npm, GitHub Packages, etc.).
|
|
@@ -34983,7 +36291,7 @@ var PublishTarget = class extends Class("PublishTarget")({
|
|
|
34983
36291
|
var PublishabilityDetector = class extends Tag("@spencerbeggs/workspaces-effect/PublishabilityDetector")() {};
|
|
34984
36292
|
|
|
34985
36293
|
//#endregion
|
|
34986
|
-
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.
|
|
36294
|
+
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/PublishabilityDetectorLive.js
|
|
34987
36295
|
/**
|
|
34988
36296
|
* Default live implementation of the {@link PublishabilityDetector} service.
|
|
34989
36297
|
*
|
|
@@ -35056,7 +36364,7 @@ const PublishabilityDetectorLive = succeed$2(PublishabilityDetector, { detect: (
|
|
|
35056
36364
|
}).pipe(withSpan("PublishabilityDetector.detect", { attributes: { "workspace.package": pkg.name } })) });
|
|
35057
36365
|
|
|
35058
36366
|
//#endregion
|
|
35059
|
-
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.
|
|
36367
|
+
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/WorkspaceDiscoveryLive.js
|
|
35060
36368
|
/**
|
|
35061
36369
|
* Live implementation of the {@link WorkspaceDiscovery} service.
|
|
35062
36370
|
*
|
|
@@ -35344,7 +36652,7 @@ const WorkspaceDiscoveryLive = effect$1(WorkspaceDiscovery, gen(function* () {
|
|
|
35344
36652
|
}));
|
|
35345
36653
|
|
|
35346
36654
|
//#endregion
|
|
35347
|
-
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.
|
|
36655
|
+
//#region ../../node_modules/.pnpm/workspaces-effect@2.0.2_@effect+platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/WorkspaceRootLive.js
|
|
35348
36656
|
/**
|
|
35349
36657
|
* Live implementation of the {@link WorkspaceRoot} service.
|
|
35350
36658
|
*
|
|
@@ -60367,7 +61675,7 @@ var ChangelogTransformer = class ChangelogTransformer {
|
|
|
60367
61675
|
};
|
|
60368
61676
|
|
|
60369
61677
|
//#endregion
|
|
60370
|
-
//#region ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.
|
|
61678
|
+
//#region ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.5/node_modules/fdir/dist/index.mjs
|
|
60371
61679
|
var __require = /* @__PURE__ */ createRequire$1(import.meta.url);
|
|
60372
61680
|
function cleanPath(path) {
|
|
60373
61681
|
let normalized = normalize(path);
|
|
@@ -60876,7 +62184,7 @@ var Builder = class {
|
|
|
60876
62184
|
};
|
|
60877
62185
|
|
|
60878
62186
|
//#endregion
|
|
60879
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
62187
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/constants.js
|
|
60880
62188
|
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
60881
62189
|
const WIN_SLASH = "\\\\/";
|
|
60882
62190
|
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
@@ -61050,7 +62358,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
61050
62358
|
}));
|
|
61051
62359
|
|
|
61052
62360
|
//#endregion
|
|
61053
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
62361
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/utils.js
|
|
61054
62362
|
var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
61055
62363
|
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
|
|
61056
62364
|
exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
@@ -61099,7 +62407,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
61099
62407
|
}));
|
|
61100
62408
|
|
|
61101
62409
|
//#endregion
|
|
61102
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
62410
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/scan.js
|
|
61103
62411
|
var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
61104
62412
|
const utils = require_utils();
|
|
61105
62413
|
const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants();
|
|
@@ -61387,7 +62695,7 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
61387
62695
|
}));
|
|
61388
62696
|
|
|
61389
62697
|
//#endregion
|
|
61390
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
62698
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/parse.js
|
|
61391
62699
|
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
61392
62700
|
const constants = require_constants();
|
|
61393
62701
|
const utils = require_utils();
|
|
@@ -61542,7 +62850,10 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
61542
62850
|
}
|
|
61543
62851
|
}
|
|
61544
62852
|
};
|
|
61545
|
-
const
|
|
62853
|
+
const buildCharClassStar = (chars) => {
|
|
62854
|
+
return `${chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`}*`;
|
|
62855
|
+
};
|
|
62856
|
+
const getStarExtglobSequenceChars = (pattern) => {
|
|
61546
62857
|
let index = 0;
|
|
61547
62858
|
const chars = [];
|
|
61548
62859
|
while (index < pattern.length) {
|
|
@@ -61556,7 +62867,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
61556
62867
|
index += match.end + 1;
|
|
61557
62868
|
}
|
|
61558
62869
|
if (chars.length < 1) return;
|
|
61559
|
-
return
|
|
62870
|
+
return chars;
|
|
61560
62871
|
};
|
|
61561
62872
|
const repeatedExtglobRecursion = (pattern) => {
|
|
61562
62873
|
let depth = 0;
|
|
@@ -61576,14 +62887,28 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
61576
62887
|
if (branches.length > 1) {
|
|
61577
62888
|
if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) return { risky: true };
|
|
61578
62889
|
}
|
|
62890
|
+
const safeChars = [];
|
|
62891
|
+
let sawStarSequence = false;
|
|
62892
|
+
let combinable = true;
|
|
61579
62893
|
for (const branch of branches) {
|
|
61580
|
-
const
|
|
61581
|
-
if (
|
|
61582
|
-
|
|
61583
|
-
|
|
61584
|
-
|
|
62894
|
+
const chars = getStarExtglobSequenceChars(branch);
|
|
62895
|
+
if (chars) {
|
|
62896
|
+
sawStarSequence = true;
|
|
62897
|
+
safeChars.push(...chars);
|
|
62898
|
+
continue;
|
|
62899
|
+
}
|
|
62900
|
+
const literal = normalizeSimpleBranch(branch);
|
|
62901
|
+
if (literal && literal.length === 1) {
|
|
62902
|
+
safeChars.push(literal);
|
|
62903
|
+
continue;
|
|
62904
|
+
}
|
|
62905
|
+
combinable = false;
|
|
61585
62906
|
if (repeatedExtglobRecursion(branch) > max) return { risky: true };
|
|
61586
62907
|
}
|
|
62908
|
+
if (sawStarSequence) return combinable ? {
|
|
62909
|
+
risky: true,
|
|
62910
|
+
safeOutput: buildCharClassStar([...new Set(safeChars)])
|
|
62911
|
+
} : { risky: true };
|
|
61587
62912
|
return { risky: false };
|
|
61588
62913
|
};
|
|
61589
62914
|
/**
|
|
@@ -62445,7 +63770,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
62445
63770
|
}));
|
|
62446
63771
|
|
|
62447
63772
|
//#endregion
|
|
62448
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
63773
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/picomatch.js
|
|
62449
63774
|
var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
62450
63775
|
const scan = require_scan();
|
|
62451
63776
|
const parse = require_parse();
|
|
@@ -62466,6 +63791,18 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
62466
63791
|
* const isMatch = picomatch('*.!(*a)');
|
|
62467
63792
|
* console.log(isMatch('a.a')); //=> false
|
|
62468
63793
|
* console.log(isMatch('a.b')); //=> true
|
|
63794
|
+
*
|
|
63795
|
+
* // For environments without `node.js`, `picomatch/posix` provides you a dependency-free matcher, without automatic OS detection.
|
|
63796
|
+
* const picomatch = require('picomatch/posix');
|
|
63797
|
+
* // the same API, defaulting to posix paths
|
|
63798
|
+
* const isMatch = picomatch('a/*');
|
|
63799
|
+
* console.log(isMatch('a\\b')); //=> false
|
|
63800
|
+
* console.log(isMatch('a/b')); //=> true
|
|
63801
|
+
*
|
|
63802
|
+
* // you can still configure the matcher function to accept windows paths
|
|
63803
|
+
* const isMatch = picomatch('a/*', { options: windows });
|
|
63804
|
+
* console.log(isMatch('a\\b')); //=> true
|
|
63805
|
+
* console.log(isMatch('a/b')); //=> true
|
|
62469
63806
|
* ```
|
|
62470
63807
|
* @name picomatch
|
|
62471
63808
|
* @param {String|Array} `globs` One or more glob patterns.
|
|
@@ -62584,8 +63921,8 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
62584
63921
|
* @return {Boolean}
|
|
62585
63922
|
* @api public
|
|
62586
63923
|
*/
|
|
62587
|
-
picomatch.matchBase = (input, glob, options) => {
|
|
62588
|
-
return (glob instanceof RegExp ? glob : picomatch.makeRe(glob, options)).test(utils.basename(input));
|
|
63924
|
+
picomatch.matchBase = (input, glob, options, posix = options && options.windows) => {
|
|
63925
|
+
return (glob instanceof RegExp ? glob : picomatch.makeRe(glob, options)).test(utils.basename(input, { windows: posix }));
|
|
62589
63926
|
};
|
|
62590
63927
|
/**
|
|
62591
63928
|
* Returns true if **any** of the given glob `patterns` match the specified `string`.
|
|
@@ -62746,7 +64083,7 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
62746
64083
|
}));
|
|
62747
64084
|
|
|
62748
64085
|
//#endregion
|
|
62749
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
64086
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/index.js
|
|
62750
64087
|
var require_picomatch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
62751
64088
|
const pico = require_picomatch$1();
|
|
62752
64089
|
const utils = require_utils();
|
|
@@ -63748,15 +65085,16 @@ function makeShape$2(inspector) {
|
|
|
63748
65085
|
path,
|
|
63749
65086
|
status: "added"
|
|
63750
65087
|
}));
|
|
65088
|
+
const isOwnChangeset = (path) => path.startsWith(".changeset/") && path.endsWith(".md");
|
|
63751
65089
|
const seen = /* @__PURE__ */ new Set();
|
|
63752
65090
|
const rawEntries = [];
|
|
63753
65091
|
for (const e of diffEntries) {
|
|
63754
|
-
if (seen.has(e.path)) continue;
|
|
65092
|
+
if (seen.has(e.path) || isOwnChangeset(e.path)) continue;
|
|
63755
65093
|
seen.add(e.path);
|
|
63756
65094
|
rawEntries.push(e);
|
|
63757
65095
|
}
|
|
63758
65096
|
for (const e of untrackedEntries) {
|
|
63759
|
-
if (seen.has(e.path)) continue;
|
|
65097
|
+
if (seen.has(e.path) || isOwnChangeset(e.path)) continue;
|
|
63760
65098
|
seen.add(e.path);
|
|
63761
65099
|
rawEntries.push(e);
|
|
63762
65100
|
}
|
|
@@ -63891,6 +65229,32 @@ const DEP_TYPE_MAP = [
|
|
|
63891
65229
|
*/
|
|
63892
65230
|
const resolveOrRaw = (snapshot, dep, spec) => getOrElse(snapshot.resolve(dep, spec), () => spec);
|
|
63893
65231
|
/**
|
|
65232
|
+
* Drop no-net-change field moves: the same dependency removed from one field
|
|
65233
|
+
* and added to another with an equal resolved version (e.g. a dep promoted
|
|
65234
|
+
* from `devDependencies` to `dependencies`). A field reclassification is a
|
|
65235
|
+
* contract change worth release-note prose, not a version movement, so it
|
|
65236
|
+
* must not surface as an unrelated removed row plus an added row. Moves that
|
|
65237
|
+
* also change the resolved version keep both rows (the movement is real).
|
|
65238
|
+
*/
|
|
65239
|
+
const collapseFieldMoves = (rows) => {
|
|
65240
|
+
const dropped = /* @__PURE__ */ new Set();
|
|
65241
|
+
const byName = /* @__PURE__ */ new Map();
|
|
65242
|
+
for (const row of rows) {
|
|
65243
|
+
const group = byName.get(row.dependency);
|
|
65244
|
+
if (group) group.push(row);
|
|
65245
|
+
else byName.set(row.dependency, [row]);
|
|
65246
|
+
}
|
|
65247
|
+
for (const group of byName.values()) for (const removed of group) {
|
|
65248
|
+
if (removed.action !== "removed" || dropped.has(removed)) continue;
|
|
65249
|
+
const added = group.find((r) => r.action === "added" && !dropped.has(r) && r.type !== removed.type && r.to === removed.from);
|
|
65250
|
+
if (added) {
|
|
65251
|
+
dropped.add(removed);
|
|
65252
|
+
dropped.add(added);
|
|
65253
|
+
}
|
|
65254
|
+
}
|
|
65255
|
+
return rows.filter((r) => !dropped.has(r));
|
|
65256
|
+
};
|
|
65257
|
+
/**
|
|
63894
65258
|
* Diff two workspace snapshots and return per-package dependency-table rows,
|
|
63895
65259
|
* comparing already-resolved specifier values per side.
|
|
63896
65260
|
*
|
|
@@ -63946,10 +65310,11 @@ function computeWorkspaceDependencyDiffs(before, after) {
|
|
|
63946
65310
|
});
|
|
63947
65311
|
}
|
|
63948
65312
|
}
|
|
63949
|
-
|
|
65313
|
+
const collapsed = collapseFieldMoves(rows);
|
|
65314
|
+
if (collapsed.length > 0) result.push({
|
|
63950
65315
|
package: afterPkg.name,
|
|
63951
65316
|
relativePath: afterPkg.relativePath,
|
|
63952
|
-
rows: sortDependencyRows(
|
|
65317
|
+
rows: sortDependencyRows(collapsed)
|
|
63953
65318
|
});
|
|
63954
65319
|
}
|
|
63955
65320
|
return result;
|
|
@@ -64292,7 +65657,8 @@ function makeShape$1(pit, inspector, discovery, detector, config, fs) {
|
|
|
64292
65657
|
fromRef = yield* gitMergeBase(resolvedCwd, baseBranch);
|
|
64293
65658
|
}
|
|
64294
65659
|
const rawDiffs = computeWorkspaceDependencyDiffs(yield* pit.at(fromRef, { cwd: resolvedCwd }), options.to ? yield* pit.at(options.to, { cwd: resolvedCwd }) : yield* pit.worktree({ cwd: resolvedCwd }));
|
|
64295
|
-
const
|
|
65660
|
+
const explicitTargets = /* @__PURE__ */ new Set([...options.packages ?? [], ...options.package ? [options.package] : []]);
|
|
65661
|
+
const excluded = new Set(options.exclude ?? []);
|
|
64296
65662
|
const livePackages = yield* discovery.listPackages(resolvedCwd);
|
|
64297
65663
|
const publishable = yield* listPublishablePackageNames(livePackages, resolvedCwd).pipe(provide$1(provideDetector));
|
|
64298
65664
|
const versionPrivate = yield* config.versionPrivate(resolvedCwd);
|
|
@@ -64301,9 +65667,15 @@ function makeShape$1(pit, inspector, discovery, detector, config, fs) {
|
|
|
64301
65667
|
if (yield* config.isIgnored(pkg.name, resolvedCwd)) continue;
|
|
64302
65668
|
if (publishable.has(pkg.name) || versionPrivate) inScope.add(pkg.name);
|
|
64303
65669
|
}
|
|
64304
|
-
const
|
|
65670
|
+
const activeTargets = /* @__PURE__ */ new Set();
|
|
65671
|
+
for (const name of explicitTargets) {
|
|
65672
|
+
if (excluded.has(name)) continue;
|
|
65673
|
+
if (yield* config.isIgnored(name, resolvedCwd)) continue;
|
|
65674
|
+
activeTargets.add(name);
|
|
65675
|
+
}
|
|
65676
|
+
const inScopeFor = (name) => explicitTargets.size > 0 ? activeTargets.has(name) : inScope.has(name) && !excluded.has(name);
|
|
64305
65677
|
const keepDevDeps = options.includeDevDeps === true;
|
|
64306
|
-
const scoped =
|
|
65678
|
+
const scoped = rawDiffs.filter((d) => inScopeFor(d.package));
|
|
64307
65679
|
const resolved = [];
|
|
64308
65680
|
for (const diff of scoped) {
|
|
64309
65681
|
const rows = keepDevDeps ? [...diff.rows] : diff.rows.filter((r) => r.type !== "devDependency");
|
|
@@ -64314,7 +65686,7 @@ function makeShape$1(pit, inspector, discovery, detector, config, fs) {
|
|
|
64314
65686
|
}
|
|
64315
65687
|
const existingPure = yield* findPureDependencyChangesets(fs, changesetDir);
|
|
64316
65688
|
const skippedMixed = yield* findMixedDependencyChangesets(fs, changesetDir);
|
|
64317
|
-
const toDelete =
|
|
65689
|
+
const toDelete = existingPure.filter((p) => inScopeFor(p.package));
|
|
64318
65690
|
const chosenFilenames = /* @__PURE__ */ new Set();
|
|
64319
65691
|
const toWrite = [];
|
|
64320
65692
|
for (const diff of resolved) {
|
|
@@ -64532,23 +65904,46 @@ function parseJsonPath(path) {
|
|
|
64532
65904
|
* @internal
|
|
64533
65905
|
*/
|
|
64534
65906
|
function jsonPathGet(obj, path) {
|
|
65907
|
+
return walkJsonPath(obj, path).map((entry) => entry.node);
|
|
65908
|
+
}
|
|
65909
|
+
/**
|
|
65910
|
+
* Shared breadth-first traversal behind {@link jsonPathGet} and
|
|
65911
|
+
* {@link jsonPathResolve}: each segment fans out the current set of matched
|
|
65912
|
+
* entries, carrying both the node and the concrete path taken to reach it.
|
|
65913
|
+
* The two public functions differ only in which half of the entry they keep.
|
|
65914
|
+
*/
|
|
65915
|
+
function walkJsonPath(obj, path) {
|
|
64535
65916
|
const segments = parseJsonPath(path);
|
|
64536
|
-
let current = [
|
|
65917
|
+
let current = [{
|
|
65918
|
+
node: obj,
|
|
65919
|
+
path: []
|
|
65920
|
+
}];
|
|
64537
65921
|
for (const segment of segments) {
|
|
64538
65922
|
const next = [];
|
|
64539
|
-
for (const node of current) {
|
|
65923
|
+
for (const { node, path: nodePath } of current) {
|
|
64540
65924
|
if (node === null || node === void 0 || typeof node !== "object") continue;
|
|
64541
65925
|
switch (segment.type) {
|
|
64542
65926
|
case "property": {
|
|
64543
65927
|
const value = node[segment.key];
|
|
64544
|
-
if (value !== void 0) next.push(
|
|
65928
|
+
if (value !== void 0) next.push({
|
|
65929
|
+
node: value,
|
|
65930
|
+
path: [...nodePath, segment.key]
|
|
65931
|
+
});
|
|
64545
65932
|
break;
|
|
64546
65933
|
}
|
|
64547
65934
|
case "index":
|
|
64548
|
-
if (Array.isArray(node) && segment.index < node.length) next.push(
|
|
65935
|
+
if (Array.isArray(node) && segment.index < node.length) next.push({
|
|
65936
|
+
node: node[segment.index],
|
|
65937
|
+
path: [...nodePath, segment.index]
|
|
65938
|
+
});
|
|
64549
65939
|
break;
|
|
64550
65940
|
case "wildcard":
|
|
64551
|
-
if (Array.isArray(node))
|
|
65941
|
+
if (Array.isArray(node)) node.forEach((element, index) => {
|
|
65942
|
+
next.push({
|
|
65943
|
+
node: element,
|
|
65944
|
+
path: [...nodePath, index]
|
|
65945
|
+
});
|
|
65946
|
+
});
|
|
64552
65947
|
break;
|
|
64553
65948
|
}
|
|
64554
65949
|
}
|
|
@@ -64557,81 +65952,37 @@ function jsonPathGet(obj, path) {
|
|
|
64557
65952
|
return current;
|
|
64558
65953
|
}
|
|
64559
65954
|
/**
|
|
64560
|
-
*
|
|
65955
|
+
* Resolve a JSONPath expression to the concrete paths of every existing match.
|
|
64561
65956
|
*
|
|
64562
65957
|
* @remarks
|
|
64563
|
-
*
|
|
64564
|
-
*
|
|
64565
|
-
*
|
|
64566
|
-
*
|
|
65958
|
+
* Uses the same breadth-first expansion as {@link jsonPathGet}, but instead of
|
|
65959
|
+
* collecting the matched *values* it records the concrete `(string | number)[]`
|
|
65960
|
+
* path taken to reach each one. Wildcards and indices are materialized into the
|
|
65961
|
+
* numeric array index actually traversed, so the returned paths are directly
|
|
65962
|
+
* consumable by structural editors such as `jsonc-effect`'s `modify`, which
|
|
65963
|
+
* require a fully concrete path (no wildcards).
|
|
64567
65964
|
*
|
|
64568
|
-
*
|
|
65965
|
+
* Only existing locations are returned; nothing is created. A path with no
|
|
65966
|
+
* matches yields an empty array, and the empty path (`"$."`) yields a single
|
|
65967
|
+
* empty concrete path (the document root).
|
|
65968
|
+
*
|
|
65969
|
+
* @param obj - The object to query
|
|
64569
65970
|
* @param path - JSONPath string (e.g., `"$.packages[*].version"`)
|
|
64570
|
-
* @
|
|
64571
|
-
* @returns The number of locations updated (0 if no matches or empty path)
|
|
65971
|
+
* @returns Array of concrete paths, each an array of string keys / numeric indices
|
|
64572
65972
|
*
|
|
64573
65973
|
* @example
|
|
64574
65974
|
* ```typescript
|
|
64575
|
-
* import {
|
|
65975
|
+
* import { jsonPathResolve } from "../utils/jsonpath.js";
|
|
64576
65976
|
*
|
|
64577
|
-
* const obj = { version: "1.0.0" };
|
|
64578
|
-
* const
|
|
64579
|
-
* //
|
|
65977
|
+
* const obj = { packages: [{ version: "1.0.0" }, { version: "2.0.0" }] };
|
|
65978
|
+
* const paths = jsonPathResolve(obj, "$.packages[*].version");
|
|
65979
|
+
* // [["packages", 0, "version"], ["packages", 1, "version"]]
|
|
64580
65980
|
* ```
|
|
64581
65981
|
*
|
|
64582
65982
|
* @internal
|
|
64583
65983
|
*/
|
|
64584
|
-
function
|
|
64585
|
-
|
|
64586
|
-
if (segments.length === 0) return 0;
|
|
64587
|
-
const lastSegment = segments[segments.length - 1];
|
|
64588
|
-
const parentSegments = segments.slice(0, -1);
|
|
64589
|
-
let parents = [obj];
|
|
64590
|
-
for (const segment of parentSegments) {
|
|
64591
|
-
const next = [];
|
|
64592
|
-
for (const node of parents) {
|
|
64593
|
-
if (node === null || node === void 0 || typeof node !== "object") continue;
|
|
64594
|
-
switch (segment.type) {
|
|
64595
|
-
case "property": {
|
|
64596
|
-
const child = node[segment.key];
|
|
64597
|
-
if (child !== void 0) next.push(child);
|
|
64598
|
-
break;
|
|
64599
|
-
}
|
|
64600
|
-
case "index":
|
|
64601
|
-
if (Array.isArray(node) && segment.index < node.length) next.push(node[segment.index]);
|
|
64602
|
-
break;
|
|
64603
|
-
case "wildcard":
|
|
64604
|
-
if (Array.isArray(node)) next.push(...node);
|
|
64605
|
-
break;
|
|
64606
|
-
}
|
|
64607
|
-
}
|
|
64608
|
-
parents = next;
|
|
64609
|
-
}
|
|
64610
|
-
let count = 0;
|
|
64611
|
-
for (const parent of parents) {
|
|
64612
|
-
if (parent === null || parent === void 0 || typeof parent !== "object") continue;
|
|
64613
|
-
switch (lastSegment.type) {
|
|
64614
|
-
case "property":
|
|
64615
|
-
if (lastSegment.key in parent) {
|
|
64616
|
-
parent[lastSegment.key] = value;
|
|
64617
|
-
count++;
|
|
64618
|
-
}
|
|
64619
|
-
break;
|
|
64620
|
-
case "index":
|
|
64621
|
-
if (Array.isArray(parent) && lastSegment.index < parent.length) {
|
|
64622
|
-
parent[lastSegment.index] = value;
|
|
64623
|
-
count++;
|
|
64624
|
-
}
|
|
64625
|
-
break;
|
|
64626
|
-
case "wildcard":
|
|
64627
|
-
if (Array.isArray(parent)) for (let i = 0; i < parent.length; i++) {
|
|
64628
|
-
parent[i] = value;
|
|
64629
|
-
count++;
|
|
64630
|
-
}
|
|
64631
|
-
break;
|
|
64632
|
-
}
|
|
64633
|
-
}
|
|
64634
|
-
return count;
|
|
65984
|
+
function jsonPathResolve(obj, path) {
|
|
65985
|
+
return walkJsonPath(obj, path).map((entry) => entry.path);
|
|
64635
65986
|
}
|
|
64636
65987
|
|
|
64637
65988
|
//#endregion
|
|
@@ -64823,31 +66174,39 @@ var VersionFiles = class VersionFiles {
|
|
|
64823
66174
|
return content.match(/^(\s+)"/m)?.[1] ?? " ";
|
|
64824
66175
|
}
|
|
64825
66176
|
/**
|
|
64826
|
-
* Update JSON file at specified JSONPath locations
|
|
66177
|
+
* Update a JSON (or JSONC) file at specified JSONPath locations,
|
|
66178
|
+
* preserving the original formatting byte-for-byte.
|
|
64827
66179
|
*
|
|
64828
66180
|
* @remarks
|
|
64829
|
-
*
|
|
64830
|
-
*
|
|
64831
|
-
*
|
|
64832
|
-
*
|
|
66181
|
+
* The write is performed with `jsonc-effect`'s format-preserving
|
|
66182
|
+
* `modify`/`applyEdits` rather than a `JSON.parse`/`JSON.stringify`
|
|
66183
|
+
* round-trip (which always explodes inline arrays one-element-per-line and
|
|
66184
|
+
* drops comments). Each JSONPath expression is resolved to concrete
|
|
66185
|
+
* `(string | number)[]` paths against the parsed document, and each
|
|
66186
|
+
* concrete path becomes a minimal text edit that touches only the target
|
|
66187
|
+
* value's span — so inline arrays, comments,
|
|
66188
|
+
* indentation, and the trailing-newline preference all survive; a one-line
|
|
66189
|
+
* version bump produces a one-line diff.
|
|
66190
|
+
*
|
|
66191
|
+
* Insertion semantics: a concrete, wildcard-free JSONPath whose leaf
|
|
66192
|
+
* property does not exist yet is inserted after the last sibling using the
|
|
66193
|
+
* document's detected indent (the one case where indent detection still
|
|
66194
|
+
* matters). Wildcard expressions only ever update existing matches. Returns
|
|
66195
|
+
* `undefined` (no write) when nothing was updated or inserted.
|
|
64833
66196
|
*
|
|
64834
66197
|
* @param filePath - Absolute path to the JSON file
|
|
64835
66198
|
* @param jsonPaths - JSONPath expressions to update
|
|
64836
66199
|
* @param version - New version string
|
|
64837
66200
|
* @returns Update result, or `undefined` if no changes were made
|
|
66201
|
+
*
|
|
66202
|
+
* @see {@link jsonPathResolve} for concrete-path enumeration
|
|
66203
|
+
* @see {@link VersionFiles.applyVersionEdit} for the per-path edit
|
|
64838
66204
|
*/
|
|
64839
66205
|
static updateFile(filePath, jsonPaths, version) {
|
|
64840
|
-
const
|
|
64841
|
-
const
|
|
64842
|
-
|
|
64843
|
-
|
|
64844
|
-
const previousValues = jsonPaths.flatMap((jp) => jsonPathGet(obj, jp));
|
|
64845
|
-
let totalUpdated = 0;
|
|
64846
|
-
for (const jp of jsonPaths) totalUpdated += jsonPathSet(obj, jp, version);
|
|
64847
|
-
if (totalUpdated === 0) return;
|
|
64848
|
-
let output = JSON.stringify(obj, null, indent);
|
|
64849
|
-
if (trailingNewline) output += "\n";
|
|
64850
|
-
writeFileSync(filePath, output, "utf-8");
|
|
66206
|
+
const original = readFileSync(filePath, "utf-8");
|
|
66207
|
+
const { content, previousValues, totalChanged } = VersionFiles.computeUpdate(original, jsonPaths, version);
|
|
66208
|
+
if (totalChanged === 0) return;
|
|
66209
|
+
writeFileSync(filePath, content, "utf-8");
|
|
64851
66210
|
return {
|
|
64852
66211
|
filePath,
|
|
64853
66212
|
jsonPaths,
|
|
@@ -64856,6 +66215,83 @@ var VersionFiles = class VersionFiles {
|
|
|
64856
66215
|
};
|
|
64857
66216
|
}
|
|
64858
66217
|
/**
|
|
66218
|
+
* Compute the full update for a document without touching the filesystem:
|
|
66219
|
+
* the edited content, the previous values at every matched path, and how
|
|
66220
|
+
* many locations actually changed.
|
|
66221
|
+
*
|
|
66222
|
+
* @remarks
|
|
66223
|
+
* This is the single decision path shared by {@link VersionFiles.updateFile}
|
|
66224
|
+
* and the dry-run branches of the two process methods, so a preview reports
|
|
66225
|
+
* exactly the files a real run would write — including pending inserts of a
|
|
66226
|
+
* not-yet-existing wildcard-free leaf, and excluding same-value no-ops.
|
|
66227
|
+
*
|
|
66228
|
+
* @param original - Document text as read from disk
|
|
66229
|
+
* @param jsonPaths - JSONPath expressions to update
|
|
66230
|
+
* @param version - New version string
|
|
66231
|
+
* @returns The updated content, previous values, and changed-location count
|
|
66232
|
+
*/
|
|
66233
|
+
static computeUpdate(original, jsonPaths, version) {
|
|
66234
|
+
let content = original;
|
|
66235
|
+
const obj = runSync(parse$2(content));
|
|
66236
|
+
const previousValues = jsonPaths.flatMap((jp) => jsonPathGet(obj, jp));
|
|
66237
|
+
const indent = VersionFiles.detectIndent(content);
|
|
66238
|
+
const eol = content.includes("\r\n") ? "\r\n" : "\n";
|
|
66239
|
+
let totalChanged = 0;
|
|
66240
|
+
for (const jp of jsonPaths) {
|
|
66241
|
+
const segments = parseJsonPath(jp);
|
|
66242
|
+
if (segments.length === 0) continue;
|
|
66243
|
+
const hasWildcard = segments.some((segment) => segment.type === "wildcard");
|
|
66244
|
+
let concretePaths;
|
|
66245
|
+
if (hasWildcard) concretePaths = jsonPathResolve(obj, jp);
|
|
66246
|
+
else {
|
|
66247
|
+
const direct = segments.map((segment) => segment.type === "property" ? segment.key : segment.index);
|
|
66248
|
+
concretePaths = jsonPathResolve(obj, jp).length > 0 || typeof direct[direct.length - 1] === "string" ? [direct] : [];
|
|
66249
|
+
}
|
|
66250
|
+
for (const concretePath of concretePaths) {
|
|
66251
|
+
const updated = VersionFiles.applyVersionEdit(content, concretePath, version, indent, eol);
|
|
66252
|
+
if (updated !== void 0) {
|
|
66253
|
+
content = updated;
|
|
66254
|
+
totalChanged += 1;
|
|
66255
|
+
}
|
|
66256
|
+
}
|
|
66257
|
+
}
|
|
66258
|
+
return {
|
|
66259
|
+
content,
|
|
66260
|
+
previousValues,
|
|
66261
|
+
totalChanged
|
|
66262
|
+
};
|
|
66263
|
+
}
|
|
66264
|
+
/**
|
|
66265
|
+
* Compute the format-preserving edit for a single concrete path, returning
|
|
66266
|
+
* the updated document, or `undefined` when nothing changed.
|
|
66267
|
+
*
|
|
66268
|
+
* @remarks
|
|
66269
|
+
* Delegates to `jsonc-effect`'s {@link modify} + {@link applyEdits}
|
|
66270
|
+
* (requires `jsonc-effect >= 0.3.1`, whose edit spans touch only the target
|
|
66271
|
+
* value), so every other byte of the document is preserved. When the leaf
|
|
66272
|
+
* of a wildcard-free path does not exist, `modify` inserts the property
|
|
66273
|
+
* after the last sibling using the supplied formatting options — the only
|
|
66274
|
+
* case where the detected indent matters. A path whose parent is missing or
|
|
66275
|
+
* not an object cannot be navigated; the resulting modification error is
|
|
66276
|
+
* caught and reported as "no change" so the file is left alone.
|
|
66277
|
+
*
|
|
66278
|
+
* @param content - Current document text
|
|
66279
|
+
* @param concretePath - A wildcard-free `(string | number)[]` path
|
|
66280
|
+
* @param version - New version string
|
|
66281
|
+
* @param indentUnit - One indentation level, for inserted text
|
|
66282
|
+
* @param eol - End-of-line sequence, for inserted text
|
|
66283
|
+
* @returns The updated document, or `undefined` if the path was unchanged
|
|
66284
|
+
*/
|
|
66285
|
+
static applyVersionEdit(content, concretePath, version, indentUnit, eol) {
|
|
66286
|
+
const insertSpaces = !indentUnit.includes(" ");
|
|
66287
|
+
const program = modify(content, [...concretePath], version, { formattingOptions: {
|
|
66288
|
+
insertSpaces,
|
|
66289
|
+
tabSize: insertSpaces ? indentUnit.length : 1,
|
|
66290
|
+
eol
|
|
66291
|
+
} }).pipe(flatMap$2((edits) => applyEdits$1(content, edits)), map$5((updated) => updated === content ? void 0 : updated), catchTag("JsoncModificationError", () => succeed$3(void 0)));
|
|
66292
|
+
return runSync(program);
|
|
66293
|
+
}
|
|
66294
|
+
/**
|
|
64859
66295
|
* Orchestrate the full version file update flow.
|
|
64860
66296
|
*
|
|
64861
66297
|
* @remarks
|
|
@@ -64881,9 +66317,8 @@ var VersionFiles = class VersionFiles {
|
|
|
64881
66317
|
try {
|
|
64882
66318
|
if (dryRun) {
|
|
64883
66319
|
const content = readFileSync(filePath, "utf-8");
|
|
64884
|
-
const
|
|
64885
|
-
|
|
64886
|
-
if (previousValues.length > 0) updates.push({
|
|
66320
|
+
const { previousValues, totalChanged } = VersionFiles.computeUpdate(content, jsonPaths, version);
|
|
66321
|
+
if (totalChanged > 0) updates.push({
|
|
64887
66322
|
filePath,
|
|
64888
66323
|
jsonPaths,
|
|
64889
66324
|
version,
|
|
@@ -64927,9 +66362,8 @@ var VersionFiles = class VersionFiles {
|
|
|
64927
66362
|
for (const filePath of vf.matchedFiles) try {
|
|
64928
66363
|
if (dryRun) {
|
|
64929
66364
|
const content = readFileSync(filePath, "utf-8");
|
|
64930
|
-
const
|
|
64931
|
-
|
|
64932
|
-
if (previousValues.length > 0) updates.push({
|
|
66365
|
+
const { previousValues, totalChanged } = VersionFiles.computeUpdate(content, jsonPaths, scope.version);
|
|
66366
|
+
if (totalChanged > 0) updates.push({
|
|
64933
66367
|
filePath,
|
|
64934
66368
|
jsonPaths,
|
|
64935
66369
|
version: scope.version,
|
|
@@ -78909,14 +80343,6 @@ var changesets_exports = /* @__PURE__ */ __exportAll({
|
|
|
78909
80343
|
|
|
78910
80344
|
//#endregion
|
|
78911
80345
|
//#region src/index.ts
|
|
78912
|
-
/**
|
|
78913
|
-
* The silk changelog generator as a standalone installable package — the
|
|
78914
|
-
* canonical `changelog` id for `.changeset/config.json`. Thin re-export of
|
|
78915
|
-
* `@savvy-web/silk-effects`' changelog functions; silk-effects remains the
|
|
78916
|
-
* single source of truth.
|
|
78917
|
-
*
|
|
78918
|
-
* @packageDocumentation
|
|
78919
|
-
*/
|
|
78920
80346
|
const changelogFunctions = changesets_exports.changelogFunctions;
|
|
78921
80347
|
|
|
78922
80348
|
//#endregion
|