@flatjs/evolve 1.7.4 → 1.8.1-next.100

Sign up to get free protection for your applications and to get access to all the features.
Files changed (216) hide show
  1. package/CHANGELOG.md +774 -0
  2. package/LICENSE +21 -0
  3. package/README.md +10 -46
  4. package/dist/constants.d.ts +15 -0
  5. package/dist/constants.js +1 -0
  6. package/dist/create-webpack/create-externals.d.ts +4 -0
  7. package/dist/create-webpack/create-externals.js +1 -0
  8. package/dist/create-webpack/create-optimization.d.ts +3 -0
  9. package/dist/create-webpack/create-optimization.js +1 -0
  10. package/dist/create-webpack/create-output.d.ts +3 -0
  11. package/dist/create-webpack/create-output.js +1 -0
  12. package/dist/create-webpack/create-performance.d.ts +2 -0
  13. package/dist/create-webpack/create-performance.js +1 -0
  14. package/dist/create-webpack/create-plugins.d.ts +4 -0
  15. package/dist/create-webpack/create-plugins.js +1 -0
  16. package/dist/create-webpack/create-resolve.d.ts +2 -0
  17. package/dist/create-webpack/create-resolve.js +1 -0
  18. package/dist/create-webpack/create-rule-sets.d.ts +4 -0
  19. package/dist/create-webpack/create-rule-sets.js +1 -0
  20. package/dist/create-webpack/load-webpack-config.d.ts +10 -0
  21. package/dist/create-webpack/load-webpack-config.js +1 -0
  22. package/dist/create-webpack/rule-sets/constants.d.ts +3 -0
  23. package/dist/create-webpack/rule-sets/constants.js +1 -0
  24. package/dist/create-webpack/rule-sets/rule-assets.d.ts +10 -0
  25. package/dist/create-webpack/rule-sets/rule-assets.js +1 -0
  26. package/dist/create-webpack/rule-sets/rule-css.d.ts +11 -0
  27. package/dist/create-webpack/rule-sets/rule-css.js +1 -0
  28. package/dist/create-webpack/rule-sets/rule-less.d.ts +26 -0
  29. package/dist/create-webpack/rule-sets/rule-less.js +1 -0
  30. package/dist/create-webpack/rule-sets/rule-scripts.d.ts +3 -0
  31. package/dist/create-webpack/rule-sets/rule-scripts.js +1 -0
  32. package/dist/create-webpack/rule-sets/rule-svg-icon.d.ts +6 -0
  33. package/dist/create-webpack/rule-sets/rule-svg-icon.js +1 -0
  34. package/dist/create-webpack/rule-sets/rule-utils.d.ts +7 -0
  35. package/dist/create-webpack/rule-sets/rule-utils.js +1 -0
  36. package/dist/create-webpack/types.d.ts +2 -0
  37. package/dist/create-webpack/types.js +1 -0
  38. package/dist/default-options.d.ts +2 -0
  39. package/dist/default-options.js +1 -0
  40. package/dist/define-config/define-config.d.ts +24 -0
  41. package/dist/define-config/define-config.js +1 -0
  42. package/dist/define-config/index.d.ts +1 -0
  43. package/dist/define-config/index.js +1 -0
  44. package/dist/dev-server/add-compiler-to-dev-server.d.ts +10 -0
  45. package/dist/dev-server/add-compiler-to-dev-server.js +1 -0
  46. package/dist/dev-server/create-app-page-route.d.ts +7 -0
  47. package/dist/dev-server/create-app-page-route.js +1 -0
  48. package/dist/dev-server/create-dev-server-compiler-tasks.d.ts +3 -0
  49. package/dist/dev-server/create-dev-server-compiler-tasks.js +1 -0
  50. package/dist/dev-server/create-dev-server-entries.d.ts +4 -0
  51. package/dist/dev-server/create-dev-server-entries.js +1 -0
  52. package/dist/dev-server/create-dev-server.d.ts +6 -0
  53. package/dist/dev-server/create-dev-server.js +1 -0
  54. package/dist/dev-server/index.d.ts +6 -0
  55. package/dist/dev-server/index.js +1 -0
  56. package/dist/dev-server/middlewares/create-page-middleware.d.ts +37 -0
  57. package/dist/dev-server/middlewares/create-page-middleware.js +1 -0
  58. package/dist/dev-server/middlewares/create-public-assets-middleware.d.ts +2 -0
  59. package/dist/dev-server/middlewares/create-public-assets-middleware.js +1 -0
  60. package/dist/dev-server/middlewares/index.d.ts +2 -0
  61. package/dist/dev-server/middlewares/index.js +1 -0
  62. package/dist/errors/evolve-build-error.d.ts +4 -0
  63. package/dist/errors/evolve-build-error.js +1 -0
  64. package/dist/helpers/allow-px2rem-for-module.d.ts +3 -0
  65. package/dist/helpers/allow-px2rem-for-module.js +1 -0
  66. package/dist/helpers/assert-only-single-entry-item.d.ts +7 -0
  67. package/dist/helpers/assert-only-single-entry-item.js +1 -0
  68. package/dist/helpers/chunk-entry-map.d.ts +7 -0
  69. package/dist/helpers/chunk-entry-map.js +1 -0
  70. package/dist/helpers/enable-bundle-hashname-for-module.d.ts +3 -0
  71. package/dist/helpers/enable-bundle-hashname-for-module.js +1 -0
  72. package/dist/helpers/filter-actived-entries.d.ts +16 -0
  73. package/dist/helpers/filter-actived-entries.js +1 -0
  74. package/dist/helpers/get-bundle-file-name.d.ts +14 -0
  75. package/dist/helpers/get-bundle-file-name.js +1 -0
  76. package/dist/helpers/get-git-root.d.ts +1 -0
  77. package/dist/helpers/get-git-root.js +1 -0
  78. package/dist/helpers/get-html-plugin-config.d.ts +20 -0
  79. package/dist/helpers/get-html-plugin-config.js +1 -0
  80. package/dist/helpers/get-max-process-tasks.d.ts +1 -0
  81. package/dist/helpers/get-max-process-tasks.js +1 -0
  82. package/dist/helpers/get-pacakge-dir.d.ts +1 -0
  83. package/dist/helpers/get-pacakge-dir.js +1 -0
  84. package/dist/helpers/index.d.ts +17 -0
  85. package/dist/helpers/index.js +1 -0
  86. package/dist/helpers/json-serializer.d.ts +7 -0
  87. package/dist/helpers/json-serializer.js +1 -0
  88. package/dist/helpers/merge-babel-options.d.ts +4 -0
  89. package/dist/helpers/merge-babel-options.js +1 -0
  90. package/dist/helpers/normalize-entry-map.d.ts +15 -0
  91. package/dist/helpers/normalize-entry-map.js +1 -0
  92. package/dist/helpers/normalize-resolve-alias.d.ts +1 -0
  93. package/dist/helpers/normalize-resolve-alias.js +1 -0
  94. package/dist/helpers/open-page.d.ts +7 -0
  95. package/dist/helpers/open-page.js +1 -0
  96. package/dist/helpers/print-log.d.ts +8 -0
  97. package/dist/helpers/print-log.js +1 -0
  98. package/dist/helpers/refresh-evolve-mock-options.d.ts +3 -0
  99. package/dist/helpers/refresh-evolve-mock-options.js +1 -0
  100. package/dist/helpers/resolve-entry-map-input-files.d.ts +8 -0
  101. package/dist/helpers/resolve-entry-map-input-files.js +1 -0
  102. package/dist/helpers/script-injects.d.ts +11 -0
  103. package/dist/helpers/script-injects.js +1 -0
  104. package/dist/helpers/should-enable-react-fast-refresh.d.ts +3 -0
  105. package/dist/helpers/should-enable-react-fast-refresh.js +1 -0
  106. package/dist/helpers/split-to-multi-compiler.d.ts +8 -0
  107. package/dist/helpers/split-to-multi-compiler.js +1 -0
  108. package/dist/index.d.ts +5 -0
  109. package/dist/index.js +1 -0
  110. package/dist/load-config/index.d.ts +1 -0
  111. package/dist/load-config/index.js +1 -0
  112. package/dist/load-config/load-evolve-config.d.ts +11 -0
  113. package/dist/load-config/load-evolve-config.js +1 -0
  114. package/dist/loaders/loader-icon.cjs +33 -0
  115. package/dist/loaders/loader-icon.d.cts +1 -0
  116. package/dist/main/env-verify.d.ts +2 -0
  117. package/dist/main/env-verify.js +1 -0
  118. package/dist/main/get-worker-path.d.ts +1 -0
  119. package/dist/main/get-worker-path.js +1 -0
  120. package/dist/main/index.d.ts +4 -0
  121. package/dist/main/index.js +1 -0
  122. package/dist/main/prepare-build.d.ts +9 -0
  123. package/dist/main/prepare-build.js +1 -0
  124. package/dist/main/prepare-serve.d.ts +9 -0
  125. package/dist/main/prepare-serve.js +1 -0
  126. package/dist/main/prepare-static.d.ts +7 -0
  127. package/dist/main/prepare-static.js +1 -0
  128. package/dist/main/start-build-dynamic.d.ts +20 -0
  129. package/dist/main/start-build-dynamic.js +1 -0
  130. package/dist/main/start-build-worker.d.ts +12 -0
  131. package/dist/main/start-build-worker.js +1 -0
  132. package/dist/main/start-build.d.ts +5 -0
  133. package/dist/main/start-build.js +1 -0
  134. package/dist/main/start-one-entry-build.d.ts +13 -0
  135. package/dist/main/start-one-entry-build.js +1 -0
  136. package/dist/main/start-serve.d.ts +11 -0
  137. package/dist/main/start-serve.js +1 -0
  138. package/dist/main/start-static.d.ts +10 -0
  139. package/dist/main/start-static.js +1 -0
  140. package/dist/minimizer/create-minimizers.d.ts +3 -0
  141. package/dist/minimizer/create-minimizers.js +1 -0
  142. package/dist/minimizer/default-options.d.ts +2 -0
  143. package/dist/minimizer/default-options.js +1 -0
  144. package/dist/minimizer/image-minimizer.d.ts +16 -0
  145. package/dist/minimizer/image-minimizer.js +1 -0
  146. package/dist/minimizer/index.d.ts +1 -0
  147. package/dist/minimizer/index.js +1 -0
  148. package/dist/minimizer/terser-minimizer.d.ts +6 -0
  149. package/dist/minimizer/terser-minimizer.js +3 -0
  150. package/dist/minimizer/types.d.ts +2 -0
  151. package/dist/minimizer/types.js +1 -0
  152. package/dist/plugins/circular-dependency/circular-dependency-plugin.d.ts +54 -0
  153. package/dist/plugins/circular-dependency/circular-dependency-plugin.js +1 -0
  154. package/dist/plugins/circular-dependency/index.d.ts +7 -0
  155. package/dist/plugins/circular-dependency/index.js +1 -0
  156. package/dist/plugins/clean-webpack/clean-webpack-plugin.d.ts +67 -0
  157. package/dist/plugins/clean-webpack/clean-webpack-plugin.js +1 -0
  158. package/dist/plugins/clean-webpack/index.d.ts +9 -0
  159. package/dist/plugins/clean-webpack/index.js +1 -0
  160. package/dist/plugins/define-variable/define-variable-plugin.d.ts +14 -0
  161. package/dist/plugins/define-variable/define-variable-plugin.js +1 -0
  162. package/dist/plugins/define-variable/index.d.ts +1 -0
  163. package/dist/plugins/define-variable/index.js +1 -0
  164. package/dist/plugins/html-inject-scripts/plugin-html-inject-script.d.ts +8 -0
  165. package/dist/plugins/html-inject-scripts/plugin-html-inject-script.js +1 -0
  166. package/dist/plugins/module-federation/external-template-remotes.d.ts +4 -0
  167. package/dist/plugins/module-federation/external-template-remotes.js +1 -0
  168. package/dist/plugins/module-federation/index.d.ts +1 -0
  169. package/dist/plugins/module-federation/index.js +1 -0
  170. package/dist/plugins/module-federation/module-federation.d.ts +4 -0
  171. package/dist/plugins/module-federation/module-federation.js +1 -0
  172. package/dist/plugins/multi-html/index.d.ts +4 -0
  173. package/dist/plugins/multi-html/index.js +1 -0
  174. package/dist/plugins/multi-html/multi-html-cdn-plugin.d.ts +17 -0
  175. package/dist/plugins/multi-html/multi-html-cdn-plugin.js +1 -0
  176. package/dist/plugins/multi-html/multi-html-plugin.d.ts +11 -0
  177. package/dist/plugins/multi-html/multi-html-plugin.js +1 -0
  178. package/dist/types/index.d.ts +8 -0
  179. package/dist/types/index.js +1 -0
  180. package/dist/types/types-ci.d.ts +23 -0
  181. package/dist/types/types-ci.js +1 -0
  182. package/dist/types/types-dev-server.d.ts +65 -0
  183. package/dist/types/types-dev-server.js +1 -0
  184. package/dist/types/types-entry-map.d.ts +71 -0
  185. package/dist/types/types-entry-map.js +1 -0
  186. package/dist/types/types-federation.d.ts +120 -0
  187. package/dist/types/types-federation.js +1 -0
  188. package/dist/types/types-loader-options.d.ts +76 -0
  189. package/dist/types/types-loader-options.js +1 -0
  190. package/dist/types/types-modular-import.d.ts +38 -0
  191. package/dist/types/types-modular-import.js +1 -0
  192. package/dist/types/types-multi-html.d.ts +75 -0
  193. package/dist/types/types-multi-html.js +1 -0
  194. package/dist/types/types-options.d.ts +117 -0
  195. package/dist/types/types-options.js +1 -0
  196. package/dist/types/types-plugin-options.d.ts +7 -0
  197. package/dist/types/types-plugin-options.js +1 -0
  198. package/dist/types/types-webpack.d.ts +96 -0
  199. package/dist/types/types-webpack.js +1 -0
  200. package/index.js +1 -4
  201. package/package.json +118 -61
  202. package/templates/html-plugin/index-dev.html +23 -46
  203. package/templates/html-plugin/index-inte.html +23 -46
  204. package/templates/html-plugin/index-inte2.html +23 -46
  205. package/templates/html-plugin/index-inte3.html +23 -46
  206. package/templates/html-plugin/index-inte4.html +23 -46
  207. package/templates/html-plugin/index-me.html +23 -46
  208. package/templates/html-plugin/index-prod.html +23 -46
  209. package/templates/html-plugin/index-rc.html +22 -46
  210. package/templates/html-plugin/index-uat.html +23 -46
  211. package/templates/main.html +2 -2
  212. package/templates/module-404.html +4 -2
  213. package/templates/module.html +31 -61
  214. package/cjs/index.js +0 -4
  215. package/cjs/loader-icon.js +0 -2
  216. package/index.d.ts +0 -721
