@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.
- package/lib/build/server.mjs +1 -1
- package/lib/build.mjs +1 -1
- package/lib/dev.mjs +1 -1
- package/lib/polyfills/replace-children.mjs +1 -1
- package/lib/utils/progress.d.mts +9 -0
- package/lib/utils/progress.mjs +1 -0
- package/package.json +10 -10
- package/typings/global.d.ts +1 -3
package/lib/build/server.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"webpack
|
|
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"
|
|
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
|
|
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 @@
|
|
|
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.
|
|
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.
|
|
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.
|
|
23
|
-
"core-js-compat": "3.35.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
53
|
+
"oxlint": "0.2.5",
|
|
54
54
|
"sass": "1.70.0",
|
|
55
55
|
"sass-loader": "14.0.0"
|
|
56
56
|
},
|
package/typings/global.d.ts
CHANGED
|
@@ -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?:
|
|
328
|
+
bar?: { name?: string; color?: string } | false;
|
|
331
329
|
/** 虚拟模块
|
|
332
330
|
* @example
|
|
333
331
|
* const conf = {
|