@brynlabs/fusion-ui-codemod 1.0.0-alpha.208 → 1.0.0-alpha.210

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 CHANGED
@@ -40,5 +40,6 @@ The paths default to the current directory; `node_modules`, `.next`, `dist`, `bu
40
40
  | Codemod | |
41
41
  | --- | --- |
42
42
  | `data-table-fixed-height` | `DataTableCollection` scrolls with the page by default: adds `fixedHeight` where `useWindowScroll` was missing or `false`, removes `useWindowScroll` where it was set, negates expressions. Reports `useWindowScroll` in objects |
43
+ | `data-table-collection` | Replaces the deprecated `DataTable` by a `Tile` with a `CollectionHeader` (`{...table.header}`, search, filters, `buttons`, `modalText.filterView`) and a `DataTableCollection fixedHeight` (the other props, `modalText.errorMessages` and the columns texts). Reports tables whose props come from other spreads or expressions, `storageId` (visible columns now stored by the hook's `storageId`) and references of `DataTable` / `DataTableProps` outside of JSX |
43
44
 
44
45
  `npx @brynlabs/fusion-ui-codemod list` shows the fusion-ui version of every codemod.
package/lib/codemods.json CHANGED
@@ -3,5 +3,10 @@
3
3
  "name": "data-table-fixed-height",
4
4
  "description": "DataTableCollection: replaces useWindowScroll by fixedHeight, the table scrolls with the page by default",
5
5
  "version": "1.0.0-alpha.208"
6
+ },
7
+ {
8
+ "name": "data-table-collection",
9
+ "description": "DataTable: replaces the deprecated DataTable by a Tile with a CollectionHeader and a DataTableCollection",
10
+ "version": "1.0.0-alpha.210"
6
11
  }
7
12
  ]
package/lib/git.cjs CHANGED
@@ -1,3 +1,4 @@
1
+ const fs = require("node:fs");
1
2
  const path = require("node:path");
2
3
  const {execFileSync} = require("node:child_process");
3
4
 
@@ -30,4 +31,26 @@ const changedFiles = repositoryRoot =>
30
31
  // "XY path" or "XY old -> new"
31
32
  .map(line => line.slice(3).split(" -> ").pop().replace(/^"|"$/g, ""));
32
33
 
33
- module.exports = {root, showHead, changedFiles};
34
+ /**
35
+ * The files below `paths` that git doesn't ignore (committed or not), relative to `cwd`; `null`
36
+ * outside of a repository. Git applies the ignore files itself (nested ones, negations like
37
+ * `!.yarn/patches`, `.git/info/exclude`, the global excludes file)
38
+ */
39
+ const listFiles = (cwd, paths) => {
40
+ if (root(cwd) === null) return null;
41
+ const output = run(cwd, [
42
+ "ls-files",
43
+ "-z",
44
+ "--cached",
45
+ "--others",
46
+ "--exclude-standard",
47
+ "--",
48
+ ...paths,
49
+ ]);
50
+ // Unmerged files are listed once per stage, deleted ones are still in the index
51
+ return [...new Set(output.split("\0").filter(Boolean))].filter(file =>
52
+ fs.existsSync(path.join(cwd, file)),
53
+ );
54
+ };
55
+
56
+ module.exports = {root, showHead, changedFiles, listFiles};
package/lib/run.cjs CHANGED
@@ -1,6 +1,7 @@
1
1
  const path = require("node:path");
2
2
  // Not part of the public API of jscodeshift, but the way to run it in-process (as @next/codemod does)
3
3
  const Runner = require("jscodeshift/src/Runner");
4
+ const git = require("./git.cjs");
4
5
 
5
6
  const TRANSFORMS = path.join(__dirname, "..", "transforms");
6
7
 
@@ -10,12 +11,12 @@ const TRANSFORMS = path.join(__dirname, "..", "transforms");
10
11
  * @returns {Promise<{ok: number, nochange: number, skip: number, error: number}>}
11
12
  */
12
13
  const runCodemod = (name, paths, {dry = false, print = false, verbose = false} = {}) =>
13
- Runner.run(path.join(TRANSFORMS, `${name}.cjs`), paths, {
14
+ // Git selects the files: the gitignore option of jscodeshift reads only the .gitignore of the
15
+ // current directory (and fails without one) and ignores everything after a negated pattern
16
+ Runner.run(path.join(TRANSFORMS, `${name}.cjs`), git.listFiles(process.cwd(), paths) ?? paths, {
14
17
  parser: "tsx",
15
18
  extensions: "tsx,ts,jsx,js,mjs,cjs",
16
19
  ignorePattern: ["**/node_modules/**", "**/.next/**", "**/dist/**", "**/build/**", "**/out/**"],
17
- // Respect .gitignore like the project's own tools
18
- gitignore: true,
19
20
  // The transforms are plain CommonJS
20
21
  babel: false,
21
22
  dry,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brynlabs/fusion-ui-codemod",
3
- "version": "1.0.0-alpha.208",
3
+ "version": "1.0.0-alpha.210",
4
4
  "description": "Codemods for upgrading projects that use @brynlabs/fusion-ui",
5
5
  "author": "The brynlabs.com team",
6
6
  "repository": {
@@ -0,0 +1,455 @@
1
+ /**
2
+ * Replaces the deprecated `DataTable` by a `Tile` with a `CollectionHeader` and a
3
+ * `DataTableCollection`, like the migration in the docs of `DataTable`:
4
+ *
5
+ * - `{...table}` of `useSimpleTable` / `useServerTable` → `{...table.header}` on the header and
6
+ * `{...table}` on the table
7
+ * - `search`, `searchQuery`, `filters`, `showFilterOptions`, `onFilterChipRemove` and `buttons`
8
+ * → the header (`search` and `searchQuery` become `search={{value, onChange}}`)
9
+ * - `modalText.filterView` → `text` of the header; `modalText.errorMessages` and the columns
10
+ * texts of `modalText.editView` → `text` of the table
11
+ * - the table gets `fixedHeight`: it scrolls in its own area inside the tile like before
12
+ * - `useWindowScroll` is removed, `DataTable` always scrolled in its own area
13
+ *
14
+ * The codemod leaves a `DataTable` unchanged and reports it when it can't see where its props come
15
+ * from: spreads of anything but a result of `useSimpleTable` / `useServerTable` in the same file
16
+ * (e.g. the props of a wrapper component), `modalText` built by an expression, or `search` and
17
+ * `searchQuery` split between a spread and a prop. It reports `storageId` (`DataTable` stored the
18
+ * visible columns, now `storageId` of the hook keeps them) and references of `DataTable` and
19
+ * `DataTableProps` outside of JSX. Only components imported from `@brynlabs/fusion-ui` are changed.
20
+ *
21
+ * npx @brynlabs/fusion-ui-codemod data-table-collection src
22
+ */
23
+
24
+ const PACKAGE = "@brynlabs/fusion-ui";
25
+ const OLD_COMPONENT = "DataTable";
26
+ const OLD_PROPS_TYPE = "DataTableProps";
27
+ const TABLE_HOOKS = ["useSimpleTable", "useServerTable"];
28
+
29
+ /** Props of `DataTable` that belong to the `CollectionHeader`, as they are */
30
+ const HEADER_PROPS = new Set(["filters", "showFilterOptions", "onFilterChipRemove", "buttons"]);
31
+ /** Props of `DataTable` that `DataTableCollection` doesn't take */
32
+ const REMOVED_PROPS = new Set(["useWindowScroll"]);
33
+
34
+ const isFromPackage = source =>
35
+ typeof source === "string" && (source === PACKAGE || source.startsWith(`${PACKAGE}/`));
36
+
37
+ const location = (file, node) => `${file.path}:${node.loc?.start.line ?? "?"}`;
38
+
39
+ /** Named imports from the package (imported name → local names) and namespace imports */
40
+ const findImports = (j, root) => {
41
+ const named = new Map();
42
+ const namespaces = new Set();
43
+ const declarations = [];
44
+
45
+ root.find(j.ImportDeclaration).forEach(path => {
46
+ if (!isFromPackage(path.node.source.value)) return;
47
+ declarations.push(path);
48
+
49
+ for (const specifier of path.node.specifiers ?? []) {
50
+ if (specifier.type === "ImportNamespaceSpecifier") {
51
+ namespaces.add(specifier.local.name);
52
+ } else if (specifier.type === "ImportSpecifier") {
53
+ const imported = specifier.imported.name;
54
+ if (!named.has(imported)) named.set(imported, new Set());
55
+ named.get(imported).add(specifier.local.name);
56
+ }
57
+ }
58
+ });
59
+
60
+ return {named, namespaces, declarations};
61
+ };
62
+
63
+ /** Whether a JSX element name or callee refers to the export `name` of the package */
64
+ const refersTo = (node, name, {named, namespaces}) => {
65
+ if (node.type === "JSXIdentifier" || node.type === "Identifier") {
66
+ return named.get(name)?.has(node.name) ?? false;
67
+ }
68
+ if (node.type === "JSXMemberExpression" || node.type === "MemberExpression") {
69
+ return (
70
+ ["JSXIdentifier", "Identifier"].includes(node.object.type) &&
71
+ namespaces.has(node.object.name) &&
72
+ !node.computed &&
73
+ node.property.name === name
74
+ );
75
+ }
76
+ return false;
77
+ };
78
+
79
+ /** Variables holding the result of a table hook: `const table = useSimpleTable(…)` */
80
+ const findTableStates = (j, root, imports) => {
81
+ const names = new Set();
82
+ root.find(j.VariableDeclarator).forEach(path => {
83
+ const {id, init} = path.node;
84
+ if (
85
+ id.type === "Identifier" &&
86
+ init?.type === "CallExpression" &&
87
+ TABLE_HOOKS.some(hook => refersTo(init.callee, hook, imports))
88
+ ) {
89
+ names.add(id.name);
90
+ }
91
+ });
92
+ return names;
93
+ };
94
+
95
+ /** Identifiers and property accesses (`a`, `a.b`, `this.a`), safe to read more than once */
96
+ const isPlainReference = node =>
97
+ node.type === "Identifier" ||
98
+ node.type === "ThisExpression" ||
99
+ (node.type === "MemberExpression" && !node.computed && isPlainReference(node.object));
100
+
101
+ const propertyKey = property =>
102
+ property.key.type === "Identifier"
103
+ ? property.key.name
104
+ : typeof property.key.value === "string"
105
+ ? property.key.value
106
+ : null;
107
+
108
+ const toSource = (j, node) => j(node).toSource({quote: "double"});
109
+
110
+ /**
111
+ * The value of `object.key`: the property of an object literal or a member expression of a
112
+ * reference; `undefined` for a missing key of an object literal, `null` when it can't be read
113
+ * safely
114
+ */
115
+ const pick = (j, object, key) => {
116
+ if (object.type === "ObjectExpression") {
117
+ if (
118
+ object.properties.some(property => !["Property", "ObjectProperty"].includes(property.type))
119
+ ) {
120
+ return null;
121
+ }
122
+ const property = object.properties.find(property => propertyKey(property) === key);
123
+ if (!property) return undefined;
124
+ if (property.computed || property.method) return null;
125
+ return property.value;
126
+ }
127
+ if (isPlainReference(object)) {
128
+ return j.memberExpression(object, j.identifier(key));
129
+ }
130
+ return null;
131
+ };
132
+
133
+ /** Source of an object literal, `key` alone when the value is a variable of the same name */
134
+ const objectOf = entries =>
135
+ `{${entries
136
+ .filter(([, value]) => value !== undefined)
137
+ .map(([key, value]) => (value === key ? key : `${key}: ${value}`))
138
+ .join(", ")}}`;
139
+
140
+ /** An expression parsed from its source, printed as it is written */
141
+ const parseExpression = (j, source) =>
142
+ j(`const value = ${source};`).find(j.VariableDeclarator).get().node.init;
143
+
144
+ /** Sources of the `text` of the header and of the table from `modalText`; null when it can't be split */
145
+ const splitModalText = (j, modalText) => {
146
+ const source = value => (value === undefined || value === null ? value : toSource(j, value));
147
+ const filterView = source(pick(j, modalText, "filterView"));
148
+ const errorMessages = source(pick(j, modalText, "errorMessages"));
149
+ const editView = pick(j, modalText, "editView");
150
+ if (filterView === null || errorMessages === null || editView === null) return null;
151
+
152
+ let columnsSheet;
153
+ if (editView !== undefined) {
154
+ const keys = ["title", "applyButton", "abortViewText"];
155
+ const values = keys.map(key => source(pick(j, editView, key)));
156
+ if (values.includes(null)) return null;
157
+ columnsSheet = objectOf(keys.map((key, i) => [key, values[i]]));
158
+ }
159
+
160
+ return {
161
+ header: filterView === undefined ? null : objectOf([["filterView", filterView]]),
162
+ table:
163
+ errorMessages === undefined && columnsSheet === undefined
164
+ ? null
165
+ : objectOf([
166
+ ["errorMessages", errorMessages],
167
+ ["columnsSheet", columnsSheet],
168
+ ]),
169
+ };
170
+ };
171
+
172
+ const attributeName = attribute =>
173
+ attribute.type === "JSXAttribute" && attribute.name.type === "JSXIdentifier"
174
+ ? attribute.name.name
175
+ : null;
176
+
177
+ /** The expression of a prop value (`prop="a"`, `prop={a}`, `prop` → `true`) */
178
+ const attributeExpression = (j, attribute) => {
179
+ if (attribute.value === null) return j.booleanLiteral(true);
180
+ if (attribute.value.type === "JSXExpressionContainer") return attribute.value.expression;
181
+ return attribute.value;
182
+ };
183
+
184
+ /** `name={source}` */
185
+ const expressionAttribute = (j, name, source) =>
186
+ j.jsxAttribute(j.jsxIdentifier(name), j.jsxExpressionContainer(parseExpression(j, source)));
187
+
188
+ /**
189
+ * Props of the header and the table of one `DataTable`, or a reason why it can't be migrated
190
+ *
191
+ * @returns {{header: object[], table: object[], key: object | undefined, storageId: boolean} | {skip: string}}
192
+ */
193
+ const splitProps = (j, attributes, tableStates) => {
194
+ const header = [];
195
+ const table = [];
196
+ let key;
197
+ let storageId = false;
198
+ let modalText;
199
+
200
+ const searchAttribute = attributes.find(attribute => attributeName(attribute) === "search");
201
+ const queryAttribute = attributes.find(attribute => attributeName(attribute) === "searchQuery");
202
+ const spreads = attributes.filter(attribute => attribute.type === "JSXSpreadAttribute");
203
+
204
+ for (const spread of spreads) {
205
+ const {argument} = spread;
206
+ if (argument.type !== "Identifier" || !tableStates.has(argument.name)) {
207
+ return {
208
+ skip:
209
+ `the props in {...${j(argument).toSource()}} can't be split between CollectionHeader ` +
210
+ "and DataTableCollection",
211
+ };
212
+ }
213
+ }
214
+ if (spreads.length > 0 && Boolean(searchAttribute) !== Boolean(queryAttribute)) {
215
+ return {skip: "search and searchQuery are split between a spread and a prop"};
216
+ }
217
+
218
+ for (const attribute of attributes) {
219
+ if (attribute.type === "JSXSpreadAttribute") {
220
+ header.push(
221
+ j.jsxSpreadAttribute(j.memberExpression(attribute.argument, j.identifier("header"))),
222
+ );
223
+ table.push(attribute);
224
+ continue;
225
+ }
226
+
227
+ const name = attributeName(attribute);
228
+ if (name === "key") {
229
+ key = attribute;
230
+ } else if (name === "modalText") {
231
+ modalText = attributeExpression(j, attribute);
232
+ } else if (name === "search") {
233
+ const query = queryAttribute && attributeExpression(j, queryAttribute);
234
+ const value = !query
235
+ ? '""'
236
+ : isPlainReference(query)
237
+ ? `${toSource(j, query)} ?? ""`
238
+ : `(${toSource(j, query)}) ?? ""`;
239
+ header.push(
240
+ expressionAttribute(
241
+ j,
242
+ "search",
243
+ objectOf([
244
+ ["value", value],
245
+ ["onChange", toSource(j, attributeExpression(j, attribute))],
246
+ ]),
247
+ ),
248
+ );
249
+ } else if (name === "searchQuery") {
250
+ // Moved into `search`, the `DataTable` ignored it without `search`
251
+ } else if (HEADER_PROPS.has(name)) {
252
+ header.push(attribute);
253
+ } else if (REMOVED_PROPS.has(name)) {
254
+ // `DataTable` always scrolled in its own area
255
+ } else {
256
+ if (name === "storageId") storageId = true;
257
+ table.push(attribute);
258
+ }
259
+ }
260
+
261
+ table.push(j.jsxAttribute(j.jsxIdentifier("fixedHeight")));
262
+
263
+ if (modalText) {
264
+ const text = splitModalText(j, modalText);
265
+ if (!text) {
266
+ return {skip: "modalText is built by an expression that can't be split"};
267
+ }
268
+ if (text.header) header.push(expressionAttribute(j, "text", text.header));
269
+ if (text.table) table.push(expressionAttribute(j, "text", text.table));
270
+ }
271
+
272
+ return {header, table, key, storageId};
273
+ };
274
+
275
+ /** Whether the file declares or uses `name` (other than as a property), so it can't be imported */
276
+ const isNameTaken = (j, root, name) =>
277
+ root.find(j.Identifier, {name}).some(path => {
278
+ const parent = path.parent.node;
279
+ return !(
280
+ (parent.type === "MemberExpression" && parent.property === path.node && !parent.computed) ||
281
+ (["Property", "ObjectProperty"].includes(parent.type) && parent.key === path.node)
282
+ );
283
+ }) || root.find(j.JSXIdentifier, {name}).size() > 0;
284
+
285
+ module.exports = function transform(file, api) {
286
+ // The tsx parser can't read type assertions (`<Type>value`) of .ts files
287
+ const j = /\.[mc]?ts$/.test(file.path) ? api.jscodeshift.withParser("ts") : api.jscodeshift;
288
+ const root = j(file.source);
289
+ const imports = findImports(j, root);
290
+
291
+ if (
292
+ !imports.named.has(OLD_COMPONENT) &&
293
+ !imports.named.has(OLD_PROPS_TYPE) &&
294
+ imports.namespaces.size === 0
295
+ ) {
296
+ return undefined;
297
+ }
298
+
299
+ const tableStates = findTableStates(j, root, imports);
300
+ const report = (node, message) => api.report(`${location(file, node)}: ${message}`);
301
+
302
+ // Local names of the new components, imported on demand into the declaration of `DataTable`
303
+ const declaration = imports.declarations.find(path =>
304
+ path.node.specifiers?.some(
305
+ specifier =>
306
+ specifier.type === "ImportSpecifier" && specifier.imported.name === OLD_COMPONENT,
307
+ ),
308
+ );
309
+ const localNames = new Map();
310
+ const componentName = (component, oldName) => {
311
+ if (oldName.type === "JSXMemberExpression") {
312
+ return j.jsxMemberExpression(
313
+ j.jsxIdentifier(oldName.object.name),
314
+ j.jsxIdentifier(component),
315
+ );
316
+ }
317
+ if (!localNames.has(component)) {
318
+ const imported = imports.named.get(component);
319
+ if (imported?.size) {
320
+ localNames.set(component, [...imported][0]);
321
+ } else {
322
+ const local = isNameTaken(j, root, component) ? `Fusion${component}` : component;
323
+ const specifier =
324
+ local === component
325
+ ? j.importSpecifier(j.identifier(component))
326
+ : j.importSpecifier(j.identifier(component), j.identifier(local));
327
+ declaration.node.specifiers.push(specifier);
328
+ localNames.set(component, local);
329
+ }
330
+ }
331
+ return j.jsxIdentifier(localNames.get(component));
332
+ };
333
+
334
+ let changed = false;
335
+
336
+ root.find(j.JSXElement).forEach(path => {
337
+ const opening = path.node.openingElement;
338
+ if (!refersTo(opening.name, OLD_COMPONENT, imports)) return;
339
+
340
+ if (path.node.children.some(child => child.type !== "JSXText" || child.value.trim() !== "")) {
341
+ report(opening, "DataTable with children, migrate it by hand");
342
+ return;
343
+ }
344
+
345
+ const props = splitProps(j, opening.attributes, tableStates);
346
+ if (props.skip) {
347
+ report(opening, `DataTable not migrated, ${props.skip}. Migrate it by hand`);
348
+ return;
349
+ }
350
+
351
+ const typeParameters = opening.typeParameters;
352
+ const element = (component, attributes) => {
353
+ const opening = j.jsxOpeningElement(
354
+ componentName(component, path.node.openingElement.name),
355
+ attributes,
356
+ true,
357
+ );
358
+ if (typeParameters) opening.typeParameters = typeParameters;
359
+ return j.jsxElement(opening, null, []);
360
+ };
361
+
362
+ const tile = j.jsxElement(
363
+ j.jsxOpeningElement(componentName("Tile", opening.name), props.key ? [props.key] : []),
364
+ j.jsxClosingElement(componentName("Tile", opening.name)),
365
+ [
366
+ j.jsxText("\n"),
367
+ element("CollectionHeader", props.header),
368
+ j.jsxText("\n"),
369
+ element("DataTableCollection", props.table),
370
+ j.jsxText("\n"),
371
+ ],
372
+ );
373
+
374
+ path.replace(tile);
375
+ changed = true;
376
+
377
+ if (props.storageId) {
378
+ report(
379
+ opening,
380
+ "DataTable stored the visible columns with storageId, DataTableCollection keeps only " +
381
+ "the column widths. Pass storageId to useSimpleTable / useServerTable to keep the " +
382
+ "columns, search and filters",
383
+ );
384
+ }
385
+ });
386
+
387
+ // References that aren't elements: `typeof DataTable`, `DataTableProps<T>`, `styled(DataTable)`
388
+ const localOld = imports.named.get(OLD_COMPONENT) ?? new Set();
389
+ const localPropsType = imports.named.get(OLD_PROPS_TYPE) ?? new Set();
390
+ const remaining = new Set();
391
+ const reportReference = (node, name) =>
392
+ report(
393
+ node,
394
+ name === OLD_PROPS_TYPE
395
+ ? `${OLD_PROPS_TYPE} is deprecated, use DataTableCollectionProps and CollectionHeaderProps`
396
+ : `${OLD_COMPONENT} is deprecated, migrate this reference by hand`,
397
+ );
398
+
399
+ root.find(j.Identifier).forEach(path => {
400
+ const {name} = path.node;
401
+ const parent = path.parent.node;
402
+ if (!localOld.has(name) && !localPropsType.has(name)) return;
403
+ // Elements are handled above (JSXIdentifier is an Identifier for ast-types)
404
+ if (path.node.type === "JSXIdentifier") return;
405
+ if (parent.type === "ImportSpecifier") return;
406
+ if (
407
+ ["MemberExpression", "TSQualifiedName"].includes(parent.type) &&
408
+ parent.object !== path.node &&
409
+ parent.left !== path.node
410
+ )
411
+ return;
412
+ if (
413
+ ["Property", "ObjectProperty"].includes(parent.type) &&
414
+ parent.key === path.node &&
415
+ !parent.shorthand
416
+ )
417
+ return;
418
+
419
+ if (localOld.has(name)) remaining.add(name);
420
+ reportReference(path.node, localOld.has(name) ? OLD_COMPONENT : OLD_PROPS_TYPE);
421
+ });
422
+ // `Fusion.DataTable` and `Fusion.DataTableProps`
423
+ [...root.find(j.MemberExpression).paths(), ...root.find(j.TSQualifiedName).paths()].forEach(
424
+ path => {
425
+ const object = path.node.object ?? path.node.left;
426
+ const property = path.node.property ?? path.node.right;
427
+ if (
428
+ object.type === "Identifier" &&
429
+ imports.namespaces.has(object.name) &&
430
+ !path.node.computed &&
431
+ [OLD_COMPONENT, OLD_PROPS_TYPE].includes(property.name)
432
+ ) {
433
+ reportReference(path.node, property.name);
434
+ }
435
+ },
436
+ );
437
+ root.find(j.JSXElement).forEach(path => {
438
+ const {name} = path.node.openingElement;
439
+ if (name.type === "JSXIdentifier" && localOld.has(name.name)) remaining.add(name.name);
440
+ });
441
+
442
+ // The import of `DataTable` is unused once every element is migrated
443
+ if (changed && declaration) {
444
+ declaration.node.specifiers = declaration.node.specifiers.filter(
445
+ specifier =>
446
+ specifier.type !== "ImportSpecifier" ||
447
+ specifier.imported.name !== OLD_COMPONENT ||
448
+ remaining.has(specifier.local.name),
449
+ );
450
+ }
451
+
452
+ return changed ? root.toSource({quote: "double", objectCurlySpacing: false}) : undefined;
453
+ };
454
+
455
+ module.exports.parser = "tsx";