@moneko/core 3.52.0 → 3.52.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.
@@ -11,6 +11,8 @@ interface ModuleFederationExposesDeclarationPluginOptions {
11
11
  declare const PLUGIN_NAME: string;
12
12
  export declare class ModuleFederationExposesDeclarationPlugin {
13
13
  private name: string;
14
+ private assetName: string;
15
+ private dts: string;
14
16
  private option: ModuleFederationExposesDeclarationPluginOptions;
15
17
  private worker: Worker;
16
18
  constructor(option: ModuleFederationExposesDeclarationPluginOptions);
@@ -1 +1 @@
1
- import{join as e,parse as t,resolve as o}from"node:path";import{fileURLToPath as i}from"node:url";import{loadFile as s}from"@moneko/utils";import r from"webpack";import{Worker as a}from"worker_threads";import n from"../utils/create-types.mjs";let m="ModuleFederationExposesDeclarationPlugin";export class ModuleFederationExposesDeclarationPlugin{constructor(e){this.name="ModuleFederationExposesDeclarationPlugin",this.option=e,this.worker=new a(i(new URL("../worker/dts.mjs",import.meta.url)))}apply(i){let{exposes:a}=this.option,p="module-federation.d.ts",l="";this.worker.postMessage({options:{compilerOptions:{outFile:`${p}.d.ts`},include:Object.values(a)}}),this.worker.once("message",e=>{l=e}),i.hooks.shutdown.tap(this.name,()=>{this.worker.terminate()});let u=Object.keys(a).map(e=>{let t=e.replace(/\.tsx?$/i,"");return{key:e,name:t,path:o(`types/${this.option.name}/${t}.d.ts`),originPath:a[e]}});i.hooks.thisCompilation.tap({name:m,stage:i.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},o=>{o.hooks.processAssets.tapPromise(m,async()=>{let i=u.map(async o=>{if(null!==await s(o.originPath)){let i=t(o.originPath);return`${n(e(this.option.name,o.name),`export * from '${t(i.dir).name}/${i.name}'`)}`}return""}),a=await Promise.all(i);a.unshift(l),o.emitAsset(p,new r.sources.RawSource(a.join("\n")),{javascriptModule:!1})})})}}
1
+ import{join as e,parse as t,resolve as o}from"node:path";import{fileURLToPath as s}from"node:url";import{loadFile as i}from"@moneko/utils";import r from"webpack";import{Worker as a}from"worker_threads";import n from"../utils/create-types.mjs";let m="ModuleFederationExposesDeclarationPlugin";export class ModuleFederationExposesDeclarationPlugin{constructor(e){this.name="ModuleFederationExposesDeclarationPlugin",this.assetName="module-federation.d.ts",this.dts="",this.option=e,this.worker=new a(s(new URL("../worker/dts.mjs",import.meta.url))),this.worker.postMessage({options:{compilerOptions:{outFile:this.assetName},include:Object.values(e.exposes)}}),this.worker.once("message",e=>{this.dts=e,this.worker.terminate()})}apply(s){let{exposes:a}=this.option,p=Object.keys(a).map(e=>{let t=e.replace(/\.tsx?$/i,"");return{key:e,name:t,path:o(`types/${this.option.name}/${t}.d.ts`),originPath:a[e]}});s.hooks.thisCompilation.tap({name:m,stage:s.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},o=>{o.hooks.processAssets.tapPromise(m,async()=>{let s=p.map(async o=>{if(null!==await i(o.originPath)){let s=t(o.originPath);return`${n(e(this.option.name,o.name),`export * from '${t(s.dir).name}/${s.name}'`)}`}return""}),a=await Promise.all(s);a.unshift(this.dts),o.emitAsset("module-federation.d.ts",new r.sources.RawSource(a.join("\n")),{javascriptModule:!1})})})}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.52.0",
3
+ "version": "3.52.1",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",