@rspack/core 0.7.3-canary-607ec67-20240612123914 → 0.7.3-canary-e3de538-20240625072228
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/builtin-plugin/RSCClientEntryRspackPlugin.d.ts +16 -10
- package/dist/builtin-plugin/RSCClientEntryRspackPlugin.js +37 -1
- package/dist/builtin-plugin/RSCClientReferenceManifestRspackPlugin.d.ts +3 -4
- package/dist/builtin-plugin/RSCClientReferenceManifestRspackPlugin.js +20 -22
- package/dist/builtin-plugin/RSCProxyRspackPlugin.d.ts +6 -0
- package/dist/builtin-plugin/RSCProxyRspackPlugin.js +28 -0
- package/package.json +4 -4
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import type { RawRscClientEntryRspackPluginOptions } from "@rspack/binding";
|
|
2
|
+
import type { Compiler } from "../Compiler";
|
|
3
|
+
import type { RspackBuiltinPlugin } from "./base";
|
|
4
|
+
interface Options extends RawRscClientEntryRspackPluginOptions {
|
|
5
|
+
}
|
|
6
|
+
interface ResolvedOptions {
|
|
7
|
+
root: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class RSCClientEntryRspackPlugin {
|
|
10
|
+
plugin: RspackBuiltinPlugin;
|
|
11
|
+
options: Options;
|
|
12
|
+
constructor(options: Options);
|
|
13
|
+
apply(compiler: Compiler): void;
|
|
14
|
+
resolveOptions(compiler: Compiler): ResolvedOptions;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.RSCClientEntryRspackPlugin = void 0;
|
|
4
7
|
const binding_1 = require("@rspack/binding");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
5
9
|
const base_1 = require("./base");
|
|
6
|
-
|
|
10
|
+
const RawRSCClientEntryRspackPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.RSCClientEntryRspackPlugin, options => options, "compilation");
|
|
11
|
+
class RSCClientEntryRspackPlugin {
|
|
12
|
+
constructor(options) {
|
|
13
|
+
this.plugin = new RawRSCClientEntryRspackPlugin(options);
|
|
14
|
+
this.options = options;
|
|
15
|
+
}
|
|
16
|
+
apply(compiler) {
|
|
17
|
+
this.plugin.apply(compiler);
|
|
18
|
+
if (!compiler.options.module.rules) {
|
|
19
|
+
compiler.options.module.rules = [];
|
|
20
|
+
}
|
|
21
|
+
const resolvedOptions = this.resolveOptions(compiler);
|
|
22
|
+
compiler.options.module.rules.push({
|
|
23
|
+
enforce: "pre",
|
|
24
|
+
test: /rsc-server-action-entry-loader\.(j|t|mj|cj)sx?/,
|
|
25
|
+
use: [
|
|
26
|
+
{
|
|
27
|
+
loader: "builtin:rsc-server-action-server-loader",
|
|
28
|
+
options: resolvedOptions
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
resolveOptions(compiler) {
|
|
34
|
+
const root = compiler.options.context ?? process.cwd();
|
|
35
|
+
// TODO: config output
|
|
36
|
+
const output = path_1.default.resolve(root, "./dist/server");
|
|
37
|
+
return {
|
|
38
|
+
root: output
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.RSCClientEntryRspackPlugin = RSCClientEntryRspackPlugin;
|
|
@@ -3,18 +3,17 @@ import type { Compiler } from "../Compiler";
|
|
|
3
3
|
import type { RuleSetCondition } from "../config/zod";
|
|
4
4
|
import type { RspackBuiltinPlugin } from "./base";
|
|
5
5
|
interface ResolvedOptions {
|
|
6
|
-
routes: NonNullable<RawRscClientReferenceManifestRspackPluginOptions["routes"]>;
|
|
7
|
-
entry: Record<string, string>;
|
|
8
6
|
root: string;
|
|
9
7
|
}
|
|
10
|
-
interface Options extends
|
|
8
|
+
interface Options extends RawRscClientReferenceManifestRspackPluginOptions {
|
|
11
9
|
exclude?: RuleSetCondition;
|
|
10
|
+
serverProxy?: string;
|
|
12
11
|
}
|
|
13
12
|
export declare class RSCClientReferenceManifestRspackPlugin {
|
|
14
13
|
plugin: RspackBuiltinPlugin;
|
|
15
14
|
options: Options;
|
|
16
15
|
resolvedOptions: ResolvedOptions;
|
|
17
|
-
constructor(options
|
|
16
|
+
constructor(options: Options);
|
|
18
17
|
apply(compiler: Compiler): void;
|
|
19
18
|
resolveOptions(compiler: Compiler): ResolvedOptions;
|
|
20
19
|
}
|
|
@@ -4,13 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.RSCClientReferenceManifestRspackPlugin = void 0;
|
|
7
|
-
const
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
8
|
const binding_1 = require("@rspack/binding");
|
|
9
9
|
const base_1 = require("./base");
|
|
10
|
-
const RawRSCClientReferenceManifestRspackPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.RSCClientReferenceManifestRspackPlugin,
|
|
10
|
+
const RawRSCClientReferenceManifestRspackPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.RSCClientReferenceManifestRspackPlugin, options => options, "compilation");
|
|
11
11
|
class RSCClientReferenceManifestRspackPlugin {
|
|
12
|
-
constructor(options
|
|
13
|
-
this.plugin = new RawRSCClientReferenceManifestRspackPlugin(
|
|
12
|
+
constructor(options) {
|
|
13
|
+
this.plugin = new RawRSCClientReferenceManifestRspackPlugin({
|
|
14
|
+
routes: options.routes
|
|
15
|
+
});
|
|
14
16
|
this.options = options;
|
|
15
17
|
this.resolvedOptions = {};
|
|
16
18
|
}
|
|
@@ -21,6 +23,16 @@ class RSCClientReferenceManifestRspackPlugin {
|
|
|
21
23
|
compiler.options.module.rules = [];
|
|
22
24
|
}
|
|
23
25
|
compiler.options.module.rules.push({
|
|
26
|
+
test: /rsc-client-entry-loader\.(j|t|mj|cj)sx?/,
|
|
27
|
+
use: [
|
|
28
|
+
{
|
|
29
|
+
loader: "builtin:rsc-client-entry-loader",
|
|
30
|
+
options: this.resolvedOptions
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
});
|
|
34
|
+
compiler.options.module.rules.push({
|
|
35
|
+
enforce: "post",
|
|
24
36
|
test: [/\.(j|t|mj|cj)sx?$/i],
|
|
25
37
|
exclude: this.options.exclude ?? {
|
|
26
38
|
// Exclude libraries in node_modules ...
|
|
@@ -28,32 +40,18 @@ class RSCClientReferenceManifestRspackPlugin {
|
|
|
28
40
|
},
|
|
29
41
|
use: [
|
|
30
42
|
{
|
|
31
|
-
loader: "builtin:rsc-client-
|
|
32
|
-
options: this.
|
|
43
|
+
loader: "builtin:rsc-server-action-client-loader",
|
|
44
|
+
options: { serverProxy: this.options.serverProxy }
|
|
33
45
|
}
|
|
34
46
|
]
|
|
35
47
|
});
|
|
36
48
|
}
|
|
37
49
|
resolveOptions(compiler) {
|
|
38
|
-
const entry = Object.assign({}, compiler.options.entry);
|
|
39
|
-
const resolvedEntry = {};
|
|
40
50
|
const root = compiler.options.context ?? process.cwd();
|
|
41
|
-
// TODO: support dynamic entry
|
|
42
|
-
if (typeof entry === "object") {
|
|
43
|
-
for (let item of Object.keys(entry)) {
|
|
44
|
-
const imports = entry[item].import;
|
|
45
|
-
if (imports) {
|
|
46
|
-
resolvedEntry[item] = imports[0];
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
const resolvedRoutes = this.options.routes ?? [];
|
|
51
51
|
// TODO: config output
|
|
52
|
-
const output =
|
|
52
|
+
const output = node_path_1.default.resolve(root, "./dist/server");
|
|
53
53
|
return {
|
|
54
|
-
|
|
55
|
-
root: output,
|
|
56
|
-
routes: resolvedRoutes
|
|
54
|
+
root: output
|
|
57
55
|
};
|
|
58
56
|
}
|
|
59
57
|
}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import type { Compiler } from "../Compiler";
|
|
2
2
|
import type { RuleSetCondition } from "../config/zod";
|
|
3
|
+
import type { RspackBuiltinPlugin } from "./base";
|
|
3
4
|
interface Options {
|
|
4
5
|
clientProxy: string;
|
|
5
6
|
exclude?: RuleSetCondition;
|
|
6
7
|
}
|
|
8
|
+
interface ResolvedOptions {
|
|
9
|
+
root: string;
|
|
10
|
+
}
|
|
7
11
|
export declare class RSCProxyRspackPlugin {
|
|
12
|
+
plugin: RspackBuiltinPlugin;
|
|
8
13
|
options: Options;
|
|
9
14
|
constructor(options: Options);
|
|
10
15
|
apply(compiler: Compiler): void;
|
|
16
|
+
resolveOptions(compiler: Compiler): ResolvedOptions;
|
|
11
17
|
}
|
|
12
18
|
export {};
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.RSCProxyRspackPlugin = void 0;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const binding_1 = require("@rspack/binding");
|
|
9
|
+
const base_1 = require("./base");
|
|
10
|
+
const RawRSCProxyRspackPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.RSCProxyRspackPlugin, options => options, "compilation");
|
|
4
11
|
class RSCProxyRspackPlugin {
|
|
5
12
|
constructor(options) {
|
|
13
|
+
this.plugin = new RawRSCProxyRspackPlugin({});
|
|
6
14
|
this.options = options;
|
|
7
15
|
}
|
|
8
16
|
apply(compiler) {
|
|
17
|
+
this.plugin.apply(compiler);
|
|
9
18
|
if (!compiler.options.module.rules) {
|
|
10
19
|
compiler.options.module.rules = [];
|
|
11
20
|
}
|
|
@@ -23,6 +32,25 @@ class RSCProxyRspackPlugin {
|
|
|
23
32
|
}
|
|
24
33
|
]
|
|
25
34
|
});
|
|
35
|
+
const resolvedOptions = this.resolveOptions(compiler);
|
|
36
|
+
compiler.options.module.rules.push({
|
|
37
|
+
enforce: "pre",
|
|
38
|
+
test: /rsc-server-action-entry-loader\.(j|t|mj|cj)sx?/,
|
|
39
|
+
use: [
|
|
40
|
+
{
|
|
41
|
+
loader: "builtin:rsc-server-action-server-loader",
|
|
42
|
+
options: resolvedOptions
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
resolveOptions(compiler) {
|
|
48
|
+
const root = compiler.options.context ?? process.cwd();
|
|
49
|
+
// TODO: config output
|
|
50
|
+
const output = node_path_1.default.resolve(root, "./dist/server");
|
|
51
|
+
return {
|
|
52
|
+
root: output
|
|
53
|
+
};
|
|
26
54
|
}
|
|
27
55
|
}
|
|
28
56
|
exports.RSCProxyRspackPlugin = RSCProxyRspackPlugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/core",
|
|
3
|
-
"version": "0.7.3-canary-
|
|
3
|
+
"version": "0.7.3-canary-e3de538-20240625072228",
|
|
4
4
|
"webpackVersion": "5.75.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "A Fast Rust-based Web Bundler",
|
|
@@ -72,15 +72,15 @@
|
|
|
72
72
|
"watchpack": "^2.4.0",
|
|
73
73
|
"zod": "^3.21.4",
|
|
74
74
|
"zod-validation-error": "1.3.1",
|
|
75
|
-
"@rspack/
|
|
76
|
-
"@rspack/
|
|
75
|
+
"@rspack/core": "0.7.3-canary-e3de538-20240625072228",
|
|
76
|
+
"@rspack/plugin-minify": "^0.7.3-canary-e3de538-20240625072228"
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
79
|
"@module-federation/runtime-tools": "0.1.6",
|
|
80
80
|
"caniuse-lite": "^1.0.30001616",
|
|
81
81
|
"tapable": "2.2.1",
|
|
82
82
|
"webpack-sources": "3.2.3",
|
|
83
|
-
"@rspack/binding": "0.7.3-canary-
|
|
83
|
+
"@rspack/binding": "0.7.3-canary-e3de538-20240625072228"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
86
|
"@swc/helpers": ">=0.5.1"
|