@rspack/binding 0.3.1 → 0.3.2

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 -28
  2. package/package.json +10 -10
package/binding.d.ts CHANGED
@@ -59,7 +59,7 @@ export class JsStats {
59
59
  }
60
60
 
61
61
  export class Rspack {
62
- constructor(options: RawOptions, jsHooks: JsHooks | undefined | null, outputFilesystem: ThreadsafeNodeFS, jsLoaderRunner: (...args: any[]) => any)
62
+ constructor(options: RawOptions, builtinPlugins: Array<BuiltinPlugin>, jsHooks: JsHooks | undefined | null, outputFilesystem: ThreadsafeNodeFS, jsLoaderRunner: (...args: any[]) => any)
63
63
  unsafe_set_disabled_hooks(hooks: Array<string>): void
64
64
  /**
65
65
  * Build with the given option passed to the constructor
@@ -109,10 +109,31 @@ export interface BeforeResolveData {
109
109
  context: string
110
110
  }
111
111
 
112
+ export interface BuiltinPlugin {
113
+ kind: BuiltinPluginKind
114
+ options: unknown
115
+ }
116
+
117
+ export const enum BuiltinPluginKind {
118
+ Define = 'Define',
119
+ Provide = 'Provide',
120
+ Banner = 'Banner',
121
+ Progress = 'Progress',
122
+ Copy = 'Copy',
123
+ Html = 'Html',
124
+ SwcJsMinimizer = 'SwcJsMinimizer',
125
+ SwcCssMinimizer = 'SwcCssMinimizer',
126
+ Entry = 'Entry',
127
+ Externals = 'Externals',
128
+ NodeTarget = 'NodeTarget',
129
+ ElectronTarget = 'ElectronTarget',
130
+ HttpExternals = 'HttpExternals'
131
+ }
132
+
112
133
  export function cleanupGlobalTrace(): void
113
134
 
114
135
  export interface FactoryMeta {
115
- sideEffects?: boolean
136
+ sideEffectFree?: boolean
116
137
  }
117
138
 
118
139
  export interface JsAsset {
@@ -379,6 +400,7 @@ export interface JsStatsModule {
379
400
  issuerName?: string
380
401
  issuerId?: string
381
402
  issuerPath: Array<JsStatsModuleIssuer>
403
+ nameForCondition?: string
382
404
  reasons?: Array<JsStatsModuleReason>
383
405
  assets?: Array<string>
384
406
  source?: string | Buffer
@@ -493,29 +515,21 @@ export interface RawBannerConfig {
493
515
  }
494
516
 
495
517
  export interface RawBuiltins {
496
- html?: Array<RawHtmlPluginConfig>
497
518
  css?: RawCssPluginConfig
498
- minifyOptions?: RawMinification
499
519
  presetEnv?: RawPresetEnv
500
- define: Record<string, string>
501
- provide: Record<string, string[]>
502
520
  treeShaking: string
503
- progress?: RawProgressPluginConfig
504
521
  react: RawReactOptions
505
522
  decorator?: RawDecoratorOptions
506
523
  noEmitAssets: boolean
507
524
  emotion?: string
508
525
  devFriendlySplitChunks: boolean
509
- copy?: RawCopyConfig
510
- banner?: Array<RawBannerConfig>
511
526
  pluginImport?: Array<RawPluginImportConfig>
512
527
  relay?: RawRelayConfig
513
- codeGeneration?: RawCodeGeneration
514
528
  }
515
529
 
516
530
  export interface RawCacheGroupOptions {
517
531
  priority?: number
518
- test?: string
532
+ test?: RegExp | string
519
533
  idHint?: string
520
534
  /** What kind of chunks should be selected. */
521
535
  chunks?: RegExp | 'async' | 'initial' | 'all'
@@ -542,10 +556,6 @@ export interface RawCacheOptions {
542
556
  version: string
543
557
  }
544
558
 
545
- export interface RawCodeGeneration {
546
- keepComments: boolean
547
- }
548
-
549
559
  export interface RawCopyConfig {
550
560
  patterns: Array<RawPattern>
551
561
  }
@@ -575,8 +585,8 @@ export interface RawDevServer {
575
585
  hot: boolean
576
586
  }
577
587
 
578
- export interface RawEntryDescription {
579
- import: Array<string>
588
+ export interface RawEntryOptions {
589
+ name?: string
580
590
  runtime?: string
581
591
  chunkLoading?: string
582
592
  asyncChunks?: boolean
@@ -585,12 +595,19 @@ export interface RawEntryDescription {
585
595
  filename?: string
586
596
  }
587
597
 
598
+ export interface RawEntryPluginOptions {
599
+ context: string
600
+ entry: string
601
+ options: RawEntryOptions
602
+ }
603
+
588
604
  export interface RawExperiments {
589
605
  lazyCompilation: boolean
590
606
  incrementalRebuild: RawIncrementalRebuild
591
607
  asyncWebAssembly: boolean
592
608
  newSplitChunks: boolean
593
609
  css: boolean
610
+ rspackFuture: RawRspackFuture
594
611
  }
595
612
 
596
613
  export interface RawExternalItem {
@@ -619,6 +636,11 @@ export interface RawExternalItemValue {
619
636
  arrayPayload?: Array<string>
620
637
  }
621
638
 
639
+ export interface RawExternalsPluginOptions {
640
+ type: string
641
+ externals: Array<RawExternalItem>
642
+ }
643
+
622
644
  export interface RawExternalsPresets {
623
645
  node: boolean
624
646
  web: boolean
@@ -679,6 +701,10 @@ export interface RawHtmlPluginConfig {
679
701
  meta?: Record<string, Record<string, string>>
680
702
  }
681
703
 
704
+ export interface RawHttpExternalsPluginOptions {
705
+ css: boolean
706
+ }
707
+
682
708
  export interface RawIncrementalRebuild {
683
709
  make: boolean
684
710
  emitAsset: boolean
@@ -737,6 +763,13 @@ export interface RawModuleOptions {
737
763
  }
738
764
 
739
765
  export interface RawModuleRule {
766
+ /**
767
+ * A conditional match matching an absolute path + query + fragment.
768
+ * Note:
769
+ * This is a custom matching rule not initially designed by webpack.
770
+ * Only for single-threaded environment interoperation purpose.
771
+ */
772
+ rspackResource?: RawRuleSetCondition
740
773
  /** A condition matcher matching an absolute path. */
741
774
  test?: RawRuleSetCondition
742
775
  include?: RawRuleSetCondition
@@ -802,13 +835,6 @@ export interface RawOptimizationOptions {
802
835
  }
803
836
 
804
837
  export interface RawOptions {
805
- entry: Record<string, RawEntryDescription>
806
- /**
807
- * Using this Vector to track the original order of user land entry configuration
808
- * std::collection::HashMap does not guarantee the insertion order, for more details you could refer
809
- * https://doc.rust-lang.org/std/collections/index.html#iterators:~:text=For%20unordered%20collections%20like%20HashMap%2C%20the%20items%20will%20be%20yielded%20in%20whatever%20order%20the%20internal%20representation%20made%20most%20convenient.%20This%20is%20great%20for%20reading%20through%20all%20the%20contents%20of%20the%20collection.
810
- */
811
- entryOrder: Array<string>
812
838
  mode?: undefined | 'production' | 'development' | 'none'
813
839
  target: Array<string>
814
840
  context: string
@@ -816,10 +842,6 @@ export interface RawOptions {
816
842
  resolve: RawResolveOptions
817
843
  resolveLoader: RawResolveOptions
818
844
  module: RawModuleOptions
819
- builtins: RawBuiltins
820
- externals?: Array<RawExternalItem>
821
- externalsType: string
822
- externalsPresets: RawExternalsPresets
823
845
  devtool: string
824
846
  optimization: RawOptimizationOptions
825
847
  stats: RawStatsOptions
@@ -829,6 +851,7 @@ export interface RawOptions {
829
851
  experiments: RawExperiments
830
852
  node?: RawNodeOption
831
853
  profile: boolean
854
+ builtins: RawBuiltins
832
855
  }
833
856
 
834
857
  export interface RawOutputOptions {
@@ -943,6 +966,10 @@ export interface RawResolveOptions {
943
966
  extensionAlias?: Record<string, Array<string>>
944
967
  }
945
968
 
969
+ export interface RawRspackFuture {
970
+ newResolver: boolean
971
+ }
972
+
946
973
  export interface RawRuleSetCondition {
947
974
  type: "string" | "regexp" | "logical" | "array" | "function"
948
975
  stringMatcher?: string
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/binding",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "license": "MIT",
5
5
  "description": "Node binding for rspack",
6
6
  "main": "binding.js",
@@ -22,15 +22,15 @@
22
22
  "binaryName": "rspack"
23
23
  },
24
24
  "optionalDependencies": {
25
- "@rspack/binding-darwin-arm64": "0.3.1",
26
- "@rspack/binding-win32-arm64-msvc": "0.3.1",
27
- "@rspack/binding-linux-arm64-gnu": "0.3.1",
28
- "@rspack/binding-linux-arm64-musl": "0.3.1",
29
- "@rspack/binding-win32-ia32-msvc": "0.3.1",
30
- "@rspack/binding-darwin-x64": "0.3.1",
31
- "@rspack/binding-win32-x64-msvc": "0.3.1",
32
- "@rspack/binding-linux-x64-gnu": "0.3.1",
33
- "@rspack/binding-linux-x64-musl": "0.3.1"
25
+ "@rspack/binding-darwin-arm64": "0.3.2",
26
+ "@rspack/binding-win32-arm64-msvc": "0.3.2",
27
+ "@rspack/binding-linux-arm64-gnu": "0.3.2",
28
+ "@rspack/binding-linux-arm64-musl": "0.3.2",
29
+ "@rspack/binding-win32-ia32-msvc": "0.3.2",
30
+ "@rspack/binding-darwin-x64": "0.3.2",
31
+ "@rspack/binding-win32-x64-msvc": "0.3.2",
32
+ "@rspack/binding-linux-x64-gnu": "0.3.2",
33
+ "@rspack/binding-linux-x64-musl": "0.3.2"
34
34
  },
35
35
  "scripts": {
36
36
  "build:debug": "node scripts/build.js",