react-intlayer 5.5.0-canary.0 → 5.5.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.
@@ -23,13 +23,15 @@ __export(server_exports, {
23
23
  locale: () => import_IntlayerServerProvider.locale,
24
24
  t: () => import_t.t,
25
25
  useDictionary: () => import_useDictionary.useDictionary,
26
- useIntlayer: () => import_useIntlayer.useIntlayer
26
+ useIntlayer: () => import_useIntlayer.useIntlayer,
27
+ useLocale: () => import_useLocale.useLocale
27
28
  });
28
29
  module.exports = __toCommonJS(server_exports);
29
30
  var import_IntlayerServerProvider = require('./IntlayerServerProvider.cjs');
30
- var import_useIntlayer = require('./useIntlayer.cjs');
31
- var import_useDictionary = require('./useDictionary.cjs');
32
31
  var import_t = require('./t.cjs');
32
+ var import_useDictionary = require('./useDictionary.cjs');
33
+ var import_useIntlayer = require('./useIntlayer.cjs');
34
+ var import_useLocale = require('./useLocale.cjs');
33
35
  // Annotate the CommonJS export names for ESM import in node:
34
36
  0 && (module.exports = {
35
37
  IntlayerServer,
@@ -37,6 +39,7 @@ var import_t = require('./t.cjs');
37
39
  locale,
38
40
  t,
39
41
  useDictionary,
40
- useIntlayer
42
+ useIntlayer,
43
+ useLocale
41
44
  });
