@flatjs/evolve 2.1.0-next.31 → 2.1.0-next.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. package/dist/constants.d.ts +0 -9
  2. package/dist/constants.js +1 -1
  3. package/dist/create-webpack/create-externals.d.ts +1 -1
  4. package/dist/create-webpack/create-externals.js +1 -1
  5. package/dist/create-webpack/create-optimization.d.ts +1 -1
  6. package/dist/create-webpack/create-optimization.js +1 -1
  7. package/dist/create-webpack/create-output.d.ts +1 -1
  8. package/dist/create-webpack/create-performance.d.ts +1 -1
  9. package/dist/create-webpack/create-plugins.d.ts +1 -2
  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-webpack-config.d.ts +1 -2
  15. package/dist/create-webpack/load-webpack-config.js +1 -1
  16. package/dist/create-webpack/rule-sets/rule-assets.d.ts +2 -2
  17. package/dist/create-webpack/rule-sets/rule-assets.js +1 -1
  18. package/dist/create-webpack/rule-sets/rule-css.js +1 -1
  19. package/dist/create-webpack/rule-sets/rule-scripts.d.ts +0 -2
  20. package/dist/create-webpack/rule-sets/rule-scripts.js +1 -1
  21. package/dist/create-webpack/types.d.ts +1 -1
  22. package/dist/default-options.js +1 -1
  23. package/dist/define-config/define-config.d.ts +2 -2
  24. package/dist/dev-server/add-compiler-to-dev-server.js +1 -1
  25. package/dist/dev-server/create-dev-server-compiler-tasks.d.ts +3 -0
  26. package/dist/dev-server/create-dev-server-compiler-tasks.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-bundle-asset.d.ts +1 -1
  33. package/dist/dev-server/middlewares/get-page-main-html.js +1 -1
  34. package/dist/dev-server/middlewares/get-page-module-html.js +1 -1
  35. package/dist/helpers/assert-only-single-entry-item.d.ts +7 -0
  36. package/dist/helpers/assert-only-single-entry-item.js +1 -0
  37. package/dist/helpers/get-bundle-file-name.d.ts +1 -1
  38. package/dist/helpers/index.d.ts +4 -18
  39. package/dist/helpers/index.js +1 -1
  40. package/dist/helpers/json-serializer.js +1 -1
  41. package/dist/helpers/merge-babel-options.d.ts +1 -1
  42. package/dist/helpers/merge-babel-options.js +1 -1
  43. package/dist/helpers/normalize-entry-map.d.ts +0 -1
  44. package/dist/helpers/normalize-entry-map.js +1 -1
  45. package/dist/helpers/open-page.js +1 -1
  46. package/dist/helpers/refresh-evolve-mock-options.js +1 -1
  47. package/dist/helpers/script-injects.d.ts +1 -1
  48. package/dist/helpers/should-enable-react-fast-refresh.js +1 -1
  49. package/dist/helpers/split-to-multi-compiler.d.ts +8 -0
  50. package/dist/helpers/split-to-multi-compiler.js +1 -0
  51. package/dist/index.d.ts +1 -1
  52. package/dist/index.js +1 -1
  53. package/dist/load-config/load-evolve-config.js +1 -1
  54. package/dist/loaders/loader-icon.cjs +1 -2
  55. package/dist/main/create-thread-worker.d.ts +14 -29
  56. package/dist/main/create-thread-worker.js +1 -1
  57. package/dist/main/index.d.ts +1 -1
  58. package/dist/main/index.js +1 -1
  59. package/dist/main/prepare-build.d.ts +3 -4
  60. package/dist/main/prepare-build.js +1 -1
  61. package/dist/main/prepare-serve.d.ts +1 -1
  62. package/dist/main/prepare-serve.js +1 -1
  63. package/dist/main/start-build-dynamic.d.ts +2 -2
  64. package/dist/main/start-build-dynamic.js +1 -1
  65. package/dist/main/start-build-worker.d.ts +6 -17
  66. package/dist/main/start-build-worker.js +1 -1
  67. package/dist/main/start-build.d.ts +2 -3
  68. package/dist/main/start-build.js +1 -1
  69. package/dist/main/start-one-entry-build.d.ts +13 -0
  70. package/dist/main/start-one-entry-build.js +1 -0
  71. package/dist/main/start-serve.d.ts +1 -1
  72. package/dist/main/start-serve.js +1 -1
  73. package/dist/minimizer/create-minimizers.js +1 -1
  74. package/dist/minimizer/image-minimizer.js +1 -1
  75. package/dist/minimizer/terser-minimizer.js +1 -1
  76. package/dist/plugins/circular-dependency/circular-dependency-plugin.js +1 -1
  77. package/dist/plugins/clean-webpack/index.d.ts +1 -1
  78. package/dist/plugins/clean-webpack/index.js +1 -1
  79. package/dist/plugins/define-variable/define-variable-plugin.js +1 -1
  80. package/dist/plugins/module-federation/module-federation.d.ts +1 -1
  81. package/dist/plugins/module-federation/module-federation.js +1 -1
  82. package/dist/plugins/multi-html/index.d.ts +1 -1
  83. package/dist/plugins/multi-html/index.js +1 -1
  84. package/dist/plugins/multi-html/multi-html-cdn-plugin.js +1 -1
  85. package/dist/plugins/multi-html/multi-html-plugin.d.ts +1 -1
  86. package/dist/plugins/multi-html/multi-html-plugin.js +1 -1
  87. package/dist/types/index.d.ts +1 -3
  88. package/dist/types/index.js +1 -1
  89. package/dist/types/types-dev-server.d.ts +6 -17
  90. package/dist/types/types-entry-map.d.ts +3 -21
  91. package/dist/types/types-loader-options.d.ts +9 -31
  92. package/dist/types/types-options.d.ts +15 -30
  93. package/dist/types/types-webpack.d.ts +2 -5
  94. package/package.json +61 -69
  95. package/templates/html-plugin/index-dev.html +2 -2
  96. package/templates/html-plugin/index-inte.html +2 -2
  97. package/templates/html-plugin/index-inte2.html +2 -2
  98. package/templates/html-plugin/index-inte3.html +2 -2
  99. package/templates/html-plugin/index-inte4.html +2 -2
  100. package/templates/html-plugin/index-me.html +2 -2
  101. package/templates/html-plugin/index-prod.html +2 -2
  102. package/templates/html-plugin/index-rc.html +2 -2
  103. package/templates/html-plugin/index-uat.html +2 -2
  104. package/templates/module.html +2 -2
  105. package/dist/compiler/create-global-compiler.d.ts +0 -2
  106. package/dist/compiler/create-global-compiler.js +0 -1
  107. package/dist/create-webpack/load-watch-options.d.ts +0 -12
  108. package/dist/create-webpack/load-watch-options.js +0 -1
  109. package/dist/dev-server/create-dev-server-compiler-task.d.ts +0 -3
  110. package/dist/dev-server/create-dev-server-compiler-task.js +0 -1
  111. package/dist/helpers/assert-group-entry-item.d.ts +0 -7
  112. package/dist/helpers/assert-group-entry-item.js +0 -1
  113. package/dist/helpers/assert-single-compiler.d.ts +0 -15
  114. package/dist/helpers/assert-single-compiler.js +0 -1
  115. package/dist/helpers/check-runtime-env.d.ts +0 -4
  116. package/dist/helpers/check-runtime-env.js +0 -1
  117. package/dist/helpers/custom-listr-renderer.d.ts +0 -41
  118. package/dist/helpers/custom-listr-renderer.js +0 -1
  119. package/dist/helpers/custom-message-channel.d.ts +0 -17
  120. package/dist/helpers/custom-message-channel.js +0 -1
  121. package/dist/helpers/delete-object-keys.d.ts +0 -11
  122. package/dist/helpers/delete-object-keys.js +0 -1
  123. package/dist/helpers/flat-entry-map.d.ts +0 -8
  124. package/dist/helpers/flat-entry-map.js +0 -1
  125. package/dist/helpers/format-spinner-text.d.ts +0 -8
  126. package/dist/helpers/format-spinner-text.js +0 -1
  127. package/dist/helpers/get-runtime-cdn-base.d.ts +0 -2
  128. package/dist/helpers/get-runtime-cdn-base.js +0 -1
  129. package/dist/helpers/get-stats-file-name.d.ts +0 -2
  130. package/dist/helpers/get-stats-file-name.js +0 -1
  131. package/dist/helpers/is-deep-equal.d.ts +0 -9
  132. package/dist/helpers/is-deep-equal.js +0 -1
  133. package/dist/helpers/normalize-check-entry-options.d.ts +0 -10
  134. package/dist/helpers/normalize-check-entry-options.js +0 -1
  135. package/dist/helpers/normalize-entry-module-absolute-path.d.ts +0 -10
  136. package/dist/helpers/normalize-entry-module-absolute-path.js +0 -1
  137. package/dist/helpers/normalize-group-name.d.ts +0 -8
  138. package/dist/helpers/normalize-group-name.js +0 -1
  139. package/dist/helpers/normalize-template-inject-tokens.d.ts +0 -16
  140. package/dist/helpers/normalize-template-inject-tokens.js +0 -1
  141. package/dist/helpers/split-to-entry-group.d.ts +0 -52
  142. package/dist/helpers/split-to-entry-group.js +0 -1
  143. package/dist/helpers/verify-group-entry-options.d.ts +0 -9
  144. package/dist/helpers/verify-group-entry-options.js +0 -1
  145. package/dist/main/prepare-analyzer.d.ts +0 -9
  146. package/dist/main/prepare-analyzer.js +0 -1
  147. package/dist/main/start-analyzer.d.ts +0 -10
  148. package/dist/main/start-analyzer.js +0 -1
  149. package/dist/main/start-group-entry-build.d.ts +0 -15
  150. package/dist/main/start-group-entry-build.js +0 -1
  151. package/dist/plugins/stats-webpack/helper-write-stats.d.ts +0 -28
  152. package/dist/plugins/stats-webpack/helper-write-stats.js +0 -1
  153. package/dist/plugins/stats-webpack/index.d.ts +0 -12
  154. package/dist/plugins/stats-webpack/index.js +0 -1
  155. package/dist/plugins/stats-webpack/stats-webpack-plugin.d.ts +0 -25
  156. package/dist/plugins/stats-webpack/stats-webpack-plugin.js +0 -1
  157. package/dist/plugins/ts-checker/ts-checker-guard-plugin.d.ts +0 -13
  158. package/dist/plugins/ts-checker/ts-checker-guard-plugin.js +0 -1
  159. package/dist/plugins/ts-checker/ts-checker-plugin.d.ts +0 -3
  160. package/dist/plugins/ts-checker/ts-checker-plugin.js +0 -1
  161. package/dist/types/types-analyzer.d.ts +0 -70
  162. package/dist/types/types-analyzer.js +0 -1
  163. package/dist/types/types-cli-options.d.ts +0 -12
  164. package/dist/types/types-cli-options.js +0 -1
  165. package/dist/types/types-global-compiler-options.d.ts +0 -7
  166. package/dist/types/types-global-compiler-options.js +0 -1
  167. package/dist/types/types-threads-options.d.ts +0 -18
  168. package/dist/types/types-threads-options.js +0 -1
  169. package/templates/html-plugin/index-ntv.html +0 -61
