@moneko/core 3.9.22 → 3.10.0-beta.3

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.
@@ -1 +1 @@
1
- import e from"webpack-node-externals";import o from"webpackbar";import r from"../module.config.mjs";import{CUSTOMCONFIG as s}from"../paths.mjs";import{isLibrary as t}from"../process-env.mjs";import{resolveProgramPath as m}from"../utils/index.mjs";let a={entry:{main:m("site/ssr.tsx")},output:{path:m(`${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"]})],plugins:[new o({name:"Server"})],module:r(!0),target:"node"};export default a;
1
+ import e from"webpack";import o from"webpack-node-externals";import r from"../module.config.mjs";import{CUSTOMCONFIG as s}from"../paths.mjs";import{isLibrary as t}from"../process-env.mjs";import{resolveProgramPath as m}from"../utils/index.mjs";import a from"../utils/progress.mjs";let{ProgressPlugin:n}=e,l={entry:{main:m("site/ssr.tsx")},output:{path:m(`${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:[o({allowlist:["react","react-dom","solid-js","@app","@moneko"]})],plugins:[new n({handler(e,o){a(e,"Server",o)}})],module:r(!0),target:"node"};export default l;
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"webpackbar";import i from"./build/common.mjs";import t from"./build/server.mjs";import{CONFIG as s}from"./config.mjs";import n from"./module.config.mjs";import l from"./paths.mjs";import p from"./plugin/done.mjs";import{SSR as a}from"./process-env.mjs";import f from"./utils/compiler-listener.mjs";import c from"./utils/log.mjs";import u from"./utils/seo.mjs";let g=[m(i,{module:n(!1),plugins:[s.done&&new p({done:s.done}),s.bar&&new e(s.bar)].filter(Boolean)})];a&&g.push(m(i,t));let[j,w]=r(g).compilers,d=[f("client",j)];async function h(){r(g).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++)c(m.compilation.warnings[o].message);for(let o=0,r=m.compilation.errors.length;o<r;o++)c(m.compilation.errors[o].message)}}),await Promise.all(d),s.seo&&u()}w&&d.push(f("server",w)),await h(),process.on("exit",function(){o(l.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,d=[m(e,{module:s(!1),plugins:[t.done&&new l({done:t.done}),t.bar&&new g({handler(o,r){u(o,"Build",r)}})].filter(Boolean)})];p&&d.push(m(e,i));let[j,h]=r(d).compilers,w=[a("client",j)];async function b(){r(d).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 m from"webpack-hot-middleware";import{merge as l}from"webpack-merge";import n from"webpackbar";import a from"./build/server.mjs";import{commonConfig as p}from"./common.mjs";import{CONFIG as c}from"./config.mjs";import{PORT as d,devLog as u,headers as f}from"./dev/config.mjs";import h from"./dev/mock.mjs";import w from"./dev/proxy.mjs";import g from"./module.config.mjs";import x from"./paths.mjs";import{SSR as j,isLibrary as k,isReact as b}from"./process-env.mjs";import y from"./rule.mjs";import $ from"./utils/compiler-listener.mjs";import v from"./utils/has-pkg.mjs";import{empty as _,resolveProgramPath as P}from"./utils/index.mjs";let{HotModuleReplacementPlugin:S,WatchIgnorePlugin:D}=r,T=v("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,B=v("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,I=b&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,E=["js","jsx","ts","tsx","json","html","vue"],F=E.join(","),G=["css","scss","sass","less","ts","tsx","js","jsx"],M=G.join(","),O=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],R=new URLSearchParams({timeout:2e3,reload:!0,quiet:!0,noInfo:!0,overlay:!0,dynamicPublicPath:!0}).toString(),U=p.output.path;j&&(U=P(`${k?"docs":"dist"}/client`));let q=l(p,{entry:{main:[`webpack-hot-middleware/client?name=client&path=//localhost:${d}/__hmr__&${R}`]},output:{path:U},module:g(!1),plugins:[new S,new D({paths:[/\.d\.ts$/]}),I&&new I,B&&new B({fix:!0,threads:!0,files:[`${c.alias["@"]}/**/*.{${F}}`,k&&`${c.alias["@pkg"]}/**/*.{${F}}`].filter(Boolean),extensions:E,exclude:O,cache:!0,lintDirtyModulesOnly:!0}),T&&new T({fix:!0,threads:!0,files:[`${c.alias["@"]}/**/*.{${M}}`,k&&`${c.alias["@pkg"]}/**/*.{${M}}`].filter(Boolean),extensions:G,exclude:O,cache:!0,lintDirtyModulesOnly:!0}),c.bar&&new n(c.bar)].filter(Boolean)}),A=[q];j&&A.push(l(p,a));let[C,L]=r(A).compilers;C.hooks.done.tap("client",e=>{u(null,e)});let N=o(),z=i(),H=s(C,{writeToDisk:!1,index:"index.html",headers:()=>f,serverSideRender:j});if(N.use(H),N.use(m(C,{log:!1,path:"/__hmr__",heartbeat:2e3,ignoreUnaccepted:!1,ignoreDeclined:!0,ignoreErrored:!0})),c.proxy&&w(N,c.proxy),e(x.mockPath)){let e=h(x.mockPath);N.use(e)}let J=`${q.output.path}/index.html`;N.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=[$("client",C)];L&&(L.watch({aggregateTimeout:20,ignored:y.dev_watch_ignored,poll:1e3,stdin:!0},u),K.push($("server",L))),await Promise.all(K);let Q=N.listen(d,()=>{});process.on("exit",function(){Q.close(_),Q.closeAllConnections(),t(x.cachePath)}),process.on("SIGINT",function(){process.exit()});
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 p}from"./config.mjs";import{PORT as c,devLog as d,headers as u}from"./dev/config.mjs";import f from"./dev/mock.mjs";import h from"./dev/proxy.mjs";import w from"./module.config.mjs";import g from"./paths.mjs";import{SSR as x,isLibrary as j,isReact as k}from"./process-env.mjs";import b from"./rule.mjs";import y from"./utils/compiler-listener.mjs";import $ from"./utils/has-pkg.mjs";import{empty as v,resolveProgramPath as _}from"./utils/index.mjs";import P from"./utils/progress.mjs";let{HotModuleReplacementPlugin:S,ProgressPlugin:B,WatchIgnorePlugin:D}=r,T=$("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,I=$("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"],G=F.join(","),M=["css","scss","sass","less","ts","tsx","js","jsx"],O=M.join(","),R=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],U=new URLSearchParams({timeout:2e3,reload:!0,quiet:!0,noInfo:!0,overlay:!0,dynamicPublicPath:!0}).toString(),q=a.output.path;x&&(q=_(`${j?"docs":"dist"}/client`));let A=m(a,{entry:{main:[`webpack-hot-middleware/client?name=client&path=//localhost:${c}/__hmr__&${U}`]},output:{path:q},module:w(!1),plugins:[new S,new D({paths:[/\.d\.ts$/]}),E&&new E,I&&new I({fix:!0,threads:!0,files:[`${p.alias["@"]}/**/*.{${G}}`,j&&`${p.alias["@pkg"]}/**/*.{${G}}`].filter(Boolean),extensions:F,exclude:R,cache:!0,lintDirtyModulesOnly:!0}),T&&new T({fix:!0,threads:!0,files:[`${p.alias["@"]}/**/*.{${O}}`,j&&`${p.alias["@pkg"]}/**/*.{${O}}`].filter(Boolean),extensions:M,exclude:R,cache:!0,lintDirtyModulesOnly:!0}),p.bar&&new B({handler(e,t){P(e,"Build",t)}})].filter(Boolean)}),C=[A];x&&C.push(m(a,n));let[L,N]=r(C).compilers;L.hooks.done.tap("client",e=>{d(null,e)});let z=o(),H=i(),J=s(L,{writeToDisk:!1,index:"index.html",headers:()=>u,serverSideRender:x});if(z.use(J),z.use(l(L,{log:!1,path:"/__hmr__",heartbeat:2e3,ignoreUnaccepted:!1,ignoreDeclined:!0,ignoreErrored:!0})),p.proxy&&h(z,p.proxy),e(g.mockPath)){let e=f(g.mockPath);z.use(e)}let K=`${A.output.path}/index.html`;z.all("/*",H.any(),function(e,t,o){if("GET"!==e.method)return o();{let e=J.context.outputFileSystem,o=e?.readFileSync?.(K);t.end(o)}});let Q=[y("client",L)];N&&(N.watch({aggregateTimeout:20,ignored:b.dev_watch_ignored,poll:1e3,stdin:!0},d),Q.push(y("server",N))),await Promise.all(Q);let V=z.listen(c,()=>{});process.on("exit",function(){V.close(v),V.closeAllConnections(),t(g.cachePath)}),process.on("SIGINT",function(){process.exit()});
@@ -1 +1 @@
1
- function e(...t){let o=t.length,r=Array(o);for(let e=0;e<o;e++)r[e]=t[e];for(;this.firstChild;)this.removeChild(this.firstChild);for(let e=0,t=r.length;e<t;e++){let t=r[e];this.appendChild("string"==typeof t?document.createTextNode(t):t)}}Element.prototype.replaceChildren||(Element.prototype.replaceChildren=e),ShadowRoot.prototype.replaceChildren||(ShadowRoot.prototype.replaceChildren=e);
1
+ function e(...t){let o=t.length,r=Array.from({length:o});for(let e=0;e<o;e++)r[e]=t[e];for(;this.firstChild;)this.removeChild(this.firstChild);for(let e=0,t=r.length;e<t;e++){let t=r[e];this.appendChild("string"==typeof t?document.createTextNode(t):t)}}Element.prototype.replaceChildren||(Element.prototype.replaceChildren=e),ShadowRoot.prototype.replaceChildren||(ShadowRoot.prototype.replaceChildren=e);
@@ -0,0 +1,9 @@
1
+ /**
2
+ * 进度条
3
+ * @param {Number} num 当前进度 100进制
4
+ * @param {String} title 进度条标题(默认:下载中)
5
+ * @param {String} info 详细信息
6
+ * @constructor
7
+ */
8
+ declare function progress(num?: number, title?: string, info?: string): void;
9
+ export default progress;
@@ -0,0 +1 @@
1
+ import r from"readline";import o from"chalk";export default function(t=0,e="下载中: ",i=""){let n=Number.parseInt((24*t/100).toFixed()),s=o.bgBlueBright(Array.from({length:n},()=>" ").join(""))+o.bgGray(Array.from({length:24-n},()=>"⠂").join(""));r.cursorTo(process.stdout,0),process.stdout.write(e+s+" "+t+"% "+o.grey(i))}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.9.22",
3
+ "version": "3.10.0-beta.3",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
7
7
  "scripts": {
8
- "prebuild": "oxlint -D correctness -D restriction src",
8
+ "prebuild": "oxlint -c ./eslintrc.json -D correctness -D restriction src",
9
9
  "build": "rm -rf ./lib && tsc && swc src -d lib -D",
10
10
  "postbuild": "npm run cjs && npm run mjs",
11
11
  "cjs": "find ./lib/loader/ -type f -name \"*.js\" -execdir bash -c 'mv \"$1\" \"${1%.js}.cjs\"' _ {} \\;",
@@ -16,18 +16,19 @@
16
16
  "license": "MIT",
17
17
  "dependencies": {
18
18
  "@moneko/mdx": "0.1.26",
19
- "@swc/core": "1.3.104",
19
+ "@swc/core": "1.3.105",
20
20
  "add-asset-html-webpack-plugin": "6.0.0",
21
+ "chalk": "5.3.0",
21
22
  "chokidar": "3.5.3",
22
- "core-js": "3.35.0",
23
- "core-js-compat": "3.35.0",
23
+ "core-js": "3.35.1",
24
+ "core-js-compat": "3.35.1",
24
25
  "cross-env": "7.0.3",
25
- "css-loader": "6.9.0",
26
+ "css-loader": "6.9.1",
26
27
  "express": "4.18.2",
27
28
  "html-webpack-plugin": "5.6.0",
28
29
  "http-proxy-middleware": "2.0.6",
29
30
  "less": "4.2.0",
30
- "less-loader": "12.0.0",
31
+ "less-loader": "12.1.0",
31
32
  "lightningcss": "1.23.0",
32
33
  "mini-css-extract-plugin": "2.7.7",
33
34
  "mock-json-schema": "1.1.1",
@@ -36,21 +37,20 @@
36
37
  "swc-loader": "0.2.3",
37
38
  "swc-plugin-another-transform-imports": "0.2.7",
38
39
  "typescript": "5.3.3",
39
- "webpack": "5.89.0",
40
+ "webpack": "5.90.0",
40
41
  "webpack-bundle-analyzer": "4.10.1",
41
42
  "webpack-dev-middleware": "7.0.0",
42
43
  "webpack-hot-middleware": "2.26.0",
43
44
  "webpack-merge": "5.10.0",
44
45
  "webpack-node-externals": "3.0.0",
45
46
  "webpack-virtual-modules": "0.6.1",
46
- "webpackbar": "6.0.0",
47
47
  "xml2js": "0.6.2"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@swc/cli": "0.1.63",
51
51
  "@types/express": "4.17.21",
52
52
  "@types/multer": "1.4.11",
53
- "oxlint": "0.2.1",
53
+ "oxlint": "0.2.5",
54
54
  "sass": "1.70.0",
55
55
  "sass-loader": "14.0.0"
56
56
  },
@@ -1,5 +1,4 @@
1
1
  import VirtualModulesPlugin from 'webpack-virtual-modules';
2
- import WebpackBar from 'webpackbar';
3
2
  import type { BundleAnalyzerOption } from './bundle-analyzer.d';
4
3
  import type {
5
4
  JsxDomExpressions,
@@ -23,7 +22,6 @@ import type {
23
22
  } from 'webpack';
24
23
 
25
24
  export type { TerserMinifyOptions, SwcMinifyOptions };
26
- export type WebpackBarOptions = ConstructorParameters<typeof WebpackBar>[0];
27
25
  export type MinifierType = 'swc' | 'terser';
28
26
  export declare type AppType = 'mobile' | 'site' | 'backstage' | 'micro' | 'library';
29
27
  export declare type Framework = 'react' | 'solid';
@@ -327,7 +325,7 @@ export declare type ConfigType = {
327
325
  done?: DonePluginOption;
328
326
  mdx?: Omit<MdxOptions, 'value' | 'filepath'>;
329
327
  jsxDomExpressions?: JsxDomExpressions;
330
- bar?: Partial<WebpackBarOptions> | false;
328
+ bar?: { name?: string; color?: string } | false;
331
329
  /** 虚拟模块
332
330
  * @example
333
331
  * const conf = {