exifreader 4.46.0 → 4.48.0
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/README.md +100 -34
- package/bin/TagFilterPlugin.js +23 -14
- package/bin/analyze.js +345 -0
- package/bin/build.js +13 -2
- package/bin/cli.js +449 -23
- package/bin/custom-build-marker.js +78 -0
- package/bin/unshare-file.js +29 -0
- package/bin/verify-build.js +147 -0
- package/dist/exif-reader.js +1 -1
- package/dist/exif-reader.js.map +1 -1
- package/package.json +3 -3
- package/src/canon-tags.js +4 -2
- package/src/composite.js +94 -47
- package/src/exif-reader.js +81 -16
- package/src/file-loaders.js +204 -30
- package/src/image-header-iso-bmff-iloc.js +5 -2
- package/src/image-header-iso-bmff.js +41 -10
- package/src/image-header-jpeg.js +9 -2
- package/src/image-header-png.js +33 -21
- package/src/iptc-tags.js +46 -11
- package/src/load-auto.js +6 -3
- package/src/loadview-pipeline.js +111 -61
- package/src/mpf-tags.js +10 -3
- package/src/pentax-tags.js +49 -23
- package/src/photoshop-tag-names.js +6 -2
- package/src/photoshop-tags.js +15 -22
- package/src/png-text-tags.js +237 -77
- package/src/tag-decoder.js +10 -10
- package/src/tag-filter-config.js +2 -0
- package/src/tag-filter.js +2 -0
- package/src/tag-names-0th-ifd.js +13 -1
- package/src/tags-helpers.js +220 -44
- package/src/tags.js +22 -4
- package/src/types.js +0 -5
- package/src/utils.js +260 -32
- package/src/xml.js +19 -2
- package/src/xmp-element-depth.js +226 -0
- package/src/xmp-namespaces.js +22 -7
- package/src/xmp-tags.js +285 -165
package/src/xmp-namespaces.js
CHANGED
|
@@ -2,24 +2,39 @@
|
|
|
2
2
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
3
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
4
|
|
|
5
|
+
const CHROME_MESSAGE_START = 'Namespace prefix ';
|
|
6
|
+
const CHROME_MESSAGE_END = ' is not defined';
|
|
7
|
+
|
|
5
8
|
export function isMissingNamespaceError(error) {
|
|
9
|
+
const message = String(error.message);
|
|
6
10
|
const missingNamespaceStrings = [
|
|
7
11
|
// @xmldom/xmldom
|
|
8
12
|
'prefix is non-null and namespace is null',
|
|
9
13
|
// Firefox
|
|
10
14
|
'prefix not bound to a namespace', // en
|
|
11
|
-
'prefix inte bundet till en namnrymd'
|
|
12
|
-
// Chrome
|
|
13
|
-
/Namespace prefix .+ is not defined/
|
|
15
|
+
'prefix inte bundet till en namnrymd' // sv
|
|
14
16
|
];
|
|
15
17
|
|
|
16
18
|
for (let i = 0; i < missingNamespaceStrings.length; i++) {
|
|
17
|
-
|
|
18
|
-
if (regexp.test(error.message)) {
|
|
19
|
+
if (message.indexOf(missingNamespaceStrings[i]) !== -1) {
|
|
19
20
|
return true;
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
|
|
24
|
+
return isChromeMissingNamespaceMessage(message);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Same result as the former Chrome check /Namespace prefix .+ is not defined/,
|
|
28
|
+
// in linear time.
|
|
29
|
+
function isChromeMissingNamespaceMessage(message) {
|
|
30
|
+
const lines = message.split(/[\n\r\u2028\u2029]/);
|
|
31
|
+
for (let i = 0; i < lines.length; i++) {
|
|
32
|
+
const prefixIndex = lines[i].indexOf(CHROME_MESSAGE_START);
|
|
33
|
+
if (prefixIndex !== -1
|
|
34
|
+
&& lines[i].lastIndexOf(CHROME_MESSAGE_END) > prefixIndex + CHROME_MESSAGE_START.length) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
23
38
|
return false;
|
|
24
39
|
}
|
|
25
40
|
|
|
@@ -93,11 +108,11 @@ function scanStartTag(xmlString, fromIndex) {
|
|
|
93
108
|
return {insertionIndex: -1, attributeValueSpans};
|
|
94
109
|
}
|
|
95
110
|
|
|
96
|
-
function hasSubstringAt(xmlString, substring, index) {
|
|
111
|
+
export function hasSubstringAt(xmlString, substring, index) {
|
|
97
112
|
return xmlString.slice(index, index + substring.length) === substring;
|
|
98
113
|
}
|
|
99
114
|
|
|
100
|
-
function skipPast(xmlString, fromIndex, endMarker) {
|
|
115
|
+
export function skipPast(xmlString, fromIndex, endMarker) {
|
|
101
116
|
const endIndex = xmlString.indexOf(endMarker, fromIndex);
|
|
102
117
|
if (endIndex === -1) {
|
|
103
118
|
return xmlString.length;
|