@modern-js/core 1.9.2 → 1.10.0

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 (130) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/compiled/ajv-keywords/index.d.ts +1 -0
  3. package/compiled/ajv-keywords/package.json +1 -1
  4. package/compiled/better-ajv-errors/index.d.ts +1 -0
  5. package/compiled/better-ajv-errors/package.json +1 -1
  6. package/compiled/v8-compile-cache/index.d.ts +1 -0
  7. package/compiled/v8-compile-cache/package.json +1 -1
  8. package/dist/config/index.d.ts +1 -1
  9. package/dist/config/index.js +19 -28
  10. package/dist/config/types/index.d.ts +36 -36
  11. package/dist/index.js +55 -60
  12. package/dist/initWatcher.js +3 -12
  13. package/package.json +7 -8
  14. package/tsconfig.json +1 -0
  15. package/compiled/ajv-keywords/ajv/dist/ajv.d.ts +0 -16
  16. package/compiled/ajv-keywords/ajv/dist/compile/codegen/code.d.ts +0 -40
  17. package/compiled/ajv-keywords/ajv/dist/compile/codegen/index.d.ts +0 -79
  18. package/compiled/ajv-keywords/ajv/dist/compile/codegen/scope.d.ts +0 -79
  19. package/compiled/ajv-keywords/ajv/dist/compile/errors.d.ts +0 -13
  20. package/compiled/ajv-keywords/ajv/dist/compile/index.d.ts +0 -80
  21. package/compiled/ajv-keywords/ajv/dist/compile/ref_error.d.ts +0 -6
  22. package/compiled/ajv-keywords/ajv/dist/compile/resolve.d.ts +0 -12
  23. package/compiled/ajv-keywords/ajv/dist/compile/rules.d.ts +0 -28
  24. package/compiled/ajv-keywords/ajv/dist/compile/util.d.ts +0 -40
  25. package/compiled/ajv-keywords/ajv/dist/compile/validate/index.d.ts +0 -42
  26. package/compiled/ajv-keywords/ajv/dist/compile/validate/subschema.d.ts +0 -47
  27. package/compiled/ajv-keywords/ajv/dist/core.d.ts +0 -173
  28. package/compiled/ajv-keywords/ajv/dist/runtime/validation_error.d.ts +0 -7
  29. package/compiled/ajv-keywords/ajv/dist/types/index.d.ts +0 -183
  30. package/compiled/ajv-keywords/ajv/dist/types/json-schema.d.ts +0 -124
  31. package/compiled/ajv-keywords/ajv/dist/types/jtd-schema.d.ts +0 -169
  32. package/compiled/ajv-keywords/dist/index.d.ts +0 -4
  33. package/compiled/ajv-keywords/uri-js/dist/es5/uri.all.d.ts +0 -59
  34. package/compiled/better-ajv-errors/ajv/dist/ajv.d.ts +0 -16
  35. package/compiled/better-ajv-errors/ajv/dist/compile/codegen/code.d.ts +0 -40
  36. package/compiled/better-ajv-errors/ajv/dist/compile/codegen/index.d.ts +0 -79
  37. package/compiled/better-ajv-errors/ajv/dist/compile/codegen/scope.d.ts +0 -79
  38. package/compiled/better-ajv-errors/ajv/dist/compile/errors.d.ts +0 -13
  39. package/compiled/better-ajv-errors/ajv/dist/compile/index.d.ts +0 -80
  40. package/compiled/better-ajv-errors/ajv/dist/compile/ref_error.d.ts +0 -6
  41. package/compiled/better-ajv-errors/ajv/dist/compile/resolve.d.ts +0 -12
  42. package/compiled/better-ajv-errors/ajv/dist/compile/rules.d.ts +0 -28
  43. package/compiled/better-ajv-errors/ajv/dist/compile/util.d.ts +0 -40
  44. package/compiled/better-ajv-errors/ajv/dist/compile/validate/index.d.ts +0 -42
  45. package/compiled/better-ajv-errors/ajv/dist/compile/validate/subschema.d.ts +0 -47
  46. package/compiled/better-ajv-errors/ajv/dist/core.d.ts +0 -173
  47. package/compiled/better-ajv-errors/ajv/dist/runtime/validation_error.d.ts +0 -7
  48. package/compiled/better-ajv-errors/ajv/dist/types/index.d.ts +0 -183
  49. package/compiled/better-ajv-errors/ajv/dist/types/json-schema.d.ts +0 -124
  50. package/compiled/better-ajv-errors/ajv/dist/types/jtd-schema.d.ts +0 -169
  51. package/compiled/better-ajv-errors/typings.d.ts +0 -24
  52. package/compiled/better-ajv-errors/uri-js/dist/es5/uri.all.d.ts +0 -59
  53. package/dist/js/modern/cli.js +0 -29
  54. package/dist/js/modern/config/defaults.js +0 -103
  55. package/dist/js/modern/config/index.js +0 -115
  56. package/dist/js/modern/config/mergeConfig.js +0 -22
  57. package/dist/js/modern/config/schema/deploy.js +0 -17
  58. package/dist/js/modern/config/schema/index.js +0 -107
  59. package/dist/js/modern/config/schema/output.js +0 -147
  60. package/dist/js/modern/config/schema/server.js +0 -170
  61. package/dist/js/modern/config/schema/source.js +0 -59
  62. package/dist/js/modern/config/schema/tools.js +0 -36
  63. package/dist/js/modern/config/types/electron.js +0 -1
  64. package/dist/js/modern/config/types/index.js +0 -1
  65. package/dist/js/modern/config/types/less.js +0 -0
  66. package/dist/js/modern/config/types/sass.js +0 -0
  67. package/dist/js/modern/config/types/ssg.js +0 -0
  68. package/dist/js/modern/config/types/test.js +0 -0
  69. package/dist/js/modern/config/types/unbundle.js +0 -0
  70. package/dist/js/modern/context.js +0 -63
  71. package/dist/js/modern/index.js +0 -169
  72. package/dist/js/modern/initWatcher.js +0 -62
  73. package/dist/js/modern/loadEnv.js +0 -14
  74. package/dist/js/modern/loadPlugins.js +0 -122
  75. package/dist/js/modern/manager.js +0 -28
  76. package/dist/js/modern/pluginAPI.js +0 -11
  77. package/dist/js/modern/utils/commander.js +0 -19
  78. package/dist/js/modern/utils/repeatKeyWarning.js +0 -18
  79. package/dist/js/node/cli.js +0 -35
  80. package/dist/js/node/config/defaults.js +0 -110
  81. package/dist/js/node/config/index.js +0 -182
  82. package/dist/js/node/config/mergeConfig.js +0 -32
  83. package/dist/js/node/config/schema/deploy.js +0 -26
  84. package/dist/js/node/config/schema/index.js +0 -127
  85. package/dist/js/node/config/schema/output.js +0 -156
  86. package/dist/js/node/config/schema/server.js +0 -179
  87. package/dist/js/node/config/schema/source.js +0 -68
  88. package/dist/js/node/config/schema/tools.js +0 -43
  89. package/dist/js/node/config/types/electron.js +0 -5
  90. package/dist/js/node/config/types/index.js +0 -5
  91. package/dist/js/node/config/types/less.js +0 -0
  92. package/dist/js/node/config/types/sass.js +0 -0
  93. package/dist/js/node/config/types/ssg.js +0 -0
  94. package/dist/js/node/config/types/test.js +0 -0
  95. package/dist/js/node/config/types/unbundle.js +0 -0
  96. package/dist/js/node/context.js +0 -93
  97. package/dist/js/node/index.js +0 -329
  98. package/dist/js/node/initWatcher.js +0 -82
  99. package/dist/js/node/loadEnv.js +0 -30
  100. package/dist/js/node/loadPlugins.js +0 -134
  101. package/dist/js/node/manager.js +0 -45
  102. package/dist/js/node/pluginAPI.js +0 -54
  103. package/dist/js/node/utils/commander.js +0 -32
  104. package/dist/js/node/utils/repeatKeyWarning.js +0 -31
  105. package/dist/types/cli.d.ts +0 -1
  106. package/dist/types/config/defaults.d.ts +0 -28
  107. package/dist/types/config/index.d.ts +0 -12
  108. package/dist/types/config/mergeConfig.d.ts +0 -31
  109. package/dist/types/config/schema/deploy.d.ts +0 -16
  110. package/dist/types/config/schema/index.d.ts +0 -466
  111. package/dist/types/config/schema/output.d.ts +0 -146
  112. package/dist/types/config/schema/server.d.ts +0 -182
  113. package/dist/types/config/schema/source.d.ts +0 -58
  114. package/dist/types/config/schema/tools.d.ts +0 -36
  115. package/dist/types/config/types/electron.d.ts +0 -13
  116. package/dist/types/config/types/index.d.ts +0 -252
  117. package/dist/types/config/types/less.d.ts +0 -10
  118. package/dist/types/config/types/sass.d.ts +0 -8
  119. package/dist/types/config/types/ssg.d.ts +0 -13
  120. package/dist/types/config/types/test.d.ts +0 -15
  121. package/dist/types/config/types/unbundle.d.ts +0 -28
  122. package/dist/types/context.d.ts +0 -47
  123. package/dist/types/index.d.ts +0 -64
  124. package/dist/types/initWatcher.d.ts +0 -3
  125. package/dist/types/loadEnv.d.ts +0 -1
  126. package/dist/types/loadPlugins.d.ts +0 -44
  127. package/dist/types/manager.d.ts +0 -75
  128. package/dist/types/pluginAPI.d.ts +0 -13
  129. package/dist/types/utils/commander.d.ts +0 -4
  130. package/dist/types/utils/repeatKeyWarning.d.ts +0 -3
