@vpmedia/simplify 1.72.0 → 1.74.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.
@@ -0,0 +1,6 @@
1
+ {
2
+ "recommendations": [
3
+ "oxc.oxc-vscode",
4
+ "vitest.explorer"
5
+ ]
6
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "files.watcherExclude": {
3
+ "**/.git/objects/**": true,
4
+ "**/.git/subtree-cache/**": true,
5
+ "**/build/**": true,
6
+ "**/node_modules/**": true
7
+ },
8
+ "editor.codeActionsOnSave": {
9
+ "source.removeUnusedImports": "explicit",
10
+ "source.organizeImports": "explicit"
11
+ },
12
+ "oxc.enable": true,
13
+ "[javascript]": {
14
+ "editor.defaultFormatter": "oxc.oxc-vscode"
15
+ },
16
+ "[javascriptreact]": {
17
+ "editor.defaultFormatter": "oxc.oxc-vscode"
18
+ },
19
+ "javascript.updateImportsOnFileMove.enabled": "always",
20
+ "[typescript]": {
21
+ "editor.defaultFormatter": "oxc.oxc-vscode",
22
+ },
23
+ "[typescriptreact]": {
24
+ "editor.defaultFormatter": "oxc.oxc-vscode"
25
+ },
26
+ "typescript.updateImportsOnFileMove.enabled": "always",
27
+ }
package/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ ## [1.74.0] - 2026-03-01
2
+
3
+ ### ⚙️ Miscellaneous Tasks
4
+
5
+ - Release
6
+ - Improve type checking for retryAsync
7
+ - *(release)* V1.74.0
8
+ ## [1.73.0] - 2026-03-01
9
+
10
+ ### 🚀 Features
11
+
12
+ - Added generic async retry helper
13
+
14
+ ### 💼 Other
15
+
16
+ - *(deps)* Bump dependency versions
17
+
18
+ ### ⚙️ Miscellaneous Tasks
19
+
20
+ - Release
21
+ - Migrate from prettier to oxfmt
22
+ - *(release)* V1.73.0
1
23
  ## [1.72.0] - 2026-02-28
2
24
 
3
25
  ### 🐛 Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vpmedia/simplify",
3
- "version": "1.72.0",
3
+ "version": "1.74.0",
4
4
  "description": "@vpmedia/simplify",
5
5
  "author": "Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)",
6
6
  "license": "MIT",
@@ -24,21 +24,20 @@
24
24
  "devDependencies": {
25
25
  "@commitlint/cli": "^20.4.2",
26
26
  "@commitlint/config-conventional": "^20.4.2",
27
- "@types/node": "^25.3.2",
27
+ "@types/node": "^25.3.3",
28
28
  "@vitest/coverage-v8": "^4.0.18",
29
- "globals": "^17.3.0",
30
29
  "jsdom": "^28.1.0",
31
30
  "msw": "^2.12.10",
31
+ "oxfmt": "^0.35.0",
32
32
  "oxlint": "^1.50.0",
33
33
  "oxlint-tsgolint": "^0.15.0",
34
- "prettier": "^3.8.1",
35
34
  "typescript": "^5.9.3",
36
35
  "vitest": "^4.0.18"
37
36
  },
