@flatjs/evolve 2.1.0-next.9 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. package/dist/compiler/create-global-compiler.d.ts +2 -0
  2. package/dist/compiler/create-global-compiler.js +1 -0
  3. package/dist/constants.d.ts +9 -0
  4. package/dist/constants.js +1 -1
  5. package/dist/create-webpack/create-externals.d.ts +1 -1
  6. package/dist/create-webpack/create-externals.js +1 -1
  7. package/dist/create-webpack/create-optimization.d.ts +1 -1
  8. package/dist/create-webpack/create-optimization.js +1 -1
  9. package/dist/create-webpack/create-output.d.ts +1 -1
  10. package/dist/create-webpack/create-performance.d.ts +1 -1
  11. package/dist/create-webpack/create-plugins.d.ts +2 -1
  12. package/dist/create-webpack/create-plugins.js +1 -1
  13. package/dist/create-webpack/create-resolve.js +1 -1
  14. package/dist/create-webpack/create-rule-sets.d.ts +1 -1
  15. package/dist/create-webpack/create-rule-sets.js +1 -1
  16. package/dist/create-webpack/load-watch-options.d.ts +12 -0
  17. package/dist/create-webpack/load-watch-options.js +1 -0
  18. package/dist/create-webpack/load-webpack-config.d.ts +2 -1
  19. package/dist/create-webpack/load-webpack-config.js +1 -1
  20. package/dist/create-webpack/rule-sets/rule-assets.d.ts +2 -2
  21. package/dist/create-webpack/rule-sets/rule-assets.js +1 -1
  22. package/dist/create-webpack/rule-sets/rule-css.js +1 -1
  23. package/dist/create-webpack/rule-sets/rule-scripts.d.ts +2 -0
  24. package/dist/create-webpack/rule-sets/rule-scripts.js +1 -1
  25. package/dist/create-webpack/types.d.ts +1 -1
  26. package/dist/default-options.js +1 -1
  27. package/dist/define-config/define-config.d.ts +2 -2
  28. package/dist/dev-server/add-compiler-to-dev-server.js +1 -1
  29. package/dist/dev-server/create-dev-server-compiler-task.d.ts +3 -0
  30. package/dist/dev-server/create-dev-server-compiler-task.js +1 -0
  31. package/dist/dev-server/create-dev-server-entries.d.ts +1 -1
  32. package/dist/dev-server/create-dev-server-entries.js +1 -1
  33. package/dist/dev-server/create-dev-server.js +1 -1
  34. package/dist/dev-server/index.d.ts +3 -3
  35. package/dist/dev-server/index.js +1 -1
  36. package/dist/dev-server/middlewares/get-bundle-asset.d.ts +1 -1
  37. package/dist/dev-server/middlewares/get-page-main-html.js +1 -1
  38. package/dist/dev-server/middlewares/get-page-module-html.js +1 -1
  39. package/dist/helpers/assert-group-entry-item.d.ts +7 -0
  40. package/dist/helpers/assert-group-entry-item.js +1 -0
  41. package/dist/helpers/assert-single-compiler.d.ts +15 -0
  42. package/dist/helpers/assert-single-compiler.js +1 -0
  43. package/dist/helpers/check-runtime-env.d.ts +4 -0
  44. package/dist/helpers/check-runtime-env.js +1 -0
  45. package/dist/helpers/custom-listr-renderer.d.ts +41 -0
  46. package/dist/helpers/custom-listr-renderer.js +1 -0
  47. package/dist/helpers/custom-message-channel.d.ts +17 -0
  48. package/dist/helpers/custom-message-channel.js +1 -0
  49. package/dist/helpers/delete-object-keys.d.ts +11 -0
  50. package/dist/helpers/delete-object-keys.js +1 -0
  51. package/dist/helpers/flat-entry-map.d.ts +8 -0
  52. package/dist/helpers/flat-entry-map.js +1 -0
  53. package/dist/helpers/format-spinner-text.d.ts +8 -0
  54. package/dist/helpers/format-spinner-text.js +1 -0
  55. package/dist/helpers/get-bundle-file-name.d.ts +1 -1
  56. package/dist/helpers/get-runtime-cdn-base.d.ts +2 -0
  57. package/dist/helpers/get-runtime-cdn-base.js +1 -0
  58. package/dist/helpers/get-stats-file-name.d.ts +2 -0
  59. package/dist/helpers/get-stats-file-name.js +1 -0
  60. package/dist/helpers/index.d.ts +18 -4
  61. package/dist/helpers/index.js +1 -1
  62. package/dist/helpers/is-deep-equal.d.ts +9 -0
  63. package/dist/helpers/is-deep-equal.js +1 -0
  64. package/dist/helpers/json-serializer.js +1 -1
  65. package/dist/helpers/merge-babel-options.d.ts +1 -1
  66. package/dist/helpers/merge-babel-options.js +1 -1
  67. package/dist/helpers/normalize-check-entry-options.d.ts +10 -0
  68. package/dist/helpers/normalize-check-entry-options.js +1 -0
  69. package/dist/helpers/normalize-entry-map.d.ts +1 -0
  70. package/dist/helpers/normalize-entry-map.js +1 -1
  71. package/dist/helpers/normalize-entry-module-absolute-path.d.ts +10 -0
  72. package/dist/helpers/normalize-entry-module-absolute-path.js +1 -0
  73. package/dist/helpers/normalize-group-name.d.ts +8 -0
  74. package/dist/helpers/normalize-group-name.js +1 -0
  75. package/dist/helpers/normalize-template-inject-tokens.d.ts +16 -0
  76. package/dist/helpers/normalize-template-inject-tokens.js +1 -0
  77. package/dist/helpers/open-page.js +1 -1
  78. package/dist/helpers/refresh-evolve-mock-options.js +1 -1
  79. package/dist/helpers/script-injects.d.ts +1 -1
  80. package/dist/helpers/split-to-entry-group.d.ts +52 -0
  81. package/dist/helpers/split-to-entry-group.js +1 -0
  82. package/dist/helpers/verify-group-entry-options.d.ts +9 -0
  83. package/dist/helpers/verify-group-entry-options.js +1 -0
  84. package/dist/index.d.ts +1 -1
  85. package/dist/index.js +1 -1
  86. package/dist/load-config/load-evolve-config.js +1 -1
  87. package/dist/loaders/loader-icon.cjs +2 -1
  88. package/dist/main/create-thread-worker.d.ts +29 -14
  89. package/dist/main/create-thread-worker.js +1 -1
  90. package/dist/main/index.d.ts +1 -1
  91. package/dist/main/index.js +1 -1
  92. package/dist/main/prepare-analyzer.d.ts +9 -0
  93. package/dist/main/prepare-analyzer.js +1 -0
  94. package/dist/main/prepare-build.d.ts +4 -3
  95. package/dist/main/prepare-build.js +1 -1
  96. package/dist/main/prepare-serve.d.ts +1 -1
  97. package/dist/main/prepare-serve.js +1 -1
  98. package/dist/main/start-analyzer.d.ts +10 -0
  99. package/dist/main/start-analyzer.js +1 -0
  100. package/dist/main/start-build-dynamic.d.ts +2 -2
  101. package/dist/main/start-build-dynamic.js +1 -1
  102. package/dist/main/start-build-worker.d.ts +17 -6
  103. package/dist/main/start-build-worker.js +1 -1
  104. package/dist/main/start-build.d.ts +3 -2
  105. package/dist/main/start-build.js +1 -1
  106. package/dist/main/start-group-entry-build.d.ts +15 -0
  107. package/dist/main/start-group-entry-build.js +1 -0
  108. package/dist/main/start-serve.d.ts +1 -1
  109. package/dist/main/start-serve.js +1 -1
  110. package/dist/minimizer/create-minimizers.js +1 -1
  111. package/dist/minimizer/image-minimizer.js +1 -1
  112. package/dist/minimizer/terser-minimizer.js +1 -1
  113. package/dist/plugins/circular-dependency/circular-dependency-plugin.js +1 -1
  114. package/dist/plugins/clean-webpack/index.d.ts +1 -1
  115. package/dist/plugins/clean-webpack/index.js +1 -1
  116. package/dist/plugins/define-variable/define-variable-plugin.js +1 -1
  117. package/dist/plugins/module-federation/module-federation.d.ts +1 -1
  118. package/dist/plugins/module-federation/module-federation.js +1 -1
  119. package/dist/plugins/multi-html/index.d.ts +1 -1
  120. package/dist/plugins/multi-html/index.js +1 -1
  121. package/dist/plugins/multi-html/multi-html-cdn-plugin.js +1 -1
  122. package/dist/plugins/multi-html/multi-html-plugin.d.ts +1 -1
  123. package/dist/plugins/multi-html/multi-html-plugin.js +1 -1
  124. package/dist/plugins/stats-webpack/helper-write-stats.d.ts +28 -0
  125. package/dist/plugins/stats-webpack/helper-write-stats.js +1 -0
  126. package/dist/plugins/stats-webpack/index.d.ts +12 -0
  127. package/dist/plugins/stats-webpack/index.js +1 -0
  128. package/dist/plugins/stats-webpack/stats-webpack-plugin.d.ts +25 -0
  129. package/dist/plugins/stats-webpack/stats-webpack-plugin.js +1 -0
  130. package/dist/plugins/ts-checker/ts-checker-guard-plugin.d.ts +13 -0
  131. package/dist/plugins/ts-checker/ts-checker-guard-plugin.js +1 -0
  132. package/dist/plugins/ts-checker/ts-checker-plugin.d.ts +1 -2
  133. package/dist/plugins/ts-checker/ts-checker-plugin.js +1 -1
  134. package/dist/types/index.d.ts +3 -1
  135. package/dist/types/index.js +1 -1
  136. package/dist/types/types-analyzer.d.ts +70 -0
  137. package/dist/types/types-analyzer.js +1 -0
  138. package/dist/types/types-cli-options.d.ts +12 -0
  139. package/dist/types/types-cli-options.js +1 -0
  140. package/dist/types/types-dev-server.d.ts +17 -6
  141. package/dist/types/types-entry-map.d.ts +19 -1
  142. package/dist/types/types-global-compiler-options.d.ts +7 -0
  143. package/dist/types/types-global-compiler-options.js +1 -0
  144. package/dist/types/types-loader-options.d.ts +31 -9
  145. package/dist/types/types-options.d.ts +30 -15
  146. package/dist/types/types-threads-options.d.ts +18 -0
  147. package/dist/types/types-threads-options.js +1 -0
  148. package/dist/types/types-webpack.d.ts +5 -2
  149. package/package.json +66 -64
  150. package/templates/html-plugin/index-ntv.html +61 -0
  151. package/dist/dev-server/create-dev-server-compiler-tasks.d.ts +0 -3
  152. package/dist/dev-server/create-dev-server-compiler-tasks.js +0 -1
  153. package/dist/helpers/assert-only-single-entry-item.d.ts +0 -7
  154. package/dist/helpers/assert-only-single-entry-item.js +0 -1
  155. package/dist/helpers/split-to-multi-compiler.d.ts +0 -8
  156. package/dist/helpers/split-to-multi-compiler.js +0 -1
  157. package/dist/main/start-one-entry-build.d.ts +0 -13
  158. package/dist/main/start-one-entry-build.js +0 -1
  159. package/dist/plugins/ts-checker/index.d.ts +0 -1
  160. package/dist/plugins/ts-checker/index.js +0 -1
