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

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @flatjs/evolve
2
2
 
3
+ ## 1.8.1-next.59
4
+
5
+ ### Patch Changes
6
+
7
+ - 43fcd4e: Update logging add re-throw evolve build error
8
+ - ffe4e14: bump version
9
+ - Updated dependencies [ffe4e14]
10
+ - @flatjs/forge-postcss-plugin-pixel@1.8.1-next.27
11
+ - @flatjs/evolve-preset-babel@1.8.1-next.13
12
+ - @flatjs/common@1.8.1-next.27
13
+ - @flatjs/graph@1.8.1-next.31
14
+ - @flatjs/mock@1.8.1-next.49
15
+
3
16
  ## 1.8.1-next.58
4
17
 
5
18
  ### Patch Changes
@@ -0,0 +1,4 @@
1
+ export declare class EvolveBuildError extends Error {
2
+ readonly code: string;
3
+ constructor(code: string, messages?: string | string[]);
4
+ }
@@ -0,0 +1 @@
1
+ export class EvolveBuildError extends Error{constructor(r,e){let o=r;e&&(o+=": "+JSON.stringify(e)),super(o),this.code=r}}
@@ -5,4 +5,4 @@ export declare const printError: (message: string | Error) => void;
5
5
  * @param errors
6
6
  * @returns
7
7
  */
