@flatjs/evolve 2.1.0-next.12 → 2.1.0-next.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. package/dist/compiler/create-global-compiler.d.ts +2 -0
  2. package/dist/compiler/create-global-compiler.js +1 -0
  3. package/dist/constants.js +1 -36
  4. package/dist/create-webpack/create-externals.js +1 -6
  5. package/dist/create-webpack/create-optimization.js +1 -43
  6. package/dist/create-webpack/create-output.js +1 -35
  7. package/dist/create-webpack/create-performance.js +1 -7
  8. package/dist/create-webpack/create-plugins.js +1 -78
  9. package/dist/create-webpack/create-resolve.js +1 -37
  10. package/dist/create-webpack/create-rule-sets.js +1 -20
  11. package/dist/create-webpack/load-watch-options.d.ts +12 -0
  12. package/dist/create-webpack/load-watch-options.js +1 -0
  13. package/dist/create-webpack/load-webpack-config.js +1 -57
  14. package/dist/create-webpack/resolve-public-path.js +1 -15
  15. package/dist/create-webpack/rule-sets/constants.js +1 -3
  16. package/dist/create-webpack/rule-sets/rule-assets.js +1 -52
  17. package/dist/create-webpack/rule-sets/rule-css.js +1 -111
  18. package/dist/create-webpack/rule-sets/rule-less.js +1 -44
  19. package/dist/create-webpack/rule-sets/rule-scripts.d.ts +2 -0
  20. package/dist/create-webpack/rule-sets/rule-scripts.js +1 -34
  21. package/dist/create-webpack/rule-sets/rule-svg-icon.js +1 -25
  22. package/dist/create-webpack/rule-sets/rule-utils.js +1 -10
  23. package/dist/create-webpack/types.d.ts +1 -1
  24. package/dist/create-webpack/types.js +1 -1
  25. package/dist/default-options.js +1 -83
  26. package/dist/define-config/define-config.d.ts +2 -2
  27. package/dist/define-config/define-config.js +1 -4
  28. package/dist/define-config/index.js +1 -1
  29. package/dist/dev-server/add-compiler-to-dev-server.js +1 -58
  30. package/dist/dev-server/create-app-page-route.js +1 -13
  31. package/dist/dev-server/create-dev-server-compiler-task.js +1 -55
  32. package/dist/dev-server/create-dev-server-entries.js +1 -25
  33. package/dist/dev-server/create-dev-server.js +1 -24
  34. package/dist/dev-server/index.d.ts +3 -3
  35. package/dist/dev-server/index.js +1 -6
  36. package/dist/dev-server/middlewares/create-page-middleware.js +1 -33
  37. package/dist/dev-server/middlewares/create-public-assets-middleware.js +1 -25
  38. package/dist/dev-server/middlewares/get-all-sorted-modules.js +1 -24
  39. package/dist/dev-server/middlewares/get-bundle-asset.js +1 -7
  40. package/dist/dev-server/middlewares/get-dev-server-host-uri.js +1 -5
  41. package/dist/dev-server/middlewares/get-hmr-runtime-chunks.js +1 -14
  42. package/dist/dev-server/middlewares/get-normalized-entry-name.js +1 -14
  43. package/dist/dev-server/middlewares/get-page-main-html.js +1 -49
  44. package/dist/dev-server/middlewares/get-page-module-html.js +1 -123
  45. package/dist/dev-server/middlewares/get-project-virtual-path.js +1 -3
  46. package/dist/dev-server/middlewares/get-runtime-manifest.js +1 -25
  47. package/dist/dev-server/middlewares/index.js +1 -2
  48. package/dist/dev-server/middlewares/types.js +1 -1
  49. package/dist/errors/evolve-build-error.js +1 -10
  50. package/dist/helpers/allow-px2rem-for-module.js +1 -6
  51. package/dist/helpers/assert-group-entry-item.js +1 -19
  52. package/dist/helpers/assert-single-compiler.js +1 -45
  53. package/dist/helpers/chunk-entry-map.js +1 -21
  54. package/dist/helpers/delete-object-keys.js +1 -20
  55. package/dist/helpers/enable-bundle-hashname-for-module.js +1 -6
  56. package/dist/helpers/filter-actived-entries.js +1 -42
  57. package/dist/helpers/flat-entry-map.js +1 -11
  58. package/dist/helpers/get-bundle-file-name.js +1 -23
  59. package/dist/helpers/get-git-root.js +1 -4
  60. package/dist/helpers/get-html-plugin-config.js +1 -47
  61. package/dist/helpers/get-max-process-tasks.js +1 -7
  62. package/dist/helpers/get-pacakge-dir.js +1 -13
  63. package/dist/helpers/get-runtime-cdn-base.d.ts +1 -1
  64. package/dist/helpers/get-runtime-cdn-base.js +1 -21
  65. package/dist/helpers/index.d.ts +11 -11
  66. package/dist/helpers/index.js +1 -27
  67. package/dist/helpers/is-deep-equal.js +1 -67
  68. package/dist/helpers/json-serializer.js +1 -52
  69. package/dist/helpers/merge-babel-options.js +1 -45
  70. package/dist/helpers/normalize-check-entry-options.js +1 -28
  71. package/dist/helpers/normalize-entry-map.js +1 -59
  72. package/dist/helpers/normalize-group-name.js +1 -16
  73. package/dist/helpers/normalize-page-proxy.js +1 -9
  74. package/dist/helpers/normalize-resolve-alias.js +1 -7
  75. package/dist/helpers/normalize-template-inject-tokens.js +1 -22
  76. package/dist/helpers/open-page.js +1 -15
  77. package/dist/helpers/print-log.js +1 -49
  78. package/dist/helpers/refresh-evolve-mock-options.js +1 -34
  79. package/dist/helpers/resolve-entry-map-input-files.js +1 -20
  80. package/dist/helpers/script-injects.d.ts +1 -1
  81. package/dist/helpers/script-injects.js +1 -39
  82. package/dist/helpers/should-enable-react-fast-refresh.js +1 -14
  83. package/dist/helpers/split-to-entry-group.d.ts +1 -1
  84. package/dist/helpers/split-to-entry-group.js +1 -139
  85. package/dist/helpers/verify-group-entry-options.js +1 -21
  86. package/dist/index.d.ts +1 -1
  87. package/dist/index.js +1 -5
  88. package/dist/load-config/index.js +1 -1
  89. package/dist/load-config/load-evolve-config.js +1 -41
  90. package/dist/load-config/types.js +1 -1
  91. package/dist/loaders/loader-icon.cjs +2 -1
  92. package/dist/main/create-thread-worker.js +1 -51
  93. package/dist/main/env-verify.js +1 -21
  94. package/dist/main/get-worker-path.js +1 -5
  95. package/dist/main/index.d.ts +1 -1
  96. package/dist/main/index.js +1 -4
  97. package/dist/main/prepare-build.js +1 -39
  98. package/dist/main/prepare-serve.js +1 -69
  99. package/dist/main/prepare-static.js +1 -30
  100. package/dist/main/start-build-dynamic.js +1 -171
  101. package/dist/main/start-build-worker.js +1 -44
  102. package/dist/main/start-build.js +1 -69
  103. package/dist/main/start-group-entry-build.d.ts +1 -1
  104. package/dist/main/start-group-entry-build.js +1 -32
  105. package/dist/main/start-serve.js +1 -34
  106. package/dist/main/start-static.js +1 -19
  107. package/dist/minimizer/create-minimizers.js +1 -25
  108. package/dist/minimizer/default-options.js +1 -14
  109. package/dist/minimizer/image-minimizer.js +1 -65
  110. package/dist/minimizer/index.js +1 -1
  111. package/dist/minimizer/terser-minimizer.js +3 -15
  112. package/dist/minimizer/types.js +1 -1
  113. package/dist/plugins/circular-dependency/circular-dependency-plugin.js +1 -119
  114. package/dist/plugins/circular-dependency/index.js +1 -15
  115. package/dist/plugins/clean-webpack/clean-webpack-plugin.js +1 -173
  116. package/dist/plugins/clean-webpack/index.js +1 -22
  117. package/dist/plugins/define-variable/define-variable-plugin.js +1 -28
  118. package/dist/plugins/define-variable/index.js +1 -1
  119. package/dist/plugins/html-inject-scripts/plugin-html-inject-script.js +1 -27
  120. package/dist/plugins/module-federation/external-template-remotes.js +1 -92
  121. package/dist/plugins/module-federation/index.js +1 -1
  122. package/dist/plugins/module-federation/module-federation.js +1 -100
  123. package/dist/plugins/multi-html/index.js +1 -16
  124. package/dist/plugins/multi-html/multi-html-cdn-plugin.js +1 -83
  125. package/dist/plugins/multi-html/multi-html-plugin.js +1 -65
  126. package/dist/plugins/ts-checker/ts-checker-guard-plugin.d.ts +13 -0
  127. package/dist/plugins/ts-checker/ts-checker-guard-plugin.js +1 -0
  128. package/dist/plugins/ts-checker/ts-checker-plugin.d.ts +1 -2
  129. package/dist/plugins/ts-checker/ts-checker-plugin.js +1 -24
  130. package/dist/types/index.d.ts +2 -1
  131. package/dist/types/index.js +1 -8
  132. package/dist/types/types-ci.js +1 -1
  133. package/dist/types/types-dev-server.d.ts +5 -6
  134. package/dist/types/types-dev-server.js +1 -1
  135. package/dist/types/types-entry-map.js +1 -1
  136. package/dist/types/types-federation.js +1 -1
  137. package/dist/types/types-global-compiler-options.d.ts +7 -0
  138. package/dist/types/types-global-compiler-options.js +1 -0
  139. package/dist/types/types-loader-options.d.ts +2 -7
  140. package/dist/types/types-loader-options.js +1 -1
  141. package/dist/types/types-modular-import.js +1 -1
  142. package/dist/types/types-multi-html.js +1 -1
  143. package/dist/types/types-options.d.ts +6 -1
  144. package/dist/types/types-options.js +1 -1
  145. package/dist/types/types-plugin-options.js +1 -1
  146. package/dist/types/types-threads-options.js +1 -1
  147. package/dist/types/types-webpack.d.ts +1 -1
  148. package/dist/types/types-webpack.js +1 -1
  149. package/package.json +30 -32
  150. package/dist/plugins/ts-checker/index.d.ts +0 -1
  151. package/dist/plugins/ts-checker/index.js +0 -1
@@ -1,83 +1 @@
1
- import { basename } from 'node:path';
2
- import HtmlWebpackPlugin from 'html-webpack-plugin';
3
- import webpack from 'webpack';
4
- import { getRuntimeCDNBase } from '../../helpers/get-runtime-cdn-base.js';
5
- import { findEnvCdn, httpUrlJoin } from '../../helpers/script-injects.js';
6
- export class FlatEvolveMultiCdnPlugin {
7
- constructor(evolveOptions) {
8
- this.pluginName = 'FlatEvolveMultiCdnPlugin';
9
- // https://github.com/webpack/webpack/blob/3d653290fafe385277b48e5a36807124618b9561/lib/MainTemplate.js#L12
10
- // the bundle public path RuntimeGlobals.publicPath: '__webpack_require__.p';
11
- this.requireFn = webpack.RuntimeGlobals.publicPath;
12
- this.config = evolveOptions.multiHtmlCdn;
13
- this.cdnResolver =
14
- evolveOptions.multiHtmlCdnEnvResolver ||
15
- function cdnResolver() {
16
- return undefined;
17
- };
18
- // Make sure we have `prod` configuration for each cdn node at least.
19
- if (!this.config?.prod) {
20
- throw new Error('We must setup `prod` for each CDN config node!');
21
- }
22
- }
23
- /**
24
- * Apply the plugin to check if there are non initial chunks which need to be imported using `require-ensure` or `import`
25
- * https://github.com/webpack/webpack/blob/3d653290fafe385277b48e5a36807124618b9561/lib/MainTemplate.js#L158
26
- * https://www.npmjs.com/package/vscode-webpack-debugger
27
- * https://www.cnblogs.com/Scar007/p/9166068.html
28
- * https://www.cnblogs.com/pluslius/p/10271537.html
29
- */
30
- apply(compiler) {
31
- // Handle chunk assets while `Compilation:before-chunk-assets`
32
- // https://github.com/webpack/webpack/blob/3d653290fafe385277b48e5a36807124618b9561/lib/MainTemplate.js#L58
33
- compiler.hooks.thisCompilation.tap(this.pluginName, (compilation) => {
34
- compilation.mainTemplate.hooks.requireExtensions.tap(this.pluginName, (_source, chunk) => {
35
- const buf = [];
36
- buf.push('// Dynamic assets path override(`@flatjs/evolve`) plugin-multi-html-cdn`)');
37
- const runtimeRequirements = compilation.chunkGraph?.getTreeRuntimeRequirements(chunk);
38
- if (runtimeRequirements &&
39
- runtimeRequirements.has(webpack.RuntimeGlobals.requireScope)) {
40
- buf.push(webpack.Template.indent(getRuntimeCDNBase(this.config, this.cdnResolver, this.requireFn)));
41
- }
42
- return webpack.Template.asString(buf);
43
- });
44
- });
45
- // Using html webpack plugin hooks to replace `scripts` `styles` before inject to html temlate file.
46
- compiler.hooks.compilation.tap(this.pluginName, (compilation) => {
47
- HtmlWebpackPlugin.getHooks(compilation).beforeAssetTagGeneration.tap(this.pluginName, (data) => {
48
- const { assets, plugin, outputName } = data;
49
- const chunks = plugin?.options?.chunks || [];
50
- const currentChunk = Array.isArray(chunks)
51
- ? chunks.find((chunk) => outputName.includes(chunk))
52
- : chunks;
53
- const { userOptions } = data.plugin;
54
- if (!currentChunk) {
55
- throw new Error('We must have current chunk!');
56
- }
57
- const assertJsList = assets.js.filter((jsPath) => jsPath.includes(currentChunk));
58
- const assertCssList = assets.css.filter((jsPath) => jsPath.includes(currentChunk));
59
- const multiCdn = userOptions.multiCdn;
60
- const publicPath = assets.publicPath;
61
- const scripts = assertJsList.map((scriptItem) => {
62
- // Normally for `index-dev.html` we need to use relative path.
63
- if (multiCdn.disabled) {
64
- return basename(scriptItem);
65
- }
66
- const randomCdn = findEnvCdn(this.config, multiCdn.env);
67
- return httpUrlJoin(randomCdn, scriptItem.replace(publicPath, ''));
68
- });
69
- const styles = assertCssList.map((styleItem) => {
70
- // Normally for `index-dev.html` we need to use relative path.
71
- if (multiCdn.disabled) {
72
- return basename(styleItem);
73
- }
74
- const randomCdn = findEnvCdn(this.config, multiCdn.env);
75
- return httpUrlJoin(randomCdn, styleItem.replace(publicPath, ''));
76
- });
77
- data.assets.js = scripts;
78
- data.assets.css = styles;
79
- return data;
80
- });
81
- });
82
- }
83
- }
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,65 +1 @@
1
- import HtmlWebpackPlugin from 'html-webpack-plugin';
2
- import { allowPx2remForModule } from '../../helpers/allow-px2rem-for-module.js';
3
- import { getHtmlPluginConfig, } from '../../helpers/get-html-plugin-config.js';
4
- import { normalizeTemplateInjectTokens } from '../../helpers/normalize-template-inject-tokens.js';
5
- import { findEnvCdn } from '../../helpers/script-injects.js';
6
- const minifyOpts = {
7
- minifyJS: true,
8
- removeComments: true,
9
- collapseWhitespace: true,
10
- collapseBooleanAttributes: false,
11
- };
12
- /**
13
- * Create `html-webpack-plugin` for this build, refer to best practices
14
- * We'd better pass only one entry for each `build` cycle
15
- * @param buildEntryItem the entries for this `build`
16
- * @param allEnv
17
- */
18
- export const createMultiHtmlWebpackPlugin = (serveMode, evolveOptions, entryMapItemList, allEnv) => {
19
- const firstEntryMap = entryMapItemList[0];
20
- const [, entryConfig] = firstEntryMap;
21
- const htmlPlugins = [];
22
- const { options } = entryConfig;
23
- const mode = serveMode ? 'development' : 'production';
24
- const chunks = entryMapItemList.map((entryMap) => entryMap[0]);
25
- for (const env of allEnv) {
26
- const envCdn = findEnvCdn(evolveOptions.multiHtmlCdn, env);
27
- const configData = {
28
- mode,
29
- envCdn,
30
- };
31
- const templateInjectTokens = normalizeTemplateInjectTokens(configData, options);
32
- htmlPlugins.push(new HtmlWebpackPlugin({
33
- inject: 'body',
34
- title: getHtmlPluginConfig('title', configData, options?.title),
35
- chunks: chunks,
36
- // `minify` is true, `dev` always don't minify.
37
- minify: options?.htmlMinify === false || ['me', 'dev'].includes(env)
38
- ? false
39
- : minifyOpts,
40
- // output file path
41
- filename: (entryName) => `${entryName}/index${env === 'prod' ? '' : `-${env}`}.html`,
42
- // html template
43
- template: getHtmlPluginConfig('templatePath', configData, options?.templatePath).replace(`{0}`, env),
44
- // template parameters
45
- templateParameters: {
46
- // The page title
47
- title: getHtmlPluginConfig('title', configData, options?.title),
48
- // The page favicon
49
- favicon: getHtmlPluginConfig('favicon', configData, options?.favicon),
50
- // `allowPx2rem` default is true
51
- viewport: allowPx2remForModule(firstEntryMap, evolveOptions)
52
- ? getHtmlPluginConfig('viewport', configData, options?.viewport)
53
- : '',
54
- ...templateInjectTokens,
55
- },
56
- // Some options for plugin used the `hook` of `html-webpack-plugin`
57
- multiCdn: {
58
- env,
59
- // use relative path for `me`, `dev`, `ntv`
60
- disabled: (options?.excludeCdnEnvs || ['me', 'dev', 'ntv']).includes(env),
61
- },
62
- }));
63
- }
64
- return htmlPlugins;
65
- };
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{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,n)=>{const i=l[0],[,o]=i,m=[],{options:p}=o,r=e?"development":"production",a=l.map((e=>e[0]));for(const e of n){const l={mode:r,envCdn:findEnvCdn(t.multiHtmlCdn,e)},n=normalizeTemplateInjectTokens(l,p);m.push(new HtmlWebpackPlugin({inject:"body",title:getHtmlPluginConfig("title",l,p?.title),chunks:a,minify:!1!==p?.htmlMinify&&!["me","dev"].includes(e)&&minifyOpts,filename:t=>`${t}/index${"prod"===e?"":`-${e}`}.html`,template:getHtmlPluginConfig("templatePath",l,p?.templatePath).replace("{0}",e),templateParameters:{title:getHtmlPluginConfig("title",l,p?.title),favicon:getHtmlPluginConfig("favicon",l,p?.favicon),viewport:allowPx2remForModule(i,t)?getHtmlPluginConfig("viewport",l,p?.viewport):"",...n},multiCdn:{env:e,disabled:(p?.excludeCdnEnvs||["me","dev","ntv"]).includes(e)}}))}return m};
@@ -0,0 +1,13 @@
1
+ import { type Compiler } from 'webpack';
2
+ export interface TsCheckerGuardPluginOption {
3
+ /**
4
+ * Whether to exit the process when issues is not empty
5
+ * @default false
6
+ */
7
+ autoExit?: boolean;
8
+ }
9
+ export declare class TsCheckerGuardPlugin {
10
+ private options;
11
+ constructor(option?: TsCheckerGuardPluginOption);
12
+ apply(compiler: Compiler): void;
13
+ }
@@ -0,0 +1 @@
1
+ import ForkTsCheckerWebpackPlugin from"fork-ts-checker-webpack-plugin";import{mergeOptions}from"@flatjs/common";export class TsCheckerGuardPlugin{constructor(r={}){this.options=mergeOptions({autoExit:!1},r)}apply(r){ForkTsCheckerWebpackPlugin.getCompilerHooks(r).issues.tap("issues",(r=>{const{autoExit:e}=this.options,o=r.filter((r=>"error"===r.severity));if(e&&o?.length>0)throw new Error(`TS_CHECKER_ERROR: \n ${JSON.stringify(o,null,2)}`);return r}))}}
@@ -1,4 +1,3 @@
1
1
  import { type WebpackPlugin } from '../../create-webpack/types.js';
2
- import { type EntryMapItem } from '../../types/types-entry-map.js';
3
2
  import { type FlatEvolveOptions } from '../../types/types-options.js';
4
- export declare const createTsCheckerPlugins: (serveMode: boolean, entryMapItemList: EntryMapItem[], evolveOptions: FlatEvolveOptions) => WebpackPlugin[];
3
+ export declare const createTsCheckerPlugins: (serveMode: boolean, evolveOptions: FlatEvolveOptions) => WebpackPlugin[];
@@ -1,24 +1 @@
1
- import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
2
- export const createTsCheckerPlugins = (serveMode, entryMapItemList, evolveOptions) => {
3
- const plugins = [];
4
- let isVueEntryItem = false;
5
- for (const [, entryMapItem] of entryMapItemList) {
6
- const itemEntries = entryMapItem.entry || [];
7
- if (itemEntries.find((s) => /.vue$/.test(s))) {
8
- isVueEntryItem = true;
9
- break;
10
- }
11
- }
12
- // Runs typescript type checker and linter on separate process.
13
- if (evolveOptions.loaderOptions.runTsChecker && !isVueEntryItem) {
14
- plugins.push(new ForkTsCheckerWebpackPlugin({
15
- async: serveMode,
16
- issue: {},
17
- typescript: {
18
- context: evolveOptions.projectCwd,
19
- memoryLimit: 2048 * 4,
20
- },
21
- }));
22
- }
23
- return plugins;
24
- };
1
+ import ForkTsCheckerWebpackPlugin from"fork-ts-checker-webpack-plugin";import{TsCheckerGuardPlugin}from"./ts-checker-guard-plugin.js";export const createTsCheckerPlugins=(e,r)=>{const{entryMap:t,globalCompilerOptions:c}=r,s=[];let n=!1;for(const[,e]of Object.entries(t)){if((e.entry||[]).find((e=>/.vue$/.test(e)))){n=!0;break}}if(c?.runTsChecker&&!n){const t=new ForkTsCheckerWebpackPlugin({async:e,devServer:!1,issue:{},typescript:{context:r.projectCwd,memoryLimit:8192}});s.push(t),s.push(new TsCheckerGuardPlugin({autoExit:!e}))}return s};
@@ -1,8 +1,9 @@
1
1
  export * from './types-dev-server.js';
2
2
  export * from './types-entry-map.js';
3
3
  export * from './types-federation.js';
4
+ export * from './types-global-compiler-options.js';
5
+ export * from './types-loader-options.js';
4
6
  export * from './types-modular-import.js';
5
7
  export * from './types-multi-html.js';
6
8
  export * from './types-options.js';
7
- export * from './types-loader-options.js';
8
9
  export * from './types-webpack.js';
@@ -1,8 +1 @@
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';
1
+ 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 +1 @@
1
- export {};
1
+ export{};
@@ -1,7 +1,6 @@
1
- import { type SecureContextHttps, type FlatMockOptions } from '@flatjs/mock';
2
1
  import { type RequestHandler } from 'express';
3
- import { type Configuration } from 'webpack';
4
- import { type WebSocketURL, type ClientConfiguration } from 'webpack-dev-server';
2
+ import { type ClientConfiguration, type WebSocketURL } from 'webpack-dev-server';
3
+ import { type FlatMockOptions, type SecureContextHttps } from '@flatjs/mock';
5
4
  import { type EvolveEntryMapContent } from './types-entry-map.js';
6
5
  export interface WebpackWatchOptions {
7
6
  /**
@@ -13,9 +12,9 @@ export interface WebpackWatchOptions {
13
12
  */
14
13
  followSymlinks?: boolean;
15
14
  /**
16
- * Ignore some files from watching (glob pattern or regexp).
15
+ * Ignore some files from watching
17
16
  */
18
- ignored?: string | RegExp | string[];
17
+ ignored?: string[];
19
18
  /**
20
19
  * Enable polling mode for watching.
21
20
  */
@@ -36,7 +35,7 @@ export type FlatEvolveDevServerOptions = {
36
35
  * In webpack-dev-server watch mode is enabled by default.
37
36
  * This configuration will be merged into `webpack-dev-server`
38
37
  */
39
- watchOptions?: Configuration['watchOptions'];
38
+ watchOptions?: WebpackWatchOptions;
40
39
  /**
41
40
  * Allow us costomized global serve data injected into `window.GLOBAL = {...globalData}`
42
41
  */
@@ -1 +1 @@
1
- export {};
1
+ export{};
@@ -1 +1 @@
1
- export {};
1
+ export{};
@@ -1 +1 @@
1
- export {};
1
+ export{};
@@ -0,0 +1,7 @@
1
+ export interface GlobalCompilerOptions {
2
+ /**
3
+ * The value indicates whether runs typescript type checker and linter on separate process.
4
+ * @default true
5
+ */
6
+ runTsChecker?: boolean;
7
+ }
@@ -0,0 +1 @@
1
+ export{};
@@ -1,7 +1,7 @@
1
- import { type TransformOptions } from '@babel/core';
2
- import { type PostcssPluginPixelOptions } from '@flatjs/forge-postcss-plugin-pixel';
3
1
  import { type AcceptedPlugin } from 'postcss';
4
2
  import { type LoaderContext } from 'webpack';
3
+ import { type TransformOptions } from '@babel/core';
4
+ import { type PostcssPluginPixelOptions } from '@flatjs/forge-postcss-plugin-pixel';
5
5
  import { type ModularImportOption } from './types-modular-import.js';
6
6
  export type BabelInputOptions = Pick<TransformOptions, 'presets' | 'plugins'>;
7
7
  /**
@@ -67,11 +67,6 @@ export interface RuleSetLoaderOptions {
67
67
  * @default []
68
68
  */
69
69
  modularImports?: ModularImportOption[];
70
- /**
71
- * The value indicates whether runs typescript type checker and linter on separate process.
72
- * @default true
73
- */
74
- runTsChecker?: boolean;
75
70
  /**
76
71
  * The configration options of `postcss-loader`
77
72
  */
@@ -1 +1 @@
1
- export {};
1
+ export{};
@@ -1 +1 @@
1
- export {};
1
+ export{};
@@ -1 +1 @@
1
- export {};
1
+ export{};
@@ -2,8 +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';
5
6
  import { type RuleSetLoaderOptions } from './types-loader-options.js';
6
- import { type EvolveMultiCDNEnvResolver, type EvolveMultiCDNConfig } from './types-multi-html.js';
7
+ import { type EvolveMultiCDNConfig, type EvolveMultiCDNEnvResolver } from './types-multi-html.js';
7
8
  import { type EvolvePluginOptions } from './types-plugin-options.js';
8
9
  import { type ThreadsOptions } from './types-threads-options.js';
9
10
  import { type FlatEvolveWebpackOptions } from './types-webpack.js';
@@ -45,6 +46,10 @@ export interface FlatEvolveOptions {
45
46
  * The configurations of `webpack`
46
47
  */
47
48
  webpack?: FlatEvolveWebpackOptions;
49
+ /**
50
+ * The config options of global webpack compiler.
51
+ */
52
+ globalCompilerOptions?: GlobalCompilerOptions;
48
53
  /**
49
54
  * The config options of all rule set loaders.
50
55
  */
@@ -1 +1 @@
1
- export {};
1
+ export{};
@@ -1 +1 @@
1
- export {};
1
+ export{};
@@ -1 +1 @@
1
- export {};
1
+ export{};
@@ -1,4 +1,4 @@
1
- import { type RuleSetRule, type Configuration } from 'webpack';
1
+ import { type Configuration, type RuleSetRule } from 'webpack';
2
2
  import { type WebpackPlugin } from '../create-webpack/types.js';
3
3
  import { type TerserMinimizerOptions } from '../minimizer/types.js';
4
4
  /**
@@ -1 +1 @@
1
- export {};
1
+ export{};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatjs/evolve",
3
- "version": "2.1.0-next.12",
3
+ "version": "2.1.0-next.13",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -18,46 +18,46 @@
18
18
  "./templates"
19
19
  ],
20
20
  "scripts": {
21
- "serve": "yarn node --import=@armit/path-alias/register ./tests/dev-server/dev-server.ts",
22
- "build": "rimraf dist && tsc -p ./tsconfig.build.json",
21
+ "serve": "yarn node --import=@hyperse/ts-node-paths/register ./tests/dev-server/dev-server.ts",
22
+ "build": "rimraf dist && tsc -p ./tsconfig.build.json && npm run minify",
23
23
  "?build-release": "When https://github.com/atlassian/changesets/issues/432 has a solution we can remove this trick",
24
24
  "build-release": "yarn build && rimraf ./_release && yarn pack && mkdir ./_release && tar zxvf ./package.tgz --directory ./_release && rm ./package.tgz",
25
25
  "minify": "node ../../scripts/minify.mjs --dest=dist",
26
26
  "codegen": "graphql-codegen --config ./codegen.cjs",
27
27
  "clean": "rimraf --no-glob ./dist ./coverage ./__data__ ./config/__data__ ./_release ./tsconfig.tsbuildinfo",
28
- "lint": "eslint . --ext .ts,.mts,.tsx,.js,.jsx,.cjs,.mjs --cache --cache-location ../../.cache/eslint/evolve.eslintcache",
28
+ "lint": "eslint . --cache --cache-location ../../.cache/eslint/evolve.eslintcache",
29
29
  "test": "run-s test-unit",
30
30
  "test-task": "vitest run",
31
31
  "test-unit": "vitest run --passWithNoTests",
32
32
  "test-watch": "vitest watch --ui",
33
- "fix-all-files": "eslint . --ext .ts,.tsx,.js,.jsx,.cjs,.mjs,.mdx,.graphql --fix",
33
+ "fix-all-files": "eslint . --fix",
34
34
  "typecheck": "tsc --project ./tsconfig.json --noEmit"
35
35
  },
36
36
  "dependencies": {
37
- "@armit/babel-merge": "^0.1.6",
38
- "@armit/config-loader": "^0.1.8",
39
- "@armit/file-utility": "^0.1.5",
40
- "@armit/git": "^0.1.5",
41
- "@armit/package": "^0.1.6",
42
- "@babel/core": "^7.24.5",
43
- "@flatjs/babel-plugin-import": "2.1.0-next.5",
44
- "@flatjs/common": "2.1.0-next.4",
45
- "@flatjs/evolve-preset-babel": "2.1.0-next.4",
46
- "@flatjs/forge-postcss-plugin-pixel": "2.1.0-next.4",
47
- "@flatjs/graph": "2.1.0-next.6",
48
- "@flatjs/mock": "2.1.0-next.6",
49
- "@pmmmwh/react-refresh-webpack-plugin": "^0.5.13",
37
+ "@armit/babel-merge": "^0.2.1",
38
+ "@armit/config-loader": "^0.2.1",
39
+ "@armit/file-utility": "^0.2.1",
40
+ "@armit/git": "^0.2.1",
41
+ "@armit/package": "^0.2.1",
42
+ "@babel/core": "^7.24.7",
43
+ "@flatjs/babel-plugin-import": "2.1.0-next.6",
44
+ "@flatjs/common": "2.1.0-next.5",
45
+ "@flatjs/evolve-preset-babel": "2.1.0-next.5",
46
+ "@flatjs/forge-postcss-plugin-pixel": "2.1.0-next.5",
47
+ "@flatjs/graph": "2.1.0-next.7",
48
+ "@flatjs/mock": "2.1.0-next.7",
49
+ "@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
50
50
  "@types/babel__core": "^7.20.5",
51
51
  "babel-loader": "^9.1.3",
52
52
  "better-opn": "^3.0.2",
53
53
  "case-sensitive-paths-webpack-plugin": "^2.4.0",
54
- "css-loader": "^7.1.1",
55
- "cssnano": "^7.0.1",
54
+ "css-loader": "^7.1.2",
55
+ "cssnano": "^7.0.2",
56
56
  "express": "^4.19.2",
57
57
  "fork-ts-checker-webpack-plugin": "^9.0.2",
58
- "happy-dom": "^14.10.1",
58
+ "happy-dom": "^14.12.0",
59
59
  "html-webpack-plugin": "^5.6.0",
60
- "image-minimizer-webpack-plugin": "^4.0.0",
60
+ "image-minimizer-webpack-plugin": "^4.0.2",
61
61
  "less": "^4.2.0",
62
62
  "less-loader": "^12.2.0",
63
63
  "listr": "^0.14.3",
@@ -69,40 +69,38 @@
69
69
  "svgo": "^3.3.2",
70
70
  "tarjan-graph": "^3.0.0",
71
71
  "terser-webpack-plugin": "^5.3.10",
72
- "tinypool": "^0.9.0",
72
+ "tinypool": "^1.0.0",
73
73
  "tsconfig-paths-webpack-plugin": "^4.1.0",
74
- "type-fest": "^4.18.2",
74
+ "type-fest": "^4.20.0",
75
75
  "typescript": "^5.4.5",
76
- "webpack": "^5.91.0",
76
+ "webpack": "^5.92.0",
77
77
  "webpack-bundle-analyzer": "^4.10.2",
78
78
  "webpack-dev-server": "^5.0.4",
79
79
  "webpack-sources": "^3.2.3"
80
80
  },
81
81
  "devDependencies": {
82
- "@armit/eslint-config-bases": "^0.1.6",
83
82
  "@dimjs/lang": "1.5.0",
84
83
  "@dimjs/model": "1.2.3",
85
84
  "@dimjs/model-react": "1.2.3",
86
85
  "@dimjs/utils": "1.5.1",
87
- "@flatjs/testing": "2.1.0-next.4",
88
- "@swc/core": "1.5.5",
86
+ "@flatjs/testing": "2.1.0-next.5",
87
+ "@hyperse/eslint-config-hyperse": "^1.0.8",
88
+ "@swc/core": "1.5.29",
89
89
  "@types/express": "4.17.21",
90
90
  "@types/listr": "0.14.9",
91
- "@types/node": "20.12.11",
91
+ "@types/node": "20.14.2",
92
92
  "@vitest/coverage-istanbul": "1.6.0",
93
93
  "@vitest/ui": "1.6.0",
94
94
  "@wove/react": "1.2.23",
95
- "eslint": "8.x",
95
+ "eslint": "^9.4.0",
96
96
  "imagemin-gifsicle": "7.0.0",
97
97
  "imagemin-jpegtran": "7.0.0",
98
98
  "imagemin-pngquant": "10.0.0",
99
99
  "imagemin-svgo": "11.0.0",
100
100
  "npm-run-all": "4.1.5",
101
- "prettier": "3.2.5",
102
101
  "react": "18.3.1",
103
102
  "rimraf": "5.0.7",
104
103
  "swc-unplugin-ts": "1.0.3",
105
- "ts-node": "11.0.0-beta.1",
106
104
  "vite-tsconfig-paths": "4.3.2",
107
105
  "vitest": "1.6.0",
108
106
  "vue-loader": "17.4.2"
@@ -1 +0,0 @@
1
- export * from './ts-checker-plugin.js';
@@ -1 +0,0 @@
1
- export * from './ts-checker-plugin.js';