@modern-js/app-tools 2.39.2 → 2.40.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.
- package/dist/cjs/analyze/getBundleEntry.js +2 -1
- package/dist/cjs/analyze/index.js +0 -8
- package/dist/cjs/analyze/nestedRoutes.js +1 -2
- package/dist/cjs/analyze/utils.js +10 -0
- package/dist/cjs/initialize/index.js +0 -7
- package/dist/esm/analyze/getBundleEntry.js +2 -1
- package/dist/esm/analyze/index.js +0 -8
- package/dist/esm/analyze/nestedRoutes.js +1 -4
- package/dist/esm/analyze/utils.js +9 -0
- package/dist/esm/initialize/index.js +0 -7
- package/dist/esm-node/analyze/getBundleEntry.js +2 -1
- package/dist/esm-node/analyze/index.js +0 -8
- package/dist/esm-node/analyze/nestedRoutes.js +1 -2
- package/dist/esm-node/analyze/utils.js +9 -0
- package/dist/esm-node/initialize/index.js +0 -7
- package/dist/types/analyze/utils.d.ts +2 -1
- package/package.json +24 -24
- package/dist/cjs/schema/Schema.js +0 -66
- package/dist/cjs/schema/index.js +0 -205
- package/dist/cjs/schema/legacy.js +0 -364
- package/dist/esm/schema/Schema.js +0 -82
- package/dist/esm/schema/index.js +0 -169
- package/dist/esm/schema/legacy.js +0 -333
- package/dist/esm-node/schema/Schema.js +0 -42
- package/dist/esm-node/schema/index.js +0 -170
- package/dist/esm-node/schema/legacy.js +0 -344
- package/dist/types/schema/Schema.d.ts +0 -14
- package/dist/types/schema/index.d.ts +0 -4
- package/dist/types/schema/legacy.d.ts +0 -3
@@ -35,6 +35,7 @@ var import_path = __toESM(require("path"));
|
|
35
35
|
var import_utils = require("@modern-js/utils");
|
36
36
|
var import_getFileSystemEntry = require("./getFileSystemEntry");
|
37
37
|
var import_constants = require("./constants");
|
38
|
+
var import_utils2 = require("./utils");
|
38
39
|
const ensureExtensions = (file) => {
|
39
40
|
if (!import_path.default.extname(file)) {
|
40
41
|
return (0, import_utils.findExists)(import_constants.JS_EXTENSIONS.map((ext) => `${file}${ext}`)) || file;
|
@@ -47,7 +48,7 @@ const ifAlreadyExists = (entrypoints, checked) => entrypoints.some((entrypoint)
|
|
47
48
|
checked.entryName = entrypoint.entryName;
|
48
49
|
return true;
|
49
50
|
}
|
50
|
-
if (entrypoint.entry
|
51
|
+
if ((0, import_utils2.isSubDirOrEqual)(entrypoint.entry, checked.entry) || (0, import_utils2.isSubDirOrEqual)(checked.entry, entrypoint.entry)) {
|
51
52
|
throw new Error(`Entry configuration conflicts
|
52
53
|
Your configuration: ${checked.entry}.
|
53
54
|
Default entrypoint: ${entrypoint.entry}
|
@@ -246,14 +246,6 @@ var analyze_default = ({ bundler }) => ({
|
|
246
246
|
imports
|
247
247
|
};
|
248
248
|
},
|
249
|
-
validateSchema() {
|
250
|
-
return {
|
251
|
-
target: "output.splitRouteChunks",
|
252
|
-
schema: {
|
253
|
-
type: "boolean"
|
254
|
-
}
|
255
|
-
};
|
256
|
-
},
|
257
249
|
async fileChange(e) {
|
258
250
|
const appContext = api.useAppContext();
|
259
251
|
const { appDirectory } = appContext;
|
@@ -78,8 +78,7 @@ const optimizeRoute = (routeTree) => {
|
|
78
78
|
];
|
79
79
|
}
|
80
80
|
const { children } = routeTree;
|
81
|
-
|
82
|
-
if (!routeTree._component && !routeTree.error && !routeTree.loading && !routeTree.config && !routeTree.clientData && !hasPage) {
|
81
|
+
if (!routeTree._component && !routeTree.error && !routeTree.loading && !routeTree.config && !routeTree.clientData) {
|
83
82
|
const newRoutes = children.map((child) => {
|
84
83
|
const routePath = `${routeTree.path ? routeTree.path : ""}${child.path ? `/${child.path}` : ""}`;
|
85
84
|
const newRoute = {
|
@@ -35,6 +35,7 @@ __export(utils_exports, {
|
|
35
35
|
hasAction: () => hasAction,
|
36
36
|
hasLoader: () => hasLoader,
|
37
37
|
isPageComponentFile: () => isPageComponentFile,
|
38
|
+
isSubDirOrEqual: () => isSubDirOrEqual,
|
38
39
|
parseModule: () => parseModule,
|
39
40
|
replaceWithAlias: () => replaceWithAlias,
|
40
41
|
walkDirectory: () => walkDirectory
|
@@ -211,6 +212,14 @@ const checkIsBuildCommands = () => {
|
|
211
212
|
const command = (0, import_utils.getCommand)();
|
212
213
|
return buildCommands.includes(command);
|
213
214
|
};
|
215
|
+
const isSubDirOrEqual = (parent, child) => {
|
216
|
+
if (parent === child) {
|
217
|
+
return true;
|
218
|
+
}
|
219
|
+
const relative = import_path.default.relative(parent, child);
|
220
|
+
const isSubdir = relative && !relative.startsWith("..") && !import_path.default.isAbsolute(relative);
|
221
|
+
return Boolean(isSubdir);
|
222
|
+
};
|
214
223
|
// Annotate the CommonJS export names for ESM import in node:
|
215
224
|
0 && (module.exports = {
|
216
225
|
checkIsBuildCommands,
|
@@ -220,6 +229,7 @@ const checkIsBuildCommands = () => {
|
|
220
229
|
hasAction,
|
221
230
|
hasLoader,
|
222
231
|
isPageComponentFile,
|
232
|
+
isSubDirOrEqual,
|
223
233
|
parseModule,
|
224
234
|
replaceWithAlias,
|
225
235
|
walkDirectory
|
@@ -22,7 +22,6 @@ __export(initialize_exports, {
|
|
22
22
|
});
|
23
23
|
module.exports = __toCommonJS(initialize_exports);
|
24
24
|
var import_utils = require("@modern-js/utils");
|
25
|
-
var import_schema = require("../schema");
|
26
25
|
var import_config = require("../config");
|
27
26
|
var initialize_default = ({ bundler }) => ({
|
28
27
|
name: "@modern-js/plugin-initialize",
|
@@ -44,14 +43,8 @@ var initialize_default = ({ bundler }) => ({
|
|
44
43
|
});
|
45
44
|
return (0, import_config.checkIsLegacyConfig)(userConfig) ? (0, import_config.createLegacyDefaultConfig)(appContext) : (0, import_config.createDefaultConfig)(appContext, bundler);
|
46
45
|
};
|
47
|
-
const validateSchema = () => {
|
48
|
-
const userConfig = api.useConfigContext();
|
49
|
-
const schemas = (0, import_config.checkIsLegacyConfig)(userConfig) ? import_schema.legacySchema : import_schema.schema;
|
50
|
-
return schemas.generate();
|
51
|
-
};
|
52
46
|
return {
|
53
47
|
config,
|
54
|
-
validateSchema,
|
55
48
|
async resolvedConfig({ resolved }) {
|
56
49
|
var _resolved_output_distPath;
|
57
50
|
let appContext = api.useAppContext();
|
@@ -2,6 +2,7 @@ import path from "path";
|
|
2
2
|
import { ensureAbsolutePath, fs, findExists, MAIN_ENTRY_NAME, isRouterV5 } from "@modern-js/utils";
|
3
3
|
import { getFileSystemEntry } from "./getFileSystemEntry";
|
4
4
|
import { JS_EXTENSIONS } from "./constants";
|
5
|
+
import { isSubDirOrEqual } from "./utils";
|
5
6
|
var ensureExtensions = function(file) {
|
6
7
|
if (!path.extname(file)) {
|
7
8
|
return findExists(JS_EXTENSIONS.map(function(ext) {
|
@@ -19,7 +20,7 @@ var ifAlreadyExists = function(entrypoints, checked) {
|
|
19
20
|
checked.entryName = entrypoint.entryName;
|
20
21
|
return true;
|
21
22
|
}
|
22
|
-
if (entrypoint.entry
|
23
|
+
if (isSubDirOrEqual(entrypoint.entry, checked.entry) || isSubDirOrEqual(checked.entry, entrypoint.entry)) {
|
23
24
|
throw new Error("Entry configuration conflicts\n Your configuration: ".concat(checked.entry, ".\n Default entrypoint: ").concat(entrypoint.entry, "\n Please reset source.entries or set source.disableDefaultEntries to disable the default entry rules."));
|
24
25
|
}
|
25
26
|
return false;
|
@@ -457,14 +457,6 @@ function analyze_default(param) {
|
|
457
457
|
})();
|
458
458
|
}
|
459
459
|
),
|
460
|
-
validateSchema: function validateSchema() {
|
461
|
-
return {
|
462
|
-
target: "output.splitRouteChunks",
|
463
|
-
schema: {
|
464
|
-
type: "boolean"
|
465
|
-
}
|
466
|
-
};
|
467
|
-
},
|
468
460
|
fileChange: function fileChange(e) {
|
469
461
|
return _async_to_generator(function() {
|
470
462
|
var appContext, appDirectory, filename, eventType, isPageFile, absoluteFilePath, isRouteComponent, resolvedConfig, generateCode, entrypoints;
|
@@ -45,10 +45,7 @@ var optimizeRoute = function(routeTree) {
|
|
45
45
|
];
|
46
46
|
}
|
47
47
|
var children = routeTree.children;
|
48
|
-
|
49
|
-
return child.index;
|
50
|
-
});
|
51
|
-
if (!routeTree._component && !routeTree.error && !routeTree.loading && !routeTree.config && !routeTree.clientData && !hasPage) {
|
48
|
+
if (!routeTree._component && !routeTree.error && !routeTree.loading && !routeTree.config && !routeTree.clientData) {
|
52
49
|
var newRoutes = children.map(function(child) {
|
53
50
|
var routePath = "".concat(routeTree.path ? routeTree.path : "").concat(child.path ? "/".concat(child.path) : "");
|
54
51
|
var newRoute = _object_spread_props(_object_spread({}, child), {
|
@@ -286,6 +286,14 @@ var checkIsBuildCommands = function() {
|
|
286
286
|
var command = getCommand();
|
287
287
|
return buildCommands.includes(command);
|
288
288
|
};
|
289
|
+
var isSubDirOrEqual = function(parent, child) {
|
290
|
+
if (parent === child) {
|
291
|
+
return true;
|
292
|
+
}
|
293
|
+
var relative = path.relative(parent, child);
|
294
|
+
var isSubdir = relative && !relative.startsWith("..") && !path.isAbsolute(relative);
|
295
|
+
return Boolean(isSubdir);
|
296
|
+
};
|
289
297
|
export {
|
290
298
|
checkIsBuildCommands,
|
291
299
|
getDefaultImports,
|
@@ -294,6 +302,7 @@ export {
|
|
294
302
|
hasAction,
|
295
303
|
hasLoader,
|
296
304
|
isPageComponentFile,
|
305
|
+
isSubDirOrEqual,
|
297
306
|
parseModule,
|
298
307
|
replaceWithAlias,
|
299
308
|
walkDirectory
|
@@ -3,7 +3,6 @@ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
3
3
|
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
4
4
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
5
5
|
import { ensureAbsolutePath, getPort, isDev, isDevCommand } from "@modern-js/utils";
|
6
|
-
import { legacySchema, schema } from "../schema";
|
7
6
|
import { checkIsLegacyConfig, createDefaultConfig, createLegacyDefaultConfig, transformNormalizedConfig } from "../config";
|
8
7
|
function initialize_default(param) {
|
9
8
|
var bundler = param.bundler;
|
@@ -26,14 +25,8 @@ function initialize_default(param) {
|
|
26
25
|
}));
|
27
26
|
return checkIsLegacyConfig(userConfig) ? createLegacyDefaultConfig(appContext) : createDefaultConfig(appContext, bundler);
|
28
27
|
};
|
29
|
-
var validateSchema = function() {
|
30
|
-
var userConfig = api.useConfigContext();
|
31
|
-
var schemas = checkIsLegacyConfig(userConfig) ? legacySchema : schema;
|
32
|
-
return schemas.generate();
|
33
|
-
};
|
34
28
|
return {
|
35
29
|
config,
|
36
|
-
validateSchema,
|
37
30
|
resolvedConfig: function resolvedConfig(param2) {
|
38
31
|
var resolved = param2.resolved;
|
39
32
|
return _async_to_generator(function() {
|
@@ -2,6 +2,7 @@ import path from "path";
|
|
2
2
|
import { ensureAbsolutePath, fs, findExists, MAIN_ENTRY_NAME, isRouterV5 } from "@modern-js/utils";
|
3
3
|
import { getFileSystemEntry } from "./getFileSystemEntry";
|
4
4
|
import { JS_EXTENSIONS } from "./constants";
|
5
|
+
import { isSubDirOrEqual } from "./utils";
|
5
6
|
const ensureExtensions = (file) => {
|
6
7
|
if (!path.extname(file)) {
|
7
8
|
return findExists(JS_EXTENSIONS.map((ext) => `${file}${ext}`)) || file;
|
@@ -14,7 +15,7 @@ const ifAlreadyExists = (entrypoints, checked) => entrypoints.some((entrypoint)
|
|
14
15
|
checked.entryName = entrypoint.entryName;
|
15
16
|
return true;
|
16
17
|
}
|
17
|
-
if (entrypoint.entry
|
18
|
+
if (isSubDirOrEqual(entrypoint.entry, checked.entry) || isSubDirOrEqual(checked.entry, entrypoint.entry)) {
|
18
19
|
throw new Error(`Entry configuration conflicts
|
19
20
|
Your configuration: ${checked.entry}.
|
20
21
|
Default entrypoint: ${entrypoint.entry}
|
@@ -213,14 +213,6 @@ var analyze_default = ({ bundler }) => ({
|
|
213
213
|
imports
|
214
214
|
};
|
215
215
|
},
|
216
|
-
validateSchema() {
|
217
|
-
return {
|
218
|
-
target: "output.splitRouteChunks",
|
219
|
-
schema: {
|
220
|
-
type: "boolean"
|
221
|
-
}
|
222
|
-
};
|
223
|
-
},
|
224
216
|
async fileChange(e) {
|
225
217
|
const appContext = api.useAppContext();
|
226
218
|
const { appDirectory } = appContext;
|
@@ -43,8 +43,7 @@ const optimizeRoute = (routeTree) => {
|
|
43
43
|
];
|
44
44
|
}
|
45
45
|
const { children } = routeTree;
|
46
|
-
|
47
|
-
if (!routeTree._component && !routeTree.error && !routeTree.loading && !routeTree.config && !routeTree.clientData && !hasPage) {
|
46
|
+
if (!routeTree._component && !routeTree.error && !routeTree.loading && !routeTree.config && !routeTree.clientData) {
|
48
47
|
const newRoutes = children.map((child) => {
|
49
48
|
const routePath = `${routeTree.path ? routeTree.path : ""}${child.path ? `/${child.path}` : ""}`;
|
50
49
|
const newRoute = {
|
@@ -169,6 +169,14 @@ const checkIsBuildCommands = () => {
|
|
169
169
|
const command = getCommand();
|
170
170
|
return buildCommands.includes(command);
|
171
171
|
};
|
172
|
+
const isSubDirOrEqual = (parent, child) => {
|
173
|
+
if (parent === child) {
|
174
|
+
return true;
|
175
|
+
}
|
176
|
+
const relative = path.relative(parent, child);
|
177
|
+
const isSubdir = relative && !relative.startsWith("..") && !path.isAbsolute(relative);
|
178
|
+
return Boolean(isSubdir);
|
179
|
+
};
|
172
180
|
export {
|
173
181
|
checkIsBuildCommands,
|
174
182
|
getDefaultImports,
|
@@ -177,6 +185,7 @@ export {
|
|
177
185
|
hasAction,
|
178
186
|
hasLoader,
|
179
187
|
isPageComponentFile,
|
188
|
+
isSubDirOrEqual,
|
180
189
|
parseModule,
|
181
190
|
replaceWithAlias,
|
182
191
|
walkDirectory
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import { ensureAbsolutePath, getPort, isDev, isDevCommand } from "@modern-js/utils";
|
2
|
-
import { legacySchema, schema } from "../schema";
|
3
2
|
import { checkIsLegacyConfig, createDefaultConfig, createLegacyDefaultConfig, transformNormalizedConfig } from "../config";
|
4
3
|
var initialize_default = ({ bundler }) => ({
|
5
4
|
name: "@modern-js/plugin-initialize",
|
@@ -21,14 +20,8 @@ var initialize_default = ({ bundler }) => ({
|
|
21
20
|
});
|
22
21
|
return checkIsLegacyConfig(userConfig) ? createLegacyDefaultConfig(appContext) : createDefaultConfig(appContext, bundler);
|
23
22
|
};
|
24
|
-
const validateSchema = () => {
|
25
|
-
const userConfig = api.useConfigContext();
|
26
|
-
const schemas = checkIsLegacyConfig(userConfig) ? legacySchema : schema;
|
27
|
-
return schemas.generate();
|
28
|
-
};
|
29
23
|
return {
|
30
24
|
config,
|
31
|
-
validateSchema,
|
32
25
|
async resolvedConfig({ resolved }) {
|
33
26
|
var _resolved_output_distPath;
|
34
27
|
let appContext = api.useAppContext();
|
@@ -27,4 +27,5 @@ export declare const hasLoader: (filename: string, source?: string) => Promise<b
|
|
27
27
|
export declare const hasAction: (filename: string, source?: string) => Promise<boolean>;
|
28
28
|
export declare const getServerLoadersFile: (internalDirectory: string, entryName: string) => string;
|
29
29
|
export declare const getServerCombinedModueFile: (internalDirectory: string, entryName: string) => string;
|
30
|
-
export declare const checkIsBuildCommands: () => boolean;
|
30
|
+
export declare const checkIsBuildCommands: () => boolean;
|
31
|
+
export declare const isSubDirOrEqual: (parent: string, child: string) => boolean;
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.
|
18
|
+
"version": "2.40.0",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/types/index.d.ts",
|
21
21
|
"main": "./dist/cjs/index.js",
|
@@ -72,24 +72,24 @@
|
|
72
72
|
"es-module-lexer": "^1.1.0",
|
73
73
|
"esbuild": "0.17.19",
|
74
74
|
"@swc/helpers": "0.5.1",
|
75
|
-
"@modern-js/builder": "2.
|
76
|
-
"@modern-js/builder-plugin-
|
77
|
-
"@modern-js/builder-plugin-
|
78
|
-
"@modern-js/builder-shared": "2.
|
79
|
-
"@modern-js/
|
80
|
-
"@modern-js/
|
81
|
-
"@modern-js/new-action": "2.
|
82
|
-
"@modern-js/node-bundle-require": "2.
|
83
|
-
"@modern-js/plugin
|
84
|
-
"@modern-js/plugin": "2.
|
85
|
-
"@modern-js/plugin-
|
86
|
-
"@modern-js/
|
87
|
-
"@modern-js/
|
88
|
-
"@modern-js/server": "2.
|
89
|
-
"@modern-js/types": "2.
|
90
|
-
"@modern-js/
|
91
|
-
"@modern-js/
|
92
|
-
"@modern-js/server-core": "2.
|
75
|
+
"@modern-js/builder": "2.40.0",
|
76
|
+
"@modern-js/builder-plugin-node-polyfill": "2.40.0",
|
77
|
+
"@modern-js/builder-plugin-esbuild": "2.40.0",
|
78
|
+
"@modern-js/builder-shared": "2.40.0",
|
79
|
+
"@modern-js/core": "2.40.0",
|
80
|
+
"@modern-js/builder-webpack-provider": "2.40.0",
|
81
|
+
"@modern-js/new-action": "2.40.0",
|
82
|
+
"@modern-js/node-bundle-require": "2.40.0",
|
83
|
+
"@modern-js/plugin": "2.40.0",
|
84
|
+
"@modern-js/plugin-i18n": "2.40.0",
|
85
|
+
"@modern-js/plugin-data-loader": "2.40.0",
|
86
|
+
"@modern-js/prod-server": "2.40.0",
|
87
|
+
"@modern-js/plugin-lint": "2.40.0",
|
88
|
+
"@modern-js/server": "2.40.0",
|
89
|
+
"@modern-js/types": "2.40.0",
|
90
|
+
"@modern-js/utils": "2.40.0",
|
91
|
+
"@modern-js/upgrade": "2.40.0",
|
92
|
+
"@modern-js/server-core": "2.40.0"
|
93
93
|
},
|
94
94
|
"devDependencies": {
|
95
95
|
"@types/babel__traverse": "^7.14.2",
|
@@ -98,13 +98,13 @@
|
|
98
98
|
"jest": "^29",
|
99
99
|
"typescript": "^5",
|
100
100
|
"webpack": "^5.88.1",
|
101
|
-
"@modern-js/builder-plugin-swc": "2.
|
102
|
-
"@modern-js/builder-rspack-provider": "2.
|
103
|
-
"@scripts/build": "2.
|
104
|
-
"@scripts/jest-config": "2.
|
101
|
+
"@modern-js/builder-plugin-swc": "2.40.0",
|
102
|
+
"@modern-js/builder-rspack-provider": "2.40.0",
|
103
|
+
"@scripts/build": "2.40.0",
|
104
|
+
"@scripts/jest-config": "2.40.0"
|
105
105
|
},
|
106
106
|
"peerDependencies": {
|
107
|
-
"@modern-js/builder-rspack-provider": "^2.
|
107
|
+
"@modern-js/builder-rspack-provider": "^2.40.0"
|
108
108
|
},
|
109
109
|
"peerDependenciesMeta": {
|
110
110
|
"@modern-js/builder-rspack-provider": {
|
@@ -1,66 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __defProp = Object.defineProperty;
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
-
var __export = (target, all) => {
|
7
|
-
for (var name in all)
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
-
};
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
-
for (let key of __getOwnPropNames(from))
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
-
}
|
16
|
-
return to;
|
17
|
-
};
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
-
var Schema_exports = {};
|
20
|
-
__export(Schema_exports, {
|
21
|
-
Schema: () => Schema
|
22
|
-
});
|
23
|
-
module.exports = __toCommonJS(Schema_exports);
|
24
|
-
var import_define_property = require("@swc/helpers/_/_define_property");
|
25
|
-
var import_lodash = require("@modern-js/utils/lodash");
|
26
|
-
class Schema extends Map {
|
27
|
-
setSchema(key, object) {
|
28
|
-
Object.entries(object).forEach(([k, v]) => {
|
29
|
-
const target = `${key}.${k}`;
|
30
|
-
this.set(target, v);
|
31
|
-
});
|
32
|
-
return this;
|
33
|
-
}
|
34
|
-
set(key, value) {
|
35
|
-
if (this.has(key)) {
|
36
|
-
(0, import_lodash.merge)(this.schema[key], value);
|
37
|
-
} else {
|
38
|
-
this.schema[key] = value;
|
39
|
-
}
|
40
|
-
return this;
|
41
|
-
}
|
42
|
-
has(key) {
|
43
|
-
return key in this.schema;
|
44
|
-
}
|
45
|
-
get(key) {
|
46
|
-
return this.schema[key];
|
47
|
-
}
|
48
|
-
delete(key) {
|
49
|
-
return delete this.schema[key];
|
50
|
-
}
|
51
|
-
generate() {
|
52
|
-
return Object.entries(this.schema).map(([target, schema]) => ({
|
53
|
-
target,
|
54
|
-
schema
|
55
|
-
}));
|
56
|
-
}
|
57
|
-
constructor(baseSchema = {}) {
|
58
|
-
super();
|
59
|
-
(0, import_define_property._)(this, "schema", void 0);
|
60
|
-
this.schema = baseSchema;
|
61
|
-
}
|
62
|
-
}
|
63
|
-
// Annotate the CommonJS export names for ESM import in node:
|
64
|
-
0 && (module.exports = {
|
65
|
-
Schema
|
66
|
-
});
|
package/dist/cjs/schema/index.js
DELETED
@@ -1,205 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __create = Object.create;
|
3
|
-
var __defProp = Object.defineProperty;
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
-
var __export = (target, all) => {
|
9
|
-
for (var name in all)
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
-
};
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
14
|
-
for (let key of __getOwnPropNames(from))
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
17
|
-
}
|
18
|
-
return to;
|
19
|
-
};
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
26
|
-
mod
|
27
|
-
));
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
-
var schema_exports = {};
|
30
|
-
__export(schema_exports, {
|
31
|
-
legacySchema: () => import_legacy.default,
|
32
|
-
schema: () => schema
|
33
|
-
});
|
34
|
-
module.exports = __toCommonJS(schema_exports);
|
35
|
-
var import_utils = require("@modern-js/utils");
|
36
|
-
var import_Schema = require("./Schema");
|
37
|
-
var import_legacy = __toESM(require("./legacy"));
|
38
|
-
const source = {
|
39
|
-
entries: {
|
40
|
-
type: "object",
|
41
|
-
patternProperties: {
|
42
|
-
[import_utils.ENTRY_NAME_PATTERN]: {
|
43
|
-
if: {
|
44
|
-
type: "object"
|
45
|
-
},
|
46
|
-
then: {
|
47
|
-
required: [
|
48
|
-
"entry"
|
49
|
-
],
|
50
|
-
properties: {
|
51
|
-
entry: {
|
52
|
-
type: [
|
53
|
-
"string",
|
54
|
-
"array"
|
55
|
-
]
|
56
|
-
},
|
57
|
-
disableMount: {
|
58
|
-
type: "boolean"
|
59
|
-
},
|
60
|
-
customBootstrap: {
|
61
|
-
type: "string"
|
62
|
-
}
|
63
|
-
},
|
64
|
-
additionalProperties: false
|
65
|
-
},
|
66
|
-
else: {
|
67
|
-
type: [
|
68
|
-
"string",
|
69
|
-
"array"
|
70
|
-
]
|
71
|
-
}
|
72
|
-
}
|
73
|
-
}
|
74
|
-
},
|
75
|
-
mainEntryName: {
|
76
|
-
type: "string"
|
77
|
-
},
|
78
|
-
enableAsyncEntry: {
|
79
|
-
type: "boolean"
|
80
|
-
},
|
81
|
-
disableDefaultEntries: {
|
82
|
-
type: "boolean"
|
83
|
-
},
|
84
|
-
entriesDir: {
|
85
|
-
type: "string"
|
86
|
-
},
|
87
|
-
disableEntryDirs: {
|
88
|
-
type: "array"
|
89
|
-
},
|
90
|
-
configDir: {
|
91
|
-
type: "string"
|
92
|
-
},
|
93
|
-
designSystem: {
|
94
|
-
type: "object"
|
95
|
-
}
|
96
|
-
};
|
97
|
-
const bff = {
|
98
|
-
prefix: {
|
99
|
-
type: "string"
|
100
|
-
},
|
101
|
-
httpMethodDecider: {
|
102
|
-
type: "string",
|
103
|
-
enum: [
|
104
|
-
"functionName",
|
105
|
-
"inputParams"
|
106
|
-
]
|
107
|
-
},
|
108
|
-
proxy: {
|
109
|
-
type: "object",
|
110
|
-
additionalProperties: {
|
111
|
-
type: "string"
|
112
|
-
}
|
113
|
-
}
|
114
|
-
};
|
115
|
-
const output = {
|
116
|
-
ssg: {
|
117
|
-
typeof: [
|
118
|
-
"boolean",
|
119
|
-
"object",
|
120
|
-
"function"
|
121
|
-
]
|
122
|
-
},
|
123
|
-
disableNodePolyfill: {
|
124
|
-
type: "boolean"
|
125
|
-
},
|
126
|
-
enableInlineRouteManifests: {
|
127
|
-
type: "boolean"
|
128
|
-
}
|
129
|
-
};
|
130
|
-
const dev = {};
|
131
|
-
const server = {
|
132
|
-
routes: {
|
133
|
-
type: "object"
|
134
|
-
},
|
135
|
-
publicRoutes: {
|
136
|
-
type: "object"
|
137
|
-
},
|
138
|
-
ssr: {
|
139
|
-
type: [
|
140
|
-
"boolean",
|
141
|
-
"object"
|
142
|
-
]
|
143
|
-
},
|
144
|
-
ssrByEntries: {
|
145
|
-
type: "object"
|
146
|
-
},
|
147
|
-
baseUrl: {
|
148
|
-
anyOf: [
|
149
|
-
{
|
150
|
-
type: "string"
|
151
|
-
},
|
152
|
-
{
|
153
|
-
type: "array",
|
154
|
-
items: {
|
155
|
-
type: "string"
|
156
|
-
}
|
157
|
-
}
|
158
|
-
]
|
159
|
-
},
|
160
|
-
port: {
|
161
|
-
type: "number"
|
162
|
-
},
|
163
|
-
logger: {
|
164
|
-
type: [
|
165
|
-
"boolean",
|
166
|
-
"object"
|
167
|
-
]
|
168
|
-
},
|
169
|
-
metrics: {
|
170
|
-
type: [
|
171
|
-
"boolean",
|
172
|
-
"object"
|
173
|
-
]
|
174
|
-
},
|
175
|
-
enableMicroFrontendDebug: {
|
176
|
-
type: "boolean"
|
177
|
-
},
|
178
|
-
watchOptions: {
|
179
|
-
type: "object"
|
180
|
-
},
|
181
|
-
compiler: {
|
182
|
-
type: "string"
|
183
|
-
},
|
184
|
-
enableFrameworkExt: {
|
185
|
-
type: "boolean"
|
186
|
-
}
|
187
|
-
};
|
188
|
-
const tools = {
|
189
|
-
esbuild: {
|
190
|
-
typeof: [
|
191
|
-
"object"
|
192
|
-
]
|
193
|
-
}
|
194
|
-
};
|
195
|
-
const deploy = {};
|
196
|
-
const builderPlugins = {
|
197
|
-
type: "array"
|
198
|
-
};
|
199
|
-
const schema = new import_Schema.Schema();
|
200
|
-
schema.setSchema("bff", bff).setSchema("dev", dev).setSchema("server", server).setSchema("source", source).setSchema("output", output).setSchema("tools", tools).setSchema("deploy", deploy).set("builderPlugin", builderPlugins);
|
201
|
-
// Annotate the CommonJS export names for ESM import in node:
|
202
|
-
0 && (module.exports = {
|
203
|
-
legacySchema,
|
204
|
-
schema
|
205
|
-
});
|