@moneko/core 3.9.17-beta.3 → 3.9.17-beta.5

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.
Files changed (115) hide show
  1. package/lib/build.mjs +1 -0
  2. package/lib/common.mjs +1 -0
  3. package/lib/{config.d.ts → config.d.mts} +1 -1
  4. package/lib/config.mjs +1 -0
  5. package/lib/dev.mjs +3 -0
  6. package/lib/has-pkg.mjs +1 -0
  7. package/lib/html-plugin-option.mjs +1 -0
  8. package/lib/index.d.mts +8 -0
  9. package/lib/index.mjs +1 -0
  10. package/lib/{info.d.ts → info.d.mts} +2 -2
  11. package/lib/info.mjs +1 -0
  12. package/lib/loader/ts-doc.d.cts +1 -1
  13. package/lib/{minify.d.ts → minify.d.mts} +1 -1
  14. package/lib/minify.mjs +1 -0
  15. package/lib/modify-vars.mjs +1 -0
  16. package/lib/module-federation.mjs +1 -0
  17. package/lib/module.config.d.mts +3 -0
  18. package/lib/module.config.mjs +1 -0
  19. package/lib/{net.d.ts → net.d.mts} +1 -1
  20. package/lib/net.mjs +1 -0
  21. package/lib/plugin/override-resolve.mjs +1 -0
  22. package/lib/plugin/virtual-module.mjs +1 -0
  23. package/lib/plugins.config.mjs +1 -0
  24. package/lib/polyfills.mjs +1 -0
  25. package/lib/{process-env.d.ts → process-env.d.mts} +1 -1
  26. package/lib/process-env.mjs +1 -0
  27. package/lib/seo.mjs +1 -0
  28. package/lib/{swcrc.d.ts → swcrc.d.mts} +1 -1
  29. package/lib/swcrc.mjs +1 -0
  30. package/lib/targets.mjs +1 -0
  31. package/lib/tsloader.config.mjs +0 -0
  32. package/lib/{utils.d.ts → utils.d.mts} +2 -0
  33. package/lib/utils.mjs +2 -0
  34. package/lib/vm/coverage.mjs +1 -0
  35. package/lib/vm/{docs.d.ts → docs.d.mts} +1 -1
  36. package/lib/vm/docs.mjs +1 -0
  37. package/lib/vm/{example.d.ts → example.d.mts} +1 -1
  38. package/lib/vm/example.mjs +1 -0
  39. package/lib/vm/generate-doc.mjs +1 -0
  40. package/lib/vm/{locales.d.ts → locales.d.mts} +1 -1
  41. package/lib/vm/locales.mjs +2 -0
  42. package/lib/vm/{routes.d.ts → routes.d.mts} +1 -1
  43. package/lib/vm/routes.mjs +1 -0
  44. package/package.json +15 -14
  45. package/typings/global.d.ts +2 -8
  46. package/lib/common.js +0 -1
  47. package/lib/config.js +0 -1
  48. package/lib/dev.js +0 -3
  49. package/lib/has-pkg.js +0 -1
  50. package/lib/html-plugin-option.js +0 -1
  51. package/lib/index.d.ts +0 -8
  52. package/lib/index.js +0 -1
  53. package/lib/info.js +0 -1
  54. package/lib/minify.js +0 -1
  55. package/lib/modify-vars.js +0 -1
  56. package/lib/module-federation.js +0 -1
  57. package/lib/module.config.d.ts +0 -3
  58. package/lib/module.config.js +0 -1
  59. package/lib/net.js +0 -1
  60. package/lib/plugin/override-resolve.js +0 -1
  61. package/lib/plugin/virtual-module.js +0 -1
  62. package/lib/plugins.config.js +0 -1
  63. package/lib/polyfills.js +0 -1
  64. package/lib/process-env.js +0 -1
  65. package/lib/prod.js +0 -1
  66. package/lib/seo.js +0 -1
  67. package/lib/server.js +0 -1
  68. package/lib/swcrc.js +0 -1
  69. package/lib/targets.js +0 -1
  70. package/lib/tsloader.config.d.ts +0 -8
  71. package/lib/tsloader.config.js +0 -1
  72. package/lib/utils.js +0 -2
  73. package/lib/vm/coverage.js +0 -1
  74. package/lib/vm/docs.js +0 -1
  75. package/lib/vm/example.js +0 -1
  76. package/lib/vm/generate-doc.js +0 -1
  77. package/lib/vm/locales.js +0 -2
  78. package/lib/vm/routes.js +0 -1
  79. /package/lib/{dev.d.ts → build.d.mts} +0 -0
  80. /package/lib/{common.d.ts → common.d.mts} +0 -0
  81. /package/lib/{prod.d.ts → dev.d.mts} +0 -0
  82. /package/lib/{has-pkg.d.ts → has-pkg.d.mts} +0 -0
  83. /package/lib/{html-plugin-option.d.ts → html-plugin-option.d.mts} +0 -0
  84. /package/lib/{modify-vars.d.ts → modify-vars.d.mts} +0 -0
  85. /package/lib/{module-federation.d.ts → module-federation.d.mts} +0 -0
  86. /package/lib/{os-tmp-dir.d.ts → os-tmp-dir.d.mts} +0 -0
  87. /package/lib/{os-tmp-dir.js → os-tmp-dir.mjs} +0 -0
  88. /package/lib/{paths.d.ts → paths.d.mts} +0 -0
  89. /package/lib/{paths.js → paths.mjs} +0 -0
  90. /package/lib/plugin/{add-entry-attribute.d.ts → add-entry-attribute.d.mts} +0 -0
  91. /package/lib/plugin/{add-entry-attribute.js → add-entry-attribute.mjs} +0 -0
  92. /package/lib/plugin/{done.d.ts → done.d.mts} +0 -0
  93. /package/lib/plugin/{done.js → done.mjs} +0 -0
  94. /package/lib/plugin/{external-remotes.d.ts → external-remotes.d.mts} +0 -0
  95. /package/lib/plugin/{external-remotes.js → external-remotes.mjs} +0 -0
  96. /package/lib/plugin/{lightningcss-plugin.d.ts → lightningcss-plugin.d.mts} +0 -0
  97. /package/lib/plugin/{lightningcss-plugin.js → lightningcss-plugin.mjs} +0 -0
  98. /package/lib/plugin/{override-resolve.d.ts → override-resolve.d.mts} +0 -0
  99. /package/lib/plugin/{virtual-module.d.ts → virtual-module.d.mts} +0 -0
  100. /package/lib/{plugins.config.d.ts → plugins.config.d.mts} +0 -0
  101. /package/lib/polyfills/{replace-children.js → replace-children.mjs} +0 -0
  102. /package/lib/{polyfills.d.ts → polyfills.d.mts} +0 -0
  103. /package/lib/{reactive-object.d.ts → reactive-object.d.mts} +0 -0
  104. /package/lib/{reactive-object.js → reactive-object.mjs} +0 -0
  105. /package/lib/{resolver-sync.d.ts → resolver-sync.d.mts} +0 -0
  106. /package/lib/{resolver-sync.js → resolver-sync.mjs} +0 -0
  107. /package/lib/{seo.d.ts → seo.d.mts} +0 -0
  108. /package/lib/{svg-to-data-uri.d.ts → svg-to-data-uri.d.mts} +0 -0
  109. /package/lib/{svg-to-data-uri.js → svg-to-data-uri.mjs} +0 -0
  110. /package/lib/{targets.d.ts → targets.d.mts} +0 -0
  111. /package/lib/{server.d.ts → tsloader.config.d.mts} +0 -0
  112. /package/lib/vm/{coverage.d.ts → coverage.d.mts} +0 -0
  113. /package/lib/vm/{generate-doc.d.ts → generate-doc.d.mts} +0 -0
  114. /package/lib/vm/{utils.d.ts → utils.d.mts} +0 -0
  115. /package/lib/vm/{utils.js → utils.mjs} +0 -0