@@ -1 +1 @@
1
- import{ensureSlash,mergeOptions}from"@flatjs/common";import{ignoreEntryOptionKeys}from"../constants.js";import{EvolveBuildError}from"../errors/evolve-build-error.js";import{printCompilerError}from"../helpers/print-log.js";import{verifyGroupEntryOptions}from"../helpers/verify-group-entry-options.js";import{startGroupEntryBuild}from"./start-group-entry-build.js";export const prepareBuild=async(r,o,t)=>{const e=Object.values(r)[0];if(!verifyGroupEntryOptions(r,ignoreEntryOptionKeys,!0))throw new Error("The entry options in a group must be the same.");const n=o.multiHtmlCdn?.prod||[];if(!n.length)throw new Error(`No CDN config for env:"prod", groupName: ${e.groupName}`);const i=ensureSlash(n[Math.floor(Math.random()*n.length)],!0);try{const n=e.options?.useRelativeAssetPath,s=mergeOptions(o,{webpack:{publicPath:n?"auto":i}});return await startGroupEntryBuild(r,s,t)}catch(r){const o=printCompilerError(r);throw new EvolveBuildError("BUILD_ERROR",o)}};
1
+ import{ensureSlash,mergeOptions}from"@flatjs/common";import{EvolveBuildError}from"../errors/evolve-build-error.js";import{printCompilerError}from"../helpers/print-log.js";import{startOneEntryBuild}from"./start-one-entry-build.js";export const prepareBuild=async(r,o)=>{const[t,e]=r,n=o.multiHtmlCdn?.prod||[];if(!n.length)throw new Error(`No CDN config for env:"prod", moduleName: ${t}`);const i=ensureSlash(n[Math.floor(Math.random()*n.length)],!0),l={[t]:e};try{const r=e.options?.useRelativeAssetPath,t=mergeOptions(o,{webpack:{publicPath:r?"auto":i}});return await startOneEntryBuild(l,t)}catch(r){const o=printCompilerError(r);throw new EvolveBuildError("BUILD_ERROR",o)}};
@@ -6,4 +6,4 @@ import { type FlatEvolveOptions } from '../types/types-options.js';
6
6
  * @param servedEntries All normalized webpack entries we have served.
7
7
  * @param evolveOptions FlatEvolveOptions
8
8
  */
9
- export declare const prepareServe: (projectCwd: string, servedEntries: EvolveEntryMap, evolveOptions: FlatEvolveOptions) => Promise<import("express-serve-static-core").Express | undefined>;
9
+ export declare const prepareServe: (projectCwd: string, servedEntries: EvolveEntryMap, evolveOptions: FlatEvolveOptions) => Promise<import("express-serve-static-core").Express>;
@@ -1 +1 @@
1
- import{arrayUnique,chalk,logger,urlJoin}from"@flatjs/common";import{attachMockMiddlewares}from"@flatjs/mock";import{ignoreEntryOptionKeys,moduleName}from"../constants.js";import{createAppPageRoute,createDevServer,createDevServerCompilerTask,createDevServerEntries}from"../dev-server/index.js";import{flatEntryMap,openPage}from"../helpers/index.js";import{normalizePageProxy}from"../helpers/normalize-page-proxy.js";import{splitToEntryGroup}from"../helpers/split-to-entry-group.js";import{verifyGroupEntryOptions}from"../helpers/verify-group-entry-options.js";import{envVerify}from"./env-verify.js";export const prepareServe=async(e,r,o)=>{await envVerify(e,o);const t=splitToEntryGroup(r,o,ignoreEntryOptionKeys,!0);if(!t.length)return void logger.warn("No served entries provided!");const n=[],{app:i,devPort:a,devHostUri:p,publicIp:s}=await createDevServer(o),c=o.devServer?.mockOptions?.mockFilters||[];for(const[,e]of Object.entries(r))c.push(...e.options?.mockFilters||[]);await attachMockMiddlewares(i,{...o.devServer?.mockOptions,mockFilters:arrayUnique(c),projectCwd:e});let m=a;const l=[];for(const e of t){if(!verifyGroupEntryOptions(e,ignoreEntryOptionKeys,!0))throw new Error("The entry options in a group must be the same.");m++;const r=await createDevServerEntries(m,e,o);l.push(r)}const v=flatEntryMap(l);createAppPageRoute(e,i,p,v,o);const y=normalizePageProxy(o.devServer?.pageProxy||"/pages"),f=urlJoin(p,[y]);o.devServer?.autoOpen&&openPage(f);for(const e of l){const r=createDevServerCompilerTask(s,e,l,o);n.push(r)}return Promise.all(n).then((()=>(logger.info(`debug page ➩ ${chalk(["cyan"])(f)}`,moduleName),i)))};
1
+ import{arrayUnique,urlJoin}from"@flatjs/common";import{attachMockMiddlewares}from"@flatjs/mock";import{createAppPageRoute,createDevServer,createDevServerCompilerTasks,createDevServerEntries}from"../dev-server/index.js";import{openPage}from"../helpers/index.js";import{normalizePageProxy}from"../helpers/normalize-page-proxy.js";import{envVerify}from"./env-verify.js";export const prepareServe=async(e,r,o)=>{await envVerify(e,o);const{app:t,devPort:a,devHostUri:i,publicIp:s}=await createDevServer(o),p=o.devServer?.mockOptions?.mockFilters||[];for(const[,e]of Object.entries(r))p.push(...e.options?.mockFilters||[]);await attachMockMiddlewares(t,{...o.devServer?.mockOptions,mockFilters:arrayUnique(p),projectCwd:e});const n=await createDevServerEntries(a,r,o);createAppPageRoute(e,t,i,n,o);const c=normalizePageProxy(o.devServer?.pageProxy||"/pages"),v=urlJoin(i,[c]);o.devServer?.autoOpen&&openPage(v);const m=await createDevServerCompilerTasks(e,v,s,n,o);return Promise.all(m).then((()=>t))};
@@ -1,14 +1,14 @@
1
1
  import { type PartialDeep } from 'type-fest';
2
2
  import { type ConfigLoaderOptions } from '../load-config/types.js';
3
3
  import { type FlatEvolveOptions } from '../types/types-options.js';
4
- import { type EvolveBuildResult } from './start-group-entry-build.js';
4
+ import { type EvolveBuildResult } from './start-one-entry-build.js';
5
5
  export declare function getBuildEntryFiles(projectCwd: string, diffFiles: string[], allEntryInputs: string[], resolveAlias?: Record<string, string>, graphTreeNodeFilter?: (moduleId: string) => boolean): Promise<string[]>;
6
6
  /**
7
7
  * Dynamic check which entry modules need to build.
8
8
  * @returns
9
9
  */
10
10
  export declare function dynamicCheckBuildEntryMap(projectCwd: string, earlyCommit?: string | null, lastCommit?: string, overrideEvolveOptions?: PartialDeep<FlatEvolveOptions>, configLoaderOptions?: ConfigLoaderOptions): Promise<{
11
- buildEntries: import("../index.js").EvolveEntryMap;
11
+ buildEntries: import("src/index.js").EvolveEntryMap;
12
12
  newEvolveOptions: FlatEvolveOptions;
13
13
  }>;
