astro-intlayer 9.5.10 → 9.5.12

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.
@@ -1,5 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  let node_async_hooks = require("node:async_hooks");
3
+ let _intlayer_core_interpreter = require("@intlayer/core/interpreter");
3
4
 
4
5
  //#region src/requestStorage.ts
5
6
  /**
@@ -16,6 +17,7 @@ const getIntlayerLocals = () => requestStorage.getStore()?.intlayer;
16
17
  * Returns the locale of the request being rendered, if any.
17
18
  */
18
19
  const getRequestLocale = () => getIntlayerLocals()?.locale;
20
+ (0, _intlayer_core_interpreter.registerAmbientLocaleResolver)(getRequestLocale);
19
21
 
20
22
  //#endregion
21
23
  exports.getIntlayerLocals = getIntlayerLocals;
@@ -1 +1 @@
1
- {"version":3,"file":"requestStorage.cjs","names":["AsyncLocalStorage"],"sources":["../../src/requestStorage.ts"],"sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks';\nimport type { DeclaredLocales } from '@intlayer/types/module_augmentation';\nimport type { IntlayerLocals } from './middleware';\n\n/**\n * `Astro.locals` of the request being rendered, made available to every\n * function running inside the middleware scope — page and component\n * frontmatter, endpoints, nested middleware — without passing `Astro` around.\n */\nexport const requestStorage = new AsyncLocalStorage<{\n intlayer?: IntlayerLocals;\n}>();\n\n/**\n * Returns the Intlayer locals of the request being rendered, if any.\n */\nexport const getIntlayerLocals = (): IntlayerLocals | undefined =>\n requestStorage.getStore()?.intlayer;\n\n/**\n * Returns the locale of the request being rendered, if any.\n */\nexport const getRequestLocale = (): DeclaredLocales | undefined =>\n getIntlayerLocals()?.locale;\n"],"mappings":";;;;;;;;;AASA,MAAa,iBAAiB,IAAIA,mCAE/B;;;;AAKH,MAAa,0BACX,eAAe,SAAS,CAAC,EAAE;;;;AAK7B,MAAa,yBACX,kBAAkB,CAAC,EAAE"}
1
+ {"version":3,"file":"requestStorage.cjs","names":["AsyncLocalStorage","registerAmbientLocaleResolver"],"sources":["../../src/requestStorage.ts"],"sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks';\nimport { registerAmbientLocaleResolver } from '@intlayer/core/interpreter';\nimport type { DeclaredLocales } from '@intlayer/types/module_augmentation';\nimport type { IntlayerLocals } from './middleware';\n\n/**\n * `Astro.locals` of the request being rendered, made available to every\n * function running inside the middleware scope — page and component\n * frontmatter, endpoints, nested middleware — without passing `Astro` around.\n */\nexport const requestStorage = new AsyncLocalStorage<{\n intlayer?: IntlayerLocals;\n}>();\n\n/**\n * Returns the Intlayer locals of the request being rendered, if any.\n */\nexport const getIntlayerLocals = (): IntlayerLocals | undefined =>\n requestStorage.getStore()?.intlayer;\n\n/**\n * Returns the locale of the request being rendered, if any.\n */\nexport const getRequestLocale = (): DeclaredLocales | undefined =>\n getIntlayerLocals()?.locale;\n\n// Lets a bare `getIntlayer` / `getDictionary` from any Intlayer package resolve\n// to the locale of the request being handled.\nregisterAmbientLocaleResolver(getRequestLocale);\n"],"mappings":";;;;;;;;;;AAUA,MAAa,iBAAiB,IAAIA,mCAE/B;;;;AAKH,MAAa,0BACX,eAAe,SAAS,CAAC,EAAE;;;;AAK7B,MAAa,yBACX,kBAAkB,CAAC,EAAE;IAIvBC,0DAA8B,gBAAgB"}
@@ -1,4 +1,5 @@
1
1
  import { AsyncLocalStorage } from "node:async_hooks";
2
+ import { registerAmbientLocaleResolver } from "@intlayer/core/interpreter";
2
3
 
3
4
  //#region src/requestStorage.ts
4
5
  /**
@@ -15,6 +16,7 @@ const getIntlayerLocals = () => requestStorage.getStore()?.intlayer;
15
16
  * Returns the locale of the request being rendered, if any.
16
17
  */
17
18
  const getRequestLocale = () => getIntlayerLocals()?.locale;
19
+ registerAmbientLocaleResolver(getRequestLocale);
18
20
 
19
21
  //#endregion
20
22
  export { getIntlayerLocals, getRequestLocale, requestStorage };
@@ -1 +1 @@
1
- {"version":3,"file":"requestStorage.mjs","names":[],"sources":["../../src/requestStorage.ts"],"sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks';\nimport type { DeclaredLocales } from '@intlayer/types/module_augmentation';\nimport type { IntlayerLocals } from './middleware';\n\n/**\n * `Astro.locals` of the request being rendered, made available to every\n * function running inside the middleware scope — page and component\n * frontmatter, endpoints, nested middleware — without passing `Astro` around.\n */\nexport const requestStorage = new AsyncLocalStorage<{\n intlayer?: IntlayerLocals;\n}>();\n\n/**\n * Returns the Intlayer locals of the request being rendered, if any.\n */\nexport const getIntlayerLocals = (): IntlayerLocals | undefined =>\n requestStorage.getStore()?.intlayer;\n\n/**\n * Returns the locale of the request being rendered, if any.\n */\nexport const getRequestLocale = (): DeclaredLocales | undefined =>\n getIntlayerLocals()?.locale;\n"],"mappings":";;;;;;;;AASA,MAAa,iBAAiB,IAAI,kBAE/B;;;;AAKH,MAAa,0BACX,eAAe,SAAS,CAAC,EAAE;;;;AAK7B,MAAa,yBACX,kBAAkB,CAAC,EAAE"}
1
+ {"version":3,"file":"requestStorage.mjs","names":[],"sources":["../../src/requestStorage.ts"],"sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks';\nimport { registerAmbientLocaleResolver } from '@intlayer/core/interpreter';\nimport type { DeclaredLocales } from '@intlayer/types/module_augmentation';\nimport type { IntlayerLocals } from './middleware';\n\n/**\n * `Astro.locals` of the request being rendered, made available to every\n * function running inside the middleware scope — page and component\n * frontmatter, endpoints, nested middleware — without passing `Astro` around.\n */\nexport const requestStorage = new AsyncLocalStorage<{\n intlayer?: IntlayerLocals;\n}>();\n\n/**\n * Returns the Intlayer locals of the request being rendered, if any.\n */\nexport const getIntlayerLocals = (): IntlayerLocals | undefined =>\n requestStorage.getStore()?.intlayer;\n\n/**\n * Returns the locale of the request being rendered, if any.\n */\nexport const getRequestLocale = (): DeclaredLocales | undefined =>\n getIntlayerLocals()?.locale;\n\n// Lets a bare `getIntlayer` / `getDictionary` from any Intlayer package resolve\n// to the locale of the request being handled.\nregisterAmbientLocaleResolver(getRequestLocale);\n"],"mappings":";;;;;;;;;AAUA,MAAa,iBAAiB,IAAI,kBAE/B;;;;AAKH,MAAa,0BACX,eAAe,SAAS,CAAC,EAAE;;;;AAK7B,MAAa,yBACX,kBAAkB,CAAC,EAAE;AAIvB,8BAA8B,gBAAgB"}
@@ -1 +1 @@
1
- {"version":3,"file":"requestStorage.d.ts","names":[],"sources":["../../src/requestStorage.ts"],"mappings":";;;;;;;;;qBASa,gBAAc;EACd,WAAA;;;;;qBAMA,yBAAwB;;;;qBAMxB,wBAAuB"}
1
+ {"version":3,"file":"requestStorage.d.ts","names":[],"sources":["../../src/requestStorage.ts"],"mappings":";;;;;;;;;qBAUa,gBAAc;EACd,WAAA;;;;;qBAMA,yBAAwB;;;;qBAMxB,wBAAuB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-intlayer",
3
- "version": "9.5.10",
3
+ "version": "9.5.12",
4
4
  "private": false,
5
5
  "description": "Easily internationalize i18n your Astro applications with type-safe multilingual content management.",
6
6
  "keywords": [
@@ -167,15 +167,15 @@
167
167
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
168
168
  },
169
169
  "dependencies": {
170
- "@intlayer/config": "9.5.10",
171
- "@intlayer/core": "9.5.10",
172
- "@intlayer/engine": "9.5.10",
173
- "@intlayer/types": "9.5.10",
174
- "vanilla-intlayer": "9.5.10",
175
- "vite-intlayer": "9.5.10"
170
+ "@intlayer/config": "9.5.12",
171
+ "@intlayer/core": "9.5.12",
172
+ "@intlayer/engine": "9.5.12",
173
+ "@intlayer/types": "9.5.12",
174
+ "vanilla-intlayer": "9.5.12",
175
+ "vite-intlayer": "9.5.12"
176
176
  },
177
177
  "devDependencies": {
178
- "@intlayer/dictionaries-entry": "9.5.10",
178
+ "@intlayer/dictionaries-entry": "9.5.12",
179
179
  "@types/node": "^22",
180
180
  "@utils/ts-config": "1.0.4",
181
181
  "@utils/ts-config-types": "1.0.4",