Refactor `requireNodeAddon` to take the package name and extension-less path of an addon
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- node.js, react-native, typescript
- Lĩnh vực
- backend-api-design, mobile-dev
Hướng nghiên cứu
Bắt đầu bằng cách xác định điểm vào requireNodeAddon và các khai báo công khai được biểu diễn bởi index.js và index.d.ts trong ví dụ. So sánh API packageName và đường dẫn không có phần mở rộng được yêu cầu với các triển khai trên nền tảng, bao gồm đường dẫn Node.js process.dlopen và điều kiện export node; hoàn tất khi cùng các đối số gọi hoạt động trên các nền tảng đã nêu.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- TypeScript
- Star
- 188
- Fork
- 10
- Merge trung bình
- 2 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 3
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của callstackincubator/react-native-node-api
-
Android 🤖
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
-
Sanity check of Hermes source directory via environment variable, when building Android projects Đang mởAndroid 🤖 good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
callstackincubator/react-native-node-api#163 · 1 bình luận ·
-
enhancement good first issue gyp-to-cmake
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
callstackincubator/react-native-node-api#161 · 3 bình luận · 1 reaction ·
-
enhancement Host 🏡
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
-
Automatable good first issue
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 15/100
callstackincubator/react-native-node-api#424 · 1 bình luận ·
Tất cả issue của callstackincubator/react-native-node-api
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
mksglu/context-mode#1200 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
jaegertracing/jaeger-ui#4506 ·
-
area:desktop area:ui bug platform:macos
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
anthropics/claude-code#96687 ·
-
good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
AOSSIE-Org/DebateAI#582 · 2 bình luận ·