@moneko/core 3.55.4 → 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.
- package/lib/bin/build-app.d.mts +16 -0
- package/lib/bin/build.d.mts +2 -0
- 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/pin.d.mts +6 -0
- package/lib/bin/pure-lint.d.mts +2 -0
- 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/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/check-npm.d.mts +4 -0
- package/lib/commom/corepack.d.mts +11 -0
- package/lib/commom/css-in-js-minify.d.mts +13 -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/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 +3 -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.d.cts +29 -0
- 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/split-chunk.d.mts +4 -0
- package/lib/options/swcrc.d.mts +10 -0
- package/lib/plugin/compression.d.mts +15 -0
- package/lib/plugin/copy.d.mts +30 -0
- 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/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/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/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/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/css-in-js-minify.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 +2 -2
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import http, { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
+
export declare function cacheBody(req: RequestFormData & {
|
|
3
|
+
_bodyCached?: boolean;
|
|
4
|
+
_dataChunks?: Uint8Array[];
|
|
5
|
+
}): void;
|
|
6
|
+
export interface RequestFormData extends IncomingMessage {
|
|
7
|
+
files?: {
|
|
8
|
+
fieldname: string;
|
|
9
|
+
originalname: string;
|
|
10
|
+
encoding: string;
|
|
11
|
+
mimetype: string;
|
|
12
|
+
buffer: Buffer;
|
|
13
|
+
size: number;
|
|
14
|
+
}[];
|
|
15
|
+
params?: Record<string, string>;
|
|
16
|
+
query?: Record<string, string>;
|
|
17
|
+
body?: Promise<BodyInit | null>;
|
|
18
|
+
}
|
|
19
|
+
export interface MockServerResponse extends ServerResponse<IncomingMessage> {
|
|
20
|
+
req: IncomingMessage;
|
|
21
|
+
send<T>(chunk: T): ReturnType<ServerResponse<IncomingMessage>['end']>;
|
|
22
|
+
}
|
|
23
|
+
export type ProxyFuncType = (req: RequestFormData, res: MockServerResponse) => void | Promise<void>;
|
|
24
|
+
export type MockConfiguration = Record<string, ProxyFuncType | Record<string, any> | null>;
|
|
25
|
+
export type YApiOptionBySchema = {
|
|
26
|
+
/** YApi host */
|
|
27
|
+
host: string;
|
|
28
|
+
/** 接口id */
|
|
29
|
+
id: string;
|
|
30
|
+
/** YApi开放接口token */
|
|
31
|
+
token: string;
|
|
32
|
+
};
|
|
33
|
+
type Any = any;
|
|
34
|
+
/**
|
|
35
|
+
* 通过 YApi 接口对应的响应JSON Schema生成默认的数据
|
|
36
|
+
* @param {YApiOptionBySchema} option Schema
|
|
37
|
+
* @param {T} data data
|
|
38
|
+
* @returns {Promise} mockData
|
|
39
|
+
*/
|
|
40
|
+
export declare const yApiSchemaMock: <T extends Any>(option: YApiOptionBySchema, data?: T) => Promise<T>;
|
|
41
|
+
export type YApiOption = {
|
|
42
|
+
/** YApi host */
|
|
43
|
+
host: string;
|
|
44
|
+
/** YApi 项目ID */
|
|
45
|
+
projectId: number;
|
|
46
|
+
/** 重写请求路径, 例如:'^/api/' */
|
|
47
|
+
pathRewrite: string;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* 请求YApi高级mock接口数据
|
|
51
|
+
* @param {RequestFormData} req req
|
|
52
|
+
* @param {YApiOption} yapi YApiOption
|
|
53
|
+
* @returns {Promise} data
|
|
54
|
+
*/
|
|
55
|
+
export declare const yApiMock: (req: RequestFormData, yapi: YApiOption) => Promise<Any>;
|
|
56
|
+
export interface MockPluginOptions {
|
|
57
|
+
directory: string;
|
|
58
|
+
}
|
|
59
|
+
export declare const oldMock: MockConfiguration;
|
|
60
|
+
export declare let nextMock: MockConfiguration;
|
|
61
|
+
export declare function containMockUrl(url: string): string | undefined;
|
|
62
|
+
declare const setupMock: (options: MockPluginOptions) => ((req: RequestFormData, res: ServerResponse<IncomingMessage> & {
|
|
63
|
+
req: IncomingMessage;
|
|
64
|
+
}) => boolean | (http.ServerResponse<http.IncomingMessage> & {
|
|
65
|
+
req: IncomingMessage;
|
|
66
|
+
})) | undefined;
|
|
67
|
+
export default setupMock;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
+
type ProxyItem = {
|
|
3
|
+
target: string;
|
|
4
|
+
changeOrigin?: boolean;
|
|
5
|
+
secure?: boolean;
|
|
6
|
+
ws?: boolean;
|
|
7
|
+
pathRewrite?: Record<string, string>;
|
|
8
|
+
headers?: Record<string, string>;
|
|
9
|
+
};
|
|
10
|
+
export type ProxyConfig = Record<string, string | ProxyItem>;
|
|
11
|
+
type IServerResponse = ServerResponse<IncomingMessage> & {
|
|
12
|
+
req: IncomingMessage;
|
|
13
|
+
};
|
|
14
|
+
export declare function setupProxy(req: IncomingMessage, res: IServerResponse, proxyConfig: ProxyConfig): Promise<IServerResponse | false>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { createReadStream, existsSync } from 'node:fs';
|
|
2
|
+
import { type IncomingMessage, type Server as HttpServer, type ServerResponse } from 'node:http';
|
|
3
|
+
import { type Server as HttpsServer } from 'node:https';
|
|
4
|
+
import type { OutputFileSystem } from 'webpack';
|
|
5
|
+
import { type CertOption } from '../dev/get-cert.mjs';
|
|
6
|
+
export type FileSystem = OutputFileSystem & {
|
|
7
|
+
existsSync: typeof existsSync;
|
|
8
|
+
createReadStream: typeof createReadStream;
|
|
9
|
+
};
|
|
10
|
+
type HttpServerResponse = ServerResponse<IncomingMessage> & {
|
|
11
|
+
req: IncomingMessage;
|
|
12
|
+
};
|
|
13
|
+
interface ServerOption {
|
|
14
|
+
port: number;
|
|
15
|
+
root_dir: string;
|
|
16
|
+
fileSystem: FileSystem;
|
|
17
|
+
onRequest?(req: IncomingMessage, res: HttpServerResponse): boolean | void;
|
|
18
|
+
headers?: Record<string, string>;
|
|
19
|
+
basename?: string;
|
|
20
|
+
https?: CertOption | boolean;
|
|
21
|
+
host: string;
|
|
22
|
+
open?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export type Server = HttpServer | HttpsServer;
|
|
25
|
+
declare function server(option: ServerOption): Promise<Server>;
|
|
26
|
+
export default server;
|
package/lib/dev.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/index.d.mts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type * from '../typings/global.js';
|
|
2
|
+
export type { cssInJsMinify, CssInJsMinifyOption } from './commom/css-in-js-minify.mjs';
|
|
3
|
+
export { default as hasPkg } from './commom/has-pkg.mjs';
|
|
4
|
+
export { getIPv4, getPort } from './commom/net.mjs';
|
|
5
|
+
export { default as open } from './commom/open.mjs';
|
|
6
|
+
export { default as parseArgs } from './commom/parse-args.mjs';
|
|
7
|
+
export { CUSTOMCONFIG, default as paths, routeDir, yarnArgv } from './commom/paths.mjs';
|
|
8
|
+
export { default as printLog } from './commom/print-log.mjs';
|
|
9
|
+
export { default as require } from './commom/require.mjs';
|
|
10
|
+
export { default as Rule } from './commom/rule.mjs';
|
|
11
|
+
export { default as timer } from './commom/timer.mjs';
|
|
12
|
+
export { type MockConfiguration, type ProxyFuncType, type RequestFormData, yApiMock, type YApiOption, type YApiOptionBySchema, yApiSchemaMock, } from './dev/mock.mjs';
|
|
13
|
+
export type { ProxyConfig } from './dev/proxy.mjs';
|
|
14
|
+
export type { ReactCompilerOption } from './loader/react-compiler.cjs';
|
|
15
|
+
export { type JsxDomExpressions, default as jsxDomExpressions, } from './options/jsx-dom-expressions.mjs';
|
|
16
|
+
export { type OptimizationSplitChunksOptions, default as splitChunk, } from './options/split-chunk.mjs';
|
|
17
|
+
export type { CompressionPluginOptions } from './plugin/compression.mjs';
|
|
18
|
+
export type { HtmlMeta, HtmlPluginOption } from './plugin/html-plugin.mjs';
|
|
19
|
+
export type { OverrideResolverOption } from './plugin/override-resolve.mjs';
|
|
20
|
+
export type { VirtualModulePluginOption } from './plugin/virtual-module.mjs';
|
|
21
|
+
export { APPTYPE, coreName, FRAMEWORK, isCI, isDev, isLibrary, isMicro, mainDirectory, packageJson, PACKAGENAME, } from './process-env.mjs';
|
|
22
|
+
export { resolveProgram, toCamelCase } from './utils/index.mjs';
|
|
23
|
+
export type { MdxOptions } from '@moneko/mdx';
|
|
24
|
+
export * from '@moneko/utils';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type Config, type ConfigRuleSettings, type CoreRules, type CosmiconfigResult, type CssSyntaxError, type CustomSyntax, type DisabledRange, type DisabledRangeObject, type DisabledWarning, type DisableOptions, type DisableOptionsReport, type DisablePropertyName, type DisableReportRange, type EditInfo, type FixCallback, type FixMode, type FixObject, type Formatter, type FormatterType, type GetLintSourceOptions, type GetPostcssOptions, type InternalApi, type LinterOptions, type LinterResult, type LintResult, type LonghandSubPropertiesOfShorthandProperties, type Plugin, type PostcssPluginOptions, type PostcssResult, type Problem, type Processor, type PublicApi, type Range, type Rule, type RuleBase, type RuleContext, type RuleMessage, type RuleMessages, type RuleMeta, type RuleOptions, type RuleOptionsPossible, type Severity, type ShorthandProperties, stylelint, type StylelintPostcssResult, type Utils, type Warning, type WarningOptions, } from '@moneko/stylelint';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { LoaderContext } from 'webpack';
|
|
2
|
+
import type { CssInJsMinifyOption } from '../commom/css-in-js-minify.mjs' with { 'resolution-mode': 'import' };
|
|
3
|
+
export default function cssInJsMinifyLoader(this: LoaderContext<CssInJsMinifyOption>, sourceCode: string): Promise<void>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { LoaderContext } from 'webpack';
|
|
2
|
+
import type { LightningCssLoaderOption } from './loader.cjs';
|
|
3
|
+
export interface CssImport {
|
|
4
|
+
icss?: boolean;
|
|
5
|
+
importName: string;
|
|
6
|
+
url: string;
|
|
7
|
+
type?: 'url' | string;
|
|
8
|
+
index?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface CssExport {
|
|
11
|
+
name: string;
|
|
12
|
+
value: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ApiParam {
|
|
15
|
+
url?: string;
|
|
16
|
+
importName?: string;
|
|
17
|
+
layer?: string;
|
|
18
|
+
supports?: string;
|
|
19
|
+
media?: string;
|
|
20
|
+
dedupe?: boolean;
|
|
21
|
+
index?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface ApiReplacement {
|
|
24
|
+
replacementName: string;
|
|
25
|
+
localName?: string;
|
|
26
|
+
importName: string;
|
|
27
|
+
needQuotes?: boolean;
|
|
28
|
+
hash?: string;
|
|
29
|
+
}
|
|
30
|
+
export declare function getImportCode(imports: CssImport[], options: LightningCssLoaderOption): string;
|
|
31
|
+
export declare function getModuleCode(result: {
|
|
32
|
+
map: void | Uint8Array;
|
|
33
|
+
css: string;
|
|
34
|
+
}, api: ApiParam[], replacements: ApiReplacement[], options: LightningCssLoaderOption, loaderContext: LoaderContext<LightningCssLoaderOption>): string;
|
|
35
|
+
export declare function getExportCode(exports: CssExport[], replacements: ApiReplacement[], options: LightningCssLoaderOption): string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type CustomAtRules, type TransformOptions } from 'lightningcss';
|
|
2
|
+
import type { LoaderContext } from 'webpack';
|
|
3
|
+
type ExportLocalsConvention = 'asIs' | 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly' | ((name: string) => string);
|
|
4
|
+
type Mode = 'local' | 'global' | 'pure' | 'icss' | ((resourcePath: string, resourceQuery: string, resourceFragment: string) => 'local' | 'global' | 'pure' | 'icss');
|
|
5
|
+
export interface LightningCssLoaderOption extends Omit<TransformOptions<CustomAtRules>, 'filename' | 'code' | 'inputSourceMap'> {
|
|
6
|
+
rem?: boolean;
|
|
7
|
+
implementation?: typeof import('lightningcss');
|
|
8
|
+
esModule?: boolean;
|
|
9
|
+
modules?: {
|
|
10
|
+
auto?(path: string): boolean;
|
|
11
|
+
localIdentName?: string;
|
|
12
|
+
exportOnlyLocals?: boolean;
|
|
13
|
+
getJSON?(params: {
|
|
14
|
+
resourcePath: string;
|
|
15
|
+
exports: {
|
|
16
|
+
name: string;
|
|
17
|
+
value: string;
|
|
18
|
+
}[];
|
|
19
|
+
}): void;
|
|
20
|
+
namedExport?: boolean;
|
|
21
|
+
exportLocalsConvention?: ExportLocalsConvention;
|
|
22
|
+
mode?: Mode;
|
|
23
|
+
};
|
|
24
|
+
importLoaders?: number;
|
|
25
|
+
url?: string;
|
|
26
|
+
import?(...args: unknown[]): boolean;
|
|
27
|
+
}
|
|
28
|
+
export default function LightningCssLoader(this: LoaderContext<LightningCssLoaderOption>, source: string, prevMap?: string): Promise<void>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { LoaderContext } from 'webpack';
|
|
2
|
+
export declare function urlToRequest(e: string, i?: string | boolean): string;
|
|
3
|
+
export declare function resolveRequests(resolve: (arg0: any, arg1: any) => Promise<any>, context: any, possibleRequests: any[]): Promise<any>;
|
|
4
|
+
export declare function requestify(url: string, rootContext: string): string;
|
|
5
|
+
export declare function isUrlRequestable(url: string): boolean;
|
|
6
|
+
export declare function isDataUrl(url: string): boolean;
|
|
7
|
+
export declare function getPreRequester({ loaders, loaderIndex, }: {
|
|
8
|
+
loaders: {
|
|
9
|
+
request: unknown;
|
|
10
|
+
}[];
|
|
11
|
+
loaderIndex: number;
|
|
12
|
+
}): (number: string | false | number) => any;
|
|
13
|
+
export declare function getFilter<T>(filter: T, resourcePath: string): (...args: T[]) => any;
|
|
14
|
+
export declare function normalizeSourceMapForRuntime(map: any, loaderContext: LoaderContext<unknown>): string;
|
|
15
|
+
export declare function dashesCamelCase(str: string): string;
|
|
16
|
+
export declare const camelCase: (input: string | string[], options?: Record<string, unknown>) => string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { TransformOptions } from '@moneko/eslint/babel-core';
|
|
2
|
+
import type { PluginOptions } from '@moneko/eslint/react-compiler';
|
|
3
|
+
import type { LoaderContext } from 'webpack';
|
|
4
|
+
export interface ReactCompilerOption extends PluginOptions {
|
|
5
|
+
/**
|
|
6
|
+
* 指定 React 的主要版本
|
|
7
|
+
* @description
|
|
8
|
+
* ReactCompiler 与 React 19+ 配合使用效果最佳;
|
|
9
|
+
*
|
|
10
|
+
* 将 ReactCompiler 与 React 17、18 一起使用需要安装额外的 `react-compiler-runtime` 依赖项;
|
|
11
|
+
*/
|
|
12
|
+
target: '17' | '18' | '19';
|
|
13
|
+
/** 编译模式
|
|
14
|
+
* @description annotation 注释模式: 通过 "use memo"、"use no memo" 手动指定启用优化
|
|
15
|
+
* @example
|
|
16
|
+
* export default function Home() {
|
|
17
|
+
* 'use memo';
|
|
18
|
+
* // ...
|
|
19
|
+
* }
|
|
20
|
+
* export default function About() {
|
|
21
|
+
* 'use no memo';
|
|
22
|
+
* // ...
|
|
23
|
+
* }
|
|
24
|
+
*/
|
|
25
|
+
compilationMode: 'annotation' | 'infer' | 'syntax' | 'all';
|
|
26
|
+
}
|
|
27
|
+
declare function reactCompilerLoader(this: LoaderContext<ReactCompilerOption>, sourceCode: string, inputSourceMap?: TransformOptions['inputSourceMap']): string | undefined;
|
|
28
|
+
export declare function custom(this: LoaderContext<ReactCompilerOption>, sourceCode: string, inputSourceMap?: TransformOptions['inputSourceMap']): () => string | undefined;
|
|
29
|
+
export default reactCompilerLoader;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type TransformSolidJsOption } from '@moneko/convert/solid';
|
|
2
|
+
import type { TransformOptions } from '@moneko/eslint/babel-core';
|
|
3
|
+
import type { LoaderContext } from 'webpack';
|
|
4
|
+
declare function solidLoader(this: LoaderContext<TransformSolidJsOption>, sourceCode: string, inputSourceMap?: TransformOptions['inputSourceMap']): Promise<void>;
|
|
5
|
+
export declare function custom(this: LoaderContext<TransformSolidJsOption>, sourceCode: string, inputSourceMap?: TransformOptions['inputSourceMap']): () => Promise<void>;
|
|
6
|
+
export default solidLoader;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { LoaderContext } from 'webpack';
|
|
2
|
+
import type ReactiveObject from '../commom/reactive-object.mjs';
|
|
3
|
+
export default function (this: LoaderContext<{
|
|
4
|
+
comment: ReactiveObject<Record<string, string>>;
|
|
5
|
+
generateDoc(content: string, path: string): string;
|
|
6
|
+
getCommentPath(filepath: string): string;
|
|
7
|
+
}>, value: string): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface JsxDomExpressions {
|
|
2
|
+
moduleName?: string;
|
|
3
|
+
builtIns?: string[];
|
|
4
|
+
contextToCustomElements?: boolean;
|
|
5
|
+
wrapConditionals?: boolean;
|
|
6
|
+
generate?: 'ssr' | 'dom';
|
|
7
|
+
hydratable?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const jsxDomExpressions: JsxDomExpressions;
|
|
10
|
+
export default jsxDomExpressions;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Config as SwcConfig } from '@swc/core';
|
|
2
|
+
export type SwcOption = SwcConfig & {
|
|
3
|
+
module?: {
|
|
4
|
+
resolveFully: boolean;
|
|
5
|
+
};
|
|
6
|
+
parseMap?: boolean;
|
|
7
|
+
sync?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const _default: (ssr: boolean, other?: SwcConfig) => SwcConfig;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Compilation, type Compiler, type sources } from 'webpack';
|
|
2
|
+
type Source = sources.Source;
|
|
3
|
+
export interface CompressionPluginOptions {
|
|
4
|
+
test: RegExp;
|
|
5
|
+
algorithm: 'gzip' | 'brotli';
|
|
6
|
+
}
|
|
7
|
+
export declare class CompressionPlugin {
|
|
8
|
+
private name;
|
|
9
|
+
private options;
|
|
10
|
+
constructor(options: CompressionPluginOptions);
|
|
11
|
+
private runCompressionAlgorithm;
|
|
12
|
+
compress(compiler: Compiler, compilation: Compilation, assets: Record<string, Source>): Promise<void>;
|
|
13
|
+
apply(compiler: Compiler): void;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
*/
|
|
15
|
+
export interface CopyPluginOption {
|
|
16
|
+
/** 需要拷贝的文件列表 */
|
|
17
|
+
files?: string[];
|
|
18
|
+
/** 需要拷贝的文件夹 */
|
|
19
|
+
dirs?: string[];
|
|
20
|
+
}
|
|
21
|
+
export declare class CopyPlugin {
|
|
22
|
+
private readonly baseFiles;
|
|
23
|
+
private readonly dirs;
|
|
24
|
+
private cacheFiles;
|
|
25
|
+
private fileTimestamps;
|
|
26
|
+
constructor(option: CopyPluginOption);
|
|
27
|
+
private getFiles;
|
|
28
|
+
private hasFileChanged;
|
|
29
|
+
apply(compiler: Compiler): void;
|
|
30
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Compiler, Stats } from 'webpack';
|
|
2
|
+
export type DoneCallback = (stats: Stats) => void;
|
|
3
|
+
export declare class DonePlugin {
|
|
4
|
+
private name;
|
|
5
|
+
private options;
|
|
6
|
+
constructor(options: {
|
|
7
|
+
done: DoneCallback;
|
|
8
|
+
});
|
|
9
|
+
apply(compiler: Compiler): void;
|
|
10
|
+
}
|
|
11
|
+
export type DonePluginOption = ConstructorParameters<typeof DonePlugin>[0]['done'];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ESLint } from '@moneko/eslint';
|
|
2
|
+
import { type Compiler } from 'webpack';
|
|
3
|
+
export interface ESLintOption extends ESLint.Options {
|
|
4
|
+
files: string[];
|
|
5
|
+
lintDirtyModulesOnly?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare class ESLintPlugin {
|
|
8
|
+
private name;
|
|
9
|
+
private worker;
|
|
10
|
+
private options;
|
|
11
|
+
constructor(options?: ESLintOption);
|
|
12
|
+
apply(compiler: Compiler): void;
|
|
13
|
+
private report;
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Compiler } from 'webpack';
|
|
2
|
+
interface ModuleFederationExposesDeclarationPluginOptions {
|
|
3
|
+
name: string;
|
|
4
|
+
exposes: Record<string, string>;
|
|
5
|
+
}
|
|
6
|
+
export declare class ModuleFederationExposesDeclarationPlugin {
|
|
7
|
+
private name;
|
|
8
|
+
private assetName;
|
|
9
|
+
private dts;
|
|
10
|
+
private option;
|
|
11
|
+
private worker;
|
|
12
|
+
constructor(option: ModuleFederationExposesDeclarationPluginOptions);
|
|
13
|
+
apply(compiler: Compiler): void;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -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 {};
|
|
@@ -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
|
+
}
|