@moneko/core 3.56.11 → 3.56.13

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{extname as e,join as t,resolve as o}from"node:path";import s,{config_files as a,CUSTOMCONFIG as i,TMP_DIR as n}from"./commom/paths.mjs";import{OverrideResolverPlugin as r}from"./plugin/override-resolve.mjs";import{isObject as l,node_modules as m,resolveProgram as c}from"./utils/index.mjs";import{exampleModuleName as p}from"./vm/example.mjs";import u from"./vm/info.mjs";import{CONFIG as h}from"./config.mjs";import d from"./plugins.config.mjs";import{isCI as f,isDev as b,isLibrary as g,NODE_ENV as y,packageJson as j}from"./process-env.mjs";export const outputConfig={path:c(g?"docs":"dist"),filename:"js/[name].[contenthash].bundle.js",chunkFilename:"js/[contenthash].chunk.js",assetModuleFilename:t=>{let o=e(t.filename||"").substring(1);return`assets/${o}/[hash][ext]`},library:{name:`${u.projectName}`,type:"umd",umdNamedDefine:!0},globalObject:"self",chunkLoadingGlobal:`webpackJsonp_${j.name}`,pathinfo:b,clean:!b,publicPath:h.publicPath,workerPublicPath:h.publicPath,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"use-credentials",enabledWasmLoadingTypes:["fetch"],uniqueName:`${u.projectName}`};let v={main:[m("@app/entry")]},P=[t(s.corePath,"./polyfills/public-path.mjs")];if(b&&h.refresh&&h.env.injectRemoteReactRefresh&&P.push(t(s.corePath,"./polyfills/inject-react-refresh.mjs")),h.polyfill&&P.push(t(s.corePath,"./polyfills/replace-children.mjs")),h.entry&&("string"==typeof h.entry?v={...v,main:[h.entry]}:Object.keys(h.entry)&&(v=Object.assign(v,h.entry))),"string"==typeof v.main?v.main=[...P,v.main]:Array.isArray(v.main)&&(v.main=[...P,...v.main]),h.output){if("string"==typeof h.output)outputConfig.path=h.output;else if(Object.keys(h.output)){let e=h.output,t={...outputConfig.library};Object.assign(outputConfig,e),"object"==typeof h.output&&e.library&&(outputConfig.library=Object.assign(t,e.library))}}let C={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:s.webpackCachePath,memoryCacheUnaffected:!0,name:`.${[i,y].filter(Boolean).join("-")}`,version:`${j.version}`,buildDependencies:{config:a},maxMemoryGenerations:1};!1===h.cache?C=!1:l(h.cache)&&(C=Object.assign(C,h.cache)),f&&(void 0===h.cache||h.cache&&!h.cache.cacheDirectory)&&(C.cacheDirectory=o(n,j.name));export const commonConfig={name:"client",target:"web",devtool:h.devtool,entry:v,mode:b?"development":"production",stats:"errors-only",cache:C,snapshot:{immutablePaths:[s.pnpmNodeModules,s.denoNodeModules,/node_modules\/(?!(@app)\/)/],managedPaths:[s.pnpmNodeModules,s.denoNodeModules,/node_modules\/(?!(@app)\/)/],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}},infrastructureLogging:{level:"error"},externalsPresets:h.externalsPresets,plugins:d,node:{global:!1,__filename:!1,__dirname:!1},experiments:{asyncWebAssembly:!0,cacheUnaffected:!0,lazyCompilation:h.lazyCompilation&&b&&{imports:!0,entries:!0,test:e=>{let t=e.nameForCondition();return!!(t&&(t.startsWith(m(p))||t.startsWith(m("@app/comment"))||t.startsWith(s.pagesPath)||t.startsWith(s.componentsPath)))}},buildHttp:l(h.buildHttp)?{allowedUris:[],lockfileLocation:o(s.httpCachePath,"http.lock"),cacheLocation:o(s.httpCachePath,"data"),upgrade:!0,...h.buildHttp}:h.buildHttp,backCompat:!0,futureDefaults:!0,css:!1,outputModule:!1},resolve:{extensions:[".mts",".mjs",".ts",".tsx",".js",".jsx",".json",".wasm"],alias:h.alias,modules:[s.nodeModules,s.pnpmNodeModules,s.denoNodeModules],mainFields:["browser","module","main"],mainFiles:["index"],plugins:h.resolvePlugins,preferAbsolute:!0,cache:!0,fallback:{}},externals:h.externals,output:outputConfig,recordsPath:h.recordsPath?t(s.programPath,h.recordsPath):t(s.webpackCachePath,"records.json")};h.overrideResolve&&commonConfig.resolve.plugins.push(new r(Object.assign({original:h.alias["@"],override:i&&c(i)},h.overrideResolve)));
1
+ import{extname as e,join as t,resolve as o}from"node:path";import a,{config_files as s,CUSTOMCONFIG as i,TMP_DIR as n}from"./commom/paths.mjs";import{OverrideResolverPlugin as r}from"./plugin/override-resolve.mjs";import{isObject as l,node_modules as m,resolveProgram as c}from"./utils/index.mjs";import{exampleModuleName as p}from"./vm/example.mjs";import u from"./vm/info.mjs";import{CONFIG as h}from"./config.mjs";import d from"./plugins.config.mjs";import{isCI as f,isDev as b,isLibrary as g,NODE_ENV as y,packageJson as j}from"./process-env.mjs";export const outputConfig={path:c(g?"docs":"dist"),filename:"js/[name].[contenthash].bundle.js",chunkFilename:"js/[contenthash].chunk.js",assetModuleFilename:t=>{let o=e(t.filename||"").substring(1);return`assets/${o}/[hash][ext]`},library:{name:`${u.projectName}`,type:"umd",umdNamedDefine:!0},globalObject:"self",chunkLoadingGlobal:`webpackJsonp_${j.name}`,pathinfo:b,clean:!b,publicPath:h.publicPath,workerPublicPath:h.publicPath,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"use-credentials",enabledWasmLoadingTypes:["fetch"],uniqueName:`${u.projectName}`};let v={main:[m("@app/entry")]},P=[t(a.corePath,"./polyfills/public-path.mjs")];if(b&&h.refresh&&h.env.injectRemoteReactRefresh&&P.push(t(a.corePath,"./polyfills/inject-react-refresh.mjs")),h.polyfill&&P.push(t(a.corePath,"./polyfills/replace-children.mjs")),h.entry&&("string"==typeof h.entry?v={...v,main:[h.entry]}:Object.keys(h.entry)&&(v=Object.assign(v,h.entry))),"string"==typeof v.main?v.main=[...P,v.main]:Array.isArray(v.main)&&(v.main=[...P,...v.main]),h.output){if("string"==typeof h.output)outputConfig.path=h.output;else if(Object.keys(h.output)){let e=h.output,t={...outputConfig.library};Object.assign(outputConfig,e),"object"==typeof h.output&&e.library&&(outputConfig.library=Object.assign(t,e.library))}}let C={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:a.webpackCachePath,memoryCacheUnaffected:!0,name:`.${[i,y].filter(Boolean).join("-")}`,version:`${j.version}`,buildDependencies:{config:s},maxMemoryGenerations:1};!1===h.cache?C=!1:l(h.cache)&&(C=Object.assign(C,h.cache)),f&&(void 0===h.cache||h.cache&&!h.cache.cacheDirectory)&&(C.cacheDirectory=o(n,j.name));let x={},k={imports:!0,entries:!0,test:e=>{let t=e.nameForCondition();return!!(t&&(t.startsWith(m(p))||t.startsWith(m("@app/comment"))||t.startsWith(a.pagesPath)||t.startsWith(a.componentsPath)))}};h.lazyCompilation&&b?l(h.lazyCompilation)?Object.assign(x,k,h.lazyCompilation):Object.assign(x,k):x=!1;export const commonConfig={name:"client",target:"web",devtool:h.devtool,entry:v,mode:b?"development":"production",stats:"errors-only",cache:C,snapshot:{immutablePaths:[a.pnpmNodeModules,a.denoNodeModules,/node_modules\/(?!(@app)\/)/],managedPaths:[a.pnpmNodeModules,a.denoNodeModules,/node_modules\/(?!(@app)\/)/],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}},infrastructureLogging:{level:"error"},externalsPresets:h.externalsPresets,plugins:d,node:{global:!1,__filename:!1,__dirname:!1},experiments:{asyncWebAssembly:!0,cacheUnaffected:!0,lazyCompilation:x,buildHttp:l(h.buildHttp)?{allowedUris:[],lockfileLocation:o(a.httpCachePath,"http.lock"),cacheLocation:o(a.httpCachePath,"data"),upgrade:!0,...h.buildHttp}:h.buildHttp,backCompat:!0,futureDefaults:!0,css:!1,outputModule:!1},resolve:{extensions:[".mts",".mjs",".ts",".tsx",".js",".jsx",".json",".wasm"],alias:h.alias,modules:[a.nodeModules,a.pnpmNodeModules,a.denoNodeModules],mainFields:["browser","module","main"],mainFiles:["index"],plugins:h.resolvePlugins,preferAbsolute:!0,cache:!0,fallback:{}},externals:h.externals,output:outputConfig,recordsPath:h.recordsPath?t(a.programPath,h.recordsPath):t(a.webpackCachePath,"records.json")};h.overrideResolve&&commonConfig.resolve.plugins.push(new r(Object.assign({original:h.alias["@"],override:i&&c(i)},h.overrideResolve)));
@@ -1 +1 @@
1
- import{isUint8Array as e}from"node:util/types";import{parentPort as r}from"node:worker_threads";import{compression as o}from"@moneko/utils";r?.setMaxListeners(0),r?.on("message",async({input:s,filename:t,algorithm:m})=>{let f=o(Buffer.isBuffer(s)||e(s)?Array.from(s):s,m);r?.postMessage([t,f])});
1
+ import{isUint8Array as e}from"node:util/types";import{parentPort as r}from"node:worker_threads";import{compression as s}from"@moneko/utils";r?.setMaxListeners(0),r?.on("message",async({input:o,filename:t,algorithm:m})=>{try{let a=s(Buffer.isBuffer(o)||e(o)?Array.from(o):o,m);r?.postMessage([t,a])}catch{r?.postMessage([t,o])}});
@@ -1 +1 @@
1
- let a,r;import{relative as e}from"node:path";import{parentPort as t}from"node:worker_threads";import{ESLint as o}from"@moneko/eslint";import i from"../commom/paths.mjs";if(!t)throw Error("This file must be run as a worker");t?.setMaxListeners(0),t.on("message",async({options:s})=>{a||(a=new o({cache:s.cache,cacheLocation:s.cacheLocation,cacheStrategy:s.cacheStrategy,fix:s.fix}),r=await a.loadFormatter("stylish"));let m=s.files.map(a=>(s.lintDirtyModulesOnly?e(i.programPath,a):a).replace(/\\/g,"/")),c=await a.lintFiles(m),n=[],l=[];s.fix&&await o.outputFixes(c),c.forEach(a=>{a.errorCount?l.push(a):a.warningCount&&n.push(a)});let h=await Promise.all([r.format(n,{cwd:i.programPath,rulesMeta:{}}),r.format(l,{cwd:i.programPath,rulesMeta:{}})]);t.postMessage(h.map(a=>a.replace(/[^\r\n]*(\r?\n)*$/,"")))});
1
+ let a,t;import{relative as e}from"node:path";import{parentPort as r}from"node:worker_threads";import{ESLint as o}from"@moneko/eslint";import s from"../commom/paths.mjs";if(!r)throw Error("This file must be run as a worker");r?.setMaxListeners(0),r.on("message",async({options:i})=>{try{a||(a=new o({cache:i.cache,cacheLocation:i.cacheLocation,cacheStrategy:i.cacheStrategy,fix:i.fix}),t=await a.loadFormatter("stylish"));let m=i.files.map(a=>(i.lintDirtyModulesOnly?e(s.programPath,a):a).replace(/\\/g,"/")),c=await a.lintFiles(m),n=[],h=[];i.fix&&await o.outputFixes(c),c.forEach(a=>{a.errorCount?h.push(a):a.warningCount&&n.push(a)});let l=await Promise.all([t.format(n,{cwd:s.programPath,rulesMeta:{}}),t.format(h,{cwd:s.programPath,rulesMeta:{}})]);r.postMessage(l.map(a=>a.replace(/[^\r\n]*(\r?\n)*$/,"")))}catch{r.postMessage(["",""])}});
@@ -1 +1 @@
1
- import{parentPort as e}from"node:worker_threads";import{stylelint as r}from"@moneko/stylelint";if(!e)throw Error("This file must be run as a worker");let t=await r.formatters.string;e?.setMaxListeners(0),e.on("message",async({options:a})=>{try{let i=await r.lint({cache:a.cache,cacheLocation:a.cacheLocation,fix:a.fix,files:a.files.map(e=>e.replace(/\\/g,"/")),quietDeprecationWarnings:a.quietDeprecationWarnings,quiet:a.quiet});delete i.output;let n=[],s=[];i.results.forEach(e=>{if(!e.ignored&&(e.errored||e.parseErrors.length||e.invalidOptionWarnings.length||e.deprecations.length)){let r=[],t=[];e.warnings.forEach(e=>{"error"===e.severity?r.push(e):"warning"===e.severity&&t.push(e)}),r.length>0&&n.push({...e,warnings:r}),t.length>0&&s.push({...e,warnings:t})}});let o=[t(s,i),t(n,i)];e.postMessage(o.map(e=>e.replace(/[^\r\n]*(\r?\n)*$/,"")))}catch{e.postMessage([])}});
1
+ import{parentPort as e}from"node:worker_threads";import{stylelint as r}from"@moneko/stylelint";if(!e)throw Error("This file must be run as a worker");let t=await r.formatters.string;e?.setMaxListeners(0),e.on("message",async({options:a})=>{try{let i=await r.lint({cache:a.cache,cacheLocation:a.cacheLocation,fix:a.fix,files:a.files.map(e=>e.replace(/\\/g,"/")),quietDeprecationWarnings:a.quietDeprecationWarnings,quiet:a.quiet});delete i.output;let n=[],s=[];i.results.forEach(e=>{if(!e.ignored&&(e.errored||e.parseErrors.length||e.invalidOptionWarnings.length||e.deprecations.length)){let r=[],t=[];e.warnings.forEach(e=>{"error"===e.severity?r.push(e):"warning"===e.severity&&t.push(e)}),r.length>0&&n.push({...e,warnings:r}),t.length>0&&s.push({...e,warnings:t})}});let o=[t(s,i),t(n,i)];e.postMessage(o.map(e=>e.replace(/[^\r\n]*(\r?\n)*$/,"")))}catch{e.postMessage(["",""])}});
@@ -1 +1 @@
1
- import{parentPort as r}from"node:worker_threads";import{minify as e}from"@swc/core";if(!r)throw Error("This file must be run as a worker");r?.setMaxListeners(0),r.on("message",async({buffer:o,options:s})=>{let{code:t}=await e(Buffer.from(o).toString().replace(/\r\n/g,"\n"),s);r.postMessage(t)});
1
+ import{parentPort as r}from"node:worker_threads";import{minify as e}from"@swc/core";if(!r)throw Error("This file must be run as a worker");r?.setMaxListeners(0),r.on("message",async({buffer:o,options:s})=>{try{let t=Buffer.from(o).toString().replace(/\r\n/g,"\n"),{code:a}=await e(t,s);r.postMessage(a)}catch{r.postMessage(Buffer.from(o).toString())}});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.56.11",
3
+ "version": "3.56.13",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
@@ -36,7 +36,6 @@ export type { MiniCssExtractPluginOptions, SwcMinifyOptions, TerserMinifyOptions
36
36
  export type MinifierType = 'swc' | 'terser';
37
37
  export declare type AppType = 'mobile' | 'site' | 'backstage' | 'micro' | 'library';
38
38
  export declare type Framework = 'react' | 'solid';
39
-
40
39
  export type DevtoolOption =
41
40
  | 'eval'
42
41
  | 'eval-cheap-source-map'
@@ -78,6 +77,11 @@ export interface Theme {
78
77
  errorColor?: string;
79
78
  warningColor?: string;
80
79
  }
80
+
81
+
82
+ export type Experiments = Required<Configuration>['experiments'];
83
+ export type LazyCompilationOptions = Experiments['lazyCompilation'];
84
+
81
85
  interface CacheConfig extends FileCacheOptions, MemoryCacheOptions {
82
86
  type?: 'filesystem' | 'memory';
83
87
  }
@@ -96,6 +100,7 @@ interface BarOption {
96
100
  /** 不展示进度条图形, 直接输出信息; 在 CI 中时默认为 `true`;*/
97
101
  quiet?: boolean;
98
102
  }
103
+
99
104
  export declare type ConfigType = {
100
105
  /** react jsx 运行时
101
106
  * @default 'automatic'
@@ -501,7 +506,7 @@ export declare type ConfigType = {
501
506
  /** 懒编译
502
507
  * @default false
503
508
  */
504
- lazyCompilation?: boolean;
509
+ lazyCompilation?: LazyCompilationOptions;
505
510
  /**
506
511
  * 展示性能提示
507
512
  * @description 资源(asset)和入口起点超过指定文件限制