@rspack/core 0.7.0-beta.1-canary-c7db90a-20240521105933 → 0.7.0-beta.2

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/Compiler.js CHANGED
@@ -391,9 +391,7 @@ class Compiler {
391
391
  output: {
392
392
  ...this.options.output,
393
393
  ...outputOptions
394
- },
395
- // TODO: check why we need to have builtins otherwise this.#instance will fail to initialize Rspack
396
- builtins: this.options.builtins
394
+ }
397
395
  };
398
396
  (0, defaults_1.applyRspackOptionsDefaults)(options);
399
397
  const childCompiler = new Compiler(this.context, options);
@@ -565,8 +563,6 @@ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler
565
563
  return callback(null, __classPrivateFieldGet(this, _Compiler_instance, "f"));
566
564
  }
567
565
  const options = this.options;
568
- // TODO: remove this when drop support for builtins options
569
- options.builtins = (0, builtin_plugin_1.deprecated_resolveBuiltins)(options.builtins, options);
570
566
  const rawOptions = (0, config_1.getRawOptions)(options, this);
571
567
  const instanceBinding = require("@rspack/binding");
572
568
  __classPrivateFieldSet(this, _Compiler_registers, {
@@ -699,12 +695,11 @@ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler
699
695
  return queried.promise(bindingData);
700
696
  }),
