@tailwindcss/oxide
Advanced tools
+311
-113
@@ -6,5 +6,2 @@ // prettier-ignore | ||
| const { createRequire } = require('node:module') | ||
| require = createRequire(__filename) | ||
| const { readFileSync } = require('node:fs') | ||
@@ -70,5 +67,5 @@ let nativeBinding = null | ||
| try { | ||
| nativeBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH); | ||
| return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH); | ||
| } catch (err) { | ||
| loadErrors.push(err); | ||
| loadErrors.push(err) | ||
| } | ||
@@ -83,7 +80,11 @@ } else if (process.platform === 'android') { | ||
| try { | ||
| return require('@tailwindcss/oxide-android-arm64') | ||
| const binding = require('@tailwindcss/oxide-android-arm64') | ||
| const bindingPackageVersion = require('@tailwindcss/oxide-android-arm64/package.json').version | ||
| if (bindingPackageVersion !== '0.0.0-insiders.5cb1efd' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.5cb1efd but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } else if (process.arch === 'arm') { | ||
@@ -96,7 +97,11 @@ try { | ||
| try { | ||
| return require('@tailwindcss/oxide-android-arm-eabi') | ||
| const binding = require('@tailwindcss/oxide-android-arm-eabi') | ||
| const bindingPackageVersion = require('@tailwindcss/oxide-android-arm-eabi/package.json').version | ||
| if (bindingPackageVersion !== '0.0.0-insiders.5cb1efd' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.5cb1efd but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } else { | ||
@@ -107,3 +112,20 @@ loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`)) | ||
| if (process.arch === 'x64') { | ||
| if (process.config?.variables?.shlib_suffix === 'dll.a' || process.config?.variables?.node_target_type === 'shared_library') { | ||
| try { | ||
| return require('./tailwindcss-oxide.win32-x64-gnu.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@tailwindcss/oxide-win32-x64-gnu') | ||
| const bindingPackageVersion = require('@tailwindcss/oxide-win32-x64-gnu/package.json').version | ||
| if (bindingPackageVersion !== '0.0.0-insiders.5cb1efd' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.5cb1efd but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } else { | ||
| try { | ||
| return require('./tailwindcss-oxide.win32-x64-msvc.node') | ||
@@ -114,7 +136,12 @@ } catch (e) { | ||
| try { | ||
| return require('@tailwindcss/oxide-win32-x64-msvc') | ||
| const binding = require('@tailwindcss/oxide-win32-x64-msvc') | ||
| const bindingPackageVersion = require('@tailwindcss/oxide-win32-x64-msvc/package.json').version | ||
| if (bindingPackageVersion !== '0.0.0-insiders.5cb1efd' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.5cb1efd but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } | ||
| } else if (process.arch === 'ia32') { | ||
@@ -127,7 +154,11 @@ try { | ||
| try { | ||
| return require('@tailwindcss/oxide-win32-ia32-msvc') | ||
| const binding = require('@tailwindcss/oxide-win32-ia32-msvc') | ||
| const bindingPackageVersion = require('@tailwindcss/oxide-win32-ia32-msvc/package.json').version | ||
| if (bindingPackageVersion !== '0.0.0-insiders.5cb1efd' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.5cb1efd but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } else if (process.arch === 'arm64') { | ||
@@ -140,7 +171,11 @@ try { | ||
| try { | ||
| return require('@tailwindcss/oxide-win32-arm64-msvc') | ||
| const binding = require('@tailwindcss/oxide-win32-arm64-msvc') | ||
| const bindingPackageVersion = require('@tailwindcss/oxide-win32-arm64-msvc/package.json').version | ||
| if (bindingPackageVersion !== '0.0.0-insiders.5cb1efd' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.5cb1efd but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } else { | ||
@@ -151,12 +186,16 @@ loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`)) | ||
| try { | ||
| return require('./tailwindcss-oxide.darwin-universal.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| return require('./tailwindcss-oxide.darwin-universal.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@tailwindcss/oxide-darwin-universal') | ||
| const bindingPackageVersion = require('@tailwindcss/oxide-darwin-universal/package.json').version | ||
| if (bindingPackageVersion !== '0.0.0-insiders.5cb1efd' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.5cb1efd but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| try { | ||
| return require('@tailwindcss/oxide-darwin-universal') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| if (process.arch === 'x64') { | ||
@@ -169,7 +208,11 @@ try { | ||
| try { | ||
| return require('@tailwindcss/oxide-darwin-x64') | ||
| const binding = require('@tailwindcss/oxide-darwin-x64') | ||
| const bindingPackageVersion = require('@tailwindcss/oxide-darwin-x64/package.json').version | ||
| if (bindingPackageVersion !== '0.0.0-insiders.5cb1efd' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.5cb1efd but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } else if (process.arch === 'arm64') { | ||
@@ -182,7 +225,11 @@ try { | ||
| try { | ||
| return require('@tailwindcss/oxide-darwin-arm64') | ||
| const binding = require('@tailwindcss/oxide-darwin-arm64') | ||
| const bindingPackageVersion = require('@tailwindcss/oxide-darwin-arm64/package.json').version | ||
| if (bindingPackageVersion !== '0.0.0-insiders.5cb1efd' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.5cb1efd but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } else { | ||
@@ -199,7 +246,11 @@ loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`)) | ||
| try { | ||
| return require('@tailwindcss/oxide-freebsd-x64') | ||
| const binding = require('@tailwindcss/oxide-freebsd-x64') | ||
| const bindingPackageVersion = require('@tailwindcss/oxide-freebsd-x64/package.json').version | ||
| if (bindingPackageVersion !== '0.0.0-insiders.5cb1efd' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.5cb1efd but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } else if (process.arch === 'arm64') { | ||
@@ -212,7 +263,11 @@ try { | ||
| try { | ||
| return require('@tailwindcss/oxide-freebsd-arm64') | ||
| const binding = require('@tailwindcss/oxide-freebsd-arm64') | ||
| const bindingPackageVersion = require('@tailwindcss/oxide-freebsd-arm64/package.json').version | ||
| if (bindingPackageVersion !== '0.0.0-insiders.5cb1efd' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.5cb1efd but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } else { | ||
@@ -225,67 +280,172 @@ loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`)) | ||
| try { | ||
| return require('./tailwindcss-oxide.linux-x64-musl.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| return require('@tailwindcss/oxide-linux-x64-musl') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| return require('./tailwindcss-oxide.linux-x64-musl.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@tailwindcss/oxide-linux-x64-musl') | ||
| const bindingPackageVersion = require('@tailwindcss/oxide-linux-x64-musl/package.json').version | ||
| if (bindingPackageVersion !== '0.0.0-insiders.5cb1efd' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.5cb1efd but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } else { | ||
| try { | ||
| return require('./tailwindcss-oxide.linux-x64-gnu.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| return require('./tailwindcss-oxide.linux-x64-gnu.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@tailwindcss/oxide-linux-x64-gnu') | ||
| const bindingPackageVersion = require('@tailwindcss/oxide-linux-x64-gnu/package.json').version | ||
| if (bindingPackageVersion !== '0.0.0-insiders.5cb1efd' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.5cb1efd but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } | ||
| try { | ||
| return require('@tailwindcss/oxide-linux-x64-gnu') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } | ||
| } else if (process.arch === 'arm64') { | ||
| if (isMusl()) { | ||
| try { | ||
| return require('./tailwindcss-oxide.linux-arm64-musl.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| return require('@tailwindcss/oxide-linux-arm64-musl') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| return require('./tailwindcss-oxide.linux-arm64-musl.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@tailwindcss/oxide-linux-arm64-musl') | ||
| const bindingPackageVersion = require('@tailwindcss/oxide-linux-arm64-musl/package.json').version | ||
| if (bindingPackageVersion !== '0.0.0-insiders.5cb1efd' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.5cb1efd but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } else { | ||
| try { | ||
| return require('./tailwindcss-oxide.linux-arm64-gnu.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| return require('./tailwindcss-oxide.linux-arm64-gnu.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@tailwindcss/oxide-linux-arm64-gnu') | ||
| const bindingPackageVersion = require('@tailwindcss/oxide-linux-arm64-gnu/package.json').version | ||
| if (bindingPackageVersion !== '0.0.0-insiders.5cb1efd' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.5cb1efd but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } | ||
| try { | ||
| return require('@tailwindcss/oxide-linux-arm64-gnu') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } | ||
| } else if (process.arch === 'arm') { | ||
| if (isMusl()) { | ||
| try { | ||
| return require('./tailwindcss-oxide.linux-arm-musleabihf.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| return require('./tailwindcss-oxide.linux-arm-musleabihf.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@tailwindcss/oxide-linux-arm-musleabihf') | ||
| const bindingPackageVersion = require('@tailwindcss/oxide-linux-arm-musleabihf/package.json').version | ||
| if (bindingPackageVersion !== '0.0.0-insiders.5cb1efd' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.5cb1efd but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } else { | ||
| try { | ||
| return require('./tailwindcss-oxide.linux-arm-gnueabihf.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@tailwindcss/oxide-linux-arm-gnueabihf') | ||
| const bindingPackageVersion = require('@tailwindcss/oxide-linux-arm-gnueabihf/package.json').version | ||
| if (bindingPackageVersion !== '0.0.0-insiders.5cb1efd' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.5cb1efd but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } | ||
| try { | ||
| return require('@tailwindcss/oxide-linux-arm-musleabihf') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } else if (process.arch === 'loong64') { | ||
| if (isMusl()) { | ||
| try { | ||
| return require('./tailwindcss-oxide.linux-loong64-musl.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@tailwindcss/oxide-linux-loong64-musl') | ||
| const bindingPackageVersion = require('@tailwindcss/oxide-linux-loong64-musl/package.json').version | ||
| if (bindingPackageVersion !== '0.0.0-insiders.5cb1efd' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.5cb1efd but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } else { | ||
| try { | ||
| return require('./tailwindcss-oxide.linux-loong64-gnu.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@tailwindcss/oxide-linux-loong64-gnu') | ||
| const bindingPackageVersion = require('@tailwindcss/oxide-linux-loong64-gnu/package.json').version | ||
| if (bindingPackageVersion !== '0.0.0-insiders.5cb1efd' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.5cb1efd but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } | ||
| } else if (process.arch === 'riscv64') { | ||
| if (isMusl()) { | ||
| try { | ||
| return require('./tailwindcss-oxide.linux-riscv64-musl.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@tailwindcss/oxide-linux-riscv64-musl') | ||
| const bindingPackageVersion = require('@tailwindcss/oxide-linux-riscv64-musl/package.json').version | ||
| if (bindingPackageVersion !== '0.0.0-insiders.5cb1efd' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.5cb1efd but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } else { | ||
| try { | ||
| return require('./tailwindcss-oxide.linux-arm-gnueabihf.node') | ||
| return require('./tailwindcss-oxide.linux-riscv64-gnu.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@tailwindcss/oxide-linux-riscv64-gnu') | ||
| const bindingPackageVersion = require('@tailwindcss/oxide-linux-riscv64-gnu/package.json').version | ||
| if (bindingPackageVersion !== '0.0.0-insiders.5cb1efd' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.5cb1efd but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } | ||
| } else if (process.arch === 'ppc64') { | ||
| try { | ||
| return require('./tailwindcss-oxide.linux-ppc64-gnu.node') | ||
| } catch (e) { | ||
@@ -295,12 +455,14 @@ loadErrors.push(e) | ||
| try { | ||
| return require('@tailwindcss/oxide-linux-arm-gnueabihf') | ||
| const binding = require('@tailwindcss/oxide-linux-ppc64-gnu') | ||
| const bindingPackageVersion = require('@tailwindcss/oxide-linux-ppc64-gnu/package.json').version | ||
| if (bindingPackageVersion !== '0.0.0-insiders.5cb1efd' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.5cb1efd but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } | ||
| } else if (process.arch === 'riscv64') { | ||
| if (isMusl()) { | ||
| try { | ||
| return require('./tailwindcss-oxide.linux-riscv64-musl.node') | ||
| } else if (process.arch === 's390x') { | ||
| try { | ||
| return require('./tailwindcss-oxide.linux-s390x-gnu.node') | ||
| } catch (e) { | ||
@@ -310,10 +472,18 @@ loadErrors.push(e) | ||
| try { | ||
| return require('@tailwindcss/oxide-linux-riscv64-musl') | ||
| const binding = require('@tailwindcss/oxide-linux-s390x-gnu') | ||
| const bindingPackageVersion = require('@tailwindcss/oxide-linux-s390x-gnu/package.json').version | ||
| if (bindingPackageVersion !== '0.0.0-insiders.5cb1efd' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.5cb1efd but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } else { | ||
| try { | ||
| return require('./tailwindcss-oxide.linux-riscv64-gnu.node') | ||
| } else { | ||
| loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`)) | ||
| } | ||
| } else if (process.platform === 'openharmony') { | ||
| if (process.arch === 'arm64') { | ||
| try { | ||
| return require('./tailwindcss-oxide.openharmony-arm64.node') | ||
| } catch (e) { | ||
@@ -323,11 +493,14 @@ loadErrors.push(e) | ||
| try { | ||
| return require('@tailwindcss/oxide-linux-riscv64-gnu') | ||
| const binding = require('@tailwindcss/oxide-openharmony-arm64') | ||
| const bindingPackageVersion = require('@tailwindcss/oxide-openharmony-arm64/package.json').version | ||
| if (bindingPackageVersion !== '0.0.0-insiders.5cb1efd' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.5cb1efd but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } | ||
| } else if (process.arch === 'ppc64') { | ||
| } else if (process.arch === 'x64') { | ||
| try { | ||
| return require('./tailwindcss-oxide.linux-ppc64-gnu.node') | ||
| return require('./tailwindcss-oxide.openharmony-x64.node') | ||
| } catch (e) { | ||
@@ -337,10 +510,14 @@ loadErrors.push(e) | ||
| try { | ||
| return require('@tailwindcss/oxide-linux-ppc64-gnu') | ||
| const binding = require('@tailwindcss/oxide-openharmony-x64') | ||
| const bindingPackageVersion = require('@tailwindcss/oxide-openharmony-x64/package.json').version | ||
| if (bindingPackageVersion !== '0.0.0-insiders.5cb1efd' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.5cb1efd but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } else if (process.arch === 's390x') { | ||
| } else if (process.arch === 'arm') { | ||
| try { | ||
| return require('./tailwindcss-oxide.linux-s390x-gnu.node') | ||
| return require('./tailwindcss-oxide.openharmony-arm.node') | ||
| } catch (e) { | ||
@@ -350,9 +527,13 @@ loadErrors.push(e) | ||
| try { | ||
| return require('@tailwindcss/oxide-linux-s390x-gnu') | ||
| const binding = require('@tailwindcss/oxide-openharmony-arm') | ||
| const bindingPackageVersion = require('@tailwindcss/oxide-openharmony-arm/package.json').version | ||
| if (bindingPackageVersion !== '0.0.0-insiders.5cb1efd' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 0.0.0-insiders.5cb1efd but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } else { | ||
| loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`)) | ||
| loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`)) | ||
| } | ||
@@ -367,7 +548,10 @@ } else { | ||
| if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) { | ||
| let wasiBinding = null | ||
| let wasiBindingError = null | ||
| try { | ||
| nativeBinding = require('./tailwindcss-oxide.wasi.cjs') | ||
| wasiBinding = require('./tailwindcss-oxide.wasi.cjs') | ||
| nativeBinding = wasiBinding | ||
| } catch (err) { | ||
| if (process.env.NAPI_RS_FORCE_WASI) { | ||
| loadErrors.push(err) | ||
| wasiBindingError = err | ||
| } | ||
@@ -377,5 +561,7 @@ } | ||
| try { | ||
| nativeBinding = require('@tailwindcss/oxide-wasm32-wasi') | ||
| wasiBinding = require('@tailwindcss/oxide-wasm32-wasi') | ||
| nativeBinding = wasiBinding | ||
| } catch (err) { | ||
| if (process.env.NAPI_RS_FORCE_WASI) { | ||
| wasiBindingError.cause = err | ||
| loadErrors.push(err) | ||
@@ -385,2 +571,7 @@ } | ||
| } | ||
| if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) { | ||
| const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error') | ||
| error.cause = wasiBindingError | ||
| throw error | ||
| } | ||
| } | ||
@@ -390,7 +581,13 @@ | ||
| if (loadErrors.length > 0) { | ||
| // TODO Link to documentation with potential fixes | ||
| // - The package owner could build/publish bindings for this arch | ||
| // - The user may need to bundle the correct files | ||
| // - The user may need to re-install node_modules to get new packages | ||
| throw new Error('Failed to load native binding', { cause: loadErrors }) | ||
| throw new Error( | ||
| `Cannot find native binding. ` + | ||
| `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` + | ||
| 'Please try `npm i` again after removing both package-lock.json and node_modules directory.', | ||
| { | ||
| cause: loadErrors.reduce((err, cur) => { | ||
| cur.cause = err | ||
| return cur | ||
| }), | ||
| }, | ||
| ) | ||
| } | ||
@@ -400,2 +597,3 @@ throw new Error(`Failed to load native binding`) | ||
| module.exports = nativeBinding | ||
| module.exports.Scanner = nativeBinding.Scanner |
+22
-29
| { | ||
| "name": "@tailwindcss/oxide", | ||
| "version": "0.0.0-insiders.5ca1290", | ||
| "version": "0.0.0-insiders.5cb1efd", | ||
| "repository": { | ||
@@ -35,18 +35,13 @@ "type": "git", | ||
| "license": "MIT", | ||
| "dependencies": { | ||
| "tar": "^7.4.3", | ||
| "detect-libc": "^2.0.4" | ||
| }, | ||
| "devDependencies": { | ||
| "@napi-rs/cli": "^3.0.0-alpha.78", | ||
| "@napi-rs/wasm-runtime": "^0.2.12", | ||
| "emnapi": "1.4.5" | ||
| "@napi-rs/cli": "3.4.1", | ||
| "@napi-rs/wasm-runtime": "^1.1.1", | ||
| "emnapi": "1.8.1" | ||
| }, | ||
| "engines": { | ||
| "node": ">= 10" | ||
| "node": ">= 20" | ||
| }, | ||
| "files": [ | ||
| "index.js", | ||
| "index.d.ts", | ||
| "scripts/install.js" | ||
| "index.d.ts" | ||
| ], | ||
@@ -58,27 +53,25 @@ "publishConfig": { | ||
| "optionalDependencies": { | ||
| "@tailwindcss/oxide-android-arm64": "0.0.0-insiders.5ca1290", | ||
| "@tailwindcss/oxide-darwin-x64": "0.0.0-insiders.5ca1290", | ||
| "@tailwindcss/oxide-freebsd-x64": "0.0.0-insiders.5ca1290", | ||
| "@tailwindcss/oxide-linux-arm-gnueabihf": "0.0.0-insiders.5ca1290", | ||
| "@tailwindcss/oxide-linux-arm64-gnu": "0.0.0-insiders.5ca1290", | ||
| "@tailwindcss/oxide-linux-x64-gnu": "0.0.0-insiders.5ca1290", | ||
| "@tailwindcss/oxide-linux-x64-musl": "0.0.0-insiders.5ca1290", | ||
| "@tailwindcss/oxide-linux-arm64-musl": "0.0.0-insiders.5ca1290", | ||
| "@tailwindcss/oxide-darwin-arm64": "0.0.0-insiders.5ca1290", | ||
| "@tailwindcss/oxide-wasm32-wasi": "0.0.0-insiders.5ca1290", | ||
| "@tailwindcss/oxide-win32-arm64-msvc": "0.0.0-insiders.5ca1290", | ||
| "@tailwindcss/oxide-win32-x64-msvc": "0.0.0-insiders.5ca1290" | ||
| "@tailwindcss/oxide-android-arm64": "0.0.0-insiders.5cb1efd", | ||
| "@tailwindcss/oxide-darwin-x64": "0.0.0-insiders.5cb1efd", | ||
| "@tailwindcss/oxide-linux-arm-gnueabihf": "0.0.0-insiders.5cb1efd", | ||
| "@tailwindcss/oxide-linux-x64-gnu": "0.0.0-insiders.5cb1efd", | ||
| "@tailwindcss/oxide-linux-arm64-musl": "0.0.0-insiders.5cb1efd", | ||
| "@tailwindcss/oxide-linux-x64-musl": "0.0.0-insiders.5cb1efd", | ||
| "@tailwindcss/oxide-win32-arm64-msvc": "0.0.0-insiders.5cb1efd", | ||
| "@tailwindcss/oxide-wasm32-wasi": "0.0.0-insiders.5cb1efd", | ||
| "@tailwindcss/oxide-win32-x64-msvc": "0.0.0-insiders.5cb1efd", | ||
| "@tailwindcss/oxide-linux-arm64-gnu": "0.0.0-insiders.5cb1efd", | ||
| "@tailwindcss/oxide-darwin-arm64": "0.0.0-insiders.5cb1efd", | ||
| "@tailwindcss/oxide-freebsd-x64": "0.0.0-insiders.5cb1efd" | ||
| }, | ||
| "scripts": { | ||
| "artifacts": "napi artifacts", | ||
| "build": "pnpm run build:platform && pnpm run build:wasm", | ||
| "build:platform": "napi build --platform --release --no-const-enum", | ||
| "build:platform": "napi build --platform --release", | ||
| "postbuild:platform": "node ./scripts/move-artifacts.mjs", | ||
| "build:wasm": "napi build --release --target wasm32-wasip1-threads --no-const-enum", | ||
| "build:wasm": "napi build --release --target wasm32-wasip1-threads", | ||
| "postbuild:wasm": "node ./scripts/move-artifacts.mjs", | ||
| "dev": "cargo watch --quiet --shell 'npm run build'", | ||
| "build:debug": "napi build --platform --no-const-enum", | ||
| "version": "napi version", | ||
| "postinstall": "node ./scripts/install.js" | ||
| "build:debug": "napi build --platform", | ||
| "version": "napi version" | ||
| } | ||
| } |
| #!/usr/bin/env node | ||
| /** | ||
| * @tailwindcss/oxide postinstall script | ||
| * | ||
| * This script ensures that the correct binary for the current platform and | ||
| * architecture is downloaded and available. | ||
| */ | ||
| const fs = require('fs') | ||
| const path = require('path') | ||
| const https = require('https') | ||
| const { extract } = require('tar') | ||
| const packageJson = require('../package.json') | ||
| const detectLibc = require('detect-libc') | ||
| const version = packageJson.version | ||
| function getPlatformPackageName() { | ||
| let platform = process.platform | ||
| let arch = process.arch | ||
| let libc = '' | ||
| if (platform === 'linux') { | ||
| libc = detectLibc.isNonGlibcLinuxSync() ? 'musl' : 'gnu' | ||
| } | ||
| // Map to our package naming conventions | ||
| switch (platform) { | ||
| case 'darwin': | ||
| return arch === 'arm64' ? '@tailwindcss/oxide-darwin-arm64' : '@tailwindcss/oxide-darwin-x64' | ||
| case 'win32': | ||
| if (arch === 'arm64') return '@tailwindcss/oxide-win32-arm64-msvc' | ||
| if (arch === 'ia32') return '@tailwindcss/oxide-win32-ia32-msvc' | ||
| return '@tailwindcss/oxide-win32-x64-msvc' | ||
| case 'linux': | ||
| if (arch === 'x64') { | ||
| return libc === 'musl' | ||
| ? '@tailwindcss/oxide-linux-x64-musl' | ||
| : '@tailwindcss/oxide-linux-x64-gnu' | ||
| } else if (arch === 'arm64') { | ||
| return libc === 'musl' | ||
| ? '@tailwindcss/oxide-linux-arm64-musl' | ||
| : '@tailwindcss/oxide-linux-arm64-gnu' | ||
| } else if (arch === 'arm') { | ||
| return '@tailwindcss/oxide-linux-arm-gnueabihf' | ||
| } | ||
| break | ||
| case 'freebsd': | ||
| return '@tailwindcss/oxide-freebsd-x64' | ||
| case 'android': | ||
| return '@tailwindcss/oxide-android-arm64' | ||
| default: | ||
| return '@tailwindcss/oxide-wasm32-wasi' | ||
| } | ||
| } | ||
| function isPackageAvailable(packageName) { | ||
| try { | ||
| require.resolve(packageName) | ||
| return true | ||
| } catch (e) { | ||
| return false | ||
| } | ||
| } | ||
| // Extract all files from a tarball to a destination directory | ||
| async function extractTarball(tarballStream, destDir) { | ||
| if (!fs.existsSync(destDir)) { | ||
| fs.mkdirSync(destDir, { recursive: true }) | ||
| } | ||
| return new Promise((resolve, reject) => { | ||
| tarballStream | ||
| .pipe(extract({ cwd: destDir, strip: 1 })) | ||
| .on('error', (err) => reject(err)) | ||
| .on('end', () => resolve()) | ||
| }) | ||
| } | ||
| async function downloadAndExtractBinary(packageName) { | ||
| let tarballUrl = `https://registry.npmjs.org/${packageName}/-/${packageName.replace('@tailwindcss/', '')}-${version}.tgz` | ||
| console.log(`Downloading ${tarballUrl}...`) | ||
| return new Promise((resolve) => { | ||
| https | ||
| .get(tarballUrl, (response) => { | ||
| if (response.statusCode === 302 || response.statusCode === 301) { | ||
| // Handle redirects | ||
| https.get(response.headers.location, handleResponse).on('error', (err) => { | ||
| console.error('Download error:', err) | ||
| resolve() | ||
| }) | ||
| return | ||
| } | ||
| handleResponse(response) | ||
| async function handleResponse(response) { | ||
| try { | ||
| if (response.statusCode !== 200) { | ||
| throw new Error(`Download failed with status code: ${response.statusCode}`) | ||
| } | ||
| await extractTarball( | ||
| response, | ||
| path.join(__dirname, '..', 'node_modules', ...packageName.split('/')), | ||
| ) | ||
| console.log(`Successfully downloaded and installed ${packageName}`) | ||
| } catch (error) { | ||
| console.error('Error during extraction:', error) | ||
| resolve() | ||
| } finally { | ||
| resolve() | ||
| } | ||
| } | ||
| }) | ||
| .on('error', (err) => { | ||
| console.error('Download error:', err) | ||
| resolve() | ||
| }) | ||
| }) | ||
| } | ||
| async function main() { | ||
| // Don't run this script in the package source | ||
| try { | ||
| if (fs.existsSync(path.join(__dirname, '..', 'build.rs'))) { | ||
| return | ||
| } | ||
| let packageName = getPlatformPackageName() | ||
| if (!packageName) return | ||
| if (isPackageAvailable(packageName)) return | ||
| await downloadAndExtractBinary(packageName) | ||
| } catch (error) { | ||
| console.error(error) | ||
| return | ||
| } | ||
| } | ||
| main() |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 3 instances in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Install scripts
Supply chain riskInstall scripts are run when the package is installed or built. Malicious packages often use scripts that run automatically to execute payloads or fetch additional code.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
29896
61.27%12
-14.29%607
18.32%0
-100%1
-66.67%4
-20%60
650%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed