@flatjs/evolve 2.1.0-next.31 → 2.1.0-next.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/constants.d.ts +0 -9
- package/dist/constants.js +1 -1
- package/dist/create-webpack/create-externals.d.ts +1 -1
- package/dist/create-webpack/create-externals.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-output.d.ts +1 -1
- package/dist/create-webpack/create-performance.d.ts +1 -1
- package/dist/create-webpack/create-plugins.d.ts +1 -2
- package/dist/create-webpack/create-plugins.js +1 -1
- package/dist/create-webpack/create-resolve.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.d.ts +1 -2
- 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/create-webpack/rule-sets/rule-css.js +1 -1
- package/dist/create-webpack/rule-sets/rule-scripts.d.ts +0 -2
- package/dist/create-webpack/rule-sets/rule-scripts.js +1 -1
- package/dist/create-webpack/types.d.ts +1 -1
- package/dist/default-options.js +1 -1
- package/dist/define-config/define-config.d.ts +2 -2
- package/dist/dev-server/add-compiler-to-dev-server.js +1 -1
- package/dist/dev-server/create-dev-server-compiler-tasks.d.ts +3 -0
- package/dist/dev-server/create-dev-server-compiler-tasks.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/create-dev-server.js +1 -1
- package/dist/dev-server/index.d.ts +3 -3
- package/dist/dev-server/index.js +1 -1
- package/dist/dev-server/middlewares/get-bundle-asset.d.ts +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-only-single-entry-item.d.ts +7 -0
- package/dist/helpers/assert-only-single-entry-item.js +1 -0
- package/dist/helpers/get-bundle-file-name.d.ts +1 -1
- package/dist/helpers/index.d.ts +4 -18
- package/dist/helpers/index.js +1 -1
- package/dist/helpers/json-serializer.js +1 -1
- package/dist/helpers/merge-babel-options.d.ts +1 -1
- package/dist/helpers/merge-babel-options.js +1 -1
- package/dist/helpers/normalize-entry-map.d.ts +0 -1
- package/dist/helpers/normalize-entry-map.js +1 -1
- package/dist/helpers/open-page.js +1 -1
- package/dist/helpers/refresh-evolve-mock-options.js +1 -1
- package/dist/helpers/script-injects.d.ts +1 -1
- package/dist/helpers/should-enable-react-fast-refresh.js +1 -1
- package/dist/helpers/split-to-multi-compiler.d.ts +8 -0
- package/dist/helpers/split-to-multi-compiler.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/load-config/load-evolve-config.js +1 -1
- package/dist/loaders/loader-icon.cjs +1 -2
- package/dist/main/create-thread-worker.d.ts +14 -29
- package/dist/main/create-thread-worker.js +1 -1
- package/dist/main/index.d.ts +1 -1
- package/dist/main/index.js +1 -1
- package/dist/main/prepare-build.d.ts +3 -4
- 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 +6 -17
- package/dist/main/start-build-worker.js +1 -1
- package/dist/main/start-build.d.ts +2 -3
- package/dist/main/start-build.js +1 -1
- package/dist/main/start-one-entry-build.d.ts +13 -0
- package/dist/main/start-one-entry-build.js +1 -0
- package/dist/main/start-serve.d.ts +1 -1
- package/dist/main/start-serve.js +1 -1
- package/dist/minimizer/create-minimizers.js +1 -1
- package/dist/minimizer/image-minimizer.js +1 -1
- package/dist/minimizer/terser-minimizer.js +1 -1
- package/dist/plugins/circular-dependency/circular-dependency-plugin.js +1 -1
- package/dist/plugins/clean-webpack/index.d.ts +1 -1
- package/dist/plugins/clean-webpack/index.js +1 -1
- package/dist/plugins/define-variable/define-variable-plugin.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/types/index.d.ts +1 -3
- package/dist/types/index.js +1 -1
- package/dist/types/types-dev-server.d.ts +6 -17
- package/dist/types/types-entry-map.d.ts +3 -21
- package/dist/types/types-loader-options.d.ts +9 -31
- package/dist/types/types-options.d.ts +15 -30
- package/dist/types/types-webpack.d.ts +2 -5
- package/package.json +61 -69
- 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/compiler/create-global-compiler.d.ts +0 -2
- package/dist/compiler/create-global-compiler.js +0 -1
- package/dist/create-webpack/load-watch-options.d.ts +0 -12
- package/dist/create-webpack/load-watch-options.js +0 -1
- package/dist/dev-server/create-dev-server-compiler-task.d.ts +0 -3
- package/dist/dev-server/create-dev-server-compiler-task.js +0 -1
- package/dist/helpers/assert-group-entry-item.d.ts +0 -7
- package/dist/helpers/assert-group-entry-item.js +0 -1
- package/dist/helpers/assert-single-compiler.d.ts +0 -15
- package/dist/helpers/assert-single-compiler.js +0 -1
- package/dist/helpers/check-runtime-env.d.ts +0 -4
- package/dist/helpers/check-runtime-env.js +0 -1
- package/dist/helpers/custom-listr-renderer.d.ts +0 -41
- package/dist/helpers/custom-listr-renderer.js +0 -1
- package/dist/helpers/custom-message-channel.d.ts +0 -17
- package/dist/helpers/custom-message-channel.js +0 -1
- package/dist/helpers/delete-object-keys.d.ts +0 -11
- package/dist/helpers/delete-object-keys.js +0 -1
- package/dist/helpers/flat-entry-map.d.ts +0 -8
- package/dist/helpers/flat-entry-map.js +0 -1
- package/dist/helpers/format-spinner-text.d.ts +0 -8
- package/dist/helpers/format-spinner-text.js +0 -1
- package/dist/helpers/get-runtime-cdn-base.d.ts +0 -2
- package/dist/helpers/get-runtime-cdn-base.js +0 -1
- package/dist/helpers/get-stats-file-name.d.ts +0 -2
- package/dist/helpers/get-stats-file-name.js +0 -1
- package/dist/helpers/is-deep-equal.d.ts +0 -9
- package/dist/helpers/is-deep-equal.js +0 -1
- package/dist/helpers/normalize-check-entry-options.d.ts +0 -10
- package/dist/helpers/normalize-check-entry-options.js +0 -1
- package/dist/helpers/normalize-entry-module-absolute-path.d.ts +0 -10
- package/dist/helpers/normalize-entry-module-absolute-path.js +0 -1
- package/dist/helpers/normalize-group-name.d.ts +0 -8
- package/dist/helpers/normalize-group-name.js +0 -1
- package/dist/helpers/normalize-template-inject-tokens.d.ts +0 -16
- package/dist/helpers/normalize-template-inject-tokens.js +0 -1
- package/dist/helpers/split-to-entry-group.d.ts +0 -52
- package/dist/helpers/split-to-entry-group.js +0 -1
- package/dist/helpers/verify-group-entry-options.d.ts +0 -9
- package/dist/helpers/verify-group-entry-options.js +0 -1
- package/dist/main/prepare-analyzer.d.ts +0 -9
- package/dist/main/prepare-analyzer.js +0 -1
- package/dist/main/start-analyzer.d.ts +0 -10
- package/dist/main/start-analyzer.js +0 -1
- package/dist/main/start-group-entry-build.d.ts +0 -15
- package/dist/main/start-group-entry-build.js +0 -1
- package/dist/plugins/stats-webpack/helper-write-stats.d.ts +0 -28
- package/dist/plugins/stats-webpack/helper-write-stats.js +0 -1
- package/dist/plugins/stats-webpack/index.d.ts +0 -12
- package/dist/plugins/stats-webpack/index.js +0 -1
- package/dist/plugins/stats-webpack/stats-webpack-plugin.d.ts +0 -25
- package/dist/plugins/stats-webpack/stats-webpack-plugin.js +0 -1
- package/dist/plugins/ts-checker/ts-checker-guard-plugin.d.ts +0 -13
- package/dist/plugins/ts-checker/ts-checker-guard-plugin.js +0 -1
- package/dist/plugins/ts-checker/ts-checker-plugin.d.ts +0 -3
- package/dist/plugins/ts-checker/ts-checker-plugin.js +0 -1
- package/dist/types/types-analyzer.d.ts +0 -70
- package/dist/types/types-analyzer.js +0 -1
- package/dist/types/types-cli-options.d.ts +0 -12
- package/dist/types/types-cli-options.js +0 -1
- package/dist/types/types-global-compiler-options.d.ts +0 -7
- package/dist/types/types-global-compiler-options.js +0 -1
- package/dist/types/types-threads-options.d.ts +0 -18
- package/dist/types/types-threads-options.js +0 -1
- package/templates/html-plugin/index-ntv.html +0 -61
@@ -1,8 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Normalizes the group name based on the project virtual path and index.
|
3
|
-
*
|
4
|
-
* @param projectVirtualPath - The virtual path of the project.
|
5
|
-
* @param index - The index used to generate the group name.
|
6
|
-
* @returns The normalized group name.
|
7
|
-
*/
|
8
|
-
export declare const normalizeGroupName: (projectVirtualPath: string, index: number) => string;
|
@@ -1 +0,0 @@
|
|
1
|
-
import{normalizeEvolveEntryName}from"./normalize-entry-map.js";export const normalizeGroupName=(r,o)=>{const e=Array.from({length:26},((r,o)=>String.fromCharCode(65+o))),m=[...Array.from({length:26},((r,o)=>String.fromCharCode(97+o))),...e],n=Math.floor(o/52);return normalizeEvolveEntryName(`${m[o%52]}${n||""}`,r)};
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import { type EvolveEntryItemOption } from '../types/types-entry-map.js';
|
2
|
-
import { type HtmlPluginConfigConfigData } from './get-html-plugin-config.js';
|
3
|
-
/**
|
4
|
-
* Normalizes the template inject tokens based on the provided configuration data and entry options.
|
5
|
-
*
|
6
|
-
* @param configData - The configuration data for the HTML plugin.
|
7
|
-
* @param currEntryOption - The current entry option for the evolve item.
|
8
|
-
* @returns An object containing the normalized template inject tokens.
|
9
|
-
*/
|
10
|
-
export declare const normalizeTemplateInjectTokens: (configData: HtmlPluginConfigConfigData, currEntryOption?: EvolveEntryItemOption) => {
|
11
|
-
headBeforeHtmlTags?: string[];
|
12
|
-
inlineScripts?: string[];
|
13
|
-
headBeforeStyles?: string[];
|
14
|
-
headBeforeScripts: string[];
|
15
|
-
bodyAfterScripts: string[];
|
16
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
import{getHtmlPluginConfig}from"./get-html-plugin-config.js";export const normalizeTemplateInjectTokens=(e,t)=>({headBeforeHtmlTags:getHtmlPluginConfig("headBeforeHtmlTags",e,t?.headBeforeHtmlTags),inlineScripts:getHtmlPluginConfig("inlineScripts",e,t?.inlineScripts),headBeforeStyles:getHtmlPluginConfig("headBeforeStyles",e,t?.headBeforeStyles),headBeforeScripts:getHtmlPluginConfig("headBeforeScripts",e,t?.headBeforeScripts),bodyAfterScripts:getHtmlPluginConfig("bodyAfterScripts",e,t?.bodyAfterScripts)});
|
@@ -1,52 +0,0 @@
|
|
1
|
-
import { type EvolveEntryItemOption, type EvolveEntryMap, type EvolveEntryMapContent } from '../types/types-entry-map.js';
|
2
|
-
import { type FlatEvolveOptions } from '../types/types-options.js';
|
3
|
-
/**
|
4
|
-
* Groups the manual entries based on their group names.
|
5
|
-
* @param manualEntries - The map of manual entries.
|
6
|
-
* @returns An array of grouped manual entries.
|
7
|
-
*/
|
8
|
-
export declare const manualGrouping: (manualEntries: (EvolveEntryMapContent & {
|
9
|
-
entryName: string;
|
10
|
-
})[]) => Array<EvolveEntryMap>;
|
11
|
-
/**
|
12
|
-
* Reduces an array of autoEntries into groups based on their options.
|
13
|
-
* Each group is represented by a groupKey and contains an EvolveEntryMap.
|
14
|
-
*
|
15
|
-
* @param evolveOptions - The FlatEvolveOptions object.
|
16
|
-
* @param autoEntries - An array of EvolveEntryMapContent objects with an additional entryName property.
|
17
|
-
* @param ignoreOptionKeys - An array of keys to ignore when comparing entry options.
|
18
|
-
* @param serveMode - A boolean indicating whether the function is running in serve mode.
|
19
|
-
* @returns An object where each key represents a groupKey and its value is an EvolveEntryMap.
|
20
|
-
*/
|
21
|
-
export declare const autoGroupingReduce: (autoEntries: (EvolveEntryMapContent & {
|
22
|
-
entryName: string;
|
23
|
-
})[], ignoreOptionKeys: Array<keyof EvolveEntryItemOption> | undefined, serveMode: boolean) => Record<string, EvolveEntryMap>;
|
24
|
-
/**
|
25
|
-
* Assigns a group name to each entry in the evolveEntryMapList based on the projectVirtualPath.
|
26
|
-
*
|
27
|
-
* @param evolveOptions - The options for the evolve process.
|
28
|
-
* @param evolveEntryMapList - The list of evolve entry maps.
|
29
|
-
* @returns The updated list of evolve entry maps with group names assigned.
|
30
|
-
*/
|
31
|
-
export declare const autoAssignGroupName: (evolveOptions: FlatEvolveOptions, evolveEntryMapList: Array<EvolveEntryMap>) => Array<EvolveEntryMap>;
|
32
|
-
/**
|
33
|
-
* Groups the given autoEntries into multiple EvolveEntryMap based on their options.
|
34
|
-
* If the group size exceeds the maximum group size, it will be sliced into smaller groups.
|
35
|
-
*
|
36
|
-
* @param evolveOptions - The FlatEvolveOptions object.
|
37
|
-
* @param autoEntries - An array of EvolveEntryMapContent objects with an additional entryName property.
|
38
|
-
* @param ignoreOptionKeys - An array of keys to ignore in the EvolveEntryItemOption object.
|
39
|
-
* @param serveMode - A boolean indicating whether the serve mode is enabled.
|
40
|
-
* @returns An array of EvolveEntryMap representing the grouped entries.
|
41
|
-
*/
|
42
|
-
export declare const autoGrouping: (evolveOptions: FlatEvolveOptions, autoEntries: (EvolveEntryMapContent & {
|
43
|
-
entryName: string;
|
44
|
-
})[], ignoreOptionKeys: Array<keyof EvolveEntryItemOption> | undefined, serveMode: boolean) => Array<EvolveEntryMap>;
|
45
|
-
/**
|
46
|
-
* Splits the served entries into groups based on the given options.
|
47
|
-
*
|
48
|
-
* @param evolveEntries - The map of served entries.
|
49
|
-
* @param ignoreOptionKeys - The list of option keys to ignore.
|
50
|
-
* @returns An array of evolve entry maps representing the groups.
|
51
|
-
*/
|
52
|
-
export declare const splitToEntryGroup: (evolveEntries: EvolveEntryMap, evolveOptions: FlatEvolveOptions, ignoreOptionKeys: Array<keyof EvolveEntryItemOption> | undefined, serveMode: boolean) => Array<EvolveEntryMap>;
|
@@ -1 +0,0 @@
|
|
1
|
-
import _ from"lodash";import{ignoreEntryOptionKeys}from"../constants.js";import{isDeepEqual}from"./is-deep-equal.js";import{normalizeCheckEntryOptions}from"./normalize-check-entry-options.js";import{normalizeGroupName}from"./normalize-group-name.js";export const manualGrouping=o=>{const e=_.groupBy(o,(o=>o.groupName)),t=[];for(const[,o]of Object.entries(e)){const e=o.reduce(((o,e)=>(o[e.entryName]=_.omitBy(e,"entryName"),o)),{});t.push(e)}return t};export const autoGroupingReduce=(o,e=[],t)=>_.reduce(o,((o,r,n)=>{let s=`auto_grouping_reduce-${n}`;const u=normalizeCheckEntryOptions(t,r.options,e);for(const[r,n]of Object.entries(o)){const o=Object.values(n)[0],i=normalizeCheckEntryOptions(t,o.options,e);if(isDeepEqual(u,i)){s=r;break}}return o[s]=_.merge(o[s],{[r.entryName]:_.omitBy(r,"entryName")}),o}),{});export const autoAssignGroupName=(o,e)=>{const{projectVirtualPath:t}=o,r=[];let n=0;for(const o of e){const e={},s=normalizeGroupName(t,n++);for(const[t,r]of Object.entries(o))r.groupName=s,e[t]=r;r.push(e)}return r};export const autoGrouping=(o,e,t=[],r)=>{const{maxEntryGroupSize:n=10}=o,s=autoGroupingReduce(e,t,r),u=[];for(const[,o]of Object.entries(s)){const e=Object.keys(o);if(e.length>n)for(let t=0;t<e.length;t+=n){const r=e.slice(t,t+n).reduce(((e,t)=>(e[t]=o[t],e)),{});u.push(r)}else u.push(o)}return autoAssignGroupName(o,u)};export const splitToEntryGroup=(o,e,t=ignoreEntryOptionKeys,r)=>{const{isolation:n=!1}=e;if(n){const e=[];for(const[t,r]of Object.entries(o))r.groupName=t,e.push({[t]:r});return e}const s=_.flatMap(o,((o,e)=>({...o,entryName:e}))),u=_.groupBy(s,(o=>o.groupingSource));return[...manualGrouping(u.manual),...autoGrouping(e,u.auto,t,r)]};
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import { type EvolveEntryItemOption, type EvolveEntryMap } from '../types/types-entry-map.js';
|
2
|
-
/**
|
3
|
-
* Verifies if the options of all entries in a group are equal, excluding specified keys.
|
4
|
-
*
|
5
|
-
* @param groupEvolveEntryMap - The map of group entries.
|
6
|
-
* @param ignoreOptionKeys - The keys to be ignored when comparing options.
|
7
|
-
* @returns A boolean indicating if the options of all entries are equal.
|
8
|
-
*/
|
9
|
-
export declare const verifyGroupEntryOptions: (groupEvolveEntryMap: EvolveEntryMap, ignoreOptionKeys: Array<keyof EvolveEntryItemOption> | undefined, serveMode: boolean) => boolean;
|
@@ -1 +0,0 @@
|
|
1
|
-
import{ignoreEntryOptionKeys}from"../constants.js";import{isDeepEqual}from"./is-deep-equal.js";import{normalizeCheckEntryOptions}from"./normalize-check-entry-options.js";export const verifyGroupEntryOptions=(n,o=ignoreEntryOptionKeys,t)=>{const e=Object.values(n);if(1===e.length)return!0;const r=e.shift(),i=normalizeCheckEntryOptions(t,r?.options,o);return e.every((n=>isDeepEqual(i,normalizeCheckEntryOptions(t,n.options,o))))};
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import { type AnalyzeServeOptions } from '../types/types-analyzer.js';
|
2
|
-
/**
|
3
|
-
* Prepares and analyzes webpack bundle stats.
|
4
|
-
*
|
5
|
-
* @param statsPaths - An array of paths to the webpack bundle stats files.
|
6
|
-
* @param options - Options for analyzing the webpack bundle stats.
|
7
|
-
* @returns A promise that resolves to a boolean indicating whether the analysis was successful.
|
8
|
-
*/
|
9
|
-
export declare const prepareAnalyzer: (statsPaths: string[], options: AnalyzeServeOptions) => Promise<boolean>;
|
@@ -1 +0,0 @@
|
|
1
|
-
import _ from"lodash";import{createReadStream}from"node:fs";import{start}from"webpack-bundle-analyzer";import{cancel,confirm,intro,isCancel,multiselect,outro}from"@clack/prompts";import{parseChunked}from"@discoveryjs/json-ext";import{chalk,logger}from"@flatjs/common";import{moduleName}from"../constants.js";import{formatSpinnerText}from"../helpers/format-spinner-text.js";import{getStatsFileName}from"../helpers/get-stats-file-name.js";const readStatsFromFile=async e=>parseChunked(createReadStream(e,{encoding:"utf8"})),getStatsFilenames=async e=>{const t=[];for(const[r,a]of Object.entries(e)){const e=_.flattenDeep(Object.values(a.assetsByChunkName||{})).filter((e=>e.endsWith(".js"))),s=`Group ${chalk(["magenta"])(a.name||"")} \n${formatSpinnerText(e,`${chalk(["cyan"])("◆ ")}`)}`;t.push({value:r,label:s})}intro("Webpack bundle analyzer");const r=await multiselect({message:"Select entry groups to analyze",required:!0,options:t});if(isCancel(r))return cancel("The process has exited"),process.exit(0);const a=await confirm({message:"Are you sure to perform the analysis?"});return isCancel(a)?(cancel("The process has exited"),process.exit(0)):a?(outro("You're all set!"),r):getStatsFilenames(e)},startServer=async(e,t)=>{try{return await start(e,t),!0}catch(e){return logger.error(`Failed to start the analyzer serve ${e}`,moduleName),!1}};export const prepareAnalyzer=async(e,t)=>{const r={};for(const t of e){const e=await readStatsFromFile(t);r[getStatsFileName(e)]=e}const a=[],s=await getStatsFilenames(r);for(const e of s)a.push(startServer(r[e],t));return Promise.all(a).then((()=>!0))};
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import { type AnalyzeServeOptions } from '../types/types-analyzer.js';
|
2
|
-
import { FlatEvolveOptions } from '../types/types-options.js';
|
3
|
-
/**
|
4
|
-
* Starts the analysis process for the given evolve options and analyze options.
|
5
|
-
*
|
6
|
-
* @param evolveOptions - The options for the evolve process.
|
7
|
-
* @param analyzeOptions - The options for the analyze process (optional).
|
8
|
-
* @returns A promise that resolves when the analysis process is complete.
|
9
|
-
*/
|
10
|
-
export declare const startAnalyzer: (evolveOptions: FlatEvolveOptions, analyzeOptions?: AnalyzeServeOptions) => Promise<boolean | undefined>;
|
@@ -1 +0,0 @@
|
|
1
|
-
import{join}from"node:path";import{fileWalkSync}from"@armit/file-utility";import{logger,mergeOptions}from"@flatjs/common";import{webpackStatsDir}from"../constants.js";import{prepareAnalyzer}from"./prepare-analyzer.js";export const startAnalyzer=async(t,r={})=>{const{projectCwd:o,webpack:e}=t,n="function"==typeof e?.outputDir?await e.outputDir():e?.outputDir||"public",a=join(o,webpackStatsDir),i=fileWalkSync(["*.json"],{cwd:a});if(!i.length)return void logger.warn(`No stats files found in ${o}. skipping analyze.`);const p={openBrowser:!0,reportTitle:"flatjs_evolve_analyzer",port:0,host:"127.0.0.1",bundleDir:join(o,n),analyzerUrl:t=>{const{listenHost:r,boundAddress:o}=t;return`http://${r}:${o.port}`}},s=mergeOptions(p,r);return await prepareAnalyzer(i,s)};
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import { FlatCliOptions } from '../types/types-cli-options.js';
|
2
|
-
import { type EvolveEntryMap } from '../types/types-entry-map.js';
|
3
|
-
import { type FlatEvolveOptions } from '../types/types-options.js';
|
4
|
-
export type EvolveBuildResult = {
|
5
|
-
name?: string[];
|
6
|
-
warningStats?: unknown;
|
7
|
-
};
|
8
|
-
/**
|
9
|
-
* Starts the build process for a group of entry files.
|
10
|
-
*
|
11
|
-
* @param groupBuildEntry - The map of entry files to be built.
|
12
|
-
* @param evolveOptions - The options for the build process.
|
13
|
-
* @returns A promise that resolves to the build result.
|
14
|
-
*/
|
15
|
-
export declare const startGroupEntryBuild: (groupBuildEntry: EvolveEntryMap, evolveOptions: FlatEvolveOptions, cliOptions?: FlatCliOptions) => Promise<EvolveBuildResult>;
|
@@ -1 +0,0 @@
|
|
1
|
-
import webpack from"webpack";import{loadWebpackConfig}from"../create-webpack/load-webpack-config.js";import{assertSingleCompiler}from"../helpers/assert-single-compiler.js";import{normalizeEvolveEntryName}from"../helpers/normalize-entry-map.js";export const startGroupEntryBuild=async(r,e,n)=>{const o=await loadWebpackConfig("production",r,e,n),t=assertSingleCompiler(r,o,e,!1);return new Promise(((n,o)=>{webpack(t,((t,a)=>{if(t)return o(t);const i=a?.toJson();if(i?.errors?.length)return o(i.errors);if(e.rejectWarnings&&i?.warnings?.length)return o(i.warnings);const{projectVirtualPath:s}=e,p=Object.keys(r).map((r=>normalizeEvolveEntryName(r,s)));n({name:p,warningStats:i?.warnings})}))}))};
|
@@ -1,28 +0,0 @@
|
|
1
|
-
import { Readable } from 'node:stream';
|
2
|
-
import { StatsCompilation } from 'webpack';
|
3
|
-
/**
|
4
|
-
* A readable stream that serializes a StatsCompilation object into a string representation.
|
5
|
-
*/
|
6
|
-
export declare class StatsSerializeStream extends Readable {
|
7
|
-
private indentLevel;
|
8
|
-
private stringifier;
|
9
|
-
/**
|
10
|
-
* Creates an instance of StatsSerializeStream.
|
11
|
-
* @param stats - The StatsCompilation object to be serialized.
|
12
|
-
*/
|
13
|
-
constructor(stats: StatsCompilation);
|
14
|
-
/**
|
15
|
-
* Gets the indentation string based on the current indent level.
|
16
|
-
*/
|
17
|
-
get indent(): string;
|
18
|
-
/**
|
19
|
-
* Implements the _read method required by the Readable stream.
|
20
|
-
*/
|
21
|
-
_read(): void;
|
22
|
-
/**
|
23
|
-
* Generator function that recursively converts an object into a string representation.
|
24
|
-
* @param obj - The object to be serialized.
|
25
|
-
*/
|
26
|
-
_stringify(obj: StatsCompilation): any;
|
27
|
-
}
|
28
|
-
export declare const writeStats: (stats: StatsCompilation, filepath: string) => Promise<unknown>;
|
@@ -1 +0,0 @@
|
|
1
|
-
import{createWriteStream}from"node:fs";import{Readable}from"node:stream";export class StatsSerializeStream extends Readable{constructor(e){super(),this.indentLevel=0,this.stringifier=this._stringify(e)}get indent(){return" ".repeat(this.indentLevel)}_read(){let e=!0;for(;e;){const{value:t,done:i}=this.stringifier.next();i?(this.push(null),e=!1):e=this.push(t)}}*_stringify(e){if("string"==typeof e||"number"==typeof e||"boolean"==typeof e||null===e)yield JSON.stringify(e);else if(Array.isArray(e)){yield"[",this.indentLevel++;let t=!0;for(let i of e)void 0===i&&(i=null),yield`${t?"":","}\n${this.indent}`,yield*this._stringify(i),t=!1;this.indentLevel--,yield e.length?`\n${this.indent}]`:"]"}else{yield"{",this.indentLevel++;let t=!0;const i=Object.entries(e);for(const[e,n]of i)void 0!==n&&(yield`${t?"":","}\n${this.indent}${JSON.stringify(e)}: `,yield*this._stringify(n),t=!1);this.indentLevel--,yield i.length?`\n${this.indent}}`:"}"}}}export const writeStats=(e,t)=>new Promise(((i,n)=>{new StatsSerializeStream(e).on("end",i).on("error",n).pipe(createWriteStream(t))}));
|
@@ -1,12 +0,0 @@
|
|
1
|
-
import { type WebpackPlugin } from '../../create-webpack/types.js';
|
2
|
-
import { FlatCliOptions } from '../../types/types-cli-options.js';
|
3
|
-
import { type FlatEvolveOptions } from '../../types/types-options.js';
|
4
|
-
/**
|
5
|
-
* Creates an array of Webpack plugins for generating stats files.
|
6
|
-
*
|
7
|
-
* @param serveMode - A boolean indicating whether the application is running in serve mode.
|
8
|
-
* @param evolveOptions - The options for the evolve package.
|
9
|
-
* @param cliOptions - The options passed through the command-line interface.
|
10
|
-
* @returns An array of Webpack plugins.
|
11
|
-
*/
|
12
|
-
export declare const createStatsWebpackPlugin: (serveMode: boolean, evolveOptions: FlatEvolveOptions, cliOptions?: FlatCliOptions) => WebpackPlugin[];
|
@@ -1 +0,0 @@
|
|
1
|
-
import{StatsWebpackPlugin}from"./stats-webpack-plugin.js";export const createStatsWebpackPlugin=(t,e,a={})=>{const{analyzer:r=!1}=a;return t||!r?[]:[new StatsWebpackPlugin({verbose:!0,projectCwd:e.projectCwd})]};
|
@@ -1,25 +0,0 @@
|
|
1
|
-
import { Compiler, Stats, StatsCompilation } 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
|
-
export declare class StatsWebpackPlugin {
|
16
|
-
private readonly verbose;
|
17
|
-
private outputPath;
|
18
|
-
private projectCwd;
|
19
|
-
private statsFilename;
|
20
|
-
constructor(options?: Options);
|
21
|
-
apply(compiler: Compiler): void;
|
22
|
-
handleBeforeClean(): void;
|
23
|
-
handleDone(stats: Stats, callback: (error?: Error) => void): Promise<void>;
|
24
|
-
generateStatsFile(stats: StatsCompilation): Promise<void>;
|
25
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
import{rmSync}from"node:fs";import{mkdir}from"node:fs/promises";import{dirname,join,resolve}from"node:path";import{logger}from"@flatjs/common";import{webpackStatsDir}from"../../constants.js";import{getStatsFileName}from"../../helpers/get-stats-file-name.js";import{writeStats}from"./helper-write-stats.js";export class StatsWebpackPlugin{constructor(t={}){this.verbose=!0===t.verbose||!1,this.projectCwd=t.projectCwd||process.cwd(),this.outputPath=join(this.projectCwd,webpackStatsDir)}apply(t){this.handleBeforeClean();t.hooks.done.tapAsync("stats-webpack-plugin",((t,e)=>{this.statsFilename=getStatsFileName(t),this.handleDone(t,e)}))}handleBeforeClean(){rmSync(this.outputPath,{force:!0,recursive:!0})}async handleDone(t,e){try{await this.generateStatsFile(t.toJson()),e()}catch(t){e(t)}}async generateStatsFile(t){const e=resolve(this.outputPath,this.statsFilename);await mkdir(dirname(e),{recursive:!0});try{await writeStats(t,e),this.verbose&&logger.debug(`stats-webpack-plugin: saved stats file to ${e}`)}catch(t){this.verbose&&logger.error(`stats-webpack-plugin: error saving stats file to ${e}: ${t}`)}}}
|
@@ -1,13 +0,0 @@
|
|
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
|
-
}
|
@@ -1 +0,0 @@
|
|
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 +0,0 @@
|
|
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,70 +0,0 @@
|
|
1
|
-
import { type StatsCompilation } from 'webpack';
|
2
|
-
type ExcludeAssetsPatternFn = (assetName: string) => boolean;
|
3
|
-
type ExcludeAssetsPattern = string | RegExp | ExcludeAssetsPatternFn;
|
4
|
-
interface AddressInfo {
|
5
|
-
address: string;
|
6
|
-
family: string;
|
7
|
-
port: number;
|
8
|
-
}
|
9
|
-
/**
|
10
|
-
* Options for serving and analyzing a project.
|
11
|
-
*/
|
12
|
-
export type AnalyzeServeOptions = {
|
13
|
-
/**
|
14
|
-
* The port number to listen on.
|
15
|
-
* @default 0 (auto-assign a port)
|
16
|
-
*/
|
17
|
-
port?: number;
|
18
|
-
/**
|
19
|
-
* The host address to bind to.
|
20
|
-
* @default '127.0.0.1'
|
21
|
-
*/
|
22
|
-
host?: string;
|
23
|
-
/**
|
24
|
-
* Whether to automatically open the browser.
|
25
|
-
* @default true
|
26
|
-
*/
|
27
|
-
openBrowser?: boolean;
|
28
|
-
/**
|
29
|
-
* The directory where the bundled files are located.
|
30
|
-
*/
|
31
|
-
bundleDir?: string;
|
32
|
-
/**
|
33
|
-
* Module sizes to show in the report by default.
|
34
|
-
* Should be one of "parsed", "stat", or "gzip".
|
35
|
-
* @default 'parsed'
|
36
|
-
*/
|
37
|
-
defaultSizes?: 'parsed' | 'stat' | 'gzip' | undefined;
|
38
|
-
/**
|
39
|
-
* Patterns that will be used to match against asset names to exclude them from the report.
|
40
|
-
* If the pattern is a string, it will be converted to a regular expression via `new RegExp(str)`.
|
41
|
-
* If the pattern is a function, it should have the following signature: `(assetName: string) => boolean`
|
42
|
-
* and should return true to exclude the matching asset.
|
43
|
-
* If multiple patterns are provided, an asset should match at least one of them to be excluded.
|
44
|
-
* @default null
|
45
|
-
*/
|
46
|
-
excludeAssets?: null | ExcludeAssetsPattern | ExcludeAssetsPattern[] | undefined;
|
47
|
-
/**
|
48
|
-
* Content of the HTML title element; or a function of the form `() => string` that provides the content.
|
49
|
-
* @default A function that returns the pretty printed current date and time.
|
50
|
-
*/
|
51
|
-
reportTitle?: string | (() => string) | undefined;
|
52
|
-
/**
|
53
|
-
* The URL printed to the console with server mode.
|
54
|
-
* @default 'http://${listenHost}:${boundAddress.port}'
|
55
|
-
*/
|
56
|
-
analyzerUrl?: (options: {
|
57
|
-
listenPort: string;
|
58
|
-
listenHost: string;
|
59
|
-
boundAddress: AddressInfo;
|
60
|
-
}) => string;
|
61
|
-
};
|
62
|
-
export type BundleStatsMapping = {
|
63
|
-
[statsFilename: string]: StatsCompilation;
|
64
|
-
};
|
65
|
-
export type PromptsOptionValue = {
|
66
|
-
value: string;
|
67
|
-
label: string;
|
68
|
-
hint?: string;
|
69
|
-
};
|
70
|
-
export {};
|
@@ -1 +0,0 @@
|
|
1
|
-
export{};
|
@@ -1,12 +0,0 @@
|
|
1
|
-
export interface FlatCliOptions {
|
2
|
-
/**
|
3
|
-
* Visualize size of webpack output files with an interactive zoomable treemap.
|
4
|
-
*
|
5
|
-
* With build mode `production` only
|
6
|
-
*
|
7
|
-
* This Configuration take effect only during the build phase
|
8
|
-
*
|
9
|
-
* @default false
|
10
|
-
*/
|
11
|
-
analyzer?: boolean;
|
12
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
export{};
|
@@ -1 +0,0 @@
|
|
1
|
-
export{};
|
@@ -1,18 +0,0 @@
|
|
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
|
-
* Default timeout to wait for close when Thread shuts down, in milliseconds
|
14
|
-
*
|
15
|
-
* @default 60000
|
16
|
-
*/
|
17
|
-
idleTimeout?: number;
|
18
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
export{};
|
@@ -1,61 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta charset="utf-8" />
|
5
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
6
|
-
<meta http-equiv="Expires" content="0" />
|
7
|
-
<meta http-equiv="Pragma" content="no-cache" />
|
8
|
-
<meta http-equiv="Cache-control" content="no-cache" />
|
9
|
-
<meta http-equiv="Cache" content="no-cache" />
|
10
|
-
<meta name="format-detection" content="telephone=no,email=no" />
|
11
|
-
<meta name="apple-mobile-web-app-capable" content="yes" />
|
12
|
-
<meta name="apple-touch-fullscreen" content="yes" />
|
13
|
-
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
14
|
-
<meta
|
15
|
-
name="viewport"
|
16
|
-
content="width=device-width,initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, viewport-fit=cover"
|
17
|
-
/>
|
18
|
-
<title><%= title %></title>
|
19
|
-
|
20
|
-
<% if (headBeforeHtmlTags) { %>
|
21
|
-
<% for (let index = 0; index < headBeforeHtmlTags.length; index++) { %>
|
22
|
-
<%= headBeforeHtmlTags[index] %>
|
23
|
-
<% } %>
|
24
|
-
<% } %>
|
25
|
-
<% if (inlineScripts) { %>
|
26
|
-
<script>
|
27
|
-
<% for (let index = 0; index < inlineScripts.length; index++) { %>
|
28
|
-
<%= inlineScripts[index] %>
|
29
|
-
<% } %>
|
30
|
-
</script>
|
31
|
-
<% } %>
|
32
|
-
<% if (viewport) { %>
|
33
|
-
<script>
|
34
|
-
<%= viewport %>
|
35
|
-
</script>
|
36
|
-
<% } %>
|
37
|
-
<% if (favicon) { %>
|
38
|
-
<link rel="shortcut icon" href="<%= favicon %>" type="image/x-icon" />
|
39
|
-
<link rel="icon" href="<%= favicon %>" type="image/x-icon" />
|
40
|
-
<% } %>
|
41
|
-
<% if (headBeforeStyles) { %>
|
42
|
-
<% for (let index = 0; index < headBeforeStyles.length; index++) { %>
|
43
|
-
<link href="<%= headBeforeStyles[index] %>" rel="stylesheet" />
|
44
|
-
<% } %>
|
45
|
-
<% } %>
|
46
|
-
<% if (headBeforeScripts) { %>
|
47
|
-
<% for (let index = 0; index < headBeforeScripts.length; index++) { %>
|
48
|
-
<script src="<%= headBeforeScripts[index]%>"></script>
|
49
|
-
<% } %>
|
50
|
-
<% } %>
|
51
|
-
</head>
|
52
|
-
|
53
|
-
<body>
|
54
|
-
<div id="app"></div>
|
55
|
-
<% if (bodyAfterScripts) { %>
|
56
|
-
<% for (let index = 0; index < bodyAfterScripts.length; index++) { %>
|
57
|
-
<script src="<%= bodyAfterScripts[index]%>"></script>
|
58
|
-
<% } %>
|
59
|
-
<% } %>
|
60
|
-
</body>
|
61
|
-
</html>
|