@tailwindcss/oxide 0.0.0-insiders.f2b5ed4 → 0.0.0-insiders.f302fce

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 -115
  2. package/package.json +22 -29
  3. package/scripts/install.js +0 -143
package/index.js CHANGED
@@ -3,9 +3,6 @@
3
3
  // @ts-nocheck
4
4
  /* auto-generated by NAPI-RS */
5
5
 
6
- const { createRequire } = require('node:module')
7
- require = createRequire(__filename)
8
-
9
6
  const { readFileSync } = require('node:fs')
10
7
  let nativeBinding = null
11
8
  const loadErrors = []
@@ -66,9 +63,9 @@ const isMuslFromChildProcess = () => {
66
63
  function requireNative() {
67
64
  if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
68
65
  try {
69
- nativeBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
66
+ return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
70
67
  } catch (err) {
71
- loadErrors.push(err);
68
+ loadErrors.push(err)
72
69
  }
73
70
  } else if (process.platform === 'android') {
74
71
  if (process.arch === 'arm64') {
@@ -78,11 +75,15 @@ function requireNative() {
78
75
  loadErrors.push(e)
79
76
  }
80
77
  try {
81
- return require('@tailwindcss/oxide-android-arm64')
78
+ const binding = require('@tailwindcss/oxide-android-arm64')
79
+ const bindingPackageVersion = require('@tailwindcss/oxide-android-arm64/package.json').version
80
+ if (bindingPackageVersion !== '0.0.0-insiders.f302fce' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
81
+ throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.f302fce but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
82
+ }
83
+ return binding
82
84
  } catch (e) {
83
85
  loadErrors.push(e)
84
86
  }
85
-
86
87
  } else if (process.arch === 'arm') {
87
88
  try {
88
89
  return require('./tailwindcss-oxide.android-arm-eabi.node')
@@ -90,27 +91,53 @@ function requireNative() {
90
91
  loadErrors.push(e)
91
92
  }
92
93
  try {
93
- return require('@tailwindcss/oxide-android-arm-eabi')
94
+ const binding = require('@tailwindcss/oxide-android-arm-eabi')
95
+ const bindingPackageVersion = require('@tailwindcss/oxide-android-arm-eabi/package.json').version
96
+ if (bindingPackageVersion !== '0.0.0-insiders.f302fce' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
97
+ throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.f302fce but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
98
+ }
99
+ return binding
94
100
  } catch (e) {
95
101
  loadErrors.push(e)
96
102
  }
97
-
98
103
  } else {
99
104
  loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
100
105
  }
101
106
  } else if (process.platform === 'win32') {
102
107
  if (process.arch === 'x64') {
108
+ if (process.config?.variables?.shlib_suffix === 'dll.a' || process.config?.variables?.node_target_type === 'shared_library') {
109
+ try {
110
+ return require('./tailwindcss-oxide.win32-x64-gnu.node')
111
+ } catch (e) {
112
+ loadErrors.push(e)
113
+ }
103
114
  try {
115
+ const binding = require('@tailwindcss/oxide-win32-x64-gnu')
116
+ const bindingPackageVersion = require('@tailwindcss/oxide-win32-x64-gnu/package.json').version
117
+ if (bindingPackageVersion !== '0.0.0-insiders.f302fce' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
118
+ throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.f302fce but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
119
+ }
120
+ return binding
121
+ } catch (e) {
122
+ loadErrors.push(e)
123
+ }
124
+ } else {
125
+ try {
104
126
  return require('./tailwindcss-oxide.win32-x64-msvc.node')
105
127
  } catch (e) {
106
128
  loadErrors.push(e)
107
129
  }
108
130
  try {
109
- return require('@tailwindcss/oxide-win32-x64-msvc')
131
+ const binding = require('@tailwindcss/oxide-win32-x64-msvc')
132
+ const bindingPackageVersion = require('@tailwindcss/oxide-win32-x64-msvc/package.json').version
133
+ if (bindingPackageVersion !== '0.0.0-insiders.f302fce' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
134
+ throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.f302fce but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
135
+ }
136
+ return binding
110
137
  } catch (e) {
111
138
  loadErrors.push(e)
112
139
  }
113
-
140
+ }
114
141
  } else if (process.arch === 'ia32') {
115
142
  try {
116
143
  return require('./tailwindcss-oxide.win32-ia32-msvc.node')
@@ -118,11 +145,15 @@ function requireNative() {
118
145
  loadErrors.push(e)
119
146
  }
120
147
  try {
121
- return require('@tailwindcss/oxide-win32-ia32-msvc')
148
+ const binding = require('@tailwindcss/oxide-win32-ia32-msvc')
149
+ const bindingPackageVersion = require('@tailwindcss/oxide-win32-ia32-msvc/package.json').version
150
+ if (bindingPackageVersion !== '0.0.0-insiders.f302fce' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
+ throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.f302fce but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
+ }
153
+ return binding
122
154
  } catch (e) {
123
155
  loadErrors.push(e)
124
156
  }
125
-
126
157
  } else if (process.arch === 'arm64') {
127
158
  try {
128
159
  return require('./tailwindcss-oxide.win32-arm64-msvc.node')
@@ -130,26 +161,34 @@ function requireNative() {
130
161
  loadErrors.push(e)
131
162
  }
132
163
  try {
133
- return require('@tailwindcss/oxide-win32-arm64-msvc')
164
+ const binding = require('@tailwindcss/oxide-win32-arm64-msvc')
165
+ const bindingPackageVersion = require('@tailwindcss/oxide-win32-arm64-msvc/package.json').version
166
+ if (bindingPackageVersion !== '0.0.0-insiders.f302fce' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
167
+ throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.f302fce but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
168
+ }
169
+ return binding
134
170
  } catch (e) {
135
171
  loadErrors.push(e)
136
172
  }
137
-
138
173
  } else {
139
174
  loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
140
175
  }
141
176
  } else if (process.platform === 'darwin') {
142
177
  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
-
178
+ return require('./tailwindcss-oxide.darwin-universal.node')
179
+ } catch (e) {
180
+ loadErrors.push(e)
181
+ }
182
+ try {
183
+ const binding = require('@tailwindcss/oxide-darwin-universal')
184
+ const bindingPackageVersion = require('@tailwindcss/oxide-darwin-universal/package.json').version
185
+ if (bindingPackageVersion !== '0.0.0-insiders.f302fce' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
186
+ throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.f302fce but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
187
+ }
188
+ return binding
189
+ } catch (e) {
190
+ loadErrors.push(e)
191
+ }
153
192
  if (process.arch === 'x64') {
154
193
  try {
155
194
  return require('./tailwindcss-oxide.darwin-x64.node')
@@ -157,11 +196,15 @@ function requireNative() {
157
196
  loadErrors.push(e)
158
197
  }
159
198
  try {
160
- return require('@tailwindcss/oxide-darwin-x64')
199
+ const binding = require('@tailwindcss/oxide-darwin-x64')
200
+ const bindingPackageVersion = require('@tailwindcss/oxide-darwin-x64/package.json').version
201
+ if (bindingPackageVersion !== '0.0.0-insiders.f302fce' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
202
+ throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.f302fce but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
203
+ }
204
+ return binding
161
205
  } catch (e) {
162
206
  loadErrors.push(e)
163
207
  }
164
-
165
208
  } else if (process.arch === 'arm64') {
166
209
  try {
167
210
  return require('./tailwindcss-oxide.darwin-arm64.node')
@@ -169,11 +212,15 @@ function requireNative() {
169
212
  loadErrors.push(e)
170
213
  }
171
214
  try {
172
- return require('@tailwindcss/oxide-darwin-arm64')
215
+ const binding = require('@tailwindcss/oxide-darwin-arm64')
216
+ const bindingPackageVersion = require('@tailwindcss/oxide-darwin-arm64/package.json').version
217
+ if (bindingPackageVersion !== '0.0.0-insiders.f302fce' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
+ throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.f302fce but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
219
+ }
220
+ return binding
173
221
  } catch (e) {
174
222
  loadErrors.push(e)
175
223
  }
176
-
177
224
  } else {
178
225
  loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
179
226
  }
@@ -185,11 +232,15 @@ function requireNative() {
185
232
  loadErrors.push(e)
186
233
  }
187
234
  try {
188
- return require('@tailwindcss/oxide-freebsd-x64')
235
+ const binding = require('@tailwindcss/oxide-freebsd-x64')
236
+ const bindingPackageVersion = require('@tailwindcss/oxide-freebsd-x64/package.json').version
237
+ if (bindingPackageVersion !== '0.0.0-insiders.f302fce' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
238
+ throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.f302fce but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
239
+ }
240
+ return binding
189
241
  } catch (e) {
190
242
  loadErrors.push(e)
191
243
  }
192
-
193
244
  } else if (process.arch === 'arm64') {
194
245
  try {
195
246
  return require('./tailwindcss-oxide.freebsd-arm64.node')
@@ -197,11 +248,15 @@ function requireNative() {
197
248
  loadErrors.push(e)
198
249
  }
199
250
  try {
200
- return require('@tailwindcss/oxide-freebsd-arm64')
251
+ const binding = require('@tailwindcss/oxide-freebsd-arm64')
252
+ const bindingPackageVersion = require('@tailwindcss/oxide-freebsd-arm64/package.json').version
253
+ if (bindingPackageVersion !== '0.0.0-insiders.f302fce' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
+ throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.f302fce but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
255
+ }
256
+ return binding
201
257
  } catch (e) {
202
258
  loadErrors.push(e)
203
259
  }
204
-
205
260
  } else {
206
261
  loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
207
262
  }
@@ -209,133 +264,259 @@ function requireNative() {
209
264
  if (process.arch === 'x64') {
210
265
  if (isMusl()) {
211
266
  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
-
267
+ return require('./tailwindcss-oxide.linux-x64-musl.node')
268
+ } catch (e) {
269
+ loadErrors.push(e)
270
+ }
271
+ try {
272
+ const binding = require('@tailwindcss/oxide-linux-x64-musl')
273
+ const bindingPackageVersion = require('@tailwindcss/oxide-linux-x64-musl/package.json').version
274
+ if (bindingPackageVersion !== '0.0.0-insiders.f302fce' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
275
+ throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.f302fce but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
276
+ }
277
+ return binding
278
+ } catch (e) {
279
+ loadErrors.push(e)
280
+ }
222
281
  } else {
223
282
  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
-
283
+ return require('./tailwindcss-oxide.linux-x64-gnu.node')
284
+ } catch (e) {
285
+ loadErrors.push(e)
286
+ }
287
+ try {
288
+ const binding = require('@tailwindcss/oxide-linux-x64-gnu')
289
+ const bindingPackageVersion = require('@tailwindcss/oxide-linux-x64-gnu/package.json').version
290
+ if (bindingPackageVersion !== '0.0.0-insiders.f302fce' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
291
+ throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.f302fce but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
292
+ }
293
+ return binding
294
+ } catch (e) {
295
+ loadErrors.push(e)
296
+ }
234
297
  }
235
298
  } else if (process.arch === 'arm64') {
236
299
  if (isMusl()) {
237
300
  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
-
301
+ return require('./tailwindcss-oxide.linux-arm64-musl.node')
302
+ } catch (e) {
303
+ loadErrors.push(e)
304
+ }
305
+ try {
306
+ const binding = require('@tailwindcss/oxide-linux-arm64-musl')
307
+ const bindingPackageVersion = require('@tailwindcss/oxide-linux-arm64-musl/package.json').version
308
+ if (bindingPackageVersion !== '0.0.0-insiders.f302fce' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
309
+ throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.f302fce but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
310
+ }
311
+ return binding
312
+ } catch (e) {
313
+ loadErrors.push(e)
314
+ }
248
315
  } else {
249
316
  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
-
317
+ return require('./tailwindcss-oxide.linux-arm64-gnu.node')
318
+ } catch (e) {
319
+ loadErrors.push(e)
320
+ }
321
+ try {
322
+ const binding = require('@tailwindcss/oxide-linux-arm64-gnu')
323
+ const bindingPackageVersion = require('@tailwindcss/oxide-linux-arm64-gnu/package.json').version
324
+ if (bindingPackageVersion !== '0.0.0-insiders.f302fce' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
325
+ throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.f302fce but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
326
+ }
327
+ return binding
328
+ } catch (e) {
329
+ loadErrors.push(e)
330
+ }
260
331
  }
261
332
  } else if (process.arch === 'arm') {
262
333
  if (isMusl()) {
263
334
  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)
335
+ return require('./tailwindcss-oxide.linux-arm-musleabihf.node')
336
+ } catch (e) {
337
+ loadErrors.push(e)
338
+ }
339
+ try {
340
+ const binding = require('@tailwindcss/oxide-linux-arm-musleabihf')
341
+ const bindingPackageVersion = require('@tailwindcss/oxide-linux-arm-musleabihf/package.json').version
342
+ if (bindingPackageVersion !== '0.0.0-insiders.f302fce' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
343
+ throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.f302fce but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
344
+ }
345
+ return binding
346
+ } catch (e) {
347
+ loadErrors.push(e)
348
+ }
349
+ } else {
350
+ try {
351
+ return require('./tailwindcss-oxide.linux-arm-gnueabihf.node')
352
+ } catch (e) {
353
+ loadErrors.push(e)
354
+ }
355
+ try {
356
+ const binding = require('@tailwindcss/oxide-linux-arm-gnueabihf')
357
+ const bindingPackageVersion = require('@tailwindcss/oxide-linux-arm-gnueabihf/package.json').version
358
+ if (bindingPackageVersion !== '0.0.0-insiders.f302fce' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
359
+ throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.f302fce but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
360
+ }
361
+ return binding
362
+ } catch (e) {
363
+ loadErrors.push(e)
364
+ }
365
+ }
366
+ } else if (process.arch === 'loong64') {
367
+ if (isMusl()) {
368
+ try {
369
+ return require('./tailwindcss-oxide.linux-loong64-musl.node')
370
+ } catch (e) {
371
+ loadErrors.push(e)
372
+ }
373
+ try {
374
+ const binding = require('@tailwindcss/oxide-linux-loong64-musl')
375
+ const bindingPackageVersion = require('@tailwindcss/oxide-linux-loong64-musl/package.json').version
376
+ if (bindingPackageVersion !== '0.0.0-insiders.f302fce' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
377
+ throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.f302fce but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
378
+ }
379
+ return binding
380
+ } catch (e) {
381
+ loadErrors.push(e)
382
+ }
383
+ } else {
384
+ try {
385
+ return require('./tailwindcss-oxide.linux-loong64-gnu.node')
386
+ } catch (e) {
387
+ loadErrors.push(e)
388
+ }
389
+ try {
390
+ const binding = require('@tailwindcss/oxide-linux-loong64-gnu')
391
+ const bindingPackageVersion = require('@tailwindcss/oxide-linux-loong64-gnu/package.json').version
392
+ if (bindingPackageVersion !== '0.0.0-insiders.f302fce' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
393
+ throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.f302fce but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
394
+ }
395
+ return binding
396
+ } catch (e) {
397
+ loadErrors.push(e)
398
+ }
272
399
  }
273
-
400
+ } else if (process.arch === 'riscv64') {
401
+ if (isMusl()) {
402
+ try {
403
+ return require('./tailwindcss-oxide.linux-riscv64-musl.node')
404
+ } catch (e) {
405
+ loadErrors.push(e)
406
+ }
407
+ try {
408
+ const binding = require('@tailwindcss/oxide-linux-riscv64-musl')
409
+ const bindingPackageVersion = require('@tailwindcss/oxide-linux-riscv64-musl/package.json').version
410
+ if (bindingPackageVersion !== '0.0.0-insiders.f302fce' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
+ throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.f302fce but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
412
+ }
413
+ return binding
414
+ } catch (e) {
415
+ loadErrors.push(e)
416
+ }
274
417
  } else {
275
418
  try {
276
- return require('./tailwindcss-oxide.linux-arm-gnueabihf.node')
419
+ return require('./tailwindcss-oxide.linux-riscv64-gnu.node')
420
+ } catch (e) {
421
+ loadErrors.push(e)
422
+ }
423
+ try {
424
+ const binding = require('@tailwindcss/oxide-linux-riscv64-gnu')
425
+ const bindingPackageVersion = require('@tailwindcss/oxide-linux-riscv64-gnu/package.json').version
426
+ if (bindingPackageVersion !== '0.0.0-insiders.f302fce' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
427
+ throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.f302fce but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
428
+ }
429
+ return binding
430
+ } catch (e) {
431
+ loadErrors.push(e)
432
+ }
433
+ }
434
+ } else if (process.arch === 'ppc64') {
435
+ try {
436
+ return require('./tailwindcss-oxide.linux-ppc64-gnu.node')
277
437
  } catch (e) {
278
438
  loadErrors.push(e)
279
439
  }
280
440
  try {
281
- return require('@tailwindcss/oxide-linux-arm-gnueabihf')
441
+ const binding = require('@tailwindcss/oxide-linux-ppc64-gnu')
442
+ const bindingPackageVersion = require('@tailwindcss/oxide-linux-ppc64-gnu/package.json').version
443
+ if (bindingPackageVersion !== '0.0.0-insiders.f302fce' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
+ throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.f302fce but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
445
+ }
446
+ return binding
282
447
  } catch (e) {
283
448
  loadErrors.push(e)
284
449
  }
285
-
286
- }
287
- } else if (process.arch === 'riscv64') {
288
- if (isMusl()) {
289
- try {
290
- return require('./tailwindcss-oxide.linux-riscv64-musl.node')
450
+ } else if (process.arch === 's390x') {
451
+ try {
452
+ return require('./tailwindcss-oxide.linux-s390x-gnu.node')
291
453
  } catch (e) {
292
454
  loadErrors.push(e)
293
455
  }
294
456
  try {
295
- return require('@tailwindcss/oxide-linux-riscv64-musl')
457
+ const binding = require('@tailwindcss/oxide-linux-s390x-gnu')
458
+ const bindingPackageVersion = require('@tailwindcss/oxide-linux-s390x-gnu/package.json').version
459
+ if (bindingPackageVersion !== '0.0.0-insiders.f302fce' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
+ throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.f302fce but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
461
+ }
462
+ return binding
296
463
  } catch (e) {
297
464
  loadErrors.push(e)
298
465
  }
299
-
300
- } else {
301
- try {
302
- return require('./tailwindcss-oxide.linux-riscv64-gnu.node')
466
+ } else {
467
+ loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
468
+ }
469
+ } else if (process.platform === 'openharmony') {
470
+ if (process.arch === 'arm64') {
471
+ try {
472
+ return require('./tailwindcss-oxide.openharmony-arm64.node')
303
473
  } catch (e) {
304
474
  loadErrors.push(e)
305
475
  }
306
476
  try {
307
- return require('@tailwindcss/oxide-linux-riscv64-gnu')
477
+ const binding = require('@tailwindcss/oxide-openharmony-arm64')
478
+ const bindingPackageVersion = require('@tailwindcss/oxide-openharmony-arm64/package.json').version
479
+ if (bindingPackageVersion !== '0.0.0-insiders.f302fce' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
480
+ throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.f302fce but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
481
+ }
482
+ return binding
308
483
  } catch (e) {
309
484
  loadErrors.push(e)
310
485
  }
311
-
312
- }
313
- } else if (process.arch === 'ppc64') {
486
+ } else if (process.arch === 'x64') {
314
487
  try {
315
- return require('./tailwindcss-oxide.linux-ppc64-gnu.node')
488
+ return require('./tailwindcss-oxide.openharmony-x64.node')
316
489
  } catch (e) {
317
490
  loadErrors.push(e)
318
491
  }
319
492
  try {
320
- return require('@tailwindcss/oxide-linux-ppc64-gnu')
493
+ const binding = require('@tailwindcss/oxide-openharmony-x64')
494
+ const bindingPackageVersion = require('@tailwindcss/oxide-openharmony-x64/package.json').version
495
+ if (bindingPackageVersion !== '0.0.0-insiders.f302fce' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
496
+ throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.f302fce but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
497
+ }
498
+ return binding
321
499
  } catch (e) {
322
500
  loadErrors.push(e)
323
501
  }
324
-
325
- } else if (process.arch === 's390x') {
502
+ } else if (process.arch === 'arm') {
326
503
  try {
327
- return require('./tailwindcss-oxide.linux-s390x-gnu.node')
504
+ return require('./tailwindcss-oxide.openharmony-arm.node')
328
505
  } catch (e) {
329
506
  loadErrors.push(e)
330
507
  }
331
508
  try {
332
- return require('@tailwindcss/oxide-linux-s390x-gnu')
509
+ const binding = require('@tailwindcss/oxide-openharmony-arm')
510
+ const bindingPackageVersion = require('@tailwindcss/oxide-openharmony-arm/package.json').version
511
+ if (bindingPackageVersion !== '0.0.0-insiders.f302fce' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
512
+ throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.f302fce but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
513
+ }
514
+ return binding
333
515
  } catch (e) {
334
516
  loadErrors.push(e)
335
517
  }
336
-
337
518
  } else {
338
- loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
519
+ loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
339
520
  }
340
521
  } else {
341
522
  loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
@@ -345,33 +526,50 @@ function requireNative() {
345
526
  nativeBinding = requireNative()
346
527
 
347
528
  if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
529
+ let wasiBinding = null
530
+ let wasiBindingError = null
348
531
  try {
349
- nativeBinding = require('./tailwindcss-oxide.wasi.cjs')
532
+ wasiBinding = require('./tailwindcss-oxide.wasi.cjs')
533
+ nativeBinding = wasiBinding
350
534
  } catch (err) {
351
535
  if (process.env.NAPI_RS_FORCE_WASI) {
352
- loadErrors.push(err)
536
+ wasiBindingError = err
353
537
  }
354
538
  }
355
539
  if (!nativeBinding) {
356
540
  try {
357
- nativeBinding = require('@tailwindcss/oxide-wasm32-wasi')
541
+ wasiBinding = require('@tailwindcss/oxide-wasm32-wasi')
542
+ nativeBinding = wasiBinding
358
543
  } catch (err) {
359
544
  if (process.env.NAPI_RS_FORCE_WASI) {
545
+ wasiBindingError.cause = err
360
546
  loadErrors.push(err)
361
547
  }
362
548
  }
363
549
  }
550
+ if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
551
+ const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error')
552
+ error.cause = wasiBindingError
553
+ throw error
554
+ }
364
555
  }
365
556
 
366
557
  if (!nativeBinding) {
367
558
  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 })
559
+ throw new Error(
560
+ `Cannot find native binding. ` +
561
+ `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
562
+ 'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
563
+ {
564
+ cause: loadErrors.reduce((err, cur) => {
565
+ cur.cause = err
566
+ return cur
567
+ }),
568
+ },
569
+ )
373
570
  }
374
571
  throw new Error(`Failed to load native binding`)
375
572
  }
376
573
 
574
+ module.exports = nativeBinding
377
575
  module.exports.Scanner = nativeBinding.Scanner
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailwindcss/oxide",
3
- "version": "0.0.0-insiders.f2b5ed4",
3
+ "version": "0.0.0-insiders.f302fce",
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.4"
36
+ "@napi-rs/cli": "3.4.1",
37
+ "@napi-rs/wasm-runtime": "^1.1.1",
38
+ "emnapi": "1.8.1"
43
39
  },
44
40
  "engines": {
45
- "node": ">= 10"
41
+ "node": ">= 20"
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-freebsd-x64": "0.0.0-insiders.f2b5ed4",
58
- "@tailwindcss/oxide-linux-arm64-gnu": "0.0.0-insiders.f2b5ed4",
59
- "@tailwindcss/oxide-linux-arm64-musl": "0.0.0-insiders.f2b5ed4",
60
- "@tailwindcss/oxide-linux-arm-gnueabihf": "0.0.0-insiders.f2b5ed4",
61
- "@tailwindcss/oxide-linux-x64-gnu": "0.0.0-insiders.f2b5ed4",
62
- "@tailwindcss/oxide-linux-x64-musl": "0.0.0-insiders.f2b5ed4",
63
- "@tailwindcss/oxide-win32-arm64-msvc": "0.0.0-insiders.f2b5ed4",
64
- "@tailwindcss/oxide-win32-x64-msvc": "0.0.0-insiders.f2b5ed4",
65
- "@tailwindcss/oxide-wasm32-wasi": "0.0.0-insiders.f2b5ed4",
66
- "@tailwindcss/oxide-darwin-arm64": "0.0.0-insiders.f2b5ed4",
67
- "@tailwindcss/oxide-darwin-x64": "0.0.0-insiders.f2b5ed4",
68
- "@tailwindcss/oxide-android-arm64": "0.0.0-insiders.f2b5ed4"
52
+ "@tailwindcss/oxide-darwin-arm64": "0.0.0-insiders.f302fce",
53
+ "@tailwindcss/oxide-freebsd-x64": "0.0.0-insiders.f302fce",
54
+ "@tailwindcss/oxide-darwin-x64": "0.0.0-insiders.f302fce",
55
+ "@tailwindcss/oxide-linux-arm-gnueabihf": "0.0.0-insiders.f302fce",
56
+ "@tailwindcss/oxide-linux-arm64-gnu": "0.0.0-insiders.f302fce",
57
+ "@tailwindcss/oxide-linux-arm64-musl": "0.0.0-insiders.f302fce",
58
+ "@tailwindcss/oxide-linux-x64-gnu": "0.0.0-insiders.f302fce",
59
+ "@tailwindcss/oxide-android-arm64": "0.0.0-insiders.f302fce",
60
+ "@tailwindcss/oxide-linux-x64-musl": "0.0.0-insiders.f302fce",
61
+ "@tailwindcss/oxide-wasm32-wasi": "0.0.0-insiders.f302fce",
62
+ "@tailwindcss/oxide-win32-arm64-msvc": "0.0.0-insiders.f302fce",
63
+ "@tailwindcss/oxide-win32-x64-msvc": "0.0.0-insiders.f302fce"
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()