@artel/artc 0.6.25215 → 0.6.25216

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-TT3Q66WU.js";
5
- import "./chunk-GEFYL4SZ.js";
4
+ } from "./chunk-O7AXOZXA.js";
5
+ import "./chunk-6RYP5SET.js";
6
6
  import {
7
7
  __async
8
- } from "./chunk-DZ66PBHU.js";
8
+ } from "./chunk-TJG64G2K.js";
9
9
 
10
10
  // source/Cli.ts
11
11
  function main() {
package/build/api/Api.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Compiler
3
- } from "../chunk-GEFYL4SZ.js";
3
+ } from "../chunk-6RYP5SET.js";
4
4
  import {
5
5
  AccessKind,
6
6
  AccessedMethodValueParameter,
@@ -346,7 +346,7 @@ import {
346
346
  withoutQuotes,
347
347
  withoutTextTemplateQuotes,
348
348
  yieldExecution
349
- } from "../chunk-DZ66PBHU.js";
349
+ } from "../chunk-TJG64G2K.js";
350
350
  export {
351
351
  AccessKind,
352
352
  AccessedMethodValueParameter,
@@ -6,9 +6,9 @@ import {
6
6
  PhysicalFileSystem,
7
7
  PhysicalTypeScriptLibrariesProvider,
8
8
  PrintingDiagnosticAcceptor
9
- } from "../chunk-TT3Q66WU.js";
10
- import "../chunk-GEFYL4SZ.js";
11
- import "../chunk-DZ66PBHU.js";
9
+ } from "../chunk-O7AXOZXA.js";
10
+ import "../chunk-6RYP5SET.js";
11
+ import "../chunk-TJG64G2K.js";
12
12
  export {
13
13
  CommandLineCompiler,
14
14
  FileSystemUri,
@@ -182,7 +182,7 @@ import {
182
182
  unwrapParenthesizedExpressions,
183
183
  visitChildren,
184
184
  yieldExecution
185
- } from "../chunk-DZ66PBHU.js";
185
+ } from "../chunk-TJG64G2K.js";
186
186
 
187
187
  // source/services/CustomCommand.ts
188
188
  import * as ls from "vscode-languageserver";
@@ -9478,7 +9478,38 @@ var CompilationController = class extends ObservableObject2 {
9478
9478
  );
9479
9479
  const changeKind = checkTsInteropInputsChanged(newTsProgramLoaderInputs, this._tsProgramLoaderInputs);
9480
9480
  if (changeKind === 1 /* DependenciesOrRootUri */) {
9481
- this._tsInteropInputs = createNewTsInteropInputs(newTsProgramLoaderInputs, this.config.tsLibrariesProvider);
9481
+ let tsInteropInputs;
9482
+ let tsInteropInputsKey;
9483
+ if (this.config.tsInteropInputsCache !== void 0) {
9484
+ const cachedInputsInfo = this.config.tsInteropInputsCache.getTsInteropInputs(
9485
+ newTsProgramLoaderInputs,
9486
+ this.config.tsLibrariesProvider
9487
+ );
9488
+ if (cachedInputsInfo !== void 0) {
9489
+ tsInteropInputs = cachedInputsInfo.inputs;
9490
+ tsInteropInputsKey = cachedInputsInfo.key;
9491
+ }
9492
+ }
9493
+ if (tsInteropInputs === void 0) {
9494
+ tsInteropInputs = createNewTsInteropInputs(newTsProgramLoaderInputs, this.config.tsLibrariesProvider);
9495
+ if (this.config.tsInteropInputsCache !== void 0) {
9496
+ const cachedInputsInfo = this.config.tsInteropInputsCache.getOrAddTsInteropInputs(
9497
+ newTsProgramLoaderInputs,
9498
+ this.config.tsLibrariesProvider,
9499
+ tsInteropInputs
9500
+ );
9501
+ tsInteropInputs = cachedInputsInfo.inputs;
9502
+ tsInteropInputsKey = cachedInputsInfo.key;
9503
+ }
9504
+ }
9505
+ this._tsInteropInputs = tsInteropInputs;
9506
+ if (this.config.tsInteropInputsCache !== void 0) {
9507
+ const previousTsInteropInputsKey = this._tsInteropInputsKey;
9508
+ this._tsInteropInputsKey = tsInteropInputsKey;
9509
+ if (previousTsInteropInputsKey !== void 0 && previousTsInteropInputsKey !== tsInteropInputsKey) {
9510
+ this.config.tsInteropInputsCache.removeTsInteropInputs(previousTsInteropInputsKey);
9511
+ }
9512
+ }
9482
9513
  }
