exifreader 4.22.1 → 4.23.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "exifreader",
3
- "version": "4.22.1",
3
+ "version": "4.23.1",
4
4
  "description": "Library that parses Exif metadata in images.",
5
5
  "author": "Mattias Wallander <mattias@wallander.eu>",
6
6
  "repository": {
@@ -29,13 +29,13 @@
29
29
  "@babel/preset-env": "^7.23.2",
30
30
  "@babel/register": "^7.22.15",
31
31
  "@types/node": "^18.11.9",
32
- "babel-loader": "^8.2.5",
32
+ "babel-loader": "^9.1.3",
33
33
  "babel-plugin-rewire": "^1.2.0",
34
34
  "chai": "^4.3.10",
35
35
  "cross-env": "^7.0.3",
36
36
  "cypress": "^13.3.2",
37
37
  "eslint": "^8.52.0",
38
- "eslint-plugin-cypress": "^2.15.1",
38
+ "eslint-plugin-cypress": "^3.0.2",
39
39
  "husky": "^9.0.11",
40
40
  "mocha": "^10.2.0",
41
41
  "npm-run-all": "^4.1.5",
@@ -46,7 +46,7 @@
46
46
  "typescript": "^5.2.2",
47
47
  "webpack": "^5.89.0",
48
48
  "webpack-cli": "^5.1.4",
49
- "webpack-dev-server": "^4.15.1"
49
+ "webpack-dev-server": "^5.0.4"
50
50
  },
51
51
  "scripts": {
52
52
  "build": "node bin/build.js",
@@ -10,6 +10,7 @@ import Heic from './image-header-heic.js';
10
10
  import Avif from './image-header-avif.js';
11
11
  import Webp from './image-header-webp.js';
12
12
  import Gif from './image-header-gif.js';
13
+ import Xml from './xml.js';
13
14
  import {objectAssign} from './utils.js';
14
15
 
15
16
  export default {
@@ -45,6 +46,10 @@ function parseAppMarkers(dataView, async) {
45
46
  return addFileType(Gif.findOffsets(dataView), 'gif', 'GIF');
46
47
  }
47
48
 
49
+ if (Constants.USE_XMP && Xml.isXMLFile(dataView)) {
50
+ return addFileType(Xml.findOffsets(dataView), 'xml', 'XML');
51
+ }
52
+
48
53
  throw new Error('Invalid image format');
49
54
  }
50
55
 
package/src/xml.js ADDED
@@ -0,0 +1,25 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+
5
+ import {getStringFromDataView} from './utils.js';
6
+
7
+ export default {
8
+ isXMLFile,
9
+ findOffsets
10
+ };
11
+
12
+ const XML_MARKER_OFFSET = 0;
13
+ const XML_MARKER = '<?xpacket begin';
14
+
15
+ function isXMLFile(dataView) {
16
+ return !!dataView && getStringFromDataView(dataView, XML_MARKER_OFFSET, XML_MARKER.length) === XML_MARKER;
17
+ }
18
+
19
+ function findOffsets(dataView) {
20
+ const xmpChunks = [];
21
+ xmpChunks.push({dataOffset: XML_MARKER_OFFSET, length: dataView.byteLength});
22
+ return {
23
+ xmpChunks,
24
+ };
25
+ }