Skip to content

Commit

Permalink
[Bug] createAllPromise signature is different from native Promise.all #…
Browse files Browse the repository at this point in the history
  • Loading branch information
nev21 authored Feb 18, 2024
1 parent 0737da4 commit 6e0bc30
Show file tree
Hide file tree
Showing 34 changed files with 1,265 additions and 371 deletions.
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
!/LICENSE
!lib/dist-esm/**
!lib/dist/**
!lib/browser/**
!lib/bundle/**
!lib/src/**
!lib/types/**
30 changes: 18 additions & 12 deletions README.md

Large diffs are not rendered by default.

81 changes: 50 additions & 31 deletions common/config/rush/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions common/scripts/install-run.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
},

"dependencies": {
"@nevware21/ts-utils": ">= 0.10.3 < 2.x"
"@nevware21/ts-utils": ">= 0.10.5 < 2.x"
},
"devDependencies": {
"@nevware21/tools-pre-proc": "0.1.0",
Expand Down
34 changes: 17 additions & 17 deletions lib/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const rollupConfigFactory = (srcPath, destPath, isMinified, path, format = "iife
const taskRollupConfig = {
input: `./${srcPath}/index.js`,
output: {
file: `./dist/${destPath}/${path}/${outputName}${postfix}.js`,
file: `./bundle/${destPath}/${path}/${outputName}${postfix}.js`,
banner: banner,
format: format,
name: "nevware21.ts-async",
Expand All @@ -112,7 +112,7 @@ const rollupConfigFactory = (srcPath, destPath, isMinified, path, format = "iife
};

if (isMinified) {
taskRollupConfig.output.file = `./dist/${destPath}/${path}/${outputName}${postfix}.min.js`;
taskRollupConfig.output.file = `./bundle/${destPath}/${path}/${outputName}${postfix}.min.js`;
if (format !== "esm") {
taskRollupConfig.plugins.push(
uglify3({
Expand Down Expand Up @@ -215,7 +215,7 @@ const polyfillRollupConfigFactory = (srcPath, destPath, isMinified, format = "ii
const taskRollupConfig = {
input: `./${srcPath}/polyfills.js`,
output: {
file: `./dist/${destPath}/${polyFillOutputName}${postfix}.js`,
file: `./bundle/${destPath}/${polyFillOutputName}${postfix}.js`,
banner: polyFillBanner,
format: format,
name: "nevware21.ts-async",
Expand All @@ -239,7 +239,7 @@ const polyfillRollupConfigFactory = (srcPath, destPath, isMinified, format = "ii
};

if (isMinified) {
taskRollupConfig.output.file = `./dist/${destPath}/${polyFillOutputName}${postfix}.min.js`;
taskRollupConfig.output.file = `./bundle/${destPath}/${polyFillOutputName}${postfix}.min.js`;
taskRollupConfig.plugins.push(
uglify3({
ie8: false,
Expand Down Expand Up @@ -271,27 +271,27 @@ export default [

rollupConfigFactory("dist-es5", "es5", false, "esm", "esm"),
rollupConfigFactory("dist-es5", "es5", true, "esm", "esm"),
rollupConfigFactory("dist-es5", "es5", false, "amd", "amd"),
rollupConfigFactory("dist-es5", "es5", true, "amd", "amd"),
rollupConfigFactory("dist-es5", "es5", false, "cjs", "cjs"),
rollupConfigFactory("dist-es5", "es5", true, "cjs", "cjs"),
// rollupConfigFactory("dist-es5", "es5", false, "amd", "amd"),
// rollupConfigFactory("dist-es5", "es5", true, "amd", "amd"),
// rollupConfigFactory("dist-es5", "es5", false, "cjs", "cjs"),
// rollupConfigFactory("dist-es5", "es5", true, "cjs", "cjs"),
rollupConfigFactory("dist-es5", "es5", false, "iife", "iife"),
rollupConfigFactory("dist-es5", "es5", true, "iife", "iife"),
rollupConfigFactory("dist-es5", "es5", false, "umd", "umd"),
rollupConfigFactory("dist-es5", "es5", true, "umd", "umd"),
rollupConfigFactory("dist-es5", "es5", false, "system", "system"),
rollupConfigFactory("dist-es5", "es5", true, "system", "system"),
// rollupConfigFactory("dist-es5", "es5", false, "system", "system"),
// rollupConfigFactory("dist-es5", "es5", true, "system", "system"),

rollupConfigFactory("dist-es6", "es6", false, "esm", "esm"),
rollupConfigFactory("dist-es6", "es6", true, "esm", "esm"),
rollupConfigFactory("dist-es6", "es6", false, "amd", "amd"),
rollupConfigFactory("dist-es6", "es6", true, "amd", "amd"),
rollupConfigFactory("dist-es6", "es6", false, "cjs", "cjs"),
rollupConfigFactory("dist-es6", "es6", true, "cjs", "cjs"),
// rollupConfigFactory("dist-es6", "es6", false, "amd", "amd"),
// rollupConfigFactory("dist-es6", "es6", true, "amd", "amd"),
// rollupConfigFactory("dist-es6", "es6", false, "cjs", "cjs"),
// rollupConfigFactory("dist-es6", "es6", true, "cjs", "cjs"),
rollupConfigFactory("dist-es6", "es6", false, "iife", "iife"),
rollupConfigFactory("dist-es6", "es6", true, "iife", "iife"),
rollupConfigFactory("dist-es6", "es6", false, "umd", "umd"),
rollupConfigFactory("dist-es6", "es6", true, "umd", "umd"),
rollupConfigFactory("dist-es6", "es6", false, "system", "system"),
rollupConfigFactory("dist-es6", "es6", true, "system", "system")
rollupConfigFactory("dist-es6", "es6", true, "umd", "umd")
// rollupConfigFactory("dist-es6", "es6", false, "system", "system"),
// rollupConfigFactory("dist-es6", "es6", true, "system", "system")
];
6 changes: 3 additions & 3 deletions lib/src/helpers/doWhileAsync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
* Licensed under the MIT license.
*/

import { fnCall, isFunction, isPromiseLike, utcNow } from "@nevware21/ts-utils";
import { isFunction, isPromiseLike, utcNow } from "@nevware21/ts-utils";
import { IPromise } from "../interfaces/IPromise";
import { createPromise } from "../promise/promise";
import { doAwait } from "../promise/await";
import { RejectPromiseHandler, ResolvePromiseHandler } from "../interfaces/types";
import { IWhileState } from "../interfaces/IWhileState";

const _doneChk = <T>(isDone: boolean, state: IWhileState<T>, value: T, thisArg?: any) => {
const _doneChk = /*#__PURE__*/<T>(isDone: boolean, state: IWhileState<T>, value: T, thisArg?: any) => {
let result: boolean | IPromise<boolean> = isDone;
state.res = value;
if (!result) {
Expand Down Expand Up @@ -185,7 +185,7 @@ const _doneChk = <T>(isDone: boolean, state: IWhileState<T>, value: T, thisArg?:
* console.log(result); // my old friend
* ```
*/
export const doWhileAsync = <T>(callbackFn: (state: IWhileState<T>) => T | IPromise<T>, isDoneFn?: (state: IWhileState<T>) => boolean | void | IPromise<boolean | void>, thisArg?: any): T | IPromise<T> => {
export function doWhileAsync<T>(callbackFn: (state: IWhileState<T>) => T | IPromise<T>, isDoneFn?: (state: IWhileState<T>) => boolean | void | IPromise<boolean | void>, thisArg?: any): T | IPromise<T> {
let promise: T | IPromise<T>;
let resolve: ResolvePromiseHandler<T>;
let reject: RejectPromiseHandler | never = (reason: any) => {
Expand Down
Loading

0 comments on commit 6e0bc30

Please sign in to comment.