@module-federation/rspack
Advanced tools
Comparing version 0.0.0-next-20240511031741 to 0.0.0-next-20240514062402
@@ -6,10 +6,6 @@ 'use strict'; | ||
var sdk = require('@module-federation/sdk'); | ||
var manifest = require('@module-federation/manifest'); | ||
var managers = require('@module-federation/managers'); | ||
var manifest = require('@module-federation/manifest'); | ||
var dtsPlugin = require('@module-federation/dts-plugin'); | ||
function getIdentifier(name) { | ||
return "".concat(name).concat(sdk.SEPARATOR).concat(managers.utils.getBuildVersion()); | ||
} | ||
function _class_call_check(instance, Constructor) { | ||
@@ -97,7 +93,7 @@ if (!(instance instanceof Constructor)) { | ||
} | ||
var RuntimeToolsPath = require.resolve("@module-federation/runtime-tools"); | ||
var RuntimeToolsPath = require.resolve('@module-federation/runtime-tools'); | ||
var ModuleFederationPlugin = /*#__PURE__*/ function() { | ||
function ModuleFederationPlugin(options) { | ||
_class_call_check(this, ModuleFederationPlugin); | ||
_define_property(this, "name", "RspackModuleFederationPlugin"); | ||
_define_property(this, "name", 'RspackModuleFederationPlugin'); | ||
_define_property(this, "_options", void 0); | ||
@@ -111,5 +107,7 @@ this._options = options; | ||
var name = this._options.name; | ||
new compiler.webpack.DefinePlugin({ | ||
FEDERATION_BUILD_IDENTIFIER: JSON.stringify(getIdentifier(name)) | ||
}).apply(compiler); | ||
if (name) { | ||
new compiler.webpack.DefinePlugin({ | ||
FEDERATION_BUILD_IDENTIFIER: JSON.stringify(sdk.composeKeyWithSeparator(name, managers.utils.getBuildVersion())) | ||
}).apply(compiler); | ||
} | ||
} | ||
@@ -137,3 +135,3 @@ }, | ||
if (!options.name) { | ||
throw new Error("[ ModuleFederationPlugin ]: name is required"); | ||
throw new Error('[ ModuleFederationPlugin ]: name is required'); | ||
} | ||
@@ -161,3 +159,3 @@ this._checkSingleton(compiler); | ||
new compiler.webpack.container.ModuleFederationPlugin(options).apply(compiler); | ||
var runtimeESMPath = require.resolve("@module-federation/runtime/dist/index.esm.js", { | ||
var runtimeESMPath = require.resolve('@module-federation/runtime/dist/index.esm.js', { | ||
paths: [ | ||
@@ -167,5 +165,5 @@ options.implementation | ||
}); | ||
compiler.hooks.afterPlugins.tap("PatchAliasWebpackPlugin", function() { | ||
compiler.hooks.afterPlugins.tap('PatchAliasWebpackPlugin', function() { | ||
compiler.options.resolve.alias = _object_spread_props(_object_spread({}, compiler.options.resolve.alias), { | ||
"@module-federation/runtime$": runtimeESMPath | ||
'@module-federation/runtime$': runtimeESMPath | ||
}); | ||
@@ -176,3 +174,3 @@ }); | ||
pluginVersion: "0.1.12", | ||
bundler: "rspack" | ||
bundler: 'rspack' | ||
}).apply(compiler); | ||
@@ -188,8 +186,8 @@ } | ||
switch(typeof cacheGroup === "undefined" ? "undefined" : _type_of(cacheGroup)){ | ||
case "boolean": | ||
case "string": | ||
case "function": | ||
case 'boolean': | ||
case 'string': | ||
case 'function': | ||
break; | ||
// cacheGroup.chunks will inherit splitChunks.chunks, so you only need to modify the chunks that are set separately | ||
case "object": | ||
case 'object': | ||
{ | ||
@@ -202,6 +200,6 @@ if (_instanceof(cacheGroup, RegExp)) { | ||
} | ||
if (typeof cacheGroup.chunks === "function") { | ||
if (typeof cacheGroup.chunks === 'function') { | ||
var prevChunks = cacheGroup.chunks; | ||
cacheGroup.chunks = function(chunk) { | ||
if (chunk.name && (chunk.name === name || chunk.name === name + "_partial")) { | ||
if (chunk.name && (chunk.name === name || chunk.name === name + '_partial')) { | ||
return false; | ||
@@ -213,9 +211,9 @@ } | ||
} | ||
if (cacheGroup.chunks === "all") { | ||
cacheGroup.chunks = new RegExp("^(?!.*(".concat(name, "|").concat(name, "_partial)).*$"), "g"); | ||
if (cacheGroup.chunks === 'all') { | ||
cacheGroup.chunks = new RegExp("^(?!.*(".concat(name, "|").concat(name, "_partial)).*$"), 'g'); | ||
break; | ||
} | ||
if (cacheGroup.chunks === "initial") { | ||
if (cacheGroup.chunks === 'initial') { | ||
cacheGroup.chunks = function(chunk) { | ||
if (chunk.name && (chunk.name === name || chunk.name === name + "_partial")) { | ||
if (chunk.name && (chunk.name === name || chunk.name === name + '_partial')) { | ||
return false; | ||
@@ -222,0 +220,0 @@ } |
@@ -1,10 +0,6 @@ | ||
import { SEPARATOR } from '@module-federation/sdk'; | ||
import { composeKeyWithSeparator } from '@module-federation/sdk'; | ||
import { StatsPlugin } from '@module-federation/manifest'; | ||
import { utils, ContainerManager } from '@module-federation/managers'; | ||
import { StatsPlugin } from '@module-federation/manifest'; | ||
import { DtsPlugin } from '@module-federation/dts-plugin'; | ||
function getIdentifier(name) { | ||
return "".concat(name).concat(SEPARATOR).concat(utils.getBuildVersion()); | ||
} | ||
function _class_call_check(instance, Constructor) { | ||
@@ -92,7 +88,7 @@ if (!(instance instanceof Constructor)) { | ||
} | ||
var RuntimeToolsPath = require.resolve("@module-federation/runtime-tools"); | ||
var RuntimeToolsPath = require.resolve('@module-federation/runtime-tools'); | ||
var ModuleFederationPlugin = /*#__PURE__*/ function() { | ||
function ModuleFederationPlugin(options) { | ||
_class_call_check(this, ModuleFederationPlugin); | ||
_define_property(this, "name", "RspackModuleFederationPlugin"); | ||
_define_property(this, "name", 'RspackModuleFederationPlugin'); | ||
_define_property(this, "_options", void 0); | ||
@@ -106,5 +102,7 @@ this._options = options; | ||
var name = this._options.name; | ||
new compiler.webpack.DefinePlugin({ | ||
FEDERATION_BUILD_IDENTIFIER: JSON.stringify(getIdentifier(name)) | ||
}).apply(compiler); | ||
if (name) { | ||
new compiler.webpack.DefinePlugin({ | ||
FEDERATION_BUILD_IDENTIFIER: JSON.stringify(composeKeyWithSeparator(name, utils.getBuildVersion())) | ||
}).apply(compiler); | ||
} | ||
} | ||
@@ -132,3 +130,3 @@ }, | ||
if (!options.name) { | ||
throw new Error("[ ModuleFederationPlugin ]: name is required"); | ||
throw new Error('[ ModuleFederationPlugin ]: name is required'); | ||
} | ||
@@ -156,3 +154,3 @@ this._checkSingleton(compiler); | ||
new compiler.webpack.container.ModuleFederationPlugin(options).apply(compiler); | ||
var runtimeESMPath = require.resolve("@module-federation/runtime/dist/index.esm.js", { | ||
var runtimeESMPath = require.resolve('@module-federation/runtime/dist/index.esm.js', { | ||
paths: [ | ||
@@ -162,5 +160,5 @@ options.implementation | ||
}); | ||
compiler.hooks.afterPlugins.tap("PatchAliasWebpackPlugin", function() { | ||
compiler.hooks.afterPlugins.tap('PatchAliasWebpackPlugin', function() { | ||
compiler.options.resolve.alias = _object_spread_props(_object_spread({}, compiler.options.resolve.alias), { | ||
"@module-federation/runtime$": runtimeESMPath | ||
'@module-federation/runtime$': runtimeESMPath | ||
}); | ||
@@ -171,3 +169,3 @@ }); | ||
pluginVersion: "0.1.12", | ||
bundler: "rspack" | ||
bundler: 'rspack' | ||
}).apply(compiler); | ||
@@ -183,8 +181,8 @@ } | ||
switch(typeof cacheGroup === "undefined" ? "undefined" : _type_of(cacheGroup)){ | ||
case "boolean": | ||
case "string": | ||
case "function": | ||
case 'boolean': | ||
case 'string': | ||
case 'function': | ||
break; | ||
// cacheGroup.chunks will inherit splitChunks.chunks, so you only need to modify the chunks that are set separately | ||
case "object": | ||
case 'object': | ||
{ | ||
@@ -197,6 +195,6 @@ if (_instanceof(cacheGroup, RegExp)) { | ||
} | ||
if (typeof cacheGroup.chunks === "function") { | ||
if (typeof cacheGroup.chunks === 'function') { | ||
var prevChunks = cacheGroup.chunks; | ||
cacheGroup.chunks = function(chunk) { | ||
if (chunk.name && (chunk.name === name || chunk.name === name + "_partial")) { | ||
if (chunk.name && (chunk.name === name || chunk.name === name + '_partial')) { | ||
return false; | ||
@@ -208,9 +206,9 @@ } | ||
} | ||
if (cacheGroup.chunks === "all") { | ||
cacheGroup.chunks = new RegExp("^(?!.*(".concat(name, "|").concat(name, "_partial)).*$"), "g"); | ||
if (cacheGroup.chunks === 'all') { | ||
cacheGroup.chunks = new RegExp("^(?!.*(".concat(name, "|").concat(name, "_partial)).*$"), 'g'); | ||
break; | ||
} | ||
if (cacheGroup.chunks === "initial") { | ||
if (cacheGroup.chunks === 'initial') { | ||
cacheGroup.chunks = function(chunk) { | ||
if (chunk.name && (chunk.name === name || chunk.name === name + "_partial")) { | ||
if (chunk.name && (chunk.name === name || chunk.name === name + '_partial')) { | ||
return false; | ||
@@ -217,0 +215,0 @@ } |
{ | ||
"name": "@module-federation/rspack", | ||
"version": "0.0.0-next-20240511031741", | ||
"version": "0.0.0-next-20240514062402", | ||
"license": "MIT", | ||
@@ -22,7 +22,7 @@ "keywords": [ | ||
"dependencies": { | ||
"@module-federation/sdk": "0.0.0-next-20240511031741", | ||
"@module-federation/runtime-tools": "0.0.0-next-20240511031741", | ||
"@module-federation/manifest": "0.0.0-next-20240511031741", | ||
"@module-federation/managers": "0.0.0-next-20240511031741", | ||
"@module-federation/dts-plugin": "0.0.0-next-20240511031741" | ||
"@module-federation/sdk": "0.0.0-next-20240514062402", | ||
"@module-federation/runtime-tools": "0.0.0-next-20240514062402", | ||
"@module-federation/manifest": "0.0.0-next-20240514062402", | ||
"@module-federation/managers": "0.0.0-next-20240514062402", | ||
"@module-federation/dts-plugin": "0.0.0-next-20240514062402" | ||
}, | ||
@@ -29,0 +29,0 @@ "devDependencies": { |
69
25191
10
479
+ Added@module-federation/dts-plugin@0.0.0-next-20240514062402(transitive)
+ Added@module-federation/managers@0.0.0-next-20240514062402(transitive)
+ Added@module-federation/manifest@0.0.0-next-20240514062402(transitive)
+ Added@module-federation/runtime@0.0.0-next-20240514062402(transitive)
+ Added@module-federation/runtime-tools@0.0.0-next-20240514062402(transitive)
+ Added@module-federation/sdk@0.0.0-next-20240514062402(transitive)
+ Added@module-federation/third-party-dts-extractor@0.0.0-next-20240514062402(transitive)
+ Added@module-federation/webpack-bundler-runtime@0.0.0-next-20240514062402(transitive)
- Removed@module-federation/dts-plugin@0.0.0-next-20240511031741(transitive)
- Removed@module-federation/managers@0.0.0-next-20240511031741(transitive)
- Removed@module-federation/manifest@0.0.0-next-20240511031741(transitive)
- Removed@module-federation/runtime@0.0.0-next-20240511031741(transitive)
- Removed@module-federation/runtime-tools@0.0.0-next-20240511031741(transitive)
- Removed@module-federation/sdk@0.0.0-next-20240511031741(transitive)
- Removed@module-federation/third-party-dts-extractor@0.0.0-next-20240511031741(transitive)
- Removed@module-federation/webpack-bundler-runtime@0.0.0-next-20240511031741(transitive)
Updated@module-federation/dts-plugin@0.0.0-next-20240514062402
Updated@module-federation/managers@0.0.0-next-20240514062402
Updated@module-federation/manifest@0.0.0-next-20240514062402
Updated@module-federation/runtime-tools@0.0.0-next-20240514062402