@moneko/core 3.55.3 → 3.55.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/lib/bin/build-app.d.mts +16 -0
  2. package/lib/bin/build.d.mts +2 -0
  3. package/lib/bin/changelog.d.mts +1 -0
  4. package/lib/bin/commit-lint.d.mts +2 -0
  5. package/lib/bin/eslint.d.mts +1 -0
  6. package/lib/bin/file.d.mts +2 -0
  7. package/lib/bin/git-hooks.d.mts +1 -0
  8. package/lib/bin/help.d.mts +2 -0
  9. package/lib/bin/index.d.mts +2 -0
  10. package/lib/bin/lessc.d.mts +1 -0
  11. package/lib/bin/pin.d.mts +6 -0
  12. package/lib/bin/pure-lint.d.mts +2 -0
  13. package/lib/bin/server.d.mts +2 -0
  14. package/lib/bin/setup.d.mts +2 -0
  15. package/lib/bin/start.d.mts +2 -0
  16. package/lib/bin/stylelint.d.mts +2 -0
  17. package/lib/bin/tsc.d.mts +2 -0
  18. package/lib/bin/utils/bundle-app.d.mts +2 -0
  19. package/lib/bin/utils/config.d.mts +6 -0
  20. package/lib/bin/utils/convert-react.d.mts +1 -0
  21. package/lib/bin/utils/get-commit-files.d.mts +2 -0
  22. package/lib/bin/utils/setup-swcrc.d.mts +2 -0
  23. package/lib/build/common.d.mts +3 -0
  24. package/lib/build/server.d.mts +3 -0
  25. package/lib/build.d.mts +1 -0
  26. package/lib/commom/ca.d.mts +8 -0
  27. package/lib/commom/check-npm.d.mts +4 -0
  28. package/lib/commom/corepack.d.mts +11 -0
  29. package/lib/commom/css-in-js-minify.d.mts +13 -0
  30. package/lib/commom/css-in-js-minify.mjs +1 -0
  31. package/lib/commom/diff-object.d.mts +2 -0
  32. package/lib/commom/esm.d.mts +2 -0
  33. package/lib/commom/has-pkg.d.mts +2 -0
  34. package/lib/commom/host.d.mts +1 -0
  35. package/lib/commom/is-ci-environment.d.mts +6 -0
  36. package/lib/commom/log.d.mts +2 -0
  37. package/lib/commom/match-path.d.mts +22 -0
  38. package/lib/commom/mime.d.mts +2 -0
  39. package/lib/commom/module-resolve.d.mts +2 -0
  40. package/lib/commom/net.d.mts +2 -0
  41. package/lib/commom/open.d.mts +2 -0
  42. package/lib/commom/parse-args.d.mts +2 -0
  43. package/lib/commom/parse-module-meta.d.mts +9 -0
  44. package/lib/commom/paths.d.mts +52 -0
  45. package/lib/commom/print-log.d.mts +15 -0
  46. package/lib/commom/reactive-object.d.mts +10 -0
  47. package/lib/commom/require.d.mts +2 -0
  48. package/lib/commom/rule.d.mts +26 -0
  49. package/lib/commom/setup-env.d.mts +6 -0
  50. package/lib/commom/sigint-exit.d.mts +2 -0
  51. package/lib/commom/timer.d.mts +12 -0
  52. package/lib/commom/transfer-import-on-demand.d.mts +78 -0
  53. package/lib/commom/transform-solid-js.d.mts +18 -0
  54. package/lib/common.d.mts +3 -0
  55. package/lib/config.d.mts +4 -0
  56. package/lib/dev/config.d.mts +4 -0
  57. package/lib/dev/generate-progress-html.d.mts +6 -0
  58. package/lib/dev/get-cert.d.mts +8 -0
  59. package/lib/dev/json-schema.d.mts +70 -0
  60. package/lib/dev/mock.d.mts +67 -0
  61. package/lib/dev/proxy.d.mts +15 -0
  62. package/lib/dev/server.d.mts +26 -0
  63. package/lib/dev.d.mts +1 -0
  64. package/lib/file-system.d.mts +2 -0
  65. package/lib/index.d.mts +24 -0
  66. package/lib/lint/eslint/base.d.mts +2 -0
  67. package/lib/lint/eslint/index.d.mts +2 -0
  68. package/lib/lint/eslint/react.d.mts +2 -0
  69. package/lib/lint/eslint/solid.d.mts +2 -0
  70. package/lib/lint/eslint/vue.d.mts +2 -0
  71. package/lib/lint/stylelint/config.d.mts +2 -0
  72. package/lib/lint/stylelint/index.d.mts +1 -0
  73. package/lib/loader/css-in-js-minify.cjs +1 -1
  74. package/lib/loader/css-in-js-minify.d.cts +3 -0
  75. package/lib/loader/lightning-css/codegen.d.cts +35 -0
  76. package/lib/loader/lightning-css/loader.d.cts +29 -0
  77. package/lib/loader/lightning-css/runtime/api.d.cts +1 -0
  78. package/lib/loader/lightning-css/runtime/get-url.d.cts +1 -0
  79. package/lib/loader/lightning-css/utils.d.cts +16 -0
  80. package/lib/loader/mdx.d.cts +3 -0
  81. package/lib/loader/react-compiler.cjs +1 -1
  82. package/lib/loader/react-compiler.d.cts +29 -0
  83. package/lib/loader/solid.cjs +1 -1
  84. package/lib/loader/solid.d.cts +6 -0
  85. package/lib/loader/ts-doc.d.cts +7 -0
  86. package/lib/module.config.d.mts +3 -0
  87. package/lib/options/css-extract.d.mts +3 -0
  88. package/lib/options/jsx-dom-expressions.d.mts +10 -0
  89. package/lib/options/md-to-html.d.mts +2 -0
  90. package/lib/options/modify-vars.d.mts +2 -0
  91. package/lib/options/reslove.d.mts +10 -0
  92. package/lib/options/split-chunk.d.mts +4 -0
  93. package/lib/options/swcrc.d.mts +10 -0
  94. package/lib/plugin/compression.d.mts +15 -0
  95. package/lib/plugin/copy.d.mts +30 -0
  96. package/lib/plugin/done.d.mts +11 -0
  97. package/lib/plugin/eslint.d.mts +14 -0
  98. package/lib/plugin/exposes-declararion.d.mts +15 -0
  99. package/lib/plugin/external-remotes.d.mts +4 -0
  100. package/lib/plugin/html-plugin.d.mts +60 -0
  101. package/lib/plugin/lightningcss-plugin.d.mts +20 -0
  102. package/lib/plugin/manifest.d.mts +46 -0
  103. package/lib/plugin/module-federation.d.mts +3 -0
  104. package/lib/plugin/override-resolve.d.mts +25 -0
  105. package/lib/plugin/stylelint.d.mts +13 -0
  106. package/lib/plugin/swc-minify-plugin.d.mts +8 -0
  107. package/lib/plugin/virtual-module.d.mts +12 -0
  108. package/lib/plugins.config.d.mts +3 -0
  109. package/lib/polyfills/polyfills.d.mts +3 -0
  110. package/lib/polyfills/replace-children.d.mts +1 -0
  111. package/lib/polyfills/targets.d.mts +3 -0
  112. package/lib/process-env.d.mts +26 -0
  113. package/lib/utils/compile-dts.d.mts +23 -0
  114. package/lib/utils/create-types.d.mts +2 -0
  115. package/lib/utils/dts.d.mts +14 -0
  116. package/lib/utils/fetch-module-federation-dts.d.mts +2 -0
  117. package/lib/utils/index.d.mts +35 -0
  118. package/lib/utils/run.d.mts +2 -0
  119. package/lib/utils/seo.d.mts +2 -0
  120. package/lib/utils/svg-to-data-uri.d.mts +2 -0
  121. package/lib/utils/vts.d.mts +18 -0
  122. package/lib/vm/coverage.d.mts +2 -0
  123. package/lib/vm/docs.d.mts +7 -0
  124. package/lib/vm/example.d.mts +4 -0
  125. package/lib/vm/generate-doc.d.mts +1 -0
  126. package/lib/vm/info.d.mts +2 -0
  127. package/lib/vm/locales.d.mts +5 -0
  128. package/lib/vm/modules.d.mts +2 -0
  129. package/lib/vm/render-app.d.mts +2 -0
  130. package/lib/vm/routes.d.mts +8 -0
  131. package/lib/vm/utils.d.mts +1 -0
  132. package/lib/worker/css-in-js-minify.d.mts +1 -0
  133. package/lib/worker/css-in-js-minify.mjs +1 -0
  134. package/lib/worker/dts.d.mts +1 -0
  135. package/lib/worker/eslint.d.mts +1 -0
  136. package/lib/worker/react-compiler.d.mts +1 -0
  137. package/lib/worker/solid.d.mts +1 -0
  138. package/lib/worker/stylelint.d.mts +1 -0
  139. package/lib/worker/swc-minify.d.mts +1 -0
  140. package/package.json +3 -3
  141. package/typings/global.d.ts +15 -12
