astro-intlayer 9.5.4-canary.0 → 9.5.5

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 (119) hide show
  1. package/README.md +2 -1
  2. package/dist/cjs/client/format/index.cjs +57 -0
  3. package/dist/cjs/client/index.cjs +81 -0
  4. package/dist/cjs/format/index.cjs +20 -0
  5. package/dist/cjs/format/useCompact.cjs +18 -0
  6. package/dist/cjs/format/useCompact.cjs.map +1 -0
  7. package/dist/cjs/format/useCurrency.cjs +18 -0
  8. package/dist/cjs/format/useCurrency.cjs.map +1 -0
  9. package/dist/cjs/format/useDate.cjs +27 -0
  10. package/dist/cjs/format/useDate.cjs.map +1 -0
  11. package/dist/cjs/format/useIntl.cjs +24 -0
  12. package/dist/cjs/format/useIntl.cjs.map +1 -0
  13. package/dist/cjs/format/useList.cjs +18 -0
  14. package/dist/cjs/format/useList.cjs.map +1 -0
  15. package/dist/cjs/format/useNumber.cjs +21 -0
  16. package/dist/cjs/format/useNumber.cjs.map +1 -0
  17. package/dist/cjs/format/usePercentage.cjs +18 -0
  18. package/dist/cjs/format/usePercentage.cjs.map +1 -0
  19. package/dist/cjs/format/useRelativeTime.cjs +18 -0
  20. package/dist/cjs/format/useRelativeTime.cjs.map +1 -0
  21. package/dist/cjs/format/useUnit.cjs +18 -0
  22. package/dist/cjs/format/useUnit.cjs.map +1 -0
  23. package/dist/cjs/html/index.cjs +33 -0
  24. package/dist/cjs/index.cjs +33 -35
  25. package/dist/cjs/index.cjs.map +1 -1
  26. package/dist/cjs/integration.cjs +67 -0
  27. package/dist/cjs/integration.cjs.map +1 -0
  28. package/dist/cjs/markdown/index.cjs +45 -0
  29. package/dist/cjs/middleware.cjs +43 -0
  30. package/dist/cjs/middleware.cjs.map +1 -0
  31. package/dist/cjs/requestStorage.cjs +24 -0
  32. package/dist/cjs/requestStorage.cjs.map +1 -0
  33. package/dist/cjs/useDictionary.cjs +38 -0
  34. package/dist/cjs/useDictionary.cjs.map +1 -0
  35. package/dist/cjs/useIntlayer.cjs +38 -0
  36. package/dist/cjs/useIntlayer.cjs.map +1 -0
  37. package/dist/cjs/useLocale.cjs +41 -0
  38. package/dist/cjs/useLocale.cjs.map +1 -0
  39. package/dist/cjs/withInertOnChange.cjs +17 -0
  40. package/dist/cjs/withInertOnChange.cjs.map +1 -0
  41. package/dist/esm/client/format/index.mjs +3 -0
  42. package/dist/esm/client/index.mjs +3 -0
  43. package/dist/esm/format/index.mjs +11 -0
  44. package/dist/esm/format/useCompact.mjs +17 -0
  45. package/dist/esm/format/useCompact.mjs.map +1 -0
  46. package/dist/esm/format/useCurrency.mjs +17 -0
  47. package/dist/esm/format/useCurrency.mjs.map +1 -0
  48. package/dist/esm/format/useDate.mjs +26 -0
  49. package/dist/esm/format/useDate.mjs.map +1 -0
  50. package/dist/esm/format/useIntl.mjs +23 -0
  51. package/dist/esm/format/useIntl.mjs.map +1 -0
  52. package/dist/esm/format/useList.mjs +17 -0
  53. package/dist/esm/format/useList.mjs.map +1 -0
  54. package/dist/esm/format/useNumber.mjs +20 -0
  55. package/dist/esm/format/useNumber.mjs.map +1 -0
  56. package/dist/esm/format/usePercentage.mjs +17 -0
  57. package/dist/esm/format/usePercentage.mjs.map +1 -0
  58. package/dist/esm/format/useRelativeTime.mjs +17 -0
  59. package/dist/esm/format/useRelativeTime.mjs.map +1 -0
  60. package/dist/esm/format/useUnit.mjs +17 -0
  61. package/dist/esm/format/useUnit.mjs.map +1 -0
  62. package/dist/esm/html/index.mjs +3 -0
  63. package/dist/esm/index.mjs +30 -36
  64. package/dist/esm/index.mjs.map +1 -1
  65. package/dist/esm/integration.mjs +65 -0
  66. package/dist/esm/integration.mjs.map +1 -0
  67. package/dist/esm/markdown/index.mjs +3 -0
  68. package/dist/esm/middleware.mjs +42 -0
  69. package/dist/esm/middleware.mjs.map +1 -0
  70. package/dist/esm/requestStorage.mjs +21 -0
  71. package/dist/esm/requestStorage.mjs.map +1 -0
  72. package/dist/esm/useDictionary.mjs +37 -0
  73. package/dist/esm/useDictionary.mjs.map +1 -0
  74. package/dist/esm/useIntlayer.mjs +37 -0
  75. package/dist/esm/useIntlayer.mjs.map +1 -0
  76. package/dist/esm/useLocale.mjs +40 -0
  77. package/dist/esm/useLocale.mjs.map +1 -0
  78. package/dist/esm/withInertOnChange.mjs +16 -0
  79. package/dist/esm/withInertOnChange.mjs.map +1 -0
  80. package/dist/types/client/format/index.d.ts +2 -0
  81. package/dist/types/client/index.d.ts +2 -0
  82. package/dist/types/format/index.d.ts +10 -0
  83. package/dist/types/format/useCompact.d.ts +5 -0
  84. package/dist/types/format/useCompact.d.ts.map +1 -0
  85. package/dist/types/format/useCurrency.d.ts +5 -0
  86. package/dist/types/format/useCurrency.d.ts.map +1 -0
  87. package/dist/types/format/useDate.d.ts +8 -0
  88. package/dist/types/format/useDate.d.ts.map +1 -0
  89. package/dist/types/format/useIntl.d.ts +15 -0
  90. package/dist/types/format/useIntl.d.ts.map +1 -0
  91. package/dist/types/format/useList.d.ts +5 -0
  92. package/dist/types/format/useList.d.ts.map +1 -0
  93. package/dist/types/format/useNumber.d.ts +8 -0
  94. package/dist/types/format/useNumber.d.ts.map +1 -0
  95. package/dist/types/format/usePercentage.d.ts +5 -0
  96. package/dist/types/format/usePercentage.d.ts.map +1 -0
  97. package/dist/types/format/useRelativeTime.d.ts +5 -0
  98. package/dist/types/format/useRelativeTime.d.ts.map +1 -0
  99. package/dist/types/format/useUnit.d.ts +5 -0
  100. package/dist/types/format/useUnit.d.ts.map +1 -0
  101. package/dist/types/html/index.d.ts +2 -0
  102. package/dist/types/index.d.ts +13 -6
  103. package/dist/types/index.d.ts.map +1 -1
  104. package/dist/types/integration.d.ts +37 -0
  105. package/dist/types/integration.d.ts.map +1 -0
  106. package/dist/types/markdown/index.d.ts +2 -0
  107. package/dist/types/middleware.d.ts +46 -0
  108. package/dist/types/middleware.d.ts.map +1 -0
  109. package/dist/types/requestStorage.d.ts +22 -0
  110. package/dist/types/requestStorage.d.ts.map +1 -0
  111. package/dist/types/useDictionary.d.ts +29 -0
  112. package/dist/types/useDictionary.d.ts.map +1 -0
  113. package/dist/types/useIntlayer.d.ts +28 -0
  114. package/dist/types/useIntlayer.d.ts.map +1 -0
  115. package/dist/types/useLocale.d.ts +29 -0
  116. package/dist/types/useLocale.d.ts.map +1 -0
  117. package/dist/types/withInertOnChange.d.ts +12 -0
  118. package/dist/types/withInertOnChange.d.ts.map +1 -0
  119. package/package.json +88 -6
