eddev 2.3.29 → 2.3.31
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/dist/app/lib/routing/components/BrowserRouter.d.ts.map +1 -1
- package/dist/app/lib/routing/components/BrowserRouter.js +10 -7
- package/dist/app/server/render-ssr-page.js +1 -1
- package/dist/node/cli/version.d.ts +1 -1
- package/dist/node/cli/version.js +1 -1
- package/dist/node/compiler/dev-server.d.ts.map +1 -1
- package/dist/node/compiler/dev-server.js +21 -4
- package/dist/node/utils/http-to-https-redirect.d.ts +10 -0
- package/dist/node/utils/http-to-https-redirect.d.ts.map +1 -0
- package/dist/node/utils/http-to-https-redirect.js +49 -0
- package/dist/node/utils/self-signed-cert.d.ts.map +1 -1
- package/dist/node/utils/self-signed-cert.js +13 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserRouter.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/routing/components/BrowserRouter.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAOlB,MAAM,OAAO,CAAA;AAKd,OAAO,EAGL,cAAc,EAId,KAAK,SAAS,EAGf,MAAM,aAAa,CAAA;AAYpB,KAAK,KAAK,GAAG,iBAAiB,CAAC;IAC7B,SAAS,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,SAAS,GAAG,IAAI,CAAC,CAAA;IACpD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB,CAAC,CAAA;AAiFF,wBAAgB,eAAe;WAFJ,cAAc;SAAO,SAAS;SAIxD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,+
|
|
1
|
+
{"version":3,"file":"BrowserRouter.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/routing/components/BrowserRouter.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAOlB,MAAM,OAAO,CAAA;AAKd,OAAO,EAGL,cAAc,EAId,KAAK,SAAS,EAGf,MAAM,aAAa,CAAA;AAYpB,KAAK,KAAK,GAAG,iBAAiB,CAAC;IAC7B,SAAS,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,SAAS,GAAG,IAAI,CAAC,CAAA;IACpD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB,CAAC,CAAA;AAiFF,wBAAgB,eAAe;WAFJ,cAAc;SAAO,SAAS;SAIxD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,+BA0ezC"}
|
|
@@ -9,7 +9,7 @@ import { AppRenderer } from "./RouteRenderer.js";
|
|
|
9
9
|
// Create a global RouteLoader instance
|
|
10
10
|
const loader = new RouteLoader();
|
|
11
11
|
// Create a unique ID for each history entry
|
|
12
|
-
|
|
12
|
+
const historyStamp = String(new Date().getTime());
|
|
13
13
|
let historyIndex = 0;
|
|
14
14
|
function getHistoryId() {
|
|
15
15
|
return historyStamp + historyIndex++;
|
|
@@ -34,7 +34,7 @@ if (env.client && !env.admin) {
|
|
|
34
34
|
loader.populateRouteData(document.location.pathname, initialData);
|
|
35
35
|
const initialURL = parseURL(document.location.href);
|
|
36
36
|
initialRoute = normalizeRoute({
|
|
37
|
-
id:
|
|
37
|
+
id: getHistoryId(),
|
|
38
38
|
component: loader.getRouteComponent(initialData.view),
|
|
39
39
|
pathname: initialURL.pathname,
|
|
40
40
|
hash: "",
|
|
@@ -144,7 +144,7 @@ export function BrowserRouter(props) {
|
|
|
144
144
|
...route,
|
|
145
145
|
}, false);
|
|
146
146
|
};
|
|
147
|
-
const historyCache = new Map();
|
|
147
|
+
const historyCache = new Map([[initialRoute.id, initialRoute]]);
|
|
148
148
|
function setHistory(history) {
|
|
149
149
|
setState({
|
|
150
150
|
history,
|
|
@@ -156,8 +156,9 @@ export function BrowserRouter(props) {
|
|
|
156
156
|
}
|
|
157
157
|
internals.poppedState = (href, data) => {
|
|
158
158
|
const stack = state.history;
|
|
159
|
+
const uri = stringifyRouteLink(parseRouteLink(href));
|
|
159
160
|
// Is the route in our history stack? (going back)
|
|
160
|
-
const index = stack.findIndex((item) => item.id === data.id);
|
|
161
|
+
const index = stack.findIndex((item) => item.id === data.id && isEqual(item.uri, uri));
|
|
161
162
|
if (index >= 0) {
|
|
162
163
|
const route = stack[index];
|
|
163
164
|
return doRouteTransition({
|
|
@@ -170,8 +171,9 @@ export function BrowserRouter(props) {
|
|
|
170
171
|
});
|
|
171
172
|
}
|
|
172
173
|
// Is the route in our history _cache_? (probably going forward)
|
|
173
|
-
|
|
174
|
-
|
|
174
|
+
const cachedRoute = historyCache.get(data.id);
|
|
175
|
+
if (cachedRoute && isEqual(cachedRoute.uri, uri)) {
|
|
176
|
+
const route = cachedRoute;
|
|
175
177
|
return doRouteTransition({
|
|
176
178
|
url: route.uri,
|
|
177
179
|
route,
|
|
@@ -185,6 +187,7 @@ export function BrowserRouter(props) {
|
|
|
185
187
|
url: href,
|
|
186
188
|
goingBack: true,
|
|
187
189
|
history: [],
|
|
190
|
+
historyId: typeof data.id === "string" ? data.id : undefined,
|
|
188
191
|
restoreState: data.state,
|
|
189
192
|
shouldPush: false,
|
|
190
193
|
});
|
|
@@ -248,7 +251,7 @@ export function BrowserRouter(props) {
|
|
|
248
251
|
}
|
|
249
252
|
const route = args.route ??
|
|
250
253
|
normalizeRoute({
|
|
251
|
-
id: getHistoryId(),
|
|
254
|
+
id: args.historyId ?? getHistoryId(),
|
|
252
255
|
hash: link.hash,
|
|
253
256
|
search: "",
|
|
254
257
|
query: link.query,
|
|
@@ -41,7 +41,7 @@ export async function getSsrStream(args) {
|
|
|
41
41
|
})};\n`,
|
|
42
42
|
});
|
|
43
43
|
});
|
|
44
|
-
const [initial, middle, end] = renderToString(_jsxs("html", { lang: "en", children: [_jsxs("head", { children: ["%%$%%", _jsx(MetaTags, { tags: args.initialData.meta?.head ?? [] }), "%%trackers_head%%"] }), _jsxs("body", { children: ["%%trackers_body%%", _jsx("div", { id: "root", children: "%%$%%" }), "%%trackers_footer%%"] })] }))
|
|
44
|
+
const [initial, middle, end] = renderToString(_jsxs("html", { lang: "en", className: "frontend", children: [_jsxs("head", { children: ["%%$%%", _jsx(MetaTags, { tags: args.initialData.meta?.head ?? [] }), "%%trackers_head%%"] }), _jsxs("body", { children: ["%%trackers_body%%", _jsx("div", { id: "root", children: "%%$%%" }), "%%trackers_footer%%"] })] }))
|
|
45
45
|
.replace(/%%trackers_(head|body|footer)%%/g, (_, name) => {
|
|
46
46
|
return args.initialData.trackers?.[name] || "";
|
|
47
47
|
})
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "2.3.
|
|
1
|
+
export declare const VERSION = "2.3.31";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/node/cli/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "2.3.
|
|
1
|
+
export const VERSION = "2.3.31";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../../../src/node/compiler/dev-server.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../../../src/node/compiler/dev-server.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAO/C,MAAM,MAAM,mBAAmB,GAAG;IAChC,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AAID,eAAO,MAAM,aAAa,qEAAU,CAAA;AAEpC,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,OAAO,CAAA;CACf,CAAA;AAED,qBAAa,SAAS;IAOX,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,OAAO;IAPtB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,SAAO;gBAGF,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,OAAO;IAUhB,KAAK;CA8GZ"}
|
|
@@ -2,6 +2,7 @@ import { parseURL } from "ufo";
|
|
|
2
2
|
import { createDevServer } from "vinxi/dev-server";
|
|
3
3
|
import { ProjectEnvUtils } from "../project/env.js";
|
|
4
4
|
import { ensureSelfSignedCert, isCertificateTrusted } from "../utils/self-signed-cert.js";
|
|
5
|
+
import { listenWithHttpRedirect } from "../utils/http-to-https-redirect.js";
|
|
5
6
|
import { createConsole } from "../utils/stateful-log.js";
|
|
6
7
|
import { createVinxiApp } from "./vinxi-app.js";
|
|
7
8
|
import chalk from "chalk";
|
|
@@ -88,14 +89,30 @@ export class DevServer {
|
|
|
88
89
|
devApp,
|
|
89
90
|
});
|
|
90
91
|
// console.log("Creating another listener")
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
// HTTPS needs an internal port so the public socket can redirect plain HTTP first.
|
|
93
|
+
const listener = await devApp.listen(this.opts.https ? 0 : this.port, {
|
|
94
|
+
hostname: this.opts.https ? "127.0.0.1" : undefined,
|
|
95
|
+
port: this.opts.https ? 0 : this.port,
|
|
94
96
|
https: httpsConfig,
|
|
95
97
|
qr: false,
|
|
96
98
|
showURL: false,
|
|
97
|
-
public:
|
|
99
|
+
public: !this.opts.https,
|
|
98
100
|
});
|
|
101
|
+
if (this.opts.https) {
|
|
102
|
+
try {
|
|
103
|
+
const redirectListener = await listenWithHttpRedirect({
|
|
104
|
+
hostname: this.hostname,
|
|
105
|
+
port: this.port,
|
|
106
|
+
httpsPort: listener.address.port,
|
|
107
|
+
httpsOrigin: this.hostOrigin,
|
|
108
|
+
});
|
|
109
|
+
listener.server.once("close", () => redirectListener.close());
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
await listener.close();
|
|
113
|
+
throw error;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
99
116
|
await app.hooks.callHook("app:dev:server:listener:created", {
|
|
100
117
|
app,
|
|
101
118
|
devApp,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Server } from "node:net";
|
|
2
|
+
type Options = {
|
|
3
|
+
hostname: string;
|
|
4
|
+
port: number;
|
|
5
|
+
httpsPort: number;
|
|
6
|
+
httpsOrigin: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function listenWithHttpRedirect(options: Options): Promise<Server>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=http-to-https-redirect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-to-https-redirect.d.ts","sourceRoot":"","sources":["../../../src/node/utils/http-to-https-redirect.ts"],"names":[],"mappings":"AACA,OAAO,EAA4C,KAAK,MAAM,EAAE,MAAM,UAAU,CAAA;AAEhF,KAAK,OAAO,GAAG;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAgD9E"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { createServer as createHttpServer } from "node:http";
|
|
2
|
+
import { connect, createServer as createNetServer } from "node:net";
|
|
3
|
+
export async function listenWithHttpRedirect(options) {
|
|
4
|
+
const redirectServer = createHttpServer((request, response) => {
|
|
5
|
+
let path = "/";
|
|
6
|
+
try {
|
|
7
|
+
const url = new URL(request.url ?? "/", options.httpsOrigin);
|
|
8
|
+
path = url.pathname + url.search;
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
// A malformed request target still redirects to the configured origin.
|
|
12
|
+
}
|
|
13
|
+
response.writeHead(308, {
|
|
14
|
+
Location: options.httpsOrigin + path,
|
|
15
|
+
Connection: "close",
|
|
16
|
+
"Cache-Control": "no-store",
|
|
17
|
+
});
|
|
18
|
+
response.end();
|
|
19
|
+
});
|
|
20
|
+
const server = createNetServer((socket) => {
|
|
21
|
+
socket.once("data", (firstChunk) => {
|
|
22
|
+
socket.pause();
|
|
23
|
+
// A TLS ClientHello starts with a handshake record (0x16).
|
|
24
|
+
if (firstChunk[0] !== 0x16) {
|
|
25
|
+
socket.unshift(firstChunk);
|
|
26
|
+
redirectServer.emit("connection", socket);
|
|
27
|
+
socket.resume();
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const upstream = connect(options.httpsPort, "127.0.0.1", () => {
|
|
31
|
+
upstream.write(firstChunk);
|
|
32
|
+
socket.pipe(upstream);
|
|
33
|
+
upstream.pipe(socket);
|
|
34
|
+
socket.resume();
|
|
35
|
+
});
|
|
36
|
+
socket.on("error", () => upstream.destroy());
|
|
37
|
+
upstream.on("error", () => socket.destroy());
|
|
38
|
+
socket.on("close", () => upstream.destroy());
|
|
39
|
+
upstream.on("close", () => socket.destroy());
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
return new Promise((resolve, reject) => {
|
|
43
|
+
server.once("error", reject);
|
|
44
|
+
server.listen(options.port, options.hostname, () => {
|
|
45
|
+
server.off("error", reject);
|
|
46
|
+
resolve(server);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"self-signed-cert.d.ts","sourceRoot":"","sources":["../../../src/node/utils/self-signed-cert.ts"],"names":[],"mappings":"AAKA,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;;;;;;
|
|
1
|
+
{"version":3,"file":"self-signed-cert.d.ts","sourceRoot":"","sources":["../../../src/node/utils/self-signed-cert.ts"],"names":[],"mappings":"AAKA,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;;;;;;GA0D3E;AAWD,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,oBAOtD"}
|
|
@@ -3,6 +3,19 @@ import { fs } from "./fs.js";
|
|
|
3
3
|
import { createCA, createCert } from "mkcert";
|
|
4
4
|
import { execa } from "execa";
|
|
5
5
|
export async function ensureSelfSignedCert(hostname, rootDir) {
|
|
6
|
+
const localCertDir = `${(await import("node:os")).homedir()}/Library/Application Support/Local/run/router/nginx/certs`;
|
|
7
|
+
try {
|
|
8
|
+
return {
|
|
9
|
+
created: false,
|
|
10
|
+
...(await loadCert({
|
|
11
|
+
certFile: `${localCertDir}/${hostname}.crt`,
|
|
12
|
+
keyFile: `${localCertDir}/${hostname}.key`,
|
|
13
|
+
})),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
// Fall back to eddev's certificates when Local's pair is missing or unreadable.
|
|
18
|
+
}
|
|
6
19
|
const certFile = `${rootDir}/.eddev/certs/${hostname}.crt`;
|
|
7
20
|
const keyFile = `${rootDir}/.eddev/certs/${hostname}.key`;
|
|
8
21
|
if ((await fs.exists(certFile)) && (await fs.exists(keyFile))) {
|