@moneko/core 3.54.0-beta.2 → 3.54.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/lib/bin/commit-lint.d.mts +1 -42
  2. package/lib/bin/commit-lint.mjs +1 -1
  3. package/lib/bin/file.d.mts +0 -2
  4. package/lib/bin/index.d.mts +1 -5
  5. package/lib/bin/pin.d.mts +4 -38
  6. package/lib/bin/pure-lint.d.mts +1 -31
  7. package/lib/bin/pure-lint.mjs +1 -1
  8. package/lib/bin/setup.d.mts +0 -3
  9. package/lib/bin/utils/convert-solid.d.mts +3 -6
  10. package/lib/bin/utils/convert-solid.mjs +1 -1
  11. package/lib/bin/utils/setup-swcrc.d.mts +1 -3
  12. package/lib/build/common.d.mts +1 -10
  13. package/lib/build/server.d.mts +0 -5
  14. package/lib/build.d.mts +1 -16
  15. package/lib/commom/ca.d.mts +7 -17
  16. package/lib/commom/ca.mjs +1 -1
  17. package/lib/commom/esm.d.mts +1 -1
  18. package/lib/commom/has-pkg.d.mts +0 -1
  19. package/lib/commom/is-ci-environment.d.mts +4 -2
  20. package/lib/commom/log.d.mts +1 -6
  21. package/lib/commom/match-path.d.mts +16 -1
  22. package/lib/commom/parse-module-meta.d.mts +0 -2
  23. package/lib/commom/print-log.d.mts +0 -1
  24. package/lib/commom/require.d.mts +0 -6
  25. package/lib/commom/timer.d.mts +3 -4
  26. package/lib/common.d.mts +1 -14
  27. package/lib/config.d.mts +0 -24
  28. package/lib/dev/generate-progress-html.d.mts +1 -1
  29. package/lib/dev/json-schema.d.mts +3 -3
  30. package/lib/dev/proxy.d.mts +3 -7
  31. package/lib/dev.d.mts +1 -48
  32. package/lib/dev.mjs +2 -2
  33. package/lib/file-system.d.mts +1 -1
  34. package/lib/loader/lightning-css/runtime/api.d.cts +5 -3
  35. package/lib/loader/lightning-css/runtime/get-url.cjs +1 -1
  36. package/lib/loader/lightning-css/runtime/get-url.d.cts +1 -9
  37. package/lib/module.config.d.mts +3 -49
  38. package/lib/module.config.mjs +1 -1
  39. package/lib/options/css-extract.d.mts +0 -5
  40. package/lib/options/modify-vars.d.mts +0 -9
  41. package/lib/options/split-chunk.d.mts +0 -2
  42. package/lib/plugin/eslint.d.mts +6 -14
  43. package/lib/plugin/module-federation.d.mts +1 -19
  44. package/lib/plugin/stylelint.d.mts +6 -14
  45. package/lib/plugins.config.d.mts +1 -10
  46. package/lib/polyfills/replace-children.d.mts +1 -1
  47. package/lib/process-env.d.mts +4 -8
  48. package/lib/utils/compile-dts.d.mts +16 -3
  49. package/lib/utils/create-types.d.mts +0 -13
  50. package/lib/utils/create-types.mjs +1 -1
  51. package/lib/utils/dts.d.mts +12 -5
  52. package/lib/utils/svg-to-data-uri.d.mts +1 -58
  53. package/lib/utils/vts.d.mts +14 -6
  54. package/lib/vm/docs.d.mts +0 -11
  55. package/lib/vm/docs.mjs +1 -1
  56. package/lib/vm/info.d.mts +0 -3
  57. package/lib/vm/locales.d.mts +0 -24
  58. package/lib/vm/modules.d.mts +0 -25
  59. package/lib/vm/render-app.d.mts +0 -9
  60. package/lib/worker/dts.d.mts +1 -2
  61. package/lib/worker/eslint.d.mts +0 -6
  62. package/lib/worker/eslint.mjs +1 -1
  63. package/lib/worker/react-compiler.d.mts +23 -8
  64. package/lib/worker/react-compiler.mjs +1 -1
  65. package/lib/worker/stylelint.d.mts +0 -4
  66. package/lib/worker/swc-minify.d.mts +1 -2
  67. package/package.json +3 -3
  68. package/lib/bin/build-app.d.mts +0 -11
  69. package/lib/bin/build-app.mjs +0 -1
  70. package/lib/bin/build.d.mts +0 -13
  71. package/lib/bin/build.mjs +0 -1
  72. package/lib/bin/changelog.d.mts +0 -12
  73. package/lib/bin/changelog.mjs +0 -4
  74. package/lib/bin/eslint.d.mts +0 -6
  75. package/lib/bin/eslint.mjs +0 -2
  76. package/lib/bin/git-hooks.d.mts +0 -5
  77. package/lib/bin/git-hooks.mjs +0 -2
  78. package/lib/bin/help.d.mts +0 -85
  79. package/lib/bin/help.mjs +0 -13
  80. package/lib/bin/lessc.d.mts +0 -10
  81. package/lib/bin/lessc.mjs +0 -1
  82. package/lib/bin/server.d.mts +0 -14
  83. package/lib/bin/server.mjs +0 -1
  84. package/lib/bin/start.d.mts +0 -5
  85. package/lib/bin/start.mjs +0 -1
  86. package/lib/bin/stylelint.d.mts +0 -7
  87. package/lib/bin/stylelint.mjs +0 -2
  88. package/lib/bin/tsc.d.mts +0 -6
  89. package/lib/bin/tsc.mjs +0 -1
  90. package/lib/bin/utils/bundle-app.d.mts +0 -7
  91. package/lib/bin/utils/bundle-app.mjs +0 -1
  92. package/lib/bin/utils/config.d.mts +0 -13
  93. package/lib/bin/utils/config.mjs +0 -1
  94. package/lib/bin/utils/get-commit-files.d.mts +0 -3
  95. package/lib/bin/utils/get-commit-files.mjs +0 -1
  96. package/lib/commom/check-npm.d.mts +0 -4
  97. package/lib/commom/check-npm.mjs +0 -1
  98. package/lib/commom/corepack.d.mts +0 -12
  99. package/lib/commom/corepack.mjs +0 -1
  100. package/lib/commom/diff-object.d.mts +0 -2
  101. package/lib/commom/diff-object.mjs +0 -1
  102. package/lib/commom/host.d.mts +0 -3
  103. package/lib/commom/host.mjs +0 -19
  104. package/lib/commom/module-resolve.d.mts +0 -3
  105. package/lib/commom/module-resolve.mjs +0 -1
  106. package/lib/commom/net.d.mts +0 -4
  107. package/lib/commom/net.mjs +0 -1
  108. package/lib/commom/open.d.mts +0 -5
  109. package/lib/commom/open.mjs +0 -1
  110. package/lib/commom/paths.d.mts +0 -36
  111. package/lib/commom/paths.mjs +0 -1
  112. package/lib/commom/reactive-object.d.mts +0 -10
  113. package/lib/commom/reactive-object.mjs +0 -1
  114. package/lib/commom/rule.d.mts +0 -20
  115. package/lib/commom/rule.mjs +0 -1
  116. package/lib/commom/setup-env.d.mts +0 -4
  117. package/lib/commom/setup-env.mjs +0 -1
  118. package/lib/commom/sigint-exit.d.mts +0 -3
  119. package/lib/commom/sigint-exit.mjs +0 -1
  120. package/lib/commom/transform-solid-js.d.mts +0 -41
  121. package/lib/commom/transform-solid-js.mjs +0 -1
  122. package/lib/dev/config.d.mts +0 -14
  123. package/lib/dev/config.mjs +0 -2
  124. package/lib/dev/get-cert.d.mts +0 -10
  125. package/lib/dev/get-cert.mjs +0 -1
  126. package/lib/dev/mock.d.mts +0 -61
  127. package/lib/dev/mock.mjs +0 -1
  128. package/lib/dev/server.d.mts +0 -34
  129. package/lib/dev/server.mjs +0 -1
  130. package/lib/loader/css-in-js-minify.cjs +0 -1
  131. package/lib/loader/css-in-js-minify.d.cts +0 -22
  132. package/lib/loader/lightning-css/codegen.cjs +0 -20
  133. package/lib/loader/lightning-css/codegen.d.cts +0 -36
  134. package/lib/loader/lightning-css/loader.cjs +0 -1
  135. package/lib/loader/lightning-css/loader.d.cts +0 -49
  136. package/lib/loader/lightning-css/utils.cjs +0 -1
  137. package/lib/loader/lightning-css/utils.d.cts +0 -26
  138. package/lib/loader/mdx.cjs +0 -1
  139. package/lib/loader/mdx.d.cts +0 -4
  140. package/lib/loader/react-compiler.cjs +0 -1
  141. package/lib/loader/react-compiler.d.cts +0 -21
  142. package/lib/loader/solid.cjs +0 -1
  143. package/lib/loader/solid.d.cts +0 -9
  144. package/lib/loader/ts-doc.cjs +0 -1
  145. package/lib/loader/ts-doc.d.cts +0 -11
  146. package/lib/options/md-to-html.d.mts +0 -5
  147. package/lib/options/md-to-html.mjs +0 -1
  148. package/lib/options/reslove.d.mts +0 -11
  149. package/lib/options/reslove.mjs +0 -1
  150. package/lib/options/swcrc.d.mts +0 -21
  151. package/lib/options/swcrc.mjs +0 -1
  152. package/lib/plugin/compression.d.mts +0 -17
  153. package/lib/plugin/compression.mjs +0 -1
  154. package/lib/plugin/copy.d.mts +0 -21
  155. package/lib/plugin/copy.mjs +0 -1
  156. package/lib/plugin/done.d.mts +0 -11
  157. package/lib/plugin/done.mjs +0 -1
  158. package/lib/plugin/exposes-declararion.d.mts +0 -20
  159. package/lib/plugin/exposes-declararion.mjs +0 -1
  160. package/lib/plugin/external-remotes.d.mts +0 -8
  161. package/lib/plugin/external-remotes.mjs +0 -1
  162. package/lib/plugin/html-plugin.d.mts +0 -48
  163. package/lib/plugin/html-plugin.mjs +0 -1
  164. package/lib/plugin/lightningcss-plugin.d.mts +0 -31
  165. package/lib/plugin/lightningcss-plugin.mjs +0 -1
  166. package/lib/plugin/manifest.d.mts +0 -43
  167. package/lib/plugin/manifest.mjs +0 -1
  168. package/lib/plugin/override-resolve.d.mts +0 -14
  169. package/lib/plugin/override-resolve.mjs +0 -1
  170. package/lib/plugin/swc-minify-plugin.d.mts +0 -13
  171. package/lib/plugin/swc-minify-plugin.mjs +0 -1
  172. package/lib/plugin/virtual-module.d.mts +0 -24
  173. package/lib/plugin/virtual-module.mjs +0 -1
  174. package/lib/polyfills/polyfills.d.mts +0 -7
  175. package/lib/polyfills/polyfills.mjs +0 -1
  176. package/lib/polyfills/targets.d.mts +0 -8
  177. package/lib/polyfills/targets.mjs +0 -1
  178. package/lib/utils/fetch-module-federation-dts.d.mts +0 -6
  179. package/lib/utils/fetch-module-federation-dts.mjs +0 -1
  180. package/lib/utils/index.d.mts +0 -12
  181. package/lib/utils/index.mjs +0 -1
  182. package/lib/utils/run.d.mts +0 -3
  183. package/lib/utils/run.mjs +0 -1
  184. package/lib/utils/seo.d.mts +0 -10
  185. package/lib/utils/seo.mjs +0 -4
  186. package/lib/vm/coverage.d.mts +0 -39
  187. package/lib/vm/coverage.mjs +0 -1
  188. package/lib/vm/example.d.mts +0 -12
  189. package/lib/vm/example.mjs +0 -1
  190. package/lib/vm/generate-doc.d.mts +0 -35
  191. package/lib/vm/generate-doc.mjs +0 -1
  192. package/lib/vm/routes.d.mts +0 -17
  193. package/lib/vm/routes.mjs +0 -1
  194. package/lib/vm/utils.d.mts +0 -5
  195. package/lib/vm/utils.mjs +0 -1