@@ -0,0 +1,2 @@
1
+ import { type FlatEvolveOptions } from '../types/types-options.js';
2
+ export declare const createGlobalCompiler: (serveMode: boolean, evolveOptions: FlatEvolveOptions) => Promise<boolean>;
@@ -0,0 +1 @@
1
+ import webpack from"webpack";import{getDirname}from"@armit/file-utility";import{createExternals}from"../create-webpack/create-externals.js";import{createResolve}from"../create-webpack/create-resolve.js";import{ruleBabel}from"../create-webpack/rule-sets/rule-scripts.js";import{createTsCheckerPlugins}from"../plugins/ts-checker/ts-checker-plugin.js";export const createGlobalCompiler=async(e,r)=>{const{projectCwd:t,webpack:o,devServer:a,globalCompilerOptions:c}=r,{runTsChecker:l=!0}=c||{};if(!l)return!1;const s=e?"development":"production",n=a?.watchOptions||{},p=[ruleBabel({})],i=[...createTsCheckerPlugins(e,r)],m={context:t,mode:s,watch:e,name:"flat/evolve/global-compiler",entry:{".global-compiler-bundle":["."]},resolve:createResolve(t,o),module:{rules:p},plugins:i,watchOptions:n,devtool:!1,externals:createExternals(o?.externals),cache:{type:"memory"},performance:{},output:{environment:{},path:getDirname(import.meta.url,"./")}};return new Promise(((e,r)=>{webpack(m,(t=>{if(t)return r(t.message);e(!0)}))}))};
@@ -1,3 +1,4 @@
1
+ import { type EvolveEntryItemOption } from './types/types-entry-map.js';
1
2
  export declare const moduleName = "@flatjs/evolve";
2
3
  /**
3
4
  * the configuration file of `flat-evolve`
@@ -22,3 +23,11 @@ export declare const devReactFastRefresh: {
22
23
  runtime: string;
23
24
  reactRefreshSetup: string;
24
25
  };
26
+ /**
27
+ * Array of keys to ignore in the verifyGroupEntryOptions step
28
+ */
29
+ export declare const ignoreEntryOptionKeys: Array<keyof EvolveEntryItemOption>;
30
+ /**
31
+ * The directory where the webpack stats files are stored. relative to projectCwd
32
+ */
33
+ export declare const webpackStatsDir = ".cache/stats";
package/dist/constants.js CHANGED
@@ -1 +1 @@
1
- export const moduleName="@flatjs/evolve";export const configFileName="flatjs-evolve";export const viewportScripts='(function(d){var j;var b=1;var i=1;var h=750;var c=100;function e(s,o){var q=d.document;var l=q.documentElement;var k=navigator.userAgent;var m=k.toLowerCase().indexOf("android")>-1;i=d.devicePixelRatio||1;if(i>3){i=3}if(m){i=1}console.log("current devicePixelRatio:",i);l.setAttribute("data-dpr",i.toString());var p=q.querySelector(\'meta[name="viewport"]\');if(!p){b=1/i;p=q.createElement("meta");p.setAttribute("name","viewport");q.head.appendChild(p);p.setAttribute(["content","width=device-width,user-scalable=no,initial-scale=",b,",maximum-scale=",b,",minimum-scale=",b].join(""))}function n(){var t=document.documentElement.clientWidth;j=t/o*(s/i)*i;q.documentElement.style.fontSize=String(j)+"px"}var r;d.addEventListener("resize",function(){clearTimeout(r);r=setTimeout(n,300)},false);d.addEventListener("onload",n,false);n()}e(c,h);window.fabricViewport={currRem:j,currDpr:i,currScale:b,dpiPX2px:function f(k){return parseFloat(k.toString())/j*100+"px"},px2DPIpx:function a(k){return parseFloat(k.toString())/100*j+"px"},px2rem:function g(k){return parseFloat(k.toString())/100+"rem"}}})(window);';export const polyfill=["https://polyfill.io/v3/polyfill.min.js?features=Array.from%2CArray.isArray%2CArray.of%2CArray.prototype.entries%2CArray.prototype.every%2CArray.prototype.fill%2CArray.prototype.filter%2CArray.prototype.find%2CArray.prototype.findIndex%2CArray.prototype.flat%2CArray.prototype.forEach%2CArray.prototype.flatMap%2CArray.prototype.keys%2CArray.prototype.indexOf%2CArray.prototype.includes%2CArray.prototype.lastIndexOf%2CArray.prototype.map%2CArray.prototype.reduce%2CArray.prototype.reduceRight%2CArray.prototype.some%2CArray.prototype.sort%2CArray.prototype.values%2CArrayBuffer%2CBlob%2CDataView%2CDate.now%2CObject.assign%2CObject.create%2CObject.defineProperties%2CObject.defineProperty%2CObject.entries%2CObject.freeze%2CObject.fromEntries%2CObject.getOwnPropertySymbols%2CObject.getOwnPropertyNames%2CObject.getOwnPropertyDescriptors%2CObject.getOwnPropertyDescriptor%2CObject.getPrototypeOf%2CObject.is%2CObject.isExtensible%2CObject.isFrozen%2CObject.isSealed%2CObject.keys%2CObject.values%2CObject.setPrototypeOf%2CPromise%2CPromise.prototype.finally%2CReflect%2CReflect.apply%2CReflect.construct%2CReflect.defineProperty%2CReflect.deleteProperty%2CReflect.getPrototypeOf%2CReflect.getOwnPropertyDescriptor%2CReflect.get%2CReflect.ownKeys%2CReflect.isExtensible%2CReflect.has%2CReflect.preventExtensions%2CReflect.set%2CReflect.setPrototypeOf%2CSet%2CString.prototype.trimStart%2CString.prototype.trimEnd%2CString.prototype.trim%2CString.prototype.startsWith%2CString.prototype.repeat%2CString.prototype.replaceAll%2CString.prototype.padStart%2CString.prototype.padEnd%2CMap%2CObject.seal%2Cconsole.groupEnd%2Cconsole.group"];export const devReactFastRefresh={runtime:"reactRefreshRuntime",reactRefreshSetup:"reactRefreshSetup"};
1
+ export const moduleName="@flatjs/evolve";export const configFileName="flatjs-evolve";export const viewportScripts='(function(d){var j;var b=1;var i=1;var h=750;var c=100;function e(s,o){var q=d.document;var l=q.documentElement;var k=navigator.userAgent;var m=k.toLowerCase().indexOf("android")>-1;i=d.devicePixelRatio||1;if(i>3){i=3}if(m){i=1}console.log("current devicePixelRatio:",i);l.setAttribute("data-dpr",i.toString());var p=q.querySelector(\'meta[name="viewport"]\');if(!p){b=1/i;p=q.createElement("meta");p.setAttribute("name","viewport");q.head.appendChild(p);p.setAttribute(["content","width=device-width,user-scalable=no,initial-scale=",b,",maximum-scale=",b,",minimum-scale=",b].join(""))}function n(){var t=document.documentElement.clientWidth;j=t/o*(s/i)*i;q.documentElement.style.fontSize=String(j)+"px"}var r;d.addEventListener("resize",function(){clearTimeout(r);r=setTimeout(n,300)},false);d.addEventListener("onload",n,false);n()}e(c,h);window.fabricViewport={currRem:j,currDpr:i,currScale:b,dpiPX2px:function f(k){return parseFloat(k.toString())/j*100+"px"},px2DPIpx:function a(k){return parseFloat(k.toString())/100*j+"px"},px2rem:function g(k){return parseFloat(k.toString())/100+"rem"}}})(window);';export const polyfill=["https://polyfill.io/v3/polyfill.min.js?features=Array.from%2CArray.isArray%2CArray.of%2CArray.prototype.entries%2CArray.prototype.every%2CArray.prototype.fill%2CArray.prototype.filter%2CArray.prototype.find%2CArray.prototype.findIndex%2CArray.prototype.flat%2CArray.prototype.forEach%2CArray.prototype.flatMap%2CArray.prototype.keys%2CArray.prototype.indexOf%2CArray.prototype.includes%2CArray.prototype.lastIndexOf%2CArray.prototype.map%2CArray.prototype.reduce%2CArray.prototype.reduceRight%2CArray.prototype.some%2CArray.prototype.sort%2CArray.prototype.values%2CArrayBuffer%2CBlob%2CDataView%2CDate.now%2CObject.assign%2CObject.create%2CObject.defineProperties%2CObject.defineProperty%2CObject.entries%2CObject.freeze%2CObject.fromEntries%2CObject.getOwnPropertySymbols%2CObject.getOwnPropertyNames%2CObject.getOwnPropertyDescriptors%2CObject.getOwnPropertyDescriptor%2CObject.getPrototypeOf%2CObject.is%2CObject.isExtensible%2CObject.isFrozen%2CObject.isSealed%2CObject.keys%2CObject.values%2CObject.setPrototypeOf%2CPromise%2CPromise.prototype.finally%2CReflect%2CReflect.apply%2CReflect.construct%2CReflect.defineProperty%2CReflect.deleteProperty%2CReflect.getPrototypeOf%2CReflect.getOwnPropertyDescriptor%2CReflect.get%2CReflect.ownKeys%2CReflect.isExtensible%2CReflect.has%2CReflect.preventExtensions%2CReflect.set%2CReflect.setPrototypeOf%2CSet%2CString.prototype.trimStart%2CString.prototype.trimEnd%2CString.prototype.trim%2CString.prototype.startsWith%2CString.prototype.repeat%2CString.prototype.replaceAll%2CString.prototype.padStart%2CString.prototype.padEnd%2CMap%2CObject.seal%2Cconsole.groupEnd%2Cconsole.group"];export const devReactFastRefresh={runtime:"reactRefreshRuntime",reactRefreshSetup:"reactRefreshSetup"};export const ignoreEntryOptionKeys=["title"];export const webpackStatsDir=".cache/stats";
@@ -1,4 +1,4 @@
1
1
  import { type Configuration } from 'webpack';
