@moneko/core 3.9.17-beta.2 → 3.9.17-beta.21
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/build/common.d.mts +3 -0
- package/lib/build/common.mjs +1 -0
- package/lib/build/server.d.mts +3 -0
- package/lib/build/server.mjs +1 -0
- package/lib/build.mjs +1 -0
- package/lib/{common.d.ts → common.d.mts} +1 -1
- package/lib/common.mjs +1 -0
- package/lib/{config.d.ts → config.d.mts} +1 -1
- package/lib/config.mjs +1 -0
- package/lib/dev/config.d.mts +6 -0
- package/lib/dev/config.mjs +3 -0
- package/lib/dev/mock.d.mts +40 -0
- package/lib/dev/mock.mjs +1 -0
- package/lib/{net.d.ts → dev/net.d.mts} +1 -1
- package/lib/dev/net.mjs +1 -0
- package/lib/dev/proxy.d.mts +7 -0
- package/lib/dev/proxy.mjs +1 -0
- package/lib/dev.mjs +1 -0
- package/lib/index.d.mts +16 -0
- package/lib/index.mjs +1 -0
- package/lib/loader/ts-doc.d.cts +1 -1
- package/lib/module.config.d.mts +3 -0
- package/lib/module.config.mjs +1 -0
- package/lib/options/favicon.ico +0 -0
- package/lib/{html-plugin-option.d.ts → options/html-plugin-option.d.mts} +1 -1
- package/lib/options/html-plugin-option.mjs +11 -0
- package/lib/{minify.d.ts → options/js-minify.d.mts} +2 -2
- package/lib/options/js-minify.mjs +1 -0
- package/lib/options/jsx-dom-expressions.d.mts +10 -0
- package/lib/options/jsx-dom-expressions.mjs +1 -0
- package/lib/{modify-vars.d.ts → options/modify-vars.d.mts} +0 -1
- package/lib/options/modify-vars.mjs +1 -0
- package/lib/options/split-chunk.d.mts +4 -0
- package/lib/options/split-chunk.mjs +1 -0
- package/lib/{swcrc.d.ts → options/swcrc.d.mts} +1 -1
- package/lib/options/swcrc.mjs +1 -0
- package/lib/{paths.d.ts → paths.d.mts} +4 -2
- package/lib/paths.mjs +1 -0
- package/lib/plugin/{add-entry-attribute.d.ts → add-entry-attribute.d.mts} +2 -3
- package/lib/plugin/add-entry-attribute.mjs +1 -0
- package/lib/plugin/{external-remotes.js → external-remotes.mjs} +1 -1
- package/lib/plugin/{lightningcss-plugin.d.ts → lightningcss-plugin.d.mts} +2 -2
- package/lib/plugin/lightningcss-plugin.mjs +1 -0
- package/lib/plugin/module-federation.mjs +1 -0
- package/lib/plugin/override-resolve.mjs +1 -0
- package/lib/plugin/{virtual-module.d.ts → virtual-module.d.mts} +2 -3
- package/lib/plugin/virtual-module.mjs +1 -0
- package/lib/plugins.config.mjs +1 -0
- package/lib/polyfills/polyfills.mjs +1 -0
- package/lib/polyfills/targets.mjs +1 -0
- package/lib/{process-env.d.ts → process-env.d.mts} +2 -2
- package/lib/process-env.mjs +1 -0
- package/lib/rule.d.mts +22 -0
- package/lib/rule.mjs +1 -0
- package/lib/utils/compiler-listener.d.mts +3 -0
- package/lib/utils/compiler-listener.mjs +1 -0
- package/lib/utils/esm.d.mts +2 -0
- package/lib/utils/esm.mjs +1 -0
- package/lib/utils/has-pkg.d.mts +2 -0
- package/lib/utils/has-pkg.mjs +1 -0
- package/lib/{utils.d.ts → utils/index.d.mts} +0 -4
- package/lib/utils/index.mjs +1 -0
- package/lib/utils/log.d.mts +2 -0
- package/lib/utils/log.mjs +2 -0
- package/lib/utils/match-path.d.mts +22 -0
- package/lib/utils/match-path.mjs +1 -0
- package/lib/utils/read-conf.d.mts +2 -0
- package/lib/utils/read-conf.mjs +1 -0
- package/lib/utils/run.d.mts +2 -0
- package/lib/utils/run.mjs +1 -0
- package/lib/utils/seo.mjs +1 -0
- package/lib/utils/tfc.d.mts +2 -0
- package/lib/utils/tfc.mjs +1 -0
- package/lib/vm/coverage.mjs +1 -0
- package/lib/vm/{docs.d.ts → docs.d.mts} +1 -1
- package/lib/vm/docs.mjs +1 -0
- package/lib/vm/{example.d.ts → example.d.mts} +1 -1
- package/lib/vm/example.mjs +1 -0
- package/lib/vm/generate-doc.mjs +1 -0
- package/lib/{info.d.ts → vm/info.d.mts} +4 -3
- package/lib/vm/info.mjs +1 -0
- package/lib/vm/{locales.d.ts → locales.d.mts} +1 -1
- package/lib/vm/locales.mjs +2 -0
- package/lib/vm/modules.d.mts +17 -0
- package/lib/vm/modules.mjs +1 -0
- package/lib/vm/{routes.d.ts → routes.d.mts} +1 -1
- package/lib/vm/routes.mjs +1 -0
- package/package.json +20 -16
- package/typings/global.d.ts +58 -157
- package/lib/common.js +0 -1
- package/lib/config.js +0 -1
- package/lib/dev.js +0 -3
- package/lib/has-pkg.d.ts +0 -1
- package/lib/has-pkg.js +0 -1
- package/lib/html-plugin-option.js +0 -1
- package/lib/index.d.ts +0 -8
- package/lib/index.js +0 -1
- package/lib/info.js +0 -1
- package/lib/minify.js +0 -1
- package/lib/modify-vars.js +0 -1
- package/lib/module-federation.js +0 -1
- package/lib/module.config.d.ts +0 -3
- package/lib/module.config.js +0 -1
- package/lib/net.js +0 -1
- package/lib/paths.js +0 -1
- package/lib/plugin/add-entry-attribute.js +0 -1
- package/lib/plugin/lightningcss-plugin.js +0 -1
- package/lib/plugin/override-resolve.js +0 -1
- package/lib/plugin/virtual-module.js +0 -1
- package/lib/plugins.config.js +0 -1
- package/lib/polyfills.js +0 -1
- package/lib/process-env.js +0 -1
- package/lib/prod.js +0 -1
- package/lib/seo.js +0 -1
- package/lib/server.d.ts +0 -1
- package/lib/server.js +0 -1
- package/lib/swcrc.js +0 -1
- package/lib/targets.js +0 -1
- package/lib/tsloader.config.d.ts +0 -8
- package/lib/tsloader.config.js +0 -1
- package/lib/utils.js +0 -2
- package/lib/vm/coverage.js +0 -1
- package/lib/vm/docs.js +0 -1
- package/lib/vm/example.js +0 -1
- package/lib/vm/generate-doc.js +0 -1
- package/lib/vm/locales.js +0 -2
- package/lib/vm/routes.js +0 -1
- package/template/favicon.ico +0 -0
- package/template/index.html +0 -25
- /package/lib/{dev.d.ts → build.d.mts} +0 -0
- /package/lib/{prod.d.ts → dev.d.mts} +0 -0
- /package/lib/plugin/{done.d.ts → done.d.mts} +0 -0
- /package/lib/plugin/{done.js → done.mjs} +0 -0
- /package/lib/plugin/{external-remotes.d.ts → external-remotes.d.mts} +0 -0
- /package/lib/{module-federation.d.ts → plugin/module-federation.d.mts} +0 -0
- /package/lib/plugin/{override-resolve.d.ts → override-resolve.d.mts} +0 -0
- /package/lib/{plugins.config.d.ts → plugins.config.d.mts} +0 -0
- /package/lib/{polyfills.d.ts → polyfills/polyfills.d.mts} +0 -0
- /package/lib/polyfills/{replace-children.js → replace-children.mjs} +0 -0
- /package/lib/{targets.d.ts → polyfills/targets.d.mts} +0 -0
- /package/lib/{os-tmp-dir.d.ts → utils/os-tmp-dir.d.mts} +0 -0
- /package/lib/{os-tmp-dir.js → utils/os-tmp-dir.mjs} +0 -0
- /package/lib/{reactive-object.d.ts → utils/reactive-object.d.mts} +0 -0
- /package/lib/{reactive-object.js → utils/reactive-object.mjs} +0 -0
- /package/lib/{resolver-sync.d.ts → utils/resolver-sync.d.mts} +0 -0
- /package/lib/{resolver-sync.js → utils/resolver-sync.mjs} +0 -0
- /package/lib/{seo.d.ts → utils/seo.d.mts} +0 -0
- /package/lib/{svg-to-data-uri.d.ts → utils/svg-to-data-uri.d.mts} +0 -0
- /package/lib/{svg-to-data-uri.js → utils/svg-to-data-uri.mjs} +0 -0
- /package/lib/vm/{coverage.d.ts → coverage.d.mts} +0 -0
- /package/lib/vm/{generate-doc.d.ts → generate-doc.d.mts} +0 -0
- /package/lib/vm/{utils.d.ts → utils.d.mts} +0 -0
- /package/lib/vm/{utils.js → utils.mjs} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import ReactiveObject from '../reactive-object.
|
|
1
|
+
import ReactiveObject from '../utils/reactive-object.mjs';
|
|
2
2
|
export declare const exampleModuleName = "@app/example";
|
|
3
3
|
export declare const examples: ReactiveObject<Record<string, string>>;
|
|
4
4
|
export declare function generatorDemo(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{generateExample as e}from"@moneko/mdx";import{watchFiles as t}from"./utils.mjs";import o from"../paths.mjs";import{isDev as r,isLibrary as m}from"../process-env.mjs";import p from"../utils/reactive-object.mjs";export const exampleModuleName="@app/example";function a(){try{return JSON.parse(e(o.componentsPath,"@app/example/"))}catch(e){return{}}}export const examples=new p(m?a():{});export function generatorDemo(){let e=a();for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&examples.setData(t,e[t])}m&&r&&t(o.componentsPath,/(?<!\/examples\/(.+)\.md)$/,generatorDemo);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{dirname as e}from"path";import t from"typescript";import{CONFIG as n}from"../config.mjs";let{ScriptKind:r,ScriptTarget:l,SyntaxKind:o,createSourceFile:i,forEachChild:a,getLeadingCommentRanges:c,isInterfaceDeclaration:u,isQuestionToken:s,isPropertySignature:f,isFunctionTypeNode:p,isUnionTypeNode:m,isMethodSignature:g}=t,$={};function h(e){let t=c(e.getSourceFile().text,e.pos);if(t){let n=e.getSourceFile().text.substring(t[0].pos,t[0].end).match(/\/\*\*([\s\S]*?)\*\//);if(n)return n[1].replace(/^\s*\* ?/gm,"").replace(/\s+$/,"").trim()}return null}function b(e){if(!e)return null;let t=e.match(/@since\s+([^\n]+)/);return t?t[1].trim():null}function d(e){if(!e)return null;let t=e.match(/@author (\w+)\s*(?:<([^>]+)>)?/);if(t?.length){let e=t[1].trim(),n=t[2]?.trim(),r=/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(n);return n?r&&(n=`mailto:${n}`):n=`https://github.com/${e}`,`[${e}](${n})`}return null}function y(e){if(!e)return null;let t=e.match(/@ignore\s+([^\n]+)/);return t?t[1].trim():null}let x=/(?<!['"])(unknown|any|void|bigint|object|undefined|null|boolean|number|string|symbol)(?!['"])/g;function j(e,t){if(!e)return null;let r=e.replace(/\b([A-Z][a-zA-Z0-9]*)\b/g,e=>{if($[e]){let r=`/${[n.basename,$[e]].join("/").split("/").filter(Boolean).join("/")}`;return t?`[\\color{#009688}{${e}}](${r})`:`[${e}](${r})`}return t?`\\color{#009688}{${e}}`:e});return t&&(r=r.replace(x,e=>`\\color{#009688}{${e}}`)),r}function T(e){return(function(e){let t;if(!e)return null;let n=[];for(;t=/\\color{([^|}]*)\|?([^|}]*)\|?([^|}]*)\|?([^}]*)}{([^}]*)}/g.exec(e);)n.push(t[0]);return e.replace(/[{}[\]()=>]|keyof|typeof|true|false/g,e=>n.some(t=>t.includes(e))?e:`\\color{#569cd6}{${e}}`)})(e)?.replace(/^\s*\|\s*|\s*\|\s*$/gm,"").replace(/\n/g,"<br/>").replace(/\*/g,"\\*").replace(/\|/g,"\\|").replace(/(['"])((?:(?!\1).)*)\1/g,"\\color{#ce9178}{$1$2$1}")}function B(e){return e?e.replace(/^@[a-z].+/gm,"").replace(/(\n\s+)+/g,"<br />").replace(/\n/g,"<br />").replace(/(<br \/>)$/g,""):null}export default function k(c,x){let k=i(x,c,l.Latest,!0,r.TS),w="";return a(k,r=>{u(r)?w+=function(r){let l=r.name.text;Object.assign($,{[r.name.text]:e(r.getSourceFile().fileName).replace(n.alias["@pkg"],"")});let i=h(r),a=b(i),c=B(i),u=y(i)?.split("|")||[],x=u.includes("comment"),k=u.includes("initial"),w=u.includes("optional"),E=u.includes("version"),S=u.includes("author"),v=c?`\\color{|4||0.45}{${l}}`:l,F=(function(e){let n=[];if(e.heritageClauses){for(let r of e.heritageClauses)if(r.token===t.SyntaxKind.ExtendsKeyword)for(let e of r.types)n.push(e.getText())}return n})(r)?.map(e=>`<n-tag color="#4c81db" css=".tag{gap:0px;}">${j(T(e))}</n-tag>`),z=[c,v,a&&`\\color{#52c11b|1||0.9}{${a}}`,F.length>0&&`<sub>\`extends\`</sub> ${F.join(" ")}`].filter(Boolean).join(" "),K=`## ${z}`,N=r.members.filter(e=>f(e)&&e.type?.kind!==o.NeverKeyword||g(e)),q=[];if(N.length){N.forEach(e=>{let t=j(T(g(e)?`(${e.parameters.map(e=>`${e.name.getText()}: ${e.type?.getText()||"any"}`).join(", ")}): ${e.type?.getText()||"any"}`:e.type?.getText()||"any"),!0),n=h(e),r=T(e.name.getText());!r||r.startsWith("\\color")||(g(e)||function(e){if(e.type){if(!m(e.type))return p(e.type);for(let t of e.type.types)if(p(t))return!0}return!1}(e)||t?.includes("=>")?r=`\\color{#f9a913}{${r}}`:/^["'](.+)["']$/.test(r)||(r=`\\color{#4c81db}{${r}}`));let l=e.questionToken&&s(e.questionToken);q.push([r,!w&&`\\color{${l?"#f9a913":"#52c11b"}\\|\\|\\|0.9}{${l?"✘":"✔"}}`,!x&&T(B(n)),t,!k&&T(function(e){if(!e)return null;let t=e.match(/@default\s+([^\n]+)/);return t?t[1].trim():null}(n)),!E&&T(b(n)),!S&&(d(n)||d(i))])});let e=!1,t=!1,n=!1,r=!1;q.forEach(l=>{!x&&l[2]&&(r=!0),!k&&l[4]&&(n=!0),!E&&l[5]&&(t=!0),!S&&l[6]&&(e=!0)}),K+="\n";let l=["属性",!w&&"必要",r&&"说明","类型",n&&"默认值",t&&"版本",e&&"作者"].filter(Boolean).join("|");K+=`|${l}|`;let o=[":-",!w&&":-",r&&":-",":-",n&&":-",t&&":-",e&&":-"].filter(Boolean);K+="\n";let a=o.join("|");K+=`|${a}|`,q.forEach(l=>{K+="\n";let o=[l[0]||"-",!w&&(l[1]||"-"),r&&(l[2]||"-"),l[3]||"-",n&&(l[4]||"-"),t&&(l[5]||"-"),e&&(l[6]||"-")].filter(Boolean).join("|");K+=`|${o}|`}),K+="\n"}return K+="\n"}(r):t.isEnumDeclaration(r)&&(w+=function(r){let l=r.name.text,o=h(r),i=B(o),a=b(o);Object.assign($,{[r.name.text]:e(r.getSourceFile().fileName).replace(n.alias["@pkg"],"")});let c=i?`\\color{|4||0.45}{${l}}`:l,u=[i,c,a&&`\\color{#52c11b|1||0.9}{${a}}`].filter(Boolean).join(" "),s=y(o)?.split("|")||[],f=s.includes("comment"),p=s.includes("version"),m=s.includes("author"),g=`## ${u}`;if(r.members.length){let e=[];r.members.forEach(n=>{let r=T(n.name.getText()),l=h(n),i=T(function(e){let n=e.initializer;return n&&t.isStringLiteral(n)?` '${n.text}'`:null}(n)),a=T(b(l)),c=T(B(l));!r||r.startsWith("\\color")||/^["'](.+)["']$/.test(r)||(r=`\\color{#4c81db}{${r}}`),e.push([r,!f&&c,i,!p&&a,!m&&(d(l)||d(o))])});let n=!1,l=!1,i=!1;e.forEach(e=>{!f&&e[1]&&(i=!0),!p&&e[3]&&(l=!0),!m&&e[4]&&(n=!0)}),g+="\n";let a=["属性",i&&"说明","值",l&&"版本",n&&"作者"].filter(Boolean).join("|");g+=`|${a}|`;let c=[":-",i&&":-",":-",l&&":-",n&&":-"].filter(Boolean);g+="\n";let u=c.join("|");g+=`|${u}|`,e.forEach(e=>{g+="\n";let t=[e[0]||"-",i&&(e[1]||"-"),e[2]||"-",l&&(e[3]||"-"),n&&(e[4]||"-")].filter(Boolean).join("|");g+=`|${t}|`})}return g+="\n\n"}(r))}),w}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
declare const app: {
|
|
2
2
|
name: string;
|
|
3
3
|
projectName: string;
|
|
4
|
+
ssr: boolean;
|
|
4
5
|
version: string;
|
|
5
6
|
base: string;
|
|
6
|
-
type: import("
|
|
7
|
-
routerMode: "
|
|
7
|
+
type: import("../index.mjs").AppType;
|
|
8
|
+
routerMode: "hash" | "browser" | "memory";
|
|
8
9
|
prefixCls: string | undefined;
|
|
9
|
-
theme: import("
|
|
10
|
+
theme: import("../index.mjs").Theme | undefined;
|
|
10
11
|
description: any;
|
|
11
12
|
author: any;
|
|
12
13
|
repository: any;
|
package/lib/vm/info.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{loadFileSync as e}from"@moneko/mdx";import{CONFIG as r}from"../config.mjs";import{APPTYPE as o,PACKAGENAME as t,PACKAGEVERSION as s,SSR as i}from"../process-env.mjs";import{resolveProgramPath as p,toUpperCaseString as m}from"../utils/index.mjs";let{description:n,author:a,repository:c,keywords:d}=JSON.parse(e(p("package.json"))||"{}"),f="string"==typeof a,l={name:t,projectName:m(t).replace(/-/g," "),ssr:i,version:s,base:r.basename,type:o,routerMode:r.routerMode,prefixCls:r.prefixCls,theme:r.theme,description:n,author:f?{name:a}:a,repository:f?{url:c}:c};export const description=n;export const keywords=Array.isArray(d)?d.toString():"";export default l;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{basename as e,join as t}from"path";import{directoryExists as o,scanFolder as a}from"@moneko/mdx";import{watch as l}from"chokidar";import{CONFIG as r}from"../config.mjs";import{FRAMEWORK as n,isDev as s}from"../process-env.mjs";import c from"../utils/esm.mjs";import i from"../utils/reactive-object.mjs";import g from"../utils/tfc.mjs";let u={react:'import sso from "shared-store-object";',solid:'import { createEffect, createRoot, getOwner } from "solid-js";import { createStore } from "solid-js/store";'},f={react:'let storageKey="localizable.language",language=localStorage.getItem(storageKey)||"zh_CN",{translation:a,...defaultLocale}=Object.assign({title:"简体中文",language:"zh_CN",translation:{}},resources[language]||resources.zh_CN),localizable=sso({lang:defaultLocale,t:a});export function setLang(a){let{translation:e,...l}=resources[a]||{};e&&(localizable.lang=l,localizable.t=e,localStorage.setItem(storageKey,l.language))}export default localizable;',solid:'let locale=createRoot(()=>{let e="localizable.language",a=localStorage.getItem(e)||"zh_CN",{translation:l,...o}=Object.assign({title:"简体中文",language:"zh_CN",translation:{}},resources[a]||resources.zh_CN),[n,c]=createStore({lang:o,t:l});return createEffect(()=>{let a=resources[n.lang.language]?.translation;a&&(c("t",a),localStorage.setItem(e,n.lang.language))}),{localizable:n,setLocalizable:c,setLang:function(e){let{translation:a,...l}=resources[e]||{};a&&c("lang",l)}}},getOwner());export const setLocalizable=locale.setLocalizable;export const t=locale.localizable.t;export const lang=locale.localizable.lang;export const setLang=locale.setLang;'}[n];function p(e,t){return`${u[n]}
|
|
2
|
+
export function interpolateString(r,n){return r.replace(/\\\${\\w+}/g,function(r){var t=r.slice(2,-1);var e=n[t];return e!==void 0?e.toString():""})}function deepFreeze(o) { const p = Reflect.ownKeys(o);for (const k of p) {const v = o[k];if ((v && typeof v === "object") || typeof v === "function") {deepFreeze(v);}}return Object.freeze(o);}export const locales = ${JSON.stringify(e)};const _res = ${JSON.stringify(t)};const resources = deepFreeze(_res);${f}`}export const localesModuleName="@app/locales";export const locales=new i({[localesModuleName]:p([],{})});let m={};async function d(t,o){let a=e(t).replace(/\.[^.]+$/,"");"deleted"===o?delete m[a]:Object.assign(m,{[a]:(await import(c`${g(t)}`)).default});let l=[],r={};for(let e in m)if(Object.prototype.hasOwnProperty.call(m,e)){let{language:t=a,title:o=t,icon:n,translation:s={}}=m[e];l.push({language:t,title:o,icon:n}),r[t]={language:t,title:o,icon:n,translation:s}}locales.setData(localesModuleName,p(l,r))}let z=t(r.alias["@"],"./locales");if(o(z)){let e=a(z,[".ts$"]).filter(e=>!/^\..*|\.d\.ts$/.test(e));await Promise.all(e.map(e=>d(e,"added"))),s&&function(e,t){let o=l(e,{ignored:t,persistent:!0,ignoreInitial:!0});function a(){o.unwatch(e),o.close()}o.on("add",e=>{d(e,"added")}),o.on("change",e=>{d(e,"change")}),o.on("unlink",e=>{d(e,"deleted")}),o.once("ready",()=>{s||a()}),process.on("SIGINT",a)}(z,[/^\..*/,/!\.ts$/,/\.d\.ts$/])}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
"node_modules/@app/info": string;
|
|
3
|
+
"node_modules/@app/entry": string;
|
|
4
|
+
"node_modules/@app/rem": string;
|
|
5
|
+
"node_modules/@app/fallback": string;
|
|
6
|
+
"node_modules/@app/coverage": string;
|
|
7
|
+
"node_modules/@app/merge-router": string;
|
|
8
|
+
"node_modules/@app/prefix-router": string;
|
|
9
|
+
"node_modules/@app/normalize/index.css": string;
|
|
10
|
+
"node_modules/@app/suspense/index.tsx": string;
|
|
11
|
+
"node_modules/@app/mdx-scope": string;
|
|
12
|
+
"node_modules/@app/routes": string;
|
|
13
|
+
"node_modules/@app/example": string;
|
|
14
|
+
"node_modules/@app/locales": string;
|
|
15
|
+
"node_modules/@app/docs": string;
|
|
16
|
+
};
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{join as m}from"path";import{getAppEntry as o,getAppFallback as r,getAppMdxScope as e,getAppMergeRouter as p,getAppNormalizeCss as t,getAppPrefixRouter as a,getAppRem as s,getAppSuspense as i}from"@moneko/mdx";import f from"./coverage.mjs";import{docs as n,docsModuleName as l}from"./docs.mjs";import{exampleModuleName as x}from"./example.mjs";import c from"./info.mjs";import{locales as d,localesModuleName as g}from"./locales.mjs";import{route as j,routesModuleName as u}from"./routes.mjs";import{CONFIG as h}from"../config.mjs";import v from"../paths.mjs";import{APPTYPE as k,FRAMEWORK as z}from"../process-env.mjs";import{resolveNodeModulesPath as D,resolveProgramPath as b}from"../utils/index.mjs";export default{[D("@app/info")]:`export default ${JSON.stringify(c)}`,[D("@app/entry")]:o(m(h.alias["@"],"./index.ts"),!!h.rem,!!h.normalizeCss,k,z),[D("@app/rem")]:s(h.rem?.designSize||1680),[D("@app/fallback")]:r(h.fallbackCompPath),[D("@app/coverage")]:f(v.coveragePath),[D("@app/merge-router")]:p(),[D("@app/prefix-router")]:a(),[D("@app/normalize/index.css")]:t(),[D("@app/suspense/index.tsx")]:i(k,z),[D("@app/mdx-scope")]:e(b("site/mdx-scope.ts")),[D(u)]:j.getData(u),[D(x)]:"export default []",[D(g)]:d.getData(g),[D(l)]:n.getData(l)};
|
|
@@ -0,0 +1 @@
|
|
|
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,43 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.9.17-beta.
|
|
3
|
+
"version": "3.9.17-beta.21",
|
|
4
4
|
"description": "core",
|
|
5
|
-
"main": "lib/index.
|
|
5
|
+
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "rm -rf ./lib && tsc && swc src -d lib -D",
|
|
9
|
-
"postbuild": "npm run cjs",
|
|
10
|
-
"cjs": "find ./lib/loader/ -type f -name \"*.js\" -execdir bash -c 'mv \"$1\" \"${1%.js}.cjs\"' _ {} \\;"
|
|
9
|
+
"postbuild": "npm run cjs && npm run mjs",
|
|
10
|
+
"cjs": "find ./lib/loader/ -type f -name \"*.js\" -execdir bash -c 'mv \"$1\" \"${1%.js}.cjs\"' _ {} \\;",
|
|
11
|
+
"mjs": "find ./lib/ -type f -name \"*.js\" -execdir bash -c 'mv \"$1\" \"${1%.js}.mjs\"' _ {} \\;"
|
|
11
12
|
},
|
|
12
13
|
"keywords": [],
|
|
13
14
|
"author": "moneko",
|
|
14
15
|
"license": "MIT",
|
|
15
16
|
"dependencies": {
|
|
16
|
-
"@moneko/mdx": "0.1.
|
|
17
|
+
"@moneko/mdx": "0.1.25",
|
|
17
18
|
"@swc/core": "1.3.101",
|
|
18
19
|
"add-asset-html-webpack-plugin": "6.0.0",
|
|
20
|
+
"chokidar": "3.5.3",
|
|
19
21
|
"core-js": "3.34.0",
|
|
20
22
|
"core-js-compat": "3.34.0",
|
|
21
23
|
"cross-env": "7.0.3",
|
|
22
24
|
"css-loader": "6.8.1",
|
|
23
|
-
"
|
|
25
|
+
"express": "4.18.2",
|
|
26
|
+
"html-webpack-plugin": "5.6.0",
|
|
27
|
+
"http-proxy-middleware": "2.0.6",
|
|
24
28
|
"less": "4.2.0",
|
|
25
29
|
"less-loader": "11.1.3",
|
|
26
30
|
"lightningcss": "1.22.1",
|
|
27
31
|
"mini-css-extract-plugin": "2.7.6",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
32
|
+
"mock-json-schema": "1.1.1",
|
|
33
|
+
"multer": "1.4.5-lts.1",
|
|
30
34
|
"style-loader": "3.3.3",
|
|
31
|
-
"style-resources-loader": "1.5.0",
|
|
32
35
|
"swc-loader": "0.2.3",
|
|
33
36
|
"swc-plugin-another-transform-imports": "0.2.7",
|
|
34
|
-
"ts-import-plugin": "3.0.0",
|
|
35
|
-
"ts-loader": "9.5.1",
|
|
36
37
|
"typescript": "5.3.3",
|
|
37
|
-
"webpack": "5.
|
|
38
|
+
"webpack": "5.89.0",
|
|
38
39
|
"webpack-bundle-analyzer": "4.10.1",
|
|
39
|
-
"webpack-
|
|
40
|
-
"webpack-
|
|
40
|
+
"webpack-dev-middleware": "6.1.1",
|
|
41
|
+
"webpack-hot-middleware": "2.25.4",
|
|
42
|
+
"webpack-merge": "5.10.0",
|
|
41
43
|
"webpack-node-externals": "3.0.0",
|
|
42
44
|
"webpack-virtual-modules": "0.6.1",
|
|
43
45
|
"webpackbar": "6.0.0",
|
|
@@ -45,12 +47,14 @@
|
|
|
45
47
|
},
|
|
46
48
|
"devDependencies": {
|
|
47
49
|
"@swc/cli": "0.1.63",
|
|
50
|
+
"@types/express": "4.17.21",
|
|
51
|
+
"@types/multer": "1.4.11",
|
|
48
52
|
"eslint-config-neko": "2.3.0",
|
|
49
|
-
"
|
|
53
|
+
"sass": "1.69.5",
|
|
54
|
+
"sass-loader": "13.3.2"
|
|
50
55
|
},
|
|
51
56
|
"files": [
|
|
52
57
|
"lib",
|
|
53
|
-
"template",
|
|
54
58
|
"typings/global.d.ts",
|
|
55
59
|
"typings/bundle-analyzer.d.ts"
|
|
56
60
|
]
|
package/typings/global.d.ts
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
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 {
|
|
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';
|
|
8
14
|
import type { Options as AssetHtmlOptions } from 'add-asset-html-webpack-plugin';
|
|
9
15
|
import type { Options as HtmlWebpackPluginOptions } from 'html-webpack-plugin';
|
|
10
16
|
import type { MinifyOptions as TerserMinifyOptions } from 'terser';
|
|
11
|
-
import type { Options } from 'ts-import-plugin';
|
|
12
17
|
import type {
|
|
13
18
|
Configuration,
|
|
14
19
|
ExternalsPresets,
|
|
@@ -16,12 +21,6 @@ import type {
|
|
|
16
21
|
RuleSetRule,
|
|
17
22
|
WebpackPluginInstance,
|
|
18
23
|
} from 'webpack';
|
|
19
|
-
import type {
|
|
20
|
-
Configuration as DevServerConfiguration,
|
|
21
|
-
ProxyArray,
|
|
22
|
-
ProxyConfigArray,
|
|
23
|
-
ProxyConfigMap,
|
|
24
|
-
} from 'webpack-dev-server';
|
|
25
24
|
|
|
26
25
|
export type { TerserMinifyOptions, SwcMinifyOptions };
|
|
27
26
|
export type WebpackBarOptions = ConstructorParameters<typeof WebpackBar>[0];
|
|
@@ -29,9 +28,49 @@ export type MinifierType = 'swc' | 'terser';
|
|
|
29
28
|
export declare type AppType = 'mobile' | 'site' | 'backstage' | 'micro' | 'library';
|
|
30
29
|
export declare type Framework = 'react' | 'solid';
|
|
31
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
|
+
*/
|
|
32
64
|
tags?: {
|
|
65
|
+
/**
|
|
66
|
+
* 标签内容
|
|
67
|
+
*/
|
|
33
68
|
textContent?: string;
|
|
69
|
+
/** 标签
|
|
70
|
+
* @default script
|
|
71
|
+
*/
|
|
34
72
|
tag?: string;
|
|
73
|
+
inject?: 'body' | 'head';
|
|
35
74
|
[key: string]: string | null | boolean | number;
|
|
36
75
|
}[];
|
|
37
76
|
};
|
|
@@ -77,7 +116,7 @@ export interface Theme {
|
|
|
77
116
|
errorColor?: string;
|
|
78
117
|
warningColor?: string;
|
|
79
118
|
}
|
|
80
|
-
export declare type ConfigType
|
|
119
|
+
export declare type ConfigType = {
|
|
81
120
|
/** 启用 polyfill; 当设置为 `true` 时, 则根据 `browserslist` 设置自动polyfill
|
|
82
121
|
* @default false
|
|
83
122
|
*/
|
|
@@ -86,10 +125,6 @@ export declare type ConfigType<T extends 'tsc' | 'swc' = 'swc'> = {
|
|
|
86
125
|
* @default 'csr'
|
|
87
126
|
*/
|
|
88
127
|
mode: 'ssr' | 'csr';
|
|
89
|
-
/** 编译器
|
|
90
|
-
* @default 'swc'
|
|
91
|
-
*/
|
|
92
|
-
compiler: 'tsc' | 'swc';
|
|
93
128
|
/** swc 配置项,仅当编译器为 swc 时有效 */
|
|
94
129
|
swcrc?: SwcConfig | ((isDev: boolean) => SwcConfig);
|
|
95
130
|
/**
|
|
@@ -158,7 +193,6 @@ export declare type ConfigType<T extends 'tsc' | 'swc' = 'swc'> = {
|
|
|
158
193
|
* @example
|
|
159
194
|
* ```js
|
|
160
195
|
* const conf: Partial<ConfigType> = {
|
|
161
|
-
* compiler: 'tsc',
|
|
162
196
|
* prefixJsLoader: [
|
|
163
197
|
* {
|
|
164
198
|
* loader: 'babel-loader',
|
|
@@ -174,13 +208,17 @@ export declare type ConfigType<T extends 'tsc' | 'swc' = 'swc'> = {
|
|
|
174
208
|
/** node_modules中, 需要开启 cssModules 的模块 */
|
|
175
209
|
cssModules: string[];
|
|
176
210
|
/** 按需引入 */
|
|
177
|
-
importOnDemand
|
|
211
|
+
importOnDemand?: SwcImportOnDemandTransform;
|
|
178
212
|
/** 开发服务器代理 */
|
|
179
|
-
proxy
|
|
213
|
+
proxy?: ProxyConfig;
|
|
180
214
|
/** 自定义缓存目录,为 false 时,不使用缓存 */
|
|
181
|
-
cacheDirectory
|
|
215
|
+
cacheDirectory?: string | false;
|
|
182
216
|
/** 开发服务器设置 */
|
|
183
|
-
devServer
|
|
217
|
+
devServer?: {
|
|
218
|
+
headers?: Record<string, string>;
|
|
219
|
+
host?: string;
|
|
220
|
+
port?: number;
|
|
221
|
+
};
|
|
184
222
|
/** HtmlWebpackPlugin Option */
|
|
185
223
|
htmlPluginOption: HtmlWebpackOption | false;
|
|
186
224
|
/** 自定义插入 html 的 js 和 css
|
|
@@ -288,14 +326,7 @@ export declare type ConfigType<T extends 'tsc' | 'swc' = 'swc'> = {
|
|
|
288
326
|
/** 📦 打包完成 */
|
|
289
327
|
done?: DonePluginOption;
|
|
290
328
|
mdx?: Omit<MdxOptions, 'value' | 'filepath'>;
|
|
291
|
-
jsxDomExpressions?:
|
|
292
|
-
moduleName?: string;
|
|
293
|
-
builtIns?: string[];
|
|
294
|
-
contextToCustomElements?: boolean;
|
|
295
|
-
wrapConditionals?: boolean;
|
|
296
|
-
generate?: 'ssr' | 'dom';
|
|
297
|
-
hydratable?: boolean;
|
|
298
|
-
};
|
|
329
|
+
jsxDomExpressions?: JsxDomExpressions;
|
|
299
330
|
bar?: Partial<WebpackBarOptions> | false;
|
|
300
331
|
/** 虚拟模块
|
|
301
332
|
* @example
|
|
@@ -311,7 +342,7 @@ export declare type ConfigType<T extends 'tsc' | 'swc' = 'swc'> = {
|
|
|
311
342
|
* console.log(a); // { name: "user1" }
|
|
312
343
|
* console.log(b); // { age: 12 }
|
|
313
344
|
*/
|
|
314
|
-
virtualModule?:
|
|
345
|
+
virtualModule?: VirtualModulePluginOption;
|
|
315
346
|
/** 是否使用 normalize css
|
|
316
347
|
* @default true
|
|
317
348
|
*/
|
|
@@ -486,136 +517,6 @@ export declare interface SourceMapDevToolPluginOptions {
|
|
|
486
517
|
test?: string | RegExp | Rule[];
|
|
487
518
|
}
|
|
488
519
|
|
|
489
|
-
export declare interface OptimizationSplitChunksOptions {
|
|
490
|
-
/**
|
|
491
|
-
* Sets the name delimiter for created chunks.
|
|
492
|
-
*/
|
|
493
|
-
automaticNameDelimiter?: string;
|
|
494
|
-
|
|
495
|
-
/**
|
|
496
|
-
* Assign modules to a cache group (modules from different cache groups are tried to keep in separate chunks, default categories: 'default', 'defaultVendors').
|
|
497
|
-
*/
|
|
498
|
-
cacheGroups?: {
|
|
499
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
500
|
-
[index: string]: string | false | Function | RegExp | OptimizationSplitChunksCacheGroup;
|
|
501
|
-
};
|
|
502
|
-
|
|
503
|
-
/**
|
|
504
|
-
* Select chunks for determining shared modules (defaults to "async", "initial" and "all" requires adding these chunks to the HTML).
|
|
505
|
-
*/
|
|
506
|
-
chunks?: 'all' | 'initial' | 'async' | ((chunk: Chunk) => boolean);
|
|
507
|
-
|
|
508
|
-
/**
|
|
509
|
-
* Sets the size types which are used when a number is used for sizes.
|
|
510
|
-
*/
|
|
511
|
-
defaultSizeTypes?: string[];
|
|
512
|
-
|
|
513
|
-
/**
|
|
514
|
-
* Size threshold at which splitting is enforced and other restrictions (minRemainingSize, maxAsyncRequests, maxInitialRequests) are ignored.
|
|
515
|
-
*/
|
|
516
|
-
enforceSizeThreshold?: number | { [index: string]: number };
|
|
517
|
-
|
|
518
|
-
/**
|
|
519
|
-
* Options for modules not selected by any other cache group.
|
|
520
|
-
*/
|
|
521
|
-
fallbackCacheGroup?: {
|
|
522
|
-
/**
|
|
523
|
-
* Sets the name delimiter for created chunks.
|
|
524
|
-
*/
|
|
525
|
-
automaticNameDelimiter?: string;
|
|
526
|
-
/**
|
|
527
|
-
* Select chunks for determining shared modules (defaults to "async", "initial" and "all" requires adding these chunks to the HTML).
|
|
528
|
-
*/
|
|
529
|
-
chunks?: 'all' | 'initial' | 'async' | ((chunk: Chunk) => boolean);
|
|
530
|
-
/**
|
|
531
|
-
* Maximal size hint for the on-demand chunks.
|
|
532
|
-
*/
|
|
533
|
-
maxAsyncSize?: number | { [index: string]: number };
|
|
534
|
-
/**
|
|
535
|
-
* Maximal size hint for the initial chunks.
|
|
536
|
-
*/
|
|
537
|
-
maxInitialSize?: number | { [index: string]: number };
|
|
538
|
-
/**
|
|
539
|
-
* Maximal size hint for the created chunks.
|
|
540
|
-
*/
|
|
541
|
-
maxSize?: number | { [index: string]: number };
|
|
542
|
-
/**
|
|
543
|
-
* Minimal size for the created chunk.
|
|
544
|
-
*/
|
|
545
|
-
minSize?: number | { [index: string]: number };
|
|
546
|
-
/**
|
|
547
|
-
* Minimum size reduction due to the created chunk.
|
|
548
|
-
*/
|
|
549
|
-
minSizeReduction?: number | { [index: string]: number };
|
|
550
|
-
};
|
|
551
|
-
|
|
552
|
-
/**
|
|
553
|
-
* Sets the template for the filename for created chunks.
|
|
554
|
-
*/
|
|
555
|
-
filename?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
|
|
556
|
-
|
|
557
|
-
/**
|
|
558
|
-
* Prevents exposing path info when creating names for parts splitted by maxSize.
|
|
559
|
-
*/
|
|
560
|
-
hidePathInfo?: boolean;
|
|
561
|
-
|
|
562
|
-
/**
|
|
563
|
-
* Maximum number of requests which are accepted for on-demand loading.
|
|
564
|
-
*/
|
|
565
|
-
maxAsyncRequests?: number;
|
|
566
|
-
|
|
567
|
-
/**
|
|
568
|
-
* Maximal size hint for the on-demand chunks.
|
|
569
|
-
*/
|
|
570
|
-
maxAsyncSize?: number | { [index: string]: number };
|
|
571
|
-
|
|
572
|
-
/**
|
|
573
|
-
* Maximum number of initial chunks which are accepted for an entry point.
|
|
574
|
-
*/
|
|
575
|
-
maxInitialRequests?: number;
|
|
576
|
-
|
|
577
|
-
/**
|
|
578
|
-
* Maximal size hint for the initial chunks.
|
|
579
|
-
*/
|
|
580
|
-
maxInitialSize?: number | { [index: string]: number };
|
|
581
|
-
|
|
582
|
-
/**
|
|
583
|
-
* Maximal size hint for the created chunks.
|
|
584
|
-
*/
|
|
585
|
-
maxSize?: number | { [index: string]: number };
|
|
586
|
-
|
|
587
|
-
/**
|
|
588
|
-
* Minimum number of times a module has to be duplicated until it's considered for splitting.
|
|
589
|
-
*/
|
|
590
|
-
minChunks?: number;
|
|
591
|
-
|
|
592
|
-
/**
|
|
593
|
-
* Minimal size for the chunks the stay after moving the modules to a new chunk.
|
|
594
|
-
*/
|
|
595
|
-
minRemainingSize?: number | { [index: string]: number };
|
|
596
|
-
|
|
597
|
-
/**
|
|
598
|
-
* Minimal size for the created chunks.
|
|
599
|
-
*/
|
|
600
|
-
minSize?: number | { [index: string]: number };
|
|
601
|
-
|
|
602
|
-
/**
|
|
603
|
-
* Minimum size reduction due to the created chunk.
|
|
604
|
-
*/
|
|
605
|
-
minSizeReduction?: number | { [index: string]: number };
|
|
606
|
-
|
|
607
|
-
/**
|
|
608
|
-
* Give chunks created a name (chunks with equal name are merged).
|
|
609
|
-
*/
|
|
610
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
611
|
-
name?: string | false | Function;
|
|
612
|
-
|
|
613
|
-
/**
|
|
614
|
-
* Compare used exports when checking common modules. Modules will only be put in the same chunk when exports are equal.
|
|
615
|
-
*/
|
|
616
|
-
usedExports?: boolean;
|
|
617
|
-
}
|
|
618
|
-
|
|
619
520
|
export type MemberTransformer =
|
|
620
521
|
/** 帕斯卡拼写法(大驼峰): 所有单词的首字母大写,然后直接连接起来,单词之间没有连接符 */
|
|
621
522
|
| 'pascal_case'
|
package/lib/common.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{CONFIG as e,PUBLICPATH as t}from"./config.js";import o from"./module.config.js";import s,{CUSTOMCONFIG as r}from"./paths.js";import n from"./plugin/override-resolve.js";import l from"./plugins.config.js";import{PACKAGENAME as i,PACKAGEVERSION as a,isDev as p,isLibrary as c}from"./process-env.js";import{resolveNodeModulesPath as u,resolveProgramPath as m}from"./utils.js";export const outputConfig={path:m(c?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${p?"name":"chunkhash"}].js`,assetModuleFilename:e=>{let t=e.filename;return t&&t.endsWith("?url")&&/(?:webworker|worker)(\.|\b).*\.(js|ts)\b/.test(t.replace("?url",""))?"worker/[name][ext]":"assets/[name][hash][ext]"},library:{name:i,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${i}`,pathinfo:p,clean:!0,publicPath:t,asyncChunks:!0,charset:!0};let f={main:u("@app/entry")};e.polyfill&&Object.assign(f,{"dom-polyfills":[`${s.corePath}/polyfills/replace-children.js`]}),e.entry&&("string"==typeof e.entry?f={main:e.entry}:Object.keys(e.entry)&&Object.assign(f,e.entry)),e.output&&("string"==typeof e.output?outputConfig.path=e.output:Object.keys(e.output)&&Object.assign(outputConfig,e.output));let y=!1;e.cacheDirectory&&(y=p?{type:"memory"}:{type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:e.cacheDirectory,memoryCacheUnaffected:!0,name:[r,process.env.NODE_ENV].filter(Boolean).join("-"),version:a});let d=Object.assign({original:e.alias["@"],override:r&&m(r)},e.overrideResolve);export const clientConfig={entry:f,stats:"errors-only",cache:y,infrastructureLogging:{level:"error"},target:"web",externalsPresets:e.externalsPresets,plugins:l,node:{global:!1},experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:p&&{imports:!1,entries:!1},buildHttp:e.buildHttp,backCompat:!0,futureDefaults:!1,css:!1,outputModule:!1},resolve:{extensions:["...",".jsx",".ts",".tsx"],alias:e.alias,modules:[s.nodeModules],mainFields:["browser","module","main"],mainFiles:["index"],plugins:[e.overrideResolve&&new n(d),...e.resolvePlugins].filter(Boolean),fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:o,externals:e.externals,output:outputConfig};
|
package/lib/config.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{fileExists as e}from"@moneko/mdx";import{merge as t}from"webpack-merge";import o,{CUSTOMCONFIG as s}from"./paths.js";import{FRAMEWORK as i,PACKAGENAME as n,coreName as r,isDev as a,isLibrary as l,isMobile as m,isSolid as p,jsxImportSource as c,mainDirectory as u}from"./process-env.js";import{isFunction as d,log as h,readConf as f,resolveProgramPath as g}from"./utils.js";let x=["@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"],C={seo:!1,mode:"csr",compiler:"swc",bundleAnalyzer:!1,polyfill:!1,entry:{},minifier:{},sourceMap:{filename:"[file].map",publicPath:""},env:{NODE_ENV:process.env.NODE_ENV},basename:"/",publicPath:"/",rem:{designSize:m?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":g(u)},moduleRules:[],prefixJsLoader:[],cssModules:[],importOnDemand:{},proxy:[],cacheDirectory:o.webpackCachePath,devServer:{allowedHosts:[".baidu.com"],host:"localhost",port:3e3,https:!1,compress:!1},htmlPluginOption:{template:`node_modules/${r}/template/index.html`,favicon:`node_modules/${r}/template/favicon.ico`,tags:[]},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:x,js:x,media:x,font:x,wasm:[]},mdx:{jsx:!1,development:a,jsxImportSource:c,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}};p&&Object.assign(C,{jsxDomExpressions:{moduleName:"solid-js/web",builtIns:["For","Show","Switch","Match","Suspense","SuspenseList","Portal","Index","Dynamic","ErrorBoundary"],contextToCustomElements:!0,wrapConditionals:!0,generate:"dom",hydratable:!1}}),l&&(C.alias=Object.assign(C.alias,{"@pkg":o.componentsPath,[n]:o.componentsPath}));let k=C,P={},v={};if(e(o.configPath)){let e=(await f(o.configPath,"index")).default;P=d(e)?e(process):e}if(s&&e(o.customConfigPath)){let e=(await f(o.customConfigPath,s)).default;v=d(e)?e(process):e}"tsc"===(k=t(k,P,v)).compiler&&k.minifier&&void 0===k.minifier.type&&(k.minifier.type="terser"),(!1===k.devtool||!1===k.sourceMap)&&(k.sourceMap=!1,k.devtool=!1),k.fixBrowserRouter&&k.htmlPluginOption&&(k.htmlPluginOption.tags||(k.htmlPluginOption.tags=[]),k.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=k;export const PUBLICPATH=CONFIG.publicPath||"/";global.NEKOCLICONFIG={CONFIG,CUSTOMCONFIG:s,log:h};
|
package/lib/dev.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{removeDirAll as e}from"@moneko/mdx";import o from"chalk";import t from"webpack";import s from"webpack-dev-server";import{merge as r}from"webpack-merge";import i from"webpackbar";import{clientConfig as a}from"./common.js";import{CONFIG as l}from"./config.js";import{hasPkg as n}from"./has-pkg.js";import{getIPv4 as p,getPort as m}from"./net.js";import c from"./paths.js";import{isLibrary as d,isReact as u}from"./process-env.js";import{isFunction as w,log as f,resolveProgramPath as v}from"./utils.js";let{HotModuleReplacementPlugin:h,WatchIgnorePlugin:g}=t,{yellow:k,green:b,grey:$,gray:x,bgBlue:j,bgGreenBright:S,blueBright:y,greenBright:T}=o,C=n("eslint-webpack-plugin"),A=n("stylelint-webpack-plugin"),B=n("@moneko/mock"),D=A?(await import("stylelint-webpack-plugin")).default:null,E=C?(await import("eslint-webpack-plugin")).default:null,H=l.devServer.port||3e3,M=await m(H,65535,l.devServer.host),O=B&&(await import("@moneko/mock")).default,_=u&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,I=!1===l.devtool||l.devtool?l.devtool:"eval-cheap-module-source-map";l.devServer.port=M;let J="/"===l.basename,N=l.devServer.https?"https:":"http:",P=J?"":l.basename,W=l.devServer.port!==M&&x(`Port ${k(H)} is in use, trying ${b(M)} instead.
|
|
2
|
-
`);function F(e){return`${N}//${"local"===e?l.devServer.host:p()}:${M}${P}`}let G=x("You application is running here:"),L=`${j(" Local ")} ${y(F("local"))}
|
|
3
|
-
${S(" Network ")} ${T(F("net"))}`,R=["js","jsx","ts","tsx","json","html","vue"],Y=R.join(","),q=["css","scss","sass","less","ts","tsx","js","jsx"],z=q.join(","),K=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],Q=[new g({paths:[/\.d\.ts$/]}),new h,_&&new _,E&&new E({fix:!0,threads:!0,files:[`${l.alias["@"]}/**/*.{${Y}}`,d&&`${l.alias["@pkg"]}/**/*.{${Y}}`].filter(Boolean),extensions:R,exclude:K,cache:!0,lintDirtyModulesOnly:!0}),D&&new D({fix:!0,threads:!0,files:[`${l.alias["@"]}/**/*.{${z}}`,d&&`${l.alias["@pkg"]}/**/*.{${z}}`].filter(Boolean),extensions:q,exclude:K,cache:!0,lintDirtyModulesOnly:!0}),l.bar&&new i(l.bar)].filter(Boolean),U={headers:{"Access-Control-Allow-Origin":"*"},compress:l.devServer.compress,host:"0.0.0.0",port:M,historyApiFallback:J||{index:P.endsWith("/")?P:`${P}/`,disableDotRule:!0},https:l.devServer.https,proxy:l.proxy,allowedHosts:l.devServer.allowedHosts,client:{reconnect:!0,progress:!1,logging:"info",overlay:!1,webSocketTransport:"ws"},webSocketServer:"ws",static:{watch:{ignored:e=>e.endsWith(".d.ts")||e.includes("/node_modules/")}},setupMiddlewares:(e,o)=>{if(!o)throw Error("devServer is not defined");return o.app&&w(O)&&O(o.app,v("mock/")),e},open:!1,hot:!0},V=t(r(a,{devtool:I,mode:"development",plugins:Q}));V.watch({aggregateTimeout:20,ignored:/node_modules(?![\\/]@app)/,poll:1e3,stdin:!0},(e,o)=>{!e&&o&&(process.stdout.write("\x1b[2J\x1b[3J\x1b[H"),f([G,"",L,"",$(`Compiled successfully in ${b(`${o.endTime-o.startTime}ms`)}`)]),o.compilation.warnings.forEach(e=>f(e.message)),o.compilation.errors.forEach(e=>f(e.message)),W&&f(W))});let X=new s(U,V);X.startCallback(e=>{e||f([G,"",L])}),X.stopCallback(o=>{o||e(c.cachePath)}),process.on("exit",function(){V.close(()=>{}),X.invalidate(),X.stop()}),process.on("SIGINT",()=>{process.exit()});
|
package/lib/has-pkg.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function hasPkg(name: string): boolean;
|
package/lib/has-pkg.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{fileExists as o}from"@moneko/mdx";import{resolveNodeModulesPath as r}from"./utils.js";export function hasPkg(m){return o(r(`${m}/package.json`))}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{merge as e}from"webpack-merge";import{CONFIG as t}from"./config.js";import{description as i,keywords as o}from"./info.js";import{PACKAGENAME as r,coreName as m}from"./process-env.js";import{resolveProgramPath as a}from"./utils.js";let{template:p,favicon:n,...l}=Object.assign({template:`node_modules/${m}/template/index.html`,favicon:`node_modules/${m}/template/favicon.ico`},t.htmlPluginOption||{}),s=e({title:t.env?.PROJECTNAME||r.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"},CSP:{"http-equiv":"Content-Security-Policy",content:"script-src 'self' 'unsafe-eval'"},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:i,keywords:o},tags:[],template:a(p),favicon:a(n)},l);export default s;
|
package/lib/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { default as paths, CUSTOMCONFIG } from './paths.js';
|
|
2
|
-
export { PACKAGENAME, PACKAGEVERSION, coreName, isDev, isLibrary, isMicro, mainDirectory, } from './process-env.js';
|
|
3
|
-
export { realResolve, resolveNodeModulesPath, resolveProgramPath, log } from './utils.js';
|
|
4
|
-
export { getIPv4, getPort } from './net.js';
|
|
5
|
-
export { default as osTmpDir } from './os-tmp-dir.js';
|
|
6
|
-
export type { MdxOptions } from '@moneko/mdx';
|
|
7
|
-
export type { OverrideResolverOption } from './plugin/override-resolve.js';
|
|
8
|
-
export type * from '../typings/global.d.ts';
|
package/lib/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{default as paths,CUSTOMCONFIG}from"./paths.js";export{PACKAGENAME,PACKAGEVERSION,coreName,isDev,isLibrary,isMicro,mainDirectory}from"./process-env.js";export{realResolve,resolveNodeModulesPath,resolveProgramPath,log}from"./utils.js";export{getIPv4,getPort}from"./net.js";export{default as osTmpDir}from"./os-tmp-dir.js";
|
package/lib/info.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{loadFileSync as e}from"@moneko/mdx";import{CONFIG as r}from"./config.js";import{APPTYPE as o,PACKAGENAME as t,PACKAGEVERSION as s}from"./process-env.js";import{resolveProgramPath as p,toUpperCaseString as i}from"./utils.js";let{description:m,author:n,repository:a,keywords:c}=JSON.parse(e(p("package.json"))||"{}"),d="string"==typeof n,f={name:t,projectName:i(t).replace(/-/g," "),version:s,base:r.basename,type:o,routerMode:r.routerMode,prefixCls:r.prefixCls,theme:r.theme,description:m,author:d?{name:n}:n,repository:d?{url:a}:a};export const description=m;export const keywords=Array.isArray(c)?c.toString():"";export default f;
|
package/lib/minify.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"terser-webpack-plugin";import{merge as o}from"webpack-merge";import{swcMinifyOption as r}from"./swcrc.js";export const minify={terser:{minify:e.terserMinify,terserOptions:{ecma:2015,parse:{},compress:{global_defs:{"@alert":"console.log"},drop_console:!0,drop_debugger:!0,pure_funcs:["console.log","console.warn","console.error","console.info"]},toplevel:!1,mangle:!0,module:!1,format:{comments:!1},ie8:!1,keep_classnames:void 0,keep_fnames:!1,safari10:!1},extractComments:!1},swc:{minify:e.swcMinify,terserOptions:r}};export const getMinifyOption=(e,r={})=>{let s=minify[e];return Object.assign(s,{terserOptions:o(s.terserOptions,r)})};
|
package/lib/modify-vars.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{CONFIG as i}from"./config.js";import o from"./html-plugin-option.js";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;
|
package/lib/module-federation.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"webpack";import{CONFIG as r}from"./config.js";import t from"./plugin/external-remotes.js";import{realResolve as o}from"./utils.js";let{NormalModuleReplacementPlugin:s,container:{ModuleFederationPlugin:a}}=e,i={},l={},n={},m=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(n[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?l[`./${t}`]=o(t):"[object Object]"===Object.prototype.toString.call(t)&&(l[`./${t.name}`]=o(t.path))}return new a({filename:"remote_entry.js",...e,remotes:n,exposes:l})});m.length&&(m.push(new t),m.push(new s(/(.*)/,e=>{i[e.request]&&(e.request=i[e.request])})));export default m;
|
package/lib/module.config.d.ts
DELETED
package/lib/module.config.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"mini-css-extract-plugin";import{CONFIG as s,PUBLICPATH as t}from"./config.js";import o from"./modify-vars.js";import r,{CUSTOMCONFIG as a}from"./paths.js";import{FRAMEWORK as i,isDev as l,isLibrary as n,isMicro as d}from"./process-env.js";import m from"./svg-to-data-uri.js";import c from"./swcrc.js";import{getLightningCssTargets as p}from"./targets.js";import u from"./tsloader.config.js";import{resolveNodeModulesPath as f,resolveProgramPath as y}from"./utils.js";import{comment as g,getCommentPath as j}from"./vm/docs.js";import v from"./vm/generate-doc.js";let x=d?t:"../",$={loader:e.loader,options:{publicPath:"/"!==x?x:"../"}},h={loader:`${r.corePath}/loader/lightningcss.cjs`,options:{sourceMap:!!s.sourceMap,analyzeDependencies:!1,targets:p(),drafts:{nesting:!0,customMedia:!0},errorRecovery:!1,unusedSymbols:[],rem:!!s.rem}};l&&($="style-loader");let b=[...s.cssModules,`@moneko/${i}`,"neko-ui"].map(f),w=["components","example","mock","site","src","server"].map(y);a&&w.push(y(a)),s.overrideResolve&&s.overrideResolve.override&&w.push(s.overrideResolve.override);let _={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"},importLoaders:2}},M=[$,_,h,{loader:"less-loader",options:{sourceMap:!!s.sourceMap,lessOptions:{modifyVars:o,javascriptEnabled:!0}}},{loader:"style-resources-loader",options:{patterns:["src/styles/variables.less","src/styles/mixins.less","site/styles/variables.less","site/styles/mixins.less"].map(y)}}].filter(Boolean),k="tsc"===s.compiler;function B(e){return w.concat(s.rulesInclude?.[e]?.map(f)||[])}let P=B("css"),R=B("js"),L=B("media"),O=B("wasm"),I=B("font"),J={noParse:[/jquery|lodash|prismjs|prism\.js/,/react\.min\.js$/,/marked\.min\.js$/],rules:[n&&l&&{test:/^(?![._]).*(?<!\.test)\.(tsx?)$/,include:s.alias["@pkg"],exclude:[/node_modules/,/(.+)\/__tests__\/(.+)/i],enforce:"pre",loader:`${r.corePath}/loader/ts-doc.cjs`,options:{comment:g,generateDoc:v,getCommentPath:j}},{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=>m(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:I},{test:/\.(sa|sc)ss$/i,use:[$,_,h,{loader:"sass-loader",options:{implementation:await import("sass"),sassOptions:{}}}].filter(Boolean),include:P},{test:/\.less$/i,use:M,include:P},{test:/\.css$/i,use:[$,"css-loader",h].filter(Boolean),include:P},{test:/\.(cj|mj|t|j)s(|x)$/i,use:[...s.prefixJsLoader,{loader:k?"ts-loader":"swc-loader",options:k?u:c}].filter(Boolean),include:R},{test:/\.mdx?$/i,use:[...s.prefixJsLoader,{loader:`${r.corePath}/loader/mdx.cjs`,options:s.mdx}].filter(Boolean),exclude:[/node_modules/]},{type:"asset/source",include:[/(.+)\/examples\/(.+).*?$/i]}]},...s.moduleRules].filter(e=>"object"==typeof e)};export default J;
|
package/lib/net.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createConnection as e}from"net";import r from"webpack-dev-server";let{internalIPSync:t}=r;export function getIPv4(){return t("v4")}export function getPort(r,t,o="0.0.0.0"){return new Promise(n=>{if("number"!=typeof r)n(r);else{let f=e(r,o);f.on("connect",()=>{f.destroy(),n(getPort(r+1,t,o))}),f.on("error",()=>{n(r)})}})}
|
package/lib/paths.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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`};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default class{constructor(t){this.test=t.test}apply(t){t.hooks.compilation.tap("AddEntryAttributeWebpackPlugin",s=>{let e=t.options.plugins.find(({constructor:t})=>t&&"HtmlWebpackPlugin"===t.name);e&&e.getHooks(s).alterAssetTagGroups.tap("AddEntryAttributeWebpackPlugin",t=>(t.headTags.forEach(t=>{"script"===t.tagName&&t.attributes.src&&this.test.test(t.attributes.src)&&(t.attributes.entry=!0)}),t))})}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Buffer as s}from"buffer";import{loadFileSync as t}from"@moneko/mdx";import{transform as o}from"lightningcss";import i from"webpack";let{sources:{RawSource:n,SourceMapSource:e},ModuleFilenameHelpers:{matchObject:r}}=i,a="lightning-css-minify",m=/\.css(?:\?.*)?$/i,{name:p,version:f}=JSON.parse(t(`${process.cwd()}/package.json`)||"{}");export default class{constructor(s={}){let{implementation:t,...i}=s;if(t&&"function"!=typeof t.transform)throw TypeError(`[LightningCssMinifyPlugin]: implementation.transform must be an 'lightningcss' transform function. Received ${typeof t.transform}`);this.transform=t?.transform??o,this.options=i}apply(s){let t=JSON.stringify({name:p,version:f,options:this.options});s.hooks.compilation.tap(a,s=>{s.hooks.chunkHash.tap(a,(s,o)=>o.update(t)),s.hooks.processAssets.tapPromise({name:a,stage:s.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,additionalAssets:!0},async()=>await this.transformAssets(s)),s.hooks.statsPrinter.tap(a,s=>{s.hooks.print.for("asset.info.minimized").tap(a,(s,{green:t,formatFlag:o})=>s&&t&&o?t(o("minimized")):void 0)})})}async transformAssets(t){let{options:{devtool:o}}=t.compiler,{include:i,exclude:a,test:p,sourceMap:f=!!(o&&o.includes("source-map")),...c}=this.options,l=t.getAssets().filter(s=>!s.info.minimized&&(p||m).test(s.name)&&r({include:i,exclude:a},s.name));await Promise.all(l.map(async o=>{let i;let{source:r,map:a}=o.source.sourceAndMap(),m=r.toString(),p="string"==typeof r?s.from(r):r,l=this.transform({filename:o.name,code:p,minify:!0,sourceMap:f,...c}),h=l.code.toString();i=f?new e(h,o.name,JSON.parse(l.map.toString()),m,a,!0):new n(h),t.updateAsset(o.name,i,{...o.info,minimized:!0})}))}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{relative as e}from"path";import{fileExists as t}from"@moneko/mdx";import r from"../paths.js";let a="OverrideResolverPlugin";export default class{constructor(e){this.options=e}apply(i){let{override:o,original:s}=this.options;if(o&&s){let l=`./${e(r.programPath,s)}`,p=`./${e(r.programPath,o)}`;i.getHook("existing-file").tapAsync(a,(e,r,n)=>{let h=e.request||e.path;if(h&&h.startsWith(s)&&e.relativePath){let m=h.replace(s,o);if(t(m)){let t=e.relativePath.replace(l,p);return Object.assign(e,{path:m,relativePath:t,__innerRequest_relativePath:t,__innerRequest:t}),i.doResolve("resolved",e,`${a} 使用目标模块${o}`,r,n)}}return n()})}}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{join as o}from"path";import{getAppEntry as t,getAppFallback as e,getAppMdxScope as p,getAppMergeRouter as r,getAppNormalizeCss as a,getAppPrefixRouter as s,getAppRem as i,getAppSuspense as m}from"@moneko/mdx";import n from"webpack-virtual-modules";import{CONFIG as f}from"../config.js";import l from"../info.js";import c from"../paths.js";import{APPTYPE as h,FRAMEWORK as d,isLibrary as g}from"../process-env.js";import{resolveNodeModulesPath as u,resolveProgramPath as x}from"../utils.js";import j from"../vm/coverage.js";import{comment as v,docs as y,docsModuleName as k}from"../vm/docs.js";import{exampleModuleName as b,examples as w}from"../vm/example.js";import{locales as O,localesModuleName as P}from"../vm/locales.js";import{route as z,routesModuleName as D}from"../vm/routes.js";export default class{constructor(o){this.options=o,this.hasTapped=!1}apply(S){let T=new n({[u("@app/info")]:`export default ${JSON.stringify(l)}`,[u("@app/entry")]:t(o(f.alias["@"],"./index.ts"),!!f.rem,!!f.normalizeCss,h,d),[u("@app/rem")]:i(f.rem?.designSize||1680),[u("@app/fallback")]:e(f.fallbackCompPath),[u("@app/coverage")]:j(c.coveragePath),[u("@app/merge-router")]:r(),[u("@app/prefix-router")]:s(),[u("@app/normalize/index.css")]:a(),[u("@app/suspense/index.tsx")]:m(h,d),[u("@app/mdx-scope")]:p(x("site/mdx-scope.ts")),[u(D)]:z.getData(D),[u(b)]:"export default []",[u(P)]:O.getData(P),[u(k)]:y.getData(k)});function C(o,t){let e=u(o);T.writeModule(e,t||"")}T.apply(S),z.on("change",C),O.on("change",C),g&&(w.on("change",C),y.on("change",C),v.on("change",C)),S.hooks.compilation.tap("VirtualModuleWebpackPlugin",()=>{if(!this.hasTapped){for(let o in this.hasTapped=!0,this.options)if(Object.prototype.hasOwnProperty.call(this.options,o)){let t=this.options[o];C(o,"string"==typeof t?t:`export default ${JSON.stringify(t)}`)}for(let o of w)C(...o);for(let o of y)C(...o);for(let o of v)C(...o)}})}}
|
package/lib/plugins.config.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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.js";import i from"./html-plugin-option.js";import r from"./module-federation.js";import n from"./plugin/add-entry-attribute.js";import p from"./plugin/virtual-module.js";import{isMicro as a}from"./process-env.js";let{AutomaticPrefetchPlugin:s,DefinePlugin:m,SourceMapDevToolPlugin:c,IgnorePlugin:h}=l,u=o.basename.split("/").filter(Boolean).length,f=`${Array(u).fill("..").join("/")+(u?"/":"")}404.html`,{pathSegmentsToKeep:d=u,path:w=f}=o.fixBrowserRouter||{},g=o.assetHtml.map(e=>({publicPath:"",...e})),j=[...r,new p(o.virtualModule),new s,o.htmlPluginOption&&new t(i),o.fixBrowserRouter&&new t({filename:w,inject:!1,templateContent:()=>`<html lang="en"><head><title>${i.title}</title><script>const pathKeep = ${d||u};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(g),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 j;
|
package/lib/polyfills.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import t from"core-js-compat";import{getBrowsersTargets as r}from"./targets.js";export default function(){return t({targets:r(),version:"3.34"}).list}
|
package/lib/process-env.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import o from"./paths.js";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 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;
|
package/lib/prod.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{removeDirAll as e}from"@moneko/mdx";import o from"mini-css-extract-plugin";import m from"terser-webpack-plugin";import n from"webpack";import{BundleAnalyzerPlugin as i}from"webpack-bundle-analyzer";import{merge as r}from"webpack-merge";import t from"webpackbar";import{clientConfig as p}from"./common.js";import{CONFIG as s}from"./config.js";import{getMinifyOption as l}from"./minify.js";import u from"./paths.js";import a from"./plugin/done.js";import c from"./plugin/lightningcss-plugin.js";import f from"./seo.js";let{optimize:{MinChunkSizePlugin:d,ModuleConcatenationPlugin:h}}=n,k=[];s.minifier&&(k.push(new m(l(s.minifier?.type||"swc",s.minifier?.options))),k.push(new c));let w={splitChunks:s.splitChunk,runtimeChunk:s.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,mangleWasmImports:!0,minimize:!0,minimizer:k};n(r(p,{devtool:!1===s.devtool||s.devtool?s.devtool:"cheap-module-source-map",mode:"production",optimization:w,plugins:[new h,new o({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),s.splitChunk&&new d({minChunkSize:1e4}),s.bundleAnalyzer&&new i(s.bundleAnalyzer),s.bar&&new t(s.bar),new a({done:e=>{s.done?.(e),s.seo&&f()}})].filter(Boolean)})).run(e=>{if(e)throw e}),process.on("exit",function(){e(u.cachePath)});
|