@jmlweb/tsconfig-astro 1.1.3 → 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 CHANGED
@@ -1,5 +1,13 @@
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
+
3
11
  ## 1.1.3
4
12
 
5
13
  ### Patch Changes
package/README.md CHANGED
@@ -20,7 +20,7 @@
20
20
  ## 📦 Installation
21
21
 
22
22
  ```bash
23
- npm install --save-dev @jmlweb/tsconfig-astro typescript astro @jmlweb/tsconfig-base
23
+ pnpm add -D @jmlweb/tsconfig-astro typescript astro @jmlweb/tsconfig-base
24
24
  ```
25
25
 
26
26
  > 💡 **Upgrading from a previous version?** See the [Migration Guide](#-migration-guide) for breaking changes and upgrade instructions.
@@ -94,6 +94,38 @@ Create a `tsconfig.json` file in your Astro project root:
94
94
  }
95
95
  ```
96
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
+
97
129
  ## 📋 Configuration Details
98
130
 
99
131
  ### What's Included
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jmlweb/tsconfig-astro",
3
- "version": "1.1.3",
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.3"
40
+ "@jmlweb/tsconfig-base": "1.0.4"
41
41
  },
42
42
  "scripts": {}
43
43
  }