package/README.md CHANGED
@@ -188,7 +188,8 @@ Explore our comprehensive documentation to get started with Intlayer and learn h
188
188
  <li><a href="https://intlayer.org/doc/environment/create-react-app" rel=''>React CRA</a></li>
189
189
  <li><a href="https://intlayer.org/doc/environment/vite-and-react" rel=''>Vite + React</a></li>
190
190
  <li><a href="https://intlayer.org/doc/environment/vite-and-react" rel=''>Vite + React using Compiler</a></li>
191
- <li><a href="https://intlayer.org/doc/environment/vite-and-react/compiler" rel=''>React-router-v7</a></li>
191
+ <li><a href="https://intlayer.org/doc/environment/vite-and-react/react-router-v7" rel=''>React-router-v7</a></li>
192
+ <li><a href="https://intlayer.org/doc/environment/remix-3" rel=''>Remix 3</a></li>
192
193
  <li><a href="https://intlayer.org/doc/environment/tanstack-start" rel=''>Tanstack start</a>
193
194
  <ul>
194
195
  <li><a href="https://intlayer.org/doc/environment/tanstack-start/solid" rel=''>Solid</a></li>
@@ -0,0 +1,57 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ let vanilla_intlayer_format = require("vanilla-intlayer/format");
3
+
4
+ Object.defineProperty(exports, 'useCompact', {
5
+ enumerable: true,
6
+ get: function () {
7
+ return vanilla_intlayer_format.useCompact;
8
+ }
9
+ });
10
+ Object.defineProperty(exports, 'useCurrency', {
11
+ enumerable: true,
12
+ get: function () {
13
+ return vanilla_intlayer_format.useCurrency;
14
+ }
15
+ });
16
+ Object.defineProperty(exports, 'useDate', {
17
+ enumerable: true,
18
+ get: function () {
19
+ return vanilla_intlayer_format.useDate;
20
+ }
21
+ });
22
+ Object.defineProperty(exports, 'useIntl', {
23
+ enumerable: true,
24
+ get: function () {
25
+ return vanilla_intlayer_format.useIntl;
26
+ }
27
+ });
28
+ Object.defineProperty(exports, 'useList', {
29
+ enumerable: true,
30
+ get: function () {
31
+ return vanilla_intlayer_format.useList;
32
+ }
33
+ });
34
+ Object.defineProperty(exports, 'useNumber', {
35
+ enumerable: true,
36
+ get: function () {
37
+ return vanilla_intlayer_format.useNumber;
38
+ }
39
+ });
40
+ Object.defineProperty(exports, 'usePercentage', {
41
+ enumerable: true,
42
+ get: function () {
43
+ return vanilla_intlayer_format.usePercentage;
44
+ }
45
+ });
46
+ Object.defineProperty(exports, 'useRelativeTime', {
47
+ enumerable: true,
48
+ get: function () {
49
+ return vanilla_intlayer_format.useRelativeTime;
50
+ }
51
+ });
52
+ Object.defineProperty(exports, 'useUnit', {
53
+ enumerable: true,
54
+ get: function () {
55
+ return vanilla_intlayer_format.useUnit;
56
+ }
57
+ });
@@ -0,0 +1,81 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ let vanilla_intlayer = require("vanilla-intlayer");
3
+
4
+ Object.defineProperty(exports, 'getDictionary', {
5
+ enumerable: true,
6
+ get: function () {
7
+ return vanilla_intlayer.getDictionary;
8
+ }
9
+ });
10
+ Object.defineProperty(exports, 'getIntlayer', {
11
+ enumerable: true,
12
+ get: function () {
13
+ return vanilla_intlayer.getIntlayer;
14
+ }
15
+ });
16
+ Object.defineProperty(exports, 'installIntlayer', {
17
+ enumerable: true,
18
+ get: function () {
19
+ return vanilla_intlayer.installIntlayer;
20
+ }
21
+ });
22
+ Object.defineProperty(exports, 'localeCookie', {
23
+ enumerable: true,
24
+ get: function () {
25
+ return vanilla_intlayer.localeCookie;
26
+ }
27
+ });
28
+ Object.defineProperty(exports, 'localeInStorage', {
29
+ enumerable: true,
30
+ get: function () {
31
+ return vanilla_intlayer.localeInStorage;
32
+ }
33
+ });
34
+ Object.defineProperty(exports, 'setLocaleCookie', {
35
+ enumerable: true,
36
+ get: function () {
37
+ return vanilla_intlayer.setLocaleCookie;
38
+ }
39
+ });
40
+ Object.defineProperty(exports, 'setLocaleInStorage', {
41
+ enumerable: true,
42
+ get: function () {
43
+ return vanilla_intlayer.setLocaleInStorage;
44
+ }
45
+ });
46
+ Object.defineProperty(exports, 'useDictionary', {
47
+ enumerable: true,
48
+ get: function () {
49
+ return vanilla_intlayer.useDictionary;
50
+ }
51
+ });
52
+ Object.defineProperty(exports, 'useDictionaryDynamic', {
53
+ enumerable: true,
54
+ get: function () {
55
+ return vanilla_intlayer.useDictionaryDynamic;
56
+ }
57
+ });
58
+ Object.defineProperty(exports, 'useIntlayer', {
59
+ enumerable: true,
60
+ get: function () {
61
+ return vanilla_intlayer.useIntlayer;
62
+ }
63
+ });
64
+ Object.defineProperty(exports, 'useLocale', {
65
+ enumerable: true,
66
+ get: function () {
67
+ return vanilla_intlayer.useLocale;
68
+ }
69
+ });
70
+ Object.defineProperty(exports, 'useLocaleCookie', {
71
+ enumerable: true,
72
+ get: function () {
73
+ return vanilla_intlayer.useLocaleCookie;
74
+ }
75
+ });
76
+ Object.defineProperty(exports, 'useLocaleStorage', {
77
+ enumerable: true,
78
+ get: function () {
79
+ return vanilla_intlayer.useLocaleStorage;
80
+ }
81
+ });
@@ -0,0 +1,20 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_format_useCompact = require('./useCompact.cjs');
3
+ const require_format_useCurrency = require('./useCurrency.cjs');
4
+ const require_format_useDate = require('./useDate.cjs');
5
+ const require_format_useIntl = require('./useIntl.cjs');
6
+ const require_format_useList = require('./useList.cjs');
7
+ const require_format_useNumber = require('./useNumber.cjs');
8
+ const require_format_usePercentage = require('./usePercentage.cjs');
9
+ const require_format_useRelativeTime = require('./useRelativeTime.cjs');
10
+ const require_format_useUnit = require('./useUnit.cjs');
11
+
12
+ exports.useCompact = require_format_useCompact.useCompact;
13
+ exports.useCurrency = require_format_useCurrency.useCurrency;
14
+ exports.useDate = require_format_useDate.useDate;
15
+ exports.useIntl = require_format_useIntl.useIntl;
16
+ exports.useList = require_format_useList.useList;
17
+ exports.useNumber = require_format_useNumber.useNumber;
18
+ exports.usePercentage = require_format_usePercentage.usePercentage;
19
+ exports.useRelativeTime = require_format_useRelativeTime.useRelativeTime;
20
+ exports.useUnit = require_format_useUnit.useUnit;
@@ -0,0 +1,18 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_requestStorage = require('../requestStorage.cjs');
3
+ let _intlayer_config_built = require("@intlayer/config/built");
4
+ let _intlayer_core_formatters = require("@intlayer/core/formatters");
5
+
6
+ //#region src/format/useCompact.ts
7
+ const { defaultLocale } = _intlayer_config_built.internationalization;
8
+ const useCompact = () => {
9
+ const locale = require_requestStorage.getRequestLocale() ?? defaultLocale;
10
+ return (...args) => (0, _intlayer_core_formatters.compact)(args[0], {
11
+ ...args[1],
12
+ locale: args[1]?.locale ?? locale
13
+ });
14
+ };
15
+
16
+ //#endregion
17
+ exports.useCompact = useCompact;
18
+ //# sourceMappingURL=useCompact.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCompact.cjs","names":["internationalization","getRequestLocale","compact"],"sources":["../../../src/format/useCompact.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport { compact } from '@intlayer/core/formatters';\nimport type { DeclaredLocales } from '@intlayer/types/module_augmentation';\nimport { getRequestLocale } from '../requestStorage';\n\nconst { defaultLocale } = internationalization;\n\nexport const useCompact = () => {\n const locale = getRequestLocale() ?? (defaultLocale as DeclaredLocales);\n\n return (...args: Parameters<typeof compact>) =>\n compact(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;AAKA,MAAM,EAAE,kBAAkBA;AAE1B,MAAa,mBAAmB;CAC9B,MAAM,SAASC,wCAAiB,KAAM;CAEtC,QAAQ,GAAG,aACTC,mCAAQ,KAAK,IAAI;EACf,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
@@ -0,0 +1,18 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_requestStorage = require('../requestStorage.cjs');
3
+ let _intlayer_config_built = require("@intlayer/config/built");
4
+ let _intlayer_core_formatters = require("@intlayer/core/formatters");
5
+
6
+ //#region src/format/useCurrency.ts
7
+ const { defaultLocale } = _intlayer_config_built.internationalization;
8
+ const useCurrency = () => {
9
+ const locale = require_requestStorage.getRequestLocale() ?? defaultLocale;
10
+ return (...args) => (0, _intlayer_core_formatters.currency)(args[0], {
11
+ ...args[1],
12
+ locale: args[1]?.locale ?? locale
13
+ });
14
+ };
15
+
16
+ //#endregion
17
+ exports.useCurrency = useCurrency;
18
+ //# sourceMappingURL=useCurrency.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCurrency.cjs","names":["internationalization","getRequestLocale","currency"],"sources":["../../../src/format/useCurrency.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport { currency } from '@intlayer/core/formatters';\nimport type { DeclaredLocales } from '@intlayer/types/module_augmentation';\nimport { getRequestLocale } from '../requestStorage';\n\nconst { defaultLocale } = internationalization;\n\nexport const useCurrency = () => {\n const locale = getRequestLocale() ?? (defaultLocale as DeclaredLocales);\n\n return (...args: Parameters<typeof currency>) =>\n currency(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;AAKA,MAAM,EAAE,kBAAkBA;AAE1B,MAAa,oBAAoB;CAC/B,MAAM,SAASC,wCAAiB,KAAM;CAEtC,QAAQ,GAAG,aACTC,oCAAS,KAAK,IAAI;EAChB,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
@@ -0,0 +1,27 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_requestStorage = require('../requestStorage.cjs');
3
+ let _intlayer_config_built = require("@intlayer/config/built");
4
+ let _intlayer_core_formatters = require("@intlayer/core/formatters");
5
+
6
+ //#region src/format/useDate.ts
7
+ const { defaultLocale } = _intlayer_config_built.internationalization;
8
+ /**
9
+ * Astro hook that provides a localized date/time formatter bound to the request locale.
10
+ */
11
+ const useDate = () => {
12
+ const locale = require_requestStorage.getRequestLocale() ?? defaultLocale;
13
+ return (...args) => {
14
+ const options = typeof args[1] === "string" ? {
15
+ ..._intlayer_core_formatters.presets[args[1]],
16
+ locale
17
+ } : {
18
+ ...args[1],
19
+ locale: args[1]?.locale ?? locale
20
+ };
21
+ return (0, _intlayer_core_formatters.date)(args[0], options);
22
+ };
23
+ };
24
+
25
+ //#endregion
26
+ exports.useDate = useDate;
27
+ //# sourceMappingURL=useDate.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDate.cjs","names":["internationalization","getRequestLocale","presets","date"],"sources":["../../../src/format/useDate.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport { date, presets } from '@intlayer/core/formatters';\nimport type { DeclaredLocales } from '@intlayer/types/module_augmentation';\nimport { getRequestLocale } from '../requestStorage';\n\nconst { defaultLocale } = internationalization;\n\n/**\n * Astro hook that provides a localized date/time formatter bound to the request locale.\n */\nexport const useDate = () => {\n const locale = getRequestLocale() ?? (defaultLocale as DeclaredLocales);\n\n return (...args: Parameters<typeof date>) => {\n const options =\n typeof args[1] === 'string'\n ? { ...presets[args[1]], locale }\n : { ...args[1], locale: args[1]?.locale ?? locale };\n\n return date(args[0], options as Parameters<typeof date>[1]);\n };\n};\n"],"mappings":";;;;;;AAKA,MAAM,EAAE,kBAAkBA;;;;AAK1B,MAAa,gBAAgB;CAC3B,MAAM,SAASC,wCAAiB,KAAM;CAEtC,QAAQ,GAAG,SAAkC;EAC3C,MAAM,UACJ,OAAO,KAAK,OAAO,WACf;GAAE,GAAGC,kCAAQ,KAAK;GAAK;EAAO,IAC9B;GAAE,GAAG,KAAK;GAAI,QAAQ,KAAK,EAAE,EAAE,UAAU;EAAO;EAEtD,WAAOC,gCAAK,KAAK,IAAI,OAAqC;CAC5D;AACF"}
@@ -0,0 +1,24 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_requestStorage = require('../requestStorage.cjs');
3
+ let _intlayer_config_built = require("@intlayer/config/built");
4
+ let _intlayer_core_utils = require("@intlayer/core/utils");
5
+
6
+ //#region src/format/useIntl.ts
7
+ const { defaultLocale } = _intlayer_config_built.internationalization;
8
+ /**
9
+ * Astro hook that provides a locale-bound `Intl` object.
10
+ *
11
+ * It uses the request locale on the server, falling back to the configured
12
+ * default locale.
13
+ */
14
+ const useIntl = (locale) => {
15
+ const currentLocale = locale ?? require_requestStorage.getRequestLocale() ?? defaultLocale;
16
+ return {
17
+ intl: (0, _intlayer_core_utils.bindIntl)(currentLocale),
18
+ subscribe: () => () => {}
19
+ };
20
+ };
21
+
22
+ //#endregion
23
+ exports.useIntl = useIntl;
24
+ //# sourceMappingURL=useIntl.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIntl.cjs","names":["internationalization","getRequestLocale","bindIntl"],"sources":["../../../src/format/useIntl.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport { bindIntl, type WrappedIntl } from '@intlayer/core/utils';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { getRequestLocale } from '../requestStorage';\n\nconst { defaultLocale } = internationalization;\n\n/**\n * Astro hook that provides a locale-bound `Intl` object.\n *\n * It uses the request locale on the server, falling back to the configured\n * default locale.\n */\nexport const useIntl = (\n locale?: LocalesValues\n): {\n intl: WrappedIntl;\n subscribe: (callback: (intl: WrappedIntl) => void) => () => void;\n} => {\n const currentLocale =\n locale ?? getRequestLocale() ?? (defaultLocale as DeclaredLocales);\n const intl = bindIntl(currentLocale);\n\n return {\n intl,\n subscribe: () => () => {},\n };\n};\n"],"mappings":";;;;;;AAQA,MAAM,EAAE,kBAAkBA;;;;;;;AAQ1B,MAAa,WACX,WAIG;CACH,MAAM,gBACJ,UAAUC,wCAAiB,KAAM;CAGnC,OAAO;EACL,UAHWC,+BAAS,aAGjB;EACH,uBAAuB,CAAC;CAC1B;AACF"}
@@ -0,0 +1,18 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_requestStorage = require('../requestStorage.cjs');
3
+ let _intlayer_config_built = require("@intlayer/config/built");
4
+ let _intlayer_core_formatters = require("@intlayer/core/formatters");
5
+
6
+ //#region src/format/useList.ts
7
+ const { defaultLocale } = _intlayer_config_built.internationalization;
8
+ const useList = () => {
9
+ const locale = require_requestStorage.getRequestLocale() ?? defaultLocale;
10
+ return (...args) => (0, _intlayer_core_formatters.list)(args[0], {
11
+ ...args[1],
12
+ locale: args[1]?.locale ?? locale
13
+ });
14
+ };
15
+
16
+ //#endregion
17
+ exports.useList = useList;
18
+ //# sourceMappingURL=useList.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useList.cjs","names":["internationalization","getRequestLocale","list"],"sources":["../../../src/format/useList.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport { list } from '@intlayer/core/formatters';\nimport type { DeclaredLocales } from '@intlayer/types/module_augmentation';\nimport { getRequestLocale } from '../requestStorage';\n\nconst { defaultLocale } = internationalization;\n\nexport const useList = () => {\n const locale = getRequestLocale() ?? (defaultLocale as DeclaredLocales);\n\n return (...args: Parameters<typeof list>) =>\n list(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;AAKA,MAAM,EAAE,kBAAkBA;AAE1B,MAAa,gBAAgB;CAC3B,MAAM,SAASC,wCAAiB,KAAM;CAEtC,QAAQ,GAAG,aACTC,gCAAK,KAAK,IAAI;EACZ,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
@@ -0,0 +1,21 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_requestStorage = require('../requestStorage.cjs');
3
+ let _intlayer_config_built = require("@intlayer/config/built");
4
+ let _intlayer_core_formatters = require("@intlayer/core/formatters");
5
+
6
+ //#region src/format/useNumber.ts
7
+ const { defaultLocale } = _intlayer_config_built.internationalization;
8
+ /**
9
+ * Astro hook that provides a localized number formatter bound to the request locale.
10
+ */
11
+ const useNumber = () => {
12
+ const locale = require_requestStorage.getRequestLocale() ?? defaultLocale;
13
+ return (...args) => (0, _intlayer_core_formatters.number)(args[0], {
14
+ ...args[1],
15
+ locale: args[1]?.locale ?? locale
16
+ });
17
+ };
18
+
19
+ //#endregion
20
+ exports.useNumber = useNumber;
21
+ //# sourceMappingURL=useNumber.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useNumber.cjs","names":["internationalization","getRequestLocale","number"],"sources":["../../../src/format/useNumber.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport { number } from '@intlayer/core/formatters';\nimport type { DeclaredLocales } from '@intlayer/types/module_augmentation';\nimport { getRequestLocale } from '../requestStorage';\n\nconst { defaultLocale } = internationalization;\n\n/**\n * Astro hook that provides a localized number formatter bound to the request locale.\n */\nexport const useNumber = () => {\n const locale = getRequestLocale() ?? (defaultLocale as DeclaredLocales);\n\n return (...args: Parameters<typeof number>) =>\n number(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;AAKA,MAAM,EAAE,kBAAkBA;;;;AAK1B,MAAa,kBAAkB;CAC7B,MAAM,SAASC,wCAAiB,KAAM;CAEtC,QAAQ,GAAG,aACTC,kCAAO,KAAK,IAAI;EACd,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
@@ -0,0 +1,18 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_requestStorage = require('../requestStorage.cjs');
3
+ let _intlayer_config_built = require("@intlayer/config/built");
4
+ let _intlayer_core_formatters = require("@intlayer/core/formatters");
5
+
6
+ //#region src/format/usePercentage.ts
7
+ const { defaultLocale } = _intlayer_config_built.internationalization;
8
+ const usePercentage = () => {
9
+ const locale = require_requestStorage.getRequestLocale() ?? defaultLocale;
10
+ return (...args) => (0, _intlayer_core_formatters.percentage)(args[0], {
11
+ ...args[1],
12
+ locale: args[1]?.locale ?? locale
13
+ });
14
+ };
15
+
16
+ //#endregion
17
+ exports.usePercentage = usePercentage;
18
+ //# sourceMappingURL=usePercentage.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePercentage.cjs","names":["internationalization","getRequestLocale","percentage"],"sources":["../../../src/format/usePercentage.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport { percentage } from '@intlayer/core/formatters';\nimport type { DeclaredLocales } from '@intlayer/types/module_augmentation';\nimport { getRequestLocale } from '../requestStorage';\n\nconst { defaultLocale } = internationalization;\n\nexport const usePercentage = () => {\n const locale = getRequestLocale() ?? (defaultLocale as DeclaredLocales);\n\n return (...args: Parameters<typeof percentage>) =>\n percentage(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;AAKA,MAAM,EAAE,kBAAkBA;AAE1B,MAAa,sBAAsB;CACjC,MAAM,SAASC,wCAAiB,KAAM;CAEtC,QAAQ,GAAG,aACTC,sCAAW,KAAK,IAAI;EAClB,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
@@ -0,0 +1,18 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_requestStorage = require('../requestStorage.cjs');
3
+ let _intlayer_config_built = require("@intlayer/config/built");
4
+ let _intlayer_core_formatters = require("@intlayer/core/formatters");
5
+
6
+ //#region src/format/useRelativeTime.ts
7
+ const { defaultLocale } = _intlayer_config_built.internationalization;
8
+ const useRelativeTime = () => {
9
+ const locale = require_requestStorage.getRequestLocale() ?? defaultLocale;
10
+ return (...args) => (0, _intlayer_core_formatters.relativeTime)(args[0], args[1], {
11
+ ...args[2],
12
+ locale: args[2]?.locale ?? locale
13
+ });
14
+ };
15
+
16
+ //#endregion
17
+ exports.useRelativeTime = useRelativeTime;
18
+ //# sourceMappingURL=useRelativeTime.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRelativeTime.cjs","names":["internationalization","getRequestLocale","relativeTime"],"sources":["../../../src/format/useRelativeTime.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport { relativeTime } from '@intlayer/core/formatters';\nimport type { DeclaredLocales } from '@intlayer/types/module_augmentation';\nimport { getRequestLocale } from '../requestStorage';\n\nconst { defaultLocale } = internationalization;\n\nexport const useRelativeTime = () => {\n const locale = getRequestLocale() ?? (defaultLocale as DeclaredLocales);\n\n return (...args: Parameters<typeof relativeTime>) =>\n relativeTime(args[0], args[1], {\n ...args[2],\n locale: args[2]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;AAKA,MAAM,EAAE,kBAAkBA;AAE1B,MAAa,wBAAwB;CACnC,MAAM,SAASC,wCAAiB,KAAM;CAEtC,QAAQ,GAAG,aACTC,wCAAa,KAAK,IAAI,KAAK,IAAI;EAC7B,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
@@ -0,0 +1,18 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_requestStorage = require('../requestStorage.cjs');
3
+ let _intlayer_config_built = require("@intlayer/config/built");
4
+ let _intlayer_core_formatters = require("@intlayer/core/formatters");
5
+
6
+ //#region src/format/useUnit.ts
7
+ const { defaultLocale } = _intlayer_config_built.internationalization;
8
+ const useUnit = () => {
9
+ const locale = require_requestStorage.getRequestLocale() ?? defaultLocale;
10
+ return (...args) => (0, _intlayer_core_formatters.units)(args[0], {
11
+ ...args[1],
12
+ locale: args[1]?.locale ?? locale
13
+ });
14
+ };
15
+
16
+ //#endregion
17
+ exports.useUnit = useUnit;
18
+ //# sourceMappingURL=useUnit.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUnit.cjs","names":["internationalization","getRequestLocale","units"],"sources":["../../../src/format/useUnit.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport { units } from '@intlayer/core/formatters';\nimport type { DeclaredLocales } from '@intlayer/types/module_augmentation';\nimport { getRequestLocale } from '../requestStorage';\n\nconst { defaultLocale } = internationalization;\n\nexport const useUnit = () => {\n const locale = getRequestLocale() ?? (defaultLocale as DeclaredLocales);\n\n return (...args: Parameters<typeof units>) =>\n units(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;AAKA,MAAM,EAAE,kBAAkBA;AAE1B,MAAa,gBAAgB;CAC3B,MAAM,SAASC,wCAAiB,KAAM;CAEtC,QAAQ,GAAG,aACTC,iCAAM,KAAK,IAAI;EACb,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
@@ -0,0 +1,33 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ let vanilla_intlayer_html = require("vanilla-intlayer/html");
3
+
4
+ Object.defineProperty(exports, 'installIntlayerHTML', {
5
+ enumerable: true,
6
+ get: function () {
7
+ return vanilla_intlayer_html.installIntlayerHTML;
8
+ }
9
+ });
10
+ Object.defineProperty(exports, 'installIntlayerHTMLDynamic', {
11
+ enumerable: true,
12
+ get: function () {
13
+ return vanilla_intlayer_html.installIntlayerHTMLDynamic;
14
+ }
15
+ });
16
+ Object.defineProperty(exports, 'renderHTML', {
17
+ enumerable: true,
18
+ get: function () {
19
+ return vanilla_intlayer_html.renderHTML;
20
+ }
21
+ });
22
+ Object.defineProperty(exports, 'useHTML', {
23
+ enumerable: true,
24
+ get: function () {
25
+ return vanilla_intlayer_html.useHTML;
26
+ }
27
+ });
28
+ Object.defineProperty(exports, 'useHTMLRenderer', {
29
+ enumerable: true,
30
+ get: function () {
31
+ return vanilla_intlayer_html.useHTMLRenderer;
32
+ }
33
+ });
@@ -1,24 +1,25 @@
1
1
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
- const require_emitRewrittenPages = require('./emitRewrittenPages.cjs');
3
- let node_path = require("node:path");
4
- let _intlayer_config_node = require("@intlayer/config/node");
5
- let _intlayer_config_utils = require("@intlayer/config/utils");
6
- let _intlayer_engine_build = require("@intlayer/engine/build");
7
- let vite_intlayer = require("vite-intlayer");
2
+ const require_requestStorage = require('./requestStorage.cjs');
3
+ const require_useDictionary = require('./useDictionary.cjs');
4
+ const require_useIntlayer = require('./useIntlayer.cjs');
5
+ const require_useLocale = require('./useLocale.cjs');
8
6
 
9
7
  //#region src/index.ts
10
8
  /**
11
- * Keeps the intlayer packages out of Node's native module loader in *every*
12
- * Vite environment Astro renders from.
9
+ * Package self-reference to the Node-only half of the integration.
13
10
  *
14
- * A static dev server renders from `ssr`, but other setups render from Astro's
15
- * `astro` or `prerender` environments, and a top-level `ssr.noExternal` only
16
- * seeds the `ssr` one. Declaring it per environment covers the rest.
11
+ * Kept in a variable so the `import()` below is not statically analyzable:
12
+ * Astro bundles this package into the server build (`ssr.noExternal`), and a
13
+ * literal specifier would make the bundler follow it into `vite-intlayer`,
14
+ * `@intlayer/engine` and the framework compilers — which have no business in
15
+ * the server build, and do not even bundle (`velocityjs`, …). Left alone, the
16
+ * import only runs from `astro.config`, in Node.
17
17
  */
18
- const intlayerNoExternalEnvironments = () => ({
19
- name: "astro-intlayer-no-external",
20
- configEnvironment: () => ({ resolve: { noExternal: [vite_intlayer.INTLAYER_NO_EXTERNAL_PATTERN] } })
21
- });
18
+ const integrationSpecifier = "astro-intlayer/integration";
19
+ const loadIntegration = () => import(
20
+ /* @vite-ignore */
21
+ integrationSpecifier
22
+ );
22
23
  /**
23
24
  * Astro integration for Intlayer.
24
25
  *
@@ -26,12 +27,14 @@ const intlayerNoExternalEnvironments = () => ({
26
27
  * 1. Preparing Intlayer resources (dictionaries) at config setup.
27
28
  * 2. Injecting Vite plugins for aliases, locale-based routing (middleware), and build optimizations (prune).
28
29
  * 3. Configuring Vite aliases for dictionary access.
29
- * 4. Emitting the prerendered pages at their rewritten (localized) URLs.
30
+ * 4. Registering the `astro-intlayer/middleware`, which resolves the request
31
+ * locale into `Astro.locals.intlayer` for the `useLocale` / `useIntlayer` /
32
+ * `useDictionary` hooks of this package.
33
+ * 5. Emitting the prerendered pages at their rewritten (localized) URLs.
30
34
  *
31
- * The dev-time content watcher is not started here: the bundled
32
- * `vite-intlayer` plugin already starts one from `configureServer`, and
33
- * `watch()` subscribes anew on every call, so doing both would rebuild each
34
- * content edit twice.
35
+ * The implementation is loaded lazily: this entry is also the one pages import
36
+ * their hooks from, and it must not drag the Node-only tooling into their
37
+ * server bundle.
35
38
  *
36
39
  * @returns An Astro integration object.
37
40
  *
@@ -49,22 +52,13 @@ const intlayerNoExternalEnvironments = () => ({
49
52
  const intlayer = () => ({
50
53
  name: "astro-intlayer",
51
54
  hooks: {
52
- "astro:config:setup": async ({ updateConfig }) => {
53
- const configuration = (0, _intlayer_config_node.getConfiguration)();
54
- await (0, _intlayer_engine_build.prepareIntlayer)(configuration);
55
- updateConfig({ vite: {
56
- plugins: [(0, vite_intlayer.intlayer)(), intlayerNoExternalEnvironments()],
57
- resolve: { alias: { ...(0, _intlayer_config_utils.getAlias)({
58
- configuration,
59
- formatter: (value) => (0, node_path.resolve)(value)
60
- }) } },
61
- ssr: { noExternal: [vite_intlayer.INTLAYER_NO_EXTERNAL_PATTERN] }
62
- } });
55
+ "astro:config:setup": async (options) => {
56
+ const { configSetup } = await loadIntegration();
57
+ await configSetup(options);
63
58
  },
64
- "astro:build:done": async ({ dir, logger }) => {
65
- const configuration = (0, _intlayer_config_node.getConfiguration)();
66
- const emittedPages = await require_emitRewrittenPages.emitRewrittenPages(configuration, dir);
67
- if (emittedPages.length > 0) logger.info(`Emitted ${emittedPages.length} rewritten page(s): ${emittedPages.map(([from, to]) => `${from} \u2192 ${to}`).join(", ")}`);
59
+ "astro:build:done": async (options) => {
60
+ const { buildDone } = await loadIntegration();
61
+ await buildDone(options);
68
62
  }
69
63
  }
70
64
  });
@@ -72,4 +66,8 @@ const intlayer = () => ({
72
66
  //#endregion
73
67
  exports.default = intlayer;
74
68
  exports.intlayer = intlayer;
69
+ exports.getIntlayerLocals = require_requestStorage.getIntlayerLocals;
70
+ exports.useDictionary = require_useDictionary.useDictionary;
71
+ exports.useIntlayer = require_useIntlayer.useIntlayer;
72
+ exports.useLocale = require_useLocale.useLocale;
75
73
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["INTLAYER_NO_EXTERNAL_PATTERN","getConfiguration","prepareIntlayer","viteIntlayerPlugin","getAlias","resolve","emitRewrittenPages"],"sources":["../../src/index.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { getAlias } from '@intlayer/config/utils';\nimport { prepareIntlayer } from '@intlayer/engine/build';\nimport type { AstroIntegration } from 'astro';\nimport type { PluginOption } from 'vite';\nimport {\n INTLAYER_NO_EXTERNAL_PATTERN,\n intlayer as viteIntlayerPlugin,\n} from 'vite-intlayer';\nimport { emitRewrittenPages } from './emitRewrittenPages';\n\n/**\n * Keeps the intlayer packages out of Node's native module loader in *every*\n * Vite environment Astro renders from.\n *\n * A static dev server renders from `ssr`, but other setups render from Astro's\n * `astro` or `prerender` environments, and a top-level `ssr.noExternal` only\n * seeds the `ssr` one. Declaring it per environment covers the rest.\n */\nconst intlayerNoExternalEnvironments = (): PluginOption => ({\n name: 'astro-intlayer-no-external',\n configEnvironment: () => ({\n resolve: { noExternal: [INTLAYER_NO_EXTERNAL_PATTERN] },\n }),\n});\n\n/**\n * Astro integration for Intlayer.\n *\n * It handles:\n * 1. Preparing Intlayer resources (dictionaries) at config setup.\n * 2. Injecting Vite plugins for aliases, locale-based routing (middleware), and build optimizations (prune).\n * 3. Configuring Vite aliases for dictionary access.\n * 4. Emitting the prerendered pages at their rewritten (localized) URLs.\n *\n * The dev-time content watcher is not started here: the bundled\n * `vite-intlayer` plugin already starts one from `configureServer`, and\n * `watch()` subscribes anew on every call, so doing both would rebuild each\n * content edit twice.\n *\n * @returns An Astro integration object.\n *\n * @example\n * ```ts\n * // astro.config.mjs\n * import { defineConfig } from 'astro/config';\n * import { intlayer } from 'astro-intlayer';\n *\n * export default defineConfig({\n * integrations: [intlayer()],\n * });\n * ```\n */\nexport const intlayer = (): AstroIntegration =>\n ({\n name: 'astro-intlayer',\n hooks: {\n 'astro:config:setup': async ({ updateConfig }) => {\n const configuration = getConfiguration();\n\n // Prepare once per process start to ensure generated entries exist\n await prepareIntlayer(configuration);\n\n updateConfig({\n vite: {\n plugins: [\n viteIntlayerPlugin(),\n intlayerNoExternalEnvironments(),\n ] as PluginOption[],\n resolve: {\n alias: {\n ...getAlias({\n configuration,\n formatter: (value) => resolve(value),\n }),\n },\n },\n // `astro-intlayer` is tagged with the `astro` keyword, so Astro\n // treats it as an Astro package and crawls its dependency tree\n // (`vitefu`), force-externalizing every dependency it finds —\n // `@intlayer/core`, `@intlayer/config`, … — into\n // `resolve.external`. Vite checks `external` before `noExternal`,\n // so the `ssr.noExternal` that `vite-intlayer` returns from its\n // Vite `config` hook loses that race and the packages are loaded\n // natively by Node, stranding dictionary edits behind Node's\n // require cache. Declaring it here instead runs before the crawl,\n // which drops explicitly no-externalized packages from its result.\n ssr: {\n noExternal: [INTLAYER_NO_EXTERNAL_PATTERN],\n },\n },\n });\n },\n\n // Astro renders each page from its canonical file-system route, so a\n // static build has no file for the localized paths declared in\n // `routing.rewrite`. Mirror them here, otherwise the URLs produced by\n // `getLocalizedUrl` (links, hreflang, sitemap) 404 once deployed.\n 'astro:build:done': async ({ dir, logger }) => {\n const configuration = getConfiguration();\n\n const emittedPages = await emitRewrittenPages(configuration, dir);\n\n if (emittedPages.length > 0) {\n logger.info(\n `Emitted ${emittedPages.length} rewritten page(s): ${emittedPages\n .map(([from, to]) => `${from} \\u2192 ${to}`)\n .join(', ')}`\n );\n }\n },\n },\n }) satisfies AstroIntegration;\n\n/**\n * Alias of {@link intlayer}, kept so `astro add astro-intlayer` works.\n *\n * Astro's CLI codemod always writes a default import\n * (`import intlayer from 'astro-intlayer'`) without checking what the package\n * exports, so the integration has to be reachable that way too. The named\n * export stays the documented one.\n */\nexport default intlayer;\n"],"mappings":";;;;;;;;;;;;;;;;;AAoBA,MAAM,wCAAsD;CAC1D,MAAM;CACN,0BAA0B,EACxB,SAAS,EAAE,YAAY,CAACA,0CAA4B,EAAE,EACxD;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAa,kBACV;CACC,MAAM;CACN,OAAO;EACL,sBAAsB,OAAO,EAAE,mBAAmB;GAChD,MAAM,oBAAgBC,wCAAiB;GAGvC,UAAMC,wCAAgB,aAAa;GAEnC,aAAa,EACX,MAAM;IACJ,SAAS,KACPC,wBAAmB,GACnB,+BAA+B,CACjC;IACA,SAAS,EACP,OAAO,EACL,OAAGC,iCAAS;KACV;KACA,YAAY,cAAUC,mBAAQ,KAAK;IACrC,CAAC,EACH,EACF;IAWA,KAAK,EACH,YAAY,CAACL,0CAA4B,EAC3C;GACF,EACF,CAAC;EACH;EAMA,oBAAoB,OAAO,EAAE,KAAK,aAAa;GAC7C,MAAM,oBAAgBC,wCAAiB;GAEvC,MAAM,eAAe,MAAMK,8CAAmB,eAAe,GAAG;GAEhE,IAAI,aAAa,SAAS,GACxB,OAAO,KACL,WAAW,aAAa,OAAO,sBAAsB,aAClD,KAAK,CAAC,MAAM,QAAQ,GAAG,KAAK,UAAU,IAAI,CAAC,CAC3C,KAAK,IAAI,GACd;EAEJ;CACF;AACF"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../../src/index.ts"],"sourcesContent":["import type { AstroIntegration } from 'astro';\n\nexport type { IntlayerLocals } from './middleware';\nexport { getIntlayerLocals } from './requestStorage';\nexport { useDictionary } from './useDictionary';\nexport { useIntlayer } from './useIntlayer';\nexport type { UseLocaleProps, UseLocaleResult } from './useLocale';\nexport { useLocale } from './useLocale';\n\n/**\n * Package self-reference to the Node-only half of the integration.\n *\n * Kept in a variable so the `import()` below is not statically analyzable:\n * Astro bundles this package into the server build (`ssr.noExternal`), and a\n * literal specifier would make the bundler follow it into `vite-intlayer`,\n * `@intlayer/engine` and the framework compilers — which have no business in\n * the server build, and do not even bundle (`velocityjs`, …). Left alone, the\n * import only runs from `astro.config`, in Node.\n */\nconst integrationSpecifier = 'astro-intlayer/integration';\n\nconst loadIntegration = (): Promise<typeof import('./integration')> =>\n import(/* @vite-ignore */ integrationSpecifier);\n\n/**\n * Astro integration for Intlayer.\n *\n * It handles:\n * 1. Preparing Intlayer resources (dictionaries) at config setup.\n * 2. Injecting Vite plugins for aliases, locale-based routing (middleware), and build optimizations (prune).\n * 3. Configuring Vite aliases for dictionary access.\n * 4. Registering the `astro-intlayer/middleware`, which resolves the request\n * locale into `Astro.locals.intlayer` for the `useLocale` / `useIntlayer` /\n * `useDictionary` hooks of this package.\n * 5. Emitting the prerendered pages at their rewritten (localized) URLs.\n *\n * The implementation is loaded lazily: this entry is also the one pages import\n * their hooks from, and it must not drag the Node-only tooling into their\n * server bundle.\n *\n * @returns An Astro integration object.\n *\n * @example\n * ```ts\n * // astro.config.mjs\n * import { defineConfig } from 'astro/config';\n * import { intlayer } from 'astro-intlayer';\n *\n * export default defineConfig({\n * integrations: [intlayer()],\n * });\n * ```\n */\nexport const intlayer = (): AstroIntegration =>\n ({\n name: 'astro-intlayer',\n hooks: {\n 'astro:config:setup': async (options) => {\n const { configSetup } = await loadIntegration();\n\n await configSetup(options);\n },\n 'astro:build:done': async (options) => {\n const { buildDone } = await loadIntegration();\n\n await buildDone(options);\n },\n },\n }) satisfies AstroIntegration;\n\n/**\n * Alias of {@link intlayer}, kept so `astro add astro-intlayer` works.\n *\n * Astro's CLI codemod always writes a default import\n * (`import intlayer from 'astro-intlayer'`) without checking what the package\n * exports, so the integration has to be reachable that way too. The named\n * export stays the documented one.\n */\nexport default intlayer;\n"],"mappings":";;;;;;;;;;;;;;;;;AAmBA,MAAM,uBAAuB;AAE7B,MAAM,wBACJ;;CAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+B5B,MAAa,kBACV;CACC,MAAM;CACN,OAAO;EACL,sBAAsB,OAAO,YAAY;GACvC,MAAM,EAAE,gBAAgB,MAAM,gBAAgB;GAE9C,MAAM,YAAY,OAAO;EAC3B;EACA,oBAAoB,OAAO,YAAY;GACrC,MAAM,EAAE,cAAc,MAAM,gBAAgB;GAE5C,MAAM,UAAU,OAAO;EACzB;CACF;AACF"}