@flatjs/evolve 2.1.0 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- import HtmlWebpackPlugin from"html-webpack-plugin";import{basename}from"node:path";import webpack from"webpack";import{getRuntimeCDNBase}from"../../helpers/get-runtime-cdn-base.js";import{findEnvCdn,httpUrlJoin}from"../../helpers/script-injects.js";export class FlatEvolveMultiCdnPlugin{constructor(e){if(this.pluginName="FlatEvolveMultiCdnPlugin",this.requireFn=webpack.RuntimeGlobals.publicPath,this.config=e.multiHtmlCdn,this.cdnResolver=e.multiHtmlCdnEnvResolver||function cdnResolver(){},!this.config?.prod)throw new Error("We must setup `prod` for each CDN config node!")}apply(e){e.hooks.thisCompilation.tap(this.pluginName,(e=>{e.mainTemplate.hooks.requireExtensions.tap(this.pluginName,((t,n)=>{const i=[];i.push("// Dynamic assets path override(`@flatjs/evolve`) plugin-multi-html-cdn`)");const s=e.chunkGraph?.getTreeRuntimeRequirements(n);return s&&s.has(webpack.RuntimeGlobals.requireScope)&&i.push(webpack.Template.indent(getRuntimeCDNBase(this.config,this.cdnResolver,this.requireFn))),webpack.Template.asString(i)}))})),e.hooks.compilation.tap(this.pluginName,(e=>{HtmlWebpackPlugin.getHooks(e).beforeAssetTagGeneration.tap(this.pluginName,(e=>{const{assets:t,plugin:n,outputName:i}=e,s=n?.options?.chunks||[],r=Array.isArray(s)?s.find((e=>i.includes(e))):s,{userOptions:o}=e.plugin;if(!r)throw new Error("We must have current chunk!");const a=t.js.filter((e=>e.includes(r))),l=t.css.filter((e=>e.includes(r))),p=o.multiCdn,u=t.publicPath,c=a.map((e=>{if(p.disabled)return basename(e);const t=findEnvCdn(this.config,p.env);return httpUrlJoin(t,e.replace(u,""))})),m=l.map((e=>{if(p.disabled)return basename(e);const t=findEnvCdn(this.config,p.env);return httpUrlJoin(t,e.replace(u,""))}));return e.assets.js=c,e.assets.css=m,e}))}))}}
1
+ import HtmlWebpackPlugin from"html-webpack-plugin";import{basename}from"node:path";import webpack from"webpack";import{ensureSlash}from"@flatjs/common";import{getRuntimeCDNBase}from"../../helpers/get-runtime-cdn-base.js";import{findEnvCdn,httpUrlJoin}from"../../helpers/script-injects.js";export class FlatEvolveMultiCdnPlugin{constructor(e){if(this.pluginName="FlatEvolveMultiCdnPlugin",this.requireFn=webpack.RuntimeGlobals.publicPath,this.config=e.multiHtmlCdn,this.cdnResolver=e.multiHtmlCdnEnvResolver||function cdnResolver(){},!this.config?.prod)throw new Error("We must setup `prod` for each CDN config node!")}apply(e){e.hooks.thisCompilation.tap(this.pluginName,(e=>{e.mainTemplate.hooks.requireExtensions.tap(this.pluginName,((t,n)=>{const s=[];s.push("// Dynamic assets path override(`@flatjs/evolve`) plugin-multi-html-cdn`)");const i=e.chunkGraph?.getTreeRuntimeRequirements(n);return i&&i.has(webpack.RuntimeGlobals.requireScope)&&s.push(webpack.Template.indent(getRuntimeCDNBase(this.config,this.cdnResolver,this.requireFn))),webpack.Template.asString(s)}))})),e.hooks.compilation.tap(this.pluginName,(e=>{HtmlWebpackPlugin.getHooks(e).beforeAssetTagGeneration.tap(this.pluginName,(e=>{const{assets:t,plugin:n,outputName:s}=e,i=n?.options?.chunks||[],r=Array.isArray(i)?i.find((e=>s.includes(ensureSlash(e,!0)))):i,{userOptions:o}=e.plugin;if(!r)throw new Error("We must have current chunk!");const a=t.js.filter((e=>e.includes(ensureSlash(r,!0)))),l=t.css.filter((e=>e.includes(ensureSlash(r,!0)))),p=o.multiCdn,u=t.publicPath,m=a.map((e=>{if(p.disabled)return basename(e);const t=findEnvCdn(this.config,p.env);return httpUrlJoin(t,e.replace(u,""))})),c=l.map((e=>{if(p.disabled)return basename(e);const t=findEnvCdn(this.config,p.env);return httpUrlJoin(t,e.replace(u,""))}));return e.assets.js=m,e.assets.css=c,e}))}))}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatjs/evolve",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -36,19 +36,19 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@armit/babel-merge": "^0.2.4",
39
- "@armit/config-loader": "^0.2.7",
39
+ "@armit/config-loader": "^0.2.8",
40
40
  "@armit/file-utility": "^0.2.4",
41
41
  "@armit/git": "^0.2.4",
42
- "@armit/package": "^0.2.7",
43
- "@babel/core": "^7.24.9",
42
+ "@armit/package": "^0.2.8",
43
+ "@babel/core": "^7.25.2",
44
44
  "@clack/prompts": "^0.7.0",
45
- "@discoveryjs/json-ext": "0.6.0",
46
- "@flatjs/babel-plugin-import": "2.1.0",
47
- "@flatjs/common": "2.1.0",
48
- "@flatjs/evolve-preset-babel": "2.1.0",
49
- "@flatjs/forge-postcss-plugin-pixel": "2.1.0",
50
- "@flatjs/graph": "2.1.0",
51
- "@flatjs/mock": "2.1.0",
45
+ "@discoveryjs/json-ext": "0.6.1",
46
+ "@flatjs/babel-plugin-import": "2.1.2",
47
+ "@flatjs/common": "2.1.2",
48
+ "@flatjs/evolve-preset-babel": "2.1.2",
49
+ "@flatjs/forge-postcss-plugin-pixel": "2.1.2",
50
+ "@flatjs/graph": "2.1.2",
51
+ "@flatjs/mock": "2.1.2",
52
52
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
53
53
  "@types/babel__core": "^7.20.5",
54
54
  "babel-loader": "^9.1.3",
@@ -56,19 +56,19 @@
56
56
  "case-sensitive-paths-webpack-plugin": "^2.4.0",
57
57
  "ci-info": "^4.0.0",
58
58
  "css-loader": "^7.1.2",
59
- "cssnano": "^7.0.4",
59
+ "cssnano": "^7.0.5",
60
60
  "express": "^4.19.2",
61
61
  "fork-ts-checker-webpack-plugin": "^9.0.2",
62
62
  "happy-dom": "^14.12.3",
63
63
  "html-webpack-plugin": "^5.6.0",
64
- "image-minimizer-webpack-plugin": "^4.0.2",
64
+ "image-minimizer-webpack-plugin": "^4.1.0",
65
65
  "less": "^4.2.0",
66
66
  "less-loader": "^12.2.0",
67
67
  "listr": "^0.14.3",
68
68
  "lodash": "^4.17.21",
69
- "log-update": "^6.0.0",
69
+ "log-update": "^6.1.0",
70
70
  "mini-css-extract-plugin": "^2.9.0",
71
- "postcss": "^8.4.39",
71
+ "postcss": "^8.4.41",
72
72
  "postcss-loader": "^8.1.1",
73
73
  "react-refresh": "^0.14.2",
74
74
  "svgo": "^3.3.2",
@@ -76,7 +76,7 @@
76
76
  "terser-webpack-plugin": "^5.3.10",
77
77
  "tinypool": "^1.0.0",
78
78
  "tsconfig-paths-webpack-plugin": "^4.1.0",
79
- "type-fest": "^4.23.0",
79
+ "type-fest": "^4.24.0",
80
80
  "typescript": "^5.5.4",
81
81
  "webpack": "^5.93.0",
82
82
  "webpack-bundle-analyzer": "^4.10.2",
@@ -85,16 +85,16 @@
85
85
  },
