@rsbuild/webpack 0.1.8 → 0.2.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/core/initConfigs.js +2 -2
- package/dist/core/inspectConfig.d.ts +2 -20
- package/dist/core/inspectConfig.js +3 -3
- package/dist/plugins/css.d.ts +1 -2
- package/dist/plugins/css.js +3 -6
- package/dist/plugins/less.js +2 -2
- package/dist/plugins/output.js +2 -2
- package/dist/plugins/progress.js +1 -1
- package/dist/plugins/resolve.js +0 -1
- package/dist/plugins/sass.js +2 -2
- package/dist/plugins/server.d.ts +2 -0
- package/dist/plugins/{basic.js → server.js} +32 -20
- package/dist/provider.js +16 -2
- package/dist/shared.js +2 -3
- package/package.json +6 -5
- package/dist/core/createContext.d.ts +0 -13
- package/dist/core/createContext.js +0 -56
- package/dist/plugins/basic.d.ts +0 -5
- /package/dist/{ProgressPlugin → progress}/ProgressPlugin.d.ts +0 -0
- /package/dist/{ProgressPlugin → progress}/ProgressPlugin.js +0 -0
- /package/dist/{ProgressPlugin → progress}/helpers/bar.d.ts +0 -0
- /package/dist/{ProgressPlugin → progress}/helpers/bar.js +0 -0
- /package/dist/{ProgressPlugin → progress}/helpers/bus.d.ts +0 -0
- /package/dist/{ProgressPlugin → progress}/helpers/bus.js +0 -0
- /package/dist/{ProgressPlugin → progress}/helpers/index.d.ts +0 -0
- /package/dist/{ProgressPlugin → progress}/helpers/index.js +0 -0
- /package/dist/{ProgressPlugin → progress}/helpers/log.d.ts +0 -0
- /package/dist/{ProgressPlugin → progress}/helpers/log.js +0 -0
- /package/dist/{ProgressPlugin → progress}/helpers/nonTty.d.ts +0 -0
- /package/dist/{ProgressPlugin → progress}/helpers/nonTty.js +0 -0
- /package/dist/{ProgressPlugin → progress}/helpers/percentage.d.ts +0 -0
- /package/dist/{ProgressPlugin → progress}/helpers/percentage.js +0 -0
- /package/dist/{ProgressPlugin → progress}/helpers/type.d.ts +0 -0
- /package/dist/{ProgressPlugin → progress}/helpers/type.js +0 -0
- /package/dist/{ProgressPlugin → progress}/helpers/utils.d.ts +0 -0
- /package/dist/{ProgressPlugin → progress}/helpers/utils.js +0 -0
package/dist/core/initConfigs.js
CHANGED
|
@@ -30,11 +30,11 @@ async function initConfigs({
|
|
|
30
30
|
pluginStore,
|
|
31
31
|
rsbuildOptions
|
|
32
32
|
}) {
|
|
33
|
-
await (0, import_provider.initRsbuildConfig)({
|
|
33
|
+
const normalizedConfig = await (0, import_provider.initRsbuildConfig)({
|
|
34
34
|
context,
|
|
35
35
|
pluginStore
|
|
36
36
|
});
|
|
37
|
-
const targets =
|
|
37
|
+
const { targets } = normalizedConfig.output;
|
|
38
38
|
const webpackConfigs = await Promise.all(
|
|
39
39
|
targets.map((target) => (0, import_webpackConfig.generateWebpackConfig)({ target, context }))
|
|
40
40
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InitConfigsOptions } from './initConfigs';
|
|
2
|
-
import { InspectConfigOptions } from '@rsbuild/shared';
|
|
2
|
+
import { type InspectConfigResult, type InspectConfigOptions } from '@rsbuild/shared';
|
|
3
3
|
import type { WebpackConfig } from '../types';
|
|
4
4
|
export declare function inspectConfig({
|
|
5
5
|
context,
|
|
@@ -10,22 +10,4 @@ export declare function inspectConfig({
|
|
|
10
10
|
}: InitConfigsOptions & {
|
|
11
11
|
inspectOptions?: InspectConfigOptions;
|
|
12
12
|
bundlerConfigs?: WebpackConfig[];
|
|
13
|
-
}): Promise<
|
|
14
|
-
rsbuildConfig: string;
|
|
15
|
-
bundlerConfigs: string[];
|
|
16
|
-
origin: {
|
|
17
|
-
rsbuildConfig: {
|
|
18
|
-
pluginNames: string[];
|
|
19
|
-
dev?: import("@rsbuild/shared").DevConfig | undefined;
|
|
20
|
-
server?: import("@rsbuild/shared").ServerConfig | undefined;
|
|
21
|
-
html?: import("@rsbuild/shared").HtmlConfig | undefined;
|
|
22
|
-
tools?: import("@rsbuild/shared").ToolsConfig | undefined;
|
|
23
|
-
source?: import("@rsbuild/shared").SourceConfig | undefined;
|
|
24
|
-
output?: import("@rsbuild/shared").OutputConfig | undefined;
|
|
25
|
-
security?: import("@rsbuild/shared").SecurityConfig | undefined;
|
|
26
|
-
performance?: import("@rsbuild/shared").PerformanceConfig | undefined;
|
|
27
|
-
plugins?: import("@rsbuild/shared").RsbuildPlugin[] | undefined;
|
|
28
|
-
};
|
|
29
|
-
bundlerConfigs: WebpackConfig[];
|
|
30
|
-
};
|
|
31
|
-
}>;
|
|
13
|
+
}): Promise<InspectConfigResult<'webpack'>>;
|
|
@@ -42,7 +42,7 @@ async function inspectConfig({
|
|
|
42
42
|
rsbuildOptions
|
|
43
43
|
})).webpackConfigs;
|
|
44
44
|
const rsbuildDebugConfig = {
|
|
45
|
-
...context.
|
|
45
|
+
...context.normalizedConfig,
|
|
46
46
|
pluginNames: pluginStore.plugins.map((p) => p.name)
|
|
47
47
|
};
|
|
48
48
|
const rawRsbuildConfig = await (0, import_shared.stringifyConfig)(
|
|
@@ -60,13 +60,13 @@ async function inspectConfig({
|
|
|
60
60
|
}
|
|
61
61
|
if (inspectOptions.writeToDisk) {
|
|
62
62
|
await (0, import_shared.outputInspectConfigFiles)({
|
|
63
|
-
rsbuildConfig:
|
|
63
|
+
rsbuildConfig: context.normalizedConfig,
|
|
64
|
+
rawRsbuildConfig,
|
|
64
65
|
bundlerConfigs: rawBundlerConfigs,
|
|
65
66
|
inspectOptions: {
|
|
66
67
|
...inspectOptions,
|
|
67
68
|
outputPath
|
|
68
69
|
},
|
|
69
|
-
rsbuildOptions,
|
|
70
70
|
configType: "webpack"
|
|
71
71
|
});
|
|
72
72
|
}
|
package/dist/plugins/css.d.ts
CHANGED
package/dist/plugins/css.js
CHANGED
|
@@ -37,7 +37,7 @@ async function applyBaseCSSRule({
|
|
|
37
37
|
rule,
|
|
38
38
|
config,
|
|
39
39
|
context,
|
|
40
|
-
utils: { target, isProd, isServer, CHAIN_ID, isWebWorker
|
|
40
|
+
utils: { target, isProd, isServer, CHAIN_ID, isWebWorker },
|
|
41
41
|
importLoaders = 1
|
|
42
42
|
}) {
|
|
43
43
|
const browserslist = await (0, import_shared.getBrowserslistWithDefault)(
|
|
@@ -46,12 +46,10 @@ async function applyBaseCSSRule({
|
|
|
46
46
|
target
|
|
47
47
|
);
|
|
48
48
|
const enableExtractCSS = (0, import_shared.isUseCssExtract)(config, target);
|
|
49
|
-
const enableSourceMap = (0, import_shared.isUseCssSourceMap)(config);
|
|
50
49
|
const enableCSSModuleTS = Boolean(config.output.enableCssModuleTSDeclaration);
|
|
51
50
|
const localIdentName = (0, import_shared.getCssModuleLocalIdentName)(config, isProd);
|
|
52
51
|
const cssLoaderOptions = (0, import_shared.getCssLoaderOptions)({
|
|
53
52
|
config,
|
|
54
|
-
enableSourceMap,
|
|
55
53
|
importLoaders,
|
|
56
54
|
isServer,
|
|
57
55
|
isWebWorker,
|
|
@@ -84,14 +82,13 @@ async function applyBaseCSSRule({
|
|
|
84
82
|
} else {
|
|
85
83
|
rule.use(CHAIN_ID.USE.IGNORE_CSS).loader((0, import_shared.resolvePackage)("@rsbuild/shared/ignore-css-loader", __dirname)).end();
|
|
86
84
|
}
|
|
87
|
-
rule.use(CHAIN_ID.USE.CSS).loader(
|
|
85
|
+
rule.use(CHAIN_ID.USE.CSS).loader((0, import_shared.getSharedPkgCompiledPath)("css-loader")).options(cssLoaderOptions).end();
|
|
88
86
|
if (!isServer && !isWebWorker) {
|
|
89
87
|
const postcssLoaderOptions = (0, import_shared.getPostcssConfig)({
|
|
90
|
-
enableSourceMap,
|
|
91
88
|
browserslist,
|
|
92
89
|
config
|
|
93
90
|
});
|
|
94
|
-
rule.use(CHAIN_ID.USE.POSTCSS).loader(
|
|
91
|
+
rule.use(CHAIN_ID.USE.POSTCSS).loader((0, import_shared.getSharedPkgCompiledPath)("postcss-loader")).options(postcssLoaderOptions).end();
|
|
95
92
|
}
|
|
96
93
|
rule.merge({ sideEffects: true });
|
|
97
94
|
rule.resolve.preferRelative(true);
|
package/dist/plugins/less.js
CHANGED
|
@@ -41,7 +41,7 @@ function pluginLess() {
|
|
|
41
41
|
const { applyBaseCSSRule } = await Promise.resolve().then(() => __toESM(require("./css")));
|
|
42
42
|
const { options, excludes } = (0, import_shared.getLessLoaderOptions)(
|
|
43
43
|
config.tools.less,
|
|
44
|
-
|
|
44
|
+
config.output.sourceMap.css
|
|
45
45
|
);
|
|
46
46
|
const rule = chain.module.rule(utils.CHAIN_ID.RULE.LESS).test(import_shared.LESS_REGEX);
|
|
47
47
|
excludes.forEach((item) => {
|
|
@@ -54,7 +54,7 @@ function pluginLess() {
|
|
|
54
54
|
context: api.context,
|
|
55
55
|
importLoaders: 2
|
|
56
56
|
});
|
|
57
|
-
rule.use(utils.CHAIN_ID.USE.LESS).loader(
|
|
57
|
+
rule.use(utils.CHAIN_ID.USE.LESS).loader((0, import_shared.getSharedPkgCompiledPath)("less-loader")).options(options);
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
};
|
package/dist/plugins/output.js
CHANGED
|
@@ -39,14 +39,14 @@ const pluginOutput = () => ({
|
|
|
39
39
|
(0, import_shared.applyOutputPlugin)(api);
|
|
40
40
|
api.modifyBundlerChain(async (chain, { isProd, target, CHAIN_ID }) => {
|
|
41
41
|
const config = api.getNormalizedConfig();
|
|
42
|
-
const cssPath = (0, import_shared.getDistPath)(config
|
|
42
|
+
const cssPath = (0, import_shared.getDistPath)(config, "css");
|
|
43
43
|
if ((0, import_shared.isUseCssExtract)(config, target)) {
|
|
44
44
|
const { default: MiniCssExtractPlugin } = await Promise.resolve().then(() => __toESM(require("mini-css-extract-plugin")));
|
|
45
45
|
const extractPluginOptions = (0, import_shared.mergeChainedOptions)({
|
|
46
46
|
defaults: {},
|
|
47
47
|
options: config.tools.cssExtract?.pluginOptions
|
|
48
48
|
});
|
|
49
|
-
const cssFilename = (0, import_shared.getFilename)(config
|
|
49
|
+
const cssFilename = (0, import_shared.getFilename)(config, "css", isProd);
|
|
50
50
|
chain.plugin(CHAIN_ID.PLUGIN.MINI_CSS_EXTRACT).use(MiniCssExtractPlugin, [
|
|
51
51
|
{
|
|
52
52
|
filename: import_path.posix.join(cssPath, cssFilename),
|
package/dist/plugins/progress.js
CHANGED
|
@@ -41,7 +41,7 @@ const pluginProgress = () => ({
|
|
|
41
41
|
if (!options) {
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
|
-
const { ProgressPlugin } = await Promise.resolve().then(() => __toESM(require("../
|
|
44
|
+
const { ProgressPlugin } = await Promise.resolve().then(() => __toESM(require("../progress/ProgressPlugin")));
|
|
45
45
|
chain.plugin(CHAIN_ID.PLUGIN.PROGRESS).use(ProgressPlugin, [
|
|
46
46
|
{
|
|
47
47
|
id: import_shared.TARGET_ID_MAP[target],
|
package/dist/plugins/resolve.js
CHANGED
|
@@ -67,7 +67,6 @@ const pluginResolve = () => ({
|
|
|
67
67
|
api.modifyBundlerChain(async (chain, { CHAIN_ID, target }) => {
|
|
68
68
|
const config = api.getNormalizedConfig();
|
|
69
69
|
const isTsProject = Boolean(api.context.tsconfigPath);
|
|
70
|
-
chain.module.rule(CHAIN_ID.RULE.JS_DATA_URI).resolve.set("fullySpecified", false);
|
|
71
70
|
if (isTsProject && config.source.aliasStrategy === "prefer-tsconfig") {
|
|
72
71
|
await applyTsConfigPathsPlugin({
|
|
73
72
|
chain,
|
package/dist/plugins/sass.js
CHANGED
|
@@ -59,13 +59,13 @@ function pluginSass() {
|
|
|
59
59
|
// postcss-loader, resolve-url-loader, sass-loader
|
|
60
60
|
importLoaders: 3
|
|
61
61
|
});
|
|
62
|
-
rule.use(utils.CHAIN_ID.USE.RESOLVE_URL_LOADER_FOR_SASS).loader(
|
|
62
|
+
rule.use(utils.CHAIN_ID.USE.RESOLVE_URL_LOADER_FOR_SASS).loader((0, import_shared.getSharedPkgCompiledPath)("resolve-url-loader")).options({
|
|
63
63
|
join: await (0, import_shared.getResolveUrlJoinFn)(),
|
|
64
64
|
// 'resolve-url-loader' relies on 'adjust-sourcemap-loader',
|
|
65
65
|
// it has performance regression issues in some scenarios,
|
|
66
66
|
// so we need to disable the sourceMap option.
|
|
67
67
|
sourceMap: false
|
|
68
|
-
}).end().use(utils.CHAIN_ID.USE.SASS).loader(
|
|
68
|
+
}).end().use(utils.CHAIN_ID.USE.SASS).loader((0, import_shared.getSharedPkgCompiledPath)("sass-loader")).options(options);
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
};
|
|
@@ -26,33 +26,45 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
31
|
-
|
|
29
|
+
var server_exports = {};
|
|
30
|
+
__export(server_exports, {
|
|
31
|
+
pluginServer: () => pluginServer
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
var
|
|
35
|
-
var
|
|
36
|
-
const
|
|
37
|
-
name: "rsbuild
|
|
33
|
+
module.exports = __toCommonJS(server_exports);
|
|
34
|
+
var import_fs = __toESM(require("fs"));
|
|
35
|
+
var import_path = require("path");
|
|
36
|
+
const pluginServer = () => ({
|
|
37
|
+
name: "rsbuild:server",
|
|
38
38
|
setup(api) {
|
|
39
|
-
(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
api.modifyBundlerChain(async (chain, { isProd }) => {
|
|
40
|
+
const config = api.getNormalizedConfig();
|
|
41
|
+
if (isProd && config.server?.publicDir) {
|
|
42
|
+
const { name, copyOnBuild } = config.server?.publicDir;
|
|
43
|
+
if (!copyOnBuild || !name) {
|
|
44
|
+
return;
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
const publicDir = (0, import_path.isAbsolute)(name) ? name : (0, import_path.join)(api.context.rootPath, name);
|
|
47
|
+
const publicPattern = [
|
|
48
|
+
{
|
|
49
|
+
from: publicDir,
|
|
50
|
+
to: "",
|
|
51
|
+
noErrorOnMissing: true
|
|
52
|
+
}
|
|
53
|
+
];
|
|
54
|
+
if (!import_fs.default.existsSync(publicDir)) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const { default: CopyPlugin } = await Promise.resolve().then(() => __toESM(require("../../compiled/copy-webpack-plugin")));
|
|
58
|
+
chain.plugin("public-dir").use(CopyPlugin, [
|
|
59
|
+
{
|
|
60
|
+
patterns: publicPattern
|
|
61
|
+
}
|
|
62
|
+
]);
|
|
51
63
|
}
|
|
52
64
|
});
|
|
53
65
|
}
|
|
54
66
|
});
|
|
55
67
|
// Annotate the CommonJS export names for ESM import in node:
|
|
56
68
|
0 && (module.exports = {
|
|
57
|
-
|
|
69
|
+
pluginServer
|
|
58
70
|
});
|
package/dist/provider.js
CHANGED
|
@@ -33,7 +33,6 @@ __export(provider_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(provider_exports);
|
|
34
34
|
var import_shared = require("@rsbuild/shared");
|
|
35
35
|
var import_provider = require("@rsbuild/core/provider");
|
|
36
|
-
var import_createContext = require("./core/createContext");
|
|
37
36
|
var import_shared2 = require("./shared");
|
|
38
37
|
var import_initConfigs = require("./core/initConfigs");
|
|
39
38
|
function webpackProvider({
|
|
@@ -41,7 +40,11 @@ function webpackProvider({
|
|
|
41
40
|
}) {
|
|
42
41
|
const rsbuildConfig = (0, import_shared.pickRsbuildConfig)(originalRsbuildConfig);
|
|
43
42
|
return async ({ pluginStore, rsbuildOptions, plugins }) => {
|
|
44
|
-
const context = await (0,
|
|
43
|
+
const context = await (0, import_provider.createContext)(
|
|
44
|
+
rsbuildOptions,
|
|
45
|
+
rsbuildConfig,
|
|
46
|
+
"webpack"
|
|
47
|
+
);
|
|
45
48
|
const pluginAPI = (0, import_provider.getPluginAPI)({ context, pluginStore });
|
|
46
49
|
context.pluginAPI = pluginAPI;
|
|
47
50
|
return {
|
|
@@ -68,6 +71,17 @@ function webpackProvider({
|
|
|
68
71
|
});
|
|
69
72
|
return createCompiler({ context, webpackConfigs });
|
|
70
73
|
},
|
|
74
|
+
async createDevServer(options) {
|
|
75
|
+
const { createDevServer } = await Promise.resolve().then(() => __toESM(require("@rsbuild/core/server")));
|
|
76
|
+
const { createDevMiddleware } = await Promise.resolve().then(() => __toESM(require("./core/createCompiler")));
|
|
77
|
+
await (0, import_provider.initRsbuildConfig)({ context, pluginStore });
|
|
78
|
+
return createDevServer(
|
|
79
|
+
{ context, pluginStore, rsbuildOptions },
|
|
80
|
+
// @ts-expect-error compile type mismatch
|
|
81
|
+
createDevMiddleware,
|
|
82
|
+
options
|
|
83
|
+
);
|
|
84
|
+
},
|
|
71
85
|
async startDevServer(options) {
|
|
72
86
|
const { startDevServer } = await Promise.resolve().then(() => __toESM(require("@rsbuild/core/server")));
|
|
73
87
|
const { createDevMiddleware } = await Promise.resolve().then(() => __toESM(require("./core/createCompiler")));
|
package/dist/shared.js
CHANGED
|
@@ -37,12 +37,11 @@ var import_path = require("path");
|
|
|
37
37
|
var import_shared = require("@rsbuild/shared");
|
|
38
38
|
var import_shared2 = require("@rsbuild/shared");
|
|
39
39
|
const applyDefaultPlugins = (plugins) => (0, import_shared2.awaitableGetter)([
|
|
40
|
-
|
|
40
|
+
plugins.basic?.(),
|
|
41
41
|
plugins.entry?.(),
|
|
42
42
|
plugins.cache?.(),
|
|
43
43
|
plugins.target?.(),
|
|
44
44
|
Promise.resolve().then(() => __toESM(require("./plugins/output"))).then((m) => m.pluginOutput()),
|
|
45
|
-
plugins.devtool(),
|
|
46
45
|
Promise.resolve().then(() => __toESM(require("./plugins/resolve"))).then((m) => m.pluginResolve()),
|
|
47
46
|
plugins.fileSize?.(),
|
|
48
47
|
plugins.cleanOutput?.(),
|
|
@@ -69,7 +68,7 @@ const applyDefaultPlugins = (plugins) => (0, import_shared2.awaitableGetter)([
|
|
|
69
68
|
plugins.performance(),
|
|
70
69
|
plugins.networkPerformance(),
|
|
71
70
|
plugins.preloadOrPrefetch(),
|
|
72
|
-
plugins.
|
|
71
|
+
Promise.resolve().then(() => __toESM(require("./plugins/server"))).then((m) => m.pluginServer())
|
|
73
72
|
]);
|
|
74
73
|
const getCompiledPath = (packageName) => {
|
|
75
74
|
const providerCompilerPath = (0, import_path.join)(__dirname, "../../compiled", packageName);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/webpack",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"homepage": "https://rsbuild.dev",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"directory": "packages/compat/webpack"
|
|
9
9
|
},
|
|
10
10
|
"license": "MIT",
|
|
11
|
+
"type": "commonjs",
|
|
11
12
|
"exports": {
|
|
12
13
|
".": {
|
|
13
14
|
"types": "./dist/index.d.ts",
|
|
@@ -35,13 +36,13 @@
|
|
|
35
36
|
"terser-webpack-plugin": "5.3.9",
|
|
36
37
|
"tsconfig-paths-webpack-plugin": "4.1.0",
|
|
37
38
|
"webpack": "^5.89.0",
|
|
38
|
-
"@rsbuild/core": "0.
|
|
39
|
-
"@rsbuild/shared": "0.
|
|
39
|
+
"@rsbuild/core": "0.2.0",
|
|
40
|
+
"@rsbuild/shared": "0.2.0"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
|
-
"@types/node": "
|
|
43
|
+
"@types/node": "16.x",
|
|
43
44
|
"typescript": "^5.3.0",
|
|
44
|
-
"@rsbuild/test-helper": "0.
|
|
45
|
+
"@rsbuild/test-helper": "0.2.0"
|
|
45
46
|
},
|
|
46
47
|
"publishConfig": {
|
|
47
48
|
"access": "public",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type RsbuildConfig, type CreateRsbuildOptions } from '@rsbuild/shared';
|
|
2
|
-
import { type Context } from '@rsbuild/core/provider';
|
|
3
|
-
/**
|
|
4
|
-
* Create primary context.
|
|
5
|
-
* It will be assembled into a normal context or a stub for testing as needed.
|
|
6
|
-
* Usually it would be a pure function
|
|
7
|
-
*/
|
|
8
|
-
export declare function createPrimaryContext(options: Required<CreateRsbuildOptions>, userRsbuildConfig: RsbuildConfig): Context;
|
|
9
|
-
/**
|
|
10
|
-
* Generate the actual context used in the build,
|
|
11
|
-
* which can have a lot of overhead and take some side effects.
|
|
12
|
-
*/
|
|
13
|
-
export declare function createContext(options: Required<CreateRsbuildOptions>, rsbuildConfig: RsbuildConfig): Promise<Context>;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var createContext_exports = {};
|
|
20
|
-
__export(createContext_exports, {
|
|
21
|
-
createContext: () => createContext,
|
|
22
|
-
createPrimaryContext: () => createPrimaryContext
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(createContext_exports);
|
|
25
|
-
var import_path = require("path");
|
|
26
|
-
var import_shared = require("@rsbuild/shared");
|
|
27
|
-
var import_provider = require("@rsbuild/core/provider");
|
|
28
|
-
function createPrimaryContext(options, userRsbuildConfig) {
|
|
29
|
-
const rsbuildConfig = (0, import_provider.withDefaultConfig)(userRsbuildConfig);
|
|
30
|
-
const context = (0, import_provider.createContextByConfig)(
|
|
31
|
-
options,
|
|
32
|
-
"webpack",
|
|
33
|
-
rsbuildConfig.source,
|
|
34
|
-
rsbuildConfig.output
|
|
35
|
-
);
|
|
36
|
-
return {
|
|
37
|
-
...context,
|
|
38
|
-
hooks: (0, import_provider.initHooks)(),
|
|
39
|
-
config: { ...rsbuildConfig },
|
|
40
|
-
originalConfig: userRsbuildConfig
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
async function createContext(options, rsbuildConfig) {
|
|
44
|
-
(0, import_shared.debug)("create context");
|
|
45
|
-
const ctx = createPrimaryContext(options, rsbuildConfig);
|
|
46
|
-
const tsconfigPath = (0, import_path.join)(ctx.rootPath, import_shared.TS_CONFIG_FILE);
|
|
47
|
-
if (await (0, import_shared.isFileExists)(tsconfigPath)) {
|
|
48
|
-
ctx.tsconfigPath = tsconfigPath;
|
|
49
|
-
}
|
|
50
|
-
return ctx;
|
|
51
|
-
}
|
|
52
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
-
0 && (module.exports = {
|
|
54
|
-
createContext,
|
|
55
|
-
createPrimaryContext
|
|
56
|
-
});
|
package/dist/plugins/basic.d.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|