next-intlayer 6.1.5 → 6.1.6-canary.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.
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var getLocale_exports = {};
30
+ __export(getLocale_exports, {
31
+ getLocale: () => getLocale
32
+ });
33
+ module.exports = __toCommonJS(getLocale_exports);
34
+ var import_built = __toESM(require("@intlayer/config/built"));
35
+ var import_core = require("@intlayer/core");
36
+ var import_headers = require("next/headers");
37
+ const getLocale = async () => {
38
+ const { defaultLocale } = import_built.default.internationalization;
39
+ const { headerName } = import_built.default.middleware;
40
+ const headersList = await (0, import_headers.headers)();
41
+ const currentLocale = headersList.get(headerName);
42
+ if (currentLocale) return currentLocale;
43
+ const negotiatorHeaders = {};
44
+ headersList.forEach((value, key) => negotiatorHeaders[key] = value);
45
+ const userFallbackLocale = (0, import_core.localeDetector)(negotiatorHeaders);
46
+ if (userFallbackLocale) return userFallbackLocale;
47
+ return defaultLocale;
48
+ };
49
+ // Annotate the CommonJS export names for ESM import in node:
50
+ 0 && (module.exports = {
51
+ getLocale
52
+ });
53
+ //# sourceMappingURL=getLocale.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/server/getLocale.ts"],"sourcesContent":["import { Locales } from '@intlayer/config';\nimport configuration from '@intlayer/config/built';\nimport { localeDetector } from '@intlayer/core';\nimport { headers } from 'next/headers';\n\n// Helper function to extract locale from referer URL\nexport const getLocale = async (): Promise<Locales> => {\n const { defaultLocale } = configuration.internationalization;\n const { headerName } = configuration.middleware;\n\n const headersList = await headers();\n\n const currentLocale = headersList.get(headerName) as Locales | undefined;\n\n if (currentLocale) return currentLocale;\n\n const negotiatorHeaders: Record<string, string> = {};\n\n headersList.forEach((value, key) => (negotiatorHeaders[key] = value));\n\n const userFallbackLocale = localeDetector(negotiatorHeaders);\n\n if (userFallbackLocale) return userFallbackLocale as Locales;\n\n return defaultLocale;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA0B;AAC1B,kBAA+B;AAC/B,qBAAwB;AAGjB,MAAM,YAAY,YAA8B;AACrD,QAAM,EAAE,cAAc,IAAI,aAAAA,QAAc;AACxC,QAAM,EAAE,WAAW,IAAI,aAAAA,QAAc;AAErC,QAAM,cAAc,UAAM,wBAAQ;AAElC,QAAM,gBAAgB,YAAY,IAAI,UAAU;AAEhD,MAAI,cAAe,QAAO;AAE1B,QAAM,oBAA4C,CAAC;AAEnD,cAAY,QAAQ,CAAC,OAAO,QAAS,kBAAkB,GAAG,IAAI,KAAM;AAEpE,QAAM,yBAAqB,4BAAe,iBAAiB;AAE3D,MAAI,mBAAoB,QAAO;AAE/B,SAAO;AACT;","names":["configuration"]}
@@ -20,6 +20,7 @@ var server_exports = {};
20
20
  __export(server_exports, {
21
21
  IntlayerServer: () => import_server.IntlayerServer,
22
22
  IntlayerServerProvider: () => import_server.IntlayerServerProvider,
23
+ getLocale: () => import_getLocale.getLocale,
23
24
  locale: () => import_server.locale,
24
25
  t: () => import_server.t,
25
26
  useDictionary: () => import_server.useDictionary,
@@ -32,11 +33,13 @@ __export(server_exports, {
32
33
  });
33
34
  module.exports = __toCommonJS(server_exports);
34
35
  var import_server = require("react-intlayer/server");
36
+ var import_getLocale = require('./getLocale.cjs');
35
37
  var import_withIntlayer = require('./withIntlayer.cjs');
36
38
  // Annotate the CommonJS export names for ESM import in node:
37
39
  0 && (module.exports = {
38
40
  IntlayerServer,
39
41
  IntlayerServerProvider,
42
+ getLocale,
40
43
  locale,
41
44
  t,
42
45
  useDictionary,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/server/index.ts"],"sourcesContent":["export {\n IntlayerServer,\n IntlayerServerProvider,\n locale,\n t,\n useDictionary,\n useDictionaryDynamic,\n useI18n,\n useIntlayer,\n useLoadDynamic,\n useLocale,\n} from 'react-intlayer/server';\nexport { withIntlayer } from './withIntlayer';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAWO;AACP,0BAA6B;","names":[]}
1
+ {"version":3,"sources":["../../../src/server/index.ts"],"sourcesContent":["export {\n IntlayerServer,\n IntlayerServerProvider,\n locale,\n t,\n useDictionary,\n useDictionaryDynamic,\n useI18n,\n useIntlayer,\n useLoadDynamic,\n useLocale,\n} from 'react-intlayer/server';\nexport { getLocale } from './getLocale';\nexport { withIntlayer } from './withIntlayer';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAWO;AACP,uBAA0B;AAC1B,0BAA6B;","names":[]}
@@ -0,0 +1,19 @@
1
+ import configuration from "@intlayer/config/built";
2
+ import { localeDetector } from "@intlayer/core";
3
+ import { headers } from "next/headers";
4
+ const getLocale = async () => {
5
+ const { defaultLocale } = configuration.internationalization;
6
+ const { headerName } = configuration.middleware;
7
+ const headersList = await headers();
8
+ const currentLocale = headersList.get(headerName);
9
+ if (currentLocale) return currentLocale;
10
+ const negotiatorHeaders = {};
11
+ headersList.forEach((value, key) => negotiatorHeaders[key] = value);
12
+ const userFallbackLocale = localeDetector(negotiatorHeaders);
13
+ if (userFallbackLocale) return userFallbackLocale;
14
+ return defaultLocale;
15
+ };
16
+ export {
17
+ getLocale
18
+ };
19
+ //# sourceMappingURL=getLocale.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/server/getLocale.ts"],"sourcesContent":["import { Locales } from '@intlayer/config';\nimport configuration from '@intlayer/config/built';\nimport { localeDetector } from '@intlayer/core';\nimport { headers } from 'next/headers';\n\n// Helper function to extract locale from referer URL\nexport const getLocale = async (): Promise<Locales> => {\n const { defaultLocale } = configuration.internationalization;\n const { headerName } = configuration.middleware;\n\n const headersList = await headers();\n\n const currentLocale = headersList.get(headerName) as Locales | undefined;\n\n if (currentLocale) return currentLocale;\n\n const negotiatorHeaders: Record<string, string> = {};\n\n headersList.forEach((value, key) => (negotiatorHeaders[key] = value));\n\n const userFallbackLocale = localeDetector(negotiatorHeaders);\n\n if (userFallbackLocale) return userFallbackLocale as Locales;\n\n return defaultLocale;\n};\n"],"mappings":"AACA,OAAO,mBAAmB;AAC1B,SAAS,sBAAsB;AAC/B,SAAS,eAAe;AAGjB,MAAM,YAAY,YAA8B;AACrD,QAAM,EAAE,cAAc,IAAI,cAAc;AACxC,QAAM,EAAE,WAAW,IAAI,cAAc;AAErC,QAAM,cAAc,MAAM,QAAQ;AAElC,QAAM,gBAAgB,YAAY,IAAI,UAAU;AAEhD,MAAI,cAAe,QAAO;AAE1B,QAAM,oBAA4C,CAAC;AAEnD,cAAY,QAAQ,CAAC,OAAO,QAAS,kBAAkB,GAAG,IAAI,KAAM;AAEpE,QAAM,qBAAqB,eAAe,iBAAiB;AAE3D,MAAI,mBAAoB,QAAO;AAE/B,SAAO;AACT;","names":[]}
@@ -10,10 +10,12 @@ import {
10
10
  useLoadDynamic,
11
11
  useLocale
12
12
  } from "react-intlayer/server";
13
+ import { getLocale } from "./getLocale.mjs";
13
14
  import { withIntlayer } from "./withIntlayer.mjs";
14
15
  export {
15
16
  IntlayerServer,
16
17
  IntlayerServerProvider,
18
+ getLocale,
17
19
  locale,
18
20
  t,
19
21
  useDictionary,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/server/index.ts"],"sourcesContent":["export {\n IntlayerServer,\n IntlayerServerProvider,\n locale,\n t,\n useDictionary,\n useDictionaryDynamic,\n useI18n,\n useIntlayer,\n useLoadDynamic,\n useLocale,\n} from 'react-intlayer/server';\nexport { withIntlayer } from './withIntlayer';\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oBAAoB;","names":[]}
1
+ {"version":3,"sources":["../../../src/server/index.ts"],"sourcesContent":["export {\n IntlayerServer,\n IntlayerServerProvider,\n locale,\n t,\n useDictionary,\n useDictionaryDynamic,\n useI18n,\n useIntlayer,\n useLoadDynamic,\n useLocale,\n} from 'react-intlayer/server';\nexport { getLocale } from './getLocale';\nexport { withIntlayer } from './withIntlayer';\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAiB;AAC1B,SAAS,oBAAoB;","names":[]}
@@ -0,0 +1,3 @@
1
+ import { Locales } from '@intlayer/config';
2
+ export declare const getLocale: () => Promise<Locales>;
3
+ //# sourceMappingURL=getLocale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getLocale.d.ts","sourceRoot":"","sources":["../../../src/server/getLocale.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAM3C,eAAO,MAAM,SAAS,QAAa,OAAO,CAAC,OAAO,CAmBjD,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export { IntlayerServer, IntlayerServerProvider, locale, t, useDictionary, useDictionaryDynamic, useI18n, useIntlayer, useLoadDynamic, useLocale, } from 'react-intlayer/server';
2
+ export { getLocale } from './getLocale';
2
3
  export { withIntlayer } from './withIntlayer';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,MAAM,EACN,CAAC,EACD,aAAa,EACb,oBAAoB,EACpB,OAAO,EACP,WAAW,EACX,cAAc,EACd,SAAS,GACV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,MAAM,EACN,CAAC,EACD,aAAa,EACb,oBAAoB,EACpB,OAAO,EACP,WAAW,EACX,cAAc,EACd,SAAS,GACV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-intlayer",
3
- "version": "6.1.5",
3
+ "version": "6.1.6-canary.0",
4
4
  "private": false,
5
5
  "description": "Simplify internationalization i18n in Next.js with context providers, hooks, locale detection, and multilingual content integration.",
6
6
  "keywords": [
@@ -94,12 +94,12 @@
94
94
  "dependencies": {
95
95
  "deepmerge": "^4.3.1",
96
96
  "node-loader": "^2.1.0",
97
- "@intlayer/dictionaries-entry": "6.1.5",
98
- "@intlayer/config": "6.1.5",
99
- "@intlayer/chokidar": "6.1.5",
100
- "@intlayer/core": "6.1.5",
101
- "@intlayer/webpack": "6.1.5",
102
- "react-intlayer": "6.1.5"
97
+ "@intlayer/config": "6.1.6-canary.0",
98
+ "@intlayer/chokidar": "6.1.6-canary.0",
99
+ "@intlayer/core": "6.1.6-canary.0",
100
+ "@intlayer/webpack": "6.1.6-canary.0",
101
+ "@intlayer/dictionaries-entry": "6.1.6-canary.0",
102
+ "react-intlayer": "6.1.6-canary.0"
103
103
  },
104
104
  "devDependencies": {
105
105
  "@types/node": "^24.5.2",
@@ -118,18 +118,18 @@
118
118
  "@utils/ts-config": "1.0.4",
119
119
  "@utils/ts-config-types": "1.0.4",
120
120
  "@utils/tsup-config": "1.0.4",
121
- "intlayer": "6.1.5"
121
+ "intlayer": "6.1.6-canary.0"
122
122
  },
123
123
  "peerDependencies": {
124
124
  "next": ">=14.0.0",
125
125
  "react": ">=16.0.0",
126
126
  "react-dom": ">=16.0.0",
127
- "@intlayer/config": "6.1.5",
128
- "@intlayer/core": "6.1.5",
129
- "@intlayer/webpack": "6.1.5",
130
- "@intlayer/dictionaries-entry": "6.1.5",
131
- "intlayer": "6.1.5",
132
- "react-intlayer": "6.1.5"
127
+ "@intlayer/config": "6.1.6-canary.0",
128
+ "@intlayer/dictionaries-entry": "6.1.6-canary.0",
129
+ "intlayer": "6.1.6-canary.0",
130
+ "@intlayer/webpack": "6.1.6-canary.0",
131
+ "@intlayer/core": "6.1.6-canary.0",
132
+ "react-intlayer": "6.1.6-canary.0"
133
133
  },
134
134
  "engines": {
135
135
  "node": ">=14.18"