@unbrained/pm-cli 2026.11.16 → 2026.11.18

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 (434) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/cli/main.js +2 -2
  3. package/dist/cli/register-mutation.js +3 -2
  4. package/dist/cli/runtime/invocation-rewrites.js +2 -0
  5. package/dist/cli-bundle/bundle-manifest.json +1 -1
  6. package/dist/cli-bundle/chunks/chunk-2VH6COJE.js +125 -0
  7. package/dist/cli-bundle/chunks/{chunk-NHNM3GIP.js → chunk-5OFMWP3Q.js} +3 -3
  8. package/dist/cli-bundle/chunks/chunk-7ETRLLK3.js +31 -0
  9. package/dist/cli-bundle/chunks/chunk-7LCJA54R.js +2 -0
  10. package/dist/cli-bundle/chunks/chunk-7UUPLMCU.js +115 -0
  11. package/dist/cli-bundle/chunks/chunk-AGU7632B.js +3 -0
  12. package/dist/cli-bundle/chunks/{chunk-J257NZRD.js → chunk-CGTVDSAR.js} +11 -11
  13. package/dist/cli-bundle/chunks/chunk-CR5GC3VO.js +9 -0
  14. package/dist/cli-bundle/chunks/{chunk-KGOGLKL2.js → chunk-FJQCORYR.js} +2 -2
  15. package/dist/cli-bundle/chunks/chunk-H64BNM4A.js +8 -0
  16. package/dist/cli-bundle/chunks/{chunk-2D26HRXB.js → chunk-HQYIKAC6.js} +2 -2
  17. package/dist/cli-bundle/chunks/chunk-JBPXNG6P.js +2 -0
  18. package/dist/cli-bundle/chunks/{chunk-4I7YG3VZ.js → chunk-L2ZLH3LZ.js} +2 -2
  19. package/dist/cli-bundle/chunks/chunk-LGWP5D7V.js +2 -0
  20. package/dist/cli-bundle/chunks/{chunk-I3T2FVUA.js → chunk-MUGGRKK3.js} +2 -2
  21. package/dist/cli-bundle/chunks/{chunk-FZ4XWWLO.js → chunk-OD2I3SFQ.js} +43 -43
  22. package/dist/cli-bundle/chunks/chunk-QK7RAN7R.js +2 -0
  23. package/dist/cli-bundle/chunks/{chunk-2WNORBVN.js → chunk-S3RMFLEG.js} +83 -83
  24. package/dist/cli-bundle/chunks/chunk-SSZBVRIN.js +6 -0
  25. package/dist/cli-bundle/chunks/chunk-T3E3WNHO.js +2 -0
  26. package/dist/cli-bundle/chunks/{chunk-DZWRNL6R.js → chunk-TA5VN4ME.js} +2 -2
  27. package/dist/cli-bundle/chunks/chunk-TS2CZE3O.js +2 -0
  28. package/dist/cli-bundle/chunks/{chunk-F7P42FL5.js → chunk-VETSGCF4.js} +4 -4
  29. package/dist/cli-bundle/chunks/{chunk-VJLZHOTP.js → chunk-WKHS4QC6.js} +2 -2
  30. package/dist/cli-bundle/chunks/chunk-XDIJK6VW.js +8 -0
  31. package/dist/cli-bundle/chunks/{chunk-NYN5OR2T.js → chunk-Y4LXVPA5.js} +2 -2
  32. package/dist/cli-bundle/chunks/chunk-YJI2Y5N6.js +2 -0
  33. package/dist/cli-bundle/chunks/{indexed-receipt-blobs-HNLN6UXH.js → indexed-receipt-blobs-ELEMA7IW.js} +2 -2
  34. package/dist/cli-bundle/chunks/{item-revision-PSOL5I4H.js → item-revision-BV5BUBCR.js} +2 -2
  35. package/dist/cli-bundle/chunks/item-transaction-E2ST3A3X.js +2 -0
  36. package/dist/cli-bundle/chunks/{mutation-actor-BDBBH3ZS.js → mutation-actor-DDYJW5B4.js} +2 -2
  37. package/dist/cli-bundle/chunks/mutation-admission-5AWMXMCB.js +2 -0
  38. package/dist/cli-bundle/chunks/{register-list-query-AESCVO6H.js → register-list-query-RJT7YBRF.js} +2 -2
  39. package/dist/cli-bundle/chunks/register-mutation-6KTMJGYF.js +21 -0
  40. package/dist/cli-bundle/chunks/register-operations-W24TA3HZ.js +2 -0
  41. package/dist/cli-bundle/chunks/register-setup-QK67WUX6.js +2 -0
  42. package/dist/cli-bundle/chunks/{settlement-hook-MVVVUIVZ.js → settlement-hook-E5LHZ4RD.js} +2 -2
  43. package/dist/cli-bundle/chunks/{stage-RMU3JAWM.js → stage-XGWW3T64.js} +2 -2
  44. package/dist/cli-bundle/focused-chunks/chunk-3H3SVHAT.js +2 -0
  45. package/dist/cli-bundle/focused-chunks/{chunk-DFBHW7HP.js → chunk-5JVB42Z7.js} +3 -3
  46. package/dist/cli-bundle/focused-chunks/{chunk-ONM2R32I.js → chunk-6OZ7BKWJ.js} +54 -54
  47. package/dist/cli-bundle/focused-chunks/{chunk-HHMMIHZP.js → chunk-7RF2YPZ5.js} +2 -2
  48. package/dist/cli-bundle/focused-chunks/chunk-7Z2NYAK4.js +2 -0
  49. package/dist/cli-bundle/focused-chunks/chunk-A2CLYPDA.js +102 -0
  50. package/dist/cli-bundle/focused-chunks/{chunk-7SEPCQV2.js → chunk-DH4DHL6V.js} +2 -2
  51. package/dist/cli-bundle/focused-chunks/{chunk-UBBTBNUY.js → chunk-DWCFZVT2.js} +2 -2
  52. package/dist/cli-bundle/focused-chunks/{chunk-DZMP3VYQ.js → chunk-EO4XM3XJ.js} +2 -2
  53. package/dist/cli-bundle/focused-chunks/chunk-EZXLY6S4.js +2 -0
  54. package/dist/cli-bundle/focused-chunks/{chunk-KRNF3WTC.js → chunk-FPPYE6CY.js} +2 -2
  55. package/dist/cli-bundle/focused-chunks/chunk-HO2YUD4P.js +91 -0
  56. package/dist/cli-bundle/focused-chunks/{chunk-BEHIMEV2.js → chunk-ICEHI4SN.js} +2 -2
  57. package/dist/cli-bundle/focused-chunks/chunk-IGMFXB5W.js +2 -0
  58. package/dist/cli-bundle/focused-chunks/{chunk-PDXSMSO5.js → chunk-IXYBN6D2.js} +3 -3
  59. package/dist/cli-bundle/focused-chunks/{chunk-PEL4SQXV.js → chunk-LZR3JKYT.js} +2 -2
  60. package/dist/cli-bundle/focused-chunks/chunk-MTBC32ZR.js +8 -0
  61. package/dist/cli-bundle/focused-chunks/chunk-OAIAZHRG.js +2 -0
  62. package/dist/cli-bundle/focused-chunks/{chunk-SFATIM77.js → chunk-ONHUG7IL.js} +9 -9
  63. package/dist/cli-bundle/focused-chunks/chunk-OPY43DNJ.js +2 -0
  64. package/dist/cli-bundle/focused-chunks/chunk-PNCCTZKI.js +44 -0
  65. package/dist/cli-bundle/focused-chunks/chunk-T3NMYMW4.js +27 -0
  66. package/dist/cli-bundle/focused-chunks/chunk-XS2YZCT5.js +2 -0
  67. package/dist/cli-bundle/focused-chunks/chunk-ZFUZ4YYN.js +8 -0
  68. package/dist/cli-bundle/focused-chunks/{indexed-receipt-blobs-ADMQXF3N.js → indexed-receipt-blobs-ZTRFCPH7.js} +2 -2
  69. package/dist/cli-bundle/focused-chunks/item-revision-NS2V4WON.js +2 -0
  70. package/dist/cli-bundle/focused-chunks/item-transaction-NENC4HYI.js +2 -0
  71. package/dist/cli-bundle/focused-chunks/mutation-actor-2SVBO324.js +2 -0
  72. package/dist/cli-bundle/focused-chunks/mutation-admission-DZIBDJAE.js +2 -0
  73. package/dist/cli-bundle/focused-chunks/{settlement-hook-5U2M75BY.js → settlement-hook-OUBUN45C.js} +2 -2
  74. package/dist/cli-bundle/focused-chunks/stage-LVAGKCEE.js +2 -0
  75. package/dist/cli-bundle/main.js +27 -27
  76. package/dist/cli-bundle/sdk-authoring.js +1 -1
  77. package/dist/cli-bundle/sdk-contracts.js +2 -2
  78. package/dist/cli-bundle/sdk-core.js +1 -1
  79. package/dist/cli-bundle/sdk-governance.js +1 -1
  80. package/dist/cli-bundle/sdk-graph.js +1 -1
  81. package/dist/cli-bundle/sdk-merge.js +58 -58
  82. package/dist/cli-bundle/sdk-query.js +1 -1
  83. package/dist/cli-bundle/sdk-runtime.js +1 -1
  84. package/dist/cli-bundle/sdk-testing.js +1 -1
  85. package/dist/cli-bundle/sdk.js +4 -4
  86. package/dist/core/extensions/extension-hook-runtime.d.ts +14 -2
  87. package/dist/core/extensions/extension-hook-runtime.js +1 -1
  88. package/dist/core/extensions/extension-types.d.ts +14 -0
  89. package/dist/core/extensions/extension-types.js +1 -1
  90. package/dist/core/extensions/index.d.ts +1 -1
  91. package/dist/core/extensions/index.js +1 -1
  92. package/dist/core/fs/file-glob.js +2 -0
  93. package/dist/core/policy/workflow-policy-store.js +1 -1
  94. package/dist/core/shared/secret-rules.d.ts +83 -4
  95. package/dist/core/shared/secret-rules.js +5 -4
  96. package/dist/core/store/item-mutation-precondition.d.ts +32 -1
  97. package/dist/core/store/item-mutation-precondition.js +1 -1
  98. package/dist/core/store/item-store.js +1 -1
  99. package/dist/core/store/transaction-coordinator-scope.js +2 -0
  100. package/dist/sdk/authoring.d.ts +1 -1
  101. package/dist/sdk/authoring.js +1 -1
  102. package/dist/sdk/cli-bootstrap.js +1 -1
  103. package/dist/sdk/item-transaction.js +1 -1
  104. package/dist/sdk/lifecycle/copy.js +1 -1
  105. package/dist/sdk/lifecycle/create.js +1 -1
  106. package/dist/sdk/lifecycle/restore.js +1 -1
  107. package/dist/sdk/linked-artifacts.js +2 -2
  108. package/dist/sdk/mutation-guard.d.ts +25 -4
  109. package/dist/sdk/mutation-guard.js +1 -1
  110. package/dist/sdk/package-import-adapters.d.ts +14 -1
  111. package/dist/sdk/package-import-adapters.js +1 -1
  112. package/dist/sdk/public-surface.json +1 -1
  113. package/dist/sdk/testing.d.ts +21 -3
  114. package/dist/sdk/testing.js +2 -2
  115. package/dist/sdk/workspace-transaction.js +2 -2
  116. package/docs/COMMANDS.md +33 -0
  117. package/docs/DEFECT_RECURRENCE.md +3 -2
  118. package/docs/EXTENSIONS.md +1 -1
  119. package/docs/MIGRATION_CLI_SIMPLIFICATION.md +1 -1
  120. package/docs/MUTATION_INTEGRITY.md +187 -7
  121. package/docs/SDK.md +40 -3
  122. package/docs/WORKFLOW_POLICIES.md +23 -0
  123. package/marketplace.json +1 -1
  124. package/node_modules/@opentelemetry/core/build/esm/version.d.ts +1 -1
  125. package/node_modules/@opentelemetry/core/build/esm/version.js +1 -1
  126. package/node_modules/@opentelemetry/core/build/esnext/version.d.ts +1 -1
  127. package/node_modules/@opentelemetry/core/build/esnext/version.js +1 -1
  128. package/node_modules/@opentelemetry/core/build/src/version.d.ts +1 -1
  129. package/node_modules/@opentelemetry/core/build/src/version.js +1 -1
  130. package/node_modules/@opentelemetry/core/package.json +2 -2
  131. package/node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/machine-id/execAsync.d.ts +1 -0
  132. package/node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/machine-id/execAsync.js +1 -0
  133. package/node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/machine-id/getMachineId-bsd.js +3 -2
  134. package/node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/machine-id/getMachineId-darwin.js +3 -2
  135. package/node_modules/@opentelemetry/resources/build/esm/version.d.ts +1 -1
  136. package/node_modules/@opentelemetry/resources/build/esm/version.js +1 -1
  137. package/node_modules/@opentelemetry/resources/build/esnext/detectors/platform/node/machine-id/execAsync.d.ts +1 -0
  138. package/node_modules/@opentelemetry/resources/build/esnext/detectors/platform/node/machine-id/execAsync.js +1 -0
  139. package/node_modules/@opentelemetry/resources/build/esnext/detectors/platform/node/machine-id/getMachineId-bsd.js +3 -2
  140. package/node_modules/@opentelemetry/resources/build/esnext/detectors/platform/node/machine-id/getMachineId-darwin.js +3 -2
  141. package/node_modules/@opentelemetry/resources/build/esnext/version.d.ts +1 -1
  142. package/node_modules/@opentelemetry/resources/build/esnext/version.js +1 -1
  143. package/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/execAsync.d.ts +1 -0
  144. package/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/execAsync.js +2 -1
  145. package/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/getMachineId-bsd.js +2 -1
  146. package/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/getMachineId-darwin.js +2 -1
  147. package/node_modules/@opentelemetry/resources/build/src/version.d.ts +1 -1
  148. package/node_modules/@opentelemetry/resources/build/src/version.js +1 -1
  149. package/node_modules/@opentelemetry/resources/package.json +3 -3
  150. package/node_modules/@opentelemetry/sdk-trace/build/esm/version.d.ts +1 -1
  151. package/node_modules/@opentelemetry/sdk-trace/build/esm/version.js +1 -1
  152. package/node_modules/@opentelemetry/sdk-trace/build/esnext/version.d.ts +1 -1
  153. package/node_modules/@opentelemetry/sdk-trace/build/esnext/version.js +1 -1
  154. package/node_modules/@opentelemetry/sdk-trace/build/src/version.d.ts +1 -1
  155. package/node_modules/@opentelemetry/sdk-trace/build/src/version.js +1 -1
  156. package/node_modules/@opentelemetry/sdk-trace/package.json +5 -5
  157. package/node_modules/@opentelemetry/sdk-trace-base/build/esm/version.d.ts +1 -1
  158. package/node_modules/@opentelemetry/sdk-trace-base/build/esm/version.js +1 -1
  159. package/node_modules/@opentelemetry/sdk-trace-base/build/esnext/version.d.ts +1 -1
  160. package/node_modules/@opentelemetry/sdk-trace-base/build/esnext/version.js +1 -1
  161. package/node_modules/@opentelemetry/sdk-trace-base/build/src/version.d.ts +1 -1
  162. package/node_modules/@opentelemetry/sdk-trace-base/build/src/version.js +1 -1
  163. package/node_modules/@opentelemetry/sdk-trace-base/package.json +7 -7
  164. package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_attributes.cjs +18202 -0
  165. package/node_modules/@opentelemetry/semantic-conventions/{build/src/experimental_attributes.js → dist/experimental_attributes.d.cts} +3328 -1993
  166. package/node_modules/@opentelemetry/semantic-conventions/{build/esnext/experimental_attributes.js → dist/experimental_attributes.d.mts} +3328 -1935
  167. package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_attributes.mjs +16385 -0
  168. package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_events.cjs +325 -0
  169. package/node_modules/@opentelemetry/semantic-conventions/{build/esnext/experimental_events.js → dist/experimental_events.d.cts} +37 -41
  170. package/node_modules/@opentelemetry/semantic-conventions/{build/esm/experimental_events.js → dist/experimental_events.d.mts} +37 -41
  171. package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_events.mjs +295 -0
  172. package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_metrics.cjs +4929 -0
  173. package/node_modules/@opentelemetry/semantic-conventions/{build/esnext/experimental_metrics.js → dist/experimental_metrics.d.cts} +955 -597
  174. package/node_modules/@opentelemetry/semantic-conventions/{build/esm/experimental_metrics.js → dist/experimental_metrics.d.mts} +955 -597
  175. package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_metrics.mjs +4419 -0
  176. package/node_modules/@opentelemetry/semantic-conventions/dist/index-incubating.cjs +2619 -0
  177. package/node_modules/@opentelemetry/semantic-conventions/dist/index-incubating.d.cts +7 -0
  178. package/node_modules/@opentelemetry/semantic-conventions/dist/index-incubating.d.mts +7 -0
  179. package/node_modules/@opentelemetry/semantic-conventions/dist/index-incubating.mjs +7 -0
  180. package/node_modules/@opentelemetry/semantic-conventions/dist/index.cjs +670 -0
  181. package/node_modules/@opentelemetry/semantic-conventions/dist/index.d.cts +6 -0
  182. package/node_modules/@opentelemetry/semantic-conventions/dist/index.d.mts +6 -0
  183. package/node_modules/@opentelemetry/semantic-conventions/dist/index.mjs +6 -0
  184. package/node_modules/@opentelemetry/semantic-conventions/dist/internal/utils.cjs +20 -0
  185. package/node_modules/@opentelemetry/semantic-conventions/dist/internal/utils.mjs +20 -0
  186. package/node_modules/@opentelemetry/semantic-conventions/dist/resource/SemanticResourceAttributes.cjs +1326 -0
  187. package/node_modules/@opentelemetry/semantic-conventions/{build/esnext/resource/SemanticResourceAttributes.d.ts → dist/resource/SemanticResourceAttributes.d.cts} +600 -597
  188. package/node_modules/@opentelemetry/semantic-conventions/{build/src/resource/SemanticResourceAttributes.d.ts → dist/resource/SemanticResourceAttributes.d.mts} +600 -597
  189. package/node_modules/@opentelemetry/semantic-conventions/dist/resource/SemanticResourceAttributes.mjs +1188 -0
  190. package/node_modules/@opentelemetry/semantic-conventions/dist/stable_attributes.cjs +2038 -0
  191. package/node_modules/@opentelemetry/semantic-conventions/{build/esm/stable_attributes.js → dist/stable_attributes.d.cts} +327 -220
  192. package/node_modules/@opentelemetry/semantic-conventions/{build/esnext/stable_attributes.js → dist/stable_attributes.d.mts} +327 -220
  193. package/node_modules/@opentelemetry/semantic-conventions/dist/stable_attributes.mjs +1841 -0
  194. package/node_modules/@opentelemetry/semantic-conventions/dist/stable_events.cjs +9 -0
  195. package/node_modules/@opentelemetry/semantic-conventions/dist/stable_events.d.cts +8 -0
  196. package/node_modules/@opentelemetry/semantic-conventions/dist/stable_events.d.mts +8 -0
  197. package/node_modules/@opentelemetry/semantic-conventions/dist/stable_events.mjs +9 -0
  198. package/node_modules/@opentelemetry/semantic-conventions/dist/stable_metrics.cjs +378 -0
  199. package/node_modules/@opentelemetry/semantic-conventions/{build/src/stable_metrics.js → dist/stable_metrics.d.cts} +69 -63
  200. package/node_modules/@opentelemetry/semantic-conventions/{build/esm/stable_metrics.js → dist/stable_metrics.d.mts} +69 -59
  201. package/node_modules/@opentelemetry/semantic-conventions/dist/stable_metrics.mjs +326 -0
  202. package/node_modules/@opentelemetry/semantic-conventions/dist/trace/SemanticAttributes.cjs +2508 -0
  203. package/node_modules/@opentelemetry/semantic-conventions/{build/esnext/trace/SemanticAttributes.d.ts → dist/trace/SemanticAttributes.d.cts} +1097 -1094
  204. package/node_modules/@opentelemetry/semantic-conventions/{build/src/trace/SemanticAttributes.d.ts → dist/trace/SemanticAttributes.d.mts} +1097 -1094
  205. package/node_modules/@opentelemetry/semantic-conventions/dist/trace/SemanticAttributes.mjs +2236 -0
  206. package/node_modules/@opentelemetry/semantic-conventions/package.json +27 -42
  207. package/node_modules/@sentry/core/build/cjs/client.js +14 -5
  208. package/node_modules/@sentry/core/build/cjs/integrations/express/patch-layer.js +15 -1
  209. package/node_modules/@sentry/core/build/cjs/integrations/http/client-subscriptions.js +10 -1
  210. package/node_modules/@sentry/core/build/cjs/scope.js +0 -1
  211. package/node_modules/@sentry/core/build/cjs/tracing/openai/utils.js +1 -7
  212. package/node_modules/@sentry/core/build/cjs/tracing/sentrySpan.js +11 -0
  213. package/node_modules/@sentry/core/build/cjs/utils/envelope.js +1 -1
  214. package/node_modules/@sentry/core/build/cjs/utils/sql.js +1 -1
  215. package/node_modules/@sentry/core/build/cjs/utils/tunnel.js +9 -0
  216. package/node_modules/@sentry/core/build/cjs/utils/version.js +1 -1
  217. package/node_modules/@sentry/core/build/esm/client.js +14 -5
  218. package/node_modules/@sentry/core/build/esm/integrations/express/patch-layer.js +15 -1
  219. package/node_modules/@sentry/core/build/esm/integrations/http/client-subscriptions.js +10 -1
  220. package/node_modules/@sentry/core/build/esm/package.json +1 -1
  221. package/node_modules/@sentry/core/build/esm/scope.js +0 -1
  222. package/node_modules/@sentry/core/build/esm/tracing/openai/utils.js +1 -7
  223. package/node_modules/@sentry/core/build/esm/tracing/sentrySpan.js +11 -0
  224. package/node_modules/@sentry/core/build/esm/utils/envelope.js +1 -1
  225. package/node_modules/@sentry/core/build/esm/utils/sql.js +1 -1
  226. package/node_modules/@sentry/core/build/esm/utils/tunnel.js +9 -1
  227. package/node_modules/@sentry/core/build/esm/utils/version.js +1 -1
  228. package/node_modules/@sentry/core/build/types/types/datacategory.d.ts +1 -1
  229. package/node_modules/@sentry/core/build/types/utils/tunnel.d.ts +1 -0
  230. package/node_modules/@sentry/core/build/types-ts3.8/types/datacategory.d.ts +1 -1
  231. package/node_modules/@sentry/core/build/types-ts3.8/utils/tunnel.d.ts +1 -0
  232. package/node_modules/@sentry/core/package.json +1 -1
  233. package/node_modules/@sentry/node/build/cjs/integrations/tracing/redis/index.js +1 -1
  234. package/node_modules/@sentry/node/build/esm/package.json +1 -1
  235. package/node_modules/@sentry/node/package.json +6 -6
  236. package/node_modules/@sentry/node-core/build/cjs/integrations/anr/index.js +1 -1
  237. package/node_modules/@sentry/node-core/build/cjs/integrations/contextlines.js +6 -4
  238. package/node_modules/@sentry/node-core/build/cjs/integrations/local-variables/local-variables-async.js +1 -1
  239. package/node_modules/@sentry/node-core/build/cjs/integrations/modules.js +21 -2
  240. package/node_modules/@sentry/node-core/build/cjs/integrations/node-fetch/undici-instrumentation.js +8 -0
  241. package/node_modules/@sentry/node-core/build/esm/integrations/anr/index.js +1 -1
  242. package/node_modules/@sentry/node-core/build/esm/integrations/anr/worker-script.js +2 -2
  243. package/node_modules/@sentry/node-core/build/esm/integrations/contextlines.js +7 -5
  244. package/node_modules/@sentry/node-core/build/esm/integrations/local-variables/local-variables-async.js +1 -1
  245. package/node_modules/@sentry/node-core/build/esm/integrations/local-variables/worker-script.js +1 -1
  246. package/node_modules/@sentry/node-core/build/esm/integrations/node-fetch/undici-instrumentation.js +8 -0
  247. package/node_modules/@sentry/node-core/build/esm/package.json +1 -1
  248. package/node_modules/@sentry/node-core/package.json +9 -9
  249. package/node_modules/@sentry/opentelemetry/build/esm/package.json +1 -1
  250. package/node_modules/@sentry/opentelemetry/package.json +6 -6
  251. package/node_modules/@sentry/server-utils/build/THIRD-PARTY-LICENSES.txt +32 -32
  252. package/node_modules/@sentry/server-utils/build/cjs/integrations/tracing-channel/express/instrumentation.js +12 -1
  253. package/node_modules/@sentry/server-utils/build/esm/integrations/tracing-channel/express/instrumentation.js +13 -2
  254. package/node_modules/@sentry/server-utils/build/esm/package.json +1 -1
  255. package/node_modules/@sentry/server-utils/build/types/integrations/tracing-channel/express/types.d.ts +1 -1
  256. package/node_modules/@sentry/server-utils/build/types-ts3.8/integrations/tracing-channel/express/types.d.ts +1 -1
  257. package/node_modules/@sentry/server-utils/package.json +2 -2
  258. package/node_modules/debug/package.json +1 -1
  259. package/node_modules/es-module-lexer/dist/lexer.asm.js +2 -2
  260. package/node_modules/es-module-lexer/dist/lexer.cjs +1 -1
  261. package/node_modules/es-module-lexer/dist/lexer.js +2 -2
  262. package/node_modules/es-module-lexer/dist/lexer.minimal.asm.js +2 -2
  263. package/node_modules/es-module-lexer/dist/lexer.minimal.cjs +1 -1
  264. package/node_modules/es-module-lexer/dist/lexer.minimal.js +2 -2
  265. package/node_modules/es-module-lexer/package.json +1 -1
  266. package/node_modules/import-in-the-middle/CHANGELOG.md +35 -0
  267. package/node_modules/import-in-the-middle/README.md +15 -1
  268. package/node_modules/import-in-the-middle/create-hook.mjs +370 -155
  269. package/node_modules/import-in-the-middle/index.d.ts +8 -2
  270. package/node_modules/import-in-the-middle/index.js +80 -53
  271. package/node_modules/import-in-the-middle/lib/get-esm-exports.mjs +37 -3
  272. package/node_modules/import-in-the-middle/lib/get-exports.mjs +33 -40
  273. package/node_modules/import-in-the-middle/lib/register.js +81 -16
  274. package/node_modules/import-in-the-middle/package.json +9 -5
  275. package/node_modules/supports-color/browser.js +21 -2
  276. package/node_modules/supports-color/index.js +41 -24
  277. package/node_modules/supports-color/license +1 -1
  278. package/node_modules/supports-color/package.json +11 -6
  279. package/node_modules/supports-color/readme.md +8 -7
  280. package/package.json +4 -6
  281. package/packages/pm-beads/package.json +1 -1
  282. package/packages/pm-calendar/package.json +1 -1
  283. package/packages/pm-command-kit/package.json +1 -1
  284. package/packages/pm-digital-twin/package.json +1 -1
  285. package/packages/pm-governance-audit/package.json +1 -1
  286. package/packages/pm-guide-shell/package.json +1 -1
  287. package/packages/pm-kanban/package.json +1 -1
  288. package/packages/pm-lifecycle-hooks/package.json +1 -1
  289. package/packages/pm-linked-test-adapters/package.json +1 -1
  290. package/packages/pm-search-advanced/package.json +1 -1
  291. package/packages/pm-templates/package.json +1 -1
  292. package/packages/pm-todos/package.json +1 -1
  293. package/packages/pm-vcs/package.json +1 -1
  294. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  295. package/plugins/pm-claude/package.json +1 -1
  296. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  297. package/plugins/pm-codex/package.json +1 -1
  298. package/plugins/pm-codex/plugin.json +1 -1
  299. package/runtime-dependencies.json +1 -1
  300. package/dist/cli-bundle/chunks/chunk-4WIVCOA7.js +0 -2
  301. package/dist/cli-bundle/chunks/chunk-A3WCP4TU.js +0 -6
  302. package/dist/cli-bundle/chunks/chunk-AB5S6TWE.js +0 -124
  303. package/dist/cli-bundle/chunks/chunk-BV7J3LRH.js +0 -114
  304. package/dist/cli-bundle/chunks/chunk-E4BQRZF2.js +0 -10
  305. package/dist/cli-bundle/chunks/chunk-ERD2RYWM.js +0 -31
  306. package/dist/cli-bundle/chunks/chunk-IGEBFNWE.js +0 -2
  307. package/dist/cli-bundle/chunks/chunk-IYICNCK2.js +0 -2
  308. package/dist/cli-bundle/chunks/chunk-JD3XWF66.js +0 -3
  309. package/dist/cli-bundle/chunks/chunk-JLHD7OQ2.js +0 -2
  310. package/dist/cli-bundle/chunks/chunk-LC4DJVXR.js +0 -2
  311. package/dist/cli-bundle/chunks/chunk-OFZQEQ6X.js +0 -2
  312. package/dist/cli-bundle/chunks/chunk-QGL5IAP4.js +0 -8
  313. package/dist/cli-bundle/chunks/chunk-R24NZ2TB.js +0 -8
  314. package/dist/cli-bundle/chunks/chunk-VO2HSB5F.js +0 -2
  315. package/dist/cli-bundle/chunks/item-transaction-55QTCU2M.js +0 -2
  316. package/dist/cli-bundle/chunks/mutation-admission-WUN7JYVJ.js +0 -2
  317. package/dist/cli-bundle/chunks/register-mutation-SKCEP5QU.js +0 -20
  318. package/dist/cli-bundle/chunks/register-operations-ZT4OYCF3.js +0 -2
  319. package/dist/cli-bundle/chunks/register-setup-JVWNS2TY.js +0 -2
  320. package/dist/cli-bundle/focused-chunks/chunk-3WVMEA2A.js +0 -6
  321. package/dist/cli-bundle/focused-chunks/chunk-5UVJOAUP.js +0 -91
  322. package/dist/cli-bundle/focused-chunks/chunk-5WQ3LNUK.js +0 -78
  323. package/dist/cli-bundle/focused-chunks/chunk-6E4X7MQA.js +0 -26
  324. package/dist/cli-bundle/focused-chunks/chunk-7XHE335U.js +0 -2
  325. package/dist/cli-bundle/focused-chunks/chunk-CZFZCSOX.js +0 -2
  326. package/dist/cli-bundle/focused-chunks/chunk-HPC2M6JD.js +0 -6
  327. package/dist/cli-bundle/focused-chunks/chunk-HR5FEUUL.js +0 -2
  328. package/dist/cli-bundle/focused-chunks/chunk-J7ESCE7M.js +0 -24
  329. package/dist/cli-bundle/focused-chunks/chunk-KWZLY35A.js +0 -2
  330. package/dist/cli-bundle/focused-chunks/chunk-M4IA4LC6.js +0 -8
  331. package/dist/cli-bundle/focused-chunks/chunk-NASE6JC2.js +0 -2
  332. package/dist/cli-bundle/focused-chunks/chunk-QJ647CQE.js +0 -2
  333. package/dist/cli-bundle/focused-chunks/chunk-ZCN35TCK.js +0 -2
  334. package/dist/cli-bundle/focused-chunks/chunk-ZSQ2FT22.js +0 -44
  335. package/dist/cli-bundle/focused-chunks/item-revision-GNKYO6GZ.js +0 -2
  336. package/dist/cli-bundle/focused-chunks/item-transaction-AUUQHR5Z.js +0 -2
  337. package/dist/cli-bundle/focused-chunks/mutation-actor-OBRD7HFZ.js +0 -2
  338. package/dist/cli-bundle/focused-chunks/mutation-admission-6TX3EOJX.js +0 -2
  339. package/dist/cli-bundle/focused-chunks/stage-LERF2YJU.js +0 -2
  340. package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_attributes.d.ts +0 -14984
  341. package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_attributes.js +0 -14991
  342. package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_events.d.ts +0 -291
  343. package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_metrics.d.ts +0 -4053
  344. package/node_modules/@opentelemetry/semantic-conventions/build/esm/index-incubating.d.ts +0 -7
  345. package/node_modules/@opentelemetry/semantic-conventions/build/esm/index-incubating.js +0 -13
  346. package/node_modules/@opentelemetry/semantic-conventions/build/esm/index.d.ts +0 -6
  347. package/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js +0 -16
  348. package/node_modules/@opentelemetry/semantic-conventions/build/esm/internal/utils.d.ts +0 -7
  349. package/node_modules/@opentelemetry/semantic-conventions/build/esm/internal/utils.js +0 -23
  350. package/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/SemanticResourceAttributes.d.ts +0 -1453
  351. package/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/SemanticResourceAttributes.js +0 -1250
  352. package/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/index.d.ts +0 -2
  353. package/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/index.js +0 -10
  354. package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.d.ts +0 -1726
  355. package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.d.ts +0 -5
  356. package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.js +0 -12
  357. package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_metrics.d.ts +0 -308
  358. package/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/SemanticAttributes.d.ts +0 -2664
  359. package/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/SemanticAttributes.js +0 -2360
  360. package/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/index.d.ts +0 -2
  361. package/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/index.js +0 -10
  362. package/node_modules/@opentelemetry/semantic-conventions/build/esm/version.d.ts +0 -2
  363. package/node_modules/@opentelemetry/semantic-conventions/build/esm/version.js +0 -7
  364. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_attributes.d.ts +0 -14984
  365. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_events.d.ts +0 -291
  366. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_metrics.d.ts +0 -4053
  367. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index-incubating.d.ts +0 -7
  368. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index-incubating.js +0 -13
  369. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index.d.ts +0 -6
  370. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index.js +0 -16
  371. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/internal/utils.d.ts +0 -7
  372. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/internal/utils.js +0 -23
  373. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/resource/SemanticResourceAttributes.js +0 -1250
  374. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/resource/index.d.ts +0 -2
  375. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/resource/index.js +0 -10
  376. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_attributes.d.ts +0 -1726
  377. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_events.d.ts +0 -5
  378. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_events.js +0 -12
  379. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_metrics.d.ts +0 -308
  380. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_metrics.js +0 -315
  381. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/trace/SemanticAttributes.js +0 -2360
  382. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/trace/index.d.ts +0 -2
  383. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/trace/index.js +0 -10
  384. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/version.d.ts +0 -2
  385. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/version.js +0 -7
  386. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_attributes.d.ts +0 -14984
  387. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_events.d.ts +0 -291
  388. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_events.js +0 -301
  389. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_metrics.d.ts +0 -4053
  390. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_metrics.js +0 -4072
  391. package/node_modules/@opentelemetry/semantic-conventions/build/src/index-incubating.d.ts +0 -7
  392. package/node_modules/@opentelemetry/semantic-conventions/build/src/index-incubating.js +0 -29
  393. package/node_modules/@opentelemetry/semantic-conventions/build/src/index.d.ts +0 -6
  394. package/node_modules/@opentelemetry/semantic-conventions/build/src/index.js +0 -32
  395. package/node_modules/@opentelemetry/semantic-conventions/build/src/internal/utils.d.ts +0 -7
  396. package/node_modules/@opentelemetry/semantic-conventions/build/src/internal/utils.js +0 -27
  397. package/node_modules/@opentelemetry/semantic-conventions/build/src/resource/SemanticResourceAttributes.js +0 -1255
  398. package/node_modules/@opentelemetry/semantic-conventions/build/src/resource/index.d.ts +0 -2
  399. package/node_modules/@opentelemetry/semantic-conventions/build/src/resource/index.js +0 -26
  400. package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.d.ts +0 -1726
  401. package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.js +0 -1759
  402. package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_events.d.ts +0 -5
  403. package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_events.js +0 -15
  404. package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_metrics.d.ts +0 -308
  405. package/node_modules/@opentelemetry/semantic-conventions/build/src/trace/SemanticAttributes.js +0 -2368
  406. package/node_modules/@opentelemetry/semantic-conventions/build/src/trace/index.d.ts +0 -2
  407. package/node_modules/@opentelemetry/semantic-conventions/build/src/trace/index.js +0 -26
  408. package/node_modules/@opentelemetry/semantic-conventions/build/src/version.d.ts +0 -2
  409. package/node_modules/@opentelemetry/semantic-conventions/build/src/version.js +0 -10
  410. package/node_modules/fdir/LICENSE +0 -7
  411. package/node_modules/fdir/README.md +0 -91
  412. package/node_modules/fdir/dist/index.cjs +0 -588
  413. package/node_modules/fdir/dist/index.d.cts +0 -155
  414. package/node_modules/fdir/dist/index.d.mts +0 -155
  415. package/node_modules/fdir/dist/index.mjs +0 -570
  416. package/node_modules/fdir/package.json +0 -106
  417. package/node_modules/picomatch/LICENSE +0 -21
  418. package/node_modules/picomatch/README.md +0 -743
  419. package/node_modules/picomatch/index.js +0 -17
  420. package/node_modules/picomatch/lib/constants.js +0 -184
  421. package/node_modules/picomatch/lib/parse.js +0 -1425
  422. package/node_modules/picomatch/lib/picomatch.js +0 -361
  423. package/node_modules/picomatch/lib/scan.js +0 -403
  424. package/node_modules/picomatch/lib/utils.js +0 -72
  425. package/node_modules/picomatch/package.json +0 -83
  426. package/node_modules/picomatch/posix.js +0 -3
  427. package/node_modules/tinyglobby/LICENSE +0 -21
  428. package/node_modules/tinyglobby/README.md +0 -25
  429. package/node_modules/tinyglobby/dist/index.cjs +0 -335
  430. package/node_modules/tinyglobby/dist/index.d.cts +0 -148
  431. package/node_modules/tinyglobby/dist/index.d.mts +0 -148
  432. package/node_modules/tinyglobby/dist/index.mjs +0 -307
  433. package/node_modules/tinyglobby/package.json +0 -70
  434. /package/node_modules/import-in-the-middle/{register-hooks.d.ts → register-hooks.d.mts} +0 -0
