@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 +1 -1
- package/lib/paths.d.mts +1 -1
- package/lib/paths.mjs +1 -1
- package/lib/plugin/virtual-module.d.mts +0 -1
- package/lib/plugin/virtual-module.mjs +1 -1
- package/lib/vm/example.d.mts +1 -1
- package/lib/vm/example.mjs +1 -1
- package/lib/vm/modules.mjs +1 -1
- package/package.json +2 -1
- package/lib/utils/compiler-listener.d.mts +0 -3
- package/lib/utils/compiler-listener.mjs +0 -1
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
|
|
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
|
|
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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
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])})}}
|
package/lib/vm/example.d.mts
CHANGED
|
@@ -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
|
|
4
|
+
export declare function generatorExample(): void;
|
package/lib/vm/example.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{generateExample as e}from"@moneko/mdx";import{watchFiles as t}from"./utils.mjs";import
|
|
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/modules.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{join as
|
|
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.
|
|
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 +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)})})}
|