42
45
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/server/index.ts"],"sourcesContent":["export {\n IntlayerServerContext as IntlayerServer,\n locale,\n IntlayerServerProvider,\n} from './IntlayerServerProvider';\nexport { useIntlayer } from './useIntlayer';\nexport { useDictionary } from './useDictionary';\nexport { t } from './t';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAIO;AACP,yBAA4B;AAC5B,2BAA8B;AAC9B,eAAkB;","names":[]}
1
+ {"version":3,"sources":["../../../src/server/index.ts"],"sourcesContent":["export {\n IntlayerServerContext as IntlayerServer,\n IntlayerServerProvider,\n locale,\n} from './IntlayerServerProvider';\nexport { t } from './t';\nexport { useDictionary } from './useDictionary';\nexport { useIntlayer } from './useIntlayer';\nexport { useLocale } from './useLocale';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAIO;AACP,eAAkB;AAClB,2BAA8B;AAC9B,yBAA4B;AAC5B,uBAA0B;","names":[]}
@@ -0,0 +1,46 @@
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 useLocale_exports = {};
30
+ __export(useLocale_exports, {
31
+ useLocale: () => useLocale
32
+ });
33
+ module.exports = __toCommonJS(useLocale_exports);
34
+ var import_built = __toESM(require("@intlayer/config/built"));
35
+ var import_IntlayerServerProvider = require('./IntlayerServerProvider.cjs');
36
+ var import_serverContext = require('./serverContext.cjs');
37
+ const useLocale = () => {
38
+ const { defaultLocale } = import_built.default?.internationalization ?? {};
39
+ const locale = (0, import_serverContext.getServerContext)(import_IntlayerServerProvider.IntlayerServerContext) ?? defaultLocale;
40
+ return { locale };
41
+ };
42
+ // Annotate the CommonJS export names for ESM import in node:
43
+ 0 && (module.exports = {
44
+ useLocale
45
+ });
46
+ //# sourceMappingURL=useLocale.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/server/useLocale.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { Locales, LocalesValues } from '@intlayer/config/client';\nimport { IntlayerServerContext } from './IntlayerServerProvider';\nimport { getServerContext } from './serverContext';\n\n/**\n * On the server side, Hook that picking one dictionary by its key and return the content\n *\n * If the locale is not provided, it will use the locale from the server context\n */\nexport const useLocale = () => {\n const { defaultLocale } = configuration?.internationalization ?? {};\n const locale =\n (getServerContext<LocalesValues>(IntlayerServerContext) as Locales) ??\n (defaultLocale as Locales);\n\n return { locale };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAE1B,oCAAsC;AACtC,2BAAiC;AAO1B,MAAM,YAAY,MAAM;AAC7B,QAAM,EAAE,cAAc,IAAI,aAAAA,SAAe,wBAAwB,CAAC;AAClE,QAAM,aACH,uCAAgC,mDAAqB,KACrD;AAEH,SAAO,EAAE,OAAO;AAClB;","names":["configuration"]}
@@ -1,17 +1,19 @@
1
1
  import {
2
2
  IntlayerServerContext,
3
- locale,
4
- IntlayerServerProvider
3
+ IntlayerServerProvider,
4
+ locale
5
5
  } from "./IntlayerServerProvider.mjs";
6
- import { useIntlayer } from "./useIntlayer.mjs";
7
- import { useDictionary } from "./useDictionary.mjs";
8
6
  import { t } from "./t.mjs";
7
+ import { useDictionary } from "./useDictionary.mjs";
8
+ import { useIntlayer } from "./useIntlayer.mjs";
9
+ import { useLocale } from "./useLocale.mjs";
9
10
  export {
10
11
  IntlayerServerContext as IntlayerServer,
11
12
  IntlayerServerProvider,
12
13
  locale,
13
14
  t,
14
15
  useDictionary,
15
- useIntlayer
16
+ useIntlayer,
17
+ useLocale
16
18
  };
17
19
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/server/index.ts"],"sourcesContent":["export {\n IntlayerServerContext as IntlayerServer,\n locale,\n IntlayerServerProvider,\n} from './IntlayerServerProvider';\nexport { useIntlayer } from './useIntlayer';\nexport { useDictionary } from './useDictionary';\nexport { t } from './t';\n"],"mappings":"AAAA;AAAA,EAC2B;AAAA,EACzB;AAAA,EACA;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,SAAS;","names":[]}
1
+ {"version":3,"sources":["../../../src/server/index.ts"],"sourcesContent":["export {\n IntlayerServerContext as IntlayerServer,\n IntlayerServerProvider,\n locale,\n} from './IntlayerServerProvider';\nexport { t } from './t';\nexport { useDictionary } from './useDictionary';\nexport { useIntlayer } from './useIntlayer';\nexport { useLocale } from './useLocale';\n"],"mappings":"AAAA;AAAA,EAC2B;AAAA,EACzB;AAAA,EACA;AAAA,OACK;AACP,SAAS,SAAS;AAClB,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;","names":[]}
@@ -0,0 +1,12 @@
1
+ import configuration from "@intlayer/config/built";
2
+ import { IntlayerServerContext } from "./IntlayerServerProvider.mjs";
3
+ import { getServerContext } from "./serverContext.mjs";
4
+ const useLocale = () => {
5
+ const { defaultLocale } = configuration?.internationalization ?? {};
6
+ const locale = getServerContext(IntlayerServerContext) ?? defaultLocale;
7
+ return { locale };
8
+ };
9
+ export {
10
+ useLocale
11
+ };
12
+ //# sourceMappingURL=useLocale.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/server/useLocale.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { Locales, LocalesValues } from '@intlayer/config/client';\nimport { IntlayerServerContext } from './IntlayerServerProvider';\nimport { getServerContext } from './serverContext';\n\n/**\n * On the server side, Hook that picking one dictionary by its key and return the content\n *\n * If the locale is not provided, it will use the locale from the server context\n */\nexport const useLocale = () => {\n const { defaultLocale } = configuration?.internationalization ?? {};\n const locale =\n (getServerContext<LocalesValues>(IntlayerServerContext) as Locales) ??\n (defaultLocale as Locales);\n\n return { locale };\n};\n"],"mappings":"AAAA,OAAO,mBAAmB;AAE1B,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AAO1B,MAAM,YAAY,MAAM;AAC7B,QAAM,EAAE,cAAc,IAAI,eAAe,wBAAwB,CAAC;AAClE,QAAM,SACH,iBAAgC,qBAAqB,KACrD;AAEH,SAAO,EAAE,OAAO;AAClB;","names":[]}
@@ -1,5 +1,6 @@
1
- export { IntlayerServerContext as IntlayerServer, locale, IntlayerServerProvider, } from './IntlayerServerProvider';
2
- export { useIntlayer } from './useIntlayer';
3
- export { useDictionary } from './useDictionary';
1
+ export { IntlayerServerContext as IntlayerServer, IntlayerServerProvider, locale, } from './IntlayerServerProvider';
4
2
  export { t } from './t';
3
+ export { useDictionary } from './useDictionary';
4
+ export { useIntlayer } from './useIntlayer';
5
+ export { useLocale } from './useLocale';
5
6
  //# 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,qBAAqB,IAAI,cAAc,EACvC,MAAM,EACN,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,IAAI,cAAc,EACvC,sBAAsB,EACtB,MAAM,GACP,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { Locales } from '@intlayer/config/client';
2
+ /**
3
+ * On the server side, Hook that picking one dictionary by its key and return the content
4
+ *
5
+ * If the locale is not provided, it will use the locale from the server context
6
+ */
7
+ export declare const useLocale: () => {
8
+ locale: Locales;
9
+ };
10
+ //# sourceMappingURL=useLocale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLocale.d.ts","sourceRoot":"","sources":["../../../src/server/useLocale.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAiB,MAAM,yBAAyB,CAAC;AAItE;;;;GAIG;AACH,eAAO,MAAM,SAAS;;CAOrB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-intlayer",
3
- "version": "5.5.0-canary.0",
3
+ "version": "5.5.0",
4
4
  "private": false,
5
5
  "description": "Easily internationalize i18n your React applications with type-safe multilingual content management.",
6
6
  "keywords": [
@@ -69,11 +69,11 @@
69
69
  ],
70
70
  "dependencies": {
71
71
  "js-cookie": "^3.0.5",
72
- "@intlayer/config": "5.5.0-canary.0",
73
- "@intlayer/core": "5.5.0-canary.0",
74
- "@intlayer/api": "5.5.0-canary.0",
75
- "@intlayer/editor-react": "5.5.0-canary.0",
76
- "@intlayer/dictionaries-entry": "5.5.0-canary.0"
72
+ "@intlayer/dictionaries-entry": "5.5.0",
73
+ "@intlayer/editor-react": "5.5.0",
74
+ "@intlayer/core": "5.5.0",
75
+ "@intlayer/api": "5.5.0",
76
+ "@intlayer/config": "5.5.0"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@craco/types": "^7.1.0",
@@ -93,17 +93,17 @@
93
93
  "@utils/ts-config": "1.0.4",
94
94
  "@utils/ts-config-types": "1.0.4",
95
95
  "@utils/tsup-config": "1.0.4",
96
- "@intlayer/backend": "5.5.0-canary.0"
96
+ "@intlayer/backend": "5.5.0"
97
97
  },
98
98
  "peerDependencies": {
99
99
  "react": ">=16.0.0",
100
100
  "react-dom": ">=16.0.0",
101
- "@intlayer/api": "5.5.0-canary.0",
102
- "@intlayer/config": "5.5.0-canary.0",
103
- "@intlayer/core": "5.5.0-canary.0",
104
- "@intlayer/editor-react": "5.5.0-canary.0",
105
- "@intlayer/dictionaries-entry": "5.5.0-canary.0",
106
- "intlayer": "5.5.0-canary.0"
101
+ "@intlayer/core": "5.5.0",
102
+ "@intlayer/api": "5.5.0",
103
+ "@intlayer/config": "5.5.0",
104
+ "@intlayer/dictionaries-entry": "5.5.0",
105
+ "@intlayer/editor-react": "5.5.0",
106
+ "intlayer": "5.5.0"
107
107
  },
108
108
  "engines": {
109
109
  "node": ">=14.18"