@angular-devkit/core 14.1.0-rc.3 → 14.1.2
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 +18 -10
- package/package.json +2 -2
- package/src/utils/strings.d.ts +2 -1
- package/src/utils/strings.js +3 -2
- package/src/workspace/json/reader.d.ts +5 -1
- package/src/workspace/json/reader.js +21 -7
package/node/BUILD.bazel
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
load("@npm//@bazel/jasmine:index.bzl", "jasmine_node_test")
|
|
7
7
|
load("//tools:defaults.bzl", "ts_library")
|
|
8
|
+
load("//tools:toolchain_info.bzl", "TOOLCHAINS_NAMES", "TOOLCHAINS_VERSIONS")
|
|
8
9
|
|
|
9
10
|
licenses(["notice"]) # MIT License
|
|
10
11
|
|
|
@@ -52,13 +53,20 @@ ts_library(
|
|
|
52
53
|
],
|
|
53
54
|
)
|
|
54
55
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
[
|
|
57
|
+
jasmine_node_test(
|
|
58
|
+
name = "node_test_" + toolchain_name,
|
|
59
|
+
srcs = [":node_test_lib"],
|
|
60
|
+
toolchain = toolchain,
|
|
61
|
+
deps = [
|
|
62
|
+
"@npm//chokidar",
|
|
63
|
+
# @node_module: ajv
|
|
64
|
+
# @node_module: fast_json_stable_stringify
|
|
65
|
+
# @node_module: magic_string
|
|
66
|
+
],
|
|
67
|
+
)
|
|
68
|
+
for toolchain_name, toolchain in zip(
|
|
69
|
+
TOOLCHAINS_NAMES,
|
|
70
|
+
TOOLCHAINS_VERSIONS,
|
|
71
|
+
)
|
|
72
|
+
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/core",
|
|
3
|
-
"version": "14.1.
|
|
3
|
+
"version": "14.1.2",
|
|
4
4
|
"description": "Angular DevKit - Core Utility Library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"typings": "src/index.d.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"ajv-formats": "2.1.1",
|
|
17
17
|
"ajv": "8.11.0",
|
|
18
|
-
"jsonc-parser": "3.
|
|
18
|
+
"jsonc-parser": "3.1.0",
|
|
19
19
|
"rxjs": "6.6.7",
|
|
20
20
|
"source-map": "0.7.4"
|
|
21
21
|
},
|
package/src/utils/strings.d.ts
CHANGED
|
@@ -54,13 +54,14 @@ export declare function camelize(str: string): string;
|
|
|
54
54
|
/**
|
|
55
55
|
Returns the UpperCamelCase form of a string.
|
|
56
56
|
|
|
57
|
+
@example
|
|
57
58
|
```javascript
|
|
58
59
|
'innerHTML'.classify(); // 'InnerHTML'
|
|
59
60
|
'action_name'.classify(); // 'ActionName'
|
|
60
61
|
'css-class-name'.classify(); // 'CssClassName'
|
|
61
62
|
'my favorite items'.classify(); // 'MyFavoriteItems'
|
|
63
|
+
'app.component'.classify(); // 'AppComponent'
|
|
62
64
|
```
|
|
63
|
-
|
|
64
65
|
@method classify
|
|
65
66
|
@param {String} str the string to classify
|
|
66
67
|
@return {String} the classified string
|
package/src/utils/strings.js
CHANGED
|
@@ -75,13 +75,14 @@ exports.camelize = camelize;
|
|
|
75
75
|
/**
|
|
76
76
|
Returns the UpperCamelCase form of a string.
|
|
77
77
|
|
|
78
|
+
@example
|
|
78
79
|
```javascript
|
|
79
80
|
'innerHTML'.classify(); // 'InnerHTML'
|
|
80
81
|
'action_name'.classify(); // 'ActionName'
|
|
81
82
|
'css-class-name'.classify(); // 'CssClassName'
|
|
82
83
|
'my favorite items'.classify(); // 'MyFavoriteItems'
|
|
84
|
+
'app.component'.classify(); // 'AppComponent'
|
|
83
85
|
```
|
|
84
|
-
|
|
85
86
|
@method classify
|
|
86
87
|
@param {String} str the string to classify
|
|
87
88
|
@return {String} the classified string
|
|
@@ -90,7 +91,7 @@ function classify(str) {
|
|
|
90
91
|
return str
|
|
91
92
|
.split('.')
|
|
92
93
|
.map((part) => capitalize(camelize(part)))
|
|
93
|
-
.join('
|
|
94
|
+
.join('');
|
|
94
95
|
}
|
|
95
96
|
exports.classify = classify;
|
|
96
97
|
/**
|
|
@@ -7,4 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { WorkspaceDefinition } from '../definitions';
|
|
9
9
|
import { WorkspaceHost } from '../host';
|
|
10
|
-
export
|
|
10
|
+
export interface JsonWorkspaceOptions {
|
|
11
|
+
allowedProjectExtensions?: string[];
|
|
12
|
+
allowedWorkspaceExtensions?: string[];
|
|
13
|
+
}
|
|
14
|
+
export declare function readJsonWorkspace(path: string, host: WorkspaceHost, options?: JsonWorkspaceOptions): Promise<WorkspaceDefinition>;
|
|
@@ -13,7 +13,15 @@ const utils_1 = require("../../json/utils");
|
|
|
13
13
|
const definitions_1 = require("../definitions");
|
|
14
14
|
const metadata_1 = require("./metadata");
|
|
15
15
|
const utilities_1 = require("./utilities");
|
|
16
|
-
|
|
16
|
+
const ANGULAR_WORKSPACE_EXTENSIONS = Object.freeze([
|
|
17
|
+
'cli',
|
|
18
|
+
'defaultProject',
|
|
19
|
+
'newProjectRoot',
|
|
20
|
+
'schematics',
|
|
21
|
+
]);
|
|
22
|
+
const ANGULAR_PROJECT_EXTENSIONS = Object.freeze(['cli', 'schematics', 'projectType', 'i18n']);
|
|
23
|
+
async function readJsonWorkspace(path, host, options = {}) {
|
|
24
|
+
var _a, _b;
|
|
17
25
|
const raw = await host.readFile(path);
|
|
18
26
|
if (raw === undefined) {
|
|
19
27
|
throw new Error('Unable to read workspace file.');
|
|
@@ -35,6 +43,14 @@ async function readJsonWorkspace(path, host) {
|
|
|
35
43
|
host,
|
|
36
44
|
metadata: new metadata_1.JsonWorkspaceMetadata(path, ast, raw),
|
|
37
45
|
trackChanges: true,
|
|
46
|
+
unprefixedWorkspaceExtensions: new Set([
|
|
47
|
+
...ANGULAR_WORKSPACE_EXTENSIONS,
|
|
48
|
+
...((_a = options.allowedWorkspaceExtensions) !== null && _a !== void 0 ? _a : []),
|
|
49
|
+
]),
|
|
50
|
+
unprefixedProjectExtensions: new Set([
|
|
51
|
+
...ANGULAR_PROJECT_EXTENSIONS,
|
|
52
|
+
...((_b = options.allowedProjectExtensions) !== null && _b !== void 0 ? _b : []),
|
|
53
|
+
]),
|
|
38
54
|
error(message, _node) {
|
|
39
55
|
// TODO: Diagnostic reporting support
|
|
40
56
|
throw new Error(message);
|
|
@@ -49,8 +65,6 @@ async function readJsonWorkspace(path, host) {
|
|
|
49
65
|
return workspace;
|
|
50
66
|
}
|
|
51
67
|
exports.readJsonWorkspace = readJsonWorkspace;
|
|
52
|
-
const specialWorkspaceExtensions = ['cli', 'defaultProject', 'newProjectRoot', 'schematics'];
|
|
53
|
-
const specialProjectExtensions = ['cli', 'schematics', 'projectType'];
|
|
54
68
|
function parseWorkspace(workspaceNode, context) {
|
|
55
69
|
const jsonMetadata = context.metadata;
|
|
56
70
|
let projects;
|
|
@@ -74,8 +88,8 @@ function parseWorkspace(workspaceNode, context) {
|
|
|
74
88
|
projects = parseProjectsObject(nodes, context);
|
|
75
89
|
}
|
|
76
90
|
else {
|
|
77
|
-
if (!
|
|
78
|
-
context.warn(`Project extension with invalid name found.`, name);
|
|
91
|
+
if (!context.unprefixedWorkspaceExtensions.has(name) && !/^[a-z]{1,3}-.*/.test(name)) {
|
|
92
|
+
context.warn(`Project extension with invalid name (${name}) found.`, name);
|
|
79
93
|
}
|
|
80
94
|
if (extensions) {
|
|
81
95
|
extensions[name] = value;
|
|
@@ -154,8 +168,8 @@ function parseProject(projectName, projectNode, context) {
|
|
|
154
168
|
}
|
|
155
169
|
break;
|
|
156
170
|
default:
|
|
157
|
-
if (!
|
|
158
|
-
context.warn(`Project extension with invalid name found.`, name);
|
|
171
|
+
if (!context.unprefixedProjectExtensions.has(name) && !/^[a-z]{1,3}-.*/.test(name)) {
|
|
172
|
+
context.warn(`Project extension with invalid name (${name}) found.`, name);
|
|
159
173
|
}
|
|
160
174
|
if (extensions) {
|
|
161
175
|
extensions[name] = value;
|