@windrun-huaiin/dev-scripts 14.0.0 → 14.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_commonjsHelpers.js +7 -0
- package/dist/_virtual/_commonjsHelpers.mjs +5 -0
- package/dist/_virtual/index.js +11 -0
- package/dist/_virtual/index.mjs +7 -0
- package/dist/_virtual/re.js +5 -0
- package/dist/_virtual/re.mjs +3 -0
- package/dist/cli.js +33 -1
- package/dist/cli.mjs +33 -1
- package/dist/commands/diaomao-update.d.ts +3 -0
- package/dist/commands/diaomao-update.d.ts.map +1 -0
- package/dist/commands/diaomao-update.js +304 -0
- package/dist/commands/diaomao-update.mjs +302 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +9 -0
- package/dist/config/index.mjs +9 -0
- package/dist/config/schema.d.ts +5 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +5 -0
- package/dist/config/schema.mjs +5 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.mjs +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/comparator.js +161 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/comparator.mjs +159 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/range.js +576 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/range.mjs +574 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/semver.js +350 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/semver.mjs +348 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/clean.js +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/clean.mjs +19 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/cmp.js +72 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/cmp.mjs +70 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/coerce.js +77 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/coerce.mjs +75 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-build.js +22 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-build.mjs +20 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-loose.js +18 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-loose.mjs +16 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare.js +20 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare.mjs +18 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/diff.js +73 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/diff.mjs +71 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/eq.js +18 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/eq.mjs +16 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gt.js +18 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gt.mjs +16 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gte.js +18 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gte.mjs +16 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/inc.js +34 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/inc.mjs +32 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lt.js +18 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lt.mjs +16 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lte.js +18 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lte.mjs +16 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/major.js +18 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/major.mjs +16 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/minor.js +18 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/minor.mjs +16 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/neq.js +18 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/neq.mjs +16 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/parse.js +31 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/parse.mjs +29 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/patch.js +18 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/patch.mjs +16 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/prerelease.js +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/prerelease.mjs +19 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rcompare.js +18 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rcompare.mjs +16 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rsort.js +18 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rsort.mjs +16 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/satisfies.js +25 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/satisfies.mjs +23 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/sort.js +18 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/sort.mjs +16 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/valid.js +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/valid.mjs +19 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/index.js +144 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/index.mjs +142 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/constants.js +48 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/constants.mjs +46 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/debug.js +22 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/debug.mjs +20 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/identifiers.js +40 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/identifiers.mjs +38 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/lrucache.js +53 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/lrucache.mjs +51 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/parse-options.js +28 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/parse-options.mjs +26 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/re.js +239 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/re.mjs +237 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/gtr.js +19 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/gtr.mjs +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/intersects.js +22 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/intersects.mjs +20 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/ltr.js +19 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/ltr.mjs +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/max-satisfying.js +41 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/max-satisfying.mjs +39 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-satisfying.js +40 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-satisfying.mjs +38 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-version.js +78 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-version.mjs +76 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/outside.js +102 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/outside.mjs +100 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/simplify.js +63 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/simplify.mjs +61 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/subset.js +265 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/subset.mjs +263 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/to-comparators.js +23 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/to-comparators.mjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/valid.js +26 -0
- package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/valid.mjs +24 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/compose-collection.js +90 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/compose-collection.mjs +88 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/compose-doc.js +45 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/compose-doc.mjs +43 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/compose-node.js +105 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/compose-node.mjs +102 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/compose-scalar.js +88 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/compose-scalar.mjs +86 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/composer.js +219 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/composer.mjs +217 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-block-map.js +117 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-block-map.mjs +115 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +200 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-block-scalar.mjs +198 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +51 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-block-seq.mjs +49 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-end.js +39 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-end.mjs +37 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +209 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-flow-collection.mjs +207 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +225 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.mjs +223 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-props.js +148 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-props.mjs +146 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/util-contains-newline.js +36 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/util-contains-newline.mjs +34 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +28 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.mjs +26 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +17 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/util-flow-indent-check.mjs +15 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/util-map-includes.js +15 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/util-map-includes.mjs +13 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/doc/Document.js +337 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/doc/Document.mjs +335 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/doc/anchors.js +76 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/doc/anchors.mjs +71 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/doc/applyReviver.js +57 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/doc/applyReviver.mjs +55 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/doc/createNode.js +90 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/doc/createNode.mjs +88 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/doc/directives.js +178 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/doc/directives.mjs +176 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/errors.js +62 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/errors.mjs +57 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/log.js +9 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/log.mjs +7 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/Alias.js +116 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/Alias.mjs +114 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/Collection.js +151 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/Collection.mjs +147 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/Node.js +40 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/Node.mjs +38 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/Pair.js +39 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/Pair.mjs +36 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/Scalar.js +27 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/Scalar.mjs +24 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/YAMLMap.js +147 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/YAMLMap.mjs +144 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +115 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/YAMLSeq.mjs +113 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +65 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/addPairToJSMap.mjs +63 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/identity.js +53 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/identity.mjs +36 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/toJS.js +39 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/toJS.mjs +37 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/parse/cst.js +79 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/parse/cst.mjs +73 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/parse/lexer.js +719 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/parse/lexer.mjs +717 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/parse/line-counter.js +41 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/parse/line-counter.mjs +39 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/parse/parser.js +969 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/parse/parser.mjs +967 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/public-api.js +68 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/public-api.mjs +64 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/Schema.js +39 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/Schema.mjs +37 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/common/map.js +19 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/common/map.mjs +17 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/common/null.js +17 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/common/null.mjs +15 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/common/seq.js +19 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/common/seq.mjs +17 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/common/string.js +16 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/common/string.mjs +14 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/core/bool.js +21 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/core/bool.mjs +19 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/core/float.js +47 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/core/float.mjs +43 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/core/int.js +42 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/core/int.mjs +38 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/core/schema.js +25 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/core/schema.mjs +23 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/json/schema.js +64 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/json/schema.mjs +62 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/tags.js +99 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/tags.mjs +96 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +60 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.mjs +58 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +29 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.mjs +26 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +50 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/float.mjs +46 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +76 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/int.mjs +71 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +68 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.mjs +64 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +77 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.mjs +74 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +82 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.mjs +78 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +41 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.mjs +39 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +96 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/set.mjs +93 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +105 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.mjs +101 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +151 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/foldFlowLines.mjs +146 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringify.js +131 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringify.mjs +128 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +145 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringifyCollection.mjs +143 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringifyComment.js +24 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringifyComment.mjs +20 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +87 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringifyDocument.mjs +85 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +26 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringifyNumber.mjs +24 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringifyPair.js +152 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringifyPair.mjs +150 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringifyString.js +338 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringifyString.mjs +336 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/visit.js +148 -0
- package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/visit.mjs +146 -0
- package/package.json +6 -4
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Alias } from '../nodes/Alias.mjs';
|
|
2
|
+
import { isDocument, isNode, isPair, MAP, SEQ } from '../nodes/identity.mjs';
|
|
3
|
+
import { Scalar } from '../nodes/Scalar.mjs';
|
|
4
|
+
|
|
5
|
+
const defaultTagPrefix = 'tag:yaml.org,2002:';
|
|
6
|
+
function findTagObject(value, tagName, tags) {
|
|
7
|
+
if (tagName) {
|
|
8
|
+
const match = tags.filter(t => t.tag === tagName);
|
|
9
|
+
const tagObj = match.find(t => !t.format) ?? match[0];
|
|
10
|
+
if (!tagObj)
|
|
11
|
+
throw new Error(`Tag ${tagName} not found`);
|
|
12
|
+
return tagObj;
|
|
13
|
+
}
|
|
14
|
+
return tags.find(t => t.identify?.(value) && !t.format);
|
|
15
|
+
}
|
|
16
|
+
function createNode(value, tagName, ctx) {
|
|
17
|
+
if (isDocument(value))
|
|
18
|
+
value = value.contents;
|
|
19
|
+
if (isNode(value))
|
|
20
|
+
return value;
|
|
21
|
+
if (isPair(value)) {
|
|
22
|
+
const map = ctx.schema[MAP].createNode?.(ctx.schema, null, ctx);
|
|
23
|
+
map.items.push(value);
|
|
24
|
+
return map;
|
|
25
|
+
}
|
|
26
|
+
if (value instanceof String ||
|
|
27
|
+
value instanceof Number ||
|
|
28
|
+
value instanceof Boolean ||
|
|
29
|
+
(typeof BigInt !== 'undefined' && value instanceof BigInt) // not supported everywhere
|
|
30
|
+
) {
|
|
31
|
+
// https://tc39.es/ecma262/#sec-serializejsonproperty
|
|
32
|
+
value = value.valueOf();
|
|
33
|
+
}
|
|
34
|
+
const { aliasDuplicateObjects, onAnchor, onTagObj, schema, sourceObjects } = ctx;
|
|
35
|
+
// Detect duplicate references to the same object & use Alias nodes for all
|
|
36
|
+
// after first. The `ref` wrapper allows for circular references to resolve.
|
|
37
|
+
let ref = undefined;
|
|
38
|
+
if (aliasDuplicateObjects && value && typeof value === 'object') {
|
|
39
|
+
ref = sourceObjects.get(value);
|
|
40
|
+
if (ref) {
|
|
41
|
+
ref.anchor ?? (ref.anchor = onAnchor(value));
|
|
42
|
+
return new Alias(ref.anchor);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
ref = { anchor: null, node: null };
|
|
46
|
+
sourceObjects.set(value, ref);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (tagName?.startsWith('!!'))
|
|
50
|
+
tagName = defaultTagPrefix + tagName.slice(2);
|
|
51
|
+
let tagObj = findTagObject(value, tagName, schema.tags);
|
|
52
|
+
if (!tagObj) {
|
|
53
|
+
if (value && typeof value.toJSON === 'function') {
|
|
54
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
55
|
+
value = value.toJSON();
|
|
56
|
+
}
|
|
57
|
+
if (!value || typeof value !== 'object') {
|
|
58
|
+
const node = new Scalar(value);
|
|
59
|
+
if (ref)
|
|
60
|
+
ref.node = node;
|
|
61
|
+
return node;
|
|
62
|
+
}
|
|
63
|
+
tagObj =
|
|
64
|
+
value instanceof Map
|
|
65
|
+
? schema[MAP]
|
|
66
|
+
: Symbol.iterator in Object(value)
|
|
67
|
+
? schema[SEQ]
|
|
68
|
+
: schema[MAP];
|
|
69
|
+
}
|
|
70
|
+
if (onTagObj) {
|
|
71
|
+
onTagObj(tagObj);
|
|
72
|
+
delete ctx.onTagObj;
|
|
73
|
+
}
|
|
74
|
+
const node = tagObj?.createNode
|
|
75
|
+
? tagObj.createNode(ctx.schema, value, ctx)
|
|
76
|
+
: typeof tagObj?.nodeClass?.from === 'function'
|
|
77
|
+
? tagObj.nodeClass.from(ctx.schema, value, ctx)
|
|
78
|
+
: new Scalar(value);
|
|
79
|
+
if (tagName)
|
|
80
|
+
node.tag = tagName;
|
|
81
|
+
else if (!tagObj.default)
|
|
82
|
+
node.tag = tagObj.tag;
|
|
83
|
+
if (ref)
|
|
84
|
+
ref.node = node;
|
|
85
|
+
return node;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export { createNode };
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var identity = require('../nodes/identity.js');
|
|
4
|
+
var visit = require('../visit.js');
|
|
5
|
+
|
|
6
|
+
const escapeChars = {
|
|
7
|
+
'!': '%21',
|
|
8
|
+
',': '%2C',
|
|
9
|
+
'[': '%5B',
|
|
10
|
+
']': '%5D',
|
|
11
|
+
'{': '%7B',
|
|
12
|
+
'}': '%7D'
|
|
13
|
+
};
|
|
14
|
+
const escapeTagName = (tn) => tn.replace(/[!,[\]{}]/g, ch => escapeChars[ch]);
|
|
15
|
+
class Directives {
|
|
16
|
+
constructor(yaml, tags) {
|
|
17
|
+
/**
|
|
18
|
+
* The directives-end/doc-start marker `---`. If `null`, a marker may still be
|
|
19
|
+
* included in the document's stringified representation.
|
|
20
|
+
*/
|
|
21
|
+
this.docStart = null;
|
|
22
|
+
/** The doc-end marker `...`. */
|
|
23
|
+
this.docEnd = false;
|
|
24
|
+
this.yaml = Object.assign({}, Directives.defaultYaml, yaml);
|
|
25
|
+
this.tags = Object.assign({}, Directives.defaultTags, tags);
|
|
26
|
+
}
|
|
27
|
+
clone() {
|
|
28
|
+
const copy = new Directives(this.yaml, this.tags);
|
|
29
|
+
copy.docStart = this.docStart;
|
|
30
|
+
return copy;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* During parsing, get a Directives instance for the current document and
|
|
34
|
+
* update the stream state according to the current version's spec.
|
|
35
|
+
*/
|
|
36
|
+
atDocument() {
|
|
37
|
+
const res = new Directives(this.yaml, this.tags);
|
|
38
|
+
switch (this.yaml.version) {
|
|
39
|
+
case '1.1':
|
|
40
|
+
this.atNextDocument = true;
|
|
41
|
+
break;
|
|
42
|
+
case '1.2':
|
|
43
|
+
this.atNextDocument = false;
|
|
44
|
+
this.yaml = {
|
|
45
|
+
explicit: Directives.defaultYaml.explicit,
|
|
46
|
+
version: '1.2'
|
|
47
|
+
};
|
|
48
|
+
this.tags = Object.assign({}, Directives.defaultTags);
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
return res;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* @param onError - May be called even if the action was successful
|
|
55
|
+
* @returns `true` on success
|
|
56
|
+
*/
|
|
57
|
+
add(line, onError) {
|
|
58
|
+
if (this.atNextDocument) {
|
|
59
|
+
this.yaml = { explicit: Directives.defaultYaml.explicit, version: '1.1' };
|
|
60
|
+
this.tags = Object.assign({}, Directives.defaultTags);
|
|
61
|
+
this.atNextDocument = false;
|
|
62
|
+
}
|
|
63
|
+
const parts = line.trim().split(/[ \t]+/);
|
|
64
|
+
const name = parts.shift();
|
|
65
|
+
switch (name) {
|
|
66
|
+
case '%TAG': {
|
|
67
|
+
if (parts.length !== 2) {
|
|
68
|
+
onError(0, '%TAG directive should contain exactly two parts');
|
|
69
|
+
if (parts.length < 2)
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
const [handle, prefix] = parts;
|
|
73
|
+
this.tags[handle] = prefix;
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
case '%YAML': {
|
|
77
|
+
this.yaml.explicit = true;
|
|
78
|
+
if (parts.length !== 1) {
|
|
79
|
+
onError(0, '%YAML directive should contain exactly one part');
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
const [version] = parts;
|
|
83
|
+
if (version === '1.1' || version === '1.2') {
|
|
84
|
+
this.yaml.version = version;
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
const isValid = /^\d+\.\d+$/.test(version);
|
|
89
|
+
onError(6, `Unsupported YAML version ${version}`, isValid);
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
default:
|
|
94
|
+
onError(0, `Unknown directive ${name}`, true);
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Resolves a tag, matching handles to those defined in %TAG directives.
|
|
100
|
+
*
|
|
101
|
+
* @returns Resolved tag, which may also be the non-specific tag `'!'` or a
|
|
102
|
+
* `'!local'` tag, or `null` if unresolvable.
|
|
103
|
+
*/
|
|
104
|
+
tagName(source, onError) {
|
|
105
|
+
if (source === '!')
|
|
106
|
+
return '!'; // non-specific tag
|
|
107
|
+
if (source[0] !== '!') {
|
|
108
|
+
onError(`Not a valid tag: ${source}`);
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
if (source[1] === '<') {
|
|
112
|
+
const verbatim = source.slice(2, -1);
|
|
113
|
+
if (verbatim === '!' || verbatim === '!!') {
|
|
114
|
+
onError(`Verbatim tags aren't resolved, so ${source} is invalid.`);
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
if (source[source.length - 1] !== '>')
|
|
118
|
+
onError('Verbatim tags must end with a >');
|
|
119
|
+
return verbatim;
|
|
120
|
+
}
|
|
121
|
+
const [, handle, suffix] = source.match(/^(.*!)([^!]*)$/s);
|
|
122
|
+
if (!suffix)
|
|
123
|
+
onError(`The ${source} tag has no suffix`);
|
|
124
|
+
const prefix = this.tags[handle];
|
|
125
|
+
if (prefix) {
|
|
126
|
+
try {
|
|
127
|
+
return prefix + decodeURIComponent(suffix);
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
onError(String(error));
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (handle === '!')
|
|
135
|
+
return source; // local tag
|
|
136
|
+
onError(`Could not resolve tag: ${source}`);
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Given a fully resolved tag, returns its printable string form,
|
|
141
|
+
* taking into account current tag prefixes and defaults.
|
|
142
|
+
*/
|
|
143
|
+
tagString(tag) {
|
|
144
|
+
for (const [handle, prefix] of Object.entries(this.tags)) {
|
|
145
|
+
if (tag.startsWith(prefix))
|
|
146
|
+
return handle + escapeTagName(tag.substring(prefix.length));
|
|
147
|
+
}
|
|
148
|
+
return tag[0] === '!' ? tag : `!<${tag}>`;
|
|
149
|
+
}
|
|
150
|
+
toString(doc) {
|
|
151
|
+
const lines = this.yaml.explicit
|
|
152
|
+
? [`%YAML ${this.yaml.version || '1.2'}`]
|
|
153
|
+
: [];
|
|
154
|
+
const tagEntries = Object.entries(this.tags);
|
|
155
|
+
let tagNames;
|
|
156
|
+
if (doc && tagEntries.length > 0 && identity.isNode(doc.contents)) {
|
|
157
|
+
const tags = {};
|
|
158
|
+
visit.visit(doc.contents, (_key, node) => {
|
|
159
|
+
if (identity.isNode(node) && node.tag)
|
|
160
|
+
tags[node.tag] = true;
|
|
161
|
+
});
|
|
162
|
+
tagNames = Object.keys(tags);
|
|
163
|
+
}
|
|
164
|
+
else
|
|
165
|
+
tagNames = [];
|
|
166
|
+
for (const [handle, prefix] of tagEntries) {
|
|
167
|
+
if (handle === '!!' && prefix === 'tag:yaml.org,2002:')
|
|
168
|
+
continue;
|
|
169
|
+
if (!doc || tagNames.some(tn => tn.startsWith(prefix)))
|
|
170
|
+
lines.push(`%TAG ${handle} ${prefix}`);
|
|
171
|
+
}
|
|
172
|
+
return lines.join('\n');
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
Directives.defaultYaml = { explicit: false, version: '1.2' };
|
|
176
|
+
Directives.defaultTags = { '!!': 'tag:yaml.org,2002:' };
|
|
177
|
+
|
|
178
|
+
exports.Directives = Directives;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { isNode } from '../nodes/identity.mjs';
|
|
2
|
+
import { visit } from '../visit.mjs';
|
|
3
|
+
|
|
4
|
+
const escapeChars = {
|
|
5
|
+
'!': '%21',
|
|
6
|
+
',': '%2C',
|
|
7
|
+
'[': '%5B',
|
|
8
|
+
']': '%5D',
|
|
9
|
+
'{': '%7B',
|
|
10
|
+
'}': '%7D'
|
|
11
|
+
};
|
|
12
|
+
const escapeTagName = (tn) => tn.replace(/[!,[\]{}]/g, ch => escapeChars[ch]);
|
|
13
|
+
class Directives {
|
|
14
|
+
constructor(yaml, tags) {
|
|
15
|
+
/**
|
|
16
|
+
* The directives-end/doc-start marker `---`. If `null`, a marker may still be
|
|
17
|
+
* included in the document's stringified representation.
|
|
18
|
+
*/
|
|
19
|
+
this.docStart = null;
|
|
20
|
+
/** The doc-end marker `...`. */
|
|
21
|
+
this.docEnd = false;
|
|
22
|
+
this.yaml = Object.assign({}, Directives.defaultYaml, yaml);
|
|
23
|
+
this.tags = Object.assign({}, Directives.defaultTags, tags);
|
|
24
|
+
}
|
|
25
|
+
clone() {
|
|
26
|
+
const copy = new Directives(this.yaml, this.tags);
|
|
27
|
+
copy.docStart = this.docStart;
|
|
28
|
+
return copy;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* During parsing, get a Directives instance for the current document and
|
|
32
|
+
* update the stream state according to the current version's spec.
|
|
33
|
+
*/
|
|
34
|
+
atDocument() {
|
|
35
|
+
const res = new Directives(this.yaml, this.tags);
|
|
36
|
+
switch (this.yaml.version) {
|
|
37
|
+
case '1.1':
|
|
38
|
+
this.atNextDocument = true;
|
|
39
|
+
break;
|
|
40
|
+
case '1.2':
|
|
41
|
+
this.atNextDocument = false;
|
|
42
|
+
this.yaml = {
|
|
43
|
+
explicit: Directives.defaultYaml.explicit,
|
|
44
|
+
version: '1.2'
|
|
45
|
+
};
|
|
46
|
+
this.tags = Object.assign({}, Directives.defaultTags);
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
return res;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* @param onError - May be called even if the action was successful
|
|
53
|
+
* @returns `true` on success
|
|
54
|
+
*/
|
|
55
|
+
add(line, onError) {
|
|
56
|
+
if (this.atNextDocument) {
|
|
57
|
+
this.yaml = { explicit: Directives.defaultYaml.explicit, version: '1.1' };
|
|
58
|
+
this.tags = Object.assign({}, Directives.defaultTags);
|
|
59
|
+
this.atNextDocument = false;
|
|
60
|
+
}
|
|
61
|
+
const parts = line.trim().split(/[ \t]+/);
|
|
62
|
+
const name = parts.shift();
|
|
63
|
+
switch (name) {
|
|
64
|
+
case '%TAG': {
|
|
65
|
+
if (parts.length !== 2) {
|
|
66
|
+
onError(0, '%TAG directive should contain exactly two parts');
|
|
67
|
+
if (parts.length < 2)
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
const [handle, prefix] = parts;
|
|
71
|
+
this.tags[handle] = prefix;
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
case '%YAML': {
|
|
75
|
+
this.yaml.explicit = true;
|
|
76
|
+
if (parts.length !== 1) {
|
|
77
|
+
onError(0, '%YAML directive should contain exactly one part');
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
const [version] = parts;
|
|
81
|
+
if (version === '1.1' || version === '1.2') {
|
|
82
|
+
this.yaml.version = version;
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
const isValid = /^\d+\.\d+$/.test(version);
|
|
87
|
+
onError(6, `Unsupported YAML version ${version}`, isValid);
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
default:
|
|
92
|
+
onError(0, `Unknown directive ${name}`, true);
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Resolves a tag, matching handles to those defined in %TAG directives.
|
|
98
|
+
*
|
|
99
|
+
* @returns Resolved tag, which may also be the non-specific tag `'!'` or a
|
|
100
|
+
* `'!local'` tag, or `null` if unresolvable.
|
|
101
|
+
*/
|
|
102
|
+
tagName(source, onError) {
|
|
103
|
+
if (source === '!')
|
|
104
|
+
return '!'; // non-specific tag
|
|
105
|
+
if (source[0] !== '!') {
|
|
106
|
+
onError(`Not a valid tag: ${source}`);
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
if (source[1] === '<') {
|
|
110
|
+
const verbatim = source.slice(2, -1);
|
|
111
|
+
if (verbatim === '!' || verbatim === '!!') {
|
|
112
|
+
onError(`Verbatim tags aren't resolved, so ${source} is invalid.`);
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
if (source[source.length - 1] !== '>')
|
|
116
|
+
onError('Verbatim tags must end with a >');
|
|
117
|
+
return verbatim;
|
|
118
|
+
}
|
|
119
|
+
const [, handle, suffix] = source.match(/^(.*!)([^!]*)$/s);
|
|
120
|
+
if (!suffix)
|
|
121
|
+
onError(`The ${source} tag has no suffix`);
|
|
122
|
+
const prefix = this.tags[handle];
|
|
123
|
+
if (prefix) {
|
|
124
|
+
try {
|
|
125
|
+
return prefix + decodeURIComponent(suffix);
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
onError(String(error));
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (handle === '!')
|
|
133
|
+
return source; // local tag
|
|
134
|
+
onError(`Could not resolve tag: ${source}`);
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Given a fully resolved tag, returns its printable string form,
|
|
139
|
+
* taking into account current tag prefixes and defaults.
|
|
140
|
+
*/
|
|
141
|
+
tagString(tag) {
|
|
142
|
+
for (const [handle, prefix] of Object.entries(this.tags)) {
|
|
143
|
+
if (tag.startsWith(prefix))
|
|
144
|
+
return handle + escapeTagName(tag.substring(prefix.length));
|
|
145
|
+
}
|
|
146
|
+
return tag[0] === '!' ? tag : `!<${tag}>`;
|
|
147
|
+
}
|
|
148
|
+
toString(doc) {
|
|
149
|
+
const lines = this.yaml.explicit
|
|
150
|
+
? [`%YAML ${this.yaml.version || '1.2'}`]
|
|
151
|
+
: [];
|
|
152
|
+
const tagEntries = Object.entries(this.tags);
|
|
153
|
+
let tagNames;
|
|
154
|
+
if (doc && tagEntries.length > 0 && isNode(doc.contents)) {
|
|
155
|
+
const tags = {};
|
|
156
|
+
visit(doc.contents, (_key, node) => {
|
|
157
|
+
if (isNode(node) && node.tag)
|
|
158
|
+
tags[node.tag] = true;
|
|
159
|
+
});
|
|
160
|
+
tagNames = Object.keys(tags);
|
|
161
|
+
}
|
|
162
|
+
else
|
|
163
|
+
tagNames = [];
|
|
164
|
+
for (const [handle, prefix] of tagEntries) {
|
|
165
|
+
if (handle === '!!' && prefix === 'tag:yaml.org,2002:')
|
|
166
|
+
continue;
|
|
167
|
+
if (!doc || tagNames.some(tn => tn.startsWith(prefix)))
|
|
168
|
+
lines.push(`%TAG ${handle} ${prefix}`);
|
|
169
|
+
}
|
|
170
|
+
return lines.join('\n');
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
Directives.defaultYaml = { explicit: false, version: '1.2' };
|
|
174
|
+
Directives.defaultTags = { '!!': 'tag:yaml.org,2002:' };
|
|
175
|
+
|
|
176
|
+
export { Directives };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
class YAMLError extends Error {
|
|
4
|
+
constructor(name, pos, code, message) {
|
|
5
|
+
super();
|
|
6
|
+
this.name = name;
|
|
7
|
+
this.code = code;
|
|
8
|
+
this.message = message;
|
|
9
|
+
this.pos = pos;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
class YAMLParseError extends YAMLError {
|
|
13
|
+
constructor(pos, code, message) {
|
|
14
|
+
super('YAMLParseError', pos, code, message);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
class YAMLWarning extends YAMLError {
|
|
18
|
+
constructor(pos, code, message) {
|
|
19
|
+
super('YAMLWarning', pos, code, message);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const prettifyError = (src, lc) => (error) => {
|
|
23
|
+
if (error.pos[0] === -1)
|
|
24
|
+
return;
|
|
25
|
+
error.linePos = error.pos.map(pos => lc.linePos(pos));
|
|
26
|
+
const { line, col } = error.linePos[0];
|
|
27
|
+
error.message += ` at line ${line}, column ${col}`;
|
|
28
|
+
let ci = col - 1;
|
|
29
|
+
let lineStr = src
|
|
30
|
+
.substring(lc.lineStarts[line - 1], lc.lineStarts[line])
|
|
31
|
+
.replace(/[\n\r]+$/, '');
|
|
32
|
+
// Trim to max 80 chars, keeping col position near the middle
|
|
33
|
+
if (ci >= 60 && lineStr.length > 80) {
|
|
34
|
+
const trimStart = Math.min(ci - 39, lineStr.length - 79);
|
|
35
|
+
lineStr = '…' + lineStr.substring(trimStart);
|
|
36
|
+
ci -= trimStart - 1;
|
|
37
|
+
}
|
|
38
|
+
if (lineStr.length > 80)
|
|
39
|
+
lineStr = lineStr.substring(0, 79) + '…';
|
|
40
|
+
// Include previous line in context if pointing at line start
|
|
41
|
+
if (line > 1 && /^ *$/.test(lineStr.substring(0, ci))) {
|
|
42
|
+
// Regexp won't match if start is trimmed
|
|
43
|
+
let prev = src.substring(lc.lineStarts[line - 2], lc.lineStarts[line - 1]);
|
|
44
|
+
if (prev.length > 80)
|
|
45
|
+
prev = prev.substring(0, 79) + '…\n';
|
|
46
|
+
lineStr = prev + lineStr;
|
|
47
|
+
}
|
|
48
|
+
if (/[^ ]/.test(lineStr)) {
|
|
49
|
+
let count = 1;
|
|
50
|
+
const end = error.linePos[1];
|
|
51
|
+
if (end?.line === line && end.col > col) {
|
|
52
|
+
count = Math.max(1, Math.min(end.col - col, 80 - ci));
|
|
53
|
+
}
|
|
54
|
+
const pointer = ' '.repeat(ci) + '^'.repeat(count);
|
|
55
|
+
error.message += `:\n\n${lineStr}\n${pointer}\n`;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
exports.YAMLError = YAMLError;
|
|
60
|
+
exports.YAMLParseError = YAMLParseError;
|
|
61
|
+
exports.YAMLWarning = YAMLWarning;
|
|
62
|
+
exports.prettifyError = prettifyError;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
class YAMLError extends Error {
|
|
2
|
+
constructor(name, pos, code, message) {
|
|
3
|
+
super();
|
|
4
|
+
this.name = name;
|
|
5
|
+
this.code = code;
|
|
6
|
+
this.message = message;
|
|
7
|
+
this.pos = pos;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
class YAMLParseError extends YAMLError {
|
|
11
|
+
constructor(pos, code, message) {
|
|
12
|
+
super('YAMLParseError', pos, code, message);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
class YAMLWarning extends YAMLError {
|
|
16
|
+
constructor(pos, code, message) {
|
|
17
|
+
super('YAMLWarning', pos, code, message);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const prettifyError = (src, lc) => (error) => {
|
|
21
|
+
if (error.pos[0] === -1)
|
|
22
|
+
return;
|
|
23
|
+
error.linePos = error.pos.map(pos => lc.linePos(pos));
|
|
24
|
+
const { line, col } = error.linePos[0];
|
|
25
|
+
error.message += ` at line ${line}, column ${col}`;
|
|
26
|
+
let ci = col - 1;
|
|
27
|
+
let lineStr = src
|
|
28
|
+
.substring(lc.lineStarts[line - 1], lc.lineStarts[line])
|
|
29
|
+
.replace(/[\n\r]+$/, '');
|
|
30
|
+
// Trim to max 80 chars, keeping col position near the middle
|
|
31
|
+
if (ci >= 60 && lineStr.length > 80) {
|
|
32
|
+
const trimStart = Math.min(ci - 39, lineStr.length - 79);
|
|
33
|
+
lineStr = '…' + lineStr.substring(trimStart);
|
|
34
|
+
ci -= trimStart - 1;
|
|
35
|
+
}
|
|
36
|
+
if (lineStr.length > 80)
|
|
37
|
+
lineStr = lineStr.substring(0, 79) + '…';
|
|
38
|
+
// Include previous line in context if pointing at line start
|
|
39
|
+
if (line > 1 && /^ *$/.test(lineStr.substring(0, ci))) {
|
|
40
|
+
// Regexp won't match if start is trimmed
|
|
41
|
+
let prev = src.substring(lc.lineStarts[line - 2], lc.lineStarts[line - 1]);
|
|
42
|
+
if (prev.length > 80)
|
|
43
|
+
prev = prev.substring(0, 79) + '…\n';
|
|
44
|
+
lineStr = prev + lineStr;
|
|
45
|
+
}
|
|
46
|
+
if (/[^ ]/.test(lineStr)) {
|
|
47
|
+
let count = 1;
|
|
48
|
+
const end = error.linePos[1];
|
|
49
|
+
if (end?.line === line && end.col > col) {
|
|
50
|
+
count = Math.max(1, Math.min(end.col - col, 80 - ci));
|
|
51
|
+
}
|
|
52
|
+
const pointer = ' '.repeat(ci) + '^'.repeat(count);
|
|
53
|
+
error.message += `:\n\n${lineStr}\n${pointer}\n`;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export { YAMLError, YAMLParseError, YAMLWarning, prettifyError };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var anchors = require('../doc/anchors.js');
|
|
4
|
+
var visit = require('../visit.js');
|
|
5
|
+
var identity = require('./identity.js');
|
|
6
|
+
var Node = require('./Node.js');
|
|
7
|
+
var toJS = require('./toJS.js');
|
|
8
|
+
|
|
9
|
+
class Alias extends Node.NodeBase {
|
|
10
|
+
constructor(source) {
|
|
11
|
+
super(identity.ALIAS);
|
|
12
|
+
this.source = source;
|
|
13
|
+
Object.defineProperty(this, 'tag', {
|
|
14
|
+
set() {
|
|
15
|
+
throw new Error('Alias nodes cannot have tags');
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Resolve the value of this alias within `doc`, finding the last
|
|
21
|
+
* instance of the `source` anchor before this node.
|
|
22
|
+
*/
|
|
23
|
+
resolve(doc, ctx) {
|
|
24
|
+
let nodes;
|
|
25
|
+
if (ctx?.aliasResolveCache) {
|
|
26
|
+
nodes = ctx.aliasResolveCache;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
nodes = [];
|
|
30
|
+
visit.visit(doc, {
|
|
31
|
+
Node: (_key, node) => {
|
|
32
|
+
if (identity.isAlias(node) || identity.hasAnchor(node))
|
|
33
|
+
nodes.push(node);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
if (ctx)
|
|
37
|
+
ctx.aliasResolveCache = nodes;
|
|
38
|
+
}
|
|
39
|
+
let found = undefined;
|
|
40
|
+
for (const node of nodes) {
|
|
41
|
+
if (node === this)
|
|
42
|
+
break;
|
|
43
|
+
if (node.anchor === this.source)
|
|
44
|
+
found = node;
|
|
45
|
+
}
|
|
46
|
+
return found;
|
|
47
|
+
}
|
|
48
|
+
toJSON(_arg, ctx) {
|
|
49
|
+
if (!ctx)
|
|
50
|
+
return { source: this.source };
|
|
51
|
+
const { anchors, doc, maxAliasCount } = ctx;
|
|
52
|
+
const source = this.resolve(doc, ctx);
|
|
53
|
+
if (!source) {
|
|
54
|
+
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
55
|
+
throw new ReferenceError(msg);
|
|
56
|
+
}
|
|
57
|
+
let data = anchors.get(source);
|
|
58
|
+
if (!data) {
|
|
59
|
+
// Resolve anchors for Node.prototype.toJS()
|
|
60
|
+
toJS.toJS(source, null, ctx);
|
|
61
|
+
data = anchors.get(source);
|
|
62
|
+
}
|
|
63
|
+
/* istanbul ignore if */
|
|
64
|
+
if (data?.res === undefined) {
|
|
65
|
+
const msg = 'This should not happen: Alias anchor was not resolved?';
|
|
66
|
+
throw new ReferenceError(msg);
|
|
67
|
+
}
|
|
68
|
+
if (maxAliasCount >= 0) {
|
|
69
|
+
data.count += 1;
|
|
70
|
+
if (data.aliasCount === 0)
|
|
71
|
+
data.aliasCount = getAliasCount(doc, source, anchors);
|
|
72
|
+
if (data.count * data.aliasCount > maxAliasCount) {
|
|
73
|
+
const msg = 'Excessive alias count indicates a resource exhaustion attack';
|
|
74
|
+
throw new ReferenceError(msg);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return data.res;
|
|
78
|
+
}
|
|
79
|
+
toString(ctx, _onComment, _onChompKeep) {
|
|
80
|
+
const src = `*${this.source}`;
|
|
81
|
+
if (ctx) {
|
|
82
|
+
anchors.anchorIsValid(this.source);
|
|
83
|
+
if (ctx.options.verifyAliasOrder && !ctx.anchors.has(this.source)) {
|
|
84
|
+
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
85
|
+
throw new Error(msg);
|
|
86
|
+
}
|
|
87
|
+
if (ctx.implicitKey)
|
|
88
|
+
return `${src} `;
|
|
89
|
+
}
|
|
90
|
+
return src;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function getAliasCount(doc, node, anchors) {
|
|
94
|
+
if (identity.isAlias(node)) {
|
|
95
|
+
const source = node.resolve(doc);
|
|
96
|
+
const anchor = anchors && source && anchors.get(source);
|
|
97
|
+
return anchor ? anchor.count * anchor.aliasCount : 0;
|
|
98
|
+
}
|
|
99
|
+
else if (identity.isCollection(node)) {
|
|
100
|
+
let count = 0;
|
|
101
|
+
for (const item of node.items) {
|
|
102
|
+
const c = getAliasCount(doc, item, anchors);
|
|
103
|
+
if (c > count)
|
|
104
|
+
count = c;
|
|
105
|
+
}
|
|
106
|
+
return count;
|
|
107
|
+
}
|
|
108
|
+
else if (identity.isPair(node)) {
|
|
109
|
+
const kc = getAliasCount(doc, node.key, anchors);
|
|
110
|
+
const vc = getAliasCount(doc, node.value, anchors);
|
|
111
|
+
return Math.max(kc, vc);
|
|
112
|
+
}
|
|
113
|
+
return 1;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
exports.Alias = Alias;
|