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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/dist/compiler/create-global-compiler.d.ts +2 -0
  2. package/dist/compiler/create-global-compiler.js +1 -0
  3. package/dist/constants.d.ts +5 -0
  4. package/dist/constants.js +1 -1
  5. package/dist/create-webpack/create-externals.d.ts +1 -1
  6. package/dist/create-webpack/create-externals.js +1 -1
  7. package/dist/create-webpack/create-optimization.d.ts +1 -1
  8. package/dist/create-webpack/create-optimization.js +1 -1
  9. package/dist/create-webpack/create-plugins.d.ts +1 -1
  10. package/dist/create-webpack/create-plugins.js +1 -1
  11. package/dist/create-webpack/create-resolve.js +1 -1
  12. package/dist/create-webpack/create-rule-sets.d.ts +1 -1
  13. package/dist/create-webpack/create-rule-sets.js +1 -1
  14. package/dist/create-webpack/load-watch-options.d.ts +12 -0
  15. package/dist/create-webpack/load-watch-options.js +1 -0
  16. package/dist/create-webpack/load-webpack-config.js +1 -1
  17. package/dist/create-webpack/rule-sets/rule-assets.d.ts +2 -2
  18. package/dist/create-webpack/rule-sets/rule-assets.js +1 -1
  19. package/dist/create-webpack/rule-sets/rule-css.js +1 -1
  20. package/dist/create-webpack/rule-sets/rule-scripts.d.ts +2 -0
  21. package/dist/create-webpack/rule-sets/rule-scripts.js +1 -1
  22. package/dist/create-webpack/types.d.ts +1 -1
  23. package/dist/default-options.js +1 -1
  24. package/dist/define-config/define-config.d.ts +2 -2
  25. package/dist/dev-server/create-dev-server-compiler-task.d.ts +3 -0
  26. package/dist/dev-server/create-dev-server-compiler-task.js +1 -0
  27. package/dist/dev-server/create-dev-server-entries.d.ts +1 -1
  28. package/dist/dev-server/create-dev-server-entries.js +1 -1
  29. package/dist/dev-server/create-dev-server.js +1 -1
  30. package/dist/dev-server/index.d.ts +3 -3
  31. package/dist/dev-server/index.js +1 -1
  32. package/dist/dev-server/middlewares/get-page-main-html.js +1 -1
  33. package/dist/dev-server/middlewares/get-page-module-html.js +1 -1
  34. package/dist/helpers/assert-group-entry-item.d.ts +7 -0
  35. package/dist/helpers/assert-group-entry-item.js +1 -0
  36. package/dist/helpers/assert-single-compiler.d.ts +15 -0
  37. package/dist/helpers/assert-single-compiler.js +1 -0
  38. package/dist/helpers/custom-listr-renderer.d.ts +37 -0
  39. package/dist/helpers/custom-listr-renderer.js +1 -0
  40. package/dist/helpers/delete-object-keys.d.ts +11 -0
  41. package/dist/helpers/delete-object-keys.js +1 -0
  42. package/dist/helpers/flat-entry-map.d.ts +8 -0
  43. package/dist/helpers/flat-entry-map.js +1 -0
  44. package/dist/helpers/format-spinner-text.d.ts +7 -0
  45. package/dist/helpers/format-spinner-text.js +1 -0
  46. package/dist/helpers/get-runtime-cdn-base.d.ts +2 -0
  47. package/dist/helpers/get-runtime-cdn-base.js +1 -0
  48. package/dist/helpers/index.d.ts +16 -4
  49. package/dist/helpers/index.js +1 -1
  50. package/dist/helpers/is-deep-equal.d.ts +9 -0
  51. package/dist/helpers/is-deep-equal.js +1 -0
  52. package/dist/helpers/json-serializer.js +1 -1
  53. package/dist/helpers/normalize-check-entry-options.d.ts +10 -0
  54. package/dist/helpers/normalize-check-entry-options.js +1 -0
  55. package/dist/helpers/normalize-entry-map.d.ts +1 -0
  56. package/dist/helpers/normalize-entry-map.js +1 -1
  57. package/dist/helpers/normalize-group-name.d.ts +8 -0
  58. package/dist/helpers/normalize-group-name.js +1 -0
  59. package/dist/helpers/normalize-template-inject-tokens.d.ts +16 -0
  60. package/dist/helpers/normalize-template-inject-tokens.js +1 -0
  61. package/dist/helpers/open-page.js +1 -1
  62. package/dist/helpers/refresh-evolve-mock-options.js +1 -1
  63. package/dist/helpers/script-injects.d.ts +1 -1
  64. package/dist/helpers/should-enable-react-fast-refresh.js +1 -1
  65. package/dist/helpers/split-to-entry-group.d.ts +52 -0
  66. package/dist/helpers/split-to-entry-group.js +1 -0
  67. package/dist/helpers/verify-group-entry-options.d.ts +9 -0
  68. package/dist/helpers/verify-group-entry-options.js +1 -0
  69. package/dist/index.d.ts +1 -1
  70. package/dist/index.js +1 -1
  71. package/dist/load-config/load-evolve-config.js +1 -1
  72. package/dist/loaders/loader-icon.cjs +2 -1
  73. package/dist/main/create-thread-worker.d.ts +29 -14
  74. package/dist/main/create-thread-worker.js +1 -1
  75. package/dist/main/index.d.ts +1 -1
  76. package/dist/main/index.js +1 -1
  77. package/dist/main/prepare-build.d.ts +3 -3
  78. package/dist/main/prepare-build.js +1 -1
  79. package/dist/main/prepare-serve.d.ts +1 -1
  80. package/dist/main/prepare-serve.js +1 -1
  81. package/dist/main/start-build-dynamic.d.ts +2 -2
  82. package/dist/main/start-build-dynamic.js +1 -1
  83. package/dist/main/start-build-worker.d.ts +12 -6
  84. package/dist/main/start-build-worker.js +1 -1
  85. package/dist/main/start-build.d.ts +1 -1
  86. package/dist/main/start-build.js +1 -1
  87. package/dist/main/start-group-entry-build.d.ts +14 -0
  88. package/dist/main/start-group-entry-build.js +1 -0
  89. package/dist/main/start-serve.d.ts +1 -1
  90. package/dist/main/start-serve.js +1 -1
  91. package/dist/minimizer/image-minimizer.js +1 -1
  92. package/dist/minimizer/terser-minimizer.js +1 -1
  93. package/dist/plugins/circular-dependency/circular-dependency-plugin.js +1 -1
  94. package/dist/plugins/clean-webpack/index.d.ts +1 -1
  95. package/dist/plugins/clean-webpack/index.js +1 -1
  96. package/dist/plugins/define-variable/define-variable-plugin.js +1 -1
  97. package/dist/plugins/module-federation/module-federation.d.ts +1 -1
  98. package/dist/plugins/module-federation/module-federation.js +1 -1
  99. package/dist/plugins/multi-html/index.d.ts +1 -1
  100. package/dist/plugins/multi-html/index.js +1 -1
  101. package/dist/plugins/multi-html/multi-html-cdn-plugin.js +1 -1
  102. package/dist/plugins/multi-html/multi-html-plugin.d.ts +1 -1
  103. package/dist/plugins/multi-html/multi-html-plugin.js +1 -1
  104. package/dist/plugins/ts-checker/ts-checker-guard-plugin.d.ts +13 -0
  105. package/dist/plugins/ts-checker/ts-checker-guard-plugin.js +1 -0
  106. package/dist/plugins/ts-checker/ts-checker-plugin.d.ts +3 -0
  107. package/dist/plugins/ts-checker/ts-checker-plugin.js +1 -0
  108. package/dist/types/index.d.ts +2 -1
  109. package/dist/types/index.js +1 -1
  110. package/dist/types/types-dev-server.d.ts +5 -6
  111. package/dist/types/types-entry-map.d.ts +16 -2
  112. package/dist/types/types-global-compiler-options.d.ts +7 -0
  113. package/dist/types/types-global-compiler-options.js +1 -0
  114. package/dist/types/types-loader-options.d.ts +31 -9
  115. package/dist/types/types-options.d.ts +30 -11
  116. package/dist/types/types-threads-options.d.ts +25 -0
  117. package/dist/types/types-threads-options.js +1 -0
  118. package/dist/types/types-webpack.d.ts +1 -1
  119. package/package.json +65 -61
  120. package/templates/html-plugin/index-dev.html +2 -2
  121. package/templates/html-plugin/index-inte.html +2 -2
  122. package/templates/html-plugin/index-inte2.html +2 -2
  123. package/templates/html-plugin/index-inte3.html +2 -2
  124. package/templates/html-plugin/index-inte4.html +2 -2
  125. package/templates/html-plugin/index-me.html +2 -2
  126. package/templates/html-plugin/index-prod.html +2 -2
  127. package/templates/html-plugin/index-rc.html +2 -2
  128. package/templates/html-plugin/index-uat.html +2 -2
  129. package/templates/module.html +2 -2
  130. package/dist/dev-server/create-dev-server-compiler-tasks.d.ts +0 -3
  131. package/dist/dev-server/create-dev-server-compiler-tasks.js +0 -1
  132. package/dist/helpers/assert-only-single-entry-item.d.ts +0 -7
  133. package/dist/helpers/assert-only-single-entry-item.js +0 -1
  134. package/dist/helpers/split-to-multi-compiler.d.ts +0 -8
  135. package/dist/helpers/split-to-multi-compiler.js +0 -1
  136. package/dist/main/start-one-entry-build.d.ts +0 -13
  137. package/dist/main/start-one-entry-build.js +0 -1