14
14
  /**
@@ -1 +1 @@
1
- import Listr from"listr";import{isAbsolute,join}from"node:path";import{getCommitIdOfBranch,getDiffFiles}from"@armit/git";import{arraysIntersect,chalk,logger,requireResolve}from"@flatjs/common";import{traverseGraph}from"@flatjs/graph";import{createGlobalCompiler}from"../compiler/create-global-compiler.js";import{ignoreEntryOptionKeys,moduleName}from"../constants.js";import{isCI}from"../helpers/check-runtime-env.js";import{CustomListrRenderer}from"../helpers/custom-listr-renderer.js";import{filterActivedEntriesByEntryInputs,filterActivedEntriesByModule}from"../helpers/filter-actived-entries.js";import{formatSpinnerText}from"../helpers/format-spinner-text.js";import{getGitRoot}from"../helpers/get-git-root.js";import{getMaxProcessTasks}from"../helpers/get-max-process-tasks.js";import{jsonSerializer}from"../helpers/json-serializer.js";import{normalizeEvolveEntryMap}from"../helpers/normalize-entry-map.js";import{resolveEntryMapInputFiles}from"../helpers/resolve-entry-map-input-files.js";import{splitToEntryGroup}from"../helpers/split-to-entry-group.js";import{loadEvolveConfig}from"../load-config/load-evolve-config.js";import{createThreadWorker}from"./create-thread-worker.js";import{envVerify}from"./env-verify.js";export async function getBuildEntryFiles(e,r,t,o,i){const n=[],s=[];for(const e of t)r.includes(e)?n.push(e):s.push(e);if(i&&logger.info("Use custom graph traverse filter",moduleName),s.length){const t=await traverseGraph({input:s,projectCwd:e,treeNodeFilter:i||(()=>!0),lessImportOptions:{projectCwd:e,aliases:o}});if(!t)return n;logger.debug(`DependencyGraph:\n${JSON.stringify(t,null,2)}`);for(const e of s){const o=t[e]||[];arraysIntersect(o,r)&&n.push(e)}}return n}export async function dynamicCheckBuildEntryMap(e,r,t,o,i){const n={projectCwd:e,command:"build",resolve:requireResolve},s=await loadEvolveConfig(n,e,o,i);if(s.ci?.fixedBuildModules&&s.ci?.fixedBuildModules.length){logger.info("Use `fixedBuildModules` configuration to build...");return{buildEntries:filterActivedEntriesByModule(s.entryMap,s.ci?.fixedBuildModules),newEvolveOptions:s}}if(logger.info("Dynamicly checking code changed modules ..."),!r){const e=s.ci?.basedBranch||"origin/master";r=await getCommitIdOfBranch(e),logger.info(`Resolving base branch "${e}" commit hash "${r}" ...`)}let a=r?await getDiffFiles(r,t):[];const l=getGitRoot(e);if(!l)throw new Error(`No .git root (${e}) found`);if(a=a.map((e=>isAbsolute(e)?e:join(l,e))),logger.debug(`Diff files: \n${JSON.stringify(a,null,2)}`),!a.length)return logger.warn("It seems that there are no code files changed."),{buildEntries:{},newEvolveOptions:s};const p=await resolveEntryMapInputFiles(e,s.entryMap),m=await getBuildEntryFiles(e,a,p,s.webpack?.resolve?.alias,s.ci?.graphTreeNodeFilter);logger.debug(`To build entry files: \n${JSON.stringify(m,null,2)}`);return{buildEntries:await filterActivedEntriesByEntryInputs(e,s.entryMap,m),newEvolveOptions:s}}export const startDynamicBuild=async(e,r,t,o={},i)=>{const{buildEntries:n,newEvolveOptions:s}=await dynamicCheckBuildEntryMap(e,r,t,o,i);await envVerify(e,s);const a=normalizeEvolveEntryMap(n,s.entryMap),l=splitToEntryGroup(a,s,ignoreEntryOptionKeys,!1);if(!l.length)return logger.warn("No build entries provided!"),[];await createGlobalCompiler(!1,s);const{threads:p={}}=s,m=getMaxProcessTasks(l.length,p?.maxThreads);logger.info(`Start dynamic build with (${chalk(["magenta"])(String(m))}) workers`);const c=createThreadWorker({...p,maxThreads:m}),f=new Listr([],{concurrent:m,exitOnError:!0,renderer:isCI()?void 0:CustomListrRenderer}),d=[];for(const r of l){const t=Object.values(r)?.[0]?.groupName||"",n=Object.keys(r);let s=`Group ${chalk(["magenta"])(t)} $STATUS \n${formatSpinnerText(n)}`;isCI()&&(s=`Group ${chalk(["magenta"])(t)} compiling... \n${formatSpinnerText(n)}`),f.add({title:s,task:async()=>{const r=await c.startBuildWorker({projectCwd:e,entryKeys:n,serializedEvolveOptions:jsonSerializer.stringify(o),configLoaderOptions:i,groupName:t});d.push(r)}})}if(f.tasks.length)try{await f.run()}catch(e){throw c.terminate(),e}return c.terminate(),d};
1
+ import{isAbsolute,join}from"node:path";import{getDiffFiles,getCommitIdOfBranch}from"@armit/git";import{arraysIntersect,chalk,logger,requireResolve}from"@flatjs/common";import{traverseGraph}from"@flatjs/graph";import Listr from"listr";import{moduleName}from"../constants.js";import{filterActivedEntriesByEntryInputs,filterActivedEntriesByModule}from"../helpers/filter-actived-entries.js";import{getGitRoot}from"../helpers/get-git-root.js";import{getMaxProcessTasks}from"../helpers/get-max-process-tasks.js";import{jsonSerializer}from"../helpers/json-serializer.js";import{resolveEntryMapInputFiles}from"../helpers/resolve-entry-map-input-files.js";import{loadEvolveConfig}from"../load-config/load-evolve-config.js";import{createThreadWorker}from"./create-thread-worker.js";import{envVerify}from"./env-verify.js";export async function getBuildEntryFiles(e,r,t,i,o){const n=[],s=[];for(const e of t)r.includes(e)?n.push(e):s.push(e);if(o&&logger.info("Use custom graph traverse filter",moduleName),s.length){const t=await traverseGraph({input:s,projectCwd:e,treeNodeFilter:o||(()=>!0),lessImportOptions:{projectCwd:e,aliases:i}});if(!t)return n;logger.debug(`DependencyGraph:\n${JSON.stringify(t,null,2)}`);for(const e of s){const i=t[e]||[];arraysIntersect(i,r)&&n.push(e)}}return n}export async function dynamicCheckBuildEntryMap(e,r,t,i,o){const n={projectCwd:e,command:"build",resolve:requireResolve},s=await loadEvolveConfig(n,e,i,o);if(s.ci?.fixedBuildModules&&s.ci?.fixedBuildModules.length){logger.info("Use `fixedBuildModules` configuration to build...");return{buildEntries:filterActivedEntriesByModule(s.entryMap,s.ci?.fixedBuildModules),newEvolveOptions:s}}if(logger.info("Dynamicly checking code changed modules ..."),!r){const e=s.ci?.basedBranch||"origin/master";r=await getCommitIdOfBranch(e),logger.info(`Resolving base branch "${e}" commit hash "${r}" ...`)}let a=r?await getDiffFiles(r,t):[];const l=getGitRoot(e);if(!l)throw new Error(`No .git root (${e}) found`);if(a=a.map((e=>isAbsolute(e)?e:join(l,e))),logger.debug(`Diff files: \n${JSON.stringify(a,null,2)}`),!a.length)return logger.warn("It seems that there are no code files changed."),{buildEntries:{},newEvolveOptions:s};const c=await resolveEntryMapInputFiles(e,s.entryMap),d=await getBuildEntryFiles(e,a,c,s.webpack?.resolve?.alias,s.ci?.graphTreeNodeFilter);logger.debug(`To build entry files: \n${JSON.stringify(d,null,2)}`);return{buildEntries:await filterActivedEntriesByEntryInputs(e,s.entryMap,d),newEvolveOptions:s}}export const startDynamicBuild=async(e,r,t,i={},o)=>{const{buildEntries:n,newEvolveOptions:s}=await dynamicCheckBuildEntryMap(e,r,t,i,o);await envVerify(e,s);const a=Object.keys(n);if(!a.length)return logger.warn("No build entries providered!"),[];const l=getMaxProcessTasks(a.length,s.maxProcesses);logger.info(`Start dynamic build with (${chalk(["magenta"])(String(l))}) workers:\n${JSON.stringify({buildEntries:a},null,2)}`);const c=await createThreadWorker(l),d=new Listr([],{concurrent:l,exitOnError:!0}),f=[];for(const[r]of Object.entries(n))d.add({title:`Build module ${chalk(["magenta"])(r)} ...`,task:async()=>{const t=await c.startBuildWorker(e,r,jsonSerializer.stringify(i),o);f.push(t)}});return d.tasks.length&&await d.run(),c.pool.terminate(),f};
@@ -1,23 +1,12 @@
1
- import { MessageChannel } from 'node:worker_threads';
2
1
  import { type ConfigLoaderOptions } from '../load-config/types.js';
3
- import { FlatCliOptions } from '../types/types-cli-options.js';
4
- import { type EvolveBuildResult } from './start-group-entry-build.js';
2
+ import { type EvolveBuildResult } from './start-one-entry-build.js';
5
3
  /**
6
4
  * FIXME: The main entry to start an evolve `build`, NOTE: avoid pass configuration with `function` here.
7
5
  * If you need to call build api avoid `worker` you can directly call `prepareBuild`
8
6
  * @internal
9
- * @param options.projectCwd The Root directory (workspace) of this project.
10
- * @param options.entryKey The `entryKey` for one entry build task
11
- * @param options.serializedEvolveOptions The overrided evolve options, NOTE: we will serialize `function` property here first
12
- * @param options.configLoaderOptions Evolve config loader options, NOTE: avoid pass configuration with `function` here.
7
+ * @param projectCwd The Root directory (workspace) of this project.
8
+ * @param entryKey The `entryKey` for one entry build task
9
+ * @param serializedEvolveOptions The overrided evolve options, NOTE: we will serialize `function` property here first
10
+ * @param configLoaderOptions Evolve config loader options, NOTE: avoid pass configuration with `function` here.
13
11
  */
