@tailwindcss/oxide 4.1.13 → 4.1.15

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.
Files changed (3) hide show
  1. package/index.js +313 -112
  2. package/package.json +21 -28
  3. package/scripts/install.js +0 -143
package/index.js CHANGED
@@ -66,9 +66,9 @@ const isMuslFromChildProcess = () => {
66
66
  function requireNative() {
67
67
  if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
68
68
  try {
69
- nativeBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
69
+ return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
70
70
  } catch (err) {
71
- loadErrors.push(err);
71
+ loadErrors.push(err)
72
72
  }
73
73
  } else if (process.platform === 'android') {
74
74
  if (process.arch === 'arm64') {
@@ -78,11 +78,15 @@ function requireNative() {
78
78
  loadErrors.push(e)
79
79
  }
80
80
  try {
81
- return require('@tailwindcss/oxide-android-arm64')
81
+ const binding = require('@tailwindcss/oxide-android-arm64')
82
+ const bindingPackageVersion = require('@tailwindcss/oxide-android-arm64/package.json').version
83
+ if (bindingPackageVersion !== '4.1.15' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
84
+ throw new Error(`Native binding package version mismatch, expected 4.1.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
85
+ }
86
+ return binding
82
87
  } catch (e) {
83
88
  loadErrors.push(e)
84
89
  }
85
-
86
90
  } else if (process.arch === 'arm') {
87
91
  try {
88
92
  return require('./tailwindcss-oxide.android-arm-eabi.node')
@@ -90,27 +94,53 @@ function requireNative() {
90
94
  loadErrors.push(e)
91
95
  }
92
96
  try {
93
- return require('@tailwindcss/oxide-android-arm-eabi')
97
+ const binding = require('@tailwindcss/oxide-android-arm-eabi')
98
+ const bindingPackageVersion = require('@tailwindcss/oxide-android-arm-eabi/package.json').version
99
+ if (bindingPackageVersion !== '4.1.15' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
100
+ throw new Error(`Native binding package version mismatch, expected 4.1.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
101
+ }
102
+ return binding
94
103
  } catch (e) {
95
104
  loadErrors.push(e)
96
105
  }
97
-
98
106
  } else {
99
107
  loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
100
108
  }
101
109
  } else if (process.platform === 'win32') {
102
110
  if (process.arch === 'x64') {
111
+ if (process.report?.getReport?.()?.header?.osName?.startsWith?.('MINGW')) {
112
+ try {
113
+ return require('./tailwindcss-oxide.win32-x64-gnu.node')
114
+ } catch (e) {
115
+ loadErrors.push(e)
116
+ }
103
117
  try {
118
+ const binding = require('@tailwindcss/oxide-win32-x64-gnu')
119
+ const bindingPackageVersion = require('@tailwindcss/oxide-win32-x64-gnu/package.json').version
120
+ if (bindingPackageVersion !== '4.1.15' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
121
+ throw new Error(`Native binding package version mismatch, expected 4.1.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
122
+ }
123
+ return binding
124
+ } catch (e) {
125
+ loadErrors.push(e)
126
+ }
127
+ } else {
128
+ try {
104
129
  return require('./tailwindcss-oxide.win32-x64-msvc.node')
105
130
  } catch (e) {
106
131
  loadErrors.push(e)
107
132
  }
108
133
  try {
109
- return require('@tailwindcss/oxide-win32-x64-msvc')
134
+ const binding = require('@tailwindcss/oxide-win32-x64-msvc')
135
+ const bindingPackageVersion = require('@tailwindcss/oxide-win32-x64-msvc/package.json').version
136
+ if (bindingPackageVersion !== '4.1.15' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
137
+ throw new Error(`Native binding package version mismatch, expected 4.1.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
138
+ }
139
+ return binding
110
140
  } catch (e) {
111
141
  loadErrors.push(e)
112
142
  }
113
-
143
+ }
114
144
  } else if (process.arch === 'ia32') {
115
145
  try {
116
146
  return require('./tailwindcss-oxide.win32-ia32-msvc.node')
@@ -118,11 +148,15 @@ function requireNative() {
118
148
  loadErrors.push(e)
119
149
  }
120
150
  try {
121
- return require('@tailwindcss/oxide-win32-ia32-msvc')
151
+ const binding = require('@tailwindcss/oxide-win32-ia32-msvc')
152
+ const bindingPackageVersion = require('@tailwindcss/oxide-win32-ia32-msvc/package.json').version
153
+ if (bindingPackageVersion !== '4.1.15' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
154
+ throw new Error(`Native binding package version mismatch, expected 4.1.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
155
+ }
156
+ return binding
122
157
  } catch (e) {
123
158
  loadErrors.push(e)
124
159
  }
125
-
126
160
  } else if (process.arch === 'arm64') {
127
161
  try {
128
162
  return require('./tailwindcss-oxide.win32-arm64-msvc.node')
@@ -130,26 +164,34 @@ function requireNative() {
130
164
  loadErrors.push(e)
131
165
  }
132
166
  try {
133
- return require('@tailwindcss/oxide-win32-arm64-msvc')
167
+ const binding = require('@tailwindcss/oxide-win32-arm64-msvc')
168
+ const bindingPackageVersion = require('@tailwindcss/oxide-win32-arm64-msvc/package.json').version
169
+ if (bindingPackageVersion !== '4.1.15' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
170
+ throw new Error(`Native binding package version mismatch, expected 4.1.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
171
+ }
172
+ return binding
134
173
  } catch (e) {
135
174
  loadErrors.push(e)
136
175
  }
137
-
138
176
  } else {
139
177
  loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
140
178
  }
141
179
  } else if (process.platform === 'darwin') {
142
180
  try {
143
- return require('./tailwindcss-oxide.darwin-universal.node')
144
- } catch (e) {
145
- loadErrors.push(e)
146
- }
147
- try {
148
- return require('@tailwindcss/oxide-darwin-universal')
149
- } catch (e) {
150
- loadErrors.push(e)
151
- }
152
-
181
+ return require('./tailwindcss-oxide.darwin-universal.node')
182
+ } catch (e) {
183
+ loadErrors.push(e)
184
+ }
185
+ try {
186
+ const binding = require('@tailwindcss/oxide-darwin-universal')
187
+ const bindingPackageVersion = require('@tailwindcss/oxide-darwin-universal/package.json').version
188
+ if (bindingPackageVersion !== '4.1.15' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
189
+ throw new Error(`Native binding package version mismatch, expected 4.1.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
190
+ }
191
+ return binding
192
+ } catch (e) {
193
+ loadErrors.push(e)
194
+ }
153
195
  if (process.arch === 'x64') {
154
196
  try {
155
197
  return require('./tailwindcss-oxide.darwin-x64.node')
@@ -157,11 +199,15 @@ function requireNative() {
157
199
  loadErrors.push(e)
158
200
  }
159
201
  try {
160
- return require('@tailwindcss/oxide-darwin-x64')
202
+ const binding = require('@tailwindcss/oxide-darwin-x64')
203
+ const bindingPackageVersion = require('@tailwindcss/oxide-darwin-x64/package.json').version
204
+ if (bindingPackageVersion !== '4.1.15' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
205
+ throw new Error(`Native binding package version mismatch, expected 4.1.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
206
+ }
207
+ return binding
161
208
  } catch (e) {
162
209
  loadErrors.push(e)
163
210
  }
164
-
165
211
  } else if (process.arch === 'arm64') {
166
212
  try {
167
213
  return require('./tailwindcss-oxide.darwin-arm64.node')
@@ -169,11 +215,15 @@ function requireNative() {
169
215
  loadErrors.push(e)
170
216
  }
171
217
  try {
172
- return require('@tailwindcss/oxide-darwin-arm64')
218
+ const binding = require('@tailwindcss/oxide-darwin-arm64')
219
+ const bindingPackageVersion = require('@tailwindcss/oxide-darwin-arm64/package.json').version
220
+ if (bindingPackageVersion !== '4.1.15' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
221
+ throw new Error(`Native binding package version mismatch, expected 4.1.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
222
+ }
223
+ return binding
173
224
  } catch (e) {
174
225
  loadErrors.push(e)
175
226
  }
176
-
177
227
  } else {
178
228
  loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
179
229
  }
@@ -185,11 +235,15 @@ function requireNative() {
185
235
  loadErrors.push(e)
186
236
  }
187
237
  try {
188
- return require('@tailwindcss/oxide-freebsd-x64')
238
+ const binding = require('@tailwindcss/oxide-freebsd-x64')
239
+ const bindingPackageVersion = require('@tailwindcss/oxide-freebsd-x64/package.json').version
240
+ if (bindingPackageVersion !== '4.1.15' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
241
+ throw new Error(`Native binding package version mismatch, expected 4.1.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
242
+ }
243
+ return binding
189
244
  } catch (e) {
190
245
  loadErrors.push(e)
191
246
  }
192
-
193
247
  } else if (process.arch === 'arm64') {
194
248
  try {
195
249
  return require('./tailwindcss-oxide.freebsd-arm64.node')
@@ -197,11 +251,15 @@ function requireNative() {
197
251
  loadErrors.push(e)
198
252
  }
199
253
  try {
200
- return require('@tailwindcss/oxide-freebsd-arm64')
254
+ const binding = require('@tailwindcss/oxide-freebsd-arm64')
255
+ const bindingPackageVersion = require('@tailwindcss/oxide-freebsd-arm64/package.json').version
256
+ if (bindingPackageVersion !== '4.1.15' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
257
+ throw new Error(`Native binding package version mismatch, expected 4.1.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
258
+ }
259
+ return binding
201
260
  } catch (e) {
202
261
  loadErrors.push(e)
203
262
  }
204
-
205
263
  } else {
206
264
  loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
207
265
  }
@@ -209,133 +267,259 @@ function requireNative() {
209
267
  if (process.arch === 'x64') {
210
268
  if (isMusl()) {
211
269
  try {
212
- return require('./tailwindcss-oxide.linux-x64-musl.node')
213
- } catch (e) {
214
- loadErrors.push(e)
215
- }
216
- try {
217
- return require('@tailwindcss/oxide-linux-x64-musl')
218
- } catch (e) {
219
- loadErrors.push(e)
220
- }
221
-
270
+ return require('./tailwindcss-oxide.linux-x64-musl.node')
271
+ } catch (e) {
272
+ loadErrors.push(e)
273
+ }
274
+ try {
275
+ const binding = require('@tailwindcss/oxide-linux-x64-musl')
276
+ const bindingPackageVersion = require('@tailwindcss/oxide-linux-x64-musl/package.json').version
277
+ if (bindingPackageVersion !== '4.1.15' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
278
+ throw new Error(`Native binding package version mismatch, expected 4.1.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
279
+ }
280
+ return binding
281
+ } catch (e) {
282
+ loadErrors.push(e)
283
+ }
222
284
  } else {
223
285
  try {
224
- return require('./tailwindcss-oxide.linux-x64-gnu.node')
225
- } catch (e) {
226
- loadErrors.push(e)
227
- }
228
- try {
229
- return require('@tailwindcss/oxide-linux-x64-gnu')
230
- } catch (e) {
231
- loadErrors.push(e)
232
- }
233
-
286
+ return require('./tailwindcss-oxide.linux-x64-gnu.node')
287
+ } catch (e) {
288
+ loadErrors.push(e)
289
+ }
290
+ try {
291
+ const binding = require('@tailwindcss/oxide-linux-x64-gnu')
292
+ const bindingPackageVersion = require('@tailwindcss/oxide-linux-x64-gnu/package.json').version
293
+ if (bindingPackageVersion !== '4.1.15' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
294
+ throw new Error(`Native binding package version mismatch, expected 4.1.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
295
+ }
296
+ return binding
297
+ } catch (e) {
298
+ loadErrors.push(e)
299
+ }
234
300
  }
235
301
  } else if (process.arch === 'arm64') {
236
302
  if (isMusl()) {
237
303
  try {
238
- return require('./tailwindcss-oxide.linux-arm64-musl.node')
239
- } catch (e) {
240
- loadErrors.push(e)
241
- }
242
- try {
243
- return require('@tailwindcss/oxide-linux-arm64-musl')
244
- } catch (e) {
245
- loadErrors.push(e)
246
- }
247
-
304
+ return require('./tailwindcss-oxide.linux-arm64-musl.node')
305
+ } catch (e) {
306
+ loadErrors.push(e)
307
+ }
308
+ try {
309
+ const binding = require('@tailwindcss/oxide-linux-arm64-musl')
310
+ const bindingPackageVersion = require('@tailwindcss/oxide-linux-arm64-musl/package.json').version
311
+ if (bindingPackageVersion !== '4.1.15' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
312
+ throw new Error(`Native binding package version mismatch, expected 4.1.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
313
+ }
314
+ return binding
315
+ } catch (e) {
316
+ loadErrors.push(e)
317
+ }
248
318
  } else {
249
319
  try {
250
- return require('./tailwindcss-oxide.linux-arm64-gnu.node')
251
- } catch (e) {
252
- loadErrors.push(e)
253
- }
254
- try {
255
- return require('@tailwindcss/oxide-linux-arm64-gnu')
256
- } catch (e) {
257
- loadErrors.push(e)
258
- }
259
-
320
+ return require('./tailwindcss-oxide.linux-arm64-gnu.node')
321
+ } catch (e) {
322
+ loadErrors.push(e)
323
+ }
324
+ try {
325
+ const binding = require('@tailwindcss/oxide-linux-arm64-gnu')
326
+ const bindingPackageVersion = require('@tailwindcss/oxide-linux-arm64-gnu/package.json').version
327
+ if (bindingPackageVersion !== '4.1.15' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
328
+ throw new Error(`Native binding package version mismatch, expected 4.1.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
329
+ }
330
+ return binding
331
+ } catch (e) {
332
+ loadErrors.push(e)
333
+ }
260
334
  }
261
335
  } else if (process.arch === 'arm') {
262
336
  if (isMusl()) {
263
337
  try {
264
- return require('./tailwindcss-oxide.linux-arm-musleabihf.node')
265
- } catch (e) {
266
- loadErrors.push(e)
267
- }
268
- try {
269
- return require('@tailwindcss/oxide-linux-arm-musleabihf')
270
- } catch (e) {
271
- loadErrors.push(e)
338
+ return require('./tailwindcss-oxide.linux-arm-musleabihf.node')
339
+ } catch (e) {
340
+ loadErrors.push(e)
341
+ }
342
+ try {
343
+ const binding = require('@tailwindcss/oxide-linux-arm-musleabihf')
344
+ const bindingPackageVersion = require('@tailwindcss/oxide-linux-arm-musleabihf/package.json').version
345
+ if (bindingPackageVersion !== '4.1.15' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
346
+ throw new Error(`Native binding package version mismatch, expected 4.1.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
347
+ }
348
+ return binding
349
+ } catch (e) {
350
+ loadErrors.push(e)
351
+ }
352
+ } else {
353
+ try {
354
+ return require('./tailwindcss-oxide.linux-arm-gnueabihf.node')
355
+ } catch (e) {
356
+ loadErrors.push(e)
357
+ }
358
+ try {
359
+ const binding = require('@tailwindcss/oxide-linux-arm-gnueabihf')
360
+ const bindingPackageVersion = require('@tailwindcss/oxide-linux-arm-gnueabihf/package.json').version
361
+ if (bindingPackageVersion !== '4.1.15' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
362
+ throw new Error(`Native binding package version mismatch, expected 4.1.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
363
+ }
364
+ return binding
365
+ } catch (e) {
366
+ loadErrors.push(e)
367
+ }
368
+ }
369
+ } else if (process.arch === 'loong64') {
370
+ if (isMusl()) {
371
+ try {
372
+ return require('./tailwindcss-oxide.linux-loong64-musl.node')
373
+ } catch (e) {
374
+ loadErrors.push(e)
375
+ }
376
+ try {
377
+ const binding = require('@tailwindcss/oxide-linux-loong64-musl')
378
+ const bindingPackageVersion = require('@tailwindcss/oxide-linux-loong64-musl/package.json').version
379
+ if (bindingPackageVersion !== '4.1.15' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
380
+ throw new Error(`Native binding package version mismatch, expected 4.1.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
381
+ }
382
+ return binding
383
+ } catch (e) {
384
+ loadErrors.push(e)
385
+ }
386
+ } else {
387
+ try {
388
+ return require('./tailwindcss-oxide.linux-loong64-gnu.node')
389
+ } catch (e) {
390
+ loadErrors.push(e)
391
+ }
392
+ try {
393
+ const binding = require('@tailwindcss/oxide-linux-loong64-gnu')
394
+ const bindingPackageVersion = require('@tailwindcss/oxide-linux-loong64-gnu/package.json').version
395
+ if (bindingPackageVersion !== '4.1.15' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
396
+ throw new Error(`Native binding package version mismatch, expected 4.1.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
397
+ }
398
+ return binding
399
+ } catch (e) {
400
+ loadErrors.push(e)
401
+ }
272
402
  }
273
-
403
+ } else if (process.arch === 'riscv64') {
404
+ if (isMusl()) {
405
+ try {
406
+ return require('./tailwindcss-oxide.linux-riscv64-musl.node')
407
+ } catch (e) {
408
+ loadErrors.push(e)
409
+ }
410
+ try {
411
+ const binding = require('@tailwindcss/oxide-linux-riscv64-musl')
412
+ const bindingPackageVersion = require('@tailwindcss/oxide-linux-riscv64-musl/package.json').version
413
+ if (bindingPackageVersion !== '4.1.15' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
414
+ throw new Error(`Native binding package version mismatch, expected 4.1.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
415
+ }
416
+ return binding
417
+ } catch (e) {
418
+ loadErrors.push(e)
419
+ }
274
420
  } else {
275
421
  try {
276
- return require('./tailwindcss-oxide.linux-arm-gnueabihf.node')
422
+ return require('./tailwindcss-oxide.linux-riscv64-gnu.node')
423
+ } catch (e) {
424
+ loadErrors.push(e)
425
+ }
426
+ try {
427
+ const binding = require('@tailwindcss/oxide-linux-riscv64-gnu')
428
+ const bindingPackageVersion = require('@tailwindcss/oxide-linux-riscv64-gnu/package.json').version
429
+ if (bindingPackageVersion !== '4.1.15' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
430
+ throw new Error(`Native binding package version mismatch, expected 4.1.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
431
+ }
432
+ return binding
433
+ } catch (e) {
434
+ loadErrors.push(e)
435
+ }
436
+ }
437
+ } else if (process.arch === 'ppc64') {
438
+ try {
439
+ return require('./tailwindcss-oxide.linux-ppc64-gnu.node')
277
440
  } catch (e) {
278
441
  loadErrors.push(e)
279
442
  }
280
443
  try {
281
- return require('@tailwindcss/oxide-linux-arm-gnueabihf')
444
+ const binding = require('@tailwindcss/oxide-linux-ppc64-gnu')
445
+ const bindingPackageVersion = require('@tailwindcss/oxide-linux-ppc64-gnu/package.json').version
446
+ if (bindingPackageVersion !== '4.1.15' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
447
+ throw new Error(`Native binding package version mismatch, expected 4.1.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
448
+ }
449
+ return binding
282
450
  } catch (e) {
283
451
  loadErrors.push(e)
284
452
  }
285
-
286
- }
287
- } else if (process.arch === 'riscv64') {
288
- if (isMusl()) {
289
- try {
290
- return require('./tailwindcss-oxide.linux-riscv64-musl.node')
453
+ } else if (process.arch === 's390x') {
454
+ try {
455
+ return require('./tailwindcss-oxide.linux-s390x-gnu.node')
291
456
  } catch (e) {
292
457
  loadErrors.push(e)
293
458
  }
294
459
  try {
295
- return require('@tailwindcss/oxide-linux-riscv64-musl')
460
+ const binding = require('@tailwindcss/oxide-linux-s390x-gnu')
461
+ const bindingPackageVersion = require('@tailwindcss/oxide-linux-s390x-gnu/package.json').version
462
+ if (bindingPackageVersion !== '4.1.15' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
463
+ throw new Error(`Native binding package version mismatch, expected 4.1.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
464
+ }
465
+ return binding
296
466
  } catch (e) {
297
467
  loadErrors.push(e)
298
468
  }
299
-
300
- } else {
301
- try {
302
- return require('./tailwindcss-oxide.linux-riscv64-gnu.node')
469
+ } else {
470
+ loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
471
+ }
472
+ } else if (process.platform === 'openharmony') {
473
+ if (process.arch === 'arm64') {
474
+ try {
475
+ return require('./tailwindcss-oxide.openharmony-arm64.node')
303
476
  } catch (e) {
304
477
  loadErrors.push(e)
305
478
  }
306
479
  try {
307
- return require('@tailwindcss/oxide-linux-riscv64-gnu')
480
+ const binding = require('@tailwindcss/oxide-openharmony-arm64')
481
+ const bindingPackageVersion = require('@tailwindcss/oxide-openharmony-arm64/package.json').version
482
+ if (bindingPackageVersion !== '4.1.15' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
483
+ throw new Error(`Native binding package version mismatch, expected 4.1.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
484
+ }
485
+ return binding
308
486
  } catch (e) {
309
487
  loadErrors.push(e)
310
488
  }
311
-
312
- }
313
- } else if (process.arch === 'ppc64') {
489
+ } else if (process.arch === 'x64') {
314
490
  try {
315
- return require('./tailwindcss-oxide.linux-ppc64-gnu.node')
491
+ return require('./tailwindcss-oxide.openharmony-x64.node')
316
492
  } catch (e) {
317
493
  loadErrors.push(e)
318
494
  }
319
495
  try {
320
- return require('@tailwindcss/oxide-linux-ppc64-gnu')
496
+ const binding = require('@tailwindcss/oxide-openharmony-x64')
497
+ const bindingPackageVersion = require('@tailwindcss/oxide-openharmony-x64/package.json').version
498
+ if (bindingPackageVersion !== '4.1.15' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
499
+ throw new Error(`Native binding package version mismatch, expected 4.1.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
500
+ }
501
+ return binding
321
502
  } catch (e) {
322
503
  loadErrors.push(e)
323
504
  }
324
-
325
- } else if (process.arch === 's390x') {
505
+ } else if (process.arch === 'arm') {
326
506
  try {
327
- return require('./tailwindcss-oxide.linux-s390x-gnu.node')
507
+ return require('./tailwindcss-oxide.openharmony-arm.node')
328
508
  } catch (e) {
329
509
  loadErrors.push(e)
330
510
  }
331
511
  try {
332
- return require('@tailwindcss/oxide-linux-s390x-gnu')
512
+ const binding = require('@tailwindcss/oxide-openharmony-arm')
513
+ const bindingPackageVersion = require('@tailwindcss/oxide-openharmony-arm/package.json').version
514
+ if (bindingPackageVersion !== '4.1.15' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
515
+ throw new Error(`Native binding package version mismatch, expected 4.1.15 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
516
+ }
517
+ return binding
333
518
  } catch (e) {
334
519
  loadErrors.push(e)
335
520
  }
336
-
337
521
  } else {
338
- loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
522
+ loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
339
523
  }
340
524
  } else {
341
525
  loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
@@ -345,33 +529,50 @@ function requireNative() {
345
529
  nativeBinding = requireNative()
346
530
 
347
531
  if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
532
+ let wasiBinding = null
533
+ let wasiBindingError = null
348
534
  try {
349
- nativeBinding = require('./tailwindcss-oxide.wasi.cjs')
535
+ wasiBinding = require('./tailwindcss-oxide.wasi.cjs')
536
+ nativeBinding = wasiBinding
350
537
  } catch (err) {
351
538
  if (process.env.NAPI_RS_FORCE_WASI) {
352
- loadErrors.push(err)
539
+ wasiBindingError = err
353
540
  }
354
541
  }
355
542
  if (!nativeBinding) {
356
543
  try {
357
- nativeBinding = require('@tailwindcss/oxide-wasm32-wasi')
544
+ wasiBinding = require('@tailwindcss/oxide-wasm32-wasi')
545
+ nativeBinding = wasiBinding
358
546
  } catch (err) {
359
547
  if (process.env.NAPI_RS_FORCE_WASI) {
548
+ wasiBindingError.cause = err
360
549
  loadErrors.push(err)
361
550
  }
362
551
  }
363
552
  }
553
+ if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
554
+ const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error')
555
+ error.cause = wasiBindingError
556
+ throw error
557
+ }
364
558
  }
365
559
 
366
560
  if (!nativeBinding) {
367
561
  if (loadErrors.length > 0) {
368
- // TODO Link to documentation with potential fixes
369
- // - The package owner could build/publish bindings for this arch
370
- // - The user may need to bundle the correct files
371
- // - The user may need to re-install node_modules to get new packages
372
- throw new Error('Failed to load native binding', { cause: loadErrors })
562
+ throw new Error(
563
+ `Cannot find native binding. ` +
564
+ `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
565
+ 'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
566
+ {
567
+ cause: loadErrors.reduce((err, cur) => {
568
+ cur.cause = err
569
+ return cur
570
+ }),
571
+ },
572
+ )
373
573
  }
374
574
  throw new Error(`Failed to load native binding`)
375
575
  }
376
576
 
577
+ module.exports = nativeBinding
377
578
  module.exports.Scanner = nativeBinding.Scanner
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailwindcss/oxide",
3
- "version": "4.1.13",
3
+ "version": "4.1.15",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/tailwindlabs/tailwindcss.git",
@@ -32,51 +32,44 @@
32
32
  }
33
33
  },
34
34
  "license": "MIT",
35
- "dependencies": {
36
- "tar": "^7.4.3",
37
- "detect-libc": "^2.0.4"
38
- },
39
35
  "devDependencies": {
40
- "@napi-rs/cli": "^3.0.0-alpha.78",
41
- "@napi-rs/wasm-runtime": "^0.2.12",
42
- "emnapi": "1.4.5"
36
+ "@napi-rs/cli": "^3.3.0",
37
+ "@napi-rs/wasm-runtime": "^1.0.7",
38
+ "emnapi": "1.5.0"
43
39
  },
44
40
  "engines": {
45
41
  "node": ">= 10"
46
42
  },
47
43
  "files": [
48
44
  "index.js",
49
- "index.d.ts",
50
- "scripts/install.js"
45
+ "index.d.ts"
51
46
  ],
52
47
  "publishConfig": {
53
48
  "provenance": true,
54
49
  "access": "public"
55
50
  },
56
51
  "optionalDependencies": {
57
- "@tailwindcss/oxide-android-arm64": "4.1.13",
58
- "@tailwindcss/oxide-linux-arm-gnueabihf": "4.1.13",
59
- "@tailwindcss/oxide-freebsd-x64": "4.1.13",
60
- "@tailwindcss/oxide-linux-arm64-musl": "4.1.13",
61
- "@tailwindcss/oxide-linux-x64-gnu": "4.1.13",
62
- "@tailwindcss/oxide-linux-arm64-gnu": "4.1.13",
63
- "@tailwindcss/oxide-linux-x64-musl": "4.1.13",
64
- "@tailwindcss/oxide-win32-arm64-msvc": "4.1.13",
65
- "@tailwindcss/oxide-darwin-x64": "4.1.13",
66
- "@tailwindcss/oxide-win32-x64-msvc": "4.1.13",
67
- "@tailwindcss/oxide-wasm32-wasi": "4.1.13",
68
- "@tailwindcss/oxide-darwin-arm64": "4.1.13"
52
+ "@tailwindcss/oxide-android-arm64": "4.1.15",
53
+ "@tailwindcss/oxide-darwin-arm64": "4.1.15",
54
+ "@tailwindcss/oxide-darwin-x64": "4.1.15",
55
+ "@tailwindcss/oxide-linux-arm-gnueabihf": "4.1.15",
56
+ "@tailwindcss/oxide-freebsd-x64": "4.1.15",
57
+ "@tailwindcss/oxide-linux-arm64-musl": "4.1.15",
58
+ "@tailwindcss/oxide-linux-arm64-gnu": "4.1.15",
59
+ "@tailwindcss/oxide-linux-x64-gnu": "4.1.15",
60
+ "@tailwindcss/oxide-linux-x64-musl": "4.1.15",
61
+ "@tailwindcss/oxide-wasm32-wasi": "4.1.15",
62
+ "@tailwindcss/oxide-win32-x64-msvc": "4.1.15",
63
+ "@tailwindcss/oxide-win32-arm64-msvc": "4.1.15"
69
64
  },
70
65
  "scripts": {
71
- "artifacts": "napi artifacts",
72
66
  "build": "pnpm run build:platform && pnpm run build:wasm",
73
- "build:platform": "napi build --platform --release --no-const-enum",
67
+ "build:platform": "napi build --platform --release",
74
68
  "postbuild:platform": "node ./scripts/move-artifacts.mjs",
75
- "build:wasm": "napi build --release --target wasm32-wasip1-threads --no-const-enum",
69
+ "build:wasm": "napi build --release --target wasm32-wasip1-threads",
76
70
  "postbuild:wasm": "node ./scripts/move-artifacts.mjs",
77
71
  "dev": "cargo watch --quiet --shell 'npm run build'",
78
- "build:debug": "napi build --platform --no-const-enum",
79
- "version": "napi version",
80
- "postinstall": "node ./scripts/install.js"
72
+ "build:debug": "napi build --platform",
73
+ "version": "napi version"
81
74
  }
82
75
  }
@@ -1,143 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * @tailwindcss/oxide postinstall script
5
- *
6
- * This script ensures that the correct binary for the current platform and
7
- * architecture is downloaded and available.
8
- */
9
-
10
- const fs = require('fs')
11
- const path = require('path')
12
- const https = require('https')
13
- const { extract } = require('tar')
14
- const packageJson = require('../package.json')
15
- const detectLibc = require('detect-libc')
16
-
17
- const version = packageJson.version
18
-
19
- function getPlatformPackageName() {
20
- let platform = process.platform
21
- let arch = process.arch
22
-
23
- let libc = ''
24
- if (platform === 'linux') {
25
- libc = detectLibc.isNonGlibcLinuxSync() ? 'musl' : 'gnu'
26
- }
27
-
28
- // Map to our package naming conventions
29
- switch (platform) {
30
- case 'darwin':
31
- return arch === 'arm64' ? '@tailwindcss/oxide-darwin-arm64' : '@tailwindcss/oxide-darwin-x64'
32
- case 'win32':
33
- if (arch === 'arm64') return '@tailwindcss/oxide-win32-arm64-msvc'
34
- if (arch === 'ia32') return '@tailwindcss/oxide-win32-ia32-msvc'
35
- return '@tailwindcss/oxide-win32-x64-msvc'
36
- case 'linux':
37
- if (arch === 'x64') {
38
- return libc === 'musl'
39
- ? '@tailwindcss/oxide-linux-x64-musl'
40
- : '@tailwindcss/oxide-linux-x64-gnu'
41
- } else if (arch === 'arm64') {
42
- return libc === 'musl'
43
- ? '@tailwindcss/oxide-linux-arm64-musl'
44
- : '@tailwindcss/oxide-linux-arm64-gnu'
45
- } else if (arch === 'arm') {
46
- return '@tailwindcss/oxide-linux-arm-gnueabihf'
47
- }
48
- break
49
- case 'freebsd':
50
- return '@tailwindcss/oxide-freebsd-x64'
51
- case 'android':
52
- return '@tailwindcss/oxide-android-arm64'
53
- default:
54
- return '@tailwindcss/oxide-wasm32-wasi'
55
- }
56
- }
57
-
58
- function isPackageAvailable(packageName) {
59
- try {
60
- require.resolve(packageName)
61
- return true
62
- } catch (e) {
63
- return false
64
- }
65
- }
66
-
67
- // Extract all files from a tarball to a destination directory
68
- async function extractTarball(tarballStream, destDir) {
69
- if (!fs.existsSync(destDir)) {
70
- fs.mkdirSync(destDir, { recursive: true })
71
- }
72
-
73
- return new Promise((resolve, reject) => {
74
- tarballStream
75
- .pipe(extract({ cwd: destDir, strip: 1 }))
76
- .on('error', (err) => reject(err))
77
- .on('end', () => resolve())
78
- })
79
- }
80
-
81
- async function downloadAndExtractBinary(packageName) {
82
- let tarballUrl = `https://registry.npmjs.org/${packageName}/-/${packageName.replace('@tailwindcss/', '')}-${version}.tgz`
83
- console.log(`Downloading ${tarballUrl}...`)
84
-
85
- return new Promise((resolve) => {
86
- https
87
- .get(tarballUrl, (response) => {
88
- if (response.statusCode === 302 || response.statusCode === 301) {
89
- // Handle redirects
90
- https.get(response.headers.location, handleResponse).on('error', (err) => {
91
- console.error('Download error:', err)
92
- resolve()
93
- })
94
- return
95
- }
96
-
97
- handleResponse(response)
98
-
99
- async function handleResponse(response) {
100
- try {
101
- if (response.statusCode !== 200) {
102
- throw new Error(`Download failed with status code: ${response.statusCode}`)
103
- }
104
-
105
- await extractTarball(
106
- response,
107
- path.join(__dirname, '..', 'node_modules', ...packageName.split('/')),
108
- )
109
- console.log(`Successfully downloaded and installed ${packageName}`)
110
- } catch (error) {
111
- console.error('Error during extraction:', error)
112
- resolve()
113
- } finally {
114
- resolve()
115
- }
116
- }
117
- })
118
- .on('error', (err) => {
119
- console.error('Download error:', err)
120
- resolve()
121
- })
122
- })
123
- }
124
-
125
- async function main() {
126
- // Don't run this script in the package source
127
- try {
128
- if (fs.existsSync(path.join(__dirname, '..', 'build.rs'))) {
129
- return
130
- }
131
-
132
- let packageName = getPlatformPackageName()
133
- if (!packageName) return
134
- if (isPackageAvailable(packageName)) return
135
-
136
- await downloadAndExtractBinary(packageName)
137
- } catch (error) {
138
- console.error(error)
139
- return
140
- }
141
- }
142
-
143
- main()