@zerotal/inertia 1.0.0 → 1.0.2
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 +9 -0
- package/package.json +2 -2
- package/src/inertia.ts +10 -2
- package/src/ssr/renderPage.ts +10 -2
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,15 @@ follows the Zerotal monorepo's unified versioning.
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [1.0.2] — 2026-08-06
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- Type-checking a Vue app no longer fails on React. React is an optional peer
|
|
16
|
+
and is imported dynamically at runtime, but the literal specifiers were still
|
|
17
|
+
resolved by TypeScript, so Vue projects were asked for modules they never
|
|
18
|
+
install.
|
|
19
|
+
|
|
11
20
|
## [1.0.0] — 2026-08-05
|
|
12
21
|
|
|
13
22
|
_First public release._
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zerotal/inertia",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"maturity": "beta",
|
|
6
6
|
"private": false,
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"typecheck": "tsc --noEmit"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@zerotal/core": "1.0.
|
|
35
|
+
"@zerotal/core": "1.0.2"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"react": "^18 || ^19",
|
package/src/inertia.ts
CHANGED
|
@@ -194,9 +194,17 @@ export async function inertiaStream(
|
|
|
194
194
|
const openTag = `<div id="app">`;
|
|
195
195
|
const closeBlock = `</div>\n <script type="application/json" data-page="app">${safeJson}</script>`;
|
|
196
196
|
|
|
197
|
+
// Specifiers via variables, not literals. React is an *optional* peer — a Vue
|
|
198
|
+
// app never installs it — but a literal `import("react")` is still resolved by
|
|
199
|
+
// TypeScript, so type-checking a Vue project failed on modules it will never
|
|
200
|
+
// have. Both results are cast below, so nothing is lost by hiding the
|
|
201
|
+
// specifier from the resolver; this branch only runs when the app is React.
|
|
202
|
+
const reactSpecifier = "react";
|
|
203
|
+
const reactServerSpecifier = "react-dom/server";
|
|
204
|
+
|
|
197
205
|
const [reactMod, serverMod, pageMod] = await Promise.all([
|
|
198
|
-
import(
|
|
199
|
-
import(
|
|
206
|
+
import(reactSpecifier) as Promise<{ createElement(type: unknown, props: unknown): unknown }>,
|
|
207
|
+
import(reactServerSpecifier) as Promise<{
|
|
200
208
|
renderToReadableStream(el: unknown): Promise<ReadableStream<Uint8Array>>;
|
|
201
209
|
}>,
|
|
202
210
|
import(modPath) as Promise<{ default: unknown }>,
|
package/src/ssr/renderPage.ts
CHANGED
|
@@ -104,9 +104,17 @@ async function _renderReact(page: SsrPage, modPath: string): Promise<SsrResult>
|
|
|
104
104
|
throw new Error(`SSR component "${page.component}" has no default export`);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
// Specifiers via variables so TypeScript does not resolve them: React is an
|
|
108
|
+
// optional peer, and a Vue app type-checking this package must not be asked
|
|
109
|
+
// for modules it will never install. Both results are cast on the next lines.
|
|
110
|
+
const reactSpecifier = "react";
|
|
111
|
+
const reactServerSpecifier = "react-dom/server";
|
|
112
|
+
|
|
107
113
|
const [reactMod, serverMod] = await Promise.all([
|
|
108
|
-
import(
|
|
109
|
-
|
|
114
|
+
import(reactSpecifier) as Promise<{
|
|
115
|
+
createElement: (type: unknown, props: unknown) => unknown;
|
|
116
|
+
}>,
|
|
117
|
+
import(reactServerSpecifier) as Promise<{ renderToString: (element: unknown) => string }>,
|
|
110
118
|
]);
|
|
111
119
|
|
|
112
120
|
const element = reactMod.createElement(pageMod.default, { ...page.props, url: page.url });
|