vite-plugin-react-native-web 3.0.0-rc.2 → 3.0.1
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/dist/cjs/index.js +22 -29
- package/dist/es/index.js +20 -30
- package/package.json +2 -4
- package/README.md +0 -53
- package/dist/cjs/build2-DTMMS--0.js +0 -5267
- package/dist/cjs/chunk-D0RAK71K.js +0 -75
- package/dist/cjs/chunk-DyKKrNZQ.js +0 -35
- package/dist/cjs/lib-Csqa2WBC.js +0 -370
- package/dist/cjs/node-BU5sMlzK.js +0 -799
- package/dist/cjs/postcss-DAB3_PkB.js +0 -5428
- package/dist/cjs/postcss-import-Ogs8NQqH.js +0 -450
- package/dist/cjs/prompt-BYQIwEjg-CGdBgYkO.js +0 -850
- package/dist/es/build2-D4SLif06.js +0 -5267
- package/dist/es/chunk-CRPLlQ3x.js +0 -28
- package/dist/es/chunk-CU5vi22U.js +0 -39
- package/dist/es/lib-CK8QVVm9.js +0 -365
- package/dist/es/node-mn1xxwR1.js +0 -790
- package/dist/es/postcss-gI9snXny.js +0 -3217
- package/dist/es/postcss-import-BvPWe_Qj.js +0 -450
- package/dist/es/prompt-BYQIwEjg-C9BFbUKm.js +0 -847
package/dist/es/node-mn1xxwR1.js
DELETED
|
@@ -1,790 +0,0 @@
|
|
|
1
|
-
import { n as __require, r as __toESM, t as __commonJSMin } from "./chunk-CRPLlQ3x.js";
|
|
2
|
-
//#region node_modules/detect-libc/lib/process.js
|
|
3
|
-
var require_process = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4
|
-
const isLinux = () => process.platform === "linux";
|
|
5
|
-
let report = null;
|
|
6
|
-
const getReport = () => {
|
|
7
|
-
if (!report)
|
|
8
|
-
/* istanbul ignore next */
|
|
9
|
-
if (isLinux() && process.report) {
|
|
10
|
-
const orig = process.report.excludeNetwork;
|
|
11
|
-
process.report.excludeNetwork = true;
|
|
12
|
-
report = process.report.getReport();
|
|
13
|
-
process.report.excludeNetwork = orig;
|
|
14
|
-
} else report = {};
|
|
15
|
-
return report;
|
|
16
|
-
};
|
|
17
|
-
module.exports = {
|
|
18
|
-
isLinux,
|
|
19
|
-
getReport
|
|
20
|
-
};
|
|
21
|
-
}));
|
|
22
|
-
//#endregion
|
|
23
|
-
//#region node_modules/detect-libc/lib/filesystem.js
|
|
24
|
-
var require_filesystem = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
25
|
-
const fs = __require("fs");
|
|
26
|
-
const LDD_PATH = "/usr/bin/ldd";
|
|
27
|
-
const SELF_PATH = "/proc/self/exe";
|
|
28
|
-
const MAX_LENGTH = 2048;
|
|
29
|
-
/**
|
|
30
|
-
* Read the content of a file synchronous
|
|
31
|
-
*
|
|
32
|
-
* @param {string} path
|
|
33
|
-
* @returns {Buffer}
|
|
34
|
-
*/
|
|
35
|
-
const readFileSync = (path) => {
|
|
36
|
-
const fd = fs.openSync(path, "r");
|
|
37
|
-
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
38
|
-
const bytesRead = fs.readSync(fd, buffer, 0, MAX_LENGTH, 0);
|
|
39
|
-
fs.close(fd, () => {});
|
|
40
|
-
return buffer.subarray(0, bytesRead);
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Read the content of a file
|
|
44
|
-
*
|
|
45
|
-
* @param {string} path
|
|
46
|
-
* @returns {Promise<Buffer>}
|
|
47
|
-
*/
|
|
48
|
-
const readFile = (path) => new Promise((resolve, reject) => {
|
|
49
|
-
fs.open(path, "r", (err, fd) => {
|
|
50
|
-
if (err) reject(err);
|
|
51
|
-
else {
|
|
52
|
-
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
53
|
-
fs.read(fd, buffer, 0, MAX_LENGTH, 0, (_, bytesRead) => {
|
|
54
|
-
resolve(buffer.subarray(0, bytesRead));
|
|
55
|
-
fs.close(fd, () => {});
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
module.exports = {
|
|
61
|
-
LDD_PATH,
|
|
62
|
-
SELF_PATH,
|
|
63
|
-
readFileSync,
|
|
64
|
-
readFile
|
|
65
|
-
};
|
|
66
|
-
}));
|
|
67
|
-
//#endregion
|
|
68
|
-
//#region node_modules/detect-libc/lib/elf.js
|
|
69
|
-
var require_elf = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
70
|
-
const interpreterPath = (elf) => {
|
|
71
|
-
if (elf.length < 64) return null;
|
|
72
|
-
if (elf.readUInt32BE(0) !== 2135247942) return null;
|
|
73
|
-
if (elf.readUInt8(4) !== 2) return null;
|
|
74
|
-
if (elf.readUInt8(5) !== 1) return null;
|
|
75
|
-
const offset = elf.readUInt32LE(32);
|
|
76
|
-
const size = elf.readUInt16LE(54);
|
|
77
|
-
const count = elf.readUInt16LE(56);
|
|
78
|
-
for (let i = 0; i < count; i++) {
|
|
79
|
-
const headerOffset = offset + i * size;
|
|
80
|
-
if (elf.readUInt32LE(headerOffset) === 3) {
|
|
81
|
-
const fileOffset = elf.readUInt32LE(headerOffset + 8);
|
|
82
|
-
const fileSize = elf.readUInt32LE(headerOffset + 32);
|
|
83
|
-
return elf.subarray(fileOffset, fileOffset + fileSize).toString().replace(/\0.*$/g, "");
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return null;
|
|
87
|
-
};
|
|
88
|
-
module.exports = { interpreterPath };
|
|
89
|
-
}));
|
|
90
|
-
//#endregion
|
|
91
|
-
//#region node_modules/detect-libc/lib/detect-libc.js
|
|
92
|
-
var require_detect_libc = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
93
|
-
const childProcess = __require("child_process");
|
|
94
|
-
const { isLinux, getReport } = require_process();
|
|
95
|
-
const { LDD_PATH, SELF_PATH, readFile, readFileSync } = require_filesystem();
|
|
96
|
-
const { interpreterPath } = require_elf();
|
|
97
|
-
let cachedFamilyInterpreter;
|
|
98
|
-
let cachedFamilyFilesystem;
|
|
99
|
-
let cachedVersionFilesystem;
|
|
100
|
-
const command = "getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true";
|
|
101
|
-
let commandOut = "";
|
|
102
|
-
const safeCommand = () => {
|
|
103
|
-
if (!commandOut) return new Promise((resolve) => {
|
|
104
|
-
childProcess.exec(command, (err, out) => {
|
|
105
|
-
commandOut = err ? " " : out;
|
|
106
|
-
resolve(commandOut);
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
return commandOut;
|
|
110
|
-
};
|
|
111
|
-
const safeCommandSync = () => {
|
|
112
|
-
if (!commandOut) try {
|
|
113
|
-
commandOut = childProcess.execSync(command, { encoding: "utf8" });
|
|
114
|
-
} catch (_err) {
|
|
115
|
-
commandOut = " ";
|
|
116
|
-
}
|
|
117
|
-
return commandOut;
|
|
118
|
-
};
|
|
119
|
-
/**
|
|
120
|
-
* A String constant containing the value `glibc`.
|
|
121
|
-
* @type {string}
|
|
122
|
-
* @public
|
|
123
|
-
*/
|
|
124
|
-
const GLIBC = "glibc";
|
|
125
|
-
/**
|
|
126
|
-
* A Regexp constant to get the GLIBC Version.
|
|
127
|
-
* @type {string}
|
|
128
|
-
*/
|
|
129
|
-
const RE_GLIBC_VERSION = /LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i;
|
|
130
|
-
/**
|
|
131
|
-
* A String constant containing the value `musl`.
|
|
132
|
-
* @type {string}
|
|
133
|
-
* @public
|
|
134
|
-
*/
|
|
135
|
-
const MUSL = "musl";
|
|
136
|
-
const isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
|
|
137
|
-
const familyFromReport = () => {
|
|
138
|
-
const report = getReport();
|
|
139
|
-
if (report.header && report.header.glibcVersionRuntime) return GLIBC;
|
|
140
|
-
if (Array.isArray(report.sharedObjects)) {
|
|
141
|
-
if (report.sharedObjects.some(isFileMusl)) return MUSL;
|
|
142
|
-
}
|
|
143
|
-
return null;
|
|
144
|
-
};
|
|
145
|
-
const familyFromCommand = (out) => {
|
|
146
|
-
const [getconf, ldd1] = out.split(/[\r\n]+/);
|
|
147
|
-
if (getconf && getconf.includes(GLIBC)) return GLIBC;
|
|
148
|
-
if (ldd1 && ldd1.includes(MUSL)) return MUSL;
|
|
149
|
-
return null;
|
|
150
|
-
};
|
|
151
|
-
const familyFromInterpreterPath = (path) => {
|
|
152
|
-
if (path) {
|
|
153
|
-
if (path.includes("/ld-musl-")) return MUSL;
|
|
154
|
-
else if (path.includes("/ld-linux-")) return GLIBC;
|
|
155
|
-
}
|
|
156
|
-
return null;
|
|
157
|
-
};
|
|
158
|
-
const getFamilyFromLddContent = (content) => {
|
|
159
|
-
content = content.toString();
|
|
160
|
-
if (content.includes("musl")) return MUSL;
|
|
161
|
-
if (content.includes("GNU C Library")) return GLIBC;
|
|
162
|
-
return null;
|
|
163
|
-
};
|
|
164
|
-
const familyFromFilesystem = async () => {
|
|
165
|
-
if (cachedFamilyFilesystem !== void 0) return cachedFamilyFilesystem;
|
|
166
|
-
cachedFamilyFilesystem = null;
|
|
167
|
-
try {
|
|
168
|
-
cachedFamilyFilesystem = getFamilyFromLddContent(await readFile(LDD_PATH));
|
|
169
|
-
} catch (e) {}
|
|
170
|
-
return cachedFamilyFilesystem;
|
|
171
|
-
};
|
|
172
|
-
const familyFromFilesystemSync = () => {
|
|
173
|
-
if (cachedFamilyFilesystem !== void 0) return cachedFamilyFilesystem;
|
|
174
|
-
cachedFamilyFilesystem = null;
|
|
175
|
-
try {
|
|
176
|
-
cachedFamilyFilesystem = getFamilyFromLddContent(readFileSync(LDD_PATH));
|
|
177
|
-
} catch (e) {}
|
|
178
|
-
return cachedFamilyFilesystem;
|
|
179
|
-
};
|
|
180
|
-
const familyFromInterpreter = async () => {
|
|
181
|
-
if (cachedFamilyInterpreter !== void 0) return cachedFamilyInterpreter;
|
|
182
|
-
cachedFamilyInterpreter = null;
|
|
183
|
-
try {
|
|
184
|
-
cachedFamilyInterpreter = familyFromInterpreterPath(interpreterPath(await readFile(SELF_PATH)));
|
|
185
|
-
} catch (e) {}
|
|
186
|
-
return cachedFamilyInterpreter;
|
|
187
|
-
};
|
|
188
|
-
const familyFromInterpreterSync = () => {
|
|
189
|
-
if (cachedFamilyInterpreter !== void 0) return cachedFamilyInterpreter;
|
|
190
|
-
cachedFamilyInterpreter = null;
|
|
191
|
-
try {
|
|
192
|
-
cachedFamilyInterpreter = familyFromInterpreterPath(interpreterPath(readFileSync(SELF_PATH)));
|
|
193
|
-
} catch (e) {}
|
|
194
|
-
return cachedFamilyInterpreter;
|
|
195
|
-
};
|
|
196
|
-
/**
|
|
197
|
-
* Resolves with the libc family when it can be determined, `null` otherwise.
|
|
198
|
-
* @returns {Promise<?string>}
|
|
199
|
-
*/
|
|
200
|
-
const family = async () => {
|
|
201
|
-
let family = null;
|
|
202
|
-
if (isLinux()) {
|
|
203
|
-
family = await familyFromInterpreter();
|
|
204
|
-
if (!family) {
|
|
205
|
-
family = await familyFromFilesystem();
|
|
206
|
-
if (!family) family = familyFromReport();
|
|
207
|
-
if (!family) family = familyFromCommand(await safeCommand());
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
return family;
|
|
211
|
-
};
|
|
212
|
-
/**
|
|
213
|
-
* Returns the libc family when it can be determined, `null` otherwise.
|
|
214
|
-
* @returns {?string}
|
|
215
|
-
*/
|
|
216
|
-
const familySync = () => {
|
|
217
|
-
let family = null;
|
|
218
|
-
if (isLinux()) {
|
|
219
|
-
family = familyFromInterpreterSync();
|
|
220
|
-
if (!family) {
|
|
221
|
-
family = familyFromFilesystemSync();
|
|
222
|
-
if (!family) family = familyFromReport();
|
|
223
|
-
if (!family) family = familyFromCommand(safeCommandSync());
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
return family;
|
|
227
|
-
};
|
|
228
|
-
/**
|
|
229
|
-
* Resolves `true` only when the platform is Linux and the libc family is not `glibc`.
|
|
230
|
-
* @returns {Promise<boolean>}
|
|
231
|
-
*/
|
|
232
|
-
const isNonGlibcLinux = async () => isLinux() && await family() !== GLIBC;
|
|
233
|
-
/**
|
|
234
|
-
* Returns `true` only when the platform is Linux and the libc family is not `glibc`.
|
|
235
|
-
* @returns {boolean}
|
|
236
|
-
*/
|
|
237
|
-
const isNonGlibcLinuxSync = () => isLinux() && familySync() !== GLIBC;
|
|
238
|
-
const versionFromFilesystem = async () => {
|
|
239
|
-
if (cachedVersionFilesystem !== void 0) return cachedVersionFilesystem;
|
|
240
|
-
cachedVersionFilesystem = null;
|
|
241
|
-
try {
|
|
242
|
-
const versionMatch = (await readFile(LDD_PATH)).match(RE_GLIBC_VERSION);
|
|
243
|
-
if (versionMatch) cachedVersionFilesystem = versionMatch[1];
|
|
244
|
-
} catch (e) {}
|
|
245
|
-
return cachedVersionFilesystem;
|
|
246
|
-
};
|
|
247
|
-
const versionFromFilesystemSync = () => {
|
|
248
|
-
if (cachedVersionFilesystem !== void 0) return cachedVersionFilesystem;
|
|
249
|
-
cachedVersionFilesystem = null;
|
|
250
|
-
try {
|
|
251
|
-
const versionMatch = readFileSync(LDD_PATH).match(RE_GLIBC_VERSION);
|
|
252
|
-
if (versionMatch) cachedVersionFilesystem = versionMatch[1];
|
|
253
|
-
} catch (e) {}
|
|
254
|
-
return cachedVersionFilesystem;
|
|
255
|
-
};
|
|
256
|
-
const versionFromReport = () => {
|
|
257
|
-
const report = getReport();
|
|
258
|
-
if (report.header && report.header.glibcVersionRuntime) return report.header.glibcVersionRuntime;
|
|
259
|
-
return null;
|
|
260
|
-
};
|
|
261
|
-
const versionSuffix = (s) => s.trim().split(/\s+/)[1];
|
|
262
|
-
const versionFromCommand = (out) => {
|
|
263
|
-
const [getconf, ldd1, ldd2] = out.split(/[\r\n]+/);
|
|
264
|
-
if (getconf && getconf.includes(GLIBC)) return versionSuffix(getconf);
|
|
265
|
-
if (ldd1 && ldd2 && ldd1.includes(MUSL)) return versionSuffix(ldd2);
|
|
266
|
-
return null;
|
|
267
|
-
};
|
|
268
|
-
/**
|
|
269
|
-
* Resolves with the libc version when it can be determined, `null` otherwise.
|
|
270
|
-
* @returns {Promise<?string>}
|
|
271
|
-
*/
|
|
272
|
-
const version = async () => {
|
|
273
|
-
let version = null;
|
|
274
|
-
if (isLinux()) {
|
|
275
|
-
version = await versionFromFilesystem();
|
|
276
|
-
if (!version) version = versionFromReport();
|
|
277
|
-
if (!version) version = versionFromCommand(await safeCommand());
|
|
278
|
-
}
|
|
279
|
-
return version;
|
|
280
|
-
};
|
|
281
|
-
/**
|
|
282
|
-
* Returns the libc version when it can be determined, `null` otherwise.
|
|
283
|
-
* @returns {?string}
|
|
284
|
-
*/
|
|
285
|
-
const versionSync = () => {
|
|
286
|
-
let version = null;
|
|
287
|
-
if (isLinux()) {
|
|
288
|
-
version = versionFromFilesystemSync();
|
|
289
|
-
if (!version) version = versionFromReport();
|
|
290
|
-
if (!version) version = versionFromCommand(safeCommandSync());
|
|
291
|
-
}
|
|
292
|
-
return version;
|
|
293
|
-
};
|
|
294
|
-
module.exports = {
|
|
295
|
-
GLIBC,
|
|
296
|
-
MUSL,
|
|
297
|
-
family,
|
|
298
|
-
familySync,
|
|
299
|
-
isNonGlibcLinux,
|
|
300
|
-
isNonGlibcLinuxSync,
|
|
301
|
-
version,
|
|
302
|
-
versionSync
|
|
303
|
-
};
|
|
304
|
-
}));
|
|
305
|
-
//#endregion
|
|
306
|
-
//#region node_modules/lightningcss/node/browserslistToTargets.js
|
|
307
|
-
var require_browserslistToTargets = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
308
|
-
const BROWSER_MAPPING = {
|
|
309
|
-
and_chr: "chrome",
|
|
310
|
-
and_ff: "firefox",
|
|
311
|
-
ie_mob: "ie",
|
|
312
|
-
op_mob: "opera",
|
|
313
|
-
and_qq: null,
|
|
314
|
-
and_uc: null,
|
|
315
|
-
baidu: null,
|
|
316
|
-
bb: null,
|
|
317
|
-
kaios: null,
|
|
318
|
-
op_mini: null
|
|
319
|
-
};
|
|
320
|
-
function browserslistToTargets(browserslist) {
|
|
321
|
-
let targets = {};
|
|
322
|
-
for (let browser of browserslist) {
|
|
323
|
-
let [name, v] = browser.split(" ");
|
|
324
|
-
if (BROWSER_MAPPING[name] === null) continue;
|
|
325
|
-
let version = parseVersion(v);
|
|
326
|
-
if (version == null) continue;
|
|
327
|
-
if (targets[name] == null || version < targets[name]) targets[name] = version;
|
|
328
|
-
}
|
|
329
|
-
return targets;
|
|
330
|
-
}
|
|
331
|
-
function parseVersion(version) {
|
|
332
|
-
let [major, minor = 0, patch = 0] = version.split("-")[0].split(".").map((v) => parseInt(v, 10));
|
|
333
|
-
if (isNaN(major) || isNaN(minor) || isNaN(patch)) return null;
|
|
334
|
-
return major << 16 | minor << 8 | patch;
|
|
335
|
-
}
|
|
336
|
-
module.exports = browserslistToTargets;
|
|
337
|
-
}));
|
|
338
|
-
//#endregion
|
|
339
|
-
//#region node_modules/lightningcss/node/composeVisitors.js
|
|
340
|
-
var require_composeVisitors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
341
|
-
/** @typedef {import('./index').Visitor} Visitor */
|
|
342
|
-
/** @typedef {import('./index').VisitorFunction} VisitorFunction */
|
|
343
|
-
/**
|
|
344
|
-
* Composes multiple visitor objects into a single one.
|
|
345
|
-
* @param {(Visitor | VisitorFunction)[]} visitors
|
|
346
|
-
* @return {Visitor | VisitorFunction}
|
|
347
|
-
*/
|
|
348
|
-
function composeVisitors(visitors) {
|
|
349
|
-
if (visitors.length === 1) return visitors[0];
|
|
350
|
-
if (visitors.some((v) => typeof v === "function")) return (opts) => {
|
|
351
|
-
return composeVisitors(visitors.map((v) => typeof v === "function" ? v(opts) : v));
|
|
352
|
-
};
|
|
353
|
-
/** @type Visitor */
|
|
354
|
-
let res = {};
|
|
355
|
-
composeSimpleVisitors(res, visitors, "StyleSheet");
|
|
356
|
-
composeSimpleVisitors(res, visitors, "StyleSheetExit");
|
|
357
|
-
composeObjectVisitors(res, visitors, "Rule", ruleVisitor, wrapCustomAndUnknownAtRule);
|
|
358
|
-
composeObjectVisitors(res, visitors, "RuleExit", ruleVisitor, wrapCustomAndUnknownAtRule);
|
|
359
|
-
composeObjectVisitors(res, visitors, "Declaration", declarationVisitor, wrapCustomProperty);
|
|
360
|
-
composeObjectVisitors(res, visitors, "DeclarationExit", declarationVisitor, wrapCustomProperty);
|
|
361
|
-
composeSimpleVisitors(res, visitors, "Url");
|
|
362
|
-
composeSimpleVisitors(res, visitors, "Color");
|
|
363
|
-
composeSimpleVisitors(res, visitors, "Image");
|
|
364
|
-
composeSimpleVisitors(res, visitors, "ImageExit");
|
|
365
|
-
composeSimpleVisitors(res, visitors, "Length");
|
|
366
|
-
composeSimpleVisitors(res, visitors, "Angle");
|
|
367
|
-
composeSimpleVisitors(res, visitors, "Ratio");
|
|
368
|
-
composeSimpleVisitors(res, visitors, "Resolution");
|
|
369
|
-
composeSimpleVisitors(res, visitors, "Time");
|
|
370
|
-
composeSimpleVisitors(res, visitors, "CustomIdent");
|
|
371
|
-
composeSimpleVisitors(res, visitors, "DashedIdent");
|
|
372
|
-
composeArrayFunctions(res, visitors, "MediaQuery");
|
|
373
|
-
composeArrayFunctions(res, visitors, "MediaQueryExit");
|
|
374
|
-
composeSimpleVisitors(res, visitors, "SupportsCondition");
|
|
375
|
-
composeSimpleVisitors(res, visitors, "SupportsConditionExit");
|
|
376
|
-
composeArrayFunctions(res, visitors, "Selector");
|
|
377
|
-
composeTokenVisitors(res, visitors, "Token", "token", false);
|
|
378
|
-
composeTokenVisitors(res, visitors, "Function", "function", false);
|
|
379
|
-
composeTokenVisitors(res, visitors, "FunctionExit", "function", true);
|
|
380
|
-
composeTokenVisitors(res, visitors, "Variable", "var", false);
|
|
381
|
-
composeTokenVisitors(res, visitors, "VariableExit", "var", true);
|
|
382
|
-
composeTokenVisitors(res, visitors, "EnvironmentVariable", "env", false);
|
|
383
|
-
composeTokenVisitors(res, visitors, "EnvironmentVariableExit", "env", true);
|
|
384
|
-
return res;
|
|
385
|
-
}
|
|
386
|
-
module.exports = composeVisitors;
|
|
387
|
-
function wrapCustomAndUnknownAtRule(k, f) {
|
|
388
|
-
if (k === "unknown") return ((value) => f({
|
|
389
|
-
type: "unknown",
|
|
390
|
-
value
|
|
391
|
-
}));
|
|
392
|
-
if (k === "custom") return ((value) => f({
|
|
393
|
-
type: "custom",
|
|
394
|
-
value
|
|
395
|
-
}));
|
|
396
|
-
return f;
|
|
397
|
-
}
|
|
398
|
-
function wrapCustomProperty(k, f) {
|
|
399
|
-
return k === "custom" ? ((value) => f({
|
|
400
|
-
property: "custom",
|
|
401
|
-
value
|
|
402
|
-
})) : f;
|
|
403
|
-
}
|
|
404
|
-
/**
|
|
405
|
-
* @param {import('./index').Visitor['Rule']} f
|
|
406
|
-
* @param {import('./ast').Rule} item
|
|
407
|
-
*/
|
|
408
|
-
function ruleVisitor(f, item) {
|
|
409
|
-
if (typeof f === "object") {
|
|
410
|
-
if (item.type === "unknown") {
|
|
411
|
-
let v = f.unknown;
|
|
412
|
-
if (typeof v === "object") v = v[item.value.name];
|
|
413
|
-
return v?.(item.value);
|
|
414
|
-
}
|
|
415
|
-
if (item.type === "custom") {
|
|
416
|
-
let v = f.custom;
|
|
417
|
-
if (typeof v === "object") v = v[item.value.name];
|
|
418
|
-
return v?.(item.value);
|
|
419
|
-
}
|
|
420
|
-
return f[item.type]?.(item);
|
|
421
|
-
}
|
|
422
|
-
return f?.(item);
|
|
423
|
-
}
|
|
424
|
-
/**
|
|
425
|
-
* @param {import('./index').Visitor['Declaration']} f
|
|
426
|
-
* @param {import('./ast').Declaration} item
|
|
427
|
-
*/
|
|
428
|
-
function declarationVisitor(f, item) {
|
|
429
|
-
if (typeof f === "object") {
|
|
430
|
-
/** @type {string} */
|
|
431
|
-
let name = item.property;
|
|
432
|
-
if (item.property === "unparsed") name = item.value.propertyId.property;
|
|
433
|
-
else if (item.property === "custom") {
|
|
434
|
-
let v = f.custom;
|
|
435
|
-
if (typeof v === "object") v = v[item.value.name];
|
|
436
|
-
return v?.(item.value);
|
|
437
|
-
}
|
|
438
|
-
return f[name]?.(item);
|
|
439
|
-
}
|
|
440
|
-
return f?.(item);
|
|
441
|
-
}
|
|
442
|
-
/**
|
|
443
|
-
*
|
|
444
|
-
* @param {Visitor[]} visitors
|
|
445
|
-
* @param {string} key
|
|
446
|
-
* @returns {[any[], boolean, Set<string>]}
|
|
447
|
-
*/
|
|
448
|
-
function extractObjectsOrFunctions(visitors, key) {
|
|
449
|
-
let values = [];
|
|
450
|
-
let hasFunction = false;
|
|
451
|
-
let allKeys = /* @__PURE__ */ new Set();
|
|
452
|
-
for (let visitor of visitors) {
|
|
453
|
-
let v = visitor[key];
|
|
454
|
-
if (v) {
|
|
455
|
-
if (typeof v === "function") hasFunction = true;
|
|
456
|
-
else for (let key in v) allKeys.add(key);
|
|
457
|
-
values.push(v);
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
return [
|
|
461
|
-
values,
|
|
462
|
-
hasFunction,
|
|
463
|
-
allKeys
|
|
464
|
-
];
|
|
465
|
-
}
|
|
466
|
-
/**
|
|
467
|
-
* @template {keyof Visitor} K
|
|
468
|
-
* @param {Visitor} res
|
|
469
|
-
* @param {Visitor[]} visitors
|
|
470
|
-
* @param {K} key
|
|
471
|
-
* @param {(visitor: Visitor[K], item: any) => any | any[] | void} apply
|
|
472
|
-
* @param {(k: string, f: any) => any} wrapKey
|
|
473
|
-
*/
|
|
474
|
-
function composeObjectVisitors(res, visitors, key, apply, wrapKey) {
|
|
475
|
-
let [values, hasFunction, allKeys] = extractObjectsOrFunctions(visitors, key);
|
|
476
|
-
if (values.length === 0) return;
|
|
477
|
-
if (values.length === 1) {
|
|
478
|
-
res[key] = values[0];
|
|
479
|
-
return;
|
|
480
|
-
}
|
|
481
|
-
let f = createArrayVisitor(visitors, (visitor, item) => apply(visitor[key], item));
|
|
482
|
-
if (hasFunction) res[key] = f;
|
|
483
|
-
else {
|
|
484
|
-
/** @type {any} */
|
|
485
|
-
let v = {};
|
|
486
|
-
for (let k of allKeys) v[k] = wrapKey(k, f);
|
|
487
|
-
res[key] = v;
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
/**
|
|
491
|
-
* @param {Visitor} res
|
|
492
|
-
* @param {Visitor[]} visitors
|
|
493
|
-
* @param {string} key
|
|
494
|
-
* @param {import('./ast').TokenOrValue['type']} type
|
|
495
|
-
* @param {boolean} isExit
|
|
496
|
-
*/
|
|
497
|
-
function composeTokenVisitors(res, visitors, key, type, isExit) {
|
|
498
|
-
let [values, hasFunction, allKeys] = extractObjectsOrFunctions(visitors, key);
|
|
499
|
-
if (values.length === 0) return;
|
|
500
|
-
if (values.length === 1) {
|
|
501
|
-
res[key] = values[0];
|
|
502
|
-
return;
|
|
503
|
-
}
|
|
504
|
-
let f = createTokenVisitor(visitors, type, isExit);
|
|
505
|
-
if (hasFunction) res[key] = f;
|
|
506
|
-
else {
|
|
507
|
-
let v = {};
|
|
508
|
-
for (let key of allKeys) v[key] = f;
|
|
509
|
-
res[key] = v;
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
/**
|
|
513
|
-
* @param {Visitor[]} visitors
|
|
514
|
-
* @param {import('./ast').TokenOrValue['type']} type
|
|
515
|
-
*/
|
|
516
|
-
function createTokenVisitor(visitors, type, isExit) {
|
|
517
|
-
let v = createArrayVisitor(visitors, (visitor, item) => {
|
|
518
|
-
let f;
|
|
519
|
-
switch (item.type) {
|
|
520
|
-
case "token":
|
|
521
|
-
f = visitor.Token;
|
|
522
|
-
if (typeof f === "object") f = f[item.value.type];
|
|
523
|
-
break;
|
|
524
|
-
case "function":
|
|
525
|
-
f = isExit ? visitor.FunctionExit : visitor.Function;
|
|
526
|
-
if (typeof f === "object") f = f[item.value.name];
|
|
527
|
-
break;
|
|
528
|
-
case "var":
|
|
529
|
-
f = isExit ? visitor.VariableExit : visitor.Variable;
|
|
530
|
-
break;
|
|
531
|
-
case "env":
|
|
532
|
-
f = isExit ? visitor.EnvironmentVariableExit : visitor.EnvironmentVariable;
|
|
533
|
-
if (typeof f === "object") {
|
|
534
|
-
let name;
|
|
535
|
-
switch (item.value.name.type) {
|
|
536
|
-
case "ua":
|
|
537
|
-
case "unknown":
|
|
538
|
-
name = item.value.name.value;
|
|
539
|
-
break;
|
|
540
|
-
case "custom":
|
|
541
|
-
name = item.value.name.ident;
|
|
542
|
-
break;
|
|
543
|
-
}
|
|
544
|
-
f = f[name];
|
|
545
|
-
}
|
|
546
|
-
break;
|
|
547
|
-
case "color":
|
|
548
|
-
f = visitor.Color;
|
|
549
|
-
break;
|
|
550
|
-
case "url":
|
|
551
|
-
f = visitor.Url;
|
|
552
|
-
break;
|
|
553
|
-
case "length":
|
|
554
|
-
f = visitor.Length;
|
|
555
|
-
break;
|
|
556
|
-
case "angle":
|
|
557
|
-
f = visitor.Angle;
|
|
558
|
-
break;
|
|
559
|
-
case "time":
|
|
560
|
-
f = visitor.Time;
|
|
561
|
-
break;
|
|
562
|
-
case "resolution":
|
|
563
|
-
f = visitor.Resolution;
|
|
564
|
-
break;
|
|
565
|
-
case "dashed-ident":
|
|
566
|
-
f = visitor.DashedIdent;
|
|
567
|
-
break;
|
|
568
|
-
}
|
|
569
|
-
if (!f) return;
|
|
570
|
-
let res = f(item.value);
|
|
571
|
-
switch (item.type) {
|
|
572
|
-
case "color":
|
|
573
|
-
case "url":
|
|
574
|
-
case "length":
|
|
575
|
-
case "angle":
|
|
576
|
-
case "time":
|
|
577
|
-
case "resolution":
|
|
578
|
-
case "dashed-ident":
|
|
579
|
-
if (Array.isArray(res)) res = res.map((value) => ({
|
|
580
|
-
type: item.type,
|
|
581
|
-
value
|
|
582
|
-
}));
|
|
583
|
-
else if (res) res = {
|
|
584
|
-
type: item.type,
|
|
585
|
-
value: res
|
|
586
|
-
};
|
|
587
|
-
break;
|
|
588
|
-
}
|
|
589
|
-
return res;
|
|
590
|
-
});
|
|
591
|
-
return (value) => v({
|
|
592
|
-
type,
|
|
593
|
-
value
|
|
594
|
-
});
|
|
595
|
-
}
|
|
596
|
-
/**
|
|
597
|
-
* @param {Visitor[]} visitors
|
|
598
|
-
* @param {string} key
|
|
599
|
-
*/
|
|
600
|
-
function extractFunctions(visitors, key) {
|
|
601
|
-
let functions = [];
|
|
602
|
-
for (let visitor of visitors) {
|
|
603
|
-
let f = visitor[key];
|
|
604
|
-
if (f) functions.push(f);
|
|
605
|
-
}
|
|
606
|
-
return functions;
|
|
607
|
-
}
|
|
608
|
-
/**
|
|
609
|
-
* @param {Visitor} res
|
|
610
|
-
* @param {Visitor[]} visitors
|
|
611
|
-
* @param {string} key
|
|
612
|
-
*/
|
|
613
|
-
function composeSimpleVisitors(res, visitors, key) {
|
|
614
|
-
let functions = extractFunctions(visitors, key);
|
|
615
|
-
if (functions.length === 0) return;
|
|
616
|
-
if (functions.length === 1) {
|
|
617
|
-
res[key] = functions[0];
|
|
618
|
-
return;
|
|
619
|
-
}
|
|
620
|
-
res[key] = (arg) => {
|
|
621
|
-
let mutated = false;
|
|
622
|
-
for (let f of functions) {
|
|
623
|
-
let res = f(arg);
|
|
624
|
-
if (res) {
|
|
625
|
-
arg = res;
|
|
626
|
-
mutated = true;
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
return mutated ? arg : void 0;
|
|
630
|
-
};
|
|
631
|
-
}
|
|
632
|
-
/**
|
|
633
|
-
* @param {Visitor} res
|
|
634
|
-
* @param {Visitor[]} visitors
|
|
635
|
-
* @param {string} key
|
|
636
|
-
*/
|
|
637
|
-
function composeArrayFunctions(res, visitors, key) {
|
|
638
|
-
let functions = extractFunctions(visitors, key);
|
|
639
|
-
if (functions.length === 0) return;
|
|
640
|
-
if (functions.length === 1) {
|
|
641
|
-
res[key] = functions[0];
|
|
642
|
-
return;
|
|
643
|
-
}
|
|
644
|
-
res[key] = createArrayVisitor(functions, (f, item) => f(item));
|
|
645
|
-
}
|
|
646
|
-
/**
|
|
647
|
-
* @template T
|
|
648
|
-
* @template V
|
|
649
|
-
* @param {T[]} visitors
|
|
650
|
-
* @param {(visitor: T, item: V) => V | V[] | void} apply
|
|
651
|
-
* @returns {(item: V) => V | V[] | void}
|
|
652
|
-
*/
|
|
653
|
-
function createArrayVisitor(visitors, apply) {
|
|
654
|
-
let seen = new Bitset(visitors.length);
|
|
655
|
-
return (arg) => {
|
|
656
|
-
let arr = [arg];
|
|
657
|
-
let mutated = false;
|
|
658
|
-
seen.clear();
|
|
659
|
-
for (let i = 0; i < arr.length; i++) for (let v = 0; v < visitors.length && i < arr.length;) {
|
|
660
|
-
if (seen.get(v)) {
|
|
661
|
-
v++;
|
|
662
|
-
continue;
|
|
663
|
-
}
|
|
664
|
-
let item = arr[i];
|
|
665
|
-
let visitor = visitors[v];
|
|
666
|
-
let res = apply(visitor, item);
|
|
667
|
-
if (Array.isArray(res)) {
|
|
668
|
-
if (res.length === 0) arr.splice(i, 1);
|
|
669
|
-
else if (res.length === 1) arr[i] = res[0];
|
|
670
|
-
else arr.splice(i, 1, ...res);
|
|
671
|
-
mutated = true;
|
|
672
|
-
seen.set(v);
|
|
673
|
-
v = 0;
|
|
674
|
-
} else if (res) {
|
|
675
|
-
arr[i] = res;
|
|
676
|
-
mutated = true;
|
|
677
|
-
seen.set(v);
|
|
678
|
-
v = 0;
|
|
679
|
-
} else v++;
|
|
680
|
-
}
|
|
681
|
-
if (!mutated) return;
|
|
682
|
-
return arr.length === 1 ? arr[0] : arr;
|
|
683
|
-
};
|
|
684
|
-
}
|
|
685
|
-
var Bitset = class {
|
|
686
|
-
constructor(maxBits = 32) {
|
|
687
|
-
this.bits = 0;
|
|
688
|
-
this.more = maxBits > 32 ? new Uint32Array(Math.ceil((maxBits - 32) / 32)) : null;
|
|
689
|
-
}
|
|
690
|
-
/** @param {number} bit */
|
|
691
|
-
get(bit) {
|
|
692
|
-
if (bit >= 32 && this.more) {
|
|
693
|
-
let i = Math.floor((bit - 32) / 32);
|
|
694
|
-
let b = bit % 32;
|
|
695
|
-
return Boolean(this.more[i] & 1 << b);
|
|
696
|
-
} else return Boolean(this.bits & 1 << bit);
|
|
697
|
-
}
|
|
698
|
-
/** @param {number} bit */
|
|
699
|
-
set(bit) {
|
|
700
|
-
if (bit >= 32 && this.more) {
|
|
701
|
-
let i = Math.floor((bit - 32) / 32);
|
|
702
|
-
let b = bit % 32;
|
|
703
|
-
this.more[i] |= 1 << b;
|
|
704
|
-
} else this.bits |= 1 << bit;
|
|
705
|
-
}
|
|
706
|
-
clear() {
|
|
707
|
-
this.bits = 0;
|
|
708
|
-
if (this.more) this.more.fill(0);
|
|
709
|
-
}
|
|
710
|
-
};
|
|
711
|
-
}));
|
|
712
|
-
//#endregion
|
|
713
|
-
//#region node_modules/lightningcss/node/flags.js
|
|
714
|
-
var require_flags = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
715
|
-
exports.Features = {
|
|
716
|
-
Nesting: 1,
|
|
717
|
-
NotSelectorList: 2,
|
|
718
|
-
DirSelector: 4,
|
|
719
|
-
LangSelectorList: 8,
|
|
720
|
-
IsSelector: 16,
|
|
721
|
-
TextDecorationThicknessPercent: 32,
|
|
722
|
-
MediaIntervalSyntax: 64,
|
|
723
|
-
MediaRangeSyntax: 128,
|
|
724
|
-
CustomMediaQueries: 256,
|
|
725
|
-
ClampFunction: 512,
|
|
726
|
-
ColorFunction: 1024,
|
|
727
|
-
OklabColors: 2048,
|
|
728
|
-
LabColors: 4096,
|
|
729
|
-
P3Colors: 8192,
|
|
730
|
-
HexAlphaColors: 16384,
|
|
731
|
-
SpaceSeparatedColorNotation: 32768,
|
|
732
|
-
FontFamilySystemUi: 65536,
|
|
733
|
-
DoublePositionGradients: 131072,
|
|
734
|
-
VendorPrefixes: 262144,
|
|
735
|
-
LogicalProperties: 524288,
|
|
736
|
-
LightDark: 1048576,
|
|
737
|
-
Selectors: 31,
|
|
738
|
-
MediaQueries: 448,
|
|
739
|
-
Colors: 1113088
|
|
740
|
-
};
|
|
741
|
-
}));
|
|
742
|
-
const { transform, transformStyleAttribute, bundle, bundleAsync, browserslistToTargets, composeVisitors, Features } = (/* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
743
|
-
let parts = [process.platform, process.arch];
|
|
744
|
-
if (process.platform === "linux") {
|
|
745
|
-
const { MUSL, familySync } = require_detect_libc();
|
|
746
|
-
if (familySync() === MUSL) parts.push("musl");
|
|
747
|
-
else if (process.arch === "arm") parts.push("gnueabihf");
|
|
748
|
-
else parts.push("gnu");
|
|
749
|
-
} else if (process.platform === "win32") parts.push("msvc");
|
|
750
|
-
let native;
|
|
751
|
-
try {
|
|
752
|
-
native = __require(`lightningcss-${parts.join("-")}`);
|
|
753
|
-
} catch (err) {
|
|
754
|
-
native = __require(`../lightningcss.${parts.join("-")}.node`);
|
|
755
|
-
}
|
|
756
|
-
module.exports.transform = wrap(native.transform);
|
|
757
|
-
module.exports.transformStyleAttribute = wrap(native.transformStyleAttribute);
|
|
758
|
-
module.exports.bundle = wrap(native.bundle);
|
|
759
|
-
module.exports.bundleAsync = wrap(native.bundleAsync);
|
|
760
|
-
module.exports.browserslistToTargets = require_browserslistToTargets();
|
|
761
|
-
module.exports.composeVisitors = require_composeVisitors();
|
|
762
|
-
module.exports.Features = require_flags().Features;
|
|
763
|
-
function wrap(call) {
|
|
764
|
-
return (options) => {
|
|
765
|
-
if (typeof options.visitor === "function") {
|
|
766
|
-
let deps = [];
|
|
767
|
-
options.visitor = options.visitor({ addDependency(dep) {
|
|
768
|
-
deps.push(dep);
|
|
769
|
-
} });
|
|
770
|
-
let result = call(options);
|
|
771
|
-
if (result instanceof Promise) result = result.then((res) => {
|
|
772
|
-
if (deps.length) {
|
|
773
|
-
res.dependencies ??= [];
|
|
774
|
-
res.dependencies.push(...deps);
|
|
775
|
-
}
|
|
776
|
-
return res;
|
|
777
|
-
});
|
|
778
|
-
else if (deps.length) {
|
|
779
|
-
result.dependencies ??= [];
|
|
780
|
-
result.dependencies.push(...deps);
|
|
781
|
-
}
|
|
782
|
-
return result;
|
|
783
|
-
} else return call(options);
|
|
784
|
-
};
|
|
785
|
-
}
|
|
786
|
-
})))(), 1)).default;
|
|
787
|
-
//#endregion
|
|
788
|
-
export { Features, browserslistToTargets, bundle, bundleAsync, composeVisitors, transform, transformStyleAttribute };
|
|
789
|
-
|
|
790
|
-
//# sourceMappingURL=node-mn1xxwR1.js.map
|