MCPcopy Create free account
hub / github.com/adobe/react-spectrum / Import

Function Import

packages/dev/codemods/src/s1-to-s2/src/codemods/codemod.ts:338–358  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

336 }
337 },
338 Import(path) {
339 let call = path.parentPath;
340 if (!call?.isCallExpression()) {
341 return;
342 }
343
344 let arg = call.node.arguments[0];
345 if (arg.type !== 'StringLiteral') {
346 return;
347 }
348
349 let isV3ImportSource =
350 arg.value === '@adobe/react-spectrum' ||
351 (arg.value.startsWith('@react-spectrum/') && arg.value !== '@react-spectrum/s2');
352 if (!isV3ImportSource) {
353 return;
354 }
355
356 // TODO: implement this. could be a bit challenging. punting for now.
357 addComment(call.node, ' TODO(S2-upgrade): check this dynamic import');
358 },
359 JSXOpeningElement(path) {
360 let name = path.node.name;
361 if (t.isJSXIdentifier(name) && iconImports.has(name.name)) {

Callers

nothing calls this directly

Calls 1

addCommentFunction · 0.90

Tested by

no test coverage detected