Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(js): refactor @logto/client package exports #791

Merged
merged 2 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .changeset/poor-lizards-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
"@logto/client": patch
---

add react-native package export condition

[Enabling package export](https://reactnative.dev/blog/2023/06/21/package-exports-support#enabling-package-exports-beta) in react-native is unstable and can cause issues.

Replace the `exports` in `@logto/client` package.json with the `react-native` [condition](https://reactnative.dev/blog/2023/06/21/package-exports-support#the-new-react-native-condition).

```json
{
"react-native": "./lib/shim.js"
}
```

So the `shim.js` module can be used in react-native projects, without enabling the unstable package export feature.
17 changes: 5 additions & 12 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,12 @@
"main": "./lib/index.cjs",
"module": "./lib/index.js",
"types": "./lib/index.d.ts",
"react-native": "./lib/shim.js",
"exports": {
".": {
"types": "./lib/index.d.ts",
"require": "./lib/index.cjs",
"import": "./lib/index.js",
"default": "./lib/index.js"
},
"./shim": {
"types": "./lib/shim.d.ts",
"require": "./lib/shim.cjs",
"import": "./lib/shim.js",
"default": "./lib/shim.js"
}
"types": "./lib/index.d.ts",
"require": "./lib/index.cjs",
"import": "./lib/index.js",
"default": "./lib/index.js"
},
"files": [
"lib"
Expand Down
2 changes: 1 addition & 1 deletion packages/node/src/utils/cookie-storage.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PersistKey } from '@logto/client/shim';
import { PersistKey } from '@logto/client';

import { type CookieConfig, CookieStorage } from './cookie-storage.js';
import { unwrapSession, wrapSession } from './session.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/node/src/utils/session.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PersistKey } from '@logto/client/shim';
import { PersistKey } from '@logto/client';

import { unwrapSession, wrapSession } from './session.js';

Expand Down
Loading