86
86
  "devDependencies": {
87
87
  "@dimjs/lang": "2.0.0",
88
- "@dimjs/model": "2.0.0",
89
- "@dimjs/model-react": "2.0.0",
90
- "@dimjs/utils": "2.0.0",
91
- "@flatjs/testing": "2.1.0",
92
- "@hyperse/eslint-config-hyperse": "^1.0.10",
93
- "@swc/core": "1.7.1",
88
+ "@dimjs/model": "2.0.1",
89
+ "@dimjs/model-react": "2.0.1",
90
+ "@dimjs/utils": "2.0.1",
91
+ "@flatjs/testing": "2.1.2",
92
+ "@hyperse/eslint-config-hyperse": "^1.1.3",
93
+ "@swc/core": "1.7.10",
94
94
  "@types/express": "4.17.21",
95
95
  "@types/listr": "0.14.9",
96
- "@types/node": "20.14.12",
97
- "eslint": "^9.7.0",
96
+ "@types/node": "22.2.0",
97
+ "eslint": "^9.9.0",
98
98
  "imagemin-gifsicle": "7.0.0",
99
99
  "imagemin-jpegtran": "7.0.0",
100
100
  "imagemin-pngquant": "10.0.0",
@@ -102,8 +102,8 @@
102
102
  "npm-run-all": "4.1.5",
103
103
  "react": "18.3.1",
104
104
  "rimraf": "6.0.1",
105
- "vite-tsconfig-paths": "4.3.2",
106
- "vitest": "2.0.4",
105
+ "vite-tsconfig-paths": "5.0.1",
106
+ "vitest": "2.0.5",
107
107
  "vue-loader": "17.4.2"
108
108
  },
109
109
  "peerDependencies": {