Socket
Socket
Sign inDemoInstall

@angular-devkit/schematics-cli

Package Overview
Dependencies
Maintainers
2
Versions
732
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@angular-devkit/schematics-cli - npm Package Compare versions

Comparing version 18.1.0-next.1 to 18.1.0-next.2

15

bin/schematics.d.ts

@@ -7,3 +7,3 @@ #!/usr/bin/env node

* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
* found in the LICENSE file at https://angular.dev/license
*/

@@ -18,14 +18,1 @@ import 'symbol-observable';

export declare function main({ args, stdout, stderr, }: MainOptions): Promise<0 | 1>;
/**
* This uses a dynamic import to load a module which may be ESM.
* CommonJS code can load ESM code via a dynamic import. Unfortunately, TypeScript
* will currently, unconditionally downlevel dynamic import into a require call.
* require calls cannot load ESM code and will result in a runtime error. To workaround
* this, a Function constructor is used to prevent TypeScript from changing the dynamic import.
* Once TypeScript provides support for keeping the dynamic import this workaround can
* be dropped.
*
* @param modulePath The path of the module to load.
* @returns A Promise that resolves to the dynamically imported module.
*/
export declare function loadEsmModule<T>(modulePath: string | URL): Promise<T>;

147

bin/schematics.js

@@ -8,3 +8,3 @@ #!/usr/bin/env node

* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
* found in the LICENSE file at https://angular.dev/license
*/

@@ -39,3 +39,2 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {

exports.main = main;
exports.loadEsmModule = loadEsmModule;
// symbol polyfill must go first

@@ -89,62 +88,78 @@ require("symbol-observable");

return async (definitions) => {
const questions = definitions.map((definition) => {
const question = {
name: definition.id,
message: definition.message,
default: definition.default,
};
const validator = definition.validator;
if (validator) {
question.validate = (input) => validator(input);
// Filter allows transformation of the value prior to validation
question.filter = async (input) => {
for (const type of definition.propertyTypes) {
let value;
switch (type) {
case 'string':
value = String(input);
break;
case 'integer':
case 'number':
value = Number(input);
break;
default:
value = input;
break;
}
// Can be a string if validation fails
const isValid = (await validator(value)) === true;
if (isValid) {
return value;
}
}
return input;
};
}
let prompts;
const answers = {};
for (const definition of definitions) {
// Only load prompt package if needed
prompts ??= await Promise.resolve().then(() => __importStar(require('@inquirer/prompts')));
switch (definition.type) {
case 'confirmation':
return { ...question, type: 'confirm' };
answers[definition.id] = await prompts.confirm({
message: definition.message,
default: definition.default,
});
break;
case 'list':
return {
...question,
type: definition.multiselect ? 'checkbox' : 'list',
choices: definition.items &&
definition.items.map((item) => {
if (typeof item == 'string') {
return item;
if (!definition.items?.length) {
continue;
}
const choices = definition.items?.map((item) => {
return typeof item == 'string'
? {
name: item,
value: item,
}
: {
name: item.label,
value: item.value,
};
});
answers[definition.id] = await (definition.multiselect ? prompts.checkbox : prompts.select)({
message: definition.message,
default: definition.default,
choices,
});
break;
case 'input':
let finalValue;
answers[definition.id] = await prompts.input({
message: definition.message,
default: definition.default,
async validate(value) {
if (definition.validator === undefined) {
return true;
}
let lastValidation = false;
for (const type of definition.propertyTypes) {
let potential;
switch (type) {
case 'string':
potential = String(value);
break;
case 'integer':
case 'number':
potential = Number(value);
break;
default:
potential = value;
break;
}
else {
return {
name: item.label,
value: item.value,
};
lastValidation = await definition.validator(potential);
// Can be a string if validation fails
if (lastValidation === true) {
finalValue = potential;
return true;
}
}),
};
default:
return { ...question, type: definition.type };
}
return lastValidation;
},
});
// Use validated value if present.
// This ensures the correct type is inserted into the final schema options.
if (finalValue !== undefined) {
answers[definition.id] = finalValue;
}
break;
}
});
const { default: inquirer } = await loadEsmModule('inquirer');
return inquirer.prompt(questions);
}
return answers;
};

@@ -437,21 +452,1 @@ }

}
/**
* Lazily compiled dynamic import loader function.
*/
let load;
/**
* This uses a dynamic import to load a module which may be ESM.
* CommonJS code can load ESM code via a dynamic import. Unfortunately, TypeScript
* will currently, unconditionally downlevel dynamic import into a require call.
* require calls cannot load ESM code and will result in a runtime error. To workaround
* this, a Function constructor is used to prevent TypeScript from changing the dynamic import.
* Once TypeScript provides support for keeping the dynamic import this workaround can
* be dropped.
*
* @param modulePath The path of the module to load.
* @returns A Promise that resolves to the dynamically imported module.
*/
function loadEsmModule(modulePath) {
load ??= new Function('modulePath', `return import(modulePath);`);
return load(modulePath);
}

@@ -6,3 +6,3 @@ /**

* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
* found in the LICENSE file at https://angular.dev/license
*/

@@ -9,0 +9,0 @@ import { Rule } from '@angular-devkit/schematics';

@@ -7,3 +7,3 @@ "use strict";

* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
* found in the LICENSE file at https://angular.dev/license
*/

@@ -10,0 +10,0 @@ Object.defineProperty(exports, "__esModule", { value: true });

{
"name": "@angular-devkit/schematics-cli",
"version": "18.1.0-next.1",
"version": "18.1.0-next.2",
"description": "Angular Schematics - CLI",

@@ -24,9 +24,10 @@ "homepage": "https://github.com/angular/angular-cli",

"dependencies": {
"@angular-devkit/core": "18.1.0-next.1",
"@angular-devkit/schematics": "18.1.0-next.1",
"@angular-devkit/core": "18.1.0-next.2",
"@angular-devkit/schematics": "18.1.0-next.2",
"@inquirer/prompts": "5.0.5",
"ansi-colors": "4.1.3",
"inquirer": "9.2.23",
"symbol-observable": "4.0.0",
"yargs-parser": "21.1.1"
},
"packageManager": "yarn@4.2.2",
"repository": {

@@ -45,3 +46,11 @@ "type": "git",

"url": "https://github.com/angular/angular-cli/issues"
},
"dependenciesMeta": {
"esbuild": {
"built": true
},
"puppeteer": {
"built": true
}
}
}

@@ -6,3 +6,3 @@ /**

* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
* found in the LICENSE file at https://angular.dev/license
*/

@@ -9,0 +9,0 @@ import { Rule } from '@angular-devkit/schematics';

@@ -7,3 +7,3 @@ "use strict";

* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
* found in the LICENSE file at https://angular.dev/license
*/

@@ -10,0 +10,0 @@ Object.defineProperty(exports, "__esModule", { value: true });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc