@rspack/binding 0.0.22 → 0.0.23
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/LICENSE +2 -1
- package/binding.d.ts +107 -75
- package/package.json +9 -8
package/LICENSE
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2022-present
|
|
3
|
+
Copyright (c) 2022-present Bytedance, Inc. and its affiliates.
|
|
4
|
+
|
|
4
5
|
|
|
5
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
7
|
of this software and associated documentation files (the "Software"), to deal
|
package/binding.d.ts
CHANGED
|
@@ -3,48 +3,61 @@
|
|
|
3
3
|
|
|
4
4
|
/* auto-generated by NAPI-RS */
|
|
5
5
|
|
|
6
|
+
export interface ThreadsafeNodeFs {
|
|
7
|
+
writeFile: (...args: any[]) => any
|
|
8
|
+
mkdir: (...args: any[]) => any
|
|
9
|
+
mkdirp: (...args: any[]) => any
|
|
10
|
+
}
|
|
11
|
+
export interface NodeFs {
|
|
12
|
+
writeFile: (...args: any[]) => any
|
|
13
|
+
mkdir: (...args: any[]) => any
|
|
14
|
+
mkdirp: (...args: any[]) => any
|
|
15
|
+
}
|
|
16
|
+
export interface RawPattern {
|
|
17
|
+
from: string
|
|
18
|
+
to?: string
|
|
19
|
+
context?: string
|
|
20
|
+
toType?: string
|
|
21
|
+
noErrorOnMissing: boolean
|
|
22
|
+
force: boolean
|
|
23
|
+
priority: number
|
|
24
|
+
globOptions: RawGlobOptions
|
|
25
|
+
}
|
|
26
|
+
export interface RawGlobOptions {
|
|
27
|
+
caseSensitiveMatch?: boolean
|
|
28
|
+
dot?: boolean
|
|
29
|
+
}
|
|
30
|
+
export interface RawCopyConfig {
|
|
31
|
+
patterns: Array<RawPattern>
|
|
32
|
+
}
|
|
6
33
|
export interface RawCssPluginConfig {
|
|
7
|
-
|
|
8
|
-
* ## Example
|
|
9
|
-
* ```rust,ignore
|
|
10
|
-
* RawCssOptions {
|
|
11
|
-
* preset_env: vec!["Firefox > 10".into(), "chrome >=20".into()],
|
|
12
|
-
* }
|
|
13
|
-
* ```
|
|
14
|
-
* The preset_env will finally pass into [`browserslist::resolve`](https://docs.rs/browserslist-rs/latest/browserslist/fn.resolve.html).
|
|
15
|
-
* For detailed configuration, see https://docs.rs/browserslist-rs/latest/browserslist/
|
|
16
|
-
*/
|
|
17
|
-
presetEnv?: Array<string>
|
|
18
|
-
modules?: RawCssModulesConfig
|
|
34
|
+
modules: RawCssModulesConfig
|
|
19
35
|
}
|
|
20
36
|
export interface RawCssModulesConfig {
|
|
21
|
-
localsConvention
|
|
22
|
-
localIdentName
|
|
23
|
-
exportsOnly
|
|
37
|
+
localsConvention: string
|
|
38
|
+
localIdentName: string
|
|
39
|
+
exportsOnly: boolean
|
|
24
40
|
}
|
|
25
41
|
export interface RawDecoratorOptions {
|
|
26
42
|
legacy: boolean
|
|
27
43
|
emitMetadata: boolean
|
|
28
44
|
}
|
|
29
|
-
/**
|
|
30
|
-
* It seems napi not support enum well
|
|
31
|
-
*/
|
|
32
45
|
export interface RawHtmlPluginConfig {
|
|
33
46
|
/** emitted file name in output path */
|
|
34
|
-
filename?: string
|
|
47
|
+
filename?: string
|
|
35
48
|
/** template html file */
|
|
36
49
|
template?: string
|
|
37
50
|
templateParameters?: Record<string, string>
|
|
38
51
|
/** `head`, `body` or None */
|
|
39
|
-
inject?:
|
|
52
|
+
inject?: "head" | "body"
|
|
40
53
|
/** path or `auto` */
|
|
41
54
|
publicPath?: string
|
|
42
55
|
/** `blocking`, `defer`, or `module` */
|
|
43
|
-
scriptLoading?:
|
|
56
|
+
scriptLoading?: "blocking" | "defer" | "module"
|
|
44
57
|
/** entry_chunk_name (only entry chunks are supported) */
|
|
45
58
|
chunks?: Array<string>
|
|
46
59
|
excludedChunks?: Array<string>
|
|
47
|
-
sri?:
|
|
60
|
+
sri?: "sha256" | "sha384" | "sha512"
|
|
48
61
|
minify?: boolean
|
|
49
62
|
title?: string
|
|
50
63
|
favicon?: string
|
|
@@ -66,7 +79,7 @@ export interface RawProgressPluginConfig {
|
|
|
66
79
|
prefix?: string
|
|
67
80
|
}
|
|
68
81
|
export interface RawReactOptions {
|
|
69
|
-
runtime?:
|
|
82
|
+
runtime?: "automatic" | "classic"
|
|
70
83
|
importSource?: string
|
|
71
84
|
pragma?: string
|
|
72
85
|
pragmaFrag?: string
|
|
@@ -76,27 +89,31 @@ export interface RawReactOptions {
|
|
|
76
89
|
useSpread?: boolean
|
|
77
90
|
refresh?: boolean
|
|
78
91
|
}
|
|
79
|
-
export interface
|
|
80
|
-
passes
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
92
|
+
export interface RawMinification {
|
|
93
|
+
passes: number
|
|
94
|
+
dropConsole: boolean
|
|
95
|
+
pureFuncs: Array<string>
|
|
96
|
+
}
|
|
97
|
+
export interface RawPresetEnv {
|
|
98
|
+
targets: Array<string>
|
|
99
|
+
mode?: 'usage' | 'entry'
|
|
100
|
+
coreJs?: string
|
|
84
101
|
}
|
|
85
102
|
export interface RawBuiltins {
|
|
86
103
|
html?: Array<RawHtmlPluginConfig>
|
|
87
104
|
css?: RawCssPluginConfig
|
|
88
105
|
postcss?: RawPostCssConfig
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
treeShaking?: boolean
|
|
94
|
-
sideEffects?: boolean
|
|
106
|
+
minifyOptions?: RawMinification
|
|
107
|
+
presetEnv?: RawPresetEnv
|
|
108
|
+
define: Record<string, string>
|
|
109
|
+
treeShaking: boolean
|
|
95
110
|
progress?: RawProgressPluginConfig
|
|
96
|
-
react
|
|
111
|
+
react: RawReactOptions
|
|
97
112
|
decorator?: RawDecoratorOptions
|
|
98
|
-
noEmitAssets
|
|
113
|
+
noEmitAssets: boolean
|
|
99
114
|
emotion?: string
|
|
115
|
+
devFriendlySplitChunks: boolean
|
|
116
|
+
copy?: RawCopyConfig
|
|
100
117
|
}
|
|
101
118
|
export interface RawCacheOptions {
|
|
102
119
|
type: string
|
|
@@ -110,7 +127,7 @@ export interface RawCacheOptions {
|
|
|
110
127
|
version: string
|
|
111
128
|
}
|
|
112
129
|
export interface RawDevServer {
|
|
113
|
-
hot
|
|
130
|
+
hot: boolean
|
|
114
131
|
}
|
|
115
132
|
export interface RawEntryItem {
|
|
116
133
|
import: Array<string>
|
|
@@ -118,7 +135,7 @@ export interface RawEntryItem {
|
|
|
118
135
|
}
|
|
119
136
|
export interface RawExperiments {
|
|
120
137
|
lazyCompilation: boolean
|
|
121
|
-
|
|
138
|
+
incrementalRebuild: boolean
|
|
122
139
|
}
|
|
123
140
|
/**
|
|
124
141
|
* `loader` is for js side loader, `builtin_loader` is for rust side loader,
|
|
@@ -132,10 +149,14 @@ export interface RawExperiments {
|
|
|
132
149
|
* `builtin_loader`.
|
|
133
150
|
*/
|
|
134
151
|
export interface RawModuleRuleUse {
|
|
135
|
-
|
|
152
|
+
jsLoader?: JsLoader
|
|
136
153
|
builtinLoader?: string
|
|
137
154
|
options?: string
|
|
138
|
-
|
|
155
|
+
}
|
|
156
|
+
export interface JsLoader {
|
|
157
|
+
/** composed loader name, xx-loader!yy-loader!zz-loader */
|
|
158
|
+
name: string
|
|
159
|
+
func: (...args: any[]) => any
|
|
139
160
|
}
|
|
140
161
|
export interface RawModuleRuleCondition {
|
|
141
162
|
/** Condition can be either a `string` or `Regexp`. */
|
|
@@ -171,12 +192,12 @@ export interface RawModuleRule {
|
|
|
171
192
|
resourceQuery?: RawModuleRuleCondition
|
|
172
193
|
sideEffects?: boolean
|
|
173
194
|
use?: Array<RawModuleRuleUse>
|
|
174
|
-
type?:
|
|
195
|
+
type?: string
|
|
175
196
|
parser?: RawModuleRuleParser
|
|
176
197
|
generator?: RawModuleRuleGenerator
|
|
177
198
|
resolve?: RawResolveOptions
|
|
178
199
|
issuer?: RawIssuerOptions
|
|
179
|
-
|
|
200
|
+
oneOf?: Array<RawModuleRule>
|
|
180
201
|
}
|
|
181
202
|
export interface RawModuleRuleGenerator {
|
|
182
203
|
filename?: string
|
|
@@ -222,24 +243,25 @@ export interface JsLoaderResult {
|
|
|
222
243
|
cacheable: boolean
|
|
223
244
|
}
|
|
224
245
|
export interface RawNodeOption {
|
|
225
|
-
dirname
|
|
246
|
+
dirname: string
|
|
226
247
|
}
|
|
227
248
|
export interface RawOptimizationOptions {
|
|
228
249
|
splitChunks?: RawSplitChunksOptions
|
|
229
|
-
moduleIds
|
|
230
|
-
removeAvailableModules
|
|
250
|
+
moduleIds: string
|
|
251
|
+
removeAvailableModules: boolean
|
|
252
|
+
sideEffects: string
|
|
231
253
|
}
|
|
232
254
|
export interface RawOutputOptions {
|
|
233
|
-
path
|
|
234
|
-
publicPath
|
|
235
|
-
assetModuleFilename
|
|
236
|
-
filename
|
|
237
|
-
chunkFilename
|
|
238
|
-
cssFilename
|
|
239
|
-
cssChunkFilename
|
|
240
|
-
uniqueName
|
|
255
|
+
path: string
|
|
256
|
+
publicPath: string
|
|
257
|
+
assetModuleFilename: string
|
|
258
|
+
filename: string
|
|
259
|
+
chunkFilename: string
|
|
260
|
+
cssFilename: string
|
|
261
|
+
cssChunkFilename: string
|
|
262
|
+
uniqueName: string
|
|
241
263
|
library?: string
|
|
242
|
-
strictModuleErrorHandling
|
|
264
|
+
strictModuleErrorHandling: boolean
|
|
243
265
|
}
|
|
244
266
|
export interface RawResolveOptions {
|
|
245
267
|
preferRelative?: boolean
|
|
@@ -259,8 +281,6 @@ export interface RawSnapshotStrategy {
|
|
|
259
281
|
timestamp: boolean
|
|
260
282
|
}
|
|
261
283
|
export interface RawSnapshotOptions {
|
|
262
|
-
resolveBuildDependencies: RawSnapshotStrategy
|
|
263
|
-
buildDependencies: RawSnapshotStrategy
|
|
264
284
|
resolve: RawSnapshotStrategy
|
|
265
285
|
module: RawSnapshotStrategy
|
|
266
286
|
}
|
|
@@ -288,24 +308,24 @@ export interface RawStatsOptions {
|
|
|
288
308
|
colors: boolean
|
|
289
309
|
}
|
|
290
310
|
export interface RawOptions {
|
|
291
|
-
entry
|
|
292
|
-
mode?:
|
|
293
|
-
target
|
|
294
|
-
context
|
|
295
|
-
output
|
|
296
|
-
resolve
|
|
297
|
-
module
|
|
298
|
-
builtins
|
|
299
|
-
externals
|
|
300
|
-
externalsType
|
|
301
|
-
devtool
|
|
302
|
-
optimization
|
|
303
|
-
stats
|
|
304
|
-
devServer
|
|
305
|
-
snapshot
|
|
306
|
-
cache
|
|
307
|
-
experiments
|
|
308
|
-
node
|
|
311
|
+
entry: Record<string, RawEntryItem>
|
|
312
|
+
mode?: undefined | 'production' | 'development' | 'none'
|
|
313
|
+
target: Array<string>
|
|
314
|
+
context: string
|
|
315
|
+
output: RawOutputOptions
|
|
316
|
+
resolve: RawResolveOptions
|
|
317
|
+
module: RawModuleOptions
|
|
318
|
+
builtins: RawBuiltins
|
|
319
|
+
externals: Record<string, string>
|
|
320
|
+
externalsType: '' | 'node-commonjs' | 'window'
|
|
321
|
+
devtool: string
|
|
322
|
+
optimization: RawOptimizationOptions
|
|
323
|
+
stats: RawStatsOptions
|
|
324
|
+
devServer: RawDevServer
|
|
325
|
+
snapshot: RawSnapshotOptions
|
|
326
|
+
cache: RawCacheOptions
|
|
327
|
+
experiments: RawExperiments
|
|
328
|
+
node: RawNodeOption
|
|
309
329
|
}
|
|
310
330
|
export interface JsAssetInfoRelated {
|
|
311
331
|
sourceMap?: string
|
|
@@ -357,6 +377,12 @@ export interface JsHooks {
|
|
|
357
377
|
emit: (...args: any[]) => any
|
|
358
378
|
afterEmit: (...args: any[]) => any
|
|
359
379
|
make: (...args: any[]) => any
|
|
380
|
+
optimizeChunkModule: (...args: any[]) => any
|
|
381
|
+
}
|
|
382
|
+
export interface JsModule {
|
|
383
|
+
originalSource?: JsCompatSource
|
|
384
|
+
resource: string
|
|
385
|
+
moduleIdentifier: string
|
|
360
386
|
}
|
|
361
387
|
export interface JsCompatSource {
|
|
362
388
|
/** Whether the underlying data structure is a `RawSource` */
|
|
@@ -447,6 +473,12 @@ export class JsCompilation {
|
|
|
447
473
|
getAssets(): Readonly<JsAsset>[]
|
|
448
474
|
getAsset(name: string): JsAsset | null
|
|
449
475
|
getAssetSource(name: string): JsCompatSource | null
|
|
476
|
+
getModules(): Array<JsModule>
|
|
477
|
+
/**
|
|
478
|
+
* Only available for those none Js and Css source,
|
|
479
|
+
* return true if set module source successfully, false if failed.
|
|
480
|
+
*/
|
|
481
|
+
setNoneAstModuleSource(moduleIdentifier: string, source: JsCompatSource): boolean
|
|
450
482
|
setAssetSource(name: string, source: JsCompatSource): void
|
|
451
483
|
deleteAssetSource(name: string): void
|
|
452
484
|
getAssetFilenames(): Array<string>
|
|
@@ -476,7 +508,7 @@ export class JsStats {
|
|
|
476
508
|
getHash(): string
|
|
477
509
|
}
|
|
478
510
|
export class Rspack {
|
|
479
|
-
constructor(options: RawOptions, jsHooks
|
|
511
|
+
constructor(options: RawOptions, jsHooks: JsHooks | undefined | null, outputFilesystem: ThreadsafeNodeFS)
|
|
480
512
|
/**
|
|
481
513
|
* Build with the given option passed to the constructor
|
|
482
514
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/binding",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.23",
|
|
4
|
+
"license": "MIT",
|
|
4
5
|
"description": "Node binding for rspack",
|
|
5
6
|
"main": "binding.js",
|
|
6
7
|
"types": "binding.d.ts",
|
|
@@ -11,19 +12,19 @@
|
|
|
11
12
|
"binding.js",
|
|
12
13
|
"binding.d.ts"
|
|
13
14
|
],
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
15
|
+
"homepage": "https://rspack.org",
|
|
16
|
+
"bugs": "https://github.com/modern-js-dev/rspack/issues",
|
|
17
|
+
"repository": "modern-js-dev/rspack",
|
|
17
18
|
"devDependencies": {
|
|
18
19
|
"@napi-rs/cli": "2.14.2",
|
|
19
20
|
"why-is-node-running": "2.2.1",
|
|
20
21
|
"npm-run-all": "4.1.5"
|
|
21
22
|
},
|
|
22
23
|
"optionalDependencies": {
|
|
23
|
-
"@rspack/binding-
|
|
24
|
-
"@rspack/binding-darwin-
|
|
25
|
-
"@rspack/binding-win32-x64-msvc": "0.0.
|
|
26
|
-
"@rspack/binding-
|
|
24
|
+
"@rspack/binding-linux-x64-gnu": "0.0.23",
|
|
25
|
+
"@rspack/binding-darwin-x64": "0.0.23",
|
|
26
|
+
"@rspack/binding-win32-x64-msvc": "0.0.23",
|
|
27
|
+
"@rspack/binding-darwin-arm64": "0.0.23"
|
|
27
28
|
},
|
|
28
29
|
"scripts": {
|
|
29
30
|
"build:debug": "napi build --platform --js false --dts binding.d.ts --config napirs.rc.json",
|