@moneko/core 4.2.0-beta.0 → 4.2.0
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.mjs.d.ts +17 -0
- package/lib/bin/{commit-lint.d.mts → commit-lint.mjs.d.ts} +5 -8
- package/lib/bin/{index.d.mts → index.mjs.d.ts} +1 -1
- package/lib/bin/{pin.d.mts → pin.mjs.d.ts} +1 -2
- package/lib/bin/{pure-lint.d.mts → pure-lint.mjs.d.ts} +1 -1
- package/lib/bin/server.mjs +1 -1
- package/lib/bin/server.mjs.d.ts +2 -0
- package/lib/bin/tsc.mjs.d.ts +2 -0
- package/lib/bin/utils/{bundle-app.d.mts → bundle-app.mjs.d.ts} +2 -0
- package/lib/bin/utils/convert-react.mjs.d.ts +174 -0
- package/lib/bin/utils/get-commit-files.mjs.d.ts +2 -0
- package/lib/build-dev.mjs.d.ts +1 -0
- package/lib/build.mjs.d.ts +1 -0
- package/lib/commom/{ca.d.mts → ca.mjs.d.ts} +3 -5
- package/lib/commom/{check-npm.d.mts → check-npm.mjs.d.ts} +1 -2
- package/lib/commom/{corepack.d.mts → corepack.mjs.d.ts} +1 -2
- package/lib/commom/css-in-js-minify.mjs.d.ts +12 -0
- package/lib/commom/{is-ci-environment.d.mts → is-ci-environment.mjs.d.ts} +1 -2
- package/lib/commom/{match-path.d.mts → match-path.mjs.d.ts} +1 -2
- package/lib/commom/{package-manager.d.mts → package-manager.mjs.d.ts} +2 -3
- package/lib/commom/paths.mjs.d.ts +33 -0
- package/lib/commom/{reactive-object.d.mts → reactive-object.mjs.d.ts} +1 -0
- package/lib/commom/rule.mjs.d.ts +2 -0
- package/lib/commom/{setup-env.d.mts → setup-env.mjs.d.ts} +4 -2
- package/lib/commom/{timer.d.mts → timer.mjs.d.ts} +1 -2
- package/lib/commom/transfer-import-on-demand.mjs.d.ts +54 -0
- package/lib/create-development-configuration.mjs.d.ts +2 -0
- package/lib/dev/config.mjs.d.ts +9 -0
- package/lib/dev/get-cert.mjs.d.ts +10 -0
- package/lib/dev/{json-schema.d.mts → json-schema.mjs.d.ts} +3 -1
- package/lib/dev/mock.mjs +1 -1
- package/lib/dev/{mock.d.mts → mock.mjs.d.ts} +17 -21
- package/lib/dev/{proxy.d.mts → proxy.mjs.d.ts} +1 -1
- package/lib/dev.mjs.d.ts +1 -0
- package/lib/{index.d.mts → index.mjs.d.ts} +5 -5
- package/lib/lint/stylelint/{index.d.mts → index.mjs.d.ts} +1 -1
- package/lib/loader/{lightning-css.d.cts → lightning-css.cjs.d.ts} +2 -0
- package/lib/loader/mdx.cjs.d.ts +5 -0
- package/lib/loader/react-compiler.cjs.d.ts +27 -0
- package/lib/loader/{solid.d.cts → solid.cjs.d.ts} +1 -1
- package/lib/module.config.mjs.d.ts +3 -0
- package/lib/options/reslove.mjs.d.ts +10 -0
- package/lib/options/{swcrc.d.mts → swcrc.mjs.d.ts} +2 -2
- package/lib/plugin/{compression.d.mts → compression.mjs.d.ts} +1 -1
- package/lib/plugin/{copy.d.mts → copy.mjs.d.ts} +3 -6
- package/lib/plugin/{exposes-declararion.d.mts → exposes-declararion.mjs.d.ts} +1 -1
- package/lib/plugin/{html-plugin.d.mts → html-plugin.mjs.d.ts} +20 -29
- package/lib/plugin/{lightningcss-plugin.d.mts → lightningcss-plugin.mjs.d.ts} +1 -1
- package/lib/plugin/manifest/index.mjs +1 -1
- package/lib/plugin/manifest/{index.d.mts → index.mjs.d.ts} +1 -1
- package/lib/plugin/manifest/types.mjs.d.ts +508 -0
- package/lib/plugin/override-resolve.mjs.d.ts +23 -0
- package/lib/plugin/{virtual-module.d.mts → virtual-module.mjs.d.ts} +1 -1
- package/lib/polyfills/inject-react-refresh.mjs.d.ts +1 -0
- package/lib/polyfills/replace-children.mjs.d.ts +1 -0
- package/lib/{process-env.d.mts → process-env.mjs.d.ts} +14 -14
- package/lib/utils/{compile-dts.d.mts → compile-dts.mjs.d.ts} +2 -3
- package/lib/utils/{dts.d.mts → dts.mjs.d.ts} +2 -4
- package/lib/utils/{index.d.mts → index.mjs.d.ts} +9 -15
- package/lib/utils/run.mjs.d.ts +2 -0
- package/lib/utils/seo.mjs +2 -2
- package/lib/utils/seo.mjs.d.ts +2 -0
- package/lib/utils/{vts.d.mts → vts.mjs.d.ts} +3 -3
- package/lib/vm/{docs.d.mts → docs.mjs.d.ts} +1 -0
- package/lib/vm/{locales.d.mts → locales.mjs.d.ts} +1 -0
- package/lib/worker/compression.mjs.d.ts +1 -0
- package/lib/worker/css-in-js-minify.mjs.d.ts +1 -0
- package/lib/worker/dts.mjs.d.ts +1 -0
- package/lib/worker/react-compiler.mjs.d.ts +1 -0
- package/lib/worker/solid.mjs.d.ts +1 -0
- package/lib/worker/swc-minify.mjs.d.ts +1 -0
- package/package.json +2 -2
- package/lib/bin/build-app.d.mts +0 -16
- package/lib/bin/server.d.mts +0 -2
- package/lib/bin/tsc.d.mts +0 -2
- package/lib/bin/utils/convert-react.d.mts +0 -1
- package/lib/bin/utils/get-commit-files.d.mts +0 -2
- package/lib/build-dev.d.mts +0 -1
- package/lib/build.d.mts +0 -1
- package/lib/commom/css-in-js-minify.d.mts +0 -13
- package/lib/commom/paths.d.mts +0 -52
- package/lib/commom/rule.d.mts +0 -27
- package/lib/commom/transfer-import-on-demand.d.mts +0 -78
- package/lib/create-development-configuration.d.mts +0 -2
- package/lib/dev/config.d.mts +0 -4
- package/lib/dev/get-cert.d.mts +0 -8
- package/lib/dev.d.mts +0 -1
- package/lib/loader/mdx.d.cts +0 -3
- package/lib/loader/react-compiler.d.cts +0 -29
- package/lib/module.config.d.mts +0 -3
- package/lib/options/reslove.d.mts +0 -9
- package/lib/plugin/manifest/types.d.mts +0 -576
- package/lib/plugin/override-resolve.d.mts +0 -25
- package/lib/polyfills/inject-react-refresh.d.mts +0 -1
- package/lib/polyfills/replace-children.d.mts +0 -1
- package/lib/utils/run.d.mts +0 -2
- package/lib/utils/seo.d.mts +0 -2
- package/lib/worker/compression.d.mts +0 -1
- package/lib/worker/css-in-js-minify.d.mts +0 -1
- package/lib/worker/dts.d.mts +0 -1
- package/lib/worker/react-compiler.d.mts +0 -1
- package/lib/worker/solid.d.mts +0 -1
- package/lib/worker/swc-minify.d.mts +0 -1
- /package/lib/bin/{build-dev.d.mts → build-dev.mjs.d.ts} +0 -0
- /package/lib/bin/{build.d.mts → build.mjs.d.ts} +0 -0
- /package/lib/bin/{changelog.d.mts → changelog.mjs.d.ts} +0 -0
- /package/lib/bin/{eslint.d.mts → eslint.mjs.d.ts} +0 -0
- /package/lib/bin/{file.d.mts → file.mjs.d.ts} +0 -0
- /package/lib/bin/{git-hooks.d.mts → git-hooks.mjs.d.ts} +0 -0
- /package/lib/bin/{help.d.mts → help.mjs.d.ts} +0 -0
- /package/lib/bin/{lessc.d.mts → lessc.mjs.d.ts} +0 -0
- /package/lib/bin/{setup.d.mts → setup.mjs.d.ts} +0 -0
- /package/lib/bin/{start.d.mts → start.mjs.d.ts} +0 -0
- /package/lib/bin/{stylelint.d.mts → stylelint.mjs.d.ts} +0 -0
- /package/lib/bin/utils/{config.d.mts → config.mjs.d.ts} +0 -0
- /package/lib/bin/utils/{setup-swcrc.d.mts → setup-swcrc.mjs.d.ts} +0 -0
- /package/lib/build/{common.d.mts → common.mjs.d.ts} +0 -0
- /package/lib/build/{server.d.mts → server.mjs.d.ts} +0 -0
- /package/lib/commom/{diff-object.d.mts → diff-object.mjs.d.ts} +0 -0
- /package/lib/commom/{esm.d.mts → esm.mjs.d.ts} +0 -0
- /package/lib/commom/{has-pkg.d.mts → has-pkg.mjs.d.ts} +0 -0
- /package/lib/commom/{host.d.mts → host.mjs.d.ts} +0 -0
- /package/lib/commom/{log.d.mts → log.mjs.d.ts} +0 -0
- /package/lib/commom/{mime.d.mts → mime.mjs.d.ts} +0 -0
- /package/lib/commom/{module-resolve.d.mts → module-resolve.mjs.d.ts} +0 -0
- /package/lib/commom/{net.d.mts → net.mjs.d.ts} +0 -0
- /package/lib/commom/{open.d.mts → open.mjs.d.ts} +0 -0
- /package/lib/commom/{parse-args.d.mts → parse-args.mjs.d.ts} +0 -0
- /package/lib/commom/{print-log.d.mts → print-log.mjs.d.ts} +0 -0
- /package/lib/commom/{read-json.d.mts → read-json.mjs.d.ts} +0 -0
- /package/lib/commom/{require.d.mts → require.mjs.d.ts} +0 -0
- /package/lib/commom/{sigint-exit.d.mts → sigint-exit.mjs.d.ts} +0 -0
- /package/lib/commom/{transform-solid-js.d.mts → transform-solid-js.mjs.d.ts} +0 -0
- /package/lib/{common.d.mts → common.mjs.d.ts} +0 -0
- /package/lib/{config.d.mts → config.mjs.d.ts} +0 -0
- /package/lib/dev/{generate-progress-html.d.mts → generate-progress-html.mjs.d.ts} +0 -0
- /package/lib/dev/{server.d.mts → server.mjs.d.ts} +0 -0
- /package/lib/{file-system.d.mts → file-system.mjs.d.ts} +0 -0
- /package/lib/lint/eslint/{base.d.mts → base.mjs.d.ts} +0 -0
- /package/lib/lint/eslint/{index.d.mts → index.mjs.d.ts} +0 -0
- /package/lib/lint/eslint/{react-jsx.d.mts → react-jsx.mjs.d.ts} +0 -0
- /package/lib/lint/eslint/{react-legacy.d.mts → react-legacy.mjs.d.ts} +0 -0
- /package/lib/lint/eslint/{react.d.mts → react.mjs.d.ts} +0 -0
- /package/lib/lint/eslint/{solid.d.mts → solid.mjs.d.ts} +0 -0
- /package/lib/lint/eslint/{vue.d.mts → vue.mjs.d.ts} +0 -0
- /package/lib/lint/stylelint/{config.d.mts → config.mjs.d.ts} +0 -0
- /package/lib/loader/{css-in-js-minify.d.cts → css-in-js-minify.cjs.d.ts} +0 -0
- /package/lib/options/{jsx-dom-expressions.d.mts → jsx-dom-expressions.mjs.d.ts} +0 -0
- /package/lib/options/{md-to-html.d.mts → md-to-html.mjs.d.ts} +0 -0
- /package/lib/options/{modify-vars.d.mts → modify-vars.mjs.d.ts} +0 -0
- /package/lib/options/{split-chunk.d.mts → split-chunk.mjs.d.ts} +0 -0
- /package/lib/plugin/{css-module-dts.d.mts → css-module-dts.mjs.d.ts} +0 -0
- /package/lib/plugin/{done.d.mts → done.mjs.d.ts} +0 -0
- /package/lib/plugin/{eslint.d.mts → eslint.mjs.d.ts} +0 -0
- /package/lib/plugin/{external-remotes.d.mts → external-remotes.mjs.d.ts} +0 -0
- /package/lib/plugin/{module-federation.d.mts → module-federation.mjs.d.ts} +0 -0
- /package/lib/plugin/{stylelint.d.mts → stylelint.mjs.d.ts} +0 -0
- /package/lib/plugin/{swc-minify-plugin.d.mts → swc-minify-plugin.mjs.d.ts} +0 -0
- /package/lib/{plugins.config.d.mts → plugins.config.mjs.d.ts} +0 -0
- /package/lib/polyfills/{polyfills.d.mts → polyfills.mjs.d.ts} +0 -0
- /package/lib/polyfills/{public-path.d.mts → public-path.mjs.d.ts} +0 -0
- /package/lib/polyfills/{targets.d.mts → targets.mjs.d.ts} +0 -0
- /package/lib/utils/{create-types.d.mts → create-types.mjs.d.ts} +0 -0
- /package/lib/utils/{fetch-module-federation-dts.d.mts → fetch-module-federation-dts.mjs.d.ts} +0 -0
- /package/lib/utils/{svg-to-data-uri.d.mts → svg-to-data-uri.mjs.d.ts} +0 -0
- /package/lib/vm/{app.d.mts → app.mjs.d.ts} +0 -0
- /package/lib/vm/{coverage.d.mts → coverage.mjs.d.ts} +0 -0
- /package/lib/vm/{dts.d.mts → dts.mjs.d.ts} +0 -0
- /package/lib/vm/{example.d.mts → example.mjs.d.ts} +0 -0
- /package/lib/vm/{generate-doc.d.mts → generate-doc.mjs.d.ts} +0 -0
- /package/lib/vm/{render-app.d.mts → render-app.mjs.d.ts} +0 -0
- /package/lib/vm/{routes.d.mts → routes.mjs.d.ts} +0 -0
- /package/lib/vm/{scope.d.mts → scope.mjs.d.ts} +0 -0
- /package/lib/vm/{virtual.d.mts → virtual.mjs.d.ts} +0 -0
- /package/lib/worker/{eslint.d.mts → eslint.mjs.d.ts} +0 -0
- /package/lib/worker/{stylelint.d.mts → stylelint.mjs.d.ts} +0 -0
|
@@ -10,18 +10,18 @@ export { default as printLog } from './commom/print-log.mjs';
|
|
|
10
10
|
export { default as require } from './commom/require.mjs';
|
|
11
11
|
export { default as Rule } from './commom/rule.mjs';
|
|
12
12
|
export { default as timer } from './commom/timer.mjs';
|
|
13
|
-
export { type MockConfiguration, type ProxyFuncType, type RequestFormData, yApiMock, type YApiOption, type YApiOptionBySchema, yApiSchemaMock
|
|
13
|
+
export { type MockConfiguration, type ProxyFuncType, type RequestFormData, yApiMock, type YApiOption, type YApiOptionBySchema, yApiSchemaMock } from './dev/mock.mjs';
|
|
14
14
|
export type { ProxyConfig } from './dev/proxy.mjs';
|
|
15
15
|
export type { ReactCompilerOption } from './loader/react-compiler.cjs';
|
|
16
|
-
export { type JsxDomExpressions, default as jsxDomExpressions
|
|
17
|
-
export { type OptimizationSplitChunksOptions, default as splitChunk
|
|
16
|
+
export { type JsxDomExpressions, default as jsxDomExpressions } from './options/jsx-dom-expressions.mjs';
|
|
17
|
+
export { type OptimizationSplitChunksOptions, default as splitChunk } from './options/split-chunk.mjs';
|
|
18
18
|
export type { CompressionPluginOptions } from './plugin/compression.mjs';
|
|
19
19
|
export type { HtmlMeta, HtmlPluginOption } from './plugin/html-plugin.mjs';
|
|
20
20
|
export * from './plugin/manifest/index.mjs';
|
|
21
21
|
export type { OverrideResolverOption } from './plugin/override-resolve.mjs';
|
|
22
22
|
export type { VirtualModules } from './plugin/virtual-module.mjs';
|
|
23
|
-
export { APPTYPE, coreName, FRAMEWORK, isCI, isDev, isLibrary, isMicro, mainDirectory, packageJson, PACKAGENAME
|
|
24
|
-
export { type AlgorithmIdentifier, digest, md5, node_modules, resolveProgram, toCamelCase
|
|
23
|
+
export { APPTYPE, coreName, FRAMEWORK, isCI, isDev, isLibrary, isMicro, mainDirectory, packageJson, PACKAGENAME } from './process-env.mjs';
|
|
24
|
+
export { type AlgorithmIdentifier, digest, md5, node_modules, resolveProgram, toCamelCase } from './utils/index.mjs';
|
|
25
25
|
export * from '@moneko/mdx';
|
|
26
26
|
export * from '@moneko/utils';
|
|
27
27
|
import webpack from 'webpack';
|
|
@@ -1 +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
|
|
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';
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
|
+
// @ts-nocheck
|
|
1
3
|
import { type CustomAtRules, type TransformOptions } from 'lightningcss';
|
|
2
4
|
import type { LoaderContext } from 'webpack';
|
|
3
5
|
export interface LightningCssLoaderOption extends Omit<TransformOptions<CustomAtRules>, 'filename' | 'code' | 'inputSourceMap' | 'cssModules'> {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import { type MdxOptions } from '@moneko/mdx';
|
|
4
|
+
import type { LoaderContext } from 'webpack';
|
|
5
|
+
export default function(this: LoaderContext<Omit<MdxOptions, 'value'>>, value: string): Promise<void>;
|
|
@@ -0,0 +1,27 @@
|
|
|
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 Partial<PluginOptions> {
|
|
5
|
+
/**
|
|
6
|
+
* 指定 React 的主要版本
|
|
7
|
+
* @description
|
|
8
|
+
* ReactCompiler 与 React 19+ 配合使用效果最佳;
|
|
9
|
+
*
|
|
10
|
+
* 将 ReactCompiler 与 React 17、18 一起使用需要安装额外的 `react-compiler-runtime` 依赖项;
|
|
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
|
+
*/ compilationMode: 'annotation' | 'infer' | 'syntax' | 'all';
|
|
24
|
+
}
|
|
25
|
+
declare function reactCompilerLoader(this: LoaderContext<ReactCompilerOption>, sourceCode: string, inputSourceMap?: TransformOptions['inputSourceMap']): string | Buffer | void;
|
|
26
|
+
export declare function custom(this: LoaderContext<ReactCompilerOption>, sourceCode: string, inputSourceMap?: TransformOptions['inputSourceMap']): typeof reactCompilerLoader;
|
|
27
|
+
export default reactCompilerLoader;
|
|
@@ -2,5 +2,5 @@ import { type TransformSolidJsOption } from '@moneko/convert/solid';
|
|
|
2
2
|
import type { TransformOptions } from '@moneko/eslint/babel-core';
|
|
3
3
|
import type { LoaderContext } from 'webpack';
|
|
4
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']):
|
|
5
|
+
export declare function custom(this: LoaderContext<TransformSolidJsOption>, sourceCode: string, inputSourceMap?: TransformOptions['inputSourceMap']): typeof solidLoader;
|
|
6
6
|
export default solidLoader;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const reslove: {
|
|
2
|
+
readonly sassLoader: string;
|
|
3
|
+
readonly lessLoader: string;
|
|
4
|
+
readonly swcLoader: string;
|
|
5
|
+
readonly transformImports: string;
|
|
6
|
+
readonly rawImport: string;
|
|
7
|
+
// jsxDomExpressions: hasPkg('@moneko/jsx-dom-expressions'),
|
|
8
|
+
readonly hotMiddlewareClient: string;
|
|
9
|
+
};
|
|
10
|
+
export default reslove;
|
|
@@ -6,5 +6,5 @@ export type SwcOption = SwcConfig & {
|
|
|
6
6
|
parseMap?: boolean;
|
|
7
7
|
sync?: boolean;
|
|
8
8
|
};
|
|
9
|
-
declare const
|
|
10
|
-
export default
|
|
9
|
+
declare const _default_1: (ssr: boolean, other?: SwcConfig) => SwcConfig;
|
|
10
|
+
export default _default_1;
|
|
@@ -11,12 +11,9 @@ import { type Compiler } from 'webpack';
|
|
|
11
11
|
* }
|
|
12
12
|
* }
|
|
13
13
|
* ```
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
files?: string[];
|
|
18
|
-
/** 需要拷贝的文件夹 */
|
|
19
|
-
dirs?: string[];
|
|
14
|
+
*/ export interface CopyPluginOption {
|
|
15
|
+
/** 需要拷贝的文件列表 */ files?: string[];
|
|
16
|
+
/** 需要拷贝的文件夹 */ dirs?: string[];
|
|
20
17
|
}
|
|
21
18
|
export declare class CopyPlugin {
|
|
22
19
|
private readonly baseFiles;
|
|
@@ -4,44 +4,35 @@ export interface HtmlMeta {
|
|
|
4
4
|
}
|
|
5
5
|
export interface HtmlPluginOption {
|
|
6
6
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
publicPath?: string;
|
|
7
|
+
* 公共路径, 默认使用 主配置的 publicPath
|
|
8
|
+
*/ publicPath?: string;
|
|
10
9
|
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
favicon?: string | false;
|
|
10
|
+
* 网站图标
|
|
11
|
+
*/ favicon?: string | false;
|
|
14
12
|
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
title?: string;
|
|
13
|
+
* 页面标题
|
|
14
|
+
*/ title?: string;
|
|
18
15
|
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
template?: string;
|
|
16
|
+
* 模板文件
|
|
17
|
+
*/ template?: string;
|
|
22
18
|
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
filename?: string | ((entryName: string) => string);
|
|
19
|
+
* 输出文件名
|
|
20
|
+
* @default index.html
|
|
21
|
+
*/ filename?: string | ((entryName: string) => string);
|
|
27
22
|
/**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
inject?: boolean | 'head' | 'body';
|
|
23
|
+
* 注入位置
|
|
24
|
+
* @default head
|
|
25
|
+
*/ inject?: boolean | 'head' | 'body';
|
|
32
26
|
templateContent?: (options: HtmlPluginOption) => string;
|
|
33
27
|
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
tags?: {
|
|
28
|
+
* 自定义额外的 tags, 当需要添加远程cdn时很有用
|
|
29
|
+
* */ tags?: {
|
|
37
30
|
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
textContent?: string;
|
|
31
|
+
* 标签内容
|
|
32
|
+
*/ textContent?: string;
|
|
41
33
|
/** 标签
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
tag?: string;
|
|
34
|
+
* @default script
|
|
35
|
+
*/ tag?: string;
|
|
45
36
|
inject?: 'body' | 'head';
|
|
46
37
|
[key: string]: string | null | boolean | number | undefined;
|
|
47
38
|
}[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as t,readFileSync as s}from"node:fs";import{basename as e,join as
|
|
1
|
+
import{existsSync as t,readFileSync as s}from"node:fs";import{basename as e,join as i,resolve as o}from"node:path";import n from"webpack";import{isDev as r,packageJson as a}from"../../process-env.mjs";export*from"./types.mjs";export class ManifestPlugin{constructor(t){this.name="ManifestPlugin",this.options={filename:"site.webmanifest",name:a.name,description:a.description,scope:"/",display:"standalone",background_color:"#fff",icons:[{src:"https://h5static.dewucdn.com/node-common/718d5e10-576d-8b14-b0b1-e4c58c3b3f40.webp",type:"image/webp",sizes:"512x512"}]},this.options={...this.options,...t}}getPublicPath(t){if(this.options.publicPath)return this.options.publicPath;let s=t.getAssetPath(t.outputOptions.publicPath,{hash:t.hash}),e="auto"===s?"/":s;return e.length&&!e.endsWith("/")&&(e+="/"),e}addAsset(r,a,p){if(!p)return;let c=this.getPublicPath(a);return p.map(p=>{let h={...p};if(h.src&&!h.src.startsWith("http")){let p=o(r.context,h.src);if(t(p)){let t=e(h.src),o=s(p);a.emitAsset(t,new n.sources.RawSource(o),{javascriptModule:!1}),h.src=i(c,t)}else a.warnings.push(new n.WebpackError(`Asset file ${p} does not exist`))}return h})}apply(t){let s=this.name,{filename:e,start_url:i,icons:o,screenshots:p,...c}=this.options;t.hooks.compilation.tap(s,h=>{h.hooks.processAssets.tap({name:s,stage:n.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL},()=>{let s={...c,start_url:i??this.getPublicPath(h),screenshots:this.addAsset(t,h,p),icons:this.addAsset(t,h,o),version:`${a.version}(${r?"Dev":h.fullHash})`};h.emitAsset(e,new t.webpack.sources.RawSource(JSON.stringify(s)),{javascriptModule:!1})})})}}
|
|
@@ -8,6 +8,6 @@ export declare class ManifestPlugin {
|
|
|
8
8
|
getPublicPath(compilation: Compilation): string;
|
|
9
9
|
addAsset<T extends {
|
|
10
10
|
src: string;
|
|
11
|
-
}>(compiler: Compiler, compilation: Compilation, assets?: T[]): T[] |
|
|
11
|
+
}>(compiler: Compiler, compilation: Compilation, assets?: T[]): T[] | void;
|
|
12
12
|
apply(compiler: Compiler): void;
|
|
13
13
|
}
|