From 5c19951c59047cc30c5c85cbc9333d0d29aa92e2 Mon Sep 17 00:00:00 2001 From: Long Ho Date: Mon, 18 Nov 2024 00:36:00 -0500 Subject: [PATCH 01/17] docs: create website.yml --- .github/workflows/website.yml | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/website.yml diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml new file mode 100644 index 00000000000..52c3c0fe7a5 --- /dev/null +++ b/.github/workflows/website.yml @@ -0,0 +1,38 @@ +name: Deploy Docusaurus to Organization GitHub Pages + +on: + push: + branches: + - main # The branch where updates are made in the source repo + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + # Checkout the repository + - name: Checkout Repository + uses: actions/checkout@v3 + + # Set up Node.js + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: 20 # Specify the Node.js version compatible with your Docusaurus site + + # Install dependencies + - name: Install Dependencies + run: bazel run -- @pnpm//:pnpm --dir $PWD install + + # Build the Docusaurus site + - name: Build Docusaurus Site + run: cd website; pnpm docusaurus build + + # Deploy to Organization GitHub Pages Repository + - name: Deploy + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + external_repository: formatjs/formatjs.github.io + publish_branch: main # default: gh-pages + publish_dir: ./website/build From 7dcd1ab617d35cd33ebee51335598f2d96223fa5 Mon Sep 17 00:00:00 2001 From: Long Ho Date: Mon, 18 Nov 2024 00:38:11 -0500 Subject: [PATCH 02/17] docs: Update website.yml --- .github/workflows/website.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 52c3c0fe7a5..9fba7e2a1fe 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -26,7 +26,7 @@ jobs: # Build the Docusaurus site - name: Build Docusaurus Site - run: cd website; pnpm docusaurus build + run: cd website; bazel run -- @pnpm//:pnpm --dir $PWD docusaurus build # Deploy to Organization GitHub Pages Repository - name: Deploy From 8ee5dfc5046493f59f70b5e29145df7e83ec6a38 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 05:39:08 +0000 Subject: [PATCH 03/17] chore(deps): update actions/setup-node action to v4 (#4711) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/setup-node](https://redirect.github.com/actions/setup-node) | action | major | `v3` -> `v4` | --- ### Release Notes
actions/setup-node (actions/setup-node) ### [`v4`](https://redirect.github.com/actions/setup-node/compare/v3...v4) [Compare Source](https://redirect.github.com/actions/setup-node/compare/v3...v4)
--- ### Configuration πŸ“… **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. β™» **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. πŸ”• **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/formatjs/formatjs). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/website.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 9fba7e2a1fe..e2c58df2e78 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -16,7 +16,7 @@ jobs: # Set up Node.js - name: Set up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 20 # Specify the Node.js version compatible with your Docusaurus site From d0bf84406023788b14371dc628c00d4752cc3286 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 05:39:14 +0000 Subject: [PATCH 04/17] chore(deps): update actions/checkout action to v4 (#4710) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/checkout](https://redirect.github.com/actions/checkout) | action | major | `v3` -> `v4` | --- ### Release Notes
actions/checkout (actions/checkout) ### [`v4`](https://redirect.github.com/actions/checkout/blob/HEAD/CHANGELOG.md#v421) [Compare Source](https://redirect.github.com/actions/checkout/compare/v3...v4) - Check out other refs/\* by commit if provided, fall back to ref by [@​orhantoy](https://redirect.github.com/orhantoy) in [https://github.com/actions/checkout/pull/1924](https://redirect.github.com/actions/checkout/pull/1924)
--- ### Configuration πŸ“… **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. β™» **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. πŸ”• **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/formatjs/formatjs). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/website.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index e2c58df2e78..f8909bf8386 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -12,7 +12,7 @@ jobs: steps: # Checkout the repository - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Set up Node.js - name: Set up Node.js From 78a9c6a1bdac010d3ec9c62402abdbe5df47e2a2 Mon Sep 17 00:00:00 2001 From: longlho Date: Mon, 18 Nov 2024 00:41:52 -0500 Subject: [PATCH 05/17] docs: add build script for website --- .github/workflows/website.yml | 8 ++++---- website/package.json | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index f8909bf8386..dc8b8a5bb7f 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -3,7 +3,7 @@ name: Deploy Docusaurus to Organization GitHub Pages on: push: branches: - - main # The branch where updates are made in the source repo + - main # The branch where updates are made in the source repo jobs: deploy: @@ -18,7 +18,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v4 with: - node-version: 20 # Specify the Node.js version compatible with your Docusaurus site + node-version: 20 # Specify the Node.js version compatible with your Docusaurus site # Install dependencies - name: Install Dependencies @@ -26,7 +26,7 @@ jobs: # Build the Docusaurus site - name: Build Docusaurus Site - run: cd website; bazel run -- @pnpm//:pnpm --dir $PWD docusaurus build + run: cd website; bazel run -- @pnpm//:pnpm --dir $PWD run build # Deploy to Organization GitHub Pages Repository - name: Deploy @@ -34,5 +34,5 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} external_repository: formatjs/formatjs.github.io - publish_branch: main # default: gh-pages + publish_branch: main # default: gh-pages publish_dir: ./website/build diff --git a/website/package.json b/website/package.json index 4342a4d6cca..cbeaedc894d 100644 --- a/website/package.json +++ b/website/package.json @@ -14,6 +14,9 @@ "last 1 safari version" ] }, + "scripts": { + "build": "docusaurus build" + }, "devDependencies": { "@docusaurus/core": "3.6.1", "@docusaurus/plugin-google-analytics": "3.6.1", From 8cd15d3139c5c43e342f00a8abaae9b81f2ce554 Mon Sep 17 00:00:00 2001 From: Long Ho Date: Mon, 18 Nov 2024 00:47:37 -0500 Subject: [PATCH 06/17] docs: Update website.yml --- .github/workflows/website.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index dc8b8a5bb7f..ff8cec8fb47 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -32,7 +32,7 @@ jobs: - name: Deploy uses: peaceiris/actions-gh-pages@v4 with: - github_token: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.WEBSITE_SECRET_KEY }} external_repository: formatjs/formatjs.github.io publish_branch: main # default: gh-pages publish_dir: ./website/build From 189ffc67cc286e6e927f4165f455d301c434dec9 Mon Sep 17 00:00:00 2001 From: longlho Date: Mon, 18 Nov 2024 00:50:55 -0500 Subject: [PATCH 07/17] docs: fix workflow --- .github/workflows/website.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index ff8cec8fb47..471ac8e3734 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -32,7 +32,7 @@ jobs: - name: Deploy uses: peaceiris/actions-gh-pages@v4 with: - github_token: ${{ secrets.WEBSITE_SECRET_KEY }} + deploy_key: ${{ secrets.WEBSITE_SECRET_KEY }} external_repository: formatjs/formatjs.github.io publish_branch: main # default: gh-pages publish_dir: ./website/build From 15518959b24b17b7a5698899cb60ffd89d76f892 Mon Sep 17 00:00:00 2001 From: longlho Date: Mon, 18 Nov 2024 00:51:41 -0500 Subject: [PATCH 08/17] docs: fix workflow --- .github/workflows/website.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 471ac8e3734..523724925aa 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -22,7 +22,7 @@ jobs: # Install dependencies - name: Install Dependencies - run: bazel run -- @pnpm//:pnpm --dir $PWD install + run: bazel run -- @pnpm//:pnpm --dir $PWD install --frozen-lockfile # Build the Docusaurus site - name: Build Docusaurus Site From 282d322edbf8abd4d08913c5cf0695f421e75ffb Mon Sep 17 00:00:00 2001 From: longlho Date: Mon, 18 Nov 2024 00:52:17 -0500 Subject: [PATCH 09/17] docs: fix workflow --- .github/workflows/website.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 523724925aa..863a54907eb 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -22,7 +22,7 @@ jobs: # Install dependencies - name: Install Dependencies - run: bazel run -- @pnpm//:pnpm --dir $PWD install --frozen-lockfile + run: bazel run --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_ORG_API_KEY }} -- @pnpm//:pnpm --dir $PWD install --frozen-lockfile # Build the Docusaurus site - name: Build Docusaurus Site From c9fbb68595daa9ed7281632439a479c9aac84f00 Mon Sep 17 00:00:00 2001 From: longlho Date: Mon, 18 Nov 2024 00:54:33 -0500 Subject: [PATCH 10/17] docs: fix URL --- CONTRIBUTING.md | 2 +- README.md | 2 +- packages/babel-plugin-formatjs/README.md | 2 +- packages/cli-lib/README.md | 2 +- packages/cli/README.md | 2 +- .../compile/__snapshots__/integration.test.ts.snap | 6 +++--- .../cli/integration-tests/compile/lang/html-messages.json | 2 +- .../compile_folder/__snapshots__/integration.test.ts.snap | 2 +- packages/editor/README.md | 2 +- packages/intl-datetimeformat/README.md | 2 +- packages/intl-displaynames/README.md | 2 +- packages/intl-durationformat/README.md | 2 +- packages/intl-getcanonicallocales/README.md | 2 +- packages/intl-listformat/README.md | 2 +- packages/intl-locale/README.md | 2 +- packages/intl-localematcher/README.md | 2 +- packages/intl-messageformat/README.md | 2 +- packages/intl-numberformat/README.md | 2 +- packages/intl-pluralrules/README.md | 2 +- packages/intl-relativetimeformat/README.md | 2 +- packages/intl-segmenter/README.md | 2 +- packages/intl/README.md | 2 +- packages/intl/package.json | 2 +- packages/react-intl/README.md | 2 +- packages/react-intl/package.json | 2 +- packages/ts-transformer/README.md | 2 +- packages/vue-intl/README.md | 2 +- packages/vue-intl/package.json | 2 +- website/docs/getting-started/message-extraction.md | 4 ++-- website/docs/tooling/linter.md | 4 ++-- website/static/CNAME | 1 - 31 files changed, 34 insertions(+), 35 deletions(-) delete mode 100644 website/static/CNAME diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bb6a33f8c47..82a9501bec4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -114,7 +114,7 @@ bazel run //packages/cli/integration-tests:compile_folder_integration_test_updat bazel run //packages/icu-messageformat-parser:regex ``` -### Working on `formatjs.io` website +### Working on `formatjs.github.io` website We use [docusaurus](https://docusaurus.io/) for documentation. To run the website locally: diff --git a/README.md b/README.md index 121136760f3..055d71ae906 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Slack FormatJS](https://img.shields.io/badge/slack-@formatjs-green.svg?logo=slack)](https://join.slack.com/t/formatjs/shared_invite/enQtNjM2MjM4NjE4ODIxLTMyMWE0YTNhMTlmMzZlNzJlNjEzMWY0YjM2ODUxYjlmNDE2YzQyMDIxZDg3Y2Q5YWNlMzhhYzRiNDk0OGQwNGI) [![Sauce Browser Matrix Status](https://app.saucelabs.com/browser-matrix/formatjsproject.svg)](https://app.saucelabs.com/u/formatjsproject) -This repository is the home of [FormatJS](http://formatjs.io/) and related libraries. +This repository is the home of [FormatJS](http://formatjs.github.io/) and related libraries. **Slack:** Join us on Slack at [formatjs.slack.com](https://formatjs.slack.com/) for help, general conversation and more πŸ’¬πŸŽŠπŸŽ‰ You can sign-up using this [invitation link](https://join.slack.com/t/formatjs/shared_invite/enQtNjYwMzE4NjM1MDQzLTA5NDE1Y2Y1ZWNiZWI1YTU5MGUxY2M0YjA4NWNhMmU3YTRjZmQ3MTE3NzJmOTAxMWRmYWE1ZTdkMmYzNzA5Y2M). diff --git a/packages/babel-plugin-formatjs/README.md b/packages/babel-plugin-formatjs/README.md index 59fc0bff214..68c86c3839a 100644 --- a/packages/babel-plugin-formatjs/README.md +++ b/packages/babel-plugin-formatjs/README.md @@ -1,3 +1,3 @@ # babel-plugin-formatjs -We've migrated the docs to https://formatjs.io/docs/tooling/babel-plugin/. +We've migrated the docs to https://formatjs.github.io/docs/tooling/babel-plugin/. diff --git a/packages/cli-lib/README.md b/packages/cli-lib/README.md index 67a9144d241..1d6cf25b5ef 100644 --- a/packages/cli-lib/README.md +++ b/packages/cli-lib/README.md @@ -1,3 +1,3 @@ # @formatjs/cli -We've migrated the docs to https://formatjs.io/docs/tooling/cli. +We've migrated the docs to https://formatjs.github.io/docs/tooling/cli. diff --git a/packages/cli/README.md b/packages/cli/README.md index 67a9144d241..1d6cf25b5ef 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -1,3 +1,3 @@ # @formatjs/cli -We've migrated the docs to https://formatjs.io/docs/tooling/cli. +We've migrated the docs to https://formatjs.github.io/docs/tooling/cli. diff --git a/packages/cli/integration-tests/compile/__snapshots__/integration.test.ts.snap b/packages/cli/integration-tests/compile/__snapshots__/integration.test.ts.snap index 883f24d326d..6df3dd13985 100644 --- a/packages/cli/integration-tests/compile/__snapshots__/integration.test.ts.snap +++ b/packages/cli/integration-tests/compile/__snapshots__/integration.test.ts.snap @@ -168,13 +168,13 @@ Options: not provided, result will be printed to stdout --ast Whether to compile to AST. See - https://formatjs.io/docs/guides/advanced-usage#pre-parsing-messages + https://formatjs.github.io/docs/guides/advanced-usage#pre-parsing-messages for more information --skip-errors Whether to continue compiling messages after encountering an error. Any keys with errors will not be included in the output file. --pseudo-locale Whether to generate pseudo-locale files. See - https://formatjs.io/docs/tooling/cli#--pseudo-locale-pseudolocale + https://formatjs.github.io/docs/tooling/cli#--pseudo-locale-pseudolocale for possible values. "--ast" is required for this to work. --ignore-tag Whether the parser to treat HTML/XML tags as @@ -791,7 +791,7 @@ exports[`out-file --ignore-tag 1`] = ` exports[`out-file --ignore-tag 2`] = ` { "brmsg": "a message with a non-explicit
self-closing tag", - "linkmsg": "a message containing a link", + "linkmsg": "a message containing a link", } `; diff --git a/packages/cli/integration-tests/compile/lang/html-messages.json b/packages/cli/integration-tests/compile/lang/html-messages.json index 2fc1720f237..457606c35af 100644 --- a/packages/cli/integration-tests/compile/lang/html-messages.json +++ b/packages/cli/integration-tests/compile/lang/html-messages.json @@ -3,6 +3,6 @@ "defaultMessage": "a message with a non-explicit
self-closing tag" }, "linkmsg": { - "defaultMessage": "a message containing a link" + "defaultMessage": "a message containing a link" } } diff --git a/packages/cli/integration-tests/compile_folder/__snapshots__/integration.test.ts.snap b/packages/cli/integration-tests/compile_folder/__snapshots__/integration.test.ts.snap index e6a1319b435..b73b1eda836 100644 --- a/packages/cli/integration-tests/compile_folder/__snapshots__/integration.test.ts.snap +++ b/packages/cli/integration-tests/compile_folder/__snapshots__/integration.test.ts.snap @@ -35,7 +35,7 @@ Options: This is especially useful to convert from a TMS-specific format back to react-intl format --ast Whether to compile to AST. See - https://formatjs.io/docs/guides/advanced-usage#pre-parsing-messages + https://formatjs.github.io/docs/guides/advanced-usage#pre-parsing-messages for more information -h, --help display help for command ", diff --git a/packages/editor/README.md b/packages/editor/README.md index 9f39b48db12..110cdb45af0 100644 --- a/packages/editor/README.md +++ b/packages/editor/README.md @@ -1,3 +1,3 @@ # @formatjs/editor [WIP] -We've migrated the docs to https://formatjs.io/docs/tooling/editor. +We've migrated the docs to https://formatjs.github.io/docs/tooling/editor. diff --git a/packages/intl-datetimeformat/README.md b/packages/intl-datetimeformat/README.md index a57fb3318e8..4372219ee81 100644 --- a/packages/intl-datetimeformat/README.md +++ b/packages/intl-datetimeformat/README.md @@ -1,3 +1,3 @@ # `intl-datetimeformat` -We've migrated the docs to https://formatjs.io/docs/polyfills/intl-datetimeformat +We've migrated the docs to https://formatjs.github.io/docs/polyfills/intl-datetimeformat diff --git a/packages/intl-displaynames/README.md b/packages/intl-displaynames/README.md index 2ae9287f461..01ed311015e 100644 --- a/packages/intl-displaynames/README.md +++ b/packages/intl-displaynames/README.md @@ -1,3 +1,3 @@ # `intl-displaynames` -We've migrated the docs to https://formatjs.io/docs/polyfills/intl-displaynames. +We've migrated the docs to https://formatjs.github.io/docs/polyfills/intl-displaynames. diff --git a/packages/intl-durationformat/README.md b/packages/intl-durationformat/README.md index 0a9d1cc1ad3..eec5eb38d05 100644 --- a/packages/intl-durationformat/README.md +++ b/packages/intl-durationformat/README.md @@ -1,3 +1,3 @@ # Intl DurationFormat -We've migrated the docs to https://formatjs.io/docs/polyfills/intl-durationformat. +We've migrated the docs to https://formatjs.github.io/docs/polyfills/intl-durationformat. diff --git a/packages/intl-getcanonicallocales/README.md b/packages/intl-getcanonicallocales/README.md index 88a31dbd967..ef34fc712fd 100644 --- a/packages/intl-getcanonicallocales/README.md +++ b/packages/intl-getcanonicallocales/README.md @@ -1,3 +1,3 @@ # Intl.getCanonicalLocales -We've migrated the docs to https://formatjs.io/docs/polyfills/intl-getcanonicallocales/. +We've migrated the docs to https://formatjs.github.io/docs/polyfills/intl-getcanonicallocales/. diff --git a/packages/intl-listformat/README.md b/packages/intl-listformat/README.md index dea1ee08c73..35179b94b2b 100644 --- a/packages/intl-listformat/README.md +++ b/packages/intl-listformat/README.md @@ -1,3 +1,3 @@ # Intl ListFormat -We've migrated the docs to https://formatjs.io/docs/polyfills/intl-listformat. +We've migrated the docs to https://formatjs.github.io/docs/polyfills/intl-listformat. diff --git a/packages/intl-locale/README.md b/packages/intl-locale/README.md index 26c1c42d418..7e5ee1ef194 100644 --- a/packages/intl-locale/README.md +++ b/packages/intl-locale/README.md @@ -1,3 +1,3 @@ # Intl Locale -We've migrated the docs to https://formatjs.io/docs/polyfills/intl-locale. +We've migrated the docs to https://formatjs.github.io/docs/polyfills/intl-locale. diff --git a/packages/intl-localematcher/README.md b/packages/intl-localematcher/README.md index f7c9b7e9a10..970dcc80eb8 100644 --- a/packages/intl-localematcher/README.md +++ b/packages/intl-localematcher/README.md @@ -1,3 +1,3 @@ # Intl LocaleMatcher -We've migrated the docs to https://formatjs.io/docs/polyfills/intl-localematcher. +We've migrated the docs to https://formatjs.github.io/docs/polyfills/intl-localematcher. diff --git a/packages/intl-messageformat/README.md b/packages/intl-messageformat/README.md index 8ae77f8b301..59b67ea84bf 100644 --- a/packages/intl-messageformat/README.md +++ b/packages/intl-messageformat/README.md @@ -1,3 +1,3 @@ # Intl MessageFormat -We've migrated the docs to https://formatjs.io/docs/intl-messageformat. +We've migrated the docs to https://formatjs.github.io/docs/intl-messageformat. diff --git a/packages/intl-numberformat/README.md b/packages/intl-numberformat/README.md index 9bbc1afbf6b..4a63e9f3498 100644 --- a/packages/intl-numberformat/README.md +++ b/packages/intl-numberformat/README.md @@ -1,3 +1,3 @@ # `intl-numberformat` -We've migrated the docs to https://formatjs.io/docs/polyfills/intl-numberformat. +We've migrated the docs to https://formatjs.github.io/docs/polyfills/intl-numberformat. diff --git a/packages/intl-pluralrules/README.md b/packages/intl-pluralrules/README.md index 502a113b996..abf613edb78 100644 --- a/packages/intl-pluralrules/README.md +++ b/packages/intl-pluralrules/README.md @@ -1,3 +1,3 @@ # `intl-pluralrules` -We've migrated the docs to https://formatjs.io/docs/polyfills/intl-pluralrules. +We've migrated the docs to https://formatjs.github.io/docs/polyfills/intl-pluralrules. diff --git a/packages/intl-relativetimeformat/README.md b/packages/intl-relativetimeformat/README.md index bdbadbcd68b..c15e1064eb9 100644 --- a/packages/intl-relativetimeformat/README.md +++ b/packages/intl-relativetimeformat/README.md @@ -1,3 +1,3 @@ # Intl RelativeTimeFormat -We've migrated the docs to https://formatjs.io/docs/polyfills/intl-relativetimeformat. +We've migrated the docs to https://formatjs.github.io/docs/polyfills/intl-relativetimeformat. diff --git a/packages/intl-segmenter/README.md b/packages/intl-segmenter/README.md index aca9b66bd05..8d4e39a7904 100644 --- a/packages/intl-segmenter/README.md +++ b/packages/intl-segmenter/README.md @@ -1,3 +1,3 @@ # `intl-segmenter` -We've migrated the docs to https://formatjs.io/docs/polyfills/intl-segmenter. +We've migrated the docs to https://formatjs.github.io/docs/polyfills/intl-segmenter. diff --git a/packages/intl/README.md b/packages/intl/README.md index 72e556ad6d8..b35f247e57d 100644 --- a/packages/intl/README.md +++ b/packages/intl/README.md @@ -1,3 +1,3 @@ # @formatjs/intl -We've migrated the docs to https://formatjs.io/docs/intl. +We've migrated the docs to https://formatjs.github.io/docs/intl. diff --git a/packages/intl/package.json b/packages/intl/package.json index c2bbe55c383..a3394f938f5 100644 --- a/packages/intl/package.json +++ b/packages/intl/package.json @@ -17,7 +17,7 @@ ], "author": "Long Ho ", "license": "MIT", - "homepage": "https://formatjs.io", + "homepage": "https://formatjs.github.io", "bugs": { "url": "https://github.com/formatjs/formatjs/issues" }, diff --git a/packages/react-intl/README.md b/packages/react-intl/README.md index 1d70e040fe7..5d0161716c5 100644 --- a/packages/react-intl/README.md +++ b/packages/react-intl/README.md @@ -1,3 +1,3 @@ # React Intl -We've migrated the docs to https://formatjs.io/docs/getting-started/installation. +We've migrated the docs to https://formatjs.github.io/docs/getting-started/installation. diff --git a/packages/react-intl/package.json b/packages/react-intl/package.json index 52c072c1a64..8f928dd4ddb 100644 --- a/packages/react-intl/package.json +++ b/packages/react-intl/package.json @@ -115,7 +115,7 @@ "zouxuoz " ], "license": "BSD-3-Clause", - "homepage": "https://formatjs.io/docs/react-intl", + "homepage": "https://formatjs.github.io/docs/react-intl", "bugs": { "url": "https://github.com/formatjs/formatjs/issues" }, diff --git a/packages/ts-transformer/README.md b/packages/ts-transformer/README.md index d2eee886502..838d5795949 100644 --- a/packages/ts-transformer/README.md +++ b/packages/ts-transformer/README.md @@ -1,3 +1,3 @@ # @formatjs/ts-transformer -We've migrated the docs to https://formatjs.io/docs/tooling/ts-transformer. +We've migrated the docs to https://formatjs.github.io/docs/tooling/ts-transformer. diff --git a/packages/vue-intl/README.md b/packages/vue-intl/README.md index a49dcb4087e..60b1f744cfd 100644 --- a/packages/vue-intl/README.md +++ b/packages/vue-intl/README.md @@ -1,3 +1,3 @@ # vue-intl -We've migrated the docs to https://formatjs.io/docs/vue-intl. +We've migrated the docs to https://formatjs.github.io/docs/vue-intl. diff --git a/packages/vue-intl/package.json b/packages/vue-intl/package.json index bd574915507..c2b7a29b803 100644 --- a/packages/vue-intl/package.json +++ b/packages/vue-intl/package.json @@ -7,7 +7,7 @@ "type": "git", "url": "git+https://github.com/formatjs/formatjs.git" }, - "homepage": "https://formatjs.io/docs/vue-intl", + "homepage": "https://formatjs.github.io/docs/vue-intl", "keywords": [ "vue", "intl", diff --git a/website/docs/getting-started/message-extraction.md b/website/docs/getting-started/message-extraction.md index cc2c5400077..02df904567d 100644 --- a/website/docs/getting-started/message-extraction.md +++ b/website/docs/getting-started/message-extraction.md @@ -71,7 +71,7 @@ yarn extract 'src/**/*.ts*' --ignore='**/*.d.ts' --out-file lang/en.json --id-in :::caution ID Interpolation Pattern -Make sure this pattern matches `idInterpolationPattern` when you use `babel-plugin-formatjs` or `@formatjs/ts-transformer` in [Bundling with formatjs](https://formatjs.io/docs/guides/bundler-plugins) or you'll get a `MISSING_TRANSLATION` error. +Make sure this pattern matches `idInterpolationPattern` when you use `babel-plugin-formatjs` or `@formatjs/ts-transformer` in [Bundling with formatjs](https://formatjs.github.io/docs/guides/bundler-plugins) or you'll get a `MISSING_TRANSLATION` error. ::: Given a file that has the following messages: @@ -237,7 +237,7 @@ During extraction, we'll preserve explicit declared IDs and insert a hash as an ## Automatic ID Generation -Since manual IDs are discouraged, we've provided a `babel` plugin and a `TypeScript` AST transformer that will automatically insert message IDs in your transpiled code. For more details please visit [Bundling with formatjs](https://formatjs.io/docs/guides/bundler-plugins). +Since manual IDs are discouraged, we've provided a `babel` plugin and a `TypeScript` AST transformer that will automatically insert message IDs in your transpiled code. For more details please visit [Bundling with formatjs](https://formatjs.github.io/docs/guides/bundler-plugins). ## Translation Management System (TMS) Integration diff --git a/website/docs/tooling/linter.md b/website/docs/tooling/linter.md index 90997e98f32..2f8e72a0d2c 100644 --- a/website/docs/tooling/linter.md +++ b/website/docs/tooling/linter.md @@ -416,7 +416,7 @@ Messages that look like `{thing, plural, one {1 thing} other {# things}}` will n #### Why -- one is a category for any number that behaves like 1. So in some languages, for example Ukrainian, Russian and Polish, one β†’ numbers that end in 1 (like 1, 21, 151) but that don’t end in 11 (like 11, 111, 10311). [More info](https://formatjs.io/docs/core-concepts/icu-syntax/#plural-format) +- one is a category for any number that behaves like 1. So in some languages, for example Ukrainian, Russian and Polish, one β†’ numbers that end in 1 (like 1, 21, 151) but that don’t end in 11 (like 11, 111, 10311). [More info](https://formatjs.github.io/docs/core-concepts/icu-syntax/#plural-format) ### `no-emoji` @@ -731,7 +731,7 @@ This bans explicit ID in `MessageDescriptor`. #### Why -We generally encourage automatic ID generation due to [these reasons](https://formatjs.io/docs/getting-started/message-declaration). This makes sure no explicit IDs are set. +We generally encourage automatic ID generation due to [these reasons](https://formatjs.github.io/docs/getting-started/message-declaration). This makes sure no explicit IDs are set. ### `no-complex-selectors` diff --git a/website/static/CNAME b/website/static/CNAME deleted file mode 100644 index 1556cbaea44..00000000000 --- a/website/static/CNAME +++ /dev/null @@ -1 +0,0 @@ -formatjs.io From 4713e1b240a52f7e357dcc77912c33e8bef9bfa4 Mon Sep 17 00:00:00 2001 From: longlho Date: Mon, 18 Nov 2024 01:24:37 -0500 Subject: [PATCH 11/17] feat(@formatjs/intl): remove polyfill packages in deps BREAKING CHANGE: This removes @formatjs/intl-displaynames & @formatjs/intl-listformat as deps which will reduce package size. However, this also means you'll need typescript@5 at least since that has new type defs for those native Intl APIs. --- packages/intl/BUILD | 4 --- packages/intl/package.json | 6 ---- packages/intl/src/create-intl.ts | 28 +++++++++--------- packages/intl/src/displayName.ts | 13 ++++----- packages/intl/src/list.ts | 26 ++++++++--------- packages/intl/src/message.ts | 16 +++++----- packages/intl/src/types.ts | 29 ++++++++++--------- .../intl/tests/formatDisplayNames.test.ts | 5 +--- packages/intl/tests/formatMessage.test.ts | 5 +--- packages/intl/tests/formatNumber.test.ts | 3 -- packages/intl/tests/formatTime.test.ts | 5 +--- packages/intl/tests/global.d.ts | 7 ----- 12 files changed, 57 insertions(+), 90 deletions(-) delete mode 100644 packages/intl/tests/global.d.ts diff --git a/packages/intl/BUILD b/packages/intl/BUILD index 1be8e4d55a1..20a75cb03a9 100644 --- a/packages/intl/BUILD +++ b/packages/intl/BUILD @@ -30,8 +30,6 @@ SRC_DEPS = [ ":node_modules/@formatjs/ecma402-abstract", ":node_modules/@formatjs/fast-memoize", ":node_modules/@formatjs/icu-messageformat-parser", - ":node_modules/@formatjs/intl-displaynames", - ":node_modules/@formatjs/intl-listformat", ":node_modules/intl-messageformat", ] @@ -50,8 +48,6 @@ ts_compile( jest_test( name = "unit_test", data = [":srcs"] + TESTS + SRC_DEPS + [ - ":node_modules/@formatjs/intl-datetimeformat", - ":node_modules/@formatjs/intl-numberformat", "//:node_modules/@types/node", ], ) diff --git a/packages/intl/package.json b/packages/intl/package.json index a3394f938f5..b0d2f4a097e 100644 --- a/packages/intl/package.json +++ b/packages/intl/package.json @@ -32,15 +32,9 @@ "@formatjs/ecma402-abstract": "workspace:*", "@formatjs/fast-memoize": "workspace:*", "@formatjs/icu-messageformat-parser": "workspace:*", - "@formatjs/intl-displaynames": "workspace:*", - "@formatjs/intl-listformat": "workspace:*", "intl-messageformat": "workspace:*", "tslib": "2" }, - "devDependencies": { - "@formatjs/intl-datetimeformat": "workspace:*", - "@formatjs/intl-numberformat": "workspace:*" - }, "peerDependencies": { "typescript": "^4.7 || 5" }, diff --git a/packages/intl/src/create-intl.ts b/packages/intl/src/create-intl.ts index fc95820106f..528d78c5e9e 100644 --- a/packages/intl/src/create-intl.ts +++ b/packages/intl/src/create-intl.ts @@ -1,20 +1,20 @@ -import {IntlCache, IntlShape, IntlConfig, ResolvedIntlConfig} from './types' -import {createFormatters, DEFAULT_INTL_CONFIG} from './utils' -import {InvalidConfigError, MissingDataError} from './error' -import {formatNumber, formatNumberToParts} from './number' -import {formatRelativeTime} from './relativeTime' +import {MessageFormatElement} from '@formatjs/icu-messageformat-parser' import { formatDate, + formatDateTimeRange, formatDateToParts, formatTime, formatTimeToParts, - formatDateTimeRange, } from './dateTime' -import {formatPlural} from './plural' -import {formatMessage} from './message' -import {formatList, formatListToParts} from './list' import {formatDisplayName} from './displayName' -import {MessageFormatElement} from '@formatjs/icu-messageformat-parser' +import {InvalidConfigError, MissingDataError} from './error' +import {formatList, formatListToParts} from './list' +import {formatMessage} from './message' +import {formatNumber, formatNumberToParts} from './number' +import {formatPlural} from './plural' +import {formatRelativeTime} from './relativeTime' +import {IntlCache, IntlConfig, IntlShape, ResolvedIntlConfig} from './types' +import {createFormatters, DEFAULT_INTL_CONFIG} from './utils' export interface CreateIntlFn< T = string, @@ -40,7 +40,7 @@ function verifyConfigMessages(config: IntlConfig) { ) { config.onWarn(`[@formatjs/intl] "defaultRichTextElements" was specified but "message" was not pre-compiled. Please consider using "@formatjs/cli" to pre-compile your messages for performance. -For more details see https://formatjs.io/docs/getting-started/message-distribution`) +For more details see https://formatjs.github.io/docs/getting-started/message-distribution`) } } @@ -64,7 +64,7 @@ export function createIntl( if (onError) { onError( new InvalidConfigError( - `"locale" was not configured, using "${defaultLocale}" as fallback. See https://formatjs.io/docs/react-intl/api#intlshape for more details` + `"locale" was not configured, using "${defaultLocale}" as fallback. See https://formatjs.github.io/docs/react-intl/api#intlshape for more details` ) ) } @@ -77,7 +77,7 @@ export function createIntl( } else if (!Intl.NumberFormat.supportedLocalesOf(locale).length && onError) { onError( new MissingDataError( - `Missing locale data for locale: "${locale}" in Intl.NumberFormat. Using default locale: "${defaultLocale}" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details` + `Missing locale data for locale: "${locale}" in Intl.NumberFormat. Using default locale: "${defaultLocale}" as fallback. See https://formatjs.github.io/docs/react-intl#runtime-requirements for more details` ) ) } else if ( @@ -86,7 +86,7 @@ export function createIntl( ) { onError( new MissingDataError( - `Missing locale data for locale: "${locale}" in Intl.DateTimeFormat. Using default locale: "${defaultLocale}" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details` + `Missing locale data for locale: "${locale}" in Intl.DateTimeFormat. Using default locale: "${defaultLocale}" as fallback. See https://formatjs.github.io/docs/react-intl#runtime-requirements for more details` ) ) } diff --git a/packages/intl/src/displayName.ts b/packages/intl/src/displayName.ts index 847e6f0270c..1958a4dc19d 100644 --- a/packages/intl/src/displayName.ts +++ b/packages/intl/src/displayName.ts @@ -1,13 +1,10 @@ import {Formatters, IntlFormatters, OnErrorFn} from './types' import {filterProps} from './utils' -import { - DisplayNamesOptions, - DisplayNames as IntlDisplayNames, -} from '@formatjs/intl-displaynames' -import {FormatError, ErrorCode} from 'intl-messageformat' + +import {ErrorCode, FormatError} from 'intl-messageformat' import {IntlFormatError} from './error' -const DISPLAY_NAMES_OPTONS: Array = [ +const DISPLAY_NAMES_OPTONS: Array = [ 'style', 'type', 'fallback', @@ -26,7 +23,7 @@ export function formatDisplayName( value: Parameters[0], options: Parameters[1] ): string | undefined { - const DisplayNames: typeof IntlDisplayNames = (Intl as any).DisplayNames + const DisplayNames: typeof Intl.DisplayNames = (Intl as any).DisplayNames if (!DisplayNames) { onError( new FormatError( @@ -40,7 +37,7 @@ Try polyfilling it using "@formatjs/intl-displaynames" const filteredOptions = filterProps( options, DISPLAY_NAMES_OPTONS - ) as DisplayNamesOptions + ) as Intl.DisplayNamesOptions try { return getDisplayNames(locale, filteredOptions).of(value) } catch (e) { diff --git a/packages/intl/src/list.ts b/packages/intl/src/list.ts index af4229247ba..a3d1a72b0ca 100644 --- a/packages/intl/src/list.ts +++ b/packages/intl/src/list.ts @@ -1,12 +1,9 @@ -import {Formatters, IntlFormatters, OnErrorFn} from './types' -import {filterProps} from './utils' -import type IntlListFormat from '@formatjs/intl-listformat' -import type {Part} from '@formatjs/intl-listformat' -import type {IntlListFormatOptions} from '@formatjs/intl-listformat' -import {FormatError, ErrorCode} from 'intl-messageformat' +import {ErrorCode, FormatError} from 'intl-messageformat' import {IntlFormatError} from './error' +import {Formatters, IntlFormatters, OnErrorFn, Part} from './types' +import {filterProps} from './utils' -const LIST_FORMAT_OPTIONS: Array = [ +const LIST_FORMAT_OPTIONS: Array = [ 'type', 'style', ] @@ -74,8 +71,8 @@ export function formatListToParts( getListFormat: Formatters['getListFormat'], values: Parameters[0], options: Parameters[1] = {} -): Part[] { - const ListFormat: typeof IntlListFormat = (Intl as any).ListFormat +): Part[] { + const ListFormat: typeof Intl.ListFormat = Intl.ListFormat if (!ListFormat) { onError( new FormatError( @@ -89,7 +86,7 @@ Try polyfilling it using "@formatjs/intl-listformat" const filteredOptions = filterProps( options, LIST_FORMAT_OPTIONS - ) as IntlListFormatOptions + ) as Intl.ListFormatOptions try { const richValues: Record = {} @@ -103,10 +100,11 @@ Try polyfilling it using "@formatjs/intl-listformat" }) return getListFormat(locale, filteredOptions) .formatToParts(serializedValues) - .map(part => - part.type === 'literal' - ? part - : {...part, value: richValues[part.value] || part.value} + .map( + part => + (part.type === 'literal' + ? part + : {...part, value: richValues[part.value] || part.value}) as Part ) } catch (e) { onError(new IntlFormatError('Error formatting list.', locale, e)) diff --git a/packages/intl/src/message.ts b/packages/intl/src/message.ts index cee3875082a..8736e4a6f04 100644 --- a/packages/intl/src/message.ts +++ b/packages/intl/src/message.ts @@ -1,16 +1,16 @@ import {invariant} from '@formatjs/ecma402-abstract' -import {Formatters, MessageDescriptor, CustomFormats, OnErrorFn} from './types' +import {CustomFormats, Formatters, MessageDescriptor, OnErrorFn} from './types' +import {MessageFormatElement, TYPE} from '@formatjs/icu-messageformat-parser' import { - IntlMessageFormat, FormatXMLElementFn, - PrimitiveType, + IntlMessageFormat, Formatters as IntlMessageFormatFormatters, Options, + PrimitiveType, } from 'intl-messageformat' -import {MissingTranslationError, MessageFormatError} from './error' -import {TYPE, MessageFormatElement} from '@formatjs/icu-messageformat-parser' +import {MessageFormatError, MissingTranslationError} from './error' function setTimeZoneInOptions( opts: Record, @@ -115,9 +115,9 @@ export const formatMessage: FormatMessageFn = ( invariant( !!msgId, `[@formatjs/intl] An \`id\` must be provided to format a message. You can either: -1. Configure your build toolchain with [babel-plugin-formatjs](https://formatjs.io/docs/tooling/babel-plugin) -or [@formatjs/ts-transformer](https://formatjs.io/docs/tooling/ts-transformer) OR -2. Configure your \`eslint\` config to include [eslint-plugin-formatjs](https://formatjs.io/docs/tooling/linter#enforce-id) +1. Configure your build toolchain with [babel-plugin-formatjs](https://formatjs.github.io/docs/tooling/babel-plugin) +or [@formatjs/ts-transformer](https://formatjs.github.io/docs/tooling/ts-transformer) OR +2. Configure your \`eslint\` config to include [eslint-plugin-formatjs](https://formatjs.github.io/docs/tooling/linter#enforce-id) to autofix this issue` ) const id = String(msgId) diff --git a/packages/intl/src/types.ts b/packages/intl/src/types.ts index b6c79494f50..1c8f705adfb 100644 --- a/packages/intl/src/types.ts +++ b/packages/intl/src/types.ts @@ -1,10 +1,6 @@ import {DateTimeFormat, NumberFormatOptions} from '@formatjs/ecma402-abstract' import {MessageFormatElement} from '@formatjs/icu-messageformat-parser' -import {DisplayNames, DisplayNamesOptions} from '@formatjs/intl-displaynames' -import IntlListFormat, { - IntlListFormatOptions, - Part, -} from '@formatjs/intl-listformat' + import { FormatError, Formats, @@ -22,6 +18,11 @@ import { } from './error' import {DEFAULT_INTL_CONFIG} from './utils' +export interface Part { + type: 'element' | 'literal' + value: T +} + // Note: FormatjsIntl is defined as a global namespace so the library user can // override the default types of Message.ids (e.g. as string literal unions from extracted strings) // or IntlConfig.locale (e.g. to a list of supported locales). @@ -105,10 +106,10 @@ export type FormatPluralOptions = Omit< > & CustomFormatConfig -export type FormatListOptions = Omit +export type FormatListOptions = Omit export type FormatDisplayNameOptions = Omit< - DisplayNamesOptions, + Intl.DisplayNamesOptions, 'localeMatcher' > @@ -205,7 +206,7 @@ export interface IntlFormatters { ): Part[] formatDisplayName( this: void, - value: Parameters[0], + value: Parameters[0], opts: FormatDisplayNameOptions ): string | undefined } @@ -234,12 +235,12 @@ export interface Formatters { ): Intl.PluralRules getListFormat( this: void, - ...args: ConstructorParameters - ): IntlListFormat + ...args: ConstructorParameters + ): Intl.ListFormat getDisplayNames( this: void, - ...args: ConstructorParameters - ): DisplayNames + ...args: ConstructorParameters + ): Intl.DisplayNames } export interface IntlShape @@ -254,8 +255,8 @@ export interface IntlCache { message: Record relativeTime: Record pluralRules: Record - list: Record - displayNames: Record + list: Record + displayNames: Record } export interface MessageDescriptor { diff --git a/packages/intl/tests/formatDisplayNames.test.ts b/packages/intl/tests/formatDisplayNames.test.ts index b0ec7cfd48b..9cf4f622250 100644 --- a/packages/intl/tests/formatDisplayNames.test.ts +++ b/packages/intl/tests/formatDisplayNames.test.ts @@ -1,7 +1,4 @@ /* eslint-disable @typescript-eslint/camelcase */ -import '@formatjs/intl-displaynames/polyfill' -import '@formatjs/intl-displaynames/locale-data/en' -import '@formatjs/intl-displaynames/locale-data/zh-Hans-SG' import {formatDisplayName as formatDisplayNameFn} from '../src/displayName' import {IntlConfig, IntlFormatters} from '../src/types' @@ -45,7 +42,7 @@ describe('format API', () => { it('should return locale display name as string', function () { expect(formatDisplayName('zh-Hans-SG', {type: 'language'})).toBe( - 'Simplified Chinese (Singapore)' + 'Chinese (Simplified, Singapore)' ) }) diff --git a/packages/intl/tests/formatMessage.test.ts b/packages/intl/tests/formatMessage.test.ts index b597f710295..22719c85629 100644 --- a/packages/intl/tests/formatMessage.test.ts +++ b/packages/intl/tests/formatMessage.test.ts @@ -1,9 +1,6 @@ /* eslint-disable @typescript-eslint/camelcase */ -import '@formatjs/intl-numberformat/polyfill' -import '@formatjs/intl-numberformat/locale-data/en' -import '@formatjs/intl-numberformat/locale-data/es' -import IntlMessageFormat from 'intl-messageformat' import {parse} from '@formatjs/icu-messageformat-parser' +import IntlMessageFormat from 'intl-messageformat' import {formatMessage as baseFormatMessage} from '../src/message' import {Formatters, IntlConfig, IntlFormatters} from '../src/types' diff --git a/packages/intl/tests/formatNumber.test.ts b/packages/intl/tests/formatNumber.test.ts index 0465cc0251f..3daa41c8a36 100644 --- a/packages/intl/tests/formatNumber.test.ts +++ b/packages/intl/tests/formatNumber.test.ts @@ -1,7 +1,4 @@ /* eslint-disable @typescript-eslint/camelcase */ -import '@formatjs/intl-numberformat/polyfill' -import '@formatjs/intl-numberformat/locale-data/en' -import '@formatjs/intl-numberformat/locale-data/es' import {formatNumber as formatNumberFn} from '../src/number' import {IntlConfig} from '../src/types' diff --git a/packages/intl/tests/formatTime.test.ts b/packages/intl/tests/formatTime.test.ts index a2300652a3a..8c5d841b875 100644 --- a/packages/intl/tests/formatTime.test.ts +++ b/packages/intl/tests/formatTime.test.ts @@ -1,10 +1,7 @@ /* eslint-disable @typescript-eslint/camelcase */ import {DateTimeFormat} from '@formatjs/ecma402-abstract' import {formatTime as formatTimeFn} from '../src/dateTime' -import {IntlConfig, IntlFormatters, Formatters} from '../src/types' -import '@formatjs/intl-datetimeformat/polyfill' -import '@formatjs/intl-datetimeformat/locale-data/en' -import '@formatjs/intl-datetimeformat/add-all-tz' +import {Formatters, IntlConfig, IntlFormatters} from '../src/types' describe('format API', () => { const {NODE_ENV} = process.env diff --git a/packages/intl/tests/global.d.ts b/packages/intl/tests/global.d.ts deleted file mode 100644 index fc8a3a81281..00000000000 --- a/packages/intl/tests/global.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import IntlListFormat from '@formatjs/intl-listformat' - -declare global { - namespace Intl { - const ListFormat: typeof IntlListFormat - } -} From 31b832f9a24bff0776d66e35cf85f59de25ed3c3 Mon Sep 17 00:00:00 2001 From: longlho Date: Mon, 18 Nov 2024 01:25:32 -0500 Subject: [PATCH 12/17] feat(react-intl): remove polyfill packages in deps BREAKING CHANGE: This removes @formatjs/intl-displaynames & @formatjs/intl-listformat as deps which will reduce package size. However, this also means you'll need typescript@5 at least since that has new type defs for those native Intl APIs. --- packages/react-intl/BUILD | 4 - packages/react-intl/index.ts | 90 +++++++++---------- packages/react-intl/package.json | 6 -- .../components/createFormattedComponent.tsx | 13 +-- packages/react-intl/tests/setup.js | 8 -- .../tests/unit/components/provider.test.tsx | 2 +- .../tests/unit/components/relative.test.tsx | 7 +- 7 files changed, 55 insertions(+), 75 deletions(-) diff --git a/packages/react-intl/BUILD b/packages/react-intl/BUILD index e40276b4290..d10e39b8cd8 100644 --- a/packages/react-intl/BUILD +++ b/packages/react-intl/BUILD @@ -29,8 +29,6 @@ SRCS = glob(["src/**/*.ts*"]) + ["index.ts"] SRC_DEPS = [ ":node_modules/@formatjs/ecma402-abstract", ":node_modules/@formatjs/icu-messageformat-parser", - ":node_modules/@formatjs/intl-displaynames", - ":node_modules/@formatjs/intl-listformat", ":node_modules/@formatjs/intl", ":node_modules/intl-messageformat", "//:node_modules/@types/hoist-non-react-statics", @@ -47,8 +45,6 @@ TESTS = glob( ) TEST_DEPS = SRC_DEPS + [ - ":node_modules/@formatjs/intl-numberformat", - ":node_modules/@formatjs/intl-relativetimeformat", "//:node_modules/@testing-library/jest-dom", "//:node_modules/@testing-library/react", "//:node_modules/@types/aria-query", diff --git a/packages/react-intl/index.ts b/packages/react-intl/index.ts index c15f7b7f9d8..0ea4785bee7 100644 --- a/packages/react-intl/index.ts +++ b/packages/react-intl/index.ts @@ -3,69 +3,67 @@ * Copyrights licensed under the New BSD License. * See the accompanying LICENSE file for terms. */ +import {NumberFormatOptions} from '@formatjs/ecma402-abstract' +import { + CustomFormatConfig, + FormatDateOptions, + MessageDescriptor, +} from '@formatjs/intl' import * as React from 'react' import { createFormattedComponent, createFormattedDateTimePartsComponent, } from './src/components/createFormattedComponent' -import { - MessageDescriptor, - CustomFormatConfig, - FormatDateOptions, -} from '@formatjs/intl' -import {IntlListFormatOptions} from '@formatjs/intl-listformat' -import {DisplayNamesOptions} from '@formatjs/intl-displaynames' -import {NumberFormatOptions} from '@formatjs/ecma402-abstract' +import {createIntl} from './src/components/createIntl' +import FormattedDateTimeRange from './src/components/dateTimeRange' import injectIntl, { - Provider as RawIntlProvider, Context as IntlContext, + Provider as RawIntlProvider, WithIntlProps, WrappedComponentProps, } from './src/components/injectIntl' -import useIntl from './src/components/useIntl' +import FormattedMessage from './src/components/message' +import FormattedPlural from './src/components/plural' import IntlProvider from './src/components/provider' -import {createIntl} from './src/components/createIntl' import FormattedRelativeTime from './src/components/relative' -import FormattedPlural from './src/components/plural' -import FormattedMessage from './src/components/message' -import FormattedDateTimeRange from './src/components/dateTimeRange' -export { - FormattedDateTimeRange, - FormattedMessage, - FormattedPlural, - FormattedRelativeTime, - IntlContext, - IntlProvider, - RawIntlProvider, - WithIntlProps, - WrappedComponentProps, - createIntl, - injectIntl, - useIntl, -} -export {IntlConfig, ResolvedIntlConfig, IntlShape} from './src/types' +import useIntl from './src/components/useIntl' export { createIntlCache, - MessageDescriptor, - IntlCache, - Formatters, - IntlFormatters, + CustomFormatConfig, + CustomFormats, + FormatDateOptions, FormatDisplayNameOptions, FormatListOptions, + FormatNumberOptions, FormatPluralOptions, FormatRelativeTimeOptions, - FormatNumberOptions, - FormatDateOptions, - CustomFormatConfig, - CustomFormats, - UnsupportedFormatterError, + Formatters, + IntlCache, + IntlFormatters, InvalidConfigError, - MissingDataError, + MessageDescriptor, MessageFormatError, + MissingDataError, MissingTranslationError, - IntlErrorCode as ReactIntlErrorCode, IntlError as ReactIntlError, + IntlErrorCode as ReactIntlErrorCode, + UnsupportedFormatterError, } from '@formatjs/intl' +export {IntlConfig, IntlShape, ResolvedIntlConfig} from './src/types' +export { + createIntl, + FormattedDateTimeRange, + FormattedMessage, + FormattedPlural, + FormattedRelativeTime, + injectIntl, + IntlContext, + IntlProvider, + RawIntlProvider, + useIntl, + WithIntlProps, + WrappedComponentProps, +} export function defineMessages< K extends keyof any, @@ -101,13 +99,13 @@ export const FormattedNumber: React.FC< } > = createFormattedComponent('formatNumber') export const FormattedList: React.FC< - IntlListFormatOptions & { + Intl.ListFormatOptions & { value: readonly React.ReactNode[] } > = createFormattedComponent('formatList') export const FormattedDisplayName: React.FC< - DisplayNamesOptions & { - value: string | number | Record + Intl.DisplayNamesOptions & { + value: string } > = createFormattedComponent('formatDisplayName') export const FormattedDateParts: React.FC< @@ -123,9 +121,9 @@ export const FormattedTimeParts: React.FC< } > = createFormattedDateTimePartsComponent('formatTime') +export type {MessageFormatElement} from '@formatjs/icu-messageformat-parser' +export type {PrimitiveType} from 'intl-messageformat' export { - FormattedNumberParts, FormattedListParts, + FormattedNumberParts, } from './src/components/createFormattedComponent' -export type {MessageFormatElement} from '@formatjs/icu-messageformat-parser' -export type {PrimitiveType} from 'intl-messageformat' diff --git a/packages/react-intl/package.json b/packages/react-intl/package.json index 8f928dd4ddb..20c3482e0bf 100644 --- a/packages/react-intl/package.json +++ b/packages/react-intl/package.json @@ -131,18 +131,12 @@ "@formatjs/ecma402-abstract": "workspace:*", "@formatjs/icu-messageformat-parser": "workspace:*", "@formatjs/intl": "workspace:*", - "@formatjs/intl-displaynames": "workspace:*", - "@formatjs/intl-listformat": "workspace:*", "@types/hoist-non-react-statics": "3", "@types/react": "16 || 17 || 18", "hoist-non-react-statics": "3", "intl-messageformat": "workspace:*", "tslib": "2" }, - "devDependencies": { - "@formatjs/intl-numberformat": "workspace:*", - "@formatjs/intl-relativetimeformat": "workspace:*" - }, "peerDependencies": { "react": "^16.6.0 || 17 || 18", "typescript": "^4.7 || 5" diff --git a/packages/react-intl/src/components/createFormattedComponent.tsx b/packages/react-intl/src/components/createFormattedComponent.tsx index 598f98d7ef2..fd38922dbd7 100644 --- a/packages/react-intl/src/components/createFormattedComponent.tsx +++ b/packages/react-intl/src/components/createFormattedComponent.tsx @@ -1,13 +1,12 @@ -import * as React from 'react' import { FormatDateOptions, - FormatNumberOptions, - FormatListOptions, FormatDisplayNameOptions, + FormatListOptions, + FormatNumberOptions, } from '@formatjs/intl' +import * as React from 'react' import {IntlShape} from '../types' import useIntl from './useIntl' -import {Part} from '@formatjs/intl-listformat' enum DisplayName { formatDate = 'FormattedDate', @@ -51,7 +50,9 @@ export const FormattedListParts: React.FC< Formatter['formatList'] & { value: Parameters[0] - children(val: Part[]): React.ReactElement | null + children( + val: ReturnType + ): React.ReactElement | null } > = props => { const intl = useIntl() @@ -109,7 +110,7 @@ export function createFormattedComponent( const intl = useIntl() const {value, children, ...formatProps} = props // TODO: fix TS type definition for localeMatcher upstream - const formattedValue = intl[name](value as any, formatProps as any) + const formattedValue = intl[name](value as never, formatProps as any) if (typeof children === 'function') { return children(formattedValue as any) diff --git a/packages/react-intl/tests/setup.js b/packages/react-intl/tests/setup.js index 4e307e020f1..84795f32903 100644 --- a/packages/react-intl/tests/setup.js +++ b/packages/react-intl/tests/setup.js @@ -1,10 +1,2 @@ -if (process.version.startsWith('v12')) { - delete Intl.NumberFormat -} -require('@formatjs/intl-displaynames/polyfill') -require('@formatjs/intl-displaynames/locale-data/en') -require('@formatjs/intl-numberformat/polyfill') -require('@formatjs/intl-numberformat/locale-data/en') -require('@formatjs/intl-numberformat/locale-data/es') // add custom jest matchers from jest-dom require('@testing-library/jest-dom/jest-globals') diff --git a/packages/react-intl/tests/unit/components/provider.test.tsx b/packages/react-intl/tests/unit/components/provider.test.tsx index db553ac2896..20897185934 100644 --- a/packages/react-intl/tests/unit/components/provider.test.tsx +++ b/packages/react-intl/tests/unit/components/provider.test.tsx @@ -210,6 +210,6 @@ describe('', () => { expect(consoleWarn) .toHaveBeenCalledWith(`[@formatjs/intl] "defaultRichTextElements" was specified but "message" was not pre-compiled. Please consider using "@formatjs/cli" to pre-compile your messages for performance. -For more details see https://formatjs.io/docs/getting-started/message-distribution`) +For more details see https://formatjs.github.io/docs/getting-started/message-distribution`) }) }) diff --git a/packages/react-intl/tests/unit/components/relative.test.tsx b/packages/react-intl/tests/unit/components/relative.test.tsx index 2525994b466..a2b19640183 100644 --- a/packages/react-intl/tests/unit/components/relative.test.tsx +++ b/packages/react-intl/tests/unit/components/relative.test.tsx @@ -1,11 +1,10 @@ -import '@formatjs/intl-relativetimeformat/polyfill' +import {act, render} from '@testing-library/react' import * as React from 'react' -import FormattedRelativeTime from '../../../src/components/relative' import {createIntl} from '../../../src/components/createIntl' +import FormattedRelativeTime from '../../../src/components/relative' +import type {IntlConfig} from '../../../src/types' import {IntlShape} from '../../../src/types' import {mountFormattedComponentWithProvider} from '../testUtils' -import type {IntlConfig} from '../../../src/types' -import {render, act} from '@testing-library/react' jest.useFakeTimers() From 7ea64ec66752b0879186fa46808fa8309f7b5f9b Mon Sep 17 00:00:00 2001 From: longlho Date: Mon, 18 Nov 2024 01:26:04 -0500 Subject: [PATCH 13/17] docs: fix URL --- packages/babel-plugin-formatjs/utils.ts | 6 ++-- packages/cli-lib/src/cli.ts | 6 ++-- .../rules/blocklist-elements.ts | 4 +-- .../rules/enforce-default-message.ts | 2 +- .../rules/enforce-description.ts | 2 +- .../rules/enforce-id.ts | 2 +- .../rules/enforce-placeholders.ts | 2 +- .../rules/enforce-plural-rules.ts | 2 +- .../rules/no-camel-case.ts | 2 +- .../rules/no-complex-selectors.ts | 2 +- .../eslint-plugin-formatjs/rules/no-emoji.ts | 2 +- .../eslint-plugin-formatjs/rules/no-id.ts | 2 +- .../rules/no-literal-string-in-jsx.ts | 2 +- .../no-missing-icu-plural-one-placeholders.ts | 2 +- .../rules/no-multiple-plurals.ts | 2 +- .../rules/no-multiple-whitespaces.ts | 2 +- .../eslint-plugin-formatjs/rules/no-offset.ts | 2 +- .../rules/no-useless-message.ts | 2 +- .../rules/prefer-formatted-message.ts | 2 +- .../rules/prefer-pound-in-plural.ts | 2 +- website/src/pages/index.js | 28 +++++++++++-------- 21 files changed, 42 insertions(+), 36 deletions(-) diff --git a/packages/babel-plugin-formatjs/utils.ts b/packages/babel-plugin-formatjs/utils.ts index accb8c32bd5..e3c239ec275 100644 --- a/packages/babel-plugin-formatjs/utils.ts +++ b/packages/babel-plugin-formatjs/utils.ts @@ -2,13 +2,13 @@ import * as t from '@babel/types' import {parse} from '@formatjs/icu-messageformat-parser' import {interpolateName} from '@formatjs/ts-transformer' +import {NodePath} from '@babel/core' import { - Options, ExtractedMessageDescriptor, MessageDescriptor, MessageDescriptorPath, + Options, } from './types' -import {NodePath} from '@babel/core' const DESCRIPTOR_PROPS = new Set([ 'id', @@ -166,7 +166,7 @@ function getICUMessageValue( throw messagePath.buildCodeFrameError( '[React Intl] Message failed to parse. ' + - 'See: https://formatjs.io/docs/core-concepts/icu-syntax' + + 'See: https://formatjs.github.io/docs/core-concepts/icu-syntax' + `\n${parseError}` ) } diff --git a/packages/cli-lib/src/cli.ts b/packages/cli-lib/src/cli.ts index 3404d70feb5..e574d4bcf05 100644 --- a/packages/cli-lib/src/cli.ts +++ b/packages/cli-lib/src/cli.ts @@ -168,7 +168,7 @@ This is especially useful to convert from a TMS-specific format back to react-in ) .option( '--ast', - `Whether to compile to AST. See https://formatjs.io/docs/guides/advanced-usage#pre-parsing-messages for more information` + `Whether to compile to AST. See https://formatjs.github.io/docs/guides/advanced-usage#pre-parsing-messages for more information` ) .option( '--skip-errors', @@ -176,7 +176,7 @@ This is especially useful to convert from a TMS-specific format back to react-in ) .option( '--pseudo-locale ', - `Whether to generate pseudo-locale files. See https://formatjs.io/docs/tooling/cli#--pseudo-locale-pseudolocale for possible values. "--ast" is required for this to work.` + `Whether to generate pseudo-locale files. See https://formatjs.github.io/docs/tooling/cli#--pseudo-locale-pseudolocale for possible values. "--ast" is required for this to work.` ) .option( '--ignore-tag', @@ -211,7 +211,7 @@ This is especially useful to convert from a TMS-specific format back to react-in ) .option( '--ast', - `Whether to compile to AST. See https://formatjs.io/docs/guides/advanced-usage#pre-parsing-messages for more information` + `Whether to compile to AST. See https://formatjs.github.io/docs/guides/advanced-usage#pre-parsing-messages for more information` ) .action(async (folder: string, outFolder: string, opts?: Opts) => { debug('Folder:', folder) diff --git a/packages/eslint-plugin-formatjs/rules/blocklist-elements.ts b/packages/eslint-plugin-formatjs/rules/blocklist-elements.ts index 7c18bb3e122..ce726b3f4ae 100644 --- a/packages/eslint-plugin-formatjs/rules/blocklist-elements.ts +++ b/packages/eslint-plugin-formatjs/rules/blocklist-elements.ts @@ -126,7 +126,7 @@ function checkNode( } const createRule = ESLintUtils.RuleCreator( - _ => 'https://formatjs.io/docs/tooling/linter#blocklist-elements' + _ => 'https://formatjs.github.io/docs/tooling/linter#blocklist-elements' ) export const rule = createRule({ @@ -135,7 +135,7 @@ export const rule = createRule({ type: 'problem', docs: { description: 'Disallow specific elements in ICU message format', - url: 'https://formatjs.io/docs/tooling/linter#blocklist-elements', + url: 'https://formatjs.github.io/docs/tooling/linter#blocklist-elements', }, fixable: 'code', schema: [ diff --git a/packages/eslint-plugin-formatjs/rules/enforce-default-message.ts b/packages/eslint-plugin-formatjs/rules/enforce-default-message.ts index cf39c26c92c..be978522380 100644 --- a/packages/eslint-plugin-formatjs/rules/enforce-default-message.ts +++ b/packages/eslint-plugin-formatjs/rules/enforce-default-message.ts @@ -48,7 +48,7 @@ export const rule: RuleModule = { type: 'problem', docs: { description: 'Enforce defaultMessage in message descriptor', - url: 'https://formatjs.io/docs/tooling/linter#enforce-default-message', + url: 'https://formatjs.github.io/docs/tooling/linter#enforce-default-message', }, fixable: 'code', schema: [ diff --git a/packages/eslint-plugin-formatjs/rules/enforce-description.ts b/packages/eslint-plugin-formatjs/rules/enforce-description.ts index 6b4024ba56d..cbbf1bc87fa 100644 --- a/packages/eslint-plugin-formatjs/rules/enforce-description.ts +++ b/packages/eslint-plugin-formatjs/rules/enforce-description.ts @@ -48,7 +48,7 @@ export const rule: RuleModule = { type: 'problem', docs: { description: 'Enforce description in message descriptor', - url: 'https://formatjs.io/docs/tooling/linter#enforce-description', + url: 'https://formatjs.github.io/docs/tooling/linter#enforce-description', }, fixable: 'code', schema: [ diff --git a/packages/eslint-plugin-formatjs/rules/enforce-id.ts b/packages/eslint-plugin-formatjs/rules/enforce-id.ts index 663ba51b314..a8afd8762d5 100644 --- a/packages/eslint-plugin-formatjs/rules/enforce-id.ts +++ b/packages/eslint-plugin-formatjs/rules/enforce-id.ts @@ -140,7 +140,7 @@ export const rule: RuleModule = { type: 'problem', docs: { description: 'Enforce (generated) ID in message descriptor', - url: 'https://formatjs.io/docs/tooling/linter#enforce-id', + url: 'https://formatjs.github.io/docs/tooling/linter#enforce-id', }, fixable: 'code', schema: [ diff --git a/packages/eslint-plugin-formatjs/rules/enforce-placeholders.ts b/packages/eslint-plugin-formatjs/rules/enforce-placeholders.ts index 2e4efcbcb5e..e1a50dd732a 100644 --- a/packages/eslint-plugin-formatjs/rules/enforce-placeholders.ts +++ b/packages/eslint-plugin-formatjs/rules/enforce-placeholders.ts @@ -143,7 +143,7 @@ export const rule: RuleModule = { docs: { description: 'Enforce that all messages with placeholders have enough passed-in values', - url: 'https://formatjs.io/docs/tooling/linter#enforce-placeholders', + url: 'https://formatjs.github.io/docs/tooling/linter#enforce-placeholders', }, schema: [ { diff --git a/packages/eslint-plugin-formatjs/rules/enforce-plural-rules.ts b/packages/eslint-plugin-formatjs/rules/enforce-plural-rules.ts index d00459b7cd0..bcf57e1cb20 100644 --- a/packages/eslint-plugin-formatjs/rules/enforce-plural-rules.ts +++ b/packages/eslint-plugin-formatjs/rules/enforce-plural-rules.ts @@ -90,7 +90,7 @@ export const rule: RuleModule = { docs: { description: 'Enforce plural rules to always specify certain categories like `one`/`other`', - url: 'https://formatjs.io/docs/tooling/linter#enforce-plural-rules', + url: 'https://formatjs.github.io/docs/tooling/linter#enforce-plural-rules', }, fixable: 'code', schema: [ diff --git a/packages/eslint-plugin-formatjs/rules/no-camel-case.ts b/packages/eslint-plugin-formatjs/rules/no-camel-case.ts index d4381522e60..98a119980d6 100644 --- a/packages/eslint-plugin-formatjs/rules/no-camel-case.ts +++ b/packages/eslint-plugin-formatjs/rules/no-camel-case.ts @@ -73,7 +73,7 @@ export const rule: RuleModule = { type: 'problem', docs: { description: 'Disallow camel case placeholders in message', - url: 'https://formatjs.io/docs/tooling/linter#no-camel-case', + url: 'https://formatjs.github.io/docs/tooling/linter#no-camel-case', }, fixable: 'code', schema: [], diff --git a/packages/eslint-plugin-formatjs/rules/no-complex-selectors.ts b/packages/eslint-plugin-formatjs/rules/no-complex-selectors.ts index c3bb0478f8b..594a93dce86 100644 --- a/packages/eslint-plugin-formatjs/rules/no-complex-selectors.ts +++ b/packages/eslint-plugin-formatjs/rules/no-complex-selectors.ts @@ -130,7 +130,7 @@ results in 2 sentences: "I have a dog" & "I have many dogs". Default complexity limit is 20 (using Smartling as a reference: https://help.smartling.com/hc/en-us/articles/360008030994-ICU-MessageFormat) `, - url: 'https://formatjs.io/docs/tooling/linter#no-complex-selectors', + url: 'https://formatjs.github.io/docs/tooling/linter#no-complex-selectors', }, schema: [ { diff --git a/packages/eslint-plugin-formatjs/rules/no-emoji.ts b/packages/eslint-plugin-formatjs/rules/no-emoji.ts index 0da29ab56f4..acbb12c425b 100644 --- a/packages/eslint-plugin-formatjs/rules/no-emoji.ts +++ b/packages/eslint-plugin-formatjs/rules/no-emoji.ts @@ -92,7 +92,7 @@ export const rule: RuleModule = { type: 'problem', docs: { description: 'Disallow emojis in message', - url: 'https://formatjs.io/docs/tooling/linter#no-emoji', + url: 'https://formatjs.github.io/docs/tooling/linter#no-emoji', }, fixable: 'code', schema: [ diff --git a/packages/eslint-plugin-formatjs/rules/no-id.ts b/packages/eslint-plugin-formatjs/rules/no-id.ts index 9e7b49e9534..96821e4c5dd 100644 --- a/packages/eslint-plugin-formatjs/rules/no-id.ts +++ b/packages/eslint-plugin-formatjs/rules/no-id.ts @@ -46,7 +46,7 @@ export const rule: RuleModule = { type: 'problem', docs: { description: 'Ban explicit ID from MessageDescriptor', - url: 'https://formatjs.io/docs/tooling/linter#no-id', + url: 'https://formatjs.github.io/docs/tooling/linter#no-id', }, fixable: 'code', schema: [], diff --git a/packages/eslint-plugin-formatjs/rules/no-literal-string-in-jsx.ts b/packages/eslint-plugin-formatjs/rules/no-literal-string-in-jsx.ts index 5853494d596..3b85b190968 100644 --- a/packages/eslint-plugin-formatjs/rules/no-literal-string-in-jsx.ts +++ b/packages/eslint-plugin-formatjs/rules/no-literal-string-in-jsx.ts @@ -63,7 +63,7 @@ export const rule: RuleModule = { type: 'problem', docs: { description: 'Disallow untranslated literal strings without translation.', - url: 'https://formatjs.io/docs/tooling/linter#no-literal-string-in-jsx', + url: 'https://formatjs.github.io/docs/tooling/linter#no-literal-string-in-jsx', }, schema: [ { diff --git a/packages/eslint-plugin-formatjs/rules/no-missing-icu-plural-one-placeholders.ts b/packages/eslint-plugin-formatjs/rules/no-missing-icu-plural-one-placeholders.ts index 84773f9be8d..41230ac63ce 100644 --- a/packages/eslint-plugin-formatjs/rules/no-missing-icu-plural-one-placeholders.ts +++ b/packages/eslint-plugin-formatjs/rules/no-missing-icu-plural-one-placeholders.ts @@ -115,7 +115,7 @@ export const rule: RuleModule = { docs: { description: 'We use `one {# item}` instead of `one {1 item}` in ICU messages as some locales use the `one` formatting for other similar numbers.', - url: 'https://formatjs.io/docs/tooling/linter#no-explicit-icu-plural', + url: 'https://formatjs.github.io/docs/tooling/linter#no-explicit-icu-plural', }, fixable: 'code', messages: { diff --git a/packages/eslint-plugin-formatjs/rules/no-multiple-plurals.ts b/packages/eslint-plugin-formatjs/rules/no-multiple-plurals.ts index 5fa9c7021ee..fbc1c290b55 100644 --- a/packages/eslint-plugin-formatjs/rules/no-multiple-plurals.ts +++ b/packages/eslint-plugin-formatjs/rules/no-multiple-plurals.ts @@ -65,7 +65,7 @@ export const rule: RuleModule = { type: 'problem', docs: { description: 'Disallow multiple plural rules in the same message', - url: 'https://formatjs.io/docs/tooling/linter#no-multiple-plurals', + url: 'https://formatjs.github.io/docs/tooling/linter#no-multiple-plurals', }, fixable: 'code', schema: [], diff --git a/packages/eslint-plugin-formatjs/rules/no-multiple-whitespaces.ts b/packages/eslint-plugin-formatjs/rules/no-multiple-whitespaces.ts index bf975c1e68f..45caeb503b1 100644 --- a/packages/eslint-plugin-formatjs/rules/no-multiple-whitespaces.ts +++ b/packages/eslint-plugin-formatjs/rules/no-multiple-whitespaces.ts @@ -149,7 +149,7 @@ export const rule: RuleModule = { docs: { description: 'Prevents usage of multiple consecutive whitespaces in message', - url: 'https://formatjs.io/docs/tooling/linter#no-multiple-whitespaces', + url: 'https://formatjs.github.io/docs/tooling/linter#no-multiple-whitespaces', }, messages: { noMultipleWhitespaces: 'Multiple consecutive whitespaces are not allowed', diff --git a/packages/eslint-plugin-formatjs/rules/no-offset.ts b/packages/eslint-plugin-formatjs/rules/no-offset.ts index e09eadd74a4..4d59ced8aca 100644 --- a/packages/eslint-plugin-formatjs/rules/no-offset.ts +++ b/packages/eslint-plugin-formatjs/rules/no-offset.ts @@ -64,7 +64,7 @@ export const rule: RuleModule = { type: 'problem', docs: { description: 'Disallow offset in plural rules', - url: 'https://formatjs.io/docs/tooling/linter#no-offset', + url: 'https://formatjs.github.io/docs/tooling/linter#no-offset', }, fixable: 'code', messages: { diff --git a/packages/eslint-plugin-formatjs/rules/no-useless-message.ts b/packages/eslint-plugin-formatjs/rules/no-useless-message.ts index df16752d720..93baeaf6ce8 100644 --- a/packages/eslint-plugin-formatjs/rules/no-useless-message.ts +++ b/packages/eslint-plugin-formatjs/rules/no-useless-message.ts @@ -68,7 +68,7 @@ export const rule: RuleModule = { type: 'problem', docs: { description: 'Disallow unnecessary formatted message', - url: 'https://formatjs.io/docs/tooling/linter#no-useless-message', + url: 'https://formatjs.github.io/docs/tooling/linter#no-useless-message', }, fixable: 'code', schema: [], diff --git a/packages/eslint-plugin-formatjs/rules/prefer-formatted-message.ts b/packages/eslint-plugin-formatjs/rules/prefer-formatted-message.ts index e57df72fc05..c2aaec09834 100644 --- a/packages/eslint-plugin-formatjs/rules/prefer-formatted-message.ts +++ b/packages/eslint-plugin-formatjs/rules/prefer-formatted-message.ts @@ -12,7 +12,7 @@ export const rule: RuleModule = { docs: { description: 'Prefer `FormattedMessage` component over `intl.formatMessage` if applicable.', - url: 'https://formatjs.io/docs/tooling/linter#prefer-formatted-message', + url: 'https://formatjs.github.io/docs/tooling/linter#prefer-formatted-message', }, messages: { jsxChildren: diff --git a/packages/eslint-plugin-formatjs/rules/prefer-pound-in-plural.ts b/packages/eslint-plugin-formatjs/rules/prefer-pound-in-plural.ts index 4abfbeeee09..19813d5e7ad 100644 --- a/packages/eslint-plugin-formatjs/rules/prefer-pound-in-plural.ts +++ b/packages/eslint-plugin-formatjs/rules/prefer-pound-in-plural.ts @@ -225,7 +225,7 @@ export const rule: RuleModule = { docs: { description: 'Prefer using # to reference the count in the plural argument.', - url: 'https://formatjs.io/docs/tooling/linter#prefer-pound-in-plurals', + url: 'https://formatjs.github.io/docs/tooling/linter#prefer-pound-in-plurals', }, messages: { preferPoundInPlurals: diff --git a/website/src/pages/index.js b/website/src/pages/index.js index 74c374d8d6f..8d0b026f8c3 100644 --- a/website/src/pages/index.js +++ b/website/src/pages/index.js @@ -1,21 +1,21 @@ -import React, {useState} from 'react' -import cx from 'classnames' -import Layout from '@theme/Layout' import Link from '@docusaurus/Link' -import useDocusaurusContext from '@docusaurus/useDocusaurusContext' +import {useColorMode} from '@docusaurus/theme-common' import useBaseUrl from '@docusaurus/useBaseUrl' +import useDocusaurusContext from '@docusaurus/useDocusaurusContext' +import Layout from '@theme/Layout' +import cx from 'classnames' +import React, {useState} from 'react' +import {FormattedMessage, IntlProvider, useIntl} from 'react-intl' import styles from './styles.module.css' -import {IntlProvider, FormattedMessage, useIntl} from 'react-intl' -import {useColorMode} from '@docusaurus/theme-common' +import cs from '../../lang/strings_cs-CZ.json' +import de from '../../lang/strings_de-DE.json' import en from '../../lang/strings_en-US.json' +import es from '../../lang/strings_es-AR.json' import fr from '../../lang/strings_fr-FR.json' import ja from '../../lang/strings_ja-JP.json' -import cs from '../../lang/strings_cs-CZ.json' import pt from '../../lang/strings_pt-BR.json' import sv from '../../lang/strings_sv-SE.json' -import es from '../../lang/strings_es-AR.json' -import de from '../../lang/strings_de-DE.json' const MESSAGES = { 'en-US': en, @@ -33,7 +33,10 @@ function IntegrationSection({className}) { return (
- + {intl.formatMessage({ - + {intl.formatMessage({ Date: Mon, 18 Nov 2024 01:27:19 -0500 Subject: [PATCH 14/17] feat(react-intl): drop typescript@4 support --- packages/react-intl/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-intl/package.json b/packages/react-intl/package.json index 20c3482e0bf..6dcb723a05a 100644 --- a/packages/react-intl/package.json +++ b/packages/react-intl/package.json @@ -139,7 +139,7 @@ }, "peerDependencies": { "react": "^16.6.0 || 17 || 18", - "typescript": "^4.7 || 5" + "typescript": "5" }, "peerDependenciesMeta": { "typescript": { From 98d891091dc58c0695701fb1aca62fb8e51bf4ad Mon Sep 17 00:00:00 2001 From: longlho Date: Mon, 18 Nov 2024 01:27:34 -0500 Subject: [PATCH 15/17] feat(@formatjs/intl): drop typescript@4 support --- packages/intl/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/intl/package.json b/packages/intl/package.json index b0d2f4a097e..ac4a4dbadb1 100644 --- a/packages/intl/package.json +++ b/packages/intl/package.json @@ -36,7 +36,7 @@ "tslib": "2" }, "peerDependencies": { - "typescript": "^4.7 || 5" + "typescript": "5" }, "peerDependenciesMeta": { "typescript": { From 041306698303e2b1a262b7b74f0361d63467a981 Mon Sep 17 00:00:00 2001 From: longlho Date: Mon, 18 Nov 2024 01:28:10 -0500 Subject: [PATCH 16/17] chore: re-install --- pnpm-lock.yaml | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0eb7268994c..a721a848ff2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -645,12 +645,6 @@ importers: '@formatjs/icu-messageformat-parser': specifier: workspace:* version: link:../icu-messageformat-parser - '@formatjs/intl-displaynames': - specifier: workspace:* - version: link:../intl-displaynames - '@formatjs/intl-listformat': - specifier: workspace:* - version: link:../intl-listformat intl-messageformat: specifier: workspace:* version: link:../intl-messageformat @@ -660,13 +654,6 @@ importers: typescript: specifier: 5.6.2 version: 5.6.2 - devDependencies: - '@formatjs/intl-datetimeformat': - specifier: workspace:* - version: link:../intl-datetimeformat - '@formatjs/intl-numberformat': - specifier: workspace:* - version: link:../intl-numberformat packages/intl-datetimeformat: dependencies: @@ -874,12 +861,6 @@ importers: '@formatjs/intl': specifier: workspace:* version: link:../intl - '@formatjs/intl-displaynames': - specifier: workspace:* - version: link:../intl-displaynames - '@formatjs/intl-listformat': - specifier: workspace:* - version: link:../intl-listformat '@types/hoist-non-react-statics': specifier: '3' version: 3.3.5 @@ -901,13 +882,6 @@ importers: typescript: specifier: 5.6.2 version: 5.6.2 - devDependencies: - '@formatjs/intl-numberformat': - specifier: workspace:* - version: link:../intl-numberformat - '@formatjs/intl-relativetimeformat': - specifier: workspace:* - version: link:../intl-relativetimeformat packages/react-intl/examples: devDependencies: From 78865eba761aec81a97ea4146c471fc71fd479b1 Mon Sep 17 00:00:00 2001 From: longlho Date: Mon, 18 Nov 2024 01:31:32 -0500 Subject: [PATCH 17/17] build: publish - babel-plugin-formatjs@10.5.26 - @formatjs/cli-lib@6.6.6 - @formatjs/cli@6.3.11 - @formatjs/editor@2.0.61 - eslint-plugin-formatjs@5.2.5 - @formatjs/intl@3.0.0 - react-intl@7.0.0 - vue-intl@6.5.14 --- packages/babel-plugin-formatjs/CHANGELOG.md | 4 ++++ packages/babel-plugin-formatjs/package.json | 2 +- packages/cli-lib/CHANGELOG.md | 4 ++++ packages/cli-lib/package.json | 2 +- packages/cli/CHANGELOG.md | 4 ++++ packages/cli/package.json | 2 +- packages/editor/CHANGELOG.md | 4 ++++ packages/editor/package.json | 2 +- packages/eslint-plugin-formatjs/CHANGELOG.md | 4 ++++ packages/eslint-plugin-formatjs/package.json | 2 +- packages/intl/CHANGELOG.md | 14 ++++++++++++++ packages/intl/package.json | 2 +- packages/react-intl/CHANGELOG.md | 14 ++++++++++++++ packages/react-intl/package.json | 2 +- packages/vue-intl/CHANGELOG.md | 4 ++++ packages/vue-intl/package.json | 2 +- 16 files changed, 60 insertions(+), 8 deletions(-) diff --git a/packages/babel-plugin-formatjs/CHANGELOG.md b/packages/babel-plugin-formatjs/CHANGELOG.md index 0df689422fd..f1898823fa1 100644 --- a/packages/babel-plugin-formatjs/CHANGELOG.md +++ b/packages/babel-plugin-formatjs/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [10.5.26](https://github.com/formatjs/formatjs/compare/babel-plugin-formatjs@10.5.25...babel-plugin-formatjs@10.5.26) (2024-11-18) + +**Note:** Version bump only for package babel-plugin-formatjs + ## [10.5.25](https://github.com/formatjs/formatjs/compare/babel-plugin-formatjs@10.5.24...babel-plugin-formatjs@10.5.25) (2024-11-18) **Note:** Version bump only for package babel-plugin-formatjs diff --git a/packages/babel-plugin-formatjs/package.json b/packages/babel-plugin-formatjs/package.json index 42785834464..b95c5ae4409 100644 --- a/packages/babel-plugin-formatjs/package.json +++ b/packages/babel-plugin-formatjs/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-formatjs", - "version": "10.5.25", + "version": "10.5.26", "description": "Extracts string messages for translation from modules that use formatjs.", "repository": { "type": "git", diff --git a/packages/cli-lib/CHANGELOG.md b/packages/cli-lib/CHANGELOG.md index 81c29abad93..57102efbaa2 100644 --- a/packages/cli-lib/CHANGELOG.md +++ b/packages/cli-lib/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [6.6.6](https://github.com/formatjs/formatjs/compare/@formatjs/cli-lib@6.6.5...@formatjs/cli-lib@6.6.6) (2024-11-18) + +**Note:** Version bump only for package @formatjs/cli-lib + ## [6.6.5](https://github.com/formatjs/formatjs/compare/@formatjs/cli-lib@6.6.4...@formatjs/cli-lib@6.6.5) (2024-11-18) **Note:** Version bump only for package @formatjs/cli-lib diff --git a/packages/cli-lib/package.json b/packages/cli-lib/package.json index d0eaba683fb..2ac20a47baf 100644 --- a/packages/cli-lib/package.json +++ b/packages/cli-lib/package.json @@ -1,6 +1,6 @@ { "name": "@formatjs/cli-lib", - "version": "6.6.5", + "version": "6.6.6", "description": "Lib for CLI for formatjs.", "keywords": [ "intl", diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 900ecea48de..35c88e08445 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [6.3.11](https://github.com/formatjs/formatjs/compare/@formatjs/cli@6.3.10...@formatjs/cli@6.3.11) (2024-11-18) + +**Note:** Version bump only for package @formatjs/cli + ## [6.3.10](https://github.com/formatjs/formatjs/compare/@formatjs/cli@6.3.9...@formatjs/cli@6.3.10) (2024-11-18) **Note:** Version bump only for package @formatjs/cli diff --git a/packages/cli/package.json b/packages/cli/package.json index 087726e0cf9..3b3229ba3c5 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@formatjs/cli", - "version": "6.3.10", + "version": "6.3.11", "description": "A CLI for formatjs.", "keywords": [ "intl", diff --git a/packages/editor/CHANGELOG.md b/packages/editor/CHANGELOG.md index 17a3f05f3c2..83a898f45c2 100644 --- a/packages/editor/CHANGELOG.md +++ b/packages/editor/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.0.61](https://github.com/formatjs/formatjs/compare/@formatjs/editor@2.0.60...@formatjs/editor@2.0.61) (2024-11-18) + +**Note:** Version bump only for package @formatjs/editor + ## [2.0.60](https://github.com/formatjs/formatjs/compare/@formatjs/editor@2.0.59...@formatjs/editor@2.0.60) (2024-11-18) **Note:** Version bump only for package @formatjs/editor diff --git a/packages/editor/package.json b/packages/editor/package.json index c5791172e77..89708c2088e 100644 --- a/packages/editor/package.json +++ b/packages/editor/package.json @@ -1,6 +1,6 @@ { "name": "@formatjs/editor", - "version": "2.0.60", + "version": "2.0.61", "description": "A ICU MessageFormat Editor UI", "keywords": [ "intl", diff --git a/packages/eslint-plugin-formatjs/CHANGELOG.md b/packages/eslint-plugin-formatjs/CHANGELOG.md index 7f2fe734d1d..9ad597bb25c 100644 --- a/packages/eslint-plugin-formatjs/CHANGELOG.md +++ b/packages/eslint-plugin-formatjs/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [5.2.5](https://github.com/formatjs/formatjs/compare/eslint-plugin-formatjs@5.2.4...eslint-plugin-formatjs@5.2.5) (2024-11-18) + +**Note:** Version bump only for package eslint-plugin-formatjs + ## [5.2.4](https://github.com/formatjs/formatjs/compare/eslint-plugin-formatjs@5.2.3...eslint-plugin-formatjs@5.2.4) (2024-11-18) **Note:** Version bump only for package eslint-plugin-formatjs diff --git a/packages/eslint-plugin-formatjs/package.json b/packages/eslint-plugin-formatjs/package.json index d2f9e4498d3..12e3a13d7a2 100644 --- a/packages/eslint-plugin-formatjs/package.json +++ b/packages/eslint-plugin-formatjs/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-formatjs", - "version": "5.2.4", + "version": "5.2.5", "description": "ESLint plugin for formatjs", "main": "index.js", "repository": { diff --git a/packages/intl/CHANGELOG.md b/packages/intl/CHANGELOG.md index 0650ef579e2..0247528e281 100644 --- a/packages/intl/CHANGELOG.md +++ b/packages/intl/CHANGELOG.md @@ -3,6 +3,20 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [3.0.0](https://github.com/formatjs/formatjs/compare/@formatjs/intl@2.10.15...@formatjs/intl@3.0.0) (2024-11-18) + +### Features + +* **@formatjs/intl:** drop typescript@4 support ([98d8910](https://github.com/formatjs/formatjs/commit/98d891091dc58c0695701fb1aca62fb8e51bf4ad)) - by @longlho +* **@formatjs/intl:** remove polyfill packages in deps ([4713e1b](https://github.com/formatjs/formatjs/commit/4713e1b240a52f7e357dcc77912c33e8bef9bfa4)) - by @longlho + +### BREAKING CHANGES + +* **@formatjs/intl:** This removes @formatjs/intl-displaynames & @formatjs/intl-listformat as +deps which will reduce package size. However, this also means you'll +need typescript@5 at least since that has new type defs for those native +Intl APIs. + ## [2.10.15](https://github.com/formatjs/formatjs/compare/@formatjs/intl@2.10.14...@formatjs/intl@2.10.15) (2024-11-18) **Note:** Version bump only for package @formatjs/intl diff --git a/packages/intl/package.json b/packages/intl/package.json index ac4a4dbadb1..6df36fcdaf7 100644 --- a/packages/intl/package.json +++ b/packages/intl/package.json @@ -1,6 +1,6 @@ { "name": "@formatjs/intl", - "version": "2.10.15", + "version": "3.0.0", "description": "Internationalize JS apps. This library provides an API to format dates, numbers, and strings, including pluralization and handling translations.", "keywords": [ "intl", diff --git a/packages/react-intl/CHANGELOG.md b/packages/react-intl/CHANGELOG.md index a86813bbe0e..b19925b48e9 100644 --- a/packages/react-intl/CHANGELOG.md +++ b/packages/react-intl/CHANGELOG.md @@ -3,6 +3,20 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [7.0.0](https://github.com/formatjs/formatjs/compare/react-intl@6.8.9...react-intl@7.0.0) (2024-11-18) + +### Features + +* **react-intl:** drop typescript@4 support ([12ecc1b](https://github.com/formatjs/formatjs/commit/12ecc1b36c7d86bd8bd7e7786f5565e5a5b80f88)) - by @longlho +* **react-intl:** remove polyfill packages in deps ([31b832f](https://github.com/formatjs/formatjs/commit/31b832f9a24bff0776d66e35cf85f59de25ed3c3)) - by @longlho + +### BREAKING CHANGES + +* **react-intl:** This removes @formatjs/intl-displaynames & @formatjs/intl-listformat as +deps which will reduce package size. However, this also means you'll +need typescript@5 at least since that has new type defs for those native +Intl APIs. + ## [6.8.9](https://github.com/formatjs/formatjs/compare/react-intl@6.8.8...react-intl@6.8.9) (2024-11-18) ### Bug Fixes diff --git a/packages/react-intl/package.json b/packages/react-intl/package.json index 6dcb723a05a..1834b95de3d 100644 --- a/packages/react-intl/package.json +++ b/packages/react-intl/package.json @@ -1,6 +1,6 @@ { "name": "react-intl", - "version": "6.8.9", + "version": "7.0.0", "description": "Internationalize React apps. This library provides React components and an API to format dates, numbers, and strings, including pluralization and handling translations.", "keywords": [ "intl", diff --git a/packages/vue-intl/CHANGELOG.md b/packages/vue-intl/CHANGELOG.md index d67c6c65608..dfaf1dc6db2 100644 --- a/packages/vue-intl/CHANGELOG.md +++ b/packages/vue-intl/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [6.5.14](https://github.com/formatjs/formatjs/compare/vue-intl@6.5.13...vue-intl@6.5.14) (2024-11-18) + +**Note:** Version bump only for package vue-intl + ## [6.5.13](https://github.com/formatjs/formatjs/compare/vue-intl@6.5.12...vue-intl@6.5.13) (2024-11-18) **Note:** Version bump only for package vue-intl diff --git a/packages/vue-intl/package.json b/packages/vue-intl/package.json index c2b7a29b803..b165718d83b 100644 --- a/packages/vue-intl/package.json +++ b/packages/vue-intl/package.json @@ -1,6 +1,6 @@ { "name": "vue-intl", - "version": "6.5.13", + "version": "6.5.14", "description": "formatjs intl binding for vue", "main": "index.js", "repository": { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy