@modern-js/module-tools 2.0.0-beta.2 → 2.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +276 -205
- package/bin/modern.js +7 -1
- package/compiled/@babel/code-frame/index.d.ts +1 -0
- package/compiled/@babel/code-frame/index.js +1 -0
- package/compiled/@babel/code-frame/license +22 -0
- package/compiled/@babel/code-frame/package.json +1 -0
- package/compiled/@babel/generator/index.d.ts +1 -0
- package/compiled/@babel/generator/index.js +1 -0
- package/compiled/@babel/generator/license +22 -0
- package/compiled/@babel/generator/package.json +1 -0
- package/compiled/@babel/helper-validator-identifier/index.d.ts +1 -0
- package/compiled/@babel/helper-validator-identifier/index.js +1 -0
- package/compiled/@babel/helper-validator-identifier/license +22 -0
- package/compiled/@babel/helper-validator-identifier/package.json +1 -0
- package/compiled/@babel/highlight/index.d.ts +1 -0
- package/compiled/@babel/highlight/index.js +1 -0
- package/compiled/@babel/highlight/license +22 -0
- package/compiled/@babel/highlight/package.json +1 -0
- package/compiled/@babel/parser/@babel/types/lib/index-legacy.d.ts +2742 -0
- package/compiled/@babel/parser/index.js +1 -0
- package/compiled/@babel/parser/license +19 -0
- package/compiled/@babel/parser/package.json +1 -0
- package/compiled/@babel/parser/typings/babel-parser.d.ts +214 -0
- package/compiled/@babel/template/index.d.ts +1 -0
- package/compiled/@babel/template/index.js +1 -0
- package/compiled/@babel/template/license +22 -0
- package/compiled/@babel/template/package.json +1 -0
- package/compiled/@babel/traverse/index.d.ts +1199 -0
- package/compiled/@babel/traverse/index.js +1 -0
- package/compiled/@babel/traverse/license +22 -0
- package/compiled/@babel/traverse/package.json +1 -0
- package/compiled/@babel/types/index.js +1 -0
- package/compiled/@babel/types/lib/index-legacy.d.ts +2732 -0
- package/compiled/@babel/types/license +22 -0
- package/compiled/@babel/types/package.json +1 -0
- package/compiled/@rollup/plugin-json/@rollup/pluginutils/types/index.d.ts +86 -0
- package/compiled/@rollup/plugin-json/estree/index.d.ts +548 -0
- package/compiled/@rollup/plugin-json/index.js +1 -0
- package/compiled/@rollup/plugin-json/license +21 -0
- package/compiled/@rollup/plugin-json/package.json +1 -0
- package/compiled/@rollup/plugin-json/rollup/dist/rollup.d.ts +948 -0
- package/compiled/@rollup/plugin-json/types/index.d.ts +41 -0
- package/compiled/find-up/index.d.ts +138 -0
- package/compiled/find-up/index.js +1 -0
- package/compiled/find-up/license +9 -0
- package/compiled/find-up/locate-path/index.d.ts +83 -0
- package/compiled/find-up/package.json +1 -0
- package/compiled/less/index.d.ts +282 -0
- package/compiled/less/index.js +1 -0
- package/compiled/less/package.json +1 -0
- package/compiled/normalize-path/index.d.ts +8 -0
- package/compiled/normalize-path/index.js +8 -0
- package/compiled/normalize-path/license +21 -0
- package/compiled/normalize-path/package.json +1 -0
- package/compiled/p-map/@szmarczak/http-timer/dist/source/index.d.ts +32 -0
- package/compiled/p-map/cacheable-lookup/index.d.ts +139 -0
- package/compiled/p-map/cacheable-request/index.d.ts +137 -0
- package/compiled/p-map/got/dist/source/as-promise/index.d.ts +3 -0
- package/compiled/p-map/got/dist/source/as-promise/types.d.ts +256 -0
- package/compiled/p-map/got/dist/source/core/index.d.ts +1124 -0
- package/compiled/p-map/got/dist/source/core/utils/dns-ip-version.d.ts +5 -0
- package/compiled/p-map/got/dist/source/core/utils/options-to-url.d.ts +14 -0
- package/compiled/p-map/got/dist/source/core/utils/timed-out.d.ts +29 -0
- package/compiled/p-map/got/dist/source/index.d.ts +4 -0
- package/compiled/p-map/got/dist/source/types.d.ts +344 -0
- package/compiled/p-map/http-cache-semantics/index.d.ts +170 -0
- package/compiled/p-map/index.d.ts +67 -0
- package/compiled/p-map/index.js +1 -0
- package/compiled/p-map/keyv/src/index.d.ts +104 -0
- package/compiled/p-map/license +9 -0
- package/compiled/p-map/p-cancelable/index.d.ts +176 -0
- package/compiled/p-map/package.json +1 -0
- package/compiled/p-map/responselike/index.d.ts +34 -0
- package/compiled/postcss-custom-properties/index.d.ts +1 -0
- package/compiled/postcss-custom-properties/index.js +1 -0
- package/compiled/postcss-custom-properties/package.json +1 -0
- package/compiled/postcss-flexbugs-fixes/index.d.ts +1 -0
- package/compiled/postcss-flexbugs-fixes/index.js +1 -0
- package/compiled/postcss-flexbugs-fixes/license +20 -0
- package/compiled/postcss-flexbugs-fixes/package.json +1 -0
- package/compiled/postcss-font-variant/index.d.ts +1 -0
- package/compiled/postcss-font-variant/index.js +1 -0
- package/compiled/postcss-font-variant/license +20 -0
- package/compiled/postcss-font-variant/package.json +1 -0
- package/compiled/postcss-initial/index.d.ts +1 -0
- package/compiled/postcss-initial/index.js +1 -0
- package/compiled/postcss-initial/license +20 -0
- package/compiled/postcss-initial/package.json +1 -0
- package/compiled/postcss-media-minmax/index.d.ts +1 -0
- package/compiled/postcss-media-minmax/index.js +1 -0
- package/compiled/postcss-media-minmax/license +22 -0
- package/compiled/postcss-media-minmax/package.json +1 -0
- package/compiled/postcss-nesting/index.d.ts +1 -0
- package/compiled/postcss-nesting/index.js +2 -0
- package/compiled/postcss-nesting/package.json +1 -0
- package/compiled/postcss-page-break/index.d.ts +1 -0
- package/compiled/postcss-page-break/index.js +1 -0
- package/compiled/postcss-page-break/license +20 -0
- package/compiled/postcss-page-break/package.json +1 -0
- package/compiled/postcss-value-parser/index.d.ts +1 -0
- package/compiled/postcss-value-parser/index.js +1 -0
- package/compiled/postcss-value-parser/license +22 -0
- package/compiled/postcss-value-parser/package.json +1 -0
- package/compiled/rollup/fsevents.node +0 -0
- package/compiled/rollup/index.js +82 -0
- package/compiled/rollup/package.json +1 -0
- package/compiled/rollup/types/rollup.d.ts +948 -0
- package/compiled/rollup-plugin-dts/dist/rollup-plugin-dts.d.ts +21 -0
- package/compiled/rollup-plugin-dts/index.js +1 -0
- package/compiled/rollup-plugin-dts/package.json +1 -0
- package/compiled/rollup-plugin-dts/rollup/dist/rollup.d.ts +948 -0
- package/compiled/sass/index.js +1 -0
- package/compiled/sass/license +1619 -0
- package/compiled/sass/package.json +1 -0
- package/compiled/sass/types/compile.d.ts +152 -0
- package/compiled/sass/types/exception.d.ts +41 -0
- package/compiled/sass/types/importer.d.ts +294 -0
- package/compiled/sass/types/index.d.ts +80 -0
- package/compiled/sass/types/legacy/exception.d.ts +54 -0
- package/compiled/sass/types/legacy/function.d.ts +756 -0
- package/compiled/sass/types/legacy/importer.d.ts +168 -0
- package/compiled/sass/types/legacy/options.d.ts +642 -0
- package/compiled/sass/types/legacy/plugin_this.d.ts +73 -0
- package/compiled/sass/types/legacy/render.d.ts +139 -0
- package/compiled/sass/types/logger/index.d.ts +94 -0
- package/compiled/sass/types/logger/source_location.d.ts +21 -0
- package/compiled/sass/types/logger/source_span.d.ts +34 -0
- package/compiled/sass/types/options.d.ts +435 -0
- package/compiled/sass/types/util/promise_or.d.ts +17 -0
- package/compiled/sass/types/value/argument_list.d.ts +47 -0
- package/compiled/sass/types/value/boolean.d.ts +29 -0
- package/compiled/sass/types/value/color.d.ts +107 -0
- package/compiled/sass/types/value/function.d.ts +22 -0
- package/compiled/sass/types/value/index.d.ts +173 -0
- package/compiled/sass/types/value/list.d.ts +54 -0
- package/compiled/sass/types/value/map.d.ts +41 -0
- package/compiled/sass/types/value/number.d.ts +305 -0
- package/compiled/sass/types/value/string.d.ts +84 -0
- package/compiled/signal-exit/index.d.ts +24 -0
- package/compiled/signal-exit/index.js +1 -0
- package/compiled/signal-exit/package.json +1 -0
- package/dist/builder/build.d.ts +23 -0
- package/dist/builder/build.js +265 -0
- package/dist/builder/build.js.map +1 -0
- package/dist/builder/clear.d.ts +3 -0
- package/dist/builder/clear.js +74 -0
- package/dist/builder/clear.js.map +1 -0
- package/dist/builder/copy.d.ts +9 -0
- package/dist/builder/copy.js +207 -0
- package/dist/builder/copy.js.map +1 -0
- package/dist/builder/dts/index.d.ts +2 -0
- package/dist/builder/dts/index.js +27 -0
- package/dist/builder/dts/index.js.map +1 -0
- package/dist/builder/dts/rollup.d.ts +17 -0
- package/dist/builder/dts/rollup.js +180 -0
- package/dist/builder/dts/rollup.js.map +1 -0
- package/dist/builder/dts/tsc.d.ts +3 -0
- package/dist/builder/dts/tsc.js +160 -0
- package/dist/builder/dts/tsc.js.map +1 -0
- package/dist/builder/index.d.ts +8 -0
- package/dist/builder/index.js +124 -0
- package/dist/builder/index.js.map +1 -0
- package/dist/builder/platform.d.ts +4 -0
- package/dist/builder/platform.js +140 -0
- package/dist/builder/platform.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +103 -0
- package/dist/cli.js.map +1 -0
- package/dist/command.d.ts +7 -0
- package/dist/command.js +169 -0
- package/dist/command.js.map +1 -0
- package/dist/config/defineConfig.d.ts +2 -0
- package/dist/config/defineConfig.js +25 -0
- package/dist/config/defineConfig.js.map +1 -0
- package/dist/config/normalize.d.ts +17 -0
- package/dist/config/normalize.js +177 -0
- package/dist/config/normalize.js.map +1 -0
- package/dist/config/schema.d.ts +641 -0
- package/dist/config/schema.js +207 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/constants/build-presets.d.ts +81 -0
- package/dist/constants/build-presets.js +219 -0
- package/dist/constants/build-presets.js.map +1 -0
- package/dist/constants/build.d.ts +5 -0
- package/dist/constants/build.js +71 -0
- package/dist/constants/build.js.map +1 -0
- package/dist/constants/colors.d.ts +4 -0
- package/dist/constants/colors.js +29 -0
- package/dist/constants/colors.js.map +1 -0
- package/dist/constants/dts.d.ts +4 -0
- package/dist/constants/dts.js +45 -0
- package/dist/constants/dts.js.map +1 -0
- package/dist/constants/file.d.ts +3 -0
- package/dist/constants/file.js +29 -0
- package/dist/constants/file.js.map +1 -0
- package/dist/constants/legacy-build-presets.d.ts +13 -0
- package/dist/constants/legacy-build-presets.js +189 -0
- package/dist/constants/legacy-build-presets.js.map +1 -0
- package/dist/constants/log.d.ts +8 -0
- package/dist/constants/log.js +36 -0
- package/dist/constants/log.js.map +1 -0
- package/dist/dev.d.ts +10 -0
- package/dist/dev.js +135 -0
- package/dist/dev.js.map +1 -0
- package/dist/{types/features/build/error.d.ts → error.d.ts} +1 -1
- package/dist/error.js +139 -0
- package/dist/error.js.map +1 -0
- package/dist/hooks/build.d.ts +22 -0
- package/dist/hooks/build.js +35 -0
- package/dist/hooks/build.js.map +1 -0
- package/dist/hooks/dev.d.ts +12 -0
- package/dist/hooks/dev.js +33 -0
- package/dist/hooks/dev.js.map +1 -0
- package/dist/hooks/index.d.ts +29 -0
- package/dist/hooks/index.js +44 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/misc.d.ts +5 -0
- package/dist/hooks/misc.js +29 -0
- package/dist/hooks/misc.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/{types/locale → locale}/en.d.ts +0 -0
- package/dist/locale/en.js +47 -0
- package/dist/locale/en.js.map +1 -0
- package/dist/{types/locale → locale}/index.d.ts +0 -0
- package/dist/locale/index.js +34 -0
- package/dist/locale/index.js.map +1 -0
- package/dist/{types/locale → locale}/zh.d.ts +0 -0
- package/dist/locale/zh.js +47 -0
- package/dist/locale/zh.js.map +1 -0
- package/dist/plugins.d.ts +2 -0
- package/dist/plugins.js +51 -0
- package/dist/plugins.js.map +1 -0
- package/dist/types/color.d.ts +1 -0
- package/dist/{js/modern/features/build/types.js → types/color.js} +0 -0
- package/dist/types/command.d.ts +11 -0
- package/dist/{js/modern/schema/types.js → types/command.js} +0 -0
- package/dist/types/config/index.d.ts +95 -0
- package/dist/types/config/index.js +19 -0
- package/dist/types/config/index.js.map +1 -0
- package/dist/types/config/style.d.ts +12 -0
- package/dist/{js/modern/types.js → types/config/style.js} +0 -0
- package/dist/types/context.d.ts +5 -0
- package/dist/{js/node/features/build/types.js → types/context.js} +0 -0
- package/dist/types/copy.d.ts +15 -0
- package/dist/{js/node/schema/types.js → types/copy.js} +0 -0
- package/dist/types/{utils/tsconfig.d.ts → dts.d.ts} +11 -3
- package/dist/{js/node/types.js → types/dts.js} +0 -0
- package/dist/types/hooks.d.ts +25 -0
- package/dist/types/hooks.js +0 -0
- package/dist/types/index.d.ts +17 -6
- package/dist/types/index.js +23 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/utils.d.ts +7 -0
- package/dist/types/utils.js +0 -0
- package/dist/utils/builder.d.ts +8 -0
- package/dist/utils/builder.js +117 -0
- package/dist/utils/builder.js.map +1 -0
- package/dist/utils/config.d.ts +6 -0
- package/dist/utils/config.js +172 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/context.d.ts +7 -0
- package/dist/utils/context.js +68 -0
- package/dist/utils/context.js.map +1 -0
- package/dist/utils/dts.d.ts +14 -0
- package/dist/utils/dts.js +197 -0
- package/dist/utils/dts.js.map +1 -0
- package/dist/utils/input.d.ts +16 -0
- package/dist/utils/input.js +124 -0
- package/dist/utils/input.js.map +1 -0
- package/dist/utils/language.d.ts +2 -0
- package/dist/utils/language.js +75 -0
- package/dist/utils/language.js.map +1 -0
- package/dist/utils/libuild-plugins.d.ts +6 -0
- package/dist/utils/libuild-plugins.js +90 -0
- package/dist/utils/libuild-plugins.js.map +1 -0
- package/dist/utils/log.d.ts +2 -0
- package/dist/utils/log.js +76 -0
- package/dist/utils/log.js.map +1 -0
- package/dist/utils/onExit.d.ts +1 -0
- package/dist/utils/onExit.js +71 -0
- package/dist/utils/onExit.js.map +1 -0
- package/dist/utils/path.d.ts +1 -0
- package/dist/utils/path.js +73 -0
- package/dist/utils/path.js.map +1 -0
- package/dist/utils/style.d.ts +31 -0
- package/dist/utils/style.js +134 -0
- package/dist/utils/style.js.map +1 -0
- package/dist/{types/utils/tspaths-transform/index.d.ts → utils/tspaths-transform.d.ts} +0 -0
- package/dist/utils/tspaths-transform.js +115 -0
- package/dist/utils/tspaths-transform.js.map +1 -0
- package/package.json +47 -73
- package/dist/js/modern/cli/build.js +0 -11
- package/dist/js/modern/cli/dev.js +0 -11
- package/dist/js/modern/cli/index.js +0 -3
- package/dist/js/modern/cli/new.js +0 -13
- package/dist/js/modern/commands/build.js +0 -69
- package/dist/js/modern/commands/dev.js +0 -43
- package/dist/js/modern/commands/index.js +0 -2
- package/dist/js/modern/features/build/build-platform.js +0 -69
- package/dist/js/modern/features/build/bundle/index.js +0 -9
- package/dist/js/modern/features/build/bundle/runRollup.js +0 -136
- package/dist/js/modern/features/build/bundle/runSpeedy.js +0 -176
- package/dist/js/modern/features/build/bundleless/copy-assets.js +0 -75
- package/dist/js/modern/features/build/bundleless/generator-dts/index.js +0 -106
- package/dist/js/modern/features/build/bundleless/generator-dts/utils.js +0 -94
- package/dist/js/modern/features/build/bundleless/index.js +0 -21
- package/dist/js/modern/features/build/bundleless/runBabel.js +0 -242
- package/dist/js/modern/features/build/bundleless/style.js +0 -241
- package/dist/js/modern/features/build/constants.js +0 -98
- package/dist/js/modern/features/build/error.js +0 -127
- package/dist/js/modern/features/build/index.js +0 -117
- package/dist/js/modern/features/build/legacy-constants.js +0 -103
- package/dist/js/modern/features/build/logger/index.js +0 -2
- package/dist/js/modern/features/build/logger/logText.js +0 -56
- package/dist/js/modern/features/build/logger/loggerManager.js +0 -93
- package/dist/js/modern/features/build/normalize.js +0 -277
- package/dist/js/modern/features/build/utils.js +0 -92
- package/dist/js/modern/features/dev/index.js +0 -47
- package/dist/js/modern/hooks/build.js +0 -20
- package/dist/js/modern/hooks/dev.js +0 -14
- package/dist/js/modern/hooks/index.js +0 -15
- package/dist/js/modern/index.js +0 -63
- package/dist/js/modern/locale/en.js +0 -25
- package/dist/js/modern/locale/index.js +0 -10
- package/dist/js/modern/locale/zh.js +0 -25
- package/dist/js/modern/schema/build-config.js +0 -117
- package/dist/js/modern/schema/index.js +0 -4
- package/dist/js/modern/schema/output.js +0 -45
- package/dist/js/modern/schema/source.js +0 -7
- package/dist/js/modern/schema/tools.js +0 -6
- package/dist/js/modern/utils/babel.js +0 -84
- package/dist/js/modern/utils/color.js +0 -2
- package/dist/js/modern/utils/constants.js +0 -3
- package/dist/js/modern/utils/copy.js +0 -70
- package/dist/js/modern/utils/init-env.js +0 -13
- package/dist/js/modern/utils/json.js +0 -13
- package/dist/js/modern/utils/language.js +0 -6
- package/dist/js/modern/utils/logger.js +0 -96
- package/dist/js/modern/utils/readline.js +0 -17
- package/dist/js/modern/utils/tsconfig.js +0 -13
- package/dist/js/modern/utils/tspaths-transform/constants.js +0 -5
- package/dist/js/modern/utils/tspaths-transform/index.js +0 -113
- package/dist/js/modern/utils/tspaths-transform/utils.js +0 -18
- package/dist/js/modern/utils/valide.js +0 -26
- package/dist/js/node/cli/build.js +0 -18
- package/dist/js/node/cli/dev.js +0 -18
- package/dist/js/node/cli/index.js +0 -38
- package/dist/js/node/cli/new.js +0 -20
- package/dist/js/node/commands/build.js +0 -80
- package/dist/js/node/commands/dev.js +0 -52
- package/dist/js/node/commands/index.js +0 -19
- package/dist/js/node/features/build/build-platform.js +0 -76
- package/dist/js/node/features/build/bundle/index.js +0 -17
- package/dist/js/node/features/build/bundle/runRollup.js +0 -145
- package/dist/js/node/features/build/bundle/runSpeedy.js +0 -186
- package/dist/js/node/features/build/bundleless/copy-assets.js +0 -84
- package/dist/js/node/features/build/bundleless/generator-dts/index.js +0 -114
- package/dist/js/node/features/build/bundleless/generator-dts/utils.js +0 -105
- package/dist/js/node/features/build/bundleless/index.js +0 -29
- package/dist/js/node/features/build/bundleless/runBabel.js +0 -255
- package/dist/js/node/features/build/bundleless/style.js +0 -254
- package/dist/js/node/features/build/constants.js +0 -116
- package/dist/js/node/features/build/error.js +0 -139
- package/dist/js/node/features/build/index.js +0 -128
- package/dist/js/node/features/build/legacy-constants.js +0 -111
- package/dist/js/node/features/build/logger/index.js +0 -27
- package/dist/js/node/features/build/logger/logText.js +0 -66
- package/dist/js/node/features/build/logger/loggerManager.js +0 -95
- package/dist/js/node/features/build/normalize.js +0 -288
- package/dist/js/node/features/build/utils.js +0 -107
- package/dist/js/node/features/dev/index.js +0 -56
- package/dist/js/node/hooks/build.js +0 -32
- package/dist/js/node/hooks/dev.js +0 -24
- package/dist/js/node/hooks/index.js +0 -36
- package/dist/js/node/index.js +0 -83
- package/dist/js/node/locale/en.js +0 -32
- package/dist/js/node/locale/index.js +0 -17
- package/dist/js/node/locale/zh.js +0 -32
- package/dist/js/node/schema/build-config.js +0 -126
- package/dist/js/node/schema/index.js +0 -11
- package/dist/js/node/schema/output.js +0 -52
- package/dist/js/node/schema/source.js +0 -14
- package/dist/js/node/schema/tools.js +0 -13
- package/dist/js/node/utils/babel.js +0 -93
- package/dist/js/node/utils/color.js +0 -9
- package/dist/js/node/utils/constants.js +0 -11
- package/dist/js/node/utils/copy.js +0 -79
- package/dist/js/node/utils/init-env.js +0 -20
- package/dist/js/node/utils/json.js +0 -20
- package/dist/js/node/utils/language.js +0 -12
- package/dist/js/node/utils/logger.js +0 -107
- package/dist/js/node/utils/readline.js +0 -25
- package/dist/js/node/utils/tsconfig.js +0 -21
- package/dist/js/node/utils/tspaths-transform/constants.js +0 -12
- package/dist/js/node/utils/tspaths-transform/index.js +0 -123
- package/dist/js/node/utils/tspaths-transform/utils.js +0 -25
- package/dist/js/node/utils/valide.js +0 -34
- package/dist/types/cli/build.d.ts +0 -3
- package/dist/types/cli/dev.d.ts +0 -3
- package/dist/types/cli/index.d.ts +0 -3
- package/dist/types/cli/new.d.ts +0 -2
- package/dist/types/commands/build.d.ts +0 -17
- package/dist/types/commands/dev.d.ts +0 -5
- package/dist/types/commands/index.d.ts +0 -2
- package/dist/types/features/build/build-platform.d.ts +0 -7
- package/dist/types/features/build/bundle/index.d.ts +0 -3
- package/dist/types/features/build/bundle/runRollup.d.ts +0 -3
- package/dist/types/features/build/bundle/runSpeedy.d.ts +0 -10
- package/dist/types/features/build/bundleless/copy-assets.d.ts +0 -3
- package/dist/types/features/build/bundleless/generator-dts/index.d.ts +0 -3
- package/dist/types/features/build/bundleless/generator-dts/utils.d.ts +0 -21
- package/dist/types/features/build/bundleless/index.d.ts +0 -4
- package/dist/types/features/build/bundleless/runBabel.d.ts +0 -32
- package/dist/types/features/build/bundleless/style.d.ts +0 -25
- package/dist/types/features/build/constants.d.ts +0 -18
- package/dist/types/features/build/index.d.ts +0 -12
- package/dist/types/features/build/legacy-constants.d.ts +0 -8
- package/dist/types/features/build/logger/index.d.ts +0 -2
- package/dist/types/features/build/logger/logText.d.ts +0 -39
- package/dist/types/features/build/logger/loggerManager.d.ts +0 -40
- package/dist/types/features/build/normalize.d.ts +0 -19
- package/dist/types/features/build/types.d.ts +0 -15
- package/dist/types/features/build/utils.d.ts +0 -36
- package/dist/types/features/dev/index.d.ts +0 -9
- package/dist/types/hooks/build.d.ts +0 -46
- package/dist/types/hooks/dev.d.ts +0 -20
- package/dist/types/hooks/index.d.ts +0 -30
- package/dist/types/schema/build-config.d.ts +0 -205
- package/dist/types/schema/index.d.ts +0 -217
- package/dist/types/schema/output.d.ts +0 -215
- package/dist/types/schema/source.d.ts +0 -6
- package/dist/types/schema/tools.d.ts +0 -6
- package/dist/types/schema/types.d.ts +0 -45
- package/dist/types/types.d.ts +0 -51
- package/dist/types/utils/babel.d.ts +0 -8
- package/dist/types/utils/color.d.ts +0 -2
- package/dist/types/utils/constants.d.ts +0 -2
- package/dist/types/utils/copy.d.ts +0 -5
- package/dist/types/utils/init-env.d.ts +0 -21
- package/dist/types/utils/json.d.ts +0 -4
- package/dist/types/utils/language.d.ts +0 -1
- package/dist/types/utils/logger.d.ts +0 -58
- package/dist/types/utils/readline.d.ts +0 -9
- package/dist/types/utils/tspaths-transform/constants.d.ts +0 -1
- package/dist/types/utils/tspaths-transform/utils.d.ts +0 -4
- package/dist/types/utils/valide.d.ts +0 -12
- package/types.d.ts +0 -1
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var stdin_exports = {};
|
|
19
|
+
__export(stdin_exports, {
|
|
20
|
+
buildPlatform: () => buildPlatform
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
23
|
+
var __create = Object.create;
|
|
24
|
+
var __defProp2 = Object.defineProperty;
|
|
25
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
26
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
27
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
28
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
29
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
30
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
31
|
+
for (let key of __getOwnPropNames2(from))
|
|
32
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
33
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
34
|
+
}
|
|
35
|
+
return to;
|
|
36
|
+
};
|
|
37
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps2(
|
|
38
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
39
|
+
mod
|
|
40
|
+
));
|
|
41
|
+
var __async = (__this, __arguments, generator) => {
|
|
42
|
+
return new Promise((resolve, reject) => {
|
|
43
|
+
var fulfilled = (value) => {
|
|
44
|
+
try {
|
|
45
|
+
step(generator.next(value));
|
|
46
|
+
} catch (e) {
|
|
47
|
+
reject(e);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var rejected = (value) => {
|
|
51
|
+
try {
|
|
52
|
+
step(generator.throw(value));
|
|
53
|
+
} catch (e) {
|
|
54
|
+
reject(e);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
58
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
const buildPlatform = (options, api, context) => __async(void 0, null, function* () {
|
|
62
|
+
const { chalk } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
63
|
+
const { blue, gray } = yield Promise.resolve().then(() => __toESM(require("../constants/colors")));
|
|
64
|
+
const runner = api.useHookRunners();
|
|
65
|
+
const platformBuilders = yield runner.registerBuildPlatform();
|
|
66
|
+
if (platformBuilders.length === 0) {
|
|
67
|
+
if (options.platform === true) {
|
|
68
|
+
console.info("No executable platform build tasks");
|
|
69
|
+
} else if (Array.isArray(options.platform) && options.platform.length === 1) {
|
|
70
|
+
console.info(
|
|
71
|
+
`No build tasks with platform "${options.platform[0]}" found`
|
|
72
|
+
);
|
|
73
|
+
} else if (Array.isArray(options.platform) && options.platform.length > 1) {
|
|
74
|
+
console.info(
|
|
75
|
+
`No build tasks with platform ${options.platform.join(",")} found`
|
|
76
|
+
);
|
|
77
|
+
} else {
|
|
78
|
+
console.info("Unknown platform", JSON.stringify(options.platform));
|
|
79
|
+
}
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
yield runner.beforeBuildPlatform(platformBuilders);
|
|
83
|
+
if (options.platform === true) {
|
|
84
|
+
for (const platformBuilder of platformBuilders) {
|
|
85
|
+
const currentPlatform = Array.isArray(platformBuilder.platform) ? platformBuilder.platform[0] : platformBuilder.platform;
|
|
86
|
+
console.info(
|
|
87
|
+
chalk.underline.rgb(...blue)(
|
|
88
|
+
`Running [${currentPlatform}] build task:`
|
|
89
|
+
)
|
|
90
|
+
);
|
|
91
|
+
yield runner.buildPlatform({ platform: currentPlatform });
|
|
92
|
+
yield platformBuilder.build(currentPlatform, {
|
|
93
|
+
isTsProject: context.isTsProject
|
|
94
|
+
});
|
|
95
|
+
console.info(chalk.rgb(...gray)(`Done for [${currentPlatform}] task`));
|
|
96
|
+
}
|
|
97
|
+
} else if (Array.isArray(options.platform) && options.platform.length === 1) {
|
|
98
|
+
const targetPlatform = options.platform[0];
|
|
99
|
+
const selectPlatformBuilder = platformBuilders.find((builder) => {
|
|
100
|
+
if (Array.isArray(builder.platform)) {
|
|
101
|
+
return builder.platform.includes(targetPlatform);
|
|
102
|
+
}
|
|
103
|
+
return builder.platform === targetPlatform;
|
|
104
|
+
});
|
|
105
|
+
if (!selectPlatformBuilder) {
|
|
106
|
+
console.info(`The specified "${targetPlatform}" build does not exist`);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
console.info(
|
|
110
|
+
chalk.underline.rgb(...blue)(`Running [${targetPlatform}] build task:`)
|
|
111
|
+
);
|
|
112
|
+
yield runner.buildPlatform({ platform: targetPlatform });
|
|
113
|
+
yield selectPlatformBuilder.build(targetPlatform, {
|
|
114
|
+
isTsProject: context.isTsProject
|
|
115
|
+
});
|
|
116
|
+
console.info(chalk.rgb(...gray)(`Done for [${targetPlatform}] task`));
|
|
117
|
+
} else if (Array.isArray(options.platform) && options.platform.length > 1) {
|
|
118
|
+
for (const platform of options.platform) {
|
|
119
|
+
const foundBuilder = platformBuilders.find((builder) => {
|
|
120
|
+
if (Array.isArray(builder.platform)) {
|
|
121
|
+
return builder.platform.includes(platform);
|
|
122
|
+
}
|
|
123
|
+
return builder.platform === platform;
|
|
124
|
+
});
|
|
125
|
+
if (!foundBuilder) {
|
|
126
|
+
console.info(`skip ${platform} build, because it does not exist`);
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
console.info(
|
|
130
|
+
chalk.underline.rgb(...blue)(`Running [${platform}] build task:`)
|
|
131
|
+
);
|
|
132
|
+
yield runner.buildPlatform({ platform });
|
|
133
|
+
yield foundBuilder.build(platform, { isTsProject: context.isTsProject });
|
|
134
|
+
console.info(chalk.rgb(...gray)(`Done for [${platform}] task`));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
yield runner.afterBuildPlatform();
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
//# sourceMappingURL=platform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":"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","names":[],"sources":["../../src/builder/platform.ts"],"sourcesContent":["import { PluginAPI } from '@modern-js/core';\nimport { ModuleContext } from '../types/context';\nimport { BuildCommandOptions, ModuleTools } from '../types';\n\nexport const buildPlatform = async (\n options: BuildCommandOptions,\n api: PluginAPI<ModuleTools>,\n context: ModuleContext,\n) => {\n const { chalk } = await import('@modern-js/utils');\n const { blue, gray } = await import('../constants/colors');\n const runner = api.useHookRunners();\n const platformBuilders = await runner.registerBuildPlatform();\n if (platformBuilders.length === 0) {\n if (options.platform === true) {\n console.info('No executable platform build tasks');\n } else if (\n Array.isArray(options.platform) &&\n options.platform.length === 1\n ) {\n console.info(\n `No build tasks with platform \"${options.platform[0]}\" found`,\n );\n } else if (Array.isArray(options.platform) && options.platform.length > 1) {\n console.info(\n `No build tasks with platform ${options.platform.join(',')} found`,\n );\n } else {\n console.info('Unknown platform', JSON.stringify(options.platform));\n }\n\n return;\n }\n\n await runner.beforeBuildPlatform(platformBuilders);\n if (options.platform === true) {\n for (const platformBuilder of platformBuilders) {\n const currentPlatform = Array.isArray(platformBuilder.platform)\n ? platformBuilder.platform[0]\n : platformBuilder.platform;\n\n console.info(\n chalk.underline.rgb(...blue)(\n `Running [${currentPlatform}] build task:`,\n ),\n );\n\n await runner.buildPlatform({ platform: currentPlatform });\n await platformBuilder.build(currentPlatform, {\n isTsProject: context.isTsProject,\n });\n\n console.info(chalk.rgb(...gray)(`Done for [${currentPlatform}] task`));\n }\n } else if (Array.isArray(options.platform) && options.platform.length === 1) {\n const targetPlatform = options.platform[0];\n const selectPlatformBuilder = platformBuilders.find(builder => {\n if (Array.isArray(builder.platform)) {\n return builder.platform.includes(targetPlatform);\n }\n\n return builder.platform === targetPlatform;\n });\n\n if (!selectPlatformBuilder) {\n console.info(`The specified \"${targetPlatform}\" build does not exist`);\n return;\n }\n\n console.info(\n chalk.underline.rgb(...blue)(`Running [${targetPlatform}] build task:`),\n );\n\n await runner.buildPlatform({ platform: targetPlatform });\n await selectPlatformBuilder.build(targetPlatform, {\n isTsProject: context.isTsProject,\n });\n\n console.info(chalk.rgb(...gray)(`Done for [${targetPlatform}] task`));\n } else if (Array.isArray(options.platform) && options.platform.length > 1) {\n for (const platform of options.platform) {\n const foundBuilder = platformBuilders.find(builder => {\n if (Array.isArray(builder.platform)) {\n return builder.platform.includes(platform);\n }\n\n return builder.platform === platform;\n });\n\n if (!foundBuilder) {\n console.info(`skip ${platform} build, because it does not exist`);\n continue;\n }\n\n console.info(\n chalk.underline.rgb(...blue)(`Running [${platform}] build task:`),\n );\n\n await runner.buildPlatform({ platform });\n await foundBuilder.build(platform, { isTsProject: context.isTsProject });\n\n console.info(chalk.rgb(...gray)(`Done for [${platform}] task`));\n }\n }\n\n await runner.afterBuildPlatform();\n};\n"]}
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var stdin_exports = {};
|
|
19
|
+
__export(stdin_exports, {
|
|
20
|
+
cli: () => cli
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
23
|
+
var import_hooks = require("./hooks");
|
|
24
|
+
var import_plugins = require("./plugins");
|
|
25
|
+
var __create = Object.create;
|
|
26
|
+
var __defProp2 = Object.defineProperty;
|
|
27
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
28
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
29
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
30
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
31
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
32
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
33
|
+
for (let key of __getOwnPropNames2(from))
|
|
34
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
35
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
36
|
+
}
|
|
37
|
+
return to;
|
|
38
|
+
};
|
|
39
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps2(
|
|
40
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
41
|
+
mod
|
|
42
|
+
));
|
|
43
|
+
var __async = (__this, __arguments, generator) => {
|
|
44
|
+
return new Promise((resolve, reject) => {
|
|
45
|
+
var fulfilled = (value) => {
|
|
46
|
+
try {
|
|
47
|
+
step(generator.next(value));
|
|
48
|
+
} catch (e) {
|
|
49
|
+
reject(e);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var rejected = (value) => {
|
|
53
|
+
try {
|
|
54
|
+
step(generator.throw(value));
|
|
55
|
+
} catch (e) {
|
|
56
|
+
reject(e);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
60
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
const cli = () => ({
|
|
64
|
+
name: "@modern-js/module-tools",
|
|
65
|
+
registerHook: import_hooks.registerHook,
|
|
66
|
+
usePlugins: (0, import_plugins.getPlugins)(process.argv.slice(2)[0]),
|
|
67
|
+
setup
|
|
68
|
+
});
|
|
69
|
+
const setup = (api) => __async(void 0, null, function* () {
|
|
70
|
+
const prepare = () => __async(void 0, null, function* () {
|
|
71
|
+
const { initLocalLanguage } = yield Promise.resolve().then(() => __toESM(require("./utils/language")));
|
|
72
|
+
yield initLocalLanguage();
|
|
73
|
+
const appContext = api.useAppContext();
|
|
74
|
+
const { fs, dotenv } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
75
|
+
dotenv.config();
|
|
76
|
+
yield fs.emptydir(appContext.internalDirectory);
|
|
77
|
+
const hookRunners = api.useHookRunners();
|
|
78
|
+
yield hookRunners.addRuntimeExports();
|
|
79
|
+
const { addExitListener } = yield Promise.resolve().then(() => __toESM(require("./utils/onExit")));
|
|
80
|
+
yield addExitListener(() => __async(void 0, null, function* () {
|
|
81
|
+
yield hookRunners.afterDev();
|
|
82
|
+
}));
|
|
83
|
+
});
|
|
84
|
+
const validateSchema = () => __async(void 0, null, function* () {
|
|
85
|
+
const { schema } = yield Promise.resolve().then(() => __toESM(require("./config/schema")));
|
|
86
|
+
return schema;
|
|
87
|
+
});
|
|
88
|
+
return {
|
|
89
|
+
prepare,
|
|
90
|
+
validateSchema,
|
|
91
|
+
commands(_0) {
|
|
92
|
+
return __async(this, arguments, function* ({ program }) {
|
|
93
|
+
const { buildCommand, devCommand, newCommand, upgradCommand } = yield Promise.resolve().then(() => __toESM(require("./command")));
|
|
94
|
+
yield buildCommand(program, api);
|
|
95
|
+
yield devCommand(program, api);
|
|
96
|
+
yield newCommand(program);
|
|
97
|
+
yield upgradCommand(program);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEA,mBAA6B;AAC7B,qBAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEpB,MAAM,MAAM,OAA+B;AAAA,EAChD,MAAM;AAAA,EACN;AAAA,EACA,gBAAY,2BAAW,QAAQ,KAAK,MAAM,CAAC,EAAE,EAAE;AAAA,EAC/C;AACF;AAEA,MAAM,QAAyC,CAAM,QAAO;AAC1D,QAAM,UAAU,MAAY;AAC1B,UAAM,EAAE,kBAAkB,IAAI,MAAM,6CAAO;AAC3C,UAAM,kBAAkB;AAExB,UAAM,aAAa,IAAI,cAAc;AACrC,UAAM,EAAE,IAAI,OAAO,IAAI,MAAM,6CAAO;AACpC,WAAO,OAAO;AAEd,UAAM,GAAG,SAAS,WAAW,iBAAiB;AAE9C,UAAM,cAAc,IAAI,eAAe;AACvC,UAAM,YAAY,kBAAkB;AAEpC,UAAM,EAAE,gBAAgB,IAAI,MAAM,6CAAO;AACzC,UAAM,gBAAgB,MAAY;AAChC,YAAM,YAAY,SAAS;AAAA,IAC7B,EAAC;AAAA,EACH;AAEA,QAAM,iBAAiB,MAAY;AACjC,UAAM,EAAE,OAAO,IAAI,MAAM,6CAAO;AAChC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACM,SAAS,IAAa;AAAA,iDAAb,EAAE,QAAQ,GAAG;AAC1B,cAAM,EAAE,cAAc,YAAY,YAAY,cAAc,IAC1D,MAAM,6CAAO;AACf,cAAM,aAAa,SAAS,GAAG;AAC/B,cAAM,WAAW,SAAS,GAAG;AAC7B,cAAM,WAAW,OAAO;AACxB,cAAM,cAAc,OAAO;AAAA,MAC7B;AAAA;AAAA,EACF;AACF;","names":[],"sources":["../src/cli.ts"],"sourcesContent":["import type { CliPlugin } from '@modern-js/core';\nimport type { ModuleTools } from './types';\nimport { registerHook } from './hooks';\nimport { getPlugins } from './plugins';\n\nexport const cli = (): CliPlugin<ModuleTools> => ({\n name: '@modern-js/module-tools',\n registerHook,\n usePlugins: getPlugins(process.argv.slice(2)[0]),\n setup,\n});\n\nconst setup: CliPlugin<ModuleTools>['setup'] = async api => {\n const prepare = async () => {\n const { initLocalLanguage } = await import('./utils/language');\n await initLocalLanguage();\n\n const appContext = api.useAppContext();\n const { fs, dotenv } = await import('@modern-js/utils');\n dotenv.config();\n // remove '/node_modules/.modern-js'\n await fs.emptydir(appContext.internalDirectory);\n\n const hookRunners = api.useHookRunners();\n await hookRunners.addRuntimeExports();\n\n const { addExitListener } = await import('./utils/onExit');\n await addExitListener(async () => {\n await hookRunners.afterDev();\n });\n };\n\n const validateSchema = async () => {\n const { schema } = await import('./config/schema');\n return schema;\n };\n\n return {\n prepare,\n validateSchema,\n async commands({ program }) {\n const { buildCommand, devCommand, newCommand, upgradCommand } =\n await import('./command');\n await buildCommand(program, api);\n await devCommand(program, api);\n await newCommand(program);\n await upgradCommand(program);\n },\n };\n};\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Command } from '@modern-js/utils';
|
|
2
|
+
import type { PluginAPI } from '@modern-js/core';
|
|
3
|
+
import type { ModuleTools } from './types';
|
|
4
|
+
export declare const buildCommand: (program: Command, api: PluginAPI<ModuleTools>) => Promise<void>;
|
|
5
|
+
export declare const devCommand: (program: Command, api: PluginAPI<ModuleTools>) => Promise<void>;
|
|
6
|
+
export declare const newCommand: (program: Command) => Promise<void>;
|
|
7
|
+
export declare const upgradCommand: (program: Command) => Promise<void>;
|
package/dist/command.js
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var stdin_exports = {};
|
|
19
|
+
__export(stdin_exports, {
|
|
20
|
+
buildCommand: () => buildCommand,
|
|
21
|
+
devCommand: () => devCommand,
|
|
22
|
+
newCommand: () => newCommand,
|
|
23
|
+
upgradCommand: () => upgradCommand
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
26
|
+
var import_utils = require("@modern-js/utils");
|
|
27
|
+
var __create = Object.create;
|
|
28
|
+
var __defProp2 = Object.defineProperty;
|
|
29
|
+
var __defProps = Object.defineProperties;
|
|
30
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
31
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
32
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
33
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
34
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
35
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
36
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
37
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
38
|
+
var __spreadValues = (a, b) => {
|
|
39
|
+
for (var prop in b || (b = {}))
|
|
40
|
+
if (__hasOwnProp2.call(b, prop))
|
|
41
|
+
__defNormalProp(a, prop, b[prop]);
|
|
42
|
+
if (__getOwnPropSymbols)
|
|
43
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
44
|
+
if (__propIsEnum.call(b, prop))
|
|
45
|
+
__defNormalProp(a, prop, b[prop]);
|
|
46
|
+
}
|
|
47
|
+
return a;
|
|
48
|
+
};
|
|
49
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
50
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
51
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
52
|
+
for (let key of __getOwnPropNames2(from))
|
|
53
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
54
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
55
|
+
}
|
|
56
|
+
return to;
|
|
57
|
+
};
|
|
58
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps2(
|
|
59
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
60
|
+
mod
|
|
61
|
+
));
|
|
62
|
+
var __async = (__this, __arguments, generator) => {
|
|
63
|
+
return new Promise((resolve, reject) => {
|
|
64
|
+
var fulfilled = (value) => {
|
|
65
|
+
try {
|
|
66
|
+
step(generator.next(value));
|
|
67
|
+
} catch (e) {
|
|
68
|
+
reject(e);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
var rejected = (value) => {
|
|
72
|
+
try {
|
|
73
|
+
step(generator.throw(value));
|
|
74
|
+
} catch (e) {
|
|
75
|
+
reject(e);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
79
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
const debug = (0, import_utils.createDebugger)("module-tools");
|
|
83
|
+
const buildCommand = (program, api) => __async(void 0, null, function* () {
|
|
84
|
+
const local = yield Promise.resolve().then(() => __toESM(require("./locale")));
|
|
85
|
+
const { defaultTsConfigPath } = yield Promise.resolve().then(() => __toESM(require("./constants/dts")));
|
|
86
|
+
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(
|
|
87
|
+
"--tsconfig [tsconfig]",
|
|
88
|
+
local.i18n.t(local.localeKeys.command.build.tsconfig),
|
|
89
|
+
defaultTsConfigPath
|
|
90
|
+
).option(
|
|
91
|
+
"-p, --platform [platform...]",
|
|
92
|
+
local.i18n.t(local.localeKeys.command.build.platform)
|
|
93
|
+
).option("--no-dts", local.i18n.t(local.localeKeys.command.build.dts)).option("--no-clear", local.i18n.t(local.localeKeys.command.build.no_clear)).option(
|
|
94
|
+
"-c --config <config>",
|
|
95
|
+
local.i18n.t(local.localeKeys.command.build.config)
|
|
96
|
+
).action((options) => __async(void 0, null, function* () {
|
|
97
|
+
const { initModuleContext } = yield Promise.resolve().then(() => __toESM(require("./utils/context")));
|
|
98
|
+
const context = yield initModuleContext(api);
|
|
99
|
+
if (options.platform) {
|
|
100
|
+
const { buildPlatform } = yield Promise.resolve().then(() => __toESM(require("./builder/platform")));
|
|
101
|
+
yield buildPlatform(options, api, context);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const runner = api.useHookRunners();
|
|
105
|
+
const { normalizeBuildConfig } = yield Promise.resolve().then(() => __toESM(require("./config/normalize")));
|
|
106
|
+
const resolvedBuildConfig = yield normalizeBuildConfig(
|
|
107
|
+
api,
|
|
108
|
+
context,
|
|
109
|
+
options
|
|
110
|
+
);
|
|
111
|
+
debug("resolvedBuildConfig", resolvedBuildConfig);
|
|
112
|
+
yield runner.beforeBuild({ config: resolvedBuildConfig, options });
|
|
113
|
+
const builder = yield Promise.resolve().then(() => __toESM(require("./builder")));
|
|
114
|
+
yield builder.run(
|
|
115
|
+
{ cmdOptions: options, resolvedBuildConfig, context },
|
|
116
|
+
api
|
|
117
|
+
);
|
|
118
|
+
}));
|
|
119
|
+
});
|
|
120
|
+
const devCommand = (program, api) => __async(void 0, null, function* () {
|
|
121
|
+
const local = yield Promise.resolve().then(() => __toESM(require("./locale")));
|
|
122
|
+
const runner = api.useHookRunners();
|
|
123
|
+
const devToolMetas = yield runner.registerDev();
|
|
124
|
+
yield runner.beforeDev(devToolMetas);
|
|
125
|
+
const devProgram = program.command("dev").usage("[options]").description(local.i18n.t(local.localeKeys.command.dev.describe)).action((..._0) => __async(void 0, [..._0], function* (options = {}) {
|
|
126
|
+
const { initModuleContext } = yield Promise.resolve().then(() => __toESM(require("./utils/context")));
|
|
127
|
+
const context = yield initModuleContext(api);
|
|
128
|
+
const { dev } = yield Promise.resolve().then(() => __toESM(require("./dev")));
|
|
129
|
+
yield dev(options, devToolMetas, api, context);
|
|
130
|
+
}));
|
|
131
|
+
for (const meta of devToolMetas) {
|
|
132
|
+
if (!meta.subCommands) {
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
for (const subCmd of meta.subCommands) {
|
|
136
|
+
devProgram.command(subCmd).action((..._0) => __async(void 0, [..._0], function* (options = {}) {
|
|
137
|
+
const { initModuleContext } = yield Promise.resolve().then(() => __toESM(require("./utils/context")));
|
|
138
|
+
const context = yield initModuleContext(api);
|
|
139
|
+
yield runner.beforeDevTask(meta);
|
|
140
|
+
yield meta.action(options, { isTsProject: context.isTsProject });
|
|
141
|
+
}));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
const newCommand = (program) => __async(void 0, null, function* () {
|
|
146
|
+
const local = yield Promise.resolve().then(() => __toESM(require("./locale")));
|
|
147
|
+
program.command("new").usage("[options]").description(local.i18n.t(local.localeKeys.command.new.describe)).option(
|
|
148
|
+
"-d, --debug",
|
|
149
|
+
local.i18n.t(local.localeKeys.command.new.debug),
|
|
150
|
+
false
|
|
151
|
+
).option(
|
|
152
|
+
"-c, --config <config>",
|
|
153
|
+
local.i18n.t(local.localeKeys.command.new.config)
|
|
154
|
+
).option(
|
|
155
|
+
"--dist-tag <tag>",
|
|
156
|
+
local.i18n.t(local.localeKeys.command.new.distTag)
|
|
157
|
+
).option("--registry", local.i18n.t(local.localeKeys.command.new.registry)).action((options) => __async(void 0, null, function* () {
|
|
158
|
+
const { ModuleNewAction } = yield Promise.resolve().then(() => __toESM(require("@modern-js/new-action")));
|
|
159
|
+
const { getLocaleLanguage } = yield Promise.resolve().then(() => __toESM(require("./utils/language")));
|
|
160
|
+
const locale = getLocaleLanguage();
|
|
161
|
+
yield ModuleNewAction(__spreadProps(__spreadValues({}, options), { locale }));
|
|
162
|
+
}));
|
|
163
|
+
});
|
|
164
|
+
const upgradCommand = (program) => __async(void 0, null, function* () {
|
|
165
|
+
const { defineCommand } = yield Promise.resolve().then(() => __toESM(require("@modern-js/upgrade")));
|
|
166
|
+
defineCommand(program.command("upgrade"));
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":"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","names":[],"sources":["../src/command.ts"],"sourcesContent":["import type { Command } from '@modern-js/utils';\nimport { createDebugger } from '@modern-js/utils';\nimport type { PluginAPI } from '@modern-js/core';\nimport type { ModuleTools } from './types';\nimport type { DevCommandOptions, BuildCommandOptions } from './types/command';\n\nconst debug = createDebugger('module-tools');\n\nexport const buildCommand = async (\n program: Command,\n api: PluginAPI<ModuleTools>,\n) => {\n const local = await import('./locale');\n const { defaultTsConfigPath } = await import('./constants/dts');\n\n program\n .command('build')\n .usage('[options]')\n .description(local.i18n.t(local.localeKeys.command.build.describe))\n .option('-w, --watch', local.i18n.t(local.localeKeys.command.build.watch))\n .option(\n '--tsconfig [tsconfig]',\n local.i18n.t(local.localeKeys.command.build.tsconfig),\n defaultTsConfigPath,\n )\n .option(\n '-p, --platform [platform...]',\n local.i18n.t(local.localeKeys.command.build.platform),\n )\n .option('--no-dts', local.i18n.t(local.localeKeys.command.build.dts))\n .option('--no-clear', local.i18n.t(local.localeKeys.command.build.no_clear))\n .option(\n '-c --config <config>',\n local.i18n.t(local.localeKeys.command.build.config),\n )\n .action(async (options: BuildCommandOptions) => {\n const { initModuleContext } = await import('./utils/context');\n const context = await initModuleContext(api);\n if (options.platform) {\n const { buildPlatform } = await import('./builder/platform');\n await buildPlatform(options, api, context);\n return;\n }\n\n const runner = api.useHookRunners();\n\n const { normalizeBuildConfig } = await import('./config/normalize');\n const resolvedBuildConfig = await normalizeBuildConfig(\n api,\n context,\n options,\n );\n\n debug('resolvedBuildConfig', resolvedBuildConfig);\n\n await runner.beforeBuild({ config: resolvedBuildConfig, options });\n const builder = await import('./builder');\n await builder.run(\n { cmdOptions: options, resolvedBuildConfig, context },\n api,\n );\n });\n};\n\nexport const devCommand = async (\n program: Command,\n api: PluginAPI<ModuleTools>,\n) => {\n const local = await import('./locale');\n const runner = api.useHookRunners();\n const devToolMetas = await runner.registerDev();\n\n await runner.beforeDev(devToolMetas);\n\n const devProgram = program\n .command('dev')\n .usage('[options]')\n .description(local.i18n.t(local.localeKeys.command.dev.describe))\n .action(async (options: DevCommandOptions = {}) => {\n const { initModuleContext } = await import('./utils/context');\n const context = await initModuleContext(api);\n const { dev } = await import('./dev');\n await dev(options, devToolMetas, api, context);\n });\n\n for (const meta of devToolMetas) {\n if (!meta.subCommands) {\n continue;\n }\n\n for (const subCmd of meta.subCommands) {\n devProgram\n .command(subCmd)\n .action(async (options: DevCommandOptions = {}) => {\n const { initModuleContext } = await import('./utils/context');\n const context = await initModuleContext(api);\n await runner.beforeDevTask(meta);\n await meta.action(options, { isTsProject: context.isTsProject });\n });\n }\n }\n};\n\nexport const newCommand = async (program: Command) => {\n const local = await import('./locale');\n\n program\n .command('new')\n .usage('[options]')\n .description(local.i18n.t(local.localeKeys.command.new.describe))\n .option(\n '-d, --debug',\n local.i18n.t(local.localeKeys.command.new.debug),\n false,\n )\n .option(\n '-c, --config <config>',\n local.i18n.t(local.localeKeys.command.new.config),\n )\n .option(\n '--dist-tag <tag>',\n local.i18n.t(local.localeKeys.command.new.distTag),\n )\n .option('--registry', local.i18n.t(local.localeKeys.command.new.registry))\n .action(async options => {\n const { ModuleNewAction } = await import('@modern-js/new-action');\n const { getLocaleLanguage } = await import('./utils/language');\n const locale = getLocaleLanguage();\n\n await ModuleNewAction({ ...options, locale });\n });\n};\n\nexport const upgradCommand = async (program: Command) => {\n const { defineCommand } = await import('@modern-js/upgrade');\n defineCommand(program.command('upgrade'));\n};\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var stdin_exports = {};
|
|
19
|
+
__export(stdin_exports, {
|
|
20
|
+
defineConfig: () => defineConfig
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
23
|
+
const defineConfig = (config) => config;
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=defineConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;;;;;AAEO;AAAA;AAAA;AAAA;AAAA;AAAA,MAAM,eAAe,CAAC,WAC3B;","names":[],"sources":["../../src/config/defineConfig.ts"],"sourcesContent":["import type { ModuleConfigParams } from '../types';\n\nexport const defineConfig = (config: ModuleConfigParams): ModuleConfigParams =>\n config;\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PluginAPI } from '@modern-js/core';
|
|
2
|
+
import type { ModuleUserConfig, BaseBuildConfig, BuildPreset, PartialBuildConfig, PartialBaseBuildConfig, ModuleContext, BuildCommandOptions, ModuleTools } from '../types';
|
|
3
|
+
export declare const transformBuildPresetToBaseConfigs: (options: {
|
|
4
|
+
context: ModuleContext;
|
|
5
|
+
buildCmdOptions: BuildCommandOptions;
|
|
6
|
+
}, preset?: BuildPreset) => Promise<BaseBuildConfig[]>;
|
|
7
|
+
export declare const transformBuildConfigToBaseConfigs: (config: PartialBuildConfig, options: {
|
|
8
|
+
buildCmdOptions: BuildCommandOptions;
|
|
9
|
+
context: ModuleContext;
|
|
10
|
+
}) => Promise<BaseBuildConfig[]>;
|
|
11
|
+
export declare const requiredBuildConfig: (partialBuildConfig: PartialBaseBuildConfig, context: ModuleContext) => Promise<BaseBuildConfig>;
|
|
12
|
+
export declare const transformToAbsPath: (baseConfig: BaseBuildConfig, options: {
|
|
13
|
+
context: ModuleContext;
|
|
14
|
+
buildCmdOptions: BuildCommandOptions;
|
|
15
|
+
}) => Promise<BaseBuildConfig>;
|
|
16
|
+
export declare const checkConfig: (config: ModuleUserConfig) => Promise<void>;
|
|
17
|
+
export declare const normalizeBuildConfig: (api: PluginAPI<ModuleTools>, context: ModuleContext, buildCmdOptions: BuildCommandOptions) => Promise<BaseBuildConfig[]>;
|