@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,19 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var stdin_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
17
|
+
__reExport(stdin_exports, require("./style"), module.exports);
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;;AAeA;AAAA;AAAA,0BAAc,oBAAd;","names":[],"sources":["../../../src/types/config/index.ts"],"sourcesContent":["import type {\n UserConfig as LibuildUserConfig,\n Asset as LibuildAsset,\n Style as LibuildStyle,\n} from '@modern-js/libuild';\nimport type { DeepPartial } from '../utils';\nimport { BuildInPreset, presetList } from '../../constants/build-presets';\nimport type { CopyConfig } from '../copy';\nimport type {\n LessConfig,\n SassConfig,\n PostCSSConfig,\n TailwindCSSConfig,\n} from './style';\n\nexport * from './style';\n\nexport type BuildType = 'bundleless' | 'bundle';\n\nexport type Format = 'esm' | 'cjs' | 'umd' | 'iife';\n\nexport type Target =\n | 'es5'\n | 'es6'\n | 'es2015'\n | 'es2016'\n | 'es2017'\n | 'es2018'\n | 'es2019'\n | 'es2020'\n | 'es2021'\n | 'es2022'\n // The default target is esnext which means that by default, assume all of the latest JavaScript and CSS features are supported.\n | 'esnext';\n\nexport type Input = Required<LibuildUserConfig>['input'];\n\nexport type DTSOptions = {\n distPath: string;\n tsconfigPath: string;\n only: boolean;\n};\nexport type DTS = false | Partial<DTSOptions>;\n\nexport type SvgrOptions = {\n include: string | RegExp | (string | RegExp)[];\n exclude: string | RegExp | (string | RegExp)[];\n};\n\nexport interface Asset {\n path?: LibuildAsset['outdir'];\n limit?: LibuildAsset['limit'];\n publicPath?: LibuildAsset['publicPath'];\n svgr?: boolean | SvgrOptions;\n}\nexport type SourceMap = Required<LibuildUserConfig>['sourceMap'];\nexport type AutoExternal =\n | boolean\n | {\n dependencies?: boolean;\n peerDependencies?: boolean;\n };\nexport type JSX = 'automatic' | 'transform';\n\nexport type AliasOption =\n | Record<string, string>\n | ((aliases: Record<string, string>) => Record<string, string> | void);\n\nexport type BaseBuildConfig = Omit<\n Required<PartialBaseBuildConfig>,\n 'dts' | 'style' | 'alias'\n> & {\n dts: false | DTSOptions;\n style: Omit<Required<LibuildStyle>, 'cleanCss'> & {\n tailwindCss: TailwindCSSConfig;\n };\n alias: Record<string, string>;\n};\n\nexport type PartialBaseBuildConfig = {\n buildType?: 'bundleless' | 'bundle';\n format?: Format;\n target?: Target;\n dts?: DTS;\n sourceMap?: SourceMap;\n sourceDir?: string;\n copy?: CopyConfig;\n asset?: Asset;\n jsx?: JSX;\n outdir?: string;\n alias?: AliasOption;\n input?: Input;\n platform?: LibuildUserConfig['platform'];\n splitting?: LibuildUserConfig['splitting'];\n minify?: LibuildUserConfig['minify'];\n externals?: LibuildUserConfig['external'];\n autoExternal?: AutoExternal;\n umdGlobals?: LibuildUserConfig['globals'];\n umdModuleName?: ((chunkName: string) => string) | string | undefined;\n define?: LibuildUserConfig['define'];\n style?: StyleConfig;\n};\n\nexport type BuildConfig = BaseBuildConfig | BaseBuildConfig[];\nexport type PartialBuildConfig =\n | PartialBaseBuildConfig\n | PartialBaseBuildConfig[];\n\nexport type BuildPreset =\n | keyof typeof presetList\n | ((options: {\n preset: typeof BuildInPreset;\n }) => PartialBuildConfig | Promise<PartialBuildConfig>);\n\nexport interface StyleConfig {\n less?: LessConfig;\n sass?: SassConfig;\n postcss?: PostCSSConfig;\n autoModules?: LibuildStyle['autoModules'];\n modules?: LibuildStyle['modules'];\n inject?: LibuildStyle['inject'];\n /**\n * The configuration of `tools.tailwindcss` is provided by `tailwindcss` plugin.\n * Please use `yarn new` or `pnpm new` to enable the corresponding capability.\n * @requires `tailwindcss` plugin\n */\n tailwindcss?: TailwindCSSConfig;\n}\n\nexport interface StorybookDevConfig {\n name?: string;\n}\nexport interface Dev {\n storybook: StorybookDevConfig;\n}\n\nexport interface ModuleExtraConfig {\n designSystem?: Record<string, any>;\n\n buildConfig?: PartialBuildConfig;\n\n buildPreset?: BuildPreset;\n\n dev?: DeepPartial<Dev>;\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Style } from '@modern-js/libuild';
|
|
2
|
+
import type { AcceptedPlugin as PostCSSPlugin } from 'postcss';
|
|
3
|
+
export declare type LessOptions = Required<Style>['less'];
|
|
4
|
+
export declare type SassOptions = Required<Style>['sass'];
|
|
5
|
+
export declare type PostcssOptions = Required<Style>['postcss'];
|
|
6
|
+
export declare type LessConfig = LessOptions | ((options: LessOptions) => LessOptions | void);
|
|
7
|
+
export declare type SassConfig = SassOptions | ((options: SassOptions) => SassOptions | void);
|
|
8
|
+
export declare type PostCSSConfigUtils = {
|
|
9
|
+
addPlugins: (plugins: PostCSSPlugin | PostCSSPlugin[]) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare type PostCSSConfig = PostcssOptions | ((options: PostcssOptions, utils: PostCSSConfigUtils) => PostcssOptions | void);
|
|
12
|
+
export declare type TailwindCSSConfig = Record<string, any> | ((options: Record<string, any>) => Record<string, any> | void);
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { globby } from '@modern-js/utils';
|
|
2
|
+
export interface CopyPattern {
|
|
3
|
+
from: string;
|
|
4
|
+
to?: string;
|
|
5
|
+
context?: string;
|
|
6
|
+
globOptions?: globby.GlobbyOptions;
|
|
7
|
+
}
|
|
8
|
+
export interface CopyOptions {
|
|
9
|
+
patterns?: CopyPattern[];
|
|
10
|
+
options?: {
|
|
11
|
+
concurrency?: number;
|
|
12
|
+
enableCopySync?: boolean;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare type CopyConfig = CopyOptions;
|
|
File without changes
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
+
import type { AliasOption } from './config';
|
|
2
|
+
export interface BundlelessGeneratorDtsConfig {
|
|
3
|
+
appDirectory: string;
|
|
4
|
+
distAbsPath: string;
|
|
5
|
+
tsconfigPath: string;
|
|
6
|
+
watch: boolean;
|
|
7
|
+
sourceDir: string;
|
|
8
|
+
alias: AliasOption;
|
|
9
|
+
}
|
|
1
10
|
export interface ITsconfig {
|
|
2
11
|
compilerOptions?: {
|
|
3
12
|
rootDir?: string;
|
|
4
13
|
baseUrl?: string;
|
|
5
14
|
declaration?: boolean;
|
|
6
15
|
emitDeclarationOnly?: boolean;
|
|
16
|
+
emitDecoratorMetadata?: boolean;
|
|
7
17
|
isolatedModules?: boolean;
|
|
8
18
|
allowJs?: boolean;
|
|
9
19
|
outDir?: string;
|
|
@@ -12,6 +22,4 @@ export interface ITsconfig {
|
|
|
12
22
|
include?: string[];
|
|
13
23
|
exclude?: string[];
|
|
14
24
|
extends?: string;
|
|
15
|
-
}
|
|
16
|
-
export declare const readTsConfig: <T extends ITsconfig | null>(tsconfigPath: string, noExistReturn?: T) => ITsconfig | T;
|
|
17
|
-
export declare const existTsConfigFile: (tsconfigAbsolutePath: string) => boolean;
|
|
25
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DevToolData as BaseDevToolData } from '@modern-js/core';
|
|
2
|
+
import { registerHook } from '../hooks';
|
|
3
|
+
import type { BaseBuildConfig, BuildConfig } from './config';
|
|
4
|
+
import type { DevCommandOptions, BuildCommandOptions } from './command';
|
|
5
|
+
export interface BuildTaskResult {
|
|
6
|
+
status: 'success' | 'fail';
|
|
7
|
+
message?: string;
|
|
8
|
+
config: BaseBuildConfig;
|
|
9
|
+
}
|
|
10
|
+
export interface BuildResult {
|
|
11
|
+
status: 'success' | 'fail';
|
|
12
|
+
message?: string;
|
|
13
|
+
config: BuildConfig;
|
|
14
|
+
commandOptions: BuildCommandOptions;
|
|
15
|
+
totalDuration: number;
|
|
16
|
+
}
|
|
17
|
+
export interface BuildPlatformResult {
|
|
18
|
+
status: 'success' | 'fail';
|
|
19
|
+
message: string;
|
|
20
|
+
}
|
|
21
|
+
export declare type DevToolData = BaseDevToolData<DevCommandOptions>;
|
|
22
|
+
export declare type PromptResult = {
|
|
23
|
+
choiceDevTool: string | symbol;
|
|
24
|
+
} & Record<string, any>;
|
|
25
|
+
export declare type ModuleToolsHooks = typeof registerHook;
|
|
File without changes
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
export
|
|
1
|
+
import { NormalizedConfig, UserConfig } from '@modern-js/core';
|
|
2
|
+
import { ModuleToolsHooks } from './hooks';
|
|
3
|
+
import { ModuleExtraConfig } from './config';
|
|
4
|
+
export * from './hooks';
|
|
5
|
+
export * from './command';
|
|
6
|
+
export * from './config';
|
|
7
|
+
export * from './dts';
|
|
8
|
+
export * from './context';
|
|
9
|
+
export type { CliPlugin, IAppContext, PluginAPI } from '@modern-js/core';
|
|
10
|
+
export declare type ModuleTools = {
|
|
11
|
+
hooks: ModuleToolsHooks;
|
|
12
|
+
userConfig: ModuleExtraConfig;
|
|
13
|
+
normalizedConfig: Required<ModuleExtraConfig>;
|
|
14
|
+
};
|
|
15
|
+
export declare type ModuleUserConfig = UserConfig<ModuleTools>;
|
|
16
|
+
export declare type ModuleNormalizedConfig = NormalizedConfig<ModuleTools>;
|
|
17
|
+
export declare type ModuleConfigParams = ModuleUserConfig | Promise<ModuleUserConfig> | ((env: any) => ModuleUserConfig | Promise<ModuleUserConfig>);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var stdin_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
17
|
+
__reExport(stdin_exports, require("./hooks"), module.exports);
|
|
18
|
+
__reExport(stdin_exports, require("./command"), module.exports);
|
|
19
|
+
__reExport(stdin_exports, require("./config"), module.exports);
|
|
20
|
+
__reExport(stdin_exports, require("./dts"), module.exports);
|
|
21
|
+
__reExport(stdin_exports, require("./context"), module.exports);
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;;AAIA;AAAA;AAAA,0BAAc,oBAAd;AACA,0BAAc,sBADd;AAEA,0BAAc,qBAFd;AAGA,0BAAc,kBAHd;AAIA,0BAAc,sBAJd;","names":[],"sources":["../../src/types/index.ts"],"sourcesContent":["import { NormalizedConfig, UserConfig } from '@modern-js/core';\nimport { ModuleToolsHooks } from './hooks';\nimport { ModuleExtraConfig } from './config';\n\nexport * from './hooks';\nexport * from './command';\nexport * from './config';\nexport * from './dts';\nexport * from './context';\nexport type { CliPlugin, IAppContext, PluginAPI } from '@modern-js/core';\n\nexport type ModuleTools = {\n hooks: ModuleToolsHooks;\n userConfig: ModuleExtraConfig;\n normalizedConfig: Required<ModuleExtraConfig>;\n};\n\nexport type ModuleUserConfig = UserConfig<ModuleTools>;\n\nexport type ModuleNormalizedConfig = NormalizedConfig<ModuleTools>;\n\n// params type for defineConfig\nexport type ModuleConfigParams =\n | ModuleUserConfig\n | Promise<ModuleUserConfig>\n | ((env: any) => ModuleUserConfig | Promise<ModuleUserConfig>);\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare type DeepPartial<T> = T extends Function ? T : T extends Array<infer U> ? DeepPartialArray<U> : T extends object ? DeepPartialObject<T> : T | undefined;
|
|
2
|
+
/** @private */
|
|
3
|
+
|
|
4
|
+
export declare type DeepPartialArray<T> = Array<DeepPartial<T>>;
|
|
5
|
+
/** @private */
|
|
6
|
+
|
|
7
|
+
export declare type DeepPartialObject<T> = { [P in keyof T]?: DeepPartial<T[P]> };
|
|
File without changes
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BaseBuildConfig } from '../types/config';
|
|
2
|
+
export declare const getFinalExternals: (config: BaseBuildConfig, options: {
|
|
3
|
+
appDirectory: string;
|
|
4
|
+
}) => Promise<(string | RegExp)[]>;
|
|
5
|
+
export declare const getAllDeps: <T>(appDirectory: string, options?: {
|
|
6
|
+
dependencies?: boolean;
|
|
7
|
+
peerDependencies?: boolean;
|
|
8
|
+
}) => Promise<string[]>;
|
|
@@ -0,0 +1,117 @@
|
|
|
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
|
+
getAllDeps: () => getAllDeps,
|
|
27
|
+
getFinalExternals: () => getFinalExternals
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
30
|
+
var import_path = __toESM(require("path"));
|
|
31
|
+
var __create2 = Object.create;
|
|
32
|
+
var __defProp2 = Object.defineProperty;
|
|
33
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
34
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
35
|
+
var __getProtoOf2 = Object.getPrototypeOf;
|
|
36
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
37
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
38
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
39
|
+
for (let key of __getOwnPropNames2(from))
|
|
40
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
41
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
42
|
+
}
|
|
43
|
+
return to;
|
|
44
|
+
};
|
|
45
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
46
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
47
|
+
mod
|
|
48
|
+
));
|
|
49
|
+
var __async = (__this, __arguments, generator) => {
|
|
50
|
+
return new Promise((resolve, reject) => {
|
|
51
|
+
var fulfilled = (value) => {
|
|
52
|
+
try {
|
|
53
|
+
step(generator.next(value));
|
|
54
|
+
} catch (e) {
|
|
55
|
+
reject(e);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
var rejected = (value) => {
|
|
59
|
+
try {
|
|
60
|
+
step(generator.throw(value));
|
|
61
|
+
} catch (e) {
|
|
62
|
+
reject(e);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
66
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
const getFinalExternals = (config, options) => __async(void 0, null, function* () {
|
|
70
|
+
const { autoExternal, externals } = config;
|
|
71
|
+
const { appDirectory } = options;
|
|
72
|
+
if (typeof autoExternal === "boolean") {
|
|
73
|
+
if (!autoExternal) {
|
|
74
|
+
return externals || [];
|
|
75
|
+
}
|
|
76
|
+
const deps2 = yield getAllDeps(appDirectory, {
|
|
77
|
+
dependencies: true,
|
|
78
|
+
peerDependencies: true
|
|
79
|
+
});
|
|
80
|
+
return [
|
|
81
|
+
...deps2.map((dep) => new RegExp(`^${dep}($|\\/|\\\\)`)),
|
|
82
|
+
...externals || []
|
|
83
|
+
];
|
|
84
|
+
}
|
|
85
|
+
const deps = yield getAllDeps(appDirectory, autoExternal);
|
|
86
|
+
return [
|
|
87
|
+
...deps.map((dep) => new RegExp(`^${dep}($|\\/|\\\\)`)),
|
|
88
|
+
...externals || []
|
|
89
|
+
];
|
|
90
|
+
});
|
|
91
|
+
const getAllDeps = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (appDirectory, options = {}) {
|
|
92
|
+
const { fs } = yield Promise.resolve().then(() => __toESM2(require("@modern-js/utils")));
|
|
93
|
+
try {
|
|
94
|
+
const json = JSON.parse(
|
|
95
|
+
fs.readFileSync(import_path.default.resolve(appDirectory, "./package.json"), "utf8")
|
|
96
|
+
);
|
|
97
|
+
let deps = [];
|
|
98
|
+
if (options.dependencies) {
|
|
99
|
+
deps = [
|
|
100
|
+
...deps,
|
|
101
|
+
...Object.keys(json.dependencies || {})
|
|
102
|
+
];
|
|
103
|
+
}
|
|
104
|
+
if (options.peerDependencies) {
|
|
105
|
+
deps = [
|
|
106
|
+
...deps,
|
|
107
|
+
...Object.keys(json.peerDependencies || {})
|
|
108
|
+
];
|
|
109
|
+
}
|
|
110
|
+
return deps;
|
|
111
|
+
} catch (e) {
|
|
112
|
+
console.warn("[WARN] package.json is broken");
|
|
113
|
+
return [];
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
//# sourceMappingURL=builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGV,MAAM,oBAAoB,CAC/B,QACA,YACG;AACH,QAAM,EAAE,cAAc,UAAU,IAAI;AACpC,QAAM,EAAE,aAAa,IAAI;AAEzB,MAAI,OAAO,iBAAiB,WAAW;AACrC,QAAI,CAAC,cAAc;AACjB,aAAO,aAAa,CAAC;AAAA,IACvB;AAEA,UAAMA,QAAO,MAAM,WAAW,cAAc;AAAA,MAC1C,cAAc;AAAA,MACd,kBAAkB;AAAA,IACpB,CAAC;AACD,WAAO;AAAA,MACL,GAAGA,MAAK,IAAI,SAAO,IAAI,OAAO,IAAI,iBAAiB,CAAC;AAAA,MACpD,GAAI,aAAa,CAAC;AAAA,IACpB;AAAA,EACF;AAEA,QAAM,OAAO,MAAM,WAAW,cAAc,YAAY;AACxD,SAAO;AAAA,IACL,GAAG,KAAK,IAAI,SAAO,IAAI,OAAO,IAAI,iBAAiB,CAAC;AAAA,IACpD,GAAI,aAAa,CAAC;AAAA,EACpB;AACF;AAEO,MAAM,aAAa,CACxB,OAKG,wBALH,IAKG,mBALH,cACA,UAGI,CAAC,GACF;AACH,QAAM,EAAE,GAAG,IAAI,MAAM,8CAAO;AAC5B,MAAI;AACF,UAAM,OAAO,KAAK;AAAA,MAChB,GAAG,aAAa,oBAAK,QAAQ,cAAc,gBAAgB,GAAG,MAAM;AAAA,IACtE;AAEA,QAAI,OAAiB,CAAC;AAEtB,QAAI,QAAQ,cAAc;AACxB,aAAO;AAAA,QACL,GAAG;AAAA,QACH,GAAG,OAAO,KAAM,KAAK,gBAAkC,CAAC,CAAC;AAAA,MAC3D;AAAA,IACF;AAEA,QAAI,QAAQ,kBAAkB;AAC5B,aAAO;AAAA,QACL,GAAG;AAAA,QACH,GAAG,OAAO,KAAM,KAAK,oBAAsC,CAAC,CAAC;AAAA,MAC/D;AAAA,IACF;AAEA,WAAO;AAAA,EACT,SAAS,GAAT;AACE,YAAQ,KAAK,+BAA+B;AAC5C,WAAO,CAAC;AAAA,EACV;AACF;","names":["deps"],"sources":["../../src/utils/builder.ts"],"sourcesContent":["import path from 'path';\nimport type { BaseBuildConfig } from '../types/config';\n\nexport const getFinalExternals = async (\n config: BaseBuildConfig,\n options: { appDirectory: string },\n) => {\n const { autoExternal, externals } = config;\n const { appDirectory } = options;\n\n if (typeof autoExternal === 'boolean') {\n if (!autoExternal) {\n return externals || [];\n }\n\n const deps = await getAllDeps(appDirectory, {\n dependencies: true,\n peerDependencies: true,\n });\n return [\n ...deps.map(dep => new RegExp(`^${dep}($|\\\\/|\\\\\\\\)`)),\n ...(externals || []),\n ];\n }\n\n const deps = await getAllDeps(appDirectory, autoExternal);\n return [\n ...deps.map(dep => new RegExp(`^${dep}($|\\\\/|\\\\\\\\)`)),\n ...(externals || []),\n ];\n};\n\nexport const getAllDeps = async <T>(\n appDirectory: string,\n options: {\n dependencies?: boolean;\n peerDependencies?: boolean;\n } = {},\n) => {\n const { fs } = await import('@modern-js/utils');\n try {\n const json = JSON.parse(\n fs.readFileSync(path.resolve(appDirectory, './package.json'), 'utf8'),\n );\n\n let deps: string[] = [];\n\n if (options.dependencies) {\n deps = [\n ...deps,\n ...Object.keys((json.dependencies as T | undefined) || {}),\n ];\n }\n\n if (options.peerDependencies) {\n deps = [\n ...deps,\n ...Object.keys((json.peerDependencies as T | undefined) || {}),\n ];\n }\n\n return deps;\n } catch (e) {\n console.warn('[WARN] package.json is broken');\n return [];\n }\n};\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ModuleContext } from '../types';
|
|
2
|
+
import type { BaseBuildConfig, PartialBuildConfig, PartialBaseBuildConfig, DTSOptions } from '../types/config';
|
|
3
|
+
export declare const validPartialBuildConfig: (config: PartialBuildConfig) => void;
|
|
4
|
+
export declare const validBuildTypeAndFormat: (config: PartialBaseBuildConfig) => void;
|
|
5
|
+
export declare const mergeDefaultBaseConfig: (pConfig: PartialBaseBuildConfig, context: ModuleContext) => Promise<BaseBuildConfig>;
|
|
6
|
+
export declare const getDtsConfig: (userDTS: PartialBaseBuildConfig['dts'], defaultDTS: Required<DTSOptions>) => Promise<false | Required<DTSOptions>>;
|
|
@@ -0,0 +1,172 @@
|
|
|
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
|
+
getDtsConfig: () => getDtsConfig,
|
|
21
|
+
mergeDefaultBaseConfig: () => mergeDefaultBaseConfig,
|
|
22
|
+
validBuildTypeAndFormat: () => validBuildTypeAndFormat,
|
|
23
|
+
validPartialBuildConfig: () => validPartialBuildConfig
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
26
|
+
var __create = Object.create;
|
|
27
|
+
var __defProp2 = Object.defineProperty;
|
|
28
|
+
var __defProps = Object.defineProperties;
|
|
29
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
30
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
31
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
32
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
33
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
34
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
35
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
36
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
37
|
+
var __spreadValues = (a, b) => {
|
|
38
|
+
for (var prop in b || (b = {}))
|
|
39
|
+
if (__hasOwnProp2.call(b, prop))
|
|
40
|
+
__defNormalProp(a, prop, b[prop]);
|
|
41
|
+
if (__getOwnPropSymbols)
|
|
42
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
43
|
+
if (__propIsEnum.call(b, prop))
|
|
44
|
+
__defNormalProp(a, prop, b[prop]);
|
|
45
|
+
}
|
|
46
|
+
return a;
|
|
47
|
+
};
|
|
48
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
49
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
50
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
51
|
+
for (let key of __getOwnPropNames2(from))
|
|
52
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
53
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
54
|
+
}
|
|
55
|
+
return to;
|
|
56
|
+
};
|
|
57
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps2(
|
|
58
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
59
|
+
mod
|
|
60
|
+
));
|
|
61
|
+
var __async = (__this, __arguments, generator) => {
|
|
62
|
+
return new Promise((resolve, reject) => {
|
|
63
|
+
var fulfilled = (value) => {
|
|
64
|
+
try {
|
|
65
|
+
step(generator.next(value));
|
|
66
|
+
} catch (e) {
|
|
67
|
+
reject(e);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
var rejected = (value) => {
|
|
71
|
+
try {
|
|
72
|
+
step(generator.throw(value));
|
|
73
|
+
} catch (e) {
|
|
74
|
+
reject(e);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
78
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
const validPartialBuildConfig = (config) => {
|
|
82
|
+
if (Array.isArray(config)) {
|
|
83
|
+
for (const c of config) {
|
|
84
|
+
validBuildTypeAndFormat(c);
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
validBuildTypeAndFormat(config);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const validBuildTypeAndFormat = (config) => {
|
|
91
|
+
var _a;
|
|
92
|
+
if (config.buildType === "bundleless" && ["iife", "umd"].includes((_a = config.format) != null ? _a : "")) {
|
|
93
|
+
throw new Error(
|
|
94
|
+
`when buildType is bundleless, the format must be equal to one of the allowed values: (cjs, esm)`
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const mergeDefaultBaseConfig = (pConfig, context) => __async(void 0, null, function* () {
|
|
99
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
100
|
+
const { defaultBuildConfig: defaultConfig } = yield Promise.resolve().then(() => __toESM(require("../constants/build")));
|
|
101
|
+
const { cloneDeep } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils/lodash")));
|
|
102
|
+
const { applyOptionsChain, ensureAbsolutePath, slash } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
103
|
+
const { getDefaultIndexEntry } = yield Promise.resolve().then(() => __toESM(require("./input")));
|
|
104
|
+
const { getStyleConfig } = yield Promise.resolve().then(() => __toESM(require("./style")));
|
|
105
|
+
const defaultAlias = {
|
|
106
|
+
"@": context.srcDirectory
|
|
107
|
+
};
|
|
108
|
+
const mergedAlias = applyOptionsChain(defaultAlias, pConfig.alias);
|
|
109
|
+
const alias = Object.keys(mergedAlias).reduce(
|
|
110
|
+
(prev, name) => {
|
|
111
|
+
const formattedValue = (value2) => {
|
|
112
|
+
if (typeof value2 === "string" && value2.startsWith(".")) {
|
|
113
|
+
return slash(ensureAbsolutePath(context.appDirectory, value2));
|
|
114
|
+
}
|
|
115
|
+
return value2;
|
|
116
|
+
};
|
|
117
|
+
const value = formattedValue(mergedAlias[name]);
|
|
118
|
+
prev[name] = value;
|
|
119
|
+
return prev;
|
|
120
|
+
},
|
|
121
|
+
{}
|
|
122
|
+
);
|
|
123
|
+
const styleConfig = yield getStyleConfig(pConfig);
|
|
124
|
+
const buildType = (_a = pConfig.buildType) != null ? _a : defaultConfig.buildType;
|
|
125
|
+
const sourceDir = (_b = pConfig.sourceDir) != null ? _b : defaultConfig.sourceDir;
|
|
126
|
+
const input = buildType === "bundle" ? yield getDefaultIndexEntry(context) : [sourceDir];
|
|
127
|
+
const userDefine = (_c = pConfig.define) != null ? _c : {};
|
|
128
|
+
const define = __spreadValues(__spreadValues({}, defaultConfig.define), Object.keys(userDefine).reduce((memo, name) => {
|
|
129
|
+
memo[name] = JSON.stringify(userDefine[name]);
|
|
130
|
+
return memo;
|
|
131
|
+
}, {}));
|
|
132
|
+
return {
|
|
133
|
+
asset: __spreadValues(__spreadValues({}, defaultConfig.asset), pConfig.asset),
|
|
134
|
+
buildType,
|
|
135
|
+
format: (_d = pConfig.format) != null ? _d : defaultConfig.format,
|
|
136
|
+
target: (_e = pConfig.target) != null ? _e : defaultConfig.target,
|
|
137
|
+
sourceMap: (_f = pConfig.sourceMap) != null ? _f : defaultConfig.sourceMap,
|
|
138
|
+
copy: (_g = pConfig.copy) != null ? _g : cloneDeep(defaultConfig.copy),
|
|
139
|
+
outdir: (_h = pConfig.outdir) != null ? _h : defaultConfig.outdir,
|
|
140
|
+
dts: yield getDtsConfig(pConfig.dts, defaultConfig.dts),
|
|
141
|
+
jsx: (_i = pConfig.jsx) != null ? _i : defaultConfig.jsx,
|
|
142
|
+
input: (_j = pConfig.input) != null ? _j : cloneDeep(input),
|
|
143
|
+
platform: (_k = pConfig.platform) != null ? _k : defaultConfig.platform,
|
|
144
|
+
splitting: (_l = pConfig.splitting) != null ? _l : defaultConfig.splitting,
|
|
145
|
+
minify: (_m = pConfig.minify) != null ? _m : defaultConfig.minify,
|
|
146
|
+
autoExternal: (_n = pConfig.autoExternal) != null ? _n : defaultConfig.autoExternal,
|
|
147
|
+
umdGlobals: __spreadValues(__spreadValues({}, defaultConfig.umdGlobals), pConfig.umdGlobals),
|
|
148
|
+
umdModuleName: (_o = pConfig.umdModuleName) != null ? _o : defaultConfig.umdModuleName,
|
|
149
|
+
externals: (_p = pConfig.externals) != null ? _p : defaultConfig.externals,
|
|
150
|
+
sourceDir,
|
|
151
|
+
alias,
|
|
152
|
+
define,
|
|
153
|
+
style: __spreadProps(__spreadValues({}, styleConfig), {
|
|
154
|
+
inject: (_r = (_q = pConfig.style) == null ? void 0 : _q.inject) != null ? _r : defaultConfig.style.inject,
|
|
155
|
+
modules: (_t = (_s = pConfig.style) == null ? void 0 : _s.modules) != null ? _t : defaultConfig.style.modules,
|
|
156
|
+
autoModules: (_v = (_u = pConfig.style) == null ? void 0 : _u.autoModules) != null ? _v : defaultConfig.style.autoModules,
|
|
157
|
+
tailwindCss: defaultConfig.style.tailwindCss
|
|
158
|
+
})
|
|
159
|
+
};
|
|
160
|
+
});
|
|
161
|
+
const getDtsConfig = (userDTS, defaultDTS) => __async(void 0, null, function* () {
|
|
162
|
+
const { cloneDeep, isUndefined, isObject } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils/lodash")));
|
|
163
|
+
if (isUndefined(userDTS)) {
|
|
164
|
+
return cloneDeep(defaultDTS);
|
|
165
|
+
}
|
|
166
|
+
if (isObject(userDTS)) {
|
|
167
|
+
return __spreadValues(__spreadValues({}, defaultDTS), userDTS);
|
|
168
|
+
}
|
|
169
|
+
return userDTS;
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQO,MAAM,0BAA0B,CAAC,WAA+B;AACrE,MAAI,MAAM,QAAQ,MAAM,GAAG;AACzB,eAAW,KAAK,QAAQ;AACtB,8BAAwB,CAAC;AAAA,IAC3B;AAAA,EACF,OAAO;AACL,4BAAwB,MAAM;AAAA,EAChC;AACF;AAEO,MAAM,0BAA0B,CAAC,WAAmC;AAlB3E;AAmBE,MACE,OAAO,cAAc,gBACrB,CAAC,QAAQ,KAAK,EAAE,UAAS,YAAO,WAAP,YAAiB,EAAE,GAC5C;AACA,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACF;AAEO,MAAM,yBAAyB,CACpC,SACA,YAC6B;AAhC/B;AAiCE,QAAM,EAAE,oBAAoB,cAAc,IAAI,MAAM,6CAClD;AAEF,QAAM,EAAE,UAAU,IAAI,MAAM,6CAAO;AACnC,QAAM,EAAE,mBAAmB,oBAAoB,MAAM,IAAI,MAAM,6CAC7D;AAEF,QAAM,EAAE,qBAAqB,IAAI,MAAM,6CAAO;AAC9C,QAAM,EAAE,eAAe,IAAI,MAAM,6CAAO;AACxC,QAAM,eAAe;AAAA,IACnB,KAAK,QAAQ;AAAA,EACf;AACA,QAAM,cAAc,kBAAkB,cAAc,QAAQ,KAAK;AAOjE,QAAM,QAAQ,OAAO,KAAK,WAAW,EAAE;AAAA,IACrC,CAAC,MAAM,SAAS;AACd,YAAM,iBAAiB,CAACA,WAAkB;AACxC,YAAI,OAAOA,WAAU,YAAYA,OAAM,WAAW,GAAG,GAAG;AACtD,iBAAO,MAAM,mBAAmB,QAAQ,cAAcA,MAAK,CAAC;AAAA,QAC9D;AACA,eAAOA;AAAAA,MACT;AACA,YAAM,QAAQ,eAAe,YAAY,KAAK;AAE9C,WAAK,QAAQ;AACb,aAAO;AAAA,IACT;AAAA,IACA,CAAC;AAAA,EACH;AAEA,QAAM,cAAc,MAAM,eAAe,OAAO;AAChD,QAAM,aAAY,aAAQ,cAAR,YAAqB,cAAc;AACrD,QAAM,aAAY,aAAQ,cAAR,YAAqB,cAAc;AACrD,QAAM,QACJ,cAAc,WAAW,MAAM,qBAAqB,OAAO,IAAI,CAAC,SAAS;AAC3E,QAAM,cAAa,aAAQ,WAAR,YAAkB,CAAC;AACtC,QAAM,SAAS,kCACV,cAAc,SACd,OAAO,KAAK,UAAU,EAAE,OAA+B,CAAC,MAAM,SAAS;AACxE,SAAK,QAAQ,KAAK,UAAU,WAAW,KAAM;AAC7C,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AAEP,SAAO;AAAA,IACL,OAAO,kCACF,cAAc,QACd,QAAQ;AAAA,IAEb;AAAA,IACA,SAAQ,aAAQ,WAAR,YAAkB,cAAc;AAAA,IACxC,SAAQ,aAAQ,WAAR,YAAkB,cAAc;AAAA,IACxC,YAAW,aAAQ,cAAR,YAAqB,cAAc;AAAA,IAC9C,OAAM,aAAQ,SAAR,YAAgB,UAAU,cAAc,IAAI;AAAA,IAClD,SAAQ,aAAQ,WAAR,YAAkB,cAAc;AAAA,IACxC,KAAK,MAAM,aAAa,QAAQ,KAAK,cAAc,GAAiB;AAAA,IACpE,MAAK,aAAQ,QAAR,YAAe,cAAc;AAAA,IAClC,QAAO,aAAQ,UAAR,YAAiB,UAAU,KAAK;AAAA,IACvC,WAAU,aAAQ,aAAR,YAAoB,cAAc;AAAA,IAC5C,YAAW,aAAQ,cAAR,YAAqB,cAAc;AAAA,IAC9C,SAAQ,aAAQ,WAAR,YAAkB,cAAc;AAAA,IACxC,eAAc,aAAQ,iBAAR,YAAwB,cAAc;AAAA,IACpD,YAAY,kCACP,cAAc,aACd,QAAQ;AAAA,IAEb,gBAAe,aAAQ,kBAAR,YAAyB,cAAc;AAAA,IACtD,YAAW,aAAQ,cAAR,YAAqB,cAAc;AAAA,IAC9C;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,iCACF,cADE;AAAA,MAEL,SAAQ,mBAAQ,UAAR,mBAAe,WAAf,YAAyB,cAAc,MAAM;AAAA,MACrD,UAAS,mBAAQ,UAAR,mBAAe,YAAf,YAA0B,cAAc,MAAM;AAAA,MACvD,cACE,mBAAQ,UAAR,mBAAe,gBAAf,YAA8B,cAAc,MAAM;AAAA,MACpD,aAAa,cAAc,MAAM;AAAA,IACnC;AAAA,EACF;AACF;AAEO,MAAM,eAAe,CAC1B,SACA,eACG;AACH,QAAM,EAAE,WAAW,aAAa,SAAS,IAAI,MAAM,6CACjD;AAGF,MAAI,YAAY,OAAO,GAAG;AACxB,WAAO,UAAU,UAAU;AAAA,EAC7B;AAEA,MAAI,SAAS,OAAO,GAAG;AACrB,WAAO,kCACF,aACA;AAAA,EAEP;AAEA,SAAO;AACT;","names":["value"],"sources":["../../src/utils/config.ts"],"sourcesContent":["import { ModuleContext } from '../types';\nimport type {\n BaseBuildConfig,\n PartialBuildConfig,\n PartialBaseBuildConfig,\n DTSOptions,\n} from '../types/config';\n\nexport const validPartialBuildConfig = (config: PartialBuildConfig) => {\n if (Array.isArray(config)) {\n for (const c of config) {\n validBuildTypeAndFormat(c);\n }\n } else {\n validBuildTypeAndFormat(config);\n }\n};\n\nexport const validBuildTypeAndFormat = (config: PartialBaseBuildConfig) => {\n if (\n config.buildType === 'bundleless' &&\n ['iife', 'umd'].includes(config.format ?? '')\n ) {\n throw new Error(\n `when buildType is bundleless, the format must be equal to one of the allowed values: (cjs, esm)`,\n );\n }\n};\n\nexport const mergeDefaultBaseConfig = async (\n pConfig: PartialBaseBuildConfig,\n context: ModuleContext,\n): Promise<BaseBuildConfig> => {\n const { defaultBuildConfig: defaultConfig } = await import(\n '../constants/build'\n );\n const { cloneDeep } = await import('@modern-js/utils/lodash');\n const { applyOptionsChain, ensureAbsolutePath, slash } = await import(\n '@modern-js/utils'\n );\n const { getDefaultIndexEntry } = await import('./input');\n const { getStyleConfig } = await import('./style');\n const defaultAlias = {\n '@': context.srcDirectory,\n };\n const mergedAlias = applyOptionsChain(defaultAlias, pConfig.alias);\n\n /**\n * Format alias value:\n * - Relative paths need to be turned into absolute paths.\n * - Absolute paths or a package name are not processed.\n */\n const alias = Object.keys(mergedAlias).reduce<Record<string, string>>(\n (prev, name) => {\n const formattedValue = (value: string) => {\n if (typeof value === 'string' && value.startsWith('.')) {\n return slash(ensureAbsolutePath(context.appDirectory, value));\n }\n return value;\n };\n const value = formattedValue(mergedAlias[name]);\n\n prev[name] = value;\n return prev;\n },\n {},\n );\n\n const styleConfig = await getStyleConfig(pConfig);\n const buildType = pConfig.buildType ?? defaultConfig.buildType;\n const sourceDir = pConfig.sourceDir ?? defaultConfig.sourceDir;\n const input =\n buildType === 'bundle' ? await getDefaultIndexEntry(context) : [sourceDir];\n const userDefine = pConfig.define ?? {};\n const define = {\n ...defaultConfig.define,\n ...Object.keys(userDefine).reduce<Record<string, string>>((memo, name) => {\n memo[name] = JSON.stringify(userDefine[name]!);\n return memo;\n }, {}),\n };\n return {\n asset: {\n ...defaultConfig.asset,\n ...pConfig.asset,\n },\n buildType,\n format: pConfig.format ?? defaultConfig.format,\n target: pConfig.target ?? defaultConfig.target,\n sourceMap: pConfig.sourceMap ?? defaultConfig.sourceMap,\n copy: pConfig.copy ?? cloneDeep(defaultConfig.copy),\n outdir: pConfig.outdir ?? defaultConfig.outdir,\n dts: await getDtsConfig(pConfig.dts, defaultConfig.dts as DTSOptions),\n jsx: pConfig.jsx ?? defaultConfig.jsx,\n input: pConfig.input ?? cloneDeep(input),\n platform: pConfig.platform ?? defaultConfig.platform,\n splitting: pConfig.splitting ?? defaultConfig.splitting,\n minify: pConfig.minify ?? defaultConfig.minify,\n autoExternal: pConfig.autoExternal ?? defaultConfig.autoExternal,\n umdGlobals: {\n ...defaultConfig.umdGlobals,\n ...pConfig.umdGlobals,\n },\n umdModuleName: pConfig.umdModuleName ?? defaultConfig.umdModuleName,\n externals: pConfig.externals ?? defaultConfig.externals,\n sourceDir,\n alias,\n define,\n style: {\n ...styleConfig,\n inject: pConfig.style?.inject ?? defaultConfig.style.inject,\n modules: pConfig.style?.modules ?? defaultConfig.style.modules,\n autoModules:\n pConfig.style?.autoModules ?? defaultConfig.style.autoModules,\n tailwindCss: defaultConfig.style.tailwindCss,\n },\n };\n};\n\nexport const getDtsConfig = async (\n userDTS: PartialBaseBuildConfig['dts'],\n defaultDTS: Required<DTSOptions>,\n) => {\n const { cloneDeep, isUndefined, isObject } = await import(\n '@modern-js/utils/lodash'\n );\n\n if (isUndefined(userDTS)) {\n return cloneDeep(defaultDTS);\n }\n\n if (isObject(userDTS)) {\n return {\n ...defaultDTS,\n ...userDTS,\n };\n }\n\n return userDTS;\n};\n"]}
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
initModuleContext: () => initModuleContext
|
|
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 initModuleContext = (api) => __async(void 0, null, function* () {
|
|
62
|
+
const { isTypescript } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
63
|
+
const { appDirectory, srcDirectory } = api.useAppContext();
|
|
64
|
+
const isTsProject = isTypescript(appDirectory);
|
|
65
|
+
return { isTsProject, appDirectory, srcDirectory };
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,MAAM,oBAAoB,CAAO,QAAgC;AACtE,QAAM,EAAE,aAAa,IAAI,MAAM,6CAAO;AACtC,QAAM,EAAE,cAAc,aAAa,IAAI,IAAI,cAAc;AACzD,QAAM,cAAc,aAAa,YAAY;AAE7C,SAAO,EAAE,aAAa,cAAc,aAAa;AACnD;","names":[],"sources":["../../src/utils/context.ts"],"sourcesContent":["import type { PluginAPI } from '@modern-js/core';\nimport type { ModuleTools } from '../types';\n\nexport const initModuleContext = async (api: PluginAPI<ModuleTools>) => {\n const { isTypescript } = await import('@modern-js/utils');\n const { appDirectory, srcDirectory } = api.useAppContext();\n const isTsProject = isTypescript(appDirectory);\n\n return { isTsProject, appDirectory, srcDirectory };\n};\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ITsconfig, BundlelessGeneratorDtsConfig, BuildCommandOptions, BaseBuildConfig } from '../types';
|
|
2
|
+
export declare const generatorTsConfig: (projectTsconfig: ITsconfig, config: BundlelessGeneratorDtsConfig) => Promise<{
|
|
3
|
+
tempTsconfigPath: string;
|
|
4
|
+
tempDistAbsRootPath: string;
|
|
5
|
+
tempDistAbsSrcPath: string;
|
|
6
|
+
}>;
|
|
7
|
+
export declare const getTscBinPath: (appDirectory: string) => Promise<string>;
|
|
8
|
+
export declare const resolveAlias: (config: BundlelessGeneratorDtsConfig, options: {
|
|
9
|
+
userTsconfig: ITsconfig;
|
|
10
|
+
tempTsconfigPath: string;
|
|
11
|
+
tempDistAbsRootPath: string;
|
|
12
|
+
tempDistAbsSrcPath: string;
|
|
13
|
+
}, watchFilenames?: string[]) => Promise<void>;
|
|
14
|
+
export declare const assignTsConfigPath: (config: BaseBuildConfig, options: BuildCommandOptions) => Promise<BaseBuildConfig>;
|