@modern-js/app-tools 2.58.1-alpha.6 → 2.58.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/builder/builder-webpack/createCopyPattern.js +0 -1
- package/dist/cjs/builder/builder-webpack/index.js +1 -1
- package/dist/cjs/builder/generator/index.js +2 -2
- package/dist/cjs/builder/index.js +2 -2
- package/dist/cjs/builder/shared/bundlerPlugins/RouterPlugin.js +13 -4
- package/dist/cjs/commands/build.js +19 -0
- package/dist/cjs/commands/dev.js +9 -0
- package/dist/cjs/commands/index.js +8 -8
- package/dist/cjs/commands/inspect.js +1 -1
- package/dist/cjs/config/initialize/inits.js +4 -4
- package/dist/cjs/esm/esbuild-loader.mjs +20 -0
- package/dist/cjs/esm/register-esm.mjs +67 -0
- package/dist/cjs/esm/ts-node-loader.mjs +21 -0
- package/dist/cjs/esm/utils.mjs +43 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/plugins/analyze/index.js +3 -3
- package/dist/cjs/plugins/deploy/dependencies/index.js +2 -15
- package/dist/cjs/plugins/deploy/dependencies/utils.js +13 -78
- package/dist/cjs/plugins/deploy/platforms/netlify-entry.js +3 -0
- package/dist/cjs/plugins/deploy/platforms/netlify-entry.mjs +1 -0
- package/dist/cjs/plugins/deploy/platforms/{netlifyEntry.js → netlify-handler.js} +6 -4
- package/dist/cjs/plugins/deploy/platforms/netlify.js +14 -5
- package/dist/cjs/plugins/deploy/platforms/node.js +13 -4
- package/dist/cjs/plugins/deploy/platforms/vercel-entry.js +3 -0
- package/dist/cjs/plugins/deploy/platforms/vercel-entry.mjs +3 -0
- package/dist/cjs/plugins/deploy/platforms/{vercelEntry.js → vercel-handler.js} +4 -1
- package/dist/cjs/plugins/deploy/platforms/vercel.js +14 -5
- package/dist/cjs/utils/config.js +1 -1
- package/dist/cjs/utils/loadPlugins.js +1 -1
- package/dist/cjs/utils/register.js +50 -23
- package/dist/types/builder/builder-rspack/adapterCopy.d.ts +2 -2
- package/dist/types/builder/builder-rspack/index.d.ts +1 -1
- package/dist/types/builder/builder-webpack/adapterModern.d.ts +2 -2
- package/dist/types/builder/builder-webpack/index.d.ts +1 -1
- package/dist/types/builder/generator/index.d.ts +2 -2
- package/dist/types/builder/index.d.ts +1 -1
- package/dist/types/builder/shared/builderPlugins/adapterHtml.d.ts +1 -1
- package/dist/types/builder/shared/builderPlugins/adapterSSR.d.ts +1 -1
- package/dist/types/builder/shared/createCopyInfo.d.ts +1 -1
- package/dist/types/commands/build.d.ts +1 -1
- package/dist/types/commands/dev.d.ts +3 -3
- package/dist/types/commands/index.d.ts +3 -3
- package/dist/types/config/default.d.ts +1 -1
- package/dist/types/config/initialize/inits.d.ts +1 -1
- package/dist/types/config/legacy/createHtmlConfig.d.ts +1 -1
- package/dist/types/config/legacy/createOutputConfig.d.ts +1 -1
- package/dist/types/config/legacy/createSourceConfig.d.ts +1 -1
- package/dist/types/config/legacy/createToolsConfig.d.ts +1 -1
- package/dist/types/esm/esbuild-loader.d.mts +6 -0
- package/dist/types/esm/register-esm.d.mts +5 -0
- package/dist/types/esm/ts-node-loader.d.mts +6 -0
- package/dist/types/esm/utils.d.mts +6 -0
- package/dist/types/exports/server.d.ts +1 -1
- package/dist/types/hooks.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/plugins/analyze/getBundleEntry.d.ts +1 -1
- package/dist/types/plugins/analyze/getFileSystemEntry.d.ts +1 -1
- package/dist/types/plugins/analyze/index.d.ts +1 -1
- package/dist/types/plugins/deploy/dependencies/index.d.ts +3 -5
- package/dist/types/plugins/deploy/dependencies/utils.d.ts +2 -9
- package/dist/types/plugins/deploy/index.d.ts +2 -2
- package/dist/types/plugins/deploy/platforms/netlify-entry.d.cts +1 -0
- package/dist/types/plugins/deploy/platforms/netlify-entry.d.mts +1 -0
- package/dist/types/plugins/deploy/platforms/netlify-handler.d.cts +1 -0
- package/dist/types/plugins/deploy/platforms/netlify.d.ts +1 -1
- package/dist/types/plugins/deploy/platforms/node.d.ts +1 -1
- package/dist/types/plugins/deploy/platforms/platform.d.ts +2 -2
- package/dist/types/plugins/deploy/platforms/vercel-entry.d.mts +2 -0
- package/dist/types/plugins/deploy/platforms/vercel-entry.d.ts +2 -0
- package/dist/types/plugins/deploy/platforms/vercel-handler.d.cts +1 -0
- package/dist/types/plugins/deploy/platforms/vercel.d.ts +1 -1
- package/dist/types/plugins/deploy/utils.d.ts +1 -1
- package/dist/types/plugins/serverBuild.d.ts +1 -1
- package/dist/types/types/hooks.d.ts +1 -1
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/utils/createServer.d.ts +1 -1
- package/dist/types/utils/generateWatchFiles.d.ts +1 -1
- package/dist/types/utils/getSelectedEntries.d.ts +1 -1
- package/dist/types/utils/loadPlugins.d.ts +3 -3
- package/dist/types/utils/register.d.ts +2 -2
- package/dist/types/utils/restart.d.ts +2 -2
- package/lib/types.d.ts +15 -0
- package/package.json +20 -21
- package/dist/esm/builder/builder-rspack/adapterCopy.js +0 -166
- package/dist/esm/builder/builder-rspack/index.js +0 -34
- package/dist/esm/builder/builder-webpack/adapterModern.js +0 -29
- package/dist/esm/builder/builder-webpack/createCopyPattern.js +0 -44
- package/dist/esm/builder/builder-webpack/index.js +0 -52
- package/dist/esm/builder/generator/createBuilderProviderConfig.js +0 -37
- package/dist/esm/builder/generator/getBuilderEnvironments.js +0 -81
- package/dist/esm/builder/generator/index.js +0 -94
- package/dist/esm/builder/index.js +0 -45
- package/dist/esm/builder/shared/builderPlugins/adapterBasic.js +0 -85
- package/dist/esm/builder/shared/builderPlugins/adapterHtml.js +0 -126
- package/dist/esm/builder/shared/builderPlugins/adapterSSR.js +0 -270
- package/dist/esm/builder/shared/builderPlugins/adapterWorker.js +0 -43
- package/dist/esm/builder/shared/builderPlugins/index.js +0 -4
- package/dist/esm/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -51
- package/dist/esm/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +0 -37
- package/dist/esm/builder/shared/bundlerPlugins/RouterPlugin.js +0 -288
- package/dist/esm/builder/shared/bundlerPlugins/index.js +0 -3
- package/dist/esm/builder/shared/createCopyInfo.js +0 -14
- package/dist/esm/builder/shared/index.js +0 -3
- package/dist/esm/builder/shared/loaders/serverModuleLoader.js +0 -7
- package/dist/esm/builder/shared/types.js +0 -0
- package/dist/esm/commands/build.js +0 -117
- package/dist/esm/commands/deploy.js +0 -48
- package/dist/esm/commands/dev.js +0 -169
- package/dist/esm/commands/index.js +0 -411
- package/dist/esm/commands/inspect.js +0 -28
- package/dist/esm/commands/serve.js +0 -93
- package/dist/esm/config/default.js +0 -190
- package/dist/esm/config/index.js +0 -3
- package/dist/esm/config/initialize/index.js +0 -9
- package/dist/esm/config/initialize/inits.js +0 -85
- package/dist/esm/config/legacy/createHtmlConfig.js +0 -21
- package/dist/esm/config/legacy/createOutputConfig.js +0 -45
- package/dist/esm/config/legacy/createSourceConfig.js +0 -46
- package/dist/esm/config/legacy/createToolsConfig.js +0 -28
- package/dist/esm/config/legacy/index.js +0 -43
- package/dist/esm/defineConfig.js +0 -16
- package/dist/esm/exports/server.js +0 -4
- package/dist/esm/hooks.js +0 -34
- package/dist/esm/index.js +0 -239
- package/dist/esm/locale/en.js +0 -43
- package/dist/esm/locale/index.js +0 -12
- package/dist/esm/locale/zh.js +0 -43
- package/dist/esm/plugins/analyze/constants.js +0 -14
- package/dist/esm/plugins/analyze/getBundleEntry.js +0 -102
- package/dist/esm/plugins/analyze/getFileSystemEntry.js +0 -238
- package/dist/esm/plugins/analyze/getHtmlTemplate.js +0 -178
- package/dist/esm/plugins/analyze/getServerRoutes.js +0 -132
- package/dist/esm/plugins/analyze/index.js +0 -380
- package/dist/esm/plugins/analyze/isDefaultExportFunction.js +0 -49
- package/dist/esm/plugins/analyze/templates.js +0 -6
- package/dist/esm/plugins/analyze/utils.js +0 -101
- package/dist/esm/plugins/deploy/dependencies/index.js +0 -629
- package/dist/esm/plugins/deploy/dependencies/utils.js +0 -643
- package/dist/esm/plugins/deploy/exports.js +0 -4
- package/dist/esm/plugins/deploy/index.js +0 -135
- package/dist/esm/plugins/deploy/platforms/netlify.js +0 -299
- package/dist/esm/plugins/deploy/platforms/netlifyEntry.js +0 -203
- package/dist/esm/plugins/deploy/platforms/node.js +0 -133
- package/dist/esm/plugins/deploy/platforms/nodeEntry.js +0 -108
- package/dist/esm/plugins/deploy/platforms/platform.js +0 -0
- package/dist/esm/plugins/deploy/platforms/vercel.js +0 -233
- package/dist/esm/plugins/deploy/platforms/vercelEntry.js +0 -203
- package/dist/esm/plugins/deploy/utils.js +0 -47
- package/dist/esm/plugins/initialize/index.js +0 -119
- package/dist/esm/plugins/serverBuild.js +0 -87
- package/dist/esm/types/config/deploy.js +0 -0
- package/dist/esm/types/config/dev.js +0 -0
- package/dist/esm/types/config/experiments.js +0 -0
- package/dist/esm/types/config/html.js +0 -0
- package/dist/esm/types/config/index.js +0 -1
- package/dist/esm/types/config/output.js +0 -0
- package/dist/esm/types/config/performance.js +0 -0
- package/dist/esm/types/config/security.js +0 -0
- package/dist/esm/types/config/source.js +0 -0
- package/dist/esm/types/config/testing.js +0 -0
- package/dist/esm/types/config/tools.js +0 -0
- package/dist/esm/types/hooks.js +0 -0
- package/dist/esm/types/index.js +0 -3
- package/dist/esm/types/legacyConfig/deploy.js +0 -0
- package/dist/esm/types/legacyConfig/dev.js +0 -0
- package/dist/esm/types/legacyConfig/index.js +0 -0
- package/dist/esm/types/legacyConfig/output.js +0 -0
- package/dist/esm/types/legacyConfig/source.js +0 -0
- package/dist/esm/types/legacyConfig/testing.js +0 -0
- package/dist/esm/types/legacyConfig/tools.js +0 -0
- package/dist/esm/types/utils.js +0 -0
- package/dist/esm/utils/config.js +0 -122
- package/dist/esm/utils/createServer.js +0 -58
- package/dist/esm/utils/env.js +0 -16
- package/dist/esm/utils/generateWatchFiles.js +0 -71
- package/dist/esm/utils/getSelectedEntries.js +0 -67
- package/dist/esm/utils/loadPlugins.js +0 -69
- package/dist/esm/utils/printInstructions.js +0 -32
- package/dist/esm/utils/register.js +0 -129
- package/dist/esm/utils/restart.js +0 -67
- package/dist/esm/utils/routes.js +0 -42
- package/dist/esm/utils/types.js +0 -0
- package/dist/esm-node/builder/builder-rspack/adapterCopy.js +0 -67
- package/dist/esm-node/builder/builder-rspack/index.js +0 -12
- package/dist/esm-node/builder/builder-webpack/adapterModern.js +0 -26
- package/dist/esm-node/builder/builder-webpack/createCopyPattern.js +0 -42
- package/dist/esm-node/builder/builder-webpack/index.js +0 -20
- package/dist/esm-node/builder/generator/createBuilderProviderConfig.js +0 -44
- package/dist/esm-node/builder/generator/getBuilderEnvironments.js +0 -60
- package/dist/esm-node/builder/generator/index.js +0 -37
- package/dist/esm-node/builder/index.js +0 -11
- package/dist/esm-node/builder/shared/builderPlugins/adapterBasic.js +0 -48
- package/dist/esm-node/builder/shared/builderPlugins/adapterHtml.js +0 -60
- package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.js +0 -156
- package/dist/esm-node/builder/shared/builderPlugins/adapterWorker.js +0 -27
- package/dist/esm-node/builder/shared/builderPlugins/index.js +0 -4
- package/dist/esm-node/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -30
- package/dist/esm-node/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +0 -31
- package/dist/esm-node/builder/shared/bundlerPlugins/RouterPlugin.js +0 -219
- package/dist/esm-node/builder/shared/bundlerPlugins/index.js +0 -3
- package/dist/esm-node/builder/shared/createCopyInfo.js +0 -14
- package/dist/esm-node/builder/shared/index.js +0 -3
- package/dist/esm-node/builder/shared/loaders/serverModuleLoader.js +0 -7
- package/dist/esm-node/builder/shared/types.js +0 -0
- package/dist/esm-node/commands/build.js +0 -55
- package/dist/esm-node/commands/deploy.js +0 -12
- package/dist/esm-node/commands/dev.js +0 -95
- package/dist/esm-node/commands/index.js +0 -92
- package/dist/esm-node/commands/inspect.js +0 -15
- package/dist/esm-node/commands/serve.js +0 -51
- package/dist/esm-node/config/default.js +0 -197
- package/dist/esm-node/config/index.js +0 -3
- package/dist/esm-node/config/initialize/index.js +0 -9
- package/dist/esm-node/config/initialize/inits.js +0 -79
- package/dist/esm-node/config/legacy/createHtmlConfig.js +0 -21
- package/dist/esm-node/config/legacy/createOutputConfig.js +0 -45
- package/dist/esm-node/config/legacy/createSourceConfig.js +0 -29
- package/dist/esm-node/config/legacy/createToolsConfig.js +0 -28
- package/dist/esm-node/config/legacy/index.js +0 -43
- package/dist/esm-node/defineConfig.js +0 -13
- package/dist/esm-node/exports/server.js +0 -4
- package/dist/esm-node/hooks.js +0 -34
- package/dist/esm-node/index.js +0 -124
- package/dist/esm-node/locale/en.js +0 -43
- package/dist/esm-node/locale/index.js +0 -12
- package/dist/esm-node/locale/zh.js +0 -43
- package/dist/esm-node/plugins/analyze/constants.js +0 -14
- package/dist/esm-node/plugins/analyze/getBundleEntry.js +0 -61
- package/dist/esm-node/plugins/analyze/getFileSystemEntry.js +0 -100
- package/dist/esm-node/plugins/analyze/getHtmlTemplate.js +0 -74
- package/dist/esm-node/plugins/analyze/getServerRoutes.js +0 -132
- package/dist/esm-node/plugins/analyze/index.js +0 -166
- package/dist/esm-node/plugins/analyze/isDefaultExportFunction.js +0 -47
- package/dist/esm-node/plugins/analyze/templates.js +0 -24
- package/dist/esm-node/plugins/analyze/utils.js +0 -68
- package/dist/esm-node/plugins/deploy/dependencies/index.js +0 -215
- package/dist/esm-node/plugins/deploy/dependencies/utils.js +0 -202
- package/dist/esm-node/plugins/deploy/exports.js +0 -4
- package/dist/esm-node/plugins/deploy/index.js +0 -44
- package/dist/esm-node/plugins/deploy/platforms/netlify.js +0 -108
- package/dist/esm-node/plugins/deploy/platforms/netlifyEntry.js +0 -69
- package/dist/esm-node/plugins/deploy/platforms/node.js +0 -63
- package/dist/esm-node/plugins/deploy/platforms/nodeEntry.js +0 -44
- package/dist/esm-node/plugins/deploy/platforms/platform.js +0 -0
- package/dist/esm-node/plugins/deploy/platforms/vercel.js +0 -120
- package/dist/esm-node/plugins/deploy/platforms/vercelEntry.js +0 -69
- package/dist/esm-node/plugins/deploy/utils.js +0 -44
- package/dist/esm-node/plugins/initialize/index.js +0 -84
- package/dist/esm-node/plugins/serverBuild.js +0 -58
- package/dist/esm-node/types/config/deploy.js +0 -0
- package/dist/esm-node/types/config/dev.js +0 -0
- package/dist/esm-node/types/config/experiments.js +0 -0
- package/dist/esm-node/types/config/html.js +0 -0
- package/dist/esm-node/types/config/index.js +0 -1
- package/dist/esm-node/types/config/output.js +0 -0
- package/dist/esm-node/types/config/performance.js +0 -0
- package/dist/esm-node/types/config/security.js +0 -0
- package/dist/esm-node/types/config/source.js +0 -0
- package/dist/esm-node/types/config/testing.js +0 -0
- package/dist/esm-node/types/config/tools.js +0 -0
- package/dist/esm-node/types/hooks.js +0 -0
- package/dist/esm-node/types/index.js +0 -3
- package/dist/esm-node/types/legacyConfig/deploy.js +0 -0
- package/dist/esm-node/types/legacyConfig/dev.js +0 -0
- package/dist/esm-node/types/legacyConfig/index.js +0 -0
- package/dist/esm-node/types/legacyConfig/output.js +0 -0
- package/dist/esm-node/types/legacyConfig/source.js +0 -0
- package/dist/esm-node/types/legacyConfig/testing.js +0 -0
- package/dist/esm-node/types/legacyConfig/tools.js +0 -0
- package/dist/esm-node/types/utils.js +0 -0
- package/dist/esm-node/utils/config.js +0 -49
- package/dist/esm-node/utils/createServer.js +0 -26
- package/dist/esm-node/utils/env.js +0 -16
- package/dist/esm-node/utils/generateWatchFiles.js +0 -30
- package/dist/esm-node/utils/getSelectedEntries.js +0 -34
- package/dist/esm-node/utils/loadPlugins.js +0 -22
- package/dist/esm-node/utils/printInstructions.js +0 -11
- package/dist/esm-node/utils/register.js +0 -69
- package/dist/esm-node/utils/restart.js +0 -22
- package/dist/esm-node/utils/routes.js +0 -21
- package/dist/esm-node/utils/types.js +0 -0
- package/dist/types/plugins/deploy/platforms/netlifyEntry.d.ts +0 -2
- package/dist/types/plugins/deploy/platforms/vercelEntry.d.ts +0 -2
- /package/dist/cjs/plugins/deploy/platforms/{nodeEntry.js → node-entry.js} +0 -0
- /package/dist/types/plugins/deploy/platforms/{nodeEntry.d.ts → node-entry.d.ts} +0 -0
@@ -1,5 +1,5 @@
|
|
1
|
-
import { ServerPlugin as ServerPluginInstance } from '@modern-js/server-core';
|
2
|
-
import { ServerPlugin } from '@modern-js/types';
|
3
|
-
import { AppTools, PluginAPI } from '../types';
|
1
|
+
import type { ServerPlugin as ServerPluginInstance } from '@modern-js/server-core';
|
2
|
+
import type { ServerPlugin } from '@modern-js/types';
|
3
|
+
import type { AppTools, PluginAPI } from '../types';
|
4
4
|
export declare function getServerPlugins(api: PluginAPI<AppTools<'shared'>>, metaName?: string): Promise<ServerPlugin[]>;
|
5
5
|
export declare function loadServerPlugins(api: PluginAPI<AppTools<'shared'>>, appDirectory: string, metaName: string): Promise<ServerPluginInstance[]>;
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import { Alias } from '@modern-js/utils';
|
1
|
+
import { type Alias } from '@modern-js/utils';
|
2
2
|
import type { ConfigChain } from '@rsbuild/core';
|
3
|
-
export declare const registerCompiler: (appDir: string
|
3
|
+
export declare const registerCompiler: (appDir: string, distDir: string, alias?: ConfigChain<Alias>) => Promise<void>;
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import { ToRunners } from '@modern-js/core';
|
2
|
-
import { AppToolsHooks } from '../types/hooks';
|
1
|
+
import { type ToRunners } from '@modern-js/core';
|
2
|
+
import type { AppToolsHooks } from '../types/hooks';
|
3
3
|
export declare function restart(hooksRunner: ToRunners<AppToolsHooks>, filename: string): Promise<void>;
|
package/lib/types.d.ts
CHANGED
@@ -36,6 +36,11 @@ declare module '*.png' {
|
|
36
36
|
export default src;
|
37
37
|
}
|
38
38
|
|
39
|
+
declare module '*.avif' {
|
40
|
+
const src: string;
|
41
|
+
export default src;
|
42
|
+
}
|
43
|
+
|
39
44
|
declare module '*.ico' {
|
40
45
|
const src: string;
|
41
46
|
export default src;
|
@@ -91,6 +96,11 @@ declare module '*.png?inline' {
|
|
91
96
|
export default src;
|
92
97
|
}
|
93
98
|
|
99
|
+
declare module '*.avif?inline' {
|
100
|
+
const src: string;
|
101
|
+
export default src;
|
102
|
+
}
|
103
|
+
|
94
104
|
declare module '*.ico?inline' {
|
95
105
|
const src: string;
|
96
106
|
export default src;
|
@@ -137,6 +147,11 @@ declare module '*.png?url' {
|
|
137
147
|
export default src;
|
138
148
|
}
|
139
149
|
|
150
|
+
declare module '*.avif?url' {
|
151
|
+
const src: string;
|
152
|
+
export default src;
|
153
|
+
}
|
154
|
+
|
140
155
|
declare module '*.ico?url' {
|
141
156
|
const src: string;
|
142
157
|
export default src;
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.58.
|
18
|
+
"version": "2.58.2",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/types/index.d.ts",
|
21
21
|
"main": "./dist/cjs/index.js",
|
@@ -77,10 +77,9 @@
|
|
77
77
|
"@babel/parser": "^7.22.15",
|
78
78
|
"@babel/traverse": "^7.23.2",
|
79
79
|
"@babel/types": "^7.24.7",
|
80
|
-
"@rsbuild/core": "1.0.1-beta.
|
80
|
+
"@rsbuild/core": "1.0.1-beta.14",
|
81
81
|
"@rsbuild/plugin-node-polyfill": "1.0.4",
|
82
82
|
"@swc/helpers": "0.5.3",
|
83
|
-
"@ungap/structured-clone": "^1.2.0",
|
84
83
|
"@vercel/nft": "^0.26.4",
|
85
84
|
"es-module-lexer": "^1.1.0",
|
86
85
|
"esbuild": "0.17.19",
|
@@ -89,33 +88,33 @@
|
|
89
88
|
"mlly": "^1.6.1",
|
90
89
|
"pkg-types": "^1.1.0",
|
91
90
|
"std-env": "^3.7.0",
|
92
|
-
"@modern-js/core": "2.58.
|
93
|
-
"@modern-js/node-bundle-require": "2.58.
|
94
|
-
"@modern-js/plugin": "2.58.
|
95
|
-
"@modern-js/plugin-i18n": "2.58.
|
96
|
-
"@modern-js/plugin-
|
97
|
-
"@modern-js/
|
98
|
-
"@modern-js/
|
99
|
-
"@modern-js/
|
100
|
-
"@modern-js/
|
101
|
-
"@modern-js/server": "2.58.
|
102
|
-
"@modern-js/
|
103
|
-
"@modern-js/
|
104
|
-
"@modern-js/
|
105
|
-
"@modern-js/
|
91
|
+
"@modern-js/core": "2.58.2",
|
92
|
+
"@modern-js/node-bundle-require": "2.58.2",
|
93
|
+
"@modern-js/plugin": "2.58.2",
|
94
|
+
"@modern-js/plugin-i18n": "2.58.2",
|
95
|
+
"@modern-js/plugin-data-loader": "2.58.2",
|
96
|
+
"@modern-js/plugin-lint": "2.58.2",
|
97
|
+
"@modern-js/prod-server": "2.58.2",
|
98
|
+
"@modern-js/server": "2.58.2",
|
99
|
+
"@modern-js/rsbuild-plugin-esbuild": "2.58.2",
|
100
|
+
"@modern-js/server-core": "2.58.2",
|
101
|
+
"@modern-js/types": "2.58.2",
|
102
|
+
"@modern-js/server-utils": "2.58.2",
|
103
|
+
"@modern-js/uni-builder": "2.58.2",
|
104
|
+
"@modern-js/utils": "2.58.2"
|
106
105
|
},
|
107
106
|
"devDependencies": {
|
108
|
-
"@rsbuild/plugin-swc": "1.0.1-beta.
|
107
|
+
"@rsbuild/plugin-swc": "1.0.1-beta.14",
|
109
108
|
"@types/babel__traverse": "7.18.5",
|
110
109
|
"@types/jest": "^29",
|
111
|
-
"@types/node": "^
|
110
|
+
"@types/node": "^16",
|
112
111
|
"jest": "^29",
|
113
112
|
"ts-node": "^10.9.1",
|
114
113
|
"tsconfig-paths": "^4.2.0",
|
115
114
|
"typescript": "^5",
|
116
115
|
"webpack": "^5.93.0",
|
117
|
-
"@scripts/
|
118
|
-
"@scripts/
|
116
|
+
"@scripts/jest-config": "2.58.2",
|
117
|
+
"@scripts/build": "2.58.2"
|
119
118
|
},
|
120
119
|
"sideEffects": false,
|
121
120
|
"publishConfig": {
|
@@ -1,166 +0,0 @@
|
|
1
|
-
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
2
|
-
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
3
|
-
import { _ as _type_of } from "@swc/helpers/_/_type_of";
|
4
|
-
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
5
|
-
import path from "path";
|
6
|
-
import fs from "@modern-js/utils/fs-extra";
|
7
|
-
import { logger, removeTailSlash } from "@modern-js/utils";
|
8
|
-
import { createCopyInfo } from "../shared";
|
9
|
-
var builderPluginAdpaterCopy = function(options) {
|
10
|
-
return {
|
11
|
-
name: "builder-plugin-adapter-rspack-copy",
|
12
|
-
setup: function setup(api) {
|
13
|
-
var publicPath;
|
14
|
-
api.modifyBundlerChain(function(chain, param) {
|
15
|
-
var CHAIN_ID = param.CHAIN_ID;
|
16
|
-
chain.plugin(CHAIN_ID.PLUGIN.COPY).tap(function(args) {
|
17
|
-
var _args_;
|
18
|
-
return [
|
19
|
-
{
|
20
|
-
patterns: _to_consumable_array(((_args_ = args[0]) === null || _args_ === void 0 ? void 0 : _args_.patterns) || []).concat(_to_consumable_array(createConfigBuiltinCopy(options)))
|
21
|
-
}
|
22
|
-
];
|
23
|
-
});
|
24
|
-
});
|
25
|
-
api.modifyRspackConfig(function(config) {
|
26
|
-
var _config_output;
|
27
|
-
publicPath = (_config_output = config.output) === null || _config_output === void 0 ? void 0 : _config_output.publicPath;
|
28
|
-
});
|
29
|
-
api.onDevCompileDone(/* @__PURE__ */ _async_to_generator(function() {
|
30
|
-
return _ts_generator(this, function(_state) {
|
31
|
-
switch (_state.label) {
|
32
|
-
case 0:
|
33
|
-
return [
|
34
|
-
4,
|
35
|
-
transformHtmlFiles()
|
36
|
-
];
|
37
|
-
case 1:
|
38
|
-
_state.sent();
|
39
|
-
return [
|
40
|
-
2
|
41
|
-
];
|
42
|
-
}
|
43
|
-
});
|
44
|
-
}));
|
45
|
-
api.onAfterBuild(/* @__PURE__ */ _async_to_generator(function() {
|
46
|
-
return _ts_generator(this, function(_state) {
|
47
|
-
switch (_state.label) {
|
48
|
-
case 0:
|
49
|
-
return [
|
50
|
-
4,
|
51
|
-
transformHtmlFiles()
|
52
|
-
];
|
53
|
-
case 1:
|
54
|
-
_state.sent();
|
55
|
-
return [
|
56
|
-
2
|
57
|
-
];
|
58
|
-
}
|
59
|
-
});
|
60
|
-
}));
|
61
|
-
function transformHtmlFiles() {
|
62
|
-
return _transformHtmlFiles.apply(this, arguments);
|
63
|
-
}
|
64
|
-
function _transformHtmlFiles() {
|
65
|
-
_transformHtmlFiles = /** transform public/*.html manaully */
|
66
|
-
_async_to_generator(function() {
|
67
|
-
var _normalizedConfig_output_distPath, normalizedConfig, publicDir, HTML_REGEXP, filepaths;
|
68
|
-
return _ts_generator(this, function(_state) {
|
69
|
-
switch (_state.label) {
|
70
|
-
case 0:
|
71
|
-
normalizedConfig = options.normalizedConfig;
|
72
|
-
publicDir = path.resolve(((_normalizedConfig_output_distPath = normalizedConfig.output.distPath) === null || _normalizedConfig_output_distPath === void 0 ? void 0 : _normalizedConfig_output_distPath.root) || "./dist", "./public");
|
73
|
-
if (!fs.existsSync(publicDir) || !fs.statSync(publicDir).isDirectory()) {
|
74
|
-
return [
|
75
|
-
2
|
76
|
-
];
|
77
|
-
}
|
78
|
-
HTML_REGEXP = /\.html?$/;
|
79
|
-
return [
|
80
|
-
4,
|
81
|
-
fs.readdir(publicDir)
|
82
|
-
];
|
83
|
-
case 1:
|
84
|
-
filepaths = _state.sent().map(function(file) {
|
85
|
-
return path.resolve(publicDir, file);
|
86
|
-
});
|
87
|
-
return [
|
88
|
-
4,
|
89
|
-
Promise.all(filepaths.filter(function(file) {
|
90
|
-
return HTML_REGEXP.test(file);
|
91
|
-
}).map(function() {
|
92
|
-
var _ref = _async_to_generator(function(file) {
|
93
|
-
var content;
|
94
|
-
return _ts_generator(this, function(_state2) {
|
95
|
-
switch (_state2.label) {
|
96
|
-
case 0:
|
97
|
-
return [
|
98
|
-
4,
|
99
|
-
fs.readFile(file, "utf-8")
|
100
|
-
];
|
101
|
-
case 1:
|
102
|
-
content = _state2.sent();
|
103
|
-
if (!(publicPath && typeof publicPath === "string"))
|
104
|
-
return [
|
105
|
-
3,
|
106
|
-
3
|
107
|
-
];
|
108
|
-
return [
|
109
|
-
4,
|
110
|
-
fs.writeFile(file, content.replace(/<%=\s*assetPrefix\s*%>/g, removeTailSlash(publicPath)))
|
111
|
-
];
|
112
|
-
case 2:
|
113
|
-
_state2.sent();
|
114
|
-
return [
|
115
|
-
3,
|
116
|
-
5
|
117
|
-
];
|
118
|
-
case 3:
|
119
|
-
logger.warn("Expect get a string from `publicPath`, but receive `".concat(typeof publicPath === "undefined" ? "undefined" : _type_of(publicPath), "`."));
|
120
|
-
return [
|
121
|
-
4,
|
122
|
-
fs.writeFile(file, content.replace(/<%=\s*assetPrefix\s*%>/g, removeTailSlash("/")))
|
123
|
-
];
|
124
|
-
case 4:
|
125
|
-
_state2.sent();
|
126
|
-
_state2.label = 5;
|
127
|
-
case 5:
|
128
|
-
return [
|
129
|
-
2
|
130
|
-
];
|
131
|
-
}
|
132
|
-
});
|
133
|
-
});
|
134
|
-
return function(file) {
|
135
|
-
return _ref.apply(this, arguments);
|
136
|
-
};
|
137
|
-
}()))
|
138
|
-
];
|
139
|
-
case 2:
|
140
|
-
_state.sent();
|
141
|
-
return [
|
142
|
-
2
|
143
|
-
];
|
144
|
-
}
|
145
|
-
});
|
146
|
-
});
|
147
|
-
return _transformHtmlFiles.apply(this, arguments);
|
148
|
-
}
|
149
|
-
}
|
150
|
-
};
|
151
|
-
};
|
152
|
-
function createConfigBuiltinCopy(options) {
|
153
|
-
var normalizedConfig = options.normalizedConfig, appContext = options.appContext;
|
154
|
-
var publicDir = createCopyInfo(appContext, normalizedConfig).publicDir;
|
155
|
-
return [
|
156
|
-
{
|
157
|
-
from: "**/*",
|
158
|
-
to: "public",
|
159
|
-
context: publicDir,
|
160
|
-
noErrorOnMissing: true
|
161
|
-
}
|
162
|
-
];
|
163
|
-
}
|
164
|
-
export {
|
165
|
-
builderPluginAdpaterCopy
|
166
|
-
};
|
@@ -1,34 +0,0 @@
|
|
1
|
-
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
2
|
-
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
3
|
-
import { generateBuilder } from "../generator";
|
4
|
-
import { builderPluginAdpaterCopy } from "./adapterCopy";
|
5
|
-
function createRspackBuilderForModern(options) {
|
6
|
-
return _createRspackBuilderForModern.apply(this, arguments);
|
7
|
-
}
|
8
|
-
function _createRspackBuilderForModern() {
|
9
|
-
_createRspackBuilderForModern = _async_to_generator(function(options) {
|
10
|
-
var builder;
|
11
|
-
return _ts_generator(this, function(_state) {
|
12
|
-
switch (_state.label) {
|
13
|
-
case 0:
|
14
|
-
return [
|
15
|
-
4,
|
16
|
-
generateBuilder(options, "rspack")
|
17
|
-
];
|
18
|
-
case 1:
|
19
|
-
builder = _state.sent();
|
20
|
-
builder.addPlugins([
|
21
|
-
builderPluginAdpaterCopy(options)
|
22
|
-
]);
|
23
|
-
return [
|
24
|
-
2,
|
25
|
-
builder
|
26
|
-
];
|
27
|
-
}
|
28
|
-
});
|
29
|
-
});
|
30
|
-
return _createRspackBuilderForModern.apply(this, arguments);
|
31
|
-
}
|
32
|
-
export {
|
33
|
-
createRspackBuilderForModern
|
34
|
-
};
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
2
|
-
import { createPublicPattern } from "./createCopyPattern";
|
3
|
-
var builderPluginAdapterModern = function(options) {
|
4
|
-
return {
|
5
|
-
name: "builder-plugin-adapter-modern",
|
6
|
-
setup: function setup(api) {
|
7
|
-
var modernConfig = options.normalizedConfig, appContext = options.appContext;
|
8
|
-
api.modifyWebpackChain(function(chain, param) {
|
9
|
-
var CHAIN_ID = param.CHAIN_ID;
|
10
|
-
if (chain.plugins.has(CHAIN_ID.PLUGIN.COPY)) {
|
11
|
-
var defaultCopyPattern = createPublicPattern(appContext, modernConfig, chain);
|
12
|
-
chain.plugin(CHAIN_ID.PLUGIN.COPY).tap(function(args) {
|
13
|
-
var _args_;
|
14
|
-
return [
|
15
|
-
{
|
16
|
-
patterns: _to_consumable_array(((_args_ = args[0]) === null || _args_ === void 0 ? void 0 : _args_.patterns) || []).concat([
|
17
|
-
defaultCopyPattern
|
18
|
-
])
|
19
|
-
}
|
20
|
-
];
|
21
|
-
});
|
22
|
-
}
|
23
|
-
});
|
24
|
-
}
|
25
|
-
};
|
26
|
-
};
|
27
|
-
export {
|
28
|
-
builderPluginAdapterModern
|
29
|
-
};
|
@@ -1,44 +0,0 @@
|
|
1
|
-
import { removeTailSlash } from "@modern-js/utils";
|
2
|
-
import { createCopyInfo } from "../shared";
|
3
|
-
var minifiedJsRexExp = /\.min\.js/;
|
4
|
-
var info = function(file) {
|
5
|
-
return {
|
6
|
-
// If the file name ends with `.min.js`, we assume it's a compressed file.
|
7
|
-
// So we don't want copy-webpack-plugin to minify it.
|
8
|
-
// ref: https://github.com/webpack-contrib/copy-webpack-plugin#info
|
9
|
-
minimized: minifiedJsRexExp.test(file.sourceFilename)
|
10
|
-
};
|
11
|
-
};
|
12
|
-
function createPublicPattern(appContext, config, chain) {
|
13
|
-
var publicDir = createCopyInfo(appContext, config).publicDir;
|
14
|
-
return {
|
15
|
-
info,
|
16
|
-
from: "**/*",
|
17
|
-
to: "public",
|
18
|
-
context: publicDir,
|
19
|
-
noErrorOnMissing: true,
|
20
|
-
// eslint-disable-next-line node/prefer-global/buffer
|
21
|
-
transform: function(content, absoluteFrom) {
|
22
|
-
if (!/\.html?$/.test(absoluteFrom)) {
|
23
|
-
return content;
|
24
|
-
}
|
25
|
-
return content.toString("utf8").replace(/<%=\s*assetPrefix\s*%>/g, removeTailSlash(chain.output.get("publicPath")));
|
26
|
-
}
|
27
|
-
};
|
28
|
-
}
|
29
|
-
function createUploadPattern(appContext, config) {
|
30
|
-
var uploadDir = createCopyInfo(appContext, config).uploadDir;
|
31
|
-
return {
|
32
|
-
// rspack copy info structure is inconsistent with webpack, it only used in webpack mode
|
33
|
-
// @ts-expect-error
|
34
|
-
info,
|
35
|
-
from: "**/*",
|
36
|
-
to: "upload",
|
37
|
-
context: uploadDir,
|
38
|
-
noErrorOnMissing: true
|
39
|
-
};
|
40
|
-
}
|
41
|
-
export {
|
42
|
-
createPublicPattern,
|
43
|
-
createUploadPattern
|
44
|
-
};
|
@@ -1,52 +0,0 @@
|
|
1
|
-
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
2
|
-
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
3
|
-
import { generateBuilder } from "../generator";
|
4
|
-
import { builderPluginAdapterModern } from "./adapterModern";
|
5
|
-
function createWebpackBuilderForModern(options) {
|
6
|
-
return _createWebpackBuilderForModern.apply(this, arguments);
|
7
|
-
}
|
8
|
-
function _createWebpackBuilderForModern() {
|
9
|
-
_createWebpackBuilderForModern = _async_to_generator(function(options) {
|
10
|
-
var builder, normalizedConfig, _normalizedConfig_tools, esbuildOptions, pluginEsbuild;
|
11
|
-
return _ts_generator(this, function(_state) {
|
12
|
-
switch (_state.label) {
|
13
|
-
case 0:
|
14
|
-
return [
|
15
|
-
4,
|
16
|
-
generateBuilder(options, "webpack")
|
17
|
-
];
|
18
|
-
case 1:
|
19
|
-
builder = _state.sent();
|
20
|
-
normalizedConfig = options.normalizedConfig;
|
21
|
-
if (!normalizedConfig.tools.esbuild)
|
22
|
-
return [
|
23
|
-
3,
|
24
|
-
3
|
25
|
-
];
|
26
|
-
_normalizedConfig_tools = normalizedConfig.tools, esbuildOptions = _normalizedConfig_tools.esbuild;
|
27
|
-
return [
|
28
|
-
4,
|
29
|
-
import("@modern-js/rsbuild-plugin-esbuild")
|
30
|
-
];
|
31
|
-
case 2:
|
32
|
-
pluginEsbuild = _state.sent().pluginEsbuild;
|
33
|
-
builder.addPlugins([
|
34
|
-
pluginEsbuild(esbuildOptions)
|
35
|
-
]);
|
36
|
-
_state.label = 3;
|
37
|
-
case 3:
|
38
|
-
builder.addPlugins([
|
39
|
-
builderPluginAdapterModern(options)
|
40
|
-
]);
|
41
|
-
return [
|
42
|
-
2,
|
43
|
-
builder
|
44
|
-
];
|
45
|
-
}
|
46
|
-
});
|
47
|
-
});
|
48
|
-
return _createWebpackBuilderForModern.apply(this, arguments);
|
49
|
-
}
|
50
|
-
export {
|
51
|
-
createWebpackBuilderForModern
|
52
|
-
};
|
@@ -1,37 +0,0 @@
|
|
1
|
-
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
2
|
-
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
3
|
-
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
4
|
-
import { createUploadPattern } from "../builder-webpack/createCopyPattern";
|
5
|
-
function modifyOutputConfig(config, appContext) {
|
6
|
-
var defaultCopyPattern = createUploadPattern(appContext, config);
|
7
|
-
var copy = config.output.copy;
|
8
|
-
var copyOptions = Array.isArray(copy) ? copy : copy === null || copy === void 0 ? void 0 : copy.patterns;
|
9
|
-
var builderCopy = _to_consumable_array(copyOptions || []).concat([
|
10
|
-
defaultCopyPattern
|
11
|
-
]);
|
12
|
-
config.output = _object_spread_props(_object_spread({}, config.output), {
|
13
|
-
copy: builderCopy
|
14
|
-
});
|
15
|
-
}
|
16
|
-
function createBuilderProviderConfig(resolveConfig, appContext) {
|
17
|
-
var htmlConfig = _object_spread({}, resolveConfig.html);
|
18
|
-
if (!htmlConfig.template) {
|
19
|
-
htmlConfig.templateByEntries = _object_spread({}, appContext.htmlTemplates, htmlConfig.templateByEntries);
|
20
|
-
}
|
21
|
-
var config = _object_spread_props(_object_spread({}, resolveConfig), {
|
22
|
-
plugins: [],
|
23
|
-
dev: _object_spread_props(_object_spread({}, resolveConfig.dev), {
|
24
|
-
port: appContext.port
|
25
|
-
}),
|
26
|
-
html: htmlConfig,
|
27
|
-
output: _object_spread_props(_object_spread({}, resolveConfig.output), {
|
28
|
-
// We need to do this in the app-tools prepare hook because some files will be generated into the dist directory in the analyze process
|
29
|
-
cleanDistPath: false
|
30
|
-
})
|
31
|
-
});
|
32
|
-
modifyOutputConfig(config, appContext);
|
33
|
-
return config;
|
34
|
-
}
|
35
|
-
export {
|
36
|
-
createBuilderProviderConfig
|
37
|
-
};
|
@@ -1,81 +0,0 @@
|
|
1
|
-
import { isProd, isServiceWorker, isSSR, isUseSSRBundle } from "@modern-js/utils";
|
2
|
-
import { SERVICE_WORKER_ENVIRONMENT_NAME } from "@modern-js/uni-builder";
|
3
|
-
function getBuilderEnvironments(normalizedConfig, appContext) {
|
4
|
-
var entries = {};
|
5
|
-
var _appContext_entrypoints = appContext.entrypoints, entrypoints = _appContext_entrypoints === void 0 ? [] : _appContext_entrypoints, checkedEntries = appContext.checkedEntries;
|
6
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
7
|
-
try {
|
8
|
-
for (var _iterator = entrypoints[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
9
|
-
var _step_value = _step.value, entryName = _step_value.entryName, internalEntry = _step_value.internalEntry, entry = _step_value.entry;
|
10
|
-
if (checkedEntries && !checkedEntries.includes(entryName)) {
|
11
|
-
continue;
|
12
|
-
}
|
13
|
-
var finalEntry = internalEntry || entry;
|
14
|
-
if (entryName in entries) {
|
15
|
-
entries[entryName].push(finalEntry);
|
16
|
-
} else {
|
17
|
-
entries[entryName] = [
|
18
|
-
finalEntry
|
19
|
-
];
|
20
|
-
}
|
21
|
-
}
|
22
|
-
} catch (err) {
|
23
|
-
_didIteratorError = true;
|
24
|
-
_iteratorError = err;
|
25
|
-
} finally {
|
26
|
-
try {
|
27
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
28
|
-
_iterator.return();
|
29
|
-
}
|
30
|
-
} finally {
|
31
|
-
if (_didIteratorError) {
|
32
|
-
throw _iteratorError;
|
33
|
-
}
|
34
|
-
}
|
35
|
-
}
|
36
|
-
var serverEntries = {};
|
37
|
-
for (var entry1 in entries) {
|
38
|
-
var v = entries[entry1];
|
39
|
-
serverEntries[entry1] = v.map(function(entry2) {
|
40
|
-
return entry2.replace("index.jsx", "index.server.jsx");
|
41
|
-
}).map(function(entry2) {
|
42
|
-
return entry2.replace("bootstrap.jsx", "bootstrap.server.jsx");
|
43
|
-
});
|
44
|
-
}
|
45
|
-
var environments = {
|
46
|
-
web: {
|
47
|
-
output: {
|
48
|
-
target: "web"
|
49
|
-
},
|
50
|
-
source: {
|
51
|
-
entry: entries
|
52
|
-
}
|
53
|
-
}
|
54
|
-
};
|
55
|
-
var useNodeTarget = isProd() ? isUseSSRBundle(normalizedConfig) : isSSR(normalizedConfig);
|
56
|
-
if (useNodeTarget) {
|
57
|
-
environments.node = {
|
58
|
-
output: {
|
59
|
-
target: "node"
|
60
|
-
},
|
61
|
-
source: {
|
62
|
-
entry: serverEntries
|
63
|
-
}
|
64
|
-
};
|
65
|
-
}
|
66
|
-
var useWorkerTarget = isServiceWorker(normalizedConfig);
|
67
|
-
if (useWorkerTarget) {
|
68
|
-
environments[SERVICE_WORKER_ENVIRONMENT_NAME] = {
|
69
|
-
output: {
|
70
|
-
target: "web-worker"
|
71
|
-
},
|
72
|
-
source: {
|
73
|
-
entry: serverEntries
|
74
|
-
}
|
75
|
-
};
|
76
|
-
}
|
77
|
-
return environments;
|
78
|
-
}
|
79
|
-
export {
|
80
|
-
getBuilderEnvironments
|
81
|
-
};
|
@@ -1,94 +0,0 @@
|
|
1
|
-
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
2
|
-
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
3
|
-
import { createUniBuilder } from "@modern-js/uni-builder";
|
4
|
-
import { mergeRsbuildConfig } from "@rsbuild/core";
|
5
|
-
import { createBuilderProviderConfig } from "./createBuilderProviderConfig";
|
6
|
-
import { getBuilderEnvironments } from "./getBuilderEnvironments";
|
7
|
-
function generateBuilder(options, bundlerType) {
|
8
|
-
return _generateBuilder.apply(this, arguments);
|
9
|
-
}
|
10
|
-
function _generateBuilder() {
|
11
|
-
_generateBuilder = _async_to_generator(function(options, bundlerType) {
|
12
|
-
var normalizedConfig, appContext, builderConfig, environments, builder;
|
13
|
-
return _ts_generator(this, function(_state) {
|
14
|
-
switch (_state.label) {
|
15
|
-
case 0:
|
16
|
-
normalizedConfig = options.normalizedConfig, appContext = options.appContext;
|
17
|
-
builderConfig = createBuilderProviderConfig(normalizedConfig, appContext);
|
18
|
-
environments = getBuilderEnvironments(normalizedConfig, appContext);
|
19
|
-
builderConfig.environments = builderConfig.environments ? mergeRsbuildConfig(environments, builderConfig.environments) : environments;
|
20
|
-
return [
|
21
|
-
4,
|
22
|
-
createUniBuilder({
|
23
|
-
cwd: appContext.appDirectory,
|
24
|
-
frameworkConfigPath: appContext.configFile || void 0,
|
25
|
-
bundlerType,
|
26
|
-
config: builderConfig
|
27
|
-
})
|
28
|
-
];
|
29
|
-
case 1:
|
30
|
-
builder = _state.sent();
|
31
|
-
return [
|
32
|
-
4,
|
33
|
-
applyBuilderPlugins(builder, options)
|
34
|
-
];
|
35
|
-
case 2:
|
36
|
-
_state.sent();
|
37
|
-
return [
|
38
|
-
2,
|
39
|
-
builder
|
40
|
-
];
|
41
|
-
}
|
42
|
-
});
|
43
|
-
});
|
44
|
-
return _generateBuilder.apply(this, arguments);
|
45
|
-
}
|
46
|
-
function applyBuilderPlugins(builder, options) {
|
47
|
-
return _applyBuilderPlugins.apply(this, arguments);
|
48
|
-
}
|
49
|
-
function _applyBuilderPlugins() {
|
50
|
-
_applyBuilderPlugins = _async_to_generator(function(builder, options) {
|
51
|
-
var _ref, builderPluginAdapterBasic, builderPluginAdapterHtml, builderPluginAdapterSSR, builderPluginAdapterWorker, normalizedConfig, pluginNodePolyfill;
|
52
|
-
return _ts_generator(this, function(_state) {
|
53
|
-
switch (_state.label) {
|
54
|
-
case 0:
|
55
|
-
return [
|
56
|
-
4,
|
57
|
-
import("../shared/builderPlugins")
|
58
|
-
];
|
59
|
-
case 1:
|
60
|
-
_ref = _state.sent(), builderPluginAdapterBasic = _ref.builderPluginAdapterBasic, builderPluginAdapterHtml = _ref.builderPluginAdapterHtml, builderPluginAdapterSSR = _ref.builderPluginAdapterSSR, builderPluginAdapterWorker = _ref.builderPluginAdapterWorker;
|
61
|
-
builder.addPlugins([
|
62
|
-
builderPluginAdapterBasic(),
|
63
|
-
builderPluginAdapterSSR(options),
|
64
|
-
builderPluginAdapterHtml(options),
|
65
|
-
builderPluginAdapterWorker()
|
66
|
-
]);
|
67
|
-
normalizedConfig = options.normalizedConfig;
|
68
|
-
if (!!normalizedConfig.output.disableNodePolyfill)
|
69
|
-
return [
|
70
|
-
3,
|
71
|
-
3
|
72
|
-
];
|
73
|
-
return [
|
74
|
-
4,
|
75
|
-
import("@rsbuild/plugin-node-polyfill")
|
76
|
-
];
|
77
|
-
case 2:
|
78
|
-
pluginNodePolyfill = _state.sent().pluginNodePolyfill;
|
79
|
-
builder.addPlugins([
|
80
|
-
pluginNodePolyfill()
|
81
|
-
]);
|
82
|
-
_state.label = 3;
|
83
|
-
case 3:
|
84
|
-
return [
|
85
|
-
2
|
86
|
-
];
|
87
|
-
}
|
88
|
-
});
|
89
|
-
});
|
90
|
-
return _applyBuilderPlugins.apply(this, arguments);
|
91
|
-
}
|
92
|
-
export {
|
93
|
-
generateBuilder
|
94
|
-
};
|