@moneko/core 3.26.2 → 3.26.3-beta.1

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 (141) hide show
  1. package/lib/bin/build-app.d.mts +16 -1
  2. package/lib/bin/build-app.mjs +1 -1
  3. package/lib/bin/build.d.mts +2 -1
  4. package/lib/bin/build.mjs +1 -1
  5. package/lib/bin/changelog.d.mts +1 -1
  6. package/lib/bin/changelog.mjs +3 -3
  7. package/lib/bin/eslint.d.mts +1 -1
  8. package/lib/bin/eslint.mjs +1 -1
  9. package/lib/bin/file.d.mts +0 -15
  10. package/lib/bin/file.mjs +1 -1
  11. package/lib/bin/git-hooks.d.mts +1 -1
  12. package/lib/bin/git-hooks.mjs +1 -1
  13. package/lib/bin/help.d.mts +2 -0
  14. package/lib/bin/help.mjs +36 -0
  15. package/lib/bin/index.d.mts +1 -8
  16. package/lib/bin/index.mjs +1 -1
  17. package/lib/bin/lessc.mjs +1 -1
  18. package/lib/bin/runlint.d.mts +1 -1
  19. package/lib/bin/runlint.mjs +2 -2
  20. package/lib/bin/start.d.mts +2 -1
  21. package/lib/bin/start.mjs +1 -1
  22. package/lib/bin/stylelint.d.mts +1 -1
  23. package/lib/bin/stylelint.mjs +1 -1
  24. package/lib/bin/utils/bundle-app.mjs +1 -1
  25. package/lib/bin/utils/config.d.mts +0 -1
  26. package/lib/bin/utils/config.mjs +1 -1
  27. package/lib/bin/utils/setup-swcrc.d.mts +1 -1
  28. package/lib/bin/utils/setup-swcrc.mjs +1 -1
  29. package/lib/build/server.mjs +1 -1
  30. package/lib/build.mjs +1 -1
  31. package/lib/{utils → commom}/has-pkg.mjs +1 -1
  32. package/lib/commom/net.mjs +1 -0
  33. package/lib/commom/os-tmp-dir.mjs +1 -0
  34. package/lib/commom/parse-module-meta.mjs +1 -0
  35. package/lib/{paths.d.mts → commom/paths.d.mts} +2 -4
  36. package/lib/commom/paths.mjs +1 -0
  37. package/lib/{utils → commom}/reactive-object.d.mts +1 -1
  38. package/lib/commom/reactive-object.mjs +1 -0
  39. package/lib/commom/require.mjs +1 -0
  40. package/lib/common.mjs +1 -1
  41. package/lib/config.mjs +1 -1
  42. package/lib/dev/config.mjs +3 -3
  43. package/lib/dev/json-schema.d.mts +3 -0
  44. package/lib/dev/json-schema.mjs +1 -0
  45. package/lib/dev/mock.mjs +1 -1
  46. package/lib/dev/proxy.d.mts +1 -1
  47. package/lib/dev.mjs +1 -1
  48. package/lib/index.d.mts +14 -14
  49. package/lib/index.mjs +1 -1
  50. package/lib/loader/css-in-js-minify.cjs +1 -1
  51. package/lib/loader/css-in-js-minify.d.cts +1 -0
  52. package/lib/loader/lightning-css/codegen.cjs +20 -0
  53. package/lib/loader/lightning-css/codegen.d.cts +35 -0
  54. package/lib/loader/lightning-css/loader.cjs +1 -0
  55. package/lib/loader/lightning-css/loader.d.cts +29 -0
  56. package/lib/loader/lightning-css/runtime/api.cjs +1 -0
  57. package/lib/loader/lightning-css/runtime/get-url.cjs +1 -0
  58. package/lib/loader/lightning-css/runtime/get-url.d.cts +1 -0
  59. package/lib/loader/lightning-css/utils.cjs +1 -0
  60. package/lib/loader/lightning-css/utils.d.cts +16 -0
  61. package/lib/loader/mdx.cjs +1 -1
  62. package/lib/loader/react-compiler.cjs +1 -1
  63. package/lib/loader/solid.d.cts +1 -1
  64. package/lib/loader/ts-doc.cjs +1 -1
  65. package/lib/loader/ts-doc.d.cts +1 -1
  66. package/lib/module.config.mjs +2 -1
  67. package/lib/options/css-extract.mjs +1 -1
  68. package/lib/options/html-plugin-option.mjs +1 -1
  69. package/lib/options/modify-vars.mjs +1 -1
  70. package/lib/options/reslove.d.mts +0 -1
  71. package/lib/options/reslove.mjs +1 -1
  72. package/lib/options/swcrc.mjs +1 -1
  73. package/lib/plugin/copy.mjs +1 -1
  74. package/lib/plugin/exposes-declararion.mjs +1 -1
  75. package/lib/plugin/lightningcss-plugin.mjs +1 -1
  76. package/lib/plugin/module-federation.mjs +1 -1
  77. package/lib/plugin/override-resolve.mjs +1 -1
  78. package/lib/plugin/virtual-module.mjs +1 -1
  79. package/lib/plugins.config.mjs +1 -1
  80. package/lib/polyfills/polyfills.mjs +1 -1
  81. package/lib/polyfills/targets.mjs +1 -1
  82. package/lib/process-env.d.mts +1 -1
  83. package/lib/process-env.mjs +1 -1
  84. package/lib/utils/create-types.mjs +1 -1
  85. package/lib/utils/dts.mjs +1 -1
  86. package/lib/utils/fetch-module-federation-dts.mjs +1 -1
  87. package/lib/utils/index.d.mts +1 -1
  88. package/lib/utils/index.mjs +1 -1
  89. package/lib/utils/run.mjs +1 -1
  90. package/lib/utils/seo.mjs +2 -2
  91. package/lib/utils/vts.mjs +1 -1
  92. package/lib/vm/coverage.mjs +1 -1
  93. package/lib/vm/docs.d.mts +1 -1
  94. package/lib/vm/docs.mjs +1 -1
  95. package/lib/vm/example.d.mts +1 -1
  96. package/lib/vm/example.mjs +1 -1
  97. package/lib/vm/generate-doc.mjs +1 -1
  98. package/lib/vm/info.mjs +1 -1
  99. package/lib/vm/locales.d.mts +1 -1
  100. package/lib/vm/locales.mjs +2 -2
  101. package/lib/vm/modules.mjs +1 -1
  102. package/lib/vm/routes.d.mts +1 -1
  103. package/lib/vm/routes.mjs +1 -1
  104. package/lib/vm/utils.mjs +1 -1
  105. package/package.json +3 -4
  106. package/typings/global.d.ts +21 -21
  107. package/lib/bin/version.mjs +0 -1
  108. package/lib/dev/net.mjs +0 -1
  109. package/lib/loader/lightningcss.cjs +0 -1
  110. package/lib/loader/lightningcss.d.cts +0 -7
  111. package/lib/paths.mjs +0 -1
  112. package/lib/utils/os-tmp-dir.mjs +0 -1
  113. package/lib/utils/parse-module-meta.mjs +0 -1
  114. package/lib/utils/print.d.mts +0 -2
  115. package/lib/utils/print.mjs +0 -2
  116. package/lib/utils/reactive-object.mjs +0 -1
  117. package/lib/utils/require.mjs +0 -1
  118. package/lib/utils/setup-env.d.mts +0 -6
  119. package/lib/utils/setup-env.mjs +0 -1
  120. /package/lib/{utils → commom}/diff-object.d.mts +0 -0
  121. /package/lib/{utils → commom}/diff-object.mjs +0 -0
  122. /package/lib/{utils → commom}/esm.d.mts +0 -0
  123. /package/lib/{utils → commom}/esm.mjs +0 -0
  124. /package/lib/{utils → commom}/get-current-time.d.mts +0 -0
  125. /package/lib/{utils → commom}/get-current-time.mjs +0 -0
  126. /package/lib/{utils → commom}/has-pkg.d.mts +0 -0
  127. /package/lib/{utils → commom}/log.d.mts +0 -0
  128. /package/lib/{utils → commom}/log.mjs +0 -0
  129. /package/lib/{utils → commom}/match-path.d.mts +0 -0
  130. /package/lib/{utils → commom}/match-path.mjs +0 -0
  131. /package/lib/{dev → commom}/net.d.mts +0 -0
  132. /package/lib/{utils → commom}/os-tmp-dir.d.mts +0 -0
  133. /package/lib/{utils → commom}/parse-module-meta.d.mts +0 -0
  134. /package/lib/{utils → commom}/require.d.mts +0 -0
  135. /package/lib/{rule.d.mts → commom/rule.d.mts} +0 -0
  136. /package/lib/{rule.mjs → commom/rule.mjs} +0 -0
  137. /package/lib/{bin/utils → commom}/setup-env.d.mts +0 -0
  138. /package/lib/{bin/utils → commom}/setup-env.mjs +0 -0
  139. /package/lib/{utils → commom}/sigint-exit.d.mts +0 -0
  140. /package/lib/{utils → commom}/sigint-exit.mjs +0 -0
  141. /package/lib/{bin/version.d.mts → loader/lightning-css/runtime/api.d.cts} +0 -0
