@gravity-ui/app-builder 0.41.0 → 0.42.0-beta.1
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.
- package/dist/common/typescript/watch.js +15 -16
- package/package.json +1 -1
|
@@ -9,13 +9,7 @@ function watch(ts, projectPath, { logger, onAfterFilesEmitted, enableSourceMap,
|
|
|
9
9
|
logger.message(`Typescript v${ts.version}`);
|
|
10
10
|
const configPath = (0, utils_1.getTsProjectConfigPath)(ts, projectPath);
|
|
11
11
|
const createProgram = ts.createEmitAndSemanticDiagnosticsBuilderProgram;
|
|
12
|
-
const host = ts.
|
|
13
|
-
noEmit: false,
|
|
14
|
-
noEmitOnError: false,
|
|
15
|
-
inlineSourceMap: enableSourceMap,
|
|
16
|
-
inlineSources: enableSourceMap,
|
|
17
|
-
...(enableSourceMap ? { sourceMap: false } : undefined),
|
|
18
|
-
}, ts.sys, createProgram, reportDiagnostic, reportWatchStatusChanged);
|
|
12
|
+
const host = ts.createSolutionBuilderWithWatchHost(ts.sys, createProgram, reportDiagnostic, reportDiagnostic, reportWatchStatusChanged);
|
|
19
13
|
host.readFile = (0, utils_1.displayFilename)(host.readFile, 'Reading', logger);
|
|
20
14
|
(0, utils_1.onHostEvent)(host, 'createProgram', () => {
|
|
21
15
|
logger.verbose("We're about to create the program");
|
|
@@ -26,20 +20,25 @@ function watch(ts, projectPath, { logger, onAfterFilesEmitted, enableSourceMap,
|
|
|
26
20
|
const count = host.readFile.disableDisplay();
|
|
27
21
|
logger.verbose(`Program created, read ${count} files`);
|
|
28
22
|
});
|
|
29
|
-
(0, utils_1.onHostEvent)(host, '
|
|
30
|
-
logger.verbose('We finished making the program! Emitting...');
|
|
31
|
-
const transformPathsToLocalModules = (0, transformers_1.createTransformPathsToLocalModules)(ts);
|
|
32
|
-
program.emit(undefined, undefined, undefined, undefined, {
|
|
33
|
-
after: [transformPathsToLocalModules],
|
|
34
|
-
afterDeclarations: [transformPathsToLocalModules],
|
|
35
|
-
});
|
|
23
|
+
(0, utils_1.onHostEvent)(host, 'afterProgramEmitAndDiagnostics', () => {
|
|
36
24
|
logger.verbose('Emit completed!');
|
|
37
25
|
}, () => {
|
|
38
26
|
onAfterFilesEmitted?.();
|
|
39
27
|
});
|
|
40
|
-
// `
|
|
28
|
+
// `createSolutionBuilderWithWatch` creates an initial program, watches files, and updates
|
|
41
29
|
// the program over time.
|
|
42
|
-
ts.
|
|
30
|
+
const solutionBuilder = ts.createSolutionBuilderWithWatch(host, [configPath], {
|
|
31
|
+
noEmit: false,
|
|
32
|
+
noEmitOnError: false,
|
|
33
|
+
inlineSourceMap: enableSourceMap,
|
|
34
|
+
inlineSources: enableSourceMap,
|
|
35
|
+
...(enableSourceMap ? { sourceMap: false } : undefined),
|
|
36
|
+
});
|
|
37
|
+
const transformPathsToLocalModules = (0, transformers_1.createTransformPathsToLocalModules)(ts);
|
|
38
|
+
solutionBuilder.build(undefined, undefined, undefined, () => ({
|
|
39
|
+
after: [transformPathsToLocalModules],
|
|
40
|
+
afterDeclarations: [transformPathsToLocalModules],
|
|
41
|
+
}));
|
|
43
42
|
function reportDiagnostic(diagnostic) {
|
|
44
43
|
const formatHost = {
|
|
45
44
|
getCanonicalFileName: (path) => path,
|
package/package.json
CHANGED