@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.
Files changed (85) hide show
  1. package/dist/bundler-plugins/rolldown.d.ts +1 -1
  2. package/dist/bundler-plugins/rollup.d.ts +1 -1
  3. package/dist/bundler-plugins/vite.d.ts +1 -1
  4. package/dist/cli/defaults.d.ts.map +1 -1
  5. package/dist/cli/steps/initialize-inlang-project.d.ts.map +1 -1
  6. package/dist/cli/steps/update-ts-config.d.ts.map +1 -1
  7. package/dist/cli/steps/update-ts-config.js.map +1 -1
  8. package/dist/cli/utils.d.ts.map +1 -1
  9. package/dist/cli/utils.js.map +1 -1
  10. package/dist/compiler/compile-bundle.d.ts.map +1 -1
  11. package/dist/compiler/compile-message.d.ts.map +1 -1
  12. package/dist/compiler/compile-pattern.d.ts.map +1 -1
  13. package/dist/compiler/compile-project.d.ts.map +1 -1
  14. package/dist/compiler/compile.bench.js.map +1 -1
  15. package/dist/compiler/compiler-options.d.ts +5 -0
  16. package/dist/compiler/compiler-options.d.ts.map +1 -1
  17. package/dist/compiler/emit-ts-declarations.d.ts.map +1 -1
  18. package/dist/compiler/emit-ts-declarations.interop.test.d.ts +2 -0
  19. package/dist/compiler/emit-ts-declarations.interop.test.d.ts.map +1 -0
  20. package/dist/compiler/emit-ts-declarations.interop.test.js +62 -0
  21. package/dist/compiler/emit-ts-declarations.interop.test.js.map +1 -0
  22. package/dist/compiler/emit-ts-declarations.js +150 -0
  23. package/dist/compiler/emit-ts-declarations.js.map +1 -1
  24. package/dist/compiler/emit-ts-declarations.test.d.ts +2 -0
  25. package/dist/compiler/emit-ts-declarations.test.d.ts.map +1 -0
  26. package/dist/compiler/emit-ts-declarations.test.js +181 -0
  27. package/dist/compiler/emit-ts-declarations.test.js.map +1 -0
  28. package/dist/compiler/resolve-tsc-js-path.d.ts +10 -0
  29. package/dist/compiler/resolve-tsc-js-path.d.ts.map +1 -0
  30. package/dist/compiler/resolve-tsc-js-path.js +23 -0
  31. package/dist/compiler/resolve-tsc-js-path.js.map +1 -0
  32. package/dist/compiler/runtime/check-locale.d.ts +3 -3
  33. package/dist/compiler/runtime/check-locale.d.ts.map +1 -1
  34. package/dist/compiler/runtime/create-runtime.js.map +1 -1
  35. package/dist/compiler/runtime/extract-locale-from-cookie.d.ts +2 -2
  36. package/dist/compiler/runtime/extract-locale-from-cookie.d.ts.map +1 -1
  37. package/dist/compiler/runtime/extract-locale-from-header.d.ts +1 -1
  38. package/dist/compiler/runtime/extract-locale-from-header.d.ts.map +1 -1
  39. package/dist/compiler/runtime/extract-locale-from-navigator.d.ts +1 -1
  40. package/dist/compiler/runtime/extract-locale-from-navigator.d.ts.map +1 -1
  41. package/dist/compiler/runtime/extract-locale-from-request-async.d.ts +33 -2
  42. package/dist/compiler/runtime/extract-locale-from-request-async.d.ts.map +1 -1
  43. package/dist/compiler/runtime/extract-locale-from-request.d.ts +36 -4
  44. package/dist/compiler/runtime/extract-locale-from-request.d.ts.map +1 -1
  45. package/dist/compiler/runtime/extract-locale-from-url.d.ts +1 -1
  46. package/dist/compiler/runtime/extract-locale-from-url.d.ts.map +1 -1
  47. package/dist/compiler/runtime/generate-static-localized-urls.d.ts +1 -1
  48. package/dist/compiler/runtime/generate-static-localized-urls.d.ts.map +1 -1
  49. package/dist/compiler/runtime/get-locale.d.ts +36 -3
  50. package/dist/compiler/runtime/get-locale.d.ts.map +1 -1
  51. package/dist/compiler/runtime/get-text-direction.d.ts +1 -1
  52. package/dist/compiler/runtime/get-text-direction.d.ts.map +1 -1
  53. package/dist/compiler/runtime/get-url-origin.d.ts +10 -2
  54. package/dist/compiler/runtime/get-url-origin.d.ts.map +1 -1
  55. package/dist/compiler/runtime/localize-href.d.ts +3 -3
  56. package/dist/compiler/runtime/localize-href.d.ts.map +1 -1
  57. package/dist/compiler/runtime/localize-url.d.ts +4 -4
  58. package/dist/compiler/runtime/localize-url.d.ts.map +1 -1
  59. package/dist/compiler/runtime/set-locale.d.ts +19 -5
  60. package/dist/compiler/runtime/set-locale.d.ts.map +1 -1
  61. package/dist/compiler/runtime/should-redirect.d.ts +29 -29
  62. package/dist/compiler/runtime/should-redirect.d.ts.map +1 -1
  63. package/dist/compiler/runtime/strategy.d.ts +36 -36
  64. package/dist/compiler/runtime/strategy.d.ts.map +1 -1
  65. package/dist/compiler/runtime/track-message-call.d.ts +1 -1
  66. package/dist/compiler/runtime/track-message-call.d.ts.map +1 -1
  67. package/dist/compiler/runtime/type-definitions.d.ts +144 -43
  68. package/dist/compiler/runtime/type-definitions.d.ts.map +1 -1
  69. package/dist/compiler/runtime/type.test.js.map +1 -1
  70. package/dist/compiler/runtime/variables.d.ts +60 -60
  71. package/dist/compiler/runtime/variables.d.ts.map +1 -1
  72. package/dist/compiler/server/create-server-file.js.map +1 -1
  73. package/dist/compiler/server/middleware.d.ts +1 -1
  74. package/dist/compiler/server/middleware.d.ts.map +1 -1
  75. package/dist/services/codegen/quotes.d.ts.map +1 -1
  76. package/dist/services/env-variables/create-index-file.d.ts +8 -0
  77. package/dist/services/env-variables/create-index-file.d.ts.map +1 -1
  78. package/dist/services/env-variables/create-index-file.js.map +1 -1
  79. package/dist/services/env-variables/index.d.ts.map +1 -1
  80. package/dist/services/env-variables/index.js +1 -1
  81. package/dist/services/file-watching/tracked-fs.js.map +1 -1
  82. package/dist/services/logger/index.d.ts.map +1 -1
  83. package/dist/services/logger/index.js.map +1 -1
  84. package/dist/utilities/detect-json-formatting.d.ts.map +1 -1
  85. package/package.json +2 -1
