@typespec/compiler 0.41.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 (352) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +9 -0
  3. package/cmd/tsp-server.js +3 -0
  4. package/cmd/tsp.js +3 -0
  5. package/dist/cmd/runner.d.ts +9 -0
  6. package/dist/cmd/runner.d.ts.map +1 -0
  7. package/dist/cmd/runner.js +62 -0
  8. package/dist/cmd/runner.js.map +1 -0
  9. package/dist/config/config-interpolation.d.ts +11 -0
  10. package/dist/config/config-interpolation.d.ts.map +1 -0
  11. package/dist/config/config-interpolation.js +109 -0
  12. package/dist/config/config-interpolation.js.map +1 -0
  13. package/dist/config/config-loader.d.ts +25 -0
  14. package/dist/config/config-loader.d.ts.map +1 -0
  15. package/dist/config/config-loader.js +182 -0
  16. package/dist/config/config-loader.js.map +1 -0
  17. package/dist/config/config-schema.d.ts +4 -0
  18. package/dist/config/config-schema.d.ts.map +1 -0
  19. package/dist/config/config-schema.js +84 -0
  20. package/dist/config/config-schema.js.map +1 -0
  21. package/dist/config/index.d.ts +3 -0
  22. package/dist/config/index.d.ts.map +1 -0
  23. package/dist/config/index.js +3 -0
  24. package/dist/config/index.js.map +1 -0
  25. package/dist/config/types.d.ts +79 -0
  26. package/dist/config/types.d.ts.map +1 -0
  27. package/dist/config/types.js +2 -0
  28. package/dist/config/types.js.map +1 -0
  29. package/dist/core/binder.d.ts +29 -0
  30. package/dist/core/binder.d.ts.map +1 -0
  31. package/dist/core/binder.js +455 -0
  32. package/dist/core/binder.js.map +1 -0
  33. package/dist/core/charcode.d.ts +130 -0
  34. package/dist/core/charcode.d.ts.map +1 -0
  35. package/dist/core/charcode.js +115 -0
  36. package/dist/core/charcode.js.map +1 -0
  37. package/dist/core/checker.d.ts +138 -0
  38. package/dist/core/checker.d.ts.map +1 -0
  39. package/dist/core/checker.js +4070 -0
  40. package/dist/core/checker.js.map +1 -0
  41. package/dist/core/cli/args.d.ts +18 -0
  42. package/dist/core/cli/args.d.ts.map +1 -0
  43. package/dist/core/cli/args.js +108 -0
  44. package/dist/core/cli/args.js.map +1 -0
  45. package/dist/core/cli/cli.d.ts +2 -0
  46. package/dist/core/cli/cli.d.ts.map +1 -0
  47. package/dist/core/cli/cli.js +477 -0
  48. package/dist/core/cli/cli.js.map +1 -0
  49. package/dist/core/cli/index.d.ts +2 -0
  50. package/dist/core/cli/index.d.ts.map +1 -0
  51. package/dist/core/cli/index.js +2 -0
  52. package/dist/core/cli/index.js.map +1 -0
  53. package/dist/core/decorator-utils.d.ts +108 -0
  54. package/dist/core/decorator-utils.d.ts.map +1 -0
  55. package/dist/core/decorator-utils.js +326 -0
  56. package/dist/core/decorator-utils.js.map +1 -0
  57. package/dist/core/diagnostics.d.ts +93 -0
  58. package/dist/core/diagnostics.d.ts.map +1 -0
  59. package/dist/core/diagnostics.js +315 -0
  60. package/dist/core/diagnostics.js.map +1 -0
  61. package/dist/core/emitter-utils.d.ts +14 -0
  62. package/dist/core/emitter-utils.d.ts.map +1 -0
  63. package/dist/core/emitter-utils.js +16 -0
  64. package/dist/core/emitter-utils.js.map +1 -0
  65. package/dist/core/formatter-fs.d.ts +21 -0
  66. package/dist/core/formatter-fs.d.ts.map +1 -0
  67. package/dist/core/formatter-fs.js +79 -0
  68. package/dist/core/formatter-fs.js.map +1 -0
  69. package/dist/core/formatter.d.ts +10 -0
  70. package/dist/core/formatter.d.ts.map +1 -0
  71. package/dist/core/formatter.js +24 -0
  72. package/dist/core/formatter.js.map +1 -0
  73. package/dist/core/helpers/discriminator-utils.d.ts +14 -0
  74. package/dist/core/helpers/discriminator-utils.d.ts.map +1 -0
  75. package/dist/core/helpers/discriminator-utils.js +169 -0
  76. package/dist/core/helpers/discriminator-utils.js.map +1 -0
  77. package/dist/core/helpers/index.d.ts +6 -0
  78. package/dist/core/helpers/index.d.ts.map +1 -0
  79. package/dist/core/helpers/index.js +6 -0
  80. package/dist/core/helpers/index.js.map +1 -0
  81. package/dist/core/helpers/operation-utils.d.ts +15 -0
  82. package/dist/core/helpers/operation-utils.d.ts.map +1 -0
  83. package/dist/core/helpers/operation-utils.js +35 -0
  84. package/dist/core/helpers/operation-utils.js.map +1 -0
  85. package/dist/core/helpers/projected-names-utils.d.ts +20 -0
  86. package/dist/core/helpers/projected-names-utils.d.ts.map +1 -0
  87. package/dist/core/helpers/projected-names-utils.js +40 -0
  88. package/dist/core/helpers/projected-names-utils.js.map +1 -0
  89. package/dist/core/helpers/type-name-utils.d.ts +14 -0
  90. package/dist/core/helpers/type-name-utils.d.ts.map +1 -0
  91. package/dist/core/helpers/type-name-utils.js +122 -0
  92. package/dist/core/helpers/type-name-utils.js.map +1 -0
  93. package/dist/core/helpers/usage-resolver.d.ts +20 -0
  94. package/dist/core/helpers/usage-resolver.d.ts.map +1 -0
  95. package/dist/core/helpers/usage-resolver.js +108 -0
  96. package/dist/core/helpers/usage-resolver.js.map +1 -0
  97. package/dist/core/index.d.ts +26 -0
  98. package/dist/core/index.d.ts.map +1 -0
  99. package/dist/core/index.js +26 -0
  100. package/dist/core/index.js.map +1 -0
  101. package/dist/core/install.d.ts +2 -0
  102. package/dist/core/install.d.ts.map +1 -0
  103. package/dist/core/install.js +26 -0
  104. package/dist/core/install.js.map +1 -0
  105. package/dist/core/library.d.ts +34 -0
  106. package/dist/core/library.d.ts.map +1 -0
  107. package/dist/core/library.js +100 -0
  108. package/dist/core/library.js.map +1 -0
  109. package/dist/core/logger/console-sink.browser.d.ts +4 -0
  110. package/dist/core/logger/console-sink.browser.d.ts.map +1 -0
  111. package/dist/core/logger/console-sink.browser.js +14 -0
  112. package/dist/core/logger/console-sink.browser.js.map +1 -0
  113. package/dist/core/logger/console-sink.d.ts +9 -0
  114. package/dist/core/logger/console-sink.d.ts.map +1 -0
  115. package/dist/core/logger/console-sink.js +81 -0
  116. package/dist/core/logger/console-sink.js.map +1 -0
  117. package/dist/core/logger/index.d.ts +3 -0
  118. package/dist/core/logger/index.d.ts.map +1 -0
  119. package/dist/core/logger/index.js +3 -0
  120. package/dist/core/logger/index.js.map +1 -0
  121. package/dist/core/logger/logger.d.ts +7 -0
  122. package/dist/core/logger/logger.d.ts.map +1 -0
  123. package/dist/core/logger/logger.js +32 -0
  124. package/dist/core/logger/logger.js.map +1 -0
  125. package/dist/core/logger/tracer.d.ts +3 -0
  126. package/dist/core/logger/tracer.d.ts.map +1 -0
  127. package/dist/core/logger/tracer.js +91 -0
  128. package/dist/core/logger/tracer.js.map +1 -0
  129. package/dist/core/manifest.d.ts +21 -0
  130. package/dist/core/manifest.d.ts.map +1 -0
  131. package/dist/core/manifest.js +8 -0
  132. package/dist/core/manifest.js.map +1 -0
  133. package/dist/core/messages.d.ts +2253 -0
  134. package/dist/core/messages.d.ts.map +1 -0
  135. package/dist/core/messages.js +749 -0
  136. package/dist/core/messages.js.map +1 -0
  137. package/dist/core/module-resolver.d.ts +84 -0
  138. package/dist/core/module-resolver.d.ts.map +1 -0
  139. package/dist/core/module-resolver.js +170 -0
  140. package/dist/core/module-resolver.js.map +1 -0
  141. package/dist/core/node-host.browser.d.ts +2 -0
  142. package/dist/core/node-host.browser.d.ts.map +1 -0
  143. package/dist/core/node-host.browser.js +2 -0
  144. package/dist/core/node-host.browser.js.map +1 -0
  145. package/dist/core/node-host.d.ts +7 -0
  146. package/dist/core/node-host.d.ts.map +1 -0
  147. package/dist/core/node-host.js +43 -0
  148. package/dist/core/node-host.js.map +1 -0
  149. package/dist/core/nonascii.d.ts +2 -0
  150. package/dist/core/nonascii.d.ts.map +1 -0
  151. package/dist/core/nonascii.js +712 -0
  152. package/dist/core/nonascii.js.map +1 -0
  153. package/dist/core/options.d.ts +46 -0
  154. package/dist/core/options.d.ts.map +1 -0
  155. package/dist/core/options.js +2 -0
  156. package/dist/core/options.js.map +1 -0
  157. package/dist/core/parser.d.ts +17 -0
  158. package/dist/core/parser.d.ts.map +1 -0
  159. package/dist/core/parser.js +2561 -0
  160. package/dist/core/parser.js.map +1 -0
  161. package/dist/core/path-utils.d.ts +193 -0
  162. package/dist/core/path-utils.d.ts.map +1 -0
  163. package/dist/core/path-utils.js +427 -0
  164. package/dist/core/path-utils.js.map +1 -0
  165. package/dist/core/program.d.ts +104 -0
  166. package/dist/core/program.d.ts.map +1 -0
  167. package/dist/core/program.js +898 -0
  168. package/dist/core/program.js.map +1 -0
  169. package/dist/core/projection-members.d.ts +8 -0
  170. package/dist/core/projection-members.d.ts.map +1 -0
  171. package/dist/core/projection-members.js +387 -0
  172. package/dist/core/projection-members.js.map +1 -0
  173. package/dist/core/projector.d.ts +26 -0
  174. package/dist/core/projector.d.ts.map +1 -0
  175. package/dist/core/projector.js +523 -0
  176. package/dist/core/projector.js.map +1 -0
  177. package/dist/core/scanner.d.ts +125 -0
  178. package/dist/core/scanner.d.ts.map +1 -0
  179. package/dist/core/scanner.js +1012 -0
  180. package/dist/core/scanner.js.map +1 -0
  181. package/dist/core/schema-validator.d.ts +6 -0
  182. package/dist/core/schema-validator.d.ts.map +1 -0
  183. package/dist/core/schema-validator.js +38 -0
  184. package/dist/core/schema-validator.js.map +1 -0
  185. package/dist/core/semantic-walker.d.ts +53 -0
  186. package/dist/core/semantic-walker.d.ts.map +1 -0
  187. package/dist/core/semantic-walker.js +355 -0
  188. package/dist/core/semantic-walker.js.map +1 -0
  189. package/dist/core/type-utils.d.ts +49 -0
  190. package/dist/core/type-utils.d.ts.map +1 -0
  191. package/dist/core/type-utils.js +95 -0
  192. package/dist/core/type-utils.js.map +1 -0
  193. package/dist/core/types.d.ts +1345 -0
  194. package/dist/core/types.d.ts.map +1 -0
  195. package/dist/core/types.js +105 -0
  196. package/dist/core/types.js.map +1 -0
  197. package/dist/core/util.d.ts +150 -0
  198. package/dist/core/util.d.ts.map +1 -0
  199. package/dist/core/util.js +417 -0
  200. package/dist/core/util.js.map +1 -0
  201. package/dist/emitter-framework/asset-emitter.d.ts +5 -0
  202. package/dist/emitter-framework/asset-emitter.d.ts.map +1 -0
  203. package/dist/emitter-framework/asset-emitter.js +610 -0
  204. package/dist/emitter-framework/asset-emitter.js.map +1 -0
  205. package/dist/emitter-framework/builders/array-builder.d.ts +7 -0
  206. package/dist/emitter-framework/builders/array-builder.d.ts.map +1 -0
  207. package/dist/emitter-framework/builders/array-builder.js +45 -0
  208. package/dist/emitter-framework/builders/array-builder.js.map +1 -0
  209. package/dist/emitter-framework/builders/object-builder.d.ts +9 -0
  210. package/dist/emitter-framework/builders/object-builder.d.ts.map +1 -0
  211. package/dist/emitter-framework/builders/object-builder.js +30 -0
  212. package/dist/emitter-framework/builders/object-builder.js.map +1 -0
  213. package/dist/emitter-framework/builders/string-builder.d.ts +13 -0
  214. package/dist/emitter-framework/builders/string-builder.d.ts.map +1 -0
  215. package/dist/emitter-framework/builders/string-builder.js +98 -0
  216. package/dist/emitter-framework/builders/string-builder.js.map +1 -0
  217. package/dist/emitter-framework/custom-key-map.d.ts +29 -0
  218. package/dist/emitter-framework/custom-key-map.d.ts.map +1 -0
  219. package/dist/emitter-framework/custom-key-map.js +62 -0
  220. package/dist/emitter-framework/custom-key-map.js.map +1 -0
  221. package/dist/emitter-framework/index.d.ts +8 -0
  222. package/dist/emitter-framework/index.d.ts.map +1 -0
  223. package/dist/emitter-framework/index.js +8 -0
  224. package/dist/emitter-framework/index.js.map +1 -0
  225. package/dist/emitter-framework/placeholder.d.ts +12 -0
  226. package/dist/emitter-framework/placeholder.d.ts.map +1 -0
  227. package/dist/emitter-framework/placeholder.js +27 -0
  228. package/dist/emitter-framework/placeholder.js.map +1 -0
  229. package/dist/emitter-framework/type-emitter.d.ts +314 -0
  230. package/dist/emitter-framework/type-emitter.d.ts.map +1 -0
  231. package/dist/emitter-framework/type-emitter.js +612 -0
  232. package/dist/emitter-framework/type-emitter.js.map +1 -0
  233. package/dist/emitter-framework/types.d.ts +124 -0
  234. package/dist/emitter-framework/types.d.ts.map +1 -0
  235. package/dist/emitter-framework/types.js +39 -0
  236. package/dist/emitter-framework/types.js.map +1 -0
  237. package/dist/formatter/index.d.ts +11 -0
  238. package/dist/formatter/index.d.ts.map +1 -0
  239. package/dist/formatter/index.js +28 -0
  240. package/dist/formatter/index.js.map +1 -0
  241. package/dist/formatter/parser.d.ts +16 -0
  242. package/dist/formatter/parser.d.ts.map +1 -0
  243. package/dist/formatter/parser.js +23 -0
  244. package/dist/formatter/parser.js.map +1 -0
  245. package/dist/formatter/print/comment-handler.d.ts +7 -0
  246. package/dist/formatter/print/comment-handler.d.ts.map +1 -0
  247. package/dist/formatter/print/comment-handler.js +81 -0
  248. package/dist/formatter/print/comment-handler.js.map +1 -0
  249. package/dist/formatter/print/index.d.ts +3 -0
  250. package/dist/formatter/print/index.d.ts.map +1 -0
  251. package/dist/formatter/print/index.js +3 -0
  252. package/dist/formatter/print/index.js.map +1 -0
  253. package/dist/formatter/print/needs-parens.d.ts +10 -0
  254. package/dist/formatter/print/needs-parens.d.ts.map +1 -0
  255. package/dist/formatter/print/needs-parens.js +27 -0
  256. package/dist/formatter/print/needs-parens.js.map +1 -0
  257. package/dist/formatter/print/printer.d.ts +62 -0
  258. package/dist/formatter/print/printer.d.ts.map +1 -0
  259. package/dist/formatter/print/printer.js +1025 -0
  260. package/dist/formatter/print/printer.js.map +1 -0
  261. package/dist/formatter/print/types.d.ts +9 -0
  262. package/dist/formatter/print/types.d.ts.map +1 -0
  263. package/dist/formatter/print/types.js +2 -0
  264. package/dist/formatter/print/types.js.map +1 -0
  265. package/dist/init/index.d.ts +2 -0
  266. package/dist/init/index.d.ts.map +1 -0
  267. package/dist/init/index.js +2 -0
  268. package/dist/init/index.js.map +1 -0
  269. package/dist/init/init-template.d.ts +45 -0
  270. package/dist/init/init-template.d.ts.map +1 -0
  271. package/dist/init/init-template.js +45 -0
  272. package/dist/init/init-template.js.map +1 -0
  273. package/dist/init/init.d.ts +49 -0
  274. package/dist/init/init.d.ts.map +1 -0
  275. package/dist/init/init.js +224 -0
  276. package/dist/init/init.js.map +1 -0
  277. package/dist/lib/decorators.d.ts +222 -0
  278. package/dist/lib/decorators.d.ts.map +1 -0
  279. package/dist/lib/decorators.js +745 -0
  280. package/dist/lib/decorators.js.map +1 -0
  281. package/dist/lib/service.d.ts +38 -0
  282. package/dist/lib/service.d.ts.map +1 -0
  283. package/dist/lib/service.js +78 -0
  284. package/dist/lib/service.js.map +1 -0
  285. package/dist/manifest.js +4 -0
  286. package/dist/server/completion.d.ts +10 -0
  287. package/dist/server/completion.d.ts.map +1 -0
  288. package/dist/server/completion.js +207 -0
  289. package/dist/server/completion.js.map +1 -0
  290. package/dist/server/index.d.ts +3 -0
  291. package/dist/server/index.d.ts.map +1 -0
  292. package/dist/server/index.js +3 -0
  293. package/dist/server/index.js.map +1 -0
  294. package/dist/server/language-config.d.ts +195 -0
  295. package/dist/server/language-config.d.ts.map +1 -0
  296. package/dist/server/language-config.js +102 -0
  297. package/dist/server/language-config.js.map +1 -0
  298. package/dist/server/server.d.ts +2 -0
  299. package/dist/server/server.d.ts.map +1 -0
  300. package/dist/server/server.js +131 -0
  301. package/dist/server/server.js.map +1 -0
  302. package/dist/server/serverlib.d.ts +72 -0
  303. package/dist/server/serverlib.d.ts.map +1 -0
  304. package/dist/server/serverlib.js +1034 -0
  305. package/dist/server/serverlib.js.map +1 -0
  306. package/dist/server/symbol-structure.d.ts +4 -0
  307. package/dist/server/symbol-structure.d.ts.map +1 -0
  308. package/dist/server/symbol-structure.js +121 -0
  309. package/dist/server/symbol-structure.js.map +1 -0
  310. package/dist/server/tmlanguage.d.ts +3 -0
  311. package/dist/server/tmlanguage.d.ts.map +1 -0
  312. package/dist/server/tmlanguage.js +713 -0
  313. package/dist/server/tmlanguage.js.map +1 -0
  314. package/dist/server/type-details.d.ts +11 -0
  315. package/dist/server/type-details.d.ts.map +1 -0
  316. package/dist/server/type-details.js +72 -0
  317. package/dist/server/type-details.js.map +1 -0
  318. package/dist/server/type-signature.d.ts +2 -0
  319. package/dist/server/type-signature.d.ts.map +1 -0
  320. package/dist/server/type-signature.js +108 -0
  321. package/dist/server/type-signature.js.map +1 -0
  322. package/dist/testing/expect.d.ts +49 -0
  323. package/dist/testing/expect.d.ts.map +1 -0
  324. package/dist/testing/expect.js +83 -0
  325. package/dist/testing/expect.js.map +1 -0
  326. package/dist/testing/index.d.ts +6 -0
  327. package/dist/testing/index.d.ts.map +1 -0
  328. package/dist/testing/index.js +6 -0
  329. package/dist/testing/index.js.map +1 -0
  330. package/dist/testing/test-host.d.ts +14 -0
  331. package/dist/testing/test-host.d.ts.map +1 -0
  332. package/dist/testing/test-host.js +271 -0
  333. package/dist/testing/test-host.js.map +1 -0
  334. package/dist/testing/test-server-host.d.ts +39 -0
  335. package/dist/testing/test-server-host.d.ts.map +1 -0
  336. package/dist/testing/test-server-host.js +112 -0
  337. package/dist/testing/test-server-host.js.map +1 -0
  338. package/dist/testing/test-utils.d.ts +22 -0
  339. package/dist/testing/test-utils.d.ts.map +1 -0
  340. package/dist/testing/test-utils.js +60 -0
  341. package/dist/testing/test-utils.js.map +1 -0
  342. package/dist/testing/types.d.ts +69 -0
  343. package/dist/testing/types.d.ts.map +1 -0
  344. package/dist/testing/types.js +7 -0
  345. package/dist/testing/types.js.map +1 -0
  346. package/dist/typespec.tmLanguage +1760 -0
  347. package/lib/decorators.tsp +420 -0
  348. package/lib/lib.tsp +158 -0
  349. package/lib/main.tsp +4 -0
  350. package/lib/projected-names.tsp +94 -0
  351. package/lib/reflection.tsp +10 -0
  352. package/package.json +119 -0
