MCPcopy Create free account
hub / github.com/neplextech/vectorizer / requireNative

Function requireNative

js-bindings.js:66–659  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

64};
65
66function requireNative() {
67 if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
68 try {
69 return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
70 } catch (err) {
71 loadErrors.push(err);
72 }
73 } else if (process.platform === 'android') {
74 if (process.arch === 'arm64') {
75 try {
76 return require('./vectorizer.android-arm64.node');
77 } catch (e) {
78 loadErrors.push(e);
79 }
80 try {
81 const binding = require('@neplex/vectorizer-android-arm64');
82 const bindingPackageVersion = require('@neplex/vectorizer-android-arm64/package.json').version;
83 if (
84 bindingPackageVersion !== '0.0.5' &&
85 process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
86 process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
87 ) {
88 throw new Error(
89 `Native binding package version mismatch, expected 0.0.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
90 );
91 }
92 return binding;
93 } catch (e) {
94 loadErrors.push(e);
95 }
96 } else if (process.arch === 'arm') {
97 try {
98 return require('./vectorizer.android-arm-eabi.node');
99 } catch (e) {
100 loadErrors.push(e);
101 }
102 try {
103 const binding = require('@neplex/vectorizer-android-arm-eabi');
104 const bindingPackageVersion = require('@neplex/vectorizer-android-arm-eabi/package.json').version;
105 if (
106 bindingPackageVersion !== '0.0.5' &&
107 process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
108 process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
109 ) {
110 throw new Error(
111 `Native binding package version mismatch, expected 0.0.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
112 );
113 }
114 return binding;
115 } catch (e) {
116 loadErrors.push(e);
117 }
118 } else {
119 loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`));
120 }
121 } else if (process.platform === 'win32') {
122 if (process.arch === 'x64') {
123 try {

Callers 1

js-bindings.jsFile · 0.85

Calls 1

isMuslFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…