@nu-art/build-and-install 0.204.82 → 0.204.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,7 +13,7 @@ runner
13
13
  .then(() => {
14
14
  ts_common_1.StaticLogger.logInfo('completed');
15
15
  //TODO: make it an array of non exit params
16
- if (!params_1.RuntimeParams.launch)
16
+ if (!params_1.RuntimeParams.launch && !params_1.RuntimeParams.watch)
17
17
  process.exit(0);
18
18
  })
19
19
  .catch(err => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nu-art/build-and-install",
3
- "version": "0.204.82",
3
+ "version": "0.204.84",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "TacB0sS",
@@ -1,7 +1,7 @@
1
1
  import { FunctionKeys, ParamResolver } from '@nu-art/ts-common';
2
2
  import { Phase } from '../phase/types';
3
3
  import { BaseUnit } from '../unit/core';
4
- declare class PhaseRunnerDispatcher<T, K extends FunctionKeys<T> = FunctionKeys<T>, P extends ParamResolver<T, K> = ParamResolver<T, K>> {
4
+ export declare class PhaseRunnerDispatcher<T, K extends FunctionKeys<T> = FunctionKeys<T>, P extends ParamResolver<T, K> = ParamResolver<T, K>> {
5
5
  private readonly method;
6
6
  constructor(method: K);
7
7
  private listeners;
@@ -21,4 +21,3 @@ export interface PhaseRunner_OnUnitsChange {
21
21
  __onUnitsChange: (data: BaseUnit[]) => void;
22
22
  }
23
23
  export declare const dispatcher_UnitChange: PhaseRunnerDispatcher<PhaseRunner_OnUnitsChange, "__onUnitsChange", [data: BaseUnit<import("../unit/core").BaseUnit_Config, import("../unit/core").BaseUnit_RuntimeConfig>[]]>;
24
- export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.dispatcher_UnitChange = exports.dispatcher_UnitStatusChange = exports.dispatcher_PhaseChange = void 0;
3
+ exports.dispatcher_UnitChange = exports.dispatcher_UnitStatusChange = exports.dispatcher_PhaseChange = exports.PhaseRunnerDispatcher = void 0;
4
4
  const ts_common_1 = require("@nu-art/ts-common");
5
5
  class PhaseRunnerDispatcher {
6
6
  constructor(method) {
@@ -24,6 +24,7 @@ class PhaseRunnerDispatcher {
24
24
  });
25
25
  }
26
26
  }
27
+ exports.PhaseRunnerDispatcher = PhaseRunnerDispatcher;
27
28
  exports.dispatcher_PhaseChange = new PhaseRunnerDispatcher('__onPhaseChange');
28
29
  exports.dispatcher_UnitStatusChange = new PhaseRunnerDispatcher('__onUnitStatusChange');
29
30
  exports.dispatcher_UnitChange = new PhaseRunnerDispatcher('__onUnitsChange');
@@ -0,0 +1,6 @@
1
+ import { WatchEventType } from './types';
2
+ export declare const WatchEvent_Add: WatchEventType;
3
+ export declare const WatchEvent_Update: WatchEventType;
4
+ export declare const WatchEvent_RemoveDir: WatchEventType;
5
+ export declare const WatchEvent_RemoveFile: WatchEventType;
6
+ export declare const WatchEvent_Ready: WatchEventType;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WatchEvent_Ready = exports.WatchEvent_RemoveFile = exports.WatchEvent_RemoveDir = exports.WatchEvent_Update = exports.WatchEvent_Add = void 0;
4
+ exports.WatchEvent_Add = 'add';
5
+ exports.WatchEvent_Update = 'update';
6
+ exports.WatchEvent_RemoveDir = 'remove_dir';
7
+ exports.WatchEvent_RemoveFile = 'remove_file';
8
+ exports.WatchEvent_Ready = 'ready';
@@ -1,6 +1,7 @@
1
1
  import { Unit_Typescript, Unit_Typescript_Config, Unit_Typescript_RuntimeConfig } from './Unit_Typescript';
2
- import { UnitPhaseImplementor } from '../types';
2
+ import { UnitPhaseImplementor, WatchEventType } from '../types';
3
3
  import { Phase_CheckCyclicImports, Phase_Compile, Phase_Lint, Phase_PreCompile, Phase_PrintDependencyTree, Phase_Purge } from '../../phase';
4
+ import { OnWatchEvent } from '../runner-dispatchers';
4
5
  export type Unit_TypescriptLib_Config = Unit_Typescript_Config & {
5
6
  customTSConfig?: boolean;
6
7
  output: string;
@@ -18,14 +19,23 @@ export declare class Unit_TypescriptLib<C extends Unit_TypescriptLib_Config = Un
18
19
  Phase_CheckCyclicImports,
19
20
  Phase_Purge,
20
21
  Phase_Lint
21
- ]> {
22
+ ]>, OnWatchEvent {
23
+ private compilationError;
22
24
  constructor(config: Unit_TypescriptLib<C, RTC>['config']);
25
+ __onWatchEvent(type: WatchEventType, path?: string): Promise<void>;
23
26
  protected init(setInitialized?: boolean): Promise<void>;
24
27
  protected resolveTSConfig(): Promise<void>;
25
28
  protected clearOutputDir(): Promise<void>;
26
29
  protected compileImpl(): Promise<void>;
27
30
  protected copyAssetsToOutput(): Promise<void>;
28
31
  protected copyPackageJSONToOutput(): Promise<void>;
32
+ protected handleWatchChange(path: string, shouldRemoveDist?: boolean): Promise<void>;
33
+ /**
34
+ * Remove the deleted file/folder from the dist folder on watch remove file event
35
+ * @param path The path of the currently removed file/folder
36
+ * @private
37
+ */
38
+ private removeSpecificFileFromDist;
29
39
  preCompile(): Promise<void>;
30
40
  compile(): Promise<void>;
31
41
  purge(): Promise<void>;
@@ -34,6 +34,8 @@ const RunnerParams_1 = require("../../phase-runner/RunnerParams");
34
34
  const cli_1 = require("@nu-art/commando/core/cli");
35
35
  const consts_1 = require("../../../core/consts");
36
36
  const params_1 = require("../../../core/params/params");
37
+ const runner_dispatchers_1 = require("../runner-dispatchers");
38
+ const consts_2 = require("../consts");
37
39
  const extensionsToLint = ['.ts', '.tsx'];
38
40
  const assetExtensions = [
39
41
  'json',
@@ -48,7 +50,14 @@ const assetExtensions = [
48
50
  class Unit_TypescriptLib extends Unit_Typescript_1.Unit_Typescript {
49
51
  constructor(config) {
50
52
  super(config);
53
+ this.compilationError = false;
51
54
  this.addToClassStack(Unit_TypescriptLib);
55
+ runner_dispatchers_1.dispatcher_WatchEvent.addListener(this);
56
+ }
57
+ async __onWatchEvent(type, path) {
58
+ if (type === consts_2.WatchEvent_Ready)
59
+ return this.setStatus('Watching');
60
+ await this.handleWatchChange(path, [consts_2.WatchEvent_RemoveFile, consts_2.WatchEvent_RemoveDir].includes(type));
52
61
  }
53
62
  async init(setInitialized = true) {
54
63
  await super.init(false);
@@ -90,12 +99,25 @@ class Unit_TypescriptLib extends Unit_Typescript_1.Unit_Typescript {
90
99
  async compileImpl() {
91
100
  const pathToCompile = `${this.runtime.pathTo.pkg}/src/main`;
92
101
  const pathToTSConfig = `${pathToCompile}/tsconfig.json`;
93
- await nvm_1.NVM
94
- .createCommando(basic_1.Cli_Basic)
95
- .setUID(this.config.key)
96
- .cd(this.runtime.pathTo.pkg)
97
- .append(`tsc -p "${pathToTSConfig}" --rootDir "${pathToCompile}" --outDir "${this.runtime.pathTo.output}"`)
98
- .execute();
102
+ try {
103
+ await nvm_1.NVM
104
+ .createCommando(basic_1.Cli_Basic)
105
+ .setUID(this.config.key)
106
+ .cd(this.runtime.pathTo.pkg)
107
+ .append(`tsc -p "${pathToTSConfig}" --rootDir "${pathToCompile}" --outDir "${this.runtime.pathTo.output}"`)
108
+ .execute();
109
+ // set compilation error status on success
110
+ this.compilationError = false;
111
+ }
112
+ catch (e) {
113
+ //In order to finish compile when running watch we just log the error instead of throwing it
114
+ if (params_1.RuntimeParams.watch) {
115
+ // set compilation error status on error
116
+ this.compilationError = true;
117
+ return this.logError(e);
118
+ }
119
+ throw e;
120
+ }
99
121
  }
100
122
  async copyAssetsToOutput() {
101
123
  const command = `find . \\( -name ${assetExtensions.map(suffix => `'*.${suffix}'`).join(' -o -name ')} \\) | cpio -pdmuv "${this.runtime.pathTo.output}" > /dev/null 2>&1`;
@@ -113,6 +135,43 @@ class Unit_TypescriptLib extends Unit_Typescript_1.Unit_Typescript {
113
135
  const fileContent = JSON.stringify(this.packageJson.dist, null, 2);
114
136
  await fs_1.promises.writeFile(targetPath, fileContent, { encoding: 'utf-8' });
115
137
  }
138
+ async handleWatchChange(path, shouldRemoveDist = false) {
139
+ // ignore if path doesn't related to unit
140
+ if (!path.startsWith(this.config.pathToPackage))
141
+ return;
142
+ this.setStatus('Compile');
143
+ // check if dist folder must be cleared
144
+ if (shouldRemoveDist)
145
+ await this.removeSpecificFileFromDist(path);
146
+ // perform all watch actions
147
+ await this.compileImpl();
148
+ await this.copyAssetsToOutput();
149
+ this.setStatus(`Watching${this.compilationError ? ' with error' : ''}`);
150
+ // dispatch unit post compile
151
+ runner_dispatchers_1.dispatcher_UnitWatchCompile.dispatch(this);
152
+ }
153
+ /**
154
+ * Remove the deleted file/folder from the dist folder on watch remove file event
155
+ * @param path The path of the currently removed file/folder
156
+ * @private
157
+ */
158
+ async removeSpecificFileFromDist(path) {
159
+ const distPathBase = path.replace('src/main', 'dist').replace(/\.ts$/, '');
160
+ const pathsToDelete = [
161
+ `${distPathBase}.js`,
162
+ `${distPathBase}.d.ts`,
163
+ `${distPathBase}.js.map`,
164
+ distPathBase // in case it's a directory
165
+ ];
166
+ // try to remove all path options from dist
167
+ for (const path of pathsToDelete) {
168
+ if (!fs.existsSync(path)) {
169
+ this.logDebug(`no file in path ${path}`);
170
+ continue;
171
+ }
172
+ await fs_1.promises.rm(path, { recursive: true, force: true });
173
+ }
174
+ }
116
175
  //######################### Phase Implementations #########################
117
176
  async preCompile() {
118
177
  if (!fs.existsSync(`${this.config.pathToPackage}/prebuild.sh`))
@@ -130,7 +189,7 @@ class Unit_TypescriptLib extends Unit_Typescript_1.Unit_Typescript {
130
189
  await this.compileImpl();
131
190
  await this.copyAssetsToOutput();
132
191
  await this.copyPackageJSONToOutput();
133
- this.setStatus('Compiled');
192
+ this.setStatus(`Compiled${this.compilationError ? ' with error' : ''}`);
134
193
  }
135
194
  async purge() {
136
195
  await fs_1.promises.rm(this.runtime.pathTo.output, { recursive: true, force: true });
@@ -1,15 +1,29 @@
1
1
  import { UnitPhaseImplementor } from '../types';
2
2
  import { Unit_Typescript, Unit_Typescript_Config, Unit_Typescript_RuntimeConfig } from './Unit_Typescript';
3
- import { Phase_Install } from '../../phase';
3
+ import { Phase_Install, Phase_Watch } from '../../phase';
4
4
  import { StringMap } from '@nu-art/ts-common/utils/types';
5
5
  type Unit_TypescriptProject_Config = Unit_Typescript_Config & {
6
6
  globalPackages?: StringMap;
7
7
  };
8
8
  type Unit_TypescriptProject_RuntimeConfig = Unit_Typescript_RuntimeConfig & {};
9
- export declare class Unit_TypescriptProject<C extends Unit_TypescriptProject_Config = Unit_TypescriptProject_Config, RTC extends Unit_TypescriptProject_RuntimeConfig = Unit_TypescriptProject_RuntimeConfig> extends Unit_Typescript<C, RTC> implements UnitPhaseImplementor<[Phase_Install]> {
9
+ export declare class Unit_TypescriptProject<C extends Unit_TypescriptProject_Config = Unit_TypescriptProject_Config, RTC extends Unit_TypescriptProject_RuntimeConfig = Unit_TypescriptProject_RuntimeConfig> extends Unit_Typescript<C, RTC> implements UnitPhaseImplementor<[Phase_Install, Phase_Watch]> {
10
+ private readonly suffixesToWatch;
10
11
  constructor(config: Unit_TypescriptProject<C>['config']);
11
12
  private installGlobals;
12
13
  private installPackages;
14
+ /**
15
+ * Resolve all paths to watch in all project libs
16
+ * @private
17
+ * @returns string[]
18
+ */
19
+ private prepareWatchPaths;
20
+ /**
21
+ * Init watch events and attach default watch callback with correct params to each of them
22
+ * @private
23
+ */
24
+ private initWatch;
25
+ private watchImpl;
13
26
  install(): Promise<void>;
27
+ watch(): Promise<void>;
14
28
  }
15
29
  export {};
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.Unit_TypescriptProject = void 0;
4
27
  const Unit_Typescript_1 = require("./Unit_Typescript");
@@ -7,9 +30,21 @@ const ts_common_1 = require("@nu-art/ts-common");
7
30
  const nvm_1 = require("@nu-art/commando/cli/nvm");
8
31
  const pnpm_1 = require("@nu-art/commando/cli/pnpm");
9
32
  const consts_1 = require("../../phase-runner/consts");
33
+ const chokidar = __importStar(require("chokidar"));
34
+ const runner_dispatchers_1 = require("../runner-dispatchers");
35
+ const consts_2 = require("../consts");
36
+ const Unit_TypescriptLib_1 = require("./Unit_TypescriptLib");
37
+ const firebase_units_1 = require("../firebase-units");
10
38
  class Unit_TypescriptProject extends Unit_Typescript_1.Unit_Typescript {
11
39
  constructor(config) {
12
40
  super(config);
41
+ this.suffixesToWatch = [
42
+ 'ts',
43
+ 'tsx',
44
+ 'scss',
45
+ 'json',
46
+ 'svg'
47
+ ];
13
48
  this.addToClassStack(Unit_TypescriptProject);
14
49
  }
15
50
  //######################### Internal Logic #########################
@@ -33,10 +68,71 @@ class Unit_TypescriptProject extends Unit_Typescript_1.Unit_Typescript {
33
68
  await pnpm_1.PNPM.createWorkspace(packages);
34
69
  await pnpm_1.PNPM.installPackages(nvm_1.NVM.createCommando());
35
70
  }
71
+ /**
72
+ * Resolve all paths to watch in all project libs
73
+ * @private
74
+ * @returns string[]
75
+ */
76
+ prepareWatchPaths() {
77
+ // Using phase runner instance to resolve all project libs to watch
78
+ const cantBeInstanceOf = [firebase_units_1.Unit_FirebaseHostingApp, firebase_units_1.Unit_FirebaseFunctionsApp];
79
+ const projectLibs = consts_1.MemKey_PhaseRunner.get()
80
+ .getUnits().filter(unit => unit.isInstanceOf(Unit_TypescriptLib_1.Unit_TypescriptLib) && cantBeInstanceOf.every(_instance => !unit.isInstanceOf(_instance)));
81
+ //return all paths to watch
82
+ return projectLibs.map(lib => {
83
+ const sourceFolder = `${lib.config.pathToPackage}/src/main`;
84
+ return { paths: this.suffixesToWatch.map(suffix => `${sourceFolder}/**/*.${suffix}`), unit: lib };
85
+ });
86
+ }
87
+ /**
88
+ * Init watch events and attach default watch callback with correct params to each of them
89
+ * @private
90
+ */
91
+ initWatch() {
92
+ const pathDeclarations = this.prepareWatchPaths();
93
+ const paths = pathDeclarations.flatMap(path => path.paths);
94
+ const watcher = chokidar.watch(paths);
95
+ // set all events to watch and handle them
96
+ return new Promise((resolve, error) => {
97
+ this.logInfo('Starting the watcher...');
98
+ watcher
99
+ .on('error', (error) => {
100
+ this.logError('Error while watching', error);
101
+ })
102
+ .on('ready', () => {
103
+ this.logInfo('Watching...');
104
+ runner_dispatchers_1.dispatcher_WatchEvent.dispatch(consts_2.WatchEvent_Ready);
105
+ watcher
106
+ .on('add', (path) => {
107
+ runner_dispatchers_1.dispatcher_WatchEvent.dispatch(consts_2.WatchEvent_Add, path);
108
+ })
109
+ .on('change', (path) => {
110
+ runner_dispatchers_1.dispatcher_WatchEvent.dispatch(consts_2.WatchEvent_Update, path);
111
+ })
112
+ .on('unlinkDir', (path) => {
113
+ runner_dispatchers_1.dispatcher_WatchEvent.dispatch(consts_2.WatchEvent_RemoveDir, path);
114
+ })
115
+ .on('unlink', (path) => {
116
+ runner_dispatchers_1.dispatcher_WatchEvent.dispatch(consts_2.WatchEvent_RemoveFile, path);
117
+ });
118
+ });
119
+ process.on('SIGINT', async (status) => {
120
+ await watcher.close();
121
+ process.exit(0);
122
+ resolve();
123
+ });
124
+ });
125
+ }
126
+ async watchImpl() {
127
+ await this.initWatch();
128
+ }
36
129
  //######################### Phase Implementation #########################
37
130
  async install() {
38
131
  await this.installGlobals();
39
132
  await this.installPackages();
40
133
  }
134
+ async watch() {
135
+ await this.watchImpl();
136
+ }
41
137
  }
42
138
  exports.Unit_TypescriptProject = Unit_TypescriptProject;
@@ -1,12 +1,13 @@
1
- import { Unit_TypescriptLib, Unit_TypescriptLib_Config } from '../core';
1
+ import { BaseUnit, Unit_TypescriptLib, Unit_TypescriptLib_Config } from '../core';
2
2
  import { UnitPhaseImplementor } from '../types';
3
3
  import { Phase_DeployBackend, Phase_Launch, Phase_ResolveConfigs } from '../../phase';
4
4
  import { FirebasePackageConfig } from '../../../core/types';
5
+ import { OnUnitWatchCompiled } from '../runner-dispatchers';
5
6
  export type Unit_FirebaseFunctionsApp_Config = Unit_TypescriptLib_Config & {
6
7
  firebaseConfig: FirebasePackageConfig;
7
8
  sources?: string[];
8
9
  };
9
- export declare class Unit_FirebaseFunctionsApp<C extends Unit_FirebaseFunctionsApp_Config = Unit_FirebaseFunctionsApp_Config> extends Unit_TypescriptLib<C> implements UnitPhaseImplementor<[Phase_ResolveConfigs, Phase_Launch, Phase_DeployBackend]> {
10
+ export declare class Unit_FirebaseFunctionsApp<C extends Unit_FirebaseFunctionsApp_Config = Unit_FirebaseFunctionsApp_Config> extends Unit_TypescriptLib<C> implements UnitPhaseImplementor<[Phase_ResolveConfigs, Phase_Launch, Phase_DeployBackend]>, OnUnitWatchCompiled {
10
11
  static staggerCount: number;
11
12
  private readonly PROXY_PID_LOG;
12
13
  private readonly PROXY_KILL_LOG;
@@ -14,6 +15,7 @@ export declare class Unit_FirebaseFunctionsApp<C extends Unit_FirebaseFunctionsA
14
15
  private readonly EMULATOR_KILL_LOG;
15
16
  private launchCommandos;
16
17
  private listeners;
18
+ __onUnitWatchCompiled(unit: BaseUnit): Promise<void>;
17
19
  constructor(config: Unit_FirebaseFunctionsApp<C>['config']);
18
20
  resolveConfigs(): Promise<void>;
19
21
  compile(): Promise<void>;
@@ -12,8 +12,18 @@ const cli_1 = require("@nu-art/commando/core/cli");
12
12
  const basic_1 = require("@nu-art/commando/cli/basic");
13
13
  const nvm_1 = require("@nu-art/commando/cli/nvm");
14
14
  const consts_3 = require("../../phase-runner/consts");
15
+ const runner_dispatchers_1 = require("../runner-dispatchers");
15
16
  const CONST_VersionApp = 'version-app.json';
16
17
  class Unit_FirebaseFunctionsApp extends core_1.Unit_TypescriptLib {
18
+ async __onUnitWatchCompiled(unit) {
19
+ if (this.runtime.unitDependencyNames.includes(unit.runtime.dependencyName)) {
20
+ this.setStatus('Compile');
21
+ await this.compileImpl();
22
+ await this.copyAssetsToOutput();
23
+ await this.createDependenciesDir();
24
+ this.setStatus('Compiled');
25
+ }
26
+ }
17
27
  constructor(config) {
18
28
  super(config);
19
29
  this.PROXY_PID_LOG = '_PROXY_PID_';
@@ -21,6 +31,8 @@ class Unit_FirebaseFunctionsApp extends core_1.Unit_TypescriptLib {
21
31
  this.EMULATOR_PID_LOG = '_EMULATOR_PID_';
22
32
  this.EMULATOR_KILL_LOG = '_EMULATOR_KILLED_';
23
33
  this.addToClassStack(Unit_FirebaseFunctionsApp);
34
+ runner_dispatchers_1.dispatcher_WatchEvent.removeListener(this);
35
+ runner_dispatchers_1.dispatcher_UnitWatchCompile.addListener(this);
24
36
  }
25
37
  //######################### Phase Implementations #########################
26
38
  async resolveConfigs() {
@@ -11,6 +11,7 @@ const nvm_1 = require("@nu-art/commando/cli/nvm");
11
11
  const basic_1 = require("@nu-art/commando/cli/basic");
12
12
  const RunnerParams_1 = require("../../phase-runner/RunnerParams");
13
13
  const cli_1 = require("@nu-art/commando/core/cli");
14
+ const runner_dispatchers_1 = require("../runner-dispatchers");
14
15
  const CONST_VersionApp = 'version-app.json';
15
16
  class Unit_FirebaseHostingApp extends core_1.Unit_TypescriptLib {
16
17
  constructor(config) {
@@ -18,6 +19,7 @@ class Unit_FirebaseHostingApp extends core_1.Unit_TypescriptLib {
18
19
  this.APP_PID_LOG = '_APP_PID_';
19
20
  this.APP_KILL_LOG = '_APP_KILLED_';
20
21
  this.addToClassStack(Unit_FirebaseHostingApp);
22
+ runner_dispatchers_1.dispatcher_WatchEvent.removeListener(this);
21
23
  }
22
24
  //######################### Phase Implementations #########################
23
25
  async resolveConfigs() {
@@ -0,0 +1,11 @@
1
+ import { PhaseRunnerDispatcher } from '../phase-runner/PhaseRunnerDispatcher';
2
+ import { WatchEventType } from './types';
3
+ import { BaseUnit } from './core';
4
+ export interface OnWatchEvent {
5
+ __onWatchEvent: (type: WatchEventType, path?: string) => void;
6
+ }
7
+ export declare const dispatcher_WatchEvent: PhaseRunnerDispatcher<OnWatchEvent, "__onWatchEvent", [type: WatchEventType, path?: string | undefined]>;
8
+ export interface OnUnitWatchCompiled {
9
+ __onUnitWatchCompiled: (init: BaseUnit) => void;
10
+ }
11
+ export declare const dispatcher_UnitWatchCompile: PhaseRunnerDispatcher<OnUnitWatchCompiled, "__onUnitWatchCompiled", [init: BaseUnit<import("./core").BaseUnit_Config, import("./core").BaseUnit_RuntimeConfig>]>;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dispatcher_UnitWatchCompile = exports.dispatcher_WatchEvent = void 0;
4
+ const PhaseRunnerDispatcher_1 = require("../phase-runner/PhaseRunnerDispatcher");
5
+ exports.dispatcher_WatchEvent = new PhaseRunnerDispatcher_1.PhaseRunnerDispatcher('__onWatchEvent');
6
+ exports.dispatcher_UnitWatchCompile = new PhaseRunnerDispatcher_1.PhaseRunnerDispatcher('__onUnitWatchCompiled');
@@ -5,3 +5,4 @@ export type Unit<P extends Phase<string>[]> = BaseUnit & UnitPhaseImplementor<P>
5
5
  export type UnitPhaseImplementor<P extends Phase<string>[]> = {
6
6
  [K in P[number]['method']]: AsyncVoidFunction;
7
7
  };
8
+ export type WatchEventType = 'update' | 'add' | 'remove_file' | 'remove_dir' | 'ready';