From 31c60da4b29775ca10ee8e215016b1039fb2dff0 Mon Sep 17 00:00:00 2001 From: thinkinggis Date: Wed, 26 Feb 2020 22:23:43 +0800 Subject: [PATCH] chore: move out async-hook --- jest.config.js | 1 - package.json | 2 - packages/async-hook/README.md | 11 ----- packages/async-hook/package.json | 40 ------------------- .../async-hook/src/core/AsyncParallelHook.ts | 20 ---------- packages/async-hook/src/core/IHook.ts | 5 --- packages/async-hook/src/core/SyncBailHook.ts | 20 ---------- packages/async-hook/src/core/SyncHook.ts | 22 ---------- .../async-hook/src/core/SyncWaterfallHook.ts | 27 ------------- packages/async-hook/src/index.ts | 4 -- packages/async-hook/tsconfig.build.json | 9 ----- packages/core/package.json | 2 +- packages/layers/package.json | 2 +- packages/source/package.json | 2 +- tsconfig.build.json | 1 - tsconfig.json | 1 - yarn.lock | 17 ++++---- 17 files changed, 10 insertions(+), 176 deletions(-) delete mode 100644 packages/async-hook/README.md delete mode 100644 packages/async-hook/package.json delete mode 100644 packages/async-hook/src/core/AsyncParallelHook.ts delete mode 100644 packages/async-hook/src/core/IHook.ts delete mode 100644 packages/async-hook/src/core/SyncBailHook.ts delete mode 100644 packages/async-hook/src/core/SyncHook.ts delete mode 100644 packages/async-hook/src/core/SyncWaterfallHook.ts delete mode 100644 packages/async-hook/src/index.ts delete mode 100644 packages/async-hook/tsconfig.build.json diff --git a/jest.config.js b/jest.config.js index d9d93171e3..c775c0eda8 100644 --- a/jest.config.js +++ b/jest.config.js @@ -29,7 +29,6 @@ module.exports = { modulePathIgnorePatterns: [ 'dist' ], moduleNameMapper: { '@antv/l7-(.+)$': 'packages/$1/src', - '@antv/async-hook$': 'packages/async-hook/src' }, notify: true, notifyMode: 'always', diff --git a/package.json b/package.json index 7fb4553b76..ef49507196 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ "@rollup/plugin-json": "^4.0.0", "@rollup/plugin-node-resolve": "^6.0.0", "@storybook/react": "^5.1.9", - "@types/async": "^3.0.8", "@types/dat.gui": "^0.7.1", "@types/enzyme": "^3.1.14", "@types/enzyme-adapter-react-16": "^1.0.3", @@ -36,7 +35,6 @@ "@types/node": "^12.12.22", "@types/storybook__react": "^4.0.2", "@types/supercluster": "^5.0.1", - "async-es": "^3.2.0", "awesome-typescript-loader": "^5.2.1", "babel-jest": "^24.9.0", "babel-loader": "^8.0.6", diff --git a/packages/async-hook/README.md b/packages/async-hook/README.md deleted file mode 100644 index 12ac183118..0000000000 --- a/packages/async-hook/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# `async-hook` - -> TODO: description - -## Usage - -``` -const asyncHook = require('async-hook'); - -// TODO: DEMONSTRATE API -``` diff --git a/packages/async-hook/package.json b/packages/async-hook/package.json deleted file mode 100644 index a817c26075..0000000000 --- a/packages/async-hook/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@antv/async-hook", - "version": "2.0.28-alpha.2", - "description": "", - "main": "lib/index.js", - "module": "es/index.js", - "types": "es/index.d.ts", - "sideEffects": true, - "files": [ - "lib", - "es", - "README.md" - ], - "scripts": { - "tsc": "tsc --project tsconfig.build.json", - "clean": "rimraf dist; rimraf es; rimraf lib;", - "build": "run-p build:*", - "build:cjs": "BABEL_ENV=cjs babel src --root-mode upward --out-dir lib --source-maps --extensions .ts,.tsx --delete-dir-on-start --no-comments", - "build:esm": "BABEL_ENV=esm babel src --root-mode upward --out-dir es --source-maps --extensions .ts,.tsx --delete-dir-on-start --no-comments", - "watch": "BABEL_ENV=cjs babel src --watch --root-mode upward --out-dir lib --source-maps --extensions .ts,.tsx --delete-dir-on-start --no-comments", - "lint:ts": "run-p -c lint:ts-*", - "test": "jest" - }, - "author": "lzxue", - "license": "ISC", - "bugs": { - "url": "https://github.com/antvis/L7/issues" - }, - "homepage": "https://github.com/antvis/L7#readme", - "dependencies": { - "async": "^3.1.1" - }, - "devDependencies": { - "@types/async": "^3.0.8" - }, - "gitHead": "a5d354b66873f700730248d015c5e539c54b34b7", - "publishConfig": { - "access": "public" - } -} diff --git a/packages/async-hook/src/core/AsyncParallelHook.ts b/packages/async-hook/src/core/AsyncParallelHook.ts deleted file mode 100644 index 0e8322c90d..0000000000 --- a/packages/async-hook/src/core/AsyncParallelHook.ts +++ /dev/null @@ -1,20 +0,0 @@ -// @ts-ignore -// tslint:disable-next-line:no-submodule-imports -import async from 'async/dist/async.js'; -import { CallBack } from './IHook'; -export default class AsyncParallelHook { - private tasks: any[]; - constructor(...args: any[]) { - this.tasks = []; - } - - public promise(...args: any[]) { - return async.parallel(this.tasks); - } - public tapPromise(name: string, cb: CallBack) { - this.tasks.push(async (callback: any) => { - await cb(); - callback(null, name); - }); - } -} diff --git a/packages/async-hook/src/core/IHook.ts b/packages/async-hook/src/core/IHook.ts deleted file mode 100644 index c7c4baa32e..0000000000 --- a/packages/async-hook/src/core/IHook.ts +++ /dev/null @@ -1,5 +0,0 @@ -export type CallBack = (...args: any[]) => any; -export interface IHook { - call: (...args: any[]) => void; - tap(name: string, task: CallBack): void; -} diff --git a/packages/async-hook/src/core/SyncBailHook.ts b/packages/async-hook/src/core/SyncBailHook.ts deleted file mode 100644 index 9fd4aaf3d9..0000000000 --- a/packages/async-hook/src/core/SyncBailHook.ts +++ /dev/null @@ -1,20 +0,0 @@ -// @ts-ignore -// tslint:disable-next-line:no-submodule-imports -import async from 'async/dist/async.js'; -import { CallBack, IHook } from './IHook'; -export default class SyncBailHook implements IHook { - private tasks: any[]; - constructor(...args: any[]) { - this.tasks = []; - } - - public call(...args: any[]): void { - return async.series(this.tasks); - } - public tap(name: string, cb: CallBack) { - this.tasks.push((callback: any) => { - const err = cb(); - callback(err, name); - }); - } -} diff --git a/packages/async-hook/src/core/SyncHook.ts b/packages/async-hook/src/core/SyncHook.ts deleted file mode 100644 index e77955aa2d..0000000000 --- a/packages/async-hook/src/core/SyncHook.ts +++ /dev/null @@ -1,22 +0,0 @@ -// @ts-ignore -// tslint:disable-next-line:no-submodule-imports -import async from 'async/dist/async.js'; -import { CallBack, IHook } from './IHook'; -export default class SyncHook implements IHook { - private tasks: any[]; - private args: any[]; - constructor(...args: any[]) { - this.tasks = []; - } - - public call(...args: any[]): void { - this.args = args; - return async.series(this.tasks); - } - public tap(name: string, cb: CallBack) { - this.tasks.push((callback: any) => { - cb(...this.args); - callback(null, name); - }); - } -} diff --git a/packages/async-hook/src/core/SyncWaterfallHook.ts b/packages/async-hook/src/core/SyncWaterfallHook.ts deleted file mode 100644 index 5a6a8c9e47..0000000000 --- a/packages/async-hook/src/core/SyncWaterfallHook.ts +++ /dev/null @@ -1,27 +0,0 @@ -// @ts-ignore -// tslint:disable-next-line:no-submodule-imports -import async from 'async/dist/async.js'; -import { CallBack, IHook } from './IHook'; -export default class SyncWaterfallHook implements IHook { - private tasks: any[]; - constructor(...args: any[]) { - this.tasks = []; - } - - public call(...args: any[]): void { - return async.waterfall(this.tasks); - } - public tap(name: string, cb: CallBack) { - if (this.tasks.length === 0) { - this.tasks.push((callback: any) => { - const value = cb(); - callback(value ? null : false, value); - }); - } else { - this.tasks.push((arg: any, callback: any) => { - const value = cb(); - callback(value ? null : false, name); - }); - } - } -} diff --git a/packages/async-hook/src/index.ts b/packages/async-hook/src/index.ts deleted file mode 100644 index 6d0beedddf..0000000000 --- a/packages/async-hook/src/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { default as SyncHook } from './core/SyncHook'; -export { default as AsyncParallelHook } from './core/AsyncParallelHook'; -export { default as SyncWaterfallHook } from './core/SyncWaterfallHook'; -export { default as SyncBailHook } from './core/SyncBailHook'; diff --git a/packages/async-hook/tsconfig.build.json b/packages/async-hook/tsconfig.build.json deleted file mode 100644 index b0875fcb83..0000000000 --- a/packages/async-hook/tsconfig.build.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../tsconfig.build.json", - "compilerOptions": { - "declarationDir": "./es", - "rootDir": "./src", - "baseUrl": "./", - }, - "include": ["./src"] -} diff --git a/packages/core/package.json b/packages/core/package.json index 44c63112dd..3837cf2929 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -22,7 +22,7 @@ "author": "xiaoiver", "license": "ISC", "dependencies": { - "@antv/async-hook": "^2.0.28-alpha.2", + "@antv/async-hook": "^2.1.0", "@antv/l7-utils": "^2.0.28-alpha.2", "@babel/runtime": "^7.7.7", "@mapbox/tiny-sdf": "^1.1.1", diff --git a/packages/layers/package.json b/packages/layers/package.json index c3f8da562a..aa7a6c843e 100644 --- a/packages/layers/package.json +++ b/packages/layers/package.json @@ -22,7 +22,7 @@ "author": "xiaoiver", "license": "ISC", "dependencies": { - "@antv/async-hook": "^2.0.28-alpha.2", + "@antv/async-hook": "^2.1.0", "@antv/l7-core": "^2.0.28-alpha.2", "@antv/l7-source": "^2.0.28-alpha.2", "@antv/l7-utils": "^2.0.28-alpha.2", diff --git a/packages/source/package.json b/packages/source/package.json index e5fbf26bb9..c9cf717323 100644 --- a/packages/source/package.json +++ b/packages/source/package.json @@ -24,7 +24,7 @@ "author": "lzxue", "license": "ISC", "dependencies": { - "@antv/async-hook": "^2.0.28-alpha.2", + "@antv/async-hook": "^2.1.0", "@antv/l7-core": "^2.0.28-alpha.2", "@antv/l7-utils": "^2.0.28-alpha.2", "@babel/runtime": "^7.7.7", diff --git a/tsconfig.build.json b/tsconfig.build.json index eb851bfe18..7d60a440ce 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -7,7 +7,6 @@ "rootDir": "./", "baseUrl": "./", "paths": { - "@antv/async-hook": ["packages/async-hook/src"], "@antv/l7-*": ["packages/*/src"], "@antv/l7": ["packages/l7/src"], "*": ["node_modules", "packages"] diff --git a/tsconfig.json b/tsconfig.json index 8da284d9ff..392e8ac2f2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,7 +19,6 @@ "paths": { "@antv/l7-*": ["packages/*/src"], "@antv/l7": ["packages/l7/src"], - "@antv/async-hook": ["packages/async-hook/src"], "*": ["node_modules", "packages", "typings/*"] } }, diff --git a/yarn.lock b/yarn.lock index 4395201858..ea0a47f28d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -37,6 +37,13 @@ dependencies: "@antv/util" "~1.3.1" +"@antv/async-hook@^2.1.0": + version "2.1.0" + resolved "https://registry.npmjs.org/@antv/async-hook/-/async-hook-2.1.0.tgz#17f57a6ae5e9c55adac3cdfac7d441258c3f9aeb" + integrity sha512-q7Rup5jTDAiWh77Xb2vgkCURJGczmU2iWTCkBDq28PuK5KUoenyeGGrFKAVkgqaL663wdpw0Vzn+sYriTfT9hA== + dependencies: + async "^3.1.1" + "@antv/attr@~0.1.2": version "0.1.2" resolved "https://registry.npmjs.org/@antv/attr/-/attr-0.1.2.tgz#2eeb122fcaaf851a2d8749abc7c60519d3f77e37" @@ -3419,11 +3426,6 @@ resolved "https://registry.npmjs.org/@types/amap-js-api/-/amap-js-api-1.4.7.tgz#565342799c14c0b112cfea237aaa4b700360f406" integrity sha512-YWU1cWVtZ3d25/0rLiVH1ecJfEPRh+WiCShOsDbOa4woW7oP55OCoxKXuvkD+GjePv9Ye7dKR78HtDuF6s+OFQ== -"@types/async@^3.0.8": - version "3.0.8" - resolved "https://registry.npmjs.org/@types/async/-/async-3.0.8.tgz#8c183f149d8cc91f944d58e5594d2a614ceb33ff" - integrity sha512-wIM8bCrHeQHCUyDqJYXyvG8P98YeERaOB1NeOvcjnjlM32pn21S13j6tZqhiWX+nkpU3EvhtE/nuO1ItCpZ+HQ== - "@types/babel__core@^7.1.0": version "7.1.5" resolved "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.5.tgz#e4d84704b4df868b3ad538365a13da2fa6dbc023" @@ -4801,11 +4803,6 @@ async-each@^1.0.1: resolved "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz#b727dbf87d7651602f06f4d4ac387f47d91b0cbf" integrity sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ== -async-es@^3.2.0: - version "3.2.0" - resolved "https://registry.npmjs.org/async-es/-/async-es-3.2.0.tgz#8837aa12f675de80fac56b94a4b4cef515343de3" - integrity sha512-dMWVIUBi/ejt+QERtMdIin2rlzSNK7GAfEwIyaOGDy536s0OqH+aUNkj9MQ01hq2rB1f7x6w7RJchtthCk0IDA== - async-foreach@^0.1.3: version "0.1.3" resolved "https://registry.npmjs.org/async-foreach/-/async-foreach-0.1.3.tgz#36121f845c0578172de419a97dbeb1d16ec34542"