@@ -1,6 +1,7 @@
1
+ import { type AcceptedPlugin } from 'postcss';
2
+ import { type LoaderContext } from 'webpack';
1
3
  import { type TransformOptions } from '@babel/core';
2
4
  import { type PostcssPluginPixelOptions } from '@flatjs/forge-postcss-plugin-pixel';
3
- import { type AcceptedPlugin } from 'postcss';
4
5
  import { type ModularImportOption } from './types-modular-import.js';
5
6
  export type BabelInputOptions = Pick<TransformOptions, 'presets' | 'plugins'>;
6
7
  /**
@@ -14,6 +15,34 @@ export type BuiltinBabelOptions = BabelInputOptions & {
14
15
  */
15
16
  usePreset?: 'react' | 'vue';
16
17
  };
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>;
17
46
  /**
18
47
  * The configurations for `builtin` rule set options
19
48
  */
@@ -28,9 +57,7 @@ export interface RuleSetLoaderOptions {
28
57
  * The configurations of `css-loader`
29
58
  * https://github.com/webpack-contrib/css-loader/blob/master/README.md#modules
30
59
  */
31
- cssLoaderOptions?: {
32
- modules?: Record<string, unknown>;
33
- } & Record<string, unknown>;
60
+ cssLoaderOptions?: CssLoaderOptions;
34
61
  /**
35
62
  * The config for `Less`
36
63
  */
@@ -40,11 +67,6 @@ export interface RuleSetLoaderOptions {
40
67
  * @default []
41
68
  */
42
69
  modularImports?: ModularImportOption[];
43
- /**
44
- * The value indicates whether runs typescript type checker and linter on separate process.
45
- * @default true
46
- */
47
- runTsChecker?: boolean;
48
70
  /**
49
71
  * The configration options of `postcss-loader`
50
72
  */
@@ -2,9 +2,11 @@ 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';
9
+ import { type ThreadsOptions } from './types-threads-options.js';
8
10
  import { type FlatEvolveWebpackOptions } from './types-webpack.js';
9
11
  /**
10
12
  * Detect locally installed dependencies that have correctly installed from `package.json` declared version `dependencies`
@@ -44,6 +46,10 @@ export interface FlatEvolveOptions {
44
46
  * The configurations of `webpack`
45
47
  */
46
48
  webpack?: FlatEvolveWebpackOptions;
49
+ /**
50
+ * The config options of global webpack compiler.
51
+ */
52
+ globalCompilerOptions?: GlobalCompilerOptions;
47
53
  /**
48
54
  * The config options of all rule set loaders.
49
55
  */
@@ -96,20 +102,13 @@ export interface FlatEvolveOptions {
96
102
  /**
97
103
  * All webpack entries configuration
98
104
  */
99
- entryMap: EvolveEntryMap;
105
+ entryMap: {
106
+ [K in keyof EvolveEntryMap]: Omit<EvolveEntryMap[K], 'groupingSource'>;
107
+ };
100
108
  /**
101
109
  * Visualize size of webpack output files with an interactive zoomable treemap.
102
110
  */
103
111
  analyzer?: Record<string, unknown>;
104
- /**
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
111
- */
112
- maxProcesses?: number | string;
113
112
  /**
114
113
  * For `production` mode, the value indicates if we interrupt compilation process while received "warnings" while evolve `build`
115
114
  * @default false
@@ -119,4 +118,24 @@ export interface FlatEvolveOptions {
119
118
  * The faster builds, simplified ci pipeline configurations
120
119
  */
121
120
  ci?: FlatEvolveCI;
121
+ /**
122
+ * The configurations of `threads`
123
+ */
124
+ threads?: ThreadsOptions;
125
+ /**
126
+ * Control whether each entry is built independently.
127
+ *
128
+ * If `true`, each entry will be built independently.
129
+ *
130
+ * If `false`, each entries are grouped according to certain rules
131
+ *
132
+ * @default false
133
+ */
134
+ isolation?: boolean;
135
+ /**
136
+ * The maximum size of an entry group.
137
+ *
138
+ * @default 10
139
+ */
140
+ maxEntryGroupSize?: number;
122
141
  }
@@ -0,0 +1,25 @@
1
+ export interface ThreadsOptions {
2
+ /**
3
+ * Minimum number of process to run at once for production build
4
+ *
5
+ * @default 1
6
+ */
7
+ minThreads?: number;
8
+ /**
9
+ * Maximum number of process to run at once for production build
10
+ */
11
+ maxThreads?: number;
12
+ /**
13
+ * The runtime to use for creating threads.
14
+ * Possible values are 'child_process' or 'worker_threads'.
15
+ *
16
+ * @default 'worker_threads'
17
+ */
18
+ runtime?: 'child_process' | 'worker_threads';
19
+ /**
20
+ * Default timeout to wait for close when Thread shuts down, in milliseconds
21
+ *
22
+ * @default 60000
23
+ */
24
+ idleTimeout?: number;
25
+ }
@@ -0,0 +1 @@
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
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatjs/evolve",
3
- "version": "2.1.0-next.2",
3
+ "version": "2.1.0-next.20",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -18,88 +18,92 @@
18
18
  "./templates"
19
19
  ],
20
20
  "scripts": {
21
- "serve": "yarn node --import=@armit/path-alias/register ./tests/dev-server/dev-server.ts",
21
+ "serve": "yarn node --import=@hyperse/ts-node-paths/register ./tests/dev-server/dev-server.ts",
22
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.5",
38
- "@armit/config-loader": "^0.1.6",
39
- "@armit/file-utility": "^0.1.4",
40
- "@armit/git": "^0.1.4",
41
- "@armit/package": "^0.1.5",
42
- "@armit/worker-threads": "^0.1.4",
43
- "@babel/core": "7.24.3",
44
- "@flatjs/babel-plugin-import": "2.1.0-next.1",
45
- "@flatjs/common": "2.1.0-next.2",
46
- "@flatjs/evolve-preset-babel": "2.1.0-next.2",
47
- "@flatjs/forge-postcss-plugin-pixel": "2.1.0-next.2",
48
- "@flatjs/graph": "2.1.0-next.2",
49
- "@flatjs/mock": "2.1.0-next.2",
50
- "@pmmmwh/react-refresh-webpack-plugin": "0.5.11",
51
- "@types/babel__core": "7.20.5",
52
- "babel-loader": "9.1.3",
53
- "better-opn": "3.0.2",
54
- "case-sensitive-paths-webpack-plugin": "2.4.0",
55
- "css-loader": "6.10.0",
56
- "cssnano": "6.1.2",
57
- "express": "4.19.2",
58
- "fork-ts-checker-webpack-plugin": "9.0.2",
59
- "happy-dom": "14.3.10",
60
- "html-webpack-plugin": "5.6.0",
61
- "image-minimizer-webpack-plugin": "4.0.0",
62
- "less": "4.2.0",
63
- "less-loader": "12.2.0",
64
- "listr": "0.14.3",
65
- "lodash": "4.17.21",
66
- "mini-css-extract-plugin": "2.8.1",
67
- "postcss": "8.4.38",
68
- "postcss-loader": "8.1.1",
69
- "react-refresh": "0.14.0",
70
- "svgo": "3.2.0",
71
- "tarjan-graph": "3.0.0",
72
- "terser-webpack-plugin": "5.3.10",
73
- "tsconfig-paths-webpack-plugin": "4.1.0",
74
- "type-fest": "^4.14.0",
75
- "typescript": "5.4.3",
76
- "webpack": "5.91.0",
77
- "webpack-bundle-analyzer": "4.10.1",
78
- "webpack-dev-server": "5.0.4",
79
- "webpack-sources": "3.2.3"
37
+ "@armit/babel-merge": "^0.2.2",
38
+ "@armit/config-loader": "^0.2.2",
39
+ "@armit/file-utility": "^0.2.2",
40
+ "@armit/git": "^0.2.2",
41
+ "@armit/package": "^0.2.2",
42
+ "@babel/core": "^7.24.7",
43
+ "@flatjs/babel-plugin-import": "2.1.0-next.8",
44
+ "@flatjs/common": "2.1.0-next.7",
45
+ "@flatjs/evolve-preset-babel": "2.1.0-next.7",
46
+ "@flatjs/forge-postcss-plugin-pixel": "2.1.0-next.7",
47
+ "@flatjs/graph": "2.1.0-next.9",
48
+ "@flatjs/mock": "2.1.0-next.10",
49
+ "@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
50
+ "@types/babel__core": "^7.20.5",
51
+ "babel-loader": "^9.1.3",
52
+ "better-opn": "^3.0.2",
53
+ "case-sensitive-paths-webpack-plugin": "^2.4.0",
54
+ "css-loader": "^7.1.2",
55
+ "cssnano": "^7.0.3",
56
+ "express": "^4.19.2",
57
+ "fork-ts-checker-webpack-plugin": "^9.0.2",
58
+ "happy-dom": "^14.12.0",
59
+ "html-webpack-plugin": "^5.6.0",
60
+ "image-minimizer-webpack-plugin": "^4.0.2",
61
+ "less": "^4.2.0",
62
+ "less-loader": "^12.2.0",
63
+ "listr": "^0.14.3",
64
+ "lodash": "^4.17.21",
65
+ "log-update": "^6.0.0",
66
+ "mini-css-extract-plugin": "^2.9.0",
67
+ "postcss": "^8.4.38",
68
+ "postcss-loader": "^8.1.1",
69
+ "react-refresh": "^0.14.2",
70
+ "svgo": "^3.3.2",
71
+ "tarjan-graph": "^3.0.0",
72
+ "terser-webpack-plugin": "^5.3.10",
73
+ "tinypool": "^1.0.0",
74
+ "tsconfig-paths-webpack-plugin": "^4.1.0",
75
+ "type-fest": "^4.20.1",
76
+ "typescript": "^5.4.5",
77
+ "webpack": "^5.92.1",
78
+ "webpack-bundle-analyzer": "^4.10.2",
79
+ "webpack-dev-server": "^5.0.4",
80
+ "webpack-sources": "^3.2.3"
80
81
  },
81
82
  "devDependencies": {
82
- "@armit/eslint-config-bases": "^0.1.5",
83
- "@flatjs/testing": "2.1.0-next.2",
84
- "@swc/core": "1.4.11",
83
+ "@dimjs/lang": "1.5.0",
84
+ "@dimjs/model": "1.2.3",
85
+ "@dimjs/model-react": "1.2.3",
86
+ "@dimjs/utils": "1.5.1",
87
+ "@flatjs/testing": "2.1.0-next.7",
88
+ "@hyperse/eslint-config-hyperse": "^1.0.9",
89
+ "@swc/core": "1.6.3",
85
90
  "@types/express": "4.17.21",
86
91
  "@types/listr": "0.14.9",
87
- "@types/node": "20.12.2",
88
- "@vitest/coverage-istanbul": "1.4.0",
89
- "@vitest/ui": "1.4.0",
90
- "eslint": "8.57.0",
92
+ "@types/node": "20.14.6",
93
+ "@vitest/coverage-istanbul": "1.6.0",
94
+ "@vitest/ui": "1.6.0",
95
+ "@wove/react": "1.2.23",
96
+ "eslint": "^9.5.0",
91
97
  "imagemin-gifsicle": "7.0.0",
92
98
  "imagemin-jpegtran": "7.0.0",
93
- "imagemin-pngquant": "9.0.2",
94
- "imagemin-svgo": "10.0.1",
99
+ "imagemin-pngquant": "10.0.0",
100
+ "imagemin-svgo": "11.0.1",
95
101
  "npm-run-all": "4.1.5",
96
- "prettier": "3.2.5",
97
- "react": "18.2.0",
98
- "rimraf": "5.0.5",
102
+ "react": "18.3.1",
103
+ "rimraf": "5.0.7",
99
104
  "swc-unplugin-ts": "1.0.3",
100
- "ts-node": "11.0.0-beta.1",
101
105
  "vite-tsconfig-paths": "4.3.2",
102
- "vitest": "1.4.0",
106
+ "vitest": "1.6.0",
103
107
  "vue-loader": "17.4.2"
104
108
  },
105
109
  "peerDependencies": {
@@ -45,7 +45,7 @@
45
45
  <% } %>
46
46
  <% if (headBeforeScripts) { %>
47
47
  <% for (let index = 0; index < headBeforeScripts.length; index++) { %>
48
- <script crossorigin="anonymous" src="<%= headBeforeScripts[index]%>"></script>
48
+ <script src="<%= headBeforeScripts[index]%>"></script>
49
49
  <% } %>
50
50
  <% } %>
51
51
  </head>
@@ -54,7 +54,7 @@
54
54
  <div id="app"></div>
55
55
  <% if (bodyAfterScripts) { %>
56
56
  <% for (let index = 0; index < bodyAfterScripts.length; index++) { %>
57
- <script crossorigin="anonymous" src="<%= bodyAfterScripts[index]%>"></script>
57
+ <script src="<%= bodyAfterScripts[index]%>"></script>
58
58
  <% } %>
59
59
  <% } %>
60
60
  </body>
@@ -45,7 +45,7 @@
45
45
  <% } %>