@@ -1,4 +1,4 @@
1
- import ReactiveObject from '../utils/reactive-object.mjs';
1
+ import ReactiveObject from '../commom/reactive-object.mjs';
2
2
  export declare const localesModuleName: string;
3
3
  export declare const locales: ReactiveObject<{
4
4
  [x: string]: string;
@@ -1,2 +1,2 @@
1
- import{basename as e,join as t}from"path";import{watch as o}from"chokidar";import{CONFIG as a}from"../config.mjs";import{FRAMEWORK as l,isDev as r}from"../process-env.mjs";import n from"../utils/reactive-object.mjs";import s from"../utils/sigint-exit.mjs";import{directoryExists as c,scanFolderSync as i}from"@moneko/utils";import g from"../utils/require.mjs";import u from"../utils/parse-module-meta.mjs";let f={react:'import sso from "shared-store-object";',solid:'import { createEffect, createRoot, getOwner } from "solid-js";import { createStore } from "solid-js/store";'},p={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;'}[l];function m(e,t){return`${f[l]}
2
- export function template(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);${p}`}let{file:d,pkg:z,meta:b}=u("@app/locales");export const localesModuleName=d;export const locales=new n({[d]:m([],{}),[z]:b});let h={};async function j(t,o){let a=e(t).replace(/\.[^.]+$/,"");try{"deleted"===o?delete h[a]:(delete g.cache[t],Object.assign(h,{[a]:g(t).default}));let e=[],l={};for(let t in h)if(Object.prototype.hasOwnProperty.call(h,t)){let{language:o=a,title:r=o,icon:n,translation:s={}}=h[t];e.push({language:o,title:r,icon:n}),l[o]={language:o,title:r,icon:n,translation:s}}locales.setData(d,m(e,l)),locales.setData(z,b)}catch{}}let y=t(a.alias["@"],"./locales");if(c(y)&&!1!==a.htmlPluginOption){let e=i(y,[".ts$"]).filter(e=>!/^\..*|\.d\.ts$/.test(e));await Promise.all(e.map(e=>j(e,"added"))),r&&function(e,t){let a=o(e,{ignored:t,persistent:!0,ignoreInitial:!0});function l(){a.unwatch(e),a.close()}a.on("add",e=>{j(e,"added")}),a.on("change",e=>{j(e,"change")}),a.on("unlink",e=>{j(e,"deleted")}),a.once("ready",()=>{r||l()}),s(l)}(y,[/^\..*/,/!\.ts$/,/\.d\.ts$/])}
1
+ import{basename as e,join as t}from"node:path";import{directoryExists as o,scanFolderSync as a}from"@moneko/utils";import{watch as l}from"chokidar";import r from"../commom/log.mjs";import n from"../commom/parse-module-meta.mjs";import c from"../commom/reactive-object.mjs";import s from"../commom/require.mjs";import i from"../commom/sigint-exit.mjs";import{CONFIG as m}from"../config.mjs";import{FRAMEWORK as g,isDev as f}from"../process-env.mjs";let p={react:'import sso from "shared-store-object";',solid:'import { createEffect, createRoot, getOwner } from "solid-js";import { createStore } from "solid-js/store";'},u={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;'}[g];function d(e,t){return`${p[g]}
2
+ export function template(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);${u}`}let{file:z,pkg:b,meta:h}=n("@app/locales");export const localesModuleName=z;export const locales=new c({[z]:d([],{}),[b]:h});let j={};async function y(t,o){let a=e(t).replace(/\.[^.]+$/,"");try{"deleted"===o?delete j[a]:(delete s.cache[t],Object.assign(j,{[a]:s(t).default}));let e=[],l={};for(let t in j)if(Object.prototype.hasOwnProperty.call(j,t)){let{language:o=a,title:r=o,icon:n,translation:c={}}=j[t];e.push({language:o,title:r,icon:n}),l[o]={language:o,title:r,icon:n,translation:c}}locales.setData(z,d(e,l)),locales.setData(b,h)}catch(e){r(e)}}let x=t(m.alias["@"],"./locales");if(o(x)&&!1!==m.htmlPluginOption){let e=a(x,[".ts$"]).filter(e=>!/^\..*|\.d\.ts$/.test(e));await Promise.all(e.map(e=>y(e,"added"))),f&&function(e,t){let o=l(e,{ignored:t,persistent:!0,ignoreInitial:!0});function a(){o.unwatch(e),o.close()}o.on("add",e=>{y(e,"added")}),o.on("change",e=>{y(e,"change")}),o.on("unlink",e=>{y(e,"deleted")}),o.once("ready",()=>{f||a()}),i(a)}(x,[/^\..*/,/!\.ts$/,/\.d\.ts$/])}
@@ -1 +1 @@
1
- import{join as t}from"path";import{getAppEntry as p,getAppFallback as e,getAppMdxScope as o,getAppMergeRouter as r,getAppNormalizeCss as m,getAppPrefixRouter as s,getAppRem as a,getAppSuspense as i}from"@moneko/mdx";import l from"./coverage.mjs";import{docs as f,docsModuleName as n}from"./docs.mjs";import d from"./info.mjs";import{locales as u,localesModuleName as x}from"./locales.mjs";import{route as c,routesModuleName as j}from"./routes.mjs";import{CONFIG as g}from"../config.mjs";import v from"../paths.mjs";import{APPTYPE as y,FRAMEWORK as h}from"../process-env.mjs";import{node_modules as k}from"../utils/index.mjs";import{generateDeclaration as O}from"../utils/dts.mjs";import S from"../utils/has-pkg.mjs";import{updateFileSync as b}from"@moneko/utils";import z from"../plugin/module-federation.mjs";import D from"../utils/create-types.mjs";import J from"../rule.mjs";import N from"../utils/parse-module-meta.mjs";let $=S(t(g.alias["@"],"./mdx-scope.tsx"))||S(t(g.alias["@"],"./mdx-scope.ts")),C={"@app/env.ts":`export default ${JSON.stringify(g.env)}`,"@app/info.ts":`export default ${JSON.stringify(d)}`,"@app/entry.ts":p(t(g.alias["@"],"./index.ts"),!!z.length,!!g.rem,!!g.normalizeCss,y,h),"@app/rem":a(g.rem?.designSize||1680),"@app/fallback":e(g.fallbackCompPath),"@app/coverage":l(v.coveragePath),"@app/merge-router":r(),"@app/prefix-router":s(),"@app/normalize/index.css":m(),"@app/suspense/index.tsx":i(y,h),"@app/mdx-scope.tsx":$?o($):"export default {}","@app/routes":c.getData(j),"@app/locales":u.getData(x),"@app/docs":f.getData(n)};b(k("@types/@app/index.d.ts"),["@app/env.ts","@app/info.ts","@app/entry.ts","@app/mdx-scope.tsx"].map(t=>D(t.replace(J.js,""),O(C[t],t))).join("\n")),b(k("@types/@vm/index.d.ts"),Object.keys(g.virtualModule).map(t=>{let p=g.virtualModule[t],{file:e}=N(t);return D(t,O("string"==typeof p?p:`export default ${JSON.stringify(p)}`,e))}).join("\n"));export default C;
1
+ import{join as o}from"node:path";import{getAppEntry as m,getAppFallback as p,getAppMdxScope as t,getAppMergeRouter as e,getAppNormalizeCss as r,getAppPrefixRouter as s,getAppRem as a,getAppSuspense as i}from"@moneko/mdx";import{updateFileSync as f}from"@moneko/utils";import n from"../commom/has-pkg.mjs";import l from"../commom/parse-module-meta.mjs";import d from"../commom/paths.mjs";import c from"../commom/rule.mjs";import{CONFIG as u}from"../config.mjs";import x from"../plugin/module-federation.mjs";import{APPTYPE as j,FRAMEWORK as g}from"../process-env.mjs";import v from"../utils/create-types.mjs";import{generateDeclaration as y}from"../utils/dts.mjs";import{node_modules as h}from"../utils/index.mjs";import k from"./coverage.mjs";import{docs as O,docsModuleName as S}from"./docs.mjs";import b from"./info.mjs";import{locales as z,localesModuleName as D}from"./locales.mjs";import{route as J,routesModuleName as N}from"./routes.mjs";let $=n(o(u.alias["@"],"./mdx-scope.tsx"))||n(o(u.alias["@"],"./mdx-scope.ts")),C={"@app/env.ts":`export default ${JSON.stringify(u.env)}`,"@app/info.ts":`export default ${JSON.stringify(b)}`,"@app/entry.ts":m(o(u.alias["@"],"./index.ts"),!!x.length,!!u.rem,!!u.normalizeCss,j,g),"@app/rem":a(u.rem?.designSize||1680),"@app/fallback":p(u.fallbackCompPath),"@app/coverage":k(d.coveragePath),"@app/merge-router":e(),"@app/prefix-router":s(),"@app/normalize/index.css":r(),"@app/suspense/index.tsx":i(j,g),"@app/mdx-scope.tsx":$?t($):"export default {}","@app/routes":J.getData(N),"@app/locales":z.getData(D),"@app/docs":O.getData(S)};f(h("@types/@app/index.d.ts"),["@app/env.ts","@app/info.ts","@app/entry.ts","@app/mdx-scope.tsx"].map(o=>v(o.replace(c.js,""),y(C[o],o))).join("\n")),f(h("@types/@vm/index.d.ts"),Object.keys(u.virtualModule).map(o=>{let m=u.virtualModule[o],{file:p}=l(o);return v(o,y("string"==typeof m?m:`export default ${JSON.stringify(m)}`,p))}).join("\n"));export default C;
@@ -1,4 +1,4 @@
1
- import ReactiveObject from '../utils/reactive-object.mjs';
1
+ import ReactiveObject from '../commom/reactive-object.mjs';
2
2
  export declare const routesModuleName: string;
3
3
  export declare const routesModulePkgJson: string;
4
4
  export declare const routesModuleMeta: string;
package/lib/vm/routes.mjs CHANGED
@@ -1 +1 @@
1
- import{generateRouter as o}from"@moneko/mdx";import{watchFiles as t}from"./utils.mjs";import{CONFIG as e}from"../config.mjs";import{routeDir as r}from"../paths.mjs";import{FRAMEWORK as m,isDev as s,isLibrary as n}from"../process-env.mjs";import p from"../utils/reactive-object.mjs";import u from"../utils/parse-module-meta.mjs";let i=n?"@pkg":"@/pages",{file:a,pkg:l,meta:c}=u("@app/routes");export const routesModuleName=a;export const routesModulePkgJson=l;export const routesModuleMeta=c;function f(){return!1===e.htmlPluginOption?"":o(r,`${e.alias["@"]}/router/index.ts`,m,i,n)}export const route=new p({[a]:f(),[l]:c});export function generatorRouter(){route.setData(a,f())}s&&t(r,n?/(?<!README\.mdx?)$/:/(?<!index\.tsx?)$/,generatorRouter);
1
+ import{generateRouter as o}from"@moneko/mdx";import t from"../commom/parse-module-meta.mjs";import{routeDir as e}from"../commom/paths.mjs";import r from"../commom/reactive-object.mjs";import{CONFIG as m}from"../config.mjs";import{FRAMEWORK as s,isDev as n,isLibrary as p}from"../process-env.mjs";import{watchFiles as u}from"./utils.mjs";let i=p?"@pkg":"@/pages",{file:a,pkg:c,meta:f}=t("@app/routes");export const routesModuleName=a;export const routesModulePkgJson=c;export const routesModuleMeta=f;function x(){return!1===m.htmlPluginOption?"":o(e,`${m.alias["@"]}/router/index.ts`,s,i,p)}export const route=new r({[a]:x(),[c]:f});export function generatorRouter(){route.setData(a,x())}n&&u(e,p?/(?<!README\.mdx?)$/:/(?<!index\.tsx?)$/,generatorRouter);
package/lib/vm/utils.mjs CHANGED
@@ -1 +1 @@
1
- import{watch as i}from"chokidar";import t from"../utils/sigint-exit.mjs";import{empty as n}from"../utils/index.mjs";export function watchFiles(o,r,e=n){let s=i(o,{ignored:(i,t)=>{if(t)return!t.isDirectory()&&r?.test(i)},persistent:!0,ignoreInitial:!0});s.on("add",e).on("change",e).on("unlink",e),t(function(){s.unwatch(o),s.close()})}
1
+ import{watch as i}from"chokidar";import o from"../commom/sigint-exit.mjs";import{empty as t}from"../utils/index.mjs";export function watchFiles(n,r,e=t){let m=i(n,{ignored:(i,o)=>{if(o)return!o.isDirectory()&&r?.test(i)},persistent:!0,ignoreInitial:!0});m.on("add",e).on("change",e).on("unlink",e),o(function(){m.unwatch(n),m.close()})}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.26.2",
3
+ "version": "3.26.3-beta.1",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
@@ -25,10 +25,8 @@
25
25
  "@typescript/vfs": "1.6.0",
26
26
  "browserslist": "4.24.2",
27
27
  "chokidar": "4.0.1",
28
- "commander": "12.1.0",
29
28
  "core-js": "3.39.0",
30
29
  "core-js-compat": "3.39.0",
31
- "css-loader": "7.1.2",
32
30
  "express": "5.0.1",
33
31
  "html-webpack-plugin": "5.6.3",
34
32
  "http-proxy-middleware": "3.0.3",
@@ -37,7 +35,6 @@
37
35
  "lightningcss": "1.28.2",
38
36
  "marked-completed": "1.2.14",
39
37
  "mini-css-extract-plugin": "2.9.2",
40
- "mock-json-schema": "1.1.1",
41
38
  "multer": "1.4.5-lts.1",
42
39
  "style-loader": "4.0.0",
43
40
  "swc-loader": "0.2.6",
@@ -58,6 +55,8 @@
58
55
  "@types/multer": "1.4.12",
59
56
  "@types/webpack-bundle-analyzer": "4.7.0",
60
57
  "@types/webpack-hot-middleware": "2.25.9",
58
+ "eslint-config-neko": "3.0.1",
59
+ "openapi-types": "12.1.3",
61
60
  "oxlint": "0.13.2",
62
61
  "sass": "1.81.0",
63
62
  "sass-loader": "16.0.3",
@@ -1,31 +1,32 @@
1
- import VirtualModulesPlugin from 'webpack-virtual-modules';
2
- import type { BundleAnalyzerOption } from './bundle-analyzer.d';
3
- import type {
4
- JsxDomExpressions,
5
- OptimizationSplitChunksOptions,
6
- OverrideResolverOption,
7
- VirtualModulePluginOption,
8
- } from '../lib/index';
9
- import type { Options } from 'http-proxy-middleware';
10
- import type { DonePluginOption } from '../lib/plugin/done';
11
1
  import type { MdxOptions } from '@moneko/mdx';
12
2
  import type { Config as SwcConfig, JsMinifyOptions as SwcMinifyOptions } from '@swc/core';
13
3
  import type { Options as HtmlWebpackPluginOptions } from 'html-webpack-plugin';
4
+ import type { Options } from 'http-proxy-middleware';
5
+ import type { PluginOptions as MiniCssExtractPluginOptions } from 'mini-css-extract-plugin';
14
6
  import type { MinifyOptions as TerserMinifyOptions } from 'terser';
15
7
  import type {
16
8
  Configuration,
17
9
  ExternalsPresets,
10
+ FileCacheOptions,
11
+ MemoryCacheOptions,
12
+ ModuleOptions,
18
13
  ResolvePluginInstance,
19
14
  RuleSetRule,
20
15
  WebpackPluginInstance,
21
- ModuleOptions,
22
- FileCacheOptions,
23
- MemoryCacheOptions,
24
16
  } from 'webpack';
25
- import type { PluginOptions as MiniCssExtractPluginOptions } from 'mini-css-extract-plugin';
17
+
18
+ import type {
19
+ JsxDomExpressions,
20
+ OptimizationSplitChunksOptions,
21
+ OverrideResolverOption,
22
+ VirtualModulePluginOption,
23
+ } from '../lib/index';
26
24
  import type { CopyPluginOption } from '../lib/plugin/copy.mjs';
25
+ import type { DonePluginOption } from '../lib/plugin/done';
26
+
27
+ import type { BundleAnalyzerOption } from './bundle-analyzer.d';
27
28
 
28
- export type { TerserMinifyOptions, SwcMinifyOptions, MiniCssExtractPluginOptions };
29
+ export type { MiniCssExtractPluginOptions, SwcMinifyOptions, TerserMinifyOptions };
29
30
  export type MinifierType = 'swc' | 'terser';
30
31
  export declare type AppType = 'mobile' | 'site' | 'backstage' | 'micro' | 'library';
31
32
  export declare type Framework = 'react' | 'solid';
@@ -220,7 +221,7 @@ export declare type ConfigType = {
220
221
  * ```
221
222
  * */
222
223
  prefixJsLoader: RuleSetRule['use'][];
223
- /** node_modules中, 需要开启 cssModules 的模块
224
+ /** node_modules中, 需要开启 cssModules 的模块
224
225
  * @description 用于指定哪些 node_modules 中的模块需要启用 CSS Modules 功能
225
226
  */
226
227
  cssModules: string[];
@@ -373,8 +374,7 @@ export declare type ConfigType = {
373
374
  | 'single'
374
375
  | 'multiple'
375
376
  | {
376
- // eslint-disable-next-line @typescript-eslint/ban-types
377
- name?: string | Function;
377
+ name?: string | VoidFunction;
378
378
  };
379
379
  /** 编译输出路径
380
380
  * @description 用于配置输出选项,可以是一个字符串(表示输出目录路径)或一个对象(包含详细的输出配置)
@@ -398,7 +398,7 @@ export declare type ConfigType = {
398
398
  * './Button': './src/components/Button'
399
399
  * }
400
400
  * }
401
- *
401
+ *
402
402
  * // 引入远程模块示例
403
403
  * {
404
404
  * name: 'demo_client_name',
@@ -420,10 +420,10 @@ export declare type ConfigType = {
420
420
  * externals: {
421
421
  * jquery: 'jQuery'
422
422
  * }
423
- *
423
+ *
424
424
  * // 使用数组形式排除多个模块
425
425
  * externals: ['jquery', 'lodash']
426
- *
426
+ *
427
427
  * // 使用正则表达式匹配要排除的模块
428
428
  * externals: /^(jquery|\$)$/i
429
429
  */
@@ -1 +0,0 @@
1
- import{program as o}from"commander";import{coreVersion as m}from"./utils/config.mjs";o.version(m,"-v, --version");
package/lib/dev/net.mjs DELETED
@@ -1 +0,0 @@
1
- import{createConnection as e}from"net";import{networkInterfaces as t}from"os";export function getIPv4(){let e=t(),r=null,o=Object.keys(e);for(let t=0,n=o.length;t<n;t++){let n=e[o[t]]||[];for(let e=0,t=n.length;e<t;e++){let t=n[e];"IPv4"!==t.family||t.internal||(r=t.address)}}return r}export function getPort(t,r="0.0.0.0"){return new Promise((o,n)=>{if("number"!=typeof t)o(t);else{let l=e(t,r);l.on("connect",()=>{l.destroy(),o(getPort(t+1,r))}),l.on("error",e=>{l.destroy(e),"ECONNREFUSED"===e.code?o(t):n(e)})}})}
@@ -1 +0,0 @@
1
- "use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return u}});const t=require("buffer"),r=require("lightningcss"),n=(e=require("../utils/log.mjs"))&&e.__esModule?e:{default:e},i={Declaration:{custom(e){if("content"===e.name&&1===e.value.length){let t=e.value[0];if("token"===t.type&&"string"===t.value.type)return[{property:e.name,raw:JSON.stringify(t.value.value.replace(/[\u4e00-\u9faF]/g,function(e){return`\\${e.charCodeAt(0).toString(16)}`}))}]}}}};function u(e,u){let o=this.async();this.cacheable&&this.cacheable();let{implementation:a,visitor:s,rem:f,...l}=this.getOptions();if(a&&"function"!=typeof a.transform){o(TypeError(`[lightningcss]: implementation.transform must be an 'lightningcss' transform function. Received ${typeof a.transform}`));return}let c=a?.transform?a.transform:r.transform;try{f&&!i.Length&&(i.Length=function(e){if("px"===e.unit)return{unit:"rem",value:e.value/16}});let{code:r,map:n}=c({filename:this.resourcePath,code:t.Buffer.from(e),minify:!0,visitor:{...i,...s},sourceMap:!!this.sourceMap,inputSourceMap:this.sourceMap&&u?JSON.stringify(u):void 0,...l});o(null,r.toString(),n&&JSON.parse(n.toString()))}catch(e){o(e),(0,n.default)(e)}}
@@ -1,7 +0,0 @@
1
- import { type CustomAtRules, type TransformOptions } from 'lightningcss';
2
- import type { LoaderContext } from 'webpack';
3
- export interface LightningCssLoaderOption extends Omit<TransformOptions<CustomAtRules>, 'filename' | 'code' | 'inputSourceMap'> {
4
- rem?: boolean;
5
- implementation?: typeof import('lightningcss');
6
- }
7
- export default function LightningCssLoader(this: LoaderContext<LightningCssLoaderOption>, source: string, prevMap?: string): void;
package/lib/paths.mjs DELETED
@@ -1 +0,0 @@
1
- import o from"url";import{dirname as e,resolve as t}from"path";import{fileExists as a}from"@moneko/utils";let n=JSON.parse(process.env.npm_config_argv||'{"original":[]}').original;export const __filename=o.fileURLToPath(import.meta.url);export const __dirname=e(__filename);export const yarnArgv={};for(let o=0,e=n.length;o<e;o++){let e=n[o].split("=");Object.assign(yarnArgv,{[e[0]]:e[1]||!0})}export const CUSTOMCONFIG=process.env.npm_config_config||yarnArgv.config||process.env.__args__config__;let c=process.cwd(),r=t(c,"./node_modules"),s={__dirname,__filename,nodeModules:r,pnpmNodeModules:t(r,"./.pnpm/node_modules"),corePath:o.fileURLToPath(new URL(".",import.meta.url)),programPath:c,webpackCachePath:t(r,"./.cache"),lintCachePath:t(r,"./.cache"),httpCachePath:t(r,"./.cache/http"),swcCachePath:t(r,"./.cache/.swc"),configPath:t(c,"./config/index.ts"),customConfigPath:t(c,`./config/${CUSTOMCONFIG}.ts`),coveragePath:t(c,"./coverage/clover.xml"),pagesPath:t(c,"./src/pages"),componentsPath:t(c,"./components"),mockPath:t(c,"./mock")};export const config_files=[a(s.configPath)&&s.configPath,a(s.customConfigPath)&&s.customConfigPath].filter(Boolean);export const routeDir="library"===process.env.APPTYPE?s.componentsPath:s.pagesPath;export default s;
@@ -1 +0,0 @@
1
- let e="win32"===process.platform,s=e?/[^:]\\$/:/.\/$/;export default function(){let o;return o=e?process.env.TEMP||process.env.TMP||`${process.env.SystemRoot||process.env.windir}\\temp`:process.env.TMPDIR||process.env.TMP||process.env.TEMP||"/tmp",s.test(o)&&(o=o.slice(0,-1)),o}
@@ -1 +0,0 @@
1
- import{resolve as e}from"path";import n from"../paths.mjs";export default function(a,t=1){let i=a.replace(/^\/|\/$/g,"").replace(/\\/g,"/"),o=i,m="index.ts",r=i.match(/(.+)\/index\.([^/]+)$/),d=i.match(/(.+)\.([^/]+)$/);return r?(o=r[1],m=`index.${r[2]}`):d&&(o=d[1],m=`index.${d[2]}`),{name:o,main:m,pkg:e(n.nodeModules,o,"package.json"),file:e(n.nodeModules,o,m),meta:`{"name":"${o}","main":"${m}","version":"0.0.${t}","description": ""}`}}
@@ -1,2 +0,0 @@
1
- declare function print(msg: string | string[]): void;
2
- export default print;
@@ -1,2 +0,0 @@
1
- import r from"readline";export default function e(o){if(Array.isArray(o))for(let r=0,t=o.length;r<t;r++)e(`${o[r]}
2
- `);else r.cursorTo(process.stdout,0),r.clearLine(process.stdout,1),process.stdout.write(o)}
@@ -1 +0,0 @@
1
- import t from"events";class e extends t{constructor(t={}){super(),this.data=t}setData(t,e){this.data[t]!==e&&(this.data[t]=e,this.emit("change",t,e))}getData(t){return this.data[t]}removeData(t){Object.prototype.hasOwnProperty.call(this.data,t)&&(delete this.data[t],this.emit("change",t,null))}[Symbol.iterator](){let t=Object.keys(this.data),e=0;return{next:()=>{if(e<t.length){let a=t[e++];return{value:[a,this.data[a]],done:!1}}return{value:void 0,done:!0}}}}}export default e;
@@ -1 +0,0 @@
1
- import{createRequire as e}from"module";import{transformFileSync as o}from"@swc/core";let t=e(import.meta.url),s={sourceMaps:!1,module:{type:"commonjs"},jsc:{parser:{syntax:"typescript"}}};function r(e,t){return e._compile(o(t,s).code,t)}t.extensions[".ts"]=r,t.extensions[".mts"]=r,t.extensions[".mjs"]=r;export default t;
@@ -1,6 +0,0 @@
1
- declare function setupEnv(mode: string, type: string, framework: string): Promise<{
2
- NODE_ENV: string;
3
- APPTYPE: string;
4
- FRAMEWORK: string;
5
- }>;
6
- export default setupEnv;
@@ -1 +0,0 @@
1
- import{loadFile as e}from"@moneko/utils";async function t(t,r,n){let i=[".env",".env/.env",`.env/.${"production"===t?"prod":"dev"}.env`],o={NODE_ENV:t,APPTYPE:r,FRAMEWORK:n};return(await Promise.all(i.map(e))).forEach(e=>{e&&Object.assign(o,e.split("\n").reduce((e,t)=>{if(!t||t.trim().startsWith("#"))return e;let[r,...n]=t.split("=");if(!r)return e;let i=n.join("=").trim();return e[r.trim()]=i.replace(/^["']|["']$/g,""),e},{}))}),Object.keys(o).forEach(e=>{let t=o[e];process.env[e]!==t&&(process.env[e]=o[e])}),o}export default t;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes