@angular/google-maps 19.0.0-next.9 → 19.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -17,8 +17,9 @@ declare interface Algorithm_2 {
17
17
  */
18
18
  calculate: ({ markers, map }: AlgorithmInput) => AlgorithmOutput;
19
19
  }
20
+ export { Algorithm_2 as Algorithm }
20
21
 
21
- declare interface AlgorithmInput {
22
+ export declare interface AlgorithmInput {
22
23
  /**
23
24
  * The map containing the markers and clusters.
24
25
  */
@@ -38,15 +39,15 @@ declare interface AlgorithmInput {
38
39
  mapCanvasProjection: google.maps.MapCanvasProjection;
39
40
  }
40
41
 
41
- declare interface AlgorithmOptions {
42
+ export declare interface AlgorithmOptions {
42
43
  maxZoom?: number;
43
44
  }
44
45
 
45
- declare interface AlgorithmOutput {
46
+ export declare interface AlgorithmOutput {
46
47
  /**
47
48
  * The clusters returned based upon the {@link AlgorithmInput}.
48
49
  */
49
- clusters: Cluster_2[];
50
+ clusters: Cluster[];
50
51
  /**
51
52
  * A boolean flag indicating that the clusters have not changed.
52
53
  */
@@ -67,20 +68,7 @@ export declare type AriaLabelFn = (text: string) => string;
67
68
  */
68
69
  export declare type Calculator = (markers: google.maps.Marker[], clusterIconStylesCount: number) => ClusterIconInfo;
69
70
 
70
- /**
71
- * Cluster class from the @google/markerclustererplus library.
72
- *
73
- * See googlemaps.github.io/v3-utility-library/classes/_google_markerclustererplus.cluster.html
74
- */
75
- declare class Cluster {
76
- constructor(markerClusterer: MarkerClusterer);
77
- getCenter(): google.maps.LatLng;
78
- getMarkers(): google.maps.Marker[];
79
- getSize(): number;
80
- updateIcon(): void;
81
- }
82
-
83
- declare class Cluster_2 {
71
+ export declare class Cluster {
84
72
  marker?: Marker;
85
73
  readonly markers?: Marker[];
86
74
  protected _position: google.maps.LatLng;
@@ -101,6 +89,19 @@ declare class Cluster_2 {
101
89
  delete(): void;
102
90
  }
103
91
 
92
+ /**
93
+ * Cluster class from the @google/markerclustererplus library.
94
+ *
95
+ * See googlemaps.github.io/v3-utility-library/classes/_google_markerclustererplus.cluster.html
96
+ */
97
+ declare class Cluster_2 {
98
+ constructor(markerClusterer: MarkerClusterer_2);
99
+ getCenter(): google.maps.LatLng;
100
+ getMarkers(): google.maps.Marker[];
101
+ getSize(): number;
102
+ updateIcon(): void;
103
+ }
104
+
104
105
  /**
105
106
  * Info interface for a marker cluster icon.
106
107
  *
@@ -138,12 +139,12 @@ export declare interface ClusterIconStyle {
138
139
  width: number;
139
140
  }
140
141
 
141
- declare interface ClusterOptions {
142
+ export declare interface ClusterOptions {
142
143
  position?: google.maps.LatLng | google.maps.LatLngLiteral;
143
144
  markers?: Marker[];
144
145
  }
145
146
 
146
- declare class ClusterStats {
147
+ export declare class ClusterStats {
147
148
  readonly markers: {
148
149
  sum: number;
149
150
  };
@@ -156,7 +157,7 @@ declare class ClusterStats {
156
157
  max: number;
157
158
  };
158
159
  };
159
- constructor(markers: Marker[], clusters: Cluster_2[]);
160
+ constructor(markers: Marker[], clusters: Cluster[]);
160
161
  }
161
162
 
162
163
  /** Arbitrary default height for the map element */
@@ -190,6 +191,8 @@ declare const DEFAULT_OPTIONS: google.maps.MapOptions;
190
191
  /** Arbitrary default width for the map element */
191
192
  declare const DEFAULT_WIDTH = "500px";
192
193
 
194
+ export declare const defaultOnClusterClickHandler: onClusterClickHandler;
195
+
193
196
  /**
194
197
  * Angular component for implementing a Google Maps Marker Clusterer.
195
198
  * See https://developers.google.com/maps/documentation/javascript/marker-clustering
@@ -255,7 +258,7 @@ export declare class DeprecatedMapMarkerClusterer implements OnInit, AfterConten
255
258
  */
256
259
  readonly clusteringend: Observable<void>;
257
260
  /** Emits when a cluster has been clicked. */
258
- readonly clusterClick: Observable<Cluster>;
261
+ readonly clusterClick: Observable<Cluster_2>;
259
262
  _markers: QueryList<MapMarker>;
260
263
  /**
261
264
  * The underlying MarkerClusterer object.
@@ -264,9 +267,9 @@ export declare class DeprecatedMapMarkerClusterer implements OnInit, AfterConten
264
267
  * googlemaps.github.io/v3-utility-library/classes/
265
268
  * _google_markerclustererplus.markerclusterer.html
266
269
  */
267
- markerClusterer?: MarkerClusterer;
270
+ markerClusterer?: MarkerClusterer_2;
268
271
  /** Event emitted when the clusterer is initialized. */
269
- readonly markerClustererInitialized: EventEmitter<MarkerClusterer>;
272
+ readonly markerClustererInitialized: EventEmitter<MarkerClusterer_2>;
270
273
  constructor(...args: unknown[]);
271
274
  ngOnInit(): void;
272
275
  ngAfterContentInit(): void;
@@ -277,7 +280,7 @@ export declare class DeprecatedMapMarkerClusterer implements OnInit, AfterConten
277
280
  getBatchSizeIE(): number;
278
281
  getCalculator(): Calculator;
279
282
  getClusterClass(): string;
280
- getClusters(): Cluster[];
283
+ getClusters(): Cluster_2[];
281
284
  getEnableRetinaIcons(): boolean;
282
285
  getGridSize(): number;
283
286
  getIgnoreHidden(): boolean;
@@ -1631,12 +1634,12 @@ export declare class MapMarkerClusterer implements OnInit, OnChanges, OnDestroy
1631
1634
  /** Emits when clustering is done. */
1632
1635
  readonly clusteringend: Observable<void>;
1633
1636
  /** Emits when a cluster has been clicked. */
1634
- readonly clusterClick: EventEmitter<Cluster_2>;
1637
+ readonly clusterClick: EventEmitter<Cluster>;
1635
1638
  /** Event emitted when the marker clusterer is initialized. */
1636
- readonly markerClustererInitialized: EventEmitter<MarkerClusterer_2>;
1639
+ readonly markerClustererInitialized: EventEmitter<MarkerClusterer>;
1637
1640
  _markers: QueryList<MarkerDirective>;
1638
1641
  /** Underlying MarkerClusterer object used to interact with Google Maps. */
1639
- markerClusterer?: MarkerClusterer_2;
1642
+ markerClusterer?: MarkerClusterer;
1640
1643
  ngOnInit(): Promise<void>;
1641
1644
  ngOnChanges(changes: SimpleChanges): Promise<void>;
1642
1645
  ngOnDestroy(): void;
@@ -2016,6 +2019,27 @@ export declare class MapTransitLayer implements OnInit, OnDestroy {
2016
2019
  /** Marker types from the Google Maps API. */
2017
2020
  declare type Marker = google.maps.Marker | google.maps.marker.AdvancedMarkerElement;
2018
2021
 
2022
+ export declare class MarkerClusterer extends google.maps.OverlayView {
2023
+ onClusterClick: onClusterClickHandler;
2024
+ protected algorithm: Algorithm_2;
2025
+ protected clusters: Cluster[];
2026
+ protected markers: Marker[];
2027
+ protected renderer: Renderer;
2028
+ protected map: google.maps.Map | null;
2029
+ protected idleListener: google.maps.MapsEventListener;
2030
+ constructor({ map, markers, algorithmOptions, algorithm, renderer, onClusterClick, }: MarkerClustererOptions_2);
2031
+ addMarker(marker: Marker, noDraw?: boolean): void;
2032
+ addMarkers(markers: Marker[], noDraw?: boolean): void;
2033
+ removeMarker(marker: Marker, noDraw?: boolean): boolean;
2034
+ removeMarkers(markers: Marker[], noDraw?: boolean): boolean;
2035
+ clearMarkers(noDraw?: boolean): void;
2036
+ render(): void;
2037
+ onAdd(): void;
2038
+ onRemove(): void;
2039
+ protected reset(): void;
2040
+ protected renderClusters(): void;
2041
+ }
2042
+
2019
2043
 
2020
2044
  /// <reference types="google.maps" preserve="true" />
2021
2045
  /**
@@ -2024,7 +2048,7 @@ declare type Marker = google.maps.Marker | google.maps.marker.AdvancedMarkerElem
2024
2048
  * See
2025
2049
  * googlemaps.github.io/v3-utility-library/classes/_google_markerclustererplus.markerclusterer.html
2026
2050
  */
2027
- declare class MarkerClusterer {
2051
+ declare class MarkerClusterer_2 {
2028
2052
  constructor(map: google.maps.Map, markers?: google.maps.Marker[], options?: MarkerClustererOptions);
2029
2053
  ariaLabelFn: AriaLabelFn;
2030
2054
  static BATCH_SIZE: number;
@@ -2033,7 +2057,7 @@ declare class MarkerClusterer {
2033
2057
  static IMAGE_PATH: string;
2034
2058
  static IMAGE_SIZES: number[];
2035
2059
  addListener(eventName: string, handler: Function): google.maps.MapsEventListener;
2036
- addMarker(marker: MarkerClusterer, nodraw: boolean): void;
2060
+ addMarker(marker: MarkerClusterer_2, nodraw: boolean): void;
2037
2061
  addMarkers(markers: google.maps.Marker[], nodraw?: boolean): void;
2038
2062
  bindTo(key: string, target: google.maps.MVCObject, targetKey: string, noNotify: boolean): void;
2039
2063
  changed(key: string): void;
@@ -2044,7 +2068,7 @@ declare class MarkerClusterer {
2044
2068
  getBatchSizeIE(): number;
2045
2069
  getCalculator(): Calculator;
2046
2070
  getClusterClass(): string;
2047
- getClusters(): Cluster[];
2071
+ getClusters(): Cluster_2[];
2048
2072
  getEnableRetinaIcons(): boolean;
2049
2073
  getGridSize(): number;
2050
2074
  getIgnoreHidden(): boolean;
@@ -2093,25 +2117,10 @@ declare class MarkerClusterer {
2093
2117
  static withDefaultStyle(overrides: ClusterIconStyle): ClusterIconStyle;
2094
2118
  }
2095
2119
 
2096
- declare class MarkerClusterer_2 extends google.maps.OverlayView {
2097
- onClusterClick: onClusterClickHandler;
2098
- protected algorithm: Algorithm_2;
2099
- protected clusters: Cluster_2[];
2100
- protected markers: Marker[];
2101
- protected renderer: Renderer;
2102
- protected map: google.maps.Map | null;
2103
- protected idleListener: google.maps.MapsEventListener;
2104
- constructor({ map, markers, algorithmOptions, algorithm, renderer, onClusterClick, }: MarkerClustererOptions_2);
2105
- addMarker(marker: Marker, noDraw?: boolean): void;
2106
- addMarkers(markers: Marker[], noDraw?: boolean): void;
2107
- removeMarker(marker: Marker, noDraw?: boolean): boolean;
2108
- removeMarkers(markers: Marker[], noDraw?: boolean): boolean;
2109
- clearMarkers(noDraw?: boolean): void;
2110
- render(): void;
2111
- onAdd(): void;
2112
- onRemove(): void;
2113
- protected reset(): void;
2114
- protected renderClusters(): void;
2120
+ export declare enum MarkerClustererEvents {
2121
+ CLUSTERING_BEGIN = "clusteringbegin",
2122
+ CLUSTERING_END = "clusteringend",
2123
+ CLUSTER_CLICK = "click"
2115
2124
  }
2116
2125
 
2117
2126
  /**
@@ -2165,9 +2174,9 @@ declare interface MarkerDirective {
2165
2174
  _resolveMarker(): Promise<Marker>;
2166
2175
  }
2167
2176
 
2168
- declare type onClusterClickHandler = (event: google.maps.MapMouseEvent, cluster: Cluster_2, map: google.maps.Map) => void;
2177
+ export declare type onClusterClickHandler = (event: google.maps.MapMouseEvent, cluster: Cluster, map: google.maps.Map) => void;
2169
2178
 
2170
- declare interface Renderer {
2179
+ export declare interface Renderer {
2171
2180
  /**
2172
2181
  * Turn a {@link Cluster} into a `Marker`.
2173
2182
  *
@@ -2180,7 +2189,7 @@ declare interface Renderer {
2180
2189
  * });
2181
2190
  * ```
2182
2191
  */
2183
- render(cluster: Cluster_2, stats: ClusterStats, map: google.maps.Map): Marker;
2192
+ render(cluster: Cluster, stats: ClusterStats, map: google.maps.Map): Marker;
2184
2193
  }
2185
2194
 
2186
2195
  export { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/google-maps",
3
- "version": "19.0.0-next.9",
3
+ "version": "19.0.0-rc.1",
4
4
  "description": "Angular Google Maps",
5
5
  "repository": {
6
6
  "type": "git",
@@ -36,9 +36,13 @@ var DEPRECATED_CLASS_NAME = "DeprecatedMapMarkerClusterer";
36
36
  function updateToV19() {
37
37
  return (tree) => {
38
38
  tree.visit((path) => {
39
+ var _a;
40
+ if (path.includes("node_modules")) {
41
+ return;
42
+ }
39
43
  if (path.endsWith(".html")) {
40
- const content = tree.readText(path);
41
- if (content.includes("<" + TAG_NAME)) {
44
+ const content = (_a = tree.read(path)) == null ? void 0 : _a.toString();
45
+ if (content && content.includes("<" + TAG_NAME)) {
42
46
  tree.overwrite(path, migrateHtml(content));
43
47
  }
44
48
  } else if (path.endsWith(".ts") && !path.endsWith(".d.ts")) {
@@ -51,8 +55,9 @@ function migrateHtml(content) {
51
55
  return content.replace(/<map-marker-clusterer/g, "<deprecated-map-marker-clusterer").replace(/<\/map-marker-clusterer/g, "</deprecated-map-marker-clusterer");
52
56
  }
53
57
  function migrateTypeScript(path, tree) {
54
- const content = tree.readText(path);
55
- if (!content.includes("<" + TAG_NAME) && !content.includes(MODULE_NAME) && !content.includes(CLASS_NAME)) {
58
+ var _a;
59
+ const content = (_a = tree.read(path)) == null ? void 0 : _a.toString();
60
+ if (!content || !content.includes("<" + TAG_NAME) && !content.includes(MODULE_NAME) && !content.includes(CLASS_NAME)) {
56
61
  return;
57
62
  }
58
63
  const sourceFile = import_typescript.default.createSourceFile(path, content, import_typescript.default.ScriptTarget.Latest, true);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/google-maps/schematics/ng-update/index.ts"],
4
- "sourcesContent": ["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Path} from '@angular-devkit/core';\nimport {Rule, Tree} from '@angular-devkit/schematics';\nimport ts from 'typescript';\n\n/** Tag name of the clusterer component. */\nconst TAG_NAME = 'map-marker-clusterer';\n\n/** Module from which the clusterer is being imported. */\nconst MODULE_NAME = '@angular/google-maps';\n\n/** Old name of the clusterer class. */\nconst CLASS_NAME = 'MapMarkerClusterer';\n\n/** New name of the clusterer class. */\nconst DEPRECATED_CLASS_NAME = 'DeprecatedMapMarkerClusterer';\n\n/** Entry point for the migration schematics with target of Angular Material v19 */\nexport function updateToV19(): Rule {\n return tree => {\n tree.visit(path => {\n if (path.endsWith('.html')) {\n const content = tree.readText(path);\n\n if (content.includes('<' + TAG_NAME)) {\n tree.overwrite(path, migrateHtml(content));\n }\n } else if (path.endsWith('.ts') && !path.endsWith('.d.ts')) {\n migrateTypeScript(path, tree);\n }\n });\n };\n}\n\n/** Migrates an HTML template from the old tag name to the new one. */\nfunction migrateHtml(content: string): string {\n return content\n .replace(/<map-marker-clusterer/g, '<deprecated-map-marker-clusterer')\n .replace(/<\\/map-marker-clusterer/g, '</deprecated-map-marker-clusterer');\n}\n\n/** Migrates a TypeScript file from the old tag and class names to the new ones. */\nfunction migrateTypeScript(path: Path, tree: Tree) {\n const content = tree.readText(path);\n\n // Exit early if none of the symbols we're looking for are mentioned.\n if (\n !content.includes('<' + TAG_NAME) &&\n !content.includes(MODULE_NAME) &&\n !content.includes(CLASS_NAME)\n ) {\n return;\n }\n\n const sourceFile = ts.createSourceFile(path, content, ts.ScriptTarget.Latest, true);\n const toMigrate = findTypeScriptNodesToMigrate(sourceFile);\n\n if (toMigrate.length === 0) {\n return;\n }\n\n const printer = ts.createPrinter();\n const update = tree.beginUpdate(path);\n\n for (const node of toMigrate) {\n let replacement: ts.Node;\n\n if (ts.isStringLiteralLike(node)) {\n // Strings should be migrated as if they're HTML.\n if (ts.isStringLiteral(node)) {\n replacement = ts.factory.createStringLiteral(\n migrateHtml(node.text),\n node.getText()[0] === `'`,\n );\n } else {\n replacement = ts.factory.createNoSubstitutionTemplateLiteral(migrateHtml(node.text));\n }\n } else {\n // Imports/exports should preserve the old name, but import the clusterer using the new one.\n const propertyName = ts.factory.createIdentifier(DEPRECATED_CLASS_NAME);\n const name = node.name as ts.Identifier;\n\n replacement = ts.isImportSpecifier(node)\n ? ts.factory.updateImportSpecifier(node, node.isTypeOnly, propertyName, name)\n : ts.factory.updateExportSpecifier(node, node.isTypeOnly, propertyName, name);\n }\n\n update\n .remove(node.getStart(), node.getWidth())\n .insertLeft(\n node.getStart(),\n printer.printNode(ts.EmitHint.Unspecified, replacement, sourceFile),\n );\n }\n\n tree.commitUpdate(update);\n}\n\n/** Finds the TypeScript nodes that need to be migrated from a specific file. */\nfunction findTypeScriptNodesToMigrate(sourceFile: ts.SourceFile) {\n const results: (ts.StringLiteralLike | ts.ImportSpecifier | ts.ExportSpecifier)[] = [];\n\n sourceFile.forEachChild(function walk(node) {\n // Most likely a template using the clusterer.\n if (ts.isStringLiteral(node) && node.text.includes('<' + TAG_NAME)) {\n results.push(node);\n } else if (\n // Import/export referencing the clusterer.\n (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) &&\n node.moduleSpecifier &&\n ts.isStringLiteralLike(node.moduleSpecifier) &&\n node.moduleSpecifier.text === MODULE_NAME\n ) {\n const bindings = ts.isImportDeclaration(node)\n ? node.importClause?.namedBindings\n : node.exportClause;\n\n if (bindings && (ts.isNamedImports(bindings) || ts.isNamedExports(bindings))) {\n bindings.elements.forEach(element => {\n const symbolName = element.propertyName || element.name;\n\n if (ts.isIdentifier(symbolName) && symbolName.text === CLASS_NAME) {\n results.push(element);\n }\n });\n }\n } else {\n node.forEachChild(walk);\n }\n });\n\n // Sort the results in reverse order to make applying the updates easier.\n return results.sort((a, b) => b.getStart() - a.getStart());\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAUA,wBAAe;AAGf,IAAM,WAAW;AAGjB,IAAM,cAAc;AAGpB,IAAM,aAAa;AAGnB,IAAM,wBAAwB;AAGxB,SAAU,cAAW;AACzB,SAAO,UAAO;AACZ,SAAK,MAAM,UAAO;AAChB,UAAI,KAAK,SAAS,OAAO,GAAG;AAC1B,cAAM,UAAU,KAAK,SAAS,IAAI;AAElC,YAAI,QAAQ,SAAS,MAAM,QAAQ,GAAG;AACpC,eAAK,UAAU,MAAM,YAAY,OAAO,CAAC;QAC3C;MACF,WAAW,KAAK,SAAS,KAAK,KAAK,CAAC,KAAK,SAAS,OAAO,GAAG;AAC1D,0BAAkB,MAAM,IAAI;MAC9B;IACF,CAAC;EACH;AACF;AAGA,SAAS,YAAY,SAAe;AAClC,SAAO,QACJ,QAAQ,0BAA0B,kCAAkC,EACpE,QAAQ,4BAA4B,mCAAmC;AAC5E;AAGA,SAAS,kBAAkB,MAAY,MAAU;AAC/C,QAAM,UAAU,KAAK,SAAS,IAAI;AAGlC,MACE,CAAC,QAAQ,SAAS,MAAM,QAAQ,KAChC,CAAC,QAAQ,SAAS,WAAW,KAC7B,CAAC,QAAQ,SAAS,UAAU,GAC5B;AACA;EACF;AAEA,QAAM,aAAa,kBAAAA,QAAG,iBAAiB,MAAM,SAAS,kBAAAA,QAAG,aAAa,QAAQ,IAAI;AAClF,QAAM,YAAY,6BAA6B,UAAU;AAEzD,MAAI,UAAU,WAAW,GAAG;AAC1B;E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AAM,WAAW,kBAAAA,QAAG,oBAAoB,IAAI,KACxC,UAAK,iBAAL,mBAAmB,gBACnB,KAAK;AAET,UAAI,aAAa,kBAAAA,QAAG,eAAe,QAAQ,KAAK,kBAAAA,QAAG,eAAe,QAAQ,IAAI;AAC5E,iBAAS,SAAS,QAAQ,aAAU;AAClC,gBAAM,aAAa,QAAQ,gBAAgB,QAAQ;AAEnD,cAAI,kBAAAA,QAAG,aAAa,UAAU,KAAK,WAAW,SAAS,YAAY;AACjE,oBAAQ,KAAK,OAAO;UACtB;QACF,CAAC;MACH;IACF,OAAO;AACL,WAAK,aAAa,IAAI;IACxB;EACF,CAAC;AAGD,SAAO,QAAQ,KAAK,CAAC,GAAG,MAAM,EAAE,SAAQ,IAAK,EAAE,SAAQ,CAAE;AAC3D;",
4
+ "sourcesContent": ["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Path} from '@angular-devkit/core';\nimport {Rule, Tree} from '@angular-devkit/schematics';\nimport ts from 'typescript';\n\n/** Tag name of the clusterer component. */\nconst TAG_NAME = 'map-marker-clusterer';\n\n/** Module from which the clusterer is being imported. */\nconst MODULE_NAME = '@angular/google-maps';\n\n/** Old name of the clusterer class. */\nconst CLASS_NAME = 'MapMarkerClusterer';\n\n/** New name of the clusterer class. */\nconst DEPRECATED_CLASS_NAME = 'DeprecatedMapMarkerClusterer';\n\n/** Entry point for the migration schematics with target of Angular Material v19 */\nexport function updateToV19(): Rule {\n return tree => {\n tree.visit(path => {\n if (path.includes('node_modules')) {\n return;\n }\n\n if (path.endsWith('.html')) {\n const content = tree.read(path)?.toString();\n\n if (content && content.includes('<' + TAG_NAME)) {\n tree.overwrite(path, migrateHtml(content));\n }\n } else if (path.endsWith('.ts') && !path.endsWith('.d.ts')) {\n migrateTypeScript(path, tree);\n }\n });\n };\n}\n\n/** Migrates an HTML template from the old tag name to the new one. */\nfunction migrateHtml(content: string): string {\n return content\n .replace(/<map-marker-clusterer/g, '<deprecated-map-marker-clusterer')\n .replace(/<\\/map-marker-clusterer/g, '</deprecated-map-marker-clusterer');\n}\n\n/** Migrates a TypeScript file from the old tag and class names to the new ones. */\nfunction migrateTypeScript(path: Path, tree: Tree) {\n const content = tree.read(path)?.toString();\n\n // Exit early if none of the symbols we're looking for are mentioned.\n if (\n !content ||\n (!content.includes('<' + TAG_NAME) &&\n !content.includes(MODULE_NAME) &&\n !content.includes(CLASS_NAME))\n ) {\n return;\n }\n\n const sourceFile = ts.createSourceFile(path, content, ts.ScriptTarget.Latest, true);\n const toMigrate = findTypeScriptNodesToMigrate(sourceFile);\n\n if (toMigrate.length === 0) {\n return;\n }\n\n const printer = ts.createPrinter();\n const update = tree.beginUpdate(path);\n\n for (const node of toMigrate) {\n let replacement: ts.Node;\n\n if (ts.isStringLiteralLike(node)) {\n // Strings should be migrated as if they're HTML.\n if (ts.isStringLiteral(node)) {\n replacement = ts.factory.createStringLiteral(\n migrateHtml(node.text),\n node.getText()[0] === `'`,\n );\n } else {\n replacement = ts.factory.createNoSubstitutionTemplateLiteral(migrateHtml(node.text));\n }\n } else {\n // Imports/exports should preserve the old name, but import the clusterer using the new one.\n const propertyName = ts.factory.createIdentifier(DEPRECATED_CLASS_NAME);\n const name = node.name as ts.Identifier;\n\n replacement = ts.isImportSpecifier(node)\n ? ts.factory.updateImportSpecifier(node, node.isTypeOnly, propertyName, name)\n : ts.factory.updateExportSpecifier(node, node.isTypeOnly, propertyName, name);\n }\n\n update\n .remove(node.getStart(), node.getWidth())\n .insertLeft(\n node.getStart(),\n printer.printNode(ts.EmitHint.Unspecified, replacement, sourceFile),\n );\n }\n\n tree.commitUpdate(update);\n}\n\n/** Finds the TypeScript nodes that need to be migrated from a specific file. */\nfunction findTypeScriptNodesToMigrate(sourceFile: ts.SourceFile) {\n const results: (ts.StringLiteralLike | ts.ImportSpecifier | ts.ExportSpecifier)[] = [];\n\n sourceFile.forEachChild(function walk(node) {\n // Most likely a template using the clusterer.\n if (ts.isStringLiteral(node) && node.text.includes('<' + TAG_NAME)) {\n results.push(node);\n } else if (\n // Import/export referencing the clusterer.\n (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) &&\n node.moduleSpecifier &&\n ts.isStringLiteralLike(node.moduleSpecifier) &&\n node.moduleSpecifier.text === MODULE_NAME\n ) {\n const bindings = ts.isImportDeclaration(node)\n ? node.importClause?.namedBindings\n : node.exportClause;\n\n if (bindings && (ts.isNamedImports(bindings) || ts.isNamedExports(bindings))) {\n bindings.elements.forEach(element => {\n const symbolName = element.propertyName || element.name;\n\n if (ts.isIdentifier(symbolName) && symbolName.text === CLASS_NAME) {\n results.push(element);\n }\n });\n }\n } else {\n node.forEachChild(walk);\n }\n });\n\n // Sort the results in reverse order to make applying the updates easier.\n return results.sort((a, b) => b.getStart() - a.getStart());\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAUA,wBAAe;AAGf,IAAM,WAAW;AAGjB,IAAM,cAAc;AAGpB,IAAM,aAAa;AAGnB,IAAM,wBAAwB;AAGxB,SAAU,cAAW;AACzB,SAAO,UAAO;AACZ,SAAK,MAAM,UAAO;AA3BtB;AA4BM,UAAI,KAAK,SAAS,cAAc,GAAG;AACjC;MACF;AAEA,UAAI,KAAK,SAAS,OAAO,GAAG;AAC1B,cAAM,WAAU,UAAK,KAAK,IAAI,MAAd,mBAAiB;AAEjC,YAAI,WAAW,QAAQ,SAAS,MAAM,QAAQ,GAAG;AAC/C,eAAK,UAAU,MAAM,YAAY,OAAO,CAAC;QAC3C;MACF,WAAW,KAAK,SAAS,KAAK,KAAK,CAAC,KAAK,SAAS,OAAO,GAAG;AAC1D,0BAAkB,MAAM,IAAI;MAC9B;IACF,CAAC;EACH;AACF;AAGA,SAAS,YAAY,SAAe;AAClC,SAAO,QACJ,QAAQ,0BAA0B,kCAAkC,EACpE,QAAQ,4BAA4B,mCAAmC;AAC5E;AAGA,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