@@ -1,3 +1,6 @@
1
+ export type SetLocaleFn = (newLocale: Locale, options?: {
2
+ reload?: boolean;
3
+ }) => void | Promise<void>;
1
4
  /**
2
5
  * @typedef {(newLocale: Locale, options?: { reload?: boolean }) => void | Promise<void>} SetLocaleFn
3
6
  */
@@ -22,9 +25,20 @@
22
25
  *
23
26
  * @type {SetLocaleFn}
24
27
  */
25
- export let setLocale: SetLocaleFn;
26
- export function overwriteSetLocale(fn: SetLocaleFn): void;
27
- export type SetLocaleFn = (newLocale: Locale, options?: {
28
- reload?: boolean;
29
- }) => void | Promise<void>;
28
+ export declare let setLocale: SetLocaleFn;
29
+ /**
30
+ * Overwrite the `setLocale()` function.
31
+ *
32
+ * Use this function to overwrite how the locale is set. For example,
33
+ * modify a cookie, env variable, or a user's preference.
34
+ *
35
+ * @example
36
+ * overwriteSetLocale((newLocale) => {
37
+ * // set the locale in a cookie
38
+ * return Cookies.set('locale', newLocale)
39
+ * });
40
+ *
41
+ * @param {SetLocaleFn} fn
42
+ */
43
+ export declare const overwriteSetLocale: (fn: SetLocaleFn) => void;
30
44
  //# sourceMappingURL=set-locale.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"set-locale.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/set-locale.js"],"names":[],"mappings":"AAiCA;;GAEG;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,sBAFU,WAAW,CA8GnB;AAgBK,uCAFI,WAAW,QAIrB;0BAtJY,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC"}
1
+ {"version":3,"file":"set-locale.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/set-locale.js"],"names":[],"mappings":"AAkCG,YAAuF,WAAW,GAAxF,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAa;AADrG;;GAEG;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,IAAI,SAAS,EAFV,WA8GT,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB,OAFpB,WAAW,SAIrB,CAAC"}
@@ -1,3 +1,31 @@
1
+ export type ShouldRedirectServerInput = {
2
+ request: Request;
3
+ /**
4
+ * - Effective request URL to use for route matching, locale detection with the URL strategy, and redirect targets.
5
+ */
6
+ effectiveRequestUrl?: string | URL;
7
+ locale?: Locale;
8
+ };
9
+ export type ShouldRedirectClientInput = {
10
+ request?: undefined;
11
+ url?: string | URL;
12
+ locale?: Locale;
13
+ };
14
+ export type ShouldRedirectInput = ShouldRedirectServerInput | ShouldRedirectClientInput;
15
+ export type ShouldRedirectResult = {
16
+ /**
17
+ * - Indicates whether the consumer should perform a redirect.
18
+ */
19
+ shouldRedirect: boolean;
20
+ /**
21
+ * - Locale resolved using the configured strategies.
22
+ */
23
+ locale: Locale;
24
+ /**
25
+ * - Destination URL when a redirect is required.
26
+ */
27
+ redirectUrl: URL | undefined;
28
+ };
1
29
  /**
2
30
  * @typedef {object} ShouldRedirectServerInput
3
31
  * @property {Request} request
@@ -69,33 +97,5 @@
69
97
  * @param {ShouldRedirectInput} [input]
70
98
  * @returns {Promise<ShouldRedirectResult>}
71
99
  */
72
- export function shouldRedirect(input?: ShouldRedirectInput): Promise<ShouldRedirectResult>;
73
- export type ShouldRedirectServerInput = {
74
- request: Request;
75
- /**
76
- * - Effective request URL to use for route matching, locale detection with the URL strategy, and redirect targets.
77
- */
78
- effectiveRequestUrl?: string | URL | undefined;
79
- locale?: string | undefined;
80
- };
81
- export type ShouldRedirectClientInput = {
82
- request?: undefined;
83
- url?: string | URL | undefined;
84
- locale?: string | undefined;
85
- };
86
- export type ShouldRedirectInput = ShouldRedirectServerInput | ShouldRedirectClientInput;
87
- export type ShouldRedirectResult = {
88
- /**
89
- * - Indicates whether the consumer should perform a redirect.
90
- */
91
- shouldRedirect: boolean;
92
- /**
93
- * - Locale resolved using the configured strategies.
94
- */
95
- locale: Locale;
96
- /**
97
- * - Destination URL when a redirect is required.
98
- */
99
- redirectUrl: URL | undefined;
100
- };
100
+ export declare function shouldRedirect(input?: ShouldRedirectInput): Promise<ShouldRedirectResult>;
101
101
  //# sourceMappingURL=should-redirect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"should-redirect.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/should-redirect.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,uCAHW,mBAAmB,GACjB,OAAO,CAAC,oBAAoB,CAAC,CAqBzC;;aAzFa,OAAO;;;;;;;;cAKP,SAAS;;;;kCAIV,yBAAyB,GAAG,yBAAyB;;;;;oBAGpD,OAAO;;;;YACP,MAAM;;;;iBACN,GAAG,GAAG,SAAS"}
1
+ {"version":3,"file":"should-redirect.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/should-redirect.js"],"names":[],"mappings":"AAQG,YAAkB,yBAAyB,GAC3C;IAAoB,OAAO,EAAhB,OAAO,CAClB;;;;IAA0B,mBAAmB,AAA7C,CACA,EADW,MAAM,GAAG,GAAG,CACvB;IAAoB,MAAM,AAA1B,CAEA,EAFW,MAAM,CAEjB;CAAA,CAAA;AAAA,YAAkB,yBAAyB,GAC3C;IAAuB,OAAO,AAA9B,CACA,EADW,SAAS,CACpB;IAA0B,GAAG,AAA7B,CACA,EADW,MAAM,GAAG,GAAG,CACvB;IAAoB,MAAM,AAA1B,CAEA,EAFW,MAAM,CAEjB;CAAA,CAAA;AAAA,YAAiE,mBAAmB,GAA1E,yBAAyB,GAAG,yBAAyB,CAAqB;AAEpF,YAAkB,oBAAoB,GACtC;;;;IAAoB,cAAc,EAAvB,OAAO,CAClB;;;;IAAmB,MAAM,EAAd,MAAM,CACjB;;;;IAA4B,WAAW,EAA5B,GAAG,GAAG,SAAS,CAC5B;CAAA,CAAA;AAjBD;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,wBAAsB,cAAc,CAAC,KAAK,AAHvC,CACA,EADQ,mBAGoC,GAFlC,OAAO,CAAC,oBAAoB,CAAC,CAqBzC"}
@@ -1,3 +1,36 @@
1
+ /**
2
+ * @typedef {"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage"} BuiltInStrategy
3
+ */
4
+ export type BuiltInStrategy = "cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage";
5
+ export type CustomStrategy = `custom_${string}`;
6
+ export type Strategy = BuiltInStrategy | CustomStrategy;
7
+ export type Strategies = Array<Strategy>;
8
+ export type CustomServerStrategyHandler = {
9
+ getLocale: (request?: Request) => Promise<string | undefined> | (string | undefined);
10
+ };
11
+ export type CustomClientStrategyHandler = {
12
+ getLocale: () => Promise<string | undefined> | (string | undefined);
13
+ setLocale: (locale: string) => Promise<void> | void;
14
+ };
15
+ /**
16
+ * @typedef {`custom_${string}`} CustomStrategy
17
+ */
18
+ /**
19
+ * @typedef {BuiltInStrategy | CustomStrategy} Strategy
20
+ */
21
+ /**
22
+ * @typedef {Array<Strategy>} Strategies
23
+ */
24
+ /**
25
+ * @typedef {{ getLocale: (request?: Request) => Promise<string | undefined> | (string | undefined) }} CustomServerStrategyHandler
26
+ */
27
+ /**
28
+ * @typedef {{ getLocale: () => Promise<string|undefined> | (string | undefined), setLocale: (locale: string) => Promise<void> | void }} CustomClientStrategyHandler
29
+ */
30
+ /** @type {Map<string, CustomServerStrategyHandler>} */
31
+ export declare const customServerStrategies: Map<string, CustomServerStrategyHandler>;
32
+ /** @type {Map<string, CustomClientStrategyHandler>} */
33
+ export declare const customClientStrategies: Map<string, CustomClientStrategyHandler>;
1
34
  /**
2
35
  * Checks if the given strategy is a custom strategy.
3
36
  *
@@ -5,7 +38,7 @@
5
38
  * Must be a string that starts with "custom-" followed by alphanumeric characters, hyphens, or underscores.
6
39
  * @returns {boolean} Returns true if it is a custom strategy, false otherwise.
7
40
  */
