@tailwindcss/oxide 0.0.0-insiders.751eb74 → 0.0.0-insiders.75cbfc2
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 +27 -16
- package/index.js +345 -283
- package/package.json +49 -30
- package/scripts/install.js +143 -0
package/index.d.ts
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* auto-generated by NAPI-RS */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
export declare class Scanner {
|
|
4
|
+
constructor(opts: ScannerOptions)
|
|
5
|
+
scan(): Array<string>
|
|
6
|
+
scanFiles(input: Array<ChangedContent>): Array<string>
|
|
7
|
+
getCandidatesWithPositions(input: ChangedContent): Array<CandidateWithPosition>
|
|
8
|
+
get files(): Array<string>
|
|
9
|
+
get globs(): Array<GlobEntry>
|
|
10
|
+
get normalizedSources(): Array<GlobEntry>
|
|
11
|
+
}
|
|
3
12
|
|
|
4
|
-
|
|
13
|
+
export interface CandidateWithPosition {
|
|
14
|
+
/** The candidate string */
|
|
15
|
+
candidate: string
|
|
16
|
+
/** The position of the candidate inside the content file */
|
|
17
|
+
position: number
|
|
18
|
+
}
|
|
5
19
|
|
|
6
20
|
export interface ChangedContent {
|
|
7
21
|
/** File path to the changed file */
|
|
@@ -11,27 +25,24 @@ export interface ChangedContent {
|
|
|
11
25
|
/** File extension */
|
|
12
26
|
extension: string
|
|
13
27
|
}
|
|
28
|
+
|
|
14
29
|
export interface GlobEntry {
|
|
15
30
|
/** Base path of the glob */
|
|
16
31
|
base: string
|
|
17
32
|
/** Glob pattern */
|
|
18
33
|
pattern: string
|
|
19
34
|
}
|
|
35
|
+
|
|
20
36
|
export interface ScannerOptions {
|
|
21
37
|
/** Glob sources */
|
|
22
|
-
sources?: Array<
|
|
38
|
+
sources?: Array<SourceEntry>
|
|
23
39
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
scan(): Array<string>
|
|
33
|
-
scanFiles(input: Array<ChangedContent>): Array<string>
|
|
34
|
-
getCandidatesWithPositions(input: ChangedContent): Array<CandidateWithPosition>
|
|
35
|
-
get files(): Array<string>
|
|
36
|
-
get globs(): Array<GlobEntry>
|
|
40
|
+
|
|
41
|
+
export interface SourceEntry {
|
|
42
|
+
/** Base path of the glob */
|
|
43
|
+
base: string
|
|
44
|
+
/** Glob pattern */
|
|
45
|
+
pattern: string
|
|
46
|
+
/** Negated flag */
|
|
47
|
+
negated: boolean
|
|
37
48
|
}
|
package/index.js
CHANGED
|
@@ -1,315 +1,377 @@
|
|
|
1
|
-
|
|
1
|
+
// prettier-ignore
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
// @ts-nocheck
|
|
5
4
|
/* auto-generated by NAPI-RS */
|
|
6
5
|
|
|
7
|
-
const {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const { platform, arch } = process
|
|
6
|
+
const { createRequire } = require('node:module')
|
|
7
|
+
require = createRequire(__filename)
|
|
11
8
|
|
|
9
|
+
const { readFileSync } = require('node:fs')
|
|
12
10
|
let nativeBinding = null
|
|
13
|
-
|
|
14
|
-
let loadError = null
|
|
11
|
+
const loadErrors = []
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
13
|
+
const isMusl = () => {
|
|
14
|
+
let musl = false
|
|
15
|
+
if (process.platform === 'linux') {
|
|
16
|
+
musl = isMuslFromFilesystem()
|
|
17
|
+
if (musl === null) {
|
|
18
|
+
musl = isMuslFromReport()
|
|
19
|
+
}
|
|
20
|
+
if (musl === null) {
|
|
21
|
+
musl = isMuslFromChildProcess()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return musl
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-')
|
|
28
|
+
|
|
29
|
+
const isMuslFromFilesystem = () => {
|
|
30
|
+
try {
|
|
31
|
+
return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')
|
|
32
|
+
} catch {
|
|
33
|
+
return null
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const isMuslFromReport = () => {
|
|
38
|
+
let report = null
|
|
39
|
+
if (typeof process.report?.getReport === 'function') {
|
|
40
|
+
process.report.excludeNetwork = true
|
|
41
|
+
report = process.report.getReport()
|
|
42
|
+
}
|
|
43
|
+
if (!report) {
|
|
44
|
+
return null
|
|
45
|
+
}
|
|
46
|
+
if (report.header && report.header.glibcVersionRuntime) {
|
|
47
|
+
return false
|
|
48
|
+
}
|
|
49
|
+
if (Array.isArray(report.sharedObjects)) {
|
|
50
|
+
if (report.sharedObjects.some(isFileMusl)) {
|
|
23
51
|
return true
|
|
24
52
|
}
|
|
25
|
-
} else {
|
|
26
|
-
const { glibcVersionRuntime } = process.report.getReport().header
|
|
27
|
-
return !glibcVersionRuntime
|
|
28
53
|
}
|
|
54
|
+
return false
|
|
29
55
|
}
|
|
30
56
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
57
|
+
const isMuslFromChildProcess = () => {
|
|
58
|
+
try {
|
|
59
|
+
return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
|
|
60
|
+
} catch (e) {
|
|
61
|
+
// If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
|
|
62
|
+
return false
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function requireNative() {
|
|
67
|
+
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
|
68
|
+
try {
|
|
69
|
+
nativeBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
|
70
|
+
} catch (err) {
|
|
71
|
+
loadErrors.push(err);
|
|
72
|
+
}
|
|
73
|
+
} else if (process.platform === 'android') {
|
|
74
|
+
if (process.arch === 'arm64') {
|
|
75
|
+
try {
|
|
76
|
+
return require('./tailwindcss-oxide.android-arm64.node')
|
|
77
|
+
} catch (e) {
|
|
78
|
+
loadErrors.push(e)
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
return require('@tailwindcss/oxide-android-arm64')
|
|
82
|
+
} catch (e) {
|
|
83
|
+
loadErrors.push(e)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
} else if (process.arch === 'arm') {
|
|
87
|
+
try {
|
|
88
|
+
return require('./tailwindcss-oxide.android-arm-eabi.node')
|
|
89
|
+
} catch (e) {
|
|
90
|
+
loadErrors.push(e)
|
|
91
|
+
}
|
|
92
|
+
try {
|
|
93
|
+
return require('@tailwindcss/oxide-android-arm-eabi')
|
|
94
|
+
} catch (e) {
|
|
95
|
+
loadErrors.push(e)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
} else {
|
|
99
|
+
loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
|
|
100
|
+
}
|
|
101
|
+
} else if (process.platform === 'win32') {
|
|
102
|
+
if (process.arch === 'x64') {
|
|
103
|
+
try {
|
|
104
|
+
return require('./tailwindcss-oxide.win32-x64-msvc.node')
|
|
105
|
+
} catch (e) {
|
|
106
|
+
loadErrors.push(e)
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
return require('@tailwindcss/oxide-win32-x64-msvc')
|
|
110
|
+
} catch (e) {
|
|
111
|
+
loadErrors.push(e)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
} else if (process.arch === 'ia32') {
|
|
115
|
+
try {
|
|
116
|
+
return require('./tailwindcss-oxide.win32-ia32-msvc.node')
|
|
117
|
+
} catch (e) {
|
|
118
|
+
loadErrors.push(e)
|
|
119
|
+
}
|
|
120
|
+
try {
|
|
121
|
+
return require('@tailwindcss/oxide-win32-ia32-msvc')
|
|
122
|
+
} catch (e) {
|
|
123
|
+
loadErrors.push(e)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
} else if (process.arch === 'arm64') {
|
|
127
|
+
try {
|
|
128
|
+
return require('./tailwindcss-oxide.win32-arm64-msvc.node')
|
|
129
|
+
} catch (e) {
|
|
130
|
+
loadErrors.push(e)
|
|
131
|
+
}
|
|
132
|
+
try {
|
|
133
|
+
return require('@tailwindcss/oxide-win32-arm64-msvc')
|
|
134
|
+
} catch (e) {
|
|
135
|
+
loadErrors.push(e)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
} else {
|
|
139
|
+
loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
|
|
140
|
+
}
|
|
141
|
+
} else if (process.platform === 'darwin') {
|
|
142
|
+
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
|
+
|
|
153
|
+
if (process.arch === 'x64') {
|
|
154
|
+
try {
|
|
155
|
+
return require('./tailwindcss-oxide.darwin-x64.node')
|
|
156
|
+
} catch (e) {
|
|
157
|
+
loadErrors.push(e)
|
|
158
|
+
}
|
|
159
|
+
try {
|
|
160
|
+
return require('@tailwindcss/oxide-darwin-x64')
|
|
161
|
+
} catch (e) {
|
|
162
|
+
loadErrors.push(e)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
} else if (process.arch === 'arm64') {
|
|
166
|
+
try {
|
|
167
|
+
return require('./tailwindcss-oxide.darwin-arm64.node')
|
|
168
|
+
} catch (e) {
|
|
169
|
+
loadErrors.push(e)
|
|
170
|
+
}
|
|
171
|
+
try {
|
|
172
|
+
return require('@tailwindcss/oxide-darwin-arm64')
|
|
173
|
+
} catch (e) {
|
|
174
|
+
loadErrors.push(e)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
} else {
|
|
178
|
+
loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
|
|
179
|
+
}
|
|
180
|
+
} else if (process.platform === 'freebsd') {
|
|
181
|
+
if (process.arch === 'x64') {
|
|
182
|
+
try {
|
|
183
|
+
return require('./tailwindcss-oxide.freebsd-x64.node')
|
|
184
|
+
} catch (e) {
|
|
185
|
+
loadErrors.push(e)
|
|
186
|
+
}
|
|
187
|
+
try {
|
|
188
|
+
return require('@tailwindcss/oxide-freebsd-x64')
|
|
189
|
+
} catch (e) {
|
|
190
|
+
loadErrors.push(e)
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
} else if (process.arch === 'arm64') {
|
|
194
|
+
try {
|
|
195
|
+
return require('./tailwindcss-oxide.freebsd-arm64.node')
|
|
196
|
+
} catch (e) {
|
|
197
|
+
loadErrors.push(e)
|
|
198
|
+
}
|
|
199
|
+
try {
|
|
200
|
+
return require('@tailwindcss/oxide-freebsd-arm64')
|
|
201
|
+
} catch (e) {
|
|
202
|
+
loadErrors.push(e)
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
} else {
|
|
206
|
+
loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
|
|
207
|
+
}
|
|
208
|
+
} else if (process.platform === 'linux') {
|
|
209
|
+
if (process.arch === 'x64') {
|
|
210
|
+
if (isMusl()) {
|
|
36
211
|
try {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
+
|
|
222
|
+
} else {
|
|
48
223
|
try {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
case 'win32':
|
|
63
|
-
switch (arch) {
|
|
64
|
-
case 'x64':
|
|
65
|
-
localFileExisted = existsSync(
|
|
66
|
-
join(__dirname, 'tailwindcss-oxide.win32-x64-msvc.node')
|
|
67
|
-
)
|
|
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
|
+
|
|
234
|
+
}
|
|
235
|
+
} else if (process.arch === 'arm64') {
|
|
236
|
+
if (isMusl()) {
|
|
68
237
|
try {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
join(__dirname, 'tailwindcss-oxide.win32-ia32-msvc.node')
|
|
81
|
-
)
|
|
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
|
+
|
|
248
|
+
} else {
|
|
82
249
|
try {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|
+
|
|
260
|
+
}
|
|
261
|
+
} else if (process.arch === 'arm') {
|
|
262
|
+
if (isMusl()) {
|
|
96
263
|
try {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
throw new Error(`Unsupported architecture on Windows: ${arch}`)
|
|
108
|
-
}
|
|
109
|
-
break
|
|
110
|
-
case 'darwin':
|
|
111
|
-
localFileExisted = existsSync(join(__dirname, 'tailwindcss-oxide.darwin-universal.node'))
|
|
112
|
-
try {
|
|
113
|
-
if (localFileExisted) {
|
|
114
|
-
nativeBinding = require('./tailwindcss-oxide.darwin-universal.node')
|
|
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)
|
|
272
|
+
}
|
|
273
|
+
|
|
115
274
|
} else {
|
|
116
|
-
|
|
275
|
+
try {
|
|
276
|
+
return require('./tailwindcss-oxide.linux-arm-gnueabihf.node')
|
|
277
|
+
} catch (e) {
|
|
278
|
+
loadErrors.push(e)
|
|
279
|
+
}
|
|
280
|
+
try {
|
|
281
|
+
return require('@tailwindcss/oxide-linux-arm-gnueabihf')
|
|
282
|
+
} catch (e) {
|
|
283
|
+
loadErrors.push(e)
|
|
117
284
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
localFileExisted = existsSync(join(__dirname, 'tailwindcss-oxide.darwin-x64.node'))
|
|
285
|
+
|
|
286
|
+
}
|
|
287
|
+
} else if (process.arch === 'riscv64') {
|
|
288
|
+
if (isMusl()) {
|
|
123
289
|
try {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
join(__dirname, 'tailwindcss-oxide.darwin-arm64.node')
|
|
136
|
-
)
|
|
290
|
+
return require('./tailwindcss-oxide.linux-riscv64-musl.node')
|
|
291
|
+
} catch (e) {
|
|
292
|
+
loadErrors.push(e)
|
|
293
|
+
}
|
|
294
|
+
try {
|
|
295
|
+
return require('@tailwindcss/oxide-linux-riscv64-musl')
|
|
296
|
+
} catch (e) {
|
|
297
|
+
loadErrors.push(e)
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
} else {
|
|
137
301
|
try {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
302
|
+
return require('./tailwindcss-oxide.linux-riscv64-gnu.node')
|
|
303
|
+
} catch (e) {
|
|
304
|
+
loadErrors.push(e)
|
|
305
|
+
}
|
|
306
|
+
try {
|
|
307
|
+
return require('@tailwindcss/oxide-linux-riscv64-gnu')
|
|
308
|
+
} catch (e) {
|
|
309
|
+
loadErrors.push(e)
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
}
|
|
313
|
+
} else if (process.arch === 'ppc64') {
|
|
314
|
+
try {
|
|
315
|
+
return require('./tailwindcss-oxide.linux-ppc64-gnu.node')
|
|
316
|
+
} catch (e) {
|
|
317
|
+
loadErrors.push(e)
|
|
318
|
+
}
|
|
319
|
+
try {
|
|
320
|
+
return require('@tailwindcss/oxide-linux-ppc64-gnu')
|
|
321
|
+
} catch (e) {
|
|
322
|
+
loadErrors.push(e)
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
} else if (process.arch === 's390x') {
|
|
326
|
+
try {
|
|
327
|
+
return require('./tailwindcss-oxide.linux-s390x-gnu.node')
|
|
328
|
+
} catch (e) {
|
|
329
|
+
loadErrors.push(e)
|
|
330
|
+
}
|
|
331
|
+
try {
|
|
332
|
+
return require('@tailwindcss/oxide-linux-s390x-gnu')
|
|
333
|
+
} catch (e) {
|
|
334
|
+
loadErrors.push(e)
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
} else {
|
|
338
|
+
loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
|
|
149
339
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
340
|
+
} else {
|
|
341
|
+
loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
nativeBinding = requireNative()
|
|
346
|
+
|
|
347
|
+
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
348
|
+
try {
|
|
349
|
+
nativeBinding = require('./tailwindcss-oxide.wasi.cjs')
|
|
350
|
+
} catch (err) {
|
|
351
|
+
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
352
|
+
loadErrors.push(err)
|
|
154
353
|
}
|
|
155
|
-
|
|
354
|
+
}
|
|
355
|
+
if (!nativeBinding) {
|
|
156
356
|
try {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
357
|
+
nativeBinding = require('@tailwindcss/oxide-wasm32-wasi')
|
|
358
|
+
} catch (err) {
|
|
359
|
+
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
360
|
+
loadErrors.push(err)
|
|
161
361
|
}
|
|
162
|
-
} catch (e) {
|
|
163
|
-
loadError = e
|
|
164
|
-
}
|
|
165
|
-
break
|
|
166
|
-
case 'linux':
|
|
167
|
-
switch (arch) {
|
|
168
|
-
case 'x64':
|
|
169
|
-
if (isMusl()) {
|
|
170
|
-
localFileExisted = existsSync(
|
|
171
|
-
join(__dirname, 'tailwindcss-oxide.linux-x64-musl.node')
|
|
172
|
-
)
|
|
173
|
-
try {
|
|
174
|
-
if (localFileExisted) {
|
|
175
|
-
nativeBinding = require('./tailwindcss-oxide.linux-x64-musl.node')
|
|
176
|
-
} else {
|
|
177
|
-
nativeBinding = require('@tailwindcss/oxide-linux-x64-musl')
|
|
178
|
-
}
|
|
179
|
-
} catch (e) {
|
|
180
|
-
loadError = e
|
|
181
|
-
}
|
|
182
|
-
} else {
|
|
183
|
-
localFileExisted = existsSync(
|
|
184
|
-
join(__dirname, 'tailwindcss-oxide.linux-x64-gnu.node')
|
|
185
|
-
)
|
|
186
|
-
try {
|
|
187
|
-
if (localFileExisted) {
|
|
188
|
-
nativeBinding = require('./tailwindcss-oxide.linux-x64-gnu.node')
|
|
189
|
-
} else {
|
|
190
|
-
nativeBinding = require('@tailwindcss/oxide-linux-x64-gnu')
|
|
191
|
-
}
|
|
192
|
-
} catch (e) {
|
|
193
|
-
loadError = e
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
break
|
|
197
|
-
case 'arm64':
|
|
198
|
-
if (isMusl()) {
|
|
199
|
-
localFileExisted = existsSync(
|
|
200
|
-
join(__dirname, 'tailwindcss-oxide.linux-arm64-musl.node')
|
|
201
|
-
)
|
|
202
|
-
try {
|
|
203
|
-
if (localFileExisted) {
|
|
204
|
-
nativeBinding = require('./tailwindcss-oxide.linux-arm64-musl.node')
|
|
205
|
-
} else {
|
|
206
|
-
nativeBinding = require('@tailwindcss/oxide-linux-arm64-musl')
|
|
207
|
-
}
|
|
208
|
-
} catch (e) {
|
|
209
|
-
loadError = e
|
|
210
|
-
}
|
|
211
|
-
} else {
|
|
212
|
-
localFileExisted = existsSync(
|
|
213
|
-
join(__dirname, 'tailwindcss-oxide.linux-arm64-gnu.node')
|
|
214
|
-
)
|
|
215
|
-
try {
|
|
216
|
-
if (localFileExisted) {
|
|
217
|
-
nativeBinding = require('./tailwindcss-oxide.linux-arm64-gnu.node')
|
|
218
|
-
} else {
|
|
219
|
-
nativeBinding = require('@tailwindcss/oxide-linux-arm64-gnu')
|
|
220
|
-
}
|
|
221
|
-
} catch (e) {
|
|
222
|
-
loadError = e
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
break
|
|
226
|
-
case 'arm':
|
|
227
|
-
if (isMusl()) {
|
|
228
|
-
localFileExisted = existsSync(
|
|
229
|
-
join(__dirname, 'tailwindcss-oxide.linux-arm-musleabihf.node')
|
|
230
|
-
)
|
|
231
|
-
try {
|
|
232
|
-
if (localFileExisted) {
|
|
233
|
-
nativeBinding = require('./tailwindcss-oxide.linux-arm-musleabihf.node')
|
|
234
|
-
} else {
|
|
235
|
-
nativeBinding = require('@tailwindcss/oxide-linux-arm-musleabihf')
|
|
236
|
-
}
|
|
237
|
-
} catch (e) {
|
|
238
|
-
loadError = e
|
|
239
|
-
}
|
|
240
|
-
} else {
|
|
241
|
-
localFileExisted = existsSync(
|
|
242
|
-
join(__dirname, 'tailwindcss-oxide.linux-arm-gnueabihf.node')
|
|
243
|
-
)
|
|
244
|
-
try {
|
|
245
|
-
if (localFileExisted) {
|
|
246
|
-
nativeBinding = require('./tailwindcss-oxide.linux-arm-gnueabihf.node')
|
|
247
|
-
} else {
|
|
248
|
-
nativeBinding = require('@tailwindcss/oxide-linux-arm-gnueabihf')
|
|
249
|
-
}
|
|
250
|
-
} catch (e) {
|
|
251
|
-
loadError = e
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
break
|
|
255
|
-
case 'riscv64':
|
|
256
|
-
if (isMusl()) {
|
|
257
|
-
localFileExisted = existsSync(
|
|
258
|
-
join(__dirname, 'tailwindcss-oxide.linux-riscv64-musl.node')
|
|
259
|
-
)
|
|
260
|
-
try {
|
|
261
|
-
if (localFileExisted) {
|
|
262
|
-
nativeBinding = require('./tailwindcss-oxide.linux-riscv64-musl.node')
|
|
263
|
-
} else {
|
|
264
|
-
nativeBinding = require('@tailwindcss/oxide-linux-riscv64-musl')
|
|
265
|
-
}
|
|
266
|
-
} catch (e) {
|
|
267
|
-
loadError = e
|
|
268
|
-
}
|
|
269
|
-
} else {
|
|
270
|
-
localFileExisted = existsSync(
|
|
271
|
-
join(__dirname, 'tailwindcss-oxide.linux-riscv64-gnu.node')
|
|
272
|
-
)
|
|
273
|
-
try {
|
|
274
|
-
if (localFileExisted) {
|
|
275
|
-
nativeBinding = require('./tailwindcss-oxide.linux-riscv64-gnu.node')
|
|
276
|
-
} else {
|
|
277
|
-
nativeBinding = require('@tailwindcss/oxide-linux-riscv64-gnu')
|
|
278
|
-
}
|
|
279
|
-
} catch (e) {
|
|
280
|
-
loadError = e
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
break
|
|
284
|
-
case 's390x':
|
|
285
|
-
localFileExisted = existsSync(
|
|
286
|
-
join(__dirname, 'tailwindcss-oxide.linux-s390x-gnu.node')
|
|
287
|
-
)
|
|
288
|
-
try {
|
|
289
|
-
if (localFileExisted) {
|
|
290
|
-
nativeBinding = require('./tailwindcss-oxide.linux-s390x-gnu.node')
|
|
291
|
-
} else {
|
|
292
|
-
nativeBinding = require('@tailwindcss/oxide-linux-s390x-gnu')
|
|
293
|
-
}
|
|
294
|
-
} catch (e) {
|
|
295
|
-
loadError = e
|
|
296
|
-
}
|
|
297
|
-
break
|
|
298
|
-
default:
|
|
299
|
-
throw new Error(`Unsupported architecture on Linux: ${arch}`)
|
|
300
362
|
}
|
|
301
|
-
|
|
302
|
-
default:
|
|
303
|
-
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
|
|
363
|
+
}
|
|
304
364
|
}
|
|
305
365
|
|
|
306
366
|
if (!nativeBinding) {
|
|
307
|
-
if (
|
|
308
|
-
|
|
367
|
+
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 })
|
|
309
373
|
}
|
|
310
374
|
throw new Error(`Failed to load native binding`)
|
|
311
375
|
}
|
|
312
376
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
module.exports.Scanner = Scanner
|
|
377
|
+
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.
|
|
3
|
+
"version": "0.0.0-insiders.75cbfc2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/tailwindlabs/tailwindcss.git",
|
|
@@ -9,55 +9,74 @@
|
|
|
9
9
|
"main": "index.js",
|
|
10
10
|
"types": "index.d.ts",
|
|
11
11
|
"napi": {
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
12
|
+
"binaryName": "tailwindcss-oxide",
|
|
13
|
+
"packageName": "@tailwindcss/oxide",
|
|
14
|
+
"targets": [
|
|
15
|
+
"armv7-linux-androideabi",
|
|
16
|
+
"aarch64-linux-android",
|
|
17
|
+
"aarch64-apple-darwin",
|
|
18
|
+
"aarch64-unknown-linux-gnu",
|
|
19
|
+
"aarch64-unknown-linux-musl",
|
|
20
|
+
"armv7-unknown-linux-gnueabihf",
|
|
21
|
+
"x86_64-unknown-linux-musl",
|
|
22
|
+
"x86_64-unknown-freebsd",
|
|
23
|
+
"i686-pc-windows-msvc",
|
|
24
|
+
"aarch64-pc-windows-msvc",
|
|
25
|
+
"wasm32-wasip1-threads"
|
|
26
|
+
],
|
|
27
|
+
"wasm": {
|
|
28
|
+
"initialMemory": 16384,
|
|
29
|
+
"browser": {
|
|
30
|
+
"fs": true
|
|
31
|
+
}
|
|
26
32
|
}
|
|
27
33
|
},
|
|
28
34
|
"license": "MIT",
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"tar": "^7.4.3",
|
|
37
|
+
"detect-libc": "^2.0.4"
|
|
38
|
+
},
|
|
29
39
|
"devDependencies": {
|
|
30
|
-
"@napi-rs/cli": "^
|
|
40
|
+
"@napi-rs/cli": "^3.0.0-alpha.78",
|
|
41
|
+
"@napi-rs/wasm-runtime": "^0.2.11",
|
|
42
|
+
"emnapi": "1.4.3"
|
|
31
43
|
},
|
|
32
44
|
"engines": {
|
|
33
45
|
"node": ">= 10"
|
|
34
46
|
},
|
|
35
47
|
"files": [
|
|
36
48
|
"index.js",
|
|
37
|
-
"index.d.ts"
|
|
49
|
+
"index.d.ts",
|
|
50
|
+
"scripts/install.js"
|
|
38
51
|
],
|
|
39
52
|
"publishConfig": {
|
|
40
53
|
"provenance": true,
|
|
41
54
|
"access": "public"
|
|
42
55
|
},
|
|
43
56
|
"optionalDependencies": {
|
|
44
|
-
"@tailwindcss/oxide-darwin-arm64": "0.0.0-insiders.
|
|
45
|
-
"@tailwindcss/oxide-darwin-x64": "0.0.0-insiders.
|
|
46
|
-
"@tailwindcss/oxide-linux-
|
|
47
|
-
"@tailwindcss/oxide-
|
|
48
|
-
"@tailwindcss/oxide-linux-arm64-
|
|
49
|
-
"@tailwindcss/oxide-
|
|
50
|
-
"@tailwindcss/oxide-linux-
|
|
51
|
-
"@tailwindcss/oxide-
|
|
52
|
-
"@tailwindcss/oxide-
|
|
53
|
-
"@tailwindcss/oxide-win32-
|
|
54
|
-
"@tailwindcss/oxide-
|
|
57
|
+
"@tailwindcss/oxide-darwin-arm64": "0.0.0-insiders.75cbfc2",
|
|
58
|
+
"@tailwindcss/oxide-darwin-x64": "0.0.0-insiders.75cbfc2",
|
|
59
|
+
"@tailwindcss/oxide-linux-arm64-gnu": "0.0.0-insiders.75cbfc2",
|
|
60
|
+
"@tailwindcss/oxide-linux-x64-musl": "0.0.0-insiders.75cbfc2",
|
|
61
|
+
"@tailwindcss/oxide-linux-arm64-musl": "0.0.0-insiders.75cbfc2",
|
|
62
|
+
"@tailwindcss/oxide-win32-arm64-msvc": "0.0.0-insiders.75cbfc2",
|
|
63
|
+
"@tailwindcss/oxide-linux-arm-gnueabihf": "0.0.0-insiders.75cbfc2",
|
|
64
|
+
"@tailwindcss/oxide-wasm32-wasi": "0.0.0-insiders.75cbfc2",
|
|
65
|
+
"@tailwindcss/oxide-freebsd-x64": "0.0.0-insiders.75cbfc2",
|
|
66
|
+
"@tailwindcss/oxide-win32-x64-msvc": "0.0.0-insiders.75cbfc2",
|
|
67
|
+
"@tailwindcss/oxide-android-arm64": "0.0.0-insiders.75cbfc2",
|
|
68
|
+
"@tailwindcss/oxide-linux-x64-gnu": "0.0.0-insiders.75cbfc2"
|
|
55
69
|
},
|
|
56
70
|
"scripts": {
|
|
57
71
|
"artifacts": "napi artifacts",
|
|
58
|
-
"build": "
|
|
72
|
+
"build": "pnpm run build:platform && pnpm run build:wasm",
|
|
73
|
+
"build:platform": "napi build --platform --release --no-const-enum",
|
|
74
|
+
"postbuild:platform": "node ./scripts/move-artifacts.mjs",
|
|
75
|
+
"build:wasm": "napi build --release --target wasm32-wasip1-threads --no-const-enum",
|
|
76
|
+
"postbuild:wasm": "node ./scripts/move-artifacts.mjs",
|
|
59
77
|
"dev": "cargo watch --quiet --shell 'npm run build'",
|
|
60
78
|
"build:debug": "napi build --platform --no-const-enum",
|
|
61
|
-
"version": "napi version"
|
|
79
|
+
"version": "napi version",
|
|
80
|
+
"postinstall": "node ./scripts/install.js"
|
|
62
81
|
}
|
|
63
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()
|