-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(localizations): Allow usage of subpath exports
The addition of `.gitignore` and `subpaths.mjs` is used to support Expo framework. This fix is also used in `@clerk/shared` package. original PR: #2046 Co-authored-by: Andrew <[email protected]>
- Loading branch information
1 parent
d48d1aa
commit 5e8714c
Showing
7 changed files
with
113 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
'@clerk/localizations': patch | ||
--- | ||
|
||
The package now allows for [subpath exports](https://nodejs.org/api/packages.html#subpath-exports). | ||
|
||
```diff | ||
- import { frFR } from "@clerk/localizations" | ||
+ import { frFR } from "@clerk/localizations/fr-FR" | ||
``` | ||
|
||
This should help with tree-shaking by helping the bundler to include only specific localization. | ||
|
||
This is a non-breaking change-previous imports from "@clerk/localizations" are still working as expected. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/*/ | ||
!/src/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// This file is a helper for the "subpath-workaround.mjs" script | ||
// We have to polyfill our "exports" subpaths :cry: | ||
|
||
export const subpathNames = [ | ||
'ar-SA', | ||
'cs-CZ', | ||
'da-DK', | ||
'de-DE', | ||
'el-GR', | ||
'en-US', | ||
'es-ES', | ||
'fr-FR', | ||
'he-IL', | ||
'it-IT', | ||
'ja-JP', | ||
'ko-KR', | ||
'nb-NO', | ||
'nl-NL', | ||
'pl-PL', | ||
'pt-BR', | ||
'pt-PT', | ||
'ro-RO', | ||
'ru-RU', | ||
'sk-SK', | ||
'sv-SE', | ||
'tr-TR', | ||
'uk-UA', | ||
'vi-VN', | ||
'zh-CN', | ||
'zh-TW', | ||
]; | ||
|
||
export const subpathFoldersBarrel = []; | ||
|
||
export const ignoredFolders = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
import { defineConfig } from 'tsup'; | ||
|
||
export default defineConfig(() => { | ||
export default defineConfig(_overrideOptions => { | ||
const uiRetheme = process.env.CLERK_RETHEME === '1' || process.env.CLERK_RETHEME === 'true'; | ||
|
||
return { | ||
entry: { | ||
index: uiRetheme ? 'src/index.retheme.ts' : 'src/index.ts', | ||
}, | ||
minify: false, | ||
entry: uiRetheme | ||
? ['src', '!src/index.ts', '!src/en-US.ts'] | ||
: ['src', '!src/index.retheme.ts', '!src/en-US.retheme.ts'], | ||
format: ['cjs', 'esm'], | ||
bundle: true, | ||
clean: true, | ||
minify: false, | ||
sourcemap: true, | ||
format: ['cjs', 'esm'], | ||
legacyOutput: true, | ||
dts: true, | ||
splitting: false, | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters