aveazul 1.0.2 → 1.1.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.
Files changed (83) hide show
  1. package/cjs-entry.cjs +2 -0
  2. package/dist-cjs/any.cjs +50 -0
  3. package/dist-cjs/any.cjs.map +1 -0
  4. package/dist-cjs/any.d.ts +2 -0
  5. package/dist-cjs/any.js.map +1 -0
  6. package/dist-cjs/aveazul.cjs +648 -0
  7. package/dist-cjs/aveazul.cjs.map +1 -0
  8. package/dist-cjs/aveazul.d.ts +344 -0
  9. package/dist-cjs/aveazul.js.map +1 -0
  10. package/dist-cjs/disposer.cjs +15 -0
  11. package/dist-cjs/disposer.cjs.map +1 -0
  12. package/dist-cjs/disposer.d.ts +9 -0
  13. package/dist-cjs/disposer.js.map +1 -0
  14. package/dist-cjs/index.cjs +17 -0
  15. package/dist-cjs/index.cjs.map +1 -0
  16. package/dist-cjs/index.d.ts +10 -0
  17. package/dist-cjs/index.js.map +1 -0
  18. package/dist-cjs/not-implemented.cjs +107 -0
  19. package/dist-cjs/not-implemented.cjs.map +1 -0
  20. package/dist-cjs/not-implemented.d.ts +4 -0
  21. package/dist-cjs/not-implemented.js.map +1 -0
  22. package/dist-cjs/operational-error.cjs +43 -0
  23. package/dist-cjs/operational-error.cjs.map +1 -0
  24. package/dist-cjs/operational-error.d.ts +20 -0
  25. package/dist-cjs/operational-error.js.map +1 -0
  26. package/dist-cjs/promisify-all.cjs +74 -0
  27. package/dist-cjs/promisify-all.cjs.map +1 -0
  28. package/dist-cjs/promisify-all.d.ts +10 -0
  29. package/dist-cjs/promisify-all.js.map +1 -0
  30. package/dist-cjs/promisify.cjs +63 -0
  31. package/dist-cjs/promisify.cjs.map +1 -0
  32. package/dist-cjs/promisify.d.ts +11 -0
  33. package/dist-cjs/promisify.js.map +1 -0
  34. package/dist-cjs/tsconfig.cjs.tsbuildinfo +1 -0
  35. package/dist-cjs/using.cjs +129 -0
  36. package/dist-cjs/using.cjs.map +1 -0
  37. package/dist-cjs/using.d.ts +12 -0
  38. package/dist-cjs/using.js.map +1 -0
  39. package/dist-cjs/util.cjs +185 -0
  40. package/dist-cjs/util.cjs.map +1 -0
  41. package/dist-cjs/util.d.ts +29 -0
  42. package/dist-cjs/util.js.map +1 -0
  43. package/dist-esm/any.d.ts +2 -0
  44. package/dist-esm/any.js +47 -0
  45. package/dist-esm/any.js.map +1 -0
  46. package/dist-esm/aveazul.d.ts +344 -0
  47. package/dist-esm/aveazul.js +612 -0
  48. package/dist-esm/aveazul.js.map +1 -0
  49. package/dist-esm/disposer.d.ts +9 -0
  50. package/dist-esm/disposer.js +11 -0
  51. package/dist-esm/disposer.js.map +1 -0
  52. package/dist-esm/index.d.ts +10 -0
  53. package/dist-esm/index.js +8 -0
  54. package/dist-esm/index.js.map +1 -0
  55. package/dist-esm/not-implemented.d.ts +4 -0
  56. package/dist-esm/not-implemented.js +102 -0
  57. package/dist-esm/not-implemented.js.map +1 -0
  58. package/dist-esm/operational-error.d.ts +20 -0
  59. package/dist-esm/operational-error.js +37 -0
  60. package/dist-esm/operational-error.js.map +1 -0
  61. package/dist-esm/promisify-all.d.ts +10 -0
  62. package/dist-esm/promisify-all.js +71 -0
  63. package/dist-esm/promisify-all.js.map +1 -0
  64. package/dist-esm/promisify.d.ts +11 -0
  65. package/dist-esm/promisify.js +60 -0
  66. package/dist-esm/promisify.js.map +1 -0
  67. package/dist-esm/tsconfig.esm.tsbuildinfo +1 -0
  68. package/dist-esm/using.d.ts +12 -0
  69. package/dist-esm/using.js +126 -0
  70. package/dist-esm/using.js.map +1 -0
  71. package/dist-esm/util.d.ts +29 -0
  72. package/dist-esm/util.js +175 -0
  73. package/dist-esm/util.js.map +1 -0
  74. package/package.json +31 -18
  75. package/lib/any.js +0 -55
  76. package/lib/aveazul.js +0 -645
  77. package/lib/disposer.js +0 -14
  78. package/lib/not-implemented.js +0 -110
  79. package/lib/operational-error.js +0 -46
  80. package/lib/promisify-all.js +0 -93
  81. package/lib/promisify.js +0 -70
  82. package/lib/using.js +0 -142
  83. package/lib/util.js +0 -199
