@rspack/core 0.7.1-canary-6e44e4b-20240605080608 → 0.7.1-canary-a7d673e-20240606094751

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.
@@ -9,19 +9,19 @@ class ChunkGraph {
9
9
  this.compilation = compilation;
10
10
  }
11
11
  getChunkModules(chunk) {
12
- return (0, binding_1.__chunk_graph_inner_get_chunk_modules)(chunk.__internal_inner_ukey(), this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m, this.compilation));
12
+ return (0, binding_1.__chunk_graph_inner_get_chunk_modules)(chunk.__internal_inner_ukey(), this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m));
13
13
  }
14
14
  getChunkModulesIterable(chunk) {
15
- return new Set((0, binding_1.__chunk_graph_inner_get_chunk_modules)(chunk.__internal_inner_ukey(), this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m, this.compilation)));
15
+ return new Set((0, binding_1.__chunk_graph_inner_get_chunk_modules)(chunk.__internal_inner_ukey(), this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m)));
16
16
  }
17
17
  getChunkEntryModulesIterable(chunk) {
18
- return new Set((0, binding_1.__chunk_graph_inner_get_chunk_entry_modules)(chunk.__internal_inner_ukey(), this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m, this.compilation)));
18
+ return new Set((0, binding_1.__chunk_graph_inner_get_chunk_entry_modules)(chunk.__internal_inner_ukey(), this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m)));
19
19
  }
20
20
  getChunkEntryDependentChunksIterable(chunk) {
21
21
  return new Set((0, binding_1.__chunk_graph_inner_get_chunk_entry_dependent_chunks_iterable)(chunk.__internal_inner_ukey(), this.compilation.__internal_getInner()).map(c => Chunk_1.Chunk.__from_binding(c, this.compilation.__internal_getInner())));
22
22
  }
23
23
  getChunkModulesIterableBySourceType(chunk, sourceType) {
24
- return new Set((0, binding_1.__chunk_graph_inner_get_chunk_modules_iterable_by_source_type)(chunk.__internal_inner_ukey(), sourceType, this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m, this.compilation)));
24
+ return new Set((0, binding_1.__chunk_graph_inner_get_chunk_modules_iterable_by_source_type)(chunk.__internal_inner_ukey(), sourceType, this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m)));
25
25
  }
26
26
  }
27
27
  exports.ChunkGraph = ChunkGraph;
@@ -136,15 +136,6 @@ export declare class Compilation {
136
136
  * Note: This is a proxy for webpack internal API, only method `get` is supported now.
137
137
  */
138
138
  get namedChunks(): Map<string, Readonly<Chunk>>;
139
- /**
140
- * Note: This is not a webpack public API, maybe removed in future.
141
- *
142
- * @internal
143
- */
144
- __internal__getCustomModule(moduleIdentifier: string): {
145
- buildInfo: Record<string, unknown>;
146
- buildMeta: Record<string, unknown>;
147
- };
148
139
  getCache(name: string): import("./lib/CacheFacade");
149
140
  createStatsOptions(optionsOrPreset: StatsValue | undefined, context?: CreateStatsOptionsContext): StatsOptions;
150
141
  createStatsFactory(options: StatsOptions): StatsFactory;
@@ -36,7 +36,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
36
36
  var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  return (mod && mod.__esModule) ? mod : { "default": mod };
38
38
  };
39
- var _Compilation_instances, _Compilation_inner, _Compilation_cachedAssets, _Compilation_customModules, _Compilation_createCachedAssets;
39
+ var _Compilation_instances, _Compilation_inner, _Compilation_cachedAssets, _Compilation_createCachedAssets;
40
40
  Object.defineProperty(exports, "__esModule", { value: true });
41
41
  exports.Compilation = void 0;
42
42
  const tapable = __importStar(require("tapable"));
@@ -67,33 +67,25 @@ class Compilation {
67
67
  return null;
68
68
  }
69
69
  };
70
- /**
71
- * Records the dynamically added fields for Module on the JavaScript side, using the Module identifier for association.
72
- * These fields are generally used within a plugin, so they do not need to be passed back to the Rust side.
73
- */
74
- _Compilation_customModules.set(this, void 0);
75
70
  this.fileDependencies = (0, fake_1.createFakeCompilationDependencies)(() => __classPrivateFieldGet(this, _Compilation_inner, "f").getFileDependencies(), d => __classPrivateFieldGet(this, _Compilation_inner, "f").addFileDependencies(d));