8
- export function isCustomStrategy(strategy: unknown): boolean;
41
+ export declare function isCustomStrategy(strategy: unknown): boolean;
9
42
  /**
10
43
  * Defines a custom strategy that is executed on the server.
11
44
  *
@@ -16,7 +49,7 @@ export function isCustomStrategy(strategy: unknown): boolean;
16
49
  * the method getLocale.
17
50
  * @returns {void}
18
51
  */
19
- export function defineCustomServerStrategy(strategy: string, handler: CustomServerStrategyHandler): void;
52
+ export declare function defineCustomServerStrategy(strategy: string, handler: CustomServerStrategyHandler): void;
20
53
  /**
21
54
  * Defines a custom strategy that is executed on the client.
22
55
  *
@@ -27,38 +60,5 @@ export function defineCustomServerStrategy(strategy: string, handler: CustomServ
27
60
  * methods getLocale and setLocale.
28
61
  * @returns {void}
29
62
  */
30
- export function defineCustomClientStrategy(strategy: string, handler: CustomClientStrategyHandler): void;
31
- /**
32
- * @typedef {"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage"} BuiltInStrategy
33
- */
34
- /**
35
- * @typedef {`custom_${string}`} CustomStrategy
36
- */
37
- /**
38
- * @typedef {BuiltInStrategy | CustomStrategy} Strategy
39
- */
40
- /**
41
- * @typedef {Array<Strategy>} Strategies
42
- */
43
- /**
44
- * @typedef {{ getLocale: (request?: Request) => Promise<string | undefined> | (string | undefined) }} CustomServerStrategyHandler
45
- */
46
- /**
47
- * @typedef {{ getLocale: () => Promise<string|undefined> | (string | undefined), setLocale: (locale: string) => Promise<void> | void }} CustomClientStrategyHandler
48
- */
49
- /** @type {Map<string, CustomServerStrategyHandler>} */
50
- export const customServerStrategies: Map<string, CustomServerStrategyHandler>;
51
- /** @type {Map<string, CustomClientStrategyHandler>} */
52
- export const customClientStrategies: Map<string, CustomClientStrategyHandler>;
53
- export type BuiltInStrategy = "cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage";
54
- export type CustomStrategy = `custom_${string}`;
55
- export type Strategy = BuiltInStrategy | CustomStrategy;
56
- export type Strategies = Array<Strategy>;
57
- export type CustomServerStrategyHandler = {
58
- getLocale: (request?: Request) => Promise<string | undefined> | (string | undefined);
59
- };
60
- export type CustomClientStrategyHandler = {
61
- getLocale: () => Promise<string | undefined> | (string | undefined);
62
- setLocale: (locale: string) => Promise<void> | void;
63
- };
63
+ export declare function defineCustomClientStrategy(strategy: string, handler: CustomClientStrategyHandler): void;
64
64
  //# sourceMappingURL=strategy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"strategy.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/strategy.js"],"names":[],"mappings":"AA6BA;;;;;;GAMG;AACH,2CAJW,OAAO,GAEL,OAAO,CAMnB;AAED;;;;;;;;;GASG;AACH,qDALW,MAAM,WACN,2BAA2B,GAEzB,IAAI,CAUhB;AAED;;;;;;;;;GASG;AACH,qDALW,MAAM,WACN,2BAA2B,GAEzB,IAAI,CAUhB;AAhFD;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH,uDAAuD;AACvD,qCADW,GAAG,CAAC,MAAM,EAAE,2BAA2B,CAAC,CACH;AAChD,uDAAuD;AACvD,qCADW,GAAG,CAAC,MAAM,EAAE,2BAA2B,CAAC,CACH;8BA1BnC,QAAQ,GAAG,YAAY,GAAG,gBAAgB,GAAG,KAAK,GAAG,mBAAmB,GAAG,cAAc;6BAIzF,UAAU,MAAM,EAAE;uBAIlB,eAAe,GAAG,cAAc;yBAIhC,KAAK,CAAC,QAAQ,CAAC;0CAIf;IAAE,SAAS,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;CAAE;0CAIxF;IAAE,SAAS,EAAE,MAAM,OAAO,CAAC,MAAM,GAAC,SAAS,CAAC,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAAC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;CAAE"}
