@flatjs/evolve 1.8.1-next.31 → 1.8.1-next.32

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.32
4
+
5
+ ### Patch Changes
6
+
7
+ - 69b3166: Add `maxProcesses` for production build
8
+ - 68642bf: update minify.ts to minify.mjs
9
+ - Updated dependencies [68642bf]
10
+ - @flatjs/forge-postcss-plugin-pixel@1.8.1-next.17
11
+ - @flatjs/evolve-preset-babel@1.8.1-next.7
12
+ - @flatjs/common@1.8.1-next.17
13
+ - @flatjs/mock@1.8.1-next.29
14
+
3
15
  ## 1.8.1-next.31
4
16
 
5
17
  ### Patch Changes
@@ -1 +1 @@
1
- export const defaultEvolveOptions={projectCwd:process.cwd(),projectVirtualPath:"flatjs/evolve",rejectWarnings:!1,devServer:{autoOpen:!0,mockOptions:{mockBaseDir:"mocks"},middlewares:[],watchOptions:{poll:1e3,ignored:/node_modules/,aggregateTimeout:500},defaultServeGlobalData:()=>Promise.resolve({})},webpack:{target:["web","es5"],plugins:[],ruleSets:[],publicPath:"auto",externals:{vue:"Vue",react:"React","react-dom":"ReactDOM"},enableBundleHashName:!0},loaderOptions:{assetDataUrlMaxSize:4096,babelOptions:{usePreset:"react",plugins:[],presets:[]},runTsChecker:!0,lessOptions:{},cssnanoOptions:{},pixelOptions:{rootValue:{px:100,rpx:1},outputUnit:"rem"},modularImports:[]},entryMap:{},multiHtmlCdn:{},multiHtmlCdnEnvResolver:function cdnResolver(){},needVerifyPackages:{},packageInstallChecker:{enabled:!1,detectModules:["@dimjs/*"],throwError:!1,showAllInstalledGraph:!0}};
1
+ export const defaultEvolveOptions={projectCwd:process.cwd(),projectVirtualPath:"flatjs/evolve",rejectWarnings:!1,devServer:{autoOpen:!0,mockOptions:{mockBaseDir:"mocks"},middlewares:[],watchOptions:{poll:1e3,ignored:/node_modules/,aggregateTimeout:500},defaultServeGlobalData:()=>Promise.resolve({})},webpack:{target:["web","es5"],plugins:[],ruleSets:[],publicPath:"auto",externals:{vue:"Vue",react:"React","react-dom":"ReactDOM"},enableBundleHashName:!0},loaderOptions:{assetDataUrlMaxSize:4096,babelOptions:{usePreset:"react",plugins:[],presets:[]},runTsChecker:!0,lessOptions:{},cssnanoOptions:{},pixelOptions:{rootValue:{px:100,rpx:1},outputUnit:"rem"},modularImports:[]},entryMap:{},multiHtmlCdn:{},multiHtmlCdnEnvResolver:function cdnResolver(){},needVerifyPackages:{},packageInstallChecker:{enabled:!1,detectModules:["@dimjs/*"],throwError:!1,showAllInstalledGraph:!0},maxProcesses:"50%"};
@@ -2,7 +2,7 @@ import { type EvolveEntryMap } from '../types/types-entry-map.js';
2
2
  import { type FlatEvolveOptions } from '../types/types-options.js';
3
3
  export type EvolveBuildResult = {
4
4
  name?: string;
5
- warningStats?: any;
5
+ warningStats?: unknown;
6
6
  };
