@moneko/core 3.9.17-beta.15 → 3.9.17-beta.17
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/config.mjs +1 -1
- package/lib/dev/config.mjs +3 -3
- package/lib/dev.mjs +1 -1
- package/lib/index.d.mts +4 -0
- package/lib/index.mjs +1 -1
- package/lib/module.config.mjs +1 -1
- package/lib/options/html-plugin-option.mjs +2 -1
- package/lib/options/jsx-dom-expressions.d.mts +10 -0
- package/lib/options/jsx-dom-expressions.mjs +1 -0
- package/lib/options/split-chunk.d.mts +4 -0
- package/lib/options/split-chunk.mjs +1 -0
- package/lib/plugin/add-entry-attribute.d.mts +1 -2
- package/lib/plugin/add-entry-attribute.mjs +1 -1
- package/lib/plugin/virtual-module.d.mts +2 -3
- package/lib/plugin/virtual-module.mjs +1 -1
- package/lib/plugins.config.mjs +1 -1
- package/lib/rule.d.mts +22 -0
- package/lib/rule.mjs +1 -0
- package/lib/vm/info.d.mts +1 -1
- package/package.json +2 -2
- package/typings/global.d.ts +9 -140
package/lib/config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fileExists as e}from"@moneko/mdx";import{merge as
|
|
1
|
+
import{fileExists as e}from"@moneko/mdx";import{merge as o}from"webpack-merge";import t from"./options/jsx-dom-expressions.mjs";import s from"./options/split-chunk.mjs";import a,{CUSTOMCONFIG as i}from"./paths.mjs";import{FRAMEWORK as r,PACKAGENAME as l,isDev as n,isLibrary as m,isMobile as p,isSolid as c,jsxImportSource as u,mainDirectory as d}from"./process-env.mjs";import{isFunction as h,resolveProgramPath as f}from"./utils/index.mjs";import g from"./utils/log.mjs";import x from"./utils/read-conf.mjs";let P=["@moneko","neko-ui","antd","@antv","katex","font-pingfang-sc","font-pingfang-tc","react-photo-view","react-markdown-editor-lite","schema-design","@app",".cache/http/data"],v={devtool:n?"eval-cheap-module-source-map":"cheap-module-source-map",seo:!1,mode:"csr",bundleAnalyzer:!1,polyfill:!1,entry:{},minifier:{},sourceMap:{filename:"[file].map",publicPath:""},env:{NODE_ENV:process.env.NODE_ENV},basename:"/",publicPath:"/",rem:{designSize:p?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":f(d)},moduleRules:[],prefixJsLoader:[],cssModules:[],importOnDemand:{},proxy:{},cacheDirectory:a.webpackCachePath,devServer:{host:"localhost",port:3e3},htmlPluginOption:{},assetHtml:[],routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:s,runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:P,js:P,media:P,font:P,wasm:[]},mdx:{jsx:!1,development:n,jsxImportSource:u,providerImportSource:`@moneko/${r}/mdx`},jsxDomExpressions:{},bar:{name:"Client",color:"#6f42c1"},normalizeCss:!0,externalsPresets:{},buildHttp:{allowedUris:[],lockfileLocation:`${a.httpCachePath}/http.lock`,cacheLocation:`${a.httpCachePath}/data`,upgrade:!0},virtualModule:{}};c&&(v.jsxDomExpressions=t),m&&(v.alias=Object.assign(v.alias,{"@pkg":a.componentsPath,[l]:a.componentsPath}));let C=v,j={},k={};if(e(a.configPath)){let e=(await x(a.configPath,"index")).default;j=h(e)?e(process):e}if(i&&e(a.customConfigPath)){let e=(await x(a.customConfigPath,i)).default;k=h(e)?e(process):e}(!1===(C=o(C,j,k)).devtool||!1===C.sourceMap)&&(C.sourceMap=!1,C.devtool=!1),C.fixBrowserRouter&&C.htmlPluginOption&&(C.htmlPluginOption.tags||(C.htmlPluginOption.tags=[]),C.htmlPluginOption.tags.push({textContent:"(function(l) {if (l.search[1] === '/' ) {var decoded = l.search.slice(1).split('&').map(function(s) {return s.replace(/~and~/g, '&')}).join('?');window.history.replaceState(null, null,l.pathname.slice(0, -1) + decoded + l.hash);}}(window.location))"}));export const CONFIG=C;export const PUBLICPATH=CONFIG.publicPath||"/";global.NEKOCLICONFIG={CONFIG,CUSTOMCONFIG:i,log:g};
|
package/lib/dev/config.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
`);function g(
|
|
3
|
-
${c(" Network ")} ${$(g("net"))}`;export function devLog(o
|
|
1
|
+
import t from"chalk";import{getIPv4 as o,getPort as e}from"./net.mjs";import{CONFIG as r}from"../config.mjs";import s from"../utils/log.mjs";let{yellow:i,green:n,grey:l,gray:m,bgBlue:a,bgGreenBright:c,blueBright:p,greenBright:$}=t,u=r.devServer||{},f=u.port||3e3;export const PORT=await e(f,65535,u.host);u.port=PORT;let d="/"===r.basename?"":r.basename,T=u.port!==PORT&&m(`Port ${i(f)} is in use, trying ${n(PORT)} instead.
|
|
2
|
+
`);function g(t){return`http://${"local"===t?u.host:o()}:${PORT}${d}`}let h=m("You application is running here:"),x=`${a(" Local ")} ${p(g("local"))}
|
|
3
|
+
${c(" Network ")} ${$(g("net"))}`;export function devLog(t,o){!t&&o&&(process.stdout.write("\x1b[2J\x1b[3J\x1b[H"),s([h,"",x,"",l(`Compiled successfully in ${n(`${o.endTime-o.startTime}ms`)}`)]),T&&s(T))}export const headers={"Access-Control-Allow-Origin":"*"};
|
package/lib/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{directoryExists as e,removeDirAll as t}from"@moneko/mdx";import o from"cors";import i from"express";import r from"multer";import
|
|
1
|
+
import{directoryExists as e,removeDirAll as t}from"@moneko/mdx";import o from"cors";import i from"express";import r from"multer";import m from"webpack";import s from"webpack-dev-middleware";import l from"webpack-hot-middleware";import{merge as a}from"webpack-merge";import n from"webpackbar";import p from"./build/server.mjs";import{commonConfig as c}from"./common.mjs";import{CONFIG as d}from"./config.mjs";import{PORT as u,devLog as f,headers as h}from"./dev/config.mjs";import w from"./dev/mock.mjs";import g from"./dev/proxy.mjs";import x from"./module.config.mjs";import j from"./paths.mjs";import{SSR as k,isLibrary as b,isReact as y}from"./process-env.mjs";import v from"./rule.mjs";import $ from"./utils/compiler-listener.mjs";import _ from"./utils/has-pkg.mjs";import{resolveProgramPath as P}from"./utils/index.mjs";let S=_("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,D=_("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,T=y&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,B=["js","jsx","ts","tsx","json","html","vue"],I=B.join(","),E=["css","scss","sass","less","ts","tsx","js","jsx"],F=E.join(","),G=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],M=new URLSearchParams({timeout:2e3,reload:!0,quiet:!0,noInfo:!0,overlay:!0,dynamicPublicPath:!0}).toString(),O=c.output.path;k&&(O=P(`${b?"docs":"dist"}/client`));let R=a(c,{entry:{main:[`webpack-hot-middleware/client?name=client&path=//localhost:${u}/__hmr__&${M}`]},output:{path:O},module:x(!1),plugins:[T&&new T,D&&new D({fix:!0,threads:!0,files:[`${d.alias["@"]}/**/*.{${I}}`,b&&`${d.alias["@pkg"]}/**/*.{${I}}`].filter(Boolean),extensions:B,exclude:G,cache:!0,lintDirtyModulesOnly:!0}),S&&new S({fix:!0,threads:!0,files:[`${d.alias["@"]}/**/*.{${F}}`,b&&`${d.alias["@pkg"]}/**/*.{${F}}`].filter(Boolean),extensions:E,exclude:G,cache:!0,lintDirtyModulesOnly:!0}),d.bar&&new n(d.bar)].filter(Boolean)}),U=[R];k&&U.push(a(c,p));let[q,L]=m(U).compilers;q.hooks.done.tap("client",e=>{f(null,e)});let N=i(),z=r(),A=s(q,{writeToDisk:!1,index:"index.html",headers:()=>h,serverSideRender:k});if(N.use(o()),N.use(A),N.use(l(q,{log:!1,path:"/__hmr__",heartbeat:2e3,ignoreUnaccepted:!1,ignoreDeclined:!0,ignoreErrored:!0})),d.proxy&&g(N,d.proxy),e(j.mockPath)){let e=w(j.mockPath);N.use(e)}let C=`${R.output.path}/index.html`;N.all("/*",z.any(),function(e,t,o){if("GET"!==e.method)return o();{let e=A.context.outputFileSystem,o=e?.readFileSync?.(C);t.end(o)}});let H=[$("client",q)];L&&(L.watch({aggregateTimeout:20,ignored:v.dev_watch_ignored,poll:1e3,stdin:!0},f),H.push($("server",L))),await Promise.all(H),N.listen(u,()=>{}),process.on("exit",function(){t(j.cachePath)}),process.on("SIGINT",function(){process.exit()});
|
package/lib/index.d.mts
CHANGED
|
@@ -9,4 +9,8 @@ export type { OverrideResolverOption } from './plugin/override-resolve.mjs';
|
|
|
9
9
|
export { type YApiOption, type YApiOptionBySchema, yApiMock, yApiSchemaMock, type RequestFormData, type ProxyFuncType, type MockConfiguration, } from './dev/mock.mjs';
|
|
10
10
|
export type { ProxyConfig } from './dev/proxy.mjs';
|
|
11
11
|
export { getIPv4, getPort } from './dev/net.mjs';
|
|
12
|
+
export { default as jsxDomExpressions, type JsxDomExpressions, } from './options/jsx-dom-expressions.mjs';
|
|
13
|
+
export { default as splitChunk, type OptimizationSplitChunksOptions, } from './options/split-chunk.mjs';
|
|
14
|
+
export { default as Rule } from './rule.mjs';
|
|
15
|
+
export type { VirtualModulePluginOption } from './plugin/virtual-module.mjs';
|
|
12
16
|
export type * from '../typings/global.js';
|
package/lib/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{default as paths,CUSTOMCONFIG,yarnArgv,routeDir}from"./paths.mjs";export{APPTYPE,FRAMEWORK,PACKAGENAME,PACKAGEVERSION,coreName,isDev,isLibrary,isMicro,mainDirectory}from"./process-env.mjs";export{realResolve,resolveNodeModulesPath,resolveProgramPath}from"./utils/index.mjs";export{default as log}from"./utils/log.mjs";export{default as hasPkg}from"./utils/has-pkg.mjs";export{default as osTmpDir}from"./utils/os-tmp-dir.mjs";export{yApiMock,yApiSchemaMock}from"./dev/mock.mjs";export{getIPv4,getPort}from"./dev/net.mjs";
|
|
1
|
+
export{default as paths,CUSTOMCONFIG,yarnArgv,routeDir}from"./paths.mjs";export{APPTYPE,FRAMEWORK,PACKAGENAME,PACKAGEVERSION,coreName,isDev,isLibrary,isMicro,mainDirectory}from"./process-env.mjs";export{realResolve,resolveNodeModulesPath,resolveProgramPath}from"./utils/index.mjs";export{default as log}from"./utils/log.mjs";export{default as hasPkg}from"./utils/has-pkg.mjs";export{default as osTmpDir}from"./utils/os-tmp-dir.mjs";export{yApiMock,yApiSchemaMock}from"./dev/mock.mjs";export{getIPv4,getPort}from"./dev/net.mjs";export{default as jsxDomExpressions}from"./options/jsx-dom-expressions.mjs";export{default as splitChunk}from"./options/split-chunk.mjs";export{default as Rule}from"./rule.mjs";
|
package/lib/module.config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
let e;import s from"mini-css-extract-plugin";import{CONFIG as
|
|
1
|
+
let e;import s from"mini-css-extract-plugin";import{CONFIG as o,PUBLICPATH as t}from"./config.mjs";import r from"./options/modify-vars.mjs";import a from"./options/swcrc.mjs";import n,{CUSTOMCONFIG as l}from"./paths.mjs";import{getLightningCssTargets as i}from"./polyfills/targets.mjs";import{FRAMEWORK as m,isDev as d,isLibrary as c,isMicro as p}from"./process-env.mjs";import u from"./rule.mjs";import f from"./utils/has-pkg.mjs";import{resolveNodeModulesPath as y,resolveProgramPath as g}from"./utils/index.mjs";import v from"./utils/svg-to-data-uri.mjs";import{comment as j,getCommentPath as x}from"./vm/docs.mjs";import h from"./vm/generate-doc.mjs";let _=p?t:"../",w={loader:s.loader,options:{publicPath:"/"!==_?_:"../"}},b={loader:`${n.corePath}/loader/lightningcss.cjs`,options:{sourceMap:!!o.sourceMap,analyzeDependencies:!1,targets:i(),drafts:{nesting:!0,customMedia:!0},errorRecovery:!1,unusedSymbols:[],rem:!!o.rem}};d&&(w="style-loader");let k=[...o.cssModules,`@moneko/${m}`,"neko-ui"].map(y),M=["components","example","mock","site","src","server"].map(g);function O(e){return M.concat(o.rulesInclude?.[e]?.map(y)||[])}l&&M.push(g(l)),o.overrideResolve&&o.overrideResolve.override&&M.push(o.overrideResolve.override);let P=O("css"),R=O("js"),L=O("media"),$=O("wasm"),B=O("font");f("sass")&&(e={loader:"sass-loader",options:{implementation:await import("sass"),sassOptions:{}}});let I=c&&d&&{test:u.tsdoc,include:o.alias["@pkg"],exclude:[u.node_modules,u.__tests__],enforce:"pre",loader:`${n.corePath}/loader/ts-doc.cjs`,options:{comment:j,generateDoc:h,getCommentPath:x}},Q=[{resourceQuery:/raw/i,type:"asset/source"},{resourceQuery:/url/i,type:"asset/resource",generator:{filename:e=>{let s=e.filename;return s&&s.endsWith("wasm?url")?"wasm/[name][ext]":"assets/[name][ext]"}}},{test:u.wasm,type:"webassembly/async",include:$},{test:u.txt,type:"asset/source"},{test:u.ico,type:"asset/inline",include:L},{test:u.svg,type:"asset/inline",generator:{dataUrl:e=>v(e.toString())},include:L},{test:u.image,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/images/[name][ext]"},include:L},{test:u.video,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[name][ext]"},include:L},{test:u.font,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[name][ext]"},include:B}],S=o.prefixJsLoader.filter(Boolean)||[];export default(s=>{let t={loader:"swc-loader",options:a(s)},l={loader:"css-loader",options:{modules:{auto:e=>{if(e){for(let s=0,o=k.length;s<o;s++)if(e.includes(k[s]))return u.css_module.test(e)}return u.node_modules_css_module.test(e)},localIdentName:"[path][name]_[local]",exportLocalsConvention:"dashesOnly",exportOnlyLocals:s},importLoaders:2}};return{noParse:u.no_parse,rules:[I,{oneOf:[...Q,{test:u.js,use:[...S,t],include:R},{test:u.css,use:[w,"css-loader",b],include:P},e&&{test:u.scss,use:[w,l,b,e],include:P},{test:u.less,use:[w,l,b,{loader:"less-loader",options:{sourceMap:!!o.sourceMap,lessOptions:{modifyVars:r,javascriptEnabled:!0}}}],include:P},{test:u.markdown,use:[...S,{loader:`${n.corePath}/loader/mdx.cjs`,options:o.mdx}],exclude:[u.node_modules]}].filter(Boolean)},...o.moduleRules].filter(e=>"object"==typeof e)}});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import{merge as e}from"webpack-merge";import{CONFIG as t}from"../config.mjs";import{PACKAGENAME as i,coreName as o}from"../process-env.mjs";import{resolveProgramPath as m}from"../utils/index.mjs";import{description as r,keywords as a}from"../vm/info.mjs";let{favicon:n=`node_modules/${o}/lib/options/favicon.ico`,template:p
|
|
1
|
+
import{merge as e}from"webpack-merge";import{CONFIG as t}from"../config.mjs";import{PACKAGENAME as i,coreName as o}from"../process-env.mjs";import{resolveProgramPath as m}from"../utils/index.mjs";import{description as r,keywords as a}from"../vm/info.mjs";let{favicon:n=`node_modules/${o}/lib/options/favicon.ico`,template:l,...p}=t.htmlPluginOption||{},s=e({title:t.env?.PROJECTNAME||i.toLocaleUpperCase()||"Title",filename:"index.html",hash:!1,minify:{minifyJS:!0,minifyCSS:!0,collapseWhitespace:!0,removeComments:!0,removeRedundantAttributes:!1,removeScriptTypeAttributes:!1,removeStyleLinkTypeAttributes:!1,removeAttributeQuotes:!0,useShortDoctype:!0},meta:{charset:"UTF-8","X-UA-Compatible":{"http-equiv":"X-UA-Compatible",content:"IE=edge,Chrome=1"},HandheldFriendly:"true",MobileOptimized:"320","screen-orientation":"portrait","x5-orientation":"portrait",browsermode:"application","x5-page-mode":"app","msapplication-tap-highlight":"no",viewport:"width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1","apple-mobile-web-app-capable":"yes",renderer:"webkit",description:r,keywords:a},tags:[],favicon:n?m(n):n},p,l?{template:l?m(l):void 0}:{templateContent:function({htmlWebpackPlugin:{options:e}}){let t=e.tags,i="",o="";return t&&t.map(function(e){let{tag:t="script",textContent:m="",inject:r="head",...a}=e,n="";for(let e in a)Object.prototype.hasOwnProperty.call(a,e)&&(n+=`${e}="${a[e]}" `);let l=`<${t} ${n}>${m}</${t}>`;"body"===r?o+=l:i+=l}),`<!DOCTYPE html>
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
|
+
<title>${e.title}</title>
|
|
4
5
|
${i}
|
|
5
6
|
</head>
|
|
6
7
|
<body>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface JsxDomExpressions {
|
|
2
|
+
moduleName?: string;
|
|
3
|
+
builtIns?: string[];
|
|
4
|
+
contextToCustomElements?: boolean;
|
|
5
|
+
wrapConditionals?: boolean;
|
|
6
|
+
generate?: 'ssr' | 'dom';
|
|
7
|
+
hydratable?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const jsxDomExpressions: JsxDomExpressions;
|
|
10
|
+
export default jsxDomExpressions;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default{moduleName:"solid-js/web",builtIns:["For","Show","Switch","Match","Suspense","SuspenseList","Portal","Index","Dynamic","ErrorBoundary"],contextToCustomElements:!0,wrapConditionals:!0,generate:"dom",hydratable:!1};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=function(){let e={priority:-10,reuseExistingChunk:!0};return function(n){return{...e,test:n}}}(),n={chunks:"all",minSize:1024,minChunks:1,cacheGroups:{CHANGELOG:e(/CHANGELOG\.md/),prismjs:e(/(prism\.js|prism\/css\.ts)/),site:e(/site/),marked:e(/marked/),"n-katex":e(/n-katex/),"n-code-live":e(/n-code-live/),"@moneko":e(/@moneko/)}};export default n;
|
|
@@ -9,11 +9,10 @@ import type { Compiler } from 'webpack';
|
|
|
9
9
|
* })),
|
|
10
10
|
* ```
|
|
11
11
|
*/
|
|
12
|
-
declare class
|
|
12
|
+
export declare class AddEntryAttributePlugin {
|
|
13
13
|
private readonly test;
|
|
14
14
|
constructor(opt: {
|
|
15
15
|
test: RegExp;
|
|
16
16
|
});
|
|
17
17
|
apply(compiler: Compiler): void;
|
|
18
18
|
}
|
|
19
|
-
export default AddEntryAttributeWebpackPlugin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export class AddEntryAttributePlugin{constructor(t){this.test=t.test}apply(t){t.hooks.compilation.tap("AddEntryAttributeWebpackPlugin",s=>{t.options.plugins.filter(t=>t?.constructor.name==="HtmlWebpackPlugin").forEach(t=>{t.getHooks(s).alterAssetTagGroups.tap("AddEntryAttributeWebpackPlugin",t=>(t.headTags.forEach(t=>{"script"===t.tagName&&t.attributes.src&&this.test.test(t.attributes.src)&&(t.attributes.entry=!0)}),t))})})}}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { Compiler } from 'webpack';
|
|
2
|
-
interface VirtualModulePluginOption {
|
|
2
|
+
export interface VirtualModulePluginOption {
|
|
3
3
|
[key: string]: string | object;
|
|
4
4
|
}
|
|
5
|
-
declare class VirtualModuleWebpackPlugin {
|
|
5
|
+
export declare class VirtualModuleWebpackPlugin {
|
|
6
6
|
private readonly options?;
|
|
7
7
|
private hasTapped;
|
|
8
8
|
constructor(options?: VirtualModulePluginOption);
|
|
9
9
|
apply(compiler: Compiler): void;
|
|
10
10
|
}
|
|
11
|
-
export default VirtualModuleWebpackPlugin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import o from"webpack-virtual-modules";import{isLibrary as t}from"../process-env.mjs";import{resolveNodeModulesPath as e}from"../utils/index.mjs";import{comment as r,docs as
|
|
1
|
+
import o from"webpack-virtual-modules";import{isLibrary as t}from"../process-env.mjs";import{resolveNodeModulesPath as e}from"../utils/index.mjs";import{comment as r,docs as p}from"../vm/docs.mjs";import{examples as i}from"../vm/example.mjs";import{locales as m}from"../vm/locales.mjs";import s from"../vm/modules.mjs";import{route as l}from"../vm/routes.mjs";export class VirtualModuleWebpackPlugin{constructor(o={}){this.options=o,this.hasTapped=!1}apply(a){let n=this.options,f=new o(s);function c(o,t){let r=e(o);f.writeModule(r,t||"")}f.apply(a),l.on("change",c),m.on("change",c),t&&(i.on("change",c),p.on("change",c),r.on("change",c)),a.hooks.compilation.tap("VirtualModuleWebpackPlugin",()=>{if(!this.hasTapped){for(let o in this.hasTapped=!0,n)if(Object.prototype.hasOwnProperty.call(n,o)){let t=n[o];c(o,"string"==typeof t?t:`export default ${JSON.stringify(t)}`)}for(let o of i)c(...o);for(let o of p)c(...o);for(let o of r)c(...o)}})}}
|
package/lib/plugins.config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"add-asset-html-webpack-plugin";import t from"html-webpack-plugin";import l from"webpack";import{CONFIG as o}from"./config.mjs";import i from"./options/html-plugin-option.mjs";import n
|
|
1
|
+
import e from"add-asset-html-webpack-plugin";import t from"html-webpack-plugin";import l from"webpack";import{CONFIG as o}from"./config.mjs";import i from"./options/html-plugin-option.mjs";import{AddEntryAttributePlugin as n}from"./plugin/add-entry-attribute.mjs";import p from"./plugin/module-federation.mjs";import{VirtualModuleWebpackPlugin as r}from"./plugin/virtual-module.mjs";import{isDev as a,isMicro as s}from"./process-env.mjs";let{DefinePlugin:m,SourceMapDevToolPlugin:c,IgnorePlugin:h,WatchIgnorePlugin:u,HotModuleReplacementPlugin:f}=l,d=o.basename.split("/").filter(Boolean).length,w=`${Array(d).fill("..").join("/")+(d?"/":"")}404.html`,{pathSegmentsToKeep:g=d,path:j=w}=o.fixBrowserRouter||{},b=o.assetHtml.map(e=>({publicPath:"",...e})),v=[a&&new f,new u({paths:[/\.d\.ts$/]}),...p,new r(o.virtualModule),o.htmlPluginOption&&new t(i),o.fixBrowserRouter&&new t({filename:j,inject:!1,templateContent:()=>`<html lang="en"><head><title>${i.title}</title><script>const pathKeep = ${g||d};const l = window.location;l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + l.pathname.split('/').slice(0, 1 + pathKeep).join('/') + '/?/' + l.pathname.slice(1).split('/').slice(pathKeep).join('/').replace(/&/g, '~and~') + (l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') + l.hash);</script></head><body></body></html>`}),new e(b),s&&new n({test:/main\.bundle\.js$/}),new m({"process.env":JSON.stringify(o.env)}),new h({resourceRegExp:/\/__tests__\//}),o.sourceMap&&new c(o.sourceMap),...o.plugins].filter(e=>!!e);export default v;
|
package/lib/rule.d.mts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
declare const Rule: {
|
|
2
|
+
js: RegExp;
|
|
3
|
+
css: RegExp;
|
|
4
|
+
less: RegExp;
|
|
5
|
+
scss: RegExp;
|
|
6
|
+
wasm: RegExp;
|
|
7
|
+
txt: RegExp;
|
|
8
|
+
ico: RegExp;
|
|
9
|
+
svg: RegExp;
|
|
10
|
+
image: RegExp;
|
|
11
|
+
video: RegExp;
|
|
12
|
+
font: RegExp;
|
|
13
|
+
markdown: RegExp;
|
|
14
|
+
tsdoc: RegExp;
|
|
15
|
+
css_module: RegExp;
|
|
16
|
+
node_modules_css_module: RegExp;
|
|
17
|
+
no_parse: RegExp[];
|
|
18
|
+
node_modules: RegExp;
|
|
19
|
+
__tests__: RegExp;
|
|
20
|
+
dev_watch_ignored: RegExp;
|
|
21
|
+
};
|
|
22
|
+
export default Rule;
|
package/lib/rule.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default{js:/\.(cj|mj|t|j)s(|x)$/i,css:/\.css$/i,less:/\.less$/i,scss:/\.(sa|sc)ss$/i,wasm:/\.wasm$/i,txt:/\.txt$/i,ico:/\.ico$/i,svg:/\.svg$/i,image:/\.(gif|png|jpe?g|webp)$/i,video:/\.(webm|mp4|ogv)$/i,font:/\.(woff2?|eot|ttf|otf)(\?.*)?$/i,markdown:/\.mdx?$/i,tsdoc:/^(?![._]).*(?<!\.test)\.(tsx?)$/,css_module:/(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i,node_modules_css_module:/(^(?!.*node_modules))(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i,no_parse:[/jquery|lodash|prismjs|prism\.js/,/react\.min\.js$/,/marked\.min\.js$/],node_modules:/node_modules/,__tests__:/(.+)\/__tests__\/(.+)/,dev_watch_ignored:/node_modules(?![\\/]@app)/};
|
package/lib/vm/info.d.mts
CHANGED
|
@@ -5,7 +5,7 @@ declare const app: {
|
|
|
5
5
|
version: string;
|
|
6
6
|
base: string;
|
|
7
7
|
type: import("../index.mjs").AppType;
|
|
8
|
-
routerMode: "
|
|
8
|
+
routerMode: "hash" | "browser" | "memory";
|
|
9
9
|
prefixCls: string | undefined;
|
|
10
10
|
theme: import("../index.mjs").Theme | undefined;
|
|
11
11
|
description: any;
|
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.17",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"swc-loader": "0.2.3",
|
|
38
38
|
"swc-plugin-another-transform-imports": "0.2.7",
|
|
39
39
|
"typescript": "5.3.3",
|
|
40
|
-
"webpack": "5.
|
|
40
|
+
"webpack": "5.89.0",
|
|
41
41
|
"webpack-bundle-analyzer": "4.10.1",
|
|
42
42
|
"webpack-dev-middleware": "6.1.1",
|
|
43
43
|
"webpack-hot-middleware": "2.25.4",
|
package/typings/global.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import VirtualModulesPlugin from 'webpack-virtual-modules';
|
|
2
2
|
import WebpackBar from 'webpackbar';
|
|
3
3
|
import type { BundleAnalyzerOption } from './bundle-analyzer.d';
|
|
4
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
JsxDomExpressions,
|
|
6
|
+
OptimizationSplitChunksOptions,
|
|
7
|
+
OverrideResolverOption,
|
|
8
|
+
ProxyConfig,
|
|
9
|
+
VirtualModulePluginOption,
|
|
10
|
+
} from '../lib/index';
|
|
5
11
|
import type { DonePluginOption } from '../lib/plugin/done';
|
|
6
12
|
import type { MdxOptions } from '@moneko/mdx';
|
|
7
13
|
import type { Config as SwcConfig, JsMinifyOptions as SwcMinifyOptions } from '@swc/core';
|
|
@@ -320,14 +326,7 @@ export declare type ConfigType = {
|
|
|
320
326
|
/** 📦 打包完成 */
|
|
321
327
|
done?: DonePluginOption;
|
|
322
328
|
mdx?: Omit<MdxOptions, 'value' | 'filepath'>;
|
|
323
|
-
jsxDomExpressions?:
|
|
324
|
-
moduleName?: string;
|
|
325
|
-
builtIns?: string[];
|
|
326
|
-
contextToCustomElements?: boolean;
|
|
327
|
-
wrapConditionals?: boolean;
|
|
328
|
-
generate?: 'ssr' | 'dom';
|
|
329
|
-
hydratable?: boolean;
|
|
330
|
-
};
|
|
329
|
+
jsxDomExpressions?: JsxDomExpressions;
|
|
331
330
|
bar?: Partial<WebpackBarOptions> | false;
|
|
332
331
|
/** 虚拟模块
|
|
333
332
|
* @example
|
|
@@ -343,7 +342,7 @@ export declare type ConfigType = {
|
|
|
343
342
|
* console.log(a); // { name: "user1" }
|
|
344
343
|
* console.log(b); // { age: 12 }
|
|
345
344
|
*/
|
|
346
|
-
virtualModule?:
|
|
345
|
+
virtualModule?: VirtualModulePluginOption;
|
|
347
346
|
/** 是否使用 normalize css
|
|
348
347
|
* @default true
|
|
349
348
|
*/
|
|
@@ -518,136 +517,6 @@ export declare interface SourceMapDevToolPluginOptions {
|
|
|
518
517
|
test?: string | RegExp | Rule[];
|
|
519
518
|
}
|
|
520
519
|
|
|
521
|
-
export declare interface OptimizationSplitChunksOptions {
|
|
522
|
-
/**
|
|
523
|
-
* Sets the name delimiter for created chunks.
|
|
524
|
-
*/
|
|
525
|
-
automaticNameDelimiter?: string;
|
|
526
|
-
|
|
527
|
-
/**
|
|
528
|
-
* Assign modules to a cache group (modules from different cache groups are tried to keep in separate chunks, default categories: 'default', 'defaultVendors').
|
|
529
|
-
*/
|
|
530
|
-
cacheGroups?: {
|
|
531
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
532
|
-
[index: string]: string | false | Function | RegExp | OptimizationSplitChunksCacheGroup;
|
|
533
|
-
};
|
|
534
|
-
|
|
535
|
-
/**
|
|
536
|
-
* Select chunks for determining shared modules (defaults to "async", "initial" and "all" requires adding these chunks to the HTML).
|
|
537
|
-
*/
|
|
538
|
-
chunks?: 'all' | 'initial' | 'async' | ((chunk: Chunk) => boolean);
|
|
539
|
-
|
|
540
|
-
/**
|
|
541
|
-
* Sets the size types which are used when a number is used for sizes.
|
|
542
|
-
*/
|
|
543
|
-
defaultSizeTypes?: string[];
|
|
544
|
-
|
|
545
|
-
/**
|
|
546
|
-
* Size threshold at which splitting is enforced and other restrictions (minRemainingSize, maxAsyncRequests, maxInitialRequests) are ignored.
|
|
547
|
-
*/
|
|
548
|
-
enforceSizeThreshold?: number | { [index: string]: number };
|
|
549
|
-
|
|
550
|
-
/**
|
|
551
|
-
* Options for modules not selected by any other cache group.
|
|
552
|
-
*/
|
|
553
|
-
fallbackCacheGroup?: {
|
|
554
|
-
/**
|
|
555
|
-
* Sets the name delimiter for created chunks.
|
|
556
|
-
*/
|
|
557
|
-
automaticNameDelimiter?: string;
|
|
558
|
-
/**
|
|
559
|
-
* Select chunks for determining shared modules (defaults to "async", "initial" and "all" requires adding these chunks to the HTML).
|
|
560
|
-
*/
|
|
561
|
-
chunks?: 'all' | 'initial' | 'async' | ((chunk: Chunk) => boolean);
|
|
562
|
-
/**
|
|
563
|
-
* Maximal size hint for the on-demand chunks.
|
|
564
|
-
*/
|
|
565
|
-
maxAsyncSize?: number | { [index: string]: number };
|
|
566
|
-
/**
|
|
567
|
-
* Maximal size hint for the initial chunks.
|
|
568
|
-
*/
|
|
569
|
-
maxInitialSize?: number | { [index: string]: number };
|
|
570
|
-
/**
|
|
571
|
-
* Maximal size hint for the created chunks.
|
|
572
|
-
*/
|
|
573
|
-
maxSize?: number | { [index: string]: number };
|
|
574
|
-
/**
|
|
575
|
-
* Minimal size for the created chunk.
|
|
576
|
-
*/
|
|
577
|
-
minSize?: number | { [index: string]: number };
|
|
578
|
-
/**
|
|
579
|
-
* Minimum size reduction due to the created chunk.
|
|
580
|
-
*/
|
|
581
|
-
minSizeReduction?: number | { [index: string]: number };
|
|
582
|
-
};
|
|
583
|
-
|
|
584
|
-
/**
|
|
585
|
-
* Sets the template for the filename for created chunks.
|
|
586
|
-
*/
|
|
587
|
-
filename?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
|
|
588
|
-
|
|
589
|
-
/**
|
|
590
|
-
* Prevents exposing path info when creating names for parts splitted by maxSize.
|
|
591
|
-
*/
|
|
592
|
-
hidePathInfo?: boolean;
|
|
593
|
-
|
|
594
|
-
/**
|
|
595
|
-
* Maximum number of requests which are accepted for on-demand loading.
|
|
596
|
-
*/
|
|
597
|
-
maxAsyncRequests?: number;
|
|
598
|
-
|
|
599
|
-
/**
|
|
600
|
-
* Maximal size hint for the on-demand chunks.
|
|
601
|
-
*/
|
|
602
|
-
maxAsyncSize?: number | { [index: string]: number };
|
|
603
|
-
|
|
604
|
-
/**
|
|
605
|
-
* Maximum number of initial chunks which are accepted for an entry point.
|
|
606
|
-
*/
|
|
607
|
-
maxInitialRequests?: number;
|
|
608
|
-
|
|
609
|
-
/**
|
|
610
|
-
* Maximal size hint for the initial chunks.
|
|
611
|
-
*/
|
|
612
|
-
maxInitialSize?: number | { [index: string]: number };
|
|
613
|
-
|
|
614
|
-
/**
|
|
615
|
-
* Maximal size hint for the created chunks.
|
|
616
|
-
*/
|
|
617
|
-
maxSize?: number | { [index: string]: number };
|
|
618
|
-
|
|
619
|
-
/**
|
|
620
|
-
* Minimum number of times a module has to be duplicated until it's considered for splitting.
|
|
621
|
-
*/
|
|
622
|
-
minChunks?: number;
|
|
623
|
-
|
|
624
|
-
/**
|
|
625
|
-
* Minimal size for the chunks the stay after moving the modules to a new chunk.
|
|
626
|
-
*/
|
|
627
|
-
minRemainingSize?: number | { [index: string]: number };
|
|
628
|
-
|
|
629
|
-
/**
|
|
630
|
-
* Minimal size for the created chunks.
|
|
631
|
-
*/
|
|
632
|
-
minSize?: number | { [index: string]: number };
|
|
633
|
-
|
|
634
|
-
/**
|
|
635
|
-
* Minimum size reduction due to the created chunk.
|
|
636
|
-
*/
|
|
637
|
-
minSizeReduction?: number | { [index: string]: number };
|
|
638
|
-
|
|
639
|
-
/**
|
|
640
|
-
* Give chunks created a name (chunks with equal name are merged).
|
|
641
|
-
*/
|
|
642
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
643
|
-
name?: string | false | Function;
|
|
644
|
-
|
|
645
|
-
/**
|
|
646
|
-
* Compare used exports when checking common modules. Modules will only be put in the same chunk when exports are equal.
|
|
647
|
-
*/
|
|
648
|
-
usedExports?: boolean;
|
|
649
|
-
}
|
|
650
|
-
|
|
651
520
|
export type MemberTransformer =
|
|
652
521
|
/** 帕斯卡拼写法(大驼峰): 所有单词的首字母大写,然后直接连接起来,单词之间没有连接符 */
|
|
653
522
|
| 'pascal_case'
|