@colbymchenry/codegraph-darwin-arm64 0.9.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 (569) hide show
  1. package/bin/codegraph +3 -0
  2. package/lib/dist/bin/codegraph.d.ts +21 -0
  3. package/lib/dist/bin/codegraph.d.ts.map +1 -0
  4. package/lib/dist/bin/codegraph.js +1273 -0
  5. package/lib/dist/bin/codegraph.js.map +1 -0
  6. package/lib/dist/bin/node-version-check.d.ts +37 -0
  7. package/lib/dist/bin/node-version-check.d.ts.map +1 -0
  8. package/lib/dist/bin/node-version-check.js +79 -0
  9. package/lib/dist/bin/node-version-check.js.map +1 -0
  10. package/lib/dist/bin/uninstall.d.ts +14 -0
  11. package/lib/dist/bin/uninstall.d.ts.map +1 -0
  12. package/lib/dist/bin/uninstall.js +36 -0
  13. package/lib/dist/bin/uninstall.js.map +1 -0
  14. package/lib/dist/config.d.ts +51 -0
  15. package/lib/dist/config.d.ts.map +1 -0
  16. package/lib/dist/config.js +321 -0
  17. package/lib/dist/config.js.map +1 -0
  18. package/lib/dist/context/formatter.d.ts +30 -0
  19. package/lib/dist/context/formatter.d.ts.map +1 -0
  20. package/lib/dist/context/formatter.js +244 -0
  21. package/lib/dist/context/formatter.js.map +1 -0
  22. package/lib/dist/context/index.d.ts +97 -0
  23. package/lib/dist/context/index.d.ts.map +1 -0
  24. package/lib/dist/context/index.js +1050 -0
  25. package/lib/dist/context/index.js.map +1 -0
  26. package/lib/dist/db/index.d.ts +83 -0
  27. package/lib/dist/db/index.d.ts.map +1 -0
  28. package/lib/dist/db/index.js +219 -0
  29. package/lib/dist/db/index.js.map +1 -0
  30. package/lib/dist/db/migrations.d.ts +44 -0
  31. package/lib/dist/db/migrations.d.ts.map +1 -0
  32. package/lib/dist/db/migrations.js +131 -0
  33. package/lib/dist/db/migrations.js.map +1 -0
  34. package/lib/dist/db/queries.d.ts +253 -0
  35. package/lib/dist/db/queries.d.ts.map +1 -0
  36. package/lib/dist/db/queries.js +1207 -0
  37. package/lib/dist/db/queries.js.map +1 -0
  38. package/lib/dist/db/schema.sql +151 -0
  39. package/lib/dist/db/sqlite-adapter.d.ts +46 -0
  40. package/lib/dist/db/sqlite-adapter.d.ts.map +1 -0
  41. package/lib/dist/db/sqlite-adapter.js +114 -0
  42. package/lib/dist/db/sqlite-adapter.js.map +1 -0
  43. package/lib/dist/directory.d.ts +57 -0
  44. package/lib/dist/directory.d.ts.map +1 -0
  45. package/lib/dist/directory.js +264 -0
  46. package/lib/dist/directory.js.map +1 -0
  47. package/lib/dist/errors.d.ts +136 -0
  48. package/lib/dist/errors.d.ts.map +1 -0
  49. package/lib/dist/errors.js +219 -0
  50. package/lib/dist/errors.js.map +1 -0
  51. package/lib/dist/extraction/dfm-extractor.d.ts +31 -0
  52. package/lib/dist/extraction/dfm-extractor.d.ts.map +1 -0
  53. package/lib/dist/extraction/dfm-extractor.js +151 -0
  54. package/lib/dist/extraction/dfm-extractor.js.map +1 -0
  55. package/lib/dist/extraction/grammars.d.ts +78 -0
  56. package/lib/dist/extraction/grammars.d.ts.map +1 -0
  57. package/lib/dist/extraction/grammars.js +332 -0
  58. package/lib/dist/extraction/grammars.js.map +1 -0
  59. package/lib/dist/extraction/index.d.ts +130 -0
  60. package/lib/dist/extraction/index.d.ts.map +1 -0
  61. package/lib/dist/extraction/index.js +1305 -0
  62. package/lib/dist/extraction/index.js.map +1 -0
  63. package/lib/dist/extraction/languages/c-cpp.d.ts +4 -0
  64. package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -0
  65. package/lib/dist/extraction/languages/c-cpp.js +126 -0
  66. package/lib/dist/extraction/languages/c-cpp.js.map +1 -0
  67. package/lib/dist/extraction/languages/csharp.d.ts +3 -0
  68. package/lib/dist/extraction/languages/csharp.d.ts.map +1 -0
  69. package/lib/dist/extraction/languages/csharp.js +72 -0
  70. package/lib/dist/extraction/languages/csharp.js.map +1 -0
  71. package/lib/dist/extraction/languages/dart.d.ts +3 -0
  72. package/lib/dist/extraction/languages/dart.d.ts.map +1 -0
  73. package/lib/dist/extraction/languages/dart.js +192 -0
  74. package/lib/dist/extraction/languages/dart.js.map +1 -0
  75. package/lib/dist/extraction/languages/go.d.ts +3 -0
  76. package/lib/dist/extraction/languages/go.d.ts.map +1 -0
  77. package/lib/dist/extraction/languages/go.js +58 -0
  78. package/lib/dist/extraction/languages/go.js.map +1 -0
  79. package/lib/dist/extraction/languages/index.d.ts +10 -0
  80. package/lib/dist/extraction/languages/index.d.ts.map +1 -0
  81. package/lib/dist/extraction/languages/index.js +49 -0
  82. package/lib/dist/extraction/languages/index.js.map +1 -0
  83. package/lib/dist/extraction/languages/java.d.ts +3 -0
  84. package/lib/dist/extraction/languages/java.d.ts.map +1 -0
  85. package/lib/dist/extraction/languages/java.js +64 -0
  86. package/lib/dist/extraction/languages/java.js.map +1 -0
  87. package/lib/dist/extraction/languages/javascript.d.ts +3 -0
  88. package/lib/dist/extraction/languages/javascript.d.ts.map +1 -0
  89. package/lib/dist/extraction/languages/javascript.js +90 -0
  90. package/lib/dist/extraction/languages/javascript.js.map +1 -0
  91. package/lib/dist/extraction/languages/kotlin.d.ts +3 -0
  92. package/lib/dist/extraction/languages/kotlin.d.ts.map +1 -0
  93. package/lib/dist/extraction/languages/kotlin.js +253 -0
  94. package/lib/dist/extraction/languages/kotlin.js.map +1 -0
  95. package/lib/dist/extraction/languages/lua.d.ts +3 -0
  96. package/lib/dist/extraction/languages/lua.d.ts.map +1 -0
  97. package/lib/dist/extraction/languages/lua.js +150 -0
  98. package/lib/dist/extraction/languages/lua.js.map +1 -0
  99. package/lib/dist/extraction/languages/luau.d.ts +3 -0
  100. package/lib/dist/extraction/languages/luau.d.ts.map +1 -0
  101. package/lib/dist/extraction/languages/luau.js +37 -0
  102. package/lib/dist/extraction/languages/luau.js.map +1 -0
  103. package/lib/dist/extraction/languages/pascal.d.ts +3 -0
  104. package/lib/dist/extraction/languages/pascal.d.ts.map +1 -0
  105. package/lib/dist/extraction/languages/pascal.js +66 -0
  106. package/lib/dist/extraction/languages/pascal.js.map +1 -0
  107. package/lib/dist/extraction/languages/php.d.ts +3 -0
  108. package/lib/dist/extraction/languages/php.d.ts.map +1 -0
  109. package/lib/dist/extraction/languages/php.js +107 -0
  110. package/lib/dist/extraction/languages/php.js.map +1 -0
  111. package/lib/dist/extraction/languages/python.d.ts +3 -0
  112. package/lib/dist/extraction/languages/python.d.ts.map +1 -0
  113. package/lib/dist/extraction/languages/python.js +56 -0
  114. package/lib/dist/extraction/languages/python.js.map +1 -0
  115. package/lib/dist/extraction/languages/ruby.d.ts +3 -0
  116. package/lib/dist/extraction/languages/ruby.d.ts.map +1 -0
  117. package/lib/dist/extraction/languages/ruby.js +114 -0
  118. package/lib/dist/extraction/languages/ruby.js.map +1 -0
  119. package/lib/dist/extraction/languages/rust.d.ts +3 -0
  120. package/lib/dist/extraction/languages/rust.d.ts.map +1 -0
  121. package/lib/dist/extraction/languages/rust.js +109 -0
  122. package/lib/dist/extraction/languages/rust.js.map +1 -0
  123. package/lib/dist/extraction/languages/scala.d.ts +3 -0
  124. package/lib/dist/extraction/languages/scala.d.ts.map +1 -0
  125. package/lib/dist/extraction/languages/scala.js +139 -0
  126. package/lib/dist/extraction/languages/scala.js.map +1 -0
  127. package/lib/dist/extraction/languages/swift.d.ts +3 -0
  128. package/lib/dist/extraction/languages/swift.d.ts.map +1 -0
  129. package/lib/dist/extraction/languages/swift.js +91 -0
  130. package/lib/dist/extraction/languages/swift.js.map +1 -0
  131. package/lib/dist/extraction/languages/typescript.d.ts +3 -0
  132. package/lib/dist/extraction/languages/typescript.d.ts.map +1 -0
  133. package/lib/dist/extraction/languages/typescript.js +129 -0
  134. package/lib/dist/extraction/languages/typescript.js.map +1 -0
  135. package/lib/dist/extraction/liquid-extractor.d.ts +52 -0
  136. package/lib/dist/extraction/liquid-extractor.d.ts.map +1 -0
  137. package/lib/dist/extraction/liquid-extractor.js +313 -0
  138. package/lib/dist/extraction/liquid-extractor.js.map +1 -0
  139. package/lib/dist/extraction/parse-worker.d.ts +8 -0
  140. package/lib/dist/extraction/parse-worker.d.ts.map +1 -0
  141. package/lib/dist/extraction/parse-worker.js +94 -0
  142. package/lib/dist/extraction/parse-worker.js.map +1 -0
  143. package/lib/dist/extraction/svelte-extractor.d.ts +56 -0
  144. package/lib/dist/extraction/svelte-extractor.d.ts.map +1 -0
  145. package/lib/dist/extraction/svelte-extractor.js +272 -0
  146. package/lib/dist/extraction/svelte-extractor.js.map +1 -0
  147. package/lib/dist/extraction/tree-sitter-helpers.d.ts +28 -0
  148. package/lib/dist/extraction/tree-sitter-helpers.d.ts.map +1 -0
  149. package/lib/dist/extraction/tree-sitter-helpers.js +103 -0
  150. package/lib/dist/extraction/tree-sitter-helpers.js.map +1 -0
  151. package/lib/dist/extraction/tree-sitter-types.d.ts +179 -0
  152. package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -0
  153. package/lib/dist/extraction/tree-sitter-types.js +10 -0
  154. package/lib/dist/extraction/tree-sitter-types.js.map +1 -0
  155. package/lib/dist/extraction/tree-sitter.d.ts +233 -0
  156. package/lib/dist/extraction/tree-sitter.d.ts.map +1 -0
  157. package/lib/dist/extraction/tree-sitter.js +2425 -0
  158. package/lib/dist/extraction/tree-sitter.js.map +1 -0
  159. package/lib/dist/extraction/vue-extractor.d.ts +36 -0
  160. package/lib/dist/extraction/vue-extractor.d.ts.map +1 -0
  161. package/lib/dist/extraction/vue-extractor.js +163 -0
  162. package/lib/dist/extraction/vue-extractor.js.map +1 -0
  163. package/lib/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
  164. package/lib/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
  165. package/lib/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
  166. package/lib/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
  167. package/lib/dist/graph/index.d.ts +8 -0
  168. package/lib/dist/graph/index.d.ts.map +1 -0
  169. package/lib/dist/graph/index.js +13 -0
  170. package/lib/dist/graph/index.js.map +1 -0
  171. package/lib/dist/graph/queries.d.ts +106 -0
  172. package/lib/dist/graph/queries.d.ts.map +1 -0
  173. package/lib/dist/graph/queries.js +366 -0
  174. package/lib/dist/graph/queries.js.map +1 -0
  175. package/lib/dist/graph/traversal.d.ts +127 -0
  176. package/lib/dist/graph/traversal.d.ts.map +1 -0
  177. package/lib/dist/graph/traversal.js +493 -0
  178. package/lib/dist/graph/traversal.js.map +1 -0
  179. package/lib/dist/index.d.ts +453 -0
  180. package/lib/dist/index.d.ts.map +1 -0
  181. package/lib/dist/index.js +833 -0
  182. package/lib/dist/index.js.map +1 -0
  183. package/lib/dist/installer/claude-md-template.d.ts +14 -0
  184. package/lib/dist/installer/claude-md-template.d.ts.map +1 -0
  185. package/lib/dist/installer/claude-md-template.js +21 -0
  186. package/lib/dist/installer/claude-md-template.js.map +1 -0
  187. package/lib/dist/installer/config-writer.d.ts +29 -0
  188. package/lib/dist/installer/config-writer.d.ts.map +1 -0
  189. package/lib/dist/installer/config-writer.js +111 -0
  190. package/lib/dist/installer/config-writer.js.map +1 -0
  191. package/lib/dist/installer/index.d.ts +65 -0
  192. package/lib/dist/installer/index.d.ts.map +1 -0
  193. package/lib/dist/installer/index.js +406 -0
  194. package/lib/dist/installer/index.js.map +1 -0
  195. package/lib/dist/installer/instructions-template.d.ts +28 -0
  196. package/lib/dist/installer/instructions-template.d.ts.map +1 -0
  197. package/lib/dist/installer/instructions-template.js +64 -0
  198. package/lib/dist/installer/instructions-template.js.map +1 -0
  199. package/lib/dist/installer/targets/claude.d.ts +47 -0
  200. package/lib/dist/installer/targets/claude.d.ts.map +1 -0
  201. package/lib/dist/installer/targets/claude.js +401 -0
  202. package/lib/dist/installer/targets/claude.js.map +1 -0
  203. package/lib/dist/installer/targets/codex.d.ts +18 -0
  204. package/lib/dist/installer/targets/codex.d.ts.map +1 -0
  205. package/lib/dist/installer/targets/codex.js +185 -0
  206. package/lib/dist/installer/targets/codex.js.map +1 -0
  207. package/lib/dist/installer/targets/cursor.d.ts +35 -0
  208. package/lib/dist/installer/targets/cursor.d.ts.map +1 -0
  209. package/lib/dist/installer/targets/cursor.js +229 -0
  210. package/lib/dist/installer/targets/cursor.js.map +1 -0
  211. package/lib/dist/installer/targets/opencode.d.ts +30 -0
  212. package/lib/dist/installer/targets/opencode.d.ts.map +1 -0
  213. package/lib/dist/installer/targets/opencode.js +235 -0
  214. package/lib/dist/installer/targets/opencode.js.map +1 -0
  215. package/lib/dist/installer/targets/registry.d.ts +35 -0
  216. package/lib/dist/installer/targets/registry.d.ts.map +1 -0
  217. package/lib/dist/installer/targets/registry.js +83 -0
  218. package/lib/dist/installer/targets/registry.js.map +1 -0
  219. package/lib/dist/installer/targets/shared.d.ts +77 -0
  220. package/lib/dist/installer/targets/shared.d.ts.map +1 -0
  221. package/lib/dist/installer/targets/shared.js +246 -0
  222. package/lib/dist/installer/targets/shared.js.map +1 -0
  223. package/lib/dist/installer/targets/toml.d.ts +52 -0
  224. package/lib/dist/installer/targets/toml.d.ts.map +1 -0
  225. package/lib/dist/installer/targets/toml.js +147 -0
  226. package/lib/dist/installer/targets/toml.js.map +1 -0
  227. package/lib/dist/installer/targets/types.d.ts +116 -0
  228. package/lib/dist/installer/targets/types.d.ts.map +1 -0
  229. package/lib/dist/installer/targets/types.js +16 -0
  230. package/lib/dist/installer/targets/types.js.map +1 -0
  231. package/lib/dist/mcp/index.d.ts +94 -0
  232. package/lib/dist/mcp/index.d.ts.map +1 -0
  233. package/lib/dist/mcp/index.js +453 -0
  234. package/lib/dist/mcp/index.js.map +1 -0
  235. package/lib/dist/mcp/server-instructions.d.ts +19 -0
  236. package/lib/dist/mcp/server-instructions.d.ts.map +1 -0
  237. package/lib/dist/mcp/server-instructions.js +71 -0
  238. package/lib/dist/mcp/server-instructions.js.map +1 -0
  239. package/lib/dist/mcp/tools.d.ts +257 -0
  240. package/lib/dist/mcp/tools.d.ts.map +1 -0
  241. package/lib/dist/mcp/tools.js +1646 -0
  242. package/lib/dist/mcp/tools.js.map +1 -0
  243. package/lib/dist/mcp/transport.d.ts +106 -0
  244. package/lib/dist/mcp/transport.d.ts.map +1 -0
  245. package/lib/dist/mcp/transport.js +233 -0
  246. package/lib/dist/mcp/transport.js.map +1 -0
  247. package/lib/dist/resolution/frameworks/cargo-workspace.d.ts +18 -0
  248. package/lib/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -0
  249. package/lib/dist/resolution/frameworks/cargo-workspace.js +225 -0
  250. package/lib/dist/resolution/frameworks/cargo-workspace.js.map +1 -0
  251. package/lib/dist/resolution/frameworks/csharp.d.ts +8 -0
  252. package/lib/dist/resolution/frameworks/csharp.d.ts.map +1 -0
  253. package/lib/dist/resolution/frameworks/csharp.js +213 -0
  254. package/lib/dist/resolution/frameworks/csharp.js.map +1 -0
  255. package/lib/dist/resolution/frameworks/express.d.ts +8 -0
  256. package/lib/dist/resolution/frameworks/express.d.ts.map +1 -0
  257. package/lib/dist/resolution/frameworks/express.js +225 -0
  258. package/lib/dist/resolution/frameworks/express.js.map +1 -0
  259. package/lib/dist/resolution/frameworks/go.d.ts +8 -0
  260. package/lib/dist/resolution/frameworks/go.d.ts.map +1 -0
  261. package/lib/dist/resolution/frameworks/go.js +158 -0
  262. package/lib/dist/resolution/frameworks/go.js.map +1 -0
  263. package/lib/dist/resolution/frameworks/index.d.ts +42 -0
  264. package/lib/dist/resolution/frameworks/index.d.ts.map +1 -0
  265. package/lib/dist/resolution/frameworks/index.js +133 -0
  266. package/lib/dist/resolution/frameworks/index.js.map +1 -0
  267. package/lib/dist/resolution/frameworks/java.d.ts +8 -0
  268. package/lib/dist/resolution/frameworks/java.d.ts.map +1 -0
  269. package/lib/dist/resolution/frameworks/java.js +177 -0
  270. package/lib/dist/resolution/frameworks/java.js.map +1 -0
  271. package/lib/dist/resolution/frameworks/laravel.d.ts +13 -0
  272. package/lib/dist/resolution/frameworks/laravel.d.ts.map +1 -0
  273. package/lib/dist/resolution/frameworks/laravel.js +248 -0
  274. package/lib/dist/resolution/frameworks/laravel.js.map +1 -0
  275. package/lib/dist/resolution/frameworks/nestjs.d.ts +26 -0
  276. package/lib/dist/resolution/frameworks/nestjs.d.ts.map +1 -0
  277. package/lib/dist/resolution/frameworks/nestjs.js +374 -0
  278. package/lib/dist/resolution/frameworks/nestjs.js.map +1 -0
  279. package/lib/dist/resolution/frameworks/python.d.ts +10 -0
  280. package/lib/dist/resolution/frameworks/python.d.ts.map +1 -0
  281. package/lib/dist/resolution/frameworks/python.js +278 -0
  282. package/lib/dist/resolution/frameworks/python.js.map +1 -0
  283. package/lib/dist/resolution/frameworks/react.d.ts +8 -0
  284. package/lib/dist/resolution/frameworks/react.d.ts.map +1 -0
  285. package/lib/dist/resolution/frameworks/react.js +272 -0
  286. package/lib/dist/resolution/frameworks/react.js.map +1 -0
  287. package/lib/dist/resolution/frameworks/ruby.d.ts +8 -0
  288. package/lib/dist/resolution/frameworks/ruby.d.ts.map +1 -0
  289. package/lib/dist/resolution/frameworks/ruby.js +198 -0
  290. package/lib/dist/resolution/frameworks/ruby.js.map +1 -0
  291. package/lib/dist/resolution/frameworks/rust.d.ts +8 -0
  292. package/lib/dist/resolution/frameworks/rust.d.ts.map +1 -0
  293. package/lib/dist/resolution/frameworks/rust.js +207 -0
  294. package/lib/dist/resolution/frameworks/rust.js.map +1 -0
  295. package/lib/dist/resolution/frameworks/svelte.d.ts +9 -0
  296. package/lib/dist/resolution/frameworks/svelte.d.ts.map +1 -0
  297. package/lib/dist/resolution/frameworks/svelte.js +249 -0
  298. package/lib/dist/resolution/frameworks/svelte.js.map +1 -0
  299. package/lib/dist/resolution/frameworks/swift.d.ts +10 -0
  300. package/lib/dist/resolution/frameworks/swift.d.ts.map +1 -0
  301. package/lib/dist/resolution/frameworks/swift.js +376 -0
  302. package/lib/dist/resolution/frameworks/swift.js.map +1 -0
  303. package/lib/dist/resolution/frameworks/vue.d.ts +9 -0
  304. package/lib/dist/resolution/frameworks/vue.d.ts.map +1 -0
  305. package/lib/dist/resolution/frameworks/vue.js +306 -0
  306. package/lib/dist/resolution/frameworks/vue.js.map +1 -0
  307. package/lib/dist/resolution/import-resolver.d.ts +40 -0
  308. package/lib/dist/resolution/import-resolver.d.ts.map +1 -0
  309. package/lib/dist/resolution/import-resolver.js +663 -0
  310. package/lib/dist/resolution/import-resolver.js.map +1 -0
  311. package/lib/dist/resolution/index.d.ts +106 -0
  312. package/lib/dist/resolution/index.d.ts.map +1 -0
  313. package/lib/dist/resolution/index.js +709 -0
  314. package/lib/dist/resolution/index.js.map +1 -0
  315. package/lib/dist/resolution/name-matcher.d.ts +32 -0
  316. package/lib/dist/resolution/name-matcher.d.ts.map +1 -0
  317. package/lib/dist/resolution/name-matcher.js +384 -0
  318. package/lib/dist/resolution/name-matcher.js.map +1 -0
  319. package/lib/dist/resolution/path-aliases.d.ts +68 -0
  320. package/lib/dist/resolution/path-aliases.d.ts.map +1 -0
  321. package/lib/dist/resolution/path-aliases.js +238 -0
  322. package/lib/dist/resolution/path-aliases.js.map +1 -0
  323. package/lib/dist/resolution/strip-comments.d.ts +27 -0
  324. package/lib/dist/resolution/strip-comments.d.ts.map +1 -0
  325. package/lib/dist/resolution/strip-comments.js +441 -0
  326. package/lib/dist/resolution/strip-comments.js.map +1 -0
  327. package/lib/dist/resolution/types.d.ts +172 -0
  328. package/lib/dist/resolution/types.d.ts.map +1 -0
  329. package/lib/dist/resolution/types.js +8 -0
  330. package/lib/dist/resolution/types.js.map +1 -0
  331. package/lib/dist/search/query-parser.d.ts +57 -0
  332. package/lib/dist/search/query-parser.d.ts.map +1 -0
  333. package/lib/dist/search/query-parser.js +177 -0
  334. package/lib/dist/search/query-parser.js.map +1 -0
  335. package/lib/dist/search/query-utils.d.ts +53 -0
  336. package/lib/dist/search/query-utils.d.ts.map +1 -0
  337. package/lib/dist/search/query-utils.js +350 -0
  338. package/lib/dist/search/query-utils.js.map +1 -0
  339. package/lib/dist/sync/git-hooks.d.ts +45 -0
  340. package/lib/dist/sync/git-hooks.d.ts.map +1 -0
  341. package/lib/dist/sync/git-hooks.js +223 -0
  342. package/lib/dist/sync/git-hooks.js.map +1 -0
  343. package/lib/dist/sync/index.d.ts +17 -0
  344. package/lib/dist/sync/index.d.ts.map +1 -0
  345. package/lib/dist/sync/index.js +28 -0
  346. package/lib/dist/sync/index.js.map +1 -0
  347. package/lib/dist/sync/watch-policy.d.ts +48 -0
  348. package/lib/dist/sync/watch-policy.d.ts.map +1 -0
  349. package/lib/dist/sync/watch-policy.js +124 -0
  350. package/lib/dist/sync/watch-policy.js.map +1 -0
  351. package/lib/dist/sync/watcher.d.ts +81 -0
  352. package/lib/dist/sync/watcher.d.ts.map +1 -0
  353. package/lib/dist/sync/watcher.js +194 -0
  354. package/lib/dist/sync/watcher.js.map +1 -0
  355. package/lib/dist/types.d.ts +423 -0
  356. package/lib/dist/types.d.ts.map +1 -0
  357. package/lib/dist/types.js +262 -0
  358. package/lib/dist/types.js.map +1 -0
  359. package/lib/dist/ui/glyphs.d.ts +42 -0
  360. package/lib/dist/ui/glyphs.d.ts.map +1 -0
  361. package/lib/dist/ui/glyphs.js +78 -0
  362. package/lib/dist/ui/glyphs.js.map +1 -0
  363. package/lib/dist/ui/shimmer-progress.d.ts +11 -0
  364. package/lib/dist/ui/shimmer-progress.d.ts.map +1 -0
  365. package/lib/dist/ui/shimmer-progress.js +90 -0
  366. package/lib/dist/ui/shimmer-progress.js.map +1 -0
  367. package/lib/dist/ui/shimmer-worker.d.ts +2 -0
  368. package/lib/dist/ui/shimmer-worker.d.ts.map +1 -0
  369. package/lib/dist/ui/shimmer-worker.js +118 -0
  370. package/lib/dist/ui/shimmer-worker.js.map +1 -0
  371. package/lib/dist/ui/types.d.ts +17 -0
  372. package/lib/dist/ui/types.d.ts.map +1 -0
  373. package/lib/dist/ui/types.js +3 -0
  374. package/lib/dist/ui/types.js.map +1 -0
  375. package/lib/dist/utils.d.ts +205 -0
  376. package/lib/dist/utils.d.ts.map +1 -0
  377. package/lib/dist/utils.js +549 -0
  378. package/lib/dist/utils.js.map +1 -0
  379. package/lib/node_modules/.package-lock.json +116 -0
  380. package/lib/node_modules/@clack/core/CHANGELOG.md +348 -0
  381. package/lib/node_modules/@clack/core/LICENSE +9 -0
  382. package/lib/node_modules/@clack/core/README.md +22 -0
  383. package/lib/node_modules/@clack/core/dist/index.d.mts +363 -0
  384. package/lib/node_modules/@clack/core/dist/index.mjs +17 -0
  385. package/lib/node_modules/@clack/core/dist/index.mjs.map +1 -0
  386. package/lib/node_modules/@clack/core/package.json +63 -0
  387. package/lib/node_modules/@clack/prompts/CHANGELOG.md +591 -0
  388. package/lib/node_modules/@clack/prompts/LICENSE +9 -0
  389. package/lib/node_modules/@clack/prompts/README.md +375 -0
  390. package/lib/node_modules/@clack/prompts/dist/index.d.mts +396 -0
  391. package/lib/node_modules/@clack/prompts/dist/index.mjs +144 -0
  392. package/lib/node_modules/@clack/prompts/dist/index.mjs.map +1 -0
  393. package/lib/node_modules/@clack/prompts/package.json +68 -0
  394. package/lib/node_modules/commander/LICENSE +22 -0
  395. package/lib/node_modules/commander/Readme.md +1176 -0
  396. package/lib/node_modules/commander/esm.mjs +16 -0
  397. package/lib/node_modules/commander/index.js +24 -0
  398. package/lib/node_modules/commander/lib/argument.js +150 -0
  399. package/lib/node_modules/commander/lib/command.js +2777 -0
  400. package/lib/node_modules/commander/lib/error.js +39 -0
  401. package/lib/node_modules/commander/lib/help.js +747 -0
  402. package/lib/node_modules/commander/lib/option.js +380 -0
  403. package/lib/node_modules/commander/lib/suggestSimilar.js +101 -0
  404. package/lib/node_modules/commander/package-support.json +19 -0
  405. package/lib/node_modules/commander/package.json +82 -0
  406. package/lib/node_modules/commander/typings/esm.d.mts +3 -0
  407. package/lib/node_modules/commander/typings/index.d.ts +1113 -0
  408. package/lib/node_modules/fast-string-truncated-width/dist/index.d.ts +4 -0
  409. package/lib/node_modules/fast-string-truncated-width/dist/index.js +111 -0
  410. package/lib/node_modules/fast-string-truncated-width/dist/types.d.ts +19 -0
  411. package/lib/node_modules/fast-string-truncated-width/dist/types.js +2 -0
  412. package/lib/node_modules/fast-string-truncated-width/dist/utils.d.ts +4 -0
  413. package/lib/node_modules/fast-string-truncated-width/dist/utils.js +20 -0
  414. package/lib/node_modules/fast-string-truncated-width/license +21 -0
  415. package/lib/node_modules/fast-string-truncated-width/package.json +35 -0
  416. package/lib/node_modules/fast-string-truncated-width/readme.md +59 -0
  417. package/lib/node_modules/fast-string-width/dist/index.d.ts +4 -0
  418. package/lib/node_modules/fast-string-width/dist/index.js +14 -0
  419. package/lib/node_modules/fast-string-width/license +21 -0
  420. package/lib/node_modules/fast-string-width/package.json +34 -0
  421. package/lib/node_modules/fast-string-width/readme.md +42 -0
  422. package/lib/node_modules/fast-wrap-ansi/LICENSE +23 -0
  423. package/lib/node_modules/fast-wrap-ansi/README.md +26 -0
  424. package/lib/node_modules/fast-wrap-ansi/lib/main.d.ts +6 -0
  425. package/lib/node_modules/fast-wrap-ansi/lib/main.js +219 -0
  426. package/lib/node_modules/fast-wrap-ansi/lib/main.js.map +1 -0
  427. package/lib/node_modules/fast-wrap-ansi/package.json +51 -0
  428. package/lib/node_modules/jsonc-parser/CHANGELOG.md +76 -0
  429. package/lib/node_modules/jsonc-parser/LICENSE.md +21 -0
  430. package/lib/node_modules/jsonc-parser/README.md +364 -0
  431. package/lib/node_modules/jsonc-parser/SECURITY.md +41 -0
  432. package/lib/node_modules/jsonc-parser/lib/esm/impl/edit.js +185 -0
  433. package/lib/node_modules/jsonc-parser/lib/esm/impl/format.js +261 -0
  434. package/lib/node_modules/jsonc-parser/lib/esm/impl/parser.js +659 -0
  435. package/lib/node_modules/jsonc-parser/lib/esm/impl/scanner.js +443 -0
  436. package/lib/node_modules/jsonc-parser/lib/esm/impl/string-intern.js +29 -0
  437. package/lib/node_modules/jsonc-parser/lib/esm/main.d.ts +351 -0
  438. package/lib/node_modules/jsonc-parser/lib/esm/main.js +178 -0
  439. package/lib/node_modules/jsonc-parser/lib/umd/impl/edit.js +201 -0
  440. package/lib/node_modules/jsonc-parser/lib/umd/impl/format.js +275 -0
  441. package/lib/node_modules/jsonc-parser/lib/umd/impl/parser.js +682 -0
  442. package/lib/node_modules/jsonc-parser/lib/umd/impl/scanner.js +456 -0
  443. package/lib/node_modules/jsonc-parser/lib/umd/impl/string-intern.js +42 -0
  444. package/lib/node_modules/jsonc-parser/lib/umd/main.d.ts +351 -0
  445. package/lib/node_modules/jsonc-parser/lib/umd/main.js +194 -0
  446. package/lib/node_modules/jsonc-parser/package.json +37 -0
  447. package/lib/node_modules/picomatch/LICENSE +21 -0
  448. package/lib/node_modules/picomatch/README.md +738 -0
  449. package/lib/node_modules/picomatch/index.js +17 -0
  450. package/lib/node_modules/picomatch/lib/constants.js +180 -0
  451. package/lib/node_modules/picomatch/lib/parse.js +1085 -0
  452. package/lib/node_modules/picomatch/lib/picomatch.js +341 -0
  453. package/lib/node_modules/picomatch/lib/scan.js +391 -0
  454. package/lib/node_modules/picomatch/lib/utils.js +72 -0
  455. package/lib/node_modules/picomatch/package.json +83 -0
  456. package/lib/node_modules/picomatch/posix.js +3 -0
  457. package/lib/node_modules/sisteransi/license +21 -0
  458. package/lib/node_modules/sisteransi/package.json +34 -0
  459. package/lib/node_modules/sisteransi/readme.md +113 -0
  460. package/lib/node_modules/sisteransi/src/index.js +58 -0
  461. package/lib/node_modules/sisteransi/src/sisteransi.d.ts +35 -0
  462. package/lib/node_modules/tree-sitter-wasms/LICENSE +24 -0
  463. package/lib/node_modules/tree-sitter-wasms/README.md +23 -0
  464. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-bash.wasm +0 -0
  465. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-c.wasm +0 -0
  466. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-c_sharp.wasm +0 -0
  467. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-cpp.wasm +0 -0
  468. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-css.wasm +0 -0
  469. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-dart.wasm +0 -0
  470. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-elisp.wasm +0 -0
  471. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-elixir.wasm +0 -0
  472. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-elm.wasm +0 -0
  473. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-embedded_template.wasm +0 -0
  474. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-go.wasm +0 -0
  475. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-html.wasm +0 -0
  476. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-java.wasm +0 -0
  477. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-javascript.wasm +0 -0
  478. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-json.wasm +0 -0
  479. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-kotlin.wasm +0 -0
  480. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-lua.wasm +0 -0
  481. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-objc.wasm +0 -0
  482. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-ocaml.wasm +0 -0
  483. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-php.wasm +0 -0
  484. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-python.wasm +0 -0
  485. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-ql.wasm +0 -0
  486. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-rescript.wasm +0 -0
  487. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-ruby.wasm +0 -0
  488. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-rust.wasm +0 -0
  489. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-scala.wasm +0 -0
  490. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-solidity.wasm +0 -0
  491. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-swift.wasm +0 -0
  492. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-systemrdl.wasm +0 -0
  493. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-tlaplus.wasm +0 -0
  494. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-toml.wasm +0 -0
  495. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-tsx.wasm +0 -0
  496. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-typescript.wasm +0 -0
  497. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-vue.wasm +0 -0
  498. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-yaml.wasm +0 -0
  499. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-zig.wasm +0 -0
  500. package/lib/node_modules/tree-sitter-wasms/package.json +64 -0
  501. package/lib/node_modules/web-tree-sitter/LICENSE +21 -0
  502. package/lib/node_modules/web-tree-sitter/README.md +269 -0
  503. package/lib/node_modules/web-tree-sitter/debug/tree-sitter.cjs +4558 -0
  504. package/lib/node_modules/web-tree-sitter/debug/tree-sitter.cjs.map +7 -0
  505. package/lib/node_modules/web-tree-sitter/debug/tree-sitter.js +4516 -0
  506. package/lib/node_modules/web-tree-sitter/debug/tree-sitter.js.map +7 -0
  507. package/lib/node_modules/web-tree-sitter/debug/tree-sitter.wasm +0 -0
  508. package/lib/node_modules/web-tree-sitter/debug/tree-sitter.wasm.map +31 -0
  509. package/lib/node_modules/web-tree-sitter/lib/alloc.c +48 -0
  510. package/lib/node_modules/web-tree-sitter/lib/alloc.h +41 -0
  511. package/lib/node_modules/web-tree-sitter/lib/array.h +291 -0
  512. package/lib/node_modules/web-tree-sitter/lib/atomic.h +68 -0
  513. package/lib/node_modules/web-tree-sitter/lib/clock.h +146 -0
  514. package/lib/node_modules/web-tree-sitter/lib/error_costs.h +11 -0
  515. package/lib/node_modules/web-tree-sitter/lib/get_changed_ranges.c +523 -0
  516. package/lib/node_modules/web-tree-sitter/lib/get_changed_ranges.h +36 -0
  517. package/lib/node_modules/web-tree-sitter/lib/host.h +21 -0
  518. package/lib/node_modules/web-tree-sitter/lib/language.c +293 -0
  519. package/lib/node_modules/web-tree-sitter/lib/language.h +293 -0
  520. package/lib/node_modules/web-tree-sitter/lib/length.h +52 -0
  521. package/lib/node_modules/web-tree-sitter/lib/lexer.c +483 -0
  522. package/lib/node_modules/web-tree-sitter/lib/lexer.h +54 -0
  523. package/lib/node_modules/web-tree-sitter/lib/lib.c +12 -0
  524. package/lib/node_modules/web-tree-sitter/lib/node.c +875 -0
  525. package/lib/node_modules/web-tree-sitter/lib/parser.c +2297 -0
  526. package/lib/node_modules/web-tree-sitter/lib/parser.h +286 -0
  527. package/lib/node_modules/web-tree-sitter/lib/point.h +48 -0
  528. package/lib/node_modules/web-tree-sitter/lib/query.c +4347 -0
  529. package/lib/node_modules/web-tree-sitter/lib/reduce_action.h +34 -0
  530. package/lib/node_modules/web-tree-sitter/lib/reusable_node.h +95 -0
  531. package/lib/node_modules/web-tree-sitter/lib/stack.c +912 -0
  532. package/lib/node_modules/web-tree-sitter/lib/stack.h +133 -0
  533. package/lib/node_modules/web-tree-sitter/lib/subtree.c +1034 -0
  534. package/lib/node_modules/web-tree-sitter/lib/subtree.h +399 -0
  535. package/lib/node_modules/web-tree-sitter/lib/tree-sitter.c +987 -0
  536. package/lib/node_modules/web-tree-sitter/lib/tree-sitter.cjs +2988 -0
  537. package/lib/node_modules/web-tree-sitter/lib/tree-sitter.wasm +0 -0
  538. package/lib/node_modules/web-tree-sitter/lib/tree-sitter.wasm.map +1 -0
  539. package/lib/node_modules/web-tree-sitter/lib/tree.c +170 -0
  540. package/lib/node_modules/web-tree-sitter/lib/tree.h +31 -0
  541. package/lib/node_modules/web-tree-sitter/lib/tree_cursor.c +716 -0
  542. package/lib/node_modules/web-tree-sitter/lib/tree_cursor.h +48 -0
  543. package/lib/node_modules/web-tree-sitter/lib/ts_assert.h +11 -0
  544. package/lib/node_modules/web-tree-sitter/lib/unicode.h +75 -0
  545. package/lib/node_modules/web-tree-sitter/lib/wasm_store.c +1937 -0
  546. package/lib/node_modules/web-tree-sitter/lib/wasm_store.h +31 -0
  547. package/lib/node_modules/web-tree-sitter/package.json +98 -0
  548. package/lib/node_modules/web-tree-sitter/src/bindings.ts +26 -0
  549. package/lib/node_modules/web-tree-sitter/src/constants.ts +133 -0
  550. package/lib/node_modules/web-tree-sitter/src/index.ts +31 -0
  551. package/lib/node_modules/web-tree-sitter/src/language.ts +291 -0
  552. package/lib/node_modules/web-tree-sitter/src/lookahead_iterator.ts +75 -0
  553. package/lib/node_modules/web-tree-sitter/src/marshal.ts +176 -0
  554. package/lib/node_modules/web-tree-sitter/src/node.ts +646 -0
  555. package/lib/node_modules/web-tree-sitter/src/parser.ts +325 -0
  556. package/lib/node_modules/web-tree-sitter/src/query.ts +973 -0
  557. package/lib/node_modules/web-tree-sitter/src/tree.ts +145 -0
  558. package/lib/node_modules/web-tree-sitter/src/tree_cursor.ts +318 -0
  559. package/lib/node_modules/web-tree-sitter/tree-sitter.cjs +4031 -0
  560. package/lib/node_modules/web-tree-sitter/tree-sitter.cjs.map +7 -0
  561. package/lib/node_modules/web-tree-sitter/tree-sitter.js +3980 -0
  562. package/lib/node_modules/web-tree-sitter/tree-sitter.js.map +7 -0
  563. package/lib/node_modules/web-tree-sitter/tree-sitter.wasm +0 -0
  564. package/lib/node_modules/web-tree-sitter/tree-sitter.wasm.map +30 -0
  565. package/lib/node_modules/web-tree-sitter/web-tree-sitter.d.ts +1030 -0
  566. package/lib/node_modules/web-tree-sitter/web-tree-sitter.d.ts.map +56 -0
  567. package/lib/package.json +55 -0
  568. package/node +0 -0
  569. package/package.json +17 -0