@@ -18,10 +18,13 @@ export type Namespace = { [key: string]: any }
18
18
  * starting from the package name.
19
19
  * @param {baseDir} string The absolute path of the module, if not provided in
20
20
  * `name`.
21
+ * @param {format} string The loader format, when available. CommonJS modules
22
+ * report `commonjs`, including type-stripped CommonJS. Older generated wrappers
23
+ * provide `undefined`.
21
24
  * @return any A value that can will be assigned to `exports.default`. This is
22
25
  * equivalent to doing that assignment in the body of this function.
23
26
  */
24
- export type HookFn = (exported: Namespace, name: string, baseDir: string|void) => any
27
+ export type HookFn = (exported: Namespace, name: string, baseDir: string|void, format?: string) => any
25
28
 
26
29
  export type Options = {
27
30
  internals?: boolean
@@ -60,8 +63,11 @@ export default Hook
60
63
  * @param {url} string The absolute path of the module, as a `file:` URL string.
61
64
  * @param {exported} { [string]: any } An object representing the exported
62
65
  * items of a module.
66
+ * @param {specifier} string The original import specifier, when available.
67
+ * @param {format} string The loader format, when available. Older generated
68
+ * wrappers provide `undefined`.
63
69
  */
64
- export type HookFunction = (url: string, exported: Namespace) => void
70
+ export type HookFunction = (url: string, exported: Namespace, specifier?: string, format?: string) => void
65
71
 
66
72
  /**
67
73
  * Adds a hook to be run on any already loaded modules and any that will be
@@ -19,28 +19,70 @@ const {
19
19
  } = require('./lib/register')
20
20
 
21
21
  /**
22
- * Checks turbopack specifiers separately (for Next.js 16+).
23
- *
24
- * If turbopack is used, specifiers will have an additional hash appended to the end.
25
- * Something like "ai" might become "ai-5e7181a616786b24". This only happens in Next.js 16+.
26
- * Just checking if the baseDir ends with this new specifier won't match, as the baseDir still has the plain package.
27
- *
28
- * This logic isolates a new check for checking the actual name in the case turbopack is being used.
29
- *
30
- * @param specifier {string}
31
- * @param baseDir {string}
22
+ * @param {string} specifier
23
+ * @param {string} baseDir
24
+ * @returns {boolean}
32
25
  */
33
- function isTurbopackSpecifier (specifier, baseDir) {
26
+ function isPackageSpecifier (specifier, baseDir) {
27
+ if (process.platform === 'win32' && specifier.includes('/')) baseDir = baseDir.replaceAll(path.sep, '/')
28
+ if (baseDir.endsWith(specifier)) return true
34
29
  const usingTurbopack = process.env.TURBOPACK ?? process.argv.includes('--turbo')
35
30
  if (!usingTurbopack) return false
31
+ const hashSeparator = specifier.lastIndexOf('-')
32
+ return hashSeparator !== -1 && baseDir.endsWith(specifier.slice(0, hashSeparator))
33
+ }
34
+
35
+ // Every Hook instance resolves the same details for a given module load, so the
36
+ // result for the most recent URL is shared instead of being recomputed per Hook.
37
+ // The details depend only on the URL, so a stale entry can never be returned.
38
+ let lastLoadUrl
39
+ let lastDetails
40
+
41
+ /**
42
+ * @param {string} loadUrl
43
+ * @returns {{ name: string, filePath: string | undefined, baseDir: string | undefined }}
44
+ */
45
+ function getModuleDetails (loadUrl) {
46
+ if (loadUrl === lastLoadUrl) return lastDetails
47
+
48
+ let name = loadUrl
49
+ let filePath, baseDir
50
+
51
+ if (loadUrl.startsWith('node:')) {
52
+ // Normalize builtin module name to *not* have 'node:' prefix, unless
53
+ // required, as it is for 'node:test' and some others. `module.isBuiltin`
54
+ // is available in all Node.js versions that have node:-only modules.
55
+ const unprefixed = loadUrl.slice(5)
56
+ if (isBuiltin(unprefixed)) {
57
+ name = unprefixed
58
+ }
59
+ } else if (loadUrl.startsWith('file://')) {
60
+ const stackTraceLimit = Error.stackTraceLimit
61
+ Error.stackTraceLimit = 0
62
+ try {
63
+ filePath = fileURLToPath(loadUrl)
64
+ name = filePath
65
+ } catch (e) {}
66
+ Error.stackTraceLimit = stackTraceLimit
67
+
68
+ if (filePath) {
69
+ const details = moduleDetailsFromPath(filePath)
70
+ if (details) {
71
+ name = details.name
72
+ baseDir = details.basedir
73
+ }
74
+ }
75
+ }
36
76
 
37
- const specifierWithoutTurbopackHash = specifier.slice(0, specifier.lastIndexOf('-'))
38
- return baseDir.endsWith(specifierWithoutTurbopackHash)
77
+ lastLoadUrl = loadUrl
78
+ lastDetails = { name, filePath, baseDir }
79
+ return lastDetails
39
80
  }
40
81
 
82
+ /** @param {import('./index').HookFunction} hook */
41
83
  function addHook (hook) {
42
84
  importHooks.push(hook)
43
- toHook.forEach(([name, namespace, specifier]) => hook(name, namespace, specifier))
85
+ toHook.forEach(([name, namespace, specifier, format]) => hook(name, namespace, specifier, format))
44
86
  }
45
87
 
46
88
  function removeHook (hook) {
@@ -50,8 +92,15 @@ function removeHook (hook) {
50
92
  }
51
93
  }
52
94
 
53
- function callHookFn (hookFn, namespace, name, baseDir) {
54
- const newDefault = hookFn(namespace, name, baseDir)
95
+ /**
96
+ * @param {import('./index').HookFn} hookFn
97
+ * @param {import('./index').Namespace} namespace
98
+ * @param {string} name
99
+ * @param {string | undefined} baseDir
100
+ * @param {string | undefined} format
101
+ */
102
+ function callHookFn (hookFn, namespace, name, baseDir, format) {
103
+ const newDefault = hookFn(namespace, name, baseDir, format)
55
104
  if (newDefault && newDefault !== namespace) {
56
105
  // Only ESM modules that actually export `default` can have it reassigned.
57
106
  // Some hooks return a value unconditionally; avoid crashing when the module
@@ -147,63 +196,41 @@ function Hook (modules, options, hookFn) {
147
196
  sendModulesToLoader(modules)
148
197
  }
149
198
 
150
- this._iitmHook = (name, namespace, specifier) => {
151
- const loadUrl = name
152
- const isNodeUrl = loadUrl.startsWith('node:')
153
- let filePath, baseDir
154
-
155
- if (isNodeUrl) {
156
- // Normalize builtin module name to *not* have 'node:' prefix, unless
157
- // required, as it is for 'node:test' and some others. `module.isBuiltin`
158
- // is available in all Node.js versions that have node:-only modules.
159
- const unprefixed = name.slice(5)
160
- if (isBuiltin(unprefixed)) {
161
- name = unprefixed
162
- }
163
- } else if (loadUrl.startsWith('file://')) {
164
- const stackTraceLimit = Error.stackTraceLimit
165
- Error.stackTraceLimit = 0
166
- try {
167
- filePath = fileURLToPath(name)
168
- name = filePath
169
- } catch (e) {}
170
- Error.stackTraceLimit = stackTraceLimit
171
-
172
- if (filePath) {
173
- const details = moduleDetailsFromPath(filePath)
174
- if (details) {
175
- name = details.name
176
- baseDir = details.basedir
177
- }
178
- }
179
- }
199
+ /**
200
+ * @param {string} loadUrl
201
+ * @param {import('./index').Namespace} namespace
202
+ * @param {string} specifier
203
+ * @param {string | undefined} format
204
+ */
205
+ this._iitmHook = (loadUrl, namespace, specifier, format) => {
206
+ const { name, filePath, baseDir } = getModuleDetails(loadUrl)
180
207
 
181
208
  if (modules) {
182
209
  for (const matchArg of modules) {
183
210
  if (filePath && matchArg === filePath) {
184
211
  // abspath match
185
- callHookFn(hookFn, namespace, filePath, undefined)
212
+ callHookFn(hookFn, namespace, filePath, undefined, format)
186
213
  } else if (matchArg === name) {
187
214
  if (!baseDir) {
188
215
  // built-in module (or unexpected non file:// name?)
189
- callHookFn(hookFn, namespace, name, baseDir)
190
- } else if (baseDir.endsWith(specifiers.get(loadUrl)) || isTurbopackSpecifier(specifiers.get(loadUrl), baseDir)) {
216
+ callHookFn(hookFn, namespace, name, baseDir, format)
217
+ } else if (isPackageSpecifier(specifiers.get(loadUrl), baseDir)) {
191
218
  // An import of the top-level module (e.g. `import 'ioredis'`).
192
219
  // Note: Slight behaviour difference from RITM. RITM uses
193
220
  // `require.resolve(name)` to see if filename is the module
194
221
  // main file, which will catch `require('ioredis/built/index.js')`.
195
222
  // The check here will not catch `import 'ioredis/built/index.js'`.
196
- callHookFn(hookFn, namespace, name, baseDir)
223
+ callHookFn(hookFn, namespace, name, baseDir, format)
197
224
  } else if (internals) {
198
225
  const internalPath = name + path.sep + path.relative(baseDir, filePath)
199
- callHookFn(hookFn, namespace, internalPath, baseDir)
226
+ callHookFn(hookFn, namespace, internalPath, baseDir, format)
200
227
  }
201
228
  } else if (matchArg === specifier) {
202
- callHookFn(hookFn, namespace, specifier, baseDir)
229
+ callHookFn(hookFn, namespace, specifier, baseDir, format)
203
230
  }
204
231
  }
205
232
  } else {
206
- callHookFn(hookFn, namespace, name, baseDir)
233
+ callHookFn(hookFn, namespace, name, baseDir, format)
207
234
  }
208
235
  }
209
236
 
@@ -2,10 +2,14 @@
2
2
 
3
3
  import { parse } from 'es-module-lexer'
4
4
 
5
+ /** @typedef {string | Pick<import('es-module-lexer').StaticImport, 'specifier' | 'attributes'>} ModuleImport */
6
+
5
7
  /**
6
8
  * @typedef {object} LexedExports
7
9
  * @property {string[] | Set<string>} exportNames
8
10
  * @property {Array<{ specifier: string, parentURL: string }> | undefined} starReexports
11
+ * @property {boolean} [hasModuleImports] Whether a non-star static request can refer to a user module.
12
+ * @property {ModuleImport[] | undefined} [moduleImports]
9
13
  * @property {boolean} hasModuleSyntax
10
14
  */
11
15
 
@@ -58,9 +62,10 @@ export default function getEsmExports (moduleSource) {
58
62
  *
59
63
  * @param {string} moduleSource The source code of the module to lex.
60
64
  * @param {string} [parentURL] The URL of the module declaring star re-exports.
65
+ * @param {boolean} [includeModuleImports = false] Report static requests and possible cycle importers.
61
66
  * @returns {LexedExports}
62
67
  */
63
- export function lexEsm (moduleSource, parentURL) {
68
+ export function lexEsm (moduleSource, parentURL, includeModuleImports = false) {
64
69
  const legacy = parentURL === undefined
65
70
  const exportNames = legacy ? new Set() : []
66
71
  // TypeScript overload signatures and declaration merging (`function` +
@@ -68,7 +73,22 @@ export function lexEsm (moduleSource, parentURL) {
68
73
  // wrapper would then emit a duplicate export, which is a SyntaxError.
69
74
  let seenNames
70
75
  let starReexports
71
- const [, exports, , hasModuleSyntax] = parse(moduleSource)
76
+ const [imports, exports, , hasModuleSyntax] = parse(moduleSource)
77
+ let hasModuleImports = false
78
+ let moduleImports
79
+ if (includeModuleImports) {
80
+ for (const imported of imports) {
81
+ if ((imported.type !== 'static' && imported.type !== 'reexport-star') ||
82
+ imported.typeOnly || imported.specifier.startsWith('node:')) continue
83
+ moduleImports ??= []
84
+ if (imported.attributes === null) {
85
+ moduleImports.push(imported.specifier)
86
+ } else {
87
+ moduleImports.push({ specifier: imported.specifier, attributes: imported.attributes })
88
+ }
89
+ if (imported.type === 'static') hasModuleImports = true
90
+ }
91
+ }
72
92
 
73
93
  for (const exported of exports) {
74
94
  if (exported.typeOnly) continue
@@ -77,7 +97,8 @@ export function lexEsm (moduleSource, parentURL) {
77
97
  if (legacy) {
78
98
  exportNames.add(`* from ${exported.from}`)
79
99
  } else {
80
- (starReexports ??= []).push({ specifier: exported.from, parentURL })
100
+ starReexports ??= []
101
+ starReexports.push({ specifier: exported.from, parentURL })
81
102
  }
82
103
  } else {
83
104
  const name = decodeExportName(exported.name)
@@ -92,5 +113,18 @@ export function lexEsm (moduleSource, parentURL) {
92
113
  }
93
114
  }
94
115
 
116
+ if (includeModuleImports) {
117
+ return { exportNames, starReexports, hasModuleSyntax, hasModuleImports, moduleImports }
118
+ }
95
119
  return { exportNames, starReexports, hasModuleSyntax }
96
120
  }
121
+
122
+ /** @param {import('node:module').LoadFnOutput['source']} source */
123
+ export function sourceToString (source) {
124
+ if (source == null || typeof source === 'string') return source
125
+ if (Buffer.isBuffer(source)) return source.toString('utf8')
126
+ if (ArrayBuffer.isView(source)) {
127
+ return Buffer.from(source.buffer, source.byteOffset, source.byteLength).toString('utf8')
128
+ }
129
+ return Buffer.from(source).toString('utf8')
130
+ }
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { lexEsm } from './get-esm-exports.mjs'
3
+ import { lexEsm, sourceToString } from './get-esm-exports.mjs'
4
4
  import { parse as parseCjs, initSync } from 'cjs-module-lexer'
5
5
  import { readFileSync, existsSync } from 'fs'
6
6
  import { builtinModules, createRequire } from 'module'
@@ -12,7 +12,14 @@ const nodeMajor = Number(process.versions.node.split('.')[0])
12
12
  export const hasModuleExportsCJSDefault = nodeMajor >= 23
13
13
 
14
14
  /** @typedef {{ specifier: string, parentURL: string }} StarReexport */
15
- /** @typedef {{ exportNames: Iterable<string>, starReexports?: StarReexport[] }} ModuleExports */
15
+ /**
16
+ * @typedef {object} ModuleExports
17
+ * @property {Iterable<string>} exportNames
18
+ * @property {StarReexport[]} [starReexports]
19
+ * @property {string} [format]
20
+ * @property {boolean} [hasModuleImports]
21
+ * @property {import('./get-esm-exports.mjs').ModuleImport[]} [moduleImports]
22
+ */
16
23
 
17
24
  let parserInitialized = false
18
25
  let stripTypeScriptTypes
@@ -89,8 +96,8 @@ const urlsBeingProcessed = new Set() // Guard against circular imports.
89
96
  // OrchestrionJS, minifiers) are stable and unaffected; the wrapper's real
90
97
  // namespace `load()` still runs every time, so per-load source differences in
91
98
  // the *executed* module are preserved (see the wrapper's `import * as
92
- // namespace`). Only the pure ESM result is cached: the CommonJS path mutates
93
- // `context.format` and resolves re-exports, and builtins memoize via BUILT_INS.
99
+ // namespace`). Only the pure ESM result is cached: the CommonJS path resolves
100
+ // re-exports, and builtins memoize via BUILT_INS.
94
101
  const esmExportsCache = new Map()
95
102
 
96
103
  /**
@@ -131,9 +138,8 @@ function resolvePackageImports (specifier, fromUrl) {
131
138
  }
132
139
 
133
140
  if (resolvedExport) {
134
- const url = resolvedExport.startsWith('.')
135
- ? pathToFileURL(join(currentDir, resolvedExport))
136
- : fromUrl
141
+ let url = fromUrl
142
+ if (resolvedExport.startsWith('.')) url = pathToFileURL(join(currentDir, resolvedExport))
137
143
  return [url, resolvedExport]
138
144
  }
139
145
  }
@@ -157,7 +163,7 @@ function resolvePackageImports (specifier, fromUrl) {
157
163
  */
158
164
  function * getCjsExports (url, context, source) {
159
165
  if (urlsBeingProcessed.has(url)) {
160
- return { exportNames: new Set() }
166
+ return { exportNames: new Set(), format: 'commonjs' }
161
167
  }
162
168
  urlsBeingProcessed.add(url)
163
169
 
@@ -217,9 +223,7 @@ function * getCjsExports (url, context, source) {
217
223
  full.add('module.exports')
218
224
  }
219
225
 
220
- // we know that it's commonjs at this point, because ESM failed
221
- context.format = 'commonjs'
222
- return { exportNames: full, starReexports }
226
+ return { exportNames: full, starReexports, format: 'commonjs' }
223
227
  } finally {
224
228
  urlsBeingProcessed.delete(url)
225
229
  }
@@ -239,14 +243,15 @@ function * getCjsExports (url, context, source) {
239
243
  * get the exports of.
240
244
  * @param {object} context Context object as provided by the `load` hook from
241
245
  * the loaders API.
246
+ * @param {boolean} [includeModuleImports = false] Collect static requests for a cycle scan.
242
247
  *
243
248
  * @returns {Generator<Array, ModuleExports>} A generator that yields I/O
244
249
  * operations and ultimately returns the identifiers and star re-exports of the
245
250
  * module.
246
251
  */
247
- export function * getModuleExports (url, context) {
252
+ export function * getModuleExports (url, context, includeModuleImports = false) {
248
253
  const cached = esmExportsCache.get(url)
249
- if (cached !== undefined) {
254
+ if (cached !== undefined && (!includeModuleImports || cached.hasModuleImports !== undefined)) {
250
255
  return cached
251
256
  }
252
257
 
@@ -254,31 +259,13 @@ export function * getModuleExports (url, context) {
254
259
  // upstream loader. This doesn't always work though, so later on we fall back
255
260
  // to reading it from disk.
256
261
  const parentCtx = yield [LOAD, url, context]
257
- let source = parentCtx.source
258
262
  const format = parentCtx.format
259
-
260
- // Loader hooks can return ArrayBuffer / TypedArray sources. Normalize to a
261
- // string for parsing.
262
- if (source && typeof source !== 'string') {
263
- // Avoid copies where possible:
264
- // - Buffer.from(Uint8Array) copies
265
- // - Buffer.from(ArrayBuffer, offset, length) wraps the existing memory
266
- if (Buffer.isBuffer(source)) {
267
- source = source.toString('utf8')
268
- } else if (ArrayBuffer.isView(source)) {
269
- source = Buffer.from(source.buffer, source.byteOffset, source.byteLength).toString('utf8')
270
- } else {
271
- source = Buffer.from(source).toString('utf8')
272
- }
263
+ if (format === 'builtin') {
264
+ return { exportNames: getExportsForNodeBuiltIn(url), format }
273
265
  }
274
266
 
275
- if (!source) {
276
- if (format === 'builtin') {
277
- // Builtins don't give us the source property, so we're stuck
278
- // just requiring it to get the exports.
279
- return { exportNames: getExportsForNodeBuiltIn(url) }
280
- }
281
-
267
+ let source = sourceToString(parentCtx.source)
268
+ if (source == null) {
282
269
  // Sometimes source is retrieved by parentLoad, CommonJs isn't.
283
270
  source = readFileSync(fileURLToPath(url), 'utf8')
284
271
  }
@@ -299,8 +286,13 @@ export function * getModuleExports (url, context) {
299
286
  return yield * getCjsExports(url, context, source)
300
287
  }
301
288
 
302
- const { exportNames, starReexports, hasModuleSyntax } = lexEsm(source, url)
303
- const moduleExports = starReexports === undefined ? { exportNames } : { exportNames, starReexports }
289
+ const { exportNames, starReexports, hasModuleImports, hasModuleSyntax, moduleImports } = lexEsm(source, url, includeModuleImports)
290
+ const moduleExports = cached ?? (starReexports === undefined ? { exportNames } : { exportNames, starReexports })
291
+ moduleExports.format = format ?? context.format
292
+ if (includeModuleImports) {
293
+ moduleExports.hasModuleImports = hasModuleImports
294
+ moduleExports.moduleImports = moduleImports
295
+ }
304
296
 
305
297
  if (moduleFormat === 'module') {
306
298
  esmExportsCache.set(url, moduleExports)
@@ -332,9 +324,10 @@ export function * getModuleExports (url, context) {
332
324
  */
333
325
  export function * getExports (url, context) {
334
326
  const { exportNames, starReexports } = yield * getModuleExports(url, context)
335
- const legacyExports = starReexports === undefined && exportNames instanceof Set
336
- ? exportNames
337
- : new Set(exportNames)
327
+ let legacyExports = exportNames
328
+ if (starReexports !== undefined || !(exportNames instanceof Set)) {
329
+ legacyExports = new Set(exportNames)
330
+ }
338
331
 
339
332
  if (starReexports !== undefined) {
340
333
  for (const { specifier } of starReexports) {
@@ -4,6 +4,8 @@
4
4
 
5
5
  const importHooks = [] // TODO should this be a Set?
6
6
  const binders = new WeakMap()
7
+ /** @type {Set<() => boolean> | undefined} */
8
+ let uninitializedExports
7
9
  let legacySetters
8
10
  let legacyGetters
9
11
  let legacyProxyHandler
@@ -21,6 +23,23 @@ function readExport (source, name) {
21
23
  return source[name]
22
24
  }
23
25
 
26
+ /**
27
+ * @param {object} source The module namespace.
28
+ * @param {string[]} keys The wrapper's export names.
29
+ * @param {object[]} [sources] Alternate namespaces for star-collision bindings.
30
+ */
31
+ function hasUninitializedExport (source, keys, sources) {
32
+ try {
33
+ for (let index = 0; index < keys.length; index++) {
34
+ if (readExport(sources?.[index] ?? source, keys[index]) === undefined) return true
35
+ }
36
+ } catch (error) {
37
+ if (!(error instanceof ReferenceError)) throw error
38
+ return true
39
+ }
40
+ return false
41
+ }
42
+
24
43
  /**
25
44
  * @param {object} target The proxy target.
26
45
  * @param {string | symbol} name The export name.
@@ -104,12 +123,12 @@ function registerLegacy (name, namespace, set, get, specifier) {
104
123
  * @param {string} name The wrapped module URL.
105
124
  * @param {ModuleBinder | object} binder The wrapper's binding state or legacy namespace.
106
125
  * @param {string | object} specifier The original import specifier or legacy setters.
107
- * @param {object} [get] The legacy export getters.
126
+ * @param {string | object} [format] The loader format or legacy export getters.
108
127
  * @param {string} [legacySpecifier] The legacy original import specifier.
109
128
  */
110
- function register (name, binder, specifier, get, legacySpecifier) {
129
+ function register (name, binder, specifier, format, legacySpecifier) {
111
130
  if (arguments.length === 5) {
112
- registerLegacy(name, binder, specifier, get, legacySpecifier)
131
+ registerLegacy(name, binder, specifier, format, legacySpecifier)
113
132
  return
114
133
  }
115
134
 
@@ -117,8 +136,8 @@ function register (name, binder, specifier, get, legacySpecifier) {
117
136
  specifiers.set(name, specifier)
118
137
  binders.set(namespace, binder)
119
138
  const proxy = new Proxy(namespace, proxyHandler)
120
- importHooks.forEach(hook => hook(name, proxy, specifier))
121
- toHook.push([name, proxy, specifier])
139
+ importHooks.forEach(hook => hook(name, proxy, specifier, format))
140
+ toHook.push([name, proxy, specifier, format])
122
141
  }
123
142
 
124
143
  // Delays (ms) for re-reading exports that were still in their temporal dead zone
@@ -140,7 +159,10 @@ const RETRY_DELAYS = [0, 10, 50]
140
159
  class ModuleBinder {
141
160
  // Mimics a Module namespace object (https://tc39.es/ecma262/#sec-module-namespace-objects).
142
161
  namespace = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } })
143
- #set = Object.create(null)
162
+ /** @type {Record<string, number> | undefined} */
163
+ #set
164
+ /** @type {string[] | undefined} */
165
+ #keys
144
166
  #write
145
167
  #overridden
146
168
  #pending
@@ -150,12 +172,21 @@ class ModuleBinder {
150
172
  * @param {string[]} [keys] Export names in wrapper-binding order.
151
173
  * @param {(index: number, value: unknown) => void} [write] Assigns a wrapper binding by index.
152
174
  * @param {object[]} [sources] Alternate namespaces for star-collision bindings.
175
+ * @param {boolean} [refresh] Refresh staged bindings after native initialization.
153
176
  */
154
- constructor (source, keys, write, sources) {
177
+ constructor (source, keys, write, sources, refresh = false) {
155
178
  this.#write = write
179
+ this.#keys = keys
180
+ if (uninitializedExports?.size > 0 && keys !== undefined && hasUninitializedExport(source, keys, sources)) {
181
+ let previousSize
182
+ do {
183
+ previousSize = uninitializedExports.size
184
+ for (const update of uninitializedExports) update()
185
+ } while (uninitializedExports.size < previousSize)
186
+ }
156
187
  if (keys !== undefined) {
157
188
  for (let index = 0; index < keys.length; index++) {
158
- this.#bind(keys[index], index, sources?.[index] ?? source)
189
+ this.#bind(keys[index], index, sources?.[index] ?? source, refresh)
159
190
  }
160
191
  }
161
192
  }
@@ -168,21 +199,30 @@ class ModuleBinder {
168
199
  * @param {string} key The export name.
169
200
  * @param {number} index The wrapper binding index.
170
201
  * @param {object} source The binding's source namespace.
202
+ * @param {boolean} refresh Whether this value must be read again before hooks run.
171
203
  * @returns {void}
172
204
  */
173
- #bind (key, index, source) {
205
+ #bind (key, index, source, refresh) {
174
206
  let value
207
+ let uninitialized = false
175
208
  try {
176
209
  value = readExport(source, key)
210
+ uninitialized = value === undefined && uninitializedExports?.size > 0
177
211
  this.#write(index, value)
178
212
  this.namespace[key] = value
179
213
  } catch (error) {
180
214
  if (!(error instanceof ReferenceError)) throw error
215
+ uninitialized = true
181
216
  }
182
- if (value === undefined) {
183
- (this.#pending ??= []).push(this.#makeUpdater(key, index, source))
217
+ if (refresh || value === undefined) {
218
+ const update = this.#makeUpdater(key, index, source)
219
+ this.#pending ??= []
220
+ this.#pending.push(update)
221
+ if (uninitialized) {
222
+ uninitializedExports ??= new Set()
223
+ uninitializedExports.add(update)
224
+ }
184
225
  }
185
- this.#set[key] = index
186
226
  }
187
227
 
188
228
  /**
@@ -191,6 +231,14 @@ class ModuleBinder {
191
231
  * @returns {boolean}
192
232
  */
193
233
  write (key, value) {
234
+ if (this.#set === undefined) {
235
+ if (this.#keys === undefined) return true
236
+ this.#set = Object.create(null)
237
+ for (let index = 0; index < this.#keys.length; index++) {
238
+ this.#set[this.#keys[index]] = index
239
+ }
240
+ this.#keys = undefined
241
+ }
194
242
  const index = this.#set[key]
195
243
  if (index !== undefined) {
196
244
  this.#write(index, value)
@@ -210,13 +258,17 @@ class ModuleBinder {
210
258
  * @returns {() => boolean} Updater returning whether the value is now settled.
211
259
  */
212
260
  #makeUpdater (key, index, source) {
213
- return () => {
214
- if (this.#overridden?.[key] === true) return true
261
+ const update = () => {
262
+ if (this.#overridden?.[key] === true) {
263
+ uninitializedExports?.delete(update)
264
+ return true
265
+ }
215
266
  try {
216
267
  const value = readExport(source, key)
217
- if (value !== undefined) {
268
+ if (value !== undefined || this.namespace[key] !== undefined) {
218
269
  this.#write(index, value)
219
270
  this.namespace[key] = value
271
+ uninitializedExports?.delete(update)
220
272
  return true
221
273
  }
222
274
  return false
@@ -229,6 +281,7 @@ class ModuleBinder {
229
281
  throw error
230
282
  }
231
283
  }
284
+ return update
232
285
  }
233
286
 
234
287
  #flushOnce () {
@@ -238,11 +291,20 @@ class ModuleBinder {
238
291
  let next
239
292
  for (const updater of pending) {
240
293
  // If it still throws ReferenceError, keep it for the (single) next attempt.
241
- if (updater() !== true) (next ??= []).push(updater)
294
+ if (updater() !== true) {
295
+ next ??= []
296
+ next.push(updater)
297
+ }
242
298
  }
243
299
  this.#pending = next
244
300
  }
245
301
 
302
+ // Hooks must see initialized exports after the native root finishes evaluating.
303
+ flushSync () {
304
+ this.#flushOnce()
305
+ this.flush()
306
+ }
307
+
246
308
  /**
247
309
  * Resolves exports deferred by `bind` (undefined or TDZ at wrapper-eval time).
248
310
  * Retries on a microtask, then at `RETRY_DELAYS`, giving up afterwards to avoid
@@ -266,6 +328,9 @@ class ModuleBinder {
266
328
  if (this.#pending === undefined) return
267
329
  if (attempt >= RETRY_DELAYS.length) {
268
330
  // Give up: leave exports as-is to avoid unbounded retries.
331
+ if (uninitializedExports !== undefined) {
332
+ for (const update of this.#pending) uninitializedExports.delete(update)
333
+ }
269
334
  this.#pending = undefined
270
335
  return
271
336
  }