@@ -0,0 +1,427 @@
1
+ // Forked from https://github.com/microsoft/TypeScript/blob/663b19fe4a7c4d4ddaa61aedadd28da06acd27b6/src/compiler/path.ts
2
+ /**
3
+ * Internally, we represent paths as strings with '/' as the directory separator.
4
+ * When we make system calls (eg: LanguageServiceHost.getDirectory()),
5
+ * we expect the host to correctly handle paths in our specified format.
6
+ */
7
+ export const directorySeparator = "/";
8
+ export const altDirectorySeparator = "\\";
9
+ const urlSchemeSeparator = "://";
10
+ const backslashRegExp = /\\/g;
11
+ const relativePathSegmentRegExp = /(?:\/\/)|(?:^|\/)\.\.?(?:$|\/)/;
12
+ //#region Path Tests
13
+ /**
14
+ * Determines whether a charCode corresponds to `/` or `\`.
15
+ */
16
+ export function isAnyDirectorySeparator(charCode) {
17
+ return charCode === 47 /* CharacterCodes.slash */ || charCode === 92 /* CharacterCodes.backslash */;
18
+ }
19
+ /**
20
+ * Determines whether a path starts with a URL scheme (e.g. starts with `http://`, `ftp://`, `file://`, etc.).
21
+ */
22
+ export function isUrl(path) {
23
+ return getEncodedRootLength(path) < 0;
24
+ }
25
+ /*
26
+ * Determines whether a path starts with an absolute path component (i.e. `/`, `c:/`, `file://`, etc.).
27
+ *
28
+ * ```ts
29
+ * // POSIX
30
+ * isPathAbsolute("/path/to/file.ext") === true
31
+ * // DOS
32
+ * isPathAbsolute("c:/path/to/file.ext") === true
33
+ * // URL
34
+ * isPathAbsolute("file:///path/to/file.ext") === true
35
+ * // Non-absolute
36
+ * isPathAbsolute("path/to/file.ext") === false
37
+ * isPathAbsolute("./path/to/file.ext") === false
38
+ * ```
39
+ */
40
+ export function isPathAbsolute(path) {
41
+ return getEncodedRootLength(path) !== 0;
42
+ }
43
+ //#endregion
44
+ //#region Path Parsing
45
+ function isVolumeCharacter(charCode) {
46
+ return ((charCode >= 97 /* CharacterCodes.a */ && charCode <= 122 /* CharacterCodes.z */) ||
47
+ (charCode >= 65 /* CharacterCodes.A */ && charCode <= 90 /* CharacterCodes.Z */));
48
+ }
49
+ function getFileUrlVolumeSeparatorEnd(url, start) {
50
+ const ch0 = url.charCodeAt(start);
51
+ if (ch0 === 58 /* CharacterCodes.colon */)
52
+ return start + 1;
53
+ if (ch0 === 37 /* CharacterCodes.percent */ && url.charCodeAt(start + 1) === 51 /* CharacterCodes._3 */) {
54
+ const ch2 = url.charCodeAt(start + 2);
55
+ if (ch2 === 97 /* CharacterCodes.a */ || ch2 === 65 /* CharacterCodes.A */)
56
+ return start + 3;
57
+ }
58
+ return -1;
59
+ }
60
+ /**
61
+ * Returns length of the root part of a path or URL (i.e. length of "/", "x:/", "//server/share/, file:///user/files").
62
+ *
63
+ * For example:
64
+ * ```ts
65
+ * getRootLength("a") === 0 // ""
66
+ * getRootLength("/") === 1 // "/"
67
+ * getRootLength("c:") === 2 // "c:"
68
+ * getRootLength("c:d") === 0 // ""
69
+ * getRootLength("c:/") === 3 // "c:/"
70
+ * getRootLength("c:\\") === 3 // "c:\\"
71
+ * getRootLength("//server") === 7 // "//server"
72
+ * getRootLength("//server/share") === 8 // "//server/"
73
+ * getRootLength("\\\\server") === 7 // "\\\\server"
74
+ * getRootLength("\\\\server\\share") === 8 // "\\\\server\\"
75
+ * getRootLength("file:///path") === 8 // "file:///"
76
+ * getRootLength("file:///c:") === 10 // "file:///c:"
77
+ * getRootLength("file:///c:d") === 8 // "file:///"
78
+ * getRootLength("file:///c:/path") === 11 // "file:///c:/"
79
+ * getRootLength("file://server") === 13 // "file://server"
80
+ * getRootLength("file://server/path") === 14 // "file://server/"
81
+ * getRootLength("http://server") === 13 // "http://server"
82
+ * getRootLength("http://server/path") === 14 // "http://server/"
83
+ * ```
84
+ */
85
+ export function getRootLength(path) {
86
+ const rootLength = getEncodedRootLength(path);
87
+ return rootLength < 0 ? ~rootLength : rootLength;
88
+ }
89
+ /**
90
+ * Returns length of the root part of a path or URL (i.e. length of "/", "x:/", "//server/share/, file:///user/files").
91
+ * If the root is part of a URL, the twos-complement of the root length is returned.
92
+ */
93
+ function getEncodedRootLength(path) {
94
+ if (!path)
95
+ return 0;
96
+ const ch0 = path.charCodeAt(0);
97
+ // POSIX or UNC
98
+ if (ch0 === 47 /* CharacterCodes.slash */ || ch0 === 92 /* CharacterCodes.backslash */) {
99
+ if (path.charCodeAt(1) !== ch0)
100
+ return 1; // POSIX: "/" (or non-normalized "\")
101
+ const p1 = path.indexOf(ch0 === 47 /* CharacterCodes.slash */ ? directorySeparator : altDirectorySeparator, 2);
102
+ if (p1 < 0)
103
+ return path.length; // UNC: "//server" or "\\server"
104
+ return p1 + 1; // UNC: "//server/" or "\\server\"
105
+ }
106
+ // DOS
107
+ if (isVolumeCharacter(ch0) && path.charCodeAt(1) === 58 /* CharacterCodes.colon */) {
108
+ const ch2 = path.charCodeAt(2);
109
+ if (ch2 === 47 /* CharacterCodes.slash */ || ch2 === 92 /* CharacterCodes.backslash */)
110
+ return 3; // DOS: "c:/" or "c:\"
111
+ if (path.length === 2)
112
+ return 2; // DOS: "c:" (but not "c:d")
113
+ }
114
+ // URL
115
+ const schemeEnd = path.indexOf(urlSchemeSeparator);
116
+ if (schemeEnd !== -1) {
117
+ const authorityStart = schemeEnd + urlSchemeSeparator.length;
118
+ const authorityEnd = path.indexOf(directorySeparator, authorityStart);
119
+ if (authorityEnd !== -1) {
120
+ // URL: "file:///", "file://server/", "file://server/path"
121
+ // For local "file" URLs, include the leading DOS volume (if present).
122
+ // Per https://www.ietf.org/rfc/rfc1738.txt, a host of "" or "localhost" is a
123
+ // special case interpreted as "the machine from which the URL is being interpreted".
124
+ const scheme = path.slice(0, schemeEnd);
125
+ const authority = path.slice(authorityStart, authorityEnd);
126
+ if (scheme === "file" &&
127
+ (authority === "" || authority === "localhost") &&
128
+ isVolumeCharacter(path.charCodeAt(authorityEnd + 1))) {
129
+ const volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(path, authorityEnd + 2);
130
+ if (volumeSeparatorEnd !== -1) {
131
+ if (path.charCodeAt(volumeSeparatorEnd) === 47 /* CharacterCodes.slash */) {
132
+ // URL: "file:///c:/", "file://localhost/c:/", "file:///c%3a/", "file://localhost/c%3a/"
133
+ return ~(volumeSeparatorEnd + 1);
134
+ }
135
+ if (volumeSeparatorEnd === path.length) {
136
+ // URL: "file:///c:", "file://localhost/c:", "file:///c$3a", "file://localhost/c%3a"
137
+ // but not "file:///c:d" or "file:///c%3ad"
138
+ return ~volumeSeparatorEnd;
139
+ }
140
+ }
141
+ }
142
+ return ~(authorityEnd + 1); // URL: "file://server/", "http://server/"
143
+ }
144
+ return ~path.length; // URL: "file://server", "http://server"
145
+ }
146
+ // relative
147
+ return 0;
148
+ }
149
+ export function getDirectoryPath(path) {
150
+ path = normalizeSlashes(path);
151
+ // If the path provided is itself the root, then return it.
152
+ const rootLength = getRootLength(path);
153
+ if (rootLength === path.length)
154
+ return path;
155
+ // return the leading portion of the path up to the last (non-terminal) directory separator
156
+ // but not including any trailing directory separator.
157
+ path = removeTrailingDirectorySeparator(path);
158
+ return path.slice(0, Math.max(rootLength, path.lastIndexOf(directorySeparator)));
159
+ }
160
+ /**
161
+ * Returns the path except for its containing directory name.
162
+ * Semantics align with NodeJS's `path.basename` except that we support URL's as well.
163
+ *
164
+ * ```ts
165
+ * // POSIX
166
+ * getBaseFileName("/path/to/file.ext") === "file.ext"
167
+ * getBaseFileName("/path/to/") === "to"
168
+ * getBaseFileName("/") === ""
169
+ * // DOS
170
+ * getBaseFileName("c:/path/to/file.ext") === "file.ext"
171
+ * getBaseFileName("c:/path/to/") === "to"
172
+ * getBaseFileName("c:/") === ""
173
+ * getBaseFileName("c:") === ""
174
+ * // URL
175
+ * getBaseFileName("http://typescriptlang.org/path/to/file.ext") === "file.ext"
176
+ * getBaseFileName("http://typescriptlang.org/path/to/") === "to"
177
+ * getBaseFileName("http://typescriptlang.org/") === ""
178
+ * getBaseFileName("http://typescriptlang.org") === ""
179
+ * getBaseFileName("file://server/path/to/file.ext") === "file.ext"
180
+ * getBaseFileName("file://server/path/to/") === "to"
181
+ * getBaseFileName("file://server/") === ""
182
+ * getBaseFileName("file://server") === ""
183
+ * getBaseFileName("file:///path/to/file.ext") === "file.ext"
184
+ * getBaseFileName("file:///path/to/") === "to"
185
+ * getBaseFileName("file:///") === ""
186
+ * getBaseFileName("file://") === ""
187
+ * ```
188
+ */
189
+ export function getBaseFileName(path) {
190
+ path = normalizeSlashes(path);
191
+ // if the path provided is itself the root, then it has not file name.
192
+ const rootLength = getRootLength(path);
193
+ if (rootLength === path.length)
194
+ return "";
195
+ // return the trailing portion of the path starting after the last (non-terminal) directory
196
+ // separator but not including any trailing directory separator.
197
+ path = removeTrailingDirectorySeparator(path);
198
+ return path.slice(Math.max(getRootLength(path), path.lastIndexOf(directorySeparator) + 1));
199
+ }
200
+ /**
201
+ * Gets the file extension for a path.
202
+ * Normalizes it to lower case.
203
+ *
204
+ * ```ts
205
+ * getAnyExtensionFromPath("/path/to/file.ext") === ".ext"
206
+ * getAnyExtensionFromPath("/path/to/file.ext/") === ".ext"
207
+ * getAnyExtensionFromPath("/path/to/file") === ""
208
+ * getAnyExtensionFromPath("/path/to.ext/file") === ""
209
+ * ```
210
+ */
211
+ export function getAnyExtensionFromPath(path) {
212
+ // Retrieves any string from the final "." onwards from a base file name.
213
+ // Unlike extensionFromPath, which throws an exception on unrecognized extensions.
214
+ const baseFileName = getBaseFileName(path);
215
+ const extensionIndex = baseFileName.lastIndexOf(".");
216
+ if (extensionIndex >= 0) {
217
+ return baseFileName.substring(extensionIndex).toLowerCase();
218
+ }
219
+ return "";
220
+ }
221
+ function pathComponents(path, rootLength) {
222
+ const root = path.substring(0, rootLength);
223
+ const rest = path.substring(rootLength).split(directorySeparator);
224
+ if (rest.length && !rest[rest.length - 1])
225
+ rest.pop();
226
+ return [root, ...rest];
227
+ }
228
+ /**
229
+ * Parse a path into an array containing a root component (at index 0) and zero or more path
230
+ * components (at indices > 0). The result is not normalized.
231
+ * If the path is relative, the root component is `""`.
232
+ * If the path is absolute, the root component includes the first path separator (`/`).
233
+ *
234
+ * ```ts
235
+ * // POSIX
236
+ * getPathComponents("/path/to/file.ext") === ["/", "path", "to", "file.ext"]
237
+ * getPathComponents("/path/to/") === ["/", "path", "to"]
238
+ * getPathComponents("/") === ["/"]
239
+ * // DOS
240
+ * getPathComponents("c:/path/to/file.ext") === ["c:/", "path", "to", "file.ext"]
241
+ * getPathComponents("c:/path/to/") === ["c:/", "path", "to"]
242
+ * getPathComponents("c:/") === ["c:/"]
243
+ * getPathComponents("c:") === ["c:"]
244
+ * // URL
245
+ * getPathComponents("http://typescriptlang.org/path/to/file.ext") === ["http://typescriptlang.org/", "path", "to", "file.ext"]
246
+ * getPathComponents("http://typescriptlang.org/path/to/") === ["http://typescriptlang.org/", "path", "to"]
247
+ * getPathComponents("http://typescriptlang.org/") === ["http://typescriptlang.org/"]
248
+ * getPathComponents("http://typescriptlang.org") === ["http://typescriptlang.org"]
249
+ * getPathComponents("file://server/path/to/file.ext") === ["file://server/", "path", "to", "file.ext"]
250
+ * getPathComponents("file://server/path/to/") === ["file://server/", "path", "to"]
251
+ * getPathComponents("file://server/") === ["file://server/"]
252
+ * getPathComponents("file://server") === ["file://server"]
253
+ * getPathComponents("file:///path/to/file.ext") === ["file:///", "path", "to", "file.ext"]
254
+ * getPathComponents("file:///path/to/") === ["file:///", "path", "to"]
255
+ * getPathComponents("file:///") === ["file:///"]
256
+ * getPathComponents("file://") === ["file://"]
257
+ */
258
+ export function getPathComponents(path, currentDirectory = "") {
259
+ path = joinPaths(currentDirectory, path);
260
+ return pathComponents(path, getRootLength(path));
261
+ }
262
+ //#endregion
263
+ //#region Path Formatting
264
+ /**
265
+ * Reduce an array of path components to a more simplified path by navigating any
266
+ * `"."` or `".."` entries in the path.
267
+ */
268
+ export function reducePathComponents(components) {
269
+ if (!components.some((x) => x !== undefined))
270
+ return [];
271
+ const reduced = [components[0]];
272
+ for (let i = 1; i < components.length; i++) {
273
+ const component = components[i];
274
+ if (!component)
275
+ continue;
276
+ if (component === ".")
277
+ continue;
278
+ if (component === "..") {
279
+ if (reduced.length > 1) {
280
+ if (reduced[reduced.length - 1] !== "..") {
281
+ reduced.pop();
282
+ continue;
283
+ }
284
+ }
285
+ else if (reduced[0])
286
+ continue;
287
+ }
288
+ reduced.push(component);
289
+ }
290
+ return reduced;
291
+ }
292
+ /**
293
+ * Combines paths. If a path is absolute, it replaces any previous path. Relative paths are not simplified.
294
+ *
295
+ * ```ts
296
+ * // Non-rooted
297
+ * joinPaths("path", "to", "file.ext") === "path/to/file.ext"
298
+ * joinPaths("path", "dir", "..", "to", "file.ext") === "path/dir/../to/file.ext"
299
+ * // POSIX
300
+ * joinPaths("/path", "to", "file.ext") === "/path/to/file.ext"
301
+ * joinPaths("/path", "/to", "file.ext") === "/to/file.ext"
302
+ * // DOS
303
+ * joinPaths("c:/path", "to", "file.ext") === "c:/path/to/file.ext"
304
+ * joinPaths("c:/path", "c:/to", "file.ext") === "c:/to/file.ext"
305
+ * // URL
306
+ * joinPaths("file:///path", "to", "file.ext") === "file:///path/to/file.ext"
307
+ * joinPaths("file:///path", "file:///to", "file.ext") === "file:///to/file.ext"
308
+ * ```
309
+ */
310
+ export function joinPaths(path, ...paths) {
311
+ if (path)
312
+ path = normalizeSlashes(path);
313
+ for (let relativePath of paths) {
314
+ if (!relativePath)
315
+ continue;
316
+ relativePath = normalizeSlashes(relativePath);
317
+ if (!path || getRootLength(relativePath) !== 0) {
318
+ path = relativePath;
319
+ }
320
+ else {
321
+ path = ensureTrailingDirectorySeparator(path) + relativePath;
322
+ }
323
+ }
324
+ return path;
325
+ }
326
+ /**
327
+ * Combines and resolves paths. If a path is absolute, it replaces any previous path. Any
328
+ * `.` and `..` path components are resolved. Trailing directory separators are preserved.
329
+ *
330
+ * ```ts
331
+ * resolvePath("/path", "to", "file.ext") === "path/to/file.ext"
332
+ * resolvePath("/path", "to", "file.ext/") === "path/to/file.ext/"
333
+ * resolvePath("/path", "dir", "..", "to", "file.ext") === "path/to/file.ext"
334
+ * ```
335
+ */
336
+ export function resolvePath(path, ...paths) {
337
+ return normalizePath(paths.some((x) => x !== undefined) ? joinPaths(path, ...paths) : normalizeSlashes(path));
338
+ }
339
+ /**
340
+ * Parse a path into an array containing a root component (at index 0) and zero or more path
341
+ * components (at indices > 0). The result is normalized.
342
+ * If the path is relative, the root component is `""`.
343
+ * If the path is absolute, the root component includes the first path separator (`/`).
344
+ *
345
+ * ```ts
346
+ * getNormalizedPathComponents("to/dir/../file.ext", "/path/") === ["/", "path", "to", "file.ext"]
347
+ * ```
348
+ */
349
+ export function getNormalizedPathComponents(path, currentDirectory) {
350
+ return reducePathComponents(getPathComponents(path, currentDirectory));
351
+ }
352
+ export function getNormalizedAbsolutePath(fileName, currentDirectory) {
353
+ return getPathFromPathComponents(getNormalizedPathComponents(fileName, currentDirectory));
354
+ }
355
+ export function normalizePath(path) {
356
+ path = normalizeSlashes(path);
357
+ // Most paths don't require normalization
358
+ if (!relativePathSegmentRegExp.test(path)) {
359
+ return path;
360
+ }
361
+ // Some paths only require cleanup of `/./` or leading `./`
362
+ const simplified = path.replace(/\/\.\//g, "/").replace(/^\.\//, "");
363
+ if (simplified !== path) {
364
+ path = simplified;
365
+ if (!relativePathSegmentRegExp.test(path)) {
366
+ return path;
367
+ }
368
+ }
369
+ // Other paths require full normalization
370
+ const normalized = getPathFromPathComponents(reducePathComponents(getPathComponents(path)));
371
+ return normalized && hasTrailingDirectorySeparator(path)
372
+ ? ensureTrailingDirectorySeparator(normalized)
373
+ : normalized;
374
+ }
375
+ //#endregion
376
+ function getPathWithoutRoot(pathComponents) {
377
+ if (pathComponents.length === 0)
378
+ return "";
379
+ return pathComponents.slice(1).join(directorySeparator);
380
+ }
381
+ export function getNormalizedAbsolutePathWithoutRoot(fileName, currentDirectory) {
382
+ return getPathWithoutRoot(getNormalizedPathComponents(fileName, currentDirectory));
383
+ }
384
+ /**
385
+ * Formats a parsed path consisting of a root component (at index 0) and zero or more path
386
+ * segments (at indices > 0).
387
+ *
388
+ * ```ts
389
+ * getPathFromPathComponents(["/", "path", "to", "file.ext"]) === "/path/to/file.ext"
390
+ * ```
391
+ */
392
+ export function getPathFromPathComponents(pathComponents) {
393
+ if (pathComponents.length === 0)
394
+ return "";
395
+ const root = pathComponents[0] && ensureTrailingDirectorySeparator(pathComponents[0]);
396
+ return root + pathComponents.slice(1).join(directorySeparator);
397
+ }
398
+ export function removeTrailingDirectorySeparator(path) {
399
+ if (hasTrailingDirectorySeparator(path)) {
400
+ return path.substr(0, path.length - 1);
401
+ }
402
+ return path;
403
+ }
404
+ export function ensureTrailingDirectorySeparator(path) {
405
+ if (!hasTrailingDirectorySeparator(path)) {
406
+ return path + directorySeparator;
407
+ }
408
+ return path;
409
+ }
410
+ /**
411
+ * Determines whether a path has a trailing separator (`/` or `\\`).
412
+ */
413
+ export function hasTrailingDirectorySeparator(path) {
414
+ return path.length > 0 && isAnyDirectorySeparator(path.charCodeAt(path.length - 1));
415
+ }
416
+ /**
417
+ * Normalize path separators, converting `\` into `/`.
418
+ */
419
+ export function normalizeSlashes(path) {
420
+ const index = path.indexOf("\\");
421
+ if (index === -1) {
422
+ return path;
423
+ }
424
+ backslashRegExp.lastIndex = index; // prime regex with known position
425
+ return path.replace(backslashRegExp, directorySeparator);
426
+ }
427
+ //# sourceMappingURL=path-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-utils.js","sourceRoot":"","sources":["../../core/path-utils.ts"],"names":[],"mappings":"AAAA,yHAAyH;AAEzH;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AACtC,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAC1C,MAAM,kBAAkB,GAAG,KAAK,CAAC;AACjC,MAAM,eAAe,GAAG,KAAK,CAAC;AAC9B,MAAM,yBAAyB,GAAG,gCAAgC,CAAC;AAEnE,oBAAoB;AACpB;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,QAAgB;IACtD,OAAO,QAAQ,kCAAyB,IAAI,QAAQ,sCAA6B,CAAC;AACpF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,KAAK,CAAC,IAAY;IAChC,OAAO,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,OAAO,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC1C,CAAC;AACD,YAAY;AAEZ,sBAAsB;AAEtB,SAAS,iBAAiB,CAAC,QAAgB;IACzC,OAAO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AAI,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;KACxC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,gCAAgC,CAAC,IAAY;IAC3D,IAAI,CAAC,6BAA6B,CAAC,IAAI,CAAC,EAAE;QACxC,OAAO,IAAI,GAAG,kBAAkB,CAAC;KAClC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAAC,IAAY;IACxD,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,uBAAuB,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;AACtF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;QAChB,OAAO,IAAI,CAAC;KACb;IACD,eAAe,CAAC,SAAS,GAAG,KAAK,CAAC,CAAC,kCAAkC;IACrE,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,104 @@
1
+ import { Checker } from "./checker.js";
2
+ import { CompilerOptions } from "./options.js";
3
+ import { CompilerHost, Diagnostic, EmitterFunc, JsSourceFileNode, LiteralType, Namespace, ProjectionApplication, Projector, SourceFile, SymbolTable, Tracer, Type, TypeSpecScriptNode } from "./types.js";
4
+ export interface ProjectedProgram extends Program {
5
+ projector: Projector;
6
+ }
7
+ export declare function isProjectedProgram(program: Program | ProjectedProgram): program is ProjectedProgram;
8
+ export interface Program {
9
+ compilerOptions: CompilerOptions;
10
+ mainFile?: TypeSpecScriptNode;
11
+ /** All source files in the program, keyed by their file path. */
12
+ sourceFiles: Map<string, TypeSpecScriptNode>;
13
+ jsSourceFiles: Map<string, JsSourceFileNode>;
14
+ literalTypes: Map<string | number | boolean, LiteralType>;
15
+ host: CompilerHost;
16
+ tracer: Tracer;
17
+ trace(area: string, message: string): void;
18
+ checker: Checker;
19
+ emitters: EmitterRef[];
20
+ readonly diagnostics: readonly Diagnostic[];
21
+ loadTypeSpecScript(typespecScript: SourceFile): Promise<TypeSpecScriptNode>;
22
+ onValidate(cb: (program: Program) => void | Promise<void>): void;
23
+ getOption(key: string): string | undefined;
24
+ stateSet(key: symbol): Set<Type>;
25
+ stateSets: Map<symbol, StateSet>;
26
+ stateMap(key: symbol): Map<Type, any>;
27
+ stateMaps: Map<symbol, StateMap>;
28
+ hasError(): boolean;
29
+ reportDiagnostic(diagnostic: Diagnostic): void;
30
+ reportDiagnostics(diagnostics: readonly Diagnostic[]): void;
31
+ reportDuplicateSymbols(symbols: SymbolTable | undefined): void;
32
+ getGlobalNamespaceType(): Namespace;
33
+ resolveTypeReference(reference: string): [Type | undefined, readonly Diagnostic[]];
34
+ }
35
+ interface LibraryMetadata {
36
+ /**
37
+ * Library name as specified in the package.json or in exported $lib.
38
+ */
39
+ name?: string;
40
+ /**
41
+ * Library homepage.
42
+ */
43
+ homepage?: string;
44
+ bugs?: {
45
+ /**
46
+ * Url where to file bugs for this library.
47
+ */
48
+ url?: string;
49
+ };
50
+ }
51
+ interface EmitterRef {
52
+ emitFunction: EmitterFunc;
53
+ main: string;
54
+ metadata: LibraryMetadata;
55
+ emitterOutputDir: string;
56
+ options: Record<string, unknown>;
57
+ }
58
+ declare class StateMap extends Map<undefined | Projector, Map<Type, unknown>> {
59
+ }
60
+ declare class StateSet extends Map<undefined | Projector, Set<Type>> {
61
+ }
62
+ declare class StateMapView<V> implements Map<Type, V> {
63
+ private state;
64
+ private projector?;
65
+ constructor(state: StateMap, projector?: Projector | undefined);
66
+ has(t: Type): boolean;
67
+ set(t: Type, v: any): this;
68
+ get(t: Type): V | undefined;
69
+ delete(t: Type): boolean;
70
+ forEach(cb: (value: V, key: Type, map: Map<Type, V>) => void, thisArg?: any): this;
71
+ get size(): number;
72
+ clear(): void;
73
+ entries(): IterableIterator<[Type, V]>;
74
+ values(): IterableIterator<V>;
75
+ keys(): IterableIterator<Type>;
76
+ [Symbol.iterator](): IterableIterator<[Type, V]>;
77
+ [Symbol.toStringTag]: string;
78
+ dispatch(keyType?: Type): Map<Type, V>;
79
+ }
80
+ declare class StateSetView implements Set<Type> {
81
+ private state;
82
+ private projector?;
83
+ constructor(state: StateSet, projector?: Projector | undefined);
84
+ has(t: Type): boolean;
85
+ add(t: Type): this;
86
+ delete(t: Type): boolean;
87
+ forEach(cb: (value: Type, value2: Type, set: Set<Type>) => void, thisArg?: any): this;
88
+ get size(): number;
89
+ clear(): void;
90
+ values(): IterableIterator<Type>;
91
+ keys(): IterableIterator<Type>;
92
+ entries(): IterableIterator<[Type, Type]>;
93
+ [Symbol.iterator](): IterableIterator<Type>;
94
+ [Symbol.toStringTag]: string;
95
+ dispatch(keyType?: Type): Set<Type>;
96
+ }
97
+ export declare function projectProgram(program: Program, projections: ProjectionApplication[], startNode?: Type): ProjectedProgram;
98
+ export declare function compile(host: CompilerHost, mainFile: string, options?: CompilerOptions, oldProgram?: Program): Promise<Program>;
99
+ export declare function createStateAccessors(stateMaps: Map<symbol, StateMap>, stateSets: Map<symbol, StateSet>, projector?: Projector): {
100
+ stateMap: <T>(key: symbol) => StateMapView<T>;
101
+ stateSet: (key: symbol) => StateSetView;
102
+ };
103
+ export {};
104
+ //# sourceMappingURL=program.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../../core/program.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAiB,MAAM,cAAc,CAAC;AActD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAI/C,OAAO,EACL,YAAY,EACZ,UAAU,EAKV,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,SAAS,EAIT,qBAAqB,EACrB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