@moneko/core 3.9.17-beta.14 → 3.9.17-beta.16

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.
Files changed (40) hide show
  1. package/lib/build/common.mjs +1 -1
  2. package/lib/config.mjs +1 -1
  3. package/lib/index.d.mts +6 -2
  4. package/lib/index.mjs +1 -1
  5. package/lib/module.config.mjs +1 -1
  6. package/lib/options/favicon.ico +0 -0
  7. package/lib/{html-plugin-option.d.mts → options/html-plugin-option.d.mts} +1 -1
  8. package/lib/options/html-plugin-option.mjs +11 -0
  9. package/lib/{minify.d.mts → options/js-minify.d.mts} +1 -1
  10. package/lib/options/jsx-dom-expressions.d.mts +10 -0
  11. package/lib/options/jsx-dom-expressions.mjs +1 -0
  12. package/lib/{modify-vars.d.mts → options/modify-vars.d.mts} +0 -1
  13. package/lib/options/modify-vars.mjs +1 -0
  14. package/lib/options/split-chunk.d.mts +4 -0
  15. package/lib/options/split-chunk.mjs +1 -0
  16. package/lib/options/swcrc.mjs +1 -0
  17. package/lib/paths.d.mts +3 -2
  18. package/lib/paths.mjs +1 -1
  19. package/lib/plugin/module-federation.mjs +1 -0
  20. package/lib/plugin/virtual-module.d.mts +1 -1
  21. package/lib/plugins.config.mjs +1 -1
  22. package/lib/process-env.d.mts +0 -1
  23. package/lib/process-env.mjs +1 -1
  24. package/lib/rule.d.mts +21 -0
  25. package/lib/rule.mjs +1 -0
  26. package/lib/utils/seo.mjs +1 -1
  27. package/lib/vm/info.d.mts +1 -1
  28. package/lib/vm/routes.mjs +1 -1
  29. package/package.json +2 -3
  30. package/typings/global.d.ts +49 -140
  31. package/lib/html-plugin-option.mjs +0 -1
  32. package/lib/modify-vars.mjs +0 -1
  33. package/lib/module-federation.mjs +0 -1
  34. package/lib/swcrc.mjs +0 -1
  35. package/template/favicon.ico +0 -0
  36. package/template/index.html +0 -25
  37. package/template/index.ssr.html +0 -25
  38. /package/lib/{minify.mjs → options/js-minify.mjs} +0 -0
  39. /package/lib/{swcrc.d.mts → options/swcrc.d.mts} +0 -0
  40. /package/lib/{module-federation.d.mts → plugin/module-federation.d.mts} +0 -0
