intlayer 1.2.1 → 2.0.1

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.
package/README.md CHANGED
@@ -43,9 +43,9 @@ Create and manage your content dictionaries:
43
43
 
44
44
  ```typescript
45
45
  // src/app/[locale]/page.content.ts
46
- import { t, enu, type ContentModule } from "intlayer";
46
+ import { t, enu, type DeclarationContent } from "intlayer";
47
47
 
48
- const pageContent: ContentModule = {
48
+ const pageContent: DeclarationContent = {
49
49
  id: "page",
50
50
  getStarted: {
51
51
  main: t({
@@ -79,7 +79,7 @@ export default pageContent;
79
79
 
80
80
  import { t } from "intlayer";
81
81
 
82
- /** @type {import('intlayer').ContentModule} */
82
+ /** @type {import('intlayer').DeclarationContent} */
83
83
  const pageContent = {
84
84
  id: "page",
85
85
  getStarted: {
@@ -114,7 +114,7 @@ export default pageContent;
114
114
 
115
115
  const { t } = require("intlayer");
116
116
 
117
- /** @type {import('intlayer').ContentModule} */
117
+ /** @type {import('intlayer').DeclarationContent} */
118
118
  const pageContent = {
119
119
  id: "page",
120
120
  getStarted: {
@@ -144,7 +144,8 @@ module.exports = pageContent;
144
144
 
145
145
  #### Using JSON
146
146
 
147
- ```json
147
+ ```json5
148
+ // src/app/[locale]/page.content.json
148
149
  {
149
150
  "id": "page",
150
151
  "getStarted": {
@@ -152,9 +153,9 @@ module.exports = pageContent;
152
153
  "nodeType": "translation",
153
154
  "en": "Get started by editing",
154
155
  "fr": "Commencez par éditer",
155
- "es": "Comience por editar"
156
+ "es": "Comience por editar",
156
157
  },
157
- "pageLink": "src/app/page.tsx"
158
+ "pageLink": "src/app/page.tsx",
158
159
  },
159
160
  "nestedContent": {
160
161
  "id": "enumeration",
@@ -165,9 +166,9 @@ module.exports = pageContent;
165
166
  "0": "No cars",
166
167
  "1": "One car",
167
168
  ">5": "Some cars",
168
- ">19": "Many cars"
169
- }
170
- }
169
+ ">19": "Many cars",
170
+ },
171
+ },
171
172
  }
172
173
  ```
