@rspack/binding 0.0.8 → 0.0.10

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
@@ -84,6 +84,9 @@ export interface RawBuiltins {
84
84
  react?: RawReactOptions
85
85
  decorator?: RawDecoratorOptions
86
86
  }
87
+ export interface RawDevServer {
88
+ hot?: boolean
89
+ }
87
90
  /**
88
91
  * `loader` is for js side loader, `builtin_loader` is for rust side loader,
89
92
  * which is mapped to real rust side loader by [get_builtin_loader].
@@ -172,19 +175,12 @@ export interface RawOptions {
172
175
  devtool?: string
173
176
  optimization?: RawOptimizationOptions
174
177
  stats?: RawStatsOptions
178
+ devServer?: RawDevServer
175
179
  }
176
- export interface AssetContent {
177
- buffer?: Buffer
178
- source?: string
179
- }
180
- export interface UpdateAssetOptions {
181
- asset: AssetContent
182
- filename: string
183
- }
184
- export interface AssetInfoRelated {
180
+ export interface JsAssetInfoRelated {
185
181
  sourceMap?: string
186
182
  }
187
- export interface AssetInfo {
183
+ export interface JsAssetInfo {
188
184
  /**
189
185
  * if the asset can be long term cached forever (contains a hash)
190
186
  * whether the asset is minimized
@@ -205,18 +201,24 @@ export interface AssetInfo {
205
201
  * when asset is javascript and an ESM
206
202
  * related object to other assets, keyed by type of relation (only points from parent to child)
207
203
  */
208
- related: AssetInfoRelated
204
+ related: JsAssetInfoRelated
209
205
  }
