@unbrained/pm-cli 2026.11.16 → 2026.11.17
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.
- package/.claude-plugin/marketplace.json +1 -1
- package/dist/cli/main.js +2 -2
- package/dist/cli/register-mutation.js +3 -2
- package/dist/cli/runtime/invocation-rewrites.js +2 -0
- package/dist/cli-bundle/bundle-manifest.json +1 -1
- package/dist/cli-bundle/chunks/{chunk-ERD2RYWM.js → chunk-2WHXFKMY.js} +31 -31
- package/dist/cli-bundle/chunks/{chunk-VJLZHOTP.js → chunk-36R3JTAD.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-FZ4XWWLO.js → chunk-3IU2S5UQ.js} +43 -43
- package/dist/cli-bundle/chunks/chunk-4FIN2XWC.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-NHNM3GIP.js → chunk-5OFMWP3Q.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-2WNORBVN.js → chunk-77MGDTK4.js} +83 -83
- package/dist/cli-bundle/chunks/{chunk-F7P42FL5.js → chunk-7K2RUKMK.js} +4 -4
- package/dist/cli-bundle/chunks/chunk-7UUPLMCU.js +115 -0
- package/dist/cli-bundle/chunks/chunk-ABFHWRLE.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-KGOGLKL2.js → chunk-ACLBUVQG.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-DZWRNL6R.js → chunk-ADKDFCVT.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-AM26RAG7.js +124 -0
- package/dist/cli-bundle/chunks/chunk-CR5GC3VO.js +9 -0
- package/dist/cli-bundle/chunks/chunk-DXSZL3T6.js +3 -0
- package/dist/cli-bundle/chunks/chunk-FXSLODOK.js +2 -0
- package/dist/cli-bundle/chunks/chunk-H64BNM4A.js +8 -0
- package/dist/cli-bundle/chunks/{chunk-2D26HRXB.js → chunk-HQYIKAC6.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-I3T2FVUA.js → chunk-KIQNEOKJ.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-O4ZSIMNC.js +8 -0
- package/dist/cli-bundle/chunks/chunk-QANUQMDL.js +6 -0
- package/dist/cli-bundle/chunks/{chunk-4I7YG3VZ.js → chunk-QZNL5XDT.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-RXNBNF6O.js +2 -0
- package/dist/cli-bundle/chunks/chunk-VLKCFZY6.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-J257NZRD.js → chunk-X5TFNFTS.js} +11 -11
- package/dist/cli-bundle/chunks/chunk-XP35IEHT.js +2 -0
- package/dist/cli-bundle/chunks/chunk-XPBADEUK.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-NYN5OR2T.js → chunk-Y4LXVPA5.js} +2 -2
- package/dist/cli-bundle/chunks/{indexed-receipt-blobs-HNLN6UXH.js → indexed-receipt-blobs-ELEMA7IW.js} +2 -2
- package/dist/cli-bundle/chunks/{item-revision-PSOL5I4H.js → item-revision-7RVMVXTE.js} +2 -2
- package/dist/cli-bundle/chunks/item-transaction-NVX6P3FK.js +2 -0
- package/dist/cli-bundle/chunks/{mutation-actor-BDBBH3ZS.js → mutation-actor-DDYJW5B4.js} +2 -2
- package/dist/cli-bundle/chunks/mutation-admission-3PKQOAYK.js +2 -0
- package/dist/cli-bundle/chunks/{register-list-query-AESCVO6H.js → register-list-query-TPZLHFHQ.js} +2 -2
- package/dist/cli-bundle/chunks/register-mutation-JG5AEBRJ.js +21 -0
- package/dist/cli-bundle/chunks/register-operations-3CNXP46P.js +2 -0
- package/dist/cli-bundle/chunks/register-setup-4N56VL2P.js +2 -0
- package/dist/cli-bundle/chunks/{settlement-hook-MVVVUIVZ.js → settlement-hook-E5LHZ4RD.js} +2 -2
- package/dist/cli-bundle/chunks/{stage-RMU3JAWM.js → stage-XGWW3T64.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-2MQNIDKG.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-DFBHW7HP.js → chunk-5JVB42Z7.js} +3 -3
- package/dist/cli-bundle/focused-chunks/{chunk-SFATIM77.js → chunk-6JQXDGHM.js} +9 -9
- package/dist/cli-bundle/focused-chunks/{chunk-HHMMIHZP.js → chunk-7RF2YPZ5.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-7Z2NYAK4.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-A2CLYPDA.js +102 -0
- package/dist/cli-bundle/focused-chunks/chunk-BNLLST32.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-7SEPCQV2.js → chunk-DH4DHL6V.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-EZXLY6S4.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-KRNF3WTC.js → chunk-FPPYE6CY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ONM2R32I.js → chunk-GD2YWUAD.js} +50 -50
- package/dist/cli-bundle/focused-chunks/chunk-HO2YUD4P.js +91 -0
- package/dist/cli-bundle/focused-chunks/{chunk-BEHIMEV2.js → chunk-ICEHI4SN.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-PDXSMSO5.js → chunk-IXYBN6D2.js} +3 -3
- package/dist/cli-bundle/focused-chunks/chunk-MTBC32ZR.js +8 -0
- package/dist/cli-bundle/focused-chunks/chunk-OAIAZHRG.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-OPY43DNJ.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-DZMP3VYQ.js → chunk-SESMRMEE.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-PEL4SQXV.js → chunk-VBA4BIHN.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-UBBTBNUY.js → chunk-XJS4COL2.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-XS2YZCT5.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-YWPLBFPC.js +44 -0
- package/dist/cli-bundle/focused-chunks/{chunk-6E4X7MQA.js → chunk-ZDY5L2C2.js} +7 -7
- package/dist/cli-bundle/focused-chunks/chunk-ZFUZ4YYN.js +8 -0
- package/dist/cli-bundle/focused-chunks/{indexed-receipt-blobs-ADMQXF3N.js → indexed-receipt-blobs-ZTRFCPH7.js} +2 -2
- package/dist/cli-bundle/focused-chunks/item-revision-U7GDVAH7.js +2 -0
- package/dist/cli-bundle/focused-chunks/item-transaction-7C4BH47O.js +2 -0
- package/dist/cli-bundle/focused-chunks/mutation-actor-2SVBO324.js +2 -0
- package/dist/cli-bundle/focused-chunks/mutation-admission-SKXVITP5.js +2 -0
- package/dist/cli-bundle/focused-chunks/{settlement-hook-5U2M75BY.js → settlement-hook-OUBUN45C.js} +2 -2
- package/dist/cli-bundle/focused-chunks/stage-LVAGKCEE.js +2 -0
- package/dist/cli-bundle/main.js +27 -27
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +2 -2
- package/dist/cli-bundle/sdk-core.js +1 -1
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +57 -57
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +4 -4
- package/dist/core/extensions/extension-hook-runtime.d.ts +14 -2
- package/dist/core/extensions/extension-hook-runtime.js +1 -1
- package/dist/core/extensions/extension-types.d.ts +14 -0
- package/dist/core/extensions/extension-types.js +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.js +1 -1
- package/dist/core/policy/workflow-policy-store.js +1 -1
- package/dist/core/store/item-mutation-precondition.d.ts +32 -1
- package/dist/core/store/item-mutation-precondition.js +1 -1
- package/dist/core/store/item-store.js +1 -1
- package/dist/core/store/transaction-coordinator-scope.js +2 -0
- package/dist/sdk/authoring.d.ts +1 -1
- package/dist/sdk/authoring.js +1 -1
- package/dist/sdk/cli-bootstrap.js +1 -1
- package/dist/sdk/item-transaction.js +1 -1
- package/dist/sdk/lifecycle/copy.js +1 -1
- package/dist/sdk/lifecycle/create.js +1 -1
- package/dist/sdk/lifecycle/restore.js +1 -1
- package/dist/sdk/package-import-adapters.d.ts +14 -1
- package/dist/sdk/package-import-adapters.js +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/testing.d.ts +21 -3
- package/dist/sdk/testing.js +2 -2
- package/dist/sdk/workspace-transaction.js +2 -2
- package/docs/EXTENSIONS.md +1 -1
- package/docs/MIGRATION_CLI_SIMPLIFICATION.md +1 -1
- package/docs/SDK.md +40 -3
- package/docs/WORKFLOW_POLICIES.md +23 -0
- package/marketplace.json +1 -1
- package/node_modules/@opentelemetry/core/build/esm/version.d.ts +1 -1
- package/node_modules/@opentelemetry/core/build/esm/version.js +1 -1
- package/node_modules/@opentelemetry/core/build/esnext/version.d.ts +1 -1
- package/node_modules/@opentelemetry/core/build/esnext/version.js +1 -1
- package/node_modules/@opentelemetry/core/build/src/version.d.ts +1 -1
- package/node_modules/@opentelemetry/core/build/src/version.js +1 -1
- package/node_modules/@opentelemetry/core/package.json +2 -2
- package/node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/machine-id/execAsync.d.ts +1 -0
- package/node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/machine-id/execAsync.js +1 -0
- package/node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/machine-id/getMachineId-bsd.js +3 -2
- package/node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/machine-id/getMachineId-darwin.js +3 -2
- package/node_modules/@opentelemetry/resources/build/esm/version.d.ts +1 -1
- package/node_modules/@opentelemetry/resources/build/esm/version.js +1 -1
- package/node_modules/@opentelemetry/resources/build/esnext/detectors/platform/node/machine-id/execAsync.d.ts +1 -0
- package/node_modules/@opentelemetry/resources/build/esnext/detectors/platform/node/machine-id/execAsync.js +1 -0
- package/node_modules/@opentelemetry/resources/build/esnext/detectors/platform/node/machine-id/getMachineId-bsd.js +3 -2
- package/node_modules/@opentelemetry/resources/build/esnext/detectors/platform/node/machine-id/getMachineId-darwin.js +3 -2
- package/node_modules/@opentelemetry/resources/build/esnext/version.d.ts +1 -1
- package/node_modules/@opentelemetry/resources/build/esnext/version.js +1 -1
- package/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/execAsync.d.ts +1 -0
- package/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/execAsync.js +2 -1
- package/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/getMachineId-bsd.js +2 -1
- package/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/getMachineId-darwin.js +2 -1
- package/node_modules/@opentelemetry/resources/build/src/version.d.ts +1 -1
- package/node_modules/@opentelemetry/resources/build/src/version.js +1 -1
- package/node_modules/@opentelemetry/resources/package.json +3 -3
- package/node_modules/@opentelemetry/sdk-trace/build/esm/version.d.ts +1 -1
- package/node_modules/@opentelemetry/sdk-trace/build/esm/version.js +1 -1
- package/node_modules/@opentelemetry/sdk-trace/build/esnext/version.d.ts +1 -1
- package/node_modules/@opentelemetry/sdk-trace/build/esnext/version.js +1 -1
- package/node_modules/@opentelemetry/sdk-trace/build/src/version.d.ts +1 -1
- package/node_modules/@opentelemetry/sdk-trace/build/src/version.js +1 -1
- package/node_modules/@opentelemetry/sdk-trace/package.json +5 -5
- package/node_modules/@opentelemetry/sdk-trace-base/build/esm/version.d.ts +1 -1
- package/node_modules/@opentelemetry/sdk-trace-base/build/esm/version.js +1 -1
- package/node_modules/@opentelemetry/sdk-trace-base/build/esnext/version.d.ts +1 -1
- package/node_modules/@opentelemetry/sdk-trace-base/build/esnext/version.js +1 -1
- package/node_modules/@opentelemetry/sdk-trace-base/build/src/version.d.ts +1 -1
- package/node_modules/@opentelemetry/sdk-trace-base/build/src/version.js +1 -1
- package/node_modules/@opentelemetry/sdk-trace-base/package.json +7 -7
- package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_attributes.cjs +18202 -0
- package/node_modules/@opentelemetry/semantic-conventions/{build/src/experimental_attributes.js → dist/experimental_attributes.d.cts} +3328 -1993
- package/node_modules/@opentelemetry/semantic-conventions/{build/esnext/experimental_attributes.js → dist/experimental_attributes.d.mts} +3328 -1935
- package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_attributes.mjs +16385 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_events.cjs +325 -0
- package/node_modules/@opentelemetry/semantic-conventions/{build/esnext/experimental_events.js → dist/experimental_events.d.cts} +37 -41
- package/node_modules/@opentelemetry/semantic-conventions/{build/esm/experimental_events.js → dist/experimental_events.d.mts} +37 -41
- package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_events.mjs +295 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_metrics.cjs +4929 -0
- package/node_modules/@opentelemetry/semantic-conventions/{build/esnext/experimental_metrics.js → dist/experimental_metrics.d.cts} +955 -597
- package/node_modules/@opentelemetry/semantic-conventions/{build/esm/experimental_metrics.js → dist/experimental_metrics.d.mts} +955 -597
- package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_metrics.mjs +4419 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/index-incubating.cjs +2619 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/index-incubating.d.cts +7 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/index-incubating.d.mts +7 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/index-incubating.mjs +7 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/index.cjs +670 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/index.d.cts +6 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/index.d.mts +6 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/index.mjs +6 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/internal/utils.cjs +20 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/internal/utils.mjs +20 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/resource/SemanticResourceAttributes.cjs +1326 -0
- package/node_modules/@opentelemetry/semantic-conventions/{build/esnext/resource/SemanticResourceAttributes.d.ts → dist/resource/SemanticResourceAttributes.d.cts} +600 -597
- package/node_modules/@opentelemetry/semantic-conventions/{build/src/resource/SemanticResourceAttributes.d.ts → dist/resource/SemanticResourceAttributes.d.mts} +600 -597
- package/node_modules/@opentelemetry/semantic-conventions/dist/resource/SemanticResourceAttributes.mjs +1188 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/stable_attributes.cjs +2038 -0
- package/node_modules/@opentelemetry/semantic-conventions/{build/esm/stable_attributes.js → dist/stable_attributes.d.cts} +327 -220
- package/node_modules/@opentelemetry/semantic-conventions/{build/esnext/stable_attributes.js → dist/stable_attributes.d.mts} +327 -220
- package/node_modules/@opentelemetry/semantic-conventions/dist/stable_attributes.mjs +1841 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/stable_events.cjs +9 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/stable_events.d.cts +8 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/stable_events.d.mts +8 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/stable_events.mjs +9 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/stable_metrics.cjs +378 -0
- package/node_modules/@opentelemetry/semantic-conventions/{build/src/stable_metrics.js → dist/stable_metrics.d.cts} +69 -63
- package/node_modules/@opentelemetry/semantic-conventions/{build/esm/stable_metrics.js → dist/stable_metrics.d.mts} +69 -59
- package/node_modules/@opentelemetry/semantic-conventions/dist/stable_metrics.mjs +326 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/trace/SemanticAttributes.cjs +2508 -0
- package/node_modules/@opentelemetry/semantic-conventions/{build/esnext/trace/SemanticAttributes.d.ts → dist/trace/SemanticAttributes.d.cts} +1097 -1094
- package/node_modules/@opentelemetry/semantic-conventions/{build/src/trace/SemanticAttributes.d.ts → dist/trace/SemanticAttributes.d.mts} +1097 -1094
- package/node_modules/@opentelemetry/semantic-conventions/dist/trace/SemanticAttributes.mjs +2236 -0
- package/node_modules/@opentelemetry/semantic-conventions/package.json +27 -42
- package/node_modules/@sentry/core/build/cjs/client.js +14 -5
- package/node_modules/@sentry/core/build/cjs/integrations/express/patch-layer.js +15 -1
- package/node_modules/@sentry/core/build/cjs/integrations/http/client-subscriptions.js +10 -1
- package/node_modules/@sentry/core/build/cjs/scope.js +0 -1
- package/node_modules/@sentry/core/build/cjs/tracing/openai/utils.js +1 -7
- package/node_modules/@sentry/core/build/cjs/tracing/sentrySpan.js +11 -0
- package/node_modules/@sentry/core/build/cjs/utils/envelope.js +1 -1
- package/node_modules/@sentry/core/build/cjs/utils/sql.js +1 -1
- package/node_modules/@sentry/core/build/cjs/utils/tunnel.js +9 -0
- package/node_modules/@sentry/core/build/cjs/utils/version.js +1 -1
- package/node_modules/@sentry/core/build/esm/client.js +14 -5
- package/node_modules/@sentry/core/build/esm/integrations/express/patch-layer.js +15 -1
- package/node_modules/@sentry/core/build/esm/integrations/http/client-subscriptions.js +10 -1
- package/node_modules/@sentry/core/build/esm/package.json +1 -1
- package/node_modules/@sentry/core/build/esm/scope.js +0 -1
- package/node_modules/@sentry/core/build/esm/tracing/openai/utils.js +1 -7
- package/node_modules/@sentry/core/build/esm/tracing/sentrySpan.js +11 -0
- package/node_modules/@sentry/core/build/esm/utils/envelope.js +1 -1
- package/node_modules/@sentry/core/build/esm/utils/sql.js +1 -1
- package/node_modules/@sentry/core/build/esm/utils/tunnel.js +9 -1
- package/node_modules/@sentry/core/build/esm/utils/version.js +1 -1
- package/node_modules/@sentry/core/build/types/types/datacategory.d.ts +1 -1
- package/node_modules/@sentry/core/build/types/utils/tunnel.d.ts +1 -0
- package/node_modules/@sentry/core/build/types-ts3.8/types/datacategory.d.ts +1 -1
- package/node_modules/@sentry/core/build/types-ts3.8/utils/tunnel.d.ts +1 -0
- package/node_modules/@sentry/core/package.json +1 -1
- package/node_modules/@sentry/node/build/cjs/integrations/tracing/redis/index.js +1 -1
- package/node_modules/@sentry/node/build/esm/package.json +1 -1
- package/node_modules/@sentry/node/package.json +6 -6
- package/node_modules/@sentry/node-core/build/cjs/integrations/anr/index.js +1 -1
- package/node_modules/@sentry/node-core/build/cjs/integrations/contextlines.js +6 -4
- package/node_modules/@sentry/node-core/build/cjs/integrations/local-variables/local-variables-async.js +1 -1
- package/node_modules/@sentry/node-core/build/cjs/integrations/modules.js +21 -2
- package/node_modules/@sentry/node-core/build/cjs/integrations/node-fetch/undici-instrumentation.js +8 -0
- package/node_modules/@sentry/node-core/build/esm/integrations/anr/index.js +1 -1
- package/node_modules/@sentry/node-core/build/esm/integrations/anr/worker-script.js +2 -2
- package/node_modules/@sentry/node-core/build/esm/integrations/contextlines.js +7 -5
- package/node_modules/@sentry/node-core/build/esm/integrations/local-variables/local-variables-async.js +1 -1
- package/node_modules/@sentry/node-core/build/esm/integrations/local-variables/worker-script.js +1 -1
- package/node_modules/@sentry/node-core/build/esm/integrations/node-fetch/undici-instrumentation.js +8 -0
- package/node_modules/@sentry/node-core/build/esm/package.json +1 -1
- package/node_modules/@sentry/node-core/package.json +9 -9
- package/node_modules/@sentry/opentelemetry/build/esm/package.json +1 -1
- package/node_modules/@sentry/opentelemetry/package.json +6 -6
- package/node_modules/@sentry/server-utils/build/THIRD-PARTY-LICENSES.txt +32 -32
- package/node_modules/@sentry/server-utils/build/cjs/integrations/tracing-channel/express/instrumentation.js +12 -1
- package/node_modules/@sentry/server-utils/build/esm/integrations/tracing-channel/express/instrumentation.js +13 -2
- package/node_modules/@sentry/server-utils/build/esm/package.json +1 -1
- package/node_modules/@sentry/server-utils/build/types/integrations/tracing-channel/express/types.d.ts +1 -1
- package/node_modules/@sentry/server-utils/build/types-ts3.8/integrations/tracing-channel/express/types.d.ts +1 -1
- package/node_modules/@sentry/server-utils/package.json +2 -2
- package/node_modules/debug/package.json +1 -1
- package/node_modules/es-module-lexer/dist/lexer.asm.js +2 -2
- package/node_modules/es-module-lexer/dist/lexer.cjs +1 -1
- package/node_modules/es-module-lexer/dist/lexer.js +2 -2
- package/node_modules/es-module-lexer/dist/lexer.minimal.asm.js +2 -2
- package/node_modules/es-module-lexer/dist/lexer.minimal.cjs +1 -1
- package/node_modules/es-module-lexer/dist/lexer.minimal.js +2 -2
- package/node_modules/es-module-lexer/package.json +1 -1
- package/node_modules/import-in-the-middle/CHANGELOG.md +35 -0
- package/node_modules/import-in-the-middle/README.md +15 -1
- package/node_modules/import-in-the-middle/create-hook.mjs +370 -155
- package/node_modules/import-in-the-middle/index.d.ts +8 -2
- package/node_modules/import-in-the-middle/index.js +80 -53
- package/node_modules/import-in-the-middle/lib/get-esm-exports.mjs +37 -3
- package/node_modules/import-in-the-middle/lib/get-exports.mjs +33 -40
- package/node_modules/import-in-the-middle/lib/register.js +81 -16
- package/node_modules/import-in-the-middle/package.json +9 -5
- package/node_modules/supports-color/browser.js +21 -2
- package/node_modules/supports-color/index.js +41 -24
- package/node_modules/supports-color/license +1 -1
- package/node_modules/supports-color/package.json +11 -6
- package/node_modules/supports-color/readme.md +8 -7
- package/package.json +4 -4
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/package.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +1 -1
- package/plugins/pm-codex/plugin.json +1 -1
- package/runtime-dependencies.json +1 -1
- package/dist/cli-bundle/chunks/chunk-4WIVCOA7.js +0 -2
- package/dist/cli-bundle/chunks/chunk-A3WCP4TU.js +0 -6
- package/dist/cli-bundle/chunks/chunk-AB5S6TWE.js +0 -124
- package/dist/cli-bundle/chunks/chunk-BV7J3LRH.js +0 -114
- package/dist/cli-bundle/chunks/chunk-E4BQRZF2.js +0 -10
- package/dist/cli-bundle/chunks/chunk-IGEBFNWE.js +0 -2
- package/dist/cli-bundle/chunks/chunk-IYICNCK2.js +0 -2
- package/dist/cli-bundle/chunks/chunk-JD3XWF66.js +0 -3
- package/dist/cli-bundle/chunks/chunk-JLHD7OQ2.js +0 -2
- package/dist/cli-bundle/chunks/chunk-LC4DJVXR.js +0 -2
- package/dist/cli-bundle/chunks/chunk-OFZQEQ6X.js +0 -2
- package/dist/cli-bundle/chunks/chunk-QGL5IAP4.js +0 -8
- package/dist/cli-bundle/chunks/chunk-R24NZ2TB.js +0 -8
- package/dist/cli-bundle/chunks/chunk-VO2HSB5F.js +0 -2
- package/dist/cli-bundle/chunks/item-transaction-55QTCU2M.js +0 -2
- package/dist/cli-bundle/chunks/mutation-admission-WUN7JYVJ.js +0 -2
- package/dist/cli-bundle/chunks/register-mutation-SKCEP5QU.js +0 -20
- package/dist/cli-bundle/chunks/register-operations-ZT4OYCF3.js +0 -2
- package/dist/cli-bundle/chunks/register-setup-JVWNS2TY.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-3WVMEA2A.js +0 -6
- package/dist/cli-bundle/focused-chunks/chunk-5UVJOAUP.js +0 -91
- package/dist/cli-bundle/focused-chunks/chunk-5WQ3LNUK.js +0 -78
- package/dist/cli-bundle/focused-chunks/chunk-7XHE335U.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-CZFZCSOX.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-HPC2M6JD.js +0 -6
- package/dist/cli-bundle/focused-chunks/chunk-HR5FEUUL.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-J7ESCE7M.js +0 -24
- package/dist/cli-bundle/focused-chunks/chunk-KWZLY35A.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-M4IA4LC6.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-NASE6JC2.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-QJ647CQE.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZCN35TCK.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZSQ2FT22.js +0 -44
- package/dist/cli-bundle/focused-chunks/item-revision-GNKYO6GZ.js +0 -2
- package/dist/cli-bundle/focused-chunks/item-transaction-AUUQHR5Z.js +0 -2
- package/dist/cli-bundle/focused-chunks/mutation-actor-OBRD7HFZ.js +0 -2
- package/dist/cli-bundle/focused-chunks/mutation-admission-6TX3EOJX.js +0 -2
- package/dist/cli-bundle/focused-chunks/stage-LERF2YJU.js +0 -2
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_attributes.d.ts +0 -14984
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_attributes.js +0 -14991
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_events.d.ts +0 -291
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_metrics.d.ts +0 -4053
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/index-incubating.d.ts +0 -7
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/index-incubating.js +0 -13
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/index.d.ts +0 -6
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js +0 -16
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/internal/utils.d.ts +0 -7
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/internal/utils.js +0 -23
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/SemanticResourceAttributes.d.ts +0 -1453
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/SemanticResourceAttributes.js +0 -1250
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/index.d.ts +0 -2
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/index.js +0 -10
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.d.ts +0 -1726
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.d.ts +0 -5
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.js +0 -12
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_metrics.d.ts +0 -308
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/SemanticAttributes.d.ts +0 -2664
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/SemanticAttributes.js +0 -2360
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/index.d.ts +0 -2
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/index.js +0 -10
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/version.d.ts +0 -2
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/version.js +0 -7
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_attributes.d.ts +0 -14984
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_events.d.ts +0 -291
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_metrics.d.ts +0 -4053
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index-incubating.d.ts +0 -7
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index-incubating.js +0 -13
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index.d.ts +0 -6
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index.js +0 -16
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/internal/utils.d.ts +0 -7
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/internal/utils.js +0 -23
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/resource/SemanticResourceAttributes.js +0 -1250
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/resource/index.d.ts +0 -2
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/resource/index.js +0 -10
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_attributes.d.ts +0 -1726
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_events.d.ts +0 -5
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_events.js +0 -12
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_metrics.d.ts +0 -308
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_metrics.js +0 -315
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/trace/SemanticAttributes.js +0 -2360
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/trace/index.d.ts +0 -2
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/trace/index.js +0 -10
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/version.d.ts +0 -2
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/version.js +0 -7
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_attributes.d.ts +0 -14984
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_events.d.ts +0 -291
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_events.js +0 -301
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_metrics.d.ts +0 -4053
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_metrics.js +0 -4072
- package/node_modules/@opentelemetry/semantic-conventions/build/src/index-incubating.d.ts +0 -7
- package/node_modules/@opentelemetry/semantic-conventions/build/src/index-incubating.js +0 -29
- package/node_modules/@opentelemetry/semantic-conventions/build/src/index.d.ts +0 -6
- package/node_modules/@opentelemetry/semantic-conventions/build/src/index.js +0 -32
- package/node_modules/@opentelemetry/semantic-conventions/build/src/internal/utils.d.ts +0 -7
- package/node_modules/@opentelemetry/semantic-conventions/build/src/internal/utils.js +0 -27
- package/node_modules/@opentelemetry/semantic-conventions/build/src/resource/SemanticResourceAttributes.js +0 -1255
- package/node_modules/@opentelemetry/semantic-conventions/build/src/resource/index.d.ts +0 -2
- package/node_modules/@opentelemetry/semantic-conventions/build/src/resource/index.js +0 -26
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.d.ts +0 -1726
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.js +0 -1759
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_events.d.ts +0 -5
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_events.js +0 -15
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_metrics.d.ts +0 -308
- package/node_modules/@opentelemetry/semantic-conventions/build/src/trace/SemanticAttributes.js +0 -2368
- package/node_modules/@opentelemetry/semantic-conventions/build/src/trace/index.d.ts +0 -2
- package/node_modules/@opentelemetry/semantic-conventions/build/src/trace/index.js +0 -26
- package/node_modules/@opentelemetry/semantic-conventions/build/src/version.d.ts +0 -2
- package/node_modules/@opentelemetry/semantic-conventions/build/src/version.js +0 -10
- /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
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
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
|
|
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
|
-
|
|
38
|
-
|
|
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
|
-
|
|
54
|
-
|
|
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
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
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 (
|
|
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
|
-
|
|
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
|
-
/**
|
|
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
|
|
93
|
-
//
|
|
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
|
-
|
|
135
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
276
|
-
|
|
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
|
-
|
|
336
|
-
|
|
337
|
-
|
|
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} [
|
|
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,
|
|
129
|
+
function register (name, binder, specifier, format, legacySpecifier) {
|
|
111
130
|
if (arguments.length === 5) {
|
|
112
|
-
registerLegacy(name, binder, specifier,
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
214
|
-
if (this.#overridden?.[key] === 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)
|
|
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
|
}
|