@rspack/core 1.0.6 → 1.0.8

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.
@@ -14,7 +14,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.resolve = exports.load = void 0;
16
16
  const node_path_1 = __importDefault(require("node:path"));
17
- const browserslist_1 = __importDefault(require("../../compiled/browserslist"));
18
17
  // [[C:]/path/to/config][:env]
19
18
  const inputRx = /^(?:((?:[A-Z]:)?[/\\].*?))?(?::(.+?))?$/i;
20
19
  /**
@@ -30,7 +29,8 @@ const parse = (input, context) => {
30
29
  const [, configPath, env] = inputRx.exec(input) || [];
31
30
  return { configPath, env };
32
31
  }
33
- const config = browserslist_1.default.findConfig(context);
32
+ const browserslist = require("../../compiled/browserslist");
33
+ const config = browserslist.findConfig(context);
34
34
  if (config && Object.keys(config).includes(input)) {
35
35
  return { env: input };
36
36
  }
@@ -42,6 +42,7 @@ const parse = (input, context) => {
42
42
  * @returns selected browsers
43
43
  */
44
44
  const load = (input, context) => {
45
+ const browserslist = require("../../compiled/browserslist");
45
46
  const { configPath, env, query } = parse(input, context);
46
47
  // if a query is specified, then use it, else
47
48
  // if a path to a config is specified then load it, else
@@ -49,14 +50,14 @@ const load = (input, context) => {
49
50
  const config = query
50
51
  ? query
51
52
  : configPath
52
- ? browserslist_1.default.loadConfig({
53
+ ? browserslist.loadConfig({
53
54
  config: configPath,
54
55
  env
55
56
  })
56
- : browserslist_1.default.loadConfig({ path: context, env });
57
+ : browserslist.loadConfig({ path: context, env });
57
58
  if (!config)
58
59
  return;
59
- return (0, browserslist_1.default)(config);
60
+ return browserslist(config);
60
61
  };
61
62
  exports.load = load;
62
63
  /**
@@ -133,12 +133,20 @@ const applyExperimentsDefaults = (experiments) => {
133
133
  D(experiments, "css", experiments.futureDefaults ? true : undefined);
134
134
  D(experiments, "layers", false);
135
135
  D(experiments, "topLevelAwait", true);
136
+ // IGNORE(experiments.incremental): Rspack specific configuration for incremental
137
+ D(experiments, "incremental", {});
138
+ if (typeof experiments.incremental === "object") {
139
+ D(experiments.incremental, "make", true);
140
+ D(experiments.incremental, "emitAssets", true);
141
+ D(experiments.incremental, "inferAsyncModules", false);
142
+ D(experiments.incremental, "providedExports", false);
143
+ D(experiments.incremental, "moduleHashes", false);
144
+ D(experiments.incremental, "moduleCodegen", false);
145
+ D(experiments.incremental, "moduleRuntimeRequirements", false);
146
+ }
136
147
  // IGNORE(experiments.rspackFuture): Rspack specific configuration
137
148
  D(experiments, "rspackFuture", {});
138
149
  // rspackFuture.bundlerInfo default value is applied after applyDefaults
139
- if (typeof experiments.rspackFuture === "object") {
140
- D(experiments.rspackFuture, "newIncremental", false);
141
- }
142
150
  };
143
151
  const applybundlerInfoDefaults = (rspackFuture, library) => {
144
152
  if (typeof rspackFuture === "object") {
@@ -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, AsyncChunks, Bail, BaseUri, 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, ImportMetaName, InfrastructureLogging, Layer, LazyCompilationOptions, LibraryOptions, Loader, Mode, Name, NoParseOption, Node, 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, AsyncChunks, Bail, BaseUri, 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, ImportMetaName, Incremental, InfrastructureLogging, Layer, LazyCompilationOptions, LibraryOptions, Loader, Mode, Name, NoParseOption, Node, 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;
@@ -90,6 +90,7 @@ export interface ExperimentsNormalized {
90
90
  topLevelAwait?: boolean;
91
91
  css?: boolean;
92
92
  layers?: boolean;
93
+ incremental?: false | Incremental;
93
94
  futureDefaults?: boolean;
94
95
  rspackFuture?: RspackFutureOptions;
95
96
  }
@@ -194,7 +194,8 @@ const getNormalizedRspackOptions = (config) => {
194
194
  plugins: nestedArray(config.plugins, p => [...p]),
195
195
  experiments: nestedConfig(config.experiments, experiments => ({
196
196
  ...experiments,
197
- lazyCompilation: optionalNestedConfig(experiments.lazyCompilation, options => (options === true ? {} : options))
197
+ lazyCompilation: optionalNestedConfig(experiments.lazyCompilation, options => (options === true ? {} : options)),
198
+ incremental: optionalNestedConfig(experiments.incremental, options => options === true ? {} : options)
198
199
  })),
199
200
  watch: config.watch,
200
201
  watchOptions: cloneObject(config.watchOptions),