@moneko/core 3.55.1 → 3.55.2-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/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/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/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/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 +26 -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 +9 -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/eslint.mjs +1 -1
- 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/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/stylelint.mjs +1 -1
- 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/dts.d.mts +1 -0
- package/lib/worker/dts.mjs +1 -1
- package/lib/worker/eslint.d.mts +1 -0
- package/lib/worker/eslint.mjs +1 -1
- package/lib/worker/react-compiler.d.mts +1 -0
- package/lib/worker/react-compiler.mjs +1 -1
- package/lib/worker/solid.d.mts +1 -0
- package/lib/worker/solid.mjs +1 -1
- package/lib/worker/stylelint.d.mts +1 -0
- package/lib/worker/stylelint.mjs +1 -1
- package/lib/worker/swc-minify.d.mts +1 -0
- package/lib/worker/swc-minify.mjs +1 -1
- package/package.json +3 -4
|
@@ -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,14 @@
|
|
|
1
|
+
import type { LoaderContext } from 'webpack';
|
|
2
|
+
export interface CssInJsMinifyOption {
|
|
3
|
+
/**
|
|
4
|
+
* css in js 使用的模块
|
|
5
|
+
* @default '@moneko/css'
|
|
6
|
+
*/
|
|
7
|
+
moduleName: string;
|
|
8
|
+
/**
|
|
9
|
+
* css in js 字符串模版函数
|
|
10
|
+
* @default ['css', 'injectGlobal']
|
|
11
|
+
*/
|
|
12
|
+
allowFuncs: string[];
|
|
13
|
+
}
|
|
14
|
+
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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return s}});const e=require("node:path"),t=require("node:worker_threads");function s(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return s}});const e=require("node:path"),t=new(require("node:worker_threads")).Worker((0,e.join)(__dirname,"../worker/react-compiler.mjs"));function s(e){let s,r=this.async(),o=this.resourcePath,i=this.getOptions();this.cacheable&&this.cacheable(),this._compiler?.hooks.done.tap("react-compiler-loader",()=>{t.terminate()}),s="annotation"===i.compilationMode?e.includes("use memo")||e.includes("use forget"):e.includes("react")||this.resourcePath.endsWith(".tsx")||this.resourcePath.endsWith(".jsx"),this.resourcePath.endsWith(".d.ts")||!s?r(null,e):(t.postMessage({sourceCode:e,resourcePath:o,options:i}),t.once("message",e=>{o===e[0]&&r(e[1],e[2],e[3])}))}t.setMaxListeners(0);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { PluginOptions } from '@moneko/eslint/react-compiler';
|
|
2
|
+
import type { LoaderContext } from 'webpack';
|
|
3
|
+
export interface ReactCompilerOption extends PluginOptions {
|
|
4
|
+
/**
|
|
5
|
+
* 指定 React 的主要版本
|
|
6
|
+
* @description
|
|
7
|
+
* ReactCompiler 与 React 19+ 配合使用效果最佳;
|
|
8
|
+
*
|
|
9
|
+
* 将 ReactCompiler 与 React 17、18 一起使用需要安装额外的 `react-compiler-runtime` 依赖项;
|
|
10
|
+
*/
|
|
11
|
+
target: '17' | '18' | '19';
|
|
12
|
+
/** 编译模式
|
|
13
|
+
* @description annotation 注释模式: 通过 "use memo"、"use no memo" 手动指定启用优化
|
|
14
|
+
* @example
|
|
15
|
+
* export default function Home() {
|
|
16
|
+
* 'use memo';
|
|
17
|
+
* // ...
|
|
18
|
+
* }
|
|
19
|
+
* export default function About() {
|
|
20
|
+
* 'use no memo';
|
|
21
|
+
* // ...
|
|
22
|
+
* }
|
|
23
|
+
*/
|
|
24
|
+
compilationMode: 'annotation' | 'infer' | 'syntax' | 'all';
|
|
25
|
+
}
|
|
26
|
+
export default function reactCompilerLoader(this: LoaderContext<ReactCompilerOption>, sourceCode: string): void;
|
package/lib/loader/solid.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=exports,t={get custom(){return i},get default(){return a}};for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:Object.getOwnPropertyDescriptor(t,r).get});const s=require("node:path"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=exports,t={get custom(){return i},get default(){return a}};for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:Object.getOwnPropertyDescriptor(t,r).get});const s=require("node:path"),o=new(require("node:worker_threads")).Worker((0,s.join)(__dirname,"../worker/solid.mjs"));async function n(e,t){this.cacheable&&this.cacheable(),this._compiler?.hooks.done.tap("solid-loader",()=>{o.terminate()});let r=this.async(),s=this.getOptions(),n=this.resourcePath;o.postMessage({...s,sourceCode:e,filename:n,inputSourceMap:t}),o.on("message",e=>{n===e[0]&&r(e[1],e[2],e[3])})}function i(e,t){return n.bind(this,e,t)}o.setMaxListeners(0);const a=n;
|
|
@@ -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
|
+
}
|
package/lib/plugin/eslint.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fileURLToPath as t}from"node:url";import e
|
|
1
|
+
import{fileURLToPath as t}from"node:url";import{Worker as e}from"node:worker_threads";import s from"webpack";class o extends s.WebpackError{constructor(t){super(`[ESLint] ${t}`),this.name="ESLintError",this.stack=""}}export class ESLintPlugin{constructor(s={files:[]}){this.name="ESLintPlugin",this.options=s,this.worker=new e(t(new URL("../worker/eslint.mjs",import.meta.url))),this.worker.setMaxListeners(0)}apply(t){t.hooks.thisCompilation.tap(this.name,e=>{let s=t.modifiedFiles||new Set;e.hooks.finishModules.tap(this.name,t=>{let o=this.options;if(this.options?.lintDirtyModulesOnly){let e=[];for(let o of t){let t=o.resource;s.has(t)&&e.push(t)}o.files=e}this.worker.postMessage({options:o}),this.worker.once("message",t=>{this.report(e,t)})})}),t.hooks.shutdown.tap(this.name,()=>{this.worker.terminate()})}report(t,e){e?.length&&t&&(e[0]?.length&&t.warnings.push(new o(e[0])),e[1]?.length&&t.errors.push(new o(e[1])))}}
|
|
@@ -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 {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{join as e,parse as t,resolve as o}from"node:path";import{fileURLToPath as s}from"node:url";import{
|
|
1
|
+
import{join as e,parse as t,resolve as o}from"node:path";import{fileURLToPath as s}from"node:url";import{Worker as i}from"node:worker_threads";import{loadFile as r}from"@moneko/utils";import a from"webpack";import n from"../utils/create-types.mjs";let m="ModuleFederationExposesDeclarationPlugin";export class ModuleFederationExposesDeclarationPlugin{constructor(e){this.name="ModuleFederationExposesDeclarationPlugin",this.assetName="module-federation.d.ts",this.dts="",this.option=e,this.worker=new i(s(new URL("../worker/dts.mjs",import.meta.url))),this.worker.setMaxListeners(0),this.worker.postMessage({options:{compilerOptions:{outFile:this.assetName},include:Object.values(e.exposes)}}),this.worker.once("message",e=>{this.dts=e,this.worker.terminate()})}apply(s){let{exposes:i}=this.option,p=Object.keys(i).map(e=>{let t=e.replace(/\.tsx?$/i,"");return{key:e,name:t,path:o(`types/${this.option.name}/${t}.d.ts`),originPath:i[e]}});s.hooks.thisCompilation.tap({name:m,stage:s.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},o=>{o.hooks.processAssets.tapPromise(m,async()=>{let s=p.map(async o=>{if(null!==await r(o.originPath)){let s=t(o.originPath);return`${n(e(this.option.name,o.name),`export * from '${t(s.dir).name}/${s.name}'`)}`}return""}),i=await Promise.all(s);i.unshift(this.dts),o.emitAsset("module-federation.d.ts",new a.sources.RawSource(i.join("\n")),{javascriptModule:!1})})})}}
|
|
@@ -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
|
+
}
|
package/lib/plugin/stylelint.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fileURLToPath as t}from"node:url";import
|
|
1
|
+
import{fileURLToPath as t}from"node:url";import{Worker as e}from"node:worker_threads";import r from"webpack";class s extends r.WebpackError{constructor(t){super(`[Stylelint] ${t}`),this.name="StylelintError",this.stack=""}}export class StylelintPlugin{constructor(r={files:[]}){this.name="StylelintPlugin",this.options=r,this.worker=new e(t(new URL("../worker/stylelint.mjs",import.meta.url))),this.worker.setMaxListeners(0)}apply(t){t.hooks.thisCompilation.tap(this.name,t=>{this.worker.postMessage({options:this.options}),this.worker.once("message",e=>{this.report(e,t)})}),t.hooks.shutdown.tap(this.name,()=>{this.worker.terminate()})}report(t,e){t?.length&&e&&(t[0]?.length&&e.warnings.push(new s(t[0])),t[1]?.length&&e.errors.push(new s(t[1])))}}
|
|
@@ -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;
|