@rspack/core 0.7.1-canary-fdc7685-20240605004251 → 0.7.1-canary-6e44e4b-20240605080608

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.
@@ -0,0 +1,10 @@
1
+ import { BuiltinPluginName } from "@rspack/binding";
2
+ export declare const RSCClientEntryRspackPlugin: {
3
+ new (options: any): {
4
+ name: BuiltinPluginName;
5
+ _options: any;
6
+ affectedHooks: "done" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
7
+ raw(): import("@rspack/binding").BuiltinPlugin;
8
+ apply(compiler: import("../Compiler").Compiler): void;
9
+ };
10
+ };
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RSCClientEntryRspackPlugin = void 0;
4
+ const binding_1 = require("@rspack/binding");
5
+ const base_1 = require("./base");
6
+ exports.RSCClientEntryRspackPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.RSCClientEntryRspackPlugin, options => options, "compilation");
@@ -0,0 +1,21 @@
1
+ import type { RawRscClientReferenceManifestRspackPluginOptions } from "@rspack/binding";
2
+ import type { Compiler } from "../Compiler";
3
+ import type { RuleSetCondition } from "../config/zod";
4
+ import type { RspackBuiltinPlugin } from "./base";
5
+ interface ResolvedOptions {
6
+ routes: NonNullable<RawRscClientReferenceManifestRspackPluginOptions["routes"]>;
7
+ entry: Record<string, string>;
8
+ root: string;
9
+ }
10
+ interface Options extends Pick<RawRscClientReferenceManifestRspackPluginOptions, "routes"> {
11
+ exclude?: RuleSetCondition;
12
+ }
13
+ export declare class RSCClientReferenceManifestRspackPlugin {
14
+ plugin: RspackBuiltinPlugin;
15
+ options: Options;
16
+ resolvedOptions: ResolvedOptions;
17
+ constructor(options?: Options);
18
+ apply(compiler: Compiler): void;
19
+ resolveOptions(compiler: Compiler): ResolvedOptions;
20
+ }
21
+ export {};
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.RSCClientReferenceManifestRspackPlugin = void 0;
7
+ const binding_1 = require("@rspack/binding");
8
+ const path_1 = __importDefault(require("path"));
9
+ const base_1 = require("./base");
10
+ const RawRSCClientReferenceManifestRspackPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.RSCClientReferenceManifestRspackPlugin, () => { }, "compilation");
11
+ class RSCClientReferenceManifestRspackPlugin {
12
+ constructor(options = {}) {
13
+ this.plugin = new RawRSCClientReferenceManifestRspackPlugin();
14
+ this.options = options;
15
+ this.resolvedOptions = {};
16
+ }
17
+ apply(compiler) {
18
+ this.plugin.apply(compiler);
19
+ this.resolvedOptions = this.resolveOptions(compiler);
20
+ if (!compiler.options.module.rules) {
21
+ compiler.options.module.rules = [];
22
+ }
23
+ compiler.options.module.rules.push({
24
+ test: [/\.(j|t|mj|cj)sx?$/i],
25
+ exclude: this.options.exclude ?? {
26
+ // Exclude libraries in node_modules ...
27
+ and: [/node_modules/]
28
+ },
29
+ use: [
30
+ {
31
+ loader: "builtin:rsc-client-entry-loader",
32
+ options: this.resolvedOptions
33
+ }
34
+ ]
35
+ });
36
+ }
37
+ resolveOptions(compiler) {
38
+ const entry = Object.assign({}, compiler.options.entry);
39
+ const resolvedEntry = {};
40
+ 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
+ // TODO: config output
52
+ const output = path_1.default.resolve(root, "./dist/server");
53
+ return {
54
+ entry: resolvedEntry,
55
+ root: output,
56
+ routes: resolvedRoutes
57
+ };
58
+ }
59
+ }
60
+ exports.RSCClientReferenceManifestRspackPlugin = RSCClientReferenceManifestRspackPlugin;
@@ -0,0 +1,12 @@
1
+ import type { Compiler } from "../Compiler";
2
+ import type { RuleSetCondition } from "../config/zod";
3
+ interface Options {
4
+ clientProxy: string;
5
+ exclude?: RuleSetCondition;
6
+ }
7
+ export declare class RSCProxyRspackPlugin {
8
+ options: Options;
9
+ constructor(options: Options);
10
+ apply(compiler: Compiler): void;
11
+ }
12
+ export {};
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RSCProxyRspackPlugin = void 0;
4
+ class RSCProxyRspackPlugin {
5
+ constructor(options) {
6
+ this.options = options;
7
+ }
8
+ apply(compiler) {
9
+ if (!compiler.options.module.rules) {
10
+ compiler.options.module.rules = [];
11
+ }
12
+ compiler.options.module.rules.push({
13
+ enforce: "post",
14
+ test: [/\.(j|t|mj|cj)sx?$/i],
15
+ exclude: this.options.exclude ?? {
16
+ // Exclude libraries in node_modules ...
17
+ and: [/node_modules/]
18
+ },
19
+ use: [
20
+ {
21
+ loader: "builtin:rsc-proxy-loader",
22
+ options: this.options
23
+ }
24
+ ]
25
+ });
26
+ }
27
+ }
28
+ exports.RSCProxyRspackPlugin = RSCProxyRspackPlugin;
@@ -8,6 +8,8 @@ export * from "./BundlerInfoRspackPlugin";
8
8
  export * from "./ChunkPrefetchPreloadPlugin";
