@modern-js/app-tools 2.45.0 → 2.45.1-alpha.0
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/dist/cjs/analyze/nestedRoutes.js +1 -1
- package/dist/cjs/analyze/templates.js +0 -2
- package/dist/cjs/builder/builder-rspack/index.js +1 -2
- package/dist/cjs/builder/builder-webpack/createCopyPattern.js +2 -0
- package/dist/cjs/builder/builder-webpack/index.js +3 -4
- package/dist/cjs/builder/generator/createBuilderOptions.js +2 -3
- package/dist/cjs/builder/generator/createBuilderProviderConfig.js +1 -0
- package/dist/cjs/builder/generator/index.js +9 -8
- package/dist/cjs/builder/index.js +2 -10
- package/dist/cjs/builder/shared/builderPlugins/adapterBasic.js +1 -3
- package/dist/cjs/builder/shared/builderPlugins/adapterHtml.js +3 -3
- package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +4 -4
- package/dist/cjs/commands/dev.js +0 -1
- package/dist/cjs/config/default.js +12 -12
- package/dist/cjs/initialize/index.js +1 -1
- package/dist/esm/analyze/nestedRoutes.js +1 -1
- package/dist/esm/analyze/templates.js +1 -1
- package/dist/esm/builder/builder-rspack/index.js +1 -2
- package/dist/esm/builder/builder-webpack/createCopyPattern.js +2 -0
- package/dist/esm/builder/builder-webpack/index.js +5 -6
- package/dist/esm/builder/generator/createBuilderOptions.js +2 -3
- package/dist/esm/builder/generator/createBuilderProviderConfig.js +1 -0
- package/dist/esm/builder/generator/index.js +14 -12
- package/dist/esm/builder/index.js +5 -30
- package/dist/esm/builder/shared/builderPlugins/adapterBasic.js +1 -3
- package/dist/esm/builder/shared/builderPlugins/adapterHtml.js +1 -1
- package/dist/esm/builder/shared/builderPlugins/adapterSSR.js +3 -3
- package/dist/esm/commands/dev.js +0 -1
- package/dist/esm/config/default.js +20 -15
- package/dist/esm/initialize/index.js +1 -1
- package/dist/esm-node/analyze/nestedRoutes.js +1 -1
- package/dist/esm-node/analyze/templates.js +0 -2
- package/dist/esm-node/builder/builder-rspack/index.js +1 -2
- package/dist/esm-node/builder/builder-webpack/createCopyPattern.js +2 -0
- package/dist/esm-node/builder/builder-webpack/index.js +3 -4
- package/dist/esm-node/builder/generator/createBuilderOptions.js +2 -3
- package/dist/esm-node/builder/generator/createBuilderProviderConfig.js +1 -0
- package/dist/esm-node/builder/generator/index.js +9 -8
- package/dist/esm-node/builder/index.js +2 -10
- package/dist/esm-node/builder/shared/builderPlugins/adapterBasic.js +1 -3
- package/dist/esm-node/builder/shared/builderPlugins/adapterHtml.js +1 -1
- package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.js +3 -3
- package/dist/esm-node/commands/dev.js +0 -1
- package/dist/esm-node/config/default.js +12 -12
- package/dist/esm-node/initialize/index.js +1 -1
- package/dist/types/analyze/generateCode.d.ts +2 -2
- package/dist/types/builder/builder-rspack/adapterCopy.d.ts +2 -3
- package/dist/types/builder/builder-rspack/index.d.ts +1 -1
- package/dist/types/builder/builder-webpack/adapterModern.d.ts +2 -3
- package/dist/types/builder/builder-webpack/createCopyPattern.d.ts +2 -12
- package/dist/types/builder/builder-webpack/index.d.ts +1 -3
- package/dist/types/builder/generator/createBuilderOptions.d.ts +3 -2
- package/dist/types/builder/generator/createBuilderProviderConfig.d.ts +1 -1
- package/dist/types/builder/generator/getBuilderTargets.d.ts +2 -2
- package/dist/types/builder/generator/index.d.ts +4 -6
- package/dist/types/builder/index.d.ts +1 -1
- package/dist/types/builder/shared/builderPlugins/adapterBasic.d.ts +2 -3
- package/dist/types/builder/shared/builderPlugins/adapterHtml.d.ts +3 -3
- package/dist/types/builder/shared/builderPlugins/adapterSSR.d.ts +3 -3
- package/dist/types/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.d.ts +1 -3
- package/dist/types/builder/shared/bundlerPlugins/HtmlBottomTemplate.d.ts +1 -3
- package/dist/types/builder/shared/bundlerPlugins/RouterPlugin.d.ts +3 -5
- package/dist/types/builder/shared/loaders/serverModuleLoader.d.ts +1 -2
- package/dist/types/builder/shared/types.d.ts +0 -7
- package/dist/types/commands/inspect.d.ts +1 -8
- package/dist/types/config/default.d.ts +1 -1
- package/dist/types/config/initialize/inits.d.ts +1 -1
- package/dist/types/defineConfig.d.ts +1 -1
- package/dist/types/types/config/dev.d.ts +2 -2
- package/dist/types/types/config/experiments.d.ts +2 -2
- package/dist/types/types/config/html.d.ts +3 -5
- package/dist/types/types/config/index.d.ts +15 -31
- package/dist/types/types/config/output.d.ts +3 -10
- package/dist/types/types/config/performance.d.ts +3 -6
- package/dist/types/types/config/security.d.ts +2 -7
- package/dist/types/types/config/source.d.ts +2 -7
- package/dist/types/types/config/tools.d.ts +11 -13
- package/dist/types/types/hooks.d.ts +2 -3
- package/dist/types/types/index.d.ts +5 -14
- package/dist/types/types/legacyConfig/output.d.ts +1 -1
- package/dist/types/types/legacyConfig/tools.d.ts +2 -2
- package/package.json +10 -20
@@ -1,23 +1,28 @@
|
|
1
1
|
import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
2
|
-
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
3
|
-
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
4
|
-
import { createDefaultConfig as createDefaultBuilderConfig } from "@modern-js/builder-webpack-provider";
|
5
2
|
import { MAIN_ENTRY_NAME } from "@modern-js/utils";
|
6
3
|
import { getAutoInjectEnv } from "../utils/env";
|
7
|
-
function createDefaultConfig(appContext
|
8
|
-
var
|
9
|
-
var dev = _object_spread_props(_object_spread({}, defaultBuilderConfig.dev), {
|
4
|
+
function createDefaultConfig(appContext) {
|
5
|
+
var dev = {
|
10
6
|
// `dev.port` should not have a default value
|
11
7
|
// because we will use `server.port` by default
|
12
8
|
port: void 0
|
13
|
-
}
|
14
|
-
var output =
|
9
|
+
};
|
10
|
+
var output = {
|
11
|
+
distPath: {
|
12
|
+
root: "dist",
|
13
|
+
html: "html",
|
14
|
+
js: "static/js",
|
15
|
+
css: "static/css",
|
16
|
+
server: "bundles",
|
17
|
+
worker: "worker"
|
18
|
+
},
|
19
|
+
cleanDistPath: true,
|
15
20
|
disableNodePolyfill: true,
|
16
21
|
enableInlineRouteManifests: true,
|
17
22
|
disableInlineRouteManifests: false
|
18
|
-
}
|
23
|
+
};
|
19
24
|
var _obj;
|
20
|
-
var source =
|
25
|
+
var source = {
|
21
26
|
entries: void 0,
|
22
27
|
mainEntryName: MAIN_ENTRY_NAME,
|
23
28
|
enableAsyncEntry: false,
|
@@ -26,9 +31,10 @@ function createDefaultConfig(appContext, bundler) {
|
|
26
31
|
configDir: "./config",
|
27
32
|
globalVars: getAutoInjectEnv(appContext),
|
28
33
|
alias: (_obj = {}, _define_property(_obj, appContext.internalDirAlias, appContext.internalDirectory), _define_property(_obj, appContext.internalSrcAlias, appContext.srcDirectory), _define_property(_obj, "@", appContext.srcDirectory), _define_property(_obj, "@shared", appContext.sharedDirectory), _obj)
|
29
|
-
}
|
30
|
-
var html =
|
34
|
+
};
|
35
|
+
var html = {
|
31
36
|
title: "",
|
37
|
+
mountId: "root",
|
32
38
|
meta: {
|
33
39
|
charset: {
|
34
40
|
charset: "utf-8"
|
@@ -44,7 +50,7 @@ function createDefaultConfig(appContext, bundler) {
|
|
44
50
|
"wap-font-scale": "no",
|
45
51
|
"format-detection": "telephone=no"
|
46
52
|
}
|
47
|
-
}
|
53
|
+
};
|
48
54
|
var server = {
|
49
55
|
routes: void 0,
|
50
56
|
publicRoutes: void 0,
|
@@ -53,7 +59,7 @@ function createDefaultConfig(appContext, bundler) {
|
|
53
59
|
baseUrl: "/",
|
54
60
|
port: 8080
|
55
61
|
};
|
56
|
-
var
|
62
|
+
var tools = {
|
57
63
|
tsChecker: {
|
58
64
|
issue: {
|
59
65
|
include: [
|
@@ -64,7 +70,6 @@ function createDefaultConfig(appContext, bundler) {
|
|
64
70
|
}
|
65
71
|
}
|
66
72
|
};
|
67
|
-
var tools = bundler === "webpack" ? _object_spread({}, defaultBuilderConfig.tools, defaultTsCheckerConfig) : defaultTsCheckerConfig;
|
68
73
|
return {
|
69
74
|
source,
|
70
75
|
output,
|
@@ -23,7 +23,7 @@ function initialize_default(param) {
|
|
23
23
|
api.setAppContext(_object_spread_props(_object_spread({}, appContext), {
|
24
24
|
bundlerType: bundler
|
25
25
|
}));
|
26
|
-
return checkIsLegacyConfig(userConfig) ? createLegacyDefaultConfig(appContext) : createDefaultConfig(appContext
|
26
|
+
return checkIsLegacyConfig(userConfig) ? createLegacyDefaultConfig(appContext) : createDefaultConfig(appContext);
|
27
27
|
};
|
28
28
|
return {
|
29
29
|
config,
|
@@ -108,7 +108,7 @@ const walk = async (dirname, rootDir, alias, entryName, isMainEntry, oldVersion)
|
|
108
108
|
const items = await fs.readdir(dirname);
|
109
109
|
for (const item of items) {
|
110
110
|
const itemPath = path.join(dirname, item);
|
111
|
-
const itemPathWithAlias = replaceWithAlias(alias.basename, itemPath, alias.name);
|
111
|
+
const itemPathWithAlias = getPathWithoutExt(replaceWithAlias(alias.basename, itemPath, alias.name));
|
112
112
|
const extname = path.extname(item);
|
113
113
|
const itemWithoutExt = item.slice(0, -extname.length);
|
114
114
|
const isDirectory2 = (await fs.stat(itemPath)).isDirectory();
|
@@ -1,8 +1,7 @@
|
|
1
|
-
import { builderRspackProvider } from "@modern-js/builder-rspack-provider";
|
2
1
|
import { generateBuilder } from "../generator";
|
3
2
|
import { builderPluginAdpaterCopy } from "./adapterCopy";
|
4
3
|
async function createRspackBuilderForModern(options) {
|
5
|
-
const builder = await generateBuilder(options,
|
4
|
+
const builder = await generateBuilder(options, "rspack");
|
6
5
|
builder.addPlugins([
|
7
6
|
builderPluginAdpaterCopy(options)
|
8
7
|
]);
|
@@ -27,6 +27,8 @@ function createPublicPattern(appContext, config, chain) {
|
|
27
27
|
function createUploadPattern(appContext, config) {
|
28
28
|
const { uploadDir } = createCopyInfo(appContext, config);
|
29
29
|
return {
|
30
|
+
// rspack copy info structure is inconsistent with webpack, it only used in webpack mode
|
31
|
+
// @ts-expect-error
|
30
32
|
info,
|
31
33
|
from: "**/*",
|
32
34
|
to: "upload",
|
@@ -1,14 +1,13 @@
|
|
1
|
-
import { builderWebpackProvider } from "@modern-js/builder-webpack-provider";
|
2
1
|
import { generateBuilder } from "../generator";
|
3
2
|
import { builderPluginAdapterModern } from "./adapterModern";
|
4
3
|
async function createWebpackBuilderForModern(options) {
|
5
|
-
const builder = await generateBuilder(options,
|
4
|
+
const builder = await generateBuilder(options, "webpack");
|
6
5
|
const { normalizedConfig } = options;
|
7
6
|
if (normalizedConfig.tools.esbuild) {
|
8
7
|
const { esbuild: esbuildOptions } = normalizedConfig.tools;
|
9
|
-
const {
|
8
|
+
const { pluginEsbuild } = await import("@rsbuild/plugin-esbuild");
|
10
9
|
builder.addPlugins([
|
11
|
-
|
10
|
+
pluginEsbuild(esbuildOptions)
|
12
11
|
]);
|
13
12
|
}
|
14
13
|
builder.addPlugins([
|
@@ -17,9 +17,8 @@ function createBuilderOptions(target, appContext) {
|
|
17
17
|
return {
|
18
18
|
cwd: appContext.appDirectory,
|
19
19
|
target,
|
20
|
-
|
21
|
-
entry: entries
|
22
|
-
framework: appContext.metaName
|
20
|
+
frameworkConfigPath: appContext.configFile || void 0,
|
21
|
+
entry: entries
|
23
22
|
};
|
24
23
|
}
|
25
24
|
export {
|
@@ -1,16 +1,17 @@
|
|
1
|
-
import {
|
1
|
+
import { createUniBuilder } from "@modern-js/uni-builder";
|
2
2
|
import { createBuilderProviderConfig } from "./createBuilderProviderConfig";
|
3
3
|
import { getBuilderTargets } from "./getBuilderTargets";
|
4
4
|
import { createBuilderOptions } from "./createBuilderOptions";
|
5
|
-
async function generateBuilder(options,
|
5
|
+
async function generateBuilder(options, bundlerType) {
|
6
6
|
const { normalizedConfig, appContext } = options;
|
7
7
|
const builderConfig = createBuilderProviderConfig(normalizedConfig, appContext);
|
8
|
-
const provider = generateProvider({
|
9
|
-
builderConfig
|
10
|
-
});
|
11
8
|
const target = getBuilderTargets(normalizedConfig);
|
12
9
|
const builderOptions = createBuilderOptions(target, appContext);
|
13
|
-
const builder = await
|
10
|
+
const builder = await createUniBuilder({
|
11
|
+
...builderOptions,
|
12
|
+
bundlerType,
|
13
|
+
config: builderConfig
|
14
|
+
});
|
14
15
|
await applyBuilderPlugins(builder, options);
|
15
16
|
return builder;
|
16
17
|
}
|
@@ -23,9 +24,9 @@ async function applyBuilderPlugins(builder, options) {
|
|
23
24
|
]);
|
24
25
|
const { normalizedConfig } = options;
|
25
26
|
if (!normalizedConfig.output.disableNodePolyfill) {
|
26
|
-
const {
|
27
|
+
const { pluginNodePolyfill } = await import("@rsbuild/plugin-node-polyfill");
|
27
28
|
builder.addPlugins([
|
28
|
-
|
29
|
+
pluginNodePolyfill()
|
29
30
|
]);
|
30
31
|
}
|
31
32
|
}
|
@@ -1,15 +1,7 @@
|
|
1
|
-
import { logger } from "@modern-js/utils";
|
2
1
|
async function createBuilderGenerator(bundler) {
|
3
2
|
if (bundler === "rspack") {
|
4
|
-
|
5
|
-
|
6
|
-
const { getRspackVersion } = await import("@modern-js/builder-rspack-provider");
|
7
|
-
const version = await getRspackVersion();
|
8
|
-
logger.info(`Using Rspack v${version}`);
|
9
|
-
return createRspackBuilderForModern;
|
10
|
-
} catch (_) {
|
11
|
-
throw new Error("Failed to use Rspack, please check if you have `@modern-js/builder-rspack-provider` installed");
|
12
|
-
}
|
3
|
+
const { createRspackBuilderForModern } = await import("./builder-rspack");
|
4
|
+
return createRspackBuilderForModern;
|
13
5
|
}
|
14
6
|
const { createWebpackBuilderForModern } = await import("./builder-webpack");
|
15
7
|
return createWebpackBuilderForModern;
|
@@ -9,15 +9,13 @@ const builderPluginAdapterBasic = () => ({
|
|
9
9
|
chain.name("service-worker");
|
10
10
|
} else if (target === "web-worker") {
|
11
11
|
chain.name("worker");
|
12
|
-
} else if (target === "modern-web") {
|
13
|
-
chain.name("modern");
|
14
12
|
} else {
|
15
13
|
chain.name("client");
|
16
14
|
}
|
17
15
|
if (target === "node" || target === "service-worker") {
|
18
16
|
applyNodeCompat(target, chain);
|
19
17
|
}
|
20
|
-
if (target === "web"
|
18
|
+
if (target === "web") {
|
21
19
|
const bareServerModuleReg = /\.(server|node)\.[tj]sx?$/;
|
22
20
|
chain.module.rule(CHAIN_ID.RULE.JS).exclude.add(bareServerModuleReg);
|
23
21
|
chain.module.rule("bare-server-module").test(bareServerModuleReg).use("server-module-loader").loader(require.resolve("../loaders/serverModuleLoader"));
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { isHtmlDisabled, createVirtualModule } from "@
|
1
|
+
import { isHtmlDisabled, createVirtualModule } from "@rsbuild/shared";
|
2
2
|
import { MAIN_ENTRY_NAME, getEntryOptions, removeTailSlash } from "@modern-js/utils";
|
3
3
|
import { template as lodashTemplate } from "@modern-js/utils/lodash";
|
4
4
|
import { BottomTemplatePlugin } from "../bundlerPlugins";
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as path from "path";
|
2
|
-
import { isHtmlDisabled,
|
2
|
+
import { isHtmlDisabled, mergeRsbuildConfig } from "@rsbuild/shared";
|
3
3
|
import { isSSR, fs } from "@modern-js/utils";
|
4
4
|
import { HtmlAsyncChunkPlugin, RouterPlugin } from "../bundlerPlugins";
|
5
5
|
import { getServerCombinedModueFile } from "../../../analyze/utils";
|
@@ -7,9 +7,9 @@ const builderPluginAdapterSSR = (options) => ({
|
|
7
7
|
name: "builder-plugin-adapter-modern-ssr",
|
8
8
|
setup(api) {
|
9
9
|
const { normalizedConfig } = options;
|
10
|
-
api.
|
10
|
+
api.modifyRsbuildConfig((config) => {
|
11
11
|
if (isStreamingSSR(normalizedConfig)) {
|
12
|
-
return
|
12
|
+
return mergeRsbuildConfig(config, {
|
13
13
|
html: {
|
14
14
|
inject: "body"
|
15
15
|
}
|
@@ -1,22 +1,26 @@
|
|
1
|
-
import { createDefaultConfig as createDefaultBuilderConfig } from "@modern-js/builder-webpack-provider";
|
2
1
|
import { MAIN_ENTRY_NAME } from "@modern-js/utils";
|
3
2
|
import { getAutoInjectEnv } from "../utils/env";
|
4
|
-
function createDefaultConfig(appContext
|
5
|
-
const defaultBuilderConfig = createDefaultBuilderConfig();
|
3
|
+
function createDefaultConfig(appContext) {
|
6
4
|
const dev = {
|
7
|
-
...defaultBuilderConfig.dev,
|
8
5
|
// `dev.port` should not have a default value
|
9
6
|
// because we will use `server.port` by default
|
10
7
|
port: void 0
|
11
8
|
};
|
12
9
|
const output = {
|
13
|
-
|
10
|
+
distPath: {
|
11
|
+
root: "dist",
|
12
|
+
html: "html",
|
13
|
+
js: "static/js",
|
14
|
+
css: "static/css",
|
15
|
+
server: "bundles",
|
16
|
+
worker: "worker"
|
17
|
+
},
|
18
|
+
cleanDistPath: true,
|
14
19
|
disableNodePolyfill: true,
|
15
20
|
enableInlineRouteManifests: true,
|
16
21
|
disableInlineRouteManifests: false
|
17
22
|
};
|
18
23
|
const source = {
|
19
|
-
...defaultBuilderConfig.source,
|
20
24
|
entries: void 0,
|
21
25
|
mainEntryName: MAIN_ENTRY_NAME,
|
22
26
|
enableAsyncEntry: false,
|
@@ -32,8 +36,8 @@ function createDefaultConfig(appContext, bundler) {
|
|
32
36
|
}
|
33
37
|
};
|
34
38
|
const html = {
|
35
|
-
...defaultBuilderConfig.html,
|
36
39
|
title: "",
|
40
|
+
mountId: "root",
|
37
41
|
meta: {
|
38
42
|
charset: {
|
39
43
|
charset: "utf-8"
|
@@ -58,7 +62,7 @@ function createDefaultConfig(appContext, bundler) {
|
|
58
62
|
baseUrl: "/",
|
59
63
|
port: 8080
|
60
64
|
};
|
61
|
-
const
|
65
|
+
const tools = {
|
62
66
|
tsChecker: {
|
63
67
|
issue: {
|
64
68
|
include: [
|
@@ -69,10 +73,6 @@ function createDefaultConfig(appContext, bundler) {
|
|
69
73
|
}
|
70
74
|
}
|
71
75
|
};
|
72
|
-
const tools = bundler === "webpack" ? {
|
73
|
-
...defaultBuilderConfig.tools,
|
74
|
-
...defaultTsCheckerConfig
|
75
|
-
} : defaultTsCheckerConfig;
|
76
76
|
return {
|
77
77
|
source,
|
78
78
|
output,
|
@@ -18,7 +18,7 @@ var initialize_default = ({ bundler }) => ({
|
|
18
18
|
...appContext,
|
19
19
|
bundlerType: bundler
|
20
20
|
});
|
21
|
-
return checkIsLegacyConfig(userConfig) ? createLegacyDefaultConfig(appContext) : createDefaultConfig(appContext
|
21
|
+
return checkIsLegacyConfig(userConfig) ? createLegacyDefaultConfig(appContext) : createDefaultConfig(appContext);
|
22
22
|
};
|
23
23
|
return {
|
24
24
|
config,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { IAppContext, PluginAPI } from '@modern-js/core';
|
2
2
|
import type { Entrypoint } from '@modern-js/types';
|
3
|
-
import {
|
3
|
+
import { RspackConfig, WebpackConfig } from '@rsbuild/shared';
|
4
4
|
import { AppNormalizedConfig, AppTools, ImportStatement } from '../types';
|
5
5
|
export declare const createImportStatements: (statements: ImportStatement[]) => string;
|
6
6
|
export declare const generateCode: (appContext: IAppContext, config: AppNormalizedConfig<'shared'>, entrypoints: Entrypoint[], api: PluginAPI<AppTools<'shared'>>) => Promise<{
|
@@ -12,5 +12,5 @@ export declare const generateIndexCode: ({ appContext, api, entrypoints, config,
|
|
12
12
|
entrypoints: Entrypoint[];
|
13
13
|
config: AppNormalizedConfig<'shared'>;
|
14
14
|
importsStatemets: Map<string, ImportStatement[]>;
|
15
|
-
bundlerConfigs?:
|
15
|
+
bundlerConfigs?: RspackConfig[] | WebpackConfig[] | undefined;
|
16
16
|
}) => Promise<void>;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import {
|
2
|
-
import { BuilderPluginAPI } from '@modern-js/builder-rspack-provider';
|
1
|
+
import { RsbuildPlugin } from '@modern-js/uni-builder';
|
3
2
|
import { BuilderOptions } from '../shared';
|
4
|
-
export declare const builderPluginAdpaterCopy: (options: BuilderOptions<'rspack'>) =>
|
3
|
+
export declare const builderPluginAdpaterCopy: (options: BuilderOptions<'rspack'>) => RsbuildPlugin;
|
@@ -1,2 +1,2 @@
|
|
1
1
|
import { BuilderOptions } from '../shared';
|
2
|
-
export declare function createRspackBuilderForModern(options: BuilderOptions<'rspack'>): Promise<import("@modern-js/
|
2
|
+
export declare function createRspackBuilderForModern(options: BuilderOptions<'rspack'>): Promise<import("@modern-js/uni-builder").UniBuilderInstance>;
|
@@ -1,7 +1,6 @@
|
|
1
|
-
import {
|
2
|
-
import type { BuilderPluginAPI } from '@modern-js/builder-webpack-provider';
|
1
|
+
import { RsbuildPlugin } from '@modern-js/uni-builder';
|
3
2
|
import { BuilderOptions } from '../shared';
|
4
3
|
/**
|
5
4
|
* Provides default configuration consistent with modern.js v1
|
6
5
|
*/
|
7
|
-
export declare const builderPluginAdapterModern: (options: BuilderOptions<'webpack'>) =>
|
6
|
+
export declare const builderPluginAdapterModern: (options: BuilderOptions<'webpack'>) => RsbuildPlugin;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/// <reference types="node" />
|
2
|
-
import { WebpackChain } from '@modern-js/builder
|
2
|
+
import { CopyPluginOptions, WebpackChain } from '@modern-js/uni-builder';
|
3
3
|
import type { AppNormalizedConfig, Bundler, IAppContext } from '../../types';
|
4
4
|
export declare function createPublicPattern(appContext: IAppContext, config: AppNormalizedConfig, chain: WebpackChain): {
|
5
5
|
info: (file: {
|
@@ -13,14 +13,4 @@ export declare function createPublicPattern(appContext: IAppContext, config: App
|
|
13
13
|
noErrorOnMissing: boolean;
|
14
14
|
transform: (content: Buffer, absoluteFrom: string) => string | Buffer;
|
15
15
|
};
|
16
|
-
export declare function createUploadPattern<B extends Bundler>(appContext: IAppContext, config: AppNormalizedConfig<B>):
|
17
|
-
info: (file: {
|
18
|
-
sourceFilename: string;
|
19
|
-
}) => {
|
20
|
-
minimized: boolean;
|
21
|
-
};
|
22
|
-
from: string;
|
23
|
-
to: string;
|
24
|
-
context: string;
|
25
|
-
noErrorOnMissing: boolean;
|
26
|
-
};
|
16
|
+
export declare function createUploadPattern<B extends Bundler>(appContext: IAppContext, config: AppNormalizedConfig<B>): CopyPluginOptions['patterns']['0'];
|
@@ -1,4 +1,2 @@
|
|
1
|
-
import { BuilderInstance } from '@modern-js/builder';
|
2
|
-
import { BuilderWebpackProvider } from '@modern-js/builder-webpack-provider';
|
3
1
|
import { BuilderOptions } from '../shared';
|
4
|
-
export declare function createWebpackBuilderForModern(options: BuilderOptions<'webpack'>): Promise<
|
2
|
+
export declare function createWebpackBuilderForModern(options: BuilderOptions<'webpack'>): Promise<import("@modern-js/uni-builder").UniBuilderInstance>;
|
@@ -1,3 +1,4 @@
|
|
1
|
-
import type {
|
1
|
+
import type { CreateUniBuilderOptions } from '@modern-js/uni-builder';
|
2
|
+
import type { RsbuildTarget } from '@rsbuild/shared';
|
2
3
|
import type { IAppContext } from '@modern-js/core';
|
3
|
-
export declare function createBuilderOptions(target:
|
4
|
+
export declare function createBuilderOptions(target: RsbuildTarget | RsbuildTarget[], appContext: IAppContext): Omit<CreateUniBuilderOptions, 'bundlerType' | 'config'>;
|
@@ -1,2 +1,2 @@
|
|
1
1
|
import type { Bundler, IAppContext, AppNormalizedConfig } from '../../types';
|
2
|
-
export declare function createBuilderProviderConfig<B extends Bundler>(resolveConfig: AppNormalizedConfig<B>, appContext: IAppContext): AppNormalizedConfig<B>;
|
2
|
+
export declare function createBuilderProviderConfig<B extends Bundler>(resolveConfig: AppNormalizedConfig<B>, appContext: IAppContext): Omit<AppNormalizedConfig<B>, 'plugins'>;
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import type {
|
1
|
+
import type { RsbuildTarget } from '@rsbuild/shared';
|
2
2
|
import type { AppNormalizedConfig } from '../../types';
|
3
|
-
export declare function getBuilderTargets(normalizedConfig: AppNormalizedConfig<'shared'>):
|
3
|
+
export declare function getBuilderTargets(normalizedConfig: AppNormalizedConfig<'shared'>): RsbuildTarget[];
|
@@ -1,12 +1,10 @@
|
|
1
|
-
import
|
1
|
+
import { UniBuilderInstance } from '@modern-js/uni-builder';
|
2
|
+
import { BundlerType } from '@rsbuild/shared';
|
2
3
|
import { BuilderOptions } from '../shared';
|
3
4
|
import { Bundler } from '../../types';
|
4
|
-
export type GenerateProvider = (c: {
|
5
|
-
builderConfig: any;
|
6
|
-
}) => BuilderProvider;
|
7
5
|
/**
|
8
6
|
* @param options BuilderOptions
|
9
|
-
* @param
|
7
|
+
* @param bundlerType BundlerType
|
10
8
|
* @returns BuilderInstance
|
11
9
|
*/
|
12
|
-
export declare function generateBuilder<B extends Bundler>(options: BuilderOptions<B>,
|
10
|
+
export declare function generateBuilder<B extends Bundler>(options: BuilderOptions<B>, bundlerType: BundlerType): Promise<UniBuilderInstance>;
|
@@ -1 +1 @@
|
|
1
|
-
export declare function createBuilderGenerator(bundler: 'webpack' | 'rspack'): Promise<typeof import("./builder-rspack").createRspackBuilderForModern
|
1
|
+
export declare function createBuilderGenerator(bundler: 'webpack' | 'rspack'): Promise<typeof import("./builder-rspack").createRspackBuilderForModern>;
|
@@ -1,3 +1,2 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
export declare const builderPluginAdapterBasic: () => BuilderPlugin<BuilderPluginAPI>;
|
1
|
+
import { RsbuildPlugin } from '@rsbuild/shared';
|
2
|
+
export declare const builderPluginAdapterBasic: () => RsbuildPlugin;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { RsbuildPlugin } from '@rsbuild/shared';
|
2
2
|
import { Bundler } from '../../../types';
|
3
|
-
import type { BuilderOptions
|
4
|
-
export declare const builderPluginAdapterHtml: <B extends Bundler>(options: BuilderOptions<B>) =>
|
3
|
+
import type { BuilderOptions } from '../types';
|
4
|
+
export declare const builderPluginAdapterHtml: <B extends Bundler>(options: BuilderOptions<B>) => RsbuildPlugin;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { RsbuildPlugin } from '@rsbuild/shared';
|
2
2
|
import type { Bundler } from '../../../types';
|
3
|
-
import type { BuilderOptions
|
4
|
-
export declare const builderPluginAdapterSSR: <B extends Bundler>(options: BuilderOptions<B>) =>
|
3
|
+
import type { BuilderOptions } from '../types';
|
4
|
+
export declare const builderPluginAdapterSSR: <B extends Bundler>(options: BuilderOptions<B>) => RsbuildPlugin;
|
@@ -1,6 +1,4 @@
|
|
1
|
-
import type { webpack } from '@modern-js/builder
|
2
|
-
import type { Rspack } from '@modern-js/builder-rspack-provider';
|
3
|
-
import type HtmlWebpackPlugin from '@modern-js/builder-webpack-provider/html-webpack-plugin';
|
1
|
+
import type { Rspack, webpack, HtmlWebpackPlugin } from '@modern-js/uni-builder';
|
4
2
|
export declare class HtmlAsyncChunkPlugin {
|
5
3
|
name: string;
|
6
4
|
htmlWebpackPlugin: typeof HtmlWebpackPlugin;
|
@@ -1,6 +1,4 @@
|
|
1
|
-
import type { webpack } from '@modern-js/builder
|
2
|
-
import type { Rspack } from '@modern-js/builder-rspack-provider';
|
3
|
-
import type HtmlWebpackPlugin from '@modern-js/builder-webpack-provider/html-webpack-plugin';
|
1
|
+
import type { Rspack, webpack, HtmlWebpackPlugin } from '@modern-js/uni-builder';
|
4
2
|
export declare class BottomTemplatePlugin {
|
5
3
|
htmlWebpackPlugin: typeof HtmlWebpackPlugin;
|
6
4
|
bottomTemplateReg: RegExp;
|
@@ -1,7 +1,5 @@
|
|
1
|
-
import type { webpack } from '@modern-js/builder
|
2
|
-
import type {
|
3
|
-
import type HtmlWebpackPlugin from '@modern-js/builder-webpack-provider/html-webpack-plugin';
|
4
|
-
import type { ScriptLoading } from '@modern-js/builder-shared';
|
1
|
+
import type { Rspack, webpack, HtmlWebpackPlugin } from '@modern-js/uni-builder';
|
2
|
+
import type { ScriptLoading } from '@rsbuild/shared';
|
5
3
|
export interface RouteAssets {
|
6
4
|
[routeId: string]: {
|
7
5
|
chunkIds?: (string | number)[];
|
@@ -12,7 +10,7 @@ export interface RouteAssets {
|
|
12
10
|
type Compiler = webpack.Compiler | Rspack.Compiler;
|
13
11
|
type Options = {
|
14
12
|
HtmlBundlerPlugin: typeof HtmlWebpackPlugin;
|
15
|
-
staticJsDir
|
13
|
+
staticJsDir?: string;
|
16
14
|
enableInlineRouteManifests: boolean;
|
17
15
|
disableFilenameHash?: boolean;
|
18
16
|
scriptLoading?: ScriptLoading;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import type { webpack } from '@modern-js/builder
|
2
|
-
import type { Rspack } from '@modern-js/builder-rspack-provider';
|
1
|
+
import type { webpack, Rspack } from '@modern-js/uni-builder';
|
3
2
|
declare function loader(this: webpack.LoaderContext<void> | Rspack.LoaderContext): string;
|
4
3
|
export default loader;
|
@@ -1,12 +1,5 @@
|
|
1
|
-
import type { BuilderConfig as WebpackBuilderConfig, NormalizedConfig as WebpackNormalizedConfig } from '@modern-js/builder-webpack-provider';
|
2
|
-
import type { BuilderConfig as RspackBuilderConfig, NormalizedConfig as RspackNormalizedConfig } from '@modern-js/builder-rspack-provider';
|
3
|
-
import type { DefaultBuilderPluginAPI } from '@modern-js/builder-shared';
|
4
1
|
import type { Bundler, AppNormalizedConfig, IAppContext } from '../../types';
|
5
|
-
export { WebpackBuilderConfig, RspackBuilderConfig };
|
6
2
|
export type BuilderOptions<B extends Bundler> = {
|
7
3
|
normalizedConfig: AppNormalizedConfig<B>;
|
8
4
|
appContext: IAppContext;
|
9
5
|
};
|
10
|
-
export type BuilderConfig = RspackBuilderConfig | WebpackBuilderConfig;
|
11
|
-
export type BuilderNormalizedConfig = RspackNormalizedConfig | WebpackNormalizedConfig;
|
12
|
-
export type BuilderPluginAPI = DefaultBuilderPluginAPI<BuilderConfig, BuilderNormalizedConfig>;
|
@@ -1,11 +1,4 @@
|
|
1
1
|
import type { PluginAPI } from '@modern-js/core';
|
2
2
|
import type { InspectOptions } from '../utils/types';
|
3
3
|
import type { AppTools } from '../types';
|
4
|
-
export declare const inspect: (api: PluginAPI<AppTools<'shared'>>, options: InspectOptions) => Promise<
|
5
|
-
builderConfig: string;
|
6
|
-
bundlerConfigs: string[];
|
7
|
-
origin: {
|
8
|
-
builderConfig: Record<string, any>;
|
9
|
-
bundlerConfigs: Record<string, any>[];
|
10
|
-
};
|
11
|
-
}>;
|
4
|
+
export declare const inspect: (api: PluginAPI<AppTools<'shared'>>, options: InspectOptions) => Promise<import("@rsbuild/shared").InspectConfigResult<"rspack">>;
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import { IAppContext, AppUserConfig, AppLegacyUserConfig } from '../types';
|
2
|
-
export declare function createDefaultConfig(appContext: IAppContext
|
2
|
+
export declare function createDefaultConfig(appContext: IAppContext): AppUserConfig<'webpack'> | AppUserConfig<'rspack'>;
|
3
3
|
export declare function createLegacyDefaultConfig(appContext: IAppContext): AppLegacyUserConfig;
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import { AppNormalizedConfig, IAppContext } from '../../types';
|
2
|
-
export declare function initHtmlConfig(config: AppNormalizedConfig<'shared'>, appContext: IAppContext):
|
2
|
+
export declare function initHtmlConfig(config: AppNormalizedConfig<'shared'>, appContext: IAppContext): AppNormalizedConfig<'shared'>['html'];
|
3
3
|
export declare function initSourceConfig(config: AppNormalizedConfig<'shared'>, appContext: IAppContext, bundler: 'webpack' | 'rspack'): void;
|
4
4
|
export declare function createBuilderModuleScope(config: AppNormalizedConfig<'webpack'>): (string | RegExp)[] | undefined;
|
@@ -4,7 +4,7 @@ import type { AppLegacyUserConfig, AppUserConfig } from './types';
|
|
4
4
|
* This function helps you to autocomplete configuration types.
|
5
5
|
* It accepts a direct config object, or a function that returns a config.
|
6
6
|
*/
|
7
|
-
export declare const defineConfig: <B extends "
|
7
|
+
export declare const defineConfig: <B extends "rspack" | "webpack" = "webpack">(config: UserConfigExport<AppUserConfig<B_1>>) => UserConfigExport<AppUserConfig<B_1>>;
|
8
8
|
/**
|
9
9
|
* @deprecated Please use `defineConfig` instead.
|
10
10
|
* `defineLegacyConfig` will be removed in the future major version.
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import type {
|
2
|
-
type BuilderDevConfig = Required<
|
1
|
+
import type { UniBuilderConfig } from '@modern-js/uni-builder';
|
2
|
+
type BuilderDevConfig = Required<UniBuilderConfig>['dev'];
|
3
3
|
export type DevProxyOptions = string | Record<string, string>;
|
4
4
|
export interface DevUserConfig extends BuilderDevConfig {
|
5
5
|
/**
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import type {
|
2
|
-
export type BuilderExperimentsConfig = Required<
|
1
|
+
import type { UniBuilderConfig } from '@modern-js/uni-builder';
|
2
|
+
export type BuilderExperimentsConfig = Required<UniBuilderConfig>['experiments'];
|
3
3
|
export type ExperimentsUserConfig = BuilderExperimentsConfig;
|
@@ -1,5 +1,3 @@
|
|
1
|
-
import {
|
2
|
-
import type {
|
3
|
-
export type
|
4
|
-
export type HtmlUserConfig = UnwrapBuilderConfig<WebpackBuilderConfig, 'html'>;
|
5
|
-
export type RsHtmlUserConfig = UnwrapBuilderConfig<RspackBuilderConfig, 'html'>;
|
1
|
+
import type { UniBuilderConfig } from '@modern-js/uni-builder';
|
2
|
+
import type { UnwrapBuilderConfig } from '../utils';
|
3
|
+
export type HtmlUserConfig = UnwrapBuilderConfig<UniBuilderConfig, 'html'>;
|