@tailwindcss/oxide 4.1.5 → 4.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +21 -15
- package/scripts/install.js +143 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailwindcss/oxide",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.7",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/tailwindlabs/tailwindcss.git",
|
|
@@ -32,6 +32,10 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"license": "MIT",
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"tar": "^7.4.3",
|
|
37
|
+
"detect-libc": "^2.0.4"
|
|
38
|
+
},
|
|
35
39
|
"devDependencies": {
|
|
36
40
|
"@napi-rs/cli": "^3.0.0-alpha.78",
|
|
37
41
|
"@napi-rs/wasm-runtime": "^0.2.9",
|
|
@@ -42,25 +46,26 @@
|
|
|
42
46
|
},
|
|
43
47
|
"files": [
|
|
44
48
|
"index.js",
|
|
45
|
-
"index.d.ts"
|
|
49
|
+
"index.d.ts",
|
|
50
|
+
"scripts/install.js"
|
|
46
51
|
],
|
|
47
52
|
"publishConfig": {
|
|
48
53
|
"provenance": true,
|
|
49
54
|
"access": "public"
|
|
50
55
|
},
|
|
51
56
|
"optionalDependencies": {
|
|
52
|
-
"@tailwindcss/oxide-
|
|
53
|
-
"@tailwindcss/oxide-darwin-
|
|
54
|
-
"@tailwindcss/oxide-freebsd-x64": "4.1.
|
|
55
|
-
"@tailwindcss/oxide-linux-arm-gnueabihf": "4.1.
|
|
56
|
-
"@tailwindcss/oxide-linux-arm64-gnu": "4.1.
|
|
57
|
-
"@tailwindcss/oxide-linux-arm64-musl": "4.1.
|
|
58
|
-
"@tailwindcss/oxide-linux-x64-
|
|
59
|
-
"@tailwindcss/oxide-
|
|
60
|
-
"@tailwindcss/oxide-
|
|
61
|
-
"@tailwindcss/oxide-win32-arm64-msvc": "4.1.
|
|
62
|
-
"@tailwindcss/oxide-
|
|
63
|
-
"@tailwindcss/oxide-
|
|
57
|
+
"@tailwindcss/oxide-darwin-x64": "4.1.7",
|
|
58
|
+
"@tailwindcss/oxide-darwin-arm64": "4.1.7",
|
|
59
|
+
"@tailwindcss/oxide-freebsd-x64": "4.1.7",
|
|
60
|
+
"@tailwindcss/oxide-linux-arm-gnueabihf": "4.1.7",
|
|
61
|
+
"@tailwindcss/oxide-linux-arm64-gnu": "4.1.7",
|
|
62
|
+
"@tailwindcss/oxide-linux-arm64-musl": "4.1.7",
|
|
63
|
+
"@tailwindcss/oxide-linux-x64-musl": "4.1.7",
|
|
64
|
+
"@tailwindcss/oxide-wasm32-wasi": "4.1.7",
|
|
65
|
+
"@tailwindcss/oxide-win32-x64-msvc": "4.1.7",
|
|
66
|
+
"@tailwindcss/oxide-win32-arm64-msvc": "4.1.7",
|
|
67
|
+
"@tailwindcss/oxide-android-arm64": "4.1.7",
|
|
68
|
+
"@tailwindcss/oxide-linux-x64-gnu": "4.1.7"
|
|
64
69
|
},
|
|
65
70
|
"scripts": {
|
|
66
71
|
"artifacts": "napi artifacts",
|
|
@@ -71,6 +76,7 @@
|
|
|
71
76
|
"postbuild:wasm": "node ./scripts/move-artifacts.mjs",
|
|
72
77
|
"dev": "cargo watch --quiet --shell 'npm run build'",
|
|
73
78
|
"build:debug": "napi build --platform --no-const-enum",
|
|
74
|
-
"version": "napi version"
|
|
79
|
+
"version": "napi version",
|
|
80
|
+
"postinstall": "node ./scripts/install.js"
|
|
75
81
|
}
|
|
76
82
|
}
|
|
@@ -0,0 +1,143 @@
|
|
|
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()
|