@angular-devkit/schematics-cli 18.1.0-next.1 → 18.1.0-next.3
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/bin/schematics.d.ts +1 -14
- package/bin/schematics.js +71 -76
- package/blank/factory.d.ts +1 -1
- package/blank/factory.js +1 -1
- package/package.json +13 -4
- package/schematic/factory.d.ts +1 -1
- package/schematic/factory.js +1 -1
package/bin/schematics.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
import 'symbol-observable';
|
|
10
10
|
import { ProcessOutput } from '@angular-devkit/core/node';
|
|
@@ -14,16 +14,3 @@ export interface MainOptions {
|
|
|
14
14
|
stderr?: ProcessOutput;
|
|
15
15
|
}
|
|
16
16
|
export declare function main({ args, stdout, stderr, }: MainOptions): Promise<0 | 1>;
|
|
17
|
-
/**
|
|
18
|
-
* This uses a dynamic import to load a module which may be ESM.
|
|
19
|
-
* CommonJS code can load ESM code via a dynamic import. Unfortunately, TypeScript
|
|
20
|
-
* will currently, unconditionally downlevel dynamic import into a require call.
|
|
21
|
-
* require calls cannot load ESM code and will result in a runtime error. To workaround
|
|
22
|
-
* this, a Function constructor is used to prevent TypeScript from changing the dynamic import.
|
|
23
|
-
* Once TypeScript provides support for keeping the dynamic import this workaround can
|
|
24
|
-
* be dropped.
|
|
25
|
-
*
|
|
26
|
-
* @param modulePath The path of the module to load.
|
|
27
|
-
* @returns A Promise that resolves to the dynamically imported module.
|
|
28
|
-
*/
|
|
29
|
-
export declare function loadEsmModule<T>(modulePath: string | URL): Promise<T>;
|
package/bin/schematics.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Copyright Google LLC All Rights Reserved.
|
|
6
6
|
*
|
|
7
7
|
* Use of this source code is governed by an MIT-style license that can be
|
|
8
|
-
* found in the LICENSE file at https://angular.
|
|
8
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
9
9
|
*/
|
|
10
10
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
11
|
if (k2 === undefined) k2 = k;
|
|
@@ -35,7 +35,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
35
35
|
};
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
37
|
exports.main = main;
|
|
38
|
-
exports.loadEsmModule = loadEsmModule;
|
|
39
38
|
// symbol polyfill must go first
|
|
40
39
|
require("symbol-observable");
|
|
41
40
|
const node_1 = require("@angular-devkit/core/node");
|
|
@@ -84,66 +83,82 @@ function _listSchematics(workflow, collectionName, logger) {
|
|
|
84
83
|
}
|
|
85
84
|
function _createPromptProvider() {
|
|
86
85
|
return async (definitions) => {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
};
|
|
93
|
-
const validator = definition.validator;
|
|
94
|
-
if (validator) {
|
|
95
|
-
question.validate = (input) => validator(input);
|
|
96
|
-
// Filter allows transformation of the value prior to validation
|
|
97
|
-
question.filter = async (input) => {
|
|
98
|
-
for (const type of definition.propertyTypes) {
|
|
99
|
-
let value;
|
|
100
|
-
switch (type) {
|
|
101
|
-
case 'string':
|
|
102
|
-
value = String(input);
|
|
103
|
-
break;
|
|
104
|
-
case 'integer':
|
|
105
|
-
case 'number':
|
|
106
|
-
value = Number(input);
|
|
107
|
-
break;
|
|
108
|
-
default:
|
|
109
|
-
value = input;
|
|
110
|
-
break;
|
|
111
|
-
}
|
|
112
|
-
// Can be a string if validation fails
|
|
113
|
-
const isValid = (await validator(value)) === true;
|
|
114
|
-
if (isValid) {
|
|
115
|
-
return value;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return input;
|
|
119
|
-
};
|
|
120
|
-
}
|
|
86
|
+
let prompts;
|
|
87
|
+
const answers = {};
|
|
88
|
+
for (const definition of definitions) {
|
|
89
|
+
// Only load prompt package if needed
|
|
90
|
+
prompts ??= await Promise.resolve().then(() => __importStar(require('@inquirer/prompts')));
|
|
121
91
|
switch (definition.type) {
|
|
122
92
|
case 'confirmation':
|
|
123
|
-
|
|
93
|
+
answers[definition.id] = await prompts.confirm({
|
|
94
|
+
message: definition.message,
|
|
95
|
+
default: definition.default,
|
|
96
|
+
});
|
|
97
|
+
break;
|
|
124
98
|
case 'list':
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
99
|
+
if (!definition.items?.length) {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
const choices = definition.items?.map((item) => {
|
|
103
|
+
return typeof item == 'string'
|
|
104
|
+
? {
|
|
105
|
+
name: item,
|
|
106
|
+
value: item,
|
|
107
|
+
}
|
|
108
|
+
: {
|
|
109
|
+
name: item.label,
|
|
110
|
+
value: item.value,
|
|
111
|
+
};
|
|
112
|
+
});
|
|
113
|
+
answers[definition.id] = await (definition.multiselect ? prompts.checkbox : prompts.select)({
|
|
114
|
+
message: definition.message,
|
|
115
|
+
default: definition.default,
|
|
116
|
+
choices,
|
|
117
|
+
});
|
|
118
|
+
break;
|
|
119
|
+
case 'input':
|
|
120
|
+
let finalValue;
|
|
121
|
+
answers[definition.id] = await prompts.input({
|
|
122
|
+
message: definition.message,
|
|
123
|
+
default: definition.default,
|
|
124
|
+
async validate(value) {
|
|
125
|
+
if (definition.validator === undefined) {
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
let lastValidation = false;
|
|
129
|
+
for (const type of definition.propertyTypes) {
|
|
130
|
+
let potential;
|
|
131
|
+
switch (type) {
|
|
132
|
+
case 'string':
|
|
133
|
+
potential = String(value);
|
|
134
|
+
break;
|
|
135
|
+
case 'integer':
|
|
136
|
+
case 'number':
|
|
137
|
+
potential = Number(value);
|
|
138
|
+
break;
|
|
139
|
+
default:
|
|
140
|
+
potential = value;
|
|
141
|
+
break;
|
|
132
142
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
143
|
+
lastValidation = await definition.validator(potential);
|
|
144
|
+
// Can be a string if validation fails
|
|
145
|
+
if (lastValidation === true) {
|
|
146
|
+
finalValue = potential;
|
|
147
|
+
return true;
|
|
138
148
|
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
149
|
+
}
|
|
150
|
+
return lastValidation;
|
|
151
|
+
},
|
|
152
|
+
});
|
|
153
|
+
// Use validated value if present.
|
|
154
|
+
// This ensures the correct type is inserted into the final schema options.
|
|
155
|
+
if (finalValue !== undefined) {
|
|
156
|
+
answers[definition.id] = finalValue;
|
|
157
|
+
}
|
|
158
|
+
break;
|
|
143
159
|
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
return inquirer.prompt(questions);
|
|
160
|
+
}
|
|
161
|
+
return answers;
|
|
147
162
|
};
|
|
148
163
|
}
|
|
149
164
|
function findUp(names, from) {
|
|
@@ -431,23 +446,3 @@ if (require.main === module) {
|
|
|
431
446
|
throw e;
|
|
432
447
|
});
|
|
433
448
|
}
|
|
434
|
-
/**
|
|
435
|
-
* Lazily compiled dynamic import loader function.
|
|
436
|
-
*/
|
|
437
|
-
let load;
|
|
438
|
-
/**
|
|
439
|
-
* This uses a dynamic import to load a module which may be ESM.
|
|
440
|
-
* CommonJS code can load ESM code via a dynamic import. Unfortunately, TypeScript
|
|
441
|
-
* will currently, unconditionally downlevel dynamic import into a require call.
|
|
442
|
-
* require calls cannot load ESM code and will result in a runtime error. To workaround
|
|
443
|
-
* this, a Function constructor is used to prevent TypeScript from changing the dynamic import.
|
|
444
|
-
* Once TypeScript provides support for keeping the dynamic import this workaround can
|
|
445
|
-
* be dropped.
|
|
446
|
-
*
|
|
447
|
-
* @param modulePath The path of the module to load.
|
|
448
|
-
* @returns A Promise that resolves to the dynamically imported module.
|
|
449
|
-
*/
|
|
450
|
-
function loadEsmModule(modulePath) {
|
|
451
|
-
load ??= new Function('modulePath', `return import(modulePath);`);
|
|
452
|
-
return load(modulePath);
|
|
453
|
-
}
|
package/blank/factory.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Rule } from '@angular-devkit/schematics';
|
|
9
9
|
import { Schema } from './schema';
|
package/blank/factory.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.default = default_1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/schematics-cli",
|
|
3
|
-
"version": "18.1.0-next.
|
|
3
|
+
"version": "18.1.0-next.3",
|
|
4
4
|
"description": "Angular Schematics - CLI",
|
|
5
5
|
"homepage": "https://github.com/angular/angular-cli",
|
|
6
6
|
"bin": {
|
|
@@ -21,13 +21,14 @@
|
|
|
21
21
|
],
|
|
22
22
|
"schematics": "./collection.json",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@angular-devkit/core": "18.1.0-next.
|
|
25
|
-
"@angular-devkit/schematics": "18.1.0-next.
|
|
24
|
+
"@angular-devkit/core": "18.1.0-next.3",
|
|
25
|
+
"@angular-devkit/schematics": "18.1.0-next.3",
|
|
26
|
+
"@inquirer/prompts": "5.0.6",
|
|
26
27
|
"ansi-colors": "4.1.3",
|
|
27
|
-
"inquirer": "9.2.23",
|
|
28
28
|
"symbol-observable": "4.0.0",
|
|
29
29
|
"yargs-parser": "21.1.1"
|
|
30
30
|
},
|
|
31
|
+
"packageManager": "yarn@4.3.0",
|
|
31
32
|
"repository": {
|
|
32
33
|
"type": "git",
|
|
33
34
|
"url": "https://github.com/angular/angular-cli.git"
|
|
@@ -41,5 +42,13 @@
|
|
|
41
42
|
"license": "MIT",
|
|
42
43
|
"bugs": {
|
|
43
44
|
"url": "https://github.com/angular/angular-cli/issues"
|
|
45
|
+
},
|
|
46
|
+
"dependenciesMeta": {
|
|
47
|
+
"esbuild": {
|
|
48
|
+
"built": true
|
|
49
|
+
},
|
|
50
|
+
"puppeteer": {
|
|
51
|
+
"built": true
|
|
52
|
+
}
|
|
44
53
|
}
|
|
45
54
|
}
|
package/schematic/factory.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Rule } from '@angular-devkit/schematics';
|
|
9
9
|
import { Schema } from './schema';
|
package/schematic/factory.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.default = default_1;
|