@moneko/core 3.55.2 → 3.55.3-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bin/build-app.d.mts +16 -0
- package/lib/bin/build.d.mts +2 -0
- package/lib/bin/build.mjs +1 -1
- package/lib/bin/changelog.d.mts +1 -0
- package/lib/bin/commit-lint.d.mts +2 -0
- package/lib/bin/eslint.d.mts +1 -0
- package/lib/bin/file.d.mts +2 -0
- package/lib/bin/git-hooks.d.mts +1 -0
- package/lib/bin/help.d.mts +2 -0
- package/lib/bin/index.d.mts +2 -0
- package/lib/bin/lessc.d.mts +1 -0
- package/lib/bin/lessc.mjs +1 -1
- package/lib/bin/pin.d.mts +6 -0
- package/lib/bin/pin.mjs +1 -1
- package/lib/bin/pure-lint.d.mts +2 -0
- package/lib/bin/pure-lint.mjs +1 -1
- package/lib/bin/server.d.mts +2 -0
- package/lib/bin/setup.d.mts +2 -0
- package/lib/bin/start.d.mts +2 -0
- package/lib/bin/stylelint.d.mts +2 -0
- package/lib/bin/tsc.d.mts +2 -0
- package/lib/bin/utils/bundle-app.d.mts +2 -0
- package/lib/bin/utils/config.d.mts +6 -0
- package/lib/bin/utils/convert-react.d.mts +1 -0
- package/lib/bin/utils/get-commit-files.d.mts +2 -0
- package/lib/bin/utils/setup-swcrc.d.mts +2 -0
- package/lib/bin/utils/setup-swcrc.mjs +1 -1
- package/lib/build/common.d.mts +3 -0
- package/lib/build/server.d.mts +3 -0
- package/lib/build.d.mts +1 -0
- package/lib/commom/ca.d.mts +8 -0
- package/lib/commom/ca.mjs +1 -1
- package/lib/commom/check-npm.d.mts +4 -0
- package/lib/commom/corepack.d.mts +11 -0
- package/lib/commom/diff-object.d.mts +2 -0
- package/lib/commom/esm.d.mts +2 -0
- package/lib/commom/has-pkg.d.mts +2 -0
- package/lib/commom/host.d.mts +1 -0
- package/lib/commom/is-ci-environment.d.mts +6 -0
- package/lib/commom/log.d.mts +2 -0
- package/lib/commom/match-path.d.mts +22 -0
- package/lib/commom/mime.d.mts +2 -0
- package/lib/commom/module-resolve.d.mts +2 -0
- package/lib/commom/net.d.mts +2 -0
- package/lib/commom/open.d.mts +2 -0
- package/lib/commom/parse-args.d.mts +2 -0
- package/lib/commom/parse-module-meta.d.mts +9 -0
- package/lib/commom/paths.d.mts +52 -0
- package/lib/commom/print-log.d.mts +15 -0
- package/lib/commom/reactive-object.d.mts +10 -0
- package/lib/commom/require.d.mts +2 -0
- package/lib/commom/rule.d.mts +26 -0
- package/lib/commom/setup-env.d.mts +6 -0
- package/lib/commom/sigint-exit.d.mts +2 -0
- package/lib/commom/timer.d.mts +12 -0
- package/lib/commom/transfer-import-on-demand.d.mts +78 -0
- package/lib/commom/transfer-import-on-demand.mjs +1 -0
- package/lib/commom/transform-solid-js.d.mts +18 -0
- package/lib/common.d.mts +3 -0
- package/lib/config.d.mts +4 -0
- package/lib/dev/config.d.mts +4 -0
- package/lib/dev/generate-progress-html.d.mts +6 -0
- package/lib/dev/get-cert.d.mts +8 -0
- package/lib/dev/json-schema.d.mts +70 -0
- package/lib/dev/mock.d.mts +67 -0
- package/lib/dev/proxy.d.mts +15 -0
- package/lib/dev/server.d.mts +26 -0
- package/lib/dev.d.mts +1 -0
- package/lib/file-system.d.mts +2 -0
- package/lib/index.d.mts +24 -0
- package/lib/lint/eslint/base.d.mts +2 -0
- package/lib/lint/eslint/index.d.mts +2 -0
- package/lib/lint/eslint/react.d.mts +2 -0
- package/lib/lint/eslint/solid.d.mts +2 -0
- package/lib/lint/eslint/vue.d.mts +2 -0
- package/lib/lint/stylelint/config.d.mts +2 -0
- package/lib/lint/stylelint/index.d.mts +1 -0
- package/lib/loader/css-in-js-minify.d.cts +14 -0
- package/lib/loader/lightning-css/codegen.d.cts +35 -0
- package/lib/loader/lightning-css/loader.d.cts +29 -0
- package/lib/loader/lightning-css/runtime/api.d.cts +1 -0
- package/lib/loader/lightning-css/runtime/get-url.d.cts +1 -0
- package/lib/loader/lightning-css/utils.d.cts +16 -0
- package/lib/loader/mdx.d.cts +3 -0
- package/lib/loader/react-compiler.cjs +1 -1
- package/lib/loader/react-compiler.d.cts +29 -0
- package/lib/loader/solid.cjs +1 -1
- package/lib/loader/solid.d.cts +6 -0
- package/lib/loader/ts-doc.d.cts +7 -0
- package/lib/module.config.d.mts +3 -0
- package/lib/options/css-extract.d.mts +3 -0
- package/lib/options/jsx-dom-expressions.d.mts +10 -0
- package/lib/options/md-to-html.d.mts +2 -0
- package/lib/options/modify-vars.d.mts +2 -0
- package/lib/options/reslove.d.mts +10 -0
- package/lib/options/reslove.mjs +1 -1
- package/lib/options/split-chunk.d.mts +4 -0
- package/lib/options/swcrc.d.mts +10 -0
- package/lib/options/swcrc.mjs +1 -1
- package/lib/plugin/compression.d.mts +15 -0
- package/lib/plugin/compression.mjs +1 -1
- package/lib/plugin/copy.d.mts +30 -0
- package/lib/plugin/copy.mjs +1 -1
- package/lib/plugin/done.d.mts +11 -0
- package/lib/plugin/eslint.d.mts +14 -0
- package/lib/plugin/exposes-declararion.d.mts +15 -0
- package/lib/plugin/exposes-declararion.mjs +1 -1
- package/lib/plugin/external-remotes.d.mts +4 -0
- package/lib/plugin/html-plugin.d.mts +60 -0
- package/lib/plugin/lightningcss-plugin.d.mts +20 -0
- package/lib/plugin/lightningcss-plugin.mjs +1 -1
- package/lib/plugin/manifest.d.mts +46 -0
- package/lib/plugin/module-federation.d.mts +3 -0
- package/lib/plugin/override-resolve.d.mts +25 -0
- package/lib/plugin/stylelint.d.mts +13 -0
- package/lib/plugin/swc-minify-plugin.d.mts +8 -0
- package/lib/plugin/swc-minify-plugin.mjs +1 -1
- package/lib/plugin/virtual-module.d.mts +12 -0
- package/lib/plugins.config.d.mts +3 -0
- package/lib/polyfills/polyfills.d.mts +3 -0
- package/lib/polyfills/replace-children.d.mts +1 -0
- package/lib/polyfills/targets.d.mts +3 -0
- package/lib/process-env.d.mts +26 -0
- package/lib/utils/compile-dts.d.mts +23 -0
- package/lib/utils/create-types.d.mts +2 -0
- package/lib/utils/dts.d.mts +14 -0
- package/lib/utils/fetch-module-federation-dts.d.mts +2 -0
- package/lib/utils/index.d.mts +35 -0
- package/lib/utils/run.d.mts +2 -0
- package/lib/utils/seo.d.mts +2 -0
- package/lib/utils/svg-to-data-uri.d.mts +2 -0
- package/lib/utils/vts.d.mts +18 -0
- package/lib/vm/coverage.d.mts +2 -0
- package/lib/vm/docs.d.mts +7 -0
- package/lib/vm/example.d.mts +4 -0
- package/lib/vm/generate-doc.d.mts +1 -0
- package/lib/vm/info.d.mts +2 -0
- package/lib/vm/locales.d.mts +5 -0
- package/lib/vm/locales.mjs +1 -1
- package/lib/vm/modules.d.mts +2 -0
- package/lib/vm/render-app.d.mts +2 -0
- package/lib/vm/routes.d.mts +8 -0
- package/lib/vm/utils.d.mts +1 -0
- package/lib/worker/dts.d.mts +1 -0
- package/lib/worker/eslint.d.mts +1 -0
- package/lib/worker/react-compiler.d.mts +1 -0
- package/lib/worker/solid.d.mts +1 -0
- package/lib/worker/stylelint.d.mts +1 -0
- package/lib/worker/swc-minify.d.mts +1 -0
- package/package.json +5 -5
- package/typings/global.d.ts +13 -85
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type Compiler } from 'webpack';
|
|
2
|
+
export interface HtmlMeta {
|
|
3
|
+
[key: string]: string | undefined | HtmlMeta;
|
|
4
|
+
}
|
|
5
|
+
export interface HtmlPluginOption {
|
|
6
|
+
/**
|
|
7
|
+
* 网站图标
|
|
8
|
+
*/
|
|
9
|
+
favicon?: string | false;
|
|
10
|
+
/**
|
|
11
|
+
* 页面标题
|
|
12
|
+
*/
|
|
13
|
+
title?: string;
|
|
14
|
+
/**
|
|
15
|
+
* 模板文件
|
|
16
|
+
*/
|
|
17
|
+
template?: string;
|
|
18
|
+
/**
|
|
19
|
+
* 输出文件名
|
|
20
|
+
* @default index.html
|
|
21
|
+
*/
|
|
22
|
+
filename?: string | ((entryName: string) => string);
|
|
23
|
+
/**
|
|
24
|
+
* 注入位置
|
|
25
|
+
* @default head
|
|
26
|
+
*/
|
|
27
|
+
inject?: boolean | 'head' | 'body';
|
|
28
|
+
templateContent?: (options: HtmlPluginOption) => string;
|
|
29
|
+
/**
|
|
30
|
+
* 自定义额外的 tags, 当需要添加远程cdn时很有用
|
|
31
|
+
* */
|
|
32
|
+
tags?: {
|
|
33
|
+
/**
|
|
34
|
+
* 标签内容
|
|
35
|
+
*/
|
|
36
|
+
textContent?: string;
|
|
37
|
+
/** 标签
|
|
38
|
+
* @default script
|
|
39
|
+
*/
|
|
40
|
+
tag?: string;
|
|
41
|
+
inject?: 'body' | 'head';
|
|
42
|
+
[key: string]: string | null | boolean | number | undefined;
|
|
43
|
+
}[];
|
|
44
|
+
meta?: HtmlMeta;
|
|
45
|
+
}
|
|
46
|
+
export declare class HtmlPlugin {
|
|
47
|
+
private options;
|
|
48
|
+
private AddEntry;
|
|
49
|
+
private faviconPath;
|
|
50
|
+
private name;
|
|
51
|
+
private cachedMetaTags;
|
|
52
|
+
private cachedCustomTags;
|
|
53
|
+
constructor(options?: HtmlPluginOption);
|
|
54
|
+
apply(compiler: Compiler): void;
|
|
55
|
+
private generateDefaultTemplate;
|
|
56
|
+
private generateMetaTags;
|
|
57
|
+
private generateCustomTags;
|
|
58
|
+
private getAssets;
|
|
59
|
+
private injectAssets;
|
|
60
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Targets } from 'lightningcss';
|
|
2
|
+
import { type Compiler } from 'webpack';
|
|
3
|
+
type Filter = string | RegExp;
|
|
4
|
+
type Implementation = typeof import('lightningcss');
|
|
5
|
+
interface MinifyPluginOpts {
|
|
6
|
+
implementation?: Implementation;
|
|
7
|
+
sourceMap?: boolean;
|
|
8
|
+
test?: RegExp;
|
|
9
|
+
include?: Filter | Filter[];
|
|
10
|
+
exclude?: Filter | Filter[];
|
|
11
|
+
targets?: Targets;
|
|
12
|
+
}
|
|
13
|
+
export declare class LightningCssMinifyPlugin {
|
|
14
|
+
private readonly options;
|
|
15
|
+
private readonly transform;
|
|
16
|
+
constructor(opts?: MinifyPluginOpts);
|
|
17
|
+
apply(compiler: Compiler): void;
|
|
18
|
+
private transformAssets;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Buffer as s}from"node:buffer";import{transform as e}from"lightningcss";import i from"webpack";let t=new TextEncoder,o=i.sources.RawSource,n=i.sources.SourceMapSource,a=i.ModuleFilenameHelpers.matchObject,r="lightning-css-minify",m=/\.(c|le|sc|sa)ss(?:\?.*)?$/i;export class LightningCssMinifyPlugin{constructor(s={}){let{implementation:i,...t}=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??e,this.options=t}apply(s){let e=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(e)),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:e,formatFlag:i})=>s?e(i("minimized")):void 0)})})}async transformAssets(e){let{options:{devtool:i}}=e.compiler,{include:c,exclude:p,test:f,sourceMap:l=void 0===this.options.sourceMap?!!(i&&i.includes("source-map")):this.options.sourceMap,...u}=this.options,h=e.getCache(r),d=e.getAssets().filter(s=>!s.info.minimized&&(f||m).test(s.name)&&a({include:c,exclude:p},s.name));await Promise.
|
|
1
|
+
import{Buffer as s}from"node:buffer";import{transform as e}from"lightningcss";import i from"webpack";let t=new TextEncoder,o=i.sources.RawSource,n=i.sources.SourceMapSource,a=i.ModuleFilenameHelpers.matchObject,r="lightning-css-minify",m=/\.(c|le|sc|sa)ss(?:\?.*)?$/i;export class LightningCssMinifyPlugin{constructor(s={}){let{implementation:i,...t}=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??e,this.options=t}apply(s){let e=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(e)),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:e,formatFlag:i})=>s?e(i("minimized")):void 0)})})}async transformAssets(e){let{options:{devtool:i}}=e.compiler,{include:c,exclude:p,test:f,sourceMap:l=void 0===this.options.sourceMap?!!(i&&i.includes("source-map")):this.options.sourceMap,...u}=this.options,h=e.getCache(r),d=e.getAssets().filter(s=>!s.info.minimized&&(f||m).test(s.name)&&a({include:c,exclude:p},s.name));await Promise.allSettled(d.map(async i=>{let a,r=h.getItemCache(JSON.stringify(i.name),h.getLazyHashedEtag(i.source)),m=await r.getPromise();if(m&&m.minimized)return void e.updateAsset(i.name,m.source,{...i.info,minimized:!0});let c=i.source.source(),p="string"==typeof c?t.encode(c):c,f=this.transform({filename:i.name,code:p,minify:!0,sourceMap:l,...u}),d=s.from(f.code),g={source:a=l?new n(d,i.name,f.map||"",c,f.map||"",!0):new o(d),minimized:!0};await r.storePromise(g),e.updateAsset(i.name,a,{...i.info,minimized:!0})}))}}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Compiler } from 'webpack';
|
|
2
|
+
interface Icon {
|
|
3
|
+
src: string;
|
|
4
|
+
type: string;
|
|
5
|
+
sizes: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ManifestPluginOption {
|
|
8
|
+
filename: string;
|
|
9
|
+
id?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
version?: string;
|
|
12
|
+
short_name?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
start_url?: string;
|
|
15
|
+
display?: string;
|
|
16
|
+
background_color?: string;
|
|
17
|
+
theme_color?: string;
|
|
18
|
+
icons?: Icon[];
|
|
19
|
+
shortcuts?: {
|
|
20
|
+
name: string;
|
|
21
|
+
short_name: string;
|
|
22
|
+
description: string;
|
|
23
|
+
url: string;
|
|
24
|
+
icons: Icon[];
|
|
25
|
+
}[];
|
|
26
|
+
screenshots?: {
|
|
27
|
+
src: string;
|
|
28
|
+
type: string;
|
|
29
|
+
sizes: string;
|
|
30
|
+
form_factor: string;
|
|
31
|
+
}[];
|
|
32
|
+
content_assets?: string[];
|
|
33
|
+
[key: string]: unknown;
|
|
34
|
+
}
|
|
35
|
+
export declare function generateManifest(override: Partial<ManifestPluginOption>, hash?: string, content_assets?: string[]): ManifestPluginOption & Partial<ManifestPluginOption> & {
|
|
36
|
+
version: string;
|
|
37
|
+
hash: string | undefined;
|
|
38
|
+
content_assets: string[] | undefined;
|
|
39
|
+
};
|
|
40
|
+
export declare class ManifestPlugin {
|
|
41
|
+
private name;
|
|
42
|
+
private options;
|
|
43
|
+
constructor(options?: Partial<ManifestPluginOption>);
|
|
44
|
+
apply(compiler: Compiler): void;
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Resolver } from 'webpack';
|
|
2
|
+
export interface OverrideResolverOption {
|
|
3
|
+
/** 源文件夹地址
|
|
4
|
+
* @default src 默认
|
|
5
|
+
* @default site 组件库
|
|
6
|
+
*/
|
|
7
|
+
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
|
+
override?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare class OverrideResolverPlugin {
|
|
22
|
+
private readonly options;
|
|
23
|
+
constructor(options: Required<OverrideResolverOption>);
|
|
24
|
+
apply(resolver: Resolver): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { LinterOptions } from '@moneko/stylelint';
|
|
2
|
+
import { type Compiler } from 'webpack';
|
|
3
|
+
export interface StylelintOption extends LinterOptions {
|
|
4
|
+
files: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare class StylelintPlugin {
|
|
7
|
+
private name;
|
|
8
|
+
private worker;
|
|
9
|
+
private options;
|
|
10
|
+
constructor(options?: StylelintOption);
|
|
11
|
+
apply(compiler: Compiler): void;
|
|
12
|
+
private report;
|
|
13
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{minify as e}from"@swc/core";import s from"webpack";let o=s.sources.SourceMapSource;export class SwcMinifyPlugin{constructor(e){this.name="SwcMinifyPlugin",this.options={format:{comments:!1},ecma:2015,compress:{drop_console:!0,drop_debugger:!0,global_defs:{"@alert":"console.log"},pure_funcs:["console.log","console.warn","console.error","console.info"],ecma:2015,toplevel:!1,module:!1,ie8:!1,keep_classnames:void 0,keep_fnames:!1,top_retain:[],keep_infinity:!0},mangle:!0,sourceMap:!0,...e}}apply(t){t.hooks.compilation.tap(this.name,t=>{t.hooks.processAssets.tapAsync({name:this.name,stage:s.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,additionalAssets:!0},async(s,i)=>{let a=t.getCache(this.name),n=Object.keys(s).filter(e=>e.endsWith(".js")&&!e.endsWith(".min.js"));try{await Promise.
|
|
1
|
+
import{minify as e}from"@swc/core";import s from"webpack";let o=s.sources.SourceMapSource;export class SwcMinifyPlugin{constructor(e){this.name="SwcMinifyPlugin",this.options={format:{comments:!1},ecma:2015,compress:{drop_console:!0,drop_debugger:!0,global_defs:{"@alert":"console.log"},pure_funcs:["console.log","console.warn","console.error","console.info"],ecma:2015,toplevel:!1,module:!1,ie8:!1,keep_classnames:void 0,keep_fnames:!1,top_retain:[],keep_infinity:!0},mangle:!0,sourceMap:!0,...e}}apply(t){t.hooks.compilation.tap(this.name,t=>{t.hooks.processAssets.tapAsync({name:this.name,stage:s.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,additionalAssets:!0},async(s,i)=>{let a=t.getCache(this.name),n=Object.keys(s).filter(e=>e.endsWith(".js")&&!e.endsWith(".min.js"));try{await Promise.allSettled(n.map(async s=>{let i=t.getAsset(s);if(!i||i.info.minimized)return;let n=a.getItemCache(JSON.stringify(i.name),a.getLazyHashedEtag(i.source)),r=await n.getPromise();if(r&&r.minimized)return void t.updateAsset(i.name,r.source,{...i.info,minimized:!0});let c=i.source.sourceAndMap();try{let s=await e(c.source.toString().replace(/\r\n/g,"\n"),this.options),a={sources:[i.name]};s.map&&((a=JSON.parse(s.map)).sources=[i.name],delete a.sourcesContent);let r={source:new o(s.code,i.name,a||"",c.source,c.map||"",!0),minimized:!0};await n.storePromise(r),t.updateAsset(i.name,r.source,{...i.info,minimized:!0})}catch(e){t.errors.push(e)}})),i()}catch(e){i(e)}})})}}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Compiler, WebpackPluginInstance } from 'webpack';
|
|
2
|
+
export interface VirtualModulePluginOption {
|
|
3
|
+
[key: string]: string | object;
|
|
4
|
+
}
|
|
5
|
+
export declare class VirtualModuleWebpackPlugin implements WebpackPluginInstance {
|
|
6
|
+
private virtualModules;
|
|
7
|
+
private options;
|
|
8
|
+
private init;
|
|
9
|
+
constructor(options?: VirtualModulePluginOption);
|
|
10
|
+
private modify;
|
|
11
|
+
apply(compiler: Compiler): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AppType, Framework } from './index.mjs';
|
|
2
|
+
export declare const IS_WINDOW: boolean;
|
|
3
|
+
export declare const APPTYPE: AppType;
|
|
4
|
+
export declare const FRAMEWORK: Framework;
|
|
5
|
+
export declare const NODE_ENV: string;
|
|
6
|
+
export declare const isLibrary: boolean;
|
|
7
|
+
export declare const isMicro: boolean;
|
|
8
|
+
export declare const isMobile: boolean;
|
|
9
|
+
export declare const isReact: boolean;
|
|
10
|
+
export declare const isSolid: boolean;
|
|
11
|
+
export declare const SSR: boolean;
|
|
12
|
+
/** 项目主要文件夹 */
|
|
13
|
+
export declare const mainDirectory: 'site' | 'src';
|
|
14
|
+
export declare const jsxImportSource: string;
|
|
15
|
+
export declare const framework: 'react' | 'solid-js';
|
|
16
|
+
export declare const frameworkVersionStr: string;
|
|
17
|
+
export declare const frameworkVersion: number;
|
|
18
|
+
export declare const packageJson: typeof import('package.json');
|
|
19
|
+
/** 应用名称 */
|
|
20
|
+
export declare const PACKAGENAME: string;
|
|
21
|
+
/** core 包名 */
|
|
22
|
+
export declare const coreName: string;
|
|
23
|
+
/** 是否为本地开发环境 */
|
|
24
|
+
export declare const isDev: boolean;
|
|
25
|
+
export declare const refresh: boolean;
|
|
26
|
+
export declare const isCI: boolean;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
interface CompilerDtsOption {
|
|
3
|
+
extends?: string;
|
|
4
|
+
compilerOptions?: ts.CompilerOptions;
|
|
5
|
+
include?: string[];
|
|
6
|
+
}
|
|
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
|
+
*/
|
|
22
|
+
export declare function compileDts(config: CompilerDtsOption): string;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 根据ts内容生成声明类型
|
|
3
|
+
* @param {String} source 源码内容
|
|
4
|
+
* @param {String} filename 文件名
|
|
5
|
+
* @returns {String} declaration
|
|
6
|
+
*/
|
|
7
|
+
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
|
+
*/
|
|
14
|
+
export declare function getExportKeys(source: string, filename: string): string[];
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 将字符串转换为小驼峰命名
|
|
3
|
+
* @param {string} str 需要转换的字符串
|
|
4
|
+
* @returns {string} 转换后的小驼峰命名字符串
|
|
5
|
+
* @example
|
|
6
|
+
* toCamelCase('hello-world') // 'helloWorld'
|
|
7
|
+
* toCamelCase('foo-bar') // 'fooBar'
|
|
8
|
+
*/
|
|
9
|
+
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
|
+
export declare function convertToCamelCase(name: string): string;
|
|
19
|
+
type ProgramPath<T extends string> = `${T extends string ? T : string}`;
|
|
20
|
+
/** 位于项目根目录下的位置
|
|
21
|
+
* @param {string} src 路径
|
|
22
|
+
* @returns {string} 位于项目根目录下的位置
|
|
23
|
+
*/
|
|
24
|
+
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
|
+
export declare function node_modules<T extends string>(name: T): `node_modules/${T}`;
|
|
30
|
+
export declare function isObject(target: unknown): target is object;
|
|
31
|
+
type AnyFunction = (...a: any[]) => any;
|
|
32
|
+
export declare function isFunction<T>(target: T): target is T & AnyFunction;
|
|
33
|
+
export declare function transformModule(obj: object | string): string;
|
|
34
|
+
export declare function empty(): void;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface VfsOptions {
|
|
2
|
+
namedExport?: boolean;
|
|
3
|
+
modules: Record<string, any>;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* 运行 ts 代码
|
|
7
|
+
* @param {String} filepath 文件名
|
|
8
|
+
* @returns {String} declaration
|
|
9
|
+
* @example
|
|
10
|
+
* // a.ts
|
|
11
|
+
* export default { user: 'admin' } as { user: 'admin' };
|
|
12
|
+
* // b.js
|
|
13
|
+
* const a = vts('fullpath/a.ts');
|
|
14
|
+
*
|
|
15
|
+
* console.log(a); // { user: 'admin' }
|
|
16
|
+
*/
|
|
17
|
+
export declare function vts<T>(filepath: string, options?: VfsOptions): T;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import ReactiveObject from '../commom/reactive-object.mjs';
|
|
2
|
+
export declare const docsModuleName: string;
|
|
3
|
+
export declare const docsModulePkgJson: string;
|
|
4
|
+
export declare const docsModuleMeta: string;
|
|
5
|
+
export declare const docs: ReactiveObject<Record<string, string>>;
|
|
6
|
+
export declare const comment: ReactiveObject<Record<string, string>>;
|
|
7
|
+
export declare const getCommentPath: (file: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function generateDoc(content: string, path: string): string;
|
package/lib/vm/locales.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{basename as e,join as t}from"node:path";import{directoryExists as a,scanFolderSync as o}from"@moneko/utils";import{watch as l}from"chokidar";import r from"../commom/log.mjs";import n from"../commom/parse-module-meta.mjs";import c from"../commom/reactive-object.mjs";import s from"../commom/require.mjs";import i from"../commom/sigint-exit.mjs";import{CONFIG as g}from"../config.mjs";import{FRAMEWORK as m,isDev as u}from"../process-env.mjs";let p={react:'import sso from "shared-store-object";',solid:'import { createEffect, createRoot, getOwner } from "solid-js";import { createStore } from "solid-js/store";'},f={react:'let storageKey="localizable.language",language=localStorage.getItem(storageKey)||navigator.language,{translation:a,...defaultLocale}=Object.assign({title:"简体中文",language:navigator.language,translation:{}},resources[language]||resources[navigator.language]),localizable=sso({lang:defaultLocale,t:a});export function setLang(a){let{translation:e,...l}=resources[a]||{};e&&(localizable.lang=l,localizable.t=e,localStorage.setItem(storageKey,l.language))}export default localizable;',solid:'let locale=createRoot(()=>{let e="localizable.language",a=localStorage.getItem(e)||navigator.language,{translation:l,...o}=Object.assign({title:"简体中文",language:navigator.language,translation:{}},resources[a]||resources[navigator.language]),[n,c]=createStore({lang:o,t:l});return createEffect(()=>{let a=resources[n.lang.language]?.translation;a&&(c("t",a),localStorage.setItem(e,n.lang.language))}),{localizable:n,setLocalizable:c,setLang:function(e){let{translation:a,...l}=resources[e]||{};a&&c("lang",l)}}},getOwner());export const setLocalizable=locale.setLocalizable;export const t=locale.localizable.t;export const lang=locale.localizable.lang;export const setLang=locale.setLang;'}[m];function d(e,t){return`${p[m]}
|
|
2
|
-
export function template(r,n){return r.replace(/\\\${\\w+}/g,function(r){var t=r.slice(2,-1);var e=n[t];return e!==void 0?e.toString():""})}function deepFreeze(o) { const p = Reflect.ownKeys(o);for (const k of p) {const v = o[k];if ((v && typeof v === "object") || typeof v === "function") {deepFreeze(v);}}return Object.freeze(o);}export const locales = ${JSON.stringify(e)};const _res = ${JSON.stringify(t)};const resources = deepFreeze(_res);${f}`}let b=n("@app/locales");export const localesModuleName=b.file;export const locales=new c({[localesModuleName]:d([],{}),[b.pkg]:b.meta});let j={};async function v(t,a){let o=e(t).replace(/\.[^.]+$/,"");try{"deleted"===a?delete j[o]:(delete s.cache[t],Object.assign(j,{[o]:s(t).default}));let e=[],l={};for(let t in j)if(Object.prototype.hasOwnProperty.call(j,t)){let{language:a=o,title:r=a,icon:n,translation:c={}}=j[t];e.push({language:a,title:r,icon:n}),l[a]={language:a,title:r,icon:n,translation:c}}locales.setData(localesModuleName,d(e,l)),locales.setData(b.pkg,b.meta)}catch(e){r(e)}}let z=t(g.alias["@"],"./locales");if(a(z)&&!1!==g.htmlPluginOption){let e=o(z,[".ts$"]).filter(e=>!/^\..*|\.d\.ts$/.test(e));await Promise.
|
|
2
|
+
export function template(r,n){return r.replace(/\\\${\\w+}/g,function(r){var t=r.slice(2,-1);var e=n[t];return e!==void 0?e.toString():""})}function deepFreeze(o) { const p = Reflect.ownKeys(o);for (const k of p) {const v = o[k];if ((v && typeof v === "object") || typeof v === "function") {deepFreeze(v);}}return Object.freeze(o);}export const locales = ${JSON.stringify(e)};const _res = ${JSON.stringify(t)};const resources = deepFreeze(_res);${f}`}let b=n("@app/locales");export const localesModuleName=b.file;export const locales=new c({[localesModuleName]:d([],{}),[b.pkg]:b.meta});let j={};async function v(t,a){let o=e(t).replace(/\.[^.]+$/,"");try{"deleted"===a?delete j[o]:(delete s.cache[t],Object.assign(j,{[o]:s(t).default}));let e=[],l={};for(let t in j)if(Object.prototype.hasOwnProperty.call(j,t)){let{language:a=o,title:r=a,icon:n,translation:c={}}=j[t];e.push({language:a,title:r,icon:n}),l[a]={language:a,title:r,icon:n,translation:c}}locales.setData(localesModuleName,d(e,l)),locales.setData(b.pkg,b.meta)}catch(e){r(e)}}let z=t(g.alias["@"],"./locales");if(a(z)&&!1!==g.htmlPluginOption){let e=o(z,[".ts$"]).filter(e=>!/^\..*|\.d\.ts$/.test(e));await Promise.allSettled(e.map(e=>v(e,"added"))),u&&function(e,t){let a=l(e,{ignored:t,persistent:!0,ignoreInitial:!0});function o(){a.unwatch(e),a.close()}a.on("add",e=>{v(e,"added")}),a.on("change",e=>{v(e,"change")}),a.on("unlink",e=>{v(e,"deleted")}),a.once("ready",()=>{u||o()}),i(o)}(z,[/^\..*/,/!\.ts$/,/\.d\.ts$/])}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import ReactiveObject from '../commom/reactive-object.mjs';
|
|
2
|
+
export declare const routesModuleName: string;
|
|
3
|
+
export declare const routesModulePkgJson: string;
|
|
4
|
+
export declare const routesModuleMeta: string;
|
|
5
|
+
export declare const route: ReactiveObject<{
|
|
6
|
+
[x: string]: string;
|
|
7
|
+
}>;
|
|
8
|
+
export declare function generatorRouter(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function watchFiles(root: string, ignored?: RegExp, call?: VoidFunction): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ESLintWorkerMessage = [warnings: string, errors: string];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type StylelintWorkerMessage = [warnings: string, errors: string];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.55.
|
|
3
|
+
"version": "3.55.3-beta.1",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -111,10 +111,10 @@
|
|
|
111
111
|
"@moneko/convert": "1.1.3",
|
|
112
112
|
"@moneko/eslint": "1.9.3",
|
|
113
113
|
"@moneko/mdx": "0.1.44",
|
|
114
|
-
"@moneko/raw-import": "0.0
|
|
114
|
+
"@moneko/raw-import": "1.0.0",
|
|
115
115
|
"@moneko/request": "1.6.2",
|
|
116
116
|
"@moneko/stylelint": "1.5.0",
|
|
117
|
-
"@moneko/transform-imports": "1.0.
|
|
117
|
+
"@moneko/transform-imports": "1.0.1",
|
|
118
118
|
"@moneko/utils": "0.3.3",
|
|
119
119
|
"@swc/core": "1.13.5",
|
|
120
120
|
"browserslist": "4.26.2",
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"less-loader": "12.3.0",
|
|
127
127
|
"lightningcss": "1.30.1",
|
|
128
128
|
"marked-completed": "1.2.14",
|
|
129
|
-
"memfs": "4.
|
|
129
|
+
"memfs": "4.43.0",
|
|
130
130
|
"mini-css-extract-plugin": "2.9.4",
|
|
131
131
|
"style-loader": "4.0.0",
|
|
132
132
|
"swc-loader": "0.2.6",
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
"@types/stylis": "4.2.7",
|
|
142
142
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
|
143
143
|
"@types/webpack-hot-middleware": "2.25.10",
|
|
144
|
-
"sass": "1.
|
|
144
|
+
"sass": "1.93.1",
|
|
145
145
|
"sass-loader": "16.0.5",
|
|
146
146
|
"solid-refresh": "0.7.5",
|
|
147
147
|
"stylis": "4.3.6",
|
package/typings/global.d.ts
CHANGED
|
@@ -14,24 +14,23 @@ import type {
|
|
|
14
14
|
SourceMapDevToolPlugin,
|
|
15
15
|
} from 'webpack';
|
|
16
16
|
|
|
17
|
-
import type {
|
|
18
|
-
CssInJsMinifyOption,
|
|
19
|
-
HtmlPluginOption,
|
|
20
|
-
JsxDomExpressions,
|
|
21
|
-
CompressionPluginOptions,
|
|
22
|
-
OptimizationSplitChunksOptions,
|
|
23
|
-
OverrideResolverOption,
|
|
24
|
-
ProxyConfig,
|
|
25
|
-
ReactCompilerOption,
|
|
26
|
-
VirtualModulePluginOption,
|
|
27
|
-
} from '../lib/index.mjs';
|
|
28
17
|
import type { CopyPluginOption } from '../lib/plugin/copy.mjs';
|
|
29
18
|
import type { DonePluginOption } from '../lib/plugin/done.mjs';
|
|
30
19
|
import type { ManifestPluginOption } from '../lib/plugin/manifest.mjs';
|
|
31
20
|
|
|
32
|
-
import type { BundleAnalyzerOption } from './bundle-analyzer.d';
|
|
33
|
-
import type { ESLintOption } from '../lib/plugin/eslint.
|
|
34
|
-
import type { StylelintOption } from '../lib/plugin/stylelint.
|
|
21
|
+
import type { BundleAnalyzerOption } from './bundle-analyzer.d.ts';
|
|
22
|
+
import type { ESLintOption } from '../lib/plugin/eslint.mjs';
|
|
23
|
+
import type { StylelintOption } from '../lib/plugin/stylelint.mjs';
|
|
24
|
+
import type { SwcImportOnDemandTransform } from '../lib/commom/transfer-import-on-demand.mjs';
|
|
25
|
+
import type { CssInJsMinifyOption } from '../lib/loader/css-in-js-minify.cjs';
|
|
26
|
+
import type { ReactCompilerOption } from '../lib/loader/react-compiler.cjs';
|
|
27
|
+
import type { CompressionPluginOptions } from '../lib/plugin/compression.mjs';
|
|
28
|
+
import type { JsxDomExpressions } from '../lib/options/jsx-dom-expressions.mjs';
|
|
29
|
+
import type { ProxyConfig } from '../lib/dev/proxy.mjs';
|
|
30
|
+
import type { VirtualModulePluginOption } from '../lib/plugin/virtual-module.mjs';
|
|
31
|
+
import type { OverrideResolverOption } from '../lib/plugin/override-resolve.mjs';
|
|
32
|
+
import type { OptimizationSplitChunksOptions } from '../lib/options/split-chunk.mjs';
|
|
33
|
+
import type { HtmlPluginOption } from '../lib/plugin/html-plugin.mjs';
|
|
35
34
|
|
|
36
35
|
export type { MiniCssExtractPluginOptions, SwcMinifyOptions, TerserMinifyOptions };
|
|
37
36
|
export type MinifierType = 'swc' | 'terser';
|
|
@@ -688,75 +687,4 @@ export declare interface SharedConfig {
|
|
|
688
687
|
|
|
689
688
|
export type SourceMapDevToolPluginOptions = ConstructorParameters<typeof SourceMapDevToolPlugin>[0];
|
|
690
689
|
|
|
691
|
-
export type MemberTransformer =
|
|
692
|
-
/** 帕斯卡拼写法(大驼峰): 所有单词的首字母大写,然后直接连接起来,单词之间没有连接符 */
|
|
693
|
-
| 'pascal_case'
|
|
694
|
-
/** 骆驼拼写法(小驼峰): 第一个单词的首字母小写, 后续所有单词的首字母大写,然后直接连接起来,单词之间没有连接符 */
|
|
695
|
-
| 'camel_case'
|
|
696
|
-
/** 连字符拼写法: 各个单词或缩写之间以`-`做间隔 */
|
|
697
|
-
| 'kebab_case'
|
|
698
|
-
/** 破折号式: 每个单词全小写或全大写,多单词使用`-`隔开 */
|
|
699
|
-
| 'dashed_case'
|
|
700
|
-
/** 蛇形命名: 每个单词全小写或全大写,多单词使用`_`隔开 */
|
|
701
|
-
| 'snake_case'
|
|
702
|
-
/** 大写 */
|
|
703
|
-
| 'upper_case'
|
|
704
|
-
/** 最后大写 */
|
|
705
|
-
| 'upper_first'
|
|
706
|
-
/** 小写 */
|
|
707
|
-
| 'lower_case'
|
|
708
|
-
/** 最后小写 */
|
|
709
|
-
| 'lower_first';
|
|
710
|
-
|
|
711
|
-
export type SwcImportOnDemandTransform = Record<
|
|
712
|
-
/** 库名 */
|
|
713
|
-
string,
|
|
714
|
-
{
|
|
715
|
-
/** 要使用的库名称,而不是导入语句中指定的库名称。`${member}` 是替换的成员
|
|
716
|
-
* @example
|
|
717
|
-
* ```javascript
|
|
718
|
-
* const conf = {
|
|
719
|
-
* importOnDemand: {
|
|
720
|
-
* 'antd': {
|
|
721
|
-
* transform: 'es/${member}',
|
|
722
|
-
* memberTransformers: ['dashed_case']
|
|
723
|
-
* }
|
|
724
|
-
* }
|
|
725
|
-
* }
|
|
726
|
-
* // 以下代码将会按照预期进行转换
|
|
727
|
-
* import { Button } from 'antd';
|
|
728
|
-
* // to
|
|
729
|
-
* import Button from 'antd/es/button'
|
|
730
|
-
* ```
|
|
731
|
-
*/
|
|
732
|
-
transform: string;
|
|
733
|
-
/** 默认值:`false`, 设置转换时需要单独导入的样式,`${member}` 是替换的成员
|
|
734
|
-
* @example
|
|
735
|
-
* ```javascript
|
|
736
|
-
* const conf = {
|
|
737
|
-
* importOnDemand: {
|
|
738
|
-
* antd: {
|
|
739
|
-
* transform: 'es/${member}',
|
|
740
|
-
* style: 'es/${member}/style',
|
|
741
|
-
* memberTransformers: ['dashed_case']
|
|
742
|
-
* }
|
|
743
|
-
* }
|
|
744
|
-
* }
|
|
745
|
-
* // 以下代码将会按照预期进行转换
|
|
746
|
-
* import { BackTop } from 'antd';
|
|
747
|
-
* // to
|
|
748
|
-
* import BackTop from 'antd/es/back-top';
|
|
749
|
-
* import 'antd/es/back-top/style';
|
|
750
|
-
* ```
|
|
751
|
-
*/
|
|
752
|
-
style?: string | boolean;
|
|
753
|
-
/** 默认值:`false`, 当设置为true时,将保留 `import { Button }` 语法,而不是转换为 `import Button` */
|
|
754
|
-
skipDefaultConversion?: boolean;
|
|
755
|
-
/** 默认值:`true`, 当遇到会导致导入整个模块时,是否抛出 */
|
|
756
|
-
preventFullImport?: boolean;
|
|
757
|
-
/** 默认值:`[]`, 成员转换规则 */
|
|
758
|
-
memberTransformers?: MemberTransformer[];
|
|
759
|
-
}
|
|
760
|
-
>;
|
|
761
|
-
|
|
762
690
|
export {};
|