@flatjs/evolve 1.8.1-next.30 → 1.8.1-next.31

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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # @flatjs/evolve
2
2
 
3
+ ## 1.8.1-next.31
4
+
5
+ ### Patch Changes
6
+
7
+ - b318549: Add array chunks & evolve split entryMap into multi chunks
8
+ - Updated dependencies [b318549]
9
+ - @flatjs/common@1.8.1-next.16
10
+ - @flatjs/forge-postcss-plugin-pixel@1.8.1-next.16
11
+ - @flatjs/mock@1.8.1-next.28
12
+ - @flatjs/evolve-preset-babel@1.8.1-next.6
13
+
3
14
  ## 1.8.1-next.30
4
15
 
5
16
  ### Patch Changes
@@ -0,0 +1,7 @@
1
+ import { type EvolveEntryMap } from '../types/types-entry-map.js';
2
+ /**
3
+ * Split entryMap into multi entryMap with a `size`
4
+ * @param entryMap
5
+ * @param size
6
+ */
7
+ export declare const chunkEntryMap: (entryMap: EvolveEntryMap, size?: number) => EvolveEntryMap[];
@@ -0,0 +1 @@
1
+ import{arrayChunk}from"@flatjs/common";export const chunkEntryMap=(r,o=2)=>{const n=Object.keys(r),t=arrayChunk(n,o),c=[];for(const o of t){const n=o.reduce(((o,n)=>({...o,[n]:r[n]})),{});c.push(n)}return c};
@@ -1,5 +1,6 @@
1
1
  export * from './allow-px2rem-for-module.js';
2
2
  export * from './assert-only-single-entry-item.js';
3
+ export * from './chunk-entry-map.js';
3
4
  export * from './enable-bundle-hashname-for-module.js';
4
5
  export * from './get-bundle-file-name.js';
5
6
  export * from './get-html-plugin-config.js';
@@ -1 +1 @@
1
- export*from"./allow-px2rem-for-module.js";export*from"./assert-only-single-entry-item.js";export*from"./enable-bundle-hashname-for-module.js";export*from"./get-bundle-file-name.js";export*from"./get-html-plugin-config.js";export*from"./get-pacakge-dir.js";export*from"./merge-babel-options.js";export*from"./normalize-entry-map.js";export*from"./open-page.js";export*from"./print-log.js";export*from"./refresh-evolve-mock-options.js";export*from"./script-injects.js";export*from"./should-enable-react-fast-refresh.js";export*from"./split-to-multi-compiler.js";
1
+ export*from"./allow-px2rem-for-module.js";export*from"./assert-only-single-entry-item.js";export*from"./chunk-entry-map.js";export*from"./enable-bundle-hashname-for-module.js";export*from"./get-bundle-file-name.js";export*from"./get-html-plugin-config.js";export*from"./get-pacakge-dir.js";export*from"./merge-babel-options.js";export*from"./normalize-entry-map.js";export*from"./open-page.js";export*from"./print-log.js";export*from"./refresh-evolve-mock-options.js";export*from"./script-injects.js";export*from"./should-enable-react-fast-refresh.js";export*from"./split-to-multi-compiler.js";
@@ -1 +1 @@
1
- import{ensureSlash,mergeOptions}from"@flatjs/common";import webpack from"webpack";import{loadWebpackConfig}from"../create-webpack/load-webpack-config.js";import{splitToMultiCompilerConfigs}from"../helpers/split-to-multi-compiler.js";import{envVerify}from"./env-verify.js";const startSingleEntryBuild=(r,o)=>{const t=loadWebpackConfig("production",r,o),e=splitToMultiCompilerConfigs(r,t,o);if(e.length>1)throw new Error("startSingleEntryBuild() only support `compiler` at a time");const n=e[0];return new Promise(((r,t)=>{webpack(n,((e,i)=>{if(e)return t(e);const s=i?.toJson();return s?.errors?.length?t(s.errors):o.rejectWarnings&&s?.warnings?.length?t(s.warnings):void r({name:n.name,warningStats:s?.warnings})}))}))};export const prepareBuild=async(r,o,t)=>{await envVerify(r,t);const e=t.multiHtmlCdn?.prod||[];if(!e.length)throw new Error('No CDN configuration for env: "prod"');const n=[],i=ensureSlash(e[Math.floor(Math.random()*e.length)],!0);for(const[r,e]of Object.entries(o)){const o={[r]:e},s=e.options?.useRelativeAssetPath;n.push(startSingleEntryBuild(o,mergeOptions(t,{webpack:{publicPath:s?"auto":i}})))}return Promise.all(n)};
1
+ import{ensureSlash,logger,mergeOptions}from"@flatjs/common";import webpack from"webpack";import{moduleName}from"../constants.js";import{loadWebpackConfig}from"../create-webpack/load-webpack-config.js";import{chunkEntryMap}from"../helpers/chunk-entry-map.js";import{splitToMultiCompilerConfigs}from"../helpers/split-to-multi-compiler.js";import{envVerify}from"./env-verify.js";const startSingleEntryBuild=(r,o)=>{const t=loadWebpackConfig("production",r,o),e=splitToMultiCompilerConfigs(r,t,o);if(e.length>1)throw new Error("startSingleEntryBuild() only support `compiler` at a time");const n=e[0];return new Promise(((r,t)=>{webpack(n,((e,i)=>{if(e)return t(e);const s=i?.toJson();return s?.errors?.length?t(s.errors):o.rejectWarnings&&s?.warnings?.length?t(s.warnings):void r({name:n.name,warningStats:s?.warnings})}))}))};export const prepareBuild=async(r,o,t)=>{await envVerify(r,t);const e=t.multiHtmlCdn?.prod||[];if(!e.length)throw new Error('No CDN configuration for env: "prod"');const n=ensureSlash(e[Math.floor(Math.random()*e.length)],!0),i=[],s=chunkEntryMap(o);for(const r of s){logger.info(`build task: ${JSON.stringify(Object.keys(r))}`,moduleName);const o=[];for(const[e,i]of Object.entries(r)){const r={[e]:i},s=i.options?.useRelativeAssetPath;o.push(startSingleEntryBuild(r,mergeOptions(t,{webpack:{publicPath:s?"auto":n}})))}const e=await Promise.all(o);i.push(...e)}return i};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatjs/evolve",
3
- "version": "1.8.1-next.30",
3
+ "version": "1.8.1-next.31",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -25,7 +25,7 @@
25
25
  "build": "rimraf dist && tsc -p ./tsconfig.build.json && npm run minify",
