@moneko/core 3.9.14-beta.2 → 3.9.15-beta.0

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/common.js CHANGED
@@ -1 +1 @@
1
- import e from"add-asset-html-webpack-plugin";import t from"html-webpack-plugin";import o from"webpack";import{CONFIG as l,PUBLICPATH as r}from"./config.js";import s from"./html-plugin-option.js";import n from"./module-federation.js";import i from"./module.config.js";import a,{CUSTOMCONFIG as p}from"./paths.js";import c from"./plugin/add-entry-attribute.js";import m from"./plugin/override-resolve.js";import u from"./plugin/virtual-module.js";import{PACKAGENAME as f,PACKAGEVERSION as h,isDev as d,isLibrary as g,isMicro as y}from"./process-env.js";import{resolveNodeModulesPath as b,resolveProgramPath as j}from"./utils.js";let{AutomaticPrefetchPlugin:w,DefinePlugin:v,SourceMapDevToolPlugin:k,WatchIgnorePlugin:x}=o,C=l.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:j(g?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${d?"name":"chunkhash"}].js`,assetModuleFilename:e=>{let t=e.filename;return t&&t.endsWith("?url")&&/(?:webworker|worker)(\.|\b).*\.(js|ts)\b/.test(t.replace("?url",""))?"worker/[name][ext]":"assets/[name][hash][ext]"},library:{name:f,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${f}`,pathinfo:d,clean:!0,publicPath:r,asyncChunks:!0,charset:!0};let O={main:b("@app/entry")};l.polyfill&&Object.assign(O,{"dom-polyfills":[`${a.corePath}/polyfills/replace-children.js`]}),l.entry&&("string"==typeof l.entry?O={main:l.entry}:Object.keys(l.entry)&&Object.assign(O,l.entry)),l.output&&("string"==typeof l.output?outputConfig.path=l.output:Object.keys(l.output)&&Object.assign(outputConfig,l.output));let $=l.basename.split("/").filter(Boolean).length,P=`${Array($).fill("..").join("/")+($?"/":"")}404.html`,{pathSegmentsToKeep:M=$,path:B=P}=l.fixBrowserRouter||{},D=!1;l.cacheDirectory&&(D={type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:l.cacheDirectory,memoryCacheUnaffected:!0,name:[p,process.env.NODE_ENV].filter(Boolean).join("-"),version:h});let R=Object.assign({original:l.alias["@"],override:p&&j(p)},l.overrideResolve);export const clientConfig={entry:O,stats:"errors-only",cache:D,infrastructureLogging:{level:"error"},target:"web",externalsPresets:l.externalsPresets,plugins:[...n,new u(l.virtualModule),new w,l.htmlPluginOption&&new t(s),l.fixBrowserRouter&&new t({filename:B,inject:!1,templateContent:()=>`<html lang="en"><head><title>${s.title}</title><script>const pathKeep = ${M||$};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 e(C),y&&new c({test:/main\.bundle\.js$/}),new v({"process.env":JSON.stringify(l.env)}),new x({paths:[/\.d\.ts$/]}),l.sourceMap&&new k(l.sourceMap),...l.plugins].filter(e=>!!e),node:{global:!1},experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:d&&{imports:!1,entries:!1},buildHttp:l.buildHttp,backCompat:!0,futureDefaults:!1,css:!1,outputModule:!1},resolve:{extensions:[".tsx",".ts",".js",".jsx"],alias:l.alias,plugins:[l.overrideResolve&&new m(R),...l.resolvePlugins].filter(Boolean),fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:i,externals:l.externals,output:outputConfig};
1
+ import e from"add-asset-html-webpack-plugin";import t from"html-webpack-plugin";import o from"webpack";import{CONFIG as l,PUBLICPATH as s}from"./config.js";import r from"./html-plugin-option.js";import n from"./module-federation.js";import i from"./module.config.js";import a,{CUSTOMCONFIG as p}from"./paths.js";import c from"./plugin/add-entry-attribute.js";import m from"./plugin/override-resolve.js";import u from"./plugin/virtual-module.js";import{PACKAGENAME as f,PACKAGEVERSION as h,isDev as d,isLibrary as g,isMicro as y}from"./process-env.js";import{resolveNodeModulesPath as b,resolveProgramPath as j}from"./utils.js";let{AutomaticPrefetchPlugin:w,DefinePlugin:v,SourceMapDevToolPlugin:k,IgnorePlugin:x}=o,C=l.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:j(g?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${d?"name":"chunkhash"}].js`,assetModuleFilename:e=>{let t=e.filename;return t&&t.endsWith("?url")&&/(?:webworker|worker)(\.|\b).*\.(js|ts)\b/.test(t.replace("?url",""))?"worker/[name][ext]":"assets/[name][hash][ext]"},library:{name:f,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${f}`,pathinfo:d,clean:!0,publicPath:s,asyncChunks:!0,charset:!0};let O={main:b("@app/entry")};l.polyfill&&Object.assign(O,{"dom-polyfills":[`${a.corePath}/polyfills/replace-children.js`]}),l.entry&&("string"==typeof l.entry?O={main:l.entry}:Object.keys(l.entry)&&Object.assign(O,l.entry)),l.output&&("string"==typeof l.output?outputConfig.path=l.output:Object.keys(l.output)&&Object.assign(outputConfig,l.output));let M=l.basename.split("/").filter(Boolean).length,P=`${Array(M).fill("..").join("/")+(M?"/":"")}404.html`,{pathSegmentsToKeep:$=M,path:_=P}=l.fixBrowserRouter||{},B=!1;l.cacheDirectory&&(B={type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:l.cacheDirectory,memoryCacheUnaffected:!0,name:[p,process.env.NODE_ENV].filter(Boolean).join("-"),version:h});let D=Object.assign({original:l.alias["@"],override:p&&j(p)},l.overrideResolve);export const clientConfig={entry:O,stats:"errors-only",cache:B,infrastructureLogging:{level:"error"},target:"web",externalsPresets:l.externalsPresets,plugins:[...n,new u(l.virtualModule),new w,l.htmlPluginOption&&new t(r),l.fixBrowserRouter&&new t({filename:_,inject:!1,templateContent:()=>`<html lang="en"><head><title>${r.title}</title><script>const pathKeep = ${$||M};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 e(C),y&&new c({test:/main\.bundle\.js$/}),new v({"process.env":JSON.stringify(l.env)}),new x({resourceRegExp:/\/__tests__\//}),l.sourceMap&&new k(l.sourceMap),...l.plugins].filter(e=>!!e),node:{global:!1},experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:d&&{imports:!1,entries:!1},buildHttp:l.buildHttp,backCompat:!0,futureDefaults:!1,css:!1,outputModule:!1},resolve:{extensions:["...",".jsx",".ts",".tsx"],alias:l.alias,modules:[a.nodeModules],mainFields:["browser","module","main"],mainFiles:["index"],plugins:[l.overrideResolve&&new m(D),...l.resolvePlugins].filter(Boolean),fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:i,externals:l.externals,output:outputConfig};
package/lib/dev.js CHANGED
@@ -1,3 +1,3 @@
1
- import{removeDirAll as e}from"@moneko/mdx";import o from"chalk";import t from"webpack";import s from"webpack-dev-server";import{merge as r}from"webpack-merge";import i from"webpackbar";import{clientConfig as a}from"./common.js";import{CONFIG as l}from"./config.js";import{hasPkg as n}from"./has-pkg.js";import{getIPv4 as p,getPort as m}from"./net.js";import c from"./paths.js";import{isLibrary as d,isReact as u}from"./process-env.js";import{isFunction as w,log as f,resolveProgramPath as v}from"./utils.js";let{HotModuleReplacementPlugin:h}=t,{yellow:g,green:k,grey:b,gray:$,bgBlue:x,bgGreenBright:j,blueBright:S,greenBright:y}=o,T=n("eslint-webpack-plugin"),C=n("stylelint-webpack-plugin"),A=n("@moneko/mock"),B=C?(await import("stylelint-webpack-plugin")).default:null,D=T?(await import("eslint-webpack-plugin")).default:null,E=l.devServer.port||3e3,H=await m(E,65535,l.devServer.host),M=A&&(await import("@moneko/mock")).default,O=u&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,_=!1===l.devtool||l.devtool?l.devtool:"eval-cheap-module-source-map";l.devServer.port=H;let I="/"===l.basename,J=l.devServer.https?"https:":"http:",N=I?"":l.basename,P=l.devServer.port!==H&&$(`Port ${g(E)} is in use, trying ${k(H)} instead.
2
- `);function W(e){return`${J}//${"local"===e?l.devServer.host:p()}:${H}${N}`}let F=$("You application is running here:"),G=`${x(" Local ")} ${S(W("local"))}
3
- ${j(" Network ")} ${y(W("net"))}`,L=["js","jsx","ts","tsx","json","html","vue"],R=L.join(","),Y=["css","scss","sass","less","ts","tsx","js","jsx"],q=Y.join(","),z=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],K=[new h,O&&new O,D&&new D({fix:!0,threads:!0,files:[`${l.alias["@"]}/**/*.{${R}}`,d&&`${l.alias["@pkg"]}/**/*.{${R}}`].filter(Boolean),extensions:L,exclude:z,cache:!0,lintDirtyModulesOnly:!0}),B&&new B({fix:!0,threads:!0,files:[`${l.alias["@"]}/**/*.{${q}}`,d&&`${l.alias["@pkg"]}/**/*.{${q}}`].filter(Boolean),extensions:Y,exclude:z,cache:!0,lintDirtyModulesOnly:!0}),l.bar&&new i(l.bar)].filter(Boolean),Q={headers:{"Access-Control-Allow-Origin":"*"},compress:l.devServer.compress,host:"0.0.0.0",port:H,historyApiFallback:I||{index:N.endsWith("/")?N:`${N}/`,disableDotRule:!0},https:l.devServer.https,proxy:l.proxy,allowedHosts:l.devServer.allowedHosts,client:{reconnect:!0,progress:!1,logging:"info",overlay:!1,webSocketTransport:"ws"},webSocketServer:"ws",static:{watch:{ignored:e=>e.endsWith(".d.ts")||e.includes("/node_modules/")}},setupMiddlewares:(e,o)=>{if(!o)throw Error("devServer is not defined");return o.app&&w(M)&&M(o.app,v("mock/")),e},open:!1,hot:!0},U=t(r(a,{devtool:_,mode:"development",plugins:K}));U.watch({aggregateTimeout:20,ignored:/node_modules(?![\\/]@app)/,stdin:!0},(e,o)=>{!e&&o&&(process.stdout.write("\x1b[2J\x1b[3J\x1b[H"),f([F,"",G,"",b(`Compiled successfully in ${k(`${o.endTime-o.startTime}ms`)}`)]),o.compilation.warnings.forEach(e=>f(e.message)),o.compilation.errors.forEach(e=>f(e.message)),P&&f(P))});let V=new s(Q,U);V.startCallback(e=>{e||f([F,"",G])}),V.stopCallback(o=>{o||e(c.cachePath)}),process.on("exit",function(){U.close(()=>{}),V.invalidate(),V.stop()}),process.on("SIGINT",()=>{process.exit()});
1
+ import{removeDirAll as e}from"@moneko/mdx";import o from"chalk";import t from"webpack";import s from"webpack-dev-server";import{merge as r}from"webpack-merge";import i from"webpackbar";import{clientConfig as a}from"./common.js";import{CONFIG as l}from"./config.js";import{hasPkg as n}from"./has-pkg.js";import{getIPv4 as p,getPort as m}from"./net.js";import c from"./paths.js";import{isLibrary as d,isReact as u}from"./process-env.js";import{isFunction as w,log as f,resolveProgramPath as v}from"./utils.js";let{HotModuleReplacementPlugin:h,WatchIgnorePlugin:g}=t,{yellow:k,green:b,grey:$,gray:x,bgBlue:j,bgGreenBright:S,blueBright:y,greenBright:T}=o,C=n("eslint-webpack-plugin"),A=n("stylelint-webpack-plugin"),B=n("@moneko/mock"),D=A?(await import("stylelint-webpack-plugin")).default:null,E=C?(await import("eslint-webpack-plugin")).default:null,H=l.devServer.port||3e3,M=await m(H,65535,l.devServer.host),O=B&&(await import("@moneko/mock")).default,_=u&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,I=!1===l.devtool||l.devtool?l.devtool:"eval-cheap-module-source-map";l.devServer.port=M;let J="/"===l.basename,N=l.devServer.https?"https:":"http:",P=J?"":l.basename,W=l.devServer.port!==M&&x(`Port ${k(H)} is in use, trying ${b(M)} instead.
2
+ `);function F(e){return`${N}//${"local"===e?l.devServer.host:p()}:${M}${P}`}let G=x("You application is running here:"),L=`${j(" Local ")} ${y(F("local"))}
3
+ ${S(" Network ")} ${T(F("net"))}`,R=["js","jsx","ts","tsx","json","html","vue"],Y=R.join(","),q=["css","scss","sass","less","ts","tsx","js","jsx"],z=q.join(","),K=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],Q=[new g({paths:[/\.d\.ts$/]}),new h,_&&new _,E&&new E({fix:!0,threads:!0,files:[`${l.alias["@"]}/**/*.{${Y}}`,d&&`${l.alias["@pkg"]}/**/*.{${Y}}`].filter(Boolean),extensions:R,exclude:K,cache:!0,lintDirtyModulesOnly:!0}),D&&new D({fix:!0,threads:!0,files:[`${l.alias["@"]}/**/*.{${z}}`,d&&`${l.alias["@pkg"]}/**/*.{${z}}`].filter(Boolean),extensions:q,exclude:K,cache:!0,lintDirtyModulesOnly:!0}),l.bar&&new i(l.bar)].filter(Boolean),U={headers:{"Access-Control-Allow-Origin":"*"},compress:l.devServer.compress,host:"0.0.0.0",port:M,historyApiFallback:J||{index:P.endsWith("/")?P:`${P}/`,disableDotRule:!0},https:l.devServer.https,proxy:l.proxy,allowedHosts:l.devServer.allowedHosts,client:{reconnect:!0,progress:!1,logging:"info",overlay:!1,webSocketTransport:"ws"},webSocketServer:"ws",static:{watch:{ignored:e=>e.endsWith(".d.ts")||e.includes("/node_modules/")}},setupMiddlewares:(e,o)=>{if(!o)throw Error("devServer is not defined");return o.app&&w(O)&&O(o.app,v("mock/")),e},open:!1,hot:!0},V=t(r(a,{devtool:I,mode:"development",plugins:Q}));V.watch({aggregateTimeout:20,ignored:/node_modules(?![\\/]@app)/,poll:1e3,stdin:!0},(e,o)=>{!e&&o&&(process.stdout.write("\x1b[2J\x1b[3J\x1b[H"),f([G,"",L,"",$(`Compiled successfully in ${b(`${o.endTime-o.startTime}ms`)}`)]),o.compilation.warnings.forEach(e=>f(e.message)),o.compilation.errors.forEach(e=>f(e.message)),W&&f(W))});let X=new s(U,V);X.startCallback(e=>{e||f([G,"",L])}),X.stopCallback(o=>{o||e(c.cachePath)}),process.on("exit",function(){V.close(()=>{}),X.invalidate(),X.stop()}),process.on("SIGINT",()=>{process.exit()});
@@ -1 +1 @@
1
- import{merge as e}from"webpack-merge";import{CONFIG as t}from"./config.js";import{description as i,keywords as o}from"./info.js";import{PACKAGENAME as r,coreName as a}from"./process-env.js";import{resolveProgramPath as m}from"./utils.js";let{template:p,favicon:n,...l}=Object.assign({template:`node_modules/${a}/template/index.html`,favicon:`node_modules/${a}/template/favicon.ico`},t.htmlPluginOption||{}),s=e({title:t.env?.PROJECTNAME||r.toLocaleUpperCase()||"Title",filename:"index.html",hash:!1,minify:{collapseWhitespace:!0,removeComments:!0,removeRedundantAttributes:!1,removeScriptTypeAttributes:!1,removeStyleLinkTypeAttributes:!1,removeAttributeQuotes:!0,useShortDoctype:!0},meta:{charset:"UTF-8","X-UA-Compatible":{"http-equiv":"X-UA-Compatible",content:"IE=edge,Chrome=1"},CSP:{"http-equiv":"Content-Security-Policy",content:"script-src 'self' 'unsafe-eval'"},HandheldFriendly:"true",MobileOptimized:"320","screen-orientation":"portrait","x5-orientation":"portrait",browsermode:"application","x5-page-mode":"app","msapplication-tap-highlight":"no",viewport:"width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no","apple-mobile-web-app-capable":"yes",renderer:"webkit",description:i,keywords:o},tags:[],template:m(p),favicon:m(n)},l);export default s;
1
+ import{merge as e}from"webpack-merge";import{CONFIG as t}from"./config.js";import{description as i,keywords as o}from"./info.js";import{PACKAGENAME as r,coreName as a}from"./process-env.js";import{resolveProgramPath as m}from"./utils.js";let{template:p,favicon:n,...l}=Object.assign({template:`node_modules/${a}/template/index.html`,favicon:`node_modules/${a}/template/favicon.ico`},t.htmlPluginOption||{}),s=e({title:t.env?.PROJECTNAME||r.toLocaleUpperCase()||"Title",filename:"index.html",hash:!1,minify:{collapseWhitespace:!0,removeComments:!0,removeRedundantAttributes:!1,removeScriptTypeAttributes:!1,removeStyleLinkTypeAttributes:!1,removeAttributeQuotes:!0,useShortDoctype:!0},meta:{charset:"UTF-8","X-UA-Compatible":{"http-equiv":"X-UA-Compatible",content:"IE=edge,Chrome=1"},CSP:{"http-equiv":"Content-Security-Policy",content:"script-src 'self' 'unsafe-eval'"},HandheldFriendly:"true",MobileOptimized:"320","screen-orientation":"portrait","x5-orientation":"portrait",browsermode:"application","x5-page-mode":"app","msapplication-tap-highlight":"no",viewport:"width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1","apple-mobile-web-app-capable":"yes",renderer:"webkit",description:i,keywords:o},tags:[],template:m(p),favicon:m(n)},l);export default s;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return s}});const e=require("fs"),t={};function s(s){let i=this.resourcePath,{comment:r,generateDoc:n}=this.getOptions();return(0,e.stat)(i,(e,c)=>{if(!e){let e=c.mtime.getTime();t[i]!==e&&(Object.assign(t,{[i]:e}),r.setData(`@app/comment/${i.split("/").slice(-2).join("/").replace(/\.tsx?/,".md")}`,n(s,i)))}}),this.cacheable(!0),s}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return r}});const e=require("fs"),t={};function r(r){let s=this.resourcePath,{comment:i,generateDoc:n,getCommentPath:u}=this.getOptions();return(0,e.stat)(s,(e,a)=>{if(!e){let e=a.mtime.getTime();t[s]!==e&&(Object.assign(t,{[s]:e}),i.setData(u(s),n(r,s)))}}),this.cacheable(!0),r}
@@ -3,4 +3,5 @@ import type { LoaderContext } from 'webpack';
3
3
  export default function (this: LoaderContext<{
4
4
  comment: ReactiveObject<Record<string, string>>;
5
5
  generateDoc(content: string, path: string): string;
6
+ getCommentPath(filepath: string): string;
6
7
  }>, value: string): string;
@@ -1 +1 @@
1
- import e from"mini-css-extract-plugin";import{CONFIG as s,PUBLICPATH as t}from"./config.js";import o from"./modify-vars.js";import r,{CUSTOMCONFIG as a}from"./paths.js";import{FRAMEWORK as l,isDev as i,isLibrary as n,isMicro as c}from"./process-env.js";import d from"./svg-to-data-uri.js";import m from"./swcrc.js";import{getLightningCssTargets as p}from"./targets.js";import u from"./tsloader.config.js";import{resolveNodeModulesPath as f,resolveProgramPath as y}from"./utils.js";import{comment as x}from"./vm/docs.js";import g from"./vm/generate-doc.js";let $=c?t:"../",v={loader:e.loader,options:{publicPath:"/"!==$?$:"../"}},j={loader:`${r.corePath}/loader/lightningcss.cjs`,options:{sourceMap:!!s.sourceMap,analyzeDependencies:!1,targets:p(),drafts:{nesting:!0,customMedia:!0},errorRecovery:!1,unusedSymbols:[],rem:!!s.rem}};i&&(v="style-loader");let b=[...s.cssModules,`@moneko/${l}`,"neko-ui"].map(f),h=[...["src/styles/variables.less","src/styles/mixins.less","site/styles/variables.less","site/styles/mixins.less"].map(y)],w=["components","example","mock","site","src","server"].map(y);a&&w.push(y(a)),s.overrideResolve&&s.overrideResolve.override&&w.push(s.overrideResolve.override);let _={loader:"css-loader",options:{modules:{auto:e=>{for(let s=0,t=b.length;s<t;s++)if(e&&e?.includes(b[s]))return/(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i.test(e);return/(^(?!.*node_modules))(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i.test(e)},localIdentName:"[path][name]__[local]",exportLocalsConvention:"dashesOnly"},importLoaders:2}},M=[v,_,j,{loader:"less-loader",options:{sourceMap:!!s.sourceMap,lessOptions:{modifyVars:o,javascriptEnabled:!0}}},{loader:"style-resources-loader",options:{patterns:h}}].filter(Boolean),B="tsc"===s.compiler,R={loader:B?"ts-loader":"swc-loader",options:B?u:m(i)};function k(e){return w.concat(s.rulesInclude?.[e]?.map(f)||[])}let L=k("media"),O={rules:[n&&i&&{test:/^(?![._]).*(?<!\.test)\.(tsx?)$/,include:s.alias["@pkg"],exclude:[/node_modules/,/(.+)\/__tests__\/(.+)/i],enforce:"pre",loader:`${r.corePath}/loader/ts-doc.cjs`,options:{comment:x,generateDoc:g}},{oneOf:[{resourceQuery:/raw/i,type:"asset/source"},{resourceQuery:/url/i,type:"asset/resource",generator:{filename:e=>{let s=e.filename;return s&&s.endsWith("wasm?url")?"wasm/[name][ext]":"assets/[name][ext]"}}},{test:/\.wasm$/i,type:"webassembly/async",include:k("wasm")},{test:/\.txt$/i,type:"asset/source"},{test:/\.ico$/i,type:"asset/inline",include:L},{test:/\.svg$/i,type:"asset/inline",generator:{dataUrl:e=>d(e.toString())},include:L},{test:/\.(gif|png|jpe?g|webp)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/images/[name][ext]"},include:L},{test:/\.(webm|mp4|ogv)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[name][ext]"},include:L},{test:/\.(woff2?|eot|ttf|otf)(\?.*)?$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[name][ext]"},include:k("font")},{test:/\.(sa|sc)ss$/i,use:[v,_,j,{loader:"sass-loader",options:{implementation:await import("sass"),sassOptions:{}}}].filter(Boolean),include:k("css")},{test:/\.less$/i,use:M,include:k("css")},{test:/\.css$/i,use:[v,"css-loader",j].filter(Boolean),include:k("css")},{test:/\.(cj|mj|t|j)s(|x)$/i,use:[...s.prefixJsLoader,R].filter(Boolean),include:k("js")},{test:/\.mdx?$/i,use:[...s.prefixJsLoader,{loader:`${r.corePath}/loader/mdx.cjs`,options:s.mdx}].filter(Boolean),include:w,exclude:[/(.+)\/examples\/(.+).mdx?$/i]},{test:/\.mdx?$/i,type:"asset/source",include:[/(.+)\/examples\/(.+).mdx?$/i]},{type:"asset/source",include:[/(.+)\/examples\/(.+).*?$/i]}]},...s.moduleRules].filter(e=>"object"==typeof e)};export default O;
1
+ import e from"mini-css-extract-plugin";import{CONFIG as s,PUBLICPATH as t}from"./config.js";import o from"./modify-vars.js";import r,{CUSTOMCONFIG as a}from"./paths.js";import{FRAMEWORK as l,isDev as i,isLibrary as n,isMicro as c}from"./process-env.js";import d from"./svg-to-data-uri.js";import m from"./swcrc.js";import{getLightningCssTargets as p}from"./targets.js";import u from"./tsloader.config.js";import{resolveNodeModulesPath as f,resolveProgramPath as y}from"./utils.js";import{comment as x,getCommentPath as g}from"./vm/docs.js";import j from"./vm/generate-doc.js";let $=c?t:"../",v={loader:e.loader,options:{publicPath:"/"!==$?$:"../"}},h={loader:`${r.corePath}/loader/lightningcss.cjs`,options:{sourceMap:!!s.sourceMap,analyzeDependencies:!1,targets:p(),drafts:{nesting:!0,customMedia:!0},errorRecovery:!1,unusedSymbols:[],rem:!!s.rem}};i&&(v="style-loader");let b=[...s.cssModules,`@moneko/${l}`,"neko-ui"].map(f),w=[...["src/styles/variables.less","src/styles/mixins.less","site/styles/variables.less","site/styles/mixins.less"].map(y)],_=["components","example","mock","site","src","server"].map(y);a&&_.push(y(a)),s.overrideResolve&&s.overrideResolve.override&&_.push(s.overrideResolve.override);let k={loader:"css-loader",options:{modules:{auto:e=>{for(let s=0,t=b.length;s<t;s++)if(e&&e?.includes(b[s]))return/(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i.test(e);return/(^(?!.*node_modules))(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i.test(e)},localIdentName:"[path][name]__[local]",exportLocalsConvention:"dashesOnly"},importLoaders:2}},M=[v,k,h,{loader:"less-loader",options:{sourceMap:!!s.sourceMap,lessOptions:{modifyVars:o,javascriptEnabled:!0}}},{loader:"style-resources-loader",options:{patterns:w}}].filter(Boolean),B="tsc"===s.compiler,P={loader:B?"ts-loader":"swc-loader",options:B?u:m(i)};function R(e){return _.concat(s.rulesInclude?.[e]?.map(f)||[])}let L=R("media"),O={noParse:[/node_modules\/jquery/,/jquery|lodash|prismjs/,/react\.min\.js$/,/@moneko\/(common|css)/,/\/(n-katex|n-code-live)\/umd\//],rules:[n&&i&&{test:/^(?![._]).*(?<!\.test)\.(tsx?)$/,include:s.alias["@pkg"],exclude:[/node_modules/,/(.+)\/__tests__\/(.+)/i],enforce:"pre",loader:`${r.corePath}/loader/ts-doc.cjs`,options:{comment:x,generateDoc:j,getCommentPath:g}},{oneOf:[{resourceQuery:/raw/i,type:"asset/source"},{resourceQuery:/url/i,type:"asset/resource",generator:{filename:e=>{let s=e.filename;return s&&s.endsWith("wasm?url")?"wasm/[name][ext]":"assets/[name][ext]"}}},{test:/\.wasm$/i,type:"webassembly/async",include:R("wasm")},{test:/\.txt$/i,type:"asset/source"},{test:/\.ico$/i,type:"asset/inline",include:L},{test:/\.svg$/i,type:"asset/inline",generator:{dataUrl:e=>d(e.toString())},include:L},{test:/\.(gif|png|jpe?g|webp)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/images/[name][ext]"},include:L},{test:/\.(webm|mp4|ogv)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[name][ext]"},include:L},{test:/\.(woff2?|eot|ttf|otf)(\?.*)?$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[name][ext]"},include:R("font")},{test:/\.(sa|sc)ss$/i,use:[v,k,h,{loader:"sass-loader",options:{implementation:await import("sass"),sassOptions:{}}}].filter(Boolean),include:R("css")},{test:/\.less$/i,use:M,include:R("css")},{test:/\.css$/i,use:[v,"css-loader",h].filter(Boolean),include:R("css")},{test:/\.(cj|mj|t|j)s(|x)$/i,use:[...s.prefixJsLoader,P].filter(Boolean),include:R("js")},{test:/\.mdx?$/i,use:[...s.prefixJsLoader,{loader:`${r.corePath}/loader/mdx.cjs`,options:s.mdx}].filter(Boolean),include:_,exclude:[/(.+)\/examples\/(.+).mdx?$/i]},{test:/\.mdx?$/i,type:"asset/source",include:[/(.+)\/examples\/(.+).mdx?$/i]},{type:"asset/source",include:[/(.+)\/examples\/(.+).*?$/i]}]},...s.moduleRules].filter(e=>"object"==typeof e)};export default O;
package/lib/paths.d.ts CHANGED
@@ -10,6 +10,7 @@ export declare const yarnArgv: Record<string, string> & {
10
10
  */
11
11
  export declare const CUSTOMCONFIG: string | undefined;
12
12
  declare const _default: {
13
+ nodeModules: string;
13
14
  corePath: string;
14
15
  programPath: string;
15
16
  webpackCachePath: string;
package/lib/paths.js CHANGED
@@ -1 +1 @@
1
- import e from"url";let o=JSON.parse(process.env.npm_config_argv||"{}")?.original;export const yarnArgv={};o?.forEach(e=>{let o=e.split("=");Object.assign(yarnArgv,{[o[0]]:o[1]||!0})});export const CUSTOMCONFIG=process.env.npm_config_config||yarnArgv.config;let c=process.cwd(),t=`${c}/node_modules/.cache/.mo`;export default{corePath:e.fileURLToPath(new URL(".",import.meta.url)),programPath:c,webpackCachePath:`${c}/node_modules/.temp_cache`,cachePath:t,httpCachePath:`${c}/node_modules/.cache/http`,swcCachePath:`${c}/node_modules/.swc`,configPath:`${c}/config/index.ts`,customConfigPath:`${c}/config/${CUSTOMCONFIG}.ts`,coveragePath:`${c}/coverage/clover.xml`,pagesPath:`${c}/src/pages`,componentsPath:`${c}/components`};
1
+ import e from"url";let c=JSON.parse(process.env.npm_config_argv||"{}")?.original;export const yarnArgv={};c?.forEach(e=>{let c=e.split("=");Object.assign(yarnArgv,{[c[0]]:c[1]||!0})});export const CUSTOMCONFIG=process.env.npm_config_config||yarnArgv.config;let o=process.cwd(),t=`${o}/node_modules`,a=`${t}/.cache/.mo`;export default{nodeModules:t,corePath:e.fileURLToPath(new URL(".",import.meta.url)),programPath:o,webpackCachePath:`${t}/.temp_cache`,cachePath:a,httpCachePath:`${t}/.cache/http`,swcCachePath:`${t}/.swc`,configPath:`${o}/config/index.ts`,customConfigPath:`${o}/config/${CUSTOMCONFIG}.ts`,coveragePath:`${o}/coverage/clover.xml`,pagesPath:`${o}/src/pages`,componentsPath:`${o}/components`};
package/lib/utils.js CHANGED
@@ -1,2 +1,2 @@
1
- import{resolve as t}from"path";import r from"readline";import{saveFileSync as o}from"@moneko/mdx";import{transformFileSync as e}from"@swc/core";import n from"./paths.js";import c from"./resolver-sync.js";export function esm(t,...r){let o=t.raw[0];for(let e=0;e<r.length;e++)o+=r[e]+t.raw[e+1];return`data:text/javascript;base64,${Buffer.from(o).toString("base64")}`}let p={inputSourceMap:!1,sourceMaps:!1,module:{type:"es6"},jsc:{parser:{syntax:"typescript"},loose:!1}};export function log(t){Array.isArray(t)?t.forEach(t=>{log(`${t}
2
- `)}):(r.cursorTo(process.stdout,0),process.stdout.write(t))}export function tfc(t){return e(t,p).code||"{}"}export function readConf(t,r){let e=`${n.cachePath}/${r}.mjs`;return o(e,tfc(t)),import(e)}export function toUpperCaseString(t){return t?.replace(/\b\w/g,t=>t.toUpperCase()).replace(/\./g," ")}export function resolveProgramPath(r){return t(n.programPath,`./${r}`)}export const resolveNodeModulesPath=t=>resolveProgramPath(`node_modules/${t}`);export const realResolve=t=>c.resolveSync({},n.programPath,t)||t;export function isObject(t){let r=typeof t;return null!==t&&("object"==r||"function"==r)}export function isFunction(t){if(!isObject(t))return!1;let r=Object.prototype.toString.call(t);return"[object Function]"==r||"[object AsyncFunction]"==r||"[object GeneratorFunction]"==r||"[object Proxy]"==r}export function empty(){}
1
+ import{resolve as t}from"path";import o from"readline";import{saveFileSync as r}from"@moneko/mdx";import{transformFileSync as e}from"@swc/core";import n from"./paths.js";import c from"./resolver-sync.js";export function esm(t,...o){let r=t.raw[0];for(let e=0;e<o.length;e++)r+=o[e]+t.raw[e+1];return`data:text/javascript;base64,${Buffer.from(r).toString("base64")}`}let p={inputSourceMap:!1,sourceMaps:!1,module:{type:"es6"},jsc:{parser:{syntax:"typescript"},loose:!1}};export function log(t){Array.isArray(t)?t.forEach(t=>{log(`${t}
2
+ `)}):(o.cursorTo(process.stdout,0),process.stdout.write(t))}export function tfc(t){return e(t,p).code||"{}"}export function readConf(t,o){let e=`${n.cachePath}/${o}.mjs`;return r(e,tfc(t)),import(e)}export function toUpperCaseString(t){return t?.replace(/\b\w/g,t=>t.toUpperCase()).replace(/\./g," ")}export function resolveProgramPath(o){return t(n.programPath,`./${o}`)}export const resolveNodeModulesPath=t=>`${n.nodeModules}/${t}`;export const realResolve=t=>c.resolveSync({},n.programPath,t)||t;export function isObject(t){let o=typeof t;return null!==t&&("object"==o||"function"==o)}export function isFunction(t){if(!isObject(t))return!1;let o=Object.prototype.toString.call(t);return"[object Function]"==o||"[object AsyncFunction]"==o||"[object GeneratorFunction]"==o||"[object Proxy]"==o}export function empty(){}
package/lib/vm/docs.d.ts CHANGED
@@ -2,3 +2,4 @@ import ReactiveObject from '../reactive-object.js';
2
2
  export declare const docsModuleName = "@app/docs";
3
3
  export declare const docs: ReactiveObject<Record<string, string>>;
4
4
  export declare const comment: ReactiveObject<Record<string, string>>;
5
+ export declare const getCommentPath: (file: string) => string;
package/lib/vm/docs.js CHANGED
@@ -1 +1 @@
1
- import{loadFileSync as e,scanFolder as t}from"@moneko/mdx";import o from"./generate-doc.js";import{CONFIG as r}from"../config.js";import{FRAMEWORKNAME as n,createElement as p,isLibrary as s,isReact as a,isSolid as m}from"../process-env.js";import l from"../reactive-object.js";export const docsModuleName="@app/docs";export const docs=new l({[docsModuleName]:"export default {}"});export const comment=new l({});if(s){let s={},l=`import { ${p}${m?",Dynamic":""} } from "${n}${m?"/web":""}";import SuspenseComp from "@app/suspense";function call_then(res) {return {default: ${a?"() =>":""}${p}(${m?"Dynamic":"'n-md'"}, {text: res.default, ${m?"component: 'n-md', ":""}css: 'table td a {display:inline-flex;align-items:center;gap:2px;}table td a n-img{display:inline-block;overflow:hidden;border-radius:var(--border-radius);inline-size:18px;block-size:18px;}' })};}`,c=(e,t)=>{let[o,r]=e.replace(/^@app\/comment\//,"").split("/");if(s[o]||(s[o]={}),t)s[o][r]&&delete s[o][r];else{let e=`@app/comment/${o}/${r}`;s[o][r]=`rr(() => ${p}(SuspenseComp, { comp: () => import(/* webpackChunkName: '${e}' */ '${e}?raw').then(call_then)}))rr`}let n={};for(let e in s)Object.prototype.hasOwnProperty.call(s,e)&&(n[e]=Object.values(s[e]));docs.setData(docsModuleName,`${l}export default ${JSON.stringify(n).replace(/"rr\((.+?)\)rr"/g,"$1")}`)};comment.on("change",(e,t)=>{c(e,t?.length<0)}),t(r.alias["@pkg"]).filter(e=>/^(?![._]).*(?<!\.test)\.(tsx?)$/i.test(e)).forEach(t=>{let r=e(t);r&&comment.setData(`@app/comment/${t.split("/").slice(-2).join("/").replace(/\.tsx?/,".md")}`,o(r,t))})}
1
+ import{loadFileSync as e,scanFolder as t}from"@moneko/mdx";import o from"./generate-doc.js";import{CONFIG as r}from"../config.js";import{FRAMEWORKNAME as n,createElement as a,isLibrary as p,isReact as s,isSolid as m}from"../process-env.js";import l from"../reactive-object.js";export const docsModuleName="@app/docs";export const docs=new l({[docsModuleName]:"export default {}"});export const comment=new l({});export const getCommentPath=function(){let e=/^\/?(.+?)\.tsx?$/,t=r.alias["@pkg"].length;return o=>o.substring(t).replace(e,"@app/comment/$1.md")}();if(p){let p={},l=`import { ${a}${m?",Dynamic":""} } from "${n}${m?"/web":""}";import SuspenseComp from "@app/suspense";function call_then(res) {return {default: ${s?"() =>":""}${a}(${m?"Dynamic":"'n-md'"}, {text: res.default, ${m?"component: 'n-md', ":""}css: 'table td a {display:inline-flex;align-items:center;gap:2px;}table td a n-img{display:inline-block;overflow:hidden;border-radius:var(--border-radius);inline-size:18px;block-size:18px;}' })};}`,c=(e,t)=>{let o=e.replace(/^@app\/comment\//,"").split("/"),r=o.pop(),n=o.join("/");p[n]||(p[n]={}),t?p[n][r]&&delete p[n][r]:p[n][r]=`rr(() => ${a}(SuspenseComp, { comp: () => import(/* webpackChunkName: '${e}' */ '${e}?raw').then(call_then)}))rr`;let s={};for(let e in p)Object.prototype.hasOwnProperty.call(p,e)&&(s[e]=Object.values(p[e]));docs.setData(docsModuleName,`${l}export default ${JSON.stringify(s).replace(/"rr\((.+?)\)rr"/g,"$1")}`)};comment.on("change",(e,t)=>{c(e,t?.length<0)}),t(r.alias["@pkg"]).filter(e=>/^(?![._]).*(?<!\.test)\.(tsx?)$/i.test(e)).forEach(t=>{let r=e(t);r&&comment.setData(getCommentPath(t),o(r,t))})}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.9.14-beta.2",
3
+ "version": "3.9.15-beta.0",
4
4
  "description": "core",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",
@@ -1,5 +1,5 @@
1
1
  <!DOCTYPE html>
2
- <html>
2
+ <html lang="en">
3
3
  <head>
4
4
  <title><%= htmlWebpackPlugin.options.title %></title>
5
5
  <%