@modern-js/core 2.26.0 → 2.28.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/CHANGELOG.md +23 -0
- package/dist/bin.d.ts +1 -1
- package/dist/bin.js +5 -3
- package/dist/config/createDefaultConfig.d.ts +1 -1
- package/dist/config/createDefaultConfig.js +12 -6
- package/dist/config/createLoadedConfig.d.ts +1 -1
- package/dist/config/createLoadedConfig.js +81 -73
- package/dist/config/createResolvedConfig.d.ts +1 -1
- package/dist/config/createResolvedConfig.js +60 -72
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js +7 -18
- package/dist/config/loadConfig.d.ts +5 -5
- package/dist/config/loadConfig.js +115 -112
- package/dist/context.d.ts +21 -14
- package/dist/context.js +74 -60
- package/dist/createCli.d.ts +13 -13
- package/dist/createCli.js +134 -113
- package/dist/index.d.ts +16 -16
- package/dist/index.js +59 -35
- package/dist/loadEnv.d.ts +1 -1
- package/dist/loadEnv.js +23 -17
- package/dist/loadPlugins.d.ts +4 -4
- package/dist/loadPlugins.js +55 -54
- package/dist/manager.d.ts +62 -62
- package/dist/manager.js +40 -23
- package/dist/nodeApi.d.ts +1 -1
- package/dist/nodeApi.js +25 -9
- package/dist/runBin.d.ts +2 -2
- package/dist/runBin.js +57 -53
- package/dist/schema/patchSchema.d.ts +15 -15
- package/dist/schema/patchSchema.js +56 -53
- package/dist/schema/testing.d.ts +11 -11
- package/dist/schema/testing.js +26 -8
- package/dist/schema/traverseSchema.d.ts +1 -1
- package/dist/schema/traverseSchema.js +25 -17
- package/dist/types/config/index.d.ts +37 -37
- package/dist/types/config/index.js +3 -1
- package/dist/types/config/testing.d.ts +11 -11
- package/dist/types/config/testing.js +3 -1
- package/dist/types/context.d.ts +27 -27
- package/dist/types/context.js +3 -1
- package/dist/types/coreOptions.d.ts +22 -22
- package/dist/types/coreOptions.js +3 -1
- package/dist/types/hooks.d.ts +41 -41
- package/dist/types/hooks.js +3 -1
- package/dist/types/index.d.ts +3 -3
- package/dist/types/index.js +10 -21
- package/dist/types/plugin.d.ts +10 -10
- package/dist/types/plugin.js +3 -1
- package/dist/types/pluginAPI.d.ts +10 -10
- package/dist/types/pluginAPI.js +3 -1
- package/dist/utils/checkIsDuplicationPlugin.d.ts +1 -1
- package/dist/utils/checkIsDuplicationPlugin.js +24 -21
- package/dist/utils/commander.d.ts +1 -1
- package/dist/utils/commander.js +31 -17
- package/dist/utils/createFileWatcher.d.ts +1 -1
- package/dist/utils/createFileWatcher.js +85 -106
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +10 -21
- package/dist/utils/initAppDir.d.ts +1 -1
- package/dist/utils/initAppDir.js +22 -17
- package/dist/utils/mergeConfig.d.ts +1 -1
- package/dist/utils/mergeConfig.js +37 -27
- package/dist/utils/repeatKeyWarning.d.ts +1 -1
- package/dist/utils/repeatKeyWarning.js +29 -16
- package/package.json +11 -10
package/dist/utils/commander.js
CHANGED
|
@@ -1,20 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
initCommandsMap: function() {
|
|
14
|
+
return initCommandsMap;
|
|
15
|
+
},
|
|
16
|
+
program: function() {
|
|
17
|
+
return _utils.program;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
const _utils = require("@modern-js/utils");
|
|
6
21
|
function initCommandsMap() {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
22
|
+
if (!_utils.program.hasOwnProperty("commandsMap")) {
|
|
23
|
+
Object.defineProperty(_utils.program, "commandsMap", {
|
|
24
|
+
get() {
|
|
25
|
+
const map = /* @__PURE__ */ new Map();
|
|
26
|
+
for (const command of _utils.program.commands) {
|
|
27
|
+
map.set(command._name, command);
|
|
28
|
+
}
|
|
29
|
+
return map;
|
|
30
|
+
},
|
|
31
|
+
configurable: false
|
|
32
|
+
});
|
|
33
|
+
}
|
|
19
34
|
}
|
|
20
|
-
exports.initCommandsMap = initCommandsMap;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { CliHooksRunner, IAppContext } from '../types';
|
|
2
|
-
export declare const createFileWatcher: (appContext: IAppContext, hooksRunner: CliHooksRunner) => Promise<import("@modern-js/utils").FSWatcher | undefined>;
|
|
2
|
+
export declare const createFileWatcher: (appContext: IAppContext, hooksRunner: CliHooksRunner) => Promise<import("@modern-js/utils").FSWatcher | undefined>;
|
|
@@ -1,111 +1,90 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
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;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
17
4
|
});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const utils_1 = require("@modern-js/utils");
|
|
34
|
-
const debug = (0, utils_1.createDebugger)('watch-files');
|
|
35
|
-
const hashMap = new Map();
|
|
36
|
-
const md5 = (data) => crypto_1.default.createHash('md5').update(data).digest('hex');
|
|
5
|
+
Object.defineProperty(exports, "createFileWatcher", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return createFileWatcher;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
12
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
13
|
+
const _crypto = /* @__PURE__ */ _interop_require_default._(require("crypto"));
|
|
14
|
+
const _path = /* @__PURE__ */ _interop_require_wildcard._(require("path"));
|
|
15
|
+
const _fs = /* @__PURE__ */ _interop_require_wildcard._(require("fs"));
|
|
16
|
+
const _utils = require("@modern-js/utils");
|
|
17
|
+
const debug = (0, _utils.createDebugger)("watch-files");
|
|
18
|
+
const hashMap = /* @__PURE__ */ new Map();
|
|
19
|
+
const md5 = (data) => _crypto.default.createHash("md5").update(data).digest("hex");
|
|
37
20
|
const createFileWatcher = async (appContext, hooksRunner) => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
filename: changed,
|
|
79
|
-
eventType: 'change',
|
|
80
|
-
isPrivate: isPrivate(changed),
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
watcher.on('add', changed => {
|
|
85
|
-
debug(`add file: %s`, changed);
|
|
86
|
-
const currentHash = md5(fs.readFileSync(path.join(appDirectory, changed), 'utf8'));
|
|
87
|
-
hashMap.set(changed, currentHash);
|
|
88
|
-
hooksRunner.fileChange({
|
|
89
|
-
filename: changed,
|
|
90
|
-
eventType: 'add',
|
|
91
|
-
isPrivate: isPrivate(changed),
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
watcher.on('unlink', changed => {
|
|
95
|
-
debug(`remove file: %s`, changed);
|
|
96
|
-
if (hashMap.has(changed)) {
|
|
97
|
-
hashMap.delete(changed);
|
|
98
|
-
}
|
|
99
|
-
hooksRunner.fileChange({
|
|
100
|
-
filename: changed,
|
|
101
|
-
eventType: 'unlink',
|
|
102
|
-
isPrivate: isPrivate(changed),
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
watcher.on('error', err => {
|
|
106
|
-
throw err;
|
|
21
|
+
if ((0, _utils.isDevCommand)()) {
|
|
22
|
+
const { appDirectory } = appContext;
|
|
23
|
+
const extraFiles = await hooksRunner.watchFiles();
|
|
24
|
+
const watched = extraFiles.filter((extra) => {
|
|
25
|
+
return Array.isArray(extra);
|
|
26
|
+
}).flat();
|
|
27
|
+
const privateWatched = extraFiles.filter((extra) => {
|
|
28
|
+
return !Array.isArray(extra) && extra.isPrivate;
|
|
29
|
+
}).map((extra) => {
|
|
30
|
+
return extra.files;
|
|
31
|
+
}).flat();
|
|
32
|
+
const isPrivate = (filename) => privateWatched.some((ff) => {
|
|
33
|
+
return _path.resolve(appDirectory, filename).startsWith(ff);
|
|
34
|
+
});
|
|
35
|
+
debug(`watched: %o`, watched);
|
|
36
|
+
const watcher = _utils.chokidar.watch([
|
|
37
|
+
...watched,
|
|
38
|
+
...privateWatched
|
|
39
|
+
], {
|
|
40
|
+
cwd: appDirectory,
|
|
41
|
+
ignoreInitial: true,
|
|
42
|
+
ignorePermissionErrors: true,
|
|
43
|
+
ignored: [
|
|
44
|
+
/node_modules/,
|
|
45
|
+
"**/__test__/**",
|
|
46
|
+
"**/*.test.(js|jsx|ts|tsx)",
|
|
47
|
+
"**/*.spec.(js|jsx|ts|tsx)",
|
|
48
|
+
"**/*.stories.(js|jsx|ts|tsx)"
|
|
49
|
+
]
|
|
50
|
+
});
|
|
51
|
+
watcher.on("change", (changed) => {
|
|
52
|
+
const lastHash = hashMap.get(changed);
|
|
53
|
+
const currentHash = md5(_fs.readFileSync(_path.join(appDirectory, changed), "utf8"));
|
|
54
|
+
if (currentHash !== lastHash) {
|
|
55
|
+
debug(`file change: %s`, changed);
|
|
56
|
+
hashMap.set(changed, currentHash);
|
|
57
|
+
hooksRunner.fileChange({
|
|
58
|
+
filename: changed,
|
|
59
|
+
eventType: "change",
|
|
60
|
+
isPrivate: isPrivate(changed)
|
|
107
61
|
});
|
|
108
|
-
|
|
109
|
-
}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
watcher.on("add", (changed) => {
|
|
65
|
+
debug(`add file: %s`, changed);
|
|
66
|
+
const currentHash = md5(_fs.readFileSync(_path.join(appDirectory, changed), "utf8"));
|
|
67
|
+
hashMap.set(changed, currentHash);
|
|
68
|
+
hooksRunner.fileChange({
|
|
69
|
+
filename: changed,
|
|
70
|
+
eventType: "add",
|
|
71
|
+
isPrivate: isPrivate(changed)
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
watcher.on("unlink", (changed) => {
|
|
75
|
+
debug(`remove file: %s`, changed);
|
|
76
|
+
if (hashMap.has(changed)) {
|
|
77
|
+
hashMap.delete(changed);
|
|
78
|
+
}
|
|
79
|
+
hooksRunner.fileChange({
|
|
80
|
+
filename: changed,
|
|
81
|
+
eventType: "unlink",
|
|
82
|
+
isPrivate: isPrivate(changed)
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
watcher.on("error", (err) => {
|
|
86
|
+
throw err;
|
|
87
|
+
});
|
|
88
|
+
return watcher;
|
|
89
|
+
}
|
|
110
90
|
};
|
|
111
|
-
exports.createFileWatcher = createFileWatcher;
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -1,22 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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("./commander"), exports);
|
|
18
|
-
__exportStar(require("./createFileWatcher"), exports);
|
|
19
|
-
__exportStar(require("./initAppDir"), exports);
|
|
20
|
-
__exportStar(require("./mergeConfig"), exports);
|
|
21
|
-
__exportStar(require("./repeatKeyWarning"), exports);
|
|
22
|
-
__exportStar(require("./checkIsDuplicationPlugin"), exports);
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
|
6
|
+
_export_star._(require("./commander"), exports);
|
|
7
|
+
_export_star._(require("./createFileWatcher"), exports);
|
|
8
|
+
_export_star._(require("./initAppDir"), exports);
|
|
9
|
+
_export_star._(require("./mergeConfig"), exports);
|
|
10
|
+
_export_star._(require("./repeatKeyWarning"), exports);
|
|
11
|
+
_export_star._(require("./checkIsDuplicationPlugin"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const initAppDir: (cwd?: string) => Promise<string>;
|
|
1
|
+
export declare const initAppDir: (cwd?: string) => Promise<string>;
|
package/dist/utils/initAppDir.js
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "initAppDir", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return initAppDir;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
12
|
+
const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
|
|
13
|
+
const _utils = require("@modern-js/utils");
|
|
9
14
|
const initAppDir = async (cwd) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
15
|
+
if (!cwd) {
|
|
16
|
+
cwd = process.cwd();
|
|
17
|
+
}
|
|
18
|
+
const pkg = await (0, _utils.pkgUp)({
|
|
19
|
+
cwd
|
|
20
|
+
});
|
|
21
|
+
if (!pkg) {
|
|
22
|
+
throw new Error(`no package.json found in current work dir: ${cwd}`);
|
|
23
|
+
}
|
|
24
|
+
return _path.default.dirname(pkg);
|
|
19
25
|
};
|
|
20
|
-
exports.initAppDir = initAppDir;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { UserConfig, NormalizedConfig } from '../types';
|
|
2
|
-
export declare const mergeConfig: <ExtendConfig extends Record<string, any>>(configs: (UserConfig<ExtendConfig> | NormalizedConfig<ExtendConfig>)[]) => NormalizedConfig<ExtendConfig>;
|
|
2
|
+
export declare const mergeConfig: <ExtendConfig extends Record<string, any>>(configs: (UserConfig<ExtendConfig> | NormalizedConfig<ExtendConfig>)[]) => NormalizedConfig<ExtendConfig>;
|
|
@@ -1,32 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "mergeConfig", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return mergeConfig;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _utils = require("@modern-js/utils");
|
|
12
|
+
const _lodash = require("@modern-js/utils/lodash");
|
|
13
|
+
const mergeConfig = (configs) => (0, _lodash.mergeWith)({}, ...configs, (target, source, key) => {
|
|
14
|
+
if (key === "designSystem" || key === "tailwindcss" && typeof source === "object") {
|
|
15
|
+
return (0, _lodash.mergeWith)({}, target !== null && target !== void 0 ? target : {}, source !== null && source !== void 0 ? source : {});
|
|
16
|
+
}
|
|
17
|
+
if (Array.isArray(target) || Array.isArray(source)) {
|
|
18
|
+
if (target === void 0) {
|
|
19
|
+
return source;
|
|
20
|
+
}
|
|
21
|
+
if (source === void 0) {
|
|
22
|
+
return target;
|
|
11
23
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
24
|
+
return [
|
|
25
|
+
...(0, _utils.ensureArray)(target),
|
|
26
|
+
...(0, _utils.ensureArray)(source)
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
if ((0, _lodash.isFunction)(target) || (0, _lodash.isFunction)(source)) {
|
|
30
|
+
if (source === void 0) {
|
|
31
|
+
return target;
|
|
20
32
|
}
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
return target;
|
|
24
|
-
}
|
|
25
|
-
if (target === undefined) {
|
|
26
|
-
return source;
|
|
27
|
-
}
|
|
28
|
-
return [target, source];
|
|
33
|
+
if (target === void 0) {
|
|
34
|
+
return source;
|
|
29
35
|
}
|
|
30
|
-
return
|
|
36
|
+
return [
|
|
37
|
+
target,
|
|
38
|
+
source
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
return void 0;
|
|
31
42
|
});
|
|
32
|
-
exports.mergeConfig = mergeConfig;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { UserConfig } from '../types';
|
|
2
2
|
export declare const deepGet: (obj: any, key: string) => any;
|
|
3
|
-
export declare const repeatKeyWarning: <E extends Record<string, any>>(schema: any, jsConfig: UserConfig<E>, pkgConfig: UserConfig<E>) => void;
|
|
3
|
+
export declare const repeatKeyWarning: <E extends Record<string, any>>(schema: any, jsConfig: UserConfig<E>, pkgConfig: UserConfig<E>) => void;
|
|
@@ -1,22 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
deepGet: function() {
|
|
14
|
+
return deepGet;
|
|
15
|
+
},
|
|
16
|
+
repeatKeyWarning: function() {
|
|
17
|
+
return repeatKeyWarning;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
const _traverseSchema = require("../schema/traverseSchema");
|
|
5
21
|
const deepGet = (obj, key) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return obj;
|
|
22
|
+
for (const p of key.split(".")) {
|
|
23
|
+
obj = obj ? obj[p] : void 0;
|
|
24
|
+
}
|
|
25
|
+
return obj;
|
|
11
26
|
};
|
|
12
|
-
exports.deepGet = deepGet;
|
|
13
27
|
const repeatKeyWarning = (schema, jsConfig, pkgConfig) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
28
|
+
const keys = (0, _traverseSchema.traverseSchema)(schema);
|
|
29
|
+
for (const key of keys) {
|
|
30
|
+
if (deepGet(jsConfig, key) !== void 0 && deepGet(pkgConfig, key) !== void 0) {
|
|
31
|
+
throw new Error(`The same configuration ${key} exists in modern.config.js and package.json.
|
|
32
|
+
Please remove it from package.json.`);
|
|
20
33
|
}
|
|
34
|
+
}
|
|
21
35
|
};
|
|
22
|
-
exports.repeatKeyWarning = repeatKeyWarning;
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"modern",
|
|
15
15
|
"modern.js"
|
|
16
16
|
],
|
|
17
|
-
"version": "2.
|
|
17
|
+
"version": "2.28.0",
|
|
18
18
|
"jsnext:source": "./src/index.ts",
|
|
19
19
|
"types": "./dist/index.d.ts",
|
|
20
20
|
"main": "./dist/index.js",
|
|
@@ -69,9 +69,10 @@
|
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@
|
|
73
|
-
"@modern-js/
|
|
74
|
-
"@modern-js/
|
|
72
|
+
"@swc/helpers": "0.5.1",
|
|
73
|
+
"@modern-js/node-bundle-require": "2.28.0",
|
|
74
|
+
"@modern-js/plugin": "2.28.0",
|
|
75
|
+
"@modern-js/utils": "2.28.0"
|
|
75
76
|
},
|
|
76
77
|
"devDependencies": {
|
|
77
78
|
"@types/jest": "^29",
|
|
@@ -79,10 +80,10 @@
|
|
|
79
80
|
"tsm": "2.3.0",
|
|
80
81
|
"jest": "^29",
|
|
81
82
|
"typescript": "^5",
|
|
82
|
-
"@modern-js/builder-shared": "2.
|
|
83
|
-
"@modern-js/types": "2.
|
|
84
|
-
"@scripts/build": "2.
|
|
85
|
-
"@scripts/jest-config": "2.
|
|
83
|
+
"@modern-js/builder-shared": "2.28.0",
|
|
84
|
+
"@modern-js/types": "2.28.0",
|
|
85
|
+
"@scripts/build": "2.28.0",
|
|
86
|
+
"@scripts/jest-config": "2.28.0"
|
|
86
87
|
},
|
|
87
88
|
"sideEffects": false,
|
|
88
89
|
"publishConfig": {
|
|
@@ -92,8 +93,8 @@
|
|
|
92
93
|
},
|
|
93
94
|
"scripts": {
|
|
94
95
|
"new": "modern-lib new",
|
|
95
|
-
"build": "
|
|
96
|
-
"dev": "
|
|
96
|
+
"build": "modern-lib build",
|
|
97
|
+
"dev": "modern-lib build --watch",
|
|
97
98
|
"test": "jest"
|
|
98
99
|
}
|
|
99
100
|
}
|