@angular-devkit/core 14.1.0-next.4 → 14.1.1

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 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
- jasmine_node_test(
56
- name = "node_test",
57
- srcs = [":node_test_lib"],
58
- deps = [
59
- "@npm//chokidar",
60
- # @node_module: ajv
61
- # @node_module: fast_json_stable_stringify
62
- # @node_module: magic_string
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.0-next.4",
3
+ "version": "14.1.1",
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.0.0",
18
+ "jsonc-parser": "3.1.0",
19
19
  "rxjs": "6.6.7",
20
20
  "source-map": "0.7.4"
21
21
  },
@@ -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
@@ -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 declare function readJsonWorkspace(path: string, host: WorkspaceHost): Promise<WorkspaceDefinition>;
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
- async function readJsonWorkspace(path, host) {
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,20 +43,28 @@ 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);
41
57
  },
42
- warn(_message, _node) {
58
+ warn(message, _node) {
43
59
  // TODO: Diagnostic reporting support
60
+ // eslint-disable-next-line no-console
61
+ console.warn(message);
44
62
  },
45
63
  };
46
64
  const workspace = parseWorkspace(ast, context);
47
65
  return workspace;
48
66
  }
49
67
  exports.readJsonWorkspace = readJsonWorkspace;
50
- const specialWorkspaceExtensions = ['cli', 'defaultProject', 'newProjectRoot', 'schematics'];
51
- const specialProjectExtensions = ['cli', 'schematics', 'projectType'];
52
68
  function parseWorkspace(workspaceNode, context) {
53
69
  const jsonMetadata = context.metadata;
54
70
  let projects;
@@ -72,8 +88,8 @@ function parseWorkspace(workspaceNode, context) {
72
88
  projects = parseProjectsObject(nodes, context);
73
89
  }
74
90
  else {
75
- if (!specialWorkspaceExtensions.includes(name) && !/^[a-z]{1,3}-.*/.test(name)) {
76
- 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);
77
93
  }
78
94
  if (extensions) {
79
95
  extensions[name] = value;
@@ -124,6 +140,10 @@ function parseProject(projectName, projectNode, context) {
124
140
  properties = Object.create(null);
125
141
  }
126
142
  const projectNodeValue = (0, jsonc_parser_1.getNodeValue)(projectNode);
143
+ if (!('root' in projectNodeValue)) {
144
+ // TODO(alan-agius4): change this to error in v15.
145
+ context.warn(`Project "${projectName}" is missing a required property "root". This will become an error in the next major version.`, projectNodeValue);
146
+ }
127
147
  for (const [name, value] of Object.entries(projectNodeValue)) {
128
148
  switch (name) {
129
149
  case 'targets':
@@ -148,8 +168,8 @@ function parseProject(projectName, projectNode, context) {
148
168
  }
149
169
  break;
150
170
  default:
151
- if (!specialProjectExtensions.includes(name) && !/^[a-z]{1,3}-.*/.test(name)) {
152
- 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);
153
173
  }
154
174
  if (extensions) {
155
175
  extensions[name] = value;