nx 21.0.0-canary.20250501-8f50358 → 21.0.0-canary.20250502-110614d
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/package.json +14 -11
- package/src/command-line/format/command-object.js +1 -1
- package/src/command-line/nx-commands.d.ts +1 -1
- package/src/command-line/nx-commands.js +1 -1
- package/src/command-line/report/report.js +1 -29
- package/src/command-line/yargs-utils/shared-options.js +27 -14
- package/src/core/graph/main.js +1 -1
- package/src/daemon/server/watcher.js +0 -6
- package/src/executors/run-commands/running-tasks.d.ts +2 -2
- package/src/executors/run-commands/running-tasks.js +15 -5
- package/src/generators/utils/nx-json.d.ts +1 -2
- package/src/generators/utils/nx-json.js +6 -12
- package/src/native/index.d.ts +3 -3
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/tasks-runner/forked-process-task-runner.js +1 -0
- package/src/tasks-runner/is-tui-enabled.js +13 -7
- package/src/tasks-runner/pseudo-terminal.d.ts +4 -3
- package/src/tasks-runner/pseudo-terminal.js +9 -9
- package/src/tasks-runner/running-tasks/batch-process.d.ts +1 -1
- package/src/tasks-runner/running-tasks/node-child-process.d.ts +2 -2
- package/src/tasks-runner/running-tasks/running-task.d.ts +1 -1
- package/src/utils/ignore.d.ts +0 -6
- package/src/utils/ignore.js +0 -63
- package/src/utils/params.js +22 -16
@@ -5,16 +5,10 @@ exports.watchOutputFiles = watchOutputFiles;
|
|
5
5
|
exports.convertChangeEventsToLogMessage = convertChangeEventsToLogMessage;
|
6
6
|
const workspace_root_1 = require("../../utils/workspace-root");
|
7
7
|
const path_1 = require("path");
|
8
|
-
const socket_utils_1 = require("../socket-utils");
|
9
8
|
const shutdown_utils_1 = require("./shutdown-utils");
|
10
9
|
const path_2 = require("../../utils/path");
|
11
|
-
const ignore_1 = require("../../utils/ignore");
|
12
10
|
const cache_1 = require("../cache");
|
13
11
|
const server_1 = require("./server");
|
14
|
-
const ALWAYS_IGNORE = [
|
15
|
-
...(0, ignore_1.getAlwaysIgnore)(workspace_root_1.workspaceRoot),
|
16
|
-
(0, socket_utils_1.getFullOsSocketPath)(),
|
17
|
-
];
|
18
12
|
async function watchWorkspace(server, cb) {
|
19
13
|
const { Watcher } = await Promise.resolve().then(() => require('../../native'));
|
20
14
|
const watcher = new Watcher(workspace_root_1.workspaceRoot);
|
@@ -17,7 +17,7 @@ export declare class ParallelRunningTasks implements RunningTask {
|
|
17
17
|
onOutput(cb: (terminalOutput: string) => void): void;
|
18
18
|
onExit(cb: (code: number, terminalOutput: string) => void): void;
|
19
19
|
send(message: Serializable): void;
|
20
|
-
kill(signal?: NodeJS.Signals
|
20
|
+
kill(signal?: NodeJS.Signals): Promise<void>;
|
21
21
|
private run;
|
22
22
|
}
|
23
23
|
export declare class SeriallyRunningTasks implements RunningTask {
|
@@ -36,7 +36,7 @@ export declare class SeriallyRunningTasks implements RunningTask {
|
|
36
36
|
onExit(cb: (code: number, terminalOutput: string) => void): void;
|
37
37
|
onOutput(cb: (terminalOutput: string) => void): void;
|
38
38
|
send(message: Serializable): void;
|
39
|
-
kill(signal?: NodeJS.Signals
|
39
|
+
kill(signal?: NodeJS.Signals): void | Promise<void>;
|
40
40
|
private run;
|
41
41
|
private createProcess;
|
42
42
|
}
|
@@ -231,14 +231,24 @@ class RunningNodeProcess {
|
|
231
231
|
}
|
232
232
|
kill(signal) {
|
233
233
|
return new Promise((res, rej) => {
|
234
|
-
|
235
|
-
if (
|
236
|
-
|
234
|
+
if (process.platform === 'win32' || process.platform === 'darwin') {
|
235
|
+
if (this.childProcess.kill(signal)) {
|
236
|
+
res();
|
237
237
|
}
|
238
238
|
else {
|
239
|
-
|
239
|
+
rej('Unable to kill process');
|
240
240
|
}
|
241
|
-
}
|
241
|
+
}
|
242
|
+
else {
|
243
|
+
treeKill(this.childProcess.pid, signal, (err) => {
|
244
|
+
if (err) {
|
245
|
+
rej(err);
|
246
|
+
}
|
247
|
+
else {
|
248
|
+
res();
|
249
|
+
}
|
250
|
+
});
|
251
|
+
}
|
242
252
|
});
|
243
253
|
}
|
244
254
|
triggerOutputListeners(output) {
|
@@ -1,9 +1,8 @@
|
|
1
1
|
import type { NxJsonConfiguration } from '../../config/nx-json';
|
2
2
|
import type { Tree } from '../tree';
|
3
3
|
/**
|
4
|
-
*
|
4
|
+
* Reads nx.json
|
5
5
|
*/
|
6
|
-
export declare function readNxJson(): NxJsonConfiguration | null;
|
7
6
|
export declare function readNxJson(tree: Tree): NxJsonConfiguration | null;
|
8
7
|
/**
|
9
8
|
* Update nx.json
|
@@ -4,24 +4,18 @@ exports.readNxJson = readNxJson;
|
|
4
4
|
exports.updateNxJson = updateNxJson;
|
5
5
|
const path_1 = require("path");
|
6
6
|
const json_1 = require("./json");
|
7
|
-
const nx_json_1 = require("../../config/nx-json");
|
8
7
|
/**
|
9
8
|
* Reads nx.json
|
10
9
|
*/
|
11
10
|
function readNxJson(tree) {
|
12
|
-
if (tree) {
|
13
|
-
|
14
|
-
return null;
|
15
|
-
}
|
16
|
-
let nxJson = (0, json_1.readJson)(tree, 'nx.json');
|
17
|
-
if (nxJson.extends) {
|
18
|
-
nxJson = { ...readNxJsonExtends(tree, nxJson.extends), ...nxJson };
|
19
|
-
}
|
20
|
-
return nxJson;
|
11
|
+
if (!tree.exists('nx.json')) {
|
12
|
+
return null;
|
21
13
|
}
|
22
|
-
|
23
|
-
|
14
|
+
let nxJson = (0, json_1.readJson)(tree, 'nx.json');
|
15
|
+
if (nxJson.extends) {
|
16
|
+
nxJson = { ...readNxJsonExtends(tree, nxJson.extends), ...nxJson };
|
24
17
|
}
|
18
|
+
return nxJson;
|
25
19
|
}
|
26
20
|
/**
|
27
21
|
* Update nx.json
|
package/src/native/index.d.ts
CHANGED
@@ -26,7 +26,7 @@ export declare class AppLifeCycle {
|
|
26
26
|
|
27
27
|
export declare class ChildProcess {
|
28
28
|
getParserAndWriter(): ExternalObject<[ParserArc, WriterArc]>
|
29
|
-
kill(): void
|
29
|
+
kill(signal?: NodeJS.Signals): void
|
30
30
|
onExit(callback: (message: string) => void): void
|
31
31
|
onOutput(callback: (message: string) => void): void
|
32
32
|
cleanup(): void
|
@@ -89,12 +89,12 @@ export declare class RunningTasksService {
|
|
89
89
|
|
90
90
|
export declare class RustPseudoTerminal {
|
91
91
|
constructor()
|
92
|
-
runCommand(command: string, commandDir?: string | undefined | null, jsEnv?: Record<string, string> | undefined | null, execArgv?: Array<string> | undefined | null, quiet?: boolean | undefined | null, tty?: boolean | undefined | null): ChildProcess
|
92
|
+
runCommand(command: string, commandDir?: string | undefined | null, jsEnv?: Record<string, string> | undefined | null, execArgv?: Array<string> | undefined | null, quiet?: boolean | undefined | null, tty?: boolean | undefined | null, commandLabel?: string | undefined | null): ChildProcess
|
93
93
|
/**
|
94
94
|
* This allows us to run a pseudoterminal with a fake node ipc channel
|
95
95
|
* this makes it possible to be backwards compatible with the old implementation
|
96
96
|
*/
|
97
|
-
fork(id: string, forkScript: string, pseudoIpcPath: string, commandDir: string | undefined | null, jsEnv: Record<string, string> | undefined | null, execArgv: Array<string> | undefined | null, quiet: boolean): ChildProcess
|
97
|
+
fork(id: string, forkScript: string, pseudoIpcPath: string, commandDir: string | undefined | null, jsEnv: Record<string, string> | undefined | null, execArgv: Array<string> | undefined | null, quiet: boolean, commandLabel?: string | undefined | null): ChildProcess
|
98
98
|
}
|
99
99
|
|
100
100
|
export declare class TaskDetails {
|
Binary file
|
@@ -28,14 +28,23 @@ function shouldUseTui(nxJson, nxArgs, skipCapabilityCheck = process.env.NX_TUI_S
|
|
28
28
|
if (!isCapable) {
|
29
29
|
return false;
|
30
30
|
}
|
31
|
-
// The environment variable takes precedence over the nx.json config
|
32
|
-
if (typeof process.env.NX_TUI === 'string') {
|
33
|
-
return process.env.NX_TUI === 'true';
|
34
|
-
}
|
35
31
|
if (['static', 'stream', 'dynamic-legacy'].includes(nxArgs.outputStyle)) {
|
36
32
|
// If the user has specified a non-TUI output style, we disable the TUI
|
37
33
|
return false;
|
38
34
|
}
|
35
|
+
if (nxArgs.outputStyle === 'dynamic' || nxArgs.outputStyle === 'tui') {
|
36
|
+
return true;
|
37
|
+
}
|
38
|
+
// The environment variable takes precedence over the nx.json config, but
|
39
|
+
// are lower priority than the CLI args as they are less likely to change
|
40
|
+
// between runs, whereas the CLI args are specified by the user for each run.
|
41
|
+
if (typeof process.env.NX_TUI === 'string') {
|
42
|
+
return process.env.NX_TUI === 'true';
|
43
|
+
}
|
44
|
+
// BELOW THIS LINE ARE "repo specific" checks, instead of "user specific" checks.
|
45
|
+
// "user specific" checks are specified by the current user rather than the repo
|
46
|
+
// settings which are applied for all users of the repo... so they are more specific
|
47
|
+
// and take priority.
|
39
48
|
if (
|
40
49
|
// Interactive TUI doesn't make sense on CI
|
41
50
|
(0, is_ci_1.isCI)() ||
|
@@ -46,9 +55,6 @@ function shouldUseTui(nxJson, nxArgs, skipCapabilityCheck = process.env.NX_TUI_S
|
|
46
55
|
native_1.IS_WASM) {
|
47
56
|
return false;
|
48
57
|
}
|
49
|
-
if (nxArgs.outputStyle === 'dynamic' || nxArgs.outputStyle === 'tui') {
|
50
|
-
return true;
|
51
|
-
}
|
52
58
|
// Respect user config
|
53
59
|
if (typeof nxJson.tui?.enabled === 'boolean') {
|
54
60
|
return Boolean(nxJson.tui?.enabled);
|
@@ -12,7 +12,7 @@ export declare class PseudoTerminal {
|
|
12
12
|
static isSupported(): boolean;
|
13
13
|
constructor(rustPseudoTerminal: RustPseudoTerminal);
|
14
14
|
init(): Promise<void>;
|
15
|
-
shutdown(): void;
|
15
|
+
shutdown(s?: NodeJS.Signals): void;
|
16
16
|
runCommand(command: string, { cwd, execArgv, jsEnv, quiet, tty, }?: {
|
17
17
|
cwd?: string;
|
18
18
|
execArgv?: string[];
|
@@ -20,11 +20,12 @@ export declare class PseudoTerminal {
|
|
20
20
|
quiet?: boolean;
|
21
21
|
tty?: boolean;
|
22
22
|
}): PseudoTtyProcess;
|
23
|
-
fork(id: string, script: string, { cwd, execArgv, jsEnv, quiet, }: {
|
23
|
+
fork(id: string, script: string, { cwd, execArgv, jsEnv, quiet, commandLabel, }: {
|
24
24
|
cwd?: string;
|
25
25
|
execArgv?: string[];
|
26
26
|
jsEnv?: Record<string, string>;
|
27
27
|
quiet?: boolean;
|
28
|
+
commandLabel?: string;
|
28
29
|
}): Promise<PseudoTtyProcessWithSend>;
|
29
30
|
sendMessageToChildren(message: Serializable): void;
|
30
31
|
onMessageFromChildren(callback: (message: Serializable) => void): void;
|
@@ -43,7 +44,7 @@ export declare class PseudoTtyProcess implements RunningTask {
|
|
43
44
|
}>;
|
44
45
|
onExit(callback: (code: number) => void): void;
|
45
46
|
onOutput(callback: (message: string) => void): void;
|
46
|
-
kill(): void;
|
47
|
+
kill(s?: NodeJS.Signals): void;
|
47
48
|
getParserAndWriter(): import("../native").ExternalObject<[ParserArc, WriterArc]>;
|
48
49
|
}
|
49
50
|
export declare class PseudoTtyProcessWithSend extends PseudoTtyProcess {
|
@@ -9,13 +9,13 @@ const pseudo_ipc_1 = require("./pseudo-ipc");
|
|
9
9
|
// Register single event listeners for all pseudo-terminal instances
|
10
10
|
const pseudoTerminalShutdownCallbacks = [];
|
11
11
|
process.on('SIGINT', () => {
|
12
|
-
pseudoTerminalShutdownCallbacks.forEach((cb) => cb());
|
12
|
+
pseudoTerminalShutdownCallbacks.forEach((cb) => cb('SIGINT'));
|
13
13
|
});
|
14
14
|
process.on('SIGTERM', () => {
|
15
|
-
pseudoTerminalShutdownCallbacks.forEach((cb) => cb());
|
15
|
+
pseudoTerminalShutdownCallbacks.forEach((cb) => cb('SIGTERM'));
|
16
16
|
});
|
17
17
|
process.on('SIGHUP', () => {
|
18
|
-
pseudoTerminalShutdownCallbacks.forEach((cb) => cb());
|
18
|
+
pseudoTerminalShutdownCallbacks.forEach((cb) => cb('SIGHUP'));
|
19
19
|
});
|
20
20
|
process.on('exit', () => {
|
21
21
|
pseudoTerminalShutdownCallbacks.forEach((cb) => cb());
|
@@ -47,10 +47,10 @@ class PseudoTerminal {
|
|
47
47
|
await this.pseudoIPC.init();
|
48
48
|
this.initialized = true;
|
49
49
|
}
|
50
|
-
shutdown() {
|
50
|
+
shutdown(s) {
|
51
51
|
for (const cp of this.childProcesses) {
|
52
52
|
try {
|
53
|
-
cp.kill();
|
53
|
+
cp.kill(s);
|
54
54
|
}
|
55
55
|
catch { }
|
56
56
|
}
|
@@ -63,11 +63,11 @@ class PseudoTerminal {
|
|
63
63
|
this.childProcesses.add(cp);
|
64
64
|
return cp;
|
65
65
|
}
|
66
|
-
async fork(id, script, { cwd, execArgv, jsEnv, quiet, }) {
|
66
|
+
async fork(id, script, { cwd, execArgv, jsEnv, quiet, commandLabel, }) {
|
67
67
|
if (!this.initialized) {
|
68
68
|
throw new Error('Call init() before forking processes');
|
69
69
|
}
|
70
|
-
const cp = new PseudoTtyProcessWithSend(this.rustPseudoTerminal, this.rustPseudoTerminal.fork(id, script, this.pseudoIPCPath, cwd, jsEnv, execArgv, quiet), id, this.pseudoIPC);
|
70
|
+
const cp = new PseudoTtyProcessWithSend(this.rustPseudoTerminal, this.rustPseudoTerminal.fork(id, script, this.pseudoIPCPath, cwd, jsEnv, execArgv, quiet, commandLabel), id, this.pseudoIPC);
|
71
71
|
this.childProcesses.add(cp);
|
72
72
|
await this.pseudoIPC.waitForChildReady(id);
|
73
73
|
return cp;
|
@@ -112,10 +112,10 @@ class PseudoTtyProcess {
|
|
112
112
|
onOutput(callback) {
|
113
113
|
this.outputCallbacks.push(callback);
|
114
114
|
}
|
115
|
-
kill() {
|
115
|
+
kill(s) {
|
116
116
|
if (this.isAlive) {
|
117
117
|
try {
|
118
|
-
this.childProcess.kill();
|
118
|
+
this.childProcess.kill(s);
|
119
119
|
}
|
120
120
|
catch {
|
121
121
|
// when the child process completes before we explicitly call kill, this will throw
|
@@ -15,7 +15,7 @@ export declare class NodeChildProcessWithNonDirectOutput implements RunningTask
|
|
15
15
|
terminalOutput: string;
|
16
16
|
}>;
|
17
17
|
send(message: Serializable): void;
|
18
|
-
kill(signal?: NodeJS.Signals
|
18
|
+
kill(signal?: NodeJS.Signals): void;
|
19
19
|
}
|
20
20
|
export declare class NodeChildProcessWithDirectOutput implements RunningTask {
|
21
21
|
private childProcess;
|
@@ -33,5 +33,5 @@ export declare class NodeChildProcessWithDirectOutput implements RunningTask {
|
|
33
33
|
}>;
|
34
34
|
waitForExit(): Promise<void>;
|
35
35
|
getTerminalOutput(): string;
|
36
|
-
kill(signal?: NodeJS.Signals
|
36
|
+
kill(signal?: NodeJS.Signals): void;
|
37
37
|
}
|
@@ -5,7 +5,7 @@ export declare abstract class RunningTask {
|
|
5
5
|
terminalOutput: string;
|
6
6
|
}>;
|
7
7
|
abstract onExit(cb: (code: number) => void): void;
|
8
|
-
abstract kill(signal?: NodeJS.Signals
|
8
|
+
abstract kill(signal?: NodeJS.Signals): Promise<void> | void;
|
9
9
|
abstract onOutput?(cb: (output: string) => void): void;
|
10
10
|
abstract send?(message: Serializable): void;
|
11
11
|
}
|
package/src/utils/ignore.d.ts
CHANGED
@@ -1,8 +1,2 @@
|
|
1
1
|
import ignore from 'ignore';
|
2
|
-
/**
|
3
|
-
* An array of glob patterns that should always be ignored.
|
4
|
-
*/
|
5
|
-
export declare const ALWAYS_IGNORE: string[];
|
6
|
-
export declare function getIgnoredGlobs(root?: string, prependRoot?: boolean): string[];
|
7
|
-
export declare function getAlwaysIgnore(root?: string): string[];
|
8
2
|
export declare function getIgnoreObject(root?: string): ReturnType<typeof ignore>;
|
package/src/utils/ignore.js
CHANGED
@@ -1,75 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.ALWAYS_IGNORE = void 0;
|
4
|
-
exports.getIgnoredGlobs = getIgnoredGlobs;
|
5
|
-
exports.getAlwaysIgnore = getAlwaysIgnore;
|
6
3
|
exports.getIgnoreObject = getIgnoreObject;
|
7
|
-
const node_fs_1 = require("node:fs");
|
8
4
|
const ignore_1 = require("ignore");
|
9
5
|
const fileutils_1 = require("./fileutils");
|
10
|
-
const path_1 = require("./path");
|
11
6
|
const workspace_root_1 = require("./workspace-root");
|
12
|
-
/**
|
13
|
-
* An array of glob patterns that should always be ignored.
|
14
|
-
*/
|
15
|
-
exports.ALWAYS_IGNORE = getAlwaysIgnore();
|
16
|
-
function getIgnoredGlobs(root = workspace_root_1.workspaceRoot, prependRoot = true) {
|
17
|
-
const files = ['.gitignore', '.nxignore'];
|
18
|
-
if (prependRoot) {
|
19
|
-
return [
|
20
|
-
...getAlwaysIgnore(root),
|
21
|
-
...files.flatMap((f) => getIgnoredGlobsFromFile((0, path_1.joinPathFragments)(root, f), root)),
|
22
|
-
];
|
23
|
-
}
|
24
|
-
else {
|
25
|
-
return [
|
26
|
-
...getAlwaysIgnore(),
|
27
|
-
...files.flatMap((f) => getIgnoredGlobsFromFile((0, path_1.joinPathFragments)(root, f))),
|
28
|
-
];
|
29
|
-
}
|
30
|
-
}
|
31
|
-
function getAlwaysIgnore(root) {
|
32
|
-
const paths = [
|
33
|
-
'node_modules',
|
34
|
-
'**/node_modules',
|
35
|
-
'.git',
|
36
|
-
'.nx',
|
37
|
-
'.vscode',
|
38
|
-
'.yarn/cache',
|
39
|
-
];
|
40
|
-
return root ? paths.map((x) => (0, path_1.joinPathFragments)(root, x)) : paths;
|
41
|
-
}
|
42
7
|
function getIgnoreObject(root = workspace_root_1.workspaceRoot) {
|
43
8
|
const ig = (0, ignore_1.default)();
|
44
9
|
ig.add((0, fileutils_1.readFileIfExisting)(`${root}/.gitignore`));
|
45
10
|
ig.add((0, fileutils_1.readFileIfExisting)(`${root}/.nxignore`));
|
46
11
|
return ig;
|
47
12
|
}
|
48
|
-
function getIgnoredGlobsFromFile(file, root) {
|
49
|
-
try {
|
50
|
-
const results = [];
|
51
|
-
const contents = (0, node_fs_1.readFileSync)(file, 'utf-8');
|
52
|
-
const lines = contents.split('\n');
|
53
|
-
for (const line of lines) {
|
54
|
-
const trimmed = line.trim();
|
55
|
-
if (!trimmed || trimmed.startsWith('#')) {
|
56
|
-
continue;
|
57
|
-
}
|
58
|
-
else if (trimmed.startsWith('/')) {
|
59
|
-
if (root) {
|
60
|
-
results.push((0, path_1.joinPathFragments)(root, trimmed));
|
61
|
-
}
|
62
|
-
else {
|
63
|
-
results.push((0, path_1.joinPathFragments)('.', trimmed));
|
64
|
-
}
|
65
|
-
}
|
66
|
-
else {
|
67
|
-
results.push(trimmed);
|
68
|
-
}
|
69
|
-
}
|
70
|
-
return results;
|
71
|
-
}
|
72
|
-
catch (e) {
|
73
|
-
return [];
|
74
|
-
}
|
75
|
-
}
|
package/src/utils/params.js
CHANGED
@@ -349,15 +349,11 @@ function setDefaultsInObject(opts, properties, definitions) {
|
|
349
349
|
});
|
350
350
|
}
|
351
351
|
function setPropertyDefault(opts, propName, schema, definitions) {
|
352
|
+
let defaultValueToSet;
|
352
353
|
if (schema.$ref) {
|
353
354
|
schema = resolveDefinition(schema.$ref, definitions);
|
354
355
|
}
|
355
|
-
if (schema.type
|
356
|
-
if (opts[propName] === undefined && schema.default !== undefined) {
|
357
|
-
opts[propName] = schema.default;
|
358
|
-
}
|
359
|
-
}
|
360
|
-
else if (schema.type === 'array') {
|
356
|
+
if (schema.type === 'array') {
|
361
357
|
const items = schema.items || {};
|
362
358
|
if (opts[propName] &&
|
363
359
|
Array.isArray(opts[propName]) &&
|
@@ -365,19 +361,29 @@ function setPropertyDefault(opts, propName, schema, definitions) {
|
|
365
361
|
opts[propName].forEach((valueInArray) => setDefaultsInObject(valueInArray, items.properties || {}, definitions));
|
366
362
|
}
|
367
363
|
else if (!opts[propName] && schema.default) {
|
368
|
-
|
364
|
+
defaultValueToSet = schema.default;
|
369
365
|
}
|
370
366
|
}
|
371
367
|
else {
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
368
|
+
if (opts[propName] === undefined && schema.default !== undefined) {
|
369
|
+
defaultValueToSet = schema.default;
|
370
|
+
}
|
371
|
+
if (schema.type === 'object') {
|
372
|
+
const wasUndefined = opts[propName] === undefined;
|
373
|
+
if (!wasUndefined) {
|
374
|
+
setDefaultsInObject(opts[propName], schema.properties || {}, definitions);
|
375
|
+
}
|
376
|
+
}
|
377
|
+
}
|
378
|
+
if (defaultValueToSet !== undefined) {
|
379
|
+
try {
|
380
|
+
validateProperty(propName, defaultValueToSet, schema, definitions);
|
381
|
+
opts[propName] = defaultValueToSet;
|
382
|
+
}
|
383
|
+
catch (e) {
|
384
|
+
// If the default value is invalid, we don't set it...
|
385
|
+
// this should honestly never be needed... but some notable
|
386
|
+
// 3rd party schema's are invalid.
|
381
387
|
}
|
382
388
|
}
|
383
389
|
}
|