@spyglassmc/core 0.1.0 → 0.2.0

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 (196) hide show
  1. package/README.md +7 -0
  2. package/lib/browser.d.ts +2 -0
  3. package/lib/browser.js +2 -0
  4. package/lib/common/TwoWayMap.d.ts +21 -0
  5. package/lib/common/TwoWayMap.js +69 -0
  6. package/lib/common/externals/BrowserExternals.d.ts +3 -0
  7. package/lib/common/externals/BrowserExternals.js +191 -0
  8. package/lib/common/externals/NodeJsExternals.d.ts +3 -0
  9. package/lib/common/externals/NodeJsExternals.js +151 -0
  10. package/lib/common/externals/downloader.d.ts +31 -0
  11. package/lib/common/externals/downloader.js +32 -0
  12. package/lib/common/externals/index.d.ts +96 -0
  13. package/lib/common/externals/index.js +2 -0
  14. package/lib/common/index.d.ts +2 -1
  15. package/lib/common/index.js +2 -13
  16. package/lib/common/util.d.ts +17 -34
  17. package/lib/common/util.js +32 -113
  18. package/lib/index.d.ts +7 -7
  19. package/lib/index.js +7 -19
  20. package/lib/node/AstNode.d.ts +3 -3
  21. package/lib/node/AstNode.js +10 -16
  22. package/lib/node/BooleanNode.d.ts +2 -2
  23. package/lib/node/BooleanNode.js +4 -7
  24. package/lib/node/CommentNode.d.ts +1 -1
  25. package/lib/node/CommentNode.js +2 -5
  26. package/lib/node/ErrorNode.d.ts +1 -1
  27. package/lib/node/ErrorNode.js +2 -5
  28. package/lib/node/FileNode.d.ts +3 -3
  29. package/lib/node/FileNode.js +2 -5
  30. package/lib/node/FloatNode.d.ts +2 -2
  31. package/lib/node/FloatNode.js +4 -7
  32. package/lib/node/IntegerNode.d.ts +2 -2
  33. package/lib/node/IntegerNode.js +4 -7
  34. package/lib/node/ListNode.d.ts +2 -2
  35. package/lib/node/ListNode.js +2 -5
  36. package/lib/node/LiteralNode.d.ts +4 -4
  37. package/lib/node/LiteralNode.js +5 -8
  38. package/lib/node/LongNode.d.ts +2 -2
  39. package/lib/node/LongNode.js +4 -7
  40. package/lib/node/RecordNode.d.ts +2 -2
  41. package/lib/node/RecordNode.js +2 -5
  42. package/lib/node/ResourceLocationNode.d.ts +6 -8
  43. package/lib/node/ResourceLocationNode.js +9 -12
  44. package/lib/node/Sequence.d.ts +4 -3
  45. package/lib/node/Sequence.js +4 -6
  46. package/lib/node/StringNode.d.ts +5 -5
  47. package/lib/node/StringNode.js +9 -12
  48. package/lib/node/SymbolNode.d.ts +4 -4
  49. package/lib/node/SymbolNode.js +5 -8
  50. package/lib/node/index.d.ts +15 -15
  51. package/lib/node/index.js +15 -27
  52. package/lib/nodejs.d.ts +2 -0
  53. package/lib/nodejs.js +2 -0
  54. package/lib/parser/Parser.d.ts +3 -3
  55. package/lib/parser/Parser.js +1 -4
  56. package/lib/parser/boolean.d.ts +2 -2
  57. package/lib/parser/boolean.js +3 -6
  58. package/lib/parser/comment.d.ts +2 -2
  59. package/lib/parser/comment.js +5 -9
  60. package/lib/parser/empty.d.ts +1 -1
  61. package/lib/parser/empty.js +1 -5
  62. package/lib/parser/error.d.ts +2 -2
  63. package/lib/parser/error.js +5 -9
  64. package/lib/parser/file.d.ts +3 -3
  65. package/lib/parser/file.js +9 -13
  66. package/lib/parser/float.d.ts +4 -4
  67. package/lib/parser/float.js +12 -16
  68. package/lib/parser/index.d.ts +16 -16
  69. package/lib/parser/index.js +16 -34
  70. package/lib/parser/integer.d.ts +4 -4
  71. package/lib/parser/integer.js +10 -14
  72. package/lib/parser/list.d.ts +2 -2
  73. package/lib/parser/list.js +15 -19
  74. package/lib/parser/literal.d.ts +2 -2
  75. package/lib/parser/literal.js +5 -9
  76. package/lib/parser/long.d.ts +4 -4
  77. package/lib/parser/long.js +10 -14
  78. package/lib/parser/record.d.ts +3 -3
  79. package/lib/parser/record.js +20 -24
  80. package/lib/parser/resourceLocation.d.ts +2 -2
  81. package/lib/parser/resourceLocation.js +14 -18
  82. package/lib/parser/string.d.ts +7 -7
  83. package/lib/parser/string.js +40 -44
  84. package/lib/parser/symbol.d.ts +3 -3
  85. package/lib/parser/symbol.js +3 -7
  86. package/lib/parser/util.d.ts +30 -12
  87. package/lib/parser/util.js +78 -63
  88. package/lib/processor/ColorInfoProvider.d.ts +1 -1
  89. package/lib/processor/ColorInfoProvider.js +6 -9
  90. package/lib/processor/InlayHintProvider.d.ts +2 -2
  91. package/lib/processor/InlayHintProvider.js +1 -2
  92. package/lib/processor/SignatureHelpProvider.d.ts +2 -2
  93. package/lib/processor/SignatureHelpProvider.js +1 -2
  94. package/lib/processor/checker/Checker.d.ts +2 -2
  95. package/lib/processor/checker/Checker.js +1 -5
  96. package/lib/processor/checker/builtin.d.ts +5 -4
  97. package/lib/processor/checker/builtin.js +26 -28
  98. package/lib/processor/checker/index.d.ts +2 -2
  99. package/lib/processor/checker/index.js +2 -27
  100. package/lib/processor/colorizer/Colorizer.d.ts +4 -4
  101. package/lib/processor/colorizer/Colorizer.js +8 -11
  102. package/lib/processor/colorizer/builtin.d.ts +3 -3
  103. package/lib/processor/colorizer/builtin.js +33 -46
  104. package/lib/processor/colorizer/index.d.ts +2 -2
  105. package/lib/processor/colorizer/index.js +2 -27
  106. package/lib/processor/completer/Completer.d.ts +4 -4
  107. package/lib/processor/completer/Completer.js +14 -33
  108. package/lib/processor/completer/builtin.d.ts +7 -7
  109. package/lib/processor/completer/builtin.js +58 -74
  110. package/lib/processor/completer/index.d.ts +2 -2
  111. package/lib/processor/completer/index.js +2 -27
  112. package/lib/processor/formatter/Formatter.d.ts +2 -2
  113. package/lib/processor/formatter/Formatter.js +2 -7
  114. package/lib/processor/formatter/builtin.d.ts +3 -3
  115. package/lib/processor/formatter/builtin.js +22 -36
  116. package/lib/processor/formatter/index.d.ts +2 -2
  117. package/lib/processor/formatter/index.js +2 -27
  118. package/lib/processor/index.d.ts +9 -9
  119. package/lib/processor/index.js +9 -21
  120. package/lib/processor/linter/Linter.d.ts +2 -2
  121. package/lib/processor/linter/Linter.js +1 -2
  122. package/lib/processor/linter/builtin/undeclaredSymbol.d.ts +2 -2
  123. package/lib/processor/linter/builtin/undeclaredSymbol.js +23 -27
  124. package/lib/processor/linter/builtin.d.ts +3 -3
  125. package/lib/processor/linter/builtin.js +19 -31
  126. package/lib/processor/linter/index.d.ts +2 -2
  127. package/lib/processor/linter/index.js +2 -27
  128. package/lib/processor/util.d.ts +2 -2
  129. package/lib/processor/util.js +4 -9
  130. package/lib/service/CacheService.d.ts +6 -6
  131. package/lib/service/CacheService.js +38 -48
  132. package/lib/service/Config.d.ts +17 -16
  133. package/lib/service/Config.js +56 -51
  134. package/lib/service/Context.d.ts +14 -14
  135. package/lib/service/Context.js +30 -32
  136. package/lib/service/Dependency.js +2 -5
  137. package/lib/service/Downloader.d.ts +10 -39
  138. package/lib/service/Downloader.js +37 -106
  139. package/lib/service/ErrorReporter.d.ts +2 -2
  140. package/lib/service/ErrorReporter.js +11 -15
  141. package/lib/service/FileService.d.ts +41 -14
  142. package/lib/service/FileService.js +107 -81
  143. package/lib/service/Hover.d.ts +2 -2
  144. package/lib/service/Hover.js +4 -7
  145. package/lib/service/Logger.js +2 -5
  146. package/lib/service/MetaRegistry.d.ts +12 -12
  147. package/lib/service/MetaRegistry.js +62 -73
  148. package/lib/service/Operations.js +3 -9
  149. package/lib/service/Profiler.d.ts +1 -1
  150. package/lib/service/Profiler.js +25 -41
  151. package/lib/service/Project.d.ts +50 -51
  152. package/lib/service/Project.js +240 -238
  153. package/lib/service/Service.d.ts +19 -29
  154. package/lib/service/Service.js +57 -53
  155. package/lib/service/SymbolLocations.d.ts +3 -3
  156. package/lib/service/SymbolLocations.js +4 -7
  157. package/lib/service/SymbolRegistrar.d.ts +1 -1
  158. package/lib/service/SymbolRegistrar.js +1 -2
  159. package/lib/service/fileUtil.d.ts +21 -41
  160. package/lib/service/fileUtil.js +59 -129
  161. package/lib/service/index.d.ts +17 -17
  162. package/lib/service/index.js +17 -31
  163. package/lib/source/IndexMap.d.ts +1 -1
  164. package/lib/source/IndexMap.js +7 -10
  165. package/lib/source/LanguageError.d.ts +2 -2
  166. package/lib/source/LanguageError.js +3 -6
  167. package/lib/source/Location.d.ts +3 -3
  168. package/lib/source/Location.js +6 -9
  169. package/lib/source/Offset.d.ts +1 -1
  170. package/lib/source/Offset.js +4 -7
  171. package/lib/source/Position.js +2 -5
  172. package/lib/source/PositionRange.d.ts +2 -2
  173. package/lib/source/PositionRange.js +14 -17
  174. package/lib/source/Range.d.ts +1 -1
  175. package/lib/source/Range.js +7 -10
  176. package/lib/source/Source.d.ts +12 -4
  177. package/lib/source/Source.js +84 -29
  178. package/lib/source/index.d.ts +8 -8
  179. package/lib/source/index.js +8 -20
  180. package/lib/symbol/Symbol.d.ts +15 -15
  181. package/lib/symbol/Symbol.js +53 -68
  182. package/lib/symbol/SymbolUtil.d.ts +23 -33
  183. package/lib/symbol/SymbolUtil.js +162 -163
  184. package/lib/symbol/UriBinder.d.ts +1 -1
  185. package/lib/symbol/UriBinder.js +1 -2
  186. package/lib/symbol/index.d.ts +3 -3
  187. package/lib/symbol/index.js +3 -15
  188. package/package.json +7 -4
  189. package/lib/common/Heap.d.ts +0 -1
  190. package/lib/common/Heap.js +0 -2
  191. package/lib/node/TableNode.d.ts +0 -17
  192. package/lib/node/TableNode.js +0 -11
  193. package/lib/parser/table.d.ts +0 -22
  194. package/lib/parser/table.js +0 -97
  195. package/lib/service/CommandExecutor.d.ts +0 -3
  196. package/lib/service/CommandExecutor.js +0 -7