9
9
  export * from "./CommonJsChunkFormatPlugin";
10
10
  export * from "./CopyRspackPlugin";
11
+ export * from "./CopyRspackPlugin";
12
+ export * from "./css-extract";
11
13
  export * from "./css-extract";
12
14
  export * from "./CssModulesPlugin";
13
15
  export * from "./DataUriPlugin";
@@ -34,6 +36,7 @@ export * from "./IgnorePlugin";
34
36
  export * from "./InferAsyncModulesPlugin";
35
37
  export * from "./JavascriptModulesPlugin";
36
38
  export * from "./JsLoaderRspackPlugin";
39
+ export * from "./JsLoaderRspackPlugin";
37
40
  export * from "./JsonModulesPlugin";
38
41
  export * from "./lazy-compilation/plugin";
39
42
  export * from "./LimitChunkCountPlugin";
@@ -50,6 +53,9 @@ export * from "./ProgressPlugin";
50
53
  export * from "./ProvidePlugin";
51
54
  export * from "./RealContentHashPlugin";
52
55
  export * from "./RemoveEmptyChunksPlugin";
56
+ export * from "./RSCClientEntryRspackPlugin";
57
+ export * from "./RSCClientReferenceManifestRspackPlugin";
58
+ export * from "./RSCProxyRspackPlugin";
53
59
  export * from "./RuntimeChunkPlugin";
54
60
  export * from "./RuntimePlugin";
55
61
  export * from "./SideEffectsFlagPlugin";
@@ -26,6 +26,8 @@ __exportStar(require("./BundlerInfoRspackPlugin"), exports);
26
26
  __exportStar(require("./ChunkPrefetchPreloadPlugin"), exports);
27
27
  __exportStar(require("./CommonJsChunkFormatPlugin"), exports);
28
28
  __exportStar(require("./CopyRspackPlugin"), exports);
29
+ __exportStar(require("./CopyRspackPlugin"), exports);
30
+ __exportStar(require("./css-extract"), exports);
29
31
  __exportStar(require("./css-extract"), exports);
30
32
  __exportStar(require("./CssModulesPlugin"), exports);
31
33
  __exportStar(require("./DataUriPlugin"), exports);
