Refactor `requireNodeAddon` to take the package name and extension-less path of an addon
還沒有人認領這個 Issue。
評估
- 難度
- 5/5
- 預估耗時
- 一週以上
- 新手友好度
- 25/100
- Issue 類型
- 重構
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 技術堆疊
- node.js, react-native, typescript
研究方向
先定位範例中的 requireNodeAddon 進入點,以及由 index.js 和 index.d.ts 表示的公開宣告。將要求的 packageName 與無副檔名路徑 API,和各平台的實作進行比較,包括 Node.js process.dlopen 路徑與 node 匯出條件;當相同的呼叫引數能在所述平台上運作時,即表示完成。
由索引模型根據 Issue 內容生成。
描述
This is a suggestion which is subtly different from the one proposed in https://github.com/callstackincubator/react-native-node-api/issues/91.
Goals
- Removing the requirement for the Babel plugin, for use-cases where a library author "controls" the code calling into the host package.
- Give more control to the host package when deciding what library files to loads (at runtime).
- Supporting multiple platforms (including Node.js) with source-code calling into the host package with the same call arguments
- In particular Node.js by providing a "node" export condition implementing
requireNodeAddonby calling intoprocess.dlopen.
- In particular Node.js by providing a "node" export condition implementing
Example library
Imagine a library ("my-lib") with a single index.js entrypoint calling into our host package:
// node_modules/my-lib/index.js
import { requireNodeAddon } from "react-native-node-api";
const addon = requireNodeAddon({
packageName: "my-lib", // The name from the package.json
path: "build/Release/hello" // Path to the addon, relative to the package root, stripped from its ".*.node" file extensions.
});
export const sum = addon.sum;
and the following directory structure:
index.js
index.d.ts
build/Release
├── hello.android.node
│ ├── arm64-v8a
│ │ └── libhello.so
│ ├── armeabi-v7a
│ │ └── libhello.so
│ ├── react-native-node-api-module
│ ├── x86
│ │ └── libhello.so
│ └── x86_64
│ └── libhello.so
├── hello.apple.node
│ ├── Info.plist
│ ├── ios-arm64
│ │ └── hello.framework
│ │ ├── Headers
│ │ ├── hello
│ │ └── Info.plist
│ ├── ios-arm64-simulator
│ │ └── hello.framework
│ │ ├── Headers
│ │ ├── hello
│ │ └── Info.plist
│ ├── macos-arm64_x86_64
│ │ └── hello.framework
│ │ ├── Headers
│ │ ├── hello
│ │ └── Info.plist
│ ├── react-native-node-api-module
│ ├── tvos-arm64
│ │ └── hello.framework
│ │ ├── Headers
│ │ ├── hello
│ │ └── Info.plist
│ ├── tvos-arm64-simulator
│ │ └── hello.framework
│ │ ├── Headers
│ │ ├── hello
│ │ └── Info.plist
│ ├── xros-arm64
│ │ └── hello.framework
│ │ ├── Headers
│ │ ├── hello
│ │ └── Info.plist
│ └── xros-arm64-simulator
│ └── hello.framework
│ ├── Headers
│ ├── hello
│ └── Info.plist
└── hello.nodejs.node
├── darwin-arm64
│ └── hello.node
└── react-native-node-api-module
- 主要語言
- TypeScript
- 星號
- 188
- 分支
- 10
- 平均合併
- 2 天 17 小時
- 30 天內合併 PR
- 3
貢獻指南
這個儲存庫沒有索引到貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
callstackincubator/react-native-node-api 的其他 Issue
-
Android 🤖
難度 2/5 1-3 小時 新手友好度 66/100
-
Sanity check of Hermes source directory via environment variable, when building Android projects 未關閉Android 🤖 good first issue
難度 2/5 1-3 小時 新手友好度 78/100
callstackincubator/react-native-node-api#163 · 1 則留言 ·
-
enhancement good first issue gyp-to-cmake
難度 2/5 1-3 小時 新手友好度 72/100
callstackincubator/react-native-node-api#161 · 3 則留言 · 1 個 reaction ·
-
enhancement Host 🏡
難度 5/5 一週以上 新手友好度 25/100
-
Automatable good first issue
難度 3/5 1-2 天 新手友好度 15/100
callstackincubator/react-native-node-api#424 · 1 則留言 ·
查看 callstackincubator/react-native-node-api 的全部 Issue
相似的 Issue
-
VerificationGate: ATTRIBUTION quote guard never matches a normal quotation (\b around the quote) 未關閉
難度 2/5 1-3 小時 新手友好度 75/100
danielmiessler/LifeOS#2234 ·
-
T: Bug
難度 2/5 1-3 小時 新手友好度 75/100
-
難度 2/5 1-3 小時 新手友好度 65/100
-
難度 1/5 1 小時以內 新手友好度 85/100
-
Mend: dependency security vulnerability untriaged
難度 2/5 1-3 小時 新手友好度 70/100