@rspack-canary/browser 1.6.2-canary-86b743b4-20251108173831 → 1.6.2-canary-ae75bb5c-20251110081755
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.
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type BuiltinPlugin, BuiltinPluginName } from "../binding";
|
|
2
|
+
import { RspackBuiltinPlugin } from "../builtin-plugin/base";
|
|
3
|
+
import type { Compiler } from "../Compiler";
|
|
4
|
+
export type RemoteAliasMap = Record<string, {
|
|
5
|
+
name: string;
|
|
6
|
+
entry?: string;
|
|
7
|
+
}>;
|
|
8
|
+
export type ManifestExposeOption = {
|
|
9
|
+
path: string;
|
|
10
|
+
name: string;
|
|
11
|
+
};
|
|
12
|
+
export type ManifestSharedOption = {
|
|
13
|
+
name: string;
|
|
14
|
+
version?: string;
|
|
15
|
+
requiredVersion?: string;
|
|
16
|
+
singleton?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type ModuleFederationManifestPluginOptions = {
|
|
19
|
+
name?: string;
|
|
20
|
+
globalName?: string;
|
|
21
|
+
filePath?: string;
|
|
22
|
+
disableAssetsAnalyze?: boolean;
|
|
23
|
+
fileName?: string;
|
|
24
|
+
remoteAliasMap?: RemoteAliasMap;
|
|
25
|
+
exposes?: ManifestExposeOption[];
|
|
26
|
+
shared?: ManifestSharedOption[];
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* JS-side post-processing plugin: reads mf-manifest.json and mf-stats.json, executes additionalData callback and merges/overwrites manifest.
|
|
30
|
+
* To avoid cross-NAPI callback complexity, this plugin runs at the afterProcessAssets stage to ensure Rust-side MfManifestPlugin has already output its artifacts.
|
|
31
|
+
*/
|
|
32
|
+
export declare class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
|
|
33
|
+
name: BuiltinPluginName;
|
|
34
|
+
private opts;
|
|
35
|
+
constructor(opts: ModuleFederationManifestPluginOptions);
|
|
36
|
+
raw(compiler: Compiler): BuiltinPlugin;
|
|
37
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { Compiler } from "../Compiler";
|
|
2
|
+
import { type ModuleFederationManifestPluginOptions } from "./ModuleFederationManifestPlugin";
|
|
2
3
|
import type { ModuleFederationPluginV1Options } from "./ModuleFederationPluginV1";
|
|
3
4
|
export interface ModuleFederationPluginOptions extends Omit<ModuleFederationPluginV1Options, "enhanced"> {
|
|
4
5
|
runtimePlugins?: RuntimePlugins;
|
|
5
6
|
implementation?: string;
|
|
6
7
|
shareStrategy?: "version-first" | "loaded-first";
|
|
8
|
+
manifest?: boolean | Omit<ModuleFederationManifestPluginOptions, "remoteAliasMap" | "globalName" | "name" | "exposes" | "shared">;
|
|
7
9
|
}
|
|
8
10
|
export type RuntimePlugins = string[] | [string, Record<string, unknown>][];
|
|
9
11
|
export declare class ModuleFederationPlugin {
|
package/dist/index.mjs
CHANGED
|
@@ -58126,7 +58126,7 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
|
|
|
58126
58126
|
if ("object" == typeof rspackFuture) {
|
|
58127
58127
|
D(rspackFuture, "bundlerInfo", {});
|
|
58128
58128
|
if ("object" == typeof rspackFuture.bundlerInfo) {
|
|
58129
|
-
D(rspackFuture.bundlerInfo, "version", "1.6.2-canary-
|
|
58129
|
+
D(rspackFuture.bundlerInfo, "version", "1.6.2-canary-ae75bb5c-20251110081755");
|
|
58130
58130
|
D(rspackFuture.bundlerInfo, "bundler", "rspack");
|
|
58131
58131
|
D(rspackFuture.bundlerInfo, "force", !library);
|
|
58132
58132
|
}
|
|
@@ -62074,7 +62074,7 @@ class MultiStats {
|
|
|
62074
62074
|
return obj;
|
|
62075
62075
|
});
|
|
62076
62076
|
if (childOptions.version) {
|
|
62077
|
-
obj.rspackVersion = "1.6.2-canary-
|
|
62077
|
+
obj.rspackVersion = "1.6.2-canary-ae75bb5c-20251110081755";
|
|
62078
62078
|
obj.version = "5.75.0";
|
|
62079
62079
|
}
|
|
62080
62080
|
if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join("");
|
|
@@ -63379,7 +63379,7 @@ const SIMPLE_EXTRACTORS = {
|
|
|
63379
63379
|
},
|
|
63380
63380
|
version: (object)=>{
|
|
63381
63381
|
object.version = "5.75.0";
|
|
63382
|
-
object.rspackVersion = "1.6.2-canary-
|
|
63382
|
+
object.rspackVersion = "1.6.2-canary-ae75bb5c-20251110081755";
|
|
63383
63383
|
},
|
|
63384
63384
|
env: (object, _compilation, _context, { _env })=>{
|
|
63385
63385
|
object.env = _env;
|
|
@@ -65808,6 +65808,100 @@ class NodeTemplatePlugin {
|
|
|
65808
65808
|
this._options = _options;
|
|
65809
65809
|
}
|
|
65810
65810
|
}
|
|
65811
|
+
const VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
|
|
65812
|
+
function isRequiredVersion(str) {
|
|
65813
|
+
return VERSION_PATTERN_REGEXP.test(str);
|
|
65814
|
+
}
|
|
65815
|
+
var ModuleFederationManifestPlugin_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
|
|
65816
|
+
function ModuleFederationManifestPlugin_define_property(obj, key, value) {
|
|
65817
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
65818
|
+
value: value,
|
|
65819
|
+
enumerable: true,
|
|
65820
|
+
configurable: true,
|
|
65821
|
+
writable: true
|
|
65822
|
+
});
|
|
65823
|
+
else obj[key] = value;
|
|
65824
|
+
return obj;
|
|
65825
|
+
}
|
|
65826
|
+
const MANIFEST_FILE_NAME = "mf-manifest.json";
|
|
65827
|
+
const STATS_FILE_NAME = "mf-stats.json";
|
|
65828
|
+
const LOCAL_BUILD_VERSION = "local";
|
|
65829
|
+
const JSON_EXT = ".json";
|
|
65830
|
+
function isPlainObject(value) {
|
|
65831
|
+
return Boolean(value) && "object" == typeof value && !Array.isArray(value);
|
|
65832
|
+
}
|
|
65833
|
+
function parseJSON(input, guard) {
|
|
65834
|
+
try {
|
|
65835
|
+
const parsed = JSON.parse(input);
|
|
65836
|
+
if (guard(parsed)) return parsed;
|
|
65837
|
+
} catch {}
|
|
65838
|
+
}
|
|
65839
|
+
function readPKGJson(root) {
|
|
65840
|
+
const base = root ? (0, path_browserify.resolve)(root) : ModuleFederationManifestPlugin_process.cwd();
|
|
65841
|
+
const pkgPath = (0, path_browserify.join)(base, "package.json");
|
|
65842
|
+
try {
|
|
65843
|
+
const content = (0, browser_fs.readFileSync)(pkgPath, "utf-8");
|
|
65844
|
+
const parsed = parseJSON(content, isPlainObject);
|
|
65845
|
+
if (parsed) {
|
|
65846
|
+
const filtered = {};
|
|
65847
|
+
for (const [key, value] of Object.entries(parsed))if ("string" == typeof value) filtered[key] = value;
|
|
65848
|
+
if (Object.keys(filtered).length > 0) return filtered;
|
|
65849
|
+
}
|
|
65850
|
+
} catch {}
|
|
65851
|
+
return {};
|
|
65852
|
+
}
|
|
65853
|
+
function getBuildInfo(isDev, root) {
|
|
65854
|
+
const rootPath = root || ModuleFederationManifestPlugin_process.cwd();
|
|
65855
|
+
const pkg = readPKGJson(rootPath);
|
|
65856
|
+
const buildVersion = isDev ? LOCAL_BUILD_VERSION : pkg?.version;
|
|
65857
|
+
return {
|
|
65858
|
+
buildVersion: ModuleFederationManifestPlugin_process.env.MF_BUILD_VERSION || buildVersion || "UNKNOWN",
|
|
65859
|
+
buildName: ModuleFederationManifestPlugin_process.env.MF_BUILD_NAME || pkg?.name || "UNKNOWN"
|
|
65860
|
+
};
|
|
65861
|
+
}
|
|
65862
|
+
function getFileName(manifestOptions) {
|
|
65863
|
+
if (!manifestOptions) return {
|
|
65864
|
+
statsFileName: STATS_FILE_NAME,
|
|
65865
|
+
manifestFileName: MANIFEST_FILE_NAME
|
|
65866
|
+
};
|
|
65867
|
+
const filePath = "boolean" == typeof manifestOptions ? "" : manifestOptions.filePath || "";
|
|
65868
|
+
const fileName = "boolean" == typeof manifestOptions ? "" : manifestOptions.fileName || "";
|
|
65869
|
+
const addExt = (name)=>{
|
|
65870
|
+
if (name.endsWith(JSON_EXT)) return name;
|
|
65871
|
+
return `${name}${JSON_EXT}`;
|
|
65872
|
+
};
|
|
65873
|
+
const insertSuffix = (name, suffix)=>name.replace(JSON_EXT, `${suffix}${JSON_EXT}`);
|
|
65874
|
+
const manifestFileName = fileName ? addExt(fileName) : MANIFEST_FILE_NAME;
|
|
65875
|
+
const statsFileName = fileName ? insertSuffix(manifestFileName, "-stats") : STATS_FILE_NAME;
|
|
65876
|
+
return {
|
|
65877
|
+
statsFileName: (0, path_browserify.join)(filePath, statsFileName),
|
|
65878
|
+
manifestFileName: (0, path_browserify.join)(filePath, manifestFileName)
|
|
65879
|
+
};
|
|
65880
|
+
}
|
|
65881
|
+
class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
|
|
65882
|
+
raw(compiler) {
|
|
65883
|
+
const { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = this.opts;
|
|
65884
|
+
const { statsFileName, manifestFileName } = getFileName(this.opts);
|
|
65885
|
+
const rawOptions = {
|
|
65886
|
+
name: this.opts.name,
|
|
65887
|
+
globalName: this.opts.globalName,
|
|
65888
|
+
fileName,
|
|
65889
|
+
filePath,
|
|
65890
|
+
manifestFileName,
|
|
65891
|
+
statsFileName,
|
|
65892
|
+
disableAssetsAnalyze,
|
|
65893
|
+
remoteAliasMap,
|
|
65894
|
+
exposes,
|
|
65895
|
+
shared,
|
|
65896
|
+
buildInfo: getBuildInfo("development" === compiler.options.mode, compiler.context)
|
|
65897
|
+
};
|
|
65898
|
+
return createBuiltinPlugin(this.name, rawOptions);
|
|
65899
|
+
}
|
|
65900
|
+
constructor(opts){
|
|
65901
|
+
super(), ModuleFederationManifestPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin), ModuleFederationManifestPlugin_define_property(this, "opts", void 0);
|
|
65902
|
+
this.opts = opts;
|
|
65903
|
+
}
|
|
65904
|
+
}
|
|
65811
65905
|
const ModuleFederationRuntimePlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
|
|
65812
65906
|
const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
|
|
65813
65907
|
const array = (items)=>{
|
|
@@ -65860,12 +65954,93 @@ class ModuleFederationPlugin {
|
|
|
65860
65954
|
...this._options,
|
|
65861
65955
|
enhanced: true
|
|
65862
65956
|
}).apply(compiler);
|
|
65957
|
+
if (this._options.manifest) {
|
|
65958
|
+
const manifestOptions = true === this._options.manifest ? {} : {
|
|
65959
|
+
...this._options.manifest
|
|
65960
|
+
};
|
|
65961
|
+
const containerName = manifestOptions.name ?? this._options.name;
|
|
65962
|
+
const globalName = manifestOptions.globalName ?? resolveLibraryGlobalName(this._options.library) ?? containerName;
|
|
65963
|
+
const remoteAliasMap = Object.entries(getRemoteInfos(this._options)).reduce((sum, cur)=>{
|
|
65964
|
+
if (cur[1].length > 1) return sum;
|
|
65965
|
+
const remoteInfo = cur[1][0];
|
|
65966
|
+
const { entry, alias, name } = remoteInfo;
|
|
65967
|
+
if (entry && name) sum[alias] = {
|
|
65968
|
+
name,
|
|
65969
|
+
entry
|
|
65970
|
+
};
|
|
65971
|
+
return sum;
|
|
65972
|
+
}, {});
|
|
65973
|
+
const manifestExposes = collectManifestExposes(this._options.exposes);
|
|
65974
|
+
if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
|
|
65975
|
+
const manifestShared = collectManifestShared(this._options.shared);
|
|
65976
|
+
if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
|
|
65977
|
+
new ModuleFederationManifestPlugin({
|
|
65978
|
+
...manifestOptions,
|
|
65979
|
+
name: containerName,
|
|
65980
|
+
globalName,
|
|
65981
|
+
remoteAliasMap
|
|
65982
|
+
}).apply(compiler);
|
|
65983
|
+
}
|
|
65863
65984
|
}
|
|
65864
65985
|
constructor(_options){
|
|
65865
65986
|
ModuleFederationPlugin_define_property(this, "_options", void 0);
|
|
65866
65987
|
this._options = _options;
|
|
65867
65988
|
}
|
|
65868
65989
|
}
|
|
65990
|
+
function collectManifestExposes(exposes) {
|
|
65991
|
+
if (!exposes) return;
|
|
65992
|
+
const parsed = parseOptions(exposes, (value, key)=>({
|
|
65993
|
+
import: Array.isArray(value) ? value : [
|
|
65994
|
+
value
|
|
65995
|
+
],
|
|
65996
|
+
name: void 0
|
|
65997
|
+
}), (value)=>({
|
|
65998
|
+
import: Array.isArray(value.import) ? value.import : [
|
|
65999
|
+
value.import
|
|
66000
|
+
],
|
|
66001
|
+
name: value.name ?? void 0
|
|
66002
|
+
}));
|
|
66003
|
+
const result = parsed.map(([exposeKey, info])=>{
|
|
66004
|
+
const exposeName = info.name ?? exposeKey.replace(/^\.\//, "");
|
|
66005
|
+
return {
|
|
66006
|
+
path: exposeKey,
|
|
66007
|
+
name: exposeName
|
|
66008
|
+
};
|
|
66009
|
+
});
|
|
66010
|
+
return result.length > 0 ? result : void 0;
|
|
66011
|
+
}
|
|
66012
|
+
function collectManifestShared(shared) {
|
|
66013
|
+
if (!shared) return;
|
|
66014
|
+
const parsed = parseOptions(shared, (item, key)=>{
|
|
66015
|
+
if ("string" != typeof item) throw new Error("Unexpected array in shared");
|
|
66016
|
+
return item !== key && isRequiredVersion(item) ? {
|
|
66017
|
+
import: key,
|
|
66018
|
+
requiredVersion: item
|
|
66019
|
+
} : {
|
|
66020
|
+
import: item
|
|
66021
|
+
};
|
|
66022
|
+
}, (item)=>item);
|
|
66023
|
+
const result = parsed.map(([key, config])=>{
|
|
66024
|
+
const name = config.shareKey || key;
|
|
66025
|
+
const version = "string" == typeof config.version ? config.version : void 0;
|
|
66026
|
+
const requiredVersion = "string" == typeof config.requiredVersion ? config.requiredVersion : void 0;
|
|
66027
|
+
return {
|
|
66028
|
+
name,
|
|
66029
|
+
version,
|
|
66030
|
+
requiredVersion,
|
|
66031
|
+
singleton: config.singleton
|
|
66032
|
+
};
|
|
66033
|
+
});
|
|
66034
|
+
return result.length > 0 ? result : void 0;
|
|
66035
|
+
}
|
|
66036
|
+
function resolveLibraryGlobalName(library) {
|
|
66037
|
+
if (!library) return;
|
|
66038
|
+
const libName = library.name;
|
|
66039
|
+
if (!libName) return;
|
|
66040
|
+
if ("string" == typeof libName) return libName;
|
|
66041
|
+
if (Array.isArray(libName)) return libName[0];
|
|
66042
|
+
if ("object" == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
|
|
66043
|
+
}
|
|
65869
66044
|
function getRemoteInfos(options) {
|
|
65870
66045
|
if (!options.remotes) return {};
|
|
65871
66046
|
function extractUrlAndGlobal(urlAndGlobal) {
|
|
@@ -65991,10 +66166,6 @@ class ShareRuntimePlugin extends RspackBuiltinPlugin {
|
|
|
65991
66166
|
super(), ShareRuntimePlugin_define_property(this, "enhanced", void 0), ShareRuntimePlugin_define_property(this, "name", void 0), this.enhanced = enhanced, this.name = external_rspack_wasi_browser_js_.BuiltinPluginName.ShareRuntimePlugin;
|
|
65992
66167
|
}
|
|
65993
66168
|
}
|
|
65994
|
-
const VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
|
|
65995
|
-
function isRequiredVersion(str) {
|
|
65996
|
-
return VERSION_PATTERN_REGEXP.test(str);
|
|
65997
|
-
}
|
|
65998
66169
|
function ConsumeSharedPlugin_define_property(obj, key, value) {
|
|
65999
66170
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
66000
66171
|
value: value,
|
|
@@ -66345,7 +66516,7 @@ function transformSync(source, options) {
|
|
|
66345
66516
|
const _options = JSON.stringify(options || {});
|
|
66346
66517
|
return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
|
|
66347
66518
|
}
|
|
66348
|
-
const exports_rspackVersion = "1.6.2-canary-
|
|
66519
|
+
const exports_rspackVersion = "1.6.2-canary-ae75bb5c-20251110081755";
|
|
66349
66520
|
const exports_version = "5.75.0";
|
|
66350
66521
|
const exports_WebpackError = Error;
|
|
66351
66522
|
const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
|
package/dist/napi-binding.d.ts
CHANGED
|
@@ -545,6 +545,7 @@ export declare enum BuiltinPluginName {
|
|
|
545
545
|
ProvideSharedPlugin = 'ProvideSharedPlugin',
|
|
546
546
|
ConsumeSharedPlugin = 'ConsumeSharedPlugin',
|
|
547
547
|
ModuleFederationRuntimePlugin = 'ModuleFederationRuntimePlugin',
|
|
548
|
+
ModuleFederationManifestPlugin = 'ModuleFederationManifestPlugin',
|
|
548
549
|
NamedModuleIdsPlugin = 'NamedModuleIdsPlugin',
|
|
549
550
|
NaturalModuleIdsPlugin = 'NaturalModuleIdsPlugin',
|
|
550
551
|
DeterministicModuleIdsPlugin = 'DeterministicModuleIdsPlugin',
|
|
@@ -2434,6 +2435,32 @@ export interface RawLimitChunkCountPluginOptions {
|
|
|
2434
2435
|
maxChunks: number
|
|
2435
2436
|
}
|
|
2436
2437
|
|
|
2438
|
+
export interface RawManifestExposeOption {
|
|
2439
|
+
path: string
|
|
2440
|
+
name: string
|
|
2441
|
+
}
|
|
2442
|
+
|
|
2443
|
+
export interface RawManifestSharedOption {
|
|
2444
|
+
name: string
|
|
2445
|
+
version?: string
|
|
2446
|
+
requiredVersion?: string
|
|
2447
|
+
singleton?: boolean
|
|
2448
|
+
}
|
|
2449
|
+
|
|
2450
|
+
export interface RawModuleFederationManifestPluginOptions {
|
|
2451
|
+
name?: string
|
|
2452
|
+
globalName?: string
|
|
2453
|
+
fileName?: string
|
|
2454
|
+
filePath?: string
|
|
2455
|
+
statsFileName?: string
|
|
2456
|
+
manifestFileName?: string
|
|
2457
|
+
disableAssetsAnalyze?: boolean
|
|
2458
|
+
remoteAliasMap?: Record<string, RawRemoteAliasTarget>
|
|
2459
|
+
exposes?: Array<RawManifestExposeOption>
|
|
2460
|
+
shared?: Array<RawManifestSharedOption>
|
|
2461
|
+
buildInfo?: RawStatsBuildInfo
|
|
2462
|
+
}
|
|
2463
|
+
|
|
2437
2464
|
export interface RawModuleFederationRuntimePluginOptions {
|
|
2438
2465
|
entryRuntime?: string | undefined
|
|
2439
2466
|
}
|
|
@@ -2656,6 +2683,11 @@ export interface RawRelated {
|
|
|
2656
2683
|
sourceMap?: string
|
|
2657
2684
|
}
|
|
2658
2685
|
|
|
2686
|
+
export interface RawRemoteAliasTarget {
|
|
2687
|
+
name: string
|
|
2688
|
+
entry?: string
|
|
2689
|
+
}
|
|
2690
|
+
|
|
2659
2691
|
export interface RawRemoteOptions {
|
|
2660
2692
|
key: string
|
|
2661
2693
|
external: Array<string>
|
|
@@ -2815,6 +2847,11 @@ export interface RawSplitChunksOptions {
|
|
|
2815
2847
|
maxInitialSize?: number | RawSplitChunkSizes
|
|
2816
2848
|
}
|
|
2817
2849
|
|
|
2850
|
+
export interface RawStatsBuildInfo {
|
|
2851
|
+
buildVersion: string
|
|
2852
|
+
buildName?: string
|
|
2853
|
+
}
|
|
2854
|
+
|
|
2818
2855
|
export interface RawStatsOptions {
|
|
2819
2856
|
colors: boolean
|
|
2820
2857
|
}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack-canary/browser",
|
|
3
|
-
"version": "1.6.2-canary-
|
|
3
|
+
"version": "1.6.2-canary-ae75bb5c-20251110081755",
|
|
4
4
|
"webpackVersion": "5.75.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Rspack for running in the browser. This is still in early stage and may not follow the semver.",
|