2
2
  import { type EntryMapItem } from '../types/types-entry-map.js';
3
3
  import { type FlatEvolveWebpackOptions } from '../types/types-webpack.js';
4
- export declare const createExternals: (externals: FlatEvolveWebpackOptions['externals'], entryItem: EntryMapItem) => Configuration['externals'];
4
+ export declare const createExternals: (externals?: FlatEvolveWebpackOptions["externals"], entryItem?: EntryMapItem) => Configuration["externals"];
@@ -1 +1 @@
1
- import{mergeOptions}from"@flatjs/common";export const createExternals=(t={},e)=>{const o=e[1],r=o.options?.externals||{};return mergeOptions(t,r)};
1
+ import{mergeOptions}from"@flatjs/common";export const createExternals=(t={},e)=>{const o=e?.[1];return mergeOptions(t,o?.options?.externals||{})};
@@ -1,4 +1,4 @@
1
1
  import { type Configuration } from 'webpack';
2
2
  import { type EntryMapItem } from '../types/types-entry-map.js';
3
3
  import { type FlatEvolveOptions } from '../types/types-options.js';
4
- export declare const createOptimization: (serveMode: boolean, evolveOptions: FlatEvolveOptions, entryItem: EntryMapItem) => Configuration['optimization'];
4
+ export declare const createOptimization: (serveMode: boolean, evolveOptions: FlatEvolveOptions, entryMapItem: EntryMapItem) => Configuration["optimization"];
@@ -1 +1 @@
1
- import{join}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:()=>join(n[0],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
+ import{join}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=>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,4 +1,4 @@
1
1
  import { type Configuration } from 'webpack';
2
2
  import { type EntryMapItem } from '../types/types-entry-map.js';
3
3
  import { type FlatEvolveOptions } from '../types/types-options.js';
4
- export declare const createOutput: (serveMode: boolean, evolveOptions: FlatEvolveOptions, entryItem: EntryMapItem) => Promise<Configuration['output']>;
4
+ export declare const createOutput: (serveMode: boolean, evolveOptions: FlatEvolveOptions, entryItem: EntryMapItem) => Promise<Configuration["output"]>;
@@ -1,2 +1,2 @@
1
1
  import { type FlatEvolveWebpackOptions } from '../types/types-webpack.js';
2
- export declare const createPerformance: (serveMode: boolean, performanceOptions?: FlatEvolveWebpackOptions['performance']) => FlatEvolveWebpackOptions['performance'];
2
+ export declare const createPerformance: (serveMode: boolean, performanceOptions?: FlatEvolveWebpackOptions["performance"]) => FlatEvolveWebpackOptions["performance"];
@@ -1,4 +1,5 @@
1
+ import { FlatCliOptions } from '../types/types-cli-options.js';
1
2
  import { type EntryMapItem } from '../types/types-entry-map.js';
2
3
  import { type FlatEvolveOptions } from '../types/types-options.js';
3
4
  import { type FlatEvolveWebpackOptions } from '../types/types-webpack.js';
4
- export declare const createPlugins: (serveMode: boolean, entryMapItem: EntryMapItem, evolveOptions: FlatEvolveOptions) => Promise<FlatEvolveWebpackOptions['plugins']>;
5
+ export declare const createPlugins: (serveMode: boolean, entryMapItemList: EntryMapItem[], evolveOptions: FlatEvolveOptions, cliOptions?: FlatCliOptions) => Promise<FlatEvolveWebpackOptions["plugins"]>;
@@ -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 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";import{createTsCheckerPlugins}from"../plugins/ts-checker/index.js";export const createPlugins=async(e,a,n)=>{const[r,l]=a,i=enableBundleHashNameForModule(n,l?.options),s=[new webpack.WatchIgnorePlugin({paths:[/\.d\.[cm]ts$/]}),new CaseSensitivePathsPlugin,...createCircularDependencyPlugin(e,n),new MiniCssExtractPlugin({filename:`[name]/${getBundleFileName("css",e,i)}`,chunkFilename:"[id].[contenthash].css"}),...await createBuiltinDefineVariables(e,n),...createCleanWebpackPlugin(e,a,n),...createModuleFederationPlugin(e,a,n),...createHtmlPlugins(e,a,n),...createTsCheckerPlugins(e,a,n)];n.analyzer&&s.push(new BundleAnalyzerPlugin({analyzerPort:"auto",analyzerMode:"server",...n.analyzer}));const t=shouldEnableReactFastRefresh(e,a,n);t&&s.push(new ReactRefreshWebpackPlugin({overlay:!1})),!t&&e&&(n.devServer?.liveReload?logger.warn('The HMR disabled cause of "liveReload" specificed'):logger.warn(`The HMR disabled cause of \`"moduleFederation":"${r}"\``));const o=n.webpack?.plugins||[];return s.concat(o)};
1
+ import CaseSensitivePathsPlugin from"case-sensitive-paths-webpack-plugin";import MiniCssExtractPlugin from"mini-css-extract-plugin";import webpack from"webpack";import{logger}from"@flatjs/common";import ReactRefreshWebpackPlugin from"@pmmmwh/react-refresh-webpack-plugin";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";import{createStatsWebpackPlugin}from"../plugins/stats-webpack/index.js";export const createPlugins=async(e,a,n,i)=>{const r=a[0],[l,t]=r,s=enableBundleHashNameForModule(n,t?.options),o=[new webpack.WatchIgnorePlugin({paths:[/\.d\.[cm]ts$/]}),new CaseSensitivePathsPlugin,...createCircularDependencyPlugin(e,n),new MiniCssExtractPlugin({filename:`[name]/${getBundleFileName("css",e,s)}`,chunkFilename:"[id].[contenthash].css"}),...await createBuiltinDefineVariables(e,n),...createCleanWebpackPlugin(e,a,n),...createModuleFederationPlugin(e,a,n),...createHtmlPlugins(e,a,n),...createStatsWebpackPlugin(e,n,i)],c=shouldEnableReactFastRefresh(e,r,n);c&&o.push(new ReactRefreshWebpackPlugin({overlay:!1})),!c&&e&&(n.devServer?.liveReload?logger.warn('The HMR disabled cause of "liveReload" specificed'):logger.warn(`The HMR disabled cause of \`"moduleFederation":"${l}"\``));const u=n.webpack?.plugins||[];return o.concat(u)};
@@ -1 +1 @@
1
- import{join}from"node:path";import{mergeOptions}from"@flatjs/common";import{TsconfigPathsPlugin}from"tsconfig-paths-webpack-plugin";export const createResolve=(s,o)=>{const n={mainFields:["browser","module","main"],extensions:[".ts",".tsx",".js",".json"],extensionAlias:{".js":[".js",".ts"],".cjs":[".cjs",".cts"],".mjs":[".mjs",".mts"],".jsx":[".jsx",".tsx"]},plugins:[new TsconfigPathsPlugin({configFile:join(s,"tsconfig.json"),extensions:[".ts",".tsx",".js",".jsx"]})]};return mergeOptions(n,o?.resolve||{})};
1
+ import{join}from"node:path";import{TsconfigPathsPlugin}from"tsconfig-paths-webpack-plugin";import{mergeOptions}from"@flatjs/common";export const createResolve=(s,o)=>{const t={mainFields:["browser","module","main"],extensions:[".ts",".tsx",".js",".jsx",".mjs",".cjs",".mts",".cts",".json"],extensionAlias:{".js":[".js",".ts"],".cjs":[".cjs",".cts"],".mjs":[".mjs",".mts"],".jsx":[".jsx",".tsx"]},plugins:[new TsconfigPathsPlugin({configFile:join(s,"tsconfig.json"),extensions:[".ts",".tsx",".js",".jsx",".mjs"]})]};return mergeOptions(t,o?.resolve||{})};
@@ -1,4 +1,4 @@
1
1
  import { type RuleSetRule } from 'webpack';
2
2
  import { type EntryMapItem } from '../types/types-entry-map.js';
3
3
  import { type FlatEvolveOptions } from '../types/types-options.js';
4
- export declare const createRuleSets: (serveMode: boolean, entryMapItem: EntryMapItem, evolveOptions: FlatEvolveOptions) => RuleSetRule[];
4
+ export declare const createRuleSets: (serveMode: boolean, entryMapItemList: EntryMapItem[], evolveOptions: FlatEvolveOptions) => RuleSetRule[];
@@ -1 +1 @@
1
- import{ruleAssets}from"./rule-sets/rule-assets.js";import{ruleCss}from"./rule-sets/rule-css.js";import{ruleLess}from"./rule-sets/rule-less.js";import{ruleScripts}from"./rule-sets/rule-scripts.js";import{ruleSvgIcon}from"./rule-sets/rule-svg-icon.js";export const createRuleSets=(s,e,r)=>{const l=[ruleSvgIcon(),ruleAssets(e,r),ruleCss(s,e,r,!1),ruleCss(s,e,r,!0),ruleLess(s,e,r),ruleScripts(s,e,r)],t=r.webpack?.ruleSets||[];return l.concat(t)};
1
+ import{ruleAssets}from"./rule-sets/rule-assets.js";import{ruleCss}from"./rule-sets/rule-css.js";import{ruleLess}from"./rule-sets/rule-less.js";import{ruleScripts}from"./rule-sets/rule-scripts.js";import{ruleSvgIcon}from"./rule-sets/rule-svg-icon.js";export const createRuleSets=(s,e,r)=>{const l=e[0],t=[ruleSvgIcon(),ruleAssets(e,r),ruleCss(s,l,r,!1),ruleCss(s,l,r,!0),ruleLess(s,l,r),ruleScripts(s,l,r)],u=r.webpack?.ruleSets||[];return t.concat(u)};
@@ -0,0 +1,12 @@
1
+ import { type FlatEvolveDevServerOptions } from '../types/types-dev-server.js';
2
+ import { EvolveEntryMap } from '../types/types-entry-map.js';
3
+ import { type FlatEvolveOptions } from '../types/types-options.js';
4
+ /**
5
+ * Loads the watch options for webpack configuration.
6
+ *
7
+ * @param groupEntryMap - The map of entry.
8
+ * @param evolveOptions - The options for the evolve process.
9
+ * @param originalOptions - The original watch options to be merged with.
10
+ * @returns The updated watch options for webpack configuration.
11
+ */
12
+ export declare const loadWatchOptions: (groupEntryMap: EvolveEntryMap, evolveOptions: FlatEvolveOptions, originalOptions?: FlatEvolveDevServerOptions["watchOptions"]) => FlatEvolveDevServerOptions["watchOptions"];
@@ -0,0 +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,t={})=>{const{ignored:r=[]}=t,{entryMap:n}=e,s=normalizeEntryModuleAbsolutePath(e,o),l=normalizeEntryModuleAbsolutePath(e,n);for(const o of l){existsSync(o)||logger.warn(`The module path does not exist. Check ${o}`);s.findIndex((e=>e===o))<0&&r.push(`**${o}**/*`)}return{...t,ignored:r}};
@@ -1,4 +1,5 @@
1
1
  import { type Configuration } from 'webpack';