76
71
  this.contextDependencies = (0, fake_1.createFakeCompilationDependencies)(() => __classPrivateFieldGet(this, _Compilation_inner, "f").getContextDependencies(), d => __classPrivateFieldGet(this, _Compilation_inner, "f").addContextDependencies(d));
77
72
  this.missingDependencies = (0, fake_1.createFakeCompilationDependencies)(() => __classPrivateFieldGet(this, _Compilation_inner, "f").getMissingDependencies(), d => __classPrivateFieldGet(this, _Compilation_inner, "f").addMissingDependencies(d));
78
73
  this.buildDependencies = (0, fake_1.createFakeCompilationDependencies)(() => __classPrivateFieldGet(this, _Compilation_inner, "f").getBuildDependencies(), d => __classPrivateFieldGet(this, _Compilation_inner, "f").addBuildDependencies(d));
79
- this._rebuildModuleCaller = (function (compilation) {
80
- return new MergeCaller_1.default((args) => {
81
- __classPrivateFieldGet(compilation, _Compilation_inner, "f").rebuildModule(args.map(item => item[0]), function (err, modules) {
82
- for (const [id, callback] of args) {
83
- const m = modules.find(item => item.moduleIdentifier === id);
84
- if (m) {
85
- callback(err, Module_1.Module.__from_binding(m, compilation));
86
- }
87
- else {
88
- callback(err || new Error("module no found"), null);
89
- }
74
+ this._rebuildModuleCaller = new MergeCaller_1.default((args) => {
75
+ __classPrivateFieldGet(this, _Compilation_inner, "f").rebuildModule(args.map(item => item[0]), function (err, modules) {
76
+ for (const [id, callback] of args) {
77
+ const m = modules.find(item => item.moduleIdentifier === id);
78
+ if (m) {
79
+ callback(err, Module_1.Module.__from_binding(m));
90
80
  }
91
- });
92
- }, 10);
93
- })(this);
81
+ else {
82
+ callback(err || new Error("module no found"), null);
83
+ }
84
+ }
85
+ });
86
+ }, 10);
94
87
  __classPrivateFieldSet(this, _Compilation_inner, inner, "f");
95
88
  __classPrivateFieldSet(this, _Compilation_cachedAssets, __classPrivateFieldGet(this, _Compilation_instances, "m", _Compilation_createCachedAssets).call(this), "f");
96
- __classPrivateFieldSet(this, _Compilation_customModules, {}, "f");
97
89
  const processAssetsHook = new liteTapable.AsyncSeriesHook([
98
90
  "assets"
99
91
  ]);
@@ -195,7 +187,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
195
187
  }
196
188
  get modules() {
197
189
  return (0, memoize_1.memoizeValue)(() => {
198
- return this.__internal__getModules().map(item => Module_1.Module.__from_binding(item, this));
190
+ return this.__internal__getModules().map(item => Module_1.Module.__from_binding(item));
199
191
  });
200
192
  }
201
193
  // FIXME: Webpack returns a `Set`
@@ -219,21 +211,6 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
219
211
  }
220
212
  };
221
213
  }
222
- /**
223
- * Note: This is not a webpack public API, maybe removed in future.
224
- *
225
- * @internal
226
- */
227
- __internal__getCustomModule(moduleIdentifier) {
228
- let module = __classPrivateFieldGet(this, _Compilation_customModules, "f")[moduleIdentifier];
229
- if (!module) {
230
- module = __classPrivateFieldGet(this, _Compilation_customModules, "f")[moduleIdentifier] = {
231
- buildInfo: {},
232
- buildMeta: {}
233
- };
234
- }
235
- return module;
236
- }
237
214
  getCache(name) {
238
215
  return this.compiler.getCache(name);
239
216
  }
@@ -706,7 +683,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
706
683
  seal() { }
707
684
  unseal() { }
708
685
  }
