angular-intlayer 5.6.0 → 5.7.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.
@@ -17,6 +17,7 @@ var client_exports = {};
17
17
  module.exports = __toCommonJS(client_exports);
18
18
  __reExport(client_exports, require('./installIntlayer.cjs'), module.exports);
19
19
  __reExport(client_exports, require('./useDictionary.cjs'), module.exports);
20
+ __reExport(client_exports, require('./useDictionaryAsync.cjs'), module.exports);
20
21
  __reExport(client_exports, require('./useDictionaryDynamic.cjs'), module.exports);
21
22
  __reExport(client_exports, require('./useIntlayer.cjs'), module.exports);
22
23
  __reExport(client_exports, require('./useLoadDynamic.cjs'), module.exports);
@@ -25,6 +26,7 @@ __reExport(client_exports, require('./useLocale.cjs'), module.exports);
25
26
  0 && (module.exports = {
26
27
  ...require('./installIntlayer.cjs'),
27
28
  ...require('./useDictionary.cjs'),
29
+ ...require('./useDictionaryAsync.cjs'),
28
30
  ...require('./useDictionaryDynamic.cjs'),
29
31
  ...require('./useIntlayer.cjs'),
30
32
  ...require('./useLoadDynamic.cjs'),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/index.ts"],"sourcesContent":["export * from './installIntlayer';\nexport * from './useDictionary';\nexport * from './useDictionaryDynamic';\nexport * from './useIntlayer';\nexport * from './useLoadDynamic';\nexport * from './useLocale';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,2BAAc,8BAAd;AACA,2BAAc,4BADd;AAEA,2BAAc,mCAFd;AAGA,2BAAc,0BAHd;AAIA,2BAAc,6BAJd;AAKA,2BAAc,wBALd;","names":[]}
1
+ {"version":3,"sources":["../../../src/client/index.ts"],"sourcesContent":["export * from './installIntlayer';\nexport * from './useDictionary';\nexport * from './useDictionaryAsync';\nexport * from './useDictionaryDynamic';\nexport * from './useIntlayer';\nexport * from './useLoadDynamic';\nexport * from './useLocale';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,2BAAc,8BAAd;AACA,2BAAc,4BADd;AAEA,2BAAc,iCAFd;AAGA,2BAAc,mCAHd;AAIA,2BAAc,0BAJd;AAKA,2BAAc,6BALd;AAMA,2BAAc,wBANd;","names":[]}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var useDictionaryAsync_exports = {};
31
+ __export(useDictionaryAsync_exports, {
32
+ useDictionaryAsync: () => useDictionaryAsync
33
+ });
34
+ module.exports = __toCommonJS(useDictionaryAsync_exports);
35
+ var import_core = require("@angular/core");
36
+ var import_built = __toESM(require("@intlayer/config/built"));
37
+ var import_installIntlayer = require('./installIntlayer.cjs');
38
+ var import_useDictionary = require('./useDictionary.cjs');
39
+ const useDictionaryAsync = async (dictionaryPromise, locale) => {
40
+ const intlayer = (0, import_core.inject)(import_installIntlayer.INTLAYER_TOKEN);
41
+ const localeTarget = (0, import_core.computed)(
42
+ () => locale ?? intlayer?.locale() ?? import_built.default?.internationalization.defaultLocale
43
+ );
44
+ const dictionary = await dictionaryPromise[localeTarget()]();
45
+ return (0, import_useDictionary.useDictionary)(dictionary, localeTarget());
46
+ };
47
+ // Annotate the CommonJS export names for ESM import in node:
48
+ 0 && (module.exports = {
49
+ useDictionaryAsync
50
+ });
51
+ //# sourceMappingURL=useDictionaryAsync.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/client/useDictionaryAsync.ts"],"sourcesContent":["'use client';\n\nimport { computed, inject } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/config/client';\nimport type { Dictionary, LanguageContent } from '@intlayer/core';\nimport { INTLAYER_TOKEN, IntlayerProvider } from './installIntlayer';\nimport { useDictionary } from './useDictionary';\n\n/**\n * On the server side, Hook that transform a dictionary and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useDictionaryAsync = async <T extends Dictionary>(\n dictionaryPromise: LanguageContent<() => Promise<T>>,\n locale?: LocalesValues\n) => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n const localeTarget = computed(\n () =>\n locale ??\n intlayer?.locale() ??\n configuration?.internationalization.defaultLocale\n );\n\n const dictionary = await dictionaryPromise[localeTarget()]!();\n\n return useDictionary(dictionary, localeTarget() as any);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAAiC;AACjC,mBAA0B;AAG1B,6BAAiD;AACjD,2BAA8B;AAOvB,MAAM,qBAAqB,OAChC,mBACA,WACG;AACH,QAAM,eAAW,oBAAyB,qCAAc;AAExD,QAAM,mBAAe;AAAA,IACnB,MACE,UACA,UAAU,OAAO,KACjB,aAAAA,SAAe,qBAAqB;AAAA,EACxC;AAEA,QAAM,aAAa,MAAM,kBAAkB,aAAa,CAAC,EAAG;AAE5D,aAAO,oCAAc,YAAY,aAAa,CAAQ;AACxD;","names":["configuration"]}
@@ -1,5 +1,6 @@
1
1
  export * from "./installIntlayer.mjs";
2
2
  export * from "./useDictionary.mjs";
3
+ export * from "./useDictionaryAsync.mjs";
3
4
  export * from "./useDictionaryDynamic.mjs";
4
5
  export * from "./useIntlayer.mjs";
5
6
  export * from "./useLoadDynamic.mjs";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/index.ts"],"sourcesContent":["export * from './installIntlayer';\nexport * from './useDictionary';\nexport * from './useDictionaryDynamic';\nexport * from './useIntlayer';\nexport * from './useLoadDynamic';\nexport * from './useLocale';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/client/index.ts"],"sourcesContent":["export * from './installIntlayer';\nexport * from './useDictionary';\nexport * from './useDictionaryAsync';\nexport * from './useDictionaryDynamic';\nexport * from './useIntlayer';\nexport * from './useLoadDynamic';\nexport * from './useLocale';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import { computed, inject } from "@angular/core";
3
+ import configuration from "@intlayer/config/built";
4
+ import { INTLAYER_TOKEN } from "./installIntlayer.mjs";
5
+ import { useDictionary } from "./useDictionary.mjs";
6
+ const useDictionaryAsync = async (dictionaryPromise, locale) => {
7
+ const intlayer = inject(INTLAYER_TOKEN);
8
+ const localeTarget = computed(
9
+ () => locale ?? intlayer?.locale() ?? configuration?.internationalization.defaultLocale
10
+ );
11
+ const dictionary = await dictionaryPromise[localeTarget()]();
12
+ return useDictionary(dictionary, localeTarget());
13
+ };
14
+ export {
15
+ useDictionaryAsync
16
+ };
17
+ //# sourceMappingURL=useDictionaryAsync.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/client/useDictionaryAsync.ts"],"sourcesContent":["'use client';\n\nimport { computed, inject } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/config/client';\nimport type { Dictionary, LanguageContent } from '@intlayer/core';\nimport { INTLAYER_TOKEN, IntlayerProvider } from './installIntlayer';\nimport { useDictionary } from './useDictionary';\n\n/**\n * On the server side, Hook that transform a dictionary and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useDictionaryAsync = async <T extends Dictionary>(\n dictionaryPromise: LanguageContent<() => Promise<T>>,\n locale?: LocalesValues\n) => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n const localeTarget = computed(\n () =>\n locale ??\n intlayer?.locale() ??\n configuration?.internationalization.defaultLocale\n );\n\n const dictionary = await dictionaryPromise[localeTarget()]!();\n\n return useDictionary(dictionary, localeTarget() as any);\n};\n"],"mappings":";AAEA,SAAS,UAAU,cAAc;AACjC,OAAO,mBAAmB;AAG1B,SAAS,sBAAwC;AACjD,SAAS,qBAAqB;AAOvB,MAAM,qBAAqB,OAChC,mBACA,WACG;AACH,QAAM,WAAW,OAAyB,cAAc;AAExD,QAAM,eAAe;AAAA,IACnB,MACE,UACA,UAAU,OAAO,KACjB,eAAe,qBAAqB;AAAA,EACxC;AAEA,QAAM,aAAa,MAAM,kBAAkB,aAAa,CAAC,EAAG;AAE5D,SAAO,cAAc,YAAY,aAAa,CAAQ;AACxD;","names":[]}
@@ -1,5 +1,6 @@
1
1
  export * from './installIntlayer';
2
2
  export * from './useDictionary';
3
+ export * from './useDictionaryAsync';
3
4
  export * from './useDictionaryDynamic';
4
5
  export * from './useIntlayer';
5
6
  export * from './useLoadDynamic';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { LocalesValues } from '@intlayer/config/client';
2
+ import type { Dictionary, LanguageContent } from '@intlayer/core';
3
+ /**
4
+ * On the server side, Hook that transform a dictionary and return the content
5
+ *
6
+ * If the locale is not provided, it will use the locale from the client context
7
+ */
8
+ export declare const useDictionaryAsync: <T extends Dictionary>(dictionaryPromise: LanguageContent<() => Promise<T>>, locale?: LocalesValues) => Promise<any>;
9
+ //# sourceMappingURL=useDictionaryAsync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDictionaryAsync.d.ts","sourceRoot":"","sources":["../../../src/client/useDictionaryAsync.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAIlE;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAU,CAAC,SAAS,UAAU,EAC3D,mBAAmB,eAAe,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,EACpD,SAAS,aAAa,iBAcvB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "angular-intlayer",
3
- "version": "5.6.0",
3
+ "version": "5.7.0",
4
4
  "private": false,
5
5
  "description": "Easily internationalize i18n your Angular applications with type-safe multilingual content management.",
6
6
  "keywords": [
@@ -64,12 +64,12 @@
64
64
  "deepmerge": "^4.3.1",
65
65
  "js-cookie": "^3.0.5",
66
66
  "uuid": "^11.1.0",
67
- "@intlayer/config": "5.6.0",
68
- "@intlayer/editor": "5.6.0",
69
- "@intlayer/webpack": "5.6.0",
70
- "@intlayer/chokidar": "5.6.0",
71
- "@intlayer/core": "5.6.0",
72
- "@intlayer/dictionaries-entry": "5.6.0"
67
+ "@intlayer/dictionaries-entry": "5.7.0",
68
+ "@intlayer/core": "5.7.0",
69
+ "@intlayer/editor": "5.7.0",
70
+ "@intlayer/config": "5.7.0",
71
+ "@intlayer/chokidar": "5.7.0",
72
+ "@intlayer/webpack": "5.7.0"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@types/node": "^22.15.30",
@@ -83,19 +83,19 @@
83
83
  "tsup": "^8.5.0",
84
84
  "typescript": "^5.8.3",
85
85
  "vitest": "^3.2.2",
86
- "@utils/eslint-config": "1.0.4",
87
86
  "@utils/ts-config": "1.0.4",
88
87
  "@utils/ts-config-types": "1.0.4",
89
- "@utils/tsup-config": "1.0.4"
88
+ "@utils/tsup-config": "1.0.4",
89
+ "@utils/eslint-config": "1.0.4"
90
90
  },
91
91
  "peerDependencies": {
92
92
  "@angular/common": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0",
93
93
  "@angular/core": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0",
94
94
  "rxjs": "^6.0.0 || ^7.0.0",
95
- "@intlayer/chokidar": "5.6.0",
96
- "@intlayer/config": "5.6.0",
97
- "@intlayer/dictionaries-entry": "5.6.0",
98
- "@intlayer/core": "5.6.0"
95
+ "@intlayer/chokidar": "5.7.0",
96
+ "@intlayer/config": "5.7.0",
97
+ "@intlayer/core": "5.7.0",
98
+ "@intlayer/dictionaries-entry": "5.7.0"
99
99
  },
100
100
  "engines": {
101
101
  "node": ">=14.18"