@arcgis/codemod 5.2.0-next.117 → 5.2.0-next.119
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/README.md +32 -8
- package/dist/{actions-CQZGPkk1.js → actions-pyK_bLYZ.js} +88 -95
- package/dist/cli-C-HhqWfY.js +326 -0
- package/dist/cli.js +3 -2
- package/dist/{codemod-CtDiL__8.js → codemod-BaP5d7QD.js} +1 -1
- package/dist/{codemod-v6MLU8Qq.js → codemod-BhxEZX2B.js} +10 -9
- package/dist/{codemod--z_92lWI.js → codemod-CVM-ahrt.js} +3 -3
- package/dist/{codemod-BALsil-0.js → codemod-DlxIx0fk.js} +3 -3
- package/dist/{codemod-MHr8xn-r.js → codemod-DsvACPpG.js} +2 -2
- package/dist/{codemod-DKND2-mc.js → codemod-DzUJHZc4.js} +19 -18
- package/dist/{codemod-ZwlO-Y4a.js → codemod-lXphX6G6.js} +2 -2
- package/dist/codeowners-CarwYwHK.js +118 -0
- package/dist/config-BP6HDIQa.js +19 -0
- package/dist/index-BYkl918U.js +142 -0
- package/dist/index-G3qil5yu.js +313 -0
- package/dist/log-B76HBvov.js +11 -0
- package/dist/sync-e0pgnEOM.js +240 -0
- package/dist/{useProjectInstance-Cs8LP18f.js → useProjectInstance-BqEY3afe.js} +19 -18
- package/package.json +5 -4
- package/dist/cli-BLMaWpqf.js +0 -269
package/README.md
CHANGED
|
@@ -12,11 +12,11 @@ and updating geometry operator usage.
|
|
|
12
12
|
|
|
13
13
|
- Node.js 24
|
|
14
14
|
- A project using the ArcGIS Maps SDK for JavaScript
|
|
15
|
-
- This codemod operates exclusively on TypeScript files.
|
|
15
|
+
- This codemod operates exclusively on TypeScript files. You do not need to run this tool if the project does not use TypeScript.
|
|
16
16
|
|
|
17
17
|
## Before you begin
|
|
18
18
|
|
|
19
|
-
Ensure your project's dependencies are up to date, for example
|
|
19
|
+
Ensure your project's dependencies are up to date, for example by running `pnpm install`.
|
|
20
20
|
|
|
21
21
|
If your project uses **ESLint, Prettier, or other formatters/linters**, run them after the codemod to ensure consistent formatting.
|
|
22
22
|
|
|
@@ -74,7 +74,7 @@ The codemod will emit warnings for cases it cannot safely rewrite, including:
|
|
|
74
74
|
- Complex computed or dynamic type usage
|
|
75
75
|
- Unresolvable symbols
|
|
76
76
|
|
|
77
|
-
These will be reported in the console
|
|
77
|
+
These will be reported in the console. Manually review all changes before committing.
|
|
78
78
|
|
|
79
79
|
### Normalize Calcite icon names
|
|
80
80
|
|
|
@@ -104,9 +104,9 @@ npx @arcgis/codemod run normalize-calcite-icon-names [<target-directory>]
|
|
|
104
104
|
|
|
105
105
|
### Rename Geometry Operators
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
In version 5.2, geometry operator exports and option types were renamed to improve consistency and discoverability.
|
|
108
108
|
The `geometry-operator-renames` codemod updates geometry operator calls to use the new names.
|
|
109
|
-
It additionally inlines namespace imports, which are
|
|
109
|
+
It additionally inlines namespace imports, which are no longer necessary.
|
|
110
110
|
|
|
111
111
|
Run it in the root of your project or with an explicit target directory:
|
|
112
112
|
|
|
@@ -116,7 +116,7 @@ npx @arcgis/codemod run geometry-operator-renames [<target-directory>]
|
|
|
116
116
|
|
|
117
117
|
**Before:**
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
```ts
|
|
120
120
|
import * as bufferOperator from "@arcgis/core/geometry/operators/bufferOperator";
|
|
121
121
|
const options: bufferOperator.Options = { unit: "meters" };
|
|
122
122
|
const buffered = bufferOperator.execute(polyline, 250, options);
|
|
@@ -128,10 +128,34 @@ const buffered = bufferOperator.execute(polyline, 250, options);
|
|
|
128
128
|
import { bufferExecute, type BufferExecuteOptions } from "@arcgis/core/geometry/operators/bufferOperator";
|
|
129
129
|
const options: BufferExecuteOptions = { unit: "meters" };
|
|
130
130
|
const buffered = bufferExecute(polyline, 250, options);
|
|
131
|
-
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Versioning
|
|
134
|
+
|
|
135
|
+
The codemods are available until the corresponding deprecated feature is removed.
|
|
136
|
+
If migrating from a much older release, the codemod might no longer be available in the most recent version of the `@arcgis/codemod` package.
|
|
137
|
+
In such cases, run the codemod from an older version, matching the version in the release notes:
|
|
138
|
+
|
|
139
|
+
```sh
|
|
140
|
+
npx @arcgis/codemod@5.2 run refactor-out-esri-namespace
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Troubleshooting
|
|
144
|
+
|
|
145
|
+
Some codemods rely on type information to perform more accurate migrations.
|
|
146
|
+
On large codebases, this may require more RAM than the default Node.js limit.
|
|
147
|
+
If you encounter an out-of-memory error (like `Allocation failed - JavaScript heap out of memory`), re-run the codemod with a higher RAM limit:
|
|
148
|
+
|
|
149
|
+
Example on Linux/macOS:
|
|
150
|
+
|
|
151
|
+
```sh
|
|
152
|
+
NODE_OPTIONS="--max-old-space-size=10240" npx @arcgis/codemod run normalize-calcite-icon-names
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
[Windows command line](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/set_1) and [PowerShell](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-7.6) use a different environment variable syntax.
|
|
132
156
|
|
|
133
157
|
## License
|
|
134
158
|
|
|
135
159
|
This package is licensed under the terms described in the `LICENSE.md` file,
|
|
136
160
|
located in the root of the package, and at https://js.arcgis.com/5.2/LICENSE.txt.
|
|
137
|
-
For third
|
|
161
|
+
For third-party notices, see https://js.arcgis.com/5.2/third-party-notices.txt.
|
|
@@ -1,36 +1,31 @@
|
|
|
1
|
-
import { path as
|
|
1
|
+
import { path as x } from "@arcgis/node-toolkit/path";
|
|
2
2
|
import { SyntaxKind as I } from "ts-morph";
|
|
3
|
-
import { g as D } from "./cli-
|
|
4
|
-
import { ModuleResolutionKind as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function A(t) {
|
|
12
|
-
return q(t.getFilePath());
|
|
13
|
-
}
|
|
14
|
-
function q(t) {
|
|
15
|
-
return O.relative(process.cwd(), t);
|
|
3
|
+
import { g as D } from "./cli-C-HhqWfY.js";
|
|
4
|
+
import { ModuleResolutionKind as K } from "typescript";
|
|
5
|
+
import { a as w } from "./log-B76HBvov.js";
|
|
6
|
+
import { capitalize as A } from "@arcgis/toolkit/string";
|
|
7
|
+
import { log as P } from "@arcgis/toolkit/log";
|
|
8
|
+
function j(t) {
|
|
9
|
+
const e = t.typeScriptConfig?.compilerOptions?.moduleResolution ?? K.Bundler;
|
|
10
|
+
return e >= K.Node16 && e <= K.NodeNext;
|
|
16
11
|
}
|
|
17
12
|
function V(t, e) {
|
|
18
13
|
const s = {};
|
|
19
|
-
|
|
20
|
-
const { specifiers: i, names: m, lastImportIndex: r } =
|
|
21
|
-
let p =
|
|
22
|
-
for (const [o,
|
|
14
|
+
q(t);
|
|
15
|
+
const { specifiers: i, names: m, lastImportIndex: r } = b(t), l = [], n = {}, c = [];
|
|
16
|
+
let p = j(D.project.projectData);
|
|
17
|
+
for (const [o, f] of Object.entries(e)) {
|
|
23
18
|
let a = i.get(o) ?? (o.startsWith(".") ? i.get(
|
|
24
|
-
|
|
19
|
+
x.relative(t.getDirectoryPath(), x.resolve(D.project.projectData.cwd, o))
|
|
25
20
|
) : void 0);
|
|
26
21
|
if (a === void 0) {
|
|
27
22
|
const y = i.get(`${o}.js`);
|
|
28
23
|
y !== void 0 && (p = !0, a === void 0 ? a = y : a = [...a, ...y]);
|
|
29
24
|
}
|
|
30
|
-
for (const [y, g] of Object.entries(
|
|
25
|
+
for (const [y, g] of Object.entries(f)) {
|
|
31
26
|
const v = Array.isArray(g) ? g : [g];
|
|
32
27
|
for (const N of v)
|
|
33
|
-
N.do === "deprecate" ? R(y, o, s, a) : N.do === "add" ?
|
|
28
|
+
N.do === "deprecate" ? R(y, o, s, a) : N.do === "add" ? C(o, y, N, a, l, n, m) : N.do === "rename" ? E(o, y, N, a, l, n, m) : N.do === "remove-namespace-import" && W(
|
|
34
29
|
o,
|
|
35
30
|
a,
|
|
36
31
|
l,
|
|
@@ -40,12 +35,12 @@ function V(t, e) {
|
|
|
40
35
|
);
|
|
41
36
|
}
|
|
42
37
|
}
|
|
43
|
-
const
|
|
38
|
+
const d = Object.entries(n);
|
|
44
39
|
let u = r;
|
|
45
|
-
for (let o = 0; o <
|
|
46
|
-
const [
|
|
47
|
-
|
|
48
|
-
) :
|
|
40
|
+
for (let o = 0; o < d.length; o += 1) {
|
|
41
|
+
const [f, a] = d[o], y = f.startsWith(".") ? M(
|
|
42
|
+
x.relative(t.getDirectoryPath(), x.resolve(D.project.projectData.cwd, f))
|
|
43
|
+
) : f, g = p && y.startsWith("@arcgis/core") ? `${y}.js` : y, v = a.afterDeclaration === void 0 ? u : a.afterDeclaration.getChildIndex() + 1;
|
|
49
44
|
if (a.named.length > 0) {
|
|
50
45
|
let N = !0;
|
|
51
46
|
for (let h = 0; h < a.named.length; h += 1)
|
|
@@ -71,18 +66,18 @@ function V(t, e) {
|
|
|
71
66
|
}), u += 1);
|
|
72
67
|
}
|
|
73
68
|
if (Object.keys(s).length > 0) {
|
|
74
|
-
const o = Object.entries(s).map(([
|
|
75
|
-
|
|
69
|
+
const o = Object.entries(s).map(([f, a]) => `${a.join(", ")} from ${f}`).join("; ");
|
|
70
|
+
P("warn", w(t), `Deprecated API usages found: ${o}`);
|
|
76
71
|
}
|
|
77
72
|
for (const o of c)
|
|
78
73
|
o.remove();
|
|
79
74
|
return l;
|
|
80
75
|
}
|
|
81
|
-
function
|
|
76
|
+
function q(t) {
|
|
82
77
|
const e = t.getChildSyntaxList()?.getFirstChild();
|
|
83
|
-
if (
|
|
78
|
+
if (S === e)
|
|
84
79
|
return;
|
|
85
|
-
|
|
80
|
+
S = e, O.clear();
|
|
86
81
|
const s = /* @__PURE__ */ new Set();
|
|
87
82
|
i(t);
|
|
88
83
|
function i(m) {
|
|
@@ -99,11 +94,11 @@ function b(t) {
|
|
|
99
94
|
if (n.isKind(I.QualifiedName) && n.getLeft() !== l || n.isKind(I.PropertyAccessExpression) && n.getExpression() !== l || (n.isKind(I.PropertyDeclaration) || n.isKind(I.PropertySignature) || n.isKind(I.PropertyAssignment)) && n.getNameNode() === l)
|
|
100
95
|
return;
|
|
101
96
|
const c = l.getText();
|
|
102
|
-
s.has(c) ||
|
|
97
|
+
s.has(c) || O.add(l.getText());
|
|
103
98
|
});
|
|
104
99
|
}
|
|
105
100
|
}
|
|
106
|
-
function
|
|
101
|
+
function b(t) {
|
|
107
102
|
const e = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), i = t.getStatements();
|
|
108
103
|
let m;
|
|
109
104
|
for (let l = 0; l < i.length; l += 1) {
|
|
@@ -116,21 +111,21 @@ function C(t) {
|
|
|
116
111
|
m = n;
|
|
117
112
|
const c = n.getModuleSpecifierValue(), p = e.get(c);
|
|
118
113
|
p === void 0 ? e.set(c, [n]) : p.push(n);
|
|
119
|
-
const
|
|
120
|
-
if (
|
|
114
|
+
const d = n.getImportClause();
|
|
115
|
+
if (d === void 0)
|
|
121
116
|
continue;
|
|
122
|
-
const u =
|
|
117
|
+
const u = d.getDefaultImport()?.getText();
|
|
123
118
|
u !== void 0 && s.add(u);
|
|
124
|
-
const o =
|
|
119
|
+
const o = d.getNamedBindings();
|
|
125
120
|
if (o !== void 0)
|
|
126
121
|
if (o.isKind(I.NamedImports))
|
|
127
|
-
for (const
|
|
128
|
-
const a =
|
|
122
|
+
for (const f of o.getElements()) {
|
|
123
|
+
const a = f.getName();
|
|
129
124
|
s.add(a);
|
|
130
125
|
}
|
|
131
126
|
else {
|
|
132
|
-
const
|
|
133
|
-
s.add(
|
|
127
|
+
const f = o.getName();
|
|
128
|
+
s.add(f);
|
|
134
129
|
}
|
|
135
130
|
}
|
|
136
131
|
const r = m === void 0 ? 0 : m.getChildIndex() + 1;
|
|
@@ -163,17 +158,17 @@ function R(t, e, s, i) {
|
|
|
163
158
|
}
|
|
164
159
|
}
|
|
165
160
|
}
|
|
166
|
-
function
|
|
161
|
+
function C(t, e, s, i, m, r, l) {
|
|
167
162
|
const n = e === "default";
|
|
168
163
|
if (n || e === "*") {
|
|
169
164
|
if (i !== void 0)
|
|
170
165
|
for (const p of i) {
|
|
171
|
-
const
|
|
172
|
-
if (
|
|
166
|
+
const d = n ? p.getDefaultImport() : p.getNamespaceImport();
|
|
167
|
+
if (d !== void 0) {
|
|
173
168
|
s.isTypeOnly !== !0 && p.isTypeOnly() && p.setIsTypeOnly(!1), m.push({
|
|
174
169
|
specifier: t,
|
|
175
170
|
requestedName: e,
|
|
176
|
-
actualName:
|
|
171
|
+
actualName: d.getText()
|
|
177
172
|
});
|
|
178
173
|
return;
|
|
179
174
|
}
|
|
@@ -192,18 +187,18 @@ function E(t, e, s, i, m, r, l) {
|
|
|
192
187
|
let c, p;
|
|
193
188
|
if (i !== void 0) {
|
|
194
189
|
let o = !1;
|
|
195
|
-
for (const
|
|
196
|
-
if (
|
|
197
|
-
p ??=
|
|
198
|
-
for (const a of
|
|
190
|
+
for (const f of i)
|
|
191
|
+
if (f.getNamespaceImport() === void 0) {
|
|
192
|
+
p ??= f, c ??= f.isTypeOnly() && f.getDefaultImport() === void 0 ? f : void 0;
|
|
193
|
+
for (const a of f.getNamedImports())
|
|
199
194
|
if (a.getNameNode().getText() === e) {
|
|
200
195
|
if (o = !0, s.isTypeOnly !== !0) {
|
|
201
196
|
if (a.isTypeOnly())
|
|
202
197
|
a.setIsTypeOnly(!1);
|
|
203
|
-
else if (
|
|
204
|
-
for (const y of
|
|
198
|
+
else if (f.isTypeOnly()) {
|
|
199
|
+
for (const y of f.getNamedImports())
|
|
205
200
|
y !== a && y.setIsTypeOnly(!0);
|
|
206
|
-
|
|
201
|
+
f.setIsTypeOnly(!1);
|
|
207
202
|
}
|
|
208
203
|
}
|
|
209
204
|
m.push({
|
|
@@ -217,12 +212,12 @@ function E(t, e, s, i, m, r, l) {
|
|
|
217
212
|
if (o)
|
|
218
213
|
return;
|
|
219
214
|
}
|
|
220
|
-
const
|
|
215
|
+
const d = T(
|
|
221
216
|
s.preferAlias === !0 ? s.preferredAlias : e,
|
|
222
217
|
s.preferAlias === !0 ? e : s.preferredAlias,
|
|
223
218
|
t,
|
|
224
219
|
l
|
|
225
|
-
), u = e ===
|
|
220
|
+
), u = e === d ? void 0 : d;
|
|
226
221
|
if (s.isTypeOnly && c !== void 0)
|
|
227
222
|
c.addNamedImport({
|
|
228
223
|
name: e,
|
|
@@ -250,37 +245,37 @@ function E(t, e, s, i, m, r, l) {
|
|
|
250
245
|
alias: u,
|
|
251
246
|
isTypeOnly: s.isTypeOnly === !0
|
|
252
247
|
});
|
|
253
|
-
m.push({ specifier: t, requestedName: e, actualName:
|
|
248
|
+
m.push({ specifier: t, requestedName: e, actualName: d });
|
|
254
249
|
}
|
|
255
250
|
}
|
|
256
|
-
function
|
|
251
|
+
function E(t, e, s, i, m, r, l) {
|
|
257
252
|
if (i === void 0)
|
|
258
253
|
return;
|
|
259
254
|
const n = s.name ?? e, c = s.specifier ?? t, p = e === "default";
|
|
260
255
|
if (p || e === "*") {
|
|
261
|
-
for (const
|
|
262
|
-
const u = p ?
|
|
256
|
+
for (const d of i) {
|
|
257
|
+
const u = p ? d.getDefaultImport() : d.getNamespaceImport();
|
|
263
258
|
if (u === void 0)
|
|
264
259
|
continue;
|
|
265
|
-
if (s.isTypeOnly === !1 &&
|
|
266
|
-
|
|
267
|
-
for (const
|
|
268
|
-
|
|
260
|
+
if (s.isTypeOnly === !1 && d.isTypeOnly()) {
|
|
261
|
+
d.setIsTypeOnly(!1);
|
|
262
|
+
for (const f of d.getNamedImports())
|
|
263
|
+
f.setIsTypeOnly(!0);
|
|
269
264
|
}
|
|
270
265
|
let o = n;
|
|
271
266
|
if (n !== e) {
|
|
272
|
-
const
|
|
273
|
-
n ===
|
|
267
|
+
const f = T(n, e, t, l);
|
|
268
|
+
n === f ? u.rename(n) : o = u.getText();
|
|
274
269
|
} else
|
|
275
270
|
o = u.getText();
|
|
276
|
-
t !== c && (
|
|
271
|
+
t !== c && (d.getNamedImports().length === 0 ? d.setModuleSpecifier(c) : (p ? d.removeDefaultImport() : d.removeNamespaceImport(), r[c] ??= {
|
|
277
272
|
afterDeclaration: void 0,
|
|
278
273
|
named: [],
|
|
279
274
|
default: void 0,
|
|
280
275
|
"*": void 0
|
|
281
|
-
}, r[c].afterDeclaration ??=
|
|
276
|
+
}, r[c].afterDeclaration ??= d, r[c][e] = {
|
|
282
277
|
name: o,
|
|
283
|
-
isTypeOnly:
|
|
278
|
+
isTypeOnly: d.isTypeOnly()
|
|
284
279
|
})), m.push({
|
|
285
280
|
specifier: c,
|
|
286
281
|
requestedName: e,
|
|
@@ -290,46 +285,46 @@ function W(t, e, s, i, m, r, l) {
|
|
|
290
285
|
}
|
|
291
286
|
return;
|
|
292
287
|
}
|
|
293
|
-
for (const
|
|
294
|
-
for (const o of
|
|
288
|
+
for (const d of i) {
|
|
289
|
+
for (const o of d.getNamedImports()) {
|
|
295
290
|
if (o.getNameNode().getText() !== e)
|
|
296
291
|
continue;
|
|
297
292
|
if (s.isTypeOnly === !1) {
|
|
298
293
|
if (o.isTypeOnly())
|
|
299
294
|
o.setIsTypeOnly(!1);
|
|
300
|
-
else if (
|
|
301
|
-
|
|
302
|
-
for (const y of
|
|
295
|
+
else if (d.isTypeOnly()) {
|
|
296
|
+
d.setIsTypeOnly(!1);
|
|
297
|
+
for (const y of d.getNamedImports())
|
|
303
298
|
y !== o && y.setIsTypeOnly(!0);
|
|
304
299
|
}
|
|
305
300
|
}
|
|
306
|
-
let
|
|
301
|
+
let f = n;
|
|
307
302
|
const a = o.getAliasNode();
|
|
308
303
|
if (n !== e)
|
|
309
304
|
if (a === void 0) {
|
|
310
305
|
const y = T(n, e, t, l);
|
|
311
|
-
n === y ? o.getNameNode().asKind(I.Identifier)?.rename(n) : (o.setAlias(e), o.getNameNode().replaceWithText(n),
|
|
306
|
+
n === y ? o.getNameNode().asKind(I.Identifier)?.rename(n) : (o.setAlias(e), o.getNameNode().replaceWithText(n), f = e);
|
|
312
307
|
} else
|
|
313
|
-
o.getNameNode().replaceWithText(n),
|
|
308
|
+
o.getNameNode().replaceWithText(n), f = a.getText();
|
|
314
309
|
if (c !== t) {
|
|
315
|
-
const g = (
|
|
316
|
-
|
|
310
|
+
const g = (j(D.project.projectData) || d.getModuleSpecifierValue().endsWith(".js")) && c.startsWith("@arcgis/core") ? `${c}.js` : c;
|
|
311
|
+
d.getNamedImports().length === 1 && d.getDefaultImport() === void 0 ? d.setModuleSpecifier(g) : (r[g] ??= { named: [] }, r[g].afterDeclaration ??= i?.[0], r[g].named.push({
|
|
317
312
|
name: n,
|
|
318
|
-
alias: n ===
|
|
313
|
+
alias: n === f ? void 0 : f,
|
|
319
314
|
isTypeOnly: o.isTypeOnly()
|
|
320
315
|
}), o.remove());
|
|
321
316
|
}
|
|
322
317
|
m.push({
|
|
323
318
|
specifier: c,
|
|
324
319
|
requestedName: n,
|
|
325
|
-
actualName: a?.getText() ??
|
|
320
|
+
actualName: a?.getText() ?? f
|
|
326
321
|
});
|
|
327
322
|
return;
|
|
328
323
|
}
|
|
329
|
-
const u =
|
|
324
|
+
const u = d.getNamespaceImport();
|
|
330
325
|
if (u)
|
|
331
326
|
for (const o of u.findReferencesAsNodes().slice(1)) {
|
|
332
|
-
const
|
|
327
|
+
const f = o.getParentIfKind(I.PropertyAccessExpression), a = o.getParentIfKind(I.QualifiedName)?.getParentIfKind(I.TypeReference), y = f ?? a;
|
|
333
328
|
if (!y)
|
|
334
329
|
continue;
|
|
335
330
|
const g = y.getText();
|
|
@@ -337,7 +332,7 @@ function W(t, e, s, i, m, r, l) {
|
|
|
337
332
|
}
|
|
338
333
|
}
|
|
339
334
|
}
|
|
340
|
-
function
|
|
335
|
+
function W(t, e, s, i, m, r) {
|
|
341
336
|
if (e = e?.filter((u) => u.getNamespaceImport() != null), e === void 0 || e.length === 0)
|
|
342
337
|
return;
|
|
343
338
|
if (e.length !== 1)
|
|
@@ -346,21 +341,21 @@ function $(t, e, s, i, m, r) {
|
|
|
346
341
|
);
|
|
347
342
|
const [l] = e, n = l.getNamespaceImport(), c = {}, p = /* @__PURE__ */ new Set();
|
|
348
343
|
for (const u of n.findReferencesAsNodes()) {
|
|
349
|
-
const o = u.getParentIfKind(I.PropertyAccessExpression),
|
|
344
|
+
const o = u.getParentIfKind(I.PropertyAccessExpression), f = u.getParentIfKind(I.QualifiedName)?.getParentIfKind(I.TypeReference), a = o ?? f;
|
|
350
345
|
if (!a)
|
|
351
346
|
continue;
|
|
352
347
|
const y = a.getText().split(".").pop().trim();
|
|
353
348
|
c[y] ??= T(y, void 0, t, r);
|
|
354
349
|
const g = c[y];
|
|
355
|
-
a.replaceWithText(g),
|
|
350
|
+
a.replaceWithText(g), f || p.add(g);
|
|
356
351
|
}
|
|
357
352
|
i[t] ??= {
|
|
358
353
|
afterDeclaration: l,
|
|
359
354
|
named: []
|
|
360
355
|
};
|
|
361
|
-
const { named:
|
|
356
|
+
const { named: d } = i[t];
|
|
362
357
|
for (const [u, o] of Object.entries(c))
|
|
363
|
-
|
|
358
|
+
d.push({
|
|
364
359
|
name: u,
|
|
365
360
|
alias: o === u ? void 0 : o,
|
|
366
361
|
isTypeOnly: !p.has(o)
|
|
@@ -373,7 +368,7 @@ function $(t, e, s, i, m, r) {
|
|
|
373
368
|
}
|
|
374
369
|
function T(t, e, s, i) {
|
|
375
370
|
if (t !== void 0) {
|
|
376
|
-
if (!i.has(t) && !
|
|
371
|
+
if (!i.has(t) && !O.has(t))
|
|
377
372
|
return i.add(t), t;
|
|
378
373
|
if (e !== void 0)
|
|
379
374
|
return T(e, void 0, s, i);
|
|
@@ -382,21 +377,19 @@ function T(t, e, s, i) {
|
|
|
382
377
|
const m = s.split("/");
|
|
383
378
|
let r = t ?? "";
|
|
384
379
|
for (let l = m.length - 1; l >= 0; l--) {
|
|
385
|
-
const n = m[l].replaceAll(
|
|
386
|
-
if (n !== r && (r = n +
|
|
380
|
+
const n = m[l].replaceAll($, "");
|
|
381
|
+
if (n !== r && (r = n + A(r), !i.has(r) && !O.has(r)))
|
|
387
382
|
return i.add(r), r;
|
|
388
383
|
}
|
|
389
384
|
for (let l = 2; ; l++) {
|
|
390
385
|
const n = r + l;
|
|
391
|
-
if (!i.has(n) && !
|
|
386
|
+
if (!i.has(n) && !O.has(n))
|
|
392
387
|
return i.add(n), n;
|
|
393
388
|
}
|
|
394
389
|
}
|
|
395
|
-
const
|
|
396
|
-
let
|
|
390
|
+
const $ = /[^a-zA-Z0-9$_]/gu, M = (t) => t.startsWith(".") ? t : `./${t}`, O = /* @__PURE__ */ new Set();
|
|
391
|
+
let S;
|
|
397
392
|
export {
|
|
398
|
-
A as a,
|
|
399
|
-
q as f,
|
|
400
393
|
V as p,
|
|
401
|
-
|
|
394
|
+
q as u
|
|
402
395
|
};
|