This commit is contained in:
CHEVALLIER Abel
2025-11-13 16:23:22 +01:00
parent de9c515a47
commit cb235644dc
34924 changed files with 3811102 additions and 0 deletions

18
node_modules/@angular/cdk/schematics/collection.json generated vendored Executable file
View File

@@ -0,0 +1,18 @@
{
"$schema": "./node_modules/@angular-devkit/schematics/collection-schema.json",
"schematics": {
"ng-add": {
"description": "Installs the Angular CDK",
"factory": "./ng-add/index",
"schema": "./ng-add/schema.json",
"aliases": ["install"],
"hidden": true
},
"drag-drop": {
"description": "Generates a component using the Drag and Drop module",
"factory": "./ng-generate/drag-drop/index",
"schema": "./ng-generate/drag-drop/schema.json",
"aliases": ["dragdrop", "drag-and-drop"]
}
}
}

14
node_modules/@angular/cdk/schematics/index.d.ts generated vendored Executable file
View File

@@ -0,0 +1,14 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
export * from './utils';
export * from './ng-update/public-api';
export * from './update-tool/public-api';
export * from '@schematics/angular/utility/ast-utils';
export * from '@schematics/angular/utility/ng-ast-utils';
import * as parse5 from 'parse5';
export { parse5 };

37
node_modules/@angular/cdk/schematics/index.js generated vendored Executable file
View File

@@ -0,0 +1,37 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.parse5 = void 0;
__exportStar(require("./utils"), exports);
__exportStar(require("./ng-update/public-api"), exports);
__exportStar(require("./update-tool/public-api"), exports);
// Re-exported so that Angular Material schematic code can consume the same AST utils as the CDK.
__exportStar(require("@schematics/angular/utility/ast-utils"), exports);
__exportStar(require("@schematics/angular/utility/ng-ast-utils"), exports);
// Re-export parse5 from the CDK. Material schematics code cannot simply import
// "parse5" because it could result in a different version. As long as we import
// it from within the CDK, it will always be the correct version that is specified
// in the CDK "package.json" as optional dependency.
const parse5 = require("parse5");
exports.parse5 = parse5;
//# sourceMappingURL=index.js.map

1
node_modules/@angular/cdk/schematics/index.js.map generated vendored Executable file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;AAEH,0CAAwB;AACxB,yDAAuC;AACvC,2DAAyC;AAEzC,iGAAiG;AACjG,wEAAsD;AACtD,2EAAyD;AAEzD,+EAA+E;AAC/E,gFAAgF;AAChF,kFAAkF;AAClF,oDAAoD;AACpD,iCAAiC;AACzB,wBAAM"}

15
node_modules/@angular/cdk/schematics/migration.json generated vendored Executable file
View File

@@ -0,0 +1,15 @@
{
"$schema": "./node_modules/@angular-devkit/schematics/collection-schema.json",
"schematics": {
"migration-v20": {
"version": "20.0.0-0",
"description": "Updates the Angular CDK to v20",
"factory": "./ng-update/index#updateToV20"
},
"ng-post-update": {
"description": "Prints out results after ng-update.",
"factory": "./ng-update/index#postUpdate",
"private": true
}
}
}

17
node_modules/@angular/cdk/schematics/ng-add/index.d.ts generated vendored Executable file
View File

@@ -0,0 +1,17 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { Rule } from '@angular-devkit/schematics';
/**
* Schematic factory entry-point for the `ng-add` schematic. The ng-add schematic will be
* automatically executed if developers run `ng add @angular/cdk`.
*
* By default, the CLI already installs the package that has been specified with `ng add`.
* We just store the version in the `package.json` in case the package manager didn't. Also
* this ensures that there will be no error that says that the CDK does not support `ng add`.
*/
export default function (): Rule;

31
node_modules/@angular/cdk/schematics/ng-add/index.js generated vendored Executable file
View File

@@ -0,0 +1,31 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const utility_1 = require("@schematics/angular/utility");
/**
* Schematic factory entry-point for the `ng-add` schematic. The ng-add schematic will be
* automatically executed if developers run `ng add @angular/cdk`.
*
* By default, the CLI already installs the package that has been specified with `ng add`.
* We just store the version in the `package.json` in case the package manager didn't. Also
* this ensures that there will be no error that says that the CDK does not support `ng add`.
*/
function default_1() {
// The CLI inserts `@angular/cdk` into the `package.json` before this schematic runs. This
// means that we do not need to insert the CDK into `package.json` files again. In some cases
// though, it could happen that this schematic runs outside of the CLI `ng add` command, or
// the CDK is only listed as a dev dependency. If that is the case, we insert a version based
// on the current build version (substituted version placeholder).
// In order to align the CDK version with other Angular dependencies that are setup by
// `@schematics/angular`, we use tilde instead of caret. This is default for Angular
// dependencies in new CLI projects.
return (0, utility_1.addDependency)('@angular/cdk', `~20.2.12`, { existing: utility_1.ExistingBehavior.Skip });
}
//# sourceMappingURL=index.js.map

1
node_modules/@angular/cdk/schematics/ng-add/index.js.map generated vendored Executable file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAaH,4BAWC;AArBD,yDAA4E;AAE5E;;;;;;;GAOG;AACH;IACE,0FAA0F;IAC1F,6FAA6F;IAC7F,2FAA2F;IAC3F,6FAA6F;IAC7F,kEAAkE;IAElE,sFAAsF;IACtF,oFAAoF;IACpF,oCAAoC;IACpC,OAAO,IAAA,uBAAa,EAAC,cAAc,EAAE,oBAAoB,EAAE,EAAC,QAAQ,EAAE,0BAAgB,CAAC,IAAI,EAAC,CAAC,CAAC;AAChG,CAAC"}

11
node_modules/@angular/cdk/schematics/ng-add/schema.d.ts generated vendored Executable file
View File

@@ -0,0 +1,11 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
export interface Schema {
/** Name of the project to target. */
project: string;
}

10
node_modules/@angular/cdk/schematics/ng-add/schema.js generated vendored Executable file
View File

@@ -0,0 +1,10 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=schema.js.map

1
node_modules/@angular/cdk/schematics/ng-add/schema.js.map generated vendored Executable file
View File

@@ -0,0 +1 @@
{"version":3,"file":"schema.js","sourceRoot":"","sources":["schema.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG"}

16
node_modules/@angular/cdk/schematics/ng-add/schema.json generated vendored Executable file
View File

@@ -0,0 +1,16 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "angular-cdk-ng-add",
"title": "Angular CDK ng-add",
"type": "object",
"properties": {
"project": {
"type": "string",
"description": "The name of the project.",
"$default": {
"$source": "projectName"
}
}
},
"required": []
}

View File

@@ -0,0 +1,53 @@
.container {
width: 400px;
max-width: 100%;
margin: 0 20px;
display: inline-block;
vertical-align: top;
}
.list {
border: solid 1px #ccc;
min-height: 60px;
background: white;
border-radius: 4px;
display: block;
overflow: hidden;
}
.list-item {
padding: 20px 10px;
border-bottom: solid 1px #ccc;
box-sizing: border-box;
cursor: move;
background: white;
color: black;
font-size: 14px;
}
.list-item:last-child {
border: none;
}
/* Highlight the list item that is being dragged. */
.cdk-drag-preview {
border-radius: 4px;
box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2),
0 8px 10px 1px rgba(0, 0, 0, 0.14),
0 3px 14px 2px rgba(0, 0, 0, 0.12);
}
/* Animate items as they're being sorted. */
.cdk-drop-list-dragging .cdk-drag {
transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
}
/* Animate an item that has been dropped. */
.cdk-drag-animating {
transition: transform 300ms cubic-bezier(0, 0, 0.2, 1);
}
.cdk-drag-placeholder {
opacity: 0;
}

View File

@@ -0,0 +1,21 @@
<div class="container">
<h2>To do</h2>
<div cdkDropList #todoList="cdkDropList" [cdkDropListData]="todo"
[cdkDropListConnectedTo]="doneList" class="list" (cdkDropListDropped)="drop($event)">
@for (item of todo; track item) {
<div class="list-item" cdkDrag>{{item}}</div>
}
</div>
</div>
<div class="container">
<h2>Done</h2>
<div cdkDropList #doneList="cdkDropList" [cdkDropListData]="done"
[cdkDropListConnectedTo]="todoList" class="list" (cdkDropListDropped)="drop($event)">
@for (item of done; track item) {
<div class="list-item" cdkDrag>{{item}}</div>
}
</div>
</div>

View File

@@ -0,0 +1,25 @@
import { <% if(!standalone) { %>waitForAsync, <% } %>ComponentFixture, TestBed } from '@angular/core/testing';<% if(!standalone) { %>
import { DragDropModule } from '@angular/cdk/drag-drop';<% } %>
import { <%= classify(name) %>Component } from './<%= dasherize(name) %>.component';
describe('<%= classify(name) %>Component', () => {
let component: <%= classify(name) %>Component;
let fixture: ComponentFixture<<%= classify(name) %>Component>;<% if(!standalone) { %>
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [<%= classify(name) %>Component],
imports: [DragDropModule]
});
}));<% } %>
beforeEach(() => {
fixture = TestBed.createComponent(<%= classify(name) %>Component);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should compile', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,45 @@
import { Component<% if(!!viewEncapsulation) { %>, ViewEncapsulation<% }%><% if(changeDetection !== 'Default') { %>, ChangeDetectionStrategy<% }%> } from '@angular/core';
import { <% if(standalone) { %>CdkDrag, CdkDropList, <% } %>CdkDragDrop, moveItemInArray, transferArrayItem } from '@angular/cdk/drag-drop';
@Component({
selector: '<%= selector %>',<% if(inlineTemplate) { %>
template: `
<%= indentTextContent(resolvedFiles.template, 4) %>
`,<% } else { %>
templateUrl: './<%= dasherize(name) %>.component.html',<% } if(inlineStyle) { %>
styles: `
<%= indentTextContent(resolvedFiles.stylesheet, 4) %>
`<% } else { %>
styleUrl: './<%= dasherize(name) %>.component.<%= style %>'<% } %><% if(!!viewEncapsulation) { %>,
encapsulation: ViewEncapsulation.<%= viewEncapsulation %><% } if (changeDetection !== 'Default') { %>,
changeDetection: ChangeDetectionStrategy.<%= changeDetection %><% } %><% if(standalone) { %>,
imports: [CdkDrag, CdkDropList]<% } else { %>,
standalone: false<% } %>
})
export class <%= classify(name) %>Component {
todo = [
'Get to work',
'Pick up groceries',
'Go home',
'Fall asleep'
];
done = [
'Get up',
'Brush teeth',
'Take a shower',
'Check e-mail',
'Walk dog'
];
drop(event: CdkDragDrop<string[]>): void {
if (event.previousContainer === event.container) {
moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
} else {
transferArrayItem(event.previousContainer.data,
event.container.data,
event.previousIndex,
event.currentIndex);
}
}
}

View File

@@ -0,0 +1,11 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { Rule } from '@angular-devkit/schematics';
import { Schema } from './schema';
/** Scaffolds a new Angular component that uses the Drag and Drop module. */
export default function (options: Schema): Rule;

View File

@@ -0,0 +1,42 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const schematics_1 = require("@angular-devkit/schematics");
const utils_1 = require("../../utils");
/** Scaffolds a new Angular component that uses the Drag and Drop module. */
function default_1(options) {
return (0, schematics_1.chain)([
(0, utils_1.buildComponent)(Object.assign({}, options), {
template: './__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html.template',
stylesheet: './__path__/__name@dasherize@if-flat__/__name@dasherize__.component.__style__.template',
}),
options.skipImport ? (0, schematics_1.noop)() : addDragDropModulesToModule(options),
]);
}
/** Adds the required modules to the main module of the CLI project. */
function addDragDropModulesToModule(options) {
return (host) => __awaiter(this, void 0, void 0, function* () {
const isStandalone = yield (0, utils_1.isStandaloneSchematic)(host, options);
if (!isStandalone) {
const modulePath = yield (0, utils_1.findModuleFromOptions)(host, options);
(0, utils_1.addModuleImportToModule)(host, modulePath, 'DragDropModule', '@angular/cdk/drag-drop');
}
});
}
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;AAYH,4BAaC;AAvBD,2DAAmE;AACnE,uCAKqB;AAGrB,4EAA4E;AAC5E,mBAAyB,OAAe;IACtC,OAAO,IAAA,kBAAK,EAAC;QACX,IAAA,sBAAc,oBACR,OAAO,GACX;YACE,QAAQ,EACN,kFAAkF;YACpF,UAAU,EACR,uFAAuF;SAC1F,CACF;QACD,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,iBAAI,GAAE,CAAC,CAAC,CAAC,0BAA0B,CAAC,OAAO,CAAC;KAClE,CAAC,CAAC;AACL,CAAC;AAED,uEAAuE;AACvE,SAAS,0BAA0B,CAAC,OAAe;IACjD,OAAO,CAAO,IAAU,EAAE,EAAE;QAC1B,MAAM,YAAY,GAAG,MAAM,IAAA,6BAAqB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEhE,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,MAAM,UAAU,GAAG,MAAM,IAAA,6BAAqB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAC9D,IAAA,+BAAuB,EAAC,IAAI,EAAE,UAAW,EAAE,gBAAgB,EAAE,wBAAwB,CAAC,CAAC;QACzF,CAAC;IACH,CAAC,CAAA,CAAC;AACJ,CAAC"}

View File

@@ -0,0 +1,10 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { Schema as ComponentSchema } from '@schematics/angular/component/schema';
export interface Schema extends ComponentSchema {
}

View File

@@ -0,0 +1,10 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=schema.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"schema.js","sourceRoot":"","sources":["schema.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG"}

View File

@@ -0,0 +1,100 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "CdkSchematicsDragDrop",
"title": "Angular CDK Drag and Drop schematic",
"type": "object",
"properties": {
"path": {
"type": "string",
"format": "path",
"$default": {
"$source": "workingDirectory"
},
"description": "The path to create the component.",
"visible": false
},
"project": {
"type": "string",
"description": "The name of the project.",
"$default": {
"$source": "projectName"
}
},
"name": {
"type": "string",
"description": "The name of the component.",
"$default": {
"$source": "argv",
"index": 0
},
"x-prompt": "What should be the name of the component?"
},
"inlineStyle": {
"description": "Specifies if the style will be in the ts file.",
"type": "boolean",
"alias": "s"
},
"inlineTemplate": {
"description": "Specifies if the template will be in the ts file.",
"type": "boolean",
"alias": "t"
},
"standalone": {
"description": "Whether the generated component is standalone.",
"type": "boolean"
},
"viewEncapsulation": {
"description": "Specifies the view encapsulation strategy.",
"enum": ["Emulated", "None"],
"type": "string",
"alias": "v"
},
"changeDetection": {
"description": "Specifies the change detection strategy.",
"enum": ["Default", "OnPush"],
"type": "string",
"default": "Default",
"alias": "c"
},
"prefix": {
"type": "string",
"format": "html-selector",
"description": "The prefix to apply to generated selectors.",
"alias": "p"
},
"style": {
"description": "The file extension to be used for style files.",
"type": "string"
},
"skipTests": {
"type": "boolean",
"description": "When true, does not generate a test file."
},
"flat": {
"type": "boolean",
"description": "Flag to indicate if a dir is created.",
"default": false
},
"skipImport": {
"type": "boolean",
"description": "Flag to skip the module import.",
"default": false
},
"selector": {
"type": "string",
"format": "html-selector",
"description": "The selector to use for the component."
},
"module": {
"type": "string",
"description": "Allows specification of the declaring module.",
"alias": "m"
},
"export": {
"type": "boolean",
"default": false,
"description": "Specifies if declaring module exports the component."
}
},
"required": ["name"]
}

View File

@@ -0,0 +1,15 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { VersionChanges } from '../../update-tool/version-changes';
export interface AttributeSelectorUpgradeData {
/** The attribute name to replace. */
replace: string;
/** The new name for the attribute. */
replaceWith: string;
}
export declare const attributeSelectors: VersionChanges<AttributeSelectorUpgradeData>;

View File

@@ -0,0 +1,12 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.attributeSelectors = void 0;
exports.attributeSelectors = {};
//# sourceMappingURL=attribute-selectors.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"attribute-selectors.js","sourceRoot":"","sources":["attribute-selectors.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAWU,QAAA,kBAAkB,GAAiD,EAAE,CAAC"}

View File

@@ -0,0 +1,15 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { VersionChanges } from '../../update-tool/version-changes';
export interface ClassNameUpgradeData {
/** The Class name to replace. */
replace: string;
/** The new name for the Class. */
replaceWith: string;
}
export declare const classNames: VersionChanges<ClassNameUpgradeData>;

View File

@@ -0,0 +1,12 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.classNames = void 0;
exports.classNames = {};
//# sourceMappingURL=class-names.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"class-names.js","sourceRoot":"","sources":["class-names.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAWU,QAAA,UAAU,GAAyC,EAAE,CAAC"}

View File

@@ -0,0 +1,15 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { VersionChanges } from '../../update-tool/version-changes';
export type ConstructorChecksUpgradeData = string;
/**
* List of class names for which the constructor signature has been changed. The new constructor
* signature types don't need to be stored here because the signature will be determined
* automatically through type checking.
*/
export declare const constructorChecks: VersionChanges<ConstructorChecksUpgradeData>;

View File

@@ -0,0 +1,17 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.constructorChecks = void 0;
/**
* List of class names for which the constructor signature has been changed. The new constructor
* signature types don't need to be stored here because the signature will be determined
* automatically through type checking.
*/
exports.constructorChecks = {};
//# sourceMappingURL=constructor-checks.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"constructor-checks.js","sourceRoot":"","sources":["constructor-checks.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAMH;;;;GAIG;AACU,QAAA,iBAAiB,GAAiD,EAAE,CAAC"}

View File

@@ -0,0 +1,27 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { VersionChanges } from '../../update-tool/version-changes';
export interface CssSelectorUpgradeData {
/** The CSS selector to replace. */
replace: string;
/** The new CSS selector. */
replaceWith: string;
/**
* Controls which file types in which this replacement is made. If omitted, it is made in all
* files.
*/
replaceIn?: {
/** Replace this name in stylesheet files. */
stylesheet?: boolean;
/** Replace this name in HTML files. */
html?: boolean;
/** Replace this name in TypeScript strings. */
tsStringLiterals?: boolean;
};
}
export declare const cssSelectors: VersionChanges<CssSelectorUpgradeData>;

View File

@@ -0,0 +1,12 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.cssSelectors = void 0;
exports.cssSelectors = {};
//# sourceMappingURL=css-selectors.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"css-selectors.js","sourceRoot":"","sources":["css-selectors.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAuBU,QAAA,YAAY,GAA2C,EAAE,CAAC"}

View File

@@ -0,0 +1,27 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { VersionChanges } from '../../update-tool/version-changes';
export interface CssTokenUpgradeData {
/** The CSS selector to replace. */
replace: string;
/** The new CSS selector. */
replaceWith: string;
/**
* Controls which file types in which this replacement is made. If omitted, it is made in all
* files.
*/
replaceIn?: {
/** Replace this name in stylesheet files. */
stylesheet?: boolean;
/** Replace this name in HTML files. */
html?: boolean;
/** Replace this name in TypeScript strings. */
tsStringLiterals?: boolean;
};
}
export declare const cssTokens: VersionChanges<CssTokenUpgradeData>;

View File

@@ -0,0 +1,12 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.cssTokens = void 0;
exports.cssTokens = {};
//# sourceMappingURL=css-tokens.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"css-tokens.js","sourceRoot":"","sources":["css-tokens.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAuBU,QAAA,SAAS,GAAwC,EAAE,CAAC"}

View File

@@ -0,0 +1,15 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { VersionChanges } from '../../update-tool/version-changes';
export interface ElementSelectorUpgradeData {
/** The element name to replace. */
replace: string;
/** The new name for the element. */
replaceWith: string;
}
export declare const elementSelectors: VersionChanges<ElementSelectorUpgradeData>;

View File

@@ -0,0 +1,12 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.elementSelectors = void 0;
exports.elementSelectors = {};
//# sourceMappingURL=element-selectors.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"element-selectors.js","sourceRoot":"","sources":["element-selectors.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAWU,QAAA,gBAAgB,GAA+C,EAAE,CAAC"}

View File

@@ -0,0 +1,18 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
export * from './attribute-selectors';
export * from './class-names';
export * from './constructor-checks';
export * from './css-selectors';
export * from './css-tokens';
export * from './element-selectors';
export * from './input-names';
export * from './method-call-checks';
export * from './output-names';
export * from './property-names';
export * from './symbol-removal';

35
node_modules/@angular/cdk/schematics/ng-update/data/index.js generated vendored Executable file
View File

@@ -0,0 +1,35 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./attribute-selectors"), exports);
__exportStar(require("./class-names"), exports);
__exportStar(require("./constructor-checks"), exports);
__exportStar(require("./css-selectors"), exports);
__exportStar(require("./css-tokens"), exports);
__exportStar(require("./element-selectors"), exports);
__exportStar(require("./input-names"), exports);
__exportStar(require("./method-call-checks"), exports);
__exportStar(require("./output-names"), exports);
__exportStar(require("./property-names"), exports);
__exportStar(require("./symbol-removal"), exports);
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;AAEH,wDAAsC;AACtC,gDAA8B;AAC9B,uDAAqC;AACrC,kDAAgC;AAChC,+CAA6B;AAC7B,sDAAoC;AACpC,gDAA8B;AAC9B,uDAAqC;AACrC,iDAA+B;AAC/B,mDAAiC;AACjC,mDAAiC"}

View File

@@ -0,0 +1,22 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { VersionChanges } from '../../update-tool/version-changes';
export interface InputNameUpgradeData {
/** The @Input() name to replace. */
replace: string;
/** The new name for the @Input(). */
replaceWith: string;
/** Controls which elements and attributes in which this replacement is made. */
limitedTo: {
/** Limit to elements with any of these element tags. */
elements?: string[];
/** Limit to elements with any of these attributes. */
attributes?: string[];
};
}
export declare const inputNames: VersionChanges<InputNameUpgradeData>;

View File

@@ -0,0 +1,12 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.inputNames = void 0;
exports.inputNames = {};
//# sourceMappingURL=input-names.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"input-names.js","sourceRoot":"","sources":["input-names.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAkBU,QAAA,UAAU,GAAyC,EAAE,CAAC"}

View File

@@ -0,0 +1,17 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { VersionChanges } from '../../update-tool/version-changes';
export interface MethodCallUpgradeData {
className: string;
method: string;
invalidArgCounts: {
count: number;
message: string;
}[];
}
export declare const methodCallChecks: VersionChanges<MethodCallUpgradeData>;

View File

@@ -0,0 +1,12 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.methodCallChecks = void 0;
exports.methodCallChecks = {};
//# sourceMappingURL=method-call-checks.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"method-call-checks.js","sourceRoot":"","sources":["method-call-checks.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAUU,QAAA,gBAAgB,GAA0C,EAAE,CAAC"}

View File

@@ -0,0 +1,22 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { VersionChanges } from '../../update-tool/version-changes';
export interface OutputNameUpgradeData {
/** The @Output() name to replace. */
replace: string;
/** The new name for the @Output(). */
replaceWith: string;
/** Controls which elements and attributes in which this replacement is made. */
limitedTo: {
/** Limit to elements with any of these element tags. */
elements?: string[];
/** Limit to elements with any of these attributes. */
attributes?: string[];
};
}
export declare const outputNames: VersionChanges<OutputNameUpgradeData>;

View File

@@ -0,0 +1,12 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.outputNames = void 0;
exports.outputNames = {};
//# sourceMappingURL=output-names.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"output-names.js","sourceRoot":"","sources":["output-names.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAkBU,QAAA,WAAW,GAA0C,EAAE,CAAC"}

View File

@@ -0,0 +1,20 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { VersionChanges } from '../../update-tool/version-changes';
export interface PropertyNameUpgradeData {
/** The property name to replace. */
replace: string;
/** The new name for the property. */
replaceWith: string;
/** Controls which classes in which this replacement is made. */
limitedTo: {
/** Replace the property only when its type is one of the given Classes. */
classes: string[];
};
}
export declare const propertyNames: VersionChanges<PropertyNameUpgradeData>;

View File

@@ -0,0 +1,12 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.propertyNames = void 0;
exports.propertyNames = {};
//# sourceMappingURL=property-names.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"property-names.js","sourceRoot":"","sources":["property-names.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAgBU,QAAA,aAAa,GAA4C,EAAE,CAAC"}

View File

@@ -0,0 +1,17 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { VersionChanges } from '../../update-tool/version-changes';
export interface SymbolRemovalUpgradeData {
/** Module that the symbol was removed from. */
module: string;
/** Name of the symbol being removed. */
name: string;
/** Message to log explaining why the symbol was removed. */
message: string;
}
export declare const symbolRemoval: VersionChanges<SymbolRemovalUpgradeData>;

View File

@@ -0,0 +1,12 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.symbolRemoval = void 0;
exports.symbolRemoval = {};
//# sourceMappingURL=symbol-removal.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"symbol-removal.js","sourceRoot":"","sources":["symbol-removal.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAeU,QAAA,aAAa,GAA6C,EAAE,CAAC"}

View File

@@ -0,0 +1,30 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { Path } from '@angular-devkit/core';
import { Tree, UpdateRecorder } from '@angular-devkit/schematics';
import { DirectoryEntry, FileSystem } from '../update-tool/file-system';
/**
* File system that leverages the virtual tree from the CLI devkit. This file
* system is commonly used by `ng update` migrations that run as part of the
* Angular CLI.
*/
export declare class DevkitFileSystem extends FileSystem {
private _tree;
private _updateRecorderCache;
constructor(_tree: Tree);
resolve(...segments: string[]): Path;
edit(filePath: Path): UpdateRecorder;
commitEdits(): void;
fileExists(filePath: Path): boolean;
directoryExists(dirPath: Path): boolean;
overwrite(filePath: Path, content: string): void;
create(filePath: Path, content: string): void;
delete(filePath: Path): void;
read(filePath: Path): string | null;
readDirectory(dirPath: Path): DirectoryEntry;
}

View File

@@ -0,0 +1,83 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.DevkitFileSystem = void 0;
const core_1 = require("@angular-devkit/core");
const file_system_1 = require("../update-tool/file-system");
const path = require("path");
/**
* File system that leverages the virtual tree from the CLI devkit. This file
* system is commonly used by `ng update` migrations that run as part of the
* Angular CLI.
*/
class DevkitFileSystem extends file_system_1.FileSystem {
constructor(_tree) {
super();
this._tree = _tree;
this._updateRecorderCache = new Map();
}
resolve(...segments) {
// Note: We use `posix.resolve` as the devkit paths are using posix separators.
return (0, core_1.normalize)(path.posix.resolve('/', ...segments.map(core_1.normalize)));
}
edit(filePath) {
if (this._updateRecorderCache.has(filePath)) {
return this._updateRecorderCache.get(filePath);
}
const recorder = this._tree.beginUpdate(filePath);
this._updateRecorderCache.set(filePath, recorder);
return recorder;
}
commitEdits() {
this._updateRecorderCache.forEach(r => this._tree.commitUpdate(r));
this._updateRecorderCache.clear();
}
fileExists(filePath) {
return this._tree.exists(filePath);
}
directoryExists(dirPath) {
// The devkit tree does not expose an API for checking whether a given
// directory exists. It throws a specific error though if a directory
// is being read as a file. We use that to check if a directory exists.
try {
this._tree.get(dirPath);
}
catch (e) {
// Note: We do not use an `instanceof` check here. It could happen that
// the devkit version used by the CLI is different than the one we end up
// loading. This can happen depending on how Yarn/NPM hoists the NPM
// packages / whether there are multiple versions installed. Typescript
// throws a compilation error if the type isn't specified and we can't
// check the type, so we have to cast the error output to any.
if (e.constructor.name === 'PathIsDirectoryException') {
return true;
}
}
return false;
}
overwrite(filePath, content) {
this._tree.overwrite(filePath, content);
}
create(filePath, content) {
this._tree.create(filePath, content);
}
delete(filePath) {
this._tree.delete(filePath);
}
read(filePath) {
const buffer = this._tree.read(filePath);
return buffer !== null ? buffer.toString() : null;
}
readDirectory(dirPath) {
const { subdirs: directories, subfiles: files } = this._tree.getDir(dirPath);
return { directories, files };
}
}
exports.DevkitFileSystem = DevkitFileSystem;
//# sourceMappingURL=devkit-file-system.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"devkit-file-system.js","sourceRoot":"","sources":["devkit-file-system.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,+CAAqD;AAErD,4DAAsE;AACtE,6BAA6B;AAE7B;;;;GAIG;AACH,MAAa,gBAAiB,SAAQ,wBAAU;IAG9C,YAAoB,KAAW;QAC7B,KAAK,EAAE,CAAC;QADU,UAAK,GAAL,KAAK,CAAM;QAFvB,yBAAoB,GAAG,IAAI,GAAG,EAA0B,CAAC;IAIjE,CAAC;IAED,OAAO,CAAC,GAAG,QAAkB;QAC3B,+EAA+E;QAC/E,OAAO,IAAA,gBAAS,EAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,gBAAS,CAAC,CAAC,CAAC,CAAC;IACxE,CAAC;IAED,IAAI,CAAC,QAAc;QACjB,IAAI,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5C,OAAO,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,QAAQ,CAAE,CAAC;QAClD,CAAC;QACD,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAClD,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAClD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,WAAW;QACT,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;QACnE,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,CAAC;IACpC,C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,CAAC;QAC3E,OAAO,EAAC,WAAW,EAAE,KAAK,EAAC,CAAC;IAC9B,CAAC;CACF;AAvED,4CAuEC"}

View File

@@ -0,0 +1,24 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { Rule, SchematicContext } from '@angular-devkit/schematics';
import { MigrationCtor } from '../update-tool/migration';
import { TargetVersion } from '../update-tool/target-version';
import { DevkitContext, DevkitMigrationCtor } from './devkit-migration';
import { UpgradeData } from './upgrade-data';
/** List of migrations which run for the CDK update. */
export declare const cdkMigrations: MigrationCtor<UpgradeData>[];
export type NullableDevkitMigration = MigrationCtor<UpgradeData | null, DevkitContext>;
type PostMigrationFn = (context: SchematicContext, targetVersion: TargetVersion, hasFailure: boolean) => void;
/**
* Creates a Angular schematic rule that runs the upgrade for the
* specified target version.
*/
export declare function createMigrationSchematicRule(targetVersion: TargetVersion, extraMigrations: NullableDevkitMigration[], upgradeData: UpgradeData, onMigrationCompleteFn?: PostMigrationFn): Rule;
/** Whether the given migration type refers to a devkit migration */
export declare function isDevkitMigration(value: MigrationCtor<any, any>): value is DevkitMigrationCtor<any>;
export {};

View File

@@ -0,0 +1,142 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.cdkMigrations = void 0;
exports.createMigrationSchematicRule = createMigrationSchematicRule;
exports.isDevkitMigration = isDevkitMigration;
const tasks_1 = require("@angular-devkit/schematics/tasks");
const update_tool_1 = require("../update-tool");
const project_tsconfig_paths_1 = require("../utils/project-tsconfig-paths");
const devkit_file_system_1 = require("./devkit-file-system");
const devkit_migration_1 = require("./devkit-migration");
const find_stylesheets_1 = require("./find-stylesheets");
const attribute_selectors_1 = require("./migrations/attribute-selectors");
const class_inheritance_1 = require("./migrations/class-inheritance");
const class_names_1 = require("./migrations/class-names");
const constructor_signature_1 = require("./migrations/constructor-signature");
const css_selectors_1 = require("./migrations/css-selectors");
const css_tokens_1 = require("./migrations/css-tokens");
const element_selectors_1 = require("./migrations/element-selectors");
const input_names_1 = require("./migrations/input-names");
const method_call_arguments_1 = require("./migrations/method-call-arguments");
const misc_template_1 = require("./migrations/misc-template");
const output_names_1 = require("./migrations/output-names");
const property_names_1 = require("./migrations/property-names");
const symbol_removal_1 = require("./migrations/symbol-removal");
/** List of migrations which run for the CDK update. */
exports.cdkMigrations = [
attribute_selectors_1.AttributeSelectorsMigration,
class_inheritance_1.ClassInheritanceMigration,
class_names_1.ClassNamesMigration,
constructor_signature_1.ConstructorSignatureMigration,
css_selectors_1.CssSelectorsMigration,
css_tokens_1.CssTokensMigration,
element_selectors_1.ElementSelectorsMigration,
input_names_1.InputNamesMigration,
method_call_arguments_1.MethodCallArgumentsMigration,
misc_template_1.MiscTemplateMigration,
output_names_1.OutputNamesMigration,
property_names_1.PropertyNamesMigration,
symbol_removal_1.SymbolRemovalMigration,
];
/**
* Creates a Angular schematic rule that runs the upgrade for the
* specified target version.
*/
function createMigrationSchematicRule(targetVersion, extraMigrations, upgradeData, onMigrationCompleteFn) {
return (tree, context) => __awaiter(this, void 0, void 0, function* () {
const logger = context.logger;
const workspace = yield (0, project_tsconfig_paths_1.getWorkspaceConfigGracefully)(tree);
if (workspace === null) {
logger.error('Could not find workspace configuration file.');
return;
}
// Keep track of all project source files which have been checked/migrated. This is
// necessary because multiple TypeScript projects can contain the same source file and
// we don't want to check these again, as this would result in duplicated failure messages.
const analyzedFiles = new Set();
const fileSystem = new devkit_file_system_1.DevkitFileSystem(tree);
const projectNames = workspace.projects.keys();
const migrations = [...exports.cdkMigrations, ...extraMigrations];
let hasFailures = false;
for (const projectName of projectNames) {
const project = workspace.projects.get(projectName);
const buildTsconfigPath = (0, project_tsconfig_paths_1.getTargetTsconfigPath)(project, 'build');
const testTsconfigPath = (0, project_tsconfig_paths_1.getTargetTsconfigPath)(project, 'test');
if (!buildTsconfigPath && !testTsconfigPath) {
logger.warn(`Skipping migration for project ${projectName}. Unable to determine 'tsconfig.json' file in workspace config.`);
continue;
}
// In some applications, developers will have global stylesheets which are not
// specified in any Angular component. Therefore we glob up all CSS and SCSS files
// in the project and migrate them if needed.
// TODO: rework this to collect global stylesheets from the workspace config.
// TODO: https://github.com/angular/components/issues/24032.
const additionalStylesheetPaths = (0, find_stylesheets_1.findStylesheetFiles)(tree, project.root);
if (buildTsconfigPath !== null) {
runMigrations(project, projectName, buildTsconfigPath, additionalStylesheetPaths, false);
}
if (testTsconfigPath !== null) {
runMigrations(project, projectName, testTsconfigPath, additionalStylesheetPaths, true);
}
}
let runPackageManager = false;
// Run the global post migration static members for all
// registered devkit migrations.
migrations.forEach(m => {
const actionResult = isDevkitMigration(m) && m.globalPostMigration !== undefined
? m.globalPostMigration(tree, targetVersion, context)
: null;
if (actionResult) {
runPackageManager = runPackageManager || actionResult.runPackageManager;
}
});
// If a migration requested the package manager to run, we run it as an
// asynchronous post migration task. We cannot run it synchronously,
// as file changes from the current migration task are not applied to
// the file system yet.
if (runPackageManager) {
context.addTask(new tasks_1.NodePackageInstallTask({ quiet: false }));
}
if (onMigrationCompleteFn) {
onMigrationCompleteFn(context, targetVersion, hasFailures);
}
/** Runs the migrations for the specified workspace project. */
function runMigrations(project, projectName, tsconfigPath, additionalStylesheetPaths, isTestTarget) {
const program = update_tool_1.UpdateProject.createProgramFromTsconfig(tsconfigPath, fileSystem);
const updateContext = {
isTestTarget,
projectName,
project,
tree,
};
const updateProject = new update_tool_1.UpdateProject(updateContext, program, fileSystem, analyzedFiles, context.logger);
const result = updateProject.migrate(migrations, targetVersion, upgradeData, additionalStylesheetPaths);
// Commit all recorded edits in the update recorder. We apply the edits after all
// migrations ran because otherwise offsets in the TypeScript program would be
// shifted and individual migrations could no longer update the same source file.
fileSystem.commitEdits();
hasFailures = hasFailures || result.hasFailures;
}
});
}
/** Whether the given migration type refers to a devkit migration */
function isDevkitMigration(value) {
return devkit_migration_1.DevkitMigration.isPrototypeOf(value);
}
//# sourceMappingURL=devkit-migration-rule.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"devkit-migration-rule.js","sourceRoot":"","sources":["devkit-migration-rule.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;AA2DH,oEAmHC;AAGD,8CAIC;AAlLD,4DAAwE;AAGxE,gDAA6C;AAI7C,4EAAoG;AAEpG,6DAAsD;AACtD,yDAAuF;AACvF,yDAAuD;AACvD,0EAA6E;AAC7E,sEAAyE;AACzE,0DAA6D;AAC7D,8EAAiF;AACjF,8DAAiE;AACjE,wDAA2D;AAC3D,sEAAyE;AACzE,0DAA6D;AAC7D,8EAAgF;AAChF,8DAAiE;AACjE,4DAA+D;AAC/D,gEAAmE;AACnE,gEAAmE;AAGnE,uDAAuD;AAC1C,QAAA,aAAa,GAAiC;IACzD,iDAA2B;IAC3B,6CAAyB;IACzB,iCAAmB;IACnB,qDAA6B;IAC7B,qCAAqB;IACrB,+BAAkB;IAClB,6CAAyB;IACzB,iCAAmB;IACnB,oDAA4B;IAC5B,qCAAqB;IACrB,mCAAoB;IACpB,uCAAsB;IACtB,uCAAsB;CACvB,CAAC;AAUF;;;GAGG;AACH,SAAgB,4BAA4B,CAC1C,aAA4B,EAC5B,eAA0C,EAC1C,WAAwB,EACxB,qBAAuC;IAEvC,OAAO,CAAO,IAAU,EAAE,OAAyB,EAAE,EAAE;QACrD,MAAM,MAAM,GAAG,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AAI;aACL,CAAC;YAEF,MAAM,aAAa,GAAG,IAAI,2BAAa,CACrC,aAAa,EACb,OAAO,EACP,UAAU,EACV,aAAa,EACb,OAAO,CAAC,MAAM,CACf,CAAC;YAEF,MAAM,MAAM,GAAG,aAAa,CAAC,OAAO,CAClC,UAAU,EACV,aAAa,EACb,WAAW,EACX,yBAAyB,CAC1B,CAAC;YAEF,iFAAiF;YACjF,8EAA8E;YAC9E,iFAAiF;YACjF,UAAU,CAAC,WAAW,EAAE,CAAC;YAEzB,WAAW,GAAG,WAAW,IAAI,MAAM,CAAC,WAAW,CAAC;QAClD,CAAC;IACH,CAAC,CAAA,CAAC;AACJ,CAAC;AAED,oEAAoE;AACpE,SAAgB,iBAAiB,CAC/B,KAA8B;IAE9B,OAAO,kCAAe,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAC9C,CAAC"}

View File

@@ -0,0 +1,35 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { SchematicContext, Tree } from '@angular-devkit/schematics';
import { ProjectDefinition } from '@schematics/angular/utility';
import { Constructor, Migration, PostMigrationAction } from '../update-tool/migration';
import { TargetVersion } from '../update-tool/target-version';
export type DevkitContext = {
/** Devkit tree for the current migrations. Can be used to insert/remove files. */
tree: Tree;
/** Name of the project the migrations run against. */
projectName: string;
/** Workspace project the migrations run against. */
project: ProjectDefinition;
/** Whether the migrations run for a test target. */
isTestTarget: boolean;
};
export declare abstract class DevkitMigration<Data> extends Migration<Data, DevkitContext> {
/** Prints an informative message with context on the current target. */
protected printInfo(text: string): void;
/**
* Optional static method that will be called once the migration of all project
* targets has been performed. This method can be used to make changes respecting the
* migration result of all individual targets. e.g. removing HammerJS if it
* is not needed in any project target.
*/
static globalPostMigration?(tree: Tree, targetVersion: TargetVersion, context: SchematicContext): PostMigrationAction;
}
export type DevkitMigrationCtor<Data> = Constructor<DevkitMigration<Data>> & {
[m in keyof typeof DevkitMigration]: (typeof DevkitMigration)[m];
};

View File

@@ -0,0 +1,20 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.DevkitMigration = void 0;
const migration_1 = require("../update-tool/migration");
class DevkitMigration extends migration_1.Migration {
/** Prints an informative message with context on the current target. */
printInfo(text) {
const targetName = this.context.isTestTarget ? 'test' : 'build';
this.logger.info(`- ${this.context.projectName}@${targetName}: ${text}`);
}
}
exports.DevkitMigration = DevkitMigration;
//# sourceMappingURL=devkit-migration.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"devkit-migration.js","sourceRoot":"","sources":["devkit-migration.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAIH,wDAAqF;AAcrF,MAAsB,eAAsB,SAAQ,qBAA8B;IAChF,wEAAwE;IAC9D,SAAS,CAAC,IAAY;QAC9B,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;QAChE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,WAAW,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC,CAAC;IAC3E,CAAC;CAaF;AAlBD,0CAkBC"}

View File

@@ -0,0 +1,16 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { Tree } from '@angular-devkit/schematics';
/**
* Finds stylesheets in the given directory from within the specified tree.
* @param tree Devkit tree where stylesheet files can be found in.
* @param startDirectory Optional start directory where stylesheets should be searched in.
* This can be useful if only stylesheets within a given folder are relevant (to avoid
* unnecessary iterations).
*/
export declare function findStylesheetFiles(tree: Tree, startDirectory?: string): string[];

View File

@@ -0,0 +1,41 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.findStylesheetFiles = findStylesheetFiles;
const core_1 = require("@angular-devkit/core");
/** Regular expression that matches stylesheet paths */
const STYLESHEET_REGEX = /.*\.(css|scss)$/;
/**
* Finds stylesheets in the given directory from within the specified tree.
* @param tree Devkit tree where stylesheet files can be found in.
* @param startDirectory Optional start directory where stylesheets should be searched in.
* This can be useful if only stylesheets within a given folder are relevant (to avoid
* unnecessary iterations).
*/
function findStylesheetFiles(tree, startDirectory = '/') {
const result = [];
const visitDir = (dirPath) => {
const { subfiles, subdirs } = tree.getDir(dirPath);
subfiles.forEach(fileName => {
if (STYLESHEET_REGEX.test(fileName)) {
result.push((0, core_1.join)(dirPath, fileName));
}
});
// Visit directories within the current directory to find other stylesheets.
subdirs.forEach(fragment => {
// Do not visit directories or files inside node modules or `dist/` folders.
if (fragment !== 'node_modules' && fragment !== 'dist') {
visitDir((0, core_1.join)(dirPath, fragment));
}
});
};
visitDir(startDirectory);
return result;
}
//# sourceMappingURL=find-stylesheets.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"find-stylesheets.js","sourceRoot":"","sources":["find-stylesheets.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAeH,kDAqBC;AAlCD,+CAAgD;AAGhD,uDAAuD;AACvD,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAE3C;;;;;;GAMG;AACH,SAAgB,mBAAmB,CAAC,IAAU,EAAE,iBAAyB,GAAG;IAC1E,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,QAAQ,GAAG,CAAC,OAAa,EAAE,EAAE;QACjC,MAAM,EAAC,QAAQ,EAAE,OAAO,EAAC,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAEjD,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC1B,IAAI,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACpC,MAAM,CAAC,IAAI,CAAC,IAAA,WAAI,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;YACvC,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,4EAA4E;QAC5E,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YACzB,4EAA4E;YAC5E,IAAI,QAAQ,KAAK,cAAc,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;gBACvD,QAAQ,CAAC,IAAA,WAAI,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;YACpC,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IACF,QAAQ,CAAC,cAAsB,CAAC,CAAC;IACjC,OAAO,MAAM,CAAC;AAChB,CAAC"}

View File

@@ -0,0 +1,15 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
/** Finds the specified Angular @Input in the given elements with tag name. */
export declare function findInputsOnElementWithTag(html: string, inputName: string, tagNames: string[]): number[];
/** Finds the specified Angular @Input in elements that have one of the specified attributes. */
export declare function findInputsOnElementWithAttr(html: string, inputName: string, attrs: string[]): number[];
/** Finds the specified Angular @Output in the given elements with tag name. */
export declare function findOutputsOnElementWithTag(html: string, outputName: string, tagNames: string[]): number[];
/** Finds the specified Angular @Output in elements that have one of the specified attributes. */
export declare function findOutputsOnElementWithAttr(html: string, outputName: string, attrs: string[]): number[];

View File

@@ -0,0 +1,51 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.findInputsOnElementWithTag = findInputsOnElementWithTag;
exports.findInputsOnElementWithAttr = findInputsOnElementWithAttr;
exports.findOutputsOnElementWithTag = findOutputsOnElementWithTag;
exports.findOutputsOnElementWithAttr = findOutputsOnElementWithAttr;
const elements_1 = require("./elements");
/** Finds the specified Angular @Input in the given elements with tag name. */
function findInputsOnElementWithTag(html, inputName, tagNames) {
return [
// Inputs can be also used without brackets (e.g. `<mat-toolbar color="primary">`)
...(0, elements_1.findAttributeOnElementWithTag)(html, inputName, tagNames),
// Add one column to the mapped offset because the first bracket for the @Input
// is part of the attribute and therefore also part of the offset. We only want to return
// the offset for the inner name of the bracketed input.
...(0, elements_1.findAttributeOnElementWithTag)(html, `[${inputName}]`, tagNames).map(offset => offset + 1),
];
}
/** Finds the specified Angular @Input in elements that have one of the specified attributes. */
function findInputsOnElementWithAttr(html, inputName, attrs) {
return [
// Inputs can be also used without brackets (e.g. `<button matButton color="primary">`)
...(0, elements_1.findAttributeOnElementWithAttrs)(html, inputName, attrs),
// Add one column to the mapped offset because the first bracket for the @Input
// is part of the attribute and therefore also part of the offset. We only want to return
// the offset for the inner name of the bracketed input.
...(0, elements_1.findAttributeOnElementWithAttrs)(html, `[${inputName}]`, attrs).map(offset => offset + 1),
];
}
/** Finds the specified Angular @Output in the given elements with tag name. */
function findOutputsOnElementWithTag(html, outputName, tagNames) {
// Add one column to the mapped offset because the first parenthesis for the @Output
// is part of the attribute and therefore also part of the offset. We only want to return
// the offset for the inner name of the output.
return (0, elements_1.findAttributeOnElementWithTag)(html, `(${outputName})`, tagNames).map(offset => offset + 1);
}
/** Finds the specified Angular @Output in elements that have one of the specified attributes. */
function findOutputsOnElementWithAttr(html, outputName, attrs) {
// Add one column to the mapped offset because the first bracket for the @Output
// is part of the attribute and therefore also part of the offset. We only want to return
// the offset for the inner name of the output.
return (0, elements_1.findAttributeOnElementWithAttrs)(html, `(${outputName})`, attrs).map(offset => offset + 1);
}
//# sourceMappingURL=angular.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"angular.js","sourceRoot":"","sources":["angular.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAKH,gEASC;AAGD,kEASC;AAGD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AAA,0CAA+B,EAAC,IAAI,EAAE,IAAI,UAAU,GAAG,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACnG,CAAC"}

View File

@@ -0,0 +1,24 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
/**
* Parses a HTML fragment and traverses all AST nodes in order find elements that
* include the specified attribute.
*/
export declare function findElementsWithAttribute(html: string, attributeName: string): import("parse5/dist/tree-adapters/default").Element[];
/**
* Finds elements with explicit tag names that also contain the specified attribute. Returns the
* attribute start offset based on the specified HTML.
*/
export declare function findAttributeOnElementWithTag(html: string, name: string, tagNames: string[]): number[];
/**
* Finds elements that contain the given attribute and contain at least one of the other
* specified attributes. Returns the primary attribute's start offset based on the specified HTML.
*/
export declare function findAttributeOnElementWithAttrs(html: string, name: string, attrs: string[]): number[];
/** Gets the start offset of the given attribute from a Parse5 element. */
export declare function getStartOffsetOfAttribute(element: any, attributeName: string): number;

View File

@@ -0,0 +1,63 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.findElementsWithAttribute = findElementsWithAttribute;
exports.findAttributeOnElementWithTag = findAttributeOnElementWithTag;
exports.findAttributeOnElementWithAttrs = findAttributeOnElementWithAttrs;
exports.getStartOffsetOfAttribute = getStartOffsetOfAttribute;
const parse5_1 = require("parse5");
/**
* Parses a HTML fragment and traverses all AST nodes in order find elements that
* include the specified attribute.
*/
function findElementsWithAttribute(html, attributeName) {
const document = (0, parse5_1.parseFragment)(html, { sourceCodeLocationInfo: true });
const elements = [];
const visitNodes = (nodes) => {
nodes.forEach(n => {
var _a;
const node = n;
if (node.childNodes) {
visitNodes(node.childNodes);
}
if ((_a = node.attrs) === null || _a === void 0 ? void 0 : _a.some(attr => attr.name === attributeName.toLowerCase())) {
elements.push(node);
}
});
};
visitNodes(document.childNodes);
return elements;
}
/**
* Finds elements with explicit tag names that also contain the specified attribute. Returns the
* attribute start offset based on the specified HTML.
*/
function findAttributeOnElementWithTag(html, name, tagNames) {
return findElementsWithAttribute(html, name)
.filter(element => tagNames.includes(element.tagName))
.map(element => getStartOffsetOfAttribute(element, name));
}
/**
* Finds elements that contain the given attribute and contain at least one of the other
* specified attributes. Returns the primary attribute's start offset based on the specified HTML.
*/
function findAttributeOnElementWithAttrs(html, name, attrs) {
return findElementsWithAttribute(html, name)
.filter(element => attrs.some(attr => hasElementAttribute(element, attr)))
.map(element => getStartOffsetOfAttribute(element, name));
}
/** Shorthand function that checks if the specified element contains the given attribute. */
function hasElementAttribute(element, attributeName) {
return element.attrs && element.attrs.some(attr => attr.name === attributeName.toLowerCase());
}
/** Gets the start offset of the given attribute from a Parse5 element. */
function getStartOffsetOfAttribute(element, attributeName) {
return element.sourceCodeLocation.attrs[attributeName.toLowerCase()].startOffset;
}
//# sourceMappingURL=elements.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"elements.js","sourceRoot":"","sources":["elements.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AASH,8DAqBC;AAMD,sEAIC;AAMD,0EAIC;AAQD,8DAEC;AA1DD,mCAAqC;AAGrC;;;GAGG;AACH,SAAgB,yBAAyB,CAAC,IAAY,EAAE,aAAqB;IAC3E,MAAM,QAAQ,GAAG,IAAA,sBAAa,EAAC,IAAI,EAAE,EAAC,sBAAsB,EAAE,IAAI,EAAC,CAAC,CAAC;IACrE,MAAM,QAAQ,GAAc,EAAE,CAAC;IAE/B,MAAM,UAAU,GAAG,CAAC,KAAkB,EAAE,EAAE;QACxC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;;YAChB,MAAM,IAAI,GAAG,CAAY,CAAC;YAE1B,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;gBACpB,UA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,CAAC,IAAI,CAAC,IAAI,KAAK,aAAa,CAAC,WAAW,EAAE,CAAC,CAAC;AAChG,CAAC;AAED,0EAA0E;AAC1E,SAAgB,yBAAyB,CAAC,OAAY,EAAE,aAAqB;IAC3E,OAAO,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC,CAAC,WAAW,CAAC;AACnF,CAAC"}

10
node_modules/@angular/cdk/schematics/ng-update/index.d.ts generated vendored Executable file
View File

@@ -0,0 +1,10 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { Rule } from '@angular-devkit/schematics';
/** Entry point for the migration schematics with target of Angular CDK 20.0.0 */
export declare function updateToV20(): Rule;

29
node_modules/@angular/cdk/schematics/ng-update/index.js generated vendored Executable file
View File

@@ -0,0 +1,29 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.updateToV20 = updateToV20;
const target_version_1 = require("../update-tool/target-version");
const upgrade_data_1 = require("./upgrade-data");
const devkit_migration_rule_1 = require("./devkit-migration-rule");
const cdkMigrations = [];
/** Entry point for the migration schematics with target of Angular CDK 20.0.0 */
function updateToV20() {
return (0, devkit_migration_rule_1.createMigrationSchematicRule)(target_version_1.TargetVersion.V20, cdkMigrations, upgrade_data_1.cdkUpgradeData, onMigrationComplete);
}
/** Function that will be called when the migration completed. */
function onMigrationComplete(context, targetVersion, hasFailures) {
context.logger.info('');
context.logger.info(` ✓ Updated Angular CDK to ${targetVersion}`);
context.logger.info('');
if (hasFailures) {
context.logger.warn(' ⚠ Some issues were detected but could not be fixed automatically. Please check the ' +
'output above and fix these issues manually.');
}
}
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAUH,kCAOC;AAdD,kEAA4D;AAC5D,iDAA8C;AAC9C,mEAA8F;AAE9F,MAAM,aAAa,GAA8B,EAAE,CAAC;AAEpD,iFAAiF;AACjF,SAAgB,WAAW;IACzB,OAAO,IAAA,oDAA4B,EACjC,8BAAa,CAAC,GAAG,EACjB,aAAa,EACb,6BAAc,EACd,mBAAmB,CACpB,CAAC;AACJ,CAAC;AAED,iEAAiE;AACjE,SAAS,mBAAmB,CAC1B,OAAyB,EACzB,aAA4B,EAC5B,WAAoB;IAEpB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACxB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,+BAA+B,aAAa,EAAE,CAAC,CAAC;IACpE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAExB,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO,CAAC,MAAM,CAAC,IAAI,CACjB,wFAAwF;YACtF,6CAA6C,CAChD,CAAC;IACJ,CAAC;AACH,CAAC"}

View File

@@ -0,0 +1,26 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import * as ts from 'typescript';
import { ResolvedResource } from '../../update-tool/component-resource-collector';
import { Migration } from '../../update-tool/migration';
import { AttributeSelectorUpgradeData } from '../data/attribute-selectors';
import { UpgradeData } from '../upgrade-data';
/**
* Migration that walks through every string literal, template and stylesheet
* in order to switch deprecated attribute selectors to the updated selector.
*/
export declare class AttributeSelectorsMigration extends Migration<UpgradeData> {
/** Required upgrade changes for specified target version. */
data: AttributeSelectorUpgradeData[];
enabled: boolean;
visitNode(node: ts.Node): void;
visitTemplate(template: ResolvedResource): void;
visitStylesheet(stylesheet: ResolvedResource): void;
private _visitStringLiteralLike;
private _replaceSelector;
}

View File

@@ -0,0 +1,71 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.AttributeSelectorsMigration = void 0;
const ts = require("typescript");
const migration_1 = require("../../update-tool/migration");
const literal_1 = require("../typescript/literal");
const upgrade_data_1 = require("../upgrade-data");
/**
* Migration that walks through every string literal, template and stylesheet
* in order to switch deprecated attribute selectors to the updated selector.
*/
class AttributeSelectorsMigration extends migration_1.Migration {
constructor() {
super(...arguments);
/** Required upgrade changes for specified target version. */
this.data = (0, upgrade_data_1.getVersionUpgradeData)(this, 'attributeSelectors');
// Only enable the migration rule if there is upgrade data.
this.enabled = this.data.length !== 0;
}
visitNode(node) {
if (ts.isStringLiteralLike(node)) {
this._visitStringLiteralLike(node);
}
}
visitTemplate(template) {
this.data.forEach(selector => {
(0, literal_1.findAllSubstringIndices)(template.content, selector.replace)
.map(offset => template.start + offset)
.forEach(start => this._replaceSelector(template.filePath, start, selector));
});
}
visitStylesheet(stylesheet) {
this.data.forEach(selector => {
const currentSelector = `[${selector.replace}]`;
const updatedSelector = `[${selector.replaceWith}]`;
(0, literal_1.findAllSubstringIndices)(stylesheet.content, currentSelector)
.map(offset => stylesheet.start + offset)
.forEach(start => this._replaceSelector(stylesheet.filePath, start, {
replace: currentSelector,
replaceWith: updatedSelector,
}));
});
}
_visitStringLiteralLike(literal) {
if (literal.parent && literal.parent.kind !== ts.SyntaxKind.CallExpression) {
return;
}
const literalText = literal.getText();
const filePath = this.fileSystem.resolve(literal.getSourceFile().fileName);
this.data.forEach(selector => {
(0, literal_1.findAllSubstringIndices)(literalText, selector.replace)
.map(offset => literal.getStart() + offset)
.forEach(start => this._replaceSelector(filePath, start, selector));
});
}
_replaceSelector(filePath, start, data) {
this.fileSystem
.edit(filePath)
.remove(start, data.replace.length)
.insertRight(start, data.replaceWith);
}
}
exports.AttributeSelectorsMigration = AttributeSelectorsMigration;
//# sourceMappingURL=attribute-selectors.js.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,IAAI,CAAC,WAAW,CAAC,CAAC;IAC1C,CAAC;CACF;AA9DD,kEA8DC"}

View File

@@ -0,0 +1,26 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import * as ts from 'typescript';
import { Migration } from '../../update-tool/migration';
import { PropertyNameUpgradeData } from '../data/property-names';
import { UpgradeData } from '../upgrade-data';
/**
* Migration that identifies class declarations that extend CDK or Material classes
* which had a public property change.
*/
export declare class ClassInheritanceMigration extends Migration<UpgradeData> {
/**
* Map of classes that have been updated. Each class name maps to the according property
* change data.
*/
propertyNames: Map<string, PropertyNameUpgradeData>;
enabled: boolean;
init(): void;
visitNode(node: ts.Node): void;
private _visitClassDeclaration;
}

View File

@@ -0,0 +1,58 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClassInheritanceMigration = void 0;
const ts = require("typescript");
const migration_1 = require("../../update-tool/migration");
const base_types_1 = require("../typescript/base-types");
const upgrade_data_1 = require("../upgrade-data");
/**
* Migration that identifies class declarations that extend CDK or Material classes
* which had a public property change.
*/
class ClassInheritanceMigration extends migration_1.Migration {
constructor() {
super(...arguments);
/**
* Map of classes that have been updated. Each class name maps to the according property
* change data.
*/
this.propertyNames = new Map();
// Only enable the migration rule if there is upgrade data.
this.enabled = this.propertyNames.size !== 0;
}
init() {
(0, upgrade_data_1.getVersionUpgradeData)(this, 'propertyNames')
.filter(data => data.limitedTo && data.limitedTo.classes)
.forEach(data => data.limitedTo.classes.forEach(name => this.propertyNames.set(name, data)));
}
visitNode(node) {
if (ts.isClassDeclaration(node)) {
this._visitClassDeclaration(node);
}
}
_visitClassDeclaration(node) {
const baseTypes = (0, base_types_1.determineBaseTypes)(node);
const className = node.name ? node.name.text : '{unknown-name}';
if (!baseTypes) {
return;
}
baseTypes.forEach(typeName => {
const data = this.propertyNames.get(typeName);
if (data) {
this.createFailureAtNode(node, `Found class "${className}" which extends class ` +
`"${typeName}". Please note that the base class property ` +
`"${data.replace}" has changed to "${data.replaceWith}". ` +
`You may need to update your class as well.`);
}
});
}
}
exports.ClassInheritanceMigration = ClassInheritanceMigration;
//# sourceMappingURL=class-inheritance.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"class-inheritance.js","sourceRoot":"","sources":["class-inheritance.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,iCAAiC;AACjC,2DAAsD;AAEtD,yDAA4D;AAC5D,kDAAmE;AAEnE;;;GAGG;AACH,MAAa,yBAA0B,SAAQ,qBAAsB;IAArE;;QACE;;;WAGG;QACH,kBAAa,GAAG,IAAI,GAAG,EAAmC,CAAC;QAE3D,2DAA2D;QAC3D,YAAO,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,CAAC;IAoC1C,CAAC;IAlCU,IAAI;QACX,IAAA,oCAAqB,EAAC,IAAI,EAAE,eAAe,CAAC;aACzC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;aACxD,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IACjG,CAAC;IAEQ,SAAS,CAAC,IAAa;QAC9B,IAAI,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;YAChC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;IAEO,sBAAsB,CAAC,IAAyB;QACtD,MAAM,SAAS,GAAG,IAAA,+BAAkB,EAAC,IAAI,CAAC,CAAC;QAC3C,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC;QAEhE,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO;QACT,CAAC;QAED,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC3B,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAE9C,IAAI,IAAI,EAAE,CAAC;gBACT,IAAI,CAAC,mBAAmB,CACtB,IAAI,EACJ,gBAAgB,SAAS,wBAAwB;oBAC/C,IAAI,QAAQ,8CAA8C;oBAC1D,IAAI,IAAI,CAAC,OAAO,qBAAqB,IAAI,CAAC,WAAW,KAAK;oBAC1D,4CAA4C,CAC/C,CAAC;YACJ,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA5CD,8DA4CC"}

View File

@@ -0,0 +1,32 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import * as ts from 'typescript';
import { Migration } from '../../update-tool/migration';
import { ClassNameUpgradeData } from '../data';
import { UpgradeData } from '../upgrade-data';
/**
* Migration that walks through every identifier that is part of Angular Material or thr CDK
* and replaces the outdated name with the new one if specified in the upgrade data.
*/
export declare class ClassNamesMigration extends Migration<UpgradeData> {
/** Change data that upgrades to the specified target version. */
data: ClassNameUpgradeData[];
/**
* List of identifier names that have been imported from `@angular/material` or `@angular/cdk`
* in the current source file and therefore can be considered trusted.
*/
trustedIdentifiers: Set<string>;
/** List of namespaces that have been imported from `@angular/material` or `@angular/cdk`. */
trustedNamespaces: Set<string>;
enabled: boolean;
visitNode(node: ts.Node): void;
/** Method that is called for every identifier inside of the specified project. */
private _visitIdentifier;
/** Creates a failure and replacement for the specified identifier. */
private _createFailureWithReplacement;
}

View File

@@ -0,0 +1,91 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClassNamesMigration = void 0;
const ts = require("typescript");
const migration_1 = require("../../update-tool/migration");
const imports_1 = require("../typescript/imports");
const module_specifiers_1 = require("../typescript/module-specifiers");
const upgrade_data_1 = require("../upgrade-data");
/**
* Migration that walks through every identifier that is part of Angular Material or thr CDK
* and replaces the outdated name with the new one if specified in the upgrade data.
*/
// TODO: rework this rule to identify symbols using the import identifier resolver. This
// makes it more robust, less AST convoluted and is more TypeScript AST idiomatic. COMP-300.
class ClassNamesMigration extends migration_1.Migration {
constructor() {
super(...arguments);
/** Change data that upgrades to the specified target version. */
this.data = (0, upgrade_data_1.getVersionUpgradeData)(this, 'classNames');
/**
* List of identifier names that have been imported from `@angular/material` or `@angular/cdk`
* in the current source file and therefore can be considered trusted.
*/
this.trustedIdentifiers = new Set();
/** List of namespaces that have been imported from `@angular/material` or `@angular/cdk`. */
this.trustedNamespaces = new Set();
// Only enable the migration rule if there is upgrade data.
this.enabled = this.data.length !== 0;
}
visitNode(node) {
if (ts.isIdentifier(node)) {
this._visitIdentifier(node);
}
}
/** Method that is called for every identifier inside of the specified project. */
_visitIdentifier(identifier) {
// For identifiers that aren't listed in the className data, the whole check can be
// skipped safely.
if (!this.data.some(data => data.replace === identifier.text)) {
return;
}
// For namespace imports that are referring to Angular Material or the CDK, we store the
// namespace name in order to be able to safely find identifiers that don't belong to the
// developer's application.
if ((0, imports_1.isNamespaceImportNode)(identifier) && (0, module_specifiers_1.isMaterialImportDeclaration)(identifier)) {
this.trustedNamespaces.add(identifier.text);
return this._createFailureWithReplacement(identifier);
}
// For export declarations that are referring to Angular Material or the CDK, the identifier
// can be immediately updated to the new name.
if ((0, imports_1.isExportSpecifierNode)(identifier) && (0, module_specifiers_1.isMaterialExportDeclaration)(identifier)) {
return this._createFailureWithReplacement(identifier);
}
// For import declarations that are referring to Angular Material or the CDK, the name of
// the import identifiers. This allows us to identify identifiers that belong to Material and
// the CDK, and we won't accidentally touch a developer's identifier.
if ((0, imports_1.isImportSpecifierNode)(identifier) && (0, module_specifiers_1.isMaterialImportDeclaration)(identifier)) {
this.trustedIdentifiers.add(identifier.text);
return this._createFailureWithReplacement(identifier);
}
// In case the identifier is part of a property access expression, we need to verify that the
// property access originates from a namespace that has been imported from Material or the CDK.
if (ts.isPropertyAccessExpression(identifier.parent)) {
const expression = identifier.parent.expression;
if (ts.isIdentifier(expression) && this.trustedNamespaces.has(expression.text)) {
return this._createFailureWithReplacement(identifier);
}
}
else if (this.trustedIdentifiers.has(identifier.text)) {
return this._createFailureWithReplacement(identifier);
}
}
/** Creates a failure and replacement for the specified identifier. */
_createFailureWithReplacement(identifier) {
const classData = this.data.find(data => data.replace === identifier.text);
const filePath = this.fileSystem.resolve(identifier.getSourceFile().fileName);
this.fileSystem
.edit(filePath)
.remove(identifier.getStart(), identifier.getWidth())
.insertRight(identifier.getStart(), classData.replaceWith);
}
}
exports.ClassNamesMigration = ClassNamesMigration;
//# sourceMappingURL=class-names.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"class-names.js","sourceRoot":"","sources":["class-names.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,iCAAiC;AACjC,2DAAsD;AAGtD,mDAI+B;AAC/B,uEAGyC;AACzC,kDAAmE;AAEnE;;;GAGG;AACH,wFAAwF;AACxF,4FAA4F;AAC5F,MAAa,mBAAoB,SAAQ,qBAAsB;IAA/D;;QACE,iEAAiE;QACjE,SAAI,GAA2B,IAAA,oCAAqB,EAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAEzE;;;WAGG;QACH,uBAAkB,GAAgB,IAAI,GAAG,EAAE,CAAC;QAE5C,6FAA6F;QAC7F,sBAAiB,GAAgB,IAAI,GAAG,EAAE,CAAC;QAE3C,2DAA2D;QAC3D,YAAO,GAAG,IAAI,CAAC,IAAI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C/F,IAAI,EAAE,CAAC,0BAA0B,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YACrD,MAAM,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC;YAEhD,IAAI,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC/E,OAAO,IAAI,CAAC,6BAA6B,CAAC,UAAU,CAAC,CAAC;YACxD,CAAC;QACH,CAAC;aAAM,IAAI,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACxD,OAAO,IAAI,CAAC,6BAA6B,CAAC,UAAU,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;IAED,sEAAsE;IAC9D,6BAA6B,CAAC,UAAyB;QAC7D,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,UAAU,CAAC,IAAI,CAAE,CAAC;QAC5E,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC,QAAQ,CAAC,CAAC;QAE9E,IAAI,CAAC,UAAU;aACZ,IAAI,CAAC,QAAQ,CAAC;aACd,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,UAAU,CAAC,QAAQ,EAAE,CAAC;aACpD,WAAW,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAC/D,CAAC;CACF;AA7ED,kDA6EC"}

View File

@@ -0,0 +1,29 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import * as ts from 'typescript';
import { Migration } from '../../update-tool/migration';
import { UpgradeData } from '../upgrade-data';
/**
* Migration that visits every TypeScript new expression or super call and checks if
* the parameter type signature is invalid and needs to be updated manually.
*/
export declare class ConstructorSignatureMigration extends Migration<UpgradeData> {
data: string[];
enabled: boolean;
visitNode(node: ts.Node): void;
/**
* Method that will be called for each source file of the upgrade project. In order to
* properly determine invalid constructor signatures, we take advantage of the pre-emit
* diagnostics from TypeScript.
*
* By using the diagnostics, the migration can handle type assignability. Not using
* diagnostics would mean that we need to use simple type equality checking which is
* too strict. See related issue: https://github.com/Microsoft/TypeScript/issues/9879
*/
private _visitSourceFile;
}

View File

@@ -0,0 +1,139 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConstructorSignatureMigration = void 0;
const ts = require("typescript");
const migration_1 = require("../../update-tool/migration");
const version_changes_1 = require("../../update-tool/version-changes");
/**
* List of diagnostic codes that refer to pre-emit diagnostics which indicate invalid
* new expression or super call signatures. See the list of diagnostics here:
*
* https://github.com/Microsoft/TypeScript/blob/master/src/compiler/diagnosticMessages.json
*/
const signatureErrorDiagnostics = [
// Type not assignable error diagnostic.
2345,
// Constructor argument length invalid diagnostics
2554, 2555, 2556, 2557,
];
/**
* Migration that visits every TypeScript new expression or super call and checks if
* the parameter type signature is invalid and needs to be updated manually.
*/
class ConstructorSignatureMigration extends migration_1.Migration {
constructor() {
super(...arguments);
// Note that the data for this rule is not distinguished based on the target version because
// we don't keep track of the new signature and don't want to update incrementally.
// See: https://github.com/angular/components/pull/12970#issuecomment-418337566
this.data = (0, version_changes_1.getAllChanges)(this.upgradeData.constructorChecks);
// Only enable the migration rule if there is upgrade data.
this.enabled = this.data.length !== 0;
}
visitNode(node) {
if (ts.isSourceFile(node)) {
this._visitSourceFile(node);
}
}
/**
* Method that will be called for each source file of the upgrade project. In order to
* properly determine invalid constructor signatures, we take advantage of the pre-emit
* diagnostics from TypeScript.
*
* By using the diagnostics, the migration can handle type assignability. Not using
* diagnostics would mean that we need to use simple type equality checking which is
* too strict. See related issue: https://github.com/Microsoft/TypeScript/issues/9879
*/
_visitSourceFile(sourceFile) {
// List of classes of which the constructor signature has changed.
const diagnostics = ts
.getPreEmitDiagnostics(this.program, sourceFile)
.filter(diagnostic => signatureErrorDiagnostics.includes(diagnostic.code))
.filter(diagnostic => diagnostic.start !== undefined);
for (const diagnostic of diagnostics) {
const node = findConstructorNode(diagnostic, sourceFile);
if (!node) {
continue;
}
const classType = this.typeChecker.getTypeAtLocation(node.expression);
const className = classType.symbol && classType.symbol.name;
const isNewExpression = ts.isNewExpression(node);
// Determine the class names of the actual construct signatures because we cannot assume that
// the diagnostic refers to a constructor of the actual expression. In case the constructor
// is inherited, we need to detect that the owner-class of the constructor is added to the
// constructor checks upgrade data. e.g. `class CustomCalendar extends MatCalendar {}`.
const signatureClassNames = classType
.getConstructSignatures()
.map(signature => getClassDeclarationOfSignature(signature))
.map(declaration => (declaration && declaration.name ? declaration.name.text : null))
.filter(Boolean);
// Besides checking the signature class names, we need to check the actual class name because
// there can be classes without an explicit constructor.
if (!this.data.includes(className) &&
!signatureClassNames.some(name => this.data.includes(name))) {
continue;
}
const classSignatures = classType
.getConstructSignatures()
.map(signature => getParameterTypesFromSignature(signature, this.typeChecker));
const expressionName = isNewExpression ? `new ${className}` : 'super';
const signatures = classSignatures
.map(signature => signature.map(t => (t === null ? 'any' : this.typeChecker.typeToString(t))))
.map(signature => `${expressionName}(${signature.join(', ')})`)
.join(' or ');
this.createFailureAtNode(node, `Found "${className}" constructed with ` +
`an invalid signature. Please manually update the ${expressionName} expression to ` +
`match the new signature${classSignatures.length > 1 ? 's' : ''}: ${signatures}`);
}
}
}
exports.ConstructorSignatureMigration = ConstructorSignatureMigration;
/** Resolves the type for each parameter in the specified signature. */
function getParameterTypesFromSignature(signature, typeChecker) {
return signature
.getParameters()
.map(param => param.declarations ? typeChecker.getTypeAtLocation(param.declarations[0]) : null);
}
/**
* Walks through each node of a source file in order to find a new-expression node or super-call
* expression node that is captured by the specified diagnostic.
*/
function findConstructorNode(diagnostic, sourceFile) {
let resolvedNode = null;
const _visitNode = (node) => {
// Check whether the current node contains the diagnostic. If the node contains the diagnostic,
// walk deeper in order to find all constructor expression nodes.
if (node.getStart() <= diagnostic.start && node.getEnd() >= diagnostic.start) {
if (ts.isNewExpression(node) ||
(ts.isCallExpression(node) && node.expression.kind === ts.SyntaxKind.SuperKeyword)) {
resolvedNode = node;
}
ts.forEachChild(node, _visitNode);
}
};
ts.forEachChild(sourceFile, _visitNode);
return resolvedNode;
}
/** Determines the class declaration of the specified construct signature. */
function getClassDeclarationOfSignature(signature) {
let node = signature.getDeclaration();
// Handle signatures which don't have an actual declaration. This happens if a class
// does not have an explicitly written constructor.
if (!node) {
return null;
}
while (!ts.isSourceFile((node = node.parent))) {
if (ts.isClassDeclaration(node)) {
return node;
}
}
return null;
}
//# sourceMappingURL=constructor-signature.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"constructor-signature.js","sourceRoot":"","sources":["constructor-signature.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,iCAAiC;AACjC,2DAAsD;AACtD,uEAAgE;AAGhE;;;;;GAKG;AACH,MAAM,yBAAyB,GAAG;IAChC,wCAAwC;IACxC,IAAI;IACJ,kDAAkD;IAClD,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;CACvB,CAAC;AAEF;;;GAGG;AACH,MAAa,6BAA8B,SAAQ,qBAAsB;IAAzE;;QACE,4FAA4F;QAC5F,mFAAmF;QACnF,+EAA+E;QAC/E,SAAI,GAAG,IAAA,+BAAa,EAAC,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;QAEzD,2DAA2D;QAC3D,YAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;IA0EnC,CAAC;IAxEU,SAAS,CAAC,IAAa;QAC9B,IAAI,EAAE,CAAC,YAAY,CAAC,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,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;QAC9C,IAAI,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;YAChC,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}

View File

@@ -0,0 +1,26 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import * as ts from 'typescript';
import { ResolvedResource } from '../../update-tool/component-resource-collector';
import { Migration } from '../../update-tool/migration';
import { CssSelectorUpgradeData } from '../data/css-selectors';
import { UpgradeData } from '../upgrade-data';
/**
* Migration that walks through every string literal, template and stylesheet in
* order to migrate outdated CSS selectors to the new selector.
*/
export declare class CssSelectorsMigration extends Migration<UpgradeData> {
/** Change data that upgrades to the specified target version. */
data: CssSelectorUpgradeData[];
enabled: boolean;
visitNode(node: ts.Node): void;
visitTemplate(template: ResolvedResource): void;
visitStylesheet(stylesheet: ResolvedResource): void;
private _visitStringLiteralLike;
private _replaceSelector;
}

View File

@@ -0,0 +1,75 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.CssSelectorsMigration = void 0;
const ts = require("typescript");
const migration_1 = require("../../update-tool/migration");
const literal_1 = require("../typescript/literal");
const upgrade_data_1 = require("../upgrade-data");
/**
* Migration that walks through every string literal, template and stylesheet in
* order to migrate outdated CSS selectors to the new selector.
*/
class CssSelectorsMigration extends migration_1.Migration {
constructor() {
super(...arguments);
/** Change data that upgrades to the specified target version. */
this.data = (0, upgrade_data_1.getVersionUpgradeData)(this, 'cssSelectors');
// Only enable the migration rule if there is upgrade data.
this.enabled = this.data.length !== 0;
}
visitNode(node) {
if (ts.isStringLiteralLike(node)) {
this._visitStringLiteralLike(node);
}
}
visitTemplate(template) {
this.data.forEach(data => {
if (data.replaceIn && !data.replaceIn.html) {
return;
}
(0, literal_1.findAllSubstringIndices)(template.content, data.replace)
.map(offset => template.start + offset)
.forEach(start => this._replaceSelector(template.filePath, start, data));
});
}
visitStylesheet(stylesheet) {
this.data.forEach(data => {
if (data.replaceIn && !data.replaceIn.stylesheet) {
return;
}
(0, literal_1.findAllSubstringIndices)(stylesheet.content, data.replace)
.map(offset => stylesheet.start + offset)
.forEach(start => this._replaceSelector(stylesheet.filePath, start, data));
});
}
_visitStringLiteralLike(node) {
if (node.parent && node.parent.kind !== ts.SyntaxKind.CallExpression) {
return;
}
const textContent = node.getText();
const filePath = this.fileSystem.resolve(node.getSourceFile().fileName);
this.data.forEach(data => {
if (data.replaceIn && !data.replaceIn.tsStringLiterals) {
return;
}
(0, literal_1.findAllSubstringIndices)(textContent, data.replace)
.map(offset => node.getStart() + offset)
.forEach(start => this._replaceSelector(filePath, start, data));
});
}
_replaceSelector(filePath, start, data) {
this.fileSystem
.edit(filePath)
.remove(start, data.replace.length)
.insertRight(start, data.replaceWith);
}
}
exports.CssSelectorsMigration = CssSelectorsMigration;
//# sourceMappingURL=css-selectors.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"css-selectors.js","sourceRoot":"","sources":["css-selectors.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,iCAAiC;AAGjC,2DAAsD;AAEtD,mDAA8D;AAC9D,kDAAmE;AAEnE;;;GAGG;AACH,MAAa,qBAAsB,SAAQ,qBAAsB;IAAjE;;QACE,iEAAiE;QACjE,SAAI,GAA6B,IAAA,oCAAqB,EAAC,IAAI,EAAE,cAAc,CAAC,CAAC;QAE7E,2DAA2D;QAC3D,YAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;IAyDnC,CAAC;IAvDU,SAAS,CAAC,IAAa;QAC9B,IAAI,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;YACjC,IAAI,CAAC,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;YACrE,OAAO;QACT,CAAC;QAED,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,QAAQ,CAAC,CAAC;QAExE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACvB,IAAI,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE,CAAC;gBACvD,OAAO;YACT,CAAC;YAED,IAAA,iCAAuB,EAAC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC;iBAC/C,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,MAAM,CAAC;iBACvC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;QACpE,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,gBAAgB,CAAC,QAAuB,EAAE,KAAa,EAAE,IAA4B;QAC3F,IAAI,CAAC,UAAU;aACZ,IAAI,CAAC,QAAQ,CAAC;aACd,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;aAClC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAC1C,CAAC;CACF;AA9DD,sDA8DC"}

View File

@@ -0,0 +1,26 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import * as ts from 'typescript';
import { ResolvedResource } from '../../update-tool/component-resource-collector';
import { Migration } from '../../update-tool/migration';
import { CssTokenUpgradeData } from '../data/css-tokens';
import { UpgradeData } from '../upgrade-data';
/**
* Migration that walks through every string literal, template and stylesheet in
* order to migrate outdated CSS tokens to their new name.
*/
export declare class CssTokensMigration extends Migration<UpgradeData> {
/** Change data that upgrades to the specified target version. */
data: CssTokenUpgradeData[];
enabled: boolean;
visitNode(node: ts.Node): void;
visitTemplate(template: ResolvedResource): void;
visitStylesheet(stylesheet: ResolvedResource): void;
private _visitStringLiteralLike;
private _replaceSelector;
}

View File

@@ -0,0 +1,83 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.CssTokensMigration = void 0;
const ts = require("typescript");
const migration_1 = require("../../update-tool/migration");
const literal_1 = require("../typescript/literal");
const upgrade_data_1 = require("../upgrade-data");
/** Characters that can be part of a valid token name. */
const TOKEN_CHARACTER = /[-_a-z0-9]/i;
/**
* Migration that walks through every string literal, template and stylesheet in
* order to migrate outdated CSS tokens to their new name.
*/
class CssTokensMigration extends migration_1.Migration {
constructor() {
super(...arguments);
/** Change data that upgrades to the specified target version. */
this.data = (0, upgrade_data_1.getVersionUpgradeData)(this, 'cssTokens');
// Only enable the migration rule if there is upgrade data.
this.enabled = this.data.length !== 0;
}
visitNode(node) {
if (ts.isStringLiteralLike(node)) {
this._visitStringLiteralLike(node);
}
}
visitTemplate(template) {
this.data.forEach(data => {
if (data.replaceIn && !data.replaceIn.html) {
return;
}
(0, literal_1.findAllSubstringIndices)(template.content, data.replace)
.map(offset => template.start + offset)
// Filter out matches that are followed by a valid token character, so that we don't match
// partial token names.
.filter(start => !TOKEN_CHARACTER.test(template.content[start + data.replace.length] || ''))
.forEach(start => this._replaceSelector(template.filePath, start, data));
});
}
visitStylesheet(stylesheet) {
this.data.forEach(data => {
if (data.replaceIn && !data.replaceIn.stylesheet) {
return;
}
(0, literal_1.findAllSubstringIndices)(stylesheet.content, data.replace)
.map(offset => stylesheet.start + offset)
// Filter out matches that are followed by a valid token character, so that we don't match
// partial token names.
.filter(start => !TOKEN_CHARACTER.test(stylesheet.content[start + data.replace.length] || ''))
.forEach(start => this._replaceSelector(stylesheet.filePath, start, data));
});
}
_visitStringLiteralLike(node) {
const textContent = node.getText();
const filePath = this.fileSystem.resolve(node.getSourceFile().fileName);
this.data.forEach(data => {
if (data.replaceIn && !data.replaceIn.tsStringLiterals) {
return;
}
(0, literal_1.findAllSubstringIndices)(textContent, data.replace)
.map(offset => node.getStart() + offset)
// Filter out matches that are followed by a valid token character, so that we don't match
// partial token names.
.filter(start => !TOKEN_CHARACTER.test(textContent[start + data.replace.length] || ''))
.forEach(start => this._replaceSelector(filePath, start, data));
});
}
_replaceSelector(filePath, start, data) {
this.fileSystem
.edit(filePath)
.remove(start, data.replace.length)
.insertRight(start, data.replaceWith);
}
}
exports.CssTokensMigration = CssTokensMigration;
//# sourceMappingURL=css-tokens.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"css-tokens.js","sourceRoot":"","sources":["css-tokens.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,iCAAiC;AAGjC,2DAAsD;AAEtD,mDAA8D;AAC9D,kDAAmE;AAEnE,yDAAyD;AACzD,MAAM,eAAe,GAAG,aAAa,CAAC;AAEtC;;;GAGG;AACH,MAAa,kBAAmB,SAAQ,qBAAsB;IAA9D;;QACE,iEAAiE;QACjE,SAAI,GAA0B,IAAA,oCAAqB,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAEvE,2DAA2D;QAC3D,YAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;IAgEnC,CAAC;IA9DU,SAAS,CAAC,IAAa;QAC9B,IAAI,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;YACjC,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IAEQ,aAAa,CAAC,QAA0B;QAC/C,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACvB,IAAI,IAAI,CAAC,SAAS,IA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@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import * as ts from 'typescript';
import { ResolvedResource } from '../../update-tool/component-resource-collector';
import { Migration } from '../../update-tool/migration';
import { ElementSelectorUpgradeData } from '../data/element-selectors';
import { UpgradeData } from '../upgrade-data';
/**
* Migration that walks through every string literal, template and stylesheet in order
* to migrate outdated element selectors to the new one.
*/
export declare class ElementSelectorsMigration extends Migration<UpgradeData> {
/** Change data that upgrades to the specified target version. */
data: ElementSelectorUpgradeData[];
enabled: boolean;
visitNode(node: ts.Node): void;
visitTemplate(template: ResolvedResource): void;
visitStylesheet(stylesheet: ResolvedResource): void;
private _visitStringLiteralLike;
private _replaceSelector;
}

View File

@@ -0,0 +1,66 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ElementSelectorsMigration = void 0;
const ts = require("typescript");
const migration_1 = require("../../update-tool/migration");
const literal_1 = require("../typescript/literal");
const upgrade_data_1 = require("../upgrade-data");
/**
* Migration that walks through every string literal, template and stylesheet in order
* to migrate outdated element selectors to the new one.
*/
class ElementSelectorsMigration extends migration_1.Migration {
constructor() {
super(...arguments);
/** Change data that upgrades to the specified target version. */
this.data = (0, upgrade_data_1.getVersionUpgradeData)(this, 'elementSelectors');
// Only enable the migration rule if there is upgrade data.
this.enabled = this.data.length !== 0;
}
visitNode(node) {
if (ts.isStringLiteralLike(node)) {
this._visitStringLiteralLike(node);
}
}
visitTemplate(template) {
this.data.forEach(selector => {
(0, literal_1.findAllSubstringIndices)(template.content, selector.replace)
.map(offset => template.start + offset)
.forEach(start => this._replaceSelector(template.filePath, start, selector));
});
}
visitStylesheet(stylesheet) {
this.data.forEach(selector => {
(0, literal_1.findAllSubstringIndices)(stylesheet.content, selector.replace)
.map(offset => stylesheet.start + offset)
.forEach(start => this._replaceSelector(stylesheet.filePath, start, selector));
});
}
_visitStringLiteralLike(node) {
if (node.parent && node.parent.kind !== ts.SyntaxKind.CallExpression) {
return;
}
const textContent = node.getText();
const filePath = this.fileSystem.resolve(node.getSourceFile().fileName);
this.data.forEach(selector => {
(0, literal_1.findAllSubstringIndices)(textContent, selector.replace)
.map(offset => node.getStart() + offset)
.forEach(start => this._replaceSelector(filePath, start, selector));
});
}
_replaceSelector(filePath, start, data) {
this.fileSystem
.edit(filePath)
.remove(start, data.replace.length)
.insertRight(start, data.replaceWith);
}
}
exports.ElementSelectorsMigration = ElementSelectorsMigration;
//# sourceMappingURL=element-selectors.js.map

Some files were not shown because too many files have changed in this diff Show More