7
7
  /**
8
8
  * The main entry to start an evolve `build`
@@ -1 +1 @@
1
- import{ensureSlash,logger,mergeOptions}from"@flatjs/common";import webpack from"webpack";import{moduleName}from"../constants.js";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 startSingleEntryBuild=(r,o)=>{const t=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,i)=>{if(e)return t(e);const s=i?.toJson();return s?.errors?.length?t(s.errors):o.rejectWarnings&&s?.warnings?.length?t(s.warnings):void r({name:n.name,warningStats:s?.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),i=[],s=chunkEntryMap(o);for(const r of s){logger.info(`build task: ${JSON.stringify(Object.keys(r))}`,moduleName);const o=[];for(const[e,i]of Object.entries(r)){const r={[e]:i},s=i.options?.useRelativeAssetPath;o.push(startSingleEntryBuild(r,mergeOptions(t,{webpack:{publicPath:s?"auto":n}})))}const e=await Promise.all(o);i.push(...e)}return i};
1
+ import{cpus}from"node:os";import{ensureSlash,logger,mergeOptions,chalk}from"@flatjs/common";import webpack from"webpack";import{moduleName}from"../constants.js";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=(t,e)=>Math.max(1,"string"==typeof e&&e.endsWith("%")?Math.round(cpus().length*Number(e.slice(0,-1))/100):Number(e)||t),startSingleEntryBuild=(t,e)=>{const r=loadWebpackConfig("production",t,e),o=splitToMultiCompilerConfigs(t,r,e);if(o.length>1)throw new Error("startSingleEntryBuild() only support `compiler` at a time");const n=o[0];return new Promise(((t,r)=>{webpack(n,((o,s)=>{if(o)return r(o);const i=s?.toJson();return i?.errors?.length?r(i.errors):e.rejectWarnings&&i?.warnings?.length?r(i.warnings):void t({name:n.name,warningStats:i?.warnings})}))}))};export const prepareBuild=async(t,e,r)=>{await envVerify(t,r);const o=r.multiHtmlCdn?.prod||[];if(!o.length)throw new Error('No CDN configuration for env: "prod"');const n=ensureSlash(o[Math.floor(Math.random()*o.length)],!0),s=[],i=chunkEntryMap(e,(a=Object.keys(e).length,l=r.maxProcesses,Math.max(1,"string"==typeof l&&l.endsWith("%")?Math.round(cpus().length*Number(l.slice(0,-1))/100):Number(l)||a)));var a,l;for(const t of i){logger.info(`Build task: ${chalk(["magenta"])(JSON.stringify(Object.keys(t)))}`,moduleName);const e=[];for(const[o,s]of Object.entries(t)){const t={[o]:s},i=s.options?.useRelativeAssetPath;e.push(startSingleEntryBuild(t,mergeOptions(r,{webpack:{publicPath:i?"auto":n}})))}const o=await Promise.all(e);s.push(...o)}return s};
@@ -90,6 +90,15 @@ export interface FlatEvolveOptions {
90
90
  * Visualize size of webpack output files with an interactive zoomable treemap.
91
91
  */
92
92
  analyzer?: Record<string, unknown>;
93
+ /**
94
+ * Maximum number of process to run at once for production build
95
+ * Exact number or a percent of CPUs available (for example "50%").
96
+ *
97
+ * If undefined, then all build processes will start in parallel.
98
+ * Setting this value to 1 will achieve sequential running.
99
+ * @default `50%`
100
+ */
101
+ maxProcesses?: number | string;
93
102
  /**
94
103
  * For `production` mode, the value indicates if we interrupt compilation process while received "warnings" while evolve `build`
95
104
  * @default false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatjs/evolve",
3
- "version": "1.8.1-next.31",
3
+ "version": "1.8.1-next.32",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -40,10 +40,10 @@
40
40
  "@armit/file-utility": "^0.0.19",
41
41
  "@armit/package": "^0.0.29",
42
42
  "@babel/core": "7.21.8",
43
- "@flatjs/common": "1.8.1-next.16",
44
- "@flatjs/evolve-preset-babel": "1.8.1-next.6",
45
- "@flatjs/forge-postcss-plugin-pixel": "1.8.1-next.16",
46
- "@flatjs/mock": "1.8.1-next.28",
43
+ "@flatjs/common": "1.8.1-next.17",
44
+ "@flatjs/evolve-preset-babel": "1.8.1-next.7",
45
+ "@flatjs/forge-postcss-plugin-pixel": "1.8.1-next.17",
46
+ "@flatjs/mock": "1.8.1-next.29",
47
47
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
48
48
  "@types/babel__core": "7.20.0",
49
49
  "babel-loader": "9.1.2",
@@ -75,7 +75,7 @@
75
75
  },
76
76
  "devDependencies": {
77
77
  "@armit/eslint-config-bases": "^0.0.16",
78
- "@flatjs/testing": "1.8.1-next.13",
78
+ "@flatjs/testing": "1.8.1-next.14",
79
79
  "@swc/core": "1.3.59",
80
80
  "@types/express": "4.17.17",
81
81
  "@types/node": "20.2.3",