@artel/artc 0.6.25191

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 (281) hide show
  1. package/build/Cli.js +20 -0
  2. package/build/api/Api.js +664 -0
  3. package/build/api/ApiNodeJS.js +20 -0
  4. package/build/api/ApiServices.js +12847 -0
  5. package/build/chunk-BQHCAH6D.js +588 -0
  6. package/build/chunk-O2JKESUU.js +63219 -0
  7. package/build/chunk-QRBDQKYM.js +94 -0
  8. package/build/types/Cli.d.ts +3 -0
  9. package/build/types/analysis/AccessedMethod.d.ts +53 -0
  10. package/build/types/analysis/AnalyzedTranslationPackage.d.ts +191 -0
  11. package/build/types/analysis/Analyzer.d.ts +665 -0
  12. package/build/types/analysis/AutotypeCallExpressionMeaning.d.ts +25 -0
  13. package/build/types/analysis/BaseExpressionMeaning.d.ts +47 -0
  14. package/build/types/analysis/BuiltInOperators.d.ts +14 -0
  15. package/build/types/analysis/CallArgumentToParameterMatchResult.d.ts +30 -0
  16. package/build/types/analysis/CallArgumentsToParametersMatcher.d.ts +44 -0
  17. package/build/types/analysis/CallExpressionMeaning.d.ts +39 -0
  18. package/build/types/analysis/ConstructorOverloadResolver.d.ts +34 -0
  19. package/build/types/analysis/DeclarationsUsageCounter.d.ts +18 -0
  20. package/build/types/analysis/DereferenceExpressionMeaning.d.ts +23 -0
  21. package/build/types/analysis/DiagnosticCollector.d.ts +68 -0
  22. package/build/types/analysis/EntityLocalizationHelper.d.ts +15 -0
  23. package/build/types/analysis/FindModifier.d.ts +4 -0
  24. package/build/types/analysis/FoundDeclaration.d.ts +19 -0
  25. package/build/types/analysis/IdentifierExpressionMeaning.d.ts +98 -0
  26. package/build/types/analysis/ImportedPackageNameTree.d.ts +22 -0
  27. package/build/types/analysis/IndexedAccessExpressionMeaning.d.ts +26 -0
  28. package/build/types/analysis/IndexerAccess.d.ts +10 -0
  29. package/build/types/analysis/Localization.d.ts +54 -0
  30. package/build/types/analysis/LocalizationContext.d.ts +15 -0
  31. package/build/types/analysis/Lookup.d.ts +23 -0
  32. package/build/types/analysis/NamedTypeResolver.d.ts +42 -0
  33. package/build/types/analysis/NamedTypeSpecifierResolver.d.ts +20 -0
  34. package/build/types/analysis/NodeTypeUtils.d.ts +28 -0
  35. package/build/types/analysis/ObjectExpressionMeaning.d.ts +38 -0
  36. package/build/types/analysis/OperationOverloadResolver.d.ts +19 -0
  37. package/build/types/analysis/OverloadResolver.d.ts +12 -0
  38. package/build/types/analysis/PackageMemberLookup.d.ts +15 -0
  39. package/build/types/analysis/PrefixUnaryOperatorResolver.d.ts +27 -0
  40. package/build/types/analysis/PropertyAccessExpressionMeaning.d.ts +100 -0
  41. package/build/types/analysis/Scope.d.ts +309 -0
  42. package/build/types/analysis/SemanticContext.d.ts +320 -0
  43. package/build/types/analysis/SemanticContextBuilder.d.ts +54 -0
  44. package/build/types/analysis/SourceFileMembers.d.ts +92 -0
  45. package/build/types/analysis/SourcePackageDependencyGraph.d.ts +41 -0
  46. package/build/types/analysis/SourcePackageMembersCreator.d.ts +6 -0
  47. package/build/types/analysis/StatementBlockScopeBuilder.d.ts +22 -0
  48. package/build/types/analysis/SubstitutedMethod.d.ts +49 -0
  49. package/build/types/analysis/TagMeaning.d.ts +26 -0
  50. package/build/types/analysis/Tags.d.ts +29 -0
  51. package/build/types/analysis/TargetTypeHint.d.ts +5 -0
  52. package/build/types/analysis/TypeInferrer.d.ts +9 -0
  53. package/build/types/analysis/TypeMemberLookup.d.ts +27 -0
  54. package/build/types/analysis/TypeOverloadResolver.d.ts +7 -0
  55. package/build/types/analysis/UserDefinableBinaryOperatorResolver.d.ts +37 -0
  56. package/build/types/analysis/Utils.d.ts +17 -0
  57. package/build/types/analysis/VariableAccess.d.ts +10 -0
  58. package/build/types/analysis/VariantLookup.d.ts +20 -0
  59. package/build/types/analysis/Visitor.d.ts +7 -0
  60. package/build/types/analysis/WellKnownDeclarations.d.ts +34 -0
  61. package/build/types/analysis/index.d.ts +8 -0
  62. package/build/types/api/Api.d.ts +59 -0
  63. package/build/types/api/ApiNodeJS.d.ts +5 -0
  64. package/build/types/api/ApiServices.d.ts +3 -0
  65. package/build/types/common/AccessKind.d.ts +4 -0
  66. package/build/types/common/ArtelFileCheck.d.ts +2 -0
  67. package/build/types/common/Cached.d.ts +6 -0
  68. package/build/types/common/CancellationToken.d.ts +13 -0
  69. package/build/types/common/Constants.d.ts +19 -0
  70. package/build/types/common/Debug.d.ts +10 -0
  71. package/build/types/common/Delayed.d.ts +7 -0
  72. package/build/types/common/ErrorHandlingStrategy.d.ts +3 -0
  73. package/build/types/common/FormatString.d.ts +5 -0
  74. package/build/types/common/HelperPhrases.d.ts +11 -0
  75. package/build/types/common/Interner.d.ts +4 -0
  76. package/build/types/common/L10nConfig.d.ts +1 -0
  77. package/build/types/common/Lazy.d.ts +9 -0
  78. package/build/types/common/LocalizationHelper.d.ts +10 -0
  79. package/build/types/common/Logger.d.ts +10 -0
  80. package/build/types/common/Name.d.ts +83 -0
  81. package/build/types/common/NameFormatConversion.d.ts +12 -0
  82. package/build/types/common/NonEmptyArray.d.ts +8 -0
  83. package/build/types/common/Option.d.ts +28 -0
  84. package/build/types/common/PackageDialect.d.ts +5 -0
  85. package/build/types/common/PackageLocale.d.ts +15 -0
  86. package/build/types/common/PackageLocaleGuard.d.ts +1 -0
  87. package/build/types/common/Path.d.ts +8 -0
  88. package/build/types/common/PerformanceMeasurement.d.ts +20 -0
  89. package/build/types/common/Query.d.ts +39 -0
  90. package/build/types/common/Range.d.ts +10 -0
  91. package/build/types/common/Result.d.ts +13 -0
  92. package/build/types/common/SearchName.d.ts +13 -0
  93. package/build/types/common/ThrottledCancellationToken.d.ts +17 -0
  94. package/build/types/common/TreeQuery.d.ts +53 -0
  95. package/build/types/common/TreeTraversal.d.ts +13 -0
  96. package/build/types/common/Uri.d.ts +28 -0
  97. package/build/types/common/UriTree.d.ts +41 -0
  98. package/build/types/common/UserLocale.d.ts +2 -0
  99. package/build/types/common/WithDiagnostics.d.ts +19 -0
  100. package/build/types/common/YieldExecution.d.ts +1 -0
  101. package/build/types/common/index.d.ts +32 -0
  102. package/build/types/diagnostic/Diagnostic.d.ts +21 -0
  103. package/build/types/diagnostic/DiagnosticCode.d.ts +146 -0
  104. package/build/types/diagnostic/DiagnosticData.d.ts +20 -0
  105. package/build/types/diagnostic/DiagnosticFormatter.d.ts +8 -0
  106. package/build/types/diagnostic/RangeDiagnostic.d.ts +19 -0
  107. package/build/types/emitter/BlockStatementTransformationResult.d.ts +10 -0
  108. package/build/types/emitter/CustomModuleLoader.d.ts +1 -0
  109. package/build/types/emitter/DebugStack.d.ts +10 -0
  110. package/build/types/emitter/Emitter.d.ts +61 -0
  111. package/build/types/emitter/EmitterContext.d.ts +342 -0
  112. package/build/types/emitter/EmitterGeneratedDeclarationKind.d.ts +36 -0
  113. package/build/types/emitter/EmitterPackage.d.ts +60 -0
  114. package/build/types/emitter/EntityNameProviders.d.ts +33 -0
  115. package/build/types/emitter/ExpressionTransformationResult.d.ts +17 -0
  116. package/build/types/emitter/GeneralLowering.d.ts +72 -0
  117. package/build/types/emitter/Internal.d.ts +10 -0
  118. package/build/types/emitter/IntrinsicEntities.d.ts +118 -0
  119. package/build/types/emitter/IrBuilder.d.ts +108 -0
  120. package/build/types/emitter/IrToJs.d.ts +113 -0
  121. package/build/types/emitter/JavaScriptName.d.ts +1 -0
  122. package/build/types/emitter/PackageMemberDeclarationTransformationResult.d.ts +17 -0
  123. package/build/types/emitter/SimpleTransformationResult.d.ts +14 -0
  124. package/build/types/emitter/StatementTransformationResult.d.ts +16 -0
  125. package/build/types/emitter/StructuredTypeMemberDeclarationTransformationResult.d.ts +13 -0
  126. package/build/types/emitter/TransformationContinuationAction.d.ts +4 -0
  127. package/build/types/emitter/Transformer.d.ts +282 -0
  128. package/build/types/emitter/TypeAccessExpressionTransformationResult.d.ts +12 -0
  129. package/build/types/emitter/error-boundary.d.ts +10 -0
  130. package/build/types/emitter/index.d.ts +1 -0
  131. package/build/types/emitter/ir/AccessedEntities.d.ts +19 -0
  132. package/build/types/emitter/ir/LoweringOptions.d.ts +34 -0
  133. package/build/types/emitter/ir/Nodes.d.ts +1585 -0
  134. package/build/types/emitter/ir/SourceLocation.d.ts +10 -0
  135. package/build/types/emitter/ir/index.d.ts +5 -0
  136. package/build/types/emitter/ir/types.d.ts +10 -0
  137. package/build/types/entities/AliasTypeEntity.d.ts +84 -0
  138. package/build/types/entities/BinaryOperatorEntity.d.ts +48 -0
  139. package/build/types/entities/ConstructorEntity.d.ts +99 -0
  140. package/build/types/entities/DereferenceOperatorEntity.d.ts +40 -0
  141. package/build/types/entities/DestructorEntity.d.ts +31 -0
  142. package/build/types/entities/EntityHiding.d.ts +27 -0
  143. package/build/types/entities/EntityNaming.d.ts +12 -0
  144. package/build/types/entities/GetterEntity.d.ts +86 -0
  145. package/build/types/entities/IndexerEntity.d.ts +51 -0
  146. package/build/types/entities/MethodEntity.d.ts +174 -0
  147. package/build/types/entities/MethodTypeEntity.d.ts +98 -0
  148. package/build/types/entities/PackageAliasEntity.d.ts +30 -0
  149. package/build/types/entities/PackageEntity.d.ts +56 -0
  150. package/build/types/entities/PackageMembers.d.ts +98 -0
  151. package/build/types/entities/SetterEntity.d.ts +78 -0
  152. package/build/types/entities/StructuredTypeEntity.d.ts +199 -0
  153. package/build/types/entities/SubstitutionApplicationMode.d.ts +4 -0
  154. package/build/types/entities/TypeEntityMembers.d.ts +36 -0
  155. package/build/types/entities/TypeExtensionEntity.d.ts +33 -0
  156. package/build/types/entities/TypeMemberContainer.d.ts +23 -0
  157. package/build/types/entities/TypeParameterEntity.d.ts +94 -0
  158. package/build/types/entities/UnaryOperatorEntity.d.ts +33 -0
  159. package/build/types/entities/VariableEntity.d.ts +423 -0
  160. package/build/types/entities/VariantEntity.d.ts +31 -0
  161. package/build/types/entities/VariantTypeEntity.d.ts +83 -0
  162. package/build/types/entities/Variants.d.ts +10 -0
  163. package/build/types/entities/index.d.ts +87 -0
  164. package/build/types/executor/CommandLineCompiler.d.ts +8 -0
  165. package/build/types/executor/Compiler.d.ts +15 -0
  166. package/build/types/executor/FileSystemUri.d.ts +5 -0
  167. package/build/types/executor/NodeCompiler.d.ts +39 -0
  168. package/build/types/executor/PhysicalFileSystem.d.ts +12 -0
  169. package/build/types/executor/PhysicalTypeScriptLibrariesProvider.d.ts +12 -0
  170. package/build/types/generated/BuiltInSystemPackages.d.ts +3 -0
  171. package/build/types/old/Executor.d.ts +14 -0
  172. package/build/types/old/JavaScriptEmitter.d.ts +1 -0
  173. package/build/types/old/JavaScriptEmittingVisitor.d.ts +1 -0
  174. package/build/types/old/NzonParser.d.ts +1 -0
  175. package/build/types/old/NzonScanner.d.ts +1 -0
  176. package/build/types/old/NzonSyntax.d.ts +1 -0
  177. package/build/types/old/RemoteWorkspaceFileSystem.d.ts +1 -0
  178. package/build/types/parser/CharacterCodes.d.ts +21 -0
  179. package/build/types/parser/ConvertTokenKind.d.ts +3 -0
  180. package/build/types/parser/KeywordDictionary.d.ts +12 -0
  181. package/build/types/parser/ParseNumber.d.ts +5 -0
  182. package/build/types/parser/Parser.d.ts +7 -0
  183. package/build/types/parser/ParserDiagnostic.d.ts +7 -0
  184. package/build/types/parser/ReservedIdentifierDictionary.d.ts +12 -0
  185. package/build/types/parser/Scanner.d.ts +60 -0
  186. package/build/types/parser/TokenKind.d.ts +73 -0
  187. package/build/types/parser/UnescapeText.d.ts +2 -0
  188. package/build/types/project/Compilation.d.ts +21 -0
  189. package/build/types/project/CompilationLoader.d.ts +104 -0
  190. package/build/types/project/FileSystemTree.d.ts +70 -0
  191. package/build/types/project/PackageConfigurationSerializer.d.ts +1 -0
  192. package/build/types/project/Position.d.ts +5 -0
  193. package/build/types/project/SourceFile.d.ts +21 -0
  194. package/build/types/project/SourcePackage.d.ts +151 -0
  195. package/build/types/project/TextFile.d.ts +11 -0
  196. package/build/types/project/configuration/BuildPackageApi.d.ts +75 -0
  197. package/build/types/project/configuration/ConfigurationConverter.d.ts +25 -0
  198. package/build/types/project/configuration/ConfigurationFileParser.d.ts +26 -0
  199. package/build/types/project/configuration/PackageConfigurationInterpreter.d.ts +27 -0
  200. package/build/types/project/configuration/types/PackageConfigurationEn.d.ts +90 -0
  201. package/build/types/project/configuration/types/PackageConfigurationRu.d.ts +91 -0
  202. package/build/types/project/index.d.ts +12 -0
  203. package/build/types/services/AddPropertyAssignmentService.d.ts +15 -0
  204. package/build/types/services/CompletionService.d.ts +95 -0
  205. package/build/types/services/CustomCommand.d.ts +120 -0
  206. package/build/types/services/DefinitionService.d.ts +19 -0
  207. package/build/types/services/DisplayService.d.ts +830 -0
  208. package/build/types/services/DocumentHighlightsService.d.ts +18 -0
  209. package/build/types/services/EvaluatableExpressionService.d.ts +15 -0
  210. package/build/types/services/FileSystemTreeDisplayService.d.ts +7 -0
  211. package/build/types/services/HoverService.d.ts +17 -0
  212. package/build/types/services/LanguageServer.d.ts +125 -0
  213. package/build/types/services/NodeSemanticInfo.d.ts +132 -0
  214. package/build/types/services/ProjectItemsService.d.ts +6 -0
  215. package/build/types/services/ReferencesService.d.ts +30 -0
  216. package/build/types/services/RenameService.d.ts +16 -0
  217. package/build/types/services/SelectionRangeService.d.ts +12 -0
  218. package/build/types/services/SemanticTokensService.d.ts +40 -0
  219. package/build/types/services/SourceFileItemsService.d.ts +42 -0
  220. package/build/types/services/TranslationService.d.ts +23 -0
  221. package/build/types/services/TreeUtils.d.ts +58 -0
  222. package/build/types/services/TypeDefinitionService.d.ts +9 -0
  223. package/build/types/services/Types.d.ts +22 -0
  224. package/build/types/services/Utils.d.ts +5 -0
  225. package/build/types/services/signature-help/SignatureHelpService.d.ts +17 -0
  226. package/build/types/services/signature-help/SignatureWithValueParameters.d.ts +114 -0
  227. package/build/types/services/signature-help/TypeParameterSignatureHelpProvider.d.ts +20 -0
  228. package/build/types/services/signature-help/ValueParametersSignatureHelpProvider.d.ts +15 -0
  229. package/build/types/services/signature-help/utils.d.ts +9 -0
  230. package/build/types/services/source-generation/EntityToSyntax.d.ts +47 -0
  231. package/build/types/services/source-generation/SourceGenerationService.d.ts +22 -0
  232. package/build/types/services/workspace/ClientTrackedSourceFiles.d.ts +41 -0
  233. package/build/types/services/workspace/CompilationController.d.ts +108 -0
  234. package/build/types/services/workspace/FileSystemTreeProviderBasedOnWatchedFileSystem.d.ts +61 -0
  235. package/build/types/services/workspace/ManuallyUpdatedFileSystemTreeProvider.d.ts +21 -0
  236. package/build/types/services/workspace/Workspace.d.ts +59 -0
  237. package/build/types/services/workspace/WorkspaceFileSystem.d.ts +5 -0
  238. package/build/types/services/workspace/WorkspaceFiles.d.ts +35 -0
  239. package/build/types/services/workspace/index.d.ts +7 -0
  240. package/build/types/tree/KeywordKind.d.ts +64 -0
  241. package/build/types/tree/NodeKind.d.ts +163 -0
  242. package/build/types/tree/TokenKind.d.ts +132 -0
  243. package/build/types/tree/TriviaKind.d.ts +7 -0
  244. package/build/types/tree/green/BaseNode.d.ts +12 -0
  245. package/build/types/tree/green/Nodes.d.ts +2235 -0
  246. package/build/types/tree/green/SyntaxFactory.d.ts +67 -0
  247. package/build/types/tree/green/SyntaxToCode.d.ts +116 -0
  248. package/build/types/tree/green/Token.d.ts +37 -0
  249. package/build/types/tree/green/Utils.d.ts +2 -0
  250. package/build/types/tree/green/index.d.ts +7 -0
  251. package/build/types/tree/index.d.ts +4 -0
  252. package/build/types/tree/red/BaseNode.d.ts +15 -0
  253. package/build/types/tree/red/Internal.d.ts +2 -0
  254. package/build/types/tree/red/NodePath.d.ts +10 -0
  255. package/build/types/tree/red/Nodes.d.ts +2237 -0
  256. package/build/types/tree/red/Token.d.ts +29 -0
  257. package/build/types/tree/red/Utils.d.ts +6 -0
  258. package/build/types/tree/red/index.d.ts +6 -0
  259. package/build/types/ts-interop/Entities.d.ts +634 -0
  260. package/build/types/ts-interop/TsInteropContext.d.ts +179 -0
  261. package/build/types/ts-interop/TsLibrariesProvider.d.ts +12 -0
  262. package/build/types/ts-interop/TsPackageContents.d.ts +64 -0
  263. package/build/types/ts-interop/TsPackageMembersCreator.d.ts +69 -0
  264. package/build/types/ts-interop/TsProgramLoader.d.ts +38 -0
  265. package/build/types/ts-interop/TsTypeMembersCreator.d.ts +45 -0
  266. package/build/types/ts-interop/Utils.d.ts +43 -0
  267. package/build/types/types/AliasType.d.ts +20 -0
  268. package/build/types/types/Internal.d.ts +1 -0
  269. package/build/types/types/MethodType.d.ts +23 -0
  270. package/build/types/types/ParameterType.d.ts +19 -0
  271. package/build/types/types/StandardTypes.d.ts +42 -0
  272. package/build/types/types/StructuredType.d.ts +25 -0
  273. package/build/types/types/Substitutions.d.ts +18 -0
  274. package/build/types/types/Type.d.ts +16 -0
  275. package/build/types/types/TypeFactory.d.ts +15 -0
  276. package/build/types/types/TypeMembers.d.ts +134 -0
  277. package/build/types/types/UnionType.d.ts +20 -0
  278. package/build/types/types/UnresolvedType.d.ts +16 -0
  279. package/build/types/types/VariantType.d.ts +19 -0
  280. package/build/types/types/index.d.ts +12 -0
  281. package/package.json +73 -0
@@ -0,0 +1,588 @@
1
+ import {
2
+ Compiler
3
+ } from "./chunk-QRBDQKYM.js";
4
+ import {
5
+ ArtelVersion,
6
+ Cached,
7
+ Debug,
8
+ Diagnostic,
9
+ DiagnosticData,
10
+ DirectoryEntry,
11
+ PerformanceMeasurement,
12
+ Query,
13
+ Uri,
14
+ __async,
15
+ performanceMeasurementStageNames,
16
+ performanceMeasurementStages
17
+ } from "./chunk-O2JKESUU.js";
18
+
19
+ // source/executor/FileSystemUri.ts
20
+ import { platform } from "os";
21
+ import { normalize, sep } from "path";
22
+ var FileSystemUri = class {
23
+ static pathToUri(path) {
24
+ path = normalize(path);
25
+ if (path.startsWith(sep)) {
26
+ path = path.substring(sep.length);
27
+ }
28
+ if (path.endsWith(sep)) {
29
+ path = path.substring(0, path.length - sep.length);
30
+ }
31
+ return new Uri("file", path.split(sep));
32
+ }
33
+ static toPath(uri) {
34
+ if (platform() === "win32") {
35
+ return uri.segments.join(sep);
36
+ }
37
+ return `${sep}${uri.segments.join(sep)}`;
38
+ }
39
+ };
40
+
41
+ // source/executor/PhysicalFileSystem.ts
42
+ import { existsSync } from "fs";
43
+ import { lstat, mkdir, readFile, readdir, rm, writeFile } from "fs/promises";
44
+ import { dirname, join } from "path";
45
+ var PhysicalFileSystem = class {
46
+ readDirectory(uri) {
47
+ return __async(this, null, function* () {
48
+ const path = FileSystemUri.toPath(uri);
49
+ let names;
50
+ try {
51
+ names = yield readdir(path);
52
+ } catch {
53
+ names = [];
54
+ }
55
+ const readEntriesPromises = names.map((name) => __async(this, null, function* () {
56
+ const childPath = join(path, name);
57
+ const stats = yield this.tryLstat(childPath);
58
+ if (stats !== void 0 && (stats.isDirectory() || stats.isFile())) {
59
+ return new DirectoryEntry(FileSystemUri.pathToUri(childPath), stats.isFile());
60
+ } else {
61
+ return void 0;
62
+ }
63
+ }));
64
+ const result = Query.from(yield Promise.all(readEntriesPromises)).mapAndFilter((e) => e).toArray();
65
+ return result;
66
+ });
67
+ }
68
+ readFile(uri) {
69
+ return __async(this, null, function* () {
70
+ const path = FileSystemUri.toPath(uri);
71
+ let text;
72
+ try {
73
+ text = yield readFile(path, "utf8");
74
+ } catch {
75
+ }
76
+ return text;
77
+ });
78
+ }
79
+ readEntry(uri) {
80
+ return __async(this, null, function* () {
81
+ const path = FileSystemUri.toPath(uri);
82
+ const stats = yield this.tryLstat(path);
83
+ let result;
84
+ if (stats !== void 0 && (stats.isFile() || stats.isDirectory())) {
85
+ result = new DirectoryEntry(uri, stats.isFile());
86
+ }
87
+ return result;
88
+ });
89
+ }
90
+ clearDirectory(uri) {
91
+ return __async(this, null, function* () {
92
+ const path = FileSystemUri.toPath(uri);
93
+ yield rm(path, { recursive: true, force: true });
94
+ });
95
+ }
96
+ writeFile(uri, content) {
97
+ return __async(this, null, function* () {
98
+ const path = FileSystemUri.toPath(uri);
99
+ const directoryPath = dirname(path);
100
+ if (!existsSync(directoryPath)) {
101
+ yield mkdir(directoryPath, { recursive: true });
102
+ }
103
+ yield writeFile(path, content, "utf8");
104
+ });
105
+ }
106
+ tryLstat(path) {
107
+ return __async(this, null, function* () {
108
+ try {
109
+ return yield lstat(path);
110
+ } catch {
111
+ return void 0;
112
+ }
113
+ });
114
+ }
115
+ };
116
+
117
+ // source/executor/PhysicalTypeScriptLibrariesProvider.ts
118
+ import { lstatSync, readFileSync } from "fs";
119
+ import { platform as platform2 } from "os";
120
+ var PhysicalTypeScriptLibrariesProvider = class {
121
+ constructor(standardLibraryUri) {
122
+ this._isCaseSensitive = new Cached();
123
+ this._standardLibraryUri = standardLibraryUri;
124
+ }
125
+ getStandardLibraryUri() {
126
+ return this._standardLibraryUri;
127
+ }
128
+ readFileSync(uri) {
129
+ const path = FileSystemUri.toPath(uri);
130
+ let text;
131
+ try {
132
+ text = readFileSync(path, "utf8");
133
+ } catch {
134
+ }
135
+ return text;
136
+ }
137
+ fileExistsSync(uri) {
138
+ const path = FileSystemUri.toPath(uri);
139
+ let stats;
140
+ try {
141
+ stats = lstatSync(path);
142
+ } catch {
143
+ }
144
+ const result = stats?.isFile() === true;
145
+ return result;
146
+ }
147
+ directoryExistsSync(uri) {
148
+ const path = FileSystemUri.toPath(uri);
149
+ let stats;
150
+ try {
151
+ stats = lstatSync(path);
152
+ } catch {
153
+ }
154
+ const result = stats?.isDirectory() === true;
155
+ return result;
156
+ }
157
+ isCaseSensitive() {
158
+ return this._isCaseSensitive.getOrInsertWith(() => {
159
+ const platformName = platform2();
160
+ if (platformName === "win32") {
161
+ return false;
162
+ }
163
+ return true;
164
+ });
165
+ }
166
+ };
167
+
168
+ // source/executor/NodeCompiler.ts
169
+ import { relative } from "path";
170
+ import process2 from "process";
171
+
172
+ // source/diagnostic/DiagnosticFormatter.ts
173
+ var DiagnosticFormatter = class {
174
+ static format(diagnostic, options) {
175
+ let result;
176
+ if (diagnostic.location !== void 0) {
177
+ const sourceFile = diagnostic.location.file;
178
+ const uri = options?.convertUri?.(sourceFile.uri) ?? sourceFile.uri.toString();
179
+ const position = sourceFile.getPositionAt(diagnostic.location.range.start);
180
+ result = `${uri}:${position.line + 1}:${position.character + 1} - ${diagnostic.data.message}`;
181
+ } else {
182
+ result = diagnostic.data.message;
183
+ }
184
+ return result;
185
+ }
186
+ };
187
+
188
+ // source/executor/NodeCompiler.ts
189
+ var NodeCompiler = class {
190
+ static get fileSystem() {
191
+ return this._fileSystem ??= new PhysicalFileSystem();
192
+ }
193
+ static findStandardTypeScriptLibrary(nodeModulesSearchPaths, defaultTsLibraryPath) {
194
+ return __async(this, null, function* () {
195
+ const nodeModulesSearchUris = nodeModulesSearchPaths.map((p) => FileSystemUri.pathToUri(p));
196
+ for (const baseUri of nodeModulesSearchUris) {
197
+ let currentUri = baseUri;
198
+ const relativeSegments = ["node_modules", "typescript", "lib"];
199
+ while (currentUri !== void 0) {
200
+ const libDirectoryUri = currentUri.append(relativeSegments);
201
+ if ((yield this.fileSystem.readEntry(libDirectoryUri))?.isFile === false) {
202
+ return libDirectoryUri;
203
+ }
204
+ currentUri = currentUri.parentUri();
205
+ }
206
+ }
207
+ if (defaultTsLibraryPath !== void 0) {
208
+ return FileSystemUri.pathToUri(defaultTsLibraryPath);
209
+ }
210
+ return void 0;
211
+ });
212
+ }
213
+ static createTypeScriptLibrariesProvider(nodeModulesSearchPaths, defaultTsLibraryPath, diagnostics) {
214
+ return __async(this, null, function* () {
215
+ const standardLibraryUri = yield this.findStandardTypeScriptLibrary(nodeModulesSearchPaths, defaultTsLibraryPath);
216
+ if (standardLibraryUri === void 0) {
217
+ const diagnostic = new Diagnostic(DiagnosticData.withCode(
218
+ 137 /* CanNotFindTsLibDirectoryBaseSearchPaths0 */,
219
+ [nodeModulesSearchPaths.map((p) => `'${p}'`).join(", ")]
220
+ ), void 0);
221
+ diagnostics?.addDiagnostic(diagnostic);
222
+ return void 0;
223
+ }
224
+ return new PhysicalTypeScriptLibrariesProvider(standardLibraryUri);
225
+ });
226
+ }
227
+ static loadCompilation(projectPath, tsLibrariesProvider, diagnostics, workspacePath, standardPackagesPath, cancellationToken) {
228
+ return __async(this, null, function* () {
229
+ const projectUri = FileSystemUri.pathToUri(projectPath);
230
+ const workspaceUri = workspacePath !== void 0 ? FileSystemUri.pathToUri(workspacePath) : void 0;
231
+ const standardPackagesUri = standardPackagesPath !== void 0 ? FileSystemUri.pathToUri(standardPackagesPath) : void 0;
232
+ return yield Compiler.loadCompilation(
233
+ projectUri,
234
+ this.fileSystem,
235
+ tsLibrariesProvider,
236
+ diagnostics,
237
+ workspaceUri,
238
+ standardPackagesUri,
239
+ cancellationToken
240
+ );
241
+ });
242
+ }
243
+ static createAnalyzer(compilation, tsLibrariesProvider, diagnostics, cancellationToken) {
244
+ return __async(this, null, function* () {
245
+ return yield Compiler.createAnalyzer(compilation, tsLibrariesProvider, diagnostics, cancellationToken);
246
+ });
247
+ }
248
+ static analyze(analyzer, diagnostics, cancellationToken) {
249
+ return __async(this, null, function* () {
250
+ return yield Compiler.analyze(analyzer, diagnostics, cancellationToken);
251
+ });
252
+ }
253
+ static emit(analyzer, outputPath, diagnostics, emitOptions, cancellationToken) {
254
+ return __async(this, null, function* () {
255
+ const outputUri = FileSystemUri.pathToUri(outputPath);
256
+ const launchUri = yield Compiler.emit(
257
+ analyzer,
258
+ outputUri,
259
+ this.fileSystem,
260
+ diagnostics,
261
+ emitOptions,
262
+ cancellationToken
263
+ );
264
+ if (launchUri === void 0) {
265
+ return void 0;
266
+ }
267
+ const launchPath = FileSystemUri.toPath(launchUri);
268
+ return launchPath;
269
+ });
270
+ }
271
+ static compile(task) {
272
+ return __async(this, null, function* () {
273
+ const typeScriptLibrariesProvider = yield this.createTypeScriptLibrariesProvider(
274
+ task.nodeModulesWithTypeScriptSearchPaths,
275
+ task.defaultTsLibraryPath,
276
+ task.diagnostics
277
+ );
278
+ if (typeScriptLibrariesProvider === void 0) {
279
+ return void 0;
280
+ }
281
+ const compilation = yield this.loadCompilation(
282
+ task.projectPath,
283
+ typeScriptLibrariesProvider,
284
+ task.diagnostics,
285
+ task.workspacePath,
286
+ task.standardPackagesPath,
287
+ task.cancellationToken
288
+ );
289
+ if (compilation === void 0) {
290
+ return void 0;
291
+ }
292
+ const analyzer = yield this.createAnalyzer(
293
+ compilation,
294
+ typeScriptLibrariesProvider,
295
+ task.diagnostics,
296
+ task.cancellationToken
297
+ );
298
+ if (analyzer === void 0) {
299
+ return void 0;
300
+ }
301
+ const analyzed = yield this.analyze(analyzer, task.diagnostics, task.cancellationToken);
302
+ if (!analyzed) {
303
+ return void 0;
304
+ }
305
+ const launchPath = yield this.emit(
306
+ analyzer,
307
+ task.outputPath,
308
+ task.diagnostics,
309
+ task.emitOptions,
310
+ task.cancellationToken
311
+ );
312
+ return launchPath;
313
+ });
314
+ }
315
+ };
316
+ var PrintingDiagnosticAcceptor = class {
317
+ constructor(basePath) {
318
+ this._formatter = new NodeDiagnosticFormatter(basePath);
319
+ }
320
+ addDiagnostic(diagnostic) {
321
+ if (diagnostic.data.kind === 0 /* Error */ || diagnostic.data.kind === 1 /* Warning */) {
322
+ const diagnosticText = this._formatter.format(diagnostic);
323
+ console.log(diagnosticText);
324
+ }
325
+ }
326
+ };
327
+ var NodeDiagnosticFormatter = class {
328
+ constructor(basePath) {
329
+ basePath ??= process2.cwd();
330
+ this._formatDiagnosticOptions = {
331
+ convertUri(uri) {
332
+ if (uri.scheme === "file") {
333
+ const path = FileSystemUri.toPath(uri);
334
+ const relativePath = relative(basePath, path);
335
+ return relativePath;
336
+ } else {
337
+ return uri.toString();
338
+ }
339
+ }
340
+ };
341
+ }
342
+ format(diagnostic) {
343
+ return DiagnosticFormatter.format(diagnostic, this._formatDiagnosticOptions);
344
+ }
345
+ };
346
+
347
+ // source/executor/CommandLineCompiler.ts
348
+ import { spawn } from "child_process";
349
+ import { resolve } from "path";
350
+ import { fileURLToPath, pathToFileURL } from "url";
351
+ var CommandLineCompiler = class {
352
+ static {
353
+ this.successExitCode = 0;
354
+ }
355
+ static {
356
+ this.errorExitCode = 1;
357
+ }
358
+ static run(args) {
359
+ return __async(this, null, function* () {
360
+ const parsedArguments = ArgumentsParser.parseArguments(args);
361
+ if (parsedArguments.command === void 0) {
362
+ this.displayUsageMessage(parsedArguments);
363
+ return this.errorExitCode;
364
+ }
365
+ if (parsedArguments.command === 5 /* Help */) {
366
+ this.displayUsageMessage(parsedArguments);
367
+ return this.errorExitCode;
368
+ }
369
+ if (parsedArguments.command === 4 /* Version */) {
370
+ console.log(ArtelVersion);
371
+ return this.successExitCode;
372
+ }
373
+ if (parsedArguments.projectPath === void 0 || parsedArguments.outputPath === void 0) {
374
+ this.displayUsageMessage(parsedArguments);
375
+ return this.successExitCode;
376
+ }
377
+ if (parsedArguments.measurePerformance) {
378
+ PerformanceMeasurement.isEnabled = true;
379
+ }
380
+ try {
381
+ const diagnostics = new PrintingDiagnosticAcceptor();
382
+ const compilerTask = {
383
+ nodeModulesWithTypeScriptSearchPaths: [
384
+ parsedArguments.projectPath,
385
+ fileURLToPath(new URL("..", import.meta.url))
386
+ ],
387
+ projectPath: parsedArguments.projectPath,
388
+ outputPath: parsedArguments.outputPath,
389
+ workspacePath: parsedArguments.workspacePath,
390
+ standardPackagesPath: parsedArguments.standardPackagesPath,
391
+ diagnostics,
392
+ defaultTsLibraryPath: parsedArguments.defaultTsLibraryPath,
393
+ emitOptions: {
394
+ sourceMap: {
395
+ mode: "linked" /* Linked */,
396
+ includeSourcesContent: true,
397
+ justApplicationCode: false
398
+ }
399
+ }
400
+ };
401
+ const launchPath = yield NodeCompiler.compile(compilerTask);
402
+ if (launchPath === void 0) {
403
+ return this.errorExitCode;
404
+ }
405
+ if (parsedArguments.command === 3 /* Launch */) {
406
+ const launchUrl = pathToFileURL(launchPath).toString();
407
+ yield import(launchUrl);
408
+ } else if (parsedArguments.command === 2 /* Execute */) {
409
+ yield this.execute(launchPath, parsedArguments.outputPath);
410
+ }
411
+ } catch (e) {
412
+ console.log(`\u041E\u0448\u0438\u0431\u043A\u0430.
413
+ ${e}
414
+ ${e.stack}`);
415
+ return this.errorExitCode;
416
+ }
417
+ if (parsedArguments.measurePerformance) {
418
+ this.displayPerformanceMeasurementResults();
419
+ }
420
+ return this.successExitCode;
421
+ });
422
+ }
423
+ static displayUsageMessage(args) {
424
+ console.log(`
425
+ \u0410\u0440\u0442\u0435\u043B\u044C*Artel ${ArtelVersion} @ ${args.projectPath ?? process.cwd()}
426
+ `);
427
+ console.log("\n\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u0435:");
428
+ console.log("\u0430\u0440\u0442\u0435\u043B\u044C \u0437\u0430\u043F\u0443\u0441\u043A <\u043F\u0430\u043F\u043A\u0430 \u043F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u044B> <\u0441\u0431\u043E\u0440\u043E\u0447\u043D\u0430\u044F \u043F\u0430\u043F\u043A\u0430>");
429
+ console.log("\u0430\u0440\u0442\u0435\u043B\u044C \u0441\u043E\u0431\u0440\u0430\u0442\u044C <\u043F\u0430\u043F\u043A\u0430 \u043F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u044B> <\u0441\u0431\u043E\u0440\u043E\u0447\u043D\u0430\u044F \u043F\u0430\u043F\u043A\u0430>");
430
+ console.log("\u0430\u0440\u0442\u0435\u043B\u044C \u043D\u0430\u0441\u0442\u0440\u043E\u0438\u0442\u044C");
431
+ console.log("\nUsage:");
432
+ console.log("artel launch <program folder> <build folder>");
433
+ console.log("artel build <program folder> <build folder>");
434
+ console.log("artel setup");
435
+ }
436
+ static displayPerformanceMeasurementResults() {
437
+ for (const stage of performanceMeasurementStages) {
438
+ const duration = PerformanceMeasurement.getDurationMs(stage);
439
+ console.log(`${performanceMeasurementStageNames[stage]}: ${duration.toFixed(2)}ms`);
440
+ }
441
+ }
442
+ static execute(launchPath, cwdPath) {
443
+ return __async(this, null, function* () {
444
+ return new Promise((resolve2, reject) => {
445
+ const program = spawn(`"${process.execPath}"`, [launchPath], {
446
+ stdio: [process.stdin, process.stdout, process.stderr],
447
+ cwd: cwdPath,
448
+ shell: true,
449
+ env: process.env
450
+ });
451
+ program.once("exit", (code) => resolve2(code ?? 0));
452
+ program.once("error", reject);
453
+ });
454
+ });
455
+ }
456
+ };
457
+ var ArgumentsParser = class {
458
+ static parseArguments(args) {
459
+ const result = {
460
+ command: void 0,
461
+ projectPath: void 0,
462
+ outputPath: void 0,
463
+ measurePerformance: false,
464
+ defaultTsLibraryPath: void 0,
465
+ workspacePath: void 0,
466
+ standardPackagesPath: void 0
467
+ };
468
+ const index = this.parseMainCommand(0, args, result);
469
+ this.parseNamedArguments(index, args, result);
470
+ return result;
471
+ }
472
+ static parseMainCommand(index, args, result) {
473
+ if (index < args.length && !args[index].startsWith("-")) {
474
+ result.command = this.getCommandKind(args[index]);
475
+ index++;
476
+ if (result.command !== void 0) {
477
+ switch (result.command) {
478
+ case 0 /* Setup */:
479
+ case 1 /* Build */:
480
+ case 2 /* Execute */:
481
+ case 3 /* Launch */: {
482
+ const cwd = process.cwd();
483
+ const projectPath = this.tryParseStringArgument(index, args);
484
+ if (projectPath !== void 0) {
485
+ result.projectPath = resolve(cwd, projectPath);
486
+ index++;
487
+ const outputPath = this.tryParseStringArgument(index, args);
488
+ if (outputPath !== void 0) {
489
+ result.outputPath = resolve(cwd, outputPath);
490
+ index++;
491
+ }
492
+ }
493
+ break;
494
+ }
495
+ case 4 /* Version */:
496
+ case 5 /* Help */:
497
+ break;
498
+ default:
499
+ Debug.never(result.command);
500
+ }
501
+ }
502
+ }
503
+ return index;
504
+ }
505
+ static getCommandKind(name) {
506
+ switch (name) {
507
+ case "\u043D\u0430\u0441\u0442\u0440\u043E\u0438\u0442\u044C":
508
+ case "setup":
509
+ return 0 /* Setup */;
510
+ case "\u0441\u043E\u0431\u0440\u0430\u0442\u044C":
511
+ case "build":
512
+ return 1 /* Build */;
513
+ case "\u0432\u044B\u043F\u043E\u043B\u043D\u0438\u0442\u044C":
514
+ case "execute":
515
+ return 2 /* Execute */;
516
+ case "\u0437\u0430\u043F\u0443\u0441\u043A":
517
+ case "launch":
518
+ return 3 /* Launch */;
519
+ case "\u0432\u0435\u0440\u0441\u0438\u044F":
520
+ case "version":
521
+ return 4 /* Version */;
522
+ case "\u0441\u043F\u0440\u0430\u0432\u043A\u0430":
523
+ case "help":
524
+ return 5 /* Help */;
525
+ default:
526
+ return void 0;
527
+ }
528
+ }
529
+ static parseNamedArguments(index, args, result) {
530
+ const cwd = process.cwd();
531
+ for (; index < args.length; index++) {
532
+ const argumentName = args[index];
533
+ if (!argumentName.startsWith("-")) {
534
+ continue;
535
+ }
536
+ switch (argumentName) {
537
+ case "--\u0441\u0442\u0430\u043D\u0434\u0430\u0440\u0442\u043D\u0430\u044F-\u0431\u0438\u0431\u043B\u0438\u043E\u0442\u0435\u043A\u0430-type-script":
538
+ case "--standard-type-script-library": {
539
+ const path = this.tryParseStringArgument(index + 1, args);
540
+ if (path !== void 0) {
541
+ result.defaultTsLibraryPath = resolve(cwd, path);
542
+ index++;
543
+ }
544
+ break;
545
+ }
546
+ case "--\u0437\u0430\u043C\u0435\u0440\u0438\u0442\u044C-\u043F\u0440\u043E\u0438\u0437\u0432\u043E\u0434\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C":
547
+ case "--measure-performance": {
548
+ result.measurePerformance = true;
549
+ break;
550
+ }
551
+ case "--workspace":
552
+ case "--\u0440\u0430\u0431\u043E\u0447\u0430\u044F-\u043E\u0431\u043B\u0430\u0441\u0442\u044C": {
553
+ const path = this.tryParseStringArgument(index + 1, args);
554
+ if (path !== void 0) {
555
+ result.workspacePath = resolve(cwd, path);
556
+ index++;
557
+ }
558
+ break;
559
+ }
560
+ case "--standard-packages":
561
+ case "--\u0441\u0442\u0430\u043D\u0434\u0430\u0440\u0442\u043D\u044B\u0435-\u043F\u0430\u043A\u0435\u0442\u044B": {
562
+ const path = this.tryParseStringArgument(index + 1, args);
563
+ if (path !== void 0) {
564
+ result.standardPackagesPath = resolve(cwd, path);
565
+ index++;
566
+ }
567
+ break;
568
+ }
569
+ }
570
+ }
571
+ }
572
+ static tryParseStringArgument(index, args) {
573
+ if (index < args.length && !args[index].startsWith("-")) {
574
+ return args[index];
575
+ }
576
+ return void 0;
577
+ }
578
+ };
579
+
580
+ export {
581
+ FileSystemUri,
582
+ PhysicalFileSystem,
583
+ PhysicalTypeScriptLibrariesProvider,
584
+ NodeCompiler,
585
+ PrintingDiagnosticAcceptor,
586
+ NodeDiagnosticFormatter,
587
+ CommandLineCompiler
588
+ };