@rspack/binding 0.1.0 → 0.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.
- package/binding.d.ts +55 -14
- package/package.json +18 -17
package/binding.d.ts
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
|
|
4
4
|
/* auto-generated by NAPI-RS */
|
|
5
5
|
|
|
6
|
+
export interface NodeFS {
|
|
7
|
+
writeFile: (...args: any[]) => any
|
|
8
|
+
mkdir: (...args: any[]) => any
|
|
9
|
+
mkdirp: (...args: any[]) => any
|
|
10
|
+
}
|
|
11
|
+
export interface ThreadsafeNodeFS {
|
|
12
|
+
writeFile: (...args: any[]) => any
|
|
13
|
+
mkdir: (...args: any[]) => any
|
|
14
|
+
mkdirp: (...args: any[]) => any
|
|
15
|
+
}
|
|
6
16
|
export interface RawPattern {
|
|
7
17
|
from: string
|
|
8
18
|
to?: string
|
|
@@ -16,6 +26,7 @@ export interface RawPattern {
|
|
|
16
26
|
export interface RawGlobOptions {
|
|
17
27
|
caseSensitiveMatch?: boolean
|
|
18
28
|
dot?: boolean
|
|
29
|
+
ignore?: Array<string>
|
|
19
30
|
}
|
|
20
31
|
export interface RawCopyConfig {
|
|
21
32
|
patterns: Array<RawPattern>
|
|
@@ -150,6 +161,15 @@ export interface RawExperiments {
|
|
|
150
161
|
lazyCompilation: boolean
|
|
151
162
|
incrementalRebuild: boolean
|
|
152
163
|
}
|
|
164
|
+
export interface RawExternalItem {
|
|
165
|
+
type: "string" | "regexp" | "object"
|
|
166
|
+
stringPayload?: string
|
|
167
|
+
regexpPayload?: string
|
|
168
|
+
objectPayload?: Record<string, string>
|
|
169
|
+
}
|
|
170
|
+
export interface RawExternalsPresets {
|
|
171
|
+
node: boolean
|
|
172
|
+
}
|
|
153
173
|
/**
|
|
154
174
|
* `loader` is for js side loader, `builtin_loader` is for rust side loader,
|
|
155
175
|
* which is mapped to real rust side loader by [get_builtin_loader].
|
|
@@ -172,11 +192,12 @@ export interface JsLoader {
|
|
|
172
192
|
func: (...args: any[]) => any
|
|
173
193
|
}
|
|
174
194
|
export interface RawRuleSetCondition {
|
|
175
|
-
type: "string" | "regexp" | "logical" | "array"
|
|
195
|
+
type: "string" | "regexp" | "logical" | "array" | "function"
|
|
176
196
|
stringMatcher?: string
|
|
177
197
|
regexpMatcher?: string
|
|
178
198
|
logicalMatcher?: Array<RawRuleSetLogicalConditions>
|
|
179
199
|
arrayMatcher?: Array<RawRuleSetCondition>
|
|
200
|
+
funcMatcher?: (value: string) => boolean
|
|
180
201
|
}
|
|
181
202
|
export interface RawRuleSetLogicalConditions {
|
|
182
203
|
and?: Array<RawRuleSetCondition>
|
|
@@ -246,6 +267,7 @@ export interface JsLoaderResult {
|
|
|
246
267
|
}
|
|
247
268
|
export interface RawNodeOption {
|
|
248
269
|
dirname: string
|
|
270
|
+
filename: string
|
|
249
271
|
global: string
|
|
250
272
|
}
|
|
251
273
|
export interface RawOptimizationOptions {
|
|
@@ -330,6 +352,7 @@ export interface RawCacheGroupOptions {
|
|
|
330
352
|
}
|
|
331
353
|
export interface RawStatsOptions {
|
|
332
354
|
colors: boolean
|
|
355
|
+
reasons: boolean
|
|
333
356
|
}
|
|
334
357
|
export interface RawOptions {
|
|
335
358
|
entry: Record<string, RawEntryItem>
|
|
@@ -340,8 +363,9 @@ export interface RawOptions {
|
|
|
340
363
|
resolve: RawResolveOptions
|
|
341
364
|
module: RawModuleOptions
|
|
342
365
|
builtins: RawBuiltins
|
|
343
|
-
externals
|
|
366
|
+
externals?: Array<RawExternalItem>
|
|
344
367
|
externalsType: string
|
|
368
|
+
externalsPresets: RawExternalsPresets
|
|
345
369
|
devtool: string
|
|
346
370
|
optimization: RawOptimizationOptions
|
|
347
371
|
stats: RawStatsOptions
|
|
@@ -351,16 +375,6 @@ export interface RawOptions {
|
|
|
351
375
|
experiments: RawExperiments
|
|
352
376
|
node: RawNodeOption
|
|
353
377
|
}
|
|
354
|
-
export interface ThreadsafeNodeFS {
|
|
355
|
-
writeFile: (...args: any[]) => any
|
|
356
|
-
mkdir: (...args: any[]) => any
|
|
357
|
-
mkdirp: (...args: any[]) => any
|
|
358
|
-
}
|
|
359
|
-
export interface NodeFS {
|
|
360
|
-
writeFile: (...args: any[]) => any
|
|
361
|
-
mkdir: (...args: any[]) => any
|
|
362
|
-
mkdirp: (...args: any[]) => any
|
|
363
|
-
}
|
|
364
378
|
export interface JsAssetInfoRelated {
|
|
365
379
|
sourceMap?: string
|
|
366
380
|
}
|
|
@@ -412,12 +426,27 @@ export interface JsHooks {
|
|
|
412
426
|
afterEmit: (...args: any[]) => any
|
|
413
427
|
make: (...args: any[]) => any
|
|
414
428
|
optimizeChunkModule: (...args: any[]) => any
|
|
429
|
+
normalModuleFactoryResolveForScheme: (...args: any[]) => any
|
|
415
430
|
}
|
|
416
431
|
export interface JsModule {
|
|
417
432
|
originalSource?: JsCompatSource
|
|
418
433
|
resource: string
|
|
419
434
|
moduleIdentifier: string
|
|
420
435
|
}
|
|
436
|
+
export interface SchemeAndJsResourceData {
|
|
437
|
+
resourceData: JsResourceData
|
|
438
|
+
scheme: string
|
|
439
|
+
}
|
|
440
|
+
export interface JsResourceData {
|
|
441
|
+
/** Resource with absolute path, query and fragment */
|
|
442
|
+
resource: string
|
|
443
|
+
/** Absolute resource path only */
|
|
444
|
+
path: string
|
|
445
|
+
/** Resource query with `?` prefix */
|
|
446
|
+
query?: string
|
|
447
|
+
/** Resource fragment with `#` prefix */
|
|
448
|
+
fragment?: string
|
|
449
|
+
}
|
|
421
450
|
export interface JsCompatSource {
|
|
422
451
|
/** Whether the underlying data structure is a `RawSource` */
|
|
423
452
|
isRaw: boolean
|
|
@@ -479,6 +508,10 @@ export interface JsStatsChunk {
|
|
|
479
508
|
initial: boolean
|
|
480
509
|
names: Array<string>
|
|
481
510
|
size: number
|
|
511
|
+
modules?: Array<JsStatsModule>
|
|
512
|
+
parents?: Array<string>
|
|
513
|
+
children?: Array<string>
|
|
514
|
+
siblings?: Array<string>
|
|
482
515
|
}
|
|
483
516
|
export interface JsStatsChunkGroupAsset {
|
|
484
517
|
name: string
|
|
@@ -498,6 +531,13 @@ export interface JsStatsGetAssets {
|
|
|
498
531
|
assets: Array<JsStatsAsset>
|
|
499
532
|
assetsByChunkName: Array<JsStatsAssetsByChunkName>
|
|
500
533
|
}
|
|
534
|
+
/**
|
|
535
|
+
* Some code is modified based on
|
|
536
|
+
* https://github.com/swc-project/swc/blob/d1d0607158ab40463d1b123fed52cc526eba8385/bindings/binding_core_node/src/util.rs#L29-L58
|
|
537
|
+
* Apache-2.0 licensed
|
|
538
|
+
* Author Donny/강동윤
|
|
539
|
+
* Copyright (c)
|
|
540
|
+
*/
|
|
501
541
|
export function initCustomTraceSubscriber(): void
|
|
502
542
|
export class JsCompilation {
|
|
503
543
|
updateAsset(filename: string, newSourceOrFunction: JsCompatSource | ((source: JsCompatSource) => JsCompatSource), assetInfoUpdateOrFunction?: JsAssetInfo | ((assetInfo: JsAssetInfo) => JsAssetInfo)): void
|
|
@@ -505,6 +545,7 @@ export class JsCompilation {
|
|
|
505
545
|
getAsset(name: string): JsAsset | null
|
|
506
546
|
getAssetSource(name: string): JsCompatSource | null
|
|
507
547
|
getModules(): Array<JsModule>
|
|
548
|
+
getChunks(): Array<JsChunk>
|
|
508
549
|
/**
|
|
509
550
|
* Only available for those none Js and Css source,
|
|
510
551
|
* return true if set module source successfully, false if failed.
|
|
@@ -531,8 +572,8 @@ export class JsCompilation {
|
|
|
531
572
|
}
|
|
532
573
|
export class JsStats {
|
|
533
574
|
getAssets(): JsStatsGetAssets
|
|
534
|
-
getModules(
|
|
535
|
-
getChunks(): Array<JsStatsChunk>
|
|
575
|
+
getModules(): Array<JsStatsModule>
|
|
576
|
+
getChunks(chunkModules: boolean, chunksRelations: boolean): Array<JsStatsChunk>
|
|
536
577
|
getEntrypoints(): Array<JsStatsChunkGroup>
|
|
537
578
|
getNamedChunkGroups(): Array<JsStatsChunkGroup>
|
|
538
579
|
getErrors(): Array<JsStatsError>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/binding",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Node binding for rspack",
|
|
6
6
|
"main": "binding.js",
|
|
@@ -17,32 +17,33 @@
|
|
|
17
17
|
"repository": "web-infra-dev/rspack",
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@napi-rs/cli": "2.14.2",
|
|
20
|
-
"
|
|
21
|
-
"npm-run-all": "4.1.5"
|
|
20
|
+
"cross-env": "^7.0.3",
|
|
21
|
+
"npm-run-all": "4.1.5",
|
|
22
|
+
"why-is-node-running": "2.2.1"
|
|
22
23
|
},
|
|
23
24
|
"napi": {
|
|
24
25
|
"name": "rspack"
|
|
25
26
|
},
|
|
26
27
|
"optionalDependencies": {
|
|
27
|
-
"@rspack/binding-darwin-arm64": "0.1.
|
|
28
|
-
"@rspack/binding-win32-arm64-msvc": "0.1.
|
|
29
|
-
"@rspack/binding-linux-arm64-gnu": "0.1.
|
|
30
|
-
"@rspack/binding-linux-arm64-musl": "0.1.
|
|
31
|
-
"@rspack/binding-win32-ia32-msvc": "0.1.
|
|
32
|
-
"@rspack/binding-darwin-x64": "0.1.
|
|
33
|
-
"@rspack/binding-win32-x64-msvc": "0.1.
|
|
34
|
-
"@rspack/binding-linux-x64-gnu": "0.1.
|
|
35
|
-
"@rspack/binding-linux-x64-musl": "0.1.
|
|
28
|
+
"@rspack/binding-darwin-arm64": "0.1.2",
|
|
29
|
+
"@rspack/binding-win32-arm64-msvc": "0.1.2",
|
|
30
|
+
"@rspack/binding-linux-arm64-gnu": "0.1.2",
|
|
31
|
+
"@rspack/binding-linux-arm64-musl": "0.1.2",
|
|
32
|
+
"@rspack/binding-win32-ia32-msvc": "0.1.2",
|
|
33
|
+
"@rspack/binding-darwin-x64": "0.1.2",
|
|
34
|
+
"@rspack/binding-win32-x64-msvc": "0.1.2",
|
|
35
|
+
"@rspack/binding-linux-x64-gnu": "0.1.2",
|
|
36
|
+
"@rspack/binding-linux-x64-musl": "0.1.2"
|
|
36
37
|
},
|
|
37
38
|
"scripts": {
|
|
38
39
|
"build:debug": "node scripts/build.js",
|
|
39
|
-
"build:debug:x64": "RUST_TARGET=x86_64-apple-darwin node scripts/build.js",
|
|
40
|
-
"build:debug:linux": "RUST_TARGET=x86_64-unknown-linux-gnu node scripts/build.js",
|
|
40
|
+
"build:debug:x64": "cross-env RUST_TARGET=x86_64-apple-darwin node scripts/build.js",
|
|
41
|
+
"build:debug:linux": "cross-env RUST_TARGET=x86_64-unknown-linux-gnu node scripts/build.js",
|
|
41
42
|
"build:release:all": "run-p build:release build:release:x64 build:release:linux && pnpm move-binding",
|
|
42
43
|
"build:release": "node scripts/build.js --release",
|
|
43
|
-
"build:release:x64": "RUST_TARGET=x86_64-apple-darwin node scripts/build.js --release",
|
|
44
|
-
"build:release:linux": "RUST_TARGET=x86_64-unknown-linux-gnu node scripts/build.js --release",
|
|
45
|
-
"build:release:win": "RUST_TARGET=x86_64-pc-windows-msvc node scripts/build.js --release",
|
|
44
|
+
"build:release:x64": "cross-env RUST_TARGET=x86_64-apple-darwin node scripts/build.js --release",
|
|
45
|
+
"build:release:linux": "cross-env RUST_TARGET=x86_64-unknown-linux-gnu node scripts/build.js --release",
|
|
46
|
+
"build:release:win": "cross-env RUST_TARGET=x86_64-pc-windows-msvc node scripts/build.js --release",
|
|
46
47
|
"move-binding": "node scripts/move-binding"
|
|
47
48
|
}
|
|
48
49
|
}
|