2
+ import { FlatCliOptions } from '../types/types-cli-options.js';
2
3
  import { type EvolveEntryMap } from '../types/types-entry-map.js';
3
4
  import { type FlatEvolveOptions } from '../types/types-options.js';
4
5
  /**
@@ -7,4 +8,4 @@ import { type FlatEvolveOptions } from '../types/types-options.js';
7
8
  * @param entryMap The only single one `servedEntry` or `toBuildEntry`
8
9
  * @param overrideOptions The manually override configuration options for flatjsEvolve
9
10
  */
10
- export declare const loadWebpackConfig: (mode: 'production' | 'development', entryMap: EvolveEntryMap, evolveOptions: FlatEvolveOptions) => Promise<Omit<Configuration, 'entry'>>;
11
+ export declare const loadWebpackConfig: (mode: "production" | "development", entryMap: EvolveEntryMap, evolveOptions: FlatEvolveOptions, cliOptions?: FlatCliOptions) => Promise<Omit<Configuration, "entry">>;
@@ -1 +1 @@
1
- import{assertOnlySingleEntryItem}from"../helpers/assert-only-single-entry-item.js";import{createExternals}from"./create-externals.js";import{createOptimization}from"./create-optimization.js";import{createOutput}from"./create-output.js";import{createPerformance}from"./create-performance.js";import{createPlugins}from"./create-plugins.js";import{createResolve}from"./create-resolve.js";import{createRuleSets}from"./create-rule-sets.js";export const loadWebpackConfig=async(e,t,r)=>{const a="development"===e,{projectCwd:o,webpack:s,devServer:n}=r,c=n?.watchOptions,i=assertOnlySingleEntryItem(t,r),m=createRuleSets(a,i,r);return{mode:e,plugins:await createPlugins(a,i,r),watchOptions:c,output:await createOutput(a,r,i),context:o,target:s?.target??["web","es5"],resolve:createResolve(o,s),module:{rules:m},devtool:a?"eval-source-map":s?.sourceMap||!1,externalsType:s?.externalsType,externals:createExternals(s?.externals,i),performance:createPerformance(a,s?.performance),optimization:createOptimization(a,r,i),infrastructureLogging:s?.infrastructureLogging??{level:"warn"},stats:s?.stats??{preset:"minimal"},cache:{type:"memory"}}};
1
+ import{assertGroupEntryItem}from"../helpers/assert-group-entry-item.js";import{createExternals}from"./create-externals.js";import{createOptimization}from"./create-optimization.js";import{createOutput}from"./create-output.js";import{createPerformance}from"./create-performance.js";import{createPlugins}from"./create-plugins.js";import{createResolve}from"./create-resolve.js";import{createRuleSets}from"./create-rule-sets.js";import{loadWatchOptions}from"./load-watch-options.js";export const loadWebpackConfig=async(e,t,r,a)=>{const o="development"===e,{projectCwd:s,webpack:c,devServer:n}=r,p=loadWatchOptions(t,r,n?.watchOptions),i=assertGroupEntryItem(t,r),m=createRuleSets(o,i,r),l=await createPlugins(o,i,r,a),u=i[0];return{mode:e,plugins:l,watchOptions:p,output:await createOutput(o,r,u),context:s,target:c?.target??["web","es5"],resolve:createResolve(s,c),module:{rules:m},devtool:o?"eval-source-map":c?.sourceMap||!1,externalsType:c?.externalsType,externals:createExternals(c?.externals,u),performance:createPerformance(o,c?.performance),optimization:createOptimization(o,r,u),infrastructureLogging:c?.infrastructureLogging??{level:"warn"},stats:c?.stats??{preset:"errors-warnings"},cache:{type:"memory"}}};
@@ -5,6 +5,6 @@ import { type FlatEvolveOptions } from '../../types/types-options.js';
5
5
  * Preparing image loader for normal pictures except stored in folder `icons`
6
6
  * Webpack@5 don't need `file-loader`, `raw-loader`, `url-loader` provider us `asset-modules`
7
7
  * https://webpack.js.org/guides/asset-modules/
8
- * @param entryItem The available entries, `development` it contains multiple enties, `production` only one entry in once build.
8
+ * @param entryMapItemList The available entries, `development` it contains multiple enties, `production`
9
9
  */