701
697
  registerContextModuleFactoryAfterResolveTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.ContextModuleFactoryAfterResolve, () => __classPrivateFieldGet(this, _Compiler_compilationParams, "f").contextModuleFactory.hooks.afterResolve, queried => async (bindingData) => {
702
- var _a;
703
698
  const data = bindingData
704
699
  ? ({
705
700
  resource: bindingData.resource,
706
701
  regExp: bindingData.regExp
707
- ? new RegExp(bindingData.regExp)
702
+ ? new RegExp(bindingData.regExp.source, bindingData.regExp.flags)
708
703
  : undefined,
709
704
  request: bindingData.request,
710
705
  context: bindingData.context,
@@ -718,7 +713,12 @@ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler
718
713
  resource: ret.resource,
719
714
  context: ret.context,
720
715
  request: ret.request,
721
- regExp: (_a = ret.regExp) === null || _a === void 0 ? void 0 : _a.toString()
716
+ regExp: ret.regExp
717
+ ? {
718
+ source: ret.regExp.source,
719
+ flags: ret.regExp.flags
720
+ }
721
+ : undefined
722
722
  })
723
723
  : false;
724
724
  return result;
@@ -48,14 +48,6 @@ const pitch = function (request, _, data) {
48
48
  this.emitWarning(e);
49
49
  return;
50
50
  }
51
- if (this._compiler &&
52
- this._compiler.options &&
53
- this._compiler.options.experiments &&
54
- this._compiler.options.experiments.rspackFuture &&
55
- this._compiler.options.experiments.rspackFuture.newTreeshaking === false) {
56
- this.emitError(new Error("Cannot use CssExtractRspackPlugin without newTreeshaking"));
57
- return;
58
- }
59
51
  const options = this.getOptions(loader_options_json_1.default);
60
52
  const emit = typeof options.emit !== "undefined" ? options.emit : true;
61
53
  const callback = this.async();
@@ -1,4 +1,4 @@
1
- import { BuiltinPluginName, JsModule, RawRegexMatcher } from "@rspack/binding";
1
+ import { BuiltinPluginName, JsModule, RawRegex } from "@rspack/binding";
2
2
  export declare const BuiltinLazyCompilationPlugin: {
3
3
  new (module: (args: {
4
4
  module: string;
@@ -7,7 +7,7 @@ export declare const BuiltinLazyCompilationPlugin: {
7
7
  active: boolean;
8
8
  data: string;
9
9
  client: string;
10
- }, cacheable: boolean, entries: boolean, imports: boolean, test?: RawRegexMatcher | ((m: JsModule) => boolean) | undefined): {
10
+ }, cacheable: boolean, entries: boolean, imports: boolean, test?: RawRegex | ((m: JsModule) => boolean) | undefined): {
11
11
  name: BuiltinPluginName;
12
12
  _options: {
13
13
  module: (args: {
@@ -21,7 +21,7 @@ export declare const BuiltinLazyCompilationPlugin: {
21
21
  cacheable: boolean;
22
22
  imports: boolean;
23
23
  entries: boolean;
24
- test: RawRegexMatcher | ((m: JsModule) => boolean) | undefined;
24
+ test: RawRegex | ((m: JsModule) => boolean) | undefined;
25
25
  };
26
26
  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;
27
27
  raw(): import("@rspack/binding").BuiltinPlugin;
@@ -1,13 +1,13 @@
1
- import { JsModule, RawRegexMatcher } from "@rspack/binding";
1
+ import { JsModule, RawRegex } from "@rspack/binding";
2
2
  import type { Compiler } from "../..";
3
3
  import { LazyCompilationDefaultBackendOptions } from "./backend";
4
4
  export default class LazyCompilationPlugin {
5
5
  cacheable: boolean;
6
6
  entries: boolean;
7
7
  imports: boolean;
8
- test?: RawRegexMatcher | ((m: JsModule) => boolean);
8
+ test?: RawRegex | ((m: JsModule) => boolean);
9
9
  backend?: LazyCompilationDefaultBackendOptions;
10
- constructor(cacheable: boolean, entries: boolean, imports: boolean, test?: RawRegexMatcher | ((m: JsModule) => boolean), backend?: LazyCompilationDefaultBackendOptions);
10
+ constructor(cacheable: boolean, entries: boolean, imports: boolean, test?: RawRegex | ((m: JsModule) => boolean), backend?: LazyCompilationDefaultBackendOptions);
11
11
  apply(compiler: Compiler): void;
12
12
  }
13
13
  export { LazyCompilationPlugin };
@@ -49,9 +49,7 @@ const getRawOptions = (options, compiler) => {
49
49
  // SAFETY: applied default value in `applyRspackOptionsDefaults`.
50
50
  profile: options.profile,
51
51
  // SAFETY: applied default value in `applyRspackOptionsDefaults`.
52
- bail: options.bail,
53
- // TODO: remove this
54
- builtins: options.builtins
52
+ bail: options.bail
55
53
  };
56
54
  };
57
55
  exports.getRawOptions = getRawOptions;
@@ -596,25 +594,8 @@ function getRawOptimization(optimization) {
596
594
  mangleExports: String(optimization.mangleExports)
597
595
  };
598
596
  }
599
- function getRawSnapshotOptions(snapshot) {
600
- const { resolve, module } = snapshot;
601
- (0, assert_1.default)(!(0, util_1.isNil)(resolve) && !(0, util_1.isNil)(module));
602
- const { timestamp: resolveTimestamp, hash: resolveHash } = resolve;
603
- const { timestamp: moduleTimestamp, hash: moduleHash } = module;
604
- (0, assert_1.default)(!(0, util_1.isNil)(resolveTimestamp) &&
605
- !(0, util_1.isNil)(resolveHash) &&
606
- !(0, util_1.isNil)(moduleTimestamp) &&
607
- !(0, util_1.isNil)(moduleHash));
608
- return {
609
- resolve: {
610
- timestamp: resolveTimestamp,
611
- hash: resolveHash
612
- },
613
- module: {
614
- timestamp: moduleTimestamp,
615
- hash: moduleHash
616
- }
617
- };
597
+ function getRawSnapshotOptions(_snapshot) {
598
+ return {};
618
599
  }
619
600
  function getRawExperiments(experiments) {
620
601
  const { topLevelAwait, rspackFuture } = experiments;
@@ -624,11 +605,8 @@ function getRawExperiments(experiments) {
624
605
  rspackFuture: getRawRspackFutureOptions(rspackFuture)
625
606
  };
626
607
  }
627
- function getRawRspackFutureOptions(future) {
628
- (0, assert_1.default)(!(0, util_1.isNil)(future.newTreeshaking));
629
- return {
630
- newTreeshaking: future.newTreeshaking
631
- };
608
+ function getRawRspackFutureOptions(_future) {
609
+ return {};
632
610
  }
633
611
  function getRawNode(node) {
634
612
  if (node === false) {
@@ -125,7 +125,6 @@ const applyExperimentsDefaults = (experiments, { cache }) => {
125
125
  D(experiments, "topLevelAwait", true);
126
126
  D(experiments, "rspackFuture", {});
127
127
  if (typeof experiments.rspackFuture === "object") {
128
- D(experiments.rspackFuture, "newTreeshaking", true);
129
128
  D(experiments.rspackFuture, "bundlerInfo", {});
130
129
  if (typeof experiments.rspackFuture.bundlerInfo === "object") {
131
130
  D(experiments.rspackFuture.bundlerInfo, "version", require("../../package.json").version);
@@ -133,26 +132,7 @@ const applyExperimentsDefaults = (experiments, { cache }) => {
133
132
  }
134
133
  }
135
134
  };
136
- const applySnapshotDefaults = (snapshot, { production }) => {
137
- if (typeof snapshot.module === "object") {
138
- D(snapshot.module, "timestamp", false);
139
- D(snapshot.module, "hash", false);
140
- }
141
- else {
142
- F(snapshot, "module", () => production
143
- ? { timestamp: true, hash: true }
144
- : { timestamp: true, hash: false });
145
- }
146
- if (typeof snapshot.resolve === "object") {
147
- D(snapshot.resolve, "timestamp", false);
148
- D(snapshot.resolve, "hash", false);
149
- }
150
- else {
151
- F(snapshot, "resolve", () => production
152
- ? { timestamp: true, hash: true }
153
- : { timestamp: true, hash: false });
154
- }
155
- };
135
+ const applySnapshotDefaults = (_snapshot, _env) => { };
156
136
  const applyJavascriptParserOptionsDefaults = (parserOptions, fallback) => {
157
137
  var _a, _b, _c, _d, _e, _f;
158
138
  D(parserOptions, "dynamicImportMode", (_a = fallback === null || fallback === void 0 ? void 0 : fallback.dynamicImportMode) !== null && _a !== void 0 ? _a : "lazy");
@@ -8,7 +8,7 @@
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
10
  import type { Compilation } from "../Compilation";
11
- import type { AssetModuleFilename, Bail, Builtins, CacheOptions, ChunkFilename, ChunkLoading, ChunkLoadingGlobal, Clean, Context, CrossOriginLoading, CssChunkFilename, CssFilename, Dependencies, DevServer, DevTool, DevtoolFallbackModuleFilenameTemplate, DevtoolModuleFilenameTemplate, DevtoolNamespace, EnabledLibraryTypes, EnabledWasmLoadingTypes, EntryFilename, EntryRuntime, Environment, Externals, ExternalsPresets, ExternalsType, Filename, GeneratorOptionsByModuleType, GlobalObject, HashDigest, HashDigestLength, HashFunction, HashSalt, HotUpdateChunkFilename, HotUpdateGlobal, HotUpdateMainFilename, Iife, ImportFunctionName, InfrastructureLogging, LazyCompilationOptions, LibraryOptions, Mode, Name, Node, NoParseOption, Optimization, OutputModule, ParserOptionsByModuleType, Path, Performance, Plugins, Profile, PublicPath, Resolve, RspackFutureOptions, RspackOptions, RuleSetRules, ScriptType, SnapshotOptions, SourceMapFilename, StatsValue, StrictModuleErrorHandling, Target, TrustedTypes, UniqueName, WasmLoading, Watch, WatchOptions, WebassemblyModuleFilename, WorkerPublicPath } from "./zod";
11
+ import type { AssetModuleFilename, Bail, CacheOptions, ChunkFilename, ChunkLoading, ChunkLoadingGlobal, Clean, Context, CrossOriginLoading, CssChunkFilename, CssFilename, Dependencies, DevServer, DevTool, DevtoolFallbackModuleFilenameTemplate, DevtoolModuleFilenameTemplate, DevtoolNamespace, EnabledLibraryTypes, EnabledWasmLoadingTypes, EntryFilename, EntryRuntime, Environment, Externals, ExternalsPresets, ExternalsType, Filename, GeneratorOptionsByModuleType, GlobalObject, HashDigest, HashDigestLength, HashFunction, HashSalt, HotUpdateChunkFilename, HotUpdateGlobal, HotUpdateMainFilename, Iife, ImportFunctionName, InfrastructureLogging, LazyCompilationOptions, LibraryOptions, Mode, Name, Node, NoParseOption, Optimization, OutputModule, ParserOptionsByModuleType, Path, Performance, Plugins, Profile, PublicPath, Resolve, RspackFutureOptions, RspackOptions, RuleSetRules, ScriptType, SnapshotOptions, SourceMapFilename, StatsValue, StrictModuleErrorHandling, Target, TrustedTypes, UniqueName, WasmLoading, Watch, WatchOptions, WebassemblyModuleFilename, WorkerPublicPath } from "./zod";
12
12
  export declare const getNormalizedRspackOptions: (config: RspackOptions) => RspackOptionsNormalized;
13
13
  export type EntryDynamicNormalized = () => Promise<EntryStaticNormalized>;
14
14
  export type EntryNormalized = EntryDynamicNormalized | EntryStaticNormalized;
@@ -123,5 +123,4 @@ export interface RspackOptionsNormalized {
123
123
  performance?: Performance;
124
124
  profile?: Profile;
125
125
  bail?: Bail;
126
- builtins: Builtins;
127
126
  }
@@ -144,16 +144,7 @@ const getNormalizedRspackOptions = (config) => {
144
144
  node: nestedConfig(config.node, node => node && {
145
145
  ...node
146
146
  }),
147
- snapshot: nestedConfig(config.snapshot, snapshot => ({
148
- resolve: optionalNestedConfig(snapshot.resolve, resolve => ({
149
- timestamp: resolve.timestamp,
150
- hash: resolve.hash
151
- })),
152
- module: optionalNestedConfig(snapshot.module, module => ({
153
- timestamp: module.timestamp,
154
- hash: module.hash
155
- }))
156
- })),
147
+ snapshot: nestedConfig(config.snapshot, _snapshot => ({})),
157
148
  cache: optionalNestedConfig(config.cache, cache => cache),
158
149
  stats: nestedConfig(config.stats, stats => {
159
150
  if (stats === false) {
@@ -198,10 +189,7 @@ const getNormalizedRspackOptions = (config) => {
198
189
  watchOptions: cloneObject(config.watchOptions),
199
190
  devServer: config.devServer,
200
191
  profile: config.profile,
201
- bail: config.bail,
202
- builtins: nestedConfig(config.builtins, builtins => ({
203
- ...builtins
204
- }))
192
+ bail: config.bail
205
193
  };
206
194
  };
207
195
  exports.getNormalizedRspackOptions = getNormalizedRspackOptions;
@@ -3,7 +3,6 @@ import { JsAssetInfo, RawFuncUseCtx } from "@rspack/binding";
3
3
  import type * as webpackDevServer from "webpack-dev-server";
4
4
  import { z } from "../../compiled/zod";
5
5
  import { Compilation, Compiler } from "..";
6
- import type { Builtins as BuiltinsType } from "../builtin-plugin";
7
6
  import { Chunk } from "../Chunk";
8
7
  import { Module } from "../Module";
9
8
  declare const name: z.ZodString;
@@ -3748,46 +3747,7 @@ declare const node: z.ZodUnion<[z.ZodLiteral<false>, z.ZodObject<{
3748
3747
  global?: boolean | "warn" | undefined;
3749
3748
  }>]>;
3750
3749
  export type Node = z.infer<typeof node>;
3751
- declare const snapshotOptions: z.ZodObject<{
3752
- module: z.ZodOptional<z.ZodObject<{
3753
- hash: z.ZodOptional<z.ZodBoolean>;
3754
- timestamp: z.ZodOptional<z.ZodBoolean>;
3755
- }, "strict", z.ZodTypeAny, {
3756
- hash?: boolean | undefined;
3757
- timestamp?: boolean | undefined;
3758
- }, {
3759
- hash?: boolean | undefined;
3760
- timestamp?: boolean | undefined;
3761
- }>>;
3762
- resolve: z.ZodOptional<z.ZodObject<{
3763
- hash: z.ZodOptional<z.ZodBoolean>;
3764
- timestamp: z.ZodOptional<z.ZodBoolean>;
3765
- }, "strict", z.ZodTypeAny, {
3766
- hash?: boolean | undefined;
3767
- timestamp?: boolean | undefined;
3768
- }, {
3769
- hash?: boolean | undefined;
3770
- timestamp?: boolean | undefined;
3771
- }>>;
3772
- }, "strict", z.ZodTypeAny, {
3773
- module?: {
3774
- hash?: boolean | undefined;
3775
- timestamp?: boolean | undefined;
3776
- } | undefined;
3777
- resolve?: {
3778
- hash?: boolean | undefined;
3779
- timestamp?: boolean | undefined;
3780
- } | undefined;
3781
- }, {
3782
- module?: {
3783
- hash?: boolean | undefined;
3784
- timestamp?: boolean | undefined;
3785
- } | undefined;
3786
- resolve?: {
3787
- hash?: boolean | undefined;
3788
- timestamp?: boolean | undefined;
3789
- } | undefined;
3790
- }>;
3750
+ declare const snapshotOptions: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
3791
3751
  export type SnapshotOptions = z.infer<typeof snapshotOptions>;
3792
3752
  declare const cacheOptions: z.ZodBoolean;
3793
3753
  export type CacheOptions = z.infer<typeof cacheOptions>;
@@ -4582,7 +4542,6 @@ declare const optimization: z.ZodObject<{
4582
4542
  }>;
4583
4543
  export type Optimization = z.infer<typeof optimization>;
4584
4544
  declare const rspackFutureOptions: z.ZodObject<{
4585
- newTreeshaking: z.ZodOptional<z.ZodBoolean>;
4586
4545
  bundlerInfo: z.ZodOptional<z.ZodObject<{
4587
4546
  version: z.ZodOptional<z.ZodString>;
4588
4547
  force: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodArray<z.ZodEnum<["version"]>, "many">]>>;
@@ -4594,13 +4553,11 @@ declare const rspackFutureOptions: z.ZodObject<{
4594
4553
  force?: boolean | "version"[] | undefined;
4595
4554
  }>>;
4596
4555
  }, "strict", z.ZodTypeAny, {
4597
- newTreeshaking?: boolean | undefined;
4598
4556
  bundlerInfo?: {
4599
4557
  version?: string | undefined;
4600
4558
  force?: boolean | "version"[] | undefined;
4601
4559
  } | undefined;
4602
4560
  }, {
4603
- newTreeshaking?: boolean | undefined;
4604
4561
  bundlerInfo?: {
4605
4562
  version?: string | undefined;
4606
4563
  force?: boolean | "version"[] | undefined;
@@ -4641,7 +4598,6 @@ declare const experiments: z.ZodObject<{
4641
4598
  css: z.ZodOptional<z.ZodBoolean>;
4642
4599
  futureDefaults: z.ZodOptional<z.ZodBoolean>;
4643
4600
  rspackFuture: z.ZodOptional<z.ZodObject<{
4644
- newTreeshaking: z.ZodOptional<z.ZodBoolean>;
4645
4601
  bundlerInfo: z.ZodOptional<z.ZodObject<{
4646
4602
  version: z.ZodOptional<z.ZodString>;
4647
4603
  force: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodArray<z.ZodEnum<["version"]>, "many">]>>;
@@ -4653,13 +4609,11 @@ declare const experiments: z.ZodObject<{
4653
4609
  force?: boolean | "version"[] | undefined;
4654
4610
  }>>;
4655
4611
  }, "strict", z.ZodTypeAny, {
4656
- newTreeshaking?: boolean | undefined;
4657
4612
  bundlerInfo?: {
4658
4613
  version?: string | undefined;
4659
4614
  force?: boolean | "version"[] | undefined;
4660
4615
  } | undefined;
4661
4616
  }, {
4662
- newTreeshaking?: boolean | undefined;
4663
4617
  bundlerInfo?: {
4664
4618
  version?: string | undefined;
4665
4619
  force?: boolean | "version"[] | undefined;
@@ -4677,7 +4631,6 @@ declare const experiments: z.ZodObject<{
4677
4631
  css?: boolean | undefined;
4678
4632
  futureDefaults?: boolean | undefined;
4679
4633
  rspackFuture?: {
4680
- newTreeshaking?: boolean | undefined;
4681
4634
  bundlerInfo?: {
4682
4635
  version?: string | undefined;
4683
4636
  force?: boolean | "version"[] | undefined;
@@ -4695,7 +4648,6 @@ declare const experiments: z.ZodObject<{
4695
4648
  css?: boolean | undefined;
4696
4649
  futureDefaults?: boolean | undefined;
4697
4650
  rspackFuture?: {
4698
- newTreeshaking?: boolean | undefined;
4699
4651
  bundlerInfo?: {
4700
4652
  version?: string | undefined;
4701
4653
  force?: boolean | "version"[] | undefined;
@@ -4750,8 +4702,6 @@ declare const performance: z.ZodUnion<[z.ZodObject<{
4750
4702
  maxEntrypointSize?: number | undefined;
4751
4703
  }>, z.ZodLiteral<false>]>;
4752
4704
  export type Performance = z.infer<typeof performance>;
4753
- declare const builtins: z.ZodType<BuiltinsType, z.ZodTypeDef, BuiltinsType>;
4754
- export type Builtins = z.infer<typeof builtins>;
4755
4705
  export declare const rspackOptions: z.ZodObject<{
4756
4706
  name: z.ZodOptional<z.ZodString>;
4757
4707
  dependencies: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -5419,7 +5369,6 @@ export declare const rspackOptions: z.ZodObject<{
5419
5369
  css: z.ZodOptional<z.ZodBoolean>;
5420
5370
  futureDefaults: z.ZodOptional<z.ZodBoolean>;
5421
5371
  rspackFuture: z.ZodOptional<z.ZodObject<{
5422
- newTreeshaking: z.ZodOptional<z.ZodBoolean>;
5423
5372
  bundlerInfo: z.ZodOptional<z.ZodObject<{
5424
5373
  version: z.ZodOptional<z.ZodString>;
5425
5374
  force: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodArray<z.ZodEnum<["version"]>, "many">]>>;
@@ -5431,13 +5380,11 @@ export declare const rspackOptions: z.ZodObject<{
5431
5380
  force?: boolean | "version"[] | undefined;
5432
5381
  }>>;
5433
5382
  }, "strict", z.ZodTypeAny, {
5434
- newTreeshaking?: boolean | undefined;
5435
5383
  bundlerInfo?: {
5436
5384
  version?: string | undefined;
5437
5385
  force?: boolean | "version"[] | undefined;
5438
5386
  } | undefined;
5439
5387
  }, {
5440
- newTreeshaking?: boolean | undefined;
5441
5388
  bundlerInfo?: {
5442
5389
  version?: string | undefined;
5443
5390
  force?: boolean | "version"[] | undefined;
@@ -5455,7 +5402,6 @@ export declare const rspackOptions: z.ZodObject<{
5455
5402
  css?: boolean | undefined;
5456
5403
  futureDefaults?: boolean | undefined;
5457
5404
  rspackFuture?: {
5458
- newTreeshaking?: boolean | undefined;
5459
5405
  bundlerInfo?: {
5460
5406
  version?: string | undefined;
5461
5407
  force?: boolean | "version"[] | undefined;
@@ -5473,7 +5419,6 @@ export declare const rspackOptions: z.ZodObject<{
5473
5419
  css?: boolean | undefined;
5474
5420
  futureDefaults?: boolean | undefined;
5475
5421
  rspackFuture?: {
5476
- newTreeshaking?: boolean | undefined;
5477
5422
  bundlerInfo?: {
5478
5423
  version?: string | undefined;
5479
5424
  force?: boolean | "version"[] | undefined;
@@ -5723,46 +5668,7 @@ export declare const rspackOptions: z.ZodObject<{
5723
5668
  optimizationBailout?: boolean | undefined;
5724
5669
  orphanModules?: boolean | undefined;
5725
5670
  }>]>>;
5726
- snapshot: z.ZodOptional<z.ZodObject<{
5727
- module: z.ZodOptional<z.ZodObject<{
5728
- hash: z.ZodOptional<z.ZodBoolean>;
5729
- timestamp: z.ZodOptional<z.ZodBoolean>;
5730
- }, "strict", z.ZodTypeAny, {
5731
- hash?: boolean | undefined;
5732
- timestamp?: boolean | undefined;
5733
- }, {
5734
- hash?: boolean | undefined;
5735
- timestamp?: boolean | undefined;
5736
- }>>;
5737
- resolve: z.ZodOptional<z.ZodObject<{
5738
- hash: z.ZodOptional<z.ZodBoolean>;
5739
- timestamp: z.ZodOptional<z.ZodBoolean>;
5740
- }, "strict", z.ZodTypeAny, {
5741
- hash?: boolean | undefined;
5742
- timestamp?: boolean | undefined;
5743
- }, {
5744
- hash?: boolean | undefined;
5745
- timestamp?: boolean | undefined;
5746
- }>>;
5747
- }, "strict", z.ZodTypeAny, {
5748
- module?: {
5749
- hash?: boolean | undefined;
5750
- timestamp?: boolean | undefined;
5751
- } | undefined;
5752
- resolve?: {
5753
- hash?: boolean | undefined;
5754
- timestamp?: boolean | undefined;
5755
- } | undefined;
5756
- }, {
5757
- module?: {
5758
- hash?: boolean | undefined;
5759
- timestamp?: boolean | undefined;
5760
- } | undefined;
5761
- resolve?: {
5762
- hash?: boolean | undefined;
5763
- timestamp?: boolean | undefined;
5764
- } | undefined;
5765
- }>>;
5671
+ snapshot: z.ZodOptional<z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>>;
5766
5672
  optimization: z.ZodOptional<z.ZodObject<{
5767
5673
  moduleIds: z.ZodOptional<z.ZodEnum<["named", "deterministic"]>>;
5768
5674
  chunkIds: z.ZodOptional<z.ZodEnum<["named", "deterministic"]>>;
@@ -6089,7 +5995,6 @@ export declare const rspackOptions: z.ZodObject<{
6089
5995
  resolveLoader: z.ZodOptional<z.ZodType<ResolveOptions, z.ZodTypeDef, ResolveOptions>>;
6090
5996
  plugins: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodType<RspackPluginInstance, z.ZodTypeDef, RspackPluginInstance>, z.ZodType<RspackPluginFunction, z.ZodTypeDef, RspackPluginFunction>, z.ZodUnion<[z.ZodLiteral<false>, z.ZodLiteral<0>, z.ZodLiteral<"">, z.ZodNull, z.ZodUndefined]>]>, "many">>;
6091
5997
  devServer: z.ZodOptional<z.ZodType<DevServer, z.ZodTypeDef, DevServer>>;
6092
- builtins: z.ZodOptional<z.ZodType<BuiltinsType, z.ZodTypeDef, BuiltinsType>>;
6093
5998
  module: z.ZodOptional<z.ZodObject<{
6094
5999
  defaultRules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"...">, z.ZodType<RuleSetRule, z.ZodTypeDef, RuleSetRule>]>, z.ZodUnion<[z.ZodLiteral<false>, z.ZodLiteral<0>, z.ZodLiteral<"">, z.ZodNull, z.ZodUndefined]>]>, "many">>;
6095
6000
  rules: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"...">, z.ZodType<RuleSetRule, z.ZodTypeDef, RuleSetRule>]>, z.ZodUnion<[z.ZodLiteral<false>, z.ZodLiteral<0>, z.ZodLiteral<"">, z.ZodNull, z.ZodUndefined]>]>, "many">>;
@@ -6918,7 +6823,6 @@ export declare const rspackOptions: z.ZodObject<{
6918
6823
  css?: boolean | undefined;
6919
6824
  futureDefaults?: boolean | undefined;
6920
6825
  rspackFuture?: {
6921
- newTreeshaking?: boolean | undefined;
6922
6826
  bundlerInfo?: {
6923
6827
  version?: string | undefined;
6924
6828
  force?: boolean | "version"[] | undefined;
@@ -7014,16 +6918,7 @@ export declare const rspackOptions: z.ZodObject<{
7014
6918
  optimizationBailout?: boolean | undefined;
7015
6919
  orphanModules?: boolean | undefined;
7016
6920
  } | undefined;
7017
- snapshot?: {
7018
- module?: {
7019
- hash?: boolean | undefined;
7020
- timestamp?: boolean | undefined;
7021
- } | undefined;
7022
- resolve?: {
7023
- hash?: boolean | undefined;
7024
- timestamp?: boolean | undefined;
7025
- } | undefined;
7026
- } | undefined;
6921
+ snapshot?: {} | undefined;
7027
6922
  optimization?: {
7028
6923
  moduleIds?: "named" | "deterministic" | undefined;
7029
6924
  chunkIds?: "named" | "deterministic" | undefined;
@@ -7090,7 +6985,6 @@ export declare const rspackOptions: z.ZodObject<{
7090
6985
  resolveLoader?: ResolveOptions | undefined;
7091
6986
  plugins?: (false | "" | 0 | RspackPluginInstance | RspackPluginFunction | null | undefined)[] | undefined;
7092
6987
  devServer?: DevServer | undefined;
7093
- builtins?: BuiltinsType | undefined;
7094
6988
  module?: {
7095
6989
  defaultRules?: (false | "" | 0 | "..." | RuleSetRule | null | undefined)[] | undefined;
7096
6990
  rules?: (false | "" | 0 | "..." | RuleSetRule | null | undefined)[] | undefined;
@@ -7361,7 +7255,6 @@ export declare const rspackOptions: z.ZodObject<{
7361
7255
  css?: boolean | undefined;
7362
7256
  futureDefaults?: boolean | undefined;
7363
7257
  rspackFuture?: {
7364
- newTreeshaking?: boolean | undefined;
7365
7258
  bundlerInfo?: {
7366
7259
  version?: string | undefined;
7367
7260
  force?: boolean | "version"[] | undefined;
@@ -7457,16 +7350,7 @@ export declare const rspackOptions: z.ZodObject<{
7457
7350
  optimizationBailout?: boolean | undefined;
7458
7351
  orphanModules?: boolean | undefined;
7459
7352
  } | undefined;
7460
- snapshot?: {
7461
- module?: {
7462
- hash?: boolean | undefined;
7463
- timestamp?: boolean | undefined;
7464
- } | undefined;
7465
- resolve?: {
7466
- hash?: boolean | undefined;
7467
- timestamp?: boolean | undefined;
7468
- } | undefined;
7469
- } | undefined;
7353
+ snapshot?: {} | undefined;
7470
7354
  optimization?: {
7471
7355
  moduleIds?: "named" | "deterministic" | undefined;
7472
7356
  chunkIds?: "named" | "deterministic" | undefined;
@@ -7533,7 +7417,6 @@ export declare const rspackOptions: z.ZodObject<{
7533
7417
  resolveLoader?: ResolveOptions | undefined;
7534
7418
  plugins?: (false | "" | 0 | RspackPluginInstance | RspackPluginFunction | null | undefined)[] | undefined;
7535
7419
  devServer?: DevServer | undefined;
7536
- builtins?: BuiltinsType | undefined;
7537
7420
  module?: {
7538
7421
  defaultRules?: (false | "" | 0 | "..." | RuleSetRule | null | undefined)[] | undefined;
7539
7422
  rules?: (false | "" | 0 | "..." | RuleSetRule | null | undefined)[] | undefined;
@@ -587,20 +587,7 @@ const nodeOptions = zod_1.z.strictObject({
587
587
  const node = zod_1.z.literal(false).or(nodeOptions);
588
588
  //#endregion
589
589
  //#region Snapshot
590
- const snapshotOptions = zod_1.z.strictObject({
591
- module: zod_1.z
592
- .strictObject({
593
- hash: zod_1.z.boolean().optional(),
594
- timestamp: zod_1.z.boolean().optional()
595
- })
596
- .optional(),
597
- resolve: zod_1.z
598
- .strictObject({
599
- hash: zod_1.z.boolean().optional(),
600
- timestamp: zod_1.z.boolean().optional()
601
- })
602
- .optional()
603
- });
590
+ const snapshotOptions = zod_1.z.strictObject({});
604
591
  //#endregion
605
592
  //#region Cache
606
593
  const cacheOptions = zod_1.z.boolean();
@@ -754,7 +741,6 @@ const optimization = zod_1.z.strictObject({
754
741
  //#endregion
755
742
  //#region Experiments
756
743
  const rspackFutureOptions = zod_1.z.strictObject({
757
- newTreeshaking: zod_1.z.boolean().optional(),
758
744
  bundlerInfo: zod_1.z
759
745
  .strictObject({
760
746
  version: zod_1.z.string().optional(),
@@ -826,9 +812,6 @@ const performance = zod_1.z
826
812
  })
827
813
  .or(zod_1.z.literal(false));
828
814
  //#endregion
829
- //#region Builtins (deprecated)
830
- const builtins = zod_1.z.custom();
831
- //#endregion
832
815
  exports.rspackOptions = zod_1.z.strictObject({
833
816
  name: name.optional(),
834
817
  dependencies: dependencies.optional(),
@@ -855,7 +838,6 @@ exports.rspackOptions = zod_1.z.strictObject({
855
838
  resolveLoader: resolve.optional(),
856
839
  plugins: plugins.optional(),
857
840
  devServer: devServer.optional(),
858
- builtins: builtins.optional(),
859
841
  module: moduleOptions.optional(),
860
842
  profile: profile.optional(),
861
843
  bail: bail.optional(),
@@ -26,7 +26,7 @@ const cleverMerge_1 = require("./util/cleverMerge");
26
26
  class RspackOptionsApply {
27
27
  constructor() { }
28
28
  process(options, compiler) {
29
- var _a, _b, _c, _d;
29
+ var _a, _b, _c;
30
30
  (0, assert_1.default)(options.output.path, "options.output.path should have value after `applyRspackOptionsDefaults`");
31
31
  compiler.outputPath = options.output.path;
32
32
  compiler.name = options.name;
@@ -147,29 +147,27 @@ class RspackOptionsApply {
147
147
  if (options.optimization.mergeDuplicateChunks) {
148
148
  new builtin_plugin_1.MergeDuplicateChunksPlugin().apply(compiler);
149
149
  }
150
- if ((_a = options.experiments.rspackFuture) === null || _a === void 0 ? void 0 : _a.newTreeshaking) {
151
- if (options.optimization.sideEffects) {
152
- new builtin_plugin_1.SideEffectsFlagPlugin( /* options.optimization.sideEffects === true */).apply(compiler);
153
- }
154
- if (options.optimization.providedExports) {
155
- new builtin_plugin_1.FlagDependencyExportsPlugin().apply(compiler);
156
- }
157
- if (options.optimization.usedExports) {
158
- new builtin_plugin_1.FlagDependencyUsagePlugin(options.optimization.usedExports === "global").apply(compiler);
159
- }
160
- if (options.optimization.concatenateModules) {
161
- new builtin_plugin_1.ModuleConcatenationPlugin().apply(compiler);
162
- }
163
- if (options.optimization.mangleExports) {
164
- new builtin_plugin_1.MangleExportsPlugin(options.optimization.mangleExports !== "size").apply(compiler);
165
- }
150
+ if (options.optimization.sideEffects) {
151
+ new builtin_plugin_1.SideEffectsFlagPlugin( /* options.optimization.sideEffects === true */).apply(compiler);
152
+ }
153
+ if (options.optimization.providedExports) {
154
+ new builtin_plugin_1.FlagDependencyExportsPlugin().apply(compiler);
155
+ }
156
+ if (options.optimization.usedExports) {
157
+ new builtin_plugin_1.FlagDependencyUsagePlugin(options.optimization.usedExports === "global").apply(compiler);
158
+ }
159
+ if (options.optimization.concatenateModules) {
160
+ new builtin_plugin_1.ModuleConcatenationPlugin().apply(compiler);
161
+ }
162
+ if (options.optimization.mangleExports) {
163
+ new builtin_plugin_1.MangleExportsPlugin(options.optimization.mangleExports !== "size").apply(compiler);
166
164
  }
167
165
  if (options.experiments.lazyCompilation) {
168
166
  const lazyOptions = options.experiments.lazyCompilation;
169
167
  new builtin_plugin_1.LazyCompilationPlugin(
170
168
  // this is only for test
171
169
  // @ts-expect-error cacheable is hide
172
- (_b = lazyOptions.cacheable) !== null && _b !== void 0 ? _b : true, (_c = lazyOptions.entries) !== null && _c !== void 0 ? _c : true, (_d = lazyOptions.imports) !== null && _d !== void 0 ? _d : true, typeof lazyOptions.test === "function"
170
+ (_a = lazyOptions.cacheable) !== null && _a !== void 0 ? _a : true, (_b = lazyOptions.entries) !== null && _b !== void 0 ? _b : true, (_c = lazyOptions.imports) !== null && _c !== void 0 ? _c : true, typeof lazyOptions.test === "function"
173
171
  ? function (jsModule) {
174
172
  return lazyOptions.test.call(lazyOptions, new Module_1.Module(jsModule));
175
173
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "0.7.0-beta.1-canary-c7db90a-20240521105933",
3
+ "version": "0.7.0-beta.2",
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.0-beta.1-canary-c7db90a-20240521105933",
76
- "@rspack/plugin-minify": "^0.7.0-beta.1-canary-c7db90a-20240521105933"
75
+ "@rspack/plugin-minify": "^0.7.0-beta.2",
76
+ "@rspack/core": "0.7.0-beta.2"
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.0-beta.1-canary-c7db90a-20240521105933"
83
+ "@rspack/binding": "0.7.0-beta.2"
84
84
  },
85
85
  "peerDependencies": {
86
86
  "@swc/helpers": ">=0.5.1"