@nrwl/workspace 12.10.0 → 13.0.0-beta.4
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/index.d.ts +1 -1
- package/index.js +2 -3
- package/index.js.map +1 -1
- package/migrations.json +6 -0
- package/package.json +5 -5
- package/src/command-line/dep-graph.js +17 -21
- package/src/command-line/dep-graph.js.map +1 -1
- package/src/command-line/examples.js +38 -38
- package/src/command-line/examples.js.map +1 -1
- package/src/command-line/lint.js +5 -4
- package/src/command-line/lint.js.map +1 -1
- package/src/command-line/nx-commands.js +26 -3
- package/src/command-line/nx-commands.js.map +1 -1
- package/src/command-line/supported-nx-commands.js +1 -0
- package/src/command-line/supported-nx-commands.js.map +1 -1
- package/src/command-line/utils.js +1 -1
- package/src/command-line/utils.js.map +1 -1
- package/src/core/dep-graph/main.es5.js +1 -1
- package/src/core/dep-graph/main.esm.js +1 -1
- package/src/core/dep-graph/polyfills.es5.js +1 -1
- package/src/core/dep-graph/polyfills.esm.js +1 -1
- package/src/core/dep-graph/runtime.es5.js +1 -1
- package/src/core/dep-graph/runtime.esm.js +1 -1
- package/src/core/file-utils.d.ts +11 -4
- package/src/core/file-utils.js +103 -15
- package/src/core/file-utils.js.map +1 -1
- package/src/core/hasher/file-hasher.d.ts +1 -16
- package/src/core/hasher/file-hasher.js +4 -20
- package/src/core/hasher/file-hasher.js.map +1 -1
- package/src/core/nx-deps/nx-deps-cache.d.ts +6 -6
- package/src/core/nx-deps/nx-deps-cache.js +9 -5
- package/src/core/nx-deps/nx-deps-cache.js.map +1 -1
- package/src/core/project-graph/build-dependencies/build-explicit-typescript-and-package-json-dependencies.d.ts +2 -0
- package/src/core/project-graph/build-dependencies/build-explicit-typescript-and-package-json-dependencies.js +12 -0
- package/src/core/project-graph/build-dependencies/build-explicit-typescript-and-package-json-dependencies.js.map +1 -0
- package/src/core/project-graph/build-dependencies/explicit-package-json-dependencies.d.ts +3 -2
- package/src/core/project-graph/build-dependencies/explicit-package-json-dependencies.js +14 -8
- package/src/core/project-graph/build-dependencies/explicit-package-json-dependencies.js.map +1 -1
- package/src/core/project-graph/build-dependencies/explicit-project-dependencies.d.ts +3 -2
- package/src/core/project-graph/build-dependencies/explicit-project-dependencies.js +12 -6
- package/src/core/project-graph/build-dependencies/explicit-project-dependencies.js.map +1 -1
- package/src/core/project-graph/build-project-graph.d.ts +7 -0
- package/src/core/project-graph/build-project-graph.js +221 -0
- package/src/core/project-graph/build-project-graph.js.map +1 -0
- package/src/core/project-graph/daemon/cache.d.ts +5 -13
- package/src/core/project-graph/daemon/cache.js +39 -16
- package/src/core/project-graph/daemon/cache.js.map +1 -1
- package/src/core/project-graph/daemon/client/client.js +31 -57
- package/src/core/project-graph/daemon/client/client.js.map +1 -1
- package/src/core/project-graph/daemon/client/exec-is-server-available.d.ts +1 -0
- package/src/core/project-graph/daemon/client/exec-is-server-available.js +13 -0
- package/src/core/project-graph/daemon/client/exec-is-server-available.js.map +1 -0
- package/src/core/project-graph/daemon/client/generate-help-output.d.ts +1 -0
- package/src/core/project-graph/daemon/client/generate-help-output.js +28 -0
- package/src/core/project-graph/daemon/client/generate-help-output.js.map +1 -0
- package/src/core/project-graph/daemon/server/logger.d.ts +19 -0
- package/src/core/project-graph/daemon/server/logger.js +41 -0
- package/src/core/project-graph/daemon/server/logger.js.map +1 -0
- package/src/core/project-graph/daemon/server/project-graph-incremental-recomputation.d.ts +6 -0
- package/src/core/project-graph/daemon/server/project-graph-incremental-recomputation.js +119 -0
- package/src/core/project-graph/daemon/server/project-graph-incremental-recomputation.js.map +1 -0
- package/src/core/project-graph/daemon/server/server.d.ts +1 -5
- package/src/core/project-graph/daemon/server/server.js +97 -184
- package/src/core/project-graph/daemon/server/server.js.map +1 -1
- package/src/core/project-graph/daemon/server/shutdown-utils.d.ts +13 -0
- package/src/core/project-graph/daemon/server/shutdown-utils.js +28 -0
- package/src/core/project-graph/daemon/server/shutdown-utils.js.map +1 -0
- package/src/core/project-graph/daemon/server/start.js +1 -8
- package/src/core/project-graph/daemon/server/start.js.map +1 -1
- package/src/core/project-graph/daemon/server/stop.js +1 -11
- package/src/core/project-graph/daemon/server/stop.js.map +1 -1
- package/src/core/project-graph/daemon/server/watcher.d.ts +1 -1
- package/src/core/project-graph/daemon/server/watcher.js +1 -1
- package/src/core/project-graph/daemon/socket-utils.d.ts +13 -0
- package/src/core/project-graph/daemon/socket-utils.js +39 -10
- package/src/core/project-graph/daemon/socket-utils.js.map +1 -1
- package/src/core/project-graph/daemon/tmp-dir.d.ts +7 -0
- package/src/core/project-graph/daemon/tmp-dir.js +59 -0
- package/src/core/project-graph/daemon/tmp-dir.js.map +1 -0
- package/src/core/project-graph/index.d.ts +1 -1
- package/src/core/project-graph/index.js +1 -3
- package/src/core/project-graph/index.js.map +1 -1
- package/src/core/project-graph/project-graph-worker.d.ts +1 -0
- package/src/core/project-graph/project-graph-worker.js +17 -0
- package/src/core/project-graph/project-graph-worker.js.map +1 -0
- package/src/core/project-graph/project-graph.d.ts +1 -30
- package/src/core/project-graph/project-graph.js +5 -195
- package/src/core/project-graph/project-graph.js.map +1 -1
- package/src/generators/init/init.js +27 -27
- package/src/generators/init/init.js.map +1 -1
- package/src/generators/new/new.js +1 -1
- package/src/generators/new/new.js.map +1 -1
- package/src/migrations/update-10-0-0/update-10-0-0.js +1 -1
- package/src/migrations/update-10-0-0/update-10-0-0.js.map +1 -1
- package/src/migrations/update-13-0-0/set-default-base-if-not-set.d.ts +3 -0
- package/src/migrations/update-13-0-0/set-default-base-if-not-set.js +30 -0
- package/src/migrations/update-13-0-0/set-default-base-if-not-set.js.map +1 -0
- package/src/utilities/default-base.js +2 -2
- package/src/utilities/default-base.js.map +1 -1
- package/src/utilities/run-webpack.d.ts +3 -2
- package/src/utilities/run-webpack.js +18 -34
- package/src/utilities/run-webpack.js.map +1 -1
- package/src/utils/ast-utils.d.ts +1 -10
- package/src/utils/ast-utils.js +1 -19
- package/src/utils/ast-utils.js.map +1 -1
- package/src/utils/testing-utils.js +1 -1
- package/src/utils/testing-utils.js.map +1 -1
- package/src/utils/versions.js +1 -1
- package/src/core/file-graph/index.d.ts +0 -1
- package/src/core/file-graph/index.js +0 -5
- package/src/core/file-graph/index.js.map +0 -1
- package/src/core/file-graph/project-file-map.d.ts +0 -3
- package/src/core/file-graph/project-file-map.js +0 -35
- package/src/core/file-graph/project-file-map.js.map +0 -1
- package/src/utilities/create-project-graph-from-tree.d.ts +0 -5
- package/src/utilities/create-project-graph-from-tree.js +0 -13
- package/src/utilities/create-project-graph-from-tree.js.map +0 -1
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildProjectGraphUsingProjectFileMap = exports.buildProjectGraph = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
6
|
+
const app_root_1 = require("@nrwl/tao/src/utils/app-root");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
const perf_hooks_1 = require("perf_hooks");
|
|
9
|
+
const assert_workspace_validity_1 = require("../assert-workspace-validity");
|
|
10
|
+
const file_utils_1 = require("../file-utils");
|
|
11
|
+
const normalize_nx_json_1 = require("../normalize-nx-json");
|
|
12
|
+
const nx_deps_cache_1 = require("../nx-deps/nx-deps-cache");
|
|
13
|
+
const build_dependencies_1 = require("./build-dependencies");
|
|
14
|
+
const build_nodes_1 = require("./build-nodes");
|
|
15
|
+
const fs_1 = require("fs");
|
|
16
|
+
const os = require("os");
|
|
17
|
+
const build_explicit_typescript_and_package_json_dependencies_1 = require("./build-dependencies/build-explicit-typescript-and-package-json-dependencies");
|
|
18
|
+
function buildProjectGraph(projectGraphVersion = '4.0') {
|
|
19
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const workspaceJson = file_utils_1.readWorkspaceJson();
|
|
21
|
+
const { projectFileMap, allWorkspaceFiles } = file_utils_1.createProjectFileMap(workspaceJson);
|
|
22
|
+
const cacheEnabled = process.env.NX_CACHE_PROJECT_GRAPH !== 'false';
|
|
23
|
+
let cache = cacheEnabled ? nx_deps_cache_1.readCache() : null;
|
|
24
|
+
return (yield buildProjectGraphUsingProjectFileMap(workspaceJson, projectFileMap, allWorkspaceFiles, cache, cacheEnabled, projectGraphVersion)).projectGraph;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
exports.buildProjectGraph = buildProjectGraph;
|
|
28
|
+
function buildProjectGraphUsingProjectFileMap(workspaceJson, projectFileMap, allWorkspaceFiles, cache, shouldWriteCache, projectGraphVersion) {
|
|
29
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
const nxJson = file_utils_1.readNxJson();
|
|
31
|
+
assert_workspace_validity_1.assertWorkspaceValidity(workspaceJson, nxJson);
|
|
32
|
+
const normalizedNxJson = normalize_nx_json_1.normalizeNxJson(nxJson);
|
|
33
|
+
const packageJsonDeps = readCombinedDeps();
|
|
34
|
+
const rootTsConfig = readRootTsConfig();
|
|
35
|
+
let filesToProcess = projectFileMap;
|
|
36
|
+
let cachedFileData = {};
|
|
37
|
+
if (cache &&
|
|
38
|
+
!nx_deps_cache_1.shouldRecomputeWholeGraph(cache, packageJsonDeps, workspaceJson, normalizedNxJson, rootTsConfig)) {
|
|
39
|
+
const fromCache = nx_deps_cache_1.extractCachedFileData(projectFileMap, cache);
|
|
40
|
+
filesToProcess = fromCache.filesToProcess;
|
|
41
|
+
cachedFileData = fromCache.cachedFileData;
|
|
42
|
+
}
|
|
43
|
+
const context = createContext(workspaceJson, normalizedNxJson, projectFileMap, filesToProcess);
|
|
44
|
+
let projectGraph = yield buildProjectGraphUsingContext(context, cachedFileData, projectGraphVersion);
|
|
45
|
+
const projectGraphCache = nx_deps_cache_1.createCache(nxJson, packageJsonDeps, projectGraph, rootTsConfig);
|
|
46
|
+
if (shouldWriteCache) {
|
|
47
|
+
nx_deps_cache_1.writeCache(projectGraphCache);
|
|
48
|
+
}
|
|
49
|
+
projectGraph.allWorkspaceFiles = allWorkspaceFiles;
|
|
50
|
+
return {
|
|
51
|
+
projectGraph,
|
|
52
|
+
projectGraphCache,
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
exports.buildProjectGraphUsingProjectFileMap = buildProjectGraphUsingProjectFileMap;
|
|
57
|
+
function readCombinedDeps() {
|
|
58
|
+
const json = devkit_1.readJsonFile(path_1.join(app_root_1.appRootPath, 'package.json'));
|
|
59
|
+
return Object.assign(Object.assign({}, json.dependencies), json.devDependencies);
|
|
60
|
+
}
|
|
61
|
+
function buildProjectGraphUsingContext(ctx, cachedFileData, projectGraphVersion) {
|
|
62
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
perf_hooks_1.performance.mark('build project graph:start');
|
|
64
|
+
const builder = new devkit_1.ProjectGraphBuilder();
|
|
65
|
+
build_nodes_1.buildWorkspaceProjectNodes(ctx, builder);
|
|
66
|
+
build_nodes_1.buildNpmPackageNodes(builder);
|
|
67
|
+
for (const proj of Object.keys(cachedFileData)) {
|
|
68
|
+
for (const f of builder.graph.nodes[proj].data.files) {
|
|
69
|
+
const cached = cachedFileData[proj][f.file];
|
|
70
|
+
if (cached) {
|
|
71
|
+
f.deps = cached.deps;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
yield buildExplicitDependencies(ctx, builder);
|
|
76
|
+
build_dependencies_1.buildImplicitProjectDependencies(ctx, builder);
|
|
77
|
+
builder.setVersion(projectGraphVersion);
|
|
78
|
+
const initProjectGraph = builder.getUpdatedProjectGraph();
|
|
79
|
+
const r = updateProjectGraphWithPlugins(ctx, initProjectGraph);
|
|
80
|
+
perf_hooks_1.performance.mark('build project graph:end');
|
|
81
|
+
perf_hooks_1.performance.measure('build project graph', 'build project graph:start', 'build project graph:end');
|
|
82
|
+
return r;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function buildExplicitDependencies(ctx, builder) {
|
|
86
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
let totalNumOfFilesToProcess = totalNumberOfFilesToProcess(ctx);
|
|
88
|
+
// using workers has an overhead, so we only do it when the number of
|
|
89
|
+
// files we need to process is >= 100
|
|
90
|
+
if (totalNumOfFilesToProcess < 100) {
|
|
91
|
+
return buildExplicitDependenciesWithoutWorkers(ctx, builder);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
return buildExplicitDependenciesUsingWorkers(ctx, totalNumOfFilesToProcess, builder);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function totalNumberOfFilesToProcess(ctx) {
|
|
99
|
+
let totalNumOfFilesToProcess = 0;
|
|
100
|
+
Object.values(ctx.filesToProcess).forEach((t) => (totalNumOfFilesToProcess += t.length));
|
|
101
|
+
return totalNumOfFilesToProcess;
|
|
102
|
+
}
|
|
103
|
+
function splitFilesIntoBins(ctx, totalNumOfFilesToProcess, numberOfWorkers) {
|
|
104
|
+
// we want to have numberOfWorkers * 5 bins
|
|
105
|
+
const filesPerBin = Math.round(totalNumOfFilesToProcess / numberOfWorkers / 5) + 1;
|
|
106
|
+
const bins = [];
|
|
107
|
+
let currentProjectFileMap = {};
|
|
108
|
+
let currentNumberOfFiles = 0;
|
|
109
|
+
for (const source of Object.keys(ctx.filesToProcess)) {
|
|
110
|
+
for (const f of Object.values(ctx.filesToProcess[source])) {
|
|
111
|
+
if (!currentProjectFileMap[source])
|
|
112
|
+
currentProjectFileMap[source] = [];
|
|
113
|
+
currentProjectFileMap[source].push(f);
|
|
114
|
+
currentNumberOfFiles++;
|
|
115
|
+
if (currentNumberOfFiles >= filesPerBin) {
|
|
116
|
+
bins.push(currentProjectFileMap);
|
|
117
|
+
currentProjectFileMap = {};
|
|
118
|
+
currentNumberOfFiles = 0;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
bins.push(currentProjectFileMap);
|
|
123
|
+
return bins;
|
|
124
|
+
}
|
|
125
|
+
function createWorkerPool(numberOfWorkers) {
|
|
126
|
+
const res = [];
|
|
127
|
+
for (let i = 0; i < numberOfWorkers; ++i) {
|
|
128
|
+
res.push(new (require('worker_threads').Worker)(path_1.join(__dirname, './project-graph-worker.js'), {
|
|
129
|
+
env: process.env,
|
|
130
|
+
}));
|
|
131
|
+
}
|
|
132
|
+
return res;
|
|
133
|
+
}
|
|
134
|
+
function buildExplicitDependenciesWithoutWorkers(ctx, builder) {
|
|
135
|
+
build_explicit_typescript_and_package_json_dependencies_1.buildExplicitTypescriptAndPackageJsonDependencies(ctx.workspace, builder.graph, ctx.filesToProcess).forEach((r) => {
|
|
136
|
+
builder.addExplicitDependency(r.sourceProjectName, r.sourceProjectFile, r.targetProjectName);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
function buildExplicitDependenciesUsingWorkers(ctx, totalNumOfFilesToProcess, builder) {
|
|
140
|
+
const numberOfWorkers = os.cpus().length - 1;
|
|
141
|
+
const bins = splitFilesIntoBins(ctx, totalNumOfFilesToProcess, numberOfWorkers);
|
|
142
|
+
const workers = createWorkerPool(numberOfWorkers);
|
|
143
|
+
let numberOfExpectedResponses = bins.length;
|
|
144
|
+
return new Promise((res, reject) => {
|
|
145
|
+
for (let w of workers) {
|
|
146
|
+
w.on('message', (explicitDependencies) => {
|
|
147
|
+
explicitDependencies.forEach((r) => {
|
|
148
|
+
builder.addExplicitDependency(r.sourceProjectName, r.sourceProjectFile, r.targetProjectName);
|
|
149
|
+
});
|
|
150
|
+
if (bins.length > 0) {
|
|
151
|
+
w.postMessage({ filesToProcess: bins.shift() });
|
|
152
|
+
}
|
|
153
|
+
// we processed all the bins
|
|
154
|
+
if (--numberOfExpectedResponses === 0) {
|
|
155
|
+
for (let w of workers) {
|
|
156
|
+
w.terminate();
|
|
157
|
+
}
|
|
158
|
+
res(null);
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
w.on('error', reject);
|
|
162
|
+
w.on('exit', (code) => {
|
|
163
|
+
if (code !== 0) {
|
|
164
|
+
reject(new Error(`Unable to complete project graph creation. Worker stopped with exit code: ${code}`));
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
w.postMessage({
|
|
168
|
+
workspace: ctx.workspace,
|
|
169
|
+
projectGraph: builder.graph,
|
|
170
|
+
});
|
|
171
|
+
w.postMessage({ filesToProcess: bins.shift() });
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
function createContext(workspaceJson, nxJson, fileMap, filesToProcess) {
|
|
176
|
+
const projects = Object.keys(workspaceJson.projects).reduce((map, projectName) => {
|
|
177
|
+
map[projectName] = Object.assign(Object.assign({}, workspaceJson.projects[projectName]), nxJson.projects[projectName]);
|
|
178
|
+
return map;
|
|
179
|
+
}, {});
|
|
180
|
+
return {
|
|
181
|
+
workspace: Object.assign(Object.assign(Object.assign({}, workspaceJson), nxJson), { projects }),
|
|
182
|
+
fileMap,
|
|
183
|
+
filesToProcess,
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
function updateProjectGraphWithPlugins(context, initProjectGraph) {
|
|
187
|
+
return (context.workspace.plugins || []).reduce((graph, path) => {
|
|
188
|
+
try {
|
|
189
|
+
const pluginPath = require.resolve(path, {
|
|
190
|
+
paths: [app_root_1.appRootPath],
|
|
191
|
+
});
|
|
192
|
+
const pluginModule = require(pluginPath);
|
|
193
|
+
if (!pluginModule.processProjectGraph) {
|
|
194
|
+
return graph;
|
|
195
|
+
}
|
|
196
|
+
return pluginModule.processProjectGraph(graph, context);
|
|
197
|
+
}
|
|
198
|
+
catch (e) {
|
|
199
|
+
const message = `Failed to process the project graph with "${path}". This will error in the future!`;
|
|
200
|
+
if (process.env.NX_VERBOSE_LOGGING === 'true') {
|
|
201
|
+
console.error(e);
|
|
202
|
+
devkit_1.logger.error(message);
|
|
203
|
+
return graph;
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
devkit_1.logger.warn(message);
|
|
207
|
+
devkit_1.logger.warn(`Run with NX_VERBOSE_LOGGING=true to see the error.`);
|
|
208
|
+
}
|
|
209
|
+
return graph;
|
|
210
|
+
}
|
|
211
|
+
}, initProjectGraph);
|
|
212
|
+
}
|
|
213
|
+
function readRootTsConfig() {
|
|
214
|
+
for (const tsConfigName of ['tsconfig.base.json', 'tsconfig.json']) {
|
|
215
|
+
const tsConfigPath = path_1.join(app_root_1.appRootPath, tsConfigName);
|
|
216
|
+
if (fs_1.existsSync(tsConfigPath)) {
|
|
217
|
+
return devkit_1.readJsonFile(tsConfigPath);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=build-project-graph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-project-graph.js","sourceRoot":"","sources":["../../../../../../packages/workspace/src/core/project-graph/build-project-graph.ts"],"names":[],"mappings":";;;;AAAA,yCAcsB;AACtB,2DAA2D;AAC3D,+BAAqC;AACrC,2CAAyC;AACzC,4EAAuE;AACvE,8CAIuB;AACvB,4DAAuD;AACvD,4DAOkC;AAClC,6DAAwE;AACxE,+CAGuB;AACvB,2BAAgC;AAChC,yBAAyB;AACzB,0JAAiJ;AAEjJ,SAAsB,iBAAiB,CAAC,sBAA8B,KAAK;;QACzE,MAAM,aAAa,GAAG,8BAAiB,EAAE,CAAC;QAC1C,MAAM,EAAE,cAAc,EAAE,iBAAiB,EAAE,GACzC,iCAAoB,CAAC,aAAa,CAAC,CAAC;QAEtC,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,sBAAsB,KAAK,OAAO,CAAC;QACpE,IAAI,KAAK,GAAG,YAAY,CAAC,CAAC,CAAC,yBAAS,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QAE9C,OAAO,CACL,MAAM,oCAAoC,CACxC,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,KAAK,EACL,YAAY,EACZ,mBA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AAI,mCAAmC,CAAC;YACrG,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,KAAK,MAAM,EAAE;gBAC7C,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBACjB,eAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACtB,OAAO,KAAK,CAAC;aACd;iBAAM;gBACL,eAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACrB,eAAM,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAC;aACnE;YACD,OAAO,KAAK,CAAC;SACd;IACH,CAAC,EAAE,gBAAgB,CAAC,CAAC;AACvB,CAAC;AAED,SAAS,gBAAgB;IACvB,KAAK,MAAM,YAAY,IAAI,CAAC,oBAAoB,EAAE,eAAe,CAAC,EAAE;QAClE,MAAM,YAAY,GAAG,WAAI,CAAC,sBAAW,EAAE,YAAY,CAAC,CAAC;QACrD,IAAI,eAAU,CAAC,YAAY,CAAC,EAAE;YAC5B,OAAO,qBAAY,CAAC,YAAY,CAAC,CAAC;SACnC;KACF;AACH,CAAC"}
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* it is not possible for us to cache valuable metadata in memory. We therefore
|
|
4
|
-
* instead leverage the existing node_modules/.cache/nx directory to create a new
|
|
5
|
-
* file called daemon.json in order to track things such as the background processes
|
|
6
|
-
* created by this utility so that they can be cleaned up appropriately.
|
|
7
|
-
*/
|
|
8
|
-
export interface DaemonJson {
|
|
9
|
-
serverLogOutputFile: string;
|
|
10
|
-
backgroundProcessId: number;
|
|
1
|
+
export interface DaemonProcessJson {
|
|
2
|
+
processId: number;
|
|
11
3
|
}
|
|
12
|
-
export declare function
|
|
13
|
-
export declare function
|
|
14
|
-
export declare function
|
|
4
|
+
export declare function writeDaemonJsonProcessCache(daemonJson: DaemonProcessJson): Promise<void>;
|
|
5
|
+
export declare function safelyCleanUpExistingProcess(): Promise<void>;
|
|
6
|
+
export declare function getDaemonProcessId(): number | null;
|
|
@@ -1,33 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getDaemonProcessId = exports.safelyCleanUpExistingProcess = exports.writeDaemonJsonProcessCache = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const fs_extra_1 = require("fs-extra");
|
|
6
6
|
const path_1 = require("path");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
function
|
|
7
|
+
const tmp_dir_1 = require("./tmp-dir");
|
|
8
|
+
const serverProcessJsonPath = path_1.join(tmp_dir_1.DAEMON_DIR_FOR_CURRENT_WORKSPACE, 'server-process.json');
|
|
9
|
+
function readDaemonProcessJsonCache() {
|
|
10
10
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
11
|
-
|
|
12
|
-
if (!fs_extra_1.existsSync(daemonJsonPath)) {
|
|
11
|
+
if (!fs_extra_1.existsSync(serverProcessJsonPath)) {
|
|
13
12
|
return null;
|
|
14
13
|
}
|
|
15
|
-
return yield fs_extra_1.readJson(
|
|
14
|
+
return yield fs_extra_1.readJson(serverProcessJsonPath);
|
|
16
15
|
});
|
|
17
16
|
}
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
function deleteDaemonJsonProcessCache() {
|
|
18
|
+
try {
|
|
19
|
+
fs_extra_1.unlinkSync(serverProcessJsonPath);
|
|
20
|
+
}
|
|
21
|
+
catch (_a) { }
|
|
22
|
+
}
|
|
23
|
+
function writeDaemonJsonProcessCache(daemonJson) {
|
|
20
24
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
|
|
22
|
-
yield fs_extra_1.writeJson(daemonJsonPath, daemonJson);
|
|
25
|
+
yield fs_extra_1.writeJson(serverProcessJsonPath, daemonJson);
|
|
23
26
|
});
|
|
24
27
|
}
|
|
25
|
-
exports.
|
|
26
|
-
function
|
|
28
|
+
exports.writeDaemonJsonProcessCache = writeDaemonJsonProcessCache;
|
|
29
|
+
function safelyCleanUpExistingProcess() {
|
|
30
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
const daemonProcessJson = yield readDaemonProcessJsonCache();
|
|
32
|
+
if (daemonProcessJson && daemonProcessJson.processId) {
|
|
33
|
+
try {
|
|
34
|
+
process.kill(daemonProcessJson.processId);
|
|
35
|
+
}
|
|
36
|
+
catch (_a) { }
|
|
37
|
+
}
|
|
38
|
+
deleteDaemonJsonProcessCache();
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
exports.safelyCleanUpExistingProcess = safelyCleanUpExistingProcess;
|
|
42
|
+
// Must be sync for the help output use case
|
|
43
|
+
function getDaemonProcessId() {
|
|
44
|
+
if (!fs_extra_1.existsSync(serverProcessJsonPath)) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
27
47
|
try {
|
|
28
|
-
|
|
48
|
+
const daemonProcessJson = require(serverProcessJsonPath);
|
|
49
|
+
return daemonProcessJson.processId;
|
|
50
|
+
}
|
|
51
|
+
catch (_a) {
|
|
52
|
+
return null;
|
|
29
53
|
}
|
|
30
|
-
catch (_a) { }
|
|
31
54
|
}
|
|
32
|
-
exports.
|
|
55
|
+
exports.getDaemonProcessId = getDaemonProcessId;
|
|
33
56
|
//# sourceMappingURL=cache.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/core/project-graph/daemon/cache.ts"],"names":[],"mappings":";;;;AAAA,uCAAuE;AACvE,+BAA4B;AAC5B
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/core/project-graph/daemon/cache.ts"],"names":[],"mappings":";;;;AAAA,uCAAuE;AACvE,+BAA4B;AAC5B,uCAA6D;AAM7D,MAAM,qBAAqB,GAAG,WAAI,CAChC,0CAAgC,EAChC,qBAAqB,CACtB,CAAC;AAEF,SAAe,0BAA0B;;QACvC,IAAI,CAAC,qBAAU,CAAC,qBAAqB,CAAC,EAAE;YACtC,OAAO,IAAI,CAAC;SACb;QACD,OAAO,MAAM,mBAAQ,CAAC,qBAAqB,CAAC,CAAC;IAC/C,CAAC;CAAA;AAED,SAAS,4BAA4B;IACnC,IAAI;QACF,qBAAU,CAAC,qBAAqB,CAAC,CAAC;KACnC;IAAC,WAAM,GAAE;AACZ,CAAC;AAED,SAAsB,2BAA2B,CAC/C,UAA6B;;QAE7B,MAAM,oBAAS,CAAC,qBAAqB,EAAE,UAAU,CAAC,CAAC;IACrD,CAAC;CAAA;AAJD,kEAIC;AAED,SAAsB,4BAA4B;;QAChD,MAAM,iBAAiB,GAAG,MAAM,0BAA0B,EAAE,CAAC;QAC7D,IAAI,iBAAiB,IAAI,iBAAiB,CAAC,SAAS,EAAE;YACpD,IAAI;gBACF,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;aAC3C;YAAC,WAAM,GAAE;SACX;QACD,4BAA4B,EAAE,CAAC;IACjC,CAAC;CAAA;AARD,oEAQC;AAED,4CAA4C;AAC5C,SAAgB,kBAAkB;IAChC,IAAI,CAAC,qBAAU,CAAC,qBAAqB,CAAC,EAAE;QACtC,OAAO,IAAI,CAAC;KACb;IACD,IAAI;QACF,MAAM,iBAAiB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;QACzD,OAAO,iBAAiB,CAAC,SAAS,CAAC;KACpC;IAAC,WAAM;QACN,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AAVD,gDAUC"}
|
|
@@ -3,53 +3,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getProjectGraphFromServer = exports.isServerAvailable = exports.stop = exports.startInCurrentProcess = exports.startInBackground = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nrwl/devkit");
|
|
6
|
-
const app_root_1 = require("@nrwl/tao/src/utils/app-root");
|
|
7
6
|
const child_process_1 = require("child_process");
|
|
8
|
-
const
|
|
9
|
-
const path_1 = require("path");
|
|
10
|
-
const tmp_1 = require("tmp");
|
|
11
|
-
const cache_1 = require("../cache");
|
|
7
|
+
const fs_1 = require("fs");
|
|
12
8
|
const net_1 = require("net");
|
|
13
|
-
const socket_utils_1 = require("../socket-utils");
|
|
14
9
|
const perf_hooks_1 = require("perf_hooks");
|
|
15
|
-
const
|
|
10
|
+
const cache_1 = require("../cache");
|
|
11
|
+
const socket_utils_1 = require("../socket-utils");
|
|
12
|
+
const tmp_dir_1 = require("../tmp-dir");
|
|
16
13
|
function startInBackground() {
|
|
17
14
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
|
|
19
|
-
* For now, while the daemon is an opt-in feature, we will log to stdout when
|
|
20
|
-
* starting the server, as well as providing a reference to where any subsequent
|
|
21
|
-
* log files can be found.
|
|
22
|
-
*/
|
|
23
|
-
const tmpDirPrefix = `nx-daemon--${devkit_1.normalizePath(app_root_1.appRootPath).replace(
|
|
24
|
-
// Replace the occurrences of / in the unix-style normalized path with a -
|
|
25
|
-
new RegExp(escapeRegExp('/'), 'g'), '-')}`;
|
|
26
|
-
const serverLogOutputDir = tmp_1.dirSync({
|
|
27
|
-
prefix: tmpDirPrefix,
|
|
28
|
-
}).name;
|
|
29
|
-
const serverLogOutputFile = path_1.join(serverLogOutputDir, 'nx-daemon.log');
|
|
30
|
-
fs_extra_1.ensureFileSync(serverLogOutputFile);
|
|
31
|
-
// Clean up any existing orphaned background process before creating a new one
|
|
32
|
-
const cachedDaemonJson = yield cache_1.readDaemonJsonCache();
|
|
33
|
-
if (cachedDaemonJson) {
|
|
34
|
-
if (cachedDaemonJson.backgroundProcessId) {
|
|
35
|
-
process.kill(cachedDaemonJson.backgroundProcessId);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
devkit_1.logger.info(`NX Daemon Server - Starting in a background process...`);
|
|
39
|
-
devkit_1.logger.log(` Logs from the Daemon process can be found here: ${serverLogOutputFile}\n`);
|
|
15
|
+
yield cache_1.safelyCleanUpExistingProcess();
|
|
40
16
|
try {
|
|
41
|
-
const
|
|
17
|
+
const out = fs_1.openSync(tmp_dir_1.DAEMON_OUTPUT_LOG_FILE, 'a');
|
|
18
|
+
const err = fs_1.openSync(tmp_dir_1.DAEMON_OUTPUT_LOG_FILE, 'a');
|
|
19
|
+
const backgroundProcess = child_process_1.spawn(process.execPath, ['../server/start.js'], {
|
|
42
20
|
cwd: __dirname,
|
|
43
|
-
stdio: 'ignore',
|
|
21
|
+
stdio: ['ignore', out, err],
|
|
44
22
|
detached: true,
|
|
45
23
|
});
|
|
46
24
|
backgroundProcess.unref();
|
|
47
25
|
// Persist metadata about the background process so that it can be cleaned up later if needed
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
};
|
|
52
|
-
yield cache_1.writeDaemonJsonCache(daemonJson);
|
|
26
|
+
yield cache_1.writeDaemonJsonProcessCache({
|
|
27
|
+
processId: backgroundProcess.pid,
|
|
28
|
+
});
|
|
53
29
|
/**
|
|
54
30
|
* Ensure the server is actually available to connect to via IPC before resolving
|
|
55
31
|
*/
|
|
@@ -71,7 +47,7 @@ function startInBackground() {
|
|
|
71
47
|
exports.startInBackground = startInBackground;
|
|
72
48
|
function startInCurrentProcess() {
|
|
73
49
|
devkit_1.logger.info(`NX Daemon Server - Starting in the current process...`);
|
|
74
|
-
child_process_1.spawnSync(process.execPath, ['
|
|
50
|
+
child_process_1.spawnSync(process.execPath, ['../server/start.js'], {
|
|
75
51
|
cwd: __dirname,
|
|
76
52
|
stdio: 'inherit',
|
|
77
53
|
});
|
|
@@ -85,10 +61,6 @@ function stop() {
|
|
|
85
61
|
});
|
|
86
62
|
}
|
|
87
63
|
exports.stop = stop;
|
|
88
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping
|
|
89
|
-
function escapeRegExp(string) {
|
|
90
|
-
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
|
|
91
|
-
}
|
|
92
64
|
/**
|
|
93
65
|
* As noted in the comments above the createServer() call, in order to reliably (meaning it works
|
|
94
66
|
* cross-platform) check whether or not the server is availabe to request a project graph from we
|
|
@@ -99,21 +71,20 @@ function escapeRegExp(string) {
|
|
|
99
71
|
*/
|
|
100
72
|
function isServerAvailable() {
|
|
101
73
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
socket.on('connect', () => {
|
|
74
|
+
return new Promise((resolve) => {
|
|
75
|
+
try {
|
|
76
|
+
const socket = net_1.connect(socket_utils_1.FULL_OS_SOCKET_PATH, () => {
|
|
106
77
|
socket.destroy();
|
|
107
78
|
resolve(true);
|
|
108
79
|
});
|
|
109
|
-
socket.
|
|
80
|
+
socket.once('error', () => {
|
|
110
81
|
resolve(false);
|
|
111
82
|
});
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
83
|
+
}
|
|
84
|
+
catch (err) {
|
|
85
|
+
resolve(false);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
117
88
|
});
|
|
118
89
|
}
|
|
119
90
|
exports.isServerAvailable = isServerAvailable;
|
|
@@ -154,19 +125,22 @@ function getProjectGraphFromServer() {
|
|
|
154
125
|
*/
|
|
155
126
|
socket.on('connect', () => {
|
|
156
127
|
socket.write('REQUEST_PROJECT_GRAPH_PAYLOAD');
|
|
157
|
-
let
|
|
128
|
+
let serializedProjectGraphResult = '';
|
|
158
129
|
socket.on('data', (data) => {
|
|
159
|
-
|
|
130
|
+
serializedProjectGraphResult += data.toString();
|
|
160
131
|
});
|
|
161
132
|
socket.on('end', () => {
|
|
162
133
|
try {
|
|
163
134
|
perf_hooks_1.performance.mark('json-parse-start');
|
|
164
|
-
const
|
|
135
|
+
const projectGraphResult = socket_utils_1.deserializeResult(serializedProjectGraphResult);
|
|
165
136
|
perf_hooks_1.performance.mark('json-parse-end');
|
|
166
|
-
perf_hooks_1.performance.measure('deserialize graph on the client', 'json-parse-start', 'json-parse-end');
|
|
167
|
-
|
|
137
|
+
perf_hooks_1.performance.measure('deserialize graph result on the client', 'json-parse-start', 'json-parse-end');
|
|
138
|
+
if (projectGraphResult.error) {
|
|
139
|
+
devkit_1.logger.error(`NX Daemon Client - The server returned an Error`);
|
|
140
|
+
return reject(projectGraphResult.error);
|
|
141
|
+
}
|
|
168
142
|
perf_hooks_1.performance.measure('total for getProjectGraphFromServer()', 'getProjectGraphFromServer-start', 'json-parse-end');
|
|
169
|
-
return resolve(projectGraph);
|
|
143
|
+
return resolve(projectGraphResult.projectGraph);
|
|
170
144
|
}
|
|
171
145
|
catch (_a) {
|
|
172
146
|
devkit_1.logger.error('NX Daemon Client - Error: Could not deserialize the ProjectGraph');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../../../../packages/workspace/src/core/project-graph/daemon/client/client.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../../../../packages/workspace/src/core/project-graph/daemon/client/client.ts"],"names":[],"mappings":";;;;AAAA,yCAAoD;AACpD,iDAAiD;AACjD,2BAA0C;AAC1C,6BAA8B;AAC9B,2CAAyC;AACzC,oCAGkB;AAClB,kDAIyB;AACzB,wCAAoD;AAEpD,SAAsB,iBAAiB;;QACrC,MAAM,oCAA4B,EAAE,CAAC;QAErC,IAAI;YACF,MAAM,GAAG,GAAG,aAAQ,CAAC,gCAAsB,EAAE,GAAG,CAAC,CAAC;YAClD,MAAM,GAAG,GAAG,aAAQ,CAAC,gCAAsB,EAAE,GAAG,CAAC,CAAC;YAClD,MAAM,iBAAiB,GAAG,qBAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,oBAAoB,CAAC,EAAE;gBACxE,GAAG,EAAE,SAAS;gBACd,KAAK,EAAE,CAAC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
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const client_1 = require("./client");
|
|
5
|
+
(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
6
|
+
try {
|
|
7
|
+
console.log(yield client_1.isServerAvailable());
|
|
8
|
+
}
|
|
9
|
+
catch (_a) {
|
|
10
|
+
console.log(false);
|
|
11
|
+
}
|
|
12
|
+
}))();
|
|
13
|
+
//# sourceMappingURL=exec-is-server-available.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec-is-server-available.js","sourceRoot":"","sources":["../../../../../../../../packages/workspace/src/core/project-graph/daemon/client/exec-is-server-available.ts"],"names":[],"mappings":";;;AAAA,qCAA6C;AAE7C,CAAC,GAAS,EAAE;IACV,IAAI;QACF,OAAO,CAAC,GAAG,CAAC,MAAM,0BAAiB,EAAE,CAAC,CAAC;KACxC;IAAC,WAAM;QACN,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;KACpB;AACH,CAAC,CAAA,CAAC,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function generateDaemonHelpOutput(): string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateDaemonHelpOutput = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const cache_1 = require("../cache");
|
|
6
|
+
const tmp_dir_1 = require("../tmp-dir");
|
|
7
|
+
function generateDaemonHelpOutput() {
|
|
8
|
+
var _a;
|
|
9
|
+
/**
|
|
10
|
+
* A workaround for cases such as yargs output where we need to synchronously
|
|
11
|
+
* get the value of this async operation.
|
|
12
|
+
*/
|
|
13
|
+
const res = child_process_1.spawnSync(process.execPath, ['./exec-is-server-available.js'], {
|
|
14
|
+
cwd: __dirname,
|
|
15
|
+
});
|
|
16
|
+
const isServerAvailable = ((_a = res === null || res === void 0 ? void 0 : res.stdout) === null || _a === void 0 ? void 0 : _a.toString().trim()) === 'true';
|
|
17
|
+
if (!isServerAvailable) {
|
|
18
|
+
return '';
|
|
19
|
+
}
|
|
20
|
+
const pid = cache_1.getDaemonProcessId();
|
|
21
|
+
return `Nx Daemon is currently running:
|
|
22
|
+
- Logs: ${tmp_dir_1.DAEMON_OUTPUT_LOG_FILE}${pid
|
|
23
|
+
? `
|
|
24
|
+
- Process ID: ${pid}`
|
|
25
|
+
: ''}`;
|
|
26
|
+
}
|
|
27
|
+
exports.generateDaemonHelpOutput = generateDaemonHelpOutput;
|
|
28
|
+
//# sourceMappingURL=generate-help-output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-help-output.js","sourceRoot":"","sources":["../../../../../../../../packages/workspace/src/core/project-graph/daemon/client/generate-help-output.ts"],"names":[],"mappings":";;;AAAA,iDAA0C;AAC1C,oCAA8C;AAC9C,wCAAoD;AAEpD,SAAgB,wBAAwB;;IACtC;;;OAGG;IACH,MAAM,GAAG,GAAG,yBAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,+BAA+B,CAAC,EAAE;QACzE,GAAG,EAAE,SAAS;KACf,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAAG,CAAA,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,MAAM,0CAAE,QAAQ,GAAG,IAAI,EAAE,MAAK,MAAM,CAAC;IACpE,IAAI,CAAC,iBAAiB,EAAE;QACtB,OAAO,EAAE,CAAC;KACX;IAED,MAAM,GAAG,GAAG,0BAAkB,EAAE,CAAC;IACjC,OAAO;YACG,gCAAsB,GAC9B,GAAG;QACD,CAAC,CAAC;kBACU,GAAG,EAAE;QACjB,CAAC,CAAC,EACN,EAAE,CAAC;AACL,CAAC;AAtBD,4DAsBC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* To improve the overall readibility of the logs, we categorize things by "trigger":
|
|
3
|
+
*
|
|
4
|
+
* - [REQUEST] meaning that the current set of actions were triggered by a client request to the server
|
|
5
|
+
* - [WATCHER] meaning the the current set of actions were triggered by handling changes to the workspace files
|
|
6
|
+
*
|
|
7
|
+
* We keep those two "triggers" left aligned at the top level and then indent subsequent logs so that there is a
|
|
8
|
+
* logical hierarchy/grouping.
|
|
9
|
+
*/
|
|
10
|
+
declare class ServerLogger {
|
|
11
|
+
log(...s: unknown[]): void;
|
|
12
|
+
requestLog(...s: unknown[]): void;
|
|
13
|
+
watcherLog(...s: unknown[]): void;
|
|
14
|
+
nestedLog(...s: unknown[]): void;
|
|
15
|
+
private formatLogMessage;
|
|
16
|
+
private getNow;
|
|
17
|
+
}
|
|
18
|
+
export declare const serverLogger: ServerLogger;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* To improve the overall readibility of the logs, we categorize things by "trigger":
|
|
4
|
+
*
|
|
5
|
+
* - [REQUEST] meaning that the current set of actions were triggered by a client request to the server
|
|
6
|
+
* - [WATCHER] meaning the the current set of actions were triggered by handling changes to the workspace files
|
|
7
|
+
*
|
|
8
|
+
* We keep those two "triggers" left aligned at the top level and then indent subsequent logs so that there is a
|
|
9
|
+
* logical hierarchy/grouping.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.serverLogger = void 0;
|
|
13
|
+
class ServerLogger {
|
|
14
|
+
log(...s) {
|
|
15
|
+
console.log(this.formatLogMessage(`${s
|
|
16
|
+
.map((val) => {
|
|
17
|
+
if (typeof val === 'string') {
|
|
18
|
+
return val;
|
|
19
|
+
}
|
|
20
|
+
return JSON.stringify(val);
|
|
21
|
+
})
|
|
22
|
+
.join(' ')}`));
|
|
23
|
+
}
|
|
24
|
+
requestLog(...s) {
|
|
25
|
+
this.log(`[REQUEST]: ${s.join(' ')}`);
|
|
26
|
+
}
|
|
27
|
+
watcherLog(...s) {
|
|
28
|
+
this.log(`[WATCHER]: ${s.join(' ')}`);
|
|
29
|
+
}
|
|
30
|
+
nestedLog(...s) {
|
|
31
|
+
this.log(` ${s.join(' ')}`);
|
|
32
|
+
}
|
|
33
|
+
formatLogMessage(message) {
|
|
34
|
+
return `[NX Daemon Server] - ${this.getNow()} - ${message}`;
|
|
35
|
+
}
|
|
36
|
+
getNow() {
|
|
37
|
+
return new Date(Date.now()).toISOString();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.serverLogger = new ServerLogger();
|
|
41
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../../../../../../packages/workspace/src/core/project-graph/daemon/server/logger.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH,MAAM,YAAY;IAChB,GAAG,CAAC,GAAG,CAAY;QACjB,OAAO,CAAC,GAAG,CACT,IAAI,CAAC,gBAAgB,CACnB,GAAG,CAAC;aACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YACX,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;gBAC3B,OAAO,GAAG,CAAC;aACZ;YACD,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC,CAAC;aACD,IAAI,CAAC,GAAG,CAAC,EAAE,CACf,CACF,CAAC;IACJ,CAAC;IAED,UAAU,CAAC,GAAG,CAAY;QACxB,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACxC,CAAC;IAED,UAAU,CAAC,GAAG,CAAY;QACxB,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACxC,CAAC;IAED,SAAS,CAAC,GAAG,CAAY;QACvB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC/B,CAAC;IAEO,gBAAgB,CAAC,OAAe;QACtC,OAAO,wBAAwB,IAAI,CAAC,MAAM,EAAE,MAAM,OAAO,EAAE,CAAC;IAC9D,CAAC;IAEO,MAAM;QACZ,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IAC5C,CAAC;CACF;AAEY,QAAA,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC"}
|