@modern-js/plugin-swc 2.0.0-beta.2 → 2.0.0-beta.3

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.
Files changed (86) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/package.json +10 -10
  3. package/dist/bin.d.ts +0 -2
  4. package/dist/bin.js +0 -38
  5. package/dist/config/createLoadedConfig.d.ts +0 -6
  6. package/dist/config/createLoadedConfig.js +0 -35
  7. package/dist/config/createResolvedConfig.d.ts +0 -3
  8. package/dist/config/createResolvedConfig.js +0 -91
  9. package/dist/config/defaults.d.ts +0 -29
  10. package/dist/config/defaults.js +0 -110
  11. package/dist/config/index.d.ts +0 -2
  12. package/dist/config/index.js +0 -18
  13. package/dist/config/mergeConfig.d.ts +0 -32
  14. package/dist/config/mergeConfig.js +0 -39
  15. package/dist/config/schema/deploy.d.ts +0 -16
  16. package/dist/config/schema/deploy.js +0 -16
  17. package/dist/config/schema/index.d.ts +0 -499
  18. package/dist/config/schema/index.js +0 -94
  19. package/dist/config/schema/output.d.ts +0 -146
  20. package/dist/config/schema/output.js +0 -68
  21. package/dist/config/schema/server.d.ts +0 -194
  22. package/dist/config/schema/server.js +0 -111
  23. package/dist/config/schema/source.d.ts +0 -64
  24. package/dist/config/schema/source.js +0 -38
  25. package/dist/config/schema/tools.d.ts +0 -51
  26. package/dist/config/schema/tools.js +0 -24
  27. package/dist/config/types/electron.d.ts +0 -13
  28. package/dist/config/types/electron.js +0 -2
  29. package/dist/config/types/index.d.ts +0 -260
  30. package/dist/config/types/index.js +0 -2
  31. package/dist/config/types/less.d.ts +0 -12
  32. package/dist/config/types/less.js +0 -2
  33. package/dist/config/types/postcss.d.ts +0 -28
  34. package/dist/config/types/postcss.js +0 -2
  35. package/dist/config/types/sass.d.ts +0 -10
  36. package/dist/config/types/sass.js +0 -2
  37. package/dist/config/types/ssg.d.ts +0 -15
  38. package/dist/config/types/ssg.js +0 -2
  39. package/dist/config/types/test.d.ts +0 -14
  40. package/dist/config/types/test.js +0 -2
  41. package/dist/config/types/ts-loader.d.ts +0 -23
  42. package/dist/config/types/ts-loader.js +0 -2
  43. package/dist/context.d.ts +0 -34
  44. package/dist/context.js +0 -60
  45. package/dist/initWatcher.d.ts +0 -3
  46. package/dist/initWatcher.js +0 -66
  47. package/dist/load-configs/index.d.ts +0 -34
  48. package/dist/load-configs/index.js +0 -124
  49. package/dist/loadEnv.d.ts +0 -1
  50. package/dist/loadEnv.js +0 -21
  51. package/dist/loadPlugins.d.ts +0 -16
  52. package/dist/loadPlugins.js +0 -60
  53. package/dist/manager.d.ts +0 -87
  54. package/dist/manager.js +0 -24
  55. package/dist/pluginAPI.d.ts +0 -13
  56. package/dist/pluginAPI.js +0 -16
  57. package/dist/schema/patchSchema.d.ts +0 -19
  58. package/dist/schema/patchSchema.js +0 -57
  59. package/dist/schema/source.d.ts +0 -9
  60. package/dist/schema/source.js +0 -10
  61. package/dist/schema/testing.d.ts +0 -13
  62. package/dist/schema/testing.js +0 -11
  63. package/dist/schema/traverseSchema.d.ts +0 -2
  64. package/dist/schema/traverseSchema.js +0 -20
  65. package/dist/types/cli.d.ts +0 -59
  66. package/dist/types/cli.js +0 -2
  67. package/dist/types/config/index.d.ts +0 -41
  68. package/dist/types/config/index.js +0 -2
  69. package/dist/types/config/testing.d.ts +0 -15
  70. package/dist/types/config/testing.js +0 -2
  71. package/dist/types/context.d.ts +0 -26
  72. package/dist/types/context.js +0 -2
  73. package/dist/types/hooks.d.ts +0 -26
  74. package/dist/types/hooks.js +0 -2
  75. package/dist/types/index.d.ts +0 -10
  76. package/dist/types/index.js +0 -21
  77. package/dist/types/plugin.d.ts +0 -26
  78. package/dist/types/plugin.js +0 -2
  79. package/dist/types/pluginAPI.d.ts +0 -18
  80. package/dist/types/pluginAPI.js +0 -2
  81. package/dist/utils/commander.d.ts +0 -4
  82. package/dist/utils/commander.js +0 -20
  83. package/dist/utils/mergeConfig.d.ts +0 -2
  84. package/dist/utils/mergeConfig.js +0 -32
  85. package/dist/utils/repeatKeyWarning.d.ts +0 -3
  86. package/dist/utils/repeatKeyWarning.js +0 -22