@@ -0,0 +1,175 @@
1
+ /**
2
+ * Determines if a function is a class (either ES6 class or ES5 constructor function)
3
+ * This function performs several checks to identify different class patterns:
4
+ * 1. ES6 classes with the 'class' keyword
5
+ * 2. Constructor functions (ES5 classes) with prototype methods
6
+ *
7
+ * @param fn - The value to check
8
+ * @returns True if the function is a class, false otherwise
9
+ */
10
+ const thisAssignmentPattern = /this\s*\.\s*\S+\s*=/;
11
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
12
+ export function isClass(fn) {
13
+ try {
14
+ if (typeof fn === "function") {
15
+ const keys = Object.getOwnPropertyNames(fn.prototype);
16
+ const hasMethods = keys.length > 1;
17
+ const hasMethodsOtherThanConstructor = keys.length > 0 && !(keys.length === 1 && keys[0] === "constructor");
18
+ const hasThisAssignmentAndStaticMethods = thisAssignmentPattern.test(fn + "") &&
19
+ Object.getOwnPropertyNames(fn).length > 0;
20
+ if (hasMethods ||
21
+ hasMethodsOtherThanConstructor ||
22
+ hasThisAssignmentAndStaticMethods) {
23
+ return true;
24
+ }
25
+ }
26
+ return false;
27
+ }
28
+ catch (_a) {
29
+ return false;
30
+ }
31
+ }
32
+ const rident = /^[a-z$_][a-z$_0-9]*$/i;
33
+ export function isIdentifier(str) {
34
+ return rident.test(str);
35
+ }
36
+ /**
37
+ * Prop filtering code copied from bluebird/js/release
38
+ */
39
+ const noCopyProps = [
40
+ "arity",
41
+ "length",
42
+ "name",
43
+ "arguments",
44
+ "caller",
45
+ "callee",
46
+ "prototype",
47
+ "__isPromisified__",
48
+ ];
49
+ const noCopyPropsPattern = new RegExp("^(?:" + noCopyProps.join("|") + ")$");
50
+ function propsFilter(key) {
51
+ return !noCopyPropsPattern.test(key);
52
+ }
53
+ export function copyOwnProperties(source, target, filter = propsFilter) {
54
+ const names = Object.getOwnPropertyNames(source);
55
+ for (const name of names) {
56
+ if (filter(name)) {
57
+ Object.defineProperty(target, name, Object.getOwnPropertyDescriptor(source, name));
58
+ }
59
+ }
60
+ }
61
+ /**
62
+ * Copied from bluebird/js/release/util.js
63
+ */
64
+ export function isPromisified(fn) {
65
+ try {
66
+ return fn.__isPromisified__ === true;
67
+ }
68
+ catch (_a) {
69
+ return false;
70
+ }
71
+ }
72
+ /**
73
+ * Determines if an object is a Promise instance
74
+ * @param obj - The object to check
75
+ * @returns True if the object is a Promise instance, false otherwise
76
+ */
77
+ export function isPromise(obj) {
78
+ return (obj instanceof Promise ||
79
+ (obj != null &&
80
+ typeof obj === "object" &&
81
+ typeof obj.then === "function" &&
82
+ typeof obj.catch === "function"));
83
+ }
84
+ /**
85
+ * Gets all property keys from an object and its prototype chain, excluding standard
86
+ * prototypes like Object.prototype, Array.prototype, and Function.prototype
87
+ *
88
+ * @param obj - The target object to get keys from
89
+ * @param excludedProtos - An array of prototype objects to exclude keys from
90
+ * @returns Array of property keys
91
+ */
92
+ export function getObjectDataKeys(obj, excludedProtos = []) {
93
+ const excludedPrototypes = [
94
+ Array.prototype,
95
+ Object.prototype,
96
+ Function.prototype,
97
+ ...excludedProtos,
98
+ ];
99
+ const isExcludedProto = function (val) {
100
+ for (const protoVal of excludedPrototypes) {
101
+ if (protoVal === val) {
102
+ return true;
103
+ }
104
+ }
105
+ return false;
106
+ };
107
+ const ret = [];
108
+ const visitedKeys = Object.create(null);
109
+ /* copied from bluebird/js/release/util.js and modified */
110
+ while (obj && !isExcludedProto(obj)) {
111
+ let keys;
112
+ try {
113
+ keys = Object.getOwnPropertyNames(obj);
114
+ }
115
+ catch (_a) {
116
+ /* istanbul ignore next */
117
+ return ret;
118
+ }
119
+ for (const key of keys) {
120
+ /* istanbul ignore if */
121
+ if (visitedKeys[key]) {
122
+ /* istanbul ignore next */
123
+ continue;
124
+ }
125
+ visitedKeys[key] = true;
126
+ const desc = Object.getOwnPropertyDescriptor(obj, key);
127
+ /**
128
+ * When desc.get && desc.set are falsy, it means the property is a data
129
+ * property that holds an actual value, rather than being computed dynamically
130
+ * through getter/setter functions.
131
+ */
132
+ /* istanbul ignore next */
133
+ if (desc && !desc.get && !desc.set) {
134
+ ret.push(key);
135
+ }
136
+ }
137
+ obj = Object.getPrototypeOf(obj);
138
+ }
139
+ return ret;
140
+ }
141
+ /**
142
+ * Triggers an uncaught exception in a safe way by scheduling it on the next event loop tick
143
+ * This is used for fatal errors that should crash the process
144
+ * @param error - The error to throw
145
+ */
146
+ export function triggerUncaughtException(error) {
147
+ let err;
148
+ if (!(error instanceof Error)) {
149
+ err = new Error(String(error));
150
+ }
151
+ else {
152
+ err = error;
153
+ }
154
+ // Use setTimeout with 0ms delay to throw on the next event loop tick
155
+ // This ensures the current execution context completes first
156
+ setTimeout(() => {
157
+ throw err;
158
+ }, 0);
159
+ }
160
+ export function toArray(args) {
161
+ if (!Array.isArray(args)) {
162
+ // Check if args is iterable
163
+ if (args != null &&
164
+ typeof args[Symbol.iterator] === "function") {
165
+ // Convert iterable to array, must do this to get the length, in order
166
+ // to detect if too many errors occurred and completion is impossible.
167
+ args = Array.from(args);
168
+ }
169
+ else {
170
+ throw new TypeError("expecting an array or an iterable object but got " + args);
171
+ }
172
+ }
173
+ return args;
174
+ }
175
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,qBAAqB,GAAG,qBAAqB,CAAC;AAEpD,sEAAsE;AACtE,MAAM,UAAU,OAAO,CAAC,EAAW;IACjC,IAAI,CAAC;QACH,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE,CAAC;YAC7B,MAAM,IAAI,GAAG,MAAM,CAAC,mBAAmB,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC;YAEtD,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;YACnC,MAAM,8BAA8B,GAClC,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,C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E,IAAI,IAAI,IAAI;YACZ,OAAQ,IAAoB,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,UAAU,EAC5D,CAAC;YACD,sEAAsE;YACtE,sEAAsE;YACtE,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAmB,CAAC,CAAC;QACzC,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,SAAS,CACjB,mDAAmD,GAAG,IAAI,CAC3D,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,IAAW,CAAC;AACrB,CAAC"}
package/package.json CHANGED
@@ -1,26 +1,44 @@
1
1
  {
2
2
  "name": "aveazul",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "description": "Bluebird drop-in replacement built on native Promise",
5
- "main": "lib/aveazul.js",
5
+ "type": "module",
6
+ "types": "dist-cjs/index.d.ts",
7
+ "main": "cjs-entry.cjs",
8
+ "module": "dist-esm/index.js",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist-esm/index.js",
12
+ "require": "./cjs-entry.cjs"
13
+ },
14
+ "./package.json": "./package.json"
15
+ },
6
16
  "homepage": "https://github.com/jchip/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": "xrun [-s, build:clean, [build:esm, build:cjs], build:2cjs]",
