cloudflare-next-intl 0.9.6 → 0.9.7
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/src/client/components/client_provider.js +1 -1
- package/dist/src/client/components/client_provider_static.js +1 -1
- package/dist/src/client/components/locale_link.d.ts +1 -1
- package/dist/src/client/components/locale_link_client.js +1 -1
- package/dist/src/client/hooks/use_path_name.js +1 -1
- package/dist/src/config/middleware.d.ts +2 -2
- package/dist/src/config/middleware.js +1 -1
- package/dist/src/cookie_consent/client/components/auto_analytics_events.js +1 -1
- package/dist/src/cookie_consent/client/components/cookie_consent_analytics.js +1 -1
- package/dist/src/cookie_consent/client/components/default_privacy_policy_link.js +1 -1
- package/dist/src/cookie_consent/client/cookie_consent_provider.js +1 -1
- package/dist/src/db/connection.js +10 -0
- package/dist/src/error_handling/create_server_error_action.js +1 -1
- package/dist/src/firebase_auth/client/auth_user_provider.js +1 -1
- package/dist/src/firebase_auth/middleware/update_session.d.ts +1 -1
- package/dist/src/firebase_auth/middleware/update_session.js +1 -1
- package/dist/src/firebase_auth/server/auth_user_server_provider.js +3 -3
- package/dist/src/firebase_auth/server/clear_session_action.js +1 -1
- package/dist/src/firebase_auth/server/firebase_server.js +1 -1
- package/dist/src/image_optimizer/next_image_shim.d.ts +2 -2
- package/dist/src/image_optimizer/next_image_shim.js +1 -1
- package/dist/src/server/components/link.d.ts +1 -1
- package/dist/src/server/components/link.js +1 -1
- package/dist/src/server/components/server_provider.js +2 -2
- package/dist/src/server/components/server_provider_static.js +2 -2
- package/dist/src/server/functions/geo.js +2 -2
- package/dist/src/server/functions/server.js +2 -2
- package/dist/src/types/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { setLocaleCache, setMessageForLocaleCache } from "../../general/cache_variables.js";
|
|
4
4
|
import { createContext, useMemo } from "react";
|
|
5
|
-
import dynamic from "next/dynamic";
|
|
5
|
+
import dynamic from "next/dynamic.js";
|
|
6
6
|
import config from "@intl-config";
|
|
7
7
|
import installConsoleErrorOverride from "../../error_handling/install_console_error_override.js";
|
|
8
8
|
import installGlobalErrorOverride from "../../error_handling/install_global_error_override.js";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { setLocaleCache, setMessageForLocaleCache } from "../../general/cache_variables.js";
|
|
4
4
|
import { createContext, useMemo } from "react";
|
|
5
|
-
import dynamic from "next/dynamic";
|
|
5
|
+
import dynamic from "next/dynamic.js";
|
|
6
6
|
import config from "@intl-config";
|
|
7
7
|
import installConsoleErrorOverride from "../../error_handling/install_console_error_override.js";
|
|
8
8
|
import installGlobalErrorOverride from "../../error_handling/install_global_error_override.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type LinkProps } from 'next/link';
|
|
1
|
+
import { type LinkProps } from 'next/link.js';
|
|
2
2
|
import { type ComponentProps } from 'react';
|
|
3
3
|
type NextLinkProps = Omit<ComponentProps<'a'>, keyof LinkProps> & Omit<LinkProps, 'locale' | 'href' | 'prefetch' | 'onNavigate' | 'hrefLang' | 'replace' | 'scroll'>;
|
|
4
4
|
export type LocaleLinkProps = NextLinkProps & {
|
|
@@ -5,7 +5,7 @@ import config from '../../config/intl_config.js';
|
|
|
5
5
|
import usePathname from '../hooks/use_path_name.js';
|
|
6
6
|
import { localeCookieName } from '../../config/cookie_key.js';
|
|
7
7
|
import setCookie from '../functions/set_cookie.js';
|
|
8
|
-
import { useSearchParams } from 'next/navigation';
|
|
8
|
+
import { useSearchParams } from 'next/navigation.js';
|
|
9
9
|
function ClientLocaleLinkComponent({ locale, className, ...rest }, ref) {
|
|
10
10
|
const pathname = usePathname();
|
|
11
11
|
const searchParams = useSearchParams();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { usePathname as nextUsePathname } from "next/navigation";
|
|
2
|
+
import { usePathname as nextUsePathname } from "next/navigation.js";
|
|
3
3
|
import { useLocale } from "./client_hooks.js";
|
|
4
4
|
export default function usePathname() {
|
|
5
5
|
const pathname = nextUsePathname();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { NextRequest } from 'next/server';
|
|
2
|
-
import { NextResponse } from 'next/server';
|
|
1
|
+
import type { NextRequest } from 'next/server.js';
|
|
2
|
+
import { NextResponse } from 'next/server.js';
|
|
3
3
|
import type { MiddlewareCustomHandler } from '../types/types.js';
|
|
4
4
|
export declare const localesSet: Set<string>;
|
|
5
5
|
export default function intlMiddleware(request: NextRequest, options?: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
1
|
+
import { NextResponse } from 'next/server.js';
|
|
2
2
|
import { languageDetecotr } from '../server/functions/get_user_locale.js';
|
|
3
3
|
import config from './intl_config.js';
|
|
4
4
|
import { isBotCookieKey, localeCookieName } from './cookie_key.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
|
-
import dynamic from 'next/dynamic';
|
|
4
|
+
import dynamic from 'next/dynamic.js';
|
|
5
5
|
import useCookieConsent from '../use_cookie_consent.js';
|
|
6
6
|
const ClarityScript = dynamic(() => import('./clarity_script.js'));
|
|
7
7
|
export default function CookieConsentAnalytics({ config }) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import NextLink from 'next/link';
|
|
3
|
+
import NextLink from 'next/link.js';
|
|
4
4
|
import config from '../../../config/intl_config.js';
|
|
5
5
|
import { getLocaleCache } from '../../../general/cache_variables.js';
|
|
6
6
|
export default function DefaultPrivacyPolicyLink({ privacyPolicyPath, text, className, style }) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { createContext, useCallback, useEffect, useMemo, useState } from 'react';
|
|
4
|
-
import { usePathname } from 'next/navigation';
|
|
4
|
+
import { usePathname } from 'next/navigation.js';
|
|
5
5
|
import config from '../../config/intl_config.js';
|
|
6
6
|
import requireCookieConsentConfig from '../require_config.js';
|
|
7
7
|
import getCookie from '../../client/functions/get_cookie.js';
|
|
@@ -21,6 +21,14 @@ async function resolveConnectionString(db, generate) {
|
|
|
21
21
|
'to a connection string, or to a function returning one (e.g. reading a ' +
|
|
22
22
|
'Hyperdrive binding off `env` or `getCloudflareContext().env`).');
|
|
23
23
|
}
|
|
24
|
+
async function resetSessionState(client) {
|
|
25
|
+
try {
|
|
26
|
+
await client.query('discard all');
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
await client.query('reset role').catch(() => undefined);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
24
32
|
export async function withDbClient(config, queryFn) {
|
|
25
33
|
const db = config.db;
|
|
26
34
|
requireDbConfig(db);
|
|
@@ -33,6 +41,7 @@ export async function withDbClient(config, queryFn) {
|
|
|
33
41
|
try {
|
|
34
42
|
await client.connect();
|
|
35
43
|
connected = true;
|
|
44
|
+
await resetSessionState(client);
|
|
36
45
|
}
|
|
37
46
|
catch (error) {
|
|
38
47
|
const message = error instanceof Error ? error.message : String(error ?? '');
|
|
@@ -83,6 +92,7 @@ export async function connectToPostgres(config) {
|
|
|
83
92
|
void reportError({ errorHandling: config.errorHandling, generate: config.generate }, { error, classOrMethodName: 'db.connectToPostgres.clientError' });
|
|
84
93
|
});
|
|
85
94
|
await client.connect();
|
|
95
|
+
await resetSessionState(client);
|
|
86
96
|
return client;
|
|
87
97
|
}
|
|
88
98
|
export async function disconnectPostgres(client) {
|
|
@@ -2,7 +2,7 @@ import reportError from './report_error.js';
|
|
|
2
2
|
import stringifyUnknown from './stringify_unknown.js';
|
|
3
3
|
async function resolveRequestContext() {
|
|
4
4
|
try {
|
|
5
|
-
const { headers } = await import('next/headers');
|
|
5
|
+
const { headers } = await import('next/headers.js');
|
|
6
6
|
const headerList = await headers();
|
|
7
7
|
return {
|
|
8
8
|
path: headerList.get('x-pathname') ?? undefined,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { createContext, useCallback, useEffect, useRef, useState } from 'react';
|
|
4
|
-
import { useRouter } from 'next/navigation';
|
|
4
|
+
import { useRouter } from 'next/navigation.js';
|
|
5
5
|
import usePathname from '../../client/hooks/use_path_name.js';
|
|
6
6
|
import config from '@intl-config';
|
|
7
7
|
import requireFirebaseAuthConfig from '../require_config.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NextResponse, type NextRequest } from 'next/server';
|
|
1
|
+
import { NextResponse, type NextRequest } from 'next/server.js';
|
|
2
2
|
import config from '@intl-config';
|
|
3
3
|
export declare const defaultSessionCookieName = "__fa_session__";
|
|
4
4
|
export declare const defaultRefreshTokenCookieName = "__fa_refresh_token__";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import dynamic from 'next/dynamic';
|
|
3
|
-
import { headers } from 'next/headers';
|
|
4
|
-
import { redirect } from 'next/navigation';
|
|
2
|
+
import dynamic from 'next/dynamic.js';
|
|
3
|
+
import { headers } from 'next/headers.js';
|
|
4
|
+
import { redirect } from 'next/navigation.js';
|
|
5
5
|
import config from '@intl-config';
|
|
6
6
|
import requireFirebaseAuthConfig from '../require_config.js';
|
|
7
7
|
import { getAuthenticatedAppForUser } from './firebase_server.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use server";
|
|
2
|
-
import { cookies } from "next/headers";
|
|
2
|
+
import { cookies } from "next/headers.js";
|
|
3
3
|
import config from "@intl-config";
|
|
4
4
|
import { defaultRefreshTokenCookieName, defaultSessionCookieName } from "../middleware/update_session.js";
|
|
5
5
|
export default async function clearSessionAction() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { getImageProps as nextGetImageProps } from "next/image";
|
|
3
|
-
import type { ImageProps } from "next/image";
|
|
2
|
+
import { getImageProps as nextGetImageProps } from "next/image.js";
|
|
3
|
+
import type { ImageProps } from "next/image.js";
|
|
4
4
|
import { getImageBlurSvg } from "./blur_svg.js";
|
|
5
5
|
import type { OptimizedImage } from "./types.js";
|
|
6
6
|
export type ManifestEntry = OptimizedImage;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import NextImage, { getImageProps as nextGetImageProps } from "next/image";
|
|
2
|
+
import NextImage, { getImageProps as nextGetImageProps } from "next/image.js";
|
|
3
3
|
import { getImageBlurSvg } from "./blur_svg.js";
|
|
4
4
|
import { ImgWithFallback } from "./img_with_fallback.js";
|
|
5
5
|
function pickVariant(entry, requestedWidth) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type LinkProps } from 'next/link';
|
|
1
|
+
import { type LinkProps } from 'next/link.js';
|
|
2
2
|
import { type ComponentProps } from 'react';
|
|
3
3
|
type NextLinkProps = Omit<ComponentProps<'a'>, keyof LinkProps> & Omit<LinkProps, 'locale'>;
|
|
4
4
|
declare const Link: import("react").ForwardRefExoticComponent<Omit<NextLinkProps, "ref"> & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import LinkComponent from 'next/link';
|
|
2
|
+
import LinkComponent from 'next/link.js';
|
|
3
3
|
import { forwardRef, } from 'react';
|
|
4
4
|
import config from '../../config/intl_config.js';
|
|
5
5
|
import { getLocaleCache } from '../../general/cache_variables.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { setLocaleCache, setMessageForLocaleCache } from "../../general/cache_variables.js";
|
|
3
3
|
import { getMessage } from "../functions/server.js";
|
|
4
|
-
import dynamic from "next/dynamic";
|
|
4
|
+
import dynamic from "next/dynamic.js";
|
|
5
5
|
import { localesSet } from "../../config/middleware.js";
|
|
6
6
|
import config from "../../config/intl_config.js";
|
|
7
7
|
import resolveRequiresConsent from "../../cookie_consent/gdpr_countries.js";
|
|
@@ -11,7 +11,7 @@ const LocationzationClientProvider = dynamic(() => import("../../client/componen
|
|
|
11
11
|
let authUserServerProviderModule;
|
|
12
12
|
export default async function LocationzationProvider({ language, messages, staticSafe = true, children }) {
|
|
13
13
|
if (!localesSet.has(language)) {
|
|
14
|
-
const { notFound } = await import("next/navigation");
|
|
14
|
+
const { notFound } = await import("next/navigation.js");
|
|
15
15
|
notFound();
|
|
16
16
|
}
|
|
17
17
|
if (language) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { setLocaleCache, setMessageForLocaleCache } from "../../general/cache_variables.js";
|
|
3
3
|
import { getMessage } from "../functions/server.js";
|
|
4
|
-
import dynamic from "next/dynamic";
|
|
4
|
+
import dynamic from "next/dynamic.js";
|
|
5
5
|
import { localesSet } from "../../config/middleware.js";
|
|
6
6
|
import config from "../../config/intl_config.js";
|
|
7
7
|
import resolveRequiresConsent from "../../cookie_consent/gdpr_countries.js";
|
|
@@ -10,7 +10,7 @@ import reportError from "../../error_handling/report_error.js";
|
|
|
10
10
|
const LocationzationClientProvider = dynamic(() => import("../../client/components/client_provider_static.js"));
|
|
11
11
|
export default async function LocationzationProvider({ language, messages, children }) {
|
|
12
12
|
if (!localesSet.has(language)) {
|
|
13
|
-
const { notFound } = await import("next/navigation");
|
|
13
|
+
const { notFound } = await import("next/navigation.js");
|
|
14
14
|
notFound();
|
|
15
15
|
}
|
|
16
16
|
if (config.firebaseAuth) {
|
|
@@ -48,7 +48,7 @@ export async function getCountry(input, generate, headerNames) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
try {
|
|
51
|
-
const { headers } = await import('next/headers');
|
|
51
|
+
const { headers } = await import('next/headers.js');
|
|
52
52
|
const h = await headers();
|
|
53
53
|
const country = extractFromHeaderNames(h, names);
|
|
54
54
|
if (country)
|
|
@@ -101,7 +101,7 @@ export async function getTimezone(input, fallback, generate, headerNames) {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
try {
|
|
104
|
-
const { headers } = await import('next/headers');
|
|
104
|
+
const { headers } = await import('next/headers.js');
|
|
105
105
|
const h = await headers();
|
|
106
106
|
const tz = extractFromHeaderNames(h, names);
|
|
107
107
|
if (tz)
|
|
@@ -19,7 +19,7 @@ async function iGetMessage(locale) {
|
|
|
19
19
|
}
|
|
20
20
|
catch {
|
|
21
21
|
if (!localesSet.has(locale)) {
|
|
22
|
-
const { notFound } = await import("next/navigation");
|
|
22
|
+
const { notFound } = await import("next/navigation.js");
|
|
23
23
|
notFound();
|
|
24
24
|
return {};
|
|
25
25
|
}
|
|
@@ -47,7 +47,7 @@ async function iGetLocale() {
|
|
|
47
47
|
}
|
|
48
48
|
try {
|
|
49
49
|
if (!nextHeadersModule) {
|
|
50
|
-
nextHeadersModule = await import("next/headers");
|
|
50
|
+
nextHeadersModule = await import("next/headers.js");
|
|
51
51
|
}
|
|
52
52
|
const cookieStore = await nextHeadersModule.cookies();
|
|
53
53
|
const localeCookie = cookieStore.get(localeCookieName);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NextResponse } from 'next/server';
|
|
1
|
+
import type { NextResponse } from 'next/server.js';
|
|
2
2
|
import type { Languages } from 'next/dist/lib/metadata/types/alternative-urls-types';
|
|
3
3
|
import type { Videos } from 'next/dist/lib/metadata/types/metadata-types';
|
|
4
4
|
import type { CookieConsentDialogProps } from '../cookie_consent/client/components/cookie_consent_dialog.js';
|