46
46
  <% if (headBeforeScripts) { %>
47
47
  <% for (let index = 0; index < headBeforeScripts.length; index++) { %>
48
- <script crossorigin="anonymous" src="<%= headBeforeScripts[index]%>"></script>
48
+ <script src="<%= headBeforeScripts[index]%>"></script>
49
49
  <% } %>
50
50
  <% } %>
51
51
  </head>
@@ -54,7 +54,7 @@
54
54
  <div id="app"></div>
55
55
  <% if (bodyAfterScripts) { %>
56
56
  <% for (let index = 0; index < bodyAfterScripts.length; index++) { %>
57
- <script crossorigin="anonymous" src="<%= bodyAfterScripts[index]%>"></script>
57
+ <script src="<%= bodyAfterScripts[index]%>"></script>
58
58
  <% } %>
59
59
  <% } %>
60
60
  </body>
@@ -45,7 +45,7 @@
45
45
  <% } %>
46
46
  <% if (headBeforeScripts) { %>
47
47
  <% for (let index = 0; index < headBeforeScripts.length; index++) { %>
48
- <script crossorigin="anonymous" src="<%= headBeforeScripts[index]%>"></script>
48
+ <script src="<%= headBeforeScripts[index]%>"></script>
49
49
  <% } %>
50
50
  <% } %>
