Skip to content

Commit 5d17b32

Browse files
Merge pull request #78 from superbrobenji/feature/cjs-fix
Feature/cjs fix
2 parents f1d6941 + fee85d0 commit 5d17b32

File tree

10 files changed

+21
-14
lines changed

10 files changed

+21
-14
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
coverage
33
dist
4+
**.tgz

build.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ const option = {
1010
(async () => {
1111
await Bun.build({
1212
format: "esm",
13+
naming: "index.mjs",
1314
...option,
1415
}).catch(() => process.exit(1));
1516

1617
await Bun.build({
1718
format: "cjs",
18-
naming: "cjs.js",
19+
naming: "index.cjs",
1920
...option,
2021
}).catch(() => process.exit(1));
2122
})();

docs/jsdoc/AsyncQueue.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ <h5 class="h5-parameters">Parameters:</h5>
871871
<br class="clear">
872872

873873
<footer>
874-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a> on Wed Nov 27 2024 14:48:04 GMT+0200 (South Africa Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
874+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a> on Thu Nov 28 2024 09:23:08 GMT+0200 (South Africa Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
875875
</footer>
876876

877877
<script>prettyPrint();</script>

docs/jsdoc/AsyncQueue.module.exports.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ <h6>Properties</h6>
386386
<br class="clear">
387387

388388
<footer>
389-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a> on Wed Nov 27 2024 14:48:04 GMT+0200 (South Africa Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
389+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a> on Thu Nov 28 2024 09:23:08 GMT+0200 (South Africa Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
390390
</footer>
391391

392392
<script>prettyPrint();</script>

docs/jsdoc/global.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ <h4 class="name" id="abortHandler"><span class="type-signature type-signature-co
202202

203203
<dt class="tag-source">Source:</dt>
204204
<dd class="tag-source"><ul class="dummy"><li>
205-
<a href="index.js.html">index.js</a>, <a href="index.js.html#line315">line 315</a>
205+
<a href="index.js.html">index.js</a>, <a href="index.js.html#line316">line 316</a>
206206
</li></ul></dd>
207207

208208

@@ -827,7 +827,7 @@ <h5 class="h5-returns">Returns:</h5>
827827
<br class="clear">
828828

829829
<footer>
830-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a> on Wed Nov 27 2024 14:48:04 GMT+0200 (South Africa Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
830+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a> on Thu Nov 28 2024 09:23:08 GMT+0200 (South Africa Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
831831
</footer>
832832

833833
<script>prettyPrint();</script>

docs/jsdoc/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ <h2>📝 License</h2>
132132
<br class="clear">
133133

134134
<footer>
135-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a> on Wed Nov 27 2024 14:48:04 GMT+0200 (South Africa Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
135+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a> on Thu Nov 28 2024 09:23:08 GMT+0200 (South Africa Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
136136
</footer>
137137

138138
<script>prettyPrint();</script>

docs/jsdoc/index.js.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ <h1 class="page-title">index.js</h1>
341341

342342
/**
343343
* abort handler for handling aborts in your promise
344+
* @param {AbortSignal} signal - the reject function of the promise
344345
* @param {RejectFunction} reject - the reject function of the promise
345346
* @example
346347
*
@@ -385,7 +386,7 @@ <h1 class="page-title">index.js</h1>
385386
<br class="clear">
386387

387388
<footer>
388-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a> on Wed Nov 27 2024 14:48:04 GMT+0200 (South Africa Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
389+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a> on Thu Nov 28 2024 09:23:08 GMT+0200 (South Africa Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
389390
</footer>
390391

391392
<script>prettyPrint();</script>

docs/package.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ abort handler for handling aborts in your promise
210210
211211
| Param | Type | Description |
212212
| --- | --- | --- |
213+
| signal | <code>AbortSignal</code> | the reject function of the promise |
213214
| reject | <code>RejectFunction</code> | the reject function of the promise |
214215
215216
**Example**

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
},
99
"home": "https://github.com/superbrobenji/async-queue",
1010
"bugs": "https://github.com/superbrobenji/async-queue",
11-
"main": "./dist/index.js",
12-
"type": "module",
11+
"main": "./dist/index.cjs",
12+
"module": "./dist/index.mjs",
1313
"engines": {
1414
"node": ">=18.0.0"
1515
},
@@ -40,11 +40,11 @@
4040
"limit"
4141
],
4242
"exports": {
43-
"import": {
44-
"default": "./dist/index.js",
43+
".": {
44+
"import": "./dist/index.mjs",
45+
"require": "./dist/index.cjs",
4546
"types": "./dist/index.d.ts"
46-
},
47-
"require": "./dist/cjs.js"
47+
}
4848
},
4949
"types": "./dist/index.d.ts",
5050
"author": "superbrobenji",

src/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const QUEUE_ERRORS = {
1313
MAX_RETRIES: "max retries reached",
1414
};
1515

16-
export default class AsyncQueue {
16+
export class Queue {
1717
#queue = new Set();
1818
#running = 0;
1919
#maxConcurrency = 0;
@@ -292,6 +292,7 @@ export default class AsyncQueue {
292292

293293
/**
294294
* abort handler for handling aborts in your promise
295+
* @param {AbortSignal} signal - the reject function of the promise
295296
* @param {RejectFunction} reject - the reject function of the promise
296297
* @example
297298
*
@@ -322,3 +323,5 @@ export const abortHandler = (signal, reject) => {
322323
};
323324
signal.addEventListener("abort", abortHandler);
324325
};
326+
327+
export default Queue;

0 commit comments

Comments
 (0)