@emulsify/cli 2.0.0 → 2.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/README.md +131 -12
- package/dist/handlers/componentInstall.js +65 -4
- package/dist/index.js +2 -0
- package/dist/node_modules/.package-lock.json +6 -216
- package/dist/node_modules/@types/node/README.md +1 -1
- package/dist/node_modules/@types/node/http2.d.ts +1 -0
- package/dist/node_modules/@types/node/package.json +2 -2
- package/dist/package-lock.json +61 -42
- package/dist/package.json +5 -6
- package/dist/schemas/emulsifyProjectConfig.json +80 -0
- package/dist/util/fs/executeScript.js +10 -4
- package/dist/util/fs/loadJsonFile.js +14 -4
- package/dist/util/fs/safeResolveWithin.js +22 -0
- package/dist/util/getRepositoryLatestTag.js +96 -13
- package/dist/util/project/buildComponentDependencyList.js +35 -10
- package/dist/util/project/generateComponent.js +52 -23
- package/dist/util/project/getEmulsifyConfig.js +35 -1
- package/dist/util/project/installComponentFromCache.js +3 -2
- package/dist/util/project/installGeneralAssetsFromCache.js +4 -2
- package/dist/util/system/getAvailableSystems.js +0 -5
- package/package.json +5 -6
- package/dist/node_modules/@babel/code-frame/LICENSE +0 -22
- package/dist/node_modules/@babel/code-frame/README.md +0 -19
- package/dist/node_modules/@babel/code-frame/lib/index.js +0 -217
- package/dist/node_modules/@babel/code-frame/lib/index.js.map +0 -1
- package/dist/node_modules/@babel/code-frame/package.json +0 -32
- package/dist/node_modules/@babel/helper-validator-identifier/LICENSE +0 -22
- package/dist/node_modules/@babel/helper-validator-identifier/README.md +0 -19
- package/dist/node_modules/@babel/helper-validator-identifier/lib/identifier.js +0 -70
- package/dist/node_modules/@babel/helper-validator-identifier/lib/identifier.js.map +0 -1
- package/dist/node_modules/@babel/helper-validator-identifier/lib/index.js +0 -57
- package/dist/node_modules/@babel/helper-validator-identifier/lib/index.js.map +0 -1
- package/dist/node_modules/@babel/helper-validator-identifier/lib/keyword.js +0 -35
- package/dist/node_modules/@babel/helper-validator-identifier/lib/keyword.js.map +0 -1
- package/dist/node_modules/@babel/helper-validator-identifier/package.json +0 -31
- package/dist/node_modules/@types/progress/LICENSE +0 -21
- package/dist/node_modules/@types/progress/README.md +0 -15
- package/dist/node_modules/@types/progress/index.d.ts +0 -143
- package/dist/node_modules/@types/progress/package.json +0 -27
- package/dist/node_modules/argparse/CHANGELOG.md +0 -216
- package/dist/node_modules/argparse/LICENSE +0 -254
- package/dist/node_modules/argparse/README.md +0 -84
- package/dist/node_modules/argparse/argparse.js +0 -3707
- package/dist/node_modules/argparse/lib/sub.js +0 -67
- package/dist/node_modules/argparse/lib/textwrap.js +0 -440
- package/dist/node_modules/argparse/package.json +0 -31
- package/dist/node_modules/callsites/index.d.ts +0 -96
- package/dist/node_modules/callsites/index.js +0 -13
- package/dist/node_modules/callsites/license +0 -9
- package/dist/node_modules/callsites/package.json +0 -39
- package/dist/node_modules/callsites/readme.md +0 -48
- package/dist/node_modules/cosmiconfig/LICENSE +0 -22
- package/dist/node_modules/cosmiconfig/README.md +0 -782
- package/dist/node_modules/cosmiconfig/dist/Explorer.d.ts +0 -2
- package/dist/node_modules/cosmiconfig/dist/Explorer.js +0 -174
- package/dist/node_modules/cosmiconfig/dist/ExplorerBase.d.ts +0 -2
- package/dist/node_modules/cosmiconfig/dist/ExplorerBase.js +0 -126
- package/dist/node_modules/cosmiconfig/dist/ExplorerSync.d.ts +0 -2
- package/dist/node_modules/cosmiconfig/dist/ExplorerSync.js +0 -188
- package/dist/node_modules/cosmiconfig/dist/defaults.d.ts +0 -25
- package/dist/node_modules/cosmiconfig/dist/defaults.js +0 -105
- package/dist/node_modules/cosmiconfig/dist/index.d.ts +0 -6
- package/dist/node_modules/cosmiconfig/dist/index.js +0 -148
- package/dist/node_modules/cosmiconfig/dist/loaders.d.ts +0 -8
- package/dist/node_modules/cosmiconfig/dist/loaders.js +0 -150
- package/dist/node_modules/cosmiconfig/dist/merge.d.ts +0 -9
- package/dist/node_modules/cosmiconfig/dist/merge.js +0 -44
- package/dist/node_modules/cosmiconfig/dist/types.d.ts +0 -98
- package/dist/node_modules/cosmiconfig/dist/types.js +0 -3
- package/dist/node_modules/cosmiconfig/dist/util.d.ts +0 -2
- package/dist/node_modules/cosmiconfig/dist/util.js +0 -108
- package/dist/node_modules/cosmiconfig/package.json +0 -103
- package/dist/node_modules/env-paths/index.d.ts +0 -101
- package/dist/node_modules/env-paths/index.js +0 -74
- package/dist/node_modules/env-paths/license +0 -9
- package/dist/node_modules/env-paths/package.json +0 -45
- package/dist/node_modules/env-paths/readme.md +0 -115
- package/dist/node_modules/error-ex/LICENSE +0 -21
- package/dist/node_modules/error-ex/README.md +0 -144
- package/dist/node_modules/error-ex/index.js +0 -141
- package/dist/node_modules/error-ex/package.json +0 -46
- package/dist/node_modules/import-fresh/index.d.ts +0 -30
- package/dist/node_modules/import-fresh/index.js +0 -34
- package/dist/node_modules/import-fresh/license +0 -9
- package/dist/node_modules/import-fresh/node_modules/resolve-from/index.js +0 -47
- package/dist/node_modules/import-fresh/node_modules/resolve-from/license +0 -9
- package/dist/node_modules/import-fresh/node_modules/resolve-from/package.json +0 -34
- package/dist/node_modules/import-fresh/node_modules/resolve-from/readme.md +0 -72
- package/dist/node_modules/import-fresh/package.json +0 -48
- package/dist/node_modules/import-fresh/readme.md +0 -54
- package/dist/node_modules/is-arrayish/.editorconfig +0 -18
- package/dist/node_modules/is-arrayish/.istanbul.yml +0 -4
- package/dist/node_modules/is-arrayish/.travis.yml +0 -17
- package/dist/node_modules/is-arrayish/LICENSE +0 -21
- package/dist/node_modules/is-arrayish/README.md +0 -16
- package/dist/node_modules/is-arrayish/index.js +0 -10
- package/dist/node_modules/is-arrayish/package.json +0 -34
- package/dist/node_modules/js-tokens/CHANGELOG.md +0 -151
- package/dist/node_modules/js-tokens/LICENSE +0 -21
- package/dist/node_modules/js-tokens/README.md +0 -240
- package/dist/node_modules/js-tokens/index.js +0 -23
- package/dist/node_modules/js-tokens/package.json +0 -30
- package/dist/node_modules/js-yaml/LICENSE +0 -21
- package/dist/node_modules/js-yaml/README.md +0 -231
- package/dist/node_modules/js-yaml/bin/js-yaml.js +0 -117
- package/dist/node_modules/js-yaml/dist/js-yaml.js +0 -2404
- package/dist/node_modules/js-yaml/dist/js-yaml.js.map +0 -1
- package/dist/node_modules/js-yaml/dist/js-yaml.min.js +0 -33
- package/dist/node_modules/js-yaml/dist/js-yaml.min.js.map +0 -1
- package/dist/node_modules/js-yaml/dist/js-yaml.mjs +0 -2382
- package/dist/node_modules/js-yaml/dist/js-yaml.mjs.map +0 -1
- package/dist/node_modules/js-yaml/index.js +0 -44
- package/dist/node_modules/js-yaml/lib/common.js +0 -50
- package/dist/node_modules/js-yaml/lib/dumper.js +0 -937
- package/dist/node_modules/js-yaml/lib/exception.js +0 -51
- package/dist/node_modules/js-yaml/lib/index_vite_proxy.tmp.mjs +0 -37
- package/dist/node_modules/js-yaml/lib/loader.js +0 -1794
- package/dist/node_modules/js-yaml/lib/schema/core.js +0 -9
- package/dist/node_modules/js-yaml/lib/schema/default.js +0 -20
- package/dist/node_modules/js-yaml/lib/schema/failsafe.js +0 -14
- package/dist/node_modules/js-yaml/lib/schema/json.js +0 -17
- package/dist/node_modules/js-yaml/lib/schema.js +0 -109
- package/dist/node_modules/js-yaml/lib/snippet.js +0 -96
- package/dist/node_modules/js-yaml/lib/type/binary.js +0 -122
- package/dist/node_modules/js-yaml/lib/type/bool.js +0 -35
- package/dist/node_modules/js-yaml/lib/type/float.js +0 -99
- package/dist/node_modules/js-yaml/lib/type/int.js +0 -142
- package/dist/node_modules/js-yaml/lib/type/map.js +0 -8
- package/dist/node_modules/js-yaml/lib/type/merge.js +0 -12
- package/dist/node_modules/js-yaml/lib/type/null.js +0 -35
- package/dist/node_modules/js-yaml/lib/type/omap.js +0 -45
- package/dist/node_modules/js-yaml/lib/type/pairs.js +0 -50
- package/dist/node_modules/js-yaml/lib/type/seq.js +0 -8
- package/dist/node_modules/js-yaml/lib/type/set.js +0 -29
- package/dist/node_modules/js-yaml/lib/type/str.js +0 -8
- package/dist/node_modules/js-yaml/lib/type/timestamp.js +0 -88
- package/dist/node_modules/js-yaml/lib/type.js +0 -66
- package/dist/node_modules/js-yaml/package.json +0 -77
- package/dist/node_modules/json-parse-even-better-errors/CHANGELOG.md +0 -50
- package/dist/node_modules/json-parse-even-better-errors/LICENSE.md +0 -25
- package/dist/node_modules/json-parse-even-better-errors/README.md +0 -96
- package/dist/node_modules/json-parse-even-better-errors/index.js +0 -121
- package/dist/node_modules/json-parse-even-better-errors/package.json +0 -33
- package/dist/node_modules/lines-and-columns/LICENSE +0 -21
- package/dist/node_modules/lines-and-columns/README.md +0 -33
- package/dist/node_modules/lines-and-columns/build/index.d.ts +0 -13
- package/dist/node_modules/lines-and-columns/build/index.js +0 -62
- package/dist/node_modules/lines-and-columns/package.json +0 -49
- package/dist/node_modules/parent-module/index.js +0 -37
- package/dist/node_modules/parent-module/license +0 -9
- package/dist/node_modules/parent-module/package.json +0 -46
- package/dist/node_modules/parent-module/readme.md +0 -67
- package/dist/node_modules/parse-json/index.js +0 -54
- package/dist/node_modules/parse-json/license +0 -9
- package/dist/node_modules/parse-json/package.json +0 -45
- package/dist/node_modules/parse-json/readme.md +0 -119
- package/dist/node_modules/picocolors/LICENSE +0 -15
- package/dist/node_modules/picocolors/README.md +0 -21
- package/dist/node_modules/picocolors/package.json +0 -25
- package/dist/node_modules/picocolors/picocolors.browser.js +0 -4
- package/dist/node_modules/picocolors/picocolors.d.ts +0 -5
- package/dist/node_modules/picocolors/picocolors.js +0 -75
- package/dist/node_modules/picocolors/types.d.ts +0 -51
- package/dist/node_modules/typescript/LICENSE.txt +0 -55
- package/dist/node_modules/typescript/README.md +0 -50
- package/dist/node_modules/typescript/SECURITY.md +0 -39
- package/dist/node_modules/typescript/ThirdPartyNoticeText.txt +0 -193
- package/dist/node_modules/typescript/bin/tsc +0 -2
- package/dist/node_modules/typescript/bin/tsserver +0 -2
- package/dist/node_modules/typescript/lib/_tsc.js +0 -134465
- package/dist/node_modules/typescript/lib/_tsserver.js +0 -659
- package/dist/node_modules/typescript/lib/_typingsInstaller.js +0 -222
- package/dist/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +0 -2129
- package/dist/node_modules/typescript/lib/de/diagnosticMessages.generated.json +0 -2125
- package/dist/node_modules/typescript/lib/es/diagnosticMessages.generated.json +0 -2129
- package/dist/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +0 -2129
- package/dist/node_modules/typescript/lib/it/diagnosticMessages.generated.json +0 -2125
- package/dist/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +0 -2129
- package/dist/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +0 -2129
- package/dist/node_modules/typescript/lib/lib.d.ts +0 -20
- package/dist/node_modules/typescript/lib/lib.decorators.d.ts +0 -382
- package/dist/node_modules/typescript/lib/lib.decorators.legacy.d.ts +0 -20
- package/dist/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +0 -18
- package/dist/node_modules/typescript/lib/lib.dom.d.ts +0 -45125
- package/dist/node_modules/typescript/lib/lib.dom.iterable.d.ts +0 -18
- package/dist/node_modules/typescript/lib/lib.es2015.collection.d.ts +0 -150
- package/dist/node_modules/typescript/lib/lib.es2015.core.d.ts +0 -595
- package/dist/node_modules/typescript/lib/lib.es2015.d.ts +0 -26
- package/dist/node_modules/typescript/lib/lib.es2015.generator.d.ts +0 -75
- package/dist/node_modules/typescript/lib/lib.es2015.iterable.d.ts +0 -603
- package/dist/node_modules/typescript/lib/lib.es2015.promise.d.ts +0 -79
- package/dist/node_modules/typescript/lib/lib.es2015.proxy.d.ts +0 -126
- package/dist/node_modules/typescript/lib/lib.es2015.reflect.d.ts +0 -142
- package/dist/node_modules/typescript/lib/lib.es2015.symbol.d.ts +0 -44
- package/dist/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +0 -324
- package/dist/node_modules/typescript/lib/lib.es2016.array.include.d.ts +0 -114
- package/dist/node_modules/typescript/lib/lib.es2016.d.ts +0 -19
- package/dist/node_modules/typescript/lib/lib.es2016.full.d.ts +0 -21
- package/dist/node_modules/typescript/lib/lib.es2016.intl.d.ts +0 -29
- package/dist/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts +0 -19
- package/dist/node_modules/typescript/lib/lib.es2017.d.ts +0 -24
- package/dist/node_modules/typescript/lib/lib.es2017.date.d.ts +0 -29
- package/dist/node_modules/typescript/lib/lib.es2017.full.d.ts +0 -21
- package/dist/node_modules/typescript/lib/lib.es2017.intl.d.ts +0 -42
- package/dist/node_modules/typescript/lib/lib.es2017.object.d.ts +0 -47
- package/dist/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +0 -133
- package/dist/node_modules/typescript/lib/lib.es2017.string.d.ts +0 -43
- package/dist/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +0 -51
- package/dist/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +0 -75
- package/dist/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +0 -51
- package/dist/node_modules/typescript/lib/lib.es2018.d.ts +0 -22
- package/dist/node_modules/typescript/lib/lib.es2018.full.d.ts +0 -22
- package/dist/node_modules/typescript/lib/lib.es2018.intl.d.ts +0 -81
- package/dist/node_modules/typescript/lib/lib.es2018.promise.d.ts +0 -28
- package/dist/node_modules/typescript/lib/lib.es2018.regexp.d.ts +0 -35
- package/dist/node_modules/typescript/lib/lib.es2019.array.d.ts +0 -77
- package/dist/node_modules/typescript/lib/lib.es2019.d.ts +0 -22
- package/dist/node_modules/typescript/lib/lib.es2019.full.d.ts +0 -22
- package/dist/node_modules/typescript/lib/lib.es2019.intl.d.ts +0 -21
- package/dist/node_modules/typescript/lib/lib.es2019.object.d.ts +0 -31
- package/dist/node_modules/typescript/lib/lib.es2019.string.d.ts +0 -35
- package/dist/node_modules/typescript/lib/lib.es2019.symbol.d.ts +0 -22
- package/dist/node_modules/typescript/lib/lib.es2020.bigint.d.ts +0 -763
- package/dist/node_modules/typescript/lib/lib.es2020.d.ts +0 -25
- package/dist/node_modules/typescript/lib/lib.es2020.date.d.ts +0 -40
- package/dist/node_modules/typescript/lib/lib.es2020.full.d.ts +0 -22
- package/dist/node_modules/typescript/lib/lib.es2020.intl.d.ts +0 -472
- package/dist/node_modules/typescript/lib/lib.es2020.number.d.ts +0 -26
- package/dist/node_modules/typescript/lib/lib.es2020.promise.d.ts +0 -45
- package/dist/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +0 -97
- package/dist/node_modules/typescript/lib/lib.es2020.string.d.ts +0 -42
- package/dist/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +0 -39
- package/dist/node_modules/typescript/lib/lib.es2021.d.ts +0 -21
- package/dist/node_modules/typescript/lib/lib.es2021.full.d.ts +0 -22
- package/dist/node_modules/typescript/lib/lib.es2021.intl.d.ts +0 -164
- package/dist/node_modules/typescript/lib/lib.es2021.promise.d.ts +0 -46
- package/dist/node_modules/typescript/lib/lib.es2021.string.d.ts +0 -31
- package/dist/node_modules/typescript/lib/lib.es2021.weakref.d.ts +0 -76
- package/dist/node_modules/typescript/lib/lib.es2022.array.d.ts +0 -119
- package/dist/node_modules/typescript/lib/lib.es2022.d.ts +0 -23
- package/dist/node_modules/typescript/lib/lib.es2022.error.d.ts +0 -73
- package/dist/node_modules/typescript/lib/lib.es2022.full.d.ts +0 -22
- package/dist/node_modules/typescript/lib/lib.es2022.intl.d.ts +0 -143
- package/dist/node_modules/typescript/lib/lib.es2022.object.d.ts +0 -24
- package/dist/node_modules/typescript/lib/lib.es2022.regexp.d.ts +0 -37
- package/dist/node_modules/typescript/lib/lib.es2022.string.d.ts +0 -23
- package/dist/node_modules/typescript/lib/lib.es2023.array.d.ts +0 -922
- package/dist/node_modules/typescript/lib/lib.es2023.collection.d.ts +0 -19
- package/dist/node_modules/typescript/lib/lib.es2023.d.ts +0 -20
- package/dist/node_modules/typescript/lib/lib.es2023.full.d.ts +0 -22
- package/dist/node_modules/typescript/lib/lib.es2023.intl.d.ts +0 -62
- package/dist/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts +0 -63
- package/dist/node_modules/typescript/lib/lib.es2024.collection.d.ts +0 -27
- package/dist/node_modules/typescript/lib/lib.es2024.d.ts +0 -24
- package/dist/node_modules/typescript/lib/lib.es2024.full.d.ts +0 -22
- package/dist/node_modules/typescript/lib/lib.es2024.object.d.ts +0 -27
- package/dist/node_modules/typescript/lib/lib.es2024.promise.d.ts +0 -33
- package/dist/node_modules/typescript/lib/lib.es2024.regexp.d.ts +0 -23
- package/dist/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts +0 -66
- package/dist/node_modules/typescript/lib/lib.es2024.string.d.ts +0 -27
- package/dist/node_modules/typescript/lib/lib.es2025.collection.d.ts +0 -94
- package/dist/node_modules/typescript/lib/lib.es2025.d.ts +0 -23
- package/dist/node_modules/typescript/lib/lib.es2025.float16.d.ts +0 -443
- package/dist/node_modules/typescript/lib/lib.es2025.full.d.ts +0 -22
- package/dist/node_modules/typescript/lib/lib.es2025.intl.d.ts +0 -200
- package/dist/node_modules/typescript/lib/lib.es2025.iterator.d.ts +0 -146
- package/dist/node_modules/typescript/lib/lib.es2025.promise.d.ts +0 -32
- package/dist/node_modules/typescript/lib/lib.es2025.regexp.d.ts +0 -30
- package/dist/node_modules/typescript/lib/lib.es5.d.ts +0 -4599
- package/dist/node_modules/typescript/lib/lib.es6.d.ts +0 -21
- package/dist/node_modules/typescript/lib/lib.esnext.array.d.ts +0 -33
- package/dist/node_modules/typescript/lib/lib.esnext.collection.d.ts +0 -47
- package/dist/node_modules/typescript/lib/lib.esnext.d.ts +0 -27
- package/dist/node_modules/typescript/lib/lib.esnext.date.d.ts +0 -21
- package/dist/node_modules/typescript/lib/lib.esnext.decorators.d.ts +0 -26
- package/dist/node_modules/typescript/lib/lib.esnext.disposable.d.ts +0 -191
- package/dist/node_modules/typescript/lib/lib.esnext.error.d.ts +0 -22
- package/dist/node_modules/typescript/lib/lib.esnext.full.d.ts +0 -22
- package/dist/node_modules/typescript/lib/lib.esnext.intl.d.ts +0 -107
- package/dist/node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts +0 -23
- package/dist/node_modules/typescript/lib/lib.esnext.temporal.d.ts +0 -485
- package/dist/node_modules/typescript/lib/lib.esnext.typedarrays.d.ts +0 -90
- package/dist/node_modules/typescript/lib/lib.scripthost.d.ts +0 -320
- package/dist/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +0 -18
- package/dist/node_modules/typescript/lib/lib.webworker.d.ts +0 -15606
- package/dist/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +0 -21
- package/dist/node_modules/typescript/lib/lib.webworker.iterable.d.ts +0 -18
- package/dist/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +0 -2129
- package/dist/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +0 -2129
- package/dist/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +0 -2125
- package/dist/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +0 -2129
- package/dist/node_modules/typescript/lib/tsc.js +0 -8
- package/dist/node_modules/typescript/lib/tsserver.js +0 -8
- package/dist/node_modules/typescript/lib/tsserverlibrary.d.ts +0 -17
- package/dist/node_modules/typescript/lib/tsserverlibrary.js +0 -21
- package/dist/node_modules/typescript/lib/typesMap.json +0 -497
- package/dist/node_modules/typescript/lib/typescript.d.ts +0 -11448
- package/dist/node_modules/typescript/lib/typescript.js +0 -201039
- package/dist/node_modules/typescript/lib/typingsInstaller.js +0 -8
- package/dist/node_modules/typescript/lib/watchGuard.js +0 -53
- package/dist/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +0 -2129
- package/dist/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +0 -2125
- package/dist/node_modules/typescript/package.json +0 -118
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// Standard YAML's Core schema.
|
|
2
|
-
// http://www.yaml.org/spec/1.2/spec.html#id2804923
|
|
3
|
-
//
|
|
4
|
-
// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
|
|
5
|
-
// So, Core schema has no distinctions from JSON schema is JS-YAML.
|
|
6
|
-
|
|
7
|
-
'use strict'
|
|
8
|
-
|
|
9
|
-
module.exports = require('./json')
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// JS-YAML's default schema for `safeLoad` function.
|
|
2
|
-
// It is not described in the YAML specification.
|
|
3
|
-
//
|
|
4
|
-
// This schema is based on standard YAML's Core schema and includes most of
|
|
5
|
-
// extra types described at YAML tag repository. (http://yaml.org/type/)
|
|
6
|
-
|
|
7
|
-
'use strict'
|
|
8
|
-
|
|
9
|
-
module.exports = require('./core').extend({
|
|
10
|
-
implicit: [
|
|
11
|
-
require('../type/timestamp'),
|
|
12
|
-
require('../type/merge')
|
|
13
|
-
],
|
|
14
|
-
explicit: [
|
|
15
|
-
require('../type/binary'),
|
|
16
|
-
require('../type/omap'),
|
|
17
|
-
require('../type/pairs'),
|
|
18
|
-
require('../type/set')
|
|
19
|
-
]
|
|
20
|
-
})
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Standard YAML's Failsafe schema.
|
|
2
|
-
// http://www.yaml.org/spec/1.2/spec.html#id2802346
|
|
3
|
-
|
|
4
|
-
'use strict'
|
|
5
|
-
|
|
6
|
-
const Schema = require('../schema')
|
|
7
|
-
|
|
8
|
-
module.exports = new Schema({
|
|
9
|
-
explicit: [
|
|
10
|
-
require('../type/str'),
|
|
11
|
-
require('../type/seq'),
|
|
12
|
-
require('../type/map')
|
|
13
|
-
]
|
|
14
|
-
})
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// Standard YAML's JSON schema.
|
|
2
|
-
// http://www.yaml.org/spec/1.2/spec.html#id2803231
|
|
3
|
-
//
|
|
4
|
-
// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
|
|
5
|
-
// So, this schema is not such strict as defined in the YAML specification.
|
|
6
|
-
// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc.
|
|
7
|
-
|
|
8
|
-
'use strict'
|
|
9
|
-
|
|
10
|
-
module.exports = require('./failsafe').extend({
|
|
11
|
-
implicit: [
|
|
12
|
-
require('../type/null'),
|
|
13
|
-
require('../type/bool'),
|
|
14
|
-
require('../type/int'),
|
|
15
|
-
require('../type/float')
|
|
16
|
-
]
|
|
17
|
-
})
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const YAMLException = require('./exception')
|
|
4
|
-
const Type = require('./type')
|
|
5
|
-
|
|
6
|
-
function compileList (schema, name) {
|
|
7
|
-
const result = []
|
|
8
|
-
|
|
9
|
-
schema[name].forEach(function (currentType) {
|
|
10
|
-
let newIndex = result.length
|
|
11
|
-
|
|
12
|
-
result.forEach(function (previousType, previousIndex) {
|
|
13
|
-
if (previousType.tag === currentType.tag &&
|
|
14
|
-
previousType.kind === currentType.kind &&
|
|
15
|
-
previousType.multi === currentType.multi) {
|
|
16
|
-
newIndex = previousIndex
|
|
17
|
-
}
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
result[newIndex] = currentType
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
return result
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function compileMap (/* lists... */) {
|
|
27
|
-
const result = {
|
|
28
|
-
scalar: {},
|
|
29
|
-
sequence: {},
|
|
30
|
-
mapping: {},
|
|
31
|
-
fallback: {},
|
|
32
|
-
multi: {
|
|
33
|
-
scalar: [],
|
|
34
|
-
sequence: [],
|
|
35
|
-
mapping: [],
|
|
36
|
-
fallback: []
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
function collectType (type) {
|
|
40
|
-
if (type.multi) {
|
|
41
|
-
result.multi[type.kind].push(type)
|
|
42
|
-
result.multi['fallback'].push(type)
|
|
43
|
-
} else {
|
|
44
|
-
result[type.kind][type.tag] = result['fallback'][type.tag] = type
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
for (let index = 0, length = arguments.length; index < length; index += 1) {
|
|
49
|
-
arguments[index].forEach(collectType)
|
|
50
|
-
}
|
|
51
|
-
return result
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function Schema (definition) {
|
|
55
|
-
return this.extend(definition)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
Schema.prototype.extend = function extend (definition) {
|
|
59
|
-
let implicit = []
|
|
60
|
-
let explicit = []
|
|
61
|
-
|
|
62
|
-
if (definition instanceof Type) {
|
|
63
|
-
// Schema.extend(type)
|
|
64
|
-
explicit.push(definition)
|
|
65
|
-
} else if (Array.isArray(definition)) {
|
|
66
|
-
// Schema.extend([ type1, type2, ... ])
|
|
67
|
-
explicit = explicit.concat(definition)
|
|
68
|
-
} else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
|
|
69
|
-
// Schema.extend({ explicit: [ type1, type2, ... ], implicit: [ type1, type2, ... ] })
|
|
70
|
-
if (definition.implicit) implicit = implicit.concat(definition.implicit)
|
|
71
|
-
if (definition.explicit) explicit = explicit.concat(definition.explicit)
|
|
72
|
-
} else {
|
|
73
|
-
throw new YAMLException('Schema.extend argument should be a Type, [ Type ], ' +
|
|
74
|
-
'or a schema definition ({ implicit: [...], explicit: [...] })')
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
implicit.forEach(function (type) {
|
|
78
|
-
if (!(type instanceof Type)) {
|
|
79
|
-
throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.')
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (type.loadKind && type.loadKind !== 'scalar') {
|
|
83
|
-
throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.')
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (type.multi) {
|
|
87
|
-
throw new YAMLException('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.')
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
explicit.forEach(function (type) {
|
|
92
|
-
if (!(type instanceof Type)) {
|
|
93
|
-
throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.')
|
|
94
|
-
}
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
const result = Object.create(Schema.prototype)
|
|
98
|
-
|
|
99
|
-
result.implicit = (this.implicit || []).concat(implicit)
|
|
100
|
-
result.explicit = (this.explicit || []).concat(explicit)
|
|
101
|
-
|
|
102
|
-
result.compiledImplicit = compileList(result, 'implicit')
|
|
103
|
-
result.compiledExplicit = compileList(result, 'explicit')
|
|
104
|
-
result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit)
|
|
105
|
-
|
|
106
|
-
return result
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
module.exports = Schema
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const common = require('./common')
|
|
4
|
-
|
|
5
|
-
// get snippet for a single line, respecting maxLength
|
|
6
|
-
function getLine (buffer, lineStart, lineEnd, position, maxLineLength) {
|
|
7
|
-
let head = ''
|
|
8
|
-
let tail = ''
|
|
9
|
-
const maxHalfLength = Math.floor(maxLineLength / 2) - 1
|
|
10
|
-
|
|
11
|
-
if (position - lineStart > maxHalfLength) {
|
|
12
|
-
head = ' ... '
|
|
13
|
-
lineStart = position - maxHalfLength + head.length
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (lineEnd - position > maxHalfLength) {
|
|
17
|
-
tail = ' ...'
|
|
18
|
-
lineEnd = position + maxHalfLength - tail.length
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return {
|
|
22
|
-
str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, '→') + tail,
|
|
23
|
-
pos: position - lineStart + head.length // relative position
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function padStart (string, max) {
|
|
28
|
-
return common.repeat(' ', max - string.length) + string
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function makeSnippet (mark, options) {
|
|
32
|
-
options = Object.create(options || null)
|
|
33
|
-
|
|
34
|
-
if (!mark.buffer) return null
|
|
35
|
-
|
|
36
|
-
if (!options.maxLength) options.maxLength = 79
|
|
37
|
-
if (typeof options.indent !== 'number') options.indent = 1
|
|
38
|
-
if (typeof options.linesBefore !== 'number') options.linesBefore = 3
|
|
39
|
-
if (typeof options.linesAfter !== 'number') options.linesAfter = 2
|
|
40
|
-
|
|
41
|
-
const re = /\r?\n|\r|\0/g
|
|
42
|
-
const lineStarts = [0]
|
|
43
|
-
const lineEnds = []
|
|
44
|
-
let match
|
|
45
|
-
let foundLineNo = -1
|
|
46
|
-
|
|
47
|
-
while ((match = re.exec(mark.buffer))) {
|
|
48
|
-
lineEnds.push(match.index)
|
|
49
|
-
lineStarts.push(match.index + match[0].length)
|
|
50
|
-
|
|
51
|
-
if (mark.position <= match.index && foundLineNo < 0) {
|
|
52
|
-
foundLineNo = lineStarts.length - 2
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (foundLineNo < 0) foundLineNo = lineStarts.length - 1
|
|
57
|
-
|
|
58
|
-
let result = ''
|
|
59
|
-
const lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length
|
|
60
|
-
const maxLineLength = options.maxLength - (options.indent + lineNoLength + 3)
|
|
61
|
-
|
|
62
|
-
for (let i = 1; i <= options.linesBefore; i++) {
|
|
63
|
-
if (foundLineNo - i < 0) break
|
|
64
|
-
const line = getLine(
|
|
65
|
-
mark.buffer,
|
|
66
|
-
lineStarts[foundLineNo - i],
|
|
67
|
-
lineEnds[foundLineNo - i],
|
|
68
|
-
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),
|
|
69
|
-
maxLineLength
|
|
70
|
-
)
|
|
71
|
-
result = common.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) +
|
|
72
|
-
' | ' + line.str + '\n' + result
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength)
|
|
76
|
-
result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) +
|
|
77
|
-
' | ' + line.str + '\n'
|
|
78
|
-
result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\n'
|
|
79
|
-
|
|
80
|
-
for (let i = 1; i <= options.linesAfter; i++) {
|
|
81
|
-
if (foundLineNo + i >= lineEnds.length) break
|
|
82
|
-
const line = getLine(
|
|
83
|
-
mark.buffer,
|
|
84
|
-
lineStarts[foundLineNo + i],
|
|
85
|
-
lineEnds[foundLineNo + i],
|
|
86
|
-
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),
|
|
87
|
-
maxLineLength
|
|
88
|
-
)
|
|
89
|
-
result += common.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) +
|
|
90
|
-
' | ' + line.str + '\n'
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return result.replace(/\n$/, '')
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
module.exports = makeSnippet
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const Type = require('../type')
|
|
4
|
-
|
|
5
|
-
// [ 64, 65, 66 ] -> [ padding, CR, LF ]
|
|
6
|
-
const BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'
|
|
7
|
-
|
|
8
|
-
function resolveYamlBinary (data) {
|
|
9
|
-
if (data === null) return false
|
|
10
|
-
|
|
11
|
-
let bitlen = 0
|
|
12
|
-
const max = data.length
|
|
13
|
-
const map = BASE64_MAP
|
|
14
|
-
|
|
15
|
-
// Convert one by one.
|
|
16
|
-
for (let idx = 0; idx < max; idx++) {
|
|
17
|
-
const code = map.indexOf(data.charAt(idx))
|
|
18
|
-
|
|
19
|
-
// Skip CR/LF
|
|
20
|
-
if (code > 64) continue
|
|
21
|
-
|
|
22
|
-
// Fail on illegal characters
|
|
23
|
-
if (code < 0) return false
|
|
24
|
-
|
|
25
|
-
bitlen += 6
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// If there are any bits left, source was corrupted
|
|
29
|
-
return (bitlen % 8) === 0
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function constructYamlBinary (data) {
|
|
33
|
-
const input = data.replace(/[\r\n=]/g, '') // remove CR/LF & padding to simplify scan
|
|
34
|
-
const max = input.length
|
|
35
|
-
const map = BASE64_MAP
|
|
36
|
-
let bits = 0
|
|
37
|
-
const result = []
|
|
38
|
-
|
|
39
|
-
// Collect by 6*4 bits (3 bytes)
|
|
40
|
-
|
|
41
|
-
for (let idx = 0; idx < max; idx++) {
|
|
42
|
-
if ((idx % 4 === 0) && idx) {
|
|
43
|
-
result.push((bits >> 16) & 0xFF)
|
|
44
|
-
result.push((bits >> 8) & 0xFF)
|
|
45
|
-
result.push(bits & 0xFF)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
bits = (bits << 6) | map.indexOf(input.charAt(idx))
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Dump tail
|
|
52
|
-
|
|
53
|
-
const tailbits = (max % 4) * 6
|
|
54
|
-
|
|
55
|
-
if (tailbits === 0) {
|
|
56
|
-
result.push((bits >> 16) & 0xFF)
|
|
57
|
-
result.push((bits >> 8) & 0xFF)
|
|
58
|
-
result.push(bits & 0xFF)
|
|
59
|
-
} else if (tailbits === 18) {
|
|
60
|
-
result.push((bits >> 10) & 0xFF)
|
|
61
|
-
result.push((bits >> 2) & 0xFF)
|
|
62
|
-
} else if (tailbits === 12) {
|
|
63
|
-
result.push((bits >> 4) & 0xFF)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return new Uint8Array(result)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function representYamlBinary (object /*, style */) {
|
|
70
|
-
let result = ''
|
|
71
|
-
let bits = 0
|
|
72
|
-
const max = object.length
|
|
73
|
-
const map = BASE64_MAP
|
|
74
|
-
|
|
75
|
-
// Convert every three bytes to 4 ASCII characters.
|
|
76
|
-
|
|
77
|
-
for (let idx = 0; idx < max; idx++) {
|
|
78
|
-
if ((idx % 3 === 0) && idx) {
|
|
79
|
-
result += map[(bits >> 18) & 0x3F]
|
|
80
|
-
result += map[(bits >> 12) & 0x3F]
|
|
81
|
-
result += map[(bits >> 6) & 0x3F]
|
|
82
|
-
result += map[bits & 0x3F]
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
bits = (bits << 8) + object[idx]
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// Dump tail
|
|
89
|
-
|
|
90
|
-
const tail = max % 3
|
|
91
|
-
|
|
92
|
-
if (tail === 0) {
|
|
93
|
-
result += map[(bits >> 18) & 0x3F]
|
|
94
|
-
result += map[(bits >> 12) & 0x3F]
|
|
95
|
-
result += map[(bits >> 6) & 0x3F]
|
|
96
|
-
result += map[bits & 0x3F]
|
|
97
|
-
} else if (tail === 2) {
|
|
98
|
-
result += map[(bits >> 10) & 0x3F]
|
|
99
|
-
result += map[(bits >> 4) & 0x3F]
|
|
100
|
-
result += map[(bits << 2) & 0x3F]
|
|
101
|
-
result += map[64]
|
|
102
|
-
} else if (tail === 1) {
|
|
103
|
-
result += map[(bits >> 2) & 0x3F]
|
|
104
|
-
result += map[(bits << 4) & 0x3F]
|
|
105
|
-
result += map[64]
|
|
106
|
-
result += map[64]
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return result
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function isBinary (obj) {
|
|
113
|
-
return Object.prototype.toString.call(obj) === '[object Uint8Array]'
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
module.exports = new Type('tag:yaml.org,2002:binary', {
|
|
117
|
-
kind: 'scalar',
|
|
118
|
-
resolve: resolveYamlBinary,
|
|
119
|
-
construct: constructYamlBinary,
|
|
120
|
-
predicate: isBinary,
|
|
121
|
-
represent: representYamlBinary
|
|
122
|
-
})
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const Type = require('../type')
|
|
4
|
-
|
|
5
|
-
function resolveYamlBoolean (data) {
|
|
6
|
-
if (data === null) return false
|
|
7
|
-
|
|
8
|
-
const max = data.length
|
|
9
|
-
|
|
10
|
-
return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||
|
|
11
|
-
(max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'))
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function constructYamlBoolean (data) {
|
|
15
|
-
return data === 'true' ||
|
|
16
|
-
data === 'True' ||
|
|
17
|
-
data === 'TRUE'
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function isBoolean (object) {
|
|
21
|
-
return Object.prototype.toString.call(object) === '[object Boolean]'
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
module.exports = new Type('tag:yaml.org,2002:bool', {
|
|
25
|
-
kind: 'scalar',
|
|
26
|
-
resolve: resolveYamlBoolean,
|
|
27
|
-
construct: constructYamlBoolean,
|
|
28
|
-
predicate: isBoolean,
|
|
29
|
-
represent: {
|
|
30
|
-
lowercase: function (object) { return object ? 'true' : 'false' },
|
|
31
|
-
uppercase: function (object) { return object ? 'TRUE' : 'FALSE' },
|
|
32
|
-
camelcase: function (object) { return object ? 'True' : 'False' }
|
|
33
|
-
},
|
|
34
|
-
defaultStyle: 'lowercase'
|
|
35
|
-
})
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const common = require('../common')
|
|
4
|
-
const Type = require('../type')
|
|
5
|
-
|
|
6
|
-
const YAML_FLOAT_PATTERN = new RegExp(
|
|
7
|
-
// 2.5e4, 2.5 and integers
|
|
8
|
-
'^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?' +
|
|
9
|
-
// .2e4, .2
|
|
10
|
-
// special case, seems not from spec
|
|
11
|
-
'|\\.[0-9]+(?:[eE][-+]?[0-9]+)?' +
|
|
12
|
-
// .inf
|
|
13
|
-
'|[-+]?\\.(?:inf|Inf|INF)' +
|
|
14
|
-
// .nan
|
|
15
|
-
'|\\.(?:nan|NaN|NAN))$')
|
|
16
|
-
|
|
17
|
-
const YAML_FLOAT_SPECIAL_PATTERN = new RegExp(
|
|
18
|
-
'^(?:' +
|
|
19
|
-
// .inf
|
|
20
|
-
'[-+]?\\.(?:inf|Inf|INF)' +
|
|
21
|
-
// .nan
|
|
22
|
-
'|\\.(?:nan|NaN|NAN))$')
|
|
23
|
-
|
|
24
|
-
function resolveYamlFloat (data) {
|
|
25
|
-
if (data === null) return false
|
|
26
|
-
|
|
27
|
-
if (!YAML_FLOAT_PATTERN.test(data)) {
|
|
28
|
-
return false
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (Number.isFinite(parseFloat(data, 10))) {
|
|
32
|
-
return true
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return YAML_FLOAT_SPECIAL_PATTERN.test(data)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function constructYamlFloat (data) {
|
|
39
|
-
let value = data.toLowerCase()
|
|
40
|
-
const sign = value[0] === '-' ? -1 : 1
|
|
41
|
-
|
|
42
|
-
if ('+-'.indexOf(value[0]) >= 0) {
|
|
43
|
-
value = value.slice(1)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (value === '.inf') {
|
|
47
|
-
return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY
|
|
48
|
-
} else if (value === '.nan') {
|
|
49
|
-
return NaN
|
|
50
|
-
}
|
|
51
|
-
return sign * parseFloat(value, 10)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/
|
|
55
|
-
|
|
56
|
-
function representYamlFloat (object, style) {
|
|
57
|
-
if (isNaN(object)) {
|
|
58
|
-
switch (style) {
|
|
59
|
-
case 'lowercase': return '.nan'
|
|
60
|
-
case 'uppercase': return '.NAN'
|
|
61
|
-
case 'camelcase': return '.NaN'
|
|
62
|
-
}
|
|
63
|
-
} else if (Number.POSITIVE_INFINITY === object) {
|
|
64
|
-
switch (style) {
|
|
65
|
-
case 'lowercase': return '.inf'
|
|
66
|
-
case 'uppercase': return '.INF'
|
|
67
|
-
case 'camelcase': return '.Inf'
|
|
68
|
-
}
|
|
69
|
-
} else if (Number.NEGATIVE_INFINITY === object) {
|
|
70
|
-
switch (style) {
|
|
71
|
-
case 'lowercase': return '-.inf'
|
|
72
|
-
case 'uppercase': return '-.INF'
|
|
73
|
-
case 'camelcase': return '-.Inf'
|
|
74
|
-
}
|
|
75
|
-
} else if (common.isNegativeZero(object)) {
|
|
76
|
-
return '-0.0'
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const res = object.toString(10)
|
|
80
|
-
|
|
81
|
-
// JS stringifier can build scientific format without dots: 5e-100,
|
|
82
|
-
// while YAML requres dot: 5.e-100. Fix it with simple hack
|
|
83
|
-
|
|
84
|
-
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function isFloat (object) {
|
|
88
|
-
return (Object.prototype.toString.call(object) === '[object Number]') &&
|
|
89
|
-
(object % 1 !== 0 || common.isNegativeZero(object))
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
module.exports = new Type('tag:yaml.org,2002:float', {
|
|
93
|
-
kind: 'scalar',
|
|
94
|
-
resolve: resolveYamlFloat,
|
|
95
|
-
construct: constructYamlFloat,
|
|
96
|
-
predicate: isFloat,
|
|
97
|
-
represent: representYamlFloat,
|
|
98
|
-
defaultStyle: 'lowercase'
|
|
99
|
-
})
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const common = require('../common')
|
|
4
|
-
const Type = require('../type')
|
|
5
|
-
|
|
6
|
-
function isHexCode (c) {
|
|
7
|
-
return ((c >= 0x30/* 0 */) && (c <= 0x39/* 9 */)) ||
|
|
8
|
-
((c >= 0x41/* A */) && (c <= 0x46/* F */)) ||
|
|
9
|
-
((c >= 0x61/* a */) && (c <= 0x66/* f */))
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function isOctCode (c) {
|
|
13
|
-
return ((c >= 0x30/* 0 */) && (c <= 0x37/* 7 */))
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function isDecCode (c) {
|
|
17
|
-
return ((c >= 0x30/* 0 */) && (c <= 0x39/* 9 */))
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function resolveYamlInteger (data) {
|
|
21
|
-
if (data === null) return false
|
|
22
|
-
|
|
23
|
-
const max = data.length
|
|
24
|
-
let index = 0
|
|
25
|
-
let hasDigits = false
|
|
26
|
-
|
|
27
|
-
if (!max) return false
|
|
28
|
-
|
|
29
|
-
let ch = data[index]
|
|
30
|
-
|
|
31
|
-
// sign
|
|
32
|
-
if (ch === '-' || ch === '+') {
|
|
33
|
-
ch = data[++index]
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (ch === '0') {
|
|
37
|
-
// 0
|
|
38
|
-
if (index + 1 === max) return true
|
|
39
|
-
ch = data[++index]
|
|
40
|
-
|
|
41
|
-
// base 2, base 8, base 16
|
|
42
|
-
|
|
43
|
-
if (ch === 'b') {
|
|
44
|
-
// base 2
|
|
45
|
-
index++
|
|
46
|
-
|
|
47
|
-
for (; index < max; index++) {
|
|
48
|
-
ch = data[index]
|
|
49
|
-
if (ch !== '0' && ch !== '1') return false
|
|
50
|
-
hasDigits = true
|
|
51
|
-
}
|
|
52
|
-
return hasDigits && Number.isFinite(parseYamlInteger(data))
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (ch === 'x') {
|
|
56
|
-
// base 16
|
|
57
|
-
index++
|
|
58
|
-
|
|
59
|
-
for (; index < max; index++) {
|
|
60
|
-
if (!isHexCode(data.charCodeAt(index))) return false
|
|
61
|
-
hasDigits = true
|
|
62
|
-
}
|
|
63
|
-
return hasDigits && Number.isFinite(parseYamlInteger(data))
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (ch === 'o') {
|
|
67
|
-
// base 8
|
|
68
|
-
index++
|
|
69
|
-
|
|
70
|
-
for (; index < max; index++) {
|
|
71
|
-
if (!isOctCode(data.charCodeAt(index))) return false
|
|
72
|
-
hasDigits = true
|
|
73
|
-
}
|
|
74
|
-
return hasDigits && Number.isFinite(parseYamlInteger(data))
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// base 10 (except 0)
|
|
79
|
-
|
|
80
|
-
for (; index < max; index++) {
|
|
81
|
-
if (!isDecCode(data.charCodeAt(index))) {
|
|
82
|
-
return false
|
|
83
|
-
}
|
|
84
|
-
hasDigits = true
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (!hasDigits) return false
|
|
88
|
-
|
|
89
|
-
return Number.isFinite(parseYamlInteger(data))
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function parseYamlInteger (data) {
|
|
93
|
-
let value = data
|
|
94
|
-
let sign = 1
|
|
95
|
-
|
|
96
|
-
let ch = value[0]
|
|
97
|
-
|
|
98
|
-
if (ch === '-' || ch === '+') {
|
|
99
|
-
if (ch === '-') sign = -1
|
|
100
|
-
value = value.slice(1)
|
|
101
|
-
ch = value[0]
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (value === '0') return 0
|
|
105
|
-
|
|
106
|
-
if (ch === '0') {
|
|
107
|
-
if (value[1] === 'b') return sign * parseInt(value.slice(2), 2)
|
|
108
|
-
if (value[1] === 'x') return sign * parseInt(value.slice(2), 16)
|
|
109
|
-
if (value[1] === 'o') return sign * parseInt(value.slice(2), 8)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return sign * parseInt(value, 10)
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function constructYamlInteger (data) {
|
|
116
|
-
return parseYamlInteger(data)
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function isInteger (object) {
|
|
120
|
-
return (Object.prototype.toString.call(object)) === '[object Number]' &&
|
|
121
|
-
(object % 1 === 0 && !common.isNegativeZero(object))
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
module.exports = new Type('tag:yaml.org,2002:int', {
|
|
125
|
-
kind: 'scalar',
|
|
126
|
-
resolve: resolveYamlInteger,
|
|
127
|
-
construct: constructYamlInteger,
|
|
128
|
-
predicate: isInteger,
|
|
129
|
-
represent: {
|
|
130
|
-
binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1) },
|
|
131
|
-
octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1) },
|
|
132
|
-
decimal: function (obj) { return obj.toString(10) },
|
|
133
|
-
hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1) }
|
|
134
|
-
},
|
|
135
|
-
defaultStyle: 'decimal',
|
|
136
|
-
styleAliases: {
|
|
137
|
-
binary: [2, 'bin'],
|
|
138
|
-
octal: [8, 'oct'],
|
|
139
|
-
decimal: [10, 'dec'],
|
|
140
|
-
hexadecimal: [16, 'hex']
|
|
141
|
-
}
|
|
142
|
-
})
|