@gravity-ui/app-builder 0.42.0-beta.1 → 0.42.0-beta.2

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.
@@ -10,5 +10,5 @@ export declare function displayFilename(originalFunc: (path: string, encoding?:
10
10
  };
11
11
  export declare function onHostEvent<F extends string, T extends {
12
12
  [key in F]?: (...args: any[]) => any;
13
- }>(host: T, functionName: F, before?: (...args: Parameters<NonNullable<T[F]>>) => void, after?: (res: ReturnType<NonNullable<T[F]>>) => void): void;
13
+ }>(host: T, functionName: F, before?: (...args: Parameters<NonNullable<T[F]>>) => void, after?: (res: ReturnType<NonNullable<T[F]>>, ...args: Parameters<NonNullable<T[F]>>) => void): void;
14
14
  export declare function resolveTypescript(): string;
@@ -74,7 +74,7 @@ function onHostEvent(host, functionName, before, after) {
74
74
  result = originalFunction(...args);
75
75
  }
76
76
  if (after) {
77
- after(result);
77
+ after(result, ...args);
78
78
  }
79
79
  return result;
80
80
  });
@@ -10,20 +10,23 @@ function watch(ts, projectPath, { logger, onAfterFilesEmitted, enableSourceMap,
10
10
  const configPath = (0, utils_1.getTsProjectConfigPath)(ts, projectPath);
11
11
  const createProgram = ts.createEmitAndSemanticDiagnosticsBuilderProgram;
12
12
  const host = ts.createSolutionBuilderWithWatchHost(ts.sys, createProgram, reportDiagnostic, reportDiagnostic, reportWatchStatusChanged);
13
- host.readFile = (0, utils_1.displayFilename)(host.readFile, 'Reading', logger);
14
- (0, utils_1.onHostEvent)(host, 'createProgram', () => {
13
+ (0, utils_1.onHostEvent)(host, 'createProgram', (_rootnames, _options, host) => {
15
14
  logger.verbose("We're about to create the program");
16
- // @ts-expect-error
17
- host.readFile.enableDisplay();
18
- }, () => {
19
- // @ts-expect-error
20
- const count = host.readFile.disableDisplay();
21
- logger.verbose(`Program created, read ${count} files`);
15
+ if (host) {
16
+ host.readFile = (0, utils_1.displayFilename)(host.readFile, 'Reading', logger);
17
+ // @ts-expect-error
18
+ host.readFile.enableDisplay();
19
+ }
20
+ }, (_result, _rootnames, _options, host) => {
21
+ if (host) {
22
+ // @ts-expect-error
23
+ const count = host.readFile.disableDisplay();
24
+ logger.verbose(`Program created, read ${count} files`);
25
+ }
22
26
  });
23
- (0, utils_1.onHostEvent)(host, 'afterProgramEmitAndDiagnostics', () => {
24
- logger.verbose('Emit completed!');
25
- }, () => {
26
- onAfterFilesEmitted?.();
27
+ (0, utils_1.onHostEvent)(host, 'afterProgramEmitAndDiagnostics', (program) => {
28
+ const project = program.getCompilerOptions().project;
29
+ logger.verbose(`Emit completed for ${project}!`);
27
30
  });
28
31
  // `createSolutionBuilderWithWatch` creates an initial program, watches files, and updates
29
32
  // the program over time.
@@ -60,5 +63,8 @@ function watch(ts, projectPath, { logger, onAfterFilesEmitted, enableSourceMap,
60
63
  if (diagnostic.messageText) {
61
64
  logger.message(ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine));
62
65
  }
66
+ if (diagnostic.code === 6194 || diagnostic.code === 6193) {
67
+ onAfterFilesEmitted?.();
68
+ }
63
69
  }
64
70
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/app-builder",
3
- "version": "0.42.0-beta.1",
3
+ "version": "0.42.0-beta.2",
4
4
  "description": "Develop and build your React client-server projects, powered by typescript and webpack",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",