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

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
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
+
9
+ ## 1.8.1-next.57
10
+
11
+ ### Patch Changes
12
+
13
+ - 12f0600: Setup `config:false` for `postcss-loader` to improve performance
14
+
3
15
  ## 1.8.1-next.56
4
16
 
5
17
  ### Patch Changes
@@ -1 +1 @@
1
- import{forgePostcssPluginPixel}from"@flatjs/forge-postcss-plugin-pixel";import cssnano from"cssnano";import MiniCssExtractPlugin from"mini-css-extract-plugin";import{allowPx2remForModule}from"../../helpers/allow-px2rem-for-module.js";const getPostcssOptions=(s,o={},e={})=>{const r=[...e.plugins||[],cssnano({preset:["default",{discardComments:{removeAll:!s},reduceInitial:!1,normalizeWhitespace:!s,...e.cssnanoOptions}]})];return!1!==o&&r.push(forgePostcssPluginPixel(o)),{plugins:r}};export const ruleCss=(s,o,e)=>{const r={test:/\.css$/i,use:[{loader:MiniCssExtractPlugin.loader,options:{esModule:!0}},{loader:"css-loader",options:{sourceMap:s}}]},{pixelOptions:t,postcssOptions:i}=e.loaderOptions,n=allowPx2remForModule(o,e);return Array.isArray(r.use)&&r.use.push({loader:"postcss-loader",options:{postcssOptions:getPostcssOptions(s,!!n&&t,i),sourceMap:s}}),r};
1
+ import{forgePostcssPluginPixel}from"@flatjs/forge-postcss-plugin-pixel";import cssnano from"cssnano";import MiniCssExtractPlugin from"mini-css-extract-plugin";import{allowPx2remForModule}from"../../helpers/allow-px2rem-for-module.js";const getPostcssOptions=(s,o={},e={})=>{const t=[...e.plugins||[],cssnano({preset:["default",{discardComments:{removeAll:!s},reduceInitial:!1,normalizeWhitespace:!s,...e.cssnanoOptions}]})];return!1!==o&&t.push(forgePostcssPluginPixel(o)),{plugins:t}};export const ruleCss=(s,o,e)=>{const t={test:/\.css$/i,use:[{loader:MiniCssExtractPlugin.loader,options:{esModule:!0}},{loader:"css-loader",options:{sourceMap:s}}]},{pixelOptions:r,postcssOptions:i}=e.loaderOptions,n=allowPx2remForModule(o,e);if(Array.isArray(t.use)){const o=getPostcssOptions(s,!!n&&r,i);t.use.push({loader:"postcss-loader",options:{postcssOptions:{...o,config:!1},sourceMap:s}})}return t};
@@ -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.56",
3
+ "version": "1.8.1-next.58",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {