vue-intl 6.5.27 → 7.0.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.
package/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { IntlFormatters as CoreIntlFormatters, MessageDescriptor } from '@formatjs/intl';
2
- export * from './plugin';
3
- export * from './provider';
4
- export { intlKey } from './injection-key';
2
+ export * from './plugin.js';
3
+ export * from './provider.js';
4
+ export { intlKey } from './injection-key.js';
5
5
  export { IntlShape, IntlConfig, ResolvedIntlConfig, createIntlCache, MessageDescriptor, IntlCache, Formatters, FormatDisplayNameOptions, FormatListOptions, FormatPluralOptions, FormatRelativeTimeOptions, FormatNumberOptions, FormatDateOptions, CustomFormatConfig, CustomFormats, UnsupportedFormatterError, InvalidConfigError, MissingDataError, MessageFormatError, MissingTranslationError, IntlErrorCode, IntlError, } from '@formatjs/intl';
6
6
  import { VNode } from 'vue';
7
7
  export type IntlFormatters = CoreIntlFormatters<VNode>;
package/index.js CHANGED
@@ -1,25 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IntlError = exports.IntlErrorCode = exports.MissingTranslationError = exports.MessageFormatError = exports.MissingDataError = exports.InvalidConfigError = exports.UnsupportedFormatterError = exports.createIntlCache = exports.intlKey = void 0;
4
- exports.defineMessages = defineMessages;
5
- exports.defineMessage = defineMessage;
6
- const tslib_1 = require("tslib");
7
- tslib_1.__exportStar(require("./plugin"), exports);
8
- tslib_1.__exportStar(require("./provider"), exports);
9
- var injection_key_1 = require("./injection-key");
10
- Object.defineProperty(exports, "intlKey", { enumerable: true, get: function () { return injection_key_1.intlKey; } });
11
- var intl_1 = require("@formatjs/intl");
12
- Object.defineProperty(exports, "createIntlCache", { enumerable: true, get: function () { return intl_1.createIntlCache; } });
13
- Object.defineProperty(exports, "UnsupportedFormatterError", { enumerable: true, get: function () { return intl_1.UnsupportedFormatterError; } });
14
- Object.defineProperty(exports, "InvalidConfigError", { enumerable: true, get: function () { return intl_1.InvalidConfigError; } });
15
- Object.defineProperty(exports, "MissingDataError", { enumerable: true, get: function () { return intl_1.MissingDataError; } });
16
- Object.defineProperty(exports, "MessageFormatError", { enumerable: true, get: function () { return intl_1.MessageFormatError; } });
17
- Object.defineProperty(exports, "MissingTranslationError", { enumerable: true, get: function () { return intl_1.MissingTranslationError; } });
18
- Object.defineProperty(exports, "IntlErrorCode", { enumerable: true, get: function () { return intl_1.IntlErrorCode; } });
19
- Object.defineProperty(exports, "IntlError", { enumerable: true, get: function () { return intl_1.IntlError; } });
20
- function defineMessages(msgs) {
1
+ export * from './plugin.js';
2
+ export * from './provider.js';
3
+ export { intlKey } from './injection-key.js';
4
+ export { createIntlCache, UnsupportedFormatterError, InvalidConfigError, MissingDataError, MessageFormatError, MissingTranslationError, IntlErrorCode, IntlError, } from '@formatjs/intl';
5
+ export function defineMessages(msgs) {
21
6
  return msgs;
22
7
  }
23
- function defineMessage(msg) {
8
+ export function defineMessage(msg) {
24
9
  return msg;
25
10
  }
package/injection-key.js CHANGED
@@ -1,4 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.intlKey = void 0;
4
- exports.intlKey = Symbol();
1
+ export const intlKey = Symbol();
package/package.json CHANGED
@@ -1,17 +1,16 @@
1
1
  {
2
2
  "name": "vue-intl",
3
3
  "description": "formatjs intl binding for vue",
4
- "version": "6.5.27",
5
- "license": "ISC",
4
+ "version": "7.0.0",
6
5
  "author": "Long Ho <holevietlong@gmail.com>",
7
6
  "dependencies": {
8
7
  "@babel/types": "^7.26.10",
9
- "tslib": "^2.8.0",
10
- "@formatjs/icu-messageformat-parser": "2.11.4",
11
- "@formatjs/intl": "3.1.8"
8
+ "@formatjs/icu-messageformat-parser": "3.0.0",
9
+ "@formatjs/intl": "4.0.0",
10
+ "tslib": "^2.8.0"
12
11
  },
13
- "peerDependencies": {
14
- "vue": "^3.5.12"
12
+ "exports": {
13
+ ".": "./index.js"
15
14
  },
16
15
  "homepage": "https://formatjs.github.io/docs/vue-intl",
17
16
  "keywords": [
@@ -21,6 +20,11 @@
21
20
  "intl",
22
21
  "vue"
23
22
  ],
24
- "main": "index.js",
25
- "repository": "formatjs/formatjs.git"
23
+ "license": "ISC",
24
+ "peerDependencies": {
25
+ "vue": "3.5.13"
26
+ },
27
+ "repository": "formatjs/formatjs.git",
28
+ "type": "module",
29
+ "types": "index.d.ts"
26
30
  }
package/plugin.js CHANGED
@@ -1,14 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createIntl = void 0;
4
- const intl_1 = require("@formatjs/intl");
5
- const injection_key_1 = require("./injection-key");
6
- const createIntl = (options) => ({
1
+ import { createIntl as _createIntl, } from '@formatjs/intl';
2
+ import { intlKey } from './injection-key.js';
3
+ export const createIntl = (options) => ({
7
4
  install(app) {
8
5
  if (!options) {
9
6
  throw new Error('Missing `options` for vue-intl plugin');
10
7
  }
11
- const intl = (0, intl_1.createIntl)(options);
8
+ const intl = _createIntl(options);
12
9
  app.config.globalProperties.$intl = intl;
13
10
  app.config.globalProperties.$formatMessage = intl.formatMessage;
14
11
  app.config.globalProperties.$formatDate = intl.formatDate;
@@ -18,7 +15,6 @@ const createIntl = (options) => ({
18
15
  app.config.globalProperties.$formatDisplayName = intl.formatDisplayName;
19
16
  app.config.globalProperties.$formatNumber = intl.formatNumber;
20
17
  app.config.globalProperties.$formatList = intl.formatList;
21
- app.provide(injection_key_1.intlKey, intl);
18
+ app.provide(intlKey, intl);
22
19
  },
23
20
  });
24
- exports.createIntl = createIntl;
package/provider.js CHANGED
@@ -1,14 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.provideIntl = provideIntl;
4
- exports.useIntl = useIntl;
5
- const vue_1 = require("vue");
6
- const injection_key_1 = require("./injection-key");
7
- function provideIntl(intl) {
8
- (0, vue_1.provide)(injection_key_1.intlKey, intl);
1
+ import { inject, provide } from 'vue';
2
+ import { intlKey } from './injection-key.js';
3
+ export function provideIntl(intl) {
4
+ provide(intlKey, intl);
9
5
  }
10
- function useIntl() {
11
- const intl = (0, vue_1.inject)(injection_key_1.intlKey);
6
+ export function useIntl() {
7
+ const intl = inject(intlKey);
12
8
  if (!intl) {
13
9
  throw new Error(`An intl object was not injected. Install the plugin or use provideIntl.`);
14
10
  }
@@ -1,10 +0,0 @@
1
- import { IntlFormatters as CoreIntlFormatters, MessageDescriptor } from '@formatjs/intl';
2
- export * from './plugin';
3
- export * from './provider';
4
- export { intlKey } from './injection-key';
5
- export { IntlShape, IntlConfig, ResolvedIntlConfig, createIntlCache, MessageDescriptor, IntlCache, Formatters, FormatDisplayNameOptions, FormatListOptions, FormatPluralOptions, FormatRelativeTimeOptions, FormatNumberOptions, FormatDateOptions, CustomFormatConfig, CustomFormats, UnsupportedFormatterError, InvalidConfigError, MissingDataError, MessageFormatError, MissingTranslationError, IntlErrorCode, IntlError, } from '@formatjs/intl';
6
- import { VNode } from 'vue';
7
- export type IntlFormatters = CoreIntlFormatters<VNode>;
8
- export declare function defineMessages<K extends keyof any, T = MessageDescriptor, U extends Record<K, T> = Record<K, T>>(msgs: U): U;
9
- export declare function defineMessage<T>(msg: T): T;
10
- export type { MessageFormatElement } from '@formatjs/icu-messageformat-parser';
@@ -1,10 +0,0 @@
1
- export * from './plugin';
2
- export * from './provider';
3
- export { intlKey } from './injection-key';
4
- export { createIntlCache, UnsupportedFormatterError, InvalidConfigError, MissingDataError, MessageFormatError, MissingTranslationError, IntlErrorCode, IntlError, } from '@formatjs/intl';
5
- export function defineMessages(msgs) {
6
- return msgs;
7
- }
8
- export function defineMessage(msg) {
9
- return msg;
10
- }
@@ -1 +0,0 @@
1
- export declare const intlKey: unique symbol;
@@ -1 +0,0 @@
1
- export const intlKey = Symbol();
@@ -1,16 +0,0 @@
1
- import { IntlConfig, IntlFormatters, IntlShape } from '@formatjs/intl';
2
- import type { Plugin } from 'vue';
3
- declare module 'vue' {
4
- interface ComponentCustomProperties {
5
- $intl: IntlShape;
6
- $formatMessage: IntlFormatters['formatMessage'];
7
- $formatDate: IntlFormatters['formatDate'];
8
- $formatTime: IntlFormatters['formatTime'];
9
- $formatDateTimeRange: IntlFormatters['formatDateTimeRange'];
10
- $formatRelativeTime: IntlFormatters['formatRelativeTime'];
11
- $formatDisplayName: IntlFormatters['formatDisplayName'];
12
- $formatNumber: IntlFormatters['formatNumber'];
13
- $formatList: IntlFormatters['formatList'];
14
- }
15
- }
16
- export declare const createIntl: (options: IntlConfig) => Plugin;
@@ -1,20 +0,0 @@
1
- import { createIntl as _createIntl, } from '@formatjs/intl';
2
- import { intlKey } from './injection-key';
3
- export const createIntl = (options) => ({
4
- install(app) {
5
- if (!options) {
6
- throw new Error('Missing `options` for vue-intl plugin');
7
- }
8
- const intl = _createIntl(options);
9
- app.config.globalProperties.$intl = intl;
10
- app.config.globalProperties.$formatMessage = intl.formatMessage;
11
- app.config.globalProperties.$formatDate = intl.formatDate;
12
- app.config.globalProperties.$formatTime = intl.formatTime;
13
- app.config.globalProperties.$formatDateTimeRange = intl.formatDateTimeRange;
14
- app.config.globalProperties.$formatRelativeTime = intl.formatRelativeTime;
15
- app.config.globalProperties.$formatDisplayName = intl.formatDisplayName;
16
- app.config.globalProperties.$formatNumber = intl.formatNumber;
17
- app.config.globalProperties.$formatList = intl.formatList;
18
- app.provide(intlKey, intl);
19
- },
20
- });
@@ -1,6 +0,0 @@
1
- import { IntlShape } from '@formatjs/intl';
2
- import { RendererElement, RendererNode, VNode } from 'vue';
3
- export declare function provideIntl(intl: IntlShape<VNode>): void;
4
- export declare function useIntl(): IntlShape<VNode<RendererNode, RendererElement, {
5
- [key: string]: any;
6
- }>>;
@@ -1,12 +0,0 @@
1
- import { inject, provide } from 'vue';
2
- import { intlKey } from './injection-key';
3
- export function provideIntl(intl) {
4
- provide(intlKey, intl);
5
- }
6
- export function useIntl() {
7
- const intl = inject(intlKey);
8
- if (!intl) {
9
- throw new Error(`An intl object was not injected. Install the plugin or use provideIntl.`);
10
- }
11
- return intl;
12
- }