@moneko/core 3.58.1-bate.3 → 3.58.1-bate.4
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{existsSync as t,readFileSync as s}from"node:fs";import{basename as o,join as e,relative as i,resolve as r}from"node:path";import a from"webpack";import n from"../../commom/paths.mjs";import{packageJson as p}from"../../process-env.mjs";export*from"./types.mjs";export class ManifestPlugin{constructor(t){this.name="ManifestPlugin",this.options={filename:"site.webmanifest",name:p.name,short_name:p.shortName,description:p.description,
|
|
1
|
+
import{existsSync as t,readFileSync as s}from"node:fs";import{basename as o,join as e,relative as i,resolve as r}from"node:path";import a from"webpack";import n from"../../commom/paths.mjs";import{packageJson as p}from"../../process-env.mjs";export*from"./types.mjs";export class ManifestPlugin{constructor(t){this.name="ManifestPlugin",this.options={filename:"site.webmanifest",name:p.name,short_name:p.shortName,description:p.description,scope:"/",display:p.display??"standalone",background_color:p.backgroundColor??"#fff",theme_color:p.themeColor,icons:[{src:i(n.programPath,`${n.corePath}/options/icon.webp`),type:"image/webp",sizes:"512x512"}]},this.options={...this.options,...t}}getPublicPath(t){if(this.options.publicPath)return this.options.publicPath;let s=t.getAssetPath(t.outputOptions.publicPath,{hash:t.hash}),o="auto"===s?"/":s;return o.length&&!o.endsWith("/")&&(o+="/"),o}apply(i){let n=this.name,{filename:c,publicPath:h,start_url:m,...l}=this.options;i.hooks.compilation.tap(n,u=>{u.hooks.processAssets.tap({name:n,stage:a.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL},()=>{let n=h||this.getPublicPath(u),f={...l,start_url:m??n,icons:l.icons?.map(p=>{let c={...p};if(c.src&&!c.src.startsWith("http")){let p=r(i.context,c.src);if(t(p)){let t=o(c.src),i=s(p);u.emitAsset(t,new a.sources.RawSource(i),{javascriptModule:!1}),c.src=e(n,t)}else u.warnings.push(new a.WebpackError(`Icon file ${p} does not exist`))}return c}),version:`${p.version}(${u.fullHash})`};u.emitAsset(c,new i.webpack.sources.RawSource(JSON.stringify(f)),{javascriptModule:!1})})})}}
|