@rspack/core 0.7.3-canary-607ec67-20240612123914 → 0.7.3

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.
@@ -8,8 +8,6 @@ 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";
13
11
  export * from "./css-extract";
14
12
  export * from "./CssModulesPlugin";
15
13
  export * from "./DataUriPlugin";
@@ -36,7 +34,6 @@ export * from "./IgnorePlugin";
36
34
  export * from "./InferAsyncModulesPlugin";
37
35
  export * from "./JavascriptModulesPlugin";
38
36
  export * from "./JsLoaderRspackPlugin";
39
- export * from "./JsLoaderRspackPlugin";
40
37
  export * from "./JsonModulesPlugin";
41
38
  export * from "./lazy-compilation/plugin";
42
39
  export * from "./LimitChunkCountPlugin";
@@ -53,9 +50,6 @@ export * from "./ProgressPlugin";
53
50
  export * from "./ProvidePlugin";
54
51
  export * from "./RealContentHashPlugin";
55
52
  export * from "./RemoveEmptyChunksPlugin";
56
- export * from "./RSCClientEntryRspackPlugin";
57
- export * from "./RSCClientReferenceManifestRspackPlugin";
58
- export * from "./RSCProxyRspackPlugin";
59
53
  export * from "./RuntimeChunkPlugin";
60
54
  export * from "./RuntimePlugin";
61
55
  export * from "./SideEffectsFlagPlugin";
@@ -26,8 +26,6 @@ __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);
31
29
  __exportStar(require("./css-extract"), exports);
32
30
  __exportStar(require("./CssModulesPlugin"), exports);
33
31
  __exportStar(require("./DataUriPlugin"), exports);
@@ -54,7 +52,6 @@ __exportStar(require("./IgnorePlugin"), exports);
54
52
  __exportStar(require("./InferAsyncModulesPlugin"), exports);
55
53
  __exportStar(require("./JavascriptModulesPlugin"), exports);
56
54
  __exportStar(require("./JsLoaderRspackPlugin"), exports);
57
- __exportStar(require("./JsLoaderRspackPlugin"), exports);
58
55
  __exportStar(require("./JsonModulesPlugin"), exports);
59
56
  __exportStar(require("./lazy-compilation/plugin"), exports);
60
57
  __exportStar(require("./LimitChunkCountPlugin"), exports);
@@ -71,9 +68,6 @@ __exportStar(require("./ProgressPlugin"), exports);
71
68
  __exportStar(require("./ProvidePlugin"), exports);
72
69
  __exportStar(require("./RealContentHashPlugin"), exports);
73
70
  __exportStar(require("./RemoveEmptyChunksPlugin"), exports);
74
- __exportStar(require("./RSCClientEntryRspackPlugin"), exports);
75
- __exportStar(require("./RSCClientReferenceManifestRspackPlugin"), exports);
76
- __exportStar(require("./RSCProxyRspackPlugin"), exports);
77
71
  __exportStar(require("./RuntimeChunkPlugin"), exports);
78
72
  __exportStar(require("./RuntimePlugin"), exports);
79
73
  __exportStar(require("./SideEffectsFlagPlugin"), exports);
@@ -602,12 +602,11 @@ function getRawSnapshotOptions(_snapshot) {
602
602
  return {};
603
603
  }
604
604
  function getRawExperiments(experiments) {
605
- const { topLevelAwait, rspackFuture, rsc = false } = experiments;
605
+ const { topLevelAwait, rspackFuture } = experiments;
606
606
  (0, assert_1.default)(!(0, util_1.isNil)(topLevelAwait) && !(0, util_1.isNil)(rspackFuture));
607
607
  return {
608
608
  topLevelAwait,
609
- rspackFuture: getRawRspackFutureOptions(rspackFuture),
610
- rsc
609
+ rspackFuture: getRawRspackFutureOptions(rspackFuture)
611
610
  };
612
611
  }
613
612
  function getRawRspackFutureOptions(_future) {
@@ -86,7 +86,6 @@ export interface ExperimentsNormalized {
86
86
  css?: boolean;
87
87
  futureDefaults?: boolean;
88
88
  rspackFuture?: RspackFutureOptions;
89
- rsc?: boolean;
90
89
  }
91
90
  export type IgnoreWarningsNormalized = ((warning: Error, compilation: Compilation) => boolean)[];
92
91
  export type OptimizationRuntimeChunkNormalized = false | {
@@ -5121,7 +5121,6 @@ declare const experiments: z.ZodObject<{
5121
5121
  force?: boolean | "version"[] | undefined;
5122
5122
  } | undefined;
5123
5123
  }>>;
5124
- rsc: z.ZodOptional<z.ZodBoolean>;
5125
5124
  }, "strict", z.ZodTypeAny, {
5126
5125
  lazyCompilation?: boolean | {
5127
5126
  imports?: boolean | undefined;
@@ -5139,7 +5138,6 @@ declare const experiments: z.ZodObject<{
5139
5138
  force?: boolean | "version"[] | undefined;
5140
5139
  } | undefined;
5141
5140
  } | undefined;
5142
- rsc?: boolean | undefined;
5143
5141
  }, {
5144
5142
  lazyCompilation?: boolean | {
5145
5143
  imports?: boolean | undefined;
@@ -5157,7 +5155,6 @@ declare const experiments: z.ZodObject<{
5157
5155
  force?: boolean | "version"[] | undefined;
5158
5156
  } | undefined;
5159
5157
  } | undefined;
5160
- rsc?: boolean | undefined;
5161
5158
  }>;
5162
5159
  export type Experiments = z.infer<typeof experiments>;
5163
5160
  declare const watch: z.ZodBoolean;
@@ -5895,7 +5892,6 @@ export declare const rspackOptions: z.ZodObject<{
5895
5892
  force?: boolean | "version"[] | undefined;
5896
5893
  } | undefined;
5897
5894
  }>>;
5898
- rsc: z.ZodOptional<z.ZodBoolean>;
5899
5895
  }, "strict", z.ZodTypeAny, {
5900
5896
  lazyCompilation?: boolean | {
5901
5897
  imports?: boolean | undefined;
@@ -5913,7 +5909,6 @@ export declare const rspackOptions: z.ZodObject<{
5913
5909
  force?: boolean | "version"[] | undefined;
5914
5910
  } | undefined;
5915
5911
  } | undefined;
5916
- rsc?: boolean | undefined;
5917
5912
  }, {
5918
5913
  lazyCompilation?: boolean | {
5919
5914
  imports?: boolean | undefined;
@@ -5931,7 +5926,6 @@ export declare const rspackOptions: z.ZodObject<{
5931
5926
  force?: boolean | "version"[] | undefined;
5932
5927
  } | undefined;
5933
5928
  } | undefined;
5934
- rsc?: boolean | undefined;
5935
5929
  }>>;
5936
5930
  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<{
5937
5931
  context: z.ZodOptional<z.ZodString>;
@@ -7557,7 +7551,6 @@ export declare const rspackOptions: z.ZodObject<{
7557
7551
  force?: boolean | "version"[] | undefined;
7558
7552
  } | undefined;
7559
7553
  } | undefined;
7560
- rsc?: boolean | undefined;
7561
7554
  } | undefined;
7562
7555
  externals?: string | RegExp | Record<string, string | boolean | string[] | Record<string, string | string[]>> | ((args_0: {
7563
7556
  context?: string | undefined;
@@ -8043,7 +8036,6 @@ export declare const rspackOptions: z.ZodObject<{
8043
8036
  force?: boolean | "version"[] | undefined;
8044
8037
  } | undefined;
8045
8038
  } | undefined;
8046
- rsc?: boolean | undefined;
8047
8039
  } | undefined;
8048
8040
  externals?: string | RegExp | Record<string, string | boolean | string[] | Record<string, string | string[]>> | ((args_0: {
8049
8041
  context?: string | undefined;
@@ -832,8 +832,7 @@ const experiments = zod_1.z.strictObject({
832
832
  topLevelAwait: zod_1.z.boolean().optional(),
833
833
  css: zod_1.z.boolean().optional(),
834
834
  futureDefaults: zod_1.z.boolean().optional(),
835
- rspackFuture: rspackFutureOptions.optional(),
836
- rsc: zod_1.z.boolean().optional()
835
+ rspackFuture: rspackFutureOptions.optional()
837
836
  });
838
837
  //#endregion
839
838
  //#region Watch
package/dist/exports.d.ts CHANGED
@@ -141,6 +141,3 @@ 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,7 +27,6 @@ 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;
31
30
  const { version: rspackVersion, webpackVersion } = require("../package.json");
32
31
  exports.rspackVersion = rspackVersion;
33
32
  exports.version = webpackVersion;
@@ -158,9 +157,3 @@ var builtin_plugin_25 = require("./builtin-plugin");
158
157
  Object.defineProperty(exports, "EvalDevToolModulePlugin", { enumerable: true, get: function () { return builtin_plugin_25.EvalDevToolModulePlugin; } });
159
158
  var builtin_plugin_26 = require("./builtin-plugin");
160
159
  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; } });
@@ -282,7 +282,7 @@ const SORTERS = {
282
282
  // "compilation.modules": MODULES_SORTER,
283
283
  // "chunk.rootModules": MODULES_SORTER,
284
284
  // "chunk.modules": MODULES_SORTER,
285
- // "module.modules": MODULES_SORTER
285
+ // "module.modules": MODULES_SORTER,
286
286
  // not support module.reasons (missing Module.identifier())
287
287
  // not support chunk.origins (missing compilation.chunkGraph)
288
288
  };
@@ -633,6 +633,20 @@ const SIMPLE_EXTRACTORS = {
633
633
  },
634
634
  optimizationBailout: (object, module) => {
635
635
  object.optimizationBailout = module.optimizationBailout || null;
636
+ },
637
+ depth: (object, module) => {
638
+ object.depth = module.depth;
639
+ },
640
+ nestedModules: (object, module, context, options, factory) => {
641
+ const { type } = context;
642
+ const innerModules =
643
+ /** @type {Module & { modules?: Module[] }} */ module.modules;
644
+ if (Array.isArray(innerModules) && innerModules.length > 0) {
645
+ const groupedModules = factory.create(`${type.slice(0, -8)}.modules`, innerModules, context);
646
+ const limited = (0, statsFactoryUtils_1.spaceLimited)(groupedModules, options.nestedModulesSpace);
647
+ object.modules = limited.children;
648
+ object.filteredModules = limited.filteredChildren;
649
+ }
636
650
  }
637
651
  },
