From 0006c7750293156fc601551c251724d6b24f42e9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 26 Aug 2026 18:01:20 +0000 Subject: [PATCH 1/2] Bump the npm-minor group across 1 directory with 2 updates Bumps the npm-minor group with 2 updates in the / directory: [js-yaml](https://github.com/nodeca/js-yaml) and [uuid](https://github.com/uuidjs/uuid). Updates `js-yaml` from 5.2.3 to 5.3.0 - [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md) - [Commits](https://github.com/nodeca/js-yaml/compare/5.2.3...5.3.0) Updates `uuid` from 14.0.1 to 14.0.2 - [Release notes](https://github.com/uuidjs/uuid/releases) - [Changelog](https://github.com/uuidjs/uuid/blob/main/CHANGELOG.md) - [Commits](https://github.com/uuidjs/uuid/compare/v14.0.1...v14.0.2) --- updated-dependencies: - dependency-name: js-yaml dependency-version: 5.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor - dependency-name: uuid dependency-version: 14.0.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: npm-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 16 ++++++++-------- package.json | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2ef7d4791f..819a0f77e7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,13 +31,13 @@ "follow-redirects": "^1.16.0", "get-folder-size": "^5.0.0", "https-proxy-agent": "^7.0.6", - "js-yaml": "^5.2.3", + "js-yaml": "^5.3.0", "jsonschema": "1.5.0", "long": "^5.3.2", "node-forge": "^1.4.0", "semver": "^7.8.5", "undici": "^6.28.0", - "uuid": "^14.0.1" + "uuid": "^14.0.2" }, "devDependencies": { "@ava/typescript": "6.0.0", @@ -7010,9 +7010,9 @@ } }, "node_modules/js-yaml": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-5.2.3.tgz", - "integrity": "sha512-n+mUVyUX5bVv7G/G2zyIHOhdxfuU1dY2NOFzTQUWiMUbFss8b57NFlgCCaggU78wSw5KVS9cllzeLyzyR+n5nw==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-5.3.0.tgz", + "integrity": "sha512-muutsYr+e2+d3rTgUGslq5rxbBlUy3cJ61IsHag2QNDQV+7zXWjkUpmALIajhrlLlrgRUiymj6U3zUr/TMK84Q==", "funding": [ { "type": "github", @@ -9528,9 +9528,9 @@ "license": "MIT" }, "node_modules/uuid": { - "version": "14.0.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-14.0.1.tgz", - "integrity": "sha512-6ZxzVpzDXDa3bJWaHilVayA+BH/1zmxCJoVgvmqJnid/gPoKHxUrS/aC/T6LGQtNHT+XHG9fXPJB4d+IrU30Ew==", + "version": "14.0.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-14.0.2.tgz", + "integrity": "sha512-xZe/16rV4aa+HGSOCiY2YeLT1OybRLrrkL/Rqaq7p7GMVXjFh+6wN4oMYgjFmnSnhY8t6Xpdl2l9qmnHYuMHwQ==", "funding": [ "https://github.com/sponsors/broofa", "https://github.com/sponsors/ctavan" diff --git a/package.json b/package.json index 4eaef40a68..ba08815e3c 100644 --- a/package.json +++ b/package.json @@ -39,12 +39,12 @@ "follow-redirects": "^1.16.0", "get-folder-size": "^5.0.0", "https-proxy-agent": "^7.0.6", - "js-yaml": "^5.2.3", + "js-yaml": "^5.3.0", "jsonschema": "1.5.0", "long": "^5.3.2", "node-forge": "^1.4.0", "semver": "^7.8.5", - "uuid": "^14.0.1", + "uuid": "^14.0.2", "undici": "^6.28.0" }, "devDependencies": { From d75af13705aededf06c4151ea4a0803574589d32 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 26 Aug 2026 18:03:17 +0000 Subject: [PATCH 2/2] Rebuild --- lib/entry-points.js | 403 +++++++++++++++++++++++++++----------------- 1 file changed, 252 insertions(+), 151 deletions(-) diff --git a/lib/entry-points.js b/lib/entry-points.js index a9b26925a2..0fd400bd7a 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -142283,7 +142283,6 @@ async function core(rootItemPath, options = {}, returnType = {}) { // node_modules/js-yaml/dist/js-yaml.mjs var NOT_RESOLVED = /* @__PURE__ */ Symbol("NOT_RESOLVED"); -var MERGE_KEY = /* @__PURE__ */ Symbol("MERGE_KEY"); function defineScalarTag(tagName, options) { return { tagName, @@ -142292,9 +142291,9 @@ function defineScalarTag(tagName, options) { matchByTagPrefix: options.matchByTagPrefix ?? false, implicitFirstChars: options.implicitFirstChars ?? null, resolve: options.resolve, - identify: options.identify ?? null, + identify: options.identify, represent: options.represent ?? ((data) => String(data)), - representTagName: options.representTagName ?? null + representTagName: options.representTagName ?? (() => tagName) }; } function defineSequenceTag(tagName, options) { @@ -142308,9 +142307,9 @@ function defineSequenceTag(tagName, options) { addItem: options.addItem, finalize: options.finalize ?? ((carrier) => carrier), carrierIsResult, - identify: options.identify ?? null, + identify: options.identify, represent: options.represent ?? ((data) => data), - representTagName: options.representTagName ?? null + representTagName: options.representTagName ?? (() => tagName) }; } function defineMappingTag(tagName, options) { @@ -142327,9 +142326,9 @@ function defineMappingTag(tagName, options) { get: options.get, finalize: options.finalize ?? ((carrier) => carrier), carrierIsResult, - identify: options.identify ?? null, + identify: options.identify, represent: options.represent ?? ((data) => data), - representTagName: options.representTagName ?? null + representTagName: options.representTagName ?? (() => tagName) }; } var strTag = defineScalarTag("tag:yaml.org,2002:str", { @@ -142678,9 +142677,10 @@ var mergeTag = defineScalarTag("tag:yaml.org,2002:merge", { implicit: true, implicitFirstChars: ["<"], resolve: (source, isExplicit) => { - if (source === "<<" || isExplicit && source === "") return MERGE_KEY; + if (source === "<<" || isExplicit && source === "") return "<<"; return NOT_RESOLVED; - } + }, + identify: () => false }); var BASE64_PATTERN = /^[A-Za-z0-9+/]*={0,2}$/; function resolveYamlBinary(source) { @@ -142785,7 +142785,8 @@ var omapTag = defineSequenceTag("tag:yaml.org,2002:omap", { carrier.list.push(item); return ""; }, - finalize: (carrier) => carrier.list + finalize: (carrier) => carrier.list, + identify: () => false }); var pairsTag = defineSequenceTag("tag:yaml.org,2002:pairs", { create: () => [], @@ -142801,7 +142802,8 @@ var pairsTag = defineSequenceTag("tag:yaml.org,2002:pairs", { if (keys.length !== 1) return "cannot resolve a pairs item"; container.push([keys[0], object2[keys[0]]]); return ""; - } + }, + identify: () => false }); var mapTag = defineMappingTag("tag:yaml.org,2002:map", { create: () => ({}), @@ -142882,11 +142884,35 @@ function compileTags(tags) { } var Schema = class Schema2 { tags; + /** @internal */ implicitScalarTags; + /** + * Dispatch implicit scalar resolvers by `source.charAt(0)`. Each bucket holds + * the resolvers that may match that key, in schema order; a key absent from + * the map uses + * {@link Schema.implicitScalarAnyFirstChar} + * (resolvers that declared no first-char constraint, so they apply to any + * first character). + */ implicitScalarByFirstChar; implicitScalarAnyFirstChar; + /** + * The default scalar tag (`!!str`), resolved once so the composer's fallback + * for unresolved plain scalars avoids a keyed lookup per scalar. + * + * @internal + */ defaultScalarTag; + /** + * The default container tags (`!!seq` / `!!map`), used by the dumper: when a + * value is identified by its default tag, the tag is implicit and not + * printed. Undefined if the schema does not define them (then such values + * can't be dumped). + * + * @internal + */ defaultSequenceTag; + /** @internal */ defaultMappingTag; exact; prefix; @@ -142932,6 +142958,52 @@ var Schema = class Schema2 { this.exact = exact; this.prefix = prefix; } + /** @internal */ + lookupScalarTag(tagName) { + const exactTag = this.exact.scalar[tagName]; + if (exactTag) return exactTag; + for (const tag of this.prefix.scalar) if (tagName.startsWith(tag.tagName)) return tag; + } + /** @internal */ + lookupSequenceTag(tagName) { + const exactTag = this.exact.sequence[tagName]; + if (exactTag) return exactTag; + for (const tag of this.prefix.sequence) if (tagName.startsWith(tag.tagName)) return tag; + } + /** @internal */ + lookupMappingTag(tagName) { + const exactTag = this.exact.mapping[tagName]; + if (exactTag) return exactTag; + for (const tag of this.prefix.mapping) if (tagName.startsWith(tag.tagName)) return tag; + } + /** @internal */ + resolveImplicitScalarTag(source) { + const candidates = this.implicitScalarByFirstChar.get(source.charAt(0)) ?? this.implicitScalarAnyFirstChar; + for (const tag2 of candidates) { + const value = tag2.resolve(source, false, tag2.tagName); + if (value !== NOT_RESOLVED) return { + value, + tag: tag2 + }; + } + const tag = this.defaultScalarTag; + return { + value: tag.resolve(source, false, tag.tagName), + tag + }; + } + /** + * Creates a new schema with the specified tags added. If a tag already + * exists, it is replaced by the specified tag. + * + * @example + * + * ```javascript + * import { CORE_SCHEMA, mergeTag, realMapTag } from 'js-yaml' + * + * const schema = CORE_SCHEMA.withTags(mergeTag, realMapTag) + * ``` + */ withTags(...tags) { let flatTags = []; for (const tag of tags) flatTags = flatTags.concat(tag); @@ -142970,6 +143042,19 @@ var YAML11_SCHEMA = new Schema([ pairsTag, setTag ]); +var DUMP_SCHEMA = YAML11_SCHEMA.withTags({ + ...intYaml11Tag, + resolve: (source, isExplicit, tagName) => { + const result = intYaml11Tag.resolve(source, isExplicit, tagName); + return result === NOT_RESOLVED ? intCoreTag.resolve(source, isExplicit, tagName) : result; + } +}, { + ...floatYaml11Tag, + resolve: (source, isExplicit, tagName) => { + const result = floatYaml11Tag.resolve(source, isExplicit, tagName); + return result === NOT_RESOLVED ? floatCoreTag.resolve(source, isExplicit, tagName) : result; + } +}); var realMapTag = defineMappingTag("tag:yaml.org,2002:map", { create: () => /* @__PURE__ */ new Map(), addPair: (container, key, value) => { @@ -143106,9 +143191,13 @@ function formatError(exception, compact) { ${exception.mark.snippet}`; return `${exception.reason} ${where}`; } -var YAMLException = class extends Error { +var YAMLException = class YAMLException2 extends Error { reason; mark; + /** + * Optional `mark` contains source snippet data. Usually, use + * {@link YAMLException.throwAt} instead of passing it directly. + */ constructor(reason, mark) { super(); this.name = "YAMLException"; @@ -143117,34 +143206,65 @@ var YAMLException = class extends Error { this.message = formatError(this, false); if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor); } + /** + * Returns the formatted error, omitting the source snippet in compact mode. + */ toString(compact) { return `${this.name}: ${formatError(this, compact)}`; } -}; -function throwErrorAt(source, position, message, filename = "") { - let line = 0; - let lineStart = 0; - for (let index2 = 0; index2 < position; index2++) { - const ch = source.charCodeAt(index2); - if (ch === 10) { - line++; - lineStart = index2 + 1; - } else if (ch === 13) { - line++; - if (source.charCodeAt(index2 + 1) === 10) index2++; - lineStart = index2 + 1; - } + /** + * Builds a YAMLException with a source snippet and throws it. `source` is + * the raw input text; `position` is an offset into it. + */ + static throwAt(source, position, message, filename = "") { + let line = 0; + let lineStart = 0; + for (let index2 = 0; index2 < position; index2++) { + const ch = source.charCodeAt(index2); + if (ch === 10) { + line++; + lineStart = index2 + 1; + } else if (ch === 13) { + line++; + if (source.charCodeAt(index2 + 1) === 10) index2++; + lineStart = index2 + 1; + } + } + const mark = { + name: filename, + buffer: source, + position, + line, + column: position - lineStart + }; + mark.snippet = makeSnippet(mark); + throw new YAMLException2(message, mark); } - const mark = { - name: filename, - buffer: source, - position, - line, - column: position - lineStart - }; - mark.snippet = makeSnippet(mark); - throw new YAMLException(message, mark); -} +}; +var EVENT_ID = { + DOCUMENT: 1, + SEQUENCE: 2, + MAPPING: 3, + SCALAR: 4, + ALIAS: 5, + POP: 6 +}; +var SCALAR_STYLE = { + PLAIN: 1, + SINGLE_QUOTED: 2, + DOUBLE_QUOTED: 3, + LITERAL_BLOCK: 4, + FOLDED_BLOCK: 5 +}; +var COLLECTION_STYLE = { + BLOCK: 1, + FLOW: 2 +}; +var CHOMPING_MODE = { + CLIP: 1, + STRIP: 2, + KEEP: 3 +}; var NO_RANGE$3 = -1; function simpleEscapeSequence(c) { switch (c) { @@ -143342,8 +143462,8 @@ function getBlockValue(input, start, end, indent, chomping, folded) { didReadContent = true; emptyLines = 0; } - if (chomping === 3) result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines); - else if (chomping !== 2) { + if (chomping === CHOMPING_MODE.KEEP) result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines); + else if (chomping !== CHOMPING_MODE.STRIP) { if (didReadContent) result += "\n"; } return result; @@ -143353,13 +143473,13 @@ function getScalarValue(input, scalar) { const { valueStart, valueEnd } = scalar; if (scalar.fast) return input.slice(valueStart, valueEnd); switch (scalar.style) { - case 2: + case SCALAR_STYLE.SINGLE_QUOTED: return getSingleQuotedValue(input, valueStart, valueEnd); - case 3: + case SCALAR_STYLE.DOUBLE_QUOTED: return getDoubleQuotedValue(input, valueStart, valueEnd); - case 4: + case SCALAR_STYLE.LITERAL_BLOCK: return getBlockValue(input, valueStart, valueEnd, scalar.indent, scalar.chomping, false); - case 5: + case SCALAR_STYLE.FOLDED_BLOCK: return getBlockValue(input, valueStart, valueEnd, scalar.indent, scalar.chomping, true); default: return getPlainValue(input, valueStart, valueEnd); @@ -143389,6 +143509,7 @@ function tagNameShort(fullTag) { return `!<${tagPercentEncode(tag)}>`; } var NO_RANGE$2 = -1; +var MERGE_TAG_NAME = "tag:yaml.org,2002:merge"; var DEFAULT_CONSTRUCTOR_OPTIONS = { filename: "", schema: CORE_SCHEMA, @@ -143404,26 +143525,16 @@ function eventPosition$1(event) { return 0; } function throwError$1(state, message) { - throwErrorAt(state.source, state.position, message, state.filename); + YAMLException.throwAt(state.source, state.position, message, state.filename); } function finalizeCollection(state, position, tag, carrier) { try { return tag.finalize(carrier); } catch (error3) { if (error3 instanceof YAMLException) throw error3; - throwErrorAt(state.source, position, error3 instanceof Error ? error3.message : String(error3), state.filename); + YAMLException.throwAt(state.source, position, error3 instanceof Error ? error3.message : String(error3), state.filename); } } -function lookupTag(exact, prefix, tagName) { - const exactTag = exact[tagName]; - if (exactTag) return exactTag; - for (const tag of prefix) if (tagName.startsWith(tag.tagName)) return tag; -} -function findExplicitTag(state, exact, prefix, tagName, nodeKind) { - const tag = lookupTag(exact, prefix, tagName); - if (tag) return tag; - throwError$1(state, `unknown ${nodeKind} tag !<${tagName}>`); -} function constructScalar(state, event) { const source = getScalarValue(state.source, event); const rawTag = event.tagStart === NO_RANGE$2 ? "" : state.source.slice(event.tagStart, event.tagEnd); @@ -143434,7 +143545,7 @@ function constructScalar(state, event) { tag: strTag2 }; const tagName = tagNameFull(rawTag, state.tagHandlers); - const scalarTag = lookupTag(state.schema.exact.scalar, state.schema.prefix.scalar, tagName); + const scalarTag = state.schema.lookupScalarTag(tagName); if (scalarTag) { const result = scalarTag.resolve(source, true, tagName); if (result === NOT_RESOLVED) throwError$1(state, `cannot resolve a node with !<${tagName}> explicit tag`); @@ -143443,7 +143554,7 @@ function constructScalar(state, event) { tag: scalarTag }; } - const collectionTagDef = lookupTag(state.schema.exact.mapping, state.schema.prefix.mapping, tagName) ?? lookupTag(state.schema.exact.sequence, state.schema.prefix.sequence, tagName); + const collectionTagDef = state.schema.lookupMappingTag(tagName) ?? state.schema.lookupSequenceTag(tagName); if (collectionTagDef) { if (source !== "") throwError$1(state, `cannot resolve a node with !<${tagName}> explicit tag`); const carrier = collectionTagDef.create(tagName); @@ -143454,28 +143565,15 @@ function constructScalar(state, event) { } throwError$1(state, `unknown scalar tag !<${tagName}>`); } - if (event.style === 1) { - const candidates = state.schema.implicitScalarByFirstChar.get(source.charAt(0)) ?? state.schema.implicitScalarAnyFirstChar; - for (const tag of candidates) { - const result = tag.resolve(source, false, tag.tagName); - if (result !== NOT_RESOLVED) return { - value: result, - tag - }; - } - } + if (event.style === SCALAR_STYLE.PLAIN) return state.schema.resolveImplicitScalarTag(source); return { value: strTag2.resolve(source, false, strTag2.tagName), tag: strTag2 }; } -function collectionTag(state, event, exact, prefix, defaultTagName, nodeKind) { +function collectionTagName(state, event, defaultTagName) { const rawTag = event.tagStart === NO_RANGE$2 ? "" : state.source.slice(event.tagStart, event.tagEnd); - const tagName = rawTag === "" || rawTag === "!" ? defaultTagName : tagNameFull(rawTag, state.tagHandlers); - return { - tagName, - tag: findExplicitTag(state, exact, prefix, tagName, nodeKind) - }; + return rawTag === "" || rawTag === "!" ? defaultTagName : tagNameFull(rawTag, state.tagHandlers); } function isMappingTag(tag) { return tag.nodeKind === "mapping"; @@ -143492,12 +143590,16 @@ function mergeKeys(state, frame, source, sourceTag) { function mergeSource(state, frame, source, sourceTag) { state.position = frame.keyPosition; if (isMappingTag(sourceTag)) mergeKeys(state, frame, source, sourceTag); - else if (sourceTag.nodeKind === "sequence" && Array.isArray(source)) for (const element of source) mergeKeys(state, frame, element, frame.tag); + else if (sourceTag.nodeKind === "sequence" && Array.isArray(source)) for (const element of source) { + const elementTag = state.nodeTags.get(element); + if (!elementTag) throwError$1(state, "cannot merge mappings; the provided source object is unacceptable"); + mergeKeys(state, frame, element, elementTag); + } else throwError$1(state, "cannot merge mappings; the provided source object is unacceptable"); } function addMappingValue(state, frame, key, value, tag) { state.position = frame.keyPosition; - if (key === MERGE_KEY) { + if (frame.keyIsMerge) { mergeSource(state, frame, value, tag); return; } @@ -143512,9 +143614,7 @@ function addValue(state, value, tag) { frame.value = value; frame.hasValue = true; } else if (frame.kind === "sequence") { - if (frame.merge) { - if (!isMappingTag(tag)) throwError$1(state, "cannot merge mappings; the provided source object is unacceptable"); - } + if (isMappingTag(tag)) state.nodeTags.set(value, tag); const err = frame.tag.addItem(frame.value, value, frame.index++); if (err) throwError$1(state, err); } else if (frame.hasKey) { @@ -143526,6 +143626,7 @@ function addValue(state, value, tag) { frame.key = value; frame.keyPosition = state.position; frame.hasKey = true; + frame.keyIsMerge = tag.tagName === MERGE_TAG_NAME; } } function storeAnchor(state, event, value, tag, isValueFinal) { @@ -143550,6 +143651,7 @@ function constructFromEvents(events, options) { position: 0, frames: [], anchors: /* @__PURE__ */ new Map(), + nodeTags: /* @__PURE__ */ new Map(), tagHandlers: /* @__PURE__ */ Object.create(null), totalMergeKeys: 0, aliasCount: 0 @@ -143558,8 +143660,9 @@ function constructFromEvents(events, options) { const event = state.events[state.eventIndex++]; state.position = eventPosition$1(event); switch (event.type) { - case 1: + case EVENT_ID.DOCUMENT: state.anchors = /* @__PURE__ */ new Map(); + state.nodeTags = /* @__PURE__ */ new Map(); state.aliasCount = 0; state.tagHandlers = /* @__PURE__ */ Object.create(null); for (const directive of event.directives) if (directive.kind === "tag") state.tagHandlers[directive.handle] = directive.prefix; @@ -143570,47 +143673,49 @@ function constructFromEvents(events, options) { hasValue: false }); break; - case 4: { + case EVENT_ID.SCALAR: { const { value, tag } = constructScalar(state, event); storeAnchor(state, event, value, tag, true); addValue(state, value, tag); break; } - case 2: { - const definition = collectionTag(state, event, state.schema.exact.sequence, state.schema.prefix.sequence, "tag:yaml.org,2002:seq", "sequence"); - const value = definition.tag.create(definition.tagName); - const anchor = storeAnchor(state, event, value, definition.tag, definition.tag.carrierIsResult); - const parent = state.frames[state.frames.length - 1]; - const merge2 = parent !== void 0 && parent.kind === "mapping" && parent.hasKey && parent.key === MERGE_KEY; + case EVENT_ID.SEQUENCE: { + const tagName = collectionTagName(state, event, "tag:yaml.org,2002:seq"); + const tag = state.schema.lookupSequenceTag(tagName); + if (!tag) throwError$1(state, `unknown sequence tag !<${tagName}>`); + const value = tag.create(tagName); + const anchor = storeAnchor(state, event, value, tag, tag.carrierIsResult); state.frames.push({ kind: "sequence", position: state.position, value, - tag: definition.tag, + tag, anchor, - index: 0, - merge: merge2 + index: 0 }); break; } - case 3: { - const definition = collectionTag(state, event, state.schema.exact.mapping, state.schema.prefix.mapping, "tag:yaml.org,2002:map", "mapping"); - const value = definition.tag.create(definition.tagName); - const anchor = storeAnchor(state, event, value, definition.tag, definition.tag.carrierIsResult); + case EVENT_ID.MAPPING: { + const tagName = collectionTagName(state, event, "tag:yaml.org,2002:map"); + const tag = state.schema.lookupMappingTag(tagName); + if (!tag) throwError$1(state, `unknown mapping tag !<${tagName}>`); + const value = tag.create(tagName); + const anchor = storeAnchor(state, event, value, tag, tag.carrierIsResult); state.frames.push({ kind: "mapping", position: state.position, value, - tag: definition.tag, + tag, anchor, key: void 0, keyPosition: state.position, hasKey: false, + keyIsMerge: false, overridable: null }); break; } - case 5: { + case EVENT_ID.ALIAS: { if (state.maxAliases !== -1 && ++state.aliasCount > state.maxAliases) throwError$1(state, `aliases exceeded maxAliases (${state.maxAliases})`); const name = state.source.slice(event.anchorStart, event.anchorEnd); const anchor = state.anchors.get(name); @@ -143619,7 +143724,7 @@ function constructFromEvents(events, options) { addValue(state, anchor.value, anchor.tag); break; } - case 6: { + case EVENT_ID.POP: { const frame = state.frames.pop(); if (frame.kind === "mapping" && frame.hasKey) { state.position = frame.keyPosition; @@ -143660,7 +143765,7 @@ var DEFAULT_PARSER_OPTIONS = { }; function addDocumentEvent(state, explicitStart, explicitEnd) { state.events.push({ - type: 1, + type: EVENT_ID.DOCUMENT, explicitStart, explicitEnd, directives: state.directives @@ -143668,7 +143773,7 @@ function addDocumentEvent(state, explicitStart, explicitEnd) { } function addSequenceEvent(state, start, anchorStart, anchorEnd, tagStart, tagEnd, style) { state.events.push({ - type: 2, + type: EVENT_ID.SEQUENCE, start, anchorStart, anchorEnd, @@ -143679,7 +143784,7 @@ function addSequenceEvent(state, start, anchorStart, anchorEnd, tagStart, tagEnd } function addMappingEvent(state, start, anchorStart, anchorEnd, tagStart, tagEnd, style) { state.events.push({ - type: 3, + type: EVENT_ID.MAPPING, start, anchorStart, anchorEnd, @@ -143690,18 +143795,18 @@ function addMappingEvent(state, start, anchorStart, anchorEnd, tagStart, tagEnd, } function insertFlowPairMappingEvent(state, snapshot) { state.events.splice(snapshot.eventsLength, 0, { - type: 3, + type: EVENT_ID.MAPPING, start: snapshot.position, anchorStart: NO_RANGE$1, anchorEnd: NO_RANGE$1, tagStart: NO_RANGE$1, tagEnd: NO_RANGE$1, - style: 2 + style: COLLECTION_STYLE.FLOW }); } -function addScalarEvent(state, valueStart, valueEnd, anchorStart, anchorEnd, tagStart, tagEnd, style, chomping = 1, indent = -1, fast = false) { +function addScalarEvent(state, valueStart, valueEnd, anchorStart, anchorEnd, tagStart, tagEnd, style, chomping = CHOMPING_MODE.CLIP, indent = -1, fast = false) { state.events.push({ - type: 4, + type: EVENT_ID.SCALAR, valueStart, valueEnd, anchorStart, @@ -143716,16 +143821,16 @@ function addScalarEvent(state, valueStart, valueEnd, anchorStart, anchorEnd, tag } function addAliasEvent(state, anchorStart, anchorEnd) { state.events.push({ - type: 5, + type: EVENT_ID.ALIAS, anchorStart, anchorEnd }); } function addPopEvent(state) { - state.events.push({ type: 6 }); + state.events.push({ type: EVENT_ID.POP }); } function addEmptyScalarEvent(state) { - addScalarEvent(state, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, 1); + addScalarEvent(state, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, SCALAR_STYLE.PLAIN); } function emptyProperties() { return { @@ -143754,7 +143859,7 @@ function restoreState(state, snapshot) { state.events.length = snapshot.eventsLength; } function throwError(state, message) { - throwErrorAt(state.input.slice(0, state.length), state.position, message, state.filename); + YAMLException.throwAt(state.input.slice(0, state.length), state.position, message, state.filename); } function isEol(c) { return c === 10 || c === 13; @@ -143922,7 +144027,7 @@ function readSingleQuotedScalar(state, nodeIndent, props) { } const end = state.position; state.position++; - addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, 2, 1, -1, simple); + addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, SCALAR_STYLE.SINGLE_QUOTED, CHOMPING_MODE.CLIP, -1, simple); return true; } if (isEol(ch)) { @@ -143944,7 +144049,7 @@ function readDoubleQuotedScalar(state, nodeIndent, props) { if (ch === 34) { const end = state.position; state.position++; - addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, 3, 1, -1, simple); + addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, SCALAR_STYLE.DOUBLE_QUOTED, CHOMPING_MODE.CLIP, -1, simple); return true; } if (ch === 92) { @@ -143972,18 +144077,18 @@ function readDoubleQuotedScalar(state, nodeIndent, props) { } function readBlockScalar(state, parentIndent, props) { const ch = state.input.charCodeAt(state.position); - let chomping = 1; + let chomping = CHOMPING_MODE.CLIP; let indent = -1; let detectedIndent = false; if (ch !== 124 && ch !== 62) return false; - const style = ch === 124 ? 4 : 5; + const style = ch === 124 ? SCALAR_STYLE.LITERAL_BLOCK : SCALAR_STYLE.FOLDED_BLOCK; state.position++; while (state.input.charCodeAt(state.position) !== 0) { const current = state.input.charCodeAt(state.position); const digit = fromDecimalCode(current); if (current === 43 || current === 45) { - if (chomping !== 1) throwError(state, "repeat of a chomping mode identifier"); - chomping = current === 43 ? 3 : 2; + if (chomping !== CHOMPING_MODE.CLIP) throwError(state, "repeat of a chomping mode identifier"); + chomping = current === 43 ? CHOMPING_MODE.KEEP : CHOMPING_MODE.STRIP; state.position++; } else if (digit >= 0) { if (digit === 0) throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one"); @@ -144098,7 +144203,7 @@ function readPlainScalar(state, nodeIndent, nodeContext, props) { } if (end === start) return false; checkPrintable(state, start, end); - addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, 1, 1, -1, !multiline); + addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, SCALAR_STYLE.PLAIN, CHOMPING_MODE.CLIP, -1, !multiline); return true; } function skipFlowSeparationSpace(state, nodeIndent) { @@ -144113,8 +144218,8 @@ function readFlowCollection(state, nodeIndent, props) { let readNext = true; if (ch !== 91 && ch !== 123) return false; const terminator = isMapping ? 125 : 93; - if (isMapping) addMappingEvent(state, start, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, 2); - else addSequenceEvent(state, start, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, 2); + if (isMapping) addMappingEvent(state, start, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.FLOW); + else addSequenceEvent(state, start, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.FLOW); state.position++; while (state.input.charCodeAt(state.position) !== 0) { skipFlowSeparationSpace(state, nodeIndent); @@ -144168,7 +144273,7 @@ function readFlowCollection(state, nodeIndent, props) { } function readBlockSequence(state, nodeIndent, props) { if (state.firstTabInLine !== -1 || state.input.charCodeAt(state.position) !== 45 || !isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) return false; - addSequenceEvent(state, state.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, 1); + addSequenceEvent(state, state.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.BLOCK); while (state.input.charCodeAt(state.position) === 45 && isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) { if (state.firstTabInLine !== -1) { state.position = state.firstTabInLine; @@ -144204,7 +144309,7 @@ function readBlockMapping(state, nodeIndent, flowIndent, props) { const entryLine = state.line; if ((ch === 63 || ch === 58) && isWsOrEolOrEnd(following)) { if (!mappingOpened) { - addMappingEvent(state, state.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, 1); + addMappingEvent(state, state.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.BLOCK); mappingOpened = true; } if (ch === 63) { @@ -144234,7 +144339,7 @@ function readBlockMapping(state, nodeIndent, flowIndent, props) { if (!isWsOrEolOrEnd(ch)) throwError(state, "a whitespace character is expected after the key-value separator within a block mapping"); if (!mappingOpened) { restoreState(state, beforeKey); - addMappingEvent(state, beforeKey.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, 1); + addMappingEvent(state, beforeKey.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.BLOCK); mappingOpened = true; parseNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true); ch = state.input.charCodeAt(state.position); @@ -144302,7 +144407,7 @@ function parseNode(state, parentIndent, nodeContext, allowToSeek, allowCompact, if (atNewLine && allowBlockStyles && (props.tagStart !== NO_RANGE$1 || props.anchorStart !== NO_RANGE$1) && (ch === 33 || ch === 38)) { const fallbackState = snapshotState(state); const flowIndent = parentIndent + 1; - if (readBlockMapping(state, state.position - state.lineStart, flowIndent, props) && state.events[fallbackState.eventsLength]?.type === 3) { + if (readBlockMapping(state, state.position - state.lineStart, flowIndent, props) && state.events[fallbackState.eventsLength]?.type === EVENT_ID.MAPPING) { state.depth--; return true; } @@ -144330,7 +144435,7 @@ function parseNode(state, parentIndent, nodeContext, allowToSeek, allowCompact, const fallbackState = snapshotState(state); const propertyIndent = propertyStart.position - propertyStart.lineStart; restoreState(state, propertyStart); - if (readBlockMapping(state, propertyIndent, flowIndent, emptyProperties()) && state.events[fallbackState.eventsLength]?.type === 3) hasContent = true; + if (readBlockMapping(state, propertyIndent, flowIndent, emptyProperties()) && state.events[fallbackState.eventsLength]?.type === EVENT_ID.MAPPING) hasContent = true; else restoreState(state, fallbackState); } if (!hasContent && (allowBlockScalars && readBlockScalar(state, flowIndent, props) || readSingleQuotedScalar(state, flowIndent, props) || readDoubleQuotedScalar(state, flowIndent, props) || readAlias(state, props) || readPlainScalar(state, flowIndent, nodeContext, props))) hasContent = true; @@ -144339,7 +144444,7 @@ function parseNode(state, parentIndent, nodeContext, allowToSeek, allowCompact, } allowBlockScalars = allowBlockScalars && !hasContent; if (!hasContent && (props.anchorStart !== NO_RANGE$1 || props.tagStart !== NO_RANGE$1 || allowBlockScalars)) { - addScalarEvent(state, NO_RANGE$1, NO_RANGE$1, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, 1); + addScalarEvent(state, NO_RANGE$1, NO_RANGE$1, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, SCALAR_STYLE.PLAIN); hasContent = true; } state.depth--; @@ -144424,7 +144529,7 @@ function readDocument(state) { } } const documentEvent = state.events[documentEventIndex]; - if (documentEvent?.type === 1) documentEvent.explicitEnd = explicitEnd; + if (documentEvent?.type === EVENT_ID.DOCUMENT) documentEvent.explicitEnd = explicitEnd; addPopEvent(state); if (!explicitEnd && state.position < state.length && !(state.position === state.lineStart && testDocumentSeparator(state))) throwError(state, "end of the stream or a document separator is expected"); } @@ -144446,7 +144551,7 @@ function parseEvents(input, options) { events: [] }; const nullpos = input.indexOf("\0"); - if (nullpos !== -1) throwErrorAt(input, nullpos, "null byte is not allowed in input", state.filename); + if (nullpos !== -1) YAMLException.throwAt(input, nullpos, "null byte is not allowed in input", state.filename); if (state.input.charCodeAt(state.position) === 65279) state.position++; while (state.position < state.length) { skipSeparationSpace(state, true); @@ -144482,6 +144587,7 @@ function load(input, options) { throw new YAMLException("expected a single document in the stream, but found more"); } var Style = class { + /** Whether to print the node's tag explicitly. */ tagged = false; flow = false; singleQuoted = false; @@ -144517,9 +144623,9 @@ function buildRepresentTypes(schema) { function matchTag(state, object2) { for (let index2 = 0, length = state.representTypes.length; index2 < length; index2 += 1) { const { tag, implicitTag } = state.representTypes[index2]; - if (tag.identify && tag.identify(object2)) { + if (tag.identify(object2)) { let tagName; - if (tag.matchByTagPrefix && tag.representTagName) tagName = tag.representTagName(object2); + if (tag.matchByTagPrefix) tagName = tag.representTagName(object2); else tagName = tag.tagName; return { tag, @@ -144719,8 +144825,7 @@ function createPresenterState(options) { }; return { ...opts, - defaultScalarTagName: opts.schema.defaultScalarTag.tagName, - implicitResolvers: opts.schema.implicitScalarTags + defaultScalarTagName: opts.schema.defaultScalarTag.tagName }; } function encodeNonPrintable(character) { @@ -144761,13 +144866,6 @@ function scalarLayout(state, level) { lineWidth: state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent) }; } -function resolveImplicitTag(state, str) { - for (let index2 = 0, length = state.implicitResolvers.length; index2 < length; index2 += 1) { - const tagDefinition = state.implicitResolvers[index2]; - if (tagDefinition.resolve(str, false, tagDefinition.tagName) !== NOT_RESOLVED) return tagDefinition.tagName; - } - return state.defaultScalarTagName; -} function isWhitespace(c) { return c === CHAR_SPACE || c === CHAR_TAB; } @@ -144884,11 +144982,11 @@ function resolveScalarStyle(state, node, layout, iskey, inblock) { } const string2 = node.value; if (string2.length === 0) { - if (node.style.tagged || resolveImplicitTag(state, string2) === node.tag) return STYLE_PLAIN; + if (node.style.tagged || state.schema.resolveImplicitScalarTag(string2).tag.tagName === node.tag) return STYLE_PLAIN; return state.quoteStyle === "double" ? STYLE_DOUBLE : STYLE_SINGLE; } const style = chooseScalarStyle(state, string2, layout, singleLineOnly, state.forceQuotes && !iskey, inblock); - if (style === STYLE_PLAIN && !node.style.tagged && resolveImplicitTag(state, string2) !== node.tag) return state.quoteStyle === "double" ? STYLE_DOUBLE : STYLE_SINGLE; + if (style === STYLE_PLAIN && !node.style.tagged && state.schema.resolveImplicitScalarTag(string2).tag.tagName !== node.tag) return state.quoteStyle === "double" ? STYLE_DOUBLE : STYLE_SINGLE; return style; } function blockHeader(string2, indentPerLevel) { @@ -145172,22 +145270,9 @@ function present(documents, options) { } return result; } -var DEFAULT_DUMP_SCHEMA = YAML11_SCHEMA.withTags({ - ...intYaml11Tag, - resolve: (source, isExplicit, tagName) => { - const result = intYaml11Tag.resolve(source, isExplicit, tagName); - return result === NOT_RESOLVED ? intCoreTag.resolve(source, isExplicit, tagName) : result; - } -}, { - ...floatYaml11Tag, - resolve: (source, isExplicit, tagName) => { - const result = floatYaml11Tag.resolve(source, isExplicit, tagName); - return result === NOT_RESOLVED ? floatCoreTag.resolve(source, isExplicit, tagName) : result; - } -}); var DEFAULT_DUMP_OPTIONS = { ...DEFAULT_PRESENTER_OPTIONS, - schema: DEFAULT_DUMP_SCHEMA, + schema: DUMP_SCHEMA, skipInvalid: false, noRefs: false, flowLevel: -1, @@ -145214,6 +145299,22 @@ function dump(input, options = {}) { schema: opts.schema }); } +var EVENT_DOCUMENT = EVENT_ID.DOCUMENT; +var EVENT_SEQUENCE = EVENT_ID.SEQUENCE; +var EVENT_MAPPING = EVENT_ID.MAPPING; +var EVENT_SCALAR = EVENT_ID.SCALAR; +var EVENT_ALIAS = EVENT_ID.ALIAS; +var EVENT_POP = EVENT_ID.POP; +var SCALAR_STYLE_PLAIN = SCALAR_STYLE.PLAIN; +var SCALAR_STYLE_SINGLE_QUOTED = SCALAR_STYLE.SINGLE_QUOTED; +var SCALAR_STYLE_DOUBLE_QUOTED = SCALAR_STYLE.DOUBLE_QUOTED; +var SCALAR_STYLE_LITERAL_BLOCK = SCALAR_STYLE.LITERAL_BLOCK; +var SCALAR_STYLE_FOLDED_BLOCK = SCALAR_STYLE.FOLDED_BLOCK; +var COLLECTION_STYLE_BLOCK = COLLECTION_STYLE.BLOCK; +var COLLECTION_STYLE_FLOW = COLLECTION_STYLE.FLOW; +var CHOMPING_CLIP = CHOMPING_MODE.CLIP; +var CHOMPING_STRIP = CHOMPING_MODE.STRIP; +var CHOMPING_KEEP = CHOMPING_MODE.KEEP; // src/util.ts var semver = __toESM(require_semver2()); @@ -163948,7 +164049,7 @@ tmp/lib/tmp.js: *) js-yaml/dist/js-yaml.mjs: - (*! js-yaml 5.2.3 https://github.com/nodeca/js-yaml @license MIT *) + (*! js-yaml 5.3.0 https://github.com/nodeca/js-yaml @license MIT *) long/index.js: (**