@react-aria/i18n
Advanced tools
Comparing version 3.0.0-nightly.2843 to 3.0.0-nightly.2846
@@ -1,6 +0,45 @@ | ||
// useMessageFormatter is deprecated, but has a large dependency on intl-messageformat | ||
// that we want to avoid. If it is built into the same file as the rest of the package, | ||
// it deopts tree shaking in Parcel even when unused. Instead, it is split into a separate | ||
// file and re-exported here, which allows tree shaking to work properly. | ||
module.exports = require('./real-main.js'); | ||
Object.defineProperties(module.exports, Object.getOwnPropertyDescriptors(require('./useMessageFormatter.js'))); | ||
var $47fa5ec5ff482271$exports = require("./context.main.js"); | ||
var $c376aa482226bf60$exports = require("./useMessageFormatter.main.js"); | ||
var $fc53663969a3d00a$exports = require("./useLocalizedStringFormatter.main.js"); | ||
var $cb6a3e7d490e97a4$exports = require("./useListFormatter.main.js"); | ||
var $b80c530ff2e20243$exports = require("./useDateFormatter.main.js"); | ||
var $fea93c5b7c90d9f4$exports = require("./useNumberFormatter.main.js"); | ||
var $27a5ce66022270ad$exports = require("./useCollator.main.js"); | ||
var $832d079b867c7223$exports = require("./useFilter.main.js"); | ||
function $parcel$export(e, n, v, s) { | ||
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true}); | ||
} | ||
$parcel$export(module.exports, "I18nProvider", () => $47fa5ec5ff482271$exports.I18nProvider); | ||
$parcel$export(module.exports, "useLocale", () => $47fa5ec5ff482271$exports.useLocale); | ||
$parcel$export(module.exports, "useMessageFormatter", () => $c376aa482226bf60$exports.useMessageFormatter); | ||
$parcel$export(module.exports, "useLocalizedStringFormatter", () => $fc53663969a3d00a$exports.useLocalizedStringFormatter); | ||
$parcel$export(module.exports, "useLocalizedStringDictionary", () => $fc53663969a3d00a$exports.useLocalizedStringDictionary); | ||
$parcel$export(module.exports, "useListFormatter", () => $cb6a3e7d490e97a4$exports.useListFormatter); | ||
$parcel$export(module.exports, "useDateFormatter", () => $b80c530ff2e20243$exports.useDateFormatter); | ||
$parcel$export(module.exports, "useNumberFormatter", () => $fea93c5b7c90d9f4$exports.useNumberFormatter); | ||
$parcel$export(module.exports, "useCollator", () => $27a5ce66022270ad$exports.useCollator); | ||
$parcel$export(module.exports, "useFilter", () => $832d079b867c7223$exports.useFilter); | ||
/* | ||
* Copyright 2020 Adobe. All rights reserved. | ||
* This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. You may obtain a copy | ||
* of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under | ||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
* OF ANY KIND, either express or implied. See the License for the specific language | ||
* governing permissions and limitations under the License. | ||
*/ | ||
//# sourceMappingURL=main.js.map |
@@ -1,6 +0,31 @@ | ||
// useMessageFormatter is deprecated, but has a large dependency on intl-messageformat | ||
// that we want to avoid. If it is built into the same file as the rest of the package, | ||
// it deopts tree shaking in Parcel even when unused. Instead, it is split into a separate | ||
// file and re-exported here, which allows tree shaking to work properly. | ||
export * from './real-module.js'; | ||
export * from './useMessageFormatter.module.js'; | ||
import {I18nProvider as $18f2051aff69b9bf$export$a54013f0d02a8f82, useLocale as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7} from "./context.module.js"; | ||
import {useMessageFormatter as $321bc95feeb923dd$export$ec23bf898b1eed85} from "./useMessageFormatter.module.js"; | ||
import {useLocalizedStringDictionary as $fca6afa0e843324b$export$87b761675e8eaa10, useLocalizedStringFormatter as $fca6afa0e843324b$export$f12b703ca79dfbb1} from "./useLocalizedStringFormatter.module.js"; | ||
import {useListFormatter as $33bf17300c498528$export$a2f47a3d2973640} from "./useListFormatter.module.js"; | ||
import {useDateFormatter as $896ba0a80a8f4d36$export$85fd5fdf27bacc79} from "./useDateFormatter.module.js"; | ||
import {useNumberFormatter as $a916eb452884faea$export$b7a616150fdb9f44} from "./useNumberFormatter.module.js"; | ||
import {useCollator as $325a3faab7a68acd$export$a16aca283550c30d} from "./useCollator.module.js"; | ||
import {useFilter as $bb77f239b46e8c72$export$3274cf84b703fff} from "./useFilter.module.js"; | ||
/* | ||
* Copyright 2020 Adobe. All rights reserved. | ||
* This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. You may obtain a copy | ||
* of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under | ||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
* OF ANY KIND, either express or implied. See the License for the specific language | ||
* governing permissions and limitations under the License. | ||
*/ | ||
export {$18f2051aff69b9bf$export$a54013f0d02a8f82 as I18nProvider, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 as useLocale, $321bc95feeb923dd$export$ec23bf898b1eed85 as useMessageFormatter, $fca6afa0e843324b$export$f12b703ca79dfbb1 as useLocalizedStringFormatter, $fca6afa0e843324b$export$87b761675e8eaa10 as useLocalizedStringDictionary, $33bf17300c498528$export$a2f47a3d2973640 as useListFormatter, $896ba0a80a8f4d36$export$85fd5fdf27bacc79 as useDateFormatter, $a916eb452884faea$export$b7a616150fdb9f44 as useNumberFormatter, $325a3faab7a68acd$export$a16aca283550c30d as useCollator, $bb77f239b46e8c72$export$3274cf84b703fff as useFilter}; | ||
//# sourceMappingURL=module.js.map |
@@ -0,1 +1,5 @@ | ||
import {useLocale as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7} from "./context.module.js"; | ||
import {MessageDictionary as $eZWU1$MessageDictionary, MessageFormatter as $eZWU1$MessageFormatter} from "@internationalized/message"; | ||
import {useMemo as $eZWU1$useMemo, useCallback as $eZWU1$useCallback} from "react"; | ||
/* | ||
@@ -11,30 +15,30 @@ * Copyright 2020 Adobe. All rights reserved. | ||
* governing permissions and limitations under the License. | ||
*/ | ||
*/ | ||
import { MessageDictionary, MessageFormatter } from '@internationalized/message'; | ||
import { useCallback, useMemo } from 'react'; | ||
import { useLocale } from '@react-aria/i18n'; | ||
const cache = new WeakMap(); | ||
function getCachedDictionary(strings) { | ||
let dictionary = cache.get(strings); | ||
if (!dictionary) { | ||
dictionary = new MessageDictionary(strings); | ||
cache.set(strings, dictionary); | ||
} | ||
return dictionary; | ||
const $321bc95feeb923dd$var$cache = new WeakMap(); | ||
function $321bc95feeb923dd$var$getCachedDictionary(strings) { | ||
let dictionary = $321bc95feeb923dd$var$cache.get(strings); | ||
if (!dictionary) { | ||
dictionary = new (0, $eZWU1$MessageDictionary)(strings); | ||
$321bc95feeb923dd$var$cache.set(strings, dictionary); | ||
} | ||
return dictionary; | ||
} | ||
function $321bc95feeb923dd$export$ec23bf898b1eed85(strings) { | ||
let { locale: locale } = (0, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7)(); | ||
let dictionary = (0, $eZWU1$useMemo)(()=>$321bc95feeb923dd$var$getCachedDictionary(strings), [ | ||
strings | ||
]); | ||
let formatter = (0, $eZWU1$useMemo)(()=>new (0, $eZWU1$MessageFormatter)(locale, dictionary), [ | ||
locale, | ||
dictionary | ||
]); | ||
return (0, $eZWU1$useCallback)((key, variables)=>formatter.format(key, variables), [ | ||
formatter | ||
]); | ||
} | ||
/** | ||
* Handles formatting ICU Message strings to create localized strings for the current locale. | ||
* Automatically updates when the locale changes, and handles caching of messages for performance. | ||
* @param strings - A mapping of languages to strings by key. | ||
* @deprecated - use useLocalizedStringFormatter instead. | ||
*/ | ||
export function useMessageFormatter(strings) { | ||
let { | ||
locale | ||
} = useLocale(); | ||
let dictionary = useMemo(() => getCachedDictionary(strings), [strings]); | ||
let formatter = useMemo(() => new MessageFormatter(locale, dictionary), [locale, dictionary]); | ||
return useCallback((key, variables) => formatter.format(key, variables), [formatter]); | ||
} | ||
export {$321bc95feeb923dd$export$ec23bf898b1eed85 as useMessageFormatter}; | ||
//# sourceMappingURL=useMessageFormatter.module.js.map |
{ | ||
"name": "@react-aria/i18n", | ||
"version": "3.0.0-nightly.2843+81162ea39", | ||
"version": "3.0.0-nightly.2846+c5e4b3701", | ||
"description": "Spectrum UI components in React", | ||
@@ -19,4 +19,2 @@ "license": "Apache-2.0", | ||
}, | ||
"real-main": "dist/real-main.js", | ||
"real-module": "dist/real-module.js", | ||
"server-module": "server/index.mjs", | ||
@@ -27,14 +25,4 @@ "server-main": "server/index.js", | ||
"targets": { | ||
"main": false, | ||
"module": false, | ||
"real-module": { | ||
"outputFormat": "esmodule", | ||
"isLibrary": true, | ||
"includeNodeModules": false | ||
}, | ||
"real-main": { | ||
"outputFormat": "commonjs", | ||
"isLibrary": true, | ||
"includeNodeModules": false | ||
}, | ||
"main": {}, | ||
"module": {}, | ||
"server-module": { | ||
@@ -53,10 +41,2 @@ "source": "src/server.tsx", | ||
}, | ||
"alias": { | ||
"./src/useMessageFormatter.ts": false | ||
}, | ||
"scripts": { | ||
"build:module": "yarn babel --presets @babel/preset-typescript src/useMessageFormatter.ts -o dist/useMessageFormatter.module.js && cp src/module.js dist/module.js && cp dist/real-module.js dist/real-module.mjs && cp dist/real-module.js.map dist/real-module.mjs.map && cp dist/useMessageFormatter.module.js dist/useMessageFormatter.module.mjs", | ||
"build:cjs": "yarn babel --presets @babel/preset-typescript,@babel/preset-env src/useMessageFormatter.ts -o dist/useMessageFormatter.js && cp src/main.js dist/main.js", | ||
"prepublishOnly": "yarn build:module && yarn build:cjs" | ||
}, | ||
"files": [ | ||
@@ -73,9 +53,9 @@ "dist", | ||
"dependencies": { | ||
"@internationalized/date": "3.5.3-nightly.4555+81162ea39", | ||
"@internationalized/message": "3.1.3-nightly.4555+81162ea39", | ||
"@internationalized/number": "3.5.2-nightly.4555+81162ea39", | ||
"@internationalized/string": "3.2.2-nightly.4555+81162ea39", | ||
"@react-aria/ssr": "3.9.3-nightly.4555+81162ea39", | ||
"@react-aria/utils": "3.0.0-nightly.2843+81162ea39", | ||
"@react-types/shared": "3.0.0-nightly.2843+81162ea39", | ||
"@internationalized/date": "3.5.3-nightly.4558+c5e4b3701", | ||
"@internationalized/message": "3.1.3-nightly.4558+c5e4b3701", | ||
"@internationalized/number": "3.5.2-nightly.4558+c5e4b3701", | ||
"@internationalized/string": "3.2.2-nightly.4558+c5e4b3701", | ||
"@react-aria/ssr": "3.9.3-nightly.4558+c5e4b3701", | ||
"@react-aria/utils": "3.0.0-nightly.2846+c5e4b3701", | ||
"@react-types/shared": "3.0.0-nightly.2846+c5e4b3701", | ||
"@swc/helpers": "^0.5.0" | ||
@@ -89,3 +69,3 @@ }, | ||
}, | ||
"gitHead": "81162ea392926d06ec3d25c228e6f9b6b5479d59" | ||
"gitHead": "c5e4b3701fdb89eb551f1b3697ac253f06ef68fa" | ||
} |
@@ -15,3 +15,3 @@ /* | ||
import {useCallback, useMemo} from 'react'; | ||
import {useLocale} from '@react-aria/i18n'; | ||
import {useLocale} from './context'; | ||
@@ -18,0 +18,0 @@ export type FormatMessage = (key: string, variables?: {[key: string]: any}) => string; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
78
2077
186050
2