@@ -1 +1 @@
1
- import e from"mini-css-extract-plugin";import i from"terser-webpack-plugin";import m from"webpack";import{BundleAnalyzerPlugin as n}from"webpack-bundle-analyzer";import{merge as r}from"webpack-merge";import{commonConfig as o}from"../common.mjs";import{CONFIG as t}from"../config.mjs";import{getMinifyOption as l}from"../minify.mjs";import p from"../plugin/lightningcss-plugin.mjs";let{optimize:{MinChunkSizePlugin:s,ModuleConcatenationPlugin:u}}=m,a=r(o,{plugins:[new u,new e({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),t.splitChunk&&new s({minChunkSize:1e4}),t.bundleAnalyzer&&new n(t.bundleAnalyzer)].filter(Boolean),optimization:{splitChunks:t.splitChunk,runtimeChunk:t.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,mangleWasmImports:!0,minimize:!0,minimizer:!!t.minifier&&[new i(l(t.minifier?.type||"swc",t.minifier?.options)),new p]||[]}});export default a;
1
+ import e from"mini-css-extract-plugin";import i from"terser-webpack-plugin";import m from"webpack";import{BundleAnalyzerPlugin as n}from"webpack-bundle-analyzer";import{merge as r}from"webpack-merge";import{commonConfig as o}from"../common.mjs";import{CONFIG as t}from"../config.mjs";import{getMinifyOption as l}from"../options/js-minify.mjs";import p from"../plugin/lightningcss-plugin.mjs";let{optimize:{MinChunkSizePlugin:s,ModuleConcatenationPlugin:u}}=m,a=r(o,{plugins:[new u,new e({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),t.splitChunk&&new s({minChunkSize:1e4}),t.bundleAnalyzer&&new n(t.bundleAnalyzer)].filter(Boolean),optimization:{splitChunks:t.splitChunk,runtimeChunk:t.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,mangleWasmImports:!0,minimize:!0,minimizer:!!t.minifier&&[new i(l(t.minifier?.type||"swc",t.minifier?.options)),new p]||[]}});export default a;
package/lib/config.mjs CHANGED
@@ -1 +1 @@
1
- import{fileExists as e}from"@moneko/mdx";import{merge as t}from"webpack-merge";import o,{CUSTOMCONFIG as s}from"./paths.mjs";import{FRAMEWORK as i,PACKAGENAME as r,isDev as n,isLibrary as a,isMobile as l,isSolid as m,jsxImportSource as p,mainDirectory as c}from"./process-env.mjs";import{isFunction as u,resolveProgramPath as d}from"./utils/index.mjs";import h from"./utils/log.mjs";import f from"./utils/read-conf.mjs";let g=["@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"],x={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:l?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":d(c)},moduleRules:[],prefixJsLoader:[],cssModules:[],importOnDemand:{},proxy:{},cacheDirectory:o.webpackCachePath,devServer:{host:"localhost",port:3e3},htmlPluginOption:{},assetHtml:[],routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:{chunks:"all",minSize:1024,minChunks:1,cacheGroups:{CHANGELOG:{test:/CHANGELOG\.md/,priority:-10,name:"CHANGELOG",reuseExistingChunk:!0},prismjs:{test:/(prism\.js|prism\/css\.ts)/,priority:-10,name:"vendors-prismjs",reuseExistingChunk:!0},site:{test:/site/,priority:-10,reuseExistingChunk:!0},marked:{test:/marked/,priority:-10,reuseExistingChunk:!0},"n-katex":{test:/n-katex/,priority:-10,reuseExistingChunk:!0},"n-code-live":{test:/n-code-live/,priority:-10,reuseExistingChunk:!0},"@moneko":{test:/@moneko/,priority:-10,reuseExistingChunk:!0}}},runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:g,js:g,media:g,font:g,wasm:[]},mdx:{jsx:!1,development:n,jsxImportSource:p,providerImportSource:`@moneko/${i}/mdx`},jsxDomExpressions:{},bar:{name:"Client",color:"#6f42c1"},normalizeCss:!0,externalsPresets:{},buildHttp:{allowedUris:[],lockfileLocation:`${o.httpCachePath}/http.lock`,cacheLocation:`${o.httpCachePath}/data`,upgrade:!0},virtualModule:{}};m&&(x.jsxDomExpressions={moduleName:"solid-js/web",builtIns:["For","Show","Switch","Match","Suspense","SuspenseList","Portal","Index","Dynamic","ErrorBoundary"],contextToCustomElements:!0,wrapConditionals:!0,generate:"dom",hydratable:!1}),a&&(x.alias=Object.assign(x.alias,{"@pkg":o.componentsPath,[r]:o.componentsPath}));let C=x,k={},P={};if(e(o.configPath)){let e=(await f(o.configPath,"index")).default;k=u(e)?e(process):e}if(s&&e(o.customConfigPath)){let e=(await f(o.customConfigPath,s)).default;P=u(e)?e(process):e}(!1===(C=t(C,k,P)).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:s,log:h};
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/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- export { default as paths, CUSTOMCONFIG } from './paths.mjs';
2
- export { PACKAGENAME, PACKAGEVERSION, coreName, isDev, isLibrary, isMicro, mainDirectory, } from './process-env.mjs';
1
+ export { default as paths, CUSTOMCONFIG, yarnArgv, routeDir } from './paths.mjs';
2
+ export { APPTYPE, FRAMEWORK, PACKAGENAME, PACKAGEVERSION, coreName, isDev, isLibrary, isMicro, mainDirectory, } from './process-env.mjs';
3
3
  export { realResolve, resolveNodeModulesPath, resolveProgramPath } from './utils/index.mjs';
4
4
  export { default as log } from './utils/log.mjs';
5
5
  export { default as hasPkg } from './utils/has-pkg.mjs';
@@ -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}from"./paths.mjs";export{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";
@@ -1 +1 @@
1
- let e;import s from"mini-css-extract-plugin";import{CONFIG as t,PUBLICPATH as o}from"./config.mjs";import r from"./modify-vars.mjs";import a,{CUSTOMCONFIG as i}from"./paths.mjs";import{getLightningCssTargets as l}from"./polyfills/targets.mjs";import{FRAMEWORK as n,isDev as m,isLibrary as d,isMicro as c}from"./process-env.mjs";import p from"./swcrc.mjs";import u from"./utils/has-pkg.mjs";import{resolveNodeModulesPath as f,resolveProgramPath as y}from"./utils/index.mjs";import g from"./utils/svg-to-data-uri.mjs";import{comment as j,getCommentPath as x}from"./vm/docs.mjs";import $ from"./vm/generate-doc.mjs";let v=c?o:"../",h={loader:s.loader,options:{publicPath:"/"!==v?v:"../"}},w={loader:`${a.corePath}/loader/lightningcss.cjs`,options:{sourceMap:!!t.sourceMap,analyzeDependencies:!1,targets:l(),drafts:{nesting:!0,customMedia:!0},errorRecovery:!1,unusedSymbols:[],rem:!!t.rem}};m&&(h="style-loader");let b=[...t.cssModules,`@moneko/${n}`,"neko-ui"].map(f),_=["components","example","mock","site","src","server"].map(y);function k(e){return _.concat(t.rulesInclude?.[e]?.map(f)||[])}i&&_.push(y(i)),t.overrideResolve&&t.overrideResolve.override&&_.push(t.overrideResolve.override);let M=k("css"),B=k("js"),L=k("media"),O=k("wasm"),P=k("font");u("sass")&&(e={loader:"sass-loader",options:{implementation:await import("sass"),sassOptions:{}}});let R=d&&m&&{test:/^(?![._]).*(?<!\.test)\.(tsx?)$/,include:t.alias["@pkg"],exclude:[/node_modules/,/(.+)\/__tests__\/(.+)/i],enforce:"pre",loader:`${a.corePath}/loader/ts-doc.cjs`,options:{comment:j,generateDoc:$,getCommentPath:x}};export default(s=>{let o={loader:"swc-loader",options:p(s)},i={loader:"css-loader",options:{modules:{auto:e=>{for(let s=0,t=b.length;s<t;s++)if(e&&e?.includes(b[s]))return/(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i.test(e);return/(^(?!.*node_modules))(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i.test(e)},localIdentName:"[path][name]__[local]",exportLocalsConvention:"dashesOnly",exportOnlyLocals:s},importLoaders:2}},l=[h,i,w,{loader:"less-loader",options:{sourceMap:!!t.sourceMap,lessOptions:{modifyVars:r,javascriptEnabled:!0}}}].filter(Boolean);return{noParse:[/jquery|lodash|prismjs|prism\.js/,/react\.min\.js$/,/marked\.min\.js$/],rules:[R,{oneOf:[{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:/\.wasm$/i,type:"webassembly/async",include:O},{test:/\.txt$/i,type:"asset/source"},{test:/\.ico$/i,type:"asset/inline",include:L},{test:/\.svg$/i,type:"asset/inline",generator:{dataUrl:e=>g(e.toString())},include:L},{test:/\.(gif|png|jpe?g|webp)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/images/[name][ext]"},include:L},{test:/\.(webm|mp4|ogv)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[name][ext]"},include:L},{test:/\.(woff2?|eot|ttf|otf)(\?.*)?$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[name][ext]"},include:P},{test:/\.(sa|sc)ss$/i,use:[h,i,w,e].filter(Boolean),include:M},{test:/\.less$/i,use:l,include:M},{test:/\.css$/i,use:[h,"css-loader",w].filter(Boolean),include:M},{test:/\.(cj|mj|t|j)s(|x)$/i,use:[...t.prefixJsLoader,o].filter(Boolean),include:B},{test:/\.mdx?$/i,use:[...t.prefixJsLoader,{loader:`${a.corePath}/loader/mdx.cjs`,options:t.mdx}].filter(Boolean),exclude:[/node_modules/]},{type:"asset/source",include:[/(.+)\/examples\/(.+).*?$/i]}]},...t.moduleRules].filter(e=>"object"==typeof e)}});
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)}});
Binary file
@@ -1,3 +1,3 @@
1
- import type { HtmlWebpackOption } from '../typings/global.js';
1
+ import type { HtmlWebpackOption } from '../../typings/global.js';
2
2
  declare const htmlPluginOption: HtmlWebpackOption;
3
3
  export default htmlPluginOption;
@@ -0,0 +1,11 @@
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
+ <html lang="en">
3
+ <head>
4
+ <title>${e.title}</title>
5
+ ${i}
6
+ </head>
7
+ <body>
8
+ <div id="root"></div>
9
+ ${o}
10
+ </body>
11
+ </html>`}});export default s;
@@ -1,5 +1,5 @@
1
1
  import TerserPlugin from 'terser-webpack-plugin';
2
- import type { MinifierType, SwcMinifyOptions, TerserMinifyOptions } from './index.mjs';
2
+ import type { MinifierType, SwcMinifyOptions, TerserMinifyOptions } from '../index.mjs';
3
3
  type MinifyObject = {
4
4
  terser: {
5
5
  minify: typeof TerserPlugin.terserMinify;
@@ -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};
@@ -2,6 +2,5 @@ declare const modifyVars: {
2
2
  '@prefix-cls': string;
3
3
  '@ant-prefix': string;
4
4
  '@iconfont-css-prefix': string;
5
- '@favicon': string;
6
5
  };
7
6
  export default modifyVars;
@@ -0,0 +1 @@
1
+ import{CONFIG as i}from"../config.mjs";let f=i.prefixCls||"n",e={"@prefix-cls":f,"@ant-prefix":f,"@iconfont-css-prefix":`${f}-icon`};Object.assign(e,i.modifyVars);export default e;
@@ -0,0 +1,4 @@
1
+ import webpack from 'webpack';
2
+ export type OptimizationSplitChunksOptions = ConstructorParameters<typeof webpack.optimize.SplitChunksPlugin>[0];
3
+ declare const splitChunk: OptimizationSplitChunksOptions;
4
+ export default splitChunk;
@@ -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;
@@ -0,0 +1 @@
1
+ import{merge as e}from"webpack-merge";import{CONFIG as o}from"../config.mjs";import r from"../paths.mjs";import s from"../polyfills/polyfills.mjs";import{isDev as t,isReact as l,isSolid as n,jsxImportSource as i}from"../process-env.mjs";export const swcMinifyOption={compress:{top_retain:[],keep_infinity:!0,global_defs:{"@alert":"console.log"},pure_funcs:["console.log","console.warn","console.error","console.info"],toplevel:!1,drop_console:!0,drop_debugger:!0,module:!1,ecma:2015,ie8:!1,keep_classnames:void 0,keep_fnames:!1},mangle:!0};let p=function(e){for(let o=0,r=Object.keys(e),s=r.length;o<s;o++)e[r[o]].transform=`${r[o]}/${e[r[o]].transform}`,e[r[o]].style&&(e[r[o]].style=`${r[o]}/${e[r[o]].style}`);return e}(o.importOnDemand||{}),m={include:s(),mode:"entry",coreJs:"3.34"};export default(s=>e({module:{type:"es6",resolveFully:!0},jsc:{parser:{syntax:"typescript",tsx:!0,decorators:!0,dynamicImport:!0},loose:!0,target:o.polyfill?void 0:"es2017",externalHelpers:!1,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,refresh:l&&t,development:t,importSource:i},optimizer:{simplify:!1}},minify:t?void 0:swcMinifyOption,experimental:{emitAssertForImportAttributes:!0,cacheRoot:r.swcCachePath,plugins:[["swc-plugin-another-transform-imports",p],n&&["@moneko/jsx-dom-expressions",{...o.jsxDomExpressions,generate:s?"ssr":"dom",hydratable:!!s}]].filter(Boolean)}},env:o.polyfill?m:void 0,sourceMaps:!0,parseMap:!0},"function"==typeof o.swcrc?o.swcrc(t):o.swcrc||{}));
package/lib/paths.d.mts CHANGED
@@ -9,7 +9,7 @@ export declare const yarnArgv: Record<string, string> & {
9
9
  * ```
10
10
  */
11
11
  export declare const CUSTOMCONFIG: string | undefined;
12
- declare const _default: {
12
+ declare const paths: {
13
13
  nodeModules: string;
14
14
  corePath: string;
15
15
  programPath: string;
@@ -24,4 +24,5 @@ declare const _default: {
24
24
  componentsPath: string;
25
25
  mockPath: string;
26
26
  };
27
- export default _default;
27
+ export declare const routeDir: string;
28
+ export default paths;
package/lib/paths.mjs CHANGED
@@ -1 +1 @@
1
- import e from"url";let c=JSON.parse(process.env.npm_config_argv||"{}")?.original;export const yarnArgv={};c?.forEach(e=>{let c=e.split("=");Object.assign(yarnArgv,{[c[0]]:c[1]||!0})});export const CUSTOMCONFIG=process.env.npm_config_config||yarnArgv.config;let o=process.cwd(),t=`${o}/node_modules`,a=`${t}/.cache/.mo`;export default{nodeModules:t,corePath:e.fileURLToPath(new URL(".",import.meta.url)),programPath:o,webpackCachePath:`${t}/.temp_cache`,cachePath:a,httpCachePath:`${t}/.cache/http`,swcCachePath:`${t}/.swc`,configPath:`${o}/config/index.ts`,customConfigPath:`${o}/config/${CUSTOMCONFIG}.ts`,coveragePath:`${o}/coverage/clover.xml`,pagesPath:`${o}/src/pages`,componentsPath:`${o}/components`,mockPath:`${o}/mock`};
1
+ import e from"url";let o=JSON.parse(process.env.npm_config_argv||"{}")?.original;export const yarnArgv={};o?.forEach(e=>{let o=e.split("=");Object.assign(yarnArgv,{[o[0]]:o[1]||!0})});export const CUSTOMCONFIG=process.env.npm_config_config||yarnArgv.config;let t=process.cwd(),c=`${t}/node_modules`,a={nodeModules:c,corePath:e.fileURLToPath(new URL(".",import.meta.url)),programPath:t,webpackCachePath:`${c}/.temp_cache`,cachePath:`${c}/.cache/.mo`,httpCachePath:`${c}/.cache/http`,swcCachePath:`${c}/.swc`,configPath:`${t}/config/index.ts`,customConfigPath:`${t}/config/${CUSTOMCONFIG}.ts`,coveragePath:`${t}/coverage/clover.xml`,pagesPath:`${t}/src/pages`,componentsPath:`${t}/components`,mockPath:`${t}/mock`};export const routeDir="library"===process.env.APPTYPE?a.componentsPath:a.pagesPath;export default a;
@@ -0,0 +1 @@
1
+ import e from"webpack";import r from"./external-remotes.mjs";import{CONFIG as t}from"../config.mjs";import{realResolve as o}from"../utils/index.mjs";let{NormalModuleReplacementPlugin:s,container:{ModuleFederationPlugin:a}}=e,m={},i={},l={},n=t.moduleFederation?.map(e=>{if(Array.isArray(e.remotes))for(let r=0,t=e.remotes.length;r<t;r++){let t=e.remotes[r],o=t.alias||t.name,s=t.filename||"remote_entry.js";if(l[o]=`${t.name}@${t.host}/${s}`,Array.isArray(t.library))for(let e=0,r=t.library.length;e<r;e++)m[t.library[e]]=`${o}/${t.library[e]}`}if(Array.isArray(e.exposes))for(let r=0,t=e.exposes.length;r<t;r++){let t=e.exposes[r];"string"==typeof t?i[`./${t}`]=o(t):"[object Object]"===Object.prototype.toString.call(t)&&(i[`./${t.name}`]=o(t.path))}return new a({filename:"remote_entry.js",...e,remotes:l,exposes:i})});n.length&&(n.push(new r),n.push(new s(/(.*)/,e=>{m[e.request]&&(e.request=m[e.request])})));export default n;
@@ -1,5 +1,5 @@
1
1
  import type { Compiler } from 'webpack';
2
- interface VirtualModulePluginOption {
2
+ export interface VirtualModulePluginOption {
3
3
  [key: string]: string | object;
4
4
  }
5
5
  declare class VirtualModuleWebpackPlugin {
@@ -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"./html-plugin-option.mjs";import r from"./module-federation.mjs";import n from"./plugin/add-entry-attribute.mjs";import p from"./plugin/virtual-module.mjs";import{isMicro as a}from"./process-env.mjs";let{AutomaticPrefetchPlugin:s,DefinePlugin:m,SourceMapDevToolPlugin:c,IgnorePlugin:h,WatchIgnorePlugin:u}=l,f=o.basename.split("/").filter(Boolean).length,d=`${Array(f).fill("..").join("/")+(f?"/":"")}404.html`,{pathSegmentsToKeep:w=f,path:g=d}=o.fixBrowserRouter||{},j=o.assetHtml.map(e=>({publicPath:"",...e})),b=[new u({paths:[/\.d\.ts$/]}),...r,new p(o.virtualModule),new s,o.htmlPluginOption&&new t(i),o.fixBrowserRouter&&new t({filename:g,inject:!1,templateContent:()=>`<html lang="en"><head><title>${i.title}</title><script>const pathKeep = ${w||f};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(j),a&&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 b;
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 from"./plugin/add-entry-attribute.mjs";import p from"./plugin/module-federation.mjs";import r from"./plugin/virtual-module.mjs";import{isMicro as a}from"./process-env.mjs";let{AutomaticPrefetchPlugin:s,DefinePlugin:m,SourceMapDevToolPlugin:c,IgnorePlugin:h,WatchIgnorePlugin:u}=l,f=o.basename.split("/").filter(Boolean).length,d=`${Array(f).fill("..").join("/")+(f?"/":"")}404.html`,{pathSegmentsToKeep:w=f,path:g=d}=o.fixBrowserRouter||{},j=o.assetHtml.map(e=>({publicPath:"",...e})),b=[new u({paths:[/\.d\.ts$/]}),...p,new r(o.virtualModule),new s,o.htmlPluginOption&&new t(i),o.fixBrowserRouter&&new t({filename:g,inject:!1,templateContent:()=>`<html lang="en"><head><title>${i.title}</title><script>const pathKeep = ${w||f};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(j),a&&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 b;
@@ -18,4 +18,3 @@ export declare const PACKAGEVERSION: string;
18
18
  export declare const coreName: string;
19
19
  /** 是否为本地开发环境 */
20
20
  export declare const isDev: boolean;
21
- export declare const routeDir: string;
@@ -1 +1 @@
1
- import o from"./paths.mjs";export const APPTYPE=process.env.APPTYPE;export const FRAMEWORK=process.env.FRAMEWORK;export const isLibrary="library"===APPTYPE;export const isMicro="micro"===APPTYPE;export const isMobile="mobile"===APPTYPE;export const isReact="react"===FRAMEWORK;export const isSolid="solid"===FRAMEWORK;export const SSR="true"===process.env.SSR;export const mainDirectory=isLibrary?"site":"src";export const jsxImportSource={react:"react",solid:"solid-js/h"}[FRAMEWORK];export const PACKAGENAME=process.env.npm_package_name;export const PACKAGEVERSION=process.env.npm_package_version;export const coreName="@moneko/core";export const isDev="development"===process.env.NODE_ENV;export const routeDir=isLibrary?o.componentsPath:o.pagesPath;
1
+ export const APPTYPE=process.env.APPTYPE;export const FRAMEWORK=process.env.FRAMEWORK;export const isLibrary="library"===APPTYPE;export const isMicro="micro"===APPTYPE;export const isMobile="mobile"===APPTYPE;export const isReact="react"===FRAMEWORK;export const isSolid="solid"===FRAMEWORK;export const SSR="true"===process.env.SSR;export const mainDirectory=isLibrary?"site":"src";export const jsxImportSource={react:"react",solid:"solid-js/h"}[FRAMEWORK];export const PACKAGENAME=process.env.npm_package_name;export const PACKAGEVERSION=process.env.npm_package_version;export const coreName="@moneko/core";export const isDev="development"===process.env.NODE_ENV;
package/lib/rule.d.mts ADDED
@@ -0,0 +1,21 @@
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
+ };
21
+ 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__\/(.+)/};
package/lib/utils/seo.mjs CHANGED
@@ -1 +1 @@
1
- import{join as m}from"path";import{saveFileSync as o,scanRouter as t,sitemap as r}from"@moneko/mdx";import{resolveProgramPath as e}from"./index.mjs";import{outputConfig as p}from"../common.mjs";import{CONFIG as i}from"../config.mjs";import{isLibrary as s,routeDir as n}from"../process-env.mjs";export default(()=>{let{domain:f,nojekyll:a,path:j}=i.seo||{},l=j&&e(j)||p?.path;if(!f||!l)return;let x=`https://${f}${i.basename}`;o(m(l,"CNAME"),f),o(m(l,"robots"),`Sitemap: ${x}/sitemap.txt`),o(m(l,"sitemap.txt"),r(n,x,t(n,s)).join("\n")),a&&o(m(l,".nojekyll"),"")});
1
+ import{join as m}from"path";import{saveFileSync as o,scanRouter as t,sitemap as r}from"@moneko/mdx";import{resolveProgramPath as e}from"./index.mjs";import{outputConfig as p}from"../common.mjs";import{CONFIG as i}from"../config.mjs";import{routeDir as s}from"../paths.mjs";import{isLibrary as f}from"../process-env.mjs";export default(()=>{let{domain:n,nojekyll:a,path:j}=i.seo||{},l=j&&e(j)||p?.path;if(!n||!l)return;let x=`https://${n}${i.basename}`;o(m(l,"CNAME"),n),o(m(l,"robots"),`Sitemap: ${x}/sitemap.txt`),o(m(l,"sitemap.txt"),r(s,x,t(s,f)).join("\n")),a&&o(m(l,".nojekyll"),"")});
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: "browser" | "hash" | "memory";
8
+ routerMode: "hash" | "browser" | "memory";
9
9
  prefixCls: string | undefined;
10
10
  theme: import("../index.mjs").Theme | undefined;
11
11
  description: any;
package/lib/vm/routes.mjs CHANGED
@@ -1 +1 @@
1
- import{generateRouter as o}from"@moneko/mdx";import{watchFiles as e}from"./utils.mjs";import{CONFIG as t}from"../config.mjs";import{FRAMEWORK as r,isDev as m,isLibrary as s,routeDir as u}from"../process-env.mjs";import n from"../utils/reactive-object.mjs";let i=s?"@pkg":"@/pages";export const routesModuleName="@app/routes";function p(){return o(u,`${t.alias["@"]}/router/index.ts`,r,i,s)}export const route=new n({[routesModuleName]:p()});export function generatorRouter(){route.setData(routesModuleName,p())}m&&e(u,s?/(?<!README\.mdx?)$/:/(?<!index\.tsx?)$/,generatorRouter);
1
+ import{generateRouter as o}from"@moneko/mdx";import{watchFiles as e}from"./utils.mjs";import{CONFIG as t}from"../config.mjs";import{routeDir as r}from"../paths.mjs";import{FRAMEWORK as m,isDev as s,isLibrary as u}from"../process-env.mjs";import i from"../utils/reactive-object.mjs";let n=u?"@pkg":"@/pages";export const routesModuleName="@app/routes";function p(){return o(r,`${t.alias["@"]}/router/index.ts`,m,n,u)}export const route=new i({[routesModuleName]:p()});export function generatorRouter(){route.setData(routesModuleName,p())}s&&e(r,u?/(?<!README\.mdx?)$/:/(?<!index\.tsx?)$/,generatorRouter);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.9.17-beta.14",
3
+ "version": "3.9.17-beta.16",
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.77.0",
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",
@@ -60,7 +60,6 @@
60
60
  },
61
61
  "files": [
62
62
  "lib",
63
- "template",
64
63
  "typings/global.d.ts",
65
64
  "typings/bundle-analyzer.d.ts"
66
65
  ]
@@ -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 { OverrideResolverOption, ProxyConfig } from '../lib/index';
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';
@@ -22,9 +28,49 @@ export type MinifierType = 'swc' | 'terser';
22
28
  export declare type AppType = 'mobile' | 'site' | 'backstage' | 'micro' | 'library';
23
29
  export declare type Framework = 'react' | 'solid';
24
30
  export type HtmlWebpackOption = HtmlWebpackPluginOptions & {
31
+ /**
32
+ * 自定义额外的 tags, 当需要添加远程cdn时很有用
33
+ * @description
34
+ * 如果你配置了自定义的 template, 那么默认情况下 tags 将不生效, 请在你的 template 中按照下方案例进行修改
35
+ * @example
36
+ * ```html
37
+ * <!DOCTYPE html>
38
+ <html lang="en">
39
+ <head>
40
+ <title><%= htmlWebpackPlugin.options.title %></title>
41
+ <%
42
+ var customTag="";
43
+ if (htmlWebpackPlugin.options.tags) {
44
+ htmlWebpackPlugin.options.tags.forEach(function(item){
45
+ var { tag = "script", textContent = "", ...attrs } = item;
46
+ var _attrs = "";
47
+ for (const key in attrs) {
48
+ if (attrs.hasOwnProperty(key)) {
49
+ _attrs += `${key}="${attrs[key]}" `;
50
+ }
51
+ }
52
+ customTag += `<${tag} ${_attrs}>${textContent}</${tag}>`;
53
+ });
54
+ }
55
+ %>
56
+ <%= customTag %>
57
+ </head>
58
+ <body>
59
+ <div id="root"></div>
60
+ </body>
61
+ </html>
62
+ * ```
63
+ */
25
64
  tags?: {
65
+ /**
66
+ * 标签内容
67
+ */
26
68
  textContent?: string;
69
+ /** 标签
70
+ * @default script
71
+ */
27
72
  tag?: string;
73
+ inject?: 'body' | 'head';
28
74
  [key: string]: string | null | boolean | number;
29
75
  }[];
30
76
  };
@@ -280,14 +326,7 @@ export declare type ConfigType = {
280
326
  /** 📦 打包完成 */
281
327
  done?: DonePluginOption;
282
328
  mdx?: Omit<MdxOptions, 'value' | 'filepath'>;
283
- jsxDomExpressions?: {
284
- moduleName?: string;
285
- builtIns?: string[];
286
- contextToCustomElements?: boolean;
287
- wrapConditionals?: boolean;
288
- generate?: 'ssr' | 'dom';
289
- hydratable?: boolean;
290
- };
329
+ jsxDomExpressions?: JsxDomExpressions;
291
330
  bar?: Partial<WebpackBarOptions> | false;
292
331
  /** 虚拟模块
293
332
  * @example
@@ -303,7 +342,7 @@ export declare type ConfigType = {
303
342
  * console.log(a); // { name: "user1" }
304
343
  * console.log(b); // { age: 12 }
305
344
  */
306
- virtualModule?: Record<string, string | object>;
345
+ virtualModule?: VirtualModulePluginOption;
307
346
  /** 是否使用 normalize css
308
347
  * @default true
309
348
  */
@@ -478,136 +517,6 @@ export declare interface SourceMapDevToolPluginOptions {
478
517
  test?: string | RegExp | Rule[];
479
518
  }
480
519
 
481
- export declare interface OptimizationSplitChunksOptions {
482
- /**
483
- * Sets the name delimiter for created chunks.
484
- */
485
- automaticNameDelimiter?: string;
486
-
487
- /**
488
- * Assign modules to a cache group (modules from different cache groups are tried to keep in separate chunks, default categories: 'default', 'defaultVendors').
489
- */
490
- cacheGroups?: {
491
- // eslint-disable-next-line @typescript-eslint/ban-types
492
- [index: string]: string | false | Function | RegExp | OptimizationSplitChunksCacheGroup;
493
- };
494
-
495
- /**
496
- * Select chunks for determining shared modules (defaults to "async", "initial" and "all" requires adding these chunks to the HTML).
497
- */
498
- chunks?: 'all' | 'initial' | 'async' | ((chunk: Chunk) => boolean);
499
-
500
- /**
501
- * Sets the size types which are used when a number is used for sizes.
502
- */
503
- defaultSizeTypes?: string[];
504
-
505
- /**
506
- * Size threshold at which splitting is enforced and other restrictions (minRemainingSize, maxAsyncRequests, maxInitialRequests) are ignored.
507
- */
508
- enforceSizeThreshold?: number | { [index: string]: number };
509
-
510
- /**
511
- * Options for modules not selected by any other cache group.
512
- */
513
- fallbackCacheGroup?: {
514
- /**
515
- * Sets the name delimiter for created chunks.
516
- */
517
- automaticNameDelimiter?: string;
518
- /**
519
- * Select chunks for determining shared modules (defaults to "async", "initial" and "all" requires adding these chunks to the HTML).
520
- */
521
- chunks?: 'all' | 'initial' | 'async' | ((chunk: Chunk) => boolean);
522
- /**
523
- * Maximal size hint for the on-demand chunks.
524
- */
525
- maxAsyncSize?: number | { [index: string]: number };
526
- /**
527
- * Maximal size hint for the initial chunks.
528
- */
529
- maxInitialSize?: number | { [index: string]: number };
530
- /**
531
- * Maximal size hint for the created chunks.
532
- */
533
- maxSize?: number | { [index: string]: number };
534
- /**
535
- * Minimal size for the created chunk.
536
- */
537
- minSize?: number | { [index: string]: number };
538
- /**
539
- * Minimum size reduction due to the created chunk.
540
- */
541
- minSizeReduction?: number | { [index: string]: number };
542
- };
543
-
544
- /**
545
- * Sets the template for the filename for created chunks.
546
- */
547
- filename?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
548
-
549
- /**
550
- * Prevents exposing path info when creating names for parts splitted by maxSize.
551
- */
552
- hidePathInfo?: boolean;
553
-
554
- /**
555
- * Maximum number of requests which are accepted for on-demand loading.
556
- */
557
- maxAsyncRequests?: number;
558
-
559
- /**
560
- * Maximal size hint for the on-demand chunks.
561
- */
562
- maxAsyncSize?: number | { [index: string]: number };
563
-
564
- /**
565
- * Maximum number of initial chunks which are accepted for an entry point.
566
- */
567
- maxInitialRequests?: number;
568
-
569
- /**
570
- * Maximal size hint for the initial chunks.
571
- */
572
- maxInitialSize?: number | { [index: string]: number };
573
-
574
- /**
575
- * Maximal size hint for the created chunks.
576
- */
577
- maxSize?: number | { [index: string]: number };
578
-
579
- /**
580
- * Minimum number of times a module has to be duplicated until it's considered for splitting.
581
- */
582
- minChunks?: number;
583
-
584
- /**
585
- * Minimal size for the chunks the stay after moving the modules to a new chunk.
586
- */
587
- minRemainingSize?: number | { [index: string]: number };
588
-
589
- /**
590
- * Minimal size for the created chunks.
591
- */
592
- minSize?: number | { [index: string]: number };
593
-
594
- /**
595
- * Minimum size reduction due to the created chunk.
596
- */
597
- minSizeReduction?: number | { [index: string]: number };
598
-
599
- /**
600
- * Give chunks created a name (chunks with equal name are merged).
601
- */
602
- // eslint-disable-next-line @typescript-eslint/ban-types
603
- name?: string | false | Function;
604
-
605
- /**
606
- * Compare used exports when checking common modules. Modules will only be put in the same chunk when exports are equal.
607
- */
608
- usedExports?: boolean;
609
- }
610
-
611
520
  export type MemberTransformer =
612
521
  /** 帕斯卡拼写法(大驼峰): 所有单词的首字母大写,然后直接连接起来,单词之间没有连接符 */
613
522
  | 'pascal_case'
@@ -1 +0,0 @@
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 p=t.htmlPluginOption||{},n=p.favicon||`node_modules/${o}/template/favicon.ico`,l=p.template||`node_modules/${o}/template/index.html`,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:[]},p,{template:m(l),favicon:m(n)});export default s;
@@ -1 +0,0 @@
1
- import{CONFIG as i}from"./config.mjs";import o from"./html-plugin-option.mjs";let f=i.prefixCls||"n",n={"@prefix-cls":f,"@ant-prefix":f,"@iconfont-css-prefix":`${f}-icon`,"@favicon":JSON.stringify(o.favicon)};Object.assign(n,i.modifyVars);export default n;
@@ -1 +0,0 @@
1
- import e from"webpack";import{CONFIG as r}from"./config.mjs";import t from"./plugin/external-remotes.mjs";import{realResolve as o}from"./utils/index.mjs";let{NormalModuleReplacementPlugin:s,container:{ModuleFederationPlugin:a}}=e,i={},m={},l={},n=r.moduleFederation?.map(e=>{if(Array.isArray(e.remotes))for(let r=0,t=e.remotes.length;r<t;r++){let t=e.remotes[r],o=t.alias||t.name,s=t.filename||"remote_entry.js";if(l[o]=`${t.name}@${t.host}/${s}`,Array.isArray(t.library))for(let e=0,r=t.library.length;e<r;e++)i[t.library[e]]=`${o}/${t.library[e]}`}if(Array.isArray(e.exposes))for(let r=0,t=e.exposes.length;r<t;r++){let t=e.exposes[r];"string"==typeof t?m[`./${t}`]=o(t):"[object Object]"===Object.prototype.toString.call(t)&&(m[`./${t.name}`]=o(t.path))}return new a({filename:"remote_entry.js",...e,remotes:l,exposes:m})});n.length&&(n.push(new t),n.push(new s(/(.*)/,e=>{i[e.request]&&(e.request=i[e.request])})));export default n;
package/lib/swcrc.mjs DELETED
@@ -1 +0,0 @@
1
- import{merge as e}from"webpack-merge";import{CONFIG as o}from"./config.mjs";import r from"./paths.mjs";import s from"./polyfills/polyfills.mjs";import{isDev as t,isReact as l,isSolid as n,jsxImportSource as i}from"./process-env.mjs";export const swcMinifyOption={compress:{top_retain:[],keep_infinity:!0,global_defs:{"@alert":"console.log"},pure_funcs:["console.log","console.warn","console.error","console.info"],toplevel:!1,drop_console:!0,drop_debugger:!0,module:!1,ecma:2015,ie8:!1,keep_classnames:void 0,keep_fnames:!1},mangle:!0};let p=function(e){for(let o=0,r=Object.keys(e),s=r.length;o<s;o++)e[r[o]].transform=`${r[o]}/${e[r[o]].transform}`,e[r[o]].style&&(e[r[o]].style=`${r[o]}/${e[r[o]].style}`);return e}(o.importOnDemand||{}),m={include:s(),mode:"entry",coreJs:"3.34"};export default(s=>e({module:{type:"es6",resolveFully:!0},jsc:{parser:{syntax:"typescript",tsx:!0,decorators:!0,dynamicImport:!0},loose:!0,target:o.polyfill?void 0:"es2017",externalHelpers:!1,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,refresh:l&&t,development:t,importSource:i},optimizer:{simplify:!1}},minify:t?void 0:swcMinifyOption,experimental:{emitAssertForImportAttributes:!0,cacheRoot:r.swcCachePath,plugins:[["swc-plugin-another-transform-imports",p],n&&["@moneko/jsx-dom-expressions",{...o.jsxDomExpressions,generate:s?"ssr":"dom",hydratable:!!s}]].filter(Boolean)}},env:o.polyfill?m:void 0,sourceMaps:!0,parseMap:!0},"function"==typeof o.swcrc?o.swcrc(t):o.swcrc||{}));
Binary file
@@ -1,25 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <title><%= htmlWebpackPlugin.options.title %></title>
5
- <%
6
- var customTag="";
7
- if (htmlWebpackPlugin.options.tags) {
8
- htmlWebpackPlugin.options.tags.forEach(function(item){
9
- var { tag = "script", textContent = "", ...attrs } = item;
10
- var _attrs = "";
11
- for (const key in attrs) {
12
- if (attrs.hasOwnProperty(key)) {
13
- _attrs += `${key}="${attrs[key]}" `;
14
- }
15
- }
16
- customTag += `<${tag} ${_attrs}>${textContent}</${tag}>`;
17
- });
18
- }
19
- %>
20
- <%= customTag %>
21
- </head>
22
- <body>
23
- <div id="root"></div>
24
- </body>
25
- </html>
@@ -1,25 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <title><%= htmlWebpackPlugin.options.title %></title>
5
- <%
6
- var customTag="";
7
- if (htmlWebpackPlugin.options.tags) {
8
- htmlWebpackPlugin.options.tags.forEach(function(item){
9
- var { tag = "script", textContent = "", ...attrs } = item;
10
- var _attrs = "";
11
- for (const key in attrs) {
12
- if (attrs.hasOwnProperty(key)) {
13
- _attrs += `${key}="${attrs[key]}" `;
14
- }
15
- }
16
- customTag += `<${tag} ${_attrs}>${textContent}</${tag}>`;
17
- });
18
- }
19
- %>
20
- <%= customTag %>
21
- </head>
22
- <body>
23
- <!--ssr-outlet-->
24
- </body>
25
- </html>
File without changes
File without changes