@rspack/binding 1.3.0-beta.0 → 1.3.0

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.
Files changed (2) hide show
  1. package/binding.d.ts +55 -26
  2. package/package.json +11 -11
package/binding.d.ts CHANGED
@@ -6,8 +6,6 @@ export type JsFilename =
6
6
  | string
7
7
  | ((pathData: JsPathData, assetInfo?: AssetInfo) => string);
8
8
 
9
- export type LocalJsFilename = JsFilename;
10
-
11
9
  export type RawLazyCompilationTest = RegExp | ((module: Module) => boolean);
12
10
 
13
11
  export type AssetInfo = KnownAssetInfo & Record<string, any>;
@@ -24,19 +22,19 @@ export interface Module {
24
22
  }
25
23
 
26
24
  interface NormalModuleConstructor {
27
- new (): NormalModule;
25
+ new(): NormalModule;
28
26
  readonly prototype: NormalModule;
29
27
  }
30
28
 
31
29
  export var NormalModule: NormalModuleConstructor;
32
30
 
33
31
  export interface NormalModule extends Module {
34
- get resource(): string | undefined;
35
- get request(): string | undefined
36
- get userRequest(): string | undefined
37
- set userRequest(val: string | undefined)
38
- get rawRequest(): string | undefined
39
- get loaders(): Array<JsLoaderItem> | undefined
32
+ get resource(): string;
33
+ get request(): string
34
+ get userRequest(): string
35
+ set userRequest(val: string)
36
+ get rawRequest(): string
37
+ get loaders(): Array<JsLoaderItem>
40
38
  get resourceResolveData(): JsResourceData | undefined
41
39
  get matchResource(): string | undefined
42
40
  set matchResource(val: string | undefined)
@@ -66,7 +64,7 @@ export declare class AsyncDependenciesBlock {
66
64
  }
67
65
 
68
66
  export declare class ConcatenatedModule {
69
- get modules(): Module[] | undefined
67
+ get modules(): Module[]
70
68
  _originalSource(): JsCompatSource | undefined
71
69
  identifier(): string
72
70
  nameForCondition(): string | undefined
@@ -132,8 +130,8 @@ export declare class EntryOptionsDto {
132
130
  export type EntryOptionsDTO = EntryOptionsDto
133
131
 
134
132
  export declare class ExternalModule {
135
- get userRequest(): string | undefined
136
- set userRequest(val: string | undefined)
133
+ get userRequest(): string
134
+ set userRequest(val: string)
137
135
  _originalSource(): JsCompatSource | undefined
138
136
  identifier(): string
139
137
  nameForCondition(): string | undefined
@@ -175,7 +173,7 @@ export declare class JsChunkGraph {
175
173
  getChunkEntryDependentChunksIterable(chunk: JsChunk): JsChunk[]
176
174
  getChunkModulesIterableBySourceType(chunk: JsChunk, sourceType: string): Module[]
177
175
  getModuleChunks(module: Module): JsChunk[]
178
- getModuleId(module: Module): string | null
176
+ getModuleId(module: Module): string | number | null
179
177
  getModuleHash(module: Module, runtime: string | string[] | undefined): string | null
180
178
  getBlockChunkGroup(jsBlock: AsyncDependenciesBlock): JsChunkGroup | null
181
179
  }
@@ -226,10 +224,10 @@ export declare class JsCompilation {
226
224
  getErrors(): Array<JsRspackError>
227
225
  getWarnings(): Array<JsRspackError>
228
226
  getStats(): JsStats
229
- getAssetPath(filename: LocalJsFilename, data: JsPathData): string
230
- getAssetPathWithInfo(filename: LocalJsFilename, data: JsPathData): PathWithInfo
231
- getPath(filename: LocalJsFilename, data: JsPathData): string
232
- getPathWithInfo(filename: LocalJsFilename, data: JsPathData): PathWithInfo
227
+ getAssetPath(filename: JsFilename, data: JsPathData): string
228
+ getAssetPathWithInfo(filename: JsFilename, data: JsPathData): PathWithInfo
229
+ getPath(filename: JsFilename, data: JsPathData): string
230
+ getPathWithInfo(filename: JsFilename, data: JsPathData): PathWithInfo
233
231
  addFileDependencies(deps: Array<string>): void
234
232
  addContextDependencies(deps: Array<string>): void
235
233
  addMissingDependencies(deps: Array<string>): void
@@ -455,9 +453,11 @@ export declare enum BuiltinPluginName {
455
453
  CssExtractRspackPlugin = 'CssExtractRspackPlugin',
456
454
  SubresourceIntegrityPlugin = 'SubresourceIntegrityPlugin',
457
455
  RsdoctorPlugin = 'RsdoctorPlugin',
456
+ CircularDependencyRspackPlugin = 'CircularDependencyRspackPlugin',
458
457
  JsLoaderRspackPlugin = 'JsLoaderRspackPlugin',
459
458
  LazyCompilationPlugin = 'LazyCompilationPlugin',
460
- ModuleInfoHeaderPlugin = 'ModuleInfoHeaderPlugin'
459
+ ModuleInfoHeaderPlugin = 'ModuleInfoHeaderPlugin',
460
+ HttpUriPlugin = 'HttpUriPlugin'
461
461
  }
462
462
 
463
463
  export declare function cleanupGlobalTrace(): void
@@ -752,6 +752,12 @@ export interface JsHtmlPluginTag {
752
752
  asset?: string
753
753
  }
754
754
 
755
+ export interface JsHttpResponseRaw {
756
+ status: number
757
+ headers: Record<string, string>
758
+ body: Buffer
759
+ }
760
+
755
761
  export interface JsLibIdentOptions {
756
762
  context: string
757
763
  }
@@ -834,7 +840,7 @@ export declare enum JsLoaderState {
834
840
  export interface JsModuleDescriptor {
835
841
  identifier: string
836
842
  name: string
837
- id?: string
843
+ id?: string | number | null
838
844
  }
839
845
 
840
846
  export interface JsNormalModuleFactoryCreateModuleArgs {
@@ -1446,7 +1452,7 @@ export interface RawAssetResourceGeneratorOptions {
1446
1452
  }
1447
1453
 
1448
1454
  export interface RawBannerPluginOptions {
1449
- banner: string | ((...args: any[]) => any)
1455
+ banner: string | ((args: { hash: string, chunk: JsChunk, filename: string }) => string)
1450
1456
  entryOnly?: boolean
1451
1457
  footer?: boolean
1452
1458
  raw?: boolean
@@ -1492,6 +1498,17 @@ export interface RawCacheOptions {
1492
1498
  maxGenerations?: number
1493
1499
  }
1494
1500
 
1501
+ export interface RawCircularDependencyRspackPluginOptions {
1502
+ failOnError?: boolean
1503
+ allowAsyncCycles?: boolean
1504
+ exclude?: RegExp
1505
+ ignoredConnections?: Array<[string | RegExp, string | RegExp]>
1506
+ onDetected?: (entrypoint: Module, modules: string[], compilation: JsCompilation) => void
1507
+ onIgnored?: (entrypoint: Module, modules: string[], compilation: JsCompilation) => void
1508
+ onStart?: (compilation: JsCompilation) => void
1509
+ onEnd?: (compilation: JsCompilation) => void
1510
+ }
1511
+
1495
1512
  export interface RawConsumeOptions {
1496
1513
  key: string
1497
1514
  import?: string
@@ -1558,7 +1575,7 @@ export interface RawCopyPattern {
1558
1575
  * @default false
1559
1576
  */
1560
1577
  copyPermissions?: boolean
1561
- transform?: (input: Buffer, absoluteFilename: string) => string | Buffer | Promise<string> | Promise<Buffer>
1578
+ transform?: { transformer: (input: string, absoluteFilename: string) => string | Buffer | Promise<string> | Promise<Buffer> } | ((input: Buffer, absoluteFilename: string) => string | Buffer | Promise<string> | Promise<Buffer>)
1562
1579
  }
1563
1580
 
1564
1581
  export interface RawCopyRspackPluginOptions {
@@ -1803,6 +1820,14 @@ export interface RawHttpExternalsRspackPluginOptions {
1803
1820
  webAsync: boolean
1804
1821
  }
1805
1822
 
1823
+ export interface RawHttpUriPluginOptions {
1824
+ allowedUris: (string | RegExp)[]
1825
+ lockfileLocation?: string
1826
+ cacheLocation?: string
1827
+ upgrade: boolean
1828
+ httpClient: (url: string, headers: Record<string, string>) => Promise<JsHttpResponseRaw>
1829
+ }
1830
+
1806
1831
  export interface RawIgnorePluginOptions {
1807
1832
  resourceRegExp?: RegExp
1808
1833
  contextRegExp?: RegExp
@@ -2184,8 +2209,8 @@ export interface RawResolveOptions {
2184
2209
  mainFiles?: Array<string>
2185
2210
  mainFields?: Array<string>
2186
2211
  conditionNames?: Array<string>
2187
- alias?: Array<RawAliasOptionItem>
2188
- fallback?: Array<RawAliasOptionItem>
2212
+ alias?: Array<RawAliasOptionItem> | false
2213
+ fallback?: Array<RawAliasOptionItem> | false
2189
2214
  symlinks?: boolean
2190
2215
  tsconfig?: RawResolveTsconfigOptions
2191
2216
  modules?: Array<string>
@@ -2209,8 +2234,8 @@ export interface RawResolveOptionsWithDependencyType {
2209
2234
  mainFiles?: Array<string>
2210
2235
  mainFields?: Array<string>
2211
2236
  conditionNames?: Array<string>
2212
- alias?: Array<RawAliasOptionItem>
2213
- fallback?: Array<RawAliasOptionItem>
2237
+ alias?: Array<RawAliasOptionItem> | false
2238
+ fallback?: Array<RawAliasOptionItem> | false
2214
2239
  symlinks?: boolean
2215
2240
  tsconfig?: RawResolveTsconfigOptions
2216
2241
  modules?: Array<string>
@@ -2360,7 +2385,11 @@ export interface RawSwcJsMinimizerRspackPluginOptions {
2360
2385
 
2361
2386
  export interface RawToOptions {
2362
2387
  context: string
2363
- absoluteFilename: string
2388
+ absoluteFilename?: string
2389
+ }
2390
+
2391
+ export interface RawTransformOptions {
2392
+ transformer: { transformer: (input: string, absoluteFilename: string) => string | Buffer | Promise<string> | Promise<Buffer> }
2364
2393
  }
2365
2394
 
2366
2395
  export interface RawTrustedTypes {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/binding",
3
- "version": "1.3.0-beta.0",
3
+ "version": "1.3.0",
4
4
  "license": "MIT",
5
5
  "description": "Node binding for rspack",
6
6
  "main": "binding.js",
@@ -17,7 +17,7 @@
17
17
  "bugs": "https://github.com/web-infra-dev/rspack/issues",
18
18
  "repository": "web-infra-dev/rspack",
19
19
  "devDependencies": {
20
- "@napi-rs/cli": "3.0.0-alpha.73",
20
+ "@napi-rs/cli": "3.0.0-alpha.75",
21
21
  "@napi-rs/wasm-runtime": "^0.2.7",
22
22
  "emnapi": "^1.3.1",
23
23
  "typescript": "^5.7.3",
@@ -48,15 +48,15 @@
48
48
  }
49
49
  },
50
50
  "optionalDependencies": {
51
- "@rspack/binding-darwin-arm64": "1.3.0-beta.0",
52
- "@rspack/binding-win32-arm64-msvc": "1.3.0-beta.0",
53
- "@rspack/binding-linux-arm64-musl": "1.3.0-beta.0",
54
- "@rspack/binding-linux-arm64-gnu": "1.3.0-beta.0",
55
- "@rspack/binding-win32-ia32-msvc": "1.3.0-beta.0",
56
- "@rspack/binding-darwin-x64": "1.3.0-beta.0",
57
- "@rspack/binding-win32-x64-msvc": "1.3.0-beta.0",
58
- "@rspack/binding-linux-x64-gnu": "1.3.0-beta.0",
59
- "@rspack/binding-linux-x64-musl": "1.3.0-beta.0"
51
+ "@rspack/binding-darwin-arm64": "1.3.0",
52
+ "@rspack/binding-linux-arm64-gnu": "1.3.0",
53
+ "@rspack/binding-win32-arm64-msvc": "1.3.0",
54
+ "@rspack/binding-win32-ia32-msvc": "1.3.0",
55
+ "@rspack/binding-linux-arm64-musl": "1.3.0",
56
+ "@rspack/binding-darwin-x64": "1.3.0",
57
+ "@rspack/binding-linux-x64-gnu": "1.3.0",
58
+ "@rspack/binding-linux-x64-musl": "1.3.0",
59
+ "@rspack/binding-win32-x64-msvc": "1.3.0"
60
60
  },
61
61
  "scripts": {
62
62
  "build:dev": "node scripts/build.js",