@@ -52,6 +54,7 @@ __exportStar(require("./IgnorePlugin"), exports);
52
54
  __exportStar(require("./InferAsyncModulesPlugin"), exports);
53
55
  __exportStar(require("./JavascriptModulesPlugin"), exports);
54
56
  __exportStar(require("./JsLoaderRspackPlugin"), exports);
57
+ __exportStar(require("./JsLoaderRspackPlugin"), exports);
55
58
  __exportStar(require("./JsonModulesPlugin"), exports);
56
59
  __exportStar(require("./lazy-compilation/plugin"), exports);
57
60
  __exportStar(require("./LimitChunkCountPlugin"), exports);
@@ -68,6 +71,9 @@ __exportStar(require("./ProgressPlugin"), exports);
68
71
  __exportStar(require("./ProvidePlugin"), exports);
69
72
  __exportStar(require("./RealContentHashPlugin"), exports);
70
73
  __exportStar(require("./RemoveEmptyChunksPlugin"), exports);
74
+ __exportStar(require("./RSCClientEntryRspackPlugin"), exports);
75
+ __exportStar(require("./RSCClientReferenceManifestRspackPlugin"), exports);
76
+ __exportStar(require("./RSCProxyRspackPlugin"), exports);
71
77
  __exportStar(require("./RuntimeChunkPlugin"), exports);
72
78
  __exportStar(require("./RuntimePlugin"), exports);
73
79
  __exportStar(require("./SideEffectsFlagPlugin"), exports);
@@ -603,11 +603,12 @@ function getRawSnapshotOptions(_snapshot) {
603
603
  return {};
604
604
  }
605
605
  function getRawExperiments(experiments) {
606
- const { topLevelAwait, rspackFuture } = experiments;
606
+ const { topLevelAwait, rspackFuture, rsc = false } = experiments;
607
607
  (0, assert_1.default)(!(0, util_1.isNil)(topLevelAwait) && !(0, util_1.isNil)(rspackFuture));
608
608
  return {
609
609
  topLevelAwait,
610
- rspackFuture: getRawRspackFutureOptions(rspackFuture)
610
+ rspackFuture: getRawRspackFutureOptions(rspackFuture),
611
+ rsc
611
612
  };
612
613
  }
613
614
  function getRawRspackFutureOptions(_future) {
@@ -86,6 +86,7 @@ export interface ExperimentsNormalized {
86
86
  css?: boolean;
87
87
  futureDefaults?: boolean;
88
88
  rspackFuture?: RspackFutureOptions;
89
+ rsc?: boolean;
89
90
  }
90
91
  export type IgnoreWarningsNormalized = ((warning: Error, compilation: Compilation) => boolean)[];
91
92
  export type OptimizationRuntimeChunkNormalized = false | {
@@ -4905,6 +4905,7 @@ declare const experiments: z.ZodObject<{
4905
4905
  force?: boolean | "version"[] | undefined;
4906
4906
  } | undefined;
4907
4907
  }>>;
4908
+ rsc: z.ZodOptional<z.ZodBoolean>;
4908
4909
  }, "strict", z.ZodTypeAny, {
4909
4910
  lazyCompilation?: boolean | {
4910
4911
  imports?: boolean | undefined;
@@ -4922,6 +4923,7 @@ declare const experiments: z.ZodObject<{
4922
4923
  force?: boolean | "version"[] | undefined;
4923
4924
  } | undefined;
4924
4925
  } | undefined;
4926
+ rsc?: boolean | undefined;
4925
4927
  }, {
4926
4928
  lazyCompilation?: boolean | {
4927
4929
  imports?: boolean | undefined;
@@ -4939,6 +4941,7 @@ declare const experiments: z.ZodObject<{
4939
4941
  force?: boolean | "version"[] | undefined;
4940
4942
  } | undefined;
4941
4943
  } | undefined;
4944
+ rsc?: boolean | undefined;
4942
4945
  }>;
