@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,13 +0,0 @@
|
|
|
1
|
-
export const initEnv = ({
|
|
2
|
-
syntax,
|
|
3
|
-
type
|
|
4
|
-
}) => {
|
|
5
|
-
if (syntax === 'es6+' && type === 'commonjs') {
|
|
6
|
-
return 'CJS_ES6';
|
|
7
|
-
} else if (syntax === 'es6+' && type === 'module') {
|
|
8
|
-
return 'ESM_ES6';
|
|
9
|
-
} else if (syntax === 'es5' && type === 'module') {
|
|
10
|
-
return 'ESM_ES5';
|
|
11
|
-
}
|
|
12
|
-
return '';
|
|
13
|
-
};
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
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; }
|
|
2
|
-
import EventEmitter from 'events';
|
|
3
|
-
import { chalk } from '@modern-js/utils';
|
|
4
|
-
export const clearFlag = '\x1Bc';
|
|
5
|
-
export const logTemplate = (title, messageStack, maxLength, {
|
|
6
|
-
noBottomBorder: _noBottomBorder = false,
|
|
7
|
-
bottomBorderText: _bottomBorderText = '',
|
|
8
|
-
noLeftBorder: _noLeftBorder = false,
|
|
9
|
-
leftBorder: _leftBorder = '│',
|
|
10
|
-
contentColor: _contentColor = s => s
|
|
11
|
-
} = {}) => {
|
|
12
|
-
const leftBorderFlag = _noLeftBorder ? '' : _leftBorder;
|
|
13
|
-
const messageFragments = messageStack.map(p => {
|
|
14
|
-
p.trim();
|
|
15
|
-
return `${leftBorderFlag}${p.replace(clearFlag, '')}`;
|
|
16
|
-
}) // 移除 clearFlag
|
|
17
|
-
.filter(s => s !== leftBorderFlag) // 过滤空字符串
|
|
18
|
-
.slice(0, maxLength) // 控制长度
|
|
19
|
-
.reverse(); // 调换顺序,最新的消息在最后面
|
|
20
|
-
messageFragments[messageFragments.length - 1] = messageFragments[messageFragments.length - 1].trim();
|
|
21
|
-
const template = `${title}:
|
|
22
|
-
${_contentColor(messageFragments.join(''))}${_noBottomBorder ? '' : `\n${_bottomBorderText}`}`;
|
|
23
|
-
console.info('template', messageFragments);
|
|
24
|
-
return template;
|
|
25
|
-
};
|
|
26
|
-
export class LoggerText {
|
|
27
|
-
constructor(option) {
|
|
28
|
-
_defineProperty(this, "messages", void 0);
|
|
29
|
-
_defineProperty(this, "option", void 0);
|
|
30
|
-
this.messages = [];
|
|
31
|
-
this.option = option;
|
|
32
|
-
}
|
|
33
|
-
append(message) {
|
|
34
|
-
var _this$option$contentC;
|
|
35
|
-
const replace = ((_this$option$contentC = this.option.contentConfig) === null || _this$option$contentC === void 0 ? void 0 : _this$option$contentC.replace) || [];
|
|
36
|
-
let content = message;
|
|
37
|
-
for (const r of replace) {
|
|
38
|
-
content = content.replace(new RegExp(r, 'g'), '');
|
|
39
|
-
}
|
|
40
|
-
this.messages.push(content);
|
|
41
|
-
}
|
|
42
|
-
get value() {
|
|
43
|
-
const {
|
|
44
|
-
title,
|
|
45
|
-
maxLength,
|
|
46
|
-
contentConfig
|
|
47
|
-
} = this.option;
|
|
48
|
-
const messages = [...new Set(this.messages)];
|
|
49
|
-
return logTemplate(title, messages, maxLength, contentConfig);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
export class LoggerManager extends EventEmitter {
|
|
53
|
-
// constructor() {}
|
|
54
|
-
|
|
55
|
-
createLoggerText(option) {
|
|
56
|
-
return new LoggerText(option);
|
|
57
|
-
}
|
|
58
|
-
addStdout(loggerText, stdout, config = {}) {
|
|
59
|
-
const {
|
|
60
|
-
event = {
|
|
61
|
-
data: true,
|
|
62
|
-
error: true
|
|
63
|
-
},
|
|
64
|
-
colors = {
|
|
65
|
-
data: chalk.green,
|
|
66
|
-
error: chalk.red,
|
|
67
|
-
warning: chalk.yellow
|
|
68
|
-
}
|
|
69
|
-
} = config;
|
|
70
|
-
if (event.data) {
|
|
71
|
-
stdout === null || stdout === void 0 ? void 0 : stdout.on('data', chunk => {
|
|
72
|
-
const data = chunk.toString();
|
|
73
|
-
const content = colors.data ? colors.data(data) : chalk.green(data);
|
|
74
|
-
loggerText.append(content);
|
|
75
|
-
this.emit('data');
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
if (event.error) {
|
|
79
|
-
stdout === null || stdout === void 0 ? void 0 : stdout.on('error', error => {
|
|
80
|
-
const data = error.message;
|
|
81
|
-
const content = colors.error ? colors.error(data) : chalk.red(data);
|
|
82
|
-
loggerText.append(content);
|
|
83
|
-
this.emit('data');
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
addStderr(loggerText, stderr) {
|
|
88
|
-
stderr === null || stderr === void 0 ? void 0 : stderr.on('data', chunk => {
|
|
89
|
-
const data = chunk.toString();
|
|
90
|
-
loggerText.append(data);
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
show(loggerText) {
|
|
94
|
-
console.info(loggerText.value);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as readline from 'readline';
|
|
2
|
-
|
|
3
|
-
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
4
|
-
export class ReadlineUtils {
|
|
5
|
-
static clearPrevLine(output) {
|
|
6
|
-
ReadlineUtils.clearLine(output, 1);
|
|
7
|
-
}
|
|
8
|
-
static clearLine(output, n = 1, dir = -1) {
|
|
9
|
-
// -1 向上,1 向下
|
|
10
|
-
const dx = dir === 1 ? 1 : -1;
|
|
11
|
-
for (let i = 0; i < n; i++) {
|
|
12
|
-
readline.moveCursor(output, 0, dx);
|
|
13
|
-
readline.clearLine(output, 0);
|
|
14
|
-
readline.cursorTo(output, 0);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { fs, json5 } from '@modern-js/utils';
|
|
2
|
-
export const readTsConfig = (tsconfigPath, noExistReturn = null) => {
|
|
3
|
-
// 如果不存在,则返回 noExistReturn
|
|
4
|
-
if (!fs.existsSync(tsconfigPath)) {
|
|
5
|
-
return noExistReturn;
|
|
6
|
-
}
|
|
7
|
-
const content = fs.readFileSync(tsconfigPath, 'utf-8');
|
|
8
|
-
return json5.parse(content);
|
|
9
|
-
};
|
|
10
|
-
export const existTsConfigFile = tsconfigAbsolutePath => {
|
|
11
|
-
const tsconfig = readTsConfig(tsconfigAbsolutePath);
|
|
12
|
-
return Boolean(tsconfig);
|
|
13
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export const defaultTransformedFunctions = ['require', 'require.resolve', 'System.import',
|
|
2
|
-
// Jest methods
|
|
3
|
-
'jest.genMockFromModule', 'jest.mock', 'jest.unmock', 'jest.doMock', 'jest.dontMock', 'jest.setMock', 'jest.requireActual', 'jest.requireMock',
|
|
4
|
-
// Older Jest methods
|
|
5
|
-
'require.requireActual', 'require.requireMock'];
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import * as path from 'path';
|
|
2
|
-
import * as parser from '@babel/parser';
|
|
3
|
-
import traverse from '@babel/traverse';
|
|
4
|
-
import generator from '@babel/generator';
|
|
5
|
-
import * as t from '@babel/types';
|
|
6
|
-
import { createMatchPath } from '@modern-js/utils/tsconfig-paths';
|
|
7
|
-
import { fs } from '@modern-js/utils';
|
|
8
|
-
import { defaultTransformedFunctions } from "./constants";
|
|
9
|
-
import { matchesPattern, isImportCall } from "./utils";
|
|
10
|
-
const getPathsMap = (paths, sourceDirName = 'src') => {
|
|
11
|
-
const pathKeys = Object.keys(paths);
|
|
12
|
-
const pathsMap = {};
|
|
13
|
-
const replaceSrcToTypes = s => s.replace(sourceDirName, 'types');
|
|
14
|
-
for (const key of pathKeys) {
|
|
15
|
-
const p = paths[key];
|
|
16
|
-
if (typeof p === 'string') {
|
|
17
|
-
pathsMap[key] = [replaceSrcToTypes(p)];
|
|
18
|
-
} else {
|
|
19
|
-
pathsMap[key] = paths[key].map(sp => replaceSrcToTypes(sp));
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return pathsMap;
|
|
23
|
-
};
|
|
24
|
-
function mapPathString(nodePath, {
|
|
25
|
-
filename,
|
|
26
|
-
baseUrl,
|
|
27
|
-
paths
|
|
28
|
-
}) {
|
|
29
|
-
if (!t.isStringLiteral(nodePath)) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
const sourcePath = nodePath.node.value;
|
|
33
|
-
const currentFile = filename;
|
|
34
|
-
const pathsMap = getPathsMap(paths);
|
|
35
|
-
const matchPath = createMatchPath(baseUrl, pathsMap, ['index']);
|
|
36
|
-
const result = matchPath(sourcePath, packageJsonPath => {
|
|
37
|
-
if (!fs.existsSync(packageJsonPath)) {
|
|
38
|
-
return undefined;
|
|
39
|
-
}
|
|
40
|
-
return fs.readJSONSync(packageJsonPath);
|
|
41
|
-
}, filePath => fs.existsSync(filePath), ['.d.ts']);
|
|
42
|
-
if (result) {
|
|
43
|
-
const relativePath = path.relative(path.dirname(currentFile), path.dirname(result));
|
|
44
|
-
const fileName = path.basename(result);
|
|
45
|
-
// 如果是同级文件,则返回的是 ''
|
|
46
|
-
const filePath = path.normalize(`${relativePath.length === 0 ? '.' : relativePath}/${fileName}`);
|
|
47
|
-
const replaceString = filePath.startsWith('.') ? filePath : `./${filePath}`;
|
|
48
|
-
nodePath.replaceWith(t.stringLiteral(replaceString));
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
const transformCall = option => nodePath => {
|
|
52
|
-
const calleePath = nodePath.get('callee');
|
|
53
|
-
const isNormalCall = defaultTransformedFunctions.some(pattern => matchesPattern(calleePath, pattern));
|
|
54
|
-
if (isNormalCall || isImportCall(nodePath)) {
|
|
55
|
-
mapPathString(nodePath.get('arguments.0'), option);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
const transformImport = option => nodePath => {
|
|
59
|
-
mapPathString(nodePath.get('source'), option);
|
|
60
|
-
};
|
|
61
|
-
const transformExport = option => nodePath => {
|
|
62
|
-
mapPathString(nodePath.get('source'), option);
|
|
63
|
-
};
|
|
64
|
-
const transformSingleFileAlias = ({
|
|
65
|
-
filename,
|
|
66
|
-
baseUrl,
|
|
67
|
-
paths
|
|
68
|
-
}) => {
|
|
69
|
-
const sourceCode = fs.readFileSync(filename, 'utf-8');
|
|
70
|
-
const ast = parser.parse(sourceCode, {
|
|
71
|
-
sourceType: 'module',
|
|
72
|
-
errorRecovery: true,
|
|
73
|
-
// 防止typescript不支持的语法出现而报错
|
|
74
|
-
plugins: ['typescript']
|
|
75
|
-
});
|
|
76
|
-
traverse(ast, {
|
|
77
|
-
CallExpression: transformCall({
|
|
78
|
-
filename,
|
|
79
|
-
baseUrl,
|
|
80
|
-
paths
|
|
81
|
-
}),
|
|
82
|
-
ImportDeclaration: transformImport({
|
|
83
|
-
filename,
|
|
84
|
-
baseUrl,
|
|
85
|
-
paths
|
|
86
|
-
}),
|
|
87
|
-
ExportDeclaration: transformExport({
|
|
88
|
-
filename,
|
|
89
|
-
baseUrl,
|
|
90
|
-
paths
|
|
91
|
-
})
|
|
92
|
-
});
|
|
93
|
-
return generator(ast).code;
|
|
94
|
-
};
|
|
95
|
-
export const transformDtsAlias = option => {
|
|
96
|
-
const {
|
|
97
|
-
filenames = [],
|
|
98
|
-
baseUrl,
|
|
99
|
-
paths
|
|
100
|
-
} = option;
|
|
101
|
-
const transformResult = [];
|
|
102
|
-
for (const filename of filenames) {
|
|
103
|
-
transformResult.push({
|
|
104
|
-
path: filename,
|
|
105
|
-
content: transformSingleFileAlias({
|
|
106
|
-
filename,
|
|
107
|
-
baseUrl,
|
|
108
|
-
paths
|
|
109
|
-
})
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
return transformResult;
|
|
113
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Import } from '@modern-js/utils';
|
|
2
|
-
const t = Import.lazy('@babel/types', require);
|
|
3
|
-
export function matchesPattern(calleePath, pattern) {
|
|
4
|
-
const {
|
|
5
|
-
node
|
|
6
|
-
} = calleePath;
|
|
7
|
-
if (t.isMemberExpression(node)) {
|
|
8
|
-
return calleePath.matchesPattern(pattern);
|
|
9
|
-
}
|
|
10
|
-
if (!t.isIdentifier(node) || pattern.includes('.')) {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
const name = pattern.split('.')[0];
|
|
14
|
-
return node.name === name;
|
|
15
|
-
}
|
|
16
|
-
export function isImportCall(calleePath) {
|
|
17
|
-
return t.isImport(calleePath.node.callee);
|
|
18
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { validAlias } from '@modern-js/utils';
|
|
2
|
-
export const valideBeforeTask = ({
|
|
3
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4
|
-
modernConfig,
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
6
|
-
tsconfigPath
|
|
7
|
-
}) => {
|
|
8
|
-
// const modernConfigValidResult = modernConfigValid(modernConfig, {
|
|
9
|
-
// tsconfigPath,
|
|
10
|
-
// });
|
|
11
|
-
// if (modernConfigValidResult) {
|
|
12
|
-
// console.error(modernConfigValidResult);
|
|
13
|
-
// // eslint-disable-next-line no-process-exit
|
|
14
|
-
// process.exit(0);
|
|
15
|
-
// }
|
|
16
|
-
};
|
|
17
|
-
export const modernConfigValid = (modernConfig, option) => {
|
|
18
|
-
const valids = [validAlias];
|
|
19
|
-
for (const validFn of valids) {
|
|
20
|
-
const result = validFn(modernConfig, option);
|
|
21
|
-
if (result) {
|
|
22
|
-
return result;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return null;
|
|
26
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.buildCli = void 0;
|
|
7
|
-
var _utils = require("@modern-js/utils");
|
|
8
|
-
const local = _utils.Import.lazy('../locale/index', require);
|
|
9
|
-
const command = _utils.Import.lazy('../commands/build', require);
|
|
10
|
-
const buildCli = (program, api) => {
|
|
11
|
-
return program.command('build').usage('[options]').description(local.i18n.t(local.localeKeys.command.build.describe)).option('-w, --watch', local.i18n.t(local.localeKeys.command.build.watch)).option('--tsconfig [tsconfig]', local.i18n.t(local.localeKeys.command.build.tsconfig), './tsconfig.json').option('--style-only', local.i18n.t(local.localeKeys.command.build.style_only)).option('-p, --platform [platform]', local.i18n.t(local.localeKeys.command.build.platform))
|
|
12
|
-
// @deprecated
|
|
13
|
-
// The `--no-tsc` option has been superceded by the `--no-dts` option.
|
|
14
|
-
.option('--no-tsc', local.i18n.t(local.localeKeys.command.build.no_tsc)).option('--dts', local.i18n.t(local.localeKeys.command.build.dts)).option('--no-clear', local.i18n.t(local.localeKeys.command.build.no_clear)).option('-c --config <config>', local.i18n.t(local.localeKeys.command.build.config)).action(async subCommand => {
|
|
15
|
-
await command.build(api, subCommand);
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
exports.buildCli = buildCli;
|
package/dist/js/node/cli/dev.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.devCli = void 0;
|
|
7
|
-
var _utils = require("@modern-js/utils");
|
|
8
|
-
const local = _utils.Import.lazy('../locale', require);
|
|
9
|
-
const commands = _utils.Import.lazy('../commands', require);
|
|
10
|
-
const devCli = (program, api) => {
|
|
11
|
-
program.command('dev [subCmd]').usage('[options]').description(local.i18n.t(local.localeKeys.command.dev.describe)).option('--tsconfig [tsconfig]', local.i18n.t(local.localeKeys.command.build.tsconfig), './tsconfig.json').action(async (subCmd, params) => {
|
|
12
|
-
await commands.dev(api, params, subCmd);
|
|
13
|
-
// support plugin-proxy
|
|
14
|
-
const runner = api.useHookRunners();
|
|
15
|
-
await runner.afterDev();
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
exports.devCli = devCli;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _build = require("./build");
|
|
7
|
-
Object.keys(_build).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _build[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _build[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _dev = require("./dev");
|
|
18
|
-
Object.keys(_dev).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _dev[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _dev[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
var _new = require("./new");
|
|
29
|
-
Object.keys(_new).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] === _new[key]) return;
|
|
32
|
-
Object.defineProperty(exports, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return _new[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
package/dist/js/node/cli/new.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.newCli = void 0;
|
|
7
|
-
var _utils = require("@modern-js/utils");
|
|
8
|
-
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; }
|
|
9
|
-
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; }
|
|
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 newAction = _utils.Import.lazy('@modern-js/new-action', require);
|
|
12
|
-
const local = _utils.Import.lazy('../locale', require);
|
|
13
|
-
const newCli = (program, locale) => {
|
|
14
|
-
program.command('new').usage('[options]').description(local.i18n.t(local.localeKeys.command.new.describe)).option('-d, --debug', local.i18n.t(local.localeKeys.command.new.debug), false).option('-c, --config <config>', local.i18n.t(local.localeKeys.command.new.config)).option('--dist-tag <tag>', local.i18n.t(local.localeKeys.command.new.distTag)).option('--registry', local.i18n.t(local.localeKeys.command.new.registry)).action(async options => {
|
|
15
|
-
await newAction.ModuleNewAction(_objectSpread(_objectSpread({}, options), {}, {
|
|
16
|
-
locale
|
|
17
|
-
}));
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
exports.newCli = newCli;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.init = exports.build = void 0;
|
|
7
|
-
var path = _interopRequireWildcard(require("path"));
|
|
8
|
-
var _utils = require("@modern-js/utils");
|
|
9
|
-
var _signalExit = _interopRequireDefault(require("signal-exit"));
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
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); }
|
|
12
|
-
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; }
|
|
13
|
-
const tsConfigutils = _utils.Import.lazy('../utils/tsconfig', require);
|
|
14
|
-
const valid = _utils.Import.lazy('../utils/valide', require);
|
|
15
|
-
const buildFeature = _utils.Import.lazy('../features/build', require);
|
|
16
|
-
/**
|
|
17
|
-
* init work before build task.
|
|
18
|
-
* @param api
|
|
19
|
-
*/
|
|
20
|
-
const init = api => {
|
|
21
|
-
const {
|
|
22
|
-
appDirectory
|
|
23
|
-
} = api.useAppContext();
|
|
24
|
-
_utils.dotenv.config();
|
|
25
|
-
(0, _signalExit.default)(async code => {
|
|
26
|
-
if (code === 0) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const tempTsconfigPathPattern = path.join(appDirectory, './node_modules', `./tsconfig.**.**.json`);
|
|
30
|
-
const files = (0, _utils.globby)((0, _utils.slash)(tempTsconfigPathPattern), {
|
|
31
|
-
stats: true,
|
|
32
|
-
absolute: true
|
|
33
|
-
});
|
|
34
|
-
const currentTime = Date.now();
|
|
35
|
-
for (const file of files) {
|
|
36
|
-
// over 30s, will delete it
|
|
37
|
-
if (currentTime - file.stats.birthtimeMs >= 30 * 1000) {
|
|
38
|
-
_utils.fs.unlinkSync(file.path);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
exports.init = init;
|
|
44
|
-
const build = async (api, buildCommandOption) => {
|
|
45
|
-
var _modernConfig$output$, _modernConfig$output;
|
|
46
|
-
const {
|
|
47
|
-
watch = false,
|
|
48
|
-
tsconfig: tsconfigName,
|
|
49
|
-
tsc,
|
|
50
|
-
dts = false,
|
|
51
|
-
clear,
|
|
52
|
-
platform = false,
|
|
53
|
-
styleOnly = false
|
|
54
|
-
} = buildCommandOption;
|
|
55
|
-
init(api);
|
|
56
|
-
const {
|
|
57
|
-
appDirectory
|
|
58
|
-
} = api.useAppContext();
|
|
59
|
-
const modernConfig = api.useResolvedConfigContext();
|
|
60
|
-
const tsconfigPath = path.join(appDirectory, tsconfigName);
|
|
61
|
-
const outputPath = (_modernConfig$output$ = modernConfig === null || modernConfig === void 0 ? void 0 : (_modernConfig$output = modernConfig.output) === null || _modernConfig$output === void 0 ? void 0 : _modernConfig$output.path) !== null && _modernConfig$output$ !== void 0 ? _modernConfig$output$ : 'dist';
|
|
62
|
-
const isTsProject = tsConfigutils.existTsConfigFile(tsconfigPath);
|
|
63
|
-
const enableDtsGen = isTsProject && dts;
|
|
64
|
-
valid.valideBeforeTask({
|
|
65
|
-
modernConfig,
|
|
66
|
-
tsconfigPath
|
|
67
|
-
});
|
|
68
|
-
await buildFeature.build(api, {
|
|
69
|
-
enableWatchMode: watch,
|
|
70
|
-
enableDtsGen,
|
|
71
|
-
isTsProject,
|
|
72
|
-
tsconfigName,
|
|
73
|
-
outputPath,
|
|
74
|
-
styleOnly,
|
|
75
|
-
platform,
|
|
76
|
-
clear,
|
|
77
|
-
legacyTsc: tsc
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
exports.build = build;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.dev = 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 devFeature = _utils.Import.lazy('../features/dev', require);
|
|
12
|
-
const tsConfigutils = _utils.Import.lazy('../utils/tsconfig', require);
|
|
13
|
-
const valid = _utils.Import.lazy('../utils/valide', require);
|
|
14
|
-
const existSubCmd = subCmd => subCmd.length > 0;
|
|
15
|
-
const dev = async (api, option, subCmd = '') => {
|
|
16
|
-
const {
|
|
17
|
-
tsconfig: tsconfigName
|
|
18
|
-
} = option;
|
|
19
|
-
const appContext = api.useAppContext();
|
|
20
|
-
const modernConfig = api.useResolvedConfigContext();
|
|
21
|
-
const {
|
|
22
|
-
appDirectory
|
|
23
|
-
} = appContext;
|
|
24
|
-
const tsconfigPath = path.join(appDirectory, tsconfigName);
|
|
25
|
-
_utils.dotenv.config();
|
|
26
|
-
valid.valideBeforeTask({
|
|
27
|
-
modernConfig,
|
|
28
|
-
tsconfigPath
|
|
29
|
-
});
|
|
30
|
-
const isTsProject = tsConfigutils.existTsConfigFile(tsconfigPath);
|
|
31
|
-
if (existSubCmd(subCmd)) {
|
|
32
|
-
await devFeature.runSubCmd(api, subCmd, {
|
|
33
|
-
isTsProject,
|
|
34
|
-
appDirectory
|
|
35
|
-
});
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Compatible with the use of jupiter, RUN_PLATFORM is used in jupiter
|
|
40
|
-
if (process.env.RUN_PLATFORM) {
|
|
41
|
-
await devFeature.showMenu(api, {
|
|
42
|
-
isTsProject,
|
|
43
|
-
appDirectory
|
|
44
|
-
});
|
|
45
|
-
} else {
|
|
46
|
-
await devFeature.devStorybook(api, {
|
|
47
|
-
isTsProject,
|
|
48
|
-
appDirectory
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
exports.dev = dev;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "build", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _build.build;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "dev", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _dev.dev;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
var _dev = require("./dev");
|
|
19
|
-
var _build = require("./build");
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.buildPlatform = void 0;
|
|
7
|
-
var _utils = require("@modern-js/utils");
|
|
8
|
-
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; }
|
|
9
|
-
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; }
|
|
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 lg = _utils.Import.lazy('./logger', require);
|
|
12
|
-
const pMap = _utils.Import.lazy('p-map', require);
|
|
13
|
-
const buildPlatform = async (api, option) => {
|
|
14
|
-
const {
|
|
15
|
-
isTsProject = false,
|
|
16
|
-
platform
|
|
17
|
-
} = option;
|
|
18
|
-
const lm = new lg.LoggerManager();
|
|
19
|
-
// 获取platforms的参数
|
|
20
|
-
const runners = api.useHookRunners();
|
|
21
|
-
const buildTasks = await runners.platformBuild({
|
|
22
|
-
isTsProject
|
|
23
|
-
});
|
|
24
|
-
if (buildTasks.length <= 0) {
|
|
25
|
-
console.info(_utils.chalk.yellow('No build tasks detected.\nYou can use the `new` command to enable the more features'));
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const loggerMap = {};
|
|
29
|
-
const taskMapper = buildTasks.filter(task => platform === 'all' || task.name === platform).map(params => {
|
|
30
|
-
const logger = lm.createLoggerText({
|
|
31
|
-
title: params.title
|
|
32
|
-
});
|
|
33
|
-
loggerMap[params.name] = logger;
|
|
34
|
-
return _objectSpread({
|
|
35
|
-
logger
|
|
36
|
-
}, params);
|
|
37
|
-
});
|
|
38
|
-
if (taskMapper.length <= 0) {
|
|
39
|
-
console.info(_utils.chalk.yellow(`'${platform}' is undefined task`));
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
lm.showCompiling();
|
|
43
|
-
await pMap(taskMapper, async ({
|
|
44
|
-
taskPath,
|
|
45
|
-
params,
|
|
46
|
-
logger: _
|
|
47
|
-
}) => {
|
|
48
|
-
const childProcess = _utils.execa.node(taskPath, params, {
|
|
49
|
-
stdio: 'inherit',
|
|
50
|
-
all: true
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
// lm.addStdout(logger, childProcess.stdout, {
|
|
54
|
-
// event: { data: true, error: true },
|
|
55
|
-
// });
|
|
56
|
-
|
|
57
|
-
// lm.addStderr(logger, childProcess.stderr);
|
|
58
|
-
try {
|
|
59
|
-
await childProcess;
|
|
60
|
-
} catch (_unused) {
|
|
61
|
-
// eslint-disable-next-line no-process-exit
|
|
62
|
-
process.exit(1);
|
|
63
|
-
}
|
|
64
|
-
// lm.disappearCompiling();
|
|
65
|
-
// console.info(lg.colors.title(title));
|
|
66
|
-
// console.info(a.all);
|
|
67
|
-
}, {
|
|
68
|
-
concurrency: 1
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
// lm.disappearCompiling();
|
|
72
|
-
// for (const key of Object.keys(loggerMap)) {
|
|
73
|
-
// console.info(loggerMap[key].value);
|
|
74
|
-
// }
|
|
75
|
-
};
|
|
76
|
-
exports.buildPlatform = buildPlatform;
|