@rspack-canary/browser 1.6.0-canary-bf68c45d-20251028142310 → 1.6.0-canary-505c7433-20251028174050

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/index.mjs CHANGED
@@ -51826,28 +51826,24 @@ function createFakeCompilationDependencies(getDeps, addDeps) {
51826
51826
  }
51827
51827
  var lib = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
51828
51828
  var Buffer = __webpack_require__("./src/browser/buffer.ts")["Buffer"];
51829
- class JsSource extends lib.Source {
51830
- static __from_binding(source) {
51831
- if (Buffer.isBuffer(source.source)) return new lib.RawSource(source.source);
51829
+ class SourceAdapter {
51830
+ static fromBinding(source) {
51832
51831
  if (!source.map) return new lib.RawSource(source.source);
51833
51832
  return new lib.SourceMapSource(source.source, "inmemory://from rust", source.map);
51834
51833
  }
51835
- static __to_binding(source) {
51836
- if (source instanceof lib.RawSource) {
51837
- if (source.isBuffer()) return {
51838
- source: source.buffer()
51839
- };
51840
- return {
51841
- source: source.source()
51842
- };
51843
- }
51844
- const map = JSON.stringify(source.map?.({
51834
+ static toBinding(source) {
51835
+ const content = source.source();
51836
+ if (Buffer.isBuffer(content)) return {
51837
+ source: content,
51838
+ map: void 0
51839
+ };
51840
+ const map = source.map?.({
51845
51841
  columns: true
51846
- }));
51847
- const code = source.source();
51842
+ });
51843
+ const stringifyMap = map ? JSON.stringify(map) : void 0;
51848
51844
  return {
51849
- source: "string" == typeof code ? code : Buffer.from(code).toString("utf-8"),
51850
- map
51845
+ source: content,
51846
+ map: stringifyMap
51851
51847
  };
51852
51848
  }
51853
51849
  }
@@ -52014,7 +52010,7 @@ Object.defineProperty(external_rspack_wasi_browser_js_["default"].Sources.protot
52014
52010
  configurable: true,
52015
52011
  value (sourceType) {
52016
52012
  const originalSource = this._get(sourceType);
52017
- if (originalSource) return JsSource.__from_binding(originalSource);
52013
+ if (originalSource) return SourceAdapter.fromBinding(originalSource);
52018
52014
  return null;
52019
52015
  }
52020
52016
  });
@@ -52265,12 +52261,12 @@ class Compilation {
52265
52261
  updateAsset(filename, newSourceOrFunction, assetInfoUpdateOrFunction) {
52266
52262
  let compatNewSourceOrFunction;
52267
52263
  compatNewSourceOrFunction = "function" == typeof newSourceOrFunction ? function(source) {
52268
- return JsSource.__to_binding(newSourceOrFunction(JsSource.__from_binding(source)));
52269
- } : JsSource.__to_binding(newSourceOrFunction);
52264
+ return SourceAdapter.toBinding(newSourceOrFunction(SourceAdapter.fromBinding(source)));
52265
+ } : SourceAdapter.toBinding(newSourceOrFunction);
52270
52266
  Compilation_class_private_field_get(this, Compilation_inner).updateAsset(filename, compatNewSourceOrFunction, assetInfoUpdateOrFunction);
52271
52267
  }
52272
52268
  emitAsset(filename, source, assetInfo) {
52273
- Compilation_class_private_field_get(this, Compilation_inner).emitAsset(filename, JsSource.__to_binding(source), assetInfo);
52269
+ Compilation_class_private_field_get(this, Compilation_inner).emitAsset(filename, SourceAdapter.toBinding(source), assetInfo);
52274
52270
  }
52275
52271
  deleteAsset(filename) {
52276
52272
  Compilation_class_private_field_get(this, Compilation_inner).deleteAsset(filename);
@@ -52477,10 +52473,10 @@ class Compilation {
52477
52473
  __internal__getAssetSource(filename) {
52478
52474
  const rawSource = Compilation_class_private_field_get(this, Compilation_inner).getAssetSource(filename);
52479
52475
  if (!rawSource) return;
52480
- return JsSource.__from_binding(rawSource);
52476
+ return SourceAdapter.fromBinding(rawSource);
52481
52477
  }
52482
52478
  __internal__setAssetSource(filename, source) {
52483
- Compilation_class_private_field_get(this, Compilation_inner).setAssetSource(filename, JsSource.__to_binding(source));
52479
+ Compilation_class_private_field_get(this, Compilation_inner).setAssetSource(filename, SourceAdapter.toBinding(source));
52484
52480
  }
52485
52481
  __internal__deleteAssetSource(filename) {
52486
52482
  Compilation_class_private_field_get(this, Compilation_inner).deleteAssetSource(filename);
@@ -53798,7 +53794,7 @@ Object.defineProperty(external_rspack_wasi_browser_js_["default"].NormalModule.p
53798
53794
  configurable: true,
53799
53795
  value () {
53800
53796
  const originalSource = this._originalSource();
53801
- if (originalSource) return JsSource.__from_binding(originalSource);
53797
+ if (originalSource) return SourceAdapter.fromBinding(originalSource);
53802
53798
  return null;
53803
53799
  }
53804
53800
  });
@@ -53806,7 +53802,7 @@ Object.defineProperty(external_rspack_wasi_browser_js_["default"].NormalModule.p
53806
53802
  enumerable: true,
53807
53803
  configurable: true,
53808
53804
  value (filename, source, assetInfo) {
53809
- return this._emitFile(filename, JsSource.__to_binding(source), assetInfo);
53805
+ return this._emitFile(filename, SourceAdapter.toBinding(source), assetInfo);
53810
53806
  }
53811
53807
  });
53812
53808
  const createFakeHook = (fakeHook, message, code)=>Object.freeze(Object.assign(message && code ? deprecateAllProperties(fakeHook, message, code) : fakeHook, {
@@ -58111,7 +58107,7 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
58111
58107
  if ("object" == typeof rspackFuture) {
58112
58108
  D(rspackFuture, "bundlerInfo", {});
58113
58109
  if ("object" == typeof rspackFuture.bundlerInfo) {
58114
- D(rspackFuture.bundlerInfo, "version", "1.6.0-canary-bf68c45d-20251028142310");
58110
+ D(rspackFuture.bundlerInfo, "version", "1.6.0-canary-505c7433-20251028174050");
58115
58111
  D(rspackFuture.bundlerInfo, "bundler", "rspack");
58116
58112
  D(rspackFuture.bundlerInfo, "force", !library);
58117
58113
  }
@@ -60688,7 +60684,7 @@ Object.defineProperty(external_rspack_wasi_browser_js_["default"].Module.prototy
60688
60684
  configurable: true,
60689
60685
  value () {
60690
60686
  const originalSource = this._originalSource();
60691
- if (originalSource) return JsSource.__from_binding(originalSource);
60687
+ if (originalSource) return SourceAdapter.fromBinding(originalSource);
60692
60688
  return null;
60693
60689
  }
60694
60690
  });
@@ -60696,7 +60692,7 @@ Object.defineProperty(external_rspack_wasi_browser_js_["default"].Module.prototy
60696
60692
  enumerable: true,
60697
60693
  configurable: true,
60698
60694
  value (filename, source, assetInfo) {
60699
- return this._emitFile(filename, JsSource.__to_binding(source), assetInfo);
60695
+ return this._emitFile(filename, SourceAdapter.toBinding(source), assetInfo);
60700
60696
  }
60701
60697
  });
60702
60698
  const createContextModuleFactoryHooksRegisters = (getCompiler, createTap)=>({
@@ -62051,7 +62047,7 @@ class MultiStats {
62051
62047
  return obj;
62052
62048
  });
62053
62049
  if (childOptions.version) {
62054
- obj.rspackVersion = "1.6.0-canary-bf68c45d-20251028142310";
62050
+ obj.rspackVersion = "1.6.0-canary-505c7433-20251028174050";
62055
62051
  obj.version = "5.75.0";
62056
62052
  }
62057
62053
  if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join("");
@@ -63356,7 +63352,7 @@ const SIMPLE_EXTRACTORS = {
63356
63352
  },
63357
63353
  version: (object)=>{
63358
63354
  object.version = "5.75.0";
63359
- object.rspackVersion = "1.6.0-canary-bf68c45d-20251028142310";
63355
+ object.rspackVersion = "1.6.0-canary-505c7433-20251028174050";
63360
63356
  },
63361
63357
  env: (object, _compilation, _context, { _env })=>{
63362
63358
  object.env = _env;
@@ -65093,7 +65089,7 @@ Object.defineProperty(external_rspack_wasi_browser_js_["default"].ConcatenatedMo
65093
65089
  configurable: true,
65094
65090
  value () {
65095
65091
  const originalSource = this._originalSource();
65096
- if (originalSource) return JsSource.__from_binding(originalSource);
65092
+ if (originalSource) return SourceAdapter.fromBinding(originalSource);
65097
65093
  return null;
65098
65094
  }
65099
65095
  });
@@ -65101,7 +65097,7 @@ Object.defineProperty(external_rspack_wasi_browser_js_["default"].ConcatenatedMo
65101
65097
  enumerable: true,
65102
65098
  configurable: true,
65103
65099
  value (filename, source, assetInfo) {
65104
- return this._emitFile(filename, JsSource.__to_binding(source), assetInfo);
65100
+ return this._emitFile(filename, SourceAdapter.toBinding(source), assetInfo);
65105
65101
  }
65106
65102
  });
65107
65103
  Object.defineProperty(external_rspack_wasi_browser_js_["default"].ContextModule.prototype, "identifier", {
@@ -65116,7 +65112,7 @@ Object.defineProperty(external_rspack_wasi_browser_js_["default"].ContextModule.
65116
65112
  configurable: true,
65117
65113
  value () {
65118
65114
  const originalSource = this._originalSource();
65119
- if (originalSource) return JsSource.__from_binding(originalSource);
65115
+ if (originalSource) return SourceAdapter.fromBinding(originalSource);
65120
65116
  return null;
65121
65117
  }
65122
65118
  });
@@ -65124,7 +65120,7 @@ Object.defineProperty(external_rspack_wasi_browser_js_["default"].ContextModule.
65124
65120
  enumerable: true,
65125
65121
  configurable: true,
65126
65122
  value (filename, source, assetInfo) {
65127
- return this._emitFile(filename, JsSource.__to_binding(source), assetInfo);
65123
+ return this._emitFile(filename, SourceAdapter.toBinding(source), assetInfo);
65128
65124
  }
65129
65125
  });
65130
65126
  Object.defineProperty(external_rspack_wasi_browser_js_["default"].ExternalModule.prototype, "identifier", {
@@ -65139,7 +65135,7 @@ Object.defineProperty(external_rspack_wasi_browser_js_["default"].ExternalModule
65139
65135
  configurable: true,
65140
65136
  value () {
65141
65137
  const originalSource = this._originalSource();
65142
- if (originalSource) return JsSource.__from_binding(originalSource);
65138
+ if (originalSource) return SourceAdapter.fromBinding(originalSource);
65143
65139
  return null;
65144
65140
  }
65145
65141
  });
@@ -65147,7 +65143,7 @@ Object.defineProperty(external_rspack_wasi_browser_js_["default"].ExternalModule
65147
65143
  enumerable: true,
65148
65144
  configurable: true,
65149
65145
  value (filename, source, assetInfo) {
65150
- return this._emitFile(filename, JsSource.__to_binding(source), assetInfo);
65146
+ return this._emitFile(filename, SourceAdapter.toBinding(source), assetInfo);
65151
65147
  }
65152
65148
  });
65153
65149
  const asRegExp = (test)=>{
@@ -66322,7 +66318,7 @@ function transformSync(source, options) {
66322
66318
  const _options = JSON.stringify(options || {});
66323
66319
  return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
66324
66320
  }
66325
- const exports_rspackVersion = "1.6.0-canary-bf68c45d-20251028142310";
66321
+ const exports_rspackVersion = "1.6.0-canary-505c7433-20251028174050";
66326
66322
  const exports_version = "5.75.0";
66327
66323
  const exports_WebpackError = Error;
66328
66324
  const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
@@ -90,6 +90,11 @@ export interface RspackError extends Error {
90
90
  }
91
91
 
92
92
  export type DependencyLocation = SyntheticDependencyLocation | RealDependencyLocation;
93
+
94
+ export interface JsSource {
95
+ source: string | Buffer
96
+ map?: string
97
+ }
93
98
  /* -- banner.d.ts end -- */
94
99
 
95
100
  /* -- napi-rs generated below -- */
@@ -180,24 +185,24 @@ export declare class ConcatenatedModule {
180
185
  get rootModule(): Module
181
186
  get modules(): Module[]
182
187
  readableIdentifier(): string
183
- _originalSource(): JsCompatSource | undefined
188
+ _originalSource(): JsSource
184
189
  nameForCondition(): string | undefined
185
190
  get blocks(): AsyncDependenciesBlock[]
186
191
  get dependencies(): Dependency[]
187
192
  size(ty?: string | undefined | null): number
188
193
  libIdent(options: JsLibIdentOptions): string | null
189
- _emitFile(filename: string, source: JsCompatSource, assetInfo?: AssetInfo | undefined | null): void
194
+ _emitFile(filename: string, source: JsSource, assetInfo?: AssetInfo | undefined | null): void
190
195
  }
191
196
 
192
197
  export declare class ContextModule {
193
198
  readableIdentifier(): string
194
- _originalSource(): JsCompatSource | undefined
199
+ _originalSource(): JsSource
195
200
  nameForCondition(): string | undefined
196
201
  get blocks(): AsyncDependenciesBlock[]
197
202
  get dependencies(): Dependency[]
198
203
  size(ty?: string | undefined | null): number
199
204
  libIdent(options: JsLibIdentOptions): string | null
200
- _emitFile(filename: string, source: JsCompatSource, assetInfo?: AssetInfo | undefined | null): void
205
+ _emitFile(filename: string, source: JsSource, assetInfo?: AssetInfo | undefined | null): void
201
206
  }
202
207
 
203
208
  export declare class Dependency {
@@ -254,20 +259,20 @@ export type EntryOptionsDTO = EntryOptionsDto
254
259
 
255
260
  export declare class ExternalModule {
256
261
  readableIdentifier(): string
257
- _originalSource(): JsCompatSource | undefined
262
+ _originalSource(): JsSource
258
263
  nameForCondition(): string | undefined
259
264
  get blocks(): AsyncDependenciesBlock[]
260
265
  get dependencies(): Dependency[]
261
266
  size(ty?: string | undefined | null): number
262
267
  libIdent(options: JsLibIdentOptions): string | null
263
- _emitFile(filename: string, source: JsCompatSource, assetInfo?: AssetInfo | undefined | null): void
268
+ _emitFile(filename: string, source: JsSource, assetInfo?: AssetInfo | undefined | null): void
264
269
  }
265
270
 
266
271
  export declare class JsCompilation {
267
- updateAsset(filename: string, newSourceOrFunction: JsCompatSource | ((source: JsCompatSourceOwned) => JsCompatSourceOwned), assetInfoUpdateOrFunction?: AssetInfo | ((assetInfo: AssetInfo) => AssetInfo | undefined)): void
272
+ updateAsset(filename: string, newSourceOrFunction: JsSource | ((source: JsSource) => JsSource), assetInfoUpdateOrFunction?: AssetInfo | ((assetInfo: AssetInfo) => AssetInfo | undefined)): void
268
273
  getAssets(): Readonly<JsAsset>[]
269
274
  getAsset(name: string): JsAsset | null
270
- getAssetSource(name: string): JsCompatSource | null
275
+ getAssetSource(name: string): JsSource | null
271
276
  get modules(): Array<Module>
272
277
  get builtModules(): Array<Module>
273
278
  getOptimizationBailout(): Array<JsStatsOptimizationBailout>
@@ -276,11 +281,11 @@ export declare class JsCompilation {
276
281
  getNamedChunk(name: string): Chunk
277
282
  getNamedChunkGroupKeys(): Array<string>
278
283
  getNamedChunkGroup(name: string): ChunkGroup
279
- setAssetSource(name: string, source: JsCompatSource): void
284
+ setAssetSource(name: string, source: JsSource): void
280
285
  deleteAssetSource(name: string): void
281
286
  getAssetFilenames(): Array<string>
282
287
  hasAsset(name: string): boolean
283
- emitAsset(filename: string, source: JsCompatSource, assetInfo?: AssetInfo | undefined | null): void
288
+ emitAsset(filename: string, source: JsSource, assetInfo?: AssetInfo | undefined | null): void
284
289
  deleteAsset(filename: string): void
285
290
  renameAsset(filename: string, newName: string): void
286
291
  get entrypoints(): ChunkGroup[]
@@ -425,13 +430,13 @@ export declare class KnownBuildInfo {
425
430
 
426
431
  export declare class Module {
427
432
  readableIdentifier(): string
428
- _originalSource(): JsCompatSource | undefined
433
+ _originalSource(): JsSource
429
434
  nameForCondition(): string | undefined
430
435
  get blocks(): AsyncDependenciesBlock[]
431
436
  get dependencies(): Dependency[]
432
437
  size(ty?: string | undefined | null): number
433
438
  libIdent(options: JsLibIdentOptions): string | null
434
- _emitFile(filename: string, source: JsCompatSource, assetInfo?: AssetInfo | undefined | null): void
439
+ _emitFile(filename: string, source: JsSource, assetInfo?: AssetInfo | undefined | null): void
435
440
  }
436
441
 
437
442
  export declare class ModuleGraphConnection {
@@ -486,7 +491,7 @@ export declare class ResolverFactory {
486
491
  }
487
492
 
488
493
  export declare class Sources {
489
- _get(sourceType: string): JsCompatSourceOwned | null
494
+ _get(sourceType: string): JsSource | null
490
495
  }
491
496
 
492
497
  export declare class VirtualFileStore {
@@ -760,23 +765,6 @@ export interface JsCodegenerationResults {
760
765
  map: Record<string, Record<string, JsCodegenerationResult>>
761
766
  }
762
767
 
763
- /**
764
- * Zero copy `JsCompatSource` slice shared between Rust and Node.js if buffer is used.
765
- *
766
- * It can only be used in non-async context and the lifetime is bound to the fn closure.
767
- *
768
- * If you want to use Node.js Buffer in async context or want to extend the lifetime, use `JsCompatSourceOwned` instead.
769
- */
770
- export interface JsCompatSource {
771
- source: string | Buffer
772
- map?: string
773
- }
774
-
775
- export interface JsCompatSourceOwned {
776
- source: string | Buffer
777
- map?: string
778
- }
779
-
780
768
  export interface JsCreateData {
781
769
  request: string
782
770
  userRequest: string
@@ -1206,7 +1194,7 @@ export interface JsRuntimeGlobals {
1206
1194
  }
1207
1195
 
1208
1196
  export interface JsRuntimeModule {
1209
- source?: JsCompatSourceOwned
1197
+ source?: JsSource
1210
1198
  moduleIdentifier: string
1211
1199
  constructorName: string
1212
1200
  name: string
@@ -1227,6 +1215,23 @@ export interface JsRuntimeRequirementInTreeResult {
1227
1215
  allRuntimeRequirements: JsRuntimeGlobals
1228
1216
  }
1229
1217
 
1218
+ /**
1219
+ * Zero copy `JsSourceFromJs` slice shared between Rust and Node.js if buffer is used.
1220
+ *
1221
+ * It can only be used in non-async context and the lifetime is bound to the fn closure.
1222
+ *
1223
+ * If you want to use Node.js Buffer in async context or want to extend the lifetime, use `JsSourceToJs` instead.
1224
+ */
1225
+ export interface JsSourceFromJs {
1226
+ source: string | Buffer
1227
+ map?: string
1228
+ }
1229
+
1230
+ export interface JsSourceToJs {
1231
+ source: string | Buffer
1232
+ map?: string
1233
+ }
1234
+
1230
1235
  export interface JsStatsAsset {
1231
1236
  type: string
1232
1237
  name: string
Binary file
@@ -1,7 +1,6 @@
1
- import type { JsCompatSourceOwned } from "../binding";
2
- import { Source } from "webpack-sources";
3
- declare class JsSource extends Source {
4
- static __from_binding(source: JsCompatSourceOwned): Source;
5
- static __to_binding(source: Source): JsCompatSourceOwned;
1
+ import type { JsSource } from "../binding";
2
+ import { type Source } from "webpack-sources";
3
+ export declare class SourceAdapter {
4
+ static fromBinding(source: JsSource): Source;
5
+ static toBinding(source: Source): JsSource;
6
6
  }
7
- export { JsSource };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack-canary/browser",
3
- "version": "1.6.0-canary-bf68c45d-20251028142310",
3
+ "version": "1.6.0-canary-505c7433-20251028174050",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "Rspack for running in the browser. This is still in early stage and may not follow the semver.",