@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,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ZH_LOCALE = void 0;
|
|
7
|
-
const ZH_LOCALE = {
|
|
8
|
-
command: {
|
|
9
|
-
build: {
|
|
10
|
-
describe: '构建模块命令',
|
|
11
|
-
watch: '使用 Watch 模式构建模块',
|
|
12
|
-
tsconfig: '指定 tsconfig.json 文件的路径',
|
|
13
|
-
style_only: '只构建样式文件',
|
|
14
|
-
platform: '如果存在的话,执行指定的构建任务或者全部构建任务. (构建任务包括: "storybook", "文档")',
|
|
15
|
-
no_tsc: '关闭 tsc 编译(废弃)',
|
|
16
|
-
dts: '开启 dts 文件的生成以及类型检查',
|
|
17
|
-
no_clear: '不清理产物目录',
|
|
18
|
-
config: '指定配置文件路径,可以为相对路径或绝对路径'
|
|
19
|
-
},
|
|
20
|
-
dev: {
|
|
21
|
-
describe: '本地开发命令'
|
|
22
|
-
},
|
|
23
|
-
new: {
|
|
24
|
-
describe: '模块化工程方案中执行生成器',
|
|
25
|
-
debug: '开启 Debug 模式,打印调试日志信息',
|
|
26
|
-
config: '生成器运行默认配置(JSON 字符串)',
|
|
27
|
-
distTag: '生成器使用特殊的 npm Tag 版本',
|
|
28
|
-
registry: '生成器运行过程中定制 npm Registry'
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
exports.ZH_LOCALE = ZH_LOCALE;
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.targets = exports.presets = exports.buildSchema = void 0;
|
|
7
|
-
const targets = ['es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020',
|
|
8
|
-
// The default target is esnext which means that by default, assume all of the latest JavaScript and CSS features are supported.
|
|
9
|
-
'esnext'];
|
|
10
|
-
exports.targets = targets;
|
|
11
|
-
const presets = ['npm-library', 'npm-library-with-umd', 'npm-component', 'npm-component-with-umd', ...['npm-library', 'npm-library-with-umd', 'npm-component', 'npm-component-with-umd'].reduce((ret, crt) => {
|
|
12
|
-
return [...ret, ...targets.map(t => `${crt}-${t}`)];
|
|
13
|
-
}, [])];
|
|
14
|
-
exports.presets = presets;
|
|
15
|
-
const properties = {
|
|
16
|
-
target: {
|
|
17
|
-
enum: targets
|
|
18
|
-
},
|
|
19
|
-
format: {
|
|
20
|
-
enum: ['cjs', 'esm', 'umd']
|
|
21
|
-
},
|
|
22
|
-
sourceMap: {
|
|
23
|
-
enum: [true, false, 'inline', 'external']
|
|
24
|
-
},
|
|
25
|
-
buildType: {
|
|
26
|
-
enum: ['bundle', 'bundleless']
|
|
27
|
-
},
|
|
28
|
-
bundleOptions: {
|
|
29
|
-
type: 'object',
|
|
30
|
-
properties: {
|
|
31
|
-
getModuleId: {
|
|
32
|
-
instanceof: 'Function'
|
|
33
|
-
},
|
|
34
|
-
entry: {
|
|
35
|
-
type: 'object'
|
|
36
|
-
},
|
|
37
|
-
splitting: {
|
|
38
|
-
type: 'boolean'
|
|
39
|
-
},
|
|
40
|
-
externals: {
|
|
41
|
-
type: 'array',
|
|
42
|
-
items: {
|
|
43
|
-
anyOf: [{
|
|
44
|
-
instanceof: 'RegExp'
|
|
45
|
-
}, {
|
|
46
|
-
typeof: 'string'
|
|
47
|
-
}]
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
platform: {
|
|
51
|
-
enum: ['node', 'browser']
|
|
52
|
-
},
|
|
53
|
-
minify: {
|
|
54
|
-
enum: ['esbuild', 'terser', false]
|
|
55
|
-
},
|
|
56
|
-
skipDeps: {
|
|
57
|
-
type: 'boolean'
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
bundlelessOptions: {
|
|
62
|
-
type: 'object',
|
|
63
|
-
properties: {
|
|
64
|
-
sourceDir: {
|
|
65
|
-
type: 'string'
|
|
66
|
-
},
|
|
67
|
-
style: {
|
|
68
|
-
type: 'object',
|
|
69
|
-
properties: {
|
|
70
|
-
compileMode: {
|
|
71
|
-
enum: ['all', 'only-compiled-code', 'only-source-code', false]
|
|
72
|
-
},
|
|
73
|
-
path: {
|
|
74
|
-
type: 'string'
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
static: {
|
|
79
|
-
type: 'object',
|
|
80
|
-
properties: {
|
|
81
|
-
path: {
|
|
82
|
-
type: 'string'
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
tsconfig: {
|
|
89
|
-
type: 'string'
|
|
90
|
-
},
|
|
91
|
-
enableDts: {
|
|
92
|
-
type: 'boolean'
|
|
93
|
-
},
|
|
94
|
-
dtsOnly: {
|
|
95
|
-
type: 'boolean'
|
|
96
|
-
},
|
|
97
|
-
outputPath: {
|
|
98
|
-
type: 'string'
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
const buildSchema = [{
|
|
102
|
-
target: 'output.buildConfig',
|
|
103
|
-
schema: {
|
|
104
|
-
if: {
|
|
105
|
-
type: 'array'
|
|
106
|
-
},
|
|
107
|
-
then: {
|
|
108
|
-
items: [{
|
|
109
|
-
type: 'object',
|
|
110
|
-
properties,
|
|
111
|
-
additionalProperties: false
|
|
112
|
-
}]
|
|
113
|
-
},
|
|
114
|
-
else: {
|
|
115
|
-
type: 'object',
|
|
116
|
-
properties,
|
|
117
|
-
additionalProperties: false
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}, {
|
|
121
|
-
target: 'output.buildPreset',
|
|
122
|
-
schema: {
|
|
123
|
-
enum: presets
|
|
124
|
-
}
|
|
125
|
-
}];
|
|
126
|
-
exports.buildSchema = buildSchema;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.addSchema = void 0;
|
|
7
|
-
var _source = require("./source");
|
|
8
|
-
var _output = require("./output");
|
|
9
|
-
var _tools = require("./tools");
|
|
10
|
-
const addSchema = () => [..._source.sourceSchema, ..._output.outputSchema, ..._tools.toolsSchema];
|
|
11
|
-
exports.addSchema = addSchema;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.outputSchema = void 0;
|
|
7
|
-
var _buildConfig = require("./build-config");
|
|
8
|
-
const PACKAGE_MODE_LIST = ['universal-js', 'universal-js-lite', 'browser-js', 'browser-js-lite', 'node-js'];
|
|
9
|
-
const outputSchema = [/** packageMode will deprecated */
|
|
10
|
-
{
|
|
11
|
-
target: 'output.packageMode',
|
|
12
|
-
schema: {
|
|
13
|
-
enum: PACKAGE_MODE_LIST
|
|
14
|
-
}
|
|
15
|
-
}, /** packageFields will deprecated */
|
|
16
|
-
{
|
|
17
|
-
target: 'output.packageFields',
|
|
18
|
-
schema: {
|
|
19
|
-
typeof: 'object'
|
|
20
|
-
}
|
|
21
|
-
}, /** enableSourceMap will deprecated */
|
|
22
|
-
{
|
|
23
|
-
target: 'output.enableSourceMap',
|
|
24
|
-
schema: {
|
|
25
|
-
typeof: 'boolean'
|
|
26
|
-
}
|
|
27
|
-
}, /** importStyle will deprecated */
|
|
28
|
-
{
|
|
29
|
-
target: 'output.importStyle',
|
|
30
|
-
schema: {
|
|
31
|
-
enum: ['compiled-code', 'source-code']
|
|
32
|
-
}
|
|
33
|
-
}, /** assetsPath will deprecated */
|
|
34
|
-
{
|
|
35
|
-
target: 'output.assetsPath',
|
|
36
|
-
schema: {
|
|
37
|
-
typeof: 'string',
|
|
38
|
-
default: 'styles'
|
|
39
|
-
}
|
|
40
|
-
}, {
|
|
41
|
-
target: 'output.jsPath',
|
|
42
|
-
schema: {
|
|
43
|
-
typeof: 'string',
|
|
44
|
-
default: ''
|
|
45
|
-
}
|
|
46
|
-
}, {
|
|
47
|
-
target: 'output.disableSourceMap',
|
|
48
|
-
schema: {
|
|
49
|
-
typeof: 'boolean'
|
|
50
|
-
}
|
|
51
|
-
}, ..._buildConfig.buildSchema];
|
|
52
|
-
exports.outputSchema = outputSchema;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.sourceSchema = void 0;
|
|
7
|
-
const sourceSchema = [{
|
|
8
|
-
target: 'source.jsxTransformRuntime',
|
|
9
|
-
schema: {
|
|
10
|
-
// https://babeljs.io/docs/en/babel-preset-react#runtime
|
|
11
|
-
enum: ['classic', 'automatic']
|
|
12
|
-
}
|
|
13
|
-
}];
|
|
14
|
-
exports.sourceSchema = sourceSchema;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.toolsSchema = void 0;
|
|
7
|
-
const toolsSchema = [{
|
|
8
|
-
target: 'tools.speedy',
|
|
9
|
-
schema: {
|
|
10
|
-
typeof: ['object', 'function']
|
|
11
|
-
}
|
|
12
|
-
}];
|
|
13
|
-
exports.toolsSchema = toolsSchema;
|
|
File without changes
|
package/dist/js/node/types.js
DELETED
|
File without changes
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.resolveBabelConfig = exports.getFinalAlias = void 0;
|
|
7
|
-
var _path = _interopRequireDefault(require("path"));
|
|
8
|
-
var _babelPresetModule = require("@modern-js/babel-preset-module");
|
|
9
|
-
var _utils = require("@modern-js/utils");
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
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; }
|
|
12
|
-
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; }
|
|
13
|
-
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; }
|
|
14
|
-
const getFinalAlias = (modernConfig, option) => {
|
|
15
|
-
const aliasConfig = (0, _utils.getAliasConfig)(modernConfig.source.alias, option);
|
|
16
|
-
// 排除内部别名,因为不需要处理
|
|
17
|
-
const finalPaths = {};
|
|
18
|
-
const internalAliasPrefix = '@modern-js/runtime';
|
|
19
|
-
if (aliasConfig.paths && typeof aliasConfig.paths === 'object') {
|
|
20
|
-
const pathsKey = Object.keys(aliasConfig.paths);
|
|
21
|
-
for (const key of pathsKey) {
|
|
22
|
-
if (!key.includes(internalAliasPrefix)) {
|
|
23
|
-
finalPaths[key] = aliasConfig.paths[key];
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
aliasConfig.paths = finalPaths;
|
|
28
|
-
return aliasConfig;
|
|
29
|
-
};
|
|
30
|
-
exports.getFinalAlias = getFinalAlias;
|
|
31
|
-
const resolveBabelConfig = (appDirectory, modernConfig, sourceMap, bundlelessOptions, option) => {
|
|
32
|
-
var _modernConfig$tools;
|
|
33
|
-
const {
|
|
34
|
-
source: {
|
|
35
|
-
envVars,
|
|
36
|
-
globalVars,
|
|
37
|
-
jsxTransformRuntime = 'automatic'
|
|
38
|
-
},
|
|
39
|
-
output: {
|
|
40
|
-
importStyle
|
|
41
|
-
},
|
|
42
|
-
tools: {
|
|
43
|
-
lodash: userLodashOption,
|
|
44
|
-
styledComponents
|
|
45
|
-
} = {
|
|
46
|
-
lodash: {},
|
|
47
|
-
styledComponents: {}
|
|
48
|
-
}
|
|
49
|
-
} = modernConfig;
|
|
50
|
-
|
|
51
|
-
// alias config
|
|
52
|
-
const aliasConfig = getFinalAlias(modernConfig, _objectSpread({
|
|
53
|
-
appDirectory
|
|
54
|
-
}, option));
|
|
55
|
-
|
|
56
|
-
// lodash config
|
|
57
|
-
const lodashOptions = (0, _utils.applyOptionsChain)({
|
|
58
|
-
id: ['lodash', 'ramda']
|
|
59
|
-
},
|
|
60
|
-
// TODO: 需要处理类型问题
|
|
61
|
-
userLodashOption || {});
|
|
62
|
-
// babel config
|
|
63
|
-
const internalBabelConfig = (0, _babelPresetModule.getBabelConfig)({
|
|
64
|
-
appDirectory,
|
|
65
|
-
enableReactPreset: true,
|
|
66
|
-
enableTypescriptPreset: true,
|
|
67
|
-
alias: aliasConfig,
|
|
68
|
-
envVars,
|
|
69
|
-
globalVars,
|
|
70
|
-
lodashOptions,
|
|
71
|
-
jsxTransformRuntime,
|
|
72
|
-
importStyle,
|
|
73
|
-
sourceDir: _path.default.join(appDirectory, bundlelessOptions.sourceDir),
|
|
74
|
-
styleDir: bundlelessOptions.style.path,
|
|
75
|
-
staticDir: bundlelessOptions.static.path,
|
|
76
|
-
styledComponentsOptions: (0, _utils.applyOptionsChain)({
|
|
77
|
-
pure: true,
|
|
78
|
-
displayName: true,
|
|
79
|
-
ssr: (0, _utils.isUseSSRBundle)(modernConfig),
|
|
80
|
-
transpileTemplateLiterals: true
|
|
81
|
-
}, styledComponents)
|
|
82
|
-
}, {
|
|
83
|
-
type: option.type,
|
|
84
|
-
syntax: option.syntax
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
// Preventing warning when files are too large
|
|
88
|
-
internalBabelConfig.compact = false;
|
|
89
|
-
internalBabelConfig.sourceMaps = sourceMap === 'external' ? true : sourceMap;
|
|
90
|
-
const userBabelConfig = (_modernConfig$tools = modernConfig.tools) === null || _modernConfig$tools === void 0 ? void 0 : _modernConfig$tools.babel;
|
|
91
|
-
return (0, _babelPresetModule.applyUserBabelConfig)(internalBabelConfig, userBabelConfig);
|
|
92
|
-
};
|
|
93
|
-
exports.resolveBabelConfig = resolveBabelConfig;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.tempTsconfigName = exports.cliTsConfigDefaultValue = void 0;
|
|
7
|
-
// generator tsconfig file
|
|
8
|
-
const tempTsconfigName = 'tsconfig.temp.json';
|
|
9
|
-
exports.tempTsconfigName = tempTsconfigName;
|
|
10
|
-
const cliTsConfigDefaultValue = './tsconfig.json';
|
|
11
|
-
exports.cliTsConfigDefaultValue = cliTsConfigDefaultValue;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.copyTask = void 0;
|
|
7
|
-
var path = _interopRequireWildcard(require("path"));
|
|
8
|
-
var _utils = require("@modern-js/utils");
|
|
9
|
-
const _excluded = ["glob"];
|
|
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 _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
13
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
14
|
-
const normalizePath = _utils.Import.lazy('normalize-path', require);
|
|
15
|
-
const copyTask = async option => {
|
|
16
|
-
const {
|
|
17
|
-
modernConfig,
|
|
18
|
-
appContext
|
|
19
|
-
} = option;
|
|
20
|
-
const {
|
|
21
|
-
appDirectory
|
|
22
|
-
} = appContext;
|
|
23
|
-
const {
|
|
24
|
-
output: {
|
|
25
|
-
copy,
|
|
26
|
-
path: outputPath = 'dist',
|
|
27
|
-
jsPath = 'js'
|
|
28
|
-
}
|
|
29
|
-
} = modernConfig;
|
|
30
|
-
const copyDistDir = path.join(outputPath, jsPath);
|
|
31
|
-
if (!copy) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
try {
|
|
35
|
-
// 类型暂时这样处理,待之后优化copy的逻辑
|
|
36
|
-
for (const copyOption of copy) {
|
|
37
|
-
// 在原来的基础上,引入了类似于 copy-webpack-plugin 的 context 属性,可以设置项目根路径
|
|
38
|
-
const {
|
|
39
|
-
context = appDirectory,
|
|
40
|
-
from,
|
|
41
|
-
globOptions,
|
|
42
|
-
to: toOrigin
|
|
43
|
-
} = copyOption;
|
|
44
|
-
let fromOrigin = from;
|
|
45
|
-
// 获取 glob 规则
|
|
46
|
-
let glob = '';
|
|
47
|
-
let options = {};
|
|
48
|
-
if (fromOrigin !== null && typeof fromOrigin === 'object') {
|
|
49
|
-
var _fromOrigin = fromOrigin;
|
|
50
|
-
({
|
|
51
|
-
glob
|
|
52
|
-
} = _fromOrigin);
|
|
53
|
-
options = _objectWithoutProperties(_fromOrigin, _excluded);
|
|
54
|
-
_fromOrigin;
|
|
55
|
-
fromOrigin = glob;
|
|
56
|
-
} else if (globOptions && typeof globOptions === 'object') {
|
|
57
|
-
options = globOptions;
|
|
58
|
-
}
|
|
59
|
-
glob = path.isAbsolute(fromOrigin) ? fromOrigin : path.posix.join(_utils.fastGlob.escapePath(normalizePath(path.resolve(context))), fromOrigin);
|
|
60
|
-
// 计算 glob,获取目标文件
|
|
61
|
-
const paths = await (0, _utils.globby)((0, _utils.slash)(glob), options);
|
|
62
|
-
if (!paths.length) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
const to = path.normalize(toOrigin ? toOrigin : '');
|
|
66
|
-
const isToDirectory = path.extname(to) === '';
|
|
67
|
-
paths.forEach(item => {
|
|
68
|
-
const relativeFrom = path.relative(context, item);
|
|
69
|
-
// 如果 to 是目录,通过相对路径计算完整的产物路径;如果 to 是文件,直接作为最终产物路径
|
|
70
|
-
const fileName = isToDirectory ? path.join(to, relativeFrom) : to;
|
|
71
|
-
const finalToPath = path.resolve(copyDistDir, fileName);
|
|
72
|
-
_utils.fs.copySync(item, finalToPath);
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
} catch (e) {
|
|
76
|
-
console.error(`copy error: ${e.message}`);
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
exports.copyTask = copyTask;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.initEnv = void 0;
|
|
7
|
-
const initEnv = ({
|
|
8
|
-
syntax,
|
|
9
|
-
type
|
|
10
|
-
}) => {
|
|
11
|
-
if (syntax === 'es6+' && type === 'commonjs') {
|
|
12
|
-
return 'CJS_ES6';
|
|
13
|
-
} else if (syntax === 'es6+' && type === 'module') {
|
|
14
|
-
return 'ESM_ES6';
|
|
15
|
-
} else if (syntax === 'es5' && type === 'module') {
|
|
16
|
-
return 'ESM_ES5';
|
|
17
|
-
}
|
|
18
|
-
return '';
|
|
19
|
-
};
|
|
20
|
-
exports.initEnv = initEnv;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.safeParse = void 0;
|
|
7
|
-
const safeParse = jsonString => {
|
|
8
|
-
try {
|
|
9
|
-
return {
|
|
10
|
-
code: 0,
|
|
11
|
-
value: JSON.parse(jsonString)
|
|
12
|
-
};
|
|
13
|
-
} catch (e) {
|
|
14
|
-
return {
|
|
15
|
-
code: 1,
|
|
16
|
-
value: jsonString
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
exports.safeParse = safeParse;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getLocaleLanguage = getLocaleLanguage;
|
|
7
|
-
var _utils = require("@modern-js/utils");
|
|
8
|
-
const i18n = _utils.Import.lazy('@modern-js/plugin-i18n/language-detector', require);
|
|
9
|
-
function getLocaleLanguage() {
|
|
10
|
-
const detector = new i18n.I18CLILanguageDetector();
|
|
11
|
-
return detector.detect();
|
|
12
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.logTemplate = exports.clearFlag = exports.LoggerText = exports.LoggerManager = void 0;
|
|
7
|
-
var _events = _interopRequireDefault(require("events"));
|
|
8
|
-
var _utils = require("@modern-js/utils");
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
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; }
|
|
11
|
-
const clearFlag = '\x1Bc';
|
|
12
|
-
exports.clearFlag = clearFlag;
|
|
13
|
-
const logTemplate = (title, messageStack, maxLength, {
|
|
14
|
-
noBottomBorder: _noBottomBorder = false,
|
|
15
|
-
bottomBorderText: _bottomBorderText = '',
|
|
16
|
-
noLeftBorder: _noLeftBorder = false,
|
|
17
|
-
leftBorder: _leftBorder = '│',
|
|
18
|
-
contentColor: _contentColor = s => s
|
|
19
|
-
} = {}) => {
|
|
20
|
-
const leftBorderFlag = _noLeftBorder ? '' : _leftBorder;
|
|
21
|
-
const messageFragments = messageStack.map(p => {
|
|
22
|
-
p.trim();
|
|
23
|
-
return `${leftBorderFlag}${p.replace(clearFlag, '')}`;
|
|
24
|
-
}) // 移除 clearFlag
|
|
25
|
-
.filter(s => s !== leftBorderFlag) // 过滤空字符串
|
|
26
|
-
.slice(0, maxLength) // 控制长度
|
|
27
|
-
.reverse(); // 调换顺序,最新的消息在最后面
|
|
28
|
-
messageFragments[messageFragments.length - 1] = messageFragments[messageFragments.length - 1].trim();
|
|
29
|
-
const template = `${title}:
|
|
30
|
-
${_contentColor(messageFragments.join(''))}${_noBottomBorder ? '' : `\n${_bottomBorderText}`}`;
|
|
31
|
-
console.info('template', messageFragments);
|
|
32
|
-
return template;
|
|
33
|
-
};
|
|
34
|
-
exports.logTemplate = logTemplate;
|
|
35
|
-
class LoggerText {
|
|
36
|
-
constructor(option) {
|
|
37
|
-
_defineProperty(this, "messages", void 0);
|
|
38
|
-
_defineProperty(this, "option", void 0);
|
|
39
|
-
this.messages = [];
|
|
40
|
-
this.option = option;
|
|
41
|
-
}
|
|
42
|
-
append(message) {
|
|
43
|
-
var _this$option$contentC;
|
|
44
|
-
const replace = ((_this$option$contentC = this.option.contentConfig) === null || _this$option$contentC === void 0 ? void 0 : _this$option$contentC.replace) || [];
|
|
45
|
-
let content = message;
|
|
46
|
-
for (const r of replace) {
|
|
47
|
-
content = content.replace(new RegExp(r, 'g'), '');
|
|
48
|
-
}
|
|
49
|
-
this.messages.push(content);
|
|
50
|
-
}
|
|
51
|
-
get value() {
|
|
52
|
-
const {
|
|
53
|
-
title,
|
|
54
|
-
maxLength,
|
|
55
|
-
contentConfig
|
|
56
|
-
} = this.option;
|
|
57
|
-
const messages = [...new Set(this.messages)];
|
|
58
|
-
return logTemplate(title, messages, maxLength, contentConfig);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
exports.LoggerText = LoggerText;
|
|
62
|
-
class LoggerManager extends _events.default {
|
|
63
|
-
// constructor() {}
|
|
64
|
-
|
|
65
|
-
createLoggerText(option) {
|
|
66
|
-
return new LoggerText(option);
|
|
67
|
-
}
|
|
68
|
-
addStdout(loggerText, stdout, config = {}) {
|
|
69
|
-
const {
|
|
70
|
-
event = {
|
|
71
|
-
data: true,
|
|
72
|
-
error: true
|
|
73
|
-
},
|
|
74
|
-
colors = {
|
|
75
|
-
data: _utils.chalk.green,
|
|
76
|
-
error: _utils.chalk.red,
|
|
77
|
-
warning: _utils.chalk.yellow
|
|
78
|
-
}
|
|
79
|
-
} = config;
|
|
80
|
-
if (event.data) {
|
|
81
|
-
stdout === null || stdout === void 0 ? void 0 : stdout.on('data', chunk => {
|
|
82
|
-
const data = chunk.toString();
|
|
83
|
-
const content = colors.data ? colors.data(data) : _utils.chalk.green(data);
|
|
84
|
-
loggerText.append(content);
|
|
85
|
-
this.emit('data');
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
if (event.error) {
|
|
89
|
-
stdout === null || stdout === void 0 ? void 0 : stdout.on('error', error => {
|
|
90
|
-
const data = error.message;
|
|
91
|
-
const content = colors.error ? colors.error(data) : _utils.chalk.red(data);
|
|
92
|
-
loggerText.append(content);
|
|
93
|
-
this.emit('data');
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
addStderr(loggerText, stderr) {
|
|
98
|
-
stderr === null || stderr === void 0 ? void 0 : stderr.on('data', chunk => {
|
|
99
|
-
const data = chunk.toString();
|
|
100
|
-
loggerText.append(data);
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
show(loggerText) {
|
|
104
|
-
console.info(loggerText.value);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
exports.LoggerManager = LoggerManager;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ReadlineUtils = void 0;
|
|
7
|
-
var readline = _interopRequireWildcard(require("readline"));
|
|
8
|
-
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); }
|
|
9
|
-
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; }
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
11
|
-
class ReadlineUtils {
|
|
12
|
-
static clearPrevLine(output) {
|
|
13
|
-
ReadlineUtils.clearLine(output, 1);
|
|
14
|
-
}
|
|
15
|
-
static clearLine(output, n = 1, dir = -1) {
|
|
16
|
-
// -1 向上,1 向下
|
|
17
|
-
const dx = dir === 1 ? 1 : -1;
|
|
18
|
-
for (let i = 0; i < n; i++) {
|
|
19
|
-
readline.moveCursor(output, 0, dx);
|
|
20
|
-
readline.clearLine(output, 0);
|
|
21
|
-
readline.cursorTo(output, 0);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
exports.ReadlineUtils = ReadlineUtils;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.readTsConfig = exports.existTsConfigFile = void 0;
|
|
7
|
-
var _utils = require("@modern-js/utils");
|
|
8
|
-
const readTsConfig = (tsconfigPath, noExistReturn = null) => {
|
|
9
|
-
// 如果不存在,则返回 noExistReturn
|
|
10
|
-
if (!_utils.fs.existsSync(tsconfigPath)) {
|
|
11
|
-
return noExistReturn;
|
|
12
|
-
}
|
|
13
|
-
const content = _utils.fs.readFileSync(tsconfigPath, 'utf-8');
|
|
14
|
-
return _utils.json5.parse(content);
|
|
15
|
-
};
|
|
16
|
-
exports.readTsConfig = readTsConfig;
|
|
17
|
-
const existTsConfigFile = tsconfigAbsolutePath => {
|
|
18
|
-
const tsconfig = readTsConfig(tsconfigAbsolutePath);
|
|
19
|
-
return Boolean(tsconfig);
|
|
20
|
-
};
|
|
21
|
-
exports.existTsConfigFile = existTsConfigFile;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.defaultTransformedFunctions = void 0;
|
|
7
|
-
const defaultTransformedFunctions = ['require', 'require.resolve', 'System.import',
|
|
8
|
-
// Jest methods
|
|
9
|
-
'jest.genMockFromModule', 'jest.mock', 'jest.unmock', 'jest.doMock', 'jest.dontMock', 'jest.setMock', 'jest.requireActual', 'jest.requireMock',
|
|
10
|
-
// Older Jest methods
|
|
11
|
-
'require.requireActual', 'require.requireMock'];
|
|
12
|
-
exports.defaultTransformedFunctions = defaultTransformedFunctions;
|