@flatjs/evolve 2.1.0-next.2 → 2.1.0-next.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) 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 +5 -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-plugins.d.ts +1 -1
  10. package/dist/create-webpack/create-plugins.js +1 -1
  11. package/dist/create-webpack/create-resolve.js +1 -1
  12. package/dist/create-webpack/create-rule-sets.d.ts +1 -1
  13. package/dist/create-webpack/create-rule-sets.js +1 -1
  14. package/dist/create-webpack/load-watch-options.d.ts +12 -0
  15. package/dist/create-webpack/load-watch-options.js +1 -0
  16. package/dist/create-webpack/load-webpack-config.js +1 -1
  17. package/dist/create-webpack/rule-sets/rule-assets.d.ts +2 -2
  18. package/dist/create-webpack/rule-sets/rule-assets.js +1 -1
  19. package/dist/create-webpack/rule-sets/rule-css.js +1 -1
  20. package/dist/create-webpack/rule-sets/rule-scripts.d.ts +2 -0
  21. package/dist/create-webpack/rule-sets/rule-scripts.js +1 -1
  22. package/dist/create-webpack/types.d.ts +1 -1
  23. package/dist/default-options.js +1 -1
  24. package/dist/define-config/define-config.d.ts +2 -2
  25. package/dist/dev-server/create-dev-server-compiler-task.d.ts +3 -0
  26. package/dist/dev-server/create-dev-server-compiler-task.js +1 -0
  27. package/dist/dev-server/create-dev-server-entries.d.ts +1 -1
  28. package/dist/dev-server/create-dev-server-entries.js +1 -1
  29. package/dist/dev-server/create-dev-server.js +1 -1
  30. package/dist/dev-server/index.d.ts +3 -3
  31. package/dist/dev-server/index.js +1 -1
  32. package/dist/dev-server/middlewares/get-page-main-html.js +1 -1
  33. package/dist/dev-server/middlewares/get-page-module-html.js +1 -1
  34. package/dist/helpers/assert-group-entry-item.d.ts +7 -0
  35. package/dist/helpers/assert-group-entry-item.js +1 -0
  36. package/dist/helpers/assert-single-compiler.d.ts +15 -0
  37. package/dist/helpers/assert-single-compiler.js +1 -0
  38. package/dist/helpers/custom-listr-renderer.d.ts +37 -0
  39. package/dist/helpers/custom-listr-renderer.js +1 -0
  40. package/dist/helpers/delete-object-keys.d.ts +11 -0
  41. package/dist/helpers/delete-object-keys.js +1 -0
  42. package/dist/helpers/flat-entry-map.d.ts +8 -0
  43. package/dist/helpers/flat-entry-map.js +1 -0
  44. package/dist/helpers/format-spinner-text.d.ts +7 -0
  45. package/dist/helpers/format-spinner-text.js +1 -0
  46. package/dist/helpers/get-runtime-cdn-base.d.ts +2 -0
  47. package/dist/helpers/get-runtime-cdn-base.js +1 -0
  48. package/dist/helpers/index.d.ts +16 -4
  49. package/dist/helpers/index.js +1 -1
  50. package/dist/helpers/is-deep-equal.d.ts +9 -0
  51. package/dist/helpers/is-deep-equal.js +1 -0
  52. package/dist/helpers/json-serializer.js +1 -1
  53. package/dist/helpers/normalize-check-entry-options.d.ts +10 -0
  54. package/dist/helpers/normalize-check-entry-options.js +1 -0
  55. package/dist/helpers/normalize-entry-map.d.ts +1 -0
  56. package/dist/helpers/normalize-entry-map.js +1 -1
  57. package/dist/helpers/normalize-group-name.d.ts +8 -0
  58. package/dist/helpers/normalize-group-name.js +1 -0
  59. package/dist/helpers/normalize-template-inject-tokens.d.ts +16 -0
  60. package/dist/helpers/normalize-template-inject-tokens.js +1 -0
  61. package/dist/helpers/open-page.js +1 -1
  62. package/dist/helpers/refresh-evolve-mock-options.js +1 -1
  63. package/dist/helpers/script-injects.d.ts +1 -1
  64. package/dist/helpers/should-enable-react-fast-refresh.js +1 -1
  65. package/dist/helpers/split-to-entry-group.d.ts +52 -0
  66. package/dist/helpers/split-to-entry-group.js +1 -0
  67. package/dist/helpers/verify-group-entry-options.d.ts +9 -0
  68. package/dist/helpers/verify-group-entry-options.js +1 -0
  69. package/dist/index.d.ts +1 -1
  70. package/dist/index.js +1 -1
  71. package/dist/load-config/load-evolve-config.js +1 -1
  72. package/dist/loaders/loader-icon.cjs +2 -1
  73. package/dist/main/create-thread-worker.d.ts +29 -14
  74. package/dist/main/create-thread-worker.js +1 -1
  75. package/dist/main/index.d.ts +1 -1
  76. package/dist/main/index.js +1 -1
  77. package/dist/main/prepare-build.d.ts +3 -3
  78. package/dist/main/prepare-build.js +1 -1
  79. package/dist/main/prepare-serve.d.ts +1 -1
  80. package/dist/main/prepare-serve.js +1 -1
  81. package/dist/main/start-build-dynamic.d.ts +2 -2
  82. package/dist/main/start-build-dynamic.js +1 -1
  83. package/dist/main/start-build-worker.d.ts +12 -6
  84. package/dist/main/start-build-worker.js +1 -1
  85. package/dist/main/start-build.d.ts +1 -1
  86. package/dist/main/start-build.js +1 -1
  87. package/dist/main/start-group-entry-build.d.ts +14 -0
  88. package/dist/main/start-group-entry-build.js +1 -0
  89. package/dist/main/start-serve.d.ts +1 -1
  90. package/dist/main/start-serve.js +1 -1
  91. package/dist/minimizer/image-minimizer.js +1 -1
  92. package/dist/minimizer/terser-minimizer.js +1 -1
  93. package/dist/plugins/circular-dependency/circular-dependency-plugin.js +1 -1
  94. package/dist/plugins/clean-webpack/index.d.ts +1 -1
  95. package/dist/plugins/clean-webpack/index.js +1 -1
  96. package/dist/plugins/define-variable/define-variable-plugin.js +1 -1
  97. package/dist/plugins/module-federation/module-federation.d.ts +1 -1
  98. package/dist/plugins/module-federation/module-federation.js +1 -1
  99. package/dist/plugins/multi-html/index.d.ts +1 -1
  100. package/dist/plugins/multi-html/index.js +1 -1
  101. package/dist/plugins/multi-html/multi-html-cdn-plugin.js +1 -1
  102. package/dist/plugins/multi-html/multi-html-plugin.d.ts +1 -1
  103. package/dist/plugins/multi-html/multi-html-plugin.js +1 -1
  104. package/dist/plugins/ts-checker/ts-checker-guard-plugin.d.ts +13 -0
  105. package/dist/plugins/ts-checker/ts-checker-guard-plugin.js +1 -0
  106. package/dist/plugins/ts-checker/ts-checker-plugin.d.ts +3 -0
  107. package/dist/plugins/ts-checker/ts-checker-plugin.js +1 -0
  108. package/dist/types/index.d.ts +2 -1
  109. package/dist/types/index.js +1 -1
  110. package/dist/types/types-dev-server.d.ts +5 -6
  111. package/dist/types/types-entry-map.d.ts +16 -2
  112. package/dist/types/types-global-compiler-options.d.ts +7 -0
  113. package/dist/types/types-global-compiler-options.js +1 -0
  114. package/dist/types/types-loader-options.d.ts +31 -9
  115. package/dist/types/types-options.d.ts +30 -11
  116. package/dist/types/types-threads-options.d.ts +25 -0
  117. package/dist/types/types-threads-options.js +1 -0
  118. package/dist/types/types-webpack.d.ts +1 -1
  119. package/package.json +65 -61
  120. package/templates/html-plugin/index-dev.html +2 -2
  121. package/templates/html-plugin/index-inte.html +2 -2
  122. package/templates/html-plugin/index-inte2.html +2 -2
  123. package/templates/html-plugin/index-inte3.html +2 -2
  124. package/templates/html-plugin/index-inte4.html +2 -2
  125. package/templates/html-plugin/index-me.html +2 -2
  126. package/templates/html-plugin/index-prod.html +2 -2
  127. package/templates/html-plugin/index-rc.html +2 -2
  128. package/templates/html-plugin/index-uat.html +2 -2
  129. package/templates/module.html +2 -2
  130. package/dist/dev-server/create-dev-server-compiler-tasks.d.ts +0 -3
  131. package/dist/dev-server/create-dev-server-compiler-tasks.js +0 -1
  132. package/dist/helpers/assert-only-single-entry-item.d.ts +0 -7
  133. package/dist/helpers/assert-only-single-entry-item.js +0 -1
  134. package/dist/helpers/split-to-multi-compiler.d.ts +0 -8
  135. package/dist/helpers/split-to-multi-compiler.js +0 -1
  136. package/dist/main/start-one-entry-build.d.ts +0 -13
  137. package/dist/main/start-one-entry-build.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=(e,r)=>{const{projectCwd:t,webpack:o,devServer:a}=r,c=e?"development":"production",l=a?.watchOptions||{},s=[ruleBabel({})],p=[...createTsCheckerPlugins(e,r)],m={context:t,mode:c,watch:e,name:"flat/evolve/global-compiler",entry:{".global-compiler-bundle":["."]},resolve:createResolve(t,o),module:{rules:s},plugins:p,watchOptions:l,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,7 @@ 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>;
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"];
@@ -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 EntryMapItem } from '../types/types-entry-map.js';
2
2
  import { type FlatEvolveOptions } from '../types/types-options.js';
3
3
  import { type FlatEvolveWebpackOptions } from '../types/types-webpack.js';
4
- export declare const createPlugins: (serveMode: boolean, entryMapItem: EntryMapItem, evolveOptions: FlatEvolveOptions) => Promise<FlatEvolveWebpackOptions['plugins']>;
4
+ export declare const createPlugins: (serveMode: boolean, entryMapItemList: EntryMapItem[], evolveOptions: FlatEvolveOptions) => 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 ForkTsCheckerWebpackPlugin from"fork-ts-checker-webpack-plugin";import MiniCssExtractPlugin from"mini-css-extract-plugin";import webpack from"webpack";import{BundleAnalyzerPlugin}from"webpack-bundle-analyzer";import{enableBundleHashNameForModule}from"../helpers/enable-bundle-hashname-for-module.js";import{getBundleFileName}from"../helpers/get-bundle-file-name.js";import{shouldEnableReactFastRefresh}from"../helpers/should-enable-react-fast-refresh.js";import{createCircularDependencyPlugin}from"../plugins/circular-dependency/index.js";import{createCleanWebpackPlugin}from"../plugins/clean-webpack/index.js";import{createBuiltinDefineVariables}from"../plugins/define-variable/index.js";import{createModuleFederationPlugin}from"../plugins/module-federation/index.js";import{createHtmlPlugins}from"../plugins/multi-html/index.js";export const createPlugins=async(e,n,a)=>{const[r,i]=n,l=enableBundleHashNameForModule(a,i?.options),t=[new webpack.WatchIgnorePlugin({paths:[/\.d\.[cm]ts$/]}),new CaseSensitivePathsPlugin,...createCircularDependencyPlugin(e,a),new MiniCssExtractPlugin({filename:`[name]/${getBundleFileName("css",e,l)}`,chunkFilename:"[id].[contenthash].css"}),...await createBuiltinDefineVariables(e,a),...createCleanWebpackPlugin(e,n,a),...createModuleFederationPlugin(e,n,a),...createHtmlPlugins(e,n,a)],{analyzer:s,loaderOptions:o}=a,c=(n[1].entry||[]).find((e=>/.vue$/.test(e)));o.runTsChecker&&!c&&t.push(new ForkTsCheckerWebpackPlugin({async:e,typescript:{context:a.projectCwd,memoryLimit:8192}})),s&&t.push(new BundleAnalyzerPlugin({analyzerPort:"auto",analyzerMode:"server",...s}));const u=shouldEnableReactFastRefresh(e,n,a);u&&t.push(new ReactRefreshWebpackPlugin({overlay:!1})),!u&&e&&(a.devServer?.liveReload?logger.warn('The HMR disabled cause of "liveReload" specificed'):logger.warn(`The HMR disabled cause of \`"moduleFederation":"${r}"\``));const p=a.webpack?.plugins||[];return t.concat(p)};
1
+ 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{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";export const createPlugins=async(e,a,n)=>{const l=a[0],[r,i]=l,t=enableBundleHashNameForModule(n,i?.options),s=[new webpack.WatchIgnorePlugin({paths:[/\.d\.[cm]ts$/]}),new CaseSensitivePathsPlugin,...createCircularDependencyPlugin(e,n),new MiniCssExtractPlugin({filename:`[name]/${getBundleFileName("css",e,t)}`,chunkFilename:"[id].[contenthash].css"}),...await createBuiltinDefineVariables(e,n),...createCleanWebpackPlugin(e,a,n),...createModuleFederationPlugin(e,a,n),...createHtmlPlugins(e,a,n)];n.analyzer&&s.push(new BundleAnalyzerPlugin({analyzerPort:"auto",analyzerMode:"server",...n.analyzer}));const o=shouldEnableReactFastRefresh(e,l,n);o&&s.push(new ReactRefreshWebpackPlugin({overlay:!1})),!o&&e&&(n.devServer?.liveReload?logger.warn('The HMR disabled cause of "liveReload" specificed'):logger.warn(`The HMR disabled cause of \`"moduleFederation":"${r}"\``));const c=n.webpack?.plugins||[];return s.concat(c)};
@@ -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 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,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 { type 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 entryMap - The map of entry names to their corresponding paths.
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: (entryMap: EvolveEntryMap, evolveOptions: FlatEvolveOptions, originalOptions?: FlatEvolveDevServerOptions['watchOptions']) => FlatEvolveDevServerOptions['watchOptions'];
@@ -0,0 +1 @@
1
+ export const loadWatchOptions=(o,t,n={})=>{const{ignored:e=[]}=n,{entryMap:r}=t;for(const[t]of Object.entries(r))o[t]||e.push(`**/${t}/**/*`);return{...n,ignored:e}};
@@ -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)=>{const a="development"===e,{projectCwd:o,webpack:s,devServer:c}=r,p=loadWatchOptions(t,r,c?.watchOptions),n=assertGroupEntryItem(t,r),i=createRuleSets(a,n,r),m=await createPlugins(a,n,r),l=n[0];return{mode:e,plugins:m,watchOptions:p,output:await createOutput(a,r,l),context:o,target:s?.target??["web","es5"],resolve:createResolve(o,s),module:{rules:i},devtool:a?"eval-source-map":s?.sourceMap||!1,externalsType:s?.externalsType,externals:createExternals(s?.externals,l),performance:createPerformance(a,s?.performance),optimization:createOptimization(a,r,l),infrastructureLogging:s?.infrastructureLogging??{level:"warn"},stats:s?.stats??{preset:"minimal"},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)$/,use:[{loader:requireResolve(import.meta.url,"babel-loader"),options:e}]});export const ruleScripts=(e,r,s)=>{const{babelOptions:o={},modularImports:t=[]}=s.loaderOptions,l=mergeBabelOption(t,o);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
  /**
@@ -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: (projectCwd: string, mainPage: string, 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,a,n)=>{const[i,s]=Object.entries(t)[0],{devServerPort:l,devServerHostUri:p}=s;for(const[,e]of Object.entries(t)){const r=e.entryConfig,o=r.options?.moduleFederation,t=o?.remotes||[],n=flatEntryMap(a);t.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 c=Object.keys(t).reduce(((e,r)=>(e[r]=t[r].entryConfig,e)),{}),m=urlJoin(p,["public"]),f=await loadWebpackConfig("development",c,mergeOptions(n,{webpack:{publicPath:m}})),d=shouldEnableReactFastRefresh(!0,[i,s.entryConfig],n),v=assertSingleCompiler(c,f,n,d),g=webpack(v),h=addCompilerToDevServer(g,d,l,o,n),b=g.name||"";return g.hooks.invalid.tap("fileChange",(r=>{const o=relative(e,r||"");logger.info(`file change ➩ ${chalk(["cyan"])(o)}`,b)})),g.hooks.done.tap("compileDone",(()=>{logger.info(`debug page ➩ ${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
- 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"),i=getSortedModules(t,e,r),n=normalizePageProxy(t.devServer?.pageProxy||"/pages"),m={title:"@flatjs/evolve",modules:i.map((e=>{const{entryName:t,entryContent:o,isServedEntry:a,projectVirtualPath:i,normalizedEntryName:m}=e,l=urlJoin(r,[n,m],{env:"me"}),s=o.options?.servePageMainLinkFn||(e=>e);return{link:s(l,{hostUri:r,entryName:t,virtualPath:i}),name:t.replace(i,"").replace(/^\//,""),flagText:a?"serve":"static",isServed:a?1:0}})).sort(((e,r)=>r.isServed-e.isServed))};return _.template(a)(m)};
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,37 @@
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
+ }
@@ -0,0 +1 @@
1
+ import logUpdate from"log-update";import process from"node:process";import{chalk}from"@flatjs/common";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()}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])}}
@@ -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,7 @@
1
+ /**
2
+ * Formats the spinner text by adding prefixes and styling using chalk.
3
+ *
4
+ * @param strArr - An array of strings to format.
5
+ * @returns The formatted spinner text.
6
+ */
7
+ export declare const formatSpinnerText: (strArr?: string[]) => string;
@@ -0,0 +1 @@
1
+ import{chalk}from"@flatjs/common";export const formatSpinnerText=(n=[])=>{if(1===n.length)return` ${chalk(["blue"])("●")} ${n[0]} \n`;return n.map(((t,e)=>{let r="├";return 0===e?r="┌":e===n.length-1&&(r="└"),` ${chalk(["blue"])(r)} ${t} \n`})).join("")};
@@ -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")};
@@ -1,17 +1,29 @@
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';
3
4
  export * from './chunk-entry-map.js';
5
+ export * from './custom-listr-renderer.js';
6
+ export * from './delete-object-keys.js';
4
7
  export * from './enable-bundle-hashname-for-module.js';
8
+ export * from './flat-entry-map.js';
9
+ export * from './format-spinner-text.js';
5
10
  export * from './get-bundle-file-name.js';
6
11
  export * from './get-html-plugin-config.js';
7
12
  export * from './get-pacakge-dir.js';
13
+ export * from './get-runtime-cdn-base.js';
14
+ export * from './is-deep-equal.js';
15
+ export * from './json-serializer.js';
8
16
  export * from './merge-babel-options.js';
17
+ export * from './normalize-check-entry-options.js';
9
18
  export * from './normalize-entry-map.js';
19
+ export * from './normalize-group-name.js';
20
+ export * from './normalize-page-proxy.js';
21
+ export * from './normalize-resolve-alias.js';
22
+ export * from './normalize-template-inject-tokens.js';
10
23
  export * from './open-page.js';
11
24
  export * from './print-log.js';
12
25
  export * from './refresh-evolve-mock-options.js';
13
26
  export * from './script-injects.js';
14
27
  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';
28
+ export * from './split-to-entry-group.js';
29
+ 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"./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"./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}
@@ -1 +1 @@
1
- function stringifyWithFns(n){return JSON.stringify(n,(function(n,t){if("function"==typeof t)try{return makeFunctionFromString(t),t.toString()}catch(n){return`function ${t.toString()}`}return t}))}function looksLikeAFunctionString(n){return!![/^function[^(]*\(([^()]*)\)\s*\{[\s\S]*\}$/m,/^(\s*async\s*)?(\w*\s*)\(([^)]*)\)\s*=>\s*(.*)$/m,/^\s*\w+\s*=>/m].find((t=>t.test(n)))}function makeFunctionFromString(funcString){return eval("("+funcString+")")}function parseWithFns(n){try{return JSON.parse(n,(function(n,t){return looksLikeAFunctionString(t)?makeFunctionFromString(t):t}))}catch(n){return{}}}export const jsonSerializer={stringify:stringifyWithFns,parse:parseWithFns};
1
+ import vm from"node:vm";function stringifyWithFns(n){return JSON.stringify(n,(function(n,t){if("function"==typeof t)try{return makeFunctionFromString(t),t.toString()}catch{return`function ${t.toString()}`}return t}))}function looksLikeAFunctionString(n){return!![/^function[^(]*\(([^()]*)\)\s*\{[\s\S]*\}$/m,/^(\s*async\s*)?(\w*\s*)\(([^)]*)\)\s*=>\s*(.*)$/m,/^\s*\w+\s*=>/m].find((t=>t.test(n)))}function makeFunctionFromString(n){return vm.runInNewContext("("+n+")")}function parseWithFns(n){try{return JSON.parse(n,(function(n,t){return looksLikeAFunctionString(t)?makeFunctionFromString(t):t}))}catch{return{}}}export const jsonSerializer={stringify:stringifyWithFns,parse:parseWithFns};
@@ -0,0 +1,10 @@
1
+ import { type EvolveEntryItemOption } from '../types/types-entry-map.js';
2
+ /**
3
+ * Normalizes the check entry options.
4
+ *
5
+ * @param serveMode - A boolean indicating whether the serve mode is enabled.
6
+ * @param currEntryOption - The current entry option.
7
+ * @param ignoreOptionKeys - An array of keys to ignore in the entry option.
8
+ * @returns The normalized entry options.
9
+ */
10
+ export declare const normalizeCheckEntryOptions: (serveMode: boolean, currEntryOption?: EvolveEntryItemOption, ignoreOptionKeys?: Array<keyof EvolveEntryItemOption>) => Partial<EvolveEntryItemOption> | undefined;
@@ -0,0 +1 @@
1
+ import{urlJoin}from"@flatjs/common";import{ignoreEntryOptionKeys}from"../constants.js";import{deleteObjectKeys}from"./delete-object-keys.js";import{normalizeTemplateInjectTokens}from"./normalize-template-inject-tokens.js";export const normalizeCheckEntryOptions=(e,t,o=ignoreEntryOptionKeys)=>{const n={mode:e?"development":"production",envCdn:urlJoin(e?"http://dev.flatjs.com":"https://file.40017.cn/jinfu",["public"])},r=normalizeTemplateInjectTokens(n,t),i={...t,...r};return deleteObjectKeys(i,o)};
@@ -11,5 +11,6 @@ export declare const normalizeEvolveEntryName: (entryName: string, projectVirtua
11
11
  * Merge default entry item configuration values.
12
12
  * @param activedEntryMap actived entries
13
13
  * @param definedEntryMap defined entries in flatjs.evolve.js
14
+ * @param projectVirtualPath virtual path for current `project`
14
15
  */
15
16
  export declare const normalizeEvolveEntryMap: (activedEntryMap?: EvolveEntryMap, definedEntryMap?: EvolveEntryMap) => EvolveEntryMap;
@@ -1 +1 @@
1
- import{join}from"node:path";import _ from"lodash";export const normalizeEvolveEntryName=(o,e)=>{const r=o.replace(/^\//,""),t=e.replace(/^\//,"");return(r.startsWith(t)?r:join(t,r)).replace(/\/$/,"")};export const normalizeEvolveEntryMap=(o={},e={})=>{const r={};for(const[t,n]of Object.entries(e)){const e={options:{}};o[t]&&(r[t]=_.merge({},e,n,o[t])),_.merge(n,e)}return r};
1
+ import _ from"lodash";import{join}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(/^\//,""),n=r.replace(/^\//,"");return(e.startsWith(n)?e:join(n,e)).replace(/\/$/,"")};export const normalizeEvolveEntryMap=(o={},r={})=>{const e={};for(const[n,t]of Object.entries(r)){const r={options:{}};if(o[n]){const p=normalizeEntryGroupOptions(t);e[n]=_.merge({},r,t,o[n],p)}}return e};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Normalizes the group name based on the project virtual path and index.
3
+ *
4
+ * @param projectVirtualPath - The virtual path of the project.
5
+ * @param index - The index used to generate the group name.
6
+ * @returns The normalized group name.
7
+ */
8
+ export declare const normalizeGroupName: (projectVirtualPath: string, index: number) => string;
@@ -0,0 +1 @@
1
+ import{normalizeEvolveEntryName}from"./normalize-entry-map.js";export const normalizeGroupName=(r,o)=>{const e=Array.from({length:26},((r,o)=>String.fromCharCode(65+o))),m=[...Array.from({length:26},((r,o)=>String.fromCharCode(97+o))),...e],n=Math.floor(o/52);return normalizeEvolveEntryName(`${m[o%52]}${n||""}`,r)};
@@ -0,0 +1,16 @@
1
+ import { type EvolveEntryItemOption } from '../types/types-entry-map.js';
2
+ import { type HtmlPluginConfigConfigData } from './get-html-plugin-config.js';
3
+ /**
4
+ * Normalizes the template inject tokens based on the provided configuration data and entry options.
5
+ *
6
+ * @param configData - The configuration data for the HTML plugin.
7
+ * @param currEntryOption - The current entry option for the evolve item.
8
+ * @returns An object containing the normalized template inject tokens.
9
+ */
10
+ export declare const normalizeTemplateInjectTokens: (configData: HtmlPluginConfigConfigData, currEntryOption?: EvolveEntryItemOption) => {
11
+ headBeforeHtmlTags?: string[];
12
+ inlineScripts?: string[];
13
+ headBeforeStyles?: string[];
14
+ headBeforeScripts: string[];
15
+ bodyAfterScripts: string[];
16
+ };
@@ -0,0 +1 @@
1
+ import{getHtmlPluginConfig}from"./get-html-plugin-config.js";export const normalizeTemplateInjectTokens=(e,t)=>({headBeforeHtmlTags:getHtmlPluginConfig("headBeforeHtmlTags",e,t?.headBeforeHtmlTags),inlineScripts:getHtmlPluginConfig("inlineScripts",e,t?.inlineScripts),headBeforeStyles:getHtmlPluginConfig("headBeforeStyles",e,t?.headBeforeStyles),headBeforeScripts:getHtmlPluginConfig("headBeforeScripts",e,t?.headBeforeScripts),bodyAfterScripts:getHtmlPluginConfig("bodyAfterScripts",e,t?.bodyAfterScripts)});
@@ -1 +1 @@
1
- import opn from"better-opn";export const openPage=n=>{try{opn(n)}catch(n){console.warn("Unable to open browser. If you are running in a headless environment\n")}};
1
+ import opn from"better-opn";export const openPage=n=>{try{opn(n)}catch{console.warn("Unable to open browser. If you are running in a headless environment\n")}};
@@ -1 +1 @@
1
- import{requireResolve}from"@flatjs/common";import{loadMockConfig,getMockCwd}from"@flatjs/mock";import _ from"lodash";export const refreshEvolveMockOptions=async(o,t,e)=>{const s=t.devServer,r=e?.esmLoaderOptions,i=r?.externals||[],n={projectCwd:o,resolve:requireResolve},c=await loadMockConfig(n,o,s?.mockOptions||{},_.merge({},e,{configFile:"flatjs-mock",esmLoaderOptions:{externals:[...i,"@flatjs/mock"]}}));if(s){s.mockOptions=c||{},s.mockOptions&&!s.mockOptions.https&&(s.mockOptions.https=s?.https);const o=getMockCwd(c);Array.isArray(s?.watchOptions?.ignored)&&s?.watchOptions?.ignored.push(o)}return t};
1
+ import _ from"lodash";import{requireResolve}from"@flatjs/common";import{getMockCwd,loadMockConfig}from"@flatjs/mock";export const refreshEvolveMockOptions=async(o,t,e)=>{const s=t.devServer,r=e?.esmLoaderOptions,i=r?.externals||[],n={projectCwd:o,resolve:requireResolve},c=await loadMockConfig(n,o,s?.mockOptions||{},_.merge({},e,{configFile:"flatjs-mock",esmLoaderOptions:{externals:[...i,"@flatjs/mock"]}}));if(s){s.mockOptions=c||{},s.mockOptions&&!s.mockOptions.https&&(s.mockOptions.https=s?.https);const o=getMockCwd(c);Array.isArray(s?.watchOptions?.ignored)&&s?.watchOptions?.ignored.push(o)}return t};
@@ -1,4 +1,4 @@
1
- import { type EvolveMultiCdnEnvType, type EvolveMultiCDNConfig, type EvolveMultiCDNEnvResolver } from '../types/types-multi-html.js';
1
+ import { type EvolveMultiCDNConfig, type EvolveMultiCDNEnvResolver, type EvolveMultiCdnEnvType } from '../types/types-multi-html.js';
2
2
  export declare function httpUrlJoin(first?: string, second?: string): string;
3
3
  /**
4
4
  * To extract the best matched CDN configuration url address, either use URL `query.env` or customize the `envRresolver`
@@ -1 +1 @@
1
- export const shouldEnableReactFastRefresh=(e,o,t)=>{const r=o[1],s=!!r.options?.moduleFederation;return e&&"react"===t.loaderOptions.babelOptions?.usePreset&&!s&&!0!==t.devServer?.liveReload};
1
+ export const shouldEnableReactFastRefresh=(e,o,t)=>{const r=o[1],s=!!r.options?.moduleFederation,a=!!r.options?.output?.library;return e&&"react"===t.loaderOptions.babelOptions?.usePreset&&!s&&!a&&!0!==t.devServer?.liveReload};