@rspack/core 2.0.0-beta.3 → 2.0.0-beta.5

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.
@@ -10,7 +10,7 @@
10
10
  import type { AssetInfo, ChunkGroup, Dependency, ExternalObject, JsCompilation } from '@rspack/binding';
11
11
  import binding from '@rspack/binding';
12
12
  export type { AssetInfo } from '@rspack/binding';
13
- import * as liteTapable from '../compiled/@rspack/lite-tapable/dist/index.d.ts';
13
+ import * as liteTapable from '../compiled/@rspack/lite-tapable/dist';
14
14
  import type { Source } from '../compiled/webpack-sources';
15
15
  import type { EntryOptions, EntryPlugin } from './builtin-plugin/index.js';
16
16
  import type { Chunk } from './Chunk.js';
@@ -8,7 +8,7 @@
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
10
  import type binding from '@rspack/binding';
11
- import * as liteTapable from '../compiled/@rspack/lite-tapable/dist/index.d.ts';
11
+ import * as liteTapable from '../compiled/@rspack/lite-tapable/dist';
12
12
  import type Watchpack from '../compiled/watchpack';
13
13
  import type { Source } from '../compiled/webpack-sources';
14
14
  import type { Chunk } from './Chunk.js';
@@ -1,4 +1,4 @@
1
- import * as liteTapable from '../compiled/@rspack/lite-tapable/dist/index.d.ts';
1
+ import * as liteTapable from '../compiled/@rspack/lite-tapable/dist';
2
2
  import type { ContextModuleFactoryAfterResolveResult, ContextModuleFactoryBeforeResolveResult } from './Module.js';
