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

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
1
  import { type Configuration } from 'webpack';
2
2
  import { type EntryMapItem } from '../types/types-entry-map.js';
3
3
  import { type FlatEvolveWebpackOptions } from '../types/types-webpack.js';
4
- export declare const createExternals: (externals?: FlatEvolveWebpackOptions['externals'], entryItem?: EntryMapItem) => Configuration['externals'];
4
+ export declare const createExternals: (externals?: FlatEvolveWebpackOptions["externals"], entryItem?: EntryMapItem) => Configuration["externals"];
@@ -1,4 +1,4 @@
1
1
  import { type Configuration } from 'webpack';
2
2
  import { type EntryMapItem } from '../types/types-entry-map.js';
3
3
  import { type FlatEvolveOptions } from '../types/types-options.js';
4
- export declare const createOptimization: (serveMode: boolean, evolveOptions: FlatEvolveOptions, entryMapItem: EntryMapItem) => Configuration['optimization'];
4
+ export declare const createOptimization: (serveMode: boolean, evolveOptions: FlatEvolveOptions, entryMapItem: EntryMapItem) => Configuration["optimization"];
@@ -1,4 +1,4 @@
1
1
  import { type Configuration } from 'webpack';
2
2
  import { type EntryMapItem } from '../types/types-entry-map.js';
3
3
  import { type FlatEvolveOptions } from '../types/types-options.js';
4
- export declare const createOutput: (serveMode: boolean, evolveOptions: FlatEvolveOptions, entryItem: EntryMapItem) => Promise<Configuration['output']>;
4
+ export declare const createOutput: (serveMode: boolean, evolveOptions: FlatEvolveOptions, entryItem: EntryMapItem) => Promise<Configuration["output"]>;
@@ -1,2 +1,2 @@
1
1
  import { type FlatEvolveWebpackOptions } from '../types/types-webpack.js';
2
- export declare const createPerformance: (serveMode: boolean, performanceOptions?: FlatEvolveWebpackOptions['performance']) => FlatEvolveWebpackOptions['performance'];
2
+ export declare const createPerformance: (serveMode: boolean, performanceOptions?: FlatEvolveWebpackOptions["performance"]) => FlatEvolveWebpackOptions["performance"];
@@ -1,4 +1,4 @@
1
1
  import { type EntryMapItem } from '../types/types-entry-map.js';
2
2
  import { type FlatEvolveOptions } from '../types/types-options.js';
3
3
  import { type FlatEvolveWebpackOptions } from '../types/types-webpack.js';
4
- export declare const createPlugins: (serveMode: boolean, entryMapItemList: EntryMapItem[], evolveOptions: FlatEvolveOptions) => Promise<FlatEvolveWebpackOptions['plugins']>;
4
+ export declare const createPlugins: (serveMode: boolean, entryMapItemList: EntryMapItem[], evolveOptions: FlatEvolveOptions) => Promise<FlatEvolveWebpackOptions["plugins"]>;
@@ -1,12 +1,12 @@
1
1
  import { type FlatEvolveDevServerOptions } from '../types/types-dev-server.js';
2
- import { type EvolveEntryMap } from '../types/types-entry-map.js';
2
+ import { EntryMapItem } from '../types/types-entry-map.js';
3
3
  import { type FlatEvolveOptions } from '../types/types-options.js';
4
4
  /**
5
5
  * Loads the watch options for webpack configuration.
6
6
  *
7
- * @param entryMap - The map of entry names to their corresponding paths.
7
+ * @param entryMapItemList - The list of entry map items.
8
8
  * @param evolveOptions - The options for the evolve process.
9
9
  * @param originalOptions - The original watch options to be merged with.
10
10
  * @returns The updated watch options for webpack configuration.
11
11
  */
12
- export declare const loadWatchOptions: (entryMap: EvolveEntryMap, evolveOptions: FlatEvolveOptions, originalOptions?: FlatEvolveDevServerOptions['watchOptions']) => FlatEvolveDevServerOptions['watchOptions'];
12
+ export declare const loadWatchOptions: (entryMapItemList: EntryMapItem[], evolveOptions: FlatEvolveOptions, originalOptions?: FlatEvolveDevServerOptions["watchOptions"]) => FlatEvolveDevServerOptions["watchOptions"];
@@ -1 +1 @@
1
- export const loadWatchOptions=(o,t,n={})=>{const{ignored:e=[]}=n,{entryMap:r}=t;for(const[t]of Object.entries(r))o[t]||e.push(`**/${t}/**/*`);return{...n,ignored:e}};
1
+ import{normalizeEvolveEntryName}from"../helpers/normalize-entry-map.js";export const loadWatchOptions=(e,o,r={})=>{const{ignored:n=[]}=r,{entryMap:t,projectVirtualPath:a}=o;for(const[o]of Object.entries(t)){const r=normalizeEvolveEntryName(o,a);e.findIndex((e=>e[0]===r))<0&&n.push(`**/${r}/**/*`)}return{...r,ignored:n}};
@@ -7,4 +7,4 @@ import { type FlatEvolveOptions } from '../types/types-options.js';
7
7
  * @param entryMap The only single one `servedEntry` or `toBuildEntry`
8
8
  * @param overrideOptions The manually override configuration options for flatjsEvolve
9
9
  */
10
- export declare const loadWebpackConfig: (mode: 'production' | 'development', entryMap: EvolveEntryMap, evolveOptions: FlatEvolveOptions) => Promise<Omit<Configuration, 'entry'>>;
10
+ export declare const loadWebpackConfig: (mode: "production" | "development", entryMap: EvolveEntryMap, evolveOptions: FlatEvolveOptions) => Promise<Omit<Configuration, "entry">>;
@@ -1 +1 @@
1
- import{assertGroupEntryItem}from"../helpers/assert-group-entry-item.js";import{createExternals}from"./create-externals.js";import{createOptimization}from"./create-optimization.js";import{createOutput}from"./create-output.js";import{createPerformance}from"./create-performance.js";import{createPlugins}from"./create-plugins.js";import{createResolve}from"./create-resolve.js";import{createRuleSets}from"./create-rule-sets.js";import{loadWatchOptions}from"./load-watch-options.js";export const loadWebpackConfig=async(e,t,r)=>{const a="development"===e,{projectCwd:o,webpack:s,devServer:c}=r,p=loadWatchOptions(t,r,c?.watchOptions),n=assertGroupEntryItem(t,r),i=createRuleSets(a,n,r),m=await createPlugins(a,n,r),l=n[0];return{mode:e,plugins:m,watchOptions:p,output:await createOutput(a,r,l),context:o,target:s?.target??["web","es5"],resolve:createResolve(o,s),module:{rules:i},devtool:a?"eval-source-map":s?.sourceMap||!1,externalsType:s?.externalsType,externals:createExternals(s?.externals,l),performance:createPerformance(a,s?.performance),optimization:createOptimization(a,r,l),infrastructureLogging:s?.infrastructureLogging??{level:"warn"},stats:s?.stats??{preset:"minimal"},cache:{type:"memory"}}};
1
+ import{assertGroupEntryItem}from"../helpers/assert-group-entry-item.js";import{createExternals}from"./create-externals.js";import{createOptimization}from"./create-optimization.js";import{createOutput}from"./create-output.js";import{createPerformance}from"./create-performance.js";import{createPlugins}from"./create-plugins.js";import{createResolve}from"./create-resolve.js";import{createRuleSets}from"./create-rule-sets.js";import{loadWatchOptions}from"./load-watch-options.js";export const loadWebpackConfig=async(e,t,r)=>{const a="development"===e,{projectCwd:o,webpack:s,devServer:c}=r,p=assertGroupEntryItem(t,r),n=loadWatchOptions(p,r,c?.watchOptions),i=createRuleSets(a,p,r),m=await createPlugins(a,p,r),l=p[0];return{mode:e,plugins:m,watchOptions:n,output:await createOutput(a,r,l),context:o,target:s?.target??["web","es5"],resolve:createResolve(o,s),module:{rules:i},devtool:a?"eval-source-map":s?.sourceMap||!1,externalsType:s?.externalsType,externals:createExternals(s?.externals,l),performance:createPerformance(a,s?.performance),optimization:createOptimization(a,r,l),infrastructureLogging:s?.infrastructureLogging??{level:"warn"},stats:s?.stats??{preset:"minimal"},cache:{type:"memory"}}};
@@ -1 +1 @@
1
- export declare const getBundleAsset: (devServerHostUri: string, normalizedCurrEntry: string, extension: '.css' | '.js') => string;
1
+ export declare const getBundleAsset: (devServerHostUri: string, normalizedCurrEntry: string, extension: ".css" | ".js") => string;
@@ -34,4 +34,8 @@ export declare class CustomListrRenderer<Ctx> {
34
34
  * This method is called by the render() and end() methods.
35
35
  */
36
36
  renderTask: () => void;
37
+ /**
38
+ * Prints the memory logs to the console.
39
+ */
40
+ printMemoryLogs(): void;
37
41
  }
