@moneko/core 3.11.1 → 3.11.2

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 (41) hide show
  1. package/lib/build/server.mjs +1 -1
  2. package/lib/build.mjs +1 -1
  3. package/lib/cjs/index.cjs +1 -0
  4. package/lib/cjs/index.d.cts +6 -0
  5. package/lib/cjs/load-module-meta.cjs +1 -0
  6. package/lib/cjs/load-module-meta.d.cts +2 -0
  7. package/lib/common.mjs +1 -1
  8. package/lib/config.mjs +1 -1
  9. package/lib/dev/mock.d.mts +1 -1
  10. package/lib/dev.mjs +1 -1
  11. package/lib/index.d.mts +3 -1
  12. package/lib/index.mjs +1 -1
  13. package/lib/module.config.mjs +1 -1
  14. package/lib/options/html-plugin-option.mjs +1 -1
  15. package/lib/options/js-minify.d.mts +1 -1
  16. package/lib/options/swcrc.mjs +1 -1
  17. package/lib/paths.d.mts +5 -1
  18. package/lib/paths.mjs +1 -1
  19. package/lib/plugin/lightningcss-plugin.mjs +1 -1
  20. package/lib/plugin/virtual-module.d.mts +3 -2
  21. package/lib/plugin/virtual-module.mjs +1 -1
  22. package/lib/polyfills/polyfills.d.mts +0 -1
  23. package/lib/polyfills/polyfills.mjs +1 -1
  24. package/lib/process-env.d.mts +1 -0
  25. package/lib/process-env.mjs +1 -1
  26. package/lib/utils/has-pkg.mjs +1 -1
  27. package/lib/utils/index.d.mts +3 -4
  28. package/lib/utils/index.mjs +1 -1
  29. package/lib/utils/reactive-object.mjs +1 -1
  30. package/lib/utils/seo.mjs +1 -1
  31. package/lib/utils/setup-env.d.mts +3 -0
  32. package/lib/utils/setup-env.mjs +1 -0
  33. package/lib/vm/example.d.mts +1 -1
  34. package/lib/vm/example.mjs +1 -1
  35. package/lib/vm/info.mjs +1 -1
  36. package/lib/vm/modules.d.mts +2 -17
  37. package/lib/vm/modules.mjs +1 -1
  38. package/package.json +16 -15
  39. package/typings/global.d.ts +3 -3
  40. package/lib/utils/compiler-listener.d.mts +0 -3
  41. package/lib/utils/compiler-listener.mjs +0 -1
