diff --git a/examples/example-app-router-playground/tests/main.spec.ts b/examples/example-app-router-playground/tests/main.spec.ts index 6185b0bd0..f0eeb0010 100644 --- a/examples/example-app-router-playground/tests/main.spec.ts +++ b/examples/example-app-router-playground/tests/main.spec.ts @@ -392,6 +392,8 @@ it('supports a consistent `now` value across the server and client', async ({ }) => { await page.goto('/en/client'); + // ensure this is consistent across main entry, /server and also /navigation + const serverDate = await page.getByTestId('NowFromServer').textContent(); const serverDateDelayed = await page .getByTestId('NowFromServerDelayed') diff --git a/packages/next-intl/benchmarks/tree-shaking/.eslintrc b/packages/next-intl/benchmarks/tree-shaking/.eslintrc new file mode 100644 index 000000000..81b15e863 --- /dev/null +++ b/packages/next-intl/benchmarks/tree-shaking/.eslintrc @@ -0,0 +1,8 @@ +{ + "env": { + "browser": true + }, + "rules": { + "import/no-unresolved": "off" + } +} diff --git a/packages/next-intl/benchmarks/tree-shaking/NextIntlClientProvider.js b/packages/next-intl/benchmarks/tree-shaking/NextIntlClientProvider.js new file mode 100644 index 000000000..04c1a7434 --- /dev/null +++ b/packages/next-intl/benchmarks/tree-shaking/NextIntlClientProvider.js @@ -0,0 +1,3 @@ +import {NextIntlClientProvider} from 'next-intl'; + +window.NextIntlClientProvider = NextIntlClientProvider; diff --git a/packages/next-intl/benchmarks/tree-shaking/createFormatter.js b/packages/next-intl/benchmarks/tree-shaking/createFormatter.js new file mode 100644 index 000000000..4dff3bdd2 --- /dev/null +++ b/packages/next-intl/benchmarks/tree-shaking/createFormatter.js @@ -0,0 +1,3 @@ +import {createFormatter} from 'next-intl'; + +window.createFormatter = createFormatter; diff --git a/packages/next-intl/benchmarks/tree-shaking/createTranslator.js b/packages/next-intl/benchmarks/tree-shaking/createTranslator.js new file mode 100644 index 000000000..bd5fe3cdb --- /dev/null +++ b/packages/next-intl/benchmarks/tree-shaking/createTranslator.js @@ -0,0 +1,3 @@ +import {createTranslator} from 'next-intl'; + +window.createTranslator = createTranslator; diff --git a/packages/next-intl/benchmarks/tree-shaking/navigation/createLocalizedPathnamesNavigation.js b/packages/next-intl/benchmarks/tree-shaking/navigation/createLocalizedPathnamesNavigation.js new file mode 100644 index 000000000..beb6eeef6 --- /dev/null +++ b/packages/next-intl/benchmarks/tree-shaking/navigation/createLocalizedPathnamesNavigation.js @@ -0,0 +1,3 @@ +import {createLocalizedPathnamesNavigation} from 'next-intl/navigation'; + +window.createLocalizedPathnamesNavigation = createLocalizedPathnamesNavigation; diff --git a/packages/next-intl/benchmarks/tree-shaking/navigation/createSharedPathnamesNavigation.js b/packages/next-intl/benchmarks/tree-shaking/navigation/createSharedPathnamesNavigation.js new file mode 100644 index 000000000..aa4a91a79 --- /dev/null +++ b/packages/next-intl/benchmarks/tree-shaking/navigation/createSharedPathnamesNavigation.js @@ -0,0 +1,3 @@ +import {createSharedPathnamesNavigation} from 'next-intl/navigation'; + +window.createSharedPathnamesNavigation = createSharedPathnamesNavigation; diff --git a/packages/next-intl/benchmarks/tree-shaking/useFormatter.js b/packages/next-intl/benchmarks/tree-shaking/useFormatter.js new file mode 100644 index 000000000..fb86384cf --- /dev/null +++ b/packages/next-intl/benchmarks/tree-shaking/useFormatter.js @@ -0,0 +1,3 @@ +import {useFormatter} from 'next-intl'; + +window.useFormatter = useFormatter; diff --git a/packages/next-intl/benchmarks/tree-shaking/useLocale.js b/packages/next-intl/benchmarks/tree-shaking/useLocale.js new file mode 100644 index 000000000..6f31b1c7a --- /dev/null +++ b/packages/next-intl/benchmarks/tree-shaking/useLocale.js @@ -0,0 +1,3 @@ +import {useLocale} from 'next-intl'; + +window.useLocale = useLocale; diff --git a/packages/next-intl/benchmarks/tree-shaking/useMessages.js b/packages/next-intl/benchmarks/tree-shaking/useMessages.js new file mode 100644 index 000000000..d77d0b0a1 --- /dev/null +++ b/packages/next-intl/benchmarks/tree-shaking/useMessages.js @@ -0,0 +1,3 @@ +import {useMessages} from 'next-intl'; + +window.useMessages = useMessages; diff --git a/packages/next-intl/benchmarks/tree-shaking/useNow.js b/packages/next-intl/benchmarks/tree-shaking/useNow.js new file mode 100644 index 000000000..377173209 --- /dev/null +++ b/packages/next-intl/benchmarks/tree-shaking/useNow.js @@ -0,0 +1,3 @@ +import {useNow} from 'next-intl'; + +window.useNow = useNow; diff --git a/packages/next-intl/benchmarks/tree-shaking/useTimeZone.js b/packages/next-intl/benchmarks/tree-shaking/useTimeZone.js new file mode 100644 index 000000000..9b0867b4f --- /dev/null +++ b/packages/next-intl/benchmarks/tree-shaking/useTimeZone.js @@ -0,0 +1,3 @@ +import {useTimeZone} from 'next-intl'; + +window.useTimeZone = useTimeZone; diff --git a/packages/next-intl/benchmarks/tree-shaking/useTranslations.js b/packages/next-intl/benchmarks/tree-shaking/useTranslations.js new file mode 100644 index 000000000..37e587ecf --- /dev/null +++ b/packages/next-intl/benchmarks/tree-shaking/useTranslations.js @@ -0,0 +1,3 @@ +import {useTranslations} from 'next-intl'; + +window.useTranslations = useTranslations; diff --git a/packages/next-intl/config.d.ts b/packages/next-intl/config.d.ts index 86c346051..cfc9c469c 100644 --- a/packages/next-intl/config.d.ts +++ b/packages/next-intl/config.d.ts @@ -1,3 +1,3 @@ -import config from './dist/types/src/config'; +import config from './dist/config'; export = config; diff --git a/packages/next-intl/middleware.d.ts b/packages/next-intl/middleware.d.ts index 41dddf9a1..0b95aa6d8 100644 --- a/packages/next-intl/middleware.d.ts +++ b/packages/next-intl/middleware.d.ts @@ -1,3 +1,3 @@ -import createMiddleware from './dist/types/src/middleware'; +import createMiddleware from './dist/middleware'; export = createMiddleware; diff --git a/packages/next-intl/navigation.d.ts b/packages/next-intl/navigation.d.ts index 81ded918e..ab45eb662 100644 --- a/packages/next-intl/navigation.d.ts +++ b/packages/next-intl/navigation.d.ts @@ -1 +1 @@ -export * from './dist/types/src/navigation.react-client'; +export * from './dist/navigation'; diff --git a/packages/next-intl/package.json b/packages/next-intl/package.json index d7995a3cb..4a08d8737 100644 --- a/packages/next-intl/package.json +++ b/packages/next-intl/package.json @@ -9,7 +9,7 @@ "url": "https://github.com/sponsors/amannn" } ], - "description": "A minimal, but complete solution for internationalization in Next.js apps.", + "description": "Internationalization (i18n) for Next.js that gets out of your way.", "license": "MIT", "homepage": "https://next-intl-docs.vercel.app", "repository": { @@ -17,44 +17,86 @@ "url": "https://github.com/amannn/next-intl" }, "scripts": { - "build": "rm -rf dist && rollup -c", + "build": "rm -rf dist && bunchee --external next-intl/config", "test": "TZ=Europe/Berlin vitest", "lint": "pnpm run lint:source && pnpm run lint:package", "lint:source": "eslint src test && tsc --noEmit", - "lint:package": "publint && attw --pack", + "lint:package": "publint", "prepublishOnly": "CI=true turbo test && turbo lint && turbo build && cp ../../README.md .", "postpublish": "git checkout . && rm ./README.md", "size": "size-limit" }, - "main": "./dist/index.react-client.js", - "module": "./dist/esm/index.react-client.js", - "typings": "./dist/types/src/index.react-client.d.ts", + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "typings": "./dist/index.d.ts", "exports": { ".": { - "types": "./dist/types/src/index.react-client.d.ts", - "react-server": "./dist/esm/index.react-server.js", - "default": "./dist/index.react-client.js" + "react-server": "./dist/index.react-server.mjs", + "import": { + "types": "./dist/index.d.mts", + "default": "./dist/index.mjs" + }, + "require": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "default": "./dist/index.js" }, "./server": { - "types": "./server.d.ts", - "react-server": "./dist/esm/server.react-server.js", - "default": "./dist/server.react-client.js" + "react-server": "./dist/server.react-server.mjs", + "import": { + "types": "./dist/server.d.mts", + "default": "./dist/server.mjs" + }, + "require": { + "types": "./dist/server.d.ts", + "default": "./dist/server.js" + }, + "default": "./dist/server.js" + }, + "./navigation": { + "react-server": "./dist/navigation.react-server.mjs", + "import": { + "types": "./dist/navigation.d.mts", + "default": "./dist/navigation.mjs" + }, + "require": { + "types": "./dist/navigation.d.ts", + "default": "./dist/navigation.js" + }, + "default": "./dist/navigation.js" }, "./config": { - "types": "./config.d.ts", + "import": { + "types": "./dist/config.d.mts", + "default": "./dist/config.mjs" + }, + "require": { + "types": "./dist/config.d.ts", + "default": "./dist/config.js" + }, "default": "./dist/config.js" }, "./middleware": { - "types": "./middleware.d.ts", + "import": { + "types": "./dist/middleware.d.mts", + "default": "./dist/middleware.mjs" + }, + "require": { + "types": "./dist/middleware.d.ts", + "default": "./dist/middleware.js" + }, "default": "./dist/middleware.js" }, - "./navigation": { - "types": "./navigation.d.ts", - "react-server": "./dist/esm/navigation.react-server.js", - "default": "./dist/navigation.react-client.js" - }, "./plugin": { - "types": "./plugin.d.ts", + "import": { + "types": "./dist/plugin.d.mts", + "default": "./dist/plugin.mjs" + }, + "require": { + "types": "./dist/plugin.d.ts", + "default": "./dist/plugin.js" + }, "default": "./dist/plugin.js" } }, @@ -97,6 +139,7 @@ "@types/node": "^20.1.2", "@types/react": "18.2.34", "@types/react-dom": "^18.2.17", + "bunchee": "5.0.0-beta.1", "eslint": "^8.54.0", "eslint-config-molindo": "^7.0.0", "eslint-plugin-deprecation": "^1.4.1", @@ -105,8 +148,6 @@ "publint": "^0.2.7", "react": "^18.2.0", "react-dom": "^18.2.0", - "rollup": "^3.28.1", - "rollup-plugin-preserve-directives": "0.2.0", "size-limit": "^8.2.6", "typescript": "^5.2.2", "vitest": "^1.0.1" @@ -139,6 +180,50 @@ { "path": "dist/production/middleware.js", "limit": "5.855 KB" + }, + { + "path": "benchmarks/tree-shaking/createFormatter.js", + "limit": "1.4KB" + }, + { + "path": "benchmarks/tree-shaking/createTranslator.js", + "limit": "11.2KB" + }, + { + "path": "benchmarks/tree-shaking/NextIntlClientProvider.js", + "limit": "1KB" + }, + { + "path": "benchmarks/tree-shaking/useFormatter.js", + "limit": "12.4KB" + }, + { + "path": "benchmarks/tree-shaking/useLocale.js", + "limit": "0.4KB" + }, + { + "path": "benchmarks/tree-shaking/useMessages.js", + "limit": "0.3KB" + }, + { + "path": "benchmarks/tree-shaking/useNow.js", + "limit": "0.3KB" + }, + { + "path": "benchmarks/tree-shaking/useTimeZone.js", + "limit": "0.2KB" + }, + { + "path": "benchmarks/tree-shaking/useTranslations.js", + "limit": "12.5KB" + }, + { + "path": "benchmarks/tree-shaking/navigation/createLocalizedPathnamesNavigation.js", + "limit": "2.5kB" + }, + { + "path": "benchmarks/tree-shaking/navigation/createSharedPathnamesNavigation.js", + "limit": "1.7KB" } ] } diff --git a/packages/next-intl/plugin.d.ts b/packages/next-intl/plugin.d.ts index 476ab78b5..cf2611fbb 100644 --- a/packages/next-intl/plugin.d.ts +++ b/packages/next-intl/plugin.d.ts @@ -1,8 +1,3 @@ -import {NextConfig} from 'next'; +import createNextIntlPlugin from './dist/plugin'; -function createNextIntlPlugin( - i18nPath?: string -): (config?: NextConfig) => NextConfig; - -// Currently only available via CJS export = createNextIntlPlugin; diff --git a/packages/next-intl/server.d.ts b/packages/next-intl/server.d.ts index e53f54959..699fd532a 100644 --- a/packages/next-intl/server.d.ts +++ b/packages/next-intl/server.d.ts @@ -1 +1 @@ -export * from './dist/types/src/server/react-server'; +export * from './dist/server'; diff --git a/packages/next-intl/src/index.react-client.tsx b/packages/next-intl/src/index.tsx similarity index 100% rename from packages/next-intl/src/index.react-client.tsx rename to packages/next-intl/src/index.tsx diff --git a/packages/next-intl/src/navigation.react-client.tsx b/packages/next-intl/src/navigation.tsx similarity index 100% rename from packages/next-intl/src/navigation.react-client.tsx rename to packages/next-intl/src/navigation.tsx diff --git a/packages/next-intl/src/navigation/react-client/useBasePathname.tsx b/packages/next-intl/src/navigation/react-client/useBasePathname.tsx index f585b5efd..a800bf193 100644 --- a/packages/next-intl/src/navigation/react-client/useBasePathname.tsx +++ b/packages/next-intl/src/navigation/react-client/useBasePathname.tsx @@ -1,5 +1,3 @@ -'use client'; - import {usePathname as useNextPathname} from 'next/navigation'; import {useMemo} from 'react'; import useLocale from '../../react-client/useLocale'; diff --git a/packages/next-intl/src/navigation/react-server/ServerLink.tsx b/packages/next-intl/src/navigation/react-server/ServerLink.tsx index d9c16a27a..5c5792f90 100644 --- a/packages/next-intl/src/navigation/react-server/ServerLink.tsx +++ b/packages/next-intl/src/navigation/react-server/ServerLink.tsx @@ -1,5 +1,6 @@ +// @ts-ignore -- Only available after build +import {_getRequestLocale as getRequestLocale} from 'next-intl/server'; import React, {ComponentProps} from 'react'; -import {getLocale} from '../../server.react-server'; import {AllLocales} from '../../shared/types'; import BaseLink from '../shared/BaseLink'; @@ -14,5 +15,5 @@ export default async function ServerLink({ locale, ...rest }: Props) { - return ; + return ; } diff --git a/packages/next-intl/src/navigation/react-server/createLocalizedPathnamesNavigation.tsx b/packages/next-intl/src/navigation/react-server/createLocalizedPathnamesNavigation.tsx index 6e830d48b..c95d4d4e8 100644 --- a/packages/next-intl/src/navigation/react-server/createLocalizedPathnamesNavigation.tsx +++ b/packages/next-intl/src/navigation/react-server/createLocalizedPathnamesNavigation.tsx @@ -1,5 +1,6 @@ +// @ts-ignore -- Only available after build +import {_getRequestLocale as getRequestLocale} from 'next-intl/server'; import React, {ComponentProps} from 'react'; -import {getRequestLocale} from '../../server/react-server/RequestLocale'; import { AllLocales, LocalePrefix, diff --git a/packages/next-intl/src/navigation/react-server/serverRedirect.tsx b/packages/next-intl/src/navigation/react-server/serverRedirect.tsx index d636a40dd..43f57f807 100644 --- a/packages/next-intl/src/navigation/react-server/serverRedirect.tsx +++ b/packages/next-intl/src/navigation/react-server/serverRedirect.tsx @@ -1,4 +1,5 @@ -import {getRequestLocale} from '../../server/react-server/RequestLocale'; +// @ts-ignore -- Only available after build +import {_getRequestLocale as getRequestLocale} from 'next-intl/server'; import {LocalePrefix, ParametersExceptFirst} from '../../shared/types'; import baseRedirect from '../shared/baseRedirect'; diff --git a/packages/next-intl/src/plugin.tsx b/packages/next-intl/src/plugin.tsx index fac8cb5e3..7e6d994b3 100644 --- a/packages/next-intl/src/plugin.tsx +++ b/packages/next-intl/src/plugin.tsx @@ -107,8 +107,13 @@ function initPlugin(i18nPath?: string, nextConfig?: NextConfig): NextConfig { return Object.assign({}, nextConfig, nextIntlConfig); } -module.exports = function createNextIntlPlugin(i18nPath?: string) { +export default function createNextIntlPlugin(i18nPath?: string) { return function withNextIntl(nextConfig?: NextConfig) { return initPlugin(i18nPath, nextConfig); }; -}; +} + +// Compat with CJS default export +if (typeof module !== 'undefined' && module.exports) { + module.exports = createNextIntlPlugin; +} diff --git a/packages/next-intl/src/react-client/useLocale.tsx b/packages/next-intl/src/react-client/useLocale.tsx index 400dd6fec..fb1a3be3d 100644 --- a/packages/next-intl/src/react-client/useLocale.tsx +++ b/packages/next-intl/src/react-client/useLocale.tsx @@ -1,6 +1,5 @@ import {useParams} from 'next/navigation'; -// Workaround for some bundle splitting until we have ESM -import {useLocale as useBaseLocale} from 'use-intl/_useLocale'; +import {useLocale as useBaseLocale} from 'use-intl/react'; import {LOCALE_SEGMENT_NAME} from '../shared/constants'; export default function useLocale(): string { diff --git a/packages/next-intl/src/react-server/NextIntlClientProviderServer.tsx b/packages/next-intl/src/react-server/NextIntlClientProviderServer.tsx index 941187dcc..e87612ae4 100644 --- a/packages/next-intl/src/react-server/NextIntlClientProviderServer.tsx +++ b/packages/next-intl/src/react-server/NextIntlClientProviderServer.tsx @@ -1,5 +1,9 @@ +import { + _getRequestLocale as getRequestLocale, + _getConfig as getConfig + // @ts-ignore -- Only available after build +} from 'next-intl/server'; import React, {ComponentProps} from 'react'; -import {getLocale, getNow, getTimeZone} from '../server.react-server'; import BaseNextIntlClientProvider from '../shared/NextIntlClientProvider'; type Props = ComponentProps; @@ -10,13 +14,17 @@ export default async function NextIntlClientProviderServer({ timeZone, ...rest }: Props) { + // We need to be careful about potentially reading from headers here. + // See https://github.com/amannn/next-intl/issues/631 + if (!locale) locale = getRequestLocale(); + if (!now) now = await getConfig(locale).now; + if (!timeZone) timeZone = await getConfig(locale).timeZone; + return ( ); diff --git a/packages/next-intl/src/react-server/useConfig.tsx b/packages/next-intl/src/react-server/useConfig.tsx index 5525de78e..f98483ca6 100644 --- a/packages/next-intl/src/react-server/useConfig.tsx +++ b/packages/next-intl/src/react-server/useConfig.tsx @@ -1,5 +1,6 @@ +// @ts-ignore -- Only available after build +import {_getConfig as getConfig} from 'next-intl/server'; import {use} from 'react'; -import getConfig from '../server/react-server/getConfig'; import useLocale from './useLocale'; function useHook(hookName: string, promise: Promise) { diff --git a/packages/next-intl/src/react-server/useLocale.tsx b/packages/next-intl/src/react-server/useLocale.tsx index 518b975ea..7f3c79edf 100644 --- a/packages/next-intl/src/react-server/useLocale.tsx +++ b/packages/next-intl/src/react-server/useLocale.tsx @@ -1,5 +1,6 @@ +// @ts-ignore -- Only available after build +import {_getRequestLocale as getRequestLocale} from 'next-intl/server'; import type {useLocale as useLocaleType} from 'use-intl'; -import {getRequestLocale} from '../server/react-server/RequestLocale'; export default function useLocale( // eslint-disable-next-line no-empty-pattern diff --git a/packages/next-intl/src/react-server/useMessages.tsx b/packages/next-intl/src/react-server/useMessages.tsx index 8dff17598..c0e5d8a11 100644 --- a/packages/next-intl/src/react-server/useMessages.tsx +++ b/packages/next-intl/src/react-server/useMessages.tsx @@ -1,5 +1,5 @@ import type {useMessages as useMessagesType} from 'use-intl'; -import {getMessagesFromConfig} from '../server/react-server/getMessages'; +import getMessagesFromConfig from '../shared/getMessagesFromConfig'; import useConfig from './useConfig'; export default function useMessages( diff --git a/packages/next-intl/src/server.react-client.tsx b/packages/next-intl/src/server.tsx similarity index 100% rename from packages/next-intl/src/server.react-client.tsx rename to packages/next-intl/src/server.tsx diff --git a/packages/next-intl/src/server/react-client/index.tsx b/packages/next-intl/src/server/react-client/index.tsx index 7d00b33e4..a4ba24a11 100644 --- a/packages/next-intl/src/server/react-client/index.tsx +++ b/packages/next-intl/src/server/react-client/index.tsx @@ -5,7 +5,8 @@ import type { getTimeZone as getTimeZone_type, getMessages as getMessages_type, getLocale as getLocale_type, - unstable_setRequestLocale as unstable_setRequestLocale_type + unstable_setRequestLocale as unstable_setRequestLocale_type, + _getRequestLocale as _getRequestLocale_type } from '../react-server'; /** @@ -43,8 +44,13 @@ export const getLocale = notSupported('getLocale') as typeof getLocale_type; // The type of `getTranslations` is not assigned here because it // causes a type error. The types use the `react-server` entry // anyway, therefore this is irrelevant. +// TODO: Validate if this is still the case (probably not) export const getTranslations = notSupported('getTranslations'); +export const _getRequestLocale = notSupported( + '_getRequestLocale' +) as typeof _getRequestLocale_type; + export const unstable_setRequestLocale = notSupported( 'unstable_setRequestLocale' ) as typeof unstable_setRequestLocale_type; diff --git a/packages/next-intl/src/server/react-server/RequestLocale.tsx b/packages/next-intl/src/server/react-server/RequestLocale.tsx index 81b146931..615d14ace 100644 --- a/packages/next-intl/src/server/react-server/RequestLocale.tsx +++ b/packages/next-intl/src/server/react-server/RequestLocale.tsx @@ -35,7 +35,7 @@ function getLocaleFromHeaderImpl() { } const getLocaleFromHeader = cache(getLocaleFromHeaderImpl); -// Workaround until `createServerContext` is available +// https://github.com/vercel/next.js/discussions/58862 function getCacheImpl() { const value: {locale?: string} = {locale: undefined}; return value; diff --git a/packages/next-intl/src/server/react-server/getConfig.tsx b/packages/next-intl/src/server/react-server/getConfig.tsx index 7872415aa..41675f1dd 100644 --- a/packages/next-intl/src/server/react-server/getConfig.tsx +++ b/packages/next-intl/src/server/react-server/getConfig.tsx @@ -1,5 +1,6 @@ import {cache} from 'react'; -import {initializeConfig, IntlConfig} from 'use-intl/core'; +import {initializeConfig} from 'use-intl/core'; +import {ServerIntlConfig} from '../../shared/types'; import createRequestConfig from './createRequestConfig'; // Make sure `now` is consistent across the request in case none was configured @@ -31,14 +32,7 @@ async function receiveRuntimeConfigImpl( } const receiveRuntimeConfig = cache(receiveRuntimeConfigImpl); -async function getConfigImpl(locale: string): Promise< - IntlConfig & { - getMessageFallback: NonNullable; - now: NonNullable; - onError: NonNullable; - timeZone: NonNullable; - } -> { +async function getConfigImpl(locale: string): Promise { const runtimeConfig = await receiveRuntimeConfig(locale, createRequestConfig); const opts = {...runtimeConfig, locale}; return initializeConfig(opts); diff --git a/packages/next-intl/src/server/react-server/getMessages.tsx b/packages/next-intl/src/server/react-server/getMessages.tsx index 7591dc612..c2632f8b8 100644 --- a/packages/next-intl/src/server/react-server/getMessages.tsx +++ b/packages/next-intl/src/server/react-server/getMessages.tsx @@ -1,19 +1,9 @@ import {cache} from 'react'; import type {AbstractIntlMessages} from 'use-intl'; +import getMessagesFromConfig from '../../shared/getMessagesFromConfig'; import getConfig from './getConfig'; import resolveLocaleArg from './resolveLocaleArg'; -export function getMessagesFromConfig( - config: Awaited> -): AbstractIntlMessages { - if (!config.messages) { - throw new Error( - 'No messages found. Have you configured them correctly? See https://next-intl-docs.vercel.app/docs/configuration#messages' - ); - } - return config.messages; -} - async function getMessagesCachedImpl(locale: string) { const config = await getConfig(locale); return getMessagesFromConfig(config); diff --git a/packages/next-intl/src/server/react-server/index.tsx b/packages/next-intl/src/server/react-server/index.tsx index c3d85a3ea..3f3e4801a 100644 --- a/packages/next-intl/src/server/react-server/index.tsx +++ b/packages/next-intl/src/server/react-server/index.tsx @@ -10,4 +10,9 @@ export {default as getTranslations} from './getTranslations'; export {default as getMessages} from './getMessages'; export {default as getLocale} from './getLocale'; +// It's important to share these modules across entries +// https://github.com/huozhi/bunchee/issues/265 +export {getRequestLocale as _getRequestLocale} from './RequestLocale'; +export {default as _getConfig} from './getConfig'; + export {setRequestLocale as unstable_setRequestLocale} from './RequestLocale'; diff --git a/packages/next-intl/src/shared/NextIntlClientProvider.tsx b/packages/next-intl/src/shared/NextIntlClientProvider.tsx index 2b0385ae4..44cbac754 100644 --- a/packages/next-intl/src/shared/NextIntlClientProvider.tsx +++ b/packages/next-intl/src/shared/NextIntlClientProvider.tsx @@ -1,8 +1,7 @@ 'use client'; import React, {ComponentProps} from 'react'; -// Workaround for some bundle splitting until we have ESM -import {IntlProvider} from 'use-intl/_IntlProvider'; +import {IntlProvider} from 'use-intl/react'; type Props = Omit, 'locale'> & { /** This is automatically received when being rendered from a Server Component. In all other cases, e.g. when rendered from a Client Component, a unit test or with the Pages Router, you can pass this prop explicitly. */ diff --git a/packages/next-intl/src/shared/getMessagesFromConfig.tsx b/packages/next-intl/src/shared/getMessagesFromConfig.tsx new file mode 100644 index 000000000..a96efc416 --- /dev/null +++ b/packages/next-intl/src/shared/getMessagesFromConfig.tsx @@ -0,0 +1,13 @@ +import type {AbstractIntlMessages} from 'use-intl/core'; +import {ServerIntlConfig} from './types'; + +export default function getMessagesFromConfig( + config: ServerIntlConfig +): AbstractIntlMessages { + if (!config.messages) { + throw new Error( + 'No messages found. Have you configured them correctly? See https://next-intl-docs.vercel.app/docs/configuration#messages' + ); + } + return config.messages; +} diff --git a/packages/next-intl/src/shared/types.tsx b/packages/next-intl/src/shared/types.tsx index 590d4d1fb..46c007dbe 100644 --- a/packages/next-intl/src/shared/types.tsx +++ b/packages/next-intl/src/shared/types.tsx @@ -1,7 +1,16 @@ +import type {IntlConfig} from 'use-intl/core'; + export type AllLocales = ReadonlyArray; export type LocalePrefix = 'as-needed' | 'always' | 'never'; +export type ServerIntlConfig = IntlConfig & { + getMessageFallback: NonNullable; + now: NonNullable; + onError: NonNullable; + timeZone: NonNullable; +}; + export type Pathnames = Record< string, {[Key in Locales[number]]: string} | string diff --git a/packages/next-intl/src/shared/utils.tsx b/packages/next-intl/src/shared/utils.tsx index cacc52f88..278d5cac4 100644 --- a/packages/next-intl/src/shared/utils.tsx +++ b/packages/next-intl/src/shared/utils.tsx @@ -4,7 +4,7 @@ import {ComponentProps} from 'react'; type Href = ComponentProps['href']; -export function isRelativeHref(href: Href) { +function isRelativeHref(href: Href) { const pathname = typeof href === 'object' ? href.pathname : href; return pathname != null && !pathname.startsWith('/'); } diff --git a/packages/use-intl/_IntlProvider.d.ts b/packages/use-intl/_IntlProvider.d.ts deleted file mode 100644 index 638757cd7..000000000 --- a/packages/use-intl/_IntlProvider.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './dist/types/src/_IntlProvider'; diff --git a/packages/use-intl/_useLocale.d.ts b/packages/use-intl/_useLocale.d.ts deleted file mode 100644 index 6eefcd371..000000000 --- a/packages/use-intl/_useLocale.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './dist/types/src/_useLocale'; diff --git a/packages/use-intl/core.d.ts b/packages/use-intl/core.d.ts index 5df015235..b9674df37 100644 --- a/packages/use-intl/core.d.ts +++ b/packages/use-intl/core.d.ts @@ -1 +1 @@ -export * from './dist/types/src/core'; +export * from './dist/core.d.ts'; diff --git a/packages/use-intl/package.json b/packages/use-intl/package.json index 74c39e560..53b93f42a 100644 --- a/packages/use-intl/package.json +++ b/packages/use-intl/package.json @@ -3,7 +3,7 @@ "version": "3.9.1", "sideEffects": false, "author": "Jan Amann ", - "description": "Minimal, but complete solution for managing internationalization in React apps.", + "description": "Internationalization (i18n) for React that gets out of your way. ", "license": "MIT", "homepage": "https://next-intl-docs.vercel.app/", "repository": { @@ -11,7 +11,7 @@ "url": "https://github.com/amannn/next-intl/tree/main/packages/use-intl" }, "scripts": { - "build": "rm -rf dist && rollup -c", + "build": "bunchee", "test": "TZ=Europe/Berlin vitest", "lint": "pnpm run lint:source && pnpm run lint:package", "lint:source": "eslint src test && tsc --noEmit", @@ -20,36 +20,60 @@ "size": "size-limit" }, "main": "./dist/index.js", - "module": "dist/esm/index.js", - "typings": "./dist/types/src/index.d.ts", + "module": "dist/index.mjs", + "type": "commonjs", + "typings": "./dist/index.d.ts", "exports": { ".": { - "types": "./dist/types/src/index.d.ts", + "import": { + "types": "./dist/index.d.mts", + "production": "./dist/index.production.mjs", + "development": "./dist/index.development.mjs", + "default": "./dist/index.mjs" + }, + "require": { + "types": "./dist/index.d.ts", + "production": "./dist/index.production.js", + "development": "./dist/index.development.js", + "default": "./dist/index.js" + }, "default": "./dist/index.js" }, "./core": { - "types": "./core.d.ts", + "import": { + "types": "./dist/core.d.mts", + "production": "./dist/core.production.mjs", + "development": "./dist/core.development.mjs", + "default": "./dist/core.mjs" + }, + "require": { + "types": "./dist/core.d.ts", + "production": "./dist/core.production.js", + "development": "./dist/core.development.js", + "default": "./dist/core.js" + }, "default": "./dist/core.js" }, "./react": { - "types": "./react.d.ts", + "import": { + "types": "./dist/react.d.mts", + "production": "./dist/react.production.mjs", + "development": "./dist/react.development.mjs", + "default": "./dist/react.mjs" + }, + "require": { + "types": "./dist/react.d.ts", + "production": "./dist/react.production.js", + "development": "./dist/react.development.js", + "default": "./dist/react.js" + }, "default": "./dist/react.js" - }, - "./_useLocale": { - "types": "./_useLocale.d.ts", - "default": "./dist/_useLocale.js" - }, - "./_IntlProvider": { - "types": "./_IntlProvider.d.ts", - "default": "./dist/_IntlProvider.js" } }, "files": [ "dist", "core.d.ts", - "react.d.ts", - "_useLocale.d.ts", - "_IntlProvider.d.ts" + "react.d.ts" ], "keywords": [ "react", @@ -76,20 +100,24 @@ "@types/node": "^20.1.2", "@types/react": "^18.2.29", "@types/react-dom": "^18.2.5", + "bunchee": "5.0.0-beta.1", "date-fns": "^2.16.1", "eslint": "^8.54.0", "eslint-config-molindo": "^7.0.0", "publint": "^0.2.7", "react": "^18.2.0", "react-dom": "^18.2.0", - "rollup": "^3.28.1", "size-limit": "^8.2.6", "typescript": "^5.2.2", "vitest": "^1.0.1" }, "size-limit": [ { - "path": "dist/production/index.js", + "path": "dist/index.js", + "limit": "12.665 kB" + }, + { + "path": "dist/index.mjs", "limit": "12.575 kB" } ] diff --git a/packages/use-intl/react.d.ts b/packages/use-intl/react.d.ts index db798174f..4c11faf9f 100644 --- a/packages/use-intl/react.d.ts +++ b/packages/use-intl/react.d.ts @@ -1 +1 @@ -export * from './dist/types/src/react'; +export * from './dist/react.d.ts'; diff --git a/packages/use-intl/rollup.config.js b/packages/use-intl/rollup.config.js deleted file mode 100644 index 2bfdf871f..000000000 --- a/packages/use-intl/rollup.config.js +++ /dev/null @@ -1,20 +0,0 @@ -/* eslint-env node */ -const getBuildConfig = require('../../scripts/getBuildConfig'); - -const input = { - index: 'src/index.tsx', - core: 'src/core.tsx', - react: 'src/react.tsx', - _useLocale: 'src/_useLocale.tsx', - _IntlProvider: 'src/_IntlProvider.tsx' -}; - -module.exports = [ - getBuildConfig({input, env: 'development'}), - getBuildConfig({ - input, - env: 'esm', - output: {format: 'es'} - }), - getBuildConfig({input, env: 'production'}) -]; diff --git a/packages/use-intl/src/_IntlProvider.tsx b/packages/use-intl/src/_IntlProvider.tsx deleted file mode 100644 index c02594cc2..000000000 --- a/packages/use-intl/src/_IntlProvider.tsx +++ /dev/null @@ -1 +0,0 @@ -export {default as IntlProvider} from './react/IntlProvider'; diff --git a/packages/use-intl/src/_useLocale.tsx b/packages/use-intl/src/_useLocale.tsx deleted file mode 100644 index 162f5d506..000000000 --- a/packages/use-intl/src/_useLocale.tsx +++ /dev/null @@ -1 +0,0 @@ -export {default as useLocale} from './react/useLocale'; diff --git a/packages/use-intl/src/core.tsx b/packages/use-intl/src/core.tsx deleted file mode 100644 index 65c514e92..000000000 --- a/packages/use-intl/src/core.tsx +++ /dev/null @@ -1 +0,0 @@ -export * from './core/index'; diff --git a/packages/use-intl/src/react.tsx b/packages/use-intl/src/react.tsx deleted file mode 100644 index f97dcae79..000000000 --- a/packages/use-intl/src/react.tsx +++ /dev/null @@ -1 +0,0 @@ -export * from './react/index'; diff --git a/packages/use-intl/src/react/useMessages.tsx b/packages/use-intl/src/react/useMessages.tsx index 24a9d0481..83b0e7c19 100644 --- a/packages/use-intl/src/react/useMessages.tsx +++ b/packages/use-intl/src/react/useMessages.tsx @@ -6,6 +6,7 @@ export default function useMessages(): AbstractIntlMessages { if (!context.messages) { throw new Error( + // TODO: Are these conditions problematic? process.env.NODE_ENV !== 'production' ? 'No messages found. Have you configured them correctly? See https://next-intl-docs.vercel.app/docs/configuration#messages' : undefined diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 83d1dbbda..03fa71685 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -561,7 +561,7 @@ importers: version: 3.1.3 '@size-limit/preset-big-lib': specifier: ^8.2.6 - version: 8.2.6(esbuild@0.18.20)(size-limit@8.2.6) + version: 8.2.6(@swc/core@1.4.2)(esbuild@0.18.20)(size-limit@8.2.6) '@testing-library/react': specifier: ^13.0.0 version: 13.0.0(react-dom@18.2.0)(react@18.2.0) @@ -577,6 +577,9 @@ importers: '@types/react-dom': specifier: ^18.2.17 version: 18.2.17 + bunchee: + specifier: 5.0.0-beta.1 + version: 5.0.0-beta.1(typescript@5.2.2) eslint: specifier: ^8.54.0 version: 8.54.0 @@ -601,12 +604,6 @@ importers: react-dom: specifier: ^18.2.0 version: 18.2.0(react@18.2.0) - rollup: - specifier: ^3.28.1 - version: 3.28.1 - rollup-plugin-preserve-directives: - specifier: 0.2.0 - version: 0.2.0(rollup@3.28.1) size-limit: specifier: ^8.2.6 version: 8.2.6 @@ -631,7 +628,7 @@ importers: version: 0.13.5 '@size-limit/preset-big-lib': specifier: ^8.2.6 - version: 8.2.6(esbuild@0.18.20)(size-limit@8.2.6) + version: 8.2.6(@swc/core@1.4.2)(esbuild@0.18.20)(size-limit@8.2.6) '@testing-library/react': specifier: ^13.0.0 version: 13.0.0(react-dom@18.2.0)(react@18.2.0) @@ -644,6 +641,9 @@ importers: '@types/react-dom': specifier: ^18.2.5 version: 18.2.14 + bunchee: + specifier: 5.0.0-beta.1 + version: 5.0.0-beta.1(typescript@5.2.2) date-fns: specifier: ^2.16.1 version: 2.16.1 @@ -662,9 +662,6 @@ importers: react-dom: specifier: ^18.2.0 version: 18.2.0(react@18.2.0) - rollup: - specifier: ^3.28.1 - version: 3.28.1 size-limit: specifier: ^8.2.6 version: 8.2.6 @@ -6553,6 +6550,10 @@ packages: js-yaml: 4.1.0 dev: false + /@fastify/deepmerge@1.3.0: + resolution: {integrity: sha512-J8TOSBq3SoZbDhM9+R/u77hP93gz/rajSA+K2kGyijPpORPWUXHUpTaleoj+92As0S9uPRP7Oi8IqMf0u+ro6A==} + dev: true + /@formatjs/ecma402-abstract@1.11.4: resolution: {integrity: sha512-EBikYFp2JCdIfGEb5G9dyCkTGDmC57KSHhRQOC3aYxoPWVZvfWCDjZwkGYHN7Lis/fmuWl906bnNTJifDQ3sXw==} dependencies: @@ -8267,6 +8268,37 @@ packages: rollup: 3.28.1 dev: true + /@rollup/plugin-commonjs@25.0.7(rollup@4.12.0): + resolution: {integrity: sha512-nEvcR+LRjEjsaSsc4x3XZfCCvZIaSMenZu/OiwOKGN2UhQpAYI7ru7czFvyWbErlpoGjnSX3D5Ch5FcMA3kRWQ==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^2.68.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + dependencies: + '@rollup/pluginutils': 5.1.0(rollup@4.12.0) + commondir: 1.0.1 + estree-walker: 2.0.2 + glob: 8.1.0 + is-reference: 1.2.1 + magic-string: 0.30.8 + rollup: 4.12.0 + dev: true + + /@rollup/plugin-json@6.1.0(rollup@4.12.0): + resolution: {integrity: sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + dependencies: + '@rollup/pluginutils': 5.1.0(rollup@4.12.0) + rollup: 4.12.0 + dev: true + /@rollup/plugin-node-resolve@15.2.3(rollup@3.28.1): resolution: {integrity: sha512-j/lym8nf5E21LwBT4Df1VD6hRO2L2iwUeUmP7litikRsVp1H6NWx20NEp0Y7su+7XGc476GnXXc4kFeZNGmaSQ==} engines: {node: '>=14.0.0'} @@ -8285,6 +8317,24 @@ packages: rollup: 3.28.1 dev: true + /@rollup/plugin-node-resolve@15.2.3(rollup@4.12.0): + resolution: {integrity: sha512-j/lym8nf5E21LwBT4Df1VD6hRO2L2iwUeUmP7litikRsVp1H6NWx20NEp0Y7su+7XGc476GnXXc4kFeZNGmaSQ==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^2.78.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + dependencies: + '@rollup/pluginutils': 5.0.5(rollup@4.12.0) + '@types/resolve': 1.20.2 + deepmerge: 4.3.1 + is-builtin-module: 3.2.1 + is-module: 1.0.0 + resolve: 1.22.2 + rollup: 4.12.0 + dev: true + /@rollup/plugin-replace@5.0.5(rollup@3.28.1): resolution: {integrity: sha512-rYO4fOi8lMaTg/z5Jb+hKnrHHVn8j2lwkqwyS4kTRhKyWOLf2wST2sWXr4WzWiTcoHTp2sTjqUbqIj2E39slKQ==} engines: {node: '>=14.0.0'} @@ -8299,6 +8349,20 @@ packages: rollup: 3.28.1 dev: true + /@rollup/plugin-replace@5.0.5(rollup@4.12.0): + resolution: {integrity: sha512-rYO4fOi8lMaTg/z5Jb+hKnrHHVn8j2lwkqwyS4kTRhKyWOLf2wST2sWXr4WzWiTcoHTp2sTjqUbqIj2E39slKQ==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + dependencies: + '@rollup/pluginutils': 5.0.5(rollup@4.12.0) + magic-string: 0.30.5 + rollup: 4.12.0 + dev: true + /@rollup/plugin-terser@0.4.4(rollup@3.28.1): resolution: {integrity: sha512-XHeJC5Bgvs8LfukDwWZp7yeqin6ns8RTl2B9avbejt6tZqsqvVoWI7ZTQrcNsfKEDWBTnTxM8nMDkO2IFFbd0A==} engines: {node: '>=14.0.0'} @@ -8314,6 +8378,19 @@ packages: terser: 5.18.2 dev: true + /@rollup/plugin-wasm@6.2.2(rollup@4.12.0): + resolution: {integrity: sha512-gpC4R1G9Ni92ZIRTexqbhX7U+9estZrbhP+9SRb0DW9xpB9g7j34r+J2hqrcW/lRI7dJaU84MxZM0Rt82tqYPQ==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + dependencies: + '@rollup/pluginutils': 5.1.0(rollup@4.12.0) + rollup: 4.12.0 + dev: true + /@rollup/pluginutils@4.2.1: resolution: {integrity: sha512-iKnFXr7NkdZAIHiIWE+BX5ULi/ucVFYWD6TbAV+rZctiRTY2PL6tsIKhoIOaoskiWAkgu+VsbXgUVDNLHf+InQ==} engines: {node: '>= 8.0.0'} @@ -8337,6 +8414,44 @@ packages: rollup: 3.28.1 dev: true + /@rollup/pluginutils@5.0.5(rollup@4.12.0): + resolution: {integrity: sha512-6aEYR910NyP73oHiJglti74iRyOwgFU4x3meH/H8OJx6Ry0j6cOVZ5X/wTvub7G7Ao6qaHBEaNsV3GLJkSsF+Q==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + dependencies: + '@types/estree': 1.0.1 + estree-walker: 2.0.2 + picomatch: 2.3.1 + rollup: 4.12.0 + dev: true + + /@rollup/pluginutils@5.1.0(rollup@4.12.0): + resolution: {integrity: sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + dependencies: + '@types/estree': 1.0.1 + estree-walker: 2.0.2 + picomatch: 2.3.1 + rollup: 4.12.0 + dev: true + + /@rollup/rollup-android-arm-eabi@4.12.0: + resolution: {integrity: sha512-+ac02NL/2TCKRrJu2wffk1kZ+RyqxVUlbjSagNgPm94frxtr+XDL12E5Ll1enWskLrtrZ2r8L3wED1orIibV/w==} + cpu: [arm] + os: [android] + requiresBuild: true + dev: true + optional: true + /@rollup/rollup-android-arm-eabi@4.6.1: resolution: {integrity: sha512-0WQ0ouLejaUCRsL93GD4uft3rOmB8qoQMU05Kb8CmMtMBe7XUDLAltxVZI1q6byNqEtU7N1ZX1Vw5lIpgulLQA==} cpu: [arm] @@ -8345,6 +8460,14 @@ packages: dev: true optional: true + /@rollup/rollup-android-arm64@4.12.0: + resolution: {integrity: sha512-OBqcX2BMe6nvjQ0Nyp7cC90cnumt8PXmO7Dp3gfAju/6YwG0Tj74z1vKrfRz7qAv23nBcYM8BCbhrsWqO7PzQQ==} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + /@rollup/rollup-android-arm64@4.6.1: resolution: {integrity: sha512-1TKm25Rn20vr5aTGGZqo6E4mzPicCUD79k17EgTLAsXc1zysyi4xXKACfUbwyANEPAEIxkzwue6JZ+stYzWUTA==} cpu: [arm64] @@ -8353,6 +8476,14 @@ packages: dev: true optional: true + /@rollup/rollup-darwin-arm64@4.12.0: + resolution: {integrity: sha512-X64tZd8dRE/QTrBIEs63kaOBG0b5GVEd3ccoLtyf6IdXtHdh8h+I56C2yC3PtC9Ucnv0CpNFJLqKFVgCYe0lOQ==} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + /@rollup/rollup-darwin-arm64@4.6.1: resolution: {integrity: sha512-cEXJQY/ZqMACb+nxzDeX9IPLAg7S94xouJJCNVE5BJM8JUEP4HeTF+ti3cmxWeSJo+5D+o8Tc0UAWUkfENdeyw==} cpu: [arm64] @@ -8361,6 +8492,14 @@ packages: dev: true optional: true + /@rollup/rollup-darwin-x64@4.12.0: + resolution: {integrity: sha512-cc71KUZoVbUJmGP2cOuiZ9HSOP14AzBAThn3OU+9LcA1+IUqswJyR1cAJj3Mg55HbjZP6OLAIscbQsQLrpgTOg==} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + /@rollup/rollup-darwin-x64@4.6.1: resolution: {integrity: sha512-LoSU9Xu56isrkV2jLldcKspJ7sSXmZWkAxg7sW/RfF7GS4F5/v4EiqKSMCFbZtDu2Nc1gxxFdQdKwkKS4rwxNg==} cpu: [x64] @@ -8369,6 +8508,14 @@ packages: dev: true optional: true + /@rollup/rollup-linux-arm-gnueabihf@4.12.0: + resolution: {integrity: sha512-a6w/Y3hyyO6GlpKL2xJ4IOh/7d+APaqLYdMf86xnczU3nurFTaVN9s9jOXQg97BE4nYm/7Ga51rjec5nfRdrvA==} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@rollup/rollup-linux-arm-gnueabihf@4.6.1: resolution: {integrity: sha512-EfI3hzYAy5vFNDqpXsNxXcgRDcFHUWSx5nnRSCKwXuQlI5J9dD84g2Usw81n3FLBNsGCegKGwwTVsSKK9cooSQ==} cpu: [arm] @@ -8377,6 +8524,14 @@ packages: dev: true optional: true + /@rollup/rollup-linux-arm64-gnu@4.12.0: + resolution: {integrity: sha512-0fZBq27b+D7Ar5CQMofVN8sggOVhEtzFUwOwPppQt0k+VR+7UHMZZY4y+64WJ06XOhBTKXtQB/Sv0NwQMXyNAA==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@rollup/rollup-linux-arm64-gnu@4.6.1: resolution: {integrity: sha512-9lhc4UZstsegbNLhH0Zu6TqvDfmhGzuCWtcTFXY10VjLLUe4Mr0Ye2L3rrtHaDd/J5+tFMEuo5LTCSCMXWfUKw==} cpu: [arm64] @@ -8385,6 +8540,14 @@ packages: dev: true optional: true + /@rollup/rollup-linux-arm64-musl@4.12.0: + resolution: {integrity: sha512-eTvzUS3hhhlgeAv6bfigekzWZjaEX9xP9HhxB0Dvrdbkk5w/b+1Sxct2ZuDxNJKzsRStSq1EaEkVSEe7A7ipgQ==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@rollup/rollup-linux-arm64-musl@4.6.1: resolution: {integrity: sha512-FfoOK1yP5ksX3wwZ4Zk1NgyGHZyuRhf99j64I5oEmirV8EFT7+OhUZEnP+x17lcP/QHJNWGsoJwrz4PJ9fBEXw==} cpu: [arm64] @@ -8393,6 +8556,22 @@ packages: dev: true optional: true + /@rollup/rollup-linux-riscv64-gnu@4.12.0: + resolution: {integrity: sha512-ix+qAB9qmrCRiaO71VFfY8rkiAZJL8zQRXveS27HS+pKdjwUfEhqo2+YF2oI+H/22Xsiski+qqwIBxVewLK7sw==} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-x64-gnu@4.12.0: + resolution: {integrity: sha512-TenQhZVOtw/3qKOPa7d+QgkeM6xY0LtwzR8OplmyL5LrgTWIXpTQg2Q2ycBf8jm+SFW2Wt/DTn1gf7nFp3ssVA==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@rollup/rollup-linux-x64-gnu@4.6.1: resolution: {integrity: sha512-DNGZvZDO5YF7jN5fX8ZqmGLjZEXIJRdJEdTFMhiyXqyXubBa0WVLDWSNlQ5JR2PNgDbEV1VQowhVRUh+74D+RA==} cpu: [x64] @@ -8401,6 +8580,14 @@ packages: dev: true optional: true + /@rollup/rollup-linux-x64-musl@4.12.0: + resolution: {integrity: sha512-LfFdRhNnW0zdMvdCb5FNuWlls2WbbSridJvxOvYWgSBOYZtgBfW9UGNJG//rwMqTX1xQE9BAodvMH9tAusKDUw==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@rollup/rollup-linux-x64-musl@4.6.1: resolution: {integrity: sha512-RkJVNVRM+piYy87HrKmhbexCHg3A6Z6MU0W9GHnJwBQNBeyhCJG9KDce4SAMdicQnpURggSvtbGo9xAWOfSvIQ==} cpu: [x64] @@ -8409,6 +8596,14 @@ packages: dev: true optional: true + /@rollup/rollup-win32-arm64-msvc@4.12.0: + resolution: {integrity: sha512-JPDxovheWNp6d7AHCgsUlkuCKvtu3RB55iNEkaQcf0ttsDU/JZF+iQnYcQJSk/7PtT4mjjVG8N1kpwnI9SLYaw==} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@rollup/rollup-win32-arm64-msvc@4.6.1: resolution: {integrity: sha512-v2FVT6xfnnmTe3W9bJXl6r5KwJglMK/iRlkKiIFfO6ysKs0rDgz7Cwwf3tjldxQUrHL9INT/1r4VA0n9L/F1vQ==} cpu: [arm64] @@ -8417,6 +8612,14 @@ packages: dev: true optional: true + /@rollup/rollup-win32-ia32-msvc@4.12.0: + resolution: {integrity: sha512-fjtuvMWRGJn1oZacG8IPnzIV6GF2/XG+h71FKn76OYFqySXInJtseAqdprVTDTyqPxQOG9Exak5/E9Z3+EJ8ZA==} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@rollup/rollup-win32-ia32-msvc@4.6.1: resolution: {integrity: sha512-YEeOjxRyEjqcWphH9dyLbzgkF8wZSKAKUkldRY6dgNR5oKs2LZazqGB41cWJ4Iqqcy9/zqYgmzBkRoVz3Q9MLw==} cpu: [ia32] @@ -8425,6 +8628,14 @@ packages: dev: true optional: true + /@rollup/rollup-win32-x64-msvc@4.12.0: + resolution: {integrity: sha512-ZYmr5mS2wd4Dew/JjT0Fqi2NPB/ZhZ2VvPp7SmvPZb4Y1CG/LRcS6tcRo2cYU7zLK5A7cdbhWnnWmUjoI4qapg==} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@rollup/rollup-win32-x64-msvc@4.6.1: resolution: {integrity: sha512-0zfTlFAIhgz8V2G8STq8toAjsYYA6eci1hnXuyOTUFnymrtJwnS6uGKiv3v5UrPZkBlamLvrLV2iiaeqCKzb0A==} cpu: [x64] @@ -8506,14 +8717,14 @@ packages: size-limit: 8.2.6 dev: true - /@size-limit/preset-big-lib@8.2.6(esbuild@0.18.20)(size-limit@8.2.6): + /@size-limit/preset-big-lib@8.2.6(@swc/core@1.4.2)(esbuild@0.18.20)(size-limit@8.2.6): resolution: {integrity: sha512-63a+yos0QNMVCfx1OWnxBrdQVTlBVGzW5fDXwpWq/hKfP3B89XXHYGeL2Z2f8IXSVeGkAHXnDcTZyIPRaXffVg==} peerDependencies: size-limit: 8.2.6 dependencies: '@size-limit/file': 8.2.6(size-limit@8.2.6) '@size-limit/time': 8.2.6(size-limit@8.2.6) - '@size-limit/webpack': 8.2.6(esbuild@0.18.20)(size-limit@8.2.6) + '@size-limit/webpack': 8.2.6(@swc/core@1.4.2)(esbuild@0.18.20)(size-limit@8.2.6) size-limit: 8.2.6 transitivePeerDependencies: - '@swc/core' @@ -8542,7 +8753,7 @@ packages: - utf-8-validate dev: true - /@size-limit/webpack@8.2.6(esbuild@0.18.20)(size-limit@8.2.6): + /@size-limit/webpack@8.2.6(@swc/core@1.4.2)(esbuild@0.18.20)(size-limit@8.2.6): resolution: {integrity: sha512-y2sB66m5sJxIjZ8SEAzpWbiw3/+bnQHDHfk9cSbV5ChKklq02AlYg8BS5KxGWmMpdyUo4TzpjSCP9oEudY+hxQ==} engines: {node: ^14.0.0 || ^16.0.0 || >=18.0.0} peerDependencies: @@ -8550,7 +8761,7 @@ packages: dependencies: nanoid: 3.3.6 size-limit: 8.2.6 - webpack: 5.88.1(esbuild@0.18.20) + webpack: 5.88.1(@swc/core@1.4.2)(esbuild@0.18.20) transitivePeerDependencies: - '@swc/core' - esbuild @@ -8558,11 +8769,141 @@ packages: - webpack-cli dev: true + /@swc/core-darwin-arm64@1.4.2: + resolution: {integrity: sha512-1uSdAn1MRK5C1m/TvLZ2RDvr0zLvochgrZ2xL+lRzugLlCTlSA+Q4TWtrZaOz+vnnFVliCpw7c7qu0JouhgQIw==} + engines: {node: '>=10'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@swc/core-darwin-x64@1.4.2: + resolution: {integrity: sha512-TYD28+dCQKeuxxcy7gLJUCFLqrwDZnHtC2z7cdeGfZpbI2mbfppfTf2wUPzqZk3gEC96zHd4Yr37V3Tvzar+lQ==} + engines: {node: '>=10'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@swc/core-linux-arm-gnueabihf@1.4.2: + resolution: {integrity: sha512-Eyqipf7ZPGj0vplKHo8JUOoU1un2sg5PjJMpEesX0k+6HKE2T8pdyeyXODN0YTFqzndSa/J43EEPXm+rHAsLFQ==} + engines: {node: '>=10'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@swc/core-linux-arm64-gnu@1.4.2: + resolution: {integrity: sha512-wZn02DH8VYPv3FC0ub4my52Rttsus/rFw+UUfzdb3tHMHXB66LqN+rR0ssIOZrH6K+VLN6qpTw9VizjyoH0BxA==} + engines: {node: '>=10'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@swc/core-linux-arm64-musl@1.4.2: + resolution: {integrity: sha512-3G0D5z9hUj9bXNcwmA1eGiFTwe5rWkuL3DsoviTj73TKLpk7u64ND0XjEfO0huVv4vVu9H1jodrKb7nvln/dlw==} + engines: {node: '>=10'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@swc/core-linux-x64-gnu@1.4.2: + resolution: {integrity: sha512-LFxn9U8cjmYHw3jrdPNqPAkBGglKE3tCZ8rA7hYyp0BFxuo7L2ZcEnPm4RFpmSCCsExFH+LEJWuMGgWERoktvg==} + engines: {node: '>=10'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@swc/core-linux-x64-musl@1.4.2: + resolution: {integrity: sha512-dp0fAmreeVVYTUcb4u9njTPrYzKnbIH0EhH2qvC9GOYNNREUu2GezSIDgonjOXkHiTCvopG4xU7y56XtXj4VrQ==} + engines: {node: '>=10'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@swc/core-win32-arm64-msvc@1.4.2: + resolution: {integrity: sha512-HlVIiLMQkzthAdqMslQhDkoXJ5+AOLUSTV6fm6shFKZKqc/9cJvr4S8UveNERL9zUficA36yM3bbfo36McwnvQ==} + engines: {node: '>=10'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@swc/core-win32-ia32-msvc@1.4.2: + resolution: {integrity: sha512-WCF8faPGjCl4oIgugkp+kL9nl3nUATlzKXCEGFowMEmVVCFM0GsqlmGdPp1pjZoWc9tpYanoXQDnp5IvlDSLhA==} + engines: {node: '>=10'} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@swc/core-win32-x64-msvc@1.4.2: + resolution: {integrity: sha512-oV71rwiSpA5xre2C5570BhCsg1HF97SNLsZ/12xv7zayGzqr3yvFALFJN8tHKpqUdCB4FGPjoP3JFdV3i+1wUw==} + engines: {node: '>=10'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@swc/core@1.4.2(@swc/helpers@0.5.6): + resolution: {integrity: sha512-vWgY07R/eqj1/a0vsRKLI9o9klGZfpLNOVEnrv4nrccxBgYPjcf22IWwAoaBJ+wpA7Q4fVjCUM8lP0m01dpxcg==} + engines: {node: '>=10'} + requiresBuild: true + peerDependencies: + '@swc/helpers': ^0.5.0 + peerDependenciesMeta: + '@swc/helpers': + optional: true + dependencies: + '@swc/counter': 0.1.3 + '@swc/helpers': 0.5.6 + '@swc/types': 0.1.5 + optionalDependencies: + '@swc/core-darwin-arm64': 1.4.2 + '@swc/core-darwin-x64': 1.4.2 + '@swc/core-linux-arm-gnueabihf': 1.4.2 + '@swc/core-linux-arm64-gnu': 1.4.2 + '@swc/core-linux-arm64-musl': 1.4.2 + '@swc/core-linux-x64-gnu': 1.4.2 + '@swc/core-linux-x64-musl': 1.4.2 + '@swc/core-win32-arm64-msvc': 1.4.2 + '@swc/core-win32-ia32-msvc': 1.4.2 + '@swc/core-win32-x64-msvc': 1.4.2 + dev: true + + /@swc/counter@0.1.3: + resolution: {integrity: sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==} + dev: true + /@swc/helpers@0.5.2: resolution: {integrity: sha512-E4KcWTpoLHqwPHLxidpOqQbcrZVgi0rsmmZXUle1jXmJfuIf/UWpczUJ7MZZ5tlxytgJXyp0w4PGkkeLiuIdZw==} dependencies: tslib: 2.5.0 + /@swc/helpers@0.5.6: + resolution: {integrity: sha512-aYX01Ke9hunpoCexYAgQucEpARGQ5w/cqHFrIR+e9gdKb1QWTsVJuTJ2ozQzIAxLyRQe/m+2RqzkyOOGiMKRQA==} + dependencies: + tslib: 2.6.2 + dev: true + + /@swc/types@0.1.5: + resolution: {integrity: sha512-myfUej5naTBWnqOCc/MdVOLVjXUXtIA+NpDrDBKJtLLg2shUjBu3cZmB/85RyitKc55+lUUyl7oRfLOvkr2hsw==} + dev: true + /@szmarczak/http-timer@4.0.6: resolution: {integrity: sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==} engines: {node: '>=10'} @@ -8749,6 +9090,10 @@ packages: /@types/estree@1.0.1: resolution: {integrity: sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==} + /@types/estree@1.0.5: + resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} + dev: true + /@types/glob@7.2.0: resolution: {integrity: sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==} dependencies: @@ -11274,6 +11619,37 @@ packages: semver: 7.5.4 dev: true + /bunchee@5.0.0-beta.1(typescript@5.2.2): + resolution: {integrity: sha512-7avhLZMcFMq0W+QtpoS+lHdwRYdfrSfpUAR/DWQBel1WPzT0Gq4dQ+vJHKS0tXIIjV4FzgcgM1QhsPHY5k4aYw==} + engines: {node: '>= 18.0.0'} + hasBin: true + peerDependencies: + typescript: ^4.1 || ^5.0 + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@rollup/plugin-commonjs': 25.0.7(rollup@4.12.0) + '@rollup/plugin-json': 6.1.0(rollup@4.12.0) + '@rollup/plugin-node-resolve': 15.2.3(rollup@4.12.0) + '@rollup/plugin-replace': 5.0.5(rollup@4.12.0) + '@rollup/plugin-wasm': 6.2.2(rollup@4.12.0) + '@rollup/pluginutils': 5.1.0(rollup@4.12.0) + '@swc/core': 1.4.2(@swc/helpers@0.5.6) + '@swc/helpers': 0.5.6 + arg: 5.0.2 + clean-css: 5.3.3 + magic-string: 0.30.8 + pretty-bytes: 5.6.0 + rimraf: 5.0.5 + rollup: 4.12.0 + rollup-plugin-dts: 6.1.0(rollup@4.12.0)(typescript@5.2.2) + rollup-plugin-swc3: 0.11.0(@swc/core@1.4.2)(rollup@4.12.0) + rollup-preserve-directives: 1.1.1(rollup@4.12.0) + tslib: 2.6.2 + typescript: 5.2.2 + dev: true + /bundle-name@3.0.0: resolution: {integrity: sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw==} engines: {node: '>=12'} @@ -11708,6 +12084,13 @@ packages: source-map: 0.6.1 dev: false + /clean-css@5.3.3: + resolution: {integrity: sha512-D5J+kHaVb/wKSFcyyV75uCn8fiY4sV38XJoe4CUyGQ+mOU/fMVYUdH1hJC+CJQ5uY3EnW27SbJYS4X8BiLrAFg==} + engines: {node: '>= 10.0'} + dependencies: + source-map: 0.6.1 + dev: true + /clean-regexp@1.0.0: resolution: {integrity: sha512-GfisEZEJvzKrmGWkvfhgzcz/BllN1USeqD2V6tg14OAOgaCD2Z/PUEuxnAZ/nPvmaHRG7a8y77p1T/IRQ4D1Hw==} engines: {node: '>=4'} @@ -15955,6 +16338,12 @@ packages: resolution: {integrity: sha512-MjhiaIWCJ1sAU4pIQ5i5OfOuHHxVo1oYeNsWTON7jxYkod8pHocXeh+SSbmu5OZZZK73B6cbJ2XADzXehLyovQ==} dev: true + /get-tsconfig@4.7.2: + resolution: {integrity: sha512-wuMsz4leaj5hbGgg4IvDU0bqJagpftG5l5cXIAvo8uZrqn0NJqwtfupTN00VnkQJPcIRrxYrm1Ue24btpCha2A==} + dependencies: + resolve-pkg-maps: 1.0.0 + dev: true + /get-uri@3.0.2: resolution: {integrity: sha512-+5s0SJbGoyiJTZZ2JTpFPLMPSch72KEqGOTvQsBqg0RBWvwhWUSYZFAtz3TPW0GXJuLBJPts1E241iHg+VRfhg==} engines: {node: '>= 6'} @@ -16060,6 +16449,18 @@ packages: resolution: {integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==} dev: true + /glob@10.3.10: + resolution: {integrity: sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==} + engines: {node: '>=16 || 14 >=14.17'} + hasBin: true + dependencies: + foreground-child: 3.1.1 + jackspeak: 2.3.6 + minimatch: 9.0.3 + minipass: 5.0.0 + path-scurry: 1.10.1 + dev: true + /glob@10.3.3: resolution: {integrity: sha512-92vPiMb/iqpmEgsOoIDvTjc50wf9CCCvMzsi6W0JLPeUKE8TWP1a73PgqSrqy7iAZxaSD1YdzU7QZR5LF51MJw==} engines: {node: '>=16 || 14 >=14.17'} @@ -17749,6 +18150,15 @@ packages: '@pkgjs/parseargs': 0.11.0 dev: true + /jackspeak@2.3.6: + resolution: {integrity: sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==} + engines: {node: '>=14'} + dependencies: + '@isaacs/cliui': 8.0.2 + optionalDependencies: + '@pkgjs/parseargs': 0.11.0 + dev: true + /jake@10.8.5: resolution: {integrity: sha512-sVpxYeuAhWt0OTWITwT98oyV0GsXyMlXCF+3L1SuafBVUIr/uILGRB+NqwkzhgXKvoJpDIpQvqkUALgdmQsQxw==} engines: {node: '>=10'} @@ -18992,15 +19402,15 @@ packages: sourcemap-codec: 1.4.8 dev: true - /magic-string@0.30.0: - resolution: {integrity: sha512-LA+31JYDJLs82r2ScLrlz1GjSgu66ZV518eyWT+S8VhyQn/JL0u9MeBOvQMGYiPk1DBiSN9DDMOcXvigJZaViQ==} + /magic-string@0.30.5: + resolution: {integrity: sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==} engines: {node: '>=12'} dependencies: '@jridgewell/sourcemap-codec': 1.4.15 dev: true - /magic-string@0.30.5: - resolution: {integrity: sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==} + /magic-string@0.30.8: + resolution: {integrity: sha512-ISQTe55T2ao7XtlAStud6qwYPZjE4GK1S/BeVPus4jrq6JuOnQ00YKQC581RWhR122W7msZV263KzVeLoqidyQ==} engines: {node: '>=12'} dependencies: '@jridgewell/sourcemap-codec': 1.4.15 @@ -23066,7 +23476,6 @@ packages: /pretty-bytes@5.6.0: resolution: {integrity: sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg==} engines: {node: '>=6'} - dev: false /pretty-error@2.1.2: resolution: {integrity: sha512-EY5oDzmsX5wvuynAByrmY0P0hcp+QpnAKbJng2A2MPjVKXCxrDSUkzghVJ4ZGPIv+JC4gX8fPUWscC0RtjsWGw==} @@ -24179,6 +24588,10 @@ packages: resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} engines: {node: '>=8'} + /resolve-pkg-maps@1.0.0: + resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} + dev: true + /resolve-url@0.2.1: resolution: {integrity: sha512-ZuF55hVUQaaczgOIwqWzkEcEidmlD/xl44x1UZnhOXcYuFN2S6+rcxpG+C1N3So0wvNI3DmJICUFfu2SxhBmvg==} deprecated: https://github.com/lydell/resolve-url#deprecated @@ -24304,6 +24717,14 @@ packages: glob: 9.3.5 dev: true + /rimraf@5.0.5: + resolution: {integrity: sha512-CqDakW+hMe/Bz202FPEymy68P+G50RfMQK+Qo5YUqc9SPipvbGjCGKd0RSKEelbsfQuw3g5NZDSrlZZAJurH1A==} + engines: {node: '>=14'} + hasBin: true + dependencies: + glob: 10.3.10 + dev: true + /ripemd160@2.0.2: resolution: {integrity: sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==} dependencies: @@ -24315,6 +24736,20 @@ packages: resolution: {integrity: sha512-IXgzBWvWQwE6PrDI05OvmXUIruQTcoMDzRsOd5CDvHCVLcLHMTSYvOK5Cm46kWqlV3yAbuSpBZdJ5oP5OUoStg==} dev: false + /rollup-plugin-dts@6.1.0(rollup@4.12.0)(typescript@5.2.2): + resolution: {integrity: sha512-ijSCPICkRMDKDLBK9torss07+8dl9UpY9z1N/zTeA1cIqdzMlpkV3MOOC7zukyvQfDyxa1s3Dl2+DeiP/G6DOw==} + engines: {node: '>=16'} + peerDependencies: + rollup: ^3.29.4 || ^4 + typescript: ^4.5 || ^5.0 + dependencies: + magic-string: 0.30.8 + rollup: 4.12.0 + typescript: 5.2.2 + optionalDependencies: + '@babel/code-frame': 7.23.5 + dev: true + /rollup-plugin-inject@3.0.2: resolution: {integrity: sha512-ptg9PQwzs3orn4jkgXJ74bfs5vYz1NCZlSQMBUA0wKcGp5i5pA1AO3fOUEte8enhGUC+iapTCzEWw2jEFFUO/w==} deprecated: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject. @@ -24330,13 +24765,19 @@ packages: rollup-plugin-inject: 3.0.2 dev: true - /rollup-plugin-preserve-directives@0.2.0(rollup@3.28.1): - resolution: {integrity: sha512-KUwbBaFvD1zFIDNnOkR+u64sSod3m0l6q46/SzTOa4GTQ6hp6w0FRr2u7x99YkY9qhlna5panmTmuLWeJ/2KWw==} + /rollup-plugin-swc3@0.11.0(@swc/core@1.4.2)(rollup@4.12.0): + resolution: {integrity: sha512-luB9Ngb1YieWPpJttKvkmjN3lG5l28SmASLbf2CoScUB2+EImU0bE8wX4EYKEqv5clVulhWRQHQvE+H33X/03g==} + engines: {node: '>=12'} peerDependencies: - rollup: 2.x || 3.x + '@swc/core': '>=1.2.165' + rollup: ^2.0.0 || ^3.0.0 || ^4.0.0 dependencies: - magic-string: 0.30.0 - rollup: 3.28.1 + '@fastify/deepmerge': 1.3.0 + '@rollup/pluginutils': 5.1.0(rollup@4.12.0) + '@swc/core': 1.4.2(@swc/helpers@0.5.6) + get-tsconfig: 4.7.2 + rollup: 4.12.0 + rollup-preserve-directives: 1.1.1(rollup@4.12.0) dev: true /rollup-pluginutils@2.8.2: @@ -24345,6 +24786,15 @@ packages: estree-walker: 0.6.1 dev: true + /rollup-preserve-directives@1.1.1(rollup@4.12.0): + resolution: {integrity: sha512-+eQafbuEfDPfxQ9hQPlwaROfin4yiVRxap8hnrvvvcSGoukv1tTiYpAW9mvm3uR8J+fe4xd8FdVd5rz9q7jZ+Q==} + peerDependencies: + rollup: ^2.0.0 || ^3.0.0 || ^4.0.0 + dependencies: + magic-string: 0.30.8 + rollup: 4.12.0 + dev: true + /rollup@3.28.1: resolution: {integrity: sha512-R9OMQmIHJm9znrU3m3cpE8uhN0fGdXiawME7aZIpQqvpS/85+Vt1Hq1/yVIcYfOmaQiHjvXkQAoJukvLpau6Yw==} engines: {node: '>=14.18.0', npm: '>=8.0.0'} @@ -24353,6 +24803,29 @@ packages: fsevents: 2.3.3 dev: true + /rollup@4.12.0: + resolution: {integrity: sha512-wz66wn4t1OHIJw3+XU7mJJQV/2NAfw5OAk6G6Hoo3zcvz/XOfQ52Vgi+AN4Uxoxi0KBBwk2g8zPrTDA4btSB/Q==} + engines: {node: '>=18.0.0', npm: '>=8.0.0'} + hasBin: true + dependencies: + '@types/estree': 1.0.5 + optionalDependencies: + '@rollup/rollup-android-arm-eabi': 4.12.0 + '@rollup/rollup-android-arm64': 4.12.0 + '@rollup/rollup-darwin-arm64': 4.12.0 + '@rollup/rollup-darwin-x64': 4.12.0 + '@rollup/rollup-linux-arm-gnueabihf': 4.12.0 + '@rollup/rollup-linux-arm64-gnu': 4.12.0 + '@rollup/rollup-linux-arm64-musl': 4.12.0 + '@rollup/rollup-linux-riscv64-gnu': 4.12.0 + '@rollup/rollup-linux-x64-gnu': 4.12.0 + '@rollup/rollup-linux-x64-musl': 4.12.0 + '@rollup/rollup-win32-arm64-msvc': 4.12.0 + '@rollup/rollup-win32-ia32-msvc': 4.12.0 + '@rollup/rollup-win32-x64-msvc': 4.12.0 + fsevents: 2.3.3 + dev: true + /rollup@4.6.1: resolution: {integrity: sha512-jZHaZotEHQaHLgKr8JnQiDT1rmatjgKlMekyksz+yk9jt/8z9quNjnKNRoaM0wd9DC2QKXjmWWuDYtM3jfF8pQ==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} @@ -25898,7 +26371,7 @@ packages: - bluebird dev: false - /terser-webpack-plugin@5.3.9(esbuild@0.18.20)(webpack@5.88.1): + /terser-webpack-plugin@5.3.9(@swc/core@1.4.2)(esbuild@0.18.20)(webpack@5.88.1): resolution: {integrity: sha512-ZuXsqE07EcggTWQjXUj+Aot/OMcD0bMKGgF63f7UxYcu5/AJF53aIpK1YoP5xR9l6s/Hy2b+t1AM0bLNPRuhwA==} engines: {node: '>= 10.13.0'} peerDependencies: @@ -25915,12 +26388,13 @@ packages: optional: true dependencies: '@jridgewell/trace-mapping': 0.3.18 + '@swc/core': 1.4.2(@swc/helpers@0.5.6) esbuild: 0.18.20 jest-worker: 27.5.1 schema-utils: 3.3.0 serialize-javascript: 6.0.1 terser: 5.18.2 - webpack: 5.88.1(esbuild@0.18.20) + webpack: 5.88.1(@swc/core@1.4.2)(esbuild@0.18.20) dev: true /terser@4.8.1: @@ -26227,6 +26701,10 @@ packages: /tslib@2.5.0: resolution: {integrity: sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==} + /tslib@2.6.2: + resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} + dev: true + /tsup@7.2.0: resolution: {integrity: sha512-vDHlczXbgUvY3rWvqFEbSqmC1L7woozbzngMqTtL2PGBODTtWlRwGDDawhvWzr5c1QjKe4OAKqJGfE1xeXUvtQ==} engines: {node: '>=16.14'} @@ -27545,7 +28023,7 @@ packages: - supports-color dev: false - /webpack@5.88.1(esbuild@0.18.20): + /webpack@5.88.1(@swc/core@1.4.2)(esbuild@0.18.20): resolution: {integrity: sha512-FROX3TxQnC/ox4N+3xQoWZzvGXSuscxR32rbzjpXgEzWudJFEJBpdlkkob2ylrv5yzzufD1zph1OoFsLtm6stQ==} engines: {node: '>=10.13.0'} hasBin: true @@ -27576,7 +28054,7 @@ packages: neo-async: 2.6.2 schema-utils: 3.3.0 tapable: 2.2.1 - terser-webpack-plugin: 5.3.9(esbuild@0.18.20)(webpack@5.88.1) + terser-webpack-plugin: 5.3.9(@swc/core@1.4.2)(esbuild@0.18.20)(webpack@5.88.1) watchpack: 2.4.0 webpack-sources: 3.2.3 transitivePeerDependencies: diff --git a/scripts/getBuildConfig.js b/scripts/getBuildConfig.js index ae809ff7f..ec23c9d57 100644 --- a/scripts/getBuildConfig.js +++ b/scripts/getBuildConfig.js @@ -44,13 +44,16 @@ module.exports = function getConfig({ plugins = [], ...rest }) { + const format = output?.format || 'cjs'; + /** @type import('rollup').RollupOptions */ const config = { input, external: [/node_modules/, ...external], output: { dir: outDir + env, - format: 'cjs', + format, + entryFileNames: '[name]' + (format === 'es' ? '.mjs' : '.js'), interop: 'auto', freeze: false, esModule: true,