Socket
Socket
Sign inDemoInstall

@react-aria/i18n

Package Overview
Dependencies
9
Maintainers
2
Versions
710
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.10.2 to 3.11.0

dist/context.main.js

51

dist/main.js

@@ -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

@@ -87,2 +87,3 @@ import { Direction } from "@react-types/shared";

export function useFilter(options?: Intl.CollatorOptions): Filter;
export type { LocalizedStringFormatter } from '@internationalized/string';
export type { LocalizedStrings } from '@internationalized/message';

@@ -89,0 +90,0 @@ export type { DateFormatter } from '@internationalized/date';

55

dist/useMessageFormatter.module.js

@@ -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,33 +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;
}
/**
* 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.
*/
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
]);
}
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.10.2",
"version": "3.11.0",
"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.2",
"@internationalized/message": "^3.1.2",
"@internationalized/number": "^3.5.1",
"@internationalized/string": "^3.2.1",
"@react-aria/ssr": "^3.9.2",
"@react-aria/utils": "^3.23.2",
"@react-types/shared": "^3.22.1",
"@internationalized/date": "^3.5.3",
"@internationalized/message": "^3.1.3",
"@internationalized/number": "^3.5.2",
"@internationalized/string": "^3.2.2",
"@react-aria/ssr": "^3.9.3",
"@react-aria/utils": "^3.24.0",
"@react-types/shared": "^3.23.0",
"@swc/helpers": "^0.5.0"

@@ -89,3 +69,3 @@ },

},
"gitHead": "de9f84a22583fc741c29b341d14cd35ef4cca161"
"gitHead": "f645f29edc1322153fd60af4640cbcab1d992dbd"
}

@@ -23,2 +23,3 @@ /*

export type {FormatMessage} from './useMessageFormatter';
export type {LocalizedStringFormatter} from '@internationalized/string';
export type {I18nProviderProps} from './context';

@@ -25,0 +26,0 @@ export type {Locale} from './useDefaultLocale';

@@ -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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc