@inlang/paraglide-js 2.20.2 → 2.21.0
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/bundler-plugins/rolldown.d.ts +1 -1
- package/dist/bundler-plugins/rollup.d.ts +1 -1
- package/dist/bundler-plugins/vite.d.ts +1 -1
- package/dist/cli/defaults.d.ts.map +1 -1
- package/dist/cli/steps/initialize-inlang-project.d.ts.map +1 -1
- package/dist/cli/steps/update-ts-config.d.ts.map +1 -1
- package/dist/cli/steps/update-ts-config.js.map +1 -1
- package/dist/cli/utils.d.ts.map +1 -1
- package/dist/cli/utils.js.map +1 -1
- package/dist/compiler/compile-bundle.d.ts.map +1 -1
- package/dist/compiler/compile-message.d.ts.map +1 -1
- package/dist/compiler/compile-pattern.d.ts.map +1 -1
- package/dist/compiler/compile-project.d.ts.map +1 -1
- package/dist/compiler/compile.bench.js.map +1 -1
- package/dist/compiler/compiler-options.d.ts +5 -0
- package/dist/compiler/compiler-options.d.ts.map +1 -1
- package/dist/compiler/emit-ts-declarations.d.ts.map +1 -1
- package/dist/compiler/emit-ts-declarations.interop.test.d.ts +2 -0
- package/dist/compiler/emit-ts-declarations.interop.test.d.ts.map +1 -0
- package/dist/compiler/emit-ts-declarations.interop.test.js +62 -0
- package/dist/compiler/emit-ts-declarations.interop.test.js.map +1 -0
- package/dist/compiler/emit-ts-declarations.js +150 -0
- package/dist/compiler/emit-ts-declarations.js.map +1 -1
- package/dist/compiler/emit-ts-declarations.test.d.ts +2 -0
- package/dist/compiler/emit-ts-declarations.test.d.ts.map +1 -0
- package/dist/compiler/emit-ts-declarations.test.js +181 -0
- package/dist/compiler/emit-ts-declarations.test.js.map +1 -0
- package/dist/compiler/resolve-tsc-js-path.d.ts +10 -0
- package/dist/compiler/resolve-tsc-js-path.d.ts.map +1 -0
- package/dist/compiler/resolve-tsc-js-path.js +23 -0
- package/dist/compiler/resolve-tsc-js-path.js.map +1 -0
- package/dist/compiler/runtime/check-locale.d.ts +3 -3
- package/dist/compiler/runtime/check-locale.d.ts.map +1 -1
- package/dist/compiler/runtime/create-runtime.js.map +1 -1
- package/dist/compiler/runtime/extract-locale-from-cookie.d.ts +2 -2
- package/dist/compiler/runtime/extract-locale-from-cookie.d.ts.map +1 -1
- package/dist/compiler/runtime/extract-locale-from-header.d.ts +1 -1
- package/dist/compiler/runtime/extract-locale-from-header.d.ts.map +1 -1
- package/dist/compiler/runtime/extract-locale-from-navigator.d.ts +1 -1
- package/dist/compiler/runtime/extract-locale-from-navigator.d.ts.map +1 -1
- package/dist/compiler/runtime/extract-locale-from-request-async.d.ts +33 -2
- package/dist/compiler/runtime/extract-locale-from-request-async.d.ts.map +1 -1
- package/dist/compiler/runtime/extract-locale-from-request.d.ts +36 -4
- package/dist/compiler/runtime/extract-locale-from-request.d.ts.map +1 -1
- package/dist/compiler/runtime/extract-locale-from-url.d.ts +1 -1
- package/dist/compiler/runtime/extract-locale-from-url.d.ts.map +1 -1
- package/dist/compiler/runtime/generate-static-localized-urls.d.ts +1 -1
- package/dist/compiler/runtime/generate-static-localized-urls.d.ts.map +1 -1
- package/dist/compiler/runtime/get-locale.d.ts +36 -3
- package/dist/compiler/runtime/get-locale.d.ts.map +1 -1
- package/dist/compiler/runtime/get-text-direction.d.ts +1 -1
- package/dist/compiler/runtime/get-text-direction.d.ts.map +1 -1
- package/dist/compiler/runtime/get-url-origin.d.ts +10 -2
- package/dist/compiler/runtime/get-url-origin.d.ts.map +1 -1
- package/dist/compiler/runtime/localize-href.d.ts +3 -3
- package/dist/compiler/runtime/localize-href.d.ts.map +1 -1
- package/dist/compiler/runtime/localize-url.d.ts +4 -4
- package/dist/compiler/runtime/localize-url.d.ts.map +1 -1
- package/dist/compiler/runtime/set-locale.d.ts +19 -5
- package/dist/compiler/runtime/set-locale.d.ts.map +1 -1
- package/dist/compiler/runtime/should-redirect.d.ts +29 -29
- package/dist/compiler/runtime/should-redirect.d.ts.map +1 -1
- package/dist/compiler/runtime/strategy.d.ts +36 -36
- package/dist/compiler/runtime/strategy.d.ts.map +1 -1
- package/dist/compiler/runtime/track-message-call.d.ts +1 -1
- package/dist/compiler/runtime/track-message-call.d.ts.map +1 -1
- package/dist/compiler/runtime/type-definitions.d.ts +144 -43
- package/dist/compiler/runtime/type-definitions.d.ts.map +1 -1
- package/dist/compiler/runtime/type.test.js.map +1 -1
- package/dist/compiler/runtime/variables.d.ts +60 -60
- package/dist/compiler/runtime/variables.d.ts.map +1 -1
- package/dist/compiler/server/create-server-file.js.map +1 -1
- package/dist/compiler/server/middleware.d.ts +1 -1
- package/dist/compiler/server/middleware.d.ts.map +1 -1
- package/dist/services/codegen/quotes.d.ts.map +1 -1
- package/dist/services/env-variables/create-index-file.d.ts +8 -0
- package/dist/services/env-variables/create-index-file.d.ts.map +1 -1
- package/dist/services/env-variables/create-index-file.js.map +1 -1
- package/dist/services/env-variables/index.d.ts.map +1 -1
- package/dist/services/env-variables/index.js +1 -1
- package/dist/services/file-watching/tracked-fs.js.map +1 -1
- package/dist/services/logger/index.d.ts.map +1 -1
- package/dist/services/logger/index.js.map +1 -1
- package/dist/utilities/detect-json-formatting.d.ts.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { beforeEach, expect, test, vi } from "vitest";
|
|
2
|
+
import { createProject as typescriptProject, ts } from "@ts-morph/bootstrap";
|
|
3
|
+
import { insertBundleNested, loadProjectInMemory, newProject, } from "@inlang/sdk";
|
|
4
|
+
import { createRequire } from "node:module";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { compileProject } from "./compile-project.js";
|
|
7
|
+
// TypeScript 7 (the Go-based compiler, npm `latest` since 7.0.2) no longer
|
|
8
|
+
// ships the in-process compiler API. Its main entry point only exports
|
|
9
|
+
// `version` and `versionMajorMinor` — no `createProgram`, no `ScriptTarget`,
|
|
10
|
+
// no `ModuleKind`. Emitting declarations must go through the `tsc` CLI
|
|
11
|
+
// instead. https://github.com/opral/paraglide-js/issues/711
|
|
12
|
+
//
|
|
13
|
+
// The repo's own `typescript` dev dependency stays on 5.x for the existing
|
|
14
|
+
// tests; this file swaps in the aliased TypeScript 7 package to simulate a
|
|
15
|
+
// user who upgraded.
|
|
16
|
+
//
|
|
17
|
+
// Note: vitest wraps factory mocks in a proxy that throws on missing exports.
|
|
18
|
+
// The real TypeScript 7 module returns `undefined` for them instead, so the
|
|
19
|
+
// classic compiler API surface is stubbed out explicitly to mirror that.
|
|
20
|
+
vi.mock("typescript", async () => {
|
|
21
|
+
const actual = await vi.importActual("typescript-go");
|
|
22
|
+
return {
|
|
23
|
+
...actual,
|
|
24
|
+
createProgram: undefined,
|
|
25
|
+
createCompilerHost: undefined,
|
|
26
|
+
createSourceFile: undefined,
|
|
27
|
+
ScriptTarget: undefined,
|
|
28
|
+
ScriptKind: undefined,
|
|
29
|
+
ModuleKind: undefined,
|
|
30
|
+
ModuleResolutionKind: undefined,
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
// In production, the `typescript` module and the `tsc` CLI resolve to the
|
|
34
|
+
// same package. In this test the module is mocked with the TypeScript 7
|
|
35
|
+
// alias, so the CLI resolution must point at that alias too — otherwise it
|
|
36
|
+
// would find the repo's TypeScript 5 dev dependency. Mutable so the error
|
|
37
|
+
// path can be tested with a broken resolution.
|
|
38
|
+
const tscResolution = vi.hoisted(() => ({ tscJsPath: "" }));
|
|
39
|
+
vi.mock("./resolve-tsc-js-path.js", () => ({
|
|
40
|
+
resolveTscJsPath: () => tscResolution.tscJsPath,
|
|
41
|
+
}));
|
|
42
|
+
const typescriptGoTscJsPath = path.join(path.dirname(createRequire(import.meta.url).resolve("typescript-go/package.json")), "lib", "tsc.js");
|
|
43
|
+
beforeEach(() => {
|
|
44
|
+
tscResolution.tscJsPath = typescriptGoTscJsPath;
|
|
45
|
+
});
|
|
46
|
+
async function newProjectWithMessages() {
|
|
47
|
+
const project = await loadProjectInMemory({
|
|
48
|
+
blob: await newProject({
|
|
49
|
+
settings: {
|
|
50
|
+
locales: ["en"],
|
|
51
|
+
baseLocale: "en",
|
|
52
|
+
},
|
|
53
|
+
}),
|
|
54
|
+
});
|
|
55
|
+
// a message id that is not a valid JS identifier -> quoted export alias
|
|
56
|
+
const quotedAliasBundle = {
|
|
57
|
+
id: "greeting.hello",
|
|
58
|
+
declarations: [],
|
|
59
|
+
messages: [
|
|
60
|
+
{
|
|
61
|
+
id: "greeting.hello_en",
|
|
62
|
+
bundleId: "greeting.hello",
|
|
63
|
+
locale: "en",
|
|
64
|
+
selectors: [],
|
|
65
|
+
variants: [
|
|
66
|
+
{
|
|
67
|
+
id: "greeting.hello_en_variant",
|
|
68
|
+
messageId: "greeting.hello",
|
|
69
|
+
matches: [],
|
|
70
|
+
pattern: [{ type: "text", value: "Hello" }],
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
};
|
|
76
|
+
// a message with an input so the declarations carry a typed parameter
|
|
77
|
+
const parameterizedBundle = {
|
|
78
|
+
id: "balance",
|
|
79
|
+
declarations: [{ type: "input-variable", name: "amount" }],
|
|
80
|
+
messages: [
|
|
81
|
+
{
|
|
82
|
+
id: "balance_en",
|
|
83
|
+
bundleId: "balance",
|
|
84
|
+
locale: "en",
|
|
85
|
+
selectors: [],
|
|
86
|
+
variants: [
|
|
87
|
+
{
|
|
88
|
+
id: "balance_en_variant",
|
|
89
|
+
messageId: "balance",
|
|
90
|
+
matches: [],
|
|
91
|
+
pattern: [
|
|
92
|
+
{ type: "text", value: "You have " },
|
|
93
|
+
{
|
|
94
|
+
type: "expression",
|
|
95
|
+
arg: { type: "variable-reference", name: "amount" },
|
|
96
|
+
},
|
|
97
|
+
{ type: "text", value: " coins." },
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
};
|
|
104
|
+
await insertBundleNested(project.db, quotedAliasBundle);
|
|
105
|
+
await insertBundleNested(project.db, parameterizedBundle);
|
|
106
|
+
return project;
|
|
107
|
+
}
|
|
108
|
+
test("emitTsDeclarations works with TypeScript 7 (tsgo)", async () => {
|
|
109
|
+
const project = await newProjectWithMessages();
|
|
110
|
+
for (const outputStructure of [
|
|
111
|
+
"message-modules",
|
|
112
|
+
"locale-modules",
|
|
113
|
+
]) {
|
|
114
|
+
const output = await compileProject({
|
|
115
|
+
project,
|
|
116
|
+
compilerOptions: {
|
|
117
|
+
emitTsDeclarations: true,
|
|
118
|
+
outputStructure,
|
|
119
|
+
// path-traversing keys (incl. Windows separators) must be
|
|
120
|
+
// silently skipped like on the compiler-API path — neither
|
|
121
|
+
// escaping the temp dir nor failing the completeness check
|
|
122
|
+
additionalFiles: {
|
|
123
|
+
"../escape.js": "export const escape = 1;",
|
|
124
|
+
"foo\\..\\..\\escape.js": "export const escape = 1;",
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
expect(output["../escape.d.ts"]).toBeUndefined();
|
|
129
|
+
expect(output["foo\\..\\..\\escape.d.ts"]).toBeUndefined();
|
|
130
|
+
expect(output).toHaveProperty("runtime.d.ts");
|
|
131
|
+
expect(output).toHaveProperty("messages.d.ts");
|
|
132
|
+
expect(output).toHaveProperty("registry.d.ts");
|
|
133
|
+
expect(output["runtime.d.ts"]).toContain("getLocale");
|
|
134
|
+
// TypeScript 5's declaration emitter drops the quotes around export
|
|
135
|
+
// aliases that are not valid identifiers (worked around by a custom
|
|
136
|
+
// transformer on the compiler-API path); tsgo emits them correctly.
|
|
137
|
+
const declarationFile = outputStructure === "message-modules"
|
|
138
|
+
? "messages/greeting_hello.d.ts"
|
|
139
|
+
: "messages/_index.d.ts";
|
|
140
|
+
expect(output[declarationFile]).toContain(`as "greeting.hello"`);
|
|
141
|
+
// the emitted declarations must typecheck for a consumer
|
|
142
|
+
// (@ts-morph/bootstrap bundles its own compiler and is unaffected
|
|
143
|
+
// by the TypeScript 7 mock above)
|
|
144
|
+
const tsProject = await typescriptProject({
|
|
145
|
+
useInMemoryFileSystem: true,
|
|
146
|
+
compilerOptions: {
|
|
147
|
+
module: ts.ModuleKind.Node16,
|
|
148
|
+
moduleResolution: ts.ModuleResolutionKind.Node16,
|
|
149
|
+
strict: true,
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
for (const [fileName, code] of Object.entries(output)) {
|
|
153
|
+
if (fileName.endsWith(".d.ts")) {
|
|
154
|
+
tsProject.createSourceFile(fileName, code);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
tsProject.createSourceFile("test.ts", `
|
|
158
|
+
import { "greeting.hello" as greetingHello, balance } from "./messages.js";
|
|
159
|
+
|
|
160
|
+
greetingHello() satisfies string;
|
|
161
|
+
balance({ amount: 5 }) satisfies string;
|
|
162
|
+
`);
|
|
163
|
+
const program = tsProject.createProgram();
|
|
164
|
+
const diagnostics = ts.getPreEmitDiagnostics(program);
|
|
165
|
+
for (const diagnostic of diagnostics) {
|
|
166
|
+
console.error(diagnostic.messageText, diagnostic.file?.fileName);
|
|
167
|
+
}
|
|
168
|
+
expect(diagnostics.length).toEqual(0);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
test("emitTsDeclarations throws a descriptive error when the tsc CLI produces no declarations", async () => {
|
|
172
|
+
tscResolution.tscJsPath = path.join(path.dirname(typescriptGoTscJsPath), "does-not-exist.js");
|
|
173
|
+
const project = await newProjectWithMessages();
|
|
174
|
+
await expect(compileProject({
|
|
175
|
+
project,
|
|
176
|
+
compilerOptions: {
|
|
177
|
+
emitTsDeclarations: true,
|
|
178
|
+
},
|
|
179
|
+
})).rejects.toThrow(/did not produce a declaration file for every compiled/);
|
|
180
|
+
});
|
|
181
|
+
//# sourceMappingURL=emit-ts-declarations.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit-ts-declarations.test.js","sourceRoot":"","sources":["../../src/compiler/emit-ts-declarations.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA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,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;YACtC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAClE,CAAC;QACD,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;AACF,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,yFAAyF,EAAE,KAAK,IAAI,EAAE;IAC1G,aAAa,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,CAClC,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,EACnC,mBAAmB,CACnB,CAAC;IAEF,MAAM,OAAO,GAAG,MAAM,sBAAsB,EAAE,CAAC;IAE/C,MAAM,MAAM,CACX,cAAc,CAAC;QACd,OAAO;QACP,eAAe,EAAE;YAChB,kBAAkB,EAAE,IAAI;SACxB;KACD,CAAC,CACF,CAAC,OAAO,CAAC,OAAO,CAAC,uDAAuD,CAAC,CAAC;AAC5E,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves the path to the `tsc` CLI entry point of the installed
|
|
3
|
+
* `typescript` package.
|
|
4
|
+
*
|
|
5
|
+
* Lives in its own module so tests can point the TypeScript 7 emit
|
|
6
|
+
* path at a different TypeScript installation than the one the repo
|
|
7
|
+
* itself depends on.
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveTscJsPath(): string;
|
|
10
|
+
//# sourceMappingURL=resolve-tsc-js-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-tsc-js-path.d.ts","sourceRoot":"","sources":["../../src/compiler/resolve-tsc-js-path.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAYzC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
/**
|
|
5
|
+
* Resolves the path to the `tsc` CLI entry point of the installed
|
|
6
|
+
* `typescript` package.
|
|
7
|
+
*
|
|
8
|
+
* Lives in its own module so tests can point the TypeScript 7 emit
|
|
9
|
+
* path at a different TypeScript installation than the one the repo
|
|
10
|
+
* itself depends on.
|
|
11
|
+
*/
|
|
12
|
+
export function resolveTscJsPath() {
|
|
13
|
+
const require = createRequire(import.meta.url);
|
|
14
|
+
const packageJsonPath = require.resolve("typescript/package.json");
|
|
15
|
+
const tscJsPath = path.join(path.dirname(packageJsonPath), "lib", "tsc.js");
|
|
16
|
+
// `lib/tsc.js` is internal package layout rather than a public export, so
|
|
17
|
+
// fail with a pointed error if a future TypeScript version moves it.
|
|
18
|
+
if (existsSync(tscJsPath) === false) {
|
|
19
|
+
throw new Error(`Paraglide's "emitTsDeclarations" option could not locate TypeScript's "tsc" CLI at ${tscJsPath}. As a workaround, install TypeScript 5 or 6, or disable "emitTsDeclarations".`);
|
|
20
|
+
}
|
|
21
|
+
return tscJsPath;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=resolve-tsc-js-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-tsc-js-path.js","sourceRoot":"","sources":["../../src/compiler/resolve-tsc-js-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB;IAC/B,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/C,MAAM,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACnE,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC5E,0EAA0E;IAC1E,qEAAqE;IACrE,IAAI,UAAU,CAAC,SAAS,CAAC,KAAK,KAAK,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CACd,sFAAsF,SAAS,gFAAgF,CAC/K,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @param {unknown} value
|
|
5
5
|
* @returns {Locale | undefined}
|
|
6
6
|
*/
|
|
7
|
-
export function toLocale(value: unknown): Locale | undefined;
|
|
7
|
+
export declare function toLocale(value: unknown): Locale | undefined;
|
|
8
8
|
/**
|
|
9
9
|
* Check if something is an available locale with the canonical project casing.
|
|
10
10
|
*
|
|
@@ -20,7 +20,7 @@ export function toLocale(value: unknown): Locale | undefined;
|
|
|
20
20
|
* @param {unknown} locale
|
|
21
21
|
* @returns {locale is Locale}
|
|
22
22
|
*/
|
|
23
|
-
export function isLocale(locale: unknown): locale is Locale;
|
|
23
|
+
export declare function isLocale(locale: unknown): locale is Locale;
|
|
24
24
|
/**
|
|
25
25
|
* Asserts that the input can be normalized to a locale.
|
|
26
26
|
*
|
|
@@ -28,5 +28,5 @@ export function isLocale(locale: unknown): locale is Locale;
|
|
|
28
28
|
* @returns {Locale} The input normalized to a Locale.
|
|
29
29
|
* @throws {Error} If the input is not a locale.
|
|
30
30
|
*/
|
|
31
|
-
export function assertIsLocale(input: unknown): Locale;
|
|
31
|
+
export declare function assertIsLocale(input: unknown): Locale;
|
|
32
32
|
//# sourceMappingURL=check-locale.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-locale.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/check-locale.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,
|
|
1
|
+
{"version":3,"file":"check-locale.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/check-locale.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAHnB,OAGmB,GAFjB,MAAM,GAAG,SAAS,CAc9B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAHpB,OAGoB,GAFlB,MAAM,IAAI,MAAM,CAI5B;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAJzB,OAIyB,GAHvB,MAAM,CASlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-runtime.js","sourceRoot":"","sources":["../../../src/compiler/runtime/create-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AAGzB;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAkBjC;IACA,MAAM,WAAW,GAAG,IAAI,CAAC,eAAe,CAAC,WAAW,IAAI,EAAE,CAAC;IAC3D,MAAM,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC,eAAe,IAAI,EAAE,CAAC;IAEnE,IAAI,qBAAqB,GAAG,KAAK,CAAC;IAElC,+DAA+D;IAC/D,IAAI,IAAI,CAAC,eAAe,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;QACpD,qBAAqB,GAAG,IAAI,CAAC;QAC7B,WAAW,CAAC,IAAI,CAAC;YAChB,OAAO,EAAE,2CAA2C;YACpD,SAAS,EAAE,EAAE;SACb,CAAC,CAAC;QACH,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACnC,IAAI,MAAM,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChC,SAAS;YACV,CAAC;YACD,WAAW,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC;gBAC9B,MAAM;gBACN,kCAAkC,MAAM,aAAa;aACrD,CAAC,CAAC;QACJ,CAAC;QACD,WAAW,CAAC,CAAC,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AA4B,UAAU,KAAK,EAAE,GAAG,CAAC,EAC5D,YAAY,UAAU,EAAE,CACxB,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AACjB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Clears the cached locale from `document.cookie`.
|
|
3
3
|
*/
|
|
4
|
-
export function clearLocaleCookieCache(): void;
|
|
4
|
+
export declare function clearLocaleCookieCache(): void;
|
|
5
5
|
/**
|
|
6
6
|
* Extracts a cookie from the document.
|
|
7
7
|
*
|
|
@@ -10,5 +10,5 @@ export function clearLocaleCookieCache(): void;
|
|
|
10
10
|
*
|
|
11
11
|
* @returns {Locale | undefined}
|
|
12
12
|
*/
|
|
13
|
-
export function extractLocaleFromCookie(): Locale | undefined;
|
|
13
|
+
export declare function extractLocaleFromCookie(): Locale | undefined;
|
|
14
14
|
//# sourceMappingURL=extract-locale-from-cookie.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-locale-from-cookie.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/extract-locale-from-cookie.js"],"names":[],"mappings":"AAYA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"extract-locale-from-cookie.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/extract-locale-from-cookie.js"],"names":[],"mappings":"AAYA;;GAEG;AACH,wBAAgB,sBAAsB,SAErC;AAUD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,IAF1B,MAAM,GAAG,SAAS,CAc9B"}
|
|
@@ -10,5 +10,5 @@
|
|
|
10
10
|
* @param {Request} request - The request object to extract the locale from.
|
|
11
11
|
* @returns {Locale | undefined} The negotiated preferred language.
|
|
12
12
|
*/
|
|
13
|
-
export function extractLocaleFromHeader(request: Request): Locale | undefined;
|
|
13
|
+
export declare function extractLocaleFromHeader(request: Request): Locale | undefined;
|
|
14
14
|
//# sourceMappingURL=extract-locale-from-header.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-locale-from-header.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/extract-locale-from-header.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,
|
|
1
|
+
{"version":3,"file":"extract-locale-from-header.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/extract-locale-from-header.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAHpC,OAGoC,GAFlC,MAAM,GAAG,SAAS,CAoC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-locale-from-navigator.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/extract-locale-from-navigator.js"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,
|
|
1
|
+
{"version":3,"file":"extract-locale-from-navigator.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/extract-locale-from-navigator.js"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,IAF7B,MAAM,GAAG,SAAS,CAyB9B"}
|
|
@@ -1,4 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Asynchronously extracts a locale from a request.
|
|
3
|
+
*
|
|
4
|
+
* This function supports async custom server strategies, unlike the synchronous
|
|
5
|
+
* `extractLocaleFromRequest`. Use this function when you have custom server strategies
|
|
6
|
+
* that need to perform asynchronous operations (like database calls) in their getLocale method.
|
|
7
|
+
*
|
|
8
|
+
* The function first processes any custom server strategies asynchronously, then falls back
|
|
9
|
+
* to the synchronous `extractLocaleFromRequest` for all other strategies.
|
|
10
|
+
*
|
|
11
|
+
* @see {@link https://github.com/opral/inlang-paraglide-js/issues/527#issuecomment-2978151022}
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* // Basic usage
|
|
15
|
+
* const locale = await extractLocaleFromRequestAsync(request);
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // With custom async server strategy
|
|
19
|
+
* defineCustomServerStrategy("custom-database", {
|
|
20
|
+
* getLocale: async (request) => {
|
|
21
|
+
* const userId = extractUserIdFromRequest(request);
|
|
22
|
+
* return await getUserLocaleFromDatabase(userId);
|
|
23
|
+
* }
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* const locale = await extractLocaleFromRequestAsync(request);
|
|
27
|
+
*
|
|
28
|
+
* @param {Request} request - The request object to extract the locale from.
|
|
29
|
+
* @param {{ effectiveRequestUrl?: string | URL }} [options] - Effective request URL to use for route matching and locale detection with the URL strategy.
|
|
30
|
+
* @returns {Promise<Locale>} The extracted locale.
|
|
31
|
+
*/
|
|
32
|
+
export declare const extractLocaleFromRequestAsync: (request: Request, options?: {
|
|
2
33
|
effectiveRequestUrl?: string | URL;
|
|
3
|
-
})
|
|
34
|
+
}) => Promise<Locale>;
|
|
4
35
|
//# sourceMappingURL=extract-locale-from-request-async.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-locale-from-request-async.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/extract-locale-from-request-async.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extract-locale-from-request-async.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/extract-locale-from-request-async.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,6BAA6B,YAJ/B,OAAO,YACP;IAAE,mBAAmB,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,KACpC,OAAO,CAAC,MAAM,CA8B1B,CAAC"}
|
|
@@ -1,10 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
export function extractLocaleFromRequestWithStrategies(request: Request, strategies: typeof strategy, url?: string | URL): Locale;
|
|
1
|
+
import { strategy } from "./variables.js";
|
|
3
2
|
export type ExtractLocaleFromRequestOptions = {
|
|
4
3
|
/**
|
|
5
4
|
* - Effective request URL to use for route matching and locale detection with the URL strategy.
|
|
6
5
|
*/
|
|
7
|
-
effectiveRequestUrl?: string | URL
|
|
6
|
+
effectiveRequestUrl?: string | URL;
|
|
8
7
|
};
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {object} ExtractLocaleFromRequestOptions
|
|
10
|
+
* @property {string | URL} [effectiveRequestUrl] - Effective request URL to use for route matching and locale detection with the URL strategy.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Extracts a locale from a request.
|
|
14
|
+
*
|
|
15
|
+
* Use the function on the server to extract the locale
|
|
16
|
+
* from a request.
|
|
17
|
+
*
|
|
18
|
+
* The function goes through the strategies in the order
|
|
19
|
+
* they are defined. If a strategy returns an invalid locale,
|
|
20
|
+
* it will fall back to the next strategy.
|
|
21
|
+
*
|
|
22
|
+
* Note: Custom server strategies are not supported in this synchronous version.
|
|
23
|
+
* Use `extractLocaleFromRequestAsync` if you need custom server strategies with async getLocale methods.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* const locale = extractLocaleFromRequest(request);
|
|
27
|
+
*
|
|
28
|
+
* @param {Request} request
|
|
29
|
+
* @param {ExtractLocaleFromRequestOptions} [options]
|
|
30
|
+
* @returns {Locale}
|
|
31
|
+
*/
|
|
32
|
+
export declare const extractLocaleFromRequest: (request: Request, options?: ExtractLocaleFromRequestOptions) => Locale;
|
|
33
|
+
/**
|
|
34
|
+
* Extracts a locale from a request using the provided strategy order.
|
|
35
|
+
*
|
|
36
|
+
* @param {Request} request
|
|
37
|
+
* @param {typeof strategy} strategies
|
|
38
|
+
* @param {string | URL} [url]
|
|
39
|
+
* @returns {Locale}
|
|
40
|
+
*/
|
|
41
|
+
export declare const extractLocaleFromRequestWithStrategies: (request: Request, strategies: typeof strategy, url?: string | URL) => Locale;
|
|
10
42
|
//# sourceMappingURL=extract-locale-from-request.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-locale-from-request.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/extract-locale-from-request.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extract-locale-from-request.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/extract-locale-from-request.js"],"names":[],"mappings":"AAIA,OAAO,EAIN,QAAQ,EAIR,MAAM,gBAAgB,CAAC;AAGrB,YAAkB,+BAA+B,GACjD;;;;IAA0B,mBAAmB,AAA7C,CACF,EADa,MAAM,GAAG,GAAG,CACzB;CAAA,CAAA;AAHD;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,wBAAwB,YAJ1B,OAAO,YACP,+BAA+B,KAC7B,MAYZ,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,sCAAsC,YALxC,OAAO,cACP,OAAO,QAAQ,QACf,MAAM,GAAG,GAAG,KACV,MA+CZ,CAAC"}
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
* @param {URL|string} url - The full URL from which to extract the locale.
|
|
9
9
|
* @returns {Locale|undefined} The extracted locale, or undefined if no locale is found.
|
|
10
10
|
*/
|
|
11
|
-
export function extractLocaleFromUrl(url: URL | string): Locale | undefined;
|
|
11
|
+
export declare function extractLocaleFromUrl(url: URL | string): Locale | undefined;
|
|
12
12
|
//# sourceMappingURL=extract-locale-from-url.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-locale-from-url.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/extract-locale-from-url.js"],"names":[],"mappings":"AAkBA;;;;;;;;;GASG;AACH,
|
|
1
|
+
{"version":3,"file":"extract-locale-from-url.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/extract-locale-from-url.js"],"names":[],"mappings":"AAkBA;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAH7B,GAAG,GAAC,MAGyB,GAF3B,MAAM,GAAC,SAAS,CAmC5B"}
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
* @returns {URL[]} Array of URL objects representing all localized variants.
|
|
42
42
|
* The order follows each input URL with all its locale variants before moving to the next URL.
|
|
43
43
|
*/
|
|
44
|
-
export function generateStaticLocalizedUrls(urls: (string | URL)[]): URL[];
|
|
44
|
+
export declare function generateStaticLocalizedUrls(urls: (string | URL)[]): URL[];
|
|
45
45
|
//# sourceMappingURL=generate-static-localized-urls.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-static-localized-urls.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/generate-static-localized-urls.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,
|
|
1
|
+
{"version":3,"file":"generate-static-localized-urls.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/generate-static-localized-urls.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EANrC,CAAC,MAAM,GAAG,GAAG,CAAC,EAMuB,GAHnC,GAAG,EAAE,CAmFjB"}
|
|
@@ -1,10 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the current locale.
|
|
3
|
+
*
|
|
4
|
+
* The locale is resolved using your configured strategies (URL, cookie, localStorage, etc.)
|
|
5
|
+
* in the order they are defined. In SSR contexts, the locale is retrieved from AsyncLocalStorage
|
|
6
|
+
* which is set by the `paraglideMiddleware()`.
|
|
7
|
+
*
|
|
8
|
+
* @see https://paraglidejs.com/strategy - Configure locale detection strategies
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* if (getLocale() === 'de') {
|
|
12
|
+
* console.log('Germany 🇩🇪');
|
|
13
|
+
* } else if (getLocale() === 'nl') {
|
|
14
|
+
* console.log('Netherlands 🇳🇱');
|
|
15
|
+
* }
|
|
16
|
+
*
|
|
17
|
+
* @returns {Locale} The current locale.
|
|
18
|
+
*/
|
|
19
|
+
export declare let getLocale: () => Locale;
|
|
1
20
|
/**
|
|
2
21
|
* Resolve locale for a given URL using route-aware strategies.
|
|
3
22
|
*
|
|
4
23
|
* @param {string | URL} url
|
|
5
24
|
* @returns {Locale}
|
|
6
25
|
*/
|
|
7
|
-
export function getLocaleForUrl(url: string | URL): Locale;
|
|
8
|
-
|
|
9
|
-
|
|
26
|
+
export declare function getLocaleForUrl(url: string | URL): Locale;
|
|
27
|
+
/**
|
|
28
|
+
* Overwrite the `getLocale()` function.
|
|
29
|
+
*
|
|
30
|
+
* Use this function to overwrite how the locale is resolved. This is useful
|
|
31
|
+
* for custom locale resolution or advanced use cases like SSG with concurrent rendering.
|
|
32
|
+
*
|
|
33
|
+
* @see https://paraglidejs.com/strategy
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* overwriteGetLocale(() => {
|
|
37
|
+
* return Cookies.get('locale') ?? baseLocale
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* @param {() => Locale} fn - The new implementation for `getLocale()`.
|
|
41
|
+
*/
|
|
42
|
+
export declare const overwriteGetLocale: (fn: () => Locale) => void;
|
|
10
43
|
//# sourceMappingURL=get-locale.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-locale.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/get-locale.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-locale.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/get-locale.js"],"names":[],"mappings":"AAkCA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,IAAI,SAAS,QAFP,MAsCZ,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAHxB,MAAM,GAAG,GAGe,GAFtB,MAAM,CAmBlB;AAiED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,kBAAkB,OAFpB,MAAM,MAAM,SAItB,CAAC"}
|
|
@@ -12,5 +12,5 @@
|
|
|
12
12
|
* @param {string} [locale] - Target locale. If not provided, uses `getLocale()`
|
|
13
13
|
* @returns {"ltr" | "rtl"}
|
|
14
14
|
*/
|
|
15
|
-
export function getTextDirection(locale?: string): "ltr" | "rtl";
|
|
15
|
+
export declare function getTextDirection(locale?: string): "ltr" | "rtl";
|
|
16
16
|
//# sourceMappingURL=get-text-direction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-text-direction.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/get-text-direction.js"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;GAaG;AACH,
|
|
1
|
+
{"version":3,"file":"get-text-direction.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/get-text-direction.js"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,AAHpC,CACA,EADQ,MAG0C,GAFxC,KAAK,GAAG,KAAK,CAoBzB"}
|
|
@@ -7,6 +7,14 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @type {() => string}
|
|
9
9
|
*/
|
|
10
|
-
export let getUrlOrigin: () => string;
|
|
11
|
-
|
|
10
|
+
export declare let getUrlOrigin: () => string;
|
|
11
|
+
/**
|
|
12
|
+
* Overwrite the getUrlOrigin function.
|
|
13
|
+
*
|
|
14
|
+
* Use this function in server environments to
|
|
15
|
+
* define how the URL origin is resolved.
|
|
16
|
+
*
|
|
17
|
+
* @param {() => string} fn - The new implementation for `getUrlOrigin()`.
|
|
18
|
+
*/
|
|
19
|
+
export declare let overwriteGetUrlOrigin: (fn: () => string) => void;
|
|
12
20
|
//# sourceMappingURL=get-url-origin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-url-origin.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/get-url-origin.js"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,
|
|
1
|
+
{"version":3,"file":"get-url-origin.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/get-url-origin.js"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,eAAO,IAAI,YAAY,EAFb,MAAM,MASf,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,IAAI,qBAAqB,OAFrB,MAAM,MAAM,SAItB,CAAC"}
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
* @param {Locale} [options.locale] - Target locale. If not provided, uses `getLocale()`
|
|
39
39
|
* @returns {string} The localized href, relative if input was relative
|
|
40
40
|
*/
|
|
41
|
-
export function localizeHref(href: string, options?: {
|
|
42
|
-
locale?:
|
|
41
|
+
export declare function localizeHref(href: string, options?: {
|
|
42
|
+
locale?: Locale;
|
|
43
43
|
}): string;
|
|
44
44
|
/**
|
|
45
45
|
* High-level URL de-localization function optimized for client-side UI usage.
|
|
@@ -81,5 +81,5 @@ export function localizeHref(href: string, options?: {
|
|
|
81
81
|
* @param {string} href - The href to de-localize (can be relative or absolute)
|
|
82
82
|
* @returns {string} The de-localized href, relative if input was relative
|
|
83
83
|
*/
|
|
84
|
-
export function deLocalizeHref(href: string): string;
|
|
84
|
+
export declare function deLocalizeHref(href: string): string;
|
|
85
85
|
//# sourceMappingURL=localize-href.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localize-href.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/localize-href.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,
|
|
1
|
+
{"version":3,"file":"localize-href.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/localize-href.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,YAAY,CAAC,IAAI,EALtB,MAKsB,EAAE,OAAO,AAJvC,CAEA,EADA;IAAyB,MAAM,AAA/B,CACA,EADQ,MAAM,CACd;CAEuC,GAF7B,MAAM,CAyBlB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAHxB,MAGwB,GAFtB,MAAM,CAclB"}
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
* @param {Locale} [options.locale] - Target locale. If not provided, uses getLocale()
|
|
43
43
|
* @returns {URL} The localized URL, always absolute
|
|
44
44
|
*/
|
|
45
|
-
export function localizeUrl(url: string | URL, options?: {
|
|
46
|
-
locale?:
|
|
45
|
+
export declare function localizeUrl(url: string | URL, options?: {
|
|
46
|
+
locale?: Locale;
|
|
47
47
|
}): URL;
|
|
48
48
|
/**
|
|
49
49
|
* Low-level URL de-localization function, primarily used in server contexts.
|
|
@@ -84,7 +84,7 @@ export function localizeUrl(url: string | URL, options?: {
|
|
|
84
84
|
* @param {string | URL} url - The URL to de-localize. If string, must be absolute.
|
|
85
85
|
* @returns {URL} The de-localized URL, always absolute
|
|
86
86
|
*/
|
|
87
|
-
export function deLocalizeUrl(url: string | URL): URL;
|
|
87
|
+
export declare function deLocalizeUrl(url: string | URL): URL;
|
|
88
88
|
/**
|
|
89
89
|
* Aggregates named groups from various parts of the URLPattern match result.
|
|
90
90
|
*
|
|
@@ -92,5 +92,5 @@ export function deLocalizeUrl(url: string | URL): URL;
|
|
|
92
92
|
* @param {any} match - The URLPattern match result object.
|
|
93
93
|
* @returns {Record<string, string | null | undefined>} An object containing all named groups from the match.
|
|
94
94
|
*/
|
|
95
|
-
export function aggregateGroups(match: any): Record<string, string | null | undefined>;
|
|
95
|
+
export declare function aggregateGroups(match: any): Record<string, string | null | undefined>;
|
|
96
96
|
//# sourceMappingURL=localize-url.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localize-url.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/localize-url.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,
|
|
1
|
+
{"version":3,"file":"localize-url.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/localize-url.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,WAAW,CAAC,GAAG,EALpB,MAAM,GAAG,GAKW,EAAE,OAAO,AAJrC,CAEA,EADA;IAAyB,MAAM,AAA/B,CACA,EADQ,MAAM,CACd;CAEqC,GAF3B,GAAG,CA2Df;AAsCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAHtB,MAAM,GAAG,GAGa,GAFpB,GAAG,CAwCf;AAiJD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAH1B,GAG0B,GAFxB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAarD"}
|