@flatjs/evolve 2.1.0-next.0 → 2.1.0-next.10
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/constants.d.ts +9 -0
- package/dist/constants.js +1 -1
- package/dist/create-webpack/create-optimization.d.ts +1 -1
- package/dist/create-webpack/create-optimization.js +1 -1
- package/dist/create-webpack/create-plugins.d.ts +1 -1
- package/dist/create-webpack/create-plugins.js +1 -1
- package/dist/create-webpack/create-rule-sets.d.ts +1 -1
- package/dist/create-webpack/create-rule-sets.js +1 -1
- package/dist/create-webpack/load-webpack-config.js +1 -1
- package/dist/create-webpack/rule-sets/rule-assets.d.ts +2 -2
- package/dist/create-webpack/rule-sets/rule-assets.js +1 -1
- package/dist/default-options.js +1 -1
- package/dist/dev-server/create-dev-server-compiler-task.d.ts +3 -0
- package/dist/dev-server/create-dev-server-compiler-task.js +1 -0
- package/dist/dev-server/create-dev-server-entries.d.ts +1 -1
- package/dist/dev-server/create-dev-server-entries.js +1 -1
- package/dist/dev-server/index.d.ts +1 -1
- package/dist/dev-server/index.js +1 -1
- package/dist/dev-server/middlewares/get-page-main-html.js +1 -1
- package/dist/dev-server/middlewares/get-page-module-html.js +1 -1
- package/dist/helpers/assert-group-entry-item.d.ts +7 -0
- package/dist/helpers/assert-group-entry-item.js +1 -0
- package/dist/helpers/assert-single-compiler.d.ts +15 -0
- package/dist/helpers/assert-single-compiler.js +1 -0
- package/dist/helpers/delete-object-keys.d.ts +11 -0
- package/dist/helpers/delete-object-keys.js +1 -0
- package/dist/helpers/flat-entry-map.d.ts +8 -0
- package/dist/helpers/flat-entry-map.js +1 -0
- package/dist/helpers/get-runtime-cdn-base.d.ts +2 -0
- package/dist/helpers/get-runtime-cdn-base.js +1 -0
- package/dist/helpers/index.d.ts +12 -2
- package/dist/helpers/index.js +1 -1
- package/dist/helpers/is-deep-equal.d.ts +9 -0
- package/dist/helpers/is-deep-equal.js +1 -0
- package/dist/helpers/merge-babel-options.js +1 -1
- package/dist/helpers/normalize-check-entry-options.d.ts +10 -0
- package/dist/helpers/normalize-check-entry-options.js +1 -0
- package/dist/helpers/normalize-entry-map.d.ts +1 -0
- package/dist/helpers/normalize-entry-map.js +1 -1
- package/dist/helpers/normalize-group-name.d.ts +8 -0
- package/dist/helpers/normalize-group-name.js +1 -0
- package/dist/helpers/normalize-template-inject-tokens.d.ts +16 -0
- package/dist/helpers/normalize-template-inject-tokens.js +1 -0
- package/dist/helpers/should-enable-react-fast-refresh.js +1 -1
- package/dist/helpers/split-to-entry-group.d.ts +53 -0
- package/dist/helpers/split-to-entry-group.js +1 -0
- package/dist/helpers/verify-group-entry-options.d.ts +9 -0
- package/dist/helpers/verify-group-entry-options.js +1 -0
- package/dist/main/create-thread-worker.d.ts +29 -14
- package/dist/main/create-thread-worker.js +1 -1
- package/dist/main/prepare-build.d.ts +3 -3
- package/dist/main/prepare-build.js +1 -1
- package/dist/main/prepare-serve.d.ts +1 -1
- package/dist/main/prepare-serve.js +1 -1
- package/dist/main/start-build-dynamic.d.ts +2 -2
- package/dist/main/start-build-dynamic.js +1 -1
- package/dist/main/start-build-worker.d.ts +12 -6
- package/dist/main/start-build-worker.js +1 -1
- package/dist/main/start-build.d.ts +1 -1
- package/dist/main/start-build.js +1 -1
- package/dist/main/start-group-entry-build.d.ts +14 -0
- package/dist/main/start-group-entry-build.js +1 -0
- package/dist/main/start-serve.d.ts +1 -1
- package/dist/plugins/clean-webpack/index.d.ts +1 -1
- package/dist/plugins/clean-webpack/index.js +1 -1
- package/dist/plugins/module-federation/module-federation.d.ts +1 -1
- package/dist/plugins/module-federation/module-federation.js +1 -1
- package/dist/plugins/multi-html/index.d.ts +1 -1
- package/dist/plugins/multi-html/index.js +1 -1
- package/dist/plugins/multi-html/multi-html-cdn-plugin.js +1 -1
- package/dist/plugins/multi-html/multi-html-plugin.d.ts +1 -1
- package/dist/plugins/multi-html/multi-html-plugin.js +1 -1
- package/dist/plugins/ts-checker/index.d.ts +1 -0
- package/dist/plugins/ts-checker/index.js +1 -0
- package/dist/plugins/ts-checker/ts-checker-plugin.d.ts +4 -0
- package/dist/plugins/ts-checker/ts-checker-plugin.js +1 -0
- package/dist/types/types-entry-map.d.ts +16 -2
- package/dist/types/types-loader-options.d.ts +0 -1
- package/dist/types/types-modular-import.d.ts +1 -1
- package/dist/types/types-options.d.ts +18 -10
- package/dist/types/types-threads-options.d.ts +25 -0
- package/dist/types/types-threads-options.js +1 -0
- package/package.json +61 -56
- package/templates/html-plugin/index-dev.html +2 -2
- package/templates/html-plugin/index-inte.html +2 -2
- package/templates/html-plugin/index-inte2.html +2 -2
- package/templates/html-plugin/index-inte3.html +2 -2
- package/templates/html-plugin/index-inte4.html +2 -2
- package/templates/html-plugin/index-me.html +2 -2
- package/templates/html-plugin/index-prod.html +2 -2
- package/templates/html-plugin/index-rc.html +2 -2
- package/templates/html-plugin/index-uat.html +2 -2
- package/templates/module.html +2 -2
- package/dist/dev-server/create-dev-server-compiler-tasks.d.ts +0 -3
- package/dist/dev-server/create-dev-server-compiler-tasks.js +0 -1
- package/dist/helpers/assert-only-single-entry-item.d.ts +0 -7
- package/dist/helpers/assert-only-single-entry-item.js +0 -1
- package/dist/helpers/split-to-multi-compiler.d.ts +0 -8
- package/dist/helpers/split-to-multi-compiler.js +0 -1
- package/dist/main/start-one-entry-build.d.ts +0 -13
- 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
|
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
|
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
|
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
|
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
|
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
|
57
|
+
<script src="<%= bodyAfterScripts[index]%>"></script>
|
58
58
|
<% } %>
|
59
59
|
<% } %>
|
60
60
|
</body>
|
package/templates/module.html
CHANGED
@@ -56,7 +56,7 @@
|
|
56
56
|
|
57
57
|
<% if (headBeforeScripts) { %>
|
58
58
|
<% for (let index = 0; index < headBeforeScripts.length; index++) { %>
|
59
|
-
<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
|
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})}))}))};
|