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
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
# Copyright 2023 Niels Martignène <niels.martignene@protonmail.com>
|
|
4
|
+
#
|
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
# this software and associated documentation files (the “Software”), to deal in
|
|
7
|
+
# the Software without restriction, including without limitation the rights to use,
|
|
8
|
+
# copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
9
|
+
# Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
# subject to the following conditions:
|
|
11
|
+
#
|
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
# copies or substantial portions of the Software.
|
|
14
|
+
#
|
|
15
|
+
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
17
|
+
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
19
|
+
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
20
|
+
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
21
|
+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
22
|
+
# OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
|
|
24
|
+
# This script uses the database of mimetypes distributed here: https://github.com/jshttp/mime-db
|
|
25
|
+
# to produce the X-header file mimetypes.inc
|
|
26
|
+
|
|
27
|
+
import os
|
|
28
|
+
import argparse
|
|
29
|
+
import json
|
|
30
|
+
|
|
31
|
+
if __name__ == "__main__":
|
|
32
|
+
parser = argparse.ArgumentParser(description = 'Update mimetypes include file')
|
|
33
|
+
parser.add_argument('-O', '--output_file', dest = 'output_file', action = 'store', help = 'Output file')
|
|
34
|
+
parser.add_argument('json', help = 'Source JSON database')
|
|
35
|
+
args = parser.parse_args()
|
|
36
|
+
|
|
37
|
+
if args.output_file is None:
|
|
38
|
+
output_file = os.path.join(os.path.dirname(__file__), 'mimetypes.inc')
|
|
39
|
+
else:
|
|
40
|
+
output_file = args.output_file
|
|
41
|
+
|
|
42
|
+
with open(args.json) as f:
|
|
43
|
+
db = json.load(f)
|
|
44
|
+
|
|
45
|
+
extensions = {}
|
|
46
|
+
for (k, v) in db.items():
|
|
47
|
+
if 'extensions' not in v:
|
|
48
|
+
continue
|
|
49
|
+
|
|
50
|
+
for ext in v['extensions']:
|
|
51
|
+
if not ext in extensions:
|
|
52
|
+
extensions[ext] = 'application/x-'
|
|
53
|
+
if extensions[ext].startswith('application/x-'):
|
|
54
|
+
extensions[ext] = k
|
|
55
|
+
|
|
56
|
+
extensions = [(k, extensions[k]) for k in sorted(extensions.keys())]
|
|
57
|
+
extensions.sort()
|
|
58
|
+
|
|
59
|
+
with open(output_file) as f:
|
|
60
|
+
lines = f.readlines()
|
|
61
|
+
with open(output_file, 'w') as f:
|
|
62
|
+
for line in lines:
|
|
63
|
+
if not line.startswith('//'):
|
|
64
|
+
break
|
|
65
|
+
f.write(line)
|
|
66
|
+
|
|
67
|
+
print('', file = f)
|
|
68
|
+
print('#ifndef MIMETYPE', file = f)
|
|
69
|
+
print(' #error Please define MIMETYPE() before including mimetypes.inc', file = f)
|
|
70
|
+
print('#endif', file = f)
|
|
71
|
+
print('', file = f)
|
|
72
|
+
|
|
73
|
+
for k, v in extensions:
|
|
74
|
+
print(f'MIMETYPE(".{k}", "{v}")', file = f)
|
|
75
|
+
|
|
76
|
+
print('', file = f)
|
|
77
|
+
print('#undef MIMETYPE', file = f)
|
package/src/koffi/src/util.cc
CHANGED
|
@@ -139,6 +139,8 @@ const TypeInfo *ResolveType(Napi::Value value, int *out_directions)
|
|
|
139
139
|
bucket->key = DuplicateString(str.c_str(), &instance->str_alloc).ptr;
|
|
140
140
|
bucket->value = type;
|
|
141
141
|
}
|
|
142
|
+
} else if (out_directions) {
|
|
143
|
+
*out_directions = 1;
|
|
142
144
|
}
|
|
143
145
|
|
|
144
146
|
return type;
|
|
Binary file
|