@moneko/core 3.44.4 → 3.44.6
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/config.mjs +1 -1
- package/lib/index.d.mts +1 -0
- package/lib/plugin/compression.d.mts +1 -1
- package/lib/plugins.config.d.mts +3 -2
- package/lib/plugins.config.mjs +1 -1
- package/package.json +1 -1
- package/typings/global.d.ts +5 -0
package/lib/config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{relative as e}from"node:path";import o from"node:process";import{fileExists as t}from"@moneko/utils";import{merge as r}from"webpack-merge";import n from"./commom/paths.mjs";import s from"./commom/require.mjs";import i from"./commom/setup-env.mjs";import a from"./options/jsx-dom-expressions.mjs";import l from"./options/split-chunk.mjs";import{isFunction as m,node_modules as p,resolveProgram as c}from"./utils/index.mjs";import{APPTYPE as u,FRAMEWORK as d,frameworkVersion as f,isCI as h,isDev as g,isLibrary as v,isMobile as x,isReact as j,jsxImportSource as C,mainDirectory as P,NODE_ENV as b,PACKAGENAME as k}from"./process-env.mjs";let w=["@app","@moneko","neko-ui",".cache/http/data","@element-plus","ant-design-vue","element-plus","element-ui","ng-zorro-antd","@mui","@du","@fontsource","@fortawesome","font-pingfang-sc","font-pingfang-tc","katex","react-markdown-editor-lite","react-photo-view","schema-design","monaco-editor"];export function getConfig(e){return delete s.cache[e],new Promise(r=>{if(t(e)){let t=s(e).default;return r(m(t)?t(o):t)}return r({})})}let O=await Promise.all([i(b,u,d,[]),getConfig(n.configPath),getConfig(n.customConfigPath)]),y=O[0],S=O[1],M=O[2],I={strict:!1,devtool:g?"eval-cheap-module-source-map":"cheap-module-source-map",seo:!1,mode:"csr",bundleAnalyzer:!1,polyfill:!1,entry:{},minifier:{},sourceMap:{filename:"[file].map",publicPath:""},env:y,basename:"/",publicPath:"/",rem:{designSize:x?375:1920},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:Object.assign({"@":c(P)},j&&f<18?{"react/package.json":p("react/package.json"),"react/jsx-runtime":p("react/jsx-runtime.js"),"react/jsx-dev-runtime":p("react/jsx-dev-runtime.js")}:{}),moduleRules:[],prefixJsLoader:[],cssModules:[],cssModuleDefinition:!0,importOnDemand:{},proxy:{},devServer:{host:"localhost",port:3e3,open:!0},htmlPluginOption:{title:k.toLocaleUpperCase(),favicon:e(n.programPath,`${n.corePath}/options/favicon.ico`)},copy:{},routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:l,runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:w,js:w,media:w,font:w,wasm:[]},mdx:{jsx:!1,development:g,jsxImportSource:C,providerImportSource:`@moneko/${d}/mdx`},jsxDomExpressions:a,bar:{name:"Client",nameColor:"68",msgColor:"242",barBgColor:"15",barColor:"69",quiet:h},normalizeCss:!0,externalsPresets:{},buildHttp:void 0,virtualModule:{},cssExtract:{},externals:["@swc/core"],lazyCompilation:!1,performance:!1,refresh:"solid"!==d,bundleId:"com.moneko.bid",bundles:[],stylelint:{},eslint:{lintDirtyModulesOnly:!1},minChunkSize:1e3};v&&(I.alias=Object.assign(I.alias,{"@pkg":n.componentsPath,[k]:n.componentsPath}));let z=I;(!1===(z=r(z,S,M)).devtool||!1===z.sourceMap)&&(z.sourceMap=!1,z.devtool=!1),z.fixBrowserRouter&&z.htmlPluginOption&&(z.htmlPluginOption.tags||(z.htmlPluginOption.tags=[]),z.htmlPluginOption.tags.push({textContent:"(function(l) {if (l.search[1] === '/' ) {var decoded = l.search.slice(1).split('&').map(function(s) {return s.replace(/~and~/g, '&')}).join('?');window.history.replaceState(null, null,l.pathname.slice(0, -1) + decoded + l.hash);}}(window.location))"})),"true"===o.env.CODESPACES&&(z.devServer.https=!1),!1===z.devServer.https&&"darwin"===o.platform&&(z.devServer.open=!1);export const CONFIG=z;export const PUBLICPATH=CONFIG.publicPath;
|
|
1
|
+
import{relative as e}from"node:path";import o from"node:process";import{fileExists as t}from"@moneko/utils";import{merge as r}from"webpack-merge";import n from"./commom/paths.mjs";import s from"./commom/require.mjs";import i from"./commom/setup-env.mjs";import a from"./options/jsx-dom-expressions.mjs";import l from"./options/split-chunk.mjs";import{isFunction as m,node_modules as p,resolveProgram as c}from"./utils/index.mjs";import{APPTYPE as u,FRAMEWORK as d,frameworkVersion as f,isCI as h,isDev as g,isLibrary as v,isMobile as x,isReact as j,jsxImportSource as C,mainDirectory as P,NODE_ENV as b,PACKAGENAME as k}from"./process-env.mjs";let w=["@app","@moneko","neko-ui",".cache/http/data","@element-plus","ant-design-vue","element-plus","element-ui","ng-zorro-antd","@mui","@du","@fontsource","@fortawesome","font-pingfang-sc","font-pingfang-tc","katex","react-markdown-editor-lite","react-photo-view","schema-design","monaco-editor"];export function getConfig(e){return delete s.cache[e],new Promise(r=>{if(t(e)){let t=s(e).default;return r(m(t)?t(o):t)}return r({})})}let O=await Promise.all([i(b,u,d,[]),getConfig(n.configPath),getConfig(n.customConfigPath)]),y=O[0],S=O[1],M=O[2],I={strict:!1,devtool:g?"eval-cheap-module-source-map":"cheap-module-source-map",seo:!1,mode:"csr",bundleAnalyzer:!1,polyfill:!1,entry:{},minifier:{},sourceMap:{filename:"[file].map",publicPath:""},env:y,basename:"/",publicPath:"/",rem:{designSize:x?375:1920},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:Object.assign({"@":c(P)},j&&f<18?{"react/package.json":p("react/package.json"),"react/jsx-runtime":p("react/jsx-runtime.js"),"react/jsx-dev-runtime":p("react/jsx-dev-runtime.js")}:{}),moduleRules:[],prefixJsLoader:[],cssModules:[],cssModuleDefinition:!0,importOnDemand:{},proxy:{},devServer:{host:"localhost",port:3e3,open:!0},htmlPluginOption:{title:k.toLocaleUpperCase(),favicon:e(n.programPath,`${n.corePath}/options/favicon.ico`)},copy:{},routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:l,runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:w,js:w,media:w,font:w,wasm:[]},mdx:{jsx:!1,development:g,jsxImportSource:C,providerImportSource:`@moneko/${d}/mdx`},jsxDomExpressions:a,bar:{name:"Client",nameColor:"68",msgColor:"242",barBgColor:"15",barColor:"69",quiet:h},normalizeCss:!0,externalsPresets:{},buildHttp:void 0,virtualModule:{},cssExtract:{},externals:["@swc/core"],lazyCompilation:!1,performance:!1,refresh:"solid"!==d,bundleId:"com.moneko.bid",bundles:[],stylelint:{},eslint:{lintDirtyModulesOnly:!1},minChunkSize:1e3,compression:g};v&&(I.alias=Object.assign(I.alias,{"@pkg":n.componentsPath,[k]:n.componentsPath}));let z=I;(!1===(z=r(z,S,M)).devtool||!1===z.sourceMap)&&(z.sourceMap=!1,z.devtool=!1),z.fixBrowserRouter&&z.htmlPluginOption&&(z.htmlPluginOption.tags||(z.htmlPluginOption.tags=[]),z.htmlPluginOption.tags.push({textContent:"(function(l) {if (l.search[1] === '/' ) {var decoded = l.search.slice(1).split('&').map(function(s) {return s.replace(/~and~/g, '&')}).join('?');window.history.replaceState(null, null,l.pathname.slice(0, -1) + decoded + l.hash);}}(window.location))"})),"true"===o.env.CODESPACES&&(z.devServer.https=!1),!1===z.devServer.https&&"darwin"===o.platform&&(z.devServer.open=!1);export const CONFIG=z;export const PUBLICPATH=CONFIG.publicPath;
|
package/lib/index.d.mts
CHANGED
|
@@ -12,6 +12,7 @@ export type { CssInJsMinifyOption } from './loader/css-in-js-minify.cjs';
|
|
|
12
12
|
export type { ReactCompilerOption } from './loader/react-compiler.cjs';
|
|
13
13
|
export { type JsxDomExpressions, default as jsxDomExpressions } from './options/jsx-dom-expressions.mjs';
|
|
14
14
|
export { type OptimizationSplitChunksOptions, default as splitChunk } from './options/split-chunk.mjs';
|
|
15
|
+
export type { CompressionPluginOptions } from './plugin/compression.mjs';
|
|
15
16
|
export type { HtmlMeta, HtmlPluginOption } from './plugin/html-plugin.mjs';
|
|
16
17
|
export type { OverrideResolverOption } from './plugin/override-resolve.mjs';
|
|
17
18
|
export type { VirtualModulePluginOption } from './plugin/virtual-module.mjs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { compression } from '@moneko/utils';
|
|
2
2
|
import { type AssetInfo, type Compilation, type Compiler, type sources, type WebpackError } from 'webpack';
|
|
3
3
|
type Source = sources.Source;
|
|
4
|
-
interface CompressionPluginOptions {
|
|
4
|
+
export interface CompressionPluginOptions {
|
|
5
5
|
test: RegExp;
|
|
6
6
|
algorithm: 'gzip' | 'brotli';
|
|
7
7
|
}
|
package/lib/plugins.config.d.mts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import webpack, { type WebpackPluginInstance } from 'webpack';
|
|
2
|
-
import CompressionPlugin from './plugin/compression.mjs';
|
|
2
|
+
import CompressionPlugin, { type CompressionPluginOptions } from './plugin/compression.mjs';
|
|
3
3
|
import { CopyPlugin } from './plugin/copy.mjs';
|
|
4
4
|
import { HtmlMeta, HtmlPlugin } from './plugin/html-plugin.mjs';
|
|
5
5
|
import moduleFederation from './plugin/module-federation.mjs';
|
|
6
6
|
import { VirtualModuleWebpackPlugin } from './plugin/virtual-module.mjs';
|
|
7
7
|
import { CONFIG } from './config.mjs';
|
|
8
|
-
import {
|
|
8
|
+
import { packageJson } from './process-env.mjs';
|
|
9
|
+
declare const compression: Partial<CompressionPluginOptions>;
|
|
9
10
|
declare const plugins: WebpackPluginInstance[];
|
|
10
11
|
export default plugins;
|
package/lib/plugins.config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"webpack";import t from"./plugin/compression.mjs";import{CopyPlugin as
|
|
1
|
+
import e from"webpack";import t from"./plugin/compression.mjs";import{CopyPlugin as o}from"./plugin/copy.mjs";import{HtmlPlugin as i}from"./plugin/html-plugin.mjs";import r from"./plugin/module-federation.mjs";import{VirtualModuleWebpackPlugin as p}from"./plugin/virtual-module.mjs";import{CONFIG as l}from"./config.mjs";import{packageJson as n}from"./process-env.mjs";let s="object"==typeof l.compression?l.compression:{},a=[...r,new p(l.virtualModule),new o(l.copy),new e.DefinePlugin({"process.env":JSON.stringify(l.env)}),new e.IgnorePlugin({resourceRegExp:/\/(__(tests|mocks)__|test|spec|e2e)\//}),...l.plugins,l.compression&&new t({algorithm:l.devServer.https?"brotli":"gzip",test:/\.(js|css|html|svg|ttf|woff|woff2|png|jpg|jpeg)$/,...s})].filter(Boolean);if(l.htmlPluginOption){let e={charset:"UTF-8","X-UA-Compatible":{"http-equiv":"X-UA-Compatible",content:"IE=edge,Chrome=1"},HandheldFriendly:"true",MobileOptimized:"320","screen-orientation":"portrait","x5-orientation":"portrait",browsermode:"application","x5-page-mode":"app","msapplication-tap-highlight":"no","mobile-web-app-capable":"yes",renderer:"webkit",description:n.description,keywords:Array.isArray(n.keywords)?n.keywords.toString():"","http-equiv":"refresh",viewport:"width=device-width, initial-scale=1"};l.seo&&(e.relCanonical={rel:"canonical",href:`https://${l.seo.domain}${l.basename}`}),l.htmlPluginOption.meta&&Object.assign(e,l.htmlPluginOption.meta),a.push(new i({...l.htmlPluginOption,meta:e}))}if(l.fixBrowserRouter){let e=l.basename.split("/").filter(Boolean).length,t=`${Array(e).fill("..").join("/")+(e?"/":"")}404.html`,o=l.fixBrowserRouter.pathSegmentsToKeep??e;a.push(new i({filename:l.fixBrowserRouter.path??t,inject:!1,templateContent:()=>`<html lang="en"><head><title>Redirect</title><script>const pathKeep = ${o};const l = window.location;l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + l.pathname.split('/').slice(0, 1 + pathKeep).join('/') + '/?/' + l.pathname.slice(1).split('/').slice(pathKeep).join('/').replace(/&/g, '~and~') + (l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') + l.hash);</script></head><body></body></html>`}))}l.sourceMap&&a.push(new e.SourceMapDevToolPlugin(l.sourceMap));export default a;
|
package/package.json
CHANGED
package/typings/global.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ import type {
|
|
|
18
18
|
CssInJsMinifyOption,
|
|
19
19
|
HtmlPluginOption,
|
|
20
20
|
JsxDomExpressions,
|
|
21
|
+
CompressionPluginOptions,
|
|
21
22
|
OptimizationSplitChunksOptions,
|
|
22
23
|
OverrideResolverOption,
|
|
23
24
|
ProxyConfig,
|
|
@@ -521,6 +522,10 @@ export declare type ConfigType = {
|
|
|
521
522
|
* @description `512000` 打包体积小,速度更慢;
|
|
522
523
|
*/
|
|
523
524
|
minChunkSize?: number;
|
|
525
|
+
/**
|
|
526
|
+
* 是否进行压缩
|
|
527
|
+
*/
|
|
528
|
+
compression?: boolean | Partial<CompressionPluginOptions>;
|
|
524
529
|
};
|
|
525
530
|
|
|
526
531
|
/**
|