@rspack-canary/browser 1.6.0-canary-cf832f72-20251028084837 → 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/config/types.d.ts +25 -1
- package/dist/index.mjs +15801 -168
- package/dist/index.mjs.LICENSE.txt +9 -0
- package/dist/napi-binding.d.ts +36 -31
- package/dist/rspack.wasi-browser.js +122 -101
- package/dist/rspack.wasm32-wasi.wasm +0 -0
- package/dist/util/source.d.ts +5 -6
- package/dist/wasi-worker-browser.mjs +23563 -6
- package/dist/wasi-worker-browser.mjs.LICENSE.txt +12 -0
- package/package.json +2 -1
|
@@ -5,6 +5,15 @@
|
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
/*!
|
|
9
|
+
* The buffer module from node.js, for the browser.
|
|
10
|
+
*
|
|
11
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
12
|
+
* @license MIT
|
|
13
|
+
*/
|
|
14
|
+
|
|
8
15
|
/*! https://mths.be/punycode v1.4.1 by @mathias */
|
|
9
16
|
|
|
17
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
18
|
+
|
|
10
19
|
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
package/dist/napi-binding.d.ts
CHANGED
|
@@ -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():
|
|
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:
|
|
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():
|
|
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:
|
|
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():
|
|
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:
|
|
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:
|
|
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):
|
|
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:
|
|
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:
|
|
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():
|
|
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:
|
|
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):
|
|
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?:
|
|
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
|
|
@@ -1,104 +1,125 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
createOnMessage as __wasmCreateOnMessageForFsProxy,
|
|
3
|
+
getDefaultContext as __emnapiGetDefaultContext,
|
|
4
|
+
instantiateNapiModule as __emnapiInstantiateNapiModule,
|
|
5
|
+
WASI as __WASI,
|
|
6
|
+
} from '@napi-rs/wasm-runtime'
|
|
7
|
+
import { memfs, Buffer } from '@napi-rs/wasm-runtime/fs'
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export const { fs: __fs, vol: __volume } = memfs()
|
|
11
|
+
|
|
4
12
|
const __wasi = new __WASI({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
__emnapiContext
|
|
13
|
+
version: 'preview1',
|
|
14
|
+
fs: __fs,
|
|
15
|
+
preopens: {
|
|
16
|
+
'/': '/',
|
|
17
|
+
},
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const __wasmUrl = window.RSPACK_WASM_URL || new URL('./rspack.wasm32-wasi.wasm', import.meta.url).href
|
|
21
|
+
const __emnapiContext = __emnapiGetDefaultContext()
|
|
22
|
+
__emnapiContext.feature.Buffer = Buffer
|
|
23
|
+
|
|
14
24
|
const __sharedMemory = new WebAssembly.Memory({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
25
|
+
initial: 16384,
|
|
26
|
+
maximum: 65536,
|
|
27
|
+
shared: true,
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
const __wasmFile = await fetch(__wasmUrl).then((res) => res.arrayBuffer())
|
|
31
|
+
|
|
32
|
+
const {
|
|
33
|
+
instance: __napiInstance,
|
|
34
|
+
module: __wasiModule,
|
|
35
|
+
napiModule: __napiModule,
|
|
36
|
+
} = await __emnapiInstantiateNapiModule(__wasmFile, {
|
|
37
|
+
context: __emnapiContext,
|
|
38
|
+
asyncWorkPoolSize: 4,
|
|
39
|
+
wasi: __wasi,
|
|
40
|
+
onCreateWorker() {
|
|
41
|
+
const worker = new Worker(URL.createObjectURL(new Blob([`importScripts("${new URL('./wasi-worker-browser.mjs', import.meta.url)}")`], { type: 'text/javascript' })), {
|
|
42
|
+
type: 'classic',
|
|
43
|
+
})
|
|
44
|
+
worker.addEventListener('message', __wasmCreateOnMessageForFsProxy(__fs))
|
|
45
|
+
|
|
46
|
+
return worker
|
|
47
|
+
},
|
|
48
|
+
overwriteImports(importObject) {
|
|
49
|
+
importObject.env = {
|
|
50
|
+
...importObject.env,
|
|
51
|
+
...importObject.napi,
|
|
52
|
+
...importObject.emnapi,
|
|
53
|
+
memory: __sharedMemory,
|
|
54
|
+
}
|
|
55
|
+
return importObject
|
|
56
|
+
},
|
|
57
|
+
beforeInit({ instance }) {
|
|
58
|
+
for (const name of Object.keys(instance.exports)) {
|
|
59
|
+
if (name.startsWith('__napi_register__')) {
|
|
60
|
+
instance.exports[name]()
|
|
61
|
+
}
|
|
42
62
|
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export
|
|
46
|
-
export const
|
|
47
|
-
export const
|
|
48
|
-
export const
|
|
49
|
-
export const
|
|
50
|
-
export const
|
|
51
|
-
export const
|
|
52
|
-
export const
|
|
53
|
-
export const
|
|
54
|
-
export const
|
|
55
|
-
export const
|
|
56
|
-
export const
|
|
57
|
-
export const
|
|
58
|
-
export const
|
|
59
|
-
export const
|
|
60
|
-
export const
|
|
61
|
-
export const
|
|
62
|
-
export const
|
|
63
|
-
export const
|
|
64
|
-
export const
|
|
65
|
-
export const
|
|
66
|
-
export const
|
|
67
|
-
export const
|
|
68
|
-
export const
|
|
69
|
-
export const
|
|
70
|
-
export const
|
|
71
|
-
export const
|
|
72
|
-
export const
|
|
73
|
-
export const
|
|
74
|
-
export const
|
|
75
|
-
export const
|
|
76
|
-
export const
|
|
77
|
-
export const
|
|
78
|
-
export const
|
|
79
|
-
export const
|
|
80
|
-
export const
|
|
81
|
-
export const
|
|
82
|
-
export const
|
|
83
|
-
export const
|
|
84
|
-
export const
|
|
85
|
-
export const
|
|
86
|
-
export const
|
|
87
|
-
export const
|
|
88
|
-
export const
|
|
89
|
-
export const
|
|
90
|
-
export const
|
|
91
|
-
export const
|
|
92
|
-
export const
|
|
93
|
-
export const
|
|
94
|
-
export const
|
|
95
|
-
export const
|
|
96
|
-
export const
|
|
97
|
-
export const
|
|
98
|
-
export const
|
|
99
|
-
export const
|
|
100
|
-
export const
|
|
101
|
-
export const
|
|
102
|
-
export const
|
|
103
|
-
export const
|
|
104
|
-
export const
|
|
63
|
+
},
|
|
64
|
+
})
|
|
65
|
+
export default __napiModule.exports
|
|
66
|
+
export const Assets = __napiModule.exports.Assets
|
|
67
|
+
export const AsyncDependenciesBlock = __napiModule.exports.AsyncDependenciesBlock
|
|
68
|
+
export const Chunk = __napiModule.exports.Chunk
|
|
69
|
+
export const ChunkGraph = __napiModule.exports.ChunkGraph
|
|
70
|
+
export const ChunkGroup = __napiModule.exports.ChunkGroup
|
|
71
|
+
export const Chunks = __napiModule.exports.Chunks
|
|
72
|
+
export const CodeGenerationResult = __napiModule.exports.CodeGenerationResult
|
|
73
|
+
export const CodeGenerationResults = __napiModule.exports.CodeGenerationResults
|
|
74
|
+
export const ConcatenatedModule = __napiModule.exports.ConcatenatedModule
|
|
75
|
+
export const ContextModule = __napiModule.exports.ContextModule
|
|
76
|
+
export const Dependency = __napiModule.exports.Dependency
|
|
77
|
+
export const Diagnostics = __napiModule.exports.Diagnostics
|
|
78
|
+
export const EntryDataDto = __napiModule.exports.EntryDataDto
|
|
79
|
+
export const EntryDataDTO = __napiModule.exports.EntryDataDTO
|
|
80
|
+
export const EntryDependency = __napiModule.exports.EntryDependency
|
|
81
|
+
export const EntryOptionsDto = __napiModule.exports.EntryOptionsDto
|
|
82
|
+
export const EntryOptionsDTO = __napiModule.exports.EntryOptionsDTO
|
|
83
|
+
export const ExternalModule = __napiModule.exports.ExternalModule
|
|
84
|
+
export const JsCompilation = __napiModule.exports.JsCompilation
|
|
85
|
+
export const JsCompiler = __napiModule.exports.JsCompiler
|
|
86
|
+
export const JsContextModuleFactoryAfterResolveData = __napiModule.exports.JsContextModuleFactoryAfterResolveData
|
|
87
|
+
export const JsContextModuleFactoryBeforeResolveData = __napiModule.exports.JsContextModuleFactoryBeforeResolveData
|
|
88
|
+
export const JsDependencies = __napiModule.exports.JsDependencies
|
|
89
|
+
export const JsEntries = __napiModule.exports.JsEntries
|
|
90
|
+
export const JsExportsInfo = __napiModule.exports.JsExportsInfo
|
|
91
|
+
export const JsModuleGraph = __napiModule.exports.JsModuleGraph
|
|
92
|
+
export const JsResolver = __napiModule.exports.JsResolver
|
|
93
|
+
export const JsResolverFactory = __napiModule.exports.JsResolverFactory
|
|
94
|
+
export const JsStats = __napiModule.exports.JsStats
|
|
95
|
+
export const KnownBuildInfo = __napiModule.exports.KnownBuildInfo
|
|
96
|
+
export const Module = __napiModule.exports.Module
|
|
97
|
+
export const ModuleGraphConnection = __napiModule.exports.ModuleGraphConnection
|
|
98
|
+
export const NativeWatcher = __napiModule.exports.NativeWatcher
|
|
99
|
+
export const NativeWatchResult = __napiModule.exports.NativeWatchResult
|
|
100
|
+
export const NormalModule = __napiModule.exports.NormalModule
|
|
101
|
+
export const RawExternalItemFnCtx = __napiModule.exports.RawExternalItemFnCtx
|
|
102
|
+
export const ReadonlyResourceData = __napiModule.exports.ReadonlyResourceData
|
|
103
|
+
export const ResolverFactory = __napiModule.exports.ResolverFactory
|
|
104
|
+
export const Sources = __napiModule.exports.Sources
|
|
105
|
+
export const VirtualFileStore = __napiModule.exports.VirtualFileStore
|
|
106
|
+
export const JsVirtualFileStore = __napiModule.exports.JsVirtualFileStore
|
|
107
|
+
export const async = __napiModule.exports.async
|
|
108
|
+
export const BuiltinPluginName = __napiModule.exports.BuiltinPluginName
|
|
109
|
+
export const cleanupGlobalTrace = __napiModule.exports.cleanupGlobalTrace
|
|
110
|
+
export const EnforceExtension = __napiModule.exports.EnforceExtension
|
|
111
|
+
export const EXPECTED_RSPACK_CORE_VERSION = __napiModule.exports.EXPECTED_RSPACK_CORE_VERSION
|
|
112
|
+
export const formatDiagnostic = __napiModule.exports.formatDiagnostic
|
|
113
|
+
export const JsLoaderState = __napiModule.exports.JsLoaderState
|
|
114
|
+
export const JsRspackSeverity = __napiModule.exports.JsRspackSeverity
|
|
115
|
+
export const loadBrowserslist = __napiModule.exports.loadBrowserslist
|
|
116
|
+
export const minify = __napiModule.exports.minify
|
|
117
|
+
export const minifySync = __napiModule.exports.minifySync
|
|
118
|
+
export const RawJavascriptParserCommonjsExports = __napiModule.exports.RawJavascriptParserCommonjsExports
|
|
119
|
+
export const RawRuleSetConditionType = __napiModule.exports.RawRuleSetConditionType
|
|
120
|
+
export const registerGlobalTrace = __napiModule.exports.registerGlobalTrace
|
|
121
|
+
export const RegisterJsTapKind = __napiModule.exports.RegisterJsTapKind
|
|
122
|
+
export const sync = __napiModule.exports.sync
|
|
123
|
+
export const syncTraceEvent = __napiModule.exports.syncTraceEvent
|
|
124
|
+
export const transform = __napiModule.exports.transform
|
|
125
|
+
export const transformSync = __napiModule.exports.transformSync
|
|
Binary file
|
package/dist/util/source.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { Source } from "webpack-sources";
|
|
3
|
-
declare class
|
|
4
|
-
static
|
|
5
|
-
static
|
|
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 };
|