@happyvertical/smrt-core 0.30.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 (631) hide show
  1. package/AGENTS.md +124 -0
  2. package/CLAUDE.md +1 -0
  3. package/LICENSE +7 -0
  4. package/README.md +265 -0
  5. package/bin/smrt-prebuild.js +26 -0
  6. package/dist/__tests__/fixtures/advisor-test-classes.d.ts +28 -0
  7. package/dist/__tests__/fixtures/advisor-test-classes.d.ts.map +1 -0
  8. package/dist/__tests__/fixtures/collection-coverage-fixtures.d.ts +12 -0
  9. package/dist/__tests__/fixtures/collection-coverage-fixtures.d.ts.map +1 -0
  10. package/dist/__tests__/fixtures/inheritance-resolver-fixtures.d.ts +28 -0
  11. package/dist/__tests__/fixtures/inheritance-resolver-fixtures.d.ts.map +1 -0
  12. package/dist/__tests__/fixtures/inheritance-test-classes.d.ts +43 -0
  13. package/dist/__tests__/fixtures/inheritance-test-classes.d.ts.map +1 -0
  14. package/dist/__tests__/fixtures/mcp-integration-test-classes.d.ts +18 -0
  15. package/dist/__tests__/fixtures/mcp-integration-test-classes.d.ts.map +1 -0
  16. package/dist/__tests__/fixtures/object-ai-memory-fixtures.d.ts +15 -0
  17. package/dist/__tests__/fixtures/object-ai-memory-fixtures.d.ts.map +1 -0
  18. package/dist/__tests__/fixtures/object-spec-test-classes.d.ts +13 -0
  19. package/dist/__tests__/fixtures/object-spec-test-classes.d.ts.map +1 -0
  20. package/dist/__tests__/fixtures/registry-test-classes.d.ts +23 -0
  21. package/dist/__tests__/fixtures/registry-test-classes.d.ts.map +1 -0
  22. package/dist/adapters/ai-usage.d.ts +23 -0
  23. package/dist/adapters/ai-usage.d.ts.map +1 -0
  24. package/dist/adapters/ai-usage.js +105 -0
  25. package/dist/adapters/ai-usage.js.map +1 -0
  26. package/dist/adapters/cost-rates.d.ts +20 -0
  27. package/dist/adapters/cost-rates.d.ts.map +1 -0
  28. package/dist/adapters/cost-rates.js +40 -0
  29. package/dist/adapters/cost-rates.js.map +1 -0
  30. package/dist/adapters/index.d.ts +19 -0
  31. package/dist/adapters/index.d.ts.map +1 -0
  32. package/dist/adapters/metrics.d.ts +111 -0
  33. package/dist/adapters/metrics.d.ts.map +1 -0
  34. package/dist/adapters/metrics.js +169 -0
  35. package/dist/adapters/metrics.js.map +1 -0
  36. package/dist/adapters/pubsub.d.ts +124 -0
  37. package/dist/adapters/pubsub.d.ts.map +1 -0
  38. package/dist/adapters/pubsub.js +121 -0
  39. package/dist/adapters/pubsub.js.map +1 -0
  40. package/dist/browser.d.ts +32 -0
  41. package/dist/browser.d.ts.map +1 -0
  42. package/dist/browser.js +68 -0
  43. package/dist/browser.js.map +1 -0
  44. package/dist/child-accessors.d.ts +27 -0
  45. package/dist/child-accessors.d.ts.map +1 -0
  46. package/dist/child-accessors.js +35 -0
  47. package/dist/child-accessors.js.map +1 -0
  48. package/dist/class.d.ts +313 -0
  49. package/dist/class.d.ts.map +1 -0
  50. package/dist/class.js +896 -0
  51. package/dist/class.js.map +1 -0
  52. package/dist/collection-cache.d.ts +110 -0
  53. package/dist/collection-cache.d.ts.map +1 -0
  54. package/dist/collection-cache.js +187 -0
  55. package/dist/collection-cache.js.map +1 -0
  56. package/dist/collection.d.ts +894 -0
  57. package/dist/collection.d.ts.map +1 -0
  58. package/dist/collection.js +1987 -0
  59. package/dist/collection.js.map +1 -0
  60. package/dist/config/global-config.d.ts +3 -0
  61. package/dist/config/global-config.d.ts.map +1 -0
  62. package/dist/config/global-config.js +19 -0
  63. package/dist/config/global-config.js.map +1 -0
  64. package/dist/config.d.ts +145 -0
  65. package/dist/config.d.ts.map +1 -0
  66. package/dist/config.js +57 -0
  67. package/dist/config.js.map +1 -0
  68. package/dist/consumer-plugin/index.d.ts +22 -0
  69. package/dist/consumer-plugin/index.d.ts.map +1 -0
  70. package/dist/consumer-plugin/index.js +452 -0
  71. package/dist/consumer-plugin/index.js.map +1 -0
  72. package/dist/consumer-plugin.d.ts +8 -0
  73. package/dist/consumer-plugin.d.ts.map +1 -0
  74. package/dist/consumer-plugin.js +5 -0
  75. package/dist/consumer-plugin.js.map +1 -0
  76. package/dist/database.d.ts +95 -0
  77. package/dist/database.d.ts.map +1 -0
  78. package/dist/database.js +32 -0
  79. package/dist/database.js.map +1 -0
  80. package/dist/decorators/compatibility.d.ts +14 -0
  81. package/dist/decorators/compatibility.d.ts.map +1 -0
  82. package/dist/decorators/compatibility.js +111 -0
  83. package/dist/decorators/compatibility.js.map +1 -0
  84. package/dist/decorators/index.d.ts +381 -0
  85. package/dist/decorators/index.d.ts.map +1 -0
  86. package/dist/decorators/index.js +104 -0
  87. package/dist/decorators/index.js.map +1 -0
  88. package/dist/dispatch/bus.d.ts +306 -0
  89. package/dist/dispatch/bus.d.ts.map +1 -0
  90. package/dist/dispatch/bus.js +583 -0
  91. package/dist/dispatch/bus.js.map +1 -0
  92. package/dist/dispatch/collections/DispatchSubscriptions.d.ts +79 -0
  93. package/dist/dispatch/collections/DispatchSubscriptions.d.ts.map +1 -0
  94. package/dist/dispatch/collections/DispatchSubscriptions.js +243 -0
  95. package/dist/dispatch/collections/DispatchSubscriptions.js.map +1 -0
  96. package/dist/dispatch/collections/Dispatches.d.ts +98 -0
  97. package/dist/dispatch/collections/Dispatches.d.ts.map +1 -0
  98. package/dist/dispatch/collections/Dispatches.js +358 -0
  99. package/dist/dispatch/collections/Dispatches.js.map +1 -0
  100. package/dist/dispatch/index.d.ts +47 -0
  101. package/dist/dispatch/index.d.ts.map +1 -0
  102. package/dist/dispatch/models/Dispatch.d.ts +101 -0
  103. package/dist/dispatch/models/Dispatch.d.ts.map +1 -0
  104. package/dist/dispatch/models/Dispatch.js +162 -0
  105. package/dist/dispatch/models/Dispatch.js.map +1 -0
  106. package/dist/dispatch/models/DispatchSubscription.d.ts +83 -0
  107. package/dist/dispatch/models/DispatchSubscription.d.ts.map +1 -0
  108. package/dist/dispatch/models/DispatchSubscription.js +112 -0
  109. package/dist/dispatch/models/DispatchSubscription.js.map +1 -0
  110. package/dist/dispatch/tenant-resolver.d.ts +98 -0
  111. package/dist/dispatch/tenant-resolver.d.ts.map +1 -0
  112. package/dist/dispatch/tenant-resolver.js +32 -0
  113. package/dist/dispatch/tenant-resolver.js.map +1 -0
  114. package/dist/dispatch/types.d.ts +149 -0
  115. package/dist/dispatch/types.d.ts.map +1 -0
  116. package/dist/embeddings/hash.d.ts +33 -0
  117. package/dist/embeddings/hash.d.ts.map +1 -0
  118. package/dist/embeddings/hash.js +37 -0
  119. package/dist/embeddings/hash.js.map +1 -0
  120. package/dist/embeddings/index.d.ts +36 -0
  121. package/dist/embeddings/index.d.ts.map +1 -0
  122. package/dist/embeddings/provider.d.ts +75 -0
  123. package/dist/embeddings/provider.d.ts.map +1 -0
  124. package/dist/embeddings/provider.js +170 -0
  125. package/dist/embeddings/provider.js.map +1 -0
  126. package/dist/embeddings/similarity.d.ts +47 -0
  127. package/dist/embeddings/similarity.d.ts.map +1 -0
  128. package/dist/embeddings/similarity.js +64 -0
  129. package/dist/embeddings/similarity.js.map +1 -0
  130. package/dist/embeddings/storage.d.ts +125 -0
  131. package/dist/embeddings/storage.d.ts.map +1 -0
  132. package/dist/embeddings/storage.js +283 -0
  133. package/dist/embeddings/storage.js.map +1 -0
  134. package/dist/embeddings/types.d.ts +250 -0
  135. package/dist/embeddings/types.d.ts.map +1 -0
  136. package/dist/errors.d.ts +363 -0
  137. package/dist/errors.d.ts.map +1 -0
  138. package/dist/errors.js +669 -0
  139. package/dist/errors.js.map +1 -0
  140. package/dist/generators/cli.d.ts +162 -0
  141. package/dist/generators/cli.d.ts.map +1 -0
  142. package/dist/generators/cli.js +462 -0
  143. package/dist/generators/cli.js.map +1 -0
  144. package/dist/generators/index.d.ts +13 -0
  145. package/dist/generators/index.d.ts.map +1 -0
  146. package/dist/generators/mcp-runtime-template.d.ts +60 -0
  147. package/dist/generators/mcp-runtime-template.d.ts.map +1 -0
  148. package/dist/generators/mcp-runtime-template.js +509 -0
  149. package/dist/generators/mcp-runtime-template.js.map +1 -0
  150. package/dist/generators/mcp.d.ts +231 -0
  151. package/dist/generators/mcp.d.ts.map +1 -0
  152. package/dist/generators/mcp.js +1220 -0
  153. package/dist/generators/mcp.js.map +1 -0
  154. package/dist/generators/rest.d.ts +171 -0
  155. package/dist/generators/rest.d.ts.map +1 -0
  156. package/dist/generators/rest.js +591 -0
  157. package/dist/generators/rest.js.map +1 -0
  158. package/dist/generators/swagger.d.ts +21 -0
  159. package/dist/generators/swagger.d.ts.map +1 -0
  160. package/dist/generators/swagger.js +307 -0
  161. package/dist/generators/swagger.js.map +1 -0
  162. package/dist/generators/tenant-gate.d.ts +74 -0
  163. package/dist/generators/tenant-gate.d.ts.map +1 -0
  164. package/dist/generators/tenant-gate.js +15 -0
  165. package/dist/generators/tenant-gate.js.map +1 -0
  166. package/dist/generators.d.ts +8 -0
  167. package/dist/generators.d.ts.map +1 -0
  168. package/dist/generators.js +19 -0
  169. package/dist/generators.js.map +1 -0
  170. package/dist/hierarchical.d.ts +103 -0
  171. package/dist/hierarchical.d.ts.map +1 -0
  172. package/dist/hierarchical.js +184 -0
  173. package/dist/hierarchical.js.map +1 -0
  174. package/dist/index.d.ts +57 -0
  175. package/dist/index.d.ts.map +1 -0
  176. package/dist/index.js +202 -0
  177. package/dist/index.js.map +1 -0
  178. package/dist/interceptors.d.ts +251 -0
  179. package/dist/interceptors.d.ts.map +1 -0
  180. package/dist/interceptors.js +259 -0
  181. package/dist/interceptors.js.map +1 -0
  182. package/dist/junction.d.ts +99 -0
  183. package/dist/junction.d.ts.map +1 -0
  184. package/dist/junction.js +136 -0
  185. package/dist/junction.js.map +1 -0
  186. package/dist/knowledge.d.ts +11 -0
  187. package/dist/knowledge.d.ts.map +1 -0
  188. package/dist/knowledge.js +310 -0
  189. package/dist/knowledge.js.map +1 -0
  190. package/dist/lazy-config.d.ts +160 -0
  191. package/dist/lazy-config.d.ts.map +1 -0
  192. package/dist/lazy-config.js +146 -0
  193. package/dist/lazy-config.js.map +1 -0
  194. package/dist/manifest/discover-base-classes.d.ts +78 -0
  195. package/dist/manifest/discover-base-classes.d.ts.map +1 -0
  196. package/dist/manifest/discover-base-classes.js +85 -0
  197. package/dist/manifest/discover-base-classes.js.map +1 -0
  198. package/dist/manifest/discover-smrt-packages.d.ts +48 -0
  199. package/dist/manifest/discover-smrt-packages.d.ts.map +1 -0
  200. package/dist/manifest/discover-smrt-packages.js +361 -0
  201. package/dist/manifest/discover-smrt-packages.js.map +1 -0
  202. package/dist/manifest/generator.d.ts +93 -0
  203. package/dist/manifest/generator.d.ts.map +1 -0
  204. package/dist/manifest/generator.js +380 -0
  205. package/dist/manifest/generator.js.map +1 -0
  206. package/dist/manifest/index.d.ts +16 -0
  207. package/dist/manifest/index.d.ts.map +1 -0
  208. package/dist/manifest/index.js +51 -0
  209. package/dist/manifest/index.js.map +1 -0
  210. package/dist/manifest/manager.d.ts +51 -0
  211. package/dist/manifest/manager.d.ts.map +1 -0
  212. package/dist/manifest/manager.js +89 -0
  213. package/dist/manifest/manager.js.map +1 -0
  214. package/dist/manifest/manifest-loader.d.ts +187 -0
  215. package/dist/manifest/manifest-loader.d.ts.map +1 -0
  216. package/dist/manifest/manifest-loader.js +847 -0
  217. package/dist/manifest/manifest-loader.js.map +1 -0
  218. package/dist/manifest/sources/composite.d.ts +22 -0
  219. package/dist/manifest/sources/composite.d.ts.map +1 -0
  220. package/dist/manifest/sources/composite.js +60 -0
  221. package/dist/manifest/sources/composite.js.map +1 -0
  222. package/dist/manifest/sources/embedded.d.ts +7 -0
  223. package/dist/manifest/sources/embedded.d.ts.map +1 -0
  224. package/dist/manifest/sources/embedded.js +30 -0
  225. package/dist/manifest/sources/embedded.js.map +1 -0
  226. package/dist/manifest/sources/explicit-paths.d.ts +17 -0
  227. package/dist/manifest/sources/explicit-paths.d.ts.map +1 -0
  228. package/dist/manifest/sources/explicit-paths.js +35 -0
  229. package/dist/manifest/sources/explicit-paths.js.map +1 -0
  230. package/dist/manifest/sources/fallback.d.ts +25 -0
  231. package/dist/manifest/sources/fallback.d.ts.map +1 -0
  232. package/dist/manifest/sources/fallback.js +63 -0
  233. package/dist/manifest/sources/fallback.js.map +1 -0
  234. package/dist/manifest/sources/index.d.ts +17 -0
  235. package/dist/manifest/sources/index.d.ts.map +1 -0
  236. package/dist/manifest/sources/local-test.d.ts +7 -0
  237. package/dist/manifest/sources/local-test.d.ts.map +1 -0
  238. package/dist/manifest/sources/local-test.js +21 -0
  239. package/dist/manifest/sources/local-test.js.map +1 -0
  240. package/dist/manifest/sources/static.d.ts +7 -0
  241. package/dist/manifest/sources/static.d.ts.map +1 -0
  242. package/dist/manifest/sources/static.js +19 -0
  243. package/dist/manifest/sources/static.js.map +1 -0
  244. package/dist/manifest/sources/test.d.ts +7 -0
  245. package/dist/manifest/sources/test.d.ts.map +1 -0
  246. package/dist/manifest/sources/test.js +21 -0
  247. package/dist/manifest/sources/test.js.map +1 -0
  248. package/dist/manifest/sources/types.d.ts +79 -0
  249. package/dist/manifest/sources/types.d.ts.map +1 -0
  250. package/dist/manifest/sources/types.js +61 -0
  251. package/dist/manifest/sources/types.js.map +1 -0
  252. package/dist/manifest/static-manifest.d.ts +4 -0
  253. package/dist/manifest/static-manifest.d.ts.map +1 -0
  254. package/dist/manifest/static-manifest.js +1535 -0
  255. package/dist/manifest/static-manifest.js.map +1 -0
  256. package/dist/manifest/store.d.ts +111 -0
  257. package/dist/manifest/store.d.ts.map +1 -0
  258. package/dist/manifest/store.js +431 -0
  259. package/dist/manifest/store.js.map +1 -0
  260. package/dist/manifest/test-manifest-loader.d.ts +3 -0
  261. package/dist/manifest/test-manifest-loader.d.ts.map +1 -0
  262. package/dist/manifest/test-manifest-stub.d.ts +4 -0
  263. package/dist/manifest/test-manifest-stub.d.ts.map +1 -0
  264. package/dist/manifest/test-manifest-stub.js +80013 -0
  265. package/dist/manifest/test-manifest-stub.js.map +1 -0
  266. package/dist/manifest.d.ts +8 -0
  267. package/dist/manifest.d.ts.map +1 -0
  268. package/dist/manifest.js +20 -0
  269. package/dist/manifest.js.map +1 -0
  270. package/dist/manifest.json +1489 -0
  271. package/dist/mcp-advisor/index.d.ts +499 -0
  272. package/dist/mcp-advisor/index.d.ts.map +1 -0
  273. package/dist/mcp-advisor/tools/add-ai-methods.d.ts +6 -0
  274. package/dist/mcp-advisor/tools/add-ai-methods.d.ts.map +1 -0
  275. package/dist/mcp-advisor/tools/configure-decorators.d.ts +6 -0
  276. package/dist/mcp-advisor/tools/configure-decorators.d.ts.map +1 -0
  277. package/dist/mcp-advisor/tools/generate-collection.d.ts +6 -0
  278. package/dist/mcp-advisor/tools/generate-collection.d.ts.map +1 -0
  279. package/dist/mcp-advisor/tools/generate-field-definitions.d.ts +6 -0
  280. package/dist/mcp-advisor/tools/generate-field-definitions.d.ts.map +1 -0
  281. package/dist/mcp-advisor/tools/generate-smrt-class.d.ts +6 -0
  282. package/dist/mcp-advisor/tools/generate-smrt-class.d.ts.map +1 -0
  283. package/dist/mcp-advisor/tools/get-object-config.d.ts +6 -0
  284. package/dist/mcp-advisor/tools/get-object-config.d.ts.map +1 -0
  285. package/dist/mcp-advisor/tools/get-object-schema.d.ts +10 -0
  286. package/dist/mcp-advisor/tools/get-object-schema.d.ts.map +1 -0
  287. package/dist/mcp-advisor/tools/list-registered-objects.d.ts +9 -0
  288. package/dist/mcp-advisor/tools/list-registered-objects.d.ts.map +1 -0
  289. package/dist/mcp-advisor/tools/preview-api-endpoints.d.ts +9 -0
  290. package/dist/mcp-advisor/tools/preview-api-endpoints.d.ts.map +1 -0
  291. package/dist/mcp-advisor/tools/preview-mcp-tools.d.ts +9 -0
  292. package/dist/mcp-advisor/tools/preview-mcp-tools.d.ts.map +1 -0
  293. package/dist/mcp-advisor/tools/validate-smrt-object.d.ts +6 -0
  294. package/dist/mcp-advisor/tools/validate-smrt-object.d.ts.map +1 -0
  295. package/dist/mcp-advisor/types.d.ts +209 -0
  296. package/dist/mcp-advisor/types.d.ts.map +1 -0
  297. package/dist/migrations/backfill-tracker.d.ts +84 -0
  298. package/dist/migrations/backfill-tracker.d.ts.map +1 -0
  299. package/dist/migrations/backfill-tracker.js +118 -0
  300. package/dist/migrations/backfill-tracker.js.map +1 -0
  301. package/dist/migrations/checksum.d.ts +43 -0
  302. package/dist/migrations/checksum.d.ts.map +1 -0
  303. package/dist/migrations/checksum.js +32 -0
  304. package/dist/migrations/checksum.js.map +1 -0
  305. package/dist/migrations/differ.d.ts +186 -0
  306. package/dist/migrations/differ.d.ts.map +1 -0
  307. package/dist/migrations/differ.js +601 -0
  308. package/dist/migrations/differ.js.map +1 -0
  309. package/dist/migrations/generator.d.ts +133 -0
  310. package/dist/migrations/generator.d.ts.map +1 -0
  311. package/dist/migrations/generator.js +328 -0
  312. package/dist/migrations/generator.js.map +1 -0
  313. package/dist/migrations/index.d.ts +20 -0
  314. package/dist/migrations/index.d.ts.map +1 -0
  315. package/dist/migrations/orchestrate.d.ts +148 -0
  316. package/dist/migrations/orchestrate.d.ts.map +1 -0
  317. package/dist/migrations/orchestrate.js +118 -0
  318. package/dist/migrations/orchestrate.js.map +1 -0
  319. package/dist/migrations/tracker.d.ts +134 -0
  320. package/dist/migrations/tracker.d.ts.map +1 -0
  321. package/dist/migrations/tracker.js +624 -0
  322. package/dist/migrations/tracker.js.map +1 -0
  323. package/dist/migrations/types.d.ts +221 -0
  324. package/dist/migrations/types.d.ts.map +1 -0
  325. package/dist/migrations.d.ts +7 -0
  326. package/dist/migrations.d.ts.map +1 -0
  327. package/dist/migrations.js +26 -0
  328. package/dist/migrations.js.map +1 -0
  329. package/dist/node_modules/.pnpm/balanced-match@4.0.4/node_modules/balanced-match/dist/esm/index.js +56 -0
  330. package/dist/node_modules/.pnpm/balanced-match@4.0.4/node_modules/balanced-match/dist/esm/index.js.map +1 -0
  331. package/dist/node_modules/.pnpm/brace-expansion@5.0.5/node_modules/brace-expansion/dist/esm/index.js +163 -0
  332. package/dist/node_modules/.pnpm/brace-expansion@5.0.5/node_modules/brace-expansion/dist/esm/index.js.map +1 -0
  333. package/dist/node_modules/.pnpm/minimatch@10.2.3/node_modules/minimatch/dist/esm/assert-valid-pattern.js +13 -0
  334. package/dist/node_modules/.pnpm/minimatch@10.2.3/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map +1 -0
  335. package/dist/node_modules/.pnpm/minimatch@10.2.3/node_modules/minimatch/dist/esm/ast.js +654 -0
  336. package/dist/node_modules/.pnpm/minimatch@10.2.3/node_modules/minimatch/dist/esm/ast.js.map +1 -0
  337. package/dist/node_modules/.pnpm/minimatch@10.2.3/node_modules/minimatch/dist/esm/brace-expressions.js +111 -0
  338. package/dist/node_modules/.pnpm/minimatch@10.2.3/node_modules/minimatch/dist/esm/brace-expressions.js.map +1 -0
  339. package/dist/node_modules/.pnpm/minimatch@10.2.3/node_modules/minimatch/dist/esm/escape.js +10 -0
  340. package/dist/node_modules/.pnpm/minimatch@10.2.3/node_modules/minimatch/dist/esm/escape.js.map +1 -0
  341. package/dist/node_modules/.pnpm/minimatch@10.2.3/node_modules/minimatch/dist/esm/index.js +824 -0
  342. package/dist/node_modules/.pnpm/minimatch@10.2.3/node_modules/minimatch/dist/esm/index.js.map +1 -0
  343. package/dist/node_modules/.pnpm/minimatch@10.2.3/node_modules/minimatch/dist/esm/unescape.js +10 -0
  344. package/dist/node_modules/.pnpm/minimatch@10.2.3/node_modules/minimatch/dist/esm/unescape.js.map +1 -0
  345. package/dist/object.d.ts +1202 -0
  346. package/dist/object.d.ts.map +1 -0
  347. package/dist/object.js +2731 -0
  348. package/dist/object.js.map +1 -0
  349. package/dist/polymorphic-association.d.ts +69 -0
  350. package/dist/polymorphic-association.d.ts.map +1 -0
  351. package/dist/polymorphic-association.js +96 -0
  352. package/dist/polymorphic-association.js.map +1 -0
  353. package/dist/prebuild/cli.d.ts +7 -0
  354. package/dist/prebuild/cli.d.ts.map +1 -0
  355. package/dist/prebuild/cli.js +29 -0
  356. package/dist/prebuild/cli.js.map +1 -0
  357. package/dist/prebuild/index.d.ts +22 -0
  358. package/dist/prebuild/index.d.ts.map +1 -0
  359. package/dist/prebuild/index.js +239 -0
  360. package/dist/prebuild/index.js.map +1 -0
  361. package/dist/prebuild.d.ts +8 -0
  362. package/dist/prebuild.d.ts.map +1 -0
  363. package/dist/prebuild.js +6 -0
  364. package/dist/prebuild.js.map +1 -0
  365. package/dist/registry/cache-config.d.ts +13 -0
  366. package/dist/registry/cache-config.d.ts.map +1 -0
  367. package/dist/registry/cache-config.js +17 -0
  368. package/dist/registry/cache-config.js.map +1 -0
  369. package/dist/registry/class-registration.d.ts +31 -0
  370. package/dist/registry/class-registration.d.ts.map +1 -0
  371. package/dist/registry/class-registration.js +1074 -0
  372. package/dist/registry/class-registration.js.map +1 -0
  373. package/dist/registry/collection-resolution.d.ts +45 -0
  374. package/dist/registry/collection-resolution.d.ts.map +1 -0
  375. package/dist/registry/collection-resolution.js +121 -0
  376. package/dist/registry/collection-resolution.js.map +1 -0
  377. package/dist/registry/collision-policy.d.ts +179 -0
  378. package/dist/registry/collision-policy.d.ts.map +1 -0
  379. package/dist/registry/collision-policy.js +153 -0
  380. package/dist/registry/collision-policy.js.map +1 -0
  381. package/dist/registry/diagnostics.d.ts +58 -0
  382. package/dist/registry/diagnostics.d.ts.map +1 -0
  383. package/dist/registry/diagnostics.js +54 -0
  384. package/dist/registry/diagnostics.js.map +1 -0
  385. package/dist/registry/embedding-manager.d.ts +23 -0
  386. package/dist/registry/embedding-manager.d.ts.map +1 -0
  387. package/dist/registry/embedding-manager.js +62 -0
  388. package/dist/registry/embedding-manager.js.map +1 -0
  389. package/dist/registry/index.d.ts +13 -0
  390. package/dist/registry/index.d.ts.map +1 -0
  391. package/dist/registry/inheritance-resolver.d.ts +13 -0
  392. package/dist/registry/inheritance-resolver.d.ts.map +1 -0
  393. package/dist/registry/inheritance-resolver.js +244 -0
  394. package/dist/registry/inheritance-resolver.js.map +1 -0
  395. package/dist/registry/manifest-field-merge.d.ts +4 -0
  396. package/dist/registry/manifest-field-merge.d.ts.map +1 -0
  397. package/dist/registry/manifest-field-merge.js +82 -0
  398. package/dist/registry/manifest-field-merge.js.map +1 -0
  399. package/dist/registry/name-resolver.d.ts +102 -0
  400. package/dist/registry/name-resolver.d.ts.map +1 -0
  401. package/dist/registry/name-resolver.js +241 -0
  402. package/dist/registry/name-resolver.js.map +1 -0
  403. package/dist/registry/relationship-graph.d.ts +16 -0
  404. package/dist/registry/relationship-graph.d.ts.map +1 -0
  405. package/dist/registry/relationship-graph.js +79 -0
  406. package/dist/registry/relationship-graph.js.map +1 -0
  407. package/dist/registry/schema-builder.d.ts +113 -0
  408. package/dist/registry/schema-builder.d.ts.map +1 -0
  409. package/dist/registry/schema-builder.js +474 -0
  410. package/dist/registry/schema-builder.js.map +1 -0
  411. package/dist/registry/shared-state.d.ts +62 -0
  412. package/dist/registry/shared-state.d.ts.map +1 -0
  413. package/dist/registry/shared-state.js +135 -0
  414. package/dist/registry/shared-state.js.map +1 -0
  415. package/dist/registry/types.d.ts +667 -0
  416. package/dist/registry/types.d.ts.map +1 -0
  417. package/dist/registry/validator.d.ts +13 -0
  418. package/dist/registry/validator.d.ts.map +1 -0
  419. package/dist/registry/validator.js +138 -0
  420. package/dist/registry/validator.js.map +1 -0
  421. package/dist/registry.d.ts +1358 -0
  422. package/dist/registry.d.ts.map +1 -0
  423. package/dist/registry.js +2301 -0
  424. package/dist/registry.js.map +1 -0
  425. package/dist/runtime/client.d.ts +34 -0
  426. package/dist/runtime/client.d.ts.map +1 -0
  427. package/dist/runtime/client.js +104 -0
  428. package/dist/runtime/client.js.map +1 -0
  429. package/dist/runtime/index.d.ts +10 -0
  430. package/dist/runtime/index.d.ts.map +1 -0
  431. package/dist/runtime/mcp.d.ts +47 -0
  432. package/dist/runtime/mcp.d.ts.map +1 -0
  433. package/dist/runtime/mcp.js +72 -0
  434. package/dist/runtime/mcp.js.map +1 -0
  435. package/dist/runtime/server.d.ts +92 -0
  436. package/dist/runtime/server.d.ts.map +1 -0
  437. package/dist/runtime/server.js +390 -0
  438. package/dist/runtime/server.js.map +1 -0
  439. package/dist/runtime/types.d.ts +58 -0
  440. package/dist/runtime/types.d.ts.map +1 -0
  441. package/dist/runtime.d.ts +8 -0
  442. package/dist/runtime.d.ts.map +1 -0
  443. package/dist/runtime.js +10 -0
  444. package/dist/runtime.js.map +1 -0
  445. package/dist/scanner/import-scanner.d.ts +7 -0
  446. package/dist/scanner/import-scanner.d.ts.map +1 -0
  447. package/dist/scanner/index.d.ts +12 -0
  448. package/dist/scanner/index.d.ts.map +1 -0
  449. package/dist/scanner/manifest-generator.d.ts +304 -0
  450. package/dist/scanner/manifest-generator.d.ts.map +1 -0
  451. package/dist/scanner/manifest-generator.js +1707 -0
  452. package/dist/scanner/manifest-generator.js.map +1 -0
  453. package/dist/scanner/test-file-patterns.d.ts +18 -0
  454. package/dist/scanner/test-file-patterns.d.ts.map +1 -0
  455. package/dist/scanner/test-file-patterns.js +16 -0
  456. package/dist/scanner/test-file-patterns.js.map +1 -0
  457. package/dist/scanner/types.d.ts +313 -0
  458. package/dist/scanner/types.d.ts.map +1 -0
  459. package/dist/scanner/types.js +2 -0
  460. package/dist/scanner/types.js.map +1 -0
  461. package/dist/scanner.d.ts +6 -0
  462. package/dist/scanner.d.ts.map +1 -0
  463. package/dist/scanner.js +6 -0
  464. package/dist/scanner.js.map +1 -0
  465. package/dist/schema/code-generator.d.ts +53 -0
  466. package/dist/schema/code-generator.d.ts.map +1 -0
  467. package/dist/schema/ddl/base-strategy.d.ts +80 -0
  468. package/dist/schema/ddl/base-strategy.d.ts.map +1 -0
  469. package/dist/schema/ddl/base-strategy.js +240 -0
  470. package/dist/schema/ddl/base-strategy.js.map +1 -0
  471. package/dist/schema/ddl/duckdb-strategy.d.ts +33 -0
  472. package/dist/schema/ddl/duckdb-strategy.d.ts.map +1 -0
  473. package/dist/schema/ddl/duckdb-strategy.js +74 -0
  474. package/dist/schema/ddl/duckdb-strategy.js.map +1 -0
  475. package/dist/schema/ddl/index.d.ts +53 -0
  476. package/dist/schema/ddl/index.d.ts.map +1 -0
  477. package/dist/schema/ddl/index.js +80 -0
  478. package/dist/schema/ddl/index.js.map +1 -0
  479. package/dist/schema/ddl/json-duckdb-strategy.d.ts +8 -0
  480. package/dist/schema/ddl/json-duckdb-strategy.d.ts.map +1 -0
  481. package/dist/schema/ddl/json-duckdb-strategy.js +14 -0
  482. package/dist/schema/ddl/json-duckdb-strategy.js.map +1 -0
  483. package/dist/schema/ddl/postgres-strategy.d.ts +29 -0
  484. package/dist/schema/ddl/postgres-strategy.d.ts.map +1 -0
  485. package/dist/schema/ddl/postgres-strategy.js +102 -0
  486. package/dist/schema/ddl/postgres-strategy.js.map +1 -0
  487. package/dist/schema/ddl/sqlite-strategy.d.ts +38 -0
  488. package/dist/schema/ddl/sqlite-strategy.d.ts.map +1 -0
  489. package/dist/schema/ddl/sqlite-strategy.js +74 -0
  490. package/dist/schema/ddl/sqlite-strategy.js.map +1 -0
  491. package/dist/schema/ddl/types.d.ts +114 -0
  492. package/dist/schema/ddl/types.d.ts.map +1 -0
  493. package/dist/schema/generator.d.ts +176 -0
  494. package/dist/schema/generator.d.ts.map +1 -0
  495. package/dist/schema/generator.js +1076 -0
  496. package/dist/schema/generator.js.map +1 -0
  497. package/dist/schema/index-utils.d.ts +19 -0
  498. package/dist/schema/index-utils.d.ts.map +1 -0
  499. package/dist/schema/index-utils.js +32 -0
  500. package/dist/schema/index-utils.js.map +1 -0
  501. package/dist/schema/index.d.ts +13 -0
  502. package/dist/schema/index.d.ts.map +1 -0
  503. package/dist/schema/override-system.d.ts +43 -0
  504. package/dist/schema/override-system.d.ts.map +1 -0
  505. package/dist/schema/schema-aggregator.d.ts +112 -0
  506. package/dist/schema/schema-aggregator.d.ts.map +1 -0
  507. package/dist/schema/schema-manager.d.ts +95 -0
  508. package/dist/schema/schema-manager.d.ts.map +1 -0
  509. package/dist/schema/schema-manager.js +283 -0
  510. package/dist/schema/schema-manager.js.map +1 -0
  511. package/dist/schema/sql-identifiers.d.ts +107 -0
  512. package/dist/schema/sql-identifiers.d.ts.map +1 -0
  513. package/dist/schema/sql-identifiers.js +190 -0
  514. package/dist/schema/sql-identifiers.js.map +1 -0
  515. package/dist/schema/table-verifier.d.ts +10 -0
  516. package/dist/schema/table-verifier.d.ts.map +1 -0
  517. package/dist/schema/table-verifier.js +37 -0
  518. package/dist/schema/table-verifier.js.map +1 -0
  519. package/dist/schema/types.d.ts +241 -0
  520. package/dist/schema/types.d.ts.map +1 -0
  521. package/dist/schema/utils.d.ts +32 -0
  522. package/dist/schema/utils.d.ts.map +1 -0
  523. package/dist/schema/utils.js +134 -0
  524. package/dist/schema/utils.js.map +1 -0
  525. package/dist/scripts/create-wrappers.js +89 -0
  526. package/dist/scripts/generate-manifest.js +155 -0
  527. package/dist/scripts/generate-test-manifest.js +77 -0
  528. package/dist/scripts/migrate-datetime-to-timestamp.ts +310 -0
  529. package/dist/scripts/prepack.js +49 -0
  530. package/dist/signals/bus.d.ts +64 -0
  531. package/dist/signals/bus.d.ts.map +1 -0
  532. package/dist/signals/bus.js +102 -0
  533. package/dist/signals/bus.js.map +1 -0
  534. package/dist/signals/index.d.ts +11 -0
  535. package/dist/signals/index.d.ts.map +1 -0
  536. package/dist/signals/sanitizer.d.ts +54 -0
  537. package/dist/signals/sanitizer.d.ts.map +1 -0
  538. package/dist/signals/sanitizer.js +111 -0
  539. package/dist/signals/sanitizer.js.map +1 -0
  540. package/dist/smrt-knowledge.json +335 -0
  541. package/dist/system/compatibility.d.ts +8 -0
  542. package/dist/system/compatibility.d.ts.map +1 -0
  543. package/dist/system/compatibility.js +409 -0
  544. package/dist/system/compatibility.js.map +1 -0
  545. package/dist/system/index.d.ts +9 -0
  546. package/dist/system/index.d.ts.map +1 -0
  547. package/dist/system/schema.d.ts +69 -0
  548. package/dist/system/schema.d.ts.map +1 -0
  549. package/dist/system/schema.js +271 -0
  550. package/dist/system/schema.js.map +1 -0
  551. package/dist/system/types.d.ts +135 -0
  552. package/dist/system/types.d.ts.map +1 -0
  553. package/dist/system-fields.d.ts +44 -0
  554. package/dist/system-fields.d.ts.map +1 -0
  555. package/dist/system-fields.js +55 -0
  556. package/dist/system-fields.js.map +1 -0
  557. package/dist/table-cache.d.ts +28 -0
  558. package/dist/table-cache.d.ts.map +1 -0
  559. package/dist/table-cache.js +21 -0
  560. package/dist/table-cache.js.map +1 -0
  561. package/dist/test-utils.d.ts +140 -0
  562. package/dist/test-utils.d.ts.map +1 -0
  563. package/dist/testing/database.d.ts +73 -0
  564. package/dist/testing/database.d.ts.map +1 -0
  565. package/dist/testing/database.js +204 -0
  566. package/dist/testing/database.js.map +1 -0
  567. package/dist/testing/index.d.ts +21 -0
  568. package/dist/testing/index.d.ts.map +1 -0
  569. package/dist/testing.d.ts +6 -0
  570. package/dist/testing.d.ts.map +1 -0
  571. package/dist/testing.js +5 -0
  572. package/dist/testing.js.map +1 -0
  573. package/dist/tools/index.d.ts +8 -0
  574. package/dist/tools/index.d.ts.map +1 -0
  575. package/dist/tools/tool-executor.d.ts +101 -0
  576. package/dist/tools/tool-executor.d.ts.map +1 -0
  577. package/dist/tools/tool-executor.js +142 -0
  578. package/dist/tools/tool-executor.js.map +1 -0
  579. package/dist/tools/tool-generator.d.ts +54 -0
  580. package/dist/tools/tool-generator.d.ts.map +1 -0
  581. package/dist/tools/tool-generator.js +121 -0
  582. package/dist/tools/tool-generator.js.map +1 -0
  583. package/dist/utils/chunk.d.ts +32 -0
  584. package/dist/utils/chunk.d.ts.map +1 -0
  585. package/dist/utils/chunk.js +14 -0
  586. package/dist/utils/chunk.js.map +1 -0
  587. package/dist/utils/import-workspace-module.d.ts +8 -0
  588. package/dist/utils/import-workspace-module.d.ts.map +1 -0
  589. package/dist/utils/import-workspace-module.js +81 -0
  590. package/dist/utils/import-workspace-module.js.map +1 -0
  591. package/dist/utils/json.d.ts +102 -0
  592. package/dist/utils/json.d.ts.map +1 -0
  593. package/dist/utils/json.js +43 -0
  594. package/dist/utils/json.js.map +1 -0
  595. package/dist/utils/lru-cache.d.ts +69 -0
  596. package/dist/utils/lru-cache.d.ts.map +1 -0
  597. package/dist/utils/lru-cache.js +100 -0
  598. package/dist/utils/lru-cache.js.map +1 -0
  599. package/dist/utils/naming.d.ts +16 -0
  600. package/dist/utils/naming.d.ts.map +1 -0
  601. package/dist/utils/naming.js +23 -0
  602. package/dist/utils/naming.js.map +1 -0
  603. package/dist/utils/qualified-names.d.ts +122 -0
  604. package/dist/utils/qualified-names.d.ts.map +1 -0
  605. package/dist/utils/qualified-names.js +82 -0
  606. package/dist/utils/qualified-names.js.map +1 -0
  607. package/dist/utils/scanner-module.d.ts +37 -0
  608. package/dist/utils/scanner-module.d.ts.map +1 -0
  609. package/dist/utils.d.ts +177 -0
  610. package/dist/utils.d.ts.map +1 -0
  611. package/dist/utils.js +185 -0
  612. package/dist/utils.js.map +1 -0
  613. package/dist/vite-plugin/import-build-aware.d.ts +68 -0
  614. package/dist/vite-plugin/import-build-aware.d.ts.map +1 -0
  615. package/dist/vite-plugin/import-build-aware.js +72 -0
  616. package/dist/vite-plugin/import-build-aware.js.map +1 -0
  617. package/dist/vite-plugin/index.d.ts +59 -0
  618. package/dist/vite-plugin/index.d.ts.map +1 -0
  619. package/dist/vite-plugin/index.js +1400 -0
  620. package/dist/vite-plugin/index.js.map +1 -0
  621. package/dist/vite-plugin/sveltekit-generator.d.ts +66 -0
  622. package/dist/vite-plugin/sveltekit-generator.d.ts.map +1 -0
  623. package/dist/vite-plugin/sveltekit-generator.js +1375 -0
  624. package/dist/vite-plugin/sveltekit-generator.js.map +1 -0
  625. package/dist/vite-plugin/templates/default-ui.ts +432 -0
  626. package/dist/vite-plugin/templates/default.html +206 -0
  627. package/dist/vite-plugin.d.ts +8 -0
  628. package/dist/vite-plugin.d.ts.map +1 -0
  629. package/dist/vite-plugin.js +11 -0
  630. package/dist/vite-plugin.js.map +1 -0
  631. package/package.json +208 -0
