@effected/yaml 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Yaml.js +7 -7
- package/YamlDocument.js +3 -3
- package/YamlFormat.js +8 -5
- package/index.d.ts +36 -36
- package/internal/composer/block.js +24 -13
- package/internal/composer/flow.js +12 -6
- package/internal/composer/scalars.js +29 -17
- package/internal/cst-parser.js +9 -1
- package/internal/lexer.js +23 -17
- package/internal/stringifier.js +19 -15
- package/package.json +2 -2
package/Yaml.js
CHANGED
|
@@ -4,7 +4,7 @@ import { composeAllDocuments, composeFirstDocument } from "./internal/composer/d
|
|
|
4
4
|
import { isFatalCode } from "./internal/diagnostics.js";
|
|
5
5
|
import { StringifyDepthExceeded, StringifyFailure, stringifyValue } from "./internal/stringifier.js";
|
|
6
6
|
import { YamlDiagnostic } from "./YamlDiagnostic.js";
|
|
7
|
-
import { Effect,
|
|
7
|
+
import { Effect, Result, Schema, SchemaIssue, SchemaTransformation } from "effect";
|
|
8
8
|
|
|
9
9
|
//#region src/Yaml.ts
|
|
10
10
|
/**
|
|
@@ -126,7 +126,7 @@ var YamlStringifyOptions = class extends Schema.Class("YamlStringifyOptions")({
|
|
|
126
126
|
*
|
|
127
127
|
* @public
|
|
128
128
|
*/
|
|
129
|
-
var YamlParseError = class extends Schema.
|
|
129
|
+
var YamlParseError = class extends Schema.TaggedError()("YamlParseError", {
|
|
130
130
|
diagnostics: Schema.Array(YamlDiagnostic),
|
|
131
131
|
input: Schema.String
|
|
132
132
|
}) {
|
|
@@ -144,7 +144,7 @@ var YamlParseError = class extends Schema.TaggedErrorClass()("YamlParseError", {
|
|
|
144
144
|
*
|
|
145
145
|
* @public
|
|
146
146
|
*/
|
|
147
|
-
var YamlStringifyError = class extends Schema.
|
|
147
|
+
var YamlStringifyError = class extends Schema.TaggedError()("YamlStringifyError", {
|
|
148
148
|
diagnostics: Schema.Array(YamlDiagnostic),
|
|
149
149
|
value: Schema.Unknown
|
|
150
150
|
}) {
|
|
@@ -516,8 +516,8 @@ var Yaml = class Yaml {
|
|
|
516
516
|
*/
|
|
517
517
|
static fromString(options) {
|
|
518
518
|
return Schema.String.pipe(Schema.decodeTo(Schema.Unknown, SchemaTransformation.transformOrFail({
|
|
519
|
-
decode: (input) => Yaml.parse(input, options).pipe(Effect.mapError((error) => new SchemaIssue.InvalidValue(
|
|
520
|
-
encode: (value) => stringifyOrFail(value).pipe(Effect.mapError((error) => new SchemaIssue.InvalidValue(
|
|
519
|
+
decode: (input) => Yaml.parse(input, options).pipe(Effect.mapError((error) => new SchemaIssue.InvalidValue({ message: error.message }, input))),
|
|
520
|
+
encode: (value) => stringifyOrFail(value).pipe(Effect.mapError((error) => new SchemaIssue.InvalidValue({ message: error.message }, value)))
|
|
521
521
|
})));
|
|
522
522
|
}
|
|
523
523
|
/**
|
|
@@ -536,12 +536,12 @@ var Yaml = class Yaml {
|
|
|
536
536
|
*/
|
|
537
537
|
static allFromString(options) {
|
|
538
538
|
return Schema.String.pipe(Schema.decodeTo(Schema.Array(Schema.Unknown), SchemaTransformation.transformOrFail({
|
|
539
|
-
decode: (input) => Yaml.parseAll(input, options).pipe(Effect.mapError((error) => new SchemaIssue.InvalidValue(
|
|
539
|
+
decode: (input) => Yaml.parseAll(input, options).pipe(Effect.mapError((error) => new SchemaIssue.InvalidValue({ message: error.message }, input))),
|
|
540
540
|
encode: (values) => Effect.gen(function* () {
|
|
541
541
|
if (values.length === 0) return "";
|
|
542
542
|
const parts = [];
|
|
543
543
|
for (let index = 0; index < values.length; index++) {
|
|
544
|
-
const yaml = yield* stringifyOrFail(values[index]).pipe(Effect.mapError((error) => new SchemaIssue.InvalidValue(
|
|
544
|
+
const yaml = yield* stringifyOrFail(values[index]).pipe(Effect.mapError((error) => new SchemaIssue.InvalidValue({ message: error.message }, values)));
|
|
545
545
|
parts.push(index > 0 ? `---\n${yaml}` : yaml);
|
|
546
546
|
}
|
|
547
547
|
return parts.join("");
|
package/YamlDocument.js
CHANGED
|
@@ -4,7 +4,7 @@ import { isFatalCode } from "./internal/diagnostics.js";
|
|
|
4
4
|
import { StringifyDepthExceeded, StringifyFailure, stringifyDocument } from "./internal/stringifier.js";
|
|
5
5
|
import { YamlDiagnostic } from "./YamlDiagnostic.js";
|
|
6
6
|
import { YamlParseError, YamlStringifyError } from "./Yaml.js";
|
|
7
|
-
import { Effect,
|
|
7
|
+
import { Effect, Schema, SchemaIssue, SchemaTransformation } from "effect";
|
|
8
8
|
|
|
9
9
|
//#region src/YamlDocument.ts
|
|
10
10
|
/**
|
|
@@ -80,8 +80,8 @@ var YamlDocument = class YamlDocument extends Schema.Class("YamlDocument")({
|
|
|
80
80
|
*/
|
|
81
81
|
static schema(options) {
|
|
82
82
|
return Schema.String.pipe(Schema.decodeTo(Schema.instanceOf(YamlDocument), SchemaTransformation.transformOrFail({
|
|
83
|
-
decode: (input) => YamlDocument.parse(input, options).pipe(Effect.mapError((error) => new SchemaIssue.InvalidValue(
|
|
84
|
-
encode: (doc) => doc.stringify().pipe(Effect.mapError((error) => new SchemaIssue.InvalidValue(
|
|
83
|
+
decode: (input) => YamlDocument.parse(input, options).pipe(Effect.mapError((error) => new SchemaIssue.InvalidValue({ message: error.message }, input))),
|
|
84
|
+
encode: (doc) => doc.stringify().pipe(Effect.mapError((error) => new SchemaIssue.InvalidValue({ message: error.message }, doc)))
|
|
85
85
|
})));
|
|
86
86
|
}
|
|
87
87
|
/**
|
package/YamlFormat.js
CHANGED
|
@@ -47,7 +47,7 @@ var YamlFormattingOptions = class extends Schema.Class("YamlFormattingOptions")(
|
|
|
47
47
|
*
|
|
48
48
|
* @public
|
|
49
49
|
*/
|
|
50
|
-
var YamlModificationError = class extends Schema.
|
|
50
|
+
var YamlModificationError = class extends Schema.TaggedError()("YamlModificationError", {
|
|
51
51
|
path: Schema.Array(Schema.Union([Schema.String, Schema.Number])),
|
|
52
52
|
diagnostics: Schema.Array(YamlDiagnostic)
|
|
53
53
|
}) {
|
|
@@ -106,7 +106,7 @@ function formatDocument(text, options) {
|
|
|
106
106
|
const doc = composeFirstDocument(text, {});
|
|
107
107
|
if (doc.errors.some((e) => isFatalCode(e.code))) return void 0;
|
|
108
108
|
const preserveComments = options?.preserveComments ?? true;
|
|
109
|
-
|
|
109
|
+
const outputDoc = {
|
|
110
110
|
contents: !preserveComments && doc.contents !== null ? stripNodeComments(doc.contents) : doc.contents,
|
|
111
111
|
errors: doc.errors,
|
|
112
112
|
warnings: doc.warnings,
|
|
@@ -115,7 +115,8 @@ function formatDocument(text, options) {
|
|
|
115
115
|
hasDocumentStart: doc.hasDocumentStart,
|
|
116
116
|
hasDocumentEnd: doc.hasDocumentEnd,
|
|
117
117
|
hasDocumentStartTab: doc.hasDocumentStartTab
|
|
118
|
-
}
|
|
118
|
+
};
|
|
119
|
+
return stringifyDocument(outputDoc, toStringifyInput(options));
|
|
119
120
|
}
|
|
120
121
|
/** Convert a plain JS scalar value into a synthetic `YamlScalar` (offset/length are irrelevant — immediately re-stringified). */
|
|
121
122
|
function jsValueToNode(value) {
|
|
@@ -317,10 +318,12 @@ var YamlFormat = class YamlFormat {
|
|
|
317
318
|
}, text)]
|
|
318
319
|
});
|
|
319
320
|
}
|
|
320
|
-
|
|
321
|
+
const outputDoc = {
|
|
321
322
|
...doc,
|
|
322
323
|
contents: newContents
|
|
323
|
-
}
|
|
324
|
+
};
|
|
325
|
+
const formatted = stringifyDocument(outputDoc, toStringifyInput(options));
|
|
326
|
+
return computeEdits(text, formatted).map((e) => YamlEdit.make(e));
|
|
324
327
|
});
|
|
325
328
|
/**
|
|
326
329
|
* Modify `text` and apply the resulting edits in one step
|
package/index.d.ts
CHANGED
|
@@ -1168,8 +1168,8 @@ declare const YamlVisitorEvent: {
|
|
|
1168
1168
|
readonly path: YamlPath;
|
|
1169
1169
|
readonly depth: number;
|
|
1170
1170
|
readonly style: CollectionStyle;
|
|
1171
|
-
readonly tag?: string
|
|
1172
|
-
readonly anchor?: string
|
|
1171
|
+
readonly tag?: string;
|
|
1172
|
+
readonly anchor?: string;
|
|
1173
1173
|
}, {
|
|
1174
1174
|
readonly _tag: Tag;
|
|
1175
1175
|
}> | Extract<{
|
|
@@ -1186,8 +1186,8 @@ declare const YamlVisitorEvent: {
|
|
|
1186
1186
|
readonly depth: number;
|
|
1187
1187
|
readonly value: unknown;
|
|
1188
1188
|
readonly style: ScalarStyle;
|
|
1189
|
-
readonly tag?: string
|
|
1190
|
-
readonly anchor?: string
|
|
1189
|
+
readonly tag?: string;
|
|
1190
|
+
readonly anchor?: string;
|
|
1191
1191
|
}, {
|
|
1192
1192
|
readonly _tag: Tag;
|
|
1193
1193
|
}> | Extract<{
|
|
@@ -1201,8 +1201,8 @@ declare const YamlVisitorEvent: {
|
|
|
1201
1201
|
readonly path: YamlPath;
|
|
1202
1202
|
readonly depth: number;
|
|
1203
1203
|
readonly style: CollectionStyle;
|
|
1204
|
-
readonly tag?: string
|
|
1205
|
-
readonly anchor?: string
|
|
1204
|
+
readonly tag?: string;
|
|
1205
|
+
readonly anchor?: string;
|
|
1206
1206
|
}, {
|
|
1207
1207
|
readonly _tag: Tag;
|
|
1208
1208
|
}>;
|
|
@@ -1257,8 +1257,8 @@ declare const YamlVisitorEvent: {
|
|
|
1257
1257
|
readonly path: YamlPath;
|
|
1258
1258
|
readonly depth: number;
|
|
1259
1259
|
readonly style: CollectionStyle;
|
|
1260
|
-
readonly tag?: string
|
|
1261
|
-
readonly anchor?: string
|
|
1260
|
+
readonly tag?: string;
|
|
1261
|
+
readonly anchor?: string;
|
|
1262
1262
|
}) => any;
|
|
1263
1263
|
readonly Pair: (args: {
|
|
1264
1264
|
readonly _tag: "Pair";
|
|
@@ -1273,8 +1273,8 @@ declare const YamlVisitorEvent: {
|
|
|
1273
1273
|
readonly depth: number;
|
|
1274
1274
|
readonly value: unknown;
|
|
1275
1275
|
readonly style: ScalarStyle;
|
|
1276
|
-
readonly tag?: string
|
|
1277
|
-
readonly anchor?: string
|
|
1276
|
+
readonly tag?: string;
|
|
1277
|
+
readonly anchor?: string;
|
|
1278
1278
|
}) => any;
|
|
1279
1279
|
readonly SeqEnd: (args: {
|
|
1280
1280
|
readonly _tag: "SeqEnd";
|
|
@@ -1286,8 +1286,8 @@ declare const YamlVisitorEvent: {
|
|
|
1286
1286
|
readonly path: YamlPath;
|
|
1287
1287
|
readonly depth: number;
|
|
1288
1288
|
readonly style: CollectionStyle;
|
|
1289
|
-
readonly tag?: string
|
|
1290
|
-
readonly anchor?: string
|
|
1289
|
+
readonly tag?: string;
|
|
1290
|
+
readonly anchor?: string;
|
|
1291
1291
|
}) => any;
|
|
1292
1292
|
}>(cases: Cases): (value: {
|
|
1293
1293
|
readonly _tag: "Alias";
|
|
@@ -1331,8 +1331,8 @@ declare const YamlVisitorEvent: {
|
|
|
1331
1331
|
readonly path: YamlPath;
|
|
1332
1332
|
readonly depth: number;
|
|
1333
1333
|
readonly style: CollectionStyle;
|
|
1334
|
-
readonly tag?: string
|
|
1335
|
-
readonly anchor?: string
|
|
1334
|
+
readonly tag?: string;
|
|
1335
|
+
readonly anchor?: string;
|
|
1336
1336
|
} | {
|
|
1337
1337
|
readonly _tag: "Pair";
|
|
1338
1338
|
readonly path: YamlPath;
|
|
@@ -1345,8 +1345,8 @@ declare const YamlVisitorEvent: {
|
|
|
1345
1345
|
readonly depth: number;
|
|
1346
1346
|
readonly value: unknown;
|
|
1347
1347
|
readonly style: ScalarStyle;
|
|
1348
|
-
readonly tag?: string
|
|
1349
|
-
readonly anchor?: string
|
|
1348
|
+
readonly tag?: string;
|
|
1349
|
+
readonly anchor?: string;
|
|
1350
1350
|
} | {
|
|
1351
1351
|
readonly _tag: "SeqEnd";
|
|
1352
1352
|
readonly path: YamlPath;
|
|
@@ -1356,8 +1356,8 @@ declare const YamlVisitorEvent: {
|
|
|
1356
1356
|
readonly path: YamlPath;
|
|
1357
1357
|
readonly depth: number;
|
|
1358
1358
|
readonly style: CollectionStyle;
|
|
1359
|
-
readonly tag?: string
|
|
1360
|
-
readonly anchor?: string
|
|
1359
|
+
readonly tag?: string;
|
|
1360
|
+
readonly anchor?: string;
|
|
1361
1361
|
}) => import("effect/Unify").Unify<ReturnType<Cases["Alias" | "Comment" | "Directive" | "DocumentEnd" | "DocumentStart" | "Error" | "MapEnd" | "MapStart" | "Pair" | "Scalar" | "SeqEnd" | "SeqStart"]>>;
|
|
1362
1362
|
<Cases extends {
|
|
1363
1363
|
readonly Alias: (args: {
|
|
@@ -1409,8 +1409,8 @@ declare const YamlVisitorEvent: {
|
|
|
1409
1409
|
readonly path: YamlPath;
|
|
1410
1410
|
readonly depth: number;
|
|
1411
1411
|
readonly style: CollectionStyle;
|
|
1412
|
-
readonly tag?: string
|
|
1413
|
-
readonly anchor?: string
|
|
1412
|
+
readonly tag?: string;
|
|
1413
|
+
readonly anchor?: string;
|
|
1414
1414
|
}) => any;
|
|
1415
1415
|
readonly Pair: (args: {
|
|
1416
1416
|
readonly _tag: "Pair";
|
|
@@ -1425,8 +1425,8 @@ declare const YamlVisitorEvent: {
|
|
|
1425
1425
|
readonly depth: number;
|
|
1426
1426
|
readonly value: unknown;
|
|
1427
1427
|
readonly style: ScalarStyle;
|
|
1428
|
-
readonly tag?: string
|
|
1429
|
-
readonly anchor?: string
|
|
1428
|
+
readonly tag?: string;
|
|
1429
|
+
readonly anchor?: string;
|
|
1430
1430
|
}) => any;
|
|
1431
1431
|
readonly SeqEnd: (args: {
|
|
1432
1432
|
readonly _tag: "SeqEnd";
|
|
@@ -1438,8 +1438,8 @@ declare const YamlVisitorEvent: {
|
|
|
1438
1438
|
readonly path: YamlPath;
|
|
1439
1439
|
readonly depth: number;
|
|
1440
1440
|
readonly style: CollectionStyle;
|
|
1441
|
-
readonly tag?: string
|
|
1442
|
-
readonly anchor?: string
|
|
1441
|
+
readonly tag?: string;
|
|
1442
|
+
readonly anchor?: string;
|
|
1443
1443
|
}) => any;
|
|
1444
1444
|
}>(value: {
|
|
1445
1445
|
readonly _tag: "Alias";
|
|
@@ -1483,8 +1483,8 @@ declare const YamlVisitorEvent: {
|
|
|
1483
1483
|
readonly path: YamlPath;
|
|
1484
1484
|
readonly depth: number;
|
|
1485
1485
|
readonly style: CollectionStyle;
|
|
1486
|
-
readonly tag?: string
|
|
1487
|
-
readonly anchor?: string
|
|
1486
|
+
readonly tag?: string;
|
|
1487
|
+
readonly anchor?: string;
|
|
1488
1488
|
} | {
|
|
1489
1489
|
readonly _tag: "Pair";
|
|
1490
1490
|
readonly path: YamlPath;
|
|
@@ -1497,8 +1497,8 @@ declare const YamlVisitorEvent: {
|
|
|
1497
1497
|
readonly depth: number;
|
|
1498
1498
|
readonly value: unknown;
|
|
1499
1499
|
readonly style: ScalarStyle;
|
|
1500
|
-
readonly tag?: string
|
|
1501
|
-
readonly anchor?: string
|
|
1500
|
+
readonly tag?: string;
|
|
1501
|
+
readonly anchor?: string;
|
|
1502
1502
|
} | {
|
|
1503
1503
|
readonly _tag: "SeqEnd";
|
|
1504
1504
|
readonly path: YamlPath;
|
|
@@ -1508,8 +1508,8 @@ declare const YamlVisitorEvent: {
|
|
|
1508
1508
|
readonly path: YamlPath;
|
|
1509
1509
|
readonly depth: number;
|
|
1510
1510
|
readonly style: CollectionStyle;
|
|
1511
|
-
readonly tag?: string
|
|
1512
|
-
readonly anchor?: string
|
|
1511
|
+
readonly tag?: string;
|
|
1512
|
+
readonly anchor?: string;
|
|
1513
1513
|
}, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["Alias" | "Comment" | "Directive" | "DocumentEnd" | "DocumentStart" | "Error" | "MapEnd" | "MapStart" | "Pair" | "Scalar" | "SeqEnd" | "SeqStart"]>>;
|
|
1514
1514
|
};
|
|
1515
1515
|
readonly Alias: Data.TaggedEnum.ConstructorFrom<{
|
|
@@ -1561,8 +1561,8 @@ declare const YamlVisitorEvent: {
|
|
|
1561
1561
|
readonly path: YamlPath;
|
|
1562
1562
|
readonly depth: number;
|
|
1563
1563
|
readonly style: CollectionStyle;
|
|
1564
|
-
readonly tag?: string
|
|
1565
|
-
readonly anchor?: string
|
|
1564
|
+
readonly tag?: string;
|
|
1565
|
+
readonly anchor?: string;
|
|
1566
1566
|
}, "_tag">;
|
|
1567
1567
|
readonly Pair: Data.TaggedEnum.ConstructorFrom<{
|
|
1568
1568
|
readonly _tag: "Pair";
|
|
@@ -1577,8 +1577,8 @@ declare const YamlVisitorEvent: {
|
|
|
1577
1577
|
readonly depth: number;
|
|
1578
1578
|
readonly value: unknown;
|
|
1579
1579
|
readonly style: ScalarStyle;
|
|
1580
|
-
readonly tag?: string
|
|
1581
|
-
readonly anchor?: string
|
|
1580
|
+
readonly tag?: string;
|
|
1581
|
+
readonly anchor?: string;
|
|
1582
1582
|
}, "_tag">;
|
|
1583
1583
|
readonly SeqEnd: Data.TaggedEnum.ConstructorFrom<{
|
|
1584
1584
|
readonly _tag: "SeqEnd";
|
|
@@ -1590,8 +1590,8 @@ declare const YamlVisitorEvent: {
|
|
|
1590
1590
|
readonly path: YamlPath;
|
|
1591
1591
|
readonly depth: number;
|
|
1592
1592
|
readonly style: CollectionStyle;
|
|
1593
|
-
readonly tag?: string
|
|
1594
|
-
readonly anchor?: string
|
|
1593
|
+
readonly tag?: string;
|
|
1594
|
+
readonly anchor?: string;
|
|
1595
1595
|
}, "_tag">;
|
|
1596
1596
|
};
|
|
1597
1597
|
/**
|
|
@@ -39,11 +39,12 @@ function composeBlockMapInner(blockMapCst, state, externalFirstKey, meta) {
|
|
|
39
39
|
if (state.options.uniqueKeys) checkDuplicateKeys(pairs, state);
|
|
40
40
|
checkMultilineImplicitKeys(pairs, state);
|
|
41
41
|
const offset = externalFirstKey ? "offset" in externalFirstKey ? externalFirstKey.offset : blockMapCst.offset : blockMapCst.offset;
|
|
42
|
+
const length = blockMapCst.offset + blockMapCst.length - offset;
|
|
42
43
|
const map = new YamlMap({
|
|
43
44
|
items: pairs,
|
|
44
45
|
style: "block",
|
|
45
46
|
offset,
|
|
46
|
-
length
|
|
47
|
+
length,
|
|
47
48
|
...meta?.tag !== void 0 ? { tag: meta.tag } : {},
|
|
48
49
|
...meta?.anchor !== void 0 ? { anchor: meta.anchor } : {},
|
|
49
50
|
...meta?.comment !== void 0 ? { comment: meta.comment } : {}
|
|
@@ -135,11 +136,12 @@ function flattenBlockMapChildren(children, state, externalKeyColumn, externalKey
|
|
|
135
136
|
const firstC = findFirstContent(sliceChildren);
|
|
136
137
|
const lastC = findLastContent(sliceChildren);
|
|
137
138
|
const innerOffset = firstC ? firstC.offset : child.offset;
|
|
139
|
+
const innerEnd = lastC ? lastC.offset + lastC.length : child.offset + child.length;
|
|
138
140
|
pushNode(new YamlMap({
|
|
139
141
|
items: innerPairs,
|
|
140
142
|
style: "block",
|
|
141
143
|
offset: innerOffset,
|
|
142
|
-
length:
|
|
144
|
+
length: innerEnd - innerOffset
|
|
143
145
|
}), innerOffset);
|
|
144
146
|
i = lookahead.endIdx - 1;
|
|
145
147
|
continue;
|
|
@@ -150,8 +152,9 @@ function flattenBlockMapChildren(children, state, externalKeyColumn, externalKey
|
|
|
150
152
|
validateNoTabAfterContinuationValueSep(child, children, i, state);
|
|
151
153
|
const flushMeta = combinedPending();
|
|
152
154
|
if (hasMeta(flushMeta)) {
|
|
155
|
+
const value = resolveScalar("", "plain", flushMeta.tag, state);
|
|
153
156
|
const scalar = new YamlScalar({
|
|
154
|
-
value
|
|
157
|
+
value,
|
|
155
158
|
style: "plain",
|
|
156
159
|
offset: child.offset,
|
|
157
160
|
length: 0,
|
|
@@ -211,8 +214,9 @@ function flattenBlockMapChildren(children, state, externalKeyColumn, externalKey
|
|
|
211
214
|
if (afterValueSep && sepOnSameLine) {
|
|
212
215
|
const flushMeta = combinedPending();
|
|
213
216
|
if (hasMeta(flushMeta)) {
|
|
217
|
+
const value = resolveScalar("", "plain", flushMeta.tag, state);
|
|
214
218
|
const scalar = new YamlScalar({
|
|
215
|
-
value
|
|
219
|
+
value,
|
|
216
220
|
style: "plain",
|
|
217
221
|
offset: child.offset,
|
|
218
222
|
length: 0,
|
|
@@ -277,8 +281,9 @@ function flattenBlockMapChildren(children, state, externalKeyColumn, externalKey
|
|
|
277
281
|
if (isExplicitKey) {
|
|
278
282
|
const { value: keyValue, nextIdx: keyNextIdx } = collectMultilineKey(children, i);
|
|
279
283
|
const keyMeta = combinedPending();
|
|
284
|
+
const resolved = resolveScalar(keyValue, "plain", keyMeta.tag, state);
|
|
280
285
|
const scalar = new YamlScalar({
|
|
281
|
-
value:
|
|
286
|
+
value: resolved,
|
|
282
287
|
style: "plain",
|
|
283
288
|
offset: child.offset,
|
|
284
289
|
length: child.length,
|
|
@@ -386,7 +391,8 @@ function flattenBlockMapChildren(children, state, externalKeyColumn, externalKey
|
|
|
386
391
|
i = nextAlias.idx;
|
|
387
392
|
continue;
|
|
388
393
|
}
|
|
389
|
-
|
|
394
|
+
const aliasMeta = combinedPending();
|
|
395
|
+
checkAnchorOnAlias(aliasMeta, child, state);
|
|
390
396
|
const alias = makeAlias(child, state);
|
|
391
397
|
resetAllMeta();
|
|
392
398
|
pushNode(alias);
|
|
@@ -451,8 +457,9 @@ function flattenBlockMapChildren(children, state, externalKeyColumn, externalKey
|
|
|
451
457
|
}
|
|
452
458
|
const trailingMeta = combinedPending();
|
|
453
459
|
if (hasMeta(trailingMeta)) {
|
|
460
|
+
const value = resolveScalar("", "plain", trailingMeta.tag, state);
|
|
454
461
|
const scalar = new YamlScalar({
|
|
455
|
-
value
|
|
462
|
+
value,
|
|
456
463
|
style: "plain",
|
|
457
464
|
offset: 0,
|
|
458
465
|
length: 0,
|
|
@@ -501,7 +508,7 @@ function buildPairs(items, pairs, text) {
|
|
|
501
508
|
const nullKey = new YamlScalar({
|
|
502
509
|
value: null,
|
|
503
510
|
style: "plain",
|
|
504
|
-
offset:
|
|
511
|
+
offset: valueSepOffset,
|
|
505
512
|
length: 0
|
|
506
513
|
});
|
|
507
514
|
pairs.push(new YamlPair({
|
|
@@ -513,7 +520,7 @@ function buildPairs(items, pairs, text) {
|
|
|
513
520
|
const nullKey = new YamlScalar({
|
|
514
521
|
value: null,
|
|
515
522
|
style: "plain",
|
|
516
|
-
offset:
|
|
523
|
+
offset: valueSepOffset,
|
|
517
524
|
length: 0
|
|
518
525
|
});
|
|
519
526
|
pairs.push(new YamlPair({
|
|
@@ -643,7 +650,8 @@ function keyIdentity(key, text) {
|
|
|
643
650
|
case "string": return `s:${v}`;
|
|
644
651
|
case "bigint": return `i:${v.toString()}`;
|
|
645
652
|
case "number": {
|
|
646
|
-
|
|
653
|
+
const raw = text.slice(key.offset, key.offset + key.length).trim();
|
|
654
|
+
let kind = classifyPlainNumeric(raw);
|
|
647
655
|
if (key.tag !== void 0) {
|
|
648
656
|
if (key.tag.includes("float")) kind = "float";
|
|
649
657
|
else if (key.tag.includes("int")) kind = "int";
|
|
@@ -1012,8 +1020,9 @@ function composeBlockSeqInner(cst, state, meta) {
|
|
|
1012
1020
|
if (child.type === "flow-scalar" && getScalarStyle(child) === "plain") {
|
|
1013
1021
|
const { value: merged, nextIdx: mergeEnd, partsCount, endOffset } = collectMultilinePlainScalar(children, ci, void 0, state.text);
|
|
1014
1022
|
if (partsCount > 1) {
|
|
1023
|
+
const resolved = resolveScalar(merged, "plain", pendingMeta.tag, state);
|
|
1015
1024
|
const scalar = new YamlScalar({
|
|
1016
|
-
value:
|
|
1025
|
+
value: resolved,
|
|
1017
1026
|
style: "plain",
|
|
1018
1027
|
offset: child.offset,
|
|
1019
1028
|
length: endOffset - child.offset,
|
|
@@ -1100,8 +1109,9 @@ function composeBlockSeqInner(cst, state, meta) {
|
|
|
1100
1109
|
length: 0
|
|
1101
1110
|
}));
|
|
1102
1111
|
if (hasMeta(pendingMeta)) {
|
|
1112
|
+
const value = resolveScalar("", "plain", pendingMeta.tag, state);
|
|
1103
1113
|
const scalar = new YamlScalar({
|
|
1104
|
-
value
|
|
1114
|
+
value,
|
|
1105
1115
|
style: "plain",
|
|
1106
1116
|
offset: 0,
|
|
1107
1117
|
length: 0,
|
|
@@ -1138,11 +1148,12 @@ function composeFlatBlockMap(children, startIdx, parentCst, state, externalFirst
|
|
|
1138
1148
|
if (state.options.uniqueKeys) checkDuplicateKeys(pairs, state);
|
|
1139
1149
|
checkMultilineImplicitKeys(pairs, state);
|
|
1140
1150
|
const offset = "offset" in externalFirstKey ? externalFirstKey.offset : parentCst.offset;
|
|
1151
|
+
const end = parentCst.offset + parentCst.length;
|
|
1141
1152
|
const map = new YamlMap({
|
|
1142
1153
|
items: pairs,
|
|
1143
1154
|
style: "block",
|
|
1144
1155
|
offset,
|
|
1145
|
-
length:
|
|
1156
|
+
length: end - offset,
|
|
1146
1157
|
...meta?.tag !== void 0 ? { tag: meta.tag } : {},
|
|
1147
1158
|
...meta?.anchor !== void 0 ? { anchor: meta.anchor } : {},
|
|
1148
1159
|
...meta?.comment !== void 0 ? { comment: meta.comment } : {}
|
|
@@ -116,7 +116,8 @@ function composeFlowMapInner(cst, state, meta, parentBlockColumn) {
|
|
|
116
116
|
});
|
|
117
117
|
validateFlowContentIndent(cst, state, parentBlockColumn);
|
|
118
118
|
validateFlowSeparators(children, state, "{", "}");
|
|
119
|
-
|
|
119
|
+
const items = flattenFlowChildren(children.filter((c) => !(c.type === "whitespace" && (c.source === "{" || c.source === "}" || c.source.trim() === ""))), state);
|
|
120
|
+
buildPairs(items, pairs, state.text);
|
|
120
121
|
if (state.options.uniqueKeys) checkDuplicateKeys(pairs, state);
|
|
121
122
|
const map = new YamlMap({
|
|
122
123
|
items: pairs,
|
|
@@ -140,8 +141,9 @@ function flattenFlowChildren(children, state) {
|
|
|
140
141
|
if (child.type === "whitespace") {
|
|
141
142
|
if (child.source === ",") {
|
|
142
143
|
if (hasMeta(pendingMeta)) {
|
|
144
|
+
const value = resolveScalar("", "plain", pendingMeta.tag, state);
|
|
143
145
|
const scalar = new YamlScalar({
|
|
144
|
-
value
|
|
146
|
+
value,
|
|
145
147
|
style: "plain",
|
|
146
148
|
offset: child.offset,
|
|
147
149
|
length: 0,
|
|
@@ -159,8 +161,9 @@ function flattenFlowChildren(children, state) {
|
|
|
159
161
|
}
|
|
160
162
|
if (child.source === ":") {
|
|
161
163
|
if (hasMeta(pendingMeta)) {
|
|
164
|
+
const value = resolveScalar("", "plain", pendingMeta.tag, state);
|
|
162
165
|
const scalar = new YamlScalar({
|
|
163
|
-
value
|
|
166
|
+
value,
|
|
164
167
|
style: "plain",
|
|
165
168
|
offset: child.offset,
|
|
166
169
|
length: 0,
|
|
@@ -225,8 +228,9 @@ function flattenFlowChildren(children, state) {
|
|
|
225
228
|
if (child.type === "flow-scalar" && getScalarStyle(child) === "plain") {
|
|
226
229
|
if (hasValueSepThroughPlainScalars(children, i + 1)) {
|
|
227
230
|
const { value, nextIdx } = collectMultilineKey(children, i);
|
|
231
|
+
const resolved = resolveScalar(value, "plain", pendingMeta.tag, state);
|
|
228
232
|
const scalar = new YamlScalar({
|
|
229
|
-
value:
|
|
233
|
+
value: resolved,
|
|
230
234
|
style: "plain",
|
|
231
235
|
offset: child.offset,
|
|
232
236
|
length: child.length,
|
|
@@ -243,8 +247,9 @@ function flattenFlowChildren(children, state) {
|
|
|
243
247
|
continue;
|
|
244
248
|
}
|
|
245
249
|
const { value, nextIdx, partsCount, endOffset } = collectMultilinePlainScalar(children, i, void 0, state.text);
|
|
250
|
+
const resolved = resolveScalar(value, "plain", pendingMeta.tag, state);
|
|
246
251
|
const scalar = new YamlScalar({
|
|
247
|
-
value:
|
|
252
|
+
value: resolved,
|
|
248
253
|
style: "plain",
|
|
249
254
|
offset: child.offset,
|
|
250
255
|
length: partsCount > 1 ? endOffset - child.offset : child.length,
|
|
@@ -297,8 +302,9 @@ function flattenFlowChildren(children, state) {
|
|
|
297
302
|
}
|
|
298
303
|
}
|
|
299
304
|
if (hasMeta(pendingMeta)) {
|
|
305
|
+
const value = resolveScalar("", "plain", pendingMeta.tag, state);
|
|
300
306
|
const scalar = new YamlScalar({
|
|
301
|
-
value
|
|
307
|
+
value,
|
|
302
308
|
style: "plain",
|
|
303
309
|
offset: 0,
|
|
304
310
|
length: 0,
|
|
@@ -265,10 +265,11 @@ function foldFlowLines(text) {
|
|
|
265
265
|
}
|
|
266
266
|
const isLast = i === lines.length - 1;
|
|
267
267
|
const trimmed = isLast ? line.trimStart() : line.trim();
|
|
268
|
-
if (trimmed === "")
|
|
269
|
-
if (
|
|
270
|
-
|
|
271
|
-
|
|
268
|
+
if (trimmed === "") {
|
|
269
|
+
if (isLast) {
|
|
270
|
+
if (result.length === 0 || result[result.length - 1] !== "\n") result += " ";
|
|
271
|
+
} else result += "\n";
|
|
272
|
+
} else {
|
|
272
273
|
if (result.length > 0 && result[result.length - 1] !== "\n") result += " ";
|
|
273
274
|
result += trimmed;
|
|
274
275
|
}
|
|
@@ -681,8 +682,10 @@ function decodeBlockScalar(raw, fullText, nodeOffset) {
|
|
|
681
682
|
} else break;
|
|
682
683
|
}
|
|
683
684
|
while (i < raw.length && raw[i] !== "\n" && raw[i] !== "\r") i++;
|
|
684
|
-
if (i < raw.length)
|
|
685
|
-
|
|
685
|
+
if (i < raw.length) {
|
|
686
|
+
if (raw[i] === "\r" && raw[i + 1] === "\n") i += 2;
|
|
687
|
+
else i++;
|
|
688
|
+
}
|
|
686
689
|
let contentIndent = explicitIndent;
|
|
687
690
|
let foundContent = explicitIndent > 0;
|
|
688
691
|
if (explicitIndent > 0 && fullText !== void 0 && nodeOffset !== void 0) {
|
|
@@ -745,8 +748,10 @@ function decodeBlockScalar(raw, fullText, nodeOffset) {
|
|
|
745
748
|
trailingNewlines.length = 0;
|
|
746
749
|
lines.push(" ".repeat(spaces - contentIndent));
|
|
747
750
|
} else trailingNewlines.push("");
|
|
748
|
-
if (i < raw.length)
|
|
749
|
-
|
|
751
|
+
if (i < raw.length) {
|
|
752
|
+
if (raw[i] === "\r" && i + 1 < raw.length && raw[i + 1] === "\n") i += 2;
|
|
753
|
+
else i++;
|
|
754
|
+
}
|
|
750
755
|
continue;
|
|
751
756
|
}
|
|
752
757
|
if (spaces < contentIndent) break;
|
|
@@ -756,8 +761,10 @@ function decodeBlockScalar(raw, fullText, nodeOffset) {
|
|
|
756
761
|
const contentStart = i;
|
|
757
762
|
while (i < raw.length && raw[i] !== "\n" && raw[i] !== "\r") i++;
|
|
758
763
|
lines.push(extra + raw.slice(contentStart, i));
|
|
759
|
-
if (i < raw.length)
|
|
760
|
-
|
|
764
|
+
if (i < raw.length) {
|
|
765
|
+
if (raw[i] === "\r" && i + 1 < raw.length && raw[i + 1] === "\n") i += 2;
|
|
766
|
+
else i++;
|
|
767
|
+
}
|
|
761
768
|
}
|
|
762
769
|
let value;
|
|
763
770
|
if (isFolded) {
|
|
@@ -773,9 +780,10 @@ function decodeBlockScalar(raw, fullText, nodeOffset) {
|
|
|
773
780
|
prevMoreIndented = isMoreIndented;
|
|
774
781
|
hadContent = true;
|
|
775
782
|
} else {
|
|
776
|
-
if (result[result.length - 1] === "\n")
|
|
777
|
-
|
|
778
|
-
|
|
783
|
+
if (result[result.length - 1] === "\n") {
|
|
784
|
+
if (isMoreIndented || prevMoreIndented) result += `\n${ln}`;
|
|
785
|
+
else result += ln;
|
|
786
|
+
} else if (isMoreIndented || prevMoreIndented) result += `\n${ln}`;
|
|
779
787
|
else result += ` ${ln}`;
|
|
780
788
|
prevMoreIndented = isMoreIndented;
|
|
781
789
|
}
|
|
@@ -809,8 +817,10 @@ function validateBlockScalarLeadingEmpties(cst, state) {
|
|
|
809
817
|
const raw = cst.source;
|
|
810
818
|
let i = 0;
|
|
811
819
|
while (i < raw.length && raw[i] !== "\n" && raw[i] !== "\r") i++;
|
|
812
|
-
if (i < raw.length)
|
|
813
|
-
|
|
820
|
+
if (i < raw.length) {
|
|
821
|
+
if (raw[i] === "\r" && raw[i + 1] === "\n") i += 2;
|
|
822
|
+
else i++;
|
|
823
|
+
}
|
|
814
824
|
const emptyIndents = [];
|
|
815
825
|
while (i < raw.length) {
|
|
816
826
|
const lineStart = i;
|
|
@@ -824,8 +834,10 @@ function validateBlockScalarLeadingEmpties(cst, state) {
|
|
|
824
834
|
indent: spaces,
|
|
825
835
|
offsetInRaw: lineStart
|
|
826
836
|
});
|
|
827
|
-
if (i < raw.length)
|
|
828
|
-
|
|
837
|
+
if (i < raw.length) {
|
|
838
|
+
if (raw[i] === "\r" && raw[i + 1] === "\n") i += 2;
|
|
839
|
+
else i++;
|
|
840
|
+
}
|
|
829
841
|
continue;
|
|
830
842
|
}
|
|
831
843
|
const contentIndent = spaces;
|
package/internal/cst-parser.js
CHANGED
|
@@ -286,12 +286,14 @@ function parseBlockMappingInner(state, indent) {
|
|
|
286
286
|
continue;
|
|
287
287
|
}
|
|
288
288
|
if (token.kind === "block-map-key") {
|
|
289
|
+
if (token.column < indent && children.length > 0) break;
|
|
289
290
|
sawExplicitKey = true;
|
|
290
291
|
const leaf = consumeLeafToken(state);
|
|
291
292
|
if (leaf) children.push(leaf);
|
|
292
293
|
continue;
|
|
293
294
|
}
|
|
294
295
|
if (token.kind === "block-map-value") {
|
|
296
|
+
if (token.column < indent && children.length > 0) break;
|
|
295
297
|
const leaf = consumeLeafToken(state);
|
|
296
298
|
if (leaf) children.push(leaf);
|
|
297
299
|
children.push(...parseBlockValue(state, indent, sawExplicitKey));
|
|
@@ -357,7 +359,7 @@ function parseBlockMappingInner(state, indent) {
|
|
|
357
359
|
/**
|
|
358
360
|
* Parse the value part after a ":" in a block mapping.
|
|
359
361
|
*/
|
|
360
|
-
function parseBlockValue(state,
|
|
362
|
+
function parseBlockValue(state, parentIndent, explicitKey = false) {
|
|
361
363
|
const nodes = [];
|
|
362
364
|
while (!atEnd(state)) {
|
|
363
365
|
const token = peek(state);
|
|
@@ -385,6 +387,10 @@ function parseBlockValue(state, _parentIndent, explicitKey = false) {
|
|
|
385
387
|
nodes.push(parseBlockSequence(state, seqIndent));
|
|
386
388
|
break;
|
|
387
389
|
}
|
|
390
|
+
if (explicitKey && token.kind === "scalar" && !isBlockScalarToken(state) && hasImplicitMapAhead(state, parentIndent)) {
|
|
391
|
+
nodes.push(parseImplicitBlockMapping(state, parentIndent));
|
|
392
|
+
break;
|
|
393
|
+
}
|
|
388
394
|
if (token.kind === "scalar" || token.kind === "anchor" || token.kind === "alias" || token.kind === "tag") {
|
|
389
395
|
const leaf = consumeLeafToken(state);
|
|
390
396
|
if (leaf) nodes.push(leaf);
|
|
@@ -540,11 +546,13 @@ function parseImplicitBlockMappingInner(state, seqIndent) {
|
|
|
540
546
|
if (!token) break;
|
|
541
547
|
if (isDocumentBoundary(token)) break;
|
|
542
548
|
if (token.kind === "block-seq-entry" && token.column <= seqIndent) break;
|
|
549
|
+
if (token.kind === "block-map-key" && token.column <= seqIndent) break;
|
|
543
550
|
if (isTrivia(token)) {
|
|
544
551
|
children.push(...consumeTrivia(state));
|
|
545
552
|
continue;
|
|
546
553
|
}
|
|
547
554
|
if (token.kind === "block-map-value") {
|
|
555
|
+
if (token.column <= seqIndent && children.length > 0) break;
|
|
548
556
|
const leaf = consumeLeafToken(state);
|
|
549
557
|
if (leaf) children.push(leaf);
|
|
550
558
|
children.push(...parseBlockValue(state, seqIndent));
|
package/internal/lexer.js
CHANGED
|
@@ -216,14 +216,15 @@ function createScanner(text) {
|
|
|
216
216
|
let value = "";
|
|
217
217
|
while (pos < text.length) {
|
|
218
218
|
const ch = peek();
|
|
219
|
-
if (ch === "'")
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
219
|
+
if (ch === "'") {
|
|
220
|
+
if (peek(1) === "'") {
|
|
221
|
+
value += "'";
|
|
222
|
+
advance(2);
|
|
223
|
+
} else {
|
|
224
|
+
advance();
|
|
225
|
+
return makeToken("scalar", value, start, sLine, sCol, pos - start);
|
|
226
|
+
}
|
|
227
|
+
} else if (ch === "\n" || ch === "\r" && peek(1) === "\n") {
|
|
227
228
|
value += " ";
|
|
228
229
|
if (ch === "\r") advance(2);
|
|
229
230
|
else advance();
|
|
@@ -402,13 +403,17 @@ function createScanner(text) {
|
|
|
402
403
|
hadHeaderWhitespace = true;
|
|
403
404
|
advance();
|
|
404
405
|
}
|
|
405
|
-
if (pos < text.length && !isNewline(peek()) && peek() !== "")
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
406
|
+
if (pos < text.length && !isNewline(peek()) && peek() !== "") {
|
|
407
|
+
if (peek() === "#" && hadHeaderWhitespace) while (pos < text.length && !isNewline(peek())) advance();
|
|
408
|
+
else {
|
|
409
|
+
while (pos < text.length && !isNewline(peek())) advance();
|
|
410
|
+
return makeToken("error", text.slice(start, pos), start, sLine, sCol);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
if (pos < text.length && isNewline(peek())) {
|
|
414
|
+
if (peek() === "\r" && peek(1) === "\n") advance(2);
|
|
415
|
+
else advance();
|
|
409
416
|
}
|
|
410
|
-
if (pos < text.length && isNewline(peek())) if (peek() === "\r" && peek(1) === "\n") advance(2);
|
|
411
|
-
else advance();
|
|
412
417
|
let contentIndent = explicitIndent;
|
|
413
418
|
let foundContent = explicitIndent > 0;
|
|
414
419
|
if (explicitIndent > 0) {
|
|
@@ -564,9 +569,10 @@ function createScanner(text) {
|
|
|
564
569
|
prevMoreIndented = isMoreIndented;
|
|
565
570
|
hadContent = true;
|
|
566
571
|
} else {
|
|
567
|
-
if (result[result.length - 1] === "\n")
|
|
568
|
-
|
|
569
|
-
|
|
572
|
+
if (result[result.length - 1] === "\n") {
|
|
573
|
+
if (isMoreIndented || prevMoreIndented) result += `\n${ln}`;
|
|
574
|
+
else result += ln;
|
|
575
|
+
} else if (isMoreIndented || prevMoreIndented) result += `\n${ln}`;
|
|
570
576
|
else result += ` ${ln}`;
|
|
571
577
|
prevMoreIndented = isMoreIndented;
|
|
572
578
|
}
|
package/internal/stringifier.js
CHANGED
|
@@ -98,10 +98,12 @@ function requiresQuoting(s, ignoreType = false) {
|
|
|
98
98
|
if (!ignoreType && wouldBeResolved(s)) return true;
|
|
99
99
|
const first = s[0];
|
|
100
100
|
if (first === " " || first === " ") return true;
|
|
101
|
-
if (first !== void 0 && INDICATOR_CHARS.has(first))
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
if (first !== void 0 && INDICATOR_CHARS.has(first)) {
|
|
102
|
+
if (first === ":" || first === "?" || first === "-") {
|
|
103
|
+
const second = s[1];
|
|
104
|
+
if (s.length === 1 || second === " " || second === " ") return true;
|
|
105
|
+
} else return true;
|
|
106
|
+
}
|
|
105
107
|
if (s.startsWith("---") || s.startsWith("...")) return true;
|
|
106
108
|
if (s.includes(": ") || s.includes(": ") || s.endsWith(":")) return true;
|
|
107
109
|
if (s.includes(" #") || s.includes(" #")) return true;
|
|
@@ -132,14 +134,15 @@ function renderDoubleQuoted(s, canonical = false) {
|
|
|
132
134
|
let result = "";
|
|
133
135
|
for (let i = 0; i < escaped.length; i++) {
|
|
134
136
|
const code = escaped.charCodeAt(i);
|
|
135
|
-
if (isControlChar(code))
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
137
|
+
if (isControlChar(code)) {
|
|
138
|
+
if (code === 0) result += "\\0";
|
|
139
|
+
else if (code === 7) result += "\\a";
|
|
140
|
+
else if (code === 8) result += "\\b";
|
|
141
|
+
else if (code === 11) result += "\\v";
|
|
142
|
+
else if (code === 12) result += "\\f";
|
|
143
|
+
else if (code === 27) result += "\\e";
|
|
144
|
+
else result += `\\x${code.toString(16).padStart(2, "0")}`;
|
|
145
|
+
} else if (canonical && code > 126) {
|
|
143
146
|
if (code >= 55296 && code <= 56319 && i + 1 < escaped.length) {
|
|
144
147
|
const low = escaped.charCodeAt(i + 1);
|
|
145
148
|
if (low >= 56320 && low <= 57343) {
|
|
@@ -534,9 +537,10 @@ function stringifyScalarNodeLines(node, ctx) {
|
|
|
534
537
|
return [parts.join(" ")];
|
|
535
538
|
}
|
|
536
539
|
let lines;
|
|
537
|
-
if (val === null || val === void 0)
|
|
538
|
-
|
|
539
|
-
|
|
540
|
+
if (val === null || val === void 0) {
|
|
541
|
+
if (isEmpty) lines = [""];
|
|
542
|
+
else lines = ["null"];
|
|
543
|
+
} else if (typeof val === "boolean") lines = [val ? "true" : "false"];
|
|
540
544
|
else if (typeof val === "number") lines = [node.raw !== void 0 ? node.raw : renderNumber(val)];
|
|
541
545
|
else if (typeof val === "string") lines = renderString(val, style, " ".repeat(ctx.indent), !!node.tag, ctx.forceDefaultStyles, node.chomp, ctx.parentPosition, ctx.quoteStyle).split("\n");
|
|
542
546
|
else lines = [renderDoubleQuoted(String(val))];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effected/yaml",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Zero-dependency YAML parsing, editing and formatting as Effect schemas.",
|
|
6
6
|
"keywords": [
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"./package.json": "./package.json"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"effect": "4.0.0-beta.
|
|
43
|
+
"effect": "4.0.0-beta.107"
|
|
44
44
|
},
|
|
45
45
|
"engines": {
|
|
46
46
|
"node": ">=24.11.0"
|