@moneko/core 3.26.7 → 3.26.9

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 (125) hide show
  1. package/lib/bin/build-app.d.mts +11 -16
  2. package/lib/bin/build.d.mts +10 -1
  3. package/lib/bin/build.mjs +1 -1
  4. package/lib/bin/changelog.d.mts +12 -1
  5. package/lib/bin/convert.d.mts +14 -0
  6. package/lib/bin/convert.mjs +1 -0
  7. package/lib/bin/eslint.d.mts +6 -1
  8. package/lib/bin/eslint.mjs +2 -1
  9. package/lib/bin/file.d.mts +2 -0
  10. package/lib/bin/git-hooks.d.mts +4 -1
  11. package/lib/bin/git-hooks.mjs +2 -1
  12. package/lib/bin/help.d.mts +2 -1
  13. package/lib/bin/index.d.mts +5 -1
  14. package/lib/bin/lessc.d.mts +10 -1
  15. package/lib/bin/start.d.mts +4 -1
  16. package/lib/bin/start.mjs +1 -1
  17. package/lib/bin/stylelint.d.mts +6 -1
  18. package/lib/bin/stylelint.mjs +2 -1
  19. package/lib/bin/tsc.d.mts +5 -0
  20. package/lib/bin/tsc.mjs +1 -0
  21. package/lib/bin/utils/bundle-app.d.mts +6 -2
  22. package/lib/bin/utils/config.d.mts +8 -1
  23. package/lib/bin/utils/config.mjs +1 -1
  24. package/lib/bin/utils/setup-swcrc.d.mts +3 -2
  25. package/lib/bin/utils/setup-swcrc.mjs +1 -1
  26. package/lib/build/common.d.mts +13 -2
  27. package/lib/build/common.mjs +1 -1
  28. package/lib/build/server.d.mts +4 -0
  29. package/lib/build.d.mts +21 -1
  30. package/lib/build.mjs +1 -1
  31. package/lib/commom/diff-object.d.mts +1 -1
  32. package/lib/commom/esm.d.mts +1 -1
  33. package/lib/commom/has-pkg.d.mts +1 -0
  34. package/lib/commom/log.d.mts +4 -0
  35. package/lib/commom/log.mjs +3 -3
  36. package/lib/commom/match-path.d.mts +0 -16
  37. package/lib/commom/net.d.mts +4 -2
  38. package/lib/commom/os-tmp-dir.d.mts +0 -3
  39. package/lib/commom/parse-module-meta.d.mts +4 -1
  40. package/lib/commom/paths.d.mts +21 -39
  41. package/lib/commom/reactive-object.d.mts +4 -4
  42. package/lib/commom/require.d.mts +6 -0
  43. package/lib/commom/rule.d.mts +17 -23
  44. package/lib/commom/setup-env.d.mts +2 -5
  45. package/lib/commom/sigint-exit.d.mts +1 -1
  46. package/lib/common.d.mts +16 -1
  47. package/lib/config.d.mts +21 -0
  48. package/lib/config.mjs +1 -1
  49. package/lib/dev/config.d.mts +11 -1
  50. package/lib/dev/json-schema.d.mts +72 -3
  51. package/lib/dev/mock.d.mts +12 -21
  52. package/lib/dev/proxy.d.mts +4 -4
  53. package/lib/dev.d.mts +57 -1
  54. package/lib/dev.mjs +1 -1
  55. package/lib/index.d.mts +4 -4
  56. package/lib/loader/css-in-js-minify.d.cts +4 -1
  57. package/lib/loader/lightning-css/codegen.d.cts +4 -3
  58. package/lib/loader/lightning-css/loader.cjs +1 -1
  59. package/lib/loader/lightning-css/loader.d.cts +22 -3
  60. package/lib/loader/lightning-css/runtime/api.d.cts +3 -1
  61. package/lib/loader/lightning-css/runtime/get-url.d.cts +4 -1
  62. package/lib/loader/lightning-css/utils.d.cts +21 -11
  63. package/lib/loader/mdx.d.cts +3 -2
  64. package/lib/loader/react-compiler.d.cts +3 -1
  65. package/lib/loader/solid.d.cts +5 -4
  66. package/lib/loader/ts-doc.d.cts +6 -2
  67. package/lib/module.config.d.mts +48 -3
  68. package/lib/module.config.mjs +2 -2
  69. package/lib/options/css-extract.d.mts +6 -0
  70. package/lib/options/html-plugin-option.d.mts +9 -0
  71. package/lib/options/html-plugin-option.mjs +1 -1
  72. package/lib/options/js-minify.d.mts +12 -11
  73. package/lib/options/md-to-html.d.mts +3 -1
  74. package/lib/options/modify-vars.d.mts +7 -4
  75. package/lib/options/reslove.d.mts +9 -7
  76. package/lib/options/split-chunk.d.mts +2 -0
  77. package/lib/options/swcrc.d.mts +14 -3
  78. package/lib/plugin/add-entry-attribute.d.mts +3 -11
  79. package/lib/plugin/copy.d.mts +10 -21
  80. package/lib/plugin/copy.mjs +1 -1
  81. package/lib/plugin/done.d.mts +2 -1
  82. package/lib/plugin/exposes-declararion.d.mts +8 -4
  83. package/lib/plugin/external-remotes.d.mts +6 -2
  84. package/lib/plugin/external-remotes.mjs +1 -1
  85. package/lib/plugin/lightningcss-plugin.d.mts +14 -8
  86. package/lib/plugin/lightningcss-plugin.mjs +1 -1
  87. package/lib/plugin/module-federation.d.mts +19 -1
  88. package/lib/plugin/module-federation.mjs +1 -1
  89. package/lib/plugin/override-resolve.d.mts +6 -17
  90. package/lib/plugin/virtual-module.d.mts +18 -6
  91. package/lib/plugins.config.d.mts +20 -1
  92. package/lib/plugins.config.mjs +1 -1
  93. package/lib/polyfills/polyfills.d.mts +6 -2
  94. package/lib/polyfills/replace-children.d.mts +1 -0
  95. package/lib/polyfills/targets.d.mts +7 -3
  96. package/lib/process-env.d.mts +9 -9
  97. package/lib/process-env.mjs +1 -1
  98. package/lib/utils/create-types.d.mts +4 -1
  99. package/lib/utils/dts.d.mts +10 -12
  100. package/lib/utils/fetch-module-federation-dts.d.mts +4 -1
  101. package/lib/utils/index.d.mts +3 -26
  102. package/lib/utils/run.d.mts +2 -1
  103. package/lib/utils/seo.d.mts +9 -1
  104. package/lib/utils/svg-to-data-uri.d.mts +58 -1
  105. package/lib/utils/vts.d.mts +5 -13
  106. package/lib/vm/coverage.d.mts +38 -1
  107. package/lib/vm/docs.d.mts +12 -0
  108. package/lib/vm/docs.mjs +1 -1
  109. package/lib/vm/example.d.mts +10 -2
  110. package/lib/vm/generate-doc.d.mts +35 -1
  111. package/lib/vm/generate-doc.mjs +1 -1
  112. package/lib/vm/info.d.mts +20 -13
  113. package/lib/vm/locales.d.mts +24 -0
  114. package/lib/vm/locales.mjs +2 -2
  115. package/lib/vm/modules.d.mts +23 -0
  116. package/lib/vm/routes.d.mts +10 -1
  117. package/lib/vm/routes.mjs +1 -1
  118. package/lib/vm/utils.d.mts +5 -1
  119. package/package.json +11 -13
  120. package/typings/global.d.ts +4 -0
  121. package/lib/bin/runlint.d.mts +0 -2
  122. package/lib/bin/runlint.mjs +0 -2
  123. package/lib/commom/get-current-time.d.mts +0 -2
  124. package/lib/commom/get-current-time.mjs +0 -1
  125. package/lib/polyfills/replace-children.d.ts +0 -1