@@ -0,0 +1,16 @@
1
+ /**
2
+ * 拷贝文件
3
+ * @param {String} source 源文件
4
+ * @param {String} target 目标文件
5
+ * @constructor
6
+ * */
7
+ export declare function copyFileSync(source: string, target: string): void;
8
+ /**
9
+ * 拷贝文件夹
10
+ * @param {String} source 源文件夹
11
+ * @param {String} target 目标文件夹
12
+ * @param {String} sun 是否子文件夹
13
+ * @constructor
14
+ * */
15
+ export declare function copyFolderRecursiveSync(source: string, target: string, sun?: boolean): void;
16
+ export default function createApp(): Promise<void>;
@@ -0,0 +1,2 @@
1
+ declare function build(): Promise<void>;
2
+ export default build;
@@ -0,0 +1 @@
1
+ export default function changelog(): void;
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1 @@
1
+ export default function eslint(): Promise<void>;
@@ -0,0 +1,2 @@
1
+ export declare const __filename: string;
2
+ export declare const __dirname: string;
@@ -0,0 +1 @@
1
+ export default function githooks(): void;
@@ -0,0 +1,2 @@
1
+ declare function printHelp(): void;
2
+ export default printHelp;
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1 @@
1
+ export declare function lesscCommonjs(): Promise<void>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 检测过时依赖
3
+ * @returns {Promise<void>} 返回码 1 失败,0 成功
4
+ */
5
+ declare function pin(): Promise<void>;
6
+ export default pin;
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Promise<void>;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare function setup(): void;
2
+ export default setup;
@@ -0,0 +1,2 @@
1
+ declare function start(): Promise<void>;
2
+ export default start;
@@ -0,0 +1,2 @@
1
+ declare function run(): Promise<void>;
2
+ export default run;
@@ -0,0 +1,2 @@
1
+ declare function tsc(outDir: string): Promise<unknown>;
2
+ export default tsc;
@@ -0,0 +1,2 @@
1
+ export declare function bundleApk(outputPath: string, outputBundleDir: string, type?: string): void;
2
+ export declare function bundleIOS(outputPath: string, outputBundleDir: string, type?: string): void;
@@ -0,0 +1,6 @@
1
+ export declare const runtimePath: string;
2
+ export declare const corePkg: string;
3
+ export declare const cwd: string;
4
+ export declare const cachePath: string;
5
+ export declare const swcCachePath: string;
6
+ export declare function parseBraced(input: string): string[];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ declare function getCommitFiles(): Promise<unknown>;
2
+ export default getCommitFiles;
@@ -0,0 +1,2 @@
1
+ import type { Config } from '@swc/core';
2
+ export declare function getSwcOption(): Promise<Config>;
@@ -0,0 +1,3 @@
1
+ import { type Configuration } from 'webpack';
2
+ declare const buildCommon: Configuration;
3
+ export default buildCommon;
@@ -0,0 +1,3 @@
1
+ import { type Configuration } from 'webpack';
2
+ declare const serverOption: Configuration;
3
+ export default serverOption;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import { type ChildProcess } from 'node:child_process';
2
+ import { type CertificateResult } from '@moneko/utils';
3
+ /**
4
+ * 安装本地根 CA 到用户证书存储区(开发时信任 HTTPS 证书)
5
+ * @param certPath 本地 CA 证书路径
6
+ */
7
+ export declare function installCA(certPath: string): ChildProcess | void;
8
+ export declare function setupCert(domain?: string, install?: boolean): Promise<CertificateResult>;
@@ -0,0 +1,4 @@
1
+ /** 检查 npm 是否需要启用 pre 和 post 脚本
2
+ */
3
+ declare function checkNpm(): void;
4
+ export default checkNpm;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * 如果 corepack 未安装,则安装它
3
+ * @param {boolean} enable 是否启用 corepack
4
+ * @example
5
+ * ```ts
6
+ * import { corepack } from '@moneko/core';
7
+ * corepack(true);
8
+ * ```
9
+ * @returns
10
+ */
11
+ export declare function corepack(enable?: boolean): void;
@@ -0,0 +1,13 @@
1
+ export interface CssInJsMinifyOption {
2
+ /**
3
+ * css in js 使用的模块
4
+ * @default '@moneko/css'
5
+ */
6
+ moduleName: string;
7
+ /**
8
+ * css in js 字符串模版函数
9
+ * @default ['css', 'injectGlobal']
10
+ */
11
+ allowFuncs: string[];
12
+ }
13
+ export declare function cssInJsMinify(sourceCode: string, options: CssInJsMinifyOption): Promise<import("@swc/core").Output>;
@@ -0,0 +1 @@
1
+ import{parse as e,print as t}from"@swc/core";import{compile as r}from"stylis";import n from"./log.mjs";function a(e){return{type:"iTemplateElement",span:{start:0,end:0,ctxt:0},tail:!1,cooked:e,raw:e}}function i(e,t){if("Identifier"===e.tag.type&&t.includes(e.tag.value)){let t=e.template,n=function e(t){return t.map(t=>{switch(t.type){case"import":case"decl":return t.value;case"comm":return"/"===t.props&&t.value.includes("@")?t.value:"";case"rule":return`${t.value.replace(/&\f/g,"&")}{${e(t.children)}}`;default:return`${t.value}{${e(t.children)}}`}}).join("")}(function e(t,r){for(let n=0;n<t.length;n++){let a=t[n],i=a.parent,l=a.children;i?!function(e){var t;return"rule"===e.type&&e.parent&&(t=e.parent,e.line===t.line&&e.column===t.column)}(a)&&i.children.push(a):r.push(a),Array.isArray(l)&&(a.children=[],e(l,r))}return r}(r(function(e){let t=e.quasis.map(e=>e.cooked);return t.reduce((e,r,n)=>(e.push(r),n!==t.length-1&&e.push(`xxx${n}:xxx`),e),[]).join("").trim()}(t)),[])),i=function(e,t){let r=function(e){let t,r=/xxx(\d+):xxx/gm,n=[];for(;null!==(t=r.exec(e));)n.push({value:t[0],p1:parseInt(t[1],10),index:t.index});return n}(e);if(0===r.length)return""===e?[]:[a(e)];let n=[],i=[],l=0;return r.forEach(({value:s,p1:p,index:o},u)=>{let c=e.substring(l,o);l=l+c.length+s.length,c||0!==u?n.push(a(c)):n.push(a("")),i.push(t[p]),u===r.length-1&&n.push(a(e.substring(o+s.length)))}),i.reduce((e,t,r)=>e.concat([t],n[r+1]),[n[0]]).filter(e=>""!==e.raw)}(n,t.expressions);if(n.length>1){let e=[],r=[];i.forEach((t,n)=>{"iTemplateElement"===t.type?e.push({...t,type:"TemplateElement",tail:n===i.length-1}):r.push(t)}),t.quasis=e,t.expressions=r}}}export async function cssInJsMinify(r,a){let{moduleName:l,allowFuncs:s}=a||{};try{let n=await e(r,{syntax:"ecmascript"}),a=[];return n.body.forEach(e=>{"ImportDeclaration"===e.type&&e.source.value===l&&e.specifiers.forEach(e=>{"ImportSpecifier"===e.type&&(e.imported&&s.includes(e.imported.value)?a.push(e.local.value):s.includes(e.local.value)&&a.push(e.local.value))})}),n.body.forEach(e=>{if("ExportDeclaration"===e.type||"ExpressionStatement"===e.type){let t="declaration"in e?e.declaration:e.expression;t&&"CallExpression"===t.type&&t.arguments.forEach(e=>{e.expression&&"TaggedTemplateExpression"===e.expression.type&&i(e.expression,a)}),t&&"VariableDeclaration"===t.type&&t.declarations.forEach(e=>{e.init?.type==="TaggedTemplateExpression"&&i(e.init,a)})}else"CallExpression"===e.type&&e.arguments.forEach(e=>{e.expression&&"TaggedTemplateExpression"===e.expression.type&&i(e.expression,a)})}),await t(n)}catch(e){return n(e),{code:r,map:void 0}}}
@@ -0,0 +1,2 @@
1
+ import type { ConfigType } from '../index.mjs';
2
+ export declare function diffObject(prev?: Partial<ConfigType>, next?: Partial<ConfigType>): Partial<ConfigType>;
@@ -0,0 +1,2 @@
1
+ declare function esm(templateStrings: TemplateStringsArray, ...substitutions: unknown[]): string;
2
+ export default esm;
@@ -0,0 +1,2 @@
1
+ declare function hasPkg(name: string): string | false;
2
+ export default hasPkg;
@@ -0,0 +1 @@
1
+ export declare function hostHelp(domain: string): void;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 检测当前是否运行在 CI 环境中
3
+ * @returns {boolean} 如果是 CI 环境返回 true,否则返回 false
4
+ */
5
+ declare function isCIEnvironment(): boolean;
6
+ export default isCIEnvironment;
@@ -0,0 +1,2 @@
1
+ declare function log(message: Error | string | unknown): Promise<void>;
2
+ export default log;
@@ -0,0 +1,22 @@
1
+ type MatchPath = {
2
+ path: string;
3
+ params: Record<string, unknown>;
4
+ };
5
+ /**
6
+ * RESTful 风格api
7
+ * @param {String} pattern pattern
8
+ * @param {String} path paths
9
+ * @example
10
+ * const pattern = '/users/:id';
11
+ * const pathToMatch = '/users/123';
12
+ * const result = matchPath(pattern, pathToMatch);
13
+ * if (result) {
14
+ * console.log('Match found:', result);
15
+ * console.log('Params:', result.params);
16
+ * } else {
17
+ * console.log('No match found.');
18
+ * }
19
+ * @returns {MatchPath|null} MatchPath
20
+ */
21
+ declare function matchPath(pattern: string, path: string): MatchPath | null;
22
+ export default matchPath;
@@ -0,0 +1,2 @@
1
+ declare const mime: Record<string, string>;
2
+ export default mime;
@@ -0,0 +1,2 @@
1
+ declare function moduleResolve(name: string, esm?: boolean): string;
2
+ export default moduleResolve;
@@ -0,0 +1,2 @@
1
+ export declare function getIPv4(): string | null;
2
+ export declare function getPort<T = number>(start: T, host?: string): Promise<T>;
@@ -0,0 +1,2 @@
1
+ declare function open(url: string): void;
2
+ export default open;
@@ -0,0 +1,2 @@
1
+ declare function parseArgs<T>(args: string[]): T;
2
+ export default parseArgs;
@@ -0,0 +1,9 @@
1
+ export type ModuleMeta = {
2
+ name: string;
3
+ main: string;
4
+ pkg: string;
5
+ file: string;
6
+ meta: string;
7
+ };
8
+ declare function parseModuleMeta(path: string, version?: number): ModuleMeta;
9
+ export default parseModuleMeta;
@@ -0,0 +1,52 @@
1
+ /** 当前文件所在目录的绝对路径 */
2
+ export declare const __dirname: string;
3
+ /** yarn 命令行参数对象,包含配置选项 */
4
+ export declare const yarnArgv: Record<string, string> & {
5
+ config?: string;
6
+ };
7
+ /** 附加启动配置名称
8
+ * @example
9
+ * 当通过以下命令启动时, 此时 CUSTOMCONFIG 为 test
10
+ * ```sh
11
+ * npm run start --config=test
12
+ * ```
13
+ */
14
+ export declare const CUSTOMCONFIG: string | undefined;
15
+ export declare const TMP_DIR: string;
16
+ declare const paths: {
17
+ /** node_modules 目录路径 */
18
+ nodeModules: string;
19
+ /** pnpm node_modules 目录路径 */
20
+ pnpmNodeModules: string;
21
+ /** deno node_modules 目录路径 */
22
+ denoNodeModules: string;
23
+ /** 核心代码路径 */
24
+ corePath: string;
25
+ /** 项目根目录路径 */
26
+ programPath: string;
27
+ /** CA 目录路径 */
28
+ CA_DIR: string;
29
+ /** webpack 缓存目录路径 */
30
+ webpackCachePath: string;
31
+ /** 代码检查工具(ESLint、Stylelint等)的缓存目录路径 */
32
+ lintCachePath: string;
33
+ /** HTTP 远程模块缓存路径 */
34
+ httpCachePath: string;
35
+ /** SWC 缓存目录路径 */
36
+ swcCachePath: string;
37
+ /** 默认配置文件路径 */
38
+ configPath: string;
39
+ /** 自定义配置文件路径 */
40
+ customConfigPath: string;
41
+ /** 测试覆盖率报告路径 */
42
+ coveragePath: string;
43
+ /** 页面目录路径 */
44
+ pagesPath: string;
45
+ /** 组件目录路径 */
46
+ componentsPath: string;
47
+ /** Mock 数据目录路径 */
48
+ mockPath: string;
49
+ };
50
+ export declare const config_files: string[];
51
+ export declare const routeDir: string;
52
+ export default paths;
@@ -0,0 +1,15 @@
1
+ export declare const METHOD_COLOR: Record<string, {
2
+ fg: string;
3
+ bg: string;
4
+ }>;
5
+ interface PrintLogOption {
6
+ note?: string;
7
+ timestamp?: boolean;
8
+ labelAlign?: 'left' | 'right' | 'center';
9
+ labelLen?: number;
10
+ labelForegroundColor?: string;
11
+ labelBackgroundColor?: string;
12
+ noteForegroundColor?: string;
13
+ }
14
+ declare function printLog(label: string, url: string, option?: PrintLogOption): void;
15
+ export default printLog;
@@ -0,0 +1,10 @@
1
+ import EventEmitter from 'node:events';
2
+ declare class ReactiveObject<T extends object = Record<string, string | undefined>> extends EventEmitter {
3
+ readonly data: T;
4
+ constructor(props?: T);
5
+ setData(key: keyof T, value: T[keyof T]): void;
6
+ getData(key: keyof T): T[keyof T];
7
+ removeData(key: keyof T): void;
8
+ [Symbol.iterator](): Iterator<[keyof T, T[keyof T]]>;
9
+ }
10
+ export default ReactiveObject;
@@ -0,0 +1,2 @@
1
+ declare const require: NodeJS.Require;
2
+ export default require;
@@ -0,0 +1,26 @@
1
+ declare const Rule: {
2
+ js: RegExp;
3
+ css: RegExp;
4
+ less: RegExp;
5
+ scss: RegExp;
6
+ wasm: RegExp;
7
+ txt: RegExp;
8
+ image: RegExp;
9
+ video: RegExp;
10
+ font: RegExp;
11
+ markdown: RegExp;
12
+ tsdoc: RegExp;
13
+ css_module: RegExp;
14
+ node_modules_css_module: RegExp;
15
+ node_modules: RegExp;
16
+ __tests__: RegExp;
17
+ dev_watch_ignored: RegExp;
18
+ /**
19
+ * 提取函数字符串
20
+ * @example
21
+ * // () => import('@app')
22
+ * "rr(() => import('@app'))rr".replace(Rule.extract_func, '$1')
23
+ * */
24
+ extract_func: RegExp;
25
+ };
26
+ export default Rule;
@@ -0,0 +1,6 @@
1
+ declare function setupEnv(mode: string, type: string, framework: string, args: string[]): Promise<{
2
+ NODE_ENV: string;
3
+ APPTYPE: string;
4
+ FRAMEWORK: string;
5
+ }>;
6
+ export default setupEnv;
@@ -0,0 +1,2 @@
1
+ declare function sigintExit(call: VoidFunction): void;
2
+ export default sigintExit;
@@ -0,0 +1,12 @@
1
+ interface Timer {
2
+ start(label: string): void;
3
+ end(label: string): {
4
+ nanoseconds: bigint;
5
+ milliseconds: number;
6
+ };
7
+ }
8
+ /**
9
+ * 最高精度的计时方法,返回纳秒级精度的bigint
10
+ */
11
+ declare const timer: Timer;
12
+ export default timer;
@@ -0,0 +1,78 @@
1
+ export type MemberTransformer =
2
+ /** 帕斯卡拼写法(大驼峰): 所有单词的首字母大写,然后直接连接起来,单词之间没有连接符 */
3
+ 'pascal_case'
4
+ /** 骆驼拼写法(小驼峰): 第一个单词的首字母小写, 后续所有单词的首字母大写,然后直接连接起来,单词之间没有连接符 */
5
+ | 'camel_case'
6
+ /** 连字符拼写法: 各个单词或缩写之间以`-`做间隔 */
7
+ | 'kebab_case'
8
+ /** 破折号式: 每个单词全小写或全大写,多单词使用`-`隔开 */
9
+ | 'dashed_case'
10
+ /** 蛇形命名: 每个单词全小写或全大写,多单词使用`_`隔开 */
11
+ | 'snake_case'
12
+ /** 大写 */
13
+ | 'upper_case'
14
+ /** 最后大写 */
15
+ | 'upper_first'
16
+ /** 小写 */
17
+ | 'lower_case'
18
+ /** 最后小写 */
19
+ | 'lower_first';
20
+ export interface TransformerOption {
21
+ /**
22
+ * 要使用的库名称,而不是导入语句中指定的库名称。`${member}` 是替换的成员
23
+ */
24
+ transform: string;
25
+ /**
26
+ * 设置转换时需要单独导入的样式,`${member}` 是替换的成员
27
+ * @default false
28
+ */
29
+ style?: string | boolean;
30
+ /**
31
+ * 当设置为true时,将保留 `import { Button }` 语法,而不是转换为 `import Button`
32
+ * @default false
33
+ */
34
+ skipDefaultConversion?: boolean;
35
+ /**
36
+ * 当遇到会导致导入整个模块时,是否抛出
37
+ * @default true
38
+ */
39
+ preventFullImport?: boolean;
40
+ /**
41
+ * `${member}` 成员转换规则
42
+ * @default []
43
+ */
44
+ memberTransformers?: MemberTransformer[];
45
+ }
46
+ /**
47
+ * 引入语法转换
48
+ * @example
49
+ * ```javascript
50
+ * // 案例
51
+ * const conf = {
52
+ * importOnDemand: {
53
+ * antd: {
54
+ * transform: 'antd/lib/${member}',
55
+ * skipDefaultConversion: false,
56
+ * preventFullImport: true,
57
+ * style: 'antd/lib/${member}/style',
58
+ * memberTransformers: ['dashed_case'],
59
+ * },
60
+ * lodash: {
61
+ * transform: 'lodash/${member}',
62
+ * preventFullImport: true,
63
+ * },
64
+ * },
65
+ * };
66
+ * // 以下代码将会按照预期进行转换
67
+ * import { Button as MyButton, BackTop } from "antd";
68
+ * import { merge } from "lodash";
69
+ * // to
70
+ * import MyButton from "antd/lib/button";
71
+ * import BackTop from "antd/lib/back-top";
72
+ * import "antd/lib/back-top/style";
73
+ * import "antd/lib/button/style";
74
+ * import merge from "lodash/merge";
75
+ * ```
76
+ */
77
+ export type SwcImportOnDemandTransform = Record<string, TransformerOption | false>;
78
+ export declare function swcImportOnDemandConfig(config: SwcImportOnDemandTransform): SwcImportOnDemandTransform;
@@ -0,0 +1,18 @@
1
+ import type { BabelFileMetadata } from '@moneko/eslint/babel-core';
2
+ import type { JSDocNullableType } from 'typescript';
3
+ export interface BabelFileResult {
4
+ ast?: unknown;
5
+ code?: string | JSDocNullableType;
6
+ ignored?: boolean;
7
+ map?: {
8
+ version: number;
9
+ sources: string[];
10
+ names: string[];
11
+ sourceRoot?: string;
12
+ sourcesContent?: string[];
13
+ mappings: string;
14
+ file: string;
15
+ } | null;
16
+ metadata?: BabelFileMetadata;
17
+ }
18
+ export * from '@moneko/convert/solid';
@@ -0,0 +1,3 @@
1
+ import type { Configuration } from 'webpack';
2
+ export declare const outputConfig: Configuration['output'];
3
+ export declare const commonConfig: Configuration;
@@ -0,0 +1,4 @@
1
+ import type { ConfigType } from './index.mjs';
2
+ export declare function getConfig(path: string): Promise<ConfigType>;
3
+ export declare const CONFIG: ConfigType;
4
+ export declare const PUBLICPATH: string;
@@ -0,0 +1,4 @@
1
+ import webpack from 'webpack';
2
+ export declare const PORT: number;
3
+ export declare function getServerAddress(type: 'local' | 'net'): string;
4
+ export declare function devLog(err?: Error | null, stats?: webpack.Stats): void;
@@ -0,0 +1,6 @@
1
+ export type CompliationProcess = {
2
+ percentage: number;
3
+ info: string;
4
+ };
5
+ declare function generateProgressHtml(progressApi: string, progress: CompliationProcess): string;
6
+ export default generateProgressHtml;
@@ -0,0 +1,8 @@
1
+ export type CertOption = {
2
+ key: string;
3
+ cert: string;
4
+ } | {
5
+ install: boolean;
6
+ };
7
+ declare function getCert(domain: string, option: CertOption): Promise<import("@moneko/utils").CertificateResult>;
8
+ export default getCert;
@@ -0,0 +1,70 @@
1
+ type Any = any;
2
+ type NonArraySchemaObjectType = 'boolean' | 'object' | 'number' | 'string' | 'integer';
3
+ type ArraySchemaObjectType = 'array';
4
+ type SchemaObject = ArraySchemaObject | NonArraySchemaObject;
5
+ interface ExternalDocumentationObject {
6
+ description?: string;
7
+ url: string;
8
+ }
9
+ interface ArraySchemaObject extends BaseSchemaObject {
10
+ type: ArraySchemaObjectType;
11
+ items: ReferenceObject | SchemaObject;
12
+ }
13
+ interface NonArraySchemaObject extends BaseSchemaObject {
14
+ type?: NonArraySchemaObjectType;
15
+ }
16
+ interface BaseSchemaObject {
17
+ title?: string;
18
+ description?: string;
19
+ format?: string;
20
+ default?: Any;
21
+ multipleOf?: number;
22
+ maximum?: number;
23
+ exclusiveMaximum?: boolean;
24
+ minimum?: number;
25
+ exclusiveMinimum?: boolean;
26
+ maxLength?: number;
27
+ minLength?: number;
28
+ pattern?: string;
29
+ additionalProperties?: boolean | ReferenceObject | SchemaObject;
30
+ maxItems?: number;
31
+ minItems?: number;
32
+ uniqueItems?: boolean;
33
+ maxProperties?: number;
34
+ minProperties?: number;
35
+ required?: string[];
36
+ enum?: Any[];
37
+ properties?: {
38
+ [name: string]: ReferenceObject | SchemaObject;
39
+ };
40
+ allOf?: (ReferenceObject | SchemaObject)[];
41
+ oneOf?: (ReferenceObject | SchemaObject)[];
42
+ anyOf?: (ReferenceObject | SchemaObject)[];
43
+ not?: ReferenceObject | SchemaObject;
44
+ nullable?: boolean;
45
+ discriminator?: DiscriminatorObject;
46
+ readOnly?: boolean;
47
+ writeOnly?: boolean;
48
+ xml?: XMLObject;
49
+ externalDocs?: ExternalDocumentationObject;
50
+ example?: Any;
51
+ deprecated?: boolean;
52
+ }
53
+ interface DiscriminatorObject {
54
+ propertyName: string;
55
+ mapping?: {
56
+ [value: string]: string;
57
+ };
58
+ }
59
+ interface XMLObject {
60
+ name?: string;
61
+ namespace?: string;
62
+ prefix?: string;
63
+ attribute?: boolean;
64
+ wrapped?: boolean;
65
+ }
66
+ interface ReferenceObject {
67
+ $ref: string;
68
+ }
69
+ export declare function jsonSchema<T>(schema: SchemaObject): any;
70
+ export {};