10
- export declare const ruleAssets: (entryItem: EntryMapItem, evolveOptions: FlatEvolveOptions) => RuleSetRule;
10
+ export declare const ruleAssets: (entryMapItemList: EntryMapItem[], evolveOptions: FlatEvolveOptions) => RuleSetRule;
@@ -1 +1 @@
1
- import{dirname,join,relative,resolve}from"node:path";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[s,o]=t,{projectCwd:a,projectVirtualPath:i}=r;let n=dirname(join(i,e.replace(/^src/,"")));const l=o.entry.map((e=>dirname(join(a,e)))),m=resolve(a,e),c=l.find((e=>m.startsWith(e)));return c&&(n=dirname(join(s,relative(c,m)))),`${n}/[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
+ 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:s}=r;let n=dirname(join(s,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:s}=t,a=dirname(join(o,s)),i=resolve(o,e);if(i.startsWith(ensureSlash(a,!0))){n=dirname(join(r,relative(a,i)));break}}return`${n}/[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{requireResolve}from"@flatjs/common";import{forgePostcssPluginPixel}from"@flatjs/forge-postcss-plugin-pixel";import cssnano from"cssnano";import MiniCssExtractPlugin from"mini-css-extract-plugin";import{allowPx2remForModule}from"../../helpers/allow-px2rem-for-module.js";const getPostcssOptions=(s,o={},e={})=>{const r=[...e.plugins||[],cssnano({preset:["default",{discardComments:{removeAll:!s},reduceInitial:!1,normalizeWhitespace:!s,...e.cssnanoOptions}]})];return!1!==o&&r.push(forgePostcssPluginPixel(o)),{plugins:r}};export const ruleCss=(s,o,e,r=!1)=>{const{pixelOptions:t,cssLoaderOptions:i={},postcssOptions:l}=e.loaderOptions,n=r?{}:{modules:!1},p={test:/\.css$/i,use:[{loader:MiniCssExtractPlugin.loader,options:{esModule:!0}},{loader:requireResolve(import.meta.url,"css-loader"),options:{sourceMap:s,...i,...n}}]};r?p.include=/\.module\.css$/i:p.exclude=/\.module\.css$/i;const c=allowPx2remForModule(o,e);if(Array.isArray(p.use)){const o=getPostcssOptions(s,!!c&&t,l);p.use.push({loader:requireResolve(import.meta.url,"postcss-loader"),options:{postcssOptions:{...o,config:!1},sourceMap:s}})}return p};
1
+ import cssnano from"cssnano";import MiniCssExtractPlugin from"mini-css-extract-plugin";import{requireResolve}from"@flatjs/common";import{forgePostcssPluginPixel}from"@flatjs/forge-postcss-plugin-pixel";import{allowPx2remForModule}from"../../helpers/allow-px2rem-for-module.js";const getPostcssOptions=(s,o={},e={})=>{const r=[...e.plugins||[],cssnano({preset:["default",{discardComments:{removeAll:!s},reduceInitial:!1,normalizeWhitespace:!s,...e.cssnanoOptions}]})];return!1!==o&&r.push(forgePostcssPluginPixel(o)),{plugins:r}};export const ruleCss=(s,o,e,r=!1)=>{const{pixelOptions:t,cssLoaderOptions:i={},postcssOptions:l}=e.loaderOptions,{modules:n,...p}=i,c=r?{modules:Object.assign({namedExport:!1},n)}:{modules:!1},u={test:/\.css$/i,use:[{loader:MiniCssExtractPlugin.loader,options:{esModule:!0}},{loader:requireResolve(import.meta.url,"css-loader"),options:{sourceMap:s,...c,...p}}]};r?u.include=/\.module\.css$/i:u.exclude=/\.module\.css$/i;const a=allowPx2remForModule(o,e);if(Array.isArray(u.use)){const o=getPostcssOptions(s,!!a&&t,l);u.use.push({loader:requireResolve(import.meta.url,"postcss-loader"),options:{postcssOptions:{...o,config:!1},sourceMap:s}})}return u};
@@ -1,3 +1,5 @@
1
1
  import { type RuleSetRule } from 'webpack';
2
+ import { type TransformOptions } from '@babel/core';
2
3
  import { type EntryMapItem, type FlatEvolveOptions } from '../../types/index.js';
4
+ export declare const ruleBabel: (options: TransformOptions) => RuleSetRule;
3
5
  export declare const ruleScripts: (serveMode: boolean, entryMapItem: EntryMapItem, evolveOptions: FlatEvolveOptions) => RuleSetRule;
@@ -1 +1 @@
1
- import{requireResolve}from"@flatjs/common";import{mergeBabelOption}from"../../helpers/merge-babel-options.js";import{shouldEnableReactFastRefresh}from"../../helpers/should-enable-react-fast-refresh.js";export const ruleScripts=(e,r,s)=>{const{babelOptions:o={},modularImports:t=[]}=s.loaderOptions,l=mergeBabelOption(t,o);shouldEnableReactFastRefresh(e,r,s)&&(l.plugins?l.plugins.push(requireResolve(import.meta.url,"react-refresh/babel")):l.plugins=[requireResolve(import.meta.url,"react-refresh/babel")]);return{test:/\.(tsx|ts|js|jsx)$/,use:[{loader:requireResolve(import.meta.url,"babel-loader"),options:l}]}};
1
+ import{requireResolve}from"@flatjs/common";import{mergeBabelOption}from"../../helpers/merge-babel-options.js";import{shouldEnableReactFastRefresh}from"../../helpers/should-enable-react-fast-refresh.js";export const ruleBabel=e=>({test:/\.(tsx|ts|js|jsx|mjs|cjs|mts|cts)$/,use:[{loader:requireResolve(import.meta.url,"babel-loader"),options:e}]});export const ruleScripts=(e,r,s)=>{const{babelOptions:t={},modularImports:o=[]}=s.loaderOptions,l=mergeBabelOption(e,o,t);return shouldEnableReactFastRefresh(e,r,s)&&(l.plugins?l.plugins.push(requireResolve(import.meta.url,"react-refresh/babel")):l.plugins=[requireResolve(import.meta.url,"react-refresh/babel")]),ruleBabel(l)};
@@ -1,2 +1,2 @@
1
- import { type WebpackPluginInstance, type Compiler } from 'webpack';
1
+ import { type Compiler, type WebpackPluginInstance } from 'webpack';
2
2
  export type WebpackPlugin = ((this: Compiler, compiler: Compiler) => void) | WebpackPluginInstance;
@@ -1 +1 @@
1
- export const defaultEvolveOptions={projectCwd:process.cwd(),projectVirtualPath:"flatjs/evolve",rejectWarnings:!1,devServer:{autoOpen:!0,pageProxy:"/pages",mockOptions:{mockBaseDir:"mocks"},clientOverlay:{errors:!0,warnings:!1},webSocketURL:"localIp",middlewares:[],watchOptions:{poll:1e3,ignored:["**/node_modules","**/mocks"],aggregateTimeout:500},defaultServeGlobalData:()=>Promise.resolve({}),bundleDirResolver:e=>e},webpack:{target:["web","es5"],plugins:[],ruleSets:[],publicPath:"auto",resolve:{},externals:{vue:"Vue",react:"React","react-dom":"ReactDOM"},outputDir:"public",enableBundleHashName:!0},pluginOptions:{},loaderOptions:{assetDataUrlMaxSize:4096,babelOptions:{usePreset:"react",plugins:[],presets:[]},runTsChecker:!0,lessOptions:{},postcssOptions:{cssnanoOptions:{}},pixelOptions:{rootValue:{px:100,rpx:1},outputUnit:"rem"},modularImports:[]},entryMap:{},multiHtmlCdn:{},multiHtmlCdnEnvResolver:function cdnResolver(){},needVerifyPackages:{},packageInstallChecker:{enabled:!1,detectModules:["@dimjs/*"],throwError:!1,showAllInstalledGraph:!0},maxProcesses:5,ci:{basedBranch:"origin/master"}};
1
+ export const defaultEvolveOptions={projectCwd:process.cwd(),projectVirtualPath:"flatjs/evolve",rejectWarnings:!1,devServer:{autoOpen:!0,pageProxy:"/pages",mockOptions:{mockBaseDir:"mocks"},clientOverlay:{errors:!0,warnings:!1},webSocketURL:"localIp",middlewares:[],watchOptions:{poll:1e3,ignored:["**/node_modules","**/mocks"],aggregateTimeout:500},defaultServeGlobalData:()=>Promise.resolve({}),bundleDirResolver:e=>e},webpack:{target:["web","es5"],plugins:[],ruleSets:[],publicPath:"auto",resolve:{},externals:{vue:"Vue",react:"React","react-dom":"ReactDOM"},outputDir:"public",enableBundleHashName:!0},pluginOptions:{},loaderOptions:{assetDataUrlMaxSize:4096,babelOptions:{usePreset:"react",plugins:[],presets:[]},lessOptions:{},postcssOptions:{cssnanoOptions:{}},pixelOptions:{rootValue:{px:100,rpx:1},outputUnit:"rem"},modularImports:[]},globalCompilerOptions:{runTsChecker:!0},entryMap:{},multiHtmlCdn:{},multiHtmlCdnEnvResolver:function cdnResolver(){},needVerifyPackages:{},packageInstallChecker:{enabled:!1,detectModules:["@dimjs/*"],throwError:!1,showAllInstalledGraph:!0},ci:{basedBranch:"origin/master"},isolation:!1,maxEntryGroupSize:10};
@@ -1,6 +1,6 @@
1
- import { type UserConfigExport, type ConfigEnvBase } from '@armit/config-loader';
2
- import { type requireResolve } from '@flatjs/common';
3
1
  import { type PartialDeep } from 'type-fest';
2
+ import { type ConfigEnvBase, type UserConfigExport } from '@armit/config-loader';
3
+ import { type requireResolve } from '@flatjs/common';
4
4
  import { type FlatEvolveOptions } from '../types/types-options.js';
5
5
  export interface EvolveConfigBase extends ConfigEnvBase {
6
6
  /**
@@ -1 +1 @@
1
- import{join}from"node:path";import WebpackDevServer from"webpack-dev-server";export const addCompilerToDevServer=(e,o,r,t,s)=>{const{projectCwd:p,devServer:c}=s,l=new WebpackDevServer({server:{type:c?.https?"https":"http",options:{...c?.https}},open:!1,compress:!0,port:r,hot:o,liveReload:!o,allowedHosts:"all",static:{directory:`${join(p,"/public")}`},headers:{"Access-Control-Allow-Origin":"*"},client:{progress:!0,overlay:c?.clientOverlay,webSocketURL:"localIp"===c?.webSocketURL?{hostname:t||void 0}:{hostname:"0.0.0.0",...c?.webSocketURL}}},e);return new Promise(((e,o)=>{l.startCallback((r=>{if(r)return o(r);e(!0)}))}))};
1
+ import{join}from"node:path";import WebpackDevServer from"webpack-dev-server";export const addCompilerToDevServer=(e,r,t,o,s)=>{const{projectCwd:d,devServer:l}=s,a=new WebpackDevServer({server:{type:l?.https?"https":"http",options:{...l?.https}},open:!1,compress:!0,port:t,hot:r,liveReload:!r,allowedHosts:"all",static:{directory:`${join(d,"/public")}`},headers:{"Access-Control-Allow-Origin":"*"},setupMiddlewares:e=>(l?.devBeforeMiddlewares&&e.unshift(...l.devBeforeMiddlewares),l?.devAfterMiddlewares&&e.push(...l.devAfterMiddlewares),e),client:{progress:!0,overlay:l?.clientOverlay,webSocketURL:"localIp"===l?.webSocketURL?{hostname:o||void 0}:{hostname:"0.0.0.0",...l?.webSocketURL}}},e);return new Promise(((e,r)=>{a.startCallback((t=>{if(t)return r(t);e(!0)}))}))};
@@ -0,0 +1,3 @@
1
+ import { type FlatEvolveOptions } from '../types/types-options.js';
2
+ import { type EvolveDevServerEntryMap } from './middlewares/types.js';
3
+ export declare const createDevServerCompilerTask: (publicIp: string, servedDevServerEntries: EvolveDevServerEntryMap, servedDevServerEntryList: Array<EvolveDevServerEntryMap>, evolveOptions: FlatEvolveOptions) => Promise<boolean>;
@@ -0,0 +1 @@
1
+ import{relative}from"node:path";import webpack from"webpack";import{chalk,logger,mergeOptions,urlJoin}from"@flatjs/common";import{loadWebpackConfig}from"../create-webpack/load-webpack-config.js";import{assertSingleCompiler}from"../helpers/assert-single-compiler.js";import{flatEntryMap}from"../helpers/flat-entry-map.js";import{shouldEnableReactFastRefresh}from"../helpers/should-enable-react-fast-refresh.js";import{addCompilerToDevServer}from"./add-compiler-to-dev-server.js";export const createDevServerCompilerTask=async(e,r,o,t)=>{const{projectCwd:a}=t,[n,i]=Object.entries(r)[0],{devServerPort:s,devServerHostUri:l}=i;for(const[,e]of Object.entries(r)){const r=e.entryConfig,t=r.options?.moduleFederation,a=t?.remotes||[],n=flatEntryMap(o);a.forEach((e=>{e.endpoint=e=>{const r=n[e];if(!r)throw new Error(`No servedDevServerEntry found via "${e}"`);return urlJoin(r?.devServerHostUri,["/public"])}}))}const p=Object.keys(r).reduce(((e,o)=>(e[o]=r[o].entryConfig,e)),{}),c=urlJoin(l,["public"]),m=await loadWebpackConfig("development",p,mergeOptions(t,{webpack:{publicPath:c}})),f=shouldEnableReactFastRefresh(!0,[n,i.entryConfig],t),d=assertSingleCompiler(p,m,t,f),v=webpack(d),h=addCompilerToDevServer(v,f,s,e,t),b=v.name||"";return v.hooks.invalid.tap("fileChange",(e=>{const r=relative(a,e||"");logger.info(`file change ➩ ${chalk(["cyan"])(r||"")}`,b)})),h};
@@ -1,4 +1,4 @@
1
1
  import { type EvolveEntryMap } from '../types/types-entry-map.js';
2
2
  import { type FlatEvolveOptions } from '../types/types-options.js';
3
3
  import { type EvolveDevServerEntryMap } from './middlewares/types.js';
4
- export declare const createDevServerEntries: (startPort: number, servedEntries: EvolveEntryMap, evolveOptions: FlatEvolveOptions) => Promise<EvolveDevServerEntryMap>;
4
+ export declare const createDevServerEntries: (lastPort: number, servedEntries: EvolveEntryMap, evolveOptions: FlatEvolveOptions) => Promise<EvolveDevServerEntryMap>;
@@ -1 +1 @@
1
- import{mergeOptions}from"@flatjs/common";import{prepareMockDomain}from"@flatjs/mock";import{normalizeEvolveEntryName}from"../helpers/normalize-entry-map.js";export const createDevServerEntries=async(r,e,o)=>{const{devServer:t,projectVirtualPath:n}=o,m={};let a=r;for(const[r,o]of Object.entries(e)){a+=1;const{mockPort:e,hostUri:i}=await prepareMockDomain(mergeOptions(t?.mockOptions||{},{port:a})),s=normalizeEvolveEntryName(r,n);m[r]={entryConfig:o,devServerPort:e,devServerHostUri:i,normalizedEntryName:s}}return m};
1
+ import{mergeOptions}from"@flatjs/common";import{prepareMockDomain}from"@flatjs/mock";import{normalizeEvolveEntryName}from"../helpers/normalize-entry-map.js";export const createDevServerEntries=async(r,e,o)=>{const{devServer:t,projectVirtualPath:n}=o,m={},{mockPort:a,hostUri:i}=await prepareMockDomain(mergeOptions(t?.mockOptions||{},{port:r}));for(const[r,o]of Object.entries(e)){const e=normalizeEvolveEntryName(r,n);m[r]={entryConfig:o,devServerPort:a,devServerHostUri:i,normalizedEntryName:e}}return m};
@@ -1 +1 @@
1
- import https from"node:https";import{prepareMockDomain}from"@flatjs/mock";import express from"express";export const createDevServer=async e=>{const r=express(),t=e.devServer?.mockOptions,{mockPort:o,hostUri:p,publicIp:s}=await prepareMockDomain(t||{});return new Promise((t=>{const i=e.devServer?.https?https.createServer(e.devServer?.https,r):r;r.set("hostUri",p),i.listen(o,(()=>{t({app:r,publicIp:s,devHostUri:p,devPort:o})}))}))};
1
+ import express from"express";import https from"node:https";import{prepareMockDomain}from"@flatjs/mock";export const createDevServer=async e=>{const r=express(),t=e.devServer?.mockOptions,{mockPort:o,hostUri:p,publicIp:s}=await prepareMockDomain(t||{});return new Promise((t=>{const i=e.devServer?.https?https.createServer(e.devServer?.https,r):r;r.set("hostUri",p),i.listen(o,(()=>{t({app:r,publicIp:s,devHostUri:p,devPort:o})}))}))};
@@ -1,6 +1,6 @@
1
- export * from './middlewares/index.js';
2
1
  export * from './add-compiler-to-dev-server.js';
3
- export * from './create-dev-server.js';
4
2
  export * from './create-app-page-route.js';
3
+ export * from './create-dev-server.js';
4
+ export * from './create-dev-server-compiler-task.js';
5
5
  export * from './create-dev-server-entries.js';
6
- export * from './create-dev-server-compiler-tasks.js';
6
+ export * from './middlewares/index.js';
@@ -1 +1 @@
1
- export*from"./middlewares/index.js";export*from"./add-compiler-to-dev-server.js";export*from"./create-dev-server.js";export*from"./create-app-page-route.js";export*from"./create-dev-server-entries.js";export*from"./create-dev-server-compiler-tasks.js";
1
+ export*from"./add-compiler-to-dev-server.js";export*from"./create-app-page-route.js";export*from"./create-dev-server.js";export*from"./create-dev-server-compiler-task.js";export*from"./create-dev-server-entries.js";export*from"./middlewares/index.js";
@@ -1 +1 @@
1
- export declare const getBundleAsset: (devServerHostUri: string, normalizedCurrEntry: string, extension: '.css' | '.js') => string;
1
+ export declare const getBundleAsset: (devServerHostUri: string, normalizedCurrEntry: string, extension: ".css" | ".js") => string;
@@ -1 +1 @@
1
- import{readFileSync}from"node:fs";import{join}from"node:path";import{urlJoin}from"@flatjs/common";import _ from"lodash";import{getPackageDir}from"../../helpers/get-pacakge-dir.js";import{normalizePageProxy}from"../../helpers/normalize-page-proxy.js";import{getSortedModules}from"./get-all-sorted-modules.js";export const getPageMainHtml=async(e,r,t)=>{const o=getPackageDir(),a=readFileSync(join(o,"./templates/main.html"),"utf-8"),n=getSortedModules(t,e,r),i=normalizePageProxy(t.devServer?.pageProxy||"/pages"),m=n.map((e=>{const{entryName:t,entryContent:o,isServedEntry:a,projectVirtualPath:n,normalizedEntryName:m}=e,s=urlJoin(r,[i,m],{env:"me"}),l=o.options?.servePageMainLinkFn||(e=>e);return{link:l(s,{hostUri:r,entryName:t,virtualPath:n}),name:t.replace(n,"").replace(/^\//,""),flagText:a?"serve":"static",isServed:a?1:0}}));m.push({flagText:"serve",isServed:1,link:urlJoin(r,[i,"/runtime/manifest.json"]),name:"Runtime Manifest"});const s={title:"@flatjs/evolve",modules:m.sort(((e,r)=>r.isServed-e.isServed))};return _.template(a)(s)};
1
+ import _ from"lodash";import{readFileSync}from"node:fs";import{join}from"node:path";import{urlJoin}from"@flatjs/common";import{getPackageDir}from"../../helpers/get-pacakge-dir.js";import{normalizePageProxy}from"../../helpers/normalize-page-proxy.js";import{getSortedModules}from"./get-all-sorted-modules.js";export const getPageMainHtml=async(e,r,t)=>{const o=getPackageDir(),a=readFileSync(join(o,"./templates/main.html"),"utf-8"),n=getSortedModules(t,e,r),i=normalizePageProxy(t.devServer?.pageProxy||"/pages"),m=n.map((e=>{const{entryName:t,entryContent:o,isServedEntry:a,projectVirtualPath:n,normalizedEntryName:m}=e,s=urlJoin(r,[i,m],{env:"me"}),l=o.options?.servePageMainLinkFn||(e=>e);return{link:l(s,{hostUri:r,entryName:t,virtualPath:n}),name:t.replace(n,"").replace(/^\//,""),flagText:a?"serve":"static",isServed:a?1:0}}));m.push({flagText:"serve",isServed:1,link:urlJoin(r,[i,"/runtime/manifest.json"]),name:"Runtime Manifest"});const s={title:"@flatjs/evolve",modules:m.sort(((e,r)=>r.isServed-e.isServed))};return _.template(a)(s)};
@@ -1 +1 @@
1
- import{existsSync,readFileSync}from"node:fs";import{isAbsolute,join}from"node:path";import{ensureSlash,urlJoin}from"@flatjs/common";import _ from"lodash";import{allowPx2remForModule}from"../../helpers/allow-px2rem-for-module.js";import{getHtmlPluginConfig}from"../../helpers/get-html-plugin-config.js";import{getPackageDir}from"../../helpers/get-pacakge-dir.js";import{normalizeEvolveEntryName}from"../../helpers/normalize-entry-map.js";import{normalizePageProxy}from"../../helpers/normalize-page-proxy.js";import{injectFederationScripts}from"../../helpers/script-injects.js";import{getBundleAsset}from"./get-bundle-asset.js";import{getDevServerHostUri}from"./get-dev-server-host-uri.js";import{getHmrRuntimeChunks}from"./get-hmr-runtime-chunks.js";import{getNormalizedEntryName}from"./get-normalized-entry-name.js";export const getPageModuleHtml=async(e,t,r,o,l)=>{const{entryMap:i,projectVirtualPath:a}=l,s=Object.keys(i).sort(((e,t)=>t.length-e.length)),n=getPackageDir(),m=s.find((e=>{const r=normalizeEvolveEntryName(e,a);return ensureSlash(t.path.replace(/^\//,""),!0).startsWith(ensureSlash(r,!0))}));if(!m){const e=readFileSync(join(n,"./templates/module-404.html"),"utf-8");return _.template(e)({title:"404 Not Found",errorMeta:[{name:"@flatjs/evolve workspace",value:n},{name:"served entry names",value:JSON.stringify(s)},{name:"module path",value:`${t.path}`}]})}const p=i[m],g=p.options,u=getDevServerHostUri(e,m,r),d=g?.serveModuleTemplate||"./templates/module.html",f=join(l.projectCwd,"./templates/module.html"),c=readFileSync(isAbsolute(d)?d:existsSync(f)?f:join(n,"./templates/module.html"),"utf-8"),h=l.devServer,v=h?.defaultServeGlobalData?await h.defaultServeGlobalData(p,r):{},S={mode:"development",envCdn:urlJoin(r,["public"])},y=getNormalizedEntryName(m,a,e,h),j=normalizePageProxy(h?.pageProxy||"/pages"),H={title:getHtmlPluginConfig("title",S,g?.title),favicon:getHtmlPluginConfig("favicon",S,g?.favicon),viewport:allowPx2remForModule([m,p],l)?getHtmlPluginConfig("viewport",S,g?.viewport):"",headBeforeHtmlTags:getHtmlPluginConfig("headBeforeHtmlTags",S,g?.headBeforeHtmlTags),inlineScripts:getHtmlPluginConfig("inlineScripts",S,g?.inlineScripts),headBeforeStyles:getHtmlPluginConfig("headBeforeStyles",S,g?.headBeforeStyles),headBeforeScripts:getHtmlPluginConfig("headBeforeScripts",S,g?.headBeforeScripts),bodyAfterScripts:getHtmlPluginConfig("bodyAfterScripts",S,g?.bodyAfterScripts),moduleFederationScripts:injectFederationScripts({me:[urlJoin(r,["public"])]},l.multiHtmlCdnEnvResolver),global:{hostUrl:r,apiBase:urlJoin(r,[o]),virtualPath:join(j,a),moduleName:m.replace(a,"").replace(/^\//,""),...v,...g?.serveGlobalData||{}},styles:[getBundleAsset(u,y,".css")],scripts:[getBundleAsset(u,y,".js")]};H.headBeforeHtmlTags?H.headBeforeHtmlTags=H.headBeforeHtmlTags.slice(0):H.headBeforeHtmlTags=[];return getHmrRuntimeChunks(e,m,y,p,l,u).forEach((e=>{H.headBeforeHtmlTags?.push(`<script src="${e}"><\/script>`)})),_.template(c)(H)};
1
+ import _ from"lodash";import{existsSync,readFileSync}from"node:fs";import{isAbsolute,join}from"node:path";import{ensureSlash,urlJoin}from"@flatjs/common";import{allowPx2remForModule}from"../../helpers/allow-px2rem-for-module.js";import{getHtmlPluginConfig}from"../../helpers/get-html-plugin-config.js";import{getPackageDir}from"../../helpers/get-pacakge-dir.js";import{getRuntimeCDNBase}from"../../helpers/get-runtime-cdn-base.js";import{normalizeEvolveEntryName}from"../../helpers/normalize-entry-map.js";import{normalizePageProxy}from"../../helpers/normalize-page-proxy.js";import{normalizeTemplateInjectTokens}from"../../helpers/normalize-template-inject-tokens.js";import{injectFederationScripts}from"../../helpers/script-injects.js";import{getBundleAsset}from"./get-bundle-asset.js";import{getDevServerHostUri}from"./get-dev-server-host-uri.js";import{getHmrRuntimeChunks}from"./get-hmr-runtime-chunks.js";import{getNormalizedEntryName}from"./get-normalized-entry-name.js";export const getPageModuleHtml=async(e,t,r,o,l)=>{const{entryMap:a,projectVirtualPath:i}=l,n=Object.keys(a).sort(((e,t)=>t.length-e.length)),m=getPackageDir(),s=n.find((e=>{const r=normalizeEvolveEntryName(e,i);return ensureSlash(t.path.replace(/^\//,""),!0).startsWith(ensureSlash(r,!0))}));if(!s){const e=readFileSync(join(m,"./templates/module-404.html"),"utf-8");return _.template(e)({title:"404 Not Found",errorMeta:[{name:"@flatjs/evolve workspace",value:m},{name:"served entry names",value:JSON.stringify(n)},{name:"module path",value:`${t.path}`}]})}const p=a[s],u=p.options,c=getDevServerHostUri(e,s,r),g=u?.serveModuleTemplate||"./templates/module.html",d=join(l.projectCwd,"./templates/module.html"),f=readFileSync(isAbsolute(g)?g:existsSync(d)?d:join(m,"./templates/module.html"),"utf-8"),h=l.devServer,v=h?.defaultServeGlobalData?await h.defaultServeGlobalData(p,r):{},j={mode:"development",envCdn:urlJoin(r,["public"])},y=getNormalizedEntryName(s,i,e,h),S=normalizePageProxy(h?.pageProxy||"/pages"),H=[getRuntimeCDNBase(l.multiHtmlCdn,l.multiHtmlCdnEnvResolver||function cdnResolver(){})],P=normalizeTemplateInjectTokens(j,u),C={title:getHtmlPluginConfig("title",j,u?.title),favicon:getHtmlPluginConfig("favicon",j,u?.favicon),viewport:allowPx2remForModule([s,p],l)?getHtmlPluginConfig("viewport",j,u?.viewport):"",...P,inlineScripts:P.inlineScripts?.concat(H),moduleFederationScripts:injectFederationScripts({me:[urlJoin(r,["public"])]},l.multiHtmlCdnEnvResolver),global:{hostUrl:r,apiBase:urlJoin(r,[o]),virtualPath:join(S,i),moduleName:s.replace(i,"").replace(/^\//,""),...v,...u?.serveGlobalData||{}},styles:[getBundleAsset(c,y,".css")],scripts:[getBundleAsset(c,y,".js")]};C.headBeforeHtmlTags?C.headBeforeHtmlTags=C.headBeforeHtmlTags.slice(0):C.headBeforeHtmlTags=[];return getHmrRuntimeChunks(e,s,y,p,l,c).forEach((e=>{C.headBeforeHtmlTags?.push(`<script src="${e}"><\/script>`)})),_.template(f)(C)};
@@ -0,0 +1,7 @@
1
+ import { type EntryMapItem, type EvolveEntryMap } from '../types/types-entry-map.js';
2
+ import { type FlatEvolveOptions } from '../types/types-options.js';
3
+ /**
4
+ * Only fetch group entry map once `serve`,`build` recycle.
5
+ * @returns
6
+ */
7
+ export declare const assertGroupEntryItem: (entryMap: EvolveEntryMap, evolveOptions: FlatEvolveOptions) => EntryMapItem[];
@@ -0,0 +1 @@
1
+ import{normalizeEvolveEntryName}from"./normalize-entry-map.js";export const assertGroupEntryItem=(r,e)=>{const o=[];for(const[e,t]of Object.entries(r))o.push([e,t]);if(!o.length)throw new Error('No entry map found while "serve", "build" process!');return o.map((([r,o])=>[normalizeEvolveEntryName(r,e.projectVirtualPath),o]))};
@@ -0,0 +1,15 @@
1
+ import { type Configuration } from 'webpack';
2
+ import { type EvolveEntryMap } from '../types/types-entry-map.js';
3
+ import { type FlatEvolveOptions } from '../types/types-options.js';
4
+ /**
5
+ * Asserts a single compiler configuration by generating a new entry object based on the served entries,
6
+ * webpack configuration, evolve options, and enabled HMR flag.
7
+ *
8
+ * @param servedEntries - The served entries object.
9
+ * @param webpackConfig `Omit<Configuration, 'entry'>` webpack final configuration
10
+ * @param evolveOptions - The flat evolve options object.
11
+ * @param enabledHmr - Flag indicating whether Hot Module Replacement (HMR) is enabled. Default is false.
12
+ * @returns The merged webpack configuration object with the new entry object.
13
+ * @throws Error if the react-refresh-webpack-plugin package directory is not found.
14
+ */
15
+ export declare function assertSingleCompiler(servedEntries: EvolveEntryMap, webpackConfig: Omit<Configuration, 'entry'>, evolveOptions: FlatEvolveOptions, enabledHmr?: boolean): Configuration;
@@ -0,0 +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,"/client/ReactRefreshEntry.js")]}}const n=Object.values(e)[0].groupName;return mergeOptions(r,{name:n,entry:a})}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Check if the current environment is a CI environment.
3
+ */
4
+ export declare const isCI: () => boolean;
@@ -0,0 +1 @@
1
+ import ci from"ci-info";export const isCI=()=>ci.isCI;
@@ -0,0 +1,41 @@
1
+ import { ListrTaskObject } from 'listr';
2
+ /**
3
+ * CustomListrRenderer is a class that provides a custom renderer for Listr tasks.
4
+ * It renders the tasks in a specific format and updates the output periodically.
5
+ *
6
+ * @template Ctx - The type of the context object used by the Listr tasks.
7
+ */
8
+ export declare class CustomListrRenderer<Ctx> {
9
+ private _tasks;
10
+ private _id;
11
+ /**
12
+ * Creates an instance of CustomListrRenderer.
13
+ *
14
+ * @param tasks - An array of Listr tasks to be rendered.
15
+ */
16
+ constructor(tasks: ReadonlyArray<ListrTaskObject<Ctx>>);
17
+ /**
18
+ * Indicates whether the renderer supports non-TTY environments.
19
+ */
20
+ static get nonTTY(): boolean;
21
+ /**
22
+ * Renders the Listr tasks.
23
+ * This method is called periodically to update the output.
24
+ */
25
+ render(): void;
26
+ /**
27
+ * Ends the rendering of the Listr tasks.
28
+ * This method clears the interval and updates the final output.
29
+ */
30
+ end(): void;
31
+ formatTextByTemp(title: string, status: 'successfully' | 'failed' | 'skipped' | 'building', temp?: string): string;
32
+ /**
33
+ * Renders an individual Listr task.
34
+ * This method is called by the render() and end() methods.
35
+ */
36
+ renderTask: () => void;
37
+ /**
38
+ * Prints the memory logs to the console.
39
+ */
40
+ printMemoryLogs(): void;
41
+ }
@@ -0,0 +1 @@
1
+ import logUpdate from"log-update";import process from"node:process";import{chalk}from"@flatjs/common";import{customMessageChannel}from"./custom-message-channel.js";const startFrames="win32"===process.platform?["-","\\","|","/"]:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];let startIndex=0;export class CustomListrRenderer{constructor(t){this._tasks=[],this.renderTask=()=>{const t=[];startIndex=++startIndex%startFrames.length;const e=startFrames[startIndex];for(const s of this._tasks)s.isCompleted()?t.push(`${chalk(["green"])("✔")} ${this.formatTextByTemp(s.title,"successfully")}`):s.hasFailed()?t.push(`${chalk(["red"])("✘")} ${this.formatTextByTemp(s.title,"failed")}`):s.isSkipped()?t.push(`${chalk(["gray"])("ℹ")} ${this.formatTextByTemp(s.title,"skipped")}`):t.push(`${chalk(["cyan"])(e)} ${this.formatTextByTemp(s.title,"building")}`);logUpdate(t.join("\n"))},this._tasks=t}static get nonTTY(){return!0}render(){this._id||(this._id=setInterval((()=>{this.renderTask()}),100))}end(){this._id&&(clearInterval(this._id),this._id=void 0),this.renderTask(),logUpdate.done(),this.printMemoryLogs()}formatTextByTemp(t,e,s="$STATUS"){const r={successfully:`${chalk(["green"])("done")}`,failed:`builded ${chalk(["red"])("failed")}`,skipped:`builded ${chalk(["gray"])("skipped")}`,building:chalk(["white"])("compiling...")};return t.replace(s,r[e])}printMemoryLogs(){const{stderr:t=[],stdout:e=[]}=customMessageChannel.getStdData();for(const e of t)console.error(e);for(const t of e)console.log(t);customMessageChannel.clean()}}
@@ -0,0 +1,17 @@
1
+ import { MessageChannel } from 'node:worker_threads';
2
+ declare class CustomMessageChannel {
3
+ private stdoutData;
4
+ private stderrData;
5
+ private channelList;
6
+ constructor();
7
+ createMessageChannel(): MessageChannel;
8
+ addListener(channel: MessageChannel): void;
9
+ getStdData(): {
10
+ stdout: string[];
11
+ stderr: string[];
12
+ };
13
+ dispose(): void;
14
+ clean(): void;
15
+ }
16
+ export declare const customMessageChannel: CustomMessageChannel;
17
+ export {};
@@ -0,0 +1 @@
1
+ import{MessageChannel}from"node:worker_threads";class CustomMessageChannel{constructor(){this.stdoutData=[],this.stderrData=[],this.channelList=[],this.clean()}createMessageChannel(){const s=new MessageChannel;return this.channelList.push(s),this.addListener(s),s}addListener(s){const{port2:t}=s;t.on("message",(s=>{this.stdoutData.push(...s.stdout),this.stderrData.push(...s.stderr)}))}getStdData(){return{stdout:this.stdoutData,stderr:this.stderrData}}dispose(){for(const s of this.channelList){const{port1:t,port2:e}=s;t.close(),e.close(),e.removeAllListeners("message")}this.channelList=[]}clean(){this.stdoutData=[],this.stderrData=[]}}export const customMessageChannel=new CustomMessageChannel;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Deletes specified keys from an object and returns a new object without those keys.
3
+ * If the input object is undefined, the function returns undefined.
4
+ *
5
+ * @param obj - The input object.
6
+ * @param keys - An array of keys to be deleted from the object.
7
+ * @returns A new object without the specified keys, or undefined if the input object is undefined.
8
+ *
9
+ * @template T - The type of the input object.
10
+ */
11
+ export declare const deleteObjectKeys: <T>(obj?: T, keys?: Array<keyof T>) => Partial<T> | undefined;
@@ -0,0 +1 @@
1
+ export const deleteObjectKeys=(e,t=[])=>{if(!e)return;const r={...e};return t.forEach((e=>{delete r[e]})),r};
@@ -0,0 +1,8 @@
1
+ import { type EvolveDevServerEntryMap } from '../dev-server/middlewares/types.js';
2
+ /**
3
+ * Flattens an array of `EvolveDevServerEntryMap` objects into a single `EvolveDevServerEntryMap`.
4
+ *
5
+ * @param servedDevServerEntryList - The array of `EvolveDevServerEntryMap` objects to flatten.
6
+ * @returns The flattened `EvolveDevServerEntryMap`.
7
+ */
8
+ export declare const flatEntryMap: (servedDevServerEntryList: Array<EvolveDevServerEntryMap>) => EvolveDevServerEntryMap;
@@ -0,0 +1 @@
1
+ export const flatEntryMap=t=>t.reduce(((t,e)=>Object.assign(t,e)),{});
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Formats the spinner text by adding prefixes and styling using chalk.
3
+ *
4
+ * @param strArr - An array of strings to be formatted.
5
+ * @param prefixCode - The prefix to replace default prefix code.
6
+ * @returns The formatted spinner text.
7
+ */
8
+ export declare const formatSpinnerText: (strArr?: string[], prefixCode?: string) => string;
@@ -0,0 +1 @@
1
+ import{chalk}from"@flatjs/common";export const formatSpinnerText=(n=[],t)=>{if(1===n.length)return` ${chalk(["blue"])(t||"●")} ${n[0]} \n`;return n.map(((e,r)=>{let l="├";return 0===r?l="┌":r===n.length-1&&(l="└"),` ${chalk(["blue"])(t||l)} ${e} \n`})).join("")};
@@ -11,4 +11,4 @@ export declare const currNow: () => string;
11
11
  * @param serveMode If we are run `serve` mode