638
652
  profile: {
@@ -26,7 +26,7 @@ const NAMED_PRESETS = {
26
26
  chunkModules: true,
27
27
  // dependentModules: true,
28
28
  // chunkOrigins: true,
29
- // depth: true,
29
+ depth: true,
30
30
  // env: true,
31
31
  reasons: true,
32
32
  usedExports: true,
@@ -58,7 +58,7 @@ const NAMED_PRESETS = {
58
58
  chunkRelations: true,
59
59
  chunkModules: false,
60
60
  // chunkOrigins: true,
61
- // depth: true,
61
+ depth: true,
62
62
  usedExports: true,
63
63
  providedExports: true,
64
64
  optimizationBailout: true,
package/module.d.ts ADDED
@@ -0,0 +1,244 @@
1
+ /**
2
+ * The following code is modified based on
3
+ * https://github.com/webpack/webpack/blob/v5.92.0/module.d.ts
4
+ *
5
+ * MIT Licensed
6
+ * Author Tobias Koppers @sokra
7
+ * Copyright (c) JS Foundation and other contributors
8
+ * https://github.com/webpack/webpack/blob/main/LICENSE
9
+ */
10
+
11
+ declare namespace Rspack {
12
+ type DeclinedEvent =
13
+ | {
14
+ type: "declined";
15
+ /** The module in question. */
16
+ moduleId: number | string;
17
+ /** the chain from where the update was propagated. */
18
+ chain: (number | string)[];
19
+ /** the module id of the declining parent */
20
+ parentId: number | string;
21
+ }
22
+ | {
23
+ type: "self-declined";
24
+ /** The module in question. */
25
+ moduleId: number | string;
26
+ /** the chain from where the update was propagated. */
27
+ chain: (number | string)[];
28
+ };
29
+
30
+ type UnacceptedEvent = {
31
+ type: "unaccepted";
32
+ /** The module in question. */
33
+ moduleId: number | string;
34
+ /** the chain from where the update was propagated. */
35
+ chain: (number | string)[];
36
+ };
37
+
38
+ type AcceptedEvent = {
39
+ type: "accepted";
40
+ /** The module in question. */
41
+ moduleId: number | string;
42
+ /** the modules that are outdated and will be disposed */
43
+ outdatedModules: (number | string)[];
44
+ /** the accepted dependencies that are outdated */
45
+ outdatedDependencies: {
46
+ [id: number]: (number | string)[];
47
+ };
48
+ };
49
+
50
+ type DisposedEvent = {
51
+ type: "disposed";
52
+ /** The module in question. */
53
+ moduleId: number | string;
54
+ };
55
+
56
+ type ErroredEvent =
57
+ | {
58
+ type: "accept-error-handler-errored";
59
+ /** The module in question. */
60
+ moduleId: number | string;
61
+ /** the module id owning the accept handler. */
62
+ dependencyId: number | string;
63
+ /** the thrown error */
64
+ error: Error;
65
+ /** the error thrown by the module before the error handler tried to handle it. */
66
+ originalError: Error;
67
+ }
68
+ | {
69
+ type: "self-accept-error-handler-errored";
70
+ /** The module in question. */
71
+ moduleId: number | string;
72
+ /** the thrown error */
73
+ error: Error;
74
+ /** the error thrown by the module before the error handler tried to handle it. */
75
+ originalError: Error;
76
+ }
77
+ | {
78
+ type: "accept-errored";
79
+ /** The module in question. */
80
+ moduleId: number | string;
81
+ /** the module id owning the accept handler. */
82
+ dependencyId: number | string;
83
+ /** the thrown error */
84
+ error: Error;
85
+ }
86
+ | {
87
+ type: "self-accept-errored";
88
+ /** The module in question. */
89
+ moduleId: number | string;
90
+ /** the thrown error */
91
+ error: Error;
92
+ };
93
+
94
+ type HotEvent =
95
+ | DeclinedEvent
96
+ | UnacceptedEvent
97
+ | AcceptedEvent
98
+ | DisposedEvent
99
+ | ErroredEvent;
100
+
101
+ interface ApplyOptions {
102
+ ignoreUnaccepted?: boolean;
103
+ ignoreDeclined?: boolean;
104
+ ignoreErrored?: boolean;
105
+ onDeclined?: (event: DeclinedEvent) => void;
106
+ onUnaccepted?: (event: UnacceptedEvent) => void;
107
+ onAccepted?: (event: AcceptedEvent) => void;
108
+ onDisposed?: (event: DisposedEvent) => void;
109
+ onErrored?: (event: ErroredEvent) => void;
110
+ }
111
+
112
+ const enum HotUpdateStatus {
113
+ idle = "idle",
114
+ check = "check",
115
+ prepare = "prepare",
116
+ ready = "ready",
117
+ dispose = "dispose",
118
+ apply = "apply",
119
+ abort = "abort",
120
+ fail = "fail"
121
+ }
122
+
123
+ interface Hot {
124
+ accept: {
125
+ (
126
+ modules: string | string[],
127
+ callback?: (outdatedDependencies: string[]) => void,
128
+ errorHandler?: (
129
+ err: Error,
130
+ context: { moduleId: string | number; dependencyId: string | number }
131
+ ) => void
132
+ ): void;
133
+ (
134
+ errorHandler?: (
135
+ err: Error,
136
+ ids: { moduleId: string | number; module: NodeJS.Module }
137
+ ) => void
138
+ ): void;
139
+ };
140
+ status(): HotUpdateStatus;
141
+ decline(module?: string | string[]): void;
142
+ dispose(callback: (data: object) => void): void;
143
+ addDisposeHandler(callback: (data: object) => void): void;
144
+ removeDisposeHandler(callback: (data: object) => void): void;
145
+ invalidate(): void;
146
+ addStatusHandler(callback: (status: HotUpdateStatus) => void): void;
147
+ removeStatusHandler(callback: (status: HotUpdateStatus) => void): void;
148
+ data: object;
149
+ check(
150
+ autoApply?: boolean | ApplyOptions
151
+ ): Promise<(string | number)[] | null>;
152
+ apply(options?: ApplyOptions): Promise<(string | number)[] | null>;
153
+ }
154
+
155
+ interface ExportInfo {
156
+ used: boolean;
157
+ provideInfo: boolean | null | undefined;
158
+ useInfo: boolean | null | undefined;
159
+ canMangle: boolean;
160
+ }
161
+
162
+ interface ExportsInfo {
163
+ [k: string]: ExportInfo & ExportsInfo;
164
+ }
165
+
166
+ interface Context {
167
+ resolve(dependency: string): string | number;
168
+ keys(): Array<string>;
169
+ id: string | number;
170
+ (dependency: string): unknown;
171
+ }
172
+ }
173
+
174
+ interface ImportMeta {
175
+ url: string;
176
+ // TODO: unsupported
177
+ // webpack: number;
178
+ webpackHot: Rspack.Hot;
179
+ webpackContext: (
180
+ request: string,
181
+ options?: {
182
+ recursive?: boolean;
183
+ regExp?: RegExp;
184
+ include?: RegExp;
185
+ exclude?: RegExp;
186
+ preload?: boolean | number;
187
+ prefetch?: boolean | number;
188
+ fetchPriority?: "low" | "high" | "auto";
189
+ chunkName?: string;
190
+ exports?: string | string[][];
191
+ mode?: "sync" | "eager" | "weak" | "lazy" | "lazy-once";
192
+ }
193
+ ) => Rspack.Context;
194
+ }
195
+
196
+ declare const __resourceQuery: string;
197
+ declare var __webpack_public_path__: string;
198
+ declare var __webpack_nonce__: string;
199
+ declare const __webpack_chunkname__: string;
200
+ declare var __webpack_base_uri__: string;
201
+ declare var __webpack_runtime_id__: string;
202
+ declare const __webpack_hash__: string;
203
+ declare const __webpack_modules__: Record<string | number, NodeJS.Module>;
204
+ declare const __webpack_require__: (id: string | number) => unknown;
205
+ declare var __webpack_chunk_load__: (chunkId: string | number) => Promise<void>;
206
+ declare var __webpack_get_script_filename__: (
207
+ chunkId: string | number
208
+ ) => string;
209
+ declare var __webpack_is_included__: (request: string) => boolean;
210
+ declare var __webpack_exports_info__: Rspack.ExportsInfo;
211
+ declare const __webpack_share_scopes__: Record<
212
+ string,
213
+ Record<
214
+ string,
215
+ { loaded?: 1; get: () => Promise<unknown>; from: string; eager: boolean }
216
+ >
217
+ >;
218
+ declare var __webpack_init_sharing__: (scope: string) => Promise<void>;
219
+ declare var __non_webpack_require__: (id: any) => unknown;
220
+ declare const __system_context__: object;
221
+
222
+ declare namespace NodeJS {
223
+ interface Module {
224
+ hot: Rspack.Hot;
225
+ }
226
+
227
+ interface Require {
228
+ ensure(
229
+ dependencies: string[],
230
+ callback: (require: (module: string) => void) => void,
231
+ errorCallback?: (error: Error) => void,
232
+ chunkName?: string
233
+ ): void;
234
+ context(
235
+ request: string,
236
+ includeSubdirectories?: boolean,
237
+ filter?: RegExp,
238
+ mode?: "sync" | "eager" | "weak" | "lazy" | "lazy-once"
239
+ ): Rspack.Context;
240
+ include(dependency: string): void;
241
+ resolveWeak(dependency: string): void;
242
+ onError?: (error: Error) => void;
243
+ }
244
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "0.7.3-canary-607ec67-20240612123914",
3
+ "version": "0.7.3",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "A Fast Rust-based Web Bundler",
@@ -12,12 +12,14 @@
12
12
  },
13
13
  "./hot/*": "./hot/*.js",
14
14
  "./hot/*.js": "./hot/*.js",
15
- "./package.json": "./package.json"
15
+ "./package.json": "./package.json",
16
+ "./module": "./module.d.ts"
16
17
  },
17
18
  "files": [
18
19
  "dist",
19
20
  "hot",
20
- "compiled"
21
+ "compiled",
22
+ "module.d.ts"
21
23
  ],
22
24
  "engines": {
23
25
  "node": ">=16.0.0"
@@ -72,15 +74,15 @@
72
74
  "watchpack": "^2.4.0",
73
75
  "zod": "^3.21.4",
74
76
  "zod-validation-error": "1.3.1",
75
- "@rspack/plugin-minify": "^0.7.3-canary-607ec67-20240612123914",
76
- "@rspack/core": "0.7.3-canary-607ec67-20240612123914"
77
+ "@rspack/core": "0.7.3",
78
+ "@rspack/plugin-minify": "^0.7.3"
77
79
  },
78
80
  "dependencies": {
79
81
  "@module-federation/runtime-tools": "0.1.6",
80
82
  "caniuse-lite": "^1.0.30001616",
81
83
  "tapable": "2.2.1",
82
84
  "webpack-sources": "3.2.3",
83
- "@rspack/binding": "0.7.3-canary-607ec67-20240612123914"
85
+ "@rspack/binding": "0.7.3"
84
86
  },
85
87
  "peerDependencies": {
86
88
  "@swc/helpers": ">=0.5.1"
@@ -1,10 +0,0 @@
1
- import { BuiltinPluginName } from "@rspack/binding";
2
- export declare const RSCClientEntryRspackPlugin: {
3
- new (options: any): {
4
- name: BuiltinPluginName;
5
- _options: any;
6
- affectedHooks: "make" | "compile" | "emit" | "afterEmit" | "invalid" | "done" | "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
- };
@@ -1,6 +0,0 @@
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");
@@ -1,21 +0,0 @@
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 {};
@@ -1,60 +0,0 @@
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 path_1 = __importDefault(require("path"));
8
- const binding_1 = require("@rspack/binding");
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;
@@ -1,12 +0,0 @@
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 {};
@@ -1,28 +0,0 @@
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;