Skip to content

Commit b733e79

Browse files
authored
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 687eb00 commit b733e79

File tree

7 files changed

+20
-20
lines changed

7 files changed

+20
-20
lines changed

src/compiler/build/watch-build.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export const createWatchBuild = async (config: d.Config, compilerCtx: d.Compiler
143143
}
144144
};
145145

146-
config.sys.addDestory(close);
146+
config.sys.addDestroy(close);
147147

148148
return {
149149
start,

src/compiler/sys/stencil-sys.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ export const createSystem = (c?: { logger?: Logger }) => {
3131
const items = new Map<string, FsItem>();
3232
const destroys = new Set<() => Promise<void> | void>();
3333

34-
const addDestory = (cb: () => void) => destroys.add(cb);
35-
const removeDestory = (cb: () => void) => destroys.delete(cb);
34+
const addDestroy = (cb: () => void) => destroys.add(cb);
35+
const removeDestroy = (cb: () => void) => destroys.delete(cb);
3636
const events = buildEvents();
3737
const hardwareConcurrency = (IS_BROWSER_ENV && navigator.hardwareConcurrency) || 1;
3838

@@ -394,7 +394,7 @@ export const createSystem = (c?: { logger?: Logger }) => {
394394
}
395395
};
396396

397-
addDestory(close);
397+
addDestroy(close);
398398

399399
if (item) {
400400
item.isDirectory = true;
@@ -414,7 +414,7 @@ export const createSystem = (c?: { logger?: Logger }) => {
414414

415415
return {
416416
close() {
417-
removeDestory(close);
417+
removeDestroy(close);
418418
close();
419419
},
420420
};
@@ -434,7 +434,7 @@ export const createSystem = (c?: { logger?: Logger }) => {
434434
}
435435
};
436436

437-
addDestory(close);
437+
addDestroy(close);
438438

439439
if (item) {
440440
item.isDirectory = false;
@@ -454,7 +454,7 @@ export const createSystem = (c?: { logger?: Logger }) => {
454454

455455
return {
456456
close() {
457-
removeDestory(close);
457+
removeDestroy(close);
458458
close();
459459
},
460460
};
@@ -573,7 +573,7 @@ export const createSystem = (c?: { logger?: Logger }) => {
573573
events,
574574
access,
575575
accessSync,
576-
addDestory,
576+
addDestroy,
577577
copyFile,
578578
createDir,
579579
createDirSync,
@@ -598,7 +598,7 @@ export const createSystem = (c?: { logger?: Logger }) => {
598598
readFileSync,
599599
realpath,
600600
realpathSync,
601-
removeDestory,
601+
removeDestroy,
602602
rename,
603603
fetch,
604604
resolvePath,

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const createSysWorker = (config: Config) => {
1111
) {
1212
const workerCtrl = config.sys.createWorkerController(config.maxConcurrentWorkers);
1313

14-
config.sys.addDestory(() => workerCtrl.destroy());
14+
config.sys.addDestroy(() => workerCtrl.destroy());
1515

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

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const createTsBuildProgram = async (
4343
},
4444
};
4545

46-
config.sys.addDestory(() => tsWatchSys.clearTimeout(timeoutId));
46+
config.sys.addDestroy(() => tsWatchSys.clearTimeout(timeoutId));
4747

4848
const tsWatchHost = ts.createWatchCompilerHost(
4949
config.tsconfig,

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const createTsWatchProgram = async (
3333
},
3434
};
3535

36-
config.sys.addDestory(() => tsWatchSys.clearTimeout(timeoutId));
36+
config.sys.addDestroy(() => tsWatchSys.clearTimeout(timeoutId));
3737

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

src/declarations/stencil-public-compiler.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ export interface CompilerSystem {
894894
/**
895895
* Add a callback which will be ran when destroy() is called.
896896
*/
897-
addDestory(cb: () => void): void;
897+
addDestroy(cb: () => void): void;
898898
/**
899899
* Always returns a boolean, does not throw.
900900
*/
@@ -1036,7 +1036,7 @@ export interface CompilerSystem {
10361036
/**
10371037
* Remove a callback which will be ran when destroy() is called.
10381038
*/
1039-
removeDestory(cb: () => void): void;
1039+
removeDestroy(cb: () => void): void;
10401040
/**
10411041
* Rename old path to new path. Does not throw.
10421042
*/

src/sys/node/node-sys.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ export function createNodeSys(c: { process?: any } = {}) {
6666
} catch (e) {}
6767
return hasAccess;
6868
},
69-
addDestory(cb) {
69+
addDestroy(cb) {
7070
destroys.add(cb);
7171
},
72-
removeDestory(cb) {
72+
removeDestroy(cb) {
7373
destroys.delete(cb);
7474
},
7575
applyPrerenderGlobalPatch(opts) {
@@ -443,11 +443,11 @@ export function createNodeSys(c: { process?: any } = {}) {
443443
tsFileWatcher.close();
444444
};
445445

446-
sys.addDestory(close);
446+
sys.addDestroy(close);
447447

448448
return {
449449
close() {
450-
sys.removeDestory(close);
450+
sys.removeDestroy(close);
451451
tsFileWatcher.close();
452452
},
453453
};
@@ -471,11 +471,11 @@ export function createNodeSys(c: { process?: any } = {}) {
471471
const close = () => {
472472
tsFileWatcher.close();
473473
};
474-
sys.addDestory(close);
474+
sys.addDestroy(close);
475475

476476
return {
477477
close() {
478-
sys.removeDestory(close);
478+
sys.removeDestroy(close);
479479
tsFileWatcher.close();
480480
},
481481
};

0 commit comments

Comments
 (0)