20
+ "build:clean": "rm -rf dist-*",
21
+ "build:esm": "tsc --build tsconfig.esm.json",
22
+ "build:cjs": "tsc --build tsconfig.cjs.json",
23
+ "build:2cjs": "ts2mjs --cjs --skip-ts --remove-source dist-cjs",
24
+ "test": "xrun -s vitest build demo:cjs demo:esm",
25
+ "vitest": "vitest run",
26
+ "test:watch": "vitest",
27
+ "test:coverage": "vitest run --coverage",
28
+ "test:bluebird": "USE_BLUEBIRD=true vitest run",
29
+ "demo:cjs": "cd demo/sample-1-cjs && fyn install --no-build-local && node demo.cjs",
30
+ "demo:esm": "cd demo/sample-1-esm && fyn install --no-build-local && node demo.js",
31
+ "prepublishOnly": "xrun build",
32
+ "postpack": "publish-util-postpack"
17
33
  },
18
34
  "author": "Joel Chen",
19
35
  "contributors": [
20
36
  "Claude (AI assistant)"
21
37
  ],
22
38
  "files": [
23
- "lib"
39
+ "cjs-entry.cjs",
40
+ "dist-cjs",
41
+ "dist-esm"
24
42
  ],
25
43
  "keywords": [
26
44
  "promise",
@@ -63,14 +81,9 @@
63
81
  },
64
82
  "dependencies": {
65
83
  "@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"
84
+ "xaa": "^2.0.0"
72
85
  },
73
86
  "engines": {
74
- "node": ">=12.0.0"
87
+ "node": ">=18.0.0"
75
88
  }
76
89
  }
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;