intlayer 2.0.0 → 2.0.2

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
@@ -12,12 +12,12 @@
12
12
 
13
13
  `intlayer` package intend to declare your content in a structured way, using JavaScript.
14
14
 
15
- To build dictionaries from this declaration, you can use [intlayer-cli](https://github.com/aypineau/intlayer/blob/main/packages/intlayer-cli/readme.md).
16
- And to interpret intlayer dictionaries you can interpreters, such as [react-intlayer](https://github.com/aypineau/intlayer/blob/main/packages/react-intlayer/readme.md), or [next-intlayer](https://github.com/aypineau/intlayer/blob/main/packages/next-intlayer/readme.md)
15
+ To build dictionaries from this declaration, you can use [intlayer-cli](https://github.com/aypineau/intlayer/blob/main/packages/intlayer-cli/readme_en.md).
16
+ And to interpret intlayer dictionaries you can interpreters, such as [react-intlayer](https://github.com/aypineau/intlayer/blob/main/packages/react-intlayer/readme_en.md), or [next-intlayer](https://github.com/aypineau/intlayer/blob/main/packages/next-intlayer/readme_en.md)
17
17
 
18
18
  ## Getting Started with Intlayer
19
19
 
20
- [See how to use intlayer with NextJS](https://github.com/aypineau/intlayer/blob/main/readme.md)
20
+ [See how to use intlayer with NextJS](https://github.com/aypineau/intlayer/blob/main/readme_en.md)
21
21
 
22
22
  ### Install Package
23
23
 
@@ -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: {
@@ -95,8 +95,8 @@ const pageContent = {
95
95
  numberOfCar: enu({
96
96
  "<-1": "Less than minus one car",
97
97
  "-1": "Minus one car",
98
- "0": "No cars",
99
- "1": "One car",
98
+ 0: "No cars",
99
+ 1: "One car",
100
100
  ">5": "Some cars",
101
101
  ">19": "Many cars",
102
102
  }),
@@ -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: {
@@ -130,8 +130,8 @@ const pageContent = {
130
130
  numberOfCar: enu({
131
131
  "<-1": "Less than minus one car",
132
132
  "-1": "Minus one car",
133
- "0": "No cars",
134
- "1": "One car",
133
+ 0: "No cars",
134
+ 1: "One car",
135
135
  ">5": "Some cars",
136
136
  ">19": "Many cars",
137
137
  }),
@@ -147,20 +147,20 @@ module.exports = pageContent;
147
147
  ```json5
148
148
  // src/app/[locale]/page.content.json
149
149
  {
150
- "id": "page",
151
- "getStarted": {
152
- "main": {
153
- "nodeType": "translation",
154
- "en": "Get started by editing",
155
- "fr": "Commencez par éditer",
156
- "es": "Comience por editar",
150
+ id: "page",
151
+ getStarted: {
152
+ main: {
153
+ nodeType: "translation",
154
+ en: "Get started by editing",
155
+ fr: "Commencez par éditer",
156
+ es: "Comience por editar",
157
157
  },
158
- "pageLink": "src/app/page.tsx",
158
+ pageLink: "src/app/page.tsx",
159
159
  },
160
- "nestedContent": {
161
- "id": "enumeration",
162
- "nodeType": "enumeration",
163
- "numberOfCar": {
160
+ nestedContent: {
161
+ id: "enumeration",
162
+ nodeType: "enumeration",
163
+ numberOfCar: {
164
164
  "<-1": "Less than minus one car",
165
165
  "-1": "Minus one car",
166
166
  "0": "No cars",
@@ -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\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 ContentModule,\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
+ {"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,7 +1,7 @@
1
1
  import { Locales } from '@intlayer/config/client';
2
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
  }
@@ -1,7 +1,7 @@
1
1
  import { Locales } from '@intlayer/config/client';
2
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
  }
@@ -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\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 ContentModule,\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":[]}
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": "2.0.0",
3
+ "version": "2.0.2",
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": [
@@ -40,25 +40,23 @@
40
40
  },
41
41
  "files": [
42
42
  "./dist",
43
- "./src",
44
- "./bin",
45
43
  "./package.json"
46
44
  ],
47
45
  "dependencies": {
48
- "webpack": "^5.91.0",
49
- "@intlayer/config": "^2.0.0",
50
- "@intlayer/core": "^2.0.0",
51
- "intlayer": "^2.0.0"
46
+ "webpack": "^5.92.1",
47
+ "@intlayer/config": "^2.0.2",
48
+ "@intlayer/core": "^2.0.2",
49
+ "intlayer": "^2.0.2"
52
50
  },
53
51
  "devDependencies": {
54
52
  "@changesets/changelog-github": "0.5.0",
55
53
  "@changesets/cli": "2.27.1",
56
- "@types/node": "^20.12.7",
54
+ "@types/node": "^20.14.9",
57
55
  "rimraf": "5.0.5",
58
- "tsup": "^8.0.2",
59
- "typescript": "^5.4.5",
60
- "@utils/eslint-config": "^1.0.1",
61
- "@utils/ts-config": "^1.0.1"
56
+ "tsup": "^8.1.0",
57
+ "typescript": "^5.5.2",
58
+ "@utils/eslint-config": "^1.0.2",
59
+ "@utils/ts-config": "^1.0.2"
62
60
  },
63
61
  "engines": {
64
62
  "node": ">=14.18"
package/src/index.ts CHANGED
@@ -32,7 +32,7 @@ export type {
32
32
  LanguageContent,
33
33
  QuantityContent,
34
34
  ContentValue,
35
- ContentModule,
35
+ DeclarationContent,
36
36
  } from '@intlayer/core';
37
37
  export { getLocaleName, enu, getEnumerationContent } from '@intlayer/core';
38
38
  export type {