@@ -1,9 +1 @@
1
- type Url = {
2
- __esModule?: boolean;
3
- default: string;
4
- type?: string;
5
- data?: number[];
6
- };
7
- declare function uint8ArrayToBase64(numberArray: number[]);
8
- declare function numberArrayToHex(buffer: number[], start?: number);
9
- declare function getMimeType(buffer: number[]);
1
+ /* eslint-disable no-param-reassign */ export { };
@@ -1,49 +1,3 @@
1
- import { join, sep } from 'node:path';
2
- import { saveFileSync } from '@moneko/utils';
3
- import type { LibraryOptions, ModuleOptions, PathData, RuleSetRule } from 'webpack';
4
- import paths, { CUSTOMCONFIG } from './commom/paths.mjs';
5
- import ReactiveObject from './commom/reactive-object.mjs';
6
- import require from './commom/require.mjs';
7
- import Rule from './commom/rule.mjs';
8
- import type { LightningCssLoaderOption } from './loader/lightning-css/loader.cjs';
9
- import cssExtract from './options/css-extract.mjs';
10
- import modifyVars from './options/modify-vars.mjs';
11
- import reslove from './options/reslove.mjs';
12
- import swcrc from './options/swcrc.mjs';
13
- import { getLightningCssTargets } from './polyfills/targets.mjs';
14
- import { node_modules, resolveProgram, toCamelCase } from './utils/index.mjs';
15
- import svgToDataUri from './utils/svg-to-data-uri.mjs';
16
- import { comment, getCommentPath } from './vm/docs.mjs';
17
- import generateDoc from './vm/generate-doc.mjs';
18
- import { outputConfig } from './common.mjs';
19
- import { CONFIG } from './config.mjs';
20
- import { type ConfigType, type RulesInclude } from './index.mjs';
21
- import { FRAMEWORK, isDev, isLibrary } from './process-env.mjs';
22
- declare const lightningCssLoader: RuleSetRule;
23
- declare const lessLoader: RuleSetRule;
24
- declare const pathCache: Map<string, string[] | null>;
25
- declare function safePkgPath(name: string): string[];
26
- declare const customCssModules: string[];
27
- declare const entryResolveProgramPath: string[];
28
- declare function include(type: keyof RulesInclude): Promise<string[]>;
29
- declare const includeModules: string[][];
30
- declare const includeCss: string[];
31
- declare const includeJs: string[];
32
- declare const includeMedia: string[];
33
- declare const includeWasm: string[];
34
- declare const includeFont: string[];
35
- declare let sassLoader: RuleSetRule | void;
36
- declare const docLoader: false | RuleSetRule;
37
- declare const IS_UMD: boolean;
38
- declare const commonOneOf: RuleSetRule[];
39
- declare const prefixJsLoader: ConfigType['prefixJsLoader'];
40
- declare const cssModuleType: ReactiveObject<Record<string, string>>;
41
- declare function getJSON(params: {
42
- resourcePath: string;
43
- exports: {
44
- name: string;
45
- value: string;
46
- }[];
47
- });
48
- declare const _dts_1: (ssr: boolean) => ModuleOptions;
49
- export default _dts_1;
1
+ import type { ModuleOptions } from 'webpack';
2
+ declare const _default_1: (ssr: boolean) => ModuleOptions;
3
+ export default _default_1;
@@ -1,2 +1,2 @@
1
1
  let e;import{join as s,sep as o}from"node:path";import{saveFileSync as t}from"@moneko/utils";import r,{CUSTOMCONFIG as a}from"./commom/paths.mjs";import n from"./commom/reactive-object.mjs";import i from"./commom/require.mjs";import m from"./commom/rule.mjs";import l from"./options/css-extract.mjs";import c from"./options/modify-vars.mjs";import d from"./options/reslove.mjs";import p from"./options/swcrc.mjs";import{getLightningCssTargets as u}from"./polyfills/targets.mjs";import{node_modules as f,resolveProgram as h,toCamelCase as j}from"./utils/index.mjs";import y from"./utils/svg-to-data-uri.mjs";import{comment as g,getCommentPath as v}from"./vm/docs.mjs";import x from"./vm/generate-doc.mjs";import{outputConfig as w}from"./common.mjs";import{CONFIG as P}from"./config.mjs";import{FRAMEWORK as L,isDev as M,isLibrary as _}from"./process-env.mjs";let k={loader:s(r.corePath,"/loader/lightning-css/loader.cjs"),options:{sourceMap:!!P.sourceMap,targets:u(),rem:!!P.rem,esModule:!0,modules:{auto(e){if(e){if(e.endsWith(".css")&&!e.endsWith("module.css"))return!1;for(let s=0,o=$.length;s<o;s++)if(e.includes($[s]))return m.css_module.test(e)}return m.node_modules_css_module.test(e)},localIdentName:"[hash]_[local]",namedExport:!0,exportLocalsConvention:"dashesOnly",exportOnlyLocals:!1,getJSON:P.cssModuleDefinition?function(e){q.setData(`${e.resourcePath}.d.ts`,`${e.exports.map(({name:e,value:s})=>`export const ${j(e)}: '${s}';`).join("\n")}
2
- `)}:void 0},importLoaders:2}},O={loader:d.lessLoader,options:{sourceMap:!!P.sourceMap,lessOptions:{modifyVars:c,javascriptEnabled:!0}}},C=new Map;function I(e){if(C.has(e))return C.get(e);try{let s;let t=i.resolve(e).split(o),r=t.lastIndexOf("node_modules");return s=-1!==r?t.slice(0,r).join(o):t.join(o),C.set(e,[s]),[s]}catch{try{let s=i.resolve(`${e}${o}package.json`).replace(`${o}package.json`,"");C.set(e,[s])}catch{C.set(e,[f(e),f(`.pnpm/${e}`)])}return C.get(e)}}let $=[...P.cssModules,`@moneko/${L}`,"neko-ui"].map(I).flat(),b=["components","example","mock","site","src","server"].map(h);function B(e){return new Promise(s=>{s([...b,r.corePath,...P.rulesInclude?.[e]?.map(I).flat()||[]])})}a&&b.push(h(a)),P.overrideResolve&&P.overrideResolve.override&&b.push(P.overrideResolve.override);let J=await Promise.all([B("css"),B("js"),B("media"),B("wasm"),B("font")]),W=J[0],R=J[1],D=J[2],E=J[3],N=J[4];d.sassLoader&&(e={loader:d.sassLoader,options:{implementation:await import("sass"),sassOptions:{}}});let S=_&&M&&{test:m.tsdoc,include:P.alias["@pkg"],exclude:[/node_modules\/(?!(@app|@moneko)).+/,m.__tests__],enforce:"pre",loader:s(r.corePath,"/loader/ts-doc.cjs"),options:{comment:g,generateDoc:x,getCommentPath:v}},z=w.library?.type==="umd"&&!1===P.htmlPluginOption,Q=[{resourceQuery:/raw/i,type:"asset/source"},{resourceQuery:/url/i,type:"asset/resource",generator:{filename(e){let s=e.filename;return s&&s.toLocaleLowerCase().endsWith("wasm?url")?"wasm/[hash][ext]":"assets/[hash][ext]"}}},{test:m.wasm,type:"webassembly/async",include:E},{test:m.txt,type:"asset/source"},{test:m.image,type:"asset",dependency:{not:["url"]},parser:{dataUrlCondition:z?()=>!0:{maxSize:4096}},generator:{filename:e=>e.filename?.toLocaleLowerCase().endsWith(".svg")?"assets/svg/[hash][ext]":"assets/images/[hash][ext]",dataUrl:(e,s)=>s.filename.toLocaleLowerCase().endsWith(".svg")?y(e.toString()):e},include:D},{test:m.video,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[hash][ext]"},include:D},{test:m.font,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[hash][ext]"},include:N}],U=P.prefixJsLoader.filter(Boolean)||[];"react"===L&&P.reactCompiler&&U.unshift({loader:s(r.corePath,"/loader/react-compiler.cjs"),options:P.reactCompiler}),P.cssInJs&&"object"==typeof P.cssInJs.minify&&U.unshift({loader:s(r.corePath,"/loader/css-in-js-minify.cjs"),options:Object.assign({moduleName:"@moneko/css",allowFuncs:["css","injectGlobal"]},P.cssInJs.minify)});let q=new n({});q.on("change",(e,s)=>{t(e,s)});export default(o=>{let t={react:{loader:d.swcLoader,options:p(o)},solid:{loader:s(r.corePath,"/loader/solid.cjs"),options:{jsxOptions:P.jsxDomExpressions,refresh:P.refresh}}}[L];return{parser:{javascript:{commonjsMagicComments:!0,dynamicImportMode:"lazy",dynamicImportPrefetch:!1,dynamicImportPreload:!1,importMeta:!0,importMetaContext:!0}},noParse:P.noParse,rules:[!1!==P.htmlPluginOption&&S,{oneOf:[...Q,{test:m.js,use:[...U,t].filter(Boolean),include:R},{test:m.css,use:[l,k],include:W},e&&{test:m.scss,use:[l,k,e],include:W},{test:m.less,use:[l,k,O],include:W},{test:m.markdown,use:[...U,{loader:s(r.corePath,"/loader/mdx.cjs"),options:P.mdx}].filter(Boolean),exclude:[/node_modules\/(?!(@app|@moneko)).+/]}].filter(Boolean)},...P.moduleRules].filter(Boolean)}});
2
+ `)}:void 0},importLoaders:2}},O={loader:d.lessLoader,options:{sourceMap:!!P.sourceMap,lessOptions:{modifyVars:c,javascriptEnabled:!0}}},C=new Map;function I(e){if(C.has(e))return C.get(e);try{let s,t=i.resolve(e).split(o),r=t.lastIndexOf("node_modules");return s=-1!==r?t.slice(0,r).join(o):t.join(o),C.set(e,[s]),[s]}catch{try{let s=i.resolve(`${e}${o}package.json`).replace(`${o}package.json`,"");C.set(e,[s])}catch{C.set(e,[f(e),f(`.pnpm/${e}`)])}return C.get(e)}}let $=[...P.cssModules,`@moneko/${L}`,"neko-ui"].map(I).flat(),b=["components","example","mock","site","src","server"].map(h);function B(e){return new Promise(s=>{s([...b,r.corePath,...P.rulesInclude?.[e]?.map(I).flat()||[]])})}a&&b.push(h(a)),P.overrideResolve&&P.overrideResolve.override&&b.push(P.overrideResolve.override);let J=await Promise.all([B("css"),B("js"),B("media"),B("wasm"),B("font")]),W=J[0],R=J[1],D=J[2],E=J[3],N=J[4];d.sassLoader&&(e={loader:d.sassLoader,options:{implementation:await import("sass"),sassOptions:{}}});let S=_&&M&&{test:m.tsdoc,include:P.alias["@pkg"],exclude:[/node_modules\/(?!(@app|@moneko)).+/,m.__tests__],enforce:"pre",loader:s(r.corePath,"/loader/ts-doc.cjs"),options:{comment:g,generateDoc:x,getCommentPath:v}},z=w.library?.type==="umd"&&!1===P.htmlPluginOption,Q=[{resourceQuery:/raw/i,type:"asset/source"},{resourceQuery:/url/i,type:"asset/resource",generator:{filename(e){let s=e.filename;return s&&s.toLocaleLowerCase().endsWith("wasm?url")?"wasm/[hash][ext]":"assets/[hash][ext]"}}},{test:m.wasm,type:"webassembly/async",include:E},{test:m.txt,type:"asset/source"},{test:m.image,type:"asset",dependency:{not:["url"]},parser:{dataUrlCondition:z?()=>!0:{maxSize:4096}},generator:{filename:e=>e.filename?.toLocaleLowerCase().endsWith(".svg")?"assets/svg/[hash][ext]":"assets/images/[hash][ext]",dataUrl:(e,s)=>s.filename.toLocaleLowerCase().endsWith(".svg")?y(e.toString()):e},include:D},{test:m.video,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[hash][ext]"},include:D},{test:m.font,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[hash][ext]"},include:N}],U=P.prefixJsLoader.filter(Boolean)||[];"react"===L&&P.reactCompiler&&U.unshift({loader:s(r.corePath,"/loader/react-compiler.cjs"),options:P.reactCompiler}),P.cssInJs&&"object"==typeof P.cssInJs.minify&&U.unshift({loader:s(r.corePath,"/loader/css-in-js-minify.cjs"),options:Object.assign({moduleName:"@moneko/css",allowFuncs:["css","injectGlobal"]},P.cssInJs.minify)});let q=new n({});q.on("change",(e,s)=>{t(e,s)});export default(o=>{let t={react:{loader:d.swcLoader,options:p(o)},solid:{loader:s(r.corePath,"/loader/solid.cjs"),options:{jsxOptions:P.jsxDomExpressions,refresh:P.refresh}}}[L];return{parser:{javascript:{commonjsMagicComments:!0,dynamicImportMode:"lazy",dynamicImportPrefetch:!1,dynamicImportPreload:!1,importMeta:!0,importMetaContext:!0}},noParse:P.noParse,rules:[!1!==P.htmlPluginOption&&S,{oneOf:[...Q,{test:m.js,use:[...U,t].filter(Boolean),include:R},{test:m.css,use:[l,k],include:W},e&&{test:m.scss,use:[l,k,e],include:W},{test:m.less,use:[l,k,O],include:W},{test:m.markdown,use:[...U,{loader:s(r.corePath,"/loader/mdx.cjs"),options:P.mdx}].filter(Boolean),exclude:[/node_modules\/(?!(@app|@moneko)).+/]}].filter(Boolean)},...P.moduleRules].filter(Boolean)}});
@@ -1,9 +1,4 @@
1
- import MiniCssExtractPlugin from 'mini-css-extract-plugin';
2
1
  import type { RuleSetUseItem } from 'webpack';
3
- import { CONFIG, PUBLICPATH } from '../config.mjs';
4
2
  import { type MiniCssExtractPluginOptions } from '../index.mjs';
5
- import { isDev, isMicro } from '../process-env.mjs';
6
- import reslove from './reslove.mjs';
7
- declare const cssAssetsPublicPath: string;
8
3
  declare let cssExtract: RuleSetUseItem;
9
4
  export default cssExtract;
@@ -1,11 +1,2 @@
1
- import hasPkg from '../commom/has-pkg.mjs';
2
- import require from '../commom/require.mjs';
3
- import { CONFIG } from '../config.mjs';
4
- import type { HtmlPluginOption } from '../plugin/html-plugin.mjs';
5
- declare const prefixCls: string;
6
- declare const favicon: string;
7
1
  declare const modifyVars: Record<string, string | false | undefined>;
8
- declare const antd4Vars: {
9
- };
10
- declare const antdVars: string | false;
11
2
  export default modifyVars;
@@ -1,6 +1,4 @@
1
1
  import webpack from 'webpack';
2
2
  export type OptimizationSplitChunksOptions = ConstructorParameters<typeof webpack.optimize.SplitChunksPlugin>[0];
3
- declare function initGroup();
4
- declare const group: ReturnType<typeof initGroup>;
5
3
  declare const splitChunk: OptimizationSplitChunksOptions;
6
4
  export default splitChunk;
@@ -1,22 +1,14 @@
1
- import { fileURLToPath } from 'node:url';
2
1
  import { ESLint } from '@moneko/eslint';
3
- import webpack, { type Compilation, type Compiler } from 'webpack';
4
- import { Worker } from 'worker_threads';
5
- import type { ESLintWorkerMessage } from '../worker/eslint.mjs';
6
- declare class ESLintError extends webpack.WebpackError {
7
- constructor(message: string);
8
- }
2
+ import { type Compiler } from 'webpack';
9
3
  export interface ESLintOption extends ESLint.Options {
10
4
  files: string[];
11
5
  lintDirtyModulesOnly?: boolean;
12
6
  }
13
7
  export declare class ESLintPlugin {
14
- private name: string;
15
- private worker: Worker;
16
- private options: ESLintOption;
17
- constructor(options: ESLintOption = {
18
- files: []
19
- });
8
+ private name;
9
+ private worker;
10
+ private options;
11
+ constructor(options?: ESLintOption);
20
12
  apply(compiler: Compiler): void;
21
- private report(compilation: Compilation, lints?: ESLintWorkerMessage);
13
+ private report;
22
14
  }
@@ -1,21 +1,3 @@
1
- import webpack, { container, type WebpackPluginInstance } from 'webpack';
2
- import moduleResolve from '../commom/module-resolve.mjs';
3
- import { CONFIG } from '../config.mjs';
4
- import fetchModuleFederationDts from '../utils/fetch-module-federation-dts.mjs';
5
- import { resolveProgram } from '../utils/index.mjs';
6
- import { ModuleFederationExposesDeclarationPlugin } from './exposes-declararion.mjs';
7
- import { ExternalRemotesPlugin } from './external-remotes.mjs';
8
- type ModuleFederationPluginOption = ConstructorParameters<typeof ModuleFederationPlugin>[0];
9
- type Remote = {
10
- name: string;
11
- filename?: string;
12
- host: string;
13
- alias?: string;
14
- library?: string[];
15
- };
16
- declare const NormalModuleReplacementPlugin: typeof webpack.NormalModuleReplacementPlugin;
17
- declare const ModuleFederationPlugin: typeof container.ModuleFederationPlugin;
18
- declare const aliasLibrary: Record<string, string>;
19
- declare const exposesDeclarationPlugins: WebpackPluginInstance[];
1
+ import { type WebpackPluginInstance } from 'webpack';
20
2
  declare const moduleFederation: WebpackPluginInstance[];
21
3
  export default moduleFederation;
@@ -1,21 +1,13 @@
1
- import { fileURLToPath } from 'node:url';
2
1
  import type { LinterOptions } from '@moneko/stylelint';
3
- import webpack, { type Compilation, type Compiler } from 'webpack';
4
- import { Worker } from 'worker_threads';
5
- import type { StylelintWorkerMessage } from '../worker/stylelint.mjs';
6
- declare class StylelintError extends webpack.WebpackError {
7
- constructor(message: string);
8
- }
2
+ import { type Compiler } from 'webpack';
9
3
  export interface StylelintOption extends LinterOptions {
10
4
  files: string[];
11
5
  }
12
6
  export declare class StylelintPlugin {
13
- private name: string;
14
- private worker: Worker;
15
- private options: StylelintOption;
16
- constructor(options: StylelintOption = {
17
- files: []
18
- });
7
+ private name;
8
+ private worker;
9
+ private options;
10
+ constructor(options?: StylelintOption);
19
11
  apply(compiler: Compiler): void;
20
- private report(lints?: StylelintWorkerMessage, compilation?: Compilation);
12
+ private report;
21
13
  }
@@ -1,12 +1,3 @@
1
- import webpack, { type WebpackPluginInstance } from 'webpack';
2
- import { CompressionPlugin, type CompressionPluginOptions } from './plugin/compression.mjs';
3
- import { CopyPlugin } from './plugin/copy.mjs';
4
- import { HtmlMeta, HtmlPlugin } from './plugin/html-plugin.mjs';
5
- import { ManifestPlugin } from './plugin/manifest.mjs';
6
- import moduleFederation from './plugin/module-federation.mjs';
7
- import { VirtualModuleWebpackPlugin } from './plugin/virtual-module.mjs';
8
- import { CONFIG } from './config.mjs';
9
- import { packageJson } from './process-env.mjs';
10
- declare const compression: Partial<CompressionPluginOptions>;
1
+ import { type WebpackPluginInstance } from 'webpack';
11
2
  declare const plugins: WebpackPluginInstance[];
12
3
  export default plugins;
@@ -1 +1 @@
1
- declare function replaceChildrenPolyfill(this: Node, ...nodes: (string | Node)[]);
1
+ export { };
@@ -1,7 +1,3 @@
1
- import process from 'node:process';
2
- import hasPkg from './commom/has-pkg.mjs';
3
- import isCIEnvironment from './commom/is-ci-environment.mjs';
4
- import require from './commom/require.mjs';
5
1
  import type { AppType, Framework } from './index.mjs';
6
2
  export declare const IS_WINDOW: boolean;
7
3
  export declare const APPTYPE: AppType;
@@ -13,14 +9,14 @@ export declare const isMobile: boolean;
13
9
  export declare const isReact: boolean;
14
10
  export declare const isSolid: boolean;
15
11
  export declare const SSR: boolean;
16
- export declare const mainDirectory: 'site' | 'src';
12
+ /** 项目主要文件夹 */ export declare const mainDirectory: 'site' | 'src';
17
13
  export declare const jsxImportSource: string;
18
14
  export declare const framework: 'react' | 'solid-js';
19
15
  export declare const frameworkVersionStr: string;
20
16
  export declare const frameworkVersion: number;
21
17
  export declare const packageJson: typeof import('package.json');
22
- export declare const PACKAGENAME: string;
23
- export declare const coreName: string;
24
- export declare const isDev: boolean;
18
+ /** 应用名称 */ export declare const PACKAGENAME: string;
19
+ /** core 包名 */ export declare const coreName: string;
20
+ /** 是否为本地开发环境 */ export declare const isDev: boolean;
25
21
  export declare const refresh: boolean;
26
22
  export declare const isCI: boolean;
@@ -1,9 +1,22 @@
1
- import { cwd } from 'node:process';
2
1
  import ts from 'typescript';
3
- import log from '../commom/log.mjs';
4
2
  interface CompilerDtsOption {
5
3
  extends?: string;
6
4
  compilerOptions?: ts.CompilerOptions;
7
5
  include?: string[];
8
6
  }
9
- export declare function compileDts(config: CompilerDtsOption): string;
7
+ /**
8
+ * 编译 TypeScript 文件
9
+ * @param {CompilerDtsOption} config - 编译配置
10
+ * @returns {string} 编译结果
11
+ * @example
12
+ * ```ts
13
+ * const result = compileDts({
14
+ * extends: './tsconfig.json',
15
+ * compilerOptions: {
16
+ * outFile: './module-federation.d.ts',
17
+ * },
18
+ * include: ['src/components/graph-editor']
19
+ * });
20
+ * ```
21
+ */ export declare function compileDts(config: CompilerDtsOption): string;
22
+ export { };
@@ -1,15 +1,2 @@
1
- import ts, { type DeclarationStatement, type ModifierLike, type ModifierToken, type ModuleDeclaration, type Node, type NodeArray, type Printer, type SourceFile, type Statement, type SyntaxKind as SyntaxKinds, type TransformationContext, type TransformationResult } from 'typescript';
2
- declare const SyntaxKind: typeof SyntaxKinds;
3
- declare const declareModifier: ModifierToken<SyntaxKinds.DeclareKeyword>;
4
- declare const printer: Printer;
5
- declare function transformer(context: TransformationContext);
6
- declare function hasDeclareModifier(node: {
7
- modifiers?: readonly ModifierLike[];
8
- }): boolean;
9
- declare function removeDeclareModifier(modifiers: readonly ModifierLike[] | undefined): readonly ModifierLike[] | undefined;
10
- declare function isTargetDeclaration(node: Node): node is DeclarationStatement & {
11
- modifiers?: readonly ModifierLike[];
12
- };
13
- declare function updateDeclaration(node: Node, newModifiers: readonly ModifierLike[] | undefined): Node;
14
1
  declare function createTypes(moduleName: string, dts: string): string;
15
2
  export default createTypes;
@@ -1 +1 @@
1
- import e from"typescript";let t=e.SyntaxKind,a=e.factory.createModifier(t.DeclareKeyword),r=e.createPrinter({newLine:e.NewLineKind.LineFeed});function i(a){let r=i=>{var n;if((e.isInterfaceDeclaration(i)||e.isTypeAliasDeclaration(i)||e.isClassDeclaration(i)||e.isFunctionDeclaration(i)||e.isEnumDeclaration(i)||e.isVariableStatement(i)||e.isModuleDeclaration(i))&&(n=i).modifiers&&n.modifiers.some(e=>e.kind===t.DeclareKeyword)){let a=function(e){if(!e)return;let a=e.filter(e=>e.kind!==t.DeclareKeyword);return a.length>0?a:void 0}(i.modifiers);return function(t,a){if(e.isInterfaceDeclaration(t))return e.factory.updateInterfaceDeclaration(t,a,t.name,t.typeParameters,t.heritageClauses,t.members);if(e.isTypeAliasDeclaration(t))return e.factory.updateTypeAliasDeclaration(t,a,t.name,t.typeParameters,t.type);if(e.isClassDeclaration(t))return e.factory.updateClassDeclaration(t,a,t.name,t.typeParameters,t.heritageClauses,t.members);if(e.isFunctionDeclaration(t))return e.factory.updateFunctionDeclaration(t,a,t.asteriskToken,t.name,t.typeParameters,t.parameters,t.type,t.body);if(e.isEnumDeclaration(t))return e.factory.updateEnumDeclaration(t,a,t.name,t.members);if(e.isVariableStatement(t))return e.factory.updateVariableStatement(t,a,t.declarationList);if(e.isModuleDeclaration(t))return e.factory.updateModuleDeclaration(t,a,t.name,t.body);return t}(i,a)}return e.visitEachChild(i,r,a)};return t=>e.visitNode(t,r)}export default function(t,n){let o=t.replaceAll("\\","/"),c=e.createSourceFile(`@types/${o}.d.ts`,n,e.ScriptTarget.Latest,!0,e.ScriptKind.TS),l=e.transform(c,[i]),s=l.transformed[0],u=e.factory.createModuleDeclaration([a],e.factory.createStringLiteral(o),e.factory.createModuleBlock(s.statements),e.NodeFlags.None),d=[`// remote module: ${o}`,r.printNode(e.EmitHint.Unspecified,u,c)];return l.dispose(),d.join("\n")}
1
+ import e from"typescript";let t=e.SyntaxKind,a=e.factory.createModifier(t.DeclareKeyword),r=e.createPrinter({newLine:e.NewLineKind.LineFeed});function i(a){let r=i=>{if(n=i,(e.isInterfaceDeclaration(n)||e.isTypeAliasDeclaration(n)||e.isClassDeclaration(n)||e.isFunctionDeclaration(n)||e.isEnumDeclaration(n)||e.isVariableStatement(n)||e.isModuleDeclaration(n))&&(o=i).modifiers&&o.modifiers.some(e=>e.kind===t.DeclareKeyword)){let a=function(e){if(!e)return;let a=e.filter(e=>e.kind!==t.DeclareKeyword);return a.length>0?a:void 0}(i.modifiers);var n,o,c=i,l=a;if(e.isInterfaceDeclaration(c))return e.factory.updateInterfaceDeclaration(c,l,c.name,c.typeParameters,c.heritageClauses,c.members);if(e.isTypeAliasDeclaration(c))return e.factory.updateTypeAliasDeclaration(c,l,c.name,c.typeParameters,c.type);if(e.isClassDeclaration(c))return e.factory.updateClassDeclaration(c,l,c.name,c.typeParameters,c.heritageClauses,c.members);if(e.isFunctionDeclaration(c))return e.factory.updateFunctionDeclaration(c,l,c.asteriskToken,c.name,c.typeParameters,c.parameters,c.type,c.body);if(e.isEnumDeclaration(c))return e.factory.updateEnumDeclaration(c,l,c.name,c.members);if(e.isVariableStatement(c))return e.factory.updateVariableStatement(c,l,c.declarationList);else if(e.isModuleDeclaration(c))return e.factory.updateModuleDeclaration(c,l,c.name,c.body);return c}return e.visitEachChild(i,r,a)};return t=>e.visitNode(t,r)}export default function(t,n){let o=t.replaceAll("\\","/"),c=e.createSourceFile(`@types/${o}.d.ts`,n,e.ScriptTarget.Latest,!0,e.ScriptKind.TS),l=e.transform(c,[i]),s=l.transformed[0],d=e.factory.createModuleDeclaration([a],e.factory.createStringLiteral(o),e.factory.createModuleBlock(s.statements),e.NodeFlags.None),u=[`// remote module: ${o}`,r.printNode(e.EmitHint.Unspecified,d,c)];return l.dispose(),u.join("\n")}
@@ -1,5 +1,12 @@
1
- import ts, { type CompilerOptions, type ModifierLike } from 'typescript';
2
- import Rule from '../commom/rule.mjs';
3
- declare const compilerOptions: CompilerOptions;
4
- export declare function generateDeclaration(source: string, filename: string): string;
5
- export declare function getExportKeys(source: string, filename: string): string[];
1
+ /**
2
+ * 根据ts内容生成声明类型
3
+ * @param {String} source 源码内容
4
+ * @param {String} filename 文件名
5
+ * @returns {String} declaration
6
+ */ export declare function generateDeclaration(source: string, filename: string): string;
7
+ /**
8
+ * 获取ts内容导出的key (优化版本)
9
+ * @param {String} source 源码内容
10
+ * @param {String} filename 文件名
11
+ * @returns {Array<String>} tokens
12
+ */ export declare function getExportKeys(source: string, filename: string): string[];
@@ -1,59 +1,2 @@
1
- declare const shorterNames: {
2
- readonly aqua: RegExp;
3
- readonly azure: RegExp;
4
- readonly beige: RegExp;
5
- readonly bisque: RegExp;
6
- readonly black: RegExp;
7
- readonly blue: RegExp;
8
- readonly brown: RegExp;
9
- readonly coral: RegExp;
10
- readonly cornsilk: RegExp;
11
- readonly crimson: RegExp;
12
- readonly cyan: RegExp;
13
- readonly darkblue: RegExp;
14
- readonly darkcyan: RegExp;
15
- readonly darkgrey: RegExp;
16
- readonly darkred: RegExp;
17
- readonly deeppink: RegExp;
18
- readonly dimgrey: RegExp;
19
- readonly gold: RegExp;
20
- readonly green: RegExp;
21
- readonly grey: RegExp;
22
- readonly honeydew: RegExp;
23
- readonly hotpink: RegExp;
24
- readonly indigo: RegExp;
25
- readonly ivory: RegExp;
26
- readonly khaki: RegExp;
27
- readonly lavender: RegExp;
28
- readonly lime: RegExp;
29
- readonly linen: RegExp;
30
- readonly maroon: RegExp;
31
- readonly moccasin: RegExp;
32
- readonly navy: RegExp;
33
- readonly oldlace: RegExp;
34
- readonly olive: RegExp;
35
- readonly orange: RegExp;
36
- readonly orchid: RegExp;
37
- readonly peru: RegExp;
38
- readonly pink: RegExp;
39
- readonly plum: RegExp;
40
- readonly purple: RegExp;
41
- readonly red: RegExp;
42
- readonly salmon: RegExp;
43
- readonly seagreen: RegExp;
44
- readonly seashell: RegExp;
45
- readonly sienna: RegExp;
46
- readonly silver: RegExp;
47
- readonly skyblue: RegExp;
48
- readonly snow: RegExp;
49
- readonly tan: RegExp;
50
- readonly teal: RegExp;
51
- readonly thistle: RegExp;
52
- readonly tomato: RegExp;
53
- readonly violet: RegExp;
54
- readonly wheat: RegExp;
55
- readonly white: RegExp;
56
- };
57
- declare function colorCodeToShorterNames(str: string);
58
- declare function svgToDataUri(svgString: string);
1
+ declare function svgToDataUri(svgString: string): string;
59
2
  export default svgToDataUri;