@@ -1 +1 @@
1
- import logUpdate from"log-update";import process from"node:process";import{chalk}from"@flatjs/common";const startFrames="win32"===process.platform?["-","\\","|","/"]:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];let startIndex=0;export class CustomListrRenderer{constructor(t){this._tasks=[],this.renderTask=()=>{const t=[];startIndex=++startIndex%startFrames.length;const e=startFrames[startIndex];for(const s of this._tasks)s.isCompleted()?t.push(`${chalk(["green"])("✔")} ${this.formatTextByTemp(s.title,"successfully")}`):s.hasFailed()?t.push(`${chalk(["red"])("✘")} ${this.formatTextByTemp(s.title,"failed")}`):s.isSkipped()?t.push(`${chalk(["gray"])("ℹ")} ${this.formatTextByTemp(s.title,"skipped")}`):t.push(`${chalk(["cyan"])(e)} ${this.formatTextByTemp(s.title,"building")}`);logUpdate(t.join("\n"))},this._tasks=t}static get nonTTY(){return!0}render(){this._id||(this._id=setInterval((()=>{this.renderTask()}),100))}end(){this._id&&(clearInterval(this._id),this._id=void 0),this.renderTask(),logUpdate.done()}formatTextByTemp(t,e,s="$STATUS"){const r={successfully:`${chalk(["green"])("done")}`,failed:`builded ${chalk(["red"])("failed")}`,skipped:`builded ${chalk(["gray"])("skipped")}`,building:chalk(["white"])("compiling...")};return t.replace(s,r[e])}}
1
+ import logUpdate from"log-update";import process from"node:process";import{chalk}from"@flatjs/common";import{customMessageChannel}from"./custom-message-channel.js";const startFrames="win32"===process.platform?["-","\\","|","/"]:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];let startIndex=0;export class CustomListrRenderer{constructor(t){this._tasks=[],this.renderTask=()=>{const t=[];startIndex=++startIndex%startFrames.length;const e=startFrames[startIndex];for(const s of this._tasks)s.isCompleted()?t.push(`${chalk(["green"])("✔")} ${this.formatTextByTemp(s.title,"successfully")}`):s.hasFailed()?t.push(`${chalk(["red"])("✘")} ${this.formatTextByTemp(s.title,"failed")}`):s.isSkipped()?t.push(`${chalk(["gray"])("ℹ")} ${this.formatTextByTemp(s.title,"skipped")}`):t.push(`${chalk(["cyan"])(e)} ${this.formatTextByTemp(s.title,"building")}`);logUpdate(t.join("\n"))},this._tasks=t}static get nonTTY(){return!0}render(){this._id||(this._id=setInterval((()=>{this.renderTask()}),100))}end(){this._id&&(clearInterval(this._id),this._id=void 0),this.renderTask(),logUpdate.done(),this.printMemoryLogs()}formatTextByTemp(t,e,s="$STATUS"){const r={successfully:`${chalk(["green"])("done")}`,failed:`builded ${chalk(["red"])("failed")}`,skipped:`builded ${chalk(["gray"])("skipped")}`,building:chalk(["white"])("compiling...")};return t.replace(s,r[e])}printMemoryLogs(){const{stderr:t=[],stdout:e=[]}=customMessageChannel.getStdData();for(const e of t)console.error(e);for(const t of e)console.log(t);customMessageChannel.clean()}}
@@ -0,0 +1,17 @@
1
+ import { MessageChannel } from 'node:worker_threads';
2
+ declare class CustomMessageChannel {
3
+ private stdoutData;
4
+ private stderrData;
5
+ private channelList;
6
+ constructor();
7
+ createMessageChannel(): MessageChannel;
8
+ addListener(channel: MessageChannel): void;
9
+ getStdData(): {
10
+ stdout: string[];
11
+ stderr: string[];
12
+ };
13
+ dispose(): void;
14
+ clean(): void;
15
+ }
16
+ export declare const customMessageChannel: CustomMessageChannel;
17
+ export {};
@@ -0,0 +1 @@
1
+ import{MessageChannel}from"node:worker_threads";class CustomMessageChannel{constructor(){this.stdoutData=[],this.stderrData=[],this.channelList=[],this.clean()}createMessageChannel(){const s=new MessageChannel;return this.channelList.push(s),this.addListener(s),s}addListener(s){const{port2:t}=s;t.on("message",(s=>{this.stdoutData.push(...s.stdout),this.stderrData.push(...s.stderr)}))}getStdData(){return{stdout:this.stdoutData,stderr:this.stderrData}}dispose(){for(const s of this.channelList){const{port1:t,port2:e}=s;t.close(),e.close(),e.removeAllListeners("message")}this.channelList=[]}clean(){this.stdoutData=[],this.stderrData=[]}}export const customMessageChannel=new CustomMessageChannel;
@@ -11,4 +11,4 @@ export declare const currNow: () => string;
11
11
  * @param serveMode If we are run `serve` mode
