@moneko/core 3.9.17-beta.6 → 3.9.17-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/build.mjs CHANGED
@@ -1 +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)});
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"webpack-node-externals";import s from"webpackbar";import{commonConfig as a}from"./common.mjs";import{CONFIG as p}from"./config.mjs";import{getMinifyOption as l}from"./minify.mjs";import c from"./module.config.mjs";import u,{CUSTOMCONFIG as f}from"./paths.mjs";import h from"./plugin/done.mjs";import d from"./plugin/lightningcss-plugin.mjs";import{SSR as k,isLibrary as g}from"./process-env.mjs";import b from"./seo.mjs";import{compilerListener as w,log as y,resolveProgramPath as j}from"./utils.mjs";let{optimize:{MinChunkSizePlugin:v,ModuleConcatenationPlugin:z}}=n,x=[];p.minifier&&(x.push(new m(l(p.minifier?.type||"swc",p.minifier?.options))),x.push(new d));let C={splitChunks:p.splitChunk,runtimeChunk:p.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,mangleWasmImports:!0,minimize:!0,minimizer:x},E=[new z,new o({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),p.splitChunk&&new v({minChunkSize:1e4}),p.bundleAnalyzer&&new i(p.bundleAnalyzer)].filter(Boolean),I=a.output.path;k&&(I=j(`${g?"docs":"dist"}/client`));let A=[r(a,{optimization:C,output:{path:I},module:c(!1),plugins:[...E,(p.done||p.seo)&&new h({done(e){p.done?.(e),p.seo&&b()}}),p.bar&&new s(p.bar)].filter(Boolean)})];if(k){let e=r(a,{entry:{main:j("site/ssr.tsx")},output:{path:j(`${g?"docs":"dist"}/server`),library:{type:"commonjs2",umdNamedDefine:!1},filename:"[name].cjs",chunkFilename:"[chunkhash].cjs",globalObject:"global"},cache:{type:"filesystem",name:[f,process.env.NODE_ENV,"server"].filter(Boolean).join("-")},externalsPresets:{node:!0},externals:[t()],resolve:{fallback:{path:"path",fs:"fs",crypto:"crypto",assert:"assert"}},optimization:C,module:c(!0),target:"node",plugins:[...E,new s({name:"Server"})]});A.push(e)}let[B,D]=n(A).compilers,N=[w("client",B)];D&&N.push(w("server",D)),async function(){n(A).run((e,o)=>{if(e)throw e;o&&o.stats.forEach(e=>{e.compilation.warnings.forEach(e=>y(e.message)),e.compilation.errors.forEach(e=>y(e.message))})}),await Promise.all(N)}(),process.on("exit",function(){e(u.cachePath)});
package/lib/common.mjs CHANGED
@@ -1 +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
+ 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 n from"./plugins.config.mjs";import{PACKAGENAME as a,PACKAGEVERSION as i,isDev as l,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/[${l?"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:a,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${a}`,pathinfo:l,clean:!0,publicPath:t,asyncChunks:!0,charset:!0};let u={main:[e.polyfill&&`${o.corePath}/polyfills/replace-children.js`,c("@app/entry")].filter(Boolean)};e.entry&&("string"==typeof e.entry?u={main:[e.entry]}:Object.keys(e.entry)&&(u=Object.assign(u,e.entry))),"string"==typeof u.main&&(u.main=[u.main]),e.output&&("string"==typeof e.output?outputConfig.path=e.output:Object.keys(e.output)&&Object.assign(outputConfig,e.output));let f=!1;e.cacheDirectory&&(f={type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:e.cacheDirectory,memoryCacheUnaffected:!0,name:[s,process.env.NODE_ENV].filter(Boolean).join("-"),version:i});let d=Object.assign({original:e.alias["@"],override:s&&m(s)},e.overrideResolve);export const commonConfig={devtool:e.devtool,entry:u,mode:l?"development":"production",stats:"errors-only",cache:f,infrastructureLogging:{level:"error"},target:"web",externalsPresets:e.externalsPresets,plugins:n,node:{global:!1},experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:l&&{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(d),...e.resolvePlugins].filter(Boolean),fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},externals:e.externals,output:outputConfig};
package/lib/config.mjs CHANGED
@@ -1 +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};
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 a,isDev as r,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={devtool:r?"eval-cheap-module-source-map":"cheap-module-source-map",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/${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:x,js:x,media:x,font:x,wasm:[]},mdx:{jsx:!1,development:r,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},virtualModule:{}};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,v={},P={};if(e(o.configPath)){let e=(await g(o.configPath,"index")).default;v=d(e)?e(process):e}if(s&&e(o.customConfigPath)){let e=(await g(o.customConfigPath,s)).default;P=d(e)?e(process):e}(!1===(k=t(k,v,P)).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};
@@ -0,0 +1,6 @@
1
+ import webpack from 'webpack';
2
+ export declare const PORT: number;
3
+ export declare function devLog(err?: Error | null, stats?: webpack.Stats): void;
4
+ export declare const headers: {
5
+ 'Access-Control-Allow-Origin': string;
6
+ };
@@ -0,0 +1,3 @@
1
+ import e from"chalk";import{CONFIG as t}from"./config.mjs";import{getIPv4 as r,getPort as o}from"./net.mjs";import{log as s}from"./utils.mjs";let{yellow:i,green:n,grey:l,gray:m,bgBlue:p,bgGreenBright:a,blueBright:c,greenBright:v}=e,d=t.devServer.port||3e3;export const PORT=await o(d,65535,t.devServer.host);t.devServer.port=PORT;let $="/"===t.basename,u=t.devServer.https?"https:":"http:",f=$?"":t.basename,h=t.devServer.port!==PORT&&m(`Port ${i(d)} is in use, trying ${n(PORT)} instead.
2
+ `);function T(e){return`${u}//${"local"===e?t.devServer.host:r()}:${PORT}${f}`}let x=m("You application is running here:"),O=`${p(" Local ")} ${c(T("local"))}
3
+ ${a(" Network ")} ${v(T("net"))}`;export function devLog(e,t){!e&&t&&(process.stdout.write("\x1b[2J\x1b[3J\x1b[H"),s([x,"",O,"",l(`Compiled successfully in ${n(`${t.endTime-t.startTime}ms`)}`)]),h&&s(h))}export const headers={"Access-Control-Allow-Origin":"*"};
@@ -0,0 +1 @@
1
+ export {};
File without changes
package/lib/dev.mjs CHANGED
@@ -1,3 +1 @@
1
- import e from"chalk";import t from"webpack";import o from"webpack-node-externals";import s from"express";import i from"cors";import a 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");c("@moneko/mock");let N=M?(await import("stylelint-webpack-plugin")).default:null,O=F?(await import("eslint-webpack-plugin")).default:null,C=p.devServer.port||3e3,I=await d(C,65535,p.devServer.host),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(C)} 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"],E=A.join(","),K=["css","scss","sass","less","ts","tsx","js","jsx"],Q=K.join(","),R=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],V=[new x({paths:[/\.d\.ts$/]})].filter(Boolean),W=s();W.use(i());let X=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:[...V,new j,J&&new J,O&&new O({fix:!0,threads:!0,files:[`${p.alias["@"]}/**/*.{${E}}`,h&&`${p.alias["@pkg"]}/**/*.{${E}}`].filter(Boolean),extensions:A,exclude:R,cache:!0,lintDirtyModulesOnly:!0}),N&&new N({fix:!0,threads:!0,files:[`${p.alias["@"]}/**/*.{${Q}}`,h&&`${p.alias["@pkg"]}/**/*.{${Q}}`].filter(Boolean),extensions:K,exclude:R,cache:!0,lintDirtyModulesOnly:!0}),p.bar&&new n(p.bar)].filter(Boolean)}),Z=[X];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:[...V,new n({name:"Server"})].filter(Boolean)});Z.push(e)}let ee=t(Z),et=ee.compilers.find(e=>"web"===e.options.target),eo=ee.compilers.find(e=>"node"===e.options.target);W.use(a(et,{publicPath:X.output.publicPath,stats:X.stats,writeToDisk:!0})),W.use(r(et,{log:!1,path:"/__webpack_hmr",heartbeat:2e3})),eo&&eo.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`)}`)]))}),await Promise.all([b("client",et),eo&&b("server",eo)].filter(Boolean)),W.listen(I,()=>{L&&g(L)}),process.on("exit",function(){}),process.on("SIGINT",()=>{process.exit()});
1
+ import{removeDirAll as e}from"@moneko/mdx";import o from"cors";import t from"express";import r from"webpack";import i from"webpack-dev-middleware";import s from"webpack-hot-middleware";import{merge as a}from"webpack-merge";import m from"webpack-node-externals";import n from"webpackbar";import{commonConfig as l}from"./common.mjs";import{CONFIG as p}from"./config.mjs";import{PORT as c,devLog as d,headers as f}from"./dev-config.mjs";import{hasPkg as u}from"./has-pkg.mjs";import h from"./module.config.mjs";import w,{CUSTOMCONFIG as g}from"./paths.mjs";import{SSR as k,isLibrary as b,isReact as j}from"./process-env.mjs";import{compilerListener as x,resolveProgramPath as y}from"./utils.mjs";let{HotModuleReplacementPlugin:v}=r,_=u("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,$=u("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,B=j&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,D=["js","jsx","ts","tsx","json","html","vue"],P=D.join(","),S=["css","scss","sass","less","ts","tsx","js","jsx"],O=S.join(","),E=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],I=new URLSearchParams({timeout:2e3,reload:!0,quiet:!0,noInfo:!0,overlay:!1,dynamicPublicPath:!0}).toString(),N=[a(l,{entry:{main:[`webpack-hot-middleware/client?name=client&path=//localhost:${c}/__hmr__&${I}`]},module:h(!1),plugins:[new v,B&&new B,$&&new $({fix:!0,threads:!0,files:[`${p.alias["@"]}/**/*.{${P}}`,b&&`${p.alias["@pkg"]}/**/*.{${P}}`].filter(Boolean),extensions:D,exclude:E,cache:!0,lintDirtyModulesOnly:!0}),_&&new _({fix:!0,threads:!0,files:[`${p.alias["@"]}/**/*.{${O}}`,b&&`${p.alias["@pkg"]}/**/*.{${O}}`].filter(Boolean),extensions:S,exclude:E,cache:!0,lintDirtyModulesOnly:!0}),p.bar&&new n(p.bar)].filter(Boolean)})];if(k){let e=a(l,{entry:{main:y("site/ssr.tsx")},output:{path:y("ssr"),library:{type:"commonjs2"},filename:"[name].cjs",chunkFilename:"[name].cjs",globalObject:"global"},cache:{type:"filesystem",name:[g,process.env.NODE_ENV,"server"].filter(Boolean).join("-")},externals:[m()],module:h(!0),target:"node",plugins:[new n({name:"Server"})].filter(Boolean)});N.push(e)}let[T,M]=r(N).compilers,R=t();R.use(o()),R.use(i(T,{writeToDisk:!1,index:"index.html",headers:()=>f,serverSideRender:k})),R.use(s(T,{log:!1,path:"/__hmr__",heartbeat:2e3,ignoreUnaccepted:!1,ignoreDeclined:!0,ignoreErrored:!0}));let U=[x("client",T)];M&&(U.push(x("server",M)),M.watch({aggregateTimeout:20,ignored:/node_modules(?![\\/]@app)/,poll:1e3,stdin:!0},d)),await Promise.all(U),T.hooks.done.tap("client",e=>{d(null,e)}),R.listen(c,()=>{}),u("@moneko/mock")&&import("@moneko/mock").then(e=>{e.default(R,y("mock/"))}),process.on("exit",function(){}),process.on("SIGINT",()=>{e(w.cachePath),process.exit()});
@@ -1 +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;
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:p,favicon:n,...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"},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(p),favicon:a(n),excludeChunks:["ssr"]},l);export default s;
package/lib/info.d.mts CHANGED
@@ -1,6 +1,7 @@
1
1
  declare const app: {
2
2
  name: string;
3
3
  projectName: string;
4
+ ssr: boolean;
4
5
  version: string;
5
6
  base: string;
6
7
  type: import("./index.mjs").AppType;
package/lib/info.mjs CHANGED
@@ -1 +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
+ import{loadFileSync as e}from"@moneko/mdx";import{CONFIG as r}from"./config.mjs";import{APPTYPE as o,PACKAGENAME as t,PACKAGEVERSION as s,SSR as p}from"./process-env.mjs";import{resolveProgramPath as i,toUpperCaseString as m}from"./utils.mjs";let{description:n,author:a,repository:c,keywords:d}=JSON.parse(e(i("package.json"))||"{}"),f="string"==typeof a,l={name:t,projectName:m(t).replace(/-/g," "),ssr:p,version:s,base:r.basename,type:o,routerMode:r.routerMode,prefixCls:r.prefixCls,theme:r.theme,description:n,author:f?{name:a}:a,repository:f?{url:c}:c};export const description=n;export const keywords=Array.isArray(d)?d.toString():"";export default l;
@@ -1 +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
+ let e;import s from"mini-css-extract-plugin";import{CONFIG as t,PUBLICPATH as o}from"./config.mjs";import{hasPkg as r}from"./has-pkg.mjs";import a from"./modify-vars.mjs";import i,{CUSTOMCONFIG as l}from"./paths.mjs";import{FRAMEWORK 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";let v=c?o:"../",h={loader:s.loader,options:{publicPath:"/"!==v?v:"../"}},w={loader:`${i.corePath}/loader/lightningcss.cjs`,options:{sourceMap:!!t.sourceMap,analyzeDependencies:!1,targets:f(),drafts:{nesting:!0,customMedia:!0},errorRecovery:!1,unusedSymbols:[],rem:!!t.rem}};m&&(h="style-loader");let b=[...t.cssModules,`@moneko/${n}`,"neko-ui"].map(y),_=["components","example","mock","site","src","server"].map(g);function k(e){return _.concat(t.rulesInclude?.[e]?.map(y)||[])}l&&_.push(g(l)),t.overrideResolve&&t.overrideResolve.override&&_.push(t.overrideResolve.override);let M=k("css"),B=k("js"),L=k("media"),O=k("wasm"),P=k("font");r("sass")&&(e={loader:"sass-loader",options:{implementation:await import("sass"),sassOptions:{}}});let R=d&&m&&{test:/^(?![._]).*(?<!\.test)\.(tsx?)$/,include:t.alias["@pkg"],exclude:[/node_modules/,/(.+)\/__tests__\/(.+)/i],enforce:"pre",loader:`${i.corePath}/loader/ts-doc.cjs`,options:{comment:j,generateDoc:x,getCommentPath:$}};export default(s=>{let o={loader:"swc-loader",options:u(s)},r={loader:"css-loader",options:{modules:{auto:e=>{for(let s=0,t=b.length;s<t;s++)if(e&&e?.includes(b[s]))return/(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i.test(e);return/(^(?!.*node_modules))(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i.test(e)},localIdentName:"[path][name]__[local]",exportLocalsConvention:"dashesOnly",exportOnlyLocals:s},importLoaders:2}},l=[h,r,w,{loader:"less-loader",options:{sourceMap:!!t.sourceMap,lessOptions:{modifyVars:a,javascriptEnabled:!0}}}].filter(Boolean);return{noParse:[/jquery|lodash|prismjs|prism\.js/,/react\.min\.js$/,/marked\.min\.js$/],rules:[R,{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:O},{test:/\.txt$/i,type:"asset/source"},{test:/\.ico$/i,type:"asset/inline",include:L},{test:/\.svg$/i,type:"asset/inline",generator:{dataUrl:e=>p(e.toString())},include:L},{test:/\.(gif|png|jpe?g|webp)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/images/[name][ext]"},include:L},{test:/\.(webm|mp4|ogv)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[name][ext]"},include:L},{test:/\.(woff2?|eot|ttf|otf)(\?.*)?$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[name][ext]"},include:P},{test:/\.(sa|sc)ss$/i,use:[h,r,w,e].filter(Boolean),include:M},{test:/\.less$/i,use:l,include:M},{test:/\.css$/i,use:[h,"css-loader",w].filter(Boolean),include:M},{test:/\.(cj|mj|t|j)s(|x)$/i,use:[...t.prefixJsLoader,o].filter(Boolean),include:B},{test:/\.mdx?$/i,use:[...t.prefixJsLoader,{loader:`${i.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 +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)}})}}
1
+ import o from"webpack-virtual-modules";import{isLibrary as t}from"../process-env.mjs";import{resolveNodeModulesPath as e}from"../utils.mjs";import{comment as s,docs as p}from"../vm/docs.mjs";import{examples as r}from"../vm/example.mjs";import{locales as i}from"../vm/locales.mjs";import m from"../vm/modules.mjs";import{route as a}from"../vm/routes.mjs";export default class{constructor(o={}){this.options=o,this.hasTapped=!1}apply(l){let n=new o(m);function f(o,t){let s=e(o);n.writeModule(s,t||"")}n.apply(l),a.on("change",f),i.on("change",f),t&&(r.on("change",f),p.on("change",f),s.on("change",f)),l.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];f(o,"string"==typeof t?t:`export default ${JSON.stringify(t)}`)}for(let o of r)f(...o);for(let o of p)f(...o);for(let o of s)f(...o)}})}}
@@ -1 +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;
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.mjs";import i from"./html-plugin-option.mjs";import r from"./module-federation.mjs";import n from"./plugin/add-entry-attribute.mjs";import p from"./plugin/virtual-module.mjs";import{isMicro as a}from"./process-env.mjs";let{AutomaticPrefetchPlugin:s,DefinePlugin:m,SourceMapDevToolPlugin:c,IgnorePlugin:h,WatchIgnorePlugin:u}=l,f=o.basename.split("/").filter(Boolean).length,d=`${Array(f).fill("..").join("/")+(f?"/":"")}404.html`,{pathSegmentsToKeep:w=f,path:g=d}=o.fixBrowserRouter||{},j=o.assetHtml.map(e=>({publicPath:"",...e})),b=[new u({paths:[/\.d\.ts$/]}),...r,new p(o.virtualModule),new s,o.htmlPluginOption&&new t(i),o.fixBrowserRouter&&new t({filename:g,inject:!1,templateContent:()=>`<html lang="en"><head><title>${i.title}</title><script>const pathKeep = ${w||f};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(j),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 b;
package/lib/swcrc.mjs CHANGED
@@ -1 +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||{})});
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||{})});
package/lib/utils.mjs CHANGED
@@ -1,2 +1,2 @@
1
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 function compilerListener(o,r){return new Promise((t,e)=>{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=>{log(o.message)}),o.hasWarnings()&&o.compilation.warnings.forEach(o=>log(o.message))})})}
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 function compilerListener(o,r){return new Promise((t,e)=>{r.hooks.failed.tap(o,o=>{e(o)}),r.hooks.done.tap(o,r=>{r.hasErrors()||t(!0),r.compilation.warnings.forEach(r=>log([o,r.message])),r.compilation.errors.forEach(r=>log([o,r.message]))})})}
@@ -0,0 +1,17 @@
1
+ declare const _default: {
2
+ "node_modules/@app/info": string;
3
+ "node_modules/@app/entry": string;
4
+ "node_modules/@app/rem": string;
5
+ "node_modules/@app/fallback": string;
6
+ "node_modules/@app/coverage": string;
7
+ "node_modules/@app/merge-router": string;
8
+ "node_modules/@app/prefix-router": string;
9
+ "node_modules/@app/normalize/index.css": string;
10
+ "node_modules/@app/suspense/index.tsx": string;
11
+ "node_modules/@app/mdx-scope": string;
12
+ "node_modules/@app/routes": string;
13
+ "node_modules/@app/example": string;
14
+ "node_modules/@app/locales": string;
15
+ "node_modules/@app/docs": string;
16
+ };
17
+ export default _default;
@@ -0,0 +1 @@
1
+ import{join as m}from"path";import{getAppEntry as o,getAppFallback as r,getAppMdxScope as p,getAppMergeRouter as e,getAppNormalizeCss as t,getAppPrefixRouter as a,getAppRem as s,getAppSuspense as i}from"@moneko/mdx";import f from"./coverage.mjs";import{docs as l,docsModuleName as n}from"./docs.mjs";import{exampleModuleName as c}from"./example.mjs";import{locales as x,localesModuleName as d}from"./locales.mjs";import{route as g,routesModuleName as j}from"./routes.mjs";import{CONFIG as u}from"../config.mjs";import h from"../info.mjs";import v from"../paths.mjs";import{APPTYPE as k,FRAMEWORK as z}from"../process-env.mjs";import{resolveNodeModulesPath as D,resolveProgramPath as b}from"../utils.mjs";export default{[D("@app/info")]:`export default ${JSON.stringify(h)}`,[D("@app/entry")]:o(m(u.alias["@"],"./index.ts"),!!u.rem,!!u.normalizeCss,k,z),[D("@app/rem")]:s(u.rem?.designSize||1680),[D("@app/fallback")]:r(u.fallbackCompPath),[D("@app/coverage")]:f(v.coveragePath),[D("@app/merge-router")]:e(),[D("@app/prefix-router")]:a(),[D("@app/normalize/index.css")]:t(),[D("@app/suspense/index.tsx")]:i(k,z),[D("@app/mdx-scope")]:p(b("site/mdx-scope.ts")),[D(j)]:g.getData(j),[D(c)]:"export default []",[D(d)]:x.getData(d),[D(n)]:l.getData(n)};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.9.17-beta.6",
3
+ "version": "3.9.17-beta.8",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
@@ -46,8 +46,9 @@
46
46
  },
47
47
  "devDependencies": {
48
48
  "@swc/cli": "0.1.63",
49
- "@types/cors": "^2.8.17",
50
- "@types/express": "^4.17.21",
49
+ "@types/cors": "2.8.17",
50
+ "@types/express": "4.17.21",
51
+ "eslint-config-neko": "2.3.0",
51
52
  "eslint-webpack-plugin": "4.0.1",
52
53
  "sass": "1.69.5",
53
54
  "sass-loader": "13.3.2",