quilltap 3.1.0-dev.27 → 3.1.0-dev.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/quilltap.js +25 -11
- package/package.json +1 -1
package/bin/quilltap.js
CHANGED
|
@@ -118,19 +118,33 @@ function openBrowser(url) {
|
|
|
118
118
|
// This handles the case where npx caches the package but the user upgrades
|
|
119
119
|
// Node.js — the cached native modules will have a stale NODE_MODULE_VERSION.
|
|
120
120
|
function ensureNativeModules() {
|
|
121
|
-
const nativeModules = ['better-sqlite3', 'sharp'];
|
|
122
121
|
const needsRebuild = [];
|
|
123
122
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
123
|
+
// Check better-sqlite3: it lazy-loads the native .node binary only when you
|
|
124
|
+
// create a Database, so a bare require('better-sqlite3') always succeeds.
|
|
125
|
+
// We must load the native binding directly to detect NODE_MODULE_VERSION mismatches.
|
|
126
|
+
try {
|
|
127
|
+
const bindingsPath = path.join(
|
|
128
|
+
PACKAGE_DIR, 'node_modules', 'better-sqlite3', 'build', 'Release', 'better_sqlite3.node'
|
|
129
|
+
);
|
|
130
|
+
require(bindingsPath);
|
|
131
|
+
} catch (err) {
|
|
132
|
+
if (err.message && err.message.includes('NODE_MODULE_VERSION')) {
|
|
133
|
+
needsRebuild.push('better-sqlite3');
|
|
134
|
+
} else if (err.code === 'MODULE_NOT_FOUND') {
|
|
135
|
+
needsRebuild.push('better-sqlite3');
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Check sharp: loads its native binding eagerly on require, but we use
|
|
140
|
+
// the same explicit-path approach for consistency and reliability.
|
|
141
|
+
try {
|
|
142
|
+
require('sharp');
|
|
143
|
+
} catch (err) {
|
|
144
|
+
if (err.message && err.message.includes('NODE_MODULE_VERSION')) {
|
|
145
|
+
needsRebuild.push('sharp');
|
|
146
|
+
} else if (err.code === 'MODULE_NOT_FOUND') {
|
|
147
|
+
needsRebuild.push('sharp');
|
|
134
148
|
}
|
|
135
149
|
}
|
|
136
150
|
|