@@ -0,0 +1 @@
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:!0,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)}))}}
@@ -0,0 +1,7 @@
1
+ import { type WebpackPlugin } from '../../create-webpack/types.js';
2
+ import { type FlatEvolveOptions } from '../../types/types-options.js';
3
+ /**
4
+ * Detect modules with circular dependencies when bundling with webpack for `development` mode.
5
+ * @returns
6
+ */
7
+ export declare const createCircularDependencyPlugin: (serveMode: boolean, evolveOptions: FlatEvolveOptions) => WebpackPlugin[];
@@ -0,0 +1 @@
1
+ import{CircularDependencyPlugin}from"./circular-dependency-plugin.js";export const createCircularDependencyPlugin=(e,n)=>e?[new CircularDependencyPlugin({projectCwd:n.projectCwd})]:[];
@@ -0,0 +1,67 @@
1
+ import { type Compilation, type Compiler, type Stats } from 'webpack';
2
+ export interface Options {
3
+ /**
4
+ * The project root.
5
+ */
6
+ projectCwd?: string;
7
+ /**
8
+ * Write Logs to Console
9
+ * (Always enabled when dry is true)
10
+ *
11
+ * default: false
12
+ */
13
+ verbose?: boolean;
14
+ /**
15
+ * Automatically remove all unused webpack assets on rebuild
16
+ *
17
+ * default: true
18
+ */
19
+ cleanStaleWebpackAssets?: boolean;
20
+ /**
21
+ * Do not allow removal of current webpack assets
22
+ *
23
+ * default: true
24
+ */
25
+ protectWebpackAssets?: boolean;
26
+ /**
27
+ * Removes files once prior to Webpack compilation
28
+ * Not included in rebuilds (watch mode)
29
+ *
30
+ * Use !negative patterns to exclude files
31
+ *
32
+ * default: ['**\/*']
33
+ */
34
+ cleanOnceBeforeBuildPatterns?: string[];
35
+ /**
36
+ * Removes files after every build (including watch mode) that match this pattern.
37
+ * Used for files that are not created directly by Webpack.
38
+ *
39
+ * Use !negative patterns to exclude files
40
+ *
41
+ * default: []
42
+ */
43
+ cleanAfterEveryBuildPatterns?: string[];
44
+ }
45
+ export declare class CleanWebpackPlugin {
46
+ private readonly verbose;
47
+ private readonly cleanStaleWebpackAssets;
48
+ private readonly protectWebpackAssets;
49
+ private readonly cleanAfterEveryBuildPatterns;
50
+ private readonly cleanOnceBeforeBuildPatterns;
51
+ private currentAssets;
52
+ private initialClean;
53
+ private outputPath;
54
+ private projectCwd;
55
+ constructor(options?: Options);
56
+ apply(compiler: Compiler): void;
57
+ /**
58
+ * Initially remove files from output directory prior to build.
59
+ *
60
+ * Only happens once.
61
+ *
62
+ * Warning: It is recommended to initially clean your build directory outside of webpack to minimize unexpected behavior.
63
+ */
64
+ handleInitial(compilation: Compilation): void;
65
+ handleDone(stats: Stats): void;
66
+ removeFiles(patterns: string[]): void;
67
+ }
@@ -0,0 +1 @@
1
+ import{rmSync}from"node:fs";import{relative}from"node:path";import{fileWalkSync}from"@armit/file-utility";import{logger}from"@flatjs/common";import{moduleName}from"../../constants.js";export class CleanWebpackPlugin{constructor(e={}){this.verbose=!0===e.verbose||!1,this.projectCwd=e.projectCwd||process.cwd(),this.cleanStaleWebpackAssets=!0!==e.cleanStaleWebpackAssets&&!1!==e.cleanStaleWebpackAssets||e.cleanStaleWebpackAssets,this.protectWebpackAssets=!0!==e.protectWebpackAssets&&!1!==e.protectWebpackAssets||e.protectWebpackAssets,this.cleanAfterEveryBuildPatterns=Array.isArray(e.cleanAfterEveryBuildPatterns)?e.cleanAfterEveryBuildPatterns:[],this.cleanOnceBeforeBuildPatterns=Array.isArray(e.cleanOnceBeforeBuildPatterns)?e.cleanOnceBeforeBuildPatterns:["**/*"],this.currentAssets=[],this.initialClean=!1,this.outputPath="",this.apply=this.apply.bind(this),this.handleInitial=this.handleInitial.bind(this),this.handleDone=this.handleDone.bind(this),this.removeFiles=this.removeFiles.bind(this)}apply(e){if(!e.options.output||!e.options.output.path)return void logger.warn("clean-webpack-plugin: options.output.path not defined. Plugin disabled...",moduleName);this.outputPath=e.options.output.path;const t=e.hooks;0!==this.cleanOnceBeforeBuildPatterns.length&&t.emit.tap("clean-webpack-plugin",(e=>{this.handleInitial(e)})),t.done.tap("clean-webpack-plugin",(e=>{this.handleDone(e)}))}handleInitial(e){if(this.initialClean)return;e.getStats().hasErrors()||(this.initialClean=!0,this.removeFiles(this.cleanOnceBeforeBuildPatterns))}handleDone(e){if(e.hasErrors())return void(this.verbose&&logger.warn("clean-webpack-plugin: pausing due to webpack errors",moduleName));const t=(e.toJson({assets:!0}).assets||[]).map((e=>e.name)),s=this.currentAssets.filter((e=>!1===t.includes(e)));this.currentAssets=t.sort();const i=[];!0===this.cleanStaleWebpackAssets&&0!==s.length&&i.push(...s),0!==this.cleanAfterEveryBuildPatterns.length&&i.push(...this.cleanAfterEveryBuildPatterns),0!==i.length&&this.removeFiles(i)}removeFiles(e){try{const t=fileWalkSync(e,{absolute:!0,unique:!0,cwd:this.outputPath,dot:!0,ignore:this.protectWebpackAssets?this.currentAssets:[]});for(const e of t)rmSync(e,{force:!0,recursive:!0});this.verbose&&t.forEach((e=>{const t=relative(this.projectCwd,e);logger.debug(`clean-webpack-plugin: removed ${t}`,moduleName)}))}catch(e){if(/Cannot delete files\/folders outside the current working directory\./.test(e.message)){throw new Error("clean-webpack-plugin: Cannot delete files/folders outside the current working directory. Can be overridden with the `dangerouslyAllowCleanPatternsOutsideProject` option.")}throw e}}}
@@ -0,0 +1,9 @@
1
+ import { type WebpackPlugin } from '../../create-webpack/types.js';
2
+ import { type EntryMapItem } from '../../types/types-entry-map.js';
3
+ import { type FlatEvolveOptions } from '../../types/types-options.js';
4
+ /**
5
+ * Cleaning up the /dist folder for `production` build
6
+ * @param singleEntryItem
7
+ * @returns
8
+ */
9
+ export declare const createCleanWebpackPlugin: (serveMode: boolean, entryMapItem: EntryMapItem, evolveOptions: FlatEvolveOptions) => WebpackPlugin[];
@@ -0,0 +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:[`${join(ensureSlash(n[0],!0),"**/*")}`]})];
@@ -0,0 +1,14 @@
1
+ import { type WebpackPlugin } from '../../create-webpack/types.js';
2
+ import { type FlatEvolveOptions } from '../../types/types-options.js';
3
+ /**
4
+ * The DefinePlugin replaces variables in your code with other values or expressions at compile time.
5
+ * ```ts
6
+ * `__SENTRY_DEBUG__`
7
+ * `process.env.FLAT_BUILD_DATE`
8
+ * `process.env.FLAT_COMMIT_HASH`
9
+ * `process.env.FLAT_BRANCH_NAME`
10
+ * `process.env.FLAT_RELEASE_VERSION`
11
+ * ```
12
+ * @returns
13
+ */
14
+ export declare const createBuiltinDefineVariables: (serveMode: boolean, evolveOptions: FlatEvolveOptions) => Promise<WebpackPlugin[]>;
@@ -0,0 +1 @@
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})]};
@@ -0,0 +1 @@
1
+ export * from './define-variable-plugin.js';
@@ -0,0 +1 @@
1
+ export*from"./define-variable-plugin.js";
@@ -0,0 +1,8 @@
1
+ import type { HtmlTagObject } from 'html-webpack-plugin';
2
+ import type { Compiler, WebpackPluginInstance } from 'webpack';
3
+ export declare class HtmlInjectScriptPlugin implements WebpackPluginInstance {
4
+ scripts: string[];
5
+ constructor(scripts?: string[]);
6
+ processScripts(): HtmlTagObject[];
7
+ apply(compiler: Compiler): void;
8
+ }
@@ -0,0 +1 @@
1
+ import htmlWebpackPlugin from"html-webpack-plugin";const PLUGIN_PREFIX="HtmlInjectScriptPlugin";export class HtmlInjectScriptPlugin{constructor(t){this.scripts=t||[]}processScripts(){return this.scripts.filter(Boolean).map((t=>({tagName:"script",innerHTML:t,voidTag:!1,attributes:{},meta:{plugin:"html-inject-script-webpack-plugin"}})))}apply(t){t.hooks.compilation.tap(`${PLUGIN_PREFIX}_compilation`,(t=>{htmlWebpackPlugin.getHooks(t).alterAssetTags.tap(`${PLUGIN_PREFIX}_alterAssetTags`,(t=>(t.assetTags.scripts.unshift(...this.processScripts()),t)))}))}}
@@ -0,0 +1,4 @@
1
+ import { type Compiler } from 'webpack';
2
+ export declare class ExternalTemplateRemotesPlugin {
3
+ apply(compiler: Compiler): void;
4
+ }
@@ -0,0 +1 @@
1
+ import webpackSources from"webpack-sources";const PLUGIN_NAME="ExternalTemplateRemotesPlugin",isExternalModule=e=>"ExternalModule"===e.constructor.name;function extractUrlAndGlobal(e){const t=e.indexOf("@");if(t<=0||t===e.length-1)throw new Error(`Invalid request "${e}"`);return[e.substring(t+1),e.substring(0,t)]}export class ExternalTemplateRemotesPlugin{apply(e){e.hooks.make.tap(PLUGIN_NAME,(e=>{const t=[];e.hooks.buildModule.tap(PLUGIN_NAME,(e=>{isExternalModule(e)&&"script"===e.externalType&&t.push(e)})),e.hooks.afterCodeGeneration.tap(PLUGIN_NAME,(()=>{t.forEach((t=>{const o=extractUrlAndGlobal(t.request)[0],n=toExpression(o),r=e.codeGenerationResults.get(t,void 0).sources,s=r.get("javascript");if(s){const e=new webpackSources.RawSource(s.source().toString().replace(`"${o}"`,n));r.set("javascript",e)}}))}))}))}}function toExpression(e){const t=[],o=[];let n=!1,r=!1;for(const s of e)if("["===s){if(n){r=!0;break}n=!0,o.length&&(t.push(`"${o.join("")}"`),o.length=0)}else if("]"===s){if(!n){r=!0;break}n=!1,o.length&&(t.push(`${o.join("")}`),o.length=0),o.length=0}else o.push(s);if(n||r)throw new Error(`Invalid template URL "${e}"`);return o.length&&t.push(`"${o.join("")}"`),t.join(" + ")}
@@ -0,0 +1 @@
1
+ export * from './module-federation.js';
@@ -0,0 +1 @@
1
+ export*from"./module-federation.js";
@@ -0,0 +1,4 @@
1
+ import { type WebpackPluginInstance } from 'webpack';
2
+ import { type EntryMapItem } from '../../types/types-entry-map.js';
3
+ import { type FlatEvolveOptions } from '../../types/types-options.js';
4
+ export declare const createModuleFederationPlugin: (serveMode: boolean, entryMapItem: EntryMapItem, evolveOptions: FlatEvolveOptions) => WebpackPluginInstance[];
@@ -0,0 +1 @@
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({name:c,filename:p,remotes:d,exposes:u,...i}),new ExternalTemplateRemotesPlugin),e||s.unshift(new HtmlInjectScriptPlugin([injectFederationScripts(m,a)]))}return s};
@@ -0,0 +1,4 @@
1
+ import { type WebpackPlugin } from '../../create-webpack/types.js';
2
+ import { type EntryMapItem } from '../../types/types-entry-map.js';
3
+ import { type FlatEvolveOptions } from '../../types/types-options.js';
4
+ export declare const createHtmlPlugins: (serveMode: boolean, entryMapItem: EntryMapItem, evolveOptions: FlatEvolveOptions) => WebpackPlugin[];
@@ -0,0 +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=[];if(t)return i;const n=Object.keys(u.multiHtmlCdn);return i.push(...createMultiHtmlWebpackPlugin(t,u,l,n)),i.push(new FlatEvolveMultiCdnPlugin(u)),i};
@@ -0,0 +1,17 @@
1
+ import { type Compiler } from 'webpack';
2
+ import { type FlatEvolveOptions } from '../../types/index.js';
3
+ export declare class FlatEvolveMultiCdnPlugin {
4
+ private pluginName;
5
+ private requireFn;
6
+ private config;
7
+ private cdnResolver;
8
+ constructor(evolveOptions: FlatEvolveOptions);
9
+ /**
10
+ * Apply the plugin to check if there are non initial chunks which need to be imported using `require-ensure` or `import`
11
+ * https://github.com/webpack/webpack/blob/3d653290fafe385277b48e5a36807124618b9561/lib/MainTemplate.js#L158
12
+ * https://www.npmjs.com/package/vscode-webpack-debugger
13
+ * https://www.cnblogs.com/Scar007/p/9166068.html
14
+ * https://www.cnblogs.com/pluslius/p/10271537.html
15
+ */
16
+ apply(compiler: Compiler): void;
17
+ }
@@ -0,0 +1 @@
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}))}))}}
@@ -0,0 +1,11 @@
1
+ import { type WebpackPlugin } from '../../create-webpack/types.js';
2
+ import { type EntryMapItem } from '../../types/types-entry-map.js';
3
+ import { type EvolveMultiCdnEnvType } from '../../types/types-multi-html.js';
4
+ import { type FlatEvolveOptions } from '../../types/types-options.js';
5
+ /**
6
+ * Create `html-webpack-plugin` for this build, refer to best practices
7
+ * We'd better pass only one entry for each `build` cycle
8
+ * @param buildEntryItem the entries for this `build`
9
+ * @param allEnv
10
+ */
11
+ export declare const createMultiHtmlWebpackPlugin: (serveMode: boolean, evolveOptions: FlatEvolveOptions, entryMapItem: EntryMapItem, allEnv: Array<EvolveMultiCdnEnvType>) => WebpackPlugin[];
@@ -0,0 +1 @@
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};
@@ -0,0 +1,8 @@
1
+ export * from './types-dev-server.js';
2
+ export * from './types-entry-map.js';
3
+ export * from './types-federation.js';
4
+ export * from './types-modular-import.js';
5
+ export * from './types-multi-html.js';
6
+ export * from './types-options.js';
7
+ export * from './types-loader-options.js';
8
+ export * from './types-webpack.js';
@@ -0,0 +1 @@
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";
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The CI pipeline execute `priority` as below
3
+ * 1. Fixed module build depends on config : `fixedBuildModules` of `flatjs-evolve.config.ts`
4
+ * 2. Dynamic build depends on commits (`flat build evolve --commits=""`)
5
+ * 3. Normally build manually using (`flat build evolve -m "a;b"`)
6
+ */
7
+ export type FlatEvolveCI = {
8
+ /**
9
+ * The build module patterns, `Highest Priority First`
10
+ * Support "a;b;c" RegExp pattern; `new RegExp(`${pattern}`).test(entryKey)`
11
+ */
12
+ fixedBuildModules?: string[];
13
+ /**
14
+ * Dynamic build depends on persistent `branch`, e.g. `main`,`master`,`release`
15
+ * @default `origin/master`
16
+ */
17
+ basedBranch: string;
18
+ /**
19
+ * The release version will setup to `process.env.FLAT_RELEASE_VERSION`
20
+ * @default ''
21
+ */
22
+ releaseVersion?: string;
23
+ };
@@ -0,0 +1 @@
1
+ export{};
@@ -0,0 +1,65 @@
1
+ import { type SecureContextHttps, type FlatMockOptions } from '@flatjs/mock';
2
+ import { type RequestHandler } from 'express';
3
+ import { type Configuration } from 'webpack';
4
+ import { type ClientConfiguration } from 'webpack-dev-server';
5
+ import { type EvolveEntryMapContent } from './types-entry-map.js';
6
+ export interface WebpackWatchOptions {
7
+ /**
8
+ * Delay the rebuilt after the first change. Value is a time in ms.
9
+ */
10
+ aggregateTimeout?: number;
11
+ /**
12
+ * Resolve symlinks and watch symlink and real file. This is usually not needed as webpack already resolves symlinks ('resolve.symlinks').
13
+ */
14
+ followSymlinks?: boolean;
15
+ /**
16
+ * Ignore some files from watching (glob pattern or regexp).
17
+ */
18
+ ignored?: string | RegExp | string[];
19
+ /**
20
+ * Enable polling mode for watching.
21
+ */
22
+ poll?: number | boolean;
23
+ }
24
+ export type FlatEvolveDevServerOptions = {
25
+ /**
26
+ * Allow us provider customized middlewares for `page`, `modules`
27
+ */
28
+ middlewares?: RequestHandler[];
29
+ /**
30
+ * Turn on watch mode. This means that after the initial build, webpack will continue to watch for changes in any of the resolved files.
31
+ * In webpack-dev-server watch mode is enabled by default.
32
+ * This configuration will be merged into `webpack-dev-server`
33
+ */
34
+ watchOptions?: Configuration['watchOptions'];
35
+ /**
36
+ * Allow us costomized global serve data injected into `window.GLOBAL = {...globalData}`
37
+ */
38
+ defaultServeGlobalData?: (entryItem: EvolveEntryMapContent, hostUrl: string) => Promise<Record<string, unknown>> | Record<string, unknown>;
39
+ /**
40
+ * The value indicates if we will auto open broswers page for `serve`
41
+ * @default true
42
+ */
43
+ autoOpen?: boolean;
44
+ /**
45
+ * Enables reload/refresh the page(s) when file changes are detected (`auto` by default).
46
+ * @default undefined
47
+ */
48
+ liveReload?: true;
49
+ /**
50
+ * Enables a full-screen overlay in the browser when there are compiler errors or warnings.
51
+ * @default {
52
+ * errors: true,
53
+ * warnings: false,
54
+ * }
55
+ */
56
+ clientOverlay?: ClientConfiguration['overlay'];
57
+ /**
58
+ * The customized config options of `flatjs/mock`, it will override options `flatjs-mock.config.ts`
59
+ */
60
+ mockOptions?: Omit<FlatMockOptions, 'projectCwd'>;
61
+ /**
62
+ * Provide your own certificate using the https option
63
+ */
64
+ https?: SecureContextHttps;
65
+ };
@@ -0,0 +1 @@
1
+ export{};
@@ -0,0 +1,71 @@
1
+ import { type ModuleFederationOptions } from './types-federation.js';
2
+ import { type MultiHtmlCDNEntryItem } from './types-multi-html.js';
3
+ /**
4
+ * The configuration options for each entry item.
5
+ */
6
+ export interface EvolveEntryItemOption extends MultiHtmlCDNEntryItem {
7
+ /**
8
+ * The value indicates if we need to Px convert to rem.
9
+ * @default entryItemOption?.allowPx2rem ?? pluginLoaderOptions?.pixelOptions?.enabled
10
+ */
11
+ allowPx2rem?: boolean;
12
+ /**
13
+ * Specify dependencies that shouldn't be resolved by webpack, but should become dependencies of the resulting bundle. The kind of the dependency depends on `output.libraryTarget`.
14
+ * Note It will merged with globall externals configuration and apply for current entry compiler
15
+ */
16
+ externals?: Record<string, string>;
17
+ /**
18
+ * If all we use `contenthash` bundle name.
19
+ * @default true
20
+ */
21
+ enableBundleHashName?: boolean;
22
+ /**
23
+ * Allow customized module `link` on `/pages`
24
+ * @default undefined
25
+ */
26
+ servePageMainLinkFn?: (link: string, options: {
27
+ entryName: string;
28
+ hostUri: string;
29
+ virtualPath: string;
30
+ }) => string;
31
+ /**
32
+ * For `serve`
33
+ * Customized module template to proxy the modules template.
34
+ * If providered, it must be an absolute path. path.join(__dirname, `templates/module.html`)
35
+ * Normally it will find file `${projectCwd}/templates/module.html` automatically
36
+ */
37
+ serveModuleTemplate?: string;
38
+ /**
39
+ * For `serve`
40
+ * Attach fixed global data for specificed entry.
41
+ * Will merged into `window.GLOBAL = {...globalData}`
42
+ * @default {}
43
+ */
44
+ serveGlobalData?: Record<string, unknown>;
45
+ /**
46
+ * Multiple separate builds should form a single application.
47
+ * This is often known as Micro-Frontends, but is not limited to that.
48
+ */
49
+ moduleFederation?: ModuleFederationOptions;
50
+ /**
51
+ * The value indicates if we need to build relative asset public path?
52
+ * @default false
53
+ */
54
+ useRelativeAssetPath?: boolean;
55
+ /**
56
+ * The filter will try filter which mock defs files will be loaded for this `entryItem` while `serve`.
57
+ * @default undefined
58
+ */
59
+ mockFilters?: Array<string | RegExp>;
60
+ }
61
+ export type EvolveEntryMapContent = {
62
+ entry: [string, ...string[]];
63
+ options?: EvolveEntryItemOption;
64
+ };
65
+ export interface EvolveEntryMap {
66
+ /**
67
+ * <entryChunkName>: {}
68
+ */
69
+ [entryName: string]: EvolveEntryMapContent;
70
+ }
71
+ export type EntryMapItem = [string, EvolveEntryMapContent];
@@ -0,0 +1 @@
1
+ export{};
@@ -0,0 +1,120 @@
1
+ import { type LibraryOptions } from 'webpack';
2
+ /**
3
+ * Advanced configuration for modules that should be shared in the share scope.
4
+ */
5
+ interface SharedConfig {
6
+ /**
7
+ * Include the provided and fallback module directly instead behind an async request. This allows to use this shared module in initial load too. All possible shared modules need to be eager too.
8
+ */
9
+ eager?: boolean;
10
+ /**
11
+ * Provided module that should be provided to share scope. Also acts as fallback module if no shared module is found in share scope or version isn't valid. Defaults to the property name.
12
+ */
13
+ import?: string | false;
14
+ /**
15
+ * Package name to determine required version from description file. This is only needed when package name can't be automatically determined from request.
16
+ */
17
+ packageName?: string;
18
+ /**
19
+ * Version requirement from module in share scope.
20
+ */
21
+ requiredVersion?: string | false;
22
+ /**
23
+ * Module is looked up under this key from the share scope.
24
+ */
25
+ shareKey?: string;
26
+ /**
27
+ * Share scope name.
28
+ */
29
+ shareScope?: string;
30
+ /**
31
+ * Allow only a single version of the shared module in share scope (disabled by default).
32
+ */
33
+ singleton?: boolean;
34
+ /**
35
+ * Do not accept shared module if version is not valid (defaults to yes, if local fallback module is available and shared module is not a singleton, otherwise no, has no effect if there is no required version specified).
36
+ */
37
+ strictVersion?: boolean;
38
+ /**
39
+ * Version of the provided module. Will replace lower matching versions, but not higher.
40
+ */
41
+ version?: string | false;
42
+ }
43
+ interface SharedObject {
44
+ [index: string]: string | SharedConfig;
45
+ }
46
+ /**
47
+ * Advanced configuration for modules that should be exposed by this container.
48
+ */
49
+ export interface ExposesConfig {
50
+ /**
51
+ * Request to a module that should be exposed by this container.
52
+ * @example `import: './src/home/widget.tsx'`
53
+ */
54
+ import: string | string[];
55
+ /**
56
+ * Custom chunk name for the exposed module.
57
+ * Do not include `normalizedEntryName` e.g.(`flatjs/evolve/home`)
58
+ * @example `exposed-micro-module-home-widget` => `flatjs/evolve/home/exposed-micro-module-home-widget`
59
+ */
60
+ name: string;
61
+ }
62
+ /**
63
+ * Modules that should be exposed by this container. Property names are used as public paths.
64
+ */
65
+ export interface ExposesObject {
66
+ /**
67
+ * @example `'./Widget': { name, import }`
68
+ */
69
+ [index: string]: ExposesConfig;
70
+ }
71
+ export interface ModuleFederationRemote {
72
+ /**
73
+ * Normally it can be the entryPath like `${projectVirtualPath}/home`
74
+ * it will formatted into `evolve_demo_home`
75
+ * Note: We need to config `declare module 'evolve_demo_home/Widget` in `global.d.ts`;
76
+ * @example `home`
77
+ */
78
+ name: string;
79
+ /**
80
+ * The remote app resouce endpoint base path with prefix of `projectVirtualPath`
81
+ * Normally This is only required when an external project module as remote widget.
82
+ */
83
+ endpoint?: (entryName: string, normalizedEntryName: string) => string;
84
+ }
85
+ /**
86
+ * Multiple separate builds should form a single application.
87
+ * This is often known as Micro-Frontends, but is not limited to that.
88
+ */
89
+ export type ModuleFederationOptions = {
90
+ /**
91
+ * Container locations and request scopes from which modules should be resolved and loaded at runtime. When provided, property name is used as request scope, otherwise request scope is automatically inferred from container location.
92
+ * {`${projectVirtualPath}/home`,`${projectVirtualPath}/mine`}
93
+ */
94
+ remotes?: Array<ModuleFederationRemote>;
95
+ /**
96
+ * Options for library.
97
+ */
98
+ library?: LibraryOptions;
99
+ /**
100
+ * The external type of the remote containers.
101
+ */
102
+ remoteType?: 'import' | 'var' | 'module' | 'assign' | 'this' | 'window' | 'self' | 'global' | 'commonjs' | 'commonjs2' | 'commonjs-module' | 'commonjs-static' | 'amd' | 'amd-require' | 'umd' | 'umd2' | 'jsonp' | 'system' | 'promise' | 'script' | 'node-commonjs';
103
+ /**
104
+ * Modules that should be exposed by this container. When provided, property name is used as public name, otherwise public name is automatically inferred from request.
105
+ */
106
+ exposes?: ExposesObject[] | ExposesObject;
107
+ /**
108
+ * The name of the runtime chunk. If set a runtime chunk with this name is created or an existing entrypoint is used as runtime.
109
+ */
110
+ runtime?: string | false;
111
+ /**
112
+ * Share scope name used for all shared modules (defaults to 'default').
113
+ */
114
+ shareScope?: string;
115
+ /**
116
+ * Modules that should be shared in the share scope. When provided, property names are used to match requested modules in this compilation.
117
+ */
118
+ shared?: (string | SharedObject)[] | SharedObject;
119
+ };
120
+ export {};
@@ -0,0 +1 @@
1
+ export{};
@@ -0,0 +1,76 @@
1
+ import { type TransformOptions } from '@babel/core';
2
+ import { type PostcssPluginPixelOptions } from '@flatjs/forge-postcss-plugin-pixel';
3
+ import { type AcceptedPlugin } from 'postcss';
4
+ import { type ModularImportOption } from './types-modular-import.js';
5
+ export type BabelInputOptions = Pick<TransformOptions, 'presets' | 'plugins'>;
6
+ /**
7
+ * Builtin babel options, provider default `builin` presets.
8
+ * can be override by customized `presets` & `plugins`
9
+ */
10
+ export type BuiltinBabelOptions = BabelInputOptions & {
11
+ /**
12
+ * extra babel `plugins` or `presets`
13
+ * @default `react`
14
+ */
15
+ usePreset?: 'react' | 'vue';
16
+ };
17
+ /**
18
+ * The configurations for `builtin` rule set options
19
+ */
20
+ export interface RuleSetLoaderOptions {
21
+ /**
22
+ * Now webpack will automatically choose between resource and inline by following
23
+ * a default condition: a file with size less than 8kb will be treated as a inline module type and resource module type otherwise.
24
+ * @default `4 * 1024` (4KB)
25
+ */
26
+ assetDataUrlMaxSize?: number;
27
+ /**
28
+ * The configurations of `css-loader`
29
+ */
30
+ cssLoaderOptions?: Record<string, unknown>;
31
+ /**
32
+ * The config for `Less`
33
+ */
34
+ lessOptions?: Record<string, unknown>;
35
+ /**
36
+ * Modular import plugin for babel, compatible with antd, antd-mobile, lodash, material-ui, and so on.
37
+ * https://github.com/ant-design/babel-plugin-import
38
+ * @default []
39
+ */
40
+ modularImports?: ModularImportOption[];
41
+ /**
42
+ * The value indicates whether runs typescript type checker and linter on separate process.
43
+ * @default true
44
+ */
45
+ runTsChecker?: boolean;
46
+ /**
47
+ * The configration options of `postcss-loader`
48
+ */
49
+ postcssOptions?: {
50
+ /**
51
+ * The overrided configurations of `cssnano-preset-default`
52
+ * sometimes we need to disabled some rules for `default cssnano preset`
53
+ * @link https://www.npmjs.com/package/cssnano-preset-default
54
+ * @example
55
+ * Disable `postcss-minify-font-values` rule to avoid transitions from `font-weight:bold` to `font-weight:700`
56
+ * ```json
57
+ * cssnanoOptions: { minifyFontValues: false }
58
+ * ```
59
+ */
60
+ cssnanoOptions?: Record<string, unknown>;
61
+ /**
62
+ * Allow to extends extra plugins of `postcss-loader`
63
+ * @example `['tailwindcss', {}]`
64
+ */
65
+ plugins?: Array<AcceptedPlugin | string | [string, Record<string, unknown>]>;
66
+ };
67
+ /**
68
+ * The babel options for `babel-loader`
69
+ */
70
+ babelOptions?: BuiltinBabelOptions;
71
+ /**
72
+ * The config options fro `@flatjs/forge-postcss-plugin-plugin`
73
+ * If provider it will use default options of `forgePostcssPluginPixel`
74
+ */
75
+ pixelOptions?: false | Partial<PostcssPluginPixelOptions>;
76
+ }
@@ -0,0 +1 @@
1
+ export{};