@windrun-huaiin/dev-scripts 14.0.0 → 14.1.1
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 +336 -0
- package/dist/commands/diaomao-update.mjs +334 -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,338 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Scalar = require('../nodes/Scalar.js');
|
|
4
|
+
var foldFlowLines = require('./foldFlowLines.js');
|
|
5
|
+
|
|
6
|
+
const getFoldOptions = (ctx, isBlock) => ({
|
|
7
|
+
indentAtStart: isBlock ? ctx.indent.length : ctx.indentAtStart,
|
|
8
|
+
lineWidth: ctx.options.lineWidth,
|
|
9
|
+
minContentWidth: ctx.options.minContentWidth
|
|
10
|
+
});
|
|
11
|
+
// Also checks for lines starting with %, as parsing the output as YAML 1.1 will
|
|
12
|
+
// presume that's starting a new document.
|
|
13
|
+
const containsDocumentMarker = (str) => /^(%|---|\.\.\.)/m.test(str);
|
|
14
|
+
function lineLengthOverLimit(str, lineWidth, indentLength) {
|
|
15
|
+
if (!lineWidth || lineWidth < 0)
|
|
16
|
+
return false;
|
|
17
|
+
const limit = lineWidth - indentLength;
|
|
18
|
+
const strLen = str.length;
|
|
19
|
+
if (strLen <= limit)
|
|
20
|
+
return false;
|
|
21
|
+
for (let i = 0, start = 0; i < strLen; ++i) {
|
|
22
|
+
if (str[i] === '\n') {
|
|
23
|
+
if (i - start > limit)
|
|
24
|
+
return true;
|
|
25
|
+
start = i + 1;
|
|
26
|
+
if (strLen - start <= limit)
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
function doubleQuotedString(value, ctx) {
|
|
33
|
+
const json = JSON.stringify(value);
|
|
34
|
+
if (ctx.options.doubleQuotedAsJSON)
|
|
35
|
+
return json;
|
|
36
|
+
const { implicitKey } = ctx;
|
|
37
|
+
const minMultiLineLength = ctx.options.doubleQuotedMinMultiLineLength;
|
|
38
|
+
const indent = ctx.indent || (containsDocumentMarker(value) ? ' ' : '');
|
|
39
|
+
let str = '';
|
|
40
|
+
let start = 0;
|
|
41
|
+
for (let i = 0, ch = json[i]; ch; ch = json[++i]) {
|
|
42
|
+
if (ch === ' ' && json[i + 1] === '\\' && json[i + 2] === 'n') {
|
|
43
|
+
// space before newline needs to be escaped to not be folded
|
|
44
|
+
str += json.slice(start, i) + '\\ ';
|
|
45
|
+
i += 1;
|
|
46
|
+
start = i;
|
|
47
|
+
ch = '\\';
|
|
48
|
+
}
|
|
49
|
+
if (ch === '\\')
|
|
50
|
+
switch (json[i + 1]) {
|
|
51
|
+
case 'u':
|
|
52
|
+
{
|
|
53
|
+
str += json.slice(start, i);
|
|
54
|
+
const code = json.substr(i + 2, 4);
|
|
55
|
+
switch (code) {
|
|
56
|
+
case '0000':
|
|
57
|
+
str += '\\0';
|
|
58
|
+
break;
|
|
59
|
+
case '0007':
|
|
60
|
+
str += '\\a';
|
|
61
|
+
break;
|
|
62
|
+
case '000b':
|
|
63
|
+
str += '\\v';
|
|
64
|
+
break;
|
|
65
|
+
case '001b':
|
|
66
|
+
str += '\\e';
|
|
67
|
+
break;
|
|
68
|
+
case '0085':
|
|
69
|
+
str += '\\N';
|
|
70
|
+
break;
|
|
71
|
+
case '00a0':
|
|
72
|
+
str += '\\_';
|
|
73
|
+
break;
|
|
74
|
+
case '2028':
|
|
75
|
+
str += '\\L';
|
|
76
|
+
break;
|
|
77
|
+
case '2029':
|
|
78
|
+
str += '\\P';
|
|
79
|
+
break;
|
|
80
|
+
default:
|
|
81
|
+
if (code.substr(0, 2) === '00')
|
|
82
|
+
str += '\\x' + code.substr(2);
|
|
83
|
+
else
|
|
84
|
+
str += json.substr(i, 6);
|
|
85
|
+
}
|
|
86
|
+
i += 5;
|
|
87
|
+
start = i + 1;
|
|
88
|
+
}
|
|
89
|
+
break;
|
|
90
|
+
case 'n':
|
|
91
|
+
if (implicitKey ||
|
|
92
|
+
json[i + 2] === '"' ||
|
|
93
|
+
json.length < minMultiLineLength) {
|
|
94
|
+
i += 1;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
// folding will eat first newline
|
|
98
|
+
str += json.slice(start, i) + '\n\n';
|
|
99
|
+
while (json[i + 2] === '\\' &&
|
|
100
|
+
json[i + 3] === 'n' &&
|
|
101
|
+
json[i + 4] !== '"') {
|
|
102
|
+
str += '\n';
|
|
103
|
+
i += 2;
|
|
104
|
+
}
|
|
105
|
+
str += indent;
|
|
106
|
+
// space after newline needs to be escaped to not be folded
|
|
107
|
+
if (json[i + 2] === ' ')
|
|
108
|
+
str += '\\';
|
|
109
|
+
i += 1;
|
|
110
|
+
start = i + 1;
|
|
111
|
+
}
|
|
112
|
+
break;
|
|
113
|
+
default:
|
|
114
|
+
i += 1;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
str = start ? str + json.slice(start) : json;
|
|
118
|
+
return implicitKey
|
|
119
|
+
? str
|
|
120
|
+
: foldFlowLines.foldFlowLines(str, indent, foldFlowLines.FOLD_QUOTED, getFoldOptions(ctx, false));
|
|
121
|
+
}
|
|
122
|
+
function singleQuotedString(value, ctx) {
|
|
123
|
+
if (ctx.options.singleQuote === false ||
|
|
124
|
+
(ctx.implicitKey && value.includes('\n')) ||
|
|
125
|
+
/[ \t]\n|\n[ \t]/.test(value) // single quoted string can't have leading or trailing whitespace around newline
|
|
126
|
+
)
|
|
127
|
+
return doubleQuotedString(value, ctx);
|
|
128
|
+
const indent = ctx.indent || (containsDocumentMarker(value) ? ' ' : '');
|
|
129
|
+
const res = "'" + value.replace(/'/g, "''").replace(/\n+/g, `$&\n${indent}`) + "'";
|
|
130
|
+
return ctx.implicitKey
|
|
131
|
+
? res
|
|
132
|
+
: foldFlowLines.foldFlowLines(res, indent, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx, false));
|
|
133
|
+
}
|
|
134
|
+
function quotedString(value, ctx) {
|
|
135
|
+
const { singleQuote } = ctx.options;
|
|
136
|
+
let qs;
|
|
137
|
+
if (singleQuote === false)
|
|
138
|
+
qs = doubleQuotedString;
|
|
139
|
+
else {
|
|
140
|
+
const hasDouble = value.includes('"');
|
|
141
|
+
const hasSingle = value.includes("'");
|
|
142
|
+
if (hasDouble && !hasSingle)
|
|
143
|
+
qs = singleQuotedString;
|
|
144
|
+
else if (hasSingle && !hasDouble)
|
|
145
|
+
qs = doubleQuotedString;
|
|
146
|
+
else
|
|
147
|
+
qs = singleQuote ? singleQuotedString : doubleQuotedString;
|
|
148
|
+
}
|
|
149
|
+
return qs(value, ctx);
|
|
150
|
+
}
|
|
151
|
+
// The negative lookbehind avoids a polynomial search,
|
|
152
|
+
// but isn't supported yet on Safari: https://caniuse.com/js-regexp-lookbehind
|
|
153
|
+
let blockEndNewlines;
|
|
154
|
+
try {
|
|
155
|
+
blockEndNewlines = new RegExp('(^|(?<!\n))\n+(?!\n|$)', 'g');
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
blockEndNewlines = /\n+(?!\n|$)/g;
|
|
159
|
+
}
|
|
160
|
+
function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
|
|
161
|
+
const { blockQuote, commentString, lineWidth } = ctx.options;
|
|
162
|
+
// 1. Block can't end in whitespace unless the last line is non-empty.
|
|
163
|
+
// 2. Strings consisting of only whitespace are best rendered explicitly.
|
|
164
|
+
if (!blockQuote || /\n[\t ]+$/.test(value)) {
|
|
165
|
+
return quotedString(value, ctx);
|
|
166
|
+
}
|
|
167
|
+
const indent = ctx.indent ||
|
|
168
|
+
(ctx.forceBlockIndent || containsDocumentMarker(value) ? ' ' : '');
|
|
169
|
+
const literal = blockQuote === 'literal'
|
|
170
|
+
? true
|
|
171
|
+
: blockQuote === 'folded' || type === Scalar.Scalar.BLOCK_FOLDED
|
|
172
|
+
? false
|
|
173
|
+
: type === Scalar.Scalar.BLOCK_LITERAL
|
|
174
|
+
? true
|
|
175
|
+
: !lineLengthOverLimit(value, lineWidth, indent.length);
|
|
176
|
+
if (!value)
|
|
177
|
+
return literal ? '|\n' : '>\n';
|
|
178
|
+
// determine chomping from whitespace at value end
|
|
179
|
+
let chomp;
|
|
180
|
+
let endStart;
|
|
181
|
+
for (endStart = value.length; endStart > 0; --endStart) {
|
|
182
|
+
const ch = value[endStart - 1];
|
|
183
|
+
if (ch !== '\n' && ch !== '\t' && ch !== ' ')
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
let end = value.substring(endStart);
|
|
187
|
+
const endNlPos = end.indexOf('\n');
|
|
188
|
+
if (endNlPos === -1) {
|
|
189
|
+
chomp = '-'; // strip
|
|
190
|
+
}
|
|
191
|
+
else if (value === end || endNlPos !== end.length - 1) {
|
|
192
|
+
chomp = '+'; // keep
|
|
193
|
+
if (onChompKeep)
|
|
194
|
+
onChompKeep();
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
chomp = ''; // clip
|
|
198
|
+
}
|
|
199
|
+
if (end) {
|
|
200
|
+
value = value.slice(0, -end.length);
|
|
201
|
+
if (end[end.length - 1] === '\n')
|
|
202
|
+
end = end.slice(0, -1);
|
|
203
|
+
end = end.replace(blockEndNewlines, `$&${indent}`);
|
|
204
|
+
}
|
|
205
|
+
// determine indent indicator from whitespace at value start
|
|
206
|
+
let startWithSpace = false;
|
|
207
|
+
let startEnd;
|
|
208
|
+
let startNlPos = -1;
|
|
209
|
+
for (startEnd = 0; startEnd < value.length; ++startEnd) {
|
|
210
|
+
const ch = value[startEnd];
|
|
211
|
+
if (ch === ' ')
|
|
212
|
+
startWithSpace = true;
|
|
213
|
+
else if (ch === '\n')
|
|
214
|
+
startNlPos = startEnd;
|
|
215
|
+
else
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
let start = value.substring(0, startNlPos < startEnd ? startNlPos + 1 : startEnd);
|
|
219
|
+
if (start) {
|
|
220
|
+
value = value.substring(start.length);
|
|
221
|
+
start = start.replace(/\n+/g, `$&${indent}`);
|
|
222
|
+
}
|
|
223
|
+
const indentSize = indent ? '2' : '1'; // root is at -1
|
|
224
|
+
// Leading | or > is added later
|
|
225
|
+
let header = (startWithSpace ? indentSize : '') + chomp;
|
|
226
|
+
if (comment) {
|
|
227
|
+
header += ' ' + commentString(comment.replace(/ ?[\r\n]+/g, ' '));
|
|
228
|
+
if (onComment)
|
|
229
|
+
onComment();
|
|
230
|
+
}
|
|
231
|
+
if (!literal) {
|
|
232
|
+
const foldedValue = value
|
|
233
|
+
.replace(/\n+/g, '\n$&')
|
|
234
|
+
.replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
|
|
235
|
+
// ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
|
|
236
|
+
.replace(/\n+/g, `$&${indent}`);
|
|
237
|
+
let literalFallback = false;
|
|
238
|
+
const foldOptions = getFoldOptions(ctx, true);
|
|
239
|
+
if (blockQuote !== 'folded' && type !== Scalar.Scalar.BLOCK_FOLDED) {
|
|
240
|
+
foldOptions.onOverflow = () => {
|
|
241
|
+
literalFallback = true;
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
const body = foldFlowLines.foldFlowLines(`${start}${foldedValue}${end}`, indent, foldFlowLines.FOLD_BLOCK, foldOptions);
|
|
245
|
+
if (!literalFallback)
|
|
246
|
+
return `>${header}\n${indent}${body}`;
|
|
247
|
+
}
|
|
248
|
+
value = value.replace(/\n+/g, `$&${indent}`);
|
|
249
|
+
return `|${header}\n${indent}${start}${value}${end}`;
|
|
250
|
+
}
|
|
251
|
+
function plainString(item, ctx, onComment, onChompKeep) {
|
|
252
|
+
const { type, value } = item;
|
|
253
|
+
const { actualString, implicitKey, indent, indentStep, inFlow } = ctx;
|
|
254
|
+
if ((implicitKey && value.includes('\n')) ||
|
|
255
|
+
(inFlow && /[[\]{},]/.test(value))) {
|
|
256
|
+
return quotedString(value, ctx);
|
|
257
|
+
}
|
|
258
|
+
if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
|
|
259
|
+
// not allowed:
|
|
260
|
+
// - '-' or '?'
|
|
261
|
+
// - start with an indicator character (except [?:-]) or /[?-] /
|
|
262
|
+
// - '\n ', ': ' or ' \n' anywhere
|
|
263
|
+
// - '#' not preceded by a non-space char
|
|
264
|
+
// - end with ' ' or ':'
|
|
265
|
+
return implicitKey || inFlow || !value.includes('\n')
|
|
266
|
+
? quotedString(value, ctx)
|
|
267
|
+
: blockString(item, ctx, onComment, onChompKeep);
|
|
268
|
+
}
|
|
269
|
+
if (!implicitKey &&
|
|
270
|
+
!inFlow &&
|
|
271
|
+
type !== Scalar.Scalar.PLAIN &&
|
|
272
|
+
value.includes('\n')) {
|
|
273
|
+
// Where allowed & type not set explicitly, prefer block style for multiline strings
|
|
274
|
+
return blockString(item, ctx, onComment, onChompKeep);
|
|
275
|
+
}
|
|
276
|
+
if (containsDocumentMarker(value)) {
|
|
277
|
+
if (indent === '') {
|
|
278
|
+
ctx.forceBlockIndent = true;
|
|
279
|
+
return blockString(item, ctx, onComment, onChompKeep);
|
|
280
|
+
}
|
|
281
|
+
else if (implicitKey && indent === indentStep) {
|
|
282
|
+
return quotedString(value, ctx);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
const str = value.replace(/\n+/g, `$&\n${indent}`);
|
|
286
|
+
// Verify that output will be parsed as a string, as e.g. plain numbers and
|
|
287
|
+
// booleans get parsed with those types in v1.2 (e.g. '42', 'true' & '0.9e-3'),
|
|
288
|
+
// and others in v1.1.
|
|
289
|
+
if (actualString) {
|
|
290
|
+
const test = (tag) => tag.default && tag.tag !== 'tag:yaml.org,2002:str' && tag.test?.test(str);
|
|
291
|
+
const { compat, tags } = ctx.doc.schema;
|
|
292
|
+
if (tags.some(test) || compat?.some(test))
|
|
293
|
+
return quotedString(value, ctx);
|
|
294
|
+
}
|
|
295
|
+
return implicitKey
|
|
296
|
+
? str
|
|
297
|
+
: foldFlowLines.foldFlowLines(str, indent, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx, false));
|
|
298
|
+
}
|
|
299
|
+
function stringifyString(item, ctx, onComment, onChompKeep) {
|
|
300
|
+
const { implicitKey, inFlow } = ctx;
|
|
301
|
+
const ss = typeof item.value === 'string'
|
|
302
|
+
? item
|
|
303
|
+
: Object.assign({}, item, { value: String(item.value) });
|
|
304
|
+
let { type } = item;
|
|
305
|
+
if (type !== Scalar.Scalar.QUOTE_DOUBLE) {
|
|
306
|
+
// force double quotes on control characters & unpaired surrogates
|
|
307
|
+
if (/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(ss.value))
|
|
308
|
+
type = Scalar.Scalar.QUOTE_DOUBLE;
|
|
309
|
+
}
|
|
310
|
+
const _stringify = (_type) => {
|
|
311
|
+
switch (_type) {
|
|
312
|
+
case Scalar.Scalar.BLOCK_FOLDED:
|
|
313
|
+
case Scalar.Scalar.BLOCK_LITERAL:
|
|
314
|
+
return implicitKey || inFlow
|
|
315
|
+
? quotedString(ss.value, ctx) // blocks are not valid inside flow containers
|
|
316
|
+
: blockString(ss, ctx, onComment, onChompKeep);
|
|
317
|
+
case Scalar.Scalar.QUOTE_DOUBLE:
|
|
318
|
+
return doubleQuotedString(ss.value, ctx);
|
|
319
|
+
case Scalar.Scalar.QUOTE_SINGLE:
|
|
320
|
+
return singleQuotedString(ss.value, ctx);
|
|
321
|
+
case Scalar.Scalar.PLAIN:
|
|
322
|
+
return plainString(ss, ctx, onComment, onChompKeep);
|
|
323
|
+
default:
|
|
324
|
+
return null;
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
let res = _stringify(type);
|
|
328
|
+
if (res === null) {
|
|
329
|
+
const { defaultKeyType, defaultStringType } = ctx.options;
|
|
330
|
+
const t = (implicitKey && defaultKeyType) || defaultStringType;
|
|
331
|
+
res = _stringify(t);
|
|
332
|
+
if (res === null)
|
|
333
|
+
throw new Error(`Unsupported default string type ${t}`);
|
|
334
|
+
}
|
|
335
|
+
return res;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
exports.stringifyString = stringifyString;
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import { Scalar } from '../nodes/Scalar.mjs';
|
|
2
|
+
import { foldFlowLines, FOLD_FLOW, FOLD_QUOTED, FOLD_BLOCK } from './foldFlowLines.mjs';
|
|
3
|
+
|
|
4
|
+
const getFoldOptions = (ctx, isBlock) => ({
|
|
5
|
+
indentAtStart: isBlock ? ctx.indent.length : ctx.indentAtStart,
|
|
6
|
+
lineWidth: ctx.options.lineWidth,
|
|
7
|
+
minContentWidth: ctx.options.minContentWidth
|
|
8
|
+
});
|
|
9
|
+
// Also checks for lines starting with %, as parsing the output as YAML 1.1 will
|
|
10
|
+
// presume that's starting a new document.
|
|
11
|
+
const containsDocumentMarker = (str) => /^(%|---|\.\.\.)/m.test(str);
|
|
12
|
+
function lineLengthOverLimit(str, lineWidth, indentLength) {
|
|
13
|
+
if (!lineWidth || lineWidth < 0)
|
|
14
|
+
return false;
|
|
15
|
+
const limit = lineWidth - indentLength;
|
|
16
|
+
const strLen = str.length;
|
|
17
|
+
if (strLen <= limit)
|
|
18
|
+
return false;
|
|
19
|
+
for (let i = 0, start = 0; i < strLen; ++i) {
|
|
20
|
+
if (str[i] === '\n') {
|
|
21
|
+
if (i - start > limit)
|
|
22
|
+
return true;
|
|
23
|
+
start = i + 1;
|
|
24
|
+
if (strLen - start <= limit)
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
function doubleQuotedString(value, ctx) {
|
|
31
|
+
const json = JSON.stringify(value);
|
|
32
|
+
if (ctx.options.doubleQuotedAsJSON)
|
|
33
|
+
return json;
|
|
34
|
+
const { implicitKey } = ctx;
|
|
35
|
+
const minMultiLineLength = ctx.options.doubleQuotedMinMultiLineLength;
|
|
36
|
+
const indent = ctx.indent || (containsDocumentMarker(value) ? ' ' : '');
|
|
37
|
+
let str = '';
|
|
38
|
+
let start = 0;
|
|
39
|
+
for (let i = 0, ch = json[i]; ch; ch = json[++i]) {
|
|
40
|
+
if (ch === ' ' && json[i + 1] === '\\' && json[i + 2] === 'n') {
|
|
41
|
+
// space before newline needs to be escaped to not be folded
|
|
42
|
+
str += json.slice(start, i) + '\\ ';
|
|
43
|
+
i += 1;
|
|
44
|
+
start = i;
|
|
45
|
+
ch = '\\';
|
|
46
|
+
}
|
|
47
|
+
if (ch === '\\')
|
|
48
|
+
switch (json[i + 1]) {
|
|
49
|
+
case 'u':
|
|
50
|
+
{
|
|
51
|
+
str += json.slice(start, i);
|
|
52
|
+
const code = json.substr(i + 2, 4);
|
|
53
|
+
switch (code) {
|
|
54
|
+
case '0000':
|
|
55
|
+
str += '\\0';
|
|
56
|
+
break;
|
|
57
|
+
case '0007':
|
|
58
|
+
str += '\\a';
|
|
59
|
+
break;
|
|
60
|
+
case '000b':
|
|
61
|
+
str += '\\v';
|
|
62
|
+
break;
|
|
63
|
+
case '001b':
|
|
64
|
+
str += '\\e';
|
|
65
|
+
break;
|
|
66
|
+
case '0085':
|
|
67
|
+
str += '\\N';
|
|
68
|
+
break;
|
|
69
|
+
case '00a0':
|
|
70
|
+
str += '\\_';
|
|
71
|
+
break;
|
|
72
|
+
case '2028':
|
|
73
|
+
str += '\\L';
|
|
74
|
+
break;
|
|
75
|
+
case '2029':
|
|
76
|
+
str += '\\P';
|
|
77
|
+
break;
|
|
78
|
+
default:
|
|
79
|
+
if (code.substr(0, 2) === '00')
|
|
80
|
+
str += '\\x' + code.substr(2);
|
|
81
|
+
else
|
|
82
|
+
str += json.substr(i, 6);
|
|
83
|
+
}
|
|
84
|
+
i += 5;
|
|
85
|
+
start = i + 1;
|
|
86
|
+
}
|
|
87
|
+
break;
|
|
88
|
+
case 'n':
|
|
89
|
+
if (implicitKey ||
|
|
90
|
+
json[i + 2] === '"' ||
|
|
91
|
+
json.length < minMultiLineLength) {
|
|
92
|
+
i += 1;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
// folding will eat first newline
|
|
96
|
+
str += json.slice(start, i) + '\n\n';
|
|
97
|
+
while (json[i + 2] === '\\' &&
|
|
98
|
+
json[i + 3] === 'n' &&
|
|
99
|
+
json[i + 4] !== '"') {
|
|
100
|
+
str += '\n';
|
|
101
|
+
i += 2;
|
|
102
|
+
}
|
|
103
|
+
str += indent;
|
|
104
|
+
// space after newline needs to be escaped to not be folded
|
|
105
|
+
if (json[i + 2] === ' ')
|
|
106
|
+
str += '\\';
|
|
107
|
+
i += 1;
|
|
108
|
+
start = i + 1;
|
|
109
|
+
}
|
|
110
|
+
break;
|
|
111
|
+
default:
|
|
112
|
+
i += 1;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
str = start ? str + json.slice(start) : json;
|
|
116
|
+
return implicitKey
|
|
117
|
+
? str
|
|
118
|
+
: foldFlowLines(str, indent, FOLD_QUOTED, getFoldOptions(ctx, false));
|
|
119
|
+
}
|
|
120
|
+
function singleQuotedString(value, ctx) {
|
|
121
|
+
if (ctx.options.singleQuote === false ||
|
|
122
|
+
(ctx.implicitKey && value.includes('\n')) ||
|
|
123
|
+
/[ \t]\n|\n[ \t]/.test(value) // single quoted string can't have leading or trailing whitespace around newline
|
|
124
|
+
)
|
|
125
|
+
return doubleQuotedString(value, ctx);
|
|
126
|
+
const indent = ctx.indent || (containsDocumentMarker(value) ? ' ' : '');
|
|
127
|
+
const res = "'" + value.replace(/'/g, "''").replace(/\n+/g, `$&\n${indent}`) + "'";
|
|
128
|
+
return ctx.implicitKey
|
|
129
|
+
? res
|
|
130
|
+
: foldFlowLines(res, indent, FOLD_FLOW, getFoldOptions(ctx, false));
|
|
131
|
+
}
|
|
132
|
+
function quotedString(value, ctx) {
|
|
133
|
+
const { singleQuote } = ctx.options;
|
|
134
|
+
let qs;
|
|
135
|
+
if (singleQuote === false)
|
|
136
|
+
qs = doubleQuotedString;
|
|
137
|
+
else {
|
|
138
|
+
const hasDouble = value.includes('"');
|
|
139
|
+
const hasSingle = value.includes("'");
|
|
140
|
+
if (hasDouble && !hasSingle)
|
|
141
|
+
qs = singleQuotedString;
|
|
142
|
+
else if (hasSingle && !hasDouble)
|
|
143
|
+
qs = doubleQuotedString;
|
|
144
|
+
else
|
|
145
|
+
qs = singleQuote ? singleQuotedString : doubleQuotedString;
|
|
146
|
+
}
|
|
147
|
+
return qs(value, ctx);
|
|
148
|
+
}
|
|
149
|
+
// The negative lookbehind avoids a polynomial search,
|
|
150
|
+
// but isn't supported yet on Safari: https://caniuse.com/js-regexp-lookbehind
|
|
151
|
+
let blockEndNewlines;
|
|
152
|
+
try {
|
|
153
|
+
blockEndNewlines = new RegExp('(^|(?<!\n))\n+(?!\n|$)', 'g');
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
blockEndNewlines = /\n+(?!\n|$)/g;
|
|
157
|
+
}
|
|
158
|
+
function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
|
|
159
|
+
const { blockQuote, commentString, lineWidth } = ctx.options;
|
|
160
|
+
// 1. Block can't end in whitespace unless the last line is non-empty.
|
|
161
|
+
// 2. Strings consisting of only whitespace are best rendered explicitly.
|
|
162
|
+
if (!blockQuote || /\n[\t ]+$/.test(value)) {
|
|
163
|
+
return quotedString(value, ctx);
|
|
164
|
+
}
|
|
165
|
+
const indent = ctx.indent ||
|
|
166
|
+
(ctx.forceBlockIndent || containsDocumentMarker(value) ? ' ' : '');
|
|
167
|
+
const literal = blockQuote === 'literal'
|
|
168
|
+
? true
|
|
169
|
+
: blockQuote === 'folded' || type === Scalar.BLOCK_FOLDED
|
|
170
|
+
? false
|
|
171
|
+
: type === Scalar.BLOCK_LITERAL
|
|
172
|
+
? true
|
|
173
|
+
: !lineLengthOverLimit(value, lineWidth, indent.length);
|
|
174
|
+
if (!value)
|
|
175
|
+
return literal ? '|\n' : '>\n';
|
|
176
|
+
// determine chomping from whitespace at value end
|
|
177
|
+
let chomp;
|
|
178
|
+
let endStart;
|
|
179
|
+
for (endStart = value.length; endStart > 0; --endStart) {
|
|
180
|
+
const ch = value[endStart - 1];
|
|
181
|
+
if (ch !== '\n' && ch !== '\t' && ch !== ' ')
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
let end = value.substring(endStart);
|
|
185
|
+
const endNlPos = end.indexOf('\n');
|
|
186
|
+
if (endNlPos === -1) {
|
|
187
|
+
chomp = '-'; // strip
|
|
188
|
+
}
|
|
189
|
+
else if (value === end || endNlPos !== end.length - 1) {
|
|
190
|
+
chomp = '+'; // keep
|
|
191
|
+
if (onChompKeep)
|
|
192
|
+
onChompKeep();
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
chomp = ''; // clip
|
|
196
|
+
}
|
|
197
|
+
if (end) {
|
|
198
|
+
value = value.slice(0, -end.length);
|
|
199
|
+
if (end[end.length - 1] === '\n')
|
|
200
|
+
end = end.slice(0, -1);
|
|
201
|
+
end = end.replace(blockEndNewlines, `$&${indent}`);
|
|
202
|
+
}
|
|
203
|
+
// determine indent indicator from whitespace at value start
|
|
204
|
+
let startWithSpace = false;
|
|
205
|
+
let startEnd;
|
|
206
|
+
let startNlPos = -1;
|
|
207
|
+
for (startEnd = 0; startEnd < value.length; ++startEnd) {
|
|
208
|
+
const ch = value[startEnd];
|
|
209
|
+
if (ch === ' ')
|
|
210
|
+
startWithSpace = true;
|
|
211
|
+
else if (ch === '\n')
|
|
212
|
+
startNlPos = startEnd;
|
|
213
|
+
else
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
let start = value.substring(0, startNlPos < startEnd ? startNlPos + 1 : startEnd);
|
|
217
|
+
if (start) {
|
|
218
|
+
value = value.substring(start.length);
|
|
219
|
+
start = start.replace(/\n+/g, `$&${indent}`);
|
|
220
|
+
}
|
|
221
|
+
const indentSize = indent ? '2' : '1'; // root is at -1
|
|
222
|
+
// Leading | or > is added later
|
|
223
|
+
let header = (startWithSpace ? indentSize : '') + chomp;
|
|
224
|
+
if (comment) {
|
|
225
|
+
header += ' ' + commentString(comment.replace(/ ?[\r\n]+/g, ' '));
|
|
226
|
+
if (onComment)
|
|
227
|
+
onComment();
|
|
228
|
+
}
|
|
229
|
+
if (!literal) {
|
|
230
|
+
const foldedValue = value
|
|
231
|
+
.replace(/\n+/g, '\n$&')
|
|
232
|
+
.replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
|
|
233
|
+
// ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
|
|
234
|
+
.replace(/\n+/g, `$&${indent}`);
|
|
235
|
+
let literalFallback = false;
|
|
236
|
+
const foldOptions = getFoldOptions(ctx, true);
|
|
237
|
+
if (blockQuote !== 'folded' && type !== Scalar.BLOCK_FOLDED) {
|
|
238
|
+
foldOptions.onOverflow = () => {
|
|
239
|
+
literalFallback = true;
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
const body = foldFlowLines(`${start}${foldedValue}${end}`, indent, FOLD_BLOCK, foldOptions);
|
|
243
|
+
if (!literalFallback)
|
|
244
|
+
return `>${header}\n${indent}${body}`;
|
|
245
|
+
}
|
|
246
|
+
value = value.replace(/\n+/g, `$&${indent}`);
|
|
247
|
+
return `|${header}\n${indent}${start}${value}${end}`;
|
|
248
|
+
}
|
|
249
|
+
function plainString(item, ctx, onComment, onChompKeep) {
|
|
250
|
+
const { type, value } = item;
|
|
251
|
+
const { actualString, implicitKey, indent, indentStep, inFlow } = ctx;
|
|
252
|
+
if ((implicitKey && value.includes('\n')) ||
|
|
253
|
+
(inFlow && /[[\]{},]/.test(value))) {
|
|
254
|
+
return quotedString(value, ctx);
|
|
255
|
+
}
|
|
256
|
+
if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
|
|
257
|
+
// not allowed:
|
|
258
|
+
// - '-' or '?'
|
|
259
|
+
// - start with an indicator character (except [?:-]) or /[?-] /
|
|
260
|
+
// - '\n ', ': ' or ' \n' anywhere
|
|
261
|
+
// - '#' not preceded by a non-space char
|
|
262
|
+
// - end with ' ' or ':'
|
|
263
|
+
return implicitKey || inFlow || !value.includes('\n')
|
|
264
|
+
? quotedString(value, ctx)
|
|
265
|
+
: blockString(item, ctx, onComment, onChompKeep);
|
|
266
|
+
}
|
|
267
|
+
if (!implicitKey &&
|
|
268
|
+
!inFlow &&
|
|
269
|
+
type !== Scalar.PLAIN &&
|
|
270
|
+
value.includes('\n')) {
|
|
271
|
+
// Where allowed & type not set explicitly, prefer block style for multiline strings
|
|
272
|
+
return blockString(item, ctx, onComment, onChompKeep);
|
|
273
|
+
}
|
|
274
|
+
if (containsDocumentMarker(value)) {
|
|
275
|
+
if (indent === '') {
|
|
276
|
+
ctx.forceBlockIndent = true;
|
|
277
|
+
return blockString(item, ctx, onComment, onChompKeep);
|
|
278
|
+
}
|
|
279
|
+
else if (implicitKey && indent === indentStep) {
|
|
280
|
+
return quotedString(value, ctx);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
const str = value.replace(/\n+/g, `$&\n${indent}`);
|
|
284
|
+
// Verify that output will be parsed as a string, as e.g. plain numbers and
|
|
285
|
+
// booleans get parsed with those types in v1.2 (e.g. '42', 'true' & '0.9e-3'),
|
|
286
|
+
// and others in v1.1.
|
|
287
|
+
if (actualString) {
|
|
288
|
+
const test = (tag) => tag.default && tag.tag !== 'tag:yaml.org,2002:str' && tag.test?.test(str);
|
|
289
|
+
const { compat, tags } = ctx.doc.schema;
|
|
290
|
+
if (tags.some(test) || compat?.some(test))
|
|
291
|
+
return quotedString(value, ctx);
|
|
292
|
+
}
|
|
293
|
+
return implicitKey
|
|
294
|
+
? str
|
|
295
|
+
: foldFlowLines(str, indent, FOLD_FLOW, getFoldOptions(ctx, false));
|
|
296
|
+
}
|
|
297
|
+
function stringifyString(item, ctx, onComment, onChompKeep) {
|
|
298
|
+
const { implicitKey, inFlow } = ctx;
|
|
299
|
+
const ss = typeof item.value === 'string'
|
|
300
|
+
? item
|
|
301
|
+
: Object.assign({}, item, { value: String(item.value) });
|
|
302
|
+
let { type } = item;
|
|
303
|
+
if (type !== Scalar.QUOTE_DOUBLE) {
|
|
304
|
+
// force double quotes on control characters & unpaired surrogates
|
|
305
|
+
if (/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(ss.value))
|
|
306
|
+
type = Scalar.QUOTE_DOUBLE;
|
|
307
|
+
}
|
|
308
|
+
const _stringify = (_type) => {
|
|
309
|
+
switch (_type) {
|
|
310
|
+
case Scalar.BLOCK_FOLDED:
|
|
311
|
+
case Scalar.BLOCK_LITERAL:
|
|
312
|
+
return implicitKey || inFlow
|
|
313
|
+
? quotedString(ss.value, ctx) // blocks are not valid inside flow containers
|
|
314
|
+
: blockString(ss, ctx, onComment, onChompKeep);
|
|
315
|
+
case Scalar.QUOTE_DOUBLE:
|
|
316
|
+
return doubleQuotedString(ss.value, ctx);
|
|
317
|
+
case Scalar.QUOTE_SINGLE:
|
|
318
|
+
return singleQuotedString(ss.value, ctx);
|
|
319
|
+
case Scalar.PLAIN:
|
|
320
|
+
return plainString(ss, ctx, onComment, onChompKeep);
|
|
321
|
+
default:
|
|
322
|
+
return null;
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
let res = _stringify(type);
|
|
326
|
+
if (res === null) {
|
|
327
|
+
const { defaultKeyType, defaultStringType } = ctx.options;
|
|
328
|
+
const t = (implicitKey && defaultKeyType) || defaultStringType;
|
|
329
|
+
res = _stringify(t);
|
|
330
|
+
if (res === null)
|
|
331
|
+
throw new Error(`Unsupported default string type ${t}`);
|
|
332
|
+
}
|
|
333
|
+
return res;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export { stringifyString };
|