@@ -1 +1 @@
1
- import e from"webpack-node-externals";import o from"../module.config.mjs";import{CUSTOMCONFIG as s}from"../paths.mjs";import{isLibrary as t}from"../process-env.mjs";import{resolveProgramPath as r}from"../utils/index.mjs";let m={entry:{main:r("site/ssr.tsx")},output:{path:r(`${t?"docs":"dist"}/server`),library:{type:"commonjs2",umdNamedDefine:!1},filename:"[name].cjs",chunkFilename:"[chunkhash].cjs",globalObject:"global"},cache:{type:"filesystem",name:[s,process.env.NODE_ENV,"server"].filter(Boolean).join("-")},externalsPresets:{node:!0},externals:[e({allowlist:["react","react-dom","solid-js","@app","@moneko"]})],module:o(!0),target:"node"};export default m;
1
+ import e from"../module.config.mjs";import{CUSTOMCONFIG as s}from"../paths.mjs";import{isLibrary as t}from"../process-env.mjs";import{resolveProgram as o}from"../utils/index.mjs";let m={entry:{main:o("site/ssr.tsx")},output:{path:o(`${t?"docs":"dist"}/server`),library:{type:"commonjs2",umdNamedDefine:!1},filename:"[name].cjs",chunkFilename:"[chunkhash].cjs",globalObject:"global"},cache:{type:"filesystem",name:[s,process.env.NODE_ENV,"server"].filter(Boolean).join("-")},externalsPresets:{node:!0},externals:[],module:e(!0),target:"node"};export default m;
package/lib/build.mjs CHANGED
@@ -1 +1 @@
1
- import{removeDirAll as o}from"@moneko/mdx";import r from"webpack";import{merge as m}from"webpack-merge";import e from"./build/common.mjs";import i from"./build/server.mjs";import{CONFIG as t}from"./config.mjs";import s from"./module.config.mjs";import n from"./paths.mjs";import l from"./plugin/done.mjs";import{SSR as p}from"./process-env.mjs";import a from"./utils/compiler-listener.mjs";import f from"./utils/log.mjs";import c from"./utils/seo.mjs";import u from"./utils/progress.mjs";let{ProgressPlugin:g}=r,j=[m(e,{module:s(!1),plugins:[t.done&&new l({done:t.done}),t.bar&&new g({handler(o,r,...m){let e=t.bar;u(o,e.name||"Build",m.length?`[${r}] ${m.join(" ")}`:"",e.color)}})].filter(Boolean)})];p&&j.push(m(e,i));let[d,h]=r(j).compilers,w=[a("client",d)];async function b(){r(j).run((o,r)=>{if(o)throw o;if(r)for(let o=0,m=r.stats.length;o<m;o++){let m=r.stats[o];for(let o=0,r=m.compilation.warnings.length;o<r;o++)f(m.compilation.warnings[o].message);for(let o=0,r=m.compilation.errors.length;o<r;o++)f(m.compilation.errors[o].message)}}),await Promise.all(w),t.seo&&c()}h&&w.push(a("server",h)),await b(),process.on("exit",function(){o(n.cachePath)});
1
+ import{removeDirAll as o}from"@moneko/mdx";import r from"webpack";import{merge as m}from"webpack-merge";import e from"./build/common.mjs";import i from"./build/server.mjs";import{CONFIG as t}from"./config.mjs";import s from"./module.config.mjs";import n from"./paths.mjs";import l from"./plugin/done.mjs";import{SSR as a}from"./process-env.mjs";import p from"./utils/log.mjs";import f from"./utils/seo.mjs";import c from"./utils/progress.mjs";import g from"chalk";let{ProgressPlugin:h}=r,u=[m(e,{module:s(!1),plugins:[t.done&&new l({done:t.done}),t.bar&&new h({handler(o,r,...m){let e=t.bar;c(o,e.name||"Build",m.length?`[${r}] ${m.join(" ")}`:"",e.color)}})].filter(Boolean)})];a&&u.push(m(e,i));let d=r(u);async function j(){await new Promise(o=>{d.run((r,m)=>{if(r)throw r;if(m&&(m.hasErrors()||m.hasWarnings()))for(let o=0,r=m.stats.length;o<r;o++){let r=m.stats[o];for(let o=0,m=r.compilation.warnings.length;o<m;o++)p(g.yellowBright(r.compilation.warnings[o].message));for(let o=0,m=r.compilation.errors.length;o<m;o++)p(g.redBright(r.compilation.errors[o].message))}o(r)})}),t.seo&&f()}await j(),process.on("exit",function(){o(n.cachePath)});
@@ -0,0 +1 @@
1
+ "use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return o}});const t=(e=require("./load-module-meta.cjs"))&&e.__esModule?e:{default:e},r=(0,t.default)("core-js/package.json").version,o={coreJsVersion:r.substring(0,r.indexOf(".",2)),loadModuleMeta:t.default};
@@ -0,0 +1,6 @@
1
+ import loadModuleMeta from './load-module-meta.cjs';
2
+ declare const _default: {
3
+ coreJsVersion: any;
4
+ loadModuleMeta: typeof loadModuleMeta;
5
+ };
6
+ export default _default;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return e}});const e=function(e){return require(e)};
@@ -0,0 +1,2 @@
1
+ declare function loadModuleMeta(name: string): any;
2
+ export default loadModuleMeta;
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 n from"./plugins.config.mjs";import{PACKAGENAME as i,PACKAGEVERSION as l,isDev as a,isLibrary as p}from"./process-env.mjs";import m from"./rule.mjs";import{resolveNodeModulesPath as c,resolveProgramPath as u}from"./utils/index.mjs";export const outputConfig={path:u(p?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${a?"name":"chunkhash"}].js`,assetModuleFilename:e=>{let t=e.filename;return t?.endsWith("?url")&&m.worker_file.test(t.replace("?url",""))?"worker/[name][ext]":"assets/[name][hash][ext]"},library:{name:i,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${i}`,pathinfo:a,clean:!0,publicPath:t,asyncChunks:!0,charset:!0};let f={main:[e.polyfill&&`${o.corePath}/polyfills/replace-children.js`,c("@app/entry")].filter(Boolean)};e.entry&&("string"==typeof e.entry?f={main:[e.entry]}:Object.keys(e.entry)&&(f=Object.assign(f,e.entry))),"string"==typeof f.main&&(f.main=[f.main]),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={type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:e.cacheDirectory,memoryCacheUnaffected:!0,name:[s,process.env.NODE_ENV].filter(Boolean).join("-"),version:l});let y=Object.assign({original:e.alias["@"],override:s&&u(s)},e.overrideResolve);export const commonConfig={devtool:e.devtool,entry:f,mode:a?"development":"production",stats:"errors-only",cache:d,infrastructureLogging:{level:"error"},target:"web",externalsPresets:e.externalsPresets,plugins:n,node:{global:!1},experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:a&&{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(y),...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 i,PACKAGEVERSION as l,isDev as a,isLibrary as p}from"./process-env.mjs";import m from"./rule.mjs";import{node_modules as c,resolveProgram as u}from"./utils/index.mjs";export const outputConfig={path:u(p?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${a?"name":"chunkhash"}].js`,assetModuleFilename:e=>{let t=e.filename;return t?.endsWith("?url")&&m.worker_file.test(t.replace("?url",""))?"worker/[name][ext]":"assets/[name][hash][ext]"},library:{name:i,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${i}`,pathinfo:a,clean:!0,publicPath:t,asyncChunks:!0,charset:!0};let f={main:[e.polyfill&&`${o.corePath}/polyfills/replace-children.js`,c("@app/entry")].filter(Boolean)};e.entry&&("string"==typeof e.entry?f={main:[e.entry]}:Object.keys(e.entry)&&(f=Object.assign(f,e.entry))),"string"==typeof f.main&&(f.main=[f.main]),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={type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:e.cacheDirectory,memoryCacheUnaffected:!0,name:[s,process.env.NODE_ENV].filter(Boolean).join("-"),version:l});let y=Object.assign({original:e.alias["@"],override:s&&u(s)},e.overrideResolve);export const commonConfig={devtool:e.devtool,entry:f,mode:a?"development":"production",stats:"errors-only",cache:d,infrastructureLogging:{level:"error"},target:"web",externalsPresets:e.externalsPresets,plugins:n,node:{global:!1},experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:a&&{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(y),...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 o}from"webpack-merge";import t from"./options/jsx-dom-expressions.mjs";import s from"./options/split-chunk.mjs";import a,{CUSTOMCONFIG as i}from"./paths.mjs";import{FRAMEWORK as r,PACKAGENAME as l,isDev as n,isLibrary as m,isMobile as p,jsxImportSource as c,mainDirectory as u}from"./process-env.mjs";import{isFunction as d,resolveProgramPath as h}from"./utils/index.mjs";import f from"./utils/log.mjs";import g from"./utils/read-conf.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"],P={devtool:n?"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:p?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":h(u)},moduleRules:[],prefixJsLoader:[],cssModules:[],importOnDemand:{},proxy:{},cacheDirectory:a.webpackCachePath,devServer:{host:"localhost",port:3e3},htmlPluginOption:{},assetHtml:[],routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:s,runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:x,js:x,media:x,font:x,wasm:[]},mdx:{jsx:!1,development:n,jsxImportSource:c,providerImportSource:`@moneko/${r}/mdx`},jsxDomExpressions:t,bar:{name:"Client",color:"#6f42c1"},normalizeCss:!0,externalsPresets:{},buildHttp:{allowedUris:[],lockfileLocation:`${a.httpCachePath}/http.lock`,cacheLocation:`${a.httpCachePath}/data`,upgrade:!0},virtualModule:{},cssExtract:{}};m&&(P.alias=Object.assign(P.alias,{"@pkg":a.componentsPath,[l]:a.componentsPath}));let v=P,C={},k={};if(e(a.configPath)){let e=(await g(a.configPath,"index")).default;C=d(e)?e(process):e}if(i&&e(a.customConfigPath)){let e=(await g(a.customConfigPath,i)).default;k=d(e)?e(process):e}(!1===(v=o(v,C,k)).devtool||!1===v.sourceMap)&&(v.sourceMap=!1,v.devtool=!1),v.fixBrowserRouter&&v.htmlPluginOption&&(v.htmlPluginOption.tags||(v.htmlPluginOption.tags=[]),v.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=v;export const PUBLICPATH=CONFIG.publicPath||"/";global.NEKOCLICONFIG={CONFIG,CUSTOMCONFIG:i,log:f};
1
+ import{fileExists as e}from"@moneko/mdx";import{merge as o}from"webpack-merge";import t from"./options/jsx-dom-expressions.mjs";import s from"./options/split-chunk.mjs";import a,{CUSTOMCONFIG as i}from"./paths.mjs";import{APPTYPE as r,FRAMEWORK as l,NODE_ENV as n,PACKAGENAME as m,isDev as p,isLibrary as c,isMobile as u,jsxImportSource as d,mainDirectory as h}from"./process-env.mjs";import{isFunction as f,resolveProgram as g}from"./utils/index.mjs";import x from"./utils/log.mjs";import P from"./utils/read-conf.mjs";import v from"./utils/setup-env.mjs";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"],j={devtool:p?"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:v(n,r,l),basename:"/",publicPath:"/",rem:{designSize:u?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":g(h)},moduleRules:[],prefixJsLoader:[],cssModules:[],importOnDemand:{},proxy:{},cacheDirectory:a.webpackCachePath,devServer:{host:"localhost",port:3e3},htmlPluginOption:{},assetHtml:[],routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:s,runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:C,js:C,media:C,font:C,wasm:[]},mdx:{jsx:!1,development:p,jsxImportSource:d,providerImportSource:`@moneko/${l}/mdx`},jsxDomExpressions:t,bar:{name:"Client",color:"#6f42c1"},normalizeCss:!0,externalsPresets:{},buildHttp:{allowedUris:[],lockfileLocation:`${a.httpCachePath}/http.lock`,cacheLocation:`${a.httpCachePath}/data`,upgrade:!0},virtualModule:{},cssExtract:{}};c&&(j.alias=Object.assign(j.alias,{"@pkg":a.componentsPath,[m]:a.componentsPath}));let k=j,w={},b={};if(e(a.configPath)){let e=(await P(a.configPath,"index")).default;w=f(e)?e(process):e}if(i&&e(a.customConfigPath)){let e=(await P(a.customConfigPath,i)).default;b=f(e)?e(process):e}(!1===(k=o(k,w,b)).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:i,log:x};
@@ -20,7 +20,7 @@ type Any = any;
20
20
  * @param {T} data data
21
21
  * @returns {Promise} mockData
22
22
  */
23
- export declare const yApiSchemaMock: <T extends unknown>(option: YApiOptionBySchema, data?: T | undefined) => Promise<T>;
23
+ export declare const yApiSchemaMock: <T extends unknown>(option: YApiOptionBySchema, data?: T) => Promise<T>;
24
24
  export type YApiOption = {
25
25
  /** YApi host */
26
26
  host: string;
package/lib/dev.mjs CHANGED
@@ -1 +1 @@
1
- import{directoryExists as e,removeDirAll as t}from"@moneko/mdx";import o from"express";import i from"multer";import r from"webpack";import s from"webpack-dev-middleware";import l from"webpack-hot-middleware";import{merge as m}from"webpack-merge";import n from"./build/server.mjs";import{commonConfig as a}from"./common.mjs";import{CONFIG as c}from"./config.mjs";import{PORT as p,devLog as d,headers as u}from"./dev/config.mjs";import h from"./dev/mock.mjs";import f from"./dev/proxy.mjs";import w from"./module.config.mjs";import g from"./paths.mjs";import{SSR as j,isLibrary as x,isReact as k}from"./process-env.mjs";import $ from"./rule.mjs";import b from"./utils/compiler-listener.mjs";import y from"./utils/has-pkg.mjs";import{empty as v,resolveProgramPath as _}from"./utils/index.mjs";import P from"./utils/progress.mjs";import S from"./utils/sigint-exit.mjs";let{HotModuleReplacementPlugin:B,ProgressPlugin:D,WatchIgnorePlugin:C}=r,L=y("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,T=y("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,E=k&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,F=["js","jsx","ts","tsx","json","html","vue"],M=F.join(","),O=["css","scss","sass","less","ts","tsx","js","jsx"],R=O.join(","),U=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],q=new URLSearchParams({timeout:2e3,reload:!0,quiet:!0,noInfo:!0,overlay:!0,dynamicPublicPath:!0}).toString(),A=a.output.path;j&&(A=_(`${x?"docs":"dist"}/client`));let G=m(a,{entry:{main:[`webpack-hot-middleware/client?name=client&path=//localhost:${p}/__hmr__&${q}`]},output:{path:A},module:w(!1),plugins:[new B,new C({paths:[/\.d\.ts$/]}),E&&new E,T&&new T({fix:!0,threads:!0,files:[`${c.alias["@"]}/**/*.{${M}}`,x&&`${c.alias["@pkg"]}/**/*.{${M}}`].filter(Boolean),extensions:F,exclude:U,cache:!0,cacheLocation:`${g.lineCachePath}/.eslintcache`,lintDirtyModulesOnly:!0}),L&&new L({fix:!0,threads:!0,files:[`${c.alias["@"]}/**/*.{${R}}`,x&&`${c.alias["@pkg"]}/**/*.{${R}}`].filter(Boolean),extensions:O,exclude:U,cache:!0,cacheLocation:`${g.lineCachePath}/.stylelintcache`,lintDirtyModulesOnly:!0}),c.bar&&new D({handler(e,t,...o){let i=c.bar;P(e,i.name||"Build",o.length?`[${t}] ${o.join(" ")}`:"",i.color)}})].filter(Boolean)}),I=[G];j&&I.push(m(a,n));let[z,H]=r(I).compilers;z.hooks.done.tap("client",e=>{d(null,e)});let J=o(),K=i(),N=s(z,{writeToDisk:!1,index:"index.html",headers:()=>u,serverSideRender:j});if(J.use(N),J.use(l(z,{log:!1,path:"/__hmr__",heartbeat:2e3,ignoreUnaccepted:!1,ignoreDeclined:!0,ignoreErrored:!0})),c.proxy&&f(J,c.proxy),e(g.mockPath)){let e=h(g.mockPath);J.use(e)}let Q=`${G.output.path}/index.html`;J.all("/*",K.any(),function(e,t,o){if("GET"!==e.method)return o();{let e=N.context.outputFileSystem,o=e?.readFileSync?.(Q);t.end(o)}});let V=[b("client",z)];H&&(H.watch({aggregateTimeout:20,ignored:$.dev_watch_ignored,poll:1e3,stdin:!0},d),V.push(b("server",H))),await Promise.all(V);let W=J.listen(p,()=>{});process.on("exit",function(){N.close(v),W.close(v),W.closeAllConnections(),t(g.cachePath)}),S(()=>{process.exit(1)});
1
+ import{directoryExists as e,removeDirAll as t}from"@moneko/mdx";import o from"express";import i from"multer";import s from"webpack";import l from"webpack-dev-middleware";import r from"webpack-hot-middleware";import{merge as m}from"webpack-merge";import a from"./build/server.mjs";import{commonConfig as n}from"./common.mjs";import{CONFIG as c}from"./config.mjs";import{PORT as p,devLog as d,headers as u}from"./dev/config.mjs";import h from"./dev/mock.mjs";import f from"./dev/proxy.mjs";import w from"./module.config.mjs";import x from"./paths.mjs";import{SSR as j,isLibrary as g,isReact as k}from"./process-env.mjs";import $ from"./utils/has-pkg.mjs";import{empty as b,resolveProgram as y}from"./utils/index.mjs";import v from"./utils/progress.mjs";import _ from"./utils/sigint-exit.mjs";let{HotModuleReplacementPlugin:P,ProgressPlugin:S,WatchIgnorePlugin:B}=s,C=$("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,D=$("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,L=k&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,M=["js","jsx","ts","tsx","json","html","vue"],F=M.join(","),O=["css","scss","sass","less","ts","tsx","js","jsx"],R=O.join(","),T=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],q=new URLSearchParams({timeout:2e3,reload:!0,quiet:!0,noInfo:!0,overlay:!0,dynamicPublicPath:!0}).toString(),A=n.output.path;j&&(A=y(`${g?"docs":"dist"}/client`));let E=m(n,{entry:{main:[`webpack-hot-middleware/client?name=client&path=//localhost:${p}/__hmr__&${q}`]},output:{path:A},module:w(!1),plugins:[new P,new B({paths:[/\.d\.ts$/]}),L&&new L,D&&new D({fix:!0,threads:!0,files:[`${c.alias["@"]}/**/*.{${F}}`,g&&`${c.alias["@pkg"]}/**/*.{${F}}`].filter(Boolean),extensions:M,exclude:T,cache:!0,cacheLocation:`${x.lineCachePath}/.eslintcache`,lintDirtyModulesOnly:!0}),C&&new C({fix:!0,threads:!0,files:[`${c.alias["@"]}/**/*.{${R}}`,g&&`${c.alias["@pkg"]}/**/*.{${R}}`].filter(Boolean),extensions:O,exclude:T,cache:!0,cacheLocation:`${x.lineCachePath}/.stylelintcache`,lintDirtyModulesOnly:!0}),c.bar&&new S({handler(e,t,...o){let i=c.bar;v(e,i.name||"Build",o.length?`[${t}] ${o.join(" ")}`:"",i.color)}})].filter(Boolean)}),G=[E];j&&G.push(m(n,a));let I=s(G);I.compilers[0].hooks.done.tap("client-log",e=>{d(null,e)});let U=o(),z=i(),H=l(I,{writeToDisk:!1,index:"index.html",headers:()=>u,serverSideRender:j,lastModified:!0});if(U.use(H),U.use(r(I,{log:!1,path:"/__hmr__",heartbeat:2e3})),c.proxy&&f(U,c.proxy),e(x.mockPath)){let e=h(x.mockPath);U.use(e)}let J=`${E.output.path}/index.html`;U.all("/*",z.any(),function(e,t,o){if("GET"!==e.method)return o();{let e=H.context.outputFileSystem,o=e?.readFileSync?.(J);t.end(o)}});let K=U.listen(p,()=>{});process.on("exit",function(){H.close(b),K.close(b),K.closeAllConnections(),t(x.cachePath)}),_(()=>{process.exit(1)});
package/lib/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { default as paths, CUSTOMCONFIG, yarnArgv, routeDir } from './paths.mjs';
2
2
  export { APPTYPE, FRAMEWORK, PACKAGENAME, PACKAGEVERSION, coreName, isDev, isLibrary, isMicro, mainDirectory, } from './process-env.mjs';
3
- export { realResolve, resolveNodeModulesPath, resolveProgramPath } from './utils/index.mjs';
3
+ export { realResolve, resolveProgram } from './utils/index.mjs';
4
4
  export { default as log } from './utils/log.mjs';
5
5
  export { default as hasPkg } from './utils/has-pkg.mjs';
6
6
  export { default as osTmpDir } from './utils/os-tmp-dir.mjs';
@@ -13,4 +13,6 @@ export { default as jsxDomExpressions, type JsxDomExpressions, } from './options
13
13
  export { default as splitChunk, type OptimizationSplitChunksOptions, } from './options/split-chunk.mjs';
14
14
  export { default as Rule } from './rule.mjs';
15
15
  export type { VirtualModulePluginOption } from './plugin/virtual-module.mjs';
16
+ export declare const coreJsVersion: any;
17
+ export declare const loadModuleMeta: any;
16
18
  export type * from '../typings/global.js';
package/lib/index.mjs CHANGED
@@ -1 +1 @@
1
- export{default as paths,CUSTOMCONFIG,yarnArgv,routeDir}from"./paths.mjs";export{APPTYPE,FRAMEWORK,PACKAGENAME,PACKAGEVERSION,coreName,isDev,isLibrary,isMicro,mainDirectory}from"./process-env.mjs";export{realResolve,resolveNodeModulesPath,resolveProgramPath}from"./utils/index.mjs";export{default as log}from"./utils/log.mjs";export{default as hasPkg}from"./utils/has-pkg.mjs";export{default as osTmpDir}from"./utils/os-tmp-dir.mjs";export{yApiMock,yApiSchemaMock}from"./dev/mock.mjs";export{getIPv4,getPort}from"./dev/net.mjs";export{default as jsxDomExpressions}from"./options/jsx-dom-expressions.mjs";export{default as splitChunk}from"./options/split-chunk.mjs";export{default as Rule}from"./rule.mjs";
1
+ export{default as paths,CUSTOMCONFIG,yarnArgv,routeDir}from"./paths.mjs";export{APPTYPE,FRAMEWORK,PACKAGENAME,PACKAGEVERSION,coreName,isDev,isLibrary,isMicro,mainDirectory}from"./process-env.mjs";export{realResolve,resolveProgram}from"./utils/index.mjs";export{default as log}from"./utils/log.mjs";export{default as hasPkg}from"./utils/has-pkg.mjs";export{default as osTmpDir}from"./utils/os-tmp-dir.mjs";export{yApiMock,yApiSchemaMock}from"./dev/mock.mjs";export{getIPv4,getPort}from"./dev/net.mjs";export{default as jsxDomExpressions}from"./options/jsx-dom-expressions.mjs";export{default as splitChunk}from"./options/split-chunk.mjs";export{default as Rule}from"./rule.mjs";import o from"./cjs/index.cjs";let e=o.default;export const coreJsVersion=e.coreJsVersion;export const loadModuleMeta=e.loadModuleMeta;
@@ -1 +1 @@
1
- let e;import{CONFIG as s}from"./config.mjs";import o from"./options/modify-vars.mjs";import t from"./options/swcrc.mjs";import r,{CUSTOMCONFIG as a}from"./paths.mjs";import{getLightningCssTargets as n}from"./polyfills/targets.mjs";import{FRAMEWORK as l,isDev as i,isLibrary as m}from"./process-env.mjs";import d from"./rule.mjs";import c from"./utils/has-pkg.mjs";import{resolveNodeModulesPath as u,resolveProgramPath as p}from"./utils/index.mjs";import f from"./utils/svg-to-data-uri.mjs";import{comment as y,getCommentPath as g}from"./vm/docs.mjs";import v from"./vm/generate-doc.mjs";import j from"./options/css-extract.mjs";let x={loader:`${r.corePath}/loader/lightningcss.cjs`,options:{sourceMap:!!s.sourceMap,analyzeDependencies:!1,targets:n(),drafts:{nesting:!0,customMedia:!0},errorRecovery:!1,unusedSymbols:[],rem:!!s.rem}},h={loader:"less-loader",options:{sourceMap:!!s.sourceMap,lessOptions:{modifyVars:o,javascriptEnabled:!0}}},_=[...s.cssModules,`@moneko/${l}`,"neko-ui"].map(u),w=["components","example","mock","site","src","server"].map(p);function k(e){return[...w,...s.rulesInclude?.[e]?.map(u)||[]]}a&&w.push(p(a)),s.overrideResolve&&s.overrideResolve.override&&w.push(s.overrideResolve.override);let M=k("css"),O=k("js"),R=k("media"),b=k("wasm"),L=k("font");c("sass")&&(e={loader:"sass-loader",options:{implementation:await import("sass"),sassOptions:{}}});let P=m&&i&&{test:d.tsdoc,include:s.alias["@pkg"],exclude:[d.node_modules,d.__tests__],enforce:"pre",loader:`${r.corePath}/loader/ts-doc.cjs`,options:{comment:y,generateDoc:v,getCommentPath:g}},$=[{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:d.wasm,type:"webassembly/async",include:b},{test:d.txt,type:"asset/source"},{test:d.ico,type:"asset/inline",include:R},{test:d.svg,type:"asset/inline",generator:{dataUrl:e=>f(e.toString())},include:R},{test:d.image,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/images/[name][ext]"},include:R},{test:d.video,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[name][ext]"},include:R},{test:d.font,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[name][ext]"},include:L}],B=s.prefixJsLoader.filter(Boolean)||[];export default(o=>{let a={loader:"swc-loader",options:t(o)},n={loader:"css-loader",options:{modules:{auto:e=>{if(e){for(let s=0,o=_.length;s<o;s++)if(e.includes(_[s]))return d.css_module.test(e)}return d.node_modules_css_module.test(e)},localIdentName:"[path][name]_[local]",exportLocalsConvention:"dashesOnly",exportOnlyLocals:o},importLoaders:2}};return{noParse:d.no_parse,rules:[P,{oneOf:[...$,{test:d.js,use:[...B,a],include:O},{test:d.css,use:[j,"css-loader",x],include:M},e&&{test:d.scss,use:[j,n,x,e],include:M},{test:d.less,use:[j,n,x,h],include:M},{test:d.markdown,use:[...B,{loader:`${r.corePath}/loader/mdx.cjs`,options:s.mdx}],exclude:[d.node_modules]}].filter(Boolean)},...s.moduleRules].filter(Boolean)}});
1
+ let e;import{CONFIG as s}from"./config.mjs";import o from"./options/modify-vars.mjs";import t from"./options/swcrc.mjs";import r,{CUSTOMCONFIG as a}from"./paths.mjs";import{getLightningCssTargets as n}from"./polyfills/targets.mjs";import{FRAMEWORK as l,isDev as i,isLibrary as m}from"./process-env.mjs";import d from"./rule.mjs";import c from"./utils/has-pkg.mjs";import{node_modules as u,resolveProgram as p}from"./utils/index.mjs";import f from"./utils/svg-to-data-uri.mjs";import{comment as y,getCommentPath as g}from"./vm/docs.mjs";import v from"./vm/generate-doc.mjs";import j from"./options/css-extract.mjs";let x={loader:`${r.corePath}/loader/lightningcss.cjs`,options:{sourceMap:!!s.sourceMap,analyzeDependencies:!1,targets:n(),drafts:{nesting:!0,customMedia:!0},errorRecovery:!1,unusedSymbols:[],rem:!!s.rem}},h={loader:"less-loader",options:{sourceMap:!!s.sourceMap,lessOptions:{modifyVars:o,javascriptEnabled:!0}}},_=[...s.cssModules,`@moneko/${l}`,"neko-ui"].map(u),w=["components","example","mock","site","src","server"].map(p);function k(e){return[...w,...s.rulesInclude?.[e]?.map(u)||[]]}a&&w.push(p(a)),s.overrideResolve&&s.overrideResolve.override&&w.push(s.overrideResolve.override);let M=k("css"),O=k("js"),R=k("media"),b=k("wasm"),L=k("font");c("sass")&&(e={loader:"sass-loader",options:{implementation:await import("sass"),sassOptions:{}}});let P=m&&i&&{test:d.tsdoc,include:s.alias["@pkg"],exclude:[d.node_modules,d.__tests__],enforce:"pre",loader:`${r.corePath}/loader/ts-doc.cjs`,options:{comment:y,generateDoc:v,getCommentPath:g}},$=[{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:d.wasm,type:"webassembly/async",include:b},{test:d.txt,type:"asset/source"},{test:d.ico,type:"asset/inline",include:R},{test:d.svg,type:"asset/inline",generator:{dataUrl:e=>f(e.toString())},include:R},{test:d.image,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/images/[name][ext]"},include:R},{test:d.video,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[name][ext]"},include:R},{test:d.font,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[name][ext]"},include:L}],B=s.prefixJsLoader.filter(Boolean)||[];export default(o=>{let a={loader:"swc-loader",options:t(o)},n={loader:"css-loader",options:{modules:{auto:e=>{if(e){for(let s=0,o=_.length;s<o;s++)if(e.includes(_[s]))return d.css_module.test(e)}return d.node_modules_css_module.test(e)},localIdentName:"[path][name]_[local]",exportLocalsConvention:"dashesOnly",exportOnlyLocals:o},importLoaders:2}};return{noParse:d.no_parse,rules:[P,{oneOf:[...$,{test:d.js,use:[...B,a],include:O},{test:d.css,use:[j,"css-loader",x],include:M},e&&{test:d.scss,use:[j,n,x,e],include:M},{test:d.less,use:[j,n,x,h],include:M},{test:d.markdown,use:[...B,{loader:`${r.corePath}/loader/mdx.cjs`,options:s.mdx}],exclude:[d.node_modules]}].filter(Boolean)},...s.moduleRules].filter(Boolean)}});
@@ -1,4 +1,4 @@
1
- import{merge as e}from"webpack-merge";import{CONFIG as t}from"../config.mjs";import{PACKAGENAME as i,coreName as o}from"../process-env.mjs";import{resolveProgramPath as m}from"../utils/index.mjs";import{description as r,keywords as a}from"../vm/info.mjs";let{favicon:n=`node_modules/${o}/lib/options/favicon.ico`,template:l,...p}=t.htmlPluginOption||{},s=e({title:t.env?.PROJECTNAME||i.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:r,keywords:a},tags:[],favicon:n?m(n):n},p,l?{template:l?m(l):void 0}:{templateContent:function({htmlWebpackPlugin:{options:e}}){let t=e.tags,i="",o="";return t&&t.map(function(e){let{tag:t="script",textContent:m="",inject:r="head",...a}=e,n="";for(let e in a)Object.prototype.hasOwnProperty.call(a,e)&&(n+=`${e}="${a[e]}" `);let l=`<${t} ${n}>${m}</${t}>`;"body"===r?o+=l:i+=l}),`<!DOCTYPE html>
1
+ import{merge as e}from"webpack-merge";import{CONFIG as t}from"../config.mjs";import{PACKAGENAME as i,coreName as o}from"../process-env.mjs";import{resolveProgram as m}from"../utils/index.mjs";import{description as r,keywords as a}from"../vm/info.mjs";let{favicon:n=`node_modules/${o}/lib/options/favicon.ico`,template:l,...p}=t.htmlPluginOption||{},s=e({title:t.env?.PROJECTNAME||i.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:r,keywords:a},tags:[],favicon:n?m(n):n},p,l?{template:l?m(l):void 0}:{templateContent:function({htmlWebpackPlugin:{options:e}}){let t=e.tags,i="",o="";return t&&t.map(function(e){let{tag:t="script",textContent:m="",inject:r="head",...a}=e,n="";for(let e in a)Object.prototype.hasOwnProperty.call(a,e)&&(n+=`${e}="${a[e]}" `);let l=`<${t} ${n}>${m}</${t}>`;"body"===r?o+=l:i+=l}),`<!DOCTYPE html>
2
2
  <html lang="en">
3
3
  <head>
4
4
  <title>${e.title}</title>
@@ -20,6 +20,6 @@ export declare const getMinifyOption: (type?: MinifierType, options?: SwcMinifyO
20
20
  minify: typeof TerserPlugin.swcMinify;
21
21
  terserOptions?: SwcMinifyOptions | undefined;
22
22
  }) & {
23
- terserOptions: SwcMinifyOptions | TerserMinifyOptions;
23
+ terserOptions: any;
24
24
  };
25
25
  export {};
@@ -1 +1 @@
1
- import{merge as e}from"webpack-merge";import{CONFIG as r}from"../config.mjs";import o from"../paths.mjs";import t,{coreJsVersion as s}from"../polyfills/polyfills.mjs";import{isDev as m,isReact as a,isSolid as l,jsxImportSource as p}from"../process-env.mjs";let i=function(e){for(let r=0,o=Object.keys(e),t=o.length;r<t;r++)e[o[r]].transform=`${o[r]}/${e[o[r]].transform}`,e[o[r]].style&&(e[o[r]].style=`${o[r]}/${e[o[r]].style}`);return e}(r.importOnDemand||{}),c={include:t(),mode:"entry",coreJs:s};export default(t=>e({module:{type:"es6",resolveFully:!0},jsc:{parser:{syntax:"typescript",tsx:!0,decorators:!0,dynamicImport:!0},loose:!0,target:r.polyfill?void 0:"es2017",externalHelpers:!1,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,refresh:a&&m,development:m,importSource:p},optimizer:{simplify:!1}},experimental:{emitAssertForImportAttributes:!0,cacheRoot:o.swcCachePath,plugins:[["@moneko/transform-imports",i],l&&["@moneko/jsx-dom-expressions",{...r.jsxDomExpressions,generate:t?"ssr":"dom",hydratable:t}]].filter(Boolean)}},env:r.polyfill?c:void 0,sourceMaps:!0,parseMap:!0},"function"==typeof r.swcrc?r.swcrc(m):r.swcrc||{}));
1
+ import{merge as e}from"webpack-merge";import{CONFIG as r}from"../config.mjs";import o from"../paths.mjs";import{coreJsVersion as t}from"../index.mjs";import s from"../polyfills/polyfills.mjs";import{isDev as m,isReact as a,isSolid as p,jsxImportSource as i}from"../process-env.mjs";let l=function(e){for(let r=0,o=Object.keys(e),t=o.length;r<t;r++)e[o[r]].transform=`${o[r]}/${e[o[r]].transform}`,e[o[r]].style&&(e[o[r]].style=`${o[r]}/${e[o[r]].style}`);return e}(r.importOnDemand||{}),n={include:s(),mode:"entry",coreJs:t};export default(t=>e({module:{type:"es6",resolveFully:!0},jsc:{parser:{syntax:"typescript",tsx:!0,decorators:!0,dynamicImport:!0},loose:!0,target:r.polyfill?void 0:"es2017",externalHelpers:!1,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,refresh:a&&m,development:m,importSource:i},optimizer:{simplify:!1}},experimental:{emitAssertForImportAttributes:!0,cacheRoot:o.swcCachePath,plugins:[["@moneko/transform-imports",l],p&&["@moneko/jsx-dom-expressions",{...r.jsxDomExpressions,generate:t?"ssr":"dom",hydratable:t}]].filter(Boolean)}},env:r.polyfill?n:void 0,sourceMaps:!0,parseMap:!0},"function"==typeof r.swcrc?r.swcrc(m):r.swcrc||{}));
package/lib/paths.d.mts CHANGED
@@ -1,3 +1,5 @@
1
+ export declare const __filename: string;
2
+ export declare const __dirname: string;
1
3
  export declare const yarnArgv: Record<string, string> & {
2
4
  config?: string;
3
5
  };
@@ -10,10 +12,13 @@ export declare const yarnArgv: Record<string, string> & {
10
12
  */
11
13
  export declare const CUSTOMCONFIG: string | undefined;
12
14
  declare const paths: {
15
+ __dirname: string;
16
+ __filename: string;
13
17
  nodeModules: string;
14
18
  corePath: string;
15
19
  programPath: string;
16
20
  webpackCachePath: string;
21
+ lineCachePath: string;
17
22
  cachePath: string;
18
23
  httpCachePath: string;
19
24
  swcCachePath: string;
@@ -23,7 +28,6 @@ declare const paths: {
23
28
  pagesPath: string;
24
29
  componentsPath: string;
25
30
  mockPath: string;
26
- lineCachePath: string;
27
31
  };
28
32
  export declare const routeDir: string;
29
33
  export default paths;
package/lib/paths.mjs CHANGED
@@ -1 +1 @@
1
- import e from"url";let o=JSON.parse(process.env.npm_config_argv||'{"original":[]}').original;export const yarnArgv={};for(let e=0,t=o.length;e<t;e++){let t=o[e].split("=");Object.assign(yarnArgv,{[t[0]]:t[1]||!0})}export const CUSTOMCONFIG=process.env.npm_config_config||yarnArgv.config;let t=process.cwd(),c=`${t}/node_modules`,a={nodeModules:c,corePath:e.fileURLToPath(new URL(".",import.meta.url)),programPath:t,webpackCachePath:`${c}/.temp_cache`,cachePath:`${c}/.cache/.mo`,httpCachePath:`${c}/.cache/http`,swcCachePath:`${c}/.swc`,configPath:`${t}/config/index.ts`,customConfigPath:`${t}/config/${CUSTOMCONFIG}.ts`,coveragePath:`${t}/coverage/clover.xml`,pagesPath:`${t}/src/pages`,componentsPath:`${t}/components`,mockPath:`${t}/mock`,lineCachePath:`${c}/.cache`};export const routeDir="library"===process.env.APPTYPE?a.componentsPath:a.pagesPath;export default a;
1
+ import e from"url";import{dirname as t,resolve as o}from"path";let a=JSON.parse(process.env.npm_config_argv||'{"original":[]}').original;export const __filename=e.fileURLToPath(import.meta.url);export const __dirname=t(__filename);export const yarnArgv={};for(let e=0,t=a.length;e<t;e++){let t=a[e].split("=");Object.assign(yarnArgv,{[t[0]]:t[1]||!0})}export const CUSTOMCONFIG=process.env.npm_config_config||yarnArgv.config;let c=process.cwd(),r=o(c,"./node_modules"),n={__dirname,__filename,nodeModules:r,corePath:e.fileURLToPath(new URL(".",import.meta.url)),programPath:c,webpackCachePath:o(r,"./.temp_cache"),lineCachePath:o(r,"./.cache"),cachePath:o(r,"./.cache/.mo"),httpCachePath:o(r,"./.cache/http"),swcCachePath:o(r,"./.swc"),configPath:o(c,"./config/index.ts"),customConfigPath:o(c,`./config/${CUSTOMCONFIG}.ts`),coveragePath:o(c,"./coverage/clover.xml"),pagesPath:o(c,"./src/pages"),componentsPath:o(c,"./components"),mockPath:o(c,"./mock")};export const routeDir="library"===process.env.APPTYPE?n.componentsPath:n.pagesPath;export default n;
@@ -1 +1 @@
1
- import{Buffer as s}from"buffer";import{loadFileSync as t}from"@moneko/mdx";import{transform as i}from"lightningcss";import o from"webpack";let{sources:{RawSource:n,SourceMapSource:e},ModuleFilenameHelpers:{matchObject:r}}=o,a="lightning-css-minify",m=/\.css(?:\?.*)?$/i,{name:p,version:f}=JSON.parse(t(`${process.cwd()}/package.json`)||"{}");export class LightningCssMinifyPlugin{constructor(s={}){let{implementation:t,...o}=s;if(t&&"function"!=typeof t.transform)throw TypeError(`[LightningCssMinifyPlugin]: implementation.transform must be an 'lightningcss' transform function. Received ${typeof t.transform}`);this.transform=t?.transform??i,this.options=o}apply(s){let t=JSON.stringify({name:p,version:f,options:this.options});s.hooks.compilation.tap(a,s=>{s.hooks.chunkHash.tap(a,(s,i)=>i.update(t)),s.hooks.processAssets.tapPromise({name:a,stage:s.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,additionalAssets:!0},async()=>await this.transformAssets(s)),s.hooks.statsPrinter.tap(a,s=>{s.hooks.print.for("asset.info.minimized").tap(a,(s,{green:t,formatFlag:i})=>s&&t&&i?t(i("minimized")):void 0)})})}async transformAssets(t){let{options:{devtool:i}}=t.compiler,{include:o,exclude:a,test:p,sourceMap:f=!!(i&&i.includes("source-map")),...c}=this.options,l=t.getAssets().filter(s=>!s.info.minimized&&(p||m).test(s.name)&&r({include:o,exclude:a},s.name));await Promise.all(l.map(async i=>{let o;let{source:r,map:a}=i.source.sourceAndMap(),m=r.toString(),p="string"==typeof r?s.from(r):r,l=this.transform({filename:i.name,code:p,minify:!0,sourceMap:f,...c}),g=l.code.toString();o=f?new e(g,i.name,JSON.parse(l.map.toString()),m,a,!0):new n(g),t.updateAsset(i.name,o,{...i.info,minimized:!0})}))}}
1
+ import{Buffer as s}from"buffer";import{transform as t}from"lightningcss";import i from"webpack";import{loadModuleMeta as n,paths as o}from"../index.mjs";let{sources:{RawSource:e,SourceMapSource:r},ModuleFilenameHelpers:{matchObject:a}}=i,m="lightning-css-minify",p=/\.css(?:\?.*)?$/i,{name:f,version:c}=n(`${o.programPath}/package.json`);export class LightningCssMinifyPlugin{constructor(s={}){let{implementation:i,...n}=s;if(i&&"function"!=typeof i.transform)throw TypeError(`[LightningCssMinifyPlugin]: implementation.transform must be an 'lightningcss' transform function. Received ${typeof i.transform}`);this.transform=i?.transform??t,this.options=n}apply(s){let t=JSON.stringify({name:f,version:c,options:this.options});s.hooks.compilation.tap(m,s=>{s.hooks.chunkHash.tap(m,(s,i)=>i.update(t)),s.hooks.processAssets.tapPromise({name:m,stage:s.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,additionalAssets:!0},async()=>await this.transformAssets(s)),s.hooks.statsPrinter.tap(m,s=>{s.hooks.print.for("asset.info.minimized").tap(m,(s,{green:t,formatFlag:i})=>s&&t&&i?t(i("minimized")):void 0)})})}async transformAssets(t){let{options:{devtool:i}}=t.compiler,{include:n,exclude:o,test:m,sourceMap:f=!!(i&&i.includes("source-map")),...c}=this.options,l=t.getAssets().filter(s=>!s.info.minimized&&(m||p).test(s.name)&&a({include:n,exclude:o},s.name));await Promise.all(l.map(async i=>{let n;let{source:o,map:a}=i.source.sourceAndMap(),m=o.toString(),p="string"==typeof o?s.from(o):o,l=this.transform({filename:i.name,code:p,minify:!0,sourceMap:f,...c}),g=l.code.toString();n=f?new r(g,i.name,JSON.parse(l.map.toString()),m,a,!0):new e(g),t.updateAsset(i.name,n,{...i.info,minimized:!0})}))}}
@@ -3,8 +3,9 @@ export interface VirtualModulePluginOption {
3
3
  [key: string]: string | object;
4
4
  }
5
5
  export declare class VirtualModuleWebpackPlugin {
6
- private readonly options?;
7
- private hasTapped;
6
+ private virtualModules;
7
+ private options;
8
8
  constructor(options?: VirtualModulePluginOption);
9
+ private modify;
9
10
  apply(compiler: Compiler): void;
10
11
  }
@@ -1 +1 @@
1
- import o from"webpack-virtual-modules";import{isLibrary as t}from"../process-env.mjs";import{resolveNodeModulesPath as e}from"../utils/index.mjs";import{comment as r,docs as p}from"../vm/docs.mjs";import{examples as i}from"../vm/example.mjs";import{locales as m}from"../vm/locales.mjs";import s from"../vm/modules.mjs";import{route as a}from"../vm/routes.mjs";export class VirtualModuleWebpackPlugin{constructor(o={}){this.options=o,this.hasTapped=!1}apply(l){let n=this.options,f=new o(s);function c(o,t){f.writeModule(e(o),t||"")}f.apply(l),a.on("change",c),m.on("change",c),t&&(i.on("change",c),p.on("change",c),r.on("change",c)),l.hooks.compilation.tap("VirtualModuleWebpackPlugin",()=>{if(!this.hasTapped){for(let o in this.hasTapped=!0,n)if(Object.prototype.hasOwnProperty.call(n,o)){let t=n[o];c(o,"string"==typeof t?t:`export default ${JSON.stringify(t)}`)}for(let o of i)c(...o);for(let o of p)c(...o);for(let o of r)c(...o)}})}}
1
+ import o from"webpack-virtual-modules";import{isLibrary as t}from"../process-env.mjs";import{node_modules as e}from"../utils/index.mjs";import{comment as i,docs as s}from"../vm/docs.mjs";import{examples as r}from"../vm/example.mjs";import{locales as l}from"../vm/locales.mjs";import m from"../vm/modules.mjs";import{route as p}from"../vm/routes.mjs";import n from"../paths.mjs";export class VirtualModuleWebpackPlugin{constructor(t={}){this.virtualModules=new o(m),this.options={};let e={};for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o)){let i=t[o];Object.assign(e,{[o]:"string"==typeof i?i:`export default ${JSON.stringify(i)}`})}this.options=e}modify(o,t,i){let s=i||"",r=t.startsWith(n.nodeModules)?t:e(t),l=o?.inputFileSystem;for(;l&&l._inputFileSystem;)l=l._inputFileSystem;let m=l._virtualFiles?.[r];m&&m.contents===s||this.virtualModules.writeModule(r,s)}apply(o){this.virtualModules.apply(o);let e=(t,e)=>{this.modify(o,t,e)};p.on("change",e),l.on("change",e),t&&(r.on("change",e),s.on("change",e),i.on("change",e)),o.hooks.compilation.tap("VirtualModuleWebpackPlugin",()=>{for(let o in this.options)Object.prototype.hasOwnProperty.call(this.options,o)&&e(o,this.options[o]);for(let o of r)e(o[0],o[1]);for(let o of s)e(o[0],o[1]);for(let o of i)e(o[0],o[1])})}}
@@ -1,3 +1,2 @@
1
- export declare const coreJsVersion: any;
2
1
  declare function polyfills(): string[];
3
2
  export default polyfills;
@@ -1 +1 @@
1
- import o from"core-js-compat";import{getBrowsersTargets as r}from"./targets.mjs";import{resolve as e}from"path";import{loadFileSync as t}from"@moneko/mdx";let{version:s}=JSON.parse(t(e("node_modules/core-js/package.json"))||"{}");export const coreJsVersion=s.substring(0,s.indexOf(".",2));export default function(){return o({targets:r(),version:coreJsVersion}).list}
1
+ import r from"core-js-compat";import{getBrowsersTargets as t}from"./targets.mjs";import{coreJsVersion as o}from"../index.mjs";export default function(){return r({targets:t(),version:o}).list}
@@ -1,6 +1,7 @@
1
1
  import type { AppType, Framework } from './index.mjs';
2
2
  export declare const APPTYPE: AppType;
3
3
  export declare const FRAMEWORK: Framework;
4
+ export declare const NODE_ENV: string;
4
5
  export declare const isLibrary: boolean;
5
6
  export declare const isMicro: boolean;
6
7
  export declare const isMobile: boolean;
@@ -1 +1 @@
1
- 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;
1
+ export const APPTYPE=process.env.APPTYPE;export const FRAMEWORK=process.env.FRAMEWORK;export const NODE_ENV=process.env.NODE_ENV;export const isLibrary="library"===APPTYPE;export const isMicro="micro"===APPTYPE;export const isMobile="mobile"===APPTYPE;export const isReact="react"===FRAMEWORK;export const isSolid="solid"===FRAMEWORK;export const SSR="true"===process.env.SSR;export const mainDirectory=isLibrary?"site":"src";export const jsxImportSource={react:"react",solid:"solid-js/h"}[FRAMEWORK];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"===NODE_ENV;
@@ -1 +1 @@
1
- import{fileExists as o}from"@moneko/mdx";import{resolveNodeModulesPath as m}from"./index.mjs";export default function(r){return o(m(`${r}/package.json`))}
1
+ import{loadModuleMeta as r}from"../index.mjs";export default function(t){try{return r(`${t}/package.json`),!0}catch(r){return!1}}
@@ -1,16 +1,15 @@
1
1
  export declare function toUpperCaseString(string: string): string;
2
2
  type ProgramPath<T extends string> = `${T extends string ? T : string}`;
3
- type NodeModulesPath<T> = ProgramPath<`node_modules/${T extends string ? T : string}`>;
4
3
  /** 位于项目根目录下的位置
5
4
  * @param {string} src 路径
6
5
  * @returns {string} 位于项目根目录下的位置
7
6
  */
8
- export declare function resolveProgramPath<T extends string>(src: T): ProgramPath<T>;
7
+ export declare function resolveProgram<T extends string>(src: T): ProgramPath<T>;
9
8
  /** 位于项目根目录node_modules下的位置
10
- * @param {string} src 路径
9
+ * @param {string} name 路径
11
10
  * @returns {string} 位于项目根目录node_modules下的位置
12
11
  */
13
- export declare const resolveNodeModulesPath: <T extends string>(src: T) => `${`node_modules/${T extends string ? T : string}` extends infer T_1 ? T_1 extends `node_modules/${T extends string ? T : string}` ? T_1 extends string ? T_1 : string : never : never}`;
12
+ export declare function node_modules<T extends string>(name: T): `node_modules/${T}`;
14
13
  /** 获取模块真实入口位置
15
14
  * @param {string} url 路径
16
15
  * @returns {string} 模块真实入口路径
@@ -1 +1 @@
1
- import{resolve as t}from"path";import e from"./resolver-sync.mjs";import o from"../paths.mjs";export function toUpperCaseString(t){return t?.replaceAll(/\b\w/g,t=>t.toUpperCase()).replaceAll(/\./g," ")}export function resolveProgramPath(e){return t(o.programPath,`./${e}`)}export const resolveNodeModulesPath=e=>t(o.nodeModules,`./${e}`);export const realResolve=t=>e.resolveSync({},o.programPath,t)||t;export function isObject(t){let e=typeof t;return null!==t&&("object"===e||"function"===e)}export function isFunction(t){if(!isObject(t))return!1;let e=Object.prototype.toString.call(t);return"[object Function]"===e||"[object AsyncFunction]"===e||"[object GeneratorFunction]"===e||"[object Proxy]"===e}export function empty(){}
1
+ import{resolve as t}from"path";import e from"./resolver-sync.mjs";import o from"../paths.mjs";export function toUpperCaseString(t){return t?.replaceAll(/\b\w/g,t=>t.toUpperCase()).replaceAll(/\./g," ")}export function resolveProgram(e){return t(o.programPath,`./${e}`)}export function node_modules(e){return t(o.nodeModules,`./${e}`)}export const realResolve=t=>e.resolveSync({},o.programPath,t)||t;export function isObject(t){let e=typeof t;return null!==t&&("object"===e||"function"===e)}export function isFunction(t){if(!isObject(t))return!1;let e=Object.prototype.toString.call(t);return"[object Function]"===e||"[object AsyncFunction]"===e||"[object GeneratorFunction]"===e||"[object Proxy]"===e}export function empty(){}
@@ -1 +1 @@
1
- import t from"events";class e extends t{constructor(t={}){super(),this.data=t}setData(t,e){e!=this.data[t]&&(this.data[t]=e,this.emit("change",t,e))}getData(t){return this.data[t]}removeData(t){Object.prototype.hasOwnProperty.call(this.data,t)&&(delete this.data[t],this.emit("change",t,null))}[Symbol.iterator](){let t=Object.keys(this.data),e=0;return{next:()=>{if(e<t.length){let a=t[e++];return{value:[a,this.data[a]],done:!1}}return{value:void 0,done:!0}}}}}export default e;
1
+ import t from"events";class e extends t{constructor(t={}){super(),this.data=t}setData(t,e){this.data[t]!==e&&(this.data[t]=e,this.emit("change",t,e))}getData(t){return this.data[t]}removeData(t){Object.prototype.hasOwnProperty.call(this.data,t)&&(delete this.data[t],this.emit("change",t,null))}[Symbol.iterator](){let t=Object.keys(this.data),e=0;return{next:()=>{if(e<t.length){let a=t[e++];return{value:[a,this.data[a]],done:!1}}return{value:void 0,done:!0}}}}}export default e;
package/lib/utils/seo.mjs CHANGED
@@ -1 +1 @@
1
- import{join as m}from"path";import{saveFileSync as o,scanRouter as t,sitemap as r}from"@moneko/mdx";import{resolveProgramPath as e}from"./index.mjs";import{outputConfig as p}from"../common.mjs";import{CONFIG as i}from"../config.mjs";import{routeDir as s}from"../paths.mjs";import{isLibrary as f}from"../process-env.mjs";export default(()=>{let{domain:n,nojekyll:a,path:j}=i.seo||{},l=j&&e(j)||p?.path;if(!n||!l)return;let x=`https://${n}${i.basename}`;o(m(l,"CNAME"),n),o(m(l,"robots"),`Sitemap: ${x}/sitemap.txt`),o(m(l,"sitemap.txt"),r(s,x,t(s,f)).join("\n")),a&&o(m(l,".nojekyll"),"")});
1
+ import{join as m}from"path";import{saveFileSync as o,scanRouter as t,sitemap as r}from"@moneko/mdx";import{resolveProgram as e}from"./index.mjs";import{outputConfig as p}from"../common.mjs";import{CONFIG as i}from"../config.mjs";import{routeDir as s}from"../paths.mjs";import{isLibrary as f}from"../process-env.mjs";export default(()=>{let{domain:n,nojekyll:a,path:j}=i.seo||{},l=j&&e(j)||p?.path;if(!n||!l)return;let x=`https://${n}${i.basename}`;o(m(l,"CNAME"),n),o(m(l,"robots"),`Sitemap: ${x}/sitemap.txt`),o(m(l,"sitemap.txt"),r(s,x,t(s,f)).join("\n")),a&&o(m(l,".nojekyll"),"")});
@@ -0,0 +1,3 @@
1
+ import { type DotenvParseOutput } from 'dotenv';
2
+ declare function setupEnv(mode: string, type: string, framework: string): DotenvParseOutput;
3
+ export default setupEnv;
@@ -0,0 +1 @@
1
+ import{relative as r}from"path";import{config as t}from"dotenv";import o from"../paths.mjs";export default function(e,a,p){let n=[r(o.programPath,".env"),r(o.programPath,".env/.env"),r(o.programPath,`.env/.${"production"===e?"prod":"dev"}.env`)],m={NODE_ENV:e,APPTYPE:a,FRAMEWORK:p};return n.forEach(r=>{let o=t({path:r,override:!0}).parsed;o&&Object.assign(m,o)}),m}
@@ -1,4 +1,4 @@
1
1
  import ReactiveObject from '../utils/reactive-object.mjs';
2
2
  export declare const exampleModuleName = "@app/example";
3
3
  export declare const examples: ReactiveObject<Record<string, string>>;
4
- export declare function generatorDemo(): void;
4
+ export declare function generatorExample(): void;
@@ -1 +1 @@
1
- import{generateExample as e}from"@moneko/mdx";import{watchFiles as t}from"./utils.mjs";import o from"../paths.mjs";import{isDev as r,isLibrary as a}from"../process-env.mjs";import m from"../utils/reactive-object.mjs";import p from"../rule.mjs";export const exampleModuleName="@app/example";function s(){try{return JSON.parse(e(o.componentsPath,`${exampleModuleName}/`))}catch(e){return{}}}export const examples=new m(a?s():{});function l(e){let t={};for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&Object.assign(t,{[o]:`rr(() => import('${o}'))rr`});examples.setData(exampleModuleName,`export default ${JSON.stringify(t).replace(p.extract_func,"$1")}`)}l(examples.data);export function generatorDemo(){let e=s();for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&examples.setData(t,e[t]);l(examples.data)}a&&r&&t(o.componentsPath,/(?<!\/examples\/(.+)\.md)$/,generatorDemo);
1
+ import{generateExample as e}from"@moneko/mdx";import{watchFiles as t}from"./utils.mjs";import r from"../paths.mjs";import{isDev as o,isLibrary as m}from"../process-env.mjs";import p from"../utils/reactive-object.mjs";import a from"../rule.mjs";export const exampleModuleName="@app/example";function l(){if(!m)return{};let t=JSON.parse(e(r.componentsPath,`${exampleModuleName}/`)),o={};for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&Object.assign(o,{[e]:`rr(() => import('${e}'))rr`});return{...t,[`${exampleModuleName}/index.js`]:`export default ${JSON.stringify(o).replace(a.extract_func,"$1")}`}}export const examples=new p(l());export function generatorExample(){let e=l();for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&examples.setData(t,e[t])}m&&o&&t(r.componentsPath,/(?<!\/examples\/(.+)\.md)$/,generatorExample);
package/lib/vm/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,SSR as i}from"../process-env.mjs";import{resolveProgramPath as p,toUpperCaseString as m}from"../utils/index.mjs";let{description:n,author:a,repository:c,keywords:d}=JSON.parse(e(p("package.json"))||"{}"),f="string"==typeof a,l={name:t,projectName:m(t).replace(/-/g," "),ssr:i,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
+ import{CONFIG as r}from"../config.mjs";import{APPTYPE as e,PACKAGENAME as o,PACKAGEVERSION as t,SSR as s}from"../process-env.mjs";import{toUpperCaseString as i}from"../utils/index.mjs";import{loadModuleMeta as p,paths as m}from"../index.mjs";let{description:n,author:a,repository:c,keywords:d}=p(`${m.programPath}/package.json`),f="string"==typeof a,l={name:o,projectName:i(o).replace(/-/g," "),ssr:s,version:t,base:r.basename,type:e,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,17 +1,2 @@
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;
1
+ declare const normalModules: Record<string, string>;
2
+ export default normalModules;
@@ -1 +1 @@
1
- import{join as m}from"path";import{getAppEntry as o,getAppFallback as r,getAppMdxScope as e,getAppMergeRouter as p,getAppNormalizeCss as t,getAppPrefixRouter as a,getAppRem as s,getAppSuspense as i}from"@moneko/mdx";import f from"./coverage.mjs";import{docs as n,docsModuleName as l}from"./docs.mjs";import{exampleModuleName as x}from"./example.mjs";import c from"./info.mjs";import{locales as d,localesModuleName as g}from"./locales.mjs";import{route as j,routesModuleName as u}from"./routes.mjs";import{CONFIG as h}from"../config.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/index.mjs";export default{[D("@app/info")]:`export default ${JSON.stringify(c)}`,[D("@app/entry")]:o(m(h.alias["@"],"./index.ts"),!!h.rem,!!h.normalizeCss,k,z),[D("@app/rem")]:s(h.rem?.designSize||1680),[D("@app/fallback")]:r(h.fallbackCompPath),[D("@app/coverage")]:f(v.coveragePath),[D("@app/merge-router")]:p(),[D("@app/prefix-router")]:a(),[D("@app/normalize/index.css")]:t(),[D("@app/suspense/index.tsx")]:i(k,z),[D("@app/mdx-scope")]:e(b("site/mdx-scope.ts")),[D(u)]:j.getData(u),[D(x)]:"export default {}",[D(g)]:d.getData(g),[D(l)]:n.getData(l)};
1
+ import{join as e}from"path";import{getAppEntry as o,getAppFallback as p,getAppMdxScope as r,getAppMergeRouter as m,getAppNormalizeCss as t,getAppPrefixRouter as a,getAppRem as s,getAppSuspense as i}from"@moneko/mdx";import f from"./coverage.mjs";import{docs as n,docsModuleName as l}from"./docs.mjs";import c from"./info.mjs";import{locales as d,localesModuleName as x}from"./locales.mjs";import{route as g,routesModuleName as j}from"./routes.mjs";import{CONFIG as u}from"../config.mjs";import v from"../paths.mjs";import{APPTYPE as h,FRAMEWORK as k}from"../process-env.mjs";import{node_modules as y,resolveProgram as z}from"../utils/index.mjs";let D={[y("@app/env")]:`export default ${JSON.stringify(u.env)}`,[y("@app/info")]:`export default ${JSON.stringify(c)}`,[y("@app/entry")]:o(e(u.alias["@"],"./index.ts"),!!u.rem,!!u.normalizeCss,h,k),[y("@app/rem")]:s(u.rem?.designSize||1680),[y("@app/fallback")]:p(u.fallbackCompPath),[y("@app/coverage")]:f(v.coveragePath),[y("@app/merge-router")]:m(),[y("@app/prefix-router")]:a(),[y("@app/normalize/index.css")]:t(),[y("@app/suspense/index.tsx")]:i(h,k),[y("@app/mdx-scope")]:r(z("site/mdx-scope.ts")),[y(j)]:g.getData(j),[y(x)]:d.getData(x),[y(l)]:n.getData(l)};export default D;
package/package.json CHANGED
@@ -1,14 +1,11 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.11.1",
3
+ "version": "3.11.2",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
7
7
  "scripts": {
8
- "build": "rm -rf ./lib && tsc && swc src -d lib --strip-leading-paths -D",
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\"' _ {} \\;"
8
+ "build": "rm -rf ./lib && tsc && swc src -d lib --strip-leading-paths -D && node convert"
12
9
  },
13
10
  "keywords": [],
14
11
  "author": "moneko",
@@ -16,14 +13,16 @@
16
13
  "dependencies": {
17
14
  "@moneko/mdx": "0.1.26",
18
15
  "@moneko/transform-imports": "0.4.0",
19
- "@swc/core": "1.4.11",
16
+ "@swc/core": "1.4.14",
20
17
  "add-asset-html-webpack-plugin": "6.0.0",
18
+ "browserslist": "4.23.0",
21
19
  "chalk": "5.3.0",
22
20
  "chokidar": "3.6.0",
23
21
  "core-js": "3.36.1",
24
22
  "core-js-compat": "3.36.1",
25
- "cross-env": "7.0.3",
26
- "css-loader": "6.10.0",
23
+ "css-loader": "7.1.1",
24
+ "dotenv": "16.4.5",
25
+ "enhanced-resolve": "5.16.0",
27
26
  "express": "4.19.2",
28
27
  "html-webpack-plugin": "5.6.0",
29
28
  "http-proxy-middleware": "3.0.0",
@@ -33,15 +32,15 @@
33
32
  "mini-css-extract-plugin": "2.8.1",
34
33
  "mock-json-schema": "1.1.1",
35
34
  "multer": "1.4.5-lts.1",
36
- "style-loader": "3.3.4",
35
+ "style-loader": "4.0.0",
37
36
  "swc-loader": "0.2.6",
38
- "typescript": "5.3.3",
37
+ "terser-webpack-plugin": "5.3.10",
38
+ "typescript": "5.4.5",
39
39
  "webpack": "5.91.0",
40
- "webpack-bundle-analyzer": "4.10.1",
41
- "webpack-dev-middleware": "7.2.0",
40
+ "webpack-bundle-analyzer": "4.10.2",
41
+ "webpack-dev-middleware": "7.2.1",
42
42
  "webpack-hot-middleware": "2.26.1",
43
43
  "webpack-merge": "5.10.0",
44
- "webpack-node-externals": "3.0.0",
45
44
  "webpack-virtual-modules": "0.6.1",
46
45
  "xml2js": "0.6.2"
47
46
  },
@@ -49,8 +48,10 @@
49
48
  "@swc/cli": "0.3.12",
50
49
  "@types/express": "4.17.21",
51
50
  "@types/multer": "1.4.11",
52
- "sass": "1.72.0",
53
- "sass-loader": "14.1.1"
51
+ "@types/webpack-bundle-analyzer": "4.7.0",
52
+ "@types/webpack-hot-middleware": "2.25.9",
53
+ "sass": "1.75.0",
54
+ "sass-loader": "14.2.0"
54
55
  },
55
56
  "files": [
56
57
  "lib",
@@ -262,14 +262,14 @@ export declare type ConfigType = {
262
262
  /** 覆盖解析插件配置, 当设置为 `{}` 时为启用
263
263
  * @default false
264
264
  * @example
265
- * import { resolveProgramPath } from '@moneko/core';
265
+ * import { resolveProgram } from '@moneko/core';
266
266
  *
267
267
  * // 此时当 src 和 src-test 目录下有相同相对路径的文件时,
268
268
  * // 将优先使用 src-test 下的文件进行解析
269
269
  * const conf = {
270
270
  * overrideResolve: {
271
- * original: resolveProgramPath('src'), // 这里可以省略, 默认为 src 目录, 当为组件库时, 默认为 site 目录
272
- * override: resolveProgramPath('src-test'),
271
+ * original: resolveProgram('src'), // 这里可以省略, 默认为 src 目录, 当为组件库时, 默认为 site 目录
272
+ * override: resolveProgram('src-test'),
273
273
  * }
274
274
  * }
275
275
  */
@@ -1,3 +0,0 @@
1
- import type { Compiler } from 'webpack';
2
- declare function compilerListener(name: string, compiler: Compiler): Promise<unknown>;
3
- export default compilerListener;
@@ -1 +0,0 @@
1
- import o from"./log.mjs";export default function(r,e){return new Promise((n,t)=>{e.hooks.failed.tap(r,o=>{t(o)}),e.hooks.done.tap(r,r=>{r.hasErrors()||n(!0);for(let e=0,n=r.compilation.warnings.length;e<n;e++)o(r.compilation.warnings[e].message);for(let e=0,n=r.compilation.errors.length;e<n;e++)o(r.compilation.errors[e].message)})})}