@moneko/core 3.0.0-beta.16 → 3.0.0-beta.160

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.
Files changed (114) hide show
  1. package/lib/app-entry.d.ts +2 -0
  2. package/lib/app-entry.js +1 -0
  3. package/lib/app.d.ts +29 -0
  4. package/lib/app.js +1 -0
  5. package/lib/cleanup.js +1 -0
  6. package/{build → lib}/common.d.ts +2 -1
  7. package/lib/common.js +1 -0
  8. package/{build → lib}/coverage.d.ts +1 -1
  9. package/{build → lib}/coverage.js +1 -1
  10. package/lib/define.d.ts +4 -0
  11. package/lib/define.js +1 -0
  12. package/lib/docs.d.ts +4 -0
  13. package/lib/docs.js +1 -0
  14. package/{build → lib}/done.d.ts +2 -7
  15. package/lib/done.js +1 -0
  16. package/lib/esm.d.ts +1 -0
  17. package/lib/esm.js +1 -0
  18. package/lib/fallback.d.ts +2 -0
  19. package/lib/fallback.js +1 -0
  20. package/lib/generate-api.d.ts +1 -0
  21. package/lib/generate-api.js +1 -0
  22. package/lib/html-add-entry-attr.js +1 -0
  23. package/{build → lib}/html-plugin-option.d.ts +1 -1
  24. package/lib/html-plugin-option.js +1 -0
  25. package/lib/index.d.ts +3 -35
  26. package/lib/index.js +1 -7
  27. package/lib/loader/css-unicode.cjs +10 -0
  28. package/lib/loader/frontmatter.cjs +7 -0
  29. package/lib/locales.d.ts +10 -0
  30. package/lib/locales.js +2 -0
  31. package/lib/merge-router.d.ts +2 -0
  32. package/lib/merge-router.js +1 -0
  33. package/lib/modify-vars.d.ts +7 -0
  34. package/lib/modify-vars.js +1 -0
  35. package/lib/module-federation.js +1 -0
  36. package/lib/module.config.js +1 -0
  37. package/lib/net.d.ts +3 -0
  38. package/lib/net.js +1 -0
  39. package/lib/normalize-css.d.ts +2 -0
  40. package/lib/normalize-css.js +1 -0
  41. package/lib/object-listener.d.ts +4 -0
  42. package/lib/object-listener.js +1 -0
  43. package/lib/prefix-router.d.ts +2 -0
  44. package/lib/prefix-router.js +1 -0
  45. package/{build → lib}/process-env.d.ts +11 -3
  46. package/lib/process-env.js +1 -0
  47. package/lib/rem.d.ts +2 -0
  48. package/lib/rem.js +1 -0
  49. package/lib/routes.d.ts +31 -0
  50. package/lib/routes.js +1 -0
  51. package/lib/seo.js +1 -0
  52. package/{build → lib}/swcrc.d.ts +1 -1
  53. package/lib/swcrc.js +1 -0
  54. package/{build → lib}/tsloader.config.d.ts +1 -1
  55. package/lib/tsloader.config.js +1 -0
  56. package/{build → lib}/utils.d.ts +14 -4
  57. package/lib/utils.js +1 -0
  58. package/lib/virtual-module-plugin.d.ts +10 -0
  59. package/lib/virtual-module-plugin.js +1 -0
  60. package/lib/virtual-modules.d.ts +2 -0
  61. package/lib/virtual-modules.js +1 -0
  62. package/{build → lib}/webpack.common.d.ts +2 -2
  63. package/lib/webpack.common.js +1 -0
  64. package/lib/webpack.dev.d.ts +3 -0
  65. package/lib/webpack.dev.js +4 -0
  66. package/{build → lib}/webpack.prod.d.ts +1 -1
  67. package/lib/webpack.prod.js +1 -0
  68. package/package.json +31 -49
  69. package/template/index.html +5 -1
  70. package/typings/global.d.ts +81 -40
  71. package/build/common.js +0 -12
  72. package/build/done.js +0 -1
  73. package/build/envFlags.d.ts +0 -17
  74. package/build/envFlags.js +0 -1
  75. package/build/esm.d.ts +0 -1
  76. package/build/esm.js +0 -1
  77. package/build/html-add-entry-attr.js +0 -1
  78. package/build/html-plugin-option.js +0 -1
  79. package/build/index.d.ts +0 -2
  80. package/build/index.js +0 -1
  81. package/build/modifyVars.d.ts +0 -2
  82. package/build/modifyVars.js +0 -1
  83. package/build/module-federation.js +0 -1
  84. package/build/module.config.js +0 -1
  85. package/build/process-env.js +0 -1
  86. package/build/seo.js +0 -1
  87. package/build/swcrc.js +0 -1
  88. package/build/tsloader.config.js +0 -1
  89. package/build/utils.js +0 -1
  90. package/build/webpack.common.js +0 -1
  91. package/build/webpack.dev.d.ts +0 -2
  92. package/build/webpack.dev.js +0 -4
  93. package/build/webpack.prod.js +0 -1
  94. package/lib/normalize.css +0 -254
  95. package/lib/packages/library/bootstrap.jsx +0 -28
  96. package/lib/packages/library/index.d.ts +0 -4
  97. package/lib/packages/library/index.js +0 -4
  98. package/lib/refresh-rem.d.ts +0 -0
  99. package/lib/refresh-rem.js +0 -49
  100. package/lib/router/index.d.ts +0 -52
  101. package/lib/router/index.js +0 -277
  102. /package/lib/{packages/library/bootstrap.d.ts → cleanup.d.ts} +0 -0
  103. /package/{build → lib}/has-pkg.d.ts +0 -0
  104. /package/{build → lib}/has-pkg.js +0 -0
  105. /package/{build → lib}/html-add-entry-attr.d.ts +0 -0
  106. /package/{build → lib}/minify.d.ts +0 -0
  107. /package/{build → lib}/minify.js +0 -0
  108. /package/{build → lib}/module-federation.d.ts +0 -0
  109. /package/{build → lib}/module.config.d.ts +0 -0
  110. /package/{build → lib}/resolver-sync.d.ts +0 -0
  111. /package/{build → lib}/resolver-sync.js +0 -0
  112. /package/{build → lib}/seo.d.ts +0 -0
  113. /package/{build → lib}/yarn-argv.d.ts +0 -0
  114. /package/{build → lib}/yarn-argv.js +0 -0
@@ -0,0 +1,2 @@
1
+ declare const appEntry: string;
2
+ export default appEntry;
@@ -0,0 +1 @@
1
+ import{existsSync as o}from"fs";import{join as p}from"path";import{CONFIG as n}from"./common.js";import{APPTYPE as t,FRAMEWORK as r,isMicro as e}from"./process-env.js";import i from"./rem.js";import{getExportTokens as m}from"./utils.js";let s=p(n.alias["@"],"./index.ts"),_=o(s),u="",a=`const renderApp = (await import('@moneko/${r}/lib/entry.js')).default;`,l=[];if(_){let o="";e&&(l=m(s).filter(Boolean)).length&&(o=`{${l.map(o=>`${o} as app${o}`).join(",")}} from `),u=`import ${o}"@/index.ts";`}u+=`import "@app/normalize/index.css";${i}`,e?(u+="if (window.__POWERED_BY_QIANKUN__) {__webpack_public_path__ = window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__;}",a+=`if (!window.__POWERED_BY_QIANKUN__) {renderApp();}let unmountApp = void 0;export async function bootstrap() {console.log('app bootstraped');}export async function mount(props) {${l.includes("mount")?"appmount(props);":""}unmountApp = renderApp(props);}export async function unmount(props) {${l.includes("unmount")?"appunmount(props);":""}unmountApp();}`):a+="renderApp();","mobile"===t&&(a+="window.H5RemoteRuntime = {bootstrap: renderApp};");let d=`${u}${a}`;export default d;
package/lib/app.d.ts ADDED
@@ -0,0 +1,29 @@
1
+ declare const app: {
2
+ base: string;
3
+ routerMode: "browser" | "hash" | "memory";
4
+ mode: "csr" | "ssr";
5
+ locales: boolean;
6
+ favicon: string | false | undefined;
7
+ prefixCls: string | undefined;
8
+ theme: import("./index.js").Theme | undefined;
9
+ type: import("./index.js").AppType;
10
+ projectName: string;
11
+ iconfont: {
12
+ scriptUrl?: string | string[] | undefined;
13
+ extraCommonProps?: Record<string, any> | undefined;
14
+ } | undefined;
15
+ name: string;
16
+ version: string;
17
+ description: string | undefined;
18
+ author: {
19
+ name: string | undefined;
20
+ email: string | undefined;
21
+ url: string | undefined;
22
+ };
23
+ repository: {
24
+ type: string | undefined;
25
+ url: string | undefined;
26
+ directory: string | undefined;
27
+ };
28
+ };
29
+ export default app;
package/lib/app.js ADDED
@@ -0,0 +1 @@
1
+ import{existsSync as o}from"fs";import{join as e}from"path";import{CONFIG as r}from"./common.js";import t from"./html-plugin-option.js";import{APPTYPE as m,PACKAGENAME as i,PROGRAMPATH as s,isLibrary as f,programInfo as p}from"./process-env.js";import{toUpperCaseString as l}from"./utils.js";let n={...p,base:r.routeBaseName,routerMode:r.routerMode,mode:r.mode,locales:o(e(s,`./${f?"site":"src"}/locales`)),favicon:t.favicon,prefixCls:r.prefixCls,theme:r.theme,type:m,projectName:JSON.stringify(l(i)),iconfont:r.iconfont};export default n;
package/lib/cleanup.js ADDED
@@ -0,0 +1 @@
1
+ import{existsSync as o,readdirSync as r,rmdirSync as t,statSync as i,unlinkSync as f}from"fs";import{join as s}from"path";import{cacheDir as c}from"./process-env.js";process.on("exit",function(){!function c(e){o(e)&&(r(e).forEach(o=>{let r=s(e,o);i(r).isDirectory()?c(r):f(r)}),t(e))}(c)});
@@ -1,5 +1,6 @@
1
- import type { AppType, ConfigType } from '../typings/global.d.ts';
1
+ import type { AppType, ConfigType } from '../typings/global.js';
2
2
  export declare const ENTRYPATH: Record<AppType, string>;
