koffi 2.6.11 → 2.6.12
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/CHANGELOG.md +4 -0
- package/build/koffi/darwin_arm64/koffi.node +0 -0
- package/build/koffi/darwin_x64/koffi.node +0 -0
- package/build/koffi/freebsd_arm64/koffi.node +0 -0
- package/build/koffi/freebsd_ia32/koffi.node +0 -0
- package/build/koffi/freebsd_x64/koffi.node +0 -0
- package/build/koffi/linux_arm32hf/koffi.node +0 -0
- package/build/koffi/linux_arm64/koffi.node +0 -0
- package/build/koffi/linux_ia32/koffi.node +0 -0
- package/build/koffi/linux_riscv64hf64/koffi.node +0 -0
- package/build/koffi/linux_x64/koffi.node +0 -0
- package/build/koffi/openbsd_ia32/koffi.node +0 -0
- package/build/koffi/openbsd_x64/koffi.node +0 -0
- package/build/koffi/win32_arm64/koffi.node +0 -0
- package/build/koffi/win32_ia32/koffi.node +0 -0
- package/build/koffi/win32_x64/koffi.node +0 -0
- package/index.js +2 -2
- package/indirect.js +2 -2
- package/package.json +2 -2
- package/src/core/libcc/libcc.cc +68 -0
- package/src/core/libcc/libcc.hh +8 -0
- package/src/core/libcc/mimetypes.inc +1228 -0
- package/src/core/libcc/mimetypes_gen.py +77 -0
- package/src/koffi/src/util.cc +2 -0
- package/build/koffi/win32_x64/koffi.pdb +0 -0
package/CHANGELOG.md
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/index.js
CHANGED
|
@@ -378,8 +378,8 @@ var require_package = __commonJS({
|
|
|
378
378
|
"build/dist/src/koffi/package.json"(exports2, module2) {
|
|
379
379
|
module2.exports = {
|
|
380
380
|
name: "koffi",
|
|
381
|
-
version: "2.6.
|
|
382
|
-
stable: "2.6.
|
|
381
|
+
version: "2.6.12",
|
|
382
|
+
stable: "2.6.12",
|
|
383
383
|
description: "Fast and simple C FFI (foreign function interface) for Node.js",
|
|
384
384
|
keywords: [
|
|
385
385
|
"foreign",
|
package/indirect.js
CHANGED
|
@@ -378,8 +378,8 @@ var require_package = __commonJS({
|
|
|
378
378
|
"build/dist/src/koffi/package.json"(exports2, module2) {
|
|
379
379
|
module2.exports = {
|
|
380
380
|
name: "koffi",
|
|
381
|
-
version: "2.6.
|
|
382
|
-
stable: "2.6.
|
|
381
|
+
version: "2.6.12",
|
|
382
|
+
stable: "2.6.12",
|
|
383
383
|
description: "Fast and simple C FFI (foreign function interface) for Node.js",
|
|
384
384
|
keywords: [
|
|
385
385
|
"foreign",
|
package/package.json
CHANGED
package/src/core/libcc/libcc.cc
CHANGED
|
@@ -8372,4 +8372,72 @@ bool PromptYN(const char *prompt, bool *out_value)
|
|
|
8372
8372
|
return prompter.ReadYN(out_value);
|
|
8373
8373
|
}
|
|
8374
8374
|
|
|
8375
|
+
// ------------------------------------------------------------------------
|
|
8376
|
+
// Mime types
|
|
8377
|
+
// ------------------------------------------------------------------------
|
|
8378
|
+
|
|
8379
|
+
const char *GetMimeType(Span<const char> extension, const char *default_type)
|
|
8380
|
+
{
|
|
8381
|
+
static const HashMap<Span<const char>, const char *> mime_types = {
|
|
8382
|
+
#define MIMETYPE(Extension, MimeType) { (Extension), (MimeType) },
|
|
8383
|
+
#include "mimetypes.inc"
|
|
8384
|
+
|
|
8385
|
+
{"", "application/octet-stream"}
|
|
8386
|
+
};
|
|
8387
|
+
|
|
8388
|
+
const char *mime_type = mime_types.FindValue(extension, nullptr);
|
|
8389
|
+
|
|
8390
|
+
if (!mime_type) {
|
|
8391
|
+
LogError("Unknown MIME type for extension '%1'", extension);
|
|
8392
|
+
mime_type = default_type;
|
|
8393
|
+
}
|
|
8394
|
+
|
|
8395
|
+
return mime_type;
|
|
8396
|
+
}
|
|
8397
|
+
|
|
8398
|
+
bool CanCompressFile(const char *filename)
|
|
8399
|
+
{
|
|
8400
|
+
char extension[8];
|
|
8401
|
+
{
|
|
8402
|
+
const char *ptr = GetPathExtension(filename).ptr;
|
|
8403
|
+
|
|
8404
|
+
Size i = 0;
|
|
8405
|
+
while (i < RG_SIZE(extension) - 1 && ptr[i]) {
|
|
8406
|
+
extension[i] = LowerAscii(ptr[i]);
|
|
8407
|
+
i++;
|
|
8408
|
+
}
|
|
8409
|
+
extension[i] = 0;
|
|
8410
|
+
}
|
|
8411
|
+
|
|
8412
|
+
if (TestStrI(extension, ".zip"))
|
|
8413
|
+
return false;
|
|
8414
|
+
if (TestStrI(extension, ".rar"))
|
|
8415
|
+
return false;
|
|
8416
|
+
if (TestStrI(extension, ".7z"))
|
|
8417
|
+
return false;
|
|
8418
|
+
if (TestStrI(extension, ".gz") || TestStrI(extension, ".tgz"))
|
|
8419
|
+
return false;
|
|
8420
|
+
if (TestStrI(extension, ".bz2") || TestStrI(extension, ".tbz2"))
|
|
8421
|
+
return false;
|
|
8422
|
+
if (TestStrI(extension, ".xz") || TestStrI(extension, ".txz"))
|
|
8423
|
+
return false;
|
|
8424
|
+
if (TestStrI(extension, ".zst") || TestStrI(extension, ".tzst"))
|
|
8425
|
+
return false;
|
|
8426
|
+
if (TestStrI(extension, ".woff") || TestStrI(extension, ".woff2"))
|
|
8427
|
+
return false;
|
|
8428
|
+
if (TestStrI(extension, ".db") || TestStrI(extension, ".sqlite3"))
|
|
8429
|
+
return false;
|
|
8430
|
+
|
|
8431
|
+
const char *mime_type = GetMimeType(extension);
|
|
8432
|
+
|
|
8433
|
+
if (StartsWith(mime_type, "video/"))
|
|
8434
|
+
return false;
|
|
8435
|
+
if (StartsWith(mime_type, "audio/"))
|
|
8436
|
+
return false;
|
|
8437
|
+
if (StartsWith(mime_type, "image/") && !TestStr(mime_type, "image/svg+xml"))
|
|
8438
|
+
return false;
|
|
8439
|
+
|
|
8440
|
+
return true;
|
|
8441
|
+
}
|
|
8442
|
+
|
|
8375
8443
|
}
|
package/src/core/libcc/libcc.hh
CHANGED
|
@@ -5016,4 +5016,12 @@ static inline const char *Prompt(const char *prompt, Allocator *alloc)
|
|
|
5016
5016
|
{ return Prompt(prompt, nullptr, nullptr, alloc); }
|
|
5017
5017
|
bool PromptYN(const char *prompt, bool *out_value);
|
|
5018
5018
|
|
|
5019
|
+
// ------------------------------------------------------------------------
|
|
5020
|
+
// Mime types
|
|
5021
|
+
// ------------------------------------------------------------------------
|
|
5022
|
+
|
|
5023
|
+
const char *GetMimeType(Span<const char> extension, const char *default_typ = "application/octet-stream");
|
|
5024
|
+
|
|
5025
|
+
bool CanCompressFile(const char *filename);
|
|
5026
|
+
|
|
5019
5027
|
}
|