Skip to content

Commit 0de3c6c

Browse files
committed
Docs(fix[esm]): Use explicit .ts extensions in package entrypoints
why: Node ESM resolution fails on extensionless TS imports during Astro dev. what: - Add .ts extensions for local exports/imports in core and Astro packages - Enable allowImportingTsExtensions in the workspace tsconfig
1 parent 643cb1d commit 0de3c6c

File tree

8 files changed

+19
-11
lines changed

8 files changed

+19
-11
lines changed

astro/packages/astro/autodoc/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ export const autodocComponents = {
1616
Docstring,
1717
}
1818

19-
export * from './load'
20-
export * from './utils'
19+
export * from './load.ts'
20+
export * from './utils.ts'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
export { default as IntersphinxLink } from './components/IntersphinxLink.astro'
2-
export * from './resolve'
2+
export * from './resolve.ts'

astro/packages/core/api-model/src/build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
ApiParameterSchema,
1515
type ApiVariable,
1616
ApiVariableSchema,
17-
} from './schema'
17+
} from './schema.ts'
1818

1919
export type BuildOptions = {
2020
name: string
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export * from './build'
2-
export * from './schema'
1+
export * from './build.ts'
2+
export * from './schema.ts'
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export * from './parse'
2-
export * from './schema'
1+
export * from './parse.ts'
2+
export * from './schema.ts'

astro/packages/core/intersphinx/src/parse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
IntersphinxInventorySchema,
55
type IntersphinxItem,
66
IntersphinxItemSchema,
7-
} from './schema'
7+
} from './schema.ts'
88

99
const HEADER_LINES = 4
1010

astro/packages/core/py-ast/src/index.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
import path from 'node:path'
22
import { fileURLToPath } from 'node:url'
33
import { execa } from 'execa'
4-
import { type PyImport, type PyModule, PyModuleArraySchema, PyModuleSchema, type PyNode, PyNodeSchema } from './schema'
4+
import {
5+
type PyImport,
6+
type PyModule,
7+
PyModuleArraySchema,
8+
PyModuleSchema,
9+
type PyNode,
10+
PyNodeSchema,
11+
} from './schema.ts'
512

613
export type PythonCommand = [string, ...string[]]
714

@@ -126,4 +133,4 @@ export function* walkPyNodes(modules: PyModule[]): Generator<PyQualifiedNode> {
126133

127134
export const parsePyNode = (input: unknown): PyNode => PyNodeSchema.parse(input)
128135

129-
export * from './schema'
136+
export * from './schema.ts'

astro/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"lib": ["DOM", "DOM.Iterable", "ESNext"],
66
"jsx": "react-jsx",
77
"moduleResolution": "bundler",
8+
"allowImportingTsExtensions": true,
89
"resolveJsonModule": true,
910
"isolatedModules": true,
1011
"esModuleInterop": true,

0 commit comments

Comments
 (0)