@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,101 +0,0 @@
|
|
|
1
|
-
declare namespace envPaths {
|
|
2
|
-
export interface Options {
|
|
3
|
-
/**
|
|
4
|
-
__Don't use this option unless you really have to!__
|
|
5
|
-
|
|
6
|
-
Suffix appended to the project name to avoid name conflicts with native apps. Pass an empty string to disable it.
|
|
7
|
-
|
|
8
|
-
@default 'nodejs'
|
|
9
|
-
*/
|
|
10
|
-
readonly suffix?: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface Paths {
|
|
14
|
-
/**
|
|
15
|
-
Directory for data files.
|
|
16
|
-
|
|
17
|
-
Example locations (with the default `nodejs` suffix):
|
|
18
|
-
|
|
19
|
-
- macOS: `~/Library/Application Support/MyApp-nodejs`
|
|
20
|
-
- Windows: `%LOCALAPPDATA%\MyApp-nodejs\Data` (for example, `C:\Users\USERNAME\AppData\Local\MyApp-nodejs\Data`)
|
|
21
|
-
- Linux: `~/.local/share/MyApp-nodejs` (or `$XDG_DATA_HOME/MyApp-nodejs`)
|
|
22
|
-
*/
|
|
23
|
-
readonly data: string;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
Directory for data files.
|
|
27
|
-
|
|
28
|
-
Example locations (with the default `nodejs` suffix):
|
|
29
|
-
|
|
30
|
-
- macOS: `~/Library/Preferences/MyApp-nodejs`
|
|
31
|
-
- Windows: `%APPDATA%\MyApp-nodejs\Config` (for example, `C:\Users\USERNAME\AppData\Roaming\MyApp-nodejs\Config`)
|
|
32
|
-
- Linux: `~/.config/MyApp-nodejs` (or `$XDG_CONFIG_HOME/MyApp-nodejs`)
|
|
33
|
-
*/
|
|
34
|
-
readonly config: string;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
Directory for non-essential data files.
|
|
38
|
-
|
|
39
|
-
Example locations (with the default `nodejs` suffix):
|
|
40
|
-
|
|
41
|
-
- macOS: `~/Library/Caches/MyApp-nodejs`
|
|
42
|
-
- Windows: `%LOCALAPPDATA%\MyApp-nodejs\Cache` (for example, `C:\Users\USERNAME\AppData\Local\MyApp-nodejs\Cache`)
|
|
43
|
-
- Linux: `~/.cache/MyApp-nodejs` (or `$XDG_CACHE_HOME/MyApp-nodejs`)
|
|
44
|
-
*/
|
|
45
|
-
readonly cache: string;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
Directory for log files.
|
|
49
|
-
|
|
50
|
-
Example locations (with the default `nodejs` suffix):
|
|
51
|
-
|
|
52
|
-
- macOS: `~/Library/Logs/MyApp-nodejs`
|
|
53
|
-
- Windows: `%LOCALAPPDATA%\MyApp-nodejs\Log` (for example, `C:\Users\USERNAME\AppData\Local\MyApp-nodejs\Log`)
|
|
54
|
-
- Linux: `~/.local/state/MyApp-nodejs` (or `$XDG_STATE_HOME/MyApp-nodejs`)
|
|
55
|
-
*/
|
|
56
|
-
readonly log: string;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
Directory for temporary files.
|
|
60
|
-
|
|
61
|
-
Example locations (with the default `nodejs` suffix):
|
|
62
|
-
|
|
63
|
-
- macOS: `/var/folders/jf/f2twvvvs5jl_m49tf034ffpw0000gn/T/MyApp-nodejs`
|
|
64
|
-
- Windows: `%LOCALAPPDATA%\Temp\MyApp-nodejs` (for example, `C:\Users\USERNAME\AppData\Local\Temp\MyApp-nodejs`)
|
|
65
|
-
- Linux: `/tmp/USERNAME/MyApp-nodejs`
|
|
66
|
-
*/
|
|
67
|
-
readonly temp: string;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
declare const envPaths: {
|
|
72
|
-
/**
|
|
73
|
-
Get paths for storing things like data, config, cache, etc.
|
|
74
|
-
|
|
75
|
-
Note: It only generates the path strings. It doesn't create the directories for you. You could use [`make-dir`](https://github.com/sindresorhus/make-dir) to create the directories.
|
|
76
|
-
|
|
77
|
-
@param name - Name of your project. Used to generate the paths.
|
|
78
|
-
@returns The paths to use for your project on current OS.
|
|
79
|
-
|
|
80
|
-
@example
|
|
81
|
-
```
|
|
82
|
-
import envPaths = require('env-paths');
|
|
83
|
-
|
|
84
|
-
const paths = envPaths('MyApp');
|
|
85
|
-
|
|
86
|
-
paths.data;
|
|
87
|
-
//=> '/home/sindresorhus/.local/share/MyApp-nodejs'
|
|
88
|
-
|
|
89
|
-
paths.config
|
|
90
|
-
//=> '/home/sindresorhus/.config/MyApp-nodejs'
|
|
91
|
-
```
|
|
92
|
-
*/
|
|
93
|
-
(name: string, options?: envPaths.Options): envPaths.Paths;
|
|
94
|
-
|
|
95
|
-
// TODO: Remove this for the next major release, refactor the whole definition to:
|
|
96
|
-
// declare function envPaths(name: string, options?: envPaths.Options): envPaths.Paths;
|
|
97
|
-
// export = envPaths;
|
|
98
|
-
default: typeof envPaths;
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
export = envPaths;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const os = require('os');
|
|
4
|
-
|
|
5
|
-
const homedir = os.homedir();
|
|
6
|
-
const tmpdir = os.tmpdir();
|
|
7
|
-
const {env} = process;
|
|
8
|
-
|
|
9
|
-
const macos = name => {
|
|
10
|
-
const library = path.join(homedir, 'Library');
|
|
11
|
-
|
|
12
|
-
return {
|
|
13
|
-
data: path.join(library, 'Application Support', name),
|
|
14
|
-
config: path.join(library, 'Preferences', name),
|
|
15
|
-
cache: path.join(library, 'Caches', name),
|
|
16
|
-
log: path.join(library, 'Logs', name),
|
|
17
|
-
temp: path.join(tmpdir, name)
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const windows = name => {
|
|
22
|
-
const appData = env.APPDATA || path.join(homedir, 'AppData', 'Roaming');
|
|
23
|
-
const localAppData = env.LOCALAPPDATA || path.join(homedir, 'AppData', 'Local');
|
|
24
|
-
|
|
25
|
-
return {
|
|
26
|
-
// Data/config/cache/log are invented by me as Windows isn't opinionated about this
|
|
27
|
-
data: path.join(localAppData, name, 'Data'),
|
|
28
|
-
config: path.join(appData, name, 'Config'),
|
|
29
|
-
cache: path.join(localAppData, name, 'Cache'),
|
|
30
|
-
log: path.join(localAppData, name, 'Log'),
|
|
31
|
-
temp: path.join(tmpdir, name)
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
// https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
|
36
|
-
const linux = name => {
|
|
37
|
-
const username = path.basename(homedir);
|
|
38
|
-
|
|
39
|
-
return {
|
|
40
|
-
data: path.join(env.XDG_DATA_HOME || path.join(homedir, '.local', 'share'), name),
|
|
41
|
-
config: path.join(env.XDG_CONFIG_HOME || path.join(homedir, '.config'), name),
|
|
42
|
-
cache: path.join(env.XDG_CACHE_HOME || path.join(homedir, '.cache'), name),
|
|
43
|
-
// https://wiki.debian.org/XDGBaseDirectorySpecification#state
|
|
44
|
-
log: path.join(env.XDG_STATE_HOME || path.join(homedir, '.local', 'state'), name),
|
|
45
|
-
temp: path.join(tmpdir, username, name)
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const envPaths = (name, options) => {
|
|
50
|
-
if (typeof name !== 'string') {
|
|
51
|
-
throw new TypeError(`Expected string, got ${typeof name}`);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
options = Object.assign({suffix: 'nodejs'}, options);
|
|
55
|
-
|
|
56
|
-
if (options.suffix) {
|
|
57
|
-
// Add suffix to prevent possible conflict with native apps
|
|
58
|
-
name += `-${options.suffix}`;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (process.platform === 'darwin') {
|
|
62
|
-
return macos(name);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (process.platform === 'win32') {
|
|
66
|
-
return windows(name);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return linux(name);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
module.exports = envPaths;
|
|
73
|
-
// TODO: Remove this for the next major release
|
|
74
|
-
module.exports.default = envPaths;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
-
|
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "env-paths",
|
|
3
|
-
"version": "2.2.1",
|
|
4
|
-
"description": "Get paths for storing things like data, config, cache, etc",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"repository": "sindresorhus/env-paths",
|
|
7
|
-
"author": {
|
|
8
|
-
"name": "Sindre Sorhus",
|
|
9
|
-
"email": "sindresorhus@gmail.com",
|
|
10
|
-
"url": "sindresorhus.com"
|
|
11
|
-
},
|
|
12
|
-
"engines": {
|
|
13
|
-
"node": ">=6"
|
|
14
|
-
},
|
|
15
|
-
"scripts": {
|
|
16
|
-
"test": "xo && ava && tsd"
|
|
17
|
-
},
|
|
18
|
-
"files": [
|
|
19
|
-
"index.js",
|
|
20
|
-
"index.d.ts"
|
|
21
|
-
],
|
|
22
|
-
"keywords": [
|
|
23
|
-
"common",
|
|
24
|
-
"user",
|
|
25
|
-
"paths",
|
|
26
|
-
"env",
|
|
27
|
-
"environment",
|
|
28
|
-
"directory",
|
|
29
|
-
"dir",
|
|
30
|
-
"appdir",
|
|
31
|
-
"path",
|
|
32
|
-
"data",
|
|
33
|
-
"config",
|
|
34
|
-
"cache",
|
|
35
|
-
"logs",
|
|
36
|
-
"temp",
|
|
37
|
-
"linux",
|
|
38
|
-
"unix"
|
|
39
|
-
],
|
|
40
|
-
"devDependencies": {
|
|
41
|
-
"ava": "^1.4.1",
|
|
42
|
-
"tsd": "^0.7.1",
|
|
43
|
-
"xo": "^0.24.0"
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
# env-paths
|
|
2
|
-
|
|
3
|
-
> Get paths for storing things like data, config, cache, etc
|
|
4
|
-
|
|
5
|
-
Uses the correct OS-specific paths. Most developers get this wrong.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## Install
|
|
9
|
-
|
|
10
|
-
```
|
|
11
|
-
$ npm install env-paths
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
## Usage
|
|
16
|
-
|
|
17
|
-
```js
|
|
18
|
-
const envPaths = require('env-paths');
|
|
19
|
-
|
|
20
|
-
const paths = envPaths('MyApp');
|
|
21
|
-
|
|
22
|
-
paths.data;
|
|
23
|
-
//=> '/home/sindresorhus/.local/share/MyApp-nodejs'
|
|
24
|
-
|
|
25
|
-
paths.config
|
|
26
|
-
//=> '/home/sindresorhus/.config/MyApp-nodejs'
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
## API
|
|
31
|
-
|
|
32
|
-
### paths = envPaths(name, options?)
|
|
33
|
-
|
|
34
|
-
Note: It only generates the path strings. It doesn't create the directories for you. You could use [`make-dir`](https://github.com/sindresorhus/make-dir) to create the directories.
|
|
35
|
-
|
|
36
|
-
#### name
|
|
37
|
-
|
|
38
|
-
Type: `string`
|
|
39
|
-
|
|
40
|
-
Name of your project. Used to generate the paths.
|
|
41
|
-
|
|
42
|
-
#### options
|
|
43
|
-
|
|
44
|
-
Type: `object`
|
|
45
|
-
|
|
46
|
-
##### suffix
|
|
47
|
-
|
|
48
|
-
Type: `string`<br>
|
|
49
|
-
Default: `'nodejs'`
|
|
50
|
-
|
|
51
|
-
**Don't use this option unless you really have to!**<br>
|
|
52
|
-
Suffix appended to the project name to avoid name conflicts with native
|
|
53
|
-
apps. Pass an empty string to disable it.
|
|
54
|
-
|
|
55
|
-
### paths.data
|
|
56
|
-
|
|
57
|
-
Directory for data files.
|
|
58
|
-
|
|
59
|
-
Example locations (with the default `nodejs` [suffix](#suffix)):
|
|
60
|
-
|
|
61
|
-
- macOS: `~/Library/Application Support/MyApp-nodejs`
|
|
62
|
-
- Windows: `%LOCALAPPDATA%\MyApp-nodejs\Data` (for example, `C:\Users\USERNAME\AppData\Local\MyApp-nodejs\Data`)
|
|
63
|
-
- Linux: `~/.local/share/MyApp-nodejs` (or `$XDG_DATA_HOME/MyApp-nodejs`)
|
|
64
|
-
|
|
65
|
-
### paths.config
|
|
66
|
-
|
|
67
|
-
Directory for config files.
|
|
68
|
-
|
|
69
|
-
Example locations (with the default `nodejs` [suffix](#suffix)):
|
|
70
|
-
|
|
71
|
-
- macOS: `~/Library/Preferences/MyApp-nodejs`
|
|
72
|
-
- Windows: `%APPDATA%\MyApp-nodejs\Config` (for example, `C:\Users\USERNAME\AppData\Roaming\MyApp-nodejs\Config`)
|
|
73
|
-
- Linux: `~/.config/MyApp-nodejs` (or `$XDG_CONFIG_HOME/MyApp-nodejs`)
|
|
74
|
-
|
|
75
|
-
### paths.cache
|
|
76
|
-
|
|
77
|
-
Directory for non-essential data files.
|
|
78
|
-
|
|
79
|
-
Example locations (with the default `nodejs` [suffix](#suffix)):
|
|
80
|
-
|
|
81
|
-
- macOS: `~/Library/Caches/MyApp-nodejs`
|
|
82
|
-
- Windows: `%LOCALAPPDATA%\MyApp-nodejs\Cache` (for example, `C:\Users\USERNAME\AppData\Local\MyApp-nodejs\Cache`)
|
|
83
|
-
- Linux: `~/.cache/MyApp-nodejs` (or `$XDG_CACHE_HOME/MyApp-nodejs`)
|
|
84
|
-
|
|
85
|
-
### paths.log
|
|
86
|
-
|
|
87
|
-
Directory for log files.
|
|
88
|
-
|
|
89
|
-
Example locations (with the default `nodejs` [suffix](#suffix)):
|
|
90
|
-
|
|
91
|
-
- macOS: `~/Library/Logs/MyApp-nodejs`
|
|
92
|
-
- Windows: `%LOCALAPPDATA%\MyApp-nodejs\Log` (for example, `C:\Users\USERNAME\AppData\Local\MyApp-nodejs\Log`)
|
|
93
|
-
- Linux: `~/.local/state/MyApp-nodejs` (or `$XDG_STATE_HOME/MyApp-nodejs`)
|
|
94
|
-
|
|
95
|
-
### paths.temp
|
|
96
|
-
|
|
97
|
-
Directory for temporary files.
|
|
98
|
-
|
|
99
|
-
Example locations (with the default `nodejs` [suffix](#suffix)):
|
|
100
|
-
|
|
101
|
-
- macOS: `/var/folders/jf/f2twvvvs5jl_m49tf034ffpw0000gn/T/MyApp-nodejs`
|
|
102
|
-
- Windows: `%LOCALAPPDATA%\Temp\MyApp-nodejs` (for example, `C:\Users\USERNAME\AppData\Local\Temp\MyApp-nodejs`)
|
|
103
|
-
- Linux: `/tmp/USERNAME/MyApp-nodejs`
|
|
104
|
-
|
|
105
|
-
---
|
|
106
|
-
|
|
107
|
-
<div align="center">
|
|
108
|
-
<b>
|
|
109
|
-
<a href="https://tidelift.com/subscription/pkg/npm-env-paths?utm_source=npm-env-paths&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
|
110
|
-
</b>
|
|
111
|
-
<br>
|
|
112
|
-
<sub>
|
|
113
|
-
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
|
114
|
-
</sub>
|
|
115
|
-
</div>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2015 JD Ballard
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
|
13
|
-
all copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
THE SOFTWARE.
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
# node-error-ex [](https://travis-ci.org/Qix-/node-error-ex) [](https://coveralls.io/r/Qix-/node-error-ex)
|
|
2
|
-
> Easily subclass and customize new Error types
|
|
3
|
-
|
|
4
|
-
## Examples
|
|
5
|
-
To include in your project:
|
|
6
|
-
```javascript
|
|
7
|
-
var errorEx = require('error-ex');
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
To create an error message type with a specific name (note, that `ErrorFn.name`
|
|
11
|
-
will not reflect this):
|
|
12
|
-
```javascript
|
|
13
|
-
var JSONError = errorEx('JSONError');
|
|
14
|
-
|
|
15
|
-
var err = new JSONError('error');
|
|
16
|
-
err.name; //-> JSONError
|
|
17
|
-
throw err; //-> JSONError: error
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
To add a stack line:
|
|
21
|
-
```javascript
|
|
22
|
-
var JSONError = errorEx('JSONError', {fileName: errorEx.line('in %s')});
|
|
23
|
-
|
|
24
|
-
var err = new JSONError('error')
|
|
25
|
-
err.fileName = '/a/b/c/foo.json';
|
|
26
|
-
throw err; //-> (line 2)-> in /a/b/c/foo.json
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
To append to the error message:
|
|
30
|
-
```javascript
|
|
31
|
-
var JSONError = errorEx('JSONError', {fileName: errorEx.append('in %s')});
|
|
32
|
-
|
|
33
|
-
var err = new JSONError('error');
|
|
34
|
-
err.fileName = '/a/b/c/foo.json';
|
|
35
|
-
throw err; //-> JSONError: error in /a/b/c/foo.json
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## API
|
|
39
|
-
|
|
40
|
-
#### `errorEx([name], [properties])`
|
|
41
|
-
Creates a new ErrorEx error type
|
|
42
|
-
|
|
43
|
-
- `name`: the name of the new type (appears in the error message upon throw;
|
|
44
|
-
defaults to `Error.name`)
|
|
45
|
-
- `properties`: if supplied, used as a key/value dictionary of properties to
|
|
46
|
-
use when building up the stack message. Keys are property names that are
|
|
47
|
-
looked up on the error message, and then passed to function values.
|
|
48
|
-
- `line`: if specified and is a function, return value is added as a stack
|
|
49
|
-
entry (error-ex will indent for you). Passed the property value given
|
|
50
|
-
the key.
|
|
51
|
-
- `stack`: if specified and is a function, passed the value of the property
|
|
52
|
-
using the key, and the raw stack lines as a second argument. Takes no
|
|
53
|
-
return value (but the stack can be modified directly).
|
|
54
|
-
- `message`: if specified and is a function, return value is used as new
|
|
55
|
-
`.message` value upon get. Passed the property value of the property named
|
|
56
|
-
by key, and the existing message is passed as the second argument as an
|
|
57
|
-
array of lines (suitable for multi-line messages).
|
|
58
|
-
|
|
59
|
-
Returns a constructor (Function) that can be used just like the regular Error
|
|
60
|
-
constructor.
|
|
61
|
-
|
|
62
|
-
```javascript
|
|
63
|
-
var errorEx = require('error-ex');
|
|
64
|
-
|
|
65
|
-
var BasicError = errorEx();
|
|
66
|
-
|
|
67
|
-
var NamedError = errorEx('NamedError');
|
|
68
|
-
|
|
69
|
-
// --
|
|
70
|
-
|
|
71
|
-
var AdvancedError = errorEx('AdvancedError', {
|
|
72
|
-
foo: {
|
|
73
|
-
line: function (value, stack) {
|
|
74
|
-
if (value) {
|
|
75
|
-
return 'bar ' + value;
|
|
76
|
-
}
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
var err = new AdvancedError('hello, world');
|
|
83
|
-
err.foo = 'baz';
|
|
84
|
-
throw err;
|
|
85
|
-
|
|
86
|
-
/*
|
|
87
|
-
AdvancedError: hello, world
|
|
88
|
-
bar baz
|
|
89
|
-
at tryReadme() (readme.js:20:1)
|
|
90
|
-
*/
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
#### `errorEx.line(str)`
|
|
94
|
-
Creates a stack line using a delimiter
|
|
95
|
-
|
|
96
|
-
> This is a helper function. It is to be used in lieu of writing a value object
|
|
97
|
-
> for `properties` values.
|
|
98
|
-
|
|
99
|
-
- `str`: The string to create
|
|
100
|
-
- Use the delimiter `%s` to specify where in the string the value should go
|
|
101
|
-
|
|
102
|
-
```javascript
|
|
103
|
-
var errorEx = require('error-ex');
|
|
104
|
-
|
|
105
|
-
var FileError = errorEx('FileError', {fileName: errorEx.line('in %s')});
|
|
106
|
-
|
|
107
|
-
var err = new FileError('problem reading file');
|
|
108
|
-
err.fileName = '/a/b/c/d/foo.js';
|
|
109
|
-
throw err;
|
|
110
|
-
|
|
111
|
-
/*
|
|
112
|
-
FileError: problem reading file
|
|
113
|
-
in /a/b/c/d/foo.js
|
|
114
|
-
at tryReadme() (readme.js:7:1)
|
|
115
|
-
*/
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
#### `errorEx.append(str)`
|
|
119
|
-
Appends to the `error.message` string
|
|
120
|
-
|
|
121
|
-
> This is a helper function. It is to be used in lieu of writing a value object
|
|
122
|
-
> for `properties` values.
|
|
123
|
-
|
|
124
|
-
- `str`: The string to append
|
|
125
|
-
- Use the delimiter `%s` to specify where in the string the value should go
|
|
126
|
-
|
|
127
|
-
```javascript
|
|
128
|
-
var errorEx = require('error-ex');
|
|
129
|
-
|
|
130
|
-
var SyntaxError = errorEx('SyntaxError', {fileName: errorEx.append('in %s')});
|
|
131
|
-
|
|
132
|
-
var err = new SyntaxError('improper indentation');
|
|
133
|
-
err.fileName = '/a/b/c/d/foo.js';
|
|
134
|
-
throw err;
|
|
135
|
-
|
|
136
|
-
/*
|
|
137
|
-
SyntaxError: improper indentation in /a/b/c/d/foo.js
|
|
138
|
-
at tryReadme() (readme.js:7:1)
|
|
139
|
-
*/
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
## License
|
|
143
|
-
Licensed under the [MIT License](http://opensource.org/licenses/MIT).
|
|
144
|
-
You can find a copy of it in [LICENSE](LICENSE).
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var util = require('util');
|
|
4
|
-
var isArrayish = require('is-arrayish');
|
|
5
|
-
|
|
6
|
-
var errorEx = function errorEx(name, properties) {
|
|
7
|
-
if (!name || name.constructor !== String) {
|
|
8
|
-
properties = name || {};
|
|
9
|
-
name = Error.name;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
var errorExError = function ErrorEXError(message) {
|
|
13
|
-
if (!this) {
|
|
14
|
-
return new ErrorEXError(message);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
message = message instanceof Error
|
|
18
|
-
? message.message
|
|
19
|
-
: (message || this.message);
|
|
20
|
-
|
|
21
|
-
Error.call(this, message);
|
|
22
|
-
Error.captureStackTrace(this, errorExError);
|
|
23
|
-
|
|
24
|
-
this.name = name;
|
|
25
|
-
|
|
26
|
-
Object.defineProperty(this, 'message', {
|
|
27
|
-
configurable: true,
|
|
28
|
-
enumerable: false,
|
|
29
|
-
get: function () {
|
|
30
|
-
var newMessage = message.split(/\r?\n/g);
|
|
31
|
-
|
|
32
|
-
for (var key in properties) {
|
|
33
|
-
if (!properties.hasOwnProperty(key)) {
|
|
34
|
-
continue;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
var modifier = properties[key];
|
|
38
|
-
|
|
39
|
-
if ('message' in modifier) {
|
|
40
|
-
newMessage = modifier.message(this[key], newMessage) || newMessage;
|
|
41
|
-
if (!isArrayish(newMessage)) {
|
|
42
|
-
newMessage = [newMessage];
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return newMessage.join('\n');
|
|
48
|
-
},
|
|
49
|
-
set: function (v) {
|
|
50
|
-
message = v;
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
var overwrittenStack = null;
|
|
55
|
-
|
|
56
|
-
var stackDescriptor = Object.getOwnPropertyDescriptor(this, 'stack');
|
|
57
|
-
var stackGetter = stackDescriptor.get;
|
|
58
|
-
var stackValue = stackDescriptor.value;
|
|
59
|
-
delete stackDescriptor.value;
|
|
60
|
-
delete stackDescriptor.writable;
|
|
61
|
-
|
|
62
|
-
stackDescriptor.set = function (newstack) {
|
|
63
|
-
overwrittenStack = newstack;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
stackDescriptor.get = function () {
|
|
67
|
-
var stack = (overwrittenStack || ((stackGetter)
|
|
68
|
-
? stackGetter.call(this)
|
|
69
|
-
: stackValue)).split(/\r?\n+/g);
|
|
70
|
-
|
|
71
|
-
// starting in Node 7, the stack builder caches the message.
|
|
72
|
-
// just replace it.
|
|
73
|
-
if (!overwrittenStack) {
|
|
74
|
-
stack[0] = this.name + ': ' + this.message;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
var lineCount = 1;
|
|
78
|
-
for (var key in properties) {
|
|
79
|
-
if (!properties.hasOwnProperty(key)) {
|
|
80
|
-
continue;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
var modifier = properties[key];
|
|
84
|
-
|
|
85
|
-
if ('line' in modifier) {
|
|
86
|
-
var line = modifier.line(this[key]);
|
|
87
|
-
if (line) {
|
|
88
|
-
stack.splice(lineCount++, 0, ' ' + line);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if ('stack' in modifier) {
|
|
93
|
-
modifier.stack(this[key], stack);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return stack.join('\n');
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
Object.defineProperty(this, 'stack', stackDescriptor);
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
if (Object.setPrototypeOf) {
|
|
104
|
-
Object.setPrototypeOf(errorExError.prototype, Error.prototype);
|
|
105
|
-
Object.setPrototypeOf(errorExError, Error);
|
|
106
|
-
} else {
|
|
107
|
-
util.inherits(errorExError, Error);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return errorExError;
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
errorEx.append = function (str, def) {
|
|
114
|
-
return {
|
|
115
|
-
message: function (v, message) {
|
|
116
|
-
v = v || def;
|
|
117
|
-
|
|
118
|
-
if (v) {
|
|
119
|
-
message[0] += ' ' + str.replace('%s', v.toString());
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return message;
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
errorEx.line = function (str, def) {
|
|
128
|
-
return {
|
|
129
|
-
line: function (v) {
|
|
130
|
-
v = v || def;
|
|
131
|
-
|
|
132
|
-
if (v) {
|
|
133
|
-
return str.replace('%s', v.toString());
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return null;
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
module.exports = errorEx;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "error-ex",
|
|
3
|
-
"description": "Easy error subclassing and stack customization",
|
|
4
|
-
"version": "1.3.4",
|
|
5
|
-
"maintainers": [
|
|
6
|
-
"Josh Junon <i.am.qix@gmail.com> (github.com/qix-)",
|
|
7
|
-
"Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)"
|
|
8
|
-
],
|
|
9
|
-
"keywords": [
|
|
10
|
-
"error",
|
|
11
|
-
"errors",
|
|
12
|
-
"extend",
|
|
13
|
-
"extending",
|
|
14
|
-
"extension",
|
|
15
|
-
"subclass",
|
|
16
|
-
"stack",
|
|
17
|
-
"custom"
|
|
18
|
-
],
|
|
19
|
-
"license": "MIT",
|
|
20
|
-
"scripts": {
|
|
21
|
-
"pretest": "xo",
|
|
22
|
-
"test": "mocha --compilers coffee:coffee-script/register"
|
|
23
|
-
},
|
|
24
|
-
"xo": {
|
|
25
|
-
"rules": {
|
|
26
|
-
"operator-linebreak": [
|
|
27
|
-
0
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
"repository": "qix-/node-error-ex",
|
|
32
|
-
"files": [
|
|
33
|
-
"index.js"
|
|
34
|
-
],
|
|
35
|
-
"devDependencies": {
|
|
36
|
-
"coffee-script": "^1.9.3",
|
|
37
|
-
"coveralls": "^2.11.2",
|
|
38
|
-
"istanbul": "^0.3.17",
|
|
39
|
-
"mocha": "^2.2.5",
|
|
40
|
-
"should": "^7.0.1",
|
|
41
|
-
"xo": "^0.7.1"
|
|
42
|
-
},
|
|
43
|
-
"dependencies": {
|
|
44
|
-
"is-arrayish": "^0.2.1"
|
|
45
|
-
}
|
|
46
|
-
}
|