@moneko/core 3.9.7 → 3.9.8-beta.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.
@@ -1 +1 @@
1
- import e from"webpack";import r from"webpack/lib/container/ModuleFederationPlugin.js";import{CONFIG as t}from"./config.js";import o from"./plugin/external-remotes.js";import{realResolve as s}from"./utils.js";let{NormalModuleReplacementPlugin:i}=e,a={},l={},n={},m=t.moduleFederation?.map(e=>{if(Array.isArray(e.remotes))for(let r=0,t=e.remotes.length;r<t;r++){let t=e.remotes[r],o=t.alias||t.name,s=t.filename||"remote_entry.js";if(n[o]=`${t.name}@${t.host}/${s}`,Array.isArray(t.library))for(let e=0,r=t.library.length;e<r;e++)a[t.library[e]]=`${o}/${t.library[e]}`}if(Array.isArray(e.exposes))for(let r=0,t=e.exposes.length;r<t;r++){let t=e.exposes[r];"string"==typeof t?l[`./${t}`]=s(t):"[object Object]"===Object.prototype.toString.call(t)&&(l[`./${t.name}`]=s(t.path))}return new r({filename:"remote_entry.js",...e,remotes:n,exposes:l})});m.length&&(m.push(new o),m.push(new i(/(.*)/,e=>{a[e.request]&&(e.request=a[e.request])})));export default m;
1
+ import e from"webpack";import{CONFIG as r}from"./config.js";import t from"./plugin/external-remotes.js";import{realResolve as o}from"./utils.js";let{NormalModuleReplacementPlugin:s,container:{ModuleFederationPlugin:a}}=e,i={},l={},n={},m=r.moduleFederation?.map(e=>{if(Array.isArray(e.remotes))for(let r=0,t=e.remotes.length;r<t;r++){let t=e.remotes[r],o=t.alias||t.name,s=t.filename||"remote_entry.js";if(n[o]=`${t.name}@${t.host}/${s}`,Array.isArray(t.library))for(let e=0,r=t.library.length;e<r;e++)i[t.library[e]]=`${o}/${t.library[e]}`}if(Array.isArray(e.exposes))for(let r=0,t=e.exposes.length;r<t;r++){let t=e.exposes[r];"string"==typeof t?l[`./${t}`]=o(t):"[object Object]"===Object.prototype.toString.call(t)&&(l[`./${t.name}`]=o(t.path))}return new a({filename:"remote_entry.js",...e,remotes:n,exposes:l})});m.length&&(m.push(new t),m.push(new s(/(.*)/,e=>{i[e.request]&&(e.request=i[e.request])})));export default m;
@@ -1 +1 @@
1
- import e from"webpack";import t from"webpack/lib/util/extractUrlAndGlobal.js";let{sources:o}=e,l="ExternalRemotesPlugin";export default class{apply(e){e.hooks.make.tap(l,e=>{let r=[];e.hooks.buildModule.tap(l,e=>{"ExternalModule"===e.constructor.name&&"script"===e.externalType&&r.push(e)}),e.hooks.afterCodeGeneration.tap(l,function(){r.map(l=>{let r=t(l.request)[0],a=function(e){let t=[],o=[],l=!1,r=!1;for(let a of e)if("["===a){if(l){r=!0;break}l=!0,o.length&&(t.push(`"${o.join("")}"`),o.length=0)}else if("]"===a){if(!l){r=!0;break}l=!1,o.length&&(t.push(`${o.join("")}`),o.length=0),o.length=0}else o.push(a);if(l||r)throw Error(`Invalid template URL "${e}"`);return o.length&&t.push(`"${o.join("")}"`),t.join(" + ")}(r),n=e.codeGenerationResults.get(l,void 0).sources;n.set("javascript",new o.RawSource(n.get("javascript")?.source().replace(`"${r}"`,a)))})})})}}
1
+ import e from"webpack";let{sources:t}=e,r="ExternalRemotesPlugin";export default class{apply(e){e.hooks.make.tap(r,e=>{let n=[];e.hooks.buildModule.tap(r,e=>{"ExternalModule"===e.constructor.name&&"script"===e.externalType&&n.push(e)}),e.hooks.afterCodeGeneration.tap(r,function(){n.map(r=>{let n=function(e){let t=e.indexOf("@");if(t<=0||t===e.length-1)throw Error(`Invalid request "${e}"`);return[e.substring(t+1),e.substring(0,t)]}(r.request)[0],o=function(e){let t=[],r=[],n=!1,o=!1;for(let l of e)if("["===l){if(n){o=!0;break}n=!0,r.length&&(t.push(`"${r.join("")}"`),r.length=0)}else if("]"===l){if(!n){o=!0;break}n=!1,r.length&&(t.push(`${r.join("")}`),r.length=0),r.length=0}else r.push(l);if(n||o)throw Error(`Invalid template URL "${e}"`);return r.length&&t.push(`"${r.join("")}"`),t.join(" + ")}(n),l=e.codeGenerationResults.get(r,void 0).sources;l.set("javascript",new t.RawSource(l.get("javascript")?.source().replace(`"${n}"`,o)))})})})}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.9.7",
3
+ "version": "3.9.8-beta.1",
4
4
  "description": "core",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",