@flatjs/evolve 1.8.1-next.92 → 1.8.1-next.93
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +16 -0
- package/dist/create-webpack/create-plugins.js +1 -1
- package/dist/plugins/circular-dependency/circular-dependency-plugin.d.ts +54 -0
- package/dist/plugins/circular-dependency/circular-dependency-plugin.js +1 -0
- package/dist/plugins/circular-dependency/index.d.ts +7 -0
- package/dist/plugins/circular-dependency/index.js +1 -0
- package/package.json +23 -22
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# @flatjs/evolve
|
2
2
|
|
3
|
+
## 1.8.1-next.93
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- b70ff50: bump version
|
8
|
+
- 76ffa17: Add `Circular` dependencies check plugin in `development` phase
|
9
|
+
- ea10e66: bump version
|
10
|
+
- Updated dependencies [b70ff50]
|
11
|
+
- Updated dependencies [ea10e66]
|
12
|
+
- Updated dependencies [ba80b25]
|
13
|
+
- @flatjs/forge-postcss-plugin-pixel@1.8.1-next.35
|
14
|
+
- @flatjs/evolve-preset-babel@1.8.1-next.17
|
15
|
+
- @flatjs/common@1.8.1-next.35
|
16
|
+
- @flatjs/graph@1.8.1-next.49
|
17
|
+
- @flatjs/mock@1.8.1-next.71
|
18
|
+
|
3
19
|
## 1.8.1-next.92
|
4
20
|
|
5
21
|
### 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,
|
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{createCircularDependencyPlugin}from"../plugins/circular-dependency/index.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,l=enableBundleHashNameForModule(a,i?.options),t=[new webpack.WatchIgnorePlugin({paths:[/\.d\.[cm]ts$/]}),new CaseSensitivePathsPlugin,...createCircularDependencyPlugin(e,a),new MiniCssExtractPlugin({filename:`[name]/${getBundleFileName("css",e,l)}`,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&&t.push(new ForkTsCheckerWebpackPlugin({async:e,typescript:{context:a.projectCwd,memoryLimit:8192}})),s&&t.push(new BundleAnalyzerPlugin({analyzerPort:"auto",analyzerMode:"server",...s}));const u=shouldEnableReactFastRefresh(e,n,a);u&&t.push(new ReactRefreshWebpackPlugin({overlay:!1})),!u&&e&&logger.warn(`The HMR has disabled cause of \`"${r}":"moduleFederation"\``);const p=a.webpack?.plugins||[];return t.concat(p)};
|
@@ -0,0 +1,54 @@
|
|
1
|
+
import { type Compilation, type Compiler } from 'webpack';
|
2
|
+
export interface Options {
|
3
|
+
/**
|
4
|
+
* The project root.
|
5
|
+
*/
|
6
|
+
projectCwd?: string;
|
7
|
+
/**
|
8
|
+
* exclude detection of files based on a RegExp
|
9
|
+
* @default /node_modules/
|
10
|
+
*/
|
11
|
+
exclude?: RegExp;
|
12
|
+
/**
|
13
|
+
* include specific files based on a RegExp
|
14
|
+
* @default `new RegExp('.*')`
|
15
|
+
*/
|
16
|
+
include?: RegExp;
|
17
|
+
/**
|
18
|
+
* add errors to webpack instead of warnings
|
19
|
+
* @default false
|
20
|
+
*/
|
21
|
+
failOnError?: boolean;
|
22
|
+
/**
|
23
|
+
* allow import cycles that include an asynchronous import,
|
24
|
+
* e.g. via via import(/* webpackMode: "weak" *\/ './file.js')
|
25
|
+
* @default false
|
26
|
+
*/
|
27
|
+
allowAsyncCycles?: boolean;
|
28
|
+
/**
|
29
|
+
* `onStart` is called before the cycle detection starts
|
30
|
+
*/
|
31
|
+
onStart?: (options: {
|
32
|
+
compilation: Compilation;
|
33
|
+
}) => void;
|
34
|
+
/**
|
35
|
+
* `onDetected` is called for each module that is cyclical
|
36
|
+
* `paths` will be an Array of the relative module paths that make up the cycle
|
37
|
+
*/
|
38
|
+
onDetected?: (options: {
|
39
|
+
paths: string[];
|
40
|
+
compilation: Compilation;
|
41
|
+
}) => void;
|
42
|
+
/**
|
43
|
+
* `onEnd` is called before the cycle detection ends
|
44
|
+
*/
|
45
|
+
onEnd?: (options: {
|
46
|
+
compilation: Compilation;
|
47
|
+
}) => void;
|
48
|
+
}
|
49
|
+
export declare class CircularDependencyPlugin {
|
50
|
+
private options;
|
51
|
+
constructor(options?: Options);
|
52
|
+
apply(compiler: Compiler): void;
|
53
|
+
private isCyclic;
|
54
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
import{relative}from"node:path";import{mergeOptions}from"@flatjs/common";import Graph from"tarjan-graph";import webpack from"webpack";const BASE_ERROR="Circular dependency detected:\r\n",PLUGIN_TITLE="CircularDependencyPlugin";export class CircularDependencyPlugin{constructor(o={}){this.options=mergeOptions({exclude:/node_modules/,include:/.*/,failOnError:!1,allowAsyncCycles:!1,projectCwd:process.cwd()},o)}apply(o){const e=this.options.projectCwd;o.hooks.compilation.tap(PLUGIN_TITLE,(o=>{o.hooks.optimizeModules.tap(PLUGIN_TITLE,(t=>{this.options.onStart&&this.options.onStart({compilation:o});const n=new(Graph.default||Graph);for(const e of t){const t=[];for(const n of e.dependencies){if(n.constructor&&"CommonJsSelfReferenceDependency"===n.constructor.name)continue;let r=null;r=o.moduleGraph?o.moduleGraph.getModule(n):n.module,r&&(r instanceof webpack.NormalModule&&r.resource&&(this.options.allowAsyncCycles&&n.weak||e!==r&&t.push(r.identifier())))}n.add(e.identifier(),t)}const r=n.getCycles();this.isCyclic(r,o,e),this.options.onEnd&&this.options.onEnd({compilation:o})}))}))}isCyclic(o,e,t){o.forEach((o=>{const n=o.slice().reverse().map((o=>{const t=e.findModule(o.name);return t instanceof webpack.NormalModule&&t.resource||null}));if(n.every((o=>!o||this.options.exclude.test(o)||!this.options.include.test(o))))return;const r=n.map((o=>relative(t,o)));if(this.options.onDetected){try{this.options.onDetected({paths:r.concat([r[0]]),compilation:e})}catch(o){e.errors.push(o)}return}const s=new Error(BASE_ERROR.concat(r.concat([r[0]]).join(" -> ")));this.options.failOnError?e.errors.push(s):e.warnings.push(s)}))}}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { type WebpackPlugin } from '../../create-webpack/types.js';
|
2
|
+
import { type FlatEvolveOptions } from '../../types/types-options.js';
|
3
|
+
/**
|
4
|
+
* Detect modules with circular dependencies when bundling with webpack for `development` mode.
|
5
|
+
* @returns
|
6
|
+
*/
|
7
|
+
export declare const createCircularDependencyPlugin: (serveMode: boolean, evolveOptions: FlatEvolveOptions) => WebpackPlugin[];
|
@@ -0,0 +1 @@
|
|
1
|
+
import{CircularDependencyPlugin}from"./circular-dependency-plugin.js";export const createCircularDependencyPlugin=(e,n)=>e?[new CircularDependencyPlugin({projectCwd:n.projectCwd})]:[];
|
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.93",
|
4
4
|
"license": "MIT",
|
5
5
|
"type": "module",
|
6
6
|
"exports": {
|
@@ -37,29 +37,29 @@
|
|
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.51",
|
41
|
+
"@armit/file-utility": "^0.0.28",
|
42
|
+
"@armit/git": "^0.0.36",
|
43
|
+
"@armit/package": "^0.0.45",
|
44
|
+
"@armit/worker-threads": "^0.0.5",
|
45
45
|
"@babel/core": "7.22.9",
|
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.
|
46
|
+
"@flatjs/common": "1.8.1-next.35",
|
47
|
+
"@flatjs/evolve-preset-babel": "1.8.1-next.17",
|
48
|
+
"@flatjs/forge-postcss-plugin-pixel": "1.8.1-next.35",
|
49
|
+
"@flatjs/graph": "1.8.1-next.49",
|
50
|
+
"@flatjs/mock": "1.8.1-next.71",
|
51
51
|
"@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
|
52
52
|
"@types/babel__core": "7.20.1",
|
53
53
|
"babel-loader": "9.1.3",
|
54
54
|
"babel-merge": "3.0.0",
|
55
|
-
"babel-plugin-import": "1.13.
|
55
|
+
"babel-plugin-import": "1.13.8",
|
56
56
|
"better-opn": "3.0.2",
|
57
57
|
"case-sensitive-paths-webpack-plugin": "2.4.0",
|
58
58
|
"css-loader": "6.8.1",
|
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.6.3",
|
63
63
|
"html-webpack-plugin": "5.5.3",
|
64
64
|
"image-minimizer-webpack-plugin": "3.8.3",
|
65
65
|
"less": "4.1.3",
|
@@ -71,24 +71,25 @@
|
|
71
71
|
"postcss-loader": "7.3.3",
|
72
72
|
"react-refresh": "0.14.0",
|
73
73
|
"svgo": "3.0.2",
|
74
|
+
"tarjan-graph": "3.0.0",
|
74
75
|
"terser-webpack-plugin": "5.3.9",
|
75
76
|
"tsconfig-paths-webpack-plugin": "4.1.0",
|
76
|
-
"type-fest": "^4.
|
77
|
+
"type-fest": "^4.1.0",
|
77
78
|
"webpack": "5.88.2",
|
78
79
|
"webpack-bundle-analyzer": "4.9.0",
|
79
80
|
"webpack-dev-server": "4.15.1",
|
80
81
|
"webpack-sources": "3.2.3"
|
81
82
|
},
|
82
83
|
"devDependencies": {
|
83
|
-
"@armit/eslint-config-bases": "^0.0.
|
84
|
-
"@flatjs/testing": "1.8.1-next.
|
85
|
-
"@swc/core": "1.3.
|
84
|
+
"@armit/eslint-config-bases": "^0.0.23",
|
85
|
+
"@flatjs/testing": "1.8.1-next.36",
|
86
|
+
"@swc/core": "1.3.74",
|
86
87
|
"@types/express": "4.17.17",
|
87
88
|
"@types/listr": "0.14.4",
|
88
|
-
"@types/node": "20.4.
|
89
|
-
"@vitest/coverage-istanbul": "0.
|
90
|
-
"@vitest/ui": "0.
|
91
|
-
"eslint": "8.
|
89
|
+
"@types/node": "20.4.6",
|
90
|
+
"@vitest/coverage-istanbul": "0.34.1",
|
91
|
+
"@vitest/ui": "0.34.1",
|
92
|
+
"eslint": "8.46.0",
|
92
93
|
"imagemin-gifsicle": "7.0.0",
|
93
94
|
"imagemin-jpegtran": "7.0.0",
|
94
95
|
"imagemin-pngquant": "9.0.2",
|
@@ -100,7 +101,7 @@
|
|
100
101
|
"swc-unplugin-ts": "1.0.2",
|
101
102
|
"ts-node": "10.9.1",
|
102
103
|
"vite-tsconfig-paths": "4.2.0",
|
103
|
-
"vitest": "0.
|
104
|
+
"vitest": "0.34.1",
|
104
105
|
"vue-loader": "17.2.2"
|
105
106
|
},
|
106
107
|
"peerDependencies": {
|