@rspack/core 2.1.0 → 2.1.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.
@@ -615,6 +615,10 @@ export type RuleSetLogicalConditions = {
615
615
  export type RuleSetLoader = string;
616
616
  export type RuleSetLoaderOptions = string | Record<string, any>;
617
617
  export type RuleSetLoaderWithOptions = {
618
+ /**
619
+ * Stable identifier used to reference object-form loader options.
620
+ * When provided, Rspack passes object options to the loader request as `??${ident}`.
621
+ */
618
622
  ident?: string;
619
623
  loader: RuleSetLoader;
620
624
  /**
@@ -970,7 +974,8 @@ export type JsonParserOptions = {
970
974
  */
971
975
  exportsDepth?: number;
972
976
  /**
973
- * If Rule.type is set to 'json' then Rules.parser.parse option may be a function that implements custom logic to parse module's source and convert it to a json-compatible data.
977
+ * Custom synchronous parser for json modules. It receives the module source and should return JSON-serializable data.
978
+ * Can be configured through module.parser.json or through Rule.parser when Rule.type is 'json'.
974
979
  */
975
980
  parse?: (source: string) => any;
976
981
  };
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import { __webpack_require__ } from "./rslib-runtime-index.js";
9
9
  let __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
10
10
  import * as __rspack_external_node_util_1b29d436 from "node:util";
11
11
  __webpack_require__.add({
12
- "../../node_modules/.pnpm/enhanced-resolve@5.24.0/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js" (module, __unused_rspack_exports, __webpack_require__) {
12
+ "../../node_modules/.pnpm/enhanced-resolve@5.24.1/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js" (module, __unused_rspack_exports, __webpack_require__) {
13
13
  let { nextTick } = __webpack_require__("process"), dirname = (path)=>{
14
14
  let idx = path.length - 1;
15
15
  for(; idx >= 0;){
@@ -7032,7 +7032,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7032
7032
  return output.wasmLoading && enabledWasmLoadingTypes.add(output.wasmLoading), output.workerWasmLoading && enabledWasmLoadingTypes.add(output.workerWasmLoading), forEachEntry((desc)=>{
7033
7033
  desc.wasmLoading && enabledWasmLoadingTypes.add(desc.wasmLoading);
7034
7034
  }), Array.from(enabledWasmLoadingTypes);
7035
- }), D(output, 'bundlerInfo', {}), 'object' == typeof output.bundlerInfo && (D(output.bundlerInfo, 'version', "2.1.0"), D(output.bundlerInfo, 'bundler', 'rspack'), D(output.bundlerInfo, 'force', !1));
7035
+ }), D(output, 'bundlerInfo', {}), 'object' == typeof output.bundlerInfo && (D(output.bundlerInfo, 'version', "2.1.2"), D(output.bundlerInfo, 'bundler', 'rspack'), D(output.bundlerInfo, 'force', !1));
7036
7036
  }, applyExternalsPresetsDefaults = (externalsPresets, { targetProperties, buildHttp, outputModule })=>{
7037
7037
  let isUniversal = (key)=>!!(outputModule && targetProperties && null === targetProperties[key]);
7038
7038
  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')));
@@ -8330,7 +8330,7 @@ class MultiStats {
8330
8330
  obj.children = this.stats.map((stat, idx)=>{
8331
8331
  let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
8332
8332
  return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
8333
- }), childOptions.version && (obj.rspackVersion = "2.1.0", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(''));
8333
+ }), childOptions.version && (obj.rspackVersion = "2.1.2", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(''));
8334
8334
  let mapError = (j, obj)=>({
8335
8335
  ...obj,
8336
8336
  compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
@@ -8889,7 +8889,7 @@ let arraySum = (array)=>{
8889
8889
  let str = `${a}`, length = lengths[i];
8890
8890
  return str.length === length ? str : length > 5 ? `...${str.slice(-length + 3)}` : length > 0 ? str.slice(-length) : '';
8891
8891
  });
8892
- }, CachedInputFileSystem = __webpack_require__("../../node_modules/.pnpm/enhanced-resolve@5.24.0/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js");
8892
+ }, CachedInputFileSystem = __webpack_require__("../../node_modules/.pnpm/enhanced-resolve@5.24.1/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js");
8893
8893
  var CachedInputFileSystem_default = __webpack_require__.n(CachedInputFileSystem);
8894
8894
  class NodeEnvironmentPlugin {
8895
8895
  options;
@@ -9654,7 +9654,7 @@ let iterateConfig = (config, options, fn)=>{
9654
9654
  object.hash = context.getStatsCompilation(compilation).hash;
9655
9655
  },
9656
9656
  version: (object)=>{
9657
- object.version = "5.75.0", object.rspackVersion = "2.1.0";
9657
+ object.version = "5.75.0", object.rspackVersion = "2.1.2";
9658
9658
  },
9659
9659
  env: (object, _compilation, _context, { _env })=>{
9660
9660
  object.env = _env;
@@ -11315,7 +11315,7 @@ class TraceHookPlugin {
11315
11315
  });
11316
11316
  }
11317
11317
  }
