@moneko/core 3.33.1 → 3.33.3

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,6 +1,6 @@
1
1
  import { createRequire } from 'node:module';
2
2
  import { type Options, transformFileSync } from '@swc/core';
3
- declare const require: NodeRequire;
3
+ declare const require: NodeJS.Require;
4
4
  declare const transformOptions: Options;
5
5
  declare function requireEsm(module: NodeJS.Module & {
6
6
  _compile?: (code: string, filename: string) => void;
@@ -1,4 +1,5 @@
1
1
  import marked from 'marked-completed';
2
- declare const renderer: marked.Renderer;
2
+ declare function setup();
3
+ declare let initial: boolean;
3
4
  declare function mdToHtml(text: string);
4
5
  export default mdToHtml;
@@ -1 +1 @@
1
- import e from"marked-completed";let r=new e.Renderer;r.code=(e,r)=>"treeview"===r?`<n-tree data="${e}" />`:`<n-code class="n-code" toolbar="${JSON.stringify(["copy"])}" language="${r}" line-number="true">${encodeURIComponent(e)}</n-code>`,r.image=(e,r,t)=>`<n-img lazy="true" role="img" src="${e}" alt="${t}" ${r?`title="${r}"`:""}></n-img>`,e.use({langToolbar:["copy"],headerPrefix:"# ",breaks:!0,pedantic:!1,smartLists:!0,smartypants:!0,xhtml:!0,renderer:r});export default function(r){return e.parse(r)}
1
+ import e from"marked-completed";let r=!0;export default function(t){return r&&(r=!1,function(){let r=new e.Renderer;r.code=(e,r)=>"treeview"===r?`<n-tree data="${e}" />`:`<n-code class="n-code" toolbar="${JSON.stringify(["copy"])}" language="${r}" line-number="true">${encodeURIComponent(e)}</n-code>`,r.image=(e,r,t)=>`<n-img lazy="true" role="img" src="${e}" alt="${t}" ${r?`title="${r}"`:""}></n-img>`,e.use({langToolbar:["copy"],headerPrefix:"# ",breaks:!0,pedantic:!1,smartLists:!0,smartypants:!0,xhtml:!0,renderer:r})}()),e.parse(t)}
@@ -1,5 +1,5 @@
1
1
  import { resolve } from 'node:path';
2
- import { loadFile, scanFolderSync } from '@moneko/utils';
2
+ import { loadFileRaw, scanFolderSync } from '@moneko/utils';
3
3
  import webpack, { type Compiler } from 'webpack';
4
4
  export interface CopyPluginOption {
5
5
  files?: string[];
@@ -1 +1 @@
1
- import{resolve as e}from"node:path";import{loadFile as s,scanFolderSync as t}from"@moneko/utils";import i from"webpack";let o="CopyPlugin",l=i.sources.RawSource;export class CopyPlugin{constructor(s){this.cacheFiles=[],this.baseFiles=new Set(s.files?.map(s=>e(s))||[]),this.dirs=new Set(s.dirs||[])}getFiles(){let e=new Set(this.baseFiles);for(let s of this.dirs)t(s).forEach(s=>e.add(s));let s={deleted:[],files:[...e]};for(let t of new Set(this.cacheFiles))e.has(t)||s.deleted.push(t);return this.cacheFiles=s.files,s}apply(e){e.hooks.thisCompilation.tap({name:o,stage:e.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},e=>{e.hooks.processAssets.tapPromise(o,async()=>{let t=this.getFiles(),i=t.files.map(e=>s(e));(await Promise.all(i)).forEach((s,i)=>{null!==s&&e.emitAsset(t.files[i],new l(s))}),t.deleted.forEach(s=>{e.deleteAsset(s)})})})}}
1
+ import{resolve as e}from"node:path";import{loadFileRaw as s,scanFolderSync as t}from"@moneko/utils";import i from"webpack";let o="CopyPlugin",l=i.sources.RawSource;export class CopyPlugin{constructor(s){this.cacheFiles=[],this.baseFiles=new Set(s.files?.map(s=>e(s))||[]),this.dirs=new Set(s.dirs||[])}getFiles(){let e=new Set(this.baseFiles);for(let s of this.dirs)t(s,["\\.*"]).forEach(s=>e.add(s));let s={deleted:[],files:[...e]};for(let t of new Set(this.cacheFiles))e.has(t)||s.deleted.push(t);return this.cacheFiles=s.files,s}apply(e){e.hooks.thisCompilation.tap({name:o,stage:e.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},e=>{e.hooks.processAssets.tapPromise(o,async()=>{let t=this.getFiles();(await Promise.all(t.files.map(e=>s(e)))).forEach((s,i)=>{null!==s&&e.emitAsset(t.files[i],new l(Buffer.from(s)))}),t.deleted.forEach(s=>{e.deleteAsset(s)})})})}}
@@ -2,7 +2,7 @@ import { fileURLToPath } from 'node:url';
2
2
  import { ESLint } from '@moneko/eslint';
3
3
  import webpack, { type Compilation, type Compiler } from 'webpack';
4
4
  import { Worker } from 'worker_threads';
5
- import type { ESLintWorkerMessage } from './worker/eslint.mjs';
5
+ import type { ESLintWorkerMessage } from '../worker/eslint.mjs';
6
6
  declare class ESLintError extends webpack.WebpackError {
7
7
  constructor(message: string);
8
8
  }
@@ -1 +1 @@
1
- import{fileURLToPath as t}from"node:url";import r from"webpack";import{Worker as s}from"worker_threads";class e extends r.WebpackError{constructor(t){super(`[ESLint] ${t}`),this.name="ESLintError",this.stack=""}}export default class{constructor(r={files:[]}){this.name="ESLintPlugin",this.options=r,this.worker=new s(t(new URL("./worker/eslint.mjs",import.meta.url)))}apply(t){t.hooks.thisCompilation.tap(this.name,t=>{this.worker.postMessage({options:this.options}),this.worker.once("message",r=>{this.report(t,r)})}),t.hooks.shutdown.tap(this.name,()=>{this.worker.terminate()})}report(t,r){r?.length&&t&&(r[0]?.length&&t.warnings.push(new e(r[0])),r[1]?.length&&t.errors.push(new e(r[1])))}}
1
+ import{fileURLToPath as t}from"node:url";import r from"webpack";import{Worker as s}from"worker_threads";class e extends r.WebpackError{constructor(t){super(`[ESLint] ${t}`),this.name="ESLintError",this.stack=""}}export default class{constructor(r={files:[]}){this.name="ESLintPlugin",this.options=r,this.worker=new s(t(new URL("../worker/eslint.mjs",import.meta.url)))}apply(t){t.hooks.thisCompilation.tap(this.name,t=>{this.worker.postMessage({options:this.options}),this.worker.once("message",r=>{this.report(t,r)})}),t.hooks.shutdown.tap(this.name,()=>{this.worker.terminate()})}report(t,r){r?.length&&t&&(r[0]?.length&&t.warnings.push(new e(r[0])),r[1]?.length&&t.errors.push(new e(r[1])))}}
@@ -2,7 +2,7 @@ import { fileURLToPath } from 'node:url';
2
2
  import type { LinterOptions } from '@moneko/stylelint';
3
3
  import webpack, { type Compilation, type Compiler } from 'webpack';
4
4
  import { Worker } from 'worker_threads';
5
- import type { StylelintWorkerMessage } from './worker/stylelint.mjs';
5
+ import type { StylelintWorkerMessage } from '../worker/stylelint.mjs';
6
6
  declare class StylelintError extends webpack.WebpackError {
7
7
  constructor(message: string);
8
8
  }
@@ -1 +1 @@
1
- import{fileURLToPath as t}from"node:url";import r from"webpack";import{Worker as e}from"worker_threads";class s extends r.WebpackError{constructor(t){super(`[Stylelint] ${t}`),this.name="StylelintError",this.stack=""}}export default class{constructor(r={files:[]}){this.name="StylelintPlugin",this.options=r,this.worker=new e(t(new URL("./worker/stylelint.mjs",import.meta.url)))}apply(t){t.hooks.thisCompilation.tap(this.name,t=>{this.worker.postMessage({options:this.options}),this.worker.once("message",r=>{this.report(r,t)})}),t.hooks.shutdown.tap(this.name,()=>{this.worker.terminate()})}report(t,r){t?.length&&r&&(t[0]?.length&&r.warnings.push(new s(t[0])),t[1]?.length&&r.errors.push(new s(t[1])))}}
1
+ import{fileURLToPath as t}from"node:url";import r from"webpack";import{Worker as e}from"worker_threads";class s extends r.WebpackError{constructor(t){super(`[Stylelint] ${t}`),this.name="StylelintError",this.stack=""}}export default class{constructor(r={files:[]}){this.name="StylelintPlugin",this.options=r,this.worker=new e(t(new URL("../worker/stylelint.mjs",import.meta.url)))}apply(t){t.hooks.thisCompilation.tap(this.name,t=>{this.worker.postMessage({options:this.options}),this.worker.once("message",r=>{this.report(r,t)})}),t.hooks.shutdown.tap(this.name,()=>{this.worker.terminate()})}report(t,r){t?.length&&r&&(t[0]?.length&&r.warnings.push(new s(t[0])),t[1]?.length&&r.errors.push(new s(t[1])))}}
@@ -1 +1 @@
1
- import e from"compression-webpack-plugin";import t from"webpack";import{CopyPlugin as i}from"./plugin/copy.mjs";import{HtmlPlugin as o}from"./plugin/html-plugin.mjs";import r from"./plugin/module-federation.mjs";import{VirtualModuleWebpackPlugin as l}from"./plugin/virtual-module.mjs";import{CONFIG as n}from"./config.mjs";import{packageJson as p}from"./process-env.mjs";let a=[...r,new l(n.virtualModule),new i(n.copy),new t.DefinePlugin({"process.env":JSON.stringify(n.env)}),new t.IgnorePlugin({resourceRegExp:/\/(__(tests|mocks)__|test|spec|e2e)\//}),...n.plugins,new e({filename:"[path][base].gz",algorithm:"gzip",test:/./,threshold:0,minRatio:.8})].filter(Boolean);if(n.htmlPluginOption){let e={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","mobile-web-app-capable":"yes",renderer:"webkit",description:p.description,keywords:Array.isArray(p.keywords)?p.keywords.toString():"","http-equiv":"refresh",viewport:"width=device-width, initial-scale=1"};n.seo&&(e.relCanonical={rel:"canonical",href:`https://${n.seo.domain}${n.basename}`}),n.htmlPluginOption.meta&&Object.assign(e,n.htmlPluginOption.meta),a.push(new o({...n.htmlPluginOption,meta:e}))}if(n.fixBrowserRouter){let e=n.basename.split("/").filter(Boolean).length,t=`${Array(e).fill("..").join("/")+(e?"/":"")}404.html`,i=n.fixBrowserRouter.pathSegmentsToKeep??e;a.push(new o({filename:n.fixBrowserRouter.path??t,inject:!1,templateContent:()=>`<html lang="en"><head><title>Redirect</title><script>const pathKeep = ${i};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>`}))}n.sourceMap&&a.push(new t.SourceMapDevToolPlugin(n.sourceMap));export default a;
1
+ import e from"compression-webpack-plugin";import t from"webpack";import{CopyPlugin as i}from"./plugin/copy.mjs";import{HtmlPlugin as o}from"./plugin/html-plugin.mjs";import r from"./plugin/module-federation.mjs";import{VirtualModuleWebpackPlugin as l}from"./plugin/virtual-module.mjs";import{CONFIG as n}from"./config.mjs";import{packageJson as p}from"./process-env.mjs";let a=[...r,new l(n.virtualModule),new i(n.copy),new t.DefinePlugin({"process.env":JSON.stringify(n.env)}),new t.IgnorePlugin({resourceRegExp:/\/(__(tests|mocks)__|test|spec|e2e)\//}),...n.plugins,new e({filename:"[path][base].gz",algorithm:"gzip",test:/\.(js|css|html|svg)$/})].filter(Boolean);if(n.htmlPluginOption){let e={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","mobile-web-app-capable":"yes",renderer:"webkit",description:p.description,keywords:Array.isArray(p.keywords)?p.keywords.toString():"","http-equiv":"refresh",viewport:"width=device-width, initial-scale=1"};n.seo&&(e.relCanonical={rel:"canonical",href:`https://${n.seo.domain}${n.basename}`}),n.htmlPluginOption.meta&&Object.assign(e,n.htmlPluginOption.meta),a.push(new o({...n.htmlPluginOption,meta:e}))}if(n.fixBrowserRouter){let e=n.basename.split("/").filter(Boolean).length,t=`${Array(e).fill("..").join("/")+(e?"/":"")}404.html`,i=n.fixBrowserRouter.pathSegmentsToKeep??e;a.push(new o({filename:n.fixBrowserRouter.path??t,inject:!1,templateContent:()=>`<html lang="en"><head><title>Redirect</title><script>const pathKeep = ${i};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>`}))}n.sourceMap&&a.push(new t.SourceMapDevToolPlugin(n.sourceMap));export default a;
package/lib/vm/docs.mjs CHANGED
@@ -1 +1 @@
1
- import{relative as e,sep as t}from"node:path";import{loadFile as o,scanFolderSync as m}from"@moneko/utils";import a from"../commom/parse-module-meta.mjs";import n from"../commom/paths.mjs";import r from"../commom/reactive-object.mjs";import s from"../commom/rule.mjs";import{CONFIG as l}from"../config.mjs";import{FRAMEWORK as c,framework as p,isLibrary as i,isReact as d,isSolid as f}from"../process-env.mjs";import u from"./generate-doc.mjs";let g={react:"createElement",solid:"createComponent"}[c],h=a("@app/docs");export const docsModuleName=h.file;export const docsModulePkgJson=h.pkg;export const docsModuleMeta=h.meta;export const docs=new r({[docsModuleName]:"export default {}",[docsModulePkgJson]:docsModuleMeta});export const comment=new r({});export const getCommentPath=function(){let e=/\/(.+?)\.tsx?$/,t=l.alias["@pkg"]?.length;return o=>o.substring(t).replace(/\\/g,"/").replace(e,"@app/comment/$1.md")}();if(i&&!1!==l.htmlPluginOption){let r={},c=`import { ${g}${f?",Dynamic":""} } from "${p}${f?"/web":""}";import SuspenseComp from "@app/suspense";function call_then(res) {return {default: ${d?"() =>":""}${g}(${f?"Dynamic":"'div'"}, {${f?"innerHTML: res.default, component: 'div', class: 'n-md-box' ":"dangerouslySetInnerHTML: {__html:res.default}, className: 'n-md-box'"} })};}`,i=(e,o)=>{if(!e.endsWith("package.json")){let m=e.replace(/@app[/\\]comment[/\\]/,"").split(t),a=m.pop(),n=m.join("/");r[n]||(r[n]={}),o?r[n][a]&&delete r[n][a]:r[n][a]=`rr(() => ${g}(SuspenseComp, { comp: () => import(/* webpackChunkName: '${e}' */ '${e}?raw').then(call_then)}))rr`;let l={};for(let e in r)Object.prototype.hasOwnProperty.call(r,e)&&(l[e]=Object.values(r[e]));docs.setData(docsModuleName,`${c}export default ${JSON.stringify(l).replace(s.extract_func,"$1")}`)}};comment.on("change",(t,o)=>{i(e(n.nodeModules,t),o?.length<0)});let h=m(l.alias["@pkg"],["\\.tsx?$"]).filter(e=>!/(^|\/)\.[^\\/\\.]|\.test\./i.test(e));await Promise.all(h.map(async e=>({data:await o(e),file:e}))).then(e=>{for(let t=0;t<e.length;t++){let o=e[t];if(o.data){let{file:e,pkg:t,meta:m}=a(getCommentPath(o.file));comment.setData(e,u(o.data,o.file)),comment.setData(t,m)}}})}
1
+ import{relative as e,sep as t}from"node:path";import{loadFile as o,scanFolderSync as m}from"@moneko/utils";import a from"../commom/parse-module-meta.mjs";import r from"../commom/paths.mjs";import n from"../commom/reactive-object.mjs";import s from"../commom/rule.mjs";import{CONFIG as l}from"../config.mjs";import{FRAMEWORK as c,framework as p,isLibrary as i,isReact as d,isSolid as f}from"../process-env.mjs";import u from"./generate-doc.mjs";let g={react:"createElement",solid:"createComponent"}[c],$=a("@app/docs");export const docsModuleName=$.file;export const docsModulePkgJson=$.pkg;export const docsModuleMeta=$.meta;export const docs=new n({[docsModuleName]:"export default {}",[docsModulePkgJson]:docsModuleMeta});export const comment=new n({});export const getCommentPath=function(){let e=/\/(.+?)\.tsx?$/,t=l.alias["@pkg"]?.length;return o=>o.substring(t).replace(/\\/g,"/").replace(e,"@app/comment/$1.md")}();if(i&&!1!==l.htmlPluginOption){let n={},c=`import { ${g}${f?",Dynamic":""} } from "${p}${f?"/web":""}";import SuspenseComp from "@app/suspense";function call_then(res) {return {default: ${d?"() =>":""}${g}(${f?"Dynamic":"'div'"}, {${f?"innerHTML: res.default, component: 'div', class: 'n-md-box' ":"dangerouslySetInnerHTML: {__html:res.default}, className: 'n-md-box'"} })};}`,i=(e,o)=>{if(!e.endsWith("package.json")){let m=e.replace(/@app[/\\]comment[/\\]/,"").split(t),a=m.pop(),r=m.join("/");n[r]||(n[r]={}),o?n[r][a]&&delete n[r][a]:n[r][a]=`rr(() => ${g}(SuspenseComp, { comp: () => import(/* webpackChunkName: '${e}' */ '${e}?raw').then(call_then)}))rr`;let l={};for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&(l[e]=Object.values(n[e]));docs.setData(docsModuleName,`${c}export default ${JSON.stringify(l).replace(s.extract_func,"$1")}`)}};comment.on("change",(t,o)=>{i(e(r.nodeModules,t),o?.length<0)});let $=m(l.alias["@pkg"],["\\.tsx?$"]).filter(e=>!/(^|\/)\.[^\\/\\.]|\.test\./i.test(e)),h=await Promise.all($.map(async e=>({data:await o(e),file:e})));for(let e=0;e<h.length;e++){let t=h[e];if(t.data){let{file:e,pkg:o,meta:m}=a(getCommentPath(t.file));comment.setData(e,u(t.data,t.file)),comment.setData(o,m)}}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.33.1",
3
+ "version": "3.33.3",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
File without changes
File without changes
File without changes
File without changes