@moneko/core 3.17.17 → 3.17.18
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/build/common.mjs +1 -1
- package/lib/build/server.mjs +1 -1
- package/lib/common.mjs +1 -1
- package/lib/config.mjs +1 -1
- package/lib/module.config.mjs +1 -1
- package/lib/options/split-chunk.mjs +1 -1
- package/lib/rule.d.mts +0 -1
- package/lib/rule.mjs +1 -1
- package/package.json +1 -1
- package/typings/global.d.ts +9 -2
package/lib/build/common.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"mini-css-extract-plugin";import i from"terser-webpack-plugin";import n from"webpack";import{BundleAnalyzerPlugin as
|
|
1
|
+
import e from"mini-css-extract-plugin";import i from"terser-webpack-plugin";import n from"webpack";import{BundleAnalyzerPlugin as r}from"webpack-bundle-analyzer";import{merge as m}from"webpack-merge";import{commonConfig as t}from"../common.mjs";import{CONFIG as o}from"../config.mjs";import{getMinifyOption as s}from"../options/js-minify.mjs";import{LightningCssMinifyPlugin as l}from"../plugin/lightningcss-plugin.mjs";import{getLightningCssTargets as p}from"../polyfills/targets.mjs";let{optimize:{MinChunkSizePlugin:a}}=n,u=[];o.minifier&&(u.push(new i(s(o.minifier.type,o.minifier.options))),u.push(new l({targets:p()})));let c=m(t,{plugins:[new e({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",ignoreOrder:!0}),o.splitChunk&&new a({minChunkSize:1e4}),o.bundleAnalyzer&&new r({analyzerMode:"static",reportFilename:"report.html",openAnalyzer:!1,defaultSizes:"gzip",logLevel:"silent",...o.bundleAnalyzer})].filter(Boolean),optimization:{concatenateModules:!0,realContentHash:!0,sideEffects:!0,usedExports:!0,providedExports:!0,emitOnErrors:!0,flagIncludedChunks:!0,innerGraph:!1,mangleExports:"deterministic",splitChunks:o.splitChunk,runtimeChunk:o.runtimeChunk,chunkIds:"deterministic",moduleIds:"deterministic",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,mangleWasmImports:!1,minimize:!0,minimizer:u}});export default c;
|
package/lib/build/server.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../module.config.mjs";import{CUSTOMCONFIG as s}from"../paths.mjs";import{isLibrary as t}from"../process-env.mjs";import{resolveProgram as
|
|
1
|
+
import e from"../module.config.mjs";import{CUSTOMCONFIG as s}from"../paths.mjs";import{isLibrary as t}from"../process-env.mjs";import{resolveProgram as r}from"../utils/index.mjs";let m={name:"server",target:"node",dependencies:["client"],entry:{main:r("site/ssr.tsx")},output:{path:r(`${t?"docs":"dist"}/server`),library:{type:"commonjs2",umdNamedDefine:!1},filename:"[name].cjs",chunkFilename:"[chunkhash].cjs",globalObject:"global"},cache:{type:"filesystem",name:[s,process.env.NODE_ENV,"server"].filter(Boolean).join("-")},externalsPresets:{node:!0},externals:[],module:e(!0)};export default m;
|
package/lib/common.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CONFIG as e,PUBLICPATH as t}from"./config.mjs";import o,{CUSTOMCONFIG as s}from"./paths.mjs";import
|
|
1
|
+
import{CONFIG as e,PUBLICPATH as t}from"./config.mjs";import o,{CUSTOMCONFIG as s}from"./paths.mjs";import a from"./plugin/override-resolve.mjs";import n from"./plugins.config.mjs";import{PACKAGENAME as i,PACKAGEVERSION as r,isDev as l,isLibrary as p}from"./process-env.mjs";import m from"./rule.mjs";import{isObject as c,node_modules as u,resolveProgram as h}from"./utils/index.mjs";import{join as d,resolve as f}from"path";import{exampleModuleName as g}from"./vm/example.mjs";export const outputConfig={path:h(p?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${l?"name":"contenthash"}].js`,assetModuleFilename:e=>{let t=e.filename;return t?.endsWith("?url")&&m.worker_file.test(t.replace("?url",""))?"worker/[name][ext]":"assets/[name][hash][ext]"},library:{name:i,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${i}`,pathinfo:l,clean:!0,publicPath:t,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"use-credentials",enabledWasmLoadingTypes:["fetch"],hotUpdateChunkFilename:"[id].[fullhash].hot.js",hotUpdateMainFilename:"[runtime].[fullhash].hot.json"};let y={main:[e.polyfill&&d(o.corePath,"./polyfills/replace-children.mjs"),u("@app/entry")].filter(Boolean)};e.entry&&("string"==typeof e.entry?y={main:[e.entry]}:Object.keys(e.entry)&&(y=Object.assign(y,e.entry))),"string"==typeof y.main&&(y.main=[y.main]),e.output&&("string"==typeof e.output?outputConfig.path=e.output:Object.keys(e.output)&&Object.assign(outputConfig,e.output));let b=!1;c(e.cache)&&(b=Object.assign({type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:o.webpackCachePath,memoryCacheUnaffected:!0,idleTimeoutForInitialStore:0,cacheUnaffected:!0,name:[s,process.env.NODE_ENV].filter(Boolean).join("-"),version:r,profile:!0},e.cache));let j=Object.assign({original:e.alias["@"],override:s&&h(s)},e.overrideResolve);export const commonConfig={name:"client",target:"web",devtool:e.devtool,entry:y,mode:l?"development":"production",stats:"errors-only",cache:b,infrastructureLogging:{level:"error"},performance:{maxAssetSize:307200,maxEntrypointSize:307200,assetFilter:e=>e.endsWith(".js")},externalsPresets:e.externalsPresets,plugins:n,node:{global:!1},experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:l&&{imports:!0,entries:!0,test:e=>{let t=e.nameForCondition();return!!(t&&(t.startsWith(u(g))||t.startsWith(u("@app/comment"))||t.startsWith(o.pagesPath)||t.startsWith(o.componentsPath)))}},buildHttp:c(e.buildHttp)?{allowedUris:[],lockfileLocation:f(o.httpCachePath,"http.lock"),cacheLocation:f(o.httpCachePath,"data"),upgrade:!0,...e.buildHttp}:e.buildHttp,backCompat:!0,futureDefaults:!0,css:!1,outputModule:!1},resolve:{extensions:["...",".jsx",".ts",".tsx"],alias:e.alias,modules:[o.nodeModules,o.pnpmNodeModules],mainFields:["browser","module","main"],mainFiles:["index"],plugins:[e.overrideResolve&&new a(j),...e.resolvePlugins].filter(Boolean),fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},externals:e.externals,output:outputConfig};
|
package/lib/config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{merge as e}from"webpack-merge";import o from"./options/jsx-dom-expressions.mjs";import t from"./options/split-chunk.mjs";import s,{CUSTOMCONFIG as i}from"./paths.mjs";import{APPTYPE as
|
|
1
|
+
import{merge as e}from"webpack-merge";import o from"./options/jsx-dom-expressions.mjs";import t from"./options/split-chunk.mjs";import s,{CUSTOMCONFIG as i}from"./paths.mjs";import{APPTYPE as n,FRAMEWORK as r,NODE_ENV as a,PACKAGENAME as l,isDev as m,isLibrary as p,isMobile as c,jsxImportSource as u,mainDirectory as d}from"./process-env.mjs";import{isFunction as f,resolveProgram as h}from"./utils/index.mjs";import g from"./utils/read-conf.mjs";import x from"./utils/setup-env.mjs";import{fileExists as v}from"@moneko/utils";let P=["@moneko","neko-ui","antd","@antv","katex","font-pingfang-sc","font-pingfang-tc","react-photo-view","react-markdown-editor-lite","schema-design","@app",".cache/http/data"],w={devtool:m?"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:x(a,n,r),basename:"/",publicPath:"/",rem:{designSize:c?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":h(d)},moduleRules:[],prefixJsLoader:[],cssModules:[],cssModuleDefinition:!0,importOnDemand:{},proxy:{},devServer:{host:"localhost",port:3e3},htmlPluginOption:{},copy:{},routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:t,runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:P,js:P,media:P,font:P,wasm:[]},mdx:{jsx:!1,development:m,jsxImportSource:u,providerImportSource:`@moneko/${r}/mdx`},jsxDomExpressions:o,bar:{name:"Client",color:"#6f42c1"},normalizeCss:!0,externalsPresets:{},buildHttp:void 0,virtualModule:{},cssExtract:{},externals:["@swc/core"]};async function j(e,o){if(o&&v(e)){let t=(await g(e,o)).default;return f(t)?t(process):t}return{}}p&&(w.alias=Object.assign(w.alias,{"@pkg":s.componentsPath,[l]:s.componentsPath}));let k=w;(!1===(k=e(k,await j(s.configPath,"index"),await j(s.customConfigPath,i))).devtool||!1===k.sourceMap)&&(k.sourceMap=!1,k.devtool=!1),k.fixBrowserRouter&&k.htmlPluginOption&&(k.htmlPluginOption.tags||(k.htmlPluginOption.tags=[]),k.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))"}));export const CONFIG=k;export const PUBLICPATH=CONFIG.publicPath||"/";
|
package/lib/module.config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
let e;import{CONFIG as s}from"./config.mjs";import o from"./options/modify-vars.mjs";import t from"./options/swcrc.mjs";import r,{CUSTOMCONFIG as
|
|
1
|
+
let e;import{CONFIG as s}from"./config.mjs";import o from"./options/modify-vars.mjs";import t from"./options/swcrc.mjs";import r,{CUSTOMCONFIG as a}from"./paths.mjs";import{getLightningCssTargets as n}from"./polyfills/targets.mjs";import{FRAMEWORK as i,isDev as m,isLibrary as l}from"./process-env.mjs";import d from"./rule.mjs";import c from"./utils/has-pkg.mjs";import{node_modules as p,resolveProgram as u}from"./utils/index.mjs";import f from"./utils/svg-to-data-uri.mjs";import{comment as y,getCommentPath as j}from"./vm/docs.mjs";import v from"./vm/generate-doc.mjs";import g from"./options/css-extract.mjs";import{saveFileSync as h}from"@moneko/utils";import x from"./utils/reactive-object.mjs";import w from"./options/reslove.mjs";let M={loader:`${r.corePath}/loader/lightningcss.cjs`,options:{sourceMap:!!s.sourceMap,analyzeDependencies:!1,targets:n(),drafts:{nesting:!0,customMedia:!0},errorRecovery:!1,unusedSymbols:[],rem:!!s.rem}},_={loader:w.lessLoader,options:{sourceMap:!!s.sourceMap,lessOptions:{modifyVars:o,javascriptEnabled:!0}}},L=[...s.cssModules,`@moneko/${i}`,"neko-ui"].map(p),P=["components","example","mock","site","src","server"].map(u);function $(e){return[...P,...s.rulesInclude?.[e]?.map(p)||[]]}a&&P.push(u(a)),s.overrideResolve&&s.overrideResolve.override&&P.push(s.overrideResolve.override);let k=$("css"),O=$("js"),b=$("media"),I=$("wasm"),R=$("font");w.sassLoader&&(e={loader:w.sassLoader,options:{implementation:await import("sass"),sassOptions:{}}});let B=l&&m&&{test:d.tsdoc,include:s.alias["@pkg"],exclude:[d.node_modules,d.__tests__],enforce:"pre",loader:`${r.corePath}/loader/ts-doc.cjs`,options:{comment:y,generateDoc:v,getCommentPath:j}},C=[{resourceQuery:/raw/i,type:"asset/source"},{resourceQuery:/url/i,type:"asset/resource",generator:{filename:e=>{let s=e.filename;return s&&s.endsWith("wasm?url")?"wasm/[name][ext]":"assets/[name][ext]"}}},{test:d.wasm,type:"webassembly/async",include:I},{test:d.txt,type:"asset/source"},{test:d.ico,type:"asset/inline",include:b},{test:d.svg,type:"asset/inline",generator:{dataUrl:e=>f(e.toString())},include:b},{test:d.image,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/images/[name][ext]"},include:b},{test:d.video,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[name][ext]"},include:b},{test:d.font,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[name][ext]"},include:R}],D=s.prefixJsLoader.filter(Boolean)||[];m?c("solid-refresh")&&"solid"===i&&D.unshift(`${r.corePath}/loader/solid-refresh.cjs`):c("@moneko/css")&&D.unshift(`${r.corePath}/loader/css-in-js-minify.cjs`);let S=new x({});function z(e){S.setData(`${e.resourcePath}.d.ts`,e.exports.map(({name:e,value:s})=>`export const ${e}: '${s}';`).join("\n")+"\n")}S.on("change",(e,s)=>{h(e,s)});export default(o=>{let a={loader:w.swcLoader,options:t(o)},n={loader:w.cssLoader,options:{modules:{auto:e=>{if(e){for(let s=0,o=L.length;s<o;s++)if(e.includes(L[s]))return d.css_module.test(e)}return d.node_modules_css_module.test(e)},localIdentName:"[path][name]_[local]",exportLocalsConvention:"dashesOnly",exportOnlyLocals:o,getJSON:s.cssModuleDefinition?z:void 0},importLoaders:2}};return{parser:{javascript:{commonjsMagicComments:!0,dynamicImportMode:"lazy",dynamicImportPrefetch:!1,dynamicImportPreload:!1,importMeta:!0,importMetaContext:!0}},noParse:s.noParse,rules:[B,{oneOf:[...C,{test:d.js,use:[...D,a],include:O},{test:d.css,use:[g,w.cssLoader,M],include:k},e&&{test:d.scss,use:[g,n,M,e],include:k},{test:d.less,use:[g,n,M,_],include:k},{test:d.markdown,use:[...D,{loader:`${r.corePath}/loader/mdx.cjs`,options:s.mdx}],exclude:[d.node_modules]}].filter(Boolean)},...s.moduleRules].filter(Boolean)}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
let
|
|
1
|
+
let t=function(){let t={priority:-10,reuseExistingChunk:!0};return function(e){return{...t,test:e}}}(),e={chunks:"all",minSize:1024,minChunks:1,hidePathInfo:!0,cacheGroups:{CHANGELOG:t(/CHANGELOG\.md/),site:t(/site/)}};export default e;
|
package/lib/rule.d.mts
CHANGED
package/lib/rule.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default{js:/\.(cj|mj|t|j)s(|x)$/i,css:/\.css$/i,less:/\.less$/i,scss:/\.(sa|sc)ss$/i,wasm:/\.wasm$/i,txt:/\.txt$/i,ico:/\.ico$/i,svg:/\.svg$/i,image:/\.(gif|png|jpe?g|webp)$/i,video:/\.(webm|mp4|ogv)$/i,font:/\.(woff2?|eot|ttf|otf)(\?.*)?$/i,markdown:/\.mdx?$/i,tsdoc:/^(?![._]).*(?<!\.test)\.(tsx?)$/,css_module:/(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i,node_modules_css_module:/(^(?!.*node_modules))(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i,
|
|
1
|
+
export default{js:/\.(cj|mj|t|j)s(|x)$/i,css:/\.css$/i,less:/\.less$/i,scss:/\.(sa|sc)ss$/i,wasm:/\.wasm$/i,txt:/\.txt$/i,ico:/\.ico$/i,svg:/\.svg$/i,image:/\.(gif|png|jpe?g|webp)$/i,video:/\.(webm|mp4|ogv)$/i,font:/\.(woff2?|eot|ttf|otf)(\?.*)?$/i,markdown:/\.mdx?$/i,tsdoc:/^(?![._]).*(?<!\.test)\.(tsx?)$/,css_module:/(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i,node_modules_css_module:/(^(?!.*node_modules))(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i,node_modules:/node_modules/,__tests__:/(.+)\/__tests__\/(.+)/,dev_watch_ignored:/node_modules(?![\\/]@app)/,worker_file:/(?:webworker|worker)(\.|\b).*\.(js|ts)\b/,extract_func:/"rr\((.+?)\)rr"/g};
|
package/package.json
CHANGED
package/typings/global.d.ts
CHANGED
|
@@ -18,6 +18,9 @@ import type {
|
|
|
18
18
|
ResolvePluginInstance,
|
|
19
19
|
RuleSetRule,
|
|
20
20
|
WebpackPluginInstance,
|
|
21
|
+
ModuleOptions,
|
|
22
|
+
FileCacheOptions,
|
|
23
|
+
MemoryCacheOptions
|
|
21
24
|
} from 'webpack';
|
|
22
25
|
import type { PluginOptions as MiniCssExtractPluginOptions } from 'mini-css-extract-plugin';
|
|
23
26
|
import type { CopyPluginOption } from '../lib/plugin/copy.mjs';
|
|
@@ -213,8 +216,10 @@ export declare type ConfigType = {
|
|
|
213
216
|
importOnDemand?: SwcImportOnDemandTransform;
|
|
214
217
|
/** 开发服务器代理 */
|
|
215
218
|
proxy?: ProxyConfig;
|
|
216
|
-
/**
|
|
217
|
-
|
|
219
|
+
/**
|
|
220
|
+
* 缓存配置
|
|
221
|
+
*/
|
|
222
|
+
cache?: FileCacheOptions | MemoryCacheOptions | false;
|
|
218
223
|
/** 开发服务器设置 */
|
|
219
224
|
devServer: {
|
|
220
225
|
headers?: Record<string, string>;
|
|
@@ -340,6 +345,8 @@ export declare type ConfigType = {
|
|
|
340
345
|
buildHttp?: HttpUriOptions | (string | RegExp | ((uri: string) => boolean))[];
|
|
341
346
|
/** MiniCssExtractPlugin 配置项 */
|
|
342
347
|
cssExtract?: MiniCssExtractPluginOptions;
|
|
348
|
+
/** 不进行编译不进行模块化分析 */
|
|
349
|
+
noParse?: ModuleOptions['noParse'];
|
|
343
350
|
};
|
|
344
351
|
/**
|
|
345
352
|
* 用于构建 http 资源的选项
|