@@ -0,0 +1,824 @@
1
+ import { expand } from "../../../../../brace-expansion@5.0.5/node_modules/brace-expansion/dist/esm/index.js";
2
+ import { assertValidPattern } from "./assert-valid-pattern.js";
3
+ import { AST } from "./ast.js";
4
+ import { escape } from "./escape.js";
5
+ import { unescape } from "./unescape.js";
6
+ const minimatch = (p, pattern, options = {}) => {
7
+ assertValidPattern(pattern);
8
+ if (!options.nocomment && pattern.charAt(0) === "#") {
9
+ return false;
10
+ }
11
+ return new Minimatch(pattern, options).match(p);
12
+ };
13
+ const starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
14
+ const starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
15
+ const starDotExtTestDot = (ext2) => (f) => f.endsWith(ext2);
16
+ const starDotExtTestNocase = (ext2) => {
17
+ ext2 = ext2.toLowerCase();
18
+ return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext2);
19
+ };
20
+ const starDotExtTestNocaseDot = (ext2) => {
21
+ ext2 = ext2.toLowerCase();
22
+ return (f) => f.toLowerCase().endsWith(ext2);
23
+ };
24
+ const starDotStarRE = /^\*+\.\*+$/;
25
+ const starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
26
+ const starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
27
+ const dotStarRE = /^\.\*+$/;
28
+ const dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
29
+ const starRE = /^\*+$/;
30
+ const starTest = (f) => f.length !== 0 && !f.startsWith(".");
31
+ const starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
32
+ const qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
33
+ const qmarksTestNocase = ([$0, ext2 = ""]) => {
34
+ const noext = qmarksTestNoExt([$0]);
35
+ if (!ext2)
36
+ return noext;
37
+ ext2 = ext2.toLowerCase();
38
+ return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
39
+ };
40
+ const qmarksTestNocaseDot = ([$0, ext2 = ""]) => {
41
+ const noext = qmarksTestNoExtDot([$0]);
42
+ if (!ext2)
43
+ return noext;
44
+ ext2 = ext2.toLowerCase();
45
+ return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
46
+ };
47
+ const qmarksTestDot = ([$0, ext2 = ""]) => {
48
+ const noext = qmarksTestNoExtDot([$0]);
49
+ return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
50
+ };
51
+ const qmarksTest = ([$0, ext2 = ""]) => {
52
+ const noext = qmarksTestNoExt([$0]);
53
+ return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
54
+ };
55
+ const qmarksTestNoExt = ([$0]) => {
56
+ const len = $0.length;
57
+ return (f) => f.length === len && !f.startsWith(".");
58
+ };
59
+ const qmarksTestNoExtDot = ([$0]) => {
60
+ const len = $0.length;
61
+ return (f) => f.length === len && f !== "." && f !== "..";
62
+ };
63
+ const defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
64
+ const path = {
65
+ win32: { sep: "\\" },
66
+ posix: { sep: "/" }
67
+ };
68
+ const sep = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
69
+ minimatch.sep = sep;
70
+ const GLOBSTAR = /* @__PURE__ */ Symbol("globstar **");
71
+ minimatch.GLOBSTAR = GLOBSTAR;
72
+ const qmark = "[^/]";
73
+ const star = qmark + "*?";
74
+ const twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
75
+ const twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
76
+ const filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
77
+ minimatch.filter = filter;
78
+ const ext = (a, b = {}) => Object.assign({}, a, b);
79
+ const defaults = (def) => {
80
+ if (!def || typeof def !== "object" || !Object.keys(def).length) {
81
+ return minimatch;
82
+ }
83
+ const orig = minimatch;
84
+ const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
85
+ return Object.assign(m, {
86
+ Minimatch: class Minimatch extends orig.Minimatch {
87
+ constructor(pattern, options = {}) {
88
+ super(pattern, ext(def, options));
89
+ }
90
+ static defaults(options) {
91
+ return orig.defaults(ext(def, options)).Minimatch;
92
+ }
93
+ },
94
+ AST: class AST extends orig.AST {
95
+ /* c8 ignore start */
96
+ constructor(type, parent, options = {}) {
97
+ super(type, parent, ext(def, options));
98
+ }
99
+ /* c8 ignore stop */
100
+ static fromGlob(pattern, options = {}) {
101
+ return orig.AST.fromGlob(pattern, ext(def, options));
102
+ }
103
+ },
104
+ unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
105
+ escape: (s, options = {}) => orig.escape(s, ext(def, options)),
106
+ filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
107
+ defaults: (options) => orig.defaults(ext(def, options)),
108
+ makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
109
+ braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
110
+ match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
111
+ sep: orig.sep,
112
+ GLOBSTAR
113
+ });
114
+ };
115
+ minimatch.defaults = defaults;
116
+ const braceExpand = (pattern, options = {}) => {
117
+ assertValidPattern(pattern);
118
+ if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
119
+ return [pattern];
120
+ }
121
+ return expand(pattern, { max: options.braceExpandMax });
122
+ };
123
+ minimatch.braceExpand = braceExpand;
124
+ const makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
125
+ minimatch.makeRe = makeRe;
126
+ const match = (list, pattern, options = {}) => {
127
+ const mm = new Minimatch(pattern, options);
128
+ list = list.filter((f) => mm.match(f));
129
+ if (mm.options.nonull && !list.length) {
130
+ list.push(pattern);
131
+ }
132
+ return list;
133
+ };
134
+ minimatch.match = match;
135
+ const globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
136
+ const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
137
+ class Minimatch {
138
+ options;
139
+ set;
140
+ pattern;
141
+ windowsPathsNoEscape;
142
+ nonegate;
143
+ negate;
144
+ comment;
145
+ empty;
146
+ preserveMultipleSlashes;
147
+ partial;
148
+ globSet;
149
+ globParts;
150
+ nocase;
151
+ isWindows;
152
+ platform;
153
+ windowsNoMagicRoot;
154
+ maxGlobstarRecursion;
155
+ regexp;
156
+ constructor(pattern, options = {}) {
157
+ assertValidPattern(pattern);
158
+ options = options || {};
159
+ this.options = options;
160
+ this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200;
161
+ this.pattern = pattern;
162
+ this.platform = options.platform || defaultPlatform;
163
+ this.isWindows = this.platform === "win32";
164
+ const awe = "allowWindowsEscape";
165
+ this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options[awe] === false;
166
+ if (this.windowsPathsNoEscape) {
167
+ this.pattern = this.pattern.replace(/\\/g, "/");
168
+ }
169
+ this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
170
+ this.regexp = null;
171
+ this.negate = false;
172
+ this.nonegate = !!options.nonegate;
173
+ this.comment = false;
174
+ this.empty = false;
175
+ this.partial = !!options.partial;
176
+ this.nocase = !!this.options.nocase;
177
+ this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
178
+ this.globSet = [];
179
+ this.globParts = [];
180
+ this.set = [];
181
+ this.make();
182
+ }
183
+ hasMagic() {
184
+ if (this.options.magicalBraces && this.set.length > 1) {
185
+ return true;
186
+ }
187
+ for (const pattern of this.set) {
188
+ for (const part of pattern) {
189
+ if (typeof part !== "string")
190
+ return true;
191
+ }
192
+ }
193
+ return false;
194
+ }
195
+ debug(..._) {
196
+ }
197
+ make() {
198
+ const pattern = this.pattern;
199
+ const options = this.options;
200
+ if (!options.nocomment && pattern.charAt(0) === "#") {
201
+ this.comment = true;
202
+ return;
203
+ }
204
+ if (!pattern) {
205
+ this.empty = true;
206
+ return;
207
+ }
208
+ this.parseNegate();
209
+ this.globSet = [...new Set(this.braceExpand())];
210
+ if (options.debug) {
211
+ this.debug = (...args) => console.error(...args);
212
+ }
213
+ this.debug(this.pattern, this.globSet);
214
+ const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
215
+ this.globParts = this.preprocess(rawGlobParts);
216
+ this.debug(this.pattern, this.globParts);
217
+ let set = this.globParts.map((s, _, __) => {
218
+ if (this.isWindows && this.windowsNoMagicRoot) {
219
+ const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
220
+ const isDrive = /^[a-z]:/i.test(s[0]);
221
+ if (isUNC) {
222
+ return [
223
+ ...s.slice(0, 4),
224
+ ...s.slice(4).map((ss) => this.parse(ss))
225
+ ];
226
+ } else if (isDrive) {
227
+ return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
228
+ }
229
+ }
230
+ return s.map((ss) => this.parse(ss));
231
+ });
232
+ this.debug(this.pattern, set);
233
+ this.set = set.filter((s) => s.indexOf(false) === -1);
234
+ if (this.isWindows) {
235
+ for (let i = 0; i < this.set.length; i++) {
236
+ const p = this.set[i];
237
+ if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) {
238
+ p[2] = "?";
239
+ }
240
+ }
241
+ }
242
+ this.debug(this.pattern, this.set);
243
+ }
244
+ // various transforms to equivalent pattern sets that are
245
+ // faster to process in a filesystem walk. The goal is to
246
+ // eliminate what we can, and push all ** patterns as far
247
+ // to the right as possible, even if it increases the number
248
+ // of patterns that we have to process.
249
+ preprocess(globParts) {
250
+ if (this.options.noglobstar) {
251
+ for (let i = 0; i < globParts.length; i++) {
252
+ for (let j = 0; j < globParts[i].length; j++) {
253
+ if (globParts[i][j] === "**") {
254
+ globParts[i][j] = "*";
255
+ }
256
+ }
257
+ }
258
+ }
259
+ const { optimizationLevel = 1 } = this.options;
260
+ if (optimizationLevel >= 2) {
261
+ globParts = this.firstPhasePreProcess(globParts);
262
+ globParts = this.secondPhasePreProcess(globParts);
263
+ } else if (optimizationLevel >= 1) {
264
+ globParts = this.levelOneOptimize(globParts);
265
+ } else {
266
+ globParts = this.adjascentGlobstarOptimize(globParts);
267
+ }
268
+ return globParts;
269
+ }
270
+ // just get rid of adjascent ** portions
271
+ adjascentGlobstarOptimize(globParts) {
272
+ return globParts.map((parts) => {
273
+ let gs = -1;
274
+ while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
275
+ let i = gs;
276
+ while (parts[i + 1] === "**") {
277
+ i++;
278
+ }
279
+ if (i !== gs) {
280
+ parts.splice(gs, i - gs);
281
+ }
282
+ }
283
+ return parts;
284
+ });
285
+ }
286
+ // get rid of adjascent ** and resolve .. portions
287
+ levelOneOptimize(globParts) {
288
+ return globParts.map((parts) => {
289
+ parts = parts.reduce((set, part) => {
290
+ const prev = set[set.length - 1];
291
+ if (part === "**" && prev === "**") {
292
+ return set;
293
+ }
294
+ if (part === "..") {
295
+ if (prev && prev !== ".." && prev !== "." && prev !== "**") {
296
+ set.pop();
297
+ return set;
298
+ }
299
+ }
300
+ set.push(part);
301
+ return set;
302
+ }, []);
303
+ return parts.length === 0 ? [""] : parts;
304
+ });
305
+ }
306
+ levelTwoFileOptimize(parts) {
307
+ if (!Array.isArray(parts)) {
308
+ parts = this.slashSplit(parts);
309
+ }
310
+ let didSomething = false;
311
+ do {
312
+ didSomething = false;
313
+ if (!this.preserveMultipleSlashes) {
314
+ for (let i = 1; i < parts.length - 1; i++) {
315
+ const p = parts[i];
316
+ if (i === 1 && p === "" && parts[0] === "")
317
+ continue;
318
+ if (p === "." || p === "") {
319
+ didSomething = true;
320
+ parts.splice(i, 1);
321
+ i--;
322
+ }
323
+ }
324
+ if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
325
+ didSomething = true;
326
+ parts.pop();
327
+ }
328
+ }
329
+ let dd = 0;
330
+ while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
331
+ const p = parts[dd - 1];
332
+ if (p && p !== "." && p !== ".." && p !== "**") {
333
+ didSomething = true;
334
+ parts.splice(dd - 1, 2);
335
+ dd -= 2;
336
+ }
337
+ }
338
+ } while (didSomething);
339
+ return parts.length === 0 ? [""] : parts;
340
+ }
341
+ // First phase: single-pattern processing
342
+ // <pre> is 1 or more portions
343
+ // <rest> is 1 or more portions
344
+ // <p> is any portion other than ., .., '', or **
345
+ // <e> is . or ''
346
+ //
347
+ // **/.. is *brutal* for filesystem walking performance, because
348
+ // it effectively resets the recursive walk each time it occurs,
349
+ // and ** cannot be reduced out by a .. pattern part like a regexp
350
+ // or most strings (other than .., ., and '') can be.
351
+ //
352
+ // <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
353
+ // <pre>/<e>/<rest> -> <pre>/<rest>
354
+ // <pre>/<p>/../<rest> -> <pre>/<rest>
355
+ // **/**/<rest> -> **/<rest>
356
+ //
357
+ // **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
358
+ // this WOULD be allowed if ** did follow symlinks, or * didn't
359
+ firstPhasePreProcess(globParts) {
360
+ let didSomething = false;
361
+ do {
362
+ didSomething = false;
363
+ for (let parts of globParts) {
364
+ let gs = -1;
365
+ while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
366
+ let gss = gs;
367
+ while (parts[gss + 1] === "**") {
368
+ gss++;
369
+ }
370
+ if (gss > gs) {
371
+ parts.splice(gs + 1, gss - gs);
372
+ }
373
+ let next = parts[gs + 1];
374
+ const p = parts[gs + 2];
375
+ const p2 = parts[gs + 3];
376
+ if (next !== "..")
377
+ continue;
378
+ if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") {
379
+ continue;
380
+ }
381
+ didSomething = true;
382
+ parts.splice(gs, 1);
383
+ const other = parts.slice(0);
384
+ other[gs] = "**";
385
+ globParts.push(other);
386
+ gs--;
387
+ }
388
+ if (!this.preserveMultipleSlashes) {
389
+ for (let i = 1; i < parts.length - 1; i++) {
390
+ const p = parts[i];
391
+ if (i === 1 && p === "" && parts[0] === "")
392
+ continue;
393
+ if (p === "." || p === "") {
394
+ didSomething = true;
395
+ parts.splice(i, 1);
396
+ i--;
397
+ }
398
+ }
399
+ if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
400
+ didSomething = true;
401
+ parts.pop();
402
+ }
403
+ }
404
+ let dd = 0;
405
+ while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
406
+ const p = parts[dd - 1];
407
+ if (p && p !== "." && p !== ".." && p !== "**") {
408
+ didSomething = true;
409
+ const needDot = dd === 1 && parts[dd + 1] === "**";
410
+ const splin = needDot ? ["."] : [];
411
+ parts.splice(dd - 1, 2, ...splin);
412
+ if (parts.length === 0)
413
+ parts.push("");
414
+ dd -= 2;
415
+ }
416
+ }
417
+ }
418
+ } while (didSomething);
419
+ return globParts;
420
+ }
421
+ // second phase: multi-pattern dedupes
422
+ // {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
423
+ // {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
424
+ // {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
425
+ //
426
+ // {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
427
+ // ^-- not valid because ** doens't follow symlinks
428
+ secondPhasePreProcess(globParts) {
429
+ for (let i = 0; i < globParts.length - 1; i++) {
430
+ for (let j = i + 1; j < globParts.length; j++) {
431
+ const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes);
432
+ if (matched) {
433
+ globParts[i] = [];
434
+ globParts[j] = matched;
435
+ break;
436
+ }
437
+ }
438
+ }
439
+ return globParts.filter((gs) => gs.length);
440
+ }
441
+ partsMatch(a, b, emptyGSMatch = false) {
442
+ let ai = 0;
443
+ let bi = 0;
444
+ let result = [];
445
+ let which = "";
446
+ while (ai < a.length && bi < b.length) {
447
+ if (a[ai] === b[bi]) {
448
+ result.push(which === "b" ? b[bi] : a[ai]);
449
+ ai++;
450
+ bi++;
451
+ } else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
452
+ result.push(a[ai]);
453
+ ai++;
454
+ } else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
455
+ result.push(b[bi]);
456
+ bi++;
457
+ } else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
458
+ if (which === "b")
459
+ return false;
460
+ which = "a";
461
+ result.push(a[ai]);
462
+ ai++;
463
+ bi++;
464
+ } else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
465
+ if (which === "a")
466
+ return false;
467
+ which = "b";
468
+ result.push(b[bi]);
469
+ ai++;
470
+ bi++;
471
+ } else {
472
+ return false;
473
+ }
474
+ }
475
+ return a.length === b.length && result;
476
+ }
477
+ parseNegate() {
478
+ if (this.nonegate)
479
+ return;
480
+ const pattern = this.pattern;
481
+ let negate = false;
482
+ let negateOffset = 0;
483
+ for (let i = 0; i < pattern.length && pattern.charAt(i) === "!"; i++) {
484
+ negate = !negate;
485
+ negateOffset++;
486
+ }
487
+ if (negateOffset)
488
+ this.pattern = pattern.slice(negateOffset);
489
+ this.negate = negate;
490
+ }
491
+ // set partial to true to test if, for example,
492
+ // "/a/b" matches the start of "/*/b/*/d"
493
+ // Partial means, if you run out of file before you run
494
+ // out of pattern, then that's fine, as long as all
495
+ // the parts match.
496
+ matchOne(file, pattern, partial = false) {
497
+ let fileStartIndex = 0;
498
+ let patternStartIndex = 0;
499
+ if (this.isWindows) {
500
+ const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
501
+ const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
502
+ const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
503
+ const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
504
+ const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
505
+ const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
506
+ if (typeof fdi === "number" && typeof pdi === "number") {
507
+ const [fd, pd] = [
508
+ file[fdi],
509
+ pattern[pdi]
510
+ ];
511
+ if (fd.toLowerCase() === pd.toLowerCase()) {
512
+ pattern[pdi] = fd;
513
+ patternStartIndex = pdi;
514
+ fileStartIndex = fdi;
515
+ }
516
+ }
517
+ }
518
+ const { optimizationLevel = 1 } = this.options;
519
+ if (optimizationLevel >= 2) {
520
+ file = this.levelTwoFileOptimize(file);
521
+ }
522
+ if (pattern.includes(GLOBSTAR)) {
523
+ return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
524
+ }
525
+ return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
526
+ }
527
+ #matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
528
+ const firstgs = pattern.indexOf(GLOBSTAR, patternIndex);
529
+ const lastgs = pattern.lastIndexOf(GLOBSTAR);
530
+ const [head, body, tail] = [
531
+ pattern.slice(patternIndex, firstgs),
532
+ pattern.slice(firstgs + 1, lastgs),
533
+ pattern.slice(lastgs + 1)
534
+ ];
535
+ if (head.length) {
536
+ const fileHead = file.slice(fileIndex, fileIndex + head.length);
537
+ if (!this.#matchOne(fileHead, head, partial, 0, 0)) {
538
+ return false;
539
+ }
540
+ fileIndex += head.length;
541
+ patternIndex += head.length;
542
+ }
543
+ let fileTailMatch = 0;
544
+ if (tail.length) {
545
+ if (tail.length + fileIndex > file.length)
546
+ return false;
547
+ let tailStart = file.length - tail.length;
548
+ if (this.#matchOne(file, tail, partial, tailStart, 0)) {
549
+ fileTailMatch = tail.length;
550
+ } else {
551
+ if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) {
552
+ return false;
553
+ }
554
+ tailStart--;
555
+ if (!this.#matchOne(file, tail, partial, tailStart, 0)) {
556
+ return false;
557
+ }
558
+ fileTailMatch = tail.length + 1;
559
+ }
560
+ }
561
+ if (!body.length) {
562
+ let sawSome = !!fileTailMatch;
563
+ for (let i2 = fileIndex; i2 < file.length - fileTailMatch; i2++) {
564
+ const f = String(file[i2]);
565
+ sawSome = true;
566
+ if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
567
+ return false;
568
+ }
569
+ }
570
+ return sawSome;
571
+ }
572
+ const bodySegments = [[[], 0]];
573
+ let currentBody = bodySegments[0];
574
+ let nonGsParts = 0;
575
+ const nonGsPartsSums = [0];
576
+ for (const b of body) {
577
+ if (b === GLOBSTAR) {
578
+ nonGsPartsSums.push(nonGsParts);
579
+ currentBody = [[], 0];
580
+ bodySegments.push(currentBody);
581
+ } else {
582
+ currentBody[0].push(b);
583
+ nonGsParts++;
584
+ }
585
+ }
586
+ let i = bodySegments.length - 1;
587
+ const fileLength = file.length - fileTailMatch;
588
+ for (const b of bodySegments) {
589
+ b[1] = fileLength - (nonGsPartsSums[i--] + b[0].length);
590
+ }
591
+ return !!this.#matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
592
+ }
593
+ // return false for "nope, not matching"
594
+ // return null for "not matching, cannot keep trying"
595
+ #matchGlobStarBodySections(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
596
+ const bs = bodySegments[bodyIndex];
597
+ if (!bs) {
598
+ for (let i = fileIndex; i < file.length; i++) {
599
+ sawTail = true;
600
+ const f = file[i];
601
+ if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
602
+ return false;
603
+ }
604
+ }
605
+ return sawTail;
606
+ }
607
+ const [body, after] = bs;
608
+ while (fileIndex <= after) {
609
+ const m = this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0);
610
+ if (m && globStarDepth < this.maxGlobstarRecursion) {
611
+ const sub = this.#matchGlobStarBodySections(file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
612
+ if (sub !== false) {
613
+ return sub;
614
+ }
615
+ }
616
+ const f = file[fileIndex];
617
+ if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
618
+ return false;
619
+ }
620
+ fileIndex++;
621
+ }
622
+ return null;
623
+ }
624
+ #matchOne(file, pattern, partial, fileIndex, patternIndex) {
625
+ let fi;
626
+ let pi;
627
+ let pl;
628
+ let fl;
629
+ for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
630
+ this.debug("matchOne loop");
631
+ let p = pattern[pi];
632
+ let f = file[fi];
633
+ this.debug(pattern, p, f);
634
+ if (p === false || p === GLOBSTAR) {
635
+ return false;
636
+ }
637
+ let hit;
638
+ if (typeof p === "string") {
639
+ hit = f === p;
640
+ this.debug("string match", p, f, hit);
641
+ } else {
642
+ hit = p.test(f);
643
+ this.debug("pattern match", p, f, hit);
644
+ }
645
+ if (!hit)
646
+ return false;
647
+ }
648
+ if (fi === fl && pi === pl) {
649
+ return true;
650
+ } else if (fi === fl) {
651
+ return partial;
652
+ } else if (pi === pl) {
653
+ return fi === fl - 1 && file[fi] === "";
654
+ } else {
655
+ throw new Error("wtf?");
656
+ }
657
+ }
658
+ braceExpand() {
659
+ return braceExpand(this.pattern, this.options);
660
+ }
661
+ parse(pattern) {
662
+ assertValidPattern(pattern);
663
+ const options = this.options;
664
+ if (pattern === "**")
665
+ return GLOBSTAR;
666
+ if (pattern === "")
667
+ return "";
668
+ let m;
669
+ let fastTest = null;
670
+ if (m = pattern.match(starRE)) {
671
+ fastTest = options.dot ? starTestDot : starTest;
672
+ } else if (m = pattern.match(starDotExtRE)) {
673
+ fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
674
+ } else if (m = pattern.match(qmarksRE)) {
675
+ fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
676
+ } else if (m = pattern.match(starDotStarRE)) {
677
+ fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
678
+ } else if (m = pattern.match(dotStarRE)) {
679
+ fastTest = dotStarTest;
680
+ }
681
+ const re = AST.fromGlob(pattern, this.options).toMMPattern();
682
+ if (fastTest && typeof re === "object") {
683
+ Reflect.defineProperty(re, "test", { value: fastTest });
684
+ }
685
+ return re;
686
+ }
687
+ makeRe() {
688
+ if (this.regexp || this.regexp === false)
689
+ return this.regexp;
690
+ const set = this.set;
691
+ if (!set.length) {
692
+ this.regexp = false;
693
+ return this.regexp;
694
+ }
695
+ const options = this.options;
696
+ const twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
697
+ const flags = new Set(options.nocase ? ["i"] : []);
698
+ let re = set.map((pattern) => {
699
+ const pp = pattern.map((p) => {
700
+ if (p instanceof RegExp) {
701
+ for (const f of p.flags.split(""))
702
+ flags.add(f);
703
+ }
704
+ return typeof p === "string" ? regExpEscape(p) : p === GLOBSTAR ? GLOBSTAR : p._src;
705
+ });
706
+ pp.forEach((p, i) => {
707
+ const next = pp[i + 1];
708
+ const prev = pp[i - 1];
709
+ if (p !== GLOBSTAR || prev === GLOBSTAR) {
710
+ return;
711
+ }
712
+ if (prev === void 0) {
713
+ if (next !== void 0 && next !== GLOBSTAR) {
714
+ pp[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
715
+ } else {
716
+ pp[i] = twoStar;
717
+ }
718
+ } else if (next === void 0) {
719
+ pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + ")?";
720
+ } else if (next !== GLOBSTAR) {
721
+ pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
722
+ pp[i + 1] = GLOBSTAR;
723
+ }
724
+ });
725
+ const filtered = pp.filter((p) => p !== GLOBSTAR);
726
+ if (this.partial && filtered.length >= 1) {
727
+ const prefixes = [];
728
+ for (let i = 1; i <= filtered.length; i++) {
729
+ prefixes.push(filtered.slice(0, i).join("/"));
730
+ }
731
+ return "(?:" + prefixes.join("|") + ")";
732
+ }
733
+ return filtered.join("/");
734
+ }).join("|");
735
+ const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
736
+ re = "^" + open + re + close + "$";
737
+ if (this.partial) {
738
+ re = "^(?:\\/|" + open + re.slice(1, -1) + close + ")$";
739
+ }
740
+ if (this.negate)
741
+ re = "^(?!" + re + ").+$";
742
+ try {
743
+ this.regexp = new RegExp(re, [...flags].join(""));
744
+ } catch (ex) {
745
+ this.regexp = false;
746
+ }
747
+ return this.regexp;
748
+ }
749
+ slashSplit(p) {
750
+ if (this.preserveMultipleSlashes) {
751
+ return p.split("/");
752
+ } else if (this.isWindows && /^\/\/[^\/]+/.test(p)) {
753
+ return ["", ...p.split(/\/+/)];
754
+ } else {
755
+ return p.split(/\/+/);
756
+ }
757
+ }
758
+ match(f, partial = this.partial) {
759
+ this.debug("match", f, this.pattern);
760
+ if (this.comment) {
761
+ return false;
762
+ }
763
+ if (this.empty) {
764
+ return f === "";
765
+ }
766
+ if (f === "/" && partial) {
767
+ return true;
768
+ }
769
+ const options = this.options;
770
+ if (this.isWindows) {
771
+ f = f.split("\\").join("/");
772
+ }
773
+ const ff = this.slashSplit(f);
774
+ this.debug(this.pattern, "split", ff);
775
+ const set = this.set;
776
+ this.debug(this.pattern, "set", set);
777
+ let filename = ff[ff.length - 1];
778
+ if (!filename) {
779
+ for (let i = ff.length - 2; !filename && i >= 0; i--) {
780
+ filename = ff[i];
781
+ }
782
+ }
783
+ for (let i = 0; i < set.length; i++) {
784
+ const pattern = set[i];
785
+ let file = ff;
786
+ if (options.matchBase && pattern.length === 1) {
787
+ file = [filename];
788
+ }
789
+ const hit = this.matchOne(file, pattern, partial);
790
+ if (hit) {
791
+ if (options.flipNegate) {
792
+ return true;
793
+ }
794
+ return !this.negate;
795
+ }
796
+ }
797
+ if (options.flipNegate) {
798
+ return false;
799
+ }
800
+ return this.negate;
801
+ }
802
+ static defaults(def) {
803
+ return minimatch.defaults(def).Minimatch;
804
+ }
805
+ }
806
+ minimatch.AST = AST;
807
+ minimatch.Minimatch = Minimatch;
808
+ minimatch.escape = escape;
809
+ minimatch.unescape = unescape;
810
+ export {
811
+ AST,
812
+ GLOBSTAR,
813
+ Minimatch,
814
+ braceExpand,
815
+ defaults,
816
+ escape,
817
+ filter,
818
+ makeRe,
819
+ match,
820
+ minimatch,
821
+ sep,
822
+ unescape
823
+ };
824
+ //# sourceMappingURL=index.js.map