@windrun-huaiin/dev-scripts 13.1.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,219 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var directives = require('../doc/directives.js');
|
|
4
|
+
var Document = require('../doc/Document.js');
|
|
5
|
+
var errors = require('../errors.js');
|
|
6
|
+
var identity = require('../nodes/identity.js');
|
|
7
|
+
var composeDoc = require('./compose-doc.js');
|
|
8
|
+
var resolveEnd = require('./resolve-end.js');
|
|
9
|
+
|
|
10
|
+
function getErrorPos(src) {
|
|
11
|
+
if (typeof src === 'number')
|
|
12
|
+
return [src, src + 1];
|
|
13
|
+
if (Array.isArray(src))
|
|
14
|
+
return src.length === 2 ? src : [src[0], src[1]];
|
|
15
|
+
const { offset, source } = src;
|
|
16
|
+
return [offset, offset + (typeof source === 'string' ? source.length : 1)];
|
|
17
|
+
}
|
|
18
|
+
function parsePrelude(prelude) {
|
|
19
|
+
let comment = '';
|
|
20
|
+
let atComment = false;
|
|
21
|
+
let afterEmptyLine = false;
|
|
22
|
+
for (let i = 0; i < prelude.length; ++i) {
|
|
23
|
+
const source = prelude[i];
|
|
24
|
+
switch (source[0]) {
|
|
25
|
+
case '#':
|
|
26
|
+
comment +=
|
|
27
|
+
(comment === '' ? '' : afterEmptyLine ? '\n\n' : '\n') +
|
|
28
|
+
(source.substring(1) || ' ');
|
|
29
|
+
atComment = true;
|
|
30
|
+
afterEmptyLine = false;
|
|
31
|
+
break;
|
|
32
|
+
case '%':
|
|
33
|
+
if (prelude[i + 1]?.[0] !== '#')
|
|
34
|
+
i += 1;
|
|
35
|
+
atComment = false;
|
|
36
|
+
break;
|
|
37
|
+
default:
|
|
38
|
+
// This may be wrong after doc-end, but in that case it doesn't matter
|
|
39
|
+
if (!atComment)
|
|
40
|
+
afterEmptyLine = true;
|
|
41
|
+
atComment = false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return { comment, afterEmptyLine };
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Compose a stream of CST nodes into a stream of YAML Documents.
|
|
48
|
+
*
|
|
49
|
+
* ```ts
|
|
50
|
+
* import { Composer, Parser } from 'yaml'
|
|
51
|
+
*
|
|
52
|
+
* const src: string = ...
|
|
53
|
+
* const tokens = new Parser().parse(src)
|
|
54
|
+
* const docs = new Composer().compose(tokens)
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
class Composer {
|
|
58
|
+
constructor(options = {}) {
|
|
59
|
+
this.doc = null;
|
|
60
|
+
this.atDirectives = false;
|
|
61
|
+
this.prelude = [];
|
|
62
|
+
this.errors = [];
|
|
63
|
+
this.warnings = [];
|
|
64
|
+
this.onError = (source, code, message, warning) => {
|
|
65
|
+
const pos = getErrorPos(source);
|
|
66
|
+
if (warning)
|
|
67
|
+
this.warnings.push(new errors.YAMLWarning(pos, code, message));
|
|
68
|
+
else
|
|
69
|
+
this.errors.push(new errors.YAMLParseError(pos, code, message));
|
|
70
|
+
};
|
|
71
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
72
|
+
this.directives = new directives.Directives({ version: options.version || '1.2' });
|
|
73
|
+
this.options = options;
|
|
74
|
+
}
|
|
75
|
+
decorate(doc, afterDoc) {
|
|
76
|
+
const { comment, afterEmptyLine } = parsePrelude(this.prelude);
|
|
77
|
+
//console.log({ dc: doc.comment, prelude, comment })
|
|
78
|
+
if (comment) {
|
|
79
|
+
const dc = doc.contents;
|
|
80
|
+
if (afterDoc) {
|
|
81
|
+
doc.comment = doc.comment ? `${doc.comment}\n${comment}` : comment;
|
|
82
|
+
}
|
|
83
|
+
else if (afterEmptyLine || doc.directives.docStart || !dc) {
|
|
84
|
+
doc.commentBefore = comment;
|
|
85
|
+
}
|
|
86
|
+
else if (identity.isCollection(dc) && !dc.flow && dc.items.length > 0) {
|
|
87
|
+
let it = dc.items[0];
|
|
88
|
+
if (identity.isPair(it))
|
|
89
|
+
it = it.key;
|
|
90
|
+
const cb = it.commentBefore;
|
|
91
|
+
it.commentBefore = cb ? `${comment}\n${cb}` : comment;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
const cb = dc.commentBefore;
|
|
95
|
+
dc.commentBefore = cb ? `${comment}\n${cb}` : comment;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (afterDoc) {
|
|
99
|
+
Array.prototype.push.apply(doc.errors, this.errors);
|
|
100
|
+
Array.prototype.push.apply(doc.warnings, this.warnings);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
doc.errors = this.errors;
|
|
104
|
+
doc.warnings = this.warnings;
|
|
105
|
+
}
|
|
106
|
+
this.prelude = [];
|
|
107
|
+
this.errors = [];
|
|
108
|
+
this.warnings = [];
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Current stream status information.
|
|
112
|
+
*
|
|
113
|
+
* Mostly useful at the end of input for an empty stream.
|
|
114
|
+
*/
|
|
115
|
+
streamInfo() {
|
|
116
|
+
return {
|
|
117
|
+
comment: parsePrelude(this.prelude).comment,
|
|
118
|
+
directives: this.directives,
|
|
119
|
+
errors: this.errors,
|
|
120
|
+
warnings: this.warnings
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Compose tokens into documents.
|
|
125
|
+
*
|
|
126
|
+
* @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.
|
|
127
|
+
* @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.
|
|
128
|
+
*/
|
|
129
|
+
*compose(tokens, forceDoc = false, endOffset = -1) {
|
|
130
|
+
for (const token of tokens)
|
|
131
|
+
yield* this.next(token);
|
|
132
|
+
yield* this.end(forceDoc, endOffset);
|
|
133
|
+
}
|
|
134
|
+
/** Advance the composer by one CST token. */
|
|
135
|
+
*next(token) {
|
|
136
|
+
switch (token.type) {
|
|
137
|
+
case 'directive':
|
|
138
|
+
this.directives.add(token.source, (offset, message, warning) => {
|
|
139
|
+
const pos = getErrorPos(token);
|
|
140
|
+
pos[0] += offset;
|
|
141
|
+
this.onError(pos, 'BAD_DIRECTIVE', message, warning);
|
|
142
|
+
});
|
|
143
|
+
this.prelude.push(token.source);
|
|
144
|
+
this.atDirectives = true;
|
|
145
|
+
break;
|
|
146
|
+
case 'document': {
|
|
147
|
+
const doc = composeDoc.composeDoc(this.options, this.directives, token, this.onError);
|
|
148
|
+
if (this.atDirectives && !doc.directives.docStart)
|
|
149
|
+
this.onError(token, 'MISSING_CHAR', 'Missing directives-end/doc-start indicator line');
|
|
150
|
+
this.decorate(doc, false);
|
|
151
|
+
if (this.doc)
|
|
152
|
+
yield this.doc;
|
|
153
|
+
this.doc = doc;
|
|
154
|
+
this.atDirectives = false;
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
case 'byte-order-mark':
|
|
158
|
+
case 'space':
|
|
159
|
+
break;
|
|
160
|
+
case 'comment':
|
|
161
|
+
case 'newline':
|
|
162
|
+
this.prelude.push(token.source);
|
|
163
|
+
break;
|
|
164
|
+
case 'error': {
|
|
165
|
+
const msg = token.source
|
|
166
|
+
? `${token.message}: ${JSON.stringify(token.source)}`
|
|
167
|
+
: token.message;
|
|
168
|
+
const error = new errors.YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', msg);
|
|
169
|
+
if (this.atDirectives || !this.doc)
|
|
170
|
+
this.errors.push(error);
|
|
171
|
+
else
|
|
172
|
+
this.doc.errors.push(error);
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
case 'doc-end': {
|
|
176
|
+
if (!this.doc) {
|
|
177
|
+
const msg = 'Unexpected doc-end without preceding document';
|
|
178
|
+
this.errors.push(new errors.YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', msg));
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
this.doc.directives.docEnd = true;
|
|
182
|
+
const end = resolveEnd.resolveEnd(token.end, token.offset + token.source.length, this.doc.options.strict, this.onError);
|
|
183
|
+
this.decorate(this.doc, true);
|
|
184
|
+
if (end.comment) {
|
|
185
|
+
const dc = this.doc.comment;
|
|
186
|
+
this.doc.comment = dc ? `${dc}\n${end.comment}` : end.comment;
|
|
187
|
+
}
|
|
188
|
+
this.doc.range[2] = end.offset;
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
default:
|
|
192
|
+
this.errors.push(new errors.YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', `Unsupported token ${token.type}`));
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Call at end of input to yield any remaining document.
|
|
197
|
+
*
|
|
198
|
+
* @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.
|
|
199
|
+
* @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.
|
|
200
|
+
*/
|
|
201
|
+
*end(forceDoc = false, endOffset = -1) {
|
|
202
|
+
if (this.doc) {
|
|
203
|
+
this.decorate(this.doc, true);
|
|
204
|
+
yield this.doc;
|
|
205
|
+
this.doc = null;
|
|
206
|
+
}
|
|
207
|
+
else if (forceDoc) {
|
|
208
|
+
const opts = Object.assign({ _directives: this.directives }, this.options);
|
|
209
|
+
const doc = new Document.Document(undefined, opts);
|
|
210
|
+
if (this.atDirectives)
|
|
211
|
+
this.onError(endOffset, 'MISSING_CHAR', 'Missing directives-end indicator line');
|
|
212
|
+
doc.range = [0, endOffset, endOffset];
|
|
213
|
+
this.decorate(doc, false);
|
|
214
|
+
yield doc;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
exports.Composer = Composer;
|
package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/composer.mjs
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { Directives } from '../doc/directives.mjs';
|
|
2
|
+
import { Document } from '../doc/Document.mjs';
|
|
3
|
+
import { YAMLWarning, YAMLParseError } from '../errors.mjs';
|
|
4
|
+
import { isCollection, isPair } from '../nodes/identity.mjs';
|
|
5
|
+
import { composeDoc } from './compose-doc.mjs';
|
|
6
|
+
import { resolveEnd } from './resolve-end.mjs';
|
|
7
|
+
|
|
8
|
+
function getErrorPos(src) {
|
|
9
|
+
if (typeof src === 'number')
|
|
10
|
+
return [src, src + 1];
|
|
11
|
+
if (Array.isArray(src))
|
|
12
|
+
return src.length === 2 ? src : [src[0], src[1]];
|
|
13
|
+
const { offset, source } = src;
|
|
14
|
+
return [offset, offset + (typeof source === 'string' ? source.length : 1)];
|
|
15
|
+
}
|
|
16
|
+
function parsePrelude(prelude) {
|
|
17
|
+
let comment = '';
|
|
18
|
+
let atComment = false;
|
|
19
|
+
let afterEmptyLine = false;
|
|
20
|
+
for (let i = 0; i < prelude.length; ++i) {
|
|
21
|
+
const source = prelude[i];
|
|
22
|
+
switch (source[0]) {
|
|
23
|
+
case '#':
|
|
24
|
+
comment +=
|
|
25
|
+
(comment === '' ? '' : afterEmptyLine ? '\n\n' : '\n') +
|
|
26
|
+
(source.substring(1) || ' ');
|
|
27
|
+
atComment = true;
|
|
28
|
+
afterEmptyLine = false;
|
|
29
|
+
break;
|
|
30
|
+
case '%':
|
|
31
|
+
if (prelude[i + 1]?.[0] !== '#')
|
|
32
|
+
i += 1;
|
|
33
|
+
atComment = false;
|
|
34
|
+
break;
|
|
35
|
+
default:
|
|
36
|
+
// This may be wrong after doc-end, but in that case it doesn't matter
|
|
37
|
+
if (!atComment)
|
|
38
|
+
afterEmptyLine = true;
|
|
39
|
+
atComment = false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return { comment, afterEmptyLine };
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Compose a stream of CST nodes into a stream of YAML Documents.
|
|
46
|
+
*
|
|
47
|
+
* ```ts
|
|
48
|
+
* import { Composer, Parser } from 'yaml'
|
|
49
|
+
*
|
|
50
|
+
* const src: string = ...
|
|
51
|
+
* const tokens = new Parser().parse(src)
|
|
52
|
+
* const docs = new Composer().compose(tokens)
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
class Composer {
|
|
56
|
+
constructor(options = {}) {
|
|
57
|
+
this.doc = null;
|
|
58
|
+
this.atDirectives = false;
|
|
59
|
+
this.prelude = [];
|
|
60
|
+
this.errors = [];
|
|
61
|
+
this.warnings = [];
|
|
62
|
+
this.onError = (source, code, message, warning) => {
|
|
63
|
+
const pos = getErrorPos(source);
|
|
64
|
+
if (warning)
|
|
65
|
+
this.warnings.push(new YAMLWarning(pos, code, message));
|
|
66
|
+
else
|
|
67
|
+
this.errors.push(new YAMLParseError(pos, code, message));
|
|
68
|
+
};
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
70
|
+
this.directives = new Directives({ version: options.version || '1.2' });
|
|
71
|
+
this.options = options;
|
|
72
|
+
}
|
|
73
|
+
decorate(doc, afterDoc) {
|
|
74
|
+
const { comment, afterEmptyLine } = parsePrelude(this.prelude);
|
|
75
|
+
//console.log({ dc: doc.comment, prelude, comment })
|
|
76
|
+
if (comment) {
|
|
77
|
+
const dc = doc.contents;
|
|
78
|
+
if (afterDoc) {
|
|
79
|
+
doc.comment = doc.comment ? `${doc.comment}\n${comment}` : comment;
|
|
80
|
+
}
|
|
81
|
+
else if (afterEmptyLine || doc.directives.docStart || !dc) {
|
|
82
|
+
doc.commentBefore = comment;
|
|
83
|
+
}
|
|
84
|
+
else if (isCollection(dc) && !dc.flow && dc.items.length > 0) {
|
|
85
|
+
let it = dc.items[0];
|
|
86
|
+
if (isPair(it))
|
|
87
|
+
it = it.key;
|
|
88
|
+
const cb = it.commentBefore;
|
|
89
|
+
it.commentBefore = cb ? `${comment}\n${cb}` : comment;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
const cb = dc.commentBefore;
|
|
93
|
+
dc.commentBefore = cb ? `${comment}\n${cb}` : comment;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (afterDoc) {
|
|
97
|
+
Array.prototype.push.apply(doc.errors, this.errors);
|
|
98
|
+
Array.prototype.push.apply(doc.warnings, this.warnings);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
doc.errors = this.errors;
|
|
102
|
+
doc.warnings = this.warnings;
|
|
103
|
+
}
|
|
104
|
+
this.prelude = [];
|
|
105
|
+
this.errors = [];
|
|
106
|
+
this.warnings = [];
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Current stream status information.
|
|
110
|
+
*
|
|
111
|
+
* Mostly useful at the end of input for an empty stream.
|
|
112
|
+
*/
|
|
113
|
+
streamInfo() {
|
|
114
|
+
return {
|
|
115
|
+
comment: parsePrelude(this.prelude).comment,
|
|
116
|
+
directives: this.directives,
|
|
117
|
+
errors: this.errors,
|
|
118
|
+
warnings: this.warnings
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Compose tokens into documents.
|
|
123
|
+
*
|
|
124
|
+
* @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.
|
|
125
|
+
* @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.
|
|
126
|
+
*/
|
|
127
|
+
*compose(tokens, forceDoc = false, endOffset = -1) {
|
|
128
|
+
for (const token of tokens)
|
|
129
|
+
yield* this.next(token);
|
|
130
|
+
yield* this.end(forceDoc, endOffset);
|
|
131
|
+
}
|
|
132
|
+
/** Advance the composer by one CST token. */
|
|
133
|
+
*next(token) {
|
|
134
|
+
switch (token.type) {
|
|
135
|
+
case 'directive':
|
|
136
|
+
this.directives.add(token.source, (offset, message, warning) => {
|
|
137
|
+
const pos = getErrorPos(token);
|
|
138
|
+
pos[0] += offset;
|
|
139
|
+
this.onError(pos, 'BAD_DIRECTIVE', message, warning);
|
|
140
|
+
});
|
|
141
|
+
this.prelude.push(token.source);
|
|
142
|
+
this.atDirectives = true;
|
|
143
|
+
break;
|
|
144
|
+
case 'document': {
|
|
145
|
+
const doc = composeDoc(this.options, this.directives, token, this.onError);
|
|
146
|
+
if (this.atDirectives && !doc.directives.docStart)
|
|
147
|
+
this.onError(token, 'MISSING_CHAR', 'Missing directives-end/doc-start indicator line');
|
|
148
|
+
this.decorate(doc, false);
|
|
149
|
+
if (this.doc)
|
|
150
|
+
yield this.doc;
|
|
151
|
+
this.doc = doc;
|
|
152
|
+
this.atDirectives = false;
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
case 'byte-order-mark':
|
|
156
|
+
case 'space':
|
|
157
|
+
break;
|
|
158
|
+
case 'comment':
|
|
159
|
+
case 'newline':
|
|
160
|
+
this.prelude.push(token.source);
|
|
161
|
+
break;
|
|
162
|
+
case 'error': {
|
|
163
|
+
const msg = token.source
|
|
164
|
+
? `${token.message}: ${JSON.stringify(token.source)}`
|
|
165
|
+
: token.message;
|
|
166
|
+
const error = new YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', msg);
|
|
167
|
+
if (this.atDirectives || !this.doc)
|
|
168
|
+
this.errors.push(error);
|
|
169
|
+
else
|
|
170
|
+
this.doc.errors.push(error);
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
case 'doc-end': {
|
|
174
|
+
if (!this.doc) {
|
|
175
|
+
const msg = 'Unexpected doc-end without preceding document';
|
|
176
|
+
this.errors.push(new YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', msg));
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
this.doc.directives.docEnd = true;
|
|
180
|
+
const end = resolveEnd(token.end, token.offset + token.source.length, this.doc.options.strict, this.onError);
|
|
181
|
+
this.decorate(this.doc, true);
|
|
182
|
+
if (end.comment) {
|
|
183
|
+
const dc = this.doc.comment;
|
|
184
|
+
this.doc.comment = dc ? `${dc}\n${end.comment}` : end.comment;
|
|
185
|
+
}
|
|
186
|
+
this.doc.range[2] = end.offset;
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
default:
|
|
190
|
+
this.errors.push(new YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', `Unsupported token ${token.type}`));
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Call at end of input to yield any remaining document.
|
|
195
|
+
*
|
|
196
|
+
* @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.
|
|
197
|
+
* @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.
|
|
198
|
+
*/
|
|
199
|
+
*end(forceDoc = false, endOffset = -1) {
|
|
200
|
+
if (this.doc) {
|
|
201
|
+
this.decorate(this.doc, true);
|
|
202
|
+
yield this.doc;
|
|
203
|
+
this.doc = null;
|
|
204
|
+
}
|
|
205
|
+
else if (forceDoc) {
|
|
206
|
+
const opts = Object.assign({ _directives: this.directives }, this.options);
|
|
207
|
+
const doc = new Document(undefined, opts);
|
|
208
|
+
if (this.atDirectives)
|
|
209
|
+
this.onError(endOffset, 'MISSING_CHAR', 'Missing directives-end indicator line');
|
|
210
|
+
doc.range = [0, endOffset, endOffset];
|
|
211
|
+
this.decorate(doc, false);
|
|
212
|
+
yield doc;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export { Composer };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Pair = require('../nodes/Pair.js');
|
|
4
|
+
var YAMLMap = require('../nodes/YAMLMap.js');
|
|
5
|
+
var resolveProps = require('./resolve-props.js');
|
|
6
|
+
var utilContainsNewline = require('./util-contains-newline.js');
|
|
7
|
+
var utilFlowIndentCheck = require('./util-flow-indent-check.js');
|
|
8
|
+
var utilMapIncludes = require('./util-map-includes.js');
|
|
9
|
+
|
|
10
|
+
const startColMsg = 'All mapping items must start at the same column';
|
|
11
|
+
function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, tag) {
|
|
12
|
+
const NodeClass = tag?.nodeClass ?? YAMLMap.YAMLMap;
|
|
13
|
+
const map = new NodeClass(ctx.schema);
|
|
14
|
+
if (ctx.atRoot)
|
|
15
|
+
ctx.atRoot = false;
|
|
16
|
+
let offset = bm.offset;
|
|
17
|
+
let commentEnd = null;
|
|
18
|
+
for (const collItem of bm.items) {
|
|
19
|
+
const { start, key, sep, value } = collItem;
|
|
20
|
+
// key properties
|
|
21
|
+
const keyProps = resolveProps.resolveProps(start, {
|
|
22
|
+
indicator: 'explicit-key-ind',
|
|
23
|
+
next: key ?? sep?.[0],
|
|
24
|
+
offset,
|
|
25
|
+
onError,
|
|
26
|
+
parentIndent: bm.indent,
|
|
27
|
+
startOnNewline: true
|
|
28
|
+
});
|
|
29
|
+
const implicitKey = !keyProps.found;
|
|
30
|
+
if (implicitKey) {
|
|
31
|
+
if (key) {
|
|
32
|
+
if (key.type === 'block-seq')
|
|
33
|
+
onError(offset, 'BLOCK_AS_IMPLICIT_KEY', 'A block sequence may not be used as an implicit map key');
|
|
34
|
+
else if ('indent' in key && key.indent !== bm.indent)
|
|
35
|
+
onError(offset, 'BAD_INDENT', startColMsg);
|
|
36
|
+
}
|
|
37
|
+
if (!keyProps.anchor && !keyProps.tag && !sep) {
|
|
38
|
+
commentEnd = keyProps.end;
|
|
39
|
+
if (keyProps.comment) {
|
|
40
|
+
if (map.comment)
|
|
41
|
+
map.comment += '\n' + keyProps.comment;
|
|
42
|
+
else
|
|
43
|
+
map.comment = keyProps.comment;
|
|
44
|
+
}
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
if (keyProps.newlineAfterProp || utilContainsNewline.containsNewline(key)) {
|
|
48
|
+
onError(key ?? start[start.length - 1], 'MULTILINE_IMPLICIT_KEY', 'Implicit keys need to be on a single line');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else if (keyProps.found?.indent !== bm.indent) {
|
|
52
|
+
onError(offset, 'BAD_INDENT', startColMsg);
|
|
53
|
+
}
|
|
54
|
+
// key value
|
|
55
|
+
ctx.atKey = true;
|
|
56
|
+
const keyStart = keyProps.end;
|
|
57
|
+
const keyNode = key
|
|
58
|
+
? composeNode(ctx, key, keyProps, onError)
|
|
59
|
+
: composeEmptyNode(ctx, keyStart, start, null, keyProps, onError);
|
|
60
|
+
if (ctx.schema.compat)
|
|
61
|
+
utilFlowIndentCheck.flowIndentCheck(bm.indent, key, onError);
|
|
62
|
+
ctx.atKey = false;
|
|
63
|
+
if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
|
|
64
|
+
onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');
|
|
65
|
+
// value properties
|
|
66
|
+
const valueProps = resolveProps.resolveProps(sep ?? [], {
|
|
67
|
+
indicator: 'map-value-ind',
|
|
68
|
+
next: value,
|
|
69
|
+
offset: keyNode.range[2],
|
|
70
|
+
onError,
|
|
71
|
+
parentIndent: bm.indent,
|
|
72
|
+
startOnNewline: !key || key.type === 'block-scalar'
|
|
73
|
+
});
|
|
74
|
+
offset = valueProps.end;
|
|
75
|
+
if (valueProps.found) {
|
|
76
|
+
if (implicitKey) {
|
|
77
|
+
if (value?.type === 'block-map' && !valueProps.hasNewline)
|
|
78
|
+
onError(offset, 'BLOCK_AS_IMPLICIT_KEY', 'Nested mappings are not allowed in compact mappings');
|
|
79
|
+
if (ctx.options.strict &&
|
|
80
|
+
keyProps.start < valueProps.found.offset - 1024)
|
|
81
|
+
onError(keyNode.range, 'KEY_OVER_1024_CHARS', 'The : indicator must be at most 1024 chars after the start of an implicit block mapping key');
|
|
82
|
+
}
|
|
83
|
+
// value value
|
|
84
|
+
const valueNode = value
|
|
85
|
+
? composeNode(ctx, value, valueProps, onError)
|
|
86
|
+
: composeEmptyNode(ctx, offset, sep, null, valueProps, onError);
|
|
87
|
+
if (ctx.schema.compat)
|
|
88
|
+
utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
|
|
89
|
+
offset = valueNode.range[2];
|
|
90
|
+
const pair = new Pair.Pair(keyNode, valueNode);
|
|
91
|
+
if (ctx.options.keepSourceTokens)
|
|
92
|
+
pair.srcToken = collItem;
|
|
93
|
+
map.items.push(pair);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
// key with no value
|
|
97
|
+
if (implicitKey)
|
|
98
|
+
onError(keyNode.range, 'MISSING_CHAR', 'Implicit map keys need to be followed by map values');
|
|
99
|
+
if (valueProps.comment) {
|
|
100
|
+
if (keyNode.comment)
|
|
101
|
+
keyNode.comment += '\n' + valueProps.comment;
|
|
102
|
+
else
|
|
103
|
+
keyNode.comment = valueProps.comment;
|
|
104
|
+
}
|
|
105
|
+
const pair = new Pair.Pair(keyNode);
|
|
106
|
+
if (ctx.options.keepSourceTokens)
|
|
107
|
+
pair.srcToken = collItem;
|
|
108
|
+
map.items.push(pair);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (commentEnd && commentEnd < offset)
|
|
112
|
+
onError(commentEnd, 'IMPOSSIBLE', 'Map comment with trailing content');
|
|
113
|
+
map.range = [bm.offset, offset, commentEnd ?? offset];
|
|
114
|
+
return map;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
exports.resolveBlockMap = resolveBlockMap;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { Pair } from '../nodes/Pair.mjs';
|
|
2
|
+
import { YAMLMap } from '../nodes/YAMLMap.mjs';
|
|
3
|
+
import { resolveProps } from './resolve-props.mjs';
|
|
4
|
+
import { containsNewline } from './util-contains-newline.mjs';
|
|
5
|
+
import { flowIndentCheck } from './util-flow-indent-check.mjs';
|
|
6
|
+
import { mapIncludes } from './util-map-includes.mjs';
|
|
7
|
+
|
|
8
|
+
const startColMsg = 'All mapping items must start at the same column';
|
|
9
|
+
function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, tag) {
|
|
10
|
+
const NodeClass = tag?.nodeClass ?? YAMLMap;
|
|
11
|
+
const map = new NodeClass(ctx.schema);
|
|
12
|
+
if (ctx.atRoot)
|
|
13
|
+
ctx.atRoot = false;
|
|
14
|
+
let offset = bm.offset;
|
|
15
|
+
let commentEnd = null;
|
|
16
|
+
for (const collItem of bm.items) {
|
|
17
|
+
const { start, key, sep, value } = collItem;
|
|
18
|
+
// key properties
|
|
19
|
+
const keyProps = resolveProps(start, {
|
|
20
|
+
indicator: 'explicit-key-ind',
|
|
21
|
+
next: key ?? sep?.[0],
|
|
22
|
+
offset,
|
|
23
|
+
onError,
|
|
24
|
+
parentIndent: bm.indent,
|
|
25
|
+
startOnNewline: true
|
|
26
|
+
});
|
|
27
|
+
const implicitKey = !keyProps.found;
|
|
28
|
+
if (implicitKey) {
|
|
29
|
+
if (key) {
|
|
30
|
+
if (key.type === 'block-seq')
|
|
31
|
+
onError(offset, 'BLOCK_AS_IMPLICIT_KEY', 'A block sequence may not be used as an implicit map key');
|
|
32
|
+
else if ('indent' in key && key.indent !== bm.indent)
|
|
33
|
+
onError(offset, 'BAD_INDENT', startColMsg);
|
|
34
|
+
}
|
|
35
|
+
if (!keyProps.anchor && !keyProps.tag && !sep) {
|
|
36
|
+
commentEnd = keyProps.end;
|
|
37
|
+
if (keyProps.comment) {
|
|
38
|
+
if (map.comment)
|
|
39
|
+
map.comment += '\n' + keyProps.comment;
|
|
40
|
+
else
|
|
41
|
+
map.comment = keyProps.comment;
|
|
42
|
+
}
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
if (keyProps.newlineAfterProp || containsNewline(key)) {
|
|
46
|
+
onError(key ?? start[start.length - 1], 'MULTILINE_IMPLICIT_KEY', 'Implicit keys need to be on a single line');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
else if (keyProps.found?.indent !== bm.indent) {
|
|
50
|
+
onError(offset, 'BAD_INDENT', startColMsg);
|
|
51
|
+
}
|
|
52
|
+
// key value
|
|
53
|
+
ctx.atKey = true;
|
|
54
|
+
const keyStart = keyProps.end;
|
|
55
|
+
const keyNode = key
|
|
56
|
+
? composeNode(ctx, key, keyProps, onError)
|
|
57
|
+
: composeEmptyNode(ctx, keyStart, start, null, keyProps, onError);
|
|
58
|
+
if (ctx.schema.compat)
|
|
59
|
+
flowIndentCheck(bm.indent, key, onError);
|
|
60
|
+
ctx.atKey = false;
|
|
61
|
+
if (mapIncludes(ctx, map.items, keyNode))
|
|
62
|
+
onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');
|
|
63
|
+
// value properties
|
|
64
|
+
const valueProps = resolveProps(sep ?? [], {
|
|
65
|
+
indicator: 'map-value-ind',
|
|
66
|
+
next: value,
|
|
67
|
+
offset: keyNode.range[2],
|
|
68
|
+
onError,
|
|
69
|
+
parentIndent: bm.indent,
|
|
70
|
+
startOnNewline: !key || key.type === 'block-scalar'
|
|
71
|
+
});
|
|
72
|
+
offset = valueProps.end;
|
|
73
|
+
if (valueProps.found) {
|
|
74
|
+
if (implicitKey) {
|
|
75
|
+
if (value?.type === 'block-map' && !valueProps.hasNewline)
|
|
76
|
+
onError(offset, 'BLOCK_AS_IMPLICIT_KEY', 'Nested mappings are not allowed in compact mappings');
|
|
77
|
+
if (ctx.options.strict &&
|
|
78
|
+
keyProps.start < valueProps.found.offset - 1024)
|
|
79
|
+
onError(keyNode.range, 'KEY_OVER_1024_CHARS', 'The : indicator must be at most 1024 chars after the start of an implicit block mapping key');
|
|
80
|
+
}
|
|
81
|
+
// value value
|
|
82
|
+
const valueNode = value
|
|
83
|
+
? composeNode(ctx, value, valueProps, onError)
|
|
84
|
+
: composeEmptyNode(ctx, offset, sep, null, valueProps, onError);
|
|
85
|
+
if (ctx.schema.compat)
|
|
86
|
+
flowIndentCheck(bm.indent, value, onError);
|
|
87
|
+
offset = valueNode.range[2];
|
|
88
|
+
const pair = new Pair(keyNode, valueNode);
|
|
89
|
+
if (ctx.options.keepSourceTokens)
|
|
90
|
+
pair.srcToken = collItem;
|
|
91
|
+
map.items.push(pair);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
// key with no value
|
|
95
|
+
if (implicitKey)
|
|
96
|
+
onError(keyNode.range, 'MISSING_CHAR', 'Implicit map keys need to be followed by map values');
|
|
97
|
+
if (valueProps.comment) {
|
|
98
|
+
if (keyNode.comment)
|
|
99
|
+
keyNode.comment += '\n' + valueProps.comment;
|
|
100
|
+
else
|
|
101
|
+
keyNode.comment = valueProps.comment;
|
|
102
|
+
}
|
|
103
|
+
const pair = new Pair(keyNode);
|
|
104
|
+
if (ctx.options.keepSourceTokens)
|
|
105
|
+
pair.srcToken = collItem;
|
|
106
|
+
map.items.push(pair);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (commentEnd && commentEnd < offset)
|
|
110
|
+
onError(commentEnd, 'IMPOSSIBLE', 'Map comment with trailing content');
|
|
111
|
+
map.range = [bm.offset, offset, commentEnd ?? offset];
|
|
112
|
+
return map;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export { resolveBlockMap };
|