@flatjs/evolve 1.7.3 → 1.8.1-next.100
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +774 -0
- package/LICENSE +21 -0
- package/README.md +10 -46
- package/dist/constants.d.ts +15 -0
- package/dist/constants.js +1 -0
- package/dist/create-webpack/create-externals.d.ts +4 -0
- package/dist/create-webpack/create-externals.js +1 -0
- package/dist/create-webpack/create-optimization.d.ts +3 -0
- package/dist/create-webpack/create-optimization.js +1 -0
- package/dist/create-webpack/create-output.d.ts +3 -0
- package/dist/create-webpack/create-output.js +1 -0
- package/dist/create-webpack/create-performance.d.ts +2 -0
- package/dist/create-webpack/create-performance.js +1 -0
- package/dist/create-webpack/create-plugins.d.ts +4 -0
- package/dist/create-webpack/create-plugins.js +1 -0
- package/dist/create-webpack/create-resolve.d.ts +2 -0
- package/dist/create-webpack/create-resolve.js +1 -0
- package/dist/create-webpack/create-rule-sets.d.ts +4 -0
- package/dist/create-webpack/create-rule-sets.js +1 -0
- package/dist/create-webpack/load-webpack-config.d.ts +10 -0
- package/dist/create-webpack/load-webpack-config.js +1 -0
- package/dist/create-webpack/rule-sets/constants.d.ts +3 -0
- package/dist/create-webpack/rule-sets/constants.js +1 -0
- package/dist/create-webpack/rule-sets/rule-assets.d.ts +10 -0
- package/dist/create-webpack/rule-sets/rule-assets.js +1 -0
- package/dist/create-webpack/rule-sets/rule-css.d.ts +11 -0
- package/dist/create-webpack/rule-sets/rule-css.js +1 -0
- package/dist/create-webpack/rule-sets/rule-less.d.ts +26 -0
- package/dist/create-webpack/rule-sets/rule-less.js +1 -0
- package/dist/create-webpack/rule-sets/rule-scripts.d.ts +3 -0
- package/dist/create-webpack/rule-sets/rule-scripts.js +1 -0
- package/dist/create-webpack/rule-sets/rule-svg-icon.d.ts +6 -0
- package/dist/create-webpack/rule-sets/rule-svg-icon.js +1 -0
- package/dist/create-webpack/rule-sets/rule-utils.d.ts +7 -0
- package/dist/create-webpack/rule-sets/rule-utils.js +1 -0
- package/dist/create-webpack/types.d.ts +2 -0
- package/dist/create-webpack/types.js +1 -0
- package/dist/default-options.d.ts +2 -0
- package/dist/default-options.js +1 -0
- package/dist/define-config/define-config.d.ts +24 -0
- package/dist/define-config/define-config.js +1 -0
- package/dist/define-config/index.d.ts +1 -0
- package/dist/define-config/index.js +1 -0
- package/dist/dev-server/add-compiler-to-dev-server.d.ts +10 -0
- package/dist/dev-server/add-compiler-to-dev-server.js +1 -0
- package/dist/dev-server/create-app-page-route.d.ts +7 -0
- package/dist/dev-server/create-app-page-route.js +1 -0
- 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 +4 -0
- package/dist/dev-server/create-dev-server-entries.js +1 -0
- package/dist/dev-server/create-dev-server.d.ts +6 -0
- package/dist/dev-server/create-dev-server.js +1 -0
- package/dist/dev-server/index.d.ts +6 -0
- package/dist/dev-server/index.js +1 -0
- package/dist/dev-server/middlewares/create-page-middleware.d.ts +37 -0
- package/dist/dev-server/middlewares/create-page-middleware.js +1 -0
- package/dist/dev-server/middlewares/create-public-assets-middleware.d.ts +2 -0
- package/dist/dev-server/middlewares/create-public-assets-middleware.js +1 -0
- package/dist/dev-server/middlewares/index.d.ts +2 -0
- package/dist/dev-server/middlewares/index.js +1 -0
- package/dist/errors/evolve-build-error.d.ts +4 -0
- package/dist/errors/evolve-build-error.js +1 -0
- package/dist/helpers/allow-px2rem-for-module.d.ts +3 -0
- package/dist/helpers/allow-px2rem-for-module.js +1 -0
- 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/chunk-entry-map.d.ts +7 -0
- package/dist/helpers/chunk-entry-map.js +1 -0
- package/dist/helpers/enable-bundle-hashname-for-module.d.ts +3 -0
- package/dist/helpers/enable-bundle-hashname-for-module.js +1 -0
- package/dist/helpers/filter-actived-entries.d.ts +16 -0
- package/dist/helpers/filter-actived-entries.js +1 -0
- package/dist/helpers/get-bundle-file-name.d.ts +14 -0
- package/dist/helpers/get-bundle-file-name.js +1 -0
- package/dist/helpers/get-git-root.d.ts +1 -0
- package/dist/helpers/get-git-root.js +1 -0
- package/dist/helpers/get-html-plugin-config.d.ts +20 -0
- package/dist/helpers/get-html-plugin-config.js +1 -0
- package/dist/helpers/get-max-process-tasks.d.ts +1 -0
- package/dist/helpers/get-max-process-tasks.js +1 -0
- package/dist/helpers/get-pacakge-dir.d.ts +1 -0
- package/dist/helpers/get-pacakge-dir.js +1 -0
- package/dist/helpers/index.d.ts +17 -0
- package/dist/helpers/index.js +1 -0
- package/dist/helpers/json-serializer.d.ts +7 -0
- package/dist/helpers/json-serializer.js +1 -0
- package/dist/helpers/merge-babel-options.d.ts +4 -0
- package/dist/helpers/merge-babel-options.js +1 -0
- package/dist/helpers/normalize-entry-map.d.ts +15 -0
- package/dist/helpers/normalize-entry-map.js +1 -0
- package/dist/helpers/normalize-resolve-alias.d.ts +1 -0
- package/dist/helpers/normalize-resolve-alias.js +1 -0
- package/dist/helpers/open-page.d.ts +7 -0
- package/dist/helpers/open-page.js +1 -0
- package/dist/helpers/print-log.d.ts +8 -0
- package/dist/helpers/print-log.js +1 -0
- package/dist/helpers/refresh-evolve-mock-options.d.ts +3 -0
- package/dist/helpers/refresh-evolve-mock-options.js +1 -0
- package/dist/helpers/resolve-entry-map-input-files.d.ts +8 -0
- package/dist/helpers/resolve-entry-map-input-files.js +1 -0
- package/dist/helpers/script-injects.d.ts +11 -0
- package/dist/helpers/script-injects.js +1 -0
- package/dist/helpers/should-enable-react-fast-refresh.d.ts +3 -0
- package/dist/helpers/should-enable-react-fast-refresh.js +1 -0
- 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 +5 -0
- package/dist/index.js +1 -0
- package/dist/load-config/index.d.ts +1 -0
- package/dist/load-config/index.js +1 -0
- package/dist/load-config/load-evolve-config.d.ts +11 -0
- package/dist/load-config/load-evolve-config.js +1 -0
- package/dist/loaders/loader-icon.cjs +33 -0
- package/dist/loaders/loader-icon.d.cts +1 -0
- package/dist/main/env-verify.d.ts +2 -0
- package/dist/main/env-verify.js +1 -0
- package/dist/main/get-worker-path.d.ts +1 -0
- package/dist/main/get-worker-path.js +1 -0
- package/dist/main/index.d.ts +4 -0
- package/dist/main/index.js +1 -0
- package/dist/main/prepare-build.d.ts +9 -0
- package/dist/main/prepare-build.js +1 -0
- package/dist/main/prepare-serve.d.ts +9 -0
- package/dist/main/prepare-serve.js +1 -0
- package/dist/main/prepare-static.d.ts +7 -0
- package/dist/main/prepare-static.js +1 -0
- package/dist/main/start-build-dynamic.d.ts +20 -0
- package/dist/main/start-build-dynamic.js +1 -0
- package/dist/main/start-build-worker.d.ts +12 -0
- package/dist/main/start-build-worker.js +1 -0
- package/dist/main/start-build.d.ts +5 -0
- package/dist/main/start-build.js +1 -0
- 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 +11 -0
- package/dist/main/start-serve.js +1 -0
- package/dist/main/start-static.d.ts +10 -0
- package/dist/main/start-static.js +1 -0
- package/dist/minimizer/create-minimizers.d.ts +3 -0
- package/dist/minimizer/create-minimizers.js +1 -0
- package/dist/minimizer/default-options.d.ts +2 -0
- package/dist/minimizer/default-options.js +1 -0
- package/dist/minimizer/image-minimizer.d.ts +16 -0
- package/dist/minimizer/image-minimizer.js +1 -0
- package/dist/minimizer/index.d.ts +1 -0
- package/dist/minimizer/index.js +1 -0
- package/dist/minimizer/terser-minimizer.d.ts +6 -0
- package/dist/minimizer/terser-minimizer.js +3 -0
- package/dist/minimizer/types.d.ts +2 -0
- package/dist/minimizer/types.js +1 -0
- package/dist/plugins/circular-dependency/circular-dependency-plugin.d.ts +54 -0
- package/dist/plugins/circular-dependency/circular-dependency-plugin.js +1 -0
- package/dist/plugins/circular-dependency/index.d.ts +7 -0
- package/dist/plugins/circular-dependency/index.js +1 -0
- package/dist/plugins/clean-webpack/clean-webpack-plugin.d.ts +67 -0
- package/dist/plugins/clean-webpack/clean-webpack-plugin.js +1 -0
- package/dist/plugins/clean-webpack/index.d.ts +9 -0
- package/dist/plugins/clean-webpack/index.js +1 -0
- package/dist/plugins/define-variable/define-variable-plugin.d.ts +14 -0
- package/dist/plugins/define-variable/define-variable-plugin.js +1 -0
- package/dist/plugins/define-variable/index.d.ts +1 -0
- package/dist/plugins/define-variable/index.js +1 -0
- package/dist/plugins/html-inject-scripts/plugin-html-inject-script.d.ts +8 -0
- package/dist/plugins/html-inject-scripts/plugin-html-inject-script.js +1 -0
- package/dist/plugins/module-federation/external-template-remotes.d.ts +4 -0
- package/dist/plugins/module-federation/external-template-remotes.js +1 -0
- package/dist/plugins/module-federation/index.d.ts +1 -0
- package/dist/plugins/module-federation/index.js +1 -0
- package/dist/plugins/module-federation/module-federation.d.ts +4 -0
- package/dist/plugins/module-federation/module-federation.js +1 -0
- package/dist/plugins/multi-html/index.d.ts +4 -0
- package/dist/plugins/multi-html/index.js +1 -0
- package/dist/plugins/multi-html/multi-html-cdn-plugin.d.ts +17 -0
- package/dist/plugins/multi-html/multi-html-cdn-plugin.js +1 -0
- package/dist/plugins/multi-html/multi-html-plugin.d.ts +11 -0
- package/dist/plugins/multi-html/multi-html-plugin.js +1 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.js +1 -0
- package/dist/types/types-ci.d.ts +23 -0
- package/dist/types/types-ci.js +1 -0
- package/dist/types/types-dev-server.d.ts +65 -0
- package/dist/types/types-dev-server.js +1 -0
- package/dist/types/types-entry-map.d.ts +71 -0
- package/dist/types/types-entry-map.js +1 -0
- package/dist/types/types-federation.d.ts +120 -0
- package/dist/types/types-federation.js +1 -0
- package/dist/types/types-loader-options.d.ts +76 -0
- package/dist/types/types-loader-options.js +1 -0
- package/dist/types/types-modular-import.d.ts +38 -0
- package/dist/types/types-modular-import.js +1 -0
- package/dist/types/types-multi-html.d.ts +75 -0
- package/dist/types/types-multi-html.js +1 -0
- package/dist/types/types-options.d.ts +117 -0
- package/dist/types/types-options.js +1 -0
- package/dist/types/types-plugin-options.d.ts +7 -0
- package/dist/types/types-plugin-options.js +1 -0
- package/dist/types/types-webpack.d.ts +96 -0
- package/dist/types/types-webpack.js +1 -0
- package/index.js +1 -4
- package/package.json +118 -61
- package/templates/html-plugin/index-dev.html +23 -46
- package/templates/html-plugin/index-inte.html +23 -46
- package/templates/html-plugin/index-inte2.html +23 -46
- package/templates/html-plugin/index-inte3.html +23 -46
- package/templates/html-plugin/index-inte4.html +23 -46
- package/templates/html-plugin/index-me.html +23 -46
- package/templates/html-plugin/index-prod.html +23 -46
- package/templates/html-plugin/index-rc.html +22 -46
- package/templates/html-plugin/index-uat.html +23 -46
- package/templates/main.html +2 -2
- package/templates/module-404.html +4 -2
- package/templates/module.html +31 -61
- package/cjs/index.js +0 -4
- package/cjs/loader-icon.js +0 -2
- package/index.d.ts +0 -713
@@ -0,0 +1,38 @@
|
|
1
|
+
/**
|
2
|
+
* Buildin plugin `babel-plugin-import` configurations
|
3
|
+
*/
|
4
|
+
export type ModularImportOption = {
|
5
|
+
/**
|
6
|
+
* @example `antd`, `lodash`, `material-ui`, `@flatjs`, `@dimjs`, `@fabric`, `@wine`
|
7
|
+
*/
|
8
|
+
libraryName: string;
|
9
|
+
/**
|
10
|
+
* Set this option to false if your module does not have a default export.
|
11
|
+
* @default false
|
12
|
+
*/
|
13
|
+
transformToDefaultImport?: boolean;
|
14
|
+
/**
|
15
|
+
* @default: `esm`
|
16
|
+
*/
|
17
|
+
libraryDirectory?: string;
|
18
|
+
/**
|
19
|
+
* The value will append to `${libraryDirectory}/${transformedMethodName}/${fileName}`
|
20
|
+
* e.g. `@scope/app/esm/{moduleName}/index`
|
21
|
+
* @default ""
|
22
|
+
*/
|
23
|
+
fileName?: string;
|
24
|
+
/**
|
25
|
+
* We can use customName to customize import file path.
|
26
|
+
* @example `esm/modal`
|
27
|
+
*/
|
28
|
+
customName?: (transformedMethodName: string, file: any) => string;
|
29
|
+
/**
|
30
|
+
* @default: true
|
31
|
+
*/
|
32
|
+
camel2DashComponentName?: boolean;
|
33
|
+
/**
|
34
|
+
* @default false
|
35
|
+
* @example (name) => `${name}/style/2x` | `boolean` }
|
36
|
+
*/
|
37
|
+
style?: true | 'css' | ((name: string, file: Record<string, unknown>) => string | boolean);
|
38
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export{};
|
@@ -0,0 +1,75 @@
|
|
1
|
+
import { type HtmlPluginConfigTokenType } from '../helpers/get-html-plugin-config.js';
|
2
|
+
export declare type EvolveMultiCdnEnvType = 'me' | 'dev' | 'uat' | 'inte' | 'inte2' | 'inte3' | 'inte4' | 'rc' | 'prod' | 'ntv';
|
3
|
+
export type EvolveMultiCDNConfig = {
|
4
|
+
[key in EvolveMultiCdnEnvType]?: string[];
|
5
|
+
};
|
6
|
+
/**
|
7
|
+
* Allow us customized to resolve current runtime environment.
|
8
|
+
*/
|
9
|
+
export type EvolveMultiCDNEnvResolver = (url: string) => EvolveMultiCdnEnvType | undefined;
|
10
|
+
/**
|
11
|
+
* The html plugin configuration for each entry item
|
12
|
+
*/
|
13
|
+
export declare type MultiHtmlCDNEntryItem = {
|
14
|
+
/**
|
15
|
+
* The title to use for the generated HTML document
|
16
|
+
* @default ''
|
17
|
+
*/
|
18
|
+
title?: string;
|
19
|
+
/**
|
20
|
+
* The favicon url to use for the generated HTML document
|
21
|
+
*/
|
22
|
+
favicon?: string;
|
23
|
+
/**
|
24
|
+
* webpack relative or absolute path to the template.
|
25
|
+
* It must be an absolute path. `path.join(__dirname, `templates/index-{0}.html`)`
|
26
|
+
* @default join(evolveRoot, `/templates/html-plugin/index-{0}.html`)
|
27
|
+
*/
|
28
|
+
templatePath?: string;
|
29
|
+
/**
|
30
|
+
* Indicates if we need to minify html.
|
31
|
+
* @default true
|
32
|
+
*/
|
33
|
+
htmlMinify?: boolean;
|
34
|
+
/**
|
35
|
+
* Support inject viewport scripts in each modules
|
36
|
+
* It only available while `allowPx2rem` = true
|
37
|
+
* @default ''
|
38
|
+
*/
|
39
|
+
viewport?: string;
|
40
|
+
/**
|
41
|
+
* Allow us customized inline scripts into compiled html template.
|
42
|
+
* @default []
|
43
|
+
*/
|
44
|
+
inlineScripts?: HtmlPluginConfigTokenType<string[]>;
|
45
|
+
/**
|
46
|
+
* The customized html tags should be inject to `<header />`
|
47
|
+
*/
|
48
|
+
headBeforeHtmlTags?: HtmlPluginConfigTokenType<string[]>;
|
49
|
+
/**
|
50
|
+
* The ordered styles will be injected start of html head.
|
51
|
+
* @default []
|
52
|
+
*/
|
53
|
+
headBeforeStyles?: HtmlPluginConfigTokenType<string[]>;
|
54
|
+
/**
|
55
|
+
* The ordered scripts will be injected before html head.
|
56
|
+
* @default [
|
57
|
+
* `https://polyfill.io/v3/polyfill.min.js?features=Array.from%2CArray.isArray%2CArray.of%2CArray.prototype.entries%2CArray.prototype.every%2CArray.prototype.fill%2CArray.prototype.filter%2CArray.prototype.find%2CArray.prototype.findIndex%2CArray.prototype.flat%2CArray.prototype.forEach%2CArray.prototype.flatMap%2CArray.prototype.keys%2CArray.prototype.indexOf%2CArray.prototype.includes%2CArray.prototype.lastIndexOf%2CArray.prototype.map%2CArray.prototype.reduce%2CArray.prototype.reduceRight%2CArray.prototype.some%2CArray.prototype.sort%2CArray.prototype.values%2CArrayBuffer%2CBlob%2CDataView%2CDate.now%2CObject.assign%2CObject.create%2CObject.defineProperties%2CObject.defineProperty%2CObject.entries%2CObject.freeze%2CObject.fromEntries%2CObject.getOwnPropertySymbols%2CObject.getOwnPropertyNames%2CObject.getOwnPropertyDescriptors%2CObject.getOwnPropertyDescriptor%2CObject.getPrototypeOf%2CObject.is%2CObject.isExtensible%2CObject.isFrozen%2CObject.isSealed%2CObject.keys%2CObject.values%2CObject.setPrototypeOf%2CPromise%2CPromise.prototype.finally%2CReflect%2CReflect.apply%2CReflect.construct%2CReflect.defineProperty%2CReflect.deleteProperty%2CReflect.getPrototypeOf%2CReflect.getOwnPropertyDescriptor%2CReflect.get%2CReflect.ownKeys%2CReflect.isExtensible%2CReflect.has%2CReflect.preventExtensions%2CReflect.set%2CReflect.setPrototypeOf%2CSet%2CString.prototype.trimStart%2CString.prototype.trimEnd%2CString.prototype.trim%2CString.prototype.startsWith%2CString.prototype.repeat%2CString.prototype.replaceAll%2CString.prototype.padStart%2CString.prototype.padEnd%2CMap%2CObject.seal%2Cconsole.groupEnd%2Cconsole.group`,
|
58
|
+
* `https://unpkg.com/react@17.0.2/umd/react.production.min.js`,
|
59
|
+
* `https://unpkg.com/react-dom@17.0.2/umd/react-dom.production.min.js`,
|
60
|
+
* `https://unpkg.com/react-router-dom@5.2.0/umd/react-router-dom.min.js`
|
61
|
+
* ]
|
62
|
+
*/
|
63
|
+
headBeforeScripts?: HtmlPluginConfigTokenType<string[]>;
|
64
|
+
/**
|
65
|
+
* The ordered scripts will be injected end of html body.
|
66
|
+
* @default []
|
67
|
+
*/
|
68
|
+
bodyAfterScripts?: HtmlPluginConfigTokenType<string[]>;
|
69
|
+
/**
|
70
|
+
* Give `env` list to exclude from `multi-cdn` plugin.
|
71
|
+
* Normally for `me`, `dev`,`uat`, `ntv` env we should use relative assets path instead cdn.
|
72
|
+
* @default ['dev', 'ntv']
|
73
|
+
*/
|
74
|
+
excludeCdnEnvs?: EvolveMultiCdnEnvType[];
|
75
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export{};
|
@@ -0,0 +1,117 @@
|
|
1
|
+
import { type VerifyPackagePattern } from '@armit/package';
|
2
|
+
import { type FlatEvolveCI } from './types-ci.js';
|
3
|
+
import { type FlatEvolveDevServerOptions } from './types-dev-server.js';
|
4
|
+
import { type EvolveEntryMap } from './types-entry-map.js';
|
5
|
+
import { type RuleSetLoaderOptions } from './types-loader-options.js';
|
6
|
+
import { type EvolveMultiCDNEnvResolver, type EvolveMultiCDNConfig } from './types-multi-html.js';
|
7
|
+
import { type EvolvePluginOptions } from './types-plugin-options.js';
|
8
|
+
import { type FlatEvolveWebpackOptions } from './types-webpack.js';
|
9
|
+
/**
|
10
|
+
* Detect locally installed dependencies that have correctly installed from `package.json` declared version `dependencies`
|
11
|
+
*/
|
12
|
+
export type PackageInstallChecker = {
|
13
|
+
/**
|
14
|
+
* @default false
|
15
|
+
*/
|
16
|
+
enabled?: boolean;
|
17
|
+
/**
|
18
|
+
* Stop program if we have detect unexpected error.
|
19
|
+
* @default false
|
20
|
+
*/
|
21
|
+
throwError?: boolean;
|
22
|
+
/**
|
23
|
+
* Flat indicates if we need to print all install module graph
|
24
|
+
* @default false
|
25
|
+
*/
|
26
|
+
showAllInstalledGraph?: boolean;
|
27
|
+
/**
|
28
|
+
* Package module name, or module expression. [`^babel-`,`@dimjs/*`]
|
29
|
+
* @defalt ['@dimjs/*']
|
30
|
+
*/
|
31
|
+
detectModules?: string[];
|
32
|
+
};
|
33
|
+
export interface FlatEvolveOptions {
|
34
|
+
/**
|
35
|
+
* The project workspace directory.
|
36
|
+
*/
|
37
|
+
projectCwd: string;
|
38
|
+
/**
|
39
|
+
* The virtual path for current `project`
|
40
|
+
* e.g. `evolve/test`
|
41
|
+
*/
|
42
|
+
projectVirtualPath: string;
|
43
|
+
/**
|
44
|
+
* The configurations of `webpack`
|
45
|
+
*/
|
46
|
+
webpack?: FlatEvolveWebpackOptions;
|
47
|
+
/**
|
48
|
+
* The config options of all rule set loaders.
|
49
|
+
*/
|
50
|
+
loaderOptions: RuleSetLoaderOptions;
|
51
|
+
/**
|
52
|
+
* The config opotions of all builtin webpack plugins.
|
53
|
+
*/
|
54
|
+
pluginOptions: EvolvePluginOptions;
|
55
|
+
/**
|
56
|
+
* The configurations of `dev-server`.
|
57
|
+
*/
|
58
|
+
devServer?: FlatEvolveDevServerOptions;
|
59
|
+
/**
|
60
|
+
* The plugin for `@flatjs/evolve-multi-html-cdn-plugin`
|
61
|
+
*/
|
62
|
+
multiHtmlCdn: EvolveMultiCDNConfig;
|
63
|
+
/**
|
64
|
+
* Allow us customized to resolve current runtime environment.
|
65
|
+
* ignore resolver if return undefined, otherwise use it to match environment.
|
66
|
+
* NOTE: Don't using arrow function, because we will inject `envResolver` string to html.
|
67
|
+
* @example
|
68
|
+
* ```ts
|
69
|
+
* //
|
70
|
+
* function envResolver(url) {
|
71
|
+
* const env = /.*\.(qa|t)\.*\/.exec('//fex.qa.tcshuke.com/')[1];
|
72
|
+
* switch(env) {
|
73
|
+
* case 't':
|
74
|
+
* return 'rc'
|
75
|
+
* case 'qa':
|
76
|
+
* return 'inte'
|
77
|
+
* }
|
78
|
+
* }
|
79
|
+
* ```
|
80
|
+
*/
|
81
|
+
multiHtmlCdnEnvResolver?: EvolveMultiCDNEnvResolver;
|
82
|
+
/**
|
83
|
+
* The regexp patterns to filter dependencies(will be verified) from package.json
|
84
|
+
* @default {}
|
85
|
+
*/
|
86
|
+
needVerifyPackages?: false | VerifyPackagePattern;
|
87
|
+
/**
|
88
|
+
* Detect locally installed dependencies that have correctly installed from `package.json`
|
89
|
+
*/
|
90
|
+
packageInstallChecker?: false | PackageInstallChecker;
|
91
|
+
/**
|
92
|
+
* All webpack entries configuration
|
93
|
+
*/
|
94
|
+
entryMap: EvolveEntryMap;
|
95
|
+
/**
|
96
|
+
* Visualize size of webpack output files with an interactive zoomable treemap.
|
97
|
+
*/
|
98
|
+
analyzer?: Record<string, unknown>;
|
99
|
+
/**
|
100
|
+
* Maximum number of process to run at once for production build
|
101
|
+
* Exact number or a percent of CPUs available (for example "50%").
|
102
|
+
*
|
103
|
+
* If undefined, then all build processes will start in parallel.
|
104
|
+
* Setting this value to 1 will achieve sequential running.
|
105
|
+
* @default `50%`
|
106
|
+
*/
|
107
|
+
maxProcesses?: number | string;
|
108
|
+
/**
|
109
|
+
* For `production` mode, the value indicates if we interrupt compilation process while received "warnings" while evolve `build`
|
110
|
+
* @default false
|
111
|
+
*/
|
112
|
+
rejectWarnings?: boolean;
|
113
|
+
/**
|
114
|
+
* The faster builds, simplified ci pipeline configurations
|
115
|
+
*/
|
116
|
+
ci?: FlatEvolveCI;
|
117
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export{};
|
@@ -0,0 +1,7 @@
|
|
1
|
+
export interface EvolvePluginOptions {
|
2
|
+
/**
|
3
|
+
* The DefinePlugin replaces variables in your code with other values or expressions at compile time.
|
4
|
+
* @default `__SENTRY_DEBUG__`,`process.env.FLAT_BUILD_DATE`, `process.env.FLAT_COMMIT_HASH`, `process.env.FLAT_BRANCH_NAME`
|
5
|
+
*/
|
6
|
+
definePlugin?: Record<string, unknown>;
|
7
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export{};
|
@@ -0,0 +1,96 @@
|
|
1
|
+
import { type RuleSetRule, type Configuration } from 'webpack';
|
2
|
+
import { type WebpackPlugin } from '../create-webpack/types.js';
|
3
|
+
import { type TerserMinimizerOptions } from '../minimizer/types.js';
|
4
|
+
/**
|
5
|
+
* The webpack entry configuration.
|
6
|
+
*/
|
7
|
+
export interface WebpackEntryObject {
|
8
|
+
[index: string]: string | [string, ...string[]];
|
9
|
+
}
|
10
|
+
export interface FlatEvolveWebpackOptions extends Pick<Configuration, 'performance' | 'stats' | 'infrastructureLogging'> {
|
11
|
+
/**
|
12
|
+
* These options change how modules are resolved.
|
13
|
+
*/
|
14
|
+
resolve?: Configuration['resolve'] & {
|
15
|
+
/**
|
16
|
+
* Only allow pass `key:value` alias `{'@xxx':'./src/xxx'}`
|
17
|
+
* Note: Usually you don't need to specify an alias, the framework will auto support `paths` alias of tsconfig.json
|
18
|
+
* less `@import` is also supported via `paths` of tsconfig.json only need to with prefix `~`
|
19
|
+
* @example
|
20
|
+
* ```less
|
21
|
+
* //@import '~@/utils/xxx.less'`
|
22
|
+
* //@import url('./child.less');`
|
23
|
+
* //@import url('~@/react/less/alias.less');
|
24
|
+
* //@import '~@/react/less/alias2.less';
|
25
|
+
* //@import '~@/utils/shared.less';
|
26
|
+
* ```
|
27
|
+
*/
|
28
|
+
alias?: Record<string, string>;
|
29
|
+
};
|
30
|
+
/**
|
31
|
+
* @default
|
32
|
+
* ```json
|
33
|
+
* {
|
34
|
+
* vue: 'Vue',
|
35
|
+
* react: 'React',
|
36
|
+
* 'react-dom': 'ReactDOM',
|
37
|
+
* }
|
38
|
+
* ```
|
39
|
+
*/
|
40
|
+
externals?: Record<string, string>;
|
41
|
+
/**
|
42
|
+
* output.publicPath defaults to 'auto' with web and web-worker targets
|
43
|
+
* @default 'auto'
|
44
|
+
*/
|
45
|
+
publicPath?: string;
|
46
|
+
/**
|
47
|
+
*
|
48
|
+
* Note if we build `node` using webpack, in order to ignore built-in modules like path, fs, etc.
|
49
|
+
* maybe we need to use `webpack-node-externals'` to configuration `externals`
|
50
|
+
* Now webpack-dev-server have not follow webpack@5 `browserslist` changes
|
51
|
+
* Environment to build for. An array of environments to build for all of them when possible.
|
52
|
+
* @default ['web', 'es5'],
|
53
|
+
*/
|
54
|
+
target?: string | false | string[];
|
55
|
+
/**
|
56
|
+
* Minimizer(s) to use for minimizing the output. for `serve` mode, `minimize` always `false`.
|
57
|
+
* @default `terser` minimizer has been enabled fro `production`
|
58
|
+
*/
|
59
|
+
minimizer?: false | {
|
60
|
+
terserOptions?: TerserMinimizerOptions;
|
61
|
+
/**
|
62
|
+
* @default false
|
63
|
+
*/
|
64
|
+
imageMin?: boolean;
|
65
|
+
};
|
66
|
+
/**
|
67
|
+
* A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
|
68
|
+
* https://webpack.js.org/configuration/devtool/
|
69
|
+
* Only works on production mode , `source-map` Recommended choice for production builds with high quality SourceMaps.
|
70
|
+
* Note: the `sourceMap` only focus on javascript bundle,invalid for other `loaders` e.g. less-loader, css-loader.
|
71
|
+
* `hidden-source-map` produces the same sourcemaps as `source-map`, but doesn't include the `sourceMappingURL` comment at the bottom.
|
72
|
+
* @default `false`
|
73
|
+
*/
|
74
|
+
sourceMap?: 'hidden-source-map' | 'source-map' | false;
|
75
|
+
/**
|
76
|
+
* The rule sets loaders config options
|
77
|
+
*/
|
78
|
+
ruleSets?: Array<Omit<RuleSetRule, 'test'> & {
|
79
|
+
test?: string | RegExp | ((value: string) => boolean);
|
80
|
+
}>;
|
81
|
+
/**
|
82
|
+
* The plugins config options
|
83
|
+
*/
|
84
|
+
plugins?: WebpackPlugin[];
|
85
|
+
/**
|
86
|
+
* `contentehash` bundle file name.
|
87
|
+
* @default true
|
88
|
+
*/
|
89
|
+
enableBundleHashName?: boolean;
|
90
|
+
/**
|
91
|
+
* The output directory as absolute path, Note we must keep custom outputDir with prefix `public`
|
92
|
+
* e.g. `public/a/b`, `public/c/d`, don't support `a/b`.
|
93
|
+
* @default `public`
|
94
|
+
*/
|
95
|
+
outputDir?: string | (() => string | Promise<string>);
|
96
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export{};
|
package/index.js
CHANGED
package/package.json
CHANGED
@@ -1,77 +1,134 @@
|
|
1
1
|
{
|
2
2
|
"name": "@flatjs/evolve",
|
3
|
-
"version": "1.
|
4
|
-
"description": "the webpack based tools `evolve` of @flatjs",
|
5
|
-
"keywords": [
|
6
|
-
"shared",
|
7
|
-
"flatjs",
|
8
|
-
"common",
|
9
|
-
"utils"
|
10
|
-
],
|
3
|
+
"version": "1.8.1-next.100",
|
11
4
|
"license": "MIT",
|
12
|
-
"
|
13
|
-
"
|
14
|
-
|
15
|
-
|
5
|
+
"type": "module",
|
6
|
+
"exports": {
|
7
|
+
".": {
|
8
|
+
"import": "./index.js",
|
9
|
+
"types": "./dist/index.d.ts"
|
10
|
+
},
|
11
|
+
"./package.json": "./package.json"
|
12
|
+
},
|
13
|
+
"types": "./dist/index.d.ts",
|
16
14
|
"files": [
|
17
|
-
"
|
15
|
+
"bin/",
|
16
|
+
"dist/",
|
18
17
|
"templates/",
|
19
18
|
"index.js",
|
20
|
-
"index.d.ts",
|
21
19
|
"README.md",
|
20
|
+
"CHANGELOG.md",
|
22
21
|
"package.json"
|
23
22
|
],
|
23
|
+
"scripts": {
|
24
|
+
"serve": "yarn ts-node-esm ./tests/dev-server/dev-server.ts",
|
25
|
+
"build": "rimraf dist && tsc -p ./tsconfig.build.json && npm run minify",
|
26
|
+
"?build-release": "When https://github.com/atlassian/changesets/issues/432 has a solution we can remove this trick",
|
27
|
+
"build-release": "yarn build && rimraf ./_release && yarn pack && mkdir ./_release && tar zxvf ./package.tgz --directory ./_release && rm ./package.tgz",
|
28
|
+
"minify": "node ../../scripts/minify.mjs --dest=dist",
|
29
|
+
"codegen": "graphql-codegen --config ./codegen.cjs",
|
30
|
+
"clean": "rimraf --no-glob ./dist ./coverage ./__data__ ./config/__data__ ./_release ./tsconfig.tsbuildinfo",
|
31
|
+
"lint": "eslint . --ext .ts,.mts,.tsx,.js,.jsx,.cjs,.mjs --cache --cache-location ../../.cache/eslint/evolve.eslintcache",
|
32
|
+
"test": "run-s test-unit",
|
33
|
+
"test-task": "vitest run",
|
34
|
+
"test-unit": "vitest run --passWithNoTests",
|
35
|
+
"test-watch": "vitest watch --ui",
|
36
|
+
"fix-all-files": "eslint . --ext .ts,.tsx,.js,.jsx,.cjs,.mjs,.mdx,.graphql --fix",
|
37
|
+
"typecheck": "tsc --project ./tsconfig.json --noEmit"
|
38
|
+
},
|
24
39
|
"dependencies": {
|
25
|
-
"@
|
26
|
-
"@
|
27
|
-
"@
|
28
|
-
"@
|
29
|
-
"@
|
30
|
-
"@
|
31
|
-
"
|
32
|
-
"babel
|
33
|
-
"
|
34
|
-
"
|
35
|
-
"
|
36
|
-
"
|
37
|
-
"
|
38
|
-
"
|
39
|
-
"
|
40
|
-
"
|
41
|
-
"
|
42
|
-
"
|
43
|
-
"
|
44
|
-
"
|
45
|
-
"
|
46
|
-
"
|
47
|
-
"
|
48
|
-
"
|
49
|
-
"
|
50
|
-
"
|
51
|
-
"
|
52
|
-
"
|
53
|
-
"
|
54
|
-
"
|
55
|
-
"
|
56
|
-
"
|
40
|
+
"@armit/config-loader": "^0.0.51",
|
41
|
+
"@armit/file-utility": "^0.0.28",
|
42
|
+
"@armit/git": "^0.0.36",
|
43
|
+
"@armit/package": "^0.0.45",
|
44
|
+
"@armit/worker-threads": "^0.0.5",
|
45
|
+
"@babel/core": "7.22.9",
|
46
|
+
"@flatjs/common": "1.8.1-next.35",
|
47
|
+
"@flatjs/evolve-preset-babel": "1.8.1-next.18",
|
48
|
+
"@flatjs/forge-postcss-plugin-pixel": "1.8.1-next.35",
|
49
|
+
"@flatjs/graph": "1.8.1-next.51",
|
50
|
+
"@flatjs/mock": "1.8.1-next.75",
|
51
|
+
"@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
|
52
|
+
"@types/babel__core": "7.20.1",
|
53
|
+
"babel-loader": "9.1.3",
|
54
|
+
"babel-merge": "3.0.0",
|
55
|
+
"babel-plugin-import": "1.13.8",
|
56
|
+
"better-opn": "3.0.2",
|
57
|
+
"case-sensitive-paths-webpack-plugin": "2.4.0",
|
58
|
+
"css-loader": "6.8.1",
|
59
|
+
"cssnano": "6.0.1",
|
60
|
+
"express": "4.18.2",
|
61
|
+
"fork-ts-checker-webpack-plugin": "8.0.0",
|
62
|
+
"happy-dom": "10.6.3",
|
63
|
+
"html-webpack-plugin": "5.5.3",
|
64
|
+
"image-minimizer-webpack-plugin": "3.8.3",
|
65
|
+
"less": "4.1.3",
|
66
|
+
"less-loader": "11.1.3",
|
67
|
+
"listr": "0.14.3",
|
68
|
+
"lodash": "4.17.21",
|
69
|
+
"mini-css-extract-plugin": "2.7.6",
|
70
|
+
"postcss": "8.4.27",
|
71
|
+
"postcss-loader": "7.3.3",
|
72
|
+
"react-refresh": "0.14.0",
|
73
|
+
"svgo": "3.0.2",
|
74
|
+
"tarjan-graph": "3.0.0",
|
75
|
+
"terser-webpack-plugin": "5.3.9",
|
76
|
+
"tsconfig-paths-webpack-plugin": "4.1.0",
|
77
|
+
"type-fest": "^4.1.0",
|
78
|
+
"webpack": "5.88.2",
|
79
|
+
"webpack-bundle-analyzer": "4.9.0",
|
80
|
+
"webpack-dev-server": "4.15.1",
|
81
|
+
"webpack-sources": "3.2.3"
|
57
82
|
},
|
58
83
|
"devDependencies": {
|
59
|
-
"@
|
60
|
-
"@
|
61
|
-
"@
|
62
|
-
"express": "
|
63
|
-
"
|
64
|
-
"
|
65
|
-
"
|
66
|
-
"
|
67
|
-
"
|
68
|
-
"
|
84
|
+
"@armit/eslint-config-bases": "^0.0.23",
|
85
|
+
"@flatjs/testing": "1.8.1-next.37",
|
86
|
+
"@swc/core": "1.3.74",
|
87
|
+
"@types/express": "4.17.17",
|
88
|
+
"@types/listr": "0.14.4",
|
89
|
+
"@types/node": "20.4.6",
|
90
|
+
"@vitest/coverage-istanbul": "0.34.1",
|
91
|
+
"@vitest/ui": "0.34.1",
|
92
|
+
"eslint": "8.46.0",
|
93
|
+
"imagemin-gifsicle": "7.0.0",
|
94
|
+
"imagemin-jpegtran": "7.0.0",
|
95
|
+
"imagemin-pngquant": "9.0.2",
|
96
|
+
"imagemin-svgo": "10.0.1",
|
97
|
+
"npm-run-all": "4.1.5",
|
98
|
+
"prettier": "3.0.0",
|
99
|
+
"react": "18.2.0",
|
100
|
+
"rimraf": "5.0.1",
|
101
|
+
"swc-unplugin-ts": "1.0.2",
|
102
|
+
"ts-node": "10.9.1",
|
103
|
+
"vite-tsconfig-paths": "4.2.0",
|
104
|
+
"vitest": "0.34.1",
|
105
|
+
"vue-loader": "17.2.2"
|
106
|
+
},
|
107
|
+
"peerDependencies": {
|
108
|
+
"imagemin-gifsicle": ">=7.0.0",
|
109
|
+
"imagemin-jpegtran": ">=7.0.0",
|
110
|
+
"imagemin-pngquant": ">=9.0.2",
|
111
|
+
"imagemin-svgo": ">=10.0.1"
|
112
|
+
},
|
113
|
+
"peerDependenciesMeta": {
|
114
|
+
"imagemin-gifsicle": {
|
115
|
+
"optional": true
|
116
|
+
},
|
117
|
+
"imagemin-jpegtran": {
|
118
|
+
"optional": true
|
119
|
+
},
|
120
|
+
"imagemin-pngquant": {
|
121
|
+
"optional": true
|
122
|
+
},
|
123
|
+
"imagemin-svgo": {
|
124
|
+
"optional": true
|
125
|
+
}
|
69
126
|
},
|
70
127
|
"engines": {
|
71
|
-
"node": ">=
|
128
|
+
"node": ">=18.0.0"
|
72
129
|
},
|
73
130
|
"publishConfig": {
|
74
|
-
"access": "public"
|
75
|
-
|
76
|
-
|
77
|
-
}
|
131
|
+
"access": "public",
|
132
|
+
"directory": "_release/package"
|
133
|
+
}
|
134
|
+
}
|
@@ -16,65 +16,42 @@
|
|
16
16
|
content="width=device-width,initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, viewport-fit=cover"
|
17
17
|
/>
|
18
18
|
<title><%= title %></title>
|
19
|
-
|
20
|
-
<% if (
|
21
|
-
|
19
|
+
|
20
|
+
<% if (headBeforeHtmlTags) { %> <% for (let index = 0; index <
|
21
|
+
headBeforeHtmlTags.length; index++) { %> <%= headBeforeHtmlTags[index] %> <%
|
22
|
+
} %> <% } %> <% if (inlineScripts) { %>
|
22
23
|
<script>
|
23
24
|
<% for (let index = 0; index < inlineScripts.length; index++) { %>
|
24
|
-
<%= inlineScripts[index]%>
|
25
|
+
<%= inlineScripts[index] %>
|
25
26
|
<% } %>
|
26
27
|
</script>
|
27
|
-
|
28
|
-
<% } %>
|
29
|
-
<!-- / -->
|
30
|
-
|
31
|
-
<% if (viewport) { %>
|
32
|
-
<!-- / -->
|
28
|
+
<% } %> <% if (viewport) { %>
|
33
29
|
<script>
|
34
30
|
<%= viewport %>
|
35
31
|
</script>
|
36
|
-
|
37
|
-
<% } %>
|
38
|
-
|
39
|
-
<!-- / -->
|
40
|
-
<% if (favicon) { %>
|
41
|
-
<!-- / -->
|
32
|
+
<% } %> <% if (favicon) { %>
|
42
33
|
<link rel="shortcut icon" href="<%= favicon %>" type="image/x-icon" />
|
43
34
|
<link rel="icon" href="<%= favicon %>" type="image/x-icon" />
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
<!-- / -->
|
48
|
-
<% if (headBeforeStyles) { %>
|
49
|
-
<!-- / -->
|
50
|
-
<% for (let index = 0; index < headBeforeStyles.length; index++) { %>
|
35
|
+
<% } %> <% if (headBeforeStyles) { %> <% for (let index = 0; index <
|
36
|
+
headBeforeStyles.length; index++) { %>
|
51
37
|
<link href="<%= headBeforeStyles[index] %>" rel="stylesheet" />
|
52
|
-
<% } %>
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
<%
|
59
|
-
<!-- / -->
|
60
|
-
<% for (let index = 0; index < headBeforeScripts.length; index++) { %>
|
61
|
-
<script crossorigin="anonymous" src="<%= headBeforeScripts[index]%>"></script>
|
62
|
-
<% } %>
|
63
|
-
<!-- / -->
|
64
|
-
<% } %>
|
65
|
-
<!-- / -->
|
38
|
+
<% } %> <% } %> <% if (headBeforeScripts) { %> <% for (let index = 0; index
|
39
|
+
< headBeforeScripts.length; index++) { %>
|
40
|
+
<script
|
41
|
+
crossorigin="anonymous"
|
42
|
+
src="<%= headBeforeScripts[index]%>"
|
43
|
+
></script>
|
44
|
+
<% } %> <% } %>
|
66
45
|
</head>
|
67
46
|
|
68
47
|
<body>
|
69
48
|
<div id="app"></div>
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
<% } %>
|
78
|
-
<!-- / -->
|
49
|
+
<% if (bodyAfterScripts) { %> <% for (let index = 0; index <
|
50
|
+
bodyAfterScripts.length; index++) { %>
|
51
|
+
<script
|
52
|
+
crossorigin="anonymous"
|
53
|
+
src="<%= bodyAfterScripts[index]%>"
|
54
|
+
></script>
|
55
|
+
<% } %> <% } %>
|
79
56
|
</body>
|
80
57
|
</html>
|