@moneko/core 4.6.6 → 4.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
import o from"../commom/has-pkg.mjs";import{join as
|
|
1
|
+
import o from"../commom/has-pkg.mjs";import{isNetworkUrl as i,join as e}from"../commom/posix.mjs";import m from"../commom/require.mjs";import{CONFIG as t}from"../config.mjs";let r=t.prefixCls||"n",s=t.htmlPluginOption?.favicon||"favicon.ico",n={"@prefix-cls":r,"@iconfont-css-prefix":`${r}-icon`,"@favicon":JSON.stringify(i(s)?s:e(t.basename,s))},c={},f=o("antd/dist/default-theme.js");f&&Object.assign(c,{...m(f)},{"@ant-prefix":r,hack:`true;@import (optional, reference) "${m.resolve("antd/lib/style/color/colorPalette.less")}";`}),Object.assign(n,c,t.modifyVars);export default n;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as t,readFileSync as e}from"node:fs";import{basename as s,resolve as i,sep as
|
|
1
|
+
import{existsSync as t,readFileSync as e}from"node:fs";import{basename as s,resolve as i,sep as o}from"node:path";import n from"webpack";import{isNetworkUrl as a,join as h}from"../commom/posix.mjs";export class HtmlPlugin{constructor(t={}){this.AddEntry=/(?:.*\/)?main\.[a-zA-Z0-9]+\.entry\.js$/,this.faviconPath="",this.name="HtmlPlugin",this.cachedMetaTags=null,this.cachedCustomTags=null,this.options={title:"WebApp",filename:"index.html",inject:"head",...t}}getPublicPath(t){if("string"==typeof this.options.publicPath)return this.options.publicPath;let e=t.getAssetPath(t.outputOptions.publicPath,{hash:t.hash}),s="auto"===e?"/":e;return s.length&&!s.endsWith("/")&&(s+="/"),s}apply(l){l.hooks.compilation.tap(this.name,r=>{r.hooks.processAssets.tap({name:this.name,stage:n.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL},()=>{let c;if(this.options.favicon)if(a(this.options.favicon))this.faviconPath=this.options.favicon;else{let a=i(l.context,this.options.favicon);if(t(a)){let t=s(this.options.favicon),i=e(a);r.emitAsset(t,new n.sources.RawSource(i),{javascriptModule:!1});let l=this.getPublicPath(r);this.faviconPath=h(l,t).replaceAll(o,"/")}else r.warnings.push(new n.WebpackError(`Favicon file ${a} does not exist`))}if(c=this.options.templateContent?this.options.templateContent(this.options):this.options.template?e(i(l.context,this.options.template),{encoding:"utf-8"}):this.generateDefaultTemplate(),this.options.inject){let t=this.getAssets(r);c=this.injectAssets(c,t,this.options.inject)}let p="function"==typeof this.options.filename?this.options.filename("index"):this.options.filename||"index.html";r.emitAsset(p,new n.sources.RawSource(c),{javascriptModule:!1})})})}generateDefaultTemplate(){let t=this.generateMetaTags();return`<!DOCTYPE html><html><head><meta charset="utf-8">${t}<title>${this.options.title}</title><link rel="icon" type="image/x-icon" href="${this.faviconPath}"></head><body><div id="root"></div></body></html>`}generateMetaTags(){if(null!==this.cachedMetaTags)return this.cachedMetaTags;if(!this.options.meta)return this.cachedMetaTags="","";let t=Object.entries(this.options.meta).map(([t,e])=>{if("string"==typeof e)return`<meta name="${t}" content="${e}">`;if(void 0===e)return"";let s=Object.entries(e).map(([t,e])=>`${t}="${e}"`).join(" ");return`<meta ${s}>`}).join("");return this.cachedMetaTags=t,t}generateCustomTags(){if(null!==this.cachedCustomTags)return this.cachedCustomTags;let t={head:"",body:""};if(!this.options.tags)return this.cachedCustomTags=t,t;let e=[],s=[];return this.options.tags.forEach(t=>{let{tag:i="script",textContent:o="",inject:n=this.options.inject,...a}=t,h=Object.entries(a).filter(([,t])=>null!=t).map(([t,e])=>!0===e?t:`${t}="${e}"`).join(" "),l=`<${i} ${h}>${o}</${i}>`;"head"===n?e.push(l):s.push(l)}),t.head=e.join(""),t.body=s.join(""),this.cachedCustomTags=t,t}getAssets(t){let e={js:[],css:[]},s=["import-scripts","require","async-node"],i=this.getPublicPath(t);for(let n of t.entrypoints.values())for(let t of n.chunks){let n=t.getEntryOptions(),a=n?.chunkLoading;if(!(n?.asyncChunks||a&&s.includes(a)))for(let s of t.files)s.endsWith(".js")?e.js.push(h(i,s).replaceAll(o,"/")):s.endsWith(".css")&&e.css.push(h(i,s).replaceAll(o,"/"))}return e}injectAssets(t,e,s){let i=e.css.length?e.css.map(t=>`<link href="${t}" rel="stylesheet" />`).join(""):"",o=e.js.length?e.js.map(t=>`<script defer ${this.AddEntry.test(t)?'entry="true" ':""}src="${t}"></script>`).join(""):"",n=this.generateCustomTags(),a=t.split("</head>");if(2===a.length){let[t,e]=a,h=e.split("</body>");return"head"===s?`${t}${i}${o}${n.head}</head>${h[0]}${n.body}</body>${h[1]||""}`:`${t}${n.head}</head>${h[0]}${i}${o}${n.body}</body>${h[1]||""}`}return t}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "4.6.
|
|
3
|
+
"version": "4.6.8",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -144,12 +144,12 @@
|
|
|
144
144
|
"core-js-compat": "3.48.0",
|
|
145
145
|
"husky": "9.1.7",
|
|
146
146
|
"less": "4.5.1",
|
|
147
|
-
"less-loader": "12.3.
|
|
147
|
+
"less-loader": "12.3.1",
|
|
148
148
|
"lightningcss": "1.31.1",
|
|
149
149
|
"marked-completed": "1.2.15",
|
|
150
150
|
"swc-loader": "0.2.7",
|
|
151
151
|
"typescript": "5.9.3",
|
|
152
|
-
"webpack": "5.
|
|
152
|
+
"webpack": "5.105.0",
|
|
153
153
|
"webpack-hot-middleware": "2.26.1",
|
|
154
154
|
"webpack-merge": "6.0.1"
|
|
155
155
|
},
|
|
@@ -159,7 +159,7 @@
|
|
|
159
159
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
|
160
160
|
"@types/webpack-hot-middleware": "2.25.12",
|
|
161
161
|
"sass": "1.97.3",
|
|
162
|
-
"sass-loader": "16.0.
|
|
162
|
+
"sass-loader": "16.0.7",
|
|
163
163
|
"solid-refresh": "0.7.5"
|
|
164
164
|
},
|
|
165
165
|
"publishConfig": {
|
|
@@ -170,5 +170,5 @@
|
|
|
170
170
|
"lib",
|
|
171
171
|
"typings"
|
|
172
172
|
],
|
|
173
|
-
"packageManager": "pnpm@10.
|
|
173
|
+
"packageManager": "pnpm@10.29.2"
|
|
174
174
|
}
|