Commit e180910
committed
fix(astro): drop named Image re-export — broke config load in vanilla Node
Closes kychee-com/run402-private#400.
v0.1.2 added 'export { default as Image } from "./Image.astro"' to dist/index.js so 'import { Image } from "@run402/astro"' would work. That broke the entire package: the Astro CLI loads astro.config.mjs via vanilla Node before Vite is alive, and Node has no loader for .astro extensions. The user's config does 'import { run402 } from "@run402/astro"', Node evaluates dist/index.js top-to-bottom, hits the .astro re-export, and dies with 'Unknown file extension.' vite.ssr.noExternal can't fix this because it's a Vite-pipeline setting; Vite hasn't started yet at config load time. Chicken-and-egg.
Fix: drop the re-export entirely. The integration entry point ('@run402/astro') stays pure-JS so vanilla Node can evaluate it during config load. The component is reached only via the subpath form 'import Image from "@run402/astro/Image.astro"', which Vite's plugin pipeline resolves once it's alive. Default-import syntax because .astro files have exactly one default export.
README and the entry-point JSDoc updated to document the subpath as the ONLY correct import form. The 'ergonomic named import' is documented as an anti-pattern with a pointer to the config-load constraint.
Smoke test in CI: removed the grep guard for .astro substrings (false-positives on JSDoc / comment text) and kept the runtime 'node -e import()' check, which is the authoritative test for config-load safety.1 parent 2b9d852 commit e180910
4 files changed
Lines changed: 57 additions & 49 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
171 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
172 | 180 | | |
173 | 181 | | |
174 | 182 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 48 | + | |
57 | 49 | | |
58 | 50 | | |
59 | 51 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | 7 | | |
11 | 8 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
16 | 24 | | |
17 | 25 | | |
18 | 26 | | |
| |||
143 | 151 | | |
144 | 152 | | |
145 | 153 | | |
146 | | - | |
147 | | - | |
148 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
149 | 174 | | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
155 | 179 | | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
161 | 185 | | |
162 | 186 | | |
163 | 187 | | |
0 commit comments