@angular/cli 18.1.0-next.3 → 18.1.0-rc.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.
@@ -30,7 +30,7 @@ class NewCommandModule extends schematics_command_module_1.SchematicsCommandModu
30
30
  const collectionName = typeof collectionNameFromArgs === 'string'
31
31
  ? collectionNameFromArgs
32
32
  : await this.getCollectionFromConfig();
33
- const workflow = await this.getOrCreateWorkflowForBuilder(collectionName);
33
+ const workflow = this.getOrCreateWorkflowForBuilder(collectionName);
34
34
  const collection = workflow.engine.createCollection(collectionName);
35
35
  const options = await this.getSchematicOptions(collection, this.schematicName, workflow);
36
36
  return this.addSchemaOptionsToCommand(localYargs, options);
@@ -6,4 +6,4 @@
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  export { color as colors, figures } from 'listr2';
9
- export declare function supportColor(): boolean;
9
+ export declare function supportColor(stream?: NodeJS.WritableStream): boolean;
@@ -13,27 +13,15 @@ const node_tty_1 = require("node:tty");
13
13
  var listr2_1 = require("listr2");
14
14
  Object.defineProperty(exports, "colors", { enumerable: true, get: function () { return listr2_1.color; } });
15
15
  Object.defineProperty(exports, "figures", { enumerable: true, get: function () { return listr2_1.figures; } });
16
- function supportColor() {
17
- if (process.env.FORCE_COLOR !== undefined) {
18
- // 2 colors: FORCE_COLOR = 0 (Disables colors), depth 1
19
- // 16 colors: FORCE_COLOR = 1, depth 4
20
- // 256 colors: FORCE_COLOR = 2, depth 8
21
- // 16,777,216 colors: FORCE_COLOR = 3, depth 16
22
- // See: https://nodejs.org/dist/latest-v12.x/docs/api/tty.html#tty_writestream_getcolordepth_env
23
- // and https://github.com/nodejs/node/blob/b9f36062d7b5c5039498e98d2f2c180dca2a7065/lib/internal/tty.js#L106;
24
- switch (process.env.FORCE_COLOR) {
25
- case '':
26
- case 'true':
27
- case '1':
28
- case '2':
29
- case '3':
30
- return true;
31
- default:
32
- return false;
33
- }
16
+ function supportColor(stream = process.stdout) {
17
+ if (stream instanceof node_tty_1.WriteStream) {
18
+ return stream.hasColors();
34
19
  }
35
- if (process.stdout instanceof node_tty_1.WriteStream) {
36
- return process.stdout.getColorDepth() > 1;
20
+ try {
21
+ // The hasColors function does not rely on any instance state and should ideally be static
22
+ return node_tty_1.WriteStream.prototype.hasColors();
23
+ }
24
+ catch {
25
+ return process.env['FORCE_COLOR'] !== undefined && process.env['FORCE_COLOR'] !== '0';
37
26
  }
38
- return false;
39
27
  }
@@ -12,4 +12,4 @@
12
12
  *
13
13
  * @see https://en.wikipedia.org/wiki/Memoization
14
14
  */
15
- export declare function memoize<T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
15
+ export declare function memoize<This, Args extends unknown[], Return>(target: (this: This, ...args: Args) => Return, context: ClassMemberDecoratorContext): (this: This, ...args: Args) => Return;
@@ -15,29 +15,24 @@ exports.memoize = memoize;
15
15
  *
16
16
  * @see https://en.wikipedia.org/wiki/Memoization
17
17
  */
18
- function memoize(target, propertyKey, descriptor) {
19
- const descriptorPropertyName = descriptor.get ? 'get' : 'value';
20
- const originalMethod = descriptor[descriptorPropertyName];
21
- if (typeof originalMethod !== 'function') {
18
+ function memoize(target, context) {
19
+ if (context.kind !== 'method' && context.kind !== 'getter') {
22
20
  throw new Error('Memoize decorator can only be used on methods or get accessors.');
23
21
  }
24
22
  const cache = new Map();
25
- return {
26
- ...descriptor,
27
- [descriptorPropertyName]: function (...args) {
28
- for (const arg of args) {
29
- if (!isJSONSerializable(arg)) {
30
- throw new Error(`Argument ${isNonPrimitive(arg) ? arg.toString() : arg} is JSON serializable.`);
31
- }
23
+ return function (...args) {
24
+ for (const arg of args) {
25
+ if (!isJSONSerializable(arg)) {
26
+ throw new Error(`Argument ${isNonPrimitive(arg) ? arg.toString() : arg} is JSON serializable.`);
32
27
  }
33
- const key = JSON.stringify(args);
34
- if (cache.has(key)) {
35
- return cache.get(key);
36
- }
37
- const result = originalMethod.apply(this, args);
38
- cache.set(key, result);
39
- return result;
40
- },
28
+ }
29
+ const key = JSON.stringify(args);
30
+ if (cache.has(key)) {
31
+ return cache.get(key);
32
+ }
33
+ const result = target.apply(this, args);
34
+ cache.set(key, result);
35
+ return result;
41
36
  };
42
37
  }
43
38
  /** Method to check if value is a non primitive. */