38
37
  "scripts": {
39
38
  "build": "rm -rf types && tsc -p ./tsconfig.build.json",
40
39
  "check": "pnpm build && pnpm lint && pnpm test && pnpm typecheck",
41
- "format": "prettier --write \"./**/*.{js,jsx,mjs,cjs,ts,tsx,json,css}\"",
40
+ "format": "oxfmt --write \"./**/*.{js,jsx,mjs,cjs,ts,tsx,json,css}\"",
42
41
  "lint": "oxlint src",
43
42
  "test": "vitest --coverage",
44
43
  "typecheck": "tsc"
package/src/index.js CHANGED
@@ -19,7 +19,7 @@ export {
19
19
  export { typeChecker } from './typecheck/TypeChecker.js';
20
20
  export { TypeCheckError } from './typecheck/TypeCheckError.js';
21
21
  export { typeCheck, typeCheckArray, typeCheckEnum } from './typecheck/util.js';
22
- export { delayPromise, loadJSON } from './util/async.js';
22
+ export { delayPromise, loadJSON, retryAsync } from './util/async.js';
23
23
  export { getErrorDetails, getTypedError } from './util/error.js';
24
24
  export { EventEmitter } from './util/event_emitter.js';
25
25
  export { FetchError, fetchRetry, HTTP_0_ANY } from './util/fetch.js';
package/src/util/async.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { getTypedError } from './error.js';
2
+
1
3
  /**
2
4
  * Returns a promise with delayed resolve.
3
5
  * @param {number} delayMS - Promise resolve delay in milliseconds.
@@ -8,6 +10,32 @@ export const delayPromise = (delayMS) =>
8
10
  setTimeout(resolve, delayMS);
9
11
  });
10
12
 
13
+ /**
14
+ * Async method call retry helper.
15
+ * @template T
16
+ * @param {() => Promise<T>} method - Async function to call.
17
+ * @param {number} numTries - Max retries.
18
+ * @param {number} delayMs - Delay between attempts in ms.
19
+ * @returns {Promise<T>} Async function result.
20
+ */
21
+ export const retryAsync = async (method, numTries = 1, delayMs = 100) => {
22
+ for (let attempt = 0; attempt <= numTries; attempt += 1) {
23
+ try {
24
+ // oxlint-disable-next-line no-await-in-loop
25
+ return await method();
26
+ } catch (error) {
27
+ if (attempt === numTries) {
28
+ throw getTypedError(error);
29
+ }
30
+ if (delayMs > 0) {
31
+ // oxlint-disable-next-line no-await-in-loop
32
+ await delayPromise(delayMs);
33
+ }
34
+ }
35
+ }
36
+ throw new Error('Unknown error');
37
+ };
38
+
11
39
  /**
12
40
  * Load JSON file using a fetch GET request.
13
41
  * @param {string} url - URL to load.
package/types/index.d.ts CHANGED
@@ -16,7 +16,7 @@ export { uuidv4 } from "./util/uuid.js";
16
16
  export { formatLogMessage, getLogLevelName } from "./logging/util.js";
17
17
  export { addPageLifecycleCallback, getDocumentState, getPageLifecycleEventEmitter, getPageLifecycleState, initPageLifecycle, isPageLifecycleInitialized } from "./pagelifecycle/util.js";
18
18
  export { typeCheck, typeCheckArray, typeCheckEnum } from "./typecheck/util.js";
19
- export { delayPromise, loadJSON } from "./util/async.js";
19
+ export { delayPromise, loadJSON, retryAsync } from "./util/async.js";
20
20
  export { getErrorDetails, getTypedError } from "./util/error.js";
21
21
  export { FetchError, fetchRetry, HTTP_0_ANY } from "./util/fetch.js";
22
22
  export { deg2rad, fixFloatPrecision, getRandomInt, isEqual, isGreater, isGreaterOrEqual, isInRange, isLess, isLessOrEqual, rad2deg } from "./util/number.js";
@@ -1,3 +1,4 @@
1
1
  export function delayPromise(delayMS: number): Promise<void>;
2
+ export function retryAsync<T>(method: () => Promise<T>, numTries?: number, delayMs?: number): Promise<T>;
2
3
  export function loadJSON(url: string): Promise<unknown>;
3
4
  //# sourceMappingURL=async.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../src/util/async.js"],"names":[],"mappings":"AAKO,sCAHI,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAKtB;AAOG,8BAHI,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAQ5B"}
1
+ {"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../src/util/async.js"],"names":[],"mappings":"AAOO,sCAHI,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAKtB;AAUG,2BANM,CAAC,UACH,MAAM,OAAO,CAAC,CAAC,CAAC,aAChB,MAAM,YACN,MAAM,GACJ,OAAO,CAAC,CAAC,CAAC,CAkBtB;AAOM,8BAHI,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAQ5B"}