@@ -1,182 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _exportNames = {
7
- addServerConfigToDeps: true,
8
- defineConfig: true,
9
- loadUserConfig: true,
10
- resolveConfig: true,
11
- defaultsConfig: true,
12
- mergeConfig: true
13
- };
14
- exports.addServerConfigToDeps = void 0;
15
- Object.defineProperty(exports, "defaultsConfig", {
16
- enumerable: true,
17
- get: function () {
18
- return _defaults.defaults;
19
- }
20
- });
21
- exports.loadUserConfig = exports.defineConfig = void 0;
22
- Object.defineProperty(exports, "mergeConfig", {
23
- enumerable: true,
24
- get: function () {
25
- return _mergeConfig.mergeConfig;
26
- }
27
- });
28
- exports.resolveConfig = void 0;
29
-
30
- var _loadConfig = require("@modern-js/load-config");
31
-
32
- var _ajv = _interopRequireDefault(require("ajv"));
33
-
34
- var _ajvKeywords = _interopRequireDefault(require("ajv-keywords"));
35
-
36
- var _utils = require("@modern-js/utils");
37
-
38
- var _lodash = require("@modern-js/utils/lodash");
39
-
40
- var _betterAjvErrors = _interopRequireDefault(require("better-ajv-errors"));
41
-
42
- var _codeFrame = require("@babel/code-frame");
43
-
44
- var _repeatKeyWarning = require("../utils/repeatKeyWarning");
45
-
46
- var _defaults = require("./defaults");
47
-
48
- var _mergeConfig = require("./mergeConfig");
49
-
50
- var _schema = require("./schema");
51
-
52
- var _types = require("./types");
53
-
54
- Object.keys(_types).forEach(function (key) {
55
- if (key === "default" || key === "__esModule") return;
56
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
57
- if (key in exports && exports[key] === _types[key]) return;
58
- Object.defineProperty(exports, key, {
59
- enumerable: true,
60
- get: function () {
61
- return _types[key];
62
- }
63
- });
64
- });
65
-
66
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
67
-
68
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
69
-
70
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
71
-
72
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
73
-
74
- const debug = (0, _utils.createDebugger)('resolve-config');
75
-
76
- const addServerConfigToDeps = async (dependencies, appDirectory, serverConfigFile) => {
77
- const serverConfig = await (0, _utils.getServerConfig)(appDirectory, serverConfigFile);
78
-
79
- if (serverConfig) {
80
- dependencies.push(serverConfig);
81
- }
82
- };
83
-
84
- exports.addServerConfigToDeps = addServerConfigToDeps;
85
-
86
- const defineConfig = config => config;
87
-
88
- exports.defineConfig = defineConfig;
89
-
90
- const loadUserConfig = async (appDirectory, filePath, packageJsonConfig) => {
91
- const loaded = await (0, _loadConfig.loadConfig)(appDirectory, filePath, packageJsonConfig);
92
- const config = !loaded ? {} : await (typeof loaded.config === 'function' ? loaded.config(0) : loaded.config);
93
- return {
94
- config: (0, _lodash.mergeWith)({}, config || {}, (loaded === null || loaded === void 0 ? void 0 : loaded.pkgConfig) || {}),
95
- jsConfig: config || {},
96
- pkgConfig: (loaded === null || loaded === void 0 ? void 0 : loaded.pkgConfig) || {},
97
- filePath: loaded === null || loaded === void 0 ? void 0 : loaded.path,
98
- dependencies: (loaded === null || loaded === void 0 ? void 0 : loaded.dependencies) || []
99
- };
100
- };
101
-
102
- exports.loadUserConfig = loadUserConfig;
103
-
104
- const showAdditionalPropertiesError = error => {
105
- if (error.keyword === 'additionalProperties' && error.params.additionalProperty) {
106
- const target = [error.instancePath.slice(1), error.params.additionalProperty].filter(Boolean).join('.');
107
- const name = Object.keys(_utils.PLUGIN_SCHEMAS).find(key => _utils.PLUGIN_SCHEMAS[key].some(schemaItem => schemaItem.target === target));
108
-
109
- if (name) {
110
- _utils.signale.warn(`The configuration of ${_utils.chalk.bold(target)} is provided by plugin ${_utils.chalk.bold(name)}. Please use ${_utils.chalk.bold('yarn new')} to enable the corresponding capability.\n`);
111
- }
112
- }
113
- };
114
-
115
- const resolveConfig = async (loaded, configs, schemas, restartWithExistingPort, argv, onSchemaError = showAdditionalPropertiesError) => {
116
- var _validate$errors;
117
-
118
- const {
119
- config: userConfig,
120
- jsConfig,
121
- pkgConfig
122
- } = loaded;
123
- const ajv = new _ajv.default({
124
- $data: true,
125
- strict: false
126
- });
127
- (0, _ajvKeywords.default)(ajv);
128
- const validateSchema = (0, _schema.patchSchema)(schemas);
129
- const validate = ajv.compile(validateSchema);
130
- (0, _repeatKeyWarning.repeatKeyWarning)(validateSchema, jsConfig, pkgConfig); // validate user config.
131
-
132
- const valid = validate(userConfig);
133
-
134
- if (!valid && (_validate$errors = validate.errors) !== null && _validate$errors !== void 0 && _validate$errors.length) {
135
- var _validate$errors2;
136
-
137
- onSchemaError(validate === null || validate === void 0 ? void 0 : validate.errors[0]);
138
- const errors = (0, _betterAjvErrors.default)(validateSchema, userConfig, (_validate$errors2 = validate.errors) === null || _validate$errors2 === void 0 ? void 0 : _validate$errors2.map(e => _objectSpread(_objectSpread({}, e), {}, {
139
- dataPath: e.instancePath
140
- })), {
141
- format: 'js',
142
- indent: 2
143
- });
144
-
145
- _utils.signale.log((0, _codeFrame.codeFrameColumns)(JSON.stringify(userConfig, null, 2), {
146
- start: errors === null || errors === void 0 ? void 0 : errors[0].start,
147
- end: errors === null || errors === void 0 ? void 0 : errors[0].end
148
- }, {
149
- highlightCode: true,
150
- message: errors === null || errors === void 0 ? void 0 : errors[0].error
151
- }));
152
-
153
- throw new Error(`Validate configuration error`);
154
- } // validate config from plugins.
155
-
156
-
157
- for (const config of configs) {
158
- if (!validate(config)) {
159
- _utils.signale.error(validate.errors);
160
-
161
- throw new Error(`Validate configuration error.`);
162
- }
163
- }
164
-
165
- const resolved = (0, _mergeConfig.mergeConfig)([_defaults.defaults, ...configs, userConfig]);
166
- resolved._raw = loaded.config;
167
-
168
- if ((0, _utils.isDev)() && argv[0] === 'dev') {
169
- if (restartWithExistingPort > 0) {
170
- // dev server is restarted, should use existing port number
171
- resolved.server.port = restartWithExistingPort;
172
- } else {
173
- // get port for new dev server
174
- resolved.server.port = await (0, _utils.getPort)(resolved.server.port);
175
- }
176
- }
177
-
178
- debug('resolved %o', resolved);
179
- return resolved;
180
- };
181
-
182
- exports.resolveConfig = resolveConfig;
@@ -1,32 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.mergeConfig = void 0;
7
-
8
- var _lodash = require("@modern-js/utils/lodash");
9
-
10
- var _utils = require("@modern-js/utils");
11
-
12
- /**
13
- * merge configuration from modern.config.js and plugins.
14
- *
15
- * @param configs - Configuration from modern.config.ts or plugin's config hook.
16
- * @returns - normalized user config.
17
- */
18
- const mergeConfig = configs => (0, _lodash.mergeWith)({}, ...configs, (target, source) => {
19
- if (Array.isArray(target)) {
20
- if (Array.isArray(source)) {
21
- return [...target, ...source];
22
- } else {
23
- return typeof source !== 'undefined' ? [...target, source] : target;
24
- }
25
- } else if ((0, _utils.isFunction)(source)) {
26
- return typeof target !== 'undefined' ? [target, source] : [source];
27
- }
28
-
29
- return undefined;
30
- });
31
-
32
- exports.mergeConfig = mergeConfig;
@@ -1,26 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.deploy = void 0;
7
-
8
- var _utils = require("@modern-js/utils");
9
-
10
- const deploy = {
11
- type: 'object',
12
- properties: {
13
- domain: {
14
- type: ['array', 'string']
15
- },
16
- domainByEntries: {
17
- type: 'object',
18
- patternProperties: {
19
- [_utils.ENTRY_NAME_PATTERN]: {
20
- type: ['array', 'string']
21
- }
22
- }
23
- }
24
- }
25
- };
26
- exports.deploy = deploy;
@@ -1,127 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.traverseSchema = exports.patchSchema = void 0;
7
-
8
- var _utils = require("@modern-js/utils");
9
-
10
- var _lodash = require("@modern-js/utils/lodash");
11
-
12
- var _source = require("./source");
13
-
14
- var _output = require("./output");
15
-
16
- var _server = require("./server");
17
-
18
- var _deploy = require("./deploy");
19
-
20
- var _tools = require("./tools");
21
-
22
- const debug = (0, _utils.createDebugger)('validate-schema');
23
- const plugins = {
24
- type: 'array',
25
- additionalProperties: false
26
- };
27
- const dev = {
28
- type: 'object',
29
- properties: {
30
- assetPrefix: {
31
- type: ['boolean', 'string']
32
- },
33
- https: {
34
- type: 'boolean'
35
- }
36
- },
37
- additionalProperties: false
38
- };
39
-
40
- const patchSchema = pluginSchemas => {
41
- const finalSchema = (0, _lodash.cloneDeep)({
42
- type: 'object',
43
- additionalProperties: false,
44
- properties: {
45
- source: _source.source,
46
- output: _output.output,
47
- server: _server.server,
48
- deploy: _deploy.deploy,
49
- plugins,
50
- dev,
51
- tools: _tools.tools
52
- }
53
- });
54
-
55
- const findTargetNode = props => {
56
- let node = finalSchema.properties;
57
-
58
- for (const prop of props) {
59
- node = node[prop];
60
-
61
- if (!node || !(0, _utils.isObject)(node)) {
62
- throw new Error(`add schema ${props.join('.')} error`);
63
- }
64
-
65
- node.properties = node.hasOwnProperty('properties') ? node.properties : {};
66
- node = node.properties;
67
- }
68
-
69
- return node;
70
- };
71
-
72
- const finalPluginSchemas = [];
73
- pluginSchemas.forEach(item => {
74
- if (Array.isArray(item)) {
75
- finalPluginSchemas.push(...item);
76
- } else {
77
- finalPluginSchemas.push(item);
78
- }
79
- });
80
-
81
- for (const {
82
- target,
83
- schema
84
- } of finalPluginSchemas) {
85
- if (!target) {
86
- throw new Error(`should return target property in plugin schema.`);
87
- }
88
-
89
- const props = target.split('.');
90
- const mountProperty = props.pop();
91
- const targetNode = findTargetNode(props);
92
-
93
- if (targetNode.hasOwnProperty(mountProperty)) {
94
- throw new Error(`${target} already exists in current validate schema`);
95
- }
96
-
97
- targetNode[mountProperty] = (0, _lodash.cloneDeep)(schema);
98
- }
99
-
100
- debug(`final validate schema: %o`, finalSchema);
101
- return finalSchema;
102
- };
103
-
104
- exports.patchSchema = patchSchema;
105
-
106
- const traverseSchema = schema => {
107
- const keys = [];
108
-
109
- const traverse = ({
110
- properties
111
- }, old = []) => {
112
- for (const key of Object.keys(properties)) {
113
- const current = [...old, key];
114
-
115
- if (properties[key].type === 'object' && properties[key].properties) {
116
- traverse(properties[key], current);
117
- } else {
118
- keys.push(current.join('.'));
119
- }
120
- }
121
- };
122
-
123
- traverse(schema);
124
- return keys;
125
- };
126
-
127
- exports.traverseSchema = traverseSchema;
@@ -1,156 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.output = void 0;
7
-
8
- var _utils = require("@modern-js/utils");
9
-
10
- const output = {
11
- type: 'object',
12
- additionalProperties: false,
13
- properties: {
14
- assetPrefix: {
15
- type: 'string'
16
- },
17
- path: {
18
- type: 'string'
19
- },
20
- jsPath: {
21
- type: 'string'
22
- },
23
- cssPath: {
24
- type: 'string'
25
- },
26
- htmlPath: {
27
- type: 'string'
28
- },
29
- mediaPath: {
30
- type: 'string'
31
- },
32
- mountId: {
33
- type: 'string'
34
- },
35
- favicon: {
36
- type: 'string'
37
- },
38
- faviconByEntries: {
39
- type: 'object',
40
- patternProperties: {
41
- [_utils.ENTRY_NAME_PATTERN]: {
42
- type: 'string'
43
- }
44
- }
45
- },
46
- title: {
47
- type: 'string'
48
- },
49
- titleByEntries: {
50
- type: 'object',
51
- patternProperties: {
52
- [_utils.ENTRY_NAME_PATTERN]: {
53
- type: 'string'
54
- }
55
- }
56
- },
57
- meta: {
58
- type: 'object'
59
- },
60
- metaByEntries: {
61
- type: 'object',
62
- patternProperties: {
63
- [_utils.ENTRY_NAME_PATTERN]: {
64
- type: 'object'
65
- }
66
- }
67
- },
68
- inject: {
69
- enum: [true, 'head', 'body', false]
70
- },
71
- injectByEntries: {
72
- type: 'object',
73
- patternProperties: {
74
- [_utils.ENTRY_NAME_PATTERN]: {
75
- enum: [true, 'head', 'body', false]
76
- }
77
- }
78
- },
79
- copy: {
80
- type: 'array'
81
- },
82
- scriptExt: {
83
- type: 'object'
84
- },
85
- disableTsChecker: {
86
- type: 'boolean'
87
- },
88
- disableHtmlFolder: {
89
- type: 'boolean'
90
- },
91
- disableCssModuleExtension: {
92
- type: 'boolean'
93
- },
94
- disableCssExtract: {
95
- type: 'boolean'
96
- },
97
- enableCssModuleTSDeclaration: {
98
- type: 'boolean'
99
- },
100
- disableMinimize: {
101
- type: 'boolean'
102
- },
103
- enableInlineStyles: {
104
- type: 'boolean'
105
- },
106
- enableInlineScripts: {
107
- type: 'boolean'
108
- },
109
- disableSourceMap: {
110
- type: 'boolean'
111
- },
112
- disableInlineRuntimeChunk: {
113
- type: 'boolean'
114
- },
115
- disableAssetsCache: {
116
- type: 'boolean'
117
- },
118
- enableLatestDecorators: {
119
- type: 'boolean'
120
- },
121
- enableTsLoader: {
122
- type: 'boolean'
123
- },
124
- dataUriLimit: {
125
- type: 'number'
126
- },
127
- templateParameters: {
128
- type: 'object'
129
- },
130
- templateParametersByEntries: {
131
- type: 'object',
132
- patternProperties: {
133
- [_utils.ENTRY_NAME_PATTERN]: {
134
- type: 'object'
135
- }
136
- }
137
- },
138
- polyfill: {
139
- type: 'string',
140
- enum: ['usage', 'entry', 'off', 'ua']
141
- },
142
- cssModuleLocalIdentName: {
143
- type: 'string'
144
- },
145
- federation: {
146
- type: 'object'
147
- },
148
- disableNodePolyfill: {
149
- type: 'boolean'
150
- },
151
- enableModernMode: {
152
- type: 'boolean'
153
- }
154
- }
155
- };
156
- exports.output = output;
@@ -1,179 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.server = void 0;
7
-
8
- var _utils = require("@modern-js/utils");
9
-
10
- const SERVER_ROUTE_OBJECT = {
11
- type: 'object',
12
- properties: {
13
- path: {
14
- type: 'string'
15
- },
16
- headers: {
17
- type: 'object'
18
- }
19
- },
20
- additionalProperties: false
21
- };
22
- const server = {
23
- type: 'object',
24
- additionalProperties: false,
25
- properties: {
26
- port: {
27
- type: 'number'
28
- },
29
- ssr: {
30
- if: {
31
- type: 'object'
32
- },
33
- then: {
34
- properties: {
35
- disableLoadable: {
36
- type: 'boolean'
37
- },
38
- disableHelmet: {
39
- type: 'boolean'
40
- },
41
- disableRedirect: {
42
- type: 'boolean'
43
- },
44
- enableAsyncData: {
45
- type: 'boolean'
46
- },
47
- enableProductWarning: {
48
- type: 'boolean'
49
- },
50
- timeout: {
51
- type: 'number'
52
- },
53
- asyncDataTimeout: {
54
- type: 'number'
55
- }
56
- }
57
- },
58
- else: {
59
- type: 'boolean'
60
- }
61
- },
62
- ssrByEntries: {
63
- type: 'object',
64
- patternProperties: {
65
- [_utils.ENTRY_NAME_PATTERN]: {
66
- if: {
67
- type: 'object'
68
- },
69
- then: {
70
- properties: {
71
- disableLoadable: {
72
- type: 'boolean'
73
- },
74
- disableHelmet: {
75
- type: 'boolean'
76
- },
77
- disableRedirect: {
78
- type: 'boolean'
79
- },
80
- enableProductWarning: {
81
- type: 'boolean'
82
- },
83
- enableAsyncData: {
84
- type: 'boolean'
85
- },
86
- timeout: {
87
- type: 'number'
88
- },
89
- asyncDataTimeout: {
90
- type: 'number'
91
- }
92
- },
93
- additionalProperties: false
94
- },
95
- else: {
96
- type: 'boolean'
97
- }
98
- }
99
- }
100
- },
101
- routes: {
102
- type: 'object',
103
- patternProperties: {
104
- [_utils.ENTRY_NAME_PATTERN]: {
105
- if: {
106
- type: 'object'
107
- },
108
- then: {
109
- properties: {
110
- route: {
111
- oneOf: [{
112
- type: 'string'
113
- }, {
114
- type: 'array',
115
- items: {
116
- oneOf: [{
117
- type: 'string'
118
- }, SERVER_ROUTE_OBJECT]
119
- }
120
- }, SERVER_ROUTE_OBJECT]
121
- },
122
- disableSpa: {
123
- type: 'boolean'
124
- }
125
- },
126
- additionalProperties: false
127
- },
128
- else: {
129
- oneOf: [{
130
- type: 'string'
131
- }, {
132
- type: 'array',
133
- items: {
134
- type: 'string'
135
- }
136
- }]
137
- }
138
- }
139
- }
140
- },
141
- publicRoutes: {
142
- type: 'object',
143
- patternProperties: {
144
- [_utils.ENTRY_NAME_PATTERN]: {
145
- type: ['string']
146
- }
147
- }
148
- },
149
- baseUrl: {
150
- oneOf: [{
151
- type: 'string'
152
- }, {
153
- type: 'array',
154
- items: [{
155
- type: 'string'
156
- }]
157
- }]
158
- },
159
- middleware: {
160
- instanceof: ['Array', 'Function']
161
- },
162
- renderHook: {
163
- instanceof: 'Function'
164
- },
165
- logger: {
166
- type: ['object', 'boolean']
167
- },
168
- metrics: {
169
- type: ['object', 'boolean']
170
- },
171
- proxy: {
172
- type: 'object'
173
- },
174
- enableMicroFrontendDebug: {
175
- type: 'boolean'
176
- }
177
- }
178
- };
179
- exports.server = server;