@@ -1,163 +1,65 @@
1
- "use strict";
2
1
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
2
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
3
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
6
  };
8
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
9
- if (kind === "m") throw new TypeError("Private method is not writable");
10
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
11
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
12
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
13
- };
14
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
15
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
16
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
17
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
18
- };
19
- var __importDefault = (this && this.__importDefault) || function (mod) {
20
- return (mod && mod.__esModule) ? mod : { "default": mod };
21
- };
22
- var _Project_cacheSaverIntervalId, _Project_clientManagedUris, _Project_configService, _Project_docAndNodes, _Project_initializers, _Project_initPromise, _Project_readyPromise, _Project_watchedFiles, _Project_watcher, _Project_watcherReady, _Project_dependencyRoots, _Project_dependencyFiles, _Project_roots, _Project_ctx, _Project_cacheRoot;
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.Project = exports.ProjectData = void 0;
25
- const chokidar_1 = __importDefault(require("chokidar"));
26
- const events_1 = __importDefault(require("events"));
27
- const p_limit_1 = __importDefault(require("p-limit"));
28
- const vscode_languageserver_textdocument_1 = require("vscode-languageserver-textdocument");
29
- const _1 = require(".");
30
- const common_1 = require("../common");
31
- const node_1 = require("../node");
32
- const parser_1 = require("../parser");
33
- const processor_1 = require("../processor");
34
- const source_1 = require("../source");
35
- const symbol_1 = require("../symbol");
36
- const CacheService_1 = require("./CacheService");
37
- const Config_1 = require("./Config");
38
- const Context_1 = require("./Context");
39
- const Dependency_1 = require("./Dependency");
40
- const Downloader_1 = require("./Downloader");
41
- const ErrorReporter_1 = require("./ErrorReporter");
42
- const FileService_1 = require("./FileService");
43
- const fileUtil_1 = require("./fileUtil");
44
- const Logger_1 = require("./Logger");
45
- const MetaRegistry_1 = require("./MetaRegistry");
46
- const Profiler_1 = require("./Profiler");
7
+ import { TextDocument } from 'vscode-languageserver-textdocument';
8
+ import { bufferToString, CachePromise } from '../common/index.js';
9
+ import { FileNode } from '../node/index.js';
10
+ import { file } from '../parser/index.js';
11
+ import { traversePreOrder } from '../processor/index.js';
12
+ import { Source } from '../source/index.js';
13
+ import { SymbolUtil } from '../symbol/index.js';
14
+ import { CacheService } from './CacheService.js';
15
+ import { ConfigService, LinterConfigValue } from './Config.js';
16
+ import { CheckerContext, LinterContext, ParserContext, UriBinderContext } from './Context.js';
17
+ import { DependencyKey } from './Dependency.js';
18
+ import { Downloader } from './Downloader.js';
19
+ import { LinterErrorReporter } from './ErrorReporter.js';
20
+ import { ArchiveUriSupporter, FileService, FileUriSupporter } from './FileService.js';
21
+ import { fileUtil } from './fileUtil.js';
22
+ import { Logger } from './Logger.js';
23
+ import { MetaRegistry } from './MetaRegistry.js';
24
+ import { ProfilerFactory } from './Profiler.js';
47
25
  const CacheAutoSaveInterval = 600000; // 10 Minutes.
48
- var ProjectData;
49
- (function (ProjectData) {
50
- function mock(data = {}) {
51
- const cacheRoot = data.cacheRoot ?? '/some/random/garbage/path/that/definitely/does/not/exist';
52
- const logger = data.logger ?? Logger_1.Logger.create();
53
- const downloader = data.downloader ?? new Downloader_1.Downloader(cacheRoot, logger, _1.LowLevelDownloader.mock({ fixtures: {} }));
54
- return {
55
- cacheRoot,
56
- config: data.config ?? Config_1.VanillaConfig,
57
- ctx: data.ctx ?? {},
58
- downloader,
59
- ensureParsedAndChecked: data.ensureParsedAndChecked,
60
- fs: data.fs ?? FileService_1.FileService.create(),
61
- get: data.get ?? (() => undefined),
62
- logger,
63
- meta: data.meta ?? new MetaRegistry_1.MetaRegistry(),
64
- profilers: data.profilers ?? Profiler_1.ProfilerFactory.noop(),
65
- projectRoot: data.projectRoot ?? 'file:///',
66
- roots: data.roots ?? [],
67
- symbols: data.symbols ?? new symbol_1.SymbolUtil({}),
68
- };
69
- }
70
- ProjectData.mock = mock;
71
- })(ProjectData = exports.ProjectData || (exports.ProjectData = {}));
72
26
  /* istanbul ignore next */
73
27
  /**
74
28
  * Manage all tracked documents and errors.
75
29
  */
