mirror of
https://github.com/hoverkraft-tech/compose-action.git
synced 2026-03-08 01:03:08 +08:00
Compare commits
1 Commits
04a132cb35
...
6b438ad084
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b438ad084 |
269
dist/index.js
generated
vendored
269
dist/index.js
generated
vendored
@ -36082,7 +36082,6 @@ function composeDoc(options, directives, { offset, start, value, end }, onError)
|
|||||||
const opts = Object.assign({ _directives: directives }, options);
|
const opts = Object.assign({ _directives: directives }, options);
|
||||||
const doc = new Document.Document(undefined, opts);
|
const doc = new Document.Document(undefined, opts);
|
||||||
const ctx = {
|
const ctx = {
|
||||||
atKey: false,
|
|
||||||
atRoot: true,
|
atRoot: true,
|
||||||
directives: doc.directives,
|
directives: doc.directives,
|
||||||
options: doc.options,
|
options: doc.options,
|
||||||
@ -36127,7 +36126,6 @@ exports.composeDoc = composeDoc;
|
|||||||
|
|
||||||
|
|
||||||
var Alias = __nccwpck_require__(4065);
|
var Alias = __nccwpck_require__(4065);
|
||||||
var identity = __nccwpck_require__(1127);
|
|
||||||
var composeCollection = __nccwpck_require__(7349);
|
var composeCollection = __nccwpck_require__(7349);
|
||||||
var composeScalar = __nccwpck_require__(5413);
|
var composeScalar = __nccwpck_require__(5413);
|
||||||
var resolveEnd = __nccwpck_require__(7788);
|
var resolveEnd = __nccwpck_require__(7788);
|
||||||
@ -36135,7 +36133,6 @@ var utilEmptyScalarPosition = __nccwpck_require__(2599);
|
|||||||
|
|
||||||
const CN = { composeNode, composeEmptyNode };
|
const CN = { composeNode, composeEmptyNode };
|
||||||
function composeNode(ctx, token, props, onError) {
|
function composeNode(ctx, token, props, onError) {
|
||||||
const atKey = ctx.atKey;
|
|
||||||
const { spaceBefore, comment, anchor, tag } = props;
|
const { spaceBefore, comment, anchor, tag } = props;
|
||||||
let node;
|
let node;
|
||||||
let isSrcToken = true;
|
let isSrcToken = true;
|
||||||
@ -36171,14 +36168,6 @@ function composeNode(ctx, token, props, onError) {
|
|||||||
}
|
}
|
||||||
if (anchor && node.anchor === '')
|
if (anchor && node.anchor === '')
|
||||||
onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');
|
onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');
|
||||||
if (atKey &&
|
|
||||||
ctx.options.stringKeys &&
|
|
||||||
(!identity.isScalar(node) ||
|
|
||||||
typeof node.value !== 'string' ||
|
|
||||||
(node.tag && node.tag !== 'tag:yaml.org,2002:str'))) {
|
|
||||||
const msg = 'With stringKeys, all keys must be strings';
|
|
||||||
onError(tag ?? token, 'NON_STRING_KEY', msg);
|
|
||||||
}
|
|
||||||
if (spaceBefore)
|
if (spaceBefore)
|
||||||
node.spaceBefore = true;
|
node.spaceBefore = true;
|
||||||
if (comment) {
|
if (comment) {
|
||||||
@ -36251,16 +36240,11 @@ function composeScalar(ctx, token, tagToken, onError) {
|
|||||||
const tagName = tagToken
|
const tagName = tagToken
|
||||||
? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))
|
? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))
|
||||||
: null;
|
: null;
|
||||||
let tag;
|
const tag = tagToken && tagName
|
||||||
if (ctx.options.stringKeys && ctx.atKey) {
|
? findScalarTagByName(ctx.schema, value, tagName, tagToken, onError)
|
||||||
tag = ctx.schema[identity.SCALAR];
|
: token.type === 'scalar'
|
||||||
}
|
? findScalarTagByTest(ctx, value, token, onError)
|
||||||
else if (tagName)
|
: ctx.schema[identity.SCALAR];
|
||||||
tag = findScalarTagByName(ctx.schema, value, tagName, tagToken, onError);
|
|
||||||
else if (token.type === 'scalar')
|
|
||||||
tag = findScalarTagByTest(ctx, value, token, onError);
|
|
||||||
else
|
|
||||||
tag = ctx.schema[identity.SCALAR];
|
|
||||||
let scalar;
|
let scalar;
|
||||||
try {
|
try {
|
||||||
const res = tag.resolve(value, msg => onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg), ctx.options);
|
const res = tag.resolve(value, msg => onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg), ctx.options);
|
||||||
@ -36308,9 +36292,8 @@ function findScalarTagByName(schema, value, tagName, tagToken, onError) {
|
|||||||
onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, tagName !== 'tag:yaml.org,2002:str');
|
onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, tagName !== 'tag:yaml.org,2002:str');
|
||||||
return schema[identity.SCALAR];
|
return schema[identity.SCALAR];
|
||||||
}
|
}
|
||||||
function findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {
|
function findScalarTagByTest({ directives, schema }, value, token, onError) {
|
||||||
const tag = schema.tags.find(tag => (tag.default === true || (atKey && tag.default === 'key')) &&
|
const tag = schema.tags.find(tag => tag.default && tag.test?.test(value)) || schema[identity.SCALAR];
|
||||||
tag.test?.test(value)) || schema[identity.SCALAR];
|
|
||||||
if (schema.compat) {
|
if (schema.compat) {
|
||||||
const compat = schema.compat.find(tag => tag.default && tag.test?.test(value)) ??
|
const compat = schema.compat.find(tag => tag.default && tag.test?.test(value)) ??
|
||||||
schema[identity.SCALAR];
|
schema[identity.SCALAR];
|
||||||
@ -36616,14 +36599,12 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, ta
|
|||||||
onError(offset, 'BAD_INDENT', startColMsg);
|
onError(offset, 'BAD_INDENT', startColMsg);
|
||||||
}
|
}
|
||||||
// key value
|
// key value
|
||||||
ctx.atKey = true;
|
|
||||||
const keyStart = keyProps.end;
|
const keyStart = keyProps.end;
|
||||||
const keyNode = key
|
const keyNode = key
|
||||||
? composeNode(ctx, key, keyProps, onError)
|
? composeNode(ctx, key, keyProps, onError)
|
||||||
: composeEmptyNode(ctx, keyStart, start, null, keyProps, onError);
|
: composeEmptyNode(ctx, keyStart, start, null, keyProps, onError);
|
||||||
if (ctx.schema.compat)
|
if (ctx.schema.compat)
|
||||||
utilFlowIndentCheck.flowIndentCheck(bm.indent, key, onError);
|
utilFlowIndentCheck.flowIndentCheck(bm.indent, key, onError);
|
||||||
ctx.atKey = false;
|
|
||||||
if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
|
if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
|
||||||
onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');
|
onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');
|
||||||
// value properties
|
// value properties
|
||||||
@ -36906,8 +36887,6 @@ function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError, ta
|
|||||||
const seq = new NodeClass(ctx.schema);
|
const seq = new NodeClass(ctx.schema);
|
||||||
if (ctx.atRoot)
|
if (ctx.atRoot)
|
||||||
ctx.atRoot = false;
|
ctx.atRoot = false;
|
||||||
if (ctx.atKey)
|
|
||||||
ctx.atKey = false;
|
|
||||||
let offset = bs.offset;
|
let offset = bs.offset;
|
||||||
let commentEnd = null;
|
let commentEnd = null;
|
||||||
for (const { start, value } of bs.items) {
|
for (const { start, value } of bs.items) {
|
||||||
@ -37023,8 +37002,6 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
|
|||||||
const atRoot = ctx.atRoot;
|
const atRoot = ctx.atRoot;
|
||||||
if (atRoot)
|
if (atRoot)
|
||||||
ctx.atRoot = false;
|
ctx.atRoot = false;
|
||||||
if (ctx.atKey)
|
|
||||||
ctx.atKey = false;
|
|
||||||
let offset = fc.offset + fc.start.source.length;
|
let offset = fc.offset + fc.start.source.length;
|
||||||
for (let i = 0; i < fc.items.length; ++i) {
|
for (let i = 0; i < fc.items.length; ++i) {
|
||||||
const collItem = fc.items[i];
|
const collItem = fc.items[i];
|
||||||
@ -37104,14 +37081,12 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
|
|||||||
else {
|
else {
|
||||||
// item is a key+value pair
|
// item is a key+value pair
|
||||||
// key value
|
// key value
|
||||||
ctx.atKey = true;
|
|
||||||
const keyStart = props.end;
|
const keyStart = props.end;
|
||||||
const keyNode = key
|
const keyNode = key
|
||||||
? composeNode(ctx, key, props, onError)
|
? composeNode(ctx, key, props, onError)
|
||||||
: composeEmptyNode(ctx, keyStart, start, null, props, onError);
|
: composeEmptyNode(ctx, keyStart, start, null, props, onError);
|
||||||
if (isBlock(key))
|
if (isBlock(key))
|
||||||
onError(keyNode.range, 'BLOCK_IN_FLOW', blockMsg);
|
onError(keyNode.range, 'BLOCK_IN_FLOW', blockMsg);
|
||||||
ctx.atKey = false;
|
|
||||||
// value properties
|
// value properties
|
||||||
const valueProps = resolveProps.resolveProps(sep ?? [], {
|
const valueProps = resolveProps.resolveProps(sep ?? [], {
|
||||||
flow: fcName,
|
flow: fcName,
|
||||||
@ -37725,7 +37700,11 @@ function mapIncludes(ctx, items, search) {
|
|||||||
return false;
|
return false;
|
||||||
const isEqual = typeof uniqueKeys === 'function'
|
const isEqual = typeof uniqueKeys === 'function'
|
||||||
? uniqueKeys
|
? uniqueKeys
|
||||||
: (a, b) => a === b || (identity.isScalar(a) && identity.isScalar(b) && a.value === b.value);
|
: (a, b) => a === b ||
|
||||||
|
(identity.isScalar(a) &&
|
||||||
|
identity.isScalar(b) &&
|
||||||
|
a.value === b.value &&
|
||||||
|
!(a.value === '<<' && ctx.schema.merge));
|
||||||
return items.some(pair => isEqual(pair.key, search));
|
return items.some(pair => isEqual(pair.key, search));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37777,7 +37756,6 @@ class Document {
|
|||||||
logLevel: 'warn',
|
logLevel: 'warn',
|
||||||
prettyErrors: true,
|
prettyErrors: true,
|
||||||
strict: true,
|
strict: true,
|
||||||
stringKeys: false,
|
|
||||||
uniqueKeys: true,
|
uniqueKeys: true,
|
||||||
version: '1.2'
|
version: '1.2'
|
||||||
}, options);
|
}, options);
|
||||||
@ -38001,7 +37979,7 @@ class Document {
|
|||||||
this.directives.yaml.version = '1.1';
|
this.directives.yaml.version = '1.1';
|
||||||
else
|
else
|
||||||
this.directives = new directives.Directives({ version: '1.1' });
|
this.directives = new directives.Directives({ version: '1.1' });
|
||||||
opt = { resolveKnownTags: false, schema: 'yaml-1.1' };
|
opt = { merge: true, resolveKnownTags: false, schema: 'yaml-1.1' };
|
||||||
break;
|
break;
|
||||||
case '1.2':
|
case '1.2':
|
||||||
case 'next':
|
case 'next':
|
||||||
@ -38009,7 +37987,7 @@ class Document {
|
|||||||
this.directives.yaml.version = version;
|
this.directives.yaml.version = version;
|
||||||
else
|
else
|
||||||
this.directives = new directives.Directives({ version });
|
this.directives = new directives.Directives({ version });
|
||||||
opt = { resolveKnownTags: true, schema: 'core' };
|
opt = { merge: false, resolveKnownTags: true, schema: 'core' };
|
||||||
break;
|
break;
|
||||||
case null:
|
case null:
|
||||||
if (this.directives)
|
if (this.directives)
|
||||||
@ -39352,17 +39330,24 @@ exports.YAMLSeq = YAMLSeq;
|
|||||||
|
|
||||||
|
|
||||||
var log = __nccwpck_require__(7249);
|
var log = __nccwpck_require__(7249);
|
||||||
var merge = __nccwpck_require__(452);
|
|
||||||
var stringify = __nccwpck_require__(2148);
|
var stringify = __nccwpck_require__(2148);
|
||||||
var identity = __nccwpck_require__(1127);
|
var identity = __nccwpck_require__(1127);
|
||||||
|
var Scalar = __nccwpck_require__(3301);
|
||||||
var toJS = __nccwpck_require__(6424);
|
var toJS = __nccwpck_require__(6424);
|
||||||
|
|
||||||
|
const MERGE_KEY = '<<';
|
||||||
function addPairToJSMap(ctx, map, { key, value }) {
|
function addPairToJSMap(ctx, map, { key, value }) {
|
||||||
if (identity.isNode(key) && key.addToJSMap)
|
if (ctx?.doc.schema.merge && isMergeKey(key)) {
|
||||||
key.addToJSMap(ctx, map, value);
|
value = identity.isAlias(value) ? value.resolve(ctx.doc) : value;
|
||||||
// TODO: Should drop this special case for bare << handling
|
if (identity.isSeq(value))
|
||||||
else if (merge.isMergeKey(ctx, key))
|
for (const it of value.items)
|
||||||
merge.addMergeToJSMap(ctx, map, value);
|
mergeToJSMap(ctx, map, it);
|
||||||
|
else if (Array.isArray(value))
|
||||||
|
for (const it of value)
|
||||||
|
mergeToJSMap(ctx, map, it);
|
||||||
|
else
|
||||||
|
mergeToJSMap(ctx, map, value);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
const jsKey = toJS.toJS(key, '', ctx);
|
const jsKey = toJS.toJS(key, '', ctx);
|
||||||
if (map instanceof Map) {
|
if (map instanceof Map) {
|
||||||
@ -39387,6 +39372,41 @@ function addPairToJSMap(ctx, map, { key, value }) {
|
|||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
const isMergeKey = (key) => key === MERGE_KEY ||
|
||||||
|
(identity.isScalar(key) &&
|
||||||
|
key.value === MERGE_KEY &&
|
||||||
|
(!key.type || key.type === Scalar.Scalar.PLAIN));
|
||||||
|
// If the value associated with a merge key is a single mapping node, each of
|
||||||
|
// its key/value pairs is inserted into the current mapping, unless the key
|
||||||
|
// already exists in it. If the value associated with the merge key is a
|
||||||
|
// sequence, then this sequence is expected to contain mapping nodes and each
|
||||||
|
// of these nodes is merged in turn according to its order in the sequence.
|
||||||
|
// Keys in mapping nodes earlier in the sequence override keys specified in
|
||||||
|
// later mapping nodes. -- http://yaml.org/type/merge.html
|
||||||
|
function mergeToJSMap(ctx, map, value) {
|
||||||
|
const source = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
|
||||||
|
if (!identity.isMap(source))
|
||||||
|
throw new Error('Merge sources must be maps or map aliases');
|
||||||
|
const srcMap = source.toJSON(null, ctx, Map);
|
||||||
|
for (const [key, value] of srcMap) {
|
||||||
|
if (map instanceof Map) {
|
||||||
|
if (!map.has(key))
|
||||||
|
map.set(key, value);
|
||||||
|
}
|
||||||
|
else if (map instanceof Set) {
|
||||||
|
map.add(key);
|
||||||
|
}
|
||||||
|
else if (!Object.prototype.hasOwnProperty.call(map, key)) {
|
||||||
|
Object.defineProperty(map, key, {
|
||||||
|
value,
|
||||||
|
writable: true,
|
||||||
|
enumerable: true,
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
function stringifyKey(key, jsKey, ctx) {
|
function stringifyKey(key, jsKey, ctx) {
|
||||||
if (jsKey === null)
|
if (jsKey === null)
|
||||||
return '';
|
return '';
|
||||||
@ -41801,7 +41821,6 @@ var composer = __nccwpck_require__(9984);
|
|||||||
var Document = __nccwpck_require__(3021);
|
var Document = __nccwpck_require__(3021);
|
||||||
var errors = __nccwpck_require__(1464);
|
var errors = __nccwpck_require__(1464);
|
||||||
var log = __nccwpck_require__(7249);
|
var log = __nccwpck_require__(7249);
|
||||||
var identity = __nccwpck_require__(1127);
|
|
||||||
var lineCounter = __nccwpck_require__(6628);
|
var lineCounter = __nccwpck_require__(6628);
|
||||||
var parser = __nccwpck_require__(3456);
|
var parser = __nccwpck_require__(3456);
|
||||||
|
|
||||||
@ -41893,8 +41912,6 @@ function stringify(value, replacer, options) {
|
|||||||
if (!keepUndefined)
|
if (!keepUndefined)
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
if (identity.isDocument(value) && !_replacer)
|
|
||||||
return value.toString(options);
|
|
||||||
return new Document.Document(value, _replacer, options).toString(options);
|
return new Document.Document(value, _replacer, options).toString(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41926,9 +41943,10 @@ class Schema {
|
|||||||
: compat
|
: compat
|
||||||
? tags.getTags(null, compat)
|
? tags.getTags(null, compat)
|
||||||
: null;
|
: null;
|
||||||
|
this.merge = !!merge;
|
||||||
this.name = (typeof schema === 'string' && schema) || 'core';
|
this.name = (typeof schema === 'string' && schema) || 'core';
|
||||||
this.knownTags = resolveKnownTags ? tags.coreKnownTags : {};
|
this.knownTags = resolveKnownTags ? tags.coreKnownTags : {};
|
||||||
this.tags = tags.getTags(customTags, this.name, merge);
|
this.tags = tags.getTags(customTags, this.name);
|
||||||
this.toStringOptions = toStringDefaults ?? null;
|
this.toStringOptions = toStringDefaults ?? null;
|
||||||
Object.defineProperty(this, identity.MAP, { value: map.map });
|
Object.defineProperty(this, identity.MAP, { value: map.map });
|
||||||
Object.defineProperty(this, identity.SCALAR, { value: string.string });
|
Object.defineProperty(this, identity.SCALAR, { value: string.string });
|
||||||
@ -42258,7 +42276,7 @@ const jsonScalars = [
|
|||||||
identify: value => typeof value === 'boolean',
|
identify: value => typeof value === 'boolean',
|
||||||
default: true,
|
default: true,
|
||||||
tag: 'tag:yaml.org,2002:bool',
|
tag: 'tag:yaml.org,2002:bool',
|
||||||
test: /^true$|^false$/,
|
test: /^true|false$/,
|
||||||
resolve: str => str === 'true',
|
resolve: str => str === 'true',
|
||||||
stringify: stringifyJSON
|
stringify: stringifyJSON
|
||||||
},
|
},
|
||||||
@ -42311,7 +42329,6 @@ var int = __nccwpck_require__(9874);
|
|||||||
var schema = __nccwpck_require__(896);
|
var schema = __nccwpck_require__(896);
|
||||||
var schema$1 = __nccwpck_require__(3559);
|
var schema$1 = __nccwpck_require__(3559);
|
||||||
var binary = __nccwpck_require__(6083);
|
var binary = __nccwpck_require__(6083);
|
||||||
var merge = __nccwpck_require__(452);
|
|
||||||
var omap = __nccwpck_require__(303);
|
var omap = __nccwpck_require__(303);
|
||||||
var pairs = __nccwpck_require__(8385);
|
var pairs = __nccwpck_require__(8385);
|
||||||
var schema$2 = __nccwpck_require__(8294);
|
var schema$2 = __nccwpck_require__(8294);
|
||||||
@ -42337,7 +42354,6 @@ const tagsByName = {
|
|||||||
intOct: int.intOct,
|
intOct: int.intOct,
|
||||||
intTime: timestamp.intTime,
|
intTime: timestamp.intTime,
|
||||||
map: map.map,
|
map: map.map,
|
||||||
merge: merge.merge,
|
|
||||||
null: _null.nullTag,
|
null: _null.nullTag,
|
||||||
omap: omap.omap,
|
omap: omap.omap,
|
||||||
pairs: pairs.pairs,
|
pairs: pairs.pairs,
|
||||||
@ -42347,20 +42363,13 @@ const tagsByName = {
|
|||||||
};
|
};
|
||||||
const coreKnownTags = {
|
const coreKnownTags = {
|
||||||
'tag:yaml.org,2002:binary': binary.binary,
|
'tag:yaml.org,2002:binary': binary.binary,
|
||||||
'tag:yaml.org,2002:merge': merge.merge,
|
|
||||||
'tag:yaml.org,2002:omap': omap.omap,
|
'tag:yaml.org,2002:omap': omap.omap,
|
||||||
'tag:yaml.org,2002:pairs': pairs.pairs,
|
'tag:yaml.org,2002:pairs': pairs.pairs,
|
||||||
'tag:yaml.org,2002:set': set.set,
|
'tag:yaml.org,2002:set': set.set,
|
||||||
'tag:yaml.org,2002:timestamp': timestamp.timestamp
|
'tag:yaml.org,2002:timestamp': timestamp.timestamp
|
||||||
};
|
};
|
||||||
function getTags(customTags, schemaName, addMergeTag) {
|
function getTags(customTags, schemaName) {
|
||||||
const schemaTags = schemas.get(schemaName);
|
let tags = schemas.get(schemaName);
|
||||||
if (schemaTags && !customTags) {
|
|
||||||
return addMergeTag && !schemaTags.includes(merge.merge)
|
|
||||||
? schemaTags.concat(merge.merge)
|
|
||||||
: schemaTags.slice();
|
|
||||||
}
|
|
||||||
let tags = schemaTags;
|
|
||||||
if (!tags) {
|
if (!tags) {
|
||||||
if (Array.isArray(customTags))
|
if (Array.isArray(customTags))
|
||||||
tags = [];
|
tags = [];
|
||||||
@ -42379,21 +42388,17 @@ function getTags(customTags, schemaName, addMergeTag) {
|
|||||||
else if (typeof customTags === 'function') {
|
else if (typeof customTags === 'function') {
|
||||||
tags = customTags(tags.slice());
|
tags = customTags(tags.slice());
|
||||||
}
|
}
|
||||||
if (addMergeTag)
|
return tags.map(tag => {
|
||||||
tags = tags.concat(merge.merge);
|
if (typeof tag !== 'string')
|
||||||
return tags.reduce((tags, tag) => {
|
return tag;
|
||||||
const tagObj = typeof tag === 'string' ? tagsByName[tag] : tag;
|
const tagObj = tagsByName[tag];
|
||||||
if (!tagObj) {
|
if (tagObj)
|
||||||
const tagName = JSON.stringify(tag);
|
return tagObj;
|
||||||
const keys = Object.keys(tagsByName)
|
const keys = Object.keys(tagsByName)
|
||||||
.map(key => JSON.stringify(key))
|
.map(key => JSON.stringify(key))
|
||||||
.join(', ');
|
.join(', ');
|
||||||
throw new Error(`Unknown custom tag ${tagName}; use one of ${keys}`);
|
throw new Error(`Unknown custom tag "${tag}"; use one of ${keys}`);
|
||||||
}
|
});
|
||||||
if (!tags.includes(tagObj))
|
|
||||||
tags.push(tagObj);
|
|
||||||
return tags;
|
|
||||||
}, []);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.coreKnownTags = coreKnownTags;
|
exports.coreKnownTags = coreKnownTags;
|
||||||
@ -42655,82 +42660,6 @@ exports.intHex = intHex;
|
|||||||
exports.intOct = intOct;
|
exports.intOct = intOct;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 452:
|
|
||||||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
|
|
||||||
var identity = __nccwpck_require__(1127);
|
|
||||||
var Scalar = __nccwpck_require__(3301);
|
|
||||||
|
|
||||||
// If the value associated with a merge key is a single mapping node, each of
|
|
||||||
// its key/value pairs is inserted into the current mapping, unless the key
|
|
||||||
// already exists in it. If the value associated with the merge key is a
|
|
||||||
// sequence, then this sequence is expected to contain mapping nodes and each
|
|
||||||
// of these nodes is merged in turn according to its order in the sequence.
|
|
||||||
// Keys in mapping nodes earlier in the sequence override keys specified in
|
|
||||||
// later mapping nodes. -- http://yaml.org/type/merge.html
|
|
||||||
const MERGE_KEY = '<<';
|
|
||||||
const merge = {
|
|
||||||
identify: value => value === MERGE_KEY ||
|
|
||||||
(typeof value === 'symbol' && value.description === MERGE_KEY),
|
|
||||||
default: 'key',
|
|
||||||
tag: 'tag:yaml.org,2002:merge',
|
|
||||||
test: /^<<$/,
|
|
||||||
resolve: () => Object.assign(new Scalar.Scalar(Symbol(MERGE_KEY)), {
|
|
||||||
addToJSMap: addMergeToJSMap
|
|
||||||
}),
|
|
||||||
stringify: () => MERGE_KEY
|
|
||||||
};
|
|
||||||
const isMergeKey = (ctx, key) => (merge.identify(key) ||
|
|
||||||
(identity.isScalar(key) &&
|
|
||||||
(!key.type || key.type === Scalar.Scalar.PLAIN) &&
|
|
||||||
merge.identify(key.value))) &&
|
|
||||||
ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);
|
|
||||||
function addMergeToJSMap(ctx, map, value) {
|
|
||||||
value = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
||||||
if (identity.isSeq(value))
|
|
||||||
for (const it of value.items)
|
|
||||||
mergeValue(ctx, map, it);
|
|
||||||
else if (Array.isArray(value))
|
|
||||||
for (const it of value)
|
|
||||||
mergeValue(ctx, map, it);
|
|
||||||
else
|
|
||||||
mergeValue(ctx, map, value);
|
|
||||||
}
|
|
||||||
function mergeValue(ctx, map, value) {
|
|
||||||
const source = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
||||||
if (!identity.isMap(source))
|
|
||||||
throw new Error('Merge sources must be maps or map aliases');
|
|
||||||
const srcMap = source.toJSON(null, ctx, Map);
|
|
||||||
for (const [key, value] of srcMap) {
|
|
||||||
if (map instanceof Map) {
|
|
||||||
if (!map.has(key))
|
|
||||||
map.set(key, value);
|
|
||||||
}
|
|
||||||
else if (map instanceof Set) {
|
|
||||||
map.add(key);
|
|
||||||
}
|
|
||||||
else if (!Object.prototype.hasOwnProperty.call(map, key)) {
|
|
||||||
Object.defineProperty(map, key, {
|
|
||||||
value,
|
|
||||||
writable: true,
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.addMergeToJSMap = addMergeToJSMap;
|
|
||||||
exports.isMergeKey = isMergeKey;
|
|
||||||
exports.merge = merge;
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 303:
|
/***/ 303:
|
||||||
@ -42922,7 +42851,6 @@ var binary = __nccwpck_require__(6083);
|
|||||||
var bool = __nccwpck_require__(8398);
|
var bool = __nccwpck_require__(8398);
|
||||||
var float = __nccwpck_require__(5782);
|
var float = __nccwpck_require__(5782);
|
||||||
var int = __nccwpck_require__(873);
|
var int = __nccwpck_require__(873);
|
||||||
var merge = __nccwpck_require__(452);
|
|
||||||
var omap = __nccwpck_require__(303);
|
var omap = __nccwpck_require__(303);
|
||||||
var pairs = __nccwpck_require__(8385);
|
var pairs = __nccwpck_require__(8385);
|
||||||
var set = __nccwpck_require__(1528);
|
var set = __nccwpck_require__(1528);
|
||||||
@ -42943,7 +42871,6 @@ const schema = [
|
|||||||
float.floatExp,
|
float.floatExp,
|
||||||
float.float,
|
float.float,
|
||||||
binary.binary,
|
binary.binary,
|
||||||
merge.merge,
|
|
||||||
omap.omap,
|
omap.omap,
|
||||||
pairs.pairs,
|
pairs.pairs,
|
||||||
set.set,
|
set.set,
|
||||||
@ -43164,7 +43091,7 @@ const timestamp = {
|
|||||||
}
|
}
|
||||||
return new Date(date);
|
return new Date(date);
|
||||||
},
|
},
|
||||||
stringify: ({ value }) => value.toISOString().replace(/(T00:00:00)?\.000Z$/, '')
|
stringify: ({ value }) => value.toISOString().replace(/((T00:00)?:00)?\.000Z$/, '')
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.floatTime = floatTime;
|
exports.floatTime = floatTime;
|
||||||
@ -43395,12 +43322,7 @@ function getTagObject(tags, item) {
|
|||||||
let obj;
|
let obj;
|
||||||
if (identity.isScalar(item)) {
|
if (identity.isScalar(item)) {
|
||||||
obj = item.value;
|
obj = item.value;
|
||||||
let match = tags.filter(t => t.identify?.(obj));
|
const match = tags.filter(t => t.identify?.(obj));
|
||||||
if (match.length > 1) {
|
|
||||||
const testMatch = match.filter(t => t.test);
|
|
||||||
if (testMatch.length > 0)
|
|
||||||
match = testMatch;
|
|
||||||
}
|
|
||||||
tagObj =
|
tagObj =
|
||||||
match.find(t => t.format === item.format) ?? match.find(t => !t.format);
|
match.find(t => t.format === item.format) ?? match.find(t => !t.format);
|
||||||
}
|
}
|
||||||
@ -44174,32 +44096,23 @@ function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
|
|||||||
start = start.replace(/\n+/g, `$&${indent}`);
|
start = start.replace(/\n+/g, `$&${indent}`);
|
||||||
}
|
}
|
||||||
const indentSize = indent ? '2' : '1'; // root is at -1
|
const indentSize = indent ? '2' : '1'; // root is at -1
|
||||||
// Leading | or > is added later
|
let header = (literal ? '|' : '>') + (startWithSpace ? indentSize : '') + chomp;
|
||||||
let header = (startWithSpace ? indentSize : '') + chomp;
|
|
||||||
if (comment) {
|
if (comment) {
|
||||||
header += ' ' + commentString(comment.replace(/ ?[\r\n]+/g, ' '));
|
header += ' ' + commentString(comment.replace(/ ?[\r\n]+/g, ' '));
|
||||||
if (onComment)
|
if (onComment)
|
||||||
onComment();
|
onComment();
|
||||||
}
|
}
|
||||||
if (!literal) {
|
if (literal) {
|
||||||
const foldedValue = value
|
value = value.replace(/\n+/g, `$&${indent}`);
|
||||||
.replace(/\n+/g, '\n$&')
|
return `${header}\n${indent}${start}${value}${end}`;
|
||||||
.replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
|
|
||||||
// ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
|
|
||||||
.replace(/\n+/g, `$&${indent}`);
|
|
||||||
let literalFallback = false;
|
|
||||||
const foldOptions = getFoldOptions(ctx, true);
|
|
||||||
if (blockQuote !== 'folded' && type !== Scalar.Scalar.BLOCK_FOLDED) {
|
|
||||||
foldOptions.onOverflow = () => {
|
|
||||||
literalFallback = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
const body = foldFlowLines.foldFlowLines(`${start}${foldedValue}${end}`, indent, foldFlowLines.FOLD_BLOCK, foldOptions);
|
|
||||||
if (!literalFallback)
|
|
||||||
return `>${header}\n${indent}${body}`;
|
|
||||||
}
|
}
|
||||||
value = value.replace(/\n+/g, `$&${indent}`);
|
value = value
|
||||||
return `|${header}\n${indent}${start}${value}${end}`;
|
.replace(/\n+/g, '\n$&')
|
||||||
|
.replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
|
||||||
|
// ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
|
||||||
|
.replace(/\n+/g, `$&${indent}`);
|
||||||
|
const body = foldFlowLines.foldFlowLines(`${start}${value}${end}`, indent, foldFlowLines.FOLD_BLOCK, getFoldOptions(ctx, true));
|
||||||
|
return `${header}\n${indent}${body}`;
|
||||||
}
|
}
|
||||||
function plainString(item, ctx, onComment, onChompKeep) {
|
function plainString(item, ctx, onComment, onChompKeep) {
|
||||||
const { type, value } = item;
|
const { type, value } = item;
|
||||||
|
|||||||
269
dist/post.js
generated
vendored
269
dist/post.js
generated
vendored
@ -27792,7 +27792,6 @@ function composeDoc(options, directives, { offset, start, value, end }, onError)
|
|||||||
const opts = Object.assign({ _directives: directives }, options);
|
const opts = Object.assign({ _directives: directives }, options);
|
||||||
const doc = new Document.Document(undefined, opts);
|
const doc = new Document.Document(undefined, opts);
|
||||||
const ctx = {
|
const ctx = {
|
||||||
atKey: false,
|
|
||||||
atRoot: true,
|
atRoot: true,
|
||||||
directives: doc.directives,
|
directives: doc.directives,
|
||||||
options: doc.options,
|
options: doc.options,
|
||||||
@ -27837,7 +27836,6 @@ exports.composeDoc = composeDoc;
|
|||||||
|
|
||||||
|
|
||||||
var Alias = __nccwpck_require__(4065);
|
var Alias = __nccwpck_require__(4065);
|
||||||
var identity = __nccwpck_require__(1127);
|
|
||||||
var composeCollection = __nccwpck_require__(7349);
|
var composeCollection = __nccwpck_require__(7349);
|
||||||
var composeScalar = __nccwpck_require__(5413);
|
var composeScalar = __nccwpck_require__(5413);
|
||||||
var resolveEnd = __nccwpck_require__(7788);
|
var resolveEnd = __nccwpck_require__(7788);
|
||||||
@ -27845,7 +27843,6 @@ var utilEmptyScalarPosition = __nccwpck_require__(2599);
|
|||||||
|
|
||||||
const CN = { composeNode, composeEmptyNode };
|
const CN = { composeNode, composeEmptyNode };
|
||||||
function composeNode(ctx, token, props, onError) {
|
function composeNode(ctx, token, props, onError) {
|
||||||
const atKey = ctx.atKey;
|
|
||||||
const { spaceBefore, comment, anchor, tag } = props;
|
const { spaceBefore, comment, anchor, tag } = props;
|
||||||
let node;
|
let node;
|
||||||
let isSrcToken = true;
|
let isSrcToken = true;
|
||||||
@ -27881,14 +27878,6 @@ function composeNode(ctx, token, props, onError) {
|
|||||||
}
|
}
|
||||||
if (anchor && node.anchor === '')
|
if (anchor && node.anchor === '')
|
||||||
onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');
|
onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');
|
||||||
if (atKey &&
|
|
||||||
ctx.options.stringKeys &&
|
|
||||||
(!identity.isScalar(node) ||
|
|
||||||
typeof node.value !== 'string' ||
|
|
||||||
(node.tag && node.tag !== 'tag:yaml.org,2002:str'))) {
|
|
||||||
const msg = 'With stringKeys, all keys must be strings';
|
|
||||||
onError(tag ?? token, 'NON_STRING_KEY', msg);
|
|
||||||
}
|
|
||||||
if (spaceBefore)
|
if (spaceBefore)
|
||||||
node.spaceBefore = true;
|
node.spaceBefore = true;
|
||||||
if (comment) {
|
if (comment) {
|
||||||
@ -27961,16 +27950,11 @@ function composeScalar(ctx, token, tagToken, onError) {
|
|||||||
const tagName = tagToken
|
const tagName = tagToken
|
||||||
? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))
|
? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))
|
||||||
: null;
|
: null;
|
||||||
let tag;
|
const tag = tagToken && tagName
|
||||||
if (ctx.options.stringKeys && ctx.atKey) {
|
? findScalarTagByName(ctx.schema, value, tagName, tagToken, onError)
|
||||||
tag = ctx.schema[identity.SCALAR];
|
: token.type === 'scalar'
|
||||||
}
|
? findScalarTagByTest(ctx, value, token, onError)
|
||||||
else if (tagName)
|
: ctx.schema[identity.SCALAR];
|
||||||
tag = findScalarTagByName(ctx.schema, value, tagName, tagToken, onError);
|
|
||||||
else if (token.type === 'scalar')
|
|
||||||
tag = findScalarTagByTest(ctx, value, token, onError);
|
|
||||||
else
|
|
||||||
tag = ctx.schema[identity.SCALAR];
|
|
||||||
let scalar;
|
let scalar;
|
||||||
try {
|
try {
|
||||||
const res = tag.resolve(value, msg => onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg), ctx.options);
|
const res = tag.resolve(value, msg => onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg), ctx.options);
|
||||||
@ -28018,9 +28002,8 @@ function findScalarTagByName(schema, value, tagName, tagToken, onError) {
|
|||||||
onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, tagName !== 'tag:yaml.org,2002:str');
|
onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, tagName !== 'tag:yaml.org,2002:str');
|
||||||
return schema[identity.SCALAR];
|
return schema[identity.SCALAR];
|
||||||
}
|
}
|
||||||
function findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {
|
function findScalarTagByTest({ directives, schema }, value, token, onError) {
|
||||||
const tag = schema.tags.find(tag => (tag.default === true || (atKey && tag.default === 'key')) &&
|
const tag = schema.tags.find(tag => tag.default && tag.test?.test(value)) || schema[identity.SCALAR];
|
||||||
tag.test?.test(value)) || schema[identity.SCALAR];
|
|
||||||
if (schema.compat) {
|
if (schema.compat) {
|
||||||
const compat = schema.compat.find(tag => tag.default && tag.test?.test(value)) ??
|
const compat = schema.compat.find(tag => tag.default && tag.test?.test(value)) ??
|
||||||
schema[identity.SCALAR];
|
schema[identity.SCALAR];
|
||||||
@ -28326,14 +28309,12 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, ta
|
|||||||
onError(offset, 'BAD_INDENT', startColMsg);
|
onError(offset, 'BAD_INDENT', startColMsg);
|
||||||
}
|
}
|
||||||
// key value
|
// key value
|
||||||
ctx.atKey = true;
|
|
||||||
const keyStart = keyProps.end;
|
const keyStart = keyProps.end;
|
||||||
const keyNode = key
|
const keyNode = key
|
||||||
? composeNode(ctx, key, keyProps, onError)
|
? composeNode(ctx, key, keyProps, onError)
|
||||||
: composeEmptyNode(ctx, keyStart, start, null, keyProps, onError);
|
: composeEmptyNode(ctx, keyStart, start, null, keyProps, onError);
|
||||||
if (ctx.schema.compat)
|
if (ctx.schema.compat)
|
||||||
utilFlowIndentCheck.flowIndentCheck(bm.indent, key, onError);
|
utilFlowIndentCheck.flowIndentCheck(bm.indent, key, onError);
|
||||||
ctx.atKey = false;
|
|
||||||
if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
|
if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
|
||||||
onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');
|
onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');
|
||||||
// value properties
|
// value properties
|
||||||
@ -28616,8 +28597,6 @@ function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError, ta
|
|||||||
const seq = new NodeClass(ctx.schema);
|
const seq = new NodeClass(ctx.schema);
|
||||||
if (ctx.atRoot)
|
if (ctx.atRoot)
|
||||||
ctx.atRoot = false;
|
ctx.atRoot = false;
|
||||||
if (ctx.atKey)
|
|
||||||
ctx.atKey = false;
|
|
||||||
let offset = bs.offset;
|
let offset = bs.offset;
|
||||||
let commentEnd = null;
|
let commentEnd = null;
|
||||||
for (const { start, value } of bs.items) {
|
for (const { start, value } of bs.items) {
|
||||||
@ -28733,8 +28712,6 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
|
|||||||
const atRoot = ctx.atRoot;
|
const atRoot = ctx.atRoot;
|
||||||
if (atRoot)
|
if (atRoot)
|
||||||
ctx.atRoot = false;
|
ctx.atRoot = false;
|
||||||
if (ctx.atKey)
|
|
||||||
ctx.atKey = false;
|
|
||||||
let offset = fc.offset + fc.start.source.length;
|
let offset = fc.offset + fc.start.source.length;
|
||||||
for (let i = 0; i < fc.items.length; ++i) {
|
for (let i = 0; i < fc.items.length; ++i) {
|
||||||
const collItem = fc.items[i];
|
const collItem = fc.items[i];
|
||||||
@ -28814,14 +28791,12 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
|
|||||||
else {
|
else {
|
||||||
// item is a key+value pair
|
// item is a key+value pair
|
||||||
// key value
|
// key value
|
||||||
ctx.atKey = true;
|
|
||||||
const keyStart = props.end;
|
const keyStart = props.end;
|
||||||
const keyNode = key
|
const keyNode = key
|
||||||
? composeNode(ctx, key, props, onError)
|
? composeNode(ctx, key, props, onError)
|
||||||
: composeEmptyNode(ctx, keyStart, start, null, props, onError);
|
: composeEmptyNode(ctx, keyStart, start, null, props, onError);
|
||||||
if (isBlock(key))
|
if (isBlock(key))
|
||||||
onError(keyNode.range, 'BLOCK_IN_FLOW', blockMsg);
|
onError(keyNode.range, 'BLOCK_IN_FLOW', blockMsg);
|
||||||
ctx.atKey = false;
|
|
||||||
// value properties
|
// value properties
|
||||||
const valueProps = resolveProps.resolveProps(sep ?? [], {
|
const valueProps = resolveProps.resolveProps(sep ?? [], {
|
||||||
flow: fcName,
|
flow: fcName,
|
||||||
@ -29435,7 +29410,11 @@ function mapIncludes(ctx, items, search) {
|
|||||||
return false;
|
return false;
|
||||||
const isEqual = typeof uniqueKeys === 'function'
|
const isEqual = typeof uniqueKeys === 'function'
|
||||||
? uniqueKeys
|
? uniqueKeys
|
||||||
: (a, b) => a === b || (identity.isScalar(a) && identity.isScalar(b) && a.value === b.value);
|
: (a, b) => a === b ||
|
||||||
|
(identity.isScalar(a) &&
|
||||||
|
identity.isScalar(b) &&
|
||||||
|
a.value === b.value &&
|
||||||
|
!(a.value === '<<' && ctx.schema.merge));
|
||||||
return items.some(pair => isEqual(pair.key, search));
|
return items.some(pair => isEqual(pair.key, search));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29487,7 +29466,6 @@ class Document {
|
|||||||
logLevel: 'warn',
|
logLevel: 'warn',
|
||||||
prettyErrors: true,
|
prettyErrors: true,
|
||||||
strict: true,
|
strict: true,
|
||||||
stringKeys: false,
|
|
||||||
uniqueKeys: true,
|
uniqueKeys: true,
|
||||||
version: '1.2'
|
version: '1.2'
|
||||||
}, options);
|
}, options);
|
||||||
@ -29711,7 +29689,7 @@ class Document {
|
|||||||
this.directives.yaml.version = '1.1';
|
this.directives.yaml.version = '1.1';
|
||||||
else
|
else
|
||||||
this.directives = new directives.Directives({ version: '1.1' });
|
this.directives = new directives.Directives({ version: '1.1' });
|
||||||
opt = { resolveKnownTags: false, schema: 'yaml-1.1' };
|
opt = { merge: true, resolveKnownTags: false, schema: 'yaml-1.1' };
|
||||||
break;
|
break;
|
||||||
case '1.2':
|
case '1.2':
|
||||||
case 'next':
|
case 'next':
|
||||||
@ -29719,7 +29697,7 @@ class Document {
|
|||||||
this.directives.yaml.version = version;
|
this.directives.yaml.version = version;
|
||||||
else
|
else
|
||||||
this.directives = new directives.Directives({ version });
|
this.directives = new directives.Directives({ version });
|
||||||
opt = { resolveKnownTags: true, schema: 'core' };
|
opt = { merge: false, resolveKnownTags: true, schema: 'core' };
|
||||||
break;
|
break;
|
||||||
case null:
|
case null:
|
||||||
if (this.directives)
|
if (this.directives)
|
||||||
@ -31062,17 +31040,24 @@ exports.YAMLSeq = YAMLSeq;
|
|||||||
|
|
||||||
|
|
||||||
var log = __nccwpck_require__(7249);
|
var log = __nccwpck_require__(7249);
|
||||||
var merge = __nccwpck_require__(452);
|
|
||||||
var stringify = __nccwpck_require__(2148);
|
var stringify = __nccwpck_require__(2148);
|
||||||
var identity = __nccwpck_require__(1127);
|
var identity = __nccwpck_require__(1127);
|
||||||
|
var Scalar = __nccwpck_require__(3301);
|
||||||
var toJS = __nccwpck_require__(6424);
|
var toJS = __nccwpck_require__(6424);
|
||||||
|
|
||||||
|
const MERGE_KEY = '<<';
|
||||||
function addPairToJSMap(ctx, map, { key, value }) {
|
function addPairToJSMap(ctx, map, { key, value }) {
|
||||||
if (identity.isNode(key) && key.addToJSMap)
|
if (ctx?.doc.schema.merge && isMergeKey(key)) {
|
||||||
key.addToJSMap(ctx, map, value);
|
value = identity.isAlias(value) ? value.resolve(ctx.doc) : value;
|
||||||
// TODO: Should drop this special case for bare << handling
|
if (identity.isSeq(value))
|
||||||
else if (merge.isMergeKey(ctx, key))
|
for (const it of value.items)
|
||||||
merge.addMergeToJSMap(ctx, map, value);
|
mergeToJSMap(ctx, map, it);
|
||||||
|
else if (Array.isArray(value))
|
||||||
|
for (const it of value)
|
||||||
|
mergeToJSMap(ctx, map, it);
|
||||||
|
else
|
||||||
|
mergeToJSMap(ctx, map, value);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
const jsKey = toJS.toJS(key, '', ctx);
|
const jsKey = toJS.toJS(key, '', ctx);
|
||||||
if (map instanceof Map) {
|
if (map instanceof Map) {
|
||||||
@ -31097,6 +31082,41 @@ function addPairToJSMap(ctx, map, { key, value }) {
|
|||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
const isMergeKey = (key) => key === MERGE_KEY ||
|
||||||
|
(identity.isScalar(key) &&
|
||||||
|
key.value === MERGE_KEY &&
|
||||||
|
(!key.type || key.type === Scalar.Scalar.PLAIN));
|
||||||
|
// If the value associated with a merge key is a single mapping node, each of
|
||||||
|
// its key/value pairs is inserted into the current mapping, unless the key
|
||||||
|
// already exists in it. If the value associated with the merge key is a
|
||||||
|
// sequence, then this sequence is expected to contain mapping nodes and each
|
||||||
|
// of these nodes is merged in turn according to its order in the sequence.
|
||||||
|
// Keys in mapping nodes earlier in the sequence override keys specified in
|
||||||
|
// later mapping nodes. -- http://yaml.org/type/merge.html
|
||||||
|
function mergeToJSMap(ctx, map, value) {
|
||||||
|
const source = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
|
||||||
|
if (!identity.isMap(source))
|
||||||
|
throw new Error('Merge sources must be maps or map aliases');
|
||||||
|
const srcMap = source.toJSON(null, ctx, Map);
|
||||||
|
for (const [key, value] of srcMap) {
|
||||||
|
if (map instanceof Map) {
|
||||||
|
if (!map.has(key))
|
||||||
|
map.set(key, value);
|
||||||
|
}
|
||||||
|
else if (map instanceof Set) {
|
||||||
|
map.add(key);
|
||||||
|
}
|
||||||
|
else if (!Object.prototype.hasOwnProperty.call(map, key)) {
|
||||||
|
Object.defineProperty(map, key, {
|
||||||
|
value,
|
||||||
|
writable: true,
|
||||||
|
enumerable: true,
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
function stringifyKey(key, jsKey, ctx) {
|
function stringifyKey(key, jsKey, ctx) {
|
||||||
if (jsKey === null)
|
if (jsKey === null)
|
||||||
return '';
|
return '';
|
||||||
@ -33511,7 +33531,6 @@ var composer = __nccwpck_require__(9984);
|
|||||||
var Document = __nccwpck_require__(3021);
|
var Document = __nccwpck_require__(3021);
|
||||||
var errors = __nccwpck_require__(1464);
|
var errors = __nccwpck_require__(1464);
|
||||||
var log = __nccwpck_require__(7249);
|
var log = __nccwpck_require__(7249);
|
||||||
var identity = __nccwpck_require__(1127);
|
|
||||||
var lineCounter = __nccwpck_require__(6628);
|
var lineCounter = __nccwpck_require__(6628);
|
||||||
var parser = __nccwpck_require__(3456);
|
var parser = __nccwpck_require__(3456);
|
||||||
|
|
||||||
@ -33603,8 +33622,6 @@ function stringify(value, replacer, options) {
|
|||||||
if (!keepUndefined)
|
if (!keepUndefined)
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
if (identity.isDocument(value) && !_replacer)
|
|
||||||
return value.toString(options);
|
|
||||||
return new Document.Document(value, _replacer, options).toString(options);
|
return new Document.Document(value, _replacer, options).toString(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33636,9 +33653,10 @@ class Schema {
|
|||||||
: compat
|
: compat
|
||||||
? tags.getTags(null, compat)
|
? tags.getTags(null, compat)
|
||||||
: null;
|
: null;
|
||||||
|
this.merge = !!merge;
|
||||||
this.name = (typeof schema === 'string' && schema) || 'core';
|
this.name = (typeof schema === 'string' && schema) || 'core';
|
||||||
this.knownTags = resolveKnownTags ? tags.coreKnownTags : {};
|
this.knownTags = resolveKnownTags ? tags.coreKnownTags : {};
|
||||||
this.tags = tags.getTags(customTags, this.name, merge);
|
this.tags = tags.getTags(customTags, this.name);
|
||||||
this.toStringOptions = toStringDefaults ?? null;
|
this.toStringOptions = toStringDefaults ?? null;
|
||||||
Object.defineProperty(this, identity.MAP, { value: map.map });
|
Object.defineProperty(this, identity.MAP, { value: map.map });
|
||||||
Object.defineProperty(this, identity.SCALAR, { value: string.string });
|
Object.defineProperty(this, identity.SCALAR, { value: string.string });
|
||||||
@ -33968,7 +33986,7 @@ const jsonScalars = [
|
|||||||
identify: value => typeof value === 'boolean',
|
identify: value => typeof value === 'boolean',
|
||||||
default: true,
|
default: true,
|
||||||
tag: 'tag:yaml.org,2002:bool',
|
tag: 'tag:yaml.org,2002:bool',
|
||||||
test: /^true$|^false$/,
|
test: /^true|false$/,
|
||||||
resolve: str => str === 'true',
|
resolve: str => str === 'true',
|
||||||
stringify: stringifyJSON
|
stringify: stringifyJSON
|
||||||
},
|
},
|
||||||
@ -34021,7 +34039,6 @@ var int = __nccwpck_require__(9874);
|
|||||||
var schema = __nccwpck_require__(896);
|
var schema = __nccwpck_require__(896);
|
||||||
var schema$1 = __nccwpck_require__(3559);
|
var schema$1 = __nccwpck_require__(3559);
|
||||||
var binary = __nccwpck_require__(6083);
|
var binary = __nccwpck_require__(6083);
|
||||||
var merge = __nccwpck_require__(452);
|
|
||||||
var omap = __nccwpck_require__(303);
|
var omap = __nccwpck_require__(303);
|
||||||
var pairs = __nccwpck_require__(8385);
|
var pairs = __nccwpck_require__(8385);
|
||||||
var schema$2 = __nccwpck_require__(8294);
|
var schema$2 = __nccwpck_require__(8294);
|
||||||
@ -34047,7 +34064,6 @@ const tagsByName = {
|
|||||||
intOct: int.intOct,
|
intOct: int.intOct,
|
||||||
intTime: timestamp.intTime,
|
intTime: timestamp.intTime,
|
||||||
map: map.map,
|
map: map.map,
|
||||||
merge: merge.merge,
|
|
||||||
null: _null.nullTag,
|
null: _null.nullTag,
|
||||||
omap: omap.omap,
|
omap: omap.omap,
|
||||||
pairs: pairs.pairs,
|
pairs: pairs.pairs,
|
||||||
@ -34057,20 +34073,13 @@ const tagsByName = {
|
|||||||
};
|
};
|
||||||
const coreKnownTags = {
|
const coreKnownTags = {
|
||||||
'tag:yaml.org,2002:binary': binary.binary,
|
'tag:yaml.org,2002:binary': binary.binary,
|
||||||
'tag:yaml.org,2002:merge': merge.merge,
|
|
||||||
'tag:yaml.org,2002:omap': omap.omap,
|
'tag:yaml.org,2002:omap': omap.omap,
|
||||||
'tag:yaml.org,2002:pairs': pairs.pairs,
|
'tag:yaml.org,2002:pairs': pairs.pairs,
|
||||||
'tag:yaml.org,2002:set': set.set,
|
'tag:yaml.org,2002:set': set.set,
|
||||||
'tag:yaml.org,2002:timestamp': timestamp.timestamp
|
'tag:yaml.org,2002:timestamp': timestamp.timestamp
|
||||||
};
|
};
|
||||||
function getTags(customTags, schemaName, addMergeTag) {
|
function getTags(customTags, schemaName) {
|
||||||
const schemaTags = schemas.get(schemaName);
|
let tags = schemas.get(schemaName);
|
||||||
if (schemaTags && !customTags) {
|
|
||||||
return addMergeTag && !schemaTags.includes(merge.merge)
|
|
||||||
? schemaTags.concat(merge.merge)
|
|
||||||
: schemaTags.slice();
|
|
||||||
}
|
|
||||||
let tags = schemaTags;
|
|
||||||
if (!tags) {
|
if (!tags) {
|
||||||
if (Array.isArray(customTags))
|
if (Array.isArray(customTags))
|
||||||
tags = [];
|
tags = [];
|
||||||
@ -34089,21 +34098,17 @@ function getTags(customTags, schemaName, addMergeTag) {
|
|||||||
else if (typeof customTags === 'function') {
|
else if (typeof customTags === 'function') {
|
||||||
tags = customTags(tags.slice());
|
tags = customTags(tags.slice());
|
||||||
}
|
}
|
||||||
if (addMergeTag)
|
return tags.map(tag => {
|
||||||
tags = tags.concat(merge.merge);
|
if (typeof tag !== 'string')
|
||||||
return tags.reduce((tags, tag) => {
|
return tag;
|
||||||
const tagObj = typeof tag === 'string' ? tagsByName[tag] : tag;
|
const tagObj = tagsByName[tag];
|
||||||
if (!tagObj) {
|
if (tagObj)
|
||||||
const tagName = JSON.stringify(tag);
|
return tagObj;
|
||||||
const keys = Object.keys(tagsByName)
|
const keys = Object.keys(tagsByName)
|
||||||
.map(key => JSON.stringify(key))
|
.map(key => JSON.stringify(key))
|
||||||
.join(', ');
|
.join(', ');
|
||||||
throw new Error(`Unknown custom tag ${tagName}; use one of ${keys}`);
|
throw new Error(`Unknown custom tag "${tag}"; use one of ${keys}`);
|
||||||
}
|
});
|
||||||
if (!tags.includes(tagObj))
|
|
||||||
tags.push(tagObj);
|
|
||||||
return tags;
|
|
||||||
}, []);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.coreKnownTags = coreKnownTags;
|
exports.coreKnownTags = coreKnownTags;
|
||||||
@ -34365,82 +34370,6 @@ exports.intHex = intHex;
|
|||||||
exports.intOct = intOct;
|
exports.intOct = intOct;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 452:
|
|
||||||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
|
|
||||||
var identity = __nccwpck_require__(1127);
|
|
||||||
var Scalar = __nccwpck_require__(3301);
|
|
||||||
|
|
||||||
// If the value associated with a merge key is a single mapping node, each of
|
|
||||||
// its key/value pairs is inserted into the current mapping, unless the key
|
|
||||||
// already exists in it. If the value associated with the merge key is a
|
|
||||||
// sequence, then this sequence is expected to contain mapping nodes and each
|
|
||||||
// of these nodes is merged in turn according to its order in the sequence.
|
|
||||||
// Keys in mapping nodes earlier in the sequence override keys specified in
|
|
||||||
// later mapping nodes. -- http://yaml.org/type/merge.html
|
|
||||||
const MERGE_KEY = '<<';
|
|
||||||
const merge = {
|
|
||||||
identify: value => value === MERGE_KEY ||
|
|
||||||
(typeof value === 'symbol' && value.description === MERGE_KEY),
|
|
||||||
default: 'key',
|
|
||||||
tag: 'tag:yaml.org,2002:merge',
|
|
||||||
test: /^<<$/,
|
|
||||||
resolve: () => Object.assign(new Scalar.Scalar(Symbol(MERGE_KEY)), {
|
|
||||||
addToJSMap: addMergeToJSMap
|
|
||||||
}),
|
|
||||||
stringify: () => MERGE_KEY
|
|
||||||
};
|
|
||||||
const isMergeKey = (ctx, key) => (merge.identify(key) ||
|
|
||||||
(identity.isScalar(key) &&
|
|
||||||
(!key.type || key.type === Scalar.Scalar.PLAIN) &&
|
|
||||||
merge.identify(key.value))) &&
|
|
||||||
ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);
|
|
||||||
function addMergeToJSMap(ctx, map, value) {
|
|
||||||
value = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
||||||
if (identity.isSeq(value))
|
|
||||||
for (const it of value.items)
|
|
||||||
mergeValue(ctx, map, it);
|
|
||||||
else if (Array.isArray(value))
|
|
||||||
for (const it of value)
|
|
||||||
mergeValue(ctx, map, it);
|
|
||||||
else
|
|
||||||
mergeValue(ctx, map, value);
|
|
||||||
}
|
|
||||||
function mergeValue(ctx, map, value) {
|
|
||||||
const source = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
||||||
if (!identity.isMap(source))
|
|
||||||
throw new Error('Merge sources must be maps or map aliases');
|
|
||||||
const srcMap = source.toJSON(null, ctx, Map);
|
|
||||||
for (const [key, value] of srcMap) {
|
|
||||||
if (map instanceof Map) {
|
|
||||||
if (!map.has(key))
|
|
||||||
map.set(key, value);
|
|
||||||
}
|
|
||||||
else if (map instanceof Set) {
|
|
||||||
map.add(key);
|
|
||||||
}
|
|
||||||
else if (!Object.prototype.hasOwnProperty.call(map, key)) {
|
|
||||||
Object.defineProperty(map, key, {
|
|
||||||
value,
|
|
||||||
writable: true,
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.addMergeToJSMap = addMergeToJSMap;
|
|
||||||
exports.isMergeKey = isMergeKey;
|
|
||||||
exports.merge = merge;
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 303:
|
/***/ 303:
|
||||||
@ -34632,7 +34561,6 @@ var binary = __nccwpck_require__(6083);
|
|||||||
var bool = __nccwpck_require__(8398);
|
var bool = __nccwpck_require__(8398);
|
||||||
var float = __nccwpck_require__(5782);
|
var float = __nccwpck_require__(5782);
|
||||||
var int = __nccwpck_require__(873);
|
var int = __nccwpck_require__(873);
|
||||||
var merge = __nccwpck_require__(452);
|
|
||||||
var omap = __nccwpck_require__(303);
|
var omap = __nccwpck_require__(303);
|
||||||
var pairs = __nccwpck_require__(8385);
|
var pairs = __nccwpck_require__(8385);
|
||||||
var set = __nccwpck_require__(1528);
|
var set = __nccwpck_require__(1528);
|
||||||
@ -34653,7 +34581,6 @@ const schema = [
|
|||||||
float.floatExp,
|
float.floatExp,
|
||||||
float.float,
|
float.float,
|
||||||
binary.binary,
|
binary.binary,
|
||||||
merge.merge,
|
|
||||||
omap.omap,
|
omap.omap,
|
||||||
pairs.pairs,
|
pairs.pairs,
|
||||||
set.set,
|
set.set,
|
||||||
@ -34874,7 +34801,7 @@ const timestamp = {
|
|||||||
}
|
}
|
||||||
return new Date(date);
|
return new Date(date);
|
||||||
},
|
},
|
||||||
stringify: ({ value }) => value.toISOString().replace(/(T00:00:00)?\.000Z$/, '')
|
stringify: ({ value }) => value.toISOString().replace(/((T00:00)?:00)?\.000Z$/, '')
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.floatTime = floatTime;
|
exports.floatTime = floatTime;
|
||||||
@ -35105,12 +35032,7 @@ function getTagObject(tags, item) {
|
|||||||
let obj;
|
let obj;
|
||||||
if (identity.isScalar(item)) {
|
if (identity.isScalar(item)) {
|
||||||
obj = item.value;
|
obj = item.value;
|
||||||
let match = tags.filter(t => t.identify?.(obj));
|
const match = tags.filter(t => t.identify?.(obj));
|
||||||
if (match.length > 1) {
|
|
||||||
const testMatch = match.filter(t => t.test);
|
|
||||||
if (testMatch.length > 0)
|
|
||||||
match = testMatch;
|
|
||||||
}
|
|
||||||
tagObj =
|
tagObj =
|
||||||
match.find(t => t.format === item.format) ?? match.find(t => !t.format);
|
match.find(t => t.format === item.format) ?? match.find(t => !t.format);
|
||||||
}
|
}
|
||||||
@ -35884,32 +35806,23 @@ function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
|
|||||||
start = start.replace(/\n+/g, `$&${indent}`);
|
start = start.replace(/\n+/g, `$&${indent}`);
|
||||||
}
|
}
|
||||||
const indentSize = indent ? '2' : '1'; // root is at -1
|
const indentSize = indent ? '2' : '1'; // root is at -1
|
||||||
// Leading | or > is added later
|
let header = (literal ? '|' : '>') + (startWithSpace ? indentSize : '') + chomp;
|
||||||
let header = (startWithSpace ? indentSize : '') + chomp;
|
|
||||||
if (comment) {
|
if (comment) {
|
||||||
header += ' ' + commentString(comment.replace(/ ?[\r\n]+/g, ' '));
|
header += ' ' + commentString(comment.replace(/ ?[\r\n]+/g, ' '));
|
||||||
if (onComment)
|
if (onComment)
|
||||||
onComment();
|
onComment();
|
||||||
}
|
}
|
||||||
if (!literal) {
|
if (literal) {
|
||||||
const foldedValue = value
|
value = value.replace(/\n+/g, `$&${indent}`);
|
||||||
.replace(/\n+/g, '\n$&')
|
return `${header}\n${indent}${start}${value}${end}`;
|
||||||
.replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
|
|
||||||
// ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
|
|
||||||
.replace(/\n+/g, `$&${indent}`);
|
|
||||||
let literalFallback = false;
|
|
||||||
const foldOptions = getFoldOptions(ctx, true);
|
|
||||||
if (blockQuote !== 'folded' && type !== Scalar.Scalar.BLOCK_FOLDED) {
|
|
||||||
foldOptions.onOverflow = () => {
|
|
||||||
literalFallback = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
const body = foldFlowLines.foldFlowLines(`${start}${foldedValue}${end}`, indent, foldFlowLines.FOLD_BLOCK, foldOptions);
|
|
||||||
if (!literalFallback)
|
|
||||||
return `>${header}\n${indent}${body}`;
|
|
||||||
}
|
}
|
||||||
value = value.replace(/\n+/g, `$&${indent}`);
|
value = value
|
||||||
return `|${header}\n${indent}${start}${value}${end}`;
|
.replace(/\n+/g, '\n$&')
|
||||||
|
.replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
|
||||||
|
// ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
|
||||||
|
.replace(/\n+/g, `$&${indent}`);
|
||||||
|
const body = foldFlowLines.foldFlowLines(`${start}${value}${end}`, indent, foldFlowLines.FOLD_BLOCK, getFoldOptions(ctx, true));
|
||||||
|
return `${header}\n${indent}${body}`;
|
||||||
}
|
}
|
||||||
function plainString(item, ctx, onComment, onChompKeep) {
|
function plainString(item, ctx, onComment, onChompKeep) {
|
||||||
const { type, value } = item;
|
const { type, value } = item;
|
||||||
|
|||||||
2417
package-lock.json
generated
2417
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -76,10 +76,10 @@
|
|||||||
"@actions/github": "^6.0.0",
|
"@actions/github": "^6.0.0",
|
||||||
"@actions/tool-cache": "^2.0.1",
|
"@actions/tool-cache": "^2.0.1",
|
||||||
"@octokit/action": "^7.0.0",
|
"@octokit/action": "^7.0.0",
|
||||||
|
"@ts-dev-tools/core": "^1.6.2",
|
||||||
"docker-compose": "^1.1.0"
|
"docker-compose": "^1.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ts-dev-tools/core": "1.6.2",
|
|
||||||
"@vercel/ncc": "^0.38.1",
|
"@vercel/ncc": "^0.38.1",
|
||||||
"eslint-plugin-github": "^5.0.1",
|
"eslint-plugin-github": "^5.0.1",
|
||||||
"eslint-plugin-jsonc": "^2.14.1"
|
"eslint-plugin-jsonc": "^2.14.1"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user