51
51
  </head>
@@ -54,7 +54,7 @@
54
54
  <div id="app"></div>
55
55
  <% if (bodyAfterScripts) { %>
56
56
  <% for (let index = 0; index < bodyAfterScripts.length; index++) { %>
57
- <script crossorigin="anonymous" src="<%= bodyAfterScripts[index]%>"></script>
57
+ <script src="<%= bodyAfterScripts[index]%>"></script>
58
58
  <% } %>
59
59
  <% } %>
60
60
  </body>
@@ -45,7 +45,7 @@
45
45
  <% } %>
46
46
  <% if (headBeforeScripts) { %>
47
47
  <% for (let index = 0; index < headBeforeScripts.length; index++) { %>
48
- <script crossorigin="anonymous" src="<%= headBeforeScripts[index]%>"></script>
48
+ <script src="<%= headBeforeScripts[index]%>"></script>
49
49
  <% } %>
50
50
  <% } %>
51
51
  </head>
@@ -54,7 +54,7 @@
54
54
  <div id="app"></div>
55
55
  <% if (bodyAfterScripts) { %>
56
56
  <% for (let index = 0; index < bodyAfterScripts.length; index++) { %>
57
- <script crossorigin="anonymous" src="<%= bodyAfterScripts[index]%>"></script>
57
+ <script src="<%= bodyAfterScripts[index]%>"></script>
58
58
  <% } %>
59
59
  <% } %>
