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

feat: use node logic for globals and modules #215

Merged
merged 3 commits into from Jul 24, 2023
Merged

Conversation

edusperoni
Copy link
Collaborator

@edusperoni edusperoni commented May 11, 2023

Draft on how new modules and globals could work

Instead of calling Init manually on the runtime, each module would register itself either as a global (NODE_BINDING_PER_ISOLATE_INIT_OBJ) or as a node module (NODE_BINDING_CONTEXT_AWARE_INTERNAL).

Globals are already working, we still need work for the node modules (essentially check if a module is a native module and call it + cache it).

This will allow us to require('ns:crypto'), for example. In the future, we could even rework the way we use native libraries so you can do: import { NSString } from 'ns:native:Foundation' to get a slimmer app size and automatic metadata filtering through bundlers

NativeScript/NativeScript#195

@cla-bot cla-bot bot added the cla: yes label May 11, 2023
@edusperoni edusperoni marked this pull request as ready for review July 24, 2023 01:42
@edusperoni edusperoni merged commit a66cc42 into main Jul 24, 2023
3 checks passed
@edusperoni edusperoni deleted the feat/node-bindings branch July 24, 2023 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants