@rspack/core 2.0.2 → 2.0.4

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 (40) hide show
  1. package/compiled/http-proxy-middleware/index.d.ts +4 -4
  2. package/compiled/http-proxy-middleware/package.json +1 -1
  3. package/dist/Compilation.d.ts +1 -1
  4. package/dist/MultiCompiler.d.ts +1 -1
  5. package/dist/RuntimeGlobals.d.ts +1 -1
  6. package/dist/builtin-plugin/CircularModulesInfoPlugin.d.ts +7 -0
  7. package/dist/builtin-plugin/CssHttpExternalsRspackPlugin.d.ts +9 -0
  8. package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +1 -1
  9. package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +1 -1
  10. package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +1 -1
  11. package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +1 -1
  12. package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +2 -2
  13. package/dist/builtin-plugin/HttpUriPlugin.d.ts +1 -1
  14. package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +1 -1
  15. package/dist/builtin-plugin/MangleExportsPlugin.d.ts +1 -1
  16. package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +1 -1
  17. package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +1 -1
  18. package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +1 -1
  19. package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +1 -1
  20. package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +2 -2
  21. package/dist/builtin-plugin/SplitChunksPlugin.d.ts +1 -1
  22. package/dist/builtin-plugin/WorkerPlugin.d.ts +1 -1
  23. package/dist/builtin-plugin/index.d.ts +2 -0
  24. package/dist/builtin-plugin/rsc/RscServerPlugin.d.ts +7 -0
  25. package/dist/builtin-plugin/rsc/index.d.ts +3 -3
  26. package/dist/config/target.d.ts +1 -1
  27. package/dist/config/types.d.ts +33 -29
  28. package/dist/exports.d.ts +1 -1
  29. package/dist/index.js +121 -96
  30. package/dist/lib/CacheFacade.d.ts +1 -1
  31. package/dist/runtime/cssExtractHmr.d.ts +2 -2
  32. package/dist/runtime/moduleFederationDefaultRuntime.d.ts +1 -1
  33. package/dist/sharing/ConsumeSharedPlugin.d.ts +2 -2
  34. package/dist/sharing/ProvideSharedPlugin.d.ts +4 -4
  35. package/dist/sharing/SharePlugin.d.ts +4 -4
  36. package/dist/util/comparators.d.ts +1 -1
  37. package/dist/util/createHash.d.ts +1 -1
  38. package/dist/util/identifier.d.ts +35 -8
  39. package/module.d.ts +6 -0
  40. package/package.json +7 -7
@@ -134,6 +134,6 @@ export declare class CacheFacade {
134
134
  * @param computer function to compute the value if not cached
135
135
  * @returns promise with the data
136
136
  */
137
- providePromise<T>(identifier: string, etag: Etag | null, computer: () => Promise<T> | T): Promise<{} | T | null>;
137
+ providePromise<T>(identifier: string, etag: Etag | null, computer: () => Promise<T> | T): Promise<T | {} | null>;
138
138
  }
139
139
  export default CacheFacade;
@@ -1,4 +1,4 @@
1
1
  export declare function normalizeUrl(url: string): string;
2
- declare function noop(): void;
3
- declare function cssReload(moduleId: string, options: Record<string, any>): typeof noop;
2
+ type DebouncedFunction<T extends (...args: any[]) => any> = (...args: Parameters<T>) => void;
3
+ declare function cssReload(moduleId: string, options: Record<string, any>): DebouncedFunction<() => void>;
4
4
  export { cssReload };
@@ -1 +1 @@
1
- export default function _default(): void;
1
+ export default function (): void;
@@ -31,7 +31,7 @@ export declare function normalizeConsumeShareOptions(consumes: Consumes, shareSc
31
31
  packageName: string | undefined;
32
32
  singleton: boolean;
33
33
  eager: boolean;
34
- treeShakingMode: "server-calc" | "runtime-infer" | undefined;
34
+ treeShakingMode: "runtime-infer" | "server-calc" | undefined;
35
35
  }][];
36
36
  export declare class ConsumeSharedPlugin extends RspackBuiltinPlugin {
37
37
  name: BuiltinPluginName;
@@ -45,7 +45,7 @@ export declare class ConsumeSharedPlugin extends RspackBuiltinPlugin {
45
45
  packageName: string | undefined;
46
46
  singleton: boolean;
47
47
  eager: boolean;
48
- treeShakingMode: "server-calc" | "runtime-infer" | undefined;
48
+ treeShakingMode: "runtime-infer" | "server-calc" | undefined;
49
49
  }][];
50
50
  enhanced: boolean;
51
51
  };
@@ -35,14 +35,14 @@ export declare function normalizeProvideShareOptions<Enhanced extends boolean =
35
35
  shareScope: ShareScope;
36
36
  eager: boolean;
37
37
  } | {
38
- singleton: boolean | undefined;
39
- requiredVersion: string | false | undefined;
40
- strictVersion: boolean | undefined;
41
- treeShakingMode: "server-calc" | "runtime-infer" | undefined;
42
38
  shareKey: string;
43
39
  version: string | false | undefined;
44
40
  shareScope: ShareScope;
45
41
  eager: boolean;
42
+ singleton: boolean | undefined;
43
+ requiredVersion: string | false | undefined;
44
+ strictVersion: boolean | undefined;
45
+ treeShakingMode: "runtime-infer" | "server-calc" | undefined;
46
46
  }][];
47
47
  export declare class ProvideSharedPlugin<Enhanced extends boolean = false> extends RspackBuiltinPlugin {
48
48
  name: BuiltinPluginName;
@@ -39,7 +39,7 @@ export declare function createProvideShareOptions(normalizedSharedOptions: Norma
39
39
  singleton: boolean | undefined;
40
40
  requiredVersion: string | false | undefined;
41
41
  strictVersion: boolean | undefined;
42
- treeShakingMode: "server-calc" | "runtime-infer" | undefined;
42
+ treeShakingMode: "runtime-infer" | "server-calc" | undefined;
43
43
  };
44
44
  }[];
45
45
  export declare function createConsumeShareOptions(normalizedSharedOptions: NormalizedSharedOptions): {
@@ -52,7 +52,7 @@ export declare function createConsumeShareOptions(normalizedSharedOptions: Norma
52
52
  singleton: boolean | undefined;
53
53
  packageName: string | undefined;
54
54
  eager: boolean | undefined;
55
- treeShakingMode: "server-calc" | "runtime-infer" | undefined;
55
+ treeShakingMode: "runtime-infer" | "server-calc" | undefined;
56
56
  };
57
57
  }[];
58
58
  export declare class SharePlugin {
@@ -67,7 +67,7 @@ export declare class SharePlugin {
67
67
  singleton: boolean | undefined;
68
68
  packageName: string | undefined;
69
69
  eager: boolean | undefined;
70
- treeShakingMode: "server-calc" | "runtime-infer" | undefined;
70
+ treeShakingMode: "runtime-infer" | "server-calc" | undefined;
71
71
  };
72
72
  }[];
73
73
  _provides: {
@@ -79,7 +79,7 @@ export declare class SharePlugin {
79
79
  singleton: boolean | undefined;
80
80
  requiredVersion: string | false | undefined;
81
81
  strictVersion: boolean | undefined;
82
- treeShakingMode: "server-calc" | "runtime-infer" | undefined;
82
+ treeShakingMode: "runtime-infer" | "server-calc" | undefined;
83
83
  };
84
84
  }[];
85
85
  _enhanced: boolean;
@@ -12,5 +12,5 @@ type Selector<A, B> = (input: A) => B;
12
12
  export declare const concatComparators: (...comps: Comparator[]) => Comparator;
13
13
  export declare const compareIds: <T = string | number>(a: T, b: T) => -1 | 0 | 1;
14
14
  export declare const compareSelect: <T, R>(getter: Selector<T, R>, comparator: Comparator) => Comparator;
15
- export declare const compareNumbers: (a: number, b: number) => 0 | 1 | -1;
15
+ export declare const compareNumbers: (a: number, b: number) => -1 | 0 | 1;
16
16
  export {};
@@ -13,4 +13,4 @@ import Hash from './hash/index.js';
13
13
  * @param algorithm the algorithm name or a constructor creating a hash
14
14
  * @returns the hash
15
15
  */
16
- export declare const createHash: (algorithm: "xxhash64" | "md4" | "native-md4" | (string & {}) | (new () => Hash)) => Hash;
16
+ export declare const createHash: (algorithm: 'xxhash64' | 'md4' | 'native-md4' | (string & {}) | (new () => Hash)) => Hash;
@@ -7,25 +7,52 @@ interface ParsedResource {
7
7
  type ParsedResourceWithoutFragment = Omit<ParsedResource, 'fragment'>;
8
8
  export declare const makePathsRelative: {
9
9
  (context: string, identifier: string, associatedObjectForCache: object | undefined): string;
10
- bindCache(associatedObjectForCache: object | undefined): ((arg0: string, arg1: string) => string);
11
- bindContextCache(context: string, associatedObjectForCache: object | undefined): ((arg0: string) => string);
10
+ /**
11
+ * @param {Object=} associatedObjectForCache an object to which the cache will be attached
12
+ * @returns {function(string, string): string} cached function
13
+ */
14
+ bindCache: (associatedObjectForCache: object | undefined) => ((arg0: string, arg1: string) => string);
15
+ /**
16
+ * @param {string} context context used to create relative path
17
+ * @param {Object=} associatedObjectForCache an object to which the cache will be attached
18
+ * @returns {function(string): string} cached function
19
+ */
20
+ bindContextCache: (context: string, associatedObjectForCache: object | undefined) => ((arg0: string) => string);
12
21
  };
13
22
  export declare const contextify: {
14
23
  (context: string, identifier: string, associatedObjectForCache: object | undefined): string;
15
- bindCache(associatedObjectForCache: object | undefined): ((arg0: string, arg1: string) => string);
16
- bindContextCache(context: string, associatedObjectForCache: object | undefined): ((arg0: string) => string);
24
+ /**
25
+ * @param {Object=} associatedObjectForCache an object to which the cache will be attached
26
+ * @returns {function(string, string): string} cached function
27
+ */
28
+ bindCache: (associatedObjectForCache: object | undefined) => ((arg0: string, arg1: string) => string);
29
+ /**
30
+ * @param {string} context context used to create relative path
31
+ * @param {Object=} associatedObjectForCache an object to which the cache will be attached
32
+ * @returns {function(string): string} cached function
33
+ */
34
+ bindContextCache: (context: string, associatedObjectForCache: object | undefined) => ((arg0: string) => string);
17
35
  };
18
36
  export declare const absolutify: {
19
37
  (context: string, identifier: string, associatedObjectForCache: object | undefined): string;
20
- bindCache(associatedObjectForCache: object | undefined): ((arg0: string, arg1: string) => string);
21
- bindContextCache(context: string, associatedObjectForCache: object | undefined): ((arg0: string) => string);
38
+ /**
39
+ * @param {Object=} associatedObjectForCache an object to which the cache will be attached
40
+ * @returns {function(string, string): string} cached function
41
+ */
42
+ bindCache: (associatedObjectForCache: object | undefined) => ((arg0: string, arg1: string) => string);
43
+ /**
44
+ * @param {string} context context used to create relative path
45
+ * @param {Object=} associatedObjectForCache an object to which the cache will be attached
46
+ * @returns {function(string): string} cached function
47
+ */
48
+ bindContextCache: (context: string, associatedObjectForCache: object | undefined) => ((arg0: string) => string);
22
49
  };
23
50
  export declare const parseResource: {
24
51
  (str: string, associatedObjectForCache?: object): ParsedResource;
25
- bindCache(associatedObjectForCache: object): (str: string) => ParsedResource;
52
+ bindCache: (associatedObjectForCache: object) => (str: string) => ParsedResource;
26
53
  };
27
54
  export declare const parseResourceWithoutFragment: {
28
55
  (str: string, associatedObjectForCache?: object): ParsedResourceWithoutFragment;
29
- bindCache(associatedObjectForCache: object): (str: string) => ParsedResourceWithoutFragment;
56
+ bindCache: (associatedObjectForCache: object) => (str: string) => ParsedResourceWithoutFragment;
30
57
  };
31
58
  export {};
package/module.d.ts CHANGED
@@ -235,6 +235,12 @@ interface ImportMeta {
235
235
  mode?: 'sync' | 'eager' | 'weak' | 'lazy' | 'lazy-once';
236
236
  },
237
237
  ) => Rspack.Context;
238
+ /**
239
+ * Available in server components when using the RSC plugins.
240
+ */
241
+ rspackRsc?: {
242
+ loadCss(): any;
243
+ };
238
244
  }
239
245
 
240
246
  declare const __resourceQuery: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "Fast Rust-based bundler for the web with a modernized webpack API",
@@ -37,18 +37,18 @@
37
37
  "directory": "packages/rspack"
38
38
  },
39
39
  "devDependencies": {
40
- "@ast-grep/napi": "^0.42.1",
40
+ "@ast-grep/napi": "^0.42.2",
41
41
  "@napi-rs/wasm-runtime": "1.1.4",
42
42
  "@rsbuild/plugin-node-polyfill": "^1.4.4",
43
- "@rslib/core": "0.21.3",
43
+ "@rslib/core": "^0.21.5",
44
44
  "@rspack/lite-tapable": "1.1.0",
45
45
  "@swc/types": "0.1.26",
46
- "@types/node": "^20.19.39",
46
+ "@types/node": "^20.19.41",
47
47
  "browserslist-load-config": "^1.0.1",
48
48
  "browserslist-to-es-version": "^1.4.1",
49
49
  "connect-next": "^4.0.1",
50
- "enhanced-resolve": "5.21.0",
51
- "http-proxy-middleware": "^4.0.0-beta.6",
50
+ "enhanced-resolve": "5.21.3",
51
+ "http-proxy-middleware": "^4.0.0",
52
52
  "memfs": "4.57.2",
53
53
  "open": "^11.0.0",
54
54
  "prebundle": "^1.6.4",
@@ -58,7 +58,7 @@
58
58
  "webpack-sources": "3.3.4"
59
59
  },
60
60
  "dependencies": {
61
- "@rspack/binding": "2.0.2"
61
+ "@rspack/binding": "2.0.4"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "@module-federation/runtime-tools": "^0.24.1 || ^2.0.0",