@rspack/binding 0.0.2 → 0.0.3
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 +128 -0
- package/package.json +10 -5
- package/rspack.darwin-arm64.node +0 -0
- package/Cargo.lock +0 -4322
- package/Cargo.toml +0 -44
- package/build.rs +0 -5
- package/napirs.rc.json +0 -20
- package/src/adapter/common.rs +0 -11
- package/src/adapter/mod.rs +0 -124
- package/src/adapter/utils.rs +0 -62
- package/src/lib.rs +0 -272
- package/src/utils.rs +0 -88
- package/tests/answer.js +0 -1
- package/tests/binding.spec.ts +0 -19
- package/tests/index.js +0 -2
package/binding.d.ts
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/* auto-generated by NAPI-RS */
|
|
5
|
+
|
|
6
|
+
export class ExternalObject<T> {
|
|
7
|
+
readonly '': {
|
|
8
|
+
readonly '': unique symbol
|
|
9
|
+
[K: symbol]: T
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export interface RawCssPluginConfig {
|
|
13
|
+
/**
|
|
14
|
+
* ## Example
|
|
15
|
+
* ```rust,ignore
|
|
16
|
+
* RawCssOptions {
|
|
17
|
+
* preset_env: vec!["Firefox > 10".into(), "chrome >=20".into()],
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
* The preset_env will finally pass into [`browserslist::resolve`](https://docs.rs/browserslist-rs/latest/browserslist/fn.resolve.html).
|
|
21
|
+
* For detailed configuration, see https://docs.rs/browserslist-rs/latest/browserslist/
|
|
22
|
+
*/
|
|
23
|
+
presetEnv: Array<string>
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* It seems napi not support enum well
|
|
27
|
+
*/
|
|
28
|
+
export interface RawHtmlPluginConfig {
|
|
29
|
+
/** emitted file name in output path */
|
|
30
|
+
filename?: string | void
|
|
31
|
+
/** template html file */
|
|
32
|
+
template?: string
|
|
33
|
+
/** `head`, `body` or None */
|
|
34
|
+
inject?: string | void
|
|
35
|
+
/** path or `auto` */
|
|
36
|
+
publicPath?: string
|
|
37
|
+
/** `blocking`, `defer`, or `module` */
|
|
38
|
+
scriptLoading?: string | void
|
|
39
|
+
/** entry_chunk_name (only entry chunks are supported) */
|
|
40
|
+
chunks?: Array<string>
|
|
41
|
+
excludedChunks?: Array<string>
|
|
42
|
+
sri?: string | void
|
|
43
|
+
}
|
|
44
|
+
export interface RawBuiltins {
|
|
45
|
+
html?: Array<RawHtmlPluginConfig>
|
|
46
|
+
css?: RawCssPluginConfig
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* `loader` is for js side loader, `builtin_loader` is for rust side loader,
|
|
50
|
+
* which is mapped to real rust side loader by [get_builtin_loader].
|
|
51
|
+
*
|
|
52
|
+
* `options` is
|
|
53
|
+
* - a `None` on rust side and handled by js side `getOptions` when
|
|
54
|
+
* using with `loader`.
|
|
55
|
+
* - a `Some(string)` on rust side, deserialized by `serde_json::from_str`
|
|
56
|
+
* and passed to rust side loader in [get_builtin_loader] when using with
|
|
57
|
+
* `builtin_loader`.
|
|
58
|
+
*/
|
|
59
|
+
export interface RawModuleRuleUse {
|
|
60
|
+
loader?: (...args: any[]) => any
|
|
61
|
+
builtinLoader?: string
|
|
62
|
+
options?: string
|
|
63
|
+
loaderName?: string
|
|
64
|
+
}
|
|
65
|
+
export interface RawModuleRule {
|
|
66
|
+
test?: string
|
|
67
|
+
resource?: string
|
|
68
|
+
resourceQuery?: string
|
|
69
|
+
func?: (...args: any[]) => any
|
|
70
|
+
uses?: Array<RawModuleRuleUse>
|
|
71
|
+
type?: "js" | "jsx" | "ts" | "tsx" | "css" | "json" | "asset" | "asset/resource" | "asset/source" | "asset/inline"
|
|
72
|
+
}
|
|
73
|
+
export interface RawAssetParserDataUrlOption {
|
|
74
|
+
maxSize?: number
|
|
75
|
+
}
|
|
76
|
+
export interface RawAssetParserOptions {
|
|
77
|
+
dataUrlCondition?: RawAssetParserDataUrlOption
|
|
78
|
+
}
|
|
79
|
+
export interface RawParserOptions {
|
|
80
|
+
asset?: RawAssetParserOptions
|
|
81
|
+
}
|
|
82
|
+
export interface RawModuleOptions {
|
|
83
|
+
rules: Array<RawModuleRule>
|
|
84
|
+
parser?: RawParserOptions
|
|
85
|
+
}
|
|
86
|
+
export interface RawOutputOptions {
|
|
87
|
+
path?: string
|
|
88
|
+
publicPath?: string
|
|
89
|
+
assetModuleFilename?: string
|
|
90
|
+
filename?: string
|
|
91
|
+
chunkFilename?: string
|
|
92
|
+
uniqueName?: string
|
|
93
|
+
}
|
|
94
|
+
export interface RawResolveOptions {
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
export interface RawOptions {
|
|
98
|
+
entry?: Record<string, string>
|
|
99
|
+
mode?: string
|
|
100
|
+
target?: string
|
|
101
|
+
context?: string
|
|
102
|
+
output?: RawOutputOptions
|
|
103
|
+
resolve?: RawResolveOptions
|
|
104
|
+
module?: RawModuleOptions
|
|
105
|
+
builtins?: RawBuiltins
|
|
106
|
+
define?: Record<string, string>
|
|
107
|
+
external?: Record<string, string>
|
|
108
|
+
}
|
|
109
|
+
export interface OnLoadContext {
|
|
110
|
+
id: string
|
|
111
|
+
}
|
|
112
|
+
export function initCustomTraceSubscriber(): void
|
|
113
|
+
export interface PluginCallbacks {
|
|
114
|
+
doneCallback: (...args: any[]) => any
|
|
115
|
+
}
|
|
116
|
+
export interface RspackError {
|
|
117
|
+
message: string
|
|
118
|
+
}
|
|
119
|
+
export interface Stats {
|
|
120
|
+
errors: Array<RspackError>
|
|
121
|
+
}
|
|
122
|
+
export function initTraceSubscriber(): void
|
|
123
|
+
export function newRspack(options: RawOptions, pluginCallbacks?: PluginCallbacks | undefined | null): ExternalObject<RspackInternal>
|
|
124
|
+
export function build(rspack: ExternalObject<RspackInternal>): Promise<Stats>
|
|
125
|
+
export function rebuild(rspack: ExternalObject<RspackInternal>): Promise<Record<string, string>>
|
|
126
|
+
export interface RspackInternal {
|
|
127
|
+
|
|
128
|
+
}
|
package/package.json
CHANGED
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/binding",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Node binding for rspack",
|
|
5
5
|
"main": "binding.js",
|
|
6
6
|
"types": "binding.d.ts",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
10
|
+
"files": [
|
|
11
|
+
"binding.js",
|
|
12
|
+
"binding.d.ts",
|
|
13
|
+
"*.node"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "napi build --platform --js false --dts binding.d.ts --config napirs.rc.json",
|
|
17
|
+
"build:release": "napi build --release --platform --js false --dts binding.d.ts --config napirs.rc.json"
|
|
18
|
+
},
|
|
10
19
|
"keywords": [],
|
|
11
20
|
"author": "",
|
|
12
21
|
"license": "ISC",
|
|
13
22
|
"devDependencies": {
|
|
14
23
|
"@napi-rs/cli": "^2.6.2",
|
|
15
24
|
"why-is-node-running": "2.2.1"
|
|
16
|
-
},
|
|
17
|
-
"scripts": {
|
|
18
|
-
"build": "napi build --platform --js false --dts binding.d.ts --config napirs.rc.json",
|
|
19
|
-
"build:release": "napi build --release --platform --js false --dts binding.d.ts --config napirs.rc.json"
|
|
20
25
|
}
|
|
21
26
|
}
|
|
Binary file
|