76
- class Project extends events_1.default {
77
- constructor({ cacheRoot, downloader, fs = FileService_1.FileService.create(), initializers = [], logger = Logger_1.Logger.create(), profilers = Profiler_1.ProfilerFactory.noop(), projectPath, }) {
78
- super();
79
- _Project_cacheSaverIntervalId.set(this, void 0);
80
- /**
81
- * URI of files that are currently managed by the language client.
82
- */
83
- _Project_clientManagedUris.set(this, new Set());
84
- _Project_configService.set(this, void 0);
85
- _Project_docAndNodes.set(this, new Map());
86
- _Project_initializers.set(this, void 0);
87
- _Project_initPromise.set(this, void 0);
88
- _Project_readyPromise.set(this, void 0);
89
- _Project_watchedFiles.set(this, new Set());
90
- _Project_watcher.set(this, void 0);
91
- _Project_watcherReady.set(this, false);
92
- this.meta = new MetaRegistry_1.MetaRegistry();
93
- _Project_dependencyRoots.set(this, void 0);
94
- _Project_dependencyFiles.set(this, void 0);
95
- _Project_roots.set(this, []
96
- /**
97
- * All tracked root URIs. Each URI in this array is guaranteed to end with a slash (`/`).
98
- *
99
- * Includes the roots of all dependencies, the project root, and all data pack roots identified
100
- * by `pack.mcmeta` files.
101
- *
102
- * Some URIs in the array may overlap with each other. In such cases, the deeper ones are guaranteed to come
103
- * before the shallower ones (e.g. `file:///foo/bar/` will come before `file:///foo/`).
104
- */
105
- );
106
- _Project_ctx.set(this, void 0);
107
- _Project_cacheRoot.set(this, void 0);
108
- __classPrivateFieldSet(this, _Project_cacheRoot, cacheRoot, "f");
109
- this.cacheService = new CacheService_1.CacheService(cacheRoot, this);
110
- __classPrivateFieldSet(this, _Project_configService, new Config_1.ConfigService(this), "f");
111
- this.downloader = downloader ?? new Downloader_1.Downloader(cacheRoot, logger);
112
- this.fs = fs;
113
- __classPrivateFieldSet(this, _Project_initializers, initializers, "f");
114
- this.logger = logger;
115
- this.profilers = profilers;
116
- this.projectPath = projectPath;
117
- this.projectRoot = fileUtil_1.fileUtil.ensureEndingSlash(fileUtil_1.fileUtil.pathToFileUri(projectPath));
118
- this.symbols = new symbol_1.SymbolUtil({});
119
- __classPrivateFieldSet(this, _Project_ctx, {}, "f");
120
- this.logger.info(`[Project] [init] cacheRoot = “${cacheRoot}”`);
121
- __classPrivateFieldGet(this, _Project_configService, "f")
122
- .on('changed', ({ config }) => {
123
- this.config = config;
124
- this.logger.info('[Project] [Config] Changed');
125
- })
126
- .on('error', ({ error, uri }) => this.logger.error(`[Project] [Config] Failed loading “${uri}”`, error));
127
- this.setInitPromise();
128
- this.setReadyPromise();
129
- __classPrivateFieldSet(this, _Project_cacheSaverIntervalId, setInterval(() => this.cacheService.save(), CacheAutoSaveInterval), "f");
130
- this
131
- .on('documentUpdated', ({ doc, node }) => {
132
- this.emit('documentErrorred', {
133
- doc,
134
- errors: node_1.FileNode.getErrors(node),
135
- node,
136
- });
137
- })
138
- .on('fileCreated', async ({ uri }) => {
139
- __classPrivateFieldGet(this, _Project_watchedFiles, "f").add(uri);
140
- if (uri.endsWith(Project.RootSuffix)) {
141
- this.updateRoots();
142
- }
143
- this.bind(uri);
144
- return this.ensureParsedAndChecked(uri);
145
- })
146
- .on('fileModified', async ({ uri }) => {
147
- if (this.isOnlyWatched(uri)) {
148
- __classPrivateFieldGet(this, _Project_docAndNodes, "f").delete(uri);
149
- await this.ensureParsedAndChecked(uri);
150
- }
151
- })
152
- .on('fileDeleted', ({ uri }) => {
153
- __classPrivateFieldGet(this, _Project_watchedFiles, "f").delete(uri);
154
- if (uri.endsWith(Project.RootSuffix)) {
155
- this.updateRoots();
156
- }
157
- this.symbols.clear({ uri });
158
- this.tryClearingCache(uri);
159
- });
160
- }
30
+ export class Project {
31
+ static RootSuffix = '/pack.mcmeta';
32
+ #cacheSaverIntervalId;
33
+ cacheService;
34
+ /**
35
+ * URI of files that are currently managed by the language client.
36
+ */
37
+ #clientManagedUris = new Set();
38
+ #configService;
39
+ #docAndNodes = new Map();
40
+ #eventEmitter;
41
+ #initializers;
42
+ #initPromise;
43
+ #readyPromise;
44
+ #watchedFiles = new Set();
45
+ #watcher;
46
+ #watcherReady = false;
47
+ #isReady = false;
48
+ get isReady() {
49
+ return this.#isReady;
50
+ }
51
+ config;
52
+ downloader;
53
+ externals;
54
+ fs;
55
+ logger;
56
+ meta = new MetaRegistry();
57
+ profilers;
58
+ projectRoot;
59
+ symbols;
60
+ #dependencyRoots;
61
+ #dependencyFiles;
62
+ #roots = [];
161
63
  /**
162
64
  * All tracked root URIs. Each URI in this array is guaranteed to end with a slash (`/`).
163
65
  *
@@ -168,22 +70,24 @@ class Project extends events_1.default {
168
70
  * before the shallower ones (e.g. `file:///foo/bar/` will come before `file:///foo/`).
169
71
  */
170
72
  get roots() {
171
- return __classPrivateFieldGet(this, _Project_roots, "f");
73
+ return this.#roots;
172
74
  }
75
+ #ctx;
173
76
  /**
174
77
  * Arbitrary information that will be included in the `project` property of all `Context`s.
175
78
  */
176
79
  get ctx() {
177
- return __classPrivateFieldGet(this, _Project_ctx, "f");
80
+ return this.#ctx;
178
81
  }
82
+ #cacheRoot;
179
83
  /**
180
- * File path to a directory where all cache files of Spyglass should be stored.
84
+ * File URI to a directory where all cache files of Spyglass should be stored.
181
85
  */
182
86
  get cacheRoot() {
183
- return __classPrivateFieldGet(this, _Project_cacheRoot, "f");
87
+ return this.#cacheRoot;
184
88
  }
185
89
  updateRoots() {
186
- const rawRoots = [...__classPrivateFieldGet(this, _Project_dependencyRoots, "f"), this.projectRoot];
90
+ const rawRoots = [...this.#dependencyRoots, this.projectRoot];
187
91
  const ans = new Set(rawRoots);
188
92
  // Identify roots indicated by `pack.mcmeta`.
189
93
  for (const file of this.getTrackedFiles()) {
@@ -191,8 +95,19 @@ class Project extends events_1.default {
191
95
  ans.add(file.slice(0, 1 - Project.RootSuffix.length));
192
96
  }
193
97
  }
194
- __classPrivateFieldSet(this, _Project_roots, [...ans].sort((a, b) => b.length - a.length), "f");
195
- this.emit('rootsUpdated', { roots: __classPrivateFieldGet(this, _Project_roots, "f") });
98
+ this.#roots = [...ans].sort((a, b) => b.length - a.length);
99
+ this.emit('rootsUpdated', { roots: this.#roots });
100
+ }
101
+ on(event, callbackFn) {
102
+ this.#eventEmitter.on(event, callbackFn);
103
+ return this;
104
+ }
105
+ once(event, callbackFn) {
106
+ this.#eventEmitter.once(event, callbackFn);
107
+ return this;
108
+ }
109
+ emit(event, ...args) {
110
+ return this.#eventEmitter.emit(event, ...args);
196
111
  }
197
112
  /**
198
113
  * Get all files that are tracked and supported.
@@ -202,38 +117,107 @@ class Project extends events_1.default {
202
117
  */
203
118
  getTrackedFiles() {
204
119
  const extensions = this.meta.getSupportedFileExtensions();
205
- return [...__classPrivateFieldGet(this, _Project_dependencyFiles, "f"), ...__classPrivateFieldGet(this, _Project_watchedFiles, "f")]
206
- .filter(file => extensions.includes(fileUtil_1.fileUtil.extname(file) ?? ''));
120
+ return [...this.#dependencyFiles, ...this.#watchedFiles]
121
+ .filter(file => extensions.includes(fileUtil.extname(file) ?? ''));
122
+ }
123
+ constructor({ cacheRoot, defaultConfig, downloader, externals, fs = FileService.create(externals, cacheRoot), initializers = [], logger = Logger.create(), profilers = ProfilerFactory.noop(), projectRoot, }) {
124
+ this.#cacheRoot = cacheRoot;
125
+ this.#eventEmitter = new externals.event.EventEmitter();
126
+ this.externals = externals;
127
+ this.fs = fs;
128
+ this.#initializers = initializers;
129
+ this.logger = logger;
130
+ this.profilers = profilers;
131
+ this.projectRoot = projectRoot;
132
+ this.cacheService = new CacheService(cacheRoot, this);
133
+ this.#configService = new ConfigService(this, defaultConfig);
134
+ this.downloader = downloader ?? new Downloader(cacheRoot, externals, logger);
135
+ this.symbols = new SymbolUtil({}, externals.event.EventEmitter);
136
+ this.#ctx = {};
137
+ this.logger.info(`[Project] [init] cacheRoot = “${cacheRoot}”`);
138
+ this.#configService
139
+ .on('changed', ({ config }) => {
140
+ this.config = config;
141
+ this.logger.info('[Project] [Config] Changed');
142
+ })
143
+ .on('error', ({ error, uri }) => this.logger.error(`[Project] [Config] Failed loading “${uri}”`, error));
144
+ this.setInitPromise();
145
+ this.setReadyPromise();
146
+ this.#cacheSaverIntervalId = setInterval(() => this.cacheService.save(), CacheAutoSaveInterval);
147
+ this
148
+ .on('documentUpdated', ({ doc, node }) => {
149
+ if (!this.#isReady) {
150
+ return;
151
+ }
152
+ this.emit('documentErrorred', {
153
+ doc,
154
+ errors: FileNode.getErrors(node),
155
+ node,
156
+ });
157
+ })
158
+ .on('fileCreated', async ({ uri }) => {
159
+ if (uri.endsWith(Project.RootSuffix)) {
160
+ this.updateRoots();
161
+ }
162
+ this.bind(uri);
163
+ return this.ensureParsedAndChecked(uri);
164
+ })
165
+ .on('fileModified', async ({ uri }) => {
166
+ if (this.isOnlyWatched(uri)) {
167
+ this.#docAndNodes.delete(uri);
168
+ await this.ensureParsedAndChecked(uri);
169
+ }
170
+ })
171
+ .on('fileDeleted', ({ uri }) => {
172
+ if (uri.endsWith(Project.RootSuffix)) {
173
+ this.updateRoots();
174
+ }
175
+ this.symbols.clear({ uri });
176
+ this.tryClearingCache(uri);
177
+ })
178
+ .on('ready', () => {
179
+ this.#isReady = true;
180
+ // Recheck client managed files.
181
+ const promises = [];
182
+ for (const uri of this.#clientManagedUris) {
183
+ const result = this.#docAndNodes.get(uri);
184
+ if (result) {
185
+ promises.push(this.check(result.doc, result.node));
186
+ }
187
+ }
188
+ Promise.all(promises).catch(e => this.logger.error('[Project#ready] Error occurred when rechecking client managed files after ready', e));
189
+ });
207
190
  }
208
191
  setInitPromise() {
209
192
  const loadConfig = async () => {
210
- this.config = await __classPrivateFieldGet(this, _Project_configService, "f").load();
193
+ this.config = await this.#configService.load();
211
194
  };
212
195
  const callIntializers = async () => {
213
196
  const initCtx = {
214
197
  cacheRoot: this.cacheRoot,
215
198
  config: this.config,
216
199
  downloader: this.downloader,
200
+ externals: this.externals,
217
201
  logger: this.logger,
218
202
  meta: this.meta,
219
203
  projectRoot: this.projectRoot,
220
204
  };
221
- const results = await Promise.allSettled(__classPrivateFieldGet(this, _Project_initializers, "f").map(init => init(initCtx)));
205
+ const results = await Promise.allSettled(this.#initializers.map(init => init(initCtx)));
222
206
  let ctx = {};
223
207
  results.forEach(async (r, i) => {
224
208
  if (r.status === 'rejected') {
225
- this.logger.error(`[Project] [callInitializers] [${i}] “${__classPrivateFieldGet(this, _Project_initializers, "f")[i].name}”`, r.reason);
209
+ this.logger.error(`[Project] [callInitializers] [${i}] “${this.#initializers[i].name}”`, r.reason);
226
210
  }
227
211
  else if (r.value) {
228
212
  ctx = { ...ctx, ...r.value };
229
213
  }
230
214
  });
231
- __classPrivateFieldSet(this, _Project_ctx, ctx, "f");
215
+ this.#ctx = ctx;
232
216
  };
233
217
  const init = async () => {
234
218
  const __profiler = this.profilers.get('project#init');
235
219
  const { symbols } = await this.cacheService.load();
236
- this.symbols = new symbol_1.SymbolUtil(symbols);
220
+ this.symbols = new SymbolUtil(symbols, this.externals.event.EventEmitter);
237
221
  this.symbols.buildCache();
238
222
  __profiler.task('Load Cache');
239
223
  await loadConfig();
@@ -241,13 +225,13 @@ class Project extends events_1.default {
241
225
  await callIntializers();
242
226
  __profiler.task('Initialize').finalize();
243
227
  };
244
- __classPrivateFieldSet(this, _Project_initPromise, init(), "f");
228
+ this.#initPromise = init();
245
229
  }
246
230
  setReadyPromise() {
247
231
  const getDependencies = async () => {
248
232
  const ans = [];
249
233
  for (const dependency of this.config.env.dependencies) {
250
- if (Dependency_1.DependencyKey.is(dependency)) {
234
+ if (DependencyKey.is(dependency)) {
251
235
  const provider = this.meta.getDependencyProvider(dependency);
252
236
  if (provider) {
253
237
  try {
@@ -270,55 +254,51 @@ class Project extends events_1.default {
270
254
  };
271
255
  const listDependencyFiles = async () => {
272
256
  const dependencies = await getDependencies();
273
- const fileUriSupporter = await FileService_1.FileUriSupporter.create(dependencies, this.logger);
274
- const spyglassUriSupporter = await FileService_1.SpyglassUriSupporter.create(dependencies, this.logger, this.cacheService.checksums.roots);
257
+ const fileUriSupporter = await FileUriSupporter.create(dependencies, this.externals, this.logger);
258
+ const archiveUriSupporter = await ArchiveUriSupporter.create(dependencies, this.externals, this.logger, this.cacheService.checksums.roots);
275
259
  this.fs.register('file:', fileUriSupporter, true);
276
- this.fs.register(common_1.SpyglassUri.Protocol, spyglassUriSupporter, true);
260
+ this.fs.register(ArchiveUriSupporter.Protocol, archiveUriSupporter, true);
277
261
  };
278
262
  const listProjectFiles = () => new Promise(resolve => {
279
- __classPrivateFieldSet(this, _Project_watcherReady, false, "f");
280
- __classPrivateFieldSet(this, _Project_watcher, chokidar_1.default
281
- .watch(this.projectPath, { ignoreInitial: false })
263
+ this.#watcherReady = false;
264
+ this.#watcher = this.externals.fs
265
+ .watch(this.projectRoot)
282
266
  .once('ready', () => {
283
- __classPrivateFieldSet(this, _Project_watcherReady, true, "f");
267
+ this.#watcherReady = true;
284
268
  resolve();
285
269
  })
286
- .on('add', path => {
287
- const uri = fileUtil_1.fileUtil.pathToFileUri(path);
288
- __classPrivateFieldGet(this, _Project_watchedFiles, "f").add(uri);
289
- if (__classPrivateFieldGet(this, _Project_watcherReady, "f")) {
270
+ .on('add', uri => {
271
+ this.#watchedFiles.add(uri);
272
+ if (this.#watcherReady) {
290
273
  this.emit('fileCreated', { uri });
291
274
  }
292
275
  })
293
- .on('change', path => {
294
- const uri = fileUtil_1.fileUtil.pathToFileUri(path);
295
- if (__classPrivateFieldGet(this, _Project_watcherReady, "f")) {
276
+ .on('change', uri => {
277
+ if (this.#watcherReady) {
296
278
  this.emit('fileModified', { uri });
297
279
  }
298
280
  })
299
- .on('unlink', path => {
300
- const uri = fileUtil_1.fileUtil.pathToFileUri(path);
301
- __classPrivateFieldGet(this, _Project_watchedFiles, "f").delete(uri);
302
- if (__classPrivateFieldGet(this, _Project_watcherReady, "f")) {
281
+ .on('unlink', uri => {
282
+ this.#watchedFiles.delete(uri);
283
+ if (this.#watcherReady) {
303
284
  this.emit('fileDeleted', { uri });
304
285
  }
305
286
  })
306
287
  .on('error', e => {
307
288
  this.logger.error('[Project] [chokidar]', e);
308
- }), "f");
289
+ });
309
290
  });
310
291
  const ready = async () => {
311
292
  await this.init();
312
293
  const __profiler = this.profilers.get('project#ready');
313
- const limit = (0, p_limit_1.default)(8);
314
294
  const ensureParsed = this.ensureParsed.bind(this);
315
295
  const ensureChecked = this.ensureChecked.bind(this);
316
296
  await Promise.all([
317
297
  listDependencyFiles(),
318
298
  listProjectFiles(),
319
299
  ]);
320
- __classPrivateFieldSet(this, _Project_dependencyFiles, new Set(this.fs.listFiles()), "f");
321
- __classPrivateFieldSet(this, _Project_dependencyRoots, new Set(this.fs.listRoots()), "f");
300
+ this.#dependencyFiles = new Set(this.fs.listFiles());
301
+ this.#dependencyRoots = new Set(this.fs.listRoots());
322
302
  this.updateRoots();
323
303
  __profiler.task('List Files');
324
304
  for (const [id, { checksum, registrar }] of this.meta.symbolRegistrars) {
@@ -344,7 +324,7 @@ class Project extends events_1.default {
344
324
  this.bind(addedFiles);
345
325
  }
346
326
  __profiler.task('Bind URIs');
347
- const files = [...addedFiles, ...changedFiles]; // FIXME: nbtdoc files might need to be parsed and checked before others.
327
+ const files = [...addedFiles, ...changedFiles]; // FIXME: mcdoc files might need to be parsed and checked before others.
348
328
  // const docAndNodes = (await Promise.all(files.map(uri => limit(ensureParsed, uri)))).filter((r): r is DocAndNode => !!r)
349
329
  const docAndNodes = (await Promise.all(files.map(uri => ensureParsed(uri)))).filter((r) => !!r);
350
330
  __profiler.task('Parse Files');
@@ -353,28 +333,27 @@ class Project extends events_1.default {
353
333
  __profiler.task('Check Files').finalize();
354
334
  this.emit('ready', {});
355
335
  };
356
- __classPrivateFieldSet(this, _Project_readyPromise, ready(), "f");
336
+ this.#readyPromise = ready();
357
337
  }
358
338
  async init() {
359
- await __classPrivateFieldGet(this, _Project_initPromise, "f");
339
+ await this.#initPromise;
360
340
  return this;
361
341
  }
362
342
  async ready() {
363
- await __classPrivateFieldGet(this, _Project_initPromise, "f");
364
- await __classPrivateFieldGet(this, _Project_readyPromise, "f");
343
+ await this.#readyPromise;
365
344
  return this;
366
345
  }
367
346
  /**
368
347
  * Behavior of the `Project` instance is undefined after this function has settled.
369
348
  */
370
349
  async close() {
371
- clearInterval(__classPrivateFieldGet(this, _Project_cacheSaverIntervalId, "f"));
372
- await __classPrivateFieldGet(this, _Project_watcher, "f").close();
350
+ clearInterval(this.#cacheSaverIntervalId);
351
+ await this.#watcher.close();
373
352
  await this.cacheService.save();
374
353
  }
375
354
  async restart() {
376
355
  try {
377
- await __classPrivateFieldGet(this, _Project_watcher, "f").close();
356
+ await this.#watcher.close();
378
357
  this.setReadyPromise();
379
358
  await this.ready();
380
359
  }
@@ -385,36 +364,39 @@ class Project extends events_1.default {
385
364
  resetCache() {
386
365
  return this.cacheService.reset();
387
366
  }
367
+ normalizeUri(uri) {
368
+ return this.fs.mapFromDisk(this.externals.uri.normalize(uri));
369
+ }
388
370
  /**
389
371
  * @returns The language ID of the file, or the file extension without the leading dot.
390
372
  */
391
373
  getLanguageID(uri) {
392
- uri = fileUtil_1.fileUtil.normalize(uri);
393
- const ext = fileUtil_1.fileUtil.extname(uri) ?? '.plaintext';
374
+ uri = this.normalizeUri(uri);
375
+ const ext = fileUtil.extname(uri) ?? '.plaintext';
394
376
  return this.meta.getLanguageID(ext) ?? ext.slice(1);
395
377
  }
396
378
  /**
397
379
  * @returns The cached `TextDocument` and `AstNode` for the URI, or `undefined` when such data isn't available in cache.
398
380
  */
399
381
  get(uri) {
400
- uri = fileUtil_1.fileUtil.normalize(uri);
401
- return __classPrivateFieldGet(this, _Project_docAndNodes, "f").get(uri);
382
+ uri = this.normalizeUri(uri);
383
+ return this.#docAndNodes.get(uri);
402
384
  }
403
385
  /**
404
386
  * @throws FS-related errors
405
387
  */
406
388
  async ensureParsed(uri) {
407
- uri = fileUtil_1.fileUtil.normalize(uri);
408
- if (__classPrivateFieldGet(this, _Project_docAndNodes, "f").has(uri)) {
409
- return __classPrivateFieldGet(this, _Project_docAndNodes, "f").get(uri);
389
+ uri = this.normalizeUri(uri);
390
+ if (this.#docAndNodes.has(uri)) {
391
+ return this.#docAndNodes.get(uri);
410
392
  }
411
393
  const languageID = this.getLanguageID(uri);
412
394
  if (!this.meta.isSupportedLanguage(languageID)) {
413
395
  return undefined;
414
396
  }
415
397
  try {
416
- const content = (0, common_1.bufferToString)(await this.fs.readFile(uri));
417
- const doc = vscode_languageserver_textdocument_1.TextDocument.create(uri, languageID, -1, content);
398
+ const content = bufferToString(await this.fs.readFile(uri));
399
+ const doc = TextDocument.create(uri, languageID, -1, content);
418
400
  return this.parseAndCache(doc);
419
401
  }
420
402
  catch (e) {
@@ -427,22 +409,22 @@ class Project extends events_1.default {
427
409
  return this.cache(doc, node);
428
410
  }
429
411
  parse(doc) {
430
- const ctx = Context_1.ParserContext.create(this, { doc });
431
- const src = new source_1.Source(doc.getText());
412
+ const ctx = ParserContext.create(this, { doc });
413
+ const src = new Source(doc.getText());
432
414
  let ans;
433
415
  ctx.symbols.clear({ contributor: 'parser', uri: doc.uri });
434
- ctx.symbols.contributeAs('parser', () => ans = (0, parser_1.file)()(src, ctx));
416
+ ctx.symbols.contributeAs('parser', () => ans = file()(src, ctx));
435
417
  return ans;
436
418
  }
437
419
  cache(doc, node) {
438
420
  const data = { doc, node };
439
- __classPrivateFieldGet(this, _Project_docAndNodes, "f").set(doc.uri, data);
421
+ this.#docAndNodes.set(doc.uri, data);
440
422
  this.emit('documentUpdated', data);
441
423
  return data;
442
424
  }
443
425
  async check(doc, node) {
444
426
  const checker = this.meta.getChecker(node.type);
445
- const ctx = Context_1.CheckerContext.create(this, { doc });
427
+ const ctx = CheckerContext.create(this, { doc });
446
428
  ctx.symbols.clear({ contributor: 'checker', uri: doc.uri });
447
429
  await ctx.symbols.contributeAsAsync('checker', async () => {
448
430
  await checker(node, ctx);
@@ -464,7 +446,7 @@ class Project extends events_1.default {
464
446
  lint(doc, node) {
465
447
  node.linterErrors = [];
466
448
  for (const [ruleName, rawValue] of Object.entries(this.config.lint)) {
467
- const result = Config_1.LinterConfigValue.destruct(rawValue);
449
+ const result = LinterConfigValue.destruct(rawValue);
468
450
  if (!result) {
469
451
  // Rule is disabled (i.e. set to `null`) in the config.
470
452
  continue;
@@ -475,13 +457,13 @@ class Project extends events_1.default {
475
457
  // Config value is invalid.
476
458
  continue;
477
459
  }
478
- const ctx = Context_1.LinterContext.create(this, {
460
+ const ctx = LinterContext.create(this, {
479
461
  doc,
480
- err: new ErrorReporter_1.LinterErrorReporter(ruleName, ruleSeverity),
462
+ err: new LinterErrorReporter(ruleName, ruleSeverity),
481
463
  ruleName,
482
464
  ruleValue,
483
465
  });
484
- (0, processor_1.traversePreOrder)(node, () => true, () => true, node => {
466
+ traversePreOrder(node, () => true, () => true, node => {
485
467
  if (nodePredicate(node)) {
486
468
  linter(node, ctx);
487
469
  }
@@ -507,11 +489,18 @@ class Project extends events_1.default {
507
489
  }
508
490
  return result;
509
491
  }
492
+ async ensureParsedAndCheckedOnlyWhenReady(uri) {
493
+ const result = await this.ensureParsed(uri);
494
+ if (this.#isReady && result) {
495
+ await this.ensureChecked(result.doc, result.node);
496
+ }
497
+ return result;
498
+ }
510
499
  bind(param) {
511
- const ctx = Context_1.UriBinderContext.create(this);
512
- // Remove all symbol locations contributed by URI binders if the parameter is an array.
513
- // Otherwise only remove the ones associated with the specified URI.
514
- ctx.symbols.clear({ contributor: 'uri_binder', uri: Array.isArray(param) ? undefined : param });
500
+ const ctx = UriBinderContext.create(this);
501
+ if (typeof param === 'string') {
502
+ ctx.symbols.clear({ contributor: 'uri_binder', uri: param });
503
+ }
515
504
  ctx.symbols.contributeAs('uri_binder', () => {
516
505
  const uris = Array.isArray(param) ? param : [param];
517
506
  for (const binder of this.meta.uriBinders) {
@@ -523,40 +512,53 @@ class Project extends events_1.default {
523
512
  * Notify that a new document was opened in the editor.
524
513
  */
525
514
  onDidOpen(uri, languageID, version, content) {
526
- uri = fileUtil_1.fileUtil.normalize(uri);
527
- __classPrivateFieldGet(this, _Project_clientManagedUris, "f").add(uri);
528
- const doc = vscode_languageserver_textdocument_1.TextDocument.create(uri, languageID, version, content);
515
+ uri = this.normalizeUri(uri);
516
+ if (!fileUtil.isFileUri(uri)) {
517
+ return; // We only accept `file:` scheme for client-managed URIs.
518
+ }
519
+ this.#clientManagedUris.add(uri);
520
+ const doc = TextDocument.create(uri, languageID, version, content);
529
521
  const { node } = this.parseAndCache(doc);
530
- this.check(doc, node);
522
+ if (this.#isReady) {
523
+ this.check(doc, node);
524
+ }
531
525
  }
532
526
  /**
533
527
  * Notify that an existing document was changed in the editor.
534
528
  * @throws If there is no `TextDocument` corresponding to the URI.
535
529
  */
536
530
  onDidChange(uri, changes, version) {
537
- uri = fileUtil_1.fileUtil.normalize(uri);
531
+ uri = this.normalizeUri(uri);
532
+ if (!fileUtil.isFileUri(uri)) {
533
+ return; // We only accept `file:` scheme for client-managed URIs.
534
+ }
538
535
  const result = this.get(uri);
539
536
  if (!result) {
540
537
  throw new Error(`Document for “${uri}” is not cached. This should not happen. Did the language client send a didChange notification without sending a didOpen one?`);
541
538
  }
542
- vscode_languageserver_textdocument_1.TextDocument.update(result.doc, changes, version);
539
+ TextDocument.update(result.doc, changes, version);
543
540
  const { node } = this.parseAndCache(result.doc);
544
- this.check(result.doc, node);
541
+ if (this.#isReady) {
542
+ this.check(result.doc, node);
543
+ }
545
544
  }
546
545
  /**
547
546
  * Notify that an existing document was closed in the editor.
548
547
  */
549
548
  onDidClose(uri) {
550
- uri = fileUtil_1.fileUtil.normalize(uri);
551
- __classPrivateFieldGet(this, _Project_clientManagedUris, "f").delete(uri);
549
+ uri = this.normalizeUri(uri);
550
+ if (!fileUtil.isFileUri(uri)) {
551
+ return; // We only accept `file:` scheme for client-managed URIs.
552
+ }
553
+ this.#clientManagedUris.delete(uri);
552
554
  this.tryClearingCache(uri);
553
555
  }
554
556
  async showCacheRoot() {
555
- if (!__classPrivateFieldGet(this, _Project_cacheRoot, "f")) {
557
+ if (!this.#cacheRoot) {
556
558
  return;
557
559
  }
558
560
  try {
559
- await fileUtil_1.fileUtil.showFile(__classPrivateFieldGet(this, _Project_cacheRoot, "f"));
561
+ await this.externals.fs.showFile(this.#cacheRoot);
560
562
  }
561
563
  catch (e) {
562
564
  this.logger.error('[Service#showCacheRoot]', e);
@@ -564,30 +566,30 @@ class Project extends events_1.default {
564
566
  }
565
567
  tryClearingCache(uri) {
566
568
  if (this.shouldRemove(uri)) {
567
- __classPrivateFieldGet(this, _Project_docAndNodes, "f").delete(uri);
569
+ this.#docAndNodes.delete(uri);
568
570
  this.emit('documentRemoved', { uri });
569
571
  }
570
572
  }
571
573
  shouldRemove(uri) {
572
- return !__classPrivateFieldGet(this, _Project_clientManagedUris, "f").has(uri) && !__classPrivateFieldGet(this, _Project_dependencyFiles, "f").has(uri) && !__classPrivateFieldGet(this, _Project_watchedFiles, "f").has(uri);
574
+ return !this.#clientManagedUris.has(uri) && !this.#dependencyFiles.has(uri) && !this.#watchedFiles.has(uri);
573
575
  }
574
576
  isOnlyWatched(uri) {
575
- return __classPrivateFieldGet(this, _Project_watchedFiles, "f").has(uri) && !__classPrivateFieldGet(this, _Project_clientManagedUris, "f").has(uri) && !__classPrivateFieldGet(this, _Project_dependencyFiles, "f").has(uri);
577
+ return this.#watchedFiles.has(uri) && !this.#clientManagedUris.has(uri) && !this.#dependencyFiles.has(uri);
576
578
  }
577
579
  }
578
- _Project_cacheSaverIntervalId = new WeakMap(), _Project_clientManagedUris = new WeakMap(), _Project_configService = new WeakMap(), _Project_docAndNodes = new WeakMap(), _Project_initializers = new WeakMap(), _Project_initPromise = new WeakMap(), _Project_readyPromise = new WeakMap(), _Project_watchedFiles = new WeakMap(), _Project_watcher = new WeakMap(), _Project_watcherReady = new WeakMap(), _Project_dependencyRoots = new WeakMap(), _Project_dependencyFiles = new WeakMap(), _Project_roots = new WeakMap(), _Project_ctx = new WeakMap(), _Project_cacheRoot = new WeakMap();
579
- Project.RootSuffix = '/pack.mcmeta';
580
580
  __decorate([
581
- (0, common_1.CachePromise)()
581
+ CachePromise()
582
582
  ], Project.prototype, "ensureParsed", null);
583
583
  __decorate([
584
- (0, common_1.CachePromise)()
584
+ CachePromise()
585
585
  ], Project.prototype, "check", null);
586
586
  __decorate([
587
- (0, common_1.CachePromise)()
587
+ CachePromise()
588
588
  ], Project.prototype, "ensureChecked", null);
589
589
  __decorate([
590
- (0, common_1.CachePromise)()
590
+ CachePromise()
591
591
  ], Project.prototype, "ensureParsedAndChecked", null);
592
- exports.Project = Project;
592
+ __decorate([
593
+ CachePromise()
594
+ ], Project.prototype, "ensureParsedAndCheckedOnlyWhenReady", null);
593
595
  //# sourceMappingURL=Project.js.map