Skip to content

Commit c210ed1

Browse files
committed
chore: move IfdTuple, IfdPtr types to /interfaces/libexif.ts and export those interfaces in index
1 parent f893e20 commit c210ed1

7 files changed

Lines changed: 36 additions & 25 deletions

File tree

.changeset/violet-dodos-juggle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"libexif-wasm": patch
3+
---
4+
5+
move IfdTuple, IfdPtr types to /interfaces/libexif.ts and export those interfaces in index

src/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ export {
44
ExifData,
55
exifDataOptionGetDescription,
66
exifDataOptionGetName,
7-
type IfdTuple,
87
} from "./libexif/ExifData.ts";
98
export { ExifEntry } from "./libexif/ExifEntry.ts";
109
export { exifFormatGetName, exifFormatGetSize } from "./libexif/exifFormat.ts";
@@ -104,6 +103,13 @@ export {
104103
type Tag,
105104
} from "./enums/ExifTagUnified.ts";
106105

106+
// Interfaces
107+
export type {
108+
ValidTypedArray,
109+
IfdPtr,
110+
IfdTuple,
111+
} from "./interfaces/libexif.ts";
112+
107113
// Utility functions
108114
export { getDataAsTypedArray } from "./libexif/utils/getDataAsTypedArray.ts";
109115
export { setDataFromTypedArray } from "./libexif/utils/setDataFromTypedArray.ts";

src/interfaces/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export * from "./dataSegment.ts";
22
export * from "./emscripten.ts";
3+
export * from "./libexif.ts";
34
export * from "./utils.ts";

src/interfaces/libexif.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import type { ExifContent } from "../libexif/ExifContent.ts";
2+
13
type ValidTypedArray =
24
| Uint8Array
35
| Int8Array
@@ -6,4 +8,20 @@ type ValidTypedArray =
68
| Uint32Array
79
| Int32Array;
810

9-
export type { ValidTypedArray };
11+
type IfdPtr = [
12+
IFD_0: number,
13+
IFD_1: number,
14+
EXIF: number,
15+
GPS: number,
16+
INTEROPERABILITY: number,
17+
];
18+
19+
type IfdTuple = [
20+
IFD_0: ExifContent,
21+
IFD_1: ExifContent,
22+
EXIF: ExifContent,
23+
GPS: ExifContent,
24+
INTEROPERABILITY: ExifContent,
25+
];
26+
27+
export type { ValidTypedArray, IfdPtr, IfdTuple };

src/libexif/ExifData.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { ExifDataType, type DataType } from "../enums/ExifDataType.ts";
1010
import { ExifIfd } from "../enums/ExifIfd.ts";
1111
import { ExifTagUnified, type Tag } from "../enums/ExifTagUnified.ts";
1212
import type { DisposableDataSegment } from "../interfaces/dataSegment.ts";
13+
import type { IfdTuple } from "../interfaces/libexif.ts";
1314
import { getValue, HEAPU8, UTF8ToString } from "../internal/emscripten.ts";
1415
import {
1516
exif_data_new,
@@ -40,14 +41,6 @@ import type { IfdPtr } from "../structs/ExifDataStruct.ts";
4041
import { assertEnumObjectKey } from "../utils/assertEnumObjectKey.ts";
4142
import { getEnumKeyFromValue } from "../utils/getEnumKeyFromValue.ts";
4243

43-
type IfdTuple = [
44-
IFD_0: ExifContent,
45-
IFD_1: ExifContent,
46-
EXIF: ExifContent,
47-
GPS: ExifContent,
48-
INTEROPERABILITY: ExifContent,
49-
];
50-
5144
class ExifData extends ExifDataStruct implements DisposableDataSegment {
5245
constructor(public readonly byteOffset: number) {
5346
super();
@@ -281,9 +274,4 @@ const exifDataOptionGetName = (o: DataOption) => {
281274
return UTF8ToString(exif_data_option_get_name(ExifDataOption[o]));
282275
};
283276

284-
export {
285-
ExifData,
286-
exifDataOptionGetDescription,
287-
exifDataOptionGetName,
288-
type IfdTuple,
289-
};
277+
export { ExifData, exifDataOptionGetDescription, exifDataOptionGetName };

src/structs/ExifDataStruct.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ExifIfd } from "../enums/ExifIfd.ts";
2+
import type { IfdPtr } from "../interfaces/libexif.ts";
23
import {
34
exif_data_get_ifd,
45
exif_data_set_ifd,
@@ -8,14 +9,6 @@ import {
89
exif_data_set_size,
910
} from "../internal/main.ts";
1011

11-
type IfdPtr = [
12-
IFD_0: number,
13-
IFD_1: number,
14-
EXIF: number,
15-
GPS: number,
16-
INTEROPERABILITY: number,
17-
];
18-
1912
abstract class ExifDataStruct {
2013
abstract byteOffset: number;
2114

src/structs/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export { ExifContentStruct } from "./ExifContentStruct.ts";
2-
export { ExifDataStruct, type IfdPtr } from "./ExifDataStruct.ts";
2+
export { ExifDataStruct } from "./ExifDataStruct.ts";
33
export { ExifEntryStruct } from "./ExifEntryStruct.ts";
44
export { ExifRationalStruct } from "./ExifRationalStruct.ts";
55
export { ExifSRationalStruct } from "./ExifSRationalStruct.ts";

0 commit comments

Comments
 (0)