@rspack/binding 0.1.7 → 0.1.9
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 +90 -37
- package/package.json +11 -11
package/binding.d.ts
CHANGED
|
@@ -14,6 +14,26 @@ export interface ThreadsafeNodeFS {
|
|
|
14
14
|
mkdirp: (...args: any[]) => any
|
|
15
15
|
removeDirAll: (...args: any[]) => any
|
|
16
16
|
}
|
|
17
|
+
export interface RawBannerCondition {
|
|
18
|
+
type: "string" | "regexp"
|
|
19
|
+
stringMatcher?: string
|
|
20
|
+
regexpMatcher?: string
|
|
21
|
+
}
|
|
22
|
+
export interface RawBannerConditions {
|
|
23
|
+
type: "string" | "regexp" | "array"
|
|
24
|
+
stringMatcher?: string
|
|
25
|
+
regexpMatcher?: string
|
|
26
|
+
arrayMatcher?: Array<RawBannerCondition>
|
|
27
|
+
}
|
|
28
|
+
export interface RawBannerConfig {
|
|
29
|
+
banner: string
|
|
30
|
+
entryOnly?: boolean
|
|
31
|
+
footer?: boolean
|
|
32
|
+
raw?: boolean
|
|
33
|
+
test?: RawBannerConditions
|
|
34
|
+
include?: RawBannerConditions
|
|
35
|
+
exclude?: RawBannerConditions
|
|
36
|
+
}
|
|
17
37
|
export interface RawPattern {
|
|
18
38
|
from: string
|
|
19
39
|
to?: string
|
|
@@ -139,6 +159,7 @@ export interface RawBuiltins {
|
|
|
139
159
|
emotion?: string
|
|
140
160
|
devFriendlySplitChunks: boolean
|
|
141
161
|
copy?: RawCopyConfig
|
|
162
|
+
banner?: Array<RawBannerConfig>
|
|
142
163
|
pluginImport?: Array<RawPluginImportConfig>
|
|
143
164
|
relay?: RawRelayConfig
|
|
144
165
|
}
|
|
@@ -164,21 +185,67 @@ export interface RawExperiments {
|
|
|
164
185
|
lazyCompilation: boolean
|
|
165
186
|
incrementalRebuild: boolean
|
|
166
187
|
asyncWebAssembly: boolean
|
|
188
|
+
newSplitChunks: boolean
|
|
167
189
|
}
|
|
168
190
|
export interface RawExternalItem {
|
|
169
|
-
type: "string" | "regexp" | "object"
|
|
191
|
+
type: "string" | "regexp" | "object" | "function"
|
|
170
192
|
stringPayload?: string
|
|
171
193
|
regexpPayload?: string
|
|
172
194
|
objectPayload?: Record<string, RawExternalItemValue>
|
|
195
|
+
fnPayload?: (value: any) => any
|
|
173
196
|
}
|
|
174
197
|
export interface RawExternalItemValue {
|
|
175
198
|
type: "string" | "bool"
|
|
176
199
|
stringPayload?: string
|
|
177
200
|
boolPayload?: boolean
|
|
178
201
|
}
|
|
202
|
+
export interface RawExternalItemFnResult {
|
|
203
|
+
externalType?: string
|
|
204
|
+
result?: RawExternalItemValue
|
|
205
|
+
}
|
|
206
|
+
export interface RawExternalItemFnCtx {
|
|
207
|
+
request: string
|
|
208
|
+
context: string
|
|
209
|
+
dependencyType: string
|
|
210
|
+
}
|
|
179
211
|
export interface RawExternalsPresets {
|
|
180
212
|
node: boolean
|
|
181
213
|
}
|
|
214
|
+
export interface JsLoader {
|
|
215
|
+
/** composed loader name, xx-loader$yy-loader$zz-loader */
|
|
216
|
+
identifier: string
|
|
217
|
+
}
|
|
218
|
+
export interface JsLoaderContext {
|
|
219
|
+
/** Content maybe empty in pitching stage */
|
|
220
|
+
content?: Buffer
|
|
221
|
+
additionalData?: Buffer
|
|
222
|
+
sourceMap?: Buffer
|
|
223
|
+
resource: string
|
|
224
|
+
resourcePath: string
|
|
225
|
+
resourceQuery?: string
|
|
226
|
+
resourceFragment?: string
|
|
227
|
+
cacheable: boolean
|
|
228
|
+
fileDependencies: Array<string>
|
|
229
|
+
contextDependencies: Array<string>
|
|
230
|
+
missingDependencies: Array<string>
|
|
231
|
+
buildDependencies: Array<string>
|
|
232
|
+
assetFilenames: Array<string>
|
|
233
|
+
currentLoader: string
|
|
234
|
+
isPitching: boolean
|
|
235
|
+
}
|
|
236
|
+
export interface JsLoaderResult {
|
|
237
|
+
/** Content in pitching stage can be empty */
|
|
238
|
+
content?: Buffer
|
|
239
|
+
fileDependencies: Array<string>
|
|
240
|
+
contextDependencies: Array<string>
|
|
241
|
+
missingDependencies: Array<string>
|
|
242
|
+
buildDependencies: Array<string>
|
|
243
|
+
sourceMap?: Buffer
|
|
244
|
+
additionalData?: Buffer
|
|
245
|
+
cacheable: boolean
|
|
246
|
+
/** Used to instruct how rust loaders should execute */
|
|
247
|
+
isPitching: boolean
|
|
248
|
+
}
|
|
182
249
|
/**
|
|
183
250
|
* `loader` is for js side loader, `builtin_loader` is for rust side loader,
|
|
184
251
|
* which is mapped to real rust side loader by [get_builtin_loader].
|
|
@@ -195,11 +262,6 @@ export interface RawModuleRuleUse {
|
|
|
195
262
|
builtinLoader?: string
|
|
196
263
|
options?: string
|
|
197
264
|
}
|
|
198
|
-
export interface JsLoader {
|
|
199
|
-
/** composed loader name, xx-loader!yy-loader!zz-loader */
|
|
200
|
-
name: string
|
|
201
|
-
func: (...args: any[]) => any
|
|
202
|
-
}
|
|
203
265
|
export interface RawRuleSetCondition {
|
|
204
266
|
type: "string" | "regexp" | "logical" | "array" | "function"
|
|
205
267
|
stringMatcher?: string
|
|
@@ -232,6 +294,8 @@ export interface RawModuleRule {
|
|
|
232
294
|
issuer?: RawRuleSetCondition
|
|
233
295
|
dependency?: RawRuleSetCondition
|
|
234
296
|
oneOf?: Array<RawModuleRule>
|
|
297
|
+
/** Specifies the category of the loader. No value means normal loader. */
|
|
298
|
+
enforce?: 'pre' | 'post'
|
|
235
299
|
}
|
|
236
300
|
export interface RawModuleRuleGenerator {
|
|
237
301
|
filename?: string
|
|
@@ -252,30 +316,6 @@ export interface RawModuleOptions {
|
|
|
252
316
|
rules: Array<RawModuleRule>
|
|
253
317
|
parser?: RawParserOptions
|
|
254
318
|
}
|
|
255
|
-
export interface JsLoaderContext {
|
|
256
|
-
content: Buffer
|
|
257
|
-
additionalData?: Buffer
|
|
258
|
-
sourceMap?: Buffer
|
|
259
|
-
resource: string
|
|
260
|
-
resourcePath: string
|
|
261
|
-
resourceQuery?: string
|
|
262
|
-
resourceFragment?: string
|
|
263
|
-
cacheable: boolean
|
|
264
|
-
fileDependencies: Array<string>
|
|
265
|
-
contextDependencies: Array<string>
|
|
266
|
-
missingDependencies: Array<string>
|
|
267
|
-
buildDependencies: Array<string>
|
|
268
|
-
}
|
|
269
|
-
export interface JsLoaderResult {
|
|
270
|
-
content: Buffer
|
|
271
|
-
fileDependencies: Array<string>
|
|
272
|
-
contextDependencies: Array<string>
|
|
273
|
-
missingDependencies: Array<string>
|
|
274
|
-
buildDependencies: Array<string>
|
|
275
|
-
sourceMap?: Buffer
|
|
276
|
-
additionalData?: Buffer
|
|
277
|
-
cacheable: boolean
|
|
278
|
-
}
|
|
279
319
|
export interface RawNodeOption {
|
|
280
320
|
dirname: string
|
|
281
321
|
filename: string
|
|
@@ -287,6 +327,9 @@ export interface RawOptimizationOptions {
|
|
|
287
327
|
removeAvailableModules: boolean
|
|
288
328
|
sideEffects: string
|
|
289
329
|
}
|
|
330
|
+
export interface RawTrustedTypes {
|
|
331
|
+
policyName?: string
|
|
332
|
+
}
|
|
290
333
|
export interface RawLibraryName {
|
|
291
334
|
amd?: string
|
|
292
335
|
commonjs?: string
|
|
@@ -332,6 +375,10 @@ export interface RawOutputOptions {
|
|
|
332
375
|
importFunctionName: string
|
|
333
376
|
iife: boolean
|
|
334
377
|
module: boolean
|
|
378
|
+
chunkFormat?: string
|
|
379
|
+
chunkLoading?: string
|
|
380
|
+
enabledChunkLoadingTypes?: Array<string>
|
|
381
|
+
trustedTypes?: RawTrustedTypes
|
|
335
382
|
}
|
|
336
383
|
export interface RawResolveOptions {
|
|
337
384
|
preferRelative?: boolean
|
|
@@ -369,7 +416,6 @@ export interface RawSplitChunksOptions {
|
|
|
369
416
|
}
|
|
370
417
|
export interface RawCacheGroupOptions {
|
|
371
418
|
priority?: number
|
|
372
|
-
reuseExistingChunk?: boolean
|
|
373
419
|
test?: string
|
|
374
420
|
/** What kind of chunks should be selected. */
|
|
375
421
|
chunks?: string
|
|
@@ -378,7 +424,6 @@ export interface RawCacheGroupOptions {
|
|
|
378
424
|
}
|
|
379
425
|
export interface RawStatsOptions {
|
|
380
426
|
colors: boolean
|
|
381
|
-
reasons: boolean
|
|
382
427
|
}
|
|
383
428
|
export interface RawOptions {
|
|
384
429
|
entry: Record<string, RawEntryItem>
|
|
@@ -442,12 +487,17 @@ export interface JsAsset {
|
|
|
442
487
|
export interface JsChunk {
|
|
443
488
|
files: Array<string>
|
|
444
489
|
}
|
|
490
|
+
export interface JsChunkAssetArgs {
|
|
491
|
+
chunk: JsChunk
|
|
492
|
+
filename: string
|
|
493
|
+
}
|
|
445
494
|
export interface JsChunkGroup {
|
|
446
495
|
chunks: Array<JsChunk>
|
|
447
496
|
}
|
|
448
497
|
export interface JsHooks {
|
|
449
498
|
processAssetsStageAdditional: (...args: any[]) => any
|
|
450
499
|
processAssetsStagePreProcess: (...args: any[]) => any
|
|
500
|
+
processAssetsStageAdditions: (...args: any[]) => any
|
|
451
501
|
processAssetsStageNone: (...args: any[]) => any
|
|
452
502
|
processAssetsStageOptimizeInline: (...args: any[]) => any
|
|
453
503
|
processAssetsStageSummarize: (...args: any[]) => any
|
|
@@ -457,9 +507,11 @@ export interface JsHooks {
|
|
|
457
507
|
emit: (...args: any[]) => any
|
|
458
508
|
afterEmit: (...args: any[]) => any
|
|
459
509
|
make: (...args: any[]) => any
|
|
510
|
+
optimizeModules: (...args: any[]) => any
|
|
460
511
|
optimizeChunkModule: (...args: any[]) => any
|
|
461
512
|
finishModules: (...args: any[]) => any
|
|
462
513
|
normalModuleFactoryResolveForScheme: (...args: any[]) => any
|
|
514
|
+
chunkAsset: (...args: any[]) => any
|
|
463
515
|
}
|
|
464
516
|
export interface JsModule {
|
|
465
517
|
originalSource?: JsCompatSource
|
|
@@ -514,7 +566,7 @@ export interface JsStatsModule {
|
|
|
514
566
|
moduleType: string
|
|
515
567
|
identifier: string
|
|
516
568
|
name: string
|
|
517
|
-
id
|
|
569
|
+
id?: string
|
|
518
570
|
chunks: Array<string>
|
|
519
571
|
size: number
|
|
520
572
|
issuer?: string
|
|
@@ -522,11 +574,12 @@ export interface JsStatsModule {
|
|
|
522
574
|
issuerId?: string
|
|
523
575
|
issuerPath: Array<JsStatsModuleIssuer>
|
|
524
576
|
reasons?: Array<JsStatsModuleReason>
|
|
577
|
+
assets?: Array<string>
|
|
525
578
|
}
|
|
526
579
|
export interface JsStatsModuleIssuer {
|
|
527
580
|
identifier: string
|
|
528
581
|
name: string
|
|
529
|
-
id
|
|
582
|
+
id?: string
|
|
530
583
|
}
|
|
531
584
|
export interface JsStatsModuleReason {
|
|
532
585
|
moduleIdentifier?: string
|
|
@@ -607,8 +660,8 @@ export class JsCompilation {
|
|
|
607
660
|
}
|
|
608
661
|
export class JsStats {
|
|
609
662
|
getAssets(): JsStatsGetAssets
|
|
610
|
-
getModules(): Array<JsStatsModule>
|
|
611
|
-
getChunks(chunkModules: boolean, chunksRelations: boolean): Array<JsStatsChunk>
|
|
663
|
+
getModules(reasons: boolean, moduleAssets: boolean): Array<JsStatsModule>
|
|
664
|
+
getChunks(chunkModules: boolean, chunksRelations: boolean, reasons: boolean, moduleAssets: boolean): Array<JsStatsChunk>
|
|
612
665
|
getEntrypoints(): Array<JsStatsChunkGroup>
|
|
613
666
|
getNamedChunkGroups(): Array<JsStatsChunkGroup>
|
|
614
667
|
getErrors(): Array<JsStatsError>
|
|
@@ -616,7 +669,7 @@ export class JsStats {
|
|
|
616
669
|
getHash(): string
|
|
617
670
|
}
|
|
618
671
|
export class Rspack {
|
|
619
|
-
constructor(options: RawOptions, jsHooks: JsHooks | undefined | null, outputFilesystem: ThreadsafeNodeFS)
|
|
672
|
+
constructor(options: RawOptions, jsHooks: JsHooks | undefined | null, outputFilesystem: ThreadsafeNodeFS, jsLoaderRunner: (...args: any[]) => any)
|
|
620
673
|
unsafe_set_disabled_hooks(hooks: Array<string>): void
|
|
621
674
|
/**
|
|
622
675
|
* Build with the given option passed to the constructor
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/binding",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Node binding for rspack",
|
|
6
6
|
"main": "binding.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"bugs": "https://github.com/web-infra-dev/rspack/issues",
|
|
17
17
|
"repository": "web-infra-dev/rspack",
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@napi-rs/cli": "2.
|
|
19
|
+
"@napi-rs/cli": "2.15.2",
|
|
20
20
|
"cross-env": "^7.0.3",
|
|
21
21
|
"npm-run-all": "4.1.5",
|
|
22
22
|
"why-is-node-running": "2.2.1"
|
|
@@ -25,15 +25,15 @@
|
|
|
25
25
|
"name": "rspack"
|
|
26
26
|
},
|
|
27
27
|
"optionalDependencies": {
|
|
28
|
-
"@rspack/binding-darwin-arm64": "0.1.
|
|
29
|
-
"@rspack/binding-win32-arm64-msvc": "0.1.
|
|
30
|
-
"@rspack/binding-linux-arm64-gnu": "0.1.
|
|
31
|
-
"@rspack/binding-linux-arm64-musl": "0.1.
|
|
32
|
-
"@rspack/binding-win32-ia32-msvc": "0.1.
|
|
33
|
-
"@rspack/binding-darwin-x64": "0.1.
|
|
34
|
-
"@rspack/binding-win32-x64-msvc": "0.1.
|
|
35
|
-
"@rspack/binding-linux-x64-gnu": "0.1.
|
|
36
|
-
"@rspack/binding-linux-x64-musl": "0.1.
|
|
28
|
+
"@rspack/binding-darwin-arm64": "0.1.9",
|
|
29
|
+
"@rspack/binding-win32-arm64-msvc": "0.1.9",
|
|
30
|
+
"@rspack/binding-linux-arm64-gnu": "0.1.9",
|
|
31
|
+
"@rspack/binding-linux-arm64-musl": "0.1.9",
|
|
32
|
+
"@rspack/binding-win32-ia32-msvc": "0.1.9",
|
|
33
|
+
"@rspack/binding-darwin-x64": "0.1.9",
|
|
34
|
+
"@rspack/binding-win32-x64-msvc": "0.1.9",
|
|
35
|
+
"@rspack/binding-linux-x64-gnu": "0.1.9",
|
|
36
|
+
"@rspack/binding-linux-x64-musl": "0.1.9"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build:debug": "node scripts/build.js",
|