@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.
- package/package.json +16 -16
- package/src/command-builder/architect-base-command-module.js +1 -1
- package/src/command-builder/architect-command-module.js +158 -124
- package/src/command-builder/command-module.js +225 -196
- package/src/command-builder/schematics-command-module.js +308 -284
- package/src/commands/new/cli.js +1 -1
- package/src/utilities/color.d.ts +1 -1
- package/src/utilities/color.js +9 -21
- package/src/utilities/memoize.d.ts +1 -1
- package/src/utilities/memoize.js +14 -19
- package/src/utilities/package-manager.js +265 -239
- package/src/utilities/tty.d.ts +1 -1
- package/src/utilities/tty.js +2 -2
- package/src/utilities/version.js +1 -1
package/src/commands/new/cli.js
CHANGED
|
@@ -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 =
|
|
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);
|
package/src/utilities/color.d.ts
CHANGED
package/src/utilities/color.js
CHANGED
|
@@ -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 (
|
|
18
|
-
|
|
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
|
-
|
|
36
|
-
|
|
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<
|
|
15
|
+
export declare function memoize<This, Args extends unknown[], Return>(target: (this: This, ...args: Args) => Return, context: ClassMemberDecoratorContext): (this: This, ...args: Args) => Return;
|
package/src/utilities/memoize.js
CHANGED
|
@@ -15,29 +15,24 @@ exports.memoize = memoize;
|
|
|
15
15
|
*
|
|
16
16
|
* @see https://en.wikipedia.org/wiki/Memoization
|
|
17
17
|
*/
|
|
18
|
-
function memoize(target,
|
|
19
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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. */
|