@flatjs/evolve 1.8.1-next.57 → 1.8.1-next.58

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @flatjs/evolve
2
2
 
3
+ ## 1.8.1-next.58
4
+
5
+ ### Patch Changes
6
+
7
+ - 669474e: fix wrong print the webpack compiler error message formatting
8
+
3
9
  ## 1.8.1-next.57
4
10
 
5
11
  ### Patch Changes
@@ -1,2 +1,8 @@
1
1
  export declare const printInfo: (message: string, silent?: boolean) => void;
2
2
  export declare const printError: (message: string | Error) => void;
3
+ /**
4
+ * Do not use `logger` to print webpack compiler error, cause of it may have it's message formatting.
5
+ * @param errors
6
+ * @returns
7
+ */
8
+ export declare const printCompilerError: (errors: any) => void;
@@ -1 +1 @@
1
- import{logger}from"@flatjs/common";import{moduleName}from"../constants.js";export const printInfo=(o,r=!1)=>{r||logger.info(o,moduleName)};export const printError=o=>{logger.error(o,moduleName)};
1
+ import{logger}from"@flatjs/common";import{moduleName}from"../constants.js";export const printInfo=(o,r=!1)=>{r||logger.info(o,moduleName)};export const printError=o=>{logger.error(o,moduleName)};export const printCompilerError=o=>{if(o)if("string"==typeof o)console.log(o);else if(Array.isArray(o))for(const r of o)printCompilerError(r);else if("object"==typeof o){const r=o.stack||o.message;delete o.stack,delete o.message;const e={...o,_newMsg:r};for(const[,o]of Object.entries(e))printCompilerError(o)}};
@@ -1 +1 @@
1
- import{cpus}from"node:os";import{ensureSlash,logger,mergeOptions}from"@flatjs/common";import ora from"ora";import webpack from"webpack";import{loadWebpackConfig}from"../create-webpack/load-webpack-config.js";import{chunkEntryMap}from"../helpers/chunk-entry-map.js";import{splitToMultiCompilerConfigs}from"../helpers/split-to-multi-compiler.js";import{envVerify}from"./env-verify.js";const getMaxProcessTasks=(r,t)=>Math.max(1,"string"==typeof t&&t.endsWith("%")?Math.round(cpus().length*Number(t.slice(0,-1))/100):Number(t)||r),startSingleEntryBuild=async(r,t)=>{const o=await loadWebpackConfig("production",r,t),e=splitToMultiCompilerConfigs(r,o,t);if(e.length>1)throw new Error("startSingleEntryBuild() only support `compiler` at a time");const n=e[0];return new Promise(((r,o)=>{webpack(n,((e,s)=>{if(e)return o(e);const i=s?.toJson();return i?.errors?.length?o(i.errors):t.rejectWarnings&&i?.warnings?.length?o(i.warnings):void r({name:n.name,warningStats:i?.warnings})}))}))};export const prepareBuild=async(r,t,o)=>{await envVerify(r,o);const e=o.multiHtmlCdn?.prod||[];if(!e.length)throw new Error('No CDN configuration for env: "prod"');const n=ensureSlash(e[Math.floor(Math.random()*e.length)],!0),s=[],i=chunkEntryMap(t,getMaxProcessTasks(Object.keys(t).length,o.maxProcesses)),a=i.length;logger.info(`Preparing to run total ${a} tasks...`);for(let r=0;r<a;r++){const t=i[r],e=ora(`Run building task id:${r+1} ...`).start(),a=[];for(const[r,e]of Object.entries(t)){const t={[r]:e},s=e.options?.useRelativeAssetPath;a.push(startSingleEntryBuild(t,mergeOptions(o,{webpack:{publicPath:s?"auto":n}})))}const l=await Promise.all(a);s.push(...l),e.succeed()}return s};
1
+ import{cpus}from"node:os";import{ensureSlash,logger,mergeOptions}from"@flatjs/common";import ora from"ora";import webpack from"webpack";import{loadWebpackConfig}from"../create-webpack/load-webpack-config.js";import{chunkEntryMap}from"../helpers/chunk-entry-map.js";import{printCompilerError}from"../helpers/print-log.js";import{splitToMultiCompilerConfigs}from"../helpers/split-to-multi-compiler.js";import{envVerify}from"./env-verify.js";const getMaxProcessTasks=(r,t)=>Math.max(1,"string"==typeof t&&t.endsWith("%")?Math.round(cpus().length*Number(t.slice(0,-1))/100):Number(t)||r),startSingleEntryBuild=async(r,t)=>{const o=await loadWebpackConfig("production",r,t),e=splitToMultiCompilerConfigs(r,o,t);if(e.length>1)throw new Error("startSingleEntryBuild() only support `compiler` at a time");const n=e[0];return new Promise(((r,o)=>{webpack(n,((e,s)=>{if(e)return o(e);const i=s?.toJson();return i?.errors?.length?o(i.errors):t.rejectWarnings&&i?.warnings?.length?o(i.warnings):void r({name:n.name,warningStats:i?.warnings})}))}))};export const prepareBuild=async(r,t,o)=>{await envVerify(r,o);const e=o.multiHtmlCdn?.prod||[];if(!e.length)throw new Error('No CDN configuration for env: "prod"');const n=ensureSlash(e[Math.floor(Math.random()*e.length)],!0),s=[],i=chunkEntryMap(t,getMaxProcessTasks(Object.keys(t).length,o.maxProcesses)),a=i.length;logger.info(`Preparing to run total ${a} tasks...`);for(let r=0;r<a;r++){const t=ora(`Run building task id:${r+1} ...`).start();try{const e=i[r],a=[];for(const[r,t]of Object.entries(e)){const e={[r]:t},s=t.options?.useRelativeAssetPath;a.push(startSingleEntryBuild(e,mergeOptions(o,{webpack:{publicPath:s?"auto":n}})))}const p=await Promise.all(a);s.push(...p),t.succeed()}catch(r){printCompilerError(r),t.fail()}}return s};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatjs/evolve",
3
- "version": "1.8.1-next.57",
3
+ "version": "1.8.1-next.58",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {