@moneko/core 3.26.3 → 3.26.4
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/bin/build-app.mjs +1 -1
- package/lib/bin/build.mjs +1 -1
- package/lib/bin/changelog.mjs +3 -3
- package/lib/bin/eslint.mjs +1 -1
- package/lib/bin/index.mjs +1 -1
- package/lib/bin/lessc.mjs +1 -1
- package/lib/bin/runlint.mjs +2 -2
- package/lib/bin/start.mjs +1 -1
- package/lib/bin/stylelint.mjs +1 -1
- package/lib/bin/utils/bundle-app.mjs +1 -1
- package/lib/bin/utils/config.mjs +1 -1
- package/lib/bin/utils/setup-swcrc.mjs +1 -1
- package/lib/build/server.mjs +1 -1
- package/lib/build.mjs +1 -1
- package/lib/commom/has-pkg.mjs +1 -0
- package/lib/commom/os-tmp-dir.mjs +1 -0
- package/lib/commom/parse-module-meta.mjs +1 -0
- package/lib/{paths.d.mts → commom/paths.d.mts} +0 -4
- package/lib/commom/paths.mjs +1 -0
- package/lib/common.mjs +1 -1
- package/lib/config.mjs +1 -1
- package/lib/dev/config.mjs +3 -3
- package/lib/dev/json-schema.d.mts +3 -0
- package/lib/dev/json-schema.mjs +1 -0
- package/lib/dev/mock.mjs +1 -1
- package/lib/dev/proxy.d.mts +1 -1
- package/lib/dev.mjs +1 -1
- package/lib/index.d.mts +13 -13
- package/lib/index.mjs +1 -1
- package/lib/loader/css-in-js-minify.cjs +1 -1
- package/lib/loader/css-in-js-minify.d.cts +1 -0
- package/lib/loader/lightning-css/codegen.cjs +20 -0
- package/lib/loader/lightning-css/codegen.d.cts +35 -0
- package/lib/loader/lightning-css/loader.cjs +1 -0
- package/lib/loader/lightning-css/loader.d.cts +29 -0
- package/lib/loader/lightning-css/runtime/api.cjs +1 -0
- package/lib/loader/lightning-css/runtime/api.d.cts +1 -0
- package/lib/loader/lightning-css/runtime/get-url.cjs +1 -0
- package/lib/loader/lightning-css/runtime/get-url.d.cts +1 -0
- package/lib/loader/lightning-css/utils.cjs +1 -0
- package/lib/loader/lightning-css/utils.d.cts +16 -0
- package/lib/loader/mdx.cjs +1 -1
- package/lib/loader/react-compiler.cjs +1 -1
- package/lib/loader/solid.d.cts +1 -1
- package/lib/loader/ts-doc.cjs +1 -1
- package/lib/loader/ts-doc.d.cts +1 -1
- package/lib/module.config.mjs +2 -1
- package/lib/options/css-extract.mjs +1 -1
- package/lib/options/html-plugin-option.mjs +1 -1
- package/lib/options/modify-vars.mjs +1 -1
- package/lib/options/reslove.d.mts +0 -1
- package/lib/options/reslove.mjs +1 -1
- package/lib/options/swcrc.mjs +1 -1
- package/lib/plugin/copy.mjs +1 -1
- package/lib/plugin/exposes-declararion.mjs +1 -1
- package/lib/plugin/lightningcss-plugin.mjs +1 -1
- package/lib/plugin/module-federation.mjs +1 -1
- package/lib/plugin/override-resolve.mjs +1 -1
- package/lib/plugin/virtual-module.mjs +1 -1
- package/lib/plugins.config.mjs +1 -1
- package/lib/polyfills/polyfills.mjs +1 -1
- package/lib/polyfills/targets.mjs +1 -1
- package/lib/process-env.d.mts +1 -1
- package/lib/process-env.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.mjs +1 -1
- package/lib/utils/index.d.mts +1 -1
- package/lib/utils/index.mjs +1 -1
- package/lib/utils/seo.mjs +2 -2
- package/lib/utils/vts.mjs +1 -1
- package/lib/vm/coverage.mjs +1 -1
- package/lib/vm/docs.d.mts +1 -1
- package/lib/vm/docs.mjs +1 -1
- package/lib/vm/example.d.mts +1 -1
- package/lib/vm/example.mjs +1 -1
- package/lib/vm/info.mjs +1 -1
- package/lib/vm/locales.d.mts +1 -1
- package/lib/vm/locales.mjs +2 -2
- package/lib/vm/modules.mjs +1 -1
- package/lib/vm/routes.d.mts +1 -1
- package/lib/vm/routes.mjs +1 -1
- package/lib/vm/utils.mjs +1 -1
- package/package.json +3 -3
- package/typings/global.d.ts +21 -21
- package/lib/loader/lightningcss.cjs +0 -1
- package/lib/loader/lightningcss.d.cts +0 -7
- package/lib/paths.mjs +0 -1
- package/lib/utils/has-pkg.mjs +0 -1
- package/lib/utils/os-tmp-dir.mjs +0 -1
- package/lib/utils/parse-module-meta.mjs +0 -1
- package/lib/utils/setup-env.d.mts +0 -6
- package/lib/utils/setup-env.mjs +0 -1
- /package/lib/{utils → commom}/diff-object.d.mts +0 -0
- /package/lib/{utils → commom}/diff-object.mjs +0 -0
- /package/lib/{utils → commom}/esm.d.mts +0 -0
- /package/lib/{utils → commom}/esm.mjs +0 -0
- /package/lib/{utils → commom}/get-current-time.d.mts +0 -0
- /package/lib/{utils → commom}/get-current-time.mjs +0 -0
- /package/lib/{utils → commom}/has-pkg.d.mts +0 -0
- /package/lib/{utils → commom}/log.d.mts +0 -0
- /package/lib/{utils → commom}/log.mjs +0 -0
- /package/lib/{utils → commom}/match-path.d.mts +0 -0
- /package/lib/{utils → commom}/match-path.mjs +0 -0
- /package/lib/{dev → commom}/net.d.mts +0 -0
- /package/lib/{dev → commom}/net.mjs +0 -0
- /package/lib/{utils → commom}/os-tmp-dir.d.mts +0 -0
- /package/lib/{utils → commom}/parse-module-meta.d.mts +0 -0
- /package/lib/{utils → commom}/reactive-object.d.mts +0 -0
- /package/lib/{utils → commom}/reactive-object.mjs +0 -0
- /package/lib/{rule.d.mts → commom/rule.d.mts} +0 -0
- /package/lib/{rule.mjs → commom/rule.mjs} +0 -0
- /package/lib/{bin/utils → commom}/setup-env.d.mts +0 -0
- /package/lib/{bin/utils → commom}/setup-env.mjs +0 -0
- /package/lib/{utils → commom}/sigint-exit.d.mts +0 -0
- /package/lib/{utils → commom}/sigint-exit.mjs +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return a}});const t=(e=require("babel-plugin-react-compiler"))&&e.__esModule?e:{default:e}
|
|
1
|
+
"use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return a}});const t=require("@babel/core"),r=(e=require("babel-plugin-react-compiler"))&&e.__esModule?e:{default:e};async function a(e){let a=this.async();this.cacheable&&this.cacheable();let s=(0,t.transformSync)(e,{filename:this.resourcePath,sourceMaps:this.sourceMap,plugins:[[r.default,this.getOptions()]]});if(null===s){a(Error(`Failed to transform "${this.resourcePath}"`));return}a(null,s.code||"",null===s.map?void 0:s.map)}
|
package/lib/loader/solid.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { LoaderContext } from 'webpack';
|
|
2
1
|
import { type TransformOptions } from '@babel/core';
|
|
2
|
+
import type { LoaderContext } from 'webpack';
|
|
3
3
|
declare function solidLoader(this: LoaderContext<TransformOptions & {
|
|
4
4
|
refresh?: boolean;
|
|
5
5
|
}>, sourceCode: string): Promise<void>;
|
package/lib/loader/ts-doc.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return u}});const e=require("fs"),t=
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return u}});const e=require("fs"),t=s(require("../commom/log.mjs")),r=s(require("../commom/parse-module-meta.mjs"));function s(e){return e&&e.__esModule?e:{default:e}}const i={};function u(s){this.cacheable&&this.cacheable();let u=this.resourcePath;if(u.endsWith(".d.ts"))return s;try{let t=(0,e.statSync)(u).mtime.getTime();if(i[u]!==t){Object.assign(i,{[u]:t});let{comment:e,generateDoc:a,getCommentPath:c}=this.getOptions(),{file:n,pkg:o,meta:l}=(0,r.default)(c(u));e.setData(n,a(s,u)),e.setData(o,l)}}catch(e){(0,t.default)(e)}return s}
|
package/lib/loader/ts-doc.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type ReactiveObject from '../utils/reactive-object.mjs';
|
|
2
1
|
import type { LoaderContext } from 'webpack';
|
|
2
|
+
import type ReactiveObject from '../commom/reactive-object.mjs';
|
|
3
3
|
export default function (this: LoaderContext<{
|
|
4
4
|
comment: ReactiveObject<Record<string, string>>;
|
|
5
5
|
generateDoc(content: string, path: string): string;
|
package/lib/module.config.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
let e;import{
|
|
1
|
+
let e;import{join as o,sep as s}from"node:path";import{saveFileSync as t}from"@moneko/utils";import r from"./commom/has-pkg.mjs";import a,{CUSTOMCONFIG as m}from"./commom/paths.mjs";import n from"./commom/reactive-object.mjs";import i from"./commom/require.mjs";import l from"./commom/rule.mjs";import c from"./options/css-extract.mjs";import d from"./options/modify-vars.mjs";import p from"./options/reslove.mjs";import u from"./options/swcrc.mjs";import{getLightningCssTargets as f}from"./polyfills/targets.mjs";import{node_modules as j,resolveProgram as h,toCamelCase as v}from"./utils/index.mjs";import g from"./utils/svg-to-data-uri.mjs";import{comment as y,getCommentPath as x}from"./vm/docs.mjs";import w from"./vm/generate-doc.mjs";import{CONFIG as L}from"./config.mjs";import{FRAMEWORK as P,isDev as M,isLibrary as _}from"./process-env.mjs";let k={loader:o(a.corePath,"/loader/lightning-css/loader.cjs"),options:{sourceMap:!!L.sourceMap,targets:f(),rem:!!L.rem,esModule:!0,modules:{auto(e){if(e){if(e.endsWith(".css")&&!e.endsWith("module.css"))return!1;for(let o=0,s=b.length;o<s;o++)if(e.includes(b[o]))return l.css_module.test(e)}return l.node_modules_css_module.test(e)},localIdentName:"[name][hash]_[local]",namedExport:!0,exportLocalsConvention:"dashesOnly",exportOnlyLocals:!1,getJSON:L.cssModuleDefinition?function(e){Q.setData(`${e.resourcePath}.d.ts`,`${e.exports.map(({name:e,value:o})=>`export const ${v(e)}: '${o}';`).join("\n")}
|
|
2
|
+
`)}:void 0},importLoaders:2}},C={loader:p.lessLoader,options:{sourceMap:!!L.sourceMap,lessOptions:{modifyVars:d,javascriptEnabled:!0}}},O=new Map;function I(e){if(O.has(e))return O.get(e);try{let o;let t=i.resolve(e).split(s),r=t.lastIndexOf("node_modules");return o=-1!==r?t.slice(0,r).join(s):t.join(s),O.set(e,o),o}catch{let o=j(e);return O.set(e,o),o}}let b=[...L.cssModules,`@moneko/${P}`,"neko-ui"].map(I),W=["components","example","mock","site","src","server"].map(h);function $(e){return new Promise(o=>{o([...W,...L.rulesInclude?.[e]?.map(I)||[]])})}m&&W.push(h(m)),L.overrideResolve&&L.overrideResolve.override&&W.push(L.overrideResolve.override);let[R,B,S,z,D]=await Promise.all([$("css"),$("js"),$("media"),$("wasm"),$("font")]);p.sassLoader&&(e={loader:p.sassLoader,options:{implementation:await import("sass"),sassOptions:{}}});let E=_&&M&&{test:l.tsdoc,include:L.alias["@pkg"],exclude:[/node_modules\/(?!(@app|@moneko)).+/,l.__tests__],enforce:"pre",loader:o(a.corePath,"/loader/ts-doc.cjs"),options:{comment:y,generateDoc:w,getCommentPath:x}},J=[{resourceQuery:/raw/i,type:"asset/source"},{resourceQuery:/url/i,type:"asset/resource",generator:{filename(e){let o=e.filename;return o&&o.toLocaleLowerCase().endsWith("wasm?url")?"wasm/[name][ext]":"assets/[name][ext]"}}},{test:l.wasm,type:"webassembly/async",include:z},{test:l.txt,type:"asset/source"},{test:l.image,type:"asset",dependency:{not:["url"]},parser:{dataUrlCondition:{maxSize:4096}},generator:{filename:e=>e.filename?.toLocaleLowerCase().endsWith(".svg")?"assets/svg/[name][ext]":"assets/images/[name][ext]",dataUrl:(e,o)=>o.filename.toLocaleLowerCase().endsWith(".svg")?g(e.toString()):e},include:S},{test:l.video,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[name][ext]"},include:S},{test:l.font,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[name][ext]"},include:D}],N=L.prefixJsLoader.filter(Boolean)||[];switch(P){case"react":L.reactCompiler&&N.unshift({loader:o(a.corePath,"/loader/react-compiler.cjs"),options:L.reactCompiler});break;case"solid":L.refresh=!1}!M&&r("@moneko/css")&&N.unshift(o(a.corePath,"/loader/css-in-js-minify.cjs"));let Q=new n({});Q.on("change",(e,o)=>{t(e,o)});export default(s=>{let t={loader:p.swcLoader,options:u(s)};return{parser:{javascript:{commonjsMagicComments:!0,dynamicImportMode:"lazy",dynamicImportPrefetch:!1,dynamicImportPreload:!1,importMeta:!0,importMetaContext:!0}},noParse:L.noParse,rules:[!1!==L.htmlPluginOption&&E,{oneOf:[...J,{test:l.js,use:[...N,t],include:B},{test:l.css,use:[c,k],include:R},e&&{test:l.scss,use:[c,k,e],include:R},{test:l.less,use:[c,k,C],include:R},{test:l.markdown,use:[...N,{loader:o(a.corePath,"/loader/mdx.cjs"),options:L.mdx}],exclude:[/node_modules\/(?!(@app|@moneko)).+/]}].filter(Boolean)},...L.moduleRules].filter(Boolean)}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CONFIG as
|
|
1
|
+
import o from"mini-css-extract-plugin";import{CONFIG as r,PUBLICPATH as t}from"../config.mjs";import{isDev as e,isMicro as m}from"../process-env.mjs";import s from"./reslove.mjs";let i=m?t:"../",p={loader:o.loader,options:{publicPath:"/"!==i?i:"../",...r.cssExtract}};e&&(p=s.styleLoader);export default p;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{merge as e}from"webpack-merge";import{CONFIG as t}from"../config.mjs";import{
|
|
1
|
+
import{merge as e}from"webpack-merge";import{CONFIG as t}from"../config.mjs";import{coreName as i,description as o,keywords as r,PACKAGENAME as a}from"../process-env.mjs";import{resolveProgram as n}from"../utils/index.mjs";let{favicon:l=`node_modules/${i}/lib/options/favicon.ico`,template:p,...m}=t.htmlPluginOption||{},s=t.seo&&`https://${t.seo.domain}${t.basename}`,d={charset:"UTF-8","X-UA-Compatible":{"http-equiv":"X-UA-Compatible",content:"IE=edge,Chrome=1"},HandheldFriendly:"true",MobileOptimized:"320","screen-orientation":"portrait","x5-orientation":"portrait",browsermode:"application","x5-page-mode":"app","msapplication-tap-highlight":"no","mobile-web-app-capable":"yes",renderer:"webkit",description:o,keywords:Array.isArray(r)?r.toString():"","http-equiv":"refresh",viewport:"width=device-width, initial-scale=1"};s&&Object.assign(d,{relCanonical:{rel:"canonical",href:s}});let c=e({title:t.env?.PROJECTNAME||a.toLocaleUpperCase()||"Title",filename:"index.html",hash:!1,minify:{minifyJS:!0,minifyCSS:!0,collapseWhitespace:!0,removeComments:!0,removeRedundantAttributes:!1,removeScriptTypeAttributes:!1,removeStyleLinkTypeAttributes:!1,removeAttributeQuotes:!0,useShortDoctype:!0},meta:d,tags:[],favicon:l?n(l):l},m,p?{template:p?n(p):void 0}:{templateContent:function({htmlWebpackPlugin:{options:e}}){let t=e.tags,i="",o="";return t&&t.map(function(e){let{tag:t="script",textContent:r="",inject:a="head",...n}=e,l="";for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&(l+=`${e}="${n[e]}" `);let p=`<${t} ${l}>${r}</${t}>`;"body"===a?o+=p:i+=p}),`<!DOCTYPE html>
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<title>${e.title}</title>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import i
|
|
1
|
+
import{CONFIG as i}from"../config.mjs";import o from"./html-plugin-option.mjs";let f=i.prefixCls||"n",n={"@prefix-cls":f,"@ant-prefix":f,"@iconfont-css-prefix":`${f}-icon`,"@favicon":o.favicon};Object.assign(n,i.modifyVars);export default n;
|
package/lib/options/reslove.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../commom/
|
|
1
|
+
import e from"../commom/has-pkg.mjs";import o from"../commom/require.mjs";let s={styleLoader:o.resolve("style-loader"),sassLoader:e("sass-loader"),lessLoader:o.resolve("less-loader"),swcLoader:o.resolve("swc-loader"),transformImports:e("@moneko/transform-imports"),jsxDomExpressions:e("@moneko/jsx-dom-expressions"),hotMiddlewareClient:o.resolve("webpack-hot-middleware/client.js")};export default s;
|
package/lib/options/swcrc.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{merge as e}from"webpack-merge";import
|
|
1
|
+
import{merge as e}from"webpack-merge";import r from"../commom/paths.mjs";import{CONFIG as o}from"../config.mjs";import t,{coreJsVersion as s}from"../polyfills/polyfills.mjs";import{isDev as m,isReact as a,isSolid as l,jsxImportSource as p}from"../process-env.mjs";import i from"./reslove.mjs";let c=function(e){for(let r=0,o=Object.keys(e),t=o.length;r<t;r++)e[o[r]].transform=`${o[r]}/${e[o[r]].transform}`,e[o[r]].style&&(e[o[r]].style=`${o[r]}/${e[o[r]].style}`);return e}(o.importOnDemand||{}),n={include:t(),mode:"entry",coreJs:s};export default((t,s={})=>e({module:{type:"es6",resolveFully:!0},sync:!0,jsc:{parser:{syntax:"typescript",tsx:!0,decorators:!0,dynamicImport:!0},loose:!0,target:o.polyfill?void 0:"es2017",externalHelpers:!1,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,refresh:a&&m,development:m,importSource:p},optimizer:{simplify:!1}},experimental:{emitAssertForImportAttributes:!0,cacheRoot:r.swcCachePath,plugins:[[i.transformImports,c],l&&[i.jsxDomExpressions,{...o.jsxDomExpressions,generate:t?"ssr":"dom",hydratable:t}]].filter(Boolean)}},env:o.polyfill?n:void 0,sourceMaps:!0,parseMap:!0},"function"==typeof o.swcrc?o.swcrc(m):o.swcrc||{},s));
|
package/lib/plugin/copy.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolve as e}from"node:path";import
|
|
1
|
+
import{resolve as e}from"node:path";import{loadFile as s,scanFolderSync as t}from"@moneko/utils";import i from"webpack";let l="CopyPlugin",{sources:{RawSource:o}}=i;export class CopyPlugin{constructor(s){this.cacheFiles=[],this.baseFiles=new Set(s.files?.map(s=>e(s))||[]),this.dirs=new Set(s.dirs||[])}getFiles(){let e=new Set(this.baseFiles);for(let s of this.dirs)t(s).forEach(s=>e.add(s));let s={deleted:[],files:[...e]};for(let t of new Set(this.cacheFiles))e.has(t)||s.deleted.push(t);return this.cacheFiles=s.files,s}apply(e){e.hooks.thisCompilation.tap({name:l,stage:e.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},e=>{e.hooks.processAssets.tapPromise(l,async()=>{let t=this.getFiles(),i=t.files.map(e=>s(e));(await Promise.all(i)).forEach((s,i)=>{null!==s&&e.emitAsset(t.files[i],new o(s))}),t.deleted.forEach(s=>{e.deleteAsset(s)})})})}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{join as t,resolve as e}from"node:path";import{loadFile as o}from"@moneko/utils";import s from"webpack";import a from"../utils/create-types.mjs";import{generateDeclaration as i}from"../utils/dts.mjs";let n="ModuleFederationExposesDeclarationPlugin";export class ModuleFederationExposesDeclarationPlugin{constructor(t){this.option=t}apply(r){let{exposes:p}=this.option,m=Object.keys(p).map(t=>{let o=t.replace(/\.tsx?$/i,"");return{key:t,name:o,path:e(`types/${this.option.name}/${o}.d.ts`),originPath:p[t]}});r.hooks.thisCompilation.tap({name:n,stage:r.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},e=>{e.hooks.processAssets.tapPromise(n,async()=>{let n=m.map(async e=>{let s=await o(e.originPath);return null!==s?a(t(this.option.name,e.name),i(s,`${e.name}.ts`)):""}),r=await Promise.all(n);e.emitAsset("module-federation.d.ts",new s.sources.RawSource(r.join("\n")),{javascriptModule:!1})})})}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Buffer as s}from"node:buffer";import{transform as t}from"lightningcss";import i from"webpack";
|
|
1
|
+
import{Buffer as s}from"node:buffer";import{transform as t}from"lightningcss";import i from"webpack";let o=new TextEncoder,{sources:{RawSource:n,SourceMapSource:e},ModuleFilenameHelpers:{matchObject:a}}=i,r="lightning-css-minify",m=/\.(c|le|sc|sa)ss(?:\?.*)?$/i;export class LightningCssMinifyPlugin{constructor(s={}){let{implementation:i,...o}=s;if(i&&"function"!=typeof i.transform)throw TypeError(`[LightningCssMinifyPlugin]: implementation.transform must be an 'lightningcss' transform function. Received ${typeof i.transform}`);this.transform=i?.transform??t,this.options=o}apply(s){let t=JSON.stringify({name:r,version:"0.0.1",options:this.options});s.hooks.compilation.tap(r,s=>{s.hooks.chunkHash.tap(r,(s,i)=>i.update(t)),s.hooks.processAssets.tapPromise({name:r,stage:i.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,additionalAssets:!0},async()=>await this.transformAssets(s)),s.hooks.statsPrinter.tap(r,s=>{s.hooks.print.for("asset.info.minimized").tap(r,(s,{green:t,formatFlag:i})=>s?t(i("minimized")):void 0)})})}async transformAssets(t){let{options:{devtool:i}}=t.compiler,{include:r,exclude:p,test:f,sourceMap:c=void 0===this.options.sourceMap?!!(i&&i.includes("source-map")):this.options.sourceMap,...l}=this.options,h=t.getAssets().filter(s=>!s.info.minimized&&(f||m).test(s.name)&&a({include:r,exclude:p},s.name));await Promise.all(h.map(async i=>{let a;let r=i.source.source(),m="string"==typeof r?o.encode(r):r,p=this.transform({filename:i.name,code:m,minify:!0,sourceMap:c,...l}),f=s.from(p.code);a=c?new e(f,i.name,p.map||"",r,p.map||"",!0):new n(f),t.updateAsset(i.name,a,{...i.info,minimized:!0})}))}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"webpack";import r from"
|
|
1
|
+
import e from"webpack";import r from"../commom/require.mjs";import{CONFIG as t}from"../config.mjs";import s from"../utils/fetch-module-federation-dts.mjs";import{resolveProgram as o}from"../utils/index.mjs";import{ModuleFederationExposesDeclarationPlugin as m}from"./exposes-declararion.mjs";import a from"./external-remotes.mjs";let{NormalModuleReplacementPlugin:i,container:{ModuleFederationPlugin:n}}=e,l={},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],o=t.alias||t.name,m=t.filename||"remote_entry.js";if(a[o]=`${t.name}@${t.host}/${m}`,Array.isArray(t.library))for(let e=0,r=t.library.length;e<r;e++)l[t.library[e]]=`${o}/${t.library[e]}`;s(t.host,t.name)}if(Array.isArray(e.exposes)){for(let s=0,m=e.exposes.length;s<m;s++){let m=e.exposes[s];if("string"==typeof m){let e=m.startsWith(".");t[`./${m}`]=r.resolve(e?o(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?o(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 n({filename:"remote_entry.js",...e,remotes:a,exposes:t})});f.length>0&&(f.push(new a),f.push(new i(/(.*)/,e=>{l[e.request]&&(e.request=l[e.request])})),p.forEach(e=>f.push(e))),t.env.injectRemoteReactRefresh=Object.keys(l).includes("react-dom");export default f;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{relative as e}from"node:path";import
|
|
1
|
+
import{relative as e}from"node:path";import{fileExists as t}from"@moneko/utils";import r from"../commom/paths.mjs";let o="OverrideResolverPlugin";export default class{constructor(e){this.options=e}apply(a){let i=a.ensureHook("resolved"),{override:s,original:l}=this.options;if(s&&l){let p=`./${e(r.programPath,l)}`,n=`./${e(r.programPath,s)}`;a.getHook("existing-file").tapAsync(o,(e,r,h)=>{let m=e.request||e.path;if(m&&m.startsWith(l)&&e.relativePath){let u=m.replace(l,s);if(t(u)){let t=e.relativePath.replace(p,n);return Object.assign(e,{path:u,relativePath:t,__innerRequest_relativePath:t,__innerRequest:t}),a.doResolve(i,e,`${o} 使用目标模块${s}`,r,h)}}return h()})}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"webpack-virtual-modules";import
|
|
1
|
+
import t from"webpack-virtual-modules";import o from"../commom/parse-module-meta.mjs";import i from"../commom/paths.mjs";import{isLibrary as e}from"../process-env.mjs";import{node_modules as s}from"../utils/index.mjs";import{comment as r,docs as l}from"../vm/docs.mjs";import{examples as m}from"../vm/example.mjs";import{locales as n}from"../vm/locales.mjs";import p from"../vm/modules.mjs";import{route as a}from"../vm/routes.mjs";let f={};for(let t in p)if(Object.prototype.hasOwnProperty.call(p,t)){let{file:i,pkg:e,meta:s}=o(t);f[e]=s,f[i]=p[t]}export class VirtualModuleWebpackPlugin{constructor(i={}){this.virtualModules=new t(f),this.options={},this.init=!1;let e={};for(let t in i)if(Object.prototype.hasOwnProperty.call(i,t)){let{file:s,pkg:r,meta:l}=o(t),m=i[t],n=m;n=s.endsWith("json")?"string"==typeof m?m:JSON.stringify(m):"string"==typeof m?m:`export default ${JSON.stringify(m)}`,Object.assign(e,{[s]:n,[r]:l})}this.options=e}modify(t,o,e){let r=e||"",l=o.startsWith(i.nodeModules)?o:s(o),m=t.inputFileSystem;for(;m&&m._inputFileSystem;)m=m._inputFileSystem;let n=m?._virtualFiles?.[l];n&&n.contents===r||(this.virtualModules.writeModule(l,r),t.watching?.invalidate())}apply(t){this.virtualModules.apply(t);let o=(o,i)=>{this.modify(t,o,i)};a.on("change",o),n.on("change",o),e&&(m.on("change",o),l.on("change",o),r.on("change",o)),t.hooks.compilation.tap("VirtualModuleWebpackPlugin",()=>{if(!this.init){for(let t in this.init=!0,this.options)Object.prototype.hasOwnProperty.call(this.options,t)&&o(t,this.options[t]);for(let t of m)o(t[0],t[1]);for(let t of l)o(t[0],t[1]);for(let t of r)o(t[0],t[1])}})}}
|
package/lib/plugins.config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"html-webpack-plugin";import t from"webpack";import
|
|
1
|
+
import e from"html-webpack-plugin";import t from"webpack";import o from"./options/html-plugin-option.mjs";import{AddEntryAttributePlugin as l}from"./plugin/add-entry-attribute.mjs";import{CopyPlugin as i}from"./plugin/copy.mjs";import r from"./plugin/module-federation.mjs";import{VirtualModuleWebpackPlugin as p}from"./plugin/virtual-module.mjs";import{CONFIG as n}from"./config.mjs";import{isMicro as s}from"./process-env.mjs";let{DefinePlugin:m,SourceMapDevToolPlugin:a,IgnorePlugin:c}=t,u=n.basename.split("/").filter(Boolean).length,f=`${Array(u).fill("..").join("/")+(u?"/":"")}404.html`,{pathSegmentsToKeep:h=u,path:d=f}=n.fixBrowserRouter||{},g=[...r,new p(n.virtualModule),n.htmlPluginOption&&new e(o),n.fixBrowserRouter&&new e({filename:d,inject:!1,templateContent:()=>`<html lang="en"><head><title>${o.title}</title><script>const pathKeep = ${h||u};const l = window.location;l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + l.pathname.split('/').slice(0, 1 + pathKeep).join('/') + '/?/' + l.pathname.slice(1).split('/').slice(pathKeep).join('/').replace(/&/g, '~and~') + (l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') + l.hash);</script></head><body></body></html>`}),new i(n.copy),s&&new l({test:/main\.bundle\.js$/}),new m({"process.env":JSON.stringify(n.env)}),new c({resourceRegExp:/\/(__(tests|mocks)__|test|spec|e2e)\//}),n.sourceMap&&new a(n.sourceMap),...n.plugins].filter(e=>!!e);export default g;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import r from"core-js-compat";import
|
|
1
|
+
import r from"core-js-compat";import o from"../commom/require.mjs";import{getBrowsersTargets as e}from"./targets.mjs";let s=o("core-js/package.json").version;export const coreJsVersion=s.substring(0,s.indexOf(".",2));export default function(){return r({targets:e(),version:coreJsVersion}).list}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
let r,t;import e from"browserslist";import{browserslistToTargets as s}from"lightningcss";import o from"../paths.mjs";export function getBrowsersTargets(){return r||(r=e(void 0,{path:o.programPath,env:process.env.NODE_ENV}).filter(r=>!r.endsWith(" TP"))),r}export function getLightningCssTargets(){return t||(t=s(getBrowsersTargets())),t}
|
|
1
|
+
let r,t;import e from"browserslist";import{browserslistToTargets as s}from"lightningcss";import o from"../commom/paths.mjs";export function getBrowsersTargets(){return r||(r=e(void 0,{path:o.programPath,env:process.env.NODE_ENV}).filter(r=>!r.endsWith(" TP"))),r}export function getLightningCssTargets(){return t||(t=s(getBrowsersTargets())),t}
|
package/lib/process-env.d.mts
CHANGED
|
@@ -12,7 +12,7 @@ export declare const SSR: boolean;
|
|
|
12
12
|
export declare const mainDirectory: string;
|
|
13
13
|
export declare const jsxImportSource: string;
|
|
14
14
|
declare const description: any, author: any, repository: any, keywords: any;
|
|
15
|
-
export { description,
|
|
15
|
+
export { author, description, keywords, repository };
|
|
16
16
|
/** 应用名称 */
|
|
17
17
|
export declare const PACKAGENAME: string;
|
|
18
18
|
/** 版本号 */
|
package/lib/process-env.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import o from"./commom/
|
|
1
|
+
import o from"./commom/has-pkg.mjs";import e from"./commom/require.mjs";export const APPTYPE=process.env.APPTYPE;export const FRAMEWORK=process.env.FRAMEWORK;export const NODE_ENV=process.env.NODE_ENV;export const isLibrary="library"===APPTYPE;export const isMicro="micro"===APPTYPE;export const isMobile="mobile"===APPTYPE;export const isReact="react"===FRAMEWORK;export const isSolid="solid"===FRAMEWORK;export const SSR="true"===process.env.SSR;export const mainDirectory=isLibrary?"site":"src";export const jsxImportSource={react:"react",solid:"solid-js/h"}[FRAMEWORK];let{name:r,version:s,description:t,author:c,repository:p,keywords:i}=e(`${process.cwd()}/package.json`);export const PACKAGENAME=r;export const PACKAGEVERSION=s;export const coreName="@moneko/core";export const isDev="development"===NODE_ENV;export const refresh=isDev&&(o("solid-refresh")||o("react-refresh"));export{c as author,t as description,i as keywords,p as repository};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ModuleDeclarationKind as
|
|
1
|
+
import{resolve as e}from"node:path";import{ModuleDeclarationKind as t,Project as r,SyntaxKind as o}from"ts-morph";let n=new r({useInMemoryFileSystem:!0});export default function(r,a){let d=[],s=e(`@types/${r}.d.ts`),i=n.createSourceFile(s,a,{overwrite:!0});i.forEachDescendant(e=>{e.getKind()===o.DeclareKeyword&&e.replaceWithText(e.isFirstNodeOnLine()?"export":"")});let l=i.getStructure().statements;return i.removeText(),i.addModule({name:`'${r}'`,declarationKind:t.Module,hasDeclareKeyword:!0,statements:l}),d.push(`// remote module: ${r}`),d.push(i.getText(!0)),d.join("\n")}
|
package/lib/utils/dts.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{createDefaultMapFromNodeModules as e,createSystem as t,createVirtualTypeScriptEnvironment as r}from"@typescript/vfs";import i from"typescript";import o from"../commom/rule.mjs";let c={declaration:!0,emitDeclarationOnly:!0,target:i.ScriptTarget.ESNext,skipLibCheck:!0,checkJs:!1,skipDefaultLibCheck:!0},s=e(c),p=r(t(s),[],i,c);export function generateDeclaration(e,t){let r=o.js.test(t)?t:`${t}.ts`;return s.set(r,e),p.createFile(r,e),p.languageService.getEmitOutput(r).outputFiles.reduce((e,t)=>e+=t.text,"")}export function getExportKeys(e,t){s.set(t,e),p.createFile(t,e);let r=p.getSourceFile(t)?.symbol;return Array.from(r?.exports?.keys()||[])}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{updateFile as t}from"@moneko/utils";import
|
|
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;
|
package/lib/utils/index.d.mts
CHANGED
|
@@ -14,7 +14,7 @@ export declare function toCamelCase(str: string): string;
|
|
|
14
14
|
* @example
|
|
15
15
|
* convertToCamelCase('hello-world') // 'HelloWorld'
|
|
16
16
|
* convertToCamelCase('foo-bar-ui') // 'FooBarUI'
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
18
18
|
export declare function convertToCamelCase(name: string): string;
|
|
19
19
|
type ProgramPath<T extends string> = `${T extends string ? T : string}`;
|
|
20
20
|
/** 位于项目根目录下的位置
|
package/lib/utils/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolve as e}from"node:path";import
|
|
1
|
+
import{resolve as e}from"node:path";import o from"../commom/paths.mjs";export function toCamelCase(e){return e.replace(/-./g,e=>e.charAt(1).toUpperCase())}export function convertToCamelCase(e){return e.toLowerCase().replace(/-(\w)/g,(e,o)=>o?o.toUpperCase():"").replace(/^./,e=>e.toUpperCase()).replace(/Ui$/,"UI")}export function resolveProgram(t){return e(o.programPath,`./${t}`)}export function node_modules(t){return e(o.nodeModules,`./${t}`)}export function isObject(e){let o=typeof e;return null!==e&&("object"===o||"function"===o)}export function isFunction(e){return["[object Function]","[object AsyncFunction]","[object GeneratorFunction]","[object Proxy]"].includes(Object.prototype.toString.call(e))}export function empty(){}
|
package/lib/utils/seo.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{join as o}from"node:path";import{scanRouter as m,sitemap as t}from"@moneko/mdx";import{
|
|
1
|
+
import{join as o}from"node:path";import{scanRouter as m,sitemap as t}from"@moneko/mdx";import{saveFileSync as r}from"@moneko/utils";import{routeDir as e}from"../commom/paths.mjs";import{outputConfig as p}from"../common.mjs";import{CONFIG as i}from"../config.mjs";import{isLibrary as s}from"../process-env.mjs";import{resolveProgram as n}from"./index.mjs";export default(()=>{let{domain:f,jekyll:a,path:l}=i.seo||{},j=l&&n(l)||p?.path;if(!f||!j)return;let x=`https://${f}${i.basename}`;r(o(j,"CNAME"),f),r(o(j,"robots.txt"),`User-agent: *
|
|
2
2
|
Allow: /
|
|
3
3
|
|
|
4
|
-
Sitemap: ${x}/sitemap.txt`),
|
|
4
|
+
Sitemap: ${x}/sitemap.txt`),r(o(j,"sitemap.txt"),[x,...t(e,x,m(e,s))].join("\n")),a||r(o(j,".nojekyll"),"")});
|
package/lib/utils/vts.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{createContext as e,Script as o}from"node:vm";import{transformFileSync as r}from"@swc/core";import t from"../commom/require.mjs";import*as m from"../index.mjs";let s={inputSourceMap:!1,sourceMaps:!1,module:{type:"commonjs"},jsc:{target:"es2015",parser:{syntax:"typescript"},loose:!1}};export function vts(n,p){let u=r(n,s).code,i={exports:{default:null},require:e=>p?.modules[e]?p.modules[e]:"@moneko/core"===e?m:e.startsWith(".")?void 0:t(t.resolve(e))};return(e(i),new o(u,{filename:n}).runInNewContext(i),p?.namedExport)?i.exports:i.exports.default}
|
package/lib/vm/coverage.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{fileExists as e,parseXml as t}from"@moneko/utils";import{PACKAGENAME as r}from"../process-env.mjs";export default function(o){let i="export default {}";if(e(o)){let e={},s=t(o);if(s){let{metrics:t,package:o}=JSON.parse(s).coverage.project;Object.assign(e,{[r]:t.$});for(let t=0,r=o.length;t<r;t++){let r=o[t];Object.assign(e,{[r.$.name]:r.metrics.$})}}i=`export default ${JSON.stringify(e)}`}return i}
|
package/lib/vm/docs.d.mts
CHANGED
package/lib/vm/docs.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{relative as e,sep as t}from"node:path";import o from"
|
|
1
|
+
import{relative as e,sep as t}from"node:path";import{loadFile as o,scanFolderSync as m}from"@moneko/utils";import r from"../commom/parse-module-meta.mjs";import a from"../commom/paths.mjs";import n from"../commom/reactive-object.mjs";import s from"../commom/rule.mjs";import{CONFIG as p}from"../config.mjs";import{FRAMEWORK as c,isLibrary as l,isReact as i,isSolid as d}from"../process-env.mjs";import f from"./generate-doc.mjs";let u={react:"createElement",solid:"createComponent"}[c],{file:g,pkg:h,meta:$}=r("@app/docs");export const docsModuleName=g;export const docsModulePkgJson=h;export const docsModuleMeta=$;export const docs=new n({[g]:"export default {}",[h]:$});export const comment=new n({});export const getCommentPath=function(){let e=/\/(.+?)\.tsx?$/,t=p.alias["@pkg"]?.length;return o=>o.substring(t).replace(/\\/g,"/").replace(e,"@app/comment/$1.md")}();if(l&&!1!==p.htmlPluginOption){let n={},l=`import { ${u}${d?",Dynamic":""} } from "${{react:"react",solid:"solid-js"}[c]}${d?"/web":""}";import SuspenseComp from "@app/suspense";function call_then(res) {return {default: ${i?"() =>":""}${u}(${d?"Dynamic":"'div'"}, {${d?"innerHTML: res.default, component: 'div', class: 'n-md-box' ":"dangerouslySetInnerHTML: {__html:res.default}, className: 'n-md-box'"} })};}`,h=(e,o)=>{if(!e.endsWith("package.json")){let m=e.replace(/@app[/\\]comment[/\\]/,"").split(t),r=m.pop(),a=m.join("/");n[a]||(n[a]={}),o?n[a][r]&&delete n[a][r]:n[a][r]=`rr(() => ${u}(SuspenseComp, { comp: () => import(/* webpackChunkName: '${e}' */ '${e}?raw').then(call_then)}))rr`;let p={};for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&(p[e]=Object.values(n[e]));docs.setData(g,`${l}export default ${JSON.stringify(p).replace(s.extract_func,"$1")}`)}};comment.on("change",(t,o)=>{h(e(a.nodeModules,t),o?.length<0)});let $=m(p.alias["@pkg"],["\\.tsx?$"]).filter(e=>!/(^|\/)\.[^\\/\\.]|\.test\./i.test(e));await Promise.all($.map(async e=>({data:await o(e),file:e}))).then(e=>{for(let t=0;t<e.length;t++){let o=e[t];if(o.data){let{file:e,pkg:t,meta:m}=r(getCommentPath(o.file));comment.setData(e,f(o.data,o.file)),comment.setData(t,m)}}})}
|
package/lib/vm/example.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import ReactiveObject from '../
|
|
1
|
+
import ReactiveObject from '../commom/reactive-object.mjs';
|
|
2
2
|
export declare const exampleModuleName = "@app/example";
|
|
3
3
|
export declare const examples: ReactiveObject<Record<string, string>>;
|
|
4
4
|
export declare function generatorExample(): void;
|
package/lib/vm/example.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{generateExample as e}from"@moneko/mdx";import
|
|
1
|
+
import{generateExample as e}from"@moneko/mdx";import o from"../commom/parse-module-meta.mjs";import t from"../commom/paths.mjs";import m from"../commom/reactive-object.mjs";import r from"../commom/rule.mjs";import{CONFIG as p}from"../config.mjs";import{isDev as a,isLibrary as l}from"../process-env.mjs";import{watchFiles as n}from"./utils.mjs";export const exampleModuleName="@app/example";function s(){if(!l||!1===p.htmlPluginOption)return{};let m=JSON.parse(e(t.componentsPath,`${exampleModuleName}/`)),a={};for(let e in m)Object.prototype.hasOwnProperty.call(m,e)&&Object.assign(a,{[e]:`rr(() => import('${e}'))rr`});let n={...m,[exampleModuleName]:`export default ${JSON.stringify(a).replace(r.extract_func,"$1")}`},s={};for(let e in n)if(Object.prototype.hasOwnProperty.call(n,e)){let{file:t,pkg:m,meta:r}=o(e);s[m]=r,s[t]=n[e]}return s}export const examples=new m(s());export function generatorExample(){let e=s();for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&examples.setData(o,e[o])}l&&a&&!1!==p.htmlPluginOption&&n(t.componentsPath,/(?<!\/examples\/(.+)\.md)$/,generatorExample);
|
package/lib/vm/info.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CONFIG as
|
|
1
|
+
import e from"../commom/require.mjs";import{CONFIG as r}from"../config.mjs";import{APPTYPE as o,author as s,description as m,FRAMEWORK as t,PACKAGENAME as i,PACKAGEVERSION as p,repository as a,SSR as n}from"../process-env.mjs";import{convertToCamelCase as f}from"../utils/index.mjs";let c=e(`${{react:"react",solid:"solid-js"}[t]}/package.json`).version,l="string"==typeof s,d={name:i,projectName:f(i),ssr:n,version:p,base:r.basename,type:o,routerMode:r.routerMode,prefixCls:r.prefixCls,theme:r.theme,description:m,author:l?{name:s}:s,repository:l?{url:a}:a,frameworkVersion:c};export default d;
|
package/lib/vm/locales.d.mts
CHANGED
package/lib/vm/locales.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{basename as e,join as t}from"node:path";import{
|
|
2
|
-
export function template(r,n){return r.replace(/\\\${\\w+}/g,function(r){var t=r.slice(2,-1);var e=n[t];return e!==void 0?e.toString():""})}function deepFreeze(o) { const p = Reflect.ownKeys(o);for (const k of p) {const v = o[k];if ((v && typeof v === "object") || typeof v === "function") {deepFreeze(v);}}return Object.freeze(o);}export const locales = ${JSON.stringify(e)};const _res = ${JSON.stringify(t)};const resources = deepFreeze(_res);${
|
|
1
|
+
import{basename as e,join as t}from"node:path";import{directoryExists as o,scanFolderSync as a}from"@moneko/utils";import{watch as l}from"chokidar";import r from"../commom/log.mjs";import n from"../commom/parse-module-meta.mjs";import c from"../commom/reactive-object.mjs";import s from"../commom/require.mjs";import i from"../commom/sigint-exit.mjs";import{CONFIG as m}from"../config.mjs";import{FRAMEWORK as g,isDev as f}from"../process-env.mjs";let p={react:'import sso from "shared-store-object";',solid:'import { createEffect, createRoot, getOwner } from "solid-js";import { createStore } from "solid-js/store";'},u={react:'let storageKey="localizable.language",language=localStorage.getItem(storageKey)||"zh_CN",{translation:a,...defaultLocale}=Object.assign({title:"简体中文",language:"zh_CN",translation:{}},resources[language]||resources.zh_CN),localizable=sso({lang:defaultLocale,t:a});export function setLang(a){let{translation:e,...l}=resources[a]||{};e&&(localizable.lang=l,localizable.t=e,localStorage.setItem(storageKey,l.language))}export default localizable;',solid:'let locale=createRoot(()=>{let e="localizable.language",a=localStorage.getItem(e)||"zh_CN",{translation:l,...o}=Object.assign({title:"简体中文",language:"zh_CN",translation:{}},resources[a]||resources.zh_CN),[n,c]=createStore({lang:o,t:l});return createEffect(()=>{let a=resources[n.lang.language]?.translation;a&&(c("t",a),localStorage.setItem(e,n.lang.language))}),{localizable:n,setLocalizable:c,setLang:function(e){let{translation:a,...l}=resources[e]||{};a&&c("lang",l)}}},getOwner());export const setLocalizable=locale.setLocalizable;export const t=locale.localizable.t;export const lang=locale.localizable.lang;export const setLang=locale.setLang;'}[g];function d(e,t){return`${p[g]}
|
|
2
|
+
export function template(r,n){return r.replace(/\\\${\\w+}/g,function(r){var t=r.slice(2,-1);var e=n[t];return e!==void 0?e.toString():""})}function deepFreeze(o) { const p = Reflect.ownKeys(o);for (const k of p) {const v = o[k];if ((v && typeof v === "object") || typeof v === "function") {deepFreeze(v);}}return Object.freeze(o);}export const locales = ${JSON.stringify(e)};const _res = ${JSON.stringify(t)};const resources = deepFreeze(_res);${u}`}let{file:z,pkg:b,meta:h}=n("@app/locales");export const localesModuleName=z;export const locales=new c({[z]:d([],{}),[b]:h});let j={};async function y(t,o){let a=e(t).replace(/\.[^.]+$/,"");try{"deleted"===o?delete j[a]:(delete s.cache[t],Object.assign(j,{[a]:s(t).default}));let e=[],l={};for(let t in j)if(Object.prototype.hasOwnProperty.call(j,t)){let{language:o=a,title:r=o,icon:n,translation:c={}}=j[t];e.push({language:o,title:r,icon:n}),l[o]={language:o,title:r,icon:n,translation:c}}locales.setData(z,d(e,l)),locales.setData(b,h)}catch(e){r(e)}}let x=t(m.alias["@"],"./locales");if(o(x)&&!1!==m.htmlPluginOption){let e=a(x,[".ts$"]).filter(e=>!/^\..*|\.d\.ts$/.test(e));await Promise.all(e.map(e=>y(e,"added"))),f&&function(e,t){let o=l(e,{ignored:t,persistent:!0,ignoreInitial:!0});function a(){o.unwatch(e),o.close()}o.on("add",e=>{y(e,"added")}),o.on("change",e=>{y(e,"change")}),o.on("unlink",e=>{y(e,"deleted")}),o.once("ready",()=>{f||a()}),i(a)}(x,[/^\..*/,/!\.ts$/,/\.d\.ts$/])}
|
package/lib/vm/modules.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{join as
|
|
1
|
+
import{join as o}from"node:path";import{getAppEntry as m,getAppFallback as p,getAppMdxScope as t,getAppMergeRouter as e,getAppNormalizeCss as r,getAppPrefixRouter as s,getAppRem as a,getAppSuspense as i}from"@moneko/mdx";import{updateFileSync as f}from"@moneko/utils";import n from"../commom/has-pkg.mjs";import l from"../commom/parse-module-meta.mjs";import d from"../commom/paths.mjs";import c from"../commom/rule.mjs";import{CONFIG as u}from"../config.mjs";import x from"../plugin/module-federation.mjs";import{APPTYPE as j,FRAMEWORK as g}from"../process-env.mjs";import v from"../utils/create-types.mjs";import{generateDeclaration as y}from"../utils/dts.mjs";import{node_modules as h}from"../utils/index.mjs";import k from"./coverage.mjs";import{docs as O,docsModuleName as S}from"./docs.mjs";import b from"./info.mjs";import{locales as z,localesModuleName as D}from"./locales.mjs";import{route as J,routesModuleName as N}from"./routes.mjs";let $=n(o(u.alias["@"],"./mdx-scope.tsx"))||n(o(u.alias["@"],"./mdx-scope.ts")),C={"@app/env.ts":`export default ${JSON.stringify(u.env)}`,"@app/info.ts":`export default ${JSON.stringify(b)}`,"@app/entry.ts":m(o(u.alias["@"],"./index.ts"),!!x.length,!!u.rem,!!u.normalizeCss,j,g),"@app/rem":a(u.rem?.designSize||1680),"@app/fallback":p(u.fallbackCompPath),"@app/coverage":k(d.coveragePath),"@app/merge-router":e(),"@app/prefix-router":s(),"@app/normalize/index.css":r(),"@app/suspense/index.tsx":i(j,g),"@app/mdx-scope.tsx":$?t($):"export default {}","@app/routes":J.getData(N),"@app/locales":z.getData(D),"@app/docs":O.getData(S)};f(h("@types/@app/index.d.ts"),["@app/env.ts","@app/info.ts","@app/entry.ts","@app/mdx-scope.tsx"].map(o=>v(o.replace(c.js,""),y(C[o],o))).join("\n")),f(h("@types/@vm/index.d.ts"),Object.keys(u.virtualModule).map(o=>{let m=u.virtualModule[o],{file:p}=l(o);return v(o,y("string"==typeof m?m:`export default ${JSON.stringify(m)}`,p))}).join("\n"));export default C;
|
package/lib/vm/routes.d.mts
CHANGED
package/lib/vm/routes.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{generateRouter as o}from"@moneko/mdx";import
|
|
1
|
+
import{generateRouter as o}from"@moneko/mdx";import t from"../commom/parse-module-meta.mjs";import{routeDir as e}from"../commom/paths.mjs";import r from"../commom/reactive-object.mjs";import{CONFIG as m}from"../config.mjs";import{FRAMEWORK as s,isDev as n,isLibrary as p}from"../process-env.mjs";import{watchFiles as u}from"./utils.mjs";let i=p?"@pkg":"@/pages",{file:a,pkg:c,meta:f}=t("@app/routes");export const routesModuleName=a;export const routesModulePkgJson=c;export const routesModuleMeta=f;function x(){return!1===m.htmlPluginOption?"":o(e,`${m.alias["@"]}/router/index.ts`,s,i,p)}export const route=new r({[a]:x(),[c]:f});export function generatorRouter(){route.setData(a,x())}n&&u(e,p?/(?<!README\.mdx?)$/:/(?<!index\.tsx?)$/,generatorRouter);
|
package/lib/vm/utils.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{watch as i}from"chokidar";import
|
|
1
|
+
import{watch as i}from"chokidar";import o from"../commom/sigint-exit.mjs";import{empty as t}from"../utils/index.mjs";export function watchFiles(n,r,e=t){let m=i(n,{ignored:(i,o)=>{if(o)return!o.isDirectory()&&r?.test(i)},persistent:!0,ignoreInitial:!0});m.on("add",e).on("change",e).on("unlink",e),o(function(){m.unwatch(n),m.close()})}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.26.
|
|
3
|
+
"version": "3.26.4",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
"chokidar": "4.0.1",
|
|
28
28
|
"core-js": "3.39.0",
|
|
29
29
|
"core-js-compat": "3.39.0",
|
|
30
|
-
"css-loader": "7.1.2",
|
|
31
30
|
"express": "5.0.1",
|
|
32
31
|
"html-webpack-plugin": "5.6.3",
|
|
33
32
|
"http-proxy-middleware": "3.0.3",
|
|
@@ -36,7 +35,6 @@
|
|
|
36
35
|
"lightningcss": "1.28.2",
|
|
37
36
|
"marked-completed": "1.2.14",
|
|
38
37
|
"mini-css-extract-plugin": "2.9.2",
|
|
39
|
-
"mock-json-schema": "1.1.1",
|
|
40
38
|
"multer": "1.4.5-lts.1",
|
|
41
39
|
"style-loader": "4.0.0",
|
|
42
40
|
"swc-loader": "0.2.6",
|
|
@@ -57,6 +55,8 @@
|
|
|
57
55
|
"@types/multer": "1.4.12",
|
|
58
56
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
|
59
57
|
"@types/webpack-hot-middleware": "2.25.9",
|
|
58
|
+
"eslint-config-neko": "3.0.1",
|
|
59
|
+
"openapi-types": "12.1.3",
|
|
60
60
|
"oxlint": "0.13.2",
|
|
61
61
|
"sass": "1.81.0",
|
|
62
62
|
"sass-loader": "16.0.3",
|
package/typings/global.d.ts
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
import VirtualModulesPlugin from 'webpack-virtual-modules';
|
|
2
|
-
import type { BundleAnalyzerOption } from './bundle-analyzer.d';
|
|
3
|
-
import type {
|
|
4
|
-
JsxDomExpressions,
|
|
5
|
-
OptimizationSplitChunksOptions,
|
|
6
|
-
OverrideResolverOption,
|
|
7
|
-
VirtualModulePluginOption,
|
|
8
|
-
} from '../lib/index';
|
|
9
|
-
import type { Options } from 'http-proxy-middleware';
|
|
10
|
-
import type { DonePluginOption } from '../lib/plugin/done';
|
|
11
1
|
import type { MdxOptions } from '@moneko/mdx';
|
|
12
2
|
import type { Config as SwcConfig, JsMinifyOptions as SwcMinifyOptions } from '@swc/core';
|
|
13
3
|
import type { Options as HtmlWebpackPluginOptions } from 'html-webpack-plugin';
|
|
4
|
+
import type { Options } from 'http-proxy-middleware';
|
|
5
|
+
import type { PluginOptions as MiniCssExtractPluginOptions } from 'mini-css-extract-plugin';
|
|
14
6
|
import type { MinifyOptions as TerserMinifyOptions } from 'terser';
|
|
15
7
|
import type {
|
|
16
8
|
Configuration,
|
|
17
9
|
ExternalsPresets,
|
|
10
|
+
FileCacheOptions,
|
|
11
|
+
MemoryCacheOptions,
|
|
12
|
+
ModuleOptions,
|
|
18
13
|
ResolvePluginInstance,
|
|
19
14
|
RuleSetRule,
|
|
20
15
|
WebpackPluginInstance,
|
|
21
|
-
ModuleOptions,
|
|
22
|
-
FileCacheOptions,
|
|
23
|
-
MemoryCacheOptions,
|
|
24
16
|
} from 'webpack';
|
|
25
|
-
|
|
17
|
+
|
|
18
|
+
import type {
|
|
19
|
+
JsxDomExpressions,
|
|
20
|
+
OptimizationSplitChunksOptions,
|
|
21
|
+
OverrideResolverOption,
|
|
22
|
+
VirtualModulePluginOption,
|
|
23
|
+
} from '../lib/index';
|
|
26
24
|
import type { CopyPluginOption } from '../lib/plugin/copy.mjs';
|
|
25
|
+
import type { DonePluginOption } from '../lib/plugin/done';
|
|
26
|
+
|
|
27
|
+
import type { BundleAnalyzerOption } from './bundle-analyzer.d';
|
|
27
28
|
|
|
28
|
-
export type {
|
|
29
|
+
export type { MiniCssExtractPluginOptions, SwcMinifyOptions, TerserMinifyOptions };
|
|
29
30
|
export type MinifierType = 'swc' | 'terser';
|
|
30
31
|
export declare type AppType = 'mobile' | 'site' | 'backstage' | 'micro' | 'library';
|
|
31
32
|
export declare type Framework = 'react' | 'solid';
|
|
@@ -220,7 +221,7 @@ export declare type ConfigType = {
|
|
|
220
221
|
* ```
|
|
221
222
|
* */
|
|
222
223
|
prefixJsLoader: RuleSetRule['use'][];
|
|
223
|
-
/** node_modules中, 需要开启 cssModules 的模块
|
|
224
|
+
/** node_modules中, 需要开启 cssModules 的模块
|
|
224
225
|
* @description 用于指定哪些 node_modules 中的模块需要启用 CSS Modules 功能
|
|
225
226
|
*/
|
|
226
227
|
cssModules: string[];
|
|
@@ -373,8 +374,7 @@ export declare type ConfigType = {
|
|
|
373
374
|
| 'single'
|
|
374
375
|
| 'multiple'
|
|
375
376
|
| {
|
|
376
|
-
|
|
377
|
-
name?: string | Function;
|
|
377
|
+
name?: string | VoidFunction;
|
|
378
378
|
};
|
|
379
379
|
/** 编译输出路径
|
|
380
380
|
* @description 用于配置输出选项,可以是一个字符串(表示输出目录路径)或一个对象(包含详细的输出配置)
|
|
@@ -398,7 +398,7 @@ export declare type ConfigType = {
|
|
|
398
398
|
* './Button': './src/components/Button'
|
|
399
399
|
* }
|
|
400
400
|
* }
|
|
401
|
-
*
|
|
401
|
+
*
|
|
402
402
|
* // 引入远程模块示例
|
|
403
403
|
* {
|
|
404
404
|
* name: 'demo_client_name',
|
|
@@ -420,10 +420,10 @@ export declare type ConfigType = {
|
|
|
420
420
|
* externals: {
|
|
421
421
|
* jquery: 'jQuery'
|
|
422
422
|
* }
|
|
423
|
-
*
|
|
423
|
+
*
|
|
424
424
|
* // 使用数组形式排除多个模块
|
|
425
425
|
* externals: ['jquery', 'lodash']
|
|
426
|
-
*
|
|
426
|
+
*
|
|
427
427
|
* // 使用正则表达式匹配要排除的模块
|
|
428
428
|
* externals: /^(jquery|\$)$/i
|
|
429
429
|
*/
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return u}});const t=require("buffer"),r=require("lightningcss"),n=(e=require("../utils/log.mjs"))&&e.__esModule?e:{default:e},i={Declaration:{custom(e){if("content"===e.name&&1===e.value.length){let t=e.value[0];if("token"===t.type&&"string"===t.value.type)return[{property:e.name,raw:JSON.stringify(t.value.value.replace(/[\u4e00-\u9faF]/g,function(e){return`\\${e.charCodeAt(0).toString(16)}`}))}]}}}};function u(e,u){let o=this.async();this.cacheable&&this.cacheable();let{implementation:a,visitor:s,rem:f,...l}=this.getOptions();if(a&&"function"!=typeof a.transform){o(TypeError(`[lightningcss]: implementation.transform must be an 'lightningcss' transform function. Received ${typeof a.transform}`));return}let c=a?.transform?a.transform:r.transform;try{f&&!i.Length&&(i.Length=function(e){if("px"===e.unit)return{unit:"rem",value:e.value/16}});let{code:r,map:n}=c({filename:this.resourcePath,code:t.Buffer.from(e),minify:!0,visitor:{...i,...s},sourceMap:!!this.sourceMap,inputSourceMap:this.sourceMap&&u?JSON.stringify(u):void 0,...l});o(null,r.toString(),n&&JSON.parse(n.toString()))}catch(e){o(e),(0,n.default)(e)}}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type CustomAtRules, type TransformOptions } from 'lightningcss';
|
|
2
|
-
import type { LoaderContext } from 'webpack';
|
|
3
|
-
export interface LightningCssLoaderOption extends Omit<TransformOptions<CustomAtRules>, 'filename' | 'code' | 'inputSourceMap'> {
|
|
4
|
-
rem?: boolean;
|
|
5
|
-
implementation?: typeof import('lightningcss');
|
|
6
|
-
}
|
|
7
|
-
export default function LightningCssLoader(this: LoaderContext<LightningCssLoaderOption>, source: string, prevMap?: string): void;
|
package/lib/paths.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import o from"node:url";import{dirname as e,resolve as t}from"node:path";import{fileExists as n}from"@moneko/utils";let a=JSON.parse(process.env.npm_config_argv||'{"original":[]}').original;export const __filename=o.fileURLToPath(import.meta.url);export const __dirname=e(__filename);export const yarnArgv={};for(let o=0,e=a.length;o<e;o++){let e=a[o].split("=");Object.assign(yarnArgv,{[e[0]]:e[1]||!0})}export const CUSTOMCONFIG=process.env.npm_config_config||yarnArgv.config||process.env.__args__config__;let c=process.cwd(),r=t(c,"./node_modules"),s={__dirname,__filename,nodeModules:r,pnpmNodeModules:t(r,"./.pnpm/node_modules"),denoNodeModules:t(r,"./.deno"),corePath:o.fileURLToPath(new URL(".",import.meta.url)),programPath:c,webpackCachePath:t(r,"./.cache"),lintCachePath:t(r,"./.cache"),httpCachePath:t(r,"./.cache/http"),swcCachePath:t(r,"./.cache/.swc"),configPath:t(c,"./config/index.ts"),customConfigPath:t(c,`./config/${CUSTOMCONFIG}.ts`),coveragePath:t(c,"./coverage/clover.xml"),pagesPath:t(c,"./src/pages"),componentsPath:t(c,"./components"),mockPath:t(c,"./mock")};export const config_files=[n(s.configPath)&&s.configPath,n(s.customConfigPath)&&s.customConfigPath].filter(Boolean);export const routeDir="library"===process.env.APPTYPE?s.componentsPath:s.pagesPath;export default s;
|
package/lib/utils/has-pkg.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import r from"../commom/require.mjs";export default function(e){try{return r.resolve(e)}catch(r){return!1}}
|
package/lib/utils/os-tmp-dir.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
let e="win32"===process.platform,s=e?/[^:]\\$/:/.\/$/;export default function(){let o;return o=e?process.env.TEMP||process.env.TMP||`${process.env.SystemRoot||process.env.windir}\\temp`:process.env.TMPDIR||process.env.TMP||process.env.TEMP||"/tmp",s.test(o)&&(o=o.slice(0,-1)),o}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{resolve as e}from"node:path";import n from"../paths.mjs";export default function(a,o=1){let t=a.replace(/^\/|\/$/g,"").replace(/\\/g,"/"),i=t,m="index.ts",d=t.match(/(.+)\/index\.([^/]+)$/),r=t.match(/(.+)\.([^/]+)$/);return d?(i=d[1],m=`index.${d[2]}`):r&&(i=r[1],m=`index.${r[2]}`),{name:i,main:m,pkg:e(n.nodeModules,i,"package.json"),file:e(n.nodeModules,i,m),meta:`{"name":"${i}","main":"${m}","version":"0.0.${o}","description": ""}`}}
|