@tailwindcss/oxide 0.0.0-insiders.8fb9ae8f → 0.0.0-insiders.fbb28312
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/index.d.ts +11 -0
- package/index.js +241 -0
- package/package.json +17 -14
- package/Cargo.toml +0 -18
- package/build.rs +0 -5
- package/src/lib.rs +0 -26
package/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/* auto-generated by NAPI-RS */
|
|
5
|
+
|
|
6
|
+
export interface ChangedContent {
|
|
7
|
+
file?: string
|
|
8
|
+
content?: string
|
|
9
|
+
extension: string
|
|
10
|
+
}
|
|
11
|
+
export function parseCandidateStringsFromFiles(changedContent: Array<ChangedContent>): Array<string>
|
package/index.js
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
const { existsSync, readFileSync } = require('fs')
|
|
2
|
+
const { join } = require('path')
|
|
3
|
+
|
|
4
|
+
const { platform, arch } = process
|
|
5
|
+
|
|
6
|
+
let nativeBinding = null
|
|
7
|
+
let localFileExisted = false
|
|
8
|
+
let loadError = null
|
|
9
|
+
|
|
10
|
+
function isMusl() {
|
|
11
|
+
// For Node 10
|
|
12
|
+
if (!process.report || typeof process.report.getReport !== 'function') {
|
|
13
|
+
try {
|
|
14
|
+
return readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
|
|
15
|
+
} catch (e) {
|
|
16
|
+
return true
|
|
17
|
+
}
|
|
18
|
+
} else {
|
|
19
|
+
const { glibcVersionRuntime } = process.report.getReport().header
|
|
20
|
+
return !glibcVersionRuntime
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
switch (platform) {
|
|
25
|
+
case 'android':
|
|
26
|
+
switch (arch) {
|
|
27
|
+
case 'arm64':
|
|
28
|
+
localFileExisted = existsSync(join(__dirname, 'tailwindcss-oxide.android-arm64.node'))
|
|
29
|
+
try {
|
|
30
|
+
if (localFileExisted) {
|
|
31
|
+
nativeBinding = require('./tailwindcss-oxide.android-arm64.node')
|
|
32
|
+
} else {
|
|
33
|
+
nativeBinding = require('@tailwindcss/oxide-android-arm64')
|
|
34
|
+
}
|
|
35
|
+
} catch (e) {
|
|
36
|
+
loadError = e
|
|
37
|
+
}
|
|
38
|
+
break
|
|
39
|
+
case 'arm':
|
|
40
|
+
localFileExisted = existsSync(join(__dirname, 'tailwindcss-oxide.android-arm-eabi.node'))
|
|
41
|
+
try {
|
|
42
|
+
if (localFileExisted) {
|
|
43
|
+
nativeBinding = require('./tailwindcss-oxide.android-arm-eabi.node')
|
|
44
|
+
} else {
|
|
45
|
+
nativeBinding = require('@tailwindcss/oxide-android-arm-eabi')
|
|
46
|
+
}
|
|
47
|
+
} catch (e) {
|
|
48
|
+
loadError = e
|
|
49
|
+
}
|
|
50
|
+
break
|
|
51
|
+
default:
|
|
52
|
+
throw new Error(`Unsupported architecture on Android ${arch}`)
|
|
53
|
+
}
|
|
54
|
+
break
|
|
55
|
+
case 'win32':
|
|
56
|
+
switch (arch) {
|
|
57
|
+
case 'x64':
|
|
58
|
+
localFileExisted = existsSync(
|
|
59
|
+
join(__dirname, 'tailwindcss-oxide.win32-x64-msvc.node')
|
|
60
|
+
)
|
|
61
|
+
try {
|
|
62
|
+
if (localFileExisted) {
|
|
63
|
+
nativeBinding = require('./tailwindcss-oxide.win32-x64-msvc.node')
|
|
64
|
+
} else {
|
|
65
|
+
nativeBinding = require('@tailwindcss/oxide-win32-x64-msvc')
|
|
66
|
+
}
|
|
67
|
+
} catch (e) {
|
|
68
|
+
loadError = e
|
|
69
|
+
}
|
|
70
|
+
break
|
|
71
|
+
case 'ia32':
|
|
72
|
+
localFileExisted = existsSync(
|
|
73
|
+
join(__dirname, 'tailwindcss-oxide.win32-ia32-msvc.node')
|
|
74
|
+
)
|
|
75
|
+
try {
|
|
76
|
+
if (localFileExisted) {
|
|
77
|
+
nativeBinding = require('./tailwindcss-oxide.win32-ia32-msvc.node')
|
|
78
|
+
} else {
|
|
79
|
+
nativeBinding = require('@tailwindcss/oxide-win32-ia32-msvc')
|
|
80
|
+
}
|
|
81
|
+
} catch (e) {
|
|
82
|
+
loadError = e
|
|
83
|
+
}
|
|
84
|
+
break
|
|
85
|
+
case 'arm64':
|
|
86
|
+
localFileExisted = existsSync(
|
|
87
|
+
join(__dirname, 'tailwindcss-oxide.win32-arm64-msvc.node')
|
|
88
|
+
)
|
|
89
|
+
try {
|
|
90
|
+
if (localFileExisted) {
|
|
91
|
+
nativeBinding = require('./tailwindcss-oxide.win32-arm64-msvc.node')
|
|
92
|
+
} else {
|
|
93
|
+
nativeBinding = require('@tailwindcss/oxide-win32-arm64-msvc')
|
|
94
|
+
}
|
|
95
|
+
} catch (e) {
|
|
96
|
+
loadError = e
|
|
97
|
+
}
|
|
98
|
+
break
|
|
99
|
+
default:
|
|
100
|
+
throw new Error(`Unsupported architecture on Windows: ${arch}`)
|
|
101
|
+
}
|
|
102
|
+
break
|
|
103
|
+
case 'darwin':
|
|
104
|
+
switch (arch) {
|
|
105
|
+
case 'x64':
|
|
106
|
+
localFileExisted = existsSync(join(__dirname, 'tailwindcss-oxide.darwin-x64.node'))
|
|
107
|
+
try {
|
|
108
|
+
if (localFileExisted) {
|
|
109
|
+
nativeBinding = require('./tailwindcss-oxide.darwin-x64.node')
|
|
110
|
+
} else {
|
|
111
|
+
nativeBinding = require('@tailwindcss/oxide-darwin-x64')
|
|
112
|
+
}
|
|
113
|
+
} catch (e) {
|
|
114
|
+
loadError = e
|
|
115
|
+
}
|
|
116
|
+
break
|
|
117
|
+
case 'arm64':
|
|
118
|
+
localFileExisted = existsSync(
|
|
119
|
+
join(__dirname, 'tailwindcss-oxide.darwin-arm64.node')
|
|
120
|
+
)
|
|
121
|
+
try {
|
|
122
|
+
if (localFileExisted) {
|
|
123
|
+
nativeBinding = require('./tailwindcss-oxide.darwin-arm64.node')
|
|
124
|
+
} else {
|
|
125
|
+
nativeBinding = require('@tailwindcss/oxide-darwin-arm64')
|
|
126
|
+
}
|
|
127
|
+
} catch (e) {
|
|
128
|
+
loadError = e
|
|
129
|
+
}
|
|
130
|
+
break
|
|
131
|
+
default:
|
|
132
|
+
throw new Error(`Unsupported architecture on macOS: ${arch}`)
|
|
133
|
+
}
|
|
134
|
+
break
|
|
135
|
+
case 'freebsd':
|
|
136
|
+
if (arch !== 'x64') {
|
|
137
|
+
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
|
|
138
|
+
}
|
|
139
|
+
localFileExisted = existsSync(join(__dirname, 'tailwindcss-oxide.freebsd-x64.node'))
|
|
140
|
+
try {
|
|
141
|
+
if (localFileExisted) {
|
|
142
|
+
nativeBinding = require('./tailwindcss-oxide.freebsd-x64.node')
|
|
143
|
+
} else {
|
|
144
|
+
nativeBinding = require('@tailwindcss/oxide-freebsd-x64')
|
|
145
|
+
}
|
|
146
|
+
} catch (e) {
|
|
147
|
+
loadError = e
|
|
148
|
+
}
|
|
149
|
+
break
|
|
150
|
+
case 'linux':
|
|
151
|
+
switch (arch) {
|
|
152
|
+
case 'x64':
|
|
153
|
+
if (isMusl()) {
|
|
154
|
+
localFileExisted = existsSync(
|
|
155
|
+
join(__dirname, 'tailwindcss-oxide.linux-x64-musl.node')
|
|
156
|
+
)
|
|
157
|
+
try {
|
|
158
|
+
if (localFileExisted) {
|
|
159
|
+
nativeBinding = require('./tailwindcss-oxide.linux-x64-musl.node')
|
|
160
|
+
} else {
|
|
161
|
+
nativeBinding = require('@tailwindcss/oxide-linux-x64-musl')
|
|
162
|
+
}
|
|
163
|
+
} catch (e) {
|
|
164
|
+
loadError = e
|
|
165
|
+
}
|
|
166
|
+
} else {
|
|
167
|
+
localFileExisted = existsSync(
|
|
168
|
+
join(__dirname, 'tailwindcss-oxide.linux-x64-gnu.node')
|
|
169
|
+
)
|
|
170
|
+
try {
|
|
171
|
+
if (localFileExisted) {
|
|
172
|
+
nativeBinding = require('./tailwindcss-oxide.linux-x64-gnu.node')
|
|
173
|
+
} else {
|
|
174
|
+
nativeBinding = require('@tailwindcss/oxide-linux-x64-gnu')
|
|
175
|
+
}
|
|
176
|
+
} catch (e) {
|
|
177
|
+
loadError = e
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
break
|
|
181
|
+
case 'arm64':
|
|
182
|
+
if (isMusl()) {
|
|
183
|
+
localFileExisted = existsSync(
|
|
184
|
+
join(__dirname, 'tailwindcss-oxide.linux-arm64-musl.node')
|
|
185
|
+
)
|
|
186
|
+
try {
|
|
187
|
+
if (localFileExisted) {
|
|
188
|
+
nativeBinding = require('./tailwindcss-oxide.linux-arm64-musl.node')
|
|
189
|
+
} else {
|
|
190
|
+
nativeBinding = require('@tailwindcss/oxide-linux-arm64-musl')
|
|
191
|
+
}
|
|
192
|
+
} catch (e) {
|
|
193
|
+
loadError = e
|
|
194
|
+
}
|
|
195
|
+
} else {
|
|
196
|
+
localFileExisted = existsSync(
|
|
197
|
+
join(__dirname, 'tailwindcss-oxide.linux-arm64-gnu.node')
|
|
198
|
+
)
|
|
199
|
+
try {
|
|
200
|
+
if (localFileExisted) {
|
|
201
|
+
nativeBinding = require('./tailwindcss-oxide.linux-arm64-gnu.node')
|
|
202
|
+
} else {
|
|
203
|
+
nativeBinding = require('@tailwindcss/oxide-linux-arm64-gnu')
|
|
204
|
+
}
|
|
205
|
+
} catch (e) {
|
|
206
|
+
loadError = e
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
break
|
|
210
|
+
case 'arm':
|
|
211
|
+
localFileExisted = existsSync(
|
|
212
|
+
join(__dirname, 'tailwindcss-oxide.linux-arm-gnueabihf.node')
|
|
213
|
+
)
|
|
214
|
+
try {
|
|
215
|
+
if (localFileExisted) {
|
|
216
|
+
nativeBinding = require('./tailwindcss-oxide.linux-arm-gnueabihf.node')
|
|
217
|
+
} else {
|
|
218
|
+
nativeBinding = require('@tailwindcss/oxide-linux-arm-gnueabihf')
|
|
219
|
+
}
|
|
220
|
+
} catch (e) {
|
|
221
|
+
loadError = e
|
|
222
|
+
}
|
|
223
|
+
break
|
|
224
|
+
default:
|
|
225
|
+
throw new Error(`Unsupported architecture on Linux: ${arch}`)
|
|
226
|
+
}
|
|
227
|
+
break
|
|
228
|
+
default:
|
|
229
|
+
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (!nativeBinding) {
|
|
233
|
+
if (loadError) {
|
|
234
|
+
throw loadError
|
|
235
|
+
}
|
|
236
|
+
throw new Error(`Failed to load native binding`)
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const { parseCandidateStringsFromFiles } = nativeBinding
|
|
240
|
+
|
|
241
|
+
module.exports.parseCandidateStringsFromFiles = parseCandidateStringsFromFiles
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailwindcss/oxide",
|
|
3
|
-
"version": "0.0.0-insiders.
|
|
3
|
+
"version": "0.0.0-insiders.fbb28312",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"napi": {
|
|
@@ -25,24 +25,27 @@
|
|
|
25
25
|
"engines": {
|
|
26
26
|
"node": ">= 10"
|
|
27
27
|
},
|
|
28
|
+
"files": [
|
|
29
|
+
"index.js",
|
|
30
|
+
"index.d.ts"
|
|
31
|
+
],
|
|
28
32
|
"scripts": {
|
|
29
33
|
"artifacts": "napi artifacts",
|
|
30
34
|
"build": "napi build --platform --release",
|
|
31
35
|
"build:debug": "napi build --platform",
|
|
32
|
-
"prepublishOnly": "napi prepublish -t npm",
|
|
33
36
|
"version": "napi version"
|
|
34
37
|
},
|
|
35
38
|
"optionalDependencies": {
|
|
36
|
-
"@tailwindcss/oxide-
|
|
37
|
-
"@tailwindcss/oxide-darwin-x64": "0.0.0-insiders.
|
|
38
|
-
"@tailwindcss/oxide-
|
|
39
|
-
"@tailwindcss/oxide-
|
|
40
|
-
"@tailwindcss/oxide-linux-arm64-gnu": "0.0.0-insiders.
|
|
41
|
-
"@tailwindcss/oxide-linux-arm64-musl": "0.0.0-insiders.
|
|
42
|
-
"@tailwindcss/oxide-
|
|
43
|
-
"@tailwindcss/oxide-linux-
|
|
44
|
-
"@tailwindcss/oxide-
|
|
45
|
-
"@tailwindcss/oxide-
|
|
46
|
-
"@tailwindcss/oxide-win32-
|
|
39
|
+
"@tailwindcss/oxide-darwin-arm64": "0.0.0-insiders.fbb28312",
|
|
40
|
+
"@tailwindcss/oxide-darwin-x64": "0.0.0-insiders.fbb28312",
|
|
41
|
+
"@tailwindcss/oxide-freebsd-x64": "0.0.0-insiders.fbb28312",
|
|
42
|
+
"@tailwindcss/oxide-linux-arm-gnueabihf": "0.0.0-insiders.fbb28312",
|
|
43
|
+
"@tailwindcss/oxide-linux-arm64-gnu": "0.0.0-insiders.fbb28312",
|
|
44
|
+
"@tailwindcss/oxide-linux-arm64-musl": "0.0.0-insiders.fbb28312",
|
|
45
|
+
"@tailwindcss/oxide-linux-x64-gnu": "0.0.0-insiders.fbb28312",
|
|
46
|
+
"@tailwindcss/oxide-linux-x64-musl": "0.0.0-insiders.fbb28312",
|
|
47
|
+
"@tailwindcss/oxide-win32-arm64-msvc": "0.0.0-insiders.fbb28312",
|
|
48
|
+
"@tailwindcss/oxide-win32-ia32-msvc": "0.0.0-insiders.fbb28312",
|
|
49
|
+
"@tailwindcss/oxide-win32-x64-msvc": "0.0.0-insiders.fbb28312"
|
|
47
50
|
}
|
|
48
|
-
}
|
|
51
|
+
}
|
package/Cargo.toml
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
[package]
|
|
2
|
-
edition = "2021"
|
|
3
|
-
name = "tailwind-oxide"
|
|
4
|
-
version = "0.0.0"
|
|
5
|
-
|
|
6
|
-
[lib]
|
|
7
|
-
crate-type = ["cdylib"]
|
|
8
|
-
|
|
9
|
-
[dependencies]
|
|
10
|
-
# Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
|
|
11
|
-
napi = { version = "2.10.0", default-features = false, features = ["napi4"] }
|
|
12
|
-
napi-derive = "2.9.1"
|
|
13
|
-
tailwindcss-core = { path = "../core" }
|
|
14
|
-
rayon = "1.5.3"
|
|
15
|
-
|
|
16
|
-
[build-dependencies]
|
|
17
|
-
napi-build = "2.0.1"
|
|
18
|
-
|
package/build.rs
DELETED
package/src/lib.rs
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
use std::path::PathBuf;
|
|
2
|
-
|
|
3
|
-
#[macro_use]
|
|
4
|
-
extern crate napi_derive;
|
|
5
|
-
|
|
6
|
-
#[derive(Debug, Clone)]
|
|
7
|
-
#[napi(object)]
|
|
8
|
-
pub struct ChangedContent {
|
|
9
|
-
pub file: Option<String>,
|
|
10
|
-
pub content: Option<String>,
|
|
11
|
-
pub extension: String,
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
#[napi]
|
|
15
|
-
pub fn parse_candidate_strings_from_files(changed_content: Vec<ChangedContent>) -> Vec<String> {
|
|
16
|
-
tailwindcss_core::parse_candidate_strings_from_files(
|
|
17
|
-
changed_content
|
|
18
|
-
.into_iter()
|
|
19
|
-
.map(|changed_content| tailwindcss_core::ChangedContent {
|
|
20
|
-
file: changed_content.file.map(PathBuf::from),
|
|
21
|
-
content: changed_content.content,
|
|
22
|
-
extension: changed_content.extension,
|
|
23
|
-
})
|
|
24
|
-
.collect(),
|
|
25
|
-
)
|
|
26
|
-
}
|