@moneko/core 3.11.1-beta.10 → 3.11.1-beta.11

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/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 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,resolveProgramPath 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/paths.d.mts CHANGED
@@ -14,6 +14,7 @@ declare const paths: {
14
14
  corePath: string;
15
15
  programPath: string;
16
16
  webpackCachePath: string;
17
+ lineCachePath: string;
17
18
  cachePath: string;
18
19
  httpCachePath: string;
19
20
  swcCachePath: string;
@@ -23,7 +24,6 @@ declare const paths: {
23
24
  pagesPath: string;
24
25
  componentsPath: string;
25
26
  mockPath: string;
26
- lineCachePath: string;
27
27
  };
28
28
  export declare const routeDir: string;
29
29
  export default paths;
package/lib/paths.mjs CHANGED
@@ -1 +1 @@
1
- import e from"url";import{resolve as o}from"path";let t=JSON.parse(process.env.npm_config_argv||'{"original":[]}').original;export const yarnArgv={};for(let e=0,o=t.length;e<o;e++){let o=t[e].split("=");Object.assign(yarnArgv,{[o[0]]:o[1]||!0})}export const CUSTOMCONFIG=process.env.npm_config_config||yarnArgv.config;let a=process.cwd(),c=o(a,"./node_modules"),r={nodeModules:c,corePath:e.fileURLToPath(new URL(".",import.meta.url)),programPath:a,webpackCachePath:`${c}/.temp_cache`,cachePath:`${c}/.cache/.mo`,httpCachePath:`${c}/.cache/http`,swcCachePath:`${c}/.swc`,configPath:`${a}/config/index.ts`,customConfigPath:`${a}/config/${CUSTOMCONFIG}.ts`,coveragePath:`${a}/coverage/clover.xml`,pagesPath:`${a}/src/pages`,componentsPath:`${a}/components`,mockPath:`${a}/mock`,lineCachePath:`${c}/.cache`};export const routeDir="library"===process.env.APPTYPE?r.componentsPath:r.pagesPath;export default r;
1
+ import e from"url";import{resolve as o}from"path";let t=JSON.parse(process.env.npm_config_argv||'{"original":[]}').original;export const yarnArgv={};for(let e=0,o=t.length;e<o;e++){let o=t[e].split("=");Object.assign(yarnArgv,{[o[0]]:o[1]||!0})}export const CUSTOMCONFIG=process.env.npm_config_config||yarnArgv.config;let a=process.cwd(),c=o(a,"./node_modules"),r={nodeModules:c,corePath:e.fileURLToPath(new URL(".",import.meta.url)),programPath:a,webpackCachePath:o(c,"./.temp_cache"),lineCachePath:o(c,"./.cache"),cachePath:o(c,"./.cache/.mo"),httpCachePath:o(c,"./.cache/http"),swcCachePath:o(c,"./.swc"),configPath:o(a,"./config/index.ts"),customConfigPath:o(a,`./config/${CUSTOMCONFIG}.ts`),coveragePath:o(a,"./coverage/clover.xml"),pagesPath:o(a,"./src/pages"),componentsPath:o(a,"./components"),mockPath:o(a,"./mock")};export const routeDir="library"===process.env.APPTYPE?r.componentsPath:r.pagesPath;export default r;
@@ -3,7 +3,6 @@ export interface VirtualModulePluginOption {
3
3
  [key: string]: string | object;
4
4
  }
5
5
  export declare class VirtualModuleWebpackPlugin {
6
- private hasTapped;
7
6
  private virtualModules;
8
7
  private options;
9
8
  constructor(options?: VirtualModulePluginOption);
@@ -1 +1 @@
1
- import t from"webpack-virtual-modules";import{isLibrary as o}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 p from"../vm/modules.mjs";import{route as m}from"../vm/routes.mjs";import a from"../paths.mjs";export class VirtualModuleWebpackPlugin{constructor(o={}){this.virtualModules=new t,this.options={};let e={};for(let t in o)if(Object.prototype.hasOwnProperty.call(o,t)){let i=o[t];Object.assign(e,{[t]:"string"==typeof i?i:`export default ${JSON.stringify(i)}`})}this.options=e,this.hasTapped=!1}modify(t,o,i){let s=i||"",r=o.startsWith(a.nodeModules)?o:e(o),l=t?.inputFileSystem;for(;l&&l._inputFileSystem;)l=l._inputFileSystem;let p=l._virtualFiles[r];p&&p.contents===s||this.virtualModules.writeModule(r,s)}apply(t){this.virtualModules.apply(t);let e=(o,e)=>{this.modify(t,o,e)};m.on("change",e),l.on("change",e),o&&(r.on("change",e),s.on("change",e),i.on("change",e)),t.hooks.compilation.tap("VirtualModuleWebpackPlugin",()=>{if(!this.hasTapped){for(let t in this.hasTapped=!0,p)Object.prototype.hasOwnProperty.call(p,t)&&e(t,p[t]);for(let t in this.options)Object.prototype.hasOwnProperty.call(this.options,t)&&e(t,this.options[t]);for(let t of r)e(t[0],t[1]);for(let t of s)e(t[0],t[1]);for(let t of i)e(t[0],t[1])}})}}
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,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 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 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);
@@ -1 +1 @@
1
- import{join as o}from"path";import{getAppEntry as m,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 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 h from"../paths.mjs";import{APPTYPE as v,FRAMEWORK as k}from"../process-env.mjs";import{node_modules as z,resolveProgramPath as D}from"../utils/index.mjs";let b={[z("@app/info")]:`export default ${JSON.stringify(c)}`,[z("@app/entry")]:m(o(u.alias["@"],"./index.ts"),!!u.rem,!!u.normalizeCss,v,k),[z("@app/rem")]:s(u.rem?.designSize||1680),[z("@app/fallback")]:r(u.fallbackCompPath),[z("@app/coverage")]:f(h.coveragePath),[z("@app/merge-router")]:p(),[z("@app/prefix-router")]:a(),[z("@app/normalize/index.css")]:t(),[z("@app/suspense/index.tsx")]:i(v,k),[z("@app/mdx-scope")]:e(D("site/mdx-scope.ts")),[z(j)]:g.getData(j),[z(x)]:d.getData(x),[z(l)]:n.getData(l)};export default b;
1
+ import{join as m}from"path";import{getAppEntry as o,getAppFallback as e,getAppMdxScope as r,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 c,examples as x}from"./example.mjs";import d from"./info.mjs";import{locales as g,localesModuleName as j}from"./locales.mjs";import{route as u,routesModuleName as h}from"./routes.mjs";import{CONFIG as v}from"../config.mjs";import D from"../paths.mjs";import{APPTYPE as k,FRAMEWORK as z}from"../process-env.mjs";import{node_modules as b,resolveProgramPath as y}from"../utils/index.mjs";let C={[b("@app/info")]:`export default ${JSON.stringify(d)}`,[b("@app/entry")]:o(m(v.alias["@"],"./index.ts"),!!v.rem,!!v.normalizeCss,k,z),[b("@app/rem")]:s(v.rem?.designSize||1680),[b("@app/fallback")]:e(v.fallbackCompPath),[b("@app/coverage")]:f(D.coveragePath),[b("@app/merge-router")]:p(),[b("@app/prefix-router")]:a(),[b("@app/normalize/index.css")]:t(),[b("@app/suspense/index.tsx")]:i(k,z),[b("@app/mdx-scope")]:r(y("site/mdx-scope.ts")),[b(c)]:x.getData(c),[b(h)]:u.getData(h),[b(j)]:g.getData(j),[b(l)]:n.getData(l)};export default C;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.11.1-beta.10",
3
+ "version": "3.11.1-beta.11",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
@@ -48,6 +48,7 @@
48
48
  "@swc/cli": "0.3.12",
49
49
  "@types/express": "4.17.21",
50
50
  "@types/multer": "1.4.11",
51
+ "@types/webpack-hot-middleware": "2.25.9",
51
52
  "sass": "1.75.0",
52
53
  "sass-loader": "14.2.0"
53
54
  },
@@ -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)})})}