intlayer 1.0.0 → 1.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/dist/cjs/index.cjs +20 -22
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.ts +14 -18
- package/dist/esm/index.d.mts +14 -18
- package/dist/esm/index.mjs +10 -8
- package/dist/esm/index.mjs.map +1 -1
- package/package.json +12 -6
- package/src/index.ts +34 -11
package/dist/cjs/index.cjs
CHANGED
|
@@ -8,38 +8,36 @@ var __export = (target, all) => {
|
|
|
8
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
9
|
};
|
|
10
10
|
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
12
|
for (let key of __getOwnPropNames(from))
|
|
13
13
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, {
|
|
15
|
-
get: () => from[key],
|
|
16
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
|
|
17
|
-
});
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
15
|
}
|
|
19
16
|
return to;
|
|
20
17
|
};
|
|
21
|
-
var __toCommonJS = (mod) =>
|
|
22
|
-
__copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
19
|
var src_exports = {};
|
|
24
20
|
__export(src_exports, {
|
|
25
21
|
Locales: () => import_client.Locales,
|
|
26
|
-
enu: () =>
|
|
27
|
-
getEnumerationContent: () =>
|
|
28
|
-
getLocaleName: () =>
|
|
29
|
-
getTranslationContent: () =>
|
|
30
|
-
t: () =>
|
|
22
|
+
enu: () => import_core2.enu,
|
|
23
|
+
getEnumerationContent: () => import_core2.getEnumerationContent,
|
|
24
|
+
getLocaleName: () => import_core2.getLocaleName,
|
|
25
|
+
getTranslationContent: () => getTranslationContent,
|
|
26
|
+
t: () => t
|
|
31
27
|
});
|
|
32
28
|
module.exports = __toCommonJS(src_exports);
|
|
33
29
|
var import_core = require("@intlayer/core");
|
|
30
|
+
var import_core2 = require("@intlayer/core");
|
|
34
31
|
var import_client = require("@intlayer/config/client");
|
|
32
|
+
const t = import_core.t;
|
|
33
|
+
const getTranslationContent = import_core.getTranslationContent;
|
|
35
34
|
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
-
0 &&
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
//# sourceMappingURL=index.cjs.map
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
Locales,
|
|
37
|
+
enu,
|
|
38
|
+
getEnumerationContent,
|
|
39
|
+
getLocaleName,
|
|
40
|
+
getTranslationContent,
|
|
41
|
+
t
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["
|
|
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"]}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export {
|
|
16
|
-
CustomIntlayerConfig as IntlayerConfig,
|
|
17
|
-
Locales,
|
|
18
|
-
} from "@intlayer/config/client";
|
|
1
|
+
import { Locales } from '@intlayer/config/client';
|
|
2
|
+
export { CustomIntlayerConfig as IntlayerConfig, Locales } from '@intlayer/config/client';
|
|
3
|
+
import { LanguageContent, TranslationContent } from '@intlayer/core';
|
|
4
|
+
export { ContentModule, ContentValue, LanguageContent, QuantityContent, enu, getEnumerationContent, getLocaleName } from '@intlayer/core';
|
|
5
|
+
|
|
6
|
+
interface IConfigLocales<Content> {
|
|
7
|
+
}
|
|
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>;
|
|
11
|
+
declare const t: <Content = string>(content?: CustomizableLanguageContent<Content>) => TranslationContent<Content>;
|
|
12
|
+
declare const getTranslationContent: <Content = string>(languageContent: CustomizableLanguageContent<Content>, locale: Locales) => Content;
|
|
13
|
+
|
|
14
|
+
export { type CustomizableLanguageContent, type IConfigLocales, getTranslationContent, t };
|
package/dist/esm/index.d.mts
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export {
|
|
16
|
-
CustomIntlayerConfig as IntlayerConfig,
|
|
17
|
-
Locales,
|
|
18
|
-
} from "@intlayer/config/client";
|
|
1
|
+
import { Locales } from '@intlayer/config/client';
|
|
2
|
+
export { CustomIntlayerConfig as IntlayerConfig, Locales } from '@intlayer/config/client';
|
|
3
|
+
import { LanguageContent, TranslationContent } from '@intlayer/core';
|
|
4
|
+
export { ContentModule, ContentValue, LanguageContent, QuantityContent, enu, getEnumerationContent, getLocaleName } from '@intlayer/core';
|
|
5
|
+
|
|
6
|
+
interface IConfigLocales<Content> {
|
|
7
|
+
}
|
|
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>;
|
|
11
|
+
declare const t: <Content = string>(content?: CustomizableLanguageContent<Content>) => TranslationContent<Content>;
|
|
12
|
+
declare const getTranslationContent: <Content = string>(languageContent: CustomizableLanguageContent<Content>, locale: Locales) => Content;
|
|
13
|
+
|
|
14
|
+
export { type CustomizableLanguageContent, type IConfigLocales, getTranslationContent, t };
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
|
-
t,
|
|
3
|
-
|
|
4
|
-
enu,
|
|
5
|
-
getEnumerationContent,
|
|
6
|
-
getTranslationContent,
|
|
2
|
+
t as tCore,
|
|
3
|
+
getTranslationContent as getTranslationContentCore
|
|
7
4
|
} from "@intlayer/core";
|
|
8
|
-
|
|
5
|
+
const t = tCore;
|
|
6
|
+
const getTranslationContent = getTranslationContentCore;
|
|
7
|
+
import { getLocaleName, enu, getEnumerationContent } from "@intlayer/core";
|
|
8
|
+
import {
|
|
9
|
+
Locales
|
|
10
|
+
} from "@intlayer/config/client";
|
|
9
11
|
export {
|
|
10
12
|
Locales,
|
|
11
13
|
enu,
|
|
12
14
|
getEnumerationContent,
|
|
13
15
|
getLocaleName,
|
|
14
16
|
getTranslationContent,
|
|
15
|
-
t
|
|
17
|
+
t
|
|
16
18
|
};
|
|
17
|
-
//# sourceMappingURL=index.mjs.map
|
|
19
|
+
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["
|
|
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":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intlayer",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.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": [
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"homepage": "https://github.com/aypineau/intlayer",
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
18
|
-
"url": "https://github.com/aypineau/intlayer"
|
|
18
|
+
"url": "git+https://github.com/aypineau/intlayer.git"
|
|
19
19
|
},
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"author": {
|
|
@@ -28,6 +28,11 @@
|
|
|
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
|
+
},
|
|
31
36
|
"./package.json": "./package.json"
|
|
32
37
|
},
|
|
33
38
|
"main": "src/index.ts",
|
|
@@ -46,8 +51,9 @@
|
|
|
46
51
|
],
|
|
47
52
|
"dependencies": {
|
|
48
53
|
"webpack": "^5.91.0",
|
|
49
|
-
"@intlayer/
|
|
50
|
-
"@intlayer/
|
|
54
|
+
"@intlayer/config": "^1.0.1",
|
|
55
|
+
"@intlayer/core": "^1.0.1",
|
|
56
|
+
"intlayer": "^1.0.1"
|
|
51
57
|
},
|
|
52
58
|
"devDependencies": {
|
|
53
59
|
"@changesets/changelog-github": "0.5.0",
|
|
@@ -56,8 +62,8 @@
|
|
|
56
62
|
"rimraf": "5.0.5",
|
|
57
63
|
"tsup": "^8.0.2",
|
|
58
64
|
"typescript": "^5.3.3",
|
|
59
|
-
"@utils/eslint-config": "^1.0.
|
|
60
|
-
"@utils/ts-config": "^1.0.
|
|
65
|
+
"@utils/eslint-config": "^1.0.1",
|
|
66
|
+
"@utils/ts-config": "^1.0.1"
|
|
61
67
|
},
|
|
62
68
|
"engines": {
|
|
63
69
|
"node": ">=14.18"
|
package/src/index.ts
CHANGED
|
@@ -1,19 +1,42 @@
|
|
|
1
|
+
import type { Locales } from '@intlayer/config/client';
|
|
2
|
+
import {
|
|
3
|
+
type TranslationContent,
|
|
4
|
+
t as tCore,
|
|
5
|
+
getTranslationContent as getTranslationContentCore,
|
|
6
|
+
type LanguageContent,
|
|
7
|
+
} from '@intlayer/core';
|
|
8
|
+
|
|
9
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
10
|
+
/* eslint-disable @typescript-eslint/no-empty-interface */
|
|
11
|
+
export interface IConfigLocales<Content> {
|
|
12
|
+
// This interface should be augmented in the consuming app
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type ConfigLocales = keyof IConfigLocales<unknown>;
|
|
16
|
+
|
|
17
|
+
type ConfigLanguageContent<Content> = Record<ConfigLocales, Content>;
|
|
18
|
+
|
|
19
|
+
export type CustomizableLanguageContent<Content = string> =
|
|
20
|
+
ConfigLocales extends never
|
|
21
|
+
? LanguageContent<Content>
|
|
22
|
+
: ConfigLanguageContent<Content>;
|
|
23
|
+
|
|
24
|
+
// Re-exporting the following functions from the core package: to use module augmentation
|
|
25
|
+
export const t: <Content = string>(
|
|
26
|
+
content?: CustomizableLanguageContent<Content>
|
|
27
|
+
) => TranslationContent<Content> = tCore;
|
|
28
|
+
export const getTranslationContent: <Content = string>(
|
|
29
|
+
languageContent: CustomizableLanguageContent<Content>,
|
|
30
|
+
locale: Locales
|
|
31
|
+
) => Content = getTranslationContentCore;
|
|
32
|
+
|
|
1
33
|
export type {
|
|
2
34
|
LanguageContent,
|
|
3
|
-
|
|
35
|
+
QuantityContent,
|
|
4
36
|
ContentValue,
|
|
5
|
-
Content,
|
|
6
|
-
FlatContentValue,
|
|
7
|
-
FlatContent,
|
|
8
37
|
ContentModule,
|
|
9
38
|
} from '@intlayer/core';
|
|
10
|
-
export {
|
|
11
|
-
t,
|
|
12
|
-
getLocaleName,
|
|
13
|
-
enu,
|
|
14
|
-
getEnumerationContent,
|
|
15
|
-
getTranslationContent,
|
|
16
|
-
} from '@intlayer/core';
|
|
39
|
+
export { getLocaleName, enu, getEnumerationContent } from '@intlayer/core';
|
|
17
40
|
export {
|
|
18
41
|
type CustomIntlayerConfig as IntlayerConfig,
|
|
19
42
|
Locales,
|