@turnipxenon/pineapple 5.3.15 → 5.3.17
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/external/paraglide/.prettierignore +1 -1
- package/dist/external/paraglide/README.md +162 -0
- package/dist/external/paraglide/messages/_index.d.ts +3 -8
- package/dist/external/paraglide/messages/_index.d.ts.map +1 -1
- package/dist/external/paraglide/messages/_index.js +3 -50
- package/dist/external/paraglide/messages/example_message.d.ts +19 -0
- package/dist/external/paraglide/messages/example_message.d.ts.map +1 -0
- package/dist/external/paraglide/messages/example_message.js +34 -0
- package/dist/external/paraglide/messages/package.json +4 -0
- package/dist/external/paraglide/messages/settings.d.ts +17 -0
- package/dist/external/paraglide/messages/settings.d.ts.map +1 -0
- package/dist/external/paraglide/messages/settings.js +33 -0
- package/dist/external/paraglide/registry.d.ts +13 -0
- package/dist/external/paraglide/registry.d.ts.map +1 -1
- package/dist/external/paraglide/registry.js +15 -0
- package/dist/external/paraglide/runtime.d.ts +340 -139
- package/dist/external/paraglide/runtime.d.ts.map +1 -1
- package/dist/external/paraglide/runtime.js +654 -168
- package/dist/external/paraglide/server.d.ts +47 -18
- package/dist/external/paraglide/server.d.ts.map +1 -1
- package/dist/external/paraglide/server.js +150 -35
- package/dist/modules/parsnip/external-images/externalImages.remote.d.ts +2 -2
- package/dist/modules/parsnip/external-images/externalImages.remote.d.ts.map +1 -1
- package/package.json +26 -26
- package/dist/external/paraglide/messages/en.d.ts +0 -5
- package/dist/external/paraglide/messages/en.d.ts.map +0 -1
- package/dist/external/paraglide/messages/en.js +0 -10
- package/dist/external/paraglide/messages/fr.d.ts +0 -5
- package/dist/external/paraglide/messages/fr.d.ts.map +0 -1
- package/dist/external/paraglide/messages/fr.js +0 -10
- package/dist/external/paraglide/messages/tl.d.ts +0 -5
- package/dist/external/paraglide/messages/tl.d.ts.map +0 -1
- package/dist/external/paraglide/messages/tl.js +0 -7
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Server middleware that handles locale-based routing and request processing.
|
|
3
3
|
*
|
|
4
|
+
* Configure `disableAsyncLocalStorage` when generating Paraglide with
|
|
5
|
+
* `paraglideVitePlugin()` or `compile()`, not when calling
|
|
6
|
+
* `paraglideMiddleware()`. Keep AsyncLocalStorage enabled by default and
|
|
7
|
+
* only disable it for runtimes that lack `AsyncLocalStorage` support and
|
|
8
|
+
* guarantee request isolation.
|
|
9
|
+
*
|
|
4
10
|
* This middleware performs several key functions:
|
|
5
11
|
*
|
|
6
12
|
* 1. Determines the locale for the incoming request using configured strategies
|
|
@@ -13,18 +19,27 @@
|
|
|
13
19
|
* - If URL doesn't match the determined locale, redirects to localized URL (only for document requests)
|
|
14
20
|
* - De-localizes URLs before passing to server (e.g., `/fr/about` → `/about`)
|
|
15
21
|
*
|
|
22
|
+
* @see https://paraglidejs.com/middleware
|
|
23
|
+
*
|
|
16
24
|
* @template T - The return type of the resolve function
|
|
17
25
|
*
|
|
18
26
|
* @param {Request} request - The incoming request object
|
|
19
|
-
* @param {(args: { request: Request, locale: import("./runtime.js").Locale }) => T | Promise<T>} resolve - Function to handle the request
|
|
20
|
-
*
|
|
27
|
+
* @param {(args: { request: Request, locale: import("./runtime.js").Locale }) => T | Promise<T>} resolve - Function to handle the request. The callback receives:
|
|
28
|
+
* - `request`: A modified request with a delocalized URL when the URL strategy is used (e.g., `/fr/about` → `/about`).
|
|
29
|
+
* If your framework handles URL localization itself (e.g., TanStack Router's `rewrite` option), use the original
|
|
30
|
+
* request instead to avoid redirect loops.
|
|
31
|
+
* - `locale`: The determined locale for this request.
|
|
32
|
+
* @param {{
|
|
33
|
+
* effectiveRequestUrl?: string | URL | ((request: Request) => string | URL),
|
|
34
|
+
* onRedirect?: (response: Response) => void
|
|
35
|
+
* }} [options] - Options to control middleware behavior. `effectiveRequestUrl` sets the effective request URL used for route matching, URL-based locale detection, redirects, and `getUrlOrigin()`.
|
|
21
36
|
* @returns {Promise<Response>}
|
|
22
37
|
*
|
|
23
38
|
* @example
|
|
24
39
|
* ```typescript
|
|
25
40
|
* // Basic usage in metaframeworks like NextJS, SvelteKit, Astro, Nuxt, etc.
|
|
26
41
|
* export const handle = async ({ event, resolve }) => {
|
|
27
|
-
* return
|
|
42
|
+
* return paraglideMiddleware(event.request, ({ request, locale }) => {
|
|
28
43
|
* // let the framework further resolve the request
|
|
29
44
|
* return resolve(request);
|
|
30
45
|
* });
|
|
@@ -35,7 +50,7 @@
|
|
|
35
50
|
* ```typescript
|
|
36
51
|
* // Usage in a framework like Express JS or Hono
|
|
37
52
|
* app.use(async (req, res, next) => {
|
|
38
|
-
* const result = await
|
|
53
|
+
* const result = await paraglideMiddleware(req, ({ request, locale }) => {
|
|
39
54
|
* // If a redirect happens this won't be called
|
|
40
55
|
* return next(request);
|
|
41
56
|
* });
|
|
@@ -44,25 +59,39 @@
|
|
|
44
59
|
*
|
|
45
60
|
* @example
|
|
46
61
|
* ```typescript
|
|
47
|
-
* // Usage
|
|
48
|
-
* //
|
|
49
|
-
* //
|
|
50
|
-
* //
|
|
62
|
+
* // Usage with frameworks that handle URL localization/delocalization themselves
|
|
63
|
+
* //
|
|
64
|
+
* // Some frameworks like TanStack Router handle URL localization and delocalization
|
|
65
|
+
* // themselves via their own rewrite APIs (e.g., `rewrite.input`/`rewrite.output`).
|
|
66
|
+
* //
|
|
67
|
+
* // When the framework handles this, the middleware's URL delocalization is not needed.
|
|
68
|
+
* // Using the modified `request` from the callback would cause a redirect loop because
|
|
69
|
+
* // both the middleware and the framework would attempt to delocalize the URL.
|
|
70
|
+
* //
|
|
71
|
+
* // Solution: Pass the original request to the handler instead of the modified one.
|
|
72
|
+
* // The middleware still handles locale detection, cookies, and AsyncLocalStorage context.
|
|
73
|
+
* //
|
|
74
|
+
* // ❌ WRONG - causes redirect loop when framework handles URL rewriting:
|
|
75
|
+
* // paraglideMiddleware(req, ({ request }) => handler.fetch(request))
|
|
76
|
+
* //
|
|
77
|
+
* // ✅ CORRECT - use original request when framework handles URL localization:
|
|
78
|
+
* // paraglideMiddleware(req, () => handler.fetch(req))
|
|
79
|
+
*
|
|
80
|
+
* * *
|
|
51
81
|
* export default {
|
|
52
|
-
* fetch:
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* }
|
|
59
|
-
* };
|
|
82
|
+
* fetch(req: Request): Promise<Response> {
|
|
83
|
+
* // TanStack Router handles URL rewriting via deLocalizeUrl/localizeUrl
|
|
84
|
+
* // so we pass the original `req` instead of the modified `request`
|
|
85
|
+
* return paraglideMiddleware(req, () => handler.fetch(req))
|
|
86
|
+
* },
|
|
87
|
+
* }
|
|
60
88
|
* ```
|
|
61
89
|
*/
|
|
62
90
|
export function paraglideMiddleware<T>(request: Request, resolve: (args: {
|
|
63
91
|
request: Request;
|
|
64
92
|
locale: import("./runtime.js").Locale;
|
|
65
|
-
}) => T | Promise<T>,
|
|
66
|
-
|
|
93
|
+
}) => T | Promise<T>, options?: {
|
|
94
|
+
effectiveRequestUrl?: string | URL | ((request: Request) => string | URL);
|
|
95
|
+
onRedirect?: (response: Response) => void;
|
|
67
96
|
}): Promise<Response>;
|
|
68
97
|
//# sourceMappingURL=server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/lib/external/paraglide/server.js"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/lib/external/paraglide/server.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwFG;AACH,oCAlEa,CAAC,WAEH,OAAO,WACP,CAAC,IAAI,EAAE;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,cAAc,EAAE,MAAM,CAAA;CAAE,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,YAKrF;IACN,mBAAmB,CAAC,EAAE,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC,OAAO,EAAE,OAAO,KAAK,MAAM,GAAG,GAAG,CAAC,CAAC;IAC1E,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAA;CAC1C,GACS,OAAO,CAAC,QAAQ,CAAC,CA0J7B"}
|
|
@@ -5,6 +5,12 @@ import * as runtime from "./runtime.js";
|
|
|
5
5
|
/**
|
|
6
6
|
* Server middleware that handles locale-based routing and request processing.
|
|
7
7
|
*
|
|
8
|
+
* Configure `disableAsyncLocalStorage` when generating Paraglide with
|
|
9
|
+
* `paraglideVitePlugin()` or `compile()`, not when calling
|
|
10
|
+
* `paraglideMiddleware()`. Keep AsyncLocalStorage enabled by default and
|
|
11
|
+
* only disable it for runtimes that lack `AsyncLocalStorage` support and
|
|
12
|
+
* guarantee request isolation.
|
|
13
|
+
*
|
|
8
14
|
* This middleware performs several key functions:
|
|
9
15
|
*
|
|
10
16
|
* 1. Determines the locale for the incoming request using configured strategies
|
|
@@ -17,18 +23,27 @@ import * as runtime from "./runtime.js";
|
|
|
17
23
|
* - If URL doesn't match the determined locale, redirects to localized URL (only for document requests)
|
|
18
24
|
* - De-localizes URLs before passing to server (e.g., `/fr/about` → `/about`)
|
|
19
25
|
*
|
|
26
|
+
* @see https://paraglidejs.com/middleware
|
|
27
|
+
*
|
|
20
28
|
* @template T - The return type of the resolve function
|
|
21
29
|
*
|
|
22
30
|
* @param {Request} request - The incoming request object
|
|
23
|
-
* @param {(args: { request: Request, locale: import("./runtime.js").Locale }) => T | Promise<T>} resolve - Function to handle the request
|
|
24
|
-
*
|
|
31
|
+
* @param {(args: { request: Request, locale: import("./runtime.js").Locale }) => T | Promise<T>} resolve - Function to handle the request. The callback receives:
|
|
32
|
+
* - `request`: A modified request with a delocalized URL when the URL strategy is used (e.g., `/fr/about` → `/about`).
|
|
33
|
+
* If your framework handles URL localization itself (e.g., TanStack Router's `rewrite` option), use the original
|
|
34
|
+
* request instead to avoid redirect loops.
|
|
35
|
+
* - `locale`: The determined locale for this request.
|
|
36
|
+
* @param {{
|
|
37
|
+
* effectiveRequestUrl?: string | URL | ((request: Request) => string | URL),
|
|
38
|
+
* onRedirect?: (response: Response) => void
|
|
39
|
+
* }} [options] - Options to control middleware behavior. `effectiveRequestUrl` sets the effective request URL used for route matching, URL-based locale detection, redirects, and `getUrlOrigin()`.
|
|
25
40
|
* @returns {Promise<Response>}
|
|
26
41
|
*
|
|
27
42
|
* @example
|
|
28
43
|
* ```typescript
|
|
29
44
|
* // Basic usage in metaframeworks like NextJS, SvelteKit, Astro, Nuxt, etc.
|
|
30
45
|
* export const handle = async ({ event, resolve }) => {
|
|
31
|
-
* return
|
|
46
|
+
* return paraglideMiddleware(event.request, ({ request, locale }) => {
|
|
32
47
|
* // let the framework further resolve the request
|
|
33
48
|
* return resolve(request);
|
|
34
49
|
* });
|
|
@@ -39,7 +54,7 @@ import * as runtime from "./runtime.js";
|
|
|
39
54
|
* ```typescript
|
|
40
55
|
* // Usage in a framework like Express JS or Hono
|
|
41
56
|
* app.use(async (req, res, next) => {
|
|
42
|
-
* const result = await
|
|
57
|
+
* const result = await paraglideMiddleware(req, ({ request, locale }) => {
|
|
43
58
|
* // If a redirect happens this won't be called
|
|
44
59
|
* return next(request);
|
|
45
60
|
* });
|
|
@@ -48,32 +63,61 @@ import * as runtime from "./runtime.js";
|
|
|
48
63
|
*
|
|
49
64
|
* @example
|
|
50
65
|
* ```typescript
|
|
51
|
-
* // Usage
|
|
52
|
-
* //
|
|
53
|
-
* //
|
|
54
|
-
* //
|
|
66
|
+
* // Usage with frameworks that handle URL localization/delocalization themselves
|
|
67
|
+
* //
|
|
68
|
+
* // Some frameworks like TanStack Router handle URL localization and delocalization
|
|
69
|
+
* // themselves via their own rewrite APIs (e.g., `rewrite.input`/`rewrite.output`).
|
|
70
|
+
* //
|
|
71
|
+
* // When the framework handles this, the middleware's URL delocalization is not needed.
|
|
72
|
+
* // Using the modified `request` from the callback would cause a redirect loop because
|
|
73
|
+
* // both the middleware and the framework would attempt to delocalize the URL.
|
|
74
|
+
* //
|
|
75
|
+
* // Solution: Pass the original request to the handler instead of the modified one.
|
|
76
|
+
* // The middleware still handles locale detection, cookies, and AsyncLocalStorage context.
|
|
77
|
+
* //
|
|
78
|
+
* // ❌ WRONG - causes redirect loop when framework handles URL rewriting:
|
|
79
|
+
* // paraglideMiddleware(req, ({ request }) => handler.fetch(request))
|
|
80
|
+
* //
|
|
81
|
+
* // ✅ CORRECT - use original request when framework handles URL localization:
|
|
82
|
+
* // paraglideMiddleware(req, () => handler.fetch(req))
|
|
83
|
+
*
|
|
84
|
+
* * *
|
|
55
85
|
* export default {
|
|
56
|
-
* fetch:
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* }
|
|
63
|
-
* };
|
|
86
|
+
* fetch(req: Request): Promise<Response> {
|
|
87
|
+
* // TanStack Router handles URL rewriting via deLocalizeUrl/localizeUrl
|
|
88
|
+
* // so we pass the original `req` instead of the modified `request`
|
|
89
|
+
* return paraglideMiddleware(req, () => handler.fetch(req))
|
|
90
|
+
* },
|
|
91
|
+
* }
|
|
64
92
|
* ```
|
|
65
93
|
*/
|
|
66
|
-
export async function paraglideMiddleware(request, resolve,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
94
|
+
export async function paraglideMiddleware(request, resolve, options) {
|
|
95
|
+
let requestAsyncLocalStorage = runtime.serverAsyncLocalStorage;
|
|
96
|
+
requestAsyncLocalStorage = runtime.getServerAsyncLocalStorage();
|
|
97
|
+
if (!runtime.disableAsyncLocalStorage && !requestAsyncLocalStorage) {
|
|
98
|
+
const { AsyncLocalStorage } = await import("async_hooks");
|
|
99
|
+
requestAsyncLocalStorage = runtime.getServerAsyncLocalStorage();
|
|
100
|
+
if (!requestAsyncLocalStorage) {
|
|
101
|
+
requestAsyncLocalStorage = new AsyncLocalStorage();
|
|
102
|
+
runtime.overwriteServerAsyncLocalStorage(requestAsyncLocalStorage);
|
|
103
|
+
}
|
|
70
104
|
}
|
|
71
|
-
|
|
72
|
-
|
|
105
|
+
if (!requestAsyncLocalStorage) {
|
|
106
|
+
requestAsyncLocalStorage = createMockAsyncLocalStorage();
|
|
107
|
+
runtime.overwriteServerAsyncLocalStorage(requestAsyncLocalStorage);
|
|
73
108
|
}
|
|
74
|
-
const
|
|
109
|
+
const url = resolveMiddlewareUrl(request, options?.effectiveRequestUrl);
|
|
110
|
+
const origin = url.origin;
|
|
111
|
+
if (runtime.isExcludedByRouteStrategy(url.href)) {
|
|
112
|
+
const locale = runtime.baseLocale;
|
|
113
|
+
const newRequest = cloneRequestWithFallback(request, url);
|
|
114
|
+
/** @type {Set<string>} */
|
|
115
|
+
const messageCalls = new Set();
|
|
116
|
+
return /** @type {Response} */ (await requestAsyncLocalStorage?.run({ locale, origin, messageCalls }, () => resolve({ locale, request: newRequest })));
|
|
117
|
+
}
|
|
118
|
+
const strategy = runtime.getStrategyForUrl(url.href);
|
|
119
|
+
const decision = await runtime.shouldRedirect({ request, effectiveRequestUrl: url });
|
|
75
120
|
const locale = decision.locale;
|
|
76
|
-
const origin = new URL(request.url).origin;
|
|
77
121
|
// if the client makes a request to a URL that doesn't match
|
|
78
122
|
// the localizedUrl, redirect the client to the localized URL
|
|
79
123
|
if (request.headers.get("Sec-Fetch-Dest") === "document" &&
|
|
@@ -82,7 +126,7 @@ export async function paraglideMiddleware(request, resolve, callbacks) {
|
|
|
82
126
|
// Create headers object with Vary header if preferredLanguage strategy is used
|
|
83
127
|
/** @type {Record<string, string>} */
|
|
84
128
|
const headers = {};
|
|
85
|
-
if (
|
|
129
|
+
if (strategy.includes("preferredLanguage")) {
|
|
86
130
|
headers["Vary"] = "Accept-Language";
|
|
87
131
|
}
|
|
88
132
|
const response = new Response(null, {
|
|
@@ -92,7 +136,7 @@ export async function paraglideMiddleware(request, resolve, callbacks) {
|
|
|
92
136
|
...headers,
|
|
93
137
|
},
|
|
94
138
|
});
|
|
95
|
-
|
|
139
|
+
options?.onRedirect?.(response);
|
|
96
140
|
return response;
|
|
97
141
|
}
|
|
98
142
|
// If the strategy includes "url", we need to de-localize the URL
|
|
@@ -101,15 +145,17 @@ export async function paraglideMiddleware(request, resolve, callbacks) {
|
|
|
101
145
|
// The middleware is responsible for mapping a localized URL to the
|
|
102
146
|
// de-localized URL e.g. `/en/about` to `/about`. Otherwise,
|
|
103
147
|
// the server can't render the correct page.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
148
|
+
let newRequest;
|
|
149
|
+
if (strategy.includes("url")) {
|
|
150
|
+
newRequest = cloneRequestWithFallback(request, runtime.deLocalizeUrl(url));
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
newRequest = cloneRequestWithFallback(request, url);
|
|
154
|
+
}
|
|
109
155
|
// the message functions that have been called in this request
|
|
110
156
|
/** @type {Set<string>} */
|
|
111
157
|
const messageCalls = new Set();
|
|
112
|
-
const response = await
|
|
158
|
+
const response = await requestAsyncLocalStorage?.run({ locale, origin, messageCalls }, () => resolve({ locale, request: newRequest }));
|
|
113
159
|
// Only modify HTML responses
|
|
114
160
|
if (runtime.experimentalMiddlewareLocaleSplitting &&
|
|
115
161
|
response.headers.get("Content-Type")?.includes("html")) {
|
|
@@ -122,7 +168,16 @@ export async function paraglideMiddleware(request, resolve, callbacks) {
|
|
|
122
168
|
/** @type {[string, import("./runtime.js").Locale]} */ (messageCall.split(":"));
|
|
123
169
|
messages.push(`${id}: ${compiledBundles[id]?.[locale]}`);
|
|
124
170
|
}
|
|
125
|
-
|
|
171
|
+
// Prevent translated content from terminating the inline script tag.
|
|
172
|
+
const escapedMessages = messages
|
|
173
|
+
.join(",")
|
|
174
|
+
.replace(/<\/(script)/gi, "<\\/$1");
|
|
175
|
+
// Reuse the request's CSP nonce (if any) so the injected script is allowed under a strict CSP
|
|
176
|
+
const nonce = response.headers
|
|
177
|
+
.get("Content-Security-Policy")
|
|
178
|
+
?.match(/'nonce-([\w+/=-]+)'/)?.[1];
|
|
179
|
+
const nonceAttr = nonce ? `nonce="${nonce}"` : "";
|
|
180
|
+
const script = `<script ${nonceAttr}>globalThis.__paraglide = globalThis.__paraglide ?? {}; globalThis.__paraglide.ssr = { ${escapedMessages} }</script>`;
|
|
126
181
|
// Insert the script before the closing head tag
|
|
127
182
|
const newBody = body.replace("</head>", `${script}</head>`);
|
|
128
183
|
// Create a new response with the modified body
|
|
@@ -137,13 +192,71 @@ export async function paraglideMiddleware(request, resolve, callbacks) {
|
|
|
137
192
|
}
|
|
138
193
|
return response;
|
|
139
194
|
}
|
|
195
|
+
/**
|
|
196
|
+
* @param {Request} request
|
|
197
|
+
* @param {string | URL | ((request: Request) => string | URL) | undefined} effectiveRequestUrl
|
|
198
|
+
* @returns {URL}
|
|
199
|
+
*/
|
|
200
|
+
function resolveMiddlewareUrl(request, effectiveRequestUrl) {
|
|
201
|
+
if (typeof effectiveRequestUrl === "function") {
|
|
202
|
+
return new URL(effectiveRequestUrl(request), request.url);
|
|
203
|
+
}
|
|
204
|
+
if (typeof effectiveRequestUrl === "string" || effectiveRequestUrl instanceof URL) {
|
|
205
|
+
return new URL(effectiveRequestUrl, request.url);
|
|
206
|
+
}
|
|
207
|
+
return new URL(request.url);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Some metaframeworks (NextJS) require a new Request object.
|
|
211
|
+
* https://github.com/opral/inlang-paraglide-js/issues/411
|
|
212
|
+
*
|
|
213
|
+
* However, some frameworks (TanStack Start 1.143+) use custom Request
|
|
214
|
+
* implementations that cannot be cloned with `new Request(request)`.
|
|
215
|
+
* https://github.com/opral/paraglide-js/issues/573
|
|
216
|
+
*
|
|
217
|
+
* Effective request URL overrides behind proxies:
|
|
218
|
+
* https://github.com/opral/paraglide-js/issues/652
|
|
219
|
+
*
|
|
220
|
+
* @param {Request} request
|
|
221
|
+
* @param {string | URL} [url]
|
|
222
|
+
* @returns {Request}
|
|
223
|
+
*/
|
|
224
|
+
function cloneRequestWithFallback(request, url = request.url) {
|
|
225
|
+
const targetUrl = typeof url === "string" ? url : url.href;
|
|
226
|
+
if (targetUrl === request.url) {
|
|
227
|
+
try {
|
|
228
|
+
// Clone first so building a new Request does not consume the original body stream.
|
|
229
|
+
return new Request(request.clone());
|
|
230
|
+
}
|
|
231
|
+
catch {
|
|
232
|
+
try {
|
|
233
|
+
return new Request(request);
|
|
234
|
+
}
|
|
235
|
+
catch {
|
|
236
|
+
return request;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
try {
|
|
241
|
+
// Clone first so building a new Request does not consume the original body stream.
|
|
242
|
+
return new Request(targetUrl, request.clone());
|
|
243
|
+
}
|
|
244
|
+
catch {
|
|
245
|
+
try {
|
|
246
|
+
return new Request(targetUrl, request);
|
|
247
|
+
}
|
|
248
|
+
catch {
|
|
249
|
+
return request;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
140
253
|
/**
|
|
141
254
|
* Creates a mock AsyncLocalStorage implementation for environments where
|
|
142
255
|
* native AsyncLocalStorage is not available or disabled.
|
|
143
256
|
*
|
|
144
257
|
* This mock implementation mimics the behavior of the native AsyncLocalStorage
|
|
145
|
-
* but doesn't require the async_hooks module. It's
|
|
146
|
-
*
|
|
258
|
+
* but doesn't require the async_hooks module. It's used as a fallback when
|
|
259
|
+
* the runtime does not expose AsyncLocalStorage or when it has been disabled.
|
|
147
260
|
*
|
|
148
261
|
* @returns {import("./runtime.js").ParaglideAsyncLocalStorage}
|
|
149
262
|
*/
|
|
@@ -165,6 +278,8 @@ function createMockAsyncLocalStorage() {
|
|
|
165
278
|
},
|
|
166
279
|
};
|
|
167
280
|
}
|
|
281
|
+
// Used in generated server.js when async local storage is disabled.
|
|
282
|
+
void createMockAsyncLocalStorage;
|
|
168
283
|
/**
|
|
169
284
|
* The compiled messages for the server middleware.
|
|
170
285
|
*
|
|
@@ -3,6 +3,6 @@ export declare const getPhotoDetails: import("@sveltejs/kit").RemoteQueryFunctio
|
|
|
3
3
|
description: any;
|
|
4
4
|
tags: string[];
|
|
5
5
|
createdAt: any;
|
|
6
|
-
} | null>;
|
|
7
|
-
export declare const getPhotoCollectionMeta: import("@sveltejs/kit").RemoteQueryFunction<string, any>;
|
|
6
|
+
} | null, string>;
|
|
7
|
+
export declare const getPhotoCollectionMeta: import("@sveltejs/kit").RemoteQueryFunction<string, any, string>;
|
|
8
8
|
//# sourceMappingURL=externalImages.remote.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"externalImages.remote.d.ts","sourceRoot":"","sources":["../../../../src/lib/modules/parsnip/external-images/externalImages.remote.ts"],"names":[],"mappings":"AAiCA,eAAO,MAAM,eAAe;;;UARG,MAAM,EAAE;;
|
|
1
|
+
{"version":3,"file":"externalImages.remote.d.ts","sourceRoot":"","sources":["../../../../src/lib/modules/parsnip/external-images/externalImages.remote.ts"],"names":[],"mappings":"AAiCA,eAAO,MAAM,eAAe;;;UARG,MAAM,EAAE;;iBAQ0B,CAAC;AAElE,eAAO,MAAM,sBAAsB,kEAajC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turnipxenon/pineapple",
|
|
3
3
|
"description": "personal package for base styling for other personal projects",
|
|
4
|
-
"version": "5.3.
|
|
4
|
+
"version": "5.3.17",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@commitlint/cli": "^19.8.1",
|
|
7
7
|
"@commitlint/config-conventional": "^19.8.1",
|
|
8
8
|
"@eslint/compat": "^1.4.1",
|
|
9
|
-
"@eslint/js": "^9.39.
|
|
10
|
-
"@inlang/paraglide-js": "
|
|
9
|
+
"@eslint/js": "^9.39.5",
|
|
10
|
+
"@inlang/paraglide-js": "^2.23.2",
|
|
11
11
|
"@prisma/client": "^5.22.0",
|
|
12
|
-
"@sveltejs/adapter-cloudflare": "^7.2.
|
|
13
|
-
"@sveltejs/kit": "^2.
|
|
14
|
-
"@sveltejs/package": "^2.5.
|
|
12
|
+
"@sveltejs/adapter-cloudflare": "^7.2.9",
|
|
13
|
+
"@sveltejs/kit": "^2.70.2",
|
|
14
|
+
"@sveltejs/package": "^2.5.8",
|
|
15
15
|
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
|
16
16
|
"@types/mdast": "^4.0.4",
|
|
17
|
-
"@types/node": "^20.19.
|
|
18
|
-
"eslint": "^9.39.
|
|
17
|
+
"@types/node": "^20.19.43",
|
|
18
|
+
"eslint": "^9.39.5",
|
|
19
19
|
"eslint-config-prettier": "^10.1.8",
|
|
20
|
-
"eslint-plugin-svelte": "^3.
|
|
20
|
+
"eslint-plugin-svelte": "^3.23.0",
|
|
21
21
|
"globals": "^16.5.0",
|
|
22
|
-
"highlight.js": "^11.
|
|
22
|
+
"highlight.js": "^11.12.0",
|
|
23
23
|
"htmlparser2": "^9.1.0",
|
|
24
24
|
"husky": "^9.1.7",
|
|
25
25
|
"mdast-util-from-markdown": "^1.3.1",
|
|
26
26
|
"node-html-parser": "^6.1.13",
|
|
27
|
-
"prettier": "^3.
|
|
28
|
-
"prettier-plugin-svelte": "^3.
|
|
27
|
+
"prettier": "^3.9.6",
|
|
28
|
+
"prettier-plugin-svelte": "^3.5.2",
|
|
29
29
|
"prisma": "^5.22.0",
|
|
30
|
-
"publint": "^0.3.
|
|
31
|
-
"sass": "^1.
|
|
30
|
+
"publint": "^0.3.23",
|
|
31
|
+
"sass": "^1.102.0",
|
|
32
32
|
"string-width": "^7.2.0",
|
|
33
|
-
"svelte": "^5.
|
|
34
|
-
"svelte-check": "^4.
|
|
35
|
-
"svelte2tsx": "^0.7.
|
|
33
|
+
"svelte": "^5.56.9",
|
|
34
|
+
"svelte-check": "^4.7.6",
|
|
35
|
+
"svelte2tsx": "^0.7.61",
|
|
36
36
|
"ts-node": "^10.9.2",
|
|
37
37
|
"tslib": "^2.8.1",
|
|
38
38
|
"typescript": "^5.9.3",
|
|
39
|
-
"typescript-eslint": "^8.
|
|
40
|
-
"vite": "^7.3.
|
|
41
|
-
"vitest": "^4.
|
|
42
|
-
"wrangler": "4.
|
|
39
|
+
"typescript-eslint": "^8.67.0",
|
|
40
|
+
"vite": "^7.3.6",
|
|
41
|
+
"vitest": "^4.1.10",
|
|
42
|
+
"wrangler": "^4.123.0"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@shikijs/transformers": "^3.
|
|
45
|
+
"@shikijs/transformers": "^3.23.0",
|
|
46
46
|
"melt": "^0.44.0",
|
|
47
47
|
"mode-watcher": "^0.5.1",
|
|
48
|
-
"shiki": "^3.
|
|
48
|
+
"shiki": "^3.23.0",
|
|
49
49
|
"shiki-transformer-copy-button": "0.0.3",
|
|
50
50
|
"svelte-modals": "^2.0.1",
|
|
51
|
-
"valibot": "^1.2
|
|
51
|
+
"valibot": "^1.4.2"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"svelte": "5.
|
|
54
|
+
"svelte": "^5.55.7",
|
|
55
55
|
"svelte-modals": "^2.0.1"
|
|
56
56
|
},
|
|
57
57
|
"exports": {
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"scripts": {
|
|
127
127
|
"dev": "vite dev",
|
|
128
128
|
"build": "vite build",
|
|
129
|
-
"package": "svelte-kit sync && svelte-package && publint",
|
|
129
|
+
"package": "svelte-kit sync && svelte-package && node scripts/strip-dist-gitignore.mjs && publint",
|
|
130
130
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
131
131
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
132
132
|
"check-baseline": "bash scripts/check-baseline.sh",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../../../src/lib/external/paraglide/messages/en.js"],"names":[],"mappings":"AAGA,8BAA0C,CAAC,MAAM,EAAE;IAAE,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;CAAE,KAAK,MAAM,CAE9F;AAEF,uBAAmC,CAAC,MAAM,EAAE,EAAE,KAAK,MAAM,CAEvD"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export const example_message = /** @type {(inputs: { username: NonNullable<unknown> }) => string} */ (i) => {
|
|
5
|
-
return `Hello world ${i.username}`
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export const settings = /** @type {(inputs: {}) => string} */ () => {
|
|
9
|
-
return `Settings`
|
|
10
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fr.d.ts","sourceRoot":"","sources":["../../../../src/lib/external/paraglide/messages/fr.js"],"names":[],"mappings":"AAGA,8BAA0C,CAAC,MAAM,EAAE;IAAE,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;CAAE,KAAK,MAAM,CAE9F;AAEF,uBAAmC,CAAC,MAAM,EAAE,EAAE,KAAK,MAAM,CAEvD"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export const example_message = /** @type {(inputs: { username: NonNullable<unknown> }) => string} */ (i) => {
|
|
5
|
-
return `Bonjour ${i.username}`
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export const settings = /** @type {(inputs: {}) => string} */ () => {
|
|
9
|
-
return `Paramètres`
|
|
10
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tl.d.ts","sourceRoot":"","sources":["../../../../src/lib/external/paraglide/messages/tl.js"],"names":[],"mappings":"AAGA,8BAA0C,CAAC,MAAM,EAAE;IAAE,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;CAAE,KAAK,MAAM,CAE9F"}
|