@rsbuild/webpack 0.1.6 → 0.1.7
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/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/bar.js +1 -1
- package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/bus.js +2 -2
- package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/log.js +1 -1
- package/dist/core/createCompiler.d.ts +2 -1
- package/dist/core/createContext.d.ts +1 -1
- package/dist/core/createContext.js +4 -4
- package/dist/core/initConfigs.d.ts +2 -1
- package/dist/core/initConfigs.js +2 -2
- package/dist/core/webpackConfig.d.ts +2 -1
- package/dist/index.d.ts +0 -1
- package/dist/plugins/progress.js +1 -1
- package/dist/provider.js +7 -8
- package/dist/{shared/plugin.d.ts → shared.d.ts} +2 -1
- package/dist/{shared/plugin.js → shared.js} +29 -16
- package/dist/types.d.ts +0 -15
- package/package.json +4 -27
- package/dist/core/initPlugins.d.ts +0 -9
- package/dist/core/initPlugins.js +0 -87
- package/dist/shared/fs.d.ts +0 -1
- package/dist/shared/fs.js +0 -48
- package/dist/shared/index.d.ts +0 -1
- package/dist/shared/index.js +0 -22
- /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/ProgressPlugin.d.ts +0 -0
- /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/ProgressPlugin.js +0 -0
- /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/bar.d.ts +0 -0
- /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/bus.d.ts +0 -0
- /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/index.d.ts +0 -0
- /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/index.js +0 -0
- /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/log.d.ts +0 -0
- /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/nonTty.d.ts +0 -0
- /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/nonTty.js +0 -0
- /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/percentage.d.ts +0 -0
- /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/percentage.js +0 -0
- /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/type.d.ts +0 -0
- /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/type.js +0 -0
- /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/utils.d.ts +0 -0
- /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/utils.js +0 -0
|
@@ -34,7 +34,7 @@ __export(bar_exports, {
|
|
|
34
34
|
renderBar: () => renderBar
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(bar_exports);
|
|
37
|
-
var import_cli_truncate = __toESM(require("
|
|
37
|
+
var import_cli_truncate = __toESM(require("../../../compiled/cli-truncate"));
|
|
38
38
|
var import_utils = require("./utils");
|
|
39
39
|
var import_shared = require("@rsbuild/shared");
|
|
40
40
|
const defaultOption = {
|
|
@@ -32,8 +32,8 @@ __export(bus_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(bus_exports);
|
|
34
34
|
var import_console = require("console");
|
|
35
|
-
var import_patch_console = __toESM(require("
|
|
36
|
-
var import_cli_truncate = __toESM(require("
|
|
35
|
+
var import_patch_console = __toESM(require("../../../compiled/patch-console"));
|
|
36
|
+
var import_cli_truncate = __toESM(require("../../../compiled/cli-truncate"));
|
|
37
37
|
var import_bar = require("./bar");
|
|
38
38
|
var import_log = require("./log");
|
|
39
39
|
var import_shared = require("@rsbuild/shared");
|
|
@@ -31,7 +31,7 @@ __export(log_exports, {
|
|
|
31
31
|
create: () => create
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(log_exports);
|
|
34
|
-
var import_ansi_escapes = __toESM(require("
|
|
34
|
+
var import_ansi_escapes = __toESM(require("../../../compiled/ansi-escapes"));
|
|
35
35
|
const create = (stream) => {
|
|
36
36
|
let previousLineCount = 0;
|
|
37
37
|
let previousOutput = "";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { Context
|
|
1
|
+
import type { Context } from '@rsbuild/core/provider';
|
|
2
|
+
import type { WebpackConfig } from '../types';
|
|
2
3
|
import { InitConfigsOptions } from './initConfigs';
|
|
3
4
|
import type { Compiler, MultiCompiler } from 'webpack';
|
|
4
5
|
export declare function createCompiler({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type RsbuildConfig, type CreateRsbuildOptions } from '@rsbuild/shared';
|
|
2
|
-
import type
|
|
2
|
+
import { type Context } from '@rsbuild/core/provider';
|
|
3
3
|
/**
|
|
4
4
|
* Create primary context.
|
|
5
5
|
* It will be assembled into a normal context or a stub for testing as needed.
|
|
@@ -24,10 +24,10 @@ __export(createContext_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(createContext_exports);
|
|
25
25
|
var import_path = require("path");
|
|
26
26
|
var import_shared = require("@rsbuild/shared");
|
|
27
|
-
var
|
|
27
|
+
var import_provider = require("@rsbuild/core/provider");
|
|
28
28
|
function createPrimaryContext(options, userRsbuildConfig) {
|
|
29
|
-
const rsbuildConfig = (0,
|
|
30
|
-
const context = (0,
|
|
29
|
+
const rsbuildConfig = (0, import_provider.withDefaultConfig)(userRsbuildConfig);
|
|
30
|
+
const context = (0, import_provider.createContextByConfig)(
|
|
31
31
|
options,
|
|
32
32
|
"webpack",
|
|
33
33
|
rsbuildConfig.source,
|
|
@@ -35,7 +35,7 @@ function createPrimaryContext(options, userRsbuildConfig) {
|
|
|
35
35
|
);
|
|
36
36
|
return {
|
|
37
37
|
...context,
|
|
38
|
-
hooks: (0,
|
|
38
|
+
hooks: (0, import_provider.initHooks)(),
|
|
39
39
|
config: { ...rsbuildConfig },
|
|
40
40
|
originalConfig: userRsbuildConfig
|
|
41
41
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type PluginStore, type CreateRsbuildOptions } from '@rsbuild/shared';
|
|
2
|
-
import type
|
|
2
|
+
import { type Context } from '@rsbuild/core/provider';
|
|
3
|
+
import type { WebpackConfig } from '../types';
|
|
3
4
|
export type InitConfigsOptions = {
|
|
4
5
|
context: Context;
|
|
5
6
|
pluginStore: PluginStore;
|
package/dist/core/initConfigs.js
CHANGED
|
@@ -22,7 +22,7 @@ __export(initConfigs_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(initConfigs_exports);
|
|
24
24
|
var import_shared = require("@rsbuild/shared");
|
|
25
|
-
var
|
|
25
|
+
var import_provider = require("@rsbuild/core/provider");
|
|
26
26
|
var import_inspectConfig = require("./inspectConfig");
|
|
27
27
|
var import_webpackConfig = require("./webpackConfig");
|
|
28
28
|
async function initConfigs({
|
|
@@ -30,7 +30,7 @@ async function initConfigs({
|
|
|
30
30
|
pluginStore,
|
|
31
31
|
rsbuildOptions
|
|
32
32
|
}) {
|
|
33
|
-
await (0,
|
|
33
|
+
await (0, import_provider.initRsbuildConfig)({
|
|
34
34
|
context,
|
|
35
35
|
pluginStore
|
|
36
36
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type RsbuildTarget } from '@rsbuild/shared';
|
|
2
|
-
import type { Context
|
|
2
|
+
import type { Context } from '@rsbuild/core/provider';
|
|
3
|
+
import type { WebpackConfig } from '../types';
|
|
3
4
|
export declare function generateWebpackConfig({
|
|
4
5
|
target,
|
|
5
6
|
context
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { webpackProvider } from './provider';
|
|
2
2
|
export { webpackBuild } from './core/build';
|
|
3
|
-
export type { LessLoaderOptions, SassLoaderOptions, PostCSSLoaderOptions, CSSLoaderOptions, StyleLoaderOptions } from '@rsbuild/shared';
|
|
4
3
|
export type { webpack, WebpackChain, WebpackConfig } from './types';
|
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("../ProgressPlugin/ProgressPlugin")));
|
|
45
45
|
chain.plugin(CHAIN_ID.PLUGIN.PROGRESS).use(ProgressPlugin, [
|
|
46
46
|
{
|
|
47
47
|
id: import_shared.TARGET_ID_MAP[target],
|
package/dist/provider.js
CHANGED
|
@@ -32,25 +32,24 @@ __export(provider_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(provider_exports);
|
|
34
34
|
var import_shared = require("@rsbuild/shared");
|
|
35
|
-
var
|
|
35
|
+
var import_provider = require("@rsbuild/core/provider");
|
|
36
36
|
var import_createContext = require("./core/createContext");
|
|
37
|
-
var
|
|
37
|
+
var import_shared2 = require("./shared");
|
|
38
38
|
var import_initConfigs = require("./core/initConfigs");
|
|
39
|
-
var import_initPlugins = require("./core/initPlugins");
|
|
40
39
|
function webpackProvider({
|
|
41
40
|
rsbuildConfig: originalRsbuildConfig
|
|
42
41
|
}) {
|
|
43
42
|
const rsbuildConfig = (0, import_shared.pickRsbuildConfig)(originalRsbuildConfig);
|
|
44
43
|
return async ({ pluginStore, rsbuildOptions, plugins }) => {
|
|
45
44
|
const context = await (0, import_createContext.createContext)(rsbuildOptions, rsbuildConfig);
|
|
46
|
-
const pluginAPI = (0,
|
|
45
|
+
const pluginAPI = (0, import_provider.getPluginAPI)({ context, pluginStore });
|
|
47
46
|
context.pluginAPI = pluginAPI;
|
|
48
47
|
return {
|
|
49
48
|
bundler: "webpack",
|
|
50
49
|
pluginAPI,
|
|
51
|
-
publicContext: (0,
|
|
50
|
+
publicContext: (0, import_provider.createPublicContext)(context),
|
|
52
51
|
async applyDefaultPlugins() {
|
|
53
|
-
pluginStore.addPlugins(await (0,
|
|
52
|
+
pluginStore.addPlugins(await (0, import_shared2.applyDefaultPlugins)(plugins));
|
|
54
53
|
},
|
|
55
54
|
async initConfigs() {
|
|
56
55
|
const { webpackConfigs } = await (0, import_initConfigs.initConfigs)({
|
|
@@ -72,7 +71,7 @@ function webpackProvider({
|
|
|
72
71
|
async startDevServer(options) {
|
|
73
72
|
const { startDevServer } = await Promise.resolve().then(() => __toESM(require("@rsbuild/core/server")));
|
|
74
73
|
const { createDevMiddleware } = await Promise.resolve().then(() => __toESM(require("./core/createCompiler")));
|
|
75
|
-
await (0,
|
|
74
|
+
await (0, import_provider.initRsbuildConfig)({
|
|
76
75
|
context,
|
|
77
76
|
pluginStore
|
|
78
77
|
});
|
|
@@ -89,7 +88,7 @@ function webpackProvider({
|
|
|
89
88
|
},
|
|
90
89
|
async preview(options) {
|
|
91
90
|
const { startProdServer } = await Promise.resolve().then(() => __toESM(require("@rsbuild/core/server")));
|
|
92
|
-
await (0,
|
|
91
|
+
await (0, import_provider.initRsbuildConfig)({
|
|
93
92
|
context,
|
|
94
93
|
pluginStore
|
|
95
94
|
});
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { type Plugins, type RsbuildPlugin } from '@rsbuild/shared';
|
|
2
|
-
export declare const applyDefaultPlugins: (plugins: Plugins) => import("@rsbuild/shared").AwaitableGetter<RsbuildPlugin>;
|
|
2
|
+
export declare const applyDefaultPlugins: (plugins: Plugins) => import("@rsbuild/shared").AwaitableGetter<RsbuildPlugin>;
|
|
3
|
+
export declare const getCompiledPath: (packageName: string) => string;
|
|
@@ -26,35 +26,39 @@ 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
|
-
applyDefaultPlugins: () => applyDefaultPlugins
|
|
29
|
+
var shared_exports = {};
|
|
30
|
+
__export(shared_exports, {
|
|
31
|
+
applyDefaultPlugins: () => applyDefaultPlugins,
|
|
32
|
+
getCompiledPath: () => getCompiledPath
|
|
32
33
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
+
module.exports = __toCommonJS(shared_exports);
|
|
35
|
+
var import_fs = __toESM(require("fs"));
|
|
36
|
+
var import_path = require("path");
|
|
34
37
|
var import_shared = require("@rsbuild/shared");
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
var import_shared2 = require("@rsbuild/shared");
|
|
39
|
+
const applyDefaultPlugins = (plugins) => (0, import_shared2.awaitableGetter)([
|
|
40
|
+
Promise.resolve().then(() => __toESM(require("./plugins/basic"))).then((m) => m.pluginBasic()),
|
|
37
41
|
plugins.entry?.(),
|
|
38
42
|
plugins.cache?.(),
|
|
39
43
|
plugins.target?.(),
|
|
40
|
-
Promise.resolve().then(() => __toESM(require("
|
|
44
|
+
Promise.resolve().then(() => __toESM(require("./plugins/output"))).then((m) => m.pluginOutput()),
|
|
41
45
|
plugins.devtool(),
|
|
42
|
-
Promise.resolve().then(() => __toESM(require("
|
|
46
|
+
Promise.resolve().then(() => __toESM(require("./plugins/resolve"))).then((m) => m.pluginResolve()),
|
|
43
47
|
plugins.fileSize?.(),
|
|
44
48
|
plugins.cleanOutput?.(),
|
|
45
|
-
Promise.resolve().then(() => __toESM(require("
|
|
49
|
+
Promise.resolve().then(() => __toESM(require("./plugins/hmr"))).then((m) => m.pluginHMR()),
|
|
46
50
|
plugins.asset(),
|
|
47
|
-
Promise.resolve().then(() => __toESM(require("
|
|
51
|
+
Promise.resolve().then(() => __toESM(require("./plugins/copy"))).then((m) => m.pluginCopy()),
|
|
48
52
|
plugins.html(),
|
|
49
53
|
plugins.wasm(),
|
|
50
54
|
plugins.moment(),
|
|
51
55
|
plugins.nodeAddons(),
|
|
52
56
|
plugins.define(),
|
|
53
|
-
Promise.resolve().then(() => __toESM(require("
|
|
54
|
-
Promise.resolve().then(() => __toESM(require("
|
|
55
|
-
Promise.resolve().then(() => __toESM(require("
|
|
56
|
-
Promise.resolve().then(() => __toESM(require("
|
|
57
|
-
Promise.resolve().then(() => __toESM(require("
|
|
57
|
+
Promise.resolve().then(() => __toESM(require("./plugins/progress"))).then((m) => m.pluginProgress()),
|
|
58
|
+
Promise.resolve().then(() => __toESM(require("./plugins/minimize"))).then((m) => m.pluginMinimize()),
|
|
59
|
+
Promise.resolve().then(() => __toESM(require("./plugins/css"))).then((m) => m.pluginCss()),
|
|
60
|
+
Promise.resolve().then(() => __toESM(require("./plugins/sass"))).then((m) => m.pluginSass()),
|
|
61
|
+
Promise.resolve().then(() => __toESM(require("./plugins/less"))).then((m) => m.pluginLess()),
|
|
58
62
|
plugins.bundleAnalyzer(),
|
|
59
63
|
plugins.toml(),
|
|
60
64
|
plugins.yaml(),
|
|
@@ -67,7 +71,16 @@ const applyDefaultPlugins = (plugins) => (0, import_shared.awaitableGetter)([
|
|
|
67
71
|
plugins.preloadOrPrefetch(),
|
|
68
72
|
plugins.server()
|
|
69
73
|
]);
|
|
74
|
+
const getCompiledPath = (packageName) => {
|
|
75
|
+
const providerCompilerPath = (0, import_path.join)(__dirname, "../../compiled", packageName);
|
|
76
|
+
if (import_fs.default.existsSync(providerCompilerPath)) {
|
|
77
|
+
return providerCompilerPath;
|
|
78
|
+
} else {
|
|
79
|
+
return (0, import_shared.getSharedPkgCompiledPath)(packageName);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
70
82
|
// Annotate the CommonJS export names for ESM import in node:
|
|
71
83
|
0 && (module.exports = {
|
|
72
|
-
applyDefaultPlugins
|
|
84
|
+
applyDefaultPlugins,
|
|
85
|
+
getCompiledPath
|
|
73
86
|
});
|
package/dist/types.d.ts
CHANGED
|
@@ -1,19 +1,4 @@
|
|
|
1
1
|
import type webpack from 'webpack';
|
|
2
2
|
import type { WebpackChain } from '@rsbuild/shared';
|
|
3
3
|
import type { Configuration as WebpackConfig } from 'webpack';
|
|
4
|
-
import type { Context as BaseContext, RsbuildConfig, NormalizedConfig, RsbuildPluginAPI } from '@rsbuild/shared';
|
|
5
|
-
import type { Hooks } from '@rsbuild/core/rspack-provider';
|
|
6
|
-
/** The inner context. */
|
|
7
|
-
export type Context = BaseContext & {
|
|
8
|
-
/** All hooks. */
|
|
9
|
-
hooks: Readonly<Hooks>;
|
|
10
|
-
/** Current Rsbuild config. */
|
|
11
|
-
config: Readonly<RsbuildConfig>;
|
|
12
|
-
/** The original Rsbuild config passed from the createRsbuild method. */
|
|
13
|
-
originalConfig: Readonly<RsbuildConfig>;
|
|
14
|
-
/** The normalized Rsbuild config. */
|
|
15
|
-
normalizedConfig?: NormalizedConfig;
|
|
16
|
-
/** The plugin API. */
|
|
17
|
-
pluginAPI?: RsbuildPluginAPI;
|
|
18
|
-
};
|
|
19
4
|
export type { webpack, WebpackChain, WebpackConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/webpack",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"homepage": "https://rsbuild.dev",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -16,10 +16,6 @@
|
|
|
16
16
|
"./plugin-css": {
|
|
17
17
|
"types": "./dist/plugins/css.d.ts",
|
|
18
18
|
"default": "./dist/plugins/css.js"
|
|
19
|
-
},
|
|
20
|
-
"./plugin-babel": {
|
|
21
|
-
"types": "./dist/plugins/babel.d.ts",
|
|
22
|
-
"default": "./dist/plugins/babel.js"
|
|
23
19
|
}
|
|
24
20
|
},
|
|
25
21
|
"main": "./dist/index.js",
|
|
@@ -30,41 +26,22 @@
|
|
|
30
26
|
"dist"
|
|
31
27
|
],
|
|
32
28
|
"dependencies": {
|
|
33
|
-
"@babel/core": "^7.23.2",
|
|
34
|
-
"@babel/preset-react": "^7.22.15",
|
|
35
|
-
"@babel/types": "^7.23.0",
|
|
36
|
-
"babel-loader": "9.1.3",
|
|
37
|
-
"babel-plugin-import": "1.13.5",
|
|
38
|
-
"babel-plugin-transform-react-remove-prop-types": "0.4.24",
|
|
39
|
-
"caniuse-lite": "^1.0.30001559",
|
|
40
29
|
"fast-glob": "^3.3.1",
|
|
41
|
-
"glob": "^9.3.5",
|
|
42
30
|
"globby": "^11.1.0",
|
|
43
31
|
"html-webpack-plugin": "npm:html-rspack-plugin@5.5.7",
|
|
44
|
-
"lodash": "^4.17.21",
|
|
45
32
|
"mini-css-extract-plugin": "2.7.6",
|
|
46
33
|
"postcss": "8.4.31",
|
|
47
|
-
"react-refresh": "^0.14.0",
|
|
48
34
|
"style-loader": "3.3.3",
|
|
49
35
|
"terser-webpack-plugin": "5.3.9",
|
|
50
36
|
"tsconfig-paths-webpack-plugin": "4.1.0",
|
|
51
37
|
"webpack": "^5.89.0",
|
|
52
|
-
"@rsbuild/
|
|
53
|
-
"@rsbuild/
|
|
54
|
-
"@rsbuild/plugin-react": "0.1.6",
|
|
55
|
-
"@rsbuild/plugin-babel": "0.1.6",
|
|
56
|
-
"@rsbuild/shared": "0.1.6"
|
|
38
|
+
"@rsbuild/core": "0.1.7",
|
|
39
|
+
"@rsbuild/shared": "0.1.7"
|
|
57
40
|
},
|
|
58
41
|
"devDependencies": {
|
|
59
|
-
"@types/lodash": "^4.14.200",
|
|
60
42
|
"@types/node": "^16",
|
|
61
|
-
"react": "^18.2.0",
|
|
62
|
-
"react-dom": "^18.2.0",
|
|
63
43
|
"typescript": "^5.3.0",
|
|
64
|
-
"@rsbuild/test-helper": "0.1.
|
|
65
|
-
},
|
|
66
|
-
"engines": {
|
|
67
|
-
"node": ">=14.0.0"
|
|
44
|
+
"@rsbuild/test-helper": "0.1.7"
|
|
68
45
|
},
|
|
69
46
|
"publishConfig": {
|
|
70
47
|
"access": "public",
|
package/dist/core/initPlugins.js
DELETED
|
@@ -1,87 +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 initPlugins_exports = {};
|
|
20
|
-
__export(initPlugins_exports, {
|
|
21
|
-
getPluginAPI: () => getPluginAPI
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(initPlugins_exports);
|
|
24
|
-
var import_shared = require("@rsbuild/shared");
|
|
25
|
-
var import_rspack_provider = require("@rsbuild/core/rspack-provider");
|
|
26
|
-
function getPluginAPI({
|
|
27
|
-
context,
|
|
28
|
-
pluginStore
|
|
29
|
-
}) {
|
|
30
|
-
const { hooks } = context;
|
|
31
|
-
const publicContext = (0, import_rspack_provider.createPublicContext)(context);
|
|
32
|
-
const getRsbuildConfig = () => {
|
|
33
|
-
if (!context.normalizedConfig) {
|
|
34
|
-
throw new Error(
|
|
35
|
-
"Cannot access Rsbuild config until modifyRsbuildConfig is called."
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
return context.config;
|
|
39
|
-
};
|
|
40
|
-
const getNormalizedConfig = () => {
|
|
41
|
-
if (!context.normalizedConfig) {
|
|
42
|
-
throw new Error(
|
|
43
|
-
"Cannot access normalized config until modifyRsbuildConfig is called."
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
return context.normalizedConfig;
|
|
47
|
-
};
|
|
48
|
-
const getHTMLPaths = () => {
|
|
49
|
-
return Object.keys(context.entry).reduce(
|
|
50
|
-
(prev, key) => {
|
|
51
|
-
prev[key] = (0, import_shared.getHTMLPathByEntry)(key, getNormalizedConfig());
|
|
52
|
-
return prev;
|
|
53
|
-
},
|
|
54
|
-
{}
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
(0, import_shared.onExitProcess)(() => {
|
|
58
|
-
hooks.onExitHook.call();
|
|
59
|
-
});
|
|
60
|
-
return {
|
|
61
|
-
context: publicContext,
|
|
62
|
-
getHTMLPaths,
|
|
63
|
-
getRsbuildConfig,
|
|
64
|
-
getNormalizedConfig,
|
|
65
|
-
isPluginExists: pluginStore.isPluginExists,
|
|
66
|
-
// Hooks
|
|
67
|
-
onExit: hooks.onExitHook.tap,
|
|
68
|
-
onAfterBuild: hooks.onAfterBuildHook.tap,
|
|
69
|
-
onBeforeBuild: hooks.onBeforeBuildHook.tap,
|
|
70
|
-
onDevCompileDone: hooks.onDevCompileDoneHook.tap,
|
|
71
|
-
modifyBundlerChain: hooks.modifyBundlerChainHook.tap,
|
|
72
|
-
modifyRspackConfig: hooks.modifyRspackConfigHook.tap,
|
|
73
|
-
modifyWebpackChain: hooks.modifyWebpackChainHook.tap,
|
|
74
|
-
modifyWebpackConfig: hooks.modifyWebpackConfigHook.tap,
|
|
75
|
-
modifyRsbuildConfig: hooks.modifyRsbuildConfigHook.tap,
|
|
76
|
-
onAfterCreateCompiler: hooks.onAfterCreateCompilerHook.tap,
|
|
77
|
-
onAfterStartDevServer: hooks.onAfterStartDevServerHook.tap,
|
|
78
|
-
onBeforeCreateCompiler: hooks.onBeforeCreateCompilerHook.tap,
|
|
79
|
-
onBeforeStartDevServer: hooks.onBeforeStartDevServerHook.tap,
|
|
80
|
-
onAfterStartProdServer: hooks.onAfterStartProdServerHook.tap,
|
|
81
|
-
onBeforeStartProdServer: hooks.onBeforeStartProdServerHook.tap
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
85
|
-
0 && (module.exports = {
|
|
86
|
-
getPluginAPI
|
|
87
|
-
});
|
package/dist/shared/fs.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const getCompiledPath: (packageName: string) => string;
|
package/dist/shared/fs.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var fs_exports = {};
|
|
30
|
-
__export(fs_exports, {
|
|
31
|
-
getCompiledPath: () => getCompiledPath
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(fs_exports);
|
|
34
|
-
var import_fs = __toESM(require("fs"));
|
|
35
|
-
var import_path = require("path");
|
|
36
|
-
var import_shared = require("@rsbuild/shared");
|
|
37
|
-
const getCompiledPath = (packageName) => {
|
|
38
|
-
const providerCompilerPath = (0, import_path.join)(__dirname, "../../compiled", packageName);
|
|
39
|
-
if (import_fs.default.existsSync(providerCompilerPath)) {
|
|
40
|
-
return providerCompilerPath;
|
|
41
|
-
} else {
|
|
42
|
-
return (0, import_shared.getSharedPkgCompiledPath)(packageName);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
-
0 && (module.exports = {
|
|
47
|
-
getCompiledPath
|
|
48
|
-
});
|
package/dist/shared/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './fs';
|
package/dist/shared/index.js
DELETED
|
@@ -1,22 +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 __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
var shared_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(shared_exports);
|
|
18
|
-
__reExport(shared_exports, require("./fs"), module.exports);
|
|
19
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
20
|
-
0 && (module.exports = {
|
|
21
|
-
...require("./fs")
|
|
22
|
-
});
|
|
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
|