@flatjs/evolve 2.2.5 → 2.2.6-next.0
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/dist/create-webpack/create-optimization.js +1 -1
- package/dist/create-webpack/load-watch-options.js +1 -1
- package/dist/create-webpack/rule-sets/rule-assets.js +1 -1
- package/dist/dev-server/middlewares/create-public-assets-middleware.js +1 -1
- package/dist/dev-server/middlewares/get-bundle-asset.js +1 -1
- package/dist/dev-server/middlewares/get-hmr-runtime-chunks.js +1 -1
- package/dist/helpers/assert-single-compiler.js +1 -1
- package/dist/helpers/normalize-entry-map.js +1 -1
- package/dist/helpers/normalize-entry-module-absolute-path.js +1 -1
- package/dist/plugins/clean-webpack/index.js +1 -1
- package/package.json +9 -8
@@ -1 +1 @@
|
|
1
|
-
import{
|
1
|
+
import{posix}from"node:path";import{devReactFastRefresh}from"../constants.js";import{shouldEnableReactFastRefresh}from"../helpers/should-enable-react-fast-refresh.js";import{createMinimizers}from"../minimizer/index.js";export const createOptimization=(e,i,n)=>({nodeEnv:e?"development":"production",chunkIds:"named",moduleIds:"named",runtimeChunk:!!shouldEnableReactFastRefresh(e,n,i)&&{name:e=>posix.join(e.name,devReactFastRefresh.runtime)},minimize:!1!==i.webpack?.minimizer&&!e,minimizer:createMinimizers(e,i.webpack),splitChunks:{name:!1,chunks:"all",minSize:25e5,cacheGroups:{default:!1,defaultVendors:!1}}});
|
@@ -1 +1 @@
|
|
1
|
-
import{existsSync}from"node:fs";import{logger}from"@flatjs/common";import{normalizeEntryModuleAbsolutePath}from"../helpers/normalize-entry-module-absolute-path.js";export const loadWatchOptions=(o,e
|
1
|
+
import fg from"fast-glob";import{existsSync}from"node:fs";import{posix}from"node:path";import{logger}from"@flatjs/common";import{normalizeEntryModuleAbsolutePath}from"../helpers/normalize-entry-module-absolute-path.js";export const loadWatchOptions=(o,t,e={})=>{const{ignored:r=[]}=e,{entryMap:n}=t,s=normalizeEntryModuleAbsolutePath(t,o),a=normalizeEntryModuleAbsolutePath(t,n);for(const o of a){existsSync(o)||logger.warn(`The module path does not exist. Check ${o}`);s.findIndex((t=>t===o))<0&&r.push(posix.join("**",fg.convertPathToPattern(o),"**/*"))}return{...e,ignored:r}};
|
@@ -1 +1 @@
|
|
1
|
-
import{dirname,join,relative,resolve}from"node:path";import{ensureSlash}from"@flatjs/common";import{resolvePublicPath}from"../resolve-public-path.js";import{FONT_PATH_REGEX,IMAGE_PATH_REGEX}from"./constants.js";import{isIconSvg}from"./rule-utils.js";const getEntryAssetFileName=(e,t,r)=>{const{projectCwd:o,projectVirtualPath:
|
1
|
+
import{dirname,join,relative,resolve}from"node:path";import{ensureSlash,normalizePlatformPath}from"@flatjs/common";import{resolvePublicPath}from"../resolve-public-path.js";import{FONT_PATH_REGEX,IMAGE_PATH_REGEX}from"./constants.js";import{isIconSvg}from"./rule-utils.js";const getEntryAssetFileName=(e,t,r)=>{const{projectCwd:o,projectVirtualPath:n}=r;let s=dirname(join(n,e.replace(/^src/,"")));const a=[];for(const[e,r]of t)for(const t of r.entry)a.push({entryName:e,entry:t});a.sort(((e,t)=>t.entry.length-e.entry.length));for(const t of a){const{entryName:r,entry:n}=t,a=dirname(join(o,n)),i=resolve(o,e);if(i.startsWith(ensureSlash(a,!0,!0))){s=dirname(join(r,relative(a,i)));break}}return`${normalizePlatformPath(s)}/[name]-[contenthash:8][ext]`};export const ruleAssets=(e,t)=>{const r=resolvePublicPath(t);return{type:"asset",test:e=>FONT_PATH_REGEX.test(e)||IMAGE_PATH_REGEX.test(e)&&!isIconSvg(e),generator:{filename:({filename:r})=>getEntryAssetFileName(r,e,t),publicPath:"auto"===r?void 0:r},parser:{dataUrlCondition:{maxSize:t.loaderOptions.assetDataUrlMaxSize}}}};
|
@@ -1 +1 @@
|
|
1
|
-
import{extname,
|
1
|
+
import{extname,posix}from"node:path";import{fileWalk}from"@armit/file-utility";export const createPublicAssetsMiddleware=(e,i)=>async(s,t)=>{const a=s.baseUrl;if(a.startsWith("/public")){const i=await fileWalk(posix.join("public/","**/*.{js,css}"),{cwd:e}),s=extname(a),l=i.find((e=>extname(e)===s&&-1!==e.indexOf(a.replace(/\.(?:js|css)$/,""))));l?t.sendFile(l):t.sendFile(posix.join(e,a))}else t.redirect(i)};
|
@@ -1 +1 @@
|
|
1
|
-
import{
|
1
|
+
import{posix}from"node:path";import{urlJoin}from"@flatjs/common";export const getBundleAsset=(o,i,n)=>urlJoin(o,[posix.join("public",i,`bundle${n}`)]);
|
@@ -1 +1 @@
|
|
1
|
-
import{
|
1
|
+
import{posix}from"node:path";import{devReactFastRefresh}from"../../constants.js";import{shouldEnableReactFastRefresh}from"../../helpers/should-enable-react-fast-refresh.js";import{getBundleAsset}from"./get-bundle-asset.js";export function getHmrRuntimeChunks(e,s,t,r,o,a){if(e[s]&&shouldEnableReactFastRefresh(!0,[t,r],o)){return[getBundleAsset(a,posix.join(t,devReactFastRefresh.runtime),".js"),getBundleAsset(a,posix.join(t,devReactFastRefresh.reactRefreshSetup),".js")]}return[]}
|
@@ -1 +1 @@
|
|
1
|
-
import{dirname,join}from"path";import{searchPackageDir}from"@armit/package";import{mergeOptions,requireResolve}from"@flatjs/common";import{devReactFastRefresh}from"../constants.js";import{normalizeEvolveEntryName}from"./normalize-entry-map.js";export function assertSingleCompiler(e,r,t,o=!1){const a={};for(const[r,n]of Object.entries(e)){const e=normalizeEvolveEntryName(r,t.projectVirtualPath);if(a[e]=n.entry,o){const r=join(e,devReactFastRefresh.reactRefreshSetup),t=requireResolve(import.meta.url,"@pmmmwh/react-refresh-webpack-plugin"),o=searchPackageDir({cwd:dirname(t)});if(!o)throw new Error("react-refresh-webpack-plugin package directory not found");a[r]=[join(o,"
|
1
|
+
import{dirname,join,posix}from"path";import{searchPackageDir}from"@armit/package";import{mergeOptions,requireResolve}from"@flatjs/common";import{devReactFastRefresh}from"../constants.js";import{normalizeEvolveEntryName}from"./normalize-entry-map.js";export function assertSingleCompiler(e,r,t,o=!1){const a={};for(const[r,n]of Object.entries(e)){const e=normalizeEvolveEntryName(r,t.projectVirtualPath);if(a[e]=n.entry,o){const r=posix.join(e,devReactFastRefresh.reactRefreshSetup),t=requireResolve(import.meta.url,"@pmmmwh/react-refresh-webpack-plugin"),o=searchPackageDir({cwd:dirname(t)});if(!o)throw new Error("react-refresh-webpack-plugin package directory not found");a[r]=[join(o,"client","ReactRefreshEntry.js")]}}const n=Object.values(e)[0].groupName;return mergeOptions(r,{name:n,entry:a})}
|
@@ -1 +1 @@
|
|
1
|
-
import _ from"lodash";import{
|
1
|
+
import _ from"lodash";import{posix}from"node:path";const normalizeEntryGroupOptions=o=>o&&o.groupName?{groupName:o.groupName,groupingSource:"manual"}:{groupingSource:"auto"};export const normalizeEvolveEntryName=(o,r)=>{const e=o.replace(/^\//,""),t=r.replace(/^\//,"");return(e.startsWith(t)?e:posix.join(t,e)).replace(/\/$/,"")};export const normalizeEvolveEntryMap=(o={},r={})=>{const e={};for(const[t,n]of Object.entries(r)){const r={options:{}};if(o[t]){const p=normalizeEntryGroupOptions(n);e[t]=_.merge({},r,n,o[t],p)}}return e};
|
@@ -1 +1 @@
|
|
1
|
-
import{resolve}from"node:path";import{ensureSlash}from"@flatjs/common";export const normalizeEntryModuleAbsolutePath=(e,o)=>{const{projectCwd:s}=e,t=[];for(const[,e]of Object.entries(o)){const{entryModuleBase:o,entry:r}=e;if(o)for(const e of o){const o=ensureSlash(resolve(s,e),!0);t.push(o)}else for(const e of r){let o=resolve(s,e);(/\.(ts|tsx|js|jsx)$/.test(o)
|
1
|
+
import{resolve}from"node:path";import{ensureSlash}from"@flatjs/common";export const normalizeEntryModuleAbsolutePath=(e,o)=>{const{projectCwd:s}=e,t=[];for(const[,e]of Object.entries(o)){const{entryModuleBase:o,entry:r}=e;if(o)for(const e of o){const o=ensureSlash(resolve(s,e),!0,!0);t.push(o)}else for(const e of r){let o=resolve(s,e);(/\.(ts|tsx|js|jsx)$/.test(o)||/(\\|\/)index$/.test(o))&&(o=o.replace(/[/\\][^/\\]*$/,""));const r=ensureSlash(o,!0,!0);t.push(r)}}return Array.from(new Set(t))};
|
@@ -1 +1 @@
|
|
1
|
-
import{
|
1
|
+
import{posix}from"node:path";import{ensureSlash}from"@flatjs/common";import{CleanWebpackPlugin}from"./clean-webpack-plugin.js";export const createCleanWebpackPlugin=(e,n,o)=>e?[]:[new CleanWebpackPlugin({verbose:!0,projectCwd:o.projectCwd,cleanOnceBeforeBuildPatterns:n.map((e=>`${posix.join(ensureSlash(e[0],!0),"**/*")}`))})];
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@flatjs/evolve",
|
3
|
-
"version": "2.2.
|
3
|
+
"version": "2.2.6-next.0",
|
4
4
|
"license": "MIT",
|
5
5
|
"type": "module",
|
6
6
|
"exports": {
|
@@ -43,12 +43,12 @@
|
|
43
43
|
"@babel/core": "^7.26.8",
|
44
44
|
"@clack/prompts": "^0.10.0",
|
45
45
|
"@discoveryjs/json-ext": "0.6.3",
|
46
|
-
"@flatjs/babel-plugin-import": "2.2.
|
47
|
-
"@flatjs/common": "2.2.0",
|
48
|
-
"@flatjs/evolve-preset-babel": "2.2.0",
|
49
|
-
"@flatjs/forge-postcss-plugin-pixel": "2.2.0",
|
50
|
-
"@flatjs/graph": "2.2.
|
51
|
-
"@flatjs/mock": "2.3.
|
46
|
+
"@flatjs/babel-plugin-import": "2.2.6-next.0",
|
47
|
+
"@flatjs/common": "2.2.1-next.0",
|
48
|
+
"@flatjs/evolve-preset-babel": "2.2.1-next.0",
|
49
|
+
"@flatjs/forge-postcss-plugin-pixel": "2.2.1-next.0",
|
50
|
+
"@flatjs/graph": "2.2.6-next.0",
|
51
|
+
"@flatjs/mock": "2.3.6-next.0",
|
52
52
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
|
53
53
|
"@types/babel__core": "^7.20.5",
|
54
54
|
"babel-loader": "^9.2.1",
|
@@ -59,6 +59,7 @@
|
|
59
59
|
"css-loader": "^7.1.2",
|
60
60
|
"cssnano": "^7.0.6",
|
61
61
|
"express": "^4.21.2",
|
62
|
+
"fast-glob": "^3.3.3",
|
62
63
|
"fork-ts-checker-webpack-plugin": "^9.0.2",
|
63
64
|
"happy-dom": "^17.0.2",
|
64
65
|
"html-webpack-plugin": "^5.6.3",
|
@@ -89,7 +90,7 @@
|
|
89
90
|
"@dimjs/model": "2.0.2",
|
90
91
|
"@dimjs/model-react": "2.0.2",
|
91
92
|
"@dimjs/utils": "2.0.7",
|
92
|
-
"@flatjs/testing": "2.2.0",
|
93
|
+
"@flatjs/testing": "2.2.1-next.0",
|
93
94
|
"@hyperse/eslint-config-hyperse": "^1.2.10",
|
94
95
|
"@swc/core": "1.10.15",
|
95
96
|
"@types/express": "5.0.0",
|