@flatjs/evolve 1.8.1-next.103 → 1.8.1-next.105
Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,27 @@
|
|
1
1
|
# @flatjs/evolve
|
2
2
|
|
3
|
+
## 1.8.1-next.105
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- 9be1d2d: expose `defineConfig` with correct typings export
|
8
|
+
- Updated dependencies [9be1d2d]
|
9
|
+
- @flatjs/mock@1.8.1-next.79
|
10
|
+
- @flatjs/graph@1.8.1-next.55
|
11
|
+
|
12
|
+
## 1.8.1-next.104
|
13
|
+
|
14
|
+
### Patch Changes
|
15
|
+
|
16
|
+
- 3a8aa0b: Add `graphTreeNodeFilter` allow customized filter wihile dynamic build
|
17
|
+
- 9f098ad: Bump version
|
18
|
+
- Updated dependencies [9f098ad]
|
19
|
+
- @flatjs/forge-postcss-plugin-pixel@1.8.1-next.37
|
20
|
+
- @flatjs/evolve-preset-babel@1.8.1-next.22
|
21
|
+
- @flatjs/common@1.8.1-next.37
|
22
|
+
- @flatjs/graph@1.8.1-next.54
|
23
|
+
- @flatjs/mock@1.8.1-next.78
|
24
|
+
|
3
25
|
## 1.8.1-next.103
|
4
26
|
|
5
27
|
### Patch Changes
|
@@ -21,4 +21,6 @@ export interface EvolveConfigBase extends ConfigEnvBase {
|
|
21
21
|
*/
|
22
22
|
resolve: typeof requireResolve;
|
23
23
|
}
|
24
|
-
|
24
|
+
type DefineConfigFn = (userConfig: UserConfigExport<PartialDeep<FlatEvolveOptions>, EvolveConfigBase>) => UserConfigExport<PartialDeep<FlatEvolveOptions>, EvolveConfigBase>;
|
25
|
+
export declare const defineConfig: DefineConfigFn;
|
26
|
+
export {};
|
@@ -2,7 +2,7 @@ import { type PartialDeep } from 'type-fest';
|
|
2
2
|
import { type ConfigLoaderOptions } from '../load-config/load-evolve-config.js';
|
3
3
|
import { type FlatEvolveOptions } from '../types/types-options.js';
|
4
4
|
import { type EvolveBuildResult } from './start-one-entry-build.js';
|
5
|
-
export declare function getBuildEntryFiles(projectCwd: string, diffFiles: string[], allEntryInputs: string[], resolveAlias?: Record<string, string
|
5
|
+
export declare function getBuildEntryFiles(projectCwd: string, diffFiles: string[], allEntryInputs: string[], resolveAlias?: Record<string, string>, graphTreeNodeFilter?: (moduleId: string) => boolean): Promise<string[]>;
|
6
6
|
/**
|
7
7
|
* Dynamic check which entry modules need to build.
|
8
8
|
* @returns
|
@@ -1 +1 @@
|
|
1
|
-
import{isAbsolute,join}from"node:path";import{getDiffFiles,getCommitIdOfBranch}from"@armit/git";import{createThreadPool}from"@armit/worker-threads";import{arraysIntersect,chalk,logger,requireResolve}from"@flatjs/common";import{traverseGraph}from"@flatjs/graph";import Listr from"listr";import{filterActivedEntriesByEntryInputs,filterActivedEntriesByModule}from"../helpers/filter-actived-entries.js";import{getGitRoot}from"../helpers/get-git-root.js";import{getMaxProcessTasks}from"../helpers/get-max-process-tasks.js";import{jsonSerializer}from"../helpers/json-serializer.js";import{resolveEntryMapInputFiles}from"../helpers/resolve-entry-map-input-files.js";import{loadEvolveConfig}from"../load-config/load-evolve-config.js";import{envVerify}from"./env-verify.js";import{getWorkerPath}from"./get-worker-path.js";export async function getBuildEntryFiles(e,t,r,i){const
|
1
|
+
import{isAbsolute,join}from"node:path";import{getDiffFiles,getCommitIdOfBranch}from"@armit/git";import{createThreadPool}from"@armit/worker-threads";import{arraysIntersect,chalk,logger,requireResolve}from"@flatjs/common";import{traverseGraph}from"@flatjs/graph";import Listr from"listr";import{moduleName}from"../constants.js";import{filterActivedEntriesByEntryInputs,filterActivedEntriesByModule}from"../helpers/filter-actived-entries.js";import{getGitRoot}from"../helpers/get-git-root.js";import{getMaxProcessTasks}from"../helpers/get-max-process-tasks.js";import{jsonSerializer}from"../helpers/json-serializer.js";import{resolveEntryMapInputFiles}from"../helpers/resolve-entry-map-input-files.js";import{loadEvolveConfig}from"../load-config/load-evolve-config.js";import{envVerify}from"./env-verify.js";import{getWorkerPath}from"./get-worker-path.js";export async function getBuildEntryFiles(e,t,r,i,o){const n=[],s=[];for(const e of r)t.includes(e)?n.push(e):s.push(e);if(o&&logger.info("Use custom graph traverse filter",moduleName),s.length){const r=await traverseGraph({input:s,projectCwd:e,treeNodeFilter:o||(()=>!0),lessImportOptions:{projectCwd:e,aliases:i}});if(!r)return n;logger.debug(`DependencyGraph:\n${JSON.stringify(r,null,2)}`);for(const e of s){const i=r[e]||[];arraysIntersect(i,t)&&n.push(e)}}return n}export async function dynamicCheckBuildEntryMap(e,t,r,i,o){const n={command:"build",resolve:requireResolve},s=await loadEvolveConfig(n,e,i,o);if(s.ci?.fixedBuildModules&&s.ci?.fixedBuildModules.length){logger.info("Use `fixedBuildModules` configuration to build...");return{buildEntries:filterActivedEntriesByModule(s.entryMap,s.ci?.fixedBuildModules),newEvolveOptions:s}}if(logger.info("Dynamicly checking code changed modules ..."),!t){const e=s.ci?.basedBranch||"origin/master";t=await getCommitIdOfBranch(e),logger.info(`Resolving base branch "${e}" commit hash "${t}" ...`)}let a=t?await getDiffFiles(t,r):[];const l=getGitRoot(e);if(!l)throw new Error(`No .git root (${e}) found`);if(a=a.map((e=>isAbsolute(e)?e:join(l,e))),logger.debug(`Diff files: \n${JSON.stringify(a,null,2)}`),!a.length)return logger.warn("It seems that there are no code files changed."),{buildEntries:{},newEvolveOptions:s};const c=await resolveEntryMapInputFiles(e,s.entryMap),d=await getBuildEntryFiles(e,a,c,s.webpack?.resolve?.alias,s.ci?.graphTreeNodeFilter);logger.debug(`To build entry files: \n${JSON.stringify(d,null,2)}`);return{buildEntries:await filterActivedEntriesByEntryInputs(e,s.entryMap,d),newEvolveOptions:s}}export const startDynamicBuild=async(e,t,r,i={},o)=>{const{buildEntries:n,newEvolveOptions:s}=await dynamicCheckBuildEntryMap(e,t,r,i,o);await envVerify(e,s);const a=Object.keys(n);if(!a.length)return logger.warn("No build entries providered!"),[];const l=getMaxProcessTasks(a.length,s.maxProcesses);logger.info(`Start dynamic build with (${chalk(["magenta"])(String(l))}) workers:\n${JSON.stringify({buildEntries:a},null,2)}`);const c=getWorkerPath(),d=await createThreadPool(c,{size:l}),f=new Listr([],{concurrent:l,exitOnError:!0}),g=[];for(const[t]of Object.entries(n))f.add({title:`Build module ${chalk(["magenta"])(t)} ...`,task:async()=>{const r=await d.startBuildWorker(e,t,jsonSerializer.stringify(i),o);g.push(r)}});return f.tasks.length&&await f.run(),d.pool.terminate(),g};
|
package/dist/types/types-ci.d.ts
CHANGED
@@ -5,6 +5,13 @@
|
|
5
5
|
* 3. Normally build manually using (`flat build evolve -m "a;b"`)
|
6
6
|
*/
|
7
7
|
export type FlatEvolveCI = {
|
8
|
+
/**
|
9
|
+
* A function used to determine if a module (also include root node) should be included in the dependency tree
|
10
|
+
* it should not work if you have `fixedBuildModules` definition.
|
11
|
+
* @param moduleId The imported module
|
12
|
+
* @default `() => true`
|
13
|
+
*/
|
14
|
+
graphTreeNodeFilter?: (moduleId: string) => boolean;
|
8
15
|
/**
|
9
16
|
* The build module patterns, `Highest Priority First`
|
10
17
|
* Support "a;b;c" RegExp pattern; `new RegExp(`${pattern}`).test(entryKey)`
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@flatjs/evolve",
|
3
|
-
"version": "1.8.1-next.
|
3
|
+
"version": "1.8.1-next.105",
|
4
4
|
"license": "MIT",
|
5
5
|
"type": "module",
|
6
6
|
"exports": {
|
@@ -37,18 +37,18 @@
|
|
37
37
|
"typecheck": "tsc --project ./tsconfig.json --noEmit"
|
38
38
|
},
|
39
39
|
"dependencies": {
|
40
|
-
"@armit/config-loader": "^0.0.
|
41
|
-
"@armit/file-utility": "^0.0.
|
42
|
-
"@armit/git": "^0.0.
|
43
|
-
"@armit/package": "^0.0.
|
44
|
-
"@armit/worker-threads": "^0.0.
|
40
|
+
"@armit/config-loader": "^0.0.53",
|
41
|
+
"@armit/file-utility": "^0.0.30",
|
42
|
+
"@armit/git": "^0.0.38",
|
43
|
+
"@armit/package": "^0.0.47",
|
44
|
+
"@armit/worker-threads": "^0.0.7",
|
45
45
|
"@babel/core": "7.22.10",
|
46
|
-
"@flatjs/common": "1.8.1-next.
|
47
|
-
"@flatjs/evolve-preset-babel": "1.8.1-next.
|
48
|
-
"@flatjs/forge-postcss-plugin-pixel": "1.8.1-next.
|
49
|
-
"@flatjs/graph": "1.8.1-next.
|
50
|
-
"@flatjs/mock": "1.8.1-next.
|
51
|
-
"@pmmmwh/react-refresh-webpack-plugin": "0.5.
|
46
|
+
"@flatjs/common": "1.8.1-next.37",
|
47
|
+
"@flatjs/evolve-preset-babel": "1.8.1-next.22",
|
48
|
+
"@flatjs/forge-postcss-plugin-pixel": "1.8.1-next.37",
|
49
|
+
"@flatjs/graph": "1.8.1-next.55",
|
50
|
+
"@flatjs/mock": "1.8.1-next.79",
|
51
|
+
"@pmmmwh/react-refresh-webpack-plugin": "0.5.11",
|
52
52
|
"@types/babel__core": "7.20.1",
|
53
53
|
"babel-loader": "9.1.3",
|
54
54
|
"babel-merge": "3.0.0",
|
@@ -59,7 +59,7 @@
|
|
59
59
|
"cssnano": "6.0.1",
|
60
60
|
"express": "4.18.2",
|
61
61
|
"fork-ts-checker-webpack-plugin": "8.0.0",
|
62
|
-
"happy-dom": "10.
|
62
|
+
"happy-dom": "10.10.0",
|
63
63
|
"html-webpack-plugin": "5.5.3",
|
64
64
|
"image-minimizer-webpack-plugin": "3.8.3",
|
65
65
|
"less": "4.2.0",
|
@@ -67,7 +67,7 @@
|
|
67
67
|
"listr": "0.14.3",
|
68
68
|
"lodash": "4.17.21",
|
69
69
|
"mini-css-extract-plugin": "2.7.6",
|
70
|
-
"postcss": "8.4.
|
70
|
+
"postcss": "8.4.28",
|
71
71
|
"postcss-loader": "7.3.3",
|
72
72
|
"react-refresh": "0.14.0",
|
73
73
|
"svgo": "3.0.2",
|
@@ -81,21 +81,21 @@
|
|
81
81
|
"webpack-sources": "3.2.3"
|
82
82
|
},
|
83
83
|
"devDependencies": {
|
84
|
-
"@armit/eslint-config-bases": "^0.0.
|
85
|
-
"@flatjs/testing": "1.8.1-next.
|
86
|
-
"@swc/core": "1.3.
|
84
|
+
"@armit/eslint-config-bases": "^0.0.25",
|
85
|
+
"@flatjs/testing": "1.8.1-next.39",
|
86
|
+
"@swc/core": "1.3.77",
|
87
87
|
"@types/express": "4.17.17",
|
88
88
|
"@types/listr": "0.14.4",
|
89
|
-
"@types/node": "20.
|
89
|
+
"@types/node": "20.5.0",
|
90
90
|
"@vitest/coverage-istanbul": "0.34.1",
|
91
91
|
"@vitest/ui": "0.34.1",
|
92
|
-
"eslint": "8.
|
92
|
+
"eslint": "8.47.0",
|
93
93
|
"imagemin-gifsicle": "7.0.0",
|
94
94
|
"imagemin-jpegtran": "7.0.0",
|
95
95
|
"imagemin-pngquant": "9.0.2",
|
96
96
|
"imagemin-svgo": "10.0.1",
|
97
97
|
"npm-run-all": "4.1.5",
|
98
|
-
"prettier": "3.0.
|
98
|
+
"prettier": "3.0.2",
|
99
99
|
"react": "18.2.0",
|
100
100
|
"rimraf": "5.0.1",
|
101
101
|
"swc-unplugin-ts": "1.0.2",
|