12
12
  * @param enableBundleHashName If we need to generate bundle file name with `[contenthash]`
13
13
  */
14
- export declare const getBundleFileName: (type: 'css' | 'js', serveMode: boolean, enableBundleHashName?: boolean) => string;
14
+ export declare const getBundleFileName: (type: "css" | "js", serveMode: boolean, enableBundleHashName?: boolean) => string;
@@ -20,7 +20,7 @@ export declare const manualGrouping: (manualEntries: (EvolveEntryMapContent & {
20
20
  */
21
21
  export declare const autoGroupingReduce: (autoEntries: (EvolveEntryMapContent & {
22
22
  entryName: string;
23
- })[], ignoreOptionKeys: (keyof EvolveEntryItemOption)[] | undefined, serveMode: boolean) => Record<string, EvolveEntryMap>;
23
+ })[], ignoreOptionKeys: Array<keyof EvolveEntryItemOption> | undefined, serveMode: boolean) => Record<string, EvolveEntryMap>;
24
24
  /**
25
25
  * Assigns a group name to each entry in the evolveEntryMapList based on the projectVirtualPath.
26
26
  *
@@ -41,7 +41,7 @@ export declare const autoAssignGroupName: (evolveOptions: FlatEvolveOptions, evo
41
41
  */
42
42
  export declare const autoGrouping: (evolveOptions: FlatEvolveOptions, autoEntries: (EvolveEntryMapContent & {
43
43
  entryName: string;
44
- })[], ignoreOptionKeys: (keyof EvolveEntryItemOption)[] | undefined, serveMode: boolean) => Array<EvolveEntryMap>;
44
+ })[], ignoreOptionKeys: Array<keyof EvolveEntryItemOption> | undefined, serveMode: boolean) => Array<EvolveEntryMap>;
45
45
  /**
46
46
  * Splits the served entries into groups based on the given options.
47
47
  *
@@ -49,4 +49,4 @@ export declare const autoGrouping: (evolveOptions: FlatEvolveOptions, autoEntrie
49
49
  * @param ignoreOptionKeys - The list of option keys to ignore.
50
50
  * @returns An array of evolve entry maps representing the groups.
51
51
  */
52
- export declare const splitToEntryGroup: (evolveEntries: EvolveEntryMap, evolveOptions: FlatEvolveOptions, ignoreOptionKeys: (keyof EvolveEntryItemOption)[] | undefined, serveMode: boolean) => Array<EvolveEntryMap>;
52
+ export declare const splitToEntryGroup: (evolveEntries: EvolveEntryMap, evolveOptions: FlatEvolveOptions, ignoreOptionKeys: Array<keyof EvolveEntryItemOption> | undefined, serveMode: boolean) => Array<EvolveEntryMap>;
@@ -6,4 +6,4 @@ import { type EvolveEntryItemOption, type EvolveEntryMap } from '../types/types-
6
6
  * @param ignoreOptionKeys - The keys to be ignored when comparing options.
7
7
  * @returns A boolean indicating if the options of all entries are equal.
8
8
  */
9
- export declare const verifyGroupEntryOptions: (groupEvolveEntryMap: EvolveEntryMap, ignoreOptionKeys: (keyof EvolveEntryItemOption)[] | undefined, serveMode: boolean) => boolean;
9
+ export declare const verifyGroupEntryOptions: (groupEvolveEntryMap: EvolveEntryMap, ignoreOptionKeys: Array<keyof EvolveEntryItemOption> | undefined, serveMode: boolean) => boolean;
@@ -24,7 +24,7 @@ declare class ThreadPoolForTinyPool implements BaseThreadPool {
24
24
  * @param options Optional configuration options for the worker pool.
25
25
  */
26
26
  constructor(workerPath: string, options?: ThreadsOptions);
27
- startBuildWorker(options: Parameters<typeof startBuildWorker>[0]): Promise<import("./start-group-entry-build.js").EvolveBuildResult>;
27
+ startBuildWorker(options: Parameters<typeof startBuildWorker>[0]): ReturnType<typeof startBuildWorker>;
28
28
  terminate(): void;
29
29
  }
30
30
  export declare const createThreadWorker: (options?: ThreadsOptions) => ThreadPoolForUnittest | ThreadPoolForTinyPool;
@@ -1 +1 @@
1
- import Tinypool from"tinypool";import{getWorkerPath}from"./get-worker-path.js";import startBuildWorker from"./start-build-worker.js";class ThreadPoolForUnittest{startBuildWorker(r){return startBuildWorker(r)}terminate(){console.warn('[WARNING] Using fake "terminate" for unittest!')}}class ThreadPoolForTinyPool{constructor(r,o){const{runtime:e="worker_threads",idleTimeout:t=6e4,minThreads:n=1,maxThreads:s}=o||{};this.pool=new Tinypool({filename:r,minThreads:n,maxThreads:s,runtime:e,idleTimeout:t})}startBuildWorker(r){return this.pool.run(r)}terminate(){this.pool.destroy()}}export const createThreadWorker=r=>{const o=getWorkerPath();return"test"===process.env.NODE_ENV?(console.warn("[WARNING] Using fake thread pool worker for unittest!"),new ThreadPoolForUnittest):new ThreadPoolForTinyPool(o,r)};
1
+ import Tinypool from"tinypool";import{mergeOptions}from"@flatjs/common";import{customMessageChannel}from"../helpers/custom-message-channel.js";import{getWorkerPath}from"./get-worker-path.js";import startBuildWorker from"./start-build-worker.js";class ThreadPoolForUnittest{startBuildWorker(e){return startBuildWorker(e)}terminate(){console.warn('[WARNING] Using fake "terminate" for unittest!')}}class ThreadPoolForTinyPool{constructor(e,r){const{idleTimeout:o=6e4,minThreads:t=1,maxThreads:s}=r||{};this.pool=new Tinypool({runtime:"worker_threads",filename:e,minThreads:t,maxThreads:s,idleTimeout:o})}startBuildWorker(e){const{port1:r}=customMessageChannel.createMessageChannel(),o=mergeOptions(e,{messagePort:r});return this.pool.run(o,{transferList:[r]})}terminate(){this.pool.destroy(),customMessageChannel.dispose()}}export const createThreadWorker=e=>{const r=getWorkerPath();return"test"===process.env.NODE_ENV?(console.warn("[WARNING] Using fake thread pool worker for unittest!"),new ThreadPoolForUnittest):new ThreadPoolForTinyPool(r,e)};
@@ -1,3 +1,4 @@
1
+ import { MessageChannel } from 'node:worker_threads';
1
2
  import { type ConfigLoaderOptions } from '../load-config/types.js';
