@jmlweb/tsconfig-astro 1.1.2 → 1.1.4
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/CHANGELOG.md +16 -0
- package/README.md +61 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @jmlweb/tsconfig-astro
|
|
2
2
|
|
|
3
|
+
## 1.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4a9ece1: Update documentation to use pnpm commands instead of npm
|
|
8
|
+
- Updated dependencies [4a9ece1]
|
|
9
|
+
- @jmlweb/tsconfig-base@1.0.4
|
|
10
|
+
|
|
11
|
+
## 1.1.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 6b73301: Add changelog section with link to CHANGELOG.md in package READMEs
|
|
16
|
+
- Updated dependencies [6b73301]
|
|
17
|
+
- @jmlweb/tsconfig-base@1.0.3
|
|
18
|
+
|
|
3
19
|
## 1.1.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -20,9 +20,11 @@
|
|
|
20
20
|
## 📦 Installation
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
|
|
23
|
+
pnpm add -D @jmlweb/tsconfig-astro typescript astro @jmlweb/tsconfig-base
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
+
> 💡 **Upgrading from a previous version?** See the [Migration Guide](#-migration-guide) for breaking changes and upgrade instructions.
|
|
27
|
+
|
|
26
28
|
## 🚀 Quick Start
|
|
27
29
|
|
|
28
30
|
Create a `tsconfig.json` file in your Astro project root:
|
|
@@ -92,6 +94,38 @@ Create a `tsconfig.json` file in your Astro project root:
|
|
|
92
94
|
}
|
|
93
95
|
```
|
|
94
96
|
|
|
97
|
+
## 🤔 Why Use This?
|
|
98
|
+
|
|
99
|
+
> **Philosophy**: Astro projects need TypeScript configured to preserve JSX for Astro's compiler while supporting framework components in islands.
|
|
100
|
+
|
|
101
|
+
This package provides a TypeScript configuration specifically for Astro projects. It extends the strict base configuration while setting up JSX in preserve mode, allowing Astro's compiler to handle the transformation while maintaining full type safety for both Astro components and framework components used in islands.
|
|
102
|
+
|
|
103
|
+
### Design Decisions
|
|
104
|
+
|
|
105
|
+
**JSX Preserve Mode (`jsx: "preserve"`)**: Let Astro handle JSX transformation
|
|
106
|
+
|
|
107
|
+
- **Why**: Astro has its own JSX/TSX transformation pipeline that's optimized for its component model and islands architecture. Preserve mode tells TypeScript to check types but leave the JSX syntax untouched for Astro to process. This enables proper handling of both .astro components and framework components (React, Vue, etc.) in islands
|
|
108
|
+
- **Trade-off**: Can't run TypeScript output directly without Astro's build step. But Astro projects always use Astro's build system anyway
|
|
109
|
+
- **When to override**: Never for Astro projects - Astro requires preserve mode to function correctly
|
|
110
|
+
|
|
111
|
+
**Bundler Module Resolution (`moduleResolution: "bundler"`)**: Optimized for Vite
|
|
112
|
+
|
|
113
|
+
- **Why**: Astro uses Vite as its build tool. Bundler resolution is specifically designed for Vite and other modern bundlers, providing better module resolution that matches how Vite actually resolves imports. This prevents TypeScript/runtime mismatches
|
|
114
|
+
- **Trade-off**: Not suitable for direct Node.js execution. But Astro projects always use Vite for building
|
|
115
|
+
- **When to override**: Never for Astro - bundler resolution is optimal for Vite-based frameworks
|
|
116
|
+
|
|
117
|
+
**DOM Type Definitions (`lib: ["ES2022", "DOM", "DOM.Iterable"]`)**: Browser API support
|
|
118
|
+
|
|
119
|
+
- **Why**: Astro generates static sites and SPAs that run in browsers. Your components interact with browser APIs through client-side scripts and framework islands. DOM types are essential for type-safe browser API usage
|
|
120
|
+
- **Trade-off**: Includes browser types even for static content. But most Astro sites have some client-side interactivity
|
|
121
|
+
- **When to override**: For purely static sites with zero client-side JavaScript (rare in practice)
|
|
122
|
+
|
|
123
|
+
**ESNext Modules (`module: "ESNext"`)**: Modern module syntax for Vite
|
|
124
|
+
|
|
125
|
+
- **Why**: Vite works best with ESNext modules and handles all transpilation to the target environment. Using ESNext modules enables Vite's advanced optimizations like dependency pre-bundling and fast HMR
|
|
126
|
+
- **Trade-off**: TypeScript output isn't directly executable. But Astro handles the build
|
|
127
|
+
- **When to override**: Never for Astro projects - let Vite handle module transformation
|
|
128
|
+
|
|
95
129
|
## 📋 Configuration Details
|
|
96
130
|
|
|
97
131
|
### What's Included
|
|
@@ -227,10 +261,35 @@ This package requires the following peer dependencies:
|
|
|
227
261
|
|
|
228
262
|
## 🔗 Related Packages
|
|
229
263
|
|
|
264
|
+
### Internal Packages
|
|
265
|
+
|
|
230
266
|
- [`@jmlweb/tsconfig-base`](../tsconfig-base) - Base TypeScript configuration (extended by this package)
|
|
231
|
-
- [`@jmlweb/eslint-config-
|
|
267
|
+
- [`@jmlweb/eslint-config-astro`](../eslint-config-astro) - ESLint configuration for Astro projects
|
|
232
268
|
- [`@jmlweb/prettier-config-base`](../prettier-config-base) - Prettier config for consistent formatting
|
|
233
269
|
|
|
270
|
+
### External Tools
|
|
271
|
+
|
|
272
|
+
- [TypeScript](https://www.typescriptlang.org/) - Strongly typed programming language that builds on JavaScript
|
|
273
|
+
- [Astro](https://astro.build/) - The web framework for content-driven websites
|
|
274
|
+
- [Astro integrations](https://astro.build/integrations/) - Official and community integrations
|
|
275
|
+
- [Vite](https://vite.dev/) - Build tool used by Astro
|
|
276
|
+
|
|
277
|
+
## 🔄 Migration Guide
|
|
278
|
+
|
|
279
|
+
### Upgrading to a New Version
|
|
280
|
+
|
|
281
|
+
> **Note:** If no breaking changes were introduced in a version, it's safe to upgrade without additional steps.
|
|
282
|
+
|
|
283
|
+
**No breaking changes have been introduced yet.** This package follows semantic versioning. When breaking changes are introduced, detailed migration instructions will be provided here.
|
|
284
|
+
|
|
285
|
+
For version history, see the [Changelog](./CHANGELOG.md).
|
|
286
|
+
|
|
287
|
+
**Need Help?** If you encounter issues during migration, please [open an issue](https://github.com/jmlweb/tooling/issues/new).
|
|
288
|
+
|
|
289
|
+
## 📜 Changelog
|
|
290
|
+
|
|
291
|
+
See [CHANGELOG.md](./CHANGELOG.md) for version history and release notes.
|
|
292
|
+
|
|
234
293
|
## 📄 License
|
|
235
294
|
|
|
236
295
|
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jmlweb/tsconfig-astro",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "TypeScript configuration for Astro projects with JSX support and modern defaults",
|
|
5
5
|
"main": "tsconfig.json",
|
|
6
6
|
"exports": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"astro": ">=4.0.0",
|
|
39
39
|
"typescript": ">=5.0.0",
|
|
40
|
-
"@jmlweb/tsconfig-base": "1.0.
|
|
40
|
+
"@jmlweb/tsconfig-base": "1.0.4"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {}
|
|
43
43
|
}
|