@rspack/browser 2.1.1 → 2.1.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.
@@ -13,6 +13,7 @@ export type { AssetInfo } from './binding';
13
13
  import * as liteTapable from '@rspack/lite-tapable';
14
14
  import type { Source } from 'webpack-sources';
15
15
  import type { EntryOptions, EntryPlugin } from './builtin-plugin';
16
+ import './Chunk';
16
17
  import type { Chunk } from './Chunk';
17
18
  import type { ChunkGraph } from './ChunkGraph';
18
19
  import type { Compiler } from './Compiler';
@@ -33,7 +34,6 @@ import { StatsFactory } from './stats/StatsFactory';
33
34
  import { StatsPrinter } from './stats/StatsPrinter';
34
35
  import type { InputFileSystem } from './util/fs';
35
36
  import type Hash from './util/hash';
36
- import './Chunk';
37
37
  import './Chunks';
38
38
  import './ChunkGraph';
39
39
  import './CodeGenerationResults';
@@ -44,12 +44,6 @@ export interface Asset {
44
44
  source: Source;
45
45
  info: AssetInfo;
46
46
  }
47
- export type ChunkPathData = {
48
- id?: string | number;
49
- name?: string;
50
- hash?: string;
51
- contentHash?: Record<string, string>;
52
- };
53
47
  export type PathData = {
54
48
  filename?: string;
55
49
  hash?: string;
@@ -60,6 +54,12 @@ export type PathData = {
60
54
  chunk?: Chunk | ChunkPathData;
61
55
  contentHashType?: string;
62
56
  };
57
+ export type ChunkPathData = {
58
+ id?: string | number;
59
+ name?: string;
60
+ hash?: string;
61
+ contentHash?: Record<string, string> | string;
62
+ };
63
63
  export interface LogEntry {
64
64
  type: string;
65
65
  args: any[];
@@ -615,6 +615,10 @@ export type RuleSetLogicalConditions = {
615
615
  export type RuleSetLoader = string;
616
616
  export type RuleSetLoaderOptions = string | Record<string, any>;
617
617
  export type RuleSetLoaderWithOptions = {
618
+ /**
619
+ * Stable identifier used to reference object-form loader options.
620
+ * When provided, Rspack passes object options to the loader request as `??${ident}`.
621
+ */
618
622
  ident?: string;
619
623
  loader: RuleSetLoader;
620
624
  /**
@@ -736,6 +740,7 @@ export type AssetParserOptions = {
736
740
  };
737
741
  export type CssParserNamedExports = boolean;
738
742
  export type CssParserUrl = boolean;
743
+ export type CssParserExportType = 'link' | 'text' | 'css-style-sheet' | 'style';
739
744
  export type CssParserResolveImportContext = {
740
745
  url: string;
741
746
  media: string | undefined;
@@ -746,6 +751,14 @@ export type CssParserResolveImportContext = {
746
751
  export type CssParserResolveImport = boolean | ((context: CssParserResolveImportContext) => boolean);
747
752
  /** Options object for `css` modules. */
748
753
  export type CssParserOptions = {
754
+ /**
755
+ * Configure how CSS content is exported to JavaScript.
756
+ *
757
+ * The default value is `"link"`, which emits CSS as stylesheet output.
758
+ *
759
+ * @default "link"
760
+ */
761
+ exportType?: CssParserExportType;
749
762
  /**
750
763
  * Use ES modules named export for CSS exports.
751
764
  * @default true
@@ -769,6 +782,14 @@ export type CssParserOptions = {
769
782
  };
770
783
  /** Options object for `css/global` modules. */
771
784
  export type CssModuleParserOptions = {
785
+ /**
786
+ * Configure how CSS content is exported to JavaScript.
787
+ *
788
+ * The default value is `"link"`, which emits CSS as stylesheet output.
789
+ *
790
+ * @default "link"
791
+ */
792
+ exportType?: CssParserExportType;
772
793
  /**
773
794
  * Use ES modules named export for CSS exports.
774
795
  * @default true
@@ -970,7 +991,8 @@ export type JsonParserOptions = {
970
991
  */
971
992
  exportsDepth?: number;
972
993
  /**
973
- * If Rule.type is set to 'json' then Rules.parser.parse option may be a function that implements custom logic to parse module's source and convert it to a json-compatible data.
994
+ * Custom synchronous parser for json modules. It receives the module source and should return JSON-serializable data.
995
+ * Can be configured through module.parser.json or through Rule.parser when Rule.type is 'json'.
974
996
  */
975
997
  parse?: (source: string) => any;
976
998
  };
package/dist/exports.d.ts CHANGED
@@ -43,9 +43,11 @@ type Config = {
43
43
  };
44
44
  export declare const config: Config;
45
45
  export type * from './config';
46
+ import { cachedCleverMerge as cleverMerge } from './util/cleverMerge';
47
+ import { createHash } from './util/createHash';
46
48
  export declare const util: {
47
- createHash: (algorithm: 'xxhash64' | 'md4' | 'native-md4' | (string & {}) | (new () => import("./util/hash").default)) => import("./util/hash").default;
48
- cleverMerge: <First, Second>(first: First, second: Second) => First | Second | (First & Second);
49
+ createHash: typeof createHash;
50
+ cleverMerge: typeof cleverMerge;
49
51
  };
50
52
  export type { BannerPluginArgument, DefinePluginOptions, EntryOptions, ProgressPluginHandlerInfo, ProgressPluginOptions, ProvidePluginOptions, } from './builtin-plugin';
51
53
  export { BannerPlugin, CaseSensitivePlugin, DefinePlugin, DynamicEntryPlugin, EntryPlugin, ExternalsPlugin, HotModuleReplacementPlugin, IgnorePlugin, type IgnorePluginOptions, NoEmitOnErrorsPlugin, ProgressPlugin, ProvidePlugin, RuntimePlugin, } from './builtin-plugin';