9483
9514
  this._tsProgramLoaderInputs = newTsProgramLoaderInputs;
9484
9515
  function checkTsInteropInputsChanged(newInputs, oldInputs) {
@@ -9759,6 +9790,9 @@ __decorateClass([
9759
9790
  __decorateClass([
9760
9791
  unobservable2
9761
9792
  ], CompilationController.prototype, "_tsInteropInputs", 2);
9793
+ __decorateClass([
9794
+ unobservable2
9795
+ ], CompilationController.prototype, "_tsInteropInputsKey", 2);
9762
9796
  __decorateClass([
9763
9797
  unobservable2
9764
9798
  ], CompilationController.prototype, "_tsProgramLoaderInputs", 2);
@@ -10125,6 +10159,56 @@ var ConfigurationDirectory = class {
10125
10159
  this.packageUri = packageUri;
10126
10160
  }
10127
10161
  };
10162
+ var TsInteropInputsCache = class {
10163
+ constructor() {
10164
+ this._inputsByKey = /* @__PURE__ */ new Map();
10165
+ }
10166
+ getTsInteropInputs(tsProgramLoaderInputs, librariesProvider) {
10167
+ const key = this.createKey(tsProgramLoaderInputs, librariesProvider);
10168
+ const inputsInfo = this._inputsByKey.get(key);
10169
+ if (inputsInfo === void 0) {
10170
+ return void 0;
10171
+ }
10172
+ inputsInfo.referenceCount++;
10173
+ return { inputs: inputsInfo.inputs, key };
10174
+ }
10175
+ getOrAddTsInteropInputs(tsProgramLoaderInputs, librariesProvider, inputs) {
10176
+ const key = this.createKey(tsProgramLoaderInputs, librariesProvider);
10177
+ let resultInputs;
10178
+ const resultInputsInfo = this._inputsByKey.get(key);
10179
+ if (resultInputsInfo === void 0) {
10180
+ this._inputsByKey.set(key, { inputs, referenceCount: 1 });
10181
+ resultInputs = inputs;
10182
+ } else {
10183
+ resultInputsInfo.referenceCount++;
10184
+ resultInputs = resultInputsInfo.inputs;
10185
+ }
10186
+ return { inputs: resultInputs, key };
10187
+ }
10188
+ removeTsInteropInputs(key) {
10189
+ const inputsInfo = this._inputsByKey.get(key);
10190
+ if (inputsInfo !== void 0) {
10191
+ inputsInfo.referenceCount--;
10192
+ if (inputsInfo.referenceCount <= 0) {
10193
+ this._inputsByKey.delete(key);
10194
+ }
10195
+ }
10196
+ }
10197
+ // Ключ состоит из имён файлов стандартных библиотек, npm пакетов, модулей, а также путей ко всем доступным
10198
+ // папкам node_modules.
10199
+ createKey(tsProgramLoaderInputs, librariesProvider) {
10200
+ const nodeModulesUris = new Array();
10201
+ let currentDirectoryUri = tsProgramLoaderInputs.tsProjectUri;
10202
+ while (currentDirectoryUri !== void 0) {
10203
+ const nodeModulesUri = currentDirectoryUri.append("node_modules");
10204
+ if (librariesProvider.directoryExistsSync(nodeModulesUri)) {
10205
+ nodeModulesUris.push(nodeModulesUri);
10206
+ }
10207
+ currentDirectoryUri = currentDirectoryUri.parentUri();
10208
+ }
10209
+ return tsProgramLoaderInputs.orderedStandardLibraryNames.join(",") + ";" + tsProgramLoaderInputs.orderedPackageNames.join(",") + ";" + tsProgramLoaderInputs.orderedModuleNames.join(",") + ";" + nodeModulesUris.map((u) => u.toString()).join(",");
10210
+ }
10211
+ };
10128
10212
 
10129
10213
  // source/services/workspace/FileSystemTreeProviderBasedOnWatchedFileSystem.ts
10130
10214
  import {
@@ -11141,6 +11225,7 @@ var _Workspace = class _Workspace extends ObservableObject6 {
11141
11225
  this._controllersWithOpenedFiles = new ObservableMap5();
11142
11226
  this._atLeastOneFileOfCompilationHasBeenOpened = false;
11143
11227
  this._standardPackageContents = new Cached();
11228
+ this._tsInteropInputsCache = new TsInteropInputsCache();
11144
11229
  this._config = config;
11145
11230
  this._files = new WorkspaceFiles(config.fileSystemTreeProvider);
11146
11231
  }
@@ -11359,7 +11444,8 @@ var _Workspace = class _Workspace extends ObservableObject6 {
11359
11444
  standardPackagesUri: this._config.standardPackagesUri,
11360
11445
  showErrorMessage: this._config.showErrorMessage,
11361
11446
  builtInStandardPackagesUri: this._config.builtInStandardPackagesUri,
11362
- additionalPackageContents: this._config.additionalPackageContents
11447
+ additionalPackageContents: this._config.additionalPackageContents,
11448
+ tsInteropInputsCache: this._tsInteropInputsCache
11363
11449
  };
11364
11450
  return new CompilationController(config);
11365
11451
  }
@@ -11417,6 +11503,9 @@ __decorateClass([
11417
11503
  __decorateClass([
11418
11504
  unobservable6
11419
11505
  ], _Workspace.prototype, "_standardPackageContents", 2);
11506
+ __decorateClass([
11507
+ unobservable6
11508
+ ], _Workspace.prototype, "_tsInteropInputsCache", 2);
11420
11509
  __decorateClass([
11421
11510
  cached
11422
11511
  ], _Workspace.prototype, "compilationControllerByUri", 1);
@@ -10,7 +10,7 @@ import {
10
10
  WellKnownDeclarationsLoadError,
11
11
  __async,
12
12
  createTsInteropInputsForCompilation
13
- } from "./chunk-DZ66PBHU.js";
13
+ } from "./chunk-TJG64G2K.js";
14
14
 
15
15
  // source/executor/Compiler.ts
16
16
  var Compiler = class {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Compiler
3
- } from "./chunk-GEFYL4SZ.js";
3
+ } from "./chunk-6RYP5SET.js";
4
4
  import {
5
5
  ArtelVersion,
6
6
  Cached,
@@ -14,7 +14,7 @@ import {
14
14
  __async,
15
15
  performanceMeasurementStageNames,
16
16
  performanceMeasurementStages
17
- } from "./chunk-DZ66PBHU.js";
17
+ } from "./chunk-TJG64G2K.js";
18
18
 
19
19
  // source/executor/FileSystemUri.ts
20
20
  import { platform } from "os";
@@ -577,7 +577,7 @@ var UniqueWithComparatorQuery = class extends Query {
577
577
  };
578
578
 
579
579
  // source/common/Constants.ts
580
- var ArtelVersion = true ? "0.6.25215" : "";
580
+ var ArtelVersion = true ? "0.6.25216" : "";
581
581
  var ArtelSourceFileExtensions = [".\u0430\u0440\u0442", ".\u0430\u0440\u0442\u0435\u043B\u044C", ".art", ".artel"];
582
582
  var ArtelSourceFileExtensionSet = new Set(ArtelSourceFileExtensions);
583
583
  var ArtelSourceAndConfigurationFileExtensionSet = new Set(ArtelSourceFileExtensionSet).add(".json");
@@ -1,5 +1,5 @@
1
1
  import { Indicator, ObservableObject } from 'reactronic';
2
- import { Analyzer } from '../../analysis/index.js';
2
+ import { Analyzer, TsInteropInputs } from '../../analysis/index.js';
3
3
  import { CancellationToken, Uri } from '../../common/index.js';
4
4
  import { Diagnostic } from '../../diagnostic/Diagnostic.js';
5
5
  import { ConvertedConfiguration, ProgramPackageConfiguration, SourceFile, fsTree } from '../../project/index.js';
@@ -23,6 +23,7 @@ export declare class CompilationController extends ObservableObject {
23
23
  private _packageConfigurationsVersion;
24
24
  private _packageConfigurationsVersionDuringCompilationLoad;
25
25
  private _tsInteropInputs;
26
+ private _tsInteropInputsKey;
26
27
  private _tsProgramLoaderInputs;
27
28
  private _state;
28
29
  private _configurationsOfPackagesOutsideProject;
@@ -61,6 +62,7 @@ export interface CompilationControllerConfig {
61
62
  readonly showErrorMessage?: (message: string) => Promise<void>;
62
63
  readonly builtInStandardPackagesUri?: Uri;
63
64
  readonly additionalPackageContents?: readonly PackageContent[];
65
+ readonly tsInteropInputsCache?: TsInteropInputsCache;
64
66
  }
65
67
  export declare enum CompilationControllerState {
66
68
  Created = 0,
@@ -69,6 +71,13 @@ export declare enum CompilationControllerState {
69
71
  LoadedMainCompilation = 3,
70
72
  ErrorsCreatingAnalyzer = 4
71
73
  }
74
+ declare class TsProgramLoaderInputs {
75
+ readonly orderedStandardLibraryNames: readonly string[];
76
+ readonly orderedPackageNames: readonly string[];
77
+ readonly orderedModuleNames: readonly string[];
78
+ readonly tsProjectUri: Uri;
79
+ constructor(orderedStandardLibraryNames: readonly string[], orderedPackageNames: readonly string[], orderedModuleNames: readonly string[], tsProjectUri: Uri);
80
+ }
72
81
  export type DiagnosticsCollectedInBackgroundHandler = (sourceFile: SourceFile, trackedVersion: number | undefined, diagnostics: readonly Diagnostic[], compilationVersion: number, controller: CompilationController) => Promise<void>;
73
82
  export type RawPackageConfigurationsChangedHandler = (configurations: readonly ChangedPackageConfiguration[]) => Promise<void>;
74
83
  export declare class ChangedPackageConfiguration {
@@ -108,4 +117,17 @@ declare class ConfigurationController extends ObservableObject {
108
117
  protected updateJsonConfigurationFile(): void;
109
118
  protected processConfiguration(): Promise<void>;
110
119
  }
120
+ export declare class TsInteropInputsCache {
121
+ private readonly _inputsByKey;
122
+ getTsInteropInputs(tsProgramLoaderInputs: TsProgramLoaderInputs, librariesProvider: TypeScriptLibrariesProvider): {
123
+ inputs: TsInteropInputs;
124
+ key: string;
125
+ } | undefined;
126
+ getOrAddTsInteropInputs(tsProgramLoaderInputs: TsProgramLoaderInputs, librariesProvider: TypeScriptLibrariesProvider, inputs: TsInteropInputs): {
127
+ inputs: TsInteropInputs;
128
+ key: string;
129
+ };
130
+ removeTsInteropInputs(key: string): void;
131
+ private createKey;
132
+ }
111
133
  export {};
@@ -16,6 +16,7 @@ export declare class Workspace extends ObservableObject {
16
16
  private _atLeastOneFileOfCompilationHasBeenOpened;
17
17
  private readonly _files;
18
18
  private _standardPackageContents;
19
+ private readonly _tsInteropInputsCache;
19
20
  get compilationControllers(): readonly CompilationController[];
20
21
  get trackedSourceFiles(): ReadonlyClientTrackedSourceFiles;
21
22
  get loadedWorkspaceFolderByUri(): ObservableMap<string, fsTree.Directory>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artel/artc",
3
- "version": "0.6.25215",
3
+ "version": "0.6.25216",
4
4
  "description": "Артель Компилятор | Artel Compiler",
5
5
  "author": "Nezaboodka Team <contact@nezaboodka.com>",
6
6
  "license": "LGPL-3.0-or-later",