@flatjs/evolve 2.1.0-next.28 → 2.1.0-next.3
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/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 +1 @@
|
|
1
|
-
import{arrayUnique,
|
1
|
+
import{arrayUnique,urlJoin}from"@flatjs/common";import{attachMockMiddlewares}from"@flatjs/mock";import{createAppPageRoute,createDevServer,createDevServerCompilerTasks,createDevServerEntries}from"../dev-server/index.js";import{openPage}from"../helpers/index.js";import{normalizePageProxy}from"../helpers/normalize-page-proxy.js";import{envVerify}from"./env-verify.js";export const prepareServe=async(e,r,o)=>{await envVerify(e,o);const{app:t,devPort:a,devHostUri:i,publicIp:s}=await createDevServer(o),p=o.devServer?.mockOptions?.mockFilters||[];for(const[,e]of Object.entries(r))p.push(...e.options?.mockFilters||[]);await attachMockMiddlewares(t,{...o.devServer?.mockOptions,mockFilters:arrayUnique(p),projectCwd:e});const n=await createDevServerEntries(a,r,o);createAppPageRoute(e,t,i,n,o);const c=normalizePageProxy(o.devServer?.pageProxy||"/pages"),v=urlJoin(i,[c]);o.devServer?.autoOpen&&openPage(v);const m=await createDevServerCompilerTasks(e,v,s,n,o);return Promise.all(m).then((()=>t))};
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import { type PartialDeep } from 'type-fest';
|
2
2
|
import { type ConfigLoaderOptions } from '../load-config/types.js';
|
3
3
|
import { type FlatEvolveOptions } from '../types/types-options.js';
|
4
|
-
import { type EvolveBuildResult } from './start-
|
4
|
+
import { type EvolveBuildResult } from './start-one-entry-build.js';
|
5
5
|
export declare function getBuildEntryFiles(projectCwd: string, diffFiles: string[], allEntryInputs: string[], resolveAlias?: Record<string, string>, graphTreeNodeFilter?: (moduleId: string) => boolean): Promise<string[]>;
|
6
6
|
/**
|
7
7
|
* Dynamic check which entry modules need to build.
|
8
8
|
* @returns
|
9
9
|
*/
|
10
10
|
export declare function dynamicCheckBuildEntryMap(projectCwd: string, earlyCommit?: string | null, lastCommit?: string, overrideEvolveOptions?: PartialDeep<FlatEvolveOptions>, configLoaderOptions?: ConfigLoaderOptions): Promise<{
|
11
|
-
buildEntries: import("
|
11
|
+
buildEntries: import("src/index.js").EvolveEntryMap;
|
12
12
|
newEvolveOptions: FlatEvolveOptions;
|
13
13
|
}>;
|
14
14
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
import
|
1
|
+
import{isAbsolute,join}from"node:path";import{getDiffFiles,getCommitIdOfBranch}from"@armit/git";import{arraysIntersect,chalk,logger,requireResolve}from"@flatjs/common";import{traverseGraph}from"@flatjs/graph";import Listr from"listr";import{moduleName}from"../constants.js";import{filterActivedEntriesByEntryInputs,filterActivedEntriesByModule}from"../helpers/filter-actived-entries.js";import{getGitRoot}from"../helpers/get-git-root.js";import{getMaxProcessTasks}from"../helpers/get-max-process-tasks.js";import{jsonSerializer}from"../helpers/json-serializer.js";import{resolveEntryMapInputFiles}from"../helpers/resolve-entry-map-input-files.js";import{loadEvolveConfig}from"../load-config/load-evolve-config.js";import{createThreadWorker}from"./create-thread-worker.js";import{envVerify}from"./env-verify.js";export async function getBuildEntryFiles(e,r,t,i,o){const n=[],s=[];for(const e of t)r.includes(e)?n.push(e):s.push(e);if(o&&logger.info("Use custom graph traverse filter",moduleName),s.length){const t=await traverseGraph({input:s,projectCwd:e,treeNodeFilter:o||(()=>!0),lessImportOptions:{projectCwd:e,aliases:i}});if(!t)return n;logger.debug(`DependencyGraph:\n${JSON.stringify(t,null,2)}`);for(const e of s){const i=t[e]||[];arraysIntersect(i,r)&&n.push(e)}}return n}export async function dynamicCheckBuildEntryMap(e,r,t,i,o){const n={projectCwd:e,command:"build",resolve:requireResolve},s=await loadEvolveConfig(n,e,i,o);if(s.ci?.fixedBuildModules&&s.ci?.fixedBuildModules.length){logger.info("Use `fixedBuildModules` configuration to build...");return{buildEntries:filterActivedEntriesByModule(s.entryMap,s.ci?.fixedBuildModules),newEvolveOptions:s}}if(logger.info("Dynamicly checking code changed modules ..."),!r){const e=s.ci?.basedBranch||"origin/master";r=await getCommitIdOfBranch(e),logger.info(`Resolving base branch "${e}" commit hash "${r}" ...`)}let a=r?await getDiffFiles(r,t):[];const l=getGitRoot(e);if(!l)throw new Error(`No .git root (${e}) found`);if(a=a.map((e=>isAbsolute(e)?e:join(l,e))),logger.debug(`Diff files: \n${JSON.stringify(a,null,2)}`),!a.length)return logger.warn("It seems that there are no code files changed."),{buildEntries:{},newEvolveOptions:s};const c=await resolveEntryMapInputFiles(e,s.entryMap),d=await getBuildEntryFiles(e,a,c,s.webpack?.resolve?.alias,s.ci?.graphTreeNodeFilter);logger.debug(`To build entry files: \n${JSON.stringify(d,null,2)}`);return{buildEntries:await filterActivedEntriesByEntryInputs(e,s.entryMap,d),newEvolveOptions:s}}export const startDynamicBuild=async(e,r,t,i={},o)=>{const{buildEntries:n,newEvolveOptions:s}=await dynamicCheckBuildEntryMap(e,r,t,i,o);await envVerify(e,s);const a=Object.keys(n);if(!a.length)return logger.warn("No build entries providered!"),[];const l=getMaxProcessTasks(a.length,s.maxProcesses);logger.info(`Start dynamic build with (${chalk(["magenta"])(String(l))}) workers:\n${JSON.stringify({buildEntries:a},null,2)}`);const c=await createThreadWorker(l),d=new Listr([],{concurrent:l,exitOnError:!0}),f=[];for(const[r]of Object.entries(n))d.add({title:`Build module ${chalk(["magenta"])(r)} ...`,task:async()=>{const t=await c.startBuildWorker(e,r,jsonSerializer.stringify(i),o);f.push(t)}});return d.tasks.length&&await d.run(),c.pool.terminate(),f};
|
@@ -1,23 +1,12 @@
|
|
1
|
-
import { MessageChannel } from 'node:worker_threads';
|
2
1
|
import { type ConfigLoaderOptions } from '../load-config/types.js';
|
3
|
-
import {
|
4
|
-
import { type EvolveBuildResult } from './start-group-entry-build.js';
|
2
|
+
import { type EvolveBuildResult } from './start-one-entry-build.js';
|
5
3
|
/**
|
6
4
|
* FIXME: The main entry to start an evolve `build`, NOTE: avoid pass configuration with `function` here.
|
7
5
|
* If you need to call build api avoid `worker` you can directly call `prepareBuild`
|
8
6
|
* @internal
|
9
|
-
* @param
|
10
|
-
* @param
|
11
|
-
* @param
|
12
|
-
* @param
|
7
|
+
* @param projectCwd The Root directory (workspace) of this project.
|
8
|
+
* @param entryKey The `entryKey` for one entry build task
|
9
|
+
* @param serializedEvolveOptions The overrided evolve options, NOTE: we will serialize `function` property here first
|
10
|
+
* @param configLoaderOptions Evolve config loader options, NOTE: avoid pass configuration with `function` here.
|
13
11
|
*/
|
14
|
-
declare const
|
15
|
-
projectCwd: string;
|
16
|
-
entryKeys: string[];
|
17
|
-
serializedEvolveOptions: string;
|
18
|
-
configLoaderOptions?: ConfigLoaderOptions;
|
19
|
-
messagePort?: MessageChannel["port1"];
|
20
|
-
groupName?: string;
|
21
|
-
cliOptions?: FlatCliOptions;
|
22
|
-
}) => Promise<EvolveBuildResult>;
|
23
|
-
export default _default;
|
12
|
+
export declare const startBuildWorker: (projectCwd: string, entryKey: string, serializedEvolveOptions: string, configLoaderOptions?: ConfigLoaderOptions) => Promise<EvolveBuildResult>;
|
@@ -1 +1 @@
|
|
1
|
-
import{
|
1
|
+
import{requireResolve}from"@flatjs/common";import{filterActivedEntriesByModule}from"../helpers/filter-actived-entries.js";import{jsonSerializer}from"../helpers/json-serializer.js";import{normalizeEvolveEntryMap}from"../helpers/normalize-entry-map.js";import{loadEvolveConfig}from"../load-config/load-evolve-config.js";import{prepareBuild}from"./prepare-build.js";export const startBuildWorker=async(e,r,o,i)=>{const l={projectCwd:e,command:"build",resolve:requireResolve},t=jsonSerializer.parse(o)||{},n=await loadEvolveConfig(l,e,t,i),a=filterActivedEntriesByModule(n.entryMap,[new RegExp(`^${r}$`)]);if(!Object.keys(a).length)throw new Error(`No build entry resolved via "${r}" on "startBuildWorker"!`);const s=normalizeEvolveEntryMap(a,n.entryMap)[r];return prepareBuild([r,s],n)};
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { type PartialDeep } from 'type-fest';
|
2
2
|
import { type ConfigLoaderOptions } from '../load-config/types.js';
|
3
|
-
import { FlatCliOptions } from '../types/types-cli-options.js';
|
4
3
|
import { type FlatEvolveOptions } from '../types/types-options.js';
|
5
|
-
import { type EvolveBuildResult } from './start-
|
6
|
-
export declare const startBuild: (projectCwd: string, buildModules: string[], overrideEvolveOptions?: PartialDeep<FlatEvolveOptions>, configLoaderOptions?: ConfigLoaderOptions
|
4
|
+
import { type EvolveBuildResult } from './start-one-entry-build.js';
|
5
|
+
export declare const startBuild: (projectCwd: string, buildModules: string[], overrideEvolveOptions?: PartialDeep<FlatEvolveOptions>, configLoaderOptions?: ConfigLoaderOptions) => Promise<EvolveBuildResult[]>;
|
package/dist/main/start-build.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
import
|
1
|
+
import{chalk,logger,requireResolve}from"@flatjs/common";import Listr from"listr";import{filterActivedEntriesByModule}from"../helpers/filter-actived-entries.js";import{getMaxProcessTasks}from"../helpers/get-max-process-tasks.js";import{jsonSerializer}from"../helpers/json-serializer.js";import{loadEvolveConfig}from"../load-config/load-evolve-config.js";import{createThreadWorker}from"./create-thread-worker.js";import{envVerify}from"./env-verify.js";export const startBuild=async(e,r,t={},o)=>{const i={projectCwd:e,command:"build",resolve:requireResolve},s=await loadEvolveConfig(i,e,t,o);await envVerify(e,s);const a=filterActivedEntriesByModule(s.entryMap,r),n=Object.keys(a);if(!n.length)return logger.warn("No build entries providered!"),[];const l=getMaxProcessTasks(n.length,s.maxProcesses);logger.info(`Start standard build with (${chalk(["magenta"])(String(l))}) workers:\n${JSON.stringify({buildEntries:n},null,2)}`);const c=await createThreadWorker(l),d=new Listr([],{concurrent:l,exitOnError:!0}),m=[];for(const[r]of Object.entries(a))d.add({title:`Build module ${chalk(["magenta"])(r)} ...`,task:async()=>{const i=await c.startBuildWorker(e,r,jsonSerializer.stringify(t),o);m.push(i)}});return d.tasks.length&&await d.run(),c.pool.terminate(),m};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { type EvolveEntryMap } from '../types/types-entry-map.js';
|
2
|
+
import { type FlatEvolveOptions } from '../types/types-options.js';
|
3
|
+
export type EvolveBuildResult = {
|
4
|
+
name?: string;
|
5
|
+
warningStats?: unknown;
|
6
|
+
};
|
7
|
+
/**
|
8
|
+
* The helpers to build one entry at a time
|
9
|
+
* @param singleBuildEntry The single entry
|
10
|
+
* @param buildPublicPath
|
11
|
+
* @param evolveOptions
|
12
|
+
*/
|
13
|
+
export declare const startOneEntryBuild: (singleBuildEntry: EvolveEntryMap, evolveOptions: FlatEvolveOptions) => Promise<EvolveBuildResult>;
|
@@ -0,0 +1 @@
|
|
1
|
+
import webpack from"webpack";import{loadWebpackConfig}from"../create-webpack/load-webpack-config.js";import{splitToMultiCompilerConfigs}from"../helpers/split-to-multi-compiler.js";export const startOneEntryBuild=async(r,o)=>{const t=await loadWebpackConfig("production",r,o),n=splitToMultiCompilerConfigs(r,t,o,!1);if(n.length>1)throw new Error("startOneEntryBuild() only support `compiler` at a time");const e=n[0];return new Promise(((r,t)=>{webpack(e,((n,i)=>{if(n)return t(n);const a=i?.toJson();return a?.errors?.length?t(a.errors):o.rejectWarnings&&a?.warnings?.length?t(a.warnings):void r({name:e.name,warningStats:a?.warnings})}))}))};
|
@@ -8,4 +8,4 @@ import { type FlatEvolveOptions } from '../types/types-options.js';
|
|
8
8
|
* @param overrideEvolveOptions The overrided evolve options
|
9
9
|
* @param configLoaderOptions Evolve config loader options
|
10
10
|
*/
|
11
|
-
export declare const startServe: (projectCwd: string, serveModules: string[], overrideEvolveOptions?: PartialDeep<FlatEvolveOptions>, configLoaderOptions?: ConfigLoaderOptions) => Promise<never[] | import("express-serve-static-core").Express
|
11
|
+
export declare const startServe: (projectCwd: string, serveModules: string[], overrideEvolveOptions?: PartialDeep<FlatEvolveOptions>, configLoaderOptions?: ConfigLoaderOptions) => Promise<never[] | import("express-serve-static-core").Express>;
|
package/dist/main/start-serve.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
import{logger,requireResolve}from"@flatjs/common";import{
|
1
|
+
import{logger,requireResolve}from"@flatjs/common";import{filterActivedEntriesByModule}from"../helpers/filter-actived-entries.js";import{normalizeEvolveEntryMap}from"../helpers/normalize-entry-map.js";import{loadEvolveConfig}from"../load-config/load-evolve-config.js";import{prepareServe}from"./prepare-serve.js";export const startServe=async(e,r,o={},t)=>{const i={projectCwd:e,command:"serve",resolve:requireResolve},n=await loadEvolveConfig(i,e,o,t),l=filterActivedEntriesByModule(n.entryMap,r),s=Object.keys(l);if(!s.length)return logger.warn("No served entries providered!"),[];logger.info({servedEntries:s});const v=normalizeEvolveEntryMap(l,n.entryMap);return prepareServe(e,v,n)};
|
@@ -1 +1 @@
|
|
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)}
|
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)}const m=terserMinimizer(r?.minimizer?.terserOptions||{});return e.push(m),e};
|
@@ -1 +1 @@
|
|
1
|
-
import
|
1
|
+
import{projectHasYarn}from"@armit/package";import{chalk,logger,requireResolve}from"@flatjs/common";import ImageMinimizerPlugin from"image-minimizer-webpack-plugin";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(i){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,3 +1,3 @@
|
|
1
|
-
import TerserPlugin from"terser-webpack-plugin";import{
|
1
|
+
import{mergeOptions}from"@flatjs/common";import TerserPlugin from"terser-webpack-plugin";import{defaultTerserOptions}from"./default-options.js";export const terserMinimizer=e=>new TerserPlugin({parallel:!0,
|
2
2
|
// Disable Extract all or some (use /^\**!|@preserve|@license|@cc_on/i RegExp) comments.
|
3
3
|
extractComments:!1,terserOptions:mergeOptions(defaultTerserOptions,e)});
|
@@ -1 +1 @@
|
|
1
|
-
import{relative}from"node:path";import Graph from"tarjan-graph";import webpack from"webpack";
|
1
|
+
import{relative}from"node:path";import{mergeOptions}from"@flatjs/common";import Graph from"tarjan-graph";import webpack from"webpack";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)}))}}
|
@@ -6,4 +6,4 @@ import { type FlatEvolveOptions } from '../../types/types-options.js';
|
|
6
6
|
* @param singleEntryItem
|
7
7
|
* @returns
|
8
8
|
*/
|
9
|
-
export declare const createCleanWebpackPlugin: (serveMode: boolean,
|
9
|
+
export declare const createCleanWebpackPlugin: (serveMode: boolean, entryMapItem: EntryMapItem, evolveOptions: FlatEvolveOptions) => WebpackPlugin[];
|
@@ -1 +1 @@
|
|
1
|
-
import{join}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:
|
1
|
+
import{join}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:[`${join(ensureSlash(n[0],!0),"**/*")}`]})];
|
@@ -1 +1 @@
|
|
1
|
-
import
|
1
|
+
import{getLastCommitHash,gitBranchName}from"@armit/git";import webpack from"webpack";export const createBuiltinDefineVariables=async(e,i)=>{const t=await getLastCommitHash(),n=await gitBranchName();return[new webpack.DefinePlugin({__SENTRY_DEBUG__:e,"process.env.FLAT_BUILD_DATE":JSON.stringify((new Date).toISOString()),"process.env.FLAT_COMMIT_HASH":JSON.stringify(t),"process.env.FLAT_BRANCH_NAME":JSON.stringify(n),"process.env.FLAT_RELEASE_VERSION":JSON.stringify(i.ci?.releaseVersion||t),...i.pluginOptions.definePlugin})]};
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import { type WebpackPluginInstance } 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 createModuleFederationPlugin: (serveMode: boolean,
|
4
|
+
export declare const createModuleFederationPlugin: (serveMode: boolean, entryMapItem: EntryMapItem, evolveOptions: FlatEvolveOptions) => WebpackPluginInstance[];
|
@@ -1 +1 @@
|
|
1
|
-
import{join}from"node:path";import
|
1
|
+
import{join}from"node:path";import{ensureSlash}from"@flatjs/common";import webpack from"webpack";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,r)=>{const o=r.projectVirtualPath,[n,i]=t,m=r.multiHtmlCdn,a=r.multiHtmlCdnEnvResolver,l=i.options?.moduleFederation,s=[];if(l){const{remotes:t,exposes:r,...i}=l,p=remoteFileName(n),c=normalizeWidgetName(n),u=(r?Array.isArray(r)?r:[r]:[]).map((e=>{const t={};for(const[r,o]of Object.entries(e))t[r]={...o,name:join(n,o.name.replace(/^\//,""))};return t})),d=(t||[]).map((({name:e,endpoint:t})=>{const r=normalizeEvolveEntryName(e,o),n=normalizeWidgetName(r),i=remoteFileName(r);return{[n]:`${n}@${t?ensureSlash(t(e,r),!1):"[window.evolveFetchMicroWidgets()]"}/${i}`}}));s.push(new webpack.container.ModuleFederationPlugin({...i,name:c,filename:p,remotes:d,exposes:u}),new ExternalTemplateRemotesPlugin),e||s.unshift(new HtmlInjectScriptPlugin([injectFederationScripts(m,a)]))}return s};
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import { type WebpackPlugin } from '../../create-webpack/types.js';
|
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 createHtmlPlugins: (serveMode: boolean,
|
4
|
+
export declare const createHtmlPlugins: (serveMode: boolean, entryMapItem: EntryMapItem, evolveOptions: FlatEvolveOptions) => WebpackPlugin[];
|
@@ -1 +1 @@
|
|
1
|
-
import{FlatEvolveMultiCdnPlugin}from"./multi-html-cdn-plugin.js";import{createMultiHtmlWebpackPlugin}from"./multi-html-plugin.js";export const createHtmlPlugins=(t,l,u)=>{const i=[]
|
1
|
+
import{FlatEvolveMultiCdnPlugin}from"./multi-html-cdn-plugin.js";import{createMultiHtmlWebpackPlugin}from"./multi-html-plugin.js";export const createHtmlPlugins=(t,l,u)=>{const i=[];if(t||l[1]?.options?.output?.library)return i;const n=Object.keys(u.multiHtmlCdn);return i.push(...createMultiHtmlWebpackPlugin(t,u,l,n)),i.push(new FlatEvolveMultiCdnPlugin(u)),i};
|
@@ -1 +1 @@
|
|
1
|
-
import
|
1
|
+
import{basename}from"node:path";import HtmlWebpackPlugin from"html-webpack-plugin";import webpack from"webpack";import{cdnFinder,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,((n,t)=>{const i=[];i.push("// Dynamic assets path override(`@flatjs/evolve`) plugin-multi-html-cdn`)");const s=e.chunkGraph?.getTreeRuntimeRequirements(t);return s&&s.has(webpack.RuntimeGlobals.requireScope)&&(i.push("(function () {"),i.push(webpack.Template.indent("var flatjsMultiCdn = {")),i.push(webpack.Template.indent(webpack.Template.indent([`cdnConfig: ${JSON.stringify(this.config||{})},`]))),i.push(webpack.Template.indent(webpack.Template.indent([`cdnResolver: ${this.cdnResolver.toString()},`]))),i.push(webpack.Template.indent(webpack.Template.indent([`cdnFinder: ${cdnFinder.toString()}`]))),i.push(webpack.Template.indent("};")),i.push(webpack.Template.indent(`${this.requireFn} = flatjsMultiCdn.cdnFinder(flatjsMultiCdn.cdnConfig, flatjsMultiCdn.cdnResolver) || ${this.requireFn};`)),i.push("})();")),webpack.Template.asString(i)}))})),e.hooks.compilation.tap(this.pluginName,(e=>{HtmlWebpackPlugin.getHooks(e).beforeAssetTagGeneration.tap(this.pluginName,(e=>{const{assets:n}=e,{userOptions:t}=e.plugin,i=t.multiCdn,s=n.publicPath,a=n.js.map((e=>{if(i.disabled)return basename(e);const n=findEnvCdn(this.config,i.env);return httpUrlJoin(n,e.replace(s,""))})),p=n.css.map((e=>{if(i.disabled)return basename(e);const n=findEnvCdn(this.config,i.env);return httpUrlJoin(n,e.replace(s,""))}));return e.assets.js=a,e.assets.css=p,e}))}))}}
|
@@ -8,4 +8,4 @@ import { type FlatEvolveOptions } from '../../types/types-options.js';
|
|
8
8
|
* @param buildEntryItem the entries for this `build`
|
9
9
|
* @param allEnv
|
10
10
|
*/
|
11
|
-
export declare const createMultiHtmlWebpackPlugin: (serveMode: boolean, evolveOptions: FlatEvolveOptions,
|
11
|
+
export declare const createMultiHtmlWebpackPlugin: (serveMode: boolean, evolveOptions: FlatEvolveOptions, entryMapItem: EntryMapItem, allEnv: Array<EvolveMultiCdnEnvType>) => WebpackPlugin[];
|
@@ -1 +1 @@
|
|
1
|
-
import HtmlWebpackPlugin from"html-webpack-plugin";import{
|
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{findEnvCdn}from"../../helpers/script-injects.js";const minifyOpts={minifyJS:!0,removeComments:!0,collapseWhitespace:!0,collapseBooleanAttributes:!1};export const createMultiHtmlWebpackPlugin=(e,t,i,l)=>{const[n,o]=i,r=[],{options:m}=o,g=e?"development":"production";for(const e of l){const l={mode:g,envCdn:findEnvCdn(t.multiHtmlCdn,e)};r.push(new HtmlWebpackPlugin({inject:"body",title:getHtmlPluginConfig("title",l,m?.title),chunks:[n],minify:!1!==m?.htmlMinify&&!["me","dev"].includes(e)&&minifyOpts,filename:`${n}/index${"prod"===e?"":`-${e}`}.html`,template:getHtmlPluginConfig("templatePath",l,m?.templatePath).replace("{0}",e),templateParameters:{title:getHtmlPluginConfig("title",l,m?.title),favicon:getHtmlPluginConfig("favicon",l,m?.favicon),headBeforeHtmlTags:getHtmlPluginConfig("headBeforeHtmlTags",l,m?.headBeforeHtmlTags),inlineScripts:getHtmlPluginConfig("inlineScripts",l,m?.inlineScripts),headBeforeStyles:getHtmlPluginConfig("headBeforeStyles",l,m?.headBeforeStyles),headBeforeScripts:getHtmlPluginConfig("headBeforeScripts",l,m?.headBeforeScripts),bodyAfterScripts:getHtmlPluginConfig("bodyAfterScripts",l,m?.bodyAfterScripts),viewport:allowPx2remForModule(i,t)?getHtmlPluginConfig("viewport",l,m?.viewport):""},multiCdn:{env:e,disabled:(m?.excludeCdnEnvs||["me","dev","ntv"]).includes(e)}}))}return r};
|
package/dist/types/index.d.ts
CHANGED
@@ -1,10 +1,8 @@
|
|
1
|
-
export * from './types-analyzer.js';
|
2
1
|
export * from './types-dev-server.js';
|
3
2
|
export * from './types-entry-map.js';
|
4
3
|
export * from './types-federation.js';
|
5
|
-
export * from './types-global-compiler-options.js';
|
6
|
-
export * from './types-loader-options.js';
|
7
4
|
export * from './types-modular-import.js';
|
8
5
|
export * from './types-multi-html.js';
|
9
6
|
export * from './types-options.js';
|
7
|
+
export * from './types-loader-options.js';
|
10
8
|
export * from './types-webpack.js';
|
package/dist/types/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export*from"./types-
|
1
|
+
export*from"./types-dev-server.js";export*from"./types-entry-map.js";export*from"./types-federation.js";export*from"./types-modular-import.js";export*from"./types-multi-html.js";export*from"./types-options.js";export*from"./types-loader-options.js";export*from"./types-webpack.js";
|
@@ -1,6 +1,7 @@
|
|
1
|
+
import { type SecureContextHttps, type FlatMockOptions } from '@flatjs/mock';
|
1
2
|
import { type RequestHandler } from 'express';
|
2
|
-
import { type
|
3
|
-
import { type
|
3
|
+
import { type Configuration } from 'webpack';
|
4
|
+
import { type WebSocketURL, type ClientConfiguration } from 'webpack-dev-server';
|
4
5
|
import { type EvolveEntryMapContent } from './types-entry-map.js';
|
5
6
|
export interface WebpackWatchOptions {
|
6
7
|
/**
|
@@ -12,9 +13,9 @@ export interface WebpackWatchOptions {
|
|
12
13
|
*/
|
13
14
|
followSymlinks?: boolean;
|
14
15
|
/**
|
15
|
-
* Ignore some files from watching
|
16
|
+
* Ignore some files from watching (glob pattern or regexp).
|
16
17
|
*/
|
17
|
-
ignored?: string[];
|
18
|
+
ignored?: string | RegExp | string[];
|
18
19
|
/**
|
19
20
|
* Enable polling mode for watching.
|
20
21
|
*/
|
@@ -35,19 +36,7 @@ export type FlatEvolveDevServerOptions = {
|
|
35
36
|
* In webpack-dev-server watch mode is enabled by default.
|
36
37
|
* This configuration will be merged into `webpack-dev-server`
|
37
38
|
*/
|
38
|
-
watchOptions?:
|
39
|
-
/**
|
40
|
-
* Provides the ability to execute a custom function and apply custom middleware(s).
|
41
|
-
* https://webpack.js.org/configuration/dev-server/#devserversetupmiddlewares
|
42
|
-
* @default []
|
43
|
-
*/
|
44
|
-
devBeforeMiddlewares?: Middleware[];
|
45
|
-
/**
|
46
|
-
* Provides the ability to execute a custom function and apply custom middleware(s).
|
47
|
-
* https://webpack.js.org/configuration/dev-server/#devserversetupmiddlewares
|
48
|
-
* @default []
|
49
|
-
*/
|
50
|
-
devAfterMiddlewares?: Middleware[];
|
39
|
+
watchOptions?: Configuration['watchOptions'];
|
51
40
|
/**
|
52
41
|
* Allow us costomized global serve data injected into `window.GLOBAL = {...globalData}`
|
53
42
|
*/
|
@@ -59,8 +59,8 @@ export interface EvolveEntryItemOption extends MultiHtmlCDNEntryItem {
|
|
59
59
|
*/
|
60
60
|
mockFilters?: Array<string | RegExp>;
|
61
61
|
/**
|
62
|
-
* Extends the default `output` configuration for each entry item
|
63
|
-
*
|
62
|
+
* Extends the default `output` configuration for each entry item.
|
63
|
+
* normally we use `output.library` to define the global variable name.
|
64
64
|
* @example
|
65
65
|
* ```ts
|
66
66
|
*'plugin-chart': {
|
@@ -78,29 +78,11 @@ export interface EvolveEntryItemOption extends MultiHtmlCDNEntryItem {
|
|
78
78
|
* ```
|
79
79
|
* @default undefined
|
80
80
|
*/
|
81
|
-
output?:
|
81
|
+
output?: Configuration['output'];
|
82
82
|
}
|
83
83
|
export type EvolveEntryMapContent = {
|
84
84
|
entry: [string, ...string[]];
|
85
85
|
options?: EvolveEntryItemOption;
|
86
|
-
/**
|
87
|
-
* An alias used when grouping builds
|
88
|
-
*/
|
89
|
-
groupName?: string;
|
90
|
-
/**
|
91
|
-
* The basis of the grouping, this configuration takes effect when re-entering a group
|
92
|
-
*
|
93
|
-
* If groupingSource is `manual`, The grouping depends on the manually set groupName
|
94
|
-
*
|
95
|
-
* If groupingSource is `auto`, Grouping depends on whether the entry options are the same
|
96
|
-
*
|
97
|
-
* @default 'auto'
|
98
|
-
*/
|
99
|
-
groupingSource?: 'auto' | 'manual';
|
100
|
-
/**
|
101
|
-
* The base path of the entry module
|
102
|
-
*/
|
103
|
-
entryModuleBase?: string[];
|
104
86
|
};
|
105
87
|
export interface EvolveEntryMap {
|
106
88
|
/**
|
@@ -1,7 +1,6 @@
|
|
1
|
-
import { type AcceptedPlugin } from 'postcss';
|
2
|
-
import { type LoaderContext } from 'webpack';
|
3
1
|
import { type TransformOptions } from '@babel/core';
|
4
2
|
import { type PostcssPluginPixelOptions } from '@flatjs/forge-postcss-plugin-pixel';
|
3
|
+
import { type AcceptedPlugin } from 'postcss';
|
5
4
|
import { type ModularImportOption } from './types-modular-import.js';
|
6
5
|
export type BabelInputOptions = Pick<TransformOptions, 'presets' | 'plugins'>;
|
7
6
|
/**
|
@@ -15,34 +14,6 @@ export type BuiltinBabelOptions = BabelInputOptions & {
|
|
15
14
|
*/
|
16
15
|
usePreset?: 'react' | 'vue';
|
17
16
|
};
|
18
|
-
/**
|
19
|
-
* The configurations for `css-loader` modules
|
20
|
-
* https://github.com/webpack-contrib/css-loader/blob/master/README.md#modules
|
21
|
-
*/
|
22
|
-
export type CssLoaderModules = boolean | 'local' | 'global' | 'pure' | 'icss' | Partial<{
|
23
|
-
auto: boolean | RegExp | ((resourcePath: string) => boolean);
|
24
|
-
mode: 'local' | 'global' | 'pure' | 'icss' | ((resourcePath: any) => 'local' | 'global' | 'pure' | 'icss');
|
25
|
-
localIdentName: string;
|
26
|
-
localIdentContext: string;
|
27
|
-
localIdentHashSalt: string;
|
28
|
-
localIdentHashFunction: string;
|
29
|
-
localIdentHashDigest: string;
|
30
|
-
localIdentRegExp: string | RegExp;
|
31
|
-
getLocalIdent: (context: LoaderContext<any>, localIdentName: string, localName: string) => string;
|
32
|
-
namedExport: boolean;
|
33
|
-
exportGlobals: boolean;
|
34
|
-
exportLocalsConvention: 'as-is' | 'camel-case' | 'camel-case-only' | 'dashes' | 'dashes-only' | ((name: string) => string);
|
35
|
-
exportOnlyLocals: boolean;
|
36
|
-
getJSON: ({ resourcePath, imports, exports, replacements, }: {
|
37
|
-
resourcePath: string;
|
38
|
-
imports: object[];
|
39
|
-
exports: object[];
|
40
|
-
replacements: object[];
|
41
|
-
}) => Promise<void> | void;
|
42
|
-
}>;
|
43
|
-
export type CssLoaderOptions = {
|
44
|
-
modules?: CssLoaderModules;
|
45
|
-
} & Record<string, unknown>;
|
46
17
|
/**
|
47
18
|
* The configurations for `builtin` rule set options
|
48
19
|
*/
|
@@ -57,7 +28,9 @@ export interface RuleSetLoaderOptions {
|
|
57
28
|
* The configurations of `css-loader`
|
58
29
|
* https://github.com/webpack-contrib/css-loader/blob/master/README.md#modules
|
59
30
|
*/
|
60
|
-
cssLoaderOptions?:
|
31
|
+
cssLoaderOptions?: {
|
32
|
+
modules?: Record<string, unknown>;
|
33
|
+
} & Record<string, unknown>;
|
61
34
|
/**
|
62
35
|
* The config for `Less`
|
63
36
|
*/
|
@@ -67,6 +40,11 @@ export interface RuleSetLoaderOptions {
|
|
67
40
|
* @default []
|
68
41
|
*/
|
69
42
|
modularImports?: ModularImportOption[];
|
43
|
+
/**
|
44
|
+
* The value indicates whether runs typescript type checker and linter on separate process.
|
45
|
+
* @default true
|
46
|
+
*/
|
47
|
+
runTsChecker?: boolean;
|
70
48
|
/**
|
71
49
|
* The configration options of `postcss-loader`
|
72
50
|
*/
|
@@ -2,11 +2,9 @@ import { type VerifyPackagePattern } from '@armit/package';
|
|
2
2
|
import { type FlatEvolveCI } from './types-ci.js';
|
3
3
|
import { type FlatEvolveDevServerOptions } from './types-dev-server.js';
|
4
4
|
import { type EvolveEntryMap } from './types-entry-map.js';
|
5
|
-
import { type GlobalCompilerOptions } from './types-global-compiler-options.js';
|
6
5
|
import { type RuleSetLoaderOptions } from './types-loader-options.js';
|
7
|
-
import { type
|
6
|
+
import { type EvolveMultiCDNEnvResolver, type EvolveMultiCDNConfig } from './types-multi-html.js';
|
8
7
|
import { type EvolvePluginOptions } from './types-plugin-options.js';
|
9
|
-
import { type ThreadsOptions } from './types-threads-options.js';
|
10
8
|
import { type FlatEvolveWebpackOptions } from './types-webpack.js';
|
11
9
|
/**
|
12
10
|
* Detect locally installed dependencies that have correctly installed from `package.json` declared version `dependencies`
|
@@ -46,10 +44,6 @@ export interface FlatEvolveOptions {
|
|
46
44
|
* The configurations of `webpack`
|
47
45
|
*/
|
48
46
|
webpack?: FlatEvolveWebpackOptions;
|
49
|
-
/**
|
50
|
-
* The config options of global webpack compiler.
|
51
|
-
*/
|
52
|
-
globalCompilerOptions?: GlobalCompilerOptions;
|
53
47
|
/**
|
54
48
|
* The config options of all rule set loaders.
|
55
49
|
*/
|
@@ -102,36 +96,27 @@ export interface FlatEvolveOptions {
|
|
102
96
|
/**
|
103
97
|
* All webpack entries configuration
|
104
98
|
*/
|
105
|
-
entryMap:
|
106
|
-
[K in keyof EvolveEntryMap]: Omit<EvolveEntryMap[K], 'groupingSource'>;
|
107
|
-
};
|
99
|
+
entryMap: EvolveEntryMap;
|
108
100
|
/**
|
109
|
-
*
|
110
|
-
* @default false
|
101
|
+
* Visualize size of webpack output files with an interactive zoomable treemap.
|
111
102
|
*/
|
112
|
-
|
113
|
-
/**
|
114
|
-
* The faster builds, simplified ci pipeline configurations
|
115
|
-
*/
|
116
|
-
ci?: FlatEvolveCI;
|
103
|
+
analyzer?: Record<string, unknown>;
|
117
104
|
/**
|
118
|
-
*
|
105
|
+
* Maximum number of process to run at once for production build
|
106
|
+
* Exact number or a percent of CPUs available (for example "50%").
|
107
|
+
*
|
108
|
+
* If undefined, then all build processes will start in parallel.
|
109
|
+
* Setting this value to 1 will achieve sequential running.
|
110
|
+
* @default 5
|
119
111
|
*/
|
120
|
-
|
112
|
+
maxProcesses?: number | string;
|
121
113
|
/**
|
122
|
-
*
|
123
|
-
*
|
124
|
-
* If `true`, each entry will be built independently.
|
125
|
-
*
|
126
|
-
* If `false`, each entries are grouped according to certain rules
|
127
|
-
*
|
114
|
+
* For `production` mode, the value indicates if we interrupt compilation process while received "warnings" while evolve `build`
|
128
115
|
* @default false
|
129
116
|
*/
|
130
|
-
|
117
|
+
rejectWarnings?: boolean;
|
131
118
|
/**
|
132
|
-
* The
|
133
|
-
*
|
134
|
-
* @default 10
|
119
|
+
* The faster builds, simplified ci pipeline configurations
|
135
120
|
*/
|
136
|
-
|
121
|
+
ci?: FlatEvolveCI;
|
137
122
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { type
|
1
|
+
import { type RuleSetRule, type Configuration } from 'webpack';
|
2
2
|
import { type WebpackPlugin } from '../create-webpack/types.js';
|
3
3
|
import { type TerserMinimizerOptions } from '../minimizer/types.js';
|
4
4
|
/**
|
@@ -62,10 +62,7 @@ export interface FlatEvolveWebpackOptions extends Pick<Configuration, 'performan
|
|
62
62
|
* @default `terser` minimizer has been enabled fro `production`
|
63
63
|
*/
|
64
64
|
minimizer?: false | {
|
65
|
-
|
66
|
-
* Allow to disable terser minimizer. or customized terser options.
|
67
|
-
*/
|
68
|
-
terserOptions?: false | TerserMinimizerOptions;
|
65
|
+
terserOptions?: TerserMinimizerOptions;
|
69
66
|
/**
|
70
67
|
* @default false
|
71
68
|
*/
|