60
60
  </body>
@@ -45,7 +45,7 @@
45
45
  <% } %>
46
46
  <% if (headBeforeScripts) { %>
47
47
  <% for (let index = 0; index < headBeforeScripts.length; index++) { %>
48
- <script crossorigin="anonymous" src="<%= headBeforeScripts[index]%>"></script>
48
+ <script src="<%= headBeforeScripts[index]%>"></script>
49
49
  <% } %>
50
50
  <% } %>
51
51
  </head>
@@ -54,7 +54,7 @@
54
54
  <div id="app"></div>
55
55
  <% if (bodyAfterScripts) { %>
56
56
  <% for (let index = 0; index < bodyAfterScripts.length; index++) { %>
57
- <script crossorigin="anonymous" src="<%= bodyAfterScripts[index]%>"></script>
57
+ <script src="<%= bodyAfterScripts[index]%>"></script>
58
58
  <% } %>
59
59
  <% } %>
60
60
  </body>
@@ -45,7 +45,7 @@
45
45
  <% } %>
46
46
  <% if (headBeforeScripts) { %>
47
47
  <% for (let index = 0; index < headBeforeScripts.length; index++) { %>
48
- <script crossorigin="anonymous" src="<%= headBeforeScripts[index]%>"></script>
48
+ <script src="<%= headBeforeScripts[index]%>"></script>
49
49
  <% } %>
50
50
  <% } %>