package/CHANGELOG.md CHANGED
@@ -1,5 +1,40 @@
1
1
  # @modern-js/core
2
2
 
3
+ ## 2.0.0-beta.3
4
+
5
+ ### Minor Changes
6
+
7
+ - bbe4c4a: feat: add @modern-js/plugin-swc
8
+
9
+ feat: 新增 @modern-js/plugin-swc 插件
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [c8a22763b4]
14
+ - Updated dependencies [a9b38ea196]
15
+ - Updated dependencies [6aca875]
16
+ - Updated dependencies [2e60319]
17
+ - Updated dependencies [92f0eade39]
18
+ - Updated dependencies [edd1cfb1af]
19
+ - Updated dependencies [cc971eabfc]
20
+ - Updated dependencies [5b9049f2e9]
21
+ - Updated dependencies [92004d1906]
22
+ - Updated dependencies [b8bbe036c7]
23
+ - Updated dependencies [d5a31df781]
24
+ - Updated dependencies [dda38c9c3e]
25
+ - Updated dependencies [3bbea92b2a]
26
+ - Updated dependencies [b710adb]
27
+ - Updated dependencies [0dd63a6909]
28
+ - Updated dependencies [3fae2d03b3]
29
+ - Updated dependencies [ea7cf06]
30
+ - Updated dependencies [bbe4c4a]
31
+ - Updated dependencies [e4558a0]
32
+ - Updated dependencies [abf3421a75]
33
+ - Updated dependencies [543be9558e]
34
+ - Updated dependencies [14b712da84]
35
+ - @modern-js/builder-plugin-swc@2.0.0-beta.3
36
+ - @modern-js/utils@2.0.0-beta.3
37
+
3
38
  ## 2.0.0-beta.2
4
39
 
5
40
  ### Major Changes
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "modern",
11
11
  "modern.js"
12
12
  ],
13
- "version": "2.0.0-beta.2",
13
+ "version": "2.0.0-beta.3",
14
14
  "jsnext:source": "./src/index.ts",
15
15
  "types": "./dist/index.d.ts",
16
16
  "main": "./dist/index.js",
@@ -27,20 +27,20 @@
27
27
  }
28
28
  },
29
29
  "dependencies": {
30
- "@modern-js/builder-plugin-swc": "2.0.0-beta.2",
31
- "@modern-js/utils": "2.0.0-beta.2"
30
+ "@modern-js/builder-plugin-swc": "2.0.0-beta.3",
31
+ "@modern-js/utils": "2.0.0-beta.3"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@jest/types": "^27.0.6",
35
- "@modern-js/app-tools": "2.0.0-beta.2",
36
- "@modern-js/builder-shared": "2.0.0-beta.2",
37
- "@modern-js/babel-preset-app": "2.0.0-beta.2",
38
- "@modern-js/types": "2.0.0-beta.2",
39
- "@scripts/build": "2.0.0-beta.2",
40
- "@scripts/jest-config": "2.0.0-beta.2",
41
35
  "@types/jest": "^27",
42
36
  "@types/node": "^14",
43
- "typescript": "^4"
37
+ "typescript": "^4",
38
+ "@modern-js/app-tools": "2.0.0-beta.3",
39
+ "@modern-js/builder-shared": "2.0.0-beta.3",
40
+ "@modern-js/babel-preset-app": "2.0.0-beta.3",
41
+ "@modern-js/types": "2.0.0-beta.3",
42
+ "@scripts/build": "2.0.0-beta.3",
43
+ "@scripts/jest-config": "2.0.0-beta.3"
44
44
  },