12
12
  * @param enableBundleHashName If we need to generate bundle file name with `[contenthash]`
13
13
  */
14
- export declare const getBundleFileName: (type: 'css' | 'js', serveMode: boolean, enableBundleHashName?: boolean) => string;
14
+ export declare const getBundleFileName: (type: "css" | "js", serveMode: boolean, enableBundleHashName?: boolean) => string;
@@ -0,0 +1,2 @@
1
+ import type { EvolveMultiCDNConfig, EvolveMultiCDNEnvResolver } from '../types/types-multi-html.js';
2
+ export declare const getRuntimeCDNBase: (config: EvolveMultiCDNConfig, cdnResolver: EvolveMultiCDNEnvResolver, requireFn?: string) => string;
@@ -0,0 +1 @@
1
+ import{cdnFinder}from"./script-injects.js";export const getRuntimeCDNBase=(n,e,i="")=>{const t=[`\n (function () {\n var flatjsMultiCdn = {\n cdnConfig: ${JSON.stringify(n||{})},\n cdnResolver: ${e.toString()},\n cdnFinder: ${cdnFinder.toString()}\n };\n var runtimeCDNBase = flatjsMultiCdn.cdnFinder(flatjsMultiCdn.cdnConfig, flatjsMultiCdn.cdnResolver);\n window.$evolve = window.$evolve || {};\n window.$evolve.runtimeCDNBase=runtimeCDNBase;\n `];return i&&t.push(`${i} = runtimeCDNBase || ${i};`),t.push("})();"),t.join("\n")};
@@ -0,0 +1,2 @@
1
+ import { StatsCompilation } from 'webpack';
2
+ export declare const getStatsFileName: (stats: StatsCompilation) => string;
@@ -0,0 +1 @@
1
+ export const getStatsFileName=t=>t.hash+".json";
@@ -1,17 +1,31 @@
1
1
  export * from './allow-px2rem-for-module.js';
