Get rid of third party abort-controller package (#473)

* get rid of third party abort-controller impl

* Change files

* fix typeo
This commit is contained in:
Kenneth Chau 2022-11-01 15:42:18 -07:00 коммит произвёл GitHub
Родитель 920095c97b
Коммит 97b306418a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
19 изменённых файлов: 30 добавлений и 21 удалений

2
.github/workflows/pr.yml поставляемый
Просмотреть файл

@ -42,7 +42,7 @@ jobs:
run: yarn lage depcheck
- name: Build, Test, Lint (Linux)
run: yarn lage build test lint --concurrency 2 --log-level silly
run: yarn lage build test lint --concurrency 2 --verbose
env:
BACKFILL_CACHE_PROVIDER: ${{ secrets.backfill_cache_provider }}
BACKFILL_CACHE_PROVIDER_OPTIONS: ${{ secrets.backfill_cache_provider_options }}

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "get rid of third party abort-controller impl",
"packageName": "@lage-run/scheduler",
"email": "kchau@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "get rid of third party abort-controller impl",
"packageName": "@lage-run/scheduler-types",
"email": "kchau@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "get rid of third party abort-controller impl",
"packageName": "@lage-run/worker-threads-pool",
"email": "kchau@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -14,8 +14,7 @@
"lint": "monorepo-scripts lint"
},
"dependencies": {
"@lage-run/target-graph": "^0.5.3",
"abort-controller": "^3.0.0"
"@lage-run/target-graph": "^0.5.3"
},
"devDependencies": {
"monorepo-scripts": "*"

Просмотреть файл

@ -1,5 +1,4 @@
import type { Target } from "@lage-run/target-graph";
import type { AbortSignal } from "abort-controller";
export interface TargetRunnerOptions {
target: Target;

Просмотреть файл

@ -18,8 +18,7 @@
"@lage-run/target-graph": "^0.5.3",
"@lage-run/logger": "^1.2.2",
"@lage-run/cache": "^0.1.28",
"@lage-run/worker-threads-pool": "^0.4.3",
"abort-controller": "^3.0.0"
"@lage-run/worker-threads-pool": "^0.4.3"
},
"devDependencies": {
"@lage-run/scheduler-types": "^0.2.5",

Просмотреть файл

@ -1,9 +1,7 @@
import { AbortController } from "abort-controller";
import { categorizeTargetRuns } from "./categorizeTargetRuns.js";
import { getStartTargetId, sortTargetsByPriority } from "@lage-run/target-graph";
import { WrappedTarget } from "./WrappedTarget.js";
import type { AbortSignal } from "abort-controller";
import type { CacheProvider, TargetHasher } from "@lage-run/cache";
import type { Logger } from "@lage-run/logger";
import type { TargetGraph, Target } from "@lage-run/target-graph";

Просмотреть файл

@ -6,7 +6,6 @@ import fs from "fs";
import path from "path";
import { mkdir, writeFile } from "fs/promises";
import type { AbortController } from "abort-controller";
import type { CacheProvider } from "@lage-run/cache";
import type { Pool } from "@lage-run/worker-threads-pool";
import type { TargetHasher } from "@lage-run/cache";

Просмотреть файл

@ -1,7 +1,6 @@
import { registerWorker } from "@lage-run/worker-threads-pool";
import { TargetRunnerPicker } from "../runners/TargetRunnerPicker.js";
import { workerData } from "worker_threads";
import type { AbortSignal } from "abort-controller";
import type { TargetRunnerPickerOptions } from "../runners/TargetRunnerPicker.js";
interface TargetWorkerDataOptions {

Просмотреть файл

@ -1,8 +1,6 @@
import "child_process";
import { AbortController } from "abort-controller";
import { ChildProcess } from "child_process";
import { getTargetId, Target } from "@lage-run/target-graph";
import { Logger, LogLevel, Reporter } from "@lage-run/logger";
import { NpmScriptRunner } from "../src/runners/NpmScriptRunner";
import { waitFor } from "./waitFor";
import os from "os";

Просмотреть файл

@ -2,7 +2,6 @@ import { Target } from "@lage-run/target-graph";
import { WrappedTarget } from "../src/WrappedTarget";
import path from "path";
import AbortController, { AbortSignal } from "abort-controller";
import { CacheProvider, TargetHasher } from "@lage-run/cache";
import { Logger } from "@lage-run/logger";
import { TargetRunner } from "@lage-run/scheduler-types";

Просмотреть файл

@ -15,8 +15,7 @@
"lint": "monorepo-scripts lint"
},
"dependencies": {
"@lage-run/logger": "^1.2.2",
"abort-controller": "^3.0.0"
"@lage-run/logger": "^1.2.2"
},
"devDependencies": {
"monorepo-scripts": "*"

Просмотреть файл

@ -1,4 +1,3 @@
import type { AbortSignal } from "abort-controller";
import type { Readable } from "stream";
import type { Worker, WorkerOptions } from "worker_threads";
import type { Pool } from "./types/Pool.js";

Просмотреть файл

@ -14,7 +14,6 @@ import os from "os";
import type { Pool } from "./types/Pool.js";
import type { Readable } from "stream";
import type { AbortSignal } from "abort-controller";
import type { WorkerPoolOptions } from "./types/WorkerPoolOptions.js";
const kTaskInfo = Symbol("kTaskInfo");

Просмотреть файл

@ -1,8 +1,6 @@
import { parentPort } from "worker_threads";
import { AbortController } from "abort-controller";
import { endMarker, startMarker } from "./stdioStreamMarkers.js";
import type { AbortSignal } from "abort-controller";
import type { MessagePort } from "worker_threads";
export function registerWorker(fn: (data: any, abortSignal?: AbortSignal) => Promise<void> | void) {

Просмотреть файл

@ -1,6 +1,5 @@
import type { Worker } from "worker_threads";
import type { Readable } from "stream";
import type { AbortSignal } from "abort-controller";
export interface PoolStats {
maxWorkerMemoryUsage: number; // in bytes

Просмотреть файл

@ -1,5 +1,4 @@
const { parentPort } = require("worker_threads");
const { AbortController } = require("abort-controller");
const START_WORKER_STREAM_MARKER = "## WORKER:START:";
const END_WORKER_STREAM_MARKER = "## WORKER:END:";

5
types/global/index.d.ts поставляемый Normal file
Просмотреть файл

@ -0,0 +1,5 @@
declare interface AbortSignal {
abort(): void;
addEventListener: (event: string, listener: () => void) => void;
removeEventListener: (event: string, listener: () => void) => void;
}