@moneko/core 3.43.2 → 3.43.3

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.
@@ -1 +1 @@
1
- import e from"mini-css-extract-plugin";import i from"webpack";import{merge as n}from"webpack-merge";import{commonConfig as t}from"../common.mjs";import{CONFIG as r}from"../config.mjs";import{LightningCssMinifyPlugin as m}from"../plugin/lightningcss-plugin.mjs";import s from"../plugin/swc-minify-plugin.mjs";import{getLightningCssTargets as l}from"../polyfills/targets.mjs";let o=[];r.minifier&&(o.push(new s(r.minifier)),o.push(new m({targets:l()})));let p={maxAssetSize:256e3,maxEntrypointSize:256e3,assetFilter:e=>!e.endsWith(".map")&&!e.endsWith("ce28377f3a428346.js"),...r.performance},a=n(t,{performance:r.performance&&p,plugins:[new e({filename:"style/[contenthash].css",chunkFilename:"style/[contenthash].css",ignoreOrder:!0})],optimization:{splitChunks:r.splitChunk,runtimeChunk:r.runtimeChunk,chunkIds:"deterministic",moduleIds:"deterministic",concatenateModules:!0,emitOnErrors:!1,removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,minimize:!0,minimizer:o,sideEffects:!0,providedExports:!0}});if(r.splitChunk&&a.plugins?.push(new i.optimize.MinChunkSizePlugin({minChunkSize:51200})),r.bundleAnalyzer){let e=(await import("webpack-bundle-analyzer")).BundleAnalyzerPlugin;a.plugins?.push(new e({analyzerMode:"static",reportFilename:"report.html",openAnalyzer:!1,defaultSizes:"gzip",logLevel:"silent",...r.bundleAnalyzer}))}export default a;
1
+ import e from"mini-css-extract-plugin";import i from"webpack";import{merge as n}from"webpack-merge";import{commonConfig as t}from"../common.mjs";import{CONFIG as r}from"../config.mjs";import{LightningCssMinifyPlugin as m}from"../plugin/lightningcss-plugin.mjs";import s from"../plugin/swc-minify-plugin.mjs";import{getLightningCssTargets as l}from"../polyfills/targets.mjs";let o=[];r.minifier&&(o.push(new s(r.minifier)),o.push(new m({targets:l()})));let p={maxAssetSize:256e3,maxEntrypointSize:256e3,assetFilter:e=>!e.endsWith(".map")&&!e.endsWith("ce28377f3a428346.js"),...r.performance},a=n(t,{performance:r.performance&&p,plugins:[new e({filename:"style/[contenthash].css",chunkFilename:"style/[contenthash].css",ignoreOrder:!0})],optimization:{splitChunks:r.splitChunk,runtimeChunk:r.runtimeChunk,chunkIds:"deterministic",moduleIds:"deterministic",concatenateModules:!0,emitOnErrors:!1,removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,minimize:!0,minimizer:o,sideEffects:!0,providedExports:!0}});if(r.splitChunk&&a.plugins?.push(new i.optimize.MinChunkSizePlugin({minChunkSize:r.minChunkSize||1e3})),r.bundleAnalyzer){let e=(await import("webpack-bundle-analyzer")).BundleAnalyzerPlugin;a.plugins?.push(new e({analyzerMode:"static",reportFilename:"report.html",openAnalyzer:!1,defaultSizes:"gzip",logLevel:"silent",...r.bundleAnalyzer}))}export default a;
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 w}from"./process-env.mjs";let k=["@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:w.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:k,js:k,media:k,font:k,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}};v&&(I.alias=Object.assign(I.alias,{"@pkg":n.componentsPath,[w]: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};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 +1 @@
1
- "use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return o}});const t=require("@moneko/mdx"),r=(e=require("../commom/log.mjs"))&&e.__esModule?e:{default:e};async function o(e){let o=this.async();this.cacheable&&this.cacheable();try{let r=await (0,t.mdx)({value:e,filepath:this.resourcePath,...this.getOptions()});o(null,r.code)}catch(e){o(e),(0,r.default)(Error(e))}}
1
+ "use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return o}});const t=require("@moneko/mdx"),r=(e=require("../commom/log.mjs"))&&e.__esModule?e:{default:e};async function o(e){let o=this.async();this.cacheable&&this.cacheable(),(0,t.mdx)({value:e,filepath:this.resourcePath,...this.getOptions()}).then(e=>{o(null,e.code)}).catch(e=>{o(e),(0,r.default)(Error(e))})}
@@ -1 +1 @@
1
- "use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return l}});const r=require("@moneko/eslint/babel-core"),t=require("@moneko/eslint/react-compiler"),o=(e=require("../commom/log.mjs"))&&e.__esModule?e:{default:e};async function l(e){let l=this.async();this.cacheable&&this.cacheable(),(0,r.transform)(e,{sourceFileName:this.resourcePath,filename:this.resourcePath,sourceMaps:!1,plugins:[[t.BabelPluginReactCompiler,this.getOptions()]],cloneInputAst:!1,ast:!1,configFile:!1,babelrc:!1},(r,t)=>{if(r){(0,o.default)(r),l(r,e);return}if(null===t){l(Error(`Failed to transform "${this.resourcePath}"`));return}l(null,t.code||"",null===t.map?void 0:t.map)})}
1
+ "use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return r}});const t=require("@moneko/eslint/babel-core"),s=require("@moneko/eslint/react-compiler"),o=(e=require("../commom/log.mjs"))&&e.__esModule?e:{default:e};function r(e){let r=this.async();this.cacheable&&this.cacheable();let i=this.getOptions();("annotation"===i.compilationMode?e.includes("use memo")||e.includes("use forget"):e.includes("react")||this.resourcePath.endsWith(".tsx")||this.resourcePath.endsWith(".jsx"))?(0,t.transformAsync)(e,{sourceFileName:this.resourcePath,filename:this.resourcePath,sourceMaps:"inline",plugins:[[s.BabelPluginReactCompiler,i]],cloneInputAst:!1,ast:!1,configFile:!1,babelrc:!1}).then(t=>{null===t?r(Error(`Failed to transform "${this.resourcePath}"`),e):r(null,t.code??void 0,t.map??void 0)}).catch(t=>{t&&((0,o.default)(t),r(t,e))}):r(null,e)}
@@ -1,4 +1,4 @@
1
- import { transform } from '@moneko/eslint/babel-core';
1
+ import { transformAsync } from '@moneko/eslint/babel-core';
2
2
  import { BabelPluginReactCompiler } from '@moneko/eslint/react-compiler';
3
3
  import type { LoaderContext } from 'webpack';
4
4
  import log from '../commom/log.mjs';
@@ -18,4 +18,4 @@ export interface ReactCompilerOption {
18
18
  gating?: null;
19
19
  eslintSuppressionRules?: Record<string, string | boolean | number>;
20
20
  }
21
- export default async function reactCompilerLoader(this: LoaderContext<ReactCompilerOption>, sourceCode: string);
21
+ export default function reactCompilerLoader(this: LoaderContext<ReactCompilerOption>, sourceCode: string);
@@ -1 +1 @@
1
- "use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(exports,{custom:function(){return u},default:function(){return c}});const t=require("@babel/core"),n=(e=require("solid-refresh/babel"))&&e.__esModule?e:{default:e};async function r(e){let r=this.async();this.cacheable&&this.cacheable();let u=(0,t.transformSync)(e,{plugins:[[n.default,{bundler:"webpack5"}]]});r(null,u?.code||void 0,u?.map||void 0)}function u(e){return r.bind(this,e)}const c=r;
1
+ "use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(exports,{custom:function(){return o},default:function(){return i}});const t=require("@moneko/eslint/babel-core"),n=(e=require("solid-refresh/babel"))&&e.__esModule?e:{default:e};async function r(e){let r=this.async();this.cacheable&&this.cacheable();let o=await (0,t.transformAsync)(e,{plugins:[[n.default,{bundler:"webpack5"}]]});r(null,o?.code||void 0,o?.map||void 0)}function o(e){return r.bind(this,e)}const i=r;
@@ -1,4 +1,4 @@
1
- import { type TransformOptions, transformSync } from '@babel/core';
1
+ import { transformAsync, type TransformOptions } from '@moneko/eslint/babel-core';
2
2
  import BabelPluginSolidRefresh from 'solid-refresh/babel';
3
3
  import type { LoaderContext } from 'webpack';
4
4
  declare async function solidLoader(this: LoaderContext<TransformOptions & {
@@ -12,7 +12,8 @@ type RenderAppProps = {
12
12
  };
13
13
 
14
14
  export function App(props: RenderAppProps) {
15
- const router = useRoutes(routes || []);
15
+ 'use memo';
16
+ const router = useRoutes(routes ?? []);
16
17
 
17
18
  return router;
18
19
  }
@@ -0,0 +1,20 @@
1
+ import { parentPort } from 'node:worker_threads';
2
+ import { transform } from '@moneko/eslint/babel-core';
3
+ import { BabelPluginReactCompiler } from '@moneko/eslint/react-compiler';
4
+ import log from '../commom/log.mjs';
5
+ export interface ReactCompilerOption {
6
+ target?: '17' | '18' | '19';
7
+ sources?(filename: string): boolean;
8
+ compilationMode?: 'annotation' | 'infer' | 'syntax' | 'all';
9
+ logger?: {
10
+ logEvent?: (fileName: string, event: MessageEvent) => void;
11
+ };
12
+ noEmit?: boolean;
13
+ flowSuppressions?: boolean;
14
+ ignoreUseNoForget?: boolean;
15
+ enableReanimatedCheck?: boolean;
16
+ panicThreshold?: string;
17
+ environment?: unknown;
18
+ gating?: null;
19
+ eslintSuppressionRules?: Record<string, string | boolean | number>;
20
+ }
@@ -0,0 +1 @@
1
+ import{parentPort as e}from"node:worker_threads";import{transform as o}from"@moneko/eslint/babel-core";import{BabelPluginReactCompiler as r}from"@moneko/eslint/react-compiler";import s from"../commom/log.mjs";e?.on("message",async({sourceCode:m,resourcePath:l,...n})=>{o(m,{sourceFileName:l,filename:l,sourceMaps:!1,plugins:[[r,n]],cloneInputAst:!1,ast:!1,configFile:!1,babelrc:!1},(o,r)=>{if(o){s(o),e?.postMessage([o,m]);return}if(null===r){e?.postMessage([Error(`Failed to transform "${l}"`),m]);return}e?.postMessage([null,r.code||"",null===r.map?void 0:r.map])})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.43.2",
3
+ "version": "3.43.3",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
@@ -129,7 +129,7 @@
129
129
  "style-loader": "4.0.0",
130
130
  "swc-loader": "0.2.6",
131
131
  "typescript": "5.8.3",
132
- "webpack": "5.99.5",
132
+ "webpack": "5.99.6",
133
133
  "webpack-hot-middleware": "2.26.1",
134
134
  "webpack-merge": "6.0.1",
135
135
  "webpack-virtual-modules": "0.6.2"
@@ -140,7 +140,7 @@
140
140
  "@types/stylis": "4.2.7",
141
141
  "@types/webpack-bundle-analyzer": "4.7.0",
142
142
  "@types/webpack-hot-middleware": "2.25.9",
143
- "sass": "1.86.3",
143
+ "sass": "1.87.0",
144
144
  "sass-loader": "16.0.5",
145
145
  "solid-refresh": "0.7.5",
146
146
  "stylis": "4.3.6",
@@ -514,6 +514,13 @@ export declare type ConfigType = {
514
514
  */
515
515
  minify?: CssInJsMinifyOption | false;
516
516
  };
517
+ /**
518
+ * 最小 Chunk 尺寸
519
+ * @default 1000
520
+ * @description `1000` 打包体积大,速度快;
521
+ * @description `512000` 打包体积小,速度更慢;
522
+ */
523
+ minChunkSize?: number;
517
524
  };
518
525
 
519
526
  /**