709
- _Compilation_inner = new WeakMap(), _Compilation_cachedAssets = new WeakMap(), _Compilation_customModules = new WeakMap(), _Compilation_instances = new WeakSet(), _Compilation_createCachedAssets = function _Compilation_createCachedAssets() {
686
+ _Compilation_inner = new WeakMap(), _Compilation_cachedAssets = new WeakMap(), _Compilation_instances = new WeakSet(), _Compilation_createCachedAssets = function _Compilation_createCachedAssets() {
710
687
  return new Proxy({}, {
711
688
  get: (_, property) => {
712
689
  if (typeof property === "string") {
package/dist/Compiler.js CHANGED
@@ -608,9 +608,9 @@ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler
608
608
  }
609
609
  return;
610
610
  }),
611
- registerCompilationBuildModuleTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationBuildModule, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.buildModule, queired => (m) => queired.call(Module_1.Module.__from_binding(m, __classPrivateFieldGet(this, _Compiler_compilation, "f")))),
612
- registerCompilationStillValidModuleTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationStillValidModule, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.stillValidModule, queired => (m) => queired.call(Module_1.Module.__from_binding(m, __classPrivateFieldGet(this, _Compiler_compilation, "f")))),
613
- registerCompilationSucceedModuleTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationSucceedModule, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.succeedModule, queired => (m) => queired.call(Module_1.Module.__from_binding(m, __classPrivateFieldGet(this, _Compiler_compilation, "f")))),
611
+ registerCompilationBuildModuleTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationBuildModule, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.buildModule, queired => (m) => queired.call(Module_1.Module.__from_binding(m))),
612
+ registerCompilationStillValidModuleTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationStillValidModule, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.stillValidModule, queired => (m) => queired.call(Module_1.Module.__from_binding(m))),
613
+ registerCompilationSucceedModuleTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationSucceedModule, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.succeedModule, queired => (m) => queired.call(Module_1.Module.__from_binding(m))),
614
614
  registerCompilationExecuteModuleTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationExecuteModule, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.executeModule, queried => ({ entry, id, codegenResults, runtimeModules }) => {
615
615
  const __webpack_require__ = (id) => {
616
616
  const cached = moduleCache[id];
package/dist/Module.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { JsCodegenerationResult, JsCodegenerationResults, JsCreateData, JsModule } from "@rspack/binding";
2
2
  import { Source } from "webpack-sources";
3
- import { Compilation } from "./Compilation";
4
3
  export type ResourceData = {
5
4
  resource: string;
6
5
  path: string;
@@ -33,26 +32,12 @@ export type ContextModuleFactoryAfterResolveResult = false | {
33
32
  export declare class Module {
34
33
  #private;
35
34
  _originalSource?: Source;
36
- context?: string;
37
- resource?: string;
38
- request?: string;
39
- userRequest?: string;
40
35
  rawRequest?: string;
41
- /**
42
- * Records the dynamically added fields for Module on the JavaScript side.
43
- * These fields are generally used within a plugin, so they do not need to be passed back to the Rust side.
44
- * @see {@link Compilation#customModules}
45
- */
46
- buildInfo: Record<string, any>;
47
- /**
48
- * Records the dynamically added fields for Module on the JavaScript side.
49
- * These fields are generally used within a plugin, so they do not need to be passed back to the Rust side.
50
- * @see {@link Compilation#customModules}
51
- */
52
- buildMeta: Record<string, any>;
53
- static __from_binding(module: JsModule, compilation?: Compilation): Module;
54
- constructor(module: JsModule, compilation?: Compilation);
55
- originalSource(): Source | null;
36
+ static __from_binding(module: JsModule): Module;
37
+ constructor(module: JsModule);
38
+ get context(): string | undefined;
39
+ get resource(): string | undefined;
40
+ get originalSource(): Source | null;
56
41
  identifier(): string;
57
42
  nameForCondition(): string | null;
58
43
  }
package/dist/Module.js CHANGED
@@ -15,22 +15,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.CodeGenerationResults = exports.CodeGenerationResult = exports.Module = void 0;
16
16
  const source_1 = require("./util/source");
17
17
  class Module {
18
- static __from_binding(module, compilation) {
19
- return new Module(module, compilation);
18
+ static __from_binding(module) {
19
+ return new Module(module);
20
20
  }
21
- constructor(module, compilation) {
21
+ constructor(module) {
22
22
  _Module_inner.set(this, void 0);
23
23
  __classPrivateFieldSet(this, _Module_inner, module, "f");
24
- this.context = module.context;
25
- this.resource = module.resource;
26
- this.request = module.request;
27
- this.userRequest = module.userRequest;
28
24
  this.rawRequest = module.rawRequest;
29
- const customModule = compilation?.__internal__getCustomModule(module.moduleIdentifier);
30
- this.buildInfo = customModule?.buildInfo || {};
31
- this.buildMeta = customModule?.buildMeta || {};
32
25
  }
33
- originalSource() {
26
+ get context() {
27
+ return __classPrivateFieldGet(this, _Module_inner, "f").context;
28
+ }
29
+ get resource() {
30
+ return __classPrivateFieldGet(this, _Module_inner, "f").resource;
31
+ }
32
+ get originalSource() {
34
33
  if (this._originalSource)
35
34
  return this._originalSource;
36
35
  if (__classPrivateFieldGet(this, _Module_inner, "f").originalSource) {
@@ -34,7 +34,7 @@ function toRawSplitChunksOptions(sc, compiler) {
34
34
  return name(undefined);
35
35
  }
36
36
  else {
37
- return name(Module_1.Module.__from_binding(ctx.module, compiler._lastCompilation));
37
+ return name(Module_1.Module.__from_binding(ctx.module));
38
38
  }
39
39
  };
40
40
  }
@@ -49,7 +49,7 @@ function toRawSplitChunksOptions(sc, compiler) {
49
49
  return test(undefined);
50
50
  }
51
51
  else {
52
- return test(Module_1.Module.__from_binding(ctx.module, compiler._lastCompilation));
52
+ return test(Module_1.Module.__from_binding(ctx.module));
53
53
  }
54
54
  };
55
55
  }
@@ -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);
@@ -603,12 +603,11 @@ function getRawSnapshotOptions(_snapshot) {
603
603
  return {};
604
604
  }
605
605
  function getRawExperiments(experiments) {
606
- const { topLevelAwait, rspackFuture, rsc = false } = experiments;
606
+ const { topLevelAwait, rspackFuture } = 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),
611
- rsc
610
+ rspackFuture: getRawRspackFutureOptions(rspackFuture)
612
611
  };
613
612
  }
614
613
  function getRawRspackFutureOptions(_future) {
@@ -5,7 +5,6 @@ import { Compiler } from "../Compiler";
5
5
  import { Logger } from "../logging/Logger";
6
6
  import Hash = require("../util/hash");
7
7
  import { Compilation } from "../Compilation";
8
- import { Module } from "../Module";
9
8
  import { Mode, Resolve, RuleSetUseItem, Target } from "./zod";
10
9
  export interface ComposeJsUseOptions {
11
10
  devtool: RawOptions["devtool"];
@@ -112,7 +111,6 @@ export interface LoaderContext<OptionsType = {}> {
112
111
  data: unknown;
113
112
  _compiler: Compiler;
114
113
  _compilation: Compilation;
115
- _module: Module;
116
114
  /**
117
115
  * Internal field for interoperability.
118
116
  * Do not use this in anywhere else.
@@ -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 | {
@@ -4905,7 +4905,6 @@ declare const experiments: z.ZodObject<{
4905
4905
  force?: boolean | "version"[] | undefined;
4906
4906
  } | undefined;
4907
4907
  }>>;
4908
- rsc: z.ZodOptional<z.ZodBoolean>;
4909
4908
  }, "strict", z.ZodTypeAny, {
4910
4909
  lazyCompilation?: boolean | {
4911
4910
  imports?: boolean | undefined;
@@ -4923,7 +4922,6 @@ declare const experiments: z.ZodObject<{
4923
4922
  force?: boolean | "version"[] | undefined;
4924
4923
  } | undefined;
4925
4924
  } | undefined;
4926
- rsc?: boolean | undefined;
4927
4925
  }, {
4928
4926
  lazyCompilation?: boolean | {
4929
4927
  imports?: boolean | undefined;
@@ -4941,7 +4939,6 @@ declare const experiments: z.ZodObject<{
4941
4939
  force?: boolean | "version"[] | undefined;
4942
4940
  } | undefined;
4943
4941
  } | undefined;
4944
- rsc?: boolean | undefined;
4945
4942
  }>;
4946
4943
  export type Experiments = z.infer<typeof experiments>;
4947
4944
  declare const watch: z.ZodBoolean;
@@ -5679,7 +5676,6 @@ export declare const rspackOptions: z.ZodObject<{
5679
5676
  force?: boolean | "version"[] | undefined;
5680
5677
  } | undefined;
5681
5678
  }>>;
5682
- rsc: z.ZodOptional<z.ZodBoolean>;
5683
5679
  }, "strict", z.ZodTypeAny, {
5684
5680
  lazyCompilation?: boolean | {
5685
5681
  imports?: boolean | undefined;
@@ -5697,7 +5693,6 @@ export declare const rspackOptions: z.ZodObject<{
5697
5693
  force?: boolean | "version"[] | undefined;
5698
5694
  } | undefined;
5699
5695
  } | undefined;
5700
- rsc?: boolean | undefined;
5701
5696
  }, {
5702
5697
  lazyCompilation?: boolean | {
5703
5698
  imports?: boolean | undefined;
@@ -5715,7 +5710,6 @@ export declare const rspackOptions: z.ZodObject<{
5715
5710
  force?: boolean | "version"[] | undefined;
5716
5711
  } | undefined;
5717
5712
  } | undefined;
5718
- rsc?: boolean | undefined;
5719
5713
  }>>;
5720
5714
  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<{
5721
5715
  context: z.ZodOptional<z.ZodString>;
@@ -7233,7 +7227,6 @@ export declare const rspackOptions: z.ZodObject<{
7233
7227
  force?: boolean | "version"[] | undefined;
7234
7228
  } | undefined;
7235
7229
  } | undefined;
7236
- rsc?: boolean | undefined;
7237
7230
  } | undefined;
7238
7231
  externals?: string | RegExp | Record<string, string | boolean | string[] | Record<string, string | string[]>> | ((args_0: {
7239
7232
  context?: string | undefined;
@@ -7683,7 +7676,6 @@ export declare const rspackOptions: z.ZodObject<{
7683
7676
  force?: boolean | "version"[] | undefined;
7684
7677
  } | undefined;
7685
7678
  } | undefined;
7686
- rsc?: boolean | undefined;
7687
7679
  } | undefined;
7688
7680
  externals?: string | RegExp | Record<string, string | boolean | string[] | Record<string, string | string[]>> | ((args_0: {
7689
7681
  context?: string | undefined;
@@ -778,8 +778,7 @@ 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(),
782
- rsc: zod_1.z.boolean().optional()
781
+ rspackFuture: rspackFutureOptions.optional()
783
782
  });
784
783
  //#endregion
785
784
  //#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; } });
@@ -18,7 +18,6 @@ const createHash_1 = require("../util/createHash");
18
18
  const identifier_1 = require("../util/identifier");
19
19
  const memoize_1 = require("../util/memoize");
20
20
  const loadLoader = require("./loadLoader");
21
- const Module_1 = require("../Module");
22
21
  const querystring = require("node:querystring");
23
22
  const PATH_QUERY_FRAGMENT_REGEXP = /^((?:\u200b.|[^?#\u200b])*)(\?(?:\u200b.|[^#\u200b])*)?(#.*)?$/;
24
23
  function parsePathQueryFragment(str) {
@@ -203,7 +202,7 @@ async function runLoaders(compiler, rawContext) {
203
202
  return new Promise((resolve, reject) => {
204
203
  compiler
205
204
  ._lastCompilation.__internal_getInner()
206
- .importModule(request, options.publicPath, options.baseUri, rawContext._module.moduleIdentifier, loaderContext.context, (err, res) => {
205
+ .importModule(request, options.publicPath, options.baseUri, rawContext._moduleIdentifier, loaderContext.context, (err, res) => {
207
206
  if (err)
208
207
  reject(err);
209
208
  else {
@@ -227,7 +226,7 @@ async function runLoaders(compiler, rawContext) {
227
226
  }
228
227
  return compiler
229
228
  ._lastCompilation.__internal_getInner()
230
- .importModule(request, options.publicPath, options.baseUri, rawContext._module.moduleIdentifier, loaderContext.context, (err, res) => {
229
+ .importModule(request, options.publicPath, options.baseUri, rawContext._moduleIdentifier, loaderContext.context, (err, res) => {
231
230
  if (err) {
232
231
  callback(err, undefined);
233
232
  }
@@ -480,7 +479,6 @@ async function runLoaders(compiler, rawContext) {
480
479
  };
481
480
  loaderContext._compiler = compiler;
482
481
  loaderContext._compilation = compiler._lastCompilation;
483
- loaderContext._module = Module_1.Module.__from_binding(rawContext._module, compiler._lastCompilation);
484
482
  loaderContext.getOptions = function () {
485
483
  const loader = getCurrentLoader(loaderContext);
486
484
  let options = loader?.options;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "0.7.1-canary-6e44e4b-20240605080608",
3
+ "version": "0.7.1-canary-a7d673e-20240606094751",
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/plugin-minify": "^0.7.1-canary-6e44e4b-20240605080608",
76
- "@rspack/core": "0.7.1-canary-6e44e4b-20240605080608"
75
+ "@rspack/plugin-minify": "^0.7.1-canary-a7d673e-20240606094751",
76
+ "@rspack/core": "0.7.1-canary-a7d673e-20240606094751"
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-6e44e4b-20240605080608"
83
+ "@rspack/binding": "0.7.1-canary-a7d673e-20240606094751"
84
84
  },
85
85
  "peerDependencies": {
86
86
  "@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: "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
- };
@@ -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 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;
@@ -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;