3
3
  export declare class ContextModuleFactory {
4
4
  hooks: {
@@ -7,7 +7,7 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- import * as liteTapable from '../compiled/@rspack/lite-tapable/dist/index.d.ts';
10
+ import * as liteTapable from '../compiled/@rspack/lite-tapable/dist';
11
11
  import type { CompilationParams, Compiler, CompilerHooks, RspackOptions } from './index.js';
12
12
  import type { WatchOptions } from './config/index.js';
13
13
  import MultiStats from './MultiStats.js';
@@ -7,7 +7,7 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- import type { Callback } from '../compiled/@rspack/lite-tapable/dist/index.d.ts';
10
+ import type { Callback } from '../compiled/@rspack/lite-tapable/dist';
11
11
  import type { MultiCompiler } from './MultiCompiler.js';
12
12
  import type { Watching } from './Watching.js';
13
13
  declare class MultiWatching {
@@ -1,4 +1,4 @@
1
- import * as liteTapable from '../compiled/@rspack/lite-tapable/dist/index.d.ts';
1
+ import * as liteTapable from '../compiled/@rspack/lite-tapable/dist';
2
2
  import type { Compilation } from './Compilation.js';
3
3
  import type { LoaderContext } from './config/index.js';
4
4
  import type { Module } from './Module.js';
@@ -1,5 +1,5 @@
1
1
  import type binding from '@rspack/binding';
2
- import * as liteTapable from '../compiled/@rspack/lite-tapable/dist/index.d.ts';
2
+ import * as liteTapable from '../compiled/@rspack/lite-tapable/dist';
3
3
  import type { ResolveData, ResourceDataWithData } from './Module.js';
4
4
  import type { ResolveOptionsWithDependencyType, ResolverFactory } from './ResolverFactory.js';
5
5
  export type NormalModuleCreateData = binding.JsNormalModuleFactoryCreateModuleArgs & {
@@ -7,7 +7,7 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- import type { Callback } from '../compiled/@rspack/lite-tapable/dist/index.d.ts';
10
+ import type { Callback } from '../compiled/@rspack/lite-tapable/dist';
11
11
  import type { Compiler } from './index.js';
12
12
  import { Stats } from './index.js';
13
13
  import type { WatchOptions } from './config/index.js';
@@ -1,13 +1,15 @@
1
1
  import type { Compiler } from '../Compiler.js';
2
- import type { RspackOptionsNormalized } from '../config/index.js';
2
+ import type { OptimizationSplitChunksOptions, RspackOptionsNormalized } from '../config/index.js';
3
3
  export declare function applyLimits(options: RspackOptionsNormalized): void;
4
4
  export declare class EsmLibraryPlugin {
5
5
  static PLUGIN_NAME: string;
6
- options?: {
6
+ options: {
7
7
  preserveModules?: string;
8
+ splitChunks?: OptimizationSplitChunksOptions | false;
8
9
  };
9
10
  constructor(options?: {
10
11
  preserveModules?: string;
12
+ splitChunks?: OptimizationSplitChunksOptions | false;
11
13
  });
12
14
  apply(compiler: Compiler): void;
13
15
  }
@@ -1,5 +1,5 @@
1
1
  import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
2
- import * as liteTapable from '../../compiled/@rspack/lite-tapable/dist/index.d.ts';
2
+ import * as liteTapable from '../../compiled/@rspack/lite-tapable/dist';
3
3
  import type { Chunk } from '../Chunk.js';
4
4
  import { type Compilation } from '../Compilation.js';
5
5
  import type Hash from '../util/hash/index.js';
@@ -1,5 +1,5 @@
1
1
  import { type JsRsdoctorAsset, type JsRsdoctorAssetPatch, type JsRsdoctorChunk, type JsRsdoctorChunkAssets, type JsRsdoctorChunkGraph, type JsRsdoctorChunkModules, type JsRsdoctorDependency, type JsRsdoctorEntrypoint, type JsRsdoctorEntrypointAssets, type JsRsdoctorExportInfo, type JsRsdoctorModule, type JsRsdoctorModuleGraph, type JsRsdoctorModuleGraphModule, type JsRsdoctorModuleIdsPatch, type JsRsdoctorModuleOriginalSource, type JsRsdoctorModuleSourcesPatch, type JsRsdoctorSideEffect, type JsRsdoctorSourcePosition, type JsRsdoctorSourceRange, type JsRsdoctorStatement, type JsRsdoctorVariable } from '@rspack/binding';
2
- import * as liteTapable from '../../compiled/@rspack/lite-tapable/dist/index.d.ts';
2
+ import * as liteTapable from '../../compiled/@rspack/lite-tapable/dist';
3
3
  import { type Compilation } from '../Compilation.js';
4
4
  import type { Compiler } from '../Compiler.js';
5
5
  import type { CreatePartialRegisters } from '../taps/types.js';
@@ -1,5 +1,5 @@
1
1
  import binding from '@rspack/binding';
2
- import * as liteTapable from '../../compiled/@rspack/lite-tapable/dist/index.d.ts';
2
+ import * as liteTapable from '../../compiled/@rspack/lite-tapable/dist';
3
3
  import type { Chunk } from '../Chunk.js';
4
4
  import { type Compilation } from '../Compilation.js';
5
5
  import type { CreatePartialRegisters } from '../taps/types.js';
@@ -1,4 +1,4 @@
1
- import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
1
+ import { type BuiltinPlugin, BuiltinPluginName, type RawSplitChunksOptions } from '@rspack/binding';
2
2
  import type { Compiler } from '../Compiler.js';
3
3
  import type { OptimizationSplitChunksOptions } from '../config/index.js';
4
4
  import { RspackBuiltinPlugin } from './base.js';
@@ -9,3 +9,4 @@ export declare class SplitChunksPlugin extends RspackBuiltinPlugin {
9
9
  constructor(options: OptimizationSplitChunksOptions);
10
10
  raw(compiler: Compiler): BuiltinPlugin;
11
11
  }
12
+ export declare function toRawSplitChunksOptions(sc: false | OptimizationSplitChunksOptions, compiler: Compiler): RawSplitChunksOptions | undefined;
@@ -1,5 +1,5 @@
1
1
  import type { JsAfterEmitData, JsAfterTemplateExecutionData, JsAlterAssetTagGroupsData, JsAlterAssetTagsData, JsBeforeAssetTagGenerationData, JsBeforeEmitData } from '@rspack/binding';
2
- import * as liteTapable from '../../../compiled/@rspack/lite-tapable/dist/index.d.ts';
2
+ import * as liteTapable from '../../../compiled/@rspack/lite-tapable/dist';
3
3
  import { type Compilation } from '../../Compilation.js';
4
4
  import type { HtmlRspackPluginOptions } from './options.js';
5
5
  type ExtraPluginHookData = {
@@ -809,10 +809,10 @@ export type JavascriptParserOptions = {
809
809
  */
810
810
  dynamicImportFetchPriority?: 'low' | 'high' | 'auto';
811
811
  /**
812
- * Enable or disable evaluating import.meta.
813
- * @default true
812
+ * Enable or disable evaluating import.meta. Set to 'preserve-unknown' to preserve unknown properties for runtime evaluation.
813
+ * @default 'preserve-unknown'
814
814
  */
815
- importMeta?: boolean;
815
+ importMeta?: boolean | 'preserve-unknown';
816
816
  /**
817
817
  * Enable parsing of new URL() syntax.
818
818
  * @default true
@@ -846,6 +846,8 @@ export type JavascriptParserOptions = {
846
846
  importExportsPresence?: ExportsPresence;
847
847
  /** Warn or error for conflicting re-exports */
848
848
  reexportExportsPresence?: ExportsPresence;
849
+ /** Handle the this context correctly according to the spec for namespace objects. */
850
+ strictThisContextOnImports?: boolean;
849
851
  /** Provide custom syntax for Worker parsing, commonly used to support Worklet */
850
852
  worker?: string[] | boolean;
851
853
  /** Override the module to strict or non-strict. */
@@ -1435,7 +1437,8 @@ export type StatsOptions = {
1435
1437
  errorsCount?: boolean;
1436
1438
  /**
1437
1439
  * Enables or disables the use of colors in the output.
1438
- * @default false
1440
+ * When undefined, defaults to true if the environment supports color (TTY, FORCE_COLOR, or NO_COLOR unset), otherwise false.
1441
+ * @default environment-dependent (see above)
1439
1442
  */
1440
1443
  colors?: boolean | StatsColorOptions;
1441
1444
  /**
package/dist/index.js CHANGED
@@ -2671,8 +2671,77 @@ class EnableLibraryPlugin extends RspackBuiltinPlugin {
2671
2671
  }
2672
2672
  }
2673
2673
  let EnableWasmLoadingPlugin = base_create(binding_namespaceObject.BuiltinPluginName.EnableWasmLoadingPlugin, (type)=>type), EnsureChunkConditionsPlugin = base_create(binding_namespaceObject.BuiltinPluginName.EnsureChunkConditionsPlugin, ()=>{}), RemoveDuplicateModulesPlugin = base_create(binding_namespaceObject.BuiltinPluginName.RemoveDuplicateModulesPlugin, ()=>({}));
2674
+ class JsSplitChunkSizes {
2675
+ static __to_binding(sizes) {
2676
+ return 'number' == typeof sizes ? sizes : sizes && 'object' == typeof sizes ? {
2677
+ sizes: sizes
2678
+ } : sizes;
2679
+ }
2680
+ }
2681
+ class SplitChunksPlugin extends RspackBuiltinPlugin {
2682
+ options;
2683
+ name = binding_namespaceObject.BuiltinPluginName.SplitChunksPlugin;
2684
+ affectedHooks = 'thisCompilation';
2685
+ constructor(options){
2686
+ super(), this.options = options;
2687
+ }
2688
+ raw(compiler) {
2689
+ let rawOptions = toRawSplitChunksOptions(this.options, compiler);
2690
+ if (void 0 === rawOptions) throw Error('rawOptions should not be undefined');
2691
+ return createBuiltinPlugin(this.name, rawOptions);
2692
+ }
2693
+ }
2694
+ function toRawSplitChunksOptions(sc, compiler) {
2695
+ if (!sc) return;
2696
+ function getName(name) {
2697
+ return 'function' == typeof name ? (ctx)=>void 0 === ctx.module ? name(void 0) : name(ctx.module, getChunks(ctx.chunks), ctx.cacheGroupKey) : name;
2698
+ }
2699
+ function getChunks(chunks) {
2700
+ return 'function' == typeof chunks ? (chunk)=>chunks(chunk) : chunks;
2701
+ }
2702
+ let { name, chunks, defaultSizeTypes, cacheGroups = {}, fallbackCacheGroup, minSize, minSizeReduction, maxSize, maxAsyncSize, maxInitialSize, ...passThrough } = sc;
2703
+ return {
2704
+ name: getName(name),
2705
+ chunks: getChunks(chunks),
2706
+ defaultSizeTypes: defaultSizeTypes || [
2707
+ "javascript",
2708
+ 'unknown'
2709
+ ],
2710
+ cacheGroups: Object.entries(cacheGroups).filter(([_key, group])=>!1 !== group).map(([key, group])=>{
2711
+ let { test, name, chunks, minSize, minSizeReduction, maxSize, maxAsyncSize, maxInitialSize, ...passThrough } = group;
2712
+ return {
2713
+ key,
2714
+ test: 'function' == typeof test ? (ctx)=>{
2715
+ let info = {
2716
+ moduleGraph: compiler._lastCompilation.moduleGraph,
2717
+ chunkGraph: compiler._lastCompilation.chunkGraph
2718
+ };
2719
+ return test(ctx.module, info);
2720
+ } : test,
2721
+ name: getName(name),
2722
+ chunks: getChunks(chunks),
2723
+ minSize: JsSplitChunkSizes.__to_binding(minSize),
2724
+ minSizeReduction: JsSplitChunkSizes.__to_binding(minSizeReduction),
2725
+ maxSize: JsSplitChunkSizes.__to_binding(maxSize),
2726
+ maxAsyncSize: JsSplitChunkSizes.__to_binding(maxAsyncSize),
2727
+ maxInitialSize: JsSplitChunkSizes.__to_binding(maxInitialSize),
2728
+ ...passThrough
2729
+ };
2730
+ }),
2731
+ fallbackCacheGroup: {
2732
+ chunks: getChunks(chunks),
2733
+ ...fallbackCacheGroup
2734
+ },
2735
+ minSize: JsSplitChunkSizes.__to_binding(minSize),
2736
+ minSizeReduction: JsSplitChunkSizes.__to_binding(minSizeReduction),
2737
+ maxSize: JsSplitChunkSizes.__to_binding(maxSize),
2738
+ maxAsyncSize: JsSplitChunkSizes.__to_binding(maxAsyncSize),
2739
+ maxInitialSize: JsSplitChunkSizes.__to_binding(maxInitialSize),
2740
+ ...passThrough
2741
+ };
2742
+ }
2674
2743
  function applyLimits(options) {
2675
- options.optimization.concatenateModules = !1, options.optimization.removeEmptyChunks = !1, options.output.chunkFormat = !1, options.output.chunkLoading && 'import' !== options.output.chunkLoading && (options.output.chunkLoading = 'import'), void 0 === options.output.chunkLoading && (options.output.chunkLoading = 'import');
2744
+ options.optimization.concatenateModules = !1, options.optimization.removeEmptyChunks = !1, options.output.chunkFormat = !1, options.output.module = !0, options.output.chunkLoading && 'import' !== options.output.chunkLoading && (options.output.chunkLoading = 'import'), void 0 === options.output.chunkLoading && (options.output.chunkLoading = 'import');
2676
2745
  let { splitChunks } = options.optimization;
2677
2746
  void 0 === splitChunks && (splitChunks = options.optimization.splitChunks = {}), !1 !== splitChunks && (splitChunks.chunks = 'all', splitChunks.minSize = 0, splitChunks.maxAsyncRequests = 1 / 0, splitChunks.maxInitialRequests = 1 / 0, splitChunks.cacheGroups ??= {}, splitChunks.cacheGroups.default = !1, splitChunks.cacheGroups.defaultVendors = !1);
2678
2747
  }
@@ -2680,7 +2749,7 @@ class EsmLibraryPlugin {
2680
2749
  static PLUGIN_NAME = 'EsmLibraryPlugin';
2681
2750
  options;
2682
2751
  constructor(options){
2683
- this.options = options;
2752
+ this.options = options ?? {};
2684
2753
  }
2685
2754
  apply(compiler) {
2686
2755
  var config;
@@ -2689,7 +2758,8 @@ class EsmLibraryPlugin {
2689
2758
  compiler.__internal__registerBuiltinPlugin({
2690
2759
  name: binding_namespaceObject.BuiltinPluginName.EsmLibraryPlugin,
2691
2760
  options: {
2692
- preserveModules: this.options?.preserveModules
2761
+ preserveModules: this.options.preserveModules,
2762
+ splitChunks: toRawSplitChunksOptions(this.options.splitChunks ?? !1, compiler)
2693
2763
  }
2694
2764
  });
2695
2765
  }
@@ -2794,6 +2864,11 @@ let unsupported = (name, issue)=>{
2794
2864
  query: match[2] ? match[2].replace(/\u200b(.)/g, '$1') : ''
2795
2865
  };
2796
2866
  });
2867
+ function isStatsColorSupported() {
2868
+ if ("u" < typeof process) return !1;
2869
+ let env = process.env ?? {}, argv = process.argv ?? [];
2870
+ return !('NO_COLOR' in env || argv.includes('--no-color')) && ('FORCE_COLOR' in env || argv.includes('--color') || 'win32' === process.platform || process.stdout?.isTTY && 'dumb' !== env.TERM || 'CI' in env);
2871
+ }
2797
2872
  function encodeVersion(version) {
2798
2873
  let [major, minor = 0, patch = 0] = version.split('-')[0].split('.').map((v)=>parseInt(v, 10));
2799
2874
  return Number.isNaN(major) || Number.isNaN(minor) || Number.isNaN(patch) ? null : major << 16 | minor << 8 | patch;
@@ -4348,11 +4423,12 @@ function getRawJavascriptParserOptions(parser) {
4348
4423
  dynamicImportPreload: parser.dynamicImportPreload?.toString(),
4349
4424
  dynamicImportPrefetch: parser.dynamicImportPrefetch?.toString(),
4350
4425
  dynamicImportFetchPriority: parser.dynamicImportFetchPriority,
4351
- importMeta: parser.importMeta,
4426
+ importMeta: 'boolean' == typeof parser.importMeta ? String(parser.importMeta) : parser.importMeta,
4352
4427
  url: parser.url?.toString(),
4353
4428
  exprContextCritical: parser.exprContextCritical,
4354
4429
  unknownContextCritical: parser.unknownContextCritical,
4355
4430
  wrappedContextCritical: parser.wrappedContextCritical,
4431
+ strictThisContextOnImports: parser.strictThisContextOnImports,
4356
4432
  wrappedContextRegExp: parser.wrappedContextRegExp,
4357
4433
  exportsPresence: !1 === parser.exportsPresence ? 'false' : parser.exportsPresence,
4358
4434
  importExportsPresence: !1 === parser.importExportsPresence ? 'false' : parser.importExportsPresence,
@@ -5080,76 +5156,7 @@ let SideEffectsFlagPlugin = base_create(binding_namespaceObject.BuiltinPluginNam
5080
5156
  ...options,
5081
5157
  hints
5082
5158
  };
5083
- }), SourceMapDevToolPlugin = base_create(binding_namespaceObject.BuiltinPluginName.SourceMapDevToolPlugin, (options)=>options, 'compilation');
5084
- class JsSplitChunkSizes {
5085
- static __to_binding(sizes) {
5086
- return 'number' == typeof sizes ? sizes : sizes && 'object' == typeof sizes ? {
5087
- sizes: sizes
5088
- } : sizes;
5089
- }
5090
- }
5091
- class SplitChunksPlugin extends RspackBuiltinPlugin {
5092
- options;
5093
- name = binding_namespaceObject.BuiltinPluginName.SplitChunksPlugin;
5094
- affectedHooks = 'thisCompilation';
5095
- constructor(options){
5096
- super(), this.options = options;
5097
- }
5098
- raw(compiler) {
5099
- let rawOptions = function(sc, compiler) {
5100
- if (!sc) return;
5101
- function getName(name) {
5102
- return 'function' == typeof name ? (ctx)=>void 0 === ctx.module ? name(void 0) : name(ctx.module, getChunks(ctx.chunks), ctx.cacheGroupKey) : name;
5103
- }
5104
- function getChunks(chunks) {
5105
- return 'function' == typeof chunks ? (chunk)=>chunks(chunk) : chunks;
5106
- }
5107
- let { name, chunks, defaultSizeTypes, cacheGroups = {}, fallbackCacheGroup, minSize, minSizeReduction, maxSize, maxAsyncSize, maxInitialSize, ...passThrough } = sc;
5108
- return {
5109
- name: getName(name),
5110
- chunks: getChunks(chunks),
5111
- defaultSizeTypes: defaultSizeTypes || [
5112
- "javascript",
5113
- 'unknown'
5114
- ],
5115
- cacheGroups: Object.entries(cacheGroups).filter(([_key, group])=>!1 !== group).map(([key, group])=>{
5116
- let { test, name, chunks, minSize, minSizeReduction, maxSize, maxAsyncSize, maxInitialSize, ...passThrough } = group;
5117
- return {
5118
- key,
5119
- test: 'function' == typeof test ? (ctx)=>{
5120
- let info = {
5121
- moduleGraph: compiler._lastCompilation.moduleGraph,
5122
- chunkGraph: compiler._lastCompilation.chunkGraph
5123
- };
5124
- return test(ctx.module, info);
5125
- } : test,
5126
- name: getName(name),
5127
- chunks: getChunks(chunks),
5128
- minSize: JsSplitChunkSizes.__to_binding(minSize),
5129
- minSizeReduction: JsSplitChunkSizes.__to_binding(minSizeReduction),
5130
- maxSize: JsSplitChunkSizes.__to_binding(maxSize),
5131
- maxAsyncSize: JsSplitChunkSizes.__to_binding(maxAsyncSize),
5132
- maxInitialSize: JsSplitChunkSizes.__to_binding(maxInitialSize),
5133
- ...passThrough
5134
- };
5135
- }),
5136
- fallbackCacheGroup: {
5137
- chunks: getChunks(chunks),
5138
- ...fallbackCacheGroup
5139
- },
5140
- minSize: JsSplitChunkSizes.__to_binding(minSize),
5141
- minSizeReduction: JsSplitChunkSizes.__to_binding(minSizeReduction),
5142
- maxSize: JsSplitChunkSizes.__to_binding(maxSize),
5143
- maxAsyncSize: JsSplitChunkSizes.__to_binding(maxAsyncSize),
5144
- maxInitialSize: JsSplitChunkSizes.__to_binding(maxInitialSize),
5145
- ...passThrough
5146
- };
5147
- }(this.options, compiler);
5148
- if (void 0 === rawOptions) throw Error('rawOptions should not be undefined');
5149
- return createBuiltinPlugin(this.name, rawOptions);
5150
- }
5151
- }
5152
- let SubresourceIntegrityPlugin_require = createRequire(import.meta.url), SubresourceIntegrityPlugin_PLUGIN_NAME = 'SubresourceIntegrityPlugin', NATIVE_HTML_PLUGIN = 'HtmlRspackPlugin', HTTP_PROTOCOL_REGEX = /^https?:/, NativeSubresourceIntegrityPlugin = base_create(binding_namespaceObject.BuiltinPluginName.SubresourceIntegrityPlugin, function(options) {
5159
+ }), SourceMapDevToolPlugin = base_create(binding_namespaceObject.BuiltinPluginName.SourceMapDevToolPlugin, (options)=>options, 'compilation'), SubresourceIntegrityPlugin_require = createRequire(import.meta.url), SubresourceIntegrityPlugin_PLUGIN_NAME = 'SubresourceIntegrityPlugin', NATIVE_HTML_PLUGIN = 'HtmlRspackPlugin', HTTP_PROTOCOL_REGEX = /^https?:/, NativeSubresourceIntegrityPlugin = base_create(binding_namespaceObject.BuiltinPluginName.SubresourceIntegrityPlugin, function(options) {
5153
5160
  let htmlPlugin = 'Disabled';
5154
5161
  return options.htmlPlugin === NATIVE_HTML_PLUGIN ? htmlPlugin = 'Native' : 'string' == typeof options.htmlPlugin && (htmlPlugin = 'JavaScript'), {
5155
5162
  hashFuncNames: options.hashFuncNames,
@@ -5219,13 +5226,11 @@ class SubresourceIntegrityPlugin extends NativeSubresourceIntegrityPlugin {
5219
5226
  }
5220
5227
  let src = '';
5221
5228
  if (isUrlSrc) {
5222
- if (!publicPath) return;
5229
+ if (!publicPath || '/' === publicPath || './' === publicPath) return;
5223
5230
  let protocolRelativePublicPath = publicPath.replace(HTTP_PROTOCOL_REGEX, ''), protocolRelativeTagSrc = tagSrc.replace(HTTP_PROTOCOL_REGEX, '');
5224
5231
  if (!protocolRelativeTagSrc.startsWith(protocolRelativePublicPath)) return;
5225
- {
5226
- let tagSrcWithScheme = `http:${protocolRelativeTagSrc}`;
5227
- src = relative(protocolRelativePublicPath.startsWith('//') ? `http:${protocolRelativePublicPath}` : protocolRelativePublicPath, decodeURIComponent(tagSrcWithScheme));
5228
- }
5232
+ let tagSrcWithScheme = `http:${protocolRelativeTagSrc}`;
5233
+ src = relative(protocolRelativePublicPath.startsWith('//') ? `http:${protocolRelativePublicPath}` : protocolRelativePublicPath, decodeURIComponent(tagSrcWithScheme));
5229
5234
  } else src = relative(publicPath, decodeURIComponent(tagSrc));
5230
5235
  tag.attributes.integrity = this.getIntegrityChecksumForAsset(src) || function(hashFuncNames, source) {
5231
5236
  let { createHash } = SubresourceIntegrityPlugin_require('node:crypto');
@@ -6470,7 +6475,8 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6470
6475
  targetProperties,
6471
6476
  mode: options.mode,
6472
6477
  uniqueName: options.output.uniqueName,
6473
- deferImport: options.experiments.deferImport
6478
+ deferImport: options.experiments.deferImport,
6479
+ outputModule: options.output.module
6474
6480
  }), applyOutputDefaults(options, {
6475
6481
  context: options.context,
6476
6482
  targetProperties,
@@ -6510,13 +6516,14 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6510
6516
  D(options, 'incremental', {}), 'object' == typeof options.incremental && (D(options.incremental, 'silent', !0), D(options.incremental, 'buildModuleGraph', !0), D(options.incremental, 'finishModules', !0), D(options.incremental, 'optimizeDependencies', !0), D(options.incremental, 'buildChunkGraph', !0), D(options.incremental, 'optimizeChunkModules', !0), D(options.incremental, 'moduleIds', !0), D(options.incremental, 'chunkIds', !0), D(options.incremental, 'modulesHashes', !0), D(options.incremental, 'modulesCodegen', !0), D(options.incremental, 'modulesRuntimeRequirements', !0), D(options.incremental, 'chunksRuntimeRequirements', !0), D(options.incremental, 'chunksHashes', !0), D(options.incremental, 'chunkAsset', !0), D(options.incremental, 'emitAssets', !0));
6511
6517
  }, applySnapshotDefaults = (_snapshot, _env)=>{}, applyCssGeneratorOptionsDefaults = (generatorOptions, { targetProperties })=>{
6512
6518
  D(generatorOptions, 'exportsOnly', !targetProperties || !1 === targetProperties.document), D(generatorOptions, 'esModule', !0);
6513
- }, applyModuleDefaults = (module, { asyncWebAssembly, targetProperties, mode, uniqueName, deferImport })=>{
6514
- assertNotNill(module.parser), assertNotNill(module.generator), F(module.parser, "asset", ()=>({})), assertNotNill(module.parser.asset), F(module.parser.asset, 'dataUrlCondition', ()=>({})), 'object' == typeof module.parser.asset.dataUrlCondition && D(module.parser.asset.dataUrlCondition, 'maxSize', 8096), F(module.parser, "javascript", ()=>({})), assertNotNill(module.parser.javascript), ((parserOptions, { deferImport })=>{
6515
- D(parserOptions, 'dynamicImportMode', 'lazy'), D(parserOptions, 'dynamicImportPrefetch', !1), D(parserOptions, 'dynamicImportPreload', !1), D(parserOptions, 'url', !0), D(parserOptions, 'exprContextCritical', !0), D(parserOptions, 'unknownContextCritical', !0), D(parserOptions, 'wrappedContextCritical', !1), D(parserOptions, 'wrappedContextRegExp', /.*/), D(parserOptions, 'exportsPresence', 'error'), D(parserOptions, 'requireAsExpression', !0), D(parserOptions, 'requireAlias', !1), D(parserOptions, 'requireDynamic', !0), D(parserOptions, 'requireResolve', !0), D(parserOptions, 'commonjs', !0), D(parserOptions, 'importDynamic', !0), D(parserOptions, 'worker', [
6519
+ }, applyModuleDefaults = (module, { asyncWebAssembly, targetProperties, mode, uniqueName, deferImport, outputModule })=>{
6520
+ assertNotNill(module.parser), assertNotNill(module.generator), F(module.parser, "asset", ()=>({})), assertNotNill(module.parser.asset), F(module.parser.asset, 'dataUrlCondition', ()=>({})), 'object' == typeof module.parser.asset.dataUrlCondition && D(module.parser.asset.dataUrlCondition, 'maxSize', 8096), F(module.parser, "javascript", ()=>({})), assertNotNill(module.parser.javascript), ((parserOptions, { deferImport, outputModule })=>{
6521
+ D(parserOptions, 'dynamicImportMode', 'lazy'), D(parserOptions, 'dynamicImportPrefetch', !1), D(parserOptions, 'dynamicImportPreload', !1), D(parserOptions, 'url', !0), D(parserOptions, 'exprContextCritical', !0), D(parserOptions, 'unknownContextCritical', !0), D(parserOptions, 'wrappedContextCritical', !1), D(parserOptions, 'strictThisContextOnImports', !1), D(parserOptions, 'wrappedContextRegExp', /.*/), D(parserOptions, 'exportsPresence', 'error'), D(parserOptions, 'requireAsExpression', !0), D(parserOptions, 'requireAlias', !1), D(parserOptions, 'requireDynamic', !0), D(parserOptions, 'requireResolve', !0), D(parserOptions, 'commonjs', !0), D(parserOptions, 'importDynamic', !0), D(parserOptions, 'worker', [
6516
6522
  '...'
6517
- ]), D(parserOptions, 'importMeta', !0), D(parserOptions, 'typeReexportsPresence', 'no-tolerant'), D(parserOptions, 'jsx', !1), D(parserOptions, 'deferImport', deferImport);
6523
+ ]), D(parserOptions, 'importMeta', !outputModule || 'preserve-unknown'), D(parserOptions, 'typeReexportsPresence', 'no-tolerant'), D(parserOptions, 'jsx', !1), D(parserOptions, 'deferImport', deferImport);
6518
6524
  })(module.parser.javascript, {
6519
- deferImport
6525
+ deferImport,
6526
+ outputModule
6520
6527
  }), F(module.parser, "json", ()=>({})), assertNotNill(module.parser.json), D(module.parser.json, 'exportsDepth', 'development' === mode ? 1 : Number.MAX_SAFE_INTEGER), F(module.generator, 'json', ()=>({})), assertNotNill(module.generator.json), D(module.generator.json, 'JSONParse', !0), F(module.parser, 'css', ()=>({})), assertNotNill(module.parser.css), D(module.parser.css, 'namedExports', !0), D(module.parser.css, 'url', !0), F(module.parser, 'css/auto', ()=>({})), assertNotNill(module.parser['css/auto']), D(module.parser['css/auto'], 'namedExports', !0), D(module.parser['css/auto'], 'url', !0), F(module.parser, 'css/module', ()=>({})), assertNotNill(module.parser['css/module']), D(module.parser['css/module'], 'namedExports', !0), D(module.parser['css/module'], 'url', !0), F(module.generator, 'css', ()=>({})), assertNotNill(module.generator.css), applyCssGeneratorOptionsDefaults(module.generator.css, {
6521
6528
  targetProperties
6522
6529
  }), F(module.generator, 'css/auto', ()=>({})), assertNotNill(module.generator['css/auto']), applyCssGeneratorOptionsDefaults(module.generator['css/auto'], {
@@ -6784,7 +6791,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6784
6791
  return output.wasmLoading && enabledWasmLoadingTypes.add(output.wasmLoading), output.workerWasmLoading && enabledWasmLoadingTypes.add(output.workerWasmLoading), forEachEntry((desc)=>{
6785
6792
  desc.wasmLoading && enabledWasmLoadingTypes.add(desc.wasmLoading);
6786
6793
  }), Array.from(enabledWasmLoadingTypes);
6787
- }), D(output, 'bundlerInfo', {}), 'object' == typeof output.bundlerInfo && (D(output.bundlerInfo, 'version', "2.0.0-beta.3"), D(output.bundlerInfo, 'bundler', 'rspack'), D(output.bundlerInfo, 'force', !output.library));
6794
+ }), D(output, 'bundlerInfo', {}), 'object' == typeof output.bundlerInfo && (D(output.bundlerInfo, 'version', "2.0.0-beta.5"), D(output.bundlerInfo, 'bundler', 'rspack'), D(output.bundlerInfo, 'force', !output.library));
6788
6795
  }, applyExternalsPresetsDefaults = (externalsPresets, { targetProperties, buildHttp, outputModule })=>{
6789
6796
  let isUniversal = (key)=>!!(outputModule && targetProperties && null === targetProperties[key]);
6790
6797
  D(externalsPresets, 'web', !buildHttp && targetProperties && (targetProperties.web || isUniversal('node'))), D(externalsPresets, 'node', targetProperties && (targetProperties.node || isUniversal('node'))), D(externalsPresets, 'electron', targetProperties && targetProperties.electron || isUniversal('electron')), D(externalsPresets, 'electronMain', targetProperties && !!targetProperties.electron && (targetProperties.electronMain || isUniversal('electronMain'))), D(externalsPresets, 'electronPreload', targetProperties && !!targetProperties.electron && (targetProperties.electronPreload || isUniversal('electronPreload'))), D(externalsPresets, 'electronRenderer', targetProperties && !!targetProperties.electron && (targetProperties.electronRenderer || isUniversal('electronRenderer'))), D(externalsPresets, 'nwjs', targetProperties && (targetProperties.nwjs || isUniversal('nwjs')));
@@ -8038,7 +8045,7 @@ class MultiStats {
8038
8045
  obj.children = this.stats.map((stat, idx)=>{
8039
8046
  let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
8040
8047
  return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
8041
- }), childOptions.version && (obj.rspackVersion = "2.0.0-beta.3", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(''));
8048
+ }), childOptions.version && (obj.rspackVersion = "2.0.0-beta.5", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(''));
8042
8049
  let mapError = (j, obj)=>({
8043
8050
  ...obj,
8044
8051
  compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
@@ -9297,7 +9304,7 @@ let iterateConfig = (config, options, fn)=>{
9297
9304
  object.hash = context.getStatsCompilation(compilation).hash;
9298
9305
  },
9299
9306
  version: (object)=>{
9300
- object.version = "5.75.0", object.rspackVersion = "2.0.0-beta.3";
9307
+ object.version = "5.75.0", object.rspackVersion = "2.0.0-beta.5";
9301
9308
  },
9302
9309
  env: (object, _compilation, _context, { _env })=>{
9303
9310
  object.env = _env;
@@ -9769,7 +9776,7 @@ let applyDefaults = (options, defaults)=>{
9769
9776
  chunksSort: ()=>!1,
9770
9777
  assetsSort: ()=>'!size',
9771
9778
  outputPath: OFF_FOR_TO_STRING,
9772
- colors: ()=>!1
9779
+ colors: ()=>isStatsColorSupported()
9773
9780
  }, normalizeFilter = (item)=>{
9774
9781
  if ('string' == typeof item) {
9775
9782
  let regExp = RegExp(`[\\\\/]${item.replace(/[-[\]{}()*+?.\\^$|]/g, '\\$&')}([\\\\/]|$|!|\\?)`);
@@ -10559,18 +10566,21 @@ class RspackOptionsApply {
10559
10566
  moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate,
10560
10567
  namespace: options.output.devtoolNamespace
10561
10568
  }).apply(compiler);
10562
- if (new JavascriptModulesPlugin().apply(compiler), new URLPlugin().apply(compiler), new JsonModulesPlugin().apply(compiler), new AssetModulesPlugin().apply(compiler), options.experiments.asyncWebAssembly && new AsyncWebAssemblyModulesPlugin().apply(compiler), new CssModulesPlugin().apply(compiler), new lib_EntryOptionPlugin().apply(compiler), assertNotNill(options.context), compiler.hooks.entryOption.call(options.context, options.entry), new RuntimePlugin().apply(compiler), options.output.bundlerInfo && new BundlerInfoRspackPlugin(options.output.bundlerInfo).apply(compiler), new InferAsyncModulesPlugin().apply(compiler), new APIPlugin().apply(compiler), new DataUriPlugin().apply(compiler), new FileUriPlugin().apply(compiler), options.experiments.buildHttp && new HttpUriPlugin(options.experiments.buildHttp).apply(compiler), new EnsureChunkConditionsPlugin().apply(compiler), options.optimization.mergeDuplicateChunks && new MergeDuplicateChunksPlugin().apply(compiler), options.optimization.sideEffects && new SideEffectsFlagPlugin().apply(compiler), options.optimization.providedExports && new FlagDependencyExportsPlugin().apply(compiler), options.optimization.usedExports && new FlagDependencyUsagePlugin('global' === options.optimization.usedExports).apply(compiler), options.optimization.concatenateModules && new ModuleConcatenationPlugin().apply(compiler), options.optimization.inlineExports && new InlineExportsPlugin().apply(compiler), options.optimization.mangleExports && new MangleExportsPlugin('size' !== options.optimization.mangleExports).apply(compiler), options.output.enabledLibraryTypes && options.output.enabledLibraryTypes.length > 0) {
10569
+ new JavascriptModulesPlugin().apply(compiler), new URLPlugin().apply(compiler), new JsonModulesPlugin().apply(compiler), new AssetModulesPlugin().apply(compiler), options.experiments.asyncWebAssembly && new AsyncWebAssemblyModulesPlugin().apply(compiler), new CssModulesPlugin().apply(compiler), new lib_EntryOptionPlugin().apply(compiler), assertNotNill(options.context), compiler.hooks.entryOption.call(options.context, options.entry), new RuntimePlugin().apply(compiler), options.output.bundlerInfo && new BundlerInfoRspackPlugin(options.output.bundlerInfo).apply(compiler), new InferAsyncModulesPlugin().apply(compiler), new APIPlugin().apply(compiler), new DataUriPlugin().apply(compiler), new FileUriPlugin().apply(compiler), options.experiments.buildHttp && new HttpUriPlugin(options.experiments.buildHttp).apply(compiler), new EnsureChunkConditionsPlugin().apply(compiler), options.optimization.mergeDuplicateChunks && new MergeDuplicateChunksPlugin().apply(compiler), options.optimization.sideEffects && new SideEffectsFlagPlugin().apply(compiler), options.optimization.providedExports && new FlagDependencyExportsPlugin().apply(compiler), options.optimization.usedExports && new FlagDependencyUsagePlugin('global' === options.optimization.usedExports).apply(compiler), options.optimization.concatenateModules && new ModuleConcatenationPlugin().apply(compiler), options.optimization.inlineExports && new InlineExportsPlugin().apply(compiler), options.optimization.mangleExports && new MangleExportsPlugin('size' !== options.optimization.mangleExports).apply(compiler);
10570
+ let enableLibSplitChunks = !1;
10571
+ if (options.output.enabledLibraryTypes && options.output.enabledLibraryTypes.length > 0) {
10563
10572
  let modernModuleCount = 0;
10564
10573
  for (let type of options.output.enabledLibraryTypes)'modern-module' === type && modernModuleCount++;
10565
10574
  if (options.output.library?.preserveModules && 0 === modernModuleCount) throw Error('preserveModules only works for `modern-module` library type');
10566
10575
  if (modernModuleCount > 0) {
10567
10576
  if (modernModuleCount !== options.output.enabledLibraryTypes.length) throw Error('`modern-module` cannot used together with other library types');
10568
- new EsmLibraryPlugin({
10569
- preserveModules: options.output.library?.preserveModules
10577
+ enableLibSplitChunks = !0, new EsmLibraryPlugin({
10578
+ preserveModules: options.output.library?.preserveModules,
10579
+ splitChunks: options.optimization.splitChunks
10570
10580
  }).apply(compiler);
10571
10581
  } else for (let type of options.output.enabledLibraryTypes)new EnableLibraryPlugin(type).apply(compiler);
10572
10582
  }
10573
- options.optimization.splitChunks && new SplitChunksPlugin(options.optimization.splitChunks).apply(compiler), options.optimization.removeEmptyChunks && new RemoveEmptyChunksPlugin().apply(compiler), options.optimization.realContentHash && new RealContentHashPlugin().apply(compiler);
10583
+ !enableLibSplitChunks && options.optimization.splitChunks && new SplitChunksPlugin(options.optimization.splitChunks).apply(compiler), options.optimization.removeEmptyChunks && new RemoveEmptyChunksPlugin().apply(compiler), options.optimization.realContentHash && new RealContentHashPlugin().apply(compiler);
10574
10584
  let moduleIds = options.optimization.moduleIds;
10575
10585
  if (moduleIds) switch(moduleIds){
10576
10586
  case 'named':
@@ -10959,7 +10969,7 @@ class TraceHookPlugin {
10959
10969
  });
10960
10970
  }
10961
10971
  }
10962
- let CORE_VERSION = "2.0.0-beta.3", VFILES_BY_COMPILER = new WeakMap();
10972
+ let CORE_VERSION = "2.0.0-beta.5", VFILES_BY_COMPILER = new WeakMap();
10963
10973
  class VirtualModulesPlugin {
10964
10974
  #staticModules;
10965
10975
  #compiler;
@@ -11501,7 +11511,7 @@ class Compiler {
11501
11511
  }
11502
11512
  #getInstance(callback) {
11503
11513
  var output;
11504
- let coreVersion, expectedCoreVersion, mode, experiments, error = CORE_VERSION === binding_default().EXPECTED_RSPACK_CORE_VERSION || CORE_VERSION.includes('canary') ? null : Error((coreVersion = CORE_VERSION, expectedCoreVersion = binding_default().EXPECTED_RSPACK_CORE_VERSION, process.env.RSPACK_BINDING ? `Unmatched version @rspack/core@${coreVersion} and binding version.
11514
+ let coreVersion, expectedCoreVersion, statsOptions, mode, experiments, error = CORE_VERSION === binding_default().EXPECTED_RSPACK_CORE_VERSION || CORE_VERSION.includes('canary') ? null : Error((coreVersion = CORE_VERSION, expectedCoreVersion = binding_default().EXPECTED_RSPACK_CORE_VERSION, process.env.RSPACK_BINDING ? `Unmatched version @rspack/core@${coreVersion} and binding version.
11505
11515
 
11506
11516
  Help:
11507
11517
  Looks like you are using a custom binding (via environment variable 'RSPACK_BINDING=${process.env.RSPACK_BINDING}').
@@ -11572,7 +11582,7 @@ Help:
11572
11582
  }),
11573
11583
  optimization: options.optimization,
11574
11584
  stats: {
11575
- colors: !!function(options) {
11585
+ colors: void 0 === (statsOptions = function(options) {
11576
11586
  if ('boolean' == typeof options || 'string' == typeof options) return presetToOptions(options);
11577
11587
  if (!options) return {};
11578
11588
  let obj = {
@@ -11580,7 +11590,7 @@ Help:
11580
11590
  ...options
11581
11591
  };
11582
11592
  return delete obj.preset, obj;
11583
- }(options.stats).colors
11593
+ }(options.stats)).colors ? isStatsColorSupported() : !!statsOptions.colors
11584
11594
  },
11585
11595
  cache: options.cache || !1,
11586
11596
  experiments,
@@ -12743,7 +12753,7 @@ class CollectSharedEntryPlugin extends RspackBuiltinPlugin {
12743
12753
  super.apply(compiler), compiler.hooks.thisCompilation.tap('Collect shared entry', (compilation)=>{
12744
12754
  compilation.hooks.processAssets.tap({
12745
12755
  name: 'CollectSharedEntry',
12746
- stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE
12756
+ stage: compiler.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE
12747
12757
  }, ()=>{
12748
12758
  compilation.getAssets().forEach((asset)=>{
12749
12759
  asset.name === SHARE_ENTRY_ASSET && (this._collectedEntries = JSON.parse(asset.source.source().toString())), compilation.deleteAsset(asset.name);
@@ -12864,7 +12874,7 @@ class VirtualEntryPlugin {
12864
12874
  }).apply(compiler), compiler.hooks.thisCompilation.tap('RemoveVirtualEntryAsset', (compilation)=>{
12865
12875
  compilation.hooks.processAssets.tap({
12866
12876
  name: 'RemoveVirtualEntryAsset',
12867
- stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE
12877
+ stage: compiler.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE
12868
12878
  }, ()=>{
12869
12879
  try {
12870
12880
  let chunk = compilation.namedChunks.get(VIRTUAL_ENTRY_NAME);
@@ -12924,7 +12934,7 @@ class IndependentSharedPlugin {
12924
12934
  targetShared && item.forEach(([entry, version, globalName])=>{
12925
12935
  version === targetShared.version && (targetShared.fallback = entry, targetShared.fallbackName = globalName);
12926
12936
  });
12927
- }), compilation.updateAsset(filename, new compiler.webpack.sources.RawSource(JSON.stringify(statsContent)));
12937
+ }), compilation.updateAsset(filename, new compiler.rspack.sources.RawSource(JSON.stringify(statsContent)));
12928
12938
  };
12929
12939
  injectBuildAssetsIntoStatsOrManifest(statsFileName), injectBuildAssetsIntoStatsOrManifest(manifestFileName);
12930
12940
  });
@@ -13144,7 +13154,7 @@ function getDefaultEntryRuntime(paths, options, compiler, treeShakingShareFallba
13144
13154
  `const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? 'version-first')}`,
13145
13155
  `const __module_federation_share_fallbacks__ = ${JSON.stringify(treeShakingShareFallbacks)}`,
13146
13156
  `const __module_federation_library_type__ = ${JSON.stringify(libraryType)}`,
13147
- compiler.webpack.Template.getFunctionContent(ModuleFederationPlugin_require('./moduleFederationDefaultRuntime.js').default)
13157
+ compiler.rspack.Template.getFunctionContent(ModuleFederationPlugin_require('./moduleFederationDefaultRuntime.js').default)
13148
13158
  ].join(';');
13149
13159
  return `@module-federation/runtime/rspack.js!=!data:text/javascript,${encodeURIComponent(content)}`;
13150
13160
  }
@@ -13243,7 +13253,7 @@ async function transform(source, options) {
13243
13253
  let _options = JSON.stringify(options || {});
13244
13254
  return binding_default().transform(source, _options);
13245
13255
  }
13246
- let exports_rspackVersion = "2.0.0-beta.3", exports_version = "5.75.0", exports_WebpackError = Error, exports_config = {
13256
+ let exports_rspackVersion = "2.0.0-beta.5", exports_version = "5.75.0", exports_WebpackError = Error, exports_config = {
13247
13257
  getNormalizedRspackOptions: getNormalizedRspackOptions,
13248
13258
  applyRspackOptionsDefaults: applyRspackOptionsDefaults,
13249
13259
  getNormalizedWebpackOptions: getNormalizedRspackOptions,
@@ -7,7 +7,7 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- import { AsyncParallelHook, AsyncSeriesBailHook, SyncHook } from '../../compiled/@rspack/lite-tapable/dist/index.d.ts';
10
+ import { AsyncParallelHook, AsyncSeriesBailHook, SyncHook } from '../../compiled/@rspack/lite-tapable/dist';
11
11
  import type { WebpackError } from './WebpackError.js';
12
12
  export interface Etag {
13
13
  toString(): string;
@@ -7,7 +7,7 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- import type { Callback } from '../../compiled/@rspack/lite-tapable/dist/index.d.ts';
10
+ import type { Callback } from '../../compiled/@rspack/lite-tapable/dist';
11
11
  import WebpackError from './WebpackError.js';
12
12
  export declare class HookWebpackError extends WebpackError {
13
13
  hook: string;
package/dist/rspack.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- import type { Callback } from '../compiled/@rspack/lite-tapable/dist/index.d.ts';
10
+ import type { Callback } from '../compiled/@rspack/lite-tapable/dist';
11
11
  import { Compiler } from './Compiler.js';
12
12
  import { type RspackOptions } from './config/index.js';
13
13
  import { MultiCompiler, type MultiRspackOptions } from './MultiCompiler.js';
@@ -8,7 +8,7 @@
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
10
  import type { JsStats, JsStatsCompilation, JsStatsError } from '@rspack/binding';
11
- import { HookMap, SyncBailHook, SyncWaterfallHook } from '../../compiled/@rspack/lite-tapable/dist/index.d.ts';
11
+ import { HookMap, SyncBailHook, SyncWaterfallHook } from '../../compiled/@rspack/lite-tapable/dist';
12
12
  import type { Compilation } from '../Compilation.js';
13
13
  import { type GroupConfig } from '../util/smartGrouping.js';
14
14
  export type KnownStatsFactoryContext = {
@@ -1,4 +1,4 @@
1
- import { HookMap, SyncBailHook, SyncWaterfallHook } from '../../compiled/@rspack/lite-tapable/dist/index.d.ts';
1
+ import { HookMap, SyncBailHook, SyncWaterfallHook } from '../../compiled/@rspack/lite-tapable/dist';
2
2
  import type { StatsAsset, StatsChunk, StatsChunkGroup, StatsCompilation, StatsModule, StatsModuleReason } from './statsFactoryUtils.js';
3
3
  type PrintedElement = {
4
4
  element: string;
@@ -1,5 +1,5 @@
1
1
  import type binding from '@rspack/binding';
2
- import type * as liteTapable from '../../compiled/@rspack/lite-tapable/dist/index.d.ts';
2
+ import type * as liteTapable from '../../compiled/@rspack/lite-tapable/dist';
3
3
  import type { Compiler } from '../Compiler.js';
4
4
  type CreateHookMapRegisterTaps = <H extends liteTapable.Hook<any, any, any>>(registerKind: binding.RegisterJsTapKind, getHookMap: () => liteTapable.HookMap<H>, createTap: (queried: liteTapable.QueriedHookMap<H>) => any) => (stages: number[]) => binding.JsTap[];
5
5
  type CreateHookRegisterTaps = <T, R, A>(registerKind: binding.RegisterJsTapKind, getHook: () => liteTapable.Hook<T, R, A>, createTap: (queried: liteTapable.QueriedHook<T, R, A>) => any) => (stages: number[]) => binding.JsTap[];
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Whether the current environment supports color output (TTY, FORCE_COLOR, NO_COLOR, etc.).
3
+ * Used as the default for stats.colors when not explicitly set.
4
+ * @see https://github.com/web-infra-dev/rspack/issues/9353
5
+ */
6
+ export declare function isStatsColorSupported(): boolean;
package/module.d.ts CHANGED
@@ -176,7 +176,10 @@ declare namespace Rspack {
176
176
  id: ModuleId;
177
177
  loaded: boolean;
178
178
  parents: NodeJS.Module['id'][] | null | undefined;
179
- children: NodeJS.Module['id'][];
179
+ // Keep `any[]` for compatibility:
180
+ // - Rspack runtime uses module ids
181
+ // - `@types/node` defines `children` as `Module[]`.
182
+ children: any[];
180
183
  hot?: Hot;
181
184
  }
182
185
 
@@ -210,7 +213,6 @@ declare namespace Rspack {
210
213
  interface Process {
211
214
  env: {
212
215
  [key: string]: any;
213
- NODE_ENV: 'development' | 'production' | (string & {});
214
216
  };
215
217
  }
216
218
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "2.0.0-beta.3",
3
+ "version": "2.0.0-beta.5",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "The fast Rust-based web bundler with webpack-compatible API",
@@ -58,7 +58,7 @@
58
58
  "webpack-sources": "3.3.4"
59
59
  },
60
60
  "dependencies": {
61
- "@rspack/binding": "2.0.0-beta.3"
61
+ "@rspack/binding": "2.0.0-beta.5"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "@module-federation/runtime-tools": "^0.24.1 || ^2.0.0",