Skip to content

Commit 602b322

Browse files
sean-perkinsrwaskiewicz
authored andcommitted
fix(compiler): destroy callback naming (#3289)
Fix Typos for `addDestroy` (`addDestory`) and `removeDestroy` (`removeDestory`) BREAKING CHANGE: Public APIs `addDestroy` (`addDestory`) and `removeDestroy` (`removeDestory`) have been renamed to fix typos
1 parent 3d16b41 commit 602b322

File tree

7 files changed

+20
-20
lines changed

7 files changed

+20
-20
lines changed

src/compiler/build/watch-build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export const createWatchBuild = async (
147147
}
148148
};
149149

150-
config.sys.addDestory(close);
150+
config.sys.addDestroy(close);
151151

152152
return {
153153
start,

src/compiler/sys/stencil-sys.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ export const createSystem = (c?: { logger?: Logger }): CompilerSystem => {
4444
const items = new Map<string, FsItem>();
4545
const destroys = new Set<() => Promise<void> | void>();
4646

47-
const addDestory = (cb: () => void) => destroys.add(cb);
48-
const removeDestory = (cb: () => void) => destroys.delete(cb);
47+
const addDestroy = (cb: () => void) => destroys.add(cb);
48+
const removeDestroy = (cb: () => void) => destroys.delete(cb);
4949
const events = buildEvents();
5050
const hardwareConcurrency = (IS_BROWSER_ENV && navigator.hardwareConcurrency) || 1;
5151

@@ -407,7 +407,7 @@ export const createSystem = (c?: { logger?: Logger }): CompilerSystem => {
407407
}
408408
};
409409

410-
addDestory(close);
410+
addDestroy(close);
411411

412412
if (item) {
413413
item.isDirectory = true;
@@ -427,7 +427,7 @@ export const createSystem = (c?: { logger?: Logger }): CompilerSystem => {
427427

428428
return {
429429
close() {
430-
removeDestory(close);
430+
removeDestroy(close);
431431
close();
432432
},
433433
};
@@ -447,7 +447,7 @@ export const createSystem = (c?: { logger?: Logger }): CompilerSystem => {
447447
}
448448
};
449449

450-
addDestory(close);
450+
addDestroy(close);
451451

452452
if (item) {
453453
item.isDirectory = false;
@@ -467,7 +467,7 @@ export const createSystem = (c?: { logger?: Logger }): CompilerSystem => {
467467

468468
return {
469469
close() {
470-
removeDestory(close);
470+
removeDestroy(close);
471471
close();
472472
},
473473
};
@@ -586,7 +586,7 @@ export const createSystem = (c?: { logger?: Logger }): CompilerSystem => {
586586
events,
587587
access,
588588
accessSync,
589-
addDestory,
589+
addDestroy,
590590
copyFile,
591591
createDir,
592592
createDirSync,
@@ -611,7 +611,7 @@ export const createSystem = (c?: { logger?: Logger }): CompilerSystem => {
611611
readFileSync,
612612
realpath,
613613
realpathSync,
614-
removeDestory,
614+
removeDestroy,
615615
rename,
616616
fetch,
617617
resolvePath,

src/compiler/sys/worker/sys-worker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const createSysWorker = (config: ValidatedConfig) => {
1212
) {
1313
const workerCtrl = config.sys.createWorkerController(config.maxConcurrentWorkers);
1414

15-
config.sys.addDestory(() => workerCtrl.destroy());
15+
config.sys.addDestroy(() => workerCtrl.destroy());
1616

1717
config.logger.debug(`create workers, maxWorkers: ${workerCtrl.maxWorkers}`);
1818
return createWorkerMainContext(workerCtrl);

src/compiler/transpile/create-build-program.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export const createTsBuildProgram = async (
7171
},
7272
};
7373

74-
config.sys.addDestory(() => tsWatchSys.clearTimeout(currentBuildTimeoutId));
74+
config.sys.addDestroy(() => tsWatchSys.clearTimeout(currentBuildTimeoutId));
7575

7676
/**
7777
* Create a {@link ts.WatchCompilerHost}. A CompilerHost allows a {@link ts.Program} to interact with the

src/compiler/transpile/create-watch-program.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const createTsWatchProgram = async (
3434
},
3535
};
3636

37-
config.sys.addDestory(() => tsWatchSys.clearTimeout(timeoutId));
37+
config.sys.addDestroy(() => tsWatchSys.clearTimeout(timeoutId));
3838

3939
const tsWatchHost = ts.createWatchCompilerHost(
4040
config.tsconfig,

src/declarations/stencil-public-compiler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ export interface CompilerSystem {
921921
/**
922922
* Add a callback which will be ran when destroy() is called.
923923
*/
924-
addDestory(cb: () => void): void;
924+
addDestroy(cb: () => void): void;
925925
/**
926926
* Always returns a boolean, does not throw.
927927
*/
@@ -1063,7 +1063,7 @@ export interface CompilerSystem {
10631063
/**
10641064
* Remove a callback which will be ran when destroy() is called.
10651065
*/
1066-
removeDestory(cb: () => void): void;
1066+
removeDestroy(cb: () => void): void;
10671067
/**
10681068
* Rename old path to new path. Does not throw.
10691069
*/

src/sys/node/node-sys.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ export function createNodeSys(c: { process?: any } = {}): CompilerSystem {
7676
} catch (e) {}
7777
return hasAccess;
7878
},
79-
addDestory(cb) {
79+
addDestroy(cb) {
8080
destroys.add(cb);
8181
},
82-
removeDestory(cb) {
82+
removeDestroy(cb) {
8383
destroys.delete(cb);
8484
},
8585
applyPrerenderGlobalPatch(opts) {
@@ -453,11 +453,11 @@ export function createNodeSys(c: { process?: any } = {}): CompilerSystem {
453453
tsFileWatcher.close();
454454
};
455455

456-
sys.addDestory(close);
456+
sys.addDestroy(close);
457457

458458
return {
459459
close() {
460-
sys.removeDestory(close);
460+
sys.removeDestroy(close);
461461
tsFileWatcher.close();
462462
},
463463
};
@@ -481,11 +481,11 @@ export function createNodeSys(c: { process?: any } = {}): CompilerSystem {
481481
const close = () => {
482482
tsFileWatcher.close();
483483
};
484-
sys.addDestory(close);
484+
sys.addDestroy(close);
485485

486486
return {
487487
close() {
488-
sys.removeDestory(close);
488+
sys.removeDestroy(close);
489489
tsFileWatcher.close();
490490
},
491491
};

0 commit comments

Comments
 (0)