1
+ {"version":3,"file":"strategy.d.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AAgB,0BAA0B,CAAC,QAAQ,EALxC,MAKwC,EAAE,OAAO,EAJjD,2BAIiD,GAF/C,IAAI,CAUhB"}
@@ -2,5 +2,5 @@
2
2
  * @param {string} safeModuleId
3
3
  * @param {Locale} locale
4
4
  */
5
- export function trackMessageCall(safeModuleId: string, locale: Locale): void;
5
+ export declare function trackMessageCall(safeModuleId: string, locale: Locale): void;
6
6
  //# sourceMappingURL=track-message-call.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"track-message-call.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/track-message-call.js"],"names":[],"mappings":"AAEA;;;GAGG;AACH,+CAHW,MAAM,UACN,MAAM,QAUhB"}
1
+ {"version":3,"file":"track-message-call.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/track-message-call.js"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAHlC,MAGkC,EAAE,MAAM,EAF1C,MAE0C,QAQpD"}
@@ -1,58 +1,23 @@
1
- /**
2
- * A locale that is available in the project.
3
- */
4
1
  export type Locale = string;
5
- /**
6
- * A branded type representing a localized string.
7
- *
8
- * Message functions return this type instead of \`string\`, enabling TypeScript
9
- * to distinguish translated strings from regular strings at compile time.
10
- * This allows you to enforce that only properly localized content is used
11
- * in your UI components.
12
- *
13
- * Since \`LocalizedString\` is a branded subtype of \`string\`, it remains fully
14
- * backward compatible—you can pass it anywhere a \`string\` is expected.
15
- */
16
2
  export type LocalizedString = string & {
17
- readonly __brand: "LocalizedString";
3
+ readonly __brand: 'LocalizedString';
18
4
  };
19
- /**
20
- * A single markup option passed to a tag instance.
21
- */
22
5
  export type MessageMarkupOption = {
23
6
  name: string;
24
7
  value: unknown;
25
8
  };
26
- /**
27
- * A single static markup attribute attached to a tag instance.
28
- */
29
9
  export type MessageMarkupAttribute = {
30
10
  name: string;
31
11
  value: string | true;
32
12
  };
33
- /**
34
- * Record of markup options for a tag instance.
35
- */
36
13
  export type MessageMarkupOptions = Record<string, unknown>;
37
- /**
38
- * Record of markup attributes for a tag instance.
39
- */
40
14
  export type MessageMarkupAttributes = Record<string, string | true>;
41
- /**
42
- * Type-level schema for a single markup tag.
43
- */
44
15
  export type MessageMarkupTag = {
45
16
  options: MessageMarkupOptions;
46
17
  attributes: MessageMarkupAttributes;
47
18
  children: boolean;
48
19
  };
49
- /**
50
- * Type-level schema for all markup tags in a message.
51
- */
52
20
  export type MessageMarkupSchema = Record<string, MessageMarkupTag>;
53
- /**
54
- * Type-only metadata attached to compiled message functions.
55
- */
56
21
  export type MessageMetadata<Inputs, Options, Markup extends MessageMarkupSchema = MessageMarkupSchema> = {
57
22
  readonly __paraglide?: {
58
23
  inputs: Inputs;
@@ -60,9 +25,6 @@ export type MessageMetadata<Inputs, Options, Markup extends MessageMarkupSchema
60
25
  markup: Markup;
61
26
  };
62
27
  };
63
- /**
64
- * A compiled, framework-neutral message part.
65
- */
66
28
  export type MessagePart = {
67
29
  type: "text";
68
30
  value: string;
@@ -82,16 +44,155 @@ export type MessagePart = {
82
44
  options: MessageMarkupOptions;
83
45
  attributes: MessageMarkupAttributes;
84
46
  };
47
+ export type MessageFunction = (inputs?: Record<string, never>) => LocalizedString;
48
+ export type MessageBundleFunction<T extends string> = (params: Record<string, never>, options: {
49
+ locale: T;
50
+ }) => LocalizedString;
51
+ /**
52
+ * A locale that is available in the project.
53
+ *
54
+ * @example
55
+ * setLocale(request.locale as Locale)
56
+ *
57
+ * @typedef {string} Locale
58
+ */
59
+ /**
60
+ * A branded type representing a localized string.
61
+ *
62
+ * Message functions return this type instead of \`string\`, enabling TypeScript
63
+ * to distinguish translated strings from regular strings at compile time.
64
+ * This allows you to enforce that only properly localized content is used
65
+ * in your UI components.
66
+ *
67
+ * Since \`LocalizedString\` is a branded subtype of \`string\`, it remains fully
68
+ * backward compatible—you can pass it anywhere a \`string\` is expected.
69
+ *
70
+ * @example
71
+ * // Enforce localized strings in your components
72
+ * function PageTitle(props: { title: LocalizedString }) {
73
+ * return <h1>{props.title}</h1>
74
+ * }
75
+ *
76
+ * // ✅ Correct: using a message function
77
+ * <PageTitle title={m.welcome_title()} />
78
+ *
79
+ * // ❌ Type error: raw strings are not LocalizedString
80
+ * <PageTitle title="Welcome" />
81
+ *
82
+ * @example
83
+ * // LocalizedString is assignable to string (backward compatible)
84
+ * const localized: LocalizedString = m.greeting()
85
+ * const str: string = localized // ✅ works fine
86
+ *
87
+ * // But string is not assignable to LocalizedString
88
+ * const raw: LocalizedString = "Hello" // ❌ Type error
89
+ *
90
+ * @example
91
+ * // Catches accidental string concatenation
92
+ * function showMessage(msg: LocalizedString) { ... }
93
+ *
94
+ * showMessage(m.hello()) // ✅
95
+ * showMessage("Hello " + userName) // ❌ Type error
96
+ * showMessage(m.hello_user({ name: userName })) // ✅ use params instead
97
+ *
98
+ * @typedef {string & { readonly __brand: 'LocalizedString' }} LocalizedString
99
+ */
100
+ /**
101
+ * A single markup option passed to a tag instance.
102
+ *
103
+ * @typedef {{
104
+ * name: string;
105
+ * value: unknown;
106
+ * }} MessageMarkupOption
107
+ */
108
+ /**
109
+ * A single static markup attribute attached to a tag instance.
110
+ *
111
+ * @typedef {{
112
+ * name: string;
113
+ * value: string | true;
114
+ * }} MessageMarkupAttribute
115
+ */
116
+ /**
117
+ * Record of markup options for a tag instance.
118
+ *
119
+ * @typedef {Record<string, unknown>} MessageMarkupOptions
120
+ */
121
+ /**
122
+ * Record of markup attributes for a tag instance.
123
+ *
124
+ * @typedef {Record<string, string | true>} MessageMarkupAttributes
125
+ */
126
+ /**
127
+ * Type-level schema for a single markup tag.
128
+ *
129
+ * @typedef {{
130
+ * options: MessageMarkupOptions;
131
+ * attributes: MessageMarkupAttributes;
132
+ * children: boolean;
133
+ * }} MessageMarkupTag
134
+ */
135
+ /**
136
+ * Type-level schema for all markup tags in a message.
137
+ *
138
+ * @typedef {Record<string, MessageMarkupTag>} MessageMarkupSchema
139
+ */
140
+ /**
141
+ * Type-only metadata attached to compiled message functions.
142
+ *
143
+ * @template Inputs
144
+ * @template Options
145
+ * @template {MessageMarkupSchema} [Markup = MessageMarkupSchema]
146
+ * @typedef {{
147
+ * readonly __paraglide?: {
148
+ * inputs: Inputs;
149
+ * options: Options;
150
+ * markup: Markup;
151
+ * };
152
+ * }} MessageMetadata
153
+ */
154
+ /**
155
+ * A compiled, framework-neutral message part.
156
+ *
157
+ * @typedef {{
158
+ * type: "text";
159
+ * value: string;
160
+ * } | {
161
+ * type: "markup-start";
162
+ * name: string;
163
+ * options: MessageMarkupOptions;
164
+ * attributes: MessageMarkupAttributes;
165
+ * } | {
166
+ * type: "markup-end";
167
+ * name: string;
168
+ * options: MessageMarkupOptions;
169
+ * attributes: MessageMarkupAttributes;
170
+ * } | {
171
+ * type: "markup-standalone";
172
+ * name: string;
173
+ * options: MessageMarkupOptions;
174
+ * attributes: MessageMarkupAttributes;
175
+ * }} MessagePart
176
+ */
85
177
  /**
86
178
  * A message function is a message for a specific locale.
179
+ *
180
+ * @example
181
+ * m.hello({ name: 'world' })
182
+ *
183
+ * @typedef {(inputs?: Record<string, never>) => LocalizedString} MessageFunction
87
184
  */
88
- export type MessageFunction = (inputs?: Record<string, never>) => LocalizedString;
89
185
  /**
90
186
  * A message bundle function that selects the message to be returned.
91
187
  *
92
188
  * Uses `getLocale()` under the hood to determine the locale with an option.
189
+ *
190
+ * @template {string} T
191
+ *
192
+ * @example
193
+ * import { m } from './messages.js'
194
+ * m.hello({ name: 'world' }, { locale: "en" })
195
+ *
196
+ * @typedef {(params: Record<string, never>, options: { locale: T }) => LocalizedString} MessageBundleFunction
93
197
  */
94
- export type MessageBundleFunction<T extends string> = (params: Record<string, never>, options: {
95
- locale: T;
96
- }) => LocalizedString;
97
198
  //# sourceMappingURL=type-definitions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"type-definitions.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/type-definitions.js"],"names":[],"mappings":";;;qBAQa,MAAM;;;;;;;;;;;;8BA0CN,MAAM,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Q,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1B,OAAO,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACzC,CAAC;IACF,CAAC;IAED,OAAO,CAAC,gBAAgB,CACvB,WAAW,EACX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAuCG,CACH,CAAC;IAEF,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IACxC,MAAM,WAAW,GAAG,EAAE;SACpB,qBAAqB,CAAC,OAAO,CAAC;QAC/B,sIAAsI;SACrI,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC;SAC9B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACrE,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACtC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAClE,CAAC;IACD,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACvC,CAAC,CAAC,CAAC"}
@@ -1,31 +1,3 @@
1
- /**
2
- * Returns the strategy to use for a specific URL.
3
- *
4
- * If no route strategy matches (or the matching rule is `exclude: true`),
5
- * the global strategy is returned.
6
- *
7
- * @param {string | URL} url
8
- * @returns {typeof strategy}
9
- */
10
- export function getStrategyForUrl(url: string | URL): typeof strategy;
11
- /**
12
- * Returns whether the given URL is excluded from middleware i18n processing.
13
- *
14
- * @param {string | URL} url
15
- * @returns {boolean}
16
- */
17
- export function isExcludedByRouteStrategy(url: string | URL): boolean;
18
- /**
19
- * Sets the server side async local storage.
20
- *
21
- * The function is needed because the `runtime.js` file
22
- * must define the `serverAsyncLocalStorage` variable to
23
- * avoid a circular import between `runtime.js` and
24
- * `server.js` files.
25
- *
26
- * @param {ParaglideAsyncLocalStorage | undefined} value
27
- */
28
- export function overwriteServerAsyncLocalStorage(value: ParaglideAsyncLocalStorage | undefined): void;
29
1
  /**
30
2
  * The project's base locale.
31
3
  *
@@ -34,7 +6,7 @@ export function overwriteServerAsyncLocalStorage(value: ParaglideAsyncLocalStora
34
6
  * // do something
35
7
  * }
36
8
  */
37
- export const baseLocale: "en";
9
+ export declare const baseLocale = "en";
38
10
  /**
39
11
  * The project's locales that have been specified in the settings.
40
12
  *
@@ -43,19 +15,19 @@ export const baseLocale: "en";
43
15
  * throw new Error('Locale is not available');
44
16
  * }
45
17
  */
46
- export const locales: readonly string[];
18
+ export declare const locales: readonly string[];
47
19
  /** @type {string} */
48
- export const cookieName: string;
20
+ export declare const cookieName: string;
49
21
  /** @type {number} */
50
- export const cookieMaxAge: number;
22
+ export declare const cookieMaxAge: number;
51
23
  /** @type {string} */
52
- export const cookieDomain: string;
24
+ export declare const cookieDomain: string;
53
25
  /** @type {string} */
54
- export const localStorageKey: string;
26
+ export declare const localStorageKey: string;
55
27
  /**
56
28
  * @type {Array<"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage" | `custom-${string}`>}
57
29
  */
58
- export const strategy: Array<"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage" | `custom-${string}`>;
30
+ export declare const strategy: Array<"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage" | `custom-${string}`>;
59
31
  /**
60
32
  * Route-level strategy overrides.
61
33
  *
@@ -67,7 +39,7 @@ export const strategy: Array<"cookie" | "baseLocale" | "globalVariable" | "url"
67
39
  * exclude?: boolean;
68
40
  * }>}
69
41
  */
70
- export const routeStrategies: Array<{
42
+ export declare const routeStrategies: Array<{
71
43
  match: string;
72
44
  strategy?: Array<"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage" | `custom-${string}`>;
73
45
  exclude?: boolean;
@@ -77,10 +49,39 @@ export const routeStrategies: Array<{
77
49
  *
78
50
  * @type {Array<{ pattern: string, localized: Array<[Locale, string]> }>}
79
51
  */
80
- export const urlPatterns: Array<{
52
+ export declare const urlPatterns: Array<{
81
53
  pattern: string;
82
54
  localized: Array<[Locale, string]>;
83
55
  }>;
56
+ /**
57
+ * Returns the strategy to use for a specific URL.
58
+ *
59
+ * If no route strategy matches (or the matching rule is `exclude: true`),
60
+ * the global strategy is returned.
61
+ *
62
+ * @param {string | URL} url
63
+ * @returns {typeof strategy}
64
+ */
65
+ export declare function getStrategyForUrl(url: string | URL): typeof strategy;
66
+ /**
67
+ * Returns whether the given URL is excluded from middleware i18n processing.
68
+ *
69
+ * @param {string | URL} url
70
+ * @returns {boolean}
71
+ */
72
+ export declare function isExcludedByRouteStrategy(url: string | URL): boolean;
73
+ export type ParaglideAsyncLocalStorage = {
74
+ getStore(): {
75
+ locale?: Locale;
76
+ origin?: string;
77
+ messageCalls?: Set<string>;
78
+ } | undefined;
79
+ run: (store: {
80
+ locale?: Locale;
81
+ origin?: string;
82
+ messageCalls?: Set<string>;
83
+ }, cb: any) => any;
84
+ };
84
85
  /**
85
86
  * @typedef {{
86
87
  * getStore(): {
@@ -100,28 +101,27 @@ export const urlPatterns: Array<{
100
101
  *
101
102
  * @type {ParaglideAsyncLocalStorage | undefined}
102
103
  */
103
- export let serverAsyncLocalStorage: ParaglideAsyncLocalStorage | undefined;
104
- export const disableAsyncLocalStorage: false;
105
- export const experimentalMiddlewareLocaleSplitting: false;
106
- export const isServer: boolean;
104
+ export declare let serverAsyncLocalStorage: ParaglideAsyncLocalStorage | undefined;
105
+ export declare const disableAsyncLocalStorage = false;
106
+ export declare const experimentalMiddlewareLocaleSplitting = false;
107
+ export declare const isServer: boolean;
107
108
  /** @type {Locale | undefined} */
108
- export const experimentalStaticLocale: Locale | undefined;
109
- export const TREE_SHAKE_COOKIE_STRATEGY_USED: false;
110
- export const TREE_SHAKE_URL_STRATEGY_USED: false;
111
- export const TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED: false;
112
- export const TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED: false;
113
- export const TREE_SHAKE_DEFAULT_URL_PATTERN_USED: false;
114
- export const TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED: false;
115
- export type ParaglideAsyncLocalStorage = {
116
- getStore(): {
117
- locale?: Locale;
118
- origin?: string;
119
- messageCalls?: Set<string>;
120
- } | undefined;
121
- run: (store: {
122
- locale?: Locale;
123
- origin?: string;
124
- messageCalls?: Set<string>;
125
- }, cb: any) => any;
126
- };
109
+ export declare const experimentalStaticLocale: Locale | undefined;
110
+ /**
111
+ * Sets the server side async local storage.
112
+ *
113
+ * The function is needed because the `runtime.js` file
114
+ * must define the `serverAsyncLocalStorage` variable to
115
+ * avoid a circular import between `runtime.js` and
116
+ * `server.js` files.
117
+ *
118
+ * @param {ParaglideAsyncLocalStorage | undefined} value
119
+ */
120
+ export declare function overwriteServerAsyncLocalStorage(value: ParaglideAsyncLocalStorage | undefined): void;
121
+ export declare const TREE_SHAKE_COOKIE_STRATEGY_USED = false;
122
+ export declare const TREE_SHAKE_URL_STRATEGY_USED = false;
123
+ export declare const TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED = false;
124
+ export declare const TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED = false;
125
+ export declare const TREE_SHAKE_DEFAULT_URL_PATTERN_USED = false;
126
+ export declare const TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED = false;
127
127
  //# sourceMappingURL=variables.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/variables.js"],"names":[],"mappings":"AA2FA;;;;;;;;GAQG;AACH,uCAHW,MAAM,GAAG,GAAG,GACV,OAAO,QAAQ,CAY3B;AAED;;;;;GAKG;AACH,+CAHW,MAAM,GAAG,GAAG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