4943
4946
  export type Experiments = z.infer<typeof experiments>;
4944
4947
  declare const watch: z.ZodBoolean;
@@ -5676,6 +5679,7 @@ export declare const rspackOptions: z.ZodObject<{
5676
5679
  force?: boolean | "version"[] | undefined;
5677
5680
  } | undefined;
5678
5681
  }>>;
5682
+ rsc: z.ZodOptional<z.ZodBoolean>;
5679
5683
  }, "strict", z.ZodTypeAny, {
5680
5684
  lazyCompilation?: boolean | {
5681
5685
  imports?: boolean | undefined;
@@ -5693,6 +5697,7 @@ export declare const rspackOptions: z.ZodObject<{
5693
5697
  force?: boolean | "version"[] | undefined;
5694
5698
  } | undefined;
5695
5699
  } | undefined;
5700
+ rsc?: boolean | undefined;
5696
5701
  }, {
5697
5702
  lazyCompilation?: boolean | {
5698
5703
  imports?: boolean | undefined;
@@ -5710,6 +5715,7 @@ export declare const rspackOptions: z.ZodObject<{
5710
5715
  force?: boolean | "version"[] | undefined;
5711
5716
  } | undefined;
5712
5717
  } | undefined;
5718
+ rsc?: boolean | undefined;
5713
5719
  }>>;
5714
5720
  externals: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodBoolean]>, z.ZodArray<z.ZodString, "many">]>, z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>]>>]>, z.ZodFunction<z.ZodTuple<[z.ZodObject<{
5715
5721
  context: z.ZodOptional<z.ZodString>;
@@ -7227,6 +7233,7 @@ export declare const rspackOptions: z.ZodObject<{
7227
7233
  force?: boolean | "version"[] | undefined;
7228
7234
  } | undefined;
7229
7235
  } | undefined;
7236
+ rsc?: boolean | undefined;
7230
7237
  } | undefined;