51
51
  </head>
@@ -54,7 +54,7 @@
54
54
  <div id="app"></div>
55
55
  <% if (bodyAfterScripts) { %>
56
56
  <% for (let index = 0; index < bodyAfterScripts.length; index++) { %>
57
- <script crossorigin="anonymous" src="<%= bodyAfterScripts[index]%>"></script>
57
+ <script src="<%= bodyAfterScripts[index]%>"></script>
58
58
  <% } %>
59
59
  <% } %>
60
60
  </body>
@@ -45,7 +45,7 @@
45
45
  <% } %>
46
46
  <% if (headBeforeScripts) { %>
47
47
  <% for (let index = 0; index < headBeforeScripts.length; index++) { %>
48
- <script crossorigin="anonymous" src="<%= headBeforeScripts[index]%>"></script>
48
+ <script src="<%= headBeforeScripts[index]%>"></script>
49
49
  <% } %>
50
50
  <% } %>
51
51
  </head>
@@ -54,7 +54,7 @@
54
54
  <div id="app"></div>
55
55
  <% if (bodyAfterScripts) { %>
56
56
  <% for (let index = 0; index < bodyAfterScripts.length; index++) { %>
57
- <script crossorigin="anonymous" src="<%= bodyAfterScripts[index]%>"></script>
57
+ <script src="<%= bodyAfterScripts[index]%>"></script>
58
58
  <% } %>
59
59
  <% } %>
