@rspack/binding 0.0.23 → 0.0.25
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/README.md +16 -0
- package/binding.d.ts +82 -49
- package/binding.js +2 -1
- package/package.json +22 -13
package/README.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<picture>
|
|
2
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://lf3-static.bytednsdoc.com/obj/eden-cn/rjhwzy/ljhwZthlaukjlkulzlp/rspack-banner-1610-dark.png">
|
|
3
|
+
<img alt="Rspack Banner" src="https://lf3-static.bytednsdoc.com/obj/eden-cn/rjhwzy/ljhwZthlaukjlkulzlp/rspack-banner-1610.png">
|
|
4
|
+
</picture>
|
|
5
|
+
|
|
6
|
+
# @rspack/binding
|
|
7
|
+
|
|
8
|
+
Node binding for rspack.
|
|
9
|
+
|
|
10
|
+
## Documentation
|
|
11
|
+
|
|
12
|
+
See [https://rspack.org](https://rspack.org) for details.
|
|
13
|
+
|
|
14
|
+
## License
|
|
15
|
+
|
|
16
|
+
Rspack is [MIT licensed](https://github.com/web-infra-dev/rspack/blob/main/LICENSE).
|
package/binding.d.ts
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
/* auto-generated by NAPI-RS */
|
|
5
5
|
|
|
6
|
-
export interface
|
|
6
|
+
export interface ThreadsafeNodeFS {
|
|
7
7
|
writeFile: (...args: any[]) => any
|
|
8
8
|
mkdir: (...args: any[]) => any
|
|
9
9
|
mkdirp: (...args: any[]) => any
|
|
10
10
|
}
|
|
11
|
-
export interface
|
|
11
|
+
export interface NodeFS {
|
|
12
12
|
writeFile: (...args: any[]) => any
|
|
13
13
|
mkdir: (...args: any[]) => any
|
|
14
14
|
mkdirp: (...args: any[]) => any
|
|
@@ -34,7 +34,7 @@ export interface RawCssPluginConfig {
|
|
|
34
34
|
modules: RawCssModulesConfig
|
|
35
35
|
}
|
|
36
36
|
export interface RawCssModulesConfig {
|
|
37
|
-
localsConvention:
|
|
37
|
+
localsConvention: "asIs" | "camelCase" | "camelCaseOnly" | "dashes" | "dashesOnly"
|
|
38
38
|
localIdentName: string
|
|
39
39
|
exportsOnly: boolean
|
|
40
40
|
}
|
|
@@ -63,6 +63,23 @@ export interface RawHtmlPluginConfig {
|
|
|
63
63
|
favicon?: string
|
|
64
64
|
meta?: Record<string, Record<string, string>>
|
|
65
65
|
}
|
|
66
|
+
export interface RawStyleConfig {
|
|
67
|
+
styleLibraryDirectory?: string
|
|
68
|
+
custom?: string
|
|
69
|
+
css?: string
|
|
70
|
+
bool?: boolean
|
|
71
|
+
}
|
|
72
|
+
export interface RawPluginImportConfig {
|
|
73
|
+
libraryName: string
|
|
74
|
+
libraryDirectory?: string
|
|
75
|
+
customName?: string
|
|
76
|
+
customStyleName?: string
|
|
77
|
+
style?: RawStyleConfig
|
|
78
|
+
camelToDashComponentName?: boolean
|
|
79
|
+
transformToDefaultImport?: boolean
|
|
80
|
+
ignoreEsComponent?: Array<string>
|
|
81
|
+
ignoreStyleComponent?: Array<string>
|
|
82
|
+
}
|
|
66
83
|
export interface RawPostCssConfig {
|
|
67
84
|
pxtorem?: RawPxToRemConfig
|
|
68
85
|
}
|
|
@@ -89,6 +106,10 @@ export interface RawReactOptions {
|
|
|
89
106
|
useSpread?: boolean
|
|
90
107
|
refresh?: boolean
|
|
91
108
|
}
|
|
109
|
+
export interface RawRelayConfig {
|
|
110
|
+
artifactDirectory?: string
|
|
111
|
+
language: 'javascript' | 'typescript' | 'flow'
|
|
112
|
+
}
|
|
92
113
|
export interface RawMinification {
|
|
93
114
|
passes: number
|
|
94
115
|
dropConsole: boolean
|
|
@@ -114,6 +135,8 @@ export interface RawBuiltins {
|
|
|
114
135
|
emotion?: string
|
|
115
136
|
devFriendlySplitChunks: boolean
|
|
116
137
|
copy?: RawCopyConfig
|
|
138
|
+
pluginImport?: Array<RawPluginImportConfig>
|
|
139
|
+
relay?: RawRelayConfig
|
|
117
140
|
}
|
|
118
141
|
export interface RawCacheOptions {
|
|
119
142
|
type: string
|
|
@@ -158,45 +181,34 @@ export interface JsLoader {
|
|
|
158
181
|
name: string
|
|
159
182
|
func: (...args: any[]) => any
|
|
160
183
|
}
|
|
161
|
-
export interface
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
* - "regexp": The value will be matched against the raw regexp source from JS side.
|
|
168
|
-
*/
|
|
169
|
-
matcher?: string
|
|
184
|
+
export interface RawRuleSetCondition {
|
|
185
|
+
type: "string" | "regexp" | "logical" | "array"
|
|
186
|
+
stringMatcher?: string
|
|
187
|
+
regexpMatcher?: string
|
|
188
|
+
logicalMatcher?: Array<RawRuleSetLogicalConditions>
|
|
189
|
+
arrayMatcher?: Array<RawRuleSetCondition>
|
|
170
190
|
}
|
|
171
|
-
export interface
|
|
172
|
-
|
|
191
|
+
export interface RawRuleSetLogicalConditions {
|
|
192
|
+
and?: Array<RawRuleSetCondition>
|
|
193
|
+
or?: Array<RawRuleSetCondition>
|
|
194
|
+
not?: RawRuleSetCondition
|
|
173
195
|
}
|
|
174
196
|
export interface RawModuleRule {
|
|
175
|
-
/**
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* A condition matcher matching an absolute path.
|
|
185
|
-
* See `test` above
|
|
186
|
-
*/
|
|
187
|
-
resource?: RawModuleRuleCondition
|
|
188
|
-
/**
|
|
189
|
-
* A condition matcher against the resource query.
|
|
190
|
-
* TODO: align with webpack's `?` prefixed `resourceQuery`
|
|
191
|
-
*/
|
|
192
|
-
resourceQuery?: RawModuleRuleCondition
|
|
197
|
+
/** A condition matcher matching an absolute path. */
|
|
198
|
+
test?: RawRuleSetCondition
|
|
199
|
+
include?: RawRuleSetCondition
|
|
200
|
+
exclude?: RawRuleSetCondition
|
|
201
|
+
/** A condition matcher matching an absolute path. */
|
|
202
|
+
resource?: RawRuleSetCondition
|
|
203
|
+
/** A condition matcher against the resource query. */
|
|
204
|
+
resourceQuery?: RawRuleSetCondition
|
|
193
205
|
sideEffects?: boolean
|
|
194
206
|
use?: Array<RawModuleRuleUse>
|
|
195
207
|
type?: string
|
|
196
208
|
parser?: RawModuleRuleParser
|
|
197
209
|
generator?: RawModuleRuleGenerator
|
|
198
210
|
resolve?: RawResolveOptions
|
|
199
|
-
issuer?:
|
|
211
|
+
issuer?: RawRuleSetCondition
|
|
200
212
|
oneOf?: Array<RawModuleRule>
|
|
201
213
|
}
|
|
202
214
|
export interface RawModuleRuleGenerator {
|
|
@@ -244,6 +256,7 @@ export interface JsLoaderResult {
|
|
|
244
256
|
}
|
|
245
257
|
export interface RawNodeOption {
|
|
246
258
|
dirname: string
|
|
259
|
+
global: string
|
|
247
260
|
}
|
|
248
261
|
export interface RawOptimizationOptions {
|
|
249
262
|
splitChunks?: RawSplitChunksOptions
|
|
@@ -251,6 +264,24 @@ export interface RawOptimizationOptions {
|
|
|
251
264
|
removeAvailableModules: boolean
|
|
252
265
|
sideEffects: string
|
|
253
266
|
}
|
|
267
|
+
export interface RawLibraryName {
|
|
268
|
+
amd?: string
|
|
269
|
+
commonjs?: string
|
|
270
|
+
root?: Array<string>
|
|
271
|
+
}
|
|
272
|
+
export interface RawLibraryAuxiliaryComment {
|
|
273
|
+
root?: string
|
|
274
|
+
commonjs?: string
|
|
275
|
+
commonjs2?: string
|
|
276
|
+
amd?: string
|
|
277
|
+
}
|
|
278
|
+
export interface RawLibraryOptions {
|
|
279
|
+
name?: RawLibraryName
|
|
280
|
+
export?: Array<string>
|
|
281
|
+
libraryType: string
|
|
282
|
+
umdNamedDefine?: boolean
|
|
283
|
+
auxiliaryComment?: RawLibraryAuxiliaryComment
|
|
284
|
+
}
|
|
254
285
|
export interface RawOutputOptions {
|
|
255
286
|
path: string
|
|
256
287
|
publicPath: string
|
|
@@ -260,8 +291,11 @@ export interface RawOutputOptions {
|
|
|
260
291
|
cssFilename: string
|
|
261
292
|
cssChunkFilename: string
|
|
262
293
|
uniqueName: string
|
|
263
|
-
library?:
|
|
294
|
+
library?: RawLibraryOptions
|
|
264
295
|
strictModuleErrorHandling: boolean
|
|
296
|
+
enabledLibraryTypes?: Array<string>
|
|
297
|
+
globalObject: string
|
|
298
|
+
importFunctionName: string
|
|
265
299
|
}
|
|
266
300
|
export interface RawResolveOptions {
|
|
267
301
|
preferRelative?: boolean
|
|
@@ -317,7 +351,7 @@ export interface RawOptions {
|
|
|
317
351
|
module: RawModuleOptions
|
|
318
352
|
builtins: RawBuiltins
|
|
319
353
|
externals: Record<string, string>
|
|
320
|
-
externalsType:
|
|
354
|
+
externalsType: string
|
|
321
355
|
devtool: string
|
|
322
356
|
optimization: RawOptimizationOptions
|
|
323
357
|
stats: RawStatsOptions
|
|
@@ -446,26 +480,23 @@ export interface JsStatsChunk {
|
|
|
446
480
|
names: Array<string>
|
|
447
481
|
size: number
|
|
448
482
|
}
|
|
449
|
-
export interface
|
|
483
|
+
export interface JsStatsChunkGroupAsset {
|
|
450
484
|
name: string
|
|
451
485
|
size: number
|
|
452
486
|
}
|
|
453
|
-
export interface
|
|
487
|
+
export interface JsStatsChunkGroup {
|
|
454
488
|
name: string
|
|
455
|
-
assets: Array<
|
|
489
|
+
assets: Array<JsStatsChunkGroupAsset>
|
|
456
490
|
chunks: Array<string>
|
|
457
491
|
assetsSize: number
|
|
458
492
|
}
|
|
459
|
-
export interface
|
|
493
|
+
export interface JsStatsAssetsByChunkName {
|
|
494
|
+
name: string
|
|
495
|
+
files: Array<string>
|
|
496
|
+
}
|
|
497
|
+
export interface JsStatsGetAssets {
|
|
460
498
|
assets: Array<JsStatsAsset>
|
|
461
|
-
|
|
462
|
-
chunks: Array<JsStatsChunk>
|
|
463
|
-
entrypoints: Array<JsStatsEntrypoint>
|
|
464
|
-
errors: Array<JsStatsError>
|
|
465
|
-
errorsCount: number
|
|
466
|
-
warnings: Array<JsStatsWarning>
|
|
467
|
-
warningsCount: number
|
|
468
|
-
hash: string
|
|
499
|
+
assetsByChunkName: Array<JsStatsAssetsByChunkName>
|
|
469
500
|
}
|
|
470
501
|
export function initCustomTraceSubscriber(): void
|
|
471
502
|
export class JsCompilation {
|
|
@@ -499,16 +530,18 @@ export class JsCompilation {
|
|
|
499
530
|
addBuildDependencies(deps: Array<string>): void
|
|
500
531
|
}
|
|
501
532
|
export class JsStats {
|
|
502
|
-
getAssets():
|
|
533
|
+
getAssets(): JsStatsGetAssets
|
|
503
534
|
getModules(showReasons: boolean): Array<JsStatsModule>
|
|
504
535
|
getChunks(): Array<JsStatsChunk>
|
|
505
|
-
getEntrypoints(): Array<
|
|
536
|
+
getEntrypoints(): Array<JsStatsChunkGroup>
|
|
537
|
+
getNamedChunkGroups(): Array<JsStatsChunkGroup>
|
|
506
538
|
getErrors(): Array<JsStatsError>
|
|
507
539
|
getWarnings(): Array<JsStatsWarning>
|
|
508
540
|
getHash(): string
|
|
509
541
|
}
|
|
510
542
|
export class Rspack {
|
|
511
543
|
constructor(options: RawOptions, jsHooks: JsHooks | undefined | null, outputFilesystem: ThreadsafeNodeFS)
|
|
544
|
+
unsafe_set_disabled_hooks(hooks: Array<string>): void
|
|
512
545
|
/**
|
|
513
546
|
* Build with the given option passed to the constructor
|
|
514
547
|
*
|
package/binding.js
CHANGED
|
@@ -11,7 +11,8 @@ function isMusl() {
|
|
|
11
11
|
// For Node 10
|
|
12
12
|
if (!process.report || typeof process.report.getReport !== 'function') {
|
|
13
13
|
try {
|
|
14
|
-
|
|
14
|
+
const lddPath = require('child_process').execSync('which ldd').toString().trim();
|
|
15
|
+
return readFileSync(lddPath, 'utf8').includes('musl')
|
|
15
16
|
} catch (e) {
|
|
16
17
|
return true
|
|
17
18
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/binding",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.25",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Node binding for rspack",
|
|
6
6
|
"main": "binding.js",
|
|
@@ -13,27 +13,36 @@
|
|
|
13
13
|
"binding.d.ts"
|
|
14
14
|
],
|
|
15
15
|
"homepage": "https://rspack.org",
|
|
16
|
-
"bugs": "https://github.com/
|
|
17
|
-
"repository": "
|
|
16
|
+
"bugs": "https://github.com/web-infra-dev/rspack/issues",
|
|
17
|
+
"repository": "web-infra-dev/rspack",
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@napi-rs/cli": "2.14.2",
|
|
20
20
|
"why-is-node-running": "2.2.1",
|
|
21
21
|
"npm-run-all": "4.1.5"
|
|
22
22
|
},
|
|
23
|
+
"napi": {
|
|
24
|
+
"name": "rspack"
|
|
25
|
+
},
|
|
23
26
|
"optionalDependencies": {
|
|
24
|
-
"@rspack/binding-
|
|
25
|
-
"@rspack/binding-
|
|
26
|
-
"@rspack/binding-win32-
|
|
27
|
-
"@rspack/binding-
|
|
27
|
+
"@rspack/binding-darwin-arm64": "0.0.25",
|
|
28
|
+
"@rspack/binding-linux-arm64-gnu": "0.0.25",
|
|
29
|
+
"@rspack/binding-win32-arm64-msvc": "0.0.25",
|
|
30
|
+
"@rspack/binding-linux-arm64-musl": "0.0.25",
|
|
31
|
+
"@rspack/binding-win32-ia32-msvc": "0.0.25",
|
|
32
|
+
"@rspack/binding-darwin-x64": "0.0.25",
|
|
33
|
+
"@rspack/binding-win32-x64-msvc": "0.0.25",
|
|
34
|
+
"@rspack/binding-linux-x64-gnu": "0.0.25",
|
|
35
|
+
"@rspack/binding-linux-x64-musl": "0.0.25"
|
|
28
36
|
},
|
|
29
37
|
"scripts": {
|
|
30
|
-
"build:debug": "
|
|
31
|
-
"build:debug:x64": "
|
|
38
|
+
"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",
|
|
32
41
|
"build:release:all": "run-p build:release build:release:x64 build:release:linux && pnpm move-binding",
|
|
33
|
-
"build:release": "
|
|
34
|
-
"build:release:x64": "
|
|
35
|
-
"build:release:linux": "
|
|
36
|
-
"build:release:win": "
|
|
42
|
+
"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",
|
|
37
46
|
"move-binding": "node scripts/move-binding"
|
|
38
47
|
}
|
|
39
48
|
}
|