lurqrun 0.1.6 → 0.1.8

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 (239) hide show
  1. package/README.md +311 -139
  2. package/dist/auditHandler-VWCXSDVO.js +24 -0
  3. package/dist/autopilotInit-Q62MX5M6.js +178 -0
  4. package/dist/bin/lurq.js +3255 -23319
  5. package/dist/browserAuth-J7APSD4P.js +96 -0
  6. package/dist/cache-AEAKCV4I.js +12 -0
  7. package/dist/check-2JTQDQA6.js +2613 -0
  8. package/dist/check-PQSQ2MMA.js +192 -0
  9. package/dist/checkUpgrade-5YW77OBL.js +24 -0
  10. package/dist/chunk-2GAYNIHG.js +40 -0
  11. package/dist/chunk-2O6Z37IT.js +423 -0
  12. package/dist/chunk-2WD4QAH4.js +116 -0
  13. package/dist/chunk-3676XOBU.js +2235 -0
  14. package/dist/chunk-3D2MPGOQ.js +181 -0
  15. package/dist/chunk-3GHJR7XR.js +2049 -0
  16. package/dist/chunk-4ESO33J6.js +34 -0
  17. package/dist/chunk-4JHDSVIN.js +1229 -0
  18. package/dist/chunk-4KCPOMG6.js +68 -0
  19. package/dist/chunk-53SG6XWA.js +141 -0
  20. package/dist/chunk-5ABNDB3I.js +37 -0
  21. package/dist/chunk-5ALIJFDA.js +114 -0
  22. package/dist/chunk-63MUJNZL.js +318 -0
  23. package/dist/chunk-64ZF7KO4.js +1571 -0
  24. package/dist/chunk-6DM6UQFD.js +318 -0
  25. package/dist/chunk-6EQ3ARXA.js +304 -0
  26. package/dist/chunk-6L67QMCP.js +92 -0
  27. package/dist/chunk-72Y2FDVS.js +172 -0
  28. package/dist/chunk-A3TYI2TF.js +288 -0
  29. package/dist/chunk-B2UUYRBX.js +536 -0
  30. package/dist/chunk-BJT2LHAR.js +320 -0
  31. package/dist/chunk-BM3LF5T6.js +132 -0
  32. package/dist/chunk-BN3NM47Q.js +214 -0
  33. package/dist/chunk-BUALU27S.js +123 -0
  34. package/dist/chunk-C6GLE626.js +160 -0
  35. package/dist/chunk-D3K6IZVR.js +12845 -0
  36. package/dist/chunk-D3VTZS7V.js +222 -0
  37. package/dist/chunk-DM37MTOO.js +636 -0
  38. package/dist/chunk-DONTW3NE.js +171 -0
  39. package/dist/chunk-DSROTZ3Z.js +38 -0
  40. package/dist/chunk-ELGCAM7P.js +184 -0
  41. package/dist/chunk-EQCXENKZ.js +130 -0
  42. package/dist/chunk-EYAKM6YN.js +96 -0
  43. package/dist/chunk-FDFPMBCA.js +112 -0
  44. package/dist/chunk-FVYFV5HA.js +154 -0
  45. package/dist/chunk-GE37NVLN.js +15 -0
  46. package/dist/chunk-GM5Y555O.js +143 -0
  47. package/dist/chunk-GRJXQBQZ.js +793 -0
  48. package/dist/chunk-HWFX4BC4.js +177 -0
  49. package/dist/chunk-I3M2KJXB.js +56 -0
  50. package/dist/chunk-IFNONGRQ.js +603 -0
  51. package/dist/chunk-J3U2CPSK.js +136 -0
  52. package/dist/chunk-J6XQ7OPZ.js +74 -0
  53. package/dist/chunk-KMV4Y6R3.js +127 -0
  54. package/dist/chunk-KP5ZDDPE.js +340 -0
  55. package/dist/chunk-KYKSZ3XZ.js +202 -0
  56. package/dist/chunk-LEGPB7DO.js +81 -0
  57. package/dist/chunk-LUAKDHLZ.js +40 -0
  58. package/dist/chunk-MHUEVBVO.js +35 -0
  59. package/dist/chunk-MYGSLK44.js +37 -0
  60. package/dist/chunk-NEZNAPPN.js +41 -0
  61. package/dist/chunk-NPVN2THM.js +197 -0
  62. package/dist/chunk-NYZU5NCW.js +23 -0
  63. package/dist/chunk-O4KHCV6I.js +320 -0
  64. package/dist/chunk-ONDVTXUO.js +240 -0
  65. package/dist/chunk-OTJFHESY.js +176 -0
  66. package/dist/chunk-P6MIKSPY.js +243 -0
  67. package/dist/chunk-Q5VPF4WI.js +26 -0
  68. package/dist/chunk-QCRBX3LV.js +165 -0
  69. package/dist/chunk-QKGYDMWB.js +7409 -0
  70. package/dist/chunk-QSL6QN5X.js +115 -0
  71. package/dist/chunk-QUIMQ7YL.js +73 -0
  72. package/dist/chunk-RG3YLU6E.js +49 -0
  73. package/dist/chunk-SHCEBP3J.js +107 -0
  74. package/dist/chunk-SHZFOSXC.js +462 -0
  75. package/dist/chunk-SOXFMMXC.js +151 -0
  76. package/dist/chunk-TDTYV6QI.js +119 -0
  77. package/dist/chunk-TNTXWSYA.js +19 -0
  78. package/dist/chunk-TUXQ32WE.js +2251 -0
  79. package/dist/chunk-VGCDRK3S.js +37 -0
  80. package/dist/chunk-VLRHFMGJ.js +58 -0
  81. package/dist/chunk-WHX2ZFCG.js +4048 -0
  82. package/dist/chunk-X4W64MHU.js +2005 -0
  83. package/dist/chunk-XBQA4I36.js +92 -0
  84. package/dist/chunk-XGOV6KV4.js +413 -0
  85. package/dist/chunk-XIFQIFSZ.js +940 -0
  86. package/dist/chunk-XLXPVN3Y.js +15393 -0
  87. package/dist/chunk-ZJMLQ37G.js +90 -0
  88. package/dist/client-MU4EUDZV.js +15 -0
  89. package/dist/commands-UOOTMBKA.js +1023 -0
  90. package/dist/compat-Q5DVPITN.js +201 -0
  91. package/dist/constants-DJFOFZ44.js +24 -0
  92. package/dist/dashboardIssue-KBKLQMGC.js +274 -0
  93. package/dist/diff-I4SNUHU3.js +13 -0
  94. package/dist/dist-4XXIXHHZ.js +12945 -0
  95. package/dist/domains-VRT4BRVZ.js +14 -0
  96. package/dist/e2b-FVPHDULZ.js +172 -0
  97. package/dist/env-UN6KGZ7S.js +15 -0
  98. package/dist/envCheck-KUPTORFQ.js +71 -0
  99. package/dist/extract-6WG265BL.js +455 -0
  100. package/dist/fetch-PJ3SC32M.js +22 -0
  101. package/dist/firstTouch-COJCMOB3.js +55 -0
  102. package/dist/fix-3EDWNKW3.js +220 -0
  103. package/dist/handlers-4Q37WIFT.js +55 -0
  104. package/dist/hook-NA66XJLC.js +412 -0
  105. package/dist/http-25GJ6SKK.js +6928 -0
  106. package/dist/ingestQueue-FSVJC3AA.js +37 -0
  107. package/dist/install-G2HHXYJ2.js +20 -0
  108. package/dist/installSkill-5TIMYIJZ.js +70 -0
  109. package/dist/inventory-5AWSLJYU.js +31 -0
  110. package/dist/local-XPZMRH5R.js +13 -0
  111. package/dist/manifest-ENMIC54B.js +13 -0
  112. package/dist/mcp-PENLL2PK.js +500 -0
  113. package/dist/mcpConfig-3LYPRY5Q.js +80 -0
  114. package/dist/mcpHandlers-PO7GENA7.js +22 -0
  115. package/dist/mcpScan-ULP626TQ.js +1735 -0
  116. package/dist/mcpScanWorkflow-27O44FOE.js +98 -0
  117. package/dist/mcpStack-ZNYIFXZ5.js +20 -0
  118. package/dist/model-ASMZWLM7.js +214 -0
  119. package/dist/packages-RWF2LXST.js +40 -0
  120. package/dist/plan-SDILIDZT.js +465 -0
  121. package/dist/planView-ZAKRTGVS.js +82 -0
  122. package/dist/policy-JAGNMQJI.js +115 -0
  123. package/dist/probe-3IK646WN.js +610 -0
  124. package/dist/publicUpgrades-WTBGLDIK.js +42 -0
  125. package/dist/references-I6Y4BSRR.js +16 -0
  126. package/dist/release-7IU2R4YG.js +128 -0
  127. package/dist/remote-FN6225AH.js +42 -0
  128. package/dist/rename-OS6JYBZQ.js +204 -0
  129. package/dist/reportRuns-O4X7ZFTX.js +77 -0
  130. package/dist/safeFetch-COERXGFN.js +19 -0
  131. package/dist/sandbox-SAPSRKEI.js +39 -0
  132. package/dist/sarif-WLVJFJ7U.js +125 -0
  133. package/dist/server-OLTY3NYT.js +59 -0
  134. package/dist/surface-7MHE3RL7.js +143 -0
  135. package/dist/surface-JS2XU3U3.js +38 -0
  136. package/dist/surfaceHandlers-4B6TMZ34.js +20 -0
  137. package/dist/typecheck-NGOKNAJY.js +282 -0
  138. package/dist/types-M5JP2W3D.js +10 -0
  139. package/dist/uninstall-I2IJP5JZ.js +200 -0
  140. package/dist/upgrade-FS26DJGG.js +650 -0
  141. package/dist/upgradePlan-ZS5IOVMZ.js +181 -0
  142. package/dist/upkeepHandler-VFGYXJKB.js +13 -0
  143. package/dist/userConfig-ICASHI47.js +20 -0
  144. package/dist/watch-OCNEUXG6.js +204 -0
  145. package/package.json +26 -20
  146. package/templates/agent-rules.md +4 -4
  147. package/templates/skill-instructions.md +35 -17
  148. package/dist/bin/lurq.js.map +0 -1
  149. package/dist/index.d.ts +0 -805
  150. package/dist/index.js +0 -23570
  151. package/dist/index.js.map +0 -1
  152. package/drizzle/0000_confused_fabian_cortez.sql +0 -54
  153. package/drizzle/0001_aspiring_timeslip.sql +0 -15
  154. package/drizzle/0002_lyrical_lila_cheney.sql +0 -14
  155. package/drizzle/0003_violet_giant_girl.sql +0 -14
  156. package/drizzle/0004_slim_valeria_richards.sql +0 -15
  157. package/drizzle/0005_petite_luke_cage.sql +0 -12
  158. package/drizzle/0006_calm_nighthawk.sql +0 -3
  159. package/drizzle/0007_slimy_naoko.sql +0 -1
  160. package/drizzle/0008_peaceful_tigra.sql +0 -1
  161. package/drizzle/0009_smooth_harrier.sql +0 -10
  162. package/drizzle/0010_curved_amphibian.sql +0 -2
  163. package/drizzle/0011_compat_provenance_closures.sql +0 -11
  164. package/drizzle/0012_api_surfaces.sql +0 -9
  165. package/drizzle/0013_nice_thanos.sql +0 -1
  166. package/drizzle/0014_luxuriant_malcolm_colcord.sql +0 -10
  167. package/drizzle/0015_past_fat_cobra.sql +0 -11
  168. package/drizzle/0016_futuristic_junta.sql +0 -50
  169. package/drizzle/0017_absent_grandmaster.sql +0 -20
  170. package/drizzle/0018_rainy_proemial_gods.sql +0 -1
  171. package/drizzle/0019_dashing_korvac.sql +0 -11
  172. package/drizzle/0020_normal_vulture.sql +0 -3
  173. package/drizzle/0021_dazzling_blue_shield.sql +0 -17
  174. package/drizzle/0022_massive_ghost_rider.sql +0 -24
  175. package/drizzle/0023_next_shatterstar.sql +0 -1
  176. package/drizzle/0024_dusty_maelstrom.sql +0 -15
  177. package/drizzle/0025_gifted_harpoon.sql +0 -5
  178. package/drizzle/0026_awesome_mordo.sql +0 -1
  179. package/drizzle/0027_charming_ulik.sql +0 -2
  180. package/drizzle/0028_romantic_loners.sql +0 -2
  181. package/drizzle/0029_busy_korvac.sql +0 -16
  182. package/drizzle/0030_steady_mathemanic.sql +0 -6
  183. package/drizzle/0031_redundant_maginty.sql +0 -2
  184. package/drizzle/0032_stack_resolutions.sql +0 -14
  185. package/drizzle/0033_graceful_tyger_tiger.sql +0 -3
  186. package/drizzle/0034_uneven_thunderbird.sql +0 -1
  187. package/drizzle/0035_api_key_scopes.sql +0 -1
  188. package/drizzle/0036_policy_audit.sql +0 -21
  189. package/drizzle/0037_subscription_seats.sql +0 -1
  190. package/drizzle/0038_symbol_offsets.sql +0 -2
  191. package/drizzle/0039_mcp_runtime_scans.sql +0 -80
  192. package/drizzle/0040_subscription_overage_and_interval.sql +0 -4
  193. package/drizzle/0041_account_email.sql +0 -38
  194. package/drizzle/0042_alert_channels.sql +0 -21
  195. package/drizzle/meta/0000_snapshot.json +0 -370
  196. package/drizzle/meta/0001_snapshot.json +0 -482
  197. package/drizzle/meta/0002_snapshot.json +0 -575
  198. package/drizzle/meta/0003_snapshot.json +0 -667
  199. package/drizzle/meta/0004_snapshot.json +0 -769
  200. package/drizzle/meta/0005_snapshot.json +0 -864
  201. package/drizzle/meta/0006_snapshot.json +0 -882
  202. package/drizzle/meta/0007_snapshot.json +0 -876
  203. package/drizzle/meta/0008_snapshot.json +0 -882
  204. package/drizzle/meta/0009_snapshot.json +0 -948
  205. package/drizzle/meta/0010_snapshot.json +0 -969
  206. package/drizzle/meta/0011_snapshot.json +0 -1049
  207. package/drizzle/meta/0012_snapshot.json +0 -1115
  208. package/drizzle/meta/0013_snapshot.json +0 -1121
  209. package/drizzle/meta/0014_snapshot.json +0 -1190
  210. package/drizzle/meta/0015_snapshot.json +0 -1280
  211. package/drizzle/meta/0016_snapshot.json +0 -1683
  212. package/drizzle/meta/0017_snapshot.json +0 -1834
  213. package/drizzle/meta/0018_snapshot.json +0 -1834
  214. package/drizzle/meta/0019_snapshot.json +0 -1909
  215. package/drizzle/meta/0020_snapshot.json +0 -1921
  216. package/drizzle/meta/0021_snapshot.json +0 -2045
  217. package/drizzle/meta/0022_snapshot.json +0 -2246
  218. package/drizzle/meta/0023_snapshot.json +0 -2252
  219. package/drizzle/meta/0024_snapshot.json +0 -2375
  220. package/drizzle/meta/0025_snapshot.json +0 -2407
  221. package/drizzle/meta/0026_snapshot.json +0 -2413
  222. package/drizzle/meta/0027_snapshot.json +0 -2425
  223. package/drizzle/meta/0028_snapshot.json +0 -2438
  224. package/drizzle/meta/0029_snapshot.json +0 -2546
  225. package/drizzle/meta/0030_snapshot.json +0 -2586
  226. package/drizzle/meta/0031_snapshot.json +0 -2598
  227. package/drizzle/meta/0032_snapshot.json +0 -2699
  228. package/drizzle/meta/0033_snapshot.json +0 -2712
  229. package/drizzle/meta/0034_snapshot.json +0 -2719
  230. package/drizzle/meta/0035_snapshot.json +0 -2726
  231. package/drizzle/meta/0036_snapshot.json +0 -2876
  232. package/drizzle/meta/0037_snapshot.json +0 -2883
  233. package/drizzle/meta/0038_snapshot.json +0 -2895
  234. package/drizzle/meta/0039_snapshot.json +0 -3501
  235. package/drizzle/meta/0040_snapshot.json +0 -3527
  236. package/drizzle/meta/0041_snapshot.json +0 -3824
  237. package/drizzle/meta/0042_snapshot.json +0 -3960
  238. package/drizzle/meta/_journal.json +0 -307
  239. package/src/data/seed.json +0 -253
