@inlang/paraglide-js 2.0.10 → 2.0.11
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/compiler/compiler-options.d.ts +9 -0
- package/dist/compiler/compiler-options.d.ts.map +1 -1
- package/dist/compiler/compiler-options.js +1 -0
- package/dist/compiler/runtime/create-runtime.d.ts +1 -0
- package/dist/compiler/runtime/create-runtime.d.ts.map +1 -1
- package/dist/compiler/runtime/create-runtime.js +1 -0
- package/dist/compiler/runtime/get-locale.test.js +2 -1
- package/dist/compiler/runtime/set-locale.d.ts.map +1 -1
- package/dist/compiler/runtime/set-locale.js +6 -3
- package/dist/compiler/runtime/set-locale.test.js +64 -8
- package/dist/compiler/runtime/variables.d.ts +2 -0
- package/dist/compiler/runtime/variables.d.ts.map +1 -1
- package/dist/compiler/runtime/variables.js +2 -0
- package/dist/services/env-variables/index.js +1 -1
- package/package.json +4 -4
|
@@ -12,6 +12,7 @@ export declare const defaultCompilerOptions: {
|
|
|
12
12
|
readonly strategy: ["cookie", "globalVariable", "baseLocale"];
|
|
13
13
|
readonly cookieName: "PARAGLIDE_LOCALE";
|
|
14
14
|
readonly cookieMaxAge: number;
|
|
15
|
+
readonly cookieDomain: "";
|
|
15
16
|
};
|
|
16
17
|
export type CompilerOptions = {
|
|
17
18
|
/**
|
|
@@ -101,6 +102,14 @@ export type CompilerOptions = {
|
|
|
101
102
|
* @default 60 * 60 * 24 * 400
|
|
102
103
|
*/
|
|
103
104
|
cookieMaxAge?: number;
|
|
105
|
+
/**
|
|
106
|
+
* The host to which the cookie will be sent.
|
|
107
|
+
* If null, this defaults to the host portion of the current document location and the cookie is not available on subdomains.
|
|
108
|
+
* Otherwise, subdomains are always included.
|
|
109
|
+
*
|
|
110
|
+
* @default window.location.hostname
|
|
111
|
+
*/
|
|
112
|
+
cookieDomain?: string;
|
|
104
113
|
/**
|
|
105
114
|
* The `additionalFiles` option is an array of paths to additional files that should be copied to the output directory.
|
|
106
115
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compiler-options.d.ts","sourceRoot":"","sources":["../../src/compiler/compiler-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,eAAO,MAAM,sBAAsB
|
|
1
|
+
{"version":3,"file":"compiler-options.d.ts","sourceRoot":"","sources":["../../src/compiler/compiler-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;CAcU,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG;IAC7B;;;;;;;;;;OAUG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;;;;;OAUG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAC/B;;;;;;;;;;;;;;OAcG;IACH,qCAAqC,CAAC,EAAE,OAAO,CAAC;IAChD;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC;;;;;;;;;;;;OAYG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACrC;;;;OAIG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC;;;;;;;;;OASG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC;;;;;;;;;;;;OAYG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiDG;IACH,eAAe,CAAC,EAAE,gBAAgB,GAAG,iBAAiB,CAAC;IACvD;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;OAIG;IACH,EAAE,CAAC,EAAE,GAAG,CAAC;CACT,CAAC"}
|
|
@@ -9,6 +9,7 @@ export declare function createRuntimeFile(args: {
|
|
|
9
9
|
strategy: NonNullable<CompilerOptions["strategy"]>;
|
|
10
10
|
cookieName: NonNullable<CompilerOptions["cookieName"]>;
|
|
11
11
|
cookieMaxAge: NonNullable<CompilerOptions["cookieMaxAge"]>;
|
|
12
|
+
cookieDomain: CompilerOptions["cookieDomain"];
|
|
12
13
|
urlPatterns?: CompilerOptions["urlPatterns"];
|
|
13
14
|
experimentalMiddlewareLocaleSplitting: CompilerOptions["experimentalMiddlewareLocaleSplitting"];
|
|
14
15
|
isServer: CompilerOptions["isServer"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-runtime.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/create-runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,eAAe,EAAE;QAChB,QAAQ,EAAE,WAAW,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC;QACnD,UAAU,EAAE,WAAW,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC;QACvD,YAAY,EAAE,WAAW,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC,CAAC;QAC3D,WAAW,CAAC,EAAE,eAAe,CAAC,aAAa,CAAC,CAAC;QAC7C,qCAAqC,EAAE,eAAe,CAAC,uCAAuC,CAAC,CAAC;QAChG,QAAQ,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;QACtC,eAAe,EAAE,eAAe,CAAC,iBAAiB,CAAC,CAAC;QACpD,wBAAwB,EAAE,WAAW,CACpC,eAAe,CAAC,0BAA0B,CAAC,CAC3C,CAAC;KACF,CAAC;CACF,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"create-runtime.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/create-runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,eAAe,EAAE;QAChB,QAAQ,EAAE,WAAW,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC;QACnD,UAAU,EAAE,WAAW,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC;QACvD,YAAY,EAAE,WAAW,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC,CAAC;QAC3D,YAAY,EAAE,eAAe,CAAC,cAAc,CAAC,CAAC;QAC9C,WAAW,CAAC,EAAE,eAAe,CAAC,aAAa,CAAC,CAAC;QAC7C,qCAAqC,EAAE,eAAe,CAAC,uCAAuC,CAAC,CAAC;QAChG,QAAQ,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;QACtC,eAAe,EAAE,eAAe,CAAC,iBAAiB,CAAC,CAAC;QACpD,wBAAwB,EAAE,WAAW,CACpC,eAAe,CAAC,0BAA0B,CAAC,CAC3C,CAAC;KACF,CAAC;CACF,GAAG,MAAM,CAkIT"}
|
|
@@ -35,6 +35,7 @@ ${injectCode("./variables.js")
|
|
|
35
35
|
.replace(`export const strategy = ["globalVariable"];`, `export const strategy = ${JSON.stringify(args.compilerOptions.strategy, null, 2)};`)
|
|
36
36
|
.replace(`<cookie-name>`, `${args.compilerOptions.cookieName}`)
|
|
37
37
|
.replace(`60 * 60 * 24 * 400`, `${args.compilerOptions.cookieMaxAge}`)
|
|
38
|
+
.replace(`<cookie-domain>`, `${args.compilerOptions.cookieDomain}`)
|
|
38
39
|
.replace(`export const TREE_SHAKE_COOKIE_STRATEGY_USED = false;`, `const TREE_SHAKE_COOKIE_STRATEGY_USED = ${args.compilerOptions.strategy.includes("cookie")};`)
|
|
39
40
|
.replace(`export const TREE_SHAKE_URL_STRATEGY_USED = false;`, `const TREE_SHAKE_URL_STRATEGY_USED = ${args.compilerOptions.strategy.includes("url")};`)
|
|
40
41
|
.replace(`export const TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED = false;`, `const TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED = ${args.compilerOptions.strategy.includes("globalVariable")};`)
|
|
@@ -185,6 +185,7 @@ test("initially sets the locale after resolving it for the first time", async ()
|
|
|
185
185
|
globalThis.window = {
|
|
186
186
|
// @ts-expect-error - global variable definition
|
|
187
187
|
location: {
|
|
188
|
+
hostname: "example.com",
|
|
188
189
|
href: "https://example.com/de/page",
|
|
189
190
|
},
|
|
190
191
|
};
|
|
@@ -195,6 +196,6 @@ test("initially sets the locale after resolving it for the first time", async ()
|
|
|
195
196
|
// First call to getLocale should resolve and set the locale
|
|
196
197
|
expect(runtime.getLocale()).toBe("de");
|
|
197
198
|
// Cookie should be set, proving that the locale was initially set
|
|
198
|
-
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=de; path=/; max-age=34560000");
|
|
199
|
+
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=de; path=/; max-age=34560000; domain=example.com");
|
|
199
200
|
expect(globalThis.window.location.href).toBe("https://example.com/de/page");
|
|
200
201
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-locale.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/set-locale.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"set-locale.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/set-locale.js"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;GAeG;AACH,sBAFU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,KAAK,IAAI,CAkFnE;AAgBK,uCAFI,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,QAIrC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getLocale } from "./get-locale.js";
|
|
2
2
|
import { localizeUrl } from "./localize-url.js";
|
|
3
|
-
import { cookieMaxAge, cookieName, isServer, localStorageKey, strategy, TREE_SHAKE_COOKIE_STRATEGY_USED, TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED, TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED, TREE_SHAKE_URL_STRATEGY_USED, } from "./variables.js";
|
|
3
|
+
import { cookieMaxAge, cookieName, cookieDomain, isServer, localStorageKey, strategy, TREE_SHAKE_COOKIE_STRATEGY_USED, TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED, TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED, TREE_SHAKE_URL_STRATEGY_USED, } from "./variables.js";
|
|
4
4
|
/**
|
|
5
5
|
* Set the locale.
|
|
6
6
|
*
|
|
@@ -41,11 +41,14 @@ export let setLocale = (newLocale, options) => {
|
|
|
41
41
|
_locale = newLocale;
|
|
42
42
|
}
|
|
43
43
|
else if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
|
|
44
|
-
if (isServer ||
|
|
44
|
+
if (isServer ||
|
|
45
|
+
typeof document === "undefined" ||
|
|
46
|
+
typeof window === "undefined") {
|
|
45
47
|
continue;
|
|
46
48
|
}
|
|
49
|
+
const domain = cookieDomain || window.location.hostname;
|
|
47
50
|
// set the cookie
|
|
48
|
-
document.cookie = `${cookieName}=${newLocale}; path=/; max-age=${cookieMaxAge}`;
|
|
51
|
+
document.cookie = `${cookieName}=${newLocale}; path=/; max-age=${cookieMaxAge}; domain=${domain}`;
|
|
49
52
|
}
|
|
50
53
|
else if (strat === "baseLocale") {
|
|
51
54
|
// nothing to be set here. baseLocale is only a fallback
|
|
@@ -7,7 +7,34 @@ test("sets the cookie to a different locale", async () => {
|
|
|
7
7
|
// @ts-expect-error - global variable definition
|
|
8
8
|
globalThis.window = {};
|
|
9
9
|
// @ts-expect-error - global variable definition
|
|
10
|
-
globalThis.window.location = {};
|
|
10
|
+
globalThis.window.location = { hostname: "example.com" };
|
|
11
|
+
globalThis.window.location.reload = vi.fn();
|
|
12
|
+
const runtime = await createParaglide({
|
|
13
|
+
project: await newProject({
|
|
14
|
+
settings: {
|
|
15
|
+
baseLocale: "en",
|
|
16
|
+
locales: ["en", "de"],
|
|
17
|
+
},
|
|
18
|
+
}),
|
|
19
|
+
compilerOptions: {
|
|
20
|
+
strategy: ["cookie"],
|
|
21
|
+
cookieName: "PARAGLIDE_LOCALE",
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
globalThis.document.cookie = "PARAGLIDE_LOCALE=en";
|
|
25
|
+
runtime.setLocale("de");
|
|
26
|
+
// set the locale
|
|
27
|
+
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=de; path=/; max-age=34560000; domain=example.com");
|
|
28
|
+
// reloads the site if window is available
|
|
29
|
+
expect(globalThis.window.location.reload).toBeCalled();
|
|
30
|
+
});
|
|
31
|
+
test("sets the cookie with explicit domain to a different locale navigating subdomain", async () => {
|
|
32
|
+
// @ts-expect-error - global variable definition
|
|
33
|
+
globalThis.document = {};
|
|
34
|
+
// @ts-expect-error - global variable definition
|
|
35
|
+
globalThis.window = {};
|
|
36
|
+
// @ts-expect-error - global variable definition
|
|
37
|
+
globalThis.window.location = { hostname: "web.example.com" };
|
|
11
38
|
globalThis.window.location.reload = vi.fn();
|
|
12
39
|
const runtime = await createParaglide({
|
|
13
40
|
project: await newProject({
|
|
@@ -19,12 +46,41 @@ test("sets the cookie to a different locale", async () => {
|
|
|
19
46
|
compilerOptions: {
|
|
20
47
|
strategy: ["cookie"],
|
|
21
48
|
cookieName: "PARAGLIDE_LOCALE",
|
|
49
|
+
cookieDomain: "example.com",
|
|
22
50
|
},
|
|
23
51
|
});
|
|
24
52
|
globalThis.document.cookie = "PARAGLIDE_LOCALE=en";
|
|
25
53
|
runtime.setLocale("de");
|
|
26
54
|
// set the locale
|
|
27
|
-
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=de; path=/; max-age=34560000");
|
|
55
|
+
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=de; path=/; max-age=34560000; domain=example.com");
|
|
56
|
+
// reloads the site if window is available
|
|
57
|
+
expect(globalThis.window.location.reload).toBeCalled();
|
|
58
|
+
});
|
|
59
|
+
test("sets the cookie with explicit domain to a different locale navigating domain", async () => {
|
|
60
|
+
// @ts-expect-error - global variable definition
|
|
61
|
+
globalThis.document = {};
|
|
62
|
+
// @ts-expect-error - global variable definition
|
|
63
|
+
globalThis.window = {};
|
|
64
|
+
// @ts-expect-error - global variable definition
|
|
65
|
+
globalThis.window.location = { hostname: "example.com" };
|
|
66
|
+
globalThis.window.location.reload = vi.fn();
|
|
67
|
+
const runtime = await createParaglide({
|
|
68
|
+
project: await newProject({
|
|
69
|
+
settings: {
|
|
70
|
+
baseLocale: "en",
|
|
71
|
+
locales: ["en", "de"],
|
|
72
|
+
},
|
|
73
|
+
}),
|
|
74
|
+
compilerOptions: {
|
|
75
|
+
strategy: ["cookie"],
|
|
76
|
+
cookieName: "PARAGLIDE_LOCALE",
|
|
77
|
+
cookieDomain: "example.com",
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
globalThis.document.cookie = "PARAGLIDE_LOCALE=en";
|
|
81
|
+
runtime.setLocale("de");
|
|
82
|
+
// set the locale
|
|
83
|
+
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=de; path=/; max-age=34560000; domain=example.com");
|
|
28
84
|
// reloads the site if window is available
|
|
29
85
|
expect(globalThis.window.location.reload).toBeCalled();
|
|
30
86
|
});
|
|
@@ -75,7 +131,7 @@ test("sets the cookie when it's an empty string", async () => {
|
|
|
75
131
|
/** @ts-expect-error - client side api */
|
|
76
132
|
globalThis.document = { cookie: "" };
|
|
77
133
|
runtime.setLocale("en");
|
|
78
|
-
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=en; path=/; max-age=34560000");
|
|
134
|
+
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=en; path=/; max-age=34560000; domain=example.com");
|
|
79
135
|
});
|
|
80
136
|
test("when strategy precedes URL, it should set the locale and re-direct to the URL", async () => {
|
|
81
137
|
const runtime = await createParaglide({
|
|
@@ -108,7 +164,7 @@ test("when strategy precedes URL, it should set the locale and re-direct to the
|
|
|
108
164
|
// Cookie strategy should determine locale as French
|
|
109
165
|
expect(runtime.getLocale()).toBe("fr");
|
|
110
166
|
runtime.setLocale("en");
|
|
111
|
-
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=en; path=/; max-age=34560000");
|
|
167
|
+
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=en; path=/; max-age=34560000; domain=example.com");
|
|
112
168
|
expect(globalThis.window.location.href).toBe("https://example.com/en/some-path");
|
|
113
169
|
});
|
|
114
170
|
// https://github.com/opral/inlang-paraglide-js/issues/430
|
|
@@ -118,7 +174,7 @@ test("should not reload when setting locale to current locale", async () => {
|
|
|
118
174
|
// @ts-expect-error - global variable definition
|
|
119
175
|
globalThis.window = {};
|
|
120
176
|
// @ts-expect-error - global variable definition
|
|
121
|
-
globalThis.window.location = {};
|
|
177
|
+
globalThis.window.location = { hostname: "example.com" };
|
|
122
178
|
globalThis.window.location.reload = vi.fn();
|
|
123
179
|
const runtime = await createParaglide({
|
|
124
180
|
project: await newProject({
|
|
@@ -136,12 +192,12 @@ test("should not reload when setting locale to current locale", async () => {
|
|
|
136
192
|
// Setting to the current locale (en)
|
|
137
193
|
runtime.setLocale("en");
|
|
138
194
|
// Cookie should remain unchanged
|
|
139
|
-
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=en; path=/; max-age=34560000");
|
|
195
|
+
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=en; path=/; max-age=34560000; domain=example.com");
|
|
140
196
|
// Should not trigger a reload
|
|
141
197
|
expect(globalThis.window.location.reload).not.toBeCalled();
|
|
142
198
|
// Setting to a different locale should still work
|
|
143
199
|
runtime.setLocale("de");
|
|
144
|
-
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=de; path=/; max-age=34560000");
|
|
200
|
+
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=de; path=/; max-age=34560000; domain=example.com");
|
|
145
201
|
expect(globalThis.window.location.reload).toBeCalled();
|
|
146
202
|
});
|
|
147
203
|
test("sets the locale to localStorage", async () => {
|
|
@@ -211,5 +267,5 @@ test("should set locale in all configured storage mechanisms regardless of which
|
|
|
211
267
|
// Verify that all storage mechanisms are updated
|
|
212
268
|
expect(globalThis.window.location.href).toBe("https://example.com/fr/page");
|
|
213
269
|
expect(globalThis.localStorage.setItem).toHaveBeenCalledWith("PARAGLIDE_LOCALE", "fr");
|
|
214
|
-
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=fr; path=/; max-age=34560000");
|
|
270
|
+
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=fr; path=/; max-age=34560000; domain=example.com");
|
|
215
271
|
});
|
|
@@ -32,6 +32,8 @@ export const cookieName: string;
|
|
|
32
32
|
/** @type {number} */
|
|
33
33
|
export const cookieMaxAge: number;
|
|
34
34
|
/** @type {string} */
|
|
35
|
+
export const cookieDomain: string;
|
|
36
|
+
/** @type {string} */
|
|
35
37
|
export const localStorageKey: string;
|
|
36
38
|
/**
|
|
37
39
|
* @type {Array<"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage">}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/variables.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/variables.js"],"names":[],"mappings":"AAwEA;;;;;;;;;GASG;AACH,wDAFW,0BAA0B,GAAG,SAAS,QAIhD;AApFD;;;;;;;GAOG;AACH,yBAA0B,IAAI,CAAC;AAE/B;;;;;;;GAOG;AACH,4CAA2D;AAE3D,qBAAqB;AACrB,yBADW,MAAM,CACyB;AAE1C,qBAAqB;AACrB,2BADW,MAAM,CAC8B;AAE/C,qBAAqB;AACrB,2BADW,MAAM,CAC6B;AAE9C,qBAAqB;AACrB,8BADW,MAAM,CACiC;AAElD;;GAEG;AACH,uBAFU,KAAK,CAAC,QAAQ,GAAG,YAAY,GAAG,gBAAgB,GAAG,KAAK,GAAG,mBAAmB,GAAG,cAAc,CAAC,CAE/D;AAE3C;;;;GAIG;AACH,0BAFU,KAAK,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CAAE,CAAC,CAE1C;AAE9B;;;;;;;;;;GAUG;AAEH;;;;;;;GAOG;AACH,oCAFU,0BAA0B,GAAG,SAAS,CAED;AAE/C,uCAAwC,KAAK,CAAC;AAE9C,oDAAqD,KAAK,CAAC;AAE3D,+BAAsD;AAgBtD,8CAA+C,KAAK,CAAC;AAErD,2CAA4C,KAAK,CAAC;AAElD,uDAAwD,KAAK,CAAC;AAE9D,0DAA2D,KAAK,CAAC;AAEjE,kDAAmD,KAAK,CAAC;AAEzD,qDAAsD,KAAK,CAAC;yCAnD/C;IACR,QAAQ,IAAI;QACV,MAAM,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,YAAY,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;KACzB,GAAG,SAAS,CAAC;IACf,GAAG,EAAE,CAAC,KAAK,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;KAAC,EAC3E,EAAE,EAAE,GAAG,KAAK,GAAG,CAAA;CACjB"}
|
|
@@ -21,6 +21,8 @@ export const cookieName = "<cookie-name>";
|
|
|
21
21
|
/** @type {number} */
|
|
22
22
|
export const cookieMaxAge = 60 * 60 * 24 * 400;
|
|
23
23
|
/** @type {string} */
|
|
24
|
+
export const cookieDomain = "<cookie-domain>";
|
|
25
|
+
/** @type {string} */
|
|
24
26
|
export const localStorageKey = "PARAGLIDE_LOCALE";
|
|
25
27
|
/**
|
|
26
28
|
* @type {Array<"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage">}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inlang/paraglide-js",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.11",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"json5": "2.2.3",
|
|
32
32
|
"unplugin": "^2.1.2",
|
|
33
33
|
"urlpattern-polyfill": "^10.0.0",
|
|
34
|
-
"@inlang/
|
|
35
|
-
"@inlang/
|
|
34
|
+
"@inlang/sdk": "2.4.7",
|
|
35
|
+
"@inlang/recommend-sherlock": "0.2.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@eslint/js": "^9.18.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"vitest": "2.1.8",
|
|
53
53
|
"@inlang/plugin-message-format": "4.0.0",
|
|
54
54
|
"@opral/tsconfig": "1.1.0",
|
|
55
|
-
"@inlang/paraglide-js": "2.0.
|
|
55
|
+
"@inlang/paraglide-js": "2.0.11"
|
|
56
56
|
},
|
|
57
57
|
"keywords": [
|
|
58
58
|
"inlang",
|