@moneko/core 3.47.6 → 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.
@@ -0,0 +1,3 @@
1
+ import require from './require.mjs';
2
+ declare function moduleResolve(name: string, esm?: boolean);
3
+ export default moduleResolve;
@@ -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/injectRemoteReactRefresh.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
+ 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 require from '../commom/require.mjs';
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 r from"../commom/require.mjs";import{CONFIG as t}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 i=e.NormalModuleReplacementPlugin,l=e.container.ModuleFederationPlugin,n={},p=[],f=t.moduleFederation?.map(e=>{let t={},a={},i={};if(Array.isArray(e.remotes))for(let r=0,t=e.remotes.length;r<t;r++){let t=e.remotes[r],s=t.alias||t.name,m=t.filename||"remote_entry.js";if(a[s]=`${t.name}@${t.host}/${m}`,Array.isArray(t.library))for(let e=0,r=t.library.length;e<r;e++)n[t.library[e]]=`${s}/${t.library[e]}`;o(t.host,t.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(".");t[`./${m}`]=r.resolve(e?s(m):m),e&&(i[m]=t[`./${m}`])}else if("[object Object]"===Object.prototype.toString.call(m)){let e=m.path.startsWith(".");t[`./${m.name}`]=r.resolve(e?s(m.path):m.path),e&&(i[`./${m.name}`]=t[`./${m.name}`])}}e.exposes?.length&&p.push(new m({exposes:i,name:e.name}))}return new l({filename:"remote_entry.js",...e,remotes:a,exposes:t})});f.length>0&&(f.push(new a),f.push(new i(/(.*)/,e=>{n[e.request]&&(e.request=n[e.request])})),p.forEach(e=>f.push(e))),t.env.injectRemoteReactRefresh=Object.keys(n).includes("react-dom");export default f;
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 t=e.SyntaxKind,r=e.factory.createModifier(t.DeclareKeyword),i=e.factory.createModifier(t.ExportKeyword),a=e.createPrinter({newLine:e.NewLineKind.LineFeed});function n(r){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===t.DeclareKeyword)){let r=n.modifiers.map(e=>e.kind===t.DeclareKeyword?i:e);return e.isInterfaceDeclaration(n)?e.factory.updateInterfaceDeclaration(n,r,n.name,n.typeParameters,n.heritageClauses,n.members):n}return e.visitEachChild(n,a,r)};return t=>e.visitNode(t,a)}export default function(t,i){let o=e.createSourceFile(`@types/${t}.d.ts`,i,e.ScriptTarget.Latest,!0,e.ScriptKind.TS),c=e.transform(o,[n]),s=c.transformed[0],d=e.factory.createModuleDeclaration([r],e.factory.createStringLiteral(t),e.factory.createModuleBlock(s.statements),e.NodeFlags.None),l=[`// remote module: ${t}`,a.printNode(e.EmitHint.Unspecified,d,o)];return c.dispose(),l.join("\n")}
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`,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 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,3 +1,4 @@
1
+ import { request } from '@moneko/request';
1
2
  import { updateFile } from '@moneko/utils';
2
3
  import log from '../commom/log.mjs';
3
4
  import { node_modules } from './index.mjs';
@@ -1 +1 @@
1
- import{updateFile as t}from"@moneko/utils";import o from"../commom/log.mjs";import{node_modules as e}from"./index.mjs";async function m(m,i){try{let o=`${m.startsWith("//")?`http:${m}`:m}/module-federation.d.ts`,r=await fetch(o).then(t=>t.text());t(e(`@types/${i}/index.d.ts`),r)}catch(t){o(t)}}export default m;
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.6",
3
+ "version": "3.47.8",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
@@ -108,17 +108,18 @@
108
108
  "license": "MIT",
109
109
  "dependencies": {
110
110
  "@moneko/convert": "1.0.1",
111
- "@moneko/eslint": "1.6.1",
111
+ "@moneko/eslint": "1.6.2",
112
112
  "@moneko/mdx": "0.1.44",
113
113
  "@moneko/raw-import": "0.0.3",
114
- "@moneko/stylelint": "1.4.0",
114
+ "@moneko/request": "1.6.2",
115
+ "@moneko/stylelint": "1.4.1",
115
116
  "@moneko/transform-imports": "0.6.1",
116
117
  "@moneko/utils": "0.3.3",
117
118
  "@swc/core": "1.6.13",
118
119
  "browserslist": "4.25.0 ",
119
120
  "chokidar": "4.0.3",
120
- "core-js": "3.42.0",
121
- "core-js-compat": "3.42.0",
121
+ "core-js": "3.43.0",
122
+ "core-js-compat": "3.43.0",
122
123
  "husky": "9.1.7",
123
124
  "less": "4.3.0",
124
125
  "less-loader": "12.3.0",
@@ -140,7 +141,7 @@
140
141
  "@types/stylis": "4.2.7",
141
142
  "@types/webpack-bundle-analyzer": "4.7.0",
142
143
  "@types/webpack-hot-middleware": "2.25.9",
143
- "sass": "1.89.1",
144
+ "sass": "1.89.2",
144
145
  "sass-loader": "16.0.5",
145
146
  "solid-refresh": "0.7.5",
146
147
  "stylis": "4.3.6",