Updated the project.

This commit is contained in:
Batuhan Berk Başoğlu 2024-06-03 15:44:25 -04:00
parent 5dfe9f128d
commit 7919556077
1550 changed files with 17063 additions and 40183 deletions

View file

@ -59,18 +59,21 @@
"message": "Which stylesheet format would you like to use?",
"type": "list",
"items": [
{ "value": "css", "label": "CSS" },
{
"value": "css",
"label": "CSS [ https://developer.mozilla.org/docs/Web/CSS ]"
},
{
"value": "scss",
"label": "SCSS [ https://sass-lang.com/documentation/syntax#scss ]"
"label": "Sass (SCSS) [ https://sass-lang.com/documentation/syntax#scss ]"
},
{
"value": "sass",
"label": "Sass [ https://sass-lang.com/documentation/syntax#the-indented-syntax ]"
"label": "Sass (Indented) [ https://sass-lang.com/documentation/syntax#the-indented-syntax ]"
},
{
"value": "less",
"label": "Less [ http://lesscss.org ]"
"label": "Less [ http://lesscss.org ]"
}
]
},

View file

@ -1,6 +1,5 @@
import { Injectable } from '@angular/core';
import { <%= routerImports %> } from '@angular/router';
import { Observable } from 'rxjs';
@Injectable({
providedIn: 'root'
@ -8,24 +7,24 @@ import { Observable } from 'rxjs';
export class <%= classify(name) %>Guard implements <%= implementations %> {
<% if (implements.includes('CanActivate')) { %>canActivate(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
state: RouterStateSnapshot): MaybeAsync<GuardResult> {
return true;
}
<% } %><% if (implements.includes('CanActivateChild')) { %>canActivateChild(
childRoute: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
state: RouterStateSnapshot): MaybeAsync<GuardResult> {
return true;
}
<% } %><% if (implements.includes('CanDeactivate')) { %>canDeactivate(
component: unknown,
currentRoute: ActivatedRouteSnapshot,
currentState: RouterStateSnapshot,
nextState?: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
nextState?: RouterStateSnapshot): MaybeAsync<GuardResult> {
return true;
}
<% } %><% if (implements.includes('CanMatch')) { %>canMatch(
route: Route,
segments: UrlSegment[]): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
segments: UrlSegment[]): MaybeAsync<GuardResult> {
return true;
}<% } %>
}

View file

@ -26,7 +26,7 @@ function default_1(options) {
.map((implement) => (implement === 'CanDeactivate' ? 'CanDeactivate<unknown>' : implement))
.join(', ');
const commonRouterNameImports = ['ActivatedRouteSnapshot', 'RouterStateSnapshot'];
const routerNamedImports = [...options.implements, 'UrlTree'];
const routerNamedImports = [...options.implements, 'MaybeAsync', 'GuardResult'];
if (options.implements.includes(schema_1.Implement.CanMatch)) {
routerNamedImports.push('Route', 'UrlSegment');
if (options.implements.length > 1) {

View file

@ -6,4 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import { Rule } from '@angular-devkit/schematics';
/**
* Migration main entrypoint
*/
export default function (): Rule;

View file

@ -7,16 +7,109 @@
* found in the LICENSE file at https://angular.io/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@angular-devkit/core");
const schematics_1 = require("@angular-devkit/schematics");
const posix_1 = require("node:path/posix");
const json_file_1 = require("../../utility/json-file");
const workspace_1 = require("../../utility/workspace");
const workspace_models_1 = require("../../utility/workspace-models");
function default_1() {
return async (tree, context) => {
const css_import_lexer_1 = require("./css-import-lexer");
function* updateBuildTarget(projectName, buildTarget, serverTarget, tree, context) {
// Update builder target and options
buildTarget.builder = workspace_models_1.Builders.Application;
for (const [, options] of (0, workspace_1.allTargetOptions)(buildTarget, false)) {
// Show warnings for using no longer supported options
if (usesNoLongerSupportedOptions(options, context, projectName)) {
continue;
}
if (options['index'] === '') {
options['index'] = false;
}
// Rename and transform options
options['browser'] = options['main'];
if (serverTarget && typeof options['browser'] === 'string') {
options['server'] = (0, posix_1.dirname)(options['browser']) + '/main.server.ts';
}
options['serviceWorker'] = options['ngswConfigPath'] ?? options['serviceWorker'];
if (typeof options['polyfills'] === 'string') {
options['polyfills'] = [options['polyfills']];
}
let outputPath = options['outputPath'];
if (typeof outputPath === 'string') {
if (!/\/browser\/?$/.test(outputPath)) {
// TODO: add prompt.
context.logger.warn(`The output location of the browser build has been updated from "${outputPath}" to ` +
`"${(0, posix_1.join)(outputPath, 'browser')}". ` +
'You might need to adjust your deployment pipeline or, as an alternative, ' +
'set outputPath.browser to "" in order to maintain the previous functionality.');
}
else {
outputPath = outputPath.replace(/\/browser\/?$/, '');
}
options['outputPath'] = {
base: outputPath,
};
if (typeof options['resourcesOutputPath'] === 'string') {
const media = options['resourcesOutputPath'].replaceAll('/', '');
if (media && media !== 'media') {
options['outputPath'] = {
base: outputPath,
media,
};
}
}
}
// Delete removed options
delete options['deployUrl'];
delete options['vendorChunk'];
delete options['commonChunk'];
delete options['resourcesOutputPath'];
delete options['buildOptimizer'];
delete options['main'];
delete options['ngswConfigPath'];
}
// Merge browser and server tsconfig
if (serverTarget) {
const browserTsConfig = buildTarget.options?.tsConfig;
const serverTsConfig = serverTarget.options?.tsConfig;
if (typeof browserTsConfig !== 'string') {
throw new schematics_1.SchematicsException(`Cannot update project "${projectName}" to use the application builder` +
` as the browser tsconfig cannot be located.`);
}
if (typeof serverTsConfig !== 'string') {
throw new schematics_1.SchematicsException(`Cannot update project "${projectName}" to use the application builder` +
` as the server tsconfig cannot be located.`);
}
const browserJson = new json_file_1.JSONFile(tree, browserTsConfig);
const serverJson = new json_file_1.JSONFile(tree, serverTsConfig);
const filesPath = ['files'];
const files = new Set([
...(browserJson.get(filesPath) ?? []),
...(serverJson.get(filesPath) ?? []),
]);
// Server file will be added later by the means of the ssr schematic.
files.delete('server.ts');
browserJson.modify(filesPath, Array.from(files));
const typesPath = ['compilerOptions', 'types'];
browserJson.modify(typesPath, Array.from(new Set([
...(browserJson.get(typesPath) ?? []),
...(serverJson.get(typesPath) ?? []),
])));
// Delete server tsconfig
yield deleteFile(serverTsConfig);
}
// Update server file
const ssrMainFile = serverTarget?.options?.['main'];
if (typeof ssrMainFile === 'string') {
yield deleteFile(ssrMainFile);
yield (0, schematics_1.externalSchematic)('@schematics/angular', 'ssr', {
project: projectName,
skipInstall: true,
});
}
}
function updateProjects(tree, context) {
return (0, workspace_1.updateWorkspace)((workspace) => {
const rules = [];
const workspace = await (0, workspace_1.getWorkspace)(tree);
for (const [name, project] of workspace.projects) {
if (project.extensions.projectType !== workspace_models_1.ProjectType.Application) {
// Only interested in application projects since these changes only effects application builders
@ -32,107 +125,8 @@ function default_1() {
` Only "${workspace_models_1.Builders.BrowserEsbuild}" and "${workspace_models_1.Builders.Browser}" can be automatically migrated.`);
continue;
}
// Update builder target and options
buildTarget.builder = workspace_models_1.Builders.Application;
const hasServerTarget = project.targets.has('server');
for (const [, options] of (0, workspace_1.allTargetOptions)(buildTarget, false)) {
// Show warnings for using no longer supported options
if (usesNoLongerSupportedOptions(options, context, name)) {
continue;
}
if (options['index'] === '') {
options['index'] = false;
}
// Rename and transform options
options['browser'] = options['main'];
if (hasServerTarget && typeof options['browser'] === 'string') {
options['server'] = (0, posix_1.dirname)(options['browser']) + '/main.server.ts';
}
options['serviceWorker'] = options['ngswConfigPath'] ?? options['serviceWorker'];
if (typeof options['polyfills'] === 'string') {
options['polyfills'] = [options['polyfills']];
}
let outputPath = options['outputPath'];
if (typeof outputPath === 'string') {
if (!/\/browser\/?$/.test(outputPath)) {
// TODO: add prompt.
context.logger.warn(`The output location of the browser build has been updated from "${outputPath}" to ` +
`"${(0, posix_1.join)(outputPath, 'browser')}". ` +
'You might need to adjust your deployment pipeline or, as an alternative, ' +
'set outputPath.browser to "" in order to maintain the previous functionality.');
}
else {
outputPath = outputPath.replace(/\/browser\/?$/, '');
}
options['outputPath'] = {
base: outputPath,
};
if (typeof options['resourcesOutputPath'] === 'string') {
const media = options['resourcesOutputPath'].replaceAll('/', '');
if (media && media !== 'media') {
options['outputPath'] = {
base: outputPath,
media: media,
};
}
}
}
// Delete removed options
delete options['deployUrl'];
delete options['vendorChunk'];
delete options['commonChunk'];
delete options['resourcesOutputPath'];
delete options['buildOptimizer'];
delete options['main'];
delete options['ngswConfigPath'];
}
// Merge browser and server tsconfig
if (hasServerTarget) {
const browserTsConfig = buildTarget?.options?.tsConfig;
const serverTsConfig = project.targets.get('server')?.options?.tsConfig;
if (typeof browserTsConfig !== 'string') {
throw new schematics_1.SchematicsException(`Cannot update project "${name}" to use the application builder` +
` as the browser tsconfig cannot be located.`);
}
if (typeof serverTsConfig !== 'string') {
throw new schematics_1.SchematicsException(`Cannot update project "${name}" to use the application builder` +
` as the server tsconfig cannot be located.`);
}
const browserJson = new json_file_1.JSONFile(tree, browserTsConfig);
const serverJson = new json_file_1.JSONFile(tree, serverTsConfig);
const filesPath = ['files'];
const files = new Set([
...(browserJson.get(filesPath) ?? []),
...(serverJson.get(filesPath) ?? []),
]);
// Server file will be added later by the means of the ssr schematic.
files.delete('server.ts');
browserJson.modify(filesPath, Array.from(files));
const typesPath = ['compilerOptions', 'types'];
browserJson.modify(typesPath, Array.from(new Set([
...(browserJson.get(typesPath) ?? []),
...(serverJson.get(typesPath) ?? []),
])));
// Delete server tsconfig
tree.delete(serverTsConfig);
}
// Update main tsconfig
const rootJson = new json_file_1.JSONFile(tree, 'tsconfig.json');
rootJson.modify(['compilerOptions', 'esModuleInterop'], true);
rootJson.modify(['compilerOptions', 'downlevelIteration'], undefined);
rootJson.modify(['compilerOptions', 'allowSyntheticDefaultImports'], undefined);
// Update server file
const ssrMainFile = project.targets.get('server')?.options?.['main'];
if (typeof ssrMainFile === 'string') {
tree.delete(ssrMainFile);
rules.push((0, schematics_1.externalSchematic)('@schematics/angular', 'ssr', {
project: name,
skipInstall: true,
}));
}
// Delete package.json helper scripts
const pkgJson = new json_file_1.JSONFile(tree, 'package.json');
['build:ssr', 'dev:ssr', 'serve:ssr', 'prerender'].forEach((s) => pkgJson.remove(['scripts', s]));
const serverTarget = project.targets.get('server');
rules.push(...updateBuildTarget(name, buildTarget, serverTarget, tree, context));
// Delete all redundant targets
for (const [key, target] of project.targets) {
switch (target.builder) {
@ -144,14 +138,131 @@ function default_1() {
break;
}
}
// Update CSS/Sass import specifiers
const projectSourceRoot = (0, posix_1.join)(project.root, project.sourceRoot ?? 'src');
updateStyleImports(tree, projectSourceRoot, buildTarget);
}
// Save workspace changes
await core_1.workspaces.writeWorkspace(workspace, new workspace_1.TreeWorkspaceHost(tree));
return (0, schematics_1.chain)(rules);
});
}
function* visit(directory) {
for (const path of directory.subfiles) {
const sass = path.endsWith('.scss');
if (path.endsWith('.css') || sass) {
const entry = directory.file(path);
if (entry) {
const content = entry.content;
yield [entry.path, content.toString(), sass];
}
}
}
for (const path of directory.subdirs) {
if (path === 'node_modules' || path.startsWith('.')) {
continue;
}
yield* visit(directory.dir(path));
}
}
// Based on https://github.com/sass/dart-sass/blob/44d6bb6ac72fe6b93f5bfec371a1fffb18e6b76d/lib/src/importer/utils.dart
function* potentialSassImports(specifier, base, fromImport) {
const directory = (0, posix_1.join)(base, (0, posix_1.dirname)(specifier));
const extension = (0, posix_1.extname)(specifier);
const hasStyleExtension = extension === '.scss' || extension === '.sass' || extension === '.css';
// Remove the style extension if present to allow adding the `.import` suffix
const filename = (0, posix_1.basename)(specifier, hasStyleExtension ? extension : undefined);
if (hasStyleExtension) {
if (fromImport) {
yield (0, posix_1.join)(directory, filename + '.import' + extension);
yield (0, posix_1.join)(directory, '_' + filename + '.import' + extension);
}
yield (0, posix_1.join)(directory, filename + extension);
yield (0, posix_1.join)(directory, '_' + filename + extension);
}
else {
if (fromImport) {
yield (0, posix_1.join)(directory, filename + '.import.scss');
yield (0, posix_1.join)(directory, filename + '.import.sass');
yield (0, posix_1.join)(directory, filename + '.import.css');
yield (0, posix_1.join)(directory, '_' + filename + '.import.scss');
yield (0, posix_1.join)(directory, '_' + filename + '.import.sass');
yield (0, posix_1.join)(directory, '_' + filename + '.import.css');
}
yield (0, posix_1.join)(directory, filename + '.scss');
yield (0, posix_1.join)(directory, filename + '.sass');
yield (0, posix_1.join)(directory, filename + '.css');
yield (0, posix_1.join)(directory, '_' + filename + '.scss');
yield (0, posix_1.join)(directory, '_' + filename + '.sass');
yield (0, posix_1.join)(directory, '_' + filename + '.css');
}
}
function updateStyleImports(tree, projectSourceRoot, buildTarget) {
const external = new Set();
let needWorkspaceIncludePath = false;
for (const file of visit(tree.getDir(projectSourceRoot))) {
const [path, content, sass] = file;
const relativeBase = (0, posix_1.dirname)(path);
let updater;
for (const { start, specifier, fromUse } of (0, css_import_lexer_1.findImports)(content, sass)) {
if (specifier[0] === '~') {
updater ??= tree.beginUpdate(path);
// start position includes the opening quote
updater.remove(start + 1, 1);
}
else if (specifier[0] === '^') {
updater ??= tree.beginUpdate(path);
// start position includes the opening quote
updater.remove(start + 1, 1);
// Add to externalDependencies
external.add(specifier.slice(1));
}
else if (sass &&
[...potentialSassImports(specifier, relativeBase, !fromUse)].every((v) => !tree.exists(v)) &&
[...potentialSassImports(specifier, '/', !fromUse)].some((v) => tree.exists(v))) {
needWorkspaceIncludePath = true;
}
}
if (updater) {
tree.commitUpdate(updater);
}
}
if (needWorkspaceIncludePath) {
buildTarget.options ??= {};
buildTarget.options['stylePreprocessorOptions'] ??= {};
(buildTarget.options['stylePreprocessorOptions']['includePaths'] ??= []).push('.');
}
if (external.size > 0) {
buildTarget.options ??= {};
(buildTarget.options['externalDependencies'] ??= []).push(...external);
}
}
function deleteFile(path) {
return (tree) => {
tree.delete(path);
};
}
function updateJsonFile(path, updater) {
return (tree) => {
updater(new json_file_1.JSONFile(tree, path));
};
}
/**
* Migration main entrypoint
*/
function default_1() {
return (0, schematics_1.chain)([
updateProjects,
// Delete package.json helper scripts
updateJsonFile('package.json', (pkgJson) => ['build:ssr', 'dev:ssr', 'serve:ssr', 'prerender'].forEach((s) => pkgJson.remove(['scripts', s]))),
// Update main tsconfig
updateJsonFile('tsconfig.json', (rootJson) => {
rootJson.modify(['compilerOptions', 'esModuleInterop'], true);
rootJson.modify(['compilerOptions', 'downlevelIteration'], undefined);
rootJson.modify(['compilerOptions', 'allowSyntheticDefaultImports'], undefined);
}),
]);
}
exports.default = default_1;
function usesNoLongerSupportedOptions({ deployUrl, resourcesOutputPath }, context, projectName) {
function usesNoLongerSupportedOptions({ deployUrl }, context, projectName) {
let hasUsage = false;
if (typeof deployUrl === 'string') {
hasUsage = true;

View file

@ -108,6 +108,7 @@ export interface CommitObject {
* The package manager used to install dependencies.
*/
export declare enum PackageManager {
Bun = "bun",
Cnpm = "cnpm",
Npm = "npm",
Pnpm = "pnpm",

View file

@ -8,6 +8,7 @@ exports.ViewEncapsulation = exports.Style = exports.PackageManager = void 0;
*/
var PackageManager;
(function (PackageManager) {
PackageManager["Bun"] = "bun";
PackageManager["Cnpm"] = "cnpm";
PackageManager["Npm"] = "npm";
PackageManager["Pnpm"] = "pnpm";

View file

@ -132,7 +132,7 @@
"packageManager": {
"description": "The package manager used to install dependencies.",
"type": "string",
"enum": ["npm", "yarn", "pnpm", "cnpm"]
"enum": ["npm", "yarn", "pnpm", "cnpm", "bun"]
},
"standalone": {
"description": "Creates an application based upon the standalone API, without NgModules.",

View file

@ -1,6 +1,6 @@
{
"name": "@schematics/angular",
"version": "17.1.3",
"version": "17.3.8",
"description": "Schematics specific to Angular",
"homepage": "https://github.com/angular/angular-cli",
"keywords": [
@ -23,9 +23,9 @@
},
"schematics": "./collection.json",
"dependencies": {
"@angular-devkit/core": "17.1.3",
"@angular-devkit/schematics": "17.1.3",
"jsonc-parser": "3.2.0"
"@angular-devkit/core": "17.3.8",
"@angular-devkit/schematics": "17.3.8",
"jsonc-parser": "3.2.1"
},
"repository": {
"type": "git",

View file

@ -42,7 +42,7 @@ export declare function addModuleImportToStandaloneBootstrap(tree: Tree, filePat
* @param functionName Name of the function that should be called.
* @param importPath Path from which to import the function.
* @param args Arguments to use when calling the function.
* @returns The file path that the provider was added to.
* @return The file path that the provider was added to.
* @deprecated Private utility that will be removed. Use `addRootImport` or `addRootProvider` from
* `@schematics/angular/utility` instead.
*/

View file

@ -127,7 +127,7 @@ exports.addModuleImportToStandaloneBootstrap = addModuleImportToStandaloneBootst
* @param functionName Name of the function that should be called.
* @param importPath Path from which to import the function.
* @param args Arguments to use when calling the function.
* @returns The file path that the provider was added to.
* @return The file path that the provider was added to.
* @deprecated Private utility that will be removed. Use `addRootImport` or `addRootProvider` from
* `@schematics/angular/utility` instead.
*/

View file

@ -49,9 +49,11 @@ declare namespace ts {
readonly fileName: Path;
readonly packageName: string;
readonly projectRootPath: Path;
readonly id: number;
}
interface PackageInstalledResponse extends ProjectResponse {
readonly kind: ActionPackageInstalled;
readonly id: number;
readonly success: boolean;
readonly message: string;
}
@ -203,7 +205,7 @@ declare namespace ts {
/**
* Request to reload the project structure for all the opened files
*/
interface ReloadProjectsRequest extends Message {
interface ReloadProjectsRequest extends Request {
command: CommandTypes.ReloadProjects;
}
/**
@ -1085,6 +1087,7 @@ declare namespace ts {
displayName: string;
/**
* Full display name of item to be renamed.
* If item to be renamed is a file, then this is the original text of the module specifer
*/
fullDisplayName: string;
/**
@ -2930,6 +2933,13 @@ declare namespace ts {
* Default: `false`
*/
readonly organizeImportsCaseFirst?: "upper" | "lower" | false;
/**
* Indicates where named type-only imports should sort. "inline" sorts named imports without regard to if the import is
* type-only.
*
* Default: `last`
*/
readonly organizeImportsTypeOrder?: "last" | "first" | "inline";
/**
* Indicates whether {@link ReferencesResponseItem.lineText} is supported.
*/
@ -3026,10 +3036,18 @@ declare namespace ts {
ES6 = "ES6",
ES2015 = "ES2015",
ESNext = "ESNext",
Node16 = "Node16",
NodeNext = "NodeNext",
Preserve = "Preserve",
}
enum ModuleResolutionKind {
Classic = "Classic",
/** @deprecated Renamed to `Node10` */
Node = "Node",
Node10 = "Node10",
Node16 = "Node16",
NodeNext = "NodeNext",
Bundler = "Bundler",
}
enum NewLineKind {
Crlf = "Crlf",
@ -3314,18 +3332,6 @@ declare namespace ts {
* Last version that was reported.
*/
private lastReportedVersion;
/**
* Current project's program version. (incremented everytime new program is created that is not complete reuse from the old one)
* This property is changed in 'updateGraph' based on the set of files in program
*/
private projectProgramVersion;
/**
* Current version of the project state. It is changed when:
* - new root file was added/removed
* - edit happen in some file that is currently included in the project.
* This property is different from projectStructureVersion since in most cases edits don't affect set of files in the project
*/
private projectStateVersion;
protected projectErrors: Diagnostic[] | undefined;
protected isInitialLoadPending: () => boolean;
private readonly cancellationToken;
@ -3900,6 +3906,7 @@ declare namespace ts {
private static escapeFilenameForRegex;
resetSafeList(): void;
applySafeList(proj: protocol.ExternalProject): NormalizedPath[];
private applySafeListWorker;
openExternalProject(proj: protocol.ExternalProject): void;
hasDeferredExtension(): boolean;
private enableRequestedPluginsAsync;
@ -4132,7 +4139,7 @@ declare namespace ts {
responseRequired?: boolean;
}
}
const versionMajorMinor = "5.3";
const versionMajorMinor = "5.4";
/** The version of the TypeScript compiler release */
const version: string;
/**
@ -6018,9 +6025,11 @@ declare namespace ts {
/** @deprecated */
type AssertionKey = ImportAttributeName;
/** @deprecated */
type AssertEntry = ImportAttribute;
interface AssertEntry extends ImportAttribute {
}
/** @deprecated */
type AssertClause = ImportAttributes;
interface AssertClause extends ImportAttributes {
}
type ImportAttributeName = Identifier | StringLiteral;
interface ImportAttribute extends Node {
readonly kind: SyntaxKind.ImportAttribute;
@ -6648,6 +6657,22 @@ declare namespace ts {
};
isSourceFileFromExternalLibrary(file: SourceFile): boolean;
isSourceFileDefaultLibrary(file: SourceFile): boolean;
/**
* Calculates the final resolution mode for a given module reference node. This is the resolution mode explicitly provided via import
* attributes, if present, or the syntax the usage would have if emitted to JavaScript. In `--module node16` or `nodenext`, this may
* depend on the file's `impliedNodeFormat`. In `--module preserve`, it depends only on the input syntax of the reference. In other
* `module` modes, when overriding import attributes are not provided, this function returns `undefined`, as the result would have no
* impact on module resolution, emit, or type checking.
*/
getModeForUsageLocation(file: SourceFile, usage: StringLiteralLike): ResolutionMode;
/**
* Calculates the final resolution mode for an import at some index within a file's `imports` list. This is the resolution mode
* explicitly provided via import attributes, if present, or the syntax the usage would have if emitted to JavaScript. In
* `--module node16` or `nodenext`, this may depend on the file's `impliedNodeFormat`. In `--module preserve`, it depends only on the
* input syntax of the reference. In other `module` modes, when overriding import attributes are not provided, this function returns
* `undefined`, as the result would have no impact on module resolution, emit, or type checking.
*/
getModeForResolutionAtIndex(file: SourceFile, index: number): ResolutionMode;
getProjectReferences(): readonly ProjectReference[] | undefined;
getResolvedProjectReferences(): readonly (ResolvedProjectReference | undefined)[] | undefined;
}
@ -6827,6 +6852,20 @@ declare namespace ts {
* is `never`. Instead, use `type.flags & TypeFlags.Never`.
*/
getNeverType(): Type;
/**
* Returns true if the "source" type is assignable to the "target" type.
*
* ```ts
* declare const abcLiteral: ts.Type; // Type of "abc"
* declare const stringType: ts.Type; // Type of string
*
* isTypeAssignableTo(abcLiteral, abcLiteral); // true; "abc" is assignable to "abc"
* isTypeAssignableTo(abcLiteral, stringType); // true; "abc" is assignable to string
* isTypeAssignableTo(stringType, abcLiteral); // false; string is not assignable to "abc"
* isTypeAssignableTo(stringType, stringType); // true; string is assignable to string
* ```
*/
isTypeAssignableTo(source: Type, target: Type): boolean;
/**
* True if this type is the `Array` or `ReadonlyArray` type from lib.d.ts.
* This function will _not_ return true if passed a type which
@ -6842,6 +6881,7 @@ declare namespace ts {
* True if this type is assignable to `ReadonlyArray<any>`.
*/
isArrayLikeType(type: Type): boolean;
resolveName(name: string, location: Node | undefined, meaning: SymbolFlags, excludeGlobals: boolean): Symbol | undefined;
getTypePredicateOfSignature(signature: Signature): TypePredicate | undefined;
/**
* Depending on the operation performed, it may be appropriate to throw away the checker
@ -6887,6 +6927,7 @@ declare namespace ts {
None = 0,
NoTruncation = 1,
WriteArrayAsGenericType = 2,
GenerateNamesForShadowedTypeParams = 4,
UseStructuralFallback = 8,
WriteTypeArgumentsOfSignature = 32,
UseFullyQualifiedType = 64,
@ -6906,7 +6947,7 @@ declare namespace ts {
InElementType = 2097152,
InFirstTypeArgument = 4194304,
InTypeAlias = 8388608,
NodeBuilderFlagsMask = 848330091,
NodeBuilderFlagsMask = 848330095,
}
enum SymbolFormatFlags {
None = 0,
@ -6980,6 +7021,7 @@ declare namespace ts {
Transient = 33554432,
Assignment = 67108864,
ModuleExports = 134217728,
All = -1,
Enum = 384,
Variable = 3,
Value = 111551,
@ -7048,6 +7090,8 @@ declare namespace ts {
ExportEquals = "export=",
Default = "default",
This = "this",
InstantiationExpression = "__instantiationExpression",
ImportAttributes = "__importAttributes",
}
/**
* This represents a string whose leading underscore have been escaped by adding extra leading underscores.
@ -7612,6 +7656,7 @@ declare namespace ts {
ESNext = 99,
Node16 = 100,
NodeNext = 199,
Preserve = 200,
}
enum JsxEmit {
None = 0,
@ -7890,6 +7935,7 @@ declare namespace ts {
Unspecified = 4,
EmbeddedStatement = 5,
JsxAttributeValue = 6,
ImportTypeNodeAttributes = 7,
}
enum OuterExpressionKinds {
Parentheses = 1,
@ -8762,6 +8808,7 @@ declare namespace ts {
readonly organizeImportsNumericCollation?: boolean;
readonly organizeImportsAccentCollation?: boolean;
readonly organizeImportsCaseFirst?: "upper" | "lower" | false;
readonly organizeImportsTypeOrder?: "first" | "last" | "inline";
readonly excludeLibrarySymbolsInNavTo?: boolean;
}
/** Represents a bigint literal value without requiring bigint support */
@ -9167,6 +9214,7 @@ declare namespace ts {
function isForInitializer(node: Node): node is ForInitializer;
function isModuleBody(node: Node): node is ModuleBody;
function isNamedImportBindings(node: Node): node is NamedImportBindings;
function isDeclarationStatement(node: Node): node is DeclarationStatement;
function isStatement(node: Node): node is Statement;
function isModuleReference(node: Node): node is ModuleReference;
function isJsxTagNameExpression(node: Node): node is JsxTagNameExpression;
@ -9186,11 +9234,13 @@ declare namespace ts {
function isJSDocLinkLike(node: Node): node is JSDocLink | JSDocLinkCode | JSDocLinkPlain;
function hasRestParameter(s: SignatureDeclaration | JSDocSignature): boolean;
function isRestParameter(node: ParameterDeclaration | JSDocParameterTag): boolean;
function isInternalDeclaration(node: Node, sourceFile?: SourceFile): boolean;
const unchangedTextChangeRange: TextChangeRange;
type ParameterPropertyDeclaration = ParameterDeclaration & {
parent: ConstructorDeclaration;
name: Identifier;
};
function isPartOfTypeNode(node: Node): boolean;
/**
* This function checks multiple locations for JSDoc comments that apply to a host node.
* At each location, the whole comment may apply to the node, or only a specific tag in
@ -9829,7 +9879,7 @@ declare namespace ts {
* @param visitor The callback used to visit each child.
* @param context A lexical environment context for the visitor.
*/
function visitEachChild<T extends Node>(node: T, visitor: Visitor, context: TransformationContext): T;
function visitEachChild<T extends Node>(node: T, visitor: Visitor, context: TransformationContext | undefined): T;
/**
* Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place.
*
@ -9837,7 +9887,7 @@ declare namespace ts {
* @param visitor The callback used to visit each child.
* @param context A lexical environment context for the visitor.
*/
function visitEachChild<T extends Node>(node: T | undefined, visitor: Visitor, context: TransformationContext, nodesVisitor?: typeof visitNodes, tokenVisitor?: Visitor): T | undefined;
function visitEachChild<T extends Node>(node: T | undefined, visitor: Visitor, context: TransformationContext | undefined, nodesVisitor?: typeof visitNodes, tokenVisitor?: Visitor): T | undefined;
function getTsBuildInfoEmitOutputFilePath(options: CompilerOptions): string | undefined;
function getOutputFileNames(commandLine: ParsedCommandLine, inputFileName: string, ignoreCase: boolean): readonly string[];
function createPrinter(printerOptions?: PrinterOptions, handlers?: PrintHandlers): Printer;
@ -9868,37 +9918,50 @@ declare namespace ts {
*/
function getModeForFileReference(ref: FileReference | string, containingFileMode: ResolutionMode): ResolutionMode;
/**
* Calculates the final resolution mode for an import at some index within a file's imports list. This is generally the explicitly
* defined mode of the import if provided, or, if not, the mode of the containing file (with some exceptions: import=require is always commonjs, dynamic import is always esm).
* If you have an actual import node, prefer using getModeForUsageLocation on the reference string node.
* Use `program.getModeForResolutionAtIndex`, which retrieves the correct `compilerOptions`, instead of this function whenever possible.
* Calculates the final resolution mode for an import at some index within a file's `imports` list. This is the resolution mode
* explicitly provided via import attributes, if present, or the syntax the usage would have if emitted to JavaScript. In
* `--module node16` or `nodenext`, this may depend on the file's `impliedNodeFormat`. In `--module preserve`, it depends only on the
* input syntax of the reference. In other `module` modes, when overriding import attributes are not provided, this function returns
* `undefined`, as the result would have no impact on module resolution, emit, or type checking.
* @param file File to fetch the resolution mode within
* @param index Index into the file's complete resolution list to get the resolution of - this is a concatenation of the file's imports and module augmentations
* @param compilerOptions The compiler options for the program that owns the file. If the file belongs to a referenced project, the compiler options
* should be the options of the referenced project, not the referencing project.
*/
function getModeForResolutionAtIndex(file: SourceFile, index: number): ResolutionMode;
function getModeForResolutionAtIndex(file: SourceFile, index: number, compilerOptions: CompilerOptions): ResolutionMode;
/**
* Calculates the final resolution mode for a given module reference node. This is generally the explicitly provided resolution mode, if
* one exists, or the mode of the containing source file. (Excepting import=require, which is always commonjs, and dynamic import, which is always esm).
* Notably, this function always returns `undefined` if the containing file has an `undefined` `impliedNodeFormat` - this field is only set when
* `moduleResolution` is `node16`+.
* Use `program.getModeForUsageLocation`, which retrieves the correct `compilerOptions`, instead of this function whenever possible.
* Calculates the final resolution mode for a given module reference node. This is the resolution mode explicitly provided via import
* attributes, if present, or the syntax the usage would have if emitted to JavaScript. In `--module node16` or `nodenext`, this may
* depend on the file's `impliedNodeFormat`. In `--module preserve`, it depends only on the input syntax of the reference. In other
* `module` modes, when overriding import attributes are not provided, this function returns `undefined`, as the result would have no
* impact on module resolution, emit, or type checking.
* @param file The file the import or import-like reference is contained within
* @param usage The module reference string
* @param compilerOptions The compiler options for the program that owns the file. If the file belongs to a referenced project, the compiler options
* should be the options of the referenced project, not the referencing project.
* @returns The final resolution mode of the import
*/
function getModeForUsageLocation(file: {
impliedNodeFormat?: ResolutionMode;
}, usage: StringLiteralLike): ModuleKind.CommonJS | ModuleKind.ESNext | undefined;
function getModeForUsageLocation(
file: {
impliedNodeFormat?: ResolutionMode;
},
usage: StringLiteralLike,
compilerOptions: CompilerOptions,
): ModuleKind.CommonJS | ModuleKind.ESNext | undefined;
function getConfigFileParsingDiagnostics(configFileParseResult: ParsedCommandLine): readonly Diagnostic[];
/**
* A function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the
* `options` parameter.
*
* @param fileName The normalized absolute path to check the format of (it need not exist on disk)
* @param fileName The file name to check the format of (it need not exist on disk)
* @param [packageJsonInfoCache] A cache for package file lookups - it's best to have a cache when this function is called often
* @param host The ModuleResolutionHost which can perform the filesystem lookups for package json data
* @param options The compiler options to perform the analysis under - relevant options are `moduleResolution` and `traceResolution`
* @returns `undefined` if the path has no relevant implied format, `ModuleKind.ESNext` for esm format, and `ModuleKind.CommonJS` for cjs format
*/
function getImpliedNodeFormatForFile(fileName: Path, packageJsonInfoCache: PackageJsonInfoCache | undefined, host: ModuleResolutionHost, options: CompilerOptions): ResolutionMode;
function getImpliedNodeFormatForFile(fileName: string, packageJsonInfoCache: PackageJsonInfoCache | undefined, host: ModuleResolutionHost, options: CompilerOptions): ResolutionMode;
/**
* Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions'
* that represent a compilation unit.
@ -10416,7 +10479,7 @@ declare namespace ts {
installPackage?(options: InstallPackageOptions): Promise<ApplyCodeActionCommandResult>;
writeFile?(fileName: string, content: string): void;
getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined;
jsDocParsingMode?: JSDocParsingMode;
jsDocParsingMode?: JSDocParsingMode | undefined;
}
type WithMetadata<T> = T & {
metadata?: unknown;
@ -11085,6 +11148,10 @@ declare namespace ts {
*/
fileToRename?: string;
displayName: string;
/**
* Full display name of item to be renamed.
* If item to be renamed is a file, then this is the original text of the module specifer
*/
fullDisplayName: string;
kind: ScriptElementKind;
kindModifiers: string;
@ -11612,6 +11679,7 @@ declare namespace ts {
moduleName?: string;
renamedDependencies?: MapLike<string>;
transformers?: CustomTransformers;
jsDocParsingMode?: JSDocParsingMode;
}
interface TranspileOutput {
outputText: string;

View file

@ -8,12 +8,13 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.latestVersions = void 0;
// We could have used TypeScripts' `resolveJsonModule` to make the `latestVersion` object typesafe,
// but ts_library doesn't support JSON inputs.
const dependencies = require('./latest-versions/package.json')['dependencies'];
exports.latestVersions = {
// We could have used TypeScripts' `resolveJsonModule` to make the `latestVersion` object typesafe,
// but ts_library doesn't support JSON inputs.
...require('./latest-versions/package.json')['dependencies'],
...dependencies,
// As Angular CLI works with same minor versions of Angular Framework, a tilde match for the current
Angular: '^17.1.0',
DevkitBuildAngular: '^17.1.3',
AngularSSR: '^17.1.3',
Angular: dependencies['@angular/core'],
DevkitBuildAngular: '^17.3.8',
AngularSSR: '^17.3.8',
};

View file

@ -3,6 +3,7 @@
"comment": "This file is needed so that dependencies are synced by Renovate.",
"private": true,
"dependencies": {
"@angular/core": "^17.3.0",
"@types/express": "^4.17.17",
"@types/jasmine": "~5.1.0",
"@types/node": "^18.18.0",
@ -15,12 +16,12 @@
"karma-jasmine-html-reporter": "~2.1.0",
"karma-jasmine": "~5.1.0",
"karma": "~6.4.0",
"ng-packagr": "^17.1.0",
"ng-packagr": "^17.3.0",
"protractor": "~7.0.0",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"ts-node": "~10.9.0",
"typescript": "~5.3.2",
"typescript": "~5.4.2",
"zone.js": "~0.14.3"
}
}

View file

@ -13,7 +13,7 @@ export interface PendingCode {
/** Imports that need to be added to the file in which the code is inserted. */
imports: PendingImports;
}
/** Map keeping track of imports and aliases under which they're referred to in an expresion. */
/** Map keeping track of imports and aliases under which they're referred to in an expression. */
type PendingImports = Map<string, Map<string, string>>;
/**
* Callback invoked by a Rule that produces the code

View file

@ -1,4 +1,4 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.
# Compiled output
/dist

View file

@ -3,7 +3,6 @@
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",<% if (strict) { %>
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,

View file

@ -34,6 +34,7 @@ export interface Schema {
* The package manager used to install dependencies.
*/
export declare enum PackageManager {
Bun = "bun",
Cnpm = "cnpm",
Npm = "npm",
Pnpm = "pnpm",

View file

@ -8,6 +8,7 @@ exports.PackageManager = void 0;
*/
var PackageManager;
(function (PackageManager) {
PackageManager["Bun"] = "bun";
PackageManager["Cnpm"] = "cnpm";
PackageManager["Npm"] = "npm";
PackageManager["Pnpm"] = "pnpm";

View file

@ -40,7 +40,7 @@
"packageManager": {
"description": "The package manager used to install dependencies.",
"type": "string",
"enum": ["npm", "yarn", "pnpm", "cnpm"]
"enum": ["npm", "yarn", "pnpm", "cnpm", "bun"]
}
},
"required": ["name", "version"]