@artel/artc 0.9.26062 → 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.
package/build/Cli.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CommandLineCompiler
4
- } from "./chunk-RUKQMGYY.js";
5
- import "./chunk-GFFPHR5G.js";
4
+ } from "./chunk-AKUYQ3K5.js";
5
+ import "./chunk-2EVZAJOP.js";
6
6
  import {
7
7
  __async
8
- } from "./chunk-JHXUTWHI.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-GFFPHR5G.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-JHXUTWHI.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-RUKQMGYY.js";
10
- import "../chunk-GFFPHR5G.js";
11
- import "../chunk-JHXUTWHI.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-JHXUTWHI.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")
@@ -11395,7 +11402,8 @@ var CompilationController = class extends RxObject2 {
11395
11402
  builtInStandardPackagesUri: this.config.builtInStandardPackagesUri,
11396
11403
  // Включаем логирование только при первой загрузке.
11397
11404
  enableLogging: this.config.enableLogging === true && this.previousCompilationLoadResult === void 0,
11398
- additionalPackageContents: this.config.additionalPackageContents
11405
+ additionalPackageContents: this.config.additionalPackageContents,
11406
+ performance: new PerformanceMeasurement()
11399
11407
  };
11400
11408
  const currentTransaction = Transaction.current;
11401
11409
  const loadResult = yield runNonReactive(() => __async(this, null, function* () {
@@ -19518,13 +19526,12 @@ var _LanguageServer = class _LanguageServer {
19518
19526
  (params) => this.onCreateOrUpdateSourceFile(params)
19519
19527
  );
19520
19528
  this.disposables.push(disposable);
19521
- disposable = this.connection.onRequest(
19522
- customRequests.deleteSourceFile,
19523
- (params) => this.onDeleteSourceFile(params)
19524
- );
19529
+ disposable = this.connection.onRequest(customRequests.deleteSourceFile, (params) => this.onDeleteSourceFile(params));
19525
19530
  this.disposables.push(disposable);
19526
19531
  disposable = this.connection.onRequest(customRequests.getSourceFileDialect, (params, token) => this.withTaskController(token, (taskController) => this.onGetSourceFileDialect(params, taskController)));
19527
19532
  this.disposables.push(disposable);
19533
+ disposable = this.connection.onRequest(customRequests.getMemoryUsage, () => this.onGetMemoryUsage());
19534
+ this.disposables.push(disposable);
19528
19535
  this.connection.listen();
19529
19536
  }
19530
19537
  dispose() {
@@ -20241,6 +20248,11 @@ var _LanguageServer = class _LanguageServer {
20241
20248
  return result;
20242
20249
  });
20243
20250
  }
20251
+ onGetMemoryUsage() {
20252
+ return __async(this, null, function* () {
20253
+ return getMemoryUsage();
20254
+ });
20255
+ }
20244
20256
  onEmitCodeToString(params, taskController) {
20245
20257
  return __async(this, null, function* () {
20246
20258
  let compilationControllerUri;
@@ -20269,7 +20281,14 @@ var _LanguageServer = class _LanguageServer {
20269
20281
  if (compilationController.mainCompilationState === void 0) {
20270
20282
  return { hasErrors: true, filesWithErrors: [] };
20271
20283
  }
20284
+ let performance2;
20272
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
+ }
20273
20292
  const filesWithErrors = new Array();
20274
20293
  const trackedSourceFiles = this.workspace.trackedSourceFiles.createItemsSnapshot();
20275
20294
  const packageGraph = new SourcePackageDependencyGraph(compilationState.analyzer);
@@ -20289,6 +20308,7 @@ var _LanguageServer = class _LanguageServer {
20289
20308
  }
20290
20309
  }
20291
20310
  if (hasErrors) {
20311
+ performance2?.disable();
20292
20312
  return { hasErrors, filesWithErrors };
20293
20313
  }
20294
20314
  const options7 = {
@@ -20306,9 +20326,35 @@ var _LanguageServer = class _LanguageServer {
20306
20326
  ${e}`);
20307
20327
  result = { hasErrors: true, filesWithErrors: [] };
20308
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
+ }
20309
20337
  return result;
20310
20338
  });
20311
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
+ }
20312
20358
  onProvideServerOwnedDocumentContent(params, taskController) {
20313
20359
  return __async(this, null, function* () {
20314
20360
  const vscodeUri = URI.parse(params.uri);
@@ -11,7 +11,7 @@ import {
11
11
  WellKnownDeclarationsLoadError,
12
12
  __async,
13
13
  createTsInteropInputsForCompilation
14
- } from "./chunk-JHXUTWHI.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-GFFPHR5G.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-JHXUTWHI.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* () {
@@ -782,7 +782,7 @@ var UniqueWithComparatorQuery = class extends Query {
782
782
  };
783
783
 
784
784
  // source/common/Constants.ts
785
- var ArtelVersion = true ? "0.9.26062" : "";
785
+ var ArtelVersion = true ? "0.9.26063-pre-release" : "";
786
786
  var ArtelSourceFileExtensions = [".\u0430\u0440\u0442", ".\u0430\u0440\u0442\u0435\u043B\u044C", ".art", ".artel", ".\u0430\u0440\u0442\u043C", ".\u0430\u0440\u0442\u0435\u043B\u044C\u043C", ".artm", ".artelm"];
787
787
  var ArtelSourceFileExtensionSet = new Set(ArtelSourceFileExtensions);
788
788
  var ArtelSourceAndConfigurationFileExtensionSet = new Set(ArtelSourceFileExtensionSet).add(".json");
@@ -839,23 +839,44 @@ var Debug = class {
839
839
 
840
840
  // source/common/PerformanceMeasurement.ts
841
841
  var PerformanceMeasurement = class {
842
- static {
842
+ constructor() {
843
843
  this.isEnabled = false;
844
- }
845
- static {
846
844
  this.durations = /* @__PURE__ */ new Map();
847
- }
848
- static {
849
845
  this.measureInfoStack = new Array();
846
+ this.compilationStartTime = -1;
847
+ this.compilationEndTime = -1;
848
+ }
849
+ enable() {
850
+ this.isEnabled = true;
851
+ }
852
+ disable() {
853
+ this.isEnabled = false;
854
+ }
855
+ markCompilationStart() {
856
+ if (this.isEnabled) {
857
+ this.compilationStartTime = this.nowMs();
858
+ }
859
+ }
860
+ markCompilationEnd() {
861
+ if (this.isEnabled) {
862
+ this.compilationEndTime = this.nowMs();
863
+ }
864
+ }
865
+ getTotalCompilationTimeMs() {
866
+ if (this.compilationStartTime === -1) {
867
+ return -1;
868
+ }
869
+ const compilationEndTime = this.compilationEndTime !== -1 ? this.compilationEndTime : this.nowMs();
870
+ return compilationEndTime - this.compilationStartTime;
850
871
  }
851
- static markStart(label) {
872
+ markStart(label) {
852
873
  if (this.isEnabled) {
853
874
  const startTime = this.nowMs();
854
875
  const measureInfo = { label, startTime, nestedMeasurementsTime: 0 };
855
876
  this.measureInfoStack.push(measureInfo);
856
877
  }
857
878
  }
858
- static markEnd() {
879
+ markEnd() {
859
880
  if (this.isEnabled) {
860
881
  const endTime = this.nowMs();
861
882
  const measureInfo = this.measureInfoStack.pop();
@@ -871,35 +892,40 @@ var PerformanceMeasurement = class {
871
892
  }
872
893
  }
873
894
  }
874
- static getDurationMs(label) {
895
+ getDurationMs(label) {
875
896
  return this.durations.get(label) ?? 0;
876
897
  }
877
- static reset() {
898
+ reset() {
878
899
  this.durations.clear();
879
900
  this.measureInfoStack.length = 0;
901
+ this.compilationStartTime = -1;
902
+ this.compilationEndTime = -1;
880
903
  }
881
- static nowMs() {
904
+ nowMs() {
882
905
  return typeof performance === "object" ? performance.now() : Date.now();
883
906
  }
884
907
  };
885
908
  var PerformanceMeasurementStage = /* @__PURE__ */ ((PerformanceMeasurementStage2) => {
886
909
  PerformanceMeasurementStage2[PerformanceMeasurementStage2["Parsing"] = 0] = "Parsing";
887
- PerformanceMeasurementStage2[PerformanceMeasurementStage2["Analyzing"] = 1] = "Analyzing";
888
- PerformanceMeasurementStage2[PerformanceMeasurementStage2["Emitting"] = 2] = "Emitting";
889
- PerformanceMeasurementStage2[PerformanceMeasurementStage2["IO"] = 3] = "IO";
910
+ PerformanceMeasurementStage2[PerformanceMeasurementStage2["InitializingTsInterop"] = 1] = "InitializingTsInterop";
911
+ PerformanceMeasurementStage2[PerformanceMeasurementStage2["Analyzing"] = 2] = "Analyzing";
912
+ PerformanceMeasurementStage2[PerformanceMeasurementStage2["Emitting"] = 3] = "Emitting";
913
+ PerformanceMeasurementStage2[PerformanceMeasurementStage2["IO"] = 4] = "IO";
890
914
  return PerformanceMeasurementStage2;
891
915
  })(PerformanceMeasurementStage || {});
892
916
  var performanceMeasurementStages = [
893
917
  0 /* Parsing */,
894
- 1 /* Analyzing */,
895
- 2 /* Emitting */,
896
- 3 /* IO */
918
+ 1 /* InitializingTsInterop */,
919
+ 2 /* Analyzing */,
920
+ 3 /* Emitting */,
921
+ 4 /* IO */
897
922
  ];
898
923
  var performanceMeasurementStageNames = {
899
924
  [0 /* Parsing */]: "Parsing",
900
- [1 /* Analyzing */]: "Analyzing",
901
- [2 /* Emitting */]: "Emitting",
902
- [3 /* IO */]: "I/O"
925
+ [1 /* InitializingTsInterop */]: "Initializing TS interop",
926
+ [2 /* Analyzing */]: "Analyzing",
927
+ [3 /* Emitting */]: "Emitting",
928
+ [4 /* IO */]: "I/O"
903
929
  };
904
930
 
905
931
  // source/common/TaskController.ts
@@ -5121,6 +5147,40 @@ ${stackTrace}`;
5121
5147
  }
5122
5148
  };
5123
5149
 
5150
+ // source/common/MemoryUsage.ts
5151
+ function getMemoryUsage() {
5152
+ return tryGetNodeMemoryUsage() ?? tryGetBrowserMemoryUsage();
5153
+ }
5154
+ function tryGetNodeMemoryUsage() {
5155
+ if (typeof process !== "object" || typeof process.memoryUsage !== "function") {
5156
+ return void 0;
5157
+ }
5158
+ const usage = process.memoryUsage();
5159
+ return {
5160
+ kind: "node",
5161
+ rss: usage.rss,
5162
+ heapTotal: usage.heapTotal,
5163
+ heapUsed: usage.heapUsed,
5164
+ external: usage.external,
5165
+ arrayBuffers: usage.arrayBuffers
5166
+ };
5167
+ }
5168
+ function tryGetBrowserMemoryUsage() {
5169
+ if (typeof performance !== "object") {
5170
+ return void 0;
5171
+ }
5172
+ const memory = performance.memory;
5173
+ if (memory === void 0 || typeof memory.usedJSHeapSize !== "number" || typeof memory.totalJSHeapSize !== "number" || typeof memory.jsHeapSizeLimit !== "number") {
5174
+ return void 0;
5175
+ }
5176
+ return {
5177
+ kind: "browser",
5178
+ usedJSHeapSize: memory.usedJSHeapSize,
5179
+ totalJSHeapSize: memory.totalJSHeapSize,
5180
+ jsHeapSizeLimit: memory.jsHeapSizeLimit
5181
+ };
5182
+ }
5183
+
5124
5184
  // source/common/NonEmptyArray.ts
5125
5185
  function createNonEmptyArray(array) {
5126
5186
  if (array !== void 0) {
@@ -22565,10 +22625,7 @@ var Parser = class {
22565
22625
  this.parser = new TextParser(text, locale ?? DefaultLocale);
22566
22626
  }
22567
22627
  parse() {
22568
- PerformanceMeasurement.markStart(0 /* Parsing */);
22569
- const result = this.parser.parseSourceFile();
22570
- PerformanceMeasurement.markEnd();
22571
- return result;
22628
+ return this.parser.parseSourceFile();
22572
22629
  }
22573
22630
  };
22574
22631
  var TextParser = class {
@@ -26864,10 +26921,7 @@ var Parser2 = class {
26864
26921
  this.parser = new TextParser2(text, locale ?? DefaultLocale);
26865
26922
  }
26866
26923
  parse() {
26867
- PerformanceMeasurement.markStart(0 /* Parsing */);
26868
- const result = this.parser.parseSourceFile();
26869
- PerformanceMeasurement.markEnd();
26870
- return result;
26924
+ return this.parser.parseSourceFile();
26871
26925
  }
26872
26926
  };
26873
26927
  var TextParser2 = class {
@@ -30552,7 +30606,13 @@ var SourceFileA = class _SourceFileA extends BaseSourceFile {
30552
30606
  super(text, uri, version);
30553
30607
  this.dialect = 0 /* ArtelA */;
30554
30608
  if (node === void 0) {
30555
- this.node = new Lazy(() => new Parser(this.text, this.locale).parse());
30609
+ this.node = new Lazy(() => {
30610
+ const performance2 = this.package.compilation.performance;
30611
+ performance2?.markStart(0 /* Parsing */);
30612
+ const result = new Parser(this.text, this.locale).parse();
30613
+ performance2?.markEnd();
30614
+ return result;
30615
+ });
30556
30616
  } else {
30557
30617
  this.node = Lazy.immediate(node);
30558
30618
  }
@@ -30583,7 +30643,13 @@ var SourceFileM = class _SourceFileM extends BaseSourceFile {
30583
30643
  super(text, uri, version);
30584
30644
  this.dialect = 1 /* ArtelM */;
30585
30645
  if (node === void 0) {
30586
- this.node = new Lazy(() => new Parser2(this.text, this.locale).parse());
30646
+ this.node = new Lazy(() => {
30647
+ const performance2 = this.package.compilation.performance;
30648
+ performance2?.markStart(0 /* Parsing */);
30649
+ const result = new Parser2(this.text, this.locale).parse();
30650
+ performance2?.markEnd();
30651
+ return result;
30652
+ });
30587
30653
  } else {
30588
30654
  this.node = Lazy.immediate(node);
30589
30655
  }
@@ -38227,6 +38293,7 @@ IntrinsicTypeParameterEntity = __decorateClass([
38227
38293
  var PackageEntityMembers = class _PackageEntityMembers {
38228
38294
  constructor(namedMembers, textTranslations) {
38229
38295
  this.membersByNameKey_ = new Cached();
38296
+ this.typeExtensionsByExtendedType_ = new Cached();
38230
38297
  this.textTranslationsByTextKey_ = new Cached();
38231
38298
  this.namedMembers = namedMembers;
38232
38299
  this.textTranslations = textTranslations;
@@ -38235,12 +38302,32 @@ var PackageEntityMembers = class _PackageEntityMembers {
38235
38302
  static {
38236
38303
  this.emptyNamedMembers = [];
38237
38304
  }
38305
+ static {
38306
+ this.emptyExtensionTypes = [];
38307
+ }
38238
38308
  static {
38239
38309
  this.emptyTextTranslations = [];
38240
38310
  }
38241
38311
  get membersByNameKey() {
38242
38312
  return this.membersByNameKey_.getOrInsertWith(() => Query.groupByToMap(this.namedMembers, (m) => m.getName().key));
38243
38313
  }
38314
+ get typeExtensionsByExtendedType() {
38315
+ return this.typeExtensionsByExtendedType_.getOrInsertWith(() => {
38316
+ const result = /* @__PURE__ */ new Map();
38317
+ for (const extensionType of this.extensionTypes) {
38318
+ const extendedTypeEntity = extensionType.getExtendedType().entity?.originalEntity;
38319
+ if (extendedTypeEntity !== void 0) {
38320
+ let group = result.get(extendedTypeEntity);
38321
+ if (group === void 0) {
38322
+ group = [];
38323
+ result.set(extendedTypeEntity, group);
38324
+ }
38325
+ group.push(extensionType);
38326
+ }
38327
+ }
38328
+ return result;
38329
+ });
38330
+ }
38244
38331
  get textTranslationsByTextKey() {
38245
38332
  return this.textTranslationsByTextKey_.getOrInsertWith(
38246
38333
  () => Query.groupByToMap(this.textTranslations, (d) => d.getKey())
@@ -38256,7 +38343,10 @@ var PackageEntityMembers = class _PackageEntityMembers {
38256
38343
  return this.extensionTypes;
38257
38344
  }
38258
38345
  getExtensionTypesByType(type) {
38259
- return this.extensionTypes.filter((t) => t.getExtendedType().entity?.originalEntity === type.originalEntity);
38346
+ if (this.extensionTypes.length === 0) {
38347
+ return _PackageEntityMembers.emptyExtensionTypes;
38348
+ }
38349
+ return this.typeExtensionsByExtendedType.get(type.originalEntity) ?? _PackageEntityMembers.emptyExtensionTypes;
38260
38350
  }
38261
38351
  getTextTranslations() {
38262
38352
  return this.textTranslations;
@@ -38474,7 +38564,7 @@ var MissingImplementationPackageReporter = class {
38474
38564
 
38475
38565
  // source/project/Compilation.ts
38476
38566
  var Compilation = class {
38477
- constructor(uri, mainPackage, userPackages, libraryPackages) {
38567
+ constructor(uri, mainPackage, userPackages, libraryPackages, performance2) {
38478
38568
  this.parsedSourceFiles = /* @__PURE__ */ new Map();
38479
38569
  this.packageByUri = new Lazy(() => Query.toMap(this.allPackages, (p) => p.uri.toString(), (p) => p));
38480
38570
  this.sourceFileByUri = new Lazy(() => Query.from(this.allPackages).flatMap((p) => p.sourceFiles).toMap((f) => f.uri.toString(), (f) => f));
@@ -38487,6 +38577,7 @@ var Compilation = class {
38487
38577
  this.libraryPackages = libraryPackages;
38488
38578
  this.allPackages = userPackages.concat(libraryPackages);
38489
38579
  this.allPackages.forEach((p) => p.setCompilation(this));
38580
+ this.performance = performance2;
38490
38581
  }
38491
38582
  getSourceFileByUri(uri) {
38492
38583
  return this.sourceFileByUri.value.get(uri.toString());
@@ -40581,7 +40672,7 @@ var CompilationLoader = class _CompilationLoader {
40581
40672
  return __async(this, null, function* () {
40582
40673
  const fileSystemTree = runTransactional(() => new FileSystemTree());
40583
40674
  const namesOfDirectoriesToIgnoreSet = new Set(namesOfDirectoriesToIgnore ?? DefaultNamesOfDirectoriesToIgnore);
40584
- PerformanceMeasurement.markStart(3 /* IO */);
40675
+ options?.performance?.markStart(4 /* IO */);
40585
40676
  const rootDirectory = yield runTransactional(() => _CompilationLoader.loadArtelFiles(
40586
40677
  uri,
40587
40678
  sourcesProvider,
@@ -40591,7 +40682,7 @@ var CompilationLoader = class _CompilationLoader {
40591
40682
  options?.builtInStandardPackagesUri,
40592
40683
  namesOfDirectoriesToIgnoreSet
40593
40684
  ));
40594
- PerformanceMeasurement.markEnd();
40685
+ options?.performance?.markEnd();
40595
40686
  const internalConfig = this.convertOptions(options);
40596
40687
  const source = new CompilationLoadSource.FSTreeAndPackageContents(
40597
40688
  rootDirectory,
@@ -40679,7 +40770,8 @@ var CompilationLoader = class _CompilationLoader {
40679
40770
  provideConfiguration: options?.provideConfiguration,
40680
40771
  userStandardPackagesUri: options?.userStandardPackagesUri,
40681
40772
  enableLogging: options?.enableLogging ?? false,
40682
- builtInStandardPackagesUri: options?.builtInStandardPackagesUri
40773
+ builtInStandardPackagesUri: options?.builtInStandardPackagesUri,
40774
+ performance: options?.performance
40683
40775
  };
40684
40776
  return result;
40685
40777
  }
@@ -40821,7 +40913,13 @@ var CompilationLoader = class _CompilationLoader {
40821
40913
  } else {
40822
40914
  Debug.never(this.source);
40823
40915
  }
40824
- const compilation = new Compilation(compilationUri, mainPackage, userPackages, libraryPackages);
40916
+ const compilation = new Compilation(
40917
+ compilationUri,
40918
+ mainPackage,
40919
+ userPackages,
40920
+ libraryPackages,
40921
+ this.config.performance
40922
+ );
40825
40923
  if (this.config.enableLogging) {
40826
40924
  if (this.source.kind === "fs-tree-and-package-contents") {
40827
40925
  Logger.info(`\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u043F\u0440\u043E\u0435\u043A\u0442\u0430 \u043F\u043E \u043F\u0443\u0442\u0438 '${this.source.rootDirectory.uri}' \u0443\u0441\u043F\u0435\u0448\u043D\u043E \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u0430.`);
@@ -45425,11 +45523,11 @@ function callExpression(expression, isOptionalAccess, args, isAsyncFunctionCall,
45425
45523
  sourceLocation
45426
45524
  );
45427
45525
  }
45428
- function functionCallExpression(func, args, sourceLocation) {
45526
+ function functionCallExpression(func, args, sourceLocation, nameSourceLocation) {
45429
45527
  const accessedFunction2 = func instanceof AccessedFunction ? func : AccessedFunction.fromEntity(func);
45430
45528
  const argsNode = args instanceof Array ? new OrderedArguments(args) : args;
45431
45529
  return new CallExpression3(
45432
- new FunctionAccessExpression(accessedFunction2, true),
45530
+ new FunctionAccessExpression(accessedFunction2, true, nameSourceLocation),
45433
45531
  false,
45434
45532
  argsNode,
45435
45533
  accessedFunction2.entity.details.isAsync,
@@ -50013,12 +50111,18 @@ var WrapperTypeAndExtensionMembersAccessLowering = class extends ExecutableCodeL
50013
50111
  return { expression, tempVariables };
50014
50112
  }
50015
50113
  createCallOfMethodWithExplicitReceiver(entity, receiver, args, returnType, sourceLocation, nameSourceLocation) {
50114
+ Debug.assertNotNull(entity.ifTypeMemberThenContainingType, "\u041E\u0436\u0438\u0434\u0430\u043B\u0441\u044F \u043C\u0435\u0442\u043E\u0434.");
50115
+ const typeAccess = typeAccessExpression(
50116
+ entity.ifTypeMemberThenContainingType,
50117
+ nameSourceLocation ?? sourceLocation,
50118
+ nameSourceLocation
50119
+ );
50016
50120
  const newArguments = orderedArguments([receiver, ...args.values], args.sourceLocation);
50017
50121
  const options = new CallExpressionEmitOptions().setIsWrapperOrExtensionMethodCallLowered(true);
50018
50122
  return staticMethodCallExpression(
50019
50123
  accessedFunction(entity, returnType),
50020
50124
  newArguments,
50021
- void 0,
50125
+ typeAccess,
50022
50126
  sourceLocation,
50023
50127
  nameSourceLocation
50024
50128
  ).withOptions(options);
@@ -50561,7 +50665,12 @@ var CompoundDeclarationsAndOperatorsAccessLowering = class extends ExecutableCod
50561
50665
  lowerComputedPackageVariableGetAccessExpression(node) {
50562
50666
  const getter = node.variable.entity.getter;
50563
50667
  Debug.assertNotNull(getter);
50564
- return functionCallExpression(accessedFunction(getter, node.variable.type), []);
50668
+ return functionCallExpression(
50669
+ accessedFunction(getter, node.variable.type),
50670
+ [],
50671
+ node.sourceLocation,
50672
+ node.sourceLocation
50673
+ );
50565
50674
  }
50566
50675
  lowerComputedPackageVariableSetAccessExpression(left, operatorKind, right, operator, sourceLocation) {
50567
50676
  let value;
@@ -50577,7 +50686,8 @@ var CompoundDeclarationsAndOperatorsAccessLowering = class extends ExecutableCod
50577
50686
  const callExpression3 = functionCallExpression(
50578
50687
  accessedFunction(setter, left.variable.type),
50579
50688
  [value],
50580
- sourceLocation
50689
+ sourceLocation,
50690
+ left.sourceLocation
50581
50691
  );
50582
50692
  return callExpression3;
50583
50693
  }
@@ -51378,14 +51488,14 @@ var UsagesLowering = class _UsagesLowering extends ExecutableCodeLowering {
51378
51488
  const containingType = node.field.entity.ifTypeMemberThenContainingType;
51379
51489
  Debug.assertNotNull(containingType);
51380
51490
  if (!(node.expression.kind === 67 /* TypeAccessExpression */ && node.expression.entity === containingType)) {
51381
- node.expression = typeAccessExpression(containingType);
51491
+ node.expression = typeAccessExpression(containingType, node.expression.sourceLocation);
51382
51492
  }
51383
51493
  }
51384
51494
  lowerStaticMethodAccess(node) {
51385
51495
  const containingType = node.method.entity.ifTypeMemberThenContainingType;
51386
51496
  Debug.assertNotNull(containingType);
51387
51497
  if (!(node.expression.kind === 67 /* TypeAccessExpression */ && node.expression.entity === containingType)) {
51388
- node.expression = typeAccessExpression(containingType);
51498
+ node.expression = typeAccessExpression(containingType, node.expression.sourceLocation);
51389
51499
  }
51390
51500
  }
51391
51501
  lowerErrorStatement(node) {
@@ -54903,7 +55013,8 @@ var IrBuilderA = class {
54903
55013
  expression = functionCallExpression(
54904
55014
  accessedFunction(entity, returnType),
54905
55015
  args,
54906
- this.getSourceLocation(tag)
55016
+ this.getSourceLocation(tag),
55017
+ this.getSourceLocation(tag.name)
54907
55018
  );
54908
55019
  }
54909
55020
  return decorator(expression, this.getSourceLocation(tag));
@@ -57035,7 +57146,8 @@ var IrBuilderM = class {
57035
57146
  expression = functionCallExpression(
57036
57147
  accessedFunction(entity, returnType),
57037
57148
  args,
57038
- this.getSourceLocation(tag)
57149
+ this.getSourceLocation(tag),
57150
+ this.getSourceLocation(tag.name)
57039
57151
  );
57040
57152
  }
57041
57153
  return decorator(expression, this.getSourceLocation(tag));
@@ -58774,7 +58886,7 @@ var Emitter = class _Emitter {
58774
58886
  }
58775
58887
  emitToFileSystem(outputUri, outputAcceptor, taskController) {
58776
58888
  return __async(this, null, function* () {
58777
- PerformanceMeasurement.markStart(2 /* Emitting */);
58889
+ this.analyzer.performance?.markStart(3 /* Emitting */);
58778
58890
  const declarationsUsageInfo = yield this.analyzer.collectDeclarationsUsageOfPackages(
58779
58891
  this.targetPlatform,
58780
58892
  taskController
@@ -58795,27 +58907,27 @@ var Emitter = class _Emitter {
58795
58907
  renamer.makeParametersAndLocalsNamesUnique(p.ir, p.packageLevelNames);
58796
58908
  });
58797
58909
  this.addExportModifierToAllPackageMemberDeclarations(emitterPackages);
58798
- PerformanceMeasurement.markStart(3 /* IO */);
58910
+ this.analyzer.performance?.markStart(4 /* IO */);
58799
58911
  yield outputAcceptor.clearDirectory(outputUri);
58800
- PerformanceMeasurement.markEnd();
58912
+ this.analyzer.performance?.markEnd();
58801
58913
  for (const pkg2 of emitterPackages) {
58802
58914
  const generated = yield this.generateCodeAndSourceMaps(pkg2);
58803
- PerformanceMeasurement.markStart(3 /* IO */);
58915
+ this.analyzer.performance?.markStart(4 /* IO */);
58804
58916
  yield outputAcceptor.writeFile(pkg2.outputUri, generated.code);
58805
- PerformanceMeasurement.markEnd();
58917
+ this.analyzer.performance?.markEnd();
58806
58918
  if (generated.linkedSourceMaps !== void 0) {
58807
58919
  const sourceMapUri = pkg2.outputUri.replaceLastSegment(generated.linkedSourceMaps.fileName);
58808
- PerformanceMeasurement.markStart(3 /* IO */);
58920
+ this.analyzer.performance?.markStart(4 /* IO */);
58809
58921
  yield outputAcceptor.writeFile(sourceMapUri, generated.linkedSourceMaps.json);
58810
- PerformanceMeasurement.markEnd();
58922
+ this.analyzer.performance?.markEnd();
58811
58923
  }
58812
58924
  }
58813
- PerformanceMeasurement.markEnd();
58925
+ this.analyzer.performance?.markEnd();
58814
58926
  });
58815
58927
  }
58816
58928
  emitToString(taskController) {
58817
58929
  return __async(this, null, function* () {
58818
- PerformanceMeasurement.markStart(2 /* Emitting */);
58930
+ this.analyzer.performance?.markStart(3 /* Emitting */);
58819
58931
  const declarationsUsageInfo = yield this.analyzer.collectDeclarationsUsageOfPackages(
58820
58932
  this.targetPlatform,
58821
58933
  taskController
@@ -58840,7 +58952,7 @@ var Emitter = class _Emitter {
58840
58952
  emitterPackages[0].ir.entity.locale
58841
58953
  );
58842
58954
  const code = (yield this.generateCode(mergedIr, entityNameOverrides)).code;
58843
- PerformanceMeasurement.markEnd();
58955
+ this.analyzer.performance?.markEnd();
58844
58956
  return code;
58845
58957
  });
58846
58958
  }
@@ -78368,6 +78480,7 @@ var TsUriExt = class _TsUriExt {
78368
78480
 
78369
78481
  // source/ts-interop/Utils.ts
78370
78482
  function createTsInteropInputsForCompilation(compilation, librariesProvider) {
78483
+ compilation.performance?.markStart(1 /* InitializingTsInterop */);
78371
78484
  const tsProgramRootUri = compilation.mainPackage?.configuration.jsProjectRootUri ?? compilation.uri;
78372
78485
  const configs = collectRequiredJsLibraryConfigs(compilation);
78373
78486
  const standardLibraryFileNames = configs.getStandardLibraryFileNames();
@@ -78387,6 +78500,7 @@ function createTsInteropInputsForCompilation(compilation, librariesProvider) {
78387
78500
  loadResult.rootFileByGlobalLibraryName,
78388
78501
  loadResult.moduleSymbolByName
78389
78502
  );
78503
+ compilation.performance?.markEnd();
78390
78504
  return result;
78391
78505
  }
78392
78506
  function collectRequiredJsLibraryConfigs(compilation) {
@@ -79833,7 +79947,7 @@ var SemanticContextBase = class _SemanticContextBase {
79833
79947
  getExtensionTypesByType(type) {
79834
79948
  const sourceFileContext = this.getSourceFileContext();
79835
79949
  const result = sourceFileContext.getOwnExtensionTypesByType(type, this.asContext);
79836
- return result ?? _SemanticContextBase.emptyExtensionTypes;
79950
+ return result;
79837
79951
  }
79838
79952
  getTextTranslationEntityByTextKey(key) {
79839
79953
  return this.getSourceFileContext().getTextTranslationEntityByTextKey(key);
@@ -80237,7 +80351,7 @@ var SourceFileAnalyzer = class {
80237
80351
  analyze(taskController) {
80238
80352
  return __async(this, null, function* () {
80239
80353
  this.addDiagnostics(this.sourceFile.parse().diagnostics.map((d) => new Diagnostic(d.data, new DiagnosticLocation(d.range, this.sourceFile))));
80240
- PerformanceMeasurement.markStart(1 /* Analyzing */);
80354
+ this.analyzer.performance?.markStart(2 /* Analyzing */);
80241
80355
  const sourceFileNode = this.sourceFile.getSyntaxNode();
80242
80356
  this.namedDeclarationsUsageMap = yield this.analyzer.getDeclarationsUsageOfSourceFile(
80243
80357
  sourceFileNode,
@@ -80275,7 +80389,7 @@ var SourceFileAnalyzer = class {
80275
80389
  this.addDiagnostics(unreachableCodeDiagnostics);
80276
80390
  this.analyzer.accumulateSideDiagnosticForSourceFile(this.sourceFile, this.diagnosticAcceptor);
80277
80391
  this.sortAndRemoveDuplicateDiagnosticsInPlace(this.diagnostics);
80278
- PerformanceMeasurement.markEnd();
80392
+ this.analyzer.performance?.markEnd();
80279
80393
  return this.diagnostics;
80280
80394
  });
80281
80395
  }
@@ -87320,7 +87434,7 @@ var SourceFileAnalyzer2 = class {
87320
87434
  analyze(taskController) {
87321
87435
  return __async(this, null, function* () {
87322
87436
  this.addDiagnostics(this.sourceFile.parse().diagnostics.map((d) => new Diagnostic(d.data, new DiagnosticLocation(d.range, this.sourceFile))));
87323
- PerformanceMeasurement.markStart(1 /* Analyzing */);
87437
+ this.analyzer.performance?.markStart(2 /* Analyzing */);
87324
87438
  const sourceFileNode = this.sourceFile.getSyntaxNode();
87325
87439
  this.namedDeclarationsUsageMap = yield this.analyzer.getDeclarationsUsageOfSourceFile(
87326
87440
  sourceFileNode,
@@ -87360,7 +87474,7 @@ var SourceFileAnalyzer2 = class {
87360
87474
  this.addDiagnostics(unreachableCodeDiagnostics);
87361
87475
  this.analyzer.accumulateSideDiagnosticForSourceFile(this.sourceFile, this.diagnosticAcceptor);
87362
87476
  this.sortAndRemoveDuplicateDiagnosticsInPlace(this.diagnostics);
87363
- PerformanceMeasurement.markEnd();
87477
+ this.analyzer.performance?.markEnd();
87364
87478
  return this.diagnostics;
87365
87479
  });
87366
87480
  }
@@ -90700,6 +90814,9 @@ var Analyzer = class {
90700
90814
  get tsInterop() {
90701
90815
  return this.state.tsInterop.getOrInsertWith(() => this.createTsInterop());
90702
90816
  }
90817
+ get performance() {
90818
+ return this.compilation.performance;
90819
+ }
90703
90820
  constructor(state) {
90704
90821
  this.state = state;
90705
90822
  }
@@ -93272,6 +93389,11 @@ var TypeComparabilityCheck = class {
93272
93389
  if (type1.equals(integerType) && type2.equals(numberType) || type1.equals(numberType) && type2.equals(integerType)) {
93273
93390
  return true;
93274
93391
  }
93392
+ const textType = this.analyzer.originalStandardTypes.text;
93393
+ const charType = this.analyzer.originalStandardTypes.char;
93394
+ if (type1.equals(textType) && type2.equals(charType) || type1.equals(charType) && type2.equals(textType)) {
93395
+ return true;
93396
+ }
93275
93397
  if (type1.kind === "function" && type2.kind === "function") {
93276
93398
  return type1.equals(type2);
93277
93399
  }
@@ -113837,7 +113959,12 @@ var SourceFileSemanticContext2 = class extends SemanticContextBase {
113837
113959
  }
113838
113960
  getOwnExtensionTypesByType(type, initialContext) {
113839
113961
  const packageMemberLookupContext = initialContext.getPackageMemberLookupContext();
113840
- return this.containingPackageMemberLookup.getExtensionTypes(type, packageMemberLookupContext).concat(this.importedPackageMemberLookups.flatMap((m) => m.getExtensionTypes(type, packageMemberLookupContext)));
113962
+ const result = new Array();
113963
+ result.push(...this.containingPackageMemberLookup.getExtensionTypes(type, packageMemberLookupContext));
113964
+ for (const importedPackageMemberLookup of this.importedPackageMemberLookups) {
113965
+ result.push(...importedPackageMemberLookup.getExtensionTypes(type, packageMemberLookupContext));
113966
+ }
113967
+ return result;
113841
113968
  }
113842
113969
  getTextTranslationEntityByTextKey(key) {
113843
113970
  return this.primaryTextTranslationPackage?.getMembers().getTextTranslationsByTextKey(key) ?? [];
@@ -119987,6 +120114,7 @@ var UserDefinableUnaryOperatorResolver2 = class {
119987
120114
  // source/analysis/a/Analyzer.ts
119988
120115
  var Analyzer3 = class _Analyzer extends Analyzer {
119989
120116
  constructor(compilation, tsInteropInputs) {
120117
+ compilation.performance?.markStart(2 /* Analyzing */);
119990
120118
  const state = new CommonAnalyzerState(compilation, tsInteropInputs);
119991
120119
  super(state);
119992
120120
  this.localizedWellKnownDeclarations = /* @__PURE__ */ new Map();
@@ -120032,6 +120160,7 @@ var Analyzer3 = class _Analyzer extends Analyzer {
120032
120160
  this.packageImports = new PackageImports2(this);
120033
120161
  this.reductionSourceMemberFinder = new ReductionSourceMemberFinder2(this);
120034
120162
  state.initialize(this);
120163
+ compilation.performance?.markEnd();
120035
120164
  }
120036
120165
  get dialectA() {
120037
120166
  return this;
@@ -123983,6 +124112,7 @@ export {
123983
124112
  tokenKindByOperatorKind2 as tokenKindByOperatorKind,
123984
124113
  LocalizationHelperM,
123985
124114
  Logger,
124115
+ getMemoryUsage,
123986
124116
  createNonEmptyArray,
123987
124117
  isNonEmptyArray,
123988
124118
  Option,
@@ -1,4 +1,4 @@
1
- import { Cached, DisplayableOrPrimitive, Name, Option, PackageLocale, Range, TaskController } from '../common/index.js';
1
+ import { Cached, DisplayableOrPrimitive, Name, Option, PackageLocale, PerformanceMeasurement, Range, TaskController } from '../common/index.js';
2
2
  import { Diagnostic, DiagnosticAcceptor, DiagnosticLocation } from '../diagnostic/Diagnostic.js';
3
3
  import { DiagnosticCode } from '../diagnostic/DiagnosticCode.js';
4
4
  import { DiagnosticData, DiagnosticFlags, DiagnosticKind } from '../diagnostic/DiagnosticData.js';
@@ -68,6 +68,7 @@ export declare abstract class Analyzer {
68
68
  get typeComparabilityCheck(): TypeComparabilityCheck;
69
69
  get overriddenMember(): OverriddenMember;
70
70
  get tsInterop(): TsInteropContext;
71
+ get performance(): PerformanceMeasurement | undefined;
71
72
  constructor(state: CommonAnalyzerState);
72
73
  abstract getLocalizedWellKnownDeclarations(locale: PackageLocale): WellKnownDeclarations;
73
74
  abstract getLocalizedStandardTypes(locale: PackageLocale): types.StandardTypes;
@@ -0,0 +1,16 @@
1
+ export type MemoryUsage = NodeMemoryUsage | BrowserMemoryUsage;
2
+ export type NodeMemoryUsage = {
3
+ kind: 'node';
4
+ rss: number;
5
+ heapTotal: number;
6
+ heapUsed: number;
7
+ external: number;
8
+ arrayBuffers: number;
9
+ };
10
+ export type BrowserMemoryUsage = {
11
+ kind: 'browser';
12
+ usedJSHeapSize: number;
13
+ totalJSHeapSize: number;
14
+ jsHeapSizeLimit: number;
15
+ };
16
+ export declare function getMemoryUsage(): MemoryUsage | undefined;
@@ -1,20 +1,28 @@
1
1
  export declare class PerformanceMeasurement {
2
- static isEnabled: boolean;
3
- private static readonly durations;
4
- private static readonly measureInfoStack;
5
- static markStart(label: string | number): void;
6
- static markEnd(): void;
7
- static getDurationMs(label: string | number): number;
8
- static reset(): void;
9
- private static nowMs;
2
+ isEnabled: boolean;
3
+ private readonly durations;
4
+ private readonly measureInfoStack;
5
+ private compilationStartTime;
6
+ private compilationEndTime;
7
+ enable(): void;
8
+ disable(): void;
9
+ markCompilationStart(): void;
10
+ markCompilationEnd(): void;
11
+ getTotalCompilationTimeMs(): number;
12
+ markStart(label: string | number): void;
13
+ markEnd(): void;
14
+ getDurationMs(label: string | number): number;
15
+ reset(): void;
16
+ private nowMs;
10
17
  }
11
18
  export declare const enum PerformanceMeasurementStage {
12
19
  Parsing = 0,
13
- Analyzing = 1,
14
- Emitting = 2,
15
- IO = 3
20
+ InitializingTsInterop = 1,
21
+ Analyzing = 2,
22
+ Emitting = 3,
23
+ IO = 4
16
24
  }
17
- export declare const performanceMeasurementStages: readonly [PerformanceMeasurementStage.Parsing, PerformanceMeasurementStage.Analyzing, PerformanceMeasurementStage.Emitting, PerformanceMeasurementStage.IO];
25
+ export declare const performanceMeasurementStages: readonly [PerformanceMeasurementStage.Parsing, PerformanceMeasurementStage.InitializingTsInterop, PerformanceMeasurementStage.Analyzing, PerformanceMeasurementStage.Emitting, PerformanceMeasurementStage.IO];
18
26
  export declare const performanceMeasurementStageNames: {
19
27
  [S in PerformanceMeasurementStage]: string;
20
28
  };
@@ -16,6 +16,7 @@ export * from './LocalizationHelper.js';
16
16
  export * from './LocalizationHelperA.js';
17
17
  export * from './LocalizationHelperM.js';
18
18
  export * from './Logger.js';
19
+ export * from './MemoryUsage.js';
19
20
  export * from './Name.js';
20
21
  export * from './NameFormatConversion.js';
21
22
  export * from './NonEmptyArray.js';
@@ -33,7 +33,7 @@ export declare function targetParameter(entity: VariableEntity, type: Type): ir.
33
33
  export declare function unorderedArguments(values: readonly ir.Argument[], targetParameters: readonly VariableEntity[], sourceLocation?: ir.SourceLocation): ir.UnorderedArguments;
34
34
  export declare function orderedArguments(values: readonly ir.ExpressionOrJsSpreadElement[], sourceLocation?: ir.SourceLocation): ir.OrderedArguments;
35
35
  export declare function callExpression(expression: ir.Expression, isOptionalAccess: boolean, args: readonly ir.ExpressionOrJsSpreadElement[] | ir.Arguments, isAsyncFunctionCall: boolean, returnType: Type, isCallOfFunctionWithObjectParameter: boolean, sourceLocation?: ir.SourceLocation): ir.CallExpression;
36
- export declare function functionCallExpression(func: FunctionEntity | ir.AccessedFunction, args: readonly ir.ExpressionOrJsSpreadElement[] | ir.Arguments, sourceLocation?: ir.SourceLocation): ir.CallExpression;
36
+ export declare function functionCallExpression(func: FunctionEntity | ir.AccessedFunction, args: readonly ir.ExpressionOrJsSpreadElement[] | ir.Arguments, sourceLocation?: ir.SourceLocation, nameSourceLocation?: ir.SourceLocation): ir.CallExpression;
37
37
  export declare function instanceMethodCallExpression(expression: ir.Expression, method: FunctionEntity | ir.AccessedFunction, args: readonly ir.ExpressionOrJsSpreadElement[] | ir.Arguments, isOptionalAccess: boolean, sourceLocation?: ir.SourceLocation, nameSourceLocation?: ir.SourceLocation): ir.CallExpression;
38
38
  export declare function staticMethodCallExpression(method: FunctionEntity | ir.AccessedFunction, args: readonly ir.ExpressionOrJsSpreadElement[] | ir.Arguments, typeAccess?: ir.TypeAccessExpression, sourceLocation?: ir.SourceLocation, nameSourceLocation?: ir.SourceLocation): ir.CallExpression;
39
39
  export declare function charLiteral(value: string, sourceLocation?: ir.SourceLocation): ir.CharLiteral;
@@ -2,13 +2,16 @@ import { Name } from '../common/index.js';
2
2
  import { ExtensionTypeEntity, NamedPackageMemberEntity, TextTranslationEntity, TypeEntity } from './index.js';
3
3
  export declare class PackageEntityMembers {
4
4
  private static readonly emptyNamedMembers;
5
+ private static readonly emptyExtensionTypes;
5
6
  private static readonly emptyTextTranslations;
6
7
  private readonly namedMembers;
7
8
  private readonly textTranslations;
8
9
  private readonly extensionTypes;
9
10
  private readonly membersByNameKey_;
11
+ private readonly typeExtensionsByExtendedType_;
10
12
  private readonly textTranslationsByTextKey_;
11
13
  private get membersByNameKey();
14
+ private get typeExtensionsByExtendedType();
12
15
  get textTranslationsByTextKey(): ReadonlyMap<string, readonly TextTranslationEntity[]>;
13
16
  constructor(namedMembers: readonly NamedPackageMemberEntity[], textTranslations: readonly TextTranslationEntity[]);
14
17
  getNamedMembers(): readonly NamedPackageMemberEntity[];
@@ -1,5 +1,5 @@
1
1
  import { Analyzer } from '../analysis/Analyzer.js';
2
- import { TaskController, Uri } from '../common/index.js';
2
+ import { PerformanceMeasurement, TaskController, Uri } from '../common/index.js';
3
3
  import { DiagnosticAcceptor } from '../diagnostic/Diagnostic.js';
4
4
  import { EmitOptions, OutputAcceptor } from '../emitter/index.js';
5
5
  import { Compilation } from '../project/Compilation.js';
@@ -19,6 +19,7 @@ export interface LoadCompilationOptions {
19
19
  builtInStandardPackagesUri?: Uri;
20
20
  userStandardPackagesUri?: Uri;
21
21
  enableLogging?: boolean;
22
+ performance?: PerformanceMeasurement;
22
23
  }
23
24
  export interface InputUris {
24
25
  projectUri: Uri;
@@ -1,5 +1,5 @@
1
1
  import { Analyzer } from '../analysis/Analyzer.js';
2
- import { TaskController, Uri } from '../common/index.js';
2
+ import { PerformanceMeasurement, TaskController, Uri } from '../common/index.js';
3
3
  import { Diagnostic, DiagnosticAcceptor } from '../diagnostic/Diagnostic.js';
4
4
  import { EmitOptions } from '../emitter/index.js';
5
5
  import { Compilation } from '../project/index.js';
@@ -17,12 +17,14 @@ export declare class NodeCompiler {
17
17
  static analyze(analyzer: Analyzer, diagnostics: DiagnosticAcceptor | undefined, taskController: TaskController): Promise<boolean>;
18
18
  static emit(analyzer: Analyzer, outputPath: string, diagnostics: DiagnosticAcceptor | undefined, taskController: TaskController, emitOptions?: EmitOptions): Promise<LaunchPath | undefined>;
19
19
  static compile(task: NodeCompilerTask): Promise<LaunchPath | undefined>;
20
+ private static compileWithoutMeasurement;
20
21
  }
21
22
  export interface NodeCompilerLoadCompilationOptions {
22
23
  workspacePath?: string;
23
24
  builtInsStandardPackagesPath?: string;
24
25
  userStandardPackagesPath?: string;
25
26
  enableLogging?: boolean;
27
+ performance?: PerformanceMeasurement;
26
28
  }
27
29
  export interface NodeCompilerTask {
28
30
  nodeModulesWithTypeScriptSearchPaths: readonly string[];
@@ -33,6 +35,7 @@ export interface NodeCompilerTask {
33
35
  defaultTsLibraryPath?: string;
34
36
  emitOptions?: EmitOptions;
35
37
  controller: TaskController;
38
+ performance?: PerformanceMeasurement;
36
39
  }
37
40
  export interface InputPaths {
38
41
  projectPath: string;
@@ -1,4 +1,4 @@
1
- import { Uri } from '../common/index.js';
1
+ import { PerformanceMeasurement, Uri } from '../common/index.js';
2
2
  import * as tree from '../tree/index.js';
3
3
  import { SourceFile } from './SourceFile.js';
4
4
  import { PackageName, ProgramPackage, SourcePackage } from './SourcePackage.js';
@@ -8,10 +8,11 @@ export declare class Compilation {
8
8
  readonly userPackages: readonly SourcePackage[];
9
9
  readonly libraryPackages: readonly SourcePackage[];
10
10
  readonly allPackages: readonly SourcePackage[];
11
+ readonly performance: PerformanceMeasurement | undefined;
11
12
  private parsedSourceFiles;
12
13
  private readonly packageByUri;
13
14
  private readonly sourceFileByUri;
14
- constructor(uri: Uri, mainPackage: ProgramPackage | undefined, userPackages: readonly SourcePackage[], libraryPackages: readonly SourcePackage[]);
15
+ constructor(uri: Uri, mainPackage: ProgramPackage | undefined, userPackages: readonly SourcePackage[], libraryPackages: readonly SourcePackage[], performance?: PerformanceMeasurement);
15
16
  getSourceFileByUri(uri: Uri): SourceFile | undefined;
16
17
  getSourceFileByNode(node: tree.SourceFile): SourceFile;
17
18
  getPackageByUri(uri: Uri): SourcePackage | undefined;
@@ -1,4 +1,4 @@
1
- import { TaskController, Uri } from '../common/index.js';
1
+ import { PerformanceMeasurement, TaskController, Uri } from '../common/index.js';
2
2
  import { Diagnostic, DiagnosticAcceptor } from '../diagnostic/Diagnostic.js';
3
3
  import { Compilation } from './Compilation.js';
4
4
  import { PackageOrGroupConfiguration } from './configuration/ConfigurationConverter.js';
@@ -75,6 +75,7 @@ export interface CompilationLoaderOptions {
75
75
  builtInStandardPackagesUri?: Uri;
76
76
  additionalPackageContents?: readonly packageContent.PackageContent[];
77
77
  enableLogging?: boolean;
78
+ performance?: PerformanceMeasurement;
78
79
  }
79
80
  export declare enum CompilationKind {
80
81
  Regular = 0,
@@ -1,6 +1,9 @@
1
1
  import * as ls from 'vscode-languageserver';
2
+ import { MemoryUsage } from '../common/MemoryUsage.js';
2
3
  declare class CustomRequestType<P, R> extends ls.RequestType<P, R, void> {
3
4
  }
5
+ declare class CustomRequestType0<R> extends ls.RequestType0<R, void> {
6
+ }
4
7
  declare class CustomNotificationType extends ls.NotificationType0 {
5
8
  }
6
9
  export declare const customRequests: {
@@ -13,6 +16,7 @@ export declare const customRequests: {
13
16
  displayFileSystemTree: CustomRequestType<DisplayFileSystemTreeParams, string | null>;
14
17
  createOrUpdateSourceFile: CustomRequestType<CreateOrUpdateSourceFileParams, void>;
15
18
  deleteSourceFile: CustomRequestType<DeleteSourceFileParams, void>;
19
+ getMemoryUsage: CustomRequestType0<MemoryUsage | null>;
16
20
  };
17
21
  export declare const customNotifications: {
18
22
  sourceFileDialectsChanged: CustomNotificationType;
@@ -41,6 +45,7 @@ export type ProvideServerOwnedDocumentContentParams = {
41
45
  };
42
46
  export type EmitCodeToStringParams = {
43
47
  workspaceFolderUri?: ls.URI;
48
+ measurePerformance?: boolean;
44
49
  };
45
50
  export type EmitCodeToStringResult = {
46
51
  hasErrors: true;
@@ -67,4 +72,4 @@ export type CreateOrUpdateSourceFileParams = {
67
72
  export type DeleteSourceFileParams = {
68
73
  uri: ls.DocumentUri;
69
74
  };
70
- export {};
75
+ export type { MemoryUsage };
@@ -80,7 +80,9 @@ export declare class LanguageServer {
80
80
  private onCreateOrUpdateSourceFile;
81
81
  private onDeleteSourceFile;
82
82
  private onDisplayFileSystemTree;
83
+ private onGetMemoryUsage;
83
84
  private onEmitCodeToString;
85
+ private getPerformanceMeasurementResultMessage;
84
86
  private onProvideServerOwnedDocumentContent;
85
87
  private onProvideEvaluatableExpression;
86
88
  private onGetSourceFileDialect;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artel/artc",
3
- "version": "0.9.26062",
3
+ "version": "0.9.26063-pre-release",
4
4
  "description": "Артель Компилятор | Artel Compiler",
5
5
  "author": "Nezaboodka Team <contact@nezaboodka.com>",
6
6
  "license": "Apache-2.0",