11318
- let CORE_VERSION = "2.1.0", VFILES_BY_COMPILER = new WeakMap();
11318
+ let CORE_VERSION = "2.1.2", VFILES_BY_COMPILER = new WeakMap();
11319
11319
  class VirtualModulesPlugin {
11320
11320
  #staticModules;
11321
11321
  #compiler;
@@ -13736,7 +13736,7 @@ async function transform(source, options) {
13736
13736
  let _options = JSON.stringify(options || {});
13737
13737
  return binding_default().transform(source, _options);
13738
13738
  }
13739
- let exports_rspackVersion = "2.1.0", exports_version = "5.75.0", exports_WebpackError = Error, exports_config = {
13739
+ let exports_rspackVersion = "2.1.2", exports_version = "5.75.0", exports_WebpackError = Error, exports_config = {
13740
13740
  getNormalizedRspackOptions: getNormalizedRspackOptions,
13741
13741
  applyRspackOptionsDefaults: applyRspackOptionsDefaults,
13742
13742
  getNormalizedWebpackOptions: getNormalizedRspackOptions,
@@ -7,5 +7,5 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- declare const _default: () => import("./wasm-hash.js").WasmHash;
11
10
  export default _default;
11
+ declare function _default(): import("./wasm-hash.js").WasmHash;
@@ -7,5 +7,5 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- declare const _default: () => import("./wasm-hash.js").WasmHash;
11
10
  export default _default;
11
+ declare function _default(): import("./wasm-hash.js").WasmHash;
package/module.d.ts CHANGED
@@ -251,6 +251,14 @@ interface ImportMeta {
251
251
  rspackRsc?: {
252
252
  loadCss(): any;
253
253
  };
254
+ rspackPublicPath: string;
255
+ rspackBaseUri: string;
256
+ rspackShareScopes: typeof __webpack_share_scopes__;
257
+ rspackInitSharing: typeof __webpack_init_sharing__;
258
+ rspackNonce: string;
259
+ rspackUniqueId: string;
260
+ rspackVersion: string;
261
+ rspackHash: string;
254
262
  glob: {
255
263
  <T = unknown>(
256
264
  pattern: Rspack.ImportMetaGlobPattern,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "Fast Rust-based bundler for the web with a modernized webpack API",
@@ -37,8 +37,8 @@
37
37
  "directory": "packages/rspack"
38
38
  },
39
39
  "devDependencies": {
40
- "@ast-grep/napi": "^0.43.0",
41
- "@napi-rs/wasm-runtime": "1.1.5",
40
+ "@ast-grep/napi": "^0.44.0",
41
+ "@napi-rs/wasm-runtime": "1.1.6",
42
42
  "@rsbuild/plugin-node-polyfill": "^1.4.6",
43
43
  "@rslib/core": "^0.23.0",
44
44
  "@rspack/lite-tapable": "1.1.2",
@@ -47,9 +47,9 @@
47
47
  "browserslist-load-config": "^1.0.3",
48
48
  "browserslist-to-es-version": "^1.4.2",
49
49
  "connect-next": "^4.0.3",
50
- "enhanced-resolve": "5.24.0",
50
+ "enhanced-resolve": "5.24.1",
51
51
  "http-proxy-middleware": "^4.1.1",
52
- "memfs": "4.57.7",
52
+ "memfs": "4.57.8",
53
53
  "open": "^11.0.0",
54
54
  "prebundle": "^1.6.5",
55
55
  "tinypool": "^2.1.0",
@@ -58,7 +58,7 @@
58
58
  "webpack-sources": "3.5.0"
59
59
  },
60
60
  "dependencies": {
61
- "@rspack/binding": "2.1.0"
61
+ "@rspack/binding": "2.1.2"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "@module-federation/runtime-tools": "^0.24.1 || ^2.0.0",