@angular/cli 18.1.0-next.2 → 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.
@@ -6,58 +6,22 @@
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.dev/license
8
8
  */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- var desc = Object.getOwnPropertyDescriptor(m, k);
12
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
- desc = { enumerable: true, get: function() { return m[k]; } };
14
- }
15
- Object.defineProperty(o, k2, desc);
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
- Object.defineProperty(o, "default", { enumerable: true, value: v });
22
- }) : function(o, v) {
23
- o["default"] = v;
24
- });
25
- var __importStar = (this && this.__importStar) || function (mod) {
26
- if (mod && mod.__esModule) return mod;
27
- var result = {};
28
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
- __setModuleDefault(result, mod);
30
- return result;
31
- };
32
9
  Object.defineProperty(exports, "__esModule", { value: true });
33
- exports.colors = void 0;
34
- const ansiColors = __importStar(require("ansi-colors"));
35
- const tty_1 = require("tty");
36
- function supportColor() {
37
- if (process.env.FORCE_COLOR !== undefined) {
38
- // 2 colors: FORCE_COLOR = 0 (Disables colors), depth 1
39
- // 16 colors: FORCE_COLOR = 1, depth 4
40
- // 256 colors: FORCE_COLOR = 2, depth 8
41
- // 16,777,216 colors: FORCE_COLOR = 3, depth 16
42
- // See: https://nodejs.org/dist/latest-v12.x/docs/api/tty.html#tty_writestream_getcolordepth_env
43
- // and https://github.com/nodejs/node/blob/b9f36062d7b5c5039498e98d2f2c180dca2a7065/lib/internal/tty.js#L106;
44
- switch (process.env.FORCE_COLOR) {
45
- case '':
46
- case 'true':
47
- case '1':
48
- case '2':
49
- case '3':
50
- return true;
51
- default:
52
- return false;
53
- }
10
+ exports.figures = exports.colors = void 0;
11
+ exports.supportColor = supportColor;
12
+ const node_tty_1 = require("node:tty");
13
+ var listr2_1 = require("listr2");
14
+ Object.defineProperty(exports, "colors", { enumerable: true, get: function () { return listr2_1.color; } });
15
+ Object.defineProperty(exports, "figures", { enumerable: true, get: function () { return listr2_1.figures; } });
16
+ function supportColor(stream = process.stdout) {
17
+ if (stream instanceof node_tty_1.WriteStream) {
18
+ return stream.hasColors();
19
+ }
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();
54
23
  }
55
- if (process.stdout instanceof tty_1.WriteStream) {
56
- return process.stdout.getColorDepth() > 1;
24
+ catch {
25
+ return process.env['FORCE_COLOR'] !== undefined && process.env['FORCE_COLOR'] !== '0';
57
26
  }
58
- return false;
59
27
  }
60
- // Create a separate instance to prevent unintended global changes to the color configuration
61
- const colors = ansiColors.create();
62
- exports.colors = colors;
63
- colors.enabled = supportColor();
@@ -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. */