@moneko/core 3.47.7 → 3.47.8
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/commom/module-resolve.d.mts +3 -0
- package/lib/commom/module-resolve.mjs +1 -0
- package/lib/common.mjs +1 -1
- package/lib/plugin/module-federation.d.mts +1 -1
- package/lib/plugin/module-federation.mjs +1 -1
- package/lib/utils/create-types.mjs +1 -1
- package/lib/utils/dts.mjs +1 -1
- package/lib/utils/fetch-module-federation-dts.d.mts +1 -0
- package/lib/utils/fetch-module-federation-dts.mjs +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r from"./require.mjs";export default function t(e,o){try{return o&&"function"==typeof import.meta.resolve?import.meta.resolve(e):r.resolve(e)}catch{try{return t(e,!0)}catch{return e}}}
|
package/lib/common.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{extname as e,join as t,resolve as o}from"node:path";import s,{config_files as a,CUSTOMCONFIG as n,TMP_DIR as i}from"./commom/paths.mjs";import r from"./commom/require.mjs";import{OverrideResolverPlugin as l}from"./plugin/override-resolve.mjs";import{isObject as m,node_modules as c,resolveProgram as p}from"./utils/index.mjs";import{exampleModuleName as u}from"./vm/example.mjs";import d from"./vm/info.mjs";import{CONFIG as h,PUBLICPATH as f}from"./config.mjs";import g from"./plugins.config.mjs";import{isCI as b,isDev as y,isLibrary as j,NODE_ENV as v,packageJson as C}from"./process-env.mjs";export const outputConfig={path:p(j?"docs":"dist"),filename:"js/[name].[contenthash].bundle.js",chunkFilename:"js/[contenthash].chunk.js",assetModuleFilename:t=>{let o=e(t.filename||"").substring(1);return`assets/${o}/[hash][ext]`},library:{name:`${d.projectName}`,type:"umd",umdNamedDefine:!0},globalObject:"self",chunkLoadingGlobal:`webpackJsonp_${C.name}`,pathinfo:y,clean:!y,publicPath:f,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"use-credentials",enabledWasmLoadingTypes:["fetch"]};let P={main:[c("@app/entry")]};if(h.polyfill&&P.main.unshift(t(s.corePath,"./polyfills/replace-children.mjs")),y&&h.refresh&&h.env.injectRemoteReactRefresh&&P.main.unshift(r.resolve("@moneko/react/lib/
|
|
1
|
+
import{extname as e,join as t,resolve as o}from"node:path";import s,{config_files as a,CUSTOMCONFIG as n,TMP_DIR as i}from"./commom/paths.mjs";import r from"./commom/require.mjs";import{OverrideResolverPlugin as l}from"./plugin/override-resolve.mjs";import{isObject as m,node_modules as c,resolveProgram as p}from"./utils/index.mjs";import{exampleModuleName as u}from"./vm/example.mjs";import d from"./vm/info.mjs";import{CONFIG as h,PUBLICPATH as f}from"./config.mjs";import g from"./plugins.config.mjs";import{isCI as b,isDev as y,isLibrary as j,NODE_ENV as v,packageJson as C}from"./process-env.mjs";export const outputConfig={path:p(j?"docs":"dist"),filename:"js/[name].[contenthash].bundle.js",chunkFilename:"js/[contenthash].chunk.js",assetModuleFilename:t=>{let o=e(t.filename||"").substring(1);return`assets/${o}/[hash][ext]`},library:{name:`${d.projectName}`,type:"umd",umdNamedDefine:!0},globalObject:"self",chunkLoadingGlobal:`webpackJsonp_${C.name}`,pathinfo:y,clean:!y,publicPath:f,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"use-credentials",enabledWasmLoadingTypes:["fetch"]};let P={main:[c("@app/entry")]};if(h.polyfill&&P.main.unshift(t(s.corePath,"./polyfills/replace-children.mjs")),y&&h.refresh&&h.env.injectRemoteReactRefresh&&P.main.unshift(r.resolve("@moneko/react/lib/inject-react-refresh.js")),h.entry&&("string"==typeof h.entry?P={main:[h.entry]}:Object.keys(h.entry)&&(P=Object.assign(P,h.entry))),"string"==typeof P.main&&(P.main=[P.main]),h.output){if("string"==typeof h.output)outputConfig.path=h.output;else if(Object.keys(h.output)){let e=h.output,t={...outputConfig.library};Object.assign(outputConfig,e),"object"==typeof h.output&&e.library&&(outputConfig.library=Object.assign(t,e.library))}}let x={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:s.webpackCachePath,memoryCacheUnaffected:!0,name:`.${[n,v].filter(Boolean).join("-")}`,version:`${C.version}`,buildDependencies:{config:a},maxMemoryGenerations:1};!1===h.cache?x=!1:m(h.cache)&&(x=Object.assign(x,h.cache)),b&&(void 0===h.cache||h.cache&&!h.cache.cacheDirectory)&&(x.cacheDirectory=o(i,C.name));export const commonConfig={name:"client",target:"web",devtool:h.devtool,entry:P,mode:y?"development":"production",stats:"errors-only",cache:x,snapshot:{immutablePaths:[s.pnpmNodeModules,s.denoNodeModules,/node_modules\/(?!(@app)\/)/],managedPaths:[s.pnpmNodeModules,s.denoNodeModules,/node_modules\/(?!(@app)\/)/],resolveBuildDependencies:{timestamp:!0,hash:!0},resolve:{timestamp:!0,hash:!0},module:{timestamp:!0,hash:!0},buildDependencies:{timestamp:!0,hash:!0}},infrastructureLogging:{level:"error"},externalsPresets:h.externalsPresets,plugins:g,node:{global:!1,__filename:!1,__dirname:!1},experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:h.lazyCompilation&&y&&{imports:!0,entries:!0,test:e=>{let t=e.nameForCondition();return!!(t&&(t.startsWith(c(u))||t.startsWith(c("@app/comment"))||t.startsWith(s.pagesPath)||t.startsWith(s.componentsPath)))}},buildHttp:m(h.buildHttp)?{allowedUris:[],lockfileLocation:o(s.httpCachePath,"http.lock"),cacheLocation:o(s.httpCachePath,"data"),upgrade:!0,...h.buildHttp}:h.buildHttp,backCompat:!0,futureDefaults:!0,css:!1,outputModule:!1},resolve:{extensions:[".mts",".mjs",".ts",".tsx",".js",".jsx",".json",".wasm"],alias:h.alias,modules:[s.nodeModules,s.pnpmNodeModules,s.denoNodeModules],mainFields:["browser","module","main"],mainFiles:["index"],plugins:h.resolvePlugins,preferAbsolute:!0,cache:!0,fallback:{}},externals:h.externals,output:outputConfig,recordsPath:h.recordsPath?t(s.programPath,h.recordsPath):t(s.webpackCachePath,"records.json")};h.overrideResolve&&commonConfig.resolve.plugins.push(new l(Object.assign({original:h.alias["@"],override:n&&p(n)},h.overrideResolve)));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import webpack, { container, type WebpackPluginInstance } from 'webpack';
|
|
2
|
-
import
|
|
2
|
+
import moduleResolve from '../commom/module-resolve.mjs';
|
|
3
3
|
import { CONFIG } from '../config.mjs';
|
|
4
4
|
import fetchModuleFederationDts from '../utils/fetch-module-federation-dts.mjs';
|
|
5
5
|
import { resolveProgram } from '../utils/index.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"webpack";import
|
|
1
|
+
import e from"webpack";import t from"../commom/module-resolve.mjs";import{CONFIG as r}from"../config.mjs";import o from"../utils/fetch-module-federation-dts.mjs";import{resolveProgram as s}from"../utils/index.mjs";import{ModuleFederationExposesDeclarationPlugin as m}from"./exposes-declararion.mjs";import{ExternalRemotesPlugin as a}from"./external-remotes.mjs";let l=e.NormalModuleReplacementPlugin,i=e.container.ModuleFederationPlugin,n={},p=[],f=r.moduleFederation?.map(e=>{let r={},a={},l={};if(Array.isArray(e.remotes))for(let t=0,r=e.remotes.length;t<r;t++){let r=e.remotes[t],s=r.alias||r.name,m=r.filename||"remote_entry.js";if(a[s]=`${r.name}@${r.host}/${m}`,Array.isArray(r.library))for(let e=0,t=r.library.length;e<t;e++)n[r.library[e]]=`${s}/${r.library[e]}`;o(r.host,r.name)}if(Array.isArray(e.exposes)){for(let o=0,m=e.exposes.length;o<m;o++){let m=e.exposes[o];if("string"==typeof m){let e=m.startsWith(".");r[`./${m}`]=t(e?s(m):m),e&&(l[m]=r[`./${m}`])}else if("[object Object]"===Object.prototype.toString.call(m)){let e=m.path.startsWith(".");r[`./${m.name}`]=t(e?s(m.path):m.path),e&&(l[`./${m.name}`]=r[`./${m.name}`])}}e.exposes?.length&&p.push(new m({exposes:l,name:e.name}))}return new i({filename:"remote_entry.js",...e,remotes:a,exposes:r})});f.length>0&&(f.push(new a),f.push(new l(/(.*)/,e=>{n[e.request]&&(e.request=n[e.request])})),p.forEach(e=>f.push(e))),r.env.injectRemoteReactRefresh=Object.keys(n).includes("react-dom");export default f;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"typescript";let
|
|
1
|
+
import e from"typescript";let r=e.SyntaxKind,t=e.factory.createModifier(r.DeclareKeyword),i=e.factory.createModifier(r.ExportKeyword),a=e.createPrinter({newLine:e.NewLineKind.LineFeed});function n(t){let a=n=>{if((e.isInterfaceDeclaration(n)||e.isTypeAliasDeclaration(n)||e.isClassDeclaration(n)||e.isFunctionDeclaration(n)||e.isEnumDeclaration(n))&&n.modifiers?.some(e=>e.kind===r.DeclareKeyword)){let t=n.modifiers.map(e=>e.kind===r.DeclareKeyword?i:e);return e.isInterfaceDeclaration(n)?e.factory.updateInterfaceDeclaration(n,t,n.name,n.typeParameters,n.heritageClauses,n.members):n}return e.visitEachChild(n,a,t)};return r=>e.visitNode(r,a)}export default function(r,i){let o=r.replaceAll("\\","/"),c=e.createSourceFile(`@types/${o}.d.ts`,i,e.ScriptTarget.Latest,!0,e.ScriptKind.TS),l=e.transform(c,[n]),s=l.transformed[0],d=e.factory.createModuleDeclaration([t],e.factory.createStringLiteral(o),e.factory.createModuleBlock(s.statements),e.NodeFlags.None),f=[`// remote module: ${o}`,a.printNode(e.EmitHint.Unspecified,d,c)];return l.dispose(),f.join("\n")}
|
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
|
|
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 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{request as t}from"@moneko/request";import{updateFile as o}from"@moneko/utils";import e from"../commom/log.mjs";import{node_modules as m}from"./index.mjs";async function r(r,i){try{let e=`${r.startsWith("//")?`http:${r}`:r}/module-federation.d.ts`,s=await t(e,{responseType:"text",rejectUnauthorized:!1});o(m(`@types/${i}/index.d.ts`),s)}catch(t){e(t)}}export default r;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.47.
|
|
3
|
+
"version": "3.47.8",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -111,6 +111,7 @@
|
|
|
111
111
|
"@moneko/eslint": "1.6.2",
|
|
112
112
|
"@moneko/mdx": "0.1.44",
|
|
113
113
|
"@moneko/raw-import": "0.0.3",
|
|
114
|
+
"@moneko/request": "1.6.2",
|
|
114
115
|
"@moneko/stylelint": "1.4.1",
|
|
115
116
|
"@moneko/transform-imports": "0.6.1",
|
|
116
117
|
"@moneko/utils": "0.3.3",
|