@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
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.build = void 0;
|
|
7
|
-
var _pMap = _interopRequireDefault(require("p-map"));
|
|
8
|
-
var _runSpeedy = require("./runSpeedy");
|
|
9
|
-
var _runRollup = require("./runRollup");
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
const build = async (api, config) => {
|
|
12
|
-
const tasks = config.dtsOnly ? [_runRollup.startRollup] : [_runSpeedy.runSpeedy, _runRollup.startRollup];
|
|
13
|
-
await (0, _pMap.default)(tasks, async task => {
|
|
14
|
-
await task(api, config);
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
exports.build = build;
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.startRollup = void 0;
|
|
7
|
-
var _path = _interopRequireDefault(require("path"));
|
|
8
|
-
var _typescript = _interopRequireDefault(require("typescript"));
|
|
9
|
-
var _rollupPluginHashbang = _interopRequireDefault(require("rollup-plugin-hashbang"));
|
|
10
|
-
var _pluginJson = _interopRequireDefault(require("@rollup/plugin-json"));
|
|
11
|
-
var _error = require("../error");
|
|
12
|
-
var _utils = require("../utils");
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
|
-
// Copied from https://github.com/egoist/tsup/blob/dev/src/rollup.ts
|
|
20
|
-
|
|
21
|
-
const loadCompilerOptions = tsconfig => {
|
|
22
|
-
if (!tsconfig) {
|
|
23
|
-
return {};
|
|
24
|
-
}
|
|
25
|
-
const configFile = _typescript.default.readConfigFile(tsconfig, _typescript.default.sys.readFile);
|
|
26
|
-
const {
|
|
27
|
-
options
|
|
28
|
-
} = _typescript.default.parseJsonConfigFileContent(configFile.config, _typescript.default.sys, './');
|
|
29
|
-
return options;
|
|
30
|
-
};
|
|
31
|
-
const dtsPlugin = require('rollup-plugin-dts');
|
|
32
|
-
const getRollupConfig = async (api, options) => {
|
|
33
|
-
const {
|
|
34
|
-
appDirectory
|
|
35
|
-
} = api.useAppContext();
|
|
36
|
-
const {
|
|
37
|
-
output: {
|
|
38
|
-
path: distPath = 'dist'
|
|
39
|
-
}
|
|
40
|
-
} = api.useResolvedConfigContext();
|
|
41
|
-
const {
|
|
42
|
-
outputPath,
|
|
43
|
-
bundleOptions,
|
|
44
|
-
tsconfig
|
|
45
|
-
} = options;
|
|
46
|
-
const distDir = _path.default.join(appDirectory, distPath, outputPath);
|
|
47
|
-
const compilerOptions = loadCompilerOptions(tsconfig);
|
|
48
|
-
const dtsOptions = {
|
|
49
|
-
entry: bundleOptions.entry
|
|
50
|
-
};
|
|
51
|
-
const ignoreFiles = {
|
|
52
|
-
name: 'ignore-files',
|
|
53
|
-
load(id) {
|
|
54
|
-
if (!/\.(js|jsx|ts|tsx|json)$/.test(id)) {
|
|
55
|
-
return '';
|
|
56
|
-
}
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
return {
|
|
61
|
-
inputConfig: {
|
|
62
|
-
input: dtsOptions.entry,
|
|
63
|
-
external: bundleOptions.externals,
|
|
64
|
-
onwarn(warning, handler) {
|
|
65
|
-
if (warning.code === 'UNRESOLVED_IMPORT' || warning.code === 'CIRCULAR_DEPENDENCY' || warning.code === 'EMPTY_BUNDLE') {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
handler(warning);
|
|
69
|
-
},
|
|
70
|
-
plugins: [(0, _rollupPluginHashbang.default)(), (0, _pluginJson.default)(), ignoreFiles, dtsPlugin.default({
|
|
71
|
-
// use external to prevent them which come from node_modules from be bundled.
|
|
72
|
-
respectExternal: true,
|
|
73
|
-
compilerOptions: _objectSpread(_objectSpread({}, compilerOptions), {}, {
|
|
74
|
-
baseUrl: _path.default.resolve(compilerOptions.baseUrl || '.'),
|
|
75
|
-
// Ensure ".d.ts" modules are generated
|
|
76
|
-
declaration: true,
|
|
77
|
-
// Skip ".js" generation
|
|
78
|
-
noEmit: false,
|
|
79
|
-
emitDeclarationOnly: true,
|
|
80
|
-
// Skip code generation when error occurs
|
|
81
|
-
noEmitOnError: true,
|
|
82
|
-
// Avoid extra work
|
|
83
|
-
checkJs: false,
|
|
84
|
-
declarationMap: false,
|
|
85
|
-
skipLibCheck: true,
|
|
86
|
-
preserveSymlinks: false,
|
|
87
|
-
// Ensure we can parse the latest code
|
|
88
|
-
target: _typescript.default.ScriptTarget.ESNext
|
|
89
|
-
})
|
|
90
|
-
})].filter(Boolean)
|
|
91
|
-
},
|
|
92
|
-
outputConfig: {
|
|
93
|
-
dir: distDir,
|
|
94
|
-
format: 'esm',
|
|
95
|
-
exports: 'named'
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
async function runRollup(options, context) {
|
|
100
|
-
try {
|
|
101
|
-
const {
|
|
102
|
-
rollup
|
|
103
|
-
} = await Promise.resolve().then(() => _interopRequireWildcard(require('rollup')));
|
|
104
|
-
const bundle = await rollup(options.inputConfig);
|
|
105
|
-
await bundle.write(options.outputConfig);
|
|
106
|
-
} catch (e) {
|
|
107
|
-
if (e instanceof Error) {
|
|
108
|
-
throw new _error.InternalDTSError(e, _objectSpread({
|
|
109
|
-
buildType: 'bundle'
|
|
110
|
-
}, context));
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
async function watchRollup(options) {
|
|
115
|
-
const {
|
|
116
|
-
watch
|
|
117
|
-
} = await Promise.resolve().then(() => _interopRequireWildcard(require('rollup')));
|
|
118
|
-
const titleText = '[Bundle:DTS]';
|
|
119
|
-
watch(_objectSpread(_objectSpread({}, options.inputConfig), {}, {
|
|
120
|
-
plugins: options.inputConfig.plugins,
|
|
121
|
-
output: options.outputConfig
|
|
122
|
-
})).on('event', event => {
|
|
123
|
-
if (event.code === 'START') {
|
|
124
|
-
console.info((0, _utils.watchSectionTitle)(titleText, _utils.SectionTitleStatus.Log));
|
|
125
|
-
} else if (event.code === 'BUNDLE_END') {
|
|
126
|
-
console.info((0, _utils.watchSectionTitle)(titleText, _utils.SectionTitleStatus.Success));
|
|
127
|
-
} else if (event.code === 'ERROR') {
|
|
128
|
-
// this is dts rollup plugin bug, error not complete message
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
const startRollup = async (api, options) => {
|
|
133
|
-
if (options.enableDts) {
|
|
134
|
-
const config = await getRollupConfig(api, options);
|
|
135
|
-
if (options.watch) {
|
|
136
|
-
watchRollup(config);
|
|
137
|
-
} else {
|
|
138
|
-
await runRollup(config, {
|
|
139
|
-
target: options.target,
|
|
140
|
-
format: options.format
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
exports.startRollup = startRollup;
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.runSpeedy = exports.getDefine = exports.getAlias = void 0;
|
|
7
|
-
var _path = _interopRequireDefault(require("path"));
|
|
8
|
-
var _speedyCore = require("@speedy-js/speedy-core");
|
|
9
|
-
var _speedyPluginEs = require("@speedy-js/speedy-plugin-es5");
|
|
10
|
-
var _utils = require("@modern-js/utils");
|
|
11
|
-
var _error = require("../error");
|
|
12
|
-
var _utils2 = require("../utils");
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
-
const getAlias = api => {
|
|
18
|
-
const {
|
|
19
|
-
appDirectory,
|
|
20
|
-
srcDirectory
|
|
21
|
-
} = api.useAppContext();
|
|
22
|
-
const {
|
|
23
|
-
source
|
|
24
|
-
} = api.useResolvedConfigContext();
|
|
25
|
-
// TODO: maybe check tsconfig `paths`
|
|
26
|
-
const defaultAlias = {
|
|
27
|
-
'@': srcDirectory
|
|
28
|
-
};
|
|
29
|
-
const alias = (0, _utils.applyOptionsChain)(defaultAlias, source === null || source === void 0 ? void 0 : source.alias);
|
|
30
|
-
return Object.keys(alias).reduce((o, name) => {
|
|
31
|
-
return _objectSpread(_objectSpread({}, o), {}, {
|
|
32
|
-
[name]: (0, _utils.ensureAbsolutePath)(appDirectory, alias[name])
|
|
33
|
-
});
|
|
34
|
-
}, {});
|
|
35
|
-
};
|
|
36
|
-
exports.getAlias = getAlias;
|
|
37
|
-
const getDefine = api => {
|
|
38
|
-
const {
|
|
39
|
-
source: {
|
|
40
|
-
envVars,
|
|
41
|
-
globalVars
|
|
42
|
-
}
|
|
43
|
-
} = api.useResolvedConfigContext();
|
|
44
|
-
const envVarsDefine = [...(envVars || [])].reduce((memo, name) => {
|
|
45
|
-
memo[`process.env.${name}`] = JSON.stringify(process.env[name]);
|
|
46
|
-
return memo;
|
|
47
|
-
}, {});
|
|
48
|
-
const globalVarsDefine = Object.keys(globalVars || {}).reduce((memo, name) => {
|
|
49
|
-
memo[name] = globalVars ? JSON.stringify(globalVars[name]) : '';
|
|
50
|
-
return memo;
|
|
51
|
-
}, {});
|
|
52
|
-
return _objectSpread(_objectSpread({}, envVarsDefine), globalVarsDefine);
|
|
53
|
-
};
|
|
54
|
-
exports.getDefine = getDefine;
|
|
55
|
-
const getStyleOptionFromModern = async api => {
|
|
56
|
-
const runner = api.useHookRunners();
|
|
57
|
-
const {
|
|
58
|
-
appDirectory
|
|
59
|
-
} = api.useAppContext();
|
|
60
|
-
const modernConfig = api.useResolvedConfigContext();
|
|
61
|
-
const lessOption = await runner.moduleLessConfig({
|
|
62
|
-
modernConfig
|
|
63
|
-
}, {
|
|
64
|
-
onLast: async _ => undefined
|
|
65
|
-
});
|
|
66
|
-
const sassOption = await runner.moduleSassConfig({
|
|
67
|
-
modernConfig
|
|
68
|
-
}, {
|
|
69
|
-
onLast: async _ => undefined
|
|
70
|
-
});
|
|
71
|
-
const tailwindPlugin = await runner.moduleTailwindConfig({
|
|
72
|
-
modernConfig
|
|
73
|
-
}, {
|
|
74
|
-
onLast: async _ => undefined
|
|
75
|
-
});
|
|
76
|
-
const postcssOption = (0, _utils2.getPostcssOption)(appDirectory, modernConfig);
|
|
77
|
-
if (tailwindPlugin) {
|
|
78
|
-
var _postcssOption$plugin;
|
|
79
|
-
(_postcssOption$plugin = postcssOption.plugins) === null || _postcssOption$plugin === void 0 ? void 0 : _postcssOption$plugin.push(tailwindPlugin);
|
|
80
|
-
}
|
|
81
|
-
return {
|
|
82
|
-
less: lessOption === null || lessOption === void 0 ? void 0 : lessOption.lessOption,
|
|
83
|
-
sass: sassOption,
|
|
84
|
-
postcss: _objectSpread(_objectSpread({}, postcssOption.options), {}, {
|
|
85
|
-
plugins: postcssOption.plugins
|
|
86
|
-
})
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
const runSpeedy = async (api, config) => {
|
|
90
|
-
const {
|
|
91
|
-
appDirectory
|
|
92
|
-
} = api.useAppContext();
|
|
93
|
-
const {
|
|
94
|
-
output: {
|
|
95
|
-
path: distPath = 'dist'
|
|
96
|
-
},
|
|
97
|
-
tools: {
|
|
98
|
-
speedy: userSpeedyConfig
|
|
99
|
-
} = {
|
|
100
|
-
speedy: undefined
|
|
101
|
-
}
|
|
102
|
-
} = api.useResolvedConfigContext();
|
|
103
|
-
const {
|
|
104
|
-
target,
|
|
105
|
-
watch,
|
|
106
|
-
bundleOptions,
|
|
107
|
-
outputPath,
|
|
108
|
-
format,
|
|
109
|
-
sourceMap
|
|
110
|
-
} = config;
|
|
111
|
-
const {
|
|
112
|
-
entry,
|
|
113
|
-
platform,
|
|
114
|
-
splitting,
|
|
115
|
-
minify,
|
|
116
|
-
externals,
|
|
117
|
-
getModuleId
|
|
118
|
-
} = bundleOptions;
|
|
119
|
-
const distDir = _path.default.join(appDirectory, distPath, outputPath);
|
|
120
|
-
const titleText = `[Bundle:Speedy:${format}_${target}]`;
|
|
121
|
-
const style = await getStyleOptionFromModern(api);
|
|
122
|
-
const alias = getAlias(api);
|
|
123
|
-
const define = getDefine(api);
|
|
124
|
-
const watchPlugin = () => {
|
|
125
|
-
return {
|
|
126
|
-
name: 'watch-plugin',
|
|
127
|
-
apply(compiler) {
|
|
128
|
-
compiler.hooks.watchChange.tap('watch-plugin', async () => {
|
|
129
|
-
console.info((0, _utils2.watchSectionTitle)(titleText, _utils2.SectionTitleStatus.Log));
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
};
|
|
134
|
-
const plugins = target === 'es5' ? [(0, _speedyPluginEs.es5InputPlugin)()] : [];
|
|
135
|
-
plugins.push(watchPlugin());
|
|
136
|
-
// TODO: add speedy plugin about react
|
|
137
|
-
const internalSpeedyConfig = {
|
|
138
|
-
command: 'build',
|
|
139
|
-
mode: 'production',
|
|
140
|
-
html: false,
|
|
141
|
-
preset: 'webapp',
|
|
142
|
-
// support css and json
|
|
143
|
-
platform,
|
|
144
|
-
watch,
|
|
145
|
-
input: entry,
|
|
146
|
-
target,
|
|
147
|
-
clearScreen: false,
|
|
148
|
-
output: {
|
|
149
|
-
path: distDir,
|
|
150
|
-
format,
|
|
151
|
-
splitting,
|
|
152
|
-
filename: '[name]'
|
|
153
|
-
},
|
|
154
|
-
style,
|
|
155
|
-
resolve: {
|
|
156
|
-
alias
|
|
157
|
-
},
|
|
158
|
-
define,
|
|
159
|
-
sourceMap,
|
|
160
|
-
minify,
|
|
161
|
-
external: externals,
|
|
162
|
-
plugins,
|
|
163
|
-
getModuleId
|
|
164
|
-
};
|
|
165
|
-
const speedyConfig = (0, _utils.applyOptionsChain)(internalSpeedyConfig, userSpeedyConfig);
|
|
166
|
-
const compiler = await _speedyCore.SpeedyBundler.create(speedyConfig);
|
|
167
|
-
try {
|
|
168
|
-
if (watch) {
|
|
169
|
-
console.info((0, _utils2.watchSectionTitle)(titleText, _utils2.SectionTitleStatus.Log));
|
|
170
|
-
}
|
|
171
|
-
await compiler.build();
|
|
172
|
-
} catch (e) {
|
|
173
|
-
/**
|
|
174
|
-
* in watch mode
|
|
175
|
-
* use speedy watch log
|
|
176
|
-
*/
|
|
177
|
-
if (e instanceof Error) {
|
|
178
|
-
throw new _error.InternalBuildError(e, {
|
|
179
|
-
target,
|
|
180
|
-
format,
|
|
181
|
-
buildType: 'bundle'
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
exports.runSpeedy = runSpeedy;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.copyStaticAssets = void 0;
|
|
7
|
-
var path = _interopRequireWildcard(require("path"));
|
|
8
|
-
var _utils = require("@modern-js/utils");
|
|
9
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
10
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
11
|
-
const copyUtils = _utils.Import.lazy('../../../utils/copy', require);
|
|
12
|
-
const SRC_DIRS = 'src';
|
|
13
|
-
const copyAssets = ({
|
|
14
|
-
targetDir,
|
|
15
|
-
outputDir
|
|
16
|
-
}) => {
|
|
17
|
-
const assetsFiles = _utils.glob.sync(`${targetDir}/**/*.*`, {
|
|
18
|
-
ignore: ['**/*.{js,jsx,ts,tsx,d.ts,scss,less,css,sass}']
|
|
19
|
-
});
|
|
20
|
-
if (assetsFiles.length > 0) {
|
|
21
|
-
_utils.fs.ensureDirSync(outputDir);
|
|
22
|
-
}
|
|
23
|
-
for (const resource of assetsFiles) {
|
|
24
|
-
const file = path.relative(targetDir, resource);
|
|
25
|
-
_utils.fs.ensureDirSync(path.dirname(path.resolve(outputDir, file)));
|
|
26
|
-
_utils.fs.copyFileSync(resource, path.resolve(outputDir, file));
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
const watchAssets = (api, {
|
|
30
|
-
targetDir,
|
|
31
|
-
outputDir
|
|
32
|
-
}) => {
|
|
33
|
-
(0, _utils.watch)(`${targetDir}/**/*.*`, async ({
|
|
34
|
-
changeType,
|
|
35
|
-
changedFilePath
|
|
36
|
-
}) => {
|
|
37
|
-
if (changeType === _utils.WatchChangeType.UNLINK) {
|
|
38
|
-
const removeFile = path.normalize(`${outputDir}/${path.relative(targetDir, changedFilePath)}`);
|
|
39
|
-
_utils.fs.removeSync(removeFile);
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const file = path.relative(targetDir, changedFilePath);
|
|
43
|
-
_utils.fs.copyFileSync(changedFilePath, path.resolve(outputDir, file));
|
|
44
|
-
}, ['**/*.{js,jsx,ts,tsx,d.ts,scss,less,css,sass}']);
|
|
45
|
-
};
|
|
46
|
-
const copyStaticAssets = async (api, config) => {
|
|
47
|
-
var _bundlelessOptions$so;
|
|
48
|
-
const appContext = api.useAppContext();
|
|
49
|
-
const modernConfig = api.useResolvedConfigContext();
|
|
50
|
-
const {
|
|
51
|
-
appDirectory
|
|
52
|
-
} = appContext;
|
|
53
|
-
const {
|
|
54
|
-
path: distPath = 'dist'
|
|
55
|
-
} = modernConfig.output;
|
|
56
|
-
const {
|
|
57
|
-
outputPath,
|
|
58
|
-
bundlelessOptions
|
|
59
|
-
} = config;
|
|
60
|
-
const {
|
|
61
|
-
static: {
|
|
62
|
-
path: staticPath = './'
|
|
63
|
-
} = {
|
|
64
|
-
path: './'
|
|
65
|
-
}
|
|
66
|
-
} = bundlelessOptions;
|
|
67
|
-
const srcDir = path.join(appDirectory, (_bundlelessOptions$so = bundlelessOptions.sourceDir) !== null && _bundlelessOptions$so !== void 0 ? _bundlelessOptions$so : SRC_DIRS);
|
|
68
|
-
const outputDirToSrc = path.join(appDirectory, distPath, outputPath, staticPath);
|
|
69
|
-
copyAssets({
|
|
70
|
-
targetDir: srcDir,
|
|
71
|
-
outputDir: outputDirToSrc
|
|
72
|
-
});
|
|
73
|
-
await copyUtils.copyTask({
|
|
74
|
-
modernConfig,
|
|
75
|
-
appContext
|
|
76
|
-
});
|
|
77
|
-
if (config.watch) {
|
|
78
|
-
watchAssets(api, {
|
|
79
|
-
targetDir: srcDir,
|
|
80
|
-
outputDir: outputDirToSrc
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
exports.copyStaticAssets = copyStaticAssets;
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.genDts = void 0;
|
|
7
|
-
var _path = _interopRequireDefault(require("path"));
|
|
8
|
-
var _utils = require("@modern-js/utils");
|
|
9
|
-
var _error = require("../../error");
|
|
10
|
-
var _utils2 = require("../../utils");
|
|
11
|
-
var _utils3 = require("./utils");
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
const utils = _utils.Import.lazy('./utils', require);
|
|
14
|
-
const getProjectTsconfig = tsconfigPath => {
|
|
15
|
-
if (!tsconfigPath || !_utils.fs.existsSync(tsconfigPath)) {
|
|
16
|
-
return {};
|
|
17
|
-
}
|
|
18
|
-
return _utils.json5.parse(_utils.fs.readFileSync(tsconfigPath, 'utf-8'));
|
|
19
|
-
};
|
|
20
|
-
const resolveLog = (childProgress, {
|
|
21
|
-
watch: _watch = false
|
|
22
|
-
} = {}) => {
|
|
23
|
-
var _childProgress$stdout, _childProgress$stdout2, _childProgress$stderr;
|
|
24
|
-
/**
|
|
25
|
-
* tsc 所有的log信息都是从stdout data 事件中获取
|
|
26
|
-
* 正常模式下,如果有报错信息,交给 resolveLog 后面的逻辑来处理
|
|
27
|
-
* watch 模式下,则使用这里的信息
|
|
28
|
-
*/
|
|
29
|
-
(_childProgress$stdout = childProgress.stdout) === null || _childProgress$stdout === void 0 ? void 0 : _childProgress$stdout.on('data', data => {
|
|
30
|
-
if (_watch) {
|
|
31
|
-
console.info((0, _utils2.watchSectionTitle)('[Bundleless:DTS]', _utils2.SectionTitleStatus.Log));
|
|
32
|
-
console.info(data.toString());
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
// 正常以下内容都不会触发,因为tsc 不会产生以下类型的log信息,不过防止意外情况
|
|
36
|
-
(_childProgress$stdout2 = childProgress.stdout) === null || _childProgress$stdout2 === void 0 ? void 0 : _childProgress$stdout2.on('error', error => {
|
|
37
|
-
console.error(error.message);
|
|
38
|
-
});
|
|
39
|
-
(_childProgress$stderr = childProgress.stderr) === null || _childProgress$stderr === void 0 ? void 0 : _childProgress$stderr.on('data', chunk => {
|
|
40
|
-
console.error(chunk.toString());
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
const generatorDts = async (_, config) => {
|
|
44
|
-
const {
|
|
45
|
-
tsconfigPath,
|
|
46
|
-
distDir,
|
|
47
|
-
sourceDir = 'src',
|
|
48
|
-
appDirectory,
|
|
49
|
-
watch = false
|
|
50
|
-
} = config;
|
|
51
|
-
const userTsconfig = getProjectTsconfig(tsconfigPath);
|
|
52
|
-
const willDeleteTsconfigPath = utils.generatorTsConfig(userTsconfig, {
|
|
53
|
-
appDirectory,
|
|
54
|
-
distDir,
|
|
55
|
-
sourceDir
|
|
56
|
-
});
|
|
57
|
-
const tscBinFile = (0, _utils3.getTscBinPath)(appDirectory);
|
|
58
|
-
const watchParams = watch ? ['-w'] : [];
|
|
59
|
-
const childProgress = (0, _utils.execa)(tscBinFile, ['-p', willDeleteTsconfigPath, /* Required parameter, use it stdout have color */
|
|
60
|
-
'--pretty',
|
|
61
|
-
// https://github.com/microsoft/TypeScript/issues/21824
|
|
62
|
-
'--preserveWatchOutput', ...watchParams], {
|
|
63
|
-
stdio: 'pipe',
|
|
64
|
-
cwd: appDirectory
|
|
65
|
-
});
|
|
66
|
-
resolveLog(childProgress, {
|
|
67
|
-
watch
|
|
68
|
-
});
|
|
69
|
-
try {
|
|
70
|
-
await childProgress;
|
|
71
|
-
} catch (e) {
|
|
72
|
-
if (e instanceof Error) {
|
|
73
|
-
throw new _error.InternalDTSError(e, {
|
|
74
|
-
buildType: 'bundleless'
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
_utils.fs.removeSync(willDeleteTsconfigPath);
|
|
79
|
-
};
|
|
80
|
-
const genDts = async (api, config) => {
|
|
81
|
-
const {
|
|
82
|
-
outputPath,
|
|
83
|
-
tsconfig: tsconfigPath,
|
|
84
|
-
watch,
|
|
85
|
-
bundlelessOptions: {
|
|
86
|
-
sourceDir
|
|
87
|
-
},
|
|
88
|
-
enableDts
|
|
89
|
-
} = config;
|
|
90
|
-
if (!enableDts) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
const {
|
|
94
|
-
appDirectory
|
|
95
|
-
} = api.useAppContext();
|
|
96
|
-
const modernConfig = api.useResolvedConfigContext();
|
|
97
|
-
const {
|
|
98
|
-
output: {
|
|
99
|
-
path: distPath = 'dist'
|
|
100
|
-
}
|
|
101
|
-
} = modernConfig;
|
|
102
|
-
const distDir = _path.default.join(appDirectory, distPath, outputPath);
|
|
103
|
-
const option = {
|
|
104
|
-
appDirectory,
|
|
105
|
-
distDir,
|
|
106
|
-
tsconfigPath,
|
|
107
|
-
watch,
|
|
108
|
-
sourceDir
|
|
109
|
-
};
|
|
110
|
-
await generatorDts(modernConfig, option);
|
|
111
|
-
// TODO: watch 模式下无法转换
|
|
112
|
-
utils.resolveAlias(modernConfig, option);
|
|
113
|
-
};
|
|
114
|
-
exports.genDts = genDts;
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.resolveAlias = exports.getTscBinPath = exports.generatorTsConfig = void 0;
|
|
7
|
-
var path = _interopRequireWildcard(require("path"));
|
|
8
|
-
var _utils = require("@modern-js/utils");
|
|
9
|
-
var _lodash = require("@modern-js/utils/lodash");
|
|
10
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
14
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
-
const babel = _utils.Import.lazy('../../../../utils/babel', require);
|
|
16
|
-
const tsPathsTransform = _utils.Import.lazy('../../../../utils/tspaths-transform', require);
|
|
17
|
-
const generatorTsConfig = (projectTsconfig, {
|
|
18
|
-
appDirectory,
|
|
19
|
-
distDir,
|
|
20
|
-
sourceDir: _sourceDir = 'src'
|
|
21
|
-
}) => {
|
|
22
|
-
var _projectTsconfig$comp, _projectTsconfig$comp2, _ref, _projectTsconfig$excl;
|
|
23
|
-
const tempPath = path.resolve(appDirectory, './node_modules');
|
|
24
|
-
const resolvePath = path.relative(tempPath, appDirectory);
|
|
25
|
-
// const rootDir = projectTsconfig.compilerOptions?.rootDir
|
|
26
|
-
// ? path.join(resolvePath, projectTsconfig.compilerOptions?.rootDir)
|
|
27
|
-
// : resolvePath;
|
|
28
|
-
// 目前限制 rootDir 的路径为 sourceDir
|
|
29
|
-
const rootDir = path.join(resolvePath, _sourceDir);
|
|
30
|
-
const baseUrl = (_projectTsconfig$comp = projectTsconfig.compilerOptions) !== null && _projectTsconfig$comp !== void 0 && _projectTsconfig$comp.baseUrl ? path.join(appDirectory, (_projectTsconfig$comp2 = projectTsconfig.compilerOptions) === null || _projectTsconfig$comp2 === void 0 ? void 0 : _projectTsconfig$comp2.baseUrl) : appDirectory;
|
|
31
|
-
// if include = ['src'], final include should be ['../src']
|
|
32
|
-
// const include = projectTsconfig.include?.map(includePath =>
|
|
33
|
-
const include = (_ref = [_sourceDir]) === null || _ref === void 0 ? void 0 : _ref.map(includePath => path.join(resolvePath, includePath));
|
|
34
|
-
const exclude = (_projectTsconfig$excl = projectTsconfig.exclude) === null || _projectTsconfig$excl === void 0 ? void 0 : _projectTsconfig$excl.map(excludePath => path.join(resolvePath, excludePath));
|
|
35
|
-
const resetConfig = {
|
|
36
|
-
compilerOptions: {
|
|
37
|
-
rootDir,
|
|
38
|
-
baseUrl,
|
|
39
|
-
// Ensure that .d.ts files are created by tsc, but not .js files
|
|
40
|
-
declaration: true,
|
|
41
|
-
emitDeclarationOnly: true,
|
|
42
|
-
outDir: distDir
|
|
43
|
-
},
|
|
44
|
-
include,
|
|
45
|
-
exclude
|
|
46
|
-
};
|
|
47
|
-
if (projectTsconfig.extends) {
|
|
48
|
-
resetConfig.extends = projectTsconfig.extends.startsWith('.') ? path.join(resolvePath, projectTsconfig.extends) : projectTsconfig.extends;
|
|
49
|
-
}
|
|
50
|
-
const recommendOption = {
|
|
51
|
-
// Ensure that Babel can safely transpile files in the TypeScript project
|
|
52
|
-
compilerOptions: {
|
|
53
|
-
isolatedModules: true
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
const tempTsconfigPath = path.join(tempPath, `tsconfig.${Date.now()}.${(0, _utils.nanoid)()}.json`);
|
|
57
|
-
_utils.fs.ensureFileSync(tempTsconfigPath);
|
|
58
|
-
_utils.fs.writeJSONSync(tempTsconfigPath, (0, _lodash.merge)(recommendOption, projectTsconfig,
|
|
59
|
-
// 此处是必须要覆盖用户默认配置
|
|
60
|
-
resetConfig));
|
|
61
|
-
return tempTsconfigPath;
|
|
62
|
-
};
|
|
63
|
-
exports.generatorTsConfig = generatorTsConfig;
|
|
64
|
-
const resolveAlias = (modernConfig, config, watchFilenames = []) => {
|
|
65
|
-
const {
|
|
66
|
-
output
|
|
67
|
-
} = modernConfig;
|
|
68
|
-
const defaultPaths = {
|
|
69
|
-
'@': ['./src']
|
|
70
|
-
};
|
|
71
|
-
const dtsDistPath = `${config.distDir}/**/*.d.ts`;
|
|
72
|
-
const dtsFilenames = watchFilenames.length > 0 ? watchFilenames : _utils.glob.sync(dtsDistPath, {
|
|
73
|
-
absolute: true
|
|
74
|
-
});
|
|
75
|
-
const alias = babel.getFinalAlias(modernConfig, {
|
|
76
|
-
appDirectory: config.appDirectory,
|
|
77
|
-
tsconfigPath: config.tsconfigPath || path.join(config.appDirectory, './tsconfig.json'),
|
|
78
|
-
sourceAbsDir: config.distDir
|
|
79
|
-
});
|
|
80
|
-
const mergedPaths = alias.isTsPath ? alias.paths || {} : _objectSpread(_objectSpread({}, defaultPaths), alias.paths || {});
|
|
81
|
-
const result = tsPathsTransform.transformDtsAlias({
|
|
82
|
-
filenames: dtsFilenames,
|
|
83
|
-
baseUrl: path.join(config.appDirectory, output.path || 'dist'),
|
|
84
|
-
paths: mergedPaths
|
|
85
|
-
});
|
|
86
|
-
for (const r of result) {
|
|
87
|
-
_utils.fs.writeFileSync(r.path, r.content);
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
exports.resolveAlias = resolveAlias;
|
|
91
|
-
const getTscBinPath = appDirectory => {
|
|
92
|
-
const {
|
|
93
|
-
root
|
|
94
|
-
} = path.parse(appDirectory);
|
|
95
|
-
let currentDirectory = appDirectory;
|
|
96
|
-
while (currentDirectory !== root) {
|
|
97
|
-
const tscBinFile = path.join(currentDirectory, './node_modules/.bin/tsc');
|
|
98
|
-
if (_utils.fs.existsSync(tscBinFile)) {
|
|
99
|
-
return tscBinFile;
|
|
100
|
-
}
|
|
101
|
-
currentDirectory = path.dirname(currentDirectory);
|
|
102
|
-
}
|
|
103
|
-
throw new Error('Failed to excute the `tsc` command, please check if `typescript` is installed correctly in the current directory.');
|
|
104
|
-
};
|
|
105
|
-
exports.getTscBinPath = getTscBinPath;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.build = void 0;
|
|
7
|
-
var _utils = require("@modern-js/utils");
|
|
8
|
-
var _pMap = _interopRequireDefault(require("p-map"));
|
|
9
|
-
var _runBabel = require("./runBabel");
|
|
10
|
-
var _style = require("./style");
|
|
11
|
-
var _generatorDts = require("./generator-dts");
|
|
12
|
-
var _copyAssets = require("./copy-assets");
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
const build = async (api, config, legacyOptions) => {
|
|
15
|
-
// valid format is umd
|
|
16
|
-
if (config.format === 'umd') {
|
|
17
|
-
console.info(_utils.chalk.yellowBright('bundleless 构建暂时不支持 umd 格式'));
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
if (legacyOptions !== null && legacyOptions !== void 0 && legacyOptions.styleOnly) {
|
|
21
|
-
await (0, _style.buildStyle)(api, config);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
const tasks = config.dtsOnly ? [_generatorDts.genDts] : [_runBabel.runBabelBuild, _generatorDts.genDts, _style.buildStyle, _copyAssets.copyStaticAssets];
|
|
25
|
-
await (0, _pMap.default)(tasks, async task => {
|
|
26
|
-
await task(api, config);
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
exports.build = build;
|