vinext 0.0.0 → 0.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/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/build/static-export.d.ts +78 -0
- package/dist/build/static-export.d.ts.map +1 -0
- package/dist/build/static-export.js +553 -0
- package/dist/build/static-export.js.map +1 -0
- package/dist/check.d.ts +52 -0
- package/dist/check.d.ts.map +1 -0
- package/dist/check.js +483 -0
- package/dist/check.js.map +1 -0
- package/dist/cli.d.ts +15 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +565 -0
- package/dist/cli.js.map +1 -0
- package/dist/client/entry.d.ts +2 -0
- package/dist/client/entry.d.ts.map +1 -0
- package/dist/client/entry.js +85 -0
- package/dist/client/entry.js.map +1 -0
- package/dist/cloudflare/index.d.ts +8 -0
- package/dist/cloudflare/index.d.ts.map +1 -0
- package/dist/cloudflare/index.js +8 -0
- package/dist/cloudflare/index.js.map +1 -0
- package/dist/cloudflare/kv-cache-handler.d.ts +68 -0
- package/dist/cloudflare/kv-cache-handler.d.ts.map +1 -0
- package/dist/cloudflare/kv-cache-handler.js +304 -0
- package/dist/cloudflare/kv-cache-handler.js.map +1 -0
- package/dist/cloudflare/tpr.d.ts +78 -0
- package/dist/cloudflare/tpr.d.ts.map +1 -0
- package/dist/cloudflare/tpr.js +672 -0
- package/dist/cloudflare/tpr.js.map +1 -0
- package/dist/config/config-matchers.d.ts +106 -0
- package/dist/config/config-matchers.d.ts.map +1 -0
- package/dist/config/config-matchers.js +499 -0
- package/dist/config/config-matchers.js.map +1 -0
- package/dist/config/next-config.d.ts +153 -0
- package/dist/config/next-config.d.ts.map +1 -0
- package/dist/config/next-config.js +274 -0
- package/dist/config/next-config.js.map +1 -0
- package/dist/deploy.d.ts +87 -0
- package/dist/deploy.d.ts.map +1 -0
- package/dist/deploy.js +644 -0
- package/dist/deploy.js.map +1 -0
- package/dist/index.d.ts +156 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3296 -0
- package/dist/index.js.map +1 -0
- package/dist/init.d.ts +55 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +201 -0
- package/dist/init.js.map +1 -0
- package/dist/routing/app-router.d.ts +96 -0
- package/dist/routing/app-router.d.ts.map +1 -0
- package/dist/routing/app-router.js +815 -0
- package/dist/routing/app-router.js.map +1 -0
- package/dist/routing/pages-router.d.ts +52 -0
- package/dist/routing/pages-router.d.ts.map +1 -0
- package/dist/routing/pages-router.js +239 -0
- package/dist/routing/pages-router.js.map +1 -0
- package/dist/server/api-handler.d.ts +18 -0
- package/dist/server/api-handler.d.ts.map +1 -0
- package/dist/server/api-handler.js +169 -0
- package/dist/server/api-handler.js.map +1 -0
- package/dist/server/app-dev-server.d.ts +42 -0
- package/dist/server/app-dev-server.d.ts.map +1 -0
- package/dist/server/app-dev-server.js +2718 -0
- package/dist/server/app-dev-server.js.map +1 -0
- package/dist/server/app-router-entry.d.ts +18 -0
- package/dist/server/app-router-entry.d.ts.map +1 -0
- package/dist/server/app-router-entry.js +34 -0
- package/dist/server/app-router-entry.js.map +1 -0
- package/dist/server/dev-server.d.ts +40 -0
- package/dist/server/dev-server.d.ts.map +1 -0
- package/dist/server/dev-server.js +758 -0
- package/dist/server/dev-server.js.map +1 -0
- package/dist/server/html.d.ts +22 -0
- package/dist/server/html.d.ts.map +1 -0
- package/dist/server/html.js +29 -0
- package/dist/server/html.js.map +1 -0
- package/dist/server/image-optimization.d.ts +56 -0
- package/dist/server/image-optimization.d.ts.map +1 -0
- package/dist/server/image-optimization.js +103 -0
- package/dist/server/image-optimization.js.map +1 -0
- package/dist/server/instrumentation.d.ts +68 -0
- package/dist/server/instrumentation.d.ts.map +1 -0
- package/dist/server/instrumentation.js +90 -0
- package/dist/server/instrumentation.js.map +1 -0
- package/dist/server/isr-cache.d.ts +61 -0
- package/dist/server/isr-cache.d.ts.map +1 -0
- package/dist/server/isr-cache.js +134 -0
- package/dist/server/isr-cache.js.map +1 -0
- package/dist/server/metadata-routes.d.ts +103 -0
- package/dist/server/metadata-routes.d.ts.map +1 -0
- package/dist/server/metadata-routes.js +270 -0
- package/dist/server/metadata-routes.js.map +1 -0
- package/dist/server/middleware.d.ts +77 -0
- package/dist/server/middleware.d.ts.map +1 -0
- package/dist/server/middleware.js +228 -0
- package/dist/server/middleware.js.map +1 -0
- package/dist/server/prod-server.d.ts +78 -0
- package/dist/server/prod-server.d.ts.map +1 -0
- package/dist/server/prod-server.js +712 -0
- package/dist/server/prod-server.js.map +1 -0
- package/dist/shims/amp.d.ts +17 -0
- package/dist/shims/amp.d.ts.map +1 -0
- package/dist/shims/amp.js +21 -0
- package/dist/shims/amp.js.map +1 -0
- package/dist/shims/app.d.ts +12 -0
- package/dist/shims/app.d.ts.map +1 -0
- package/dist/shims/app.js +2 -0
- package/dist/shims/app.js.map +1 -0
- package/dist/shims/cache-runtime.d.ts +68 -0
- package/dist/shims/cache-runtime.d.ts.map +1 -0
- package/dist/shims/cache-runtime.js +437 -0
- package/dist/shims/cache-runtime.js.map +1 -0
- package/dist/shims/cache.d.ts +243 -0
- package/dist/shims/cache.d.ts.map +1 -0
- package/dist/shims/cache.js +415 -0
- package/dist/shims/cache.js.map +1 -0
- package/dist/shims/client-only.d.ts +18 -0
- package/dist/shims/client-only.d.ts.map +1 -0
- package/dist/shims/client-only.js +18 -0
- package/dist/shims/client-only.js.map +1 -0
- package/dist/shims/config.d.ts +27 -0
- package/dist/shims/config.d.ts.map +1 -0
- package/dist/shims/config.js +30 -0
- package/dist/shims/config.js.map +1 -0
- package/dist/shims/constants.d.ts +13 -0
- package/dist/shims/constants.d.ts.map +1 -0
- package/dist/shims/constants.js +13 -0
- package/dist/shims/constants.js.map +1 -0
- package/dist/shims/document.d.ts +33 -0
- package/dist/shims/document.d.ts.map +1 -0
- package/dist/shims/document.js +32 -0
- package/dist/shims/document.js.map +1 -0
- package/dist/shims/dynamic.d.ts +33 -0
- package/dist/shims/dynamic.d.ts.map +1 -0
- package/dist/shims/dynamic.js +149 -0
- package/dist/shims/dynamic.js.map +1 -0
- package/dist/shims/error-boundary.d.ts +33 -0
- package/dist/shims/error-boundary.d.ts.map +1 -0
- package/dist/shims/error-boundary.js +88 -0
- package/dist/shims/error-boundary.js.map +1 -0
- package/dist/shims/error.d.ts +16 -0
- package/dist/shims/error.d.ts.map +1 -0
- package/dist/shims/error.js +45 -0
- package/dist/shims/error.js.map +1 -0
- package/dist/shims/fetch-cache.d.ts +61 -0
- package/dist/shims/fetch-cache.d.ts.map +1 -0
- package/dist/shims/fetch-cache.js +307 -0
- package/dist/shims/fetch-cache.js.map +1 -0
- package/dist/shims/font-google.d.ts +122 -0
- package/dist/shims/font-google.d.ts.map +1 -0
- package/dist/shims/font-google.js +387 -0
- package/dist/shims/font-google.js.map +1 -0
- package/dist/shims/font-local.d.ts +61 -0
- package/dist/shims/font-local.d.ts.map +1 -0
- package/dist/shims/font-local.js +303 -0
- package/dist/shims/font-local.js.map +1 -0
- package/dist/shims/form.d.ts +30 -0
- package/dist/shims/form.d.ts.map +1 -0
- package/dist/shims/form.js +78 -0
- package/dist/shims/form.js.map +1 -0
- package/dist/shims/head-state.d.ts +11 -0
- package/dist/shims/head-state.d.ts.map +1 -0
- package/dist/shims/head-state.js +47 -0
- package/dist/shims/head-state.js.map +1 -0
- package/dist/shims/head.d.ts +28 -0
- package/dist/shims/head.d.ts.map +1 -0
- package/dist/shims/head.js +148 -0
- package/dist/shims/head.js.map +1 -0
- package/dist/shims/headers.d.ts +150 -0
- package/dist/shims/headers.d.ts.map +1 -0
- package/dist/shims/headers.js +412 -0
- package/dist/shims/headers.js.map +1 -0
- package/dist/shims/image-config.d.ts +30 -0
- package/dist/shims/image-config.d.ts.map +1 -0
- package/dist/shims/image-config.js +91 -0
- package/dist/shims/image-config.js.map +1 -0
- package/dist/shims/image.d.ts +63 -0
- package/dist/shims/image.d.ts.map +1 -0
- package/dist/shims/image.js +284 -0
- package/dist/shims/image.js.map +1 -0
- package/dist/shims/internal/api-utils.d.ts +12 -0
- package/dist/shims/internal/api-utils.d.ts.map +1 -0
- package/dist/shims/internal/api-utils.js +7 -0
- package/dist/shims/internal/api-utils.js.map +1 -0
- package/dist/shims/internal/app-router-context.d.ts +21 -0
- package/dist/shims/internal/app-router-context.d.ts.map +1 -0
- package/dist/shims/internal/app-router-context.js +15 -0
- package/dist/shims/internal/app-router-context.js.map +1 -0
- package/dist/shims/internal/cookies.d.ts +9 -0
- package/dist/shims/internal/cookies.d.ts.map +1 -0
- package/dist/shims/internal/cookies.js +9 -0
- package/dist/shims/internal/cookies.js.map +1 -0
- package/dist/shims/internal/router-context.d.ts +2 -0
- package/dist/shims/internal/router-context.d.ts.map +1 -0
- package/dist/shims/internal/router-context.js +9 -0
- package/dist/shims/internal/router-context.js.map +1 -0
- package/dist/shims/internal/utils.d.ts +48 -0
- package/dist/shims/internal/utils.d.ts.map +1 -0
- package/dist/shims/internal/utils.js +35 -0
- package/dist/shims/internal/utils.js.map +1 -0
- package/dist/shims/internal/work-unit-async-storage.d.ts +12 -0
- package/dist/shims/internal/work-unit-async-storage.d.ts.map +1 -0
- package/dist/shims/internal/work-unit-async-storage.js +13 -0
- package/dist/shims/internal/work-unit-async-storage.js.map +1 -0
- package/dist/shims/layout-segment-context.d.ts +21 -0
- package/dist/shims/layout-segment-context.d.ts.map +1 -0
- package/dist/shims/layout-segment-context.js +27 -0
- package/dist/shims/layout-segment-context.js.map +1 -0
- package/dist/shims/legacy-image.d.ts +52 -0
- package/dist/shims/legacy-image.d.ts.map +1 -0
- package/dist/shims/legacy-image.js +46 -0
- package/dist/shims/legacy-image.js.map +1 -0
- package/dist/shims/link.d.ts +48 -0
- package/dist/shims/link.d.ts.map +1 -0
- package/dist/shims/link.js +395 -0
- package/dist/shims/link.js.map +1 -0
- package/dist/shims/metadata.d.ts +184 -0
- package/dist/shims/metadata.d.ts.map +1 -0
- package/dist/shims/metadata.js +472 -0
- package/dist/shims/metadata.js.map +1 -0
- package/dist/shims/navigation-state.d.ts +14 -0
- package/dist/shims/navigation-state.d.ts.map +1 -0
- package/dist/shims/navigation-state.js +77 -0
- package/dist/shims/navigation-state.js.map +1 -0
- package/dist/shims/navigation.d.ts +201 -0
- package/dist/shims/navigation.d.ts.map +1 -0
- package/dist/shims/navigation.js +672 -0
- package/dist/shims/navigation.js.map +1 -0
- package/dist/shims/og.d.ts +20 -0
- package/dist/shims/og.d.ts.map +1 -0
- package/dist/shims/og.js +19 -0
- package/dist/shims/og.js.map +1 -0
- package/dist/shims/router-state.d.ts +11 -0
- package/dist/shims/router-state.d.ts.map +1 -0
- package/dist/shims/router-state.js +56 -0
- package/dist/shims/router-state.js.map +1 -0
- package/dist/shims/router.d.ts +103 -0
- package/dist/shims/router.d.ts.map +1 -0
- package/dist/shims/router.js +536 -0
- package/dist/shims/router.js.map +1 -0
- package/dist/shims/script.d.ts +58 -0
- package/dist/shims/script.d.ts.map +1 -0
- package/dist/shims/script.js +163 -0
- package/dist/shims/script.js.map +1 -0
- package/dist/shims/server-only.d.ts +19 -0
- package/dist/shims/server-only.d.ts.map +1 -0
- package/dist/shims/server-only.js +19 -0
- package/dist/shims/server-only.js.map +1 -0
- package/dist/shims/server.d.ts +178 -0
- package/dist/shims/server.d.ts.map +1 -0
- package/dist/shims/server.js +377 -0
- package/dist/shims/server.js.map +1 -0
- package/dist/shims/web-vitals.d.ts +24 -0
- package/dist/shims/web-vitals.d.ts.map +1 -0
- package/dist/shims/web-vitals.js +17 -0
- package/dist/shims/web-vitals.js.map +1 -0
- package/dist/utils/hash.d.ts +6 -0
- package/dist/utils/hash.d.ts.map +1 -0
- package/dist/utils/hash.js +20 -0
- package/dist/utils/hash.js.map +1 -0
- package/dist/utils/project.d.ts +36 -0
- package/dist/utils/project.d.ts.map +1 -0
- package/dist/utils/project.js +112 -0
- package/dist/utils/project.js.map +1 -0
- package/dist/utils/query.d.ts +10 -0
- package/dist/utils/query.d.ts.map +1 -0
- package/dist/utils/query.js +27 -0
- package/dist/utils/query.js.map +1 -0
- package/package.json +65 -7
- package/index.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../src/shims/image.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAqB,MAAM,OAAO,CAAC;AAI1C,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAyDD,UAAU,UAAU;IAClB,GAAG,EAAE,MAAM,GAAG,eAAe,CAAC;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAC;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,MAAM,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IACnD,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IACpD,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IACpD,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AA0CD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,MAAW,GAAG,MAAM,CAE7F;AAeD,QAAA,MAAM,KAAK,qFAoKT,CAAC;AAEH;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG;IAChD,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;CAClD,CA4FA;AAED,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* next/image shim
|
|
4
|
+
*
|
|
5
|
+
* Translates Next.js Image props to @unpic/react Image component.
|
|
6
|
+
* @unpic/react auto-detects CDN from URL and uses native transforms.
|
|
7
|
+
* For local images (relative paths), routes through `/_vinext/image`
|
|
8
|
+
* for server-side optimization (resize, format negotiation, quality).
|
|
9
|
+
*
|
|
10
|
+
* Remote images are validated against `images.remotePatterns` and
|
|
11
|
+
* `images.domains` from next.config.js. Unmatched URLs are blocked
|
|
12
|
+
* in production and warn in development, matching Next.js behavior.
|
|
13
|
+
*/
|
|
14
|
+
import { forwardRef } from "react";
|
|
15
|
+
import { Image as UnpicImage } from "@unpic/react";
|
|
16
|
+
import { hasRemoteMatch } from "./image-config.js";
|
|
17
|
+
/**
|
|
18
|
+
* Image config injected at build time via Vite define.
|
|
19
|
+
* Serialized as JSON — parsed once at module level.
|
|
20
|
+
*/
|
|
21
|
+
const __imageRemotePatterns = (() => {
|
|
22
|
+
try {
|
|
23
|
+
return JSON.parse(process.env.__VINEXT_IMAGE_REMOTE_PATTERNS ?? "[]");
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
})();
|
|
29
|
+
const __imageDomains = (() => {
|
|
30
|
+
try {
|
|
31
|
+
return JSON.parse(process.env.__VINEXT_IMAGE_DOMAINS ?? "[]");
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return [];
|
|
35
|
+
}
|
|
36
|
+
})();
|
|
37
|
+
const __hasImageConfig = __imageRemotePatterns.length > 0 || __imageDomains.length > 0;
|
|
38
|
+
const __isDev = process.env.NODE_ENV !== "production";
|
|
39
|
+
/**
|
|
40
|
+
* Validate that a remote URL is allowed by the configured remote patterns.
|
|
41
|
+
* Returns true if the URL is allowed, false otherwise.
|
|
42
|
+
*
|
|
43
|
+
* When no remotePatterns/domains are configured, all remote URLs are allowed
|
|
44
|
+
* (backwards-compatible — user hasn't opted into restriction).
|
|
45
|
+
*
|
|
46
|
+
* When patterns ARE configured, only matching URLs are allowed.
|
|
47
|
+
* In development, non-matching URLs produce a console warning.
|
|
48
|
+
* In production, non-matching URLs are blocked (src replaced with empty string).
|
|
49
|
+
*/
|
|
50
|
+
function validateRemoteUrl(src) {
|
|
51
|
+
if (!__hasImageConfig) {
|
|
52
|
+
// No image config — allow everything (backwards-compatible)
|
|
53
|
+
return { allowed: true };
|
|
54
|
+
}
|
|
55
|
+
let url;
|
|
56
|
+
try {
|
|
57
|
+
url = new URL(src, "http://n");
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return { allowed: false, reason: `Invalid URL: ${src}` };
|
|
61
|
+
}
|
|
62
|
+
if (hasRemoteMatch(__imageDomains, __imageRemotePatterns, url)) {
|
|
63
|
+
return { allowed: true };
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
allowed: false,
|
|
67
|
+
reason: `Image URL "${src}" is not configured in images.remotePatterns or images.domains in next.config.js. See: https://nextjs.org/docs/messages/next-image-unconfigured-host`,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Sanitize a blurDataURL to prevent CSS injection.
|
|
72
|
+
*
|
|
73
|
+
* A crafted data URL containing `)` can break out of the `url()` CSS function,
|
|
74
|
+
* allowing injection of arbitrary CSS properties or rules. Characters like `{`,
|
|
75
|
+
* `}`, and `\` can also assist in crafting injection payloads.
|
|
76
|
+
*
|
|
77
|
+
* This validates the URL starts with `data:image/` and rejects characters that
|
|
78
|
+
* could escape the `url()` context. Semicolons are allowed since they're part
|
|
79
|
+
* of valid data URLs (`data:image/png;base64,...`) and harmless inside `url()`.
|
|
80
|
+
*
|
|
81
|
+
* Returns undefined for invalid URLs, which causes the blur placeholder to be
|
|
82
|
+
* skipped gracefully.
|
|
83
|
+
*/
|
|
84
|
+
function sanitizeBlurDataURL(url) {
|
|
85
|
+
// Must be a data: image URL
|
|
86
|
+
if (!url.startsWith("data:image/"))
|
|
87
|
+
return undefined;
|
|
88
|
+
// Reject characters that can break out of CSS url():
|
|
89
|
+
// ) - closes url()
|
|
90
|
+
// ( - could open nested functions
|
|
91
|
+
// { } - CSS rule boundaries
|
|
92
|
+
// \ - CSS escape sequences
|
|
93
|
+
// newlines - break CSS parsing
|
|
94
|
+
if (/[)(}{\\'"\n\r]/.test(url))
|
|
95
|
+
return undefined;
|
|
96
|
+
return url;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Determine if a src is a remote URL (CDN-optimizable) or local.
|
|
100
|
+
*/
|
|
101
|
+
function isRemoteUrl(src) {
|
|
102
|
+
return src.startsWith("http://") || src.startsWith("https://") || src.startsWith("//");
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Common responsive image widths matching Next.js's default device sizes + image sizes.
|
|
106
|
+
* These are the breakpoints used for srcSet generation.
|
|
107
|
+
*/
|
|
108
|
+
const RESPONSIVE_WIDTHS = [640, 750, 828, 1080, 1200, 1920, 2048, 3840];
|
|
109
|
+
/**
|
|
110
|
+
* Build a `/_vinext/image` optimization URL.
|
|
111
|
+
*
|
|
112
|
+
* In production (Cloudflare Workers), the worker intercepts this path and uses
|
|
113
|
+
* the Images binding to resize/transcode on the fly. In dev, the Vite dev
|
|
114
|
+
* server handles it as a passthrough (serves the original file).
|
|
115
|
+
*/
|
|
116
|
+
export function imageOptimizationUrl(src, width, quality = 75) {
|
|
117
|
+
return `/_vinext/image?url=${encodeURIComponent(src)}&w=${width}&q=${quality}`;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Generate a srcSet string for responsive images.
|
|
121
|
+
*
|
|
122
|
+
* Each width points to the `/_vinext/image` optimization endpoint so the
|
|
123
|
+
* server can resize and transcode the image. Only includes widths that are
|
|
124
|
+
* <= 2x the original image width to avoid pointless upscaling.
|
|
125
|
+
*/
|
|
126
|
+
function generateSrcSet(src, originalWidth, quality = 75) {
|
|
127
|
+
const widths = RESPONSIVE_WIDTHS.filter((w) => w <= originalWidth * 2);
|
|
128
|
+
if (widths.length === 0)
|
|
129
|
+
return `${imageOptimizationUrl(src, originalWidth, quality)} ${originalWidth}w`;
|
|
130
|
+
return widths.map((w) => `${imageOptimizationUrl(src, w, quality)} ${w}w`).join(", ");
|
|
131
|
+
}
|
|
132
|
+
const Image = forwardRef(function Image({ src: srcProp, alt, width, height, fill, priority, quality, placeholder, blurDataURL, loader, sizes, className, style, unoptimized: _unoptimized, overrideSrc: _overrideSrc, loading, ...rest }, ref) {
|
|
133
|
+
// Handle StaticImageData (import result)
|
|
134
|
+
const src = typeof srcProp === "string" ? srcProp : srcProp.src;
|
|
135
|
+
const imgWidth = width ?? (typeof srcProp === "object" ? srcProp.width : undefined);
|
|
136
|
+
const imgHeight = height ?? (typeof srcProp === "object" ? srcProp.height : undefined);
|
|
137
|
+
const imgBlurDataURL = blurDataURL ?? (typeof srcProp === "object" ? srcProp.blurDataURL : undefined);
|
|
138
|
+
// If a custom loader is provided, use basic img with loader URL
|
|
139
|
+
if (loader) {
|
|
140
|
+
const resolvedSrc = loader({ src, width: imgWidth ?? 0, quality: quality ?? 75 });
|
|
141
|
+
return (_jsx("img", { ref: ref, src: resolvedSrc, alt: alt, width: fill ? undefined : imgWidth, height: fill ? undefined : imgHeight, loading: priority ? "eager" : (loading ?? "lazy"), decoding: "async", sizes: sizes, className: className, style: fill
|
|
142
|
+
? { position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover", ...style }
|
|
143
|
+
: style, ...rest }));
|
|
144
|
+
}
|
|
145
|
+
// For remote URLs, validate against remotePatterns then use @unpic/react
|
|
146
|
+
if (isRemoteUrl(src)) {
|
|
147
|
+
const validation = validateRemoteUrl(src);
|
|
148
|
+
if (!validation.allowed) {
|
|
149
|
+
if (__isDev) {
|
|
150
|
+
console.warn(`[next/image] ${validation.reason}`);
|
|
151
|
+
// In dev, render the image but with a warning — matches Next.js dev behavior
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
// In production, block the image entirely
|
|
155
|
+
console.error(`[next/image] ${validation.reason}`);
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
const sanitizedBlur = imgBlurDataURL ? sanitizeBlurDataURL(imgBlurDataURL) : undefined;
|
|
160
|
+
const bg = placeholder === "blur" && sanitizedBlur
|
|
161
|
+
? `url(${sanitizedBlur})`
|
|
162
|
+
: undefined;
|
|
163
|
+
if (fill) {
|
|
164
|
+
return (_jsx(UnpicImage, { src: src, alt: alt, layout: "fullWidth", priority: priority, sizes: sizes, className: className, background: bg }));
|
|
165
|
+
}
|
|
166
|
+
// constrained layout requires width+height or aspectRatio
|
|
167
|
+
if (imgWidth && imgHeight) {
|
|
168
|
+
return (_jsx(UnpicImage, { src: src, alt: alt, width: imgWidth, height: imgHeight, layout: "constrained", priority: priority, sizes: sizes, className: className, background: bg }));
|
|
169
|
+
}
|
|
170
|
+
// Fall through to basic <img> if dimensions not provided
|
|
171
|
+
// (unpic requires them for constrained layout)
|
|
172
|
+
}
|
|
173
|
+
// Route local images through the /_vinext/image optimization endpoint.
|
|
174
|
+
// In production on Cloudflare Workers, this resizes and transcodes via
|
|
175
|
+
// the Images binding. In dev, it serves the original file as a passthrough.
|
|
176
|
+
// When `unoptimized` is true, bypass the endpoint entirely (Next.js compat).
|
|
177
|
+
const imgQuality = quality ?? 75;
|
|
178
|
+
const skipOptimization = _unoptimized === true;
|
|
179
|
+
// Build srcSet for responsive local images (common breakpoints).
|
|
180
|
+
// Each entry points to /_vinext/image with the appropriate width.
|
|
181
|
+
const srcSet = imgWidth && !fill && !skipOptimization
|
|
182
|
+
? generateSrcSet(src, imgWidth, imgQuality)
|
|
183
|
+
: imgWidth && !fill
|
|
184
|
+
? RESPONSIVE_WIDTHS.filter((w) => w <= imgWidth * 2).map((w) => `${src} ${w}w`).join(", ") || `${src} ${imgWidth}w`
|
|
185
|
+
: undefined;
|
|
186
|
+
// The main `src` also goes through the optimization endpoint. Use the
|
|
187
|
+
// declared width (or the first responsive width as fallback).
|
|
188
|
+
const optimizedSrc = skipOptimization
|
|
189
|
+
? src
|
|
190
|
+
: imgWidth
|
|
191
|
+
? imageOptimizationUrl(src, imgWidth, imgQuality)
|
|
192
|
+
: imageOptimizationUrl(src, RESPONSIVE_WIDTHS[0], imgQuality);
|
|
193
|
+
// Blur placeholder: show a low-quality background while the image loads.
|
|
194
|
+
// Sanitize blurDataURL to prevent CSS injection via crafted data URLs.
|
|
195
|
+
const sanitizedLocalBlur = imgBlurDataURL ? sanitizeBlurDataURL(imgBlurDataURL) : undefined;
|
|
196
|
+
const blurStyle = placeholder === "blur" && sanitizedLocalBlur
|
|
197
|
+
? {
|
|
198
|
+
backgroundImage: `url(${sanitizedLocalBlur})`,
|
|
199
|
+
backgroundSize: "cover",
|
|
200
|
+
backgroundRepeat: "no-repeat",
|
|
201
|
+
backgroundPosition: "center",
|
|
202
|
+
}
|
|
203
|
+
: undefined;
|
|
204
|
+
// For local images, render a standard <img> tag with srcSet and blur support.
|
|
205
|
+
// The src and srcSet point to the /_vinext/image optimization endpoint.
|
|
206
|
+
return (_jsx("img", { ref: ref, src: optimizedSrc, alt: alt, width: fill ? undefined : imgWidth, height: fill ? undefined : imgHeight, loading: priority ? "eager" : (loading ?? "lazy"), fetchPriority: priority ? "high" : undefined, decoding: "async", srcSet: srcSet, sizes: sizes ?? (fill ? "100vw" : undefined), className: className, "data-nimg": fill ? "fill" : "1", style: fill
|
|
207
|
+
? { position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover", ...blurStyle, ...style }
|
|
208
|
+
: { ...blurStyle, ...style }, ...rest }));
|
|
209
|
+
});
|
|
210
|
+
/**
|
|
211
|
+
* getImageProps — for advanced use cases (picture elements, background images).
|
|
212
|
+
* Returns the props that would be passed to the underlying <img> element.
|
|
213
|
+
*/
|
|
214
|
+
export function getImageProps(props) {
|
|
215
|
+
const { src: srcProp, alt, width, height, fill, priority, quality: _quality, placeholder, blurDataURL: blurDataURLProp, loader, sizes, className, style, unoptimized: _unoptimized, overrideSrc: _overrideSrc, loading, ...rest } = props;
|
|
216
|
+
const src = typeof srcProp === "string" ? srcProp : srcProp.src;
|
|
217
|
+
const imgWidth = width ?? (typeof srcProp === "object" ? srcProp.width : undefined);
|
|
218
|
+
const imgHeight = height ?? (typeof srcProp === "object" ? srcProp.height : undefined);
|
|
219
|
+
const imgBlurDataURL = blurDataURLProp ?? (typeof srcProp === "object" ? srcProp.blurDataURL : undefined);
|
|
220
|
+
// Validate remote URLs against configured patterns
|
|
221
|
+
let blockedInProd = false;
|
|
222
|
+
if (isRemoteUrl(src)) {
|
|
223
|
+
const validation = validateRemoteUrl(src);
|
|
224
|
+
if (!validation.allowed) {
|
|
225
|
+
if (__isDev) {
|
|
226
|
+
console.warn(`[next/image] ${validation.reason}`);
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
console.error(`[next/image] ${validation.reason}`);
|
|
230
|
+
blockedInProd = true;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
// Resolve src through custom loader if provided
|
|
235
|
+
const imgQuality = _quality ?? 75;
|
|
236
|
+
const resolvedSrc = blockedInProd
|
|
237
|
+
? ""
|
|
238
|
+
: loader
|
|
239
|
+
? loader({ src, width: imgWidth ?? 0, quality: imgQuality })
|
|
240
|
+
: src;
|
|
241
|
+
// For local images (no loader, not remote), route through optimization endpoint.
|
|
242
|
+
// When `unoptimized` is true, bypass the endpoint entirely (Next.js compat).
|
|
243
|
+
const skipOpt = _unoptimized === true || blockedInProd || !!loader || isRemoteUrl(resolvedSrc);
|
|
244
|
+
const optimizedSrc = skipOpt
|
|
245
|
+
? resolvedSrc
|
|
246
|
+
: imgWidth
|
|
247
|
+
? imageOptimizationUrl(resolvedSrc, imgWidth, imgQuality)
|
|
248
|
+
: imageOptimizationUrl(resolvedSrc, RESPONSIVE_WIDTHS[0], imgQuality);
|
|
249
|
+
// Build srcSet for local images — each width points to /_vinext/image
|
|
250
|
+
const srcSet = imgWidth && !fill && !isRemoteUrl(resolvedSrc) && !loader && !_unoptimized
|
|
251
|
+
? generateSrcSet(resolvedSrc, imgWidth, imgQuality)
|
|
252
|
+
: undefined;
|
|
253
|
+
// Blur placeholder styles — sanitize to prevent CSS injection
|
|
254
|
+
const sanitizedBlurURL = imgBlurDataURL ? sanitizeBlurDataURL(imgBlurDataURL) : undefined;
|
|
255
|
+
const blurStyle = placeholder === "blur" && sanitizedBlurURL
|
|
256
|
+
? {
|
|
257
|
+
backgroundImage: `url(${sanitizedBlurURL})`,
|
|
258
|
+
backgroundSize: "cover",
|
|
259
|
+
backgroundRepeat: "no-repeat",
|
|
260
|
+
backgroundPosition: "center",
|
|
261
|
+
}
|
|
262
|
+
: undefined;
|
|
263
|
+
return {
|
|
264
|
+
props: {
|
|
265
|
+
src: optimizedSrc,
|
|
266
|
+
alt,
|
|
267
|
+
width: fill ? undefined : imgWidth,
|
|
268
|
+
height: fill ? undefined : imgHeight,
|
|
269
|
+
loading: priority ? "eager" : (loading ?? "lazy"),
|
|
270
|
+
fetchPriority: priority ? "high" : undefined,
|
|
271
|
+
decoding: "async",
|
|
272
|
+
srcSet,
|
|
273
|
+
sizes: sizes ?? (fill ? "100vw" : undefined),
|
|
274
|
+
className,
|
|
275
|
+
"data-nimg": fill ? "fill" : "1",
|
|
276
|
+
style: fill
|
|
277
|
+
? { position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover", ...blurStyle, ...style }
|
|
278
|
+
: { ...blurStyle, ...style },
|
|
279
|
+
...rest,
|
|
280
|
+
},
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
export default Image;
|
|
284
|
+
//# sourceMappingURL=image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.js","sourceRoot":"","sources":["../../src/shims/image.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;AACH,OAAc,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,cAAc,EAAsB,MAAM,mBAAmB,CAAC;AASvE;;;GAGG;AACH,MAAM,qBAAqB,GAAoB,CAAC,GAAG,EAAE;IACnD,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,8BAA8B,IAAI,IAAI,CAAC,CAAC;IACxE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC,CAAC,EAAE,CAAC;AACL,MAAM,cAAc,GAAa,CAAC,GAAG,EAAE;IACrC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,IAAI,CAAC,CAAC;IAChE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC,CAAC,EAAE,CAAC;AACL,MAAM,gBAAgB,GAAG,qBAAqB,CAAC,MAAM,GAAG,CAAC,IAAI,cAAc,CA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,IAAI,gBAAgB;QAC1D,CAAC,CAAC;YACE,eAAe,EAAE,OAAO,gBAAgB,GAAG;YAC3C,cAAc,EAAE,OAAO;YACvB,gBAAgB,EAAE,WAAoB;YACtC,kBAAkB,EAAE,QAAiB;SACtC;QACH,CAAC,CAAC,SAAS,CAAC;IAEd,OAAO;QACL,KAAK,EAAE;YACL,GAAG,EAAE,YAAY;YACjB,GAAG;YACH,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;YAClC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;YACpC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,IAAI,MAAM,CAAC;YACjD,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAE,MAAgB,CAAC,CAAC,CAAC,SAAS;YACvD,QAAQ,EAAE,OAAgB;YAC1B,MAAM;YACN,KAAK,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;YAC5C,SAAS;YACT,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG;YAChC,KAAK,EAAE,IAAI;gBACT,CAAC,CAAC,EAAE,QAAQ,EAAE,UAAmB,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,OAAgB,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,EAAE;gBACjI,CAAC,CAAC,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,EAAE;YAC9B,GAAG,IAAI;SACqC;KAC/C,CAAC;AACJ,CAAC;AAED,eAAe,KAAK,CAAC","sourcesContent":["/**\n * next/image shim\n *\n * Translates Next.js Image props to @unpic/react Image component.\n * @unpic/react auto-detects CDN from URL and uses native transforms.\n * For local images (relative paths), routes through `/_vinext/image`\n * for server-side optimization (resize, format negotiation, quality).\n *\n * Remote images are validated against `images.remotePatterns` and\n * `images.domains` from next.config.js. Unmatched URLs are blocked\n * in production and warn in development, matching Next.js behavior.\n */\nimport React, { forwardRef } from \"react\";\nimport { Image as UnpicImage } from \"@unpic/react\";\nimport { hasRemoteMatch, type RemotePattern } from \"./image-config.js\";\n\nexport interface StaticImageData {\n src: string;\n height: number;\n width: number;\n blurDataURL?: string;\n}\n\n/**\n * Image config injected at build time via Vite define.\n * Serialized as JSON — parsed once at module level.\n */\nconst __imageRemotePatterns: RemotePattern[] = (() => {\n try {\n return JSON.parse(process.env.__VINEXT_IMAGE_REMOTE_PATTERNS ?? \"[]\");\n } catch {\n return [];\n }\n})();\nconst __imageDomains: string[] = (() => {\n try {\n return JSON.parse(process.env.__VINEXT_IMAGE_DOMAINS ?? \"[]\");\n } catch {\n return [];\n }\n})();\nconst __hasImageConfig = __imageRemotePatterns.length > 0 || __imageDomains.length > 0;\nconst __isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * Validate that a remote URL is allowed by the configured remote patterns.\n * Returns true if the URL is allowed, false otherwise.\n *\n * When no remotePatterns/domains are configured, all remote URLs are allowed\n * (backwards-compatible — user hasn't opted into restriction).\n *\n * When patterns ARE configured, only matching URLs are allowed.\n * In development, non-matching URLs produce a console warning.\n * In production, non-matching URLs are blocked (src replaced with empty string).\n */\nfunction validateRemoteUrl(src: string): { allowed: boolean; reason?: string } {\n if (!__hasImageConfig) {\n // No image config — allow everything (backwards-compatible)\n return { allowed: true };\n }\n\n let url: URL;\n try {\n url = new URL(src, \"http://n\");\n } catch {\n return { allowed: false, reason: `Invalid URL: ${src}` };\n }\n\n if (hasRemoteMatch(__imageDomains, __imageRemotePatterns, url)) {\n return { allowed: true };\n }\n\n return {\n allowed: false,\n reason: `Image URL \"${src}\" is not configured in images.remotePatterns or images.domains in next.config.js. See: https://nextjs.org/docs/messages/next-image-unconfigured-host`,\n };\n}\n\ninterface ImageProps {\n src: string | StaticImageData;\n alt: string;\n width?: number;\n height?: number;\n fill?: boolean;\n priority?: boolean;\n quality?: number;\n placeholder?: \"blur\" | \"empty\";\n blurDataURL?: string;\n loader?: (params: { src: string; width: number; quality?: number }) => string;\n sizes?: string;\n className?: string;\n style?: React.CSSProperties;\n onLoad?: React.ReactEventHandler<HTMLImageElement>;\n onError?: React.ReactEventHandler<HTMLImageElement>;\n onClick?: React.MouseEventHandler<HTMLImageElement>;\n id?: string;\n // Accept and ignore Next.js-specific props that don't apply\n unoptimized?: boolean;\n overrideSrc?: string;\n loading?: \"lazy\" | \"eager\";\n}\n\n/**\n * Sanitize a blurDataURL to prevent CSS injection.\n *\n * A crafted data URL containing `)` can break out of the `url()` CSS function,\n * allowing injection of arbitrary CSS properties or rules. Characters like `{`,\n * `}`, and `\\` can also assist in crafting injection payloads.\n *\n * This validates the URL starts with `data:image/` and rejects characters that\n * could escape the `url()` context. Semicolons are allowed since they're part\n * of valid data URLs (`data:image/png;base64,...`) and harmless inside `url()`.\n *\n * Returns undefined for invalid URLs, which causes the blur placeholder to be\n * skipped gracefully.\n */\nfunction sanitizeBlurDataURL(url: string): string | undefined {\n // Must be a data: image URL\n if (!url.startsWith(\"data:image/\")) return undefined;\n // Reject characters that can break out of CSS url():\n // ) - closes url()\n // ( - could open nested functions\n // { } - CSS rule boundaries\n // \\ - CSS escape sequences\n // newlines - break CSS parsing\n if (/[)(}{\\\\'\"\\n\\r]/.test(url)) return undefined;\n return url;\n}\n\n/**\n * Determine if a src is a remote URL (CDN-optimizable) or local.\n */\nfunction isRemoteUrl(src: string): boolean {\n return src.startsWith(\"http://\") || src.startsWith(\"https://\") || src.startsWith(\"//\");\n}\n\n/**\n * Common responsive image widths matching Next.js's default device sizes + image sizes.\n * These are the breakpoints used for srcSet generation.\n */\nconst RESPONSIVE_WIDTHS = [640, 750, 828, 1080, 1200, 1920, 2048, 3840];\n\n/**\n * Build a `/_vinext/image` optimization URL.\n *\n * In production (Cloudflare Workers), the worker intercepts this path and uses\n * the Images binding to resize/transcode on the fly. In dev, the Vite dev\n * server handles it as a passthrough (serves the original file).\n */\nexport function imageOptimizationUrl(src: string, width: number, quality: number = 75): string {\n return `/_vinext/image?url=${encodeURIComponent(src)}&w=${width}&q=${quality}`;\n}\n\n/**\n * Generate a srcSet string for responsive images.\n *\n * Each width points to the `/_vinext/image` optimization endpoint so the\n * server can resize and transcode the image. Only includes widths that are\n * <= 2x the original image width to avoid pointless upscaling.\n */\nfunction generateSrcSet(src: string, originalWidth: number, quality: number = 75): string {\n const widths = RESPONSIVE_WIDTHS.filter((w) => w <= originalWidth * 2);\n if (widths.length === 0) return `${imageOptimizationUrl(src, originalWidth, quality)} ${originalWidth}w`;\n return widths.map((w) => `${imageOptimizationUrl(src, w, quality)} ${w}w`).join(\", \");\n}\n\nconst Image = forwardRef<HTMLImageElement, ImageProps>(function Image(\n {\n src: srcProp,\n alt,\n width,\n height,\n fill,\n priority,\n quality,\n placeholder,\n blurDataURL,\n loader,\n sizes,\n className,\n style,\n unoptimized: _unoptimized,\n overrideSrc: _overrideSrc,\n loading,\n ...rest\n },\n ref,\n) {\n // Handle StaticImageData (import result)\n const src = typeof srcProp === \"string\" ? srcProp : srcProp.src;\n const imgWidth = width ?? (typeof srcProp === \"object\" ? srcProp.width : undefined);\n const imgHeight = height ?? (typeof srcProp === \"object\" ? srcProp.height : undefined);\n const imgBlurDataURL = blurDataURL ?? (typeof srcProp === \"object\" ? srcProp.blurDataURL : undefined);\n\n // If a custom loader is provided, use basic img with loader URL\n if (loader) {\n const resolvedSrc = loader({ src, width: imgWidth ?? 0, quality: quality ?? 75 });\n return (\n <img\n ref={ref}\n src={resolvedSrc}\n alt={alt}\n width={fill ? undefined : imgWidth}\n height={fill ? undefined : imgHeight}\n loading={priority ? \"eager\" : (loading ?? \"lazy\")}\n decoding=\"async\"\n sizes={sizes}\n className={className}\n style={\n fill\n ? { position: \"absolute\", inset: 0, width: \"100%\", height: \"100%\", objectFit: \"cover\", ...style }\n : style\n }\n {...rest}\n />\n );\n }\n\n // For remote URLs, validate against remotePatterns then use @unpic/react\n if (isRemoteUrl(src)) {\n const validation = validateRemoteUrl(src);\n if (!validation.allowed) {\n if (__isDev) {\n console.warn(`[next/image] ${validation.reason}`);\n // In dev, render the image but with a warning — matches Next.js dev behavior\n } else {\n // In production, block the image entirely\n console.error(`[next/image] ${validation.reason}`);\n return null;\n }\n }\n\n const sanitizedBlur = imgBlurDataURL ? sanitizeBlurDataURL(imgBlurDataURL) : undefined;\n const bg =\n placeholder === \"blur\" && sanitizedBlur\n ? `url(${sanitizedBlur})`\n : undefined;\n\n if (fill) {\n return (\n <UnpicImage\n src={src}\n alt={alt}\n layout=\"fullWidth\"\n priority={priority}\n sizes={sizes}\n className={className}\n background={bg}\n />\n );\n }\n // constrained layout requires width+height or aspectRatio\n if (imgWidth && imgHeight) {\n return (\n <UnpicImage\n src={src}\n alt={alt}\n width={imgWidth}\n height={imgHeight}\n layout=\"constrained\"\n priority={priority}\n sizes={sizes}\n className={className}\n background={bg}\n />\n );\n }\n // Fall through to basic <img> if dimensions not provided\n // (unpic requires them for constrained layout)\n }\n\n // Route local images through the /_vinext/image optimization endpoint.\n // In production on Cloudflare Workers, this resizes and transcodes via\n // the Images binding. In dev, it serves the original file as a passthrough.\n // When `unoptimized` is true, bypass the endpoint entirely (Next.js compat).\n const imgQuality = quality ?? 75;\n const skipOptimization = _unoptimized === true;\n\n // Build srcSet for responsive local images (common breakpoints).\n // Each entry points to /_vinext/image with the appropriate width.\n const srcSet = imgWidth && !fill && !skipOptimization\n ? generateSrcSet(src, imgWidth, imgQuality)\n : imgWidth && !fill\n ? RESPONSIVE_WIDTHS.filter((w) => w <= imgWidth * 2).map((w) => `${src} ${w}w`).join(\", \") || `${src} ${imgWidth}w`\n : undefined;\n\n // The main `src` also goes through the optimization endpoint. Use the\n // declared width (or the first responsive width as fallback).\n const optimizedSrc = skipOptimization\n ? src\n : imgWidth\n ? imageOptimizationUrl(src, imgWidth, imgQuality)\n : imageOptimizationUrl(src, RESPONSIVE_WIDTHS[0], imgQuality);\n\n // Blur placeholder: show a low-quality background while the image loads.\n // Sanitize blurDataURL to prevent CSS injection via crafted data URLs.\n const sanitizedLocalBlur = imgBlurDataURL ? sanitizeBlurDataURL(imgBlurDataURL) : undefined;\n const blurStyle = placeholder === \"blur\" && sanitizedLocalBlur\n ? {\n backgroundImage: `url(${sanitizedLocalBlur})`,\n backgroundSize: \"cover\",\n backgroundRepeat: \"no-repeat\",\n backgroundPosition: \"center\",\n }\n : undefined;\n\n // For local images, render a standard <img> tag with srcSet and blur support.\n // The src and srcSet point to the /_vinext/image optimization endpoint.\n return (\n <img\n ref={ref}\n src={optimizedSrc}\n alt={alt}\n width={fill ? undefined : imgWidth}\n height={fill ? undefined : imgHeight}\n loading={priority ? \"eager\" : (loading ?? \"lazy\")}\n fetchPriority={priority ? \"high\" : undefined}\n decoding=\"async\"\n srcSet={srcSet}\n sizes={sizes ?? (fill ? \"100vw\" : undefined)}\n className={className}\n data-nimg={fill ? \"fill\" : \"1\"}\n style={\n fill\n ? { position: \"absolute\", inset: 0, width: \"100%\", height: \"100%\", objectFit: \"cover\", ...blurStyle, ...style }\n : { ...blurStyle, ...style }\n }\n {...rest}\n />\n );\n});\n\n/**\n * getImageProps — for advanced use cases (picture elements, background images).\n * Returns the props that would be passed to the underlying <img> element.\n */\nexport function getImageProps(props: ImageProps): {\n props: React.ImgHTMLAttributes<HTMLImageElement>;\n} {\n const {\n src: srcProp,\n alt,\n width,\n height,\n fill,\n priority,\n quality: _quality,\n placeholder,\n blurDataURL: blurDataURLProp,\n loader,\n sizes,\n className,\n style,\n unoptimized: _unoptimized,\n overrideSrc: _overrideSrc,\n loading,\n ...rest\n } = props;\n\n const src = typeof srcProp === \"string\" ? srcProp : srcProp.src;\n const imgWidth = width ?? (typeof srcProp === \"object\" ? srcProp.width : undefined);\n const imgHeight = height ?? (typeof srcProp === \"object\" ? srcProp.height : undefined);\n const imgBlurDataURL = blurDataURLProp ?? (typeof srcProp === \"object\" ? srcProp.blurDataURL : undefined);\n\n // Validate remote URLs against configured patterns\n let blockedInProd = false;\n if (isRemoteUrl(src)) {\n const validation = validateRemoteUrl(src);\n if (!validation.allowed) {\n if (__isDev) {\n console.warn(`[next/image] ${validation.reason}`);\n } else {\n console.error(`[next/image] ${validation.reason}`);\n blockedInProd = true;\n }\n }\n }\n\n // Resolve src through custom loader if provided\n const imgQuality = _quality ?? 75;\n const resolvedSrc = blockedInProd\n ? \"\"\n : loader\n ? loader({ src, width: imgWidth ?? 0, quality: imgQuality })\n : src;\n\n // For local images (no loader, not remote), route through optimization endpoint.\n // When `unoptimized` is true, bypass the endpoint entirely (Next.js compat).\n const skipOpt = _unoptimized === true || blockedInProd || !!loader || isRemoteUrl(resolvedSrc);\n const optimizedSrc = skipOpt\n ? resolvedSrc\n : imgWidth\n ? imageOptimizationUrl(resolvedSrc, imgWidth, imgQuality)\n : imageOptimizationUrl(resolvedSrc, RESPONSIVE_WIDTHS[0], imgQuality);\n\n // Build srcSet for local images — each width points to /_vinext/image\n const srcSet = imgWidth && !fill && !isRemoteUrl(resolvedSrc) && !loader && !_unoptimized\n ? generateSrcSet(resolvedSrc, imgWidth, imgQuality)\n : undefined;\n\n // Blur placeholder styles — sanitize to prevent CSS injection\n const sanitizedBlurURL = imgBlurDataURL ? sanitizeBlurDataURL(imgBlurDataURL) : undefined;\n const blurStyle = placeholder === \"blur\" && sanitizedBlurURL\n ? {\n backgroundImage: `url(${sanitizedBlurURL})`,\n backgroundSize: \"cover\",\n backgroundRepeat: \"no-repeat\" as const,\n backgroundPosition: \"center\" as const,\n }\n : undefined;\n\n return {\n props: {\n src: optimizedSrc,\n alt,\n width: fill ? undefined : imgWidth,\n height: fill ? undefined : imgHeight,\n loading: priority ? \"eager\" : (loading ?? \"lazy\"),\n fetchPriority: priority ? (\"high\" as const) : undefined,\n decoding: \"async\" as const,\n srcSet,\n sizes: sizes ?? (fill ? \"100vw\" : undefined),\n className,\n \"data-nimg\": fill ? \"fill\" : \"1\",\n style: fill\n ? { position: \"absolute\" as const, inset: 0, width: \"100%\", height: \"100%\", objectFit: \"cover\" as const, ...blurStyle, ...style }\n : { ...blurStyle, ...style },\n ...rest,\n } as React.ImgHTMLAttributes<HTMLImageElement>,\n };\n}\n\nexport default Image;\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shim for next/dist/server/api-utils
|
|
3
|
+
*
|
|
4
|
+
* Used by: @clerk/nextjs (type-only import of NextApiRequestCookies).
|
|
5
|
+
*/
|
|
6
|
+
export type NextApiRequestCookies = Partial<{
|
|
7
|
+
[key: string]: string;
|
|
8
|
+
}>;
|
|
9
|
+
export type NextApiRequestQuery = Partial<{
|
|
10
|
+
[key: string]: string | string[];
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=api-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-utils.d.ts","sourceRoot":"","sources":["../../../src/shims/internal/api-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC,CAAC;AAEvE,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC;IACxC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;CAClC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-utils.js","sourceRoot":"","sources":["../../../src/shims/internal/api-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG","sourcesContent":["/**\n * Shim for next/dist/server/api-utils\n *\n * Used by: @clerk/nextjs (type-only import of NextApiRequestCookies).\n */\n\nexport type NextApiRequestCookies = Partial<{ [key: string]: string }>;\n\nexport type NextApiRequestQuery = Partial<{\n [key: string]: string | string[];\n}>;\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface NavigateOptions {
|
|
2
|
+
scroll?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export interface PrefetchOptions {
|
|
5
|
+
kind?: unknown;
|
|
6
|
+
onInvalidate?: () => void;
|
|
7
|
+
}
|
|
8
|
+
export interface AppRouterInstance {
|
|
9
|
+
back(): void;
|
|
10
|
+
forward(): void;
|
|
11
|
+
refresh(): void;
|
|
12
|
+
push(href: string, options?: NavigateOptions): void;
|
|
13
|
+
replace(href: string, options?: NavigateOptions): void;
|
|
14
|
+
prefetch(href: string, options?: PrefetchOptions): void;
|
|
15
|
+
}
|
|
16
|
+
export declare const AppRouterContext: import("react").Context<AppRouterInstance | null>;
|
|
17
|
+
export declare const GlobalLayoutRouterContext: import("react").Context<unknown>;
|
|
18
|
+
export declare const LayoutRouterContext: import("react").Context<unknown>;
|
|
19
|
+
export declare const MissingSlotContext: import("react").Context<Set<string>>;
|
|
20
|
+
export declare const TemplateContext: import("react").Context<unknown>;
|
|
21
|
+
//# sourceMappingURL=app-router-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-router-context.d.ts","sourceRoot":"","sources":["../../../src/shims/internal/app-router-context.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,IAAI,IAAI,CAAC;IACb,OAAO,IAAI,IAAI,CAAC;IAChB,OAAO,IAAI,IAAI,CAAC;IAChB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;IACpD,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;IACvD,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;CACzD;AAED,eAAO,MAAM,gBAAgB,mDAAgD,CAAC;AAC9E,eAAO,MAAM,yBAAyB,kCAA+B,CAAC;AACtE,eAAO,MAAM,mBAAmB,kCAA+B,CAAC;AAChE,eAAO,MAAM,kBAAkB,sCAAwC,CAAC;AACxE,eAAO,MAAM,eAAe,kCAA+B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shim for next/dist/shared/lib/app-router-context.shared-runtime
|
|
3
|
+
*
|
|
4
|
+
* Used by: @clerk/nextjs, next-intl, next-nprogress-bar, nextjs-toploader,
|
|
5
|
+
* next-view-transitions. Mostly type-only imports in published .d.ts files.
|
|
6
|
+
*
|
|
7
|
+
* We export the types and minimal context objects so these libraries resolve.
|
|
8
|
+
*/
|
|
9
|
+
import { createContext } from "react";
|
|
10
|
+
export const AppRouterContext = createContext(null);
|
|
11
|
+
export const GlobalLayoutRouterContext = createContext(null);
|
|
12
|
+
export const LayoutRouterContext = createContext(null);
|
|
13
|
+
export const MissingSlotContext = createContext(new Set());
|
|
14
|
+
export const TemplateContext = createContext(null);
|
|
15
|
+
//# sourceMappingURL=app-router-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-router-context.js","sourceRoot":"","sources":["../../../src/shims/internal/app-router-context.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAoBtC,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAA2B,IAAI,CAAC,CAAC;AAC9E,MAAM,CAAC,MAAM,yBAAyB,GAAG,aAAa,CAAU,IAAI,CAAC,CAAC;AACtE,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAU,IAAI,CAAC,CAAC;AAChE,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAc,IAAI,GAAG,EAAE,CAAC,CAAC;AACxE,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAU,IAAI,CAAC,CAAC","sourcesContent":["/**\n * Shim for next/dist/shared/lib/app-router-context.shared-runtime\n *\n * Used by: @clerk/nextjs, next-intl, next-nprogress-bar, nextjs-toploader,\n * next-view-transitions. Mostly type-only imports in published .d.ts files.\n *\n * We export the types and minimal context objects so these libraries resolve.\n */\nimport { createContext } from \"react\";\n\nexport interface NavigateOptions {\n scroll?: boolean;\n}\n\nexport interface PrefetchOptions {\n kind?: unknown;\n onInvalidate?: () => void;\n}\n\nexport interface AppRouterInstance {\n back(): void;\n forward(): void;\n refresh(): void;\n push(href: string, options?: NavigateOptions): void;\n replace(href: string, options?: NavigateOptions): void;\n prefetch(href: string, options?: PrefetchOptions): void;\n}\n\nexport const AppRouterContext = createContext<AppRouterInstance | null>(null);\nexport const GlobalLayoutRouterContext = createContext<unknown>(null);\nexport const LayoutRouterContext = createContext<unknown>(null);\nexport const MissingSlotContext = createContext<Set<string>>(new Set());\nexport const TemplateContext = createContext<unknown>(null);\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shim for next/dist/server/web/spec-extension/cookies
|
|
3
|
+
* and next/dist/compiled/@edge-runtime/cookies
|
|
4
|
+
*
|
|
5
|
+
* Used by: next-intl (type-only), test utilities.
|
|
6
|
+
* Re-exports from our server shim's cookie implementations.
|
|
7
|
+
*/
|
|
8
|
+
export { RequestCookies, ResponseCookies } from "../server.js";
|
|
9
|
+
//# sourceMappingURL=cookies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookies.d.ts","sourceRoot":"","sources":["../../../src/shims/internal/cookies.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shim for next/dist/server/web/spec-extension/cookies
|
|
3
|
+
* and next/dist/compiled/@edge-runtime/cookies
|
|
4
|
+
*
|
|
5
|
+
* Used by: next-intl (type-only), test utilities.
|
|
6
|
+
* Re-exports from our server shim's cookie implementations.
|
|
7
|
+
*/
|
|
8
|
+
export { RequestCookies, ResponseCookies } from "../server.js";
|
|
9
|
+
//# sourceMappingURL=cookies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookies.js","sourceRoot":"","sources":["../../../src/shims/internal/cookies.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC","sourcesContent":["/**\n * Shim for next/dist/server/web/spec-extension/cookies\n * and next/dist/compiled/@edge-runtime/cookies\n *\n * Used by: next-intl (type-only), test utilities.\n * Re-exports from our server shim's cookie implementations.\n */\nexport { RequestCookies, ResponseCookies } from \"../server.js\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router-context.d.ts","sourceRoot":"","sources":["../../../src/shims/internal/router-context.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,aAAa,kCAA+B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shim for next/dist/shared/lib/router-context.shared-runtime
|
|
3
|
+
*
|
|
4
|
+
* Used by: some testing utilities and older libraries.
|
|
5
|
+
* Provides the Pages Router context.
|
|
6
|
+
*/
|
|
7
|
+
import { createContext } from "react";
|
|
8
|
+
export const RouterContext = createContext(null);
|
|
9
|
+
//# sourceMappingURL=router-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router-context.js","sourceRoot":"","sources":["../../../src/shims/internal/router-context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAU,IAAI,CAAC,CAAC","sourcesContent":["/**\n * Shim for next/dist/shared/lib/router-context.shared-runtime\n *\n * Used by: some testing utilities and older libraries.\n * Provides the Pages Router context.\n */\nimport { createContext } from \"react\";\n\nexport const RouterContext = createContext<unknown>(null);\n"]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shim for next/dist/shared/lib/utils
|
|
3
|
+
*
|
|
4
|
+
* Used by: @sentry/nextjs (type-only import of NEXT_DATA).
|
|
5
|
+
* Provides the NEXT_DATA type that matches window.__NEXT_DATA__.
|
|
6
|
+
*/
|
|
7
|
+
export interface NEXT_DATA {
|
|
8
|
+
props: Record<string, unknown>;
|
|
9
|
+
page: string;
|
|
10
|
+
query: Record<string, string | string[]>;
|
|
11
|
+
buildId?: string;
|
|
12
|
+
assetPrefix?: string;
|
|
13
|
+
runtimeConfig?: Record<string, unknown>;
|
|
14
|
+
nextExport?: boolean;
|
|
15
|
+
autoExport?: boolean;
|
|
16
|
+
isFallback?: boolean;
|
|
17
|
+
dynamicIds?: (string | number)[];
|
|
18
|
+
err?: {
|
|
19
|
+
message: string;
|
|
20
|
+
statusCode: number;
|
|
21
|
+
name?: string;
|
|
22
|
+
};
|
|
23
|
+
gsp?: boolean;
|
|
24
|
+
gssp?: boolean;
|
|
25
|
+
customServer?: boolean;
|
|
26
|
+
gip?: boolean;
|
|
27
|
+
appGip?: boolean;
|
|
28
|
+
locale?: string;
|
|
29
|
+
locales?: string[];
|
|
30
|
+
defaultLocale?: string;
|
|
31
|
+
domainLocales?: Array<{
|
|
32
|
+
domain: string;
|
|
33
|
+
defaultLocale: string;
|
|
34
|
+
locales?: string[];
|
|
35
|
+
}>;
|
|
36
|
+
scriptLoader?: unknown[];
|
|
37
|
+
isPreview?: boolean;
|
|
38
|
+
notFoundSrcPage?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Standard Next.js error shape.
|
|
42
|
+
*/
|
|
43
|
+
export declare function execOnce<T extends (...args: unknown[]) => unknown>(fn: T): T;
|
|
44
|
+
export declare function getLocationOrigin(): string;
|
|
45
|
+
export declare function getURL(): string;
|
|
46
|
+
export declare const SP: boolean;
|
|
47
|
+
export declare const ST: boolean;
|
|
48
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/shims/internal/utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IACjC,GAAG,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7D,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,KAAK,CAAC;QACpB,MAAM,EAAE,MAAM,CAAC;QACf,aAAa,EAAE,MAAM,CAAC;QACtB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC,CAAC;IACH,YAAY,CAAC,EAAE,OAAO,EAAE,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAU5E;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAK1C;AAED,wBAAgB,MAAM,IAAI,MAAM,CAK/B;AAED,eAAO,MAAM,EAAE,SAAqC,CAAC;AACrD,eAAO,MAAM,EAAE,SAA+C,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shim for next/dist/shared/lib/utils
|
|
3
|
+
*
|
|
4
|
+
* Used by: @sentry/nextjs (type-only import of NEXT_DATA).
|
|
5
|
+
* Provides the NEXT_DATA type that matches window.__NEXT_DATA__.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Standard Next.js error shape.
|
|
9
|
+
*/
|
|
10
|
+
export function execOnce(fn) {
|
|
11
|
+
let used = false;
|
|
12
|
+
let result;
|
|
13
|
+
return ((...args) => {
|
|
14
|
+
if (!used) {
|
|
15
|
+
used = true;
|
|
16
|
+
result = fn(...args);
|
|
17
|
+
}
|
|
18
|
+
return result;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export function getLocationOrigin() {
|
|
22
|
+
if (typeof window !== "undefined") {
|
|
23
|
+
return window.location.origin;
|
|
24
|
+
}
|
|
25
|
+
return "http://localhost";
|
|
26
|
+
}
|
|
27
|
+
export function getURL() {
|
|
28
|
+
if (typeof window !== "undefined") {
|
|
29
|
+
return window.location.href;
|
|
30
|
+
}
|
|
31
|
+
return "http://localhost/";
|
|
32
|
+
}
|
|
33
|
+
export const SP = typeof performance !== "undefined";
|
|
34
|
+
export const ST = SP && typeof performance.mark === "function";
|
|
35
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/shims/internal/utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAgCH;;GAEG;AACH,MAAM,UAAU,QAAQ,CAA4C,EAAK;IACvE,IAAI,IAAI,GAAG,KAAK,CAAC;IACjB,IAAI,MAAe,CAAC;IACpB,OAAO,CAAC,CAAC,GAAG,IAAe,EAAE,EAAE;QAC7B,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,IAAI,GAAG,IAAI,CAAC;YACZ,MAAM,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAM,CAAC;AACV,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;IAChC,CAAC;IACD,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,MAAM;IACpB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC9B,CAAC;IACD,OAAO,mBAAmB,CAAC;AAC7B,CAAC;AAED,MAAM,CAAC,MAAM,EAAE,GAAG,OAAO,WAAW,KAAK,WAAW,CAAC;AACrD,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,OAAO,WAAW,CAAC,IAAI,KAAK,UAAU,CAAC","sourcesContent":["/**\n * Shim for next/dist/shared/lib/utils\n *\n * Used by: @sentry/nextjs (type-only import of NEXT_DATA).\n * Provides the NEXT_DATA type that matches window.__NEXT_DATA__.\n */\n\nexport interface NEXT_DATA {\n props: Record<string, unknown>;\n page: string;\n query: Record<string, string | string[]>;\n buildId?: string;\n assetPrefix?: string;\n runtimeConfig?: Record<string, unknown>;\n nextExport?: boolean;\n autoExport?: boolean;\n isFallback?: boolean;\n dynamicIds?: (string | number)[];\n err?: { message: string; statusCode: number; name?: string };\n gsp?: boolean;\n gssp?: boolean;\n customServer?: boolean;\n gip?: boolean;\n appGip?: boolean;\n locale?: string;\n locales?: string[];\n defaultLocale?: string;\n domainLocales?: Array<{\n domain: string;\n defaultLocale: string;\n locales?: string[];\n }>;\n scriptLoader?: unknown[];\n isPreview?: boolean;\n notFoundSrcPage?: string;\n}\n\n/**\n * Standard Next.js error shape.\n */\nexport function execOnce<T extends (...args: unknown[]) => unknown>(fn: T): T {\n let used = false;\n let result: unknown;\n return ((...args: unknown[]) => {\n if (!used) {\n used = true;\n result = fn(...args);\n }\n return result;\n }) as T;\n}\n\nexport function getLocationOrigin(): string {\n if (typeof window !== \"undefined\") {\n return window.location.origin;\n }\n return \"http://localhost\";\n}\n\nexport function getURL(): string {\n if (typeof window !== \"undefined\") {\n return window.location.href;\n }\n return \"http://localhost/\";\n}\n\nexport const SP = typeof performance !== \"undefined\";\nexport const ST = SP && typeof performance.mark === \"function\";\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shim for next/dist/server/app-render/work-unit-async-storage.external
|
|
3
|
+
* and next/dist/client/components/request-async-storage.external
|
|
4
|
+
*
|
|
5
|
+
* Used by: @sentry/nextjs (runtime resolve for request context injection).
|
|
6
|
+
* Provides a minimal AsyncLocalStorage-like export that Sentry can detect
|
|
7
|
+
* and use without crashing.
|
|
8
|
+
*/
|
|
9
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
10
|
+
export declare const workUnitAsyncStorage: AsyncLocalStorage<unknown>;
|
|
11
|
+
export declare const requestAsyncStorage: AsyncLocalStorage<unknown>;
|
|
12
|
+
//# sourceMappingURL=work-unit-async-storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"work-unit-async-storage.d.ts","sourceRoot":"","sources":["../../../src/shims/internal/work-unit-async-storage.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,eAAO,MAAM,oBAAoB,4BAAmC,CAAC;AAGrE,eAAO,MAAM,mBAAmB,4BAAuB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shim for next/dist/server/app-render/work-unit-async-storage.external
|
|
3
|
+
* and next/dist/client/components/request-async-storage.external
|
|
4
|
+
*
|
|
5
|
+
* Used by: @sentry/nextjs (runtime resolve for request context injection).
|
|
6
|
+
* Provides a minimal AsyncLocalStorage-like export that Sentry can detect
|
|
7
|
+
* and use without crashing.
|
|
8
|
+
*/
|
|
9
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
10
|
+
export const workUnitAsyncStorage = new AsyncLocalStorage();
|
|
11
|
+
// Legacy name (Next 13.x–14.x)
|
|
12
|
+
export const requestAsyncStorage = workUnitAsyncStorage;
|
|
13
|
+
//# sourceMappingURL=work-unit-async-storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"work-unit-async-storage.js","sourceRoot":"","sources":["../../../src/shims/internal/work-unit-async-storage.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,iBAAiB,EAAW,CAAC;AAErE,+BAA+B;AAC/B,MAAM,CAAC,MAAM,mBAAmB,GAAG,oBAAoB,CAAC","sourcesContent":["/**\n * Shim for next/dist/server/app-render/work-unit-async-storage.external\n * and next/dist/client/components/request-async-storage.external\n *\n * Used by: @sentry/nextjs (runtime resolve for request context injection).\n * Provides a minimal AsyncLocalStorage-like export that Sentry can detect\n * and use without crashing.\n */\nimport { AsyncLocalStorage } from \"node:async_hooks\";\n\nexport const workUnitAsyncStorage = new AsyncLocalStorage<unknown>();\n\n// Legacy name (Next 13.x–14.x)\nexport const requestAsyncStorage = workUnitAsyncStorage;\n"]}
|