2
- export * from './assert-only-single-entry-item.js';
2
+ export * from './assert-group-entry-item.js';
3
+ export * from './assert-single-compiler.js';
4
+ export * from './check-runtime-env.js';
3
5
  export * from './chunk-entry-map.js';
6
+ export * from './custom-listr-renderer.js';
7
+ export * from './delete-object-keys.js';
4
8
  export * from './enable-bundle-hashname-for-module.js';
9
+ export * from './flat-entry-map.js';
10
+ export * from './format-spinner-text.js';
5
11
  export * from './get-bundle-file-name.js';
6
12
  export * from './get-html-plugin-config.js';
7
13
  export * from './get-pacakge-dir.js';
14
+ export * from './get-runtime-cdn-base.js';
15
+ export * from './get-stats-file-name.js';
16
+ export * from './is-deep-equal.js';
17
+ export * from './json-serializer.js';
8
18
  export * from './merge-babel-options.js';
19
+ export * from './normalize-check-entry-options.js';
9
20
  export * from './normalize-entry-map.js';
21
+ export * from './normalize-group-name.js';
22
+ export * from './normalize-page-proxy.js';
23
+ export * from './normalize-resolve-alias.js';
24
+ export * from './normalize-template-inject-tokens.js';
10
25
  export * from './open-page.js';