@@ -1,10 +1,18 @@
1
- import { createContext, Script } from 'node:vm';
2
- import { type Options, transformFileSync } from '@swc/core';
3
- import require from '../commom/require.mjs';
4
- import * as monekoCore from '../index.mjs';
5
- declare const transformOption: Options;
6
1
  interface VfsOptions {
7
2
  namedExport?: boolean;
3
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
4
  modules: Record<string, any>;
9
5
  }
10
- export declare function vts<T>(filepath: string, options?: VfsOptions): T;
6
+ /**
7
+ * 运行 ts 代码
8
+ * @param {String} filepath 文件名
9
+ * @returns {String} declaration
10
+ * @example
11
+ * // a.ts
12
+ * export default { user: 'admin' } as { user: 'admin' };
13
+ * // b.js
14
+ * const a = vts('fullpath/a.ts');
15
+ *
16
+ * console.log(a); // { user: 'admin' }
17
+ */ export declare function vts<T>(filepath: string, options?: VfsOptions): T;
18
+ export { };
package/lib/vm/docs.d.mts CHANGED
@@ -1,18 +1,7 @@
1
- import { relative, sep } from 'node:path';
2
- import { loadFile, scanFolderSync } from '@moneko/utils';
3
- import parseModuleMeta, { type ModuleMeta } from '../commom/parse-module-meta.mjs';
4
- import paths from '../commom/paths.mjs';
5
1
  import ReactiveObject from '../commom/reactive-object.mjs';
