Skip to content

Commit c41d3b9

Browse files
1 parent 4a3bef0 commit c41d3b9

File tree

7 files changed

+123
-109
lines changed

7 files changed

+123
-109
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Jira.js changelog
22

3+
### 4.0.5
4+
5+
- **#344:** Replaced the `mime-types` library with `mime` to ensure browser compatibility, as `mime-types` relies on the `path` module from Node.js. Thanks to [kang](https://github.com/kang8) for [reporting the issue](https://github.com/MrRefactoring/jira.js/issues/344) and proposing the fix.
6+
37
### 4.0.4
48

59
- **#320:** Resolved a tree-shaking issue where importing a single client would still include all clients in the output bundle when using bundlers. Now, only the required client code is included. Thanks to [Nao Yonashiro](https://github.com/orisano) for [reporting the issue](https://github.com/MrRefactoring/jira.js/issues/320) and proposing a fix.

package-lock.json

+105-98
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jira.js",
3-
"version": "4.0.4",
3+
"version": "4.0.5",
44
"description": "A comprehensive JavaScript/TypeScript library designed for both Node.JS and browsers, facilitating seamless interaction with the Atlassian Jira API.",
55
"main": "out/index.js",
66
"types": "out/index.d.ts",
@@ -53,8 +53,7 @@
5353
"code:formatting": "npm run replace:all && npm run prettier && npm run lint:fix"
5454
},
5555
"devDependencies": {
56-
"@types/mime-types": "^2.1.4",
57-
"@types/node": "^18.19.69",
56+
"@types/node": "^18.19.70",
5857
"@types/sinon": "^17.0.3",
5958
"@typescript-eslint/eslint-plugin": "^8.19.0",
6059
"@typescript-eslint/parser": "^8.19.0",
@@ -74,7 +73,7 @@
7473
"dependencies": {
7574
"axios": "^1.7.9",
7675
"formdata-node": "^6.0.3",
77-
"mime-types": "^2.1.35",
76+
"mime": "^4.0.6",
7877
"tslib": "^2.8.1"
7978
}
8079
}

src/serviceDesk/serviceDesk.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { FormData, File } from 'formdata-node';
2-
import * as mime from 'mime-types';
32
import * as Models from './models';
43
import * as Parameters from './parameters';
54
import { Callback } from '../callback';
@@ -117,8 +116,10 @@ export class ServiceDesk {
117116
const formData = new FormData();
118117
const attachments = Array.isArray(parameters.attachment) ? parameters.attachment : [parameters.attachment];
119118

119+
const { default: mime } = await import('mime');
120+
120121
attachments.forEach(attachment => {
121-
const mimeType = attachment.mimeType ?? (mime.lookup(attachment.filename) || undefined);
122+
const mimeType = attachment.mimeType ?? (mime.getType(attachment.filename) || undefined);
122123
const file = Buffer.isBuffer(attachment.file)
123124
? new File([attachment.file], attachment.filename, { type: mimeType })
124125
: attachment.file;

src/version2/issueAttachments.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { FormData, File } from 'formdata-node';
2-
import * as mime from 'mime-types';
32
import * as Models from './models';
43
import * as Parameters from './parameters';
54
import { Callback } from '../callback';
@@ -426,8 +425,10 @@ export class IssueAttachments {
426425
const formData = new FormData();
427426
const attachments = Array.isArray(parameters.attachment) ? parameters.attachment : [parameters.attachment];
428427

428+
const { default: mime } = await import('mime');
429+
429430
attachments.forEach(attachment => {
430-
const mimeType = attachment.mimeType ?? (mime.lookup(attachment.filename) || undefined);
431+
const mimeType = attachment.mimeType ?? (mime.getType(attachment.filename) || undefined);
431432
const file = Buffer.isBuffer(attachment.file)
432433
? new File([attachment.file], attachment.filename, { type: mimeType })
433434
: attachment.file;

src/version3/issueAttachments.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { FormData, File } from 'formdata-node';
2-
import * as mime from 'mime-types';
32
import * as Models from './models';
43
import * as Parameters from './parameters';
54
import { Callback } from '../callback';
@@ -426,8 +425,10 @@ export class IssueAttachments {
426425
const formData = new FormData();
427426
const attachments = Array.isArray(parameters.attachment) ? parameters.attachment : [parameters.attachment];
428427

428+
const { default: mime } = await import('mime');
429+
429430
attachments.forEach(attachment => {
430-
const mimeType = attachment.mimeType ?? (mime.lookup(attachment.filename) || undefined);
431+
const mimeType = attachment.mimeType ?? (mime.getType(attachment.filename) || undefined);
431432
const file = Buffer.isBuffer(attachment.file)
432433
? new File([attachment.file], attachment.filename, { type: mimeType })
433434
: attachment.file;

tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"compilerOptions": {
33
"target": "ES6",
44
"outDir": "out",
5-
"module": "CommonJS",
5+
"module": "NodeNext",
6+
"skipLibCheck": true,
67
"lib": [
78
"ES2018",
89
"DOM"

0 commit comments

Comments
 (0)