@@ -1,3 +1,9 @@
1
+ import MiniCssExtractPlugin from 'mini-css-extract-plugin';
1
2
  import type { RuleSetUseItem } from 'webpack';
3
+ import { CONFIG, PUBLICPATH } from '../config.mjs';
4
+ 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;
2
8
  declare let cssExtract: RuleSetUseItem;
3
9
  export default cssExtract;
@@ -1,3 +1,12 @@
1
+ import { merge } from 'webpack-merge';
1
2
  import type { HtmlWebpackOption } from '../../typings/global.js';
3
+ import { CONFIG } from '../config.mjs';
4
+ import { coreName, description, keywords, PACKAGENAME } from '../process-env.mjs';
5
+ import { resolveProgram } from '../utils/index.mjs';
6
+ declare const option: HtmlWebpackOption;
7
+ declare const favicon: string | false;
8
+ declare function templateContent({ htmlWebpackPlugin: { options } }: any);
9
+ declare const relCanonical: string | false;
10
+ declare const meta: HtmlWebpackOption['meta'];
2
11
  declare const htmlPluginOption: HtmlWebpackOption;
3
12
  export default htmlPluginOption;
@@ -1,4 +1,4 @@
1
- import{merge as e}from"webpack-merge";import{CONFIG as t}from"../config.mjs";import{coreName as i,description as o,keywords as r,PACKAGENAME as a}from"../process-env.mjs";import{resolveProgram as n}from"../utils/index.mjs";let{favicon:l=`node_modules/${i}/lib/options/favicon.ico`,template:p,...m}=t.htmlPluginOption||{},s=t.seo&&`https://${t.seo.domain}${t.basename}`,d={charset:"UTF-8","X-UA-Compatible":{"http-equiv":"X-UA-Compatible",content:"IE=edge,Chrome=1"},HandheldFriendly:"true",MobileOptimized:"320","screen-orientation":"portrait","x5-orientation":"portrait",browsermode:"application","x5-page-mode":"app","msapplication-tap-highlight":"no","mobile-web-app-capable":"yes",renderer:"webkit",description:o,keywords:Array.isArray(r)?r.toString():"","http-equiv":"refresh",viewport:"width=device-width, initial-scale=1"};s&&Object.assign(d,{relCanonical:{rel:"canonical",href:s}});let c=e({title:t.env?.PROJECTNAME||a.toLocaleUpperCase()||"Title",filename:"index.html",hash:!1,minify:{minifyJS:!0,minifyCSS:!0,collapseWhitespace:!0,removeComments:!0,removeRedundantAttributes:!1,removeScriptTypeAttributes:!1,removeStyleLinkTypeAttributes:!1,removeAttributeQuotes:!0,useShortDoctype:!0},meta:d,tags:[],favicon:l?n(l):l},m,p?{template:p?n(p):void 0}:{templateContent:function({htmlWebpackPlugin:{options:e}}){let t=e.tags,i="",o="";return t&&t.map(function(e){let{tag:t="script",textContent:r="",inject:a="head",...n}=e,l="";for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&(l+=`${e}="${n[e]}" `);let p=`<${t} ${l}>${r}</${t}>`;"body"===a?o+=p:i+=p}),`<!DOCTYPE html>
1
+ import{merge as e}from"webpack-merge";import{CONFIG as t}from"../config.mjs";import{coreName as i,description as o,keywords as r,PACKAGENAME as a}from"../process-env.mjs";import{resolveProgram as n}from"../utils/index.mjs";let l=t.htmlPluginOption||{},p=l.favicon??`node_modules/${i}/lib/options/favicon.ico`,m=t.seo&&`https://${t.seo.domain}${t.basename}`,s={charset:"UTF-8","X-UA-Compatible":{"http-equiv":"X-UA-Compatible",content:"IE=edge,Chrome=1"},HandheldFriendly:"true",MobileOptimized:"320","screen-orientation":"portrait","x5-orientation":"portrait",browsermode:"application","x5-page-mode":"app","msapplication-tap-highlight":"no","mobile-web-app-capable":"yes",renderer:"webkit",description:o,keywords:Array.isArray(r)?r.toString():"","http-equiv":"refresh",viewport:"width=device-width, initial-scale=1"};m&&Object.assign(s,{relCanonical:{rel:"canonical",href:m}});let c=e({title:t.env?.PROJECTNAME||a.toLocaleUpperCase()||"Title",filename:"index.html",hash:!1,minify:{minifyJS:!0,minifyCSS:!0,collapseWhitespace:!0,removeComments:!0,removeRedundantAttributes:!1,removeScriptTypeAttributes:!1,removeStyleLinkTypeAttributes:!1,removeAttributeQuotes:!0,useShortDoctype:!0},meta:s,tags:[]},l,{favicon:p?n(p):p},l.template?{template:n(l.template)}:{templateContent:function({htmlWebpackPlugin:{options:e}}){let t=e.tags,i="",o="";return t&&t.map(function(e){let{tag:t="script",textContent:r="",inject:a="head",...n}=e,l="";for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&(l+=`${e}="${n[e]}" `);let p=`<${t} ${l}>${r}</${t}>`;"body"===a?o+=p:i+=p}),`<!DOCTYPE html>
2
2
  <html lang="en">
3
3
  <head>
4
4
  <title>${e.title}</title>
@@ -1,4 +1,5 @@
1
1
  import TerserPlugin from 'terser-webpack-plugin';
2
+ import { merge } from 'webpack-merge';
2
3
  import type { MinifierType, SwcMinifyOptions, TerserMinifyOptions } from '../index.mjs';
3
4
  type MinifyObject = {
4
5
  terser: {
@@ -11,15 +12,15 @@ type MinifyObject = {
11
12
  terserOptions?: SwcMinifyOptions;
12
13
  };
13
14
  };
14
- export declare const minify: MinifyObject;
15
- export declare const getMinifyOption: (type?: MinifierType, options?: SwcMinifyOptions | TerserMinifyOptions) => ({
16
- minify: typeof TerserPlugin.terserMinify;
17
- terserOptions: TerserMinifyOptions;
18
- extractComments?: boolean;
19
- } | {
20
- minify: typeof TerserPlugin.swcMinify;
21
- terserOptions?: SwcMinifyOptions;
22
- }) & {
23
- terserOptions: any;
15
+ declare const commonCompress: {
16
+ readonly drop_console: boolean;
17
+ readonly drop_debugger: boolean;
18
+ readonly global_defs: {
19
+ readonly '@alert': string;
20
+ };
21
+ readonly pure_funcs: readonly [string, string, string, string];
24
22
  };
25
- export {};
23
+ declare const commonMinifyConf: TerserMinifyOptions & SwcMinifyOptions;
24
+ export declare const minify: MinifyObject;
25
+ export declare const getMinifyOption: (type: string, options: {
26
+ }) => any;
@@ -1,2 +1,4 @@
1
- declare function mdToHtml(text: string): string;
1
+ import marked from 'marked-completed';
2
+ declare const renderer: marked.Renderer;
3
+ declare function mdToHtml(text: string);
2
4
  export default mdToHtml;
@@ -1,7 +1,10 @@
1
+ import { CONFIG } from '../config.mjs';
2
+ import htmlPluginOption from './html-plugin-option.mjs';
3
+ declare const prefixCls: string;
1
4
  declare const modifyVars: {
2
- '@prefix-cls': string;
3
- '@ant-prefix': string;
4
- '@iconfont-css-prefix': string;
5
- '@favicon': string | false | undefined;
5
+ readonly '@prefix-cls';
6
+ readonly '@ant-prefix';
7
+ readonly '@iconfont-css-prefix';
8
+ readonly '@favicon';
6
9
  };
7
10
  export default modifyVars;
@@ -1,10 +1,12 @@
1
+ import hasPkg from '../commom/has-pkg.mjs';
2
+ import require from '../commom/require.mjs';
1
3
  declare const reslove: {
2
- styleLoader: string;
3
- sassLoader: string | false;
4
- lessLoader: string;
5
- swcLoader: string;
6
- transformImports: string | false;
7
- jsxDomExpressions: string | false;
8
- hotMiddlewareClient: string;
4
+ readonly styleLoader;
5
+ readonly sassLoader;
6
+ readonly lessLoader;
7
+ readonly swcLoader;
8
+ readonly transformImports;
9
+ readonly jsxDomExpressions;
10
+ readonly hotMiddlewareClient;
9
11
  };
10
12
  export default reslove;
@@ -1,4 +1,6 @@
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>;
3
5
  declare const splitChunk: OptimizationSplitChunksOptions;
4
6
  export default splitChunk;
@@ -1,3 +1,14 @@
1
- import type { Config as SwcConfig } from '@swc/core';
2
- declare const _default: (ssr: boolean, other?: SwcConfig) => SwcConfig;
3
- export default _default;
1
+ import type { Config as SwcConfig, EnvConfig, JscConfig } from '@swc/core';
2
+ import { merge } from 'webpack-merge';
3
+ import paths from '../commom/paths.mjs';
4
+ import { CONFIG } from '../config.mjs';
5
+ import type { SwcImportOnDemandTransform } from '../index.mjs';
6
+ import polyfills, { coreJsVersion } from '../polyfills/polyfills.mjs';
7
+ import { isDev, isReact, isSolid, jsxImportSource } from '../process-env.mjs';
8
+ import reslove from './reslove.mjs';
9
+ declare function transformConfigs(config: SwcImportOnDemandTransform);
10
+ declare const importOnDemand: SwcImportOnDemandTransform;
11
+ declare const env: EnvConfig;
12
+ declare const _dts_1: (ssr: boolean, other: {
13
+ }) => any;
14
+ export default _dts_1;
@@ -1,18 +1,10 @@
1
+ import HtmlWebpackPlugin from 'html-webpack-plugin';
1
2
  import type { Compiler } from 'webpack';
2
- /**
3
- * 向 html-webpack-plugin 导出的 HTML 模板 script 添加属性
4
- * ```javascript
5
- * // 假设输出 main chunk 为 main.[hash].chunk.js。
6
- * // 提示:输出 chunk 的名称规范化可以在 output.filename 中配置
7
- * new AddEntryAttributePlugin((src => {
8
- * return !!(src.match(/main\.(.*)\.bundle.js$/) || src.match('main.bundle.js'));
9
- * })),
10
- * ```
11
- */
3
+ declare const name: string;
12
4
  export declare class AddEntryAttributePlugin {
13
5
  private readonly test;
14
6
  constructor(opt: {
15
7
  test: RegExp;
16
8
  });
17
- apply(compiler: Compiler): void;
9
+ apply(compiler: Compiler);
18
10
  }
@@ -1,28 +1,17 @@
1
- import { type Compiler } from 'webpack';
2
- /** 需要拷贝的文件列表
3
- * @example
4
- * ```ts
5
- * export default {
6
- * copy: {
7
- * // 将 public 下的 a.json 和 s.txt 添加到资源
8
- * files: ['public/a.json', 'public/s.txt'],
9
- * // 将 static 文件夹添加到资源
10
- * dirs: ['static']
11
- * }
12
- * }
13
- * ```
14
- */
1
+ import { resolve } from 'node:path';
2
+ import { loadFile, scanFolderSync } from '@moneko/utils';
3
+ import webpack, { type Compiler } from 'webpack';
15
4
  export interface CopyPluginOption {
16
- /** 需要拷贝的文件列表 */
17
5
  files?: string[];
18
- /** 需要拷贝的文件夹 */
19
6
  dirs?: string[];
20
7
  }
8
+ declare const PLUGIN_NAME: string;
9
+ declare const RawSource: typeof webpack.sources.RawSource;
21
10
  export declare class CopyPlugin {
22
- private readonly baseFiles;
23
- private readonly dirs;
24
- private cacheFiles;
11
+ private readonly baseFiles: Set<string>;
12
+ private readonly dirs: Set<string>;
13
+ private cacheFiles: string[];
25
14
  constructor(option: CopyPluginOption);
26
- private getFiles;
27
- apply(compiler: Compiler): void;
15
+ private getFiles();
16
+ apply(compiler: Compiler);
28
17
  }
@@ -1 +1 @@
1
- import{resolve as e}from"node:path";import{loadFile as s,scanFolderSync as t}from"@moneko/utils";import i from"webpack";let l="CopyPlugin",{sources:{RawSource:o}}=i;export class CopyPlugin{constructor(s){this.cacheFiles=[],this.baseFiles=new Set(s.files?.map(s=>e(s))||[]),this.dirs=new Set(s.dirs||[])}getFiles(){let e=new Set(this.baseFiles);for(let s of this.dirs)t(s).forEach(s=>e.add(s));let s={deleted:[],files:[...e]};for(let t of new Set(this.cacheFiles))e.has(t)||s.deleted.push(t);return this.cacheFiles=s.files,s}apply(e){e.hooks.thisCompilation.tap({name:l,stage:e.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},e=>{e.hooks.processAssets.tapPromise(l,async()=>{let t=this.getFiles(),i=t.files.map(e=>s(e));(await Promise.all(i)).forEach((s,i)=>{null!==s&&e.emitAsset(t.files[i],new o(s))}),t.deleted.forEach(s=>{e.deleteAsset(s)})})})}}
1
+ import{resolve as e}from"node:path";import{loadFile as s,scanFolderSync as t}from"@moneko/utils";import i from"webpack";let o="CopyPlugin",l=i.sources.RawSource;export class CopyPlugin{constructor(s){this.cacheFiles=[],this.baseFiles=new Set(s.files?.map(s=>e(s))||[]),this.dirs=new Set(s.dirs||[])}getFiles(){let e=new Set(this.baseFiles);for(let s of this.dirs)t(s).forEach(s=>e.add(s));let s={deleted:[],files:[...e]};for(let t of new Set(this.cacheFiles))e.has(t)||s.deleted.push(t);return this.cacheFiles=s.files,s}apply(e){e.hooks.thisCompilation.tap({name:o,stage:e.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},e=>{e.hooks.processAssets.tapPromise(o,async()=>{let t=this.getFiles(),i=t.files.map(e=>s(e));(await Promise.all(i)).forEach((s,i)=>{null!==s&&e.emitAsset(t.files[i],new l(s))}),t.deleted.forEach(s=>{e.deleteAsset(s)})})})}}
@@ -1,10 +1,11 @@
1
1
  import type { Compiler, Stats } from 'webpack';
2
+ declare const PLUGIN_NAME: string;
2
3
  declare class DoneWebpackPlugin {
3
4
  private options;
4
5
  constructor(options: {
5
6
  done: (stats: Stats) => void;
6
7
  });
7
- apply(compiler: Compiler): void;
8
+ apply(compiler: Compiler);
8
9
  }
9
10
  export type DonePluginOption = ConstructorParameters<typeof DoneWebpackPlugin>[0]['done'];
10
11
  export default DoneWebpackPlugin;
@@ -1,11 +1,15 @@
1
- import { type Compiler } from 'webpack';
1
+ import { join, resolve } from 'node:path';
2
+ import { loadFile } from '@moneko/utils';
3
+ import webpack, { type Compiler } from 'webpack';
4
+ import createTypes from '../utils/create-types.mjs';
5
+ import { generateDeclaration } from '../utils/dts.mjs';
2
6
  interface ModuleFederationExposesDeclarationPluginOptions {
3
7
  name: string;
4
8
  exposes: Record<string, string>;
5
9
  }
10
+ declare const PLUGIN_NAME: string;
6
11
  export declare class ModuleFederationExposesDeclarationPlugin {
7
- private option;
12
+ private option: ModuleFederationExposesDeclarationPluginOptions;
8
13
  constructor(option: ModuleFederationExposesDeclarationPluginOptions);
9
- apply(compiler: Compiler): void;
14
+ apply(compiler: Compiler);
10
15
  }
11
- export {};
@@ -1,5 +1,9 @@
1
- import { type Compiler } from 'webpack';
1
+ import webpack, { type Compiler, type ExternalModule } from 'webpack';
2
+ declare const sources: typeof webpack.sources;
3
+ declare const PLUGIN_NAME: string;
4
+ declare function toExpression(templateUrl: string);
5
+ declare function extractUrlAndGlobal(urlAndGlobal: string);
2
6
  declare class ExternalRemotesPlugin {
3
- apply(compiler: Compiler): void;
7
+ apply(compiler: Compiler);
4
8
  }
5
9
  export default ExternalRemotesPlugin;
@@ -1 +1 @@
1
- import e from"webpack";let{sources:t}=e,r="ExternalRemotesPlugin";export default class{apply(e){e.hooks.make.tap(r,e=>{let n=[];e.hooks.buildModule.tap(r,e=>{"ExternalModule"===e.constructor.name&&"script"===e.externalType&&n.push(e)}),e.hooks.afterCodeGeneration.tap(r,function(){n.map(r=>{let n=function(e){let t=e.indexOf("@");if(t<=0||t===e.length-1)throw Error(`Invalid request "${e}"`);return[e.substring(t+1),e.substring(0,t)]}(r.request)[0],o=function(e){let t=[],r=[],n=!1,o=!1;for(let l of e)if("["===l){if(n){o=!0;break}n=!0,r.length&&(t.push(`"${r.join("")}"`),r.length=0)}else if("]"===l){if(!n){o=!0;break}n=!1,r.length&&(t.push(`${r.join("")}`),r.length=0),r.length=0}else r.push(l);if(n||o)throw Error(`Invalid template URL "${e}"`);return r.length&&t.push(`"${r.join("")}"`),t.join(" + ")}(n),l=e.codeGenerationResults.get(r,void 0).sources,s=l.get("javascript")?.source();s&&l.set("javascript",new t.RawSource(s.replace(`"${n}"`,o)))})})})}}
1
+ import e from"webpack";let t=e.sources,r="ExternalRemotesPlugin";export default class{apply(e){e.hooks.make.tap(r,e=>{let o=[];e.hooks.buildModule.tap(r,e=>{"ExternalModule"===e.constructor.name&&"script"===e.externalType&&o.push(e)}),e.hooks.afterCodeGeneration.tap(r,function(){o.map(r=>{let o=function(e){let t=e.indexOf("@");if(t<=0||t===e.length-1)throw Error(`Invalid request "${e}"`);return[e.substring(t+1),e.substring(0,t)]}(r.request)[0],n=function(e){let t=[],r=[],o=!1,n=!1;for(let s of e)if("["===s){if(o){n=!0;break}o=!0,r.length&&(t.push(`"${r.join("")}"`),r.length=0)}else if("]"===s){if(!o){n=!0;break}o=!1,r.length&&(t.push(`${r.join("")}`),r.length=0),r.length=0}else r.push(s);if(o||n)throw Error(`Invalid template URL "${e}"`);return r.length&&t.push(`"${r.join("")}"`),t.join(" + ")}(o),s=e.codeGenerationResults.get(r,void 0).sources,l=s.get("javascript")?.source();l&&s.set("javascript",new t.RawSource(l.replace(`"${o}"`,n)))})})})}}
@@ -1,5 +1,12 @@
1
- import { type Targets } from 'lightningcss';
2
- import { type Compiler } from 'webpack';
1
+ import { Buffer } from 'node:buffer';
2
+ import { type Targets, transform as _transform } from 'lightningcss';
3
+ import webpack, { type Compilation, type Compiler, type ModuleFilenameHelpers, type sources } from 'webpack';
4
+ declare const encoder: TextEncoder;
5
+ declare const RawSource: typeof sources.RawSource;
6
+ declare const SourceMapSource: typeof sources.SourceMapSource;
7
+ declare const matchObject: typeof ModuleFilenameHelpers.matchObject;
8
+ declare const PLUGIN_NAME: string;
9
+ declare const CSS_FILE_REG: RegExp;
3
10
  type Filter = string | RegExp;
4
11
  type Implementation = typeof import('lightningcss');
5
12
  interface MinifyPluginOpts {
@@ -11,10 +18,9 @@ interface MinifyPluginOpts {
11
18
  targets?: Targets;
12
19
  }
13
20
  export declare class LightningCssMinifyPlugin {
14
- private readonly options;
15
- private readonly transform;
16
- constructor(opts?: MinifyPluginOpts);
17
- apply(compiler: Compiler): void;
18
- private transformAssets;
21
+ private readonly options: Omit<MinifyPluginOpts, 'implementation'>;
22
+ private readonly transform: Implementation['transform'];
23
+ constructor(opts: MinifyPluginOpts = {});
24
+ apply(compiler: Compiler);
25
+ private async transformAssets(compilation: Compilation): Promise<void>;
19
26
  }
20
- export {};
@@ -1 +1 @@
1
- import{Buffer as s}from"node:buffer";import{transform as t}from"lightningcss";import i from"webpack";let o=new TextEncoder,{sources:{RawSource:n,SourceMapSource:e},ModuleFilenameHelpers:{matchObject:a}}=i,r="lightning-css-minify",m=/\.(c|le|sc|sa)ss(?:\?.*)?$/i;export class LightningCssMinifyPlugin{constructor(s={}){let{implementation:i,...o}=s;if(i&&"function"!=typeof i.transform)throw TypeError(`[LightningCssMinifyPlugin]: implementation.transform must be an 'lightningcss' transform function. Received ${typeof i.transform}`);this.transform=i?.transform??t,this.options=o}apply(s){let t=JSON.stringify({name:r,version:"0.0.1",options:this.options});s.hooks.compilation.tap(r,s=>{s.hooks.chunkHash.tap(r,(s,i)=>i.update(t)),s.hooks.processAssets.tapPromise({name:r,stage:i.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,additionalAssets:!0},async()=>await this.transformAssets(s)),s.hooks.statsPrinter.tap(r,s=>{s.hooks.print.for("asset.info.minimized").tap(r,(s,{green:t,formatFlag:i})=>s?t(i("minimized")):void 0)})})}async transformAssets(t){let{options:{devtool:i}}=t.compiler,{include:r,exclude:p,test:f,sourceMap:c=void 0===this.options.sourceMap?!!(i&&i.includes("source-map")):this.options.sourceMap,...l}=this.options,h=t.getAssets().filter(s=>!s.info.minimized&&(f||m).test(s.name)&&a({include:r,exclude:p},s.name));await Promise.all(h.map(async i=>{let a;let r=i.source.source(),m="string"==typeof r?o.encode(r):r,p=this.transform({filename:i.name,code:m,minify:!0,sourceMap:c,...l}),f=s.from(p.code);a=c?new e(f,i.name,p.map||"",r,p.map||"",!0):new n(f),t.updateAsset(i.name,a,{...i.info,minimized:!0})}))}}
1
+ import{Buffer as s}from"node:buffer";import{transform as t}from"lightningcss";import i from"webpack";let o=new TextEncoder,e=i.sources.RawSource,n=i.sources.SourceMapSource,r=i.ModuleFilenameHelpers.matchObject,a="lightning-css-minify",m=/\.(c|le|sc|sa)ss(?:\?.*)?$/i;export class LightningCssMinifyPlugin{constructor(s={}){let{implementation:i,...o}=s;if(i&&"function"!=typeof i.transform)throw TypeError(`[LightningCssMinifyPlugin]: implementation.transform must be an 'lightningcss' transform function. Received ${typeof i.transform}`);this.transform=i?.transform??t,this.options=o}apply(s){let t=JSON.stringify({name:a,version:"0.0.1",options:this.options});s.hooks.compilation.tap(a,s=>{s.hooks.chunkHash.tap(a,(s,i)=>i.update(t)),s.hooks.processAssets.tapPromise({name:a,stage:i.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,additionalAssets:!0},async()=>await this.transformAssets(s)),s.hooks.statsPrinter.tap(a,s=>{s.hooks.print.for("asset.info.minimized").tap(a,(s,{green:t,formatFlag:i})=>s?t(i("minimized")):void 0)})})}async transformAssets(t){let{options:{devtool:i}}=t.compiler,{include:a,exclude:p,test:c,sourceMap:f=void 0===this.options.sourceMap?!!(i&&i.includes("source-map")):this.options.sourceMap,...l}=this.options,h=t.getAssets().filter(s=>!s.info.minimized&&(c||m).test(s.name)&&r({include:a,exclude:p},s.name));await Promise.all(h.map(async i=>{let r;let a=i.source.source(),m="string"==typeof a?o.encode(a):a,p=this.transform({filename:i.name,code:m,minify:!0,sourceMap:f,...l}),c=s.from(p.code);r=f?new n(c,i.name,p.map||"",a,p.map||"",!0):new e(c),t.updateAsset(i.name,r,{...i.info,minimized:!0})}))}}
@@ -1,3 +1,21 @@
1
- import { type WebpackPluginInstance } from 'webpack';
1
+ import webpack, { container, type WebpackPluginInstance } from 'webpack';
2
+ import require from '../commom/require.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[];
2
20
  declare const moduleFederation: WebpackPluginInstance[];
3
21
  export default moduleFederation;
@@ -1 +1 @@
1
- import e from"webpack";import r from"../commom/require.mjs";import{CONFIG as t}from"../config.mjs";import s from"../utils/fetch-module-federation-dts.mjs";import{resolveProgram as o}from"../utils/index.mjs";import{ModuleFederationExposesDeclarationPlugin as m}from"./exposes-declararion.mjs";import a from"./external-remotes.mjs";let{NormalModuleReplacementPlugin:i,container:{ModuleFederationPlugin:n}}=e,l={},p=[],f=t.moduleFederation?.map(e=>{let t={},a={},i={};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,m=t.filename||"remote_entry.js";if(a[o]=`${t.name}@${t.host}/${m}`,Array.isArray(t.library))for(let e=0,r=t.library.length;e<r;e++)l[t.library[e]]=`${o}/${t.library[e]}`;s(t.host,t.name)}if(Array.isArray(e.exposes)){for(let s=0,m=e.exposes.length;s<m;s++){let m=e.exposes[s];if("string"==typeof m){let e=m.startsWith(".");t[`./${m}`]=r.resolve(e?o(m):m),e&&(i[m]=t[`./${m}`])}else if("[object Object]"===Object.prototype.toString.call(m)){let e=m.path.startsWith(".");t[`./${m.name}`]=r.resolve(e?o(m.path):m.path),e&&(i[`./${m.name}`]=t[`./${m.name}`])}}e.exposes?.length&&p.push(new m({exposes:i,name:e.name}))}return new n({filename:"remote_entry.js",...e,remotes:a,exposes:t})});f.length>0&&(f.push(new a),f.push(new i(/(.*)/,e=>{l[e.request]&&(e.request=l[e.request])})),p.forEach(e=>f.push(e))),t.env.injectRemoteReactRefresh=Object.keys(l).includes("react-dom");export default f;
1
+ import e from"webpack";import r from"../commom/require.mjs";import{CONFIG as t}from"../config.mjs";import o from"../utils/fetch-module-federation-dts.mjs";import{resolveProgram as s}from"../utils/index.mjs";import{ModuleFederationExposesDeclarationPlugin as m}from"./exposes-declararion.mjs";import a from"./external-remotes.mjs";let i=e.NormalModuleReplacementPlugin,l=e.container.ModuleFederationPlugin,n={},p=[],f=t.moduleFederation?.map(e=>{let t={},a={},i={};if(Array.isArray(e.remotes))for(let r=0,t=e.remotes.length;r<t;r++){let t=e.remotes[r],s=t.alias||t.name,m=t.filename||"remote_entry.js";if(a[s]=`${t.name}@${t.host}/${m}`,Array.isArray(t.library))for(let e=0,r=t.library.length;e<r;e++)n[t.library[e]]=`${s}/${t.library[e]}`;o(t.host,t.name)}if(Array.isArray(e.exposes)){for(let o=0,m=e.exposes.length;o<m;o++){let m=e.exposes[o];if("string"==typeof m){let e=m.startsWith(".");t[`./${m}`]=r.resolve(e?s(m):m),e&&(i[m]=t[`./${m}`])}else if("[object Object]"===Object.prototype.toString.call(m)){let e=m.path.startsWith(".");t[`./${m.name}`]=r.resolve(e?s(m.path):m.path),e&&(i[`./${m.name}`]=t[`./${m.name}`])}}e.exposes?.length&&p.push(new m({exposes:i,name:e.name}))}return new l({filename:"remote_entry.js",...e,remotes:a,exposes:t})});f.length>0&&(f.push(new a),f.push(new i(/(.*)/,e=>{n[e.request]&&(e.request=n[e.request])})),p.forEach(e=>f.push(e))),t.env.injectRemoteReactRefresh=Object.keys(n).includes("react-dom");export default f;
@@ -1,26 +1,15 @@
1
+ import { relative } from 'node:path';
2
+ import { fileExists } from '@moneko/utils';
1
3
  import type { Resolver } from 'webpack';
4
+ import paths from '../commom/paths.mjs';
2
5
  export interface OverrideResolverOption {
3
- /** 源文件夹地址
4
- * @default src 默认
5
- * @default site 组件库
6
- */
7
6
  original?: string;
8
- /** 用于覆盖的文件夹地址
9
- * @default CUSTOMCONFIG 启动命令的 config 值
10
- * // 当运行下面的命令启动时
11
- * @example
12
- * ```sh
13
- * npm run start --config=fix-1131
14
- * # or
15
- * yarn start config=fix-1131
16
- * ```
17
- * override 默认为 config 的值, 即 fix-1131 目录
18
- */
19
7
  override?: string;
20
8
  }
9
+ declare const PLUGIN_NAME: string;
21
10
  declare class OverrideResolverPlugin {
22
- private readonly options;
11
+ private readonly options: Required<OverrideResolverOption>;
23
12
  constructor(options: Required<OverrideResolverOption>);
24
- apply(resolver: Resolver): void;
13
+ apply(resolver: Resolver);
25
14
  }
26
15
  export default OverrideResolverPlugin;
@@ -1,12 +1,24 @@
1
1
  import type { Compiler } from 'webpack';
2
+ import VirtualModulesPlugin from 'webpack-virtual-modules';
3
+ import parseModuleMeta from '../commom/parse-module-meta.mjs';
4
+ import paths from '../commom/paths.mjs';
5
+ import { isLibrary } from '../process-env.mjs';
6
+ import { node_modules } from '../utils/index.mjs';
7
+ import { comment, docs } from '../vm/docs.mjs';
8
+ import { examples } from '../vm/example.mjs';
9
+ import { locales } from '../vm/locales.mjs';
10
+ import modules from '../vm/modules.mjs';
11
+ import { route } from '../vm/routes.mjs';
12
+ declare const defaultModules: Record<string, string>;
2
13
  export interface VirtualModulePluginOption {
3
14
  [key: string]: string | object;
4
15
  }
16
+ declare const PLUGIN_NAME: string;
5
17
  export declare class VirtualModuleWebpackPlugin {
6
- private virtualModules;
7
- private options;
8
- private init;
9
- constructor(options?: VirtualModulePluginOption);
10
- private modify;
11
- apply(compiler: Compiler): void;
18
+ private virtualModules: any;
19
+ private options: Record<string, string>;
20
+ private init: boolean;
21
+ constructor(options: VirtualModulePluginOption = {});
22
+ private modify(compiler: Compiler, key: string, moduleContents?: string);
23
+ apply(compiler: Compiler);
12
24
  }
@@ -1,3 +1,22 @@
1
- import { type WebpackPluginInstance } from 'webpack';
1
+ import HtmlWebpackPlugin from 'html-webpack-plugin';
2
+ import webpack, { type WebpackPluginInstance } from 'webpack';
3
+ import htmlPluginOption from './options/html-plugin-option.mjs';
4
+ import { AddEntryAttributePlugin } from './plugin/add-entry-attribute.mjs';
5
+ import { CopyPlugin } from './plugin/copy.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 { isMicro } from './process-env.mjs';
10
+ declare const DefinePlugin: typeof webpack.DefinePlugin;
11
+ declare const SourceMapDevToolPlugin: typeof webpack.SourceMapDevToolPlugin;
12
+ declare const IgnorePlugin: typeof webpack.IgnorePlugin;
13
+ declare const dirDeep: number;
14
+ declare const page404: string;
15
+ declare const fixBrowserRouter: {
16
+ pathSegmentsToKeep?: number;
17
+ path?: string;
18
+ };
19
+ declare const pathSegmentsToKeep: number;
20
+ declare const path: string;
2
21
  declare const plugins: WebpackPluginInstance[];
3
22
  export default plugins;
@@ -1 +1 @@
1
- import e from"html-webpack-plugin";import t from"webpack";import o from"./options/html-plugin-option.mjs";import{AddEntryAttributePlugin as l}from"./plugin/add-entry-attribute.mjs";import{CopyPlugin as i}from"./plugin/copy.mjs";import r from"./plugin/module-federation.mjs";import{VirtualModuleWebpackPlugin as p}from"./plugin/virtual-module.mjs";import{CONFIG as n}from"./config.mjs";import{isMicro as s}from"./process-env.mjs";let{DefinePlugin:m,SourceMapDevToolPlugin:a,IgnorePlugin:c}=t,u=n.basename.split("/").filter(Boolean).length,f=`${Array(u).fill("..").join("/")+(u?"/":"")}404.html`,{pathSegmentsToKeep:h=u,path:d=f}=n.fixBrowserRouter||{},g=[...r,new p(n.virtualModule),n.htmlPluginOption&&new e(o),n.fixBrowserRouter&&new e({filename:d,inject:!1,templateContent:()=>`<html lang="en"><head><title>${o.title}</title><script>const pathKeep = ${h||u};const l = window.location;l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + l.pathname.split('/').slice(0, 1 + pathKeep).join('/') + '/?/' + l.pathname.slice(1).split('/').slice(pathKeep).join('/').replace(/&/g, '~and~') + (l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') + l.hash);</script></head><body></body></html>`}),new i(n.copy),s&&new l({test:/main\.bundle\.js$/}),new m({"process.env":JSON.stringify(n.env)}),new c({resourceRegExp:/\/(__(tests|mocks)__|test|spec|e2e)\//}),n.sourceMap&&new a(n.sourceMap),...n.plugins].filter(e=>!!e);export default g;
1
+ import e from"html-webpack-plugin";import t from"webpack";import o from"./options/html-plugin-option.mjs";import{AddEntryAttributePlugin as l}from"./plugin/add-entry-attribute.mjs";import{CopyPlugin as i}from"./plugin/copy.mjs";import n from"./plugin/module-federation.mjs";import{VirtualModuleWebpackPlugin as p}from"./plugin/virtual-module.mjs";import{CONFIG as r}from"./config.mjs";import{isMicro as s}from"./process-env.mjs";let m=t.DefinePlugin,a=t.SourceMapDevToolPlugin,c=t.IgnorePlugin,u=r.basename.split("/").filter(Boolean).length,h=`${Array(u).fill("..").join("/")+(u?"/":"")}404.html`,f=r.fixBrowserRouter||{},g=f.pathSegmentsToKeep??u,d=f.path??h,w=[...n,new p(r.virtualModule),r.htmlPluginOption&&new e(o),r.fixBrowserRouter&&new e({filename:d,inject:!1,templateContent:()=>`<html lang="en"><head><title>${o.title}</title><script>const pathKeep = ${g};const l = window.location;l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + l.pathname.split('/').slice(0, 1 + pathKeep).join('/') + '/?/' + l.pathname.slice(1).split('/').slice(pathKeep).join('/').replace(/&/g, '~and~') + (l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') + l.hash);</script></head><body></body></html>`}),new i(r.copy),s&&new l({test:/main\.bundle\.js$/}),new m({"process.env":JSON.stringify(r.env)}),new c({resourceRegExp:/\/(__(tests|mocks)__|test|spec|e2e)\//}),r.sourceMap&&new a(r.sourceMap),...r.plugins].filter(e=>!!e);export default w;
@@ -1,3 +1,7 @@
1
- export declare const coreJsVersion: any;
2
- declare function polyfills(): string[];
1
+ import compat from 'core-js-compat';
2
+ import require from '../commom/require.mjs';
3
+ import { getBrowsersTargets } from './targets.mjs';
4
+ declare const _coreJsVersion: string;
5
+ export declare const coreJsVersion: string;
6
+ declare function polyfills();
3
7
  export default polyfills;
@@ -0,0 +1 @@
1
+ declare function replaceChildrenPolyfill(this: Node, ...nodes: (string | Node)[]);
@@ -1,3 +1,7 @@
1
- import { type Targets } from 'lightningcss';
2
- export declare function getBrowsersTargets(): string[];
3
- export declare function getLightningCssTargets(): Targets;
1
+ import browsersList from 'browserslist';
2
+ import { browserslistToTargets, type Targets } from 'lightningcss';
3
+ import paths from '../commom/paths.mjs';
4
+ declare let browserTargets: string[] | undefined;
5
+ export declare function getBrowsersTargets();
6
+ declare let lightningCssTargets: Targets | undefined;
7
+ export declare function getLightningCssTargets();
@@ -1,3 +1,5 @@
1
+ import hasPkg from './commom/has-pkg.mjs';
2
+ import require from './commom/require.mjs';
1
3
  import type { AppType, Framework } from './index.mjs';
2
4
  export declare const APPTYPE: AppType;
3
5
  export declare const FRAMEWORK: Framework;
@@ -8,17 +10,15 @@ export declare const isMobile: boolean;
8
10
  export declare const isReact: boolean;
9
11
  export declare const isSolid: boolean;
10
12
  export declare const SSR: boolean;
11
- /** 项目主要文件夹 */
12
- export declare const mainDirectory: string;
13
+ export declare const mainDirectory: 'site' | 'src';
13
14
  export declare const jsxImportSource: string;
14
- declare const description: any, author: any, repository: any, keywords: any;
15
- export { author, description, keywords, repository };
16
- /** 应用名称 */
15
+ declare const info: Record<string, unknown>;
16
+ export declare const description: string;
17
+ export declare const author: string | Record<string, string>;
18
+ export declare const repository: string;
19
+ export declare const keywords: string[];
17
20
  export declare const PACKAGENAME: string;
18
- /** 版本号 */
19
21
  export declare const PACKAGEVERSION: string;
20
- /** core 包名 */
21
22
  export declare const coreName: string;
22
- /** 是否为本地开发环境 */
23
23
  export declare const isDev: boolean;
24
- export declare const refresh: string | false;
24
+ export declare const refresh: boolean;
@@ -1 +1 @@
1
- import o from"./commom/has-pkg.mjs";import e from"./commom/require.mjs";export const APPTYPE=process.env.APPTYPE;export const FRAMEWORK=process.env.FRAMEWORK;export const NODE_ENV=process.env.NODE_ENV;export const isLibrary="library"===APPTYPE;export const isMicro="micro"===APPTYPE;export const isMobile="mobile"===APPTYPE;export const isReact="react"===FRAMEWORK;export const isSolid="solid"===FRAMEWORK;export const SSR="true"===process.env.SSR;export const mainDirectory=isLibrary?"site":"src";export const jsxImportSource={react:"react",solid:"solid-js/h"}[FRAMEWORK];let{name:r,version:s,description:t,author:c,repository:p,keywords:i}=e(`${process.cwd()}/package.json`);export const PACKAGENAME=r;export const PACKAGEVERSION=s;export const coreName="@moneko/core";export const isDev="development"===NODE_ENV;export const refresh=isDev&&(o("solid-refresh")||o("react-refresh"));export{c as author,t as description,i as keywords,p as repository};
1
+ import o from"./commom/has-pkg.mjs";import r from"./commom/require.mjs";export const APPTYPE=process.env.APPTYPE;export const FRAMEWORK=process.env.FRAMEWORK;export const NODE_ENV=process.env.NODE_ENV;export const isLibrary="library"===APPTYPE;export const isMicro="micro"===APPTYPE;export const isMobile="mobile"===APPTYPE;export const isReact="react"===FRAMEWORK;export const isSolid="solid"===FRAMEWORK;export const SSR="true"===process.env.SSR;export const mainDirectory=isLibrary?"site":"src";export const jsxImportSource={react:"react",solid:"solid-js/h"}[FRAMEWORK];let e=r(`${process.cwd()}/package.json`);export const description=e.description;export const author=e.author;export const repository=e.repository;export const keywords=e.keywords;export const PACKAGENAME=e.name;export const PACKAGEVERSION=e.version;export const coreName="@moneko/core";export const isDev="development"===NODE_ENV;export const refresh=!!(isDev&&(o("solid-refresh")||o("react-refresh")));
@@ -1,2 +1,5 @@
1
- declare function createTypes(moduleName: string, dts: string): string;
1
+ import { resolve } from 'node:path';
2
+ import { ModuleDeclarationKind, Project, SyntaxKind } from 'ts-morph';
3
+ declare const project: Project;
4
+ declare function createTypes(moduleName: string, dts: string);
2
5
  export default createTypes;
@@ -1,14 +1,12 @@
1
- /**
2
- * 根据ts内容生成声明类型
3
- * @param {String} source 源码、内容
4
- * @param {String} filename 文件名
5
- * @returns {String} declaration
6
- */
1
+ import { createDefaultMapFromNodeModules, createSystem, createVirtualTypeScriptEnvironment, type VirtualTypeScriptEnvironment } from '@typescript/vfs';
2
+ import ts from 'typescript';
3
+ import Rule from '../commom/rule.mjs';
4
+ declare const compilerOptions: ts.CompilerOptions;
5
+ declare const fsMap: Map<string, string>;
6
+ declare const system: ts.System;
7
+ declare const env: VirtualTypeScriptEnvironment;
7
8
  export declare function generateDeclaration(source: string, filename: string): string;
8
- /**
9
- * 获取ts内容导出key
10
- * @param {String} source 源码、内容
11
- * @param {String} filename 文件名
12
- * @returns {Array<String>} tokens
13
- */
9
+ interface SymbolObject {
10
+ exports?: Map<string, unknown>;
11
+ }
14
12
  export declare function getExportKeys(source: string, filename: string): string[];
@@ -1,2 +1,5 @@
1
- declare function fetchModuleFederationDts(host: string, name: string): Promise<void>;
1
+ import { updateFile } from '@moneko/utils';
2
+ import log from '../commom/log.mjs';
3
+ import { node_modules } from './index.mjs';
4
+ declare async function fetchModuleFederationDts(host: string, name: string);
2
5
  export default fetchModuleFederationDts;
@@ -1,34 +1,11 @@
1
- /**
2
- * 将字符串转换为小驼峰命名
3
- * @param {string} str 需要转换的字符串
4
- * @returns {string} 转换后的小驼峰命名字符串
5
- * @example
6
- * toCamelCase('hello-world') // 'helloWorld'
7
- * toCamelCase('foo-bar') // 'fooBar'
8
- */
1
+ import { resolve } from 'node:path';
2
+ import paths from '../commom/paths.mjs';
9
3
  export declare function toCamelCase(str: string): string;
10
- /**
11
- * 将字符串转换为驼峰命名
12
- * @param {string} name 需要转换的字符串
13
- * @returns {string} 转换后的驼峰命名字符串
14
- * @example
15
- * convertToCamelCase('hello-world') // 'HelloWorld'
16
- * convertToCamelCase('foo-bar-ui') // 'FooBarUI'
17
- */
18
4
  export declare function convertToCamelCase(name: string): string;
19
5
  type ProgramPath<T extends string> = `${T extends string ? T : string}`;
20
- /** 位于项目根目录下的位置
21
- * @param {string} src 路径
22
- * @returns {string} 位于项目根目录下的位置
23
- */
24
6
  export declare function resolveProgram<T extends string>(src: T): ProgramPath<T>;
25
- /** 位于项目根目录node_modules下的位置
26
- * @param {string} name 路径
27
- * @returns {string} 位于项目根目录node_modules下的位置
28
- */
29
7
  export declare function node_modules<T extends string>(name: T): `node_modules/${T}`;
30
8
  export declare function isObject(target: unknown): target is object;
31
9
  type AnyFunction = (...a: any[]) => any;
32
10
  export declare function isFunction<T>(target: T): target is T & AnyFunction;
33
- export declare function empty(): void;
34
- export {};
11
+ export declare function empty();
@@ -1,2 +1,3 @@
1
- declare function run(fileContent: string, filePath: string): any;
1
+ import vm from 'node:vm';
2
+ declare function run(fileContent: string, filePath: string);
2
3
  export default run;
@@ -1,2 +1,10 @@
1
- declare const seo: () => void;
1
+ import { join } from 'node:path';
2
+ import { scanRouter, sitemap } from '@moneko/mdx';
3
+ import { saveFileSync } from '@moneko/utils';
4
+ import { routeDir } from '../commom/paths.mjs';
5
+ import { outputConfig } from '../common.mjs';
6
+ import { CONFIG } from '../config.mjs';
7
+ import { isLibrary } from '../process-env.mjs';
8
+ import { resolveProgram } from './index.mjs';
9
+ declare const seo: () => any;
2
10
  export default seo;