@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,5 @@
|
|
|
1
|
+
export declare type DnsLookupIpVersion = 'auto' | 'ipv4' | 'ipv6';
|
|
2
|
+
declare type DnsIpFamily = 0 | 4 | 6;
|
|
3
|
+
export declare const isDnsLookupIpVersion: (value: any) => boolean;
|
|
4
|
+
export declare const dnsLookupIpVersionToFamily: (dnsLookupIpVersion: DnsLookupIpVersion) => DnsIpFamily;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { URL } from 'url';
|
|
2
|
+
export interface URLOptions {
|
|
3
|
+
href?: string;
|
|
4
|
+
protocol?: string;
|
|
5
|
+
host?: string;
|
|
6
|
+
hostname?: string;
|
|
7
|
+
port?: string | number;
|
|
8
|
+
pathname?: string;
|
|
9
|
+
search?: string;
|
|
10
|
+
searchParams?: unknown;
|
|
11
|
+
path?: string;
|
|
12
|
+
}
|
|
13
|
+
declare const _default: (origin: string, options: URLOptions) => URL;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ClientRequest } from 'http';
|
|
2
|
+
declare const reentry: unique symbol;
|
|
3
|
+
interface TimedOutOptions {
|
|
4
|
+
host?: string;
|
|
5
|
+
hostname?: string;
|
|
6
|
+
protocol?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface Delays {
|
|
9
|
+
lookup?: number;
|
|
10
|
+
connect?: number;
|
|
11
|
+
secureConnect?: number;
|
|
12
|
+
socket?: number;
|
|
13
|
+
response?: number;
|
|
14
|
+
send?: number;
|
|
15
|
+
request?: number;
|
|
16
|
+
}
|
|
17
|
+
export declare type ErrorCode = 'ETIMEDOUT' | 'ECONNRESET' | 'EADDRINUSE' | 'ECONNREFUSED' | 'EPIPE' | 'ENOTFOUND' | 'ENETUNREACH' | 'EAI_AGAIN';
|
|
18
|
+
export declare class TimeoutError extends Error {
|
|
19
|
+
event: string;
|
|
20
|
+
code: ErrorCode;
|
|
21
|
+
constructor(threshold: number, event: string);
|
|
22
|
+
}
|
|
23
|
+
declare const _default: (request: ClientRequest, delays: Delays, options: TimedOutOptions) => () => void;
|
|
24
|
+
export default _default;
|
|
25
|
+
declare module 'http' {
|
|
26
|
+
interface ClientRequest {
|
|
27
|
+
[reentry]: boolean;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { URL } from 'url';
|
|
3
|
+
import { CancelError } from '../../../p-cancelable';
|
|
4
|
+
import { CancelableRequest, Response, Options, NormalizedOptions, Defaults as DefaultOptions, PaginationOptions, ParseError, RequestError, CacheError, ReadError, HTTPError, MaxRedirectsError, TimeoutError, UnsupportedProtocolError, UploadError } from './as-promise';
|
|
5
|
+
import Request from './core';
|
|
6
|
+
declare type Except<ObjectType, KeysType extends keyof ObjectType> = Pick<ObjectType, Exclude<keyof ObjectType, KeysType>>;
|
|
7
|
+
declare type Merge<FirstType, SecondType> = Except<FirstType, Extract<keyof FirstType, keyof SecondType>> & SecondType;
|
|
8
|
+
/**
|
|
9
|
+
Defaults for each Got instance.
|
|
10
|
+
*/
|
|
11
|
+
export interface InstanceDefaults {
|
|
12
|
+
/**
|
|
13
|
+
An object containing the default options of Got.
|
|
14
|
+
*/
|
|
15
|
+
options: DefaultOptions;
|
|
16
|
+
/**
|
|
17
|
+
An array of functions. You execute them directly by calling `got()`.
|
|
18
|
+
They are some sort of "global hooks" - these functions are called first.
|
|
19
|
+
The last handler (*it's hidden*) is either `asPromise` or `asStream`, depending on the `options.isStream` property.
|
|
20
|
+
|
|
21
|
+
@default []
|
|
22
|
+
*/
|
|
23
|
+
handlers: HandlerFunction[];
|
|
24
|
+
/**
|
|
25
|
+
A read-only boolean describing whether the defaults are mutable or not.
|
|
26
|
+
If set to `true`, you can update headers over time, for example, update an access token when it expires.
|
|
27
|
+
|
|
28
|
+
@default false
|
|
29
|
+
*/
|
|
30
|
+
mutableDefaults: boolean;
|
|
31
|
+
_rawHandlers?: HandlerFunction[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
A Request object returned by calling Got, or any of the Got HTTP alias request functions.
|
|
35
|
+
*/
|
|
36
|
+
export declare type GotReturn = Request | CancelableRequest;
|
|
37
|
+
/**
|
|
38
|
+
A function to handle options and returns a Request object.
|
|
39
|
+
It acts sort of like a "global hook", and will be called before any actual request is made.
|
|
40
|
+
*/
|
|
41
|
+
export declare type HandlerFunction = <T extends GotReturn>(options: NormalizedOptions, next: (options: NormalizedOptions) => T) => T | Promise<T>;
|
|
42
|
+
/**
|
|
43
|
+
The options available for `got.extend()`.
|
|
44
|
+
*/
|
|
45
|
+
export interface ExtendOptions extends Options {
|
|
46
|
+
/**
|
|
47
|
+
An array of functions. You execute them directly by calling `got()`.
|
|
48
|
+
They are some sort of "global hooks" - these functions are called first.
|
|
49
|
+
The last handler (*it's hidden*) is either `asPromise` or `asStream`, depending on the `options.isStream` property.
|
|
50
|
+
|
|
51
|
+
@default []
|
|
52
|
+
*/
|
|
53
|
+
handlers?: HandlerFunction[];
|
|
54
|
+
/**
|
|
55
|
+
A read-only boolean describing whether the defaults are mutable or not.
|
|
56
|
+
If set to `true`, you can update headers over time, for example, update an access token when it expires.
|
|
57
|
+
|
|
58
|
+
@default false
|
|
59
|
+
*/
|
|
60
|
+
mutableDefaults?: boolean;
|
|
61
|
+
}
|
|
62
|
+
export declare type OptionsOfTextResponseBody = Merge<Options, {
|
|
63
|
+
isStream?: false;
|
|
64
|
+
resolveBodyOnly?: false;
|
|
65
|
+
responseType?: 'text';
|
|
66
|
+
}>;
|
|
67
|
+
export declare type OptionsOfJSONResponseBody = Merge<Options, {
|
|
68
|
+
isStream?: false;
|
|
69
|
+
resolveBodyOnly?: false;
|
|
70
|
+
responseType?: 'json';
|
|
71
|
+
}>;
|
|
72
|
+
export declare type OptionsOfBufferResponseBody = Merge<Options, {
|
|
73
|
+
isStream?: false;
|
|
74
|
+
resolveBodyOnly?: false;
|
|
75
|
+
responseType: 'buffer';
|
|
76
|
+
}>;
|
|
77
|
+
export declare type OptionsOfUnknownResponseBody = Merge<Options, {
|
|
78
|
+
isStream?: false;
|
|
79
|
+
resolveBodyOnly?: false;
|
|
80
|
+
}>;
|
|
81
|
+
export declare type StrictOptions = Except<Options, 'isStream' | 'responseType' | 'resolveBodyOnly'>;
|
|
82
|
+
export declare type StreamOptions = Merge<Options, {
|
|
83
|
+
isStream?: true;
|
|
84
|
+
}>;
|
|
85
|
+
declare type ResponseBodyOnly = {
|
|
86
|
+
resolveBodyOnly: true;
|
|
87
|
+
};
|
|
88
|
+
export declare type OptionsWithPagination<T = unknown, R = unknown> = Merge<Options, PaginationOptions<T, R>>;
|
|
89
|
+
/**
|
|
90
|
+
An instance of `got.paginate`.
|
|
91
|
+
*/
|
|
92
|
+
export interface GotPaginate {
|
|
93
|
+
/**
|
|
94
|
+
Same as `GotPaginate.each`.
|
|
95
|
+
*/
|
|
96
|
+
<T, R = unknown>(url: string | URL, options?: OptionsWithPagination<T, R>): AsyncIterableIterator<T>;
|
|
97
|
+
/**
|
|
98
|
+
Same as `GotPaginate.each`.
|
|
99
|
+
*/
|
|
100
|
+
<T, R = unknown>(options?: OptionsWithPagination<T, R>): AsyncIterableIterator<T>;
|
|
101
|
+
/**
|
|
102
|
+
Returns an async iterator.
|
|
103
|
+
|
|
104
|
+
See pagination.options for more pagination options.
|
|
105
|
+
|
|
106
|
+
@example
|
|
107
|
+
```
|
|
108
|
+
(async () => {
|
|
109
|
+
const countLimit = 10;
|
|
110
|
+
|
|
111
|
+
const pagination = got.paginate('https://api.github.com/repos/sindresorhus/got/commits', {
|
|
112
|
+
pagination: {countLimit}
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
console.log(`Printing latest ${countLimit} Got commits (newest to oldest):`);
|
|
116
|
+
|
|
117
|
+
for await (const commitData of pagination) {
|
|
118
|
+
console.log(commitData.commit.message);
|
|
119
|
+
}
|
|
120
|
+
})();
|
|
121
|
+
```
|
|
122
|
+
*/
|
|
123
|
+
each: (<T, R = unknown>(url: string | URL, options?: OptionsWithPagination<T, R>) => AsyncIterableIterator<T>) & (<T, R = unknown>(options?: OptionsWithPagination<T, R>) => AsyncIterableIterator<T>);
|
|
124
|
+
/**
|
|
125
|
+
Returns a Promise for an array of all results.
|
|
126
|
+
|
|
127
|
+
See pagination.options for more pagination options.
|
|
128
|
+
|
|
129
|
+
@example
|
|
130
|
+
```
|
|
131
|
+
(async () => {
|
|
132
|
+
const countLimit = 10;
|
|
133
|
+
|
|
134
|
+
const results = await got.paginate.all('https://api.github.com/repos/sindresorhus/got/commits', {
|
|
135
|
+
pagination: {countLimit}
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
console.log(`Printing latest ${countLimit} Got commits (newest to oldest):`);
|
|
139
|
+
console.log(results);
|
|
140
|
+
})();
|
|
141
|
+
```
|
|
142
|
+
*/
|
|
143
|
+
all: (<T, R = unknown>(url: string | URL, options?: OptionsWithPagination<T, R>) => Promise<T[]>) & (<T, R = unknown>(options?: OptionsWithPagination<T, R>) => Promise<T[]>);
|
|
144
|
+
}
|
|
145
|
+
export interface GotRequestFunction {
|
|
146
|
+
(url: string | URL, options?: OptionsOfTextResponseBody): CancelableRequest<Response<string>>;
|
|
147
|
+
<T>(url: string | URL, options?: OptionsOfJSONResponseBody): CancelableRequest<Response<T>>;
|
|
148
|
+
(url: string | URL, options?: OptionsOfBufferResponseBody): CancelableRequest<Response<Buffer>>;
|
|
149
|
+
(url: string | URL, options?: OptionsOfUnknownResponseBody): CancelableRequest<Response>;
|
|
150
|
+
(options: OptionsOfTextResponseBody): CancelableRequest<Response<string>>;
|
|
151
|
+
<T>(options: OptionsOfJSONResponseBody): CancelableRequest<Response<T>>;
|
|
152
|
+
(options: OptionsOfBufferResponseBody): CancelableRequest<Response<Buffer>>;
|
|
153
|
+
(options: OptionsOfUnknownResponseBody): CancelableRequest<Response>;
|
|
154
|
+
(url: string | URL, options?: (Merge<OptionsOfTextResponseBody, ResponseBodyOnly>)): CancelableRequest<string>;
|
|
155
|
+
<T>(url: string | URL, options?: (Merge<OptionsOfJSONResponseBody, ResponseBodyOnly>)): CancelableRequest<T>;
|
|
156
|
+
(url: string | URL, options?: (Merge<OptionsOfBufferResponseBody, ResponseBodyOnly>)): CancelableRequest<Buffer>;
|
|
157
|
+
(options: (Merge<OptionsOfTextResponseBody, ResponseBodyOnly>)): CancelableRequest<string>;
|
|
158
|
+
<T>(options: (Merge<OptionsOfJSONResponseBody, ResponseBodyOnly>)): CancelableRequest<T>;
|
|
159
|
+
(options: (Merge<OptionsOfBufferResponseBody, ResponseBodyOnly>)): CancelableRequest<Buffer>;
|
|
160
|
+
(url: string | URL, options?: Merge<Options, {
|
|
161
|
+
isStream: true;
|
|
162
|
+
}>): Request;
|
|
163
|
+
(options: Merge<Options, {
|
|
164
|
+
isStream: true;
|
|
165
|
+
}>): Request;
|
|
166
|
+
(url: string | URL, options?: Options): CancelableRequest | Request;
|
|
167
|
+
(options: Options): CancelableRequest | Request;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
All available HTTP request methods provided by Got.
|
|
171
|
+
*/
|
|
172
|
+
export declare type HTTPAlias = 'get' | 'post' | 'put' | 'patch' | 'head' | 'delete';
|
|
173
|
+
interface GotStreamFunction {
|
|
174
|
+
(url: string | URL, options?: Merge<Options, {
|
|
175
|
+
isStream?: true;
|
|
176
|
+
}>): Request;
|
|
177
|
+
(options?: Merge<Options, {
|
|
178
|
+
isStream?: true;
|
|
179
|
+
}>): Request;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
An instance of `got.stream()`.
|
|
183
|
+
*/
|
|
184
|
+
export declare type GotStream = GotStreamFunction & Record<HTTPAlias, GotStreamFunction>;
|
|
185
|
+
/**
|
|
186
|
+
An instance of `got`.
|
|
187
|
+
*/
|
|
188
|
+
export interface Got extends Record<HTTPAlias, GotRequestFunction>, GotRequestFunction {
|
|
189
|
+
/**
|
|
190
|
+
Sets `options.isStream` to `true`.
|
|
191
|
+
|
|
192
|
+
Returns a [duplex stream](https://nodejs.org/api/stream.html#stream_class_stream_duplex) with additional events:
|
|
193
|
+
- request
|
|
194
|
+
- response
|
|
195
|
+
- redirect
|
|
196
|
+
- uploadProgress
|
|
197
|
+
- downloadProgress
|
|
198
|
+
- error
|
|
199
|
+
*/
|
|
200
|
+
stream: GotStream;
|
|
201
|
+
/**
|
|
202
|
+
Returns an async iterator.
|
|
203
|
+
|
|
204
|
+
See pagination.options for more pagination options.
|
|
205
|
+
|
|
206
|
+
@example
|
|
207
|
+
```
|
|
208
|
+
(async () => {
|
|
209
|
+
const countLimit = 10;
|
|
210
|
+
|
|
211
|
+
const pagination = got.paginate('https://api.github.com/repos/sindresorhus/got/commits', {
|
|
212
|
+
pagination: {countLimit}
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
console.log(`Printing latest ${countLimit} Got commits (newest to oldest):`);
|
|
216
|
+
|
|
217
|
+
for await (const commitData of pagination) {
|
|
218
|
+
console.log(commitData.commit.message);
|
|
219
|
+
}
|
|
220
|
+
})();
|
|
221
|
+
```
|
|
222
|
+
*/
|
|
223
|
+
paginate: GotPaginate;
|
|
224
|
+
/**
|
|
225
|
+
The Got defaults used in that instance.
|
|
226
|
+
*/
|
|
227
|
+
defaults: InstanceDefaults;
|
|
228
|
+
/**
|
|
229
|
+
An error to be thrown when a cache method fails. For example, if the database goes down or there's a filesystem error.
|
|
230
|
+
Contains a `code` property with `ERR_CACHE_ACCESS` or a more specific failure code.
|
|
231
|
+
*/
|
|
232
|
+
CacheError: typeof CacheError;
|
|
233
|
+
/**
|
|
234
|
+
An error to be thrown when a request fails. Contains a `code` property with error class code, like `ECONNREFUSED`.
|
|
235
|
+
If there is no specific code supplied, `code` defaults to `ERR_GOT_REQUEST_ERROR`.
|
|
236
|
+
*/
|
|
237
|
+
RequestError: typeof RequestError;
|
|
238
|
+
/**
|
|
239
|
+
An error to be thrown when reading from response stream fails. Contains a `code` property with
|
|
240
|
+
`ERR_READING_RESPONSE_STREAM` or a more specific failure code.
|
|
241
|
+
*/
|
|
242
|
+
ReadError: typeof ReadError;
|
|
243
|
+
/**
|
|
244
|
+
An error to be thrown when server response code is 2xx, and parsing body fails. Includes a
|
|
245
|
+
`response` property. Contains a `code` property with `ERR_BODY_PARSE_FAILURE` or a more specific failure code.
|
|
246
|
+
*/
|
|
247
|
+
ParseError: typeof ParseError;
|
|
248
|
+
/**
|
|
249
|
+
An error to be thrown when the server response code is not 2xx nor 3xx if `options.followRedirect` is `true`, but always except for 304.
|
|
250
|
+
Includes a `response` property. Contains a `code` property with `ERR_NON_2XX_3XX_RESPONSE` or a more specific failure code.
|
|
251
|
+
*/
|
|
252
|
+
HTTPError: typeof HTTPError;
|
|
253
|
+
/**
|
|
254
|
+
An error to be thrown when the server redirects you more than ten times.
|
|
255
|
+
Includes a `response` property. Contains a `code` property with `ERR_TOO_MANY_REDIRECTS`.
|
|
256
|
+
*/
|
|
257
|
+
MaxRedirectsError: typeof MaxRedirectsError;
|
|
258
|
+
/**
|
|
259
|
+
An error to be thrown when given an unsupported protocol. Contains a `code` property with `ERR_UNSUPPORTED_PROTOCOL`.
|
|
260
|
+
*/
|
|
261
|
+
UnsupportedProtocolError: typeof UnsupportedProtocolError;
|
|
262
|
+
/**
|
|
263
|
+
An error to be thrown when the request is aborted due to a timeout.
|
|
264
|
+
Includes an `event` and `timings` property. Contains a `code` property with `ETIMEDOUT`.
|
|
265
|
+
*/
|
|
266
|
+
TimeoutError: typeof TimeoutError;
|
|
267
|
+
/**
|
|
268
|
+
An error to be thrown when the request body is a stream and an error occurs while reading from that stream.
|
|
269
|
+
Contains a `code` property with `ERR_UPLOAD` or a more specific failure code.
|
|
270
|
+
*/
|
|
271
|
+
UploadError: typeof UploadError;
|
|
272
|
+
/**
|
|
273
|
+
An error to be thrown when the request is aborted with `.cancel()`. Contains a `code` property with `ERR_CANCELED`.
|
|
274
|
+
*/
|
|
275
|
+
CancelError: typeof CancelError;
|
|
276
|
+
/**
|
|
277
|
+
Configure a new `got` instance with default `options`.
|
|
278
|
+
The `options` are merged with the parent instance's `defaults.options` using `got.mergeOptions`.
|
|
279
|
+
You can access the resolved options with the `.defaults` property on the instance.
|
|
280
|
+
|
|
281
|
+
Additionally, `got.extend()` accepts two properties from the `defaults` object: `mutableDefaults` and `handlers`.
|
|
282
|
+
|
|
283
|
+
It is also possible to merges many instances into a single one:
|
|
284
|
+
- options are merged using `got.mergeOptions()` (including hooks),
|
|
285
|
+
- handlers are stored in an array (you can access them through `instance.defaults.handlers`).
|
|
286
|
+
|
|
287
|
+
@example
|
|
288
|
+
```js
|
|
289
|
+
const client = got.extend({
|
|
290
|
+
prefixUrl: 'https://example.com',
|
|
291
|
+
headers: {
|
|
292
|
+
'x-unicorn': 'rainbow'
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
client.get('demo');
|
|
297
|
+
|
|
298
|
+
// HTTP Request =>
|
|
299
|
+
// GET /demo HTTP/1.1
|
|
300
|
+
// Host: example.com
|
|
301
|
+
// x-unicorn: rainbow
|
|
302
|
+
```
|
|
303
|
+
*/
|
|
304
|
+
extend: (...instancesOrOptions: Array<Got | ExtendOptions>) => Got;
|
|
305
|
+
/**
|
|
306
|
+
Merges multiple `got` instances into the parent.
|
|
307
|
+
*/
|
|
308
|
+
mergeInstances: (parent: Got, ...instances: Got[]) => Got;
|
|
309
|
+
/**
|
|
310
|
+
Extends parent options.
|
|
311
|
+
Avoid using [object spread](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax#Spread_in_object_literals) as it doesn't work recursively.
|
|
312
|
+
|
|
313
|
+
Options are deeply merged to a new object. The value of each key is determined as follows:
|
|
314
|
+
|
|
315
|
+
- If the new property is not defined, the old value is used.
|
|
316
|
+
- If the new property is explicitly set to `undefined`:
|
|
317
|
+
- If the parent property is a plain `object`, the parent value is deeply cloned.
|
|
318
|
+
- Otherwise, `undefined` is used.
|
|
319
|
+
- If the parent value is an instance of `URLSearchParams`:
|
|
320
|
+
- If the new value is a `string`, an `object` or an instance of `URLSearchParams`, a new `URLSearchParams` instance is created.
|
|
321
|
+
The values are merged using [`urlSearchParams.append(key, value)`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams/append).
|
|
322
|
+
The keys defined in the new value override the keys defined in the parent value.
|
|
323
|
+
- Otherwise, the only available value is `undefined`.
|
|
324
|
+
- If the new property is a plain `object`:
|
|
325
|
+
- If the parent property is a plain `object` too, both values are merged recursively into a new `object`.
|
|
326
|
+
- Otherwise, only the new value is deeply cloned.
|
|
327
|
+
- If the new property is an `Array`, it overwrites the old one with a deep clone of the new property.
|
|
328
|
+
- Properties that are not enumerable, such as `context`, `body`, `json`, and `form`, will not be merged.
|
|
329
|
+
- Otherwise, the new value is assigned to the key.
|
|
330
|
+
|
|
331
|
+
**Note:** Only Got options are merged! Custom user options should be defined via [`options.context`](#context).
|
|
332
|
+
|
|
333
|
+
@example
|
|
334
|
+
```
|
|
335
|
+
const a = {headers: {cat: 'meow', wolf: ['bark', 'wrrr']}};
|
|
336
|
+
const b = {headers: {cow: 'moo', wolf: ['auuu']}};
|
|
337
|
+
|
|
338
|
+
{...a, ...b} // => {headers: {cow: 'moo', wolf: ['auuu']}}
|
|
339
|
+
got.mergeOptions(a, b) // => {headers: {cat: 'meow', cow: 'moo', wolf: ['auuu']}}
|
|
340
|
+
```
|
|
341
|
+
*/
|
|
342
|
+
mergeOptions: (...sources: Options[]) => NormalizedOptions;
|
|
343
|
+
}
|
|
344
|
+
export {};
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
// Type definitions for http-cache-semantics 4.0
|
|
2
|
+
// Project: https://github.com/kornelski/http-cache-semantics#readme
|
|
3
|
+
// Definitions by: BendingBender <https://github.com/BendingBender>
|
|
4
|
+
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
5
|
+
|
|
6
|
+
export = CachePolicy;
|
|
7
|
+
|
|
8
|
+
declare class CachePolicy {
|
|
9
|
+
constructor(req: CachePolicy.Request, res: CachePolicy.Response, options?: CachePolicy.Options);
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Returns `true` if the response can be stored in a cache.
|
|
13
|
+
* If it's `false` then you MUST NOT store either the request or the response.
|
|
14
|
+
*/
|
|
15
|
+
storable(): boolean;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* This is the most important method. Use this method to check whether the cached response is still fresh
|
|
19
|
+
* in the context of the new request.
|
|
20
|
+
*
|
|
21
|
+
* If it returns `true`, then the given `request` matches the original response this cache policy has been
|
|
22
|
+
* created with, and the response can be reused without contacting the server. Note that the old response
|
|
23
|
+
* can't be returned without being updated, see `responseHeaders()`.
|
|
24
|
+
*
|
|
25
|
+
* If it returns `false`, then the response may not be matching at all (e.g. it's for a different URL or method),
|
|
26
|
+
* or may require to be refreshed first (see `revalidationHeaders()`).
|
|
27
|
+
*/
|
|
28
|
+
satisfiesWithoutRevalidation(newRequest: CachePolicy.Request): boolean;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Returns updated, filtered set of response headers to return to clients receiving the cached response.
|
|
32
|
+
* This function is necessary, because proxies MUST always remove hop-by-hop headers (such as `TE` and `Connection`)
|
|
33
|
+
* and update response's `Age` to avoid doubling cache time.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* cachedResponse.headers = cachePolicy.responseHeaders(cachedResponse);
|
|
37
|
+
*/
|
|
38
|
+
responseHeaders(): CachePolicy.Headers;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Returns approximate time in milliseconds until the response becomes stale (i.e. not fresh).
|
|
42
|
+
*
|
|
43
|
+
* After that time (when `timeToLive() <= 0`) the response might not be usable without revalidation. However,
|
|
44
|
+
* there are exceptions, e.g. a client can explicitly allow stale responses, so always check with
|
|
45
|
+
* `satisfiesWithoutRevalidation()`.
|
|
46
|
+
*/
|
|
47
|
+
timeToLive(): number;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Chances are you'll want to store the `CachePolicy` object along with the cached response.
|
|
51
|
+
* `obj = policy.toObject()` gives a plain JSON-serializable object.
|
|
52
|
+
*/
|
|
53
|
+
toObject(): CachePolicy.CachePolicyObject;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* `policy = CachePolicy.fromObject(obj)` creates an instance from object created by `toObject()`.
|
|
57
|
+
*/
|
|
58
|
+
static fromObject(obj: CachePolicy.CachePolicyObject): CachePolicy;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Returns updated, filtered set of request headers to send to the origin server to check if the cached
|
|
62
|
+
* response can be reused. These headers allow the origin server to return status 304 indicating the
|
|
63
|
+
* response is still fresh. All headers unrelated to caching are passed through as-is.
|
|
64
|
+
*
|
|
65
|
+
* Use this method when updating cache from the origin server.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* updateRequest.headers = cachePolicy.revalidationHeaders(updateRequest);
|
|
69
|
+
*/
|
|
70
|
+
revalidationHeaders(newRequest: CachePolicy.Request): CachePolicy.Headers;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Use this method to update the cache after receiving a new response from the origin server.
|
|
74
|
+
*/
|
|
75
|
+
revalidatedPolicy(
|
|
76
|
+
revalidationRequest: CachePolicy.Request,
|
|
77
|
+
revalidationResponse: CachePolicy.Response
|
|
78
|
+
): CachePolicy.RevalidationPolicy;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
declare namespace CachePolicy {
|
|
82
|
+
interface Request {
|
|
83
|
+
url?: string | undefined;
|
|
84
|
+
method?: string | undefined;
|
|
85
|
+
headers: Headers;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
interface Response {
|
|
89
|
+
status?: number | undefined;
|
|
90
|
+
headers: Headers;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
interface Options {
|
|
94
|
+
/**
|
|
95
|
+
* If `true`, then the response is evaluated from a perspective of a shared cache (i.e. `private` is not
|
|
96
|
+
* cacheable and `s-maxage` is respected). If `false`, then the response is evaluated from a perspective
|
|
97
|
+
* of a single-user cache (i.e. `private` is cacheable and `s-maxage` is ignored).
|
|
98
|
+
* `true` is recommended for HTTP clients.
|
|
99
|
+
* @default true
|
|
100
|
+
*/
|
|
101
|
+
shared?: boolean | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* A fraction of response's age that is used as a fallback cache duration. The default is 0.1 (10%),
|
|
104
|
+
* e.g. if a file hasn't been modified for 100 days, it'll be cached for 100*0.1 = 10 days.
|
|
105
|
+
* @default 0.1
|
|
106
|
+
*/
|
|
107
|
+
cacheHeuristic?: number | undefined;
|
|
108
|
+
/**
|
|
109
|
+
* A number of milliseconds to assume as the default time to cache responses with `Cache-Control: immutable`.
|
|
110
|
+
* Note that [per RFC](https://httpwg.org/specs/rfc8246.html#the-immutable-cache-control-extension)
|
|
111
|
+
* these can become stale, so `max-age` still overrides the default.
|
|
112
|
+
* @default 24*3600*1000 (24h)
|
|
113
|
+
*/
|
|
114
|
+
immutableMinTimeToLive?: number | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* If `true`, common anti-cache directives will be completely ignored if the non-standard `pre-check`
|
|
117
|
+
* and `post-check` directives are present. These two useless directives are most commonly found
|
|
118
|
+
* in bad StackOverflow answers and PHP's "session limiter" defaults.
|
|
119
|
+
* @default false
|
|
120
|
+
*/
|
|
121
|
+
ignoreCargoCult?: boolean | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* If `false`, then server's `Date` header won't be used as the base for `max-age`. This is against the RFC,
|
|
124
|
+
* but it's useful if you want to cache responses with very short `max-age`, but your local clock
|
|
125
|
+
* is not exactly in sync with the server's.
|
|
126
|
+
* @default true
|
|
127
|
+
*/
|
|
128
|
+
trustServerDate?: boolean | undefined;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
interface CachePolicyObject {
|
|
132
|
+
v: number;
|
|
133
|
+
t: number;
|
|
134
|
+
sh: boolean;
|
|
135
|
+
ch: number;
|
|
136
|
+
imm: number;
|
|
137
|
+
st: number;
|
|
138
|
+
resh: Headers;
|
|
139
|
+
rescc: { [key: string]: string };
|
|
140
|
+
m: string;
|
|
141
|
+
u?: string | undefined;
|
|
142
|
+
h?: string | undefined;
|
|
143
|
+
a: boolean;
|
|
144
|
+
reqh: Headers | null;
|
|
145
|
+
reqcc: { [key: string]: string };
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
interface Headers {
|
|
149
|
+
[header: string]: string | string[] | undefined;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
interface RevalidationPolicy {
|
|
153
|
+
/**
|
|
154
|
+
* A new `CachePolicy` with HTTP headers updated from `revalidationResponse`. You can always replace
|
|
155
|
+
* the old cached `CachePolicy` with the new one.
|
|
156
|
+
*/
|
|
157
|
+
policy: CachePolicy;
|
|
158
|
+
/**
|
|
159
|
+
* Boolean indicating whether the response body has changed.
|
|
160
|
+
*
|
|
161
|
+
* - If `false`, then a valid 304 Not Modified response has been received, and you can reuse the old
|
|
162
|
+
* cached response body.
|
|
163
|
+
* - If `true`, you should use new response's body (if present), or make another request to the origin
|
|
164
|
+
* server without any conditional headers (i.e. don't use `revalidationHeaders()` this time) to get
|
|
165
|
+
* the new resource.
|
|
166
|
+
*/
|
|
167
|
+
modified: boolean;
|
|
168
|
+
matches: boolean;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
declare namespace pMap {
|
|
2
|
+
interface Options {
|
|
3
|
+
/**
|
|
4
|
+
Number of concurrently pending promises returned by `mapper`.
|
|
5
|
+
|
|
6
|
+
Must be an integer from 1 and up or `Infinity`.
|
|
7
|
+
|
|
8
|
+
@default Infinity
|
|
9
|
+
*/
|
|
10
|
+
readonly concurrency?: number;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
When set to `false`, instead of stopping when a promise rejects, it will wait for all the promises to settle and then reject with an [aggregated error](https://github.com/sindresorhus/aggregate-error) containing all the errors from the rejected promises.
|
|
14
|
+
|
|
15
|
+
@default true
|
|
16
|
+
*/
|
|
17
|
+
readonly stopOnError?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
Function which is called for every item in `input`. Expected to return a `Promise` or value.
|
|
22
|
+
|
|
23
|
+
@param element - Iterated element.
|
|
24
|
+
@param index - Index of the element in the source array.
|
|
25
|
+
*/
|
|
26
|
+
type Mapper<Element = any, NewElement = unknown> = (
|
|
27
|
+
element: Element,
|
|
28
|
+
index: number
|
|
29
|
+
) => NewElement | Promise<NewElement>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
@param input - Iterated over concurrently in the `mapper` function.
|
|
34
|
+
@param mapper - Function which is called for every item in `input`. Expected to return a `Promise` or value.
|
|
35
|
+
@returns A `Promise` that is fulfilled when all promises in `input` and ones returned from `mapper` are fulfilled, or rejects if any of the promises reject. The fulfilled value is an `Array` of the fulfilled values returned from `mapper` in `input` order.
|
|
36
|
+
|
|
37
|
+
@example
|
|
38
|
+
```
|
|
39
|
+
import pMap = require('./p-map');
|
|
40
|
+
import got = require('./got');
|
|
41
|
+
|
|
42
|
+
const sites = [
|
|
43
|
+
getWebsiteFromUsername('https://sindresorhus'), //=> Promise
|
|
44
|
+
'https://ava.li',
|
|
45
|
+
'https://github.com'
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
(async () => {
|
|
49
|
+
const mapper = async site => {
|
|
50
|
+
const {requestUrl} = await got.head(site);
|
|
51
|
+
return requestUrl;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const result = await pMap(sites, mapper, {concurrency: 2});
|
|
55
|
+
|
|
56
|
+
console.log(result);
|
|
57
|
+
//=> ['https://sindresorhus.com/', 'https://ava.li/', 'https://github.com/']
|
|
58
|
+
})();
|
|
59
|
+
```
|
|
60
|
+
*/
|
|
61
|
+
declare function pMap<Element, NewElement>(
|
|
62
|
+
input: Iterable<Element>,
|
|
63
|
+
mapper: pMap.Mapper<Element, NewElement>,
|
|
64
|
+
options?: pMap.Options
|
|
65
|
+
): Promise<NewElement[]>;
|
|
66
|
+
|
|
67
|
+
export = pMap;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{"use strict";var e={964:(e,r,t)=>{const n=t(841);const o=t(111);const cleanInternalStack=e=>e.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g,"");class AggregateError extends Error{constructor(e){if(!Array.isArray(e)){throw new TypeError(`Expected input to be an Array, got ${typeof e}`)}e=[...e].map((e=>{if(e instanceof Error){return e}if(e!==null&&typeof e==="object"){return Object.assign(new Error(e.message),e)}return new Error(e)}));let r=e.map((e=>typeof e.stack==="string"?cleanInternalStack(o(e.stack)):String(e))).join("\n");r="\n"+n(r,4);super(r);this.name="AggregateError";Object.defineProperty(this,"_errors",{value:e})}*[Symbol.iterator](){for(const e of this._errors){yield e}}}e.exports=AggregateError},111:(e,r,t)=>{const n=t(37);const o=/\s+at.*(?:\(|\s)(.*)\)?/;const s=/^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/;const i=typeof n.homedir==="undefined"?"":n.homedir();e.exports=(e,r)=>{r=Object.assign({pretty:false},r);return e.replace(/\\/g,"/").split("\n").filter((e=>{const r=e.match(o);if(r===null||!r[1]){return true}const t=r[1];if(t.includes(".app/Contents/Resources/electron.asar")||t.includes(".app/Contents/Resources/default_app.asar")){return false}return!s.test(t)})).filter((e=>e.trim()!=="")).map((e=>{if(r.pretty){return e.replace(o,((e,r)=>e.replace(r,r.replace(i,"~"))))}return e})).join("\n")}},841:e=>{e.exports=(e,r=1,t)=>{t={indent:" ",includeEmptyLines:false,...t};if(typeof e!=="string"){throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof e}\``)}if(typeof r!=="number"){throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof r}\``)}if(typeof t.indent!=="string"){throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof t.indent}\``)}if(r===0){return e}const n=t.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return e.replace(n,t.indent.repeat(r))}},977:(e,r,t)=>{const n=t(964);e.exports=async(e,r,{concurrency:t=Infinity,stopOnError:o=true}={})=>new Promise(((s,i)=>{if(typeof r!=="function"){throw new TypeError("Mapper function is required")}if(!((Number.isSafeInteger(t)||t===Infinity)&&t>=1)){throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${t}\` (${typeof t})`)}const a=[];const p=[];const c=e[Symbol.iterator]();let f=false;let u=false;let l=0;let y=0;const next=()=>{if(f){return}const e=c.next();const t=y;y++;if(e.done){u=true;if(l===0){if(!o&&p.length!==0){i(new n(p))}else{s(a)}}return}l++;(async()=>{try{const n=await e.value;a[t]=await r(n,t);l--;next()}catch(e){if(o){f=true;i(e)}else{p.push(e);l--;next()}}})()};for(let e=0;e<t;e++){next();if(u){break}}}))},37:e=>{e.exports=require("os")}};var r={};function __nccwpck_require__(t){var n=r[t];if(n!==undefined){return n.exports}var o=r[t]={exports:{}};var s=true;try{e[t](o,o.exports,__nccwpck_require__);s=false}finally{if(s)delete r[t]}return o.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var t=__nccwpck_require__(977);module.exports=t})();
|