6
- import Rule from '../commom/rule.mjs';
7
- import { CONFIG } from '../config.mjs';
8
- import { FRAMEWORK, framework, isLibrary, isReact, isSolid } from '../process-env.mjs';
9
- import generateDoc from './generate-doc.mjs';
10
- declare const createElement: string;
11
- declare const moduleMeta: ModuleMeta;
12
2
  export declare const docsModuleName: string;
13
3
  export declare const docsModulePkgJson: string;
14
4
  export declare const docsModuleMeta: string;
15
5
  export declare const docs: ReactiveObject<Record<string, string>>;
16
6
  export declare const comment: ReactiveObject<Record<string, string>>;
17
- declare function commentPath();
18
7
  export declare const getCommentPath: (file: string) => string;
package/lib/vm/docs.mjs CHANGED
@@ -1 +1 @@
1
- import{relative as e,sep as t}from"node:path";import{loadFile as o,scanFolderSync as m}from"@moneko/utils";import a from"../commom/parse-module-meta.mjs";import r from"../commom/paths.mjs";import n from"../commom/reactive-object.mjs";import s from"../commom/rule.mjs";import{CONFIG as l}from"../config.mjs";import{FRAMEWORK as c,framework as p,isLibrary as i,isReact as d,isSolid as f}from"../process-env.mjs";import u from"./generate-doc.mjs";let g={react:"createElement",solid:"createComponent"}[c],$=a("@app/docs");export const docsModuleName=$.file;export const docsModulePkgJson=$.pkg;export const docsModuleMeta=$.meta;export const docs=new n({[docsModuleName]:"export default {}",[docsModulePkgJson]:docsModuleMeta});export const comment=new n({});export const getCommentPath=function(){let e=/\/(.+?)\.tsx?$/,t=l.alias["@pkg"]?.length;return o=>o.substring(t).replace(/\\/g,"/").replace(e,"@app/comment/$1.md")}();if(i&&!1!==l.htmlPluginOption){let n={},c=`import { ${g}${f?",Dynamic":""} } from "${p}${f?"/web":""}";import SuspenseComp from "@app/suspense";function call_then(res) {return {default: ${d?"() =>":""}${g}(${f?"Dynamic":"'div'"}, {${f?"innerHTML: res.default, component: 'div', class: 'n-md-box' ":"dangerouslySetInnerHTML: {__html:res.default}, className: 'n-md-box'"} })};}`,i=(e,o)=>{if(!e.endsWith("package.json")){let m=e.replace(/@app[/\\]comment[/\\]/,"").split(t),a=m.pop(),r=m.join("/");n[r]||(n[r]={}),o?n[r][a]&&delete n[r][a]:n[r][a]=`rr(() => ${g}(SuspenseComp, { comp: () => import(/* webpackChunkName: '${e}' */ '${e}?raw').then(call_then)}))rr`;let l={};for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&(l[e]=Object.values(n[e]));docs.setData(docsModuleName,`${c}export default ${JSON.stringify(l).replace(s.extract_func,"$1")}`)}};comment.on("change",(t,o)=>{i(e(r.nodeModules,t),o?.length<0)});let $=m(l.alias["@pkg"],["\\.tsx?$"]).filter(e=>!/(^|\/)\.[^\\/\\.]|\.test\./i.test(e)),h=await Promise.all($.map(async e=>({data:await o(e),file:e})));for(let e=0;e<h.length;e++){let t=h[e];if(t.data){let{file:e,pkg:o,meta:m}=a(getCommentPath(t.file));comment.setData(e,u(t.data,t.file)),comment.setData(o,m)}}}
1
+ import{relative as e,sep as t}from"node:path";import{loadFile as o,scanFolderSync as m}from"@moneko/utils";import a from"../commom/parse-module-meta.mjs";import r from"../commom/paths.mjs";import n from"../commom/reactive-object.mjs";import s from"../commom/rule.mjs";import{CONFIG as l}from"../config.mjs";import{FRAMEWORK as c,framework as p,isLibrary as i,isReact as d,isSolid as f}from"../process-env.mjs";import u from"./generate-doc.mjs";let g={react:"createElement",solid:"createComponent"}[c],$=a("@app/docs");export const docsModuleName=$.file;export const docsModulePkgJson=$.pkg;export const docsModuleMeta=$.meta;export const docs=new n({[docsModuleName]:"export default {}",[docsModulePkgJson]:docsModuleMeta});export const comment=new n({});export const getCommentPath=function(){let e=/\/(.+?)\.tsx?$/,t=l.alias["@pkg"]?.length;return o=>o.substring(t).replace(/\\/g,"/").replace(e,"@app/comment/$1.md")}();if(i&&!1!==l.htmlPluginOption){let n={},c=`import { ${g}${f?",Dynamic":""} } from "${p}${f?"/web":""}";import SuspenseComp from "@app/suspense";function call_then(res) {return {default: ${d?"() =>":""}${g}(${f?"Dynamic":"'div'"}, {${f?"innerHTML: res.default, component: 'div', class: 'n-md-box' ":"dangerouslySetInnerHTML: {__html:res.default}, className: 'n-md-box'"} })};}`;comment.on("change",(o,m)=>{((e,o)=>{if(!e.endsWith("package.json")){let m=e.replace(/@app[/\\]comment[/\\]/,"").split(t),a=m.pop(),r=m.join("/");n[r]||(n[r]={}),o?n[r][a]&&delete n[r][a]:n[r][a]=`rr(() => ${g}(SuspenseComp, { comp: () => import(/* webpackChunkName: '${e}' */ '${e}?raw').then(call_then)}))rr`;let l={};for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&(l[e]=Object.values(n[e]));docs.setData(docsModuleName,`${c}export default ${JSON.stringify(l).replace(s.extract_func,"$1")}`)}})(e(r.nodeModules,o),m?.length<0)});let i=m(l.alias["@pkg"],["\\.tsx?$"]).filter(e=>!/(^|\/)\.[^\\/\\.]|\.test\./i.test(e)),$=await Promise.all(i.map(async e=>({data:await o(e),file:e})));for(let e=0;e<$.length;e++){let t=$[e];if(t.data){let{file:e,pkg:o,meta:m}=a(getCommentPath(t.file));comment.setData(e,u(t.data,t.file)),comment.setData(o,m)}}}
package/lib/vm/info.d.mts CHANGED
@@ -1,5 +1,2 @@
1
- import { CONFIG } from '../config.mjs';
2
- import { APPTYPE, framework, frameworkVersionStr, packageJson, SSR } from '../process-env.mjs';
3
- import { convertToCamelCase } from '../utils/index.mjs';
4
1
  declare const app: Record<string, unknown>;
5
2
  export default app;
@@ -1,29 +1,5 @@
1
- import { basename, join } from 'node:path';
2
- import { directoryExists, scanFolderSync } from '@moneko/utils';
3
- import { watch } from 'chokidar';
4
- import log from '../commom/log.mjs';
5
- import parseModuleMeta, { type ModuleMeta } from '../commom/parse-module-meta.mjs';
6
1
  import ReactiveObject from '../commom/reactive-object.mjs';
7
- import require from '../commom/require.mjs';
8
- import sigintExit from '../commom/sigint-exit.mjs';
9
- import { CONFIG } from '../config.mjs';
10
- import type { Framework } from '../index.mjs';
11
- import { FRAMEWORK, isDev } from '../process-env.mjs';
12
- declare const prefixStr: Record<Framework, string>;
13
- declare const suffixStr: string;
14
- declare function getStr(lang: Omit<LocaleConfig, 'translation'>[], data: Record<string, LocaleConfig>);
15
- declare const moduleMeta: ModuleMeta;
16
2
  export declare const localesModuleName: string;
17
3
  export declare const locales: ReactiveObject<{
18
4
  [x: string]: string;
19
5
  }>;
20
- type LocaleConfig = {
21
- language?: string;
22
- title: string;
23
- icon?: string;
24
- translation: Record<string, string>;
25
- };
26
- declare const caches: Record<string, LocaleConfig>;
27
- declare async function handleFileChange(filePath: string, type: 'change' | 'deleted' | 'added');
28
- declare function watchDirectory(paths: string, ignored: RegExp[]);
29
- declare const localsPath: string;
@@ -1,27 +1,2 @@
1
- import { join } from 'node:path';
2
- import { getAppEntry, getAppFallback, getAppMdxScope, getAppMergeRouter, getAppNormalizeCss, getAppPrefixRouter, getAppRem, getAppSuspense } from '@moneko/mdx';
3
- import { updateFileSync } from '@moneko/utils';
4
- import hasPkg from '../commom/has-pkg.mjs';
5
- import paths from '../commom/paths.mjs';
6
- import Rule from '../commom/rule.mjs';
7
- import { CONFIG } from '../config.mjs';
8
- import moduleFederation from '../plugin/module-federation.mjs';
9
- import type { VirtualModulePluginOption } from '../plugin/virtual-module.mjs';
10
- import { APPTYPE, FRAMEWORK } from '../process-env.mjs';
11
- import createTypes from '../utils/create-types.mjs';
12
- import { generateDeclaration } from '../utils/dts.mjs';
13
- import { node_modules, transformModule } from '../utils/index.mjs';
14
- import getCoverage from './coverage.mjs';
15
- import { docs, docsModuleName } from './docs.mjs';
16
- import info from './info.mjs';
17
- import { locales, localesModuleName } from './locales.mjs';
18
- import renderApp from './render-app.mjs';
19
- import { route, routesModuleName } from './routes.mjs';
20
- declare const mdxScope: string | false;
21
1
  declare const normalModules: Record<string, string | object>;
