Debian Codegraph @

.tsconfigrc.js

raw symbols SCIP
1 /* --------------------------------------------------------------------------------------------
2 * Copyright (c) Microsoft Corporation. All rights reserved.
3 * Licensed under the MIT License. See License.txt in the project root for license information.
4 * ------------------------------------------------------------------------------------------ */
5
6 // @ts-check
7 'use strict';
8
9 const { CompilerOptions } = require('@vscode/tsconfig-gen');
10
11 /**
12 * @typedef {import('@vscode/tsconfig-gen').SharableOptions} SharableOptions
13 * @typedef {import('@vscode/tsconfig-gen').ProjectDescription} ProjectDescription
14 * @typedef {import('@vscode/tsconfig-gen').ProjectOptions} ProjectOptions
15 * @typedef {import('@vscode/tsconfig-gen').Projects} Projects
16 */
17
18 /**
19 * Creates a publish project description from a normal project description by removing
20 * any project reference from it since it has to come via a npm dependency during publish.
21 *
22 * @param {ProjectDescription} projectDescription The project description
23 * @returns {ProjectDescription} The project description without project references
24 */
25 function createPublishProjectDescription(projectDescription) {
26 const result = Object.assign({}, projectDescription);
27 delete result.references;
28 return result;
29 }
30
31 /** @type SharableOptions */
32 const general = {
33 /**
34 * Even under browser we compile to node and commonjs and
35 * rely on webpack to package everything correctly.
36 */
37 compilerOptions: {
38 module: 'commonjs',
39 moduleResolution: 'node'
40 }
41 };
42
43 /** @type SharableOptions */
44 const testMixin = {
45 compilerOptions: {
46 types: ['mocha']
47 }
48 };
49
50 /** @type SharableOptions */
51 const vscodeMixin = {
52 compilerOptions: {
53 types: ['vscode']
54 }
55 };
56
57 /** @type SharableOptions */
58 const common = {
59 extends: [ general ],
60 compilerOptions: {
61 rootDir: '.',
62 types: [],
63 },
64 include: ['.']
65 };
66
67 /** @type SharableOptions */
68 const browser = {
69 extends: [ general ],
70 compilerOptions: {
71 rootDir: '.',
72 types: [],
73 lib: [ 'webworker' ]
74 },
75 include: ['.']
76 };
77
78 /** @type SharableOptions */
79 const node = {
80 extends: [ general ],
81 compilerOptions: {
82 rootDir: '.',
83 types: ['node']
84 },
85 include: ['.']
86 };
87
88 /** @type ProjectDescription */
89 const textDocument = {
90 name: 'textDocument',
91 path: './textDocument',
92 sourceFolders: [
93 {
94 path: './src',
95 extends: [ common ],
96 out: {
97 dir: '../lib/${target}',
98 buildInfoFile: '../lib/${target}/${buildInfoFile}.tsbuildInfo'
99 },
100 exclude: [ 'test' ]
101 },
102 {
103 path: './src/test',
104 extends: [ common, testMixin ],
105 out: {
106 dir: '../../lib/${target}/test',
107 buildInfoFile: '../../lib/${target}/test/${buildInfoFile}.tsbuildInfo'
108 },
109 references: [ '..' ]
110 }
111 ]
112 };
113
114 /** @type ProjectDescription */
115 const textDocument_publish = {
116 name: 'textDocument_publish',
117 path: './textDocument',
118 references: [ './tsconfig.esm.publish.json', './tsconfig.umd.publish.json' ]
119 };
120
121
122 /** @type ProjectDescription */
123 const types = {
124 name: 'types',
125 path: './types',
126 sourceFolders: [
127 {
128 path: './src',
129 extends: [ common ],
130 out: {
131 dir: '../lib/${target}',
132 buildInfoFile: '../lib/${target}/${buildInfoFile}.tsbuildInfo'
133 },
134 exclude: [ 'test' ]
135 },
136 {
137 path: './src/test',
138 extends: [ common, testMixin ],
139 out: {
140 dir: '../../lib/${target}/test',
141 buildInfoFile: '../../lib/${target}/test/${buildInfoFile}.tsbuildInfo'
142 },
143 references: [ '..' ]
144 }
145 ]
146 };
147
148 /** @type ProjectDescription */
149 const types_publish = {
150 name: 'types_publish',
151 path: './types',
152 references: [ './tsconfig.esm.publish.json', './tsconfig.umd.publish.json' ]
153 };
154
155 /** @type ProjectDescription */
156 const jsonrpc = {
157 name: 'jsonrpc',
158 path: './jsonrpc',
159 out: {
160 dir: './lib',
161 buildInfoFile: '${buildInfoFile}.tsbuildInfo'
162 },
163 sourceFolders: [
164 {
165 path: './src/common',
166 extends: [ common ],
167 exclude: [ 'test' ],
168 },
169 {
170 path: './src/common/test',
171 extends: [ common, testMixin ],
172 references: [ '..' ]
173 },
174 {
175 path: './src/browser',
176 extends: [ browser ],
177 exclude: [ 'test' ],
178 references: [ '../common' ]
179 },
180 {
181 path: './src/browser/test',
182 extends: [ browser, testMixin ],
183 references: [ '..' ]
184 },
185 {
186 path: './src/node',
187 extends: [ node ],
188 exclude: [ 'test' ],
189 references: [ '../common' ]
190 },
191 {
192 path: './src/node/test',
193 extends: [ node, testMixin ],
194 references: [ '..' ]
195 }
196 ]
197 };
198
199 /** @type ProjectDescription */
200 const protocol = {
201 name: 'protocol',
202 path: './protocol',
203 out: {
204 dir: './lib',
205 buildInfoFile: '${buildInfoFile}.tsbuildInfo'
206 },
207 sourceFolders: [
208 {
209 path: './src/common',
210 extends: [ common ]
211 },
212 {
213 path: './src/browser',
214 extends: [ browser ],
215 exclude: [ 'test' ],
216 references: [ '../common' ]
217 },
218 {
219 path: './src/browser/test',
220 extends: [ browser, testMixin ],
221 references: [ '..' ]
222 },
223 {
224 path: './src/node',
225 extends: [ node ],
226 exclude: [ 'test' ],
227 references: [ '../common' ]
228 },
229 {
230 path: './src/node/test',
231 extends: [ node, testMixin ],
232 references: [ '..' ]
233 }
234 ],
235 references: [
236 types, jsonrpc
237 ]
238 };
239
240 /** @type ProjectDescription */
241 const server = {
242 name: 'server',
243 path: './server',
244 out: {
245 dir: './lib',
246 buildInfoFile: '${buildInfoFile}.tsbuildInfo'
247 },
248 sourceFolders: [
249 {
250 path: './src/common',
251 extends: [ common ]
252 },
253 {
254 path: './src/browser',
255 extends: [ browser ],
256 references: [ '../common' ]
257 },
258 {
259 path: './src/node',
260 extends: [ node ],
261 exclude: [ 'test' ],
262 references: [ '../common' ]
263 },
264 {
265 path: './src/node/test',
266 extends: [ node, testMixin ],
267 references: [ '..' ]
268 }
269 ],
270 references: [ protocol ]
271 };
272
273 /** @type ProjectDescription */
274 const client = {
275 name: 'client',
276 path: './client',
277 out: {
278 dir: './lib',
279 buildInfoFile: '${buildInfoFile}.tsbuildInfo'
280 },
281 sourceFolders: [
282 {
283 path: './src/common',
284 extends: [ common, vscodeMixin ]
285 },
286 {
287 path: './src/browser',
288 extends: [ browser, vscodeMixin ],
289 references: [ '../common' ]
290 },
291 {
292 path: './src/node',
293 extends: [ node, vscodeMixin ],
294 references: [ '../common' ]
295 }
296 ],
297 references: [ protocol ]
298 };
299
300
301 /** @type ProjectDescription */
302 const client_node_tests = {
303 name: 'client-node-tests',
304 path: './client-node-tests',
305 out: {
306 dir: './lib',
307 buildInfoFile: '${buildInfoFile}.tsbuildInfo'
308 },
309 sourceFolders: [
310 {
311 path: './src',
312 extends: [ node, vscodeMixin, testMixin ]
313 }
314 ],
315 references: [ protocol, client, server ]
316 };
317
318 /** @type ProjectDescription */
319 const tools = {
320 name: 'tools',
321 path: './tools',
322 extends: [ node ],
323 out: {
324 dir: './lib',
325 buildInfoFile: '${buildInfoFile}.tsbuildInfo'
326 },
327 compilerOptions: {
328 rootDir: './src'
329 }
330 };
331
332 /** @type ProjectDescription */
333 const tsconfig_gen = {
334 name: 'tsconfig-gen',
335 path: './tsconfig-gen',
336 extends: [ node ],
337 out: {
338 dir: './lib',
339 buildInfoFile: '${buildInfoFile}.tsbuildInfo'
340 },
341 compilerOptions: {
342 rootDir: './src'
343 }
344 };
345
346 /** @type ProjectDescription */
347 const root = {
348 name: 'root',
349 path: './',
350 references: [ textDocument, types, jsonrpc, protocol, client, server, client_node_tests, tools, tsconfig_gen ]
351 };
352
353 /** @type CompilerOptions */
354 const defaultCompilerOptions = {
355 strict: true,
356 noImplicitAny: true,
357 noImplicitReturns: true,
358 noImplicitThis: true,
359 declaration: true,
360 stripInternal: true
361 };
362
363 /** @type CompilerOptions */
364 const compileCompilerOptions = CompilerOptions.assign(defaultCompilerOptions, {
365 sourceMap: true,
366 noUnusedLocals: true,
367 noUnusedParameters: true,
368 target: 'es2020',
369 lib: [ 'es2020' ],
370 });
371
372 /** @type ProjectOptions */
373 const compileProjectOptions = {
374 tags: ['compile'],
375 tsconfig: 'tsconfig.json',
376 variables: new Map([['buildInfoFile', 'compile']]),
377 compilerOptions: compileCompilerOptions
378 };
379
380 /** @type CompilerOptions */
381 const watchCompilerOptions = CompilerOptions.assign(defaultCompilerOptions, {
382 sourceMap: true,
383 noUnusedLocals: false,
384 noUnusedParameters: false,
385 assumeChangesOnlyAffectDirectDependencies: true,
386 target: 'es2020',
387 lib: [ 'es2020' ],
388 });
389
390 /** @type ProjectOptions */
391 const watchProjectOptions = {
392 tags: ['watch'],
393 tsconfig: 'tsconfig.watch.json',
394 variables: new Map([['buildInfoFile', 'watch']]),
395 compilerOptions: watchCompilerOptions
396 };
397
398 /** @type CompilerOptions */
399 const publishCompilerOptions = CompilerOptions.assign(defaultCompilerOptions, {
400 sourceMap: false,
401 noUnusedLocals: true,
402 noUnusedParameters: true,
403 target: 'es2020',
404 lib: [ 'es2020' ]
405
406 });
407
408 /** @type ProjectOptions */
409 const publishProjectOptions = {
410 tags: ['publish'],
411 tsconfig: 'tsconfig.publish.json',
412 variables: new Map([['buildInfoFile', 'publish']]),
413 compilerOptions: publishCompilerOptions
414 };
415
416 /** @type CompilerOptions */
417 const umdCompilerOptions = CompilerOptions.assign(defaultCompilerOptions, {
418 sourceMap: true,
419 noUnusedLocals: true,
420 noUnusedParameters: true,
421 target: 'es5',
422 module: 'umd',
423 lib: [ 'es2015' ],
424 });
425
426 /** @type ProjectOptions */
427 const umdProjectOptions = {
428 tags: ['umd', 'compile'],
429 tsconfig: 'tsconfig.json',
430 variables: new Map([['target', 'umd'], ['buildInfoFile', 'compile']]),
431 compilerOptions: umdCompilerOptions
432 };
433
434 /** @type CompilerOptions */
435 const umdWatchCompilerOptions = CompilerOptions.assign(umdCompilerOptions, {
436 noUnusedLocals: false,
437 noUnusedParameters: false,
438 assumeChangesOnlyAffectDirectDependencies: true,
439 });
440
441 /** @type ProjectOptions */
442 const umdWatchProjectOptions = {
443 tags: ['umd', 'watch'],
444 tsconfig: 'tsconfig.watch.json',
445 variables: new Map([['target', 'umd'], ['buildInfoFile', 'watch']]),
446 compilerOptions: umdCompilerOptions
447 };
448
449 /** @type CompilerOptions */
450 const umdPublishCompilerOptions = CompilerOptions.assign(umdCompilerOptions, {
451 sourceMap: false
452 });
453
454 /** @type ProjectOptions */
455 const umdPublishProjectOptions = {
456 tags: ['umd', 'publish'],
457 tsconfig: 'tsconfig.umd.publish.json',
458 variables: new Map([['target', 'umd'], ['buildInfoFile', 'publish']]),
459 compilerOptions: umdPublishCompilerOptions
460 };
461
462
463 /** @type CompilerOptions */
464 const esmPublishCompilerOptions = CompilerOptions.assign(defaultCompilerOptions, {
465 sourceMap: false,
466 target: 'es5',
467 module: 'es6',
468 lib: [ 'es2015' ]
469 });
470
471 /** @type ProjectOptions */
472 const esmPublishProjectOptions = {
473 tags: ['esm', 'publish'],
474 tsconfig: 'tsconfig.esm.publish.json',
475 variables: new Map([['target', 'esm'], ['buildInfoFile', 'publish']]),
476 compilerOptions: esmPublishCompilerOptions
477 };
478
479 /** @type Projects */
480 const projects = [
481 [ textDocument, [ umdProjectOptions, umdWatchProjectOptions, esmPublishProjectOptions, umdPublishProjectOptions ] ],
482 [ textDocument_publish, [ publishProjectOptions ] ],
483 [ types, [ umdProjectOptions, umdWatchProjectOptions, esmPublishProjectOptions, umdPublishProjectOptions ] ],
484 [ types_publish, [ publishProjectOptions ]],
485 [ jsonrpc, [ compileProjectOptions, watchProjectOptions ] ],
486 [ createPublishProjectDescription(jsonrpc), [ publishProjectOptions ] ],
487 [ protocol, [ compileProjectOptions, watchProjectOptions ] ],
488 [ createPublishProjectDescription(protocol), [ publishProjectOptions ] ],
489 [ server, [ compileProjectOptions, watchProjectOptions ] ],
490 [ createPublishProjectDescription(server), [ publishProjectOptions ] ],
491 [ client, [ compileProjectOptions, watchProjectOptions ] ],
492 [ createPublishProjectDescription(client), [ publishProjectOptions ] ],
493 [ client_node_tests, [ compileProjectOptions, watchProjectOptions ] ],
494 [ createPublishProjectDescription(client_node_tests), [ publishProjectOptions ] ],
495 [ tools, [ compileProjectOptions, watchProjectOptions ] ],
496 [ tsconfig_gen, [ compileProjectOptions, watchProjectOptions ] ],
497 [ createPublishProjectDescription(tsconfig_gen), [ publishProjectOptions ] ],
498 [ root, [ compileProjectOptions, watchProjectOptions ] ],
499 ];
500
501 module.exports = projects;