210
- export interface Asset {
206
+ export interface JsAsset {
211
207
  name: string
212
208
  source: JsCompatSource
213
- info: AssetInfo
209
+ info: JsAssetInfo
210
+ }
211
+ export interface JsChunk {
212
+ files: Array<string>
213
+ }
214
+ export interface JsChunkGroup {
215
+ chunks: Array<JsChunk>
214
216
  }
215
- export interface PluginCallbacks {
216
- doneCallback: (...args: any[]) => any
217
- processAssetsCallback: (...args: any[]) => any
218
- compilationCallback: (...args: any[]) => any
219
- thisCompilationCallback: (...args: any[]) => any
217
+ export interface JsHooks {
218
+ done: (...args: any[]) => any
219
+ processAssets: (...args: any[]) => any
220
+ compilation: (...args: any[]) => any
221
+ thisCompilation: (...args: any[]) => any
220
222
  }
221
223
  export interface JsCompatSource {
222
224
  /** Whether the underlying data structure is a `RawSource` */
@@ -226,39 +228,26 @@ export interface JsCompatSource {
226
228
  source: Buffer
227
229
  map?: Buffer
228
230
  }
229
- export const enum DiffStatKind {
230
- Changed = 0,
231
- Deleted = 1,
232
- Added = 2
233
- }
234
- export interface DiffStat {
235
- content: string
236
- kind: DiffStatKind
237
- }
238
- export interface RebuildResult {
239
- diff: Record<string, DiffStat>
240
- stats: StatsCompilation
241
- }
242
- export interface StatsError {
231
+ export interface JsStatsError {
243
232
  message: string
244
233
  formatted: string
245
234
  }
246
- export interface StatsWarning {
235
+ export interface JsStatsWarning {
247
236
  message: string
248
237
  formatted: string
249
238
  }
250
- export interface StatsAsset {
239
+ export interface JsStatsAsset {
251
240
  type: string
252
241
  name: string
253
242
  size: number
254
243
  chunks: Array<string>
255
244
  chunkNames: Array<string>
256
- info: StatsAssetInfo
245
+ info: JsStatsAssetInfo
257
246
  }
258
- export interface StatsAssetInfo {
247
+ export interface JsStatsAssetInfo {
259
248
  development: boolean
260
249
  }
261
- export interface StatsModule {
250
+ export interface JsStatsModule {
262
251
  type: string
263
252
  moduleType: string
264
253
  identifier: string
@@ -267,7 +256,7 @@ export interface StatsModule {
267
256
  chunks: Array<string>
268
257
  size: number
269
258
  }
270
- export interface StatsChunk {
259
+ export interface JsStatsChunk {
271
260
  type: string
272
261
  files: Array<string>
273
262
  id: string
@@ -276,45 +265,43 @@ export interface StatsChunk {
276
265
  names: Array<string>
277
266
  size: number
278
267
  }
279
- export interface StatsEntrypointAsset {
268
+ export interface JsStatsEntrypointAsset {
280
269
  name: string
281
270
  size: number
282
271
  }
283
- export interface StatsEntrypoint {
272
+ export interface JsStatsEntrypoint {
284
273
  name: string
285
- assets: Array<StatsEntrypointAsset>
274
+ assets: Array<JsStatsEntrypointAsset>
286
275
  chunks: Array<string>
287
276
  assetsSize: number
288
277
  }
289
- export interface StatsCompilation {
290
- assets: Array<StatsAsset>
291
- modules: Array<StatsModule>
292
- chunks: Array<StatsChunk>
293
- entrypoints: Array<StatsEntrypoint>
294
- errors: Array<StatsError>
278
+ export interface JsStatsCompilation {
279
+ assets: Array<JsStatsAsset>
280
+ modules: Array<JsStatsModule>
281
+ chunks: Array<JsStatsChunk>
282
+ entrypoints: Array<JsStatsEntrypoint>
283
+ errors: Array<JsStatsError>
295
284
  errorsCount: number
296
- warnings: Array<StatsWarning>
285
+ warnings: Array<JsStatsWarning>
297
286
  warningsCount: number
298
287
  }
299
- export interface OnLoadContext {
300
- id: string
301
- }
302
288
  export function initCustomTraceSubscriber(): void
303
289
  export class JsCompilation {
304
- updateAsset(filename: string, newSourceOrFunction: JsCompatSource | ((source: JsCompatSource) => JsCompatSource), assetInfoUpdateOrFunction?: AssetInfo | ((assetInfo: AssetInfo) => AssetInfo)): void
305
- getAssets(): Readonly<Asset>[]
306
- emitAsset(filename: string, source: JsCompatSource, assetInfo: AssetInfo): void
290
+ updateAsset(filename: string, newSourceOrFunction: JsCompatSource | ((source: JsCompatSource) => JsCompatSource), assetInfoUpdateOrFunction?: JsAssetInfo | ((assetInfo: JsAssetInfo) => JsAssetInfo)): void
291
+ getAssets(): Readonly<JsAsset>[]
292
+ emitAsset(filename: string, source: JsCompatSource, assetInfo: JsAssetInfo): void
307
293
  get assets(): Record<string, JsCompatSource>
294
+ get entrypoints(): Record<string, JsChunkGroup>
308
295
  }
309
296
  export class Rspack {
310
- constructor(options: RawOptions, pluginCallbacks?: PluginCallbacks | undefined | null)
297
+ constructor(options: RawOptions, jsHooks?: JsHooks | undefined | null)
311
298
  /**
312
299
  * Build with the given option passed to the constructor
313
300
  *
314
301
  * Warning:
315
302
  * Calling this method recursively might cause a deadlock.
316
303
  */
317
- unsafe_build(callback: (err: null | Error, result: StatsCompilation) => void): void
304
+ unsafe_build(callback: (err: null | Error, result: JsStatsCompilation) => void): void
318
305
  /**
319
306
  * Rebuild with the given option passed to the constructor
320
307
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/binding",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "Node binding for rspack",
5
5
  "main": "binding.js",
6
6
  "types": "binding.d.ts",
@@ -21,6 +21,9 @@
21
21
  },
22
22
  "scripts": {
23
23
  "build": "napi build --platform --js false --dts binding.d.ts --config napirs.rc.json",
24
- "build:release": "napi build --release --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",
25
+ "build:release": "napi build --release --platform --js false --dts binding.d.ts --config napirs.rc.json",
26
+ "build:release:x64": "napi build --release --platform --js false --dts binding.d.ts --config napirs.rc.json --target x86_64-apple-darwin",
27
+ "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"
25
28
  }
26
29
  }
Binary file
Binary file
Binary file