@rspack/binding 0.0.10 → 0.0.12

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 CHANGED
@@ -14,7 +14,8 @@ export interface RawCssPluginConfig {
14
14
  * The preset_env will finally pass into [`browserslist::resolve`](https://docs.rs/browserslist-rs/latest/browserslist/fn.resolve.html).
15
15
  * For detailed configuration, see https://docs.rs/browserslist-rs/latest/browserslist/
16
16
  */
17
- presetEnv: Array<string>
17
+ presetEnv?: Array<string>
18
+ modules?: boolean
18
19
  }
19
20
  export interface RawDecoratorOptions {
20
21
  legacy: boolean
@@ -71,22 +72,42 @@ export interface RawReactOptions {
71
72
  useSpread?: boolean
72
73
  refresh?: boolean
73
74
  }
75
+ export interface Minification {
76
+ passes?: number
77
+ enable?: boolean
78
+ }
74
79
  export interface RawBuiltins {
75
80
  html?: Array<RawHtmlPluginConfig>
76
81
  css?: RawCssPluginConfig
77
82
  postcss?: RawPostCssConfig
78
- minify?: boolean
83
+ minify?: Minification
79
84
  polyfill?: boolean
80
85
  browserslist?: Array<string>
81
86
  define?: Record<string, string>
82
87
  treeShaking?: boolean
88
+ sideEffects?: boolean
83
89
  progress?: RawProgressPluginConfig
84
90
  react?: RawReactOptions
85
91
  decorator?: RawDecoratorOptions
86
92
  }
93
+ export interface RawCacheOptions {
94
+ cacheType: string
95
+ maxGenerations: number
96
+ maxAge: number
97
+ profile: boolean
98
+ buildDependencies: Array<string>
99
+ cacheDirectory: string
100
+ cacheLocation: string
101
+ name: string
102
+ version: string
103
+ }
87
104
  export interface RawDevServer {
88
105
  hot?: boolean
89
106
  }
107
+ export interface RawEntryItem {
108
+ import: Array<string>
109
+ runtime?: string
110
+ }
90
111
  /**
91
112
  * `loader` is for js side loader, `builtin_loader` is for rust side loader,
92
113
  * which is mapped to real rust side loader by [get_builtin_loader].
@@ -104,12 +125,37 @@ export interface RawModuleRuleUse {
104
125
  options?: string
105
126
  loaderName?: string
106
127
  }
128
+ export interface RawModuleRuleCondition {
129
+ /** Condition can be either a `string` or `Regexp`. */
130
+ type: "string" | "regexp"
131
+ /**
132
+ * Based on the condition type, the value can be either a `string` or `Regexp`.
133
+ * - "string": The value will be matched against the string.
134
+ * - "regexp": The value will be matched against the raw regexp source from JS side.
135
+ */
136
+ matcher?: string
137
+ }
107
138
  export interface RawModuleRule {
108
- test?: string
109
- resource?: string
110
- resourceQuery?: string
139
+ /**
140
+ * A condition matcher matching an absolute path.
141
+ * - String: To match the input must start with the provided string. I. e. an absolute directory path, or absolute path to the file.
142
+ * - Regexp: It's tested with the input.
143
+ */
144
+ test?: RawModuleRuleCondition
145
+ include?: Array<RawModuleRuleCondition>
146
+ exclude?: Array<RawModuleRuleCondition>
147
+ /**
148
+ * A condition matcher matching an absolute path.
149
+ * See `test` above
150
+ */
151
+ resource?: RawModuleRuleCondition
152
+ /**
153
+ * A condition matcher against the resource query.
154
+ * TODO: align with webpack's `?` prefixed `resourceQuery`
155
+ */
156
+ resourceQuery?: RawModuleRuleCondition
111
157
  func?: (...args: any[]) => any
112
- uses?: Array<RawModuleRuleUse>
158
+ use?: Array<RawModuleRuleUse>
113
159
  type?: "js" | "jsx" | "ts" | "tsx" | "css" | "json" | "asset" | "asset/resource" | "asset/source" | "asset/inline"
114
160
  }
115
161
  export interface RawAssetParserDataUrlOption {
@@ -134,6 +180,8 @@ export interface RawOutputOptions {
134
180
  assetModuleFilename?: string
135
181
  filename?: string
136
182
  chunkFilename?: string
183
+ cssFilename?: string
184
+ cssChunkFilename?: string
137
185
  uniqueName?: string
138
186
  }
139
187
  export interface RawResolveOptions {
@@ -145,10 +193,20 @@ export interface RawResolveOptions {
145
193
  conditionNames?: Array<string>
146
194
  alias?: Record<string, string | false>
147
195
  symlinks?: boolean
148
- tsconfig?: string
196
+ tsConfigPath?: string
197
+ }
198
+ export interface RawSnapshotStrategy {
199
+ hash: boolean
200
+ timestamp: boolean
201
+ }
202
+ export interface RawSnapshotOptions {
203
+ resolveBuildDependencies: RawSnapshotStrategy
204
+ buildDependencies: RawSnapshotStrategy
205
+ resolve: RawSnapshotStrategy
206
+ module: RawSnapshotStrategy
149
207
  }
150
208
  export interface RawSplitChunksOptions {
151
- cacheGroups: Record<string, RawCacheGroupOptions>
209
+ cacheGroups?: Record<string, RawCacheGroupOptions>
152
210
  /** What kind of chunks should be selected. */
153
211
  chunks?: string
154
212
  }
@@ -162,7 +220,7 @@ export interface RawStatsOptions {
162
220
  colors: boolean
163
221
  }
164
222
  export interface RawOptions {
165
- entry?: Record<string, string>
223
+ entry?: Record<string, RawEntryItem>
166
224
  mode?: string
167
225
  target?: string[]
168
226
  context?: string
@@ -176,6 +234,8 @@ export interface RawOptions {
176
234
  optimization?: RawOptimizationOptions
177
235
  stats?: RawStatsOptions
178
236
  devServer?: RawDevServer
237
+ snapshot?: RawSnapshotOptions
238
+ cache?: RawCacheOptions
179
239
  }
180
240
  export interface JsAssetInfoRelated {
181
241
  sourceMap?: string
@@ -196,8 +256,9 @@ export interface JsAssetInfo {
196
256
  * when asset is only used for development and doesn't count towards user-facing assets
197
257
  */
198
258
  development: boolean
259
+ /** when asset ships data for updating an existing application (HMR) */
260
+ hotModuleReplacement: boolean
199
261
  /**
200
- * when asset ships data for updating an existing application (HMR)
201
262
  * when asset is javascript and an ESM
202
263
  * related object to other assets, keyed by type of relation (only points from parent to child)
203
264
  */
@@ -243,9 +304,11 @@ export interface JsStatsAsset {
243
304
  chunks: Array<string>
244
305
  chunkNames: Array<string>
245
306
  info: JsStatsAssetInfo
307
+ emitted: boolean
246
308
  }
247
309
  export interface JsStatsAssetInfo {
248
310
  development: boolean
311
+ hotModuleReplacement: boolean
249
312
  }
250
313
  export interface JsStatsModule {
251
314
  type: string
@@ -289,7 +352,9 @@ export function initCustomTraceSubscriber(): void
289
352
  export class JsCompilation {
290
353
  updateAsset(filename: string, newSourceOrFunction: JsCompatSource | ((source: JsCompatSource) => JsCompatSource), assetInfoUpdateOrFunction?: JsAssetInfo | ((assetInfo: JsAssetInfo) => JsAssetInfo)): void
291
354
  getAssets(): Readonly<JsAsset>[]
355
+ getAsset(name: string): JsAsset | null
292
356
  emitAsset(filename: string, source: JsCompatSource, assetInfo: JsAssetInfo): void
357
+ deleteAsset(filename: string): void
293
358
  get assets(): Record<string, JsCompatSource>
294
359
  get entrypoints(): Record<string, JsChunkGroup>
295
360
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/binding",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "Node binding for rspack",
5
5
  "main": "binding.js",
6
6
  "types": "binding.d.ts",
@@ -17,11 +17,13 @@
17
17
  "license": "ISC",
18
18
  "devDependencies": {
19
19
  "@napi-rs/cli": "^2.6.2",
20
- "why-is-node-running": "2.2.1"
20
+ "why-is-node-running": "2.2.1",
21
+ "npm-run-all": "4.1.5"
21
22
  },
22
23
  "scripts": {
23
- "build": "napi build --platform --js false --dts binding.d.ts --config napirs.rc.json",
24
- "build:release:all": "pnpm build:release && pnpm build:release:x64 && pnpm build:release:linux",
24
+ "build:debug": "napi build --platform --js false --dts binding.d.ts --config napirs.rc.json",
25
+ "build:debug:x64": "napi build --platform --js false --dts binding.d.ts --config napirs.rc.json --target x86_64-apple-darwin",
26
+ "build:release:all": "run-p build:release build:release:x64 build:release:linux",
25
27
  "build:release": "napi build --release --platform --js false --dts binding.d.ts --config napirs.rc.json",
26
28
  "build:release:x64": "napi build --release --platform --js false --dts binding.d.ts --config napirs.rc.json --target x86_64-apple-darwin",
27
29
  "build:release:linux": "napi build --release --platform --js false --dts binding.d.ts --config napirs.rc.json --zig --target x86_64-unknown-linux-gnu --zig-abi-suffix=2.17"
Binary file
Binary file
Binary file