@modern-js/module-tools 2.0.0-beta.2 → 2.0.0-beta.4
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 +276 -205
- package/bin/modern.js +7 -1
- 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 +265 -0
- package/dist/builder/build.js.map +1 -0
- package/dist/builder/clear.d.ts +3 -0
- package/dist/builder/clear.js +74 -0
- package/dist/builder/clear.js.map +1 -0
- package/dist/builder/copy.d.ts +9 -0
- package/dist/builder/copy.js +207 -0
- package/dist/builder/copy.js.map +1 -0
- package/dist/builder/dts/index.d.ts +2 -0
- package/dist/builder/dts/index.js +27 -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 +180 -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 +160 -0
- package/dist/builder/dts/tsc.js.map +1 -0
- package/dist/builder/index.d.ts +8 -0
- package/dist/builder/index.js +124 -0
- package/dist/builder/index.js.map +1 -0
- package/dist/builder/platform.d.ts +4 -0
- package/dist/builder/platform.js +140 -0
- package/dist/builder/platform.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +103 -0
- package/dist/cli.js.map +1 -0
- package/dist/command.d.ts +7 -0
- package/dist/command.js +169 -0
- package/dist/command.js.map +1 -0
- package/dist/config/defineConfig.d.ts +2 -0
- package/dist/config/defineConfig.js +25 -0
- package/dist/config/defineConfig.js.map +1 -0
- package/dist/config/normalize.d.ts +17 -0
- package/dist/config/normalize.js +177 -0
- package/dist/config/normalize.js.map +1 -0
- package/dist/config/schema.d.ts +641 -0
- package/dist/config/schema.js +207 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/constants/build-presets.d.ts +81 -0
- package/dist/constants/build-presets.js +219 -0
- package/dist/constants/build-presets.js.map +1 -0
- package/dist/constants/build.d.ts +5 -0
- package/dist/constants/build.js +71 -0
- package/dist/constants/build.js.map +1 -0
- package/dist/constants/colors.d.ts +4 -0
- package/dist/constants/colors.js +29 -0
- package/dist/constants/colors.js.map +1 -0
- package/dist/constants/dts.d.ts +4 -0
- package/dist/constants/dts.js +45 -0
- package/dist/constants/dts.js.map +1 -0
- package/dist/constants/file.d.ts +3 -0
- package/dist/constants/file.js +29 -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 +189 -0
- package/dist/constants/legacy-build-presets.js.map +1 -0
- package/dist/constants/log.d.ts +8 -0
- package/dist/constants/log.js +36 -0
- package/dist/constants/log.js.map +1 -0
- package/dist/dev.d.ts +10 -0
- package/dist/dev.js +135 -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 +139 -0
- package/dist/error.js.map +1 -0
- package/dist/hooks/build.d.ts +22 -0
- package/dist/hooks/build.js +35 -0
- package/dist/hooks/build.js.map +1 -0
- package/dist/hooks/dev.d.ts +12 -0
- package/dist/hooks/dev.js +33 -0
- package/dist/hooks/dev.js.map +1 -0
- package/dist/hooks/index.d.ts +29 -0
- package/dist/hooks/index.js +44 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/misc.d.ts +5 -0
- package/dist/hooks/misc.js +29 -0
- package/dist/hooks/misc.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/{types/locale → locale}/en.d.ts +0 -0
- package/dist/locale/en.js +47 -0
- package/dist/locale/en.js.map +1 -0
- package/dist/{types/locale → locale}/index.d.ts +0 -0
- package/dist/locale/index.js +34 -0
- package/dist/locale/index.js.map +1 -0
- package/dist/{types/locale → locale}/zh.d.ts +0 -0
- package/dist/locale/zh.js +47 -0
- package/dist/locale/zh.js.map +1 -0
- package/dist/plugins.d.ts +2 -0
- package/dist/plugins.js +51 -0
- package/dist/plugins.js.map +1 -0
- package/dist/types/color.d.ts +1 -0
- package/dist/{js/modern/features/build/types.js → types/color.js} +0 -0
- package/dist/types/command.d.ts +11 -0
- package/dist/{js/modern/schema/types.js → types/command.js} +0 -0
- package/dist/types/config/index.d.ts +95 -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/{js/modern/types.js → types/config/style.js} +0 -0
- package/dist/types/context.d.ts +5 -0
- package/dist/{js/node/features/build/types.js → types/context.js} +0 -0
- package/dist/types/copy.d.ts +15 -0
- package/dist/{js/node/schema/types.js → types/copy.js} +0 -0
- package/dist/types/{utils/tsconfig.d.ts → dts.d.ts} +11 -3
- package/dist/{js/node/types.js → types/dts.js} +0 -0
- package/dist/types/hooks.d.ts +25 -0
- package/dist/types/hooks.js +0 -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 +0 -0
- package/dist/utils/builder.d.ts +8 -0
- package/dist/utils/builder.js +117 -0
- package/dist/utils/builder.js.map +1 -0
- package/dist/utils/config.d.ts +6 -0
- package/dist/utils/config.js +172 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/context.d.ts +7 -0
- package/dist/utils/context.js +68 -0
- package/dist/utils/context.js.map +1 -0
- package/dist/utils/dts.d.ts +14 -0
- package/dist/utils/dts.js +197 -0
- package/dist/utils/dts.js.map +1 -0
- package/dist/utils/input.d.ts +16 -0
- package/dist/utils/input.js +124 -0
- package/dist/utils/input.js.map +1 -0
- package/dist/utils/language.d.ts +2 -0
- package/dist/utils/language.js +75 -0
- package/dist/utils/language.js.map +1 -0
- package/dist/utils/libuild-plugins.d.ts +6 -0
- package/dist/utils/libuild-plugins.js +90 -0
- package/dist/utils/libuild-plugins.js.map +1 -0
- package/dist/utils/log.d.ts +2 -0
- package/dist/utils/log.js +76 -0
- package/dist/utils/log.js.map +1 -0
- package/dist/utils/onExit.d.ts +1 -0
- package/dist/utils/onExit.js +71 -0
- package/dist/utils/onExit.js.map +1 -0
- package/dist/utils/path.d.ts +1 -0
- package/dist/utils/path.js +73 -0
- package/dist/utils/path.js.map +1 -0
- package/dist/utils/style.d.ts +31 -0
- package/dist/utils/style.js +134 -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 +115 -0
- package/dist/utils/tspaths-transform.js.map +1 -0
- package/package.json +47 -73
- 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/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/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/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/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,180 @@
|
|
|
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 stdin_exports = {};
|
|
25
|
+
__export(stdin_exports, {
|
|
26
|
+
runRollup: () => runRollup
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
29
|
+
var import_path = __toESM(require("path"));
|
|
30
|
+
var __create2 = Object.create;
|
|
31
|
+
var __defProp2 = Object.defineProperty;
|
|
32
|
+
var __defProps = Object.defineProperties;
|
|
33
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
34
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
35
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
36
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
37
|
+
var __getProtoOf2 = Object.getPrototypeOf;
|
|
38
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
39
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
40
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
41
|
+
var __spreadValues = (a, b) => {
|
|
42
|
+
for (var prop in b || (b = {}))
|
|
43
|
+
if (__hasOwnProp2.call(b, prop))
|
|
44
|
+
__defNormalProp(a, prop, b[prop]);
|
|
45
|
+
if (__getOwnPropSymbols)
|
|
46
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
47
|
+
if (__propIsEnum.call(b, prop))
|
|
48
|
+
__defNormalProp(a, prop, b[prop]);
|
|
49
|
+
}
|
|
50
|
+
return a;
|
|
51
|
+
};
|
|
52
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
53
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
54
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
55
|
+
for (let key of __getOwnPropNames2(from))
|
|
56
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
57
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
58
|
+
}
|
|
59
|
+
return to;
|
|
60
|
+
};
|
|
61
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
62
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
63
|
+
mod
|
|
64
|
+
));
|
|
65
|
+
var __async = (__this, __arguments, generator) => {
|
|
66
|
+
return new Promise((resolve, reject) => {
|
|
67
|
+
var fulfilled = (value) => {
|
|
68
|
+
try {
|
|
69
|
+
step(generator.next(value));
|
|
70
|
+
} catch (e) {
|
|
71
|
+
reject(e);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
var rejected = (value) => {
|
|
75
|
+
try {
|
|
76
|
+
step(generator.throw(value));
|
|
77
|
+
} catch (e) {
|
|
78
|
+
reject(e);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
82
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
const runRollup = (_0) => __async(void 0, [_0], function* ({
|
|
86
|
+
distDir,
|
|
87
|
+
tsconfigPath,
|
|
88
|
+
externals,
|
|
89
|
+
input,
|
|
90
|
+
watch
|
|
91
|
+
}) {
|
|
92
|
+
const ignoreFiles = {
|
|
93
|
+
name: "ignore-files",
|
|
94
|
+
load(id) {
|
|
95
|
+
if (!/\.(js|jsx|ts|tsx|json)$/.test(id)) {
|
|
96
|
+
return "";
|
|
97
|
+
}
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
const ts = yield Promise.resolve().then(() => __toESM2(require("typescript")));
|
|
102
|
+
const configFile = ts.readConfigFile(tsconfigPath, ts.sys.readFile);
|
|
103
|
+
const { options } = ts.parseJsonConfigFileContent(
|
|
104
|
+
configFile.config,
|
|
105
|
+
ts.sys,
|
|
106
|
+
"./"
|
|
107
|
+
);
|
|
108
|
+
const { default: jsonPlugin } = yield Promise.resolve().then(() => __toESM2(require("../../../compiled/@rollup/plugin-json")));
|
|
109
|
+
const { default: dtsPlugin } = yield Promise.resolve().then(() => __toESM2(require("../../../compiled/rollup-plugin-dts")));
|
|
110
|
+
const baseUrl = import_path.default.isAbsolute(options.baseUrl || ".") ? options.baseUrl : import_path.default.join(import_path.default.dirname(tsconfigPath), options.baseUrl || ".");
|
|
111
|
+
const inputConfig = {
|
|
112
|
+
input,
|
|
113
|
+
external: externals,
|
|
114
|
+
plugins: [
|
|
115
|
+
jsonPlugin(),
|
|
116
|
+
ignoreFiles,
|
|
117
|
+
dtsPlugin({
|
|
118
|
+
respectExternal: true,
|
|
119
|
+
compilerOptions: __spreadProps(__spreadValues({}, options), {
|
|
120
|
+
baseUrl,
|
|
121
|
+
declaration: true,
|
|
122
|
+
noEmit: false,
|
|
123
|
+
emitDeclarationOnly: true,
|
|
124
|
+
noEmitOnError: true,
|
|
125
|
+
checkJs: false,
|
|
126
|
+
declarationMap: false,
|
|
127
|
+
skipLibCheck: true,
|
|
128
|
+
preserveSymlinks: false,
|
|
129
|
+
target: ts.ScriptTarget.ESNext
|
|
130
|
+
})
|
|
131
|
+
})
|
|
132
|
+
].filter(Boolean)
|
|
133
|
+
};
|
|
134
|
+
const outputConfig = {
|
|
135
|
+
dir: distDir,
|
|
136
|
+
format: "esm",
|
|
137
|
+
exports: "named"
|
|
138
|
+
};
|
|
139
|
+
if (watch) {
|
|
140
|
+
const { watch: watch2 } = yield Promise.resolve().then(() => __toESM2(require("../../../compiled/rollup")));
|
|
141
|
+
const { watchSectionTitle } = yield Promise.resolve().then(() => __toESM2(require("../../utils/log")));
|
|
142
|
+
const { SectionTitleStatus, BundleDtsLogPrefix } = yield Promise.resolve().then(() => __toESM2(require("../../constants/log")));
|
|
143
|
+
const watcher = watch2(__spreadProps(__spreadValues({}, inputConfig), {
|
|
144
|
+
plugins: inputConfig.plugins,
|
|
145
|
+
output: outputConfig
|
|
146
|
+
})).on("event", (event) => __async(void 0, null, function* () {
|
|
147
|
+
if (event.code === "START") {
|
|
148
|
+
console.info(
|
|
149
|
+
yield watchSectionTitle(BundleDtsLogPrefix, SectionTitleStatus.Log)
|
|
150
|
+
);
|
|
151
|
+
} else if (event.code === "BUNDLE_END") {
|
|
152
|
+
console.info(
|
|
153
|
+
yield watchSectionTitle(
|
|
154
|
+
BundleDtsLogPrefix,
|
|
155
|
+
SectionTitleStatus.Success
|
|
156
|
+
)
|
|
157
|
+
);
|
|
158
|
+
} else if (event.code === "ERROR") {
|
|
159
|
+
}
|
|
160
|
+
}));
|
|
161
|
+
return watcher;
|
|
162
|
+
} else {
|
|
163
|
+
try {
|
|
164
|
+
const { rollup } = yield Promise.resolve().then(() => __toESM2(require("../../../compiled/rollup")));
|
|
165
|
+
const bundle = yield rollup(inputConfig);
|
|
166
|
+
yield bundle.write(outputConfig);
|
|
167
|
+
return bundle;
|
|
168
|
+
} catch (e) {
|
|
169
|
+
if (e instanceof Error) {
|
|
170
|
+
const { InternalDTSError } = yield Promise.resolve().then(() => __toESM2(require("../../error")));
|
|
171
|
+
throw new InternalDTSError(e, {
|
|
172
|
+
buildType: "bundle"
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
throw e;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
//# sourceMappingURL=rollup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;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,8CAAO;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,8CACpC;AAEF,QAAM,EAAE,SAAS,UAAU,IAAI,MAAM,8CACnC;AAEF,QAAM,UAAU,oBAAK,WAAW,QAAQ,WAAW,GAAG,IAClD,QAAQ,UACR,oBAAK,KAAK,oBAAK,QAAQ,YAAY,GAAG,QAAQ,WAAW,GAAG;AAChE,QAAM,cAA4B;AAAA,IAChC;AAAA,IACA,UAAU;AAAA,IACV,SAAS;AAAA,MACP,WAAW;AAAA,MACX;AAAA,MACA,UAAU;AAAA,QAER,iBAAiB;AAAA,QACjB,iBAAiB,iCACZ,UADY;AAAA,UAEf;AAAA,UAEA,aAAa;AAAA,UAEb,QAAQ;AAAA,UACR,qBAAqB;AAAA,UAErB,eAAe;AAAA,UAEf,SAAS;AAAA,UACT,gBAAgB;AAAA,UAChB,cAAc;AAAA,UACd,kBAAkB;AAAA,UAElB,QAAQ,GAAG,aAAa;AAAA,QAC1B;AAAA,MACF,CAAC;AAAA,IACH,EAAE,OAAO,OAAO;AAAA,EAClB;AACA,QAAM,eAA8B;AAAA,IAClC,KAAK;AAAA,IACL,QAAQ;AAAA,IACR,SAAS;AAAA,EACX;AACA,MAAI,OAAO;AACT,UAAM,EAAE,cAAM,IAAI,MAAM,8CAAO;AAC/B,UAAM,EAAE,kBAAkB,IAAI,MAAM,8CAAO;AAC3C,UAAM,EAAE,oBAAoB,mBAAmB,IAAI,MAAM,8CACvD;AAEF,UAAM,UAAUA,OAAM,iCACjB,cADiB;AAAA,MAEpB,SAAS,YAAY;AAAA,MACrB,QAAQ;AAAA,IACV,EAAC,EAAE,GAAG,SAAS,CAAM,UAAS;AAC5B,UAAI,MAAM,SAAS,SAAS;AAC1B,gBAAQ;AAAA,UACN,MAAM,kBAAkB,oBAAoB,mBAAmB,GAAG;AAAA,QACpE;AAAA,MACF,WAAW,MAAM,SAAS,cAAc;AACtC,gBAAQ;AAAA,UACN,MAAM;AAAA,YACJ;AAAA,YACA,mBAAmB;AAAA,UACrB;AAAA,QACF;AAAA,MACF,WAAW,MAAM,SAAS,SAAS;AAAA,MAEnC;AAAA,IACF,EAAC;AACD,WAAO;AAAA,EACT,OAAO;AACL,QAAI;AACF,YAAM,EAAE,OAAO,IAAI,MAAM,8CAAO;AAChC,YAAM,SAAS,MAAM,OAAO,WAAW;AACvC,YAAM,OAAO,MAAM,YAAY;AAC/B,aAAO;AAAA,IACT,SAAS,GAAT;AACE,UAAI,aAAa,OAAO;AACtB,cAAM,EAAE,iBAAiB,IAAI,MAAM,8CAAO;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 ...options,\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 declarationMap: false,\n skipLibCheck: true,\n preserveSymlinks: 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,160 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var stdin_exports = {};
|
|
19
|
+
__export(stdin_exports, {
|
|
20
|
+
getProjectTsconfig: () => getProjectTsconfig,
|
|
21
|
+
runTsc: () => runTsc
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
24
|
+
var __create = Object.create;
|
|
25
|
+
var __defProp2 = Object.defineProperty;
|
|
26
|
+
var __defProps = Object.defineProperties;
|
|
27
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
28
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
29
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
30
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
31
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
32
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
33
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
34
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
35
|
+
var __spreadValues = (a, b) => {
|
|
36
|
+
for (var prop in b || (b = {}))
|
|
37
|
+
if (__hasOwnProp2.call(b, prop))
|
|
38
|
+
__defNormalProp(a, prop, b[prop]);
|
|
39
|
+
if (__getOwnPropSymbols)
|
|
40
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
41
|
+
if (__propIsEnum.call(b, prop))
|
|
42
|
+
__defNormalProp(a, prop, b[prop]);
|
|
43
|
+
}
|
|
44
|
+
return a;
|
|
45
|
+
};
|
|
46
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
47
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
48
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
49
|
+
for (let key of __getOwnPropNames2(from))
|
|
50
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
51
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
52
|
+
}
|
|
53
|
+
return to;
|
|
54
|
+
};
|
|
55
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps2(
|
|
56
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
57
|
+
mod
|
|
58
|
+
));
|
|
59
|
+
var __async = (__this, __arguments, generator) => {
|
|
60
|
+
return new Promise((resolve, reject) => {
|
|
61
|
+
var fulfilled = (value) => {
|
|
62
|
+
try {
|
|
63
|
+
step(generator.next(value));
|
|
64
|
+
} catch (e) {
|
|
65
|
+
reject(e);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
var rejected = (value) => {
|
|
69
|
+
try {
|
|
70
|
+
step(generator.throw(value));
|
|
71
|
+
} catch (e) {
|
|
72
|
+
reject(e);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
76
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
const getProjectTsconfig = (tsconfigPath) => __async(void 0, null, function* () {
|
|
80
|
+
const { json5, fs } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
81
|
+
if (!fs.existsSync(tsconfigPath)) {
|
|
82
|
+
return {};
|
|
83
|
+
}
|
|
84
|
+
return json5.parse(fs.readFileSync(tsconfigPath, "utf-8"));
|
|
85
|
+
});
|
|
86
|
+
const resolveLog = (childProgress, options) => __async(void 0, null, function* () {
|
|
87
|
+
var _a, _b, _c;
|
|
88
|
+
const { watch = false, watchFn = () => __async(void 0, null, function* () {
|
|
89
|
+
return void 0;
|
|
90
|
+
}) } = options;
|
|
91
|
+
const { SectionTitleStatus, BundlelessDtsLogPrefix } = yield Promise.resolve().then(() => __toESM(require("../../constants/log")));
|
|
92
|
+
const { watchSectionTitle } = yield Promise.resolve().then(() => __toESM(require("../../utils/log")));
|
|
93
|
+
const { watchDoneText } = yield Promise.resolve().then(() => __toESM(require("../../constants/dts")));
|
|
94
|
+
(_a = childProgress.stdout) == null ? void 0 : _a.on("data", (data) => __async(void 0, null, function* () {
|
|
95
|
+
if (watch) {
|
|
96
|
+
console.info(
|
|
97
|
+
yield watchSectionTitle(BundlelessDtsLogPrefix, SectionTitleStatus.Log)
|
|
98
|
+
);
|
|
99
|
+
console.info(data.toString());
|
|
100
|
+
if (data.toString().includes(watchDoneText)) {
|
|
101
|
+
yield watchFn();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}));
|
|
105
|
+
(_b = childProgress.stdout) == null ? void 0 : _b.on("error", (error) => {
|
|
106
|
+
console.error(error.message);
|
|
107
|
+
});
|
|
108
|
+
(_c = childProgress.stderr) == null ? void 0 : _c.on("data", (chunk) => {
|
|
109
|
+
console.error(chunk.toString());
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
const generatorDts = (config) => __async(void 0, null, function* () {
|
|
113
|
+
const { execa } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
114
|
+
const { InternalDTSError } = yield Promise.resolve().then(() => __toESM(require("../../error")));
|
|
115
|
+
const { generatorTsConfig } = yield Promise.resolve().then(() => __toESM(require("../../utils/dts")));
|
|
116
|
+
const { getTscBinPath } = yield Promise.resolve().then(() => __toESM(require("../../utils/dts")));
|
|
117
|
+
const { tsconfigPath, appDirectory, watch = false } = config;
|
|
118
|
+
const userTsconfig = yield getProjectTsconfig(tsconfigPath);
|
|
119
|
+
const result = yield generatorTsConfig(userTsconfig, config);
|
|
120
|
+
const tscBinFile = yield getTscBinPath(appDirectory);
|
|
121
|
+
const watchParams = watch ? ["-w"] : [];
|
|
122
|
+
const childProgress = execa(
|
|
123
|
+
tscBinFile,
|
|
124
|
+
[
|
|
125
|
+
"-p",
|
|
126
|
+
result.tempTsconfigPath,
|
|
127
|
+
"--pretty",
|
|
128
|
+
"--preserveWatchOutput",
|
|
129
|
+
...watchParams
|
|
130
|
+
],
|
|
131
|
+
{
|
|
132
|
+
stdio: "pipe",
|
|
133
|
+
cwd: appDirectory
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
resolveLog(childProgress, {
|
|
137
|
+
watch,
|
|
138
|
+
watchFn: () => __async(void 0, null, function* () {
|
|
139
|
+
const { resolveAlias } = yield Promise.resolve().then(() => __toESM(require("../../utils/dts")));
|
|
140
|
+
yield resolveAlias(config, __spreadProps(__spreadValues({}, result), { userTsconfig }));
|
|
141
|
+
})
|
|
142
|
+
});
|
|
143
|
+
try {
|
|
144
|
+
yield childProgress;
|
|
145
|
+
} catch (e) {
|
|
146
|
+
if (e instanceof Error) {
|
|
147
|
+
throw new InternalDTSError(e, {
|
|
148
|
+
buildType: "bundleless"
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return __spreadProps(__spreadValues({}, result), { userTsconfig });
|
|
153
|
+
});
|
|
154
|
+
const runTsc = (config) => __async(void 0, null, function* () {
|
|
155
|
+
const { resolveAlias } = yield Promise.resolve().then(() => __toESM(require("../../utils/dts")));
|
|
156
|
+
const result = yield generatorDts(config);
|
|
157
|
+
yield resolveAlias(config, result);
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
//# sourceMappingURL=tsc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,MAAM,aAAa,CACjB,eACA,YAIG;AApBL;AAqBE,QAAM,EAAE,QAAQ,OAAO,UAAU,MAAS;AAAG;AAAA,KAAU,IAAI;AAC3D,QAAM,EAAE,oBAAoB,uBAAuB,IAAI,MAAM,6CAC3D;AAEF,QAAM,EAAE,kBAAkB,IAAI,MAAM,6CAAO;AAC3C,QAAM,EAAE,cAAc,IAAI,MAAM,6CAAO;AAOvC,sBAAc,WAAd,mBAAsB,GAAG,QAAQ,CAAM,SAAQ;AAC7C,QAAI,OAAO;AACT,cAAQ;AAAA,QACN,MAAM,kBAAkB,wBAAwB,mBAAmB,GAAG;AAAA,MACxE;AACA,cAAQ,KAAK,KAAK,SAAS,CAAC;AAC5B,UAAI,KAAK,SAAS,EAAE,SAAS,aAAa,GAAG;AAC3C,cAAM,QAAQ;AAAA,MAChB;AAAA,IACF;AAAA,EACF;AAEA,sBAAc,WAAd,mBAAsB,GAAG,SAAS,WAAS;AACzC,YAAQ,MAAM,MAAM,OAAO;AAAA,EAC7B;AACA,sBAAc,WAAd,mBAAsB,GAAG,QAAQ,WAAS;AACxC,YAAQ,MAAM,MAAM,SAAS,CAAC;AAAA,EAChC;AACF;AAEA,MAAM,eAAe,CAAO,WAAyC;AACnE,QAAM,EAAE,MAAM,IAAI,MAAM,6CAAO;AAC/B,QAAM,EAAE,iBAAiB,IAAI,MAAM,6CAAO;AAC1C,QAAM,EAAE,kBAAkB,IAAI,MAAM,6CAAO;AAC3C,QAAM,EAAE,cAAc,IAAI,MAAM,6CAAO;AACvC,QAAM,EAAE,cAAc,cAAc,QAAQ,MAAM,IAAI;AACtD,QAAM,eAAe,MAAM,mBAAmB,YAAY;AAC1D,QAAM,SAAS,MAAM,kBAAkB,cAAc,MAAM;AAE3D,QAAM,aAAa,MAAM,cAAc,YAAY;AAEnD,QAAM,cAAc,QAAQ,CAAC,IAAI,IAAI,CAAC;AACtC,QAAM,gBAAgB;AAAA,IACpB;AAAA,IACA;AAAA,MACE;AAAA,MACA,OAAO;AAAA,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,GAAT;AACE,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,124 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var stdin_exports = {};
|
|
19
|
+
__export(stdin_exports, {
|
|
20
|
+
run: () => run
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
23
|
+
var __create = Object.create;
|
|
24
|
+
var __defProp2 = Object.defineProperty;
|
|
25
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
26
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
27
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
28
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
29
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
30
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
31
|
+
for (let key of __getOwnPropNames2(from))
|
|
32
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
33
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
34
|
+
}
|
|
35
|
+
return to;
|
|
36
|
+
};
|
|
37
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps2(
|
|
38
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
39
|
+
mod
|
|
40
|
+
));
|
|
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
|
+
const run = (options, api) => __async(void 0, null, function* () {
|
|
62
|
+
const { chalk } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
63
|
+
const { resolvedBuildConfig, context, cmdOptions } = options;
|
|
64
|
+
const runner = api.useHookRunners();
|
|
65
|
+
let totalDuration = 0;
|
|
66
|
+
if (resolvedBuildConfig.length !== 0) {
|
|
67
|
+
const { buildSuccessText } = yield Promise.resolve().then(() => __toESM(require("../constants/log")));
|
|
68
|
+
totalDuration = Date.now();
|
|
69
|
+
!cmdOptions.watch && console.time(buildSuccessText);
|
|
70
|
+
const { runBuildTask } = yield Promise.resolve().then(() => __toESM(require("./build")));
|
|
71
|
+
const { default: pMap } = yield Promise.resolve().then(() => __toESM(require("../../compiled/p-map")));
|
|
72
|
+
const { clearBuildConfigPaths, clearDtsTemp } = yield Promise.resolve().then(() => __toESM(require("./clear")));
|
|
73
|
+
yield clearBuildConfigPaths(resolvedBuildConfig);
|
|
74
|
+
yield clearDtsTemp();
|
|
75
|
+
if (cmdOptions.watch) {
|
|
76
|
+
console.info(chalk.blue.underline("start build in watch mode...\n"));
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
yield pMap(resolvedBuildConfig, (config) => __async(void 0, null, function* () {
|
|
80
|
+
const buildConfig = yield runner.beforeBuildTask(
|
|
81
|
+
{
|
|
82
|
+
config,
|
|
83
|
+
options: cmdOptions
|
|
84
|
+
},
|
|
85
|
+
{ onLast: (c) => __async(void 0, null, function* () {
|
|
86
|
+
return c.config;
|
|
87
|
+
}) }
|
|
88
|
+
);
|
|
89
|
+
yield runBuildTask(
|
|
90
|
+
{
|
|
91
|
+
buildConfig,
|
|
92
|
+
buildCmdOptions: cmdOptions,
|
|
93
|
+
context
|
|
94
|
+
},
|
|
95
|
+
api
|
|
96
|
+
);
|
|
97
|
+
yield runner.afterBuildTask({ status: "success", config });
|
|
98
|
+
}));
|
|
99
|
+
!cmdOptions.watch && console.timeEnd(buildSuccessText);
|
|
100
|
+
} catch (e) {
|
|
101
|
+
const { isInternalError, ModuleBuildError } = yield Promise.resolve().then(() => __toESM(require("../error")));
|
|
102
|
+
if (isInternalError(e)) {
|
|
103
|
+
throw new ModuleBuildError(e);
|
|
104
|
+
} else {
|
|
105
|
+
throw e;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
totalDuration = Date.now() - totalDuration;
|
|
109
|
+
} else {
|
|
110
|
+
console.warn(
|
|
111
|
+
chalk.yellow(
|
|
112
|
+
`No build configuration found! Please configure \`buildConfig\` or \`buildPreset\``
|
|
113
|
+
)
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
yield runner.afterBuild({
|
|
117
|
+
status: "success",
|
|
118
|
+
config: resolvedBuildConfig,
|
|
119
|
+
commandOptions: cmdOptions,
|
|
120
|
+
totalDuration
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQO,MAAM,MAAM,CACjB,SAKA,QACG;AACH,QAAM,EAAE,MAAM,IAAI,MAAM,6CAAO;AAC/B,QAAM,EAAE,qBAAqB,SAAS,WAAW,IAAI;AACrD,QAAM,SAAS,IAAI,eAAe;AAElC,MAAI,gBAAgB;AAEpB,MAAI,oBAAoB,WAAW,GAAG;AACpC,UAAM,EAAE,iBAAiB,IAAI,MAAM,6CAAO;AAC1C,oBAAgB,KAAK,IAAI;AAEzB,KAAC,WAAW,SAAS,QAAQ,KAAK,gBAAgB;AAElD,UAAM,EAAE,aAAa,IAAI,MAAM,6CAAO;AACtC,UAAM,EAAE,SAAS,KAAK,IAAI,MAAM,6CAAO;AAEvC,UAAM,EAAE,uBAAuB,aAAa,IAAI,MAAM,6CAAO;AAC7D,UAAM,sBAAsB,mBAAmB;AAC/C,UAAM,aAAa;AAEnB,QAAI,WAAW,OAAO;AACpB,cAAQ,KAAK,MAAM,KAAK,UAAU,gCAAgC,CAAC;AAAA,IACrE;AAEA,QAAI;AACF,YAAM,KAAK,qBAAqB,CAAM,WAAU;AAC9C,cAAM,cAAc,MAAM,OAAO;AAAA,UAC/B;AAAA,YACE;AAAA,YACA,SAAS;AAAA,UACX;AAAA,UACA,EAAE,QAAQ,CAAM,MAAE;AAAG,qBAAE;AAAA,aAAO;AAAA,QAChC;AACA,cAAM;AAAA,UACJ;AAAA,YACE;AAAA,YACA,iBAAiB;AAAA,YACjB;AAAA,UACF;AAAA,UACA;AAAA,QACF;AACA,cAAM,OAAO,eAAe,EAAE,QAAQ,WAAW,OAAO,CAAC;AAAA,MAC3D,EAAC;AAED,OAAC,WAAW,SAAS,QAAQ,QAAQ,gBAAgB;AAAA,IACvD,SAAS,GAAT;AACE,YAAM,EAAE,iBAAiB,iBAAiB,IAAI,MAAM,6CAAO;AAC3D,UAAI,gBAAgB,CAAC,GAAG;AACtB,cAAM,IAAI,iBAAiB,CAAC;AAAA,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>;
|