2
3
  import { type EvolveBuildResult } from './start-group-entry-build.js';
3
4
  /**
@@ -14,5 +15,6 @@ declare const _default: (options: {
14
15
  entryKeys: string[];
15
16
  serializedEvolveOptions: string;
16
17
  configLoaderOptions?: ConfigLoaderOptions;
18
+ messagePort?: MessageChannel["port1"];
17
19
  }) => Promise<EvolveBuildResult>;
18
20
  export default _default;
@@ -1 +1 @@
1
- import{requireResolve}from"@flatjs/common";import{ignoreEntryOptionKeys}from"../constants.js";import{filterActivedEntriesByModule}from"../helpers/filter-actived-entries.js";import{jsonSerializer}from"../helpers/json-serializer.js";import{normalizeEvolveEntryMap}from"../helpers/normalize-entry-map.js";import{splitToEntryGroup}from"../helpers/split-to-entry-group.js";import{loadEvolveConfig}from"../load-config/load-evolve-config.js";import{prepareBuild}from"./prepare-build.js";export default async e=>{const{projectCwd:r,entryKeys:o,serializedEvolveOptions:i,configLoaderOptions:t}=e,n={projectCwd:r,command:"build",resolve:requireResolve},p=jsonSerializer.parse(i)||{},l=await loadEvolveConfig(n,r,p,t),s=o.map((e=>new RegExp(`^${e}$`))),a=filterActivedEntriesByModule(l.entryMap,s),m=normalizeEvolveEntryMap(a,l.entryMap),d=splitToEntryGroup(m,l,ignoreEntryOptionKeys,!1);return prepareBuild(d[0],l)};
1
+ import{configLoggerStdWriteSteam,loggerSimpleStdWriteSteam,requireResolve}from"@flatjs/common";import{ignoreEntryOptionKeys}from"../constants.js";import{filterActivedEntriesByModule}from"../helpers/filter-actived-entries.js";import{jsonSerializer}from"../helpers/json-serializer.js";import{normalizeEvolveEntryMap}from"../helpers/normalize-entry-map.js";import{splitToEntryGroup}from"../helpers/split-to-entry-group.js";import{loadEvolveConfig}from"../load-config/load-evolve-config.js";import{prepareBuild}from"./prepare-build.js";export default async e=>{configLoggerStdWriteSteam();const{projectCwd:r,entryKeys:o,serializedEvolveOptions:t,configLoaderOptions:i,messagePort:l}=e,n={projectCwd:r,command:"build",resolve:requireResolve},p=jsonSerializer.parse(t)||{},s=await loadEvolveConfig(n,r,p,i),a=o.map((e=>new RegExp(`^${e}$`))),m=filterActivedEntriesByModule(s.entryMap,a),d=normalizeEvolveEntryMap(m,s.entryMap),g=splitToEntryGroup(d,s,ignoreEntryOptionKeys,!1);return prepareBuild(g[0],s).then((e=>(loggerSimpleStdWriteSteam.postMessage(l),e)))};
@@ -1 +1 @@
1
- import HtmlWebpackPlugin from"html-webpack-plugin";import{allowPx2remForModule}from"../../helpers/allow-px2rem-for-module.js";import{getHtmlPluginConfig}from"../../helpers/get-html-plugin-config.js";import{normalizeTemplateInjectTokens}from"../../helpers/normalize-template-inject-tokens.js";import{findEnvCdn}from"../../helpers/script-injects.js";const minifyOpts={minifyJS:!0,removeComments:!0,collapseWhitespace:!0,collapseBooleanAttributes:!1};export const createMultiHtmlWebpackPlugin=(e,t,l,n)=>{const i=l[0],[,o]=i,m=[],{options:p}=o,r=e?"development":"production",a=l.map((e=>e[0]));for(const e of n){const l={mode:r,envCdn:findEnvCdn(t.multiHtmlCdn,e)},n=normalizeTemplateInjectTokens(l,p);m.push(new HtmlWebpackPlugin({inject:"body",title:getHtmlPluginConfig("title",l,p?.title),chunks:a,minify:!1!==p?.htmlMinify&&!["me","dev"].includes(e)&&minifyOpts,filename:t=>`${t}/index${"prod"===e?"":`-${e}`}.html`,template:getHtmlPluginConfig("templatePath",l,p?.templatePath).replace("{0}",e),templateParameters:{title:getHtmlPluginConfig("title",l,p?.title),favicon:getHtmlPluginConfig("favicon",l,p?.favicon),viewport:allowPx2remForModule(i,t)?getHtmlPluginConfig("viewport",l,p?.viewport):"",...n},multiCdn:{env:e,disabled:(p?.excludeCdnEnvs||["me","dev","ntv"]).includes(e)}}))}return m};
1
+ import HtmlWebpackPlugin from"html-webpack-plugin";import{existsSync}from"node:fs";import{logger}from"@flatjs/common";import{allowPx2remForModule}from"../../helpers/allow-px2rem-for-module.js";import{getHtmlPluginConfig}from"../../helpers/get-html-plugin-config.js";import{normalizeTemplateInjectTokens}from"../../helpers/normalize-template-inject-tokens.js";import{findEnvCdn}from"../../helpers/script-injects.js";const minifyOpts={minifyJS:!0,removeComments:!0,collapseWhitespace:!0,collapseBooleanAttributes:!1};export const createMultiHtmlWebpackPlugin=(e,t,l,i)=>{const n=l[0],[,o]=n,m=[],{options:r}=o,p=e?"development":"production",s=l.map((e=>e[0]));for(const e of i){const l={mode:p,envCdn:findEnvCdn(t.multiHtmlCdn,e)},i=normalizeTemplateInjectTokens(l,r);let o=getHtmlPluginConfig("templatePath",l,r?.templatePath).replace("{0}",e.trim());existsSync(o)||(logger.warn(`The template file ${o} is not exists, use \`prod\` instead!`),o=getHtmlPluginConfig("templatePath",l,r?.templatePath).replace("{0}","prod")),m.push(new HtmlWebpackPlugin({inject:"body",title:getHtmlPluginConfig("title",l,r?.title),chunks:s,minify:!1!==r?.htmlMinify&&!["me","dev"].includes(e)&&minifyOpts,filename:t=>`${t}/index${"prod"===e?"":`-${e}`}.html`,template:o,templateParameters:{title:getHtmlPluginConfig("title",l,r?.title),favicon:getHtmlPluginConfig("favicon",l,r?.favicon),viewport:allowPx2remForModule(n,t)?getHtmlPluginConfig("viewport",l,r?.viewport):"",...i},multiCdn:{env:e,disabled:(r?.excludeCdnEnvs||["me","dev","ntv"]).includes(e)}}))}return m};
@@ -9,13 +9,6 @@ export interface ThreadsOptions {
9
9
  * Maximum number of process to run at once for production build
10
10
  */
11
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
12
  /**
20
13
  * Default timeout to wait for close when Thread shuts down, in milliseconds
21
14
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatjs/evolve",
3
- "version": "2.1.0-next.20",
3
+ "version": "2.1.0-next.22",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -35,17 +35,17 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@armit/babel-merge": "^0.2.2",
38
- "@armit/config-loader": "^0.2.2",
38
+ "@armit/config-loader": "^0.2.3",
39
39
  "@armit/file-utility": "^0.2.2",
40
40
  "@armit/git": "^0.2.2",
41
- "@armit/package": "^0.2.2",
41
+ "@armit/package": "^0.2.3",
42
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",
43
+ "@flatjs/babel-plugin-import": "2.1.0-next.9",
44
+ "@flatjs/common": "2.1.0-next.8",
45
+ "@flatjs/evolve-preset-babel": "2.1.0-next.8",
46
+ "@flatjs/forge-postcss-plugin-pixel": "2.1.0-next.8",
47
+ "@flatjs/graph": "2.1.0-next.10",
48
+ "@flatjs/mock": "2.1.0-next.11",
49
49
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
50
50
  "@types/babel__core": "^7.20.5",
51
51
  "babel-loader": "^9.1.3",
@@ -55,7 +55,7 @@
55
55
  "cssnano": "^7.0.3",
56
56
  "express": "^4.19.2",
57
57
  "fork-ts-checker-webpack-plugin": "^9.0.2",
58
- "happy-dom": "^14.12.0",
58
+ "happy-dom": "^14.12.3",
59
59
  "html-webpack-plugin": "^5.6.0",
60
60
  "image-minimizer-webpack-plugin": "^4.0.2",
61
61
  "less": "^4.2.0",
@@ -64,7 +64,7 @@
64
64
  "lodash": "^4.17.21",
65
65
  "log-update": "^6.0.0",
66
66
  "mini-css-extract-plugin": "^2.9.0",
67
- "postcss": "^8.4.38",
67
+ "postcss": "^8.4.39",
68
68
  "postcss-loader": "^8.1.1",
69
69
  "react-refresh": "^0.14.2",
70
70
  "svgo": "^3.3.2",
@@ -73,7 +73,7 @@
73
73
  "tinypool": "^1.0.0",
74
74
  "tsconfig-paths-webpack-plugin": "^4.1.0",
75
75
  "type-fest": "^4.20.1",
76
- "typescript": "^5.4.5",
76
+ "typescript": "^5.5.2",
77
77
  "webpack": "^5.92.1",
78
78
  "webpack-bundle-analyzer": "^4.10.2",
79
79
  "webpack-dev-server": "^5.0.4",
@@ -84,16 +84,16 @@
84
84
  "@dimjs/model": "1.2.3",
85
85
  "@dimjs/model-react": "1.2.3",
86
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",
87
+ "@flatjs/testing": "2.1.0-next.8",
88
+ "@hyperse/eslint-config-hyperse": "^1.0.10",
89
+ "@swc/core": "1.6.6",
90
90
  "@types/express": "4.17.21",
91
91
  "@types/listr": "0.14.9",
92
- "@types/node": "20.14.6",
92
+ "@types/node": "20.14.9",
93
93
  "@vitest/coverage-istanbul": "1.6.0",
94
94
  "@vitest/ui": "1.6.0",
95
95
  "@wove/react": "1.2.23",
96
- "eslint": "^9.5.0",
96
+ "eslint": "^9.6.0",
97
97
  "imagemin-gifsicle": "7.0.0",
98
98
  "imagemin-jpegtran": "7.0.0",
99
99
  "imagemin-pngquant": "10.0.0",
@@ -0,0 +1,61 @@
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>