@moneko/core 4.5.6 → 4.5.8-beta.0
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/commom/has-pkg.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import r from"./require.mjs";export default function(
|
|
1
|
+
import{sep as r}from"node:path";import e from"./require.mjs";export default function(t){try{return e.resolve(t.replaceAll(r,"/"))}catch{return!1}};
|
package/lib/commom/posix.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{join as e
|
|
1
|
+
import{join as e}from"node:path";import{URL as r}from"node:url";export{basename,dirname,extname,normalize,parse,relative,resolve,sep}from"node:path";export function join(...t){let o=t[0];if(/^https?:\/\//.test(o)){let e=o;for(let o=1;o<t.length;o++)e=new r(t[o],e).href;return e}return e(...t)}
|
package/lib/file-system.d.mts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
// import { Volume } from '@jsonjoy.com/fs-node';
|
|
2
|
+
import { type FsPromisesApi, toUnixTimestamp, Volume } from '@jsonjoy.com/fs-node';
|
|
3
|
+
export interface IFs extends Volume {
|
|
4
|
+
_toUnixTimestamp: typeof toUnixTimestamp;
|
|
5
|
+
__vol: Volume;
|
|
6
|
+
promises: FsPromisesApi;
|
|
7
|
+
}
|
|
8
|
+
export declare function createFsFromVolume(vol: Volume): IFs;
|
|
2
9
|
export declare const outputFileSystem: IFs;
|
package/lib/file-system.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{constants as t}from"node:fs";import{Dirent as e,fsCallbackApiList as a,fsSynchronousApiList as n,Stats as o,toUnixTimestamp as r,Volume as i}from"@jsonjoy.com/fs-node";let{F_OK:p,R_OK:c,W_OK:f,X_OK:l}=t;export function createFsFromVolume(i){let m={F_OK:p,R_OK:c,W_OK:f,X_OK:l,constants:t,Stats:o,Dirent:e};for(let t of n)"function"==typeof i[t]&&Object.assign(m,{method:i[t].bind(i)});for(let t of a)"function"==typeof i[t]&&Object.assign(m,{method:i[t].bind(i)});return m.StatWatcher=i.StatWatcher,m.FSWatcher=i.FSWatcher,m.WriteStream=i.WriteStream,m.ReadStream=i.ReadStream,m.promises=i.promises,"function"==typeof i.realpath&&(m.realpath=i.realpath.bind(i),"function"==typeof i.realpath.native&&(m.realpath.native=i.realpath.native.bind(i))),"function"==typeof i.realpathSync&&(m.realpathSync=i.realpathSync.bind(i),"function"==typeof i.realpathSync.native&&(m.realpathSync.native=i.realpathSync.native.bind(i))),m._toUnixTimestamp=r,m.__vol=i,m}let m=new i;export const outputFileSystem=createFsFromVolume(m);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as t,readFileSync as e}from"node:fs";import s from"webpack";import{basename as i,join as n,resolve as o}from"../commom/paths.mjs";export class HtmlPlugin{constructor(t={}){this.AddEntry=/(?:.*\/)?main\.[a-zA-Z0-9]+\.bundle\.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(
|
|
1
|
+
import{existsSync as t,readFileSync as e}from"node:fs";import s from"webpack";import{basename as i,join as n,resolve as o,sep as a}from"../commom/paths.mjs";export class HtmlPlugin{constructor(t={}){this.AddEntry=/(?:.*\/)?main\.[a-zA-Z0-9]+\.bundle\.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(h){h.hooks.compilation.tap(this.name,l=>{l.hooks.processAssets.tap({name:this.name,stage:s.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL},()=>{let r;if(this.options.favicon){let r=o(h.context,this.options.favicon);if(t(r)){let t=i(this.options.favicon),o=e(r);l.emitAsset(t,new s.sources.RawSource(o),{javascriptModule:!1});let h=this.getPublicPath(l);this.faviconPath=n(h,t).replaceAll(a,"/")}else l.warnings.push(new s.WebpackError(`Favicon file ${r} does not exist`))}if(r=this.options.templateContent?this.options.templateContent(this.options):this.options.template?e(o(h.context,this.options.template),{encoding:"utf-8"}):this.generateDefaultTemplate(),this.options.inject){let t=this.getAssets(l);r=this.injectAssets(r,t,this.options.inject)}let c="function"==typeof this.options.filename?this.options.filename("index"):this.options.filename||"index.html";l.emitAsset(c,new s.sources.RawSource(r),{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:n="",inject:o=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}>${n}</${i}>`;"head"===o?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 o of t.entrypoints.values())for(let t of o.chunks){let o=t.getEntryOptions(),h=o?.chunkLoading;if(!(o?.asyncChunks||h&&s.includes(h)))for(let s of t.files)s.endsWith(".js")?e.js.push(n(i,s).replaceAll(a,"/")):s.endsWith(".css")&&e.css.push(n(i,s).replaceAll(a,"/"))}return e}injectAssets(t,e,s){let i=e.css.length?e.css.map(t=>`<link href="${t}" rel="stylesheet" />`).join(""):"",n=e.js.length?e.js.map(t=>`<script defer ${this.AddEntry.test(t)?'entry="true" ':""}src="${t}"></script>`).join(""):"",o=this.generateCustomTags(),a=t.split("</head>");if(2===a.length){let[t,e]=a,h=e.split("</body>");return"head"===s?`${t}${i}${n}${o.head}</head>${h[0]}${o.body}</body>${h[1]||""}`:`${t}${o.head}</head>${h[0]}${i}${n}${o.body}</body>${h[1]||""}`}return t}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.8-beta.0",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -129,6 +129,7 @@
|
|
|
129
129
|
"homepage": "https://monako97.github.io/neko-ui/@moneko/config",
|
|
130
130
|
"license": "MIT",
|
|
131
131
|
"dependencies": {
|
|
132
|
+
"@jsonjoy.com/fs-node": "4.56.10",
|
|
132
133
|
"@moneko/convert": "1.2.0",
|
|
133
134
|
"@moneko/eslint": "1.11.1",
|
|
134
135
|
"@moneko/mdx": "1.0.3",
|
|
@@ -137,7 +138,7 @@
|
|
|
137
138
|
"@moneko/stylelint": "1.8.2",
|
|
138
139
|
"@moneko/transform-imports": "1.4.0",
|
|
139
140
|
"@moneko/utils": "0.3.3",
|
|
140
|
-
"@swc/core": "1.15.
|
|
141
|
+
"@swc/core": "1.15.11",
|
|
141
142
|
"browserslist": "4.28.1",
|
|
142
143
|
"core-js": "3.48.0",
|
|
143
144
|
"core-js-compat": "3.48.0",
|
|
@@ -146,7 +147,6 @@
|
|
|
146
147
|
"less-loader": "12.3.0",
|
|
147
148
|
"lightningcss": "1.31.1",
|
|
148
149
|
"marked-completed": "1.2.15",
|
|
149
|
-
"memfs": "4.52.0",
|
|
150
150
|
"swc-loader": "0.2.7",
|
|
151
151
|
"typescript": "5.9.3",
|
|
152
152
|
"webpack": "5.104.1",
|
|
@@ -170,5 +170,5 @@
|
|
|
170
170
|
"lib",
|
|
171
171
|
"typings"
|
|
172
172
|
],
|
|
173
|
-
"packageManager": "pnpm@10.28.
|
|
173
|
+
"packageManager": "pnpm@10.28.2"
|
|
174
174
|
}
|