7231
7238
  externals?: string | RegExp | Record<string, string | boolean | string[] | Record<string, string | string[]>> | ((args_0: {
7232
7239
  context?: string | undefined;
@@ -7676,6 +7683,7 @@ export declare const rspackOptions: z.ZodObject<{
7676
7683
  force?: boolean | "version"[] | undefined;
7677
7684
  } | undefined;
7678
7685
  } | undefined;
7686
+ rsc?: boolean | undefined;
7679
7687
  } | undefined;
7680
7688
  externals?: string | RegExp | Record<string, string | boolean | string[] | Record<string, string | string[]>> | ((args_0: {
7681
7689
  context?: string | undefined;
@@ -778,7 +778,8 @@ const experiments = zod_1.z.strictObject({
778
778
  topLevelAwait: zod_1.z.boolean().optional(),
779
779
  css: zod_1.z.boolean().optional(),
780
780
  futureDefaults: zod_1.z.boolean().optional(),
781
- rspackFuture: rspackFutureOptions.optional()
781
+ rspackFuture: rspackFutureOptions.optional(),
782
+ rsc: zod_1.z.boolean().optional()
782
783
  });
783
784
  //#endregion
784
785
  //#region Watch
package/dist/exports.d.ts CHANGED
@@ -141,3 +141,6 @@ export { EvalSourceMapDevToolPlugin } from "./builtin-plugin";
141
141
  export { EvalDevToolModulePlugin } from "./builtin-plugin";
142
142
  export { CssExtractRspackPlugin } from "./builtin-plugin";
143
143
  export type { SwcLoaderEnvConfig, SwcLoaderEsParserConfig, SwcLoaderJscConfig, SwcLoaderModuleConfig, SwcLoaderOptions, SwcLoaderParserConfig, SwcLoaderTransformConfig, SwcLoaderTsParserConfig } from "./builtin-loader/swc/index";
144
+ export { RSCClientEntryRspackPlugin } from "./builtin-plugin";
145
+ export { RSCProxyRspackPlugin } from "./builtin-plugin";
146
+ export { RSCClientReferenceManifestRspackPlugin } from "./builtin-plugin";
package/dist/exports.js CHANGED
@@ -27,6 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.CssExtractRspackPlugin = exports.EvalDevToolModulePlugin = exports.EvalSourceMapDevToolPlugin = exports.SourceMapDevToolPlugin = exports.CopyRspackPlugin = exports.SwcCssMinimizerRspackPlugin = exports.SwcJsMinimizerRspackPlugin = exports.HtmlRspackPlugin = exports.sharing = exports.container = exports.optimize = exports.webworker = exports.javascript = exports.wasm = exports.library = exports.electron = exports.node = exports.NormalModuleReplacementPlugin = exports.LoaderTargetPlugin = exports.LoaderOptionsPlugin = exports.EnvironmentPlugin = exports.HotModuleReplacementPlugin = exports.ExternalsPlugin = exports.DynamicEntryPlugin = exports.EntryPlugin = exports.ProgressPlugin = exports.DefinePlugin = exports.ProvidePlugin = exports.IgnorePlugin = exports.BannerPlugin = exports.experimental_registerGlobalTrace = exports.experimental_cleanupGlobalTrace = exports.EntryOptionPlugin = exports.util = exports.config = exports.sources = exports.WebpackError = exports.Template = exports.ModuleFilenameHelpers = exports.Stats = exports.RuntimeGlobals = exports.NormalModule = exports.MultiStats = exports.WebpackOptionsApply = exports.RspackOptionsApply = exports.MultiCompiler = exports.Compiler = exports.Compilation = exports.version = exports.rspackVersion = void 0;
30
+ exports.RSCClientReferenceManifestRspackPlugin = exports.RSCProxyRspackPlugin = exports.RSCClientEntryRspackPlugin = void 0;
30
31
  const { version: rspackVersion, webpackVersion } = require("../package.json");
31
32
  exports.rspackVersion = rspackVersion;
32
33
  exports.version = webpackVersion;
@@ -157,3 +158,9 @@ var builtin_plugin_25 = require("./builtin-plugin");
157
158
  Object.defineProperty(exports, "EvalDevToolModulePlugin", { enumerable: true, get: function () { return builtin_plugin_25.EvalDevToolModulePlugin; } });
158
159
  var builtin_plugin_26 = require("./builtin-plugin");
159
160
  Object.defineProperty(exports, "CssExtractRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_26.CssExtractRspackPlugin; } });
161
+ var builtin_plugin_27 = require("./builtin-plugin");
162
+ Object.defineProperty(exports, "RSCClientEntryRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_27.RSCClientEntryRspackPlugin; } });
163
+ var builtin_plugin_28 = require("./builtin-plugin");
164
+ Object.defineProperty(exports, "RSCProxyRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_28.RSCProxyRspackPlugin; } });
165
+ var builtin_plugin_29 = require("./builtin-plugin");
166
+ Object.defineProperty(exports, "RSCClientReferenceManifestRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_29.RSCClientReferenceManifestRspackPlugin; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "0.7.1-canary-fdc7685-20240605004251",
3
+ "version": "0.7.1-canary-6e44e4b-20240605080608",
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/core": "0.7.1-canary-fdc7685-20240605004251",
76
- "@rspack/plugin-minify": "^0.7.1-canary-fdc7685-20240605004251"
75
+ "@rspack/plugin-minify": "^0.7.1-canary-6e44e4b-20240605080608",
76
+ "@rspack/core": "0.7.1-canary-6e44e4b-20240605080608"
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.1-canary-fdc7685-20240605004251"
83
+ "@rspack/binding": "0.7.1-canary-6e44e4b-20240605080608"
84
84
  },
85
85
  "peerDependencies": {
86
86
  "@swc/helpers": ">=0.5.1"