@rspack/binding 1.2.7 → 1.3.0-beta.0
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/binding.d.ts +146 -67
- package/binding.js +19 -0
- package/package.json +38 -13
package/binding.d.ts
CHANGED
|
@@ -8,9 +8,48 @@ export type JsFilename =
|
|
|
8
8
|
|
|
9
9
|
export type LocalJsFilename = JsFilename;
|
|
10
10
|
|
|
11
|
-
export type RawLazyCompilationTest = RegExp | ((
|
|
11
|
+
export type RawLazyCompilationTest = RegExp | ((module: Module) => boolean);
|
|
12
12
|
|
|
13
13
|
export type AssetInfo = KnownAssetInfo & Record<string, any>;
|
|
14
|
+
|
|
15
|
+
export interface Module {
|
|
16
|
+
readonly type: string;
|
|
17
|
+
get context(): string | undefined;
|
|
18
|
+
get layer(): string | undefined;
|
|
19
|
+
get factoryMeta(): JsFactoryMeta | undefined
|
|
20
|
+
get useSourceMap(): boolean;
|
|
21
|
+
get useSimpleSourceMap(): boolean;
|
|
22
|
+
buildInfo: Record<string, any>;
|
|
23
|
+
buildMeta: Record<string, any>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface NormalModuleConstructor {
|
|
27
|
+
new (): NormalModule;
|
|
28
|
+
readonly prototype: NormalModule;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export var NormalModule: NormalModuleConstructor;
|
|
32
|
+
|
|
33
|
+
export interface NormalModule extends Module {
|
|
34
|
+
get resource(): string | undefined;
|
|
35
|
+
get request(): string | undefined
|
|
36
|
+
get userRequest(): string | undefined
|
|
37
|
+
set userRequest(val: string | undefined)
|
|
38
|
+
get rawRequest(): string | undefined
|
|
39
|
+
get loaders(): Array<JsLoaderItem> | undefined
|
|
40
|
+
get resourceResolveData(): JsResourceData | undefined
|
|
41
|
+
get matchResource(): string | undefined
|
|
42
|
+
set matchResource(val: string | undefined)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface ConcatenatedModule extends Module {
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface ContextModule extends Module {
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface ExternalModule extends Module {
|
|
52
|
+
}
|
|
14
53
|
/* -- banner.d.ts end -- */
|
|
15
54
|
|
|
16
55
|
/* -- napi-rs generated below -- */
|
|
@@ -21,6 +60,34 @@ export declare class ExternalObject<T> {
|
|
|
21
60
|
[K: symbol]: T
|
|
22
61
|
}
|
|
23
62
|
}
|
|
63
|
+
export declare class AsyncDependenciesBlock {
|
|
64
|
+
get dependencies(): Dependency[]
|
|
65
|
+
get blocks(): AsyncDependenciesBlock[]
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export declare class ConcatenatedModule {
|
|
69
|
+
get modules(): Module[] | undefined
|
|
70
|
+
_originalSource(): JsCompatSource | undefined
|
|
71
|
+
identifier(): string
|
|
72
|
+
nameForCondition(): string | undefined
|
|
73
|
+
get blocks(): AsyncDependenciesBlock[]
|
|
74
|
+
get dependencies(): Dependency[]
|
|
75
|
+
size(ty?: string | undefined | null): number
|
|
76
|
+
libIdent(options: JsLibIdentOptions): string | null
|
|
77
|
+
_emitFile(filename: string, source: JsCompatSource, jsAssetInfo?: AssetInfo | undefined | null): void
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export declare class ContextModule {
|
|
81
|
+
_originalSource(): JsCompatSource | undefined
|
|
82
|
+
identifier(): string
|
|
83
|
+
nameForCondition(): string | undefined
|
|
84
|
+
get blocks(): AsyncDependenciesBlock[]
|
|
85
|
+
get dependencies(): Dependency[]
|
|
86
|
+
size(ty?: string | undefined | null): number
|
|
87
|
+
libIdent(options: JsLibIdentOptions): string | null
|
|
88
|
+
_emitFile(filename: string, source: JsCompatSource, jsAssetInfo?: AssetInfo | undefined | null): void
|
|
89
|
+
}
|
|
90
|
+
|
|
24
91
|
export declare class Dependency {
|
|
25
92
|
get type(): string
|
|
26
93
|
get category(): string
|
|
@@ -64,6 +131,19 @@ export declare class EntryOptionsDto {
|
|
|
64
131
|
}
|
|
65
132
|
export type EntryOptionsDTO = EntryOptionsDto
|
|
66
133
|
|
|
134
|
+
export declare class ExternalModule {
|
|
135
|
+
get userRequest(): string | undefined
|
|
136
|
+
set userRequest(val: string | undefined)
|
|
137
|
+
_originalSource(): JsCompatSource | undefined
|
|
138
|
+
identifier(): string
|
|
139
|
+
nameForCondition(): string | undefined
|
|
140
|
+
get blocks(): AsyncDependenciesBlock[]
|
|
141
|
+
get dependencies(): Dependency[]
|
|
142
|
+
size(ty?: string | undefined | null): number
|
|
143
|
+
libIdent(options: JsLibIdentOptions): string | null
|
|
144
|
+
_emitFile(filename: string, source: JsCompatSource, jsAssetInfo?: AssetInfo | undefined | null): void
|
|
145
|
+
}
|
|
146
|
+
|
|
67
147
|
export declare class JsChunk {
|
|
68
148
|
get name(): string | undefined
|
|
69
149
|
get id(): string | undefined
|
|
@@ -89,15 +169,15 @@ export declare class JsChunk {
|
|
|
89
169
|
}
|
|
90
170
|
|
|
91
171
|
export declare class JsChunkGraph {
|
|
92
|
-
getChunkModules(chunk: JsChunk):
|
|
93
|
-
getChunkEntryModules(chunk: JsChunk):
|
|
172
|
+
getChunkModules(chunk: JsChunk): Module[]
|
|
173
|
+
getChunkEntryModules(chunk: JsChunk): Module[]
|
|
94
174
|
getNumberOfEntryModules(chunk: JsChunk): number
|
|
95
175
|
getChunkEntryDependentChunksIterable(chunk: JsChunk): JsChunk[]
|
|
96
|
-
getChunkModulesIterableBySourceType(chunk: JsChunk, sourceType: string):
|
|
97
|
-
getModuleChunks(module:
|
|
98
|
-
getModuleId(
|
|
99
|
-
getModuleHash(module:
|
|
100
|
-
getBlockChunkGroup(jsBlock:
|
|
176
|
+
getChunkModulesIterableBySourceType(chunk: JsChunk, sourceType: string): Module[]
|
|
177
|
+
getModuleChunks(module: Module): JsChunk[]
|
|
178
|
+
getModuleId(module: Module): string | null
|
|
179
|
+
getModuleHash(module: Module, runtime: string | string[] | undefined): string | null
|
|
180
|
+
getBlockChunkGroup(jsBlock: AsyncDependenciesBlock): JsChunkGroup | null
|
|
101
181
|
}
|
|
102
182
|
|
|
103
183
|
export declare class JsChunkGroup {
|
|
@@ -109,9 +189,10 @@ export declare class JsChunkGroup {
|
|
|
109
189
|
isInitial(): boolean
|
|
110
190
|
getParents(): JsChunkGroup[]
|
|
111
191
|
getRuntimeChunk(): JsChunk
|
|
192
|
+
getEntrypointChunk(): JsChunk
|
|
112
193
|
getFiles(): Array<string>
|
|
113
|
-
getModulePreOrderIndex(module:
|
|
114
|
-
getModulePostOrderIndex(module:
|
|
194
|
+
getModulePreOrderIndex(module: Module): number | null
|
|
195
|
+
getModulePostOrderIndex(module: Module): number | null
|
|
115
196
|
}
|
|
116
197
|
|
|
117
198
|
export declare class JsCompilation {
|
|
@@ -119,8 +200,8 @@ export declare class JsCompilation {
|
|
|
119
200
|
getAssets(): Readonly<JsAsset>[]
|
|
120
201
|
getAsset(name: string): JsAsset | null
|
|
121
202
|
getAssetSource(name: string): JsCompatSource | null
|
|
122
|
-
get modules(): Array<
|
|
123
|
-
get builtModules(): Array<
|
|
203
|
+
get modules(): Array<Module>
|
|
204
|
+
get builtModules(): Array<Module>
|
|
124
205
|
getOptimizationBailout(): Array<JsStatsOptimizationBailout>
|
|
125
206
|
getChunks(): JsChunk[]
|
|
126
207
|
getNamedChunkKeys(): Array<string>
|
|
@@ -164,7 +245,7 @@ export declare class JsCompilation {
|
|
|
164
245
|
addRuntimeModule(chunk: JsChunk, runtimeModule: JsAddingRuntimeModule): void
|
|
165
246
|
get moduleGraph(): JsModuleGraph
|
|
166
247
|
get chunkGraph(): JsChunkGraph
|
|
167
|
-
addInclude(args: [string, EntryDependency, JsEntryOptions | undefined][], callback: (errMsg: Error | null, results: [string | null,
|
|
248
|
+
addInclude(args: [string, EntryDependency, JsEntryOptions | undefined][], callback: (errMsg: Error | null, results: [string | null, Module][]) => void): void
|
|
168
249
|
}
|
|
169
250
|
|
|
170
251
|
export declare class JsCompiler {
|
|
@@ -216,11 +297,6 @@ export declare class JsDependencies {
|
|
|
216
297
|
get removedBuildDependencies(): Array<string>
|
|
217
298
|
}
|
|
218
299
|
|
|
219
|
-
export declare class JsDependenciesBlock {
|
|
220
|
-
get dependencies(): Dependency[]
|
|
221
|
-
get blocks(): JsDependenciesBlock[]
|
|
222
|
-
}
|
|
223
|
-
|
|
224
300
|
export declare class JsEntries {
|
|
225
301
|
clear(): void
|
|
226
302
|
get size(): number
|
|
@@ -239,54 +315,30 @@ export declare class JsExportsInfo {
|
|
|
239
315
|
getUsed(name: string | string[], runtime: string | string[] | undefined): 0 | 1 | 2 | 3 | 4
|
|
240
316
|
}
|
|
241
317
|
|
|
242
|
-
export declare class JsModule {
|
|
243
|
-
get context(): string | undefined
|
|
244
|
-
get originalSource(): JsCompatSource | undefined
|
|
245
|
-
get resource(): string | undefined
|
|
246
|
-
get moduleIdentifier(): string
|
|
247
|
-
get nameForCondition(): string | undefined
|
|
248
|
-
get request(): string | undefined
|
|
249
|
-
get userRequest(): string | undefined
|
|
250
|
-
set userRequest(val: string | undefined)
|
|
251
|
-
get rawRequest(): string | undefined
|
|
252
|
-
get factoryMeta(): JsFactoryMeta | undefined
|
|
253
|
-
get type(): string
|
|
254
|
-
get layer(): string | undefined
|
|
255
|
-
get blocks(): JsDependenciesBlock[]
|
|
256
|
-
get dependencies(): Dependency[]
|
|
257
|
-
size(ty?: string | undefined | null): number
|
|
258
|
-
get modules(): JsModule[] | undefined
|
|
259
|
-
get useSourceMap(): boolean
|
|
260
|
-
libIdent(options: JsLibIdentOptions): string | null
|
|
261
|
-
get resourceResolveData(): JsResourceData | undefined
|
|
262
|
-
get matchResource(): string | undefined
|
|
263
|
-
emitFile(filename: string, source: JsCompatSource, jsAssetInfo?: AssetInfo | undefined | null): void
|
|
264
|
-
}
|
|
265
|
-
|
|
266
318
|
export declare class JsModuleGraph {
|
|
267
|
-
getModule(dependency: Dependency):
|
|
268
|
-
getResolvedModule(dependency: Dependency):
|
|
269
|
-
getUsedExports(
|
|
270
|
-
getIssuer(module:
|
|
271
|
-
getExportsInfo(module:
|
|
319
|
+
getModule(dependency: Dependency): Module | null
|
|
320
|
+
getResolvedModule(dependency: Dependency): Module | null
|
|
321
|
+
getUsedExports(module: Module, runtime: string | string[]): boolean | Array<string> | null
|
|
322
|
+
getIssuer(module: Module): Module | null
|
|
323
|
+
getExportsInfo(module: Module): JsExportsInfo
|
|
272
324
|
getConnection(dependency: Dependency): JsModuleGraphConnection | null
|
|
273
|
-
getOutgoingConnections(module:
|
|
274
|
-
getOutgoingConnectionsInOrder(module:
|
|
275
|
-
getIncomingConnections(module:
|
|
276
|
-
getParentModule(dependency: Dependency):
|
|
325
|
+
getOutgoingConnections(module: Module): JsModuleGraphConnection[]
|
|
326
|
+
getOutgoingConnectionsInOrder(module: Module): JsModuleGraphConnection[]
|
|
327
|
+
getIncomingConnections(module: Module): JsModuleGraphConnection[]
|
|
328
|
+
getParentModule(dependency: Dependency): Module | null
|
|
277
329
|
getParentBlockIndex(dependency: Dependency): number
|
|
278
|
-
isAsync(module:
|
|
330
|
+
isAsync(module: Module): boolean
|
|
279
331
|
}
|
|
280
332
|
|
|
281
333
|
export declare class JsModuleGraphConnection {
|
|
282
334
|
get dependency(): Dependency
|
|
283
|
-
get module():
|
|
284
|
-
get resolvedModule():
|
|
285
|
-
get originModule():
|
|
335
|
+
get module(): Module | null
|
|
336
|
+
get resolvedModule(): Module | null
|
|
337
|
+
get originModule(): Module | null
|
|
286
338
|
}
|
|
287
339
|
|
|
288
340
|
export declare class JsResolver {
|
|
289
|
-
resolveSync(path: string, request: string):
|
|
341
|
+
resolveSync(path: string, request: string): JsResourceData | false
|
|
290
342
|
withOptions(raw?: RawResolveOptionsWithDependencyType | undefined | null): JsResolver
|
|
291
343
|
}
|
|
292
344
|
|
|
@@ -302,6 +354,18 @@ export declare class JsStats {
|
|
|
302
354
|
getLogging(acceptedTypes: number): Array<JsStatsLogging>
|
|
303
355
|
}
|
|
304
356
|
|
|
357
|
+
export declare class Module {
|
|
358
|
+
_originalSource(): JsCompatSource | undefined
|
|
359
|
+
identifier(): string
|
|
360
|
+
nameForCondition(): string | undefined
|
|
361
|
+
get blocks(): AsyncDependenciesBlock[]
|
|
362
|
+
get dependencies(): Dependency[]
|
|
363
|
+
size(ty?: string | undefined | null): number
|
|
364
|
+
libIdent(options: JsLibIdentOptions): string | null
|
|
365
|
+
_emitFile(filename: string, source: JsCompatSource, jsAssetInfo?: AssetInfo | undefined | null): void
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
|
|
305
369
|
export declare class RawExternalItemFnCtx {
|
|
306
370
|
data(): RawExternalItemFnCtxData
|
|
307
371
|
getResolver(): JsResolver
|
|
@@ -389,10 +453,11 @@ export declare enum BuiltinPluginName {
|
|
|
389
453
|
LightningCssMinimizerRspackPlugin = 'LightningCssMinimizerRspackPlugin',
|
|
390
454
|
BundlerInfoRspackPlugin = 'BundlerInfoRspackPlugin',
|
|
391
455
|
CssExtractRspackPlugin = 'CssExtractRspackPlugin',
|
|
456
|
+
SubresourceIntegrityPlugin = 'SubresourceIntegrityPlugin',
|
|
392
457
|
RsdoctorPlugin = 'RsdoctorPlugin',
|
|
393
458
|
JsLoaderRspackPlugin = 'JsLoaderRspackPlugin',
|
|
394
459
|
LazyCompilationPlugin = 'LazyCompilationPlugin',
|
|
395
|
-
|
|
460
|
+
ModuleInfoHeaderPlugin = 'ModuleInfoHeaderPlugin'
|
|
396
461
|
}
|
|
397
462
|
|
|
398
463
|
export declare function cleanupGlobalTrace(): void
|
|
@@ -521,7 +586,7 @@ export interface JsBuildTimeExecutionOption {
|
|
|
521
586
|
}
|
|
522
587
|
|
|
523
588
|
export interface JsCacheGroupTestCtx {
|
|
524
|
-
module:
|
|
589
|
+
module: Module
|
|
525
590
|
}
|
|
526
591
|
|
|
527
592
|
export interface JsChunkAssetArgs {
|
|
@@ -530,12 +595,12 @@ export interface JsChunkAssetArgs {
|
|
|
530
595
|
}
|
|
531
596
|
|
|
532
597
|
export interface JsChunkGroupOrigin {
|
|
533
|
-
module?:
|
|
598
|
+
module?: Module | undefined
|
|
534
599
|
request?: string
|
|
535
600
|
}
|
|
536
601
|
|
|
537
602
|
export interface JsChunkOptionNameCtx {
|
|
538
|
-
module:
|
|
603
|
+
module: Module
|
|
539
604
|
chunks: JsChunk[]
|
|
540
605
|
cacheGroupKey: string
|
|
541
606
|
}
|
|
@@ -734,7 +799,7 @@ export interface JsLoaderContext {
|
|
|
734
799
|
resourceData: Readonly<JsResourceData>
|
|
735
800
|
/** Will be deprecated. Use module.module_identifier instead */
|
|
736
801
|
_moduleIdentifier: Readonly<string>
|
|
737
|
-
_module:
|
|
802
|
+
_module: Module
|
|
738
803
|
hot: Readonly<boolean>
|
|
739
804
|
/** Content maybe empty in pitching stage */
|
|
740
805
|
content: null | Buffer
|
|
@@ -754,7 +819,7 @@ export interface JsLoaderContext {
|
|
|
754
819
|
}
|
|
755
820
|
|
|
756
821
|
export interface JsLoaderItem {
|
|
757
|
-
|
|
822
|
+
loader: string
|
|
758
823
|
type: string
|
|
759
824
|
data: any
|
|
760
825
|
normalExecuted: boolean
|
|
@@ -823,6 +888,8 @@ export interface JsResourceData {
|
|
|
823
888
|
query?: string
|
|
824
889
|
/** Resource fragment with `#` prefix */
|
|
825
890
|
fragment?: string
|
|
891
|
+
descriptionFileData?: any
|
|
892
|
+
descriptionFilePath?: string
|
|
826
893
|
}
|
|
827
894
|
|
|
828
895
|
export interface JsRsdoctorAsset {
|
|
@@ -1336,7 +1403,7 @@ export interface RawAliasOptionItem {
|
|
|
1336
1403
|
|
|
1337
1404
|
export interface RawAssetGeneratorDataUrlFnCtx {
|
|
1338
1405
|
filename: string
|
|
1339
|
-
module:
|
|
1406
|
+
module: Module
|
|
1340
1407
|
}
|
|
1341
1408
|
|
|
1342
1409
|
export interface RawAssetGeneratorDataUrlOptions {
|
|
@@ -1484,6 +1551,13 @@ export interface RawCopyPattern {
|
|
|
1484
1551
|
priority: number
|
|
1485
1552
|
globOptions: RawCopyGlobOptions
|
|
1486
1553
|
info?: RawInfo
|
|
1554
|
+
/**
|
|
1555
|
+
* Determines whether to copy file permissions from the source to the destination.
|
|
1556
|
+
* When set to true, the plugin will preserve executable permissions and other file modes.
|
|
1557
|
+
* This is particularly useful when copying scripts or executable files.
|
|
1558
|
+
* @default false
|
|
1559
|
+
*/
|
|
1560
|
+
copyPermissions?: boolean
|
|
1487
1561
|
transform?: (input: Buffer, absoluteFilename: string) => string | Buffer | Promise<string> | Promise<Buffer>
|
|
1488
1562
|
}
|
|
1489
1563
|
|
|
@@ -1682,13 +1756,14 @@ export interface RawFuncUseCtx {
|
|
|
1682
1756
|
}
|
|
1683
1757
|
|
|
1684
1758
|
export interface RawGeneratorOptions {
|
|
1685
|
-
type: "asset" | "asset/inline" | "asset/resource" | "css" | "css/auto" | "css/module"
|
|
1759
|
+
type: "asset" | "asset/inline" | "asset/resource" | "css" | "css/auto" | "css/module" | "json"
|
|
1686
1760
|
asset?: RawAssetGeneratorOptions
|
|
1687
1761
|
assetInline?: RawAssetInlineGeneratorOptions
|
|
1688
1762
|
assetResource?: RawAssetResourceGeneratorOptions
|
|
1689
1763
|
css?: RawCssGeneratorOptions
|
|
1690
1764
|
cssAuto?: RawCssAutoGeneratorOptions
|
|
1691
1765
|
cssModule?: RawCssModuleGeneratorOptions
|
|
1766
|
+
json?: RawJsonGeneratorOptions
|
|
1692
1767
|
}
|
|
1693
1768
|
|
|
1694
1769
|
export interface RawHtmlRspackPluginBaseOptions {
|
|
@@ -1810,6 +1885,10 @@ export interface RawJavascriptParserOptions {
|
|
|
1810
1885
|
importDynamic?: boolean
|
|
1811
1886
|
}
|
|
1812
1887
|
|
|
1888
|
+
export interface RawJsonGeneratorOptions {
|
|
1889
|
+
JSONParse?: boolean
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1813
1892
|
export interface RawJsonParserOptions {
|
|
1814
1893
|
exportsDepth?: number
|
|
1815
1894
|
parse?: (source: string) => string
|
|
@@ -2359,9 +2438,9 @@ export interface RegisterJsTaps {
|
|
|
2359
2438
|
registerCompilerEmitTaps: (stages: Array<number>) => Array<{ function: (() => Promise<void>); stage: number; }>
|
|
2360
2439
|
registerCompilerAfterEmitTaps: (stages: Array<number>) => Array<{ function: (() => Promise<void>); stage: number; }>
|
|
2361
2440
|
registerCompilerAssetEmittedTaps: (stages: Array<number>) => Array<{ function: ((arg: JsAssetEmittedArgs) => Promise<void>); stage: number; }>
|
|
2362
|
-
registerCompilationBuildModuleTaps: (stages: Array<number>) => Array<{ function: ((arg:
|
|
2363
|
-
registerCompilationStillValidModuleTaps: (stages: Array<number>) => Array<{ function: ((arg:
|
|
2364
|
-
registerCompilationSucceedModuleTaps: (stages: Array<number>) => Array<{ function: ((arg:
|
|
2441
|
+
registerCompilationBuildModuleTaps: (stages: Array<number>) => Array<{ function: ((arg: Module) => void); stage: number; }>
|
|
2442
|
+
registerCompilationStillValidModuleTaps: (stages: Array<number>) => Array<{ function: ((arg: Module) => void); stage: number; }>
|
|
2443
|
+
registerCompilationSucceedModuleTaps: (stages: Array<number>) => Array<{ function: ((arg: Module) => void); stage: number; }>
|
|
2365
2444
|
registerCompilationExecuteModuleTaps: (stages: Array<number>) => Array<{ function: ((arg: JsExecuteModuleArg) => void); stage: number; }>
|
|
2366
2445
|
registerCompilationAdditionalTreeRuntimeRequirementsTaps: (stages: Array<number>) => Array<{ function: ((arg: JsAdditionalTreeRuntimeRequirementsArg) => JsAdditionalTreeRuntimeRequirementsResult | undefined); stage: number; }>
|
|
2367
2446
|
registerCompilationRuntimeRequirementInTreeTaps: (stages: Array<number>) => Array<{ function: ((arg: JsRuntimeRequirementInTreeArg) => JsRuntimeRequirementInTreeResult | undefined); stage: number; }>
|
package/binding.js
CHANGED
|
@@ -212,6 +212,25 @@ switch (platform) {
|
|
|
212
212
|
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
+
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
216
|
+
try {
|
|
217
|
+
nativeBinding = require('./rspack.wasi.cjs')
|
|
218
|
+
} catch (e) {
|
|
219
|
+
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
220
|
+
loadError = e
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
if (!nativeBinding) {
|
|
224
|
+
try {
|
|
225
|
+
nativeBinding = require('@rspack/binding-wasm32-wasi')
|
|
226
|
+
} catch (e) {
|
|
227
|
+
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
228
|
+
loadError = e
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
215
234
|
if (!nativeBinding) {
|
|
216
235
|
if (loadError) {
|
|
217
236
|
throw loadError
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/binding",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0-beta.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Node binding for rspack",
|
|
6
6
|
"main": "binding.js",
|
|
@@ -17,28 +17,53 @@
|
|
|
17
17
|
"bugs": "https://github.com/web-infra-dev/rspack/issues",
|
|
18
18
|
"repository": "web-infra-dev/rspack",
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@napi-rs/cli": "3.0.0-alpha.
|
|
21
|
-
"
|
|
20
|
+
"@napi-rs/cli": "3.0.0-alpha.73",
|
|
21
|
+
"@napi-rs/wasm-runtime": "^0.2.7",
|
|
22
|
+
"emnapi": "^1.3.1",
|
|
23
|
+
"typescript": "^5.7.3",
|
|
24
|
+
"@emnapi/core": "^1.3.1"
|
|
22
25
|
},
|
|
23
26
|
"napi": {
|
|
24
|
-
"binaryName": "rspack"
|
|
27
|
+
"binaryName": "rspack",
|
|
28
|
+
"packageName": "@rspack/binding",
|
|
29
|
+
"targets": [
|
|
30
|
+
"x86_64-apple-darwin",
|
|
31
|
+
"x86_64-pc-windows-msvc",
|
|
32
|
+
"x86_64-unknown-linux-gnu",
|
|
33
|
+
"x86_64-unknown-linux-musl",
|
|
34
|
+
"x86_64-unknown-freebsd",
|
|
35
|
+
"i686-pc-windows-msvc",
|
|
36
|
+
"armv7-unknown-linux-gnueabihf",
|
|
37
|
+
"aarch64-unknown-linux-gnu",
|
|
38
|
+
"aarch64-apple-darwin",
|
|
39
|
+
"aarch64-unknown-linux-musl",
|
|
40
|
+
"aarch64-pc-windows-msvc",
|
|
41
|
+
"wasm32-wasip1-threads"
|
|
42
|
+
],
|
|
43
|
+
"wasm": {
|
|
44
|
+
"initialMemory": 16384,
|
|
45
|
+
"browser": {
|
|
46
|
+
"fs": true
|
|
47
|
+
}
|
|
48
|
+
}
|
|
25
49
|
},
|
|
26
50
|
"optionalDependencies": {
|
|
27
|
-
"@rspack/binding-darwin-arm64": "1.
|
|
28
|
-
"@rspack/binding-win32-arm64-msvc": "1.
|
|
29
|
-
"@rspack/binding-linux-arm64-
|
|
30
|
-
"@rspack/binding-linux-arm64-
|
|
31
|
-
"@rspack/binding-
|
|
32
|
-
"@rspack/binding-
|
|
33
|
-
"@rspack/binding-win32-x64-msvc": "1.
|
|
34
|
-
"@rspack/binding-linux-x64-
|
|
35
|
-
"@rspack/binding-linux-x64-
|
|
51
|
+
"@rspack/binding-darwin-arm64": "1.3.0-beta.0",
|
|
52
|
+
"@rspack/binding-win32-arm64-msvc": "1.3.0-beta.0",
|
|
53
|
+
"@rspack/binding-linux-arm64-musl": "1.3.0-beta.0",
|
|
54
|
+
"@rspack/binding-linux-arm64-gnu": "1.3.0-beta.0",
|
|
55
|
+
"@rspack/binding-win32-ia32-msvc": "1.3.0-beta.0",
|
|
56
|
+
"@rspack/binding-darwin-x64": "1.3.0-beta.0",
|
|
57
|
+
"@rspack/binding-win32-x64-msvc": "1.3.0-beta.0",
|
|
58
|
+
"@rspack/binding-linux-x64-gnu": "1.3.0-beta.0",
|
|
59
|
+
"@rspack/binding-linux-x64-musl": "1.3.0-beta.0"
|
|
36
60
|
},
|
|
37
61
|
"scripts": {
|
|
38
62
|
"build:dev": "node scripts/build.js",
|
|
39
63
|
"build:ci": "node scripts/build.js --profile ci",
|
|
40
64
|
"build:profiling": "node scripts/build.js --profile profiling",
|
|
41
65
|
"build:release": "node scripts/build.js --profile release",
|
|
66
|
+
"build:wasm": "DISABLE_PLUGIN=1 RUST_TARGET=wasm32-wasip1-threads node scripts/build.js",
|
|
42
67
|
"move-binding": "node scripts/move-binding",
|
|
43
68
|
"test": "tsc -p tsconfig.type-test.json"
|
|
44
69
|
}
|