3
3
  export declare const log: (msg: string) => void;
4
4
  export declare const CONFIG: ConfigType<"swc">;
5
5
  export declare const PUBLICPATH: string;
6
+ export declare let hasCustomRouter: boolean;
package/lib/common.js ADDED
@@ -0,0 +1 @@
1
+ import{accessSync as e,constants as t}from"fs";import{join as o}from"path";import s from"readline";import r from"chalk";import{merge as i}from"webpack-merge";import{APPTYPE as n,CUSTOMCONFIG as a,FRAMEWORK as l,PACKAGENAME as c,PROGRAMPATH as m,jsxImportSource as u,pkgName as p}from"./process-env.js";import{isFunction as d,readConf as h,resolveProgramPath as f}from"./utils.js";export const ENTRYPATH={mobile:"mobile",site:"site",backstage:"backstage",micro:"micro",library:"library"};let g=["@moneko/core",`@moneko/${l}`,"neko-ui","antd","@antv","katex","font-pingfang-sc","font-pingfang-tc","react-photo-view","react-markdown-editor-lite","schema-design","@app"],x={library:{"@":f("site"),"@pkg":f("components"),[c]:f("components")},mobile:{},site:{},backstage:{},micro:{}},b={seo:!1,mode:"csr",compiler:"swc",bundleAnalyzer:!1,entry:{},minifier:{js:{},css:{}},sourceMap:{filename:"[file].map",publicPath:""},env:{},routeBaseName:"/",publicPath:"/",rem:{designSize:"mobile"===n?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:Object.assign({"@":f("src")},x[n]),layoutSider:{},moduleRules:[],prefixJsLoader:[],cssModules:[],importOnDemand:{},proxy:[],cacheDirectory:`${m}/node_modules/.temp_cache`,devServer:{allowedHosts:[".baidu.com"],host:"localhost",port:3e3,https:!1,compress:!1},htmlPluginOption:{template:`./node_modules/${p}/template/index.html`,favicon:`./node_modules/${p}/template/favicon.ico`,tags:[]},assetHtml:[],routerMode:"browser",fixBrowserRouter:!1,plugins:[],splitChunk:{chunks:"all",minSize:1024,minChunks:1,cacheGroups:{route:{test:/[\\/].git[\\/]router/,priority:-10,reuseExistingChunk:!0,name:"route"},example:{test:/[\\/].git[\\/]example/,priority:-10,reuseExistingChunk:!0,name:"example"}}},runtimeChunk:"single",moduleFederation:[],rulesInclude:{less:g,css:g,js:g,media:g,fonts:g},mdx:{jsxImportSource:u,useDynamicImport:!0,remarkPlugins:[],rehypePlugins:[]},jsxDomExpressions:{moduleName:"solid-js/web",builtIns:["For","Show","Switch","Match","Suspense","SuspenseList","Portal","Index","Dynamic","ErrorBoundary"],contextToCustomElements:!0,wrapConditionals:!0,generate:"dom",hydratable:!1},bar:{name:"编译中",color:"#6f42c1"},virtualModule:{},normalizeCss:!0,externalsPresets:{}};export const log=e=>{s.cursorTo(process.stdout,0),process.stdout.write(e)};let y=b,C=null,w={},k={};try{C=o(m,"./config/index.ts"),e(C,t.R_OK)}catch(e){C=null}if(C)try{let e=(await h(C,"index")).default;w=d(e)?e(process):e}catch(e){process.stdout.write(r.red(e))}if(a){let s=null;try{s=o(m,`./config/${a}.ts`),e(s,t.R_OK)}catch(e){s=null}if(null!==s)try{let e=(await h(s,a)).default;k=d(e)?e(process):e}catch(e){process.stdout.write(r.red(e))}}"tsc"===(y=i(y,w,k)).compiler&&y.minifier&&(y.minifier.js||Object.assign(y.minifier,{js:{type:"terser"}}),y.minifier.css||Object.assign(y.minifier,{css:{type:"cssnano"}})),!1===y.devtool&&(y.sourceMap=!1),!1===y.sourceMap&&(y.devtool=!1),y.fixBrowserRouter&&y.htmlPluginOption&&(y.htmlPluginOption.tags||(y.htmlPluginOption.tags=[]),y.htmlPluginOption.tags.push({textContent:'!function(n){var a=location.search.slice(1);if("/"===a[0]){for(var o=[],c=decodeURIComponent(a).split("&"),e=0,t=c.length;e<t;e++)o.push(c[e].replace(/~and~/g,"&"));var l=o.join("&");l!==a&&window.history.replaceState(null,null,"".concat(n.pathname.slice(0,-1),"?").concat(l).concat(n.hash))}}(window.location);'}));export const CONFIG=y;export const PUBLICPATH=CONFIG.publicPath||"/";export let hasCustomRouter=!1;try{e(o(CONFIG.alias["@"],"./router/index.ts"),t.R_OK),hasCustomRouter=!0}catch(e){hasCustomRouter=!1}global.NEKOCLICONFIG={CONFIG,log};
@@ -1,2 +1,2 @@
1
- import type { CoverageType, ProjectCoverageType } from '../typings/global.d.ts';
1
+ import type { CoverageType, ProjectCoverageType } from '../typings/global.js';
2
2
  export declare const coverage: Record<string, CoverageType & Partial<ProjectCoverageType>>;
@@ -1 +1 @@
1
- import{readFileSync as e,accessSync as r,constants as c}from"fs";import{join as o}from"path";import{Parser as t}from"xml2js";import{PACKAGENAME as a,PROGRAMPATH as s}from"./process-env.js";export const coverage={};try{let i=o(s,"./coverage/clover.xml");r(i,c.R_OK);let m=new t({explicitArray:!1,async:!1}),p=e(i,{encoding:"utf-8"});m.parseString(p,(e,r)=>{if(!e){let e=r.coverage.project.metrics.$,c=r.coverage.project.package;Object.assign(coverage,{[a]:e}),c.forEach(e=>{Object.assign(coverage,{[e.$.name]:e.metrics.$})})}})}catch(e){}
1
+ import{accessSync as e,constants as r,readFileSync as c}from"fs";import{join as o}from"path";import{Parser as t}from"xml2js";import{PACKAGENAME as a,PROGRAMPATH as s}from"./process-env.js";export const coverage={};try{let i=o(s,"./coverage/clover.xml");e(i,r.R_OK);let m=new t({explicitArray:!1,async:!1}),p=c(i,{encoding:"utf-8"});m.parseString(p,(e,r)=>{if(!e){let e=r.coverage.project.metrics.$,c=r.coverage.project.package;Object.assign(coverage,{[a]:e}),c.forEach(e=>{Object.assign(coverage,{[e.$.name]:e.metrics.$})})}})}catch(e){}
@@ -0,0 +1,4 @@
1
+ declare const define: {
2
+ 'process.env': string;
3
+ };
4
+ export default define;
package/lib/define.js ADDED
@@ -0,0 +1 @@
1
+ import{CONFIG as o}from"./common.js";import{NODE_ENV as e}from"./process-env.js";let r={"process.env":JSON.stringify({NODE_ENV:e,...o.env})};export default r;
package/lib/docs.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export declare const docs: {
2
+ data: Record<string, string>;
3
+ listener: (callback: (next: Record<string, string>) => void) => () => void;
4
+ };
package/lib/docs.js ADDED
@@ -0,0 +1 @@
1
+ import{statSync as e}from"fs";import{dirname as t,join as o}from"path";import{watch as r}from"chokidar";import{CONFIG as n}from"./common.js";import i from"./generate-api.js";import s from"./object-listener.js";import{FRAMEWORK as p,FRAMEWORKNAME as l,createElement as a,isLibrary as c,isReact as d,isSolid as m}from"./process-env.js";import{resolveProgramPath as f}from"./utils.js";let u="@app/comment";export const docs=s({});let $={[u]:{}},g=`() => ${a}(SuspenseComp, { comp: $1 })`,b=`import { ${a}${m?",Dynamic":""} } from "${l}${m?"/web":""}";import SuspenseComp from "@app/suspense";`;function h(e,r){let s=e.replace(RegExp(`^${n.alias["@pkg"]}`),""),p=t(s).replace(/^\//,""),l=[u,p].join("/"),c=s.split("/").pop()?.replace(/\.tsx?/,".md");if(!c)return;$[u][p]||($[u][p]={});let f=o(l,c);if("deleted"===r)$[u][p][c]&&delete $[u][p][c];else{let t=i(e);$[f]=t,t?$[u][p][c]=`rr(() => import(/* webpackChunkName: '${f}' */'${f}?raw').then((res) => ({default: ${d?"() =>":""}${a}(${m?"Dynamic":"'n-md'"}, {text: res.default, ${m?"component: 'n-md', ":""}css: 'table td a {display:inline-flex;align-items:center;gap:2px;}table td a n-img{display:inline-block;overflow:hidden;border-radius:var(--border-radius);inline-size:18px;block-size:18px;}'})})))rr`:$[u][p][c]&&delete $[u][p][c]}let h={};for(let e in $[u])Object.prototype.hasOwnProperty.call($[u],e)&&(h[e]=Object.values($[u][e]));let x={...$};delete x[u],Object.assign(docs.data,{...x,"@app/docs":`${b}export default ${JSON.stringify(h).replace(/"rr\((.+?)\)rr"/g,g)}`})}["react","solid"].includes(p)||(g="$1",b=""),c&&function(){let t=[],o=r(f("components"),{ignored:[/(^|[\\/\\])\../,/(^|[\\/\\])__tests__([\\/\\]|$)/],persistent:!0,ignoreInitial:!1});function n(t){return/\.tsx?$/.test(t)&&e(t).isFile()}o.on("add",e=>{n(e)&&(h(e,"added"),t.push(e))}),o.on("change",e=>{n(e)&&h(e,"change")}),o.on("unlink",e=>{n(e)&&(h(e,"deleted"),t.splice(t.indexOf(e),1))}),o.on("ready",()=>{t.forEach(e=>{h(e,"change")})}),process.on("SIGINT",function(){o.close()})}();
@@ -1,3 +1,4 @@
1
+ import { type Compiler } from 'webpack';
1
2
  declare class DoneWebpackPlugin {
2
3
  options: {
3
4
  done?: () => void;
@@ -5,12 +6,6 @@ declare class DoneWebpackPlugin {
5
6
  constructor(options: {
6
7
  done?: () => void;
7
8
  });
8
- apply(compiler: {
9
- hooks: {
10
- done: {
11
- tap: (arg0: string, arg1: () => void) => void;
12
- };
13
- };
14
- }): void;
9
+ apply(compiler: Compiler): void;
15
10
  }
16
11
  export default DoneWebpackPlugin;
package/lib/done.js ADDED
@@ -0,0 +1 @@
1
+ export default class{constructor(o){this.options=Object.assign({},o)}apply(o){o.hooks.done.tap("DoneWebpackPlugin",()=>{this.options.done?.()})}};
package/lib/esm.d.ts ADDED
@@ -0,0 +1 @@
1
+ export default function esm(templateStrings: TemplateStringsArray, ...substitutions: unknown[]): string;
package/lib/esm.js ADDED
@@ -0,0 +1 @@
1
+ export default function t(t,...e){let r=t.raw[0];for(let a=0;a<e.length;a++)r+=e[a]+t.raw[a+1];return`data:text/javascript;base64,${Buffer.from(r).toString("base64")}`}
@@ -0,0 +1,2 @@
1
+ declare let fallback: string;
2
+ export default fallback;
@@ -0,0 +1 @@
1
+ import{CONFIG as l}from"./common.js";let a="export default null";l.fallbackCompPath&&(a=`import Fallback from "${l.fallbackCompPath}";export default Fallback;`);export default a;
@@ -0,0 +1 @@
1
+ export default function generateApi(path: string): string;
@@ -0,0 +1 @@
1
+ import{readFileSync as e}from"fs";import{dirname as t}from"path";import n from"typescript";import{CONFIG as r}from"./common.js";let{ScriptKind:l,ScriptTarget:o,SyntaxKind:i,createSourceFile:u,forEachChild:a,getLeadingCommentRanges:c,isInterfaceDeclaration:s,isQuestionToken:f,isPropertySignature:m,isFunctionTypeNode:p,isUnionTypeNode:$,isMethodSignature:g}=n,h={};function b(e){let t=c(e.getSourceFile().text,e.pos);if(t){let n=e.getSourceFile().text.substring(t[0].pos,t[0].end),r=n.match(/\/\*\*([\s\S]*?)\*\//);if(r){let e=r[1].replace(/^\s*\* ?/gm,"").replace(/\s+$/,"").trim();return e}}return null}function d(e){if(!e)return null;let t=e.match(/@since\s+([^\n]+)/);return t?t[1].trim():null}function y(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}](https://avatars.githubusercontent.com/${e}?s=64)${e}](${n})`}return null}function x(e){if(!e)return null;let t=e.match(/@ignore\s+([^\n]+)/);return t?t[1].trim():null}let j=/(?<!['"])(unknown|any|void|bigint|object|undefined|null|boolean|number|string|symbol)(?!['"])/g;function B(e,t){if(!e)return null;let n=e.replace(/\b([A-Z][a-zA-Z0-9]*)\b/g,e=>{if(h[e]){let n=`/${[r.routeBaseName,h[e]].join("/").split("/").filter(Boolean).join("/")}`;return t?`[\\color{#009688}{${e}}](${n})`:`[${e}](${n})`}return t?`\\color{#009688}{${e}}`:e});return t&&(n=n.replace(j,e=>`\\color{#009688}{${e}}`)),n}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 k(e){return e?e.replace(/^@[a-z].+/gm,"").replace(/(\n\s+)+/g,"<br />").replace(/\n/g,"<br />").replace(/(<br \/>)$/g,""):null}export default function w(c){let j=e(c,"utf-8"),w=u(c,j,o.Latest,!0,l.TS),E="";return a(w,e=>{s(e)?E+=function(e){let l=e.name.text;Object.assign(h,{[e.name.text]:t(e.getSourceFile().fileName).replace(r.alias["@pkg"],"")});let o=b(e),u=d(o),a=k(o),c=x(o)?.split("|")||[],s=c.includes("comment"),j=c.includes("initial"),w=c.includes("optional"),E=c.includes("version"),S=c.includes("author"),v=a?`\\color{|4||0.45}{${l}}`:l,F=(function(e){let t=[];if(e.heritageClauses){for(let r of e.heritageClauses)if(r.token===n.SyntaxKind.ExtendsKeyword)for(let e of r.types)t.push(e.getText())}return t})(e)?.map(e=>`<n-tag color="#4c81db" css=".tag{gap:0px;}">${B(T(e))}</n-tag>`),N=[a,v,u&&`\\color{#52c11b|1||0.9}{${u}}`,F.length>0&&`<sub>\`extends\`</sub> ${F.join(" ")}`].filter(Boolean).join(" "),z=`## ${N}`,K=e.members.filter(e=>m(e)&&e.type?.kind!==i.NeverKeyword||g(e)),q=[];if(K.length){K.forEach(e=>{let t=B(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=b(e),r=T(e.name.getText());!r||r.startsWith("\\color")||(g(e)||function(e){if(e.type){if(!$(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&&f(e.questionToken);q.push([r,!w&&`\\color{${l?"#f9a913":"#52c11b"}\\|\\|\\|0.9}{${l?"✘":"✔"}}`,!s&&T(k(n)),t,!j&&T(function(e){if(!e)return null;let t=e.match(/@default\s+([^\n]+)/);return t?t[1].trim():null}(n)),!E&&T(d(n)),!S&&(y(n)||y(o))])});let e=!1,t=!1,n=!1,r=!1;q.forEach(l=>{!s&&l[2]&&(r=!0),!j&&l[4]&&(n=!0),!E&&l[5]&&(t=!0),!S&&l[6]&&(e=!0)}),z+="\n";let l=["属性",!w&&"必要",r&&"说明","类型",n&&"默认值",t&&"版本",e&&"作者"].filter(Boolean).join("|");z+=`|${l}|`;let i=[":-",!w&&":-",r&&":-",":-",n&&":-",t&&":-",e&&":-"].filter(Boolean);z+="\n";let u=i.join("|");z+=`|${u}|`,q.forEach(l=>{z+="\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("|");z+=`|${o}|`}),z+="\n"}return z+="\n"}(e):n.isEnumDeclaration(e)&&(E+=function(e){let l=e.name.text,o=b(e),i=k(o),u=d(o);Object.assign(h,{[e.name.text]:t(e.getSourceFile().fileName).replace(r.alias["@pkg"],"")});let a=i?`\\color{|4||0.45}{${l}}`:l,c=[i,a,u&&`\\color{#52c11b|1||0.9}{${u}}`].filter(Boolean).join(" "),s=x(o)?.split("|")||[],f=s.includes("comment"),m=s.includes("version"),p=s.includes("author"),$=`## ${c}`;if(e.members.length){let t=[];e.members.forEach(e=>{let r=T(e.name.getText()),l=b(e),i=T(function(e){let t=e.initializer;return t&&n.isStringLiteral(t)?` '${t.text}'`:null}(e)),u=T(d(l)),a=T(k(l));!r||r.startsWith("\\color")||/^("|')(.+)("|')$/.test(r)||(r=`\\color{#4c81db}{${r}}`),t.push([r,!f&&a,i,!m&&u,!p&&(y(l)||y(o))])});let r=!1,l=!1,i=!1;t.forEach(e=>{!f&&e[1]&&(i=!0),!m&&e[3]&&(l=!0),!p&&e[4]&&(r=!0)}),$+="\n";let u=["属性",i&&"说明","值",l&&"版本",r&&"作者"].filter(Boolean).join("|");$+=`|${u}|`;let a=[":-",i&&":-",":-",l&&":-",r&&":-"].filter(Boolean);$+="\n";let c=a.join("|");$+=`|${c}|`,t.forEach(e=>{$+="\n";let t=[e[0]||"-",i&&(e[1]||"-"),e[2]||"-",l&&(e[3]||"-"),r&&(e[4]||"-")].filter(Boolean).join("|");$+=`|${t}|`})}return $+="\n\n"}(e))}),E}
@@ -0,0 +1 @@
1
+ import t from"html-webpack-plugin";export default class{constructor(t){this.entryMatchCallback=t}apply(a){a.hooks.compilation.tap("AddEntryAttributeWebpackPlugin",e=>{let r=a.options.plugins.find(a=>a instanceof t);if(r){let t=r.getHooks(e);t.alterAssetTagGroups.tap("AddEntryAttributeWebpackPlugin",t=>(t.headTags.forEach(t=>{"script"===t.tagName&&this.entryMatchCallback(t.attributes.src)&&(t.attributes.entry=!0)}),t))}})}};
@@ -1,3 +1,3 @@
1
- import type { HtmlWebpackOption } from '../typings/global.d.ts';
1
+ import type { HtmlWebpackOption } from '../typings/global.js';
2
2
  declare const htmlPluginOption: HtmlWebpackOption;
3
3
  export default htmlPluginOption;
@@ -0,0 +1 @@
1
+ import e from"path";import{merge as t}from"webpack-merge";import{CONFIG as i}from"./common.js";import{PACKAGENAME as o,PROGRAMPATH as a,pkgName as m,programInfo as p}from"./process-env.js";let{template:r,favicon:n,...l}=Object.assign({template:`./node_modules/${m}/template/index.html`,favicon:`./node_modules/${m}/template/favicon.ico`},i.htmlPluginOption||{}),s=t({title:i.env?.PROJECTNAME||o.toLocaleUpperCase()||"Title",filename:"index.html",hash:!1,minify:{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"},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,user-scalable=no","apple-mobile-web-app-capable":"yes",renderer:"webkit",description:p.description||""},tags:[],template:e.join(a,r),favicon:e.join(a,n)},l);export default s;
package/lib/index.d.ts CHANGED
@@ -1,35 +1,3 @@
1
- import type { ConfigType, CommomType, CoverageType, ProjectCoverageType } from '../typings/global';
2
- export type { ConfigType, AppType, CommomType, ProgramInfoType, MemberTransformer, CoverageType, TerserOptions, MinifierType, SourceMapDevToolPluginOptions, ProjectCoverageType, SharedConfig, SwcOptions, OptimizationSplitChunksOptions, SwcImportOnDemandTransform, Theme, } from '../typings/global';
3
- export type PartialConfigType<T = 'swc'> = Partial<ConfigType<T>>;
4
- export type PartialCommomType<T = 'swc'> = Partial<CommomType<T>>;
5
- /** 一些项目基本信息 */
6
- export declare const projectBasicInfo: {
7
- projectName: string;
8
- providerConfig: {
9
- [key: string]: any;
10
- prefixCls: string;
11
- iconPrefixCls: string;
12
- input: React.InputHTMLAttributes<HTMLInputElement>;
13
- };
14
- programInfo: {
15
- name: string;
16
- description: string;
17
- version: string;
18
- type: "mobile" | "site" | "back-stage" | "single-spa" | "library";
19
- author: {
20
- name: string;
21
- url?: string | undefined;
22
- email?: string | undefined;
23
- };
24
- repository: {
25
- type?: string | undefined;
26
- url?: string | undefined;
27
- directory?: string | undefined;
28
- };
29
- routerMode: "hash" | "browser" | "memory";
30
- routeBaseName: string;
31
- designSize: number;
32
- renderMode: "ssr" | "csr";
33
- };
34
- coverage: Record<string, CoverageType & Partial<ProjectCoverageType>>;
35
- };
1
+ export * from './process-env.js';
2
+ export * from './utils.js';
3
+ export * from '../typings/global.js';
package/lib/index.js CHANGED
@@ -1,7 +1 @@
1
- /** 一些项目基本信息 */
2
- export const projectBasicInfo = {
3
- projectName: projectName,
4
- providerConfig: providerConfig,
5
- programInfo: programInfo,
6
- coverage: projectCoverage,
7
- };
1
+ export*from"./process-env.js";export*from"./utils.js";export*from"../typings/global.js";
@@ -0,0 +1,10 @@
1
+ const CONTENT_MATCH_REG = /(?<!-)content\s*:\s*([^;\\}]+)/g;
2
+ const UNICODE_MATCH_REG = /[\u4e00-\u9faF]+/g;
3
+
4
+ module.exports = function (source) {
5
+ return source.replace(CONTENT_MATCH_REG, function (m) {
6
+ return m.replace(UNICODE_MATCH_REG, function (s) {
7
+ return `\\${s.charCodeAt(0).toString(16)}`;
8
+ });
9
+ });
10
+ };
@@ -0,0 +1,7 @@
1
+ const regExp = /^---\n([\s\S]+?)\n---\n/;
2
+ const linesExp = /^\n+|\n+$/g;
3
+
4
+ module.exports = function (source) {
5
+ // 返回处理后的结果
6
+ return source.replace(regExp, '').replace(linesExp, '');
7
+ };
@@ -0,0 +1,10 @@
1
+ export declare const locales: {
2
+ data: {
3
+ name: string;
4
+ data: string;
5
+ };
6
+ listener: (callback: (next: {
7
+ name: string;
8
+ data: string;
9
+ }) => void) => () => void;
10
+ };
package/lib/locales.js ADDED
@@ -0,0 +1,2 @@
1
+ import{basename as e}from"path";import{watch as t}from"chokidar";import o from"./app.js";import a from"./esm.js";import l from"./object-listener.js";import{FRAMEWORK as r,isLibrary as n}from"./process-env.js";import{resolveProgramPath as s,tfc as c}from"./utils.js";let i={react:'import sso from "shared-store-object";',solid:'import { createEffect, createRoot, getOwner } from "solid-js";import { createStore } from "solid-js/store";'},g={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;'}[r];export const locales=l({name:"@app/locales",data:"export const locales = [];"});let p={};async function f(t,o){let l=e(t).replace(/\.[^.]+$/,"");if("deleted"===o)delete p[l];else{let e=await import(a`${c(t)}`);Object.assign(p,{[l]:e.default})}let n=[],s={};for(let e in p)if(Object.prototype.hasOwnProperty.call(p,e)){let t=p[e],{language:o=l,title:a=o,icon:r,translation:c={}}=t;n.push({language:o,title:a,icon:r}),s[o]={language:o,title:a,icon:r,translation:c}}Object.assign(locales.data,{data:`${i[r]}
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(n)};const _res = ${JSON.stringify(s)};const resources = deepFreeze(_res);${g}`})}o.locales&&function(e,o){let a=[],l=t(e,{ignored:o,persistent:!0,ignoreInitial:!1});l.on("add",e=>{f(e,"added"),a.push(e)}),l.on("change",e=>{f(e,"change")}),l.on("unlink",e=>{f(e,"deleted"),a.splice(a.indexOf(e),1)}),l.on("ready",()=>{a.forEach(e=>{f(e,"change")})}),process.on("SIGINT",function(){l.close()})}(s(n?"site/locales":"src/locales"),[/^\..*/,/!\.ts$/,/\.d\.ts$/]);
@@ -0,0 +1,2 @@
1
+ declare const _default: "function merge(e,r){if(!e.length)return void 0;const n=[];e.forEach(e=>{const t=n.findIndex(n=>n[r]==e[r]);if(t>-1){const i=[...n[t].children||[],...e.children||[]];n[t]=Object.assign(e,n[t],n[t].meta&&{meta:{...n[t].meta,...e.meta}});if(i.length){n[t].children=merge(i,r)}}else{n.push(Object.assign(e,Array.isArray(e.children)&&{children:merge(e.children,r)}))}});return n}export default merge;";
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default"function merge(e,r){if(!e.length)return void 0;const n=[];e.forEach(e=>{const t=n.findIndex(n=>n[r]==e[r]);if(t>-1){const i=[...n[t].children||[],...e.children||[]];n[t]=Object.assign(e,n[t],n[t].meta&&{meta:{...n[t].meta,...e.meta}});if(i.length){n[t].children=merge(i,r)}}else{n.push(Object.assign(e,Array.isArray(e.children)&&{children:merge(e.children,r)}))}});return n}export default merge;";
@@ -0,0 +1,7 @@
1
+ declare const modifyVars: {
2
+ '@prefix-cls': string;
3
+ '@ant-prefix': string;
4
+ '@iconfont-css-prefix': string;
5
+ '@favicon': string;
6
+ };
7
+ export default modifyVars;
@@ -0,0 +1 @@
1
+ import{CONFIG as i}from"./common.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;
@@ -0,0 +1 @@
1
+ import e from"external-remotes-plugin";import r from"webpack";import t from"webpack/lib/container/ModuleFederationPlugin.js";import{CONFIG as o}from"./common.js";import{realResolve as l}from"./utils.js";let a=r.NormalModuleReplacementPlugin,i={},m={},n={};export const moduleFederation=o.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,l=t.filename||"remote_entry.js";if(n[o]=`${t.name}@${t.host}/${l}`,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?m[`./${t}`]=l(t):"[object Object]"===Object.prototype.toString.call(t)&&(m[`./${t.name}`]=l(t.path))}return new t({filename:"remote_entry.js",...e,remotes:n,exposes:m})});moduleFederation.length&&(moduleFederation.push(new e),moduleFederation.push(new a(/(.*)/,e=>{i[e.request]&&(e.request=i[e.request])})));
@@ -0,0 +1 @@
1
+ import{resolve as e}from"path";import s from"mini-css-extract-plugin";import o from"mini-svg-data-uri";import{CONFIG as t,PUBLICPATH as l}from"./common.js";import{hasPkg as r}from"./has-pkg.js";import a from"./modify-vars.js";import{DEV as i,FRAMEWORK as n,__dirname as c,isMicro as m}from"./process-env.js";import p from"./swcrc.js";import d from"./tsloader.config.js";import{resolveNodeModulesPath as u,resolveProgramPath as f}from"./utils.js";let y={loader:e(c,"./loader/css-unicode.cjs")},x=m?l:"../",$={loader:s.loader,options:{publicPath:"/"!==x?x:"../"}},g=r("@moneko/postcss")&&{loader:"postcss-loader",options:{postcssOptions:await import("@moneko/postcss")}};i&&($="style-loader");let j=[...t.cssModules,`@moneko/${n}`,"neko-ui"].map(u),v=[...["src/styles/variables.less","src/styles/mixins.less","site/styles/variables.less","site/styles/mixins.less"].map(f)],b=["components","example","mock","site","src","server"].map(f),w=[$,{loader:"@teamsupercell/typings-for-css-modules-loader",options:{verifyOnly:!i}},{loader:"css-loader",options:{modules:{auto:e=>{for(let s=0,o=j.length;s<o;s++)if(e&&e?.includes(j[s]))return/(.*(?<!\.?global\.(le|c)ss)$)/i.test(e);return/(^(?!.*node_modules))(.*(?<!\.?global\.(le|c)ss)$)/i.test(e)},localIdentName:"[path][name]__[local]",exportLocalsConvention:"dashesOnly"},importLoaders:2}},g,y,{loader:"less-loader",options:{sourceMap:!!t.sourceMap,lessOptions:{modifyVars:a,javascriptEnabled:!0}}},{loader:"style-resources-loader",options:{patterns:v}}].filter(Boolean),h={loader:"tsc"===t.compiler?"ts-loader":"swc-loader",options:"tsc"===t.compiler?d:p(i)},k=b.concat(t.rulesInclude?.media?.map(u)||[]),I=b.concat(t.rulesInclude?.fonts?.map(u)||[]),O=b.concat(t.rulesInclude?.less?.map(u)||[]),B=b.concat(t.rulesInclude?.css?.map(u)||[]),L=b.concat(t.rulesInclude?.js?.map(u)||[]),M={rules:[{test:/\.mdx?$/i,include:[f("components")],exclude:[/(.+)\/examples\/(.+).mdx?$/i],enforce:"pre",use:[{loader:e(c,"./loader/frontmatter.cjs")}]},{oneOf:[{resourceQuery:/raw/,type:"asset/source"},{test:/\.wasm$/i,type:"webassembly/async"},{test:/\.txt$/i,type:"asset/source"},{test:/\.ico$/i,type:"asset/inline",include:k},{test:/\.svg$/i,type:"asset/inline",generator:{dataUrl:e=>o("string"!=typeof e?e.toString():e)},include:k},{test:/\.(gif|png|jpe?g|mp4)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/images/[name][ext][query]"},include:k},{test:/\.(eot|ttf|otf|woff|woff2)$/i,type:"asset",generator:{filename:"assets/fonts/[name][ext][query]"},include:I},{test:/\.less$/i,use:w,include:O},{test:/\.css$/i,use:[$,"css-loader",g,y].filter(Boolean),include:B},{test:/\.(cj|mj|t|j)s(|x)$/i,use:[...t.prefixJsLoader,h].filter(Boolean),include:L},{test:/\.mdx?$/i,use:[...t.prefixJsLoader,h,{loader:"@mdx-js/loader",options:t.mdx}].filter(Boolean),include:b,exclude:[/(.+)\/examples\/(.+).mdx?$/i]},{test:/\.mdx?$/i,type:"asset/source",include:[/(.+)\/examples\/(.+).mdx?$/i]},{type:"asset/source",include:[/(.+)\/examples\/(.+).*?$/i]}]},...t.moduleRules]};export default M;
package/lib/net.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export declare function getNetworkAdress(): string | undefined | void;
2
+ export declare function getIPv4(): string | undefined;
3
+ export declare function getPort(start: number, end: number, host?: string): Promise<number>;
package/lib/net.js ADDED
@@ -0,0 +1 @@
1
+ import{createConnection as t}from"net";import{networkInterfaces as e}from"os";import r from"webpack-dev-server";let{internalIPSync:o}=r;export function getNetworkAdress(){let t=e();for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=t[e];for(let t=0;t<r.length;t++){let e=r[t];if("IPv4"===e.family&&"127.0.0.1"!==e.address&&!e.address.startsWith("169.254")&&!e.internal)return e.address}}}export function getIPv4(){return o("v4")}export function getPort(e,r,o="0.0.0.0"){return new Promise(n=>{let s=t(e,o);s.on("connect",()=>{s.destroy(),n(getPort(e+1,r,o))}),s.on("error",()=>{n(e)})})}
@@ -0,0 +1,2 @@
1
+ declare let normalizeCss: string;
2
+ export default normalizeCss;
@@ -0,0 +1 @@
1
+ import{CONFIG as e}from"./common.js";let t="";e.normalizeCss&&(t='html,body{margin:0;padding:0;line-height:1.8}input,textarea{caret-color:inherit}h1{margin:0.67em 0;font-size:2em}hr{overflow:visible;block-size:0;box-sizing:content-box}pre{font-size:1em;font-family:monospace}a{text-decoration:none;background-color:transparent;cursor:pointer}abbr[title]{border-block-end:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-size:1em;font-family:monospace}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{inset-block-end:-0.25em}sup{inset-block-start:-0.5em}img{border-style:none}img,button{outline:1px solid transparent}button,input,optgroup,select,textarea{margin:0;font-size:100%;font-family:inherit;line-height:1.15}button,input{overflow:visible}button,select{text-transform:none}button,[type="button"],[type="reset"],[type="submit"]{appearance:button}button::-moz-focus-inner,[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring{outline:1px dotted var(--primary-outline)}fieldset{padding:0.35em 0.75em 0.625em}legend{display:table;padding:0;max-inline-size:100%;white-space:normal;color:inherit;box-sizing:border-box}progress{vertical-align:baseline}textarea{overflow:auto}details{display:block}summary{display:list-item}template,[hidden]{display:none}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{block-size:auto}[type="search"]{appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-decoration{appearance:none}::-webkit-file-upload-button{appearance:button;font:inherit}::-webkit-scrollbar{inline-size:5px;block-size:5px}::-webkit-scrollbar-track,::-webkit-scrollbar-thumb{background-color:transparent}:hover::-webkit-scrollbar-thumb{background-color:var(--primary-selection)}::-webkit-scrollbar-thumb:hover{background-color:var(--primary-hover)}::-webkit-scrollbar-thumb:active{background-color:var(--primary-active)}::-webkit-scrollbar-button{display:none}');export default t;
@@ -0,0 +1,4 @@
1
+ export default function objectListener<T extends object>(initialData: T): {
2
+ data: T;
3
+ listener: (callback: (next: T) => void) => () => void;
4
+ };
@@ -0,0 +1 @@
1
+ export default function e(e){let t=[],n=new Proxy(e,{set:(e,n,r)=>(e[n]=r,t.forEach(t=>{t(e)}),!0)});return{data:n,listener:function(e){return t.push(e),()=>{let n=t.indexOf(e);-1!==n&&t.splice(n,1)}}}}
@@ -0,0 +1,2 @@
1
+ declare let prefixRouter: string;
2
+ export default prefixRouter;
@@ -0,0 +1 @@
1
+ import{isReact as e}from"./process-env.js";let r="";e&&(r='import {createElement,isValidElement} from "react";function prefix(list){return list.map(r=>{const _=Object.assign({key:r.path},r);if(_.element&&!isValidElement(_.element)){_.element=createElement(_.element,_.meta)}if(Array.isArray(_.children)){_.children=prefix(_.children)}return _})}export default prefix;');export default r;
@@ -1,16 +1,24 @@
1
- import type { AppType } from '../typings/global.d.ts';
1
+ import type { AppType, Framework } from '../typings/global.js';
2
2
  export declare const __dirname: string;
3
3
  export declare const APPTYPE: AppType;
4
+ export declare const FRAMEWORK: Framework;
5
+ export declare const isLibrary: boolean;
6
+ export declare const isMicro: boolean;
7
+ export declare const isReact: boolean;
8
+ export declare const isSolid: boolean;
9
+ export declare const jsxImportSource: string;
10
+ export declare const createElement: string;
11
+ export declare const FRAMEWORKNAME: string;
4
12
  export declare const PROGRAMPATH: string;
5
13
  export declare const PACKAGENAME: string;
6
14
  export declare const PACKAGEVERSION: string;
7
15
  export declare const pkgName: string;
16
+ export declare const DEV: boolean;
17
+ export declare const cacheDir: string;
8
18
  export declare const NODE_ENV: string | undefined;
9
19
  export declare const CUSTOMCONFIG: string | undefined;
10
- export declare const DEV: boolean;
11
20
  export declare let hasEslintConfig: boolean;
12
21
  export declare let hasStylelintConfig: boolean;
13
- export declare const hasReact: boolean;
14
22
  export declare const hasAntd: boolean;
15
23
  export declare const programInfo: {
16
24
  name: string;
@@ -0,0 +1 @@
1
+ import{existsSync as e,mkdirSync as o,readFileSync as r}from"fs";import{join as t}from"path";import s from"url";import{hasPkg as n}from"./has-pkg.js";import{resolveProgramPath as p}from"./utils.js";import c from"./yarn-argv.js";export const __dirname=s.fileURLToPath(new URL(".",import.meta.url));export const APPTYPE=process.env.APPTYPE;export const FRAMEWORK=process.env.FRAMEWORK;export const isLibrary="library"===APPTYPE;export const isMicro="micro"===APPTYPE;export const isReact="react"===FRAMEWORK;export const isSolid="solid"===FRAMEWORK;export const jsxImportSource={react:"react",solid:"solid-js/h"}[FRAMEWORK];export const createElement={react:"createElement",solid:"createComponent"}[FRAMEWORK];export const FRAMEWORKNAME={react:"react",solid:"solid-js"}[FRAMEWORK];export const PROGRAMPATH=process.cwd();export const PACKAGENAME=process.env.npm_package_name;export const PACKAGEVERSION=process.env.npm_package_version;let a=r(t(__dirname,"../package.json"),{encoding:"utf-8"});export const pkgName=JSON.parse(a).name;export const DEV="development"===process.env.NODE_ENV;export const cacheDir=t(PROGRAMPATH,"./node_modules/.cache/.mo/");e(cacheDir)||o(cacheDir,{recursive:!0});export const NODE_ENV=process.env.NODE_ENV;export const CUSTOMCONFIG=process.env.npm_config_config||c.config;export let hasEslintConfig=!!Object.keys(process.env).filter(e=>e.startsWith("npm_package_eslintConfig_")).length;export let hasStylelintConfig=!!Object.keys(process.env).filter(e=>e.startsWith("npm_package_stylelint_")).length;export const hasAntd=n("antd");export const programInfo={name:PACKAGENAME,version:PACKAGEVERSION,type:APPTYPE,description:process.env.npm_package_description,author:{name:process.env.npm_package_author_name,email:process.env.npm_package_author_email,url:process.env.npm_package_author_url},repository:{type:process.env.npm_package_repository_type,url:process.env.npm_package_repository_url,directory:process.env.npm_package_repository_directory}};if(parseInt(process.versions.node)>14){let e=r(p("package.json"),{encoding:"utf-8"}),{description:o,author:t,repository:s,eslintConfig:n,stylelint:c}=JSON.parse(e);programInfo.author="string"==typeof t?{name:t}:t,programInfo.repository="string"==typeof t?{url:s}:s,programInfo.description=o,hasEslintConfig=!!n,hasStylelintConfig=!!c}
package/lib/rem.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ declare let rem: string;
2
+ export default rem;
package/lib/rem.js ADDED
@@ -0,0 +1 @@
1
+ import{CONFIG as e}from"./common.js";let t="";e.rem.designSize&&(t=`!function(e,n){function t(){let n=e.documentElement,t=n.clientWidth||e.body.clientWidth,i=t<=375?375:${e.rem.designSize},o=t;o=t<=375?t:t<=${e.rem.designSize}?i:t;let d=16/i*o+"px";d!==n.style.fontSize&&(n.style.fontSize=d)}t(),"addEventListener"in e&&n.addEventListener("orientationchange"in n?"orientationchange":"resize",t,!1)}(document,window);`);export default t;
@@ -0,0 +1,31 @@
1
+ type BaseRoute = {
2
+ path: string;
3
+ key: string;
4
+ component?: string;
5
+ meta?: object;
6
+ children?: BaseRoute[];
7
+ codes?: Record<string, string>;
8
+ order?: number;
9
+ };
10
+ export declare const route: {
11
+ data: {
12
+ name: string;
13
+ data: string;
14
+ };
15
+ listener: (callback: (next: {
16
+ name: string;
17
+ data: string;
18
+ }) => void) => () => void;
19
+ };
20
+ export declare const example: {
21
+ data: {
22
+ name: string;
23
+ data: Record<string, string>;
24
+ };
25
+ listener: (callback: (next: {
26
+ name: string;
27
+ data: Record<string, string>;
28
+ }) => void) => () => void;
29
+ };
30
+ export declare let routes: BaseRoute[];
31
+ export {};
package/lib/routes.js ADDED
@@ -0,0 +1 @@
1
+ let e,t;import{readFileSync as r,readdirSync as o,statSync as n}from"fs";import{join as s,relative as i}from"path";import{watch as a}from"chokidar";import{load as p}from"js-yaml";import{hasCustomRouter as l}from"./common.js";import c from"./object-listener.js";import{FRAMEWORK as m,FRAMEWORKNAME as u,PROGRAMPATH as f,createElement as d,isLibrary as x,isReact as g,isSolid as h}from"./process-env.js";let $=/^---\n([\s\S]+?)\n---\n/,j=h?"component":"element";function O(e){return e.replace(/\$/g,":").replace(/^index\.tsx?$/,"/").replace(/^README\.mdx?$/,"/")}function b(e,t){let{regex:a,alia:l,base:c=e,outputSource:m}=t,u=o(e);return u.reduce((o,u)=>{let f=s(e,u),d=n(f);if(d.isDirectory()){let e=b(f,{...t,base:c});if(e.length>0){let t={},r={path:O(u),key:O(i(c,f))};if(m)Object.assign(t,{children:e});else{let o=e.findIndex(e=>"/"===e.path||r.path===e.path),n=e.splice(o,1)[0];e.length?Object.assign(t,!h&&n,{children:[h&&{...n,path:r.path===n.path?"/":n.path},...e].filter(Boolean)}):Object.assign(t,n)}o.push(Object.assign(t,r))}}else if(a.test(f)){let e=r(f,{encoding:"utf-8"}),t=function(e){let t=e.match($);return t&&t[1]?t[1].trim():null}(e),n=t?p(t):{},a=i(c,f),u=O(a);o.push(Object.assign({path:u.split("/").slice(-2,-1)?.join("")||"/",key:u.replace(/\/?index.tsx?$/,"/").replace(/\/?README.mdx?$/,"/").split("/").filter(Boolean).join("/"),meta:{...n}},l&&{[j]:`rr(() => import(/* webpackChunkName: '${a}' */'${s(l,a)}'))rr`},m&&{codes:function(e){let t;let r={},o=/```(.+?)\n([\s\S]*?)\n```/g;for(;null!==(t=o.exec(e));){let[,e="jsx",o]=t,n=e.split(" ").pop()||"jsx";r[n]=o.trim()}return Object.keys(r).length?r:{jsx:e}}(e.replace($,"").replace(/^\n+|\n+$/g,""))}))}return o},[])}let y=s(f,"./components");export const route=c({name:"@app/routes",data:"export default []"});export const example=c({name:"@app/example",data:{}});let T=`${h?"() => ":""}${d}(SuspenseComp, { comp: $1 })`,k=`import { ${d} } from "${u}";import SuspenseComp from "@app/suspense";${g?'import prefix from "@app/prefix-router";':""}`;l&&(k+='import merge from "@app/merge-router";import customRouter from "@/router";'),["react","solid"].includes(m)||(T="$1",k="");export let routes=[];function E(e){return`${k}const routes = [{ path: "/", children: [${h?'{ path: "/" },':""} ${e}] }];const _routes = ${l?'merge([...routes, ...customRouter], "path")':"routes"};export default ${g?"prefix(_routes)":"_routes"};`}function S(e,t,r){let o=a(e,{ignored:(e,r)=>{if(r)return!r?.isDirectory()&&t.test(e)},persistent:!0,ignoreInitial:!1});o.on("add",()=>{r()}).on("change",()=>{r()}).on("unlink",()=>{r()}),process.on("SIGINT",function(){o.close()})}let D=s(f,"./src/pages");x?(S(y,/(?<!README\.mdx?)$/,function(){clearTimeout(e),e=setTimeout(()=>{clearTimeout(e),routes=b(y,{regex:/README\.mdx?$/,alia:"@pkg"});let t=JSON.stringify(routes).replace(/"rr\((.+?)\)rr"/g,T).slice(1,-1);Object.assign(route.data,{data:E(t)})},100)}),S(y,/(?<!\/examples\/(.+)\.md)$/,function(){clearTimeout(t),t=setTimeout(()=>{clearTimeout(t);let e={};b(y,{regex:/\/examples\/(.+)\.md$/,outputSource:!0}).forEach(t=>{let r=[example.data.name,t.key].filter(Boolean).join("/"),o=t.children?.[0].children?.filter(e=>e.codes)?.map(e=>({title:e.path.replace(/.md$/,""),order:0,...e.meta,codes:e.codes})).sort((e,t)=>e.order-t.order);Object.assign(e,{[r]:`export default ${JSON.stringify(o)};`})}),Object.assign(example.data,{data:e})},100)})):S(D,/(?<!index\.tsx?)$/,function(){clearTimeout(e),e=setTimeout(()=>{clearTimeout(e),routes=b(D,{regex:/index\.tsx?$/,alia:"@/pages"});let t=JSON.stringify(routes).replace(/"rr\((.+?)\)rr"/g,T).slice(1,-1);Object.assign(route.data,{data:E(t)})},100)});
package/lib/seo.js ADDED
@@ -0,0 +1 @@
1
+ import{existsSync as t,mkdirSync as o,writeFileSync as r}from"fs";import{join as e}from"path";import{CONFIG as s}from"./common.js";import{routes as m}from"./routes.js";import{resolveProgramPath as i}from"./utils.js";import{outputConfig as p}from"./webpack.common.js";function n(t,o){try{r(t,o,"utf-8")}catch(t){}}export const seo=()=>{let{domain:r,nojekyll:c,path:a}=s.seo||{};if(!r)return;let f=s.routeBaseName,h=f.endsWith("/")?f:`${f}/`,l=a&&i(a)||p?.path||process.cwd();t(l)||o(l),n(e(l,"CNAME"),r),n(e(l,"robots"),`Sitemap: https://${r}${h}sitemap.txt`);let u=[];!function t(o){o.forEach(o=>{u.push(`https://${r}${h}${o.key}`),Array.isArray(o.children)&&t(o.children)})}(m),n(e(l,"sitemap.txt"),u.join("\n")),c&&n(e(l,".nojekyll"),"")};
@@ -1,4 +1,4 @@
1
- import type { Config as SwcConfig, JsMinifyOptions } from '@swc/core';
1
+ import type { JsMinifyOptions, Config as SwcConfig } from '@swc/core';
2
2
  export declare const swcMinifyOption: JsMinifyOptions;
3
3
  declare const _default: (isDev?: boolean) => SwcConfig;
4
4
  export default _default;
package/lib/swcrc.js ADDED
@@ -0,0 +1 @@
1
+ import{merge as e}from"webpack-merge";import{CONFIG as o}from"./common.js";import{isReact as r,isSolid as s,jsxImportSource as t}from"./process-env.js";let n={env:{targets:["last 2 version","> 0.5%","ie 11","not dead"],mode:"entry",coreJs:"3"}};export const swcMinifyOption={compress:{top_retain:[],keep_infinity:!0,global_defs:{"@alert":"console.log"},pure_funcs:["console.log","console.warn","console.error","console.info"],toplevel:!1,drop_console:!0,drop_debugger:!0,module:!1,ecma:2015,ie8:!1,keep_classnames:void 0,keep_fnames:!1},mangle:!0};export default((a=!1)=>{let c={module:{type:"es6",ignoreDynamic:!0,strict:!0,strictMode:!0,lazy:!0,noInterop:!0},jsc:{parser:{syntax:"typescript",decorators:!0,dynamicImport:!0,tsx:!0},loose:!0,target:"es2022",externalHelpers:!0,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,useBuiltins:!0,refresh:r&&a,development:a,importSource:t},optimizer:{simplify:!1}},experimental:{plugins:[["swc-plugin-another-transform-imports",function(e){for(let o=0,r=Object.keys(e),s=r.length;o<s;o++)e[r[o]].transform=`${r[o]}/${e[r[o]].transform}`,e[r[o]].style&&(e[r[o]].style=`${r[o]}/${e[r[o]].style}`);return e}(o.importOnDemand||{})],s&&["@moneko/jsx-dom-expressions",o.jsxDomExpressions||{}]].filter(Boolean)}},sourceMaps:!0,parseMap:!0},i=Object.assign(c,!a&&n);return o.swcrc&&(i=e(i,"function"==typeof o.swcrc?o.swcrc(a):o.swcrc)),i});
@@ -1,4 +1,4 @@
1
- import type { TransformerFactory, SourceFile, Node } from 'typescript';
1
+ import type { Node, SourceFile, TransformerFactory } from 'typescript';
2
2
  declare let tsLoaderConfig: {
3
3
  transpileOnly: boolean;
4
4
  getCustomTransformers: () => {
@@ -0,0 +1 @@
1
+ import t from"fs";import r from"ts-import-plugin";import o from"webpack-merge";import{CONFIG as e}from"./common.js";import{isFunction as m,readConf as s,resolveProgramPath as a}from"./utils.js";let i=[];Array.isArray(e.importOnDemand)&&Object.assign(i,e.importOnDemand.map(t=>r(t)));let n=[...i],p={transpileOnly:!0,getCustomTransformers:()=>({before:n})};try{let r=a("tsloader.config.ts");t.accessSync(r,t.constants.R_OK);let e=(await s(r,"tsloader.config")).default;p=o(p,m(e)?e(process):e)}catch(t){}export default p;
@@ -1,7 +1,12 @@
1
- export declare const tfc: (filepath: string) => string;
1
+ /** 获取导出标识
2
+ * @param {string} path 文件地址
3
+ * @returns {string[]} 包含的标识
4
+ */
5
+ export declare function getExportTokens(path: string): string[];
6
+ export declare function tfc(filepath: string): string;
7
+ export declare function readConf(src: string, name: string): Promise<any>;
2
8
  export declare function toUpperCaseString(string: string): string;
3
- export declare function getIPAdress(): string | undefined | void;
4
- type ProgramPath<T extends string> = `~/${T extends string ? T : string}`;
9
+ type ProgramPath<T extends string> = `${T extends string ? T : string}`;
5
10
  type NodeModulesPath<T> = ProgramPath<`node_modules/${T extends string ? T : string}`>;
6
11
  /** 位于项目根目录下的位置
7
12
  * @param {string} src 路径
@@ -12,7 +17,12 @@ export declare function resolveProgramPath<T extends string>(src: T): ProgramPat
12
17
  * @param {string} src 路径
13
18
  * @returns {string} 位于项目根目录node_modules下的位置
14
19
  */
15
- export declare const resolveNodeModulesPath: <T extends string>(src: T) => `~/${`node_modules/${T extends string ? T : string}` extends infer T_1 ? T_1 extends `node_modules/${T extends string ? T : string}` ? T_1 extends string ? T_1 : string : never : never}`;
20
+ export declare const resolveNodeModulesPath: <T extends string>(src: T) => `${`node_modules/${T extends string ? T : string}` extends infer T_1 ? T_1 extends `node_modules/${T extends string ? T : string}` ? T_1 extends string ? T_1 : string : never : never}`;
21
+ /** 获取模块真实入口位置
22
+ * @param {string} url 路径
23
+ * @returns {string} 模块真实入口路径
24
+ */
25
+ export declare const realResolve: (url: string) => string;
16
26
  export declare function isObject(target: unknown): target is object;
17
27
  export declare function isFunction(target: unknown): target is (...args: unknown[]) => unknown;
18
28
  export {};
package/lib/utils.js ADDED
@@ -0,0 +1 @@
1
+ import{readFileSync as e,writeFileSync as t}from"fs";import{join as o,resolve as r}from"path";import{transformFileSync as n}from"@swc/core";import{cacheDir as c}from"./process-env.js";import s from"./resolver-sync.js";let p=/export\s+(?:async\s+)?(?:function|const)\s+(\w+)/g;export function getExportTokens(t){let o;let r=e(t,{encoding:"utf-8"}),n=[];for(;o=p.exec(r);)n.includes(o[1])||n.push(o[1]);return n}let u={inputSourceMap:!1,sourceMaps:!1,module:{type:"es6"},jsc:{parser:{syntax:"typescript"},loose:!1}};export function tfc(e){return n(e,u).code||"{}"}export function readConf(e,r){let n=o(c,`${r}.mjs`);return t(n,tfc(e),"utf-8"),import(n)}export function toUpperCaseString(e){return e?.replace(/\b\w/g,e=>e.toUpperCase()).replace(/\./g," ")}export function resolveProgramPath(e){return r(process.cwd(),`./${e}`)}export const resolveNodeModulesPath=e=>resolveProgramPath(`node_modules/${e}`);export const realResolve=e=>s.resolveSync({},process.cwd(),e)||e;export function isObject(e){let t=typeof e;return null!==e&&("object"==t||"function"==t)}export function isFunction(e){if(!isObject(e))return!1;let t=Object.prototype.toString.call(e);return"[object Function]"==t||"[object AsyncFunction]"==t||"[object GeneratorFunction]"==t||"[object Proxy]"==t}
@@ -0,0 +1,10 @@
1
+ import type { Compiler } from 'webpack';
2
+ interface VirtualModulePluginOption {
3
+ [key: string]: string | object;
4
+ }
5
+ declare class VirtualModulePlugin {
6
+ private options;
7
+ constructor(options: VirtualModulePluginOption);
8
+ apply(compiler: Compiler): void;
9
+ }
10
+ export default VirtualModulePlugin;
@@ -0,0 +1 @@
1
+ import t from"webpack-virtual-modules";import{docs as e}from"./docs.js";import{locales as o}from"./locales.js";import{isLibrary as a}from"./process-env.js";import{example as r,route as i}from"./routes.js";import{resolveNodeModulesPath as l}from"./utils.js";export default class{constructor(t){this.options=t}apply(s){let p=new t({[l(i.data.name)]:i.data.data,[l(r.data.name)]:"export default []",[l(o.data.name)]:o.data.data});i.listener(t=>{t.data&&p.writeModule(l(t.name),t.data)}),o.listener(t=>{t.data&&p.writeModule(l(t.name),t.data)}),a&&(r.listener(t=>{let e=t.data;for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&e[t]&&p.writeModule(l(t),e[t])}),e.listener(t=>{for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&t[e]&&p.writeModule(l(e),t[e])})),p.apply(s),s.hooks.compilation.tap("VirtualModulePlugin",()=>{for(let t in this.options)if(Object.prototype.hasOwnProperty.call(this.options,t)){let e=this.options[t];"string"==typeof e?p.writeModule(l(t),e):p.writeModule(l(t),`export default ${JSON.stringify(e)}`)}})}};
@@ -0,0 +1,2 @@
1
+ declare const virtualModules: Record<string, string | object>;
2
+ export default virtualModules;
@@ -0,0 +1 @@
1
+ import{accessSync as p,constants as o}from"fs";import{join as r}from"path";import e from"./app-entry.js";import s from"./app.js";import{CONFIG as m}from"./common.js";import{coverage as t}from"./coverage.js";import a from"./fallback.js";import c from"./merge-router.js";import f from"./normalize-css.js";import i from"./prefix-router.js";import{FRAMEWORKNAME as l,isLibrary as n,isReact as u}from"./process-env.js";import{resolveProgramPath as x}from"./utils.js";let j={...m.virtualModule,"@app":s,"@app/fallback":a,"@app/coverage":t,"@app/normalize/index.css":f,"@app/prefix-router":i,"@app/suspense/index.tsx":`import ${u?"React,":""}{Suspense,lazy} from "${l}";import Fallback from '@app/fallback';${n?'import scope from "@app/mdx-scope";':""}function SuspenseComp(props) {const Lazy = lazy(props.comp);return (<Suspense fallback={Fallback && <Fallback />}><Lazy ${n?"components={scope}":""}/></Suspense>);}export default SuspenseComp;`,"@app/entry":e,"@app/merge-router":c},d={};if(n)try{let e=r(x("site"),"./mdx-scope.ts");p(e,o.R_OK),d='import scope from "@/mdx-scope";export default scope;'}catch(p){d={}}Object.assign(j,{"@app/mdx-scope":d});export default j;
@@ -1,4 +1,4 @@
1
+ import './cleanup.js';
1
2
  import type { WebpackConfiguration } from 'webpack-dev-server';
2
3
  export declare const outputConfig: WebpackConfiguration['output'];
3
- declare const config: WebpackConfiguration;
4
- export default config;
4
+ export declare const clientConfig: WebpackConfiguration;
@@ -0,0 +1 @@
1
+ import e from"fs";import t from"add-asset-html-webpack-plugin";import s from"html-webpack-plugin";import o from"webpack";import l from"webpackbar";import"./cleanup.js";import{CONFIG as n,PUBLICPATH as r}from"./common.js";import i from"./define.js";import a from"./done.js";import p from"./html-add-entry-attr.js";import m from"./html-plugin-option.js";import{moduleFederation as c}from"./module-federation.js";import u from"./module.config.js";import{CUSTOMCONFIG as f,DEV as d,PACKAGENAME as h,PROGRAMPATH as j,hasEslintConfig as y,hasStylelintConfig as g,isLibrary as w,isMicro as b}from"./process-env.js";import{seo as x}from"./seo.js";import{resolveNodeModulesPath as k,resolveProgramPath as v}from"./utils.js";import C from"./virtual-module-plugin.js";import $ from"./virtual-modules.js";let{AutomaticPrefetchPlugin:O,DefinePlugin:B,SourceMapDevToolPlugin:P,WatchIgnorePlugin:A}=o,M=[".eslintrc.js",".eslintrc.json",".eslintrc.yaml",".eslintrc.json"],S=[".stylelintrc",".stylelintrc.json",".stylelintrc.yaml",".stylelintrc.yml",".stylelintrc.js","stylelint.config.js","stylelint.config.cjs"],T=e.readdirSync(j),D=!1,K=!1;for(let e=0,t=T.length;e<t;e++)S.includes(T[e])&&(K=!0),M.includes(T[e])&&(D=!0);D||(D=y),K||(K=g);let L=K?(await import("stylelint-webpack-plugin")).default:null,F=D?(await import("eslint-webpack-plugin")).default:null,R=n.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:v(w?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:"js/[chunkhash].js",assetModuleFilename:"assets/[hash][ext][query]",library:{name:h,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${h}`,pathinfo:d,clean:!0,publicPath:r,asyncChunks:!0};let W={main:k("@app/entry")};n.entry&&("string"==typeof n.entry?W=n.entry:Object.keys(n.entry)&&Object.assign(W,n.entry)),n.output&&("string"==typeof n.output?outputConfig.path=n.output:Object.keys(n.output)&&Object.assign(outputConfig,n.output));let _=n.routeBaseName.split("/").filter(Boolean).length,q=`${Array(_).fill("..").join("/")+(_?"/":"")}404.html`,{pathSegmentsToKeep:G=_,path:H=q}=n.fixBrowserRouter||{},J=!1;n.cacheDirectory&&(J={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:n.cacheDirectory,memoryCacheUnaffected:!0,name:`${f||"default"}-${d?"development":"production"}`});export const clientConfig={entry:W,stats:"errors-only",cache:J,infrastructureLogging:{level:"none"},target:"web",externalsPresets:n.externalsPresets,plugins:[new O,...c,F&&new F({fix:!0,threads:!0,extensions:["js","md","mdx","cjs","ejs","mjs","jsx","ts","tsx","json","html","coffee","vue"]}),L&&new L({fix:!0,threads:!0,extensions:["css","scss","sass","less","ts","tsx","js","jsx"],exclude:["node_modules/","es/","lib/","docs/","coverage/","dist/"]}),n.htmlPluginOption&&new s(m),n.fixBrowserRouter&&new s({filename:H,inject:!1,templateContent:()=>`<html html><head><title>${m.title}</title><script>var pathSegmentsToKeep = ${G||_};var l = window.location;l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + l.pathname.split('/').slice(0, 1 + pathSegmentsToKeep).join('/') + '/?/' + l.pathname.slice(1).split('/').slice(pathSegmentsToKeep).join('/').replace(/&/g, '~and~') + (l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') + l.hash);</script></head><body></body></html>`}),new t(R),b&&new p(e=>!!(e.match(/main\.(.*)\.bundle.js$/)||e.match("main.bundle.js"))),new B(i),new A({paths:[/\.d\.ts$/]}),n.sourceMap&&new P(n.sourceMap),n.bar&&new l(n.bar),new a({done:()=>{!d&&n.seo&&x(),n.done?.(),d||setTimeout(()=>{process.exit(0)},2e3)}}),new C($),...n.plugins].filter(Boolean),experiments:{topLevelAwait:!0,syncWebAssembly:!0,asyncWebAssembly:!0},resolve:{extensions:[".tsx",".ts",".js",".jsx"],alias:n.alias,fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:u,externals:n.externals,output:outputConfig};
@@ -0,0 +1,3 @@
1
+ import webpack from 'webpack';
2
+ declare const _default: webpack.Configuration[];
3
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import e from"@soda/friendly-errors-webpack-plugin";import o from"chalk";import r from"webpack";import{merge as t}from"webpack-merge";import{CONFIG as s}from"./common.js";import{hasPkg as p}from"./has-pkg.js";import{getIPv4 as i,getPort as a}from"./net.js";import{isReact as m}from"./process-env.js";import{isFunction as n,resolveProgramPath as l}from"./utils.js";import{clientConfig as d}from"./webpack.common.js";let{HotModuleReplacementPlugin:c}=r,{yellow:v,green:h}=o,w=i(),f=s.devServer.port||3e3,u=await a(f,65535,s.devServer.host),k=s.devServer.port!==u,g=p("@moneko/mock"),$=g&&await import("@moneko/mock"),S=m&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,b=!1===s.devtool||s.devtool?s.devtool:"eval-cheap-module-source-map";s.devServer.port=u;let y="/"===s.routeBaseName,j=s.devServer.https?"https:":"http:",x=y?"":s.routeBaseName,A=t(d,{devtool:b,mode:"development",devServer:{headers:{"Access-Control-Allow-Origin":"*"},compress:s.devServer.compress,host:"0.0.0.0",port:u,historyApiFallback:y||{index:x.endsWith("/")?x:`${x}/`,disableDotRule:!0},https:s.devServer.https,proxy:s.proxy,allowedHosts:s.devServer.allowedHosts,client:{progress:!1,logging:"info",overlay:!1},static:{watch:{ignored:e=>e.endsWith(".d.ts")||/\/node_modules\//.test(e)}},setupMiddlewares:(e,o)=>{if(!o)throw Error("webpack-dev-server is not defined");return o.app&&n($)&&$(o.app,l("mock/")),e},open:!1,hot:!0},plugins:[new c,S&&new S,new e({compilationSuccessInfo:{messages:[`You application is running here:
2
+
3
+ Local: ${o.cyan(`${j}//${s.devServer.host}:${u}${x}`)}
4
+ Network: ${o.cyan(`${j}//${w}:${u}${x}`)}`],notes:k?[`Port ${v(f)} is in use, trying ${h(u)} instead`]:[]},clearConsole:!0})].filter(Boolean)});export default[A];
@@ -1,3 +1,3 @@
1
1
  import webpack from 'webpack';
2
- declare const _default: webpack.Configuration;
2
+ declare const _default: webpack.Configuration[];
3
3
  export default _default;
@@ -0,0 +1 @@
1
+ import e from"css-minimizer-webpack-plugin";import i from"mini-css-extract-plugin";import n from"terser-webpack-plugin";import m from"webpack";import{BundleAnalyzerPlugin as o}from"webpack-bundle-analyzer";import{merge as r}from"webpack-merge";import{CONFIG as s}from"./common.js";import{getMinifyOption as t}from"./minify.js";import{clientConfig as p}from"./webpack.common.js";let{optimize:l}=m,{cssnanoMinify:u,swcMinify:c}=e,a="swc"===s.compiler?"swc":"terser",f="swc"===s.compiler?"swc":"cssnano",d=[];s.minifier&&(s.minifier.js&&d.push(new n(t(s.minifier.js?.type||a,s.minifier.js?.options))),s.minifier.css&&d.push(new e({minify:{swc:c,cssnano:u}[s.minifier.css?.type||f],minimizerOptions:s.minifier.css?.options})));let k={splitChunks:s.splitChunk,runtimeChunk:s.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,minimize:!0,minimizer:d},w=r(p,{devtool:!1===s.devtool||s.devtool?s.devtool:"cheap-module-source-map",mode:"production",optimization:k,plugins:[new i({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),s.bundleAnalyzer&&new o(s.bundleAnalyzer),s.splitChunk&&new l.MinChunkSizePlugin({minChunkSize:1e4})].filter(Boolean)});export default[w];