14
- declare const _default: (options: {
15
- projectCwd: string;
16
- entryKeys: string[];
17
- serializedEvolveOptions: string;
18
- configLoaderOptions?: ConfigLoaderOptions;
19
- messagePort?: MessageChannel["port1"];
20
- groupName?: string;
21
- cliOptions?: FlatCliOptions;
22
- }) => Promise<EvolveBuildResult>;
23
- export default _default;
12
+ export declare const startBuildWorker: (projectCwd: string, entryKey: string, serializedEvolveOptions: string, configLoaderOptions?: ConfigLoaderOptions) => Promise<EvolveBuildResult>;
@@ -1 +1 @@
1
- import{configLoggerStdWriteSteam,loggerSimpleStdWriteSteam,requireResolve}from"@flatjs/common";import{ignoreEntryOptionKeys}from"../constants.js";import{isCI}from"../helpers/check-runtime-env.js";import{filterActivedEntriesByModule}from"../helpers/filter-actived-entries.js";import{jsonSerializer}from"../helpers/json-serializer.js";import{normalizeEvolveEntryMap}from"../helpers/normalize-entry-map.js";import{splitToEntryGroup}from"../helpers/split-to-entry-group.js";import{loadEvolveConfig}from"../load-config/load-evolve-config.js";import{prepareBuild}from"./prepare-build.js";export default async e=>{isCI()||configLoggerStdWriteSteam();const{projectCwd:r,entryKeys:o,serializedEvolveOptions:t,configLoaderOptions:i,messagePort:s,groupName:p="flatjs_evolve_group",cliOptions:n}=e,l={projectCwd:r,command:"build",resolve:requireResolve},a=jsonSerializer.parse(t)||{},m=await loadEvolveConfig(l,r,a,i),f=o.map((e=>new RegExp(`^${e}$`))),g=filterActivedEntriesByModule(m.entryMap,f),d=normalizeEvolveEntryMap(g,m.entryMap),v=splitToEntryGroup(d,m,ignoreEntryOptionKeys,!1)[0];for(const[,e]of Object.entries(v))e.groupName=p;return prepareBuild(v,m,n).then((e=>(isCI()||loggerSimpleStdWriteSteam.postMessage(s),e)))};
1
+ import{requireResolve}from"@flatjs/common";import{filterActivedEntriesByModule}from"../helpers/filter-actived-entries.js";import{jsonSerializer}from"../helpers/json-serializer.js";import{normalizeEvolveEntryMap}from"../helpers/normalize-entry-map.js";import{loadEvolveConfig}from"../load-config/load-evolve-config.js";import{prepareBuild}from"./prepare-build.js";export const startBuildWorker=async(e,r,o,i)=>{const l={projectCwd:e,command:"build",resolve:requireResolve},t=jsonSerializer.parse(o)||{},n=await loadEvolveConfig(l,e,t,i),a=filterActivedEntriesByModule(n.entryMap,[new RegExp(`^${r}$`)]);if(!Object.keys(a).length)throw new Error(`No build entry resolved via "${r}" on "startBuildWorker"!`);const s=normalizeEvolveEntryMap(a,n.entryMap)[r];return prepareBuild([r,s],n)};
@@ -1,6 +1,5 @@
1
1
  import { type PartialDeep } from 'type-fest';
2
2
  import { type ConfigLoaderOptions } from '../load-config/types.js';
3
- import { FlatCliOptions } from '../types/types-cli-options.js';
4
3
  import { type FlatEvolveOptions } from '../types/types-options.js';
5
- import { type EvolveBuildResult } from './start-group-entry-build.js';
6
- export declare const startBuild: (projectCwd: string, buildModules: string[], overrideEvolveOptions?: PartialDeep<FlatEvolveOptions>, configLoaderOptions?: ConfigLoaderOptions, cliOptions?: FlatCliOptions) => Promise<EvolveBuildResult[]>;
4
+ import { type EvolveBuildResult } from './start-one-entry-build.js';
5
+ export declare const startBuild: (projectCwd: string, buildModules: string[], overrideEvolveOptions?: PartialDeep<FlatEvolveOptions>, configLoaderOptions?: ConfigLoaderOptions) => Promise<EvolveBuildResult[]>;
@@ -1 +1 @@
1
- import Listr from"listr";import{chalk,logger,requireResolve}from"@flatjs/common";import{createGlobalCompiler}from"../compiler/create-global-compiler.js";import{ignoreEntryOptionKeys}from"../constants.js";import{isCI}from"../helpers/check-runtime-env.js";import{CustomListrRenderer}from"../helpers/custom-listr-renderer.js";import{filterActivedEntriesByModule}from"../helpers/filter-actived-entries.js";import{formatSpinnerText}from"../helpers/format-spinner-text.js";import{getMaxProcessTasks}from"../helpers/get-max-process-tasks.js";import{jsonSerializer}from"../helpers/json-serializer.js";import{normalizeEvolveEntryMap}from"../helpers/normalize-entry-map.js";import{splitToEntryGroup}from"../helpers/split-to-entry-group.js";import{loadEvolveConfig}from"../load-config/load-evolve-config.js";import{createThreadWorker}from"./create-thread-worker.js";import{envVerify}from"./env-verify.js";import{startAnalyzer}from"./start-analyzer.js";export const startBuild=async(r,e,t={},o,i={})=>{const{analyzer:s=!1}=i,a={projectCwd:r,command:"build",resolve:requireResolve},n=await loadEvolveConfig(a,r,t,o);await envVerify(r,n);const l=filterActivedEntriesByModule(n.entryMap,e),m=normalizeEvolveEntryMap(l,n.entryMap),p=splitToEntryGroup(m,n,ignoreEntryOptionKeys,!1);if(!p.length)return logger.warn("No build entries provided!"),[];await createGlobalCompiler(!1,n);const{threads:c={}}=n,f=getMaxProcessTasks(p.length,c?.maxThreads);logger.info(`Start standard build with (${chalk(["magenta"])(String(f))}) workers`);const d=createThreadWorker({...c,maxThreads:f}),g=new Listr([],{concurrent:f,exitOnError:!0,renderer:isCI()?void 0:CustomListrRenderer}),y=[];for(const e of p){const s=Object.values(e)?.[0]?.groupName||"",a=Object.keys(e);let n=`Group ${chalk(["magenta"])(s)} $STATUS \n${formatSpinnerText(a)}`;isCI()&&(n=`Group ${chalk(["magenta"])(s)} compiling... \n${formatSpinnerText(a)}`),g.add({title:n,task:async()=>{const e=await d.startBuildWorker({projectCwd:r,entryKeys:a,groupName:s,serializedEvolveOptions:jsonSerializer.stringify(t),configLoaderOptions:o,cliOptions:i});y.push(e)}})}if(g.tasks.length)try{await g.run()}catch(r){throw d.terminate(),r}return d.terminate(),s&&startAnalyzer(n),y};
1
+ import{chalk,logger,requireResolve}from"@flatjs/common";import Listr from"listr";import{filterActivedEntriesByModule}from"../helpers/filter-actived-entries.js";import{getMaxProcessTasks}from"../helpers/get-max-process-tasks.js";import{jsonSerializer}from"../helpers/json-serializer.js";import{loadEvolveConfig}from"../load-config/load-evolve-config.js";import{createThreadWorker}from"./create-thread-worker.js";import{envVerify}from"./env-verify.js";export const startBuild=async(e,r,t={},o)=>{const i={projectCwd:e,command:"build",resolve:requireResolve},s=await loadEvolveConfig(i,e,t,o);await envVerify(e,s);const a=filterActivedEntriesByModule(s.entryMap,r),n=Object.keys(a);if(!n.length)return logger.warn("No build entries providered!"),[];const l=getMaxProcessTasks(n.length,s.maxProcesses);logger.info(`Start standard build with (${chalk(["magenta"])(String(l))}) workers:\n${JSON.stringify({buildEntries:n},null,2)}`);const c=await createThreadWorker(l),d=new Listr([],{concurrent:l,exitOnError:!0}),m=[];for(const[r]of Object.entries(a))d.add({title:`Build module ${chalk(["magenta"])(r)} ...`,task:async()=>{const i=await c.startBuildWorker(e,r,jsonSerializer.stringify(t),o);m.push(i)}});return d.tasks.length&&await d.run(),c.pool.terminate(),m};
@@ -0,0 +1,13 @@
1
+ import { type EvolveEntryMap } from '../types/types-entry-map.js';
2
+ import { type FlatEvolveOptions } from '../types/types-options.js';
3
+ export type EvolveBuildResult = {
4
+ name?: string;
5
+ warningStats?: unknown;
6
+ };
7
+ /**
8
+ * The helpers to build one entry at a time
9
+ * @param singleBuildEntry The single entry
10
+ * @param buildPublicPath
11
+ * @param evolveOptions
12
+ */
13
+ export declare const startOneEntryBuild: (singleBuildEntry: EvolveEntryMap, evolveOptions: FlatEvolveOptions) => Promise<EvolveBuildResult>;
@@ -0,0 +1 @@
1
+ import webpack from"webpack";import{loadWebpackConfig}from"../create-webpack/load-webpack-config.js";import{splitToMultiCompilerConfigs}from"../helpers/split-to-multi-compiler.js";export const startOneEntryBuild=async(r,o)=>{const t=await loadWebpackConfig("production",r,o),n=splitToMultiCompilerConfigs(r,t,o,!1);if(n.length>1)throw new Error("startOneEntryBuild() only support `compiler` at a time");const e=n[0];return new Promise(((r,t)=>{webpack(e,((n,i)=>{if(n)return t(n);const a=i?.toJson();return a?.errors?.length?t(a.errors):o.rejectWarnings&&a?.warnings?.length?t(a.warnings):void r({name:e.name,warningStats:a?.warnings})}))}))};
@@ -8,4 +8,4 @@ import { type FlatEvolveOptions } from '../types/types-options.js';
8
8
  * @param overrideEvolveOptions The overrided evolve options
9
9
  * @param configLoaderOptions Evolve config loader options
10
10
  */
