@angular-devkit/core 12.1.0-next.3 → 12.1.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/node/BUILD.bazel +0 -2
- package/node/experimental/index.js +20 -1
- package/node/host.js +2 -2
- package/node/index.js +14 -2
- package/node/testing/index.js +22 -3
- package/package.json +3 -3
- package/src/experimental.js +20 -1
- package/src/index.js +17 -5
- package/src/json/index.js +13 -1
- package/src/json/schema/index.js +13 -1
- package/src/json/schema/interface.d.ts +1 -1
- package/src/json/schema/registry.d.ts +1 -0
- package/src/json/schema/registry.js +76 -20
- package/src/utils/index.js +14 -2
- package/src/virtual-fs/index.js +13 -1
- package/src/workspace/json/writer.js +4 -1
package/node/BUILD.bazel
CHANGED
|
@@ -6,7 +6,26 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.jobs = void 0;
|
|
11
|
-
const jobs = require("./jobs");
|
|
30
|
+
const jobs = __importStar(require("./jobs"));
|
|
12
31
|
exports.jobs = jobs;
|
package/node/host.js
CHANGED
|
@@ -50,7 +50,7 @@ class NodeJsAsyncHost {
|
|
|
50
50
|
return { synchronous: false };
|
|
51
51
|
}
|
|
52
52
|
write(path, content) {
|
|
53
|
-
return rxjs_1.from(fs_1.promises.mkdir(src_1.getSystemPath(src_1.dirname(path)), { recursive: true })).pipe(operators_1.mergeMap(() => fs_1.promises.writeFile(src_1.getSystemPath(path), content)));
|
|
53
|
+
return rxjs_1.from(fs_1.promises.mkdir(src_1.getSystemPath(src_1.dirname(path)), { recursive: true })).pipe(operators_1.mergeMap(() => fs_1.promises.writeFile(src_1.getSystemPath(path), new Uint8Array(content))));
|
|
54
54
|
}
|
|
55
55
|
read(path) {
|
|
56
56
|
return rxjs_1.from(fs_1.promises.readFile(src_1.getSystemPath(path))).pipe(operators_1.map((buffer) => new Uint8Array(buffer).buffer));
|
|
@@ -85,7 +85,7 @@ class NodeJsAsyncHost {
|
|
|
85
85
|
return rxjs_1.from(fs_1.promises.readdir(src_1.getSystemPath(path))).pipe(operators_1.map((names) => names.map((name) => src_1.fragment(name))));
|
|
86
86
|
}
|
|
87
87
|
exists(path) {
|
|
88
|
-
return rxjs_1.from(exists(path));
|
|
88
|
+
return rxjs_1.from(exists(src_1.getSystemPath(path)));
|
|
89
89
|
}
|
|
90
90
|
isDirectory(path) {
|
|
91
91
|
return this.stat(path).pipe(operators_1.map((stat) => stat.isDirectory()));
|
package/node/index.js
CHANGED
|
@@ -13,14 +13,26 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
if (k2 === undefined) k2 = k;
|
|
14
14
|
o[k2] = m[k];
|
|
15
15
|
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
16
28
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
29
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
30
|
};
|
|
19
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
32
|
exports.fs = exports.experimental = void 0;
|
|
21
|
-
const experimental = require("./experimental/jobs/job-registry");
|
|
33
|
+
const experimental = __importStar(require("./experimental/jobs/job-registry"));
|
|
22
34
|
exports.experimental = experimental;
|
|
23
|
-
const fs = require("./fs");
|
|
35
|
+
const fs = __importStar(require("./fs"));
|
|
24
36
|
exports.fs = fs;
|
|
25
37
|
__exportStar(require("./cli-logger"), exports);
|
|
26
38
|
__exportStar(require("./host"), exports);
|
package/node/testing/index.js
CHANGED
|
@@ -6,11 +6,30 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.TempScopedNodeJsSyncHost = void 0;
|
|
11
|
-
const fs = require("fs");
|
|
12
|
-
const os = require("os");
|
|
13
|
-
const path = require("path");
|
|
30
|
+
const fs = __importStar(require("fs"));
|
|
31
|
+
const os = __importStar(require("os"));
|
|
32
|
+
const path = __importStar(require("path"));
|
|
14
33
|
const src_1 = require("../../src");
|
|
15
34
|
const host_1 = require("../host");
|
|
16
35
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/core",
|
|
3
|
-
"version": "12.1.0
|
|
3
|
+
"version": "12.1.0",
|
|
4
4
|
"description": "Angular DevKit - Core Utility Library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"typings": "src/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"core"
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"ajv": "8.
|
|
16
|
+
"ajv": "8.6.0",
|
|
17
17
|
"ajv-formats": "2.1.0",
|
|
18
18
|
"fast-json-stable-stringify": "2.1.0",
|
|
19
19
|
"magic-string": "0.25.7",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"url": "https://github.com/angular/angular-cli.git"
|
|
26
26
|
},
|
|
27
27
|
"engines": {
|
|
28
|
-
"node": "^12.14.1 ||
|
|
28
|
+
"node": "^12.14.1 || >=14.0.0",
|
|
29
29
|
"npm": "^6.11.0 || ^7.5.6",
|
|
30
30
|
"yarn": ">= 1.13.0"
|
|
31
31
|
},
|
package/src/experimental.js
CHANGED
|
@@ -6,7 +6,26 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.jobs = void 0;
|
|
11
|
-
const jobs = require("./experimental/jobs/index");
|
|
30
|
+
const jobs = __importStar(require("./experimental/jobs/index"));
|
|
12
31
|
exports.jobs = jobs;
|
package/src/index.js
CHANGED
|
@@ -13,20 +13,32 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
if (k2 === undefined) k2 = k;
|
|
14
14
|
o[k2] = m[k];
|
|
15
15
|
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
16
28
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
29
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
30
|
};
|
|
19
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
32
|
exports.workspaces = exports.logging = exports.json = exports.experimental = exports.analytics = void 0;
|
|
21
|
-
const analytics = require("./analytics");
|
|
33
|
+
const analytics = __importStar(require("./analytics"));
|
|
22
34
|
exports.analytics = analytics;
|
|
23
|
-
const experimental = require("./experimental");
|
|
35
|
+
const experimental = __importStar(require("./experimental"));
|
|
24
36
|
exports.experimental = experimental;
|
|
25
|
-
const json = require("./json/index");
|
|
37
|
+
const json = __importStar(require("./json/index"));
|
|
26
38
|
exports.json = json;
|
|
27
|
-
const logging = require("./logger/index");
|
|
39
|
+
const logging = __importStar(require("./logger/index"));
|
|
28
40
|
exports.logging = logging;
|
|
29
|
-
const workspaces = require("./workspace");
|
|
41
|
+
const workspaces = __importStar(require("./workspace"));
|
|
30
42
|
exports.workspaces = workspaces;
|
|
31
43
|
__exportStar(require("./exception/exception"), exports);
|
|
32
44
|
__exportStar(require("./json/index"), exports);
|
package/src/json/index.js
CHANGED
|
@@ -13,12 +13,24 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
if (k2 === undefined) k2 = k;
|
|
14
14
|
o[k2] = m[k];
|
|
15
15
|
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
16
28
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
29
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
30
|
};
|
|
19
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
32
|
exports.schema = void 0;
|
|
21
|
-
const schema = require("./schema/index");
|
|
33
|
+
const schema = __importStar(require("./schema/index"));
|
|
22
34
|
exports.schema = schema;
|
|
23
35
|
__exportStar(require("./interface"), exports);
|
|
24
36
|
__exportStar(require("./parser"), exports);
|
package/src/json/schema/index.js
CHANGED
|
@@ -13,12 +13,24 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
if (k2 === undefined) k2 = k;
|
|
14
14
|
o[k2] = m[k];
|
|
15
15
|
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
16
28
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
29
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
30
|
};
|
|
19
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
32
|
exports.transforms = void 0;
|
|
21
|
-
const transforms = require("./transforms");
|
|
33
|
+
const transforms = __importStar(require("./transforms"));
|
|
22
34
|
exports.transforms = transforms;
|
|
23
35
|
__exportStar(require("./interface"), exports);
|
|
24
36
|
__exportStar(require("./pointer"), exports);
|
|
@@ -16,7 +16,7 @@ export interface SchemaValidatorResult {
|
|
|
16
16
|
success: boolean;
|
|
17
17
|
errors?: SchemaValidatorError[];
|
|
18
18
|
}
|
|
19
|
-
export declare type SchemaValidatorError = ErrorObject
|
|
19
|
+
export declare type SchemaValidatorError = Partial<ErrorObject>;
|
|
20
20
|
export interface SchemaValidatorOptions {
|
|
21
21
|
applyPreTransforms?: boolean;
|
|
22
22
|
applyPostTransforms?: boolean;
|
|
@@ -6,15 +6,37 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
9
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
32
|
exports.CoreSchemaRegistry = exports.SchemaValidationException = void 0;
|
|
11
|
-
const ajv_1 = require("ajv");
|
|
12
|
-
const ajv_formats_1 = require("ajv-formats");
|
|
13
|
-
const http = require("http");
|
|
14
|
-
const https = require("https");
|
|
33
|
+
const ajv_1 = __importDefault(require("ajv"));
|
|
34
|
+
const ajv_formats_1 = __importDefault(require("ajv-formats"));
|
|
35
|
+
const http = __importStar(require("http"));
|
|
36
|
+
const https = __importStar(require("https"));
|
|
15
37
|
const rxjs_1 = require("rxjs");
|
|
16
38
|
const operators_1 = require("rxjs/operators");
|
|
17
|
-
const Url = require("url");
|
|
39
|
+
const Url = __importStar(require("url"));
|
|
18
40
|
const exception_1 = require("../../exception/exception");
|
|
19
41
|
const utils_1 = require("../../utils");
|
|
20
42
|
const interface_1 = require("../interface");
|
|
@@ -36,9 +58,17 @@ class SchemaValidationException extends exception_1.BaseException {
|
|
|
36
58
|
return [];
|
|
37
59
|
}
|
|
38
60
|
const messages = errors.map((err) => {
|
|
61
|
+
var _a;
|
|
39
62
|
let message = `Data path ${JSON.stringify(err.instancePath)} ${err.message}`;
|
|
40
|
-
if (err.
|
|
41
|
-
|
|
63
|
+
if (err.params) {
|
|
64
|
+
switch (err.keyword) {
|
|
65
|
+
case 'additionalProperties':
|
|
66
|
+
message += `(${err.params.additionalProperty})`;
|
|
67
|
+
break;
|
|
68
|
+
case 'enum':
|
|
69
|
+
message += `. Allowed values are: ${(_a = err.params.allowedValues) === null || _a === void 0 ? void 0 : _a.map((v) => `"${v}"`).join(', ')}`;
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
42
72
|
}
|
|
43
73
|
return message + '.';
|
|
44
74
|
});
|
|
@@ -214,6 +244,13 @@ class CoreSchemaRegistry {
|
|
|
214
244
|
this._currentCompilationSchemaInfo = schemaInfo;
|
|
215
245
|
validator = this._ajv.compile(schema);
|
|
216
246
|
}
|
|
247
|
+
catch (e) {
|
|
248
|
+
// This should eventually be refactored so that we we handle race condition where the same schema is validated at the same time.
|
|
249
|
+
if (!(e instanceof ajv_1.default.MissingRefError)) {
|
|
250
|
+
throw e;
|
|
251
|
+
}
|
|
252
|
+
validator = await this._ajv.compileAsync(schema);
|
|
253
|
+
}
|
|
217
254
|
finally {
|
|
218
255
|
this._currentCompilationSchemaInfo = undefined;
|
|
219
256
|
}
|
|
@@ -253,9 +290,17 @@ class CoreSchemaRegistry {
|
|
|
253
290
|
}
|
|
254
291
|
}
|
|
255
292
|
// Validate using ajv
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
293
|
+
try {
|
|
294
|
+
const success = await validator.call(validationContext, data);
|
|
295
|
+
if (!success) {
|
|
296
|
+
return { data, success, errors: (_a = validator.errors) !== null && _a !== void 0 ? _a : [] };
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
catch (error) {
|
|
300
|
+
if (error instanceof ajv_1.default.ValidationError) {
|
|
301
|
+
return { data, success: false, errors: error.errors };
|
|
302
|
+
}
|
|
303
|
+
throw error;
|
|
259
304
|
}
|
|
260
305
|
// Apply post-validation transforms
|
|
261
306
|
if (validationOptions.applyPostTransforms) {
|
|
@@ -286,9 +331,7 @@ class CoreSchemaRegistry {
|
|
|
286
331
|
return () => true;
|
|
287
332
|
}
|
|
288
333
|
// We cheat, heavily.
|
|
289
|
-
const pathArray = it
|
|
290
|
-
.slice(1, it.dataLevel + 1)
|
|
291
|
-
.map((p) => (typeof p === 'number' ? p : p.str.slice(1, -1)));
|
|
334
|
+
const pathArray = this.normalizeDataPathArr(it);
|
|
292
335
|
compilationSchemInfo.smartDefaultRecord.set(JSON.stringify(pathArray), schema);
|
|
293
336
|
return () => true;
|
|
294
337
|
},
|
|
@@ -321,11 +364,7 @@ class CoreSchemaRegistry {
|
|
|
321
364
|
if (!compilationSchemInfo) {
|
|
322
365
|
return () => true;
|
|
323
366
|
}
|
|
324
|
-
const path = '/' +
|
|
325
|
-
it.dataPathArr
|
|
326
|
-
.slice(1, it.dataLevel + 1)
|
|
327
|
-
.map((p) => (typeof p === 'number' ? p : p.str.slice(1, -1)))
|
|
328
|
-
.join('/');
|
|
367
|
+
const path = '/' + this.normalizeDataPathArr(it).join('/');
|
|
329
368
|
let type;
|
|
330
369
|
let items;
|
|
331
370
|
let message;
|
|
@@ -454,8 +493,20 @@ class CoreSchemaRegistry {
|
|
|
454
493
|
}
|
|
455
494
|
static _set(
|
|
456
495
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
457
|
-
data, fragments, value,
|
|
458
|
-
|
|
496
|
+
data, fragments, value,
|
|
497
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
498
|
+
parent = null, parentProperty, force) {
|
|
499
|
+
for (let index = 0; index < fragments.length; index++) {
|
|
500
|
+
const fragment = fragments[index];
|
|
501
|
+
if (/^i\d+$/.test(fragment)) {
|
|
502
|
+
if (!Array.isArray(data)) {
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
for (let dataIndex = 0; dataIndex < data.length; dataIndex++) {
|
|
506
|
+
CoreSchemaRegistry._set(data[dataIndex], fragments.slice(index + 1), value, data, `${dataIndex}`);
|
|
507
|
+
}
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
459
510
|
if (!data && parent !== null && parentProperty) {
|
|
460
511
|
data = parent[parentProperty] = {};
|
|
461
512
|
}
|
|
@@ -505,5 +556,10 @@ class CoreSchemaRegistry {
|
|
|
505
556
|
console.warn(`"${schema.$id}" schema is using the keyword "id" which its support is deprecated. Use "$id" for schema ID.`);
|
|
506
557
|
}
|
|
507
558
|
}
|
|
559
|
+
normalizeDataPathArr(it) {
|
|
560
|
+
return it.dataPathArr
|
|
561
|
+
.slice(1, it.dataLevel + 1)
|
|
562
|
+
.map((p) => (typeof p === 'number' ? p : p.str.replace(/\"/g, '')));
|
|
563
|
+
}
|
|
508
564
|
}
|
|
509
565
|
exports.CoreSchemaRegistry = CoreSchemaRegistry;
|
package/src/utils/index.js
CHANGED
|
@@ -13,14 +13,26 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
if (k2 === undefined) k2 = k;
|
|
14
14
|
o[k2] = m[k];
|
|
15
15
|
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
16
28
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
29
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
30
|
};
|
|
19
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
32
|
exports.strings = exports.tags = void 0;
|
|
21
|
-
const tags = require("./literals");
|
|
33
|
+
const tags = __importStar(require("./literals"));
|
|
22
34
|
exports.tags = tags;
|
|
23
|
-
const strings = require("./strings");
|
|
35
|
+
const strings = __importStar(require("./strings"));
|
|
24
36
|
exports.strings = strings;
|
|
25
37
|
__exportStar(require("./array"), exports);
|
|
26
38
|
__exportStar(require("./object"), exports);
|
package/src/virtual-fs/index.js
CHANGED
|
@@ -13,11 +13,23 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
if (k2 === undefined) k2 = k;
|
|
14
14
|
o[k2] = m[k];
|
|
15
15
|
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
16
28
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
29
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
30
|
};
|
|
19
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
32
|
exports.virtualFs = void 0;
|
|
21
|
-
const virtualFs = require("./host/index");
|
|
33
|
+
const virtualFs = __importStar(require("./host/index"));
|
|
22
34
|
exports.virtualFs = virtualFs;
|
|
23
35
|
__exportStar(require("./path"), exports);
|
|
@@ -6,9 +6,12 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
+
};
|
|
9
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
13
|
exports.writeJsonWorkspace = void 0;
|
|
11
|
-
const magic_string_1 = require("magic-string");
|
|
14
|
+
const magic_string_1 = __importDefault(require("magic-string"));
|
|
12
15
|
const metadata_1 = require("./metadata");
|
|
13
16
|
const utilities_1 = require("./utilities");
|
|
14
17
|
async function writeJsonWorkspace(workspace, host, path, options = {}) {
|