@flatjs/evolve 2.3.2-next.0 → 2.3.2-next.2
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.
- package/dist/build-server/compiler-server-manager.d.ts +1 -1
- package/dist/compiler/create-build-server-compiler.js +1 -1
- package/dist/core/rspack/create-externals.d.ts +4 -0
- package/dist/core/rspack/create-optimization.d.ts +4 -0
- package/dist/core/rspack/create-optimization.js +1 -0
- package/dist/core/rspack/create-performance.d.ts +2 -0
- package/dist/core/rspack/create-plugins.d.ts +5 -0
- package/dist/core/rspack/create-plugins.js +1 -0
- package/dist/core/rspack/create-resolve.d.ts +2 -0
- package/dist/core/rspack/create-resolve.js +1 -0
- package/dist/core/rspack/create-rspack-output.d.ts +4 -0
- package/dist/core/rspack/create-rspack-output.js +1 -0
- package/dist/core/rspack/create-rspack-rule-sets.d.ts +4 -0
- package/dist/core/rspack/create-rspack-rule-sets.js +1 -0
- package/dist/core/rspack/dev-serve/add-rspack-compiler-to-dev-server.d.ts +11 -0
- package/dist/core/rspack/dev-serve/add-rspack-compiler-to-dev-server.js +1 -0
- package/dist/core/rspack/dev-serve/create-rspack-compiler-task.d.ts +3 -0
- package/dist/core/rspack/dev-serve/create-rspack-compiler-task.js +1 -0
- package/dist/core/rspack/load-rspack-config.d.ts +11 -0
- package/dist/core/rspack/load-rspack-config.js +1 -0
- package/dist/core/rspack/load-rspack-watch-options.d.ts +12 -0
- package/dist/core/rspack/load-rspack-watch-options.js +1 -0
- package/dist/core/rspack/start-rspack-build.d.ts +12 -0
- package/dist/core/rspack/start-rspack-build.js +1 -0
- package/dist/{create-webpack → core/webpack}/create-externals.d.ts +2 -2
- package/dist/core/webpack/create-externals.js +1 -0
- package/dist/{create-webpack → core/webpack}/create-optimization.d.ts +2 -2
- package/dist/core/webpack/create-optimization.js +1 -0
- package/dist/{create-webpack → core/webpack}/create-output.d.ts +2 -2
- package/dist/core/webpack/create-output.js +1 -0
- package/dist/{create-webpack → core/webpack}/create-performance.d.ts +1 -1
- package/dist/core/webpack/create-performance.js +1 -0
- package/dist/core/webpack/create-plugins.d.ts +5 -0
- package/dist/core/webpack/create-plugins.js +1 -0
- package/dist/{create-webpack → core/webpack}/create-resolve.d.ts +1 -1
- package/dist/{create-webpack → core/webpack}/create-rule-sets.d.ts +2 -2
- package/dist/core/webpack/create-rule-sets.js +1 -0
- package/dist/{dev-server/add-compiler-to-dev-server.d.ts → core/webpack/dev-serve/add-webpack-compiler-to-dev-server.d.ts} +2 -2
- package/dist/core/webpack/dev-serve/add-webpack-compiler-to-dev-server.js +1 -0
- package/dist/core/webpack/dev-serve/create-webpack-compiler-task.d.ts +3 -0
- package/dist/core/webpack/dev-serve/create-webpack-compiler-task.js +1 -0
- package/dist/core/webpack/index.d.ts +2 -0
- package/dist/core/webpack/index.js +1 -0
- package/dist/{create-webpack → core/webpack}/load-watch-options.d.ts +3 -3
- package/dist/core/webpack/load-watch-options.js +1 -0
- package/dist/{create-webpack → core/webpack}/load-webpack-config.d.ts +3 -3
- package/dist/core/webpack/load-webpack-config.js +1 -0
- package/dist/core/webpack/start-webpack-build.d.ts +12 -0
- package/dist/core/webpack/start-webpack-build.js +1 -0
- package/dist/default-options.js +1 -1
- package/dist/dev-server/create-app-page-route.d.ts +1 -1
- package/dist/dev-server/create-dev-server-entries.d.ts +1 -1
- package/dist/dev-server/index.d.ts +0 -2
- package/dist/dev-server/index.js +1 -1
- package/dist/dev-server/middlewares/create-page-middleware.d.ts +1 -1
- package/dist/dev-server/middlewares/get-all-sorted-modules.d.ts +1 -1
- package/dist/dev-server/middlewares/get-dev-server-host-uri.d.ts +1 -1
- package/dist/dev-server/middlewares/get-hmr-runtime-chunks.d.ts +1 -1
- package/dist/dev-server/middlewares/get-normalized-entry-name.d.ts +1 -1
- package/dist/dev-server/middlewares/get-page-main-html.d.ts +1 -1
- package/dist/dev-server/middlewares/get-page-module-html.d.ts +1 -1
- package/dist/dev-server/middlewares/get-runtime-manifest.d.ts +1 -1
- package/dist/helpers/assert-single-compiler.d.ts +14 -1
- package/dist/helpers/assert-single-compiler.js +1 -1
- package/dist/helpers/custom-listr-renderer.js +1 -1
- package/dist/helpers/flat-entry-map.d.ts +1 -1
- package/dist/helpers/format-spinner-text.d.ts +3 -1
- package/dist/helpers/format-spinner-text.js +1 -1
- package/dist/helpers/print-promotion.d.ts +2 -0
- package/dist/helpers/print-promotion.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/main/create-build-server.d.ts +1 -1
- package/dist/main/index.d.ts +0 -1
- package/dist/main/index.js +1 -1
- package/dist/main/prepare-build.d.ts +1 -1
- package/dist/main/prepare-build.js +1 -1
- package/dist/main/prepare-serve.d.ts +2 -1
- package/dist/main/prepare-serve.js +1 -1
- package/dist/main/start-build-dynamic.d.ts +3 -2
- package/dist/main/start-build-dynamic.js +1 -1
- package/dist/main/start-build-worker.d.ts +1 -3
- 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-serve.d.ts +2 -1
- package/dist/main/start-serve.js +1 -1
- package/dist/minimizer/default-options.d.ts +2 -0
- package/dist/minimizer/default-options.js +1 -1
- package/dist/minimizer/index.d.ts +2 -1
- package/dist/minimizer/index.js +1 -1
- package/dist/minimizer/rspack/create-minimizers.d.ts +3 -0
- package/dist/minimizer/rspack/create-minimizers.js +1 -0
- package/dist/minimizer/{image-minimizer.d.ts → rspack/image-minimizer.d.ts} +1 -1
- package/dist/minimizer/rspack/image-minimizer.js +1 -0
- package/dist/minimizer/rspack/terser-minimizer.d.ts +6 -0
- package/dist/minimizer/rspack/terser-minimizer.js +1 -0
- package/dist/minimizer/webpack/create-minimizers.d.ts +3 -0
- package/dist/minimizer/webpack/create-minimizers.js +1 -0
- package/dist/minimizer/webpack/image-minimizer.d.ts +16 -0
- package/dist/minimizer/webpack/image-minimizer.js +1 -0
- package/dist/minimizer/webpack/terser-minimizer.d.ts +6 -0
- package/dist/minimizer/{terser-minimizer.js → webpack/terser-minimizer.js} +1 -1
- package/dist/plugins/{define-variable/define-variable-plugin.d.ts → rspack/define-variable/index.d.ts} +3 -3
- package/dist/plugins/rspack/define-variable/index.js +1 -0
- package/dist/plugins/rspack/module-federation/external-template-remotes-rspack-plugin.d.ts +4 -0
- package/dist/plugins/rspack/module-federation/external-template-remotes-rspack-plugin.js +1 -0
- package/dist/plugins/rspack/module-federation/index.d.ts +4 -0
- package/dist/plugins/rspack/module-federation/index.js +1 -0
- package/dist/plugins/rspack/multi-html/index.d.ts +4 -0
- package/dist/plugins/rspack/multi-html/index.js +1 -0
- package/dist/plugins/rspack/multi-html/multi-html-cdn-rspack-plugin.d.ts +18 -0
- package/dist/plugins/rspack/multi-html/multi-html-cdn-rspack-plugin.js +1 -0
- package/dist/plugins/{multi-html/multi-html-modify-plugin.d.ts → rspack/multi-html/multi-html-modify--rspack-plugin.d.ts} +2 -2
- package/dist/plugins/rspack/multi-html/multi-html-modify--rspack-plugin.js +1 -0
- package/dist/plugins/rspack/multi-html/multi-html-rspack-plugin.d.ts +11 -0
- package/dist/plugins/rspack/multi-html/multi-html-rspack-plugin.js +1 -0
- package/dist/plugins/{circular-dependency/circular-dependency-plugin.d.ts → webpack/circular-dependency/circular-dependency-webpack-plugin.d.ts} +1 -1
- package/dist/plugins/webpack/circular-dependency/circular-dependency-webpack-plugin.js +1 -0
- package/dist/plugins/webpack/circular-dependency/index.d.ts +9 -0
- package/dist/plugins/webpack/circular-dependency/index.js +1 -0
- package/dist/plugins/webpack/clean-webpack/clean-webpack-plugin.js +1 -0
- package/dist/plugins/webpack/clean-webpack/index.d.ts +9 -0
- package/dist/plugins/webpack/clean-webpack/index.js +1 -0
- package/dist/plugins/webpack/define-variable/index.d.ts +16 -0
- package/dist/plugins/webpack/define-variable/index.js +1 -0
- package/dist/plugins/{html-inject-scripts/plugin-html-inject-script.d.ts → webpack/html-inject-scripts/html-inject-script-webpack-plugin.d.ts} +1 -1
- package/dist/plugins/webpack/html-inject-scripts/html-inject-script-webpack-plugin.js +1 -0
- package/dist/plugins/webpack/html-inject-scripts/html-inline-script-webpack-plugin.d.ts +12 -0
- package/dist/plugins/webpack/html-inject-scripts/html-inline-script-webpack-plugin.js +1 -0
- package/dist/plugins/webpack/html-inject-scripts/index.d.ts +2 -0
- package/dist/plugins/webpack/html-inject-scripts/index.js +1 -0
- package/dist/plugins/{module-federation/external-template-remotes.d.ts → webpack/module-federation/external-template-remotes-webpack-plugin.d.ts} +1 -1
- package/dist/plugins/webpack/module-federation/external-template-remotes-webpack-plugin.js +1 -0
- package/dist/plugins/webpack/module-federation/index.d.ts +4 -0
- package/dist/plugins/webpack/module-federation/index.js +1 -0
- package/dist/plugins/webpack/multi-html/index.d.ts +4 -0
- package/dist/plugins/webpack/multi-html/index.js +1 -0
- package/dist/plugins/{multi-html/multi-html-cdn-plugin.d.ts → webpack/multi-html/multi-html-cdn-webpack-plugin.d.ts} +2 -2
- package/dist/plugins/webpack/multi-html/multi-html-cdn-webpack-plugin.js +1 -0
- package/dist/plugins/webpack/multi-html/multi-html-modify-webpack-plugin.d.ts +12 -0
- package/dist/plugins/webpack/multi-html/multi-html-modify-webpack-plugin.js +1 -0
- package/dist/plugins/webpack/multi-html/multi-html-webpack-plugins.d.ts +11 -0
- package/dist/plugins/webpack/multi-html/multi-html-webpack-plugins.js +1 -0
- package/dist/plugins/webpack/stats-webpack/index.d.ts +12 -0
- package/dist/plugins/webpack/stats-webpack/index.js +1 -0
- package/dist/plugins/webpack/stats-webpack/stats-webpack-plugin.js +1 -0
- package/dist/rules/index.d.ts +2 -0
- package/dist/rules/index.js +1 -0
- package/dist/rules/rspack/index.d.ts +5 -0
- package/dist/rules/rspack/index.js +1 -0
- package/dist/rules/rspack/rule-assets.d.ts +10 -0
- package/dist/rules/rspack/rule-assets.js +1 -0
- package/dist/rules/rspack/rule-css.d.ts +11 -0
- package/dist/rules/rspack/rule-css.js +1 -0
- package/dist/rules/rspack/rule-less.d.ts +26 -0
- package/dist/rules/rspack/rule-less.js +1 -0
- package/dist/rules/rspack/rule-scripts.d.ts +3 -0
- package/dist/rules/rspack/rule-scripts.js +1 -0
- package/dist/rules/rspack/rule-svg-icon.d.ts +6 -0
- package/dist/rules/rspack/rule-svg-icon.js +1 -0
- package/dist/rules/rule-utils.d.ts +19 -0
- package/dist/rules/rule-utils.js +1 -0
- package/dist/rules/wepack/index.d.ts +5 -0
- package/dist/rules/wepack/index.js +1 -0
- package/dist/{create-webpack/rule-sets → rules/wepack}/rule-assets.d.ts +1 -1
- package/dist/rules/wepack/rule-assets.js +1 -0
- package/dist/{create-webpack/rule-sets → rules/wepack}/rule-css.d.ts +1 -1
- package/dist/rules/wepack/rule-css.js +1 -0
- package/dist/{create-webpack/rule-sets → rules/wepack}/rule-less.d.ts +1 -1
- package/dist/rules/wepack/rule-less.js +1 -0
- package/dist/{create-webpack/rule-sets → rules/wepack}/rule-scripts.d.ts +1 -1
- package/dist/rules/wepack/rule-scripts.js +1 -0
- package/dist/{create-webpack/rule-sets → rules/wepack}/rule-svg-icon.d.ts +1 -1
- package/dist/rules/wepack/rule-svg-icon.js +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +1 -1
- package/dist/types/types-build.d.ts +4 -0
- package/dist/types/types-cli-options.d.ts +5 -0
- package/dist/types/types-dev-server.d.ts +23 -0
- package/dist/types/types-federation.d.ts +2 -3
- package/dist/types/types-options.d.ts +5 -0
- package/dist/types/types-webpack.d.ts +42 -3
- package/package.json +25 -15
- package/dist/create-webpack/create-optimization.js +0 -1
- package/dist/create-webpack/create-output.js +0 -1
- package/dist/create-webpack/create-plugins.d.ts +0 -5
- package/dist/create-webpack/create-plugins.js +0 -1
- package/dist/create-webpack/create-rule-sets.js +0 -1
- package/dist/create-webpack/load-watch-options.js +0 -1
- package/dist/create-webpack/load-webpack-config.js +0 -1
- package/dist/create-webpack/rule-sets/rule-assets.js +0 -1
- package/dist/create-webpack/rule-sets/rule-css.js +0 -1
- package/dist/create-webpack/rule-sets/rule-less.js +0 -1
- package/dist/create-webpack/rule-sets/rule-scripts.js +0 -1
- package/dist/create-webpack/rule-sets/rule-svg-icon.js +0 -1
- package/dist/create-webpack/rule-sets/rule-utils.d.ts +0 -7
- package/dist/create-webpack/rule-sets/rule-utils.js +0 -1
- package/dist/create-webpack/types.d.ts +0 -2
- package/dist/dev-server/add-compiler-to-dev-server.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/dev-server/middlewares/types.d.ts +0 -24
- package/dist/dev-server/middlewares/types.js +0 -1
- package/dist/helpers/custom-message-channel.d.ts +0 -17
- package/dist/helpers/custom-message-channel.js +0 -1
- package/dist/main/create-thread-worker.d.ts +0 -31
- package/dist/main/create-thread-worker.js +0 -1
- package/dist/main/get-worker-path.d.ts +0 -1
- package/dist/main/get-worker-path.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/minimizer/create-minimizers.d.ts +0 -3
- package/dist/minimizer/create-minimizers.js +0 -1
- package/dist/minimizer/image-minimizer.js +0 -1
- package/dist/minimizer/terser-minimizer.d.ts +0 -6
- package/dist/plugins/circular-dependency/circular-dependency-plugin.js +0 -1
- package/dist/plugins/circular-dependency/index.d.ts +0 -7
- package/dist/plugins/circular-dependency/index.js +0 -1
- package/dist/plugins/clean-webpack/clean-webpack-plugin.js +0 -1
- package/dist/plugins/clean-webpack/index.d.ts +0 -9
- package/dist/plugins/clean-webpack/index.js +0 -1
- package/dist/plugins/define-variable/define-variable-plugin.js +0 -1
- package/dist/plugins/define-variable/index.d.ts +0 -1
- package/dist/plugins/define-variable/index.js +0 -1
- package/dist/plugins/html-inject-scripts/plugin-html-inject-script.js +0 -1
- package/dist/plugins/module-federation/external-template-remotes.js +0 -1
- package/dist/plugins/module-federation/index.d.ts +0 -1
- package/dist/plugins/module-federation/index.js +0 -1
- package/dist/plugins/module-federation/module-federation.d.ts +0 -4
- package/dist/plugins/module-federation/module-federation.js +0 -1
- package/dist/plugins/multi-html/index.d.ts +0 -4
- package/dist/plugins/multi-html/index.js +0 -1
- package/dist/plugins/multi-html/multi-html-cdn-plugin.js +0 -1
- package/dist/plugins/multi-html/multi-html-modify-plugin.js +0 -1
- package/dist/plugins/multi-html/multi-html-plugin.d.ts +0 -11
- package/dist/plugins/multi-html/multi-html-plugin.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.js +0 -1
- /package/dist/{create-webpack → core/rspack}/create-externals.js +0 -0
- /package/dist/{create-webpack → core/rspack}/create-performance.js +0 -0
- /package/dist/{create-webpack → core/webpack}/create-resolve.js +0 -0
- /package/dist/{create-webpack → helpers}/resolve-public-path.d.ts +0 -0
- /package/dist/{create-webpack → helpers}/resolve-public-path.js +0 -0
- /package/dist/plugins/{clean-webpack → webpack/clean-webpack}/clean-webpack-plugin.d.ts +0 -0
- /package/dist/plugins/{stats-webpack → webpack/stats-webpack}/helper-write-stats.d.ts +0 -0
- /package/dist/plugins/{stats-webpack → webpack/stats-webpack}/helper-write-stats.js +0 -0
- /package/dist/plugins/{stats-webpack → webpack/stats-webpack}/stats-webpack-plugin.d.ts +0 -0
- /package/dist/{create-webpack/rule-sets → rules}/constants.d.ts +0 -0
- /package/dist/{create-webpack/rule-sets → rules}/constants.js +0 -0
- /package/dist/{create-webpack/types.js → types/types-build.js} +0 -0
@@ -1 +0,0 @@
|
|
1
|
-
export{};
|
@@ -1,17 +0,0 @@
|
|
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 {};
|
@@ -1 +0,0 @@
|
|
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;
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import Tinypool from 'tinypool';
|
2
|
-
import { type ThreadsOptions } from '../types/types-threads-options.js';
|
3
|
-
import startBuildWorker from './start-build-worker.js';
|
4
|
-
interface BaseThreadPool {
|
5
|
-
startBuildWorker: (options: Parameters<typeof startBuildWorker>[0]) => ReturnType<typeof startBuildWorker>;
|
6
|
-
terminate(): void;
|
7
|
-
}
|
8
|
-
/**
|
9
|
-
* Represents a thread pool for unit testing.
|
10
|
-
*/
|
11
|
-
declare class ThreadPoolForUnittest implements BaseThreadPool {
|
12
|
-
startBuildWorker(options: Parameters<typeof startBuildWorker>[0]): Promise<import("./start-group-entry-build.js").EvolveBuildResult>;
|
13
|
-
terminate(): void;
|
14
|
-
}
|
15
|
-
/**
|
16
|
-
* Represents a thread pool for executing tasks using the TinyPool library.
|
17
|
-
*/
|
18
|
-
declare class ThreadPoolForTinyPool implements BaseThreadPool {
|
19
|
-
pool: Tinypool;
|
20
|
-
/**
|
21
|
-
* Creates a new instance of the `ThreadPoolForTinyPool` class.
|
22
|
-
* @param workerPath The path to the worker file.
|
23
|
-
* @param workerSize The number of worker threads to create.
|
24
|
-
* @param options Optional configuration options for the worker pool.
|
25
|
-
*/
|
26
|
-
constructor(workerPath: string, options?: ThreadsOptions);
|
27
|
-
startBuildWorker(options: Parameters<typeof startBuildWorker>[0]): ReturnType<typeof startBuildWorker>;
|
28
|
-
terminate(): void;
|
29
|
-
}
|
30
|
-
export declare const createThreadWorker: (options?: ThreadsOptions) => ThreadPoolForUnittest | ThreadPoolForTinyPool;
|
31
|
-
export {};
|
@@ -1 +0,0 @@
|
|
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 +0,0 @@
|
|
1
|
-
export declare const getWorkerPath: () => string;
|
@@ -1 +0,0 @@
|
|
1
|
-
import{pathToFileURL}from"node:url";import{getDirname}from"@armit/file-utility";export const getWorkerPath=()=>pathToFileURL(getDirname(import.meta.url,"./start-build-worker.js")).toString();
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import type { 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 +0,0 @@
|
|
1
|
-
import{logger}from"@flatjs/common";import{moduleName}from"../constants.js";import{printInfo}from"../helpers/print-log.js";import{imageMinimizer}from"./image-minimizer.js";import{terserMinimizer}from"./terser-minimizer.js";export const createMinimizers=(i,r)=>{const e=[];if(i)return logger.debug("Ignore minimizer plugin for `serve` mode",moduleName),e;if(!1===r?.minimizer)return printInfo("Note `minimizer` has been disabled for now"),e;if(r?.minimizer?.imageMin){const i=imageMinimizer();i&&e.push(i)}if(!1===r?.minimizer?.terserOptions)return e;const m=terserMinimizer(r?.minimizer?.terserOptions||{});return e.push(m),e};
|
@@ -1 +0,0 @@
|
|
1
|
-
import ImageMinimizerPlugin from"image-minimizer-webpack-plugin";import{projectHasYarn}from"@armit/package";import{chalk,logger,requireResolve}from"@flatjs/common";import{moduleName}from"../constants.js";const logs=new Map;export const imageMinimizer=()=>{const e=[],i=[["svgo",{}],["gifsicle",{}],["jpegtran",{}],["pngquant",{}]].map((i=>{const n=i[0];try{return requireResolve(import.meta.url,`imagemin-${n}`),i}catch{if(!logs.get(n)){logs.set(n,!0);const i=chalk(["magenta"])(`"${projectHasYarn()?"yarn add":"npm install"} imagemin-${n} -D"`);e.push(`Execute ${i} for assets optimization`)}return null}})).filter(Boolean);if(e.length)for(const i of e)logger.warn(i,moduleName);return i.length?new ImageMinimizerPlugin({minimizer:{implementation:ImageMinimizerPlugin.imageminMinify,options:{plugins:i}}}):null};
|
@@ -1,6 +0,0 @@
|
|
1
|
-
import { type WebpackPlugin } from '../create-webpack/types.js';
|
2
|
-
import { type TerserMinimizerOptions } from './types.js';
|
3
|
-
/**
|
4
|
-
* https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions
|
5
|
-
*/
|
6
|
-
export declare const terserMinimizer: (terserOptions: TerserMinimizerOptions) => WebpackPlugin;
|
@@ -1 +0,0 @@
|
|
1
|
-
import{relative}from"node:path";import Graph from"tarjan-graph";import webpack from"webpack";import{mergeOptions}from"@flatjs/common";const BASE_ERROR="Circular dependency detected:\r\n",PLUGIN_TITLE="CircularDependencyPlugin";export class CircularDependencyPlugin{constructor(o={}){this.options=mergeOptions({exclude:/node_modules/,include:/.*/,failOnError:!1,allowAsyncCycles:!1,projectCwd:process.cwd()},o)}apply(o){const e=this.options.projectCwd;o.hooks.compilation.tap(PLUGIN_TITLE,(o=>{o.hooks.optimizeModules.tap(PLUGIN_TITLE,(t=>{this.options.onStart&&this.options.onStart({compilation:o});const n=new(Graph.default||Graph);for(const e of t){const t=[];for(const n of e.dependencies){if(n.constructor&&"CommonJsSelfReferenceDependency"===n.constructor.name)continue;let r=null;r=o.moduleGraph?o.moduleGraph.getModule(n):n.module,r&&(r instanceof webpack.NormalModule&&r.resource&&(this.options.allowAsyncCycles&&n.weak||e!==r&&t.push(r.identifier())))}n.add(e.identifier(),t)}const r=n.getCycles();this.isCyclic(r,o,e),this.options.onEnd&&this.options.onEnd({compilation:o})}))}))}isCyclic(o,e,t){o.forEach((o=>{const n=o.slice().reverse().map((o=>{const t=e.findModule(o.name);return t instanceof webpack.NormalModule&&t.resource||null}));if(n.every((o=>!o||this.options.exclude.test(o)||!this.options.include.test(o))))return;const r=n.map((o=>relative(t,o)));if(this.options.onDetected){try{this.options.onDetected({paths:r.concat([r[0]]),compilation:e})}catch(o){e.errors.push(o)}return}const s=new Error(BASE_ERROR.concat(r.concat([r[0]]).join(" -> ")));this.options.failOnError?e.errors.push(s):e.warnings.push(s)}))}}
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import { type WebpackPlugin } from '../../create-webpack/types.js';
|
2
|
-
import { type FlatEvolveOptions } from '../../types/types-options.js';
|
3
|
-
/**
|
4
|
-
* Detect modules with circular dependencies when bundling with webpack for `development` mode.
|
5
|
-
* @returns
|
6
|
-
*/
|
7
|
-
export declare const createCircularDependencyPlugin: (serveMode: boolean, evolveOptions: FlatEvolveOptions) => WebpackPlugin[];
|
@@ -1 +0,0 @@
|
|
1
|
-
import{CircularDependencyPlugin}from"./circular-dependency-plugin.js";export const createCircularDependencyPlugin=(e,n)=>e?[new CircularDependencyPlugin({projectCwd:n.projectCwd})]:[];
|
@@ -1 +0,0 @@
|
|
1
|
-
import{rmSync}from"node:fs";import{relative}from"node:path";import{fileWalkSync}from"@armit/file-utility";import{logger}from"@flatjs/common";import{moduleName}from"../../constants.js";export class CleanWebpackPlugin{constructor(e={}){this.verbose=!0===e.verbose||!1,this.projectCwd=e.projectCwd||process.cwd(),this.cleanStaleWebpackAssets=!0!==e.cleanStaleWebpackAssets&&!1!==e.cleanStaleWebpackAssets||e.cleanStaleWebpackAssets,this.protectWebpackAssets=!0!==e.protectWebpackAssets&&!1!==e.protectWebpackAssets||e.protectWebpackAssets,this.cleanAfterEveryBuildPatterns=Array.isArray(e.cleanAfterEveryBuildPatterns)?e.cleanAfterEveryBuildPatterns:[],this.cleanOnceBeforeBuildPatterns=Array.isArray(e.cleanOnceBeforeBuildPatterns)?e.cleanOnceBeforeBuildPatterns:["**/*"],this.currentAssets=[],this.initialClean=!1,this.outputPath="",this.apply=this.apply.bind(this),this.handleInitial=this.handleInitial.bind(this),this.handleDone=this.handleDone.bind(this),this.removeFiles=this.removeFiles.bind(this)}apply(e){if(!e.options.output||!e.options.output.path)return void logger.warn("clean-webpack-plugin: options.output.path not defined. Plugin disabled...",moduleName);this.outputPath=e.options.output.path;const t=e.hooks;0!==this.cleanOnceBeforeBuildPatterns.length&&t.emit.tap("clean-webpack-plugin",(e=>{this.handleInitial(e)})),t.done.tap("clean-webpack-plugin",(e=>{this.handleDone(e)}))}handleInitial(e){if(this.initialClean)return;e.getStats().hasErrors()||(this.initialClean=!0,this.removeFiles(this.cleanOnceBeforeBuildPatterns))}handleDone(e){if(e.hasErrors())return void(this.verbose&&logger.warn("clean-webpack-plugin: pausing due to webpack errors",moduleName));const t=(e.toJson({assets:!0}).assets||[]).map((e=>e.name)),s=this.currentAssets.filter((e=>!1===t.includes(e)));this.currentAssets=t.sort();const i=[];!0===this.cleanStaleWebpackAssets&&0!==s.length&&i.push(...s),0!==this.cleanAfterEveryBuildPatterns.length&&i.push(...this.cleanAfterEveryBuildPatterns),0!==i.length&&this.removeFiles(i)}removeFiles(e){try{const t=fileWalkSync(e,{absolute:!0,unique:!0,cwd:this.outputPath,dot:!0,ignore:this.protectWebpackAssets?this.currentAssets:[]});for(const e of t)rmSync(e,{force:!0,recursive:!0});this.verbose&&t.forEach((e=>{const t=relative(this.projectCwd,e);logger.debug(`clean-webpack-plugin: removed ${t}`,moduleName)}))}catch(e){if(/Cannot delete files\/folders outside the current working directory\./.test(e.message)){throw new Error("clean-webpack-plugin: Cannot delete files/folders outside the current working directory. Can be overridden with the `dangerouslyAllowCleanPatternsOutsideProject` option.")}throw e}}}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import { type WebpackPlugin } from '../../create-webpack/types.js';
|
2
|
-
import { type EntryMapItem } from '../../types/types-entry-map.js';
|
3
|
-
import { type FlatEvolveOptions } from '../../types/types-options.js';
|
4
|
-
/**
|
5
|
-
* Cleaning up the /dist folder for `production` build
|
6
|
-
* @param singleEntryItem
|
7
|
-
* @returns
|
8
|
-
*/
|
9
|
-
export declare const createCleanWebpackPlugin: (serveMode: boolean, entryMapItemList: EntryMapItem[], evolveOptions: FlatEvolveOptions) => WebpackPlugin[];
|
@@ -1 +0,0 @@
|
|
1
|
-
import{posix}from"node:path";import{ensureSlash}from"@flatjs/common";import{CleanWebpackPlugin}from"./clean-webpack-plugin.js";export const createCleanWebpackPlugin=(e,n,o)=>e?[]:[new CleanWebpackPlugin({verbose:!0,projectCwd:o.projectCwd,cleanOnceBeforeBuildPatterns:n.map((e=>`${posix.join(ensureSlash(e[0],!0),"**/*")}`))})];
|
@@ -1 +0,0 @@
|
|
1
|
-
import webpack from"webpack";import{getLastCommitHash,gitBranchName}from"@armit/git";import{logger,mergeOptions}from"@flatjs/common";export const createBuiltinDefineVariables=async(e,t)=>{const{ci:i}=t,n=i?.releaseVersion;let r={"process.env.FLAT_RELEASE_VERSION":JSON.stringify(n)};try{const e=await getLastCommitHash(),t=await gitBranchName();r=mergeOptions({"process.env.FLAT_COMMIT_HASH":JSON.stringify(e),"process.env.FLAT_BRANCH_NAME":JSON.stringify(t),"process.env.FLAT_RELEASE_VERSION":JSON.stringify(e)},r)}catch(e){logger.warn(`Failed to get commit hash or branch name: ${e.message}`)}return[new webpack.DefinePlugin({__SENTRY_DEBUG__:e,"process.env.FLAT_BUILD_DATE":JSON.stringify((new Date).toISOString()),...r,...t.pluginOptions.definePlugin})]};
|
@@ -1 +0,0 @@
|
|
1
|
-
export * from './define-variable-plugin.js';
|
@@ -1 +0,0 @@
|
|
1
|
-
export*from"./define-variable-plugin.js";
|
@@ -1 +0,0 @@
|
|
1
|
-
import htmlWebpackPlugin from"html-webpack-plugin";const PLUGIN_PREFIX="HtmlInjectScriptPlugin";export class HtmlInjectScriptPlugin{constructor(t){this.scripts=t||[]}processScripts(){return this.scripts.filter(Boolean).map((t=>({tagName:"script",innerHTML:t,voidTag:!1,attributes:{},meta:{plugin:"html-inject-script-webpack-plugin"}})))}apply(t){t.hooks.compilation.tap(`${PLUGIN_PREFIX}_compilation`,(t=>{htmlWebpackPlugin.getHooks(t).alterAssetTags.tap(`${PLUGIN_PREFIX}_alterAssetTags`,(t=>(t.assetTags.scripts.unshift(...this.processScripts()),t)))}))}}
|
@@ -1 +0,0 @@
|
|
1
|
-
import webpackSources from"webpack-sources";const PLUGIN_NAME="ExternalTemplateRemotesPlugin",isExternalModule=e=>"ExternalModule"===e.constructor.name;function extractUrlAndGlobal(e){const t=e.indexOf("@");if(t<=0||t===e.length-1)throw new Error(`Invalid request "${e}"`);return[e.substring(t+1),e.substring(0,t)]}export class ExternalTemplateRemotesPlugin{apply(e){e.hooks.make.tap(PLUGIN_NAME,(e=>{const t=[];e.hooks.buildModule.tap(PLUGIN_NAME,(e=>{isExternalModule(e)&&"script"===e.externalType&&t.push(e)})),e.hooks.afterCodeGeneration.tap(PLUGIN_NAME,(()=>{t.forEach((t=>{const o=extractUrlAndGlobal(t.request)[0],n=toExpression(o),r=e.codeGenerationResults.get(t,void 0).sources,s=r.get("javascript");if(s){const e=new webpackSources.RawSource(s.source().toString().replace(`"${o}"`,n));r.set("javascript",e)}}))}))}))}}function toExpression(e){const t=[],o=[];let n=!1,r=!1;for(const s of e)if("["===s){if(n){r=!0;break}n=!0,o.length&&(t.push(`"${o.join("")}"`),o.length=0)}else if("]"===s){if(!n){r=!0;break}n=!1,o.length&&(t.push(`${o.join("")}`),o.length=0),o.length=0}else o.push(s);if(n||r)throw new Error(`Invalid template URL "${e}"`);return o.length&&t.push(`"${o.join("")}"`),t.join(" + ")}
|
@@ -1 +0,0 @@
|
|
1
|
-
export * from './module-federation.js';
|
@@ -1 +0,0 @@
|
|
1
|
-
export*from"./module-federation.js";
|
@@ -1,4 +0,0 @@
|
|
1
|
-
import { type WebpackPluginInstance } from 'webpack';
|
2
|
-
import { type EntryMapItem } from '../../types/types-entry-map.js';
|
3
|
-
import { type FlatEvolveOptions } from '../../types/types-options.js';
|
4
|
-
export declare const createModuleFederationPlugin: (serveMode: boolean, entryMapItemList: EntryMapItem[], evolveOptions: FlatEvolveOptions) => WebpackPluginInstance[];
|
@@ -1 +0,0 @@
|
|
1
|
-
import{join}from"node:path";import webpack from"webpack";import{ensureSlash}from"@flatjs/common";import{normalizeEvolveEntryName}from"../../helpers/normalize-entry-map.js";import{injectFederationScripts}from"../../helpers/script-injects.js";import{HtmlInjectScriptPlugin}from"../html-inject-scripts/plugin-html-inject-script.js";import{ExternalTemplateRemotesPlugin}from"./external-template-remotes.js";const normalizeWidgetName=(e="")=>e.replace(/[/-]/g,"_").toLowerCase(),remoteFileName=e=>join(e,"micro-remote-module.js");export const createModuleFederationPlugin=(e,t,o)=>{const r=o.projectVirtualPath,n=o.multiHtmlCdn,i=o.multiHtmlCdnEnvResolver,m=[];for(const o of t){const[t,a]=o,l=a.options?.moduleFederation;if(l){const{remotes:o,exposes:a,...s}=l,c=remoteFileName(t),p=normalizeWidgetName(t),u=(a?Array.isArray(a)?a:[a]:[]).map((e=>{const o={};for(const[r,n]of Object.entries(e))o[r]={...n,name:join(t,n.name.replace(/^\//,""))};return o})),d=(o||[]).map((({name:e,endpoint:t})=>{const o=normalizeEvolveEntryName(e,r),n=normalizeWidgetName(o),i=remoteFileName(o),m=t?ensureSlash(t(e,o),!1):"[window.evolveFetchMicroWidgets()]";return{[n]:`${n}@${m}/${i}`}}));m.push(new webpack.container.ModuleFederationPlugin({...s,name:p,filename:c,remotes:d,exposes:u}),new ExternalTemplateRemotesPlugin),e||m.unshift(new HtmlInjectScriptPlugin([injectFederationScripts(n,i)]))}}return m};
|
@@ -1,4 +0,0 @@
|
|
1
|
-
import { type WebpackPlugin } from '../../create-webpack/types.js';
|
2
|
-
import { type EntryMapItem } from '../../types/types-entry-map.js';
|
3
|
-
import { type FlatEvolveOptions } from '../../types/types-options.js';
|
4
|
-
export declare const createHtmlPlugins: (serveMode: boolean, entryMapItemList: EntryMapItem[], evolveOptions: FlatEvolveOptions) => WebpackPlugin[];
|
@@ -1 +0,0 @@
|
|
1
|
-
import{FlatEvolveMultiCdnPlugin}from"./multi-html-cdn-plugin.js";import{createMultiHtmlWebpackPlugin}from"./multi-html-plugin.js";export const createHtmlPlugins=(t,l,u)=>{const i=[],n=l[0];if(t||n[1]?.options?.output?.library)return i;const e=Object.keys(u.multiHtmlCdn);return i.push(...createMultiHtmlWebpackPlugin(t,u,l,e)),i.push(new FlatEvolveMultiCdnPlugin(u)),i};
|
@@ -1 +0,0 @@
|
|
1
|
-
import HtmlWebpackPlugin from"html-webpack-plugin";import{basename}from"node:path";import webpack from"webpack";import{ensureSlash}from"@flatjs/common";import{getRuntimeCDNBase}from"../../helpers/get-runtime-cdn-base.js";import{findEnvCdn,httpUrlJoin}from"../../helpers/script-injects.js";export class FlatEvolveMultiCdnPlugin{constructor(e){if(this.pluginName="FlatEvolveMultiCdnPlugin",this.requireFn=webpack.RuntimeGlobals.publicPath,this.config=e.multiHtmlCdn,this.cdnResolver=e.multiHtmlCdnEnvResolver||function cdnResolver(){},!this.config?.prod)throw new Error("We must setup `prod` for each CDN config node!")}apply(e){e.hooks.thisCompilation.tap(this.pluginName,(e=>{e.mainTemplate.hooks.requireExtensions.tap(this.pluginName,((t,n)=>{const s=[];s.push("// Dynamic assets path override(`@flatjs/evolve`) plugin-multi-html-cdn`)");const i=e.chunkGraph?.getTreeRuntimeRequirements(n);return i&&i.has(webpack.RuntimeGlobals.requireScope)&&s.push(webpack.Template.indent(getRuntimeCDNBase(this.config,this.cdnResolver,this.requireFn))),webpack.Template.asString(s)}))})),e.hooks.compilation.tap(this.pluginName,(e=>{HtmlWebpackPlugin.getHooks(e).beforeAssetTagGeneration.tap(this.pluginName,(e=>{const{assets:t,plugin:n,outputName:s}=e,i=n?.options?.chunks||[],r=Array.isArray(i)?i.find((e=>s.includes(ensureSlash(e,!0)))):i,{userOptions:o}=e.plugin;if(!r)throw new Error("We must have current chunk!");const a=t.js.filter((e=>e.includes(ensureSlash(r,!0)))),l=t.css.filter((e=>e.includes(ensureSlash(r,!0)))),p=o.multiCdn,u=t.publicPath,m=a.map((e=>{if(p.disabled)return basename(e);const t=findEnvCdn(this.config,p.env);return httpUrlJoin(t,e.replace(u,""))})),c=l.map((e=>{if(p.disabled)return basename(e);const t=findEnvCdn(this.config,p.env);return httpUrlJoin(t,e.replace(u,""))}));return e.assets.js=m,e.assets.css=c,e}))}))}}
|
@@ -1 +0,0 @@
|
|
1
|
-
import HtmlWebpackPlugin from"html-webpack-plugin";import{ensureSlash}from"@flatjs/common";const getCurrentEntryOptions=(t=[],i)=>{const e=t.find((t=>i.includes(ensureSlash(t[0],!0))));return e?e[1]?.options:void 0};export class MultiHtmlModifyPlugin{constructor(t){this.pluginName="MultiHtmlModifyPlugin",this.entryMapItemList=t}apply(t){t.hooks.compilation.tap(this.pluginName,(t=>{HtmlWebpackPlugin.getHooks(t).beforeEmit.tapAsync(this.pluginName,((t,i)=>{const e=getCurrentEntryOptions(this.entryMapItemList,t.outputName);/<%= title %>/.test(t.html)&&(t.html=t.html.replace(/<%= title %>/g,e?.title||"")),i(null,t)}))}))}}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { type WebpackPlugin } from '../../create-webpack/types.js';
|
2
|
-
import { type EntryMapItem } from '../../types/types-entry-map.js';
|
3
|
-
import { type EvolveMultiCdnEnvType } from '../../types/types-multi-html.js';
|
4
|
-
import { type FlatEvolveOptions } from '../../types/types-options.js';
|
5
|
-
/**
|
6
|
-
* Create `html-webpack-plugin` for this build, refer to best practices
|
7
|
-
* We'd better pass only one entry for each `build` cycle
|
8
|
-
* @param buildEntryItem the entries for this `build`
|
9
|
-
* @param allEnv
|
10
|
-
*/
|
11
|
-
export declare const createMultiHtmlWebpackPlugin: (serveMode: boolean, evolveOptions: FlatEvolveOptions, entryMapItemList: EntryMapItem[], allEnv: Array<EvolveMultiCdnEnvType>) => WebpackPlugin[];
|
@@ -1 +0,0 @@
|
|
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";import{MultiHtmlModifyPlugin}from"./multi-html-modify-plugin.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=[new MultiHtmlModifyPlugin(l)],{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:"<%= 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};
|
@@ -1,12 +0,0 @@
|
|
1
|
-
import { type WebpackPlugin } from '../../create-webpack/types.js';
|
2
|
-
import type { 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 +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}`)}}}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|