60
60
  </body>
@@ -45,7 +45,7 @@
45
45
  <% } %>
46
46
  <% if (headBeforeScripts) { %>
47
47
  <% for (let index = 0; index < headBeforeScripts.length; index++) { %>
48
- <script crossorigin="anonymous" src="<%= headBeforeScripts[index]%>"></script>
48
+ <script src="<%= headBeforeScripts[index]%>"></script>
49
49
  <% } %>
50
50
  <% } %>
51
51
  </head>
@@ -54,7 +54,7 @@
54
54
  <div id="app"></div>
55
55
  <% if (bodyAfterScripts) { %>
56
56
  <% for (let index = 0; index < bodyAfterScripts.length; index++) { %>
57
- <script crossorigin="anonymous" src="<%= bodyAfterScripts[index]%>"></script>
57
+ <script src="<%= bodyAfterScripts[index]%>"></script>
58
58
  <% } %>
59
59
  <% } %>
60
60
  </body>
@@ -45,7 +45,7 @@
45
45
  <% } %>
46
46
  <% if (headBeforeScripts) { %>
47
47
  <% for (let index = 0; index < headBeforeScripts.length; index++) { %>
48
- <script crossorigin="anonymous" src="<%= headBeforeScripts[index]%>"></script>
48
+ <script src="<%= headBeforeScripts[index]%>"></script>
49
49
  <% } %>
50
50
  <% } %>
51
51
  </head>
@@ -54,7 +54,7 @@
54
54
  <div id="app"></div>
55
55
  <% if (bodyAfterScripts) { %>
56
56
  <% for (let index = 0; index < bodyAfterScripts.length; index++) { %>
57
- <script crossorigin="anonymous" src="<%= bodyAfterScripts[index]%>"></script>
57
+ <script src="<%= bodyAfterScripts[index]%>"></script>
58
58
  <% } %>
59
59
  <% } %>
60
60
  </body>
@@ -56,7 +56,7 @@
56
56
 
57
57
  <% if (headBeforeScripts) { %>
58
58
  <% for (let index = 0; index < headBeforeScripts.length; index++) { %>
59
- <script crossorigin="anonymous" src="<%= headBeforeScripts[index]%>"></script>
59
+ <script src="<%= headBeforeScripts[index]%>"></script>
60
60
  <% } %>
61
61
  <% } %>
62
62
  </head>
@@ -75,7 +75,7 @@
75
75
  <% } %>
76
76
  <% if (bodyAfterScripts) { %>
77
77
  <% for (let index = 0; index < bodyAfterScripts.length; index++) { %>
78
- <script crossorigin="anonymous" src="<%= bodyAfterScripts[index]%>"></script>
78
+ <script src="<%= bodyAfterScripts[index]%>"></script>
79
79
  <% } %>
80
80
  <% } %>
81
81
  </body>
@@ -1,3 +0,0 @@
1
- import { type FlatEvolveOptions } from '../types/types-options.js';
2
- import { type EvolveDevServerEntryMap } from './middlewares/types.js';
3
- export declare const createDevServerCompilerTasks: (projectCwd: string, mainPage: string, publicIp: string, servedDevServerEntries: EvolveDevServerEntryMap, evolveOptions: FlatEvolveOptions) => Promise<Promise<boolean>[]>;
@@ -1 +0,0 @@
1
- import{relative}from"node:path";import{chalk,logger,mergeOptions,urlJoin}from"@flatjs/common";import webpack from"webpack";import{loadWebpackConfig}from"../create-webpack/load-webpack-config.js";import{shouldEnableReactFastRefresh}from"../helpers/should-enable-react-fast-refresh.js";import{splitToMultiCompilerConfigs}from"../helpers/split-to-multi-compiler.js";import{addCompilerToDevServer}from"./add-compiler-to-dev-server.js";export const createDevServerCompilerTasks=async(e,o,r,t,i)=>{const a=[];for(const[n,l]of Object.entries(t)){const s=l.entryConfig,p=s.options?.moduleFederation;(p?.remotes||[]).forEach((e=>{e.endpoint=e=>{const o=t[e];if(!o)throw new Error(`No servedDevServerEntry found via "${e}"`);return urlJoin(o?.devServerHostUri,["/public"])}}));const{devServerPort:c,devServerHostUri:m}=t[n],f={[n]:s},d=urlJoin(m,["public"]),v=await loadWebpackConfig("development",f,mergeOptions(i,{webpack:{publicPath:d}})),h=shouldEnableReactFastRefresh(!0,[n,s],i),g=webpack(splitToMultiCompilerConfigs(f,v,i,h)[0]);a.push(addCompilerToDevServer(g,h,c,r,i));const u=g.name||"";g.hooks.invalid.tap("fileChange",(o=>{const r=relative(e,o||"");logger.info(`file change ➩ ${chalk(["cyan"])(r)}`,u)})),g.hooks.done.tap("compileDone",(()=>{logger.info(`debug page ➩ ${chalk(["cyan"])(o)}`,u)}))}return a};
@@ -1,7 +0,0 @@
1
- import { type EntryMapItem, type EvolveEntryMap } from '../types/types-entry-map.js';
2
- import { type FlatEvolveOptions } from '../types/types-options.js';
3
- /**
4
- * Only fetch single one entry map once `serve`,`build` recycle.
5
- * @returns
6
- */
7
- export declare const assertOnlySingleEntryItem: (entryMap: EvolveEntryMap, evolveOptions: FlatEvolveOptions) => EntryMapItem;
@@ -1 +0,0 @@
1
- import{normalizeEvolveEntryName}from"./normalize-entry-map.js";export const assertOnlySingleEntryItem=(e,r)=>{if(Object.keys(e).length>1)throw new Error("Only single one entry map support right now for `serve`, `build`!");let t;for(const[r,o]of Object.entries(e)){t=[r,o];break}if(!t)throw new Error('No entry map found while "serve", "build" process!');const[o,n]=t;return[normalizeEvolveEntryName(o,r.projectVirtualPath),n]};
@@ -1,8 +0,0 @@
1
- import { type Configuration } from 'webpack';
2
- import { type EvolveEntryMap } from '../types/types-entry-map.js';
3
- import { type FlatEvolveOptions } from '../types/types-options.js';
4
- /**
5
- * Split the `webpack` to make sure that we have separated compiler process for each module
6
- * @param webpackConfig `Omit<Configuration, 'entry'>` webpack final configuration
7
- */
8
- export declare function splitToMultiCompilerConfigs(servedEntries: EvolveEntryMap, webpackConfig: Omit<Configuration, 'entry'>, evolveOptions: FlatEvolveOptions, enabledHmr?: boolean): Configuration[];
@@ -1 +0,0 @@
1
- import{join}from"path";import{mergeOptions}from"@flatjs/common";import{devReactFastRefresh}from"../constants.js";import{normalizeEvolveEntryName}from"./normalize-entry-map.js";export function splitToMultiCompilerConfigs(e,t,r,o=!1){const n=[];for(const[t,o]of Object.entries(e)){const e=normalizeEvolveEntryName(t,r.projectVirtualPath);n.push({[e]:o.entry})}return n.map((e=>{const r=Object.keys(e)[0];if(o){e[join(r,devReactFastRefresh.reactRefreshSetup)]=["@pmmmwh/react-refresh-webpack-plugin/client/ReactRefreshEntry.js"]}return mergeOptions(t,{name:r,entry:e})}))}
@@ -1,13 +0,0 @@
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>;
@@ -1 +0,0 @@
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})}))}))};