@vpmedia/simplify 1.72.0 → 1.73.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/.vscode/extensions.json +6 -0
- package/.vscode/settings.json +27 -0
- package/CHANGELOG.md +15 -0
- package/package.json +4 -5
- package/src/index.js +1 -1
- package/src/util/async.js +27 -0
- package/types/index.d.ts +1 -1
- package/types/util/async.d.ts +1 -0
- package/types/util/async.d.ts.map +1 -1
|
@@ -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,18 @@
|
|
|
1
|
+
## [1.73.0] - 2026-03-01
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- Added generic async retry helper
|
|
6
|
+
|
|
7
|
+
### 💼 Other
|
|
8
|
+
|
|
9
|
+
- *(deps)* Bump dependency versions
|
|
10
|
+
|
|
11
|
+
### ⚙️ Miscellaneous Tasks
|
|
12
|
+
|
|
13
|
+
- Release
|
|
14
|
+
- Migrate from prettier to oxfmt
|
|
15
|
+
- *(release)* V1.73.0
|
|
1
16
|
## [1.72.0] - 2026-02-28
|
|
2
17
|
|
|
3
18
|
### 🐛 Bug Fixes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vpmedia/simplify",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.73.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.
|
|
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": "
|
|
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,31 @@ export const delayPromise = (delayMS) =>
|
|
|
8
10
|
setTimeout(resolve, delayMS);
|
|
9
11
|
});
|
|
10
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Async method call retry helper.
|
|
15
|
+
* @param {Function} method - Async function to call.
|
|
16
|
+
* @param {number} numTries - Max retries.
|
|
17
|
+
* @param {number} delayMs - Delay between attempts in ms.
|
|
18
|
+
* @returns {Promise<any>} Async function result.
|
|
19
|
+
*/
|
|
20
|
+
export const retryAsync = async (method, numTries = 1, delayMs = 100) => {
|
|
21
|
+
for (let attempt = 0; attempt <= numTries; attempt += 1) {
|
|
22
|
+
try {
|
|
23
|
+
// oxlint-disable-next-line no-await-in-loop
|
|
24
|
+
return await method();
|
|
25
|
+
} catch (error) {
|
|
26
|
+
if (attempt === numTries) {
|
|
27
|
+
throw getTypedError(error);
|
|
28
|
+
}
|
|
29
|
+
if (delayMs > 0) {
|
|
30
|
+
// oxlint-disable-next-line no-await-in-loop
|
|
31
|
+
await delayPromise(delayMs);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
throw new Error('Unknown error');
|
|
36
|
+
};
|
|
37
|
+
|
|
11
38
|
/**
|
|
12
39
|
* Load JSON file using a fetch GET request.
|
|
13
40
|
* @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";
|
package/types/util/async.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../src/util/async.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../src/util/async.js"],"names":[],"mappings":"AAOO,sCAHI,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAKtB;AASG,wDAJI,MAAM,YACN,MAAM,GACJ,OAAO,CAAC,GAAG,CAAC,CAkBxB;AAOM,8BAHI,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAQ5B"}
|