@justscale/typescript 0.1.1

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 (245) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +128 -0
  3. package/dist/api.d.ts +144 -0
  4. package/dist/api.d.ts.map +1 -0
  5. package/dist/api.js +380 -0
  6. package/dist/api.js.map +1 -0
  7. package/dist/compiler/analyzer.d.ts +247 -0
  8. package/dist/compiler/analyzer.d.ts.map +1 -0
  9. package/dist/compiler/analyzer.js +3201 -0
  10. package/dist/compiler/analyzer.js.map +1 -0
  11. package/dist/compiler/cli.d.ts +12 -0
  12. package/dist/compiler/cli.d.ts.map +1 -0
  13. package/dist/compiler/cli.js +209 -0
  14. package/dist/compiler/cli.js.map +1 -0
  15. package/dist/compiler/compile.d.ts +26 -0
  16. package/dist/compiler/compile.d.ts.map +1 -0
  17. package/dist/compiler/compile.js +121 -0
  18. package/dist/compiler/compile.js.map +1 -0
  19. package/dist/compiler/errors.d.ts +336 -0
  20. package/dist/compiler/errors.d.ts.map +1 -0
  21. package/dist/compiler/errors.js +466 -0
  22. package/dist/compiler/errors.js.map +1 -0
  23. package/dist/compiler/exports-prepass.d.ts +31 -0
  24. package/dist/compiler/exports-prepass.d.ts.map +1 -0
  25. package/dist/compiler/exports-prepass.js +249 -0
  26. package/dist/compiler/exports-prepass.js.map +1 -0
  27. package/dist/compiler/hmr-change-detector.d.ts +47 -0
  28. package/dist/compiler/hmr-change-detector.d.ts.map +1 -0
  29. package/dist/compiler/hmr-change-detector.js +395 -0
  30. package/dist/compiler/hmr-change-detector.js.map +1 -0
  31. package/dist/compiler/hmr-transformer.d.ts +54 -0
  32. package/dist/compiler/hmr-transformer.d.ts.map +1 -0
  33. package/dist/compiler/hmr-transformer.js +535 -0
  34. package/dist/compiler/hmr-transformer.js.map +1 -0
  35. package/dist/compiler/index.d.ts +19 -0
  36. package/dist/compiler/index.d.ts.map +1 -0
  37. package/dist/compiler/index.js +16 -0
  38. package/dist/compiler/index.js.map +1 -0
  39. package/dist/compiler/primitive-detector.d.ts +70 -0
  40. package/dist/compiler/primitive-detector.d.ts.map +1 -0
  41. package/dist/compiler/primitive-detector.js +338 -0
  42. package/dist/compiler/primitive-detector.js.map +1 -0
  43. package/dist/compiler/ptsc.d.ts +40 -0
  44. package/dist/compiler/ptsc.d.ts.map +1 -0
  45. package/dist/compiler/ptsc.js +462 -0
  46. package/dist/compiler/ptsc.js.map +1 -0
  47. package/dist/compiler/rewriter.d.ts +96 -0
  48. package/dist/compiler/rewriter.d.ts.map +1 -0
  49. package/dist/compiler/rewriter.js +418 -0
  50. package/dist/compiler/rewriter.js.map +1 -0
  51. package/dist/compiler/step-hash.d.ts +43 -0
  52. package/dist/compiler/step-hash.d.ts.map +1 -0
  53. package/dist/compiler/step-hash.js +83 -0
  54. package/dist/compiler/step-hash.js.map +1 -0
  55. package/dist/compiler/switch-codegen.d.ts +84 -0
  56. package/dist/compiler/switch-codegen.d.ts.map +1 -0
  57. package/dist/compiler/switch-codegen.js +1540 -0
  58. package/dist/compiler/switch-codegen.js.map +1 -0
  59. package/dist/compiler/transformer.d.ts +29 -0
  60. package/dist/compiler/transformer.d.ts.map +1 -0
  61. package/dist/compiler/transformer.js +216 -0
  62. package/dist/compiler/transformer.js.map +1 -0
  63. package/dist/config/index.d.ts +122 -0
  64. package/dist/config/index.d.ts.map +1 -0
  65. package/dist/config/index.js +215 -0
  66. package/dist/config/index.js.map +1 -0
  67. package/dist/di-errors/formatter.d.ts +126 -0
  68. package/dist/di-errors/formatter.d.ts.map +1 -0
  69. package/dist/di-errors/formatter.js +384 -0
  70. package/dist/di-errors/formatter.js.map +1 -0
  71. package/dist/di-errors/index.d.ts +5 -0
  72. package/dist/di-errors/index.d.ts.map +1 -0
  73. package/dist/di-errors/index.js +13 -0
  74. package/dist/di-errors/index.js.map +1 -0
  75. package/dist/editor.d.ts +11 -0
  76. package/dist/editor.d.ts.map +1 -0
  77. package/dist/editor.js +2 -0
  78. package/dist/editor.js.map +1 -0
  79. package/dist/index.d.ts +35 -0
  80. package/dist/index.d.ts.map +1 -0
  81. package/dist/index.js +40 -0
  82. package/dist/index.js.map +1 -0
  83. package/dist/language-service/index.d.ts +52 -0
  84. package/dist/language-service/index.d.ts.map +1 -0
  85. package/dist/language-service/index.js +366 -0
  86. package/dist/language-service/index.js.map +1 -0
  87. package/dist/language-service/process-quick-fixes.d.ts +20 -0
  88. package/dist/language-service/process-quick-fixes.d.ts.map +1 -0
  89. package/dist/language-service/process-quick-fixes.js +114 -0
  90. package/dist/language-service/process-quick-fixes.js.map +1 -0
  91. package/dist/language-service/quick-fix-discovery.d.ts +39 -0
  92. package/dist/language-service/quick-fix-discovery.d.ts.map +1 -0
  93. package/dist/language-service/quick-fix-discovery.js +124 -0
  94. package/dist/language-service/quick-fix-discovery.js.map +1 -0
  95. package/dist/loader/incremental.d.ts +50 -0
  96. package/dist/loader/incremental.d.ts.map +1 -0
  97. package/dist/loader/incremental.js +151 -0
  98. package/dist/loader/incremental.js.map +1 -0
  99. package/dist/loader/index.d.ts +25 -0
  100. package/dist/loader/index.d.ts.map +1 -0
  101. package/dist/loader/index.js +24 -0
  102. package/dist/loader/index.js.map +1 -0
  103. package/dist/loader/loader.d.ts +52 -0
  104. package/dist/loader/loader.d.ts.map +1 -0
  105. package/dist/loader/loader.js +248 -0
  106. package/dist/loader/loader.js.map +1 -0
  107. package/dist/loader/register.d.ts +14 -0
  108. package/dist/loader/register.d.ts.map +1 -0
  109. package/dist/loader/register.js +20 -0
  110. package/dist/loader/register.js.map +1 -0
  111. package/dist/plugins/index.d.ts +13 -0
  112. package/dist/plugins/index.d.ts.map +1 -0
  113. package/dist/plugins/index.js +13 -0
  114. package/dist/plugins/index.js.map +1 -0
  115. package/dist/plugins/index.public.d.ts +13 -0
  116. package/dist/plugins/index.public.d.ts.map +1 -0
  117. package/dist/plugins/index.public.js +13 -0
  118. package/dist/plugins/index.public.js.map +1 -0
  119. package/dist/plugins/types.d.ts +83 -0
  120. package/dist/plugins/types.d.ts.map +1 -0
  121. package/dist/plugins/types.js +24 -0
  122. package/dist/plugins/types.js.map +1 -0
  123. package/dist/server/index.d.ts +33 -0
  124. package/dist/server/index.d.ts.map +1 -0
  125. package/dist/server/index.js +42 -0
  126. package/dist/server/index.js.map +1 -0
  127. package/dist/server/tsserver.d.ts +28 -0
  128. package/dist/server/tsserver.d.ts.map +1 -0
  129. package/dist/server/tsserver.js +126 -0
  130. package/dist/server/tsserver.js.map +1 -0
  131. package/lib/lib.d.ts +20 -0
  132. package/lib/lib.decorators.d.ts +382 -0
  133. package/lib/lib.decorators.legacy.d.ts +20 -0
  134. package/lib/lib.dom.asynciterable.d.ts +18 -0
  135. package/lib/lib.dom.d.ts +45125 -0
  136. package/lib/lib.dom.iterable.d.ts +18 -0
  137. package/lib/lib.es2015.collection.d.ts +150 -0
  138. package/lib/lib.es2015.core.d.ts +595 -0
  139. package/lib/lib.es2015.d.ts +26 -0
  140. package/lib/lib.es2015.generator.d.ts +75 -0
  141. package/lib/lib.es2015.iterable.d.ts +603 -0
  142. package/lib/lib.es2015.promise.d.ts +79 -0
  143. package/lib/lib.es2015.proxy.d.ts +126 -0
  144. package/lib/lib.es2015.reflect.d.ts +142 -0
  145. package/lib/lib.es2015.symbol.d.ts +44 -0
  146. package/lib/lib.es2015.symbol.wellknown.d.ts +324 -0
  147. package/lib/lib.es2016.array.include.d.ts +114 -0
  148. package/lib/lib.es2016.d.ts +19 -0
  149. package/lib/lib.es2016.full.d.ts +21 -0
  150. package/lib/lib.es2016.intl.d.ts +29 -0
  151. package/lib/lib.es2017.arraybuffer.d.ts +19 -0
  152. package/lib/lib.es2017.d.ts +24 -0
  153. package/lib/lib.es2017.date.d.ts +29 -0
  154. package/lib/lib.es2017.full.d.ts +21 -0
  155. package/lib/lib.es2017.intl.d.ts +42 -0
  156. package/lib/lib.es2017.object.d.ts +47 -0
  157. package/lib/lib.es2017.sharedmemory.d.ts +133 -0
  158. package/lib/lib.es2017.string.d.ts +43 -0
  159. package/lib/lib.es2017.typedarrays.d.ts +51 -0
  160. package/lib/lib.es2018.asyncgenerator.d.ts +75 -0
  161. package/lib/lib.es2018.asynciterable.d.ts +51 -0
  162. package/lib/lib.es2018.d.ts +22 -0
  163. package/lib/lib.es2018.full.d.ts +22 -0
  164. package/lib/lib.es2018.intl.d.ts +81 -0
  165. package/lib/lib.es2018.promise.d.ts +28 -0
  166. package/lib/lib.es2018.regexp.d.ts +35 -0
  167. package/lib/lib.es2019.array.d.ts +77 -0
  168. package/lib/lib.es2019.d.ts +22 -0
  169. package/lib/lib.es2019.full.d.ts +22 -0
  170. package/lib/lib.es2019.intl.d.ts +21 -0
  171. package/lib/lib.es2019.object.d.ts +31 -0
  172. package/lib/lib.es2019.string.d.ts +35 -0
  173. package/lib/lib.es2019.symbol.d.ts +22 -0
  174. package/lib/lib.es2020.bigint.d.ts +763 -0
  175. package/lib/lib.es2020.d.ts +25 -0
  176. package/lib/lib.es2020.date.d.ts +40 -0
  177. package/lib/lib.es2020.full.d.ts +22 -0
  178. package/lib/lib.es2020.intl.d.ts +472 -0
  179. package/lib/lib.es2020.number.d.ts +26 -0
  180. package/lib/lib.es2020.promise.d.ts +45 -0
  181. package/lib/lib.es2020.sharedmemory.d.ts +97 -0
  182. package/lib/lib.es2020.string.d.ts +42 -0
  183. package/lib/lib.es2020.symbol.wellknown.d.ts +39 -0
  184. package/lib/lib.es2021.d.ts +21 -0
  185. package/lib/lib.es2021.full.d.ts +22 -0
  186. package/lib/lib.es2021.intl.d.ts +164 -0
  187. package/lib/lib.es2021.promise.d.ts +46 -0
  188. package/lib/lib.es2021.string.d.ts +31 -0
  189. package/lib/lib.es2021.weakref.d.ts +76 -0
  190. package/lib/lib.es2022.array.d.ts +119 -0
  191. package/lib/lib.es2022.d.ts +23 -0
  192. package/lib/lib.es2022.error.d.ts +73 -0
  193. package/lib/lib.es2022.full.d.ts +22 -0
  194. package/lib/lib.es2022.intl.d.ts +143 -0
  195. package/lib/lib.es2022.object.d.ts +24 -0
  196. package/lib/lib.es2022.regexp.d.ts +37 -0
  197. package/lib/lib.es2022.string.d.ts +23 -0
  198. package/lib/lib.es2023.array.d.ts +922 -0
  199. package/lib/lib.es2023.collection.d.ts +19 -0
  200. package/lib/lib.es2023.d.ts +20 -0
  201. package/lib/lib.es2023.full.d.ts +22 -0
  202. package/lib/lib.es2023.intl.d.ts +62 -0
  203. package/lib/lib.es2024.arraybuffer.d.ts +63 -0
  204. package/lib/lib.es2024.collection.d.ts +27 -0
  205. package/lib/lib.es2024.d.ts +24 -0
  206. package/lib/lib.es2024.full.d.ts +22 -0
  207. package/lib/lib.es2024.object.d.ts +27 -0
  208. package/lib/lib.es2024.promise.d.ts +33 -0
  209. package/lib/lib.es2024.regexp.d.ts +23 -0
  210. package/lib/lib.es2024.sharedmemory.d.ts +66 -0
  211. package/lib/lib.es2024.string.d.ts +27 -0
  212. package/lib/lib.es2025.collection.d.ts +94 -0
  213. package/lib/lib.es2025.d.ts +23 -0
  214. package/lib/lib.es2025.float16.d.ts +443 -0
  215. package/lib/lib.es2025.full.d.ts +22 -0
  216. package/lib/lib.es2025.intl.d.ts +200 -0
  217. package/lib/lib.es2025.iterator.d.ts +146 -0
  218. package/lib/lib.es2025.promise.d.ts +32 -0
  219. package/lib/lib.es2025.regexp.d.ts +30 -0
  220. package/lib/lib.es5.d.ts +4599 -0
  221. package/lib/lib.es6.d.ts +21 -0
  222. package/lib/lib.esnext.array.d.ts +33 -0
  223. package/lib/lib.esnext.collection.d.ts +47 -0
  224. package/lib/lib.esnext.d.ts +27 -0
  225. package/lib/lib.esnext.date.d.ts +21 -0
  226. package/lib/lib.esnext.decorators.d.ts +26 -0
  227. package/lib/lib.esnext.disposable.d.ts +191 -0
  228. package/lib/lib.esnext.error.d.ts +22 -0
  229. package/lib/lib.esnext.full.d.ts +22 -0
  230. package/lib/lib.esnext.intl.d.ts +107 -0
  231. package/lib/lib.esnext.sharedmemory.d.ts +23 -0
  232. package/lib/lib.esnext.temporal.d.ts +485 -0
  233. package/lib/lib.esnext.typedarrays.d.ts +90 -0
  234. package/lib/lib.scripthost.d.ts +320 -0
  235. package/lib/lib.webworker.asynciterable.d.ts +18 -0
  236. package/lib/lib.webworker.d.ts +15606 -0
  237. package/lib/lib.webworker.importscripts.d.ts +21 -0
  238. package/lib/lib.webworker.iterable.d.ts +18 -0
  239. package/lib/logger.js +144 -0
  240. package/lib/package.json +7 -0
  241. package/lib/tsserver.js +57 -0
  242. package/lib/tsserverlibrary.js +171 -0
  243. package/lib/typesMap.json +497 -0
  244. package/lib/typescript.js +373 -0
  245. package/package.json +115 -0
