@modern-js/module-tools 2.0.0-beta.3 → 2.0.0-beta.6
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/CHANGELOG.md +331 -211
- package/bin/modern.js +1 -0
- package/compiled/@babel/code-frame/index.d.ts +1 -0
- package/compiled/@babel/code-frame/index.js +1 -0
- package/compiled/@babel/code-frame/license +22 -0
- package/compiled/@babel/code-frame/package.json +1 -0
- package/compiled/@babel/generator/index.d.ts +1 -0
- package/compiled/@babel/generator/index.js +1 -0
- package/compiled/@babel/generator/license +22 -0
- package/compiled/@babel/generator/package.json +1 -0
- package/compiled/@babel/helper-validator-identifier/index.d.ts +1 -0
- package/compiled/@babel/helper-validator-identifier/index.js +1 -0
- package/compiled/@babel/helper-validator-identifier/license +22 -0
- package/compiled/@babel/helper-validator-identifier/package.json +1 -0
- package/compiled/@babel/highlight/index.d.ts +1 -0
- package/compiled/@babel/highlight/index.js +1 -0
- package/compiled/@babel/highlight/license +22 -0
- package/compiled/@babel/highlight/package.json +1 -0
- package/compiled/@babel/parser/@babel/types/lib/index-legacy.d.ts +2742 -0
- package/compiled/@babel/parser/index.js +1 -0
- package/compiled/@babel/parser/license +19 -0
- package/compiled/@babel/parser/package.json +1 -0
- package/compiled/@babel/parser/typings/babel-parser.d.ts +214 -0
- package/compiled/@babel/template/index.d.ts +1 -0
- package/compiled/@babel/template/index.js +1 -0
- package/compiled/@babel/template/license +22 -0
- package/compiled/@babel/template/package.json +1 -0
- package/compiled/@babel/traverse/index.d.ts +1199 -0
- package/compiled/@babel/traverse/index.js +1 -0
- package/compiled/@babel/traverse/license +22 -0
- package/compiled/@babel/traverse/package.json +1 -0
- package/compiled/@babel/types/index.js +1 -0
- package/compiled/@babel/types/lib/index-legacy.d.ts +2732 -0
- package/compiled/@babel/types/license +22 -0
- package/compiled/@babel/types/package.json +1 -0
- package/compiled/@rollup/plugin-json/@rollup/pluginutils/types/index.d.ts +86 -0
- package/compiled/@rollup/plugin-json/estree/index.d.ts +548 -0
- package/compiled/@rollup/plugin-json/index.js +1 -0
- package/compiled/@rollup/plugin-json/license +21 -0
- package/compiled/@rollup/plugin-json/package.json +1 -0
- package/compiled/@rollup/plugin-json/rollup/dist/rollup.d.ts +948 -0
- package/compiled/@rollup/plugin-json/types/index.d.ts +41 -0
- package/compiled/find-up/index.d.ts +138 -0
- package/compiled/find-up/index.js +1 -0
- package/compiled/find-up/license +9 -0
- package/compiled/find-up/locate-path/index.d.ts +83 -0
- package/compiled/find-up/package.json +1 -0
- package/compiled/less/index.d.ts +282 -0
- package/compiled/less/index.js +1 -0
- package/compiled/less/package.json +1 -0
- package/compiled/normalize-path/index.d.ts +8 -0
- package/compiled/normalize-path/index.js +8 -0
- package/compiled/normalize-path/license +21 -0
- package/compiled/normalize-path/package.json +1 -0
- package/compiled/p-map/@szmarczak/http-timer/dist/source/index.d.ts +32 -0
- package/compiled/p-map/cacheable-lookup/index.d.ts +139 -0
- package/compiled/p-map/cacheable-request/index.d.ts +137 -0
- package/compiled/p-map/got/dist/source/as-promise/index.d.ts +3 -0
- package/compiled/p-map/got/dist/source/as-promise/types.d.ts +256 -0
- package/compiled/p-map/got/dist/source/core/index.d.ts +1124 -0
- package/compiled/p-map/got/dist/source/core/utils/dns-ip-version.d.ts +5 -0
- package/compiled/p-map/got/dist/source/core/utils/options-to-url.d.ts +14 -0
- package/compiled/p-map/got/dist/source/core/utils/timed-out.d.ts +29 -0
- package/compiled/p-map/got/dist/source/index.d.ts +4 -0
- package/compiled/p-map/got/dist/source/types.d.ts +344 -0
- package/compiled/p-map/http-cache-semantics/index.d.ts +170 -0
- package/compiled/p-map/index.d.ts +67 -0
- package/compiled/p-map/index.js +1 -0
- package/compiled/p-map/keyv/src/index.d.ts +104 -0
- package/compiled/p-map/license +9 -0
- package/compiled/p-map/p-cancelable/index.d.ts +176 -0
- package/compiled/p-map/package.json +1 -0
- package/compiled/p-map/responselike/index.d.ts +34 -0
- package/compiled/postcss-custom-properties/index.d.ts +1 -0
- package/compiled/postcss-custom-properties/index.js +1 -0
- package/compiled/postcss-custom-properties/package.json +1 -0
- package/compiled/postcss-flexbugs-fixes/index.d.ts +1 -0
- package/compiled/postcss-flexbugs-fixes/index.js +1 -0
- package/compiled/postcss-flexbugs-fixes/license +20 -0
- package/compiled/postcss-flexbugs-fixes/package.json +1 -0
- package/compiled/postcss-font-variant/index.d.ts +1 -0
- package/compiled/postcss-font-variant/index.js +1 -0
- package/compiled/postcss-font-variant/license +20 -0
- package/compiled/postcss-font-variant/package.json +1 -0
- package/compiled/postcss-initial/index.d.ts +1 -0
- package/compiled/postcss-initial/index.js +1 -0
- package/compiled/postcss-initial/license +20 -0
- package/compiled/postcss-initial/package.json +1 -0
- package/compiled/postcss-media-minmax/index.d.ts +1 -0
- package/compiled/postcss-media-minmax/index.js +1 -0
- package/compiled/postcss-media-minmax/license +22 -0
- package/compiled/postcss-media-minmax/package.json +1 -0
- package/compiled/postcss-nesting/index.d.ts +1 -0
- package/compiled/postcss-nesting/index.js +2 -0
- package/compiled/postcss-nesting/package.json +1 -0
- package/compiled/postcss-page-break/index.d.ts +1 -0
- package/compiled/postcss-page-break/index.js +1 -0
- package/compiled/postcss-page-break/license +20 -0
- package/compiled/postcss-page-break/package.json +1 -0
- package/compiled/postcss-value-parser/index.d.ts +1 -0
- package/compiled/postcss-value-parser/index.js +1 -0
- package/compiled/postcss-value-parser/license +22 -0
- package/compiled/postcss-value-parser/package.json +1 -0
- package/compiled/rollup/fsevents.node +0 -0
- package/compiled/rollup/index.js +82 -0
- package/compiled/rollup/package.json +1 -0
- package/compiled/rollup/types/rollup.d.ts +948 -0
- package/compiled/rollup-plugin-dts/dist/rollup-plugin-dts.d.ts +21 -0
- package/compiled/rollup-plugin-dts/index.js +1 -0
- package/compiled/rollup-plugin-dts/package.json +1 -0
- package/compiled/rollup-plugin-dts/rollup/dist/rollup.d.ts +948 -0
- package/compiled/sass/index.js +1 -0
- package/compiled/sass/license +1619 -0
- package/compiled/sass/package.json +1 -0
- package/compiled/sass/types/compile.d.ts +152 -0
- package/compiled/sass/types/exception.d.ts +41 -0
- package/compiled/sass/types/importer.d.ts +294 -0
- package/compiled/sass/types/index.d.ts +80 -0
- package/compiled/sass/types/legacy/exception.d.ts +54 -0
- package/compiled/sass/types/legacy/function.d.ts +756 -0
- package/compiled/sass/types/legacy/importer.d.ts +168 -0
- package/compiled/sass/types/legacy/options.d.ts +642 -0
- package/compiled/sass/types/legacy/plugin_this.d.ts +73 -0
- package/compiled/sass/types/legacy/render.d.ts +139 -0
- package/compiled/sass/types/logger/index.d.ts +94 -0
- package/compiled/sass/types/logger/source_location.d.ts +21 -0
- package/compiled/sass/types/logger/source_span.d.ts +34 -0
- package/compiled/sass/types/options.d.ts +435 -0
- package/compiled/sass/types/util/promise_or.d.ts +17 -0
- package/compiled/sass/types/value/argument_list.d.ts +47 -0
- package/compiled/sass/types/value/boolean.d.ts +29 -0
- package/compiled/sass/types/value/color.d.ts +107 -0
- package/compiled/sass/types/value/function.d.ts +22 -0
- package/compiled/sass/types/value/index.d.ts +173 -0
- package/compiled/sass/types/value/list.d.ts +54 -0
- package/compiled/sass/types/value/map.d.ts +41 -0
- package/compiled/sass/types/value/number.d.ts +305 -0
- package/compiled/sass/types/value/string.d.ts +84 -0
- package/compiled/signal-exit/index.d.ts +24 -0
- package/compiled/signal-exit/index.js +1 -0
- package/compiled/signal-exit/package.json +1 -0
- package/dist/builder/build.d.ts +23 -0
- package/dist/builder/build.js +269 -0
- package/dist/builder/build.js.map +1 -0
- package/dist/builder/clear.d.ts +3 -0
- package/dist/builder/clear.js +67 -0
- package/dist/builder/clear.js.map +1 -0
- package/dist/builder/copy.d.ts +11 -0
- package/dist/builder/copy.js +196 -0
- package/dist/builder/copy.js.map +1 -0
- package/dist/builder/dts/index.d.ts +2 -0
- package/dist/builder/dts/index.js +32 -0
- package/dist/builder/dts/index.js.map +1 -0
- package/dist/builder/dts/rollup.d.ts +17 -0
- package/dist/builder/dts/rollup.js +167 -0
- package/dist/builder/dts/rollup.js.map +1 -0
- package/dist/builder/dts/tsc.d.ts +3 -0
- package/dist/builder/dts/tsc.js +153 -0
- package/dist/builder/dts/tsc.js.map +1 -0
- package/dist/builder/index.d.ts +8 -0
- package/dist/builder/index.js +116 -0
- package/dist/builder/index.js.map +1 -0
- package/dist/builder/platform.d.ts +4 -0
- package/dist/builder/platform.js +132 -0
- package/dist/builder/platform.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +95 -0
- package/dist/cli.js.map +1 -0
- package/dist/command.d.ts +7 -0
- package/dist/command.js +164 -0
- package/dist/command.js.map +1 -0
- package/dist/config/defineConfig.d.ts +2 -0
- package/dist/config/defineConfig.js +29 -0
- package/dist/config/defineConfig.js.map +1 -0
- package/dist/config/normalize.d.ts +17 -0
- package/dist/config/normalize.js +168 -0
- package/dist/config/normalize.js.map +1 -0
- package/dist/config/schema.d.ts +641 -0
- package/dist/config/schema.js +215 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/constants/build-presets.d.ts +81 -0
- package/dist/constants/build-presets.js +236 -0
- package/dist/constants/build-presets.js.map +1 -0
- package/dist/constants/build.d.ts +5 -0
- package/dist/constants/build.js +78 -0
- package/dist/constants/build.js.map +1 -0
- package/dist/constants/colors.d.ts +4 -0
- package/dist/constants/colors.js +35 -0
- package/dist/constants/colors.js.map +1 -0
- package/dist/constants/dts.d.ts +4 -0
- package/dist/constants/dts.js +52 -0
- package/dist/constants/dts.js.map +1 -0
- package/dist/constants/file.d.ts +3 -0
- package/dist/constants/file.js +35 -0
- package/dist/constants/file.js.map +1 -0
- package/dist/constants/legacy-build-presets.d.ts +13 -0
- package/dist/constants/legacy-build-presets.js +198 -0
- package/dist/constants/legacy-build-presets.js.map +1 -0
- package/dist/constants/log.d.ts +8 -0
- package/dist/constants/log.js +43 -0
- package/dist/constants/log.js.map +1 -0
- package/dist/dev.d.ts +10 -0
- package/dist/dev.js +129 -0
- package/dist/dev.js.map +1 -0
- package/dist/{types/features/build/error.d.ts → error.d.ts} +1 -1
- package/dist/error.js +148 -0
- package/dist/error.js.map +1 -0
- package/dist/hooks/build.d.ts +22 -0
- package/dist/hooks/build.js +39 -0
- package/dist/hooks/build.js.map +1 -0
- package/dist/hooks/dev.d.ts +12 -0
- package/dist/hooks/dev.js +37 -0
- package/dist/hooks/dev.js.map +1 -0
- package/dist/hooks/index.d.ts +29 -0
- package/dist/hooks/index.js +46 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/misc.d.ts +5 -0
- package/dist/hooks/misc.js +33 -0
- package/dist/hooks/misc.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -0
- package/dist/{types/locale → locale}/en.d.ts +0 -0
- package/dist/locale/en.js +51 -0
- package/dist/locale/en.js.map +1 -0
- package/dist/{types/locale → locale}/index.d.ts +0 -0
- package/dist/locale/index.js +39 -0
- package/dist/locale/index.js.map +1 -0
- package/dist/{types/locale → locale}/zh.d.ts +0 -0
- package/dist/locale/zh.js +51 -0
- package/dist/locale/zh.js.map +1 -0
- package/dist/plugins.d.ts +2 -0
- package/dist/plugins.js +55 -0
- package/dist/plugins.js.map +1 -0
- package/dist/types/color.d.ts +1 -0
- package/dist/types/color.js +17 -0
- package/dist/types/color.js.map +1 -0
- package/dist/types/command.d.ts +11 -0
- package/dist/types/command.js +17 -0
- package/dist/types/command.js.map +1 -0
- package/dist/types/config/index.d.ts +92 -0
- package/dist/types/config/index.js +19 -0
- package/dist/types/config/index.js.map +1 -0
- package/dist/types/config/style.d.ts +12 -0
- package/dist/types/config/style.js +17 -0
- package/dist/types/config/style.js.map +1 -0
- package/dist/types/context.d.ts +5 -0
- package/dist/types/context.js +17 -0
- package/dist/types/context.js.map +1 -0
- package/dist/types/copy.d.ts +15 -0
- package/dist/types/copy.js +17 -0
- package/dist/types/copy.js.map +1 -0
- package/dist/types/{utils/tsconfig.d.ts → dts.d.ts} +11 -3
- package/dist/types/dts.js +17 -0
- package/dist/types/dts.js.map +1 -0
- package/dist/types/hooks.d.ts +25 -0
- package/dist/types/hooks.js +17 -0
- package/dist/types/hooks.js.map +1 -0
- package/dist/types/index.d.ts +17 -6
- package/dist/types/index.js +23 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/utils.d.ts +7 -0
- package/dist/types/utils.js +17 -0
- package/dist/types/utils.js.map +1 -0
- package/dist/utils/builder.d.ts +8 -0
- package/dist/utils/builder.js +104 -0
- package/dist/utils/builder.js.map +1 -0
- package/dist/utils/config.d.ts +6 -0
- package/dist/utils/config.js +167 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/context.d.ts +7 -0
- package/dist/utils/context.js +60 -0
- package/dist/utils/context.js.map +1 -0
- package/dist/utils/dts.d.ts +14 -0
- package/dist/utils/dts.js +186 -0
- package/dist/utils/dts.js.map +1 -0
- package/dist/utils/input.d.ts +16 -0
- package/dist/utils/input.js +113 -0
- package/dist/utils/input.js.map +1 -0
- package/dist/utils/language.d.ts +2 -0
- package/dist/utils/language.js +68 -0
- package/dist/utils/language.js.map +1 -0
- package/dist/utils/libuild-plugins.d.ts +6 -0
- package/dist/utils/libuild-plugins.js +83 -0
- package/dist/utils/libuild-plugins.js.map +1 -0
- package/dist/utils/log.d.ts +2 -0
- package/dist/utils/log.js +68 -0
- package/dist/utils/log.js.map +1 -0
- package/dist/utils/onExit.d.ts +1 -0
- package/dist/utils/onExit.js +63 -0
- package/dist/utils/onExit.js.map +1 -0
- package/dist/utils/path.d.ts +1 -0
- package/dist/utils/path.js +59 -0
- package/dist/utils/path.js.map +1 -0
- package/dist/utils/style.d.ts +31 -0
- package/dist/utils/style.js +129 -0
- package/dist/utils/style.js.map +1 -0
- package/dist/{types/utils/tspaths-transform/index.d.ts → utils/tspaths-transform.d.ts} +0 -0
- package/dist/utils/tspaths-transform.js +119 -0
- package/dist/utils/tspaths-transform.js.map +1 -0
- package/package.json +43 -72
- package/dist/js/modern/cli/build.js +0 -11
- package/dist/js/modern/cli/dev.js +0 -11
- package/dist/js/modern/cli/index.js +0 -3
- package/dist/js/modern/cli/new.js +0 -13
- package/dist/js/modern/commands/build.js +0 -69
- package/dist/js/modern/commands/dev.js +0 -43
- package/dist/js/modern/commands/index.js +0 -2
- package/dist/js/modern/features/build/build-platform.js +0 -69
- package/dist/js/modern/features/build/bundle/index.js +0 -9
- package/dist/js/modern/features/build/bundle/runRollup.js +0 -136
- package/dist/js/modern/features/build/bundle/runSpeedy.js +0 -176
- package/dist/js/modern/features/build/bundleless/copy-assets.js +0 -75
- package/dist/js/modern/features/build/bundleless/generator-dts/index.js +0 -106
- package/dist/js/modern/features/build/bundleless/generator-dts/utils.js +0 -94
- package/dist/js/modern/features/build/bundleless/index.js +0 -21
- package/dist/js/modern/features/build/bundleless/runBabel.js +0 -242
- package/dist/js/modern/features/build/bundleless/style.js +0 -241
- package/dist/js/modern/features/build/constants.js +0 -98
- package/dist/js/modern/features/build/error.js +0 -127
- package/dist/js/modern/features/build/index.js +0 -117
- package/dist/js/modern/features/build/legacy-constants.js +0 -103
- package/dist/js/modern/features/build/logger/index.js +0 -2
- package/dist/js/modern/features/build/logger/logText.js +0 -56
- package/dist/js/modern/features/build/logger/loggerManager.js +0 -93
- package/dist/js/modern/features/build/normalize.js +0 -277
- package/dist/js/modern/features/build/types.js +0 -0
- package/dist/js/modern/features/build/utils.js +0 -92
- package/dist/js/modern/features/dev/index.js +0 -47
- package/dist/js/modern/hooks/build.js +0 -20
- package/dist/js/modern/hooks/dev.js +0 -14
- package/dist/js/modern/hooks/index.js +0 -15
- package/dist/js/modern/index.js +0 -63
- package/dist/js/modern/locale/en.js +0 -25
- package/dist/js/modern/locale/index.js +0 -10
- package/dist/js/modern/locale/zh.js +0 -25
- package/dist/js/modern/schema/build-config.js +0 -117
- package/dist/js/modern/schema/index.js +0 -4
- package/dist/js/modern/schema/output.js +0 -45
- package/dist/js/modern/schema/source.js +0 -7
- package/dist/js/modern/schema/tools.js +0 -6
- package/dist/js/modern/schema/types.js +0 -0
- package/dist/js/modern/types.js +0 -0
- package/dist/js/modern/utils/babel.js +0 -84
- package/dist/js/modern/utils/color.js +0 -2
- package/dist/js/modern/utils/constants.js +0 -3
- package/dist/js/modern/utils/copy.js +0 -70
- package/dist/js/modern/utils/init-env.js +0 -13
- package/dist/js/modern/utils/json.js +0 -13
- package/dist/js/modern/utils/language.js +0 -6
- package/dist/js/modern/utils/logger.js +0 -96
- package/dist/js/modern/utils/readline.js +0 -17
- package/dist/js/modern/utils/tsconfig.js +0 -13
- package/dist/js/modern/utils/tspaths-transform/constants.js +0 -5
- package/dist/js/modern/utils/tspaths-transform/index.js +0 -113
- package/dist/js/modern/utils/tspaths-transform/utils.js +0 -18
- package/dist/js/modern/utils/valide.js +0 -26
- package/dist/js/node/cli/build.js +0 -18
- package/dist/js/node/cli/dev.js +0 -18
- package/dist/js/node/cli/index.js +0 -38
- package/dist/js/node/cli/new.js +0 -20
- package/dist/js/node/commands/build.js +0 -80
- package/dist/js/node/commands/dev.js +0 -52
- package/dist/js/node/commands/index.js +0 -19
- package/dist/js/node/features/build/build-platform.js +0 -76
- package/dist/js/node/features/build/bundle/index.js +0 -17
- package/dist/js/node/features/build/bundle/runRollup.js +0 -145
- package/dist/js/node/features/build/bundle/runSpeedy.js +0 -186
- package/dist/js/node/features/build/bundleless/copy-assets.js +0 -84
- package/dist/js/node/features/build/bundleless/generator-dts/index.js +0 -114
- package/dist/js/node/features/build/bundleless/generator-dts/utils.js +0 -105
- package/dist/js/node/features/build/bundleless/index.js +0 -29
- package/dist/js/node/features/build/bundleless/runBabel.js +0 -255
- package/dist/js/node/features/build/bundleless/style.js +0 -254
- package/dist/js/node/features/build/constants.js +0 -116
- package/dist/js/node/features/build/error.js +0 -139
- package/dist/js/node/features/build/index.js +0 -128
- package/dist/js/node/features/build/legacy-constants.js +0 -111
- package/dist/js/node/features/build/logger/index.js +0 -27
- package/dist/js/node/features/build/logger/logText.js +0 -66
- package/dist/js/node/features/build/logger/loggerManager.js +0 -95
- package/dist/js/node/features/build/normalize.js +0 -288
- package/dist/js/node/features/build/types.js +0 -0
- package/dist/js/node/features/build/utils.js +0 -107
- package/dist/js/node/features/dev/index.js +0 -56
- package/dist/js/node/hooks/build.js +0 -32
- package/dist/js/node/hooks/dev.js +0 -24
- package/dist/js/node/hooks/index.js +0 -36
- package/dist/js/node/index.js +0 -83
- package/dist/js/node/locale/en.js +0 -32
- package/dist/js/node/locale/index.js +0 -17
- package/dist/js/node/locale/zh.js +0 -32
- package/dist/js/node/schema/build-config.js +0 -126
- package/dist/js/node/schema/index.js +0 -11
- package/dist/js/node/schema/output.js +0 -52
- package/dist/js/node/schema/source.js +0 -14
- package/dist/js/node/schema/tools.js +0 -13
- package/dist/js/node/schema/types.js +0 -0
- package/dist/js/node/types.js +0 -0
- package/dist/js/node/utils/babel.js +0 -93
- package/dist/js/node/utils/color.js +0 -9
- package/dist/js/node/utils/constants.js +0 -11
- package/dist/js/node/utils/copy.js +0 -79
- package/dist/js/node/utils/init-env.js +0 -20
- package/dist/js/node/utils/json.js +0 -20
- package/dist/js/node/utils/language.js +0 -12
- package/dist/js/node/utils/logger.js +0 -107
- package/dist/js/node/utils/readline.js +0 -25
- package/dist/js/node/utils/tsconfig.js +0 -21
- package/dist/js/node/utils/tspaths-transform/constants.js +0 -12
- package/dist/js/node/utils/tspaths-transform/index.js +0 -123
- package/dist/js/node/utils/tspaths-transform/utils.js +0 -25
- package/dist/js/node/utils/valide.js +0 -34
- package/dist/types/cli/build.d.ts +0 -3
- package/dist/types/cli/dev.d.ts +0 -3
- package/dist/types/cli/index.d.ts +0 -3
- package/dist/types/cli/new.d.ts +0 -2
- package/dist/types/commands/build.d.ts +0 -17
- package/dist/types/commands/dev.d.ts +0 -5
- package/dist/types/commands/index.d.ts +0 -2
- package/dist/types/features/build/build-platform.d.ts +0 -7
- package/dist/types/features/build/bundle/index.d.ts +0 -3
- package/dist/types/features/build/bundle/runRollup.d.ts +0 -3
- package/dist/types/features/build/bundle/runSpeedy.d.ts +0 -10
- package/dist/types/features/build/bundleless/copy-assets.d.ts +0 -3
- package/dist/types/features/build/bundleless/generator-dts/index.d.ts +0 -3
- package/dist/types/features/build/bundleless/generator-dts/utils.d.ts +0 -21
- package/dist/types/features/build/bundleless/index.d.ts +0 -4
- package/dist/types/features/build/bundleless/runBabel.d.ts +0 -32
- package/dist/types/features/build/bundleless/style.d.ts +0 -25
- package/dist/types/features/build/constants.d.ts +0 -18
- package/dist/types/features/build/index.d.ts +0 -12
- package/dist/types/features/build/legacy-constants.d.ts +0 -8
- package/dist/types/features/build/logger/index.d.ts +0 -2
- package/dist/types/features/build/logger/logText.d.ts +0 -39
- package/dist/types/features/build/logger/loggerManager.d.ts +0 -40
- package/dist/types/features/build/normalize.d.ts +0 -19
- package/dist/types/features/build/types.d.ts +0 -15
- package/dist/types/features/build/utils.d.ts +0 -36
- package/dist/types/features/dev/index.d.ts +0 -9
- package/dist/types/hooks/build.d.ts +0 -46
- package/dist/types/hooks/dev.d.ts +0 -20
- package/dist/types/hooks/index.d.ts +0 -30
- package/dist/types/schema/build-config.d.ts +0 -205
- package/dist/types/schema/index.d.ts +0 -217
- package/dist/types/schema/output.d.ts +0 -215
- package/dist/types/schema/source.d.ts +0 -6
- package/dist/types/schema/tools.d.ts +0 -6
- package/dist/types/schema/types.d.ts +0 -45
- package/dist/types/types.d.ts +0 -51
- package/dist/types/utils/babel.d.ts +0 -8
- package/dist/types/utils/color.d.ts +0 -2
- package/dist/types/utils/constants.d.ts +0 -2
- package/dist/types/utils/copy.d.ts +0 -5
- package/dist/types/utils/init-env.d.ts +0 -21
- package/dist/types/utils/json.d.ts +0 -4
- package/dist/types/utils/language.d.ts +0 -1
- package/dist/types/utils/logger.d.ts +0 -58
- package/dist/types/utils/readline.d.ts +0 -9
- package/dist/types/utils/tspaths-transform/constants.d.ts +0 -1
- package/dist/types/utils/tspaths-transform/utils.d.ts +0 -4
- package/dist/types/utils/valide.d.ts +0 -12
- package/types.d.ts +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"less","author":{"name":"Alexis Sellier","email":"self@cloudhead.net"},"version":"4.1.3","license":"Apache-2.0"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Type definitions for normalize-path 3.0
|
|
2
|
+
// Project: https://github.com/jonschlinkert/normalize-path
|
|
3
|
+
// Definitions by: BendingBender <https://github.com/BendingBender>
|
|
4
|
+
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
5
|
+
|
|
6
|
+
export = normalizePath;
|
|
7
|
+
|
|
8
|
+
declare function normalizePath(path: string, stripTrailing?: boolean): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
(()=>{var e={498:e=>{
|
|
2
|
+
/*!
|
|
3
|
+
* normalize-path <https://github.com/jonschlinkert/normalize-path>
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2014-2018, Jon Schlinkert.
|
|
6
|
+
* Released under the MIT License.
|
|
7
|
+
*/
|
|
8
|
+
e.exports=function(e,r){if(typeof e!=="string"){throw new TypeError("expected path to be a string")}if(e==="\\"||e==="/")return"/";var t=e.length;if(t<=1)return e;var _="";if(t>4&&e[3]==="\\"){var i=e[2];if((i==="?"||i===".")&&e.slice(0,2)==="\\\\"){e=e.slice(2);_="//"}}var a=e.split(/[/\\]+/);if(r!==false&&a[a.length-1]===""){a.pop()}return _+a.join("/")}}};var r={};function __nccwpck_require__(t){var _=r[t];if(_!==undefined){return _.exports}var i=r[t]={exports:{}};var a=true;try{e[t](i,i.exports,__nccwpck_require__);a=false}finally{if(a)delete r[t]}return i.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var t=__nccwpck_require__(498);module.exports=t})();
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014-2018, Jon Schlinkert.
|
|
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.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"normalize-path","author":"Jon Schlinkert (https://github.com/jonschlinkert)","version":"3.0.0","license":"MIT"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { ClientRequest, IncomingMessage } from 'http';
|
|
3
|
+
export interface Timings {
|
|
4
|
+
start: number;
|
|
5
|
+
socket?: number;
|
|
6
|
+
lookup?: number;
|
|
7
|
+
connect?: number;
|
|
8
|
+
secureConnect?: number;
|
|
9
|
+
upload?: number;
|
|
10
|
+
response?: number;
|
|
11
|
+
end?: number;
|
|
12
|
+
error?: number;
|
|
13
|
+
abort?: number;
|
|
14
|
+
phases: {
|
|
15
|
+
wait?: number;
|
|
16
|
+
dns?: number;
|
|
17
|
+
tcp?: number;
|
|
18
|
+
tls?: number;
|
|
19
|
+
request?: number;
|
|
20
|
+
firstByte?: number;
|
|
21
|
+
download?: number;
|
|
22
|
+
total?: number;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export interface ClientRequestWithTimings extends ClientRequest {
|
|
26
|
+
timings?: Timings;
|
|
27
|
+
}
|
|
28
|
+
export interface IncomingMessageWithTimings extends IncomingMessage {
|
|
29
|
+
timings?: Timings;
|
|
30
|
+
}
|
|
31
|
+
declare const timer: (request: ClientRequestWithTimings) => Timings;
|
|
32
|
+
export default timer;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import {Resolver, promises as dnsPromises, lookup} from 'dns';
|
|
2
|
+
import {Agent} from 'http';
|
|
3
|
+
|
|
4
|
+
type AsyncResolver = dnsPromises.Resolver;
|
|
5
|
+
|
|
6
|
+
export type IPFamily = 4 | 6;
|
|
7
|
+
|
|
8
|
+
type TPromise<T> = T | Promise<T>;
|
|
9
|
+
|
|
10
|
+
export interface CacheInstance {
|
|
11
|
+
set(hostname: string, entries: EntryObject[], ttl: number): TPromise<void | boolean | this>;
|
|
12
|
+
get(hostname: string): TPromise<EntryObject[] | undefined>;
|
|
13
|
+
delete(hostname: string): TPromise<boolean>;
|
|
14
|
+
clear(): TPromise<void>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface Options {
|
|
18
|
+
/**
|
|
19
|
+
* Custom cache instance. If `undefined`, it will create a new one.
|
|
20
|
+
* @default undefined
|
|
21
|
+
*/
|
|
22
|
+
cache?: CacheInstance;
|
|
23
|
+
/**
|
|
24
|
+
* Limits the cache time (TTL). If set to `0`, it will make a new DNS query each time.
|
|
25
|
+
* @default Infinity
|
|
26
|
+
*/
|
|
27
|
+
maxTtl?: number;
|
|
28
|
+
/**
|
|
29
|
+
* DNS Resolver used to make DNS queries.
|
|
30
|
+
* @default new dns.promises.Resolver()
|
|
31
|
+
*/
|
|
32
|
+
resolver?: Resolver | AsyncResolver;
|
|
33
|
+
/**
|
|
34
|
+
* When the DNS server responds with `ENOTFOUND` or `ENODATA` and the OS reports that the entry is available,
|
|
35
|
+
* it will use `dns.lookup(...)` directly for the requested hostnames for the specified amount of time (in seconds).
|
|
36
|
+
*
|
|
37
|
+
* If you don't query internal hostnames (such as `localhost`, `database.local` etc.),
|
|
38
|
+
* it is strongly recommended to set this value to `0`.
|
|
39
|
+
* @default 3600
|
|
40
|
+
*/
|
|
41
|
+
fallbackDuration?: number;
|
|
42
|
+
/**
|
|
43
|
+
* The time how long it needs to remember failed queries (TTL in seconds).
|
|
44
|
+
*
|
|
45
|
+
* **Note**: This option is independent, `options.maxTtl` does not affect this.
|
|
46
|
+
* @default 0.15
|
|
47
|
+
*/
|
|
48
|
+
errorTtl?: number;
|
|
49
|
+
/**
|
|
50
|
+
* The fallback function to use when the DNS server responds with `ENOTFOUND` or `ENODATA`.
|
|
51
|
+
*
|
|
52
|
+
* **Note**: This has no effect if the `fallbackDuration` option is less than `1`.
|
|
53
|
+
* @default dns.lookup
|
|
54
|
+
*/
|
|
55
|
+
lookup?: typeof lookup;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface EntryObject {
|
|
59
|
+
/**
|
|
60
|
+
* The IP address (can be an IPv4 or IPv5 address).
|
|
61
|
+
*/
|
|
62
|
+
readonly address: string;
|
|
63
|
+
/**
|
|
64
|
+
* The IP family.
|
|
65
|
+
*/
|
|
66
|
+
readonly family: IPFamily;
|
|
67
|
+
/**
|
|
68
|
+
* The original TTL.
|
|
69
|
+
*/
|
|
70
|
+
readonly ttl?: number;
|
|
71
|
+
/**
|
|
72
|
+
* The expiration timestamp.
|
|
73
|
+
*/
|
|
74
|
+
readonly expires?: number;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface LookupOptions {
|
|
78
|
+
/**
|
|
79
|
+
* One or more supported getaddrinfo flags. Multiple flags may be passed by bitwise ORing their values.
|
|
80
|
+
*/
|
|
81
|
+
hints?: number;
|
|
82
|
+
/**
|
|
83
|
+
* The record family. Must be `4` or `6`. IPv4 and IPv6 addresses are both returned by default.
|
|
84
|
+
*/
|
|
85
|
+
family?: IPFamily;
|
|
86
|
+
/**
|
|
87
|
+
* When `true`, the callback returns all resolved addresses in an array. Otherwise, returns a single address.
|
|
88
|
+
* @default false
|
|
89
|
+
*/
|
|
90
|
+
all?: boolean;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export default class CacheableLookup {
|
|
94
|
+
constructor(options?: Options);
|
|
95
|
+
/**
|
|
96
|
+
* The DNS servers used to make queries. Can be overridden - doing so will clear the cache.
|
|
97
|
+
*/
|
|
98
|
+
servers: string[];
|
|
99
|
+
/**
|
|
100
|
+
* @see https://nodejs.org/api/dns.html#dns_dns_lookup_hostname_options_callback
|
|
101
|
+
*/
|
|
102
|
+
lookup(hostname: string, family: IPFamily, callback: (error: NodeJS.ErrnoException, address: string, family: IPFamily) => void): void;
|
|
103
|
+
lookup(hostname: string, callback: (error: NodeJS.ErrnoException, address: string, family: IPFamily) => void): void;
|
|
104
|
+
lookup(hostname: string, options: LookupOptions & {all: true}, callback: (error: NodeJS.ErrnoException, result: ReadonlyArray<EntryObject>) => void): void;
|
|
105
|
+
lookup(hostname: string, options: LookupOptions, callback: (error: NodeJS.ErrnoException, address: string, family: IPFamily) => void): void;
|
|
106
|
+
/**
|
|
107
|
+
* The asynchronous version of `dns.lookup(…)`.
|
|
108
|
+
*/
|
|
109
|
+
lookupAsync(hostname: string, options: LookupOptions & {all: true}): Promise<ReadonlyArray<EntryObject>>;
|
|
110
|
+
lookupAsync(hostname: string, options: LookupOptions): Promise<EntryObject>;
|
|
111
|
+
lookupAsync(hostname: string): Promise<EntryObject>;
|
|
112
|
+
lookupAsync(hostname: string, family: IPFamily): Promise<EntryObject>;
|
|
113
|
+
/**
|
|
114
|
+
* An asynchronous function which returns cached DNS lookup entries. This is the base for `lookupAsync(hostname, options)` and `lookup(hostname, options, callback)`.
|
|
115
|
+
*/
|
|
116
|
+
query(hostname: string): Promise<ReadonlyArray<EntryObject>>;
|
|
117
|
+
/**
|
|
118
|
+
* An asynchronous function which makes a new DNS lookup query and updates the database. This is used by `query(hostname, family)` if no entry in the database is present. Returns an array of objects with `address`, `family`, `ttl` and `expires` properties.
|
|
119
|
+
*/
|
|
120
|
+
queryAndCache(hostname: string): Promise<ReadonlyArray<EntryObject>>;
|
|
121
|
+
/**
|
|
122
|
+
* Attaches itself to an Agent instance.
|
|
123
|
+
*/
|
|
124
|
+
install(agent: Agent): void;
|
|
125
|
+
/**
|
|
126
|
+
* Removes itself from an Agent instance.
|
|
127
|
+
*/
|
|
128
|
+
uninstall(agent: Agent): void;
|
|
129
|
+
/**
|
|
130
|
+
* Updates interface info. For example, you need to run this when you plug or unplug your WiFi driver.
|
|
131
|
+
*
|
|
132
|
+
* **Note:** Running `updateInterfaceInfo()` will trigger `clear()` only on network interface removal.
|
|
133
|
+
*/
|
|
134
|
+
updateInterfaceInfo(): void;
|
|
135
|
+
/**
|
|
136
|
+
* Clears the cache for the given hostname. If the hostname argument is not present, the entire cache will be emptied.
|
|
137
|
+
*/
|
|
138
|
+
clear(hostname?: string): void;
|
|
139
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
// Type definitions for cacheable-request 6.0
|
|
2
|
+
// Project: https://github.com/lukechilds/cacheable-request#readme
|
|
3
|
+
// Definitions by: BendingBender <https://github.com/BendingBender>
|
|
4
|
+
// Paul Melnikow <https://github.com/paulmelnikow>
|
|
5
|
+
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
6
|
+
// TypeScript Version: 2.3
|
|
7
|
+
|
|
8
|
+
/// <reference types="node" />
|
|
9
|
+
|
|
10
|
+
import { request, RequestOptions, ClientRequest, ServerResponse } from 'http';
|
|
11
|
+
import { URL } from 'url';
|
|
12
|
+
import { EventEmitter } from 'events';
|
|
13
|
+
import { Store } from '../keyv';
|
|
14
|
+
import { Options as CacheSemanticsOptions } from '../http-cache-semantics';
|
|
15
|
+
import ResponseLike = require('../responselike');
|
|
16
|
+
|
|
17
|
+
export = CacheableRequest;
|
|
18
|
+
|
|
19
|
+
declare const CacheableRequest: CacheableRequest;
|
|
20
|
+
|
|
21
|
+
type RequestFn = typeof request;
|
|
22
|
+
|
|
23
|
+
interface CacheableRequest {
|
|
24
|
+
new (requestFn: RequestFn, storageAdapter?: string | CacheableRequest.StorageAdapter): (
|
|
25
|
+
opts: string | URL | (RequestOptions & CacheSemanticsOptions),
|
|
26
|
+
cb?: (response: ServerResponse | ResponseLike) => void
|
|
27
|
+
) => CacheableRequest.Emitter;
|
|
28
|
+
|
|
29
|
+
RequestError: typeof RequestErrorCls;
|
|
30
|
+
CacheError: typeof CacheErrorCls;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
declare namespace CacheableRequest {
|
|
34
|
+
type StorageAdapter = Store<any>;
|
|
35
|
+
|
|
36
|
+
interface Options {
|
|
37
|
+
/**
|
|
38
|
+
* If the cache should be used. Setting this to `false` will completely bypass the cache for the current request.
|
|
39
|
+
* @default true
|
|
40
|
+
*/
|
|
41
|
+
cache?: boolean | undefined;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* If set to `true` once a cached resource has expired it is deleted and will have to be re-requested.
|
|
45
|
+
*
|
|
46
|
+
* If set to `false`, after a cached resource's TTL expires it is kept in the cache and will be revalidated
|
|
47
|
+
* on the next request with `If-None-Match`/`If-Modified-Since` headers.
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
strictTtl?: boolean | undefined;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Limits TTL. The `number` represents milliseconds.
|
|
54
|
+
* @default undefined
|
|
55
|
+
*/
|
|
56
|
+
maxTtl?: number | undefined;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* When set to `true`, if the DB connection fails we will automatically fallback to a network request.
|
|
60
|
+
* DB errors will still be emitted to notify you of the problem even though the request callback may succeed.
|
|
61
|
+
* @default false
|
|
62
|
+
*/
|
|
63
|
+
automaticFailover?: boolean | undefined;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Forces refreshing the cache. If the response could be retrieved from the cache, it will perform a
|
|
67
|
+
* new request and override the cache instead.
|
|
68
|
+
* @default false
|
|
69
|
+
*/
|
|
70
|
+
forceRefresh?: boolean | undefined;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
interface Emitter extends EventEmitter {
|
|
74
|
+
addListener(event: 'request', listener: (request: ClientRequest) => void): this;
|
|
75
|
+
addListener(
|
|
76
|
+
event: 'response',
|
|
77
|
+
listener: (response: ServerResponse | ResponseLike) => void
|
|
78
|
+
): this;
|
|
79
|
+
addListener(event: 'error', listener: (error: RequestError | CacheError) => void): this;
|
|
80
|
+
on(event: 'request', listener: (request: ClientRequest) => void): this;
|
|
81
|
+
on(event: 'response', listener: (response: ServerResponse | ResponseLike) => void): this;
|
|
82
|
+
on(event: 'error', listener: (error: RequestError | CacheError) => void): this;
|
|
83
|
+
once(event: 'request', listener: (request: ClientRequest) => void): this;
|
|
84
|
+
once(event: 'response', listener: (response: ServerResponse | ResponseLike) => void): this;
|
|
85
|
+
once(event: 'error', listener: (error: RequestError | CacheError) => void): this;
|
|
86
|
+
prependListener(event: 'request', listener: (request: ClientRequest) => void): this;
|
|
87
|
+
prependListener(
|
|
88
|
+
event: 'response',
|
|
89
|
+
listener: (response: ServerResponse | ResponseLike) => void
|
|
90
|
+
): this;
|
|
91
|
+
prependListener(event: 'error', listener: (error: RequestError | CacheError) => void): this;
|
|
92
|
+
prependOnceListener(event: 'request', listener: (request: ClientRequest) => void): this;
|
|
93
|
+
prependOnceListener(
|
|
94
|
+
event: 'response',
|
|
95
|
+
listener: (response: ServerResponse | ResponseLike) => void
|
|
96
|
+
): this;
|
|
97
|
+
prependOnceListener(
|
|
98
|
+
event: 'error',
|
|
99
|
+
listener: (error: RequestError | CacheError) => void
|
|
100
|
+
): this;
|
|
101
|
+
removeListener(event: 'request', listener: (request: ClientRequest) => void): this;
|
|
102
|
+
removeListener(
|
|
103
|
+
event: 'response',
|
|
104
|
+
listener: (response: ServerResponse | ResponseLike) => void
|
|
105
|
+
): this;
|
|
106
|
+
removeListener(event: 'error', listener: (error: RequestError | CacheError) => void): this;
|
|
107
|
+
off(event: 'request', listener: (request: ClientRequest) => void): this;
|
|
108
|
+
off(event: 'response', listener: (response: ServerResponse | ResponseLike) => void): this;
|
|
109
|
+
off(event: 'error', listener: (error: RequestError | CacheError) => void): this;
|
|
110
|
+
removeAllListeners(event?: 'request' | 'response' | 'error'): this;
|
|
111
|
+
listeners(event: 'request'): Array<(request: ClientRequest) => void>;
|
|
112
|
+
listeners(event: 'response'): Array<(response: ServerResponse | ResponseLike) => void>;
|
|
113
|
+
listeners(event: 'error'): Array<(error: RequestError | CacheError) => void>;
|
|
114
|
+
rawListeners(event: 'request'): Array<(request: ClientRequest) => void>;
|
|
115
|
+
rawListeners(event: 'response'): Array<(response: ServerResponse | ResponseLike) => void>;
|
|
116
|
+
rawListeners(event: 'error'): Array<(error: RequestError | CacheError) => void>;
|
|
117
|
+
emit(event: 'request', request: ClientRequest): boolean;
|
|
118
|
+
emit(event: 'response', response: ServerResponse | ResponseLike): boolean;
|
|
119
|
+
emit(event: 'error', error: RequestError | CacheError): boolean;
|
|
120
|
+
eventNames(): Array<'request' | 'response' | 'error'>;
|
|
121
|
+
listenerCount(type: 'request' | 'response' | 'error'): number;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
type RequestError = RequestErrorCls;
|
|
125
|
+
type CacheError = CacheErrorCls;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
declare class RequestErrorCls extends Error {
|
|
129
|
+
readonly name: 'RequestError';
|
|
130
|
+
|
|
131
|
+
constructor(error: Error);
|
|
132
|
+
}
|
|
133
|
+
declare class CacheErrorCls extends Error {
|
|
134
|
+
readonly name: 'CacheError';
|
|
135
|
+
|
|
136
|
+
constructor(error: Error);
|
|
137
|
+
}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import PCancelable = require('../../../../p-cancelable');
|
|
3
|
+
import Request, { Options, Response, RequestError, RequestEvents } from '../core';
|
|
4
|
+
/**
|
|
5
|
+
All parsing methods supported by Got.
|
|
6
|
+
*/
|
|
7
|
+
export declare type ResponseType = 'json' | 'buffer' | 'text';
|
|
8
|
+
export interface PaginationOptions<T, R> {
|
|
9
|
+
/**
|
|
10
|
+
All options accepted by `got.paginate()`.
|
|
11
|
+
*/
|
|
12
|
+
pagination?: {
|
|
13
|
+
/**
|
|
14
|
+
A function that transform [`Response`](#response) into an array of items.
|
|
15
|
+
This is where you should do the parsing.
|
|
16
|
+
|
|
17
|
+
@default response => JSON.parse(response.body)
|
|
18
|
+
*/
|
|
19
|
+
transform?: (response: Response<R>) => Promise<T[]> | T[];
|
|
20
|
+
/**
|
|
21
|
+
Checks whether the item should be emitted or not.
|
|
22
|
+
|
|
23
|
+
@default (item, allItems, currentItems) => true
|
|
24
|
+
*/
|
|
25
|
+
filter?: (item: T, allItems: T[], currentItems: T[]) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
The function takes three arguments:
|
|
28
|
+
- `response` - The current response object.
|
|
29
|
+
- `allItems` - An array of the emitted items.
|
|
30
|
+
- `currentItems` - Items from the current response.
|
|
31
|
+
|
|
32
|
+
It should return an object representing Got options pointing to the next page.
|
|
33
|
+
The options are merged automatically with the previous request, therefore the options returned `pagination.paginate(...)` must reflect changes only.
|
|
34
|
+
If there are no more pages, `false` should be returned.
|
|
35
|
+
|
|
36
|
+
@example
|
|
37
|
+
```
|
|
38
|
+
const got = require('got');
|
|
39
|
+
|
|
40
|
+
(async () => {
|
|
41
|
+
const limit = 10;
|
|
42
|
+
|
|
43
|
+
const items = got.paginate('https://example.com/items', {
|
|
44
|
+
searchParams: {
|
|
45
|
+
limit,
|
|
46
|
+
offset: 0
|
|
47
|
+
},
|
|
48
|
+
pagination: {
|
|
49
|
+
paginate: (response, allItems, currentItems) => {
|
|
50
|
+
const previousSearchParams = response.request.options.searchParams;
|
|
51
|
+
const previousOffset = previousSearchParams.get('offset');
|
|
52
|
+
|
|
53
|
+
if (currentItems.length < limit) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
searchParams: {
|
|
59
|
+
...previousSearchParams,
|
|
60
|
+
offset: Number(previousOffset) + limit,
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
console.log('Items from all pages:', items);
|
|
68
|
+
})();
|
|
69
|
+
```
|
|
70
|
+
*/
|
|
71
|
+
paginate?: (response: Response<R>, allItems: T[], currentItems: T[]) => Options | false;
|
|
72
|
+
/**
|
|
73
|
+
Checks whether the pagination should continue.
|
|
74
|
+
|
|
75
|
+
For example, if you need to stop **before** emitting an entry with some flag, you should use `(item, allItems, currentItems) => !item.flag`.
|
|
76
|
+
If you want to stop **after** emitting the entry, you should use `(item, allItems, currentItems) => allItems.some(entry => entry.flag)` instead.
|
|
77
|
+
|
|
78
|
+
@default (item, allItems, currentItems) => true
|
|
79
|
+
*/
|
|
80
|
+
shouldContinue?: (item: T, allItems: T[], currentItems: T[]) => boolean;
|
|
81
|
+
/**
|
|
82
|
+
The maximum amount of items that should be emitted.
|
|
83
|
+
|
|
84
|
+
@default Infinity
|
|
85
|
+
*/
|
|
86
|
+
countLimit?: number;
|
|
87
|
+
/**
|
|
88
|
+
Milliseconds to wait before the next request is triggered.
|
|
89
|
+
|
|
90
|
+
@default 0
|
|
91
|
+
*/
|
|
92
|
+
backoff?: number;
|
|
93
|
+
/**
|
|
94
|
+
The maximum amount of request that should be triggered.
|
|
95
|
+
Retries on failure are not counted towards this limit.
|
|
96
|
+
|
|
97
|
+
For example, it can be helpful during development to avoid an infinite number of requests.
|
|
98
|
+
|
|
99
|
+
@default 10000
|
|
100
|
+
*/
|
|
101
|
+
requestLimit?: number;
|
|
102
|
+
/**
|
|
103
|
+
Defines how the parameter `allItems` in pagination.paginate, pagination.filter and pagination.shouldContinue is managed.
|
|
104
|
+
When set to `false`, the parameter `allItems` is always an empty array.
|
|
105
|
+
|
|
106
|
+
This option can be helpful to save on memory usage when working with a large dataset.
|
|
107
|
+
*/
|
|
108
|
+
stackAllItems?: boolean;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
export declare type AfterResponseHook = (response: Response, retryWithMergedOptions: (options: Options) => CancelableRequest<Response>) => Response | CancelableRequest<Response> | Promise<Response | CancelableRequest<Response>>;
|
|
112
|
+
export declare namespace PromiseOnly {
|
|
113
|
+
interface Hooks {
|
|
114
|
+
/**
|
|
115
|
+
Called with [response object](#response) and a retry function.
|
|
116
|
+
Calling the retry function will trigger `beforeRetry` hooks.
|
|
117
|
+
|
|
118
|
+
Each function should return the response.
|
|
119
|
+
This is especially useful when you want to refresh an access token.
|
|
120
|
+
|
|
121
|
+
__Note__: When using streams, this hook is ignored.
|
|
122
|
+
|
|
123
|
+
@example
|
|
124
|
+
```
|
|
125
|
+
const got = require('got');
|
|
126
|
+
|
|
127
|
+
const instance = got.extend({
|
|
128
|
+
hooks: {
|
|
129
|
+
afterResponse: [
|
|
130
|
+
(response, retryWithMergedOptions) => {
|
|
131
|
+
if (response.statusCode === 401) { // Unauthorized
|
|
132
|
+
const updatedOptions = {
|
|
133
|
+
headers: {
|
|
134
|
+
token: getNewToken() // Refresh the access token
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
// Save for further requests
|
|
139
|
+
instance.defaults.options = got.mergeOptions(instance.defaults.options, updatedOptions);
|
|
140
|
+
|
|
141
|
+
// Make a new retry
|
|
142
|
+
return retryWithMergedOptions(updatedOptions);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// No changes otherwise
|
|
146
|
+
return response;
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
beforeRetry: [
|
|
150
|
+
(options, error, retryCount) => {
|
|
151
|
+
// This will be called on `retryWithMergedOptions(...)`
|
|
152
|
+
}
|
|
153
|
+
]
|
|
154
|
+
},
|
|
155
|
+
mutableDefaults: true
|
|
156
|
+
});
|
|
157
|
+
```
|
|
158
|
+
*/
|
|
159
|
+
afterResponse?: AfterResponseHook[];
|
|
160
|
+
}
|
|
161
|
+
interface Options extends PaginationOptions<unknown, unknown> {
|
|
162
|
+
/**
|
|
163
|
+
The parsing method.
|
|
164
|
+
|
|
165
|
+
The promise also has `.text()`, `.json()` and `.buffer()` methods which return another Got promise for the parsed body.
|
|
166
|
+
|
|
167
|
+
It's like setting the options to `{responseType: 'json', resolveBodyOnly: true}` but without affecting the main Got promise.
|
|
168
|
+
|
|
169
|
+
__Note__: When using streams, this option is ignored.
|
|
170
|
+
|
|
171
|
+
@example
|
|
172
|
+
```
|
|
173
|
+
(async () => {
|
|
174
|
+
const responsePromise = got(url);
|
|
175
|
+
const bufferPromise = responsePromise.buffer();
|
|
176
|
+
const jsonPromise = responsePromise.json();
|
|
177
|
+
|
|
178
|
+
const [response, buffer, json] = Promise.all([responsePromise, bufferPromise, jsonPromise]);
|
|
179
|
+
// `response` is an instance of Got Response
|
|
180
|
+
// `buffer` is an instance of Buffer
|
|
181
|
+
// `json` is an object
|
|
182
|
+
})();
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
@example
|
|
186
|
+
```
|
|
187
|
+
// This
|
|
188
|
+
const body = await got(url).json();
|
|
189
|
+
|
|
190
|
+
// is semantically the same as this
|
|
191
|
+
const body = await got(url, {responseType: 'json', resolveBodyOnly: true});
|
|
192
|
+
```
|
|
193
|
+
*/
|
|
194
|
+
responseType?: ResponseType;
|
|
195
|
+
/**
|
|
196
|
+
When set to `true` the promise will return the Response body instead of the Response object.
|
|
197
|
+
|
|
198
|
+
@default false
|
|
199
|
+
*/
|
|
200
|
+
resolveBodyOnly?: boolean;
|
|
201
|
+
/**
|
|
202
|
+
Returns a `Stream` instead of a `Promise`.
|
|
203
|
+
This is equivalent to calling `got.stream(url, options?)`.
|
|
204
|
+
|
|
205
|
+
@default false
|
|
206
|
+
*/
|
|
207
|
+
isStream?: boolean;
|
|
208
|
+
/**
|
|
209
|
+
[Encoding](https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings) to be used on `setEncoding` of the response data.
|
|
210
|
+
|
|
211
|
+
To get a [`Buffer`](https://nodejs.org/api/buffer.html), you need to set `responseType` to `buffer` instead.
|
|
212
|
+
Don't set this option to `null`.
|
|
213
|
+
|
|
214
|
+
__Note__: This doesn't affect streams! Instead, you need to do `got.stream(...).setEncoding(encoding)`.
|
|
215
|
+
|
|
216
|
+
@default 'utf-8'
|
|
217
|
+
*/
|
|
218
|
+
encoding?: BufferEncoding;
|
|
219
|
+
}
|
|
220
|
+
interface NormalizedOptions {
|
|
221
|
+
responseType: ResponseType;
|
|
222
|
+
resolveBodyOnly: boolean;
|
|
223
|
+
isStream: boolean;
|
|
224
|
+
encoding?: BufferEncoding;
|
|
225
|
+
pagination?: Required<PaginationOptions<unknown, unknown>['pagination']>;
|
|
226
|
+
}
|
|
227
|
+
interface Defaults {
|
|
228
|
+
responseType: ResponseType;
|
|
229
|
+
resolveBodyOnly: boolean;
|
|
230
|
+
isStream: boolean;
|
|
231
|
+
pagination?: Required<PaginationOptions<unknown, unknown>['pagination']>;
|
|
232
|
+
}
|
|
233
|
+
type HookEvent = 'afterResponse';
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
An error to be thrown when server response code is 2xx, and parsing body fails.
|
|
237
|
+
Includes a `response` property.
|
|
238
|
+
*/
|
|
239
|
+
export declare class ParseError extends RequestError {
|
|
240
|
+
readonly response: Response;
|
|
241
|
+
constructor(error: Error, response: Response);
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
An error to be thrown when the request is aborted with `.cancel()`.
|
|
245
|
+
*/
|
|
246
|
+
export declare class CancelError extends RequestError {
|
|
247
|
+
readonly response: Response;
|
|
248
|
+
constructor(request: Request);
|
|
249
|
+
get isCanceled(): boolean;
|
|
250
|
+
}
|
|
251
|
+
export interface CancelableRequest<T extends Response | Response['body'] = Response['body']> extends PCancelable<T>, RequestEvents<CancelableRequest<T>> {
|
|
252
|
+
json: <ReturnType>() => CancelableRequest<ReturnType>;
|
|
253
|
+
buffer: () => CancelableRequest<Buffer>;
|
|
254
|
+
text: () => CancelableRequest<string>;
|
|
255
|
+
}
|
|
256
|
+
export * from '../core';
|