11
26
  export * from './print-log.js';
12
27
  export * from './refresh-evolve-mock-options.js';
13
28
  export * from './script-injects.js';
14
29
  export * from './should-enable-react-fast-refresh.js';
15
- export * from './split-to-multi-compiler.js';
16
- export * from './json-serializer.js';
17
- export * from './normalize-resolve-alias.js';
30
+ export * from './split-to-entry-group.js';
31
+ export * from './verify-group-entry-options.js';
@@ -1 +1 @@
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";export*from"./json-serializer.js";export*from"./normalize-resolve-alias.js";
1
+ export*from"./allow-px2rem-for-module.js";export*from"./assert-group-entry-item.js";export*from"./assert-single-compiler.js";export*from"./check-runtime-env.js";export*from"./chunk-entry-map.js";export*from"./custom-listr-renderer.js";export*from"./delete-object-keys.js";export*from"./enable-bundle-hashname-for-module.js";export*from"./flat-entry-map.js";export*from"./format-spinner-text.js";export*from"./get-bundle-file-name.js";export*from"./get-html-plugin-config.js";export*from"./get-pacakge-dir.js";export*from"./get-runtime-cdn-base.js";export*from"./get-stats-file-name.js";export*from"./is-deep-equal.js";export*from"./json-serializer.js";export*from"./merge-babel-options.js";export*from"./normalize-check-entry-options.js";export*from"./normalize-entry-map.js";export*from"./normalize-group-name.js";export*from"./normalize-page-proxy.js";export*from"./normalize-resolve-alias.js";export*from"./normalize-template-inject-tokens.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-entry-group.js";export*from"./verify-group-entry-options.js";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Checks if two values are deeply equal.
3
+ *
4
+ * @template T - The type of the values being compared.
5
+ * @param a - The first value to compare.
6
+ * @param b - The second value to compare.
7
+ * @returns `true` if the values are deeply equal, `false` otherwise.
8
+ */
9
+ export declare function isDeepEqual(a: any, b: any): boolean;
@@ -0,0 +1 @@
1
+ export function isDeepEqual(t,e){if(t===e)return!0;if("function"==typeof t&&"function"==typeof e)return t.toString()===e.toString();if(t&&e&&"object"==typeof t&&"object"==typeof e){const r=Array.isArray(t),n=Array.isArray(e);let i,f,o;if(r&&n){if(f=t.length,f!==e.length)return!1;for(i=f;0!=i--;)if(!isDeepEqual(t[i],e[i]))return!1;return!0}if(r!==n)return!1;const u=t instanceof Date,c=e instanceof Date;if(u!==c)return!1;if(u&&c)return t.getTime()===e.getTime();const s=t instanceof RegExp,a=e instanceof RegExp;if(s!==a)return!1;if(s&&a)return t.toString()===e.toString();const p=Object.keys(t);if(f=p.length,f!==Object.keys(e).length)return!1;for(i=f;0!=i--;)if(!Object.prototype.hasOwnProperty.call(e,p[i]))return!1;for(i=f;0!=i--;)if(o=p[i],!isDeepEqual(t[o],e[o]))return!1;return!0}return t!=t&&e!=e}