@modern-js/module-tools 2.0.0-beta.3 → 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 +207 -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 +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 +45 -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/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,45 @@
|
|
|
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
|
+
defaultTransformedFunctions: () => defaultTransformedFunctions,
|
|
21
|
+
defaultTsConfigPath: () => defaultTsConfigPath,
|
|
22
|
+
dtsTempDirectory: () => dtsTempDirectory,
|
|
23
|
+
watchDoneText: () => watchDoneText
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
26
|
+
const defaultTransformedFunctions = [
|
|
27
|
+
"require",
|
|
28
|
+
"require.resolve",
|
|
29
|
+
"System.import",
|
|
30
|
+
"jest.genMockFromModule",
|
|
31
|
+
"jest.mock",
|
|
32
|
+
"jest.unmock",
|
|
33
|
+
"jest.doMock",
|
|
34
|
+
"jest.dontMock",
|
|
35
|
+
"jest.setMock",
|
|
36
|
+
"jest.requireActual",
|
|
37
|
+
"jest.requireMock",
|
|
38
|
+
"require.requireActual",
|
|
39
|
+
"require.requireMock"
|
|
40
|
+
];
|
|
41
|
+
const defaultTsConfigPath = "./tsconfig.json";
|
|
42
|
+
const watchDoneText = "Watching for file changes";
|
|
43
|
+
const dtsTempDirectory = "node_modules/.dts-temp";
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=dts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;;;;;AAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAAM,8BAA8B;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AACF;AAEO,MAAM,sBAAsB;AAC5B,MAAM,gBAAgB;AACtB,MAAM,mBAAmB;","names":[],"sources":["../../src/constants/dts.ts"],"sourcesContent":["export const defaultTransformedFunctions = [\n 'require',\n 'require.resolve',\n 'System.import',\n\n // Jest methods\n 'jest.genMockFromModule',\n 'jest.mock',\n 'jest.unmock',\n 'jest.doMock',\n 'jest.dontMock',\n 'jest.setMock',\n 'jest.requireActual',\n 'jest.requireMock',\n\n // Older Jest methods\n 'require.requireActual',\n 'require.requireMock',\n];\n\nexport const defaultTsConfigPath = './tsconfig.json';\nexport const watchDoneText = 'Watching for file changes';\nexport const dtsTempDirectory = 'node_modules/.dts-temp';\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
assetExts: () => assetExts,
|
|
21
|
+
dtsAliasExts: () => dtsAliasExts,
|
|
22
|
+
styleExts: () => styleExts
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
25
|
+
const assetExts = [".png", ".jpg", ".svg"];
|
|
26
|
+
const styleExts = [".css", ".less", ".sass", ".scss"];
|
|
27
|
+
const dtsAliasExts = [".d.ts"];
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;;;;;AAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAAM,YAAY,CAAC,QAAQ,QAAQ,MAAM;AACzC,MAAM,YAAY,CAAC,QAAQ,SAAS,SAAS,OAAO;AACpD,MAAM,eAAe,CAAC,OAAO;","names":[],"sources":["../../src/constants/file.ts"],"sourcesContent":["export const assetExts = ['.png', '.jpg', '.svg'];\nexport const styleExts = ['.css', '.less', '.sass', '.scss'];\nexport const dtsAliasExts = ['.d.ts'];\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PartialBuildConfig } from '../types';
|
|
2
|
+
export declare const universalJsPreset: PartialBuildConfig;
|
|
3
|
+
export declare const universalJsLitePreset: PartialBuildConfig;
|
|
4
|
+
export declare const browserJsPreset: PartialBuildConfig;
|
|
5
|
+
export declare const browserJsLitePreset: PartialBuildConfig;
|
|
6
|
+
export declare const nodeJsPreset: PartialBuildConfig;
|
|
7
|
+
export declare const legacyPresets: {
|
|
8
|
+
UNIVERSAL_JS: import("../types").PartialBaseBuildConfig[];
|
|
9
|
+
UNIVERSAL_JS_LITE: import("../types").PartialBaseBuildConfig[];
|
|
10
|
+
BROWSER_JS: import("../types").PartialBaseBuildConfig[];
|
|
11
|
+
BROWSER_JS_LITE: import("../types").PartialBaseBuildConfig[];
|
|
12
|
+
NODE_JS: import("../types").PartialBaseBuildConfig[];
|
|
13
|
+
};
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
var stdin_exports = {};
|
|
25
|
+
__export(stdin_exports, {
|
|
26
|
+
browserJsLitePreset: () => browserJsLitePreset,
|
|
27
|
+
browserJsPreset: () => browserJsPreset,
|
|
28
|
+
legacyPresets: () => legacyPresets,
|
|
29
|
+
nodeJsPreset: () => nodeJsPreset,
|
|
30
|
+
universalJsLitePreset: () => universalJsLitePreset,
|
|
31
|
+
universalJsPreset: () => universalJsPreset
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
34
|
+
var import_path = __toESM(require("path"));
|
|
35
|
+
const legacyWithSourceCodeToCopyConfig = {
|
|
36
|
+
patterns: [
|
|
37
|
+
{
|
|
38
|
+
from: import_path.default.join("src", "**/*.{less,sass,scss}"),
|
|
39
|
+
context: "src"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
};
|
|
43
|
+
const universalJsPreset = [
|
|
44
|
+
{
|
|
45
|
+
buildType: "bundleless",
|
|
46
|
+
format: "esm",
|
|
47
|
+
target: "es5",
|
|
48
|
+
outdir: "./dist/js/treeshaking",
|
|
49
|
+
copy: legacyWithSourceCodeToCopyConfig,
|
|
50
|
+
dts: false
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
buildType: "bundleless",
|
|
54
|
+
format: "cjs",
|
|
55
|
+
target: "es6",
|
|
56
|
+
outdir: "./dist/js/node",
|
|
57
|
+
dts: false
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
buildType: "bundleless",
|
|
61
|
+
format: "esm",
|
|
62
|
+
target: "es6",
|
|
63
|
+
outdir: "./dist/js/modern",
|
|
64
|
+
dts: false
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
buildType: "bundleless",
|
|
68
|
+
dts: { only: true },
|
|
69
|
+
outdir: "./dist/types"
|
|
70
|
+
}
|
|
71
|
+
];
|
|
72
|
+
const universalJsLitePreset = [
|
|
73
|
+
{
|
|
74
|
+
buildType: "bundleless",
|
|
75
|
+
format: "esm",
|
|
76
|
+
target: "es5",
|
|
77
|
+
outdir: "./dist/js/treeshaking",
|
|
78
|
+
copy: legacyWithSourceCodeToCopyConfig,
|
|
79
|
+
dts: false
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
buildType: "bundleless",
|
|
83
|
+
format: "cjs",
|
|
84
|
+
target: "es6",
|
|
85
|
+
outdir: "./dist/js/node",
|
|
86
|
+
dts: false
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
buildType: "bundleless",
|
|
90
|
+
format: "esm",
|
|
91
|
+
target: "es5",
|
|
92
|
+
outdir: "./dist/js/modern",
|
|
93
|
+
dts: false
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
buildType: "bundleless",
|
|
97
|
+
dts: { only: true },
|
|
98
|
+
outdir: "./dist/types"
|
|
99
|
+
}
|
|
100
|
+
];
|
|
101
|
+
const browserJsPreset = [
|
|
102
|
+
{
|
|
103
|
+
buildType: "bundleless",
|
|
104
|
+
format: "esm",
|
|
105
|
+
target: "es5",
|
|
106
|
+
outdir: "./dist/js/treeshaking",
|
|
107
|
+
copy: legacyWithSourceCodeToCopyConfig,
|
|
108
|
+
dts: false
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
buildType: "bundleless",
|
|
112
|
+
format: "esm",
|
|
113
|
+
target: "es6",
|
|
114
|
+
outdir: "./dist/js/node",
|
|
115
|
+
dts: false
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
buildType: "bundleless",
|
|
119
|
+
format: "esm",
|
|
120
|
+
target: "es6",
|
|
121
|
+
outdir: "./dist/js/modern",
|
|
122
|
+
dts: false
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
buildType: "bundleless",
|
|
126
|
+
dts: { only: true },
|
|
127
|
+
outdir: "./dist/types"
|
|
128
|
+
}
|
|
129
|
+
];
|
|
130
|
+
const browserJsLitePreset = [
|
|
131
|
+
{
|
|
132
|
+
buildType: "bundleless",
|
|
133
|
+
format: "esm",
|
|
134
|
+
target: "es5",
|
|
135
|
+
dts: false,
|
|
136
|
+
outdir: "./dist/js/treeshaking",
|
|
137
|
+
copy: legacyWithSourceCodeToCopyConfig
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
buildType: "bundleless",
|
|
141
|
+
format: "esm",
|
|
142
|
+
target: "es5",
|
|
143
|
+
outdir: "./dist/js/node",
|
|
144
|
+
dts: false
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
buildType: "bundleless",
|
|
148
|
+
format: "esm",
|
|
149
|
+
target: "es5",
|
|
150
|
+
outdir: "./dist/js/modern",
|
|
151
|
+
dts: false
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
buildType: "bundleless",
|
|
155
|
+
dts: { only: true },
|
|
156
|
+
outdir: "./dist/types"
|
|
157
|
+
}
|
|
158
|
+
];
|
|
159
|
+
const nodeJsPreset = [
|
|
160
|
+
{
|
|
161
|
+
buildType: "bundleless",
|
|
162
|
+
format: "cjs",
|
|
163
|
+
target: "es6",
|
|
164
|
+
dts: false,
|
|
165
|
+
outdir: "./dist/js/node",
|
|
166
|
+
copy: legacyWithSourceCodeToCopyConfig
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
buildType: "bundleless",
|
|
170
|
+
format: "esm",
|
|
171
|
+
target: "es6",
|
|
172
|
+
dts: false,
|
|
173
|
+
outdir: "./dist/js/modern"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
buildType: "bundleless",
|
|
177
|
+
dts: { only: true },
|
|
178
|
+
outdir: "./dist/types"
|
|
179
|
+
}
|
|
180
|
+
];
|
|
181
|
+
const legacyPresets = {
|
|
182
|
+
UNIVERSAL_JS: universalJsPreset,
|
|
183
|
+
UNIVERSAL_JS_LITE: universalJsLitePreset,
|
|
184
|
+
BROWSER_JS: browserJsPreset,
|
|
185
|
+
BROWSER_JS_LITE: browserJsLitePreset,
|
|
186
|
+
NODE_JS: nodeJsPreset
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
//# sourceMappingURL=legacy-build-presets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAGjB,MAAM,mCAAmC;AAAA,EACvC,UAAU;AAAA,IACR;AAAA,MACE,MAAM,oBAAK,KAAK,OAAO,uBAAuB;AAAA,MAC9C,SAAS;AAAA,IACX;AAAA,EACF;AACF;AAEO,MAAM,oBAAwC;AAAA,EACnD;AAAA,IACE,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,KAAK;AAAA,EACP;AAAA,EACA;AAAA,IACE,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,KAAK;AAAA,EACP;AAAA,EACA;AAAA,IACE,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,KAAK;AAAA,EACP;AAAA,EACA;AAAA,IACE,WAAW;AAAA,IACX,KAAK,EAAE,MAAM,KAAK;AAAA,IAClB,QAAQ;AAAA,EACV;AACF;AAEO,MAAM,wBAA4C;AAAA,EACvD;AAAA,IACE,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,KAAK;AAAA,EACP;AAAA,EACA;AAAA,IACE,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,KAAK;AAAA,EACP;AAAA,EACA;AAAA,IACE,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,KAAK;AAAA,EACP;AAAA,EACA;AAAA,IACE,WAAW;AAAA,IACX,KAAK,EAAE,MAAM,KAAK;AAAA,IAClB,QAAQ;AAAA,EACV;AACF;AACO,MAAM,kBAAsC;AAAA,EACjD;AAAA,IACE,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,KAAK;AAAA,EACP;AAAA,EACA;AAAA,IACE,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,KAAK;AAAA,EACP;AAAA,EACA;AAAA,IACE,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,KAAK;AAAA,EACP;AAAA,EACA;AAAA,IACE,WAAW;AAAA,IACX,KAAK,EAAE,MAAM,KAAK;AAAA,IAClB,QAAQ;AAAA,EACV;AACF;AAEO,MAAM,sBAA0C;AAAA,EACrD;AAAA,IACE,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,KAAK;AAAA,IACL,QAAQ;AAAA,IACR,MAAM;AAAA,EACR;AAAA,EACA;AAAA,IACE,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,KAAK;AAAA,EACP;AAAA,EACA;AAAA,IACE,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,KAAK;AAAA,EACP;AAAA,EACA;AAAA,IACE,WAAW;AAAA,IACX,KAAK,EAAE,MAAM,KAAK;AAAA,IAClB,QAAQ;AAAA,EACV;AACF;AAEO,MAAM,eAAmC;AAAA,EAC9C;AAAA,IACE,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,KAAK;AAAA,IACL,QAAQ;AAAA,IACR,MAAM;AAAA,EACR;AAAA,EACA;AAAA,IACE,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,KAAK;AAAA,IACL,QAAQ;AAAA,EACV;AAAA,EACA;AAAA,IACE,WAAW;AAAA,IACX,KAAK,EAAE,MAAM,KAAK;AAAA,IAClB,QAAQ;AAAA,EACV;AACF;AAEO,MAAM,gBAAgB;AAAA,EAC3B,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,SAAS;AACX;","names":[],"sources":["../../src/constants/legacy-build-presets.ts"],"sourcesContent":["import path from 'path';\nimport type { PartialBuildConfig } from '../types';\n\nconst legacyWithSourceCodeToCopyConfig = {\n patterns: [\n {\n from: path.join('src', '**/*.{less,sass,scss}'),\n context: 'src',\n },\n ],\n};\n\nexport const universalJsPreset: PartialBuildConfig = [\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es5',\n outdir: './dist/js/treeshaking',\n copy: legacyWithSourceCodeToCopyConfig,\n dts: false,\n },\n {\n buildType: 'bundleless',\n format: 'cjs',\n target: 'es6',\n outdir: './dist/js/node',\n dts: false,\n },\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es6',\n outdir: './dist/js/modern',\n dts: false,\n },\n {\n buildType: 'bundleless',\n dts: { only: true },\n outdir: './dist/types',\n },\n];\n\nexport const universalJsLitePreset: PartialBuildConfig = [\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es5',\n outdir: './dist/js/treeshaking',\n copy: legacyWithSourceCodeToCopyConfig,\n dts: false,\n },\n {\n buildType: 'bundleless',\n format: 'cjs',\n target: 'es6',\n outdir: './dist/js/node',\n dts: false,\n },\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es5',\n outdir: './dist/js/modern',\n dts: false,\n },\n {\n buildType: 'bundleless',\n dts: { only: true },\n outdir: './dist/types',\n },\n];\nexport const browserJsPreset: PartialBuildConfig = [\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es5',\n outdir: './dist/js/treeshaking',\n copy: legacyWithSourceCodeToCopyConfig,\n dts: false,\n },\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es6',\n outdir: './dist/js/node',\n dts: false,\n },\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es6',\n outdir: './dist/js/modern',\n dts: false,\n },\n {\n buildType: 'bundleless',\n dts: { only: true },\n outdir: './dist/types',\n },\n];\n\nexport const browserJsLitePreset: PartialBuildConfig = [\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es5',\n dts: false,\n outdir: './dist/js/treeshaking',\n copy: legacyWithSourceCodeToCopyConfig,\n },\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es5',\n outdir: './dist/js/node',\n dts: false,\n },\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es5',\n outdir: './dist/js/modern',\n dts: false,\n },\n {\n buildType: 'bundleless',\n dts: { only: true },\n outdir: './dist/types',\n },\n];\n\nexport const nodeJsPreset: PartialBuildConfig = [\n {\n buildType: 'bundleless',\n format: 'cjs',\n target: 'es6',\n dts: false,\n outdir: './dist/js/node',\n copy: legacyWithSourceCodeToCopyConfig,\n },\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es6',\n dts: false,\n outdir: './dist/js/modern',\n },\n {\n buildType: 'bundleless',\n dts: { only: true },\n outdir: './dist/types',\n },\n];\n\nexport const legacyPresets = {\n UNIVERSAL_JS: universalJsPreset,\n UNIVERSAL_JS_LITE: universalJsLitePreset,\n BROWSER_JS: browserJsPreset,\n BROWSER_JS_LITE: browserJsLitePreset,\n NODE_JS: nodeJsPreset,\n};\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare enum SectionTitleStatus {
|
|
2
|
+
Success = 0,
|
|
3
|
+
Fail = 1,
|
|
4
|
+
Log = 2,
|
|
5
|
+
}
|
|
6
|
+
export declare const BundleDtsLogPrefix = "[Bundle:DTS]";
|
|
7
|
+
export declare const BundlelessDtsLogPrefix = "[Bundleless:DTS]";
|
|
8
|
+
export declare const buildSuccessText = "Build succeed";
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
BundleDtsLogPrefix: () => BundleDtsLogPrefix,
|
|
21
|
+
BundlelessDtsLogPrefix: () => BundlelessDtsLogPrefix,
|
|
22
|
+
SectionTitleStatus: () => SectionTitleStatus,
|
|
23
|
+
buildSuccessText: () => buildSuccessText
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
26
|
+
var SectionTitleStatus = /* @__PURE__ */ ((SectionTitleStatus2) => {
|
|
27
|
+
SectionTitleStatus2[SectionTitleStatus2["Success"] = 0] = "Success";
|
|
28
|
+
SectionTitleStatus2[SectionTitleStatus2["Fail"] = 1] = "Fail";
|
|
29
|
+
SectionTitleStatus2[SectionTitleStatus2["Log"] = 2] = "Log";
|
|
30
|
+
return SectionTitleStatus2;
|
|
31
|
+
})(SectionTitleStatus || {});
|
|
32
|
+
const BundleDtsLogPrefix = "[Bundle:DTS]";
|
|
33
|
+
const BundlelessDtsLogPrefix = "[Bundleless:DTS]";
|
|
34
|
+
const buildSuccessText = "Build succeed";
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=log.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;;;;;AAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAK,qBAAL,kBAAKA,wBAAL;AACLA;AACAA;AACAA;AAHU;AAAA;AAML,MAAM,qBAAqB;AAC3B,MAAM,yBAAyB;AAC/B,MAAM,mBAAmB;","names":["SectionTitleStatus"],"sources":["../../src/constants/log.ts"],"sourcesContent":["export enum SectionTitleStatus {\n Success,\n Fail,\n Log,\n}\n\nexport const BundleDtsLogPrefix = '[Bundle:DTS]';\nexport const BundlelessDtsLogPrefix = '[Bundleless:DTS]';\nexport const buildSuccessText = 'Build succeed';\n"]}
|
package/dist/dev.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PluginAPI } from '@modern-js/core';
|
|
2
|
+
import type { DevCommandOptions } from './types/command';
|
|
3
|
+
import type { ModuleContext } from './types/context';
|
|
4
|
+
import type { DevToolData, ModuleTools } from './types';
|
|
5
|
+
export declare const runBuildBeforeDevTools: (options: {
|
|
6
|
+
disableRunBuild: boolean;
|
|
7
|
+
appDirectory: string;
|
|
8
|
+
}) => Promise<void>;
|
|
9
|
+
export declare const showMenu: (metas: DevToolData[], devCmdOptions: DevCommandOptions, api: PluginAPI<ModuleTools>, context: ModuleContext) => Promise<void>;
|
|
10
|
+
export declare const dev: (options: DevCommandOptions, metas: DevToolData[], api: PluginAPI<ModuleTools>, context: ModuleContext) => Promise<void>;
|
package/dist/dev.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
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
|
+
dev: () => dev,
|
|
21
|
+
runBuildBeforeDevTools: () => runBuildBeforeDevTools,
|
|
22
|
+
showMenu: () => showMenu
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
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 runBuildBeforeDevTools = (options) => __async(void 0, null, function* () {
|
|
64
|
+
if (!options.disableRunBuild) {
|
|
65
|
+
const { execa } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
66
|
+
execa("modern", ["build", "--watch"], {
|
|
67
|
+
stdio: ["inherit", "inherit", "inherit"],
|
|
68
|
+
cwd: options.appDirectory
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
const showMenu = (metas, devCmdOptions, api, context) => __async(void 0, null, function* () {
|
|
73
|
+
var _a;
|
|
74
|
+
const { chalk, inquirer } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
75
|
+
const runner = api.useHookRunners();
|
|
76
|
+
const menuTitle = chalk.rgb(255, 153, 0);
|
|
77
|
+
const choices = metas.map((meta) => meta.menuItem).filter((menuItem) => typeof menuItem === "object");
|
|
78
|
+
const question = [
|
|
79
|
+
{
|
|
80
|
+
name: "choiceDevTool",
|
|
81
|
+
message: menuTitle("选择调试工具"),
|
|
82
|
+
type: "list",
|
|
83
|
+
choices
|
|
84
|
+
}
|
|
85
|
+
];
|
|
86
|
+
const newQuestion = yield runner.beforeDevMenu(question);
|
|
87
|
+
const result = yield inquirer.prompt(
|
|
88
|
+
newQuestion.length !== 0 ? newQuestion : question
|
|
89
|
+
);
|
|
90
|
+
yield runner.afterDevMenu({ result, devTools: metas });
|
|
91
|
+
const currentDevTool = metas.find(
|
|
92
|
+
(meta) => {
|
|
93
|
+
var _a2;
|
|
94
|
+
return ((_a2 = meta.menuItem) == null ? void 0 : _a2.value) === result.choiceDevTool;
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
if (currentDevTool) {
|
|
98
|
+
yield runBuildBeforeDevTools({
|
|
99
|
+
disableRunBuild: (_a = currentDevTool.disableRunBuild) != null ? _a : false,
|
|
100
|
+
appDirectory: context.appDirectory
|
|
101
|
+
});
|
|
102
|
+
yield runner.beforeDevTask(currentDevTool);
|
|
103
|
+
yield currentDevTool.action(devCmdOptions, {
|
|
104
|
+
isTsProject: context.isTsProject
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
const dev = (options, metas, api, context) => __async(void 0, null, function* () {
|
|
109
|
+
var _a, _b, _c;
|
|
110
|
+
const { chalk } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
111
|
+
const { purple } = yield Promise.resolve().then(() => __toESM(require("./constants/colors")));
|
|
112
|
+
if (metas.length === 0) {
|
|
113
|
+
console.info("No dev tools found available");
|
|
114
|
+
process.exit(0);
|
|
115
|
+
}
|
|
116
|
+
const runner = api.useHookRunners();
|
|
117
|
+
if (metas.length === 1) {
|
|
118
|
+
console.info(
|
|
119
|
+
chalk.rgb(...purple)(
|
|
120
|
+
`Only one dev tooling is currently detected as available, run it directly [${(_b = (_a = metas[0].menuItem) == null ? void 0 : _a.name) != null ? _b : metas[0].name}]`
|
|
121
|
+
)
|
|
122
|
+
);
|
|
123
|
+
const meta = metas[0];
|
|
124
|
+
yield runBuildBeforeDevTools({
|
|
125
|
+
disableRunBuild: (_c = meta.disableRunBuild) != null ? _c : false,
|
|
126
|
+
appDirectory: context.appDirectory
|
|
127
|
+
});
|
|
128
|
+
yield runner.beforeDevTask(meta);
|
|
129
|
+
yield meta.action(options, { isTsProject: context.isTsProject });
|
|
130
|
+
} else if (metas.length > 1) {
|
|
131
|
+
yield showMenu(metas, options, api, context);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
//# sourceMappingURL=dev.js.map
|
package/dist/dev.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,MAAM,yBAAyB,CAAO,YAGvC;AACJ,MAAI,CAAC,QAAQ,iBAAiB;AAC5B,UAAM,EAAE,MAAM,IAAI,MAAM,6CAAO;AAE/B,UAAM,UAAU,CAAC,SAAS,SAAS,GAAG;AAAA,MACpC,OAAO,CAAC,WAAW,WAAW,SAAS;AAAA,MACvC,KAAK,QAAQ;AAAA,IACf,CAAC;AAAA,EACH;AACF;AAEO,MAAM,WAAW,CACtB,OACA,eACA,KACA,YACG;AAxBL;AAyBE,QAAM,EAAE,OAAO,SAAS,IAAI,MAAM,6CAAO;AACzC,QAAM,SAAS,IAAI,eAAe;AAElC,QAAM,YAAY,MAAM,IAAI,KAAK,KAAK,CAAC;AACvC,QAAM,UAAU,MACb,IAAI,UAAQ,KAAK,QAAQ,EACzB,OAAO,cAAY,OAAO,aAAa,QAAQ;AAClD,QAAM,WAAW;AAAA,IACf;AAAA,MACE,MAAM;AAAA,MACN,SAAS,UAAU,QAAQ;AAAA,MAC3B,MAAM;AAAA,MACN;AAAA,IACF;AAAA,EACF;AAEA,QAAM,cAAc,MAAM,OAAO,cAAc,QAAQ;AACvD,QAAM,SAAoC,MAAM,SAAS;AAAA,IACvD,YAAY,WAAW,IAAI,cAAc;AAAA,EAC3C;AACA,QAAM,OAAO,aAAa,EAAE,QAAQ,UAAU,MAAM,CAAC;AAErD,QAAM,iBAAiB,MAAM;AAAA,IAC3B,UAAK;AAhDT;AAgDY,0BAAK,aAAL,oBAAe,WAAU,OAAO;AAAA;AAAA,EAC1C;AACA,MAAI,gBAAgB;AAClB,UAAM,uBAAuB;AAAA,MAC3B,kBAAiB,oBAAe,oBAAf,YAAkC;AAAA,MACnD,cAAc,QAAQ;AAAA,IACxB,CAAC;AAED,UAAM,OAAO,cAAc,cAAc;AACzC,UAAM,eAAe,OAAO,eAAe;AAAA,MACzC,aAAa,QAAQ;AAAA,IACvB,CAAC;AAAA,EACH;AACF;AAEO,MAAM,MAAM,CACjB,SACA,OACA,KACA,YACG;AApEL;AAqEE,QAAM,EAAE,MAAM,IAAI,MAAM,6CAAO;AAC/B,QAAM,EAAE,OAAO,IAAI,MAAM,6CAAO;AAChC,MAAI,MAAM,WAAW,GAAG;AACtB,YAAQ,KAAK,8BAA8B;AAE3C,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,QAAM,SAAS,IAAI,eAAe;AAClC,MAAI,MAAM,WAAW,GAAG;AACtB,YAAQ;AAAA,MACN,MAAM,IAAI,GAAG,MAAM;AAAA,QACjB,8EACE,iBAAM,GAAG,aAAT,mBAAmB,SAAnB,YAA2B,MAAM,GAAG;AAAA,MAExC;AAAA,IACF;AACA,UAAM,OAAO,MAAM;AAEnB,UAAM,uBAAuB;AAAA,MAC3B,kBAAiB,UAAK,oBAAL,YAAwB;AAAA,MACzC,cAAc,QAAQ;AAAA,IACxB,CAAC;AAED,UAAM,OAAO,cAAc,IAAI;AAC/B,UAAM,KAAK,OAAO,SAAS,EAAE,aAAa,QAAQ,YAAY,CAAC;AAAA,EACjE,WAAW,MAAM,SAAS,GAAG;AAC3B,UAAM,SAAS,OAAO,SAAS,KAAK,OAAO;AAAA,EAC7C;AACF;","names":[],"sources":["../src/dev.ts"],"sourcesContent":["import type { PluginAPI } from '@modern-js/core';\nimport type { DevCommandOptions } from './types/command';\nimport type { ModuleContext } from './types/context';\nimport type { DevToolData, ModuleTools } from './types';\n\nexport const runBuildBeforeDevTools = async (options: {\n disableRunBuild: boolean;\n appDirectory: string;\n}) => {\n if (!options.disableRunBuild) {\n const { execa } = await import('@modern-js/utils');\n // because it is watch mode, so not use 'await'\n execa('modern', ['build', '--watch'], {\n stdio: ['inherit', 'inherit', 'inherit'],\n cwd: options.appDirectory,\n });\n }\n};\n\nexport const showMenu = async (\n metas: DevToolData[],\n devCmdOptions: DevCommandOptions,\n api: PluginAPI<ModuleTools>,\n context: ModuleContext,\n) => {\n const { chalk, inquirer } = await import('@modern-js/utils');\n const runner = api.useHookRunners();\n\n const menuTitle = chalk.rgb(255, 153, 0);\n const choices = metas\n .map(meta => meta.menuItem)\n .filter(menuItem => typeof menuItem === 'object');\n const question = [\n {\n name: 'choiceDevTool',\n message: menuTitle('选择调试工具'),\n type: 'list',\n choices,\n },\n ];\n\n const newQuestion = await runner.beforeDevMenu(question);\n const result: { choiceDevTool: string } = await inquirer.prompt(\n newQuestion.length !== 0 ? newQuestion : question,\n );\n await runner.afterDevMenu({ result, devTools: metas });\n\n const currentDevTool = metas.find(\n meta => meta.menuItem?.value === result.choiceDevTool,\n );\n if (currentDevTool) {\n await runBuildBeforeDevTools({\n disableRunBuild: currentDevTool.disableRunBuild ?? false,\n appDirectory: context.appDirectory,\n });\n\n await runner.beforeDevTask(currentDevTool);\n await currentDevTool.action(devCmdOptions, {\n isTsProject: context.isTsProject,\n });\n }\n};\n\nexport const dev = async (\n options: DevCommandOptions,\n metas: DevToolData[],\n api: PluginAPI<ModuleTools>,\n context: ModuleContext,\n) => {\n const { chalk } = await import('@modern-js/utils');\n const { purple } = await import('./constants/colors');\n if (metas.length === 0) {\n console.info('No dev tools found available');\n // eslint-disable-next-line no-process-exit\n process.exit(0);\n }\n\n const runner = api.useHookRunners();\n if (metas.length === 1) {\n console.info(\n chalk.rgb(...purple)(\n `Only one dev tooling is currently detected as available, run it directly [${\n metas[0].menuItem?.name ?? metas[0].name\n }]`,\n ),\n );\n const meta = metas[0];\n\n await runBuildBeforeDevTools({\n disableRunBuild: meta.disableRunBuild ?? false,\n appDirectory: context.appDirectory,\n });\n\n await runner.beforeDevTask(meta);\n await meta.action(options, { isTsProject: context.isTsProject });\n } else if (metas.length > 1) {\n await showMenu(metas, options, api, context);\n }\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExecaError } from '@modern-js/utils';
|
|
2
|
-
import type { BuildType, Format, Target } from '
|
|
2
|
+
import type { BuildType, Format, Target } from './types';
|
|
3
3
|
export declare const padSpaceWith: (str: string, targetL: number, opts?: {
|
|
4
4
|
endStr?: string | undefined;
|
|
5
5
|
style?: ((s: string) => string) | undefined;
|
package/dist/error.js
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
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
|
+
InternalBuildError: () => InternalBuildError,
|
|
21
|
+
InternalDTSError: () => InternalDTSError,
|
|
22
|
+
ModuleBuildError: () => ModuleBuildError,
|
|
23
|
+
isExecaError: () => isExecaError,
|
|
24
|
+
isInternalError: () => isInternalError,
|
|
25
|
+
padSpaceWith: () => padSpaceWith
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
28
|
+
var import_utils = require("@modern-js/utils");
|
|
29
|
+
const padSpaceWith = (str, targetL, opts = {}) => {
|
|
30
|
+
const { endStr = "|", style } = opts;
|
|
31
|
+
const l = str.length;
|
|
32
|
+
const endStrL = endStr.length;
|
|
33
|
+
const resetL = targetL - l - endStrL;
|
|
34
|
+
if (resetL === 0) {
|
|
35
|
+
return (style ? style(str) : str) + endStr;
|
|
36
|
+
}
|
|
37
|
+
if (resetL > 0) {
|
|
38
|
+
const padStr = str.padEnd(targetL - 1, " ");
|
|
39
|
+
if (style) {
|
|
40
|
+
return style(str) + padStr.replace(str, "") + endStr;
|
|
41
|
+
}
|
|
42
|
+
return padStr + endStr;
|
|
43
|
+
}
|
|
44
|
+
return str;
|
|
45
|
+
};
|
|
46
|
+
class InternalBuildError extends Error {
|
|
47
|
+
constructor(e, opts) {
|
|
48
|
+
super(e.message);
|
|
49
|
+
Error.captureStackTrace(this, this.constructor);
|
|
50
|
+
this.e = e;
|
|
51
|
+
this.buildType = opts.buildType;
|
|
52
|
+
this.target = opts.target;
|
|
53
|
+
this.format = opts.format;
|
|
54
|
+
}
|
|
55
|
+
toString() {
|
|
56
|
+
return this.formatError().join("\n");
|
|
57
|
+
}
|
|
58
|
+
formatError() {
|
|
59
|
+
const msgs = [];
|
|
60
|
+
const { e, buildType, target, format } = this;
|
|
61
|
+
const textL = 25;
|
|
62
|
+
const title = `│ ${padSpaceWith(`${buildType} failed:`, textL - 2, {
|
|
63
|
+
style: import_utils.chalk.red.underline,
|
|
64
|
+
endStr: "│"
|
|
65
|
+
})}`;
|
|
66
|
+
const formatMsg = padSpaceWith(`│ - format is "${format}"`, textL, {
|
|
67
|
+
endStr: "│"
|
|
68
|
+
});
|
|
69
|
+
const targetMsg = padSpaceWith(`│ - target is "${target}"`, textL, {
|
|
70
|
+
endStr: "│"
|
|
71
|
+
});
|
|
72
|
+
const startLine = padSpaceWith("╭".padEnd(textL - 1, "─"), textL, {
|
|
73
|
+
endStr: "╮"
|
|
74
|
+
});
|
|
75
|
+
const endLine = padSpaceWith("╰".padEnd(textL - 1, "─"), textL, {
|
|
76
|
+
endStr: "╯"
|
|
77
|
+
});
|
|
78
|
+
msgs.push(
|
|
79
|
+
startLine,
|
|
80
|
+
title,
|
|
81
|
+
formatMsg,
|
|
82
|
+
targetMsg,
|
|
83
|
+
endLine,
|
|
84
|
+
import_utils.chalk.blue.bold.underline(`
|
|
85
|
+
Detailed Information: `)
|
|
86
|
+
);
|
|
87
|
+
msgs.push(e.toString());
|
|
88
|
+
msgs.push(e.stack || "");
|
|
89
|
+
return msgs;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
class InternalDTSError extends Error {
|
|
93
|
+
constructor(e, opts) {
|
|
94
|
+
super(e.message);
|
|
95
|
+
Error.captureStackTrace(this, this.constructor);
|
|
96
|
+
this.e = e;
|
|
97
|
+
this.buildType = opts.buildType;
|
|
98
|
+
}
|
|
99
|
+
toString() {
|
|
100
|
+
return this.formatError().join("\n");
|
|
101
|
+
}
|
|
102
|
+
formatError() {
|
|
103
|
+
var _a;
|
|
104
|
+
const msgs = [];
|
|
105
|
+
const { e, buildType } = this;
|
|
106
|
+
msgs.push(import_utils.chalk.red.bold(`${buildType} DTS failed:`));
|
|
107
|
+
if (isExecaError(e)) {
|
|
108
|
+
if (e.stack) {
|
|
109
|
+
msgs.push((_a = e.stack) == null ? void 0 : _a.replace(`${e.name}: ${e.shortMessage}`, ""));
|
|
110
|
+
}
|
|
111
|
+
} else {
|
|
112
|
+
msgs.push(e.stack);
|
|
113
|
+
}
|
|
114
|
+
return msgs;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
class ModuleBuildError extends Error {
|
|
118
|
+
constructor(e) {
|
|
119
|
+
super(`
|
|
120
|
+
|
|
121
|
+
${e}`);
|
|
122
|
+
Error.captureStackTrace(this, this.constructor);
|
|
123
|
+
this.name = "ModuleBuildError";
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
const isInternalError = (e) => {
|
|
127
|
+
if (e instanceof InternalBuildError || e instanceof InternalDTSError) {
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
return false;
|
|
131
|
+
};
|
|
132
|
+
const isExecaError = (e) => {
|
|
133
|
+
if (e.stdout) {
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
return false;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
//# sourceMappingURL=error.js.map
|