@artel/artc 0.9.26061-pre-release → 0.9.26063-pre-release

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.
Files changed (50) hide show
  1. package/build/Cli.js +3 -3
  2. package/build/api/Api.js +4 -2
  3. package/build/api/ApiNodeJS.js +3 -3
  4. package/build/api/ApiServices.js +69 -20
  5. package/build/{chunk-ZYVAYG57.js → chunk-2EVZAJOP.js} +3 -2
  6. package/build/{chunk-6UH5JW67.js → chunk-AKUYQ3K5.js} +26 -10
  7. package/build/{chunk-53U5PFPM.js → chunk-JQN6AIUU.js} +804 -719
  8. package/build/types/analysis/Analyzer.d.ts +8 -2
  9. package/build/types/analysis/NodeOrDiagnosticLocation.d.ts +2 -0
  10. package/build/types/analysis/ResolvedImplementationPackage.d.ts +1 -0
  11. package/build/types/common/MemoryUsage.d.ts +16 -0
  12. package/build/types/common/PerformanceMeasurement.d.ts +20 -12
  13. package/build/types/common/index.d.ts +1 -0
  14. package/build/types/diagnostic/Diagnostic.d.ts +2 -0
  15. package/build/types/diagnostic/DiagnosticCode.d.ts +34 -33
  16. package/build/types/emitter/IrFactory.d.ts +1 -1
  17. package/build/types/entities/EntityLocalizationContext.d.ts +6 -4
  18. package/build/types/entities/PackageEntityMembers.d.ts +3 -0
  19. package/build/types/entities/interfaces/FunctionTypeEntity.d.ts +1 -2
  20. package/build/types/entities/interfaces/PackageEntity.d.ts +1 -3
  21. package/build/types/entities/source/a/SourceFunctionTypeEntity.d.ts +1 -2
  22. package/build/types/entities/source/a/SourcePackageEntity.d.ts +1 -5
  23. package/build/types/entities/source/m/SourceFunctionTypeEntity.d.ts +1 -2
  24. package/build/types/entities/source/m/SourcePackageEntity.d.ts +1 -5
  25. package/build/types/entities/translated/BaseTranslatedTypeMemberAccessorEntity.d.ts +3 -2
  26. package/build/types/entities/translated/TranslatedAliasTypeEntity.d.ts +2 -2
  27. package/build/types/entities/translated/TranslatedDereferenceOperatorEntity.d.ts +3 -3
  28. package/build/types/entities/translated/TranslatedExtensionTypeEntity.d.ts +3 -3
  29. package/build/types/entities/translated/TranslatedFunctionEntity.d.ts +3 -3
  30. package/build/types/entities/translated/TranslatedFunctionTypeEntity.d.ts +3 -4
  31. package/build/types/entities/translated/TranslatedIndexerEntity.d.ts +4 -4
  32. package/build/types/entities/translated/TranslatedPackageEntity.d.ts +1 -3
  33. package/build/types/entities/translated/TranslatedPackageMemberAccessorEntity.d.ts +3 -2
  34. package/build/types/entities/translated/TranslatedParameterEntity.d.ts +3 -3
  35. package/build/types/entities/translated/TranslatedReducedTypeEntity.d.ts +2 -2
  36. package/build/types/entities/translated/TranslatedStructuredTypeEntity.d.ts +6 -6
  37. package/build/types/entities/translated/TranslatedTypeMemberAccessorEntity.d.ts +2 -2
  38. package/build/types/entities/translated/TranslatedTypeParameterEntity.d.ts +2 -2
  39. package/build/types/entities/translated/TranslatedVariableEntity.d.ts +5 -5
  40. package/build/types/entities/translated/TranslatedVariantTypeEntity.d.ts +3 -3
  41. package/build/types/entities/translated/source/m/SourceTranslatedIndexerEntity.d.ts +2 -2
  42. package/build/types/executor/Compiler.d.ts +2 -1
  43. package/build/types/executor/NodeCompiler.d.ts +4 -1
  44. package/build/types/project/Compilation.d.ts +3 -2
  45. package/build/types/project/CompilationLoader.d.ts +2 -1
  46. package/build/types/services/CustomRequests.d.ts +6 -1
  47. package/build/types/services/LanguageServer.d.ts +2 -0
  48. package/build/types/services/common/node-semantic-info/NodeSemanticInfoService.d.ts +2 -2
  49. package/build/types/ts-interop/TypeEntities.d.ts +0 -1
  50. package/package.json +1 -1
