@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,23 @@
|
|
|
1
|
+
import type { BuildCommandOptions, BaseBuildConfig, ModuleTools, PluginAPI, DTSOptions, ModuleContext } from '../types';
|
|
2
|
+
export declare const runBuildTask: (options: {
|
|
3
|
+
buildConfig: BaseBuildConfig;
|
|
4
|
+
buildCmdOptions: BuildCommandOptions;
|
|
5
|
+
context: ModuleContext;
|
|
6
|
+
}, api: PluginAPI<ModuleTools>) => Promise<void>;
|
|
7
|
+
export declare const buildInTsProject: (options: {
|
|
8
|
+
buildConfig: BaseBuildConfig;
|
|
9
|
+
buildCmdOptions: BuildCommandOptions;
|
|
10
|
+
context: ModuleContext;
|
|
11
|
+
}, api: PluginAPI<ModuleTools>) => Promise<void>;
|
|
12
|
+
export declare const buildInJsProject: (options: {
|
|
13
|
+
buildConfig: BaseBuildConfig;
|
|
14
|
+
buildCmdOptions: BuildCommandOptions;
|
|
15
|
+
context: ModuleContext;
|
|
16
|
+
}, api: PluginAPI<ModuleTools>) => Promise<void>;
|
|
17
|
+
export declare const generatorDts: (config: BaseBuildConfig, api: PluginAPI, options: {
|
|
18
|
+
watch: boolean;
|
|
19
|
+
dts: DTSOptions;
|
|
20
|
+
}) => Promise<void>;
|
|
21
|
+
export declare const buildLib: (config: BaseBuildConfig, api: PluginAPI<ModuleTools>, options: {
|
|
22
|
+
watch: boolean;
|
|
23
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,265 @@
|
|
|
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
|
+
buildInJsProject: () => buildInJsProject,
|
|
21
|
+
buildInTsProject: () => buildInTsProject,
|
|
22
|
+
buildLib: () => buildLib,
|
|
23
|
+
generatorDts: () => generatorDts,
|
|
24
|
+
runBuildTask: () => runBuildTask
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
27
|
+
var __create = Object.create;
|
|
28
|
+
var __defProp2 = Object.defineProperty;
|
|
29
|
+
var __defProps = Object.defineProperties;
|
|
30
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
31
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
32
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
33
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
34
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
35
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
36
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
37
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
38
|
+
var __spreadValues = (a, b) => {
|
|
39
|
+
for (var prop in b || (b = {}))
|
|
40
|
+
if (__hasOwnProp2.call(b, prop))
|
|
41
|
+
__defNormalProp(a, prop, b[prop]);
|
|
42
|
+
if (__getOwnPropSymbols)
|
|
43
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
44
|
+
if (__propIsEnum.call(b, prop))
|
|
45
|
+
__defNormalProp(a, prop, b[prop]);
|
|
46
|
+
}
|
|
47
|
+
return a;
|
|
48
|
+
};
|
|
49
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
50
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
51
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
52
|
+
for (let key of __getOwnPropNames2(from))
|
|
53
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
54
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
55
|
+
}
|
|
56
|
+
return to;
|
|
57
|
+
};
|
|
58
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps2(
|
|
59
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
60
|
+
mod
|
|
61
|
+
));
|
|
62
|
+
var __async = (__this, __arguments, generator) => {
|
|
63
|
+
return new Promise((resolve, reject) => {
|
|
64
|
+
var fulfilled = (value) => {
|
|
65
|
+
try {
|
|
66
|
+
step(generator.next(value));
|
|
67
|
+
} catch (e) {
|
|
68
|
+
reject(e);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
var rejected = (value) => {
|
|
72
|
+
try {
|
|
73
|
+
step(generator.throw(value));
|
|
74
|
+
} catch (e) {
|
|
75
|
+
reject(e);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
79
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
const runBuildTask = (options, api) => __async(void 0, null, function* () {
|
|
83
|
+
const { buildConfig, context } = options;
|
|
84
|
+
const { appDirectory, isTsProject } = context;
|
|
85
|
+
if (isTsProject) {
|
|
86
|
+
yield buildInTsProject(options, api);
|
|
87
|
+
} else {
|
|
88
|
+
yield buildInJsProject(options, api);
|
|
89
|
+
}
|
|
90
|
+
const { copyTask } = yield Promise.resolve().then(() => __toESM(require("./copy")));
|
|
91
|
+
yield copyTask(buildConfig, { appDirectory });
|
|
92
|
+
});
|
|
93
|
+
const buildInTsProject = (options, api) => __async(void 0, null, function* () {
|
|
94
|
+
var _a;
|
|
95
|
+
const { buildConfig, buildCmdOptions } = options;
|
|
96
|
+
const dts = buildCmdOptions.dts ? buildConfig.dts : false;
|
|
97
|
+
const skipBuildLib = buildConfig.dts ? buildConfig.dts.only : false;
|
|
98
|
+
const watch = (_a = buildCmdOptions.watch) != null ? _a : false;
|
|
99
|
+
if (dts === false) {
|
|
100
|
+
!skipBuildLib && (yield buildLib(buildConfig, api, { watch }));
|
|
101
|
+
} else {
|
|
102
|
+
const tasks = dts.only ? [generatorDts] : [buildLib, generatorDts];
|
|
103
|
+
const { default: pMap } = yield Promise.resolve().then(() => __toESM(require("../../compiled/p-map")));
|
|
104
|
+
yield pMap(tasks, (task) => __async(void 0, null, function* () {
|
|
105
|
+
yield task(buildConfig, api, { watch, dts });
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
const buildInJsProject = (options, api) => __async(void 0, null, function* () {
|
|
110
|
+
var _a;
|
|
111
|
+
const { buildConfig, buildCmdOptions } = options;
|
|
112
|
+
const dts = buildCmdOptions.dts ? buildConfig.dts : false;
|
|
113
|
+
const watch = (_a = buildCmdOptions.watch) != null ? _a : false;
|
|
114
|
+
if (dts !== false && dts.only) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
yield buildLib(buildConfig, api, { watch });
|
|
118
|
+
});
|
|
119
|
+
const generatorDts = (config, api, options) => __async(void 0, null, function* () {
|
|
120
|
+
const { runRollup, runTsc } = yield Promise.resolve().then(() => __toESM(require("./dts")));
|
|
121
|
+
const { watch, dts } = options;
|
|
122
|
+
const { buildType, input, sourceDir, alias } = config;
|
|
123
|
+
const { appDirectory } = api.useAppContext();
|
|
124
|
+
const { tsconfigPath, distPath } = dts;
|
|
125
|
+
if (buildType === "bundle") {
|
|
126
|
+
const { getFinalExternals } = yield Promise.resolve().then(() => __toESM(require("../utils/builder")));
|
|
127
|
+
const finalExternals = yield getFinalExternals(config, { appDirectory });
|
|
128
|
+
yield runRollup({
|
|
129
|
+
distDir: distPath,
|
|
130
|
+
watch,
|
|
131
|
+
externals: finalExternals,
|
|
132
|
+
input,
|
|
133
|
+
tsconfigPath
|
|
134
|
+
});
|
|
135
|
+
} else {
|
|
136
|
+
yield runTsc({
|
|
137
|
+
appDirectory,
|
|
138
|
+
alias,
|
|
139
|
+
distAbsPath: distPath,
|
|
140
|
+
watch,
|
|
141
|
+
tsconfigPath,
|
|
142
|
+
sourceDir
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
const buildLib = (config, api, options) => __async(void 0, null, function* () {
|
|
147
|
+
var _a;
|
|
148
|
+
const { watch } = options;
|
|
149
|
+
const {
|
|
150
|
+
target,
|
|
151
|
+
buildType,
|
|
152
|
+
sourceMap,
|
|
153
|
+
format,
|
|
154
|
+
outdir: distPath,
|
|
155
|
+
asset,
|
|
156
|
+
jsx,
|
|
157
|
+
input,
|
|
158
|
+
platform,
|
|
159
|
+
splitting,
|
|
160
|
+
minify,
|
|
161
|
+
sourceDir,
|
|
162
|
+
umdGlobals,
|
|
163
|
+
umdModuleName,
|
|
164
|
+
define,
|
|
165
|
+
alias,
|
|
166
|
+
style,
|
|
167
|
+
externals,
|
|
168
|
+
autoExternal,
|
|
169
|
+
dts
|
|
170
|
+
} = config;
|
|
171
|
+
const { appDirectory } = api.useAppContext();
|
|
172
|
+
const { slash } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
173
|
+
const { es5Plugin, umdPlugin, transformPlugin } = yield Promise.resolve().then(() => __toESM(require("@modern-js/libuild-plugin-swc")));
|
|
174
|
+
const plugins = target === "es5" ? [es5Plugin()] : [];
|
|
175
|
+
if (format === "umd") {
|
|
176
|
+
plugins.push(umdPlugin(umdModuleName));
|
|
177
|
+
}
|
|
178
|
+
const { watchPlugin, externalPlugin } = yield Promise.resolve().then(() => __toESM(require("../utils/libuild-plugins")));
|
|
179
|
+
plugins.push(watchPlugin(config));
|
|
180
|
+
if (dts) {
|
|
181
|
+
const { getProjectTsconfig } = yield Promise.resolve().then(() => __toESM(require("./dts/tsc")));
|
|
182
|
+
const userTsconfig = yield getProjectTsconfig(dts.tsconfigPath);
|
|
183
|
+
((_a = userTsconfig.compilerOptions) == null ? void 0 : _a.emitDecoratorMetadata) && plugins.push(
|
|
184
|
+
transformPlugin({
|
|
185
|
+
jsc: {
|
|
186
|
+
transform: {
|
|
187
|
+
legacyDecorator: true,
|
|
188
|
+
decoratorMetadata: true
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
})
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
const root = slash(appDirectory);
|
|
195
|
+
const outdir = slash(distPath);
|
|
196
|
+
const assetOutDir = asset.path ? slash(asset.path) : asset.path;
|
|
197
|
+
const { less, sass, postcss, inject, modules, autoModules } = style;
|
|
198
|
+
const buildConfig = {
|
|
199
|
+
root,
|
|
200
|
+
watch,
|
|
201
|
+
target,
|
|
202
|
+
sourceMap,
|
|
203
|
+
format,
|
|
204
|
+
outdir,
|
|
205
|
+
define,
|
|
206
|
+
style: {
|
|
207
|
+
less,
|
|
208
|
+
sass,
|
|
209
|
+
postcss,
|
|
210
|
+
inject,
|
|
211
|
+
modules,
|
|
212
|
+
autoModules
|
|
213
|
+
},
|
|
214
|
+
resolve: {
|
|
215
|
+
alias
|
|
216
|
+
},
|
|
217
|
+
asset: __spreadProps(__spreadValues({}, asset), {
|
|
218
|
+
outdir: assetOutDir
|
|
219
|
+
}),
|
|
220
|
+
plugins,
|
|
221
|
+
jsx,
|
|
222
|
+
input,
|
|
223
|
+
platform,
|
|
224
|
+
splitting,
|
|
225
|
+
minify,
|
|
226
|
+
sourceDir,
|
|
227
|
+
globals: umdGlobals,
|
|
228
|
+
external: externals,
|
|
229
|
+
autoExternal,
|
|
230
|
+
bundle: buildType === "bundle",
|
|
231
|
+
outbase: sourceDir,
|
|
232
|
+
esbuildOptions: (options2) => __spreadProps(__spreadValues({}, options2), {
|
|
233
|
+
supported: {
|
|
234
|
+
"dynamic-import": !(["cjs", "umd"].includes(format) && buildType === "bundleless")
|
|
235
|
+
}
|
|
236
|
+
})
|
|
237
|
+
};
|
|
238
|
+
plugins.push(externalPlugin(config, { appDirectory }));
|
|
239
|
+
try {
|
|
240
|
+
const { Libuilder } = yield Promise.resolve().then(() => __toESM(require("@modern-js/libuild")));
|
|
241
|
+
const runner = api.useHookRunners();
|
|
242
|
+
const modifiedBuildConfig = yield runner.modifyLibuild(buildConfig, {
|
|
243
|
+
onLast: (c) => c
|
|
244
|
+
});
|
|
245
|
+
const builder = yield Libuilder.create(modifiedBuildConfig);
|
|
246
|
+
yield builder.build();
|
|
247
|
+
if (watch) {
|
|
248
|
+
const { watchSectionTitle } = yield Promise.resolve().then(() => __toESM(require("../utils/log")));
|
|
249
|
+
const { SectionTitleStatus } = yield Promise.resolve().then(() => __toESM(require("../constants/log")));
|
|
250
|
+
const titleText = `[${buildType === "bundle" ? "Bundle" : "Bundleless"}: ${format}_${target}]`;
|
|
251
|
+
console.info(
|
|
252
|
+
yield watchSectionTitle(titleText, SectionTitleStatus.Success)
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
} catch (e) {
|
|
256
|
+
const { InternalBuildError } = yield Promise.resolve().then(() => __toESM(require("../error")));
|
|
257
|
+
throw new InternalBuildError(e, {
|
|
258
|
+
target,
|
|
259
|
+
format,
|
|
260
|
+
buildType: "bundle"
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUO,MAAM,eAAe,CAC1B,SAKA,QACG;AACH,QAAM,EAAE,aAAa,QAAQ,IAAI;AACjC,QAAM,EAAE,cAAc,YAAY,IAAI;AAEtC,MAAI,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,OAAK;AAAA,IACf,CAAC;AAED,UAAM,UAAU,MAAM,UAAU,OAAO,mBAAmB;AAC1D,UAAM,QAAQ,MAAM;AAEpB,QAAI,OAAO;AACT,YAAM,EAAE,kBAAkB,IAAI,MAAM,6CAAO;AAC3C,YAAM,EAAE,mBAAmB,IAAI,MAAM,6CAAO;AAC5C,YAAM,YAAY,IAChB,cAAc,WAAW,WAAW,iBACjC,UAAU;AAEf,cAAQ;AAAA,QACN,MAAM,kBAAkB,WAAW,mBAAmB,OAAO;AAAA,MAC/D;AAAA,IACF;AAAA,EACF,SAAS,GAAT;AACE,UAAM,EAAE,mBAAmB,IAAI,MAAM,6CAAO;AAC5C,UAAM,IAAI,mBAAmB,GAAG;AAAA,MAC9B;AAAA,MACA;AAAA,MACA,WAAW;AAAA,IACb,CAAC;AAAA,EACH;AACF;","names":["options"],"sources":["../../src/builder/build.ts"],"sourcesContent":["import type { CLIConfig } from '@modern-js/libuild';\nimport type {\n BuildCommandOptions,\n BaseBuildConfig,\n ModuleTools,\n PluginAPI,\n DTSOptions,\n ModuleContext,\n} from '../types';\n\nexport const runBuildTask = async (\n options: {\n buildConfig: BaseBuildConfig;\n buildCmdOptions: BuildCommandOptions;\n context: ModuleContext;\n },\n api: PluginAPI<ModuleTools>,\n) => {\n const { buildConfig, context } = options;\n const { appDirectory, isTsProject } = context;\n\n if (isTsProject) {\n await buildInTsProject(options, api);\n } else {\n await buildInJsProject(options, api);\n }\n\n const { copyTask } = await import('./copy');\n await copyTask(buildConfig, { appDirectory });\n};\n\nexport const buildInTsProject = async (\n options: {\n buildConfig: BaseBuildConfig;\n buildCmdOptions: BuildCommandOptions;\n context: ModuleContext;\n },\n api: PluginAPI<ModuleTools>,\n) => {\n const { buildConfig, buildCmdOptions } = options;\n const dts = buildCmdOptions.dts ? buildConfig.dts : false;\n const skipBuildLib = buildConfig.dts ? buildConfig.dts.only : false;\n const watch = buildCmdOptions.watch ?? false;\n\n if (dts === false) {\n // --no-dts and buildConfig is `{ dts: { only: true } }`, then skip.\n !skipBuildLib && (await buildLib(buildConfig, api, { watch }));\n } else {\n const tasks = dts.only ? [generatorDts] : [buildLib, generatorDts];\n const { default: pMap } = await import('../../compiled/p-map');\n await pMap(tasks, async task => {\n await task(buildConfig, api as any, { watch, dts });\n });\n }\n};\n\nexport const buildInJsProject = async (\n options: {\n buildConfig: BaseBuildConfig;\n buildCmdOptions: BuildCommandOptions;\n context: ModuleContext;\n },\n api: PluginAPI<ModuleTools>,\n) => {\n const { buildConfig, buildCmdOptions } = options;\n const dts = buildCmdOptions.dts ? buildConfig.dts : false;\n const watch = buildCmdOptions.watch ?? false;\n\n if (dts !== false && dts.only) {\n return;\n }\n\n await buildLib(buildConfig, api, { watch });\n};\n\nexport const generatorDts = async (\n config: BaseBuildConfig,\n api: PluginAPI,\n options: {\n watch: boolean;\n dts: DTSOptions;\n },\n) => {\n const { runRollup, runTsc } = await import('./dts');\n const { watch, dts } = options;\n const { buildType, input, sourceDir, alias } = config;\n const { appDirectory } = api.useAppContext();\n const { tsconfigPath, distPath } = dts;\n if (buildType === 'bundle') {\n const { getFinalExternals } = await import('../utils/builder');\n const finalExternals = await getFinalExternals(config, { appDirectory });\n\n await runRollup({\n distDir: distPath,\n watch,\n externals: finalExternals,\n input,\n tsconfigPath,\n });\n } else {\n await runTsc({\n appDirectory,\n alias,\n distAbsPath: distPath,\n watch,\n tsconfigPath,\n sourceDir,\n });\n }\n};\n\nexport const buildLib = async (\n config: BaseBuildConfig,\n api: PluginAPI<ModuleTools>,\n options: {\n watch: boolean;\n },\n) => {\n const { watch } = options;\n const {\n target,\n buildType,\n sourceMap,\n format,\n outdir: distPath,\n asset,\n jsx,\n input,\n platform,\n splitting,\n minify,\n sourceDir,\n umdGlobals,\n umdModuleName,\n define,\n alias,\n style,\n externals,\n autoExternal,\n dts,\n } = config;\n const { appDirectory } = api.useAppContext();\n const { slash } = await import('@modern-js/utils');\n const { es5Plugin, umdPlugin, transformPlugin } = await import(\n '@modern-js/libuild-plugin-swc'\n );\n const plugins = target === 'es5' ? [es5Plugin()] : [];\n if (format === 'umd') {\n plugins.push(umdPlugin(umdModuleName));\n }\n const { watchPlugin, externalPlugin } = await import(\n '../utils/libuild-plugins'\n );\n plugins.push(watchPlugin(config));\n if (dts) {\n const { getProjectTsconfig } = await import('./dts/tsc');\n const userTsconfig = await getProjectTsconfig(dts.tsconfigPath);\n userTsconfig.compilerOptions?.emitDecoratorMetadata &&\n plugins.push(\n transformPlugin({\n jsc: {\n transform: {\n legacyDecorator: true,\n decoratorMetadata: true,\n },\n },\n }),\n );\n }\n const root = slash(appDirectory);\n const outdir = slash(distPath);\n const assetOutDir = asset.path ? slash(asset.path) : asset.path;\n const { less, sass, postcss, inject, modules, autoModules } = style;\n const buildConfig: CLIConfig = {\n root,\n watch,\n target,\n sourceMap,\n format,\n outdir,\n define,\n style: {\n less,\n sass,\n postcss,\n inject,\n modules,\n autoModules,\n },\n resolve: {\n alias,\n },\n asset: {\n ...asset,\n outdir: assetOutDir,\n },\n plugins,\n jsx,\n input,\n platform,\n splitting,\n minify,\n sourceDir,\n globals: umdGlobals,\n external: externals,\n autoExternal,\n bundle: buildType === 'bundle',\n // outbase for [dir]/[name]\n outbase: sourceDir,\n esbuildOptions: (options: any) => ({\n ...options,\n supported: {\n 'dynamic-import': !(\n ['cjs', 'umd'].includes(format) && buildType === 'bundleless'\n ),\n },\n }),\n };\n plugins.push(externalPlugin(config, { appDirectory }));\n\n try {\n const { Libuilder } = await import('@modern-js/libuild');\n\n const runner = api.useHookRunners();\n const modifiedBuildConfig = await runner.modifyLibuild(buildConfig, {\n onLast: c => c,\n });\n\n const builder = await Libuilder.create(modifiedBuildConfig);\n await builder.build();\n\n if (watch) {\n const { watchSectionTitle } = await import('../utils/log');\n const { SectionTitleStatus } = await import('../constants/log');\n const titleText = `[${\n buildType === 'bundle' ? 'Bundle' : 'Bundleless'\n }: ${format}_${target}]`;\n\n console.info(\n await watchSectionTitle(titleText, SectionTitleStatus.Success),\n );\n }\n } catch (e: any) {\n const { InternalBuildError } = await import('../error');\n throw new InternalBuildError(e, {\n target,\n format,\n buildType: 'bundle',\n });\n }\n};\n"]}
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
clearBuildConfigPaths: () => clearBuildConfigPaths,
|
|
21
|
+
clearDtsTemp: () => clearDtsTemp
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
24
|
+
var __create = Object.create;
|
|
25
|
+
var __defProp2 = Object.defineProperty;
|
|
26
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
27
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
28
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
29
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
30
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
31
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
32
|
+
for (let key of __getOwnPropNames2(from))
|
|
33
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
34
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
35
|
+
}
|
|
36
|
+
return to;
|
|
37
|
+
};
|
|
38
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps2(
|
|
39
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
40
|
+
mod
|
|
41
|
+
));
|
|
42
|
+
var __async = (__this, __arguments, generator) => {
|
|
43
|
+
return new Promise((resolve, reject) => {
|
|
44
|
+
var fulfilled = (value) => {
|
|
45
|
+
try {
|
|
46
|
+
step(generator.next(value));
|
|
47
|
+
} catch (e) {
|
|
48
|
+
reject(e);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
var rejected = (value) => {
|
|
52
|
+
try {
|
|
53
|
+
step(generator.throw(value));
|
|
54
|
+
} catch (e) {
|
|
55
|
+
reject(e);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
59
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
const clearDtsTemp = () => __async(void 0, null, function* () {
|
|
63
|
+
const { fs } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
64
|
+
const { dtsTempDirectory } = yield Promise.resolve().then(() => __toESM(require("../constants/dts")));
|
|
65
|
+
yield fs.remove(dtsTempDirectory);
|
|
66
|
+
});
|
|
67
|
+
const clearBuildConfigPaths = (configs) => __async(void 0, null, function* () {
|
|
68
|
+
const { fs } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
69
|
+
for (const config of configs) {
|
|
70
|
+
yield fs.remove(config.outdir);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
//# sourceMappingURL=clear.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,MAAM,eAAe,MAAY;AACtC,QAAM,EAAE,GAAG,IAAI,MAAM,6CAAO;AAC5B,QAAM,EAAE,iBAAiB,IAAI,MAAM,6CAAO;AAC1C,QAAM,GAAG,OAAO,gBAAgB;AAClC;AAEO,MAAM,wBAAwB,CAAO,YAA+B;AACzE,QAAM,EAAE,GAAG,IAAI,MAAM,6CAAO;AAE5B,aAAW,UAAU,SAAS;AAC5B,UAAM,GAAG,OAAO,OAAO,MAAM;AAAA,EAC/B;AACF;","names":[],"sources":["../../src/builder/clear.ts"],"sourcesContent":["import type { BaseBuildConfig } from '../types';\n\nexport const clearDtsTemp = async () => {\n const { fs } = await import('@modern-js/utils');\n const { dtsTempDirectory } = await import('../constants/dts');\n await fs.remove(dtsTempDirectory);\n};\n\nexport const clearBuildConfigPaths = async (configs: BaseBuildConfig[]) => {\n const { fs } = await import('@modern-js/utils');\n\n for (const config of configs) {\n await fs.remove(config.outdir);\n }\n};\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CopyPattern } from '../types/copy';
|
|
2
|
+
import type { BaseBuildConfig } from '../types/config';
|
|
3
|
+
export declare const runPatterns: (pattern: CopyPattern, options: {
|
|
4
|
+
appDirectory: string;
|
|
5
|
+
enableCopySync?: boolean;
|
|
6
|
+
}) => Promise<void>;
|
|
7
|
+
export declare const copyTask: (buildConfig: BaseBuildConfig, options: {
|
|
8
|
+
appDirectory: string;
|
|
9
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,207 @@
|
|
|
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
|
+
copyTask: () => copyTask,
|
|
27
|
+
runPatterns: () => runPatterns
|
|
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 __defProps = Object.defineProperties;
|
|
34
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
35
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
36
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
37
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
38
|
+
var __getProtoOf2 = Object.getPrototypeOf;
|
|
39
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
40
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
41
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
42
|
+
var __spreadValues = (a, b) => {
|
|
43
|
+
for (var prop in b || (b = {}))
|
|
44
|
+
if (__hasOwnProp2.call(b, prop))
|
|
45
|
+
__defNormalProp(a, prop, b[prop]);
|
|
46
|
+
if (__getOwnPropSymbols)
|
|
47
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
48
|
+
if (__propIsEnum.call(b, prop))
|
|
49
|
+
__defNormalProp(a, prop, b[prop]);
|
|
50
|
+
}
|
|
51
|
+
return a;
|
|
52
|
+
};
|
|
53
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
54
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
55
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
56
|
+
for (let key of __getOwnPropNames2(from))
|
|
57
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
58
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
59
|
+
}
|
|
60
|
+
return to;
|
|
61
|
+
};
|
|
62
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
63
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
64
|
+
mod
|
|
65
|
+
));
|
|
66
|
+
var __async = (__this, __arguments, generator) => {
|
|
67
|
+
return new Promise((resolve, reject) => {
|
|
68
|
+
var fulfilled = (value) => {
|
|
69
|
+
try {
|
|
70
|
+
step(generator.next(value));
|
|
71
|
+
} catch (e) {
|
|
72
|
+
reject(e);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
var rejected = (value) => {
|
|
76
|
+
try {
|
|
77
|
+
step(generator.throw(value));
|
|
78
|
+
} catch (e) {
|
|
79
|
+
reject(e);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
83
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
const runPatterns = (pattern, options) => __async(void 0, null, function* () {
|
|
87
|
+
var _a, _b;
|
|
88
|
+
const { fs, fastGlob, globby } = yield Promise.resolve().then(() => __toESM2(require("@modern-js/utils")));
|
|
89
|
+
const { default: normalizePath } = yield Promise.resolve().then(() => __toESM2(require("../../compiled/normalize-path")));
|
|
90
|
+
const { appDirectory, enableCopySync = false } = options;
|
|
91
|
+
const { from, globOptions = {} } = pattern;
|
|
92
|
+
const normalizedFrom = import_path.default.normalize(from);
|
|
93
|
+
if (typeof pattern.context === "string") {
|
|
94
|
+
pattern.context = import_path.default.isAbsolute(pattern.context) ? pattern.context : import_path.default.join(appDirectory, pattern.context);
|
|
95
|
+
}
|
|
96
|
+
let absoluteFrom;
|
|
97
|
+
if (import_path.default.isAbsolute(normalizedFrom)) {
|
|
98
|
+
absoluteFrom = normalizedFrom;
|
|
99
|
+
} else {
|
|
100
|
+
absoluteFrom = import_path.default.resolve(
|
|
101
|
+
(_a = pattern.context) != null ? _a : appDirectory,
|
|
102
|
+
normalizedFrom
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
let stats;
|
|
106
|
+
try {
|
|
107
|
+
stats = yield fs.stat(absoluteFrom);
|
|
108
|
+
} catch (error) {
|
|
109
|
+
}
|
|
110
|
+
let fromType;
|
|
111
|
+
if (stats) {
|
|
112
|
+
if (stats.isDirectory()) {
|
|
113
|
+
fromType = "dir";
|
|
114
|
+
} else if (stats.isFile()) {
|
|
115
|
+
fromType = "file";
|
|
116
|
+
} else {
|
|
117
|
+
fromType = "glob";
|
|
118
|
+
}
|
|
119
|
+
} else {
|
|
120
|
+
fromType = "glob";
|
|
121
|
+
}
|
|
122
|
+
let glob;
|
|
123
|
+
switch (fromType) {
|
|
124
|
+
case "dir":
|
|
125
|
+
pattern.context = absoluteFrom;
|
|
126
|
+
glob = import_path.default.posix.join(
|
|
127
|
+
fastGlob.escapePath(normalizePath(import_path.default.resolve(absoluteFrom))),
|
|
128
|
+
"**/*"
|
|
129
|
+
);
|
|
130
|
+
absoluteFrom = import_path.default.join(absoluteFrom, "**/*");
|
|
131
|
+
if (typeof globOptions.dot === "undefined") {
|
|
132
|
+
globOptions.dot = true;
|
|
133
|
+
}
|
|
134
|
+
break;
|
|
135
|
+
case "file":
|
|
136
|
+
pattern.context = import_path.default.dirname(absoluteFrom);
|
|
137
|
+
glob = fastGlob.escapePath(normalizePath(import_path.default.resolve(absoluteFrom)));
|
|
138
|
+
if (typeof globOptions.dot === "undefined") {
|
|
139
|
+
globOptions.dot = true;
|
|
140
|
+
}
|
|
141
|
+
break;
|
|
142
|
+
case "glob":
|
|
143
|
+
default: {
|
|
144
|
+
glob = import_path.default.isAbsolute(from) ? from : import_path.default.posix.join(
|
|
145
|
+
fastGlob.escapePath(
|
|
146
|
+
normalizePath(import_path.default.resolve((_b = pattern.context) != null ? _b : appDirectory))
|
|
147
|
+
),
|
|
148
|
+
from
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
const globEntries = yield globby(glob, __spreadProps(__spreadValues(__spreadValues({}, { followSymbolicLinks: true }), pattern.globOptions || {}), {
|
|
153
|
+
cwd: pattern.context,
|
|
154
|
+
objectMode: true
|
|
155
|
+
}));
|
|
156
|
+
const { default: pMap } = yield Promise.resolve().then(() => __toESM2(require("../../compiled/p-map")));
|
|
157
|
+
pMap(globEntries, (globEntry) => __async(void 0, null, function* () {
|
|
158
|
+
var _a2, _b2;
|
|
159
|
+
if (!globEntry.dirent.isFile()) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
const from2 = globEntry.path;
|
|
163
|
+
const absoluteFrom2 = import_path.default.resolve((_a2 = pattern.context) != null ? _a2 : appDirectory, from2);
|
|
164
|
+
const to = import_path.default.normalize(
|
|
165
|
+
typeof pattern.to !== "undefined" ? pattern.to : ""
|
|
166
|
+
);
|
|
167
|
+
const toType = import_path.default.extname(to) === "" || to.slice(-1) === import_path.default.sep ? "dir" : "file";
|
|
168
|
+
const relativeFrom = import_path.default.relative(
|
|
169
|
+
(_b2 = pattern.context) != null ? _b2 : appDirectory,
|
|
170
|
+
absoluteFrom2
|
|
171
|
+
);
|
|
172
|
+
const filename = toType === "dir" ? import_path.default.join(to, relativeFrom) : to;
|
|
173
|
+
const absoluteTo = import_path.default.isAbsolute(filename) ? filename : import_path.default.join(appDirectory, filename);
|
|
174
|
+
if (enableCopySync) {
|
|
175
|
+
fs.copySync(absoluteFrom2, absoluteTo);
|
|
176
|
+
} else {
|
|
177
|
+
yield fs.copy(absoluteFrom2, absoluteTo);
|
|
178
|
+
}
|
|
179
|
+
}));
|
|
180
|
+
});
|
|
181
|
+
const copyTask = (buildConfig, options) => __async(void 0, null, function* () {
|
|
182
|
+
var _a;
|
|
183
|
+
const copyConfig = buildConfig.copy;
|
|
184
|
+
if (!copyConfig.patterns || copyConfig.patterns.length === 0) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
const { default: pMap } = yield Promise.resolve().then(() => __toESM2(require("../../compiled/p-map")));
|
|
188
|
+
const concurrency = ((_a = copyConfig == null ? void 0 : copyConfig.options) == null ? void 0 : _a.concurrency) || 100;
|
|
189
|
+
try {
|
|
190
|
+
yield pMap(
|
|
191
|
+
copyConfig.patterns,
|
|
192
|
+
(copyOption) => __async(void 0, null, function* () {
|
|
193
|
+
var _a2;
|
|
194
|
+
yield runPatterns(copyOption, __spreadProps(__spreadValues({}, options), {
|
|
195
|
+
enableCopySync: (_a2 = copyConfig.options) == null ? void 0 : _a2.enableCopySync
|
|
196
|
+
}));
|
|
197
|
+
}),
|
|
198
|
+
{ concurrency }
|
|
199
|
+
);
|
|
200
|
+
} catch (e) {
|
|
201
|
+
if (e instanceof Error) {
|
|
202
|
+
console.error(`copy error: ${e.message}`);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
//# sourceMappingURL=copy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKV,MAAM,cAAc,CACzB,SACA,YAIG;AAXL;AAYE,QAAM,EAAE,IAAI,UAAU,OAAO,IAAI,MAAM,8CAAO;AAC9C,QAAM,EAAE,SAAS,cAAc,IAAI,MAAM,8CACvC;AAEF,QAAM,EAAE,cAAc,iBAAiB,MAAM,IAAI;AACjD,QAAM,EAAE,MAAM,cAAc,CAAC,EAAE,IAAI;AACnC,QAAM,iBAAiB,oBAAK,UAAU,IAAI;AAG1C,MAAI,OAAO,QAAQ,YAAY,UAAU;AACvC,YAAQ,UAAU,oBAAK,WAAW,QAAQ,OAAO,IAC7C,QAAQ,UACR,oBAAK,KAAK,cAAc,QAAQ,OAAO;AAAA,EAC7C;AAEA,MAAI;AACJ,MAAI,oBAAK,WAAW,cAAc,GAAG;AACnC,mBAAe;AAAA,EACjB,OAAO;AACL,mBAAe,oBAAK;AAAA,OAClB,aAAQ,YAAR,YAAmB;AAAA,MACnB;AAAA,IACF;AAAA,EACF;AAEA,MAAI;AACJ,MAAI;AACF,YAAQ,MAAM,GAAG,KAAK,YAAY;AAAA,EACpC,SAAS,OAAT;AAAA,EAEA;AAEA,MAAI;AACJ,MAAI,OAAO;AACT,QAAI,MAAM,YAAY,GAAG;AACvB,iBAAW;AAAA,IACb,WAAW,MAAM,OAAO,G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QAAQ,KAAK;AAAA,IACnD;AACA,UAAM,SACJ,oBAAK,QAAQ,EAAE,MAAM,MAAM,GAAG,MAAM,EAAE,MAAM,oBAAK,MAAM,QAAQ;AAEjE,UAAM,eAAe,oBAAK;AAAA,OACxBG,cAAQ,YAAR,aAAmB;AAAA,MACnBF;AAAAA,IACF;AAEA,UAAM,WAAW,WAAW,QAAQ,oBAAK,KAAK,IAAI,YAAY,IAAI;AAElE,UAAM,aAAa,oBAAK,WAAW,QAAQ,IACvC,WACA,oBAAK,KAAK,cAAc,QAAQ;AAEpC,QAAI,gBAAgB;AAClB,SAAG,SAASA,eAAc,UAAU;AAAA,IACtC,OAAO;AACL,YAAM,GAAG,KAAKA,eAAc,UAAU;AAAA,IACxC;AAAA,EACF,EAAC;AACH;AAEO,MAAM,WAAW,CACtB,aACA,YAGG;AAzIL;AA0IE,QAAM,aAAa,YAAY;AAE/B,MAAI,CAAC,WAAW,YAAY,WAAW,SAAS,WAAW,GAAG;AAC5D;AAAA,EACF;AAEA,QAAM,EAAE,SAAS,KAAK,IAAI,MAAM,8CAAO;AACvC,QAAM,gBAAc,8CAAY,YAAZ,mBAAqB,gBAAe;AACxD,MAAI;AACF,UAAM;AAAA,MACJ,WAAW;AAAA,MACX,CAAM,eAAc;AArJ1B;AAsJQ,cAAM,YAAY,YAAY,iCACzB,UADyB;AAAA,UAE5B,iBAAgBC,iBAAW,YAAX,oBAAoB;AAAA,QACtC,EAAC;AAAA,MACH;AAAA,MACA,EAAE,YAAY;AAAA,IAChB;AAAA,EACF,SAAS,GAAT;AACE,QAAI,aAAa,OAAO;AACtB,cAAQ,MAAM,eAAe,EAAE,SAAS;AAAA,IAC1C;AAAA,EACF;AACF;","names":["from","absoluteFrom","_a","_b"],"sources":["../../src/builder/copy.ts"],"sourcesContent":["import path from 'path';\nimport type { CopyPattern } from '../types/copy';\nimport type { BaseBuildConfig } from '../types/config';\n\n// TODO: about copy rules\nexport const runPatterns = async (\n pattern: CopyPattern,\n options: {\n appDirectory: string;\n enableCopySync?: boolean;\n },\n) => {\n const { fs, fastGlob, globby } = await import('@modern-js/utils');\n const { default: normalizePath } = await import(\n '../../compiled/normalize-path'\n );\n const { appDirectory, enableCopySync = false } = options;\n const { from, globOptions = {} } = pattern;\n const normalizedFrom = path.normalize(from);\n\n // when context is relative path\n if (typeof pattern.context === 'string') {\n pattern.context = path.isAbsolute(pattern.context)\n ? pattern.context\n : path.join(appDirectory, pattern.context);\n }\n\n let absoluteFrom;\n if (path.isAbsolute(normalizedFrom)) {\n absoluteFrom = normalizedFrom;\n } else {\n absoluteFrom = path.resolve(\n pattern.context ?? appDirectory,\n normalizedFrom,\n );\n }\n\n let stats;\n try {\n stats = await fs.stat(absoluteFrom);\n } catch (error) {\n // Do Nothing\n }\n\n let fromType: 'file' | 'dir' | 'glob';\n if (stats) {\n if (stats.isDirectory()) {\n fromType = 'dir';\n } else if (stats.isFile()) {\n fromType = 'file';\n } else {\n fromType = 'glob';\n }\n } else {\n fromType = 'glob';\n }\n\n let glob;\n\n switch (fromType) {\n case 'dir':\n pattern.context = absoluteFrom;\n glob = path.posix.join(\n fastGlob.escapePath(normalizePath(path.resolve(absoluteFrom))),\n '**/*',\n );\n absoluteFrom = path.join(absoluteFrom, '**/*');\n\n if (typeof globOptions.dot === 'undefined') {\n globOptions.dot = true;\n }\n break;\n case 'file':\n pattern.context = path.dirname(absoluteFrom);\n glob = fastGlob.escapePath(normalizePath(path.resolve(absoluteFrom)));\n\n if (typeof globOptions.dot === 'undefined') {\n globOptions.dot = true;\n }\n break;\n case 'glob':\n default: {\n glob = path.isAbsolute(from)\n ? from\n : path.posix.join(\n fastGlob.escapePath(\n normalizePath(path.resolve(pattern.context ?? appDirectory)),\n ),\n from,\n );\n }\n }\n\n const globEntries = await globby(glob, {\n ...{ followSymbolicLinks: true },\n ...(pattern.globOptions || {}),\n cwd: pattern.context,\n objectMode: true,\n });\n const { default: pMap } = await import('../../compiled/p-map');\n pMap(globEntries, async globEntry => {\n if (!globEntry.dirent.isFile()) {\n return;\n }\n\n const from = globEntry.path;\n const absoluteFrom = path.resolve(pattern.context ?? appDirectory, from);\n const to = path.normalize(\n typeof pattern.to !== 'undefined' ? pattern.to : '',\n );\n const toType =\n path.extname(to) === '' || to.slice(-1) === path.sep ? 'dir' : 'file';\n\n const relativeFrom = path.relative(\n pattern.context ?? appDirectory,\n absoluteFrom,\n );\n\n const filename = toType === 'dir' ? path.join(to, relativeFrom) : to;\n\n const absoluteTo = path.isAbsolute(filename)\n ? filename\n : path.join(appDirectory, filename);\n\n if (enableCopySync) {\n fs.copySync(absoluteFrom, absoluteTo);\n } else {\n await fs.copy(absoluteFrom, absoluteTo);\n }\n });\n};\n\nexport const copyTask = async (\n buildConfig: BaseBuildConfig,\n options: {\n appDirectory: string;\n },\n) => {\n const copyConfig = buildConfig.copy;\n\n if (!copyConfig.patterns || copyConfig.patterns.length === 0) {\n return;\n }\n\n const { default: pMap } = await import('../../compiled/p-map');\n const concurrency = copyConfig?.options?.concurrency || 100;\n try {\n await pMap(\n copyConfig.patterns,\n async copyOption => {\n await runPatterns(copyOption, {\n ...options,\n enableCopySync: copyConfig.options?.enableCopySync,\n });\n },\n { concurrency },\n );\n } catch (e) {\n if (e instanceof Error) {\n console.error(`copy error: ${e.message}`);\n }\n }\n};\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
runRollup: () => import_rollup.runRollup,
|
|
21
|
+
runTsc: () => import_tsc.runTsc
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
24
|
+
var import_rollup = require("./rollup");
|
|
25
|
+
var import_tsc = require("./tsc");
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA0B;AAC1B,iBAAuB;","names":[],"sources":["../../../src/builder/dts/index.ts"],"sourcesContent":["export { runRollup } from './rollup';\nexport { runTsc } from './tsc';\n"]}
|