8
- export declare const printCompilerError: (errors: any) => void;
8
+ export declare const printCompilerError: (errors: any) => string[];
@@ -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)};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
+ import{logger}from"@flatjs/common";import{moduleName}from"../constants.js";export const printInfo=(r,o=!1)=>{o||logger.info(r,moduleName)};export const printError=r=>{logger.error(r,moduleName)};const formatCompilerError=(r,o=[])=>{if(!r)return o;if("string"==typeof r)o.push(r);else if(Array.isArray(r))for(const e of r)formatCompilerError(e,o);else if("object"==typeof r){const e=r.stack||r.message;delete r.stack,delete r.message;const t={...r,_newMsg:e};for(const[,r]of Object.entries(t))formatCompilerError(r,o)}return o};export const printCompilerError=r=>{const o=formatCompilerError(r,[]);for(const r of o)console.log(r);return 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{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};
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{EvolveBuildError}from"../errors/evolve-build-error.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,o)=>Math.max(1,"string"==typeof o&&o.endsWith("%")?Math.round(cpus().length*Number(o.slice(0,-1))/100):Number(o)||r),startSingleEntryBuild=async(r,o)=>{const t=await loadWebpackConfig("production",r,o),e=splitToMultiCompilerConfigs(r,t,o);if(e.length>1)throw new Error("startSingleEntryBuild() only support `compiler` at a time");const n=e[0];return new Promise(((r,t)=>{webpack(n,((e,s)=>{if(e)return t(e);const i=s?.toJson();return i?.errors?.length?t(i.errors):o.rejectWarnings&&i?.warnings?.length?t(i.warnings):void r({name:n.name,warningStats:i?.warnings})}))}))};export const prepareBuild=async(r,o,t)=>{await envVerify(r,t);const e=t.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(o,getMaxProcessTasks(Object.keys(o).length,t.maxProcesses)),a=i.length;logger.info(`Preparing to run total ${a} tasks...`);for(let r=0;r<a;r++){const o=ora(`Run building task id:${r+1} ...`).start();try{const e=i[r],a=[];for(const[r,o]of Object.entries(e)){const e={[r]:o},s=o.options?.useRelativeAssetPath;a.push(startSingleEntryBuild(e,mergeOptions(t,{webpack:{publicPath:s?"auto":n}})))}const l=await Promise.all(a);s.push(...l),o.succeed()}catch(r){o.fail();const t=printCompilerError(r);throw new EvolveBuildError("BUILD_ERROR",t)}}return s};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatjs/evolve",
3
- "version": "1.8.1-next.58",
3
+ "version": "1.8.1-next.59",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -30,7 +30,7 @@
30
30
  "clean": "rimraf --no-glob ./dist ./coverage ./__data__ ./config/__data__ ./_release ./tsconfig.tsbuildinfo",
31
31
  "lint": "eslint . --ext .ts,.mts,.tsx,.js,.jsx,.cjs,.mjs --cache --cache-location ../../.cache/eslint/evolve.eslintcache",
32
32
  "test": "run-s test-unit",
33
- "test-task": "vitest run --passWithNoTests",
33
+ "test-task": "vitest run",
34
34
  "test-unit": "vitest run --passWithNoTests",
35
35
  "test-watch": "vitest watch --ui",
36
36
  "fix-all-files": "eslint . --ext .ts,.tsx,.js,.jsx,.cjs,.mjs,.mdx,.graphql --fix",
@@ -40,12 +40,12 @@
40
40
  "@armit/file-utility": "^0.0.25",
41
41
  "@armit/git": "^0.0.29",
42
42
  "@armit/package": "^0.0.40",
43
- "@babel/core": "7.22.1",
44
- "@flatjs/common": "1.8.1-next.26",
45
- "@flatjs/evolve-preset-babel": "1.8.1-next.12",
46
- "@flatjs/forge-postcss-plugin-pixel": "1.8.1-next.26",
47
- "@flatjs/graph": "1.8.1-next.30",
48
- "@flatjs/mock": "1.8.1-next.48",
43
+ "@babel/core": "7.22.5",
44
+ "@flatjs/common": "1.8.1-next.27",
45
+ "@flatjs/evolve-preset-babel": "1.8.1-next.13",
46
+ "@flatjs/forge-postcss-plugin-pixel": "1.8.1-next.27",
47
+ "@flatjs/graph": "1.8.1-next.31",
48
+ "@flatjs/mock": "1.8.1-next.49",
49
49
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
50
50
  "@types/babel__core": "7.20.1",
51
51
  "babel-loader": "9.1.2",
@@ -58,31 +58,31 @@
58
58
  "express": "4.18.2",
59
59
  "fork-ts-checker-webpack-plugin": "8.0.0",
60
60
  "happy-dom": "9.20.3",
61
- "html-webpack-plugin": "5.5.1",
61
+ "html-webpack-plugin": "5.5.3",
62
62
  "image-minimizer-webpack-plugin": "3.8.2",
63
63
  "less": "4.1.3",
64
- "less-loader": "11.1.2",
64
+ "less-loader": "11.1.3",
65
65
  "lodash": "4.17.21",
66
66
  "mini-css-extract-plugin": "2.7.6",
67
67
  "ora": "6.3.1",
68
68
  "postcss": "8.4.24",
69
- "postcss-loader": "7.3.2",
69
+ "postcss-loader": "7.3.3",
70
70
  "react-refresh": "0.14.0",
71
71
  "svgo": "3.0.2",
72
72
  "terser-webpack-plugin": "5.3.9",
73
73
  "tsconfig-paths-webpack-plugin": "4.0.1",
74
- "type-fest": "^3.11.1",
75
- "webpack": "5.86.0",
74
+ "type-fest": "^3.12.0",
75
+ "webpack": "5.87.0",
76
76
  "webpack-bundle-analyzer": "4.9.0",
77
- "webpack-dev-server": "4.15.0",
77
+ "webpack-dev-server": "4.15.1",
78
78
  "webpack-sources": "3.2.3"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@armit/eslint-config-bases": "^0.0.20",
82
- "@flatjs/testing": "1.8.1-next.27",
83
- "@swc/core": "1.3.62",
82
+ "@flatjs/testing": "1.8.1-next.28",
83
+ "@swc/core": "1.3.64",
84
84
  "@types/express": "4.17.17",
85
- "@types/node": "20.2.5",
85
+ "@types/node": "20.3.1",
86
86
  "@vitest/coverage-istanbul": "0.32.0",
87
87
  "@vitest/ui": "0.32.0",
88
88
  "eslint": "8.42.0",