@villedemontreal/caporal 3.1.7
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/LICENSE +21 -0
- package/README.md +29 -0
- package/dist/src/__tests__/issue-163.spec.d.ts +2 -0
- package/dist/src/__tests__/issue-163.spec.d.ts.map +1 -0
- package/dist/src/__tests__/issue-163.spec.js +17 -0
- package/dist/src/__tests__/issue-163.spec.js.map +1 -0
- package/dist/src/argument/__tests__/argument.spec.d.ts +2 -0
- package/dist/src/argument/__tests__/argument.spec.d.ts.map +1 -0
- package/dist/src/argument/__tests__/argument.spec.js +85 -0
- package/dist/src/argument/__tests__/argument.spec.js.map +1 -0
- package/dist/src/argument/find.d.ts +8 -0
- package/dist/src/argument/find.d.ts.map +1 -0
- package/dist/src/argument/find.js +11 -0
- package/dist/src/argument/find.js.map +1 -0
- package/dist/src/argument/index.d.ts +13 -0
- package/dist/src/argument/index.d.ts.map +1 -0
- package/dist/src/argument/index.js +27 -0
- package/dist/src/argument/index.js.map +1 -0
- package/dist/src/argument/synopsis.d.ts +19 -0
- package/dist/src/argument/synopsis.d.ts.map +1 -0
- package/dist/src/argument/synopsis.js +39 -0
- package/dist/src/argument/synopsis.js.map +1 -0
- package/dist/src/argument/validate.d.ts +43 -0
- package/dist/src/argument/validate.d.ts.map +1 -0
- package/dist/src/argument/validate.js +127 -0
- package/dist/src/argument/validate.js.map +1 -0
- package/dist/src/autocomplete/__fixtures__/prog-autocomplete.d.ts +3 -0
- package/dist/src/autocomplete/__fixtures__/prog-autocomplete.d.ts.map +1 -0
- package/dist/src/autocomplete/__fixtures__/prog-autocomplete.js +24 -0
- package/dist/src/autocomplete/__fixtures__/prog-autocomplete.js.map +1 -0
- package/dist/src/autocomplete/__tests__/autocomplete.spec.d.ts +2 -0
- package/dist/src/autocomplete/__tests__/autocomplete.spec.d.ts.map +1 -0
- package/dist/src/autocomplete/__tests__/autocomplete.spec.js +119 -0
- package/dist/src/autocomplete/__tests__/autocomplete.spec.js.map +1 -0
- package/dist/src/autocomplete/index.d.ts +20 -0
- package/dist/src/autocomplete/index.d.ts.map +1 -0
- package/dist/src/autocomplete/index.js +172 -0
- package/dist/src/autocomplete/index.js.map +1 -0
- package/dist/src/autocomplete/types.d.ts +26 -0
- package/dist/src/autocomplete/types.d.ts.map +1 -0
- package/dist/src/autocomplete/types.js +3 -0
- package/dist/src/autocomplete/types.js.map +1 -0
- package/dist/src/command/__fixtures__/example-cmd.d.ts +8 -0
- package/dist/src/command/__fixtures__/example-cmd.d.ts.map +1 -0
- package/dist/src/command/__fixtures__/example-cmd.js +10 -0
- package/dist/src/command/__fixtures__/example-cmd.js.map +1 -0
- package/dist/src/command/__tests__/command.spec.d.ts +2 -0
- package/dist/src/command/__tests__/command.spec.d.ts.map +1 -0
- package/dist/src/command/__tests__/command.spec.js +510 -0
- package/dist/src/command/__tests__/command.spec.js.map +1 -0
- package/dist/src/command/__tests__/find.spec.d.ts +2 -0
- package/dist/src/command/__tests__/find.spec.d.ts.map +1 -0
- package/dist/src/command/__tests__/find.spec.js +31 -0
- package/dist/src/command/__tests__/find.spec.js.map +1 -0
- package/dist/src/command/__tests__/import.spec.d.ts +2 -0
- package/dist/src/command/__tests__/import.spec.d.ts.map +1 -0
- package/dist/src/command/__tests__/import.spec.js +17 -0
- package/dist/src/command/__tests__/import.spec.js.map +1 -0
- package/dist/src/command/__tests__/scan.spec.d.ts +2 -0
- package/dist/src/command/__tests__/scan.spec.d.ts.map +1 -0
- package/dist/src/command/__tests__/scan.spec.js +20 -0
- package/dist/src/command/__tests__/scan.spec.js.map +1 -0
- package/dist/src/command/find.d.ts +8 -0
- package/dist/src/command/find.d.ts.map +1 -0
- package/dist/src/command/find.js +47 -0
- package/dist/src/command/find.js.map +1 -0
- package/dist/src/command/import.d.ts +7 -0
- package/dist/src/command/import.d.ts.map +1 -0
- package/dist/src/command/import.js +47 -0
- package/dist/src/command/import.js.map +1 -0
- package/dist/src/command/index.d.ts +211 -0
- package/dist/src/command/index.d.ts.map +1 -0
- package/dist/src/command/index.js +374 -0
- package/dist/src/command/index.js.map +1 -0
- package/dist/src/command/scan.d.ts +4 -0
- package/dist/src/command/scan.d.ts.map +1 -0
- package/dist/src/command/scan.js +31 -0
- package/dist/src/command/scan.js.map +1 -0
- package/dist/src/command/validate-call.d.ts +8 -0
- package/dist/src/command/validate-call.d.ts.map +1 -0
- package/dist/src/command/validate-call.js +13 -0
- package/dist/src/command/validate-call.js.map +1 -0
- package/dist/src/config/index.d.ts +7 -0
- package/dist/src/config/index.d.ts.map +1 -0
- package/dist/src/config/index.js +24 -0
- package/dist/src/config/index.js.map +1 -0
- package/dist/src/error/__tests__/fatal.spec.d.ts +2 -0
- package/dist/src/error/__tests__/fatal.spec.d.ts.map +1 -0
- package/dist/src/error/__tests__/fatal.spec.js +34 -0
- package/dist/src/error/__tests__/fatal.spec.js.map +1 -0
- package/dist/src/error/action.d.ts +9 -0
- package/dist/src/error/action.d.ts.map +1 -0
- package/dist/src/error/action.js +16 -0
- package/dist/src/error/action.js.map +1 -0
- package/dist/src/error/base.d.ts +11 -0
- package/dist/src/error/base.d.ts.map +1 -0
- package/dist/src/error/base.js +18 -0
- package/dist/src/error/base.js.map +1 -0
- package/dist/src/error/fatal.d.ts +10 -0
- package/dist/src/error/fatal.d.ts.map +1 -0
- package/dist/src/error/fatal.js +27 -0
- package/dist/src/error/fatal.js.map +1 -0
- package/dist/src/error/index.d.ts +18 -0
- package/dist/src/error/index.d.ts.map +1 -0
- package/dist/src/error/index.js +34 -0
- package/dist/src/error/index.js.map +1 -0
- package/dist/src/error/invalid-validator.d.ts +10 -0
- package/dist/src/error/invalid-validator.d.ts.map +1 -0
- package/dist/src/error/invalid-validator.js +15 -0
- package/dist/src/error/invalid-validator.js.map +1 -0
- package/dist/src/error/missing-argument.d.ts +11 -0
- package/dist/src/error/missing-argument.d.ts.map +1 -0
- package/dist/src/error/missing-argument.js +20 -0
- package/dist/src/error/missing-argument.js.map +1 -0
- package/dist/src/error/missing-flag.d.ts +11 -0
- package/dist/src/error/missing-flag.d.ts.map +1 -0
- package/dist/src/error/missing-flag.js +20 -0
- package/dist/src/error/missing-flag.js.map +1 -0
- package/dist/src/error/multi-validation.d.ts +10 -0
- package/dist/src/error/multi-validation.d.ts.map +1 -0
- package/dist/src/error/multi-validation.js +26 -0
- package/dist/src/error/multi-validation.js.map +1 -0
- package/dist/src/error/no-action.d.ts +10 -0
- package/dist/src/error/no-action.d.ts.map +1 -0
- package/dist/src/error/no-action.js +22 -0
- package/dist/src/error/no-action.js.map +1 -0
- package/dist/src/error/option-synopsis-syntax.d.ts +9 -0
- package/dist/src/error/option-synopsis-syntax.d.ts.map +1 -0
- package/dist/src/error/option-synopsis-syntax.js +15 -0
- package/dist/src/error/option-synopsis-syntax.js.map +1 -0
- package/dist/src/error/too-many-arguments.d.ts +11 -0
- package/dist/src/error/too-many-arguments.d.ts.map +1 -0
- package/dist/src/error/too-many-arguments.js +25 -0
- package/dist/src/error/too-many-arguments.js.map +1 -0
- package/dist/src/error/unknown-command.d.ts +13 -0
- package/dist/src/error/unknown-command.d.ts.map +1 -0
- package/dist/src/error/unknown-command.js +44 -0
- package/dist/src/error/unknown-command.js.map +1 -0
- package/dist/src/error/unknown-option.d.ts +13 -0
- package/dist/src/error/unknown-option.d.ts.map +1 -0
- package/dist/src/error/unknown-option.js +40 -0
- package/dist/src/error/unknown-option.js.map +1 -0
- package/dist/src/error/validation.d.ts +17 -0
- package/dist/src/error/validation.d.ts.map +1 -0
- package/dist/src/error/validation.js +49 -0
- package/dist/src/error/validation.js.map +1 -0
- package/dist/src/help/__tests__/help.spec.d.ts +2 -0
- package/dist/src/help/__tests__/help.spec.d.ts.map +1 -0
- package/dist/src/help/__tests__/help.spec.js +130 -0
- package/dist/src/help/__tests__/help.spec.js.map +1 -0
- package/dist/src/help/__tests__/utils.spec.d.ts +2 -0
- package/dist/src/help/__tests__/utils.spec.d.ts.map +1 -0
- package/dist/src/help/__tests__/utils.spec.js +16 -0
- package/dist/src/help/__tests__/utils.spec.js.map +1 -0
- package/dist/src/help/index.d.ts +47 -0
- package/dist/src/help/index.d.ts.map +1 -0
- package/dist/src/help/index.js +131 -0
- package/dist/src/help/index.js.map +1 -0
- package/dist/src/help/templates/command.d.ts +7 -0
- package/dist/src/help/templates/command.d.ts.map +1 -0
- package/dist/src/help/templates/command.js +23 -0
- package/dist/src/help/templates/command.js.map +1 -0
- package/dist/src/help/templates/custom.d.ts +7 -0
- package/dist/src/help/templates/custom.d.ts.map +1 -0
- package/dist/src/help/templates/custom.js +24 -0
- package/dist/src/help/templates/custom.js.map +1 -0
- package/dist/src/help/templates/header.d.ts +7 -0
- package/dist/src/help/templates/header.d.ts.map +1 -0
- package/dist/src/help/templates/header.js +16 -0
- package/dist/src/help/templates/header.js.map +1 -0
- package/dist/src/help/templates/index.d.ts +10 -0
- package/dist/src/help/templates/index.d.ts.map +1 -0
- package/dist/src/help/templates/index.js +26 -0
- package/dist/src/help/templates/index.js.map +1 -0
- package/dist/src/help/templates/program.d.ts +7 -0
- package/dist/src/help/templates/program.d.ts.map +1 -0
- package/dist/src/help/templates/program.js +18 -0
- package/dist/src/help/templates/program.js.map +1 -0
- package/dist/src/help/templates/usage.d.ts +7 -0
- package/dist/src/help/templates/usage.d.ts.map +1 -0
- package/dist/src/help/templates/usage.js +19 -0
- package/dist/src/help/templates/usage.js.map +1 -0
- package/dist/src/help/types.d.ts +53 -0
- package/dist/src/help/types.d.ts.map +1 -0
- package/dist/src/help/types.js +3 -0
- package/dist/src/help/types.js.map +1 -0
- package/dist/src/help/utils.d.ts +9 -0
- package/dist/src/help/utils.d.ts.map +1 -0
- package/dist/src/help/utils.js +92 -0
- package/dist/src/help/utils.js.map +1 -0
- package/dist/src/index.d.ts +90 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +111 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/logger/__tests__/logger.spec.d.ts +2 -0
- package/dist/src/logger/__tests__/logger.spec.d.ts.map +1 -0
- package/dist/src/logger/__tests__/logger.spec.js +56 -0
- package/dist/src/logger/__tests__/logger.spec.js.map +1 -0
- package/dist/src/logger/index.d.ts +6 -0
- package/dist/src/logger/index.d.ts.map +1 -0
- package/dist/src/logger/index.js +128 -0
- package/dist/src/logger/index.js.map +1 -0
- package/dist/src/option/__tests__/global.spec.d.ts +2 -0
- package/dist/src/option/__tests__/global.spec.d.ts.map +1 -0
- package/dist/src/option/__tests__/global.spec.js +121 -0
- package/dist/src/option/__tests__/global.spec.js.map +1 -0
- package/dist/src/option/__tests__/option.spec.d.ts +2 -0
- package/dist/src/option/__tests__/option.spec.d.ts.map +1 -0
- package/dist/src/option/__tests__/option.spec.js +111 -0
- package/dist/src/option/__tests__/option.spec.js.map +1 -0
- package/dist/src/option/find.d.ts +14 -0
- package/dist/src/option/find.d.ts.map +1 -0
- package/dist/src/option/find.js +17 -0
- package/dist/src/option/find.js.map +1 -0
- package/dist/src/option/index.d.ts +65 -0
- package/dist/src/option/index.d.ts.map +1 -0
- package/dist/src/option/index.js +230 -0
- package/dist/src/option/index.js.map +1 -0
- package/dist/src/option/mapping.d.ts +7 -0
- package/dist/src/option/mapping.d.ts.map +1 -0
- package/dist/src/option/mapping.js +21 -0
- package/dist/src/option/mapping.js.map +1 -0
- package/dist/src/option/utils.d.ts +35 -0
- package/dist/src/option/utils.d.ts.map +1 -0
- package/dist/src/option/utils.js +139 -0
- package/dist/src/option/utils.js.map +1 -0
- package/dist/src/option/validate.d.ts +15 -0
- package/dist/src/option/validate.d.ts.map +1 -0
- package/dist/src/option/validate.js +63 -0
- package/dist/src/option/validate.js.map +1 -0
- package/dist/src/parser/__tests__/parser.spec.d.ts +2 -0
- package/dist/src/parser/__tests__/parser.spec.d.ts.map +1 -0
- package/dist/src/parser/__tests__/parser.spec.js +343 -0
- package/dist/src/parser/__tests__/parser.spec.js.map +1 -0
- package/dist/src/parser/index.d.ts +17 -0
- package/dist/src/parser/index.d.ts.map +1 -0
- package/dist/src/parser/index.js +299 -0
- package/dist/src/parser/index.js.map +1 -0
- package/dist/src/program/__tests__/program.spec.d.ts +2 -0
- package/dist/src/program/__tests__/program.spec.d.ts.map +1 -0
- package/dist/src/program/__tests__/program.spec.js +261 -0
- package/dist/src/program/__tests__/program.spec.js.map +1 -0
- package/dist/src/program/index.d.ts +349 -0
- package/dist/src/program/index.d.ts.map +1 -0
- package/dist/src/program/index.js +584 -0
- package/dist/src/program/index.js.map +1 -0
- package/dist/src/types.d.ts +396 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +51 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/utils/__tests__/fs.spec.d.ts +2 -0
- package/dist/src/utils/__tests__/fs.spec.d.ts.map +1 -0
- package/dist/src/utils/__tests__/fs.spec.js +14 -0
- package/dist/src/utils/__tests__/fs.spec.js.map +1 -0
- package/dist/src/utils/__tests__/levenshtein.spec.d.ts +2 -0
- package/dist/src/utils/__tests__/levenshtein.spec.d.ts.map +1 -0
- package/dist/src/utils/__tests__/levenshtein.spec.js +18 -0
- package/dist/src/utils/__tests__/levenshtein.spec.js.map +1 -0
- package/dist/src/utils/__tests__/suggest.spec.d.ts +2 -0
- package/dist/src/utils/__tests__/suggest.spec.d.ts.map +1 -0
- package/dist/src/utils/__tests__/suggest.spec.js +31 -0
- package/dist/src/utils/__tests__/suggest.spec.js.map +1 -0
- package/dist/src/utils/colorize.d.ts +2 -0
- package/dist/src/utils/colorize.d.ts.map +1 -0
- package/dist/src/utils/colorize.js +27 -0
- package/dist/src/utils/colorize.js.map +1 -0
- package/dist/src/utils/fs.d.ts +2 -0
- package/dist/src/utils/fs.d.ts.map +1 -0
- package/dist/src/utils/fs.js +19 -0
- package/dist/src/utils/fs.js.map +1 -0
- package/dist/src/utils/levenshtein.d.ts +6 -0
- package/dist/src/utils/levenshtein.d.ts.map +1 -0
- package/dist/src/utils/levenshtein.js +32 -0
- package/dist/src/utils/levenshtein.js.map +1 -0
- package/dist/src/utils/suggest.d.ts +15 -0
- package/dist/src/utils/suggest.d.ts.map +1 -0
- package/dist/src/utils/suggest.js +49 -0
- package/dist/src/utils/suggest.js.map +1 -0
- package/dist/src/utils/version.d.ts +2 -0
- package/dist/src/utils/version.d.ts.map +1 -0
- package/dist/src/utils/version.js +21 -0
- package/dist/src/utils/version.js.map +1 -0
- package/dist/src/utils/web/autocomplete.d.ts +12 -0
- package/dist/src/utils/web/autocomplete.d.ts.map +1 -0
- package/dist/src/utils/web/autocomplete.js +12 -0
- package/dist/src/utils/web/autocomplete.js.map +1 -0
- package/dist/src/utils/web/process.d.ts +15 -0
- package/dist/src/utils/web/process.d.ts.map +1 -0
- package/dist/src/utils/web/process.js +29 -0
- package/dist/src/utils/web/process.js.map +1 -0
- package/dist/src/validator/__tests__/array.spec.d.ts +2 -0
- package/dist/src/validator/__tests__/array.spec.d.ts.map +1 -0
- package/dist/src/validator/__tests__/array.spec.js +34 -0
- package/dist/src/validator/__tests__/array.spec.js.map +1 -0
- package/dist/src/validator/__tests__/caporal.spec.d.ts +2 -0
- package/dist/src/validator/__tests__/caporal.spec.d.ts.map +1 -0
- package/dist/src/validator/__tests__/caporal.spec.js +86 -0
- package/dist/src/validator/__tests__/caporal.spec.js.map +1 -0
- package/dist/src/validator/__tests__/function.spec.d.ts +2 -0
- package/dist/src/validator/__tests__/function.spec.d.ts.map +1 -0
- package/dist/src/validator/__tests__/function.spec.js +42 -0
- package/dist/src/validator/__tests__/function.spec.js.map +1 -0
- package/dist/src/validator/__tests__/regexp.spec.d.ts +2 -0
- package/dist/src/validator/__tests__/regexp.spec.d.ts.map +1 -0
- package/dist/src/validator/__tests__/regexp.spec.js +34 -0
- package/dist/src/validator/__tests__/regexp.spec.js.map +1 -0
- package/dist/src/validator/__tests__/utils.spec.d.ts +2 -0
- package/dist/src/validator/__tests__/utils.spec.d.ts.map +1 -0
- package/dist/src/validator/__tests__/utils.spec.js +66 -0
- package/dist/src/validator/__tests__/utils.spec.js.map +1 -0
- package/dist/src/validator/__tests__/validate.spec.d.ts +2 -0
- package/dist/src/validator/__tests__/validate.spec.d.ts.map +1 -0
- package/dist/src/validator/__tests__/validate.spec.js +25 -0
- package/dist/src/validator/__tests__/validate.spec.js.map +1 -0
- package/dist/src/validator/array.d.ts +14 -0
- package/dist/src/validator/array.d.ts.map +1 -0
- package/dist/src/validator/array.js +29 -0
- package/dist/src/validator/array.js.map +1 -0
- package/dist/src/validator/caporal.d.ts +25 -0
- package/dist/src/validator/caporal.d.ts.map +1 -0
- package/dist/src/validator/caporal.js +89 -0
- package/dist/src/validator/caporal.js.map +1 -0
- package/dist/src/validator/function.d.ts +7 -0
- package/dist/src/validator/function.d.ts.map +1 -0
- package/dist/src/validator/function.js +27 -0
- package/dist/src/validator/function.js.map +1 -0
- package/dist/src/validator/regexp.d.ts +14 -0
- package/dist/src/validator/regexp.d.ts.map +1 -0
- package/dist/src/validator/regexp.js +31 -0
- package/dist/src/validator/regexp.js.map +1 -0
- package/dist/src/validator/utils.d.ts +14 -0
- package/dist/src/validator/utils.d.ts.map +1 -0
- package/dist/src/validator/utils.js +81 -0
- package/dist/src/validator/utils.js.map +1 -0
- package/dist/src/validator/validate.d.ts +7 -0
- package/dist/src/validator/validate.d.ts.map +1 -0
- package/dist/src/validator/validate.js +29 -0
- package/dist/src/validator/validate.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +75 -0
- package/src/__tests__/issue-163.spec.ts +18 -0
- package/src/argument/__tests__/argument.spec.ts +84 -0
- package/src/argument/find.ts +11 -0
- package/src/argument/index.ts +35 -0
- package/src/argument/synopsis.ts +41 -0
- package/src/argument/validate.ts +176 -0
- package/src/autocomplete/__fixtures__/prog-autocomplete.ts +24 -0
- package/src/autocomplete/__tests__/autocomplete.spec.ts +129 -0
- package/src/autocomplete/index.ts +225 -0
- package/src/autocomplete/types.ts +29 -0
- package/src/command/__fixtures__/example-cmd.ts +14 -0
- package/src/command/__tests__/command.spec.ts +621 -0
- package/src/command/__tests__/find.spec.ts +32 -0
- package/src/command/__tests__/import.spec.ts +14 -0
- package/src/command/__tests__/scan.spec.ts +16 -0
- package/src/command/find.ts +57 -0
- package/src/command/import.ts +13 -0
- package/src/command/index.ts +458 -0
- package/src/command/scan.ts +30 -0
- package/src/command/validate-call.ts +19 -0
- package/src/config/index.ts +26 -0
- package/src/error/__tests__/fatal.spec.ts +38 -0
- package/src/error/action.ts +13 -0
- package/src/error/base.ts +20 -0
- package/src/error/fatal.ts +25 -0
- package/src/error/index.ts +17 -0
- package/src/error/invalid-validator.ts +12 -0
- package/src/error/missing-argument.ts +16 -0
- package/src/error/missing-flag.ts +16 -0
- package/src/error/multi-validation.ts +22 -0
- package/src/error/no-action.ts +19 -0
- package/src/error/option-synopsis-syntax.ts +12 -0
- package/src/error/too-many-arguments.ts +28 -0
- package/src/error/unknown-command.ts +41 -0
- package/src/error/unknown-option.ts +40 -0
- package/src/error/validation.ts +80 -0
- package/src/help/__tests__/__snapshots__/help.spec.ts.snap +334 -0
- package/src/help/__tests__/help.spec.ts +144 -0
- package/src/help/__tests__/utils.spec.ts +14 -0
- package/src/help/index.ts +107 -0
- package/src/help/templates/command.ts +27 -0
- package/src/help/templates/custom.ts +25 -0
- package/src/help/templates/header.ts +19 -0
- package/src/help/templates/index.ts +9 -0
- package/src/help/templates/program.ts +21 -0
- package/src/help/templates/usage.ts +24 -0
- package/src/help/types.ts +57 -0
- package/src/help/utils.ts +109 -0
- package/src/index.ts +93 -0
- package/src/logger/__tests__/logger.spec.ts +65 -0
- package/src/logger/index.ts +97 -0
- package/src/option/__tests__/global.spec.ts +141 -0
- package/src/option/__tests__/option.spec.ts +115 -0
- package/src/option/find.ts +17 -0
- package/src/option/index.ts +280 -0
- package/src/option/mapping.ts +17 -0
- package/src/option/utils.ts +141 -0
- package/src/option/validate.ts +80 -0
- package/src/parser/__tests__/parser.spec.ts +371 -0
- package/src/parser/index.ts +383 -0
- package/src/program/__tests__/program.spec.ts +316 -0
- package/src/program/index.ts +676 -0
- package/src/types.ts +432 -0
- package/src/utils/__tests__/fs.spec.ts +14 -0
- package/src/utils/__tests__/levenshtein.spec.ts +16 -0
- package/src/utils/__tests__/suggest.spec.ts +30 -0
- package/src/utils/colorize.ts +21 -0
- package/src/utils/fs.ts +13 -0
- package/src/utils/levenshtein.ts +28 -0
- package/src/utils/suggest.ts +52 -0
- package/src/utils/version.ts +14 -0
- package/src/utils/web/autocomplete.ts +19 -0
- package/src/utils/web/process.ts +24 -0
- package/src/validator/__tests__/array.spec.ts +41 -0
- package/src/validator/__tests__/caporal.spec.ts +132 -0
- package/src/validator/__tests__/function.spec.ts +52 -0
- package/src/validator/__tests__/regexp.spec.ts +38 -0
- package/src/validator/__tests__/utils.spec.ts +67 -0
- package/src/validator/__tests__/validate.spec.ts +24 -0
- package/src/validator/array.ts +31 -0
- package/src/validator/caporal.ts +104 -0
- package/src/validator/function.ts +31 -0
- package/src/validator/regexp.ts +34 -0
- package/src/validator/utils.ts +84 -0
- package/src/validator/validate.ts +38 -0
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Command = exports.HELP_CMD = exports.PROG_CMD = void 0;
|
|
4
|
+
exports.createCommand = createCommand;
|
|
5
|
+
/**
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
* @module caporal/command
|
|
8
|
+
*/
|
|
9
|
+
const validate_call_1 = require("./validate-call");
|
|
10
|
+
const logger_1 = require("../logger");
|
|
11
|
+
const argument_1 = require("../argument");
|
|
12
|
+
const option_1 = require("../option");
|
|
13
|
+
const autocomplete_1 = require("../autocomplete");
|
|
14
|
+
const mapping_1 = require("../option/mapping");
|
|
15
|
+
const utils_1 = require("../validator/utils");
|
|
16
|
+
const error_1 = require("../error");
|
|
17
|
+
const help_1 = require("../help");
|
|
18
|
+
const config_1 = require("../config");
|
|
19
|
+
/**
|
|
20
|
+
* @ignore
|
|
21
|
+
*/
|
|
22
|
+
exports.PROG_CMD = "__self_cmd";
|
|
23
|
+
/**
|
|
24
|
+
* @ignore
|
|
25
|
+
*/
|
|
26
|
+
exports.HELP_CMD = "help";
|
|
27
|
+
/**
|
|
28
|
+
* Command class
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
class Command {
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* @param program
|
|
35
|
+
* @param name
|
|
36
|
+
* @param description
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
constructor(program, name, description, config = {}) {
|
|
40
|
+
this._aliases = [];
|
|
41
|
+
/**
|
|
42
|
+
* Command options array
|
|
43
|
+
*
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
this.options = [];
|
|
47
|
+
/**
|
|
48
|
+
* Command arguments array
|
|
49
|
+
*
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
this.args = [];
|
|
53
|
+
this.program = program;
|
|
54
|
+
this._name = name;
|
|
55
|
+
this.description = description;
|
|
56
|
+
this._config = (0, config_1.createConfigurator)({ visible: true, ...config });
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Add one or more aliases so the command can be called by different names.
|
|
60
|
+
*
|
|
61
|
+
* @param aliases Command aliases
|
|
62
|
+
*/
|
|
63
|
+
alias(...aliases) {
|
|
64
|
+
this._aliases.push(...aliases);
|
|
65
|
+
return this;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Name getter. Will return an empty string in the program-command context
|
|
69
|
+
*
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
get name() {
|
|
73
|
+
return this.isProgramCommand() ? "" : this._name;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Add an argument to the command.
|
|
77
|
+
* Synopsis is a string like `<my-argument>` or `[my-argument]`.
|
|
78
|
+
* Angled brackets (e.g. `<item>`) indicate required input. Square brackets (e.g. `[env]`) indicate optional input.
|
|
79
|
+
*
|
|
80
|
+
* Returns the {@link Command} object to facilitate chaining of methods.
|
|
81
|
+
*
|
|
82
|
+
* @param synopsis Argument synopsis.
|
|
83
|
+
* @param description - Argument description.
|
|
84
|
+
* @param [options] - Optional parameters including validator and default value.
|
|
85
|
+
*/
|
|
86
|
+
argument(synopsis, description, options = {}) {
|
|
87
|
+
this._lastAddedArgOrOpt = (0, argument_1.createArgument)(synopsis, description, options);
|
|
88
|
+
this.args.push(this._lastAddedArgOrOpt);
|
|
89
|
+
return this;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Set the corresponding action to execute for this command
|
|
93
|
+
*
|
|
94
|
+
* @param action Action to execute
|
|
95
|
+
*/
|
|
96
|
+
action(action) {
|
|
97
|
+
this._action = action;
|
|
98
|
+
return this;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Allow chaining command() calls. See {@link Program.command}.
|
|
102
|
+
*
|
|
103
|
+
*/
|
|
104
|
+
command(name, description, config = {}) {
|
|
105
|
+
return this.program.command(name, description, config);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Makes the command the default one for the program.
|
|
109
|
+
*/
|
|
110
|
+
default() {
|
|
111
|
+
this.program.defaultCommand = this;
|
|
112
|
+
return this;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Checks if the command has the given alias registered.
|
|
116
|
+
*
|
|
117
|
+
* @param alias
|
|
118
|
+
* @internal
|
|
119
|
+
*/
|
|
120
|
+
hasAlias(alias) {
|
|
121
|
+
return this._aliases.includes(alias);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Get command aliases.
|
|
125
|
+
* @internal
|
|
126
|
+
*/
|
|
127
|
+
getAliases() {
|
|
128
|
+
return this._aliases;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* @internal
|
|
132
|
+
*/
|
|
133
|
+
isProgramCommand() {
|
|
134
|
+
return this._name === exports.PROG_CMD;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* @internal
|
|
138
|
+
*/
|
|
139
|
+
isHelpCommand() {
|
|
140
|
+
return this._name === exports.HELP_CMD;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Hide the command from help.
|
|
144
|
+
* Shortcut to calling `.configure({ visible: false })`.
|
|
145
|
+
*/
|
|
146
|
+
hide() {
|
|
147
|
+
return this.configure({ visible: false });
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Add an option to the current command.
|
|
151
|
+
*
|
|
152
|
+
* @param synopsis Option synopsis like '-f, --force', or '-f, --file \<file\>', or '--with-openssl [path]'
|
|
153
|
+
* @param description Option description
|
|
154
|
+
* @param options Additional parameters
|
|
155
|
+
*/
|
|
156
|
+
option(synopsis, description, options = {}) {
|
|
157
|
+
const opt = (this._lastAddedArgOrOpt = (0, option_1.createOption)(synopsis, description, options));
|
|
158
|
+
this.options.push(opt);
|
|
159
|
+
return this;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* @internal
|
|
163
|
+
*/
|
|
164
|
+
getParserConfig() {
|
|
165
|
+
const defaults = {
|
|
166
|
+
boolean: [],
|
|
167
|
+
string: [],
|
|
168
|
+
alias: (0, mapping_1.getOptsMapping)(this),
|
|
169
|
+
autoCast: this.autoCast,
|
|
170
|
+
variadic: [],
|
|
171
|
+
ddash: false,
|
|
172
|
+
};
|
|
173
|
+
let parserOpts = this.options.reduce((parserOpts, opt) => {
|
|
174
|
+
if (opt.boolean) {
|
|
175
|
+
parserOpts.boolean.push(opt.name);
|
|
176
|
+
}
|
|
177
|
+
if ((0, utils_1.isStringValidator)(opt.validator)) {
|
|
178
|
+
parserOpts.string.push(opt.name);
|
|
179
|
+
}
|
|
180
|
+
if (opt.variadic) {
|
|
181
|
+
parserOpts.variadic.push(opt.name);
|
|
182
|
+
}
|
|
183
|
+
return parserOpts;
|
|
184
|
+
}, defaults);
|
|
185
|
+
parserOpts = this.args.reduce((parserOpts, arg, index) => {
|
|
186
|
+
if (!this.isProgramCommand()) {
|
|
187
|
+
index++;
|
|
188
|
+
}
|
|
189
|
+
if ((0, utils_1.isBoolValidator)(arg.validator)) {
|
|
190
|
+
parserOpts.boolean.push(index);
|
|
191
|
+
}
|
|
192
|
+
if ((0, utils_1.isStringValidator)(arg.validator)) {
|
|
193
|
+
parserOpts.string.push(index);
|
|
194
|
+
}
|
|
195
|
+
if (arg.variadic) {
|
|
196
|
+
parserOpts.variadic.push(index);
|
|
197
|
+
}
|
|
198
|
+
return parserOpts;
|
|
199
|
+
}, parserOpts);
|
|
200
|
+
return parserOpts;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Return a reformated synopsis string
|
|
204
|
+
* @internal
|
|
205
|
+
*/
|
|
206
|
+
get synopsis() {
|
|
207
|
+
const opts = this.options.length
|
|
208
|
+
? this.options.some((f) => f.required)
|
|
209
|
+
? "<OPTIONS...>"
|
|
210
|
+
: "[OPTIONS...]"
|
|
211
|
+
: "";
|
|
212
|
+
const name = this._name !== exports.PROG_CMD ? " " + this._name : "";
|
|
213
|
+
return (this.program.getBin() +
|
|
214
|
+
name +
|
|
215
|
+
" " +
|
|
216
|
+
this.args.map((a) => a.synopsis).join(" ") +
|
|
217
|
+
" " +
|
|
218
|
+
opts).trim();
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Customize command help. Can be called multiple times to add more paragraphs and/or sections.
|
|
222
|
+
*
|
|
223
|
+
* @param text Help contents
|
|
224
|
+
* @param options Display options
|
|
225
|
+
*/
|
|
226
|
+
help(text, options = {}) {
|
|
227
|
+
(0, help_1.customizeHelp)(this, text, options);
|
|
228
|
+
return this;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Configure some behavioral properties.
|
|
232
|
+
*
|
|
233
|
+
* @param props properties to set/update
|
|
234
|
+
*/
|
|
235
|
+
configure(props) {
|
|
236
|
+
this._config.set(props);
|
|
237
|
+
return this;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Get a configuration property value.
|
|
241
|
+
*
|
|
242
|
+
* @internal
|
|
243
|
+
* @param key Property key to get value for. See {@link CommandConfig}.
|
|
244
|
+
*/
|
|
245
|
+
getConfigProperty(key) {
|
|
246
|
+
return this._config.get(key);
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Get the auto-casting flag.
|
|
250
|
+
*
|
|
251
|
+
* @internal
|
|
252
|
+
*/
|
|
253
|
+
get autoCast() {
|
|
254
|
+
return (this.getConfigProperty("autoCast") ?? this.program.getConfigProperty("autoCast"));
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Auto-complete
|
|
258
|
+
*/
|
|
259
|
+
complete(completer) {
|
|
260
|
+
if (!this._lastAddedArgOrOpt) {
|
|
261
|
+
throw new Error("Caporal setup error: you should only call `.complete()` after .argument() or .option().");
|
|
262
|
+
}
|
|
263
|
+
(0, autocomplete_1.registerCompletion)(this._lastAddedArgOrOpt, completer);
|
|
264
|
+
return this;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Toggle strict mode.
|
|
268
|
+
* Shortcut to calling: `.configure({ strictArgsCount: strict, strictOptions: strict }).
|
|
269
|
+
* By default, strict settings are not defined for commands, and inherit from the
|
|
270
|
+
* program settings. Calling `.strict(value)` on a command will override the program
|
|
271
|
+
* settings.
|
|
272
|
+
*
|
|
273
|
+
* @param strict boolean enabled flag
|
|
274
|
+
*/
|
|
275
|
+
strict(strict = true) {
|
|
276
|
+
return this.configure({
|
|
277
|
+
strictArgsCount: strict,
|
|
278
|
+
strictOptions: strict,
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Computed strictOptions flag.
|
|
283
|
+
*
|
|
284
|
+
* @internal
|
|
285
|
+
*/
|
|
286
|
+
get strictOptions() {
|
|
287
|
+
return (this.getConfigProperty("strictOptions") ??
|
|
288
|
+
this.program.getConfigProperty("strictOptions"));
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Computed strictArgsCount flag.
|
|
292
|
+
*
|
|
293
|
+
* @internal
|
|
294
|
+
*/
|
|
295
|
+
get strictArgsCount() {
|
|
296
|
+
return (this.getConfigProperty("strictArgsCount") ??
|
|
297
|
+
this.program.getConfigProperty("strictArgsCount"));
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Enable or disable auto casting of arguments & options for the command.
|
|
301
|
+
* This is basically a shortcut to calling `command.configure({ autoCast: enabled })`.
|
|
302
|
+
* By default, auto-casting is inherited from the program configuration.
|
|
303
|
+
* This method allows overriding what's been set on the program level.
|
|
304
|
+
*
|
|
305
|
+
* @param enabled
|
|
306
|
+
*/
|
|
307
|
+
cast(enabled) {
|
|
308
|
+
return this.configure({ autoCast: enabled });
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Visible flag
|
|
312
|
+
*
|
|
313
|
+
* @internal
|
|
314
|
+
*/
|
|
315
|
+
get visible() {
|
|
316
|
+
return this.getConfigProperty("visible");
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Run the action associated with the command
|
|
320
|
+
*
|
|
321
|
+
* @internal
|
|
322
|
+
*/
|
|
323
|
+
async run(parsed) {
|
|
324
|
+
const data = {
|
|
325
|
+
args: [],
|
|
326
|
+
options: {},
|
|
327
|
+
line: "",
|
|
328
|
+
rawOptions: {},
|
|
329
|
+
rawArgv: [],
|
|
330
|
+
ddash: [],
|
|
331
|
+
...parsed,
|
|
332
|
+
};
|
|
333
|
+
try {
|
|
334
|
+
// Validate args and options, including global options
|
|
335
|
+
const result = await (0, validate_call_1.validateCall)(this, data);
|
|
336
|
+
const { args, options, ddash, errors } = result;
|
|
337
|
+
// Process any global options
|
|
338
|
+
const shouldStop = await (0, option_1.processGlobalOptions)(result, this.program, this);
|
|
339
|
+
if (shouldStop) {
|
|
340
|
+
return -1;
|
|
341
|
+
}
|
|
342
|
+
if (errors.length) {
|
|
343
|
+
throw new error_1.ValidationSummaryError(this, errors);
|
|
344
|
+
}
|
|
345
|
+
if (!this._action) {
|
|
346
|
+
throw new error_1.NoActionError(this);
|
|
347
|
+
}
|
|
348
|
+
return await this._action({
|
|
349
|
+
args,
|
|
350
|
+
options,
|
|
351
|
+
ddash,
|
|
352
|
+
logger: logger_1.logger,
|
|
353
|
+
program: this.program,
|
|
354
|
+
command: this,
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
catch (err) {
|
|
358
|
+
const ctor = Object.getPrototypeOf(err).constructor.name;
|
|
359
|
+
throw err instanceof error_1.BaseError && ctor !== "Error"
|
|
360
|
+
? err
|
|
361
|
+
: new error_1.ActionError(err);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
exports.Command = Command;
|
|
366
|
+
/**
|
|
367
|
+
* Create a new command
|
|
368
|
+
*
|
|
369
|
+
* @internal
|
|
370
|
+
*/
|
|
371
|
+
function createCommand(...args) {
|
|
372
|
+
return new Command(...args);
|
|
373
|
+
}
|
|
374
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/command/index.ts"],"names":[],"mappings":";;;AAqcA,sCAIC;AAzcD;;;GAGG;AACH,mDAA8C;AAC9C,sCAAkC;AAClC,0CAA4C;AAC5C,sCAA8D;AAC9D,kDAAoD;AAEpD,+CAAkD;AAClD,8CAAuE;AAEvE,oCAAwF;AAaxF,kCAAuC;AACvC,sCAA8C;AAE9C;;GAEG;AACU,QAAA,QAAQ,GAAG,YAAY,CAAA;AAEpC;;GAEG;AACU,QAAA,QAAQ,GAAG,MAAM,CAAA;AAE9B;;;GAGG;AACH,MAAa,OAAO;IA0BlB;;;;;;OAMG;IACH,YACE,OAAgB,EAChB,IAAY,EACZ,WAAmB,EACnB,SAAiC,EAAE;QAjC7B,aAAQ,GAAa,EAAE,CAAA;QAS/B;;;;WAIG;QACM,YAAO,GAAa,EAAE,CAAA;QAC/B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AAO,EAAE,MAAM,GAAG,CAAA;AAChC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEzC,wBAAsB,YAAY,CAChC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,OAAO,EAAE,CAAC,CAapB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.scanCommands = scanCommands;
|
|
7
|
+
/**
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
const path_1 = __importDefault(require("path"));
|
|
12
|
+
const zipObject_1 = __importDefault(require("lodash/zipObject"));
|
|
13
|
+
const map_1 = __importDefault(require("lodash/map"));
|
|
14
|
+
const fs_1 = require("../utils/fs");
|
|
15
|
+
const import_1 = require("./import");
|
|
16
|
+
const _1 = require(".");
|
|
17
|
+
async function scanCommands(program, dirPath) {
|
|
18
|
+
const files = await (0, fs_1.readdir)(dirPath);
|
|
19
|
+
const imp = await Promise.all(files.map((f) => (0, import_1.importCommand)(path_1.default.join(dirPath, f))));
|
|
20
|
+
const data = (0, zipObject_1.default)(files, imp);
|
|
21
|
+
return (0, map_1.default)(data, (cmdBuilder, filename) => {
|
|
22
|
+
const { dir, name } = path_1.default.parse(filename);
|
|
23
|
+
const cmd = dir ? [...dir.split("/"), name].join(" ") : name;
|
|
24
|
+
const options = {
|
|
25
|
+
createCommand: _1.createCommand.bind(null, program, cmd),
|
|
26
|
+
program,
|
|
27
|
+
};
|
|
28
|
+
return cmdBuilder(options);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=scan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan.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ult, ParserProcessedResult } from "../types";
|
|
6
|
+
import type { Command } from ".";
|
|
7
|
+
export declare function validateCall(cmd: Command, result: ParserResult): Promise<ParserProcessedResult>;
|
|
8
|
+
//# sourceMappingURL=validate-call.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-call.d.ts","sourceRoot":"","sources":["../../../src/command/validate-call.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAG9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,GAAG,CAAA;AAEhC,wBAAsB,YAAY,CAChC,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,qBAAqB,CAAC,CAMhC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateCall = validateCall;
|
|
4
|
+
const validate_1 = require("../argument/validate");
|
|
5
|
+
const validate_2 = require("../option/validate");
|
|
6
|
+
async function validateCall(cmd, result) {
|
|
7
|
+
const { args: parsedArgs, options: parsedFlags } = result;
|
|
8
|
+
// check if there are some global flags to handle
|
|
9
|
+
const { options: flags, errors: flagsErrors } = await (0, validate_2.validateOptions)(cmd, parsedFlags);
|
|
10
|
+
const { args, errors: argsErrors } = await (0, validate_1.validateArgs)(cmd, parsedArgs);
|
|
11
|
+
return { ...result, args, options: flags, errors: [...argsErrors, ...flagsErrors] };
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=validate-call.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-call.js","sourceRoot":"","sources":["../../../src/command/validate-call.ts"],"names":[],"mappings":";;AASA,oCASC;AAbD,mDAAmD;AACnD,iDAAoD;AAG7C,KAAK,UAAU,YAAY,CAChC,GAAY,EACZ,MAAoB;IAEpB,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,MAAM,CAAA;IACzD,iDAAiD;IACjD,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,IAAA,0BAAe,EAAC,GAAG,EAAE,WAAW,CAAC,CAAA;IACvF,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,IAAA,uBAAY,EAAC,GAAG,EAAE,UAAU,CAAC,CAAA;IACxE,OAAO,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,GAAG,UAAU,EAAE,GAAG,WAAW,CAAC,EAAE,CAAA;AACrF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAExD,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,UAAU,EAAE,QAAQ,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAmBrF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createConfigurator = createConfigurator;
|
|
4
|
+
function createConfigurator(defaults) {
|
|
5
|
+
const _defaults = defaults;
|
|
6
|
+
let config = defaults;
|
|
7
|
+
return {
|
|
8
|
+
reset() {
|
|
9
|
+
config = _defaults;
|
|
10
|
+
return config;
|
|
11
|
+
},
|
|
12
|
+
get(key) {
|
|
13
|
+
return config[key];
|
|
14
|
+
},
|
|
15
|
+
getAll() {
|
|
16
|
+
return config;
|
|
17
|
+
},
|
|
18
|
+
set(props) {
|
|
19
|
+
config = { ...config, ...props };
|
|
20
|
+
return config;
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/config/index.ts"],"names":[],"mappings":";;AAMA,gDAmBC;AAnBD,SAAgB,kBAAkB,CAAuB,QAAW;IAClE,MAAM,SAAS,GAAG,QAAQ,CAAA;IAC1B,IAAI,MAAM,GAAG,QAAQ,CAAA;IACrB,OAAO;QACL,KAAK;YACH,MAAM,GAAG,SAAS,CAAA;YAClB,OAAO,MAAM,CAAA;QACf,CAAC;QACD,GAAG,CAAoB,GAAM;YAC3B,OAAO,MAAM,CAAC,GAAG,CAAC,CAAA;QACpB,CAAC;QACD,MAAM;YACJ,OAAO,MAAM,CAAA;QACf,CAAC;QACD,GAAG,CAAC,KAAiB;YACnB,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK,EAAE,CAAA;YAChC,OAAO,MAAM,CAAA;QACf,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fatal.spec.d.ts","sourceRoot":"","sources":["../../../../src/error/__tests__/fatal.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const fatal_1 = require("../fatal");
|
|
4
|
+
const base_1 = require("../base");
|
|
5
|
+
const logger_1 = require("../../logger");
|
|
6
|
+
const vitest_1 = require("vitest");
|
|
7
|
+
(0, vitest_1.describe)("fatalError()", () => {
|
|
8
|
+
const loggerLogSpy = vitest_1.vi.spyOn(logger_1.logger, "log");
|
|
9
|
+
const loggerErrSpy = vitest_1.vi.spyOn(logger_1.logger, "error");
|
|
10
|
+
(0, vitest_1.afterEach)(() => {
|
|
11
|
+
logger_1.logger.level = "info";
|
|
12
|
+
});
|
|
13
|
+
(0, vitest_1.it)("should always call process.exit(1)", () => {
|
|
14
|
+
const err = new base_1.BaseError("my error");
|
|
15
|
+
(0, fatal_1.fatalError)(err);
|
|
16
|
+
(0, vitest_1.expect)(process.exitCode).toEqual(1);
|
|
17
|
+
});
|
|
18
|
+
(0, vitest_1.it)("should always logger.error in normal situation", () => {
|
|
19
|
+
const err = new base_1.BaseError("my error");
|
|
20
|
+
(0, fatal_1.fatalError)(err);
|
|
21
|
+
(0, vitest_1.expect)(loggerErrSpy).toHaveBeenCalledWith(err.message);
|
|
22
|
+
});
|
|
23
|
+
(0, vitest_1.it)("should always logger.log in debug mode, with more info", () => {
|
|
24
|
+
const err = new base_1.BaseError("my error");
|
|
25
|
+
logger_1.logger.level = "debug";
|
|
26
|
+
(0, fatal_1.fatalError)(err);
|
|
27
|
+
(0, vitest_1.expect)(loggerLogSpy).toHaveBeenCalledWith(vitest_1.expect.objectContaining({
|
|
28
|
+
message: vitest_1.expect.stringContaining("my error"),
|
|
29
|
+
stack: err.stack,
|
|
30
|
+
name: "BaseError",
|
|
31
|
+
}));
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=fatal.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fatal.spec.js","sourceRoot":"","sources":["../../../../src/error/__tests__/fatal.spec.ts"],"names":[],"mappings":";;AAAA,oCAAqC;AACrC,kCAAmC;AACnC,yCAAqC;AACrC,mCAA4D;AAE5D,IAAA,iBAAQ,EAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,MAAM,YAAY,GAAG,WAAE,CAAC,KAAK,CAAC,eAAM,EAAE,KAAK,CAAC,CAAA;IAC5C,MAAM,YAAY,GAAG,WAAE,CAAC,KAAK,CAAC,eAAM,EAAE,OAAO,CAAC,CAAA;IAE9C,IAAA,kBAAS,EAAC,GAAG,EAAE;QACb,eAAM,CAAC,KAAK,GAAG,MAAM,CAAA;IACvB,CAAC,CAAC,CAAA;IAEF,IAAA,WAAE,EAAC,oCAAoC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 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ActionError = void 0;
|
|
8
|
+
const base_1 = require("./base");
|
|
9
|
+
class ActionError extends base_1.BaseError {
|
|
10
|
+
constructor(error) {
|
|
11
|
+
const message = typeof error === "string" ? error : error.message;
|
|
12
|
+
super(message, { error });
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.ActionError = ActionError;
|
|
16
|
+
//# sourceMappingURL=action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../../src/error/action.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iCAAkC;AAElC,MAAa,WAAY,SAAQ,gBAAS;IACxC,YAAY,KAAqB;QAC/B,MAAM,OAAO,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAA;QACjE,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;IAC3B,CAAC;CACF;AALD,kCAKC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
import { ErrorMetadata } from "../types";
|
|
6
|
+
export type CommonError = Error | BaseError;
|
|
7
|
+
export declare class BaseError extends Error {
|
|
8
|
+
meta: ErrorMetadata;
|
|
9
|
+
constructor(message: string, meta?: ErrorMetadata);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/error/base.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,SAAS,CAAA;AAE3C,qBAAa,SAAU,SAAQ,KAAK;IAC3B,IAAI,EAAE,aAAa,CAAA;gBAEd,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,aAAkB;CAOtD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.BaseError = void 0;
|
|
8
|
+
class BaseError extends Error {
|
|
9
|
+
constructor(message, meta = {}) {
|
|
10
|
+
super(message);
|
|
11
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
12
|
+
this.name = this.constructor.name;
|
|
13
|
+
this.meta = meta;
|
|
14
|
+
Error.captureStackTrace(this, this.constructor);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.BaseError = BaseError;
|
|
18
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/error/base.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAMH,MAAa,SAAU,SAAQ,KAAK;IAGlC,YAAY,OAAe,EAAE,OAAsB,EAAE;QACnD,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;QACjD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAA;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;IACjD,CAAC;CACF;AAVD,8BAUC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fatal.d.ts","sourceRoot":"","sources":["../../../src/error/fatal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAEvC;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAajD"}
|