26
26
  "?build-release": "When https://github.com/atlassian/changesets/issues/432 has a solution we can remove this trick",
27
27
  "build-release": "yarn build && rimraf ./_release && yarn pack && mkdir ./_release && tar zxvf ./package.tgz --directory ./_release && rm ./package.tgz",
28
- "minify": "ts-node ../../scripts/minify.ts --dest=dist",
28
+ "minify": "node ../../scripts/minify.mjs --dest=dist",
29
29
  "codegen": "graphql-codegen --config ./codegen.cjs",
30
30
  "clean": "rimraf --no-glob ./dist ./coverage ./__data__ ./config/__data__ ./_release ./tsconfig.tsbuildinfo",
31
31
  "lint": "eslint . --ext .ts,.mts,.tsx,.js,.jsx,.cjs,.mjs --cache --cache-location ../../.cache/eslint/evolve.eslintcache",
@@ -40,10 +40,10 @@
40
40
  "@armit/file-utility": "^0.0.19",
41
41
  "@armit/package": "^0.0.29",
42
42
  "@babel/core": "7.21.8",
43
- "@flatjs/common": "1.8.1-next.15",
43
+ "@flatjs/common": "1.8.1-next.16",
44
44
  "@flatjs/evolve-preset-babel": "1.8.1-next.6",
45
- "@flatjs/forge-postcss-plugin-pixel": "1.8.1-next.15",
46
- "@flatjs/mock": "1.8.1-next.27",
45
+ "@flatjs/forge-postcss-plugin-pixel": "1.8.1-next.16",
46
+ "@flatjs/mock": "1.8.1-next.28",
47
47
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
48
48
  "@types/babel__core": "7.20.0",
49
49
  "babel-loader": "9.1.2",
@@ -75,7 +75,7 @@
75
75
  },
76
76
  "devDependencies": {
77
77
  "@armit/eslint-config-bases": "^0.0.16",
78
- "@flatjs/testing": "1.8.1-next.12",
78
+ "@flatjs/testing": "1.8.1-next.13",
79
79
  "@swc/core": "1.3.59",
80
80
  "@types/express": "4.17.17",
81
81
  "@types/node": "20.2.3",