package/build/Cli.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CommandLineCompiler
4
- } from "./chunk-6UH5JW67.js";
5
- import "./chunk-ZYVAYG57.js";
4
+ } from "./chunk-AKUYQ3K5.js";
5
+ import "./chunk-2EVZAJOP.js";
6
6
  import {
7
7
  __async
8
- } from "./chunk-53U5PFPM.js";
8
+ } from "./chunk-JQN6AIUU.js";
9
9
 
10
10
  // source/Cli.ts
11
11
  function main() {
package/build/api/Api.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Compiler,
3
3
  DiagnosticFormatter
4
- } from "../chunk-ZYVAYG57.js";
4
+ } from "../chunk-2EVZAJOP.js";
5
5
  import {
6
6
  AccessKind,
7
7
  AccessedFunction_entity,
@@ -257,6 +257,7 @@ import {
257
257
  formatString,
258
258
  getFileExtension,
259
259
  getHelperPhrase,
260
+ getMemoryUsage,
260
261
  getOrCreateKeywordDictionary,
261
262
  getOrCreateKeywordKindDictionary,
262
263
  getRequiredTypeParameterCount,
@@ -321,7 +322,7 @@ import {
321
322
  withoutQuotes,
322
323
  withoutTemplateQuotes,
323
324
  yieldTask
324
- } from "../chunk-53U5PFPM.js";
325
+ } from "../chunk-JQN6AIUU.js";
325
326
  export {
326
327
  AccessKind,
327
328
  AccessedFunction_entity,
@@ -577,6 +578,7 @@ export {
577
578
  FileSystemTree_exports as fsTree,
578
579
  getFileExtension,
579
580
  getHelperPhrase,
581
+ getMemoryUsage,
580
582
  getOrCreateKeywordDictionary,
581
583
  getOrCreateKeywordKindDictionary,
582
584
  getRequiredTypeParameterCount,
@@ -6,9 +6,9 @@ import {
6
6
  PhysicalFileSystem,
7
7
  PhysicalTypeScriptLibrariesProvider,
8
8
  PrintingDiagnosticAcceptor
9
- } from "../chunk-6UH5JW67.js";
10
- import "../chunk-ZYVAYG57.js";
11
- import "../chunk-53U5PFPM.js";
9
+ } from "../chunk-AKUYQ3K5.js";
10
+ import "../chunk-2EVZAJOP.js";
11
+ import "../chunk-JQN6AIUU.js";
12
12
  export {
13
13
  CommandLineCompiler,
14
14
  FileSystemUri,
@@ -53,6 +53,7 @@ import {
53
53
  ParameterDeclaration_matchResultParameter,
54
54
  ParameterDeclaration_typeMember,
55
55
  ParameterDeclaration_universal,
56
+ PerformanceMeasurement,
56
57
  Position,
57
58
  ProgramPackageConfiguration,
58
59
  Query,
@@ -93,6 +94,7 @@ import {
93
94
  findTag,
94
95
  forEachChild,
95
96
  forEachChild2,
97
+ getMemoryUsage,
96
98
  getModifierKind,
97
99
  getOrCreateKeywordDictionary,
98
100
  getOrCreateKeywordDictionary2,
@@ -140,13 +142,15 @@ import {
140
142
  modifierKindsInSortOrder,
141
143
  operatorKinds,
142
144
  operatorKinds2,
145
+ performanceMeasurementStageNames,
146
+ performanceMeasurementStages,
143
147
  setUserLocale,
144
148
  sortModifiers,
145
149
  tokenKindByOperatorKind,
146
150
  traverseTreeAsync,
147
151
  traverseTreeAsync2,
148
152
  yieldTask
149
- } from "../chunk-53U5PFPM.js";
153
+ } from "../chunk-JQN6AIUU.js";
150
154
 
151
155
  // source/services/common/Types.ts
152
156
  import * as ls from "vscode-languageserver";
@@ -182,6 +186,8 @@ var NodeLocation = class {
182
186
  import * as ls2 from "vscode-languageserver";
183
187
  var CustomRequestType = class extends ls2.RequestType {
184
188
  };
189
+ var CustomRequestType0 = class extends ls2.RequestType0 {
190
+ };
185
191
  var CustomNotificationType = class extends ls2.NotificationType0 {
186
192
  };
187
193
  var customRequests = {
@@ -193,7 +199,8 @@ var customRequests = {
193
199
  emitCodeToString: new CustomRequestType("artel/emitCodeToString"),
194
200
  displayFileSystemTree: new CustomRequestType("artel/displayFileSystemTree"),
195
201
  createOrUpdateSourceFile: new CustomRequestType("artel/fs.createOrUpdateSourceFile"),
196
- deleteSourceFile: new CustomRequestType("artel/fs.deleteSourceFile")
202
+ deleteSourceFile: new CustomRequestType("artel/fs.deleteSourceFile"),
203
+ getMemoryUsage: new CustomRequestType0("artel/getMemoryUsage")
197
204
  };
198
205
  var customNotifications = {
199
206
  sourceFileDialectsChanged: new CustomNotificationType("artel/sourceFileDialectsChanged")
@@ -4189,15 +4196,15 @@ var DefaultSwitchMatchNodeSemanticInfo = class {
4189
4196
 
4190
4197
  // source/services/common/node-semantic-info/NodeSemanticInfoService.ts
4191
4198
  var NodeSemanticInfoService = class {
4192
- static getBetterReferenceTargetsOrPreserve(_analyzer, info) {
4199
+ static getBetterReferenceTargetsOrPreserve(analyzer, info) {
4193
4200
  const currentTargets = info.betterTargets ?? info.targets;
4194
- const betterTargets = currentTargets.map((t) => this.getBetterReferenceTargets(t)).filter((t) => t !== void 0).flat();
4201
+ const betterTargets = currentTargets.map((t) => this.getBetterReferenceTargets(analyzer, t)).filter((t) => t !== void 0).flat();
4195
4202
  if (isNonEmptyArray(betterTargets)) {
4196
4203
  return new ReferenceNodeSemanticInfo(info.targets, info.isAmbiguous, betterTargets);
4197
4204
  }
4198
4205
  return info;
4199
4206
  }
4200
- static getBetterReferenceTargets(original) {
4207
+ static getBetterReferenceTargets(analyzer, original) {
4201
4208
  let result;
4202
4209
  let currentTargets = [original];
4203
4210
  let betterTargets;
@@ -4223,7 +4230,9 @@ var NodeSemanticInfoService = class {
4223
4230
  let field;
4224
4231
  const translation = currentTarget.entity.translation;
4225
4232
  if (translation !== void 0) {
4226
- const localizationContext = translation.translationPackage.getLocalizationContext();
4233
+ const localizationContext = analyzer.getLocalizationContextForPackage(
4234
+ currentTarget.entity.getContainingPackage()
4235
+ );
4227
4236
  field = localizationContext.createLocalizedField(
4228
4237
  specialVariableInfo.fieldOrBaseConstructorParameter
4229
4238
  );
@@ -4235,7 +4244,9 @@ var NodeSemanticInfoService = class {
4235
4244
  let parameter;
4236
4245
  const translation = currentTarget.entity.translation;
4237
4246
  if (translation !== void 0) {
4238
- const localizationContext = translation.translationPackage.getLocalizationContext();
4247
+ const localizationContext = analyzer.getLocalizationContextForPackage(
4248
+ currentTarget.entity.getContainingPackage()
4249
+ );
4239
4250
  parameter = localizationContext.createLocalizedParameter(
4240
4251
  specialVariableInfo.fieldOrBaseConstructorParameter
4241
4252
  );
@@ -4283,7 +4294,9 @@ var NodeSemanticInfoService = class {
4283
4294
  let field;
4284
4295
  const translation = currentTarget.parameter.entity.translation;
4285
4296
  if (translation !== void 0) {
4286
- const localizationContext = translation.translationPackage.getLocalizationContext();
4297
+ const localizationContext = analyzer.getLocalizationContextForPackage(
4298
+ currentTarget.parameter.entity.getContainingPackage()
4299
+ );
4287
4300
  field = localizationContext.createLocalizedField(
4288
4301
  specialVariableInfo.fieldOrBaseConstructorParameter
4289
4302
  );
@@ -4295,7 +4308,9 @@ var NodeSemanticInfoService = class {
4295
4308
  let parameter;
4296
4309
  const translation = currentTarget.parameter.entity.translation;
4297
4310
  if (translation !== void 0) {
4298
- const localizationContext = translation.translationPackage.getLocalizationContext();
4311
+ const localizationContext = analyzer.getLocalizationContextForPackage(
4312
+ currentTarget.parameter.entity.getContainingPackage()
4313
+ );
4299
4314
  parameter = localizationContext.createLocalizedParameter(
4300
4315
  specialVariableInfo.fieldOrBaseConstructorParameter
4301
4316
  );
@@ -8233,13 +8248,8 @@ var ReferencesService = class {
8233
8248
  return { name: entity.getName() };
8234
8249
  case 2 /* Type */: {
8235
8250
  switch (entity.typeEntityKind) {
8236
- case 0 /* Function */: {
8237
- const naming = entity.getNaming();
8238
- if (naming.kind === "named") {
8239
- return { name: naming.value };
8240
- }
8251
+ case 0 /* Function */:
8241
8252
  return void 0;
8242
- }
8243
8253
  case 1 /* Structured */: {
8244
8254
  const naming = entity.getNaming();
8245
8255
  if (naming.kind === "named") {
@@ -11392,7 +11402,8 @@ var CompilationController = class extends RxObject2 {
11392
11402
  builtInStandardPackagesUri: this.config.builtInStandardPackagesUri,
11393
11403
  // Включаем логирование только при первой загрузке.
11394
11404
  enableLogging: this.config.enableLogging === true && this.previousCompilationLoadResult === void 0,
11395
- additionalPackageContents: this.config.additionalPackageContents
11405
+ additionalPackageContents: this.config.additionalPackageContents,
11406
+ performance: new PerformanceMeasurement()
11396
11407
  };
11397
11408
  const currentTransaction = Transaction.current;
11398
11409
  const loadResult = yield runNonReactive(() => __async(this, null, function* () {
@@ -19515,13 +19526,12 @@ var _LanguageServer = class _LanguageServer {
19515
19526
  (params) => this.onCreateOrUpdateSourceFile(params)
19516
19527
  );
19517
19528
  this.disposables.push(disposable);
19518
- disposable = this.connection.onRequest(
19519
- customRequests.deleteSourceFile,
19520
- (params) => this.onDeleteSourceFile(params)
19521
- );
19529
+ disposable = this.connection.onRequest(customRequests.deleteSourceFile, (params) => this.onDeleteSourceFile(params));
19522
19530
  this.disposables.push(disposable);
19523
19531
  disposable = this.connection.onRequest(customRequests.getSourceFileDialect, (params, token) => this.withTaskController(token, (taskController) => this.onGetSourceFileDialect(params, taskController)));
19524
19532
  this.disposables.push(disposable);
19533
+ disposable = this.connection.onRequest(customRequests.getMemoryUsage, () => this.onGetMemoryUsage());
19534
+ this.disposables.push(disposable);
19525
19535
  this.connection.listen();
19526
19536
  }
19527
19537
  dispose() {
@@ -20238,6 +20248,11 @@ var _LanguageServer = class _LanguageServer {
20238
20248
  return result;
20239
20249
  });
20240
20250
  }
20251
+ onGetMemoryUsage() {
20252
+ return __async(this, null, function* () {
20253
+ return getMemoryUsage();
20254
+ });
20255
+ }
20241
20256
  onEmitCodeToString(params, taskController) {
20242
20257
  return __async(this, null, function* () {
20243
20258
  let compilationControllerUri;
@@ -20266,7 +20281,14 @@ var _LanguageServer = class _LanguageServer {
20266
20281
  if (compilationController.mainCompilationState === void 0) {
20267
20282
  return { hasErrors: true, filesWithErrors: [] };
20268
20283
  }
20284
+ let performance2;
20269
20285
  const compilationState = compilationController.mainCompilationState;
20286
+ if (params.measurePerformance === true) {
20287
+ performance2 = compilationState.analyzer.compilation.performance;
20288
+ performance2?.reset();
20289
+ performance2?.enable();
20290
+ performance2?.markCompilationStart();
20291
+ }
20270
20292
  const filesWithErrors = new Array();
20271
20293
  const trackedSourceFiles = this.workspace.trackedSourceFiles.createItemsSnapshot();
20272
20294
  const packageGraph = new SourcePackageDependencyGraph(compilationState.analyzer);
@@ -20286,6 +20308,7 @@ var _LanguageServer = class _LanguageServer {
20286
20308
  }
20287
20309
  }
20288
20310
  if (hasErrors) {
20311
+ performance2?.disable();
20289
20312
  return { hasErrors, filesWithErrors };
20290
20313
  }
20291
20314
  const options7 = {
@@ -20303,9 +20326,35 @@ var _LanguageServer = class _LanguageServer {
20303
20326
  ${e}`);
20304
20327
  result = { hasErrors: true, filesWithErrors: [] };
20305
20328
  }
20329
+ if (params.measurePerformance === true) {
20330
+ performance2?.markCompilationEnd();
20331
+ performance2?.disable();
20332
+ if (performance2 !== void 0) {
20333
+ const message = this.getPerformanceMeasurementResultMessage(performance2);
20334
+ Logger.info("\n" + message);
20335
+ }
20336
+ }
20306
20337
  return result;
20307
20338
  });
20308
20339
  }
20340
+ getPerformanceMeasurementResultMessage(performance2) {
20341
+ let result = "";
20342
+ for (const stage of performanceMeasurementStages) {
20343
+ if (result !== "") {
20344
+ result += "\n";
20345
+ }
20346
+ const duration = performance2.getDurationMs(stage);
20347
+ result += `${performanceMeasurementStageNames[stage]}: ${duration.toFixed(2)}ms`;
20348
+ }
20349
+ const total = performance2.getTotalCompilationTimeMs();
20350
+ if (total !== -1) {
20351
+ if (result !== "") {
20352
+ result += "\n";
20353
+ }
20354
+ result += `Total: ${total.toFixed(2)}ms`;
20355
+ }
20356
+ return result;
20357
+ }
20309
20358
  onProvideServerOwnedDocumentContent(params, taskController) {
20310
20359
  return __async(this, null, function* () {
20311
20360
  const vscodeUri = URI.parse(params.uri);
@@ -11,7 +11,7 @@ import {
11
11
  WellKnownDeclarationsLoadError,
12
12
  __async,
13
13
  createTsInteropInputsForCompilation
14
- } from "./chunk-53U5PFPM.js";
14
+ } from "./chunk-JQN6AIUU.js";
15
15
 
16
16
  // source/diagnostic/DiagnosticFormatter.ts
17
17
  var DiagnosticFormatter = class _DiagnosticFormatter {
@@ -150,7 +150,8 @@ var Compiler = class {
150
150
  treatRootAsPackageIfConfigIsMissing: true,
151
151
  userStandardPackagesUri: options?.userStandardPackagesUri,
152
152
  builtInStandardPackagesUri: options?.builtInStandardPackagesUri,
153
- enableLogging: options?.enableLogging
153
+ enableLogging: options?.enableLogging,
154
+ performance: options?.performance
154
155
  };
155
156
  const { loadResult } = yield CompilationLoader.loadUsingSourcesProvider(
156
157
  projectUri,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Compiler,
3
3
  DiagnosticFormatter
4
- } from "./chunk-ZYVAYG57.js";
4
+ } from "./chunk-2EVZAJOP.js";
5
5
  import {
6
6
  ArtelVersion,
7
7
  Cached,
@@ -16,7 +16,7 @@ import {
16
16
  __async,
17
17
  performanceMeasurementStageNames,
18
18
  performanceMeasurementStages
19
- } from "./chunk-53U5PFPM.js";
19
+ } from "./chunk-JQN6AIUU.js";
20
20
 
21
21
  // source/executor/FileSystemUri.ts
22
22
  import { platform } from "os";
@@ -251,7 +251,8 @@ var NodeCompiler = class {
251
251
  workspaceUri: options?.workspacePath !== void 0 ? FileSystemUri.pathToUri(options.workspacePath) : void 0,
252
252
  builtInStandardPackagesUri,
253
253
  userStandardPackagesUri: options?.userStandardPackagesPath !== void 0 ? FileSystemUri.pathToUri(options.userStandardPackagesPath) : void 0,
254
- enableLogging: options?.enableLogging
254
+ enableLogging: options?.enableLogging,
255
+ performance: options?.performance
255
256
  };
256
257
  return yield Compiler.loadCompilation(
257
258
  projectUri,
@@ -292,6 +293,14 @@ var NodeCompiler = class {
292
293
  });
293
294
  }
294
295
  static compile(task) {
296
+ return __async(this, null, function* () {
297
+ task.performance?.markCompilationStart();
298
+ const launchPath = yield this.compileWithoutMeasurement(task);
299
+ task.performance?.markCompilationEnd();
300
+ return launchPath;
301
+ });
302
+ }
303
+ static compileWithoutMeasurement(task) {
295
304
  return __async(this, null, function* () {
296
305
  const inputPaths = {
297
306
  projectPath: task.projectPath,
@@ -311,6 +320,9 @@ var NodeCompiler = class {
311
320
  if (typeScriptLibrariesProvider === void 0) {
312
321
  return void 0;
313
322
  }
323
+ if (task.loadCompilationOptions !== void 0) {
324
+ task.loadCompilationOptions.performance ??= task.performance;
325
+ }
314
326
  const compilation = yield this.loadCompilation(
315
327
  task.projectPath,
316
328
  typeScriptLibrariesProvider,
@@ -404,9 +416,8 @@ var CommandLineCompiler = class {
404
416
  if (parsedArguments.projectPath === void 0 || parsedArguments.outputPath === void 0) {
405
417
  return this.errorExitCode;
406
418
  }
407
- if (parsedArguments.measurePerformance) {
408
- PerformanceMeasurement.isEnabled = true;
409
- }
419
+ const performance = parsedArguments.measurePerformance ? new PerformanceMeasurement() : void 0;
420
+ performance?.enable();
410
421
  try {
411
422
  const diagnostics = new PrintingDiagnosticAcceptor(parsedArguments.noWarnings);
412
423
  const compilerTask = {
@@ -431,6 +442,7 @@ var CommandLineCompiler = class {
431
442
  },
432
443
  embedSyntaxNodePaths: parsedArguments.embedSyntaxNodePathsIntoCompiledCode
433
444
  },
445
+ performance,
434
446
  controller: new TaskController(-1)
435
447
  };
436
448
  const launchPath = yield NodeCompiler.compile(compilerTask);
@@ -446,8 +458,8 @@ ${e}
446
458
  ${e.stack}`);
447
459
  return this.errorExitCode;
448
460
  }
449
- if (parsedArguments.measurePerformance) {
450
- this.displayPerformanceMeasurementResults();
461
+ if (parsedArguments.measurePerformance && performance !== void 0) {
462
+ this.displayPerformanceMeasurementResults(performance);
451
463
  }
452
464
  return this.successExitCode;
453
465
  });
@@ -463,11 +475,15 @@ ${e.stack}`);
463
475
  console.log("artel start <program folder> <build folder>");
464
476
  console.log("artel build <program folder> <build folder>");
465
477
  }
466
- static displayPerformanceMeasurementResults() {
478
+ static displayPerformanceMeasurementResults(performance) {
467
479
  for (const stage of performanceMeasurementStages) {
468
- const duration = PerformanceMeasurement.getDurationMs(stage);
480
+ const duration = performance.getDurationMs(stage);
469
481
  console.log(`${performanceMeasurementStageNames[stage]}: ${duration.toFixed(2)}ms`);
470
482
  }
483
+ const total = performance.getTotalCompilationTimeMs();
484
+ if (total !== -1) {
485
+ console.log(`Total: ${total.toFixed(2)}ms`);
486
+ }
471
487
  }
472
488
  static execute(launchPath, cwdPath) {
473
489
  return __async(this, null, function* () {