@moneko/core 4.1.1 → 4.1.2
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 +1 -1
- package/package.json +1 -1
package/lib/common.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{extname as e,join as t,resolve as s}from"node:path";import o,{config_files as
|
|
1
|
+
import{extname as e,join as t,resolve as s}from"node:path";import{createDir as o}from"@moneko/utils";import a,{config_files as n,CUSTOMCONFIG as i,TMP_DIR as r}from"./commom/paths.mjs";import l from"./commom/rule.mjs";import{OverrideResolverPlugin as m}from"./plugin/override-resolve.mjs";import{isObject as c,resolveProgram as p}from"./utils/index.mjs";import{CONFIG as u}from"./config.mjs";import h from"./plugins.config.mjs";import{app_schema as d,CACHE_NAME as f,isCI as g,isDev as y,isLibrary as b,packageJson as j,projectNameCamelCase as v}from"./process-env.mjs";export const outputConfig={path:p(b?"docs":"dist"),filename:e=>e.filename?.includes(".worker")?"worker/[name].js":"js/[name].[contenthash].bundle.js",chunkFilename:"js/[contenthash].chunk.js",cssFilename:"style/[contenthash].css",cssChunkFilename:"style/[contenthash].chunk.css",assetModuleFilename:t=>{let s=e(t.filename||"").substring(1);return`assets/${s}/[hash][ext]`},library:{name:`${v}`,type:"umd",umdNamedDefine:!0},globalObject:"self",chunkLoadingGlobal:`webpackJsonp_${j.name}`,pathinfo:y,clean:!0,publicPath:u.publicPath,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"use-credentials",enabledWasmLoadingTypes:["fetch"],uniqueName:`${v}`};let C={main:[`${d}:entry`]},P=[t(a.corePath,"./polyfills/public-path.mjs")];if(y&&u.refresh&&u.env.injectRemoteReactRefresh&&P.push(t(a.corePath,"./polyfills/inject-react-refresh.mjs")),u.polyfill&&P.push(t(a.corePath,"./polyfills/replace-children.mjs")),u.entry&&("string"==typeof u.entry?C={...C,main:[u.entry]}:Object.keys(u.entry)&&(C=Object.assign(C,u.entry))),"string"==typeof C.main?C.main=[...P,C.main]:Array.isArray(C.main)&&(C.main=[...P,...C.main]),u.output){if("string"==typeof u.output)outputConfig.path=u.output;else if(Object.keys(u.output)){let e=u.output,t={...outputConfig.library};Object.assign(outputConfig,e),"object"==typeof u.output&&e.library&&(outputConfig.library=Object.assign(t,e.library))}}let k={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:a.webpackCachePath,memoryCacheUnaffected:!0,name:f,version:`${j.version}`,buildDependencies:{config:n},maxMemoryGenerations:1};if(!1===u.cache?k=!1:c(u.cache)&&(k=Object.assign(k,u.cache)),g&&(void 0===u.cache||u.cache&&!u.cache.cacheDirectory)){let e=s(r,j.name);o(e)&&(k.cacheDirectory=e)}let x={},M={imports:!0,entries:!0,test:e=>{let s=e.nameForCondition();return!!(s&&(/^[a-z][a-z0-9]*:.+$/.test(s)||s?.startsWith(t(a.programPath,"src"))||s?.startsWith(t(a.programPath,"site"))||s?.startsWith(a.componentsPath)))}};u.lazyCompilation&&y&&"true"!==process.env.IS_BUILD?c(u.lazyCompilation)?Object.assign(x,M,u.lazyCompilation):Object.assign(x,M):x=!1;export const commonConfig={name:"client",target:"web",devtool:u.devtool,entry:C,mode:u.mode??"production",cache:k,snapshot:{immutablePaths:[a.pnpmNodeModules,a.denoNodeModules,l.node_modules],managedPaths:[a.pnpmNodeModules,a.denoNodeModules,l.node_modules],resolveBuildDependencies:{timestamp:!0,hash:!0},resolve:{timestamp:!0,hash:!0},module:{timestamp:!0,hash:!0},buildDependencies:{timestamp:!0,hash:!0},contextModule:{timestamp:!0,hash:!0}},stats:"errors-only",infrastructureLogging:{level:"error"},externalsPresets:u.externalsPresets,plugins:h,node:{global:!1,__filename:!1,__dirname:!1},experiments:{asyncWebAssembly:!0,cacheUnaffected:!0,lazyCompilation:x,buildHttp:c(u.buildHttp)?{allowedUris:[],lockfileLocation:s(a.httpCachePath,"http.lock"),cacheLocation:s(a.httpCachePath,"data"),upgrade:!0,...u.buildHttp}:u.buildHttp,backCompat:!0,futureDefaults:!0,css:!0,outputModule:!1},resolve:{extensions:[".mts",".mjs",".ts",".tsx",".js",".jsx",".json",".wasm"],alias:u.alias,modules:[a.nodeModules,a.pnpmNodeModules,a.denoNodeModules],mainFields:["browser","module","main"],mainFiles:["index"],plugins:u.resolvePlugins,preferAbsolute:!0,cache:!0,fallback:{}},externals:u.externals,output:outputConfig,recordsPath:u.recordsPath};u.overrideResolve&&commonConfig.resolve.plugins.push(new m(Object.assign({original:u.alias["@"],override:i&&p(i)},u.overrideResolve)));
|