@moneko/core 3.9.17-beta.5 → 3.9.17-beta.6
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 +2 -2
- package/lib/utils.d.mts +1 -1
- package/lib/utils.mjs +1 -1
- package/package.json +3 -1
package/lib/dev.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import e from"chalk";import t from"webpack";import o from"webpack-node-externals";import s from"express";import
|
|
1
|
+
import e from"chalk";import t from"webpack";import o from"webpack-node-externals";import s from"express";import i from"cors";import a from"webpack-dev-middleware";import r from"webpack-hot-middleware";import{merge as l}from"webpack-merge";import n from"webpackbar";import{commonConfig as m}from"./common.mjs";import{CONFIG as p}from"./config.mjs";import{hasPkg as c}from"./has-pkg.mjs";import{getIPv4 as u,getPort as d}from"./net.mjs";import{SSR as f,isLibrary as h,isReact as w}from"./process-env.mjs";import{compilerListener as b,log as g,resolveProgramPath as k}from"./utils.mjs";import $ from"./module.config.mjs";let{HotModuleReplacementPlugin:j,WatchIgnorePlugin:x}=t,{yellow:v,green:y,grey:S,gray:_,bgBlue:B,bgGreenBright:T,blueBright:D,greenBright:P}=e,F=c("eslint-webpack-plugin"),M=c("stylelint-webpack-plugin");c("@moneko/mock");let N=M?(await import("stylelint-webpack-plugin")).default:null,O=F?(await import("eslint-webpack-plugin")).default:null,C=p.devServer.port||3e3,I=await d(C,65535,p.devServer.host),J=w&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default;p.devServer.port=I;let U="/"===p.basename,G=p.devServer.https?"https:":"http:",H=U?"":p.basename,L=p.devServer.port!==I&&_(`Port ${v(C)} is in use, trying ${y(I)} instead.
|
|
2
2
|
`);function Y(e){return`${G}//${"local"===e?p.devServer.host:u()}:${I}${H}`}let q=_("You application is running here:"),z=`${B(" Local ")} ${D(Y("local"))}
|
|
3
|
-
${T(" Network ")} ${P(Y("net"))}`,A=["js","jsx","ts","tsx","json","html","vue"],
|
|
3
|
+
${T(" Network ")} ${P(Y("net"))}`,A=["js","jsx","ts","tsx","json","html","vue"],E=A.join(","),K=["css","scss","sass","less","ts","tsx","js","jsx"],Q=K.join(","),R=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],V=[new x({paths:[/\.d\.ts$/]})].filter(Boolean),W=s();W.use(i());let X=l(m,{entry:{main:[`webpack-hot-middleware/client?path=http://localhost:${I}/__webpack_hmr&timeout=2000`,...m.entry.main]},output:{hotUpdateMainFilename:"updates/[fullhash].hot-update.json",hotUpdateChunkFilename:"updates/[id].[fullhash].hot-update.js"},module:$(!1),plugins:[...V,new j,J&&new J,O&&new O({fix:!0,threads:!0,files:[`${p.alias["@"]}/**/*.{${E}}`,h&&`${p.alias["@pkg"]}/**/*.{${E}}`].filter(Boolean),extensions:A,exclude:R,cache:!0,lintDirtyModulesOnly:!0}),N&&new N({fix:!0,threads:!0,files:[`${p.alias["@"]}/**/*.{${Q}}`,h&&`${p.alias["@pkg"]}/**/*.{${Q}}`].filter(Boolean),extensions:K,exclude:R,cache:!0,lintDirtyModulesOnly:!0}),p.bar&&new n(p.bar)].filter(Boolean)}),Z=[X];if(f){let e=l(m,{entry:{main:k("site/ssr.tsx")},output:{clean:!1,path:k("ssr"),library:{type:"commonjs2",umdNamedDefine:!1},filename:"[name].cjs",chunkFilename:"[name].cjs",globalObject:"global"},externals:[o()],module:$(!0),target:"node",plugins:[...V,new n({name:"Server"})].filter(Boolean)});Z.push(e)}let ee=t(Z),et=ee.compilers.find(e=>"web"===e.options.target),eo=ee.compilers.find(e=>"node"===e.options.target);W.use(a(et,{publicPath:X.output.publicPath,stats:X.stats,writeToDisk:!0})),W.use(r(et,{log:!1,path:"/__webpack_hmr",heartbeat:2e3})),eo&&eo.watch({aggregateTimeout:20,ignored:/node_modules(?![\\/]@app)/,poll:1e3,stdin:!0},function(e,t){!e&&t&&(process.stdout.write("\x1b[2J\x1b[3J\x1b[H"),g([q,"",z,"",S(`Compiled successfully in ${y(`${t.endTime-t.startTime}ms`)}`)]))}),await Promise.all([b("client",et),eo&&b("server",eo)].filter(Boolean)),W.listen(I,()=>{L&&g(L)}),process.on("exit",function(){}),process.on("SIGINT",()=>{process.exit()});
|
package/lib/utils.d.mts
CHANGED
|
@@ -24,5 +24,5 @@ export declare const realResolve: (url: string) => string;
|
|
|
24
24
|
export declare function isObject(target: unknown): target is object;
|
|
25
25
|
export declare function isFunction(target: unknown): target is (...args: unknown[]) => unknown;
|
|
26
26
|
export declare function empty(): void;
|
|
27
|
-
export declare
|
|
27
|
+
export declare function compilerListener(name: string, compiler: Compiler): Promise<unknown>;
|
|
28
28
|
export {};
|
package/lib/utils.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{resolve as o}from"path";import r from"readline";import{saveFileSync as t}from"@moneko/mdx";import{transformFileSync as e}from"@swc/core";import n from"./paths.mjs";import s from"./resolver-sync.mjs";export function esm(o,...r){let t=o.raw[0];for(let e=0;e<r.length;e++)t+=r[e]+o.raw[e+1];return`data:text/javascript;base64,${Buffer.from(t).toString("base64")}`}let c={inputSourceMap:!1,sourceMaps:!1,module:{type:"es6"},jsc:{parser:{syntax:"typescript"},loose:!1}};export function log(o){Array.isArray(o)?o.forEach(o=>{log(`${o}
|
|
2
|
-
`)}):(r.cursorTo(process.stdout,0),process.stdout.write(o))}export function tfc(o){return e(o,c).code||"{}"}export function readConf(o,r){let e=`${n.cachePath}/${r}.mjs`;return t(e,tfc(o)),import(e)}export function toUpperCaseString(o){return o?.replace(/\b\w/g,o=>o.toUpperCase()).replace(/\./g," ")}export function resolveProgramPath(r){return o(n.programPath,`./${r}`)}export const resolveNodeModulesPath=o=>`${n.nodeModules}/${o}`;export const realResolve=o=>s.resolveSync({},n.programPath,o)||o;export function isObject(o){let r=typeof o;return null!==o&&("object"==r||"function"==r)}export function isFunction(o){if(!isObject(o))return!1;let r=Object.prototype.toString.call(o);return"[object Function]"==r||"[object AsyncFunction]"==r||"[object GeneratorFunction]"==r||"[object Proxy]"==r}export function empty(){}export
|
|
2
|
+
`)}):(r.cursorTo(process.stdout,0),process.stdout.write(o))}export function tfc(o){return e(o,c).code||"{}"}export function readConf(o,r){let e=`${n.cachePath}/${r}.mjs`;return t(e,tfc(o)),import(e)}export function toUpperCaseString(o){return o?.replace(/\b\w/g,o=>o.toUpperCase()).replace(/\./g," ")}export function resolveProgramPath(r){return o(n.programPath,`./${r}`)}export const resolveNodeModulesPath=o=>`${n.nodeModules}/${o}`;export const realResolve=o=>s.resolveSync({},n.programPath,o)||o;export function isObject(o){let r=typeof o;return null!==o&&("object"==r||"function"==r)}export function isFunction(o){if(!isObject(o))return!1;let r=Object.prototype.toString.call(o);return"[object Function]"==r||"[object AsyncFunction]"==r||"[object GeneratorFunction]"==r||"[object Proxy]"==r}export function empty(){}export function compilerListener(o,r){return new Promise((t,e)=>{r.hooks.failed.tap(o,o=>{e(o)}),r.hooks.done.tap(o,o=>{o.hasErrors()||t(!0),o.hasErrors()&&o.compilation.errors.forEach(o=>{log(o.message)}),o.hasWarnings()&&o.compilation.warnings.forEach(o=>log(o.message))})})}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.9.17-beta.
|
|
3
|
+
"version": "3.9.17-beta.6",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -14,9 +14,11 @@
|
|
|
14
14
|
"author": "moneko",
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
|
+
"@loadable/webpack-plugin": "5.15.2",
|
|
17
18
|
"@moneko/mdx": "0.1.23",
|
|
18
19
|
"@swc/core": "1.3.101",
|
|
19
20
|
"add-asset-html-webpack-plugin": "6.0.0",
|
|
21
|
+
"chokidar": "3.5.3",
|
|
20
22
|
"core-js": "3.34.0",
|
|
21
23
|
"core-js-compat": "3.34.0",
|
|
22
24
|
"cors": "2.8.5",
|