11
- export declare const startServe: (projectCwd: string, serveModules: string[], overrideEvolveOptions?: PartialDeep<FlatEvolveOptions>, configLoaderOptions?: ConfigLoaderOptions) => Promise<never[] | import("express-serve-static-core").Express | undefined>;
11
+ export declare const startServe: (projectCwd: string, serveModules: string[], overrideEvolveOptions?: PartialDeep<FlatEvolveOptions>, configLoaderOptions?: ConfigLoaderOptions) => Promise<never[] | import("express-serve-static-core").Express>;
@@ -1 +1 @@
1
- import{logger,requireResolve}from"@flatjs/common";import{createGlobalCompiler}from"../compiler/create-global-compiler.js";import{filterActivedEntriesByModule}from"../helpers/filter-actived-entries.js";import{normalizeEvolveEntryMap}from"../helpers/normalize-entry-map.js";import{loadEvolveConfig}from"../load-config/load-evolve-config.js";import{prepareServe}from"./prepare-serve.js";export const startServe=async(e,r,o={},t)=>{const l={projectCwd:e,command:"serve",resolve:requireResolve},i=await loadEvolveConfig(l,e,o,t),a=filterActivedEntriesByModule(i.entryMap,r),n=Object.keys(a);if(!n.length)return logger.warn("No served entries providered!"),[];logger.info({servedEntries:n});const p=normalizeEvolveEntryMap(a,i.entryMap);return await createGlobalCompiler(!0,i),prepareServe(e,p,i)};
1
+ import{logger,requireResolve}from"@flatjs/common";import{filterActivedEntriesByModule}from"../helpers/filter-actived-entries.js";import{normalizeEvolveEntryMap}from"../helpers/normalize-entry-map.js";import{loadEvolveConfig}from"../load-config/load-evolve-config.js";import{prepareServe}from"./prepare-serve.js";export const startServe=async(e,r,o={},t)=>{const i={projectCwd:e,command:"serve",resolve:requireResolve},n=await loadEvolveConfig(i,e,o,t),l=filterActivedEntriesByModule(n.entryMap,r),s=Object.keys(l);if(!s.length)return logger.warn("No served entries providered!"),[];logger.info({servedEntries:s});const v=normalizeEvolveEntryMap(l,n.entryMap);return prepareServe(e,v,n)};
@@ -1 +1 @@
1
- import{logger}from"@flatjs/common";import{moduleName}from"../constants.js";import{printInfo}from"../helpers/print-log.js";import{imageMinimizer}from"./image-minimizer.js";import{terserMinimizer}from"./terser-minimizer.js";export const createMinimizers=(i,r)=>{const e=[];if(i)return logger.debug("Ignore minimizer plugin for `serve` mode",moduleName),e;if(!1===r?.minimizer)return printInfo("Note `minimizer` has been disabled for now"),e;if(r?.minimizer?.imageMin){const i=imageMinimizer();i&&e.push(i)}if(!1===r?.minimizer?.terserOptions)return e;const m=terserMinimizer(r?.minimizer?.terserOptions||{});return e.push(m),e};
1
+ import{logger}from"@flatjs/common";import{moduleName}from"../constants.js";import{printInfo}from"../helpers/print-log.js";import{imageMinimizer}from"./image-minimizer.js";import{terserMinimizer}from"./terser-minimizer.js";export const createMinimizers=(i,r)=>{const e=[];if(i)return logger.debug("Ignore minimizer plugin for `serve` mode",moduleName),e;if(!1===r?.minimizer)return printInfo("Note `minimizer` has been disabled for now"),e;if(r?.minimizer?.imageMin){const i=imageMinimizer();i&&e.push(i)}const m=terserMinimizer(r?.minimizer?.terserOptions||{});return e.push(m),e};
@@ -1 +1 @@
1
- import ImageMinimizerPlugin from"image-minimizer-webpack-plugin";import{projectHasYarn}from"@armit/package";import{chalk,logger,requireResolve}from"@flatjs/common";import{moduleName}from"../constants.js";const logs=new Map;export const imageMinimizer=()=>{const e=[],i=[["svgo",{}],["gifsicle",{}],["jpegtran",{}],["pngquant",{}]].map((i=>{const n=i[0];try{return requireResolve(import.meta.url,`imagemin-${n}`),i}catch{if(!logs.get(n)){logs.set(n,!0);const i=chalk(["magenta"])(`"${projectHasYarn()?"yarn add":"npm install"} imagemin-${n} -D"`);e.push(`Execute ${i} for assets optimization`)}return null}})).filter(Boolean);if(e.length)for(const i of e)logger.warn(i,moduleName);return i.length?new ImageMinimizerPlugin({minimizer:{implementation:ImageMinimizerPlugin.imageminMinify,options:{plugins:i}}}):null};
1
+ import{projectHasYarn}from"@armit/package";import{chalk,logger,requireResolve}from"@flatjs/common";import ImageMinimizerPlugin from"image-minimizer-webpack-plugin";import{moduleName}from"../constants.js";const logs=new Map;export const imageMinimizer=()=>{const e=[],i=[["svgo",{}],["gifsicle",{}],["jpegtran",{}],["pngquant",{}]].map((i=>{const n=i[0];try{return requireResolve(import.meta.url,`imagemin-${n}`),i}catch(i){if(!logs.get(n)){logs.set(n,!0);const i=chalk(["magenta"])(`"${projectHasYarn()?"yarn add":"npm install"} imagemin-${n} -D"`);e.push(`Execute ${i} for assets optimization`)}return null}})).filter(Boolean);if(e.length)for(const i of e)logger.warn(i,moduleName);return i.length?new ImageMinimizerPlugin({minimizer:{implementation:ImageMinimizerPlugin.imageminMinify,options:{plugins:i}}}):null};
@@ -1,3 +1,3 @@
1
- import TerserPlugin from"terser-webpack-plugin";import{mergeOptions}from"@flatjs/common";import{defaultTerserOptions}from"./default-options.js";export const terserMinimizer=e=>new TerserPlugin({parallel:!0,
1
+ import{mergeOptions}from"@flatjs/common";import TerserPlugin from"terser-webpack-plugin";import{defaultTerserOptions}from"./default-options.js";export const terserMinimizer=e=>new TerserPlugin({parallel:!0,
2
2
  // Disable Extract all or some (use /^\**!|@preserve|@license|@cc_on/i RegExp) comments.
3
3
  extractComments:!1,terserOptions:mergeOptions(defaultTerserOptions,e)});
@@ -1 +1 @@
1
- import{relative}from"node:path";import Graph from"tarjan-graph";import webpack from"webpack";import{mergeOptions}from"@flatjs/common";const BASE_ERROR="Circular dependency detected:\r\n",PLUGIN_TITLE="CircularDependencyPlugin";export class CircularDependencyPlugin{constructor(o={}){this.options=mergeOptions({exclude:/node_modules/,include:/.*/,failOnError:!1,allowAsyncCycles:!1,projectCwd:process.cwd()},o)}apply(o){const e=this.options.projectCwd;o.hooks.compilation.tap(PLUGIN_TITLE,(o=>{o.hooks.optimizeModules.tap(PLUGIN_TITLE,(t=>{this.options.onStart&&this.options.onStart({compilation:o});const n=new(Graph.default||Graph);for(const e of t){const t=[];for(const n of e.dependencies){if(n.constructor&&"CommonJsSelfReferenceDependency"===n.constructor.name)continue;let r=null;r=o.moduleGraph?o.moduleGraph.getModule(n):n.module,r&&(r instanceof webpack.NormalModule&&r.resource&&(this.options.allowAsyncCycles&&n.weak||e!==r&&t.push(r.identifier())))}n.add(e.identifier(),t)}const r=n.getCycles();this.isCyclic(r,o,e),this.options.onEnd&&this.options.onEnd({compilation:o})}))}))}isCyclic(o,e,t){o.forEach((o=>{const n=o.slice().reverse().map((o=>{const t=e.findModule(o.name);return t instanceof webpack.NormalModule&&t.resource||null}));if(n.every((o=>!o||this.options.exclude.test(o)||!this.options.include.test(o))))return;const r=n.map((o=>relative(t,o)));if(this.options.onDetected){try{this.options.onDetected({paths:r.concat([r[0]]),compilation:e})}catch(o){e.errors.push(o)}return}const s=new Error(BASE_ERROR.concat(r.concat([r[0]]).join(" -> ")));this.options.failOnError?e.errors.push(s):e.warnings.push(s)}))}}
1
+ import{relative}from"node:path";import{mergeOptions}from"@flatjs/common";import Graph from"tarjan-graph";import webpack from"webpack";const BASE_ERROR="Circular dependency detected:\r\n",PLUGIN_TITLE="CircularDependencyPlugin";export class CircularDependencyPlugin{constructor(o={}){this.options=mergeOptions({exclude:/node_modules/,include:/.*/,failOnError:!1,allowAsyncCycles:!1,projectCwd:process.cwd()},o)}apply(o){const e=this.options.projectCwd;o.hooks.compilation.tap(PLUGIN_TITLE,(o=>{o.hooks.optimizeModules.tap(PLUGIN_TITLE,(t=>{this.options.onStart&&this.options.onStart({compilation:o});const n=new(Graph.default||Graph);for(const e of t){const t=[];for(const n of e.dependencies){if(n.constructor&&"CommonJsSelfReferenceDependency"===n.constructor.name)continue;let r=null;r=o.moduleGraph?o.moduleGraph.getModule(n):n.module,r&&(r instanceof webpack.NormalModule&&r.resource&&(this.options.allowAsyncCycles&&n.weak||e!==r&&t.push(r.identifier())))}n.add(e.identifier(),t)}const r=n.getCycles();this.isCyclic(r,o,e),this.options.onEnd&&this.options.onEnd({compilation:o})}))}))}isCyclic(o,e,t){o.forEach((o=>{const n=o.slice().reverse().map((o=>{const t=e.findModule(o.name);return t instanceof webpack.NormalModule&&t.resource||null}));if(n.every((o=>!o||this.options.exclude.test(o)||!this.options.include.test(o))))return;const r=n.map((o=>relative(t,o)));if(this.options.onDetected){try{this.options.onDetected({paths:r.concat([r[0]]),compilation:e})}catch(o){e.errors.push(o)}return}const s=new Error(BASE_ERROR.concat(r.concat([r[0]]).join(" -> ")));this.options.failOnError?e.errors.push(s):e.warnings.push(s)}))}}
@@ -6,4 +6,4 @@ import { type FlatEvolveOptions } from '../../types/types-options.js';
6
6
  * @param singleEntryItem
7
7
  * @returns
8
8
  */
9
- export declare const createCleanWebpackPlugin: (serveMode: boolean, entryMapItemList: EntryMapItem[], evolveOptions: FlatEvolveOptions) => WebpackPlugin[];
9
+ export declare const createCleanWebpackPlugin: (serveMode: boolean, entryMapItem: EntryMapItem, evolveOptions: FlatEvolveOptions) => WebpackPlugin[];
@@ -1 +1 @@
1
- import{join}from"node:path";import{ensureSlash}from"@flatjs/common";import{CleanWebpackPlugin}from"./clean-webpack-plugin.js";export const createCleanWebpackPlugin=(e,n,o)=>e?[]:[new CleanWebpackPlugin({verbose:!0,projectCwd:o.projectCwd,cleanOnceBeforeBuildPatterns:n.map((e=>`${join(ensureSlash(e[0],!0),"**/*")}`))})];
1
+ import{join}from"node:path";import{ensureSlash}from"@flatjs/common";import{CleanWebpackPlugin}from"./clean-webpack-plugin.js";export const createCleanWebpackPlugin=(e,n,o)=>e?[]:[new CleanWebpackPlugin({verbose:!0,projectCwd:o.projectCwd,cleanOnceBeforeBuildPatterns:[`${join(ensureSlash(n[0],!0),"**/*")}`]})];
@@ -1 +1 @@
1
- import webpack from"webpack";import{getLastCommitHash,gitBranchName}from"@armit/git";export const createBuiltinDefineVariables=async(e,i)=>{const t=await getLastCommitHash(),n=await gitBranchName();return[new webpack.DefinePlugin({__SENTRY_DEBUG__:e,"process.env.FLAT_BUILD_DATE":JSON.stringify((new Date).toISOString()),"process.env.FLAT_COMMIT_HASH":JSON.stringify(t),"process.env.FLAT_BRANCH_NAME":JSON.stringify(n),"process.env.FLAT_RELEASE_VERSION":JSON.stringify(i.ci?.releaseVersion||t),...i.pluginOptions.definePlugin})]};
1
+ import{getLastCommitHash,gitBranchName}from"@armit/git";import webpack from"webpack";export const createBuiltinDefineVariables=async(e,i)=>{const t=await getLastCommitHash(),n=await gitBranchName();return[new webpack.DefinePlugin({__SENTRY_DEBUG__:e,"process.env.FLAT_BUILD_DATE":JSON.stringify((new Date).toISOString()),"process.env.FLAT_COMMIT_HASH":JSON.stringify(t),"process.env.FLAT_BRANCH_NAME":JSON.stringify(n),"process.env.FLAT_RELEASE_VERSION":JSON.stringify(i.ci?.releaseVersion||t),...i.pluginOptions.definePlugin})]};
@@ -1,4 +1,4 @@
1
1
  import { type WebpackPluginInstance } 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 createModuleFederationPlugin: (serveMode: boolean, entryMapItemList: EntryMapItem[], evolveOptions: FlatEvolveOptions) => WebpackPluginInstance[];
4
+ export declare const createModuleFederationPlugin: (serveMode: boolean, entryMapItem: EntryMapItem, evolveOptions: FlatEvolveOptions) => WebpackPluginInstance[];
@@ -1 +1 @@
1
- import{join}from"node:path";import webpack from"webpack";import{ensureSlash}from"@flatjs/common";import{normalizeEvolveEntryName}from"../../helpers/normalize-entry-map.js";import{injectFederationScripts}from"../../helpers/script-injects.js";import{HtmlInjectScriptPlugin}from"../html-inject-scripts/plugin-html-inject-script.js";import{ExternalTemplateRemotesPlugin}from"./external-template-remotes.js";const normalizeWidgetName=(e="")=>e.replace(/[/-]/g,"_").toLowerCase(),remoteFileName=e=>join(e,"micro-remote-module.js");export const createModuleFederationPlugin=(e,t,o)=>{const r=o.projectVirtualPath,n=o.multiHtmlCdn,i=o.multiHtmlCdnEnvResolver,m=[];for(const o of t){const[t,a]=o,l=a.options?.moduleFederation;if(l){const{remotes:o,exposes:a,...s}=l,c=remoteFileName(t),p=normalizeWidgetName(t),u=(a?Array.isArray(a)?a:[a]:[]).map((e=>{const o={};for(const[r,n]of Object.entries(e))o[r]={...n,name:join(t,n.name.replace(/^\//,""))};return o})),d=(o||[]).map((({name:e,endpoint:t})=>{const o=normalizeEvolveEntryName(e,r),n=normalizeWidgetName(o),i=remoteFileName(o),m=t?ensureSlash(t(e,o),!1):"[window.evolveFetchMicroWidgets()]";return{[n]:`${n}@${m}/${i}`}}));m.push(new webpack.container.ModuleFederationPlugin({...s,name:p,filename:c,remotes:d,exposes:u}),new ExternalTemplateRemotesPlugin),e||m.unshift(new HtmlInjectScriptPlugin([injectFederationScripts(n,i)]))}}return m};
1
+ import{join}from"node:path";import{ensureSlash}from"@flatjs/common";import webpack from"webpack";import{normalizeEvolveEntryName}from"../../helpers/normalize-entry-map.js";import{injectFederationScripts}from"../../helpers/script-injects.js";import{HtmlInjectScriptPlugin}from"../html-inject-scripts/plugin-html-inject-script.js";import{ExternalTemplateRemotesPlugin}from"./external-template-remotes.js";const normalizeWidgetName=(e="")=>e.replace(/[/-]/g,"_").toLowerCase(),remoteFileName=e=>join(e,"micro-remote-module.js");export const createModuleFederationPlugin=(e,t,r)=>{const o=r.projectVirtualPath,[n,i]=t,m=r.multiHtmlCdn,a=r.multiHtmlCdnEnvResolver,l=i.options?.moduleFederation,s=[];if(l){const{remotes:t,exposes:r,...i}=l,p=remoteFileName(n),c=normalizeWidgetName(n),u=(r?Array.isArray(r)?r:[r]:[]).map((e=>{const t={};for(const[r,o]of Object.entries(e))t[r]={...o,name:join(n,o.name.replace(/^\//,""))};return t})),d=(t||[]).map((({name:e,endpoint:t})=>{const r=normalizeEvolveEntryName(e,o),n=normalizeWidgetName(r),i=remoteFileName(r);return{[n]:`${n}@${t?ensureSlash(t(e,r),!1):"[window.evolveFetchMicroWidgets()]"}/${i}`}}));s.push(new webpack.container.ModuleFederationPlugin({...i,name:c,filename:p,remotes:d,exposes:u}),new ExternalTemplateRemotesPlugin),e||s.unshift(new HtmlInjectScriptPlugin([injectFederationScripts(m,a)]))}return s};
@@ -1,4 +1,4 @@
1
1
  import { type WebpackPlugin } from '../../create-webpack/types.js';
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 createHtmlPlugins: (serveMode: boolean, entryMapItemList: EntryMapItem[], evolveOptions: FlatEvolveOptions) => WebpackPlugin[];
4
+ export declare const createHtmlPlugins: (serveMode: boolean, entryMapItem: EntryMapItem, evolveOptions: FlatEvolveOptions) => WebpackPlugin[];
@@ -1 +1 @@
1
- import{FlatEvolveMultiCdnPlugin}from"./multi-html-cdn-plugin.js";import{createMultiHtmlWebpackPlugin}from"./multi-html-plugin.js";export const createHtmlPlugins=(t,l,u)=>{const i=[],n=l[0];if(t||n[1]?.options?.output?.library)return i;const e=Object.keys(u.multiHtmlCdn);return i.push(...createMultiHtmlWebpackPlugin(t,u,l,e)),i.push(new FlatEvolveMultiCdnPlugin(u)),i};
1
+ import{FlatEvolveMultiCdnPlugin}from"./multi-html-cdn-plugin.js";import{createMultiHtmlWebpackPlugin}from"./multi-html-plugin.js";export const createHtmlPlugins=(t,l,u)=>{const i=[];if(t||l[1]?.options?.output?.library)return i;const n=Object.keys(u.multiHtmlCdn);return i.push(...createMultiHtmlWebpackPlugin(t,u,l,n)),i.push(new FlatEvolveMultiCdnPlugin(u)),i};
@@ -1 +1 @@
1
- import HtmlWebpackPlugin from"html-webpack-plugin";import{basename}from"node:path";import webpack from"webpack";import{getRuntimeCDNBase}from"../../helpers/get-runtime-cdn-base.js";import{findEnvCdn,httpUrlJoin}from"../../helpers/script-injects.js";export class FlatEvolveMultiCdnPlugin{constructor(e){if(this.pluginName="FlatEvolveMultiCdnPlugin",this.requireFn=webpack.RuntimeGlobals.publicPath,this.config=e.multiHtmlCdn,this.cdnResolver=e.multiHtmlCdnEnvResolver||function cdnResolver(){},!this.config?.prod)throw new Error("We must setup `prod` for each CDN config node!")}apply(e){e.hooks.thisCompilation.tap(this.pluginName,(e=>{e.mainTemplate.hooks.requireExtensions.tap(this.pluginName,((t,n)=>{const i=[];i.push("// Dynamic assets path override(`@flatjs/evolve`) plugin-multi-html-cdn`)");const s=e.chunkGraph?.getTreeRuntimeRequirements(n);return s&&s.has(webpack.RuntimeGlobals.requireScope)&&i.push(webpack.Template.indent(getRuntimeCDNBase(this.config,this.cdnResolver,this.requireFn))),webpack.Template.asString(i)}))})),e.hooks.compilation.tap(this.pluginName,(e=>{HtmlWebpackPlugin.getHooks(e).beforeAssetTagGeneration.tap(this.pluginName,(e=>{const{assets:t,plugin:n,outputName:i}=e,s=n?.options?.chunks||[],r=Array.isArray(s)?s.find((e=>i.includes(e))):s,{userOptions:o}=e.plugin;if(!r)throw new Error("We must have current chunk!");const a=t.js.filter((e=>e.includes(r))),l=t.css.filter((e=>e.includes(r))),p=o.multiCdn,u=t.publicPath,c=a.map((e=>{if(p.disabled)return basename(e);const t=findEnvCdn(this.config,p.env);return httpUrlJoin(t,e.replace(u,""))})),m=l.map((e=>{if(p.disabled)return basename(e);const t=findEnvCdn(this.config,p.env);return httpUrlJoin(t,e.replace(u,""))}));return e.assets.js=c,e.assets.css=m,e}))}))}}
1
+ import{basename}from"node:path";import HtmlWebpackPlugin from"html-webpack-plugin";import webpack from"webpack";import{cdnFinder,findEnvCdn,httpUrlJoin}from"../../helpers/script-injects.js";export class FlatEvolveMultiCdnPlugin{constructor(e){if(this.pluginName="FlatEvolveMultiCdnPlugin",this.requireFn=webpack.RuntimeGlobals.publicPath,this.config=e.multiHtmlCdn,this.cdnResolver=e.multiHtmlCdnEnvResolver||function cdnResolver(){},!this.config?.prod)throw new Error("We must setup `prod` for each CDN config node!")}apply(e){e.hooks.thisCompilation.tap(this.pluginName,(e=>{e.mainTemplate.hooks.requireExtensions.tap(this.pluginName,((n,t)=>{const i=[];i.push("// Dynamic assets path override(`@flatjs/evolve`) plugin-multi-html-cdn`)");const s=e.chunkGraph?.getTreeRuntimeRequirements(t);return s&&s.has(webpack.RuntimeGlobals.requireScope)&&(i.push("(function () {"),i.push(webpack.Template.indent("var flatjsMultiCdn = {")),i.push(webpack.Template.indent(webpack.Template.indent([`cdnConfig: ${JSON.stringify(this.config||{})},`]))),i.push(webpack.Template.indent(webpack.Template.indent([`cdnResolver: ${this.cdnResolver.toString()},`]))),i.push(webpack.Template.indent(webpack.Template.indent([`cdnFinder: ${cdnFinder.toString()}`]))),i.push(webpack.Template.indent("};")),i.push(webpack.Template.indent(`${this.requireFn} = flatjsMultiCdn.cdnFinder(flatjsMultiCdn.cdnConfig, flatjsMultiCdn.cdnResolver) || ${this.requireFn};`)),i.push("})();")),webpack.Template.asString(i)}))})),e.hooks.compilation.tap(this.pluginName,(e=>{HtmlWebpackPlugin.getHooks(e).beforeAssetTagGeneration.tap(this.pluginName,(e=>{const{assets:n}=e,{userOptions:t}=e.plugin,i=t.multiCdn,s=n.publicPath,a=n.js.map((e=>{if(i.disabled)return basename(e);const n=findEnvCdn(this.config,i.env);return httpUrlJoin(n,e.replace(s,""))})),p=n.css.map((e=>{if(i.disabled)return basename(e);const n=findEnvCdn(this.config,i.env);return httpUrlJoin(n,e.replace(s,""))}));return e.assets.js=a,e.assets.css=p,e}))}))}}
@@ -8,4 +8,4 @@ import { type FlatEvolveOptions } from '../../types/types-options.js';
8
8
  * @param buildEntryItem the entries for this `build`
9
9
  * @param allEnv
10
10
  */
11
- export declare const createMultiHtmlWebpackPlugin: (serveMode: boolean, evolveOptions: FlatEvolveOptions, entryMapItemList: EntryMapItem[], allEnv: Array<EvolveMultiCdnEnvType>) => WebpackPlugin[];
11
+ export declare const createMultiHtmlWebpackPlugin: (serveMode: boolean, evolveOptions: FlatEvolveOptions, entryMapItem: EntryMapItem, allEnv: Array<EvolveMultiCdnEnvType>) => WebpackPlugin[];
@@ -1 +1 @@
1
- import HtmlWebpackPlugin from"html-webpack-plugin";import{existsSync}from"node:fs";import{logger}from"@flatjs/common";import{allowPx2remForModule}from"../../helpers/allow-px2rem-for-module.js";import{getHtmlPluginConfig}from"../../helpers/get-html-plugin-config.js";import{normalizeTemplateInjectTokens}from"../../helpers/normalize-template-inject-tokens.js";import{findEnvCdn}from"../../helpers/script-injects.js";const minifyOpts={minifyJS:!0,removeComments:!0,collapseWhitespace:!0,collapseBooleanAttributes:!1};export const createMultiHtmlWebpackPlugin=(e,t,l,i)=>{const n=l[0],[,o]=n,m=[],{options:r}=o,p=e?"development":"production",s=l.map((e=>e[0]));for(const e of i){const l={mode:p,envCdn:findEnvCdn(t.multiHtmlCdn,e)},i=normalizeTemplateInjectTokens(l,r);let o=getHtmlPluginConfig("templatePath",l,r?.templatePath).replace("{0}",e.trim());existsSync(o)||(logger.warn(`The template file ${o} is not exists, use \`prod\` instead!`),o=getHtmlPluginConfig("templatePath",l,r?.templatePath).replace("{0}","prod")),m.push(new HtmlWebpackPlugin({inject:"body",title:getHtmlPluginConfig("title",l,r?.title),chunks:s,minify:!1!==r?.htmlMinify&&!["me","dev"].includes(e)&&minifyOpts,filename:t=>`${t}/index${"prod"===e?"":`-${e}`}.html`,template:o,templateParameters:{title:getHtmlPluginConfig("title",l,r?.title),favicon:getHtmlPluginConfig("favicon",l,r?.favicon),viewport:allowPx2remForModule(n,t)?getHtmlPluginConfig("viewport",l,r?.viewport):"",...i},multiCdn:{env:e,disabled:(r?.excludeCdnEnvs||["me","dev","ntv"]).includes(e)}}))}return m};
1
+ import HtmlWebpackPlugin from"html-webpack-plugin";import{allowPx2remForModule}from"../../helpers/allow-px2rem-for-module.js";import{getHtmlPluginConfig}from"../../helpers/get-html-plugin-config.js";import{findEnvCdn}from"../../helpers/script-injects.js";const minifyOpts={minifyJS:!0,removeComments:!0,collapseWhitespace:!0,collapseBooleanAttributes:!1};export const createMultiHtmlWebpackPlugin=(e,t,i,l)=>{const[n,o]=i,r=[],{options:m}=o,g=e?"development":"production";for(const e of l){const l={mode:g,envCdn:findEnvCdn(t.multiHtmlCdn,e)};r.push(new HtmlWebpackPlugin({inject:"body",title:getHtmlPluginConfig("title",l,m?.title),chunks:[n],minify:!1!==m?.htmlMinify&&!["me","dev"].includes(e)&&minifyOpts,filename:`${n}/index${"prod"===e?"":`-${e}`}.html`,template:getHtmlPluginConfig("templatePath",l,m?.templatePath).replace("{0}",e),templateParameters:{title:getHtmlPluginConfig("title",l,m?.title),favicon:getHtmlPluginConfig("favicon",l,m?.favicon),headBeforeHtmlTags:getHtmlPluginConfig("headBeforeHtmlTags",l,m?.headBeforeHtmlTags),inlineScripts:getHtmlPluginConfig("inlineScripts",l,m?.inlineScripts),headBeforeStyles:getHtmlPluginConfig("headBeforeStyles",l,m?.headBeforeStyles),headBeforeScripts:getHtmlPluginConfig("headBeforeScripts",l,m?.headBeforeScripts),bodyAfterScripts:getHtmlPluginConfig("bodyAfterScripts",l,m?.bodyAfterScripts),viewport:allowPx2remForModule(i,t)?getHtmlPluginConfig("viewport",l,m?.viewport):""},multiCdn:{env:e,disabled:(m?.excludeCdnEnvs||["me","dev","ntv"]).includes(e)}}))}return r};
@@ -1,10 +1,8 @@
1
- export * from './types-analyzer.js';
2
1
  export * from './types-dev-server.js';
3
2
  export * from './types-entry-map.js';
4
3
  export * from './types-federation.js';
5
- export * from './types-global-compiler-options.js';
6
- export * from './types-loader-options.js';
7
4
  export * from './types-modular-import.js';
8
5
  export * from './types-multi-html.js';
9
6
  export * from './types-options.js';
7
+ export * from './types-loader-options.js';
10
8
  export * from './types-webpack.js';
@@ -1 +1 @@
1
- export*from"./types-analyzer.js";export*from"./types-dev-server.js";export*from"./types-entry-map.js";export*from"./types-federation.js";export*from"./types-global-compiler-options.js";export*from"./types-loader-options.js";export*from"./types-modular-import.js";export*from"./types-multi-html.js";export*from"./types-options.js";export*from"./types-webpack.js";
1
+ export*from"./types-dev-server.js";export*from"./types-entry-map.js";export*from"./types-federation.js";export*from"./types-modular-import.js";export*from"./types-multi-html.js";export*from"./types-options.js";export*from"./types-loader-options.js";export*from"./types-webpack.js";
@@ -1,6 +1,7 @@
1
+ import { type SecureContextHttps, type FlatMockOptions } from '@flatjs/mock';
1
2
  import { type RequestHandler } from 'express';
2
- import { type ClientConfiguration, Middleware, type WebSocketURL } from 'webpack-dev-server';
3
- import { type FlatMockOptions, type SecureContextHttps } from '@flatjs/mock';
3
+ import { type Configuration } from 'webpack';
4
+ import { type WebSocketURL, type ClientConfiguration } from 'webpack-dev-server';
4
5
  import { type EvolveEntryMapContent } from './types-entry-map.js';
5
6
  export interface WebpackWatchOptions {
6
7
  /**
@@ -12,9 +13,9 @@ export interface WebpackWatchOptions {
12
13
  */
13
14
  followSymlinks?: boolean;
14
15
  /**
15
- * Ignore some files from watching
16
+ * Ignore some files from watching (glob pattern or regexp).
16
17
  */
17
- ignored?: string[];
18
+ ignored?: string | RegExp | string[];
18
19
  /**
19
20
  * Enable polling mode for watching.
20
21
  */
@@ -35,19 +36,7 @@ export type FlatEvolveDevServerOptions = {
35
36
  * In webpack-dev-server watch mode is enabled by default.
36
37
  * This configuration will be merged into `webpack-dev-server`
37
38
  */
38
- watchOptions?: WebpackWatchOptions;
39
- /**
40
- * Provides the ability to execute a custom function and apply custom middleware(s).
41
- * https://webpack.js.org/configuration/dev-server/#devserversetupmiddlewares
42
- * @default []
43
- */
44
- devBeforeMiddlewares?: Middleware[];
45
- /**
46
- * Provides the ability to execute a custom function and apply custom middleware(s).
47
- * https://webpack.js.org/configuration/dev-server/#devserversetupmiddlewares
48
- * @default []
49
- */
50
- devAfterMiddlewares?: Middleware[];
39
+ watchOptions?: Configuration['watchOptions'];
51
40
  /**
52
41
  * Allow us costomized global serve data injected into `window.GLOBAL = {...globalData}`
53
42
  */
@@ -59,8 +59,8 @@ export interface EvolveEntryItemOption extends MultiHtmlCDNEntryItem {
59
59
  */
60
60
  mockFilters?: Array<string | RegExp>;
61
61
  /**
62
- * Extends the default `output` configuration for each entry item, normally we use `output.library` to define the global variable name.
63
- * Note we don't need to support react fast refresh for library target. because of the library module can not run in the browser individually.
62
+ * Extends the default `output` configuration for each entry item.
63
+ * normally we use `output.library` to define the global variable name.
64
64
  * @example
65
65
  * ```ts
66
66
  *'plugin-chart': {
@@ -78,29 +78,11 @@ export interface EvolveEntryItemOption extends MultiHtmlCDNEntryItem {
78
78
  * ```
79
79
  * @default undefined
80
80
  */
81
- output?: Omit<Required<Configuration>['output'], 'chunkFilename' | 'cssChunkFilename'>;
81
+ output?: Configuration['output'];
82
82
  }
83
83
  export type EvolveEntryMapContent = {
84
84
  entry: [string, ...string[]];
85
85
  options?: EvolveEntryItemOption;
86
- /**
87
- * An alias used when grouping builds
88
- */
89
- groupName?: string;
90
- /**
91
- * The basis of the grouping, this configuration takes effect when re-entering a group
92
- *
93
- * If groupingSource is `manual`, The grouping depends on the manually set groupName
94
- *
95
- * If groupingSource is `auto`, Grouping depends on whether the entry options are the same
96
- *
97
- * @default 'auto'
98
- */
99
- groupingSource?: 'auto' | 'manual';
100
- /**
101
- * The base path of the entry module
102
- */
103
- entryModuleBase?: string[];
104
86
  };
105
87
  export interface EvolveEntryMap {
106
88
  /**
@@ -1,7 +1,6 @@
1
- import { type AcceptedPlugin } from 'postcss';
2
- import { type LoaderContext } from 'webpack';
3
1
  import { type TransformOptions } from '@babel/core';
4
2
  import { type PostcssPluginPixelOptions } from '@flatjs/forge-postcss-plugin-pixel';
3
+ import { type AcceptedPlugin } from 'postcss';
5
4
  import { type ModularImportOption } from './types-modular-import.js';
6
5
  export type BabelInputOptions = Pick<TransformOptions, 'presets' | 'plugins'>;
7
6
  /**
@@ -15,34 +14,6 @@ export type BuiltinBabelOptions = BabelInputOptions & {
15
14
  */
16
15
  usePreset?: 'react' | 'vue';
17
16
  };
18
- /**
19
- * The configurations for `css-loader` modules
20
- * https://github.com/webpack-contrib/css-loader/blob/master/README.md#modules
21
- */
22
- export type CssLoaderModules = boolean | 'local' | 'global' | 'pure' | 'icss' | Partial<{
23
- auto: boolean | RegExp | ((resourcePath: string) => boolean);
24
- mode: 'local' | 'global' | 'pure' | 'icss' | ((resourcePath: any) => 'local' | 'global' | 'pure' | 'icss');
25
- localIdentName: string;
26
- localIdentContext: string;
27
- localIdentHashSalt: string;
28
- localIdentHashFunction: string;
29
- localIdentHashDigest: string;
30
- localIdentRegExp: string | RegExp;
31
- getLocalIdent: (context: LoaderContext<any>, localIdentName: string, localName: string) => string;
32
- namedExport: boolean;
33
- exportGlobals: boolean;
34
- exportLocalsConvention: 'as-is' | 'camel-case' | 'camel-case-only' | 'dashes' | 'dashes-only' | ((name: string) => string);
35
- exportOnlyLocals: boolean;
36
- getJSON: ({ resourcePath, imports, exports, replacements, }: {
37
- resourcePath: string;
38
- imports: object[];
39
- exports: object[];
40
- replacements: object[];
41
- }) => Promise<void> | void;
42
- }>;
43
- export type CssLoaderOptions = {
44
- modules?: CssLoaderModules;
45
- } & Record<string, unknown>;
46
17
  /**
47
18
  * The configurations for `builtin` rule set options
48
19
  */
@@ -57,7 +28,9 @@ export interface RuleSetLoaderOptions {
57
28
  * The configurations of `css-loader`
58
29
  * https://github.com/webpack-contrib/css-loader/blob/master/README.md#modules
59
30
  */
60
- cssLoaderOptions?: CssLoaderOptions;
31
+ cssLoaderOptions?: {
32
+ modules?: Record<string, unknown>;
33
+ } & Record<string, unknown>;
61
34
  /**
62
35
  * The config for `Less`
63
36
  */
@@ -67,6 +40,11 @@ export interface RuleSetLoaderOptions {
67
40
  * @default []
68
41
  */
69
42
  modularImports?: ModularImportOption[];
43
+ /**
44
+ * The value indicates whether runs typescript type checker and linter on separate process.
45
+ * @default true
46
+ */
47
+ runTsChecker?: boolean;
70
48
  /**
71
49
  * The configration options of `postcss-loader`
72
50
  */
@@ -2,11 +2,9 @@ import { type VerifyPackagePattern } from '@armit/package';
2
2
  import { type FlatEvolveCI } from './types-ci.js';
3
3
  import { type FlatEvolveDevServerOptions } from './types-dev-server.js';
4
4
  import { type EvolveEntryMap } from './types-entry-map.js';
5
- import { type GlobalCompilerOptions } from './types-global-compiler-options.js';
6
5
  import { type RuleSetLoaderOptions } from './types-loader-options.js';
7
- import { type EvolveMultiCDNConfig, type EvolveMultiCDNEnvResolver } from './types-multi-html.js';
6
+ import { type EvolveMultiCDNEnvResolver, type EvolveMultiCDNConfig } from './types-multi-html.js';
8
7
  import { type EvolvePluginOptions } from './types-plugin-options.js';
9
- import { type ThreadsOptions } from './types-threads-options.js';
10
8
  import { type FlatEvolveWebpackOptions } from './types-webpack.js';
11
9
  /**
12
10
  * Detect locally installed dependencies that have correctly installed from `package.json` declared version `dependencies`
@@ -46,10 +44,6 @@ export interface FlatEvolveOptions {
46
44
  * The configurations of `webpack`
47
45
  */
48
46
  webpack?: FlatEvolveWebpackOptions;
49
- /**
50
- * The config options of global webpack compiler.
51
- */
52
- globalCompilerOptions?: GlobalCompilerOptions;
53
47
  /**
54
48
  * The config options of all rule set loaders.
55
49
  */
@@ -102,36 +96,27 @@ export interface FlatEvolveOptions {
102
96
  /**
103
97
  * All webpack entries configuration
104
98
  */
105
- entryMap: {
106
- [K in keyof EvolveEntryMap]: Omit<EvolveEntryMap[K], 'groupingSource'>;
107
- };
99
+ entryMap: EvolveEntryMap;
108
100
  /**
109
- * For `production` mode, the value indicates if we interrupt compilation process while received "warnings" while evolve `build`
110
- * @default false
101
+ * Visualize size of webpack output files with an interactive zoomable treemap.
111
102
  */
112
- rejectWarnings?: boolean;
113
- /**
114
- * The faster builds, simplified ci pipeline configurations
115
- */
116
- ci?: FlatEvolveCI;
103
+ analyzer?: Record<string, unknown>;
117
104
  /**
118
- * The configurations of `threads`
105
+ * Maximum number of process to run at once for production build
106
+ * Exact number or a percent of CPUs available (for example "50%").
107
+ *
108
+ * If undefined, then all build processes will start in parallel.
109
+ * Setting this value to 1 will achieve sequential running.
110
+ * @default 5
119
111
  */
120
- threads?: ThreadsOptions;
112
+ maxProcesses?: number | string;
121
113
  /**
122
- * Control whether each entry is built independently.
123
- *
124
- * If `true`, each entry will be built independently.
125
- *
126
- * If `false`, each entries are grouped according to certain rules
127
- *
114
+ * For `production` mode, the value indicates if we interrupt compilation process while received "warnings" while evolve `build`
128
115
  * @default false
129
116
  */
130
- isolation?: boolean;
117
+ rejectWarnings?: boolean;
131
118
  /**
132
- * The maximum size of an entry group.
133
- *
134
- * @default 10
119
+ * The faster builds, simplified ci pipeline configurations
135
120
  */
136
- maxEntryGroupSize?: number;
121
+ ci?: FlatEvolveCI;
137
122
  }
@@ -1,4 +1,4 @@
1
- import { type Configuration, type RuleSetRule } from 'webpack';
1
+ import { type RuleSetRule, type Configuration } from 'webpack';
2
2
  import { type WebpackPlugin } from '../create-webpack/types.js';
3
3
  import { type TerserMinimizerOptions } from '../minimizer/types.js';
4
4
  /**
@@ -62,10 +62,7 @@ export interface FlatEvolveWebpackOptions extends Pick<Configuration, 'performan
62
62
  * @default `terser` minimizer has been enabled fro `production`
63
63
  */
64
64
  minimizer?: false | {
65
- /**
66
- * Allow to disable terser minimizer. or customized terser options.
67
- */
68
- terserOptions?: false | TerserMinimizerOptions;
65
+ terserOptions?: TerserMinimizerOptions;
69
66
  /**
70
67
  * @default false
71
68
  */