Skip to content

Commit d057380

Browse files
committed
remove
1 parent c0fd8e0 commit d057380

File tree

1 file changed

+0
-35
lines changed
  • recipes/createCredentials-to-createSecureContext/src

1 file changed

+0
-35
lines changed

recipes/createCredentials-to-createSecureContext/src/workflow.ts

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -336,41 +336,6 @@ function handleDynamicImport(
336336
const idNode = statement.child(0);
337337
const declaration = statement.parent();
338338

339-
// Detects: const x = (await import(...)).then(...)
340-
if (valueNode?.kind() === 'call_expression' && idNode?.kind() === 'identifier') {
341-
const functionNode = valueNode.field('function');
342-
const isThenCall = functionNode?.kind() === 'member_expression' && functionNode.field('property')?.text() === 'then';
343-
const awaitNode = functionNode?.field('object')?.find({ rule: { kind: 'await_expression' } });
344-
345-
const importModuleStringNode = awaitNode?.find({
346-
rule: {
347-
kind: 'string',
348-
has: { kind: 'string_fragment', regex: `^${oldImportModule}$` }
349-
}
350-
});
351-
352-
if (isThenCall && importModuleStringNode) {
353-
const allEdits: Edit[] = [];
354-
355-
const usageEdits = findAndReplaceUsages(rootNode, idNode.text(), newImportFunction);
356-
357-
allEdits.push(...usageEdits);
358-
allEdits.push(idNode.replace(newImportFunction));
359-
allEdits.push(importModuleStringNode.replace(`'${newImportModule}'`));
360-
361-
const thenCallback = valueNode.field('arguments')?.child(0);
362-
const callbackBody = thenCallback?.field('body');
363-
if (callbackBody?.kind() === 'member_expression') {
364-
const propertyNode = callbackBody.field('property');
365-
if (propertyNode?.text() === oldFunctionName) {
366-
allEdits.push(propertyNode.replace(newImportFunction));
367-
}
368-
}
369-
370-
return allEdits;
371-
}
372-
}
373-
374339
if (valueNode?.kind() === 'await_expression') {
375340
if (!declaration) {
376341
return [];

0 commit comments

Comments
 (0)