@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,17 @@
|
|
|
1
|
+
import type { RollupWatcher } from '../../../compiled/rollup';
|
|
2
|
+
import type { BaseBuildConfig, Input } from '../../types';
|
|
3
|
+
export type { RollupWatcher };
|
|
4
|
+
declare type Config = {
|
|
5
|
+
distDir: string;
|
|
6
|
+
tsconfigPath: string;
|
|
7
|
+
externals: BaseBuildConfig['externals'];
|
|
8
|
+
input: Input;
|
|
9
|
+
watch: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare const runRollup: ({
|
|
12
|
+
distDir,
|
|
13
|
+
tsconfigPath,
|
|
14
|
+
externals,
|
|
15
|
+
input,
|
|
16
|
+
watch
|
|
17
|
+
}: Config) => Promise<RollupWatcher | import("../../../compiled/rollup").RollupBuild>;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __export = (target, all) => {
|
|
25
|
+
for (var name in all)
|
|
26
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
27
|
+
};
|
|
28
|
+
var __copyProps = (to, from, except, desc) => {
|
|
29
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
30
|
+
for (let key of __getOwnPropNames(from))
|
|
31
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
32
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
33
|
+
}
|
|
34
|
+
return to;
|
|
35
|
+
};
|
|
36
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
37
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
38
|
+
mod
|
|
39
|
+
));
|
|
40
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
41
|
+
var __async = (__this, __arguments, generator) => {
|
|
42
|
+
return new Promise((resolve, reject) => {
|
|
43
|
+
var fulfilled = (value) => {
|
|
44
|
+
try {
|
|
45
|
+
step(generator.next(value));
|
|
46
|
+
} catch (e) {
|
|
47
|
+
reject(e);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var rejected = (value) => {
|
|
51
|
+
try {
|
|
52
|
+
step(generator.throw(value));
|
|
53
|
+
} catch (e) {
|
|
54
|
+
reject(e);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
58
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
var rollup_exports = {};
|
|
62
|
+
__export(rollup_exports, {
|
|
63
|
+
runRollup: () => runRollup
|
|
64
|
+
});
|
|
65
|
+
module.exports = __toCommonJS(rollup_exports);
|
|
66
|
+
var import_path = __toESM(require("path"));
|
|
67
|
+
const runRollup = (_0) => __async(void 0, [_0], function* ({
|
|
68
|
+
distDir,
|
|
69
|
+
tsconfigPath,
|
|
70
|
+
externals,
|
|
71
|
+
input,
|
|
72
|
+
watch
|
|
73
|
+
}) {
|
|
74
|
+
const ignoreFiles = {
|
|
75
|
+
name: "ignore-files",
|
|
76
|
+
load(id) {
|
|
77
|
+
if (!/\.(js|jsx|ts|tsx|json)$/.test(id)) {
|
|
78
|
+
return "";
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const ts = yield Promise.resolve().then(() => __toESM(require("typescript")));
|
|
84
|
+
const configFile = ts.readConfigFile(tsconfigPath, ts.sys.readFile);
|
|
85
|
+
const { options } = ts.parseJsonConfigFileContent(
|
|
86
|
+
configFile.config,
|
|
87
|
+
ts.sys,
|
|
88
|
+
"./"
|
|
89
|
+
);
|
|
90
|
+
const { default: jsonPlugin } = yield Promise.resolve().then(() => __toESM(require("../../../compiled/@rollup/plugin-json")));
|
|
91
|
+
const { default: dtsPlugin } = yield Promise.resolve().then(() => __toESM(require("../../../compiled/rollup-plugin-dts")));
|
|
92
|
+
const baseUrl = import_path.default.isAbsolute(options.baseUrl || ".") ? options.baseUrl : import_path.default.join(import_path.default.dirname(tsconfigPath), options.baseUrl || ".");
|
|
93
|
+
const inputConfig = {
|
|
94
|
+
input,
|
|
95
|
+
external: externals,
|
|
96
|
+
plugins: [
|
|
97
|
+
jsonPlugin(),
|
|
98
|
+
ignoreFiles,
|
|
99
|
+
dtsPlugin({
|
|
100
|
+
respectExternal: true,
|
|
101
|
+
compilerOptions: __spreadProps(__spreadValues({
|
|
102
|
+
declarationMap: false,
|
|
103
|
+
skipLibCheck: true,
|
|
104
|
+
preserveSymlinks: false
|
|
105
|
+
}, options), {
|
|
106
|
+
baseUrl,
|
|
107
|
+
declaration: true,
|
|
108
|
+
noEmit: false,
|
|
109
|
+
emitDeclarationOnly: true,
|
|
110
|
+
noEmitOnError: true,
|
|
111
|
+
checkJs: false,
|
|
112
|
+
target: ts.ScriptTarget.ESNext
|
|
113
|
+
})
|
|
114
|
+
})
|
|
115
|
+
].filter(Boolean)
|
|
116
|
+
};
|
|
117
|
+
const outputConfig = {
|
|
118
|
+
dir: distDir,
|
|
119
|
+
format: "esm",
|
|
120
|
+
exports: "named"
|
|
121
|
+
};
|
|
122
|
+
if (watch) {
|
|
123
|
+
const { watch: watch2 } = yield Promise.resolve().then(() => __toESM(require("../../../compiled/rollup")));
|
|
124
|
+
const { watchSectionTitle } = yield Promise.resolve().then(() => __toESM(require("../../utils/log")));
|
|
125
|
+
const { SectionTitleStatus, BundleDtsLogPrefix } = yield Promise.resolve().then(() => __toESM(require("../../constants/log")));
|
|
126
|
+
const watcher = watch2(__spreadProps(__spreadValues({}, inputConfig), {
|
|
127
|
+
plugins: inputConfig.plugins,
|
|
128
|
+
output: outputConfig
|
|
129
|
+
})).on("event", (event) => __async(void 0, null, function* () {
|
|
130
|
+
if (event.code === "START") {
|
|
131
|
+
console.info(
|
|
132
|
+
yield watchSectionTitle(BundleDtsLogPrefix, SectionTitleStatus.Log)
|
|
133
|
+
);
|
|
134
|
+
} else if (event.code === "BUNDLE_END") {
|
|
135
|
+
console.info(
|
|
136
|
+
yield watchSectionTitle(
|
|
137
|
+
BundleDtsLogPrefix,
|
|
138
|
+
SectionTitleStatus.Success
|
|
139
|
+
)
|
|
140
|
+
);
|
|
141
|
+
} else if (event.code === "ERROR") {
|
|
142
|
+
}
|
|
143
|
+
}));
|
|
144
|
+
return watcher;
|
|
145
|
+
} else {
|
|
146
|
+
try {
|
|
147
|
+
const { rollup } = yield Promise.resolve().then(() => __toESM(require("../../../compiled/rollup")));
|
|
148
|
+
const bundle = yield rollup(inputConfig);
|
|
149
|
+
yield bundle.write(outputConfig);
|
|
150
|
+
return bundle;
|
|
151
|
+
} catch (e) {
|
|
152
|
+
if (e instanceof Error) {
|
|
153
|
+
const { InternalDTSError } = yield Promise.resolve().then(() => __toESM(require("../../error")));
|
|
154
|
+
throw new InternalDTSError(e, {
|
|
155
|
+
buildType: "bundle"
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
throw e;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
163
|
+
0 && (module.exports = {
|
|
164
|
+
runRollup
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
//# sourceMappingURL=rollup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAmBV,MAAM,YAAY,CAAO,OAMlB,iBANkB,KAMlB,WANkB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAc;AACZ,QAAM,cAAsB;AAAA,IAC1B,MAAM;AAAA,IACN,KAAK,IAAI;AACP,UAAI,CAAC,0BAA0B,KAAK,EAAE,GAAG;AACvC,eAAO;AAAA,MACT;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACA,QAAM,KAAK,MAAM,6CAAO;AACxB,QAAM,aAAa,GAAG,eAAe,cAAc,GAAG,IAAI,QAAQ;AAClE,QAAM,EAAE,QAAQ,IAAI,GAAG;AAAA,IACrB,WAAW;AAAA,IACX,GAAG;AAAA,IACH;AAAA,EACF;AAEA,QAAM,EAAE,SAAS,WAAW,IAAI,MAAM,6CACpC;AAEF,QAAM,EAAE,SAAS,UAAU,IAAI,MAAM,6CACnC;AAEF,QAAM,UAAU,oBAAK,WAAW,QAAQ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,EAAE,OAAO,IAAI,MAAM,6CAAO;AAChC,YAAM,SAAS,MAAM,OAAO,WAAW;AACvC,YAAM,OAAO,MAAM,YAAY;AAC/B,aAAO;AAAA,IACT,SAAS,GAAP;AACA,UAAI,aAAa,OAAO;AACtB,cAAM,EAAE,iBAAiB,IAAI,MAAM,6CAAO;AAC1C,cAAM,IAAI,iBAAiB,GAAG;AAAA,UAC5B,WAAW;AAAA,QACb,CAAC;AAAA,MACH;AACA,YAAM;AAAA,IACR;AAAA,EACF;AACF;;;;;","names":["watch"],"sources":["../../../src/builder/dts/rollup.ts"],"sourcesContent":["import path from 'path';\nimport type {\n InputOptions,\n OutputOptions,\n Plugin,\n RollupWatcher,\n} from '../../../compiled/rollup';\nimport type { BaseBuildConfig, Input } from '../../types';\n\nexport type { RollupWatcher };\n\ntype Config = {\n distDir: string;\n tsconfigPath: string;\n externals: BaseBuildConfig['externals'];\n input: Input;\n watch: boolean;\n};\n\nexport const runRollup = async ({\n distDir,\n tsconfigPath,\n externals,\n input,\n watch,\n}: Config) => {\n const ignoreFiles: Plugin = {\n name: 'ignore-files',\n load(id) {\n if (!/\\.(js|jsx|ts|tsx|json)$/.test(id)) {\n return '';\n }\n return null;\n },\n };\n const ts = await import('typescript');\n const configFile = ts.readConfigFile(tsconfigPath, ts.sys.readFile);\n const { options } = ts.parseJsonConfigFileContent(\n configFile.config,\n ts.sys,\n './',\n );\n\n const { default: jsonPlugin } = await import(\n '../../../compiled/@rollup/plugin-json'\n );\n const { default: dtsPlugin } = await import(\n '../../../compiled/rollup-plugin-dts'\n );\n const baseUrl = path.isAbsolute(options.baseUrl || '.')\n ? options.baseUrl\n : path.join(path.dirname(tsconfigPath), options.baseUrl || '.');\n const inputConfig: InputOptions = {\n input,\n external: externals,\n plugins: [\n jsonPlugin(),\n ignoreFiles,\n dtsPlugin({\n // use external to prevent them which come from node_modules from be bundled.\n respectExternal: true,\n compilerOptions: {\n declarationMap: false,\n skipLibCheck: true,\n preserveSymlinks: false,\n ...options,\n // isAbsolute\n baseUrl,\n // Ensure \".d.ts\" modules are generated\n declaration: true,\n // Skip \".js\" generation\n noEmit: false,\n emitDeclarationOnly: true,\n // Skip code generation when error occurs\n noEmitOnError: true,\n // Avoid extra work\n checkJs: false,\n // Ensure we can parse the latest code\n target: ts.ScriptTarget.ESNext,\n },\n }),\n ].filter(Boolean),\n };\n const outputConfig: OutputOptions = {\n dir: distDir,\n format: 'esm',\n exports: 'named',\n };\n if (watch) {\n const { watch } = await import('../../../compiled/rollup');\n const { watchSectionTitle } = await import('../../utils/log');\n const { SectionTitleStatus, BundleDtsLogPrefix } = await import(\n '../../constants/log'\n );\n const watcher = watch({\n ...inputConfig,\n plugins: inputConfig.plugins,\n output: outputConfig,\n }).on('event', async event => {\n if (event.code === 'START') {\n console.info(\n await watchSectionTitle(BundleDtsLogPrefix, SectionTitleStatus.Log),\n );\n } else if (event.code === 'BUNDLE_END') {\n console.info(\n await watchSectionTitle(\n BundleDtsLogPrefix,\n SectionTitleStatus.Success,\n ),\n );\n } else if (event.code === 'ERROR') {\n // this is dts rollup plugin bug, error not complete message\n }\n });\n return watcher;\n } else {\n try {\n const { rollup } = await import('../../../compiled/rollup');\n const bundle = await rollup(inputConfig);\n await bundle.write(outputConfig);\n return bundle;\n } catch (e) {\n if (e instanceof Error) {\n const { InternalDTSError } = await import('../../error');\n throw new InternalDTSError(e, {\n buildType: 'bundle',\n });\n }\n throw e;\n }\n }\n};\n"]}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __export = (target, all) => {
|
|
25
|
+
for (var name in all)
|
|
26
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
27
|
+
};
|
|
28
|
+
var __copyProps = (to, from, except, desc) => {
|
|
29
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
30
|
+
for (let key of __getOwnPropNames(from))
|
|
31
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
32
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
33
|
+
}
|
|
34
|
+
return to;
|
|
35
|
+
};
|
|
36
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
37
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
38
|
+
mod
|
|
39
|
+
));
|
|
40
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
41
|
+
var __async = (__this, __arguments, generator) => {
|
|
42
|
+
return new Promise((resolve, reject) => {
|
|
43
|
+
var fulfilled = (value) => {
|
|
44
|
+
try {
|
|
45
|
+
step(generator.next(value));
|
|
46
|
+
} catch (e) {
|
|
47
|
+
reject(e);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var rejected = (value) => {
|
|
51
|
+
try {
|
|
52
|
+
step(generator.throw(value));
|
|
53
|
+
} catch (e) {
|
|
54
|
+
reject(e);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
58
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
var tsc_exports = {};
|
|
62
|
+
__export(tsc_exports, {
|
|
63
|
+
getProjectTsconfig: () => getProjectTsconfig,
|
|
64
|
+
runTsc: () => runTsc
|
|
65
|
+
});
|
|
66
|
+
module.exports = __toCommonJS(tsc_exports);
|
|
67
|
+
const getProjectTsconfig = (tsconfigPath) => __async(void 0, null, function* () {
|
|
68
|
+
const { json5, fs } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
69
|
+
if (!fs.existsSync(tsconfigPath)) {
|
|
70
|
+
return {};
|
|
71
|
+
}
|
|
72
|
+
return json5.parse(fs.readFileSync(tsconfigPath, "utf-8"));
|
|
73
|
+
});
|
|
74
|
+
const resolveLog = (childProgress, options) => __async(void 0, null, function* () {
|
|
75
|
+
var _a, _b, _c;
|
|
76
|
+
const { watch = false, watchFn = () => __async(void 0, null, function* () {
|
|
77
|
+
return void 0;
|
|
78
|
+
}) } = options;
|
|
79
|
+
const { SectionTitleStatus, BundlelessDtsLogPrefix } = yield Promise.resolve().then(() => __toESM(require("../../constants/log")));
|
|
80
|
+
const { watchSectionTitle } = yield Promise.resolve().then(() => __toESM(require("../../utils/log")));
|
|
81
|
+
const { watchDoneText } = yield Promise.resolve().then(() => __toESM(require("../../constants/dts")));
|
|
82
|
+
(_a = childProgress.stdout) == null ? void 0 : _a.on("data", (data) => __async(void 0, null, function* () {
|
|
83
|
+
if (watch) {
|
|
84
|
+
console.info(
|
|
85
|
+
yield watchSectionTitle(BundlelessDtsLogPrefix, SectionTitleStatus.Log)
|
|
86
|
+
);
|
|
87
|
+
console.info(data.toString());
|
|
88
|
+
if (data.toString().includes(watchDoneText)) {
|
|
89
|
+
yield watchFn();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}));
|
|
93
|
+
(_b = childProgress.stdout) == null ? void 0 : _b.on("error", (error) => {
|
|
94
|
+
console.error(error.message);
|
|
95
|
+
});
|
|
96
|
+
(_c = childProgress.stderr) == null ? void 0 : _c.on("data", (chunk) => {
|
|
97
|
+
console.error(chunk.toString());
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
const generatorDts = (config) => __async(void 0, null, function* () {
|
|
101
|
+
const { execa } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
102
|
+
const { InternalDTSError } = yield Promise.resolve().then(() => __toESM(require("../../error")));
|
|
103
|
+
const { generatorTsConfig } = yield Promise.resolve().then(() => __toESM(require("../../utils/dts")));
|
|
104
|
+
const { getTscBinPath } = yield Promise.resolve().then(() => __toESM(require("../../utils/dts")));
|
|
105
|
+
const { tsconfigPath, appDirectory, watch = false } = config;
|
|
106
|
+
const userTsconfig = yield getProjectTsconfig(tsconfigPath);
|
|
107
|
+
const result = yield generatorTsConfig(userTsconfig, config);
|
|
108
|
+
const tscBinFile = yield getTscBinPath(appDirectory);
|
|
109
|
+
const watchParams = watch ? ["-w"] : [];
|
|
110
|
+
const childProgress = execa(
|
|
111
|
+
tscBinFile,
|
|
112
|
+
[
|
|
113
|
+
"-p",
|
|
114
|
+
result.tempTsconfigPath,
|
|
115
|
+
"--pretty",
|
|
116
|
+
"--preserveWatchOutput",
|
|
117
|
+
...watchParams
|
|
118
|
+
],
|
|
119
|
+
{
|
|
120
|
+
stdio: "pipe",
|
|
121
|
+
cwd: appDirectory
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
resolveLog(childProgress, {
|
|
125
|
+
watch,
|
|
126
|
+
watchFn: () => __async(void 0, null, function* () {
|
|
127
|
+
const { resolveAlias } = yield Promise.resolve().then(() => __toESM(require("../../utils/dts")));
|
|
128
|
+
yield resolveAlias(config, __spreadProps(__spreadValues({}, result), { userTsconfig }));
|
|
129
|
+
})
|
|
130
|
+
});
|
|
131
|
+
try {
|
|
132
|
+
yield childProgress;
|
|
133
|
+
} catch (e) {
|
|
134
|
+
if (e instanceof Error) {
|
|
135
|
+
throw new InternalDTSError(e, {
|
|
136
|
+
buildType: "bundleless"
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return __spreadProps(__spreadValues({}, result), { userTsconfig });
|
|
141
|
+
});
|
|
142
|
+
const runTsc = (config) => __async(void 0, null, function* () {
|
|
143
|
+
const { resolveAlias } = yield Promise.resolve().then(() => __toESM(require("../../utils/dts")));
|
|
144
|
+
const result = yield generatorDts(config);
|
|
145
|
+
yield resolveAlias(config, result);
|
|
146
|
+
});
|
|
147
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
148
|
+
0 && (module.exports = {
|
|
149
|
+
getProjectTsconfig,
|
|
150
|
+
runTsc
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
//# sourceMappingURL=tsc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,qBAAqB,CAChC,iBACuB;AACvB,QAAM,EAAE,OAAO,GAAG,IAAI,MAAM,6CAAO;AACnC,MAAI,CAAC,GAAG,WAAW,YAAY,GAAG;AAChC,WAAO,CAAC;AAAA,EACV;AAEA,SAAO,MAAM,MAAM,GAAG,aAAa,cAAc,OAAO,CAAC;AAC3D;AAEA,M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AAA,MAEP;AAAA,MAEA;AAAA,MACA,GAAG;AAAA,IACL;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,KAAK;AAAA,IACP;AAAA,EACF;AAEA,aAAW,eAAe;AAAA,IACxB;AAAA,IACA,SAAS,MAAY;AACnB,YAAM,EAAE,aAAa,IAAI,MAAM,6CAAO;AACtC,YAAM,aAAa,QAAQ,iCAAK,SAAL,EAAa,aAAa,EAAC;AAAA,IACxD;AAAA,EACF,CAAC;AAED,MAAI;AACF,UAAM;AAAA,EACR,SAAS,GAAP;AACA,QAAI,aAAa,OAAO;AACtB,YAAM,IAAI,iBAAiB,GAAG;AAAA,QAC5B,WAAW;AAAA,MACb,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO,iCAAK,SAAL,EAAa,aAAa;AACnC;AAEO,MAAM,SAAS,CAAO,WAAyC;AACpE,QAAM,EAAE,aAAa,IAAI,MAAM,6CAAO;AACtC,QAAM,SAAS,MAAM,aAAa,MAAM;AACxC,QAAM,aAAa,QAAQ,MAAM;AACnC;;;;;;","names":[],"sources":["../../../src/builder/dts/tsc.ts"],"sourcesContent":["import type { ChildProcess } from 'child_process';\nimport type { BundlelessGeneratorDtsConfig, ITsconfig } from '../../types';\n\nexport const getProjectTsconfig = async (\n tsconfigPath: string,\n): Promise<ITsconfig> => {\n const { json5, fs } = await import('@modern-js/utils');\n if (!fs.existsSync(tsconfigPath)) {\n return {};\n }\n\n return json5.parse(fs.readFileSync(tsconfigPath, 'utf-8'));\n};\n\nconst resolveLog = async (\n childProgress: ChildProcess,\n options: {\n watch: boolean;\n watchFn: () => Promise<void>;\n },\n) => {\n const { watch = false, watchFn = async () => undefined } = options;\n const { SectionTitleStatus, BundlelessDtsLogPrefix } = await import(\n '../../constants/log'\n );\n const { watchSectionTitle } = await import('../../utils/log');\n const { watchDoneText } = await import('../../constants/dts');\n\n /**\n * tsc 所有的log信息都是从stdout data 事件中获取\n * 正常模式下,如果有报错信息,交给 resolveLog 后面的逻辑来处理\n * watch 模式下,则使用这里的信息\n */\n childProgress.stdout?.on('data', async data => {\n if (watch) {\n console.info(\n await watchSectionTitle(BundlelessDtsLogPrefix, SectionTitleStatus.Log),\n );\n console.info(data.toString());\n if (data.toString().includes(watchDoneText)) {\n await watchFn();\n }\n }\n });\n // 正常以下内容都不会触发,因为tsc 不会产生以下类型的log信息,不过防止意外情况\n childProgress.stdout?.on('error', error => {\n console.error(error.message);\n });\n childProgress.stderr?.on('data', chunk => {\n console.error(chunk.toString());\n });\n};\n\nconst generatorDts = async (config: BundlelessGeneratorDtsConfig) => {\n const { execa } = await import('@modern-js/utils');\n const { InternalDTSError } = await import('../../error');\n const { generatorTsConfig } = await import('../../utils/dts');\n const { getTscBinPath } = await import('../../utils/dts');\n const { tsconfigPath, appDirectory, watch = false } = config;\n const userTsconfig = await getProjectTsconfig(tsconfigPath);\n const result = await generatorTsConfig(userTsconfig, config);\n\n const tscBinFile = await getTscBinPath(appDirectory);\n\n const watchParams = watch ? ['-w'] : [];\n const childProgress = execa(\n tscBinFile,\n [\n '-p',\n result.tempTsconfigPath,\n /* Required parameter, use it stdout have color */\n '--pretty',\n // https://github.com/microsoft/TypeScript/issues/21824\n '--preserveWatchOutput',\n ...watchParams,\n ],\n {\n stdio: 'pipe',\n cwd: appDirectory,\n },\n );\n\n resolveLog(childProgress, {\n watch,\n watchFn: async () => {\n const { resolveAlias } = await import('../../utils/dts');\n await resolveAlias(config, { ...result, userTsconfig });\n },\n });\n\n try {\n await childProgress;\n } catch (e) {\n if (e instanceof Error) {\n throw new InternalDTSError(e, {\n buildType: 'bundleless',\n });\n }\n }\n\n return { ...result, userTsconfig };\n};\n\nexport const runTsc = async (config: BundlelessGeneratorDtsConfig) => {\n const { resolveAlias } = await import('../../utils/dts');\n const result = await generatorDts(config);\n await resolveAlias(config, result);\n};\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PluginAPI } from '@modern-js/core';
|
|
2
|
+
import type { ModuleContext } from '../types/context';
|
|
3
|
+
import type { BuildCommandOptions, BaseBuildConfig, ModuleTools } from '../types';
|
|
4
|
+
export declare const run: (options: {
|
|
5
|
+
cmdOptions: BuildCommandOptions;
|
|
6
|
+
resolvedBuildConfig: BaseBuildConfig[];
|
|
7
|
+
context: ModuleContext;
|
|
8
|
+
}, api: PluginAPI<ModuleTools>) => Promise<void>;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
var __async = (__this, __arguments, generator) => {
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
var fulfilled = (value) => {
|
|
27
|
+
try {
|
|
28
|
+
step(generator.next(value));
|
|
29
|
+
} catch (e) {
|
|
30
|
+
reject(e);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
var rejected = (value) => {
|
|
34
|
+
try {
|
|
35
|
+
step(generator.throw(value));
|
|
36
|
+
} catch (e) {
|
|
37
|
+
reject(e);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
41
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var builder_exports = {};
|
|
45
|
+
__export(builder_exports, {
|
|
46
|
+
run: () => run
|
|
47
|
+
});
|
|
48
|
+
module.exports = __toCommonJS(builder_exports);
|
|
49
|
+
const run = (options, api) => __async(void 0, null, function* () {
|
|
50
|
+
const { chalk } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
51
|
+
const { resolvedBuildConfig, context, cmdOptions } = options;
|
|
52
|
+
const runner = api.useHookRunners();
|
|
53
|
+
let totalDuration = 0;
|
|
54
|
+
if (resolvedBuildConfig.length !== 0) {
|
|
55
|
+
const { buildSuccessText } = yield Promise.resolve().then(() => __toESM(require("../constants/log")));
|
|
56
|
+
totalDuration = Date.now();
|
|
57
|
+
!cmdOptions.watch && console.time(buildSuccessText);
|
|
58
|
+
const { runBuildTask } = yield Promise.resolve().then(() => __toESM(require("./build")));
|
|
59
|
+
const { default: pMap } = yield Promise.resolve().then(() => __toESM(require("../../compiled/p-map")));
|
|
60
|
+
const { clearBuildConfigPaths, clearDtsTemp } = yield Promise.resolve().then(() => __toESM(require("./clear")));
|
|
61
|
+
yield clearBuildConfigPaths(resolvedBuildConfig);
|
|
62
|
+
yield clearDtsTemp();
|
|
63
|
+
if (cmdOptions.watch) {
|
|
64
|
+
console.info(chalk.blue.underline("start build in watch mode...\n"));
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
yield pMap(resolvedBuildConfig, (config) => __async(void 0, null, function* () {
|
|
68
|
+
const buildConfig = yield runner.beforeBuildTask(
|
|
69
|
+
{
|
|
70
|
+
config,
|
|
71
|
+
options: cmdOptions
|
|
72
|
+
},
|
|
73
|
+
{ onLast: (c) => __async(void 0, null, function* () {
|
|
74
|
+
return c.config;
|
|
75
|
+
}) }
|
|
76
|
+
);
|
|
77
|
+
yield runBuildTask(
|
|
78
|
+
{
|
|
79
|
+
buildConfig,
|
|
80
|
+
buildCmdOptions: cmdOptions,
|
|
81
|
+
context
|
|
82
|
+
},
|
|
83
|
+
api
|
|
84
|
+
);
|
|
85
|
+
yield runner.afterBuildTask({ status: "success", config });
|
|
86
|
+
}));
|
|
87
|
+
!cmdOptions.watch && console.timeEnd(buildSuccessText);
|
|
88
|
+
} catch (e) {
|
|
89
|
+
const { isInternalError, ModuleBuildError } = yield Promise.resolve().then(() => __toESM(require("../error")));
|
|
90
|
+
if (isInternalError(e)) {
|
|
91
|
+
throw new ModuleBuildError(e);
|
|
92
|
+
} else {
|
|
93
|
+
throw e;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
totalDuration = Date.now() - totalDuration;
|
|
97
|
+
} else {
|
|
98
|
+
console.warn(
|
|
99
|
+
chalk.yellow(
|
|
100
|
+
`No build configuration found! Please configure \`buildConfig\` or \`buildPreset\``
|
|
101
|
+
)
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
yield runner.afterBuild({
|
|
105
|
+
status: "success",
|
|
106
|
+
config: resolvedBuildConfig,
|
|
107
|
+
commandOptions: cmdOptions,
|
|
108
|
+
totalDuration
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
112
|
+
0 && (module.exports = {
|
|
113
|
+
run
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;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MAC9B,OAAO;AACL,cAAM;AAAA,MACR;AAAA,IACF;AACA,oBAAgB,KAAK,IAAI,IAAI;AAAA,EAC/B,OAAO;AACL,YAAQ;AAAA,MACN,MAAM;AAAA,QACJ;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,QAAM,OAAO,WAAW;AAAA,IACtB,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB;AAAA,EACF,CAAC;AACH;;;;;","names":[],"sources":["../../src/builder/index.ts"],"sourcesContent":["import type { PluginAPI } from '@modern-js/core';\nimport type { ModuleContext } from '../types/context';\nimport type {\n BuildCommandOptions,\n BaseBuildConfig,\n ModuleTools,\n} from '../types';\n\nexport const run = async (\n options: {\n cmdOptions: BuildCommandOptions;\n resolvedBuildConfig: BaseBuildConfig[];\n context: ModuleContext;\n },\n api: PluginAPI<ModuleTools>,\n) => {\n const { chalk } = await import('@modern-js/utils');\n const { resolvedBuildConfig, context, cmdOptions } = options;\n const runner = api.useHookRunners();\n\n let totalDuration = 0;\n\n if (resolvedBuildConfig.length !== 0) {\n const { buildSuccessText } = await import('../constants/log');\n totalDuration = Date.now();\n // eslint-disable-next-line no-console\n !cmdOptions.watch && console.time(buildSuccessText);\n\n const { runBuildTask } = await import('./build');\n const { default: pMap } = await import('../../compiled/p-map');\n\n const { clearBuildConfigPaths, clearDtsTemp } = await import('./clear');\n await clearBuildConfigPaths(resolvedBuildConfig);\n await clearDtsTemp();\n\n if (cmdOptions.watch) {\n console.info(chalk.blue.underline('start build in watch mode...\\n'));\n }\n\n try {\n await pMap(resolvedBuildConfig, async config => {\n const buildConfig = await runner.beforeBuildTask(\n {\n config,\n options: cmdOptions,\n },\n { onLast: async c => c.config },\n );\n await runBuildTask(\n {\n buildConfig,\n buildCmdOptions: cmdOptions,\n context,\n },\n api,\n );\n await runner.afterBuildTask({ status: 'success', config });\n });\n // eslint-disable-next-line no-console\n !cmdOptions.watch && console.timeEnd(buildSuccessText);\n } catch (e) {\n const { isInternalError, ModuleBuildError } = await import('../error');\n if (isInternalError(e)) {\n throw new ModuleBuildError(e);\n } else {\n throw e;\n }\n }\n totalDuration = Date.now() - totalDuration;\n } else {\n console.warn(\n chalk.yellow(\n `No build configuration found! Please configure \\`buildConfig\\` or \\`buildPreset\\``,\n ),\n );\n }\n\n await runner.afterBuild({\n status: 'success',\n config: resolvedBuildConfig,\n commandOptions: cmdOptions,\n totalDuration,\n });\n};\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { PluginAPI } from '@modern-js/core';
|
|
2
|
+
import { ModuleContext } from '../types/context';
|
|
3
|
+
import { BuildCommandOptions, ModuleTools } from '../types';
|
|
4
|
+
export declare const buildPlatform: (options: BuildCommandOptions, api: PluginAPI<ModuleTools>, context: ModuleContext) => Promise<void>;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
var __async = (__this, __arguments, generator) => {
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
var fulfilled = (value) => {
|
|
27
|
+
try {
|
|
28
|
+
step(generator.next(value));
|
|
29
|
+
} catch (e) {
|
|
30
|
+
reject(e);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
var rejected = (value) => {
|
|
34
|
+
try {
|
|
35
|
+
step(generator.throw(value));
|
|
36
|
+
} catch (e) {
|
|
37
|
+
reject(e);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
41
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var platform_exports = {};
|
|
45
|
+
__export(platform_exports, {
|
|
46
|
+
buildPlatform: () => buildPlatform
|
|
47
|
+
});
|
|
48
|
+
module.exports = __toCommonJS(platform_exports);
|
|
49
|
+
const buildPlatform = (options, api, context) => __async(void 0, null, function* () {
|
|
50
|
+
const { chalk } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
51
|
+
const { blue, gray } = yield Promise.resolve().then(() => __toESM(require("../constants/colors")));
|
|
52
|
+
const runner = api.useHookRunners();
|
|
53
|
+
const platformBuilders = yield runner.registerBuildPlatform();
|
|
54
|
+
if (platformBuilders.length === 0) {
|
|
55
|
+
if (options.platform === true) {
|
|
56
|
+
console.info("No executable platform build tasks");
|
|
57
|
+
} else if (Array.isArray(options.platform) && options.platform.length === 1) {
|
|
58
|
+
console.info(
|
|
59
|
+
`No build tasks with platform "${options.platform[0]}" found`
|
|
60
|
+
);
|
|
61
|
+
} else if (Array.isArray(options.platform) && options.platform.length > 1) {
|
|
62
|
+
console.info(
|
|
63
|
+
`No build tasks with platform ${options.platform.join(",")} found`
|
|
64
|
+
);
|
|
65
|
+
} else {
|
|
66
|
+
console.info("Unknown platform", JSON.stringify(options.platform));
|
|
67
|
+
}
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
yield runner.beforeBuildPlatform(platformBuilders);
|
|
71
|
+
if (options.platform === true) {
|
|
72
|
+
for (const platformBuilder of platformBuilders) {
|
|
73
|
+
const currentPlatform = Array.isArray(platformBuilder.platform) ? platformBuilder.platform[0] : platformBuilder.platform;
|
|
74
|
+
console.info(
|
|
75
|
+
chalk.underline.rgb(...blue)(
|
|
76
|
+
`Running [${currentPlatform}] build task:`
|
|
77
|
+
)
|
|
78
|
+
);
|
|
79
|
+
yield runner.buildPlatform({ platform: currentPlatform });
|
|
80
|
+
yield platformBuilder.build(currentPlatform, {
|
|
81
|
+
isTsProject: context.isTsProject
|
|
82
|
+
});
|
|
83
|
+
console.info(chalk.rgb(...gray)(`Done for [${currentPlatform}] task`));
|
|
84
|
+
}
|
|
85
|
+
} else if (Array.isArray(options.platform) && options.platform.length === 1) {
|
|
86
|
+
const targetPlatform = options.platform[0];
|
|
87
|
+
const selectPlatformBuilder = platformBuilders.find((builder) => {
|
|
88
|
+
if (Array.isArray(builder.platform)) {
|
|
89
|
+
return builder.platform.includes(targetPlatform);
|
|
90
|
+
}
|
|
91
|
+
return builder.platform === targetPlatform;
|
|
92
|
+
});
|
|
93
|
+
if (!selectPlatformBuilder) {
|
|
94
|
+
console.info(`The specified "${targetPlatform}" build does not exist`);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
console.info(
|
|
98
|
+
chalk.underline.rgb(...blue)(`Running [${targetPlatform}] build task:`)
|
|
99
|
+
);
|
|
100
|
+
yield runner.buildPlatform({ platform: targetPlatform });
|
|
101
|
+
yield selectPlatformBuilder.build(targetPlatform, {
|
|
102
|
+
isTsProject: context.isTsProject
|
|
103
|
+
});
|
|
104
|
+
console.info(chalk.rgb(...gray)(`Done for [${targetPlatform}] task`));
|
|
105
|
+
} else if (Array.isArray(options.platform) && options.platform.length > 1) {
|
|
106
|
+
for (const platform of options.platform) {
|
|
107
|
+
const foundBuilder = platformBuilders.find((builder) => {
|
|
108
|
+
if (Array.isArray(builder.platform)) {
|
|
109
|
+
return builder.platform.includes(platform);
|
|
110
|
+
}
|
|
111
|
+
return builder.platform === platform;
|
|
112
|
+
});
|
|
113
|
+
if (!foundBuilder) {
|
|
114
|
+
console.info(`skip ${platform} build, because it does not exist`);
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
console.info(
|
|
118
|
+
chalk.underline.rgb(...blue)(`Running [${platform}] build task:`)
|
|
119
|
+
);
|
|
120
|
+
yield runner.buildPlatform({ platform });
|
|
121
|
+
yield foundBuilder.build(platform, { isTsProject: context.isTsProject });
|
|
122
|
+
console.info(chalk.rgb(...gray)(`Done for [${platform}] task`));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
yield runner.afterBuildPlatform();
|
|
126
|
+
});
|
|
127
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
128
|
+
0 && (module.exports = {
|
|
129
|
+
buildPlatform
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
//# sourceMappingURL=platform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,MAAM,gBAAgB,CAC3B,SACA,KACA,YACG;AACH,QAAM,EAAE,MAAM,IAAI,MAAM,6CAAO;AAC/B,QAAM,EAAE,MAAM,KAAK,IAAI,MAAM,6CAAO;AACpC,QAAM,SAAS,IAAI,eAAe;AAClC,QAAM,mBAAmB,MAAM,OAAO,sBAAsB;AAC5D,MAAI,iBAAiB,WAAW,GAAG;AACjC,QAAI,QAAQ,aAAa,MAAM;AAC7B,cAAQ,KAA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sCAAsC;AACrE;AAAA,IACF;AAEA,YAAQ;AAAA,MACN,MAAM,UAAU,IAAI,GAAG,IAAI,EAAE,YAAY,6BAA6B;AAAA,IACxE;AAEA,UAAM,OAAO,cAAc,EAAE,UAAU,eAAe,CAAC;AACvD,UAAM,sBAAsB,MAAM,gBAAgB;AAAA,MAChD,aAAa,QAAQ;AAAA,IACvB,CAAC;AAED,YAAQ,KAAK,MAAM,IAAI,GAAG,IAAI,EAAE,aAAa,sBAAsB,CAAC;AAAA,EACtE,WAAW,MAAM,QAAQ,QAAQ,QAAQ,KAAK,QAAQ,SAAS,SAAS,GAAG;AACzE,eAAW,YAAY,QAAQ,UAAU;AACvC,YAAM,eAAe,iBAAiB,KAAK,aAAW;AACpD,YAAI,MAAM,QAAQ,QAAQ,QAAQ,GAAG;AACnC,iBAAO,QAAQ,SAAS,SAAS,QAAQ;AAAA,QAC3C;AAEA,eAAO,QAAQ,aAAa;AAAA,MAC9B,CAAC;AAED,UAAI,CAAC,cAAc;AACjB,gBAAQ,KAAK,QAAQ,2CAA2C;AAChE;AAAA,MACF;AAEA,cAAQ;AAAA,QACN,MAAM,UAAU,IAAI,GAAG,IAAI,EAAE,YAAY,uBAAuB;AAAA,MAClE;AAEA,YAAM,OAAO,cAAc,EAAE,SAAS,CAAC;AACvC,YAAM,aAAa,MAAM,UAAU,EAAE,aAAa,QAAQ,YAAY,CAAC;AAEvE,cAAQ,KAAK,MAAM,IAAI,GAAG,IAAI,EAAE,aAAa,gBAAgB,CAAC;AAAA,IAChE;AAAA,EACF;AAEA,QAAM,OAAO,mBAAmB;AAClC;;;;;","names":[],"sources":["../../src/builder/platform.ts"],"sourcesContent":["import { PluginAPI } from '@modern-js/core';\nimport { ModuleContext } from '../types/context';\nimport { BuildCommandOptions, ModuleTools } from '../types';\n\nexport const buildPlatform = async (\n options: BuildCommandOptions,\n api: PluginAPI<ModuleTools>,\n context: ModuleContext,\n) => {\n const { chalk } = await import('@modern-js/utils');\n const { blue, gray } = await import('../constants/colors');\n const runner = api.useHookRunners();\n const platformBuilders = await runner.registerBuildPlatform();\n if (platformBuilders.length === 0) {\n if (options.platform === true) {\n console.info('No executable platform build tasks');\n } else if (\n Array.isArray(options.platform) &&\n options.platform.length === 1\n ) {\n console.info(\n `No build tasks with platform \"${options.platform[0]}\" found`,\n );\n } else if (Array.isArray(options.platform) && options.platform.length > 1) {\n console.info(\n `No build tasks with platform ${options.platform.join(',')} found`,\n );\n } else {\n console.info('Unknown platform', JSON.stringify(options.platform));\n }\n\n return;\n }\n\n await runner.beforeBuildPlatform(platformBuilders);\n if (options.platform === true) {\n for (const platformBuilder of platformBuilders) {\n const currentPlatform = Array.isArray(platformBuilder.platform)\n ? platformBuilder.platform[0]\n : platformBuilder.platform;\n\n console.info(\n chalk.underline.rgb(...blue)(\n `Running [${currentPlatform}] build task:`,\n ),\n );\n\n await runner.buildPlatform({ platform: currentPlatform });\n await platformBuilder.build(currentPlatform, {\n isTsProject: context.isTsProject,\n });\n\n console.info(chalk.rgb(...gray)(`Done for [${currentPlatform}] task`));\n }\n } else if (Array.isArray(options.platform) && options.platform.length === 1) {\n const targetPlatform = options.platform[0];\n const selectPlatformBuilder = platformBuilders.find(builder => {\n if (Array.isArray(builder.platform)) {\n return builder.platform.includes(targetPlatform);\n }\n\n return builder.platform === targetPlatform;\n });\n\n if (!selectPlatformBuilder) {\n console.info(`The specified \"${targetPlatform}\" build does not exist`);\n return;\n }\n\n console.info(\n chalk.underline.rgb(...blue)(`Running [${targetPlatform}] build task:`),\n );\n\n await runner.buildPlatform({ platform: targetPlatform });\n await selectPlatformBuilder.build(targetPlatform, {\n isTsProject: context.isTsProject,\n });\n\n console.info(chalk.rgb(...gray)(`Done for [${targetPlatform}] task`));\n } else if (Array.isArray(options.platform) && options.platform.length > 1) {\n for (const platform of options.platform) {\n const foundBuilder = platformBuilders.find(builder => {\n if (Array.isArray(builder.platform)) {\n return builder.platform.includes(platform);\n }\n\n return builder.platform === platform;\n });\n\n if (!foundBuilder) {\n console.info(`skip ${platform} build, because it does not exist`);\n continue;\n }\n\n console.info(\n chalk.underline.rgb(...blue)(`Running [${platform}] build task:`),\n );\n\n await runner.buildPlatform({ platform });\n await foundBuilder.build(platform, { isTsProject: context.isTsProject });\n\n console.info(chalk.rgb(...gray)(`Done for [${platform}] task`));\n }\n }\n\n await runner.afterBuildPlatform();\n};\n"]}
|
package/dist/cli.d.ts
ADDED