@@ -0,0 +1,124 @@
1
+ /**
2
+ * Quick Fix Discovery
3
+ *
4
+ * Scans installed packages for "justscale" field with "quickFixes" entry,
5
+ * imports the quick fix modules, and registers them with the language service.
6
+ *
7
+ * Watches the lockfile for changes to detect new packages.
8
+ */
9
+ import { existsSync, readFileSync, watchFile, unwatchFile } from 'node:fs';
10
+ import { join } from 'node:path';
11
+ /**
12
+ * Discover quick fix modules from installed packages.
13
+ */
14
+ export async function discoverQuickFixes(projectRoot, log) {
15
+ const pkgPath = join(projectRoot, 'package.json');
16
+ if (!existsSync(pkgPath))
17
+ return [];
18
+ let pkg;
19
+ try {
20
+ pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
21
+ }
22
+ catch {
23
+ return [];
24
+ }
25
+ const deps = { ...pkg.dependencies, ...pkg.devDependencies };
26
+ const quickFixes = [];
27
+ for (const depName of Object.keys(deps)) {
28
+ try {
29
+ const depPkgPath = resolveDepPackageJson(projectRoot, depName);
30
+ if (!depPkgPath)
31
+ continue;
32
+ const depPkg = JSON.parse(readFileSync(depPkgPath, 'utf-8'));
33
+ const justscaleField = depPkg.justscale;
34
+ if (!justscaleField?.quickFixes)
35
+ continue;
36
+ const qfConfig = justscaleField.quickFixes;
37
+ const modulePath = resolveModulePath(depPkgPath, qfConfig);
38
+ if (!modulePath)
39
+ continue;
40
+ const qfModule = await import(modulePath);
41
+ // Collect exported quick fix definitions
42
+ for (const value of Object.values(qfModule)) {
43
+ if (isQuickFixDefinition(value)) {
44
+ quickFixes.push(value);
45
+ }
46
+ else if (Array.isArray(value)) {
47
+ for (const item of value) {
48
+ if (isQuickFixDefinition(item)) {
49
+ quickFixes.push(item);
50
+ }
51
+ }
52
+ }
53
+ }
54
+ log(`Loaded ${quickFixes.length} quick fix(es) from ${depName}`);
55
+ }
56
+ catch (err) {
57
+ log(`Warning: failed to load quick fixes from ${depName}: ${err.message}`);
58
+ }
59
+ }
60
+ return quickFixes;
61
+ }
62
+ /**
63
+ * Watch lockfile for changes and re-discover quick fixes.
64
+ */
65
+ export function watchLockfile(projectRoot, onChange, log) {
66
+ const lockfiles = [
67
+ join(projectRoot, 'pnpm-lock.yaml'),
68
+ join(projectRoot, 'package-lock.json'),
69
+ join(projectRoot, 'yarn.lock'),
70
+ ];
71
+ const watchers = [];
72
+ for (const lockfile of lockfiles) {
73
+ if (existsSync(lockfile)) {
74
+ watchFile(lockfile, { interval: 2000 }, () => {
75
+ log(`Lockfile changed: ${lockfile}`);
76
+ onChange();
77
+ });
78
+ watchers.push(lockfile);
79
+ log(`Watching lockfile: ${lockfile}`);
80
+ }
81
+ }
82
+ return () => {
83
+ for (const lockfile of watchers) {
84
+ unwatchFile(lockfile);
85
+ }
86
+ };
87
+ }
88
+ function resolveDepPackageJson(cwd, depName) {
89
+ let dir = cwd;
90
+ while (true) {
91
+ const candidate = join(dir, 'node_modules', depName, 'package.json');
92
+ if (existsSync(candidate))
93
+ return candidate;
94
+ const parent = join(dir, '..');
95
+ if (parent === dir)
96
+ break;
97
+ dir = parent;
98
+ }
99
+ return null;
100
+ }
101
+ function resolveModulePath(depPkgPath, config) {
102
+ const depDir = join(depPkgPath, '..');
103
+ if (config.import) {
104
+ const importPath = join(depDir, config.import);
105
+ if (existsSync(importPath))
106
+ return importPath;
107
+ }
108
+ if (config.source) {
109
+ const sourcePath = join(depDir, config.source);
110
+ if (existsSync(sourcePath))
111
+ return sourcePath;
112
+ }
113
+ return null;
114
+ }
115
+ function isQuickFixDefinition(value) {
116
+ if (!value || typeof value !== 'object')
117
+ return false;
118
+ const obj = value;
119
+ return typeof obj.id === 'string' &&
120
+ typeof obj.when === 'function' &&
121
+ typeof obj.label === 'string' &&
122
+ typeof obj.fix === 'function';
123
+ }
124
+ //# sourceMappingURL=quick-fix-discovery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quick-fix-discovery.js","sourceRoot":"","sources":["../../src/language-service/quick-fix-discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAgBjC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,WAAmB,EAAE,GAA0B;IACtF,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IAClD,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;QAAE,OAAO,EAAE,CAAC;IAEpC,IAAI,GAAQ,CAAC;IACb,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IACnD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,IAAI,GAAG,EAAE,GAAG,GAAG,CAAC,YAAY,EAAE,GAAG,GAAG,CAAC,eAAe,EAAE,CAAC;IAC7D,MAAM,UAAU,GAAyB,EAAE,CAAC;IAE5C,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,qBAAqB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;YAC/D,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SAAS,iBAAiB,CAAC,UAAkB,EAAE,MAA4C;IACzF,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAEtC,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QAC/C,IAAI,UAAU,CAAC,UAAU,CAAC;YAAE,OAAO,UAAU,CAAC;IAChD,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QAC/C,IAAI,UAAU,CAAC,UAAU,CAAC;YAAE,OAAO,UAAU,CAAC;IAChD,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,oBAAoB,CAAC,KAAc;IAC1C,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtD,MAAM,GAAG,GAAG,KAAY,CAAC;IACzB,OAAO,OAAO,GAAG,CAAC,EAAE,KAAK,QAAQ;QAC/B,OAAO,GAAG,CAAC,IAAI,KAAK,UAAU;QAC9B,OAAO,GAAG,CAAC,KAAK,KAAK,QAAQ;QAC7B,OAAO,GAAG,CAAC,GAAG,KAAK,UAAU,CAAC;AAClC,CAAC"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Process TypeScript Compiler
3
+ *
4
+ * Compiles process files (*.process.ts) using TypeScript's compiler API
5
+ * and the process transformer.
6
+ */
7
+ export interface CompilerOptions {
8
+ /** Root directory for finding process files */
9
+ rootDir: string;
10
+ /** Output directory for compiled files (default: .justscale/process-cache) */
11
+ cacheDir?: string;
12
+ /** Whether to emit source maps */
13
+ sourceMap?: boolean;
14
+ /** Verbose logging */
15
+ verbose?: boolean;
16
+ }
17
+ export interface CompileResult {
18
+ /** Compiled JavaScript code (includes inline source map when sourceMap is enabled) */
19
+ code: string;
20
+ /**
21
+ * Raw source map JSON when sourceMap is enabled, otherwise undefined.
22
+ * Tooling that wants to attach its own map (esbuild, coverage reporters,
23
+ * stack remappers) should consume this rather than regex-extracting the
24
+ * base64 data URL from `code`.
25
+ */
26
+ map?: string;
27
+ /** Whether this was a cache hit */
28
+ cached: boolean;
29
+ }
30
+ /**
31
+ * Process TypeScript compiler.
32
+ */
33
+ export declare class PtsCompiler {
34
+ private readonly rootDir;
35
+ private readonly cacheDir;
36
+ private readonly sourceMap;
37
+ private readonly verbose;
38
+ constructor(options: CompilerOptions);
39
+ /**
40
+ * Compile a process file.
41
+ */
42
+ compile(filePath: string): CompileResult;
43
+ private compileFile;
44
+ private createCompilerHost;
45
+ }
46
+ /**
47
+ * Create a PTS compiler instance.
48
+ */
49
+ export declare function createCompiler(options: CompilerOptions): PtsCompiler;
50
+ //# sourceMappingURL=incremental.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"incremental.d.ts","sourceRoot":"","sources":["../../src/loader/incremental.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,MAAM,WAAW,eAAe;IAC9B,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAA;IACf,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,kCAAkC;IAClC,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,sBAAsB;IACtB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,sFAAsF;IACtF,IAAI,EAAE,MAAM,CAAA;IACZ;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,mCAAmC;IACnC,MAAM,EAAE,OAAO,CAAA;CAChB;AAED;;GAEG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAU;IACpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;gBAEtB,OAAO,EAAE,eAAe;IAYpC;;OAEG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa;IAsBxC,OAAO,CAAC,WAAW;IA0EnB,OAAO,CAAC,kBAAkB;CAiD3B;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,WAAW,CAEpE"}
@@ -0,0 +1,151 @@
1
+ /**
2
+ * Process TypeScript Compiler
3
+ *
4
+ * Compiles process files (*.process.ts) using TypeScript's compiler API
5
+ * and the process transformer.
6
+ */
7
+ import ts from 'typescript';
8
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
9
+ import { dirname, join, relative, resolve } from 'node:path';
10
+ import { createProcessTransformer } from '../compiler/transformer.js';
11
+ /**
12
+ * Process TypeScript compiler.
13
+ */
14
+ export class PtsCompiler {
15
+ rootDir;
16
+ cacheDir;
17
+ sourceMap;
18
+ verbose;
19
+ constructor(options) {
20
+ this.rootDir = resolve(options.rootDir);
21
+ this.cacheDir = options.cacheDir ?? join(this.rootDir, '.justscale', 'process-cache');
22
+ this.sourceMap = options.sourceMap ?? false;
23
+ this.verbose = options.verbose ?? false;
24
+ // Ensure output directory exists
25
+ if (!existsSync(this.cacheDir)) {
26
+ mkdirSync(this.cacheDir, { recursive: true });
27
+ }
28
+ }
29
+ /**
30
+ * Compile a process file.
31
+ */
32
+ compile(filePath) {
33
+ const absolutePath = resolve(filePath);
34
+ const relativePath = relative(this.rootDir, absolutePath);
35
+ // Read source
36
+ const source = readFileSync(absolutePath, 'utf-8');
37
+ if (this.verbose) {
38
+ console.log(`[pts] Compiling: ${relativePath}`);
39
+ }
40
+ // Compile with transformer
41
+ const { code, map } = this.compileFile(absolutePath, source);
42
+ // Write compiled file for debugging
43
+ const outPath = join(this.cacheDir, relativePath.replace(/\.(process\.)?ts$/, '.js'));
44
+ mkdirSync(dirname(outPath), { recursive: true });
45
+ writeFileSync(outPath, code);
46
+ return { code, map, cached: false };
47
+ }
48
+ compileFile(filePath, source) {
49
+ // Compiler options - relaxed to handle missing type info. We emit the
50
+ // source map non-inline into a separate buffer so callers that want it
51
+ // as a distinct handle (esbuild plugin, coverage tooling) can have it
52
+ // without re-parsing a data URL. Runtime callers (the Node loader)
53
+ // still get the base64-inlined form appended to `code` below.
54
+ const compilerOptions = {
55
+ target: ts.ScriptTarget.ESNext,
56
+ module: ts.ModuleKind.ESNext,
57
+ moduleResolution: ts.ModuleResolutionKind.Bundler,
58
+ strict: false, // Relaxed - we don't need full type checking
59
+ esModuleInterop: true,
60
+ skipLibCheck: true,
61
+ declaration: false,
62
+ sourceMap: this.sourceMap,
63
+ inlineSources: this.sourceMap, // Embed original source in the map
64
+ noEmitOnError: false, // Emit even if there are errors
65
+ isolatedModules: true, // Each file is a module
66
+ };
67
+ // Create a virtual file system for compilation
68
+ const files = new Map();
69
+ files.set(filePath, source);
70
+ // Create compiler host
71
+ const host = this.createCompilerHost(files, compilerOptions);
72
+ // Create program
73
+ const program = ts.createProgram([filePath], compilerOptions, host);
74
+ // Get the transformer
75
+ const transformer = createProcessTransformer(program, {
76
+ sourceMap: this.sourceMap,
77
+ verbose: this.verbose,
78
+ });
79
+ // Get source file
80
+ const sourceFile = program.getSourceFile(filePath);
81
+ // Emit with transformer
82
+ let outputCode = '';
83
+ let outputMap;
84
+ program.emit(sourceFile, (fileName, text) => {
85
+ if (fileName.endsWith('.map')) {
86
+ outputMap = text;
87
+ }
88
+ else {
89
+ outputCode = text;
90
+ }
91
+ }, undefined, false, { before: [transformer] });
92
+ // The existing Node loader path expects the source map to be embedded
93
+ // in the emitted code (no companion .map file is written to disk), so
94
+ // re-inline as a base64 data URL. Strip any TypeScript-emitted
95
+ // sourceMappingURL comment first - with `sourceMap: true` tsc appends
96
+ // a `file.js.map` reference that doesn't exist on disk at runtime.
97
+ if (this.sourceMap && outputMap) {
98
+ // Anchor to start-of-line so we don't mangle source that legitimately
99
+ // contains the literal string "//# sourceMappingURL=" (e.g. tests that
100
+ // assert on this marker). tsc emits the comment on its own line.
101
+ outputCode = outputCode.replace(/(^|\n)\/\/# sourceMappingURL=.*$/m, '');
102
+ const base64 = Buffer.from(outputMap, 'utf-8').toString('base64');
103
+ outputCode += `\n//# sourceMappingURL=data:application/json;base64,${base64}\n`;
104
+ }
105
+ return { code: outputCode, map: outputMap };
106
+ }
107
+ createCompilerHost(files, options) {
108
+ const defaultHost = ts.createCompilerHost(options);
109
+ return {
110
+ ...defaultHost,
111
+ getSourceFile: (fileName, languageVersion, onError) => {
112
+ // Check our virtual files first
113
+ const content = files.get(fileName);
114
+ if (content !== undefined) {
115
+ return ts.createSourceFile(fileName, content, languageVersion, true, ts.ScriptKind.TS);
116
+ }
117
+ // Fall back to default host
118
+ return defaultHost.getSourceFile(fileName, languageVersion, onError);
119
+ },
120
+ fileExists: (fileName) => {
121
+ if (files.has(fileName))
122
+ return true;
123
+ return defaultHost.fileExists(fileName);
124
+ },
125
+ readFile: (fileName) => {
126
+ const content = files.get(fileName);
127
+ if (content !== undefined)
128
+ return content;
129
+ return defaultHost.readFile(fileName);
130
+ },
131
+ // Override to prevent errors about missing files
132
+ getDefaultLibFileName: (options) => {
133
+ return defaultHost.getDefaultLibFileName(options);
134
+ },
135
+ writeFile: () => {
136
+ // No-op - we capture output in emit callback
137
+ },
138
+ getCurrentDirectory: () => this.rootDir,
139
+ getCanonicalFileName: (fileName) => fileName,
140
+ useCaseSensitiveFileNames: () => true,
141
+ getNewLine: () => '\n',
142
+ };
143
+ }
144
+ }
145
+ /**
146
+ * Create a PTS compiler instance.
147
+ */
148
+ export function createCompiler(options) {
149
+ return new PtsCompiler(options);
150
+ }
151
+ //# sourceMappingURL=incremental.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"incremental.js","sourceRoot":"","sources":["../../src/loader/incremental.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,YAAY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pD,CAAC;YAED,SAAS,EAAE,GAAG,EAAE;gBACd,6CAA6C;YAC/C,CAAC;YAED,mBAAmB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO;YAEvC,oBAAoB,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ;YAE5C,yBAAyB,EAAE,GAAG,EAAE,CAAC,IAAI;YAErC,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI;SACvB,CAAC;IACJ,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,OAAwB;IACrD,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @justscale/typescript/loader
3
+ *
4
+ * PTS (Process TypeScript) compiler and loader for JustScale.
5
+ *
6
+ * ## Usage
7
+ *
8
+ * ### As a Node.js loader (recommended)
9
+ *
10
+ * ```bash
11
+ * node --import @justscale/typescript/register --import tsx ./app.ts
12
+ * ```
13
+ *
14
+ * ### Programmatic compilation
15
+ *
16
+ * ```typescript
17
+ * import { createCompiler } from '@justscale/typescript/loader'
18
+ *
19
+ * const compiler = createCompiler({ rootDir: process.cwd() })
20
+ * const result = compiler.compile('./processes/order.process.ts')
21
+ * ```
22
+ */
23
+ export { PtsCompiler, createCompiler } from './incremental.js';
24
+ export type { CompilerOptions, CompileResult } from './incremental.js';
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/loader/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC/D,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @justscale/typescript/loader
3
+ *
4
+ * PTS (Process TypeScript) compiler and loader for JustScale.
5
+ *
6
+ * ## Usage
7
+ *
8
+ * ### As a Node.js loader (recommended)
9
+ *
10
+ * ```bash
11
+ * node --import @justscale/typescript/register --import tsx ./app.ts
12
+ * ```
13
+ *
14
+ * ### Programmatic compilation
15
+ *
16
+ * ```typescript
17
+ * import { createCompiler } from '@justscale/typescript/loader'
18
+ *
19
+ * const compiler = createCompiler({ rootDir: process.cwd() })
20
+ * const result = compiler.compile('./processes/order.process.ts')
21
+ * ```
22
+ */
23
+ export { PtsCompiler, createCompiler } from './incremental.js';
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/loader/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Node.js ESM Loader for Process TypeScript and Proto files
3
+ *
4
+ * This loader hooks into Node.js module loading to:
5
+ * 1. Compile process files (*.process.ts or files importing @justscale/core/process)
6
+ * 2. Transform .proto imports to JavaScript
7
+ *
8
+ * Usage:
9
+ * node --import @justscale/typescript/register --import tsx ./app.ts
10
+ */
11
+ import '../plugins/index.js';
12
+ /** Exported for unit tests; takes an explicit root rather than using cwd. */
13
+ export declare function _isInsideRoot(filePath: string, root: string): boolean;
14
+ interface ResolveContext {
15
+ conditions: string[];
16
+ parentURL?: string;
17
+ }
18
+ interface ResolveResult {
19
+ url: string;
20
+ format?: string;
21
+ shortCircuit?: boolean;
22
+ }
23
+ type NextResolve = (specifier: string, context: ResolveContext) => Promise<ResolveResult>;
24
+ interface LoadContext {
25
+ format?: string;
26
+ conditions: string[];
27
+ }
28
+ interface LoadResult {
29
+ format: string;
30
+ source: string | ArrayBuffer;
31
+ shortCircuit?: boolean;
32
+ }
33
+ type NextLoad = (url: string, context: LoadContext) => Promise<LoadResult>;
34
+ /**
35
+ * Resolve hook - handles format imports (.proto, .capnp, .graphql/.gql).
36
+ * Tells Node.js where to find these files and marks them as ESM modules.
37
+ */
38
+ export declare function resolve(specifier: string, context: ResolveContext, nextResolve: NextResolve): Promise<ResolveResult>;
39
+ /**
40
+ * Load hook - intercepts .ts files and compiles process files specially.
41
+ * Also handles .proto files for direct proto imports.
42
+ * Non-process .ts files are forwarded to the next loader (tsx).
43
+ */
44
+ export declare function load(url: string, context: LoadContext, nextLoad: NextLoad): Promise<LoadResult>;
45
+ /**
46
+ * Initialize hook - called when the loader is registered.
47
+ */
48
+ export declare function initialize(data?: {
49
+ verbose?: boolean;
50
+ }): Promise<void>;
51
+ export {};
52
+ //# sourceMappingURL=loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/loader/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,OAAO,qBAAqB,CAAC;AAyC7B,6EAA6E;AAC7E,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAqBrE;AAsDD,UAAU,cAAc;IACtB,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,UAAU,aAAa;IACrB,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AAED,KAAK,WAAW,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;AAE1F,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,EAAE,CAAA;CACrB;AAED,UAAU,UAAU;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,GAAG,WAAW,CAAA;IAC5B,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;A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