@moneko/core 4.4.4-beta.5 → 4.4.4-beta.6
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/lib/utils/dts.d.mts
CHANGED
package/lib/utils/dts.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"typescript";import t from"../commom/rule.mjs";let i={declaration:!0,emitDeclarationOnly:!0,target:e.ScriptTarget.ESNext,skipLibCheck:!0,checkJs:!1,skipDefaultLibCheck:!0,noResolve:!0,types:[],noEmitOnError:!1,noImplicitAny:!1,noImplicitThis:!1,noImplicitReturns:!1,noUnusedLocals:!1,noUnusedParameters:!1,noFallthroughCasesInSwitch:!1,strictNullChecks:!1,strictFunctionTypes:!1,strictBindCallApply:!1,strictPropertyInitialization:!1,strict:!1};export function generateDeclaration(r,a){let s=(t.js.test(a)?a:`${a}.ts`).replace(/^\.+/,""),n="";return e.createProgram([s],i,{getSourceFile:t=>{if(t===s)return e.createSourceFile(t,r,i.target)},writeFile:(e,t)=>{e.endsWith(".d.ts")&&(n=t)},getDefaultLibFileName:()=>"lib.d.ts",getCurrentDirectory:()=>"",getCanonicalFileName:e=>e,useCaseSensitiveFileNames:()=>!0,getNewLine:()=>"\n",fileExists:()=>!0,readFile:()=>"",directoryExists:()=>!0,getDirectories:()=>[]}).emit(),n}export function getExportKeys(t,i){let r=new Set;for(let a of e.createSourceFile(i,t,e.ScriptTarget.Latest,!0).statements)if(e.isExportDeclaration(a)){if(a.exportClause&&e.isNamedExports(a.exportClause))for(let e of a.exportClause.elements)r.add(e.name.text)}else if(e.isExportAssignment(a))r.add("default");else if((e.isVariableStatement(a)||e.isFunctionDeclaration(a)||e.isClassDeclaration(a))&&a.modifiers?.some(t=>t.kind===e.SyntaxKind.ExportKeyword)){if(e.isFunctionDeclaration(a)||e.isClassDeclaration(a))a.name&&r.add(a.name.text);else if(e.isVariableStatement(a))for(let t of a.declarationList.declarations)e.isIdentifier(t.name)&&r.add(t.name.text)}return Array.from(r)}
|
|
1
|
+
import e from"typescript";import t from"../commom/rule.mjs";let i={declaration:!0,emitDeclarationOnly:!0,target:e.ScriptTarget.ESNext,skipLibCheck:!0,checkJs:!1,skipDefaultLibCheck:!0,noResolve:!0,types:[],noEmitOnError:!1,noImplicitAny:!1,noImplicitThis:!1,noImplicitReturns:!1,noUnusedLocals:!1,noUnusedParameters:!1,noFallthroughCasesInSwitch:!1,strictNullChecks:!1,strictFunctionTypes:!1,strictBindCallApply:!1,strictPropertyInitialization:!1,strict:!1};export function extractMfModules(t){let i=e.createSourceFile("temp.ts",t,e.ScriptTarget.Latest,!0),r=[];return!function t(i){if(e.isModuleDeclaration(i)){let e=i.name.text;if(e.startsWith("mf:")){let t=e.substring(3);r.push(t)}}e.forEachChild(i,t)}(i),r}export function generateDeclaration(r,a){let s=(t.js.test(a)?a:`${a}.ts`).replace(/^\.+/,""),n="";return e.createProgram([s],i,{getSourceFile:t=>{if(t===s)return e.createSourceFile(t,r,i.target)},writeFile:(e,t)=>{e.endsWith(".d.ts")&&(n=t)},getDefaultLibFileName:()=>"lib.d.ts",getCurrentDirectory:()=>"",getCanonicalFileName:e=>e,useCaseSensitiveFileNames:()=>!0,getNewLine:()=>"\n",fileExists:()=>!0,readFile:()=>"",directoryExists:()=>!0,getDirectories:()=>[]}).emit(),n}export function getExportKeys(t,i){let r=new Set;for(let a of e.createSourceFile(i,t,e.ScriptTarget.Latest,!0).statements)if(e.isExportDeclaration(a)){if(a.exportClause&&e.isNamedExports(a.exportClause))for(let e of a.exportClause.elements)r.add(e.name.text)}else if(e.isExportAssignment(a))r.add("default");else if((e.isVariableStatement(a)||e.isFunctionDeclaration(a)||e.isClassDeclaration(a))&&a.modifiers?.some(t=>t.kind===e.SyntaxKind.ExportKeyword)){if(e.isFunctionDeclaration(a)||e.isClassDeclaration(a))a.name&&r.add(a.name.text);else if(e.isVariableStatement(a))for(let t of a.declarationList.declarations)e.isIdentifier(t.name)&&r.add(t.name.text)}return Array.from(r)}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{join as e,parse as t,relative as r,sep as o}from"node:path";import s from"webpack";import m from"../commom/module-resolve.mjs";import a from"../commom/paths.mjs";import{CONFIG as l}from"../config.mjs";import n from"../utils/fetch-module-federation-dts.mjs";import{resolveProgram as p}from"../utils/index.mjs";import{mf_vm as i}from"../vm/mf.mjs";import{ModuleFederationExposesDeclarationPlugin as f}from"./exposes-declararion.mjs";import{ExternalRemotesPlugin as h}from"./external-remotes.mjs";let u=s.NormalModuleReplacementPlugin,c=s.container.ModuleFederationPlugin,d={},$=[];function x(e,r){let s=e.replaceAll(o,"/").replace(/\.tsx?$/i,""),m=t(r);i.setData(s,{type:".tsx",source:()=>{if(r.startsWith(a.nodeModules)){let e=r.substring(a.nodeModules.length).split("node_modules").pop().replaceAll(o,"/").replace(/^\//,"");return`export * from '${e}';`}return r.startsWith(l.alias["@"])?`export * from '@/${t(m.dir).name}/${m.name}'`:"export {};"}})}let y=l.moduleFederation?.map(t=>{let o={},s={},l={};if(Array.isArray(t.remotes))for(let e=0,r=t.remotes.length;e<r;e++){let r=t.remotes[e],o=r.alias||r.name,m=r.filename||"remote_entry.js";if(s[o]=`${r.name}@${r.host}/${m}`,Array.isArray(r.library))for(let e=0,t=r.library.length;e<t;e++)d[r.library[e]]=`${o}/${r.library[e]}`;n(r.host,r.name)}if(Array.isArray(t.exposes)){t.exposes.length>0&&!t.exposes.find(e=>"public-path"===e)&&t.exposes.push({name:"public-path",path:`./${r(a.programPath,e(a.corePath,"./polyfills/public-path.mjs"))}`});for(let e=0,r=t.exposes.length;e<r;e++){let r=t.exposes[e];if("string"==typeof r){let e=r.startsWith(".");o[`./${r}`]=m(e?p(r):r),e&&(l[r]=o[`./${r}`],x(`${t.name}/${r}`,l[r]))}else if("[object Object]"===Object.prototype.toString.call(r)){let e=r.path.startsWith(".");o[`./${r.name}`]=m(e?p(r.path):r.path),e&&(l[`./${r.name}`]=o[`./${r.name}`],x(`${t.name}/${r.name}`,l[`./${r.name}`]))}}t.exposes?.length&&$.push(new f({exposes:l,name:t.name}))}return new c({filename:"remote_entry.js",...t,remotes:s,exposes:o})});y.length>0&&(y.push(new h),y.push(new u(/(.*)/,e=>{d[e.request]&&(e.request=d[e.request])})),$.forEach(e=>y.push(e))),l.env.injectRemoteReactRefresh=Object.keys(d).includes("react-dom");export default y;
|