@moneko/core 3.17.34 → 3.17.36

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/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 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{isObject as m,node_modules as c,resolveProgram as u}from"./utils/index.mjs";import{join as h,resolve as d,extname as f}from"path";import{exampleModuleName as g}from"./vm/example.mjs";export const outputConfig={path:u(p?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${l?"name":"contenthash"}].js`,assetModuleFilename:e=>{let t=f(e.filename||"").substring(1);return`assets/${t?`${t}/`:""}[name]${"js"===t?"":"[hash]"}[ext]`},library:{name:i,type:"this"},globalObject:"this",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&&h(o.corePath,"./polyfills/replace-children.mjs"),c("@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;m(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&&u(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:512e3,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(c(g))||t.startsWith(c("@app/comment"))||t.startsWith(o.pagesPath)||t.startsWith(o.componentsPath)))}},buildHttp:m(e.buildHttp)?{allowedUris:[],lockfileLocation:d(o.httpCachePath,"http.lock"),cacheLocation:d(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};
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{isObject as m,node_modules as c,resolveProgram as u}from"./utils/index.mjs";import{join as h,resolve as d,extname as f}from"path";import{exampleModuleName as g}from"./vm/example.mjs";export const outputConfig={path:u(p?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${l?"name":"contenthash"}].js`,assetModuleFilename:e=>{let t=f(e.filename||"").substring(1);return`assets/${t?`${t}/`:""}[name]${"js"===t?"":"[hash]"}[ext]`},library:{name:`${i}`,type:"umd"},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&&h(o.corePath,"./polyfills/replace-children.mjs"),c("@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;m(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&&u(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:512e3,assetFilter:e=>e.endsWith(".js")},externalsPresets:e.externalsPresets,plugins:n,node:{global:!1},experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:e.lazyCompilation&&l&&{imports:!0,entries:!0,test:e=>{let t=e.nameForCondition();return!!(t&&(t.startsWith(c(g))||t.startsWith(c("@app/comment"))||t.startsWith(o.pagesPath)||t.startsWith(o.componentsPath)))}},buildHttp:m(e.buildHttp)?{allowedUris:[],lockfileLocation:d(o.httpCachePath,"http.lock"),cacheLocation:d(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 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||"/";
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:"auto",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"],lazyCompilation:!1};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||"auto";
@@ -2,7 +2,6 @@ import webpack from 'webpack';
2
2
  export declare const PORT: number;
3
3
  export declare function devLog(err?: Error | null, stats?: webpack.Stats): void;
4
4
  export declare const headers: {
5
- 'X-Content-Type-Options': string;
6
5
  'Access-Control-Allow-Origin': string;
7
6
  'Access-Control-Allow-Headers': string;
8
7
  };
@@ -1,3 +1,3 @@
1
- import e from"chalk";import{getIPv4 as o,getPort as t}from"./net.mjs";import{CONFIG as r}from"../config.mjs";import s from"../utils/log.mjs";let{yellow:n,green:i,grey:l,gray:c,bgBlue:m,bgGreenBright:a,blueBright:p,greenBright:d}=e,$=r.devServer.port||3e3;export const PORT=await t($,r.devServer.host);r.devServer.port=PORT;let f="/"===r.basename?"":r.basename,u=$!==PORT&&c(`Port ${n($)} is in use, trying ${i(PORT)} instead.
2
- `);function v(e){return`http://${"local"===e?r.devServer.host:o()}:${PORT}${f}`}let T=c("You application is running here:"),O=`${m(" Local ")} ${p(v("local"))}
3
- ${a(" Network ")} ${d(v("net"))}`;export function devLog(e,o){!e&&o&&(process.stdout.write("\x1b[2J\x1b[3J\x1b[H"),s([T,"",O,"",l(`Compiled successfully in ${i(`${o.endTime-o.startTime}ms`)}`)]),u&&s(u))}export const headers={"X-Content-Type-Options":"nosniff","Access-Control-Allow-Origin":"*","Access-Control-Allow-Headers":"*"};
1
+ import e from"chalk";import{getIPv4 as o,getPort as t}from"./net.mjs";import{CONFIG as r}from"../config.mjs";import s from"../utils/log.mjs";let{yellow:i,green:n,grey:l,gray:c,bgBlue:m,bgGreenBright:a,blueBright:p,greenBright:d}=e,$=r.devServer.port||3e3;export const PORT=await t($,r.devServer.host);r.devServer.port=PORT;let u="/"===r.basename?"":r.basename,v=$!==PORT&&c(`Port ${i($)} is in use, trying ${n(PORT)} instead.
2
+ `);function f(e){return`http://${"local"===e?r.devServer.host:o()}:${PORT}${u}`}let T=c("You application is running here:"),g=`${m(" Local ")} ${p(f("local"))}
3
+ ${a(" Network ")} ${d(f("net"))}`;export function devLog(e,o){!e&&o&&(process.stdout.write("\x1b[2J\x1b[3J\x1b[H"),s([T,"",g,"",l(`Compiled successfully in ${n(`${o.endTime-o.startTime}ms`)}`)]),v&&s(v))}export const headers={"Access-Control-Allow-Origin":"*","Access-Control-Allow-Headers":"*"};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.17.34",
3
+ "version": "3.17.36",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
@@ -351,6 +351,10 @@ export declare type ConfigType = {
351
351
  cssExtract?: MiniCssExtractPluginOptions;
352
352
  /** 不进行编译不进行模块化分析 */
353
353
  noParse?: ModuleOptions['noParse'];
354
+ /** 懒编译
355
+ * @default false
356
+ */
357
+ lazyCompilation?: boolean;
354
358
  };
355
359
  /**
356
360
  * 用于构建 http 资源的选项