173
174
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import type { Locales } from '@intlayer/config/client';\nimport {\n type TranslationContent,\n t as tCore,\n getTranslationContent as getTranslationContentCore,\n type LanguageContent,\n} from '@intlayer/core';\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable @typescript-eslint/no-empty-interface */\nexport interface IConfigLocales<Content> {\n // This interface should be augmented in the consuming app\n}\n\ntype ConfigLocales = keyof IConfigLocales<unknown>;\n\ntype ConfigLanguageContent<Content> = Record<ConfigLocales, Content>;\n\nexport type CustomizableLanguageContent<Content = string> =\n ConfigLocales extends never\n ? LanguageContent<Content>\n : ConfigLanguageContent<Content>;\n\n// Re-exporting the following functions from the core package: to use module augmentation\nexport const t: <Content = string>(\n content?: CustomizableLanguageContent<Content>\n) => TranslationContent<Content> = tCore;\nexport const getTranslationContent: <Content = string>(\n languageContent: CustomizableLanguageContent<Content>,\n locale: Locales\n) => Content = getTranslationContentCore;\n\nexport type {\n LanguageContent,\n QuantityContent,\n ContentValue,\n ContentModule,\n} from '@intlayer/core';\nexport { getLocaleName, enu, getEnumerationContent } from '@intlayer/core';\nexport {\n type CustomIntlayerConfig as IntlayerConfig,\n Locales,\n} from '@intlayer/config/client';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAKO;AAgCP,IAAAA,eAA0D;AAC1D,oBAGO;AAlBA,MAAM,IAEsB,YAAAC;AAC5B,MAAM,wBAGE,YAAAC;","names":["import_core","tCore","getTranslationContentCore"]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import type { Locales } from '@intlayer/config/client';\nimport {\n type TranslationContent,\n t as tCore,\n getTranslationContent as getTranslationContentCore,\n type LanguageContent,\n} from '@intlayer/core';\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable @typescript-eslint/no-empty-interface */\nexport interface IConfigLocales<Content> {\n // This interface should be augmented in the consuming app\n}\n\ntype ConfigLocales = keyof IConfigLocales<unknown>;\n\nexport type CustomizableLanguageContent<Content = string> =\n ConfigLocales extends never\n ? LanguageContent<Content>\n : IConfigLocales<Content>;\n\n// Re-exporting the following functions from the core package: to use module augmentation\nexport const t: <Content = string>(\n content?: CustomizableLanguageContent<Content>\n) => TranslationContent<Content> = tCore;\nexport const getTranslationContent: <Content = string>(\n languageContent: CustomizableLanguageContent<Content>,\n locale: Locales\n) => Content = getTranslationContentCore;\n\nexport type {\n LanguageContent,\n QuantityContent,\n ContentValue,\n DeclarationContent,\n} from '@intlayer/core';\nexport { getLocaleName, enu, getEnumerationContent } from '@intlayer/core';\nexport type {\n LocalesValues,\n CustomIntlayerConfig as IntlayerConfig,\n} from '@intlayer/config/client';\nexport { Locales } from '@intlayer/config/client';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAKO;AA8BP,IAAAA,eAA0D;AAK1D,oBAAwB;AAnBjB,MAAM,IAEsB,YAAAC;AAC5B,MAAM,wBAGE,YAAAC;","names":["import_core","tCore","getTranslationContentCore"]}
@@ -1,13 +1,12 @@
1
1
  import { Locales } from '@intlayer/config/client';
2
- export { CustomIntlayerConfig as IntlayerConfig, Locales } from '@intlayer/config/client';
2
+ export { CustomIntlayerConfig as IntlayerConfig, Locales, LocalesValues } from '@intlayer/config/client';
3
3
  import { LanguageContent, TranslationContent } from '@intlayer/core';
4
- export { ContentModule, ContentValue, LanguageContent, QuantityContent, enu, getEnumerationContent, getLocaleName } from '@intlayer/core';
4
+ export { ContentValue, DeclarationContent, LanguageContent, QuantityContent, enu, getEnumerationContent, getLocaleName } from '@intlayer/core';
5
5
 
6
6
  interface IConfigLocales<Content> {
7
7
  }
8
8
  type ConfigLocales = keyof IConfigLocales<unknown>;
9
- type ConfigLanguageContent<Content> = Record<ConfigLocales, Content>;
10
- type CustomizableLanguageContent<Content = string> = ConfigLocales extends never ? LanguageContent<Content> : ConfigLanguageContent<Content>;
9
+ type CustomizableLanguageContent<Content = string> = ConfigLocales extends never ? LanguageContent<Content> : IConfigLocales<Content>;
11
10
  declare const t: <Content = string>(content?: CustomizableLanguageContent<Content>) => TranslationContent<Content>;
12
11
  declare const getTranslationContent: <Content = string>(languageContent: CustomizableLanguageContent<Content>, locale: Locales) => Content;
13
12
 
@@ -1,13 +1,12 @@
1
1
  import { Locales } from '@intlayer/config/client';
2
- export { CustomIntlayerConfig as IntlayerConfig, Locales } from '@intlayer/config/client';
2
+ export { CustomIntlayerConfig as IntlayerConfig, Locales, LocalesValues } from '@intlayer/config/client';
3
3
  import { LanguageContent, TranslationContent } from '@intlayer/core';
4
- export { ContentModule, ContentValue, LanguageContent, QuantityContent, enu, getEnumerationContent, getLocaleName } from '@intlayer/core';
4
+ export { ContentValue, DeclarationContent, LanguageContent, QuantityContent, enu, getEnumerationContent, getLocaleName } from '@intlayer/core';
5
5
 
6
6
  interface IConfigLocales<Content> {
7
7
  }
8
8
  type ConfigLocales = keyof IConfigLocales<unknown>;
9
- type ConfigLanguageContent<Content> = Record<ConfigLocales, Content>;
10
- type CustomizableLanguageContent<Content = string> = ConfigLocales extends never ? LanguageContent<Content> : ConfigLanguageContent<Content>;
9
+ type CustomizableLanguageContent<Content = string> = ConfigLocales extends never ? LanguageContent<Content> : IConfigLocales<Content>;
11
10
  declare const t: <Content = string>(content?: CustomizableLanguageContent<Content>) => TranslationContent<Content>;
12
11
  declare const getTranslationContent: <Content = string>(languageContent: CustomizableLanguageContent<Content>, locale: Locales) => Content;
13
12
 
@@ -5,9 +5,7 @@ import {
5
5
  const t = tCore;
6
6
  const getTranslationContent = getTranslationContentCore;
7
7
  import { getLocaleName, enu, getEnumerationContent } from "@intlayer/core";
8
- import {
9
- Locales
10
- } from "@intlayer/config/client";
8
+ import { Locales } from "@intlayer/config/client";
11
9
  export {
12
10
  Locales,
13
11
  enu,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import type { Locales } from '@intlayer/config/client';\nimport {\n type TranslationContent,\n t as tCore,\n getTranslationContent as getTranslationContentCore,\n type LanguageContent,\n} from '@intlayer/core';\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable @typescript-eslint/no-empty-interface */\nexport interface IConfigLocales<Content> {\n // This interface should be augmented in the consuming app\n}\n\ntype ConfigLocales = keyof IConfigLocales<unknown>;\n\ntype ConfigLanguageContent<Content> = Record<ConfigLocales, Content>;\n\nexport type CustomizableLanguageContent<Content = string> =\n ConfigLocales extends never\n ? LanguageContent<Content>\n : ConfigLanguageContent<Content>;\n\n// Re-exporting the following functions from the core package: to use module augmentation\nexport const t: <Content = string>(\n content?: CustomizableLanguageContent<Content>\n) => TranslationContent<Content> = tCore;\nexport const getTranslationContent: <Content = string>(\n languageContent: CustomizableLanguageContent<Content>,\n locale: Locales\n) => Content = getTranslationContentCore;\n\nexport type {\n LanguageContent,\n QuantityContent,\n ContentValue,\n ContentModule,\n} from '@intlayer/core';\nexport { getLocaleName, enu, getEnumerationContent } from '@intlayer/core';\nexport {\n type CustomIntlayerConfig as IntlayerConfig,\n Locales,\n} from '@intlayer/config/client';\n"],"mappings":"AACA;AAAA,EAEE,KAAK;AAAA,EACL,yBAAyB;AAAA,OAEpB;AAkBA,MAAM,IAEsB;AAC5B,MAAM,wBAGE;AAQf,SAAS,eAAe,KAAK,6BAA6B;AAC1D;AAAA,EAEE;AAAA,OACK;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import type { Locales } from '@intlayer/config/client';\nimport {\n type TranslationContent,\n t as tCore,\n getTranslationContent as getTranslationContentCore,\n type LanguageContent,\n} from '@intlayer/core';\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable @typescript-eslint/no-empty-interface */\nexport interface IConfigLocales<Content> {\n // This interface should be augmented in the consuming app\n}\n\ntype ConfigLocales = keyof IConfigLocales<unknown>;\n\nexport type CustomizableLanguageContent<Content = string> =\n ConfigLocales extends never\n ? LanguageContent<Content>\n : IConfigLocales<Content>;\n\n// Re-exporting the following functions from the core package: to use module augmentation\nexport const t: <Content = string>(\n content?: CustomizableLanguageContent<Content>\n) => TranslationContent<Content> = tCore;\nexport const getTranslationContent: <Content = string>(\n languageContent: CustomizableLanguageContent<Content>,\n locale: Locales\n) => Content = getTranslationContentCore;\n\nexport type {\n LanguageContent,\n QuantityContent,\n ContentValue,\n DeclarationContent,\n} from '@intlayer/core';\nexport { getLocaleName, enu, getEnumerationContent } from '@intlayer/core';\nexport type {\n LocalesValues,\n CustomIntlayerConfig as IntlayerConfig,\n} from '@intlayer/config/client';\nexport { Locales } from '@intlayer/config/client';\n"],"mappings":"AACA;AAAA,EAEE,KAAK;AAAA,EACL,yBAAyB;AAAA,OAEpB;AAgBA,MAAM,IAEsB;AAC5B,MAAM,wBAGE;AAQf,SAAS,eAAe,KAAK,6BAA6B;AAK1D,SAAS,eAAe;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intlayer",
3
- "version": "1.2.1",
3
+ "version": "2.0.1",
4
4
  "private": false,
5
5
  "description": "IntLayer is a layer of abstraction between the business logic and the data access layer. Manage internationalization in a simple way, through TypeScript, JavaScript or JSON declaration file.",
6
6
  "keywords": [
@@ -28,11 +28,6 @@
28
28
  "require": "./dist/cjs/index.cjs",
29
29
  "import": "./dist/esm/index.mjs"
30
30
  },
31
- "./augmentation": {
32
- "types": "./dist/esm/augmentation.d.mts",
33
- "require": "./dist/cjs/augmentation.cjs",
34
- "import": "./dist/esm/augmentation.mjs"
35
- },
36
31
  "./package.json": "./package.json"
37
32
  },
38
33
  "main": "src/index.ts",
@@ -45,15 +40,13 @@
45
40
  },
46
41
  "files": [
47
42
  "./dist",
48
- "./src",
49
- "./bin",
50
43
  "./package.json"
51
44
  ],
52
45
  "dependencies": {
53
46
  "webpack": "^5.91.0",
54
- "@intlayer/config": "^1.2.1",
55
- "@intlayer/core": "^1.2.1",
56
- "intlayer": "^1.2.1"
47
+ "@intlayer/config": "^2.0.1",
48
+ "intlayer": "^2.0.1",
49
+ "@intlayer/core": "^2.0.1"
57
50
  },
58
51
  "devDependencies": {
59
52
  "@changesets/changelog-github": "0.5.0",
package/src/index.ts CHANGED
@@ -14,12 +14,10 @@ export interface IConfigLocales<Content> {
14
14
 
15
15
  type ConfigLocales = keyof IConfigLocales<unknown>;
16
16
 
17
- type ConfigLanguageContent<Content> = Record<ConfigLocales, Content>;
18
-
19
17
  export type CustomizableLanguageContent<Content = string> =
20
18
  ConfigLocales extends never
21
19
  ? LanguageContent<Content>
22
- : ConfigLanguageContent<Content>;
20
+ : IConfigLocales<Content>;
23
21
 
24
22
  // Re-exporting the following functions from the core package: to use module augmentation
25
23
  export const t: <Content = string>(
@@ -34,10 +32,11 @@ export type {
34
32
  LanguageContent,
35
33
  QuantityContent,
36
34
  ContentValue,
37
- ContentModule,
35
+ DeclarationContent,
38
36
  } from '@intlayer/core';
39
37
  export { getLocaleName, enu, getEnumerationContent } from '@intlayer/core';
40
- export {
41
- type CustomIntlayerConfig as IntlayerConfig,
42
- Locales,
38
+ export type {
39
+ LocalesValues,
40
+ CustomIntlayerConfig as IntlayerConfig,
43
41
  } from '@intlayer/config/client';
42
+ export { Locales } from '@intlayer/config/client';