@@ -0,0 +1,455 @@
1
+ import { createRequire as __lurqCreateRequire } from 'node:module'; const require = __lurqCreateRequire(import.meta.url);
2
+ import {
3
+ readManifest,
4
+ resolveEntryCandidates,
5
+ resolveInternal,
6
+ resolvesInsidePackage
7
+ } from "./chunk-ELGCAM7P.js";
8
+ import {
9
+ init_esm_shims
10
+ } from "./chunk-I3M2KJXB.js";
11
+
12
+ // src/surface/extract.ts
13
+ init_esm_shims();
14
+ import { readFileSync } from "fs";
15
+ import { relative } from "path";
16
+ import ts from "typescript";
17
+ var TIER = "shipped_js_ast";
18
+ var MAX_FILES = 400;
19
+ function classify(node) {
20
+ if (ts.isFunctionExpression(node) || ts.isArrowFunction(node) || ts.isFunctionDeclaration(node)) {
21
+ return { kind: "function", arity: arityOf(node), maxArity: maxArityOf(node) };
22
+ }
23
+ if (ts.isClassExpression(node) || ts.isClassDeclaration(node))
24
+ return { kind: "class", arity: null };
25
+ if (ts.isObjectLiteralExpression(node)) return { kind: "object", arity: null };
26
+ if (ts.isStringLiteral(node) || ts.isNumericLiteral(node) || node.kind === ts.SyntaxKind.TrueKeyword || node.kind === ts.SyntaxKind.FalseKeyword || node.kind === ts.SyntaxKind.NullKeyword) {
27
+ return { kind: "primitive", arity: null };
28
+ }
29
+ return { kind: "object", arity: null };
30
+ }
31
+ function arityOf(fn) {
32
+ let n = 0;
33
+ for (const p of fn.parameters) {
34
+ if (p.initializer || p.dotDotDotToken) break;
35
+ n++;
36
+ }
37
+ return n;
38
+ }
39
+ function maxArityOf(fn) {
40
+ if (fn.parameters.some((p) => p.dotDotDotToken)) return null;
41
+ let readsArguments = false;
42
+ const visit = (n) => {
43
+ if (readsArguments) return;
44
+ if (ts.isIdentifier(n) && n.text === "arguments") readsArguments = true;
45
+ else if (!(ts.isFunctionLike(n) && !ts.isArrowFunction(n))) ts.forEachChild(n, visit);
46
+ };
47
+ if (fn.body) visit(fn.body);
48
+ return readsArguments ? null : fn.parameters.length;
49
+ }
50
+ function lineOf(sf, node) {
51
+ return sf.getLineAndCharacterOfPosition(node.getStart(sf)).line + 1;
52
+ }
53
+ function put(out, sym) {
54
+ if (!out.has(sym.path)) out.set(sym.path, sym);
55
+ }
56
+ function localBinding(sf, name) {
57
+ let found = null;
58
+ for (const stmt of sf.statements) {
59
+ if (ts.isVariableStatement(stmt)) {
60
+ for (const d of stmt.declarationList.declarations) {
61
+ if (ts.isIdentifier(d.name) && d.name.text === name && d.initializer) found = d.initializer;
62
+ }
63
+ } else if (ts.isFunctionDeclaration(stmt) && stmt.name?.text === name) {
64
+ found = stmt;
65
+ } else if (ts.isClassDeclaration(stmt) && stmt.name?.text === name) {
66
+ found = stmt;
67
+ }
68
+ }
69
+ return found;
70
+ }
71
+ function isModuleExports(e) {
72
+ return ts.isPropertyAccessExpression(e) && ts.isIdentifier(e.expression) && e.expression.text === "module" && e.name.text === "exports";
73
+ }
74
+ function exportTargetName(e) {
75
+ if (!ts.isPropertyAccessExpression(e)) return null;
76
+ if (ts.isIdentifier(e.expression) && e.expression.text === "exports") return e.name.text;
77
+ if (isModuleExports(e.expression)) return e.name.text;
78
+ return null;
79
+ }
80
+ function hasDeprecatedTag(sf, node) {
81
+ const full = node.getFullText(sf);
82
+ const lead = full.slice(0, full.length - node.getText(sf).length);
83
+ return /@deprecated/i.test(lead);
84
+ }
85
+ function flattenStatements(stmts, depth = 0) {
86
+ if (depth > 6) return [...stmts];
87
+ const out = [];
88
+ for (const s of stmts) {
89
+ out.push(s);
90
+ if (ts.isBlock(s)) out.push(...flattenStatements(s.statements, depth + 1));
91
+ else if (ts.isIfStatement(s)) {
92
+ const branches = [s.thenStatement, s.elseStatement].filter(Boolean);
93
+ for (const b of branches) {
94
+ out.push(...flattenStatements(ts.isBlock(b) ? b.statements : [b], depth + 1));
95
+ }
96
+ } else if (ts.isTryStatement(s)) {
97
+ out.push(...flattenStatements(s.tryBlock.statements, depth + 1));
98
+ if (s.catchClause) out.push(...flattenStatements(s.catchClause.block.statements, depth + 1));
99
+ if (s.finallyBlock) out.push(...flattenStatements(s.finallyBlock.statements, depth + 1));
100
+ } else if (ts.isSwitchStatement(s)) {
101
+ for (const c of s.caseBlock.clauses) {
102
+ out.push(...flattenStatements(c.statements, depth + 1));
103
+ }
104
+ }
105
+ }
106
+ return out;
107
+ }
108
+ function walk(file, ctx, out) {
109
+ if (ctx.visited.has(file)) return;
110
+ if (ctx.filesWalked >= MAX_FILES) {
111
+ ctx.truncated = true;
112
+ return;
113
+ }
114
+ ctx.visited.add(file);
115
+ ctx.filesWalked++;
116
+ let text;
117
+ try {
118
+ text = readFileSync(file, "utf8");
119
+ } catch {
120
+ return;
121
+ }
122
+ const sf = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true, ts.ScriptKind.JS);
123
+ const rel = relative(ctx.pkgDir, file);
124
+ const add = (path, node, over = {}) => {
125
+ const { kind, arity, maxArity } = classify(node);
126
+ put(out, {
127
+ path,
128
+ kind,
129
+ arity,
130
+ ...maxArity !== void 0 ? { maxArity } : {},
131
+ origin: "local",
132
+ deprecated: hasDeprecatedTag(sf, node),
133
+ tier: TIER,
134
+ sourceRef: { file: rel, line: lineOf(sf, node), offset: node.getStart(sf) },
135
+ ...over
136
+ });
137
+ };
138
+ const reExport = (spec, names, picks) => {
139
+ if (resolvesInsidePackage(spec)) {
140
+ const target = resolveInternal(file, spec, ctx.pkgDir);
141
+ if (!target) return;
142
+ if (!picks) {
143
+ walk(target, ctx, out);
144
+ return;
145
+ }
146
+ const sub = /* @__PURE__ */ new Map();
147
+ walk(target, { ...ctx, visited: new Set(ctx.visited) }, sub);
148
+ for (const pick of picks) {
149
+ const found = sub.get(pick.from);
150
+ if (found) put(out, { ...found, path: pick.as });
151
+ else
152
+ put(out, {
153
+ path: pick.as,
154
+ kind: "object",
155
+ arity: null,
156
+ origin: "local",
157
+ deprecated: false,
158
+ tier: TIER,
159
+ sourceRef: { file: rel, line: 1 }
160
+ });
161
+ }
162
+ return;
163
+ }
164
+ ctx.external.add(spec);
165
+ for (const n of names ?? []) {
166
+ put(out, {
167
+ path: n,
168
+ kind: "object",
169
+ arity: null,
170
+ origin: `external:${spec}`,
171
+ deprecated: false,
172
+ tier: TIER,
173
+ sourceRef: { file: rel, line: 1 }
174
+ });
175
+ }
176
+ };
177
+ for (const stmt of flattenStatements(sf.statements)) {
178
+ if (ts.isExportDeclaration(stmt)) {
179
+ const spec = stmt.moduleSpecifier && ts.isStringLiteral(stmt.moduleSpecifier) ? stmt.moduleSpecifier.text : null;
180
+ const isTypeOnly = stmt.isTypeOnly;
181
+ if (stmt.exportClause && ts.isNamedExports(stmt.exportClause)) {
182
+ const names = stmt.exportClause.elements.map((el) => el.name.text);
183
+ if (spec) {
184
+ reExport(
185
+ spec,
186
+ names,
187
+ stmt.exportClause.elements.map((el) => ({
188
+ from: el.propertyName?.text ?? el.name.text,
189
+ as: el.name.text
190
+ }))
191
+ );
192
+ } else {
193
+ for (const el of stmt.exportClause.elements) {
194
+ const local = el.propertyName?.text ?? el.name.text;
195
+ const decl = localBinding(sf, local);
196
+ if (isTypeOnly || el.isTypeOnly) {
197
+ put(out, {
198
+ path: el.name.text,
199
+ kind: "type_only",
200
+ arity: null,
201
+ origin: "local",
202
+ deprecated: false,
203
+ tier: TIER,
204
+ sourceRef: { file: rel, line: lineOf(sf, el) }
205
+ });
206
+ } else if (decl) {
207
+ add(el.name.text, decl);
208
+ } else {
209
+ add(el.name.text, el);
210
+ }
211
+ }
212
+ }
213
+ } else if (spec) {
214
+ reExport(spec, null);
215
+ }
216
+ continue;
217
+ }
218
+ const mods = ts.canHaveModifiers(stmt) ? ts.getModifiers(stmt) : void 0;
219
+ const exported = mods?.some((m) => m.kind === ts.SyntaxKind.ExportKeyword);
220
+ if (exported) {
221
+ if (ts.isVariableStatement(stmt)) {
222
+ for (const d of stmt.declarationList.declarations) {
223
+ if (ts.isIdentifier(d.name)) add(d.name.text, d.initializer ?? d);
224
+ }
225
+ } else if (ts.isFunctionDeclaration(stmt) && stmt.name) {
226
+ add(stmt.name.text, stmt);
227
+ } else if (ts.isClassDeclaration(stmt) && stmt.name) {
228
+ add(stmt.name.text, stmt);
229
+ } else if (ts.isInterfaceDeclaration(stmt) || ts.isTypeAliasDeclaration(stmt)) {
230
+ put(out, {
231
+ path: stmt.name.text,
232
+ kind: "type_only",
233
+ arity: null,
234
+ origin: "local",
235
+ deprecated: false,
236
+ tier: TIER,
237
+ sourceRef: { file: rel, line: lineOf(sf, stmt) }
238
+ });
239
+ }
240
+ continue;
241
+ }
242
+ if (ts.isExportAssignment(stmt)) {
243
+ const target = ts.isIdentifier(stmt.expression) ? localBinding(sf, stmt.expression.text) ?? stmt.expression : stmt.expression;
244
+ add("default", target);
245
+ continue;
246
+ }
247
+ if (ts.isExpressionStatement(stmt)) {
248
+ const e = stmt.expression;
249
+ if (ts.isCallExpression(e) && ts.isPropertyAccessExpression(e.expression) && ts.isIdentifier(e.expression.expression) && e.expression.expression.text === "Object" && e.expression.name.text === "defineProperty" && e.arguments.length >= 2) {
250
+ const targetArg = e.arguments[0];
251
+ const isExportsTarget = ts.isIdentifier(targetArg) && targetArg.text === "exports" || isModuleExports(targetArg);
252
+ const nameArg = e.arguments[1];
253
+ if (isExportsTarget && ts.isStringLiteral(nameArg) && nameArg.text !== "__esModule") {
254
+ put(out, {
255
+ path: nameArg.text,
256
+ kind: "object",
257
+ arity: null,
258
+ origin: "local",
259
+ deprecated: hasDeprecatedTag(sf, stmt),
260
+ tier: TIER,
261
+ sourceRef: { file: rel, line: lineOf(sf, stmt) }
262
+ });
263
+ continue;
264
+ }
265
+ }
266
+ if (ts.isCallExpression(e)) {
267
+ const callee = e.expression;
268
+ const isObjectAssign = ts.isPropertyAccessExpression(callee) && ts.isIdentifier(callee.expression) && callee.expression.text === "Object" && callee.name.text === "assign" && e.arguments.length > 0 && isModuleExports(e.arguments[0]);
269
+ const isExportStar = ts.isIdentifier(callee) && /^_{0,2}(exportStar|reExport|export)$/i.test(callee.text);
270
+ if (isObjectAssign || isExportStar) {
271
+ for (const arg of e.arguments.slice(isObjectAssign ? 1 : 0)) {
272
+ const spec = requireSpecifier(arg);
273
+ if (spec) reExport(spec, null);
274
+ else if (ts.isObjectLiteralExpression(arg)) {
275
+ for (const p of arg.properties) {
276
+ if (p.name && ts.isIdentifier(p.name)) {
277
+ const value = ts.isPropertyAssignment(p) ? p.initializer : p;
278
+ add(p.name.text, isExportStar ? throughGetter(sf, value) : value);
279
+ }
280
+ }
281
+ } else if (ts.isIdentifier(arg)) {
282
+ const b = localBinding(sf, arg.text);
283
+ if (b && ts.isObjectLiteralExpression(b)) {
284
+ for (const p of b.properties) {
285
+ if (p.name && ts.isIdentifier(p.name)) {
286
+ add(p.name.text, ts.isPropertyAssignment(p) ? p.initializer : p);
287
+ }
288
+ }
289
+ }
290
+ }
291
+ }
292
+ continue;
293
+ }
294
+ }
295
+ if (!ts.isBinaryExpression(e) || e.operatorToken.kind !== ts.SyntaxKind.EqualsToken) continue;
296
+ const lhs = e.left;
297
+ const rhs = e.right;
298
+ if (isModuleExports(lhs)) {
299
+ const spec = requireSpecifier(rhs);
300
+ if (spec) {
301
+ reExport(spec, null);
302
+ continue;
303
+ }
304
+ if (ts.isObjectLiteralExpression(rhs)) {
305
+ for (const p of rhs.properties) {
306
+ if (p.name && ts.isIdentifier(p.name)) {
307
+ add(p.name.text, ts.isPropertyAssignment(p) ? p.initializer : p);
308
+ }
309
+ }
310
+ continue;
311
+ }
312
+ if (ts.isIdentifier(rhs)) {
313
+ const b = localBinding(sf, rhs.text);
314
+ if (b && ts.isObjectLiteralExpression(b)) {
315
+ for (const p of b.properties) {
316
+ if (p.name && ts.isIdentifier(p.name)) {
317
+ add(p.name.text, ts.isPropertyAssignment(p) ? p.initializer : p);
318
+ }
319
+ }
320
+ continue;
321
+ }
322
+ if (b) {
323
+ add("default", b);
324
+ continue;
325
+ }
326
+ }
327
+ add("default", rhs);
328
+ continue;
329
+ }
330
+ const name = exportTargetName(lhs);
331
+ if (name) {
332
+ const spec = requireSpecifier(rhs);
333
+ if (spec && !resolvesInsidePackage(spec)) {
334
+ ctx.external.add(spec);
335
+ put(out, {
336
+ path: name,
337
+ kind: "object",
338
+ arity: null,
339
+ origin: `external:${spec}`,
340
+ deprecated: false,
341
+ tier: TIER,
342
+ sourceRef: { file: rel, line: lineOf(sf, stmt) }
343
+ });
344
+ continue;
345
+ }
346
+ const target = ts.isIdentifier(rhs) ? localBinding(sf, rhs.text) ?? rhs : rhs;
347
+ add(name, target, { deprecated: hasDeprecatedTag(sf, stmt) });
348
+ }
349
+ }
350
+ }
351
+ }
352
+ function throughGetter(sf, value) {
353
+ if (!(ts.isArrowFunction(value) || ts.isFunctionExpression(value)) || value.parameters.length)
354
+ return value;
355
+ let returned;
356
+ if (!ts.isBlock(value.body)) returned = value.body;
357
+ else if (value.body.statements.length === 1 && ts.isReturnStatement(value.body.statements[0])) {
358
+ returned = value.body.statements[0].expression;
359
+ }
360
+ if (!returned) return value;
361
+ return ts.isIdentifier(returned) ? localBinding(sf, returned.text) ?? returned : returned;
362
+ }
363
+ function requireSpecifier(node) {
364
+ let n = node;
365
+ if (ts.isPropertyAccessExpression(n)) n = n.expression;
366
+ if (ts.isCallExpression(n) && ts.isIdentifier(n.expression) && n.expression.text === "require" && n.arguments.length === 1 && ts.isStringLiteral(n.arguments[0])) {
367
+ return n.arguments[0].text;
368
+ }
369
+ return null;
370
+ }
371
+ function isReadable(symbols) {
372
+ if (symbols.length === 0) return false;
373
+ return !(symbols.length === 1 && symbols[0].path === "default");
374
+ }
375
+ function extractSurface(pkgDir, opts = {}) {
376
+ const manifest = opts.manifest ?? readManifest(pkgDir);
377
+ const candidates = resolveEntryCandidates(pkgDir, manifest, opts.subpath);
378
+ const base = {
379
+ package: manifest?.name ?? pkgDir,
380
+ version: manifest?.version ?? null,
381
+ tier: TIER,
382
+ entry: null,
383
+ symbols: [],
384
+ filesWalked: 0,
385
+ externalReExports: []
386
+ };
387
+ if (!candidates.length) {
388
+ return {
389
+ ...base,
390
+ undeclaredReason: opts.subpath ? `no resolvable JS entry point for subpath ./${opts.subpath}` : "no resolvable JS entry point"
391
+ };
392
+ }
393
+ const attempts = [];
394
+ for (const entry of candidates) {
395
+ const ctx = {
396
+ pkgDir,
397
+ visited: /* @__PURE__ */ new Set(),
398
+ filesWalked: 0,
399
+ external: /* @__PURE__ */ new Set(),
400
+ truncated: false
401
+ };
402
+ const out = /* @__PURE__ */ new Map();
403
+ walk(entry, ctx, out);
404
+ attempts.push({
405
+ entry,
406
+ symbols: [...out.values()].sort((a, b) => a.path.localeCompare(b.path)),
407
+ walked: ctx.filesWalked,
408
+ external: [...ctx.external].sort()
409
+ });
410
+ if (isReadable(attempts[attempts.length - 1].symbols)) break;
411
+ }
412
+ const attempt = attempts.find((a) => isReadable(a.symbols)) ?? attempts[0];
413
+ return {
414
+ ...base,
415
+ entry: relative(pkgDir, attempt.entry),
416
+ symbols: attempt.symbols,
417
+ filesWalked: attempt.walked,
418
+ externalReExports: attempt.external,
419
+ ...attempt.symbols.length === 0 ? { undeclaredReason: "entry resolved but no exports found" } : {}
420
+ };
421
+ }
422
+ function usesTopLevelAwait(pkgDir, entry) {
423
+ const seen = /* @__PURE__ */ new Set();
424
+ const queue = [entry];
425
+ while (queue.length && seen.size < MAX_FILES) {
426
+ const file = queue.pop();
427
+ if (seen.has(file)) continue;
428
+ seen.add(file);
429
+ let text;
430
+ try {
431
+ text = readFileSync(file, "utf8");
432
+ } catch {
433
+ continue;
434
+ }
435
+ const sf = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, false, ts.ScriptKind.JS);
436
+ for (const stmt of sf.statements) {
437
+ if (awaitsAtTopLevel(stmt)) return true;
438
+ const spec = ts.isImportDeclaration(stmt) || ts.isExportDeclaration(stmt) ? stmt.moduleSpecifier : void 0;
439
+ if (spec && ts.isStringLiteral(spec) && resolvesInsidePackage(spec.text)) {
440
+ const next = resolveInternal(file, spec.text, pkgDir);
441
+ if (next) queue.push(next);
442
+ }
443
+ }
444
+ }
445
+ return false;
446
+ }
447
+ function awaitsAtTopLevel(node) {
448
+ if (ts.isFunctionLike(node) || ts.isClassLike(node)) return false;
449
+ if (ts.isAwaitExpression(node) || ts.isForOfStatement(node) && node.awaitModifier) return true;
450
+ return ts.forEachChild(node, awaitsAtTopLevel) ?? false;
451
+ }
452
+ export {
453
+ extractSurface,
454
+ usesTopLevelAwait
455
+ };
@@ -0,0 +1,22 @@
1
+ import { createRequire as __lurqCreateRequire } from 'node:module'; const require = __lurqCreateRequire(import.meta.url);
2
+ import {
3
+ extractUnpacked,
4
+ fetchAndExtract,
5
+ fetchManifest,
6
+ resolveTarball,
7
+ unpackPackage,
8
+ verifyIntegrity
9
+ } from "./chunk-FVYFV5HA.js";
10
+ import "./chunk-D3VTZS7V.js";
11
+ import "./chunk-KYKSZ3XZ.js";
12
+ import "./chunk-MYGSLK44.js";
13
+ import "./chunk-72Y2FDVS.js";
14
+ import "./chunk-I3M2KJXB.js";
15
+ export {
16
+ extractUnpacked,
17
+ fetchAndExtract,
18
+ fetchManifest,
19
+ resolveTarball,
20
+ unpackPackage,
21
+ verifyIntegrity
22
+ };
@@ -0,0 +1,55 @@
1
+ import { createRequire as __lurqCreateRequire } from 'node:module'; const require = __lurqCreateRequire(import.meta.url);
2
+ import {
3
+ withBudget
4
+ } from "./chunk-4ESO33J6.js";
5
+ import {
6
+ logger
7
+ } from "./chunk-MYGSLK44.js";
8
+ import {
9
+ init_esm_shims
10
+ } from "./chunk-I3M2KJXB.js";
11
+
12
+ // src/pipeline/firstTouch.ts
13
+ init_esm_shims();
14
+ var SURFACE_FIRST_TOUCH_BUDGET_MS = 4e3;
15
+ var MAX_INFLIGHT = 64;
16
+ var inFlight = /* @__PURE__ */ new Map();
17
+ function extractOnce(db, pkg, version) {
18
+ const key = `${pkg}@${version ?? "latest"}`;
19
+ const existing = inFlight.get(key);
20
+ if (existing) return existing;
21
+ if (inFlight.size >= MAX_INFLIGHT) return Promise.resolve(null);
22
+ const task = (async () => {
23
+ const { extractAndStore } = await import("./surface-7MHE3RL7.js");
24
+ const { outcome, version: resolved } = await extractAndStore(db, pkg, version);
25
+ return outcome === "stored" || outcome === "cached" ? resolved : null;
26
+ })().catch((err) => {
27
+ logger.warn(
28
+ `surface first-touch failed for ${key}: ${err instanceof Error ? err.message : String(err)}`
29
+ );
30
+ return null;
31
+ }).finally(() => {
32
+ inFlight.delete(key);
33
+ });
34
+ inFlight.set(key, task);
35
+ return task;
36
+ }
37
+ function firstTouchSurface(db, pkg, version, budgetMs = SURFACE_FIRST_TOUCH_BUDGET_MS) {
38
+ const task = extractOnce(db, pkg, version);
39
+ return budgetMs <= 0 ? Promise.resolve(null) : withBudget(task, budgetMs).then((v) => v ?? null);
40
+ }
41
+ async function firstTouchPair(db, pkg, fromVersion, toVersion, budgetMs = SURFACE_FIRST_TOUCH_BUDGET_MS) {
42
+ if (budgetMs <= 0) return false;
43
+ const pair = Promise.all([extractOnce(db, pkg, fromVersion), extractOnce(db, pkg, toVersion)]);
44
+ const settled = await withBudget(pair, budgetMs);
45
+ return Boolean(settled && settled[0] && settled[1]);
46
+ }
47
+ function resetSurfaceFirstTouch() {
48
+ inFlight.clear();
49
+ }
50
+ export {
51
+ SURFACE_FIRST_TOUCH_BUDGET_MS,
52
+ firstTouchPair,
53
+ firstTouchSurface,
54
+ resetSurfaceFirstTouch
55
+ };