@flatjs/evolve 1.8.1-next.81 → 1.8.1-next.82
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 +14 -0
- package/dist/create-webpack/create-plugins.js +1 -1
- package/dist/define-config/define-config.d.ts +1 -1
- package/dist/define-config/define-config.js +1 -1
- package/dist/load-config/load-evolve-config.js +1 -1
- package/dist/main/get-worker-path.d.ts +1 -0
- package/dist/main/get-worker-path.js +1 -0
- package/dist/main/start-build-dynamic.js +1 -1
- package/dist/main/start-build.js +1 -1
- package/dist/types/types-loader-options.d.ts +3 -3
- package/package.json +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @flatjs/evolve
|
|
2
2
|
|
|
3
|
+
## 1.8.1-next.82
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 148706e: remove `load-config` from @flatjs/common using armit/config-loader instead
|
|
8
|
+
- Updated dependencies [148706e]
|
|
9
|
+
- Updated dependencies [24e998c]
|
|
10
|
+
- Updated dependencies [f052256]
|
|
11
|
+
- @flatjs/common@1.8.1-next.31
|
|
12
|
+
- @flatjs/mock@1.8.1-next.66
|
|
13
|
+
- @flatjs/graph@1.8.1-next.41
|
|
14
|
+
- @flatjs/forge-postcss-plugin-pixel@1.8.1-next.31
|
|
15
|
+
- @flatjs/evolve-preset-babel@1.8.1-next.15
|
|
16
|
+
|
|
3
17
|
## 1.8.1-next.81
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{logger}from"@flatjs/common";import ReactRefreshWebpackPlugin from"@pmmmwh/react-refresh-webpack-plugin";import CaseSensitivePathsPlugin from"case-sensitive-paths-webpack-plugin";import ForkTsCheckerWebpackPlugin from"fork-ts-checker-webpack-plugin";import MiniCssExtractPlugin from"mini-css-extract-plugin";import webpack from"webpack";import{BundleAnalyzerPlugin}from"webpack-bundle-analyzer";import{enableBundleHashNameForModule}from"../helpers/enable-bundle-hashname-for-module.js";import{getBundleFileName}from"../helpers/get-bundle-file-name.js";import{shouldEnableReactFastRefresh}from"../helpers/should-enable-react-fast-refresh.js";import{createCleanWebpackPlugin}from"../plugins/clean-webpack/index.js";import{createBuiltinDefineVariables}from"../plugins/define-variable/index.js";import{createModuleFederationPlugin}from"../plugins/module-federation/index.js";import{createHtmlPlugins}from"../plugins/multi-html/index.js";export const createPlugins=async(e,n,a)=>{const[r,i]=n,t=enableBundleHashNameForModule(a,i?.options),l=[new webpack.WatchIgnorePlugin({paths:[/\.d\.[cm]ts$/]}),new CaseSensitivePathsPlugin,new MiniCssExtractPlugin({filename:`[name]/${getBundleFileName("css",e,t)}`,chunkFilename:"[id].[contenthash].css"}),...await createBuiltinDefineVariables(e,a),...createCleanWebpackPlugin(e,n,a),...createModuleFederationPlugin(e,n,a),...createHtmlPlugins(e,n,a)],{analyzer:s,loaderOptions:o}=a,c=(n[1].entry||[]).find((e=>/.vue$/.test(e)));o.runTsChecker&&!c&&l.push(new ForkTsCheckerWebpackPlugin({async:e,typescript:{context:a.projectCwd,memoryLimit:8192}})),s&&l.push(new BundleAnalyzerPlugin({analyzerPort:"auto",analyzerMode:"server",...s}));const u=shouldEnableReactFastRefresh(e,n,a);u&&l.push(new ReactRefreshWebpackPlugin({overlay:!1})),!u&&e&&logger.warn(`The HMR has disabled cause of
|
|
1
|
+
import{logger}from"@flatjs/common";import ReactRefreshWebpackPlugin from"@pmmmwh/react-refresh-webpack-plugin";import CaseSensitivePathsPlugin from"case-sensitive-paths-webpack-plugin";import ForkTsCheckerWebpackPlugin from"fork-ts-checker-webpack-plugin";import MiniCssExtractPlugin from"mini-css-extract-plugin";import webpack from"webpack";import{BundleAnalyzerPlugin}from"webpack-bundle-analyzer";import{enableBundleHashNameForModule}from"../helpers/enable-bundle-hashname-for-module.js";import{getBundleFileName}from"../helpers/get-bundle-file-name.js";import{shouldEnableReactFastRefresh}from"../helpers/should-enable-react-fast-refresh.js";import{createCleanWebpackPlugin}from"../plugins/clean-webpack/index.js";import{createBuiltinDefineVariables}from"../plugins/define-variable/index.js";import{createModuleFederationPlugin}from"../plugins/module-federation/index.js";import{createHtmlPlugins}from"../plugins/multi-html/index.js";export const createPlugins=async(e,n,a)=>{const[r,i]=n,t=enableBundleHashNameForModule(a,i?.options),l=[new webpack.WatchIgnorePlugin({paths:[/\.d\.[cm]ts$/]}),new CaseSensitivePathsPlugin,new MiniCssExtractPlugin({filename:`[name]/${getBundleFileName("css",e,t)}`,chunkFilename:"[id].[contenthash].css"}),...await createBuiltinDefineVariables(e,a),...createCleanWebpackPlugin(e,n,a),...createModuleFederationPlugin(e,n,a),...createHtmlPlugins(e,n,a)],{analyzer:s,loaderOptions:o}=a,c=(n[1].entry||[]).find((e=>/.vue$/.test(e)));o.runTsChecker&&!c&&l.push(new ForkTsCheckerWebpackPlugin({async:e,typescript:{context:a.projectCwd,memoryLimit:8192}})),s&&l.push(new BundleAnalyzerPlugin({analyzerPort:"auto",analyzerMode:"server",...s}));const u=shouldEnableReactFastRefresh(e,n,a);u&&l.push(new ReactRefreshWebpackPlugin({overlay:!1})),!u&&e&&logger.warn(`The HMR has disabled cause of \`"${r}":"moduleFederation"\``);const m=a.webpack?.plugins||[];return l.concat(m)};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type UserConfigExport, type ConfigEnvBase } from '@
|
|
1
|
+
import { type UserConfigExport, type ConfigEnvBase } from '@armit/config-loader';
|
|
2
2
|
import { type PartialDeep } from 'type-fest';
|
|
3
3
|
import { type FlatEvolveOptions } from '../types/types-options.js';
|
|
4
4
|
export interface EvolveConfigBase extends ConfigEnvBase {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineConfig as myDefineConfig}from"@
|
|
1
|
+
import{defineConfig as myDefineConfig}from"@armit/config-loader";export const defineConfig=i=>myDefineConfig(i);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mergeOptions,logger
|
|
1
|
+
import{searchConfig}from"@armit/config-loader";import{mergeOptions,logger}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,i={},t={configFile:configFileName,esmLoaderOptions:{externals:["@flatjs/evolve","@flatjs/mock"]}})=>{const{configFile:n,esmLoaderOptions:r}=t,s=await searchConfig(n,e,{esm:{...r,projectCwd:e}});let l={};l="function"==typeof s?.config?s?.config(o):s?.config||{};const m=mergeOptions(defaultEvolveOptions,l),f=mergeOptions(m,i),a=mergeOptions(f,{projectCwd:e}),c="build"===o.command?a:await refreshEvolveMockOptions(e,a,t);return logger.debug(`Load evolve config:\n${JSON.stringify(c,null,2)}`,moduleName),c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getWorkerPath: () => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{pathToFileURL}from"node:url";import{getDirname}from"@armit/file-utility";export const getWorkerPath=()=>pathToFileURL(getDirname(import.meta.url,"./start-build-worker.js")).toString();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isAbsolute,join}from"node:path";import{
|
|
1
|
+
import{isAbsolute,join}from"node:path";import{getDiffFiles,getCommitIdOfBranch}from"@armit/git";import{createThreadPool}from"@armit/worker-threads";import{arraysIntersect,chalk,logger}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){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(`DependencyGraph:\n${JSON.stringify(r,null,2)}`);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 s=t?await getDiffFiles(t,r):[];const a=getGitRoot(e);if(!a)throw new Error(`No .git root (${e}) found`);if(s=s.map((e=>isAbsolute(e)?e:join(a,e))),logger.debug(`Diff files: \n${JSON.stringify(s,null,2)}`),!s.length)return logger.warn("It seems that there are no code files changed."),{buildEntries:{},newEvolveOptions:n};const l=await resolveEntryMapInputFiles(e,n.entryMap),c=await getBuildEntryFiles(e,s,l);logger.debug(`To build entry files: \n${JSON.stringify(c,null,2)}`);return{buildEntries:await filterActivedEntriesByEntryInputs(e,n.entryMap,c),newEvolveOptions:n}}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(),f=await createThreadPool(c,{size:l}),d=new Listr([],{concurrent:l,exitOnError:!0}),g=[];for(const[t]of Object.entries(n))d.add({title:`Build module ${chalk(["magenta"])(t)} ...`,task:async()=>{const r=await f.startBuildWorker(e,t,jsonSerializer.stringify(i),o);g.push(r)}});return d.tasks.length&&await d.run(),f.pool.terminate(),g};
|
package/dist/main/start-build.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{createThreadPool}from"@armit/worker-threads";import{chalk,logger}from"@flatjs/common";import Listr from"listr";import{filterActivedEntriesByModule}from"../helpers/filter-actived-entries.js";import{getMaxProcessTasks}from"../helpers/get-max-process-tasks.js";import{jsonSerializer}from"../helpers/json-serializer.js";import{loadEvolveConfig}from"../load-config/load-evolve-config.js";import{envVerify}from"./env-verify.js";import{getWorkerPath}from"./get-worker-path.js";export const startBuild=async(r,e,t={},o)=>{const i=await loadEvolveConfig({command:"build"},r,t,o);await envVerify(r,i);const s=filterActivedEntriesByModule(i.entryMap,e),a=Object.keys(s);if(!a.length)return logger.warn("No build entries providered!"),[];const n=getMaxProcessTasks(a.length,i.maxProcesses);logger.info(`Start standard build with (${chalk(["magenta"])(String(n))}) workers:\n${JSON.stringify({buildEntries:a},null,2)}`);const l=getWorkerPath(),c=await createThreadPool(l,{size:n}),m=new Listr([],{concurrent:n,exitOnError:!0}),d=[];for(const[e]of Object.entries(s))m.add({title:`Build module ${chalk(["magenta"])(e)} ...`,task:async()=>{const i=await c.startBuildWorker(r,e,jsonSerializer.stringify(t),o);d.push(i)}});return m.tasks.length&&await m.run(),c.pool.terminate(),d};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type TransformOptions } from '@babel/core';
|
|
2
2
|
import { type PostcssPluginPixelOptions } from '@flatjs/forge-postcss-plugin-pixel';
|
|
3
|
-
import { type Options } from 'cssnano';
|
|
4
3
|
import { type AcceptedPlugin } from 'postcss';
|
|
5
4
|
import { type ModularImportOption } from './types-modular-import.js';
|
|
6
5
|
export type BabelInputOptions = Pick<TransformOptions, 'presets' | 'plugins'>;
|
|
@@ -51,13 +50,14 @@ export interface RuleSetLoaderOptions {
|
|
|
51
50
|
/**
|
|
52
51
|
* The overrided configurations of `cssnano-preset-default`
|
|
53
52
|
* sometimes we need to disabled some rules for `default cssnano preset`
|
|
53
|
+
* @link https://www.npmjs.com/package/cssnano-preset-default
|
|
54
54
|
* @example
|
|
55
|
-
*
|
|
55
|
+
* Disable `postcss-minify-font-values` rule to avoid transitions from `font-weight:bold` to `font-weight:700`
|
|
56
56
|
* ```json
|
|
57
57
|
* cssnanoOptions: { minifyFontValues: false }
|
|
58
58
|
* ```
|
|
59
59
|
*/
|
|
60
|
-
cssnanoOptions?:
|
|
60
|
+
cssnanoOptions?: Record<string, unknown>;
|
|
61
61
|
/**
|
|
62
62
|
* Allow to extends extra plugins of `postcss-loader`
|
|
63
63
|
* @example `['tailwindcss', {}]`
|
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.82",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -37,16 +37,17 @@
|
|
|
37
37
|
"typecheck": "tsc --project ./tsconfig.json --noEmit"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
+
"@armit/config-loader": "^0.0.47",
|
|
40
41
|
"@armit/file-utility": "^0.0.26",
|
|
41
42
|
"@armit/git": "^0.0.31",
|
|
42
43
|
"@armit/package": "^0.0.41",
|
|
43
44
|
"@armit/worker-threads": "^0.0.3",
|
|
44
45
|
"@babel/core": "7.22.5",
|
|
45
|
-
"@flatjs/common": "1.8.1-next.
|
|
46
|
+
"@flatjs/common": "1.8.1-next.31",
|
|
46
47
|
"@flatjs/evolve-preset-babel": "1.8.1-next.15",
|
|
47
|
-
"@flatjs/forge-postcss-plugin-pixel": "1.8.1-next.
|
|
48
|
-
"@flatjs/graph": "1.8.1-next.
|
|
49
|
-
"@flatjs/mock": "1.8.1-next.
|
|
48
|
+
"@flatjs/forge-postcss-plugin-pixel": "1.8.1-next.31",
|
|
49
|
+
"@flatjs/graph": "1.8.1-next.41",
|
|
50
|
+
"@flatjs/mock": "1.8.1-next.66",
|
|
50
51
|
"@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
|
|
51
52
|
"@types/babel__core": "7.20.1",
|
|
52
53
|
"babel-loader": "9.1.2",
|
|
@@ -80,7 +81,7 @@
|
|
|
80
81
|
},
|
|
81
82
|
"devDependencies": {
|
|
82
83
|
"@armit/eslint-config-bases": "^0.0.21",
|
|
83
|
-
"@flatjs/testing": "1.8.1-next.
|
|
84
|
+
"@flatjs/testing": "1.8.1-next.32",
|
|
84
85
|
"@swc/core": "1.3.67",
|
|
85
86
|
"@types/express": "4.17.17",
|
|
86
87
|
"@types/listr": "0.14.4",
|