@rspack/core 0.5.9-canary-39b53e7-20240409044942 → 0.5.9-canary-245b951-20240409104441

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.
@@ -136,12 +136,8 @@ export declare class Compilation {
136
136
  * Source: [updateAsset](https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/lib/Compilation.js#L4320)
137
137
  *
138
138
  * FIXME: *AssetInfo* may be undefined in update fn for webpack impl, but still not implemented in rspack
139
- *
140
- * @param {string} file file name
141
- * @param {Source | function(Source): Source} newSourceOrFunction new asset source or function converting old to new
142
- * @param {AssetInfo | function(AssetInfo): AssetInfo} assetInfoUpdateOrFunction new asset info or function converting old to new
143
139
  */
144
- updateAsset(filename: string, newSourceOrFunction: Source | ((source: Source) => Source), assetInfoUpdateOrFunction: AssetInfo | ((assetInfo: AssetInfo) => AssetInfo)): void;
140
+ updateAsset(filename: string, newSourceOrFunction: Source | ((source: Source) => Source), assetInfoUpdateOrFunction?: AssetInfo | ((assetInfo: AssetInfo) => AssetInfo)): void;
145
141
  /**
146
142
  * Emit an not existing asset. Trying to emit an asset that already exists will throw an error.
147
143
  *
@@ -294,10 +294,6 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
294
294
  * Source: [updateAsset](https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/lib/Compilation.js#L4320)
295
295
  *
296
296
  * FIXME: *AssetInfo* may be undefined in update fn for webpack impl, but still not implemented in rspack
297
- *
298
- * @param {string} file file name
299
- * @param {Source | function(Source): Source} newSourceOrFunction new asset source or function converting old to new
300
- * @param {AssetInfo | function(AssetInfo): AssetInfo} assetInfoUpdateOrFunction new asset info or function converting old to new
301
297
  */
302
298
  updateAsset(filename, newSourceOrFunction, assetInfoUpdateOrFunction) {
303
299
  let compatNewSourceOrFunction;
@@ -309,9 +305,11 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
309
305
  else {
310
306
  compatNewSourceOrFunction = (0, createSource_1.createRawFromSource)(newSourceOrFunction);
311
307
  }
312
- __classPrivateFieldGet(this, _Compilation_inner, "f").updateAsset(filename, compatNewSourceOrFunction, typeof assetInfoUpdateOrFunction === "function"
313
- ? jsAssetInfo => (0, util_1.toJsAssetInfo)(assetInfoUpdateOrFunction(jsAssetInfo))
314
- : (0, util_1.toJsAssetInfo)(assetInfoUpdateOrFunction));
308
+ __classPrivateFieldGet(this, _Compilation_inner, "f").updateAsset(filename, compatNewSourceOrFunction, assetInfoUpdateOrFunction === undefined
309
+ ? assetInfoUpdateOrFunction
310
+ : typeof assetInfoUpdateOrFunction === "function"
311
+ ? jsAssetInfo => (0, util_1.toJsAssetInfo)(assetInfoUpdateOrFunction(jsAssetInfo))
312
+ : (0, util_1.toJsAssetInfo)(assetInfoUpdateOrFunction));
315
313
  }
316
314
  /**
317
315
  * Emit an not existing asset. Trying to emit an asset that already exists will throw an error.
@@ -0,0 +1,10 @@
1
+ import { BuiltinPluginName } from "@rspack/binding";
2
+ export declare const APIPlugin: {
3
+ new (): {
4
+ name: BuiltinPluginName;
5
+ _options: void;
6
+ affectedHooks: "make" | "compile" | "emit" | "afterEmit" | "invalid" | "done" | "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(): import("@rspack/binding").BuiltinPlugin;
8
+ apply(compiler: import("../Compiler").Compiler): void;
9
+ };
10
+ };
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.APIPlugin = void 0;
4
+ const binding_1 = require("@rspack/binding");
5
+ const base_1 = require("./base");
6
+ exports.APIPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.APIPlugin, () => { });
@@ -47,6 +47,7 @@ export * from "./MangleExportsPlugin";
47
47
  export * from "./BundlerInfoRspackPlugin";
48
48
  export * from "./ModuleConcatenationPlugin";
49
49
  export * from "./CssModulesPlugin";
50
+ export * from "./APIPlugin";
50
51
  export * from "./HtmlRspackPlugin";
51
52
  export * from "./CopyRspackPlugin";
52
53
  export * from "./SwcJsMinimizerPlugin";
@@ -65,6 +65,7 @@ __exportStar(require("./MangleExportsPlugin"), exports);
65
65
  __exportStar(require("./BundlerInfoRspackPlugin"), exports);
66
66
  __exportStar(require("./ModuleConcatenationPlugin"), exports);
67
67
  __exportStar(require("./CssModulesPlugin"), exports);
68
+ __exportStar(require("./APIPlugin"), exports);
68
69
  __exportStar(require("./HtmlRspackPlugin"), exports);
69
70
  __exportStar(require("./CopyRspackPlugin"), exports);
70
71
  __exportStar(require("./SwcJsMinimizerPlugin"), exports);
@@ -134,6 +134,7 @@ class RspackOptionsApply {
134
134
  new builtin_plugin_1.BundlerInfoRspackPlugin(options.experiments.rspackFuture.bundlerInfo).apply(compiler);
135
135
  }
136
136
  new builtin_plugin_1.InferAsyncModulesPlugin().apply(compiler);
137
+ new builtin_plugin_1.APIPlugin().apply(compiler);
137
138
  new builtin_plugin_1.DataUriPlugin().apply(compiler);
138
139
  new builtin_plugin_1.FileUriPlugin().apply(compiler);
139
140
  new builtin_plugin_1.EnsureChunkConditionsPlugin().apply(compiler);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "0.5.9-canary-39b53e7-20240409044942",
3
+ "version": "0.5.9-canary-245b951-20240409104441",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "A Fast Rust-based Web Bundler",
@@ -56,8 +56,8 @@
56
56
  "styled-components": "^6.0.8",
57
57
  "terser": "5.27.2",
58
58
  "wast-loader": "^1.11.4",
59
- "@rspack/core": "0.5.9-canary-39b53e7-20240409044942",
60
- "@rspack/plugin-minify": "^0.5.9-canary-39b53e7-20240409044942"
59
+ "@rspack/core": "0.5.9-canary-245b951-20240409104441",
60
+ "@rspack/plugin-minify": "^0.5.9-canary-245b951-20240409104441"
61
61
  },
62
62
  "dependencies": {
63
63
  "@module-federation/runtime-tools": "0.0.8",
@@ -72,7 +72,7 @@
72
72
  "webpack-sources": "3.2.3",
73
73
  "zod": "^3.21.4",
74
74
  "zod-validation-error": "1.3.1",
75
- "@rspack/binding": "0.5.9-canary-39b53e7-20240409044942"
75
+ "@rspack/binding": "0.5.9-canary-245b951-20240409104441"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "@swc/helpers": ">=0.5.1"