aveazul 1.0.2 → 2.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/package.json CHANGED
@@ -1,26 +1,40 @@
1
1
  {
2
2
  "name": "aveazul",
3
- "version": "1.0.2",
3
+ "version": "2.0.0",
4
4
  "description": "Bluebird drop-in replacement built on native Promise",
5
- "main": "lib/aveazul.js",
6
- "homepage": "https://github.com/jchip/aveazul",
5
+ "type": "module",
6
+ "types": "./dist/index.d.ts",
7
+ "main": "./cjs-entry.cjs",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "require": "./cjs-entry.cjs"
13
+ },
14
+ "./package.json": "./package.json"
15
+ },
16
+ "homepage": "https://github.com/jchip/fynjs/tree/main/packages/aveazul",
7
17
  "license": "Apache-2.0",
8
18
  "scripts": {
9
- "test": "jest test",
10
- "test:watch": "jest test --watch",
11
- "test:coverage": "jest test --coverage",
12
- "test:bluebird": "USE_BLUEBIRD=true jest test",
13
- "test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand --no-coverage",
14
- "test:debug:bluebird": "USE_BLUEBIRD=true node --inspect-brk node_modules/.bin/jest --runInBand --no-coverage",
15
- "jest": "jest --no-coverage",
16
- "jest:bluebird": "USE_BLUEBIRD=true jest --no-coverage"
19
+ "build": "rm -rf dist && tsc -p tsconfig.json",
20
+ "test": "npm run vitest && npm run build && npm run demo:cjs && npm run demo:esm",
21
+ "ci:check": "tsc --noEmit -p tsconfig.json && npm test",
22
+ "vitest": "vitest run",
23
+ "test:watch": "vitest",
24
+ "test:coverage": "vitest run --coverage",
25
+ "test:bluebird": "USE_BLUEBIRD=true vitest run",
26
+ "demo:cjs": "cd demo/sample-1-cjs && fyn install --no-build-local && node demo.cjs",
27
+ "demo:esm": "cd demo/sample-1-esm && fyn install --no-build-local && node demo.js",
28
+ "prepublishOnly": "npm run build",
29
+ "postpack": "publish-util-postpack"
17
30
  },
18
31
  "author": "Joel Chen",
19
32
  "contributors": [
20
33
  "Claude (AI assistant)"
21
34
  ],
22
35
  "files": [
23
- "lib"
36
+ "cjs-entry.cjs",
37
+ "dist"
24
38
  ],
25
39
  "keywords": [
26
40
  "promise",
@@ -57,20 +71,20 @@
57
71
  "aveazul",
58
72
  "aveazul.js"
59
73
  ],
74
+ "bugs": {
75
+ "url": "https://github.com/jchip/fynjs/issues"
76
+ },
60
77
  "repository": {
61
78
  "type": "git",
62
- "url": "git+https://github.com/jchip/aveazul.git"
79
+ "url": "git+https://github.com/jchip/fynjs.git",
80
+ "directory": "packages/aveazul"
63
81
  },
64
82
  "dependencies": {
65
- "@jchip/error": "^1.0.3",
66
- "xaa": "^1.8.0"
67
- },
68
- "devDependencies": {
69
- "bluebird": "^3.7.2",
70
- "jest": "^28.0.0",
71
- "rimraf": "^3.0.1"
83
+ "@jchip/error": "^2.0.0",
84
+ "xaa": "^3.0.0"
72
85
  },
73
86
  "engines": {
74
- "node": ">=12.0.0"
75
- }
87
+ "node": ">=22.12.0"
88
+ },
89
+ "sideEffects": false
76
90
  }
package/lib/any.js DELETED
@@ -1,55 +0,0 @@
1
- "use strict";
2
-
3
- const { toArray, isPromise } = require("./util");
4
- const { AggregateError } = require("@jchip/error");
5
-
6
- function addStaticAny(AveAzul, force = false) {
7
- if (force || !AveAzul.any) {
8
- AveAzul.any = function (args) {
9
- try {
10
- args = toArray(args);
11
- } catch (error) {
12
- return AveAzul.reject(error);
13
- }
14
-
15
- if (args.length === 0) {
16
- return AveAzul.reject(
17
- new RangeError(
18
- "Input array must contain at least 1 items but contains only 0 items"
19
- )
20
- );
21
- }
22
-
23
- return new AveAzul((resolve, reject) => {
24
- const len = args.length;
25
- let settled = false;
26
- const errors = [];
27
-
28
- const doFinish = (value) => {
29
- if (settled) return;
30
- settled = true;
31
- resolve(value);
32
- };
33
-
34
- const addError = (err) => {
35
- errors.push(err);
36
- if (!settled && errors.length >= len) {
37
- settled = true;
38
- reject(new AggregateError(errors));
39
- }
40
- };
41
-
42
- for (let i = 0; i < len; i++) {
43
- const arg = args[i];
44
- if (isPromise(arg)) {
45
- arg.then(doFinish, addError);
46
- } else {
47
- doFinish(arg);
48
- }
49
- }
50
- });
51
- };
52
- }
53
- }
54
-
55
- module.exports.addStaticAny = addStaticAny;