@module-federation/node 0.11.0 → 0.11.1
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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.11.1](https://github.com/module-federation/nextjs-mf/compare/node-0.11.0...node-0.11.1) (2023-02-09)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* backward compatability with older versions pre 6.1.x ([f27b57a](https://github.com/module-federation/nextjs-mf/commit/f27b57a36a61280124bab4a309edaa1c3fd04ced))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
5
14
|
# [0.11.0](https://github.com/module-federation/nextjs-mf/compare/node-0.10.5...node-0.11.0) (2023-02-09)
|
|
6
15
|
|
|
7
16
|
### Dependency Updates
|
package/package.json
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
*/
|
|
5
5
|
declare const _default: "\n function loadScript(url, cb, chunkID) {\n if (global.webpackChunkLoad) {\n global.webpackChunkLoad(url).then(function (resp) {\n return resp.text();\n }).then(function (rawData) {\n cb(null, rawData);\n }).catch(function (err) {\n console.error('Federated Chunk load failed', error);\n return cb(error)\n });\n } else {\n //TODO https support\n let request = (url.startsWith('https') ? require('https') : require('http')).get(url, function (resp) {\n if (resp.statusCode === 200) {\n let rawData = '';\n resp.setEncoding('utf8');\n resp.on('data', chunk => {\n rawData += chunk;\n });\n resp.on('end', () => {\n cb(null, rawData);\n });\n } else {\n cb(resp);\n }\n });\n request.on('error', error => {\n console.error('Federated Chunk load failed', error);\n return cb(error)\n });\n }\n }\n";
|
|
6
6
|
export default _default;
|
|
7
|
-
export declare const executeLoadTemplate = "\n function executeLoad(url, callback, name) {\n if(!name) {\n throw new Error('__webpack_require__.l name is required for ' + url);\n }\n\n if (typeof global.__remote_scope__[name] !== 'undefined') return callback(global.__remote_scope__[name]);\n\n const vm = require('vm');\n (global.webpackChunkLoad || global.fetch || require(\"node-fetch\"))(url).then(function (res) {\n return res.text();\n }).then(function (scriptContent) {\n try {\n const vmContext = {exports, require, module, global, __filename, __dirname, URL, URLSearchParams, console, process,Buffer, ...global, remoteEntryName: name};\n const remote = vm.runInNewContext(scriptContent + '\\nmodule.exports', vmContext, {filename: 'node-federation-loader-' + name + '.vm'});\n const foundContainer = remote[name] || remote\n\n if(!global.__remote_scope__[name]) {\n global.__remote_scope__[name] = {\n get: foundContainer.get,\n init: function(initScope, initToken) {\n try {\n foundContainer.init(initScope, initToken)\n } catch (e) {\n // already initialized\n }\n }\n };\n global.__remote_scope__._config[name] = url;\n }\n callback(global.__remote_scope__[name]);\n } catch (e) {\n console.error('executeLoad hit catch block');\n e.target = {src: url};\n callback(e);\n }\n }).catch((e) => {\n e.target = {src: url};\n callback(e);\n });\n }\n";
|
|
7
|
+
export declare const executeLoadTemplate = "\n function executeLoad(url, callback, name) {\n if(!name) {\n throw new Error('__webpack_require__.l name is required for ' + url);\n }\n\n if (typeof global.__remote_scope__[name] !== 'undefined') return callback(global.__remote_scope__[name]);\n\n const vm = require('vm');\n (global.webpackChunkLoad || global.fetch || require(\"node-fetch\"))(url).then(function (res) {\n return res.text();\n }).then(function (scriptContent) {\n try {\n // TODO: remove conditional in v7, this is to prevent breaking change between v6.0.x and v6.1.x\n const vmContext = typeof URLSearchParams === 'undefined' ?\n {exports, require, module, global, __filename, __dirname, URL, console, process,Buffer, ...global, remoteEntryName: name} :\n {exports, require, module, global, __filename, __dirname, URL, URLSearchParams, console, process,Buffer, ...global, remoteEntryName: name};\n\n const remote = vm.runInNewContext(scriptContent + '\\nmodule.exports', vmContext, {filename: 'node-federation-loader-' + name + '.vm'});\n const foundContainer = remote[name] || remote\n\n if(!global.__remote_scope__[name]) {\n global.__remote_scope__[name] = {\n get: foundContainer.get,\n init: function(initScope, initToken) {\n try {\n foundContainer.init(initScope, initToken)\n } catch (e) {\n // already initialized\n }\n }\n };\n global.__remote_scope__._config[name] = url;\n }\n callback(global.__remote_scope__[name]);\n } catch (e) {\n console.error('executeLoad hit catch block');\n e.target = {src: url};\n callback(e);\n }\n }).catch((e) => {\n e.target = {src: url};\n callback(e);\n });\n }\n";
|
|
@@ -55,7 +55,11 @@ exports.executeLoadTemplate = `
|
|
|
55
55
|
return res.text();
|
|
56
56
|
}).then(function (scriptContent) {
|
|
57
57
|
try {
|
|
58
|
-
|
|
58
|
+
// TODO: remove conditional in v7, this is to prevent breaking change between v6.0.x and v6.1.x
|
|
59
|
+
const vmContext = typeof URLSearchParams === 'undefined' ?
|
|
60
|
+
{exports, require, module, global, __filename, __dirname, URL, console, process,Buffer, ...global, remoteEntryName: name} :
|
|
61
|
+
{exports, require, module, global, __filename, __dirname, URL, URLSearchParams, console, process,Buffer, ...global, remoteEntryName: name};
|
|
62
|
+
|
|
59
63
|
const remote = vm.runInNewContext(scriptContent + '\\nmodule.exports', vmContext, {filename: 'node-federation-loader-' + name + '.vm'});
|
|
60
64
|
const foundContainer = remote[name] || remote
|
|
61
65
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadScript.js","sourceRoot":"","sources":["../../../../../packages/node/src/plugins/loadScript.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,aAAa;AACb,kBAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCd,CAAC;AAEF,0EAA0E;AAC1E,aAAa;AACA,QAAA,mBAAmB,GAAG
|
|
1
|
+
{"version":3,"file":"loadScript.js","sourceRoot":"","sources":["../../../../../packages/node/src/plugins/loadScript.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,aAAa;AACb,kBAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCd,CAAC;AAEF,0EAA0E;AAC1E,aAAa;AACA,QAAA,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6ClC,CAAC"}
|