45
45
  "publishConfig": {
46
46
  "registry": "https://registry.npmjs.org/",
package/dist/bin.d.ts DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
package/dist/bin.js DELETED
@@ -1,38 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const utils_1 = require("@modern-js/utils");
5
- const _1 = require(".");
6
- const command = process.argv[2];
7
- if (!process.env.NODE_ENV) {
8
- if (['build', 'start', 'deploy', 'release'].includes(command)) {
9
- process.env.NODE_ENV = 'production';
10
- }
11
- else if (command === 'test') {
12
- process.env.NODE_ENV = 'test';
13
- }
14
- else {
15
- process.env.NODE_ENV = 'development';
16
- }
17
- }
18
- const { version } = require('../package.json');
19
- const cliParams = (0, utils_1.minimist)(process.argv.slice(2));
20
- const runOptions = {
21
- version,
22
- };
23
- /**
24
- * Commands that support specify config files
25
- * Some commands can't support this feature, such as `new`
26
- */
27
- const SUPPORT_CONFIG_PARAM_COMMANDS = [
28
- 'dev',
29
- 'build',
30
- 'deploy',
31
- 'start',
32
- 'inspect',
33
- ];
34
- const customConfigFile = cliParams.config || cliParams.c;
35
- if (SUPPORT_CONFIG_PARAM_COMMANDS.includes(command) && customConfigFile) {
36
- runOptions.configFile = customConfigFile;
37
- }
38
- _1.cli.run(runOptions);
@@ -1,6 +0,0 @@
1
- import { LoadedConfig, UserConfig, ConfigParams } from '../types';
2
- /**
3
- * Assign the pkg config into the user config.
4
- */
5
- export declare const assignPkgConfig: (userConfig?: UserConfig, pkgConfig?: ConfigParams) => UserConfig;
6
- export declare function createLoadedConfig(appDirectory: string, filePath?: string, packageJsonConfig?: string): Promise<LoadedConfig<{}>>;
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createLoadedConfig = exports.assignPkgConfig = void 0;
4
- const lodash_1 = require("@modern-js/utils/lodash");
5
- const utils_1 = require("@modern-js/utils");
6
- const load_configs_1 = require("../load-configs");
7
- /**
8
- * Assign the pkg config into the user config.
9
- */
10
- const assignPkgConfig = (userConfig = {}, pkgConfig = {}) => (0, lodash_1.mergeWith)({}, userConfig, pkgConfig, (objValue, srcValue) => {
11
- // mergeWith can not merge object with symbol, but plugins object contains symbol,
12
- // so we need to handle it manually.
13
- if (objValue === undefined && (0, utils_1.isPlainObject)(srcValue)) {
14
- return { ...srcValue };
15
- }
16
- // return undefined to use the default behavior of mergeWith
17
- return undefined;
18
- });
19
- exports.assignPkgConfig = assignPkgConfig;
20
- async function createLoadedConfig(appDirectory, filePath, packageJsonConfig) {
21
- const loaded = await (0, load_configs_1.loadConfig)(appDirectory, filePath, packageJsonConfig);
22
- const config = !loaded
23
- ? {}
24
- : await (typeof loaded.config === 'function'
25
- ? loaded.config(0)
26
- : loaded.config);
27
- return {
28
- config: (0, exports.assignPkgConfig)(config, loaded === null || loaded === void 0 ? void 0 : loaded.pkgConfig),
29
- filePath: loaded.path,
30
- dependencies: loaded.dependencies || [],
31
- pkgConfig: loaded.pkgConfig || {},
32
- jsConfig: config || {},
33
- };
34
- }
35
- exports.createLoadedConfig = createLoadedConfig;
@@ -1,3 +0,0 @@
1
- import type { ErrorObject } from '@modern-js/utils/ajv';
2
- import type { UserConfig, NormalizedConfig, LoadedConfig, PluginValidateSchema } from '../types';
3
- export declare const createResolveConfig: (loaded: LoadedConfig<{}>, configs: UserConfig[], schemas: PluginValidateSchema[], onSchemaError?: (error: ErrorObject) => void | Promise<void>) => Promise<NormalizedConfig>;
@@ -1,91 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.createResolveConfig = void 0;
27
- const utils_1 = require("@modern-js/utils");
28
- const constants_1 = require("@modern-js/utils/constants");
29
- const patchSchema_1 = require("../schema/patchSchema");
30
- const repeatKeyWarning_1 = require("../utils/repeatKeyWarning");
31
- const mergeConfig_1 = require("../utils/mergeConfig");
32
- const debug = (0, utils_1.createDebugger)('resolve-config');
33
- const showAdditionalPropertiesError = async (error) => {
34
- if (error.keyword === 'additionalProperties' &&
35
- error.params.additionalProperty) {
36
- const target = [
37
- error.instancePath.slice(1),
38
- error.params.additionalProperty,
39
- ]
40
- .filter(Boolean)
41
- .join('.');
42
- const name = Object.keys(constants_1.PLUGIN_SCHEMAS).find(key => constants_1.PLUGIN_SCHEMAS[key].some((schemaItem) => schemaItem.target === target));
43
- if (name) {
44
- const packageManager = await (0, utils_1.getPackageManager)();
45
- utils_1.logger.warn(`The configuration of ${utils_1.chalk.bold(target)} is provided by plugin ${utils_1.chalk.bold(name)}. Please use ${utils_1.chalk.bold(`${packageManager} run new`)} to enable the corresponding capability.\n`);
46
- }
47
- }
48
- };
49
- const createResolveConfig = async (
50
- // eslint-disable-next-line @typescript-eslint/ban-types
51
- loaded, configs, schemas, onSchemaError = showAdditionalPropertiesError) => {
52
- var _a;
53
- const { default: Ajv } = await Promise.resolve().then(() => __importStar(require('@modern-js/utils/ajv')));
54
- const { default: ajvKeywords } = await Promise.resolve().then(() => __importStar(require('@modern-js/utils/ajv-keywords')));
55
- const { default: betterAjvErrors } = await Promise.resolve().then(() => __importStar(require('@modern-js/utils/better-ajv-errors')));
56
- const { config: userConfig, jsConfig, pkgConfig } = loaded;
57
- const ajv = new Ajv({ $data: true, strict: false });
58
- ajvKeywords(ajv);
59
- const validateSchema = (0, patchSchema_1.patchSchema)(schemas);
60
- const validate = ajv.compile(validateSchema);
61
- (0, repeatKeyWarning_1.repeatKeyWarning)(validateSchema, jsConfig, pkgConfig);
62
- // validate user config.
63
- const valid = validate(userConfig);
64
- const formatValidateError = (config) => {
65
- var _a;
66
- return betterAjvErrors(validateSchema, config, (_a = validate.errors) === null || _a === void 0 ? void 0 : _a.map(e => ({
67
- ...e,
68
- dataPath: e.instancePath,
69
- })), {
70
- indent: 2,
71
- });
72
- };
73
- if (!valid && ((_a = validate.errors) === null || _a === void 0 ? void 0 : _a.length)) {
74
- await onSchemaError(validate === null || validate === void 0 ? void 0 : validate.errors[0]);
75
- const errors = formatValidateError(userConfig);
76
- utils_1.logger.log(errors);
77
- throw new Error(`Validate configuration error`);
78
- }
79
- // validate config from plugins.
80
- for (const config of configs) {
81
- if (!validate(config)) {
82
- const errors = formatValidateError(config);
83
- utils_1.logger.error(errors);
84
- throw new Error(`Validate configuration error.`);
85
- }
86
- }
87
- const resolved = (0, mergeConfig_1.mergeConfig)([...configs, userConfig]);
88
- debug('resolved %o', resolved);
89
- return resolved;
90
- };
91
- exports.createResolveConfig = createResolveConfig;
@@ -1,29 +0,0 @@
1
- import type { IAppContext } from '@modern-js/types';
2
- import { OutputConfig, ServerConfig, SourceConfig } from '.';
3
- export declare const getDefaultConfig: (appContext?: IAppContext) => {
4
- source: SourceConfig;
5
- output: OutputConfig;
6
- server: ServerConfig;
7
- dev: {
8
- assetPrefix: boolean;
9
- https: boolean;
10
- };
11
- deploy: {
12
- domain: string;
13
- domainByEntries: undefined;
14
- };
15
- tools: {
16
- webpack: undefined;
17
- babel: undefined;
18
- postcss: undefined;
19
- autoprefixer: undefined;
20
- lodash: undefined;
21
- devServer: undefined;
22
- tsLoader: undefined;
23
- terser: undefined;
24
- minifyCss: undefined;
25
- };
26
- plugins: never[];
27
- runtime: {};
28
- runtimeByEntries: {};
29
- };
@@ -1,110 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDefaultConfig = void 0;
4
- const getDefaultConfig = (appContext) => {
5
- const defaultAlias = appContext
6
- ? {
7
- [appContext.internalDirAlias]: appContext.internalDirectory,
8
- [appContext.internalSrcAlias]: appContext.srcDirectory,
9
- '@': appContext.srcDirectory,
10
- '@shared': appContext.sharedDirectory,
11
- }
12
- : {};
13
- const sourceDefaults = {
14
- entries: undefined,
15
- enableAsyncEntry: false,
16
- disableDefaultEntries: false,
17
- entriesDir: './src',
18
- configDir: './config',
19
- apiDir: './api',
20
- envVars: [],
21
- globalVars: undefined,
22
- alias: defaultAlias,
23
- moduleScopes: undefined,
24
- include: [],
25
- };
26
- const outputDefaults = {
27
- assetPrefix: '/',
28
- htmlPath: 'html',
29
- jsPath: 'static/js',
30
- cssPath: 'static/css',
31
- mediaPath: 'static/media',
32
- path: 'dist',
33
- title: '',
34
- titleByEntries: undefined,
35
- meta: {
36
- charset: { charset: 'utf-8' },
37
- viewport: 'width=device-width, initial-scale=1.0, shrink-to-fit=no, viewport-fit=cover, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no',
38
- 'http-equiv': { 'http-equiv': 'x-ua-compatible', content: 'ie=edge' },
39
- renderer: 'webkit',
40
- layoutmode: 'standard',
41
- imagemode: 'force',
42
- 'wap-font-scale': 'no',
43
- 'format-detection': 'telephone=no',
44
- },
45
- metaByEntries: undefined,
46
- inject: 'head',
47
- injectByEntries: undefined,
48
- mountId: 'root',
49
- favicon: '',
50
- faviconByEntries: undefined,
51
- copy: undefined,
52
- scriptExt: undefined,
53
- disableHtmlFolder: false,
54
- disableCssModuleExtension: false,
55
- disableCssExtract: false,
56
- enableCssModuleTSDeclaration: false,
57
- disableMinimize: false,
58
- enableInlineStyles: false,
59
- enableInlineScripts: false,
60
- disableSourceMap: false,
61
- disableInlineRuntimeChunk: false,
62
- disableAssetsCache: false,
63
- enableLatestDecorators: false,
64
- polyfill: 'entry',
65
- dataUriLimit: 10000,
66
- templateParameters: {},
67
- templateParametersByEntries: undefined,
68
- cssModuleLocalIdentName: undefined,
69
- enableModernMode: false,
70
- federation: undefined,
71
- disableNodePolyfill: false,
72
- enableTsLoader: false,
73
- };
74
- const serverDefaults = {
75
- routes: undefined,
76
- publicRoutes: undefined,
77
- ssr: undefined,
78
- ssrByEntries: undefined,
79
- baseUrl: '/',
80
- port: 8080,
81
- };
82
- const devDefaults = { assetPrefix: false, https: false };
83
- const deployDefaults = {
84
- domain: '',
85
- domainByEntries: undefined,
86
- };
87
- const toolsDefaults = {
88
- webpack: undefined,
89
- babel: undefined,
90
- postcss: undefined,
91
- autoprefixer: undefined,
92
- lodash: undefined,
93
- devServer: undefined,
94
- tsLoader: undefined,
95
- terser: undefined,
96
- minifyCss: undefined,
97
- };
98
- return {
99
- source: sourceDefaults,
100
- output: outputDefaults,
101
- server: serverDefaults,
102
- dev: devDefaults,
103
- deploy: deployDefaults,
104
- tools: toolsDefaults,
105
- plugins: [],
106
- runtime: {},
107
- runtimeByEntries: {},
108
- };
109
- };
110
- exports.getDefaultConfig = getDefaultConfig;
@@ -1,2 +0,0 @@
1
- export * from './createLoadedConfig';
2
- export * from './createResolvedConfig';
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./createLoadedConfig"), exports);
18
- __exportStar(require("./createResolvedConfig"), exports);
@@ -1,32 +0,0 @@
1
- import { UserConfig, SourceConfig, ToolsConfig } from '.';
2
- export interface NormalizedSourceConfig extends Omit<SourceConfig, 'alias' | 'moduleScopes'> {
3
- alias: SourceConfig['alias'] | Array<NonNullable<SourceConfig['alias']>>;
4
- moduleScopes: SourceConfig['moduleScopes'] | Array<SourceConfig['moduleScopes']>;
5
- }
6
- export interface NormalizedToolsConfig extends Omit<ToolsConfig, 'webpack' | 'webpackChain' | 'babel' | 'postcss' | 'autoprefixer' | 'lodash' | 'tsLoader' | 'terser' | 'minifyCss' | 'esbuild' | 'styledComponents'> {
7
- webpack: ToolsConfig['webpack'] | Array<NonNullable<ToolsConfig['webpack']>>;
8
- webpackChain: ToolsConfig['webpackChain'] | Array<NonNullable<ToolsConfig['webpackChain']>>;
9
- babel: ToolsConfig['babel'] | Array<NonNullable<ToolsConfig['babel']>>;
10
- postcss: ToolsConfig['postcss'] | Array<NonNullable<ToolsConfig['postcss']>>;
11
- styledComponents: ToolsConfig['styledComponents'] | Array<NonNullable<ToolsConfig['styledComponents']>>;
12
- autoprefixer: ToolsConfig['autoprefixer'] | Array<NonNullable<ToolsConfig['autoprefixer']>>;
13
- lodash: ToolsConfig['lodash'] | Array<ToolsConfig['lodash']>;
14
- tsLoader: ToolsConfig['tsLoader'] | Array<NonNullable<ToolsConfig['tsLoader']>>;
15
- terser: ToolsConfig['terser'] | Array<NonNullable<ToolsConfig['terser']>>;
16
- minifyCss: ToolsConfig['minifyCss'] | Array<NonNullable<ToolsConfig['minifyCss']>>;
17
- esbuild: ToolsConfig['esbuild'] | Array<NonNullable<ToolsConfig['esbuild']>>;
18
- htmlPlugin: ToolsConfig['htmlPlugin'] | Array<NonNullable<ToolsConfig['htmlPlugin']>>;
19
- }
20
- export interface NormalizedConfig extends Omit<Required<UserConfig>, 'source' | 'tools'> {
21
- source: NormalizedSourceConfig;
22
- tools: NormalizedToolsConfig;
23
- cliOptions?: Record<string, any>;
24
- _raw: UserConfig;
25
- }
26
- /**
27
- * merge configuration from modern.config.js and plugins.
28
- *
29
- * @param configs - Configuration from modern.config.ts or plugin's config hook.
30
- * @returns - normalized user config.
31
- */
32
- export declare const mergeConfig: (configs: Array<UserConfig | NormalizedConfig>) => NormalizedConfig;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mergeConfig = void 0;
4
- const lodash_1 = require("@modern-js/utils/lodash");
5
- const utils_1 = require("@modern-js/utils");
6
- /**
7
- * merge configuration from modern.config.js and plugins.
8
- *
9
- * @param configs - Configuration from modern.config.ts or plugin's config hook.
10
- * @returns - normalized user config.
11
- */
12
- const mergeConfig = (configs) => (0, lodash_1.mergeWith)({}, ...configs, (target, source, key) => {
13
- // Do not use the following merge logic for source.designSystem and tools.tailwind(css)
14
- if (key === 'designSystem' ||
15
- (key === 'tailwind' && typeof source === 'object') ||
16
- (key === 'tailwindcss' && typeof source === 'object') ||
17
- key === 'devServer') {
18
- return (0, lodash_1.mergeWith)({}, target !== null && target !== void 0 ? target : {}, source !== null && source !== void 0 ? source : {});
19
- }
20
- if (Array.isArray(target)) {
21
- if (Array.isArray(source)) {
22
- return [...target, ...source];
23
- }
24
- else {
25
- return source !== undefined ? [...target, source] : target;
26
- }
27
- }
28
- else if ((0, utils_1.isFunction)(target) || (0, utils_1.isFunction)(source)) {
29
- if (source === undefined) {
30
- return target;
31
- }
32
- if (target === undefined) {
33
- return source;
34
- }
35
- return [target, source];
36
- }
37
- return undefined;
38
- });
39
- exports.mergeConfig = mergeConfig;
@@ -1,16 +0,0 @@
1
- export declare const deploy: {
2
- type: string;
3
- properties: {
4
- domain: {
5
- type: string[];
6
- };
7
- domainByEntries: {
8
- type: string;
9
- patternProperties: {
10
- "^[a-zA-Z0-9_-]+$": {
11
- type: string[];
12
- };
13
- };
14
- };
15
- };
16
- };
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deploy = void 0;
4
- const utils_1 = require("@modern-js/utils");
5
- exports.deploy = {
6
- type: 'object',
7
- properties: {
8
- domain: { type: ['array', 'string'] },
9
- domainByEntries: {
10
- type: 'object',
11
- patternProperties: {
12
- [utils_1.ENTRY_NAME_PATTERN]: { type: ['array', 'string'] },
13
- },
14
- },
15
- },
16
- };