22
- declare const appDtsPath: string;
23
- declare const appDts: string[];
24
- declare const vmDtsPath: string;
25
- declare const virtualModule: VirtualModulePluginOption;
26
- declare const customVirtualModuleDts: string[];
27
2
  export default normalModules;
@@ -1,11 +1,2 @@
1
- import { CONFIG } from '../config.mjs';
2
- import { APPTYPE, frameworkVersion, isDev } from '../process-env.mjs';
3
- declare const legend: boolean;
4
- declare const ReactDomPath: string;
5
- declare const isHashRouter: boolean;
6
- declare const Router: string;
7
- declare const StrictMode: string;
8
- declare const remoteReactRefresh: string;
9
- declare const Root: string;
10
1
  declare const renderApp: string;
11
2
  export default renderApp;
@@ -1,2 +1 @@
1
- import { parentPort } from 'worker_threads';
2
- import { compileDts } from '../utils/compile-dts.mjs';
1
+ export { };
@@ -1,7 +1 @@
1
- import { relative } from 'node:path';
2
- import { ESLint } from '@moneko/eslint';
3
- import { parentPort } from 'worker_threads';
4
- import paths from '../commom/paths.mjs';
5
1
  export type ESLintWorkerMessage = [warnings: string, errors: string];
6
- declare let timer: NodeJS.Timeout | null;
7
- declare let eslint: ESLint, formatter: ESLint.LoadedFormatter;
@@ -1 +1 @@
1
- let e,t;import{relative as a}from"node:path";import{ESLint as o}from"@moneko/eslint";import{parentPort as r}from"worker_threads";import i from"../commom/paths.mjs";if(!r)throw Error("This file must be run as a worker");let s=null;r.on("message",async({options:c})=>{s&&clearTimeout(s),s=setTimeout(async()=>{s&&(clearTimeout(s),s=null);try{e||(e=new o({cache:c.cache,cacheLocation:c.cacheLocation,cacheStrategy:c.cacheStrategy,fix:c.fix}),t=await e.loadFormatter("stylish"));let s=c.files.map(e=>(c.lintDirtyModulesOnly?a(i.programPath,e):e).replace(/\\/g,"/")),l=await e.lintFiles(s),m=[],n=[];c.fix&&await o.outputFixes(l),l.forEach(e=>{e.errorCount?n.push(e):e.warningCount&&m.push(e)});let h=await Promise.all([t.format(m),t.format(n)]);r.postMessage(h.map(e=>e.replace(/[^\r\n]*(\r?\n)*$/,"")))}catch(e){r.postMessage(e)}},2)}),r.on("close",()=>{s&&clearTimeout(s)});
1
+ let e,t;import{relative as a}from"node:path";import{ESLint as r}from"@moneko/eslint";import{parentPort as o}from"worker_threads";import i from"../commom/paths.mjs";if(!o)throw Error("This file must be run as a worker");let s=null;o.on("message",async({options:c})=>{s&&clearTimeout(s),s=setTimeout(async()=>{s&&(clearTimeout(s),s=null);try{e||(e=new r({cache:c.cache,cacheLocation:c.cacheLocation,cacheStrategy:c.cacheStrategy,fix:c.fix}),t=await e.loadFormatter("stylish"));let s=c.files.map(e=>(c.lintDirtyModulesOnly?a(i.programPath,e):e).replace(/\\/g,"/")),l=await e.lintFiles(s),m=[],n=[];c.fix&&await r.outputFixes(l),l.forEach(e=>{e.errorCount?n.push(e):e.warningCount&&m.push(e)});let h=await Promise.all([t.format(m),t.format(n)]);o.postMessage(h.map(e=>e.replace(/[^\r\n]*(\r?\n)*$/,"")))}catch(e){o.postMessage(e)}},2)}),o.on("close",()=>{s&&clearTimeout(s)});
@@ -1,12 +1,27 @@
1
- import { parentPort } from 'node:worker_threads';
2
- import { transform } from '@moneko/eslint/babel-core';
3
- import { BabelPluginReactCompiler } from '@moneko/eslint/react-compiler';
4
- import log from '../commom/log.mjs';
5
1
  export interface ReactCompilerOption {
6
- target?: '17' | '18' | '19';
7
- sources?(filename: string): boolean;
8
- compilationMode?: 'annotation' | 'infer' | 'syntax' | 'all';
9
- logger?: {
2
+ /**
3
+ * 指定 React 的主要版本
4
+ * @description
5
+ * ReactCompiler 与 React 19+ 配合使用效果最佳;
6
+ *
7
+ * 将 ReactCompiler 与 React 17、18 一起使用需要安装额外的 `react-compiler-runtime` 依赖项;
8
+ */ target?: '17' | '18' | '19';
9
+ /** 指定启用 React Compiler 的范围 */ sources?(filename: string): boolean;
10
+ /** 编译模式
11
+ * @description annotation 注释模式: 通过 "use memo"、"use no memo" 手动指定启用优化
12
+ * @example
13
+ * export default function Home() {
14
+ * 'use memo';
15
+ * // ...
16
+ * }
17
+ * export default function About() {
18
+ * 'use no memo';
19
+ * // ...
20
+ * }
21
+ */ compilationMode?: 'annotation' | 'infer' | 'syntax' | 'all';
22
+ /**
23
+ * 定义日志输出
24
+ */ logger?: {
10
25
  logEvent?: (fileName: string, event: MessageEvent) => void;
11
26
  };
12
27
  noEmit?: boolean;
@@ -1 +1 @@
1
- import{parentPort as e}from"node:worker_threads";import{transform as o}from"@moneko/eslint/babel-core";import{BabelPluginReactCompiler as r}from"@moneko/eslint/react-compiler";import s from"../commom/log.mjs";e?.on("message",async({sourceCode:m,resourcePath:i,...n})=>{o(m,{sourceFileName:i,filename:i,sourceMaps:"inline",plugins:[[r,n]],cloneInputAst:!1,ast:!1,configFile:!1,babelrc:!1},(o,r)=>{if(o){s(o),e?.postMessage([o,m]);return}if(null===r){e?.postMessage([Error(`Failed to transform "${i}"`),m]);return}e?.postMessage([null,r.code??void 0,r.map??void 0])})});
1
+ import{parentPort as o}from"node:worker_threads";import{transform as e}from"@moneko/eslint/babel-core";import{BabelPluginReactCompiler as r}from"@moneko/eslint/react-compiler";import s from"../commom/log.mjs";o?.on("message",async({sourceCode:i,resourcePath:m,...n})=>{e(i,{sourceFileName:m,filename:m,sourceMaps:"inline",plugins:[[r,n]],cloneInputAst:!1,ast:!1,configFile:!1,babelrc:!1},(e,r)=>{if(e){s(e),o?.postMessage([e,i]);return}if(null===r)return void o?.postMessage([Error(`Failed to transform "${m}"`),i]);o?.postMessage([null,r.code??void 0,r.map??void 0])})});
@@ -1,5 +1 @@
1
- import { type Formatter, type LinterResult, type LintResult, stylelint, type Warning } from '@moneko/stylelint';
2
- import { parentPort } from 'worker_threads';
3
1
  export type StylelintWorkerMessage = [warnings: string, errors: string];
4
- declare let timer: NodeJS.Timeout | null;
5
- declare const formatter: Formatter;
@@ -1,2 +1 @@
1
- import { minify } from '@swc/core';
2
- import { parentPort } from 'worker_threads';
1
+ export { };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.54.0-beta.2",
3
+ "version": "3.54.0-beta.3",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
@@ -107,7 +107,7 @@
107
107
  "homepage": "https://monako97.github.io/neko-ui/@moneko/config",
108
108
  "license": "MIT",
109
109
  "dependencies": {
110
- "@moneko/convert": "1.0.1",
110
+ "@moneko/convert": "1.1.0",
111
111
  "@moneko/eslint": "1.8.0",
112
112
  "@moneko/mdx": "0.1.44",
113
113
  "@moneko/raw-import": "0.0.3",
@@ -156,4 +156,4 @@
156
156
  "typings"
157
157
  ],
158
158
  "packageManager": "pnpm@10.15.0"
159
- }
159
+ }