@intlayer/react-intl 8.12.5-canary.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/README.md +330 -0
- package/dist/cjs/FormattedComponents.cjs +131 -0
- package/dist/cjs/FormattedComponents.cjs.map +1 -0
- package/dist/cjs/FormattedMessage.cjs +45 -0
- package/dist/cjs/FormattedMessage.cjs.map +1 -0
- package/dist/cjs/IntlProvider.cjs +38 -0
- package/dist/cjs/IntlProvider.cjs.map +1 -0
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/cjs/context.cjs +16 -0
- package/dist/cjs/context.cjs.map +1 -0
- package/dist/cjs/createIntl.cjs +46 -0
- package/dist/cjs/createIntl.cjs.map +1 -0
- package/dist/cjs/createIntlObject.cjs +132 -0
- package/dist/cjs/createIntlObject.cjs.map +1 -0
- package/dist/cjs/defineMessages.cjs +20 -0
- package/dist/cjs/defineMessages.cjs.map +1 -0
- package/dist/cjs/errors.cjs +85 -0
- package/dist/cjs/errors.cjs.map +1 -0
- package/dist/cjs/index.cjs +40 -0
- package/dist/cjs/plugin/index.cjs +57 -0
- package/dist/cjs/plugin/index.cjs.map +1 -0
- package/dist/cjs/useIntl.cjs +33 -0
- package/dist/cjs/useIntl.cjs.map +1 -0
- package/dist/esm/FormattedComponents.mjs +119 -0
- package/dist/esm/FormattedComponents.mjs.map +1 -0
- package/dist/esm/FormattedMessage.mjs +44 -0
- package/dist/esm/FormattedMessage.mjs.map +1 -0
- package/dist/esm/IntlProvider.mjs +37 -0
- package/dist/esm/IntlProvider.mjs.map +1 -0
- package/dist/esm/context.mjs +14 -0
- package/dist/esm/context.mjs.map +1 -0
- package/dist/esm/createIntl.mjs +44 -0
- package/dist/esm/createIntl.mjs.map +1 -0
- package/dist/esm/createIntlObject.mjs +131 -0
- package/dist/esm/createIntlObject.mjs.map +1 -0
- package/dist/esm/defineMessages.mjs +17 -0
- package/dist/esm/defineMessages.mjs.map +1 -0
- package/dist/esm/errors.mjs +77 -0
- package/dist/esm/errors.mjs.map +1 -0
- package/dist/esm/index.mjs +12 -0
- package/dist/esm/plugin/index.mjs +53 -0
- package/dist/esm/plugin/index.mjs.map +1 -0
- package/dist/esm/useIntl.mjs +32 -0
- package/dist/esm/useIntl.mjs.map +1 -0
- package/dist/types/FormattedComponents.d.ts +67 -0
- package/dist/types/FormattedComponents.d.ts.map +1 -0
- package/dist/types/FormattedMessage.d.ts +28 -0
- package/dist/types/FormattedMessage.d.ts.map +1 -0
- package/dist/types/IntlProvider.d.ts +16 -0
- package/dist/types/IntlProvider.d.ts.map +1 -0
- package/dist/types/context.d.ts +13 -0
- package/dist/types/context.d.ts.map +1 -0
- package/dist/types/createIntl.d.ts +35 -0
- package/dist/types/createIntl.d.ts.map +1 -0
- package/dist/types/createIntlObject.d.ts +15 -0
- package/dist/types/createIntlObject.d.ts.map +1 -0
- package/dist/types/defineMessages.d.ts +18 -0
- package/dist/types/defineMessages.d.ts.map +1 -0
- package/dist/types/errors.d.ts +56 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/plugin/index.d.ts +23 -0
- package/dist/types/plugin/index.d.ts.map +1 -0
- package/dist/types/useIntl.d.ts +21 -0
- package/dist/types/useIntl.d.ts.map +1 -0
- package/package.json +117 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { FormattedDate as FormattedDate$1, FormattedDateParts as FormattedDateParts$1, FormattedDateTimeRange as FormattedDateTimeRange$1, FormattedDisplayName as FormattedDisplayName$1, FormattedList as FormattedList$1, FormattedListParts as FormattedListParts$1, FormattedNumber as FormattedNumber$1, FormattedNumberParts as FormattedNumberParts$1, FormattedPlural as FormattedPlural$1, FormattedRelativeTime as FormattedRelativeTime$1, FormattedTime as FormattedTime$1, FormattedTimeParts as FormattedTimeParts$1 } from "react-intl";
|
|
2
|
+
|
|
3
|
+
//#region src/FormattedComponents.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Drop-in for react-intl's `<FormattedDate>`.
|
|
6
|
+
* Renders a locale-aware date string using `Intl.DateTimeFormat`.
|
|
7
|
+
*/
|
|
8
|
+
declare const FormattedDate: typeof FormattedDate$1;
|
|
9
|
+
/**
|
|
10
|
+
* Drop-in for react-intl's `<FormattedTime>`.
|
|
11
|
+
* Renders a locale-aware time string using `Intl.DateTimeFormat`.
|
|
12
|
+
*/
|
|
13
|
+
declare const FormattedTime: typeof FormattedTime$1;
|
|
14
|
+
/**
|
|
15
|
+
* Drop-in for react-intl's `<FormattedNumber>`.
|
|
16
|
+
* Renders a locale-aware number string using `Intl.NumberFormat`.
|
|
17
|
+
*/
|
|
18
|
+
declare const FormattedNumber: typeof FormattedNumber$1;
|
|
19
|
+
/**
|
|
20
|
+
* Drop-in for react-intl's `<FormattedList>`.
|
|
21
|
+
* Renders a locale-aware list string using `Intl.ListFormat`.
|
|
22
|
+
*/
|
|
23
|
+
declare const FormattedList: typeof FormattedList$1;
|
|
24
|
+
/**
|
|
25
|
+
* Drop-in for react-intl's `<FormattedDisplayName>`.
|
|
26
|
+
* Renders a locale-aware display name using `Intl.DisplayNames`.
|
|
27
|
+
*/
|
|
28
|
+
declare const FormattedDisplayName: typeof FormattedDisplayName$1;
|
|
29
|
+
/**
|
|
30
|
+
* Drop-in for react-intl's `<FormattedRelativeTime>`.
|
|
31
|
+
* Renders a locale-aware relative time string using `Intl.RelativeTimeFormat`.
|
|
32
|
+
* Auto-update (`updateIntervalInSeconds`) is not implemented.
|
|
33
|
+
*/
|
|
34
|
+
declare const FormattedRelativeTime: typeof FormattedRelativeTime$1;
|
|
35
|
+
/**
|
|
36
|
+
* Drop-in for react-intl's `<FormattedPlural>`.
|
|
37
|
+
* Selects the matching plural slot using `Intl.PluralRules`.
|
|
38
|
+
*/
|
|
39
|
+
declare const FormattedPlural: typeof FormattedPlural$1;
|
|
40
|
+
/**
|
|
41
|
+
* Drop-in for react-intl's `<FormattedDateTimeRange>`.
|
|
42
|
+
* Renders a locale-aware date range string using `Intl.DateTimeFormat#formatRange`.
|
|
43
|
+
*/
|
|
44
|
+
declare const FormattedDateTimeRange: typeof FormattedDateTimeRange$1;
|
|
45
|
+
/**
|
|
46
|
+
* Drop-in for react-intl's `<FormattedDateParts>`.
|
|
47
|
+
* Renders format parts via a `children` render-prop.
|
|
48
|
+
*/
|
|
49
|
+
declare const FormattedDateParts: typeof FormattedDateParts$1;
|
|
50
|
+
/**
|
|
51
|
+
* Drop-in for react-intl's `<FormattedTimeParts>`.
|
|
52
|
+
* Renders format parts via a `children` render-prop.
|
|
53
|
+
*/
|
|
54
|
+
declare const FormattedTimeParts: typeof FormattedTimeParts$1;
|
|
55
|
+
/**
|
|
56
|
+
* Drop-in for react-intl's `<FormattedNumberParts>`.
|
|
57
|
+
* Renders format parts via a `children` render-prop.
|
|
58
|
+
*/
|
|
59
|
+
declare const FormattedNumberParts: typeof FormattedNumberParts$1;
|
|
60
|
+
/**
|
|
61
|
+
* Drop-in for react-intl's `<FormattedListParts>`.
|
|
62
|
+
* Renders list format parts via a `children` render-prop.
|
|
63
|
+
*/
|
|
64
|
+
declare const FormattedListParts: typeof FormattedListParts$1;
|
|
65
|
+
//#endregion
|
|
66
|
+
export { FormattedDate, FormattedDateParts, FormattedDateTimeRange, FormattedDisplayName, FormattedList, FormattedListParts, FormattedNumber, FormattedNumberParts, FormattedPlural, FormattedRelativeTime, FormattedTime, FormattedTimeParts };
|
|
67
|
+
//# sourceMappingURL=FormattedComponents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormattedComponents.d.ts","names":[],"sources":["../../src/FormattedComponents.tsx"],"mappings":";;;;;AA8BA;;cAAa,aAAA,SAAsB,eAYlC;;AAAA;AAMD;;cAAa,aAAA,SAAsB,eAYlC;;AAAA;AAMD;;cAAa,eAAA,SAAwB,iBAYpC;;AAAA;AAMD;;cAAa,aAAA,SAAsB,eAOlC;;AAAA;AAMD;;cAAa,oBAAA,SAA6B,sBAUzC;;AAAA;AAOD;;;cAAa,qBAAA,SAA8B,uBAa1C;AAAA;AAMD;;;AANC,cAMY,eAAA,SAAwB,iBA6BpC;AAAA;AAMD;;;AANC,cAMY,sBAAA,SAA+B,wBAY3C;AAAA;AAMD;;;AANC,cAMY,kBAAA,SAA2B,oBAYvC;AAAA;AAMD;;;AANC,cAMY,kBAAA,SAA2B,oBAYvC;AAAA;AAMD;;;AANC,cAMY,oBAAA,SAA6B,sBASzC;AAAA;AAMD;;;AANC,cAMY,kBAAA,SAA2B,oBAWvC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { FormattedMessage as FormattedMessage$1 } from "react-intl";
|
|
2
|
+
|
|
3
|
+
//#region src/FormattedMessage.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Drop-in for react-intl's `<FormattedMessage>`.
|
|
6
|
+
*
|
|
7
|
+
* Translates the message identified by `id` using the active intl context.
|
|
8
|
+
* Full ICU MessageFormat syntax is supported.
|
|
9
|
+
*
|
|
10
|
+
* When `values` contains render functions, rich text tags
|
|
11
|
+
* (`<b>chunks</b>`) are mapped through them. When a `tagName` is provided,
|
|
12
|
+
* the output is wrapped in that element; otherwise a fragment is used.
|
|
13
|
+
* A `children` render-prop receives the resolved nodes.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <FormattedMessage id="home.title" />
|
|
18
|
+
* <FormattedMessage id="home.greeting" values={{ name: 'Alice' }} />
|
|
19
|
+
* <FormattedMessage
|
|
20
|
+
* id="terms.agreement"
|
|
21
|
+
* values={{ b: (chunks) => <strong>{chunks}</strong> }}
|
|
22
|
+
* />
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare const FormattedMessage: typeof FormattedMessage$1;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { FormattedMessage };
|
|
28
|
+
//# sourceMappingURL=FormattedMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormattedMessage.d.ts","names":[],"sources":["../../src/FormattedMessage.tsx"],"mappings":";;;;;AA2BA;;;;AAgCC;;;;;;;;;;;;;;;cAhCY,gBAAA,SAAyB,kBAgCrC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IntlProvider as IntlProvider$1 } from "react-intl";
|
|
2
|
+
|
|
3
|
+
//#region src/IntlProvider.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Drop-in for react-intl's `IntlProvider`.
|
|
6
|
+
*
|
|
7
|
+
* `messages`, `formats`, `timeZone`, `now`, `defaultRichTextElements`,
|
|
8
|
+
* and `onError`/`onWarn` are accepted for API compatibility but have no
|
|
9
|
+
* effect — Intlayer uses its own compiled dictionaries.
|
|
10
|
+
*
|
|
11
|
+
* The `locale` prop is forwarded to `IntlayerClientProvider`.
|
|
12
|
+
*/
|
|
13
|
+
declare const IntlProvider: typeof IntlProvider$1;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { IntlProvider };
|
|
16
|
+
//# sourceMappingURL=IntlProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IntlProvider.d.ts","names":[],"sources":["../../src/IntlProvider.tsx"],"mappings":";;;;;AAqBA;;;;AAgCC;;;cAhCY,YAAA,SAAqB,cAgCjC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IntlShape } from "react-intl";
|
|
2
|
+
|
|
3
|
+
//#region src/context.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* React context holding the active intlayer-backed `IntlShape` instance.
|
|
6
|
+
* Populated by {@link IntlProvider}; consumed by {@link useIntl}.
|
|
7
|
+
*/
|
|
8
|
+
declare const IntlContext: import("react").Context<IntlShape>;
|
|
9
|
+
/** The raw `React.Provider<IntlShape>` — same as `IntlContext.Provider`. */
|
|
10
|
+
declare const RawIntlProvider: import("react").Provider<IntlShape>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { IntlContext, RawIntlProvider };
|
|
13
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","names":[],"sources":["../../src/context.tsx"],"mappings":";;;;;AAOA;;cAAa,WAAA,kBAAW,OAAA,CAAA,SAAA;;cAKX,eAAA,kBAAe,QAAA,CAAA,SAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createIntl as createIntl$1, createIntlCache as createIntlCache$1 } from "react-intl";
|
|
2
|
+
|
|
3
|
+
//#region src/createIntl.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Drop-in for react-intl's `createIntlCache`.
|
|
6
|
+
*
|
|
7
|
+
* Returns an empty cache token. In the intlayer compat adapter, formatter
|
|
8
|
+
* instances are not pooled (all backed by native `Intl.*` constructors), so
|
|
9
|
+
* the cache object serves only as an API-compatibility token.
|
|
10
|
+
*
|
|
11
|
+
* @deprecated
|
|
12
|
+
* Has no practical effect with intlayer — no formatter pooling is needed.
|
|
13
|
+
*/
|
|
14
|
+
declare const createIntlCache: typeof createIntlCache$1;
|
|
15
|
+
/**
|
|
16
|
+
* Drop-in for react-intl's `createIntl`.
|
|
17
|
+
*
|
|
18
|
+
* Creates an `IntlShape` instance backed by intlayer compiled dictionaries
|
|
19
|
+
* for the given `locale`. Use this in non-React contexts (e.g. server-side
|
|
20
|
+
* route handlers).
|
|
21
|
+
*
|
|
22
|
+
* `messages`, `formats`, `timeZone`, `onError`, and `cache` are accepted for
|
|
23
|
+
* API compatibility but have no effect — Intlayer uses its own compiled
|
|
24
|
+
* dictionaries.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const intl = createIntl({ locale: 'en' });
|
|
29
|
+
* intl.formatMessage({ id: 'home.title' });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
declare const createIntl: typeof createIntl$1;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { createIntl, createIntlCache };
|
|
35
|
+
//# sourceMappingURL=createIntl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createIntl.d.ts","names":[],"sources":["../../src/createIntl.ts"],"mappings":";;;;;AAoBA;;;;AASiB;AAmBjB;;;cA5Ba,eAAA,SAAwB,iBASpB;AAsBwC;;;;;;;;;;;;;;;;;AAAA,cAH5C,UAAA,SAAmB,YAGyB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IntlShape } from "react-intl";
|
|
2
|
+
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
3
|
+
|
|
4
|
+
//#region src/createIntlObject.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Builds an intlayer-backed `IntlShape` object for the given locale.
|
|
7
|
+
*
|
|
8
|
+
* - Translation ids use the first dot-path segment as the dictionary key.
|
|
9
|
+
* - Full ICU MessageFormat syntax is supported via `@intlayer/core/messageFormat`.
|
|
10
|
+
* - Rich text tags (`<b>chunks</b>`) are resolved through render functions in `values`.
|
|
11
|
+
*/
|
|
12
|
+
declare const createIntlObject: (locale: LocalesValues) => IntlShape;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { createIntlObject };
|
|
15
|
+
//# sourceMappingURL=createIntlObject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createIntlObject.d.ts","names":[],"sources":["../../src/createIntlObject.tsx"],"mappings":";;;;;;AAiGA;;;;;cAAa,gBAAA,GAAoB,MAAA,EAAQ,aAAA,KAAgB,SAqJxD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineMessage as defineMessage$1, defineMessages as defineMessages$1 } from "react-intl";
|
|
2
|
+
|
|
3
|
+
//#region src/defineMessages.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Drop-in for react-intl's `defineMessages`.
|
|
6
|
+
* Identity function — returns the map unchanged.
|
|
7
|
+
* Exists so that IDEs and the intlayer analyzer can locate message ids
|
|
8
|
+
* at source-analysis time.
|
|
9
|
+
*/
|
|
10
|
+
declare const defineMessages: typeof defineMessages$1;
|
|
11
|
+
/**
|
|
12
|
+
* Drop-in for react-intl's `defineMessage`.
|
|
13
|
+
* Identity function — returns the descriptor unchanged.
|
|
14
|
+
*/
|
|
15
|
+
declare const defineMessage: typeof defineMessage$1;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { defineMessage, defineMessages };
|
|
18
|
+
//# sourceMappingURL=defineMessages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineMessages.d.ts","names":[],"sources":["../../src/defineMessages.ts"],"mappings":";;;;;AAWA;;;;cAAa,cAAA,SAAuB,gBAAwC;AAM5E;;;;AAAA,cAAa,aAAA,SAAsB,eAAqC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//#region src/errors.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Error code enum matching react-intl's `ReactIntlErrorCode`.
|
|
4
|
+
*
|
|
5
|
+
* @deprecated These error codes are not raised by the intlayer compat adapter.
|
|
6
|
+
* Exported for API compatibility only.
|
|
7
|
+
*/
|
|
8
|
+
declare enum ReactIntlErrorCode {
|
|
9
|
+
FORMAT_ERROR = "FORMAT_ERROR",
|
|
10
|
+
UNSUPPORTED_FORMATTER = "UNSUPPORTED_FORMATTER",
|
|
11
|
+
INVALID_CONFIG = "INVALID_CONFIG",
|
|
12
|
+
MISSING_DATA = "MISSING_DATA",
|
|
13
|
+
MISSING_TRANSLATION = "MISSING_TRANSLATION"
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Base error class matching react-intl's `ReactIntlError` shape.
|
|
17
|
+
*
|
|
18
|
+
* @deprecated Not raised by the intlayer compat adapter. Exported for API compatibility only.
|
|
19
|
+
*/
|
|
20
|
+
declare class ReactIntlError extends Error {
|
|
21
|
+
readonly code: ReactIntlErrorCode;
|
|
22
|
+
constructor(code: ReactIntlErrorCode, message: string);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated Not raised by the intlayer compat adapter. Exported for API compatibility only.
|
|
26
|
+
*/
|
|
27
|
+
declare class InvalidConfigError extends ReactIntlError {
|
|
28
|
+
constructor(message: string);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated Not raised by the intlayer compat adapter. Exported for API compatibility only.
|
|
32
|
+
*/
|
|
33
|
+
declare class MessageFormatError extends ReactIntlError {
|
|
34
|
+
constructor(message: string);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated Not raised by the intlayer compat adapter. Exported for API compatibility only.
|
|
38
|
+
*/
|
|
39
|
+
declare class MissingDataError extends ReactIntlError {
|
|
40
|
+
constructor(message: string);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated Not raised by the intlayer compat adapter. Exported for API compatibility only.
|
|
44
|
+
*/
|
|
45
|
+
declare class MissingTranslationError extends ReactIntlError {
|
|
46
|
+
constructor(message: string);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated Not raised by the intlayer compat adapter. Exported for API compatibility only.
|
|
50
|
+
*/
|
|
51
|
+
declare class UnsupportedFormatterError extends ReactIntlError {
|
|
52
|
+
constructor(message: string);
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { InvalidConfigError, MessageFormatError, MissingDataError, MissingTranslationError, ReactIntlError, ReactIntlErrorCode, UnsupportedFormatterError };
|
|
56
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","names":[],"sources":["../../src/errors.ts"],"mappings":";;AAMA;;;;;aAAY,kBAAA;EACV,YAAA;EACA,qBAAA;EACA,cAAA;EACA,YAAA;EACA,mBAAA;AAAA;;;;;;cAQW,cAAA,SAAuB,KAAA;EAAA,SAClB,IAAA,EAAM,kBAAA;cAEV,IAAA,EAAM,kBAAA,EAAoB,OAAA;AAAA;;;;cAU3B,kBAAA,SAA2B,cAAc;cACxC,OAAA;AAAA;AAXyC;AAUvD;;AAVuD,cAoB1C,kBAAA,SAA2B,cAAc;cACxC,OAAA;AAAA;;;;cASD,gBAAA,SAAyB,cAAc;cACtC,OAAA;AAAA;;;;cASD,uBAAA,SAAgC,cAAc;cAC7C,OAAA;AAAA;AApBe;AAS7B;;AAT6B,cA6BhB,yBAAA,SAAkC,cAAc;cAC/C,OAAA;AAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FormattedDate, FormattedDateParts, FormattedDateTimeRange, FormattedDisplayName, FormattedList, FormattedListParts, FormattedNumber, FormattedNumberParts, FormattedPlural, FormattedRelativeTime, FormattedTime, FormattedTimeParts } from "./FormattedComponents.js";
|
|
2
|
+
import { FormattedMessage } from "./FormattedMessage.js";
|
|
3
|
+
import { IntlProvider } from "./IntlProvider.js";
|
|
4
|
+
import { IntlContext, RawIntlProvider } from "./context.js";
|
|
5
|
+
import { createIntl, createIntlCache } from "./createIntl.js";
|
|
6
|
+
import { defineMessage, defineMessages } from "./defineMessages.js";
|
|
7
|
+
import { InvalidConfigError, MessageFormatError, MissingDataError, MissingTranslationError, ReactIntlError, ReactIntlErrorCode, UnsupportedFormatterError } from "./errors.js";
|
|
8
|
+
import { useIntl } from "./useIntl.js";
|
|
9
|
+
import { CustomFormats, FormatDateOptions, FormatDisplayNameOptions, FormatListOptions, FormatNumberOptions, FormatPluralOptions, FormatRelativeTimeOptions, Formatters, IntlCache, IntlConfig, IntlFormatters, IntlShape, MessageDescriptor, MessageFormatElement, PrimitiveType, ResolvedIntlConfig } from "react-intl";
|
|
10
|
+
export { type CustomFormats, type FormatDateOptions, type FormatDisplayNameOptions, type FormatListOptions, type FormatNumberOptions, type FormatPluralOptions, type FormatRelativeTimeOptions, FormattedDate, FormattedDateParts, FormattedDateTimeRange, FormattedDisplayName, FormattedList, FormattedListParts, FormattedMessage, FormattedNumber, FormattedNumberParts, FormattedPlural, FormattedRelativeTime, FormattedTime, FormattedTimeParts, type Formatters, type IntlCache, type IntlConfig, IntlContext, type IntlFormatters, IntlProvider, type IntlShape, InvalidConfigError, type MessageDescriptor, type MessageFormatElement, MessageFormatError, MissingDataError, MissingTranslationError, type PrimitiveType, RawIntlProvider, ReactIntlError, ReactIntlErrorCode, type ResolvedIntlConfig, UnsupportedFormatterError, createIntl, createIntlCache, defineMessage, defineMessages, useIntl };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { PluginOption } from "vite";
|
|
2
|
+
import { intlayer } from "vite-intlayer";
|
|
3
|
+
|
|
4
|
+
//#region src/plugin/index.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* A Vite plugin for react-intl compat that wraps vite-intlayer
|
|
7
|
+
* and injects a resolve alias mapping `react-intl` to
|
|
8
|
+
* `@intlayer/react-intl`.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* // vite.config.ts
|
|
13
|
+
* import reactIntlVitePlugin from '@intlayer/react-intl/plugin';
|
|
14
|
+
*
|
|
15
|
+
* export default defineConfig({
|
|
16
|
+
* plugins: [reactIntlVitePlugin()],
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
declare const reactIntlVitePlugin: (options?: Parameters<typeof intlayer>[0]) => PluginOption[];
|
|
21
|
+
//#endregion
|
|
22
|
+
export { reactIntlVitePlugin as default, reactIntlVitePlugin };
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/plugin/index.ts"],"mappings":";;;;;;AAkCA;;;;;;;;;;;;;cAAa,mBAAA,GACX,OAAA,GAAU,UAAA,QAAkB,QAAA,SAC3B,YAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useIntl as useIntl$1 } from "react-intl";
|
|
2
|
+
|
|
3
|
+
//#region src/useIntl.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Drop-in for react-intl's `useIntl`.
|
|
6
|
+
*
|
|
7
|
+
* Returns the active `IntlShape` instance. When used inside an
|
|
8
|
+
* {@link IntlProvider} the instance comes from context; otherwise it is
|
|
9
|
+
* derived from `react-intlayer`'s locale context on the fly.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* const intl = useIntl();
|
|
14
|
+
* intl.formatMessage({ id: 'home.title' });
|
|
15
|
+
* intl.formatNumber(42, { style: 'currency', currency: 'USD' });
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
declare const useIntl: typeof useIntl$1;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { useIntl };
|
|
21
|
+
//# sourceMappingURL=useIntl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIntl.d.ts","names":[],"sources":["../../src/useIntl.ts"],"mappings":";;;;;AAuBA;;;;AAUC;;;;;;;;cAVY,OAAA,SAAgB,SAU5B"}
|
package/package.json
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@intlayer/react-intl",
|
|
3
|
+
"version": "8.12.5-canary.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "react-intl API adapter for intlayer — drop-in compatibility layer",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"intlayer",
|
|
8
|
+
"i18next",
|
|
9
|
+
"i18n",
|
|
10
|
+
"adapter",
|
|
11
|
+
"compatibility"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://intlayer.org",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/aymericzip/intlayer/issues"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/aymericzip/intlayer.git"
|
|
20
|
+
},
|
|
21
|
+
"license": "Apache-2.0",
|
|
22
|
+
"author": {
|
|
23
|
+
"name": "Aymeric PINEAU",
|
|
24
|
+
"url": "https://github.com/aymericzip"
|
|
25
|
+
},
|
|
26
|
+
"contributors": [
|
|
27
|
+
{
|
|
28
|
+
"name": "Aymeric Pineau",
|
|
29
|
+
"email": "ay.pineau@gmail.com",
|
|
30
|
+
"url": "https://github.com/aymericzip"
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"sideEffects": false,
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"types": "./dist/types/index.d.ts",
|
|
37
|
+
"require": "./dist/cjs/index.cjs",
|
|
38
|
+
"import": "./dist/esm/index.mjs"
|
|
39
|
+
},
|
|
40
|
+
"./plugin": {
|
|
41
|
+
"types": "./dist/types/plugin/index.d.ts",
|
|
42
|
+
"require": "./dist/cjs/plugin/index.cjs",
|
|
43
|
+
"import": "./dist/esm/plugin/index.mjs"
|
|
44
|
+
},
|
|
45
|
+
"./package.json": "./package.json"
|
|
46
|
+
},
|
|
47
|
+
"main": "dist/cjs/index.cjs",
|
|
48
|
+
"module": "dist/esm/index.mjs",
|
|
49
|
+
"types": "dist/types/index.d.ts",
|
|
50
|
+
"typesVersions": {
|
|
51
|
+
"*": {
|
|
52
|
+
"plugin": [
|
|
53
|
+
"./dist/types/plugin/index.d.ts"
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"files": [
|
|
58
|
+
"./dist",
|
|
59
|
+
"./package.json"
|
|
60
|
+
],
|
|
61
|
+
"scripts": {
|
|
62
|
+
"build": "bun --bun tsdown --config tsdown.config.ts",
|
|
63
|
+
"build:ci": "bun --bun tsdown --config tsdown.config.ts",
|
|
64
|
+
"clean": "bun --bun rimraf ./dist .turbo",
|
|
65
|
+
"dev": "bun --bun tsdown --config tsdown.config.ts --watch",
|
|
66
|
+
"format": "bun --bun biome format . --check",
|
|
67
|
+
"format:fix": "bun --bun biome format --write .",
|
|
68
|
+
"lint": "bun --bun biome lint .",
|
|
69
|
+
"lint:fix": "bun --bun biome lint --write .",
|
|
70
|
+
"prepublish": "cp -f ../../README.md ./README.md",
|
|
71
|
+
"publish": "bun publish || true",
|
|
72
|
+
"publish:canary": "bun publish --access public --tag canary || true",
|
|
73
|
+
"publish:latest": "bun publish --access public --tag latest || true",
|
|
74
|
+
"test": "bun --bun vitest run",
|
|
75
|
+
"test:watch": "bun --bun vitest",
|
|
76
|
+
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
77
|
+
},
|
|
78
|
+
"dependencies": {
|
|
79
|
+
"@intlayer/chokidar": "9.0.0-canary.1",
|
|
80
|
+
"@intlayer/config": "9.0.0-canary.1",
|
|
81
|
+
"@intlayer/core": "9.0.0-canary.1",
|
|
82
|
+
"@intlayer/dictionaries-entry": "9.0.0-canary.1",
|
|
83
|
+
"@intlayer/types": "9.0.0-canary.1",
|
|
84
|
+
"react-intlayer": "9.0.0-canary.1",
|
|
85
|
+
"vite-intlayer": "9.0.0-canary.1"
|
|
86
|
+
},
|
|
87
|
+
"devDependencies": {
|
|
88
|
+
"@types/node": "25.9.3",
|
|
89
|
+
"@types/react": "19.1.8",
|
|
90
|
+
"@utils/ts-config": "1.0.4",
|
|
91
|
+
"@utils/ts-config-types": "1.0.4",
|
|
92
|
+
"@utils/tsdown-config": "1.0.4",
|
|
93
|
+
"react-intl": "^10.1.13",
|
|
94
|
+
"rimraf": "6.1.3",
|
|
95
|
+
"tsdown": "0.22.2",
|
|
96
|
+
"typescript": "6.0.3",
|
|
97
|
+
"vite": "8.0.16",
|
|
98
|
+
"vitest": "4.1.9"
|
|
99
|
+
},
|
|
100
|
+
"peerDependencies": {
|
|
101
|
+
"react": ">=16.0.0",
|
|
102
|
+
"react-dom": ">=16.0.0",
|
|
103
|
+
"react-intl": ">=10.1.13",
|
|
104
|
+
"vite": ">=4.0.0"
|
|
105
|
+
},
|
|
106
|
+
"peerDependenciesMeta": {
|
|
107
|
+
"react-dom": {
|
|
108
|
+
"optional": true
|
|
109
|
+
},
|
|
110
|
+
"vite": {
|
|
111
|
+
"optional": true
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"engines": {
|
|
115
|
+
"node": ">=14.18"
|
|
116
|
+
}
|
|
117
|
+
}
|