@flatjs/evolve 1.8.1-next.52 → 1.8.1-next.54

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,26 @@
1
1
  # @flatjs/evolve
2
2
 
3
+ ## 1.8.1-next.54
4
+
5
+ ### Patch Changes
6
+
7
+ - 0b95309: update logging formats
8
+ - Updated dependencies [0b95309]
9
+ - @flatjs/mock@1.8.1-next.47
10
+
11
+ ## 1.8.1-next.53
12
+
13
+ ### Patch Changes
14
+
15
+ - 7fd8c71: Adjust logging message formatting
16
+ - 7fd8c71: bump version & adjust formatting of logs
17
+ - Updated dependencies [7fd8c71]
18
+ - @flatjs/common@1.8.1-next.25
19
+ - @flatjs/graph@1.8.1-next.29
20
+ - @flatjs/mock@1.8.1-next.46
21
+ - @flatjs/evolve-preset-babel@1.8.1-next.11
22
+ - @flatjs/forge-postcss-plugin-pixel@1.8.1-next.25
23
+
3
24
  ## 1.8.1-next.52
4
25
 
5
26
  ### Patch Changes
@@ -1 +1 @@
1
- import{mergeOptions,logger,searchConfig}from"@flatjs/common";import{configFileName,moduleName}from"../constants.js";import{defaultEvolveOptions}from"../default-options.js";import{refreshEvolveMockOptions}from"../helpers/refresh-evolve-mock-options.js";export const loadEvolveConfig=async(o,e,t={},s={configFile:configFileName,esmLoaderOptions:{externals:["@flatjs/evolve","@flatjs/mock"]}})=>{const{configFile:i,esmLoaderOptions:n}=s,r=await searchConfig(i,e,{esm:{...n,projectCwd:e}});let f={};f="function"==typeof r?.config?r?.config(o):r?.config||{};const l=mergeOptions(defaultEvolveOptions,f),m=mergeOptions(l,t),a=mergeOptions(m,{projectCwd:e}),c=await refreshEvolveMockOptions(e,a,s);return logger.debug(c,moduleName),c};
1
+ import{mergeOptions,logger,searchConfig}from"@flatjs/common";import{configFileName,moduleName}from"../constants.js";import{defaultEvolveOptions}from"../default-options.js";import{refreshEvolveMockOptions}from"../helpers/refresh-evolve-mock-options.js";export const loadEvolveConfig=async(o,e,t={},n={configFile:configFileName,esmLoaderOptions:{externals:["@flatjs/evolve","@flatjs/mock"]}})=>{const{configFile:i,esmLoaderOptions:s}=n,r=await searchConfig(i,e,{esm:{...s,projectCwd:e}});let l={};l="function"==typeof r?.config?r?.config(o):r?.config||{};const f=mergeOptions(defaultEvolveOptions,l),m=mergeOptions(f,t),a=mergeOptions(m,{projectCwd:e}),c=await refreshEvolveMockOptions(e,a,n);return logger.debug(`Load evolve config:\n${JSON.stringify(c,null,2)}`,moduleName),c};
@@ -1 +1 @@
1
- import{cpus}from"node:os";import{chalk,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 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=async(t,e)=>{const r=await 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 processing...\n ${chalk(["magenta"])(JSON.stringify(Object.keys(t),null,2))}`,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};
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 +1 @@
1
- import{isAbsolute,join}from"node:path";import{getDiffFiles,getCommitIdOfBranch}from"@armit/git";import{arraysIntersect,logger}from"@flatjs/common";import{traverseGraph}from"@flatjs/graph";import{filterActivedEntriesByEntryInputs,filterActivedEntriesByModule}from"../helpers/filter-actived-entries.js";import{getGitRoot}from"../helpers/get-git-root.js";import{normalizeEvolveEntryMap}from"../helpers/normalize-entry-map.js";import{resolveEntryMapInputFiles}from"../helpers/resolve-entry-map-input-files.js";import{loadEvolveConfig}from"../load-config/load-evolve-config.js";import{prepareBuild}from"./prepare-build.js";export async function getBuildEntryFiles(e,t,r){const i=[],o=[];for(const e of r)t.includes(e)?i.push(e):o.push(e);if(o.length){const r=await traverseGraph({input:o,projectCwd:e,treeNodeFilter:()=>!0});if(!r)return i;logger.debug(r,"DependencyGraph");for(const e of o){const o=r[e]||[];arraysIntersect(o,t)&&i.push(e)}}return i}export async function dynamicCheckBuildEntryMap(e,t,r,i,o){const n=await loadEvolveConfig({command:"build"},e,i,o);if(n.ci?.fixedBuildModules&&n.ci?.fixedBuildModules.length){logger.info("Use `fixedBuildModules` configuration to build...");return{buildEntries:filterActivedEntriesByModule(n.entryMap,n.ci?.fixedBuildModules),newEvolveOptions:n}}if(logger.info("Dynamicly checking code changed modules ..."),!t){const e=n.ci?.basedBranch||"master";logger.info(`Resolving base branch "${e}" commit hash ...`),t=await getCommitIdOfBranch(e)}let l=t?await getDiffFiles(t,r):[];const s=getGitRoot(e);if(!s)throw new Error(`No .git root (${e}) found`);if(l=l.map((e=>isAbsolute(e)?e:join(s,e))),logger.debug(l,"DiffFiles"),!l.length)return logger.warn("It seems that there are no code files changed."),{buildEntries:{},newEvolveOptions:n};const a=await resolveEntryMapInputFiles(e,n.entryMap),d=await getBuildEntryFiles(e,l,a);logger.debug(d,"ToBuildEntryFiles");return{buildEntries:await filterActivedEntriesByEntryInputs(e,n.entryMap,d),newEvolveOptions:n}}export const startDynamicBuild=async(e,t,r,i={},o)=>{const{buildEntries:n,newEvolveOptions:l}=await dynamicCheckBuildEntryMap(e,t,r,i,o),s=Object.keys(n);if(!s.length)return logger.warn("No build entries providered!"),[];logger.info({buildEntries:s});const a=normalizeEvolveEntryMap(n,l.entryMap);return prepareBuild(e,a,l)};
1
+ import{isAbsolute,join}from"node:path";import{getDiffFiles,getCommitIdOfBranch}from"@armit/git";import{arraysIntersect,logger}from"@flatjs/common";import{traverseGraph}from"@flatjs/graph";import{filterActivedEntriesByEntryInputs,filterActivedEntriesByModule}from"../helpers/filter-actived-entries.js";import{getGitRoot}from"../helpers/get-git-root.js";import{normalizeEvolveEntryMap}from"../helpers/normalize-entry-map.js";import{resolveEntryMapInputFiles}from"../helpers/resolve-entry-map-input-files.js";import{loadEvolveConfig}from"../load-config/load-evolve-config.js";import{prepareBuild}from"./prepare-build.js";export async function getBuildEntryFiles(e,t,i){const r=[],n=[];for(const e of i)t.includes(e)?r.push(e):n.push(e);if(n.length){const i=await traverseGraph({input:n,projectCwd:e,treeNodeFilter:()=>!0});if(!i)return r;logger.debug(`DependencyGraph:\n${JSON.stringify(i,null,2)}`);for(const e of n){const n=i[e]||[];arraysIntersect(n,t)&&r.push(e)}}return r}export async function dynamicCheckBuildEntryMap(e,t,i,r,n){const o=await loadEvolveConfig({command:"build"},e,r,n);if(o.ci?.fixedBuildModules&&o.ci?.fixedBuildModules.length){logger.info("Use `fixedBuildModules` configuration to build...");return{buildEntries:filterActivedEntriesByModule(o.entryMap,o.ci?.fixedBuildModules),newEvolveOptions:o}}if(logger.info("Dynamicly checking code changed modules ..."),!t){const e=o.ci?.basedBranch||"master";logger.info(`Resolving base branch "${e}" commit hash ...`),t=await getCommitIdOfBranch(e)}let l=t?await getDiffFiles(t,i):[];const s=getGitRoot(e);if(!s)throw new Error(`No .git root (${e}) found`);if(l=l.map((e=>isAbsolute(e)?e:join(s,e))),logger.debug(`Diff files: \n${JSON.stringify(l,null,2)}`),!l.length)return logger.warn("It seems that there are no code files changed."),{buildEntries:{},newEvolveOptions:o};const a=await resolveEntryMapInputFiles(e,o.entryMap),d=await getBuildEntryFiles(e,l,a);logger.debug(`To build entry files: \n${JSON.stringify(d,null,2)}`);return{buildEntries:await filterActivedEntriesByEntryInputs(e,o.entryMap,d),newEvolveOptions:o}}export const startDynamicBuild=async(e,t,i,r={},n)=>{const{buildEntries:o,newEvolveOptions:l}=await dynamicCheckBuildEntryMap(e,t,i,r,n),s=Object.keys(o);if(!s.length)return logger.warn("No build entries providered!"),[];logger.info(`Start dynamic build:\n${JSON.stringify({buildEntries:s},null,2)}`);const a=normalizeEvolveEntryMap(o,l.entryMap);return prepareBuild(e,a,l)};
@@ -1 +1 @@
1
- import{logger}from"@flatjs/common";import{filterActivedEntriesByModule}from"../helpers/filter-actived-entries.js";import{normalizeEvolveEntryMap}from"../helpers/normalize-entry-map.js";import{loadEvolveConfig}from"../load-config/load-evolve-config.js";import{prepareBuild}from"./prepare-build.js";export const startBuild=async(e,r,o={},i)=>{const t=await loadEvolveConfig({command:"build"},e,o,i),l=filterActivedEntriesByModule(t.entryMap,r),n=Object.keys(l);if(!n.length)return logger.warn("No build entries providered!"),[];logger.info({buildEntries:n});const a=normalizeEvolveEntryMap(l,t.entryMap);return prepareBuild(e,a,t)};
1
+ import{logger}from"@flatjs/common";import{filterActivedEntriesByModule}from"../helpers/filter-actived-entries.js";import{normalizeEvolveEntryMap}from"../helpers/normalize-entry-map.js";import{loadEvolveConfig}from"../load-config/load-evolve-config.js";import{prepareBuild}from"./prepare-build.js";export const startBuild=async(r,e,o={},i)=>{const t=await loadEvolveConfig({command:"build"},r,o,i),l=filterActivedEntriesByModule(t.entryMap,e),n=Object.keys(l);if(!n.length)return logger.warn("No build entries providered!"),[];logger.info(`Start normal build:\n${JSON.stringify({buildEntries:n},null,2)}`);const a=normalizeEvolveEntryMap(l,t.entryMap);return prepareBuild(r,a,t)};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatjs/evolve",
3
- "version": "1.8.1-next.52",
3
+ "version": "1.8.1-next.54",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -39,13 +39,13 @@
39
39
  "dependencies": {
40
40
  "@armit/file-utility": "^0.0.23",
41
41
  "@armit/git": "^0.0.28",
42
- "@armit/package": "^0.0.37",
42
+ "@armit/package": "^0.0.38",
43
43
  "@babel/core": "7.22.1",
44
- "@flatjs/common": "1.8.1-next.24",
44
+ "@flatjs/common": "1.8.1-next.25",
45
45
  "@flatjs/evolve-preset-babel": "1.8.1-next.11",
46
- "@flatjs/forge-postcss-plugin-pixel": "1.8.1-next.24",
47
- "@flatjs/graph": "1.8.1-next.28",
48
- "@flatjs/mock": "1.8.1-next.45",
46
+ "@flatjs/forge-postcss-plugin-pixel": "1.8.1-next.25",
47
+ "@flatjs/graph": "1.8.1-next.29",
48
+ "@flatjs/mock": "1.8.1-next.47",
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",
@@ -64,6 +64,7 @@
64
64
  "less-loader": "11.1.2",
65
65
  "lodash": "4.17.21",
66
66
  "mini-css-extract-plugin": "2.7.6",
67
+ "ora": "6.3.1",
67
68
  "postcss": "8.4.24",
68
69
  "postcss-loader": "7.3.2",
69
70
  "react-refresh": "0.14.0",
@@ -78,7 +79,7 @@
78
79
  },
79
80
  "devDependencies": {
80
81
  "@armit/eslint-config-bases": "^0.0.19",
81
- "@flatjs/testing": "1.8.1-next.24",
82
+ "@flatjs/testing": "1.8.1-next.26",
82
83
  "@swc/core": "1.3.61",
83
84
  "@types/express": "4.17.17",
84
85
  "@types/node": "20.2.5",
@@ -97,7 +98,7 @@
97
98
  "ts-node": "10.9.1",
98
99
  "vite-tsconfig-paths": "4.2.0",
99
100
  "vitest": "0.31.4",
100
- "vue-loader": "17.2.1"
101
+ "vue-loader": "17.2.2"
101
102
  },
102
103
  "peerDependencies": {
103
104
  "imagemin-gifsicle": ">=7.0.0",