@prairielearn/utils 2.0.4 → 3.0.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/CHANGELOG.md +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.test.d.ts.map +1 -1
- package/dist/index.test.js.map +1 -1
- package/package.json +10 -6
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACrC,4BAA4B;IAC5B,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACpB,4BAA4B;IAC5B,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IAC7C,2BAA2B;IAC3B,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;CAChC;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,KAAK,oBAAoB,CAAC,CAAC,CAAC,CAQ1D"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACrC,4BAA4B;IAC5B,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACpB,4BAA4B;IAC5B,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IAC7C,2BAA2B;IAC3B,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;CAChC;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,KAAK,oBAAoB,CAAC,CAAC,CAAC,CAQ1D","sourcesContent":["/**\n * An object containing a promise and its resolve/reject methods.\n */\nexport interface PromiseWithResolvers<T> {\n /** The promise instance. */\n promise: Promise<T>;\n /** Resolves the promise. */\n resolve: (value: T | PromiseLike<T>) => void;\n /** Rejects the promise. */\n reject: (reason?: any) => void;\n}\n\n/**\n * Returns an object with a promise and its resolve/reject methods exposed.\n * This is similar to Node.js's util.withResolvers (Node 21+).\n *\n * @returns An object containing the promise, resolve, and reject.\n */\nexport function withResolvers<T>(): PromiseWithResolvers<T> {\n let resolve: (value: T | PromiseLike<T>) => void;\n let reject: (reason?: any) => void;\n const promise = new Promise<T>((res, rej) => {\n resolve = res;\n reject = rej;\n });\n return { promise, resolve: resolve!, reject: reject! };\n}\n"]}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAYA;;;;;GAKG;AACH,MAAM,UAAU,aAAa;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAYA;;;;;GAKG;AACH,MAAM,UAAU,aAAa,GAA+B;IAC1D,IAAI,OAA4C,CAAC;IACjD,IAAI,MAA8B,CAAC;IACnC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAI,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC;QAC3C,OAAO,GAAG,GAAG,CAAC;QACd,MAAM,GAAG,GAAG,CAAC;IAAA,CACd,CAAC,CAAC;IACH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAQ,EAAE,MAAM,EAAE,MAAO,EAAE,CAAC;AAAA,CACxD","sourcesContent":["/**\n * An object containing a promise and its resolve/reject methods.\n */\nexport interface PromiseWithResolvers<T> {\n /** The promise instance. */\n promise: Promise<T>;\n /** Resolves the promise. */\n resolve: (value: T | PromiseLike<T>) => void;\n /** Rejects the promise. */\n reject: (reason?: any) => void;\n}\n\n/**\n * Returns an object with a promise and its resolve/reject methods exposed.\n * This is similar to Node.js's util.withResolvers (Node 21+).\n *\n * @returns An object containing the promise, resolve, and reject.\n */\nexport function withResolvers<T>(): PromiseWithResolvers<T> {\n let resolve: (value: T | PromiseLike<T>) => void;\n let reject: (reason?: any) => void;\n const promise = new Promise<T>((res, rej) => {\n resolve = res;\n reject = rej;\n });\n return { promise, resolve: resolve!, reject: reject! };\n}\n"]}
|
package/dist/index.test.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":"","sourcesContent":["import { describe, expect, it } from 'vitest';\n\nimport { withResolvers } from './index.js';\n\ndescribe('withResolvers', () => {\n it('resolves with the correct value', async () => {\n const { promise, resolve } = withResolvers<number>();\n setTimeout(() => resolve(123), 10);\n await expect(promise).resolves.toBe(123);\n });\n\n it('rejects with the correct reason', async () => {\n const { promise, reject } = withResolvers<number>();\n setTimeout(() => reject(new Error('fail')), 10);\n await expect(promise).rejects.toThrow('fail');\n });\n});\n"]}
|
package/dist/index.test.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;
|
|
1
|
+
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE,CAAC;IAC9B,EAAE,CAAC,iCAAiC,EAAE,KAAK,IAAI,EAAE,CAAC;QAChD,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,aAAa,EAAU,CAAC;QACrD,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;QACnC,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAAA,CAC1C,CAAC,CAAC;IAEH,EAAE,CAAC,iCAAiC,EAAE,KAAK,IAAI,EAAE,CAAC;QAChD,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,aAAa,EAAU,CAAC;QACpD,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAChD,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAAA,CAC/C,CAAC,CAAC;AAAA,CACJ,CAAC,CAAC","sourcesContent":["import { describe, expect, it } from 'vitest';\n\nimport { withResolvers } from './index.js';\n\ndescribe('withResolvers', () => {\n it('resolves with the correct value', async () => {\n const { promise, resolve } = withResolvers<number>();\n setTimeout(() => resolve(123), 10);\n await expect(promise).resolves.toBe(123);\n });\n\n it('rejects with the correct reason', async () => {\n const { promise, reject } = withResolvers<number>();\n setTimeout(() => reject(new Error('fail')), 10);\n await expect(promise).rejects.toThrow('fail');\n });\n});\n"]}
|
package/package.json
CHANGED
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prairielearn/utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/PrairieLearn/PrairieLearn.git",
|
|
8
8
|
"directory": "packages/utils"
|
|
9
9
|
},
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=24.0.0"
|
|
12
|
+
},
|
|
10
13
|
"main": "./dist/index.js",
|
|
11
14
|
"scripts": {
|
|
12
|
-
"build": "
|
|
13
|
-
"dev": "
|
|
15
|
+
"build": "tsgo",
|
|
16
|
+
"dev": "tsgo --watch --preserveWatchOutput",
|
|
14
17
|
"test": "vitest run --coverage"
|
|
15
18
|
},
|
|
16
19
|
"devDependencies": {
|
|
17
20
|
"@prairielearn/tsconfig": "^0.0.0",
|
|
18
|
-
"@types/node": "^
|
|
19
|
-
"@
|
|
21
|
+
"@types/node": "^24.10.9",
|
|
22
|
+
"@typescript/native-preview": "^7.0.0-dev.20260106.1",
|
|
23
|
+
"@vitest/coverage-v8": "^4.0.17",
|
|
20
24
|
"tsx": "^4.21.0",
|
|
21
25
|
"typescript": "^5.9.3",
|
|
22
|
-
"vitest": "^4.0.
|
|
26
|
+
"vitest": "^4.0.17"
|
|
23
27
|
}
|
|
24
28
|
}
|