package/lib/build.mjs ADDED
@@ -0,0 +1 @@
1
+ import{removeDirAll as e}from"@moneko/mdx";import m from"mini-css-extract-plugin";import n from"terser-webpack-plugin";import i from"webpack";import{BundleAnalyzerPlugin as o}from"webpack-bundle-analyzer";import{merge as r}from"webpack-merge";import t from"webpack-node-externals";import s from"webpackbar";import{commonConfig as l}from"./common.mjs";import{CONFIG as p}from"./config.mjs";import{getMinifyOption as a}from"./minify.mjs";import u from"./paths.mjs";import c from"./plugin/lightningcss-plugin.mjs";import{SSR as f}from"./process-env.mjs";import{compilerListener as d,resolveProgramPath as h}from"./utils.mjs";import b from"./seo.mjs";import k from"./module.config.mjs";let{optimize:{MinChunkSizePlugin:g,ModuleConcatenationPlugin:w}}=i,j=[];p.minifier&&(j.push(new n(a(p.minifier?.type||"swc",p.minifier?.options))),j.push(new c));let y={splitChunks:p.splitChunk,runtimeChunk:p.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,mangleWasmImports:!0,minimize:!0,minimizer:j},z=[new w,new m({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),p.splitChunk&&new g({minChunkSize:1e4}),p.bundleAnalyzer&&new o(p.bundleAnalyzer)].filter(Boolean),C=[r(l,{optimization:y,module:k(!1),plugins:[...z,p.bar&&new s(p.bar)].filter(Boolean)})];if(f){let e=r(l,{entry:{main:h("site/ssr.tsx")},output:{clean:!1,path:h("ssr"),library:{type:"commonjs2",umdNamedDefine:!1},filename:"[name].cjs",chunkFilename:"[name].cjs",globalObject:"global"},externals:[t()],optimization:y,module:k(!0),target:"node",plugins:[...z,new s({name:"Server"})]});C.push(e)}let x=i(C),v=x.compilers.find(e=>"web"===e.options.target),I=x.compilers.find(e=>"node"===e.options.target);function A(e,m){if(e)throw e;m?.compilation.errors&&console.error(...m.compilation.errors)}let B=[];v&&(v.run(A),B.push(d("client",v))),I&&(I.run(A),B.push(d("server",I))),async function(){await Promise.all(B),p.done?.(),p.seo&&b()}(),process.on("exit",function(){e(u.cachePath)});
package/lib/common.mjs ADDED
@@ -0,0 +1 @@
1
+ import{CONFIG as e,PUBLICPATH as t}from"./config.mjs";import o,{CUSTOMCONFIG as s}from"./paths.mjs";import r from"./plugin/override-resolve.mjs";import l from"./plugins.config.mjs";import{PACKAGENAME as n,PACKAGEVERSION as a,isDev as i,isLibrary as p}from"./process-env.mjs";import{resolveNodeModulesPath as c,resolveProgramPath as m}from"./utils.mjs";export const outputConfig={path:m(p?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${i?"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:n,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${n}`,pathinfo:i,clean:!0,publicPath:t,asyncChunks:!0,charset:!0};let u={main:c("@app/entry")};e.polyfill&&Object.assign(u,{"dom-polyfills":[`${o.corePath}/polyfills/replace-children.js`]}),e.entry&&("string"==typeof e.entry?u={main:e.entry}:Object.keys(e.entry)&&Object.assign(u,e.entry)),e.output&&("string"==typeof e.output?outputConfig.path=e.output:Object.keys(e.output)&&Object.assign(outputConfig,e.output));let d=!1;e.cacheDirectory&&(d=i?{type:"memory"}:{type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:e.cacheDirectory,memoryCacheUnaffected:!0,name:[s,process.env.NODE_ENV].filter(Boolean).join("-"),version:a});let f=Object.assign({original:e.alias["@"],override:s&&m(s)},e.overrideResolve),y=!1===e.devtool||e.devtool?e.devtool:i?"eval-cheap-module-source-map":"cheap-module-source-map";export const commonConfig={devtool:y,entry:u,mode:i?"development":"production",stats:"errors-only",cache:d,infrastructureLogging:{level:"error"},target:"web",externalsPresets:e.externalsPresets,plugins:l,node:{global:!1},experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:i&&{imports:!1,entries:!1},buildHttp:e.buildHttp,backCompat:!0,futureDefaults:!1,css:!1,outputModule:!1},resolve:{extensions:["...",".jsx",".ts",".tsx"],alias:e.alias,modules:[o.nodeModules],mainFields:["browser","module","main"],mainFiles:["index"],plugins:[e.overrideResolve&&new r(f),...e.resolvePlugins].filter(Boolean),fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},externals:e.externals,output:outputConfig};
@@ -1,3 +1,3 @@
1
- import type { ConfigType } from '.';
1
+ import type { ConfigType } from './index.mjs';
2
2
  export declare const CONFIG: ConfigType;
3
3
  export declare const PUBLICPATH: string;
package/lib/config.mjs ADDED
@@ -0,0 +1 @@
1
+ import{fileExists as e}from"@moneko/mdx";import{merge as t}from"webpack-merge";import o,{CUSTOMCONFIG as s}from"./paths.mjs";import{FRAMEWORK as i,PACKAGENAME as n,coreName as r,isDev as a,isLibrary as l,isMobile as m,isSolid as p,jsxImportSource as c,mainDirectory as u}from"./process-env.mjs";import{isFunction as d,log as h,readConf as g,resolveProgramPath as f}from"./utils.mjs";let x=["@moneko","neko-ui","antd","@antv","katex","font-pingfang-sc","font-pingfang-tc","react-photo-view","react-markdown-editor-lite","schema-design","@app",".cache/http/data"],C={seo:!1,mode:"csr",bundleAnalyzer:!1,polyfill:!1,entry:{},minifier:{},sourceMap:{filename:"[file].map",publicPath:""},env:{NODE_ENV:process.env.NODE_ENV},basename:"/",publicPath:"/",rem:{designSize:m?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":f(u)},moduleRules:[],prefixJsLoader:[],cssModules:[],importOnDemand:{},proxy:[],cacheDirectory:o.webpackCachePath,devServer:{allowedHosts:[".baidu.com"],host:"localhost",port:3e3,https:!1,compress:!1},htmlPluginOption:{template:`node_modules/${r}/template/index.html`,favicon:`node_modules/${r}/template/favicon.ico`,tags:[]},assetHtml:[],routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:{chunks:"all",minSize:1024,minChunks:1,cacheGroups:{CHANGELOG:{test:/CHANGELOG\.md/,priority:-10,name:"CHANGELOG",reuseExistingChunk:!0},prismjs:{test:/(prism\.js|prism\/css\.ts)/,priority:-10,name:"vendors-prismjs",reuseExistingChunk:!0},site:{test:/site/,priority:-10,reuseExistingChunk:!0},marked:{test:/marked/,priority:-10,reuseExistingChunk:!0},"n-katex":{test:/n-katex/,priority:-10,reuseExistingChunk:!0},"n-code-live":{test:/n-code-live/,priority:-10,reuseExistingChunk:!0},"@moneko":{test:/@moneko/,priority:-10,reuseExistingChunk:!0}}},runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:x,js:x,media:x,font:x,wasm:[]},mdx:{jsx:!1,development:a,jsxImportSource:c,providerImportSource:`@moneko/${i}/mdx`},jsxDomExpressions:{},bar:{name:"Client",color:"#6f42c1"},normalizeCss:!0,externalsPresets:{},buildHttp:{allowedUris:[],lockfileLocation:`${o.httpCachePath}/http.lock`,cacheLocation:`${o.httpCachePath}/data`,upgrade:!0}};p&&(C.jsxDomExpressions={moduleName:"solid-js/web",builtIns:["For","Show","Switch","Match","Suspense","SuspenseList","Portal","Index","Dynamic","ErrorBoundary"],contextToCustomElements:!0,wrapConditionals:!0,generate:"dom",hydratable:!1}),l&&(C.alias=Object.assign(C.alias,{"@pkg":o.componentsPath,[n]:o.componentsPath}));let k=C,P={},v={};if(e(o.configPath)){let e=(await g(o.configPath,"index")).default;P=d(e)?e(process):e}if(s&&e(o.customConfigPath)){let e=(await g(o.customConfigPath,s)).default;v=d(e)?e(process):e}(!1===(k=t(k,P,v)).devtool||!1===k.sourceMap)&&(k.sourceMap=!1,k.devtool=!1),k.fixBrowserRouter&&k.htmlPluginOption&&(k.htmlPluginOption.tags||(k.htmlPluginOption.tags=[]),k.htmlPluginOption.tags.push({textContent:"(function(l) {if (l.search[1] === '/' ) {var decoded = l.search.slice(1).split('&').map(function(s) {return s.replace(/~and~/g, '&')}).join('?');window.history.replaceState(null, null,l.pathname.slice(0, -1) + decoded + l.hash);}}(window.location))"}));export const CONFIG=k;export const PUBLICPATH=CONFIG.publicPath||"/";global.NEKOCLICONFIG={CONFIG,CUSTOMCONFIG:s,log:h};
package/lib/dev.mjs ADDED
@@ -0,0 +1,3 @@
1
+ import e from"chalk";import t from"webpack";import o from"webpack-node-externals";import s from"express";import a from"cors";import i from"webpack-dev-middleware";import r from"webpack-hot-middleware";import{merge as l}from"webpack-merge";import n from"webpackbar";import{commonConfig as m}from"./common.mjs";import{CONFIG as p}from"./config.mjs";import{hasPkg as c}from"./has-pkg.mjs";import{getIPv4 as u,getPort as d}from"./net.mjs";import{SSR as f,isLibrary as h,isReact as w}from"./process-env.mjs";import{compilerListener as b,log as g,resolveProgramPath as k}from"./utils.mjs";import $ from"./module.config.mjs";let{HotModuleReplacementPlugin:j,WatchIgnorePlugin:x}=t,{yellow:v,green:y,grey:S,gray:_,bgBlue:B,bgGreenBright:T,blueBright:D,greenBright:P}=e,F=c("eslint-webpack-plugin"),M=c("stylelint-webpack-plugin"),N=c("@moneko/mock"),O=M?(await import("stylelint-webpack-plugin")).default:null,C=F?(await import("eslint-webpack-plugin")).default:null,E=p.devServer.port||3e3,I=await d(E,65535,p.devServer.host);N&&(await import("@moneko/mock")).default;let J=w&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default;p.devServer.port=I;let U="/"===p.basename,G=p.devServer.https?"https:":"http:",H=U?"":p.basename,L=p.devServer.port!==I&&_(`Port ${v(E)} is in use, trying ${y(I)} instead.
2
+ `);function Y(e){return`${G}//${"local"===e?p.devServer.host:u()}:${I}${H}`}let q=_("You application is running here:"),z=`${B(" Local ")} ${D(Y("local"))}
3
+ ${T(" Network ")} ${P(Y("net"))}`,A=["js","jsx","ts","tsx","json","html","vue"],K=A.join(","),Q=["css","scss","sass","less","ts","tsx","js","jsx"],R=Q.join(","),V=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],W=[new x({paths:[/\.d\.ts$/]})].filter(Boolean),X=s();X.use(a());let Z=l(m,{entry:{main:[`webpack-hot-middleware/client?path=http://localhost:${I}/__webpack_hmr&timeout=2000`,...m.entry.main]},output:{hotUpdateMainFilename:"updates/[fullhash].hot-update.json",hotUpdateChunkFilename:"updates/[id].[fullhash].hot-update.js"},module:$(!1),plugins:[...W,new j,J&&new J,C&&new C({fix:!0,threads:!0,files:[`${p.alias["@"]}/**/*.{${K}}`,h&&`${p.alias["@pkg"]}/**/*.{${K}}`].filter(Boolean),extensions:A,exclude:V,cache:!0,lintDirtyModulesOnly:!0}),O&&new O({fix:!0,threads:!0,files:[`${p.alias["@"]}/**/*.{${R}}`,h&&`${p.alias["@pkg"]}/**/*.{${R}}`].filter(Boolean),extensions:Q,exclude:V,cache:!0,lintDirtyModulesOnly:!0}),p.bar&&new n(p.bar)].filter(Boolean)}),ee=[Z];if(f){let e=l(m,{entry:{main:k("site/ssr.tsx")},output:{clean:!1,path:k("ssr"),library:{type:"commonjs2",umdNamedDefine:!1},filename:"[name].cjs",chunkFilename:"[name].cjs",globalObject:"global"},externals:[o()],module:$(!0),target:"node",plugins:[...W,new n({name:"Server"})].filter(Boolean)});ee.push(e)}let et=t(ee),eo=et.compilers.find(e=>"web"===e.options.target),es=et.compilers.find(e=>"node"===e.options.target);X.use(a()),X.use(i(eo,{publicPath:Z.output.publicPath,stats:Z.stats,writeToDisk:!0})),X.use(r(eo,{log:!1,path:"/__webpack_hmr",heartbeat:2e3})),es&&es.watch({aggregateTimeout:20,ignored:/node_modules(?![\\/]@app)/,poll:1e3,stdin:!0},function(e,t){!e&&t&&(process.stdout.write("\x1b[2J\x1b[3J\x1b[H"),g([q,"",z,"",S(`Compiled successfully in ${y(`${t.endTime-t.startTime}ms`)}`)]),t.compilation.warnings.forEach(e=>g(e.message)),t.compilation.errors.forEach(e=>g(e.message)))}),await Promise.all([b("client",eo),es&&b("server",es)].filter(Boolean)),X.listen(I,()=>{L&&g(L)}),process.on("exit",function(){}),process.on("SIGINT",()=>{process.exit()});
@@ -0,0 +1 @@
1
+ import{fileExists as o}from"@moneko/mdx";import{resolveNodeModulesPath as m}from"./utils.mjs";export function hasPkg(r){return o(m(`${r}/package.json`))}
@@ -0,0 +1 @@
1
+ import{merge as e}from"webpack-merge";import{CONFIG as t}from"./config.mjs";import{description as i,keywords as o}from"./info.mjs";import{PACKAGENAME as m,coreName as r}from"./process-env.mjs";import{resolveProgramPath as a}from"./utils.mjs";let{template:n,favicon:p,...l}=Object.assign({template:`node_modules/${r}/template/index.html`,favicon:`node_modules/${r}/template/favicon.ico`},t.htmlPluginOption||{}),s=e({title:t.env?.PROJECTNAME||m.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:{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:a(n),favicon:a(p),excludeChunks:["ssr"]},l);export default s;
@@ -0,0 +1,8 @@
1
+ export { default as paths, CUSTOMCONFIG } from './paths.mjs';
2
+ export { PACKAGENAME, PACKAGEVERSION, coreName, isDev, isLibrary, isMicro, mainDirectory, } from './process-env.mjs';
3
+ export { realResolve, resolveNodeModulesPath, resolveProgramPath, log } from './utils.mjs';
4
+ export { getIPv4, getPort } from './net.mjs';
5
+ export { default as osTmpDir } from './os-tmp-dir.mjs';
6
+ export type { MdxOptions } from '@moneko/mdx';
7
+ export type { OverrideResolverOption } from './plugin/override-resolve.mjs';
8
+ export type * from '../typings/global.js';
package/lib/index.mjs ADDED
@@ -0,0 +1 @@
1
+ export{default as paths,CUSTOMCONFIG}from"./paths.mjs";export{PACKAGENAME,PACKAGEVERSION,coreName,isDev,isLibrary,isMicro,mainDirectory}from"./process-env.mjs";export{realResolve,resolveNodeModulesPath,resolveProgramPath,log}from"./utils.mjs";export{getIPv4,getPort}from"./net.mjs";export{default as osTmpDir}from"./os-tmp-dir.mjs";
@@ -3,10 +3,10 @@ declare const app: {
3
3
  projectName: string;
4
4
  version: string;
5
5
  base: string;
6
- type: import("./index.js").AppType;
6
+ type: import("./index.mjs").AppType;
7
7
  routerMode: "browser" | "hash" | "memory";
8
8
  prefixCls: string | undefined;
9
- theme: import("./index.js").Theme | undefined;
9
+ theme: import("./index.mjs").Theme | undefined;
10
10
  description: any;
11
11
  author: any;
12
12
  repository: any;
package/lib/info.mjs ADDED
@@ -0,0 +1 @@
1
+ import{loadFileSync as e}from"@moneko/mdx";import{CONFIG as r}from"./config.mjs";import{APPTYPE as o,PACKAGENAME as t,PACKAGEVERSION as s}from"./process-env.mjs";import{resolveProgramPath as p,toUpperCaseString as i}from"./utils.mjs";let{description:m,author:n,repository:a,keywords:c}=JSON.parse(e(p("package.json"))||"{}"),d="string"==typeof n,f={name:t,projectName:i(t).replace(/-/g," "),version:s,base:r.basename,type:o,routerMode:r.routerMode,prefixCls:r.prefixCls,theme:r.theme,description:m,author:d?{name:n}:n,repository:d?{url:a}:a};export const description=m;export const keywords=Array.isArray(c)?c.toString():"";export default f;
@@ -1,4 +1,4 @@
1
- import type ReactiveObject from '../reactive-object.js';
1
+ import type ReactiveObject from '../reactive-object.mjs';
2
2
  import type { LoaderContext } from 'webpack';
3
3
  export default function (this: LoaderContext<{
4
4
  comment: ReactiveObject<Record<string, string>>;
@@ -1,5 +1,5 @@
1
1
  import TerserPlugin from 'terser-webpack-plugin';
2
- import type { MinifierType, SwcMinifyOptions, TerserMinifyOptions } from '.';
2
+ import type { MinifierType, SwcMinifyOptions, TerserMinifyOptions } from './index.mjs';
3
3
  type MinifyObject = {
4
4
  terser: {
5
5
  minify: typeof TerserPlugin.terserMinify;
package/lib/minify.mjs ADDED
@@ -0,0 +1 @@
1
+ import e from"terser-webpack-plugin";import{merge as o}from"webpack-merge";import{swcMinifyOption as r}from"./swcrc.mjs";export const minify={terser:{minify:e.terserMinify,terserOptions:{ecma:2015,parse:{},compress:{global_defs:{"@alert":"console.log"},drop_console:!0,drop_debugger:!0,pure_funcs:["console.log","console.warn","console.error","console.info"]},toplevel:!1,mangle:!0,module:!1,format:{comments:!1},ie8:!1,keep_classnames:void 0,keep_fnames:!1,safari10:!1},extractComments:!1},swc:{minify:e.swcMinify,terserOptions:r}};export const getMinifyOption=(e,r={})=>{let s=minify[e];return Object.assign(s,{terserOptions:o(s.terserOptions,r)})};
@@ -0,0 +1 @@
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":JSON.stringify(o.favicon)};Object.assign(n,i.modifyVars);export default n;
@@ -0,0 +1 @@
1
+ import e from"webpack";import{CONFIG as r}from"./config.mjs";import t from"./plugin/external-remotes.mjs";import{realResolve as o}from"./utils.mjs";let{NormalModuleReplacementPlugin:s,container:{ModuleFederationPlugin:a}}=e,m={},i={},l={},n=r.moduleFederation?.map(e=>{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,s=t.filename||"remote_entry.js";if(l[o]=`${t.name}@${t.host}/${s}`,Array.isArray(t.library))for(let e=0,r=t.library.length;e<r;e++)m[t.library[e]]=`${o}/${t.library[e]}`}if(Array.isArray(e.exposes))for(let r=0,t=e.exposes.length;r<t;r++){let t=e.exposes[r];"string"==typeof t?i[`./${t}`]=o(t):"[object Object]"===Object.prototype.toString.call(t)&&(i[`./${t.name}`]=o(t.path))}return new a({filename:"remote_entry.js",...e,remotes:l,exposes:i})});n.length&&(n.push(new t),n.push(new s(/(.*)/,e=>{m[e.request]&&(e.request=m[e.request])})));export default n;
@@ -0,0 +1,3 @@
1
+ import type { ModuleOptions } from 'webpack';
2
+ declare const _default: (ssr: boolean) => ModuleOptions;
3
+ export default _default;
@@ -0,0 +1 @@
1
+ let e;import s from"mini-css-extract-plugin";import{CONFIG as t,PUBLICPATH as o}from"./config.mjs";import r from"./modify-vars.mjs";import a,{CUSTOMCONFIG as i}from"./paths.mjs";import{FRAMEWORK as l,SSR as n,isDev as m,isLibrary as d,isMicro as c}from"./process-env.mjs";import p from"./svg-to-data-uri.mjs";import u from"./swcrc.mjs";import{getLightningCssTargets as f}from"./targets.mjs";import{resolveNodeModulesPath as y,resolveProgramPath as g}from"./utils.mjs";import{comment as j,getCommentPath as $}from"./vm/docs.mjs";import x from"./vm/generate-doc.mjs";import{hasPkg as v}from"./has-pkg.mjs";let h=c?o:"../",w={loader:s.loader,options:{publicPath:"/"!==h?h:"../"}},b={loader:`${a.corePath}/loader/lightningcss.cjs`,options:{sourceMap:!!t.sourceMap,analyzeDependencies:!1,targets:f(),drafts:{nesting:!0,customMedia:!0},errorRecovery:!1,unusedSymbols:[],rem:!!t.rem}};m&&(w="style-loader");let _=[...t.cssModules,`@moneko/${l}`,"neko-ui"].map(y),k=["components","example","mock","site","src","server"].map(g);i&&k.push(g(i)),t.overrideResolve&&t.overrideResolve.override&&k.push(t.overrideResolve.override);let M={loader:"css-loader",options:{modules:{auto:e=>{for(let s=0,t=_.length;s<t;s++)if(e&&e?.includes(_[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",exportOnlyLocals:n},importLoaders:2}},B=[w,M,b,{loader:"less-loader",options:{sourceMap:!!t.sourceMap,lessOptions:{modifyVars:r,javascriptEnabled:!0}}}].filter(Boolean);function L(e){return k.concat(t.rulesInclude?.[e]?.map(y)||[])}let O=L("css"),P=L("js"),R=L("media"),I=L("wasm"),J=L("font");v("sass")&&(e={loader:"sass-loader",options:{implementation:await import("sass"),sassOptions:{}}});export default(s=>{let o={loader:"swc-loader",options:u(s)};return{noParse:[/jquery|lodash|prismjs|prism\.js/,/react\.min\.js$/,/marked\.min\.js$/],rules:[d&&m&&{test:/^(?![._]).*(?<!\.test)\.(tsx?)$/,include:t.alias["@pkg"],exclude:[/node_modules/,/(.+)\/__tests__\/(.+)/i],enforce:"pre",loader:`${a.corePath}/loader/ts-doc.cjs`,options:{comment:j,generateDoc:x,getCommentPath:$}},{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:I},{test:/\.txt$/i,type:"asset/source"},{test:/\.ico$/i,type:"asset/inline",include:R},{test:/\.svg$/i,type:"asset/inline",generator:{dataUrl:e=>p(e.toString())},include:R},{test:/\.(gif|png|jpe?g|webp)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/images/[name][ext]"},include:R},{test:/\.(webm|mp4|ogv)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[name][ext]"},include:R},{test:/\.(woff2?|eot|ttf|otf)(\?.*)?$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[name][ext]"},include:J},{test:/\.(sa|sc)ss$/i,use:[w,M,b,e].filter(Boolean),include:O},{test:/\.less$/i,use:B,include:O},{test:/\.css$/i,use:[w,"css-loader",b].filter(Boolean),include:O},{test:/\.(cj|mj|t|j)s(|x)$/i,use:[...t.prefixJsLoader,o].filter(Boolean),include:P},{test:/\.mdx?$/i,use:[...t.prefixJsLoader,{loader:`${a.corePath}/loader/mdx.cjs`,options:t.mdx}].filter(Boolean),exclude:[/node_modules/]},{type:"asset/source",include:[/(.+)\/examples\/(.+).*?$/i]}]},...t.moduleRules].filter(e=>"object"==typeof e)}});
@@ -1,2 +1,2 @@
1
- export declare function getIPv4(): string | undefined;
1
+ export declare function getIPv4(): null;
2
2
  export declare function getPort<T = number>(start: T, end: number, host?: string): Promise<T>;
package/lib/net.mjs ADDED
@@ -0,0 +1 @@
1
+ import{createConnection as e}from"net";import{networkInterfaces as r}from"os";export function getIPv4(){let e=r(),t=null;return Object.keys(e).forEach(r=>{e[r]?.forEach(e=>{"IPv4"!==e.family||e.internal||(t=e.address)})}),t}export function getPort(r,t,o="0.0.0.0"){return new Promise(n=>{if("number"!=typeof r)n(r);else{let f=e(r,o);f.on("connect",()=>{f.destroy(),n(getPort(r+1,t,o))}),f.on("error",()=>{n(r)})}})}
@@ -0,0 +1 @@
1
+ import{relative as e}from"path";import{fileExists as t}from"@moneko/mdx";import r from"../paths.mjs";let a="OverrideResolverPlugin";export default class{constructor(e){this.options=e}apply(i){let{override:o,original:s}=this.options;if(o&&s){let l=`./${e(r.programPath,s)}`,p=`./${e(r.programPath,o)}`;i.getHook("existing-file").tapAsync(a,(e,r,n)=>{let h=e.request||e.path;if(h&&h.startsWith(s)&&e.relativePath){let m=h.replace(s,o);if(t(m)){let t=e.relativePath.replace(l,p);return Object.assign(e,{path:m,relativePath:t,__innerRequest_relativePath:t,__innerRequest:t}),i.doResolve("resolved",e,`${a} 使用目标模块${o}`,r,n)}}return n()})}}}
@@ -0,0 +1 @@
1
+ import{join as o}from"path";import{getAppEntry as t,getAppFallback as e,getAppMdxScope as p,getAppMergeRouter as r,getAppNormalizeCss as a,getAppPrefixRouter as m,getAppRem as s,getAppSuspense as i}from"@moneko/mdx";import n from"webpack-virtual-modules";import{CONFIG as f}from"../config.mjs";import l from"../info.mjs";import c from"../paths.mjs";import{APPTYPE as h,FRAMEWORK as d,isLibrary as g}from"../process-env.mjs";import{resolveNodeModulesPath as u,resolveProgramPath as x}from"../utils.mjs";import j from"../vm/coverage.mjs";import{comment as v,docs as y,docsModuleName as k}from"../vm/docs.mjs";import{exampleModuleName as b,examples as w}from"../vm/example.mjs";import{locales as O,localesModuleName as P}from"../vm/locales.mjs";import{route as z,routesModuleName as D}from"../vm/routes.mjs";export default class{constructor(o){this.options=o,this.hasTapped=!1}apply(S){let T=new n({[u("@app/info")]:`export default ${JSON.stringify(l)}`,[u("@app/entry")]:t(o(f.alias["@"],"./index.ts"),!!f.rem,!!f.normalizeCss,h,d),[u("@app/rem")]:s(f.rem?.designSize||1680),[u("@app/fallback")]:e(f.fallbackCompPath),[u("@app/coverage")]:j(c.coveragePath),[u("@app/merge-router")]:r(),[u("@app/prefix-router")]:m(),[u("@app/normalize/index.css")]:a(),[u("@app/suspense/index.tsx")]:i(h,d),[u("@app/mdx-scope")]:p(x("site/mdx-scope.ts")),[u(D)]:z.getData(D),[u(b)]:"export default []",[u(P)]:O.getData(P),[u(k)]:y.getData(k)});function C(o,t){let e=u(o);T.writeModule(e,t||"")}T.apply(S),z.on("change",C),O.on("change",C),g&&(w.on("change",C),y.on("change",C),v.on("change",C)),S.hooks.compilation.tap("VirtualModuleWebpackPlugin",()=>{if(!this.hasTapped){for(let o in this.hasTapped=!0,this.options)if(Object.prototype.hasOwnProperty.call(this.options,o)){let t=this.options[o];C(o,"string"==typeof t?t:`export default ${JSON.stringify(t)}`)}for(let o of w)C(...o);for(let o of y)C(...o);for(let o of v)C(...o)}})}}
@@ -0,0 +1 @@
1
+ import e from"@loadable/webpack-plugin";import t from"add-asset-html-webpack-plugin";import l from"html-webpack-plugin";import o from"webpack";import{CONFIG as i}from"./config.mjs";import r from"./html-plugin-option.mjs";import p from"./module-federation.mjs";import n from"./plugin/add-entry-attribute.mjs";import a from"./plugin/virtual-module.mjs";import{SSR as m,isMicro as s}from"./process-env.mjs";let{AutomaticPrefetchPlugin:c,DefinePlugin:u,SourceMapDevToolPlugin:h,IgnorePlugin:f}=o,d=i.basename.split("/").filter(Boolean).length,w=`${Array(d).fill("..").join("/")+(d?"/":"")}404.html`,{pathSegmentsToKeep:g=d,path:b=w}=i.fixBrowserRouter||{},j=i.assetHtml.map(e=>({publicPath:"",...e})),v=[m&&new e,...p,new a(i.virtualModule),new c,i.htmlPluginOption&&new l(r),i.fixBrowserRouter&&new l({filename:b,inject:!1,templateContent:()=>`<html lang="en"><head><title>${r.title}</title><script>const pathKeep = ${g||d};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 t(j),s&&new n({test:/main\.bundle\.js$/}),new u({"process.env":JSON.stringify(i.env)}),new f({resourceRegExp:/\/__tests__\//}),i.sourceMap&&new h(i.sourceMap),...i.plugins].filter(e=>!!e);export default v;
@@ -0,0 +1 @@
1
+ import t from"core-js-compat";import{getBrowsersTargets as r}from"./targets.mjs";export default function(){return t({targets:r(),version:"3.34"}).list}
@@ -1,4 +1,4 @@
1
- import type { AppType, Framework } from '.';
1
+ import type { AppType, Framework } from './index.mjs';
2
2
  export declare const APPTYPE: AppType;
3
3
  export declare const FRAMEWORK: Framework;
4
4
  export declare const isLibrary: boolean;
@@ -0,0 +1 @@
1
+ import o from"./paths.mjs";export const APPTYPE=process.env.APPTYPE;export const FRAMEWORK=process.env.FRAMEWORK;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];export const PACKAGENAME=process.env.npm_package_name;export const PACKAGEVERSION=process.env.npm_package_version;export const coreName="@moneko/core";export const isDev="development"===process.env.NODE_ENV;export const routeDir=isLibrary?o.componentsPath:o.pagesPath;
package/lib/seo.mjs ADDED
@@ -0,0 +1 @@
1
+ import{join as m}from"path";import{saveFileSync as o,scanRouter as t,sitemap as r}from"@moneko/mdx";import{outputConfig as e}from"./common.mjs";import{CONFIG as p}from"./config.mjs";import{isLibrary as i,routeDir as s}from"./process-env.mjs";import{resolveProgramPath as f}from"./utils.mjs";export default(()=>{let{domain:n,nojekyll:a,path:j}=p.seo||{},l=j&&f(j)||e?.path;if(!n||!l)return;let x=`https://${n}${p.basename}`;o(m(l,"CNAME"),n),o(m(l,"robots"),`Sitemap: ${x}/sitemap.txt`),o(m(l,"sitemap.txt"),r(s,x,t(s,i)).join("\n")),a&&o(m(l,".nojekyll"),"")});
@@ -1,4 +1,4 @@
1
1
  import type { JsMinifyOptions, Config as SwcConfig } from '@swc/core';
2
2
  export declare const swcMinifyOption: JsMinifyOptions;
3
- declare const _default: SwcConfig;
3
+ declare const _default: (ssr: boolean) => SwcConfig;
4
4
  export default _default;
package/lib/swcrc.mjs ADDED
@@ -0,0 +1 @@
1
+ import{merge as e}from"webpack-merge";import{CONFIG as o}from"./config.mjs";import r from"./paths.mjs";import t from"./polyfills.mjs";import{isDev as s,isReact as n,isSolid as a,jsxImportSource as i}from"./process-env.mjs";export const swcMinifyOption={compress:{top_retain:[],keep_infinity:!0,global_defs:{"@alert":"console.log"},pure_funcs:["console.log","console.warn","console.error","console.info"],toplevel:!1,drop_console:!0,drop_debugger:!0,module:!1,ecma:2015,ie8:!1,keep_classnames:void 0,keep_fnames:!1},mangle:!0};export default(l=>{let m=o.jsxDomExpressions;l&&(m.hydratable=!0,m.generate="ssr");let p={module:{type:"es6",resolveFully:!0},jsc:{parser:{syntax:"typescript",tsx:!0,decorators:!0,dynamicImport:!0},loose:!0,target:"es2017",externalHelpers:!1,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,refresh:n&&s,development:s,importSource:i},optimizer:{simplify:!1}},minify:s?void 0:swcMinifyOption,experimental:{emitAssertForImportAttributes:!0,cacheRoot:r.swcCachePath,plugins:[["swc-plugin-another-transform-imports",function(e){for(let o=0,r=Object.keys(e),t=r.length;o<t;o++)e[r[o]].transform=`${r[o]}/${e[r[o]].transform}`,e[r[o]].style&&(e[r[o]].style=`${r[o]}/${e[r[o]].style}`);return e}(o.importOnDemand||{})],a&&["@moneko/jsx-dom-expressions",m]].filter(Boolean)}},sourceMaps:!0,parseMap:!0};return o.polyfill&&(p.jsc.target=void 0,p.env={include:t(),mode:"entry",coreJs:"3.34"}),e(p,"function"==typeof o.swcrc?o.swcrc(s):o.swcrc||{})});
@@ -0,0 +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}
File without changes
@@ -1,3 +1,4 @@
1
+ import type { Compiler } from 'webpack';
1
2
  export declare function esm(templateStrings: TemplateStringsArray, ...substitutions: unknown[]): string;
2
3
  export declare function log(msg: string | string[]): void;
3
4
  export declare function tfc(filepath: string): string;
@@ -23,4 +24,5 @@ export declare const realResolve: (url: string) => string;
23
24
  export declare function isObject(target: unknown): target is object;
24
25
  export declare function isFunction(target: unknown): target is (...args: unknown[]) => unknown;
25
26
  export declare function empty(): void;
27
+ export declare const compilerListener: (name: string, compiler: Compiler) => Promise<unknown>;
26
28
  export {};
package/lib/utils.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import{resolve as o}from"path";import r from"readline";import{saveFileSync as t}from"@moneko/mdx";import{transformFileSync as e}from"@swc/core";import n from"./paths.mjs";import s from"./resolver-sync.mjs";export function esm(o,...r){let t=o.raw[0];for(let e=0;e<r.length;e++)t+=r[e]+o.raw[e+1];return`data:text/javascript;base64,${Buffer.from(t).toString("base64")}`}let c={inputSourceMap:!1,sourceMaps:!1,module:{type:"es6"},jsc:{parser:{syntax:"typescript"},loose:!1}};export function log(o){Array.isArray(o)?o.forEach(o=>{log(`${o}
2
+ `)}):(r.cursorTo(process.stdout,0),process.stdout.write(o))}export function tfc(o){return e(o,c).code||"{}"}export function readConf(o,r){let e=`${n.cachePath}/${r}.mjs`;return t(e,tfc(o)),import(e)}export function toUpperCaseString(o){return o?.replace(/\b\w/g,o=>o.toUpperCase()).replace(/\./g," ")}export function resolveProgramPath(r){return o(n.programPath,`./${r}`)}export const resolveNodeModulesPath=o=>`${n.nodeModules}/${o}`;export const realResolve=o=>s.resolveSync({},n.programPath,o)||o;export function isObject(o){let r=typeof o;return null!==o&&("object"==r||"function"==r)}export function isFunction(o){if(!isObject(o))return!1;let r=Object.prototype.toString.call(o);return"[object Function]"==r||"[object AsyncFunction]"==r||"[object GeneratorFunction]"==r||"[object Proxy]"==r}export function empty(){}export const compilerListener=(o,r)=>new Promise((t,e)=>{r.hooks.compile.tap(o,()=>{console.log(`Compiling ${o} please wait...`)}),r.hooks.failed.tap(o,o=>{e(o)}),r.hooks.done.tap(o,o=>{o.hasErrors()||t(!0),o.hasErrors()&&o.compilation.errors.forEach(o=>{e(o)}),o.hasWarnings()&&o.compilation.warnings.forEach(o=>{console.warn(o)})})});
@@ -0,0 +1 @@
1
+ import{fileExists as e,loadFileSync as r}from"@moneko/mdx";import{Parser as t}from"xml2js";import{PACKAGENAME as o}from"../process-env.mjs";export default function(c){let a={},i="export default {}";if(e(c))try{let e=r(c);(0,new t({explicitArray:!1,async:!1}).parseString)(e,(e,r)=>{e||(Object.assign(a,{[o]:r.coverage.project.metrics.$}),r.coverage.project.package.forEach(e=>{Object.assign(a,{[e.$.name]:e.metrics.$})})),i=`export default ${JSON.stringify(a)}`})}catch(e){}return i}
@@ -1,4 +1,4 @@
1
- import ReactiveObject from '../reactive-object.js';
1
+ import ReactiveObject from '../reactive-object.mjs';
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>>;
@@ -0,0 +1 @@
1
+ import{loadFileSync as e,scanFolder as t}from"@moneko/mdx";import o from"./generate-doc.mjs";import{CONFIG as r}from"../config.mjs";import{FRAMEWORK as n,isLibrary as a,isReact as m,isSolid as s}from"../process-env.mjs";import p from"../reactive-object.mjs";let l={react:"createElement",solid:"createComponent"}[n];export const docsModuleName="@app/docs";export const docs=new p({[docsModuleName]:"export default {}"});export const comment=new p({});export const getCommentPath=function(){let e=/^\/?(.+?)\.tsx?$/,t=r.alias["@pkg"].length;return o=>o.substring(t).replace(e,"@app/comment/$1.md")}();if(a){let a={},p=`import { ${l}${s?",Dynamic":""} } from "${{react:"react",solid:"solid-js"}[n]}${s?"/web":""}";import SuspenseComp from "@app/suspense";function call_then(res) {return {default: ${m?"() =>":""}${l}(${s?"Dynamic":"'n-md'"}, {text: res.default, ${s?"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("/");a[n]||(a[n]={}),t?a[n][r]&&delete a[n][r]:a[n][r]=`rr(() => ${l}(SuspenseComp, { comp: () => import(/* webpackChunkName: '${e}' */ '${e}?raw').then(call_then)}))rr`;let m={};for(let e in a)Object.prototype.hasOwnProperty.call(a,e)&&(m[e]=Object.values(a[e]));docs.setData(docsModuleName,`${p}export default ${JSON.stringify(m).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))})}
@@ -1,4 +1,4 @@
1
- import ReactiveObject from '../reactive-object.js';
1
+ import ReactiveObject from '../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 generatorDemo(): void;
@@ -0,0 +1 @@
1
+ import{generateExample as e}from"@moneko/mdx";import{watchFiles as o}from"./utils.mjs";import t from"../paths.mjs";import{isDev as r,isLibrary as m}from"../process-env.mjs";import p from"../reactive-object.mjs";export const exampleModuleName="@app/example";function a(){try{return JSON.parse(e(t.componentsPath,"@app/example/"))}catch(e){return{}}}export const examples=new p(m?a():{});export function generatorDemo(){let e=a();for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&examples.setData(o,e[o])}m&&r&&o(t.componentsPath,/(?<!\/examples\/(.+)\.md)$/,generatorDemo);
@@ -0,0 +1 @@
1
+ import{dirname as e}from"path";import t from"typescript";import{CONFIG as n}from"../config.mjs";let{ScriptKind:r,ScriptTarget:l,SyntaxKind:o,createSourceFile:i,forEachChild:a,getLeadingCommentRanges:c,isInterfaceDeclaration:u,isQuestionToken:s,isPropertySignature:f,isFunctionTypeNode:p,isUnionTypeNode:m,isMethodSignature:g}=t,$={};function h(e){let t=c(e.getSourceFile().text,e.pos);if(t){let n=e.getSourceFile().text.substring(t[0].pos,t[0].end).match(/\/\*\*([\s\S]*?)\*\//);if(n)return n[1].replace(/^\s*\* ?/gm,"").replace(/\s+$/,"").trim()}return null}function b(e){if(!e)return null;let t=e.match(/@since\s+([^\n]+)/);return t?t[1].trim():null}function d(e){if(!e)return null;let t=e.match(/@author (\w+)\s*(?:<([^>]+)>)?/);if(t?.length){let e=t[1].trim(),n=t[2]?.trim(),r=/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(n);return n?r&&(n=`mailto:${n}`):n=`https://github.com/${e}`,`[![${e}](https://avatars.githubusercontent.com/${e}?s=64)${e}](${n})`}return null}function y(e){if(!e)return null;let t=e.match(/@ignore\s+([^\n]+)/);return t?t[1].trim():null}let x=/(?<!['"])(unknown|any|void|bigint|object|undefined|null|boolean|number|string|symbol)(?!['"])/g;function j(e,t){if(!e)return null;let r=e.replace(/\b([A-Z][a-zA-Z0-9]*)\b/g,e=>{if($[e]){let r=`/${[n.basename,$[e]].join("/").split("/").filter(Boolean).join("/")}`;return t?`[\\color{#009688}{${e}}](${r})`:`[${e}](${r})`}return t?`\\color{#009688}{${e}}`:e});return t&&(r=r.replace(x,e=>`\\color{#009688}{${e}}`)),r}function T(e){return(function(e){let t;if(!e)return null;let n=[];for(;t=/\\color{([^|}]*)\|?([^|}]*)\|?([^|}]*)\|?([^}]*)}{([^}]*)}/g.exec(e);)n.push(t[0]);return e.replace(/[{}[\]()=>]|keyof|typeof|true|false/g,e=>n.some(t=>t.includes(e))?e:`\\color{#569cd6}{${e}}`)})(e)?.replace(/^\s*\|\s*|\s*\|\s*$/gm,"").replace(/\n/g,"<br/>").replace(/\*/g,"\\*").replace(/\|/g,"\\|").replace(/(['"])((?:(?!\1).)*)\1/g,"\\color{#ce9178}{$1$2$1}")}function B(e){return e?e.replace(/^@[a-z].+/gm,"").replace(/(\n\s+)+/g,"<br />").replace(/\n/g,"<br />").replace(/(<br \/>)$/g,""):null}export default function k(c,x){let k=i(x,c,l.Latest,!0,r.TS),w="";return a(k,r=>{u(r)?w+=function(r){let l=r.name.text;Object.assign($,{[r.name.text]:e(r.getSourceFile().fileName).replace(n.alias["@pkg"],"")});let i=h(r),a=b(i),c=B(i),u=y(i)?.split("|")||[],x=u.includes("comment"),k=u.includes("initial"),w=u.includes("optional"),E=u.includes("version"),S=u.includes("author"),v=c?`\\color{|4||0.45}{${l}}`:l,F=(function(e){let n=[];if(e.heritageClauses){for(let r of e.heritageClauses)if(r.token===t.SyntaxKind.ExtendsKeyword)for(let e of r.types)n.push(e.getText())}return n})(r)?.map(e=>`<n-tag color="#4c81db" css=".tag{gap:0px;}">${j(T(e))}</n-tag>`),z=[c,v,a&&`\\color{#52c11b|1||0.9}{${a}}`,F.length>0&&`<sub>\`extends\`</sub> ${F.join(" ")}`].filter(Boolean).join(" "),K=`## ${z}`,N=r.members.filter(e=>f(e)&&e.type?.kind!==o.NeverKeyword||g(e)),q=[];if(N.length){N.forEach(e=>{let t=j(T(g(e)?`(${e.parameters.map(e=>`${e.name.getText()}: ${e.type?.getText()||"any"}`).join(", ")}): ${e.type?.getText()||"any"}`:e.type?.getText()||"any"),!0),n=h(e),r=T(e.name.getText());!r||r.startsWith("\\color")||(g(e)||function(e){if(e.type){if(!m(e.type))return p(e.type);for(let t of e.type.types)if(p(t))return!0}return!1}(e)||t?.includes("=>")?r=`\\color{#f9a913}{${r}}`:/^["'](.+)["']$/.test(r)||(r=`\\color{#4c81db}{${r}}`));let l=e.questionToken&&s(e.questionToken);q.push([r,!w&&`\\color{${l?"#f9a913":"#52c11b"}\\|\\|\\|0.9}{${l?"✘":"✔"}}`,!x&&T(B(n)),t,!k&&T(function(e){if(!e)return null;let t=e.match(/@default\s+([^\n]+)/);return t?t[1].trim():null}(n)),!E&&T(b(n)),!S&&(d(n)||d(i))])});let e=!1,t=!1,n=!1,r=!1;q.forEach(l=>{!x&&l[2]&&(r=!0),!k&&l[4]&&(n=!0),!E&&l[5]&&(t=!0),!S&&l[6]&&(e=!0)}),K+="\n";let l=["属性",!w&&"必要",r&&"说明","类型",n&&"默认值",t&&"版本",e&&"作者"].filter(Boolean).join("|");K+=`|${l}|`;let o=[":-",!w&&":-",r&&":-",":-",n&&":-",t&&":-",e&&":-"].filter(Boolean);K+="\n";let a=o.join("|");K+=`|${a}|`,q.forEach(l=>{K+="\n";let o=[l[0]||"-",!w&&(l[1]||"-"),r&&(l[2]||"-"),l[3]||"-",n&&(l[4]||"-"),t&&(l[5]||"-"),e&&(l[6]||"-")].filter(Boolean).join("|");K+=`|${o}|`}),K+="\n"}return K+="\n"}(r):t.isEnumDeclaration(r)&&(w+=function(r){let l=r.name.text,o=h(r),i=B(o),a=b(o);Object.assign($,{[r.name.text]:e(r.getSourceFile().fileName).replace(n.alias["@pkg"],"")});let c=i?`\\color{|4||0.45}{${l}}`:l,u=[i,c,a&&`\\color{#52c11b|1||0.9}{${a}}`].filter(Boolean).join(" "),s=y(o)?.split("|")||[],f=s.includes("comment"),p=s.includes("version"),m=s.includes("author"),g=`## ${u}`;if(r.members.length){let e=[];r.members.forEach(n=>{let r=T(n.name.getText()),l=h(n),i=T(function(e){let n=e.initializer;return n&&t.isStringLiteral(n)?` '${n.text}'`:null}(n)),a=T(b(l)),c=T(B(l));!r||r.startsWith("\\color")||/^["'](.+)["']$/.test(r)||(r=`\\color{#4c81db}{${r}}`),e.push([r,!f&&c,i,!p&&a,!m&&(d(l)||d(o))])});let n=!1,l=!1,i=!1;e.forEach(e=>{!f&&e[1]&&(i=!0),!p&&e[3]&&(l=!0),!m&&e[4]&&(n=!0)}),g+="\n";let a=["属性",i&&"说明","值",l&&"版本",n&&"作者"].filter(Boolean).join("|");g+=`|${a}|`;let c=[":-",i&&":-",":-",l&&":-",n&&":-"].filter(Boolean);g+="\n";let u=c.join("|");g+=`|${u}|`,e.forEach(e=>{g+="\n";let t=[e[0]||"-",i&&(e[1]||"-"),e[2]||"-",l&&(e[3]||"-"),n&&(e[4]||"-")].filter(Boolean).join("|");g+=`|${t}|`})}return g+="\n\n"}(r))}),w}
@@ -1,4 +1,4 @@
1
- import ReactiveObject from '../reactive-object.js';
1
+ import ReactiveObject from '../reactive-object.mjs';
2
2
  export declare const localesModuleName = "@app/locales";
3
3
  export declare const locales: ReactiveObject<{
4
4
  "@app/locales": string;
@@ -0,0 +1,2 @@
1
+ import{basename as e,join as t}from"path";import{directoryExists as o,scanFolder as a}from"@moneko/mdx";import{watch as l}from"chokidar";import{CONFIG as r}from"../config.mjs";import{FRAMEWORK as n,isDev as s}from"../process-env.mjs";import c from"../reactive-object.mjs";import{esm as i,tfc as g}from"../utils.mjs";let u={react:'import sso from "shared-store-object";',solid:'import { createEffect, createRoot, getOwner } from "solid-js";import { createStore } from "solid-js/store";'},f={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;'}[n];function p(e,t){return`${u[n]}
2
+ export function interpolateString(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);${f}`}export const localesModuleName="@app/locales";export const locales=new c({[localesModuleName]:p([],{})});let d={};async function m(t,o){let a=e(t).replace(/\.[^.]+$/,"");"deleted"===o?delete d[a]:Object.assign(d,{[a]:(await import(i`${g(t)}`)).default});let l=[],r={};for(let e in d)if(Object.prototype.hasOwnProperty.call(d,e)){let{language:t=a,title:o=t,icon:n,translation:s={}}=d[e];l.push({language:t,title:o,icon:n}),r[t]={language:t,title:o,icon:n,translation:s}}locales.setData(localesModuleName,p(l,r))}let z=t(r.alias["@"],"./locales");o(z)&&(a(z).filter(e=>!/^\..*/.test(e)&&!/!\.ts$/.test(e)&&!/\.d\.ts$/.test(e)).forEach(e=>{m(e,"added")}),s&&function(e,t){let o=l(e,{ignored:t,persistent:!0,ignoreInitial:!0});function a(){o.unwatch(e),o.close()}o.on("add",e=>{m(e,"added")}),o.on("change",e=>{m(e,"change")}),o.on("unlink",e=>{m(e,"deleted")}),o.once("ready",()=>{s||a()}),process.on("SIGINT",a)}(z,[/^\..*/,/!\.ts$/,/\.d\.ts$/]));
@@ -1,4 +1,4 @@
1
- import ReactiveObject from '../reactive-object.js';
1
+ import ReactiveObject from '../reactive-object.mjs';
2
2
  export declare const routesModuleName = "@app/routes";
3
3
  export declare const route: ReactiveObject<{
4
4
  "@app/routes": string;
@@ -0,0 +1 @@
1
+ import{generateRouter as o}from"@moneko/mdx";import{watchFiles as e}from"./utils.mjs";import{CONFIG as t}from"../config.mjs";import{FRAMEWORK as r,isDev as m,isLibrary as s,routeDir as u}from"../process-env.mjs";import n from"../reactive-object.mjs";let i=s?"@pkg":"@/pages";export const routesModuleName="@app/routes";function p(){return o(u,`${t.alias["@"]}/router/index.ts`,r,i,s)}export const route=new n({[routesModuleName]:p()});export function generatorRouter(){route.setData(routesModuleName,p())}m&&e(u,s?/(?<!README\.mdx?)$/:/(?<!index\.tsx?)$/,generatorRouter);
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.9.17-beta.3",
3
+ "version": "3.9.17-beta.5",
4
4
  "description": "core",
5
- "main": "lib/index.js",
5
+ "main": "lib/index.mjs",
6
6
  "type": "module",
7
7
  "scripts": {
8
8
  "build": "rm -rf ./lib && tsc && swc src -d lib -D",
9
- "postbuild": "npm run cjs",
10
- "cjs": "find ./lib/loader/ -type f -name \"*.js\" -execdir bash -c 'mv \"$1\" \"${1%.js}.cjs\"' _ {} \\;"
9
+ "postbuild": "npm run cjs && npm run mjs",
10
+ "cjs": "find ./lib/loader/ -type f -name \"*.js\" -execdir bash -c 'mv \"$1\" \"${1%.js}.cjs\"' _ {} \\;",
11
+ "mjs": "find ./lib/ -type f -name \"*.js\" -execdir bash -c 'mv \"$1\" \"${1%.js}.mjs\"' _ {} \\;"
11
12
  },
12
13
  "keywords": [],
13
14
  "author": "moneko",
14
15
  "license": "MIT",
15
16
  "dependencies": {
16
- "@loadable/webpack-plugin": "5.15.2",
17
17
  "@moneko/mdx": "0.1.23",
18
18
  "@swc/core": "1.3.101",
19
19
  "add-asset-html-webpack-plugin": "6.0.0",
@@ -22,24 +22,21 @@
22
22
  "cors": "2.8.5",
23
23
  "cross-env": "7.0.3",
24
24
  "css-loader": "6.8.1",
25
+ "express": "4.18.2",
25
26
  "html-webpack-plugin": "5.5.4",
26
27
  "less": "4.2.0",
27
28
  "less-loader": "11.1.3",
28
29
  "lightningcss": "1.22.1",
29
30
  "mini-css-extract-plugin": "2.7.6",
30
- "sass": "1.69.5",
31
- "sass-loader": "13.3.2",
32
31
  "style-loader": "3.3.3",
33
- "style-resources-loader": "1.5.0",
34
32
  "swc-loader": "0.2.3",
35
33
  "swc-plugin-another-transform-imports": "0.2.7",
36
- "ts-import-plugin": "3.0.0",
37
- "ts-loader": "9.5.1",
38
34
  "typescript": "5.3.3",
39
35
  "webpack": "5.77.0",
40
36
  "webpack-bundle-analyzer": "4.10.1",
41
- "webpack-cli": "5.1.4",
42
- "webpack-dev-server": "4.15.1",
37
+ "webpack-dev-middleware": "6.1.1",
38
+ "webpack-hot-middleware": "2.25.4",
39
+ "webpack-merge": "5.10.0",
43
40
  "webpack-node-externals": "3.0.0",
44
41
  "webpack-virtual-modules": "0.6.1",
45
42
  "webpackbar": "6.0.0",
@@ -47,8 +44,12 @@
47
44
  },
48
45
  "devDependencies": {
49
46
  "@swc/cli": "0.1.63",
50
- "eslint-config-neko": "2.3.0",
51
- "stylelint-config-moneko": "1.2.1"
47
+ "@types/cors": "^2.8.17",
48
+ "@types/express": "^4.17.21",
49
+ "eslint-webpack-plugin": "4.0.1",
50
+ "sass": "1.69.5",
51
+ "sass-loader": "13.3.2",
52
+ "stylelint-webpack-plugin": "4.1.1"
52
53
  },
53
54
  "files": [
54
55
  "lib",
@@ -8,7 +8,6 @@ import type { Config as SwcConfig, JsMinifyOptions as SwcMinifyOptions } from '@
8
8
  import type { Options as AssetHtmlOptions } from 'add-asset-html-webpack-plugin';
9
9
  import type { Options as HtmlWebpackPluginOptions } from 'html-webpack-plugin';
10
10
  import type { MinifyOptions as TerserMinifyOptions } from 'terser';
11
- import type { Options } from 'ts-import-plugin';
12
11
  import type {
13
12
  Configuration,
14
13
  ExternalsPresets,
@@ -77,7 +76,7 @@ export interface Theme {
77
76
  errorColor?: string;
78
77
  warningColor?: string;
79
78
  }
80
- export declare type ConfigType<T extends 'tsc' | 'swc' = 'swc'> = {
79
+ export declare type ConfigType = {
81
80
  /** 启用 polyfill; 当设置为 `true` 时, 则根据 `browserslist` 设置自动polyfill
82
81
  * @default false
83
82
  */
@@ -86,10 +85,6 @@ export declare type ConfigType<T extends 'tsc' | 'swc' = 'swc'> = {
86
85
  * @default 'csr'
87
86
  */
88
87
  mode: 'ssr' | 'csr';
89
- /** 编译器
90
- * @default 'swc'
91
- */
92
- compiler: 'tsc' | 'swc';
93
88
  /** swc 配置项,仅当编译器为 swc 时有效 */
94
89
  swcrc?: SwcConfig | ((isDev: boolean) => SwcConfig);
95
90
  /**
@@ -158,7 +153,6 @@ export declare type ConfigType<T extends 'tsc' | 'swc' = 'swc'> = {
158
153
  * @example
159
154
  * ```js
160
155
  * const conf: Partial<ConfigType> = {
161
- * compiler: 'tsc',
162
156
  * prefixJsLoader: [
163
157
  * {
164
158
  * loader: 'babel-loader',
@@ -174,7 +168,7 @@ export declare type ConfigType<T extends 'tsc' | 'swc' = 'swc'> = {
174
168
  /** node_modules中, 需要开启 cssModules 的模块 */
175
169
  cssModules: string[];
176
170
  /** 按需引入 */
177
- importOnDemand: T extends 'tsc' ? Partial<Options>[] : SwcImportOnDemandTransform;
171
+ importOnDemand: SwcImportOnDemandTransform;
178
172
  /** 开发服务器代理 */
179
173
  proxy: ProxyArray | ProxyConfigArray | ProxyConfigMap;
180
174
  /** 自定义缓存目录,为 false 时,不使用缓存 */
package/lib/common.js DELETED
@@ -1 +0,0 @@
1
- import{CONFIG as e,PUBLICPATH as t}from"./config.js";import o from"./module.config.js";import s,{CUSTOMCONFIG as r}from"./paths.js";import n from"./plugin/override-resolve.js";import l from"./plugins.config.js";import{PACKAGENAME as i,PACKAGEVERSION as a,isDev as p,isLibrary as c}from"./process-env.js";import{resolveNodeModulesPath as u,resolveProgramPath as m}from"./utils.js";export const outputConfig={path:m(c?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${p?"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:i,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${i}`,pathinfo:p,clean:!0,publicPath:t,asyncChunks:!0,charset:!0};let f={main:u("@app/entry")};e.polyfill&&Object.assign(f,{"dom-polyfills":[`${s.corePath}/polyfills/replace-children.js`]}),e.entry&&("string"==typeof e.entry?f={main:e.entry}:Object.keys(e.entry)&&Object.assign(f,e.entry)),e.output&&("string"==typeof e.output?outputConfig.path=e.output:Object.keys(e.output)&&Object.assign(outputConfig,e.output));let y=!1;e.cacheDirectory&&(y=p?{type:"memory"}:{type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:e.cacheDirectory,memoryCacheUnaffected:!0,name:[r,process.env.NODE_ENV].filter(Boolean).join("-"),version:a});let d=Object.assign({original:e.alias["@"],override:r&&m(r)},e.overrideResolve);export const commonConfig={entry:f,stats:"errors-only",cache:y,infrastructureLogging:{level:"error"},target:"web",externalsPresets:e.externalsPresets,plugins:l,node:{global:!1},experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:p&&{imports:!1,entries:!1},buildHttp:e.buildHttp,backCompat:!0,futureDefaults:!1,css:!1,outputModule:!1},resolve:{extensions:["...",".jsx",".ts",".tsx"],alias:e.alias,modules:[s.nodeModules],mainFields:["browser","module","main"],mainFiles:["index"],plugins:[e.overrideResolve&&new n(d),...e.resolvePlugins].filter(Boolean),fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:o,externals:e.externals,output:outputConfig};
package/lib/config.js DELETED
@@ -1 +0,0 @@
1
- import{fileExists as e}from"@moneko/mdx";import{merge as t}from"webpack-merge";import o,{CUSTOMCONFIG as s}from"./paths.js";import{FRAMEWORK as i,PACKAGENAME as n,SSR as r,coreName as a,isDev as l,isLibrary as m,isMobile as p,isSolid as c,jsxImportSource as u,mainDirectory as d}from"./process-env.js";import{isFunction as h,log as f,readConf as g,resolveProgramPath as x}from"./utils.js";let C=["@moneko","neko-ui","antd","@antv","katex","font-pingfang-sc","font-pingfang-tc","react-photo-view","react-markdown-editor-lite","schema-design","@app",".cache/http/data"],k={seo:!1,mode:"csr",compiler:"swc",bundleAnalyzer:!1,polyfill:!1,entry:{},minifier:{},sourceMap:{filename:"[file].map",publicPath:""},env:{NODE_ENV:process.env.NODE_ENV},basename:"/",publicPath:"/",rem:{designSize:p?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":x(d)},moduleRules:[],prefixJsLoader:[],cssModules:[],importOnDemand:{},proxy:[],cacheDirectory:o.webpackCachePath,devServer:{allowedHosts:[".baidu.com"],host:"localhost",port:3e3,https:!1,compress:!1},htmlPluginOption:{template:`node_modules/${a}/template/index.html`,favicon:`node_modules/${a}/template/favicon.ico`,tags:[]},assetHtml:[],routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:{chunks:"all",minSize:1024,minChunks:1,cacheGroups:{CHANGELOG:{test:/CHANGELOG\.md/,priority:-10,name:"CHANGELOG",reuseExistingChunk:!0},prismjs:{test:/(prism\.js|prism\/css\.ts)/,priority:-10,name:"vendors-prismjs",reuseExistingChunk:!0},site:{test:/site/,priority:-10,reuseExistingChunk:!0},marked:{test:/marked/,priority:-10,reuseExistingChunk:!0},"n-katex":{test:/n-katex/,priority:-10,reuseExistingChunk:!0},"n-code-live":{test:/n-code-live/,priority:-10,reuseExistingChunk:!0},"@moneko":{test:/@moneko/,priority:-10,reuseExistingChunk:!0}}},runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:C,js:C,media:C,font:C,wasm:[]},mdx:{jsx:!1,development:l,jsxImportSource:u,providerImportSource:`@moneko/${i}/mdx`},jsxDomExpressions:{},bar:{name:"Client",color:"#6f42c1"},normalizeCss:!0,externalsPresets:{},buildHttp:{allowedUris:[],lockfileLocation:`${o.httpCachePath}/http.lock`,cacheLocation:`${o.httpCachePath}/data`,upgrade:!0}};c&&(k.jsxDomExpressions={moduleName:"solid-js/web",builtIns:["For","Show","Switch","Match","Suspense","SuspenseList","Portal","Index","Dynamic","ErrorBoundary"],contextToCustomElements:!0,wrapConditionals:!0,generate:r?"ssr":"dom",hydratable:!!r}),m&&(k.alias=Object.assign(k.alias,{"@pkg":o.componentsPath,[n]:o.componentsPath}));let P=k,v={},w={};if(e(o.configPath)){let e=(await g(o.configPath,"index")).default;v=h(e)?e(process):e}if(s&&e(o.customConfigPath)){let e=(await g(o.customConfigPath,s)).default;w=h(e)?e(process):e}"tsc"===(P=t(P,v,w)).compiler&&P.minifier&&void 0===P.minifier.type&&(P.minifier.type="terser"),(!1===P.devtool||!1===P.sourceMap)&&(P.sourceMap=!1,P.devtool=!1),P.fixBrowserRouter&&P.htmlPluginOption&&(P.htmlPluginOption.tags||(P.htmlPluginOption.tags=[]),P.htmlPluginOption.tags.push({textContent:"(function(l) {if (l.search[1] === '/' ) {var decoded = l.search.slice(1).split('&').map(function(s) {return s.replace(/~and~/g, '&')}).join('?');window.history.replaceState(null, null,l.pathname.slice(0, -1) + decoded + l.hash);}}(window.location))"}));export const CONFIG=P;export const PUBLICPATH=CONFIG.publicPath||"/";global.NEKOCLICONFIG={CONFIG,CUSTOMCONFIG:s,log:f};
package/lib/dev.js DELETED
@@ -1,3 +0,0 @@
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{commonConfig 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()});
package/lib/has-pkg.js DELETED
@@ -1 +0,0 @@
1
- import{fileExists as o}from"@moneko/mdx";import{resolveNodeModulesPath as r}from"./utils.js";export function hasPkg(m){return o(r(`${m}/package.json`))}
@@ -1 +0,0 @@
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 m}from"./process-env.js";import{resolveProgramPath as a}from"./utils.js";let{template:n,favicon:p,...l}=Object.assign({template:`node_modules/${m}/template/index.html`,favicon:`node_modules/${m}/template/favicon.ico`},t.htmlPluginOption||{}),s=e({title:t.env?.PROJECTNAME||r.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:{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:a(n),favicon:a(p),excludeChunks:["ssr"]},l);export default s;
package/lib/index.d.ts DELETED
@@ -1,8 +0,0 @@
1
- export { default as paths, CUSTOMCONFIG } from './paths.js';
2
- export { PACKAGENAME, PACKAGEVERSION, coreName, isDev, isLibrary, isMicro, mainDirectory, } from './process-env.js';
3
- export { realResolve, resolveNodeModulesPath, resolveProgramPath, log } from './utils.js';
4
- export { getIPv4, getPort } from './net.js';
5
- export { default as osTmpDir } from './os-tmp-dir.js';
6
- export type { MdxOptions } from '@moneko/mdx';
7
- export type { OverrideResolverOption } from './plugin/override-resolve.js';
8
- export type * from '../typings/global.d.ts';
package/lib/index.js DELETED
@@ -1 +0,0 @@
1
- export{default as paths,CUSTOMCONFIG}from"./paths.js";export{PACKAGENAME,PACKAGEVERSION,coreName,isDev,isLibrary,isMicro,mainDirectory}from"./process-env.js";export{realResolve,resolveNodeModulesPath,resolveProgramPath,log}from"./utils.js";export{getIPv4,getPort}from"./net.js";export{default as osTmpDir}from"./os-tmp-dir.js";
package/lib/info.js DELETED
@@ -1 +0,0 @@
1
- import{loadFileSync as e}from"@moneko/mdx";import{CONFIG as r}from"./config.js";import{APPTYPE as o,PACKAGENAME as t,PACKAGEVERSION as s}from"./process-env.js";import{resolveProgramPath as p,toUpperCaseString as i}from"./utils.js";let{description:m,author:n,repository:a,keywords:c}=JSON.parse(e(p("package.json"))||"{}"),d="string"==typeof n,f={name:t,projectName:i(t).replace(/-/g," "),version:s,base:r.basename,type:o,routerMode:r.routerMode,prefixCls:r.prefixCls,theme:r.theme,description:m,author:d?{name:n}:n,repository:d?{url:a}:a};export const description=m;export const keywords=Array.isArray(c)?c.toString():"";export default f;
package/lib/minify.js DELETED
@@ -1 +0,0 @@
1
- import e from"terser-webpack-plugin";import{merge as o}from"webpack-merge";import{swcMinifyOption as r}from"./swcrc.js";export const minify={terser:{minify:e.terserMinify,terserOptions:{ecma:2015,parse:{},compress:{global_defs:{"@alert":"console.log"},drop_console:!0,drop_debugger:!0,pure_funcs:["console.log","console.warn","console.error","console.info"]},toplevel:!1,mangle:!0,module:!1,format:{comments:!1},ie8:!1,keep_classnames:void 0,keep_fnames:!1,safari10:!1},extractComments:!1},swc:{minify:e.swcMinify,terserOptions:r}};export const getMinifyOption=(e,r={})=>{let s=minify[e];return Object.assign(s,{terserOptions:o(s.terserOptions,r)})};
@@ -1 +0,0 @@
1
- import{CONFIG as i}from"./config.js";import o from"./html-plugin-option.js";let f=i.prefixCls||"n",n={"@prefix-cls":f,"@ant-prefix":f,"@iconfont-css-prefix":`${f}-icon`,"@favicon":JSON.stringify(o.favicon)};Object.assign(n,i.modifyVars);export default n;
@@ -1 +0,0 @@
1
- import e from"webpack";import{CONFIG as r}from"./config.js";import t from"./plugin/external-remotes.js";import{realResolve as o}from"./utils.js";let{NormalModuleReplacementPlugin:s,container:{ModuleFederationPlugin:a}}=e,i={},l={},n={},m=r.moduleFederation?.map(e=>{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,s=t.filename||"remote_entry.js";if(n[o]=`${t.name}@${t.host}/${s}`,Array.isArray(t.library))for(let e=0,r=t.library.length;e<r;e++)i[t.library[e]]=`${o}/${t.library[e]}`}if(Array.isArray(e.exposes))for(let r=0,t=e.exposes.length;r<t;r++){let t=e.exposes[r];"string"==typeof t?l[`./${t}`]=o(t):"[object Object]"===Object.prototype.toString.call(t)&&(l[`./${t.name}`]=o(t.path))}return new a({filename:"remote_entry.js",...e,remotes:n,exposes:l})});m.length&&(m.push(new t),m.push(new s(/(.*)/,e=>{i[e.request]&&(e.request=i[e.request])})));export default m;
@@ -1,3 +0,0 @@
1
- import type { ModuleOptions } from 'webpack';
2
- declare const moduleOptions: ModuleOptions;
3
- export default moduleOptions;
@@ -1 +0,0 @@
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,SSR as i,isDev as n,isLibrary as d,isMicro as m}from"./process-env.js";import c from"./svg-to-data-uri.js";import p from"./swcrc.js";import{getLightningCssTargets as u}from"./targets.js";import f from"./tsloader.config.js";import{resolveNodeModulesPath as y,resolveProgramPath as g}from"./utils.js";import{comment as j,getCommentPath as x}from"./vm/docs.js";import v from"./vm/generate-doc.js";let $=m?t:"../",h={loader:e.loader,options:{publicPath:"/"!==$?$:"../"}},b={loader:`${r.corePath}/loader/lightningcss.cjs`,options:{sourceMap:!!s.sourceMap,analyzeDependencies:!1,targets:u(),drafts:{nesting:!0,customMedia:!0},errorRecovery:!1,unusedSymbols:[],rem:!!s.rem}};n&&(h="style-loader");let w=[...s.cssModules,`@moneko/${l}`,"neko-ui"].map(y),_=["components","example","mock","site","src","server"].map(g);a&&_.push(g(a)),s.overrideResolve&&s.overrideResolve.override&&_.push(s.overrideResolve.override);let M={loader:"css-loader",options:{modules:{auto:e=>{for(let s=0,t=w.length;s<t;s++)if(e&&e?.includes(w[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",exportOnlyLocals:i},importLoaders:2}},k=[h,M,b,{loader:"less-loader",options:{sourceMap:!!s.sourceMap,lessOptions:{modifyVars:o,javascriptEnabled:!0}}},{loader:"style-resources-loader",options:{patterns:["src/styles/variables.less","src/styles/mixins.less","site/styles/variables.less","site/styles/mixins.less"].map(g)}}].filter(Boolean),B="tsc"===s.compiler;function L(e){return _.concat(s.rulesInclude?.[e]?.map(y)||[])}let O=L("css"),P=L("js"),R=L("media"),I=L("wasm"),J=L("font"),Q={noParse:[/jquery|lodash|prismjs|prism\.js/,/react\.min\.js$/,/marked\.min\.js$/],rules:[d&&n&&{test:/^(?![._]).*(?<!\.test)\.(tsx?)$/,include:s.alias["@pkg"],exclude:[/node_modules/,/(.+)\/__tests__\/(.+)/i],enforce:"pre",loader:`${r.corePath}/loader/ts-doc.cjs`,options:{comment:j,generateDoc:v,getCommentPath:x}},{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:I},{test:/\.txt$/i,type:"asset/source"},{test:/\.ico$/i,type:"asset/inline",include:R},{test:/\.svg$/i,type:"asset/inline",generator:{dataUrl:e=>c(e.toString())},include:R},{test:/\.(gif|png|jpe?g|webp)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/images/[name][ext]"},include:R},{test:/\.(webm|mp4|ogv)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[name][ext]"},include:R},{test:/\.(woff2?|eot|ttf|otf)(\?.*)?$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[name][ext]"},include:J},{test:/\.(sa|sc)ss$/i,use:[h,M,b,{loader:"sass-loader",options:{implementation:await import("sass"),sassOptions:{}}}].filter(Boolean),include:O},{test:/\.less$/i,use:k,include:O},{test:/\.css$/i,use:[h,"css-loader",b].filter(Boolean),include:O},{test:/\.(cj|mj|t|j)s(|x)$/i,use:[...s.prefixJsLoader,{loader:B?"ts-loader":"swc-loader",options:B?f:p}].filter(Boolean),include:P},{test:/\.mdx?$/i,use:[...s.prefixJsLoader,{loader:`${r.corePath}/loader/mdx.cjs`,options:s.mdx}].filter(Boolean),exclude:[/node_modules/]},{type:"asset/source",include:[/(.+)\/examples\/(.+).*?$/i]}]},...s.moduleRules].filter(e=>"object"==typeof e)};export default Q;
package/lib/net.js DELETED
@@ -1 +0,0 @@
1
- import{createConnection as e}from"net";import r from"webpack-dev-server";let{internalIPSync:t}=r;export function getIPv4(){return t("v4")}export function getPort(r,t,o="0.0.0.0"){return new Promise(n=>{if("number"!=typeof r)n(r);else{let f=e(r,o);f.on("connect",()=>{f.destroy(),n(getPort(r+1,t,o))}),f.on("error",()=>{n(r)})}})}
@@ -1 +0,0 @@
1
- import{relative as e}from"path";import{fileExists as t}from"@moneko/mdx";import r from"../paths.js";let a="OverrideResolverPlugin";export default class{constructor(e){this.options=e}apply(i){let{override:o,original:s}=this.options;if(o&&s){let l=`./${e(r.programPath,s)}`,p=`./${e(r.programPath,o)}`;i.getHook("existing-file").tapAsync(a,(e,r,n)=>{let h=e.request||e.path;if(h&&h.startsWith(s)&&e.relativePath){let m=h.replace(s,o);if(t(m)){let t=e.relativePath.replace(l,p);return Object.assign(e,{path:m,relativePath:t,__innerRequest_relativePath:t,__innerRequest:t}),i.doResolve("resolved",e,`${a} 使用目标模块${o}`,r,n)}}return n()})}}}
@@ -1 +0,0 @@
1
- import{join as o}from"path";import{getAppEntry as t,getAppFallback as e,getAppMdxScope as p,getAppMergeRouter as r,getAppNormalizeCss as a,getAppPrefixRouter as s,getAppRem as i,getAppSuspense as m}from"@moneko/mdx";import n from"webpack-virtual-modules";import{CONFIG as f}from"../config.js";import l from"../info.js";import c from"../paths.js";import{APPTYPE as h,FRAMEWORK as d,isLibrary as g}from"../process-env.js";import{resolveNodeModulesPath as u,resolveProgramPath as x}from"../utils.js";import j from"../vm/coverage.js";import{comment as v,docs as y,docsModuleName as k}from"../vm/docs.js";import{exampleModuleName as b,examples as w}from"../vm/example.js";import{locales as O,localesModuleName as P}from"../vm/locales.js";import{route as z,routesModuleName as D}from"../vm/routes.js";export default class{constructor(o){this.options=o,this.hasTapped=!1}apply(S){let T=new n({[u("@app/info")]:`export default ${JSON.stringify(l)}`,[u("@app/entry")]:t(o(f.alias["@"],"./index.ts"),!!f.rem,!!f.normalizeCss,h,d),[u("@app/rem")]:i(f.rem?.designSize||1680),[u("@app/fallback")]:e(f.fallbackCompPath),[u("@app/coverage")]:j(c.coveragePath),[u("@app/merge-router")]:r(),[u("@app/prefix-router")]:s(),[u("@app/normalize/index.css")]:a(),[u("@app/suspense/index.tsx")]:m(h,d),[u("@app/mdx-scope")]:p(x("site/mdx-scope.ts")),[u(D)]:z.getData(D),[u(b)]:"export default []",[u(P)]:O.getData(P),[u(k)]:y.getData(k)});function C(o,t){let e=u(o);T.writeModule(e,t||"")}T.apply(S),z.on("change",C),O.on("change",C),g&&(w.on("change",C),y.on("change",C),v.on("change",C)),S.hooks.compilation.tap("VirtualModuleWebpackPlugin",()=>{if(!this.hasTapped){for(let o in this.hasTapped=!0,this.options)if(Object.prototype.hasOwnProperty.call(this.options,o)){let t=this.options[o];C(o,"string"==typeof t?t:`export default ${JSON.stringify(t)}`)}for(let o of w)C(...o);for(let o of y)C(...o);for(let o of v)C(...o)}})}}
@@ -1 +0,0 @@
1
- import e from"add-asset-html-webpack-plugin";import t from"html-webpack-plugin";import l from"webpack";import{CONFIG as o}from"./config.js";import i from"./html-plugin-option.js";import r from"./module-federation.js";import n from"./plugin/add-entry-attribute.js";import p from"./plugin/virtual-module.js";import{isMicro as a}from"./process-env.js";let{AutomaticPrefetchPlugin:s,DefinePlugin:m,SourceMapDevToolPlugin:c,IgnorePlugin:h}=l,u=o.basename.split("/").filter(Boolean).length,f=`${Array(u).fill("..").join("/")+(u?"/":"")}404.html`,{pathSegmentsToKeep:d=u,path:w=f}=o.fixBrowserRouter||{},g=o.assetHtml.map(e=>({publicPath:"",...e})),j=[...r,new p(o.virtualModule),new s,o.htmlPluginOption&&new t(i),o.fixBrowserRouter&&new t({filename:w,inject:!1,templateContent:()=>`<html lang="en"><head><title>${i.title}</title><script>const pathKeep = ${d||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 e(g),a&&new n({test:/main\.bundle\.js$/}),new m({"process.env":JSON.stringify(o.env)}),new h({resourceRegExp:/\/__tests__\//}),o.sourceMap&&new c(o.sourceMap),...o.plugins].filter(e=>!!e);export default j;
package/lib/polyfills.js DELETED
@@ -1 +0,0 @@
1
- import t from"core-js-compat";import{getBrowsersTargets as r}from"./targets.js";export default function(){return t({targets:r(),version:"3.34"}).list}
@@ -1 +0,0 @@
1
- import o from"./paths.js";export const APPTYPE=process.env.APPTYPE;export const FRAMEWORK=process.env.FRAMEWORK;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=!!process.env.SSR;export const mainDirectory=isLibrary?"site":"src";export const jsxImportSource={react:"react",solid:"solid-js/h"}[FRAMEWORK];export const PACKAGENAME=process.env.npm_package_name;export const PACKAGEVERSION=process.env.npm_package_version;export const coreName="@moneko/core";export const isDev="development"===process.env.NODE_ENV;export const routeDir=isLibrary?o.componentsPath:o.pagesPath;
package/lib/prod.js DELETED
@@ -1 +0,0 @@
1
- import{removeDirAll as e}from"@moneko/mdx";import o from"mini-css-extract-plugin";import m from"terser-webpack-plugin";import n from"webpack";import{BundleAnalyzerPlugin as i}from"webpack-bundle-analyzer";import{merge as r}from"webpack-merge";import t from"webpackbar";import{commonConfig as p}from"./common.js";import{CONFIG as s}from"./config.js";import{getMinifyOption as l}from"./minify.js";import u from"./paths.js";import a from"./plugin/done.js";import c from"./plugin/lightningcss-plugin.js";import f from"./seo.js";let{optimize:{MinChunkSizePlugin:d,ModuleConcatenationPlugin:h}}=n,k=[];s.minifier&&(k.push(new m(l(s.minifier?.type||"swc",s.minifier?.options))),k.push(new c));let w={splitChunks:s.splitChunk,runtimeChunk:s.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,mangleWasmImports:!0,minimize:!0,minimizer:k};n(r(p,{devtool:!1===s.devtool||s.devtool?s.devtool:"cheap-module-source-map",mode:"production",optimization:w,plugins:[new h,new o({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),s.splitChunk&&new d({minChunkSize:1e4}),s.bundleAnalyzer&&new i(s.bundleAnalyzer),s.bar&&new t(s.bar),new a({done:e=>{s.done?.(e),s.seo&&f()}})].filter(Boolean)})).run(e=>{if(e)throw e}),process.on("exit",function(){e(u.cachePath)});
package/lib/seo.js DELETED
@@ -1 +0,0 @@
1
- import{join as o}from"path";import{saveFileSync as t,scanRouter as m,sitemap as r}from"@moneko/mdx";import{outputConfig as e}from"./common.js";import{CONFIG as p}from"./config.js";import{isLibrary as i,routeDir as s}from"./process-env.js";import{resolveProgramPath as f}from"./utils.js";export default(()=>{let{domain:n,nojekyll:a,path:j}=p.seo||{},l=j&&f(j)||e?.path;if(!n||!l)return;let x=`https://${n}${p.basename}`;t(o(l,"CNAME"),n),t(o(l,"robots"),`Sitemap: ${x}/sitemap.txt`),t(o(l,"sitemap.txt"),r(s,x,m(s,i)).join("\n")),a&&t(o(l,".nojekyll"),"")});
package/lib/server.js DELETED
@@ -1 +0,0 @@
1
- import{join as e}from"path";import o from"@loadable/webpack-plugin";import r from"mini-css-extract-plugin";import m from"webpack";import{merge as t}from"webpack-merge";import n from"webpack-node-externals";import a from"webpackbar";import{commonConfig as i}from"./common.js";import{CONFIG as s}from"./config.js";import p from"./paths.js";i.entry={},m(t(i,{entry:{ssr:e(p.programPath,"./site/ssr.tsx")},output:{path:e(p.programPath,"./ssr"),library:{type:"commonjs2"},filename:"[name].js",chunkFilename:"[name].js",globalObject:void 0,chunkLoadingGlobal:void 0},devtool:!1,mode:"production",plugins:[new o,new r({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),new a({name:"Server"})].filter(Boolean),externals:[...n()].concat(s.externals||[]),target:"node"})).run((e,o)=>{if(e)throw e;o?.compilation.errors&&console.error(...o.compilation.errors)});
package/lib/swcrc.js DELETED
@@ -1 +0,0 @@
1
- import{merge as e}from"webpack-merge";import{CONFIG as o}from"./config.js";import r from"./paths.js";import s from"./polyfills.js";import{isDev as t,isReact as n,isSolid as i,jsxImportSource as p}from"./process-env.js";export const swcMinifyOption={compress:{top_retain:[],keep_infinity:!0,global_defs:{"@alert":"console.log"},pure_funcs:["console.log","console.warn","console.error","console.info"],toplevel:!1,drop_console:!0,drop_debugger:!0,module:!1,ecma:2015,ie8:!1,keep_classnames:void 0,keep_fnames:!1},mangle:!0};let c={module:{type:"es6",resolveFully:!0},jsc:{parser:{syntax:"typescript",tsx:!0,decorators:!0,dynamicImport:!0},loose:!0,target:"es2017",externalHelpers:!1,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,refresh:n&&t,development:t,importSource:p},optimizer:{simplify:!1}},minify:t?void 0:swcMinifyOption,experimental:{emitAssertForImportAttributes:!0,cacheRoot:r.swcCachePath,plugins:[["swc-plugin-another-transform-imports",function(e){for(let o=0,r=Object.keys(e),s=r.length;o<s;o++)e[r[o]].transform=`${r[o]}/${e[r[o]].transform}`,e[r[o]].style&&(e[r[o]].style=`${r[o]}/${e[r[o]].style}`);return e}(o.importOnDemand||{})],i&&["@moneko/jsx-dom-expressions",o.jsxDomExpressions||{}]].filter(Boolean)}},sourceMaps:!0,parseMap:!0};o.polyfill&&(c.jsc.target=void 0,c.env={include:s(),mode:"entry",coreJs:"3.34"});export default e(c,"function"==typeof o.swcrc?o.swcrc(t):o.swcrc||{});
package/lib/targets.js DELETED
@@ -1 +0,0 @@
1
- let r,t;import e from"browserslist";import{browserslistToTargets as s}from"lightningcss";import o from"./paths.js";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,8 +0,0 @@
1
- import type { Node, SourceFile, TransformerFactory } from 'typescript';
2
- declare let tsLoaderConfig: {
3
- transpileOnly: boolean;
4
- getCustomTransformers: () => {
5
- before: (Node | TransformerFactory<SourceFile>)[];
6
- };
7
- };
8
- export default tsLoaderConfig;
@@ -1 +0,0 @@
1
- import{fileExists as r}from"@moneko/mdx";import t from"ts-import-plugin";import o from"webpack-merge";import{CONFIG as e}from"./config.js";import{isFunction as m,readConf as i,resolveProgramPath as a}from"./utils.js";let s=[];Array.isArray(e.importOnDemand)&&Object.assign(s,e.importOnDemand.map(r=>t(r)));let p=[...s],f={transpileOnly:!0,getCustomTransformers:()=>({before:p})},n=a("tsloader.config.ts");if(r(n))try{let r=(await i(n,"tsloader.config")).default;f=o(f,m(r)?r(process):r)}catch(r){}export default f;
package/lib/utils.js DELETED
@@ -1,2 +0,0 @@
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(){}
@@ -1 +0,0 @@
1
- import{fileExists as e,loadFileSync as r}from"@moneko/mdx";import{Parser as t}from"xml2js";import{PACKAGENAME as o}from"../process-env.js";export default function(c){let a={},i="export default {}";if(e(c))try{let e=r(c);(0,new t({explicitArray:!1,async:!1}).parseString)(e,(e,r)=>{e||(Object.assign(a,{[o]:r.coverage.project.metrics.$}),r.coverage.project.package.forEach(e=>{Object.assign(a,{[e.$.name]:e.metrics.$})})),i=`export default ${JSON.stringify(a)}`})}catch(e){}return i}
package/lib/vm/docs.js DELETED
@@ -1 +0,0 @@
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{FRAMEWORK as n,isLibrary as a,isReact as s,isSolid as p}from"../process-env.js";import m from"../reactive-object.js";let l={react:"createElement",solid:"createComponent"}[n];export const docsModuleName="@app/docs";export const docs=new m({[docsModuleName]:"export default {}"});export const comment=new m({});export const getCommentPath=function(){let e=/^\/?(.+?)\.tsx?$/,t=r.alias["@pkg"].length;return o=>o.substring(t).replace(e,"@app/comment/$1.md")}();if(a){let a={},m=`import { ${l}${p?",Dynamic":""} } from "${{react:"react",solid:"solid-js"}[n]}${p?"/web":""}";import SuspenseComp from "@app/suspense";function call_then(res) {return {default: ${s?"() =>":""}${l}(${p?"Dynamic":"'n-md'"}, {text: res.default, ${p?"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("/");a[n]||(a[n]={}),t?a[n][r]&&delete a[n][r]:a[n][r]=`rr(() => ${l}(SuspenseComp, { comp: () => import(/* webpackChunkName: '${e}' */ '${e}?raw').then(call_then)}))rr`;let s={};for(let e in a)Object.prototype.hasOwnProperty.call(a,e)&&(s[e]=Object.values(a[e]));docs.setData(docsModuleName,`${m}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/lib/vm/example.js DELETED
@@ -1 +0,0 @@
1
- import{generateExample as e}from"@moneko/mdx";import{watchFiles as o}from"./utils.js";import t from"../paths.js";import{isDev as r,isLibrary as p}from"../process-env.js";import m from"../reactive-object.js";export const exampleModuleName="@app/example";function a(){try{return JSON.parse(e(t.componentsPath,"@app/example/"))}catch(e){return{}}}export const examples=new m(p?a():{});export function generatorDemo(){let e=a();for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&examples.setData(o,e[o])}p&&r&&o(t.componentsPath,/(?<!\/examples\/(.+)\.md)$/,generatorDemo);
@@ -1 +0,0 @@
1
- import{dirname as e}from"path";import t from"typescript";import{CONFIG as n}from"../config.js";let{ScriptKind:r,ScriptTarget:l,SyntaxKind:o,createSourceFile:i,forEachChild:a,getLeadingCommentRanges:c,isInterfaceDeclaration:u,isQuestionToken:s,isPropertySignature:f,isFunctionTypeNode:p,isUnionTypeNode:m,isMethodSignature:g}=t,$={};function h(e){let t=c(e.getSourceFile().text,e.pos);if(t){let n=e.getSourceFile().text.substring(t[0].pos,t[0].end).match(/\/\*\*([\s\S]*?)\*\//);if(n)return n[1].replace(/^\s*\* ?/gm,"").replace(/\s+$/,"").trim()}return null}function b(e){if(!e)return null;let t=e.match(/@since\s+([^\n]+)/);return t?t[1].trim():null}function d(e){if(!e)return null;let t=e.match(/@author (\w+)\s*(?:<([^>]+)>)?/);if(t?.length){let e=t[1].trim(),n=t[2]?.trim(),r=/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(n);return n?r&&(n=`mailto:${n}`):n=`https://github.com/${e}`,`[![${e}](https://avatars.githubusercontent.com/${e}?s=64)${e}](${n})`}return null}function y(e){if(!e)return null;let t=e.match(/@ignore\s+([^\n]+)/);return t?t[1].trim():null}let x=/(?<!['"])(unknown|any|void|bigint|object|undefined|null|boolean|number|string|symbol)(?!['"])/g;function j(e,t){if(!e)return null;let r=e.replace(/\b([A-Z][a-zA-Z0-9]*)\b/g,e=>{if($[e]){let r=`/${[n.basename,$[e]].join("/").split("/").filter(Boolean).join("/")}`;return t?`[\\color{#009688}{${e}}](${r})`:`[${e}](${r})`}return t?`\\color{#009688}{${e}}`:e});return t&&(r=r.replace(x,e=>`\\color{#009688}{${e}}`)),r}function T(e){return(function(e){let t;if(!e)return null;let n=[];for(;t=/\\color{([^|}]*)\|?([^|}]*)\|?([^|}]*)\|?([^}]*)}{([^}]*)}/g.exec(e);)n.push(t[0]);return e.replace(/[{}[\]()=>]|keyof|typeof|true|false/g,e=>n.some(t=>t.includes(e))?e:`\\color{#569cd6}{${e}}`)})(e)?.replace(/^\s*\|\s*|\s*\|\s*$/gm,"").replace(/\n/g,"<br/>").replace(/\*/g,"\\*").replace(/\|/g,"\\|").replace(/(['"])((?:(?!\1).)*)\1/g,"\\color{#ce9178}{$1$2$1}")}function B(e){return e?e.replace(/^@[a-z].+/gm,"").replace(/(\n\s+)+/g,"<br />").replace(/\n/g,"<br />").replace(/(<br \/>)$/g,""):null}export default function k(c,x){let k=i(x,c,l.Latest,!0,r.TS),w="";return a(k,r=>{u(r)?w+=function(r){let l=r.name.text;Object.assign($,{[r.name.text]:e(r.getSourceFile().fileName).replace(n.alias["@pkg"],"")});let i=h(r),a=b(i),c=B(i),u=y(i)?.split("|")||[],x=u.includes("comment"),k=u.includes("initial"),w=u.includes("optional"),E=u.includes("version"),S=u.includes("author"),v=c?`\\color{|4||0.45}{${l}}`:l,F=(function(e){let n=[];if(e.heritageClauses){for(let r of e.heritageClauses)if(r.token===t.SyntaxKind.ExtendsKeyword)for(let e of r.types)n.push(e.getText())}return n})(r)?.map(e=>`<n-tag color="#4c81db" css=".tag{gap:0px;}">${j(T(e))}</n-tag>`),z=[c,v,a&&`\\color{#52c11b|1||0.9}{${a}}`,F.length>0&&`<sub>\`extends\`</sub> ${F.join(" ")}`].filter(Boolean).join(" "),K=`## ${z}`,N=r.members.filter(e=>f(e)&&e.type?.kind!==o.NeverKeyword||g(e)),q=[];if(N.length){N.forEach(e=>{let t=j(T(g(e)?`(${e.parameters.map(e=>`${e.name.getText()}: ${e.type?.getText()||"any"}`).join(", ")}): ${e.type?.getText()||"any"}`:e.type?.getText()||"any"),!0),n=h(e),r=T(e.name.getText());!r||r.startsWith("\\color")||(g(e)||function(e){if(e.type){if(!m(e.type))return p(e.type);for(let t of e.type.types)if(p(t))return!0}return!1}(e)||t?.includes("=>")?r=`\\color{#f9a913}{${r}}`:/^["'](.+)["']$/.test(r)||(r=`\\color{#4c81db}{${r}}`));let l=e.questionToken&&s(e.questionToken);q.push([r,!w&&`\\color{${l?"#f9a913":"#52c11b"}\\|\\|\\|0.9}{${l?"✘":"✔"}}`,!x&&T(B(n)),t,!k&&T(function(e){if(!e)return null;let t=e.match(/@default\s+([^\n]+)/);return t?t[1].trim():null}(n)),!E&&T(b(n)),!S&&(d(n)||d(i))])});let e=!1,t=!1,n=!1,r=!1;q.forEach(l=>{!x&&l[2]&&(r=!0),!k&&l[4]&&(n=!0),!E&&l[5]&&(t=!0),!S&&l[6]&&(e=!0)}),K+="\n";let l=["属性",!w&&"必要",r&&"说明","类型",n&&"默认值",t&&"版本",e&&"作者"].filter(Boolean).join("|");K+=`|${l}|`;let o=[":-",!w&&":-",r&&":-",":-",n&&":-",t&&":-",e&&":-"].filter(Boolean);K+="\n";let a=o.join("|");K+=`|${a}|`,q.forEach(l=>{K+="\n";let o=[l[0]||"-",!w&&(l[1]||"-"),r&&(l[2]||"-"),l[3]||"-",n&&(l[4]||"-"),t&&(l[5]||"-"),e&&(l[6]||"-")].filter(Boolean).join("|");K+=`|${o}|`}),K+="\n"}return K+="\n"}(r):t.isEnumDeclaration(r)&&(w+=function(r){let l=r.name.text,o=h(r),i=B(o),a=b(o);Object.assign($,{[r.name.text]:e(r.getSourceFile().fileName).replace(n.alias["@pkg"],"")});let c=i?`\\color{|4||0.45}{${l}}`:l,u=[i,c,a&&`\\color{#52c11b|1||0.9}{${a}}`].filter(Boolean).join(" "),s=y(o)?.split("|")||[],f=s.includes("comment"),p=s.includes("version"),m=s.includes("author"),g=`## ${u}`;if(r.members.length){let e=[];r.members.forEach(n=>{let r=T(n.name.getText()),l=h(n),i=T(function(e){let n=e.initializer;return n&&t.isStringLiteral(n)?` '${n.text}'`:null}(n)),a=T(b(l)),c=T(B(l));!r||r.startsWith("\\color")||/^["'](.+)["']$/.test(r)||(r=`\\color{#4c81db}{${r}}`),e.push([r,!f&&c,i,!p&&a,!m&&(d(l)||d(o))])});let n=!1,l=!1,i=!1;e.forEach(e=>{!f&&e[1]&&(i=!0),!p&&e[3]&&(l=!0),!m&&e[4]&&(n=!0)}),g+="\n";let a=["属性",i&&"说明","值",l&&"版本",n&&"作者"].filter(Boolean).join("|");g+=`|${a}|`;let c=[":-",i&&":-",":-",l&&":-",n&&":-"].filter(Boolean);g+="\n";let u=c.join("|");g+=`|${u}|`,e.forEach(e=>{g+="\n";let t=[e[0]||"-",i&&(e[1]||"-"),e[2]||"-",l&&(e[3]||"-"),n&&(e[4]||"-")].filter(Boolean).join("|");g+=`|${t}|`})}return g+="\n\n"}(r))}),w}
package/lib/vm/locales.js DELETED
@@ -1,2 +0,0 @@
1
- import{basename as e,join as t}from"path";import{directoryExists as o,scanFolder as a}from"@moneko/mdx";import{watch as l}from"chokidar";import{CONFIG as r}from"../config.js";import{FRAMEWORK as n,isDev as s}from"../process-env.js";import c from"../reactive-object.js";import{esm as i,tfc as g}from"../utils.js";let u={react:'import sso from "shared-store-object";',solid:'import { createEffect, createRoot, getOwner } from "solid-js";import { createStore } from "solid-js/store";'},f={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;'}[n];function p(e,t){return`${u[n]}
2
- export function interpolateString(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);${f}`}export const localesModuleName="@app/locales";export const locales=new c({[localesModuleName]:p([],{})});let d={};async function m(t,o){let a=e(t).replace(/\.[^.]+$/,"");"deleted"===o?delete d[a]:Object.assign(d,{[a]:(await import(i`${g(t)}`)).default});let l=[],r={};for(let e in d)if(Object.prototype.hasOwnProperty.call(d,e)){let{language:t=a,title:o=t,icon:n,translation:s={}}=d[e];l.push({language:t,title:o,icon:n}),r[t]={language:t,title:o,icon:n,translation:s}}locales.setData(localesModuleName,p(l,r))}let z=t(r.alias["@"],"./locales");o(z)&&(a(z).filter(e=>!/^\..*/.test(e)&&!/!\.ts$/.test(e)&&!/\.d\.ts$/.test(e)).forEach(e=>{m(e,"added")}),s&&function(e,t){let o=l(e,{ignored:t,persistent:!0,ignoreInitial:!0});function a(){o.unwatch(e),o.close()}o.on("add",e=>{m(e,"added")}),o.on("change",e=>{m(e,"change")}),o.on("unlink",e=>{m(e,"deleted")}),o.once("ready",()=>{s||a()}),process.on("SIGINT",a)}(z,[/^\..*/,/!\.ts$/,/\.d\.ts$/]));
package/lib/vm/routes.js DELETED
@@ -1 +0,0 @@
1
- import{generateRouter as o}from"@moneko/mdx";import{watchFiles as e}from"./utils.js";import{CONFIG as t}from"../config.js";import{FRAMEWORK as r,isDev as s,isLibrary as m,routeDir as u}from"../process-env.js";import n from"../reactive-object.js";let i=m?"@pkg":"@/pages";export const routesModuleName="@app/routes";function p(){return o(u,`${t.alias["@"]}/router/index.ts`,r,i,m)}export const route=new n({[routesModuleName]:p()});export function generatorRouter(){route.setData(routesModuleName,p())}s&&e(u,m?/(?<!README\.mdx?)$/:/(?<!index\.tsx?)$/,generatorRouter);
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes