@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,114 @@
|
|
|
1
|
+
import { anchorIsValid } from '../doc/anchors.mjs';
|
|
2
|
+
import { visit } from '../visit.mjs';
|
|
3
|
+
import { ALIAS, isAlias, isCollection, isPair, hasAnchor } from './identity.mjs';
|
|
4
|
+
import { NodeBase } from './Node.mjs';
|
|
5
|
+
import { toJS } from './toJS.mjs';
|
|
6
|
+
|
|
7
|
+
class Alias extends NodeBase {
|
|
8
|
+
constructor(source) {
|
|
9
|
+
super(ALIAS);
|
|
10
|
+
this.source = source;
|
|
11
|
+
Object.defineProperty(this, 'tag', {
|
|
12
|
+
set() {
|
|
13
|
+
throw new Error('Alias nodes cannot have tags');
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Resolve the value of this alias within `doc`, finding the last
|
|
19
|
+
* instance of the `source` anchor before this node.
|
|
20
|
+
*/
|
|
21
|
+
resolve(doc, ctx) {
|
|
22
|
+
let nodes;
|
|
23
|
+
if (ctx?.aliasResolveCache) {
|
|
24
|
+
nodes = ctx.aliasResolveCache;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
nodes = [];
|
|
28
|
+
visit(doc, {
|
|
29
|
+
Node: (_key, node) => {
|
|
30
|
+
if (isAlias(node) || hasAnchor(node))
|
|
31
|
+
nodes.push(node);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
if (ctx)
|
|
35
|
+
ctx.aliasResolveCache = nodes;
|
|
36
|
+
}
|
|
37
|
+
let found = undefined;
|
|
38
|
+
for (const node of nodes) {
|
|
39
|
+
if (node === this)
|
|
40
|
+
break;
|
|
41
|
+
if (node.anchor === this.source)
|
|
42
|
+
found = node;
|
|
43
|
+
}
|
|
44
|
+
return found;
|
|
45
|
+
}
|
|
46
|
+
toJSON(_arg, ctx) {
|
|
47
|
+
if (!ctx)
|
|
48
|
+
return { source: this.source };
|
|
49
|
+
const { anchors, doc, maxAliasCount } = ctx;
|
|
50
|
+
const source = this.resolve(doc, ctx);
|
|
51
|
+
if (!source) {
|
|
52
|
+
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
53
|
+
throw new ReferenceError(msg);
|
|
54
|
+
}
|
|
55
|
+
let data = anchors.get(source);
|
|
56
|
+
if (!data) {
|
|
57
|
+
// Resolve anchors for Node.prototype.toJS()
|
|
58
|
+
toJS(source, null, ctx);
|
|
59
|
+
data = anchors.get(source);
|
|
60
|
+
}
|
|
61
|
+
/* istanbul ignore if */
|
|
62
|
+
if (data?.res === undefined) {
|
|
63
|
+
const msg = 'This should not happen: Alias anchor was not resolved?';
|
|
64
|
+
throw new ReferenceError(msg);
|
|
65
|
+
}
|
|
66
|
+
if (maxAliasCount >= 0) {
|
|
67
|
+
data.count += 1;
|
|
68
|
+
if (data.aliasCount === 0)
|
|
69
|
+
data.aliasCount = getAliasCount(doc, source, anchors);
|
|
70
|
+
if (data.count * data.aliasCount > maxAliasCount) {
|
|
71
|
+
const msg = 'Excessive alias count indicates a resource exhaustion attack';
|
|
72
|
+
throw new ReferenceError(msg);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return data.res;
|
|
76
|
+
}
|
|
77
|
+
toString(ctx, _onComment, _onChompKeep) {
|
|
78
|
+
const src = `*${this.source}`;
|
|
79
|
+
if (ctx) {
|
|
80
|
+
anchorIsValid(this.source);
|
|
81
|
+
if (ctx.options.verifyAliasOrder && !ctx.anchors.has(this.source)) {
|
|
82
|
+
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
83
|
+
throw new Error(msg);
|
|
84
|
+
}
|
|
85
|
+
if (ctx.implicitKey)
|
|
86
|
+
return `${src} `;
|
|
87
|
+
}
|
|
88
|
+
return src;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function getAliasCount(doc, node, anchors) {
|
|
92
|
+
if (isAlias(node)) {
|
|
93
|
+
const source = node.resolve(doc);
|
|
94
|
+
const anchor = anchors && source && anchors.get(source);
|
|
95
|
+
return anchor ? anchor.count * anchor.aliasCount : 0;
|
|
96
|
+
}
|
|
97
|
+
else if (isCollection(node)) {
|
|
98
|
+
let count = 0;
|
|
99
|
+
for (const item of node.items) {
|
|
100
|
+
const c = getAliasCount(doc, item, anchors);
|
|
101
|
+
if (c > count)
|
|
102
|
+
count = c;
|
|
103
|
+
}
|
|
104
|
+
return count;
|
|
105
|
+
}
|
|
106
|
+
else if (isPair(node)) {
|
|
107
|
+
const kc = getAliasCount(doc, node.key, anchors);
|
|
108
|
+
const vc = getAliasCount(doc, node.value, anchors);
|
|
109
|
+
return Math.max(kc, vc);
|
|
110
|
+
}
|
|
111
|
+
return 1;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export { Alias };
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var createNode = require('../doc/createNode.js');
|
|
4
|
+
var identity = require('./identity.js');
|
|
5
|
+
var Node = require('./Node.js');
|
|
6
|
+
|
|
7
|
+
function collectionFromPath(schema, path, value) {
|
|
8
|
+
let v = value;
|
|
9
|
+
for (let i = path.length - 1; i >= 0; --i) {
|
|
10
|
+
const k = path[i];
|
|
11
|
+
if (typeof k === 'number' && Number.isInteger(k) && k >= 0) {
|
|
12
|
+
const a = [];
|
|
13
|
+
a[k] = v;
|
|
14
|
+
v = a;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
v = new Map([[k, v]]);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return createNode.createNode(v, undefined, {
|
|
21
|
+
aliasDuplicateObjects: false,
|
|
22
|
+
keepUndefined: false,
|
|
23
|
+
onAnchor: () => {
|
|
24
|
+
throw new Error('This should not happen, please report a bug.');
|
|
25
|
+
},
|
|
26
|
+
schema,
|
|
27
|
+
sourceObjects: new Map()
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
// Type guard is intentionally a little wrong so as to be more useful,
|
|
31
|
+
// as it does not cover untypable empty non-string iterables (e.g. []).
|
|
32
|
+
const isEmptyPath = (path) => path == null ||
|
|
33
|
+
(typeof path === 'object' && !!path[Symbol.iterator]().next().done);
|
|
34
|
+
class Collection extends Node.NodeBase {
|
|
35
|
+
constructor(type, schema) {
|
|
36
|
+
super(type);
|
|
37
|
+
Object.defineProperty(this, 'schema', {
|
|
38
|
+
value: schema,
|
|
39
|
+
configurable: true,
|
|
40
|
+
enumerable: false,
|
|
41
|
+
writable: true
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Create a copy of this collection.
|
|
46
|
+
*
|
|
47
|
+
* @param schema - If defined, overwrites the original's schema
|
|
48
|
+
*/
|
|
49
|
+
clone(schema) {
|
|
50
|
+
const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
51
|
+
if (schema)
|
|
52
|
+
copy.schema = schema;
|
|
53
|
+
copy.items = copy.items.map(it => identity.isNode(it) || identity.isPair(it) ? it.clone(schema) : it);
|
|
54
|
+
if (this.range)
|
|
55
|
+
copy.range = this.range.slice();
|
|
56
|
+
return copy;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Adds a value to the collection. For `!!map` and `!!omap` the value must
|
|
60
|
+
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
61
|
+
* that already exists in the map.
|
|
62
|
+
*/
|
|
63
|
+
addIn(path, value) {
|
|
64
|
+
if (isEmptyPath(path))
|
|
65
|
+
this.add(value);
|
|
66
|
+
else {
|
|
67
|
+
const [key, ...rest] = path;
|
|
68
|
+
const node = this.get(key, true);
|
|
69
|
+
if (identity.isCollection(node))
|
|
70
|
+
node.addIn(rest, value);
|
|
71
|
+
else if (node === undefined && this.schema)
|
|
72
|
+
this.set(key, collectionFromPath(this.schema, rest, value));
|
|
73
|
+
else
|
|
74
|
+
throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Removes a value from the collection.
|
|
79
|
+
* @returns `true` if the item was found and removed.
|
|
80
|
+
*/
|
|
81
|
+
deleteIn(path) {
|
|
82
|
+
const [key, ...rest] = path;
|
|
83
|
+
if (rest.length === 0)
|
|
84
|
+
return this.delete(key);
|
|
85
|
+
const node = this.get(key, true);
|
|
86
|
+
if (identity.isCollection(node))
|
|
87
|
+
return node.deleteIn(rest);
|
|
88
|
+
else
|
|
89
|
+
throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
93
|
+
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
94
|
+
* `true` (collections are always returned intact).
|
|
95
|
+
*/
|
|
96
|
+
getIn(path, keepScalar) {
|
|
97
|
+
const [key, ...rest] = path;
|
|
98
|
+
const node = this.get(key, true);
|
|
99
|
+
if (rest.length === 0)
|
|
100
|
+
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
101
|
+
else
|
|
102
|
+
return identity.isCollection(node) ? node.getIn(rest, keepScalar) : undefined;
|
|
103
|
+
}
|
|
104
|
+
hasAllNullValues(allowScalar) {
|
|
105
|
+
return this.items.every(node => {
|
|
106
|
+
if (!identity.isPair(node))
|
|
107
|
+
return false;
|
|
108
|
+
const n = node.value;
|
|
109
|
+
return (n == null ||
|
|
110
|
+
(allowScalar &&
|
|
111
|
+
identity.isScalar(n) &&
|
|
112
|
+
n.value == null &&
|
|
113
|
+
!n.commentBefore &&
|
|
114
|
+
!n.comment &&
|
|
115
|
+
!n.tag));
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Checks if the collection includes a value with the key `key`.
|
|
120
|
+
*/
|
|
121
|
+
hasIn(path) {
|
|
122
|
+
const [key, ...rest] = path;
|
|
123
|
+
if (rest.length === 0)
|
|
124
|
+
return this.has(key);
|
|
125
|
+
const node = this.get(key, true);
|
|
126
|
+
return identity.isCollection(node) ? node.hasIn(rest) : false;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
130
|
+
* boolean to add/remove the item from the set.
|
|
131
|
+
*/
|
|
132
|
+
setIn(path, value) {
|
|
133
|
+
const [key, ...rest] = path;
|
|
134
|
+
if (rest.length === 0) {
|
|
135
|
+
this.set(key, value);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
const node = this.get(key, true);
|
|
139
|
+
if (identity.isCollection(node))
|
|
140
|
+
node.setIn(rest, value);
|
|
141
|
+
else if (node === undefined && this.schema)
|
|
142
|
+
this.set(key, collectionFromPath(this.schema, rest, value));
|
|
143
|
+
else
|
|
144
|
+
throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
exports.Collection = Collection;
|
|
150
|
+
exports.collectionFromPath = collectionFromPath;
|
|
151
|
+
exports.isEmptyPath = isEmptyPath;
|
package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/Collection.mjs
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { createNode } from '../doc/createNode.mjs';
|
|
2
|
+
import { isNode, isPair, isCollection, isScalar } from './identity.mjs';
|
|
3
|
+
import { NodeBase } from './Node.mjs';
|
|
4
|
+
|
|
5
|
+
function collectionFromPath(schema, path, value) {
|
|
6
|
+
let v = value;
|
|
7
|
+
for (let i = path.length - 1; i >= 0; --i) {
|
|
8
|
+
const k = path[i];
|
|
9
|
+
if (typeof k === 'number' && Number.isInteger(k) && k >= 0) {
|
|
10
|
+
const a = [];
|
|
11
|
+
a[k] = v;
|
|
12
|
+
v = a;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
v = new Map([[k, v]]);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return createNode(v, undefined, {
|
|
19
|
+
aliasDuplicateObjects: false,
|
|
20
|
+
keepUndefined: false,
|
|
21
|
+
onAnchor: () => {
|
|
22
|
+
throw new Error('This should not happen, please report a bug.');
|
|
23
|
+
},
|
|
24
|
+
schema,
|
|
25
|
+
sourceObjects: new Map()
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
// Type guard is intentionally a little wrong so as to be more useful,
|
|
29
|
+
// as it does not cover untypable empty non-string iterables (e.g. []).
|
|
30
|
+
const isEmptyPath = (path) => path == null ||
|
|
31
|
+
(typeof path === 'object' && !!path[Symbol.iterator]().next().done);
|
|
32
|
+
class Collection extends NodeBase {
|
|
33
|
+
constructor(type, schema) {
|
|
34
|
+
super(type);
|
|
35
|
+
Object.defineProperty(this, 'schema', {
|
|
36
|
+
value: schema,
|
|
37
|
+
configurable: true,
|
|
38
|
+
enumerable: false,
|
|
39
|
+
writable: true
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Create a copy of this collection.
|
|
44
|
+
*
|
|
45
|
+
* @param schema - If defined, overwrites the original's schema
|
|
46
|
+
*/
|
|
47
|
+
clone(schema) {
|
|
48
|
+
const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
49
|
+
if (schema)
|
|
50
|
+
copy.schema = schema;
|
|
51
|
+
copy.items = copy.items.map(it => isNode(it) || isPair(it) ? it.clone(schema) : it);
|
|
52
|
+
if (this.range)
|
|
53
|
+
copy.range = this.range.slice();
|
|
54
|
+
return copy;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Adds a value to the collection. For `!!map` and `!!omap` the value must
|
|
58
|
+
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
59
|
+
* that already exists in the map.
|
|
60
|
+
*/
|
|
61
|
+
addIn(path, value) {
|
|
62
|
+
if (isEmptyPath(path))
|
|
63
|
+
this.add(value);
|
|
64
|
+
else {
|
|
65
|
+
const [key, ...rest] = path;
|
|
66
|
+
const node = this.get(key, true);
|
|
67
|
+
if (isCollection(node))
|
|
68
|
+
node.addIn(rest, value);
|
|
69
|
+
else if (node === undefined && this.schema)
|
|
70
|
+
this.set(key, collectionFromPath(this.schema, rest, value));
|
|
71
|
+
else
|
|
72
|
+
throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Removes a value from the collection.
|
|
77
|
+
* @returns `true` if the item was found and removed.
|
|
78
|
+
*/
|
|
79
|
+
deleteIn(path) {
|
|
80
|
+
const [key, ...rest] = path;
|
|
81
|
+
if (rest.length === 0)
|
|
82
|
+
return this.delete(key);
|
|
83
|
+
const node = this.get(key, true);
|
|
84
|
+
if (isCollection(node))
|
|
85
|
+
return node.deleteIn(rest);
|
|
86
|
+
else
|
|
87
|
+
throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
91
|
+
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
92
|
+
* `true` (collections are always returned intact).
|
|
93
|
+
*/
|
|
94
|
+
getIn(path, keepScalar) {
|
|
95
|
+
const [key, ...rest] = path;
|
|
96
|
+
const node = this.get(key, true);
|
|
97
|
+
if (rest.length === 0)
|
|
98
|
+
return !keepScalar && isScalar(node) ? node.value : node;
|
|
99
|
+
else
|
|
100
|
+
return isCollection(node) ? node.getIn(rest, keepScalar) : undefined;
|
|
101
|
+
}
|
|
102
|
+
hasAllNullValues(allowScalar) {
|
|
103
|
+
return this.items.every(node => {
|
|
104
|
+
if (!isPair(node))
|
|
105
|
+
return false;
|
|
106
|
+
const n = node.value;
|
|
107
|
+
return (n == null ||
|
|
108
|
+
(allowScalar &&
|
|
109
|
+
isScalar(n) &&
|
|
110
|
+
n.value == null &&
|
|
111
|
+
!n.commentBefore &&
|
|
112
|
+
!n.comment &&
|
|
113
|
+
!n.tag));
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Checks if the collection includes a value with the key `key`.
|
|
118
|
+
*/
|
|
119
|
+
hasIn(path) {
|
|
120
|
+
const [key, ...rest] = path;
|
|
121
|
+
if (rest.length === 0)
|
|
122
|
+
return this.has(key);
|
|
123
|
+
const node = this.get(key, true);
|
|
124
|
+
return isCollection(node) ? node.hasIn(rest) : false;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
128
|
+
* boolean to add/remove the item from the set.
|
|
129
|
+
*/
|
|
130
|
+
setIn(path, value) {
|
|
131
|
+
const [key, ...rest] = path;
|
|
132
|
+
if (rest.length === 0) {
|
|
133
|
+
this.set(key, value);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
const node = this.get(key, true);
|
|
137
|
+
if (isCollection(node))
|
|
138
|
+
node.setIn(rest, value);
|
|
139
|
+
else if (node === undefined && this.schema)
|
|
140
|
+
this.set(key, collectionFromPath(this.schema, rest, value));
|
|
141
|
+
else
|
|
142
|
+
throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export { Collection, collectionFromPath, isEmptyPath };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var applyReviver = require('../doc/applyReviver.js');
|
|
4
|
+
var identity = require('./identity.js');
|
|
5
|
+
var toJS = require('./toJS.js');
|
|
6
|
+
|
|
7
|
+
class NodeBase {
|
|
8
|
+
constructor(type) {
|
|
9
|
+
Object.defineProperty(this, identity.NODE_TYPE, { value: type });
|
|
10
|
+
}
|
|
11
|
+
/** Create a copy of this node. */
|
|
12
|
+
clone() {
|
|
13
|
+
const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
14
|
+
if (this.range)
|
|
15
|
+
copy.range = this.range.slice();
|
|
16
|
+
return copy;
|
|
17
|
+
}
|
|
18
|
+
/** A plain JavaScript representation of this node. */
|
|
19
|
+
toJS(doc, { mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {
|
|
20
|
+
if (!identity.isDocument(doc))
|
|
21
|
+
throw new TypeError('A document argument is required');
|
|
22
|
+
const ctx = {
|
|
23
|
+
anchors: new Map(),
|
|
24
|
+
doc,
|
|
25
|
+
keep: true,
|
|
26
|
+
mapAsMap: mapAsMap === true,
|
|
27
|
+
mapKeyWarned: false,
|
|
28
|
+
maxAliasCount: typeof maxAliasCount === 'number' ? maxAliasCount : 100
|
|
29
|
+
};
|
|
30
|
+
const res = toJS.toJS(this, '', ctx);
|
|
31
|
+
if (typeof onAnchor === 'function')
|
|
32
|
+
for (const { count, res } of ctx.anchors.values())
|
|
33
|
+
onAnchor(res, count);
|
|
34
|
+
return typeof reviver === 'function'
|
|
35
|
+
? applyReviver.applyReviver(reviver, { '': res }, '', res)
|
|
36
|
+
: res;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
exports.NodeBase = NodeBase;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { applyReviver } from '../doc/applyReviver.mjs';
|
|
2
|
+
import { NODE_TYPE, isDocument } from './identity.mjs';
|
|
3
|
+
import { toJS } from './toJS.mjs';
|
|
4
|
+
|
|
5
|
+
class NodeBase {
|
|
6
|
+
constructor(type) {
|
|
7
|
+
Object.defineProperty(this, NODE_TYPE, { value: type });
|
|
8
|
+
}
|
|
9
|
+
/** Create a copy of this node. */
|
|
10
|
+
clone() {
|
|
11
|
+
const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
12
|
+
if (this.range)
|
|
13
|
+
copy.range = this.range.slice();
|
|
14
|
+
return copy;
|
|
15
|
+
}
|
|
16
|
+
/** A plain JavaScript representation of this node. */
|
|
17
|
+
toJS(doc, { mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {
|
|
18
|
+
if (!isDocument(doc))
|
|
19
|
+
throw new TypeError('A document argument is required');
|
|
20
|
+
const ctx = {
|
|
21
|
+
anchors: new Map(),
|
|
22
|
+
doc,
|
|
23
|
+
keep: true,
|
|
24
|
+
mapAsMap: mapAsMap === true,
|
|
25
|
+
mapKeyWarned: false,
|
|
26
|
+
maxAliasCount: typeof maxAliasCount === 'number' ? maxAliasCount : 100
|
|
27
|
+
};
|
|
28
|
+
const res = toJS(this, '', ctx);
|
|
29
|
+
if (typeof onAnchor === 'function')
|
|
30
|
+
for (const { count, res } of ctx.anchors.values())
|
|
31
|
+
onAnchor(res, count);
|
|
32
|
+
return typeof reviver === 'function'
|
|
33
|
+
? applyReviver(reviver, { '': res }, '', res)
|
|
34
|
+
: res;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { NodeBase };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var createNode = require('../doc/createNode.js');
|
|
4
|
+
var stringifyPair = require('../stringify/stringifyPair.js');
|
|
5
|
+
var addPairToJSMap = require('./addPairToJSMap.js');
|
|
6
|
+
var identity = require('./identity.js');
|
|
7
|
+
|
|
8
|
+
function createPair(key, value, ctx) {
|
|
9
|
+
const k = createNode.createNode(key, undefined, ctx);
|
|
10
|
+
const v = createNode.createNode(value, undefined, ctx);
|
|
11
|
+
return new Pair(k, v);
|
|
12
|
+
}
|
|
13
|
+
class Pair {
|
|
14
|
+
constructor(key, value = null) {
|
|
15
|
+
Object.defineProperty(this, identity.NODE_TYPE, { value: identity.PAIR });
|
|
16
|
+
this.key = key;
|
|
17
|
+
this.value = value;
|
|
18
|
+
}
|
|
19
|
+
clone(schema) {
|
|
20
|
+
let { key, value } = this;
|
|
21
|
+
if (identity.isNode(key))
|
|
22
|
+
key = key.clone(schema);
|
|
23
|
+
if (identity.isNode(value))
|
|
24
|
+
value = value.clone(schema);
|
|
25
|
+
return new Pair(key, value);
|
|
26
|
+
}
|
|
27
|
+
toJSON(_, ctx) {
|
|
28
|
+
const pair = ctx?.mapAsMap ? new Map() : {};
|
|
29
|
+
return addPairToJSMap.addPairToJSMap(ctx, pair, this);
|
|
30
|
+
}
|
|
31
|
+
toString(ctx, onComment, onChompKeep) {
|
|
32
|
+
return ctx?.doc
|
|
33
|
+
? stringifyPair.stringifyPair(this, ctx, onComment, onChompKeep)
|
|
34
|
+
: JSON.stringify(this);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
exports.Pair = Pair;
|
|
39
|
+
exports.createPair = createPair;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createNode } from '../doc/createNode.mjs';
|
|
2
|
+
import { stringifyPair } from '../stringify/stringifyPair.mjs';
|
|
3
|
+
import { addPairToJSMap } from './addPairToJSMap.mjs';
|
|
4
|
+
import { NODE_TYPE, PAIR, isNode } from './identity.mjs';
|
|
5
|
+
|
|
6
|
+
function createPair(key, value, ctx) {
|
|
7
|
+
const k = createNode(key, undefined, ctx);
|
|
8
|
+
const v = createNode(value, undefined, ctx);
|
|
9
|
+
return new Pair(k, v);
|
|
10
|
+
}
|
|
11
|
+
class Pair {
|
|
12
|
+
constructor(key, value = null) {
|
|
13
|
+
Object.defineProperty(this, NODE_TYPE, { value: PAIR });
|
|
14
|
+
this.key = key;
|
|
15
|
+
this.value = value;
|
|
16
|
+
}
|
|
17
|
+
clone(schema) {
|
|
18
|
+
let { key, value } = this;
|
|
19
|
+
if (isNode(key))
|
|
20
|
+
key = key.clone(schema);
|
|
21
|
+
if (isNode(value))
|
|
22
|
+
value = value.clone(schema);
|
|
23
|
+
return new Pair(key, value);
|
|
24
|
+
}
|
|
25
|
+
toJSON(_, ctx) {
|
|
26
|
+
const pair = ctx?.mapAsMap ? new Map() : {};
|
|
27
|
+
return addPairToJSMap(ctx, pair, this);
|
|
28
|
+
}
|
|
29
|
+
toString(ctx, onComment, onChompKeep) {
|
|
30
|
+
return ctx?.doc
|
|
31
|
+
? stringifyPair(this, ctx, onComment, onChompKeep)
|
|
32
|
+
: JSON.stringify(this);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { Pair, createPair };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var identity = require('./identity.js');
|
|
4
|
+
var Node = require('./Node.js');
|
|
5
|
+
var toJS = require('./toJS.js');
|
|
6
|
+
|
|
7
|
+
const isScalarValue = (value) => !value || (typeof value !== 'function' && typeof value !== 'object');
|
|
8
|
+
class Scalar extends Node.NodeBase {
|
|
9
|
+
constructor(value) {
|
|
10
|
+
super(identity.SCALAR);
|
|
11
|
+
this.value = value;
|
|
12
|
+
}
|
|
13
|
+
toJSON(arg, ctx) {
|
|
14
|
+
return ctx?.keep ? this.value : toJS.toJS(this.value, arg, ctx);
|
|
15
|
+
}
|
|
16
|
+
toString() {
|
|
17
|
+
return String(this.value);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
Scalar.BLOCK_FOLDED = 'BLOCK_FOLDED';
|
|
21
|
+
Scalar.BLOCK_LITERAL = 'BLOCK_LITERAL';
|
|
22
|
+
Scalar.PLAIN = 'PLAIN';
|
|
23
|
+
Scalar.QUOTE_DOUBLE = 'QUOTE_DOUBLE';
|
|
24
|
+
Scalar.QUOTE_SINGLE = 'QUOTE_SINGLE';
|
|
25
|
+
|
|
26
|
+
exports.Scalar = Scalar;
|
|
27
|
+
exports.isScalarValue = isScalarValue;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SCALAR } from './identity.mjs';
|
|
2
|
+
import { NodeBase } from './Node.mjs';
|
|
3
|
+
import { toJS } from './toJS.mjs';
|
|
4
|
+
|
|
5
|
+
const isScalarValue = (value) => !value || (typeof value !== 'function' && typeof value !== 'object');
|
|
6
|
+
class Scalar extends NodeBase {
|
|
7
|
+
constructor(value) {
|
|
8
|
+
super(SCALAR);
|
|
9
|
+
this.value = value;
|
|
10
|
+
}
|
|
11
|
+
toJSON(arg, ctx) {
|
|
12
|
+
return ctx?.keep ? this.value : toJS(this.value, arg, ctx);
|
|
13
|
+
}
|
|
14
|
+
toString() {
|
|
15
|
+
return String(this.value);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
Scalar.BLOCK_FOLDED = 'BLOCK_FOLDED';
|
|
19
|
+
Scalar.BLOCK_LITERAL = 'BLOCK_LITERAL';
|
|
20
|
+
Scalar.PLAIN = 'PLAIN';
|
|
21
|
+
Scalar.QUOTE_DOUBLE = 'QUOTE_DOUBLE';
|
|
22
|
+
Scalar.QUOTE_SINGLE = 'QUOTE_SINGLE';
|
|
23
|
+
|
|
24
|
+
export { Scalar, isScalarValue };
|