diff --git a/README.md b/README.md index cfa4798..3f571de 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,21 @@ or `npm install --save yoshiki` +As most react-native packages, you need to transpile this package. This will be done automatically with React native or expo +but if you use this elsewhere you need to tweek your settings to automatically transpile it. + +For example, in next.js, you need to add the `transpilePackages` line on `next.config.js` like so: + +```js +const nextConfig = { + reactStrictMode: true, + swcMinify: true, + transpilePackages: ["yoshiki"], +}; + +module.exports = nextConfig; +``` + ## Usage ```tsx diff --git a/examples/next-example/next.config.js b/examples/next-example/next.config.js index 2e4316e..a7f64ef 100644 --- a/examples/next-example/next.config.js +++ b/examples/next-example/next.config.js @@ -19,6 +19,7 @@ const nextConfig = { config.resolve.alias["react"] = path.resolve(__dirname, ".", "node_modules", "react"); return config; }, + transpilePackages: ["yoshiki"], }; module.exports = nextConfig; diff --git a/examples/next-example/package.json b/examples/next-example/package.json index 091f310..7b81478 100644 --- a/examples/next-example/package.json +++ b/examples/next-example/package.json @@ -9,7 +9,7 @@ "lint": "next lint" }, "dependencies": { - "next": "13.0.3", + "next": "13.4.13", "react": "18.2.0", "react-dom": "18.2.0", "yoshiki": "workspace:^" diff --git a/packages/yoshiki/.npmignore b/packages/yoshiki/.npmignore index 7572a78..f797904 100644 --- a/packages/yoshiki/.npmignore +++ b/packages/yoshiki/.npmignore @@ -1,2 +1,3 @@ package.tgz tsconfig.tsbuildinfo +dist diff --git a/packages/yoshiki/index.ts b/packages/yoshiki/index.ts index 4520e6d..61423ec 100644 --- a/packages/yoshiki/index.ts +++ b/packages/yoshiki/index.ts @@ -3,4 +3,4 @@ // Licensed under the MIT license. See LICENSE file in the project root for details. // -export * from "./dist"; +export * from "./src"; diff --git a/packages/yoshiki/native.ts b/packages/yoshiki/native.ts index 266f5a2..30164d1 100644 --- a/packages/yoshiki/native.ts +++ b/packages/yoshiki/native.ts @@ -3,4 +3,4 @@ // Licensed under the MIT license. See LICENSE file in the project root for details. // -export * from "./dist/native"; +export * from "./src/native"; diff --git a/packages/yoshiki/package.json b/packages/yoshiki/package.json index aea602d..7b5e5b3 100644 --- a/packages/yoshiki/package.json +++ b/packages/yoshiki/package.json @@ -1,6 +1,6 @@ { "name": "yoshiki", - "version": "1.2.2", + "version": "1.2.3", "author": "Zoe Roux (https://github.com/zoriya)", "license": "MIT", "keywords": [ @@ -13,8 +13,8 @@ "bugs": { "url": "https://github.com/zoriya/yoshiki/issues" }, - "main": "dist/index.js", - "types": "dist/index.d.ts", + "main": "src/index.ts", + "types": "src/index.ts", "source": "src/index.ts", "scripts": { "build": "tsc --build .", diff --git a/packages/yoshiki/web.ts b/packages/yoshiki/web.ts index 7c73a9b..cf1c7c8 100644 --- a/packages/yoshiki/web.ts +++ b/packages/yoshiki/web.ts @@ -3,4 +3,4 @@ // Licensed under the MIT license. See LICENSE file in the project root for details. // -export * from "./dist/web"; +export * from "./src/web"; diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..9ecc7b7 --- /dev/null +++ b/shell.nix @@ -0,0 +1,8 @@ +{pkgs ? import {}}: + pkgs.mkShell { + packages = with pkgs; [ + nodejs-16_x + nodePackages.yarn + nodePackages.expo-cli + ]; + } diff --git a/yarn.lock b/yarn.lock index c4986d6..26445d3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2321,10 +2321,10 @@ __metadata: languageName: node linkType: hard -"@next/env@npm:13.0.3": - version: 13.0.3 - resolution: "@next/env@npm:13.0.3" - checksum: ba9cbc710c266db16f299193ac52da7ab344f3df5d9666f7010bed62d35627ba6324da896e5fdb539042787d7dddf613cf2ea499d69a614506afdb5fd4013e32 +"@next/env@npm:13.4.13": + version: 13.4.13 + resolution: "@next/env@npm:13.4.13" + checksum: 94935ff1730de9fe00be238256ad1af3e5da7ae737e6ce5d261404ccc9245f2a18fee24afa7f3b27d7f7d1c16e2715c8eccb70260ab0c0a08e7bbaa95ed36211 languageName: node linkType: hard @@ -2337,93 +2337,65 @@ __metadata: languageName: node linkType: hard -"@next/swc-android-arm-eabi@npm:13.0.3": - version: 13.0.3 - resolution: "@next/swc-android-arm-eabi@npm:13.0.3" - conditions: os=android & cpu=arm - languageName: node - linkType: hard - -"@next/swc-android-arm64@npm:13.0.3": - version: 13.0.3 - resolution: "@next/swc-android-arm64@npm:13.0.3" - conditions: os=android & cpu=arm64 - languageName: node - linkType: hard - -"@next/swc-darwin-arm64@npm:13.0.3": - version: 13.0.3 - resolution: "@next/swc-darwin-arm64@npm:13.0.3" +"@next/swc-darwin-arm64@npm:13.4.13": + version: 13.4.13 + resolution: "@next/swc-darwin-arm64@npm:13.4.13" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@next/swc-darwin-x64@npm:13.0.3": - version: 13.0.3 - resolution: "@next/swc-darwin-x64@npm:13.0.3" +"@next/swc-darwin-x64@npm:13.4.13": + version: 13.4.13 + resolution: "@next/swc-darwin-x64@npm:13.4.13" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@next/swc-freebsd-x64@npm:13.0.3": - version: 13.0.3 - resolution: "@next/swc-freebsd-x64@npm:13.0.3" - conditions: os=freebsd & cpu=x64 - languageName: node - linkType: hard - -"@next/swc-linux-arm-gnueabihf@npm:13.0.3": - version: 13.0.3 - resolution: "@next/swc-linux-arm-gnueabihf@npm:13.0.3" - conditions: os=linux & cpu=arm - languageName: node - linkType: hard - -"@next/swc-linux-arm64-gnu@npm:13.0.3": - version: 13.0.3 - resolution: "@next/swc-linux-arm64-gnu@npm:13.0.3" +"@next/swc-linux-arm64-gnu@npm:13.4.13": + version: 13.4.13 + resolution: "@next/swc-linux-arm64-gnu@npm:13.4.13" conditions: os=linux & cpu=arm64 & libc=glibc languageName: node linkType: hard -"@next/swc-linux-arm64-musl@npm:13.0.3": - version: 13.0.3 - resolution: "@next/swc-linux-arm64-musl@npm:13.0.3" +"@next/swc-linux-arm64-musl@npm:13.4.13": + version: 13.4.13 + resolution: "@next/swc-linux-arm64-musl@npm:13.4.13" conditions: os=linux & cpu=arm64 & libc=musl languageName: node linkType: hard -"@next/swc-linux-x64-gnu@npm:13.0.3": - version: 13.0.3 - resolution: "@next/swc-linux-x64-gnu@npm:13.0.3" +"@next/swc-linux-x64-gnu@npm:13.4.13": + version: 13.4.13 + resolution: "@next/swc-linux-x64-gnu@npm:13.4.13" conditions: os=linux & cpu=x64 & libc=glibc languageName: node linkType: hard -"@next/swc-linux-x64-musl@npm:13.0.3": - version: 13.0.3 - resolution: "@next/swc-linux-x64-musl@npm:13.0.3" +"@next/swc-linux-x64-musl@npm:13.4.13": + version: 13.4.13 + resolution: "@next/swc-linux-x64-musl@npm:13.4.13" conditions: os=linux & cpu=x64 & libc=musl languageName: node linkType: hard -"@next/swc-win32-arm64-msvc@npm:13.0.3": - version: 13.0.3 - resolution: "@next/swc-win32-arm64-msvc@npm:13.0.3" +"@next/swc-win32-arm64-msvc@npm:13.4.13": + version: 13.4.13 + resolution: "@next/swc-win32-arm64-msvc@npm:13.4.13" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@next/swc-win32-ia32-msvc@npm:13.0.3": - version: 13.0.3 - resolution: "@next/swc-win32-ia32-msvc@npm:13.0.3" +"@next/swc-win32-ia32-msvc@npm:13.4.13": + version: 13.4.13 + resolution: "@next/swc-win32-ia32-msvc@npm:13.4.13" conditions: os=win32 & cpu=ia32 languageName: node linkType: hard -"@next/swc-win32-x64-msvc@npm:13.0.3": - version: 13.0.3 - resolution: "@next/swc-win32-x64-msvc@npm:13.0.3" +"@next/swc-win32-x64-msvc@npm:13.4.13": + version: 13.4.13 + resolution: "@next/swc-win32-x64-msvc@npm:13.4.13" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -2998,12 +2970,12 @@ __metadata: languageName: node linkType: hard -"@swc/helpers@npm:0.4.11": - version: 0.4.11 - resolution: "@swc/helpers@npm:0.4.11" +"@swc/helpers@npm:0.5.1": + version: 0.5.1 + resolution: "@swc/helpers@npm:0.5.1" dependencies: tslib: ^2.4.0 - checksum: 736857d524b41a8a4db81094e9b027f554004e0fa3e86325d85bdb38f7e6459ce022db079edb6c61ba0f46fe8583b3e663e95f7acbd13e51b8da6c34e45bba2e + checksum: 71e0e27234590435e4c62b97ef5e796f88e786841a38c7116a5e27a3eafa7b9ead7cdec5249b32165902076de78446945311c973e59bddf77c1e24f33a8f272a languageName: node linkType: hard @@ -4804,6 +4776,15 @@ __metadata: languageName: node linkType: hard +"busboy@npm:1.6.0": + version: 1.6.0 + resolution: "busboy@npm:1.6.0" + dependencies: + streamsearch: ^1.1.0 + checksum: 32801e2c0164e12106bf236291a00795c3c4e4b709ae02132883fe8478ba2ae23743b11c5735a0aae8afe65ac4b6ca4568b91f0d9fed1fdbc32ede824a73746e + languageName: node + linkType: hard + "bytes@npm:3.0.0": version: 3.0.0 resolution: "bytes@npm:3.0.0" @@ -8151,6 +8132,13 @@ __metadata: languageName: node linkType: hard +"glob-to-regexp@npm:^0.4.1": + version: 0.4.1 + resolution: "glob-to-regexp@npm:0.4.1" + checksum: e795f4e8f06d2a15e86f76e4d92751cf8bbfcf0157cea5c2f0f35678a8195a750b34096b1256e436f0cebc1883b5ff0888c47348443e69546a5a87f9e1eb1167 + languageName: node + linkType: hard + "glob@npm:7.1.6": version: 7.1.6 resolution: "glob@npm:7.1.6" @@ -11792,7 +11780,7 @@ __metadata: "@types/react-dom": 18.0.8 eslint: 8.27.0 eslint-config-next: 13.0.3 - next: 13.0.3 + next: 13.4.13 react: 18.2.0 react-dom: 18.2.0 typescript: 4.8.4 @@ -11800,48 +11788,37 @@ __metadata: languageName: unknown linkType: soft -"next@npm:13.0.3": - version: 13.0.3 - resolution: "next@npm:13.0.3" +"next@npm:13.4.13": + version: 13.4.13 + resolution: "next@npm:13.4.13" dependencies: - "@next/env": 13.0.3 - "@next/swc-android-arm-eabi": 13.0.3 - "@next/swc-android-arm64": 13.0.3 - "@next/swc-darwin-arm64": 13.0.3 - "@next/swc-darwin-x64": 13.0.3 - "@next/swc-freebsd-x64": 13.0.3 - "@next/swc-linux-arm-gnueabihf": 13.0.3 - "@next/swc-linux-arm64-gnu": 13.0.3 - "@next/swc-linux-arm64-musl": 13.0.3 - "@next/swc-linux-x64-gnu": 13.0.3 - "@next/swc-linux-x64-musl": 13.0.3 - "@next/swc-win32-arm64-msvc": 13.0.3 - "@next/swc-win32-ia32-msvc": 13.0.3 - "@next/swc-win32-x64-msvc": 13.0.3 - "@swc/helpers": 0.4.11 + "@next/env": 13.4.13 + "@next/swc-darwin-arm64": 13.4.13 + "@next/swc-darwin-x64": 13.4.13 + "@next/swc-linux-arm64-gnu": 13.4.13 + "@next/swc-linux-arm64-musl": 13.4.13 + "@next/swc-linux-x64-gnu": 13.4.13 + "@next/swc-linux-x64-musl": 13.4.13 + "@next/swc-win32-arm64-msvc": 13.4.13 + "@next/swc-win32-ia32-msvc": 13.4.13 + "@next/swc-win32-x64-msvc": 13.4.13 + "@swc/helpers": 0.5.1 + busboy: 1.6.0 caniuse-lite: ^1.0.30001406 postcss: 8.4.14 - styled-jsx: 5.1.0 - use-sync-external-store: 1.2.0 + styled-jsx: 5.1.1 + watchpack: 2.4.0 + zod: 3.21.4 peerDependencies: - fibers: ">= 3.1.0" - node-sass: ^6.0.0 || ^7.0.0 + "@opentelemetry/api": ^1.1.0 react: ^18.2.0 react-dom: ^18.2.0 sass: ^1.3.0 dependenciesMeta: - "@next/swc-android-arm-eabi": - optional: true - "@next/swc-android-arm64": - optional: true "@next/swc-darwin-arm64": optional: true "@next/swc-darwin-x64": optional: true - "@next/swc-freebsd-x64": - optional: true - "@next/swc-linux-arm-gnueabihf": - optional: true "@next/swc-linux-arm64-gnu": optional: true "@next/swc-linux-arm64-musl": @@ -11857,15 +11834,13 @@ __metadata: "@next/swc-win32-x64-msvc": optional: true peerDependenciesMeta: - fibers: - optional: true - node-sass: + "@opentelemetry/api": optional: true sass: optional: true bin: next: dist/bin/next - checksum: f1f6e8a574476fc5f897681756497dd3c4f7ac7d304eafa6f45f549e60af4856eee022e6fabb9a1683a79100d19827a19abc0c25f212540f1e59597deae1c52e + checksum: 49c161ffafa0f63ee07d37720431aa92dd95b1f593519d729116904b1d61e8fd2b51ed97546f9ac4406132f74198010277022948fa27cac1c82571abeba2a6cd languageName: node linkType: hard @@ -15226,6 +15201,13 @@ __metadata: languageName: node linkType: hard +"streamsearch@npm:^1.1.0": + version: 1.1.0 + resolution: "streamsearch@npm:1.1.0" + checksum: 1cce16cea8405d7a233d32ca5e00a00169cc0e19fbc02aa839959985f267335d435c07f96e5e0edd0eadc6d39c98d5435fb5bbbdefc62c41834eadc5622ad942 + languageName: node + linkType: hard + "string-width@npm:^1.0.2 || 2 || 3 || 4, string-width@npm:^4.1.0, string-width@npm:^4.2.0, string-width@npm:^4.2.3": version: 4.2.3 resolution: "string-width@npm:4.2.3" @@ -15394,9 +15376,9 @@ __metadata: languageName: node linkType: hard -"styled-jsx@npm:5.1.0": - version: 5.1.0 - resolution: "styled-jsx@npm:5.1.0" +"styled-jsx@npm:5.1.1": + version: 5.1.1 + resolution: "styled-jsx@npm:5.1.1" dependencies: client-only: 0.0.1 peerDependencies: @@ -15406,7 +15388,7 @@ __metadata: optional: true babel-plugin-macros: optional: true - checksum: e5b70476fd9059147dfe35dd912e537e422a7f900cc88f80456c97da495c655598875d64de2199641d627770a7e55ed08be0fd82646bc386791fdb1d0e5af2b1 + checksum: 523a33b38603492547e861b98e29c873939b04e15fbe5ef16132c6f1e15958126647983c7d4675325038b428a5e91183d996e90141b18bdd1bbadf6e2c45b2fa languageName: node linkType: hard @@ -16328,7 +16310,7 @@ __metadata: languageName: node linkType: hard -"use-sync-external-store@npm:1.2.0, use-sync-external-store@npm:^1.0.0": +"use-sync-external-store@npm:^1.0.0": version: 1.2.0 resolution: "use-sync-external-store@npm:1.2.0" peerDependencies: @@ -16508,6 +16490,16 @@ __metadata: languageName: node linkType: hard +"watchpack@npm:2.4.0": + version: 2.4.0 + resolution: "watchpack@npm:2.4.0" + dependencies: + glob-to-regexp: ^0.4.1 + graceful-fs: ^4.1.2 + checksum: 23d4bc58634dbe13b86093e01c6a68d8096028b664ab7139d58f0c37d962d549a940e98f2f201cecdabd6f9c340338dc73ef8bf094a2249ef582f35183d1a131 + languageName: node + linkType: hard + "watchpack@npm:^1.6.1": version: 1.7.5 resolution: "watchpack@npm:1.7.5" @@ -17090,3 +17082,10 @@ __metadata: optional: true languageName: unknown linkType: soft + +"zod@npm:3.21.4": + version: 3.21.4 + resolution: "zod@npm:3.21.4" + checksum: f185ba87342ff16f7a06686767c2b2a7af41110c7edf7c1974095d8db7a73792696bcb4a00853de0d2edeb34a5b2ea6a55871bc864227dace682a0a28de33e1f + languageName: node + linkType: hard