@moneko/core 3.11.1-beta.0 → 3.11.1

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 o}from"@moneko/mdx";import m from"webpack";import{merge as r}from"webpack-merge";import e from"./build/common.mjs";import i from"./build/server.mjs";import{CONFIG as s}from"./config.mjs";import t from"./module.config.mjs";import n from"./paths.mjs";import p from"./plugin/done.mjs";import{SSR as l}from"./process-env.mjs";import f from"./utils/compiler-listener.mjs";import a from"./utils/seo.mjs";import c from"./utils/progress.mjs";import{empty as u}from"./utils/index.mjs";let{ProgressPlugin:d}=m,j=[r(e,{module:t(!1),plugins:[s.done&&new p({done:s.done}),s.bar&&new d({handler(o,m,...r){let e=s.bar;c(o,e.name||"Build",r.length?`[${m}] ${r.join(" ")}`:"",e.color)}})].filter(Boolean)})];l&&j.push(r(e,i));let[g,h]=m(j).compilers,b=[f("client",g)];async function w(){g.run(u),await Promise.all(b),s.seo&&a()}h&&b.push(f("server",h)),await w(),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 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)});
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 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 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,M=y("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,T=k&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,E=["js","jsx","ts","tsx","json","html","vue"],F=E.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=n.output.path;j&&(A=_(`${x?"docs":"dist"}/client`));let G=m(n,{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$/]}),T&&new T,M&&new M({fix:!0,threads:!0,files:[`${c.alias["@"]}/**/*.{${F}}`,x&&`${c.alias["@pkg"]}/**/*.{${F}}`].filter(Boolean),extensions:E,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(n,a));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,lastModified:!0});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:300,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 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 +1 @@
1
- import o from"webpack-virtual-modules";import{node_modules as t}from"../utils/index.mjs";import{comment as e,docs as i}from"../vm/docs.mjs";import{examples as l}from"../vm/example.mjs";import{locales as s}from"../vm/locales.mjs";import p from"../vm/modules.mjs";import{route as r}from"../vm/routes.mjs";export class VirtualModuleWebpackPlugin{constructor(o={}){this.options=o,this.hasTapped=!1}apply(m){let n=this.options,a=new o(p);function f(o,e){let i=e||"",l=t(o),s=m.inputFileSystem;for(;s&&s._inputFileSystem;)s=s._inputFileSystem;let p=s._virtualFiles[l];p&&p.contents===i||(console.log("change: ",l),a.writeModule(l,i))}a.apply(m),r.on("change",f),s.on("change",f),l.on("change",f),i.on("change",f),e.on("change",f),m.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];f(o,"string"==typeof t?t:`export default ${JSON.stringify(t)}`)}for(let o of l)f(...o);for(let o of i)f(...o);for(let o of e)f(...o)}})}}
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)}})}}
@@ -11,7 +11,6 @@ export declare function resolveProgramPath<T extends string>(src: T): ProgramPat
11
11
  * @returns {string} 位于项目根目录node_modules下的位置
12
12
  */
13
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}`;
14
- export declare function node_modules<T extends string>(name: T): `node_modules/${T}`;
15
14
  /** 获取模块真实入口位置
16
15
  * @param {string} url 路径
17
16
  * @returns {string} 模块真实入口路径
@@ -1 +1 @@
1
- import{resolve as e}from"path";import o from"./resolver-sync.mjs";import t from"../paths.mjs";export function toUpperCaseString(e){return e?.replaceAll(/\b\w/g,e=>e.toUpperCase()).replaceAll(/\./g," ")}export function resolveProgramPath(o){return e(t.programPath,`./${o}`)}export const resolveNodeModulesPath=o=>e(t.nodeModules,`./${o}`);export function node_modules(o){return e(t.nodeModules,`./${o}`)}export const realResolve=e=>o.resolveSync({},t.programPath,e)||e;export function isObject(e){let o=typeof e;return null!==e&&("object"===o||"function"===o)}export function isFunction(e){if(!isObject(e))return!1;let o=Object.prototype.toString.call(e);return"[object Function]"===o||"[object AsyncFunction]"===o||"[object GeneratorFunction]"===o||"[object Proxy]"===o}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 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 +1 @@
1
- import t from"events";class e extends t{constructor(t={}){super(),this.data=t}setData(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;
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 +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 m}from"../process-env.mjs";import p from"../utils/reactive-object.mjs";import a from"../rule.mjs";export const exampleModuleName="@app/example";function n(){if(!m)return{};let t={},r=JSON.parse(e(o.componentsPath,`${exampleModuleName}/`));for(let e in r)Object.prototype.hasOwnProperty.call(r,e)&&Object.assign(t,{[e]:`rr(() => import('${e}'))rr`});return{[exampleModuleName]:`export default ${JSON.stringify(t).replace(a.extract_func,"$1")}`,...r}}export const examples=new p(n());export function generatorDemo(){let e=n();for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&examples.setData(t,e[t])}m&&r&&t(o.componentsPath,/(?<!\/examples\/(.+)\.md)$/,generatorDemo);
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,2 +1,17 @@
1
- declare const normalModules: Record<string, string>;
2
- export default normalModules;
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 +1 @@
1
- import{join as o}from"path";import{getAppEntry as e,getAppFallback as r,getAppMdxScope as m,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{examples as c}from"./example.mjs";import d from"./info.mjs";import{locales as j,localesModuleName as x}from"./locales.mjs";import{route as g,routesModuleName as u}from"./routes.mjs";import{CONFIG as h}from"../config.mjs";import b from"../paths.mjs";import{APPTYPE as v,FRAMEWORK as y}from"../process-env.mjs";import{node_modules as O,resolveProgramPath as k}from"../utils/index.mjs";let z={[O("@app/info")]:`export default ${JSON.stringify(d)}`,[O("@app/entry")]:e(o(h.alias["@"],"./index.ts"),!!h.rem,!!h.normalizeCss,v,y),[O("@app/rem")]:s(h.rem?.designSize||1680),[O("@app/fallback")]:r(h.fallbackCompPath),[O("@app/coverage")]:f(b.coveragePath),[O("@app/merge-router")]:p(),[O("@app/prefix-router")]:a(),[O("@app/normalize/index.css")]:t(),[O("@app/suspense/index.tsx")]:i(v,y),[O("@app/mdx-scope")]:m(k("site/mdx-scope.ts")),[O(u)]:g.getData(u),[O(x)]:j.getData(x),[O(l)]:n.getData(l)};for(let o in c.data)Object.prototype.hasOwnProperty.call(c.data,o)&&Object.assign(z,{[O(o)]:c.data[o]});export default z;
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)};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.11.1-beta.0",
3
+ "version": "3.11.1",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
@@ -36,7 +36,7 @@
36
36
  "style-loader": "3.3.4",
37
37
  "swc-loader": "0.2.6",
38
38
  "typescript": "5.3.3",
39
- "webpack": "5.90.2",
39
+ "webpack": "5.91.0",
40
40
  "webpack-bundle-analyzer": "4.10.1",
41
41
  "webpack-dev-middleware": "7.2.0",
42
42
  "webpack-hot-middleware": "2.26.1",