You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Code transformation tools have evolved significantly over the years, each offering unique approaches to programmatic code manipulation. Let's explore the strengths and limitations of major frameworks in this space.
Copy file name to clipboardExpand all lines: docs/building-with-codegen/imports-and-exports.mdx
+111Lines changed: 111 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -102,6 +102,117 @@ for exp in file.exports: # Iterates over all Export symbols
102
102
empty.
103
103
</Note>
104
104
105
+
## Working with Imports
106
+
107
+
### Working with External Modules
108
+
109
+
When working with imports, you often need to distinguish between imports from your project and external packages (like `react` or `lodash`). The [ExternalModule](/api-reference/core/ExternalModule) class helps with this:
print(f"Through files: {' -> '.join(exp.file.filepath for exp in imp.export_chain)}")
210
+
```
211
+
212
+
<Note>
213
+
When working with imports, always check if they resolve to external modules before modification. This prevents accidentally modifying imports from third-party packages.
214
+
</Note>
215
+
105
216
## Identifying Export Types
106
217
107
218
Codegen provides several methods to identify and filter different types of exports in your TypeScript code. Here's how to work with various export patterns:
Copy file name to clipboardExpand all lines: docs/introduction/getting-started.mdx
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -281,8 +281,7 @@ if base_class:
281
281
282
282
<Note>
283
283
Learn more about [dependencies and
284
-
references](/building-with-codegen/dependencies-and-usages) or [imports
285
-
and exports](/building-with-codegen/imports-and-exports).
284
+
references](/building-with-codegen/dependencies-and-usages) or [imports](/building-with-codegen/imports) and [exports](/building-with-codegen/exports).
0 commit comments