@rspack/core 1.1.0 → 1.1.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.
package/dist/Chunk.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type JsChunk, type JsChunkPathData, type JsCompilation } from "@rspack/binding";
1
+ import { type JsChunk, type JsCompilation } from "@rspack/binding";
2
2
  import { Compilation } from ".";
3
3
  import { ChunkGroup } from "./ChunkGroup";
4
4
  export declare class Chunk {
@@ -37,5 +37,4 @@ export declare class Chunk {
37
37
  * @internal
38
38
  */
39
39
  __internal__innerUkey(): number;
40
- __internal_to_path_data_chunk(): JsChunkPathData;
41
40
  }
@@ -8,7 +8,7 @@
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
10
  import type * as binding from "@rspack/binding";
11
- import { type ExternalObject, type JsCompilation, type JsPathData, type JsRuntimeModule } from "@rspack/binding";
11
+ import { type ExternalObject, type JsCompilation, type JsRuntimeModule } from "@rspack/binding";
12
12
  import * as liteTapable from "@rspack/lite-tapable";
13
13
  import type { Source } from "../compiled/webpack-sources";
14
14
  import { Chunk } from "./Chunk";
@@ -37,8 +37,21 @@ export interface Asset {
37
37
  source: Source;
38
38
  info: AssetInfo;
39
39
  }
40
- export type PathData = Omit<JsPathData, "chunk"> & {
41
- chunk?: Chunk | binding.JsChunkPathData;
40
+ export type PathDataChunkLike = {
41
+ id?: string;
42
+ name?: string;
43
+ hash?: string;
44
+ contentHash?: Record<string, string>;
45
+ };
46
+ export type PathData = {
47
+ filename?: string;
48
+ hash?: string;
49
+ contentHash?: string;
50
+ runtime?: string;
51
+ url?: string;
52
+ id?: string;
53
+ chunk?: Chunk | PathDataChunkLike;
54
+ contentHashType?: string;
42
55
  };
43
56
  export interface LogEntry {
44
57
  type: string;
@@ -1,9 +1,9 @@
1
- import { type JsDependency, JsDependencyMut } from "@rspack/binding";
1
+ import type { JsDependency } from "@rspack/binding";
2
2
  export declare class Dependency {
3
3
  readonly type: string;
4
4
  readonly category: string;
5
5
  readonly request: string | undefined;
6
6
  critical: boolean;
7
- static __from_binding(binding: JsDependencyMut | JsDependency): Dependency;
7
+ static __from_binding(binding: JsDependency): Dependency;
8
8
  private constructor();
9
9
  }
@@ -83,7 +83,12 @@ export type LoaderOptions = {
83
83
  targets?: Targets | string[] | string;
84
84
  include?: FeatureOptions;
85
85
  exclude?: FeatureOptions;
86
+ /**
87
+ * @deprecated Use `drafts` instead.
88
+ * This will be removed in the next major version.
89
+ */
86
90
  draft?: Drafts;
91
+ drafts?: Drafts;
87
92
  nonStandard?: NonStandard;
88
93
  pseudoClasses?: PseudoClasses;
89
94
  unusedSymbols?: string[];
@@ -0,0 +1,13 @@
1
+ import { BuiltinPluginName } from "@rspack/binding";
2
+ export type DllEntryPluginOptions = {
3
+ name: string;
4
+ };
5
+ export declare const DllEntryPlugin: {
6
+ new (context: string, entries: string[], options: DllEntryPluginOptions): {
7
+ name: BuiltinPluginName;
8
+ _args: [context: string, entries: string[], options: DllEntryPluginOptions];
9
+ affectedHooks: "done" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
10
+ raw(compiler: import("..").Compiler): import("@rspack/binding").BuiltinPlugin;
11
+ apply(compiler: import("..").Compiler): void;
12
+ };
13
+ };
@@ -0,0 +1,11 @@
1
+ import { BuiltinPluginName, type RawDllReferenceAgencyPluginOptions } from "@rspack/binding";
2
+ export type DllReferenceAgencyPluginOptions = RawDllReferenceAgencyPluginOptions;
3
+ export declare const DllReferenceAgencyPlugin: {
4
+ new (options: RawDllReferenceAgencyPluginOptions): {
5
+ name: BuiltinPluginName;
6
+ _args: [options: RawDllReferenceAgencyPluginOptions];
7
+ affectedHooks: "done" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
8
+ raw(compiler: import("..").Compiler): import("@rspack/binding").BuiltinPlugin;
9
+ apply(compiler: import("..").Compiler): void;
10
+ };
11
+ };
@@ -0,0 +1,10 @@
1
+ import { BuiltinPluginName } from "@rspack/binding";
2
+ export declare const FlagAllModulesAsUsedPlugin: {
3
+ new (explanation: string): {
4
+ name: BuiltinPluginName;
5
+ _args: [explanation: string];
6
+ affectedHooks: "done" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
7
+ raw(compiler: import("..").Compiler): import("@rspack/binding").BuiltinPlugin;
8
+ apply(compiler: import("..").Compiler): void;
9
+ };
10
+ };
@@ -0,0 +1,18 @@
1
+ import { BuiltinPluginName } from "@rspack/binding";
2
+ export type LibManifestPluginOptions = {
3
+ context?: string;
4
+ entryOnly?: boolean;
5
+ format?: boolean;
6
+ name?: string;
7
+ path: string;
8
+ type?: string;
9
+ };
10
+ export declare const LibManifestPlugin: {
11
+ new (options: LibManifestPluginOptions): {
12
+ name: BuiltinPluginName;
13
+ _args: [options: LibManifestPluginOptions];
14
+ affectedHooks: "done" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
15
+ raw(compiler: import("..").Compiler): import("@rspack/binding").BuiltinPlugin;
16
+ apply(compiler: import("..").Compiler): void;
17
+ };
18
+ };
@@ -11,7 +11,12 @@ export type LightningCssMinimizerRspackPluginOptions = {
11
11
  targets?: string[] | string;
12
12
  include?: FeatureOptions;
13
13
  exclude?: FeatureOptions;
14
+ /**
15
+ * @deprecated Use `drafts` instead.
16
+ * This will be removed in the next major version.
17
+ */
14
18
  draft?: Drafts;
19
+ drafts?: Drafts;
15
20
  nonStandard?: NonStandard;
16
21
  pseudoClasses?: PseudoClasses;
17
22
  unusedSymbols?: string[];
@@ -66,3 +66,6 @@ export * from "./WorkerPlugin";
66
66
  export * from "./FetchCompileAsyncWasmPlugin";
67
67
  export * from "./NoEmitOnErrorsPlugin";
68
68
  export * from "./ContextReplacementPlugin";
69
+ export * from "./LibManifestPlugin";
70
+ export * from "./DllEntryPlugin";
71
+ export * from "./DllReferenceAgencyPlugin";
@@ -8,7 +8,7 @@
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
10
  import type { Compilation } from "../Compilation";
11
- import type { AssetModuleFilename, Bail, CacheOptions, ChunkFilename, ChunkLoading, ChunkLoadingGlobal, Clean, Context, CrossOriginLoading, CssChunkFilename, CssFilename, Dependencies, DevServer, DevTool, DevtoolFallbackModuleFilenameTemplate, DevtoolModuleFilenameTemplate, DevtoolNamespace, EnabledLibraryTypes, EnabledWasmLoadingTypes, EntryDescription, Environment, Externals, ExternalsPresets, ExternalsType, Filename, GeneratorOptionsByModuleType, GlobalObject, HashDigest, HashDigestLength, HashFunction, HashSalt, HotUpdateChunkFilename, HotUpdateGlobal, HotUpdateMainFilename, Iife, ImportFunctionName, ImportMetaName, Incremental, InfrastructureLogging, LazyCompilationOptions, LibraryOptions, Loader, Mode, Name, NoParseOption, Node, Optimization, OutputModule, ParserOptionsByModuleType, Path, Performance, Plugins, Profile, PublicPath, Resolve, RspackFutureOptions, RspackOptions, RuleSetRules, ScriptType, SnapshotOptions, SourceMapFilename, StatsValue, StrictModuleErrorHandling, Target, TrustedTypes, UniqueName, WasmLoading, Watch, WatchOptions, WebassemblyModuleFilename, WorkerPublicPath } from "./types";
11
+ import type { AssetModuleFilename, Bail, CacheOptions, ChunkFilename, ChunkLoading, ChunkLoadingGlobal, Clean, Context, CrossOriginLoading, CssChunkFilename, CssFilename, Dependencies, DevServer, DevTool, DevtoolFallbackModuleFilenameTemplate, DevtoolModuleFilenameTemplate, DevtoolNamespace, EnabledLibraryTypes, EnabledWasmLoadingTypes, EntryDescription, Environment, ExperimentCacheOptions, Externals, ExternalsPresets, ExternalsType, Filename, GeneratorOptionsByModuleType, GlobalObject, HashDigest, HashDigestLength, HashFunction, HashSalt, HotUpdateChunkFilename, HotUpdateGlobal, HotUpdateMainFilename, Iife, ImportFunctionName, ImportMetaName, Incremental, InfrastructureLogging, LazyCompilationOptions, LibraryOptions, Loader, Mode, Name, NoParseOption, Node, Optimization, OutputModule, ParserOptionsByModuleType, Path, Performance, Plugins, Profile, PublicPath, Resolve, RspackFutureOptions, RspackOptions, RuleSetRules, ScriptType, SnapshotOptions, SourceMapFilename, StatsValue, StrictModuleErrorHandling, Target, TrustedTypes, UniqueName, WasmLoading, Watch, WatchOptions, WebassemblyModuleFilename, WorkerPublicPath } from "./types";
12
12
  export declare const getNormalizedRspackOptions: (config: RspackOptions) => RspackOptionsNormalized;
13
13
  export type EntryDynamicNormalized = () => Promise<EntryStaticNormalized>;
14
14
  export type EntryNormalized = EntryDynamicNormalized | EntryStaticNormalized;
@@ -77,6 +77,7 @@ export interface ModuleOptionsNormalized {
77
77
  noParse?: NoParseOption;
78
78
  }
79
79
  export interface ExperimentsNormalized {
80
+ cache?: ExperimentCacheOptions;
80
81
  lazyCompilation?: false | LazyCompilationOptions;
81
82
  asyncWebAssembly?: boolean;
82
83
  outputModule?: boolean;
@@ -887,19 +887,28 @@ export type Target = false | AllowTarget | AllowTarget[];
887
887
  * `amd`, `umd`, `system` and `jsonp` externals depend on the `output.libraryTarget` being set to the same value e.g. you can only consume amd externals within an amd library.
888
888
  * @default 'var'
889
889
  */
890
- export type ExternalsType = "var" | "module" | "assign" | "this" | "window" | "self" | "global" | "commonjs" | "commonjs2" | "commonjs-module" | "commonjs-static" | "amd" | "amd-require" | "umd" | "umd2" | "jsonp" | "system" | "promise" | "import" | "module-import" | "script" | "node-commonjs";
890
+ export type ExternalsType = "var" | "module" | "assign" | "this" | "window" | "self" | "global" | "commonjs" | "commonjs2" | "commonjs-module" | "commonjs-static" | "amd" | "amd-require" | "umd" | "umd2" | "jsonp" | "system" | "promise" | "import" | "module-import" | "script" | "node-commonjs" | "commonjs-import";
891
891
  /**
892
- * The dependency used for the external.
892
+ * External item object when both libraryTarget and externalsType is 'umd'
893
893
  */
894
- export type ExternalItemValue = string | boolean | string[] | {
895
- /**
896
- * only available when libraryTarget and externalsType is 'umd'
897
- */
894
+ export type ExternalItemUmdValue = {
898
895
  root: string | string[];
899
896
  commonjs: string | string[];
900
897
  commonjs2: string | string[];
901
- amd?: string | string[];
898
+ amd: string | string[];
902
899
  };
900
+ /**
901
+ * External item object when not umd
902
+ */
903
+ export type ExternalItemObjectValue = Record<string, string | string[]>;
904
+ /**
905
+ * The dependency used for the external.
906
+ */
907
+ export type ExternalItemValue = string | boolean | string[] | ExternalItemUmdValue
908
+ /**
909
+ * when libraryTarget and externalsType is not 'umd'
910
+ */
911
+ | ExternalItemObjectValue;
903
912
  /**
904
913
  * If an dependency matches exactly a property of the object, the property value is used as dependency.
905
914
  */
@@ -1674,6 +1683,31 @@ export type Optimization = {
1674
1683
  * */
1675
1684
  emitOnErrors?: boolean;
1676
1685
  };
1686
+ /**
1687
+ * Options for caching snapshots and intermediate products during the build process.
1688
+ * @description Controls whether caching is enabled or disabled.
1689
+ * @default true in development mode, false in production mode
1690
+ * @example
1691
+ * // Enable caching
1692
+ * cache: true
1693
+ *
1694
+ * // Disable caching
1695
+ * cache: false
1696
+ */
1697
+ export type ExperimentCacheOptions = boolean | {
1698
+ type: "memory";
1699
+ } | {
1700
+ type: "persistent";
1701
+ snapshot: {
1702
+ immutablePaths: Array<string | RegExp>;
1703
+ unmanagedPaths: Array<string | RegExp>;
1704
+ managedPaths: Array<string | RegExp>;
1705
+ };
1706
+ storage: {
1707
+ type: "filesystem";
1708
+ directory: string;
1709
+ };
1710
+ };
1677
1711
  /**
1678
1712
  * Options for future Rspack features.
1679
1713
  */
@@ -1775,10 +1809,6 @@ export type Incremental = {
1775
1809
  * Enable incremental make.
1776
1810
  */
1777
1811
  make?: boolean;
1778
- /**
1779
- * Enable incremental asset emission.
1780
- */
1781
- emitAssets?: boolean;
1782
1812
  /**
1783
1813
  * Enable inference of async modules.
1784
1814
  */
@@ -1791,6 +1821,10 @@ export type Incremental = {
1791
1821
  * Enables diagnostics for dependencies.
1792
1822
  */
1793
1823
  dependenciesDiagnostics?: boolean;
1824
+ /**
1825
+ * Enable incremental build chunk graph.
1826
+ */
1827
+ buildChunkGraph?: boolean;
1794
1828
  /**
1795
1829
  * Enable incremental module hashes.
1796
1830
  */
@@ -1804,14 +1838,30 @@ export type Incremental = {
1804
1838
  */
1805
1839
  modulesRuntimeRequirements?: boolean;
1806
1840
  /**
1807
- * Enable incremental build chunk graph.
1841
+ * Enable incremental chunk runtime requirements.
1808
1842
  */
1809
- buildChunkGraph?: boolean;
1843
+ chunksRuntimeRequirements?: boolean;
1844
+ /**
1845
+ * Enable incremental chunk hashes.
1846
+ */
1847
+ chunksHashes?: boolean;
1848
+ /**
1849
+ * Enable incremental chunk render.
1850
+ */
1851
+ chunksRender?: boolean;
1852
+ /**
1853
+ * Enable incremental asset emission.
1854
+ */
1855
+ emitAssets?: boolean;
1810
1856
  };
1811
1857
  /**
1812
1858
  * Experimental features configuration.
1813
1859
  */
1814
1860
  export type Experiments = {
1861
+ /**
1862
+ * Enable new cache.
1863
+ */
1864
+ cache?: ExperimentCacheOptions;
1815
1865
  /**
1816
1866
  * Enable lazy compilation.
1817
1867
  */
@@ -0,0 +1,16 @@
1
+ import { type IssueData, type ParseReturnType, ZodType, type ZodTypeDef, z } from "../../compiled/zod";
2
+ import type { RspackOptions } from "./types";
3
+ export type ZodCrossFieldsOptions = ZodTypeDef & {
4
+ patterns: Array<{
5
+ test: (root: RspackOptions) => boolean;
6
+ type: ZodType;
7
+ issue?: (res: ParseReturnType<any>) => Array<IssueData>;
8
+ }>;
9
+ default: ZodType;
10
+ };
11
+ export declare class ZodRspackCrossChecker<T> extends ZodType<T> {
12
+ private params;
13
+ constructor(params: ZodCrossFieldsOptions);
14
+ _parse(input: z.ParseInput): z.ParseReturnType<T>;
15
+ _getRootData(ctx: z.ParseContext): any;
16
+ }