@@ -0,0 +1,1085 @@
1
+ 'use strict';
2
+
3
+ const constants = require('./constants');
4
+ const utils = require('./utils');
5
+
6
+ /**
7
+ * Constants
8
+ */
9
+
10
+ const {
11
+ MAX_LENGTH,
12
+ POSIX_REGEX_SOURCE,
13
+ REGEX_NON_SPECIAL_CHARS,
14
+ REGEX_SPECIAL_CHARS_BACKREF,
15
+ REPLACEMENTS
16
+ } = constants;
17
+
18
+ /**
19
+ * Helpers
20
+ */
21
+
22
+ const expandRange = (args, options) => {
23
+ if (typeof options.expandRange === 'function') {
24
+ return options.expandRange(...args, options);
25
+ }
26
+
27
+ args.sort();
28
+ const value = `[${args.join('-')}]`;
29
+
30
+ try {
31
+ /* eslint-disable-next-line no-new */
32
+ new RegExp(value);
33
+ } catch (ex) {
34
+ return args.map(v => utils.escapeRegex(v)).join('..');
35
+ }
36
+
37
+ return value;
38
+ };
39
+
40
+ /**
41
+ * Create the message for a syntax error
42
+ */
43
+
44
+ const syntaxError = (type, char) => {
45
+ return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
46
+ };
47
+
48
+ /**
49
+ * Parse the given input string.
50
+ * @param {String} input
51
+ * @param {Object} options
52
+ * @return {Object}
53
+ */
54
+
55
+ const parse = (input, options) => {
56
+ if (typeof input !== 'string') {
57
+ throw new TypeError('Expected a string');
58
+ }
59
+
60
+ input = REPLACEMENTS[input] || input;
61
+
62
+ const opts = { ...options };
63
+ const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
64
+
65
+ let len = input.length;
66
+ if (len > max) {
67
+ throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
68
+ }
69
+
70
+ const bos = { type: 'bos', value: '', output: opts.prepend || '' };
71
+ const tokens = [bos];
72
+
73
+ const capture = opts.capture ? '' : '?:';
74
+
75
+ // create constants based on platform, for windows or posix
76
+ const PLATFORM_CHARS = constants.globChars(opts.windows);
77
+ const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
78
+
79
+ const {
80
+ DOT_LITERAL,
81
+ PLUS_LITERAL,
82
+ SLASH_LITERAL,
83
+ ONE_CHAR,
84
+ DOTS_SLASH,
85
+ NO_DOT,
86
+ NO_DOT_SLASH,
87
+ NO_DOTS_SLASH,
88
+ QMARK,
89
+ QMARK_NO_DOT,
90
+ STAR,
91
+ START_ANCHOR
92
+ } = PLATFORM_CHARS;
93
+
94
+ const globstar = opts => {
95
+ return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
96
+ };
97
+
98
+ const nodot = opts.dot ? '' : NO_DOT;
99
+ const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
100
+ let star = opts.bash === true ? globstar(opts) : STAR;
101
+
102
+ if (opts.capture) {
103
+ star = `(${star})`;
104
+ }
105
+
106
+ // minimatch options support
107
+ if (typeof opts.noext === 'boolean') {
108
+ opts.noextglob = opts.noext;
109
+ }
110
+
111
+ const state = {
112
+ input,
113
+ index: -1,
114
+ start: 0,
115
+ dot: opts.dot === true,
116
+ consumed: '',
117
+ output: '',
118
+ prefix: '',
119
+ backtrack: false,
120
+ negated: false,
121
+ brackets: 0,
122
+ braces: 0,
123
+ parens: 0,
124
+ quotes: 0,
125
+ globstar: false,
126
+ tokens
127
+ };
128
+
129
+ input = utils.removePrefix(input, state);
130
+ len = input.length;
131
+
132
+ const extglobs = [];
133
+ const braces = [];
134
+ const stack = [];
135
+ let prev = bos;
136
+ let value;
137
+
138
+ /**
139
+ * Tokenizing helpers
140
+ */
141
+
142
+ const eos = () => state.index === len - 1;
143
+ const peek = state.peek = (n = 1) => input[state.index + n];
144
+ const advance = state.advance = () => input[++state.index] || '';
145
+ const remaining = () => input.slice(state.index + 1);
146
+ const consume = (value = '', num = 0) => {
147
+ state.consumed += value;
148
+ state.index += num;
149
+ };
150
+
151
+ const append = token => {
152
+ state.output += token.output != null ? token.output : token.value;
153
+ consume(token.value);
154
+ };
155
+
156
+ const negate = () => {
157
+ let count = 1;
158
+
159
+ while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) {
160
+ advance();
161
+ state.start++;
162
+ count++;
163
+ }
164
+
165
+ if (count % 2 === 0) {
166
+ return false;
167
+ }
168
+
169
+ state.negated = true;
170
+ state.start++;
171
+ return true;
172
+ };
173
+
174
+ const increment = type => {
175
+ state[type]++;
176
+ stack.push(type);
177
+ };
178
+
179
+ const decrement = type => {
180
+ state[type]--;
181
+ stack.pop();
182
+ };
183
+
184
+ /**
185
+ * Push tokens onto the tokens array. This helper speeds up
186
+ * tokenizing by 1) helping us avoid backtracking as much as possible,
187
+ * and 2) helping us avoid creating extra tokens when consecutive
188
+ * characters are plain text. This improves performance and simplifies
189
+ * lookbehinds.
190
+ */
191
+
192
+ const push = tok => {
193
+ if (prev.type === 'globstar') {
194
+ const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace');
195
+ const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren'));
196
+
197
+ if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) {
198
+ state.output = state.output.slice(0, -prev.output.length);
199
+ prev.type = 'star';
200
+ prev.value = '*';
201
+ prev.output = star;
202
+ state.output += prev.output;
203
+ }
204
+ }
205
+
206
+ if (extglobs.length && tok.type !== 'paren') {
207
+ extglobs[extglobs.length - 1].inner += tok.value;
208
+ }
209
+
210
+ if (tok.value || tok.output) append(tok);
211
+ if (prev && prev.type === 'text' && tok.type === 'text') {
212
+ prev.output = (prev.output || prev.value) + tok.value;
213
+ prev.value += tok.value;
214
+ return;
215
+ }
216
+
217
+ tok.prev = prev;
218
+ tokens.push(tok);
219
+ prev = tok;
220
+ };
221
+
222
+ const extglobOpen = (type, value) => {
223
+ const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' };
224
+
225
+ token.prev = prev;
226
+ token.parens = state.parens;
227
+ token.output = state.output;
228
+ const output = (opts.capture ? '(' : '') + token.open;
229
+
230
+ increment('parens');
231
+ push({ type, value, output: state.output ? '' : ONE_CHAR });
232
+ push({ type: 'paren', extglob: true, value: advance(), output });
233
+ extglobs.push(token);
234
+ };
235
+
236
+ const extglobClose = token => {
237
+ let output = token.close + (opts.capture ? ')' : '');
238
+ let rest;
239
+
240
+ if (token.type === 'negate') {
241
+ let extglobStar = star;
242
+
243
+ if (token.inner && token.inner.length > 1 && token.inner.includes('/')) {
244
+ extglobStar = globstar(opts);
245
+ }
246
+
247
+ if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
248
+ output = token.close = `)$))${extglobStar}`;
249
+ }
250
+
251
+ if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
252
+ // Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis.
253
+ // In this case, we need to parse the string and use it in the output of the original pattern.
254
+ // Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`.
255
+ //
256
+ // Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`.
257
+ const expression = parse(rest, { ...options, fastpaths: false }).output;
258
+
259
+ output = token.close = `)${expression})${extglobStar})`;
260
+ }
261
+
262
+ if (token.prev.type === 'bos') {
263
+ state.negatedExtglob = true;
264
+ }
265
+ }
266
+
267
+ push({ type: 'paren', extglob: true, value, output });
268
+ decrement('parens');
269
+ };
270
+
271
+ /**
272
+ * Fast paths
273
+ */
274
+
275
+ if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
276
+ let backslashes = false;
277
+
278
+ let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
279
+ if (first === '\\') {
280
+ backslashes = true;
281
+ return m;
282
+ }
283
+
284
+ if (first === '?') {
285
+ if (esc) {
286
+ return esc + first + (rest ? QMARK.repeat(rest.length) : '');
287
+ }
288
+ if (index === 0) {
289
+ return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
290
+ }
291
+ return QMARK.repeat(chars.length);
292
+ }
293
+
294
+ if (first === '.') {
295
+ return DOT_LITERAL.repeat(chars.length);
296
+ }
297
+
298
+ if (first === '*') {
299
+ if (esc) {
300
+ return esc + first + (rest ? star : '');
301
+ }
302
+ return star;
303
+ }
304
+ return esc ? m : `\\${m}`;
305
+ });
306
+
307
+ if (backslashes === true) {
308
+ if (opts.unescape === true) {
309
+ output = output.replace(/\\/g, '');
310
+ } else {
311
+ output = output.replace(/\\+/g, m => {
312
+ return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : '');
313
+ });
314
+ }
315
+ }
316
+
317
+ if (output === input && opts.contains === true) {
318
+ state.output = input;
319
+ return state;
320
+ }
321
+
322
+ state.output = utils.wrapOutput(output, state, options);
323
+ return state;
324
+ }
325
+
326
+ /**
327
+ * Tokenize input until we reach end-of-string
328
+ */
329
+
330
+ while (!eos()) {
331
+ value = advance();
332
+
333
+ if (value === '\u0000') {
334
+ continue;
335
+ }
336
+
337
+ /**
338
+ * Escaped characters
339
+ */
340
+
341
+ if (value === '\\') {
342
+ const next = peek();
343
+
344
+ if (next === '/' && opts.bash !== true) {
345
+ continue;
346
+ }
347
+
348
+ if (next === '.' || next === ';') {
349
+ continue;
350
+ }
351
+
352
+ if (!next) {
353
+ value += '\\';
354
+ push({ type: 'text', value });
355
+ continue;
356
+ }
357
+
358
+ // collapse slashes to reduce potential for exploits
359
+ const match = /^\\+/.exec(remaining());
360
+ let slashes = 0;
361
+
362
+ if (match && match[0].length > 2) {
363
+ slashes = match[0].length;
364
+ state.index += slashes;
365
+ if (slashes % 2 !== 0) {
366
+ value += '\\';
367
+ }
368
+ }
369
+
370
+ if (opts.unescape === true) {
371
+ value = advance();
372
+ } else {
373
+ value += advance();
374
+ }
375
+
376
+ if (state.brackets === 0) {
377
+ push({ type: 'text', value });
378
+ continue;
379
+ }
380
+ }
381
+
382
+ /**
383
+ * If we're inside a regex character class, continue
384
+ * until we reach the closing bracket.
385
+ */
386
+
387
+ if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) {
388
+ if (opts.posix !== false && value === ':') {
389
+ const inner = prev.value.slice(1);
390
+ if (inner.includes('[')) {
391
+ prev.posix = true;
392
+
393
+ if (inner.includes(':')) {
394
+ const idx = prev.value.lastIndexOf('[');
395
+ const pre = prev.value.slice(0, idx);
396
+ const rest = prev.value.slice(idx + 2);
397
+ const posix = POSIX_REGEX_SOURCE[rest];
398
+ if (posix) {
399
+ prev.value = pre + posix;
400
+ state.backtrack = true;
401
+ advance();
402
+
403
+ if (!bos.output && tokens.indexOf(prev) === 1) {
404
+ bos.output = ONE_CHAR;
405
+ }
406
+ continue;
407
+ }
408
+ }
409
+ }
410
+ }
411
+
412
+ if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) {
413
+ value = `\\${value}`;
414
+ }
415
+
416
+ if (value === ']' && (prev.value === '[' || prev.value === '[^')) {
417
+ value = `\\${value}`;
418
+ }
419
+
420
+ if (opts.posix === true && value === '!' && prev.value === '[') {
421
+ value = '^';
422
+ }
423
+
424
+ prev.value += value;
425
+ append({ value });
426
+ continue;
427
+ }
428
+
429
+ /**
430
+ * If we're inside a quoted string, continue
431
+ * until we reach the closing double quote.
432
+ */
433
+
434
+ if (state.quotes === 1 && value !== '"') {
435
+ value = utils.escapeRegex(value);
436
+ prev.value += value;
437
+ append({ value });
438
+ continue;
439
+ }
440
+
441
+ /**
442
+ * Double quotes
443
+ */
444
+
445
+ if (value === '"') {
446
+ state.quotes = state.quotes === 1 ? 0 : 1;
447
+ if (opts.keepQuotes === true) {
448
+ push({ type: 'text', value });
449
+ }
450
+ continue;
451
+ }
452
+
453
+ /**
454
+ * Parentheses
455
+ */
456
+
457
+ if (value === '(') {
458
+ increment('parens');
459
+ push({ type: 'paren', value });
460
+ continue;
461
+ }
462
+
463
+ if (value === ')') {
464
+ if (state.parens === 0 && opts.strictBrackets === true) {
465
+ throw new SyntaxError(syntaxError('opening', '('));
466
+ }
467
+
468
+ const extglob = extglobs[extglobs.length - 1];
469
+ if (extglob && state.parens === extglob.parens + 1) {
470
+ extglobClose(extglobs.pop());
471
+ continue;
472
+ }
473
+
474
+ push({ type: 'paren', value, output: state.parens ? ')' : '\\)' });
475
+ decrement('parens');
476
+ continue;
477
+ }
478
+
479
+ /**
480
+ * Square brackets
481
+ */
482
+
483
+ if (value === '[') {
484
+ if (opts.nobracket === true || !remaining().includes(']')) {
485
+ if (opts.nobracket !== true && opts.strictBrackets === true) {
486
+ throw new SyntaxError(syntaxError('closing', ']'));
487
+ }
488
+
489
+ value = `\\${value}`;
490
+ } else {
491
+ increment('brackets');
492
+ }
493
+
494
+ push({ type: 'bracket', value });
495
+ continue;
496
+ }
497
+
498
+ if (value === ']') {
499
+ if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) {
500
+ push({ type: 'text', value, output: `\\${value}` });
501
+ continue;
502
+ }
503
+
504
+ if (state.brackets === 0) {
505
+ if (opts.strictBrackets === true) {
506
+ throw new SyntaxError(syntaxError('opening', '['));
507
+ }
508
+
509
+ push({ type: 'text', value, output: `\\${value}` });
510
+ continue;
511
+ }
512
+
513
+ decrement('brackets');
514
+
515
+ const prevValue = prev.value.slice(1);
516
+ if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) {
517
+ value = `/${value}`;
518
+ }
519
+
520
+ prev.value += value;
521
+ append({ value });
522
+
523
+ // when literal brackets are explicitly disabled
524
+ // assume we should match with a regex character class
525
+ if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
526
+ continue;
527
+ }
528
+
529
+ const escaped = utils.escapeRegex(prev.value);
530
+ state.output = state.output.slice(0, -prev.value.length);
531
+
532
+ // when literal brackets are explicitly enabled
533
+ // assume we should escape the brackets to match literal characters
534
+ if (opts.literalBrackets === true) {
535
+ state.output += escaped;
536
+ prev.value = escaped;
537
+ continue;
538
+ }
539
+
540
+ // when the user specifies nothing, try to match both
541
+ prev.value = `(${capture}${escaped}|${prev.value})`;
542
+ state.output += prev.value;
543
+ continue;
544
+ }
545
+
546
+ /**
547
+ * Braces
548
+ */
549
+
550
+ if (value === '{' && opts.nobrace !== true) {
551
+ increment('braces');
552
+
553
+ const open = {
554
+ type: 'brace',
555
+ value,
556
+ output: '(',
557
+ outputIndex: state.output.length,
558
+ tokensIndex: state.tokens.length
559
+ };
560
+
561
+ braces.push(open);
562
+ push(open);
563
+ continue;
564
+ }
565
+
566
+ if (value === '}') {
567
+ const brace = braces[braces.length - 1];
568
+
569
+ if (opts.nobrace === true || !brace) {
570
+ push({ type: 'text', value, output: value });
571
+ continue;
572
+ }
573
+
574
+ let output = ')';
575
+
576
+ if (brace.dots === true) {
577
+ const arr = tokens.slice();
578
+ const range = [];
579
+
580
+ for (let i = arr.length - 1; i >= 0; i--) {
581
+ tokens.pop();
582
+ if (arr[i].type === 'brace') {
583
+ break;
584
+ }
585
+ if (arr[i].type !== 'dots') {
586
+ range.unshift(arr[i].value);
587
+ }
588
+ }
589
+
590
+ output = expandRange(range, opts);
591
+ state.backtrack = true;
592
+ }
593
+
594
+ if (brace.comma !== true && brace.dots !== true) {
595
+ const out = state.output.slice(0, brace.outputIndex);
596
+ const toks = state.tokens.slice(brace.tokensIndex);
597
+ brace.value = brace.output = '\\{';
598
+ value = output = '\\}';
599
+ state.output = out;
600
+ for (const t of toks) {
601
+ state.output += (t.output || t.value);
602
+ }
603
+ }
604
+
605
+ push({ type: 'brace', value, output });
606
+ decrement('braces');
607
+ braces.pop();
608
+ continue;
609
+ }
610
+
611
+ /**
612
+ * Pipes
613
+ */
614
+
615
+ if (value === '|') {
616
+ if (extglobs.length > 0) {
617
+ extglobs[extglobs.length - 1].conditions++;
618
+ }
619
+ push({ type: 'text', value });
620
+ continue;
621
+ }
622
+
623
+ /**
624
+ * Commas
625
+ */
626
+
627
+ if (value === ',') {
628
+ let output = value;
629
+
630
+ const brace = braces[braces.length - 1];
631
+ if (brace && stack[stack.length - 1] === 'braces') {
632
+ brace.comma = true;
633
+ output = '|';
634
+ }
635
+
636
+ push({ type: 'comma', value, output });
637
+ continue;
638
+ }
639
+
640
+ /**
641
+ * Slashes
642
+ */
643
+
644
+ if (value === '/') {
645
+ // if the beginning of the glob is "./", advance the start
646
+ // to the current index, and don't add the "./" characters
647
+ // to the state. This greatly simplifies lookbehinds when
648
+ // checking for BOS characters like "!" and "." (not "./")
649
+ if (prev.type === 'dot' && state.index === state.start + 1) {
650
+ state.start = state.index + 1;
651
+ state.consumed = '';
652
+ state.output = '';
653
+ tokens.pop();
654
+ prev = bos; // reset "prev" to the first token
655
+ continue;
656
+ }
657
+
658
+ push({ type: 'slash', value, output: SLASH_LITERAL });
659
+ continue;
660
+ }
661
+
662
+ /**
663
+ * Dots
664
+ */
665
+
666
+ if (value === '.') {
667
+ if (state.braces > 0 && prev.type === 'dot') {
668
+ if (prev.value === '.') prev.output = DOT_LITERAL;
669
+ const brace = braces[braces.length - 1];
670
+ prev.type = 'dots';
671
+ prev.output += value;
672
+ prev.value += value;
673
+ brace.dots = true;
674
+ continue;
675
+ }
676
+
677
+ if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') {
678
+ push({ type: 'text', value, output: DOT_LITERAL });
679
+ continue;
680
+ }
681
+
682
+ push({ type: 'dot', value, output: DOT_LITERAL });
683
+ continue;
684
+ }
685
+
686
+ /**
687
+ * Question marks
688
+ */
689
+
690
+ if (value === '?') {
691
+ const isGroup = prev && prev.value === '(';
692
+ if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
693
+ extglobOpen('qmark', value);
694
+ continue;
695
+ }
696
+
697
+ if (prev && prev.type === 'paren') {
698
+ const next = peek();
699
+ let output = value;
700
+
701
+ if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) {
702
+ output = `\\${value}`;
703
+ }
704
+
705
+ push({ type: 'text', value, output });
706
+ continue;
707
+ }
708
+
709
+ if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) {
710
+ push({ type: 'qmark', value, output: QMARK_NO_DOT });
711
+ continue;
712
+ }
713
+
714
+ push({ type: 'qmark', value, output: QMARK });
715
+ continue;
716
+ }
717
+
718
+ /**
719
+ * Exclamation
720
+ */
721
+
722
+ if (value === '!') {
723
+ if (opts.noextglob !== true && peek() === '(') {
724
+ if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) {
725
+ extglobOpen('negate', value);
726
+ continue;
727
+ }
728
+ }
729
+
730
+ if (opts.nonegate !== true && state.index === 0) {
731
+ negate();
732
+ continue;
733
+ }
734
+ }
735
+
736
+ /**
737
+ * Plus
738
+ */
739
+
740
+ if (value === '+') {
741
+ if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
742
+ extglobOpen('plus', value);
743
+ continue;
744
+ }
745
+
746
+ if ((prev && prev.value === '(') || opts.regex === false) {
747
+ push({ type: 'plus', value, output: PLUS_LITERAL });
748
+ continue;
749
+ }
750
+
751
+ if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) {
752
+ push({ type: 'plus', value });
753
+ continue;
754
+ }
755
+
756
+ push({ type: 'plus', value: PLUS_LITERAL });
757
+ continue;
758
+ }
759
+
760
+ /**
761
+ * Plain text
762
+ */
763
+
764
+ if (value === '@') {
765
+ if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
766
+ push({ type: 'at', extglob: true, value, output: '' });
767
+ continue;
768
+ }
769
+
770
+ push({ type: 'text', value });
771
+ continue;
772
+ }
773
+
774
+ /**
775
+ * Plain text
776
+ */
777
+
778
+ if (value !== '*') {
779
+ if (value === '$' || value === '^') {
780
+ value = `\\${value}`;
781
+ }
782
+
783
+ const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
784
+ if (match) {
785
+ value += match[0];
786
+ state.index += match[0].length;
787
+ }
788
+
789
+ push({ type: 'text', value });
790
+ continue;
791
+ }
792
+
793
+ /**
794
+ * Stars
795
+ */
796
+
797
+ if (prev && (prev.type === 'globstar' || prev.star === true)) {
798
+ prev.type = 'star';
799
+ prev.star = true;
800
+ prev.value += value;
801
+ prev.output = star;
802
+ state.backtrack = true;
803
+ state.globstar = true;
804
+ consume(value);
805
+ continue;
806
+ }
807
+
808
+ let rest = remaining();
809
+ if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
810
+ extglobOpen('star', value);
811
+ continue;
812
+ }
813
+
814
+ if (prev.type === 'star') {
815
+ if (opts.noglobstar === true) {
816
+ consume(value);
817
+ continue;
818
+ }
819
+
820
+ const prior = prev.prev;
821
+ const before = prior.prev;
822
+ const isStart = prior.type === 'slash' || prior.type === 'bos';
823
+ const afterStar = before && (before.type === 'star' || before.type === 'globstar');
824
+
825
+ if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) {
826
+ push({ type: 'star', value, output: '' });
827
+ continue;
828
+ }
829
+
830
+ const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace');
831
+ const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren');
832
+ if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) {
833
+ push({ type: 'star', value, output: '' });
834
+ continue;
835
+ }
836
+
837
+ // strip consecutive `/**/`
838
+ while (rest.slice(0, 3) === '/**') {
839
+ const after = input[state.index + 4];
840
+ if (after && after !== '/') {
841
+ break;
842
+ }
843
+ rest = rest.slice(3);
844
+ consume('/**', 3);
845
+ }
846
+
847
+ if (prior.type === 'bos' && eos()) {
848
+ prev.type = 'globstar';
849
+ prev.value += value;
850
+ prev.output = globstar(opts);
851
+ state.output = prev.output;
852
+ state.globstar = true;
853
+ consume(value);
854
+ continue;
855
+ }
856
+
857
+ if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) {
858
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
859
+ prior.output = `(?:${prior.output}`;
860
+
861
+ prev.type = 'globstar';
862
+ prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
863
+ prev.value += value;
864
+ state.globstar = true;
865
+ state.output += prior.output + prev.output;
866
+ consume(value);
867
+ continue;
868
+ }
869
+
870
+ if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') {
871
+ const end = rest[1] !== void 0 ? '|$' : '';
872
+
873
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
874
+ prior.output = `(?:${prior.output}`;
875
+
876
+ prev.type = 'globstar';
877
+ prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
878
+ prev.value += value;
879
+
880
+ state.output += prior.output + prev.output;
881
+ state.globstar = true;
882
+
883
+ consume(value + advance());
884
+
885
+ push({ type: 'slash', value: '/', output: '' });
886
+ continue;
887
+ }
888
+
889
+ if (prior.type === 'bos' && rest[0] === '/') {
890
+ prev.type = 'globstar';
891
+ prev.value += value;
892
+ prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
893
+ state.output = prev.output;
894
+ state.globstar = true;
895
+ consume(value + advance());
896
+ push({ type: 'slash', value: '/', output: '' });
897
+ continue;
898
+ }
899
+
900
+ // remove single star from output
901
+ state.output = state.output.slice(0, -prev.output.length);
902
+
903
+ // reset previous token to globstar
904
+ prev.type = 'globstar';
905
+ prev.output = globstar(opts);
906
+ prev.value += value;
907
+
908
+ // reset output with globstar
909
+ state.output += prev.output;
910
+ state.globstar = true;
911
+ consume(value);
912
+ continue;
913
+ }
914
+
915
+ const token = { type: 'star', value, output: star };
916
+
917
+ if (opts.bash === true) {
918
+ token.output = '.*?';
919
+ if (prev.type === 'bos' || prev.type === 'slash') {
920
+ token.output = nodot + token.output;
921
+ }
922
+ push(token);
923
+ continue;
924
+ }
925
+
926
+ if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) {
927
+ token.output = value;
928
+ push(token);
929
+ continue;
930
+ }
931
+
932
+ if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') {
933
+ if (prev.type === 'dot') {
934
+ state.output += NO_DOT_SLASH;
935
+ prev.output += NO_DOT_SLASH;
936
+
937
+ } else if (opts.dot === true) {
938
+ state.output += NO_DOTS_SLASH;
939
+ prev.output += NO_DOTS_SLASH;
940
+
941
+ } else {
942
+ state.output += nodot;
943
+ prev.output += nodot;
944
+ }
945
+
946
+ if (peek() !== '*') {
947
+ state.output += ONE_CHAR;
948
+ prev.output += ONE_CHAR;
949
+ }
950
+ }
951
+
952
+ push(token);
953
+ }
954
+
955
+ while (state.brackets > 0) {
956
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']'));
957
+ state.output = utils.escapeLast(state.output, '[');
958
+ decrement('brackets');
959
+ }
960
+
961
+ while (state.parens > 0) {
962
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')'));
963
+ state.output = utils.escapeLast(state.output, '(');
964
+ decrement('parens');
965
+ }
966
+
967
+ while (state.braces > 0) {
968
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}'));
969
+ state.output = utils.escapeLast(state.output, '{');
970
+ decrement('braces');
971
+ }
972
+
973
+ if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) {
974
+ push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` });
975
+ }
976
+
977
+ // rebuild the output if we had to backtrack at any point
978
+ if (state.backtrack === true) {
979
+ state.output = '';
980
+
981
+ for (const token of state.tokens) {
982
+ state.output += token.output != null ? token.output : token.value;
983
+
984
+ if (token.suffix) {
985
+ state.output += token.suffix;
986
+ }
987
+ }
988
+ }
989
+
990
+ return state;
991
+ };
992
+
993
+ /**
994
+ * Fast paths for creating regular expressions for common glob patterns.
995
+ * This can significantly speed up processing and has very little downside
996
+ * impact when none of the fast paths match.
997
+ */
998
+
999
+ parse.fastpaths = (input, options) => {
1000
+ const opts = { ...options };
1001
+ const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
1002
+ const len = input.length;
1003
+ if (len > max) {
1004
+ throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
1005
+ }
1006
+
1007
+ input = REPLACEMENTS[input] || input;
1008
+
1009
+ // create constants based on platform, for windows or posix
1010
+ const {
1011
+ DOT_LITERAL,
1012
+ SLASH_LITERAL,
1013
+ ONE_CHAR,
1014
+ DOTS_SLASH,
1015
+ NO_DOT,
1016
+ NO_DOTS,
1017
+ NO_DOTS_SLASH,
1018
+ STAR,
1019
+ START_ANCHOR
1020
+ } = constants.globChars(opts.windows);
1021
+
1022
+ const nodot = opts.dot ? NO_DOTS : NO_DOT;
1023
+ const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
1024
+ const capture = opts.capture ? '' : '?:';
1025
+ const state = { negated: false, prefix: '' };
1026
+ let star = opts.bash === true ? '.*?' : STAR;
1027
+
1028
+ if (opts.capture) {
1029
+ star = `(${star})`;
1030
+ }
1031
+
1032
+ const globstar = opts => {
1033
+ if (opts.noglobstar === true) return star;
1034
+ return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
1035
+ };
1036
+
1037
+ const create = str => {
1038
+ switch (str) {
1039
+ case '*':
1040
+ return `${nodot}${ONE_CHAR}${star}`;
1041
+
1042
+ case '.*':
1043
+ return `${DOT_LITERAL}${ONE_CHAR}${star}`;
1044
+
1045
+ case '*.*':
1046
+ return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
1047
+
1048
+ case '*/*':
1049
+ return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
1050
+
1051
+ case '**':
1052
+ return nodot + globstar(opts);
1053
+
1054
+ case '**/*':
1055
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
1056
+
1057
+ case '**/*.*':
1058
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
1059
+
1060
+ case '**/.*':
1061
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
1062
+
1063
+ default: {
1064
+ const match = /^(.*?)\.(\w+)$/.exec(str);
1065
+ if (!match) return;
1066
+
1067
+ const source = create(match[1]);
1068
+ if (!source) return;
1069
+
1070
+ return source + DOT_LITERAL + match[2];
1071
+ }
1072
+ }
1073
+ };
1074
+
1075
+ const output = utils.removePrefix(input, state);
1076
+ let source = create(output);
1077
+
1078
+ if (source && opts.strictSlashes !== true) {
1079
+ source += `${SLASH_LITERAL}?`;
1080
+ }
1081
+
1082
+ return source;
1083
+ };
1084
+
1085
+ module.exports = parse;