@flatjs/evolve 2.1.0-next.1 → 2.1.0-next.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. package/dist/constants.d.ts +9 -0
  2. package/dist/constants.js +1 -1
  3. package/dist/create-webpack/create-optimization.d.ts +1 -1
  4. package/dist/create-webpack/create-optimization.js +1 -1
  5. package/dist/create-webpack/create-plugins.d.ts +1 -1
  6. package/dist/create-webpack/create-plugins.js +1 -1
  7. package/dist/create-webpack/create-rule-sets.d.ts +1 -1
  8. package/dist/create-webpack/create-rule-sets.js +1 -1
  9. package/dist/create-webpack/load-webpack-config.js +1 -1
  10. package/dist/create-webpack/rule-sets/rule-assets.d.ts +2 -2
  11. package/dist/create-webpack/rule-sets/rule-assets.js +1 -1
  12. package/dist/default-options.js +1 -1
  13. package/dist/dev-server/create-dev-server-compiler-task.d.ts +3 -0
  14. package/dist/dev-server/create-dev-server-compiler-task.js +1 -0
  15. package/dist/dev-server/create-dev-server-entries.d.ts +1 -1
  16. package/dist/dev-server/create-dev-server-entries.js +1 -1
  17. package/dist/dev-server/index.d.ts +1 -1
  18. package/dist/dev-server/index.js +1 -1
  19. package/dist/dev-server/middlewares/get-page-main-html.js +1 -1
  20. package/dist/dev-server/middlewares/get-page-module-html.js +1 -1
  21. package/dist/helpers/assert-group-entry-item.d.ts +7 -0
  22. package/dist/helpers/assert-group-entry-item.js +1 -0
  23. package/dist/helpers/assert-single-compiler.d.ts +15 -0
  24. package/dist/helpers/assert-single-compiler.js +1 -0
  25. package/dist/helpers/delete-object-keys.d.ts +11 -0
  26. package/dist/helpers/delete-object-keys.js +1 -0
  27. package/dist/helpers/flat-entry-map.d.ts +8 -0
  28. package/dist/helpers/flat-entry-map.js +1 -0
  29. package/dist/helpers/get-runtime-cdn-base.d.ts +2 -0
  30. package/dist/helpers/get-runtime-cdn-base.js +1 -0
  31. package/dist/helpers/index.d.ts +12 -2
  32. package/dist/helpers/index.js +1 -1
  33. package/dist/helpers/is-deep-equal.d.ts +9 -0
  34. package/dist/helpers/is-deep-equal.js +1 -0
  35. package/dist/helpers/normalize-check-entry-options.d.ts +10 -0
  36. package/dist/helpers/normalize-check-entry-options.js +1 -0
  37. package/dist/helpers/normalize-entry-map.d.ts +1 -0
  38. package/dist/helpers/normalize-entry-map.js +1 -1
  39. package/dist/helpers/normalize-group-name.d.ts +8 -0
  40. package/dist/helpers/normalize-group-name.js +1 -0
  41. package/dist/helpers/normalize-template-inject-tokens.d.ts +16 -0
  42. package/dist/helpers/normalize-template-inject-tokens.js +1 -0
  43. package/dist/helpers/should-enable-react-fast-refresh.js +1 -1
  44. package/dist/helpers/split-to-entry-group.d.ts +53 -0
  45. package/dist/helpers/split-to-entry-group.js +1 -0
  46. package/dist/helpers/verify-group-entry-options.d.ts +9 -0
  47. package/dist/helpers/verify-group-entry-options.js +1 -0
  48. package/dist/main/create-thread-worker.d.ts +29 -14
  49. package/dist/main/create-thread-worker.js +1 -1
  50. package/dist/main/prepare-build.d.ts +3 -3
  51. package/dist/main/prepare-build.js +1 -1
  52. package/dist/main/prepare-serve.d.ts +1 -1
  53. package/dist/main/prepare-serve.js +1 -1
  54. package/dist/main/start-build-dynamic.d.ts +2 -2
  55. package/dist/main/start-build-dynamic.js +1 -1
  56. package/dist/main/start-build-worker.d.ts +12 -6
  57. package/dist/main/start-build-worker.js +1 -1
  58. package/dist/main/start-build.d.ts +1 -1
  59. package/dist/main/start-build.js +1 -1
  60. package/dist/main/start-group-entry-build.d.ts +14 -0
  61. package/dist/main/start-group-entry-build.js +1 -0
  62. package/dist/main/start-serve.d.ts +1 -1
  63. package/dist/plugins/clean-webpack/index.d.ts +1 -1
  64. package/dist/plugins/clean-webpack/index.js +1 -1
  65. package/dist/plugins/module-federation/module-federation.d.ts +1 -1
  66. package/dist/plugins/module-federation/module-federation.js +1 -1
  67. package/dist/plugins/multi-html/index.d.ts +1 -1
  68. package/dist/plugins/multi-html/index.js +1 -1
  69. package/dist/plugins/multi-html/multi-html-cdn-plugin.js +1 -1
  70. package/dist/plugins/multi-html/multi-html-plugin.d.ts +1 -1
  71. package/dist/plugins/multi-html/multi-html-plugin.js +1 -1
  72. package/dist/plugins/ts-checker/index.d.ts +1 -0
  73. package/dist/plugins/ts-checker/index.js +1 -0
  74. package/dist/plugins/ts-checker/ts-checker-plugin.d.ts +4 -0
  75. package/dist/plugins/ts-checker/ts-checker-plugin.js +1 -0
  76. package/dist/types/types-entry-map.d.ts +16 -2
  77. package/dist/types/types-options.d.ts +18 -10
  78. package/dist/types/types-threads-options.d.ts +25 -0
  79. package/dist/types/types-threads-options.js +1 -0
  80. package/package.json +61 -56
  81. package/templates/html-plugin/index-dev.html +2 -2
  82. package/templates/html-plugin/index-inte.html +2 -2
  83. package/templates/html-plugin/index-inte2.html +2 -2
  84. package/templates/html-plugin/index-inte3.html +2 -2
  85. package/templates/html-plugin/index-inte4.html +2 -2
  86. package/templates/html-plugin/index-me.html +2 -2
  87. package/templates/html-plugin/index-prod.html +2 -2
  88. package/templates/html-plugin/index-rc.html +2 -2
  89. package/templates/html-plugin/index-uat.html +2 -2
  90. package/templates/module.html +2 -2
  91. package/dist/dev-server/create-dev-server-compiler-tasks.d.ts +0 -3
  92. package/dist/dev-server/create-dev-server-compiler-tasks.js +0 -1
  93. package/dist/helpers/assert-only-single-entry-item.d.ts +0 -7
  94. package/dist/helpers/assert-only-single-entry-item.js +0 -1
  95. package/dist/helpers/split-to-multi-compiler.d.ts +0 -8
  96. package/dist/helpers/split-to-multi-compiler.js +0 -1
  97. package/dist/main/start-one-entry-build.d.ts +0 -13
  98. package/dist/main/start-one-entry-build.js +0 -1
@@ -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})}))}))};