@psnext/slingcli 2.5.20260727-1 → 2.5.20260731-1

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 (235) hide show
  1. package/bin/sling.js +163 -0
  2. package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +856 -57
  3. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/index.js +8 -5
  4. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsJsonRpcProtocol.js +1 -1
  5. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsRestJsonProtocol.js +1 -1
  6. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonSettings.js +1 -0
  7. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/{JsonCodec.js → codec-v1/JsonCodec.js} +1 -1
  8. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v1/JsonSettings.js +1 -0
  9. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/{JsonShapeDeserializer.js → codec-v1/JsonShapeDeserializer.js} +6 -6
  10. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/{JsonShapeSerializer.js → codec-v1/JsonShapeSerializer.js} +3 -3
  11. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.js +103 -0
  12. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonCodec2.js +20 -0
  13. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/{experimental/BufferJsonShapeDeserializer.js → codec-v2/JsonShapeDeserializer2.js} +38 -18
  14. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/{experimental/ByteJsonShapeSerializer.js → codec-v2/JsonShapeSerializer2.js} +66 -60
  15. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/index.d.ts +9 -6
  16. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJson1_0Protocol.d.ts +1 -1
  17. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJson1_1Protocol.d.ts +1 -1
  18. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +1 -1
  19. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsRestJsonProtocol.d.ts +1 -1
  20. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/JsonSettings.d.ts +7 -0
  21. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/{JsonCodec.d.ts → codec-v1/JsonCodec.d.ts} +4 -8
  22. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v1/JsonSettings.d.ts +7 -0
  23. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/{JsonShapeDeserializer.d.ts → codec-v1/JsonShapeDeserializer.d.ts} +3 -2
  24. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/{JsonShapeSerializer.d.ts → codec-v1/JsonShapeSerializer.d.ts} +3 -2
  25. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +51 -0
  26. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v2/JsonCodec2.d.ts +13 -0
  27. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/{experimental/BufferJsonShapeDeserializer.d.ts → codec-v2/JsonShapeDeserializer2.d.ts} +4 -3
  28. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/{experimental/ByteJsonShapeSerializer.d.ts → codec-v2/JsonShapeSerializer2.d.ts} +19 -16
  29. package/node_modules/@aws-sdk/core/dist-types/ts3.4/api-extractor-type-index.d.ts +4 -7
  30. package/node_modules/@aws-sdk/core/dist-types/ts3.4/index.d.ts +61 -21
  31. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/account-id-endpoint/AccountIdEndpointModeConfigResolver.d.ts +13 -27
  32. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/account-id-endpoint/AccountIdEndpointModeConstants.d.ts +4 -16
  33. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/account-id-endpoint/NodeAccountIdEndpointModeConfigOptions.d.ts +5 -14
  34. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/account-id-endpoint/index.d.ts +16 -5
  35. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/emitWarningIfUnsupportedVersion.d.ts +4 -11
  36. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/index.browser.d.ts +107 -47
  37. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/index.d.ts +112 -39
  38. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/index.native.d.ts +107 -48
  39. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/longPollMiddleware.d.ts +13 -14
  40. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-host-header/hostHeaderMiddleware.d.ts +25 -35
  41. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-logger/loggerMiddleware.d.ts +14 -4
  42. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-recursion-detection/configuration.d.ts +2 -6
  43. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-recursion-detection/getRecursionDetectionPlugin.browser.d.ts +2 -5
  44. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-recursion-detection/getRecursionDetectionPlugin.d.ts +2 -5
  45. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-recursion-detection/recursionDetectionMiddleware.browser.d.ts +2 -6
  46. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-recursion-detection/recursionDetectionMiddleware.d.ts +2 -10
  47. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-recursion-detection/recursionDetectionMiddleware.native.d.ts +2 -6
  48. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-user-agent/check-features.d.ts +16 -20
  49. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-user-agent/configurations.d.ts +21 -44
  50. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-user-agent/constants.d.ts +7 -7
  51. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-user-agent/encode-features.d.ts +2 -5
  52. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-user-agent/user-agent-middleware.d.ts +18 -18
  53. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/region-config-resolver/awsRegionConfig.d.ts +8 -11
  54. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/region-config-resolver/extensions.d.ts +14 -16
  55. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/region-config-resolver/stsRegionDefaultResolver.browser.d.ts +1 -4
  56. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/region-config-resolver/stsRegionDefaultResolver.d.ts +7 -14
  57. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/region-config-resolver/stsRegionDefaultResolver.native.d.ts +1 -4
  58. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/setCredentialFeature.d.ts +6 -7
  59. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/setFeature.d.ts +6 -12
  60. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/setTokenFeature.d.ts +6 -7
  61. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/aws.d.ts +2 -2
  62. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/lib/aws/isVirtualHostableS3Bucket.d.ts +4 -5
  63. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/lib/aws/parseArn.d.ts +2 -7
  64. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/lib/aws/partition.d.ts +28 -38
  65. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/lib/aws/partitions.d.ts +647 -638
  66. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/lib/isIpAddress.d.ts +1 -1
  67. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/resolveDefaultAwsRegionalEndpointsConfig.d.ts +29 -56
  68. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/resolveEndpoint.d.ts +1 -1
  69. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/types/EndpointError.d.ts +1 -1
  70. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/types/EndpointRuleObject.d.ts +6 -1
  71. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/types/ErrorRuleObject.d.ts +1 -1
  72. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/types/RuleSetObject.d.ts +1 -1
  73. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/types/TreeRuleObject.d.ts +1 -1
  74. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/types/shared.d.ts +12 -1
  75. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-browser/configurations.d.ts +4 -7
  76. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-browser/createUserAgentStringParsingProvider.d.ts +7 -14
  77. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-browser/defaultUserAgent.browser.d.ts +7 -2
  78. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-browser/defaultUserAgent.d.ts +18 -27
  79. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-browser/defaultUserAgent.native.d.ts +13 -18
  80. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-node/crt-availability.d.ts +3 -8
  81. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-node/defaultUserAgent.d.ts +17 -28
  82. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-node/getRuntimeUserAgentPair.d.ts +2 -6
  83. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-node/is-crt-available.d.ts +2 -5
  84. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-node/nodeAppIdConfigOptions.d.ts +4 -13
  85. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4ASigner.d.ts +9 -10
  86. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.d.ts +39 -44
  87. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/NODE_AUTH_SCHEME_PREFERENCE_OPTIONS.d.ts +2 -5
  88. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/clock-skew-defaults.browser.d.ts +1 -6
  89. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/clock-skew-defaults.d.ts +1 -7
  90. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/clock-skew-node-config.d.ts +4 -13
  91. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/index.d.ts +23 -7
  92. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4AConfig.d.ts +13 -38
  93. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.d.ts +57 -133
  94. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/index.browser.d.ts +32 -11
  95. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/index.d.ts +32 -9
  96. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/utils/getArrayForCommaSeparatedString.d.ts +1 -8
  97. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/utils/getBearerTokenEnvKey.d.ts +1 -6
  98. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/utils/getDateHeader.d.ts +2 -8
  99. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/utils/getSkewCorrectedDate.d.ts +1 -8
  100. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/utils/getUpdatedSystemClockOffset.d.ts +6 -26
  101. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/utils/index.d.ts +4 -4
  102. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/utils/isClockSkewed.d.ts +1 -9
  103. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/ConfigurableSerdeContext.d.ts +5 -8
  104. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/ProtocolLib.d.ts +40 -74
  105. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/UnionSerde.d.ts +9 -24
  106. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/cbor/AwsSmithyRpcV2CborProtocol.d.ts +36 -25
  107. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/coercing-serializers.d.ts +3 -18
  108. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/common.d.ts +5 -2
  109. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/index.d.ts +30 -22
  110. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJson1_0Protocol.d.ts +21 -22
  111. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJson1_1Protocol.d.ts +21 -22
  112. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +49 -29
  113. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsRestJsonProtocol.d.ts +49 -36
  114. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/JsonSettings.d.ts +4 -0
  115. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/awsExpectUnion.d.ts +1 -7
  116. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonCodec.d.ts +11 -0
  117. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonSettings.d.ts +4 -0
  118. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeDeserializer.d.ts +13 -0
  119. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeSerializer.d.ts +18 -0
  120. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +27 -0
  121. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonCodec2.d.ts +9 -0
  122. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.d.ts +15 -0
  123. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeSerializer2.d.ts +39 -0
  124. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/detectBufferParsing.d.ts +1 -1
  125. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/jsonReplacer.d.ts +7 -21
  126. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/jsonReviver.d.ts +7 -15
  127. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/needsReviver.d.ts +2 -11
  128. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/parseJsonBody.d.ts +14 -22
  129. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/query/AwsEc2QueryProtocol.d.ts +18 -27
  130. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/query/AwsQueryProtocol.d.ts +57 -49
  131. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/query/QuerySerializerSettings.d.ts +7 -13
  132. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/query/QueryShapeSerializer.d.ts +21 -16
  133. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/writeKey.d.ts +1 -4
  134. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/xml/AwsRestXmlProtocol.d.ts +47 -31
  135. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/xml/XmlCodec.d.ts +17 -14
  136. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/xml/XmlShapeDeserializer.d.ts +15 -20
  137. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/xml/XmlShapeSerializer.d.ts +21 -21
  138. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/xml/parseXmlBody.d.ts +4 -13
  139. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/xml/simpleFormatXml.d.ts +1 -6
  140. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/util/index.d.ts +3 -3
  141. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/util/util-arn-parser/arn.d.ts +14 -32
  142. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/util/util-format-url/format-url.d.ts +4 -2
  143. package/node_modules/@aws-sdk/core/package.json +3 -3
  144. package/node_modules/@aws-sdk/credential-provider-env/package.json +3 -3
  145. package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/package.json +2 -2
  146. package/node_modules/@aws-sdk/credential-provider-http/package.json +5 -5
  147. package/node_modules/@aws-sdk/credential-provider-ini/package.json +11 -11
  148. package/node_modules/@aws-sdk/credential-provider-login/package.json +4 -4
  149. package/node_modules/@aws-sdk/credential-provider-node/package.json +9 -9
  150. package/node_modules/@aws-sdk/credential-provider-process/package.json +3 -3
  151. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/package.json +4 -4
  152. package/node_modules/@aws-sdk/credential-provider-sso/package.json +5 -5
  153. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +4 -4
  154. package/node_modules/@aws-sdk/eventstream-handler-node/package.json +2 -2
  155. package/node_modules/@aws-sdk/middleware-eventstream/package.json +2 -2
  156. package/node_modules/@aws-sdk/middleware-websocket/package.json +5 -5
  157. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
  158. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
  159. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
  160. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
  161. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
  162. package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/package.json +2 -2
  163. package/node_modules/@aws-sdk/nested-clients/package.json +6 -6
  164. package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +2 -2
  165. package/node_modules/@earendil-works/pi-coding-agent/docs/compaction.md +14 -9
  166. package/node_modules/@earendil-works/pi-coding-agent/docs/containerization.md +16 -16
  167. package/node_modules/@earendil-works/pi-coding-agent/docs/custom-provider.md +12 -9
  168. package/node_modules/@earendil-works/pi-coding-agent/docs/docs.json +1 -5
  169. package/node_modules/@earendil-works/pi-coding-agent/docs/environment-variables.md +88 -0
  170. package/node_modules/@earendil-works/pi-coding-agent/docs/extensions.md +54 -36
  171. package/node_modules/@earendil-works/pi-coding-agent/docs/index.md +9 -6
  172. package/node_modules/@earendil-works/pi-coding-agent/docs/json.md +5 -1
  173. package/node_modules/@earendil-works/pi-coding-agent/docs/llama-cpp.md +7 -7
  174. package/node_modules/@earendil-works/pi-coding-agent/docs/mcp.md +1 -1
  175. package/node_modules/@earendil-works/pi-coding-agent/docs/models.md +13 -9
  176. package/node_modules/@earendil-works/pi-coding-agent/docs/packages.md +13 -13
  177. package/node_modules/@earendil-works/pi-coding-agent/docs/prompt-templates.md +2 -2
  178. package/node_modules/@earendil-works/pi-coding-agent/docs/quickstart.md +22 -22
  179. package/node_modules/@earendil-works/pi-coding-agent/docs/rpc.md +106 -10
  180. package/node_modules/@earendil-works/pi-coding-agent/docs/sdk.md +1186 -0
  181. package/node_modules/@earendil-works/pi-coding-agent/docs/security.md +4 -4
  182. package/node_modules/@earendil-works/pi-coding-agent/docs/session-format.md +18 -4
  183. package/node_modules/@earendil-works/pi-coding-agent/docs/sessions.md +1 -1
  184. package/node_modules/@earendil-works/pi-coding-agent/docs/settings.md +8 -8
  185. package/node_modules/@earendil-works/pi-coding-agent/docs/shell-aliases.md +1 -1
  186. package/node_modules/@earendil-works/pi-coding-agent/docs/skills.md +6 -6
  187. package/node_modules/@earendil-works/pi-coding-agent/docs/terminal-setup.md +2 -2
  188. package/node_modules/@earendil-works/pi-coding-agent/docs/termux.md +1 -1
  189. package/node_modules/@earendil-works/pi-coding-agent/docs/themes.md +2 -2
  190. package/node_modules/@earendil-works/pi-coding-agent/docs/tmux.md +4 -4
  191. package/node_modules/@earendil-works/pi-coding-agent/docs/usage.md +12 -25
  192. package/node_modules/@earendil-works/pi-coding-agent/docs/windows.md +1 -1
  193. package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +1561 -337
  194. package/node_modules/@smithy/core/dist-es/submodules/cbor/CborCodec.js +4 -205
  195. package/node_modules/@smithy/core/dist-es/submodules/cbor/cbor-encode.js +1 -1
  196. package/node_modules/@smithy/core/dist-es/submodules/cbor/codec-v1/CborShapeDeserializer.js +113 -0
  197. package/node_modules/@smithy/core/dist-es/submodules/cbor/codec-v1/CborShapeSerializer.js +103 -0
  198. package/node_modules/@smithy/core/dist-es/submodules/cbor/codec-v2/CborShapeDeserializer2.js +621 -0
  199. package/node_modules/@smithy/core/dist-es/submodules/cbor/codec-v2/CborShapeSerializer2.js +602 -0
  200. package/node_modules/@smithy/core/dist-es/submodules/cbor/index.js +5 -1
  201. package/node_modules/@smithy/core/dist-types/submodules/cbor/CborCodec.d.ts +5 -27
  202. package/node_modules/@smithy/core/dist-types/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +2 -2
  203. package/node_modules/@smithy/core/dist-types/submodules/cbor/codec-v1/CborShapeDeserializer.d.ts +13 -0
  204. package/node_modules/@smithy/core/dist-types/submodules/cbor/codec-v1/CborShapeSerializer.d.ts +15 -0
  205. package/node_modules/@smithy/core/dist-types/submodules/cbor/codec-v2/CborShapeDeserializer2.d.ts +18 -0
  206. package/node_modules/@smithy/core/dist-types/submodules/cbor/codec-v2/CborShapeSerializer2.d.ts +35 -0
  207. package/node_modules/@smithy/core/dist-types/submodules/cbor/index.d.ts +5 -1
  208. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/CborCodec.d.ts +5 -27
  209. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +2 -2
  210. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/codec-v1/CborShapeDeserializer.d.ts +13 -0
  211. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/codec-v1/CborShapeSerializer.d.ts +15 -0
  212. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/codec-v2/CborShapeDeserializer2.d.ts +18 -0
  213. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/codec-v2/CborShapeSerializer2.d.ts +35 -0
  214. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/index.d.ts +5 -1
  215. package/node_modules/@smithy/core/package.json +2 -1
  216. package/node_modules/@smithy/credential-provider-imds/package.json +2 -2
  217. package/node_modules/@smithy/fetch-http-handler/package.json +2 -2
  218. package/node_modules/@smithy/signature-v4/package.json +2 -2
  219. package/node_modules/@types/node/README.md +1 -1
  220. package/node_modules/@types/node/crypto.d.ts +1 -1
  221. package/node_modules/@types/node/package.json +2 -2
  222. package/node_modules/brace-expansion/README.md +1 -2
  223. package/node_modules/brace-expansion/dist/commonjs/index.js +30 -4
  224. package/node_modules/brace-expansion/dist/commonjs/index.js.map +1 -1
  225. package/node_modules/brace-expansion/dist/esm/index.js +30 -4
  226. package/node_modules/brace-expansion/dist/esm/index.js.map +1 -1
  227. package/node_modules/brace-expansion/package.json +1 -1
  228. package/package.json +2 -2
  229. package/slingshot/index.js +203 -205
  230. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/JsonCodec.d.ts +0 -19
  231. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/JsonShapeDeserializer.d.ts +0 -13
  232. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/JsonShapeSerializer.d.ts +0 -28
  233. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/experimental/BufferJsonShapeDeserializer.d.ts +0 -29
  234. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/experimental/ByteJsonShapeSerializer.d.ts +0 -57
  235. package/node_modules/@earendil-works/pi-coding-agent/docs/providers.md +0 -297
@@ -0,0 +1,18 @@
1
+ import { SerdeContext } from "@smithy/core/protocols";
2
+ import type { Schema, ShapeDeserializer } from "@smithy/types";
3
+ /**
4
+ * Single-pass CBOR deserializer that reads bytes and applies Smithy schema
5
+ * transformations in one traversal using module-level state.
6
+ *
7
+ * @internal
8
+ */
9
+ export declare class CborShapeDeserializer2 extends SerdeContext implements ShapeDeserializer<Uint8Array> {
10
+ read(schema: Schema, bytes: Uint8Array): any;
11
+ /**
12
+ * Deserialize a pre-decoded JS object per schema.
13
+ * Used by protocol error handling which passes pre-decoded objects.
14
+ *
15
+ * @internal
16
+ */
17
+ readValue(_schema: Schema, value: any): any;
18
+ }
@@ -0,0 +1,35 @@
1
+ import { SerdeContext } from "@smithy/core/protocols";
2
+ import { NormalizedSchema } from "@smithy/core/schema";
3
+ import type { Schema, ShapeSerializer } from "@smithy/types";
4
+ /**
5
+ * Single-pass CBOR serializer that walks the Smithy schema and writes CBOR bytes
6
+ * directly to a module-level buffer in one traversal. Eliminates the intermediate
7
+ * JS object tree that the multi-pass CborShapeSerializer builds.
8
+ *
9
+ * @internal
10
+ */
11
+ export declare class CborShapeSerializer2 extends SerdeContext implements ShapeSerializer<Uint8Array> {
12
+ write(schema: Schema, value: unknown): void;
13
+ flush(): Uint8Array;
14
+ }
15
+ /**
16
+ * Advance the encoding epoch. Call between serialization batches
17
+ * to allow stale cache entries to be evicted.
18
+ *
19
+ * @internal
20
+ */
21
+ export declare function advanceSinglePassEncodingEpoch(): void;
22
+ /**
23
+ * Cached CBOR struct iteration data: parallel arrays for direct indexed access.
24
+ */
25
+ export interface CborStructCache {
26
+ memberNames: string[];
27
+ memberSchemas: NormalizedSchema[];
28
+ encodedKeys: Uint8Array[];
29
+ }
30
+ /**
31
+ * Builds or retrieves the CBOR-specific struct cache for a given NormalizedSchema.
32
+ * On first call, iterates structIterator() to populate NormalizedSchema's own cache,
33
+ * then builds pre-encoded CBOR key bytes for each member.
34
+ */
35
+ export declare function loadCborStructIterator(ns: NormalizedSchema): CborStructCache;
@@ -2,4 +2,8 @@ export { cbor } from "./cbor";
2
2
  export { tag, tagSymbol } from "./cbor-types";
3
3
  export { buildHttpRpcRequest, checkCborResponse, dateToTag, loadSmithyRpcV2CborErrorCode, parseCborBody, parseCborErrorBody, } from "./parseCborBody";
4
4
  export { SmithyRpcV2CborProtocol } from "./SmithyRpcV2CborProtocol";
5
- export { CborCodec, CborShapeDeserializer, CborShapeSerializer } from "./CborCodec";
5
+ export { CborCodec } from "./CborCodec";
6
+ export { CborShapeSerializer } from "./codec-v1/CborShapeSerializer";
7
+ export { CborShapeDeserializer } from "./codec-v1/CborShapeDeserializer";
8
+ export { CborShapeSerializer2 } from "./codec-v2/CborShapeSerializer2";
9
+ export { CborShapeDeserializer2 } from "./codec-v2/CborShapeDeserializer2";
@@ -1,33 +1,11 @@
1
1
  import { SerdeContext } from "@smithy/core/protocols";
2
- import { Codec, Schema, ShapeDeserializer, ShapeSerializer } from "@smithy/types";
2
+ import { Codec } from "@smithy/types";
3
+ import { CborShapeSerializer2 } from "./codec-v2/CborShapeSerializer2";
4
+ import { CborShapeDeserializer2 } from "./codec-v2/CborShapeDeserializer2";
3
5
  /**
4
6
  * @public
5
7
  */
6
8
  export declare class CborCodec extends SerdeContext implements Codec<Uint8Array, Uint8Array> {
7
- createSerializer(): CborShapeSerializer;
8
- createDeserializer(): CborShapeDeserializer;
9
- }
10
- /**
11
- * @public
12
- */
13
- export declare class CborShapeSerializer extends SerdeContext implements ShapeSerializer {
14
- private value;
15
- write(schema: Schema, value: unknown): void;
16
- /**
17
- * Recursive serializer transform that copies and prepares the user input object
18
- * for CBOR serialization.
19
- */
20
- serialize(schema: Schema, source: unknown): any;
21
- flush(): Uint8Array;
22
- }
23
- /**
24
- * @public
25
- */
26
- export declare class CborShapeDeserializer extends SerdeContext implements ShapeDeserializer {
27
- read(schema: Schema, bytes: Uint8Array): any;
28
- /**
29
- * Public because it's called by the protocol implementation to deserialize errors.
30
- * @internal
31
- */
32
- readValue(_schema: Schema, value: any): any;
9
+ createSerializer(): CborShapeSerializer2;
10
+ createDeserializer(): CborShapeDeserializer2;
33
11
  }
@@ -13,8 +13,8 @@ export declare class SmithyRpcV2CborProtocol extends RpcProtocol {
13
13
  */
14
14
  protected compositeErrorRegistry: TypeRegistry;
15
15
  private codec;
16
- protected serializer: import("./CborCodec").CborShapeSerializer;
17
- protected deserializer: import("./CborCodec").CborShapeDeserializer;
16
+ protected serializer: import(".").CborShapeSerializer2;
17
+ protected deserializer: import(".").CborShapeDeserializer2;
18
18
  constructor({ defaultNamespace, errorTypeRegistries, }: {
19
19
  defaultNamespace: string;
20
20
  errorTypeRegistries?: TypeRegistry[];
@@ -0,0 +1,13 @@
1
+ import { SerdeContext } from "@smithy/core/protocols";
2
+ import { Schema, ShapeDeserializer } from "@smithy/types";
3
+ /**
4
+ * @public
5
+ */
6
+ export declare class CborShapeDeserializer extends SerdeContext implements ShapeDeserializer {
7
+ read(schema: Schema, bytes: Uint8Array): any;
8
+ /**
9
+ * Public because it's called by the protocol implementation to deserialize errors.
10
+ * @internal
11
+ */
12
+ readValue(_schema: Schema, value: any): any;
13
+ }
@@ -0,0 +1,15 @@
1
+ import { SerdeContext } from "@smithy/core/protocols";
2
+ import { Schema, ShapeSerializer } from "@smithy/types";
3
+ /**
4
+ * @public
5
+ */
6
+ export declare class CborShapeSerializer extends SerdeContext implements ShapeSerializer {
7
+ private value;
8
+ write(schema: Schema, value: unknown): void;
9
+ /**
10
+ * Recursive serializer transform that copies and prepares the user input object
11
+ * for CBOR serialization.
12
+ */
13
+ serialize(schema: Schema, source: unknown): any;
14
+ flush(): Uint8Array;
15
+ }
@@ -0,0 +1,18 @@
1
+ import { SerdeContext } from "@smithy/core/protocols";
2
+ import { Schema, ShapeDeserializer } from "@smithy/types";
3
+ /**
4
+ * Single-pass CBOR deserializer that reads bytes and applies Smithy schema
5
+ * transformations in one traversal using module-level state.
6
+ *
7
+ * @internal
8
+ */
9
+ export declare class CborShapeDeserializer2 extends SerdeContext implements ShapeDeserializer<Uint8Array> {
10
+ read(schema: Schema, bytes: Uint8Array): any;
11
+ /**
12
+ * Deserialize a pre-decoded JS object per schema.
13
+ * Used by protocol error handling which passes pre-decoded objects.
14
+ *
15
+ * @internal
16
+ */
17
+ readValue(_schema: Schema, value: any): any;
18
+ }
@@ -0,0 +1,35 @@
1
+ import { SerdeContext } from "@smithy/core/protocols";
2
+ import { NormalizedSchema } from "@smithy/core/schema";
3
+ import { Schema, ShapeSerializer } from "@smithy/types";
4
+ /**
5
+ * Single-pass CBOR serializer that walks the Smithy schema and writes CBOR bytes
6
+ * directly to a module-level buffer in one traversal. Eliminates the intermediate
7
+ * JS object tree that the multi-pass CborShapeSerializer builds.
8
+ *
9
+ * @internal
10
+ */
11
+ export declare class CborShapeSerializer2 extends SerdeContext implements ShapeSerializer<Uint8Array> {
12
+ write(schema: Schema, value: unknown): void;
13
+ flush(): Uint8Array;
14
+ }
15
+ /**
16
+ * Advance the encoding epoch. Call between serialization batches
17
+ * to allow stale cache entries to be evicted.
18
+ *
19
+ * @internal
20
+ */
21
+ export declare function advanceSinglePassEncodingEpoch(): void;
22
+ /**
23
+ * Cached CBOR struct iteration data: parallel arrays for direct indexed access.
24
+ */
25
+ export interface CborStructCache {
26
+ memberNames: string[];
27
+ memberSchemas: NormalizedSchema[];
28
+ encodedKeys: Uint8Array[];
29
+ }
30
+ /**
31
+ * Builds or retrieves the CBOR-specific struct cache for a given NormalizedSchema.
32
+ * On first call, iterates structIterator() to populate NormalizedSchema's own cache,
33
+ * then builds pre-encoded CBOR key bytes for each member.
34
+ */
35
+ export declare function loadCborStructIterator(ns: NormalizedSchema): CborStructCache;
@@ -2,4 +2,8 @@ export { cbor } from "./cbor";
2
2
  export { tag, tagSymbol } from "./cbor-types";
3
3
  export { buildHttpRpcRequest, checkCborResponse, dateToTag, loadSmithyRpcV2CborErrorCode, parseCborBody, parseCborErrorBody, } from "./parseCborBody";
4
4
  export { SmithyRpcV2CborProtocol } from "./SmithyRpcV2CborProtocol";
5
- export { CborCodec, CborShapeDeserializer, CborShapeSerializer } from "./CborCodec";
5
+ export { CborCodec } from "./CborCodec";
6
+ export { CborShapeSerializer } from "./codec-v1/CborShapeSerializer";
7
+ export { CborShapeDeserializer } from "./codec-v1/CborShapeDeserializer";
8
+ export { CborShapeSerializer2 } from "./codec-v2/CborShapeSerializer2";
9
+ export { CborShapeDeserializer2 } from "./codec-v2/CborShapeDeserializer2";
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/core",
3
- "version": "3.30.0",
3
+ "version": "3.31.1",
4
4
  "homepage": "https://github.com/smithy-lang/smithy-typescript/tree/main/packages/core",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -220,6 +220,7 @@
220
220
  "scripts": {
221
221
  "benchmark:cbor": "node ./scripts/cbor-perf.mjs",
222
222
  "benchmark:checksum": "node ./scripts/checksum-perf.mjs",
223
+ "benchmark:schema:cbor": "node ./scripts/cbor-shape-perf.mjs",
223
224
  "build": "concurrently 'yarn:build:types' 'yarn:build:es:cjs'",
224
225
  "build:es:cjs": "node ../../scripts/compilation/es_cjs.js",
225
226
  "build:types": "premove dist-types && yarn g:tsc -p tsconfig.types.json",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/credential-provider-imds",
3
- "version": "4.4.14",
3
+ "version": "4.4.16",
4
4
  "description": "AWS credential provider that sources credentials from the EC2 instance metadata service and ECS container metadata service",
5
5
  "keywords": [
6
6
  "aws",
@@ -45,7 +45,7 @@
45
45
  "test:watch": "yarn g:vitest watch"
46
46
  },
47
47
  "dependencies": {
48
- "@smithy/core": "^3.30.0",
48
+ "@smithy/core": "^3.31.1",
49
49
  "@smithy/types": "^4.16.1",
50
50
  "tslib": "^2.6.2"
51
51
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/fetch-http-handler",
3
- "version": "5.6.11",
3
+ "version": "5.6.13",
4
4
  "description": "Provides a way to make requests",
5
5
  "homepage": "https://github.com/smithy-lang/smithy-typescript/tree/main/packages/fetch-http-handler",
6
6
  "license": "Apache-2.0",
@@ -44,7 +44,7 @@
44
44
  "test:browser:watch": "yarn g:vitest watch -c vitest.config.browser.mts"
45
45
  },
46
46
  "dependencies": {
47
- "@smithy/core": "^3.30.0",
47
+ "@smithy/core": "^3.31.1",
48
48
  "@smithy/types": "^4.16.1",
49
49
  "tslib": "^2.6.2"
50
50
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/signature-v4",
3
- "version": "5.6.10",
3
+ "version": "5.6.12",
4
4
  "description": "A standalone implementation of the AWS Signature V4 request signing algorithm",
5
5
  "homepage": "https://github.com/smithy-lang/smithy-typescript/tree/main/packages/signature-v4",
6
6
  "license": "Apache-2.0",
@@ -42,7 +42,7 @@
42
42
  "test:watch": "yarn g:vitest watch"
43
43
  },
44
44
  "dependencies": {
45
- "@smithy/core": "^3.30.0",
45
+ "@smithy/core": "^3.31.1",
46
46
  "@smithy/types": "^4.16.1",
47
47
  "tslib": "^2.6.2"
48
48
  },
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Wed, 08 Jul 2026 06:47:45 GMT
11
+ * Last updated: Mon, 27 Jul 2026 17:32:10 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
@@ -1185,7 +1185,7 @@ declare module "node:crypto" {
1185
1185
  * and it will be impossible to extract the private key from the returned object.
1186
1186
  * @since v11.6.0
1187
1187
  */
1188
- function createPublicKey(key: PublicKeyInput | RawPublicKeyInput | JsonWebKeyInput | BinaryLike): KeyObject;
1188
+ function createPublicKey(key: PublicKeyInput | RawPublicKeyInput | JsonWebKeyInput | KeyLike): KeyObject;
1189
1189
  /**
1190
1190
  * Creates and returns a new key object containing a secret key for symmetric
1191
1191
  * encryption or `Hmac`.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "26.1.1",
3
+ "version": "26.1.2",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -150,6 +150,6 @@
150
150
  "undici-types": "~8.3.0"
151
151
  },
152
152
  "peerDependencies": {},
153
- "typesPublisherContentHash": "a59119b073061829bc67a5bf6bc2b8ecb0a5a6196058e3c73172a00440f4e16d",
153
+ "typesPublisherContentHash": "359a01a58cecf5a30fb7b7a7b10c4f5c332339421ef5cbc9932fc492f472a5b4",
154
154
  "typeScriptVersion": "5.6"
155
155
  }
@@ -71,9 +71,8 @@ result count stays under `max` while each result grows very long.
71
71
 
72
72
  ```js
73
73
  const expansions = expand('{a,b}'.repeat(1500), {
74
- maxLength: 100,
74
+ maxLength: 10_000,
75
75
  })
76
- // the combined length of expansions will not exceed 100 characters
77
76
  ```
78
77
 
79
78
  Valid expansions are:
@@ -130,7 +130,7 @@ function combine(acc, pre, values, max, maxLength, dropEmpties) {
130
130
  }
131
131
  // The expansion values of a single numeric (`1..5`) or alphabetic (`a..e..2`)
132
132
  // sequence body.
133
- function expandSequence(body, isAlphaSequence, max) {
133
+ function expandSequence(body, isAlphaSequence, max, maxLength) {
134
134
  const n = body.split(/\.\./);
135
135
  const N = [];
136
136
  // A sequence body always splits into two or three parts, but the compiler
@@ -153,6 +153,7 @@ function expandSequence(body, isAlphaSequence, max) {
153
153
  test = gte;
154
154
  }
155
155
  const pad = n.some(isPadded);
156
+ let length = 0;
156
157
  for (let i = x; test(i, y) && N.length < max; i += incr) {
157
158
  let c;
158
159
  if (isAlphaSequence) {
@@ -176,7 +177,10 @@ function expandSequence(body, isAlphaSequence, max) {
176
177
  }
177
178
  }
178
179
  }
180
+ if (length + c.length > maxLength)
181
+ break;
179
182
  N.push(c);
183
+ length += c.length;
180
184
  }
181
185
  return N;
182
186
  }
@@ -230,7 +234,7 @@ function expand_(str, max, maxLength, isTop) {
230
234
  }
231
235
  let values;
232
236
  if (isSequence) {
233
- values = expandSequence(m.body, isAlphaSequence, max);
237
+ values = expandSequence(m.body, isAlphaSequence, max, maxLength);
234
238
  }
235
239
  else {
236
240
  let n = parseCommaParts(m.body);
@@ -248,9 +252,31 @@ function expand_(str, max, maxLength, isTop) {
248
252
  }
249
253
  /* c8 ignore stop */
250
254
  }
255
+ // Values that `combine` is going to drop as empty produce no result, so
256
+ // they must not count against `max` - otherwise `{a,,b}` with `max: 2`
257
+ // would stop at `['a', '']` and yield one result instead of two. Skipping
258
+ // them outright keeps `values` bounded while leaving `max` a bound on
259
+ // *kept* results.
260
+ let dropsEmpties = dropEmpties && !m.post.length && !pre;
261
+ for (let d = 0; dropsEmpties && d < acc.length; d++) {
262
+ if (acc[d]) {
263
+ dropsEmpties = false;
264
+ }
265
+ }
251
266
  values = [];
252
- for (let j = 0; j < n.length; j++) {
253
- values.push.apply(values, expand_(n[j], max, maxLength, false));
267
+ let valuesLength = 0;
268
+ outer: for (let j = 0; j < n.length; j++) {
269
+ const expanded = expand_(n[j], max, maxLength, false);
270
+ for (let k = 0; k < expanded.length; k++) {
271
+ const v = expanded[k];
272
+ if (dropsEmpties && !v)
273
+ continue;
274
+ if (values.length >= max || valuesLength + v.length > maxLength) {
275
+ break outer;
276
+ }
277
+ values.push(v);
278
+ valuesLength += v.length;
279
+ }
254
280
  }
255
281
  }
256
282
  acc = combine(acc, pre, values, max, maxLength, dropEmpties && !m.post.length);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AA2FA,wBAkBC;AA7GD,mDAAyC;AAEzC,MAAM,QAAQ,GAAG,SAAS,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAA;AACjD,MAAM,OAAO,GAAG,QAAQ,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAA;AAC/C,MAAM,QAAQ,GAAG,SAAS,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAA;AACjD,MAAM,QAAQ,GAAG,SAAS,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAA;AACjD,MAAM,SAAS,GAAG,UAAU,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAA;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AC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,WAAW,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC9E,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM;YAAE,MAAK;QACzB,GAAG,GAAG,CAAC,CAAC,IAAI,CAAA;IACd,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC","sourcesContent":["import { balanced } from 'balanced-match'\n\nconst escSlash = '\\0SLASH' + Math.random() + '\\0'\nconst escOpen = '\\0OPEN' + Math.random() + '\\0'\nconst escClose = '\\0CLOSE' + Math.random() + '\\0'\nconst escComma = '\\0COMMA' + Math.random() + '\\0'\nconst escPeriod = '\\0PERIOD' + Math.random() + '\\0'\nconst escSlashPattern = new RegExp(escSlash, 'g')\nconst escOpenPattern = new RegExp(escOpen, 'g')\nconst escClosePattern = new RegExp(escClose, 'g')\nconst escCommaPattern = new RegExp(escComma, 'g')\nconst escPeriodPattern = new RegExp(escPeriod, 'g')\nconst slashPattern = /\\\\\\\\/g\nconst openPattern = /\\\\{/g\nconst closePattern = /\\\\}/g\nconst commaPattern = /\\\\,/g\nconst periodPattern = /\\\\\\./g\n\nexport const EXPANSION_MAX = 100_000\n\n// `EXPANSION_MAX` caps the *number* of expansions, but not their length. An\n// input like `'{a,b}'.repeat(1500)` stays under that count - its output is\n// truncated to 100k results - while making every result ~1500 characters\n// long. The result set, and the intermediate arrays built while combining\n// brace sets, then grow large enough to exhaust memory and crash the process\n// (CVE-2026-14257). `EXPANSION_MAX_LENGTH` bounds the total number of\n// characters the accumulator may hold at any point, so memory stays flat no\n// matter how many brace groups are chained. The limit sits well above any\n// realistic expansion (100k results hitting `EXPANSION_MAX` measure ~1M\n// characters) so legitimate input is unaffected.\nexport const EXPANSION_MAX_LENGTH = 4_000_000\n\nfunction numeric(str: string) {\n return !isNaN(str as any) ? parseInt(str, 10) : str.charCodeAt(0)\n}\n\nfunction escapeBraces(str: string) {\n return str\n .replace(slashPattern, escSlash)\n .replace(openPattern, escOpen)\n .replace(closePattern, escClose)\n .replace(commaPattern, escComma)\n .replace(periodPattern, escPeriod)\n}\n\nfunction unescapeBraces(str: string) {\n return str\n .replace(escSlashPattern, '\\\\')\n .replace(escOpenPattern, '{')\n .replace(escClosePattern, '}')\n .replace(escCommaPattern, ',')\n .replace(escPeriodPattern, '.')\n}\n\n/**\n * Basically just str.split(\",\"), but handling cases\n * where we have nested braced sections, which should be\n * treated as individual members, like {a,{b,c},d}\n */\nfunction parseCommaParts(str: string) {\n if (!str) {\n return ['']\n }\n\n const parts: string[] = []\n const m = balanced('{', '}', str)\n\n if (!m) {\n return str.split(',')\n }\n\n const { pre, body, post } = m\n const p = pre.split(',')\n\n p[p.length - 1] += '{' + body + '}'\n const postParts = parseCommaParts(post)\n if (post.length) {\n ;(p[p.length - 1] as string) += postParts.shift()\n p.push.apply(p, postParts)\n }\n\n parts.push.apply(parts, p)\n\n return parts\n}\n\nexport type BraceExpansionOptions = {\n max?: number\n maxLength?: number\n}\n\nexport function expand(str: string, options: BraceExpansionOptions = {}) {\n if (!str) {\n return []\n }\n\n const { max = EXPANSION_MAX, maxLength = EXPANSION_MAX_LENGTH } = options\n\n // I don't know why Bash 4.3 does this, but it does.\n // Anything starting with {} will have the first two bytes preserved\n // but *only* at the top level, so {},a}b will not expand to anything,\n // but a{},b}c will be expanded to [a}c,abc].\n // One could argue that this is a bug in Bash, but since the goal of\n // this module is to match Bash's rules, we escape a leading {}\n if (str.slice(0, 2) === '{}') {\n str = '\\\\{\\\\}' + str.slice(2)\n }\n\n return expand_(escapeBraces(str), max, maxLength, true).map(unescapeBraces)\n}\n\nfunction embrace(str: string) {\n return '{' + str + '}'\n}\n\nfunction isPadded(el: string) {\n return /^-?0\\d/.test(el)\n}\n\nfunction lte(i: number, y: number) {\n return i <= y\n}\n\nfunction gte(i: number, y: number) {\n return i >= y\n}\n\n// Build `{ acc[a] + pre + values[v] }` for every combination, capping the\n// number of results at `max` and the total number of characters at `maxLength`.\n// This is the one place output grows, so bounding it here keeps the single\n// accumulator - and therefore memory - flat regardless of how many brace groups\n// are combined (CVE-2026-14257).\nfunction combine(\n acc: string[],\n pre: string,\n values: string[],\n max: number,\n maxLength: number,\n dropEmpties: boolean,\n): string[] {\n const out: string[] = []\n let length = 0\n for (let a = 0; a < acc.length; a++) {\n for (let v = 0; v < values.length; v++) {\n if (out.length >= max) return out\n const expansion = (acc[a] as string) + pre + values[v]\n // Bash drops empty results at the top level. Skip them before they count\n // against `max`, so `max` bounds the number of *kept* results.\n if (dropEmpties && !expansion) continue\n if (length + expansion.length > maxLength) return out\n out.push(expansion)\n length += expansion.length\n }\n }\n return out\n}\n\n// The expansion values of a single numeric (`1..5`) or alphabetic (`a..e..2`)\n// sequence body.\nfunction expandSequence(\n body: string,\n isAlphaSequence: boolean,\n max: number,\n): string[] {\n const n = body.split(/\\.\\./)\n const N: string[] = []\n // A sequence body always splits into two or three parts, but the compiler\n // can't know that.\n /* c8 ignore start */\n if (n[0] === undefined || n[1] === undefined) {\n return N\n }\n /* c8 ignore stop */\n const x = numeric(n[0])\n const y = numeric(n[1])\n const width = Math.max(n[0].length, n[1].length)\n let incr =\n n.length === 3 && n[2] !== undefined ?\n Math.max(Math.abs(numeric(n[2])), 1)\n : 1\n let test = lte\n const reverse = y < x\n if (reverse) {\n incr *= -1\n test = gte\n }\n const pad = n.some(isPadded)\n\n for (let i = x; test(i, y) && N.length < max; i += incr) {\n let c\n if (isAlphaSequence) {\n c = String.fromCharCode(i)\n if (c === '\\\\') {\n c = ''\n }\n } else {\n c = String(i)\n if (pad) {\n const need = width - c.length\n if (need > 0) {\n const z = new Array(need + 1).join('0')\n if (i < 0) {\n c = '-' + z + c.slice(1)\n } else {\n c = z + c\n }\n }\n }\n }\n N.push(c)\n }\n return N\n}\n\nfunction expand_(\n str: string,\n max: number,\n maxLength: number,\n isTop: boolean,\n): string[] {\n // Consume the string's top-level brace groups left to right, threading a\n // running set of combined prefixes (`acc`). Expanding the tail iteratively -\n // rather than recursing on `m.post` once per group - keeps the native stack\n // depth constant, so deeply chained input (`'{a,b}'.repeat(3000)`) can no\n // longer overflow the stack, and leaves a single accumulator whose size\n // `maxLength` bounds directly (CVE-2026-14257).\n let acc: string[] = ['']\n\n // Bash drops empty results, but only when the *first* top-level group is a\n // comma set - a sequence like `{a..\\}` may legitimately yield ''. The drop\n // is on the final strings, so it is applied to whichever `combine` produces\n // them (the one with no brace set left in the tail).\n let dropEmpties = false\n let firstGroup = true\n\n for (;;) {\n const m = balanced('{', '}', str)\n\n // No brace set left: the rest of the string is literal.\n if (!m) {\n return combine(acc, str, [''], max, maxLength, dropEmpties)\n }\n\n // no need to expand pre, since it is guaranteed to be free of brace-sets\n const pre = m.pre\n\n if (/\\$$/.test(pre)) {\n acc = combine(\n acc,\n pre + '{' + m.body + '}',\n [''],\n max,\n maxLength,\n dropEmpties && !m.post.length,\n )\n firstGroup = false\n if (!m.post.length) break\n str = m.post\n continue\n }\n\n const isNumericSequence = /^-?\\d+\\.\\.-?\\d+(?:\\.\\.-?\\d+)?$/.test(m.body)\n const isAlphaSequence = /^[a-zA-Z]\\.\\.[a-zA-Z](?:\\.\\.-?\\d+)?$/.test(\n m.body,\n )\n const isSequence = isNumericSequence || isAlphaSequence\n const isOptions = m.body.indexOf(',') >= 0\n if (!isSequence && !isOptions) {\n // {a},b}\n if (m.post.match(/,(?!,).*\\}/)) {\n str = m.pre + '{' + m.body + escClose + m.post\n isTop = true\n continue\n }\n // Nothing here expands, so the whole remaining string is literal.\n return combine(\n acc,\n pre + '{' + m.body + '}' + m.post,\n [''],\n max,\n maxLength,\n dropEmpties,\n )\n }\n\n if (firstGroup) {\n dropEmpties = isTop && !isSequence\n firstGroup = false\n }\n\n let values: string[]\n if (isSequence) {\n values = expandSequence(m.body, isAlphaSequence, max)\n } else {\n let n = parseCommaParts(m.body)\n if (n.length === 1 && n[0] !== undefined) {\n // x{{a,b}}y ==> x{a}y x{b}y\n n = expand_(n[0], max, maxLength, false).map(embrace)\n //XXX is this necessary? Can't seem to hit it in tests.\n /* c8 ignore start */\n if (n.length === 1) {\n acc = combine(\n acc,\n pre + n[0],\n [''],\n max,\n maxLength,\n dropEmpties && !m.post.length,\n )\n if (!m.post.length) break\n str = m.post\n continue\n }\n /* c8 ignore stop */\n }\n\n values = []\n for (let j = 0; j < n.length; j++) {\n values.push.apply(values, expand_(n[j] as string, max, maxLength, false))\n }\n }\n\n acc = combine(acc, pre, values, max, maxLength, dropEmpties && !m.post.length)\n if (!m.post.length) break\n str = m.post\n }\n\n return acc\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AA2FA,wBAkBC;AA7GD,mDAAyC;AAEzC,MAAM,QAAQ,GAAG,SAAS,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAA;AACjD,MAAM,OAAO,GAAG,QAAQ,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAA;AAC/C,MAAM,QAAQ,GAAG,SAAS,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAA;AACjD,MAAM,QAAQ,GAAG,SAAS,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAA;AACjD,MAAM,SAAS,GAAG,UAAU,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAA;AACnD,MAAM,eAAe,GAAG,IAAI,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;AACjD,MAAM,cAAc,GAAG,IAAI,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;AAC/C,MAAM,eAAe,GAAG,IAAI,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;AACjD,MAAM,eAAe,GAAG,IAAI,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;AACjD,MAAM,gBAAgB,GAAG,IAAI,MAAM,CAAC,SAAS,EAAE,GAAG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AAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACzC,MAAM,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAW,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,CAAA;gBAC/D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;oBACzC,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAW,CAAA;oBAC/B,IAAI,YAAY,IAAI,CAAC,CAAC;wBAAE,SAAQ;oBAChC,IAAI,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,YAAY,GAAG,CAAC,CAAC,MAAM,GAAG,SAAS,EAAE,CAAC;wBAChE,MAAM,KAAK,CAAA;oBACb,CAAC;oBACD,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;oBACd,YAAY,IAAI,CAAC,CAAC,MAAM,CAAA;gBAC1B,CAAC;YACH,CAAC;QACH,CAAC;QAED,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,WAAW,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC9E,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM;YAAE,MAAK;QACzB,GAAG,GAAG,CAAC,CAAC,IAAI,CAAA;IACd,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC","sourcesContent":["import { balanced } from 'balanced-match'\n\nconst escSlash = '\\0SLASH' + Math.random() + '\\0'\nconst escOpen = '\\0OPEN' + Math.random() + '\\0'\nconst escClose = '\\0CLOSE' + Math.random() + '\\0'\nconst escComma = '\\0COMMA' + Math.random() + '\\0'\nconst escPeriod = '\\0PERIOD' + Math.random() + '\\0'\nconst escSlashPattern = new RegExp(escSlash, 'g')\nconst escOpenPattern = new RegExp(escOpen, 'g')\nconst escClosePattern = new RegExp(escClose, 'g')\nconst escCommaPattern = new RegExp(escComma, 'g')\nconst escPeriodPattern = new RegExp(escPeriod, 'g')\nconst slashPattern = /\\\\\\\\/g\nconst openPattern = /\\\\{/g\nconst closePattern = /\\\\}/g\nconst commaPattern = /\\\\,/g\nconst periodPattern = /\\\\\\./g\n\nexport const EXPANSION_MAX = 100_000\n\n// `EXPANSION_MAX` caps the *number* of expansions, but not their length. An\n// input like `'{a,b}'.repeat(1500)` stays under that count - its output is\n// truncated to 100k results - while making every result ~1500 characters\n// long. The result set, and the intermediate arrays built while combining\n// brace sets, then grow large enough to exhaust memory and crash the process\n// (CVE-2026-14257). `EXPANSION_MAX_LENGTH` bounds the total number of\n// characters the accumulator may hold at any point, so memory stays flat no\n// matter how many brace groups are chained. The limit sits well above any\n// realistic expansion (100k results hitting `EXPANSION_MAX` measure ~1M\n// characters) so legitimate input is unaffected.\nexport const EXPANSION_MAX_LENGTH = 4_000_000\n\nfunction numeric(str: string) {\n return !isNaN(str as any) ? parseInt(str, 10) : str.charCodeAt(0)\n}\n\nfunction escapeBraces(str: string) {\n return str\n .replace(slashPattern, escSlash)\n .replace(openPattern, escOpen)\n .replace(closePattern, escClose)\n .replace(commaPattern, escComma)\n .replace(periodPattern, escPeriod)\n}\n\nfunction unescapeBraces(str: string) {\n return str\n .replace(escSlashPattern, '\\\\')\n .replace(escOpenPattern, '{')\n .replace(escClosePattern, '}')\n .replace(escCommaPattern, ',')\n .replace(escPeriodPattern, '.')\n}\n\n/**\n * Basically just str.split(\",\"), but handling cases\n * where we have nested braced sections, which should be\n * treated as individual members, like {a,{b,c},d}\n */\nfunction parseCommaParts(str: string) {\n if (!str) {\n return ['']\n }\n\n const parts: string[] = []\n const m = balanced('{', '}', str)\n\n if (!m) {\n return str.split(',')\n }\n\n const { pre, body, post } = m\n const p = pre.split(',')\n\n p[p.length - 1] += '{' + body + '}'\n const postParts = parseCommaParts(post)\n if (post.length) {\n ;(p[p.length - 1] as string) += postParts.shift()\n p.push.apply(p, postParts)\n }\n\n parts.push.apply(parts, p)\n\n return parts\n}\n\nexport type BraceExpansionOptions = {\n max?: number\n maxLength?: number\n}\n\nexport function expand(str: string, options: BraceExpansionOptions = {}) {\n if (!str) {\n return []\n }\n\n const { max = EXPANSION_MAX, maxLength = EXPANSION_MAX_LENGTH } = options\n\n // I don't know why Bash 4.3 does this, but it does.\n // Anything starting with {} will have the first two bytes preserved\n // but *only* at the top level, so {},a}b will not expand to anything,\n // but a{},b}c will be expanded to [a}c,abc].\n // One could argue that this is a bug in Bash, but since the goal of\n // this module is to match Bash's rules, we escape a leading {}\n if (str.slice(0, 2) === '{}') {\n str = '\\\\{\\\\}' + str.slice(2)\n }\n\n return expand_(escapeBraces(str), max, maxLength, true).map(unescapeBraces)\n}\n\nfunction embrace(str: string) {\n return '{' + str + '}'\n}\n\nfunction isPadded(el: string) {\n return /^-?0\\d/.test(el)\n}\n\nfunction lte(i: number, y: number) {\n return i <= y\n}\n\nfunction gte(i: number, y: number) {\n return i >= y\n}\n\n// Build `{ acc[a] + pre + values[v] }` for every combination, capping the\n// number of results at `max` and the total number of characters at `maxLength`.\n// This is the one place output grows, so bounding it here keeps the single\n// accumulator - and therefore memory - flat regardless of how many brace groups\n// are combined (CVE-2026-14257).\nfunction combine(\n acc: string[],\n pre: string,\n values: string[],\n max: number,\n maxLength: number,\n dropEmpties: boolean,\n): string[] {\n const out: string[] = []\n let length = 0\n for (let a = 0; a < acc.length; a++) {\n for (let v = 0; v < values.length; v++) {\n if (out.length >= max) return out\n const expansion = (acc[a] as string) + pre + values[v]\n // Bash drops empty results at the top level. Skip them before they count\n // against `max`, so `max` bounds the number of *kept* results.\n if (dropEmpties && !expansion) continue\n if (length + expansion.length > maxLength) return out\n out.push(expansion)\n length += expansion.length\n }\n }\n return out\n}\n\n// The expansion values of a single numeric (`1..5`) or alphabetic (`a..e..2`)\n// sequence body.\nfunction expandSequence(\n body: string,\n isAlphaSequence: boolean,\n max: number,\n maxLength: number,\n): string[] {\n const n = body.split(/\\.\\./)\n const N: string[] = []\n // A sequence body always splits into two or three parts, but the compiler\n // can't know that.\n /* c8 ignore start */\n if (n[0] === undefined || n[1] === undefined) {\n return N\n }\n /* c8 ignore stop */\n const x = numeric(n[0])\n const y = numeric(n[1])\n const width = Math.max(n[0].length, n[1].length)\n let incr =\n n.length === 3 && n[2] !== undefined ?\n Math.max(Math.abs(numeric(n[2])), 1)\n : 1\n let test = lte\n const reverse = y < x\n if (reverse) {\n incr *= -1\n test = gte\n }\n const pad = n.some(isPadded)\n\n let length = 0\n for (let i = x; test(i, y) && N.length < max; i += incr) {\n let c\n if (isAlphaSequence) {\n c = String.fromCharCode(i)\n if (c === '\\\\') {\n c = ''\n }\n } else {\n c = String(i)\n if (pad) {\n const need = width - c.length\n if (need > 0) {\n const z = new Array(need + 1).join('0')\n if (i < 0) {\n c = '-' + z + c.slice(1)\n } else {\n c = z + c\n }\n }\n }\n }\n if (length + c.length > maxLength) break\n N.push(c)\n length += c.length\n }\n return N\n}\n\nfunction expand_(\n str: string,\n max: number,\n maxLength: number,\n isTop: boolean,\n): string[] {\n // Consume the string's top-level brace groups left to right, threading a\n // running set of combined prefixes (`acc`). Expanding the tail iteratively -\n // rather than recursing on `m.post` once per group - keeps the native stack\n // depth constant, so deeply chained input (`'{a,b}'.repeat(3000)`) can no\n // longer overflow the stack, and leaves a single accumulator whose size\n // `maxLength` bounds directly (CVE-2026-14257).\n let acc: string[] = ['']\n\n // Bash drops empty results, but only when the *first* top-level group is a\n // comma set - a sequence like `{a..\\}` may legitimately yield ''. The drop\n // is on the final strings, so it is applied to whichever `combine` produces\n // them (the one with no brace set left in the tail).\n let dropEmpties = false\n let firstGroup = true\n\n for (;;) {\n const m = balanced('{', '}', str)\n\n // No brace set left: the rest of the string is literal.\n if (!m) {\n return combine(acc, str, [''], max, maxLength, dropEmpties)\n }\n\n // no need to expand pre, since it is guaranteed to be free of brace-sets\n const pre = m.pre\n\n if (/\\$$/.test(pre)) {\n acc = combine(\n acc,\n pre + '{' + m.body + '}',\n [''],\n max,\n maxLength,\n dropEmpties && !m.post.length,\n )\n firstGroup = false\n if (!m.post.length) break\n str = m.post\n continue\n }\n\n const isNumericSequence = /^-?\\d+\\.\\.-?\\d+(?:\\.\\.-?\\d+)?$/.test(m.body)\n const isAlphaSequence = /^[a-zA-Z]\\.\\.[a-zA-Z](?:\\.\\.-?\\d+)?$/.test(\n m.body,\n )\n const isSequence = isNumericSequence || isAlphaSequence\n const isOptions = m.body.indexOf(',') >= 0\n if (!isSequence && !isOptions) {\n // {a},b}\n if (m.post.match(/,(?!,).*\\}/)) {\n str = m.pre + '{' + m.body + escClose + m.post\n isTop = true\n continue\n }\n // Nothing here expands, so the whole remaining string is literal.\n return combine(\n acc,\n pre + '{' + m.body + '}' + m.post,\n [''],\n max,\n maxLength,\n dropEmpties,\n )\n }\n\n if (firstGroup) {\n dropEmpties = isTop && !isSequence\n firstGroup = false\n }\n\n let values: string[]\n if (isSequence) {\n values = expandSequence(m.body, isAlphaSequence, max, maxLength)\n } else {\n let n = parseCommaParts(m.body)\n if (n.length === 1 && n[0] !== undefined) {\n // x{{a,b}}y ==> x{a}y x{b}y\n n = expand_(n[0], max, maxLength, false).map(embrace)\n //XXX is this necessary? Can't seem to hit it in tests.\n /* c8 ignore start */\n if (n.length === 1) {\n acc = combine(\n acc,\n pre + n[0],\n [''],\n max,\n maxLength,\n dropEmpties && !m.post.length,\n )\n if (!m.post.length) break\n str = m.post\n continue\n }\n /* c8 ignore stop */\n }\n\n // Values that `combine` is going to drop as empty produce no result, so\n // they must not count against `max` - otherwise `{a,,b}` with `max: 2`\n // would stop at `['a', '']` and yield one result instead of two. Skipping\n // them outright keeps `values` bounded while leaving `max` a bound on\n // *kept* results.\n let dropsEmpties = dropEmpties && !m.post.length && !pre\n for (let d = 0; dropsEmpties && d < acc.length; d++) {\n if (acc[d]) {\n dropsEmpties = false\n }\n }\n\n values = []\n let valuesLength = 0\n outer: for (let j = 0; j < n.length; j++) {\n const expanded = expand_(n[j] as string, max, maxLength, false)\n for (let k = 0; k < expanded.length; k++) {\n const v = expanded[k] as string\n if (dropsEmpties && !v) continue\n if (values.length >= max || valuesLength + v.length > maxLength) {\n break outer\n }\n values.push(v)\n valuesLength += v.length\n }\n }\n }\n\n acc = combine(acc, pre, values, max, maxLength, dropEmpties && !m.post.length)\n if (!m.post.length) break\n str = m.post\n }\n\n return acc\n}\n"]}
@@ -126,7 +126,7 @@ function combine(acc, pre, values, max, maxLength, dropEmpties) {
126
126
  }
127
127
  // The expansion values of a single numeric (`1..5`) or alphabetic (`a..e..2`)
128
128
  // sequence body.
129
- function expandSequence(body, isAlphaSequence, max) {
129
+ function expandSequence(body, isAlphaSequence, max, maxLength) {
130
130
  const n = body.split(/\.\./);
131
131
  const N = [];
132
132
  // A sequence body always splits into two or three parts, but the compiler
@@ -149,6 +149,7 @@ function expandSequence(body, isAlphaSequence, max) {
149
149
  test = gte;
150
150
  }
151
151
  const pad = n.some(isPadded);
152
+ let length = 0;
152
153
  for (let i = x; test(i, y) && N.length < max; i += incr) {
153
154
  let c;
154
155
  if (isAlphaSequence) {
@@ -172,7 +173,10 @@ function expandSequence(body, isAlphaSequence, max) {
172
173
  }
173
174
  }
174
175
  }
176
+ if (length + c.length > maxLength)
177
+ break;
175
178
  N.push(c);
179
+ length += c.length;
176
180
  }
177
181
  return N;
178
182
  }
@@ -226,7 +230,7 @@ function expand_(str, max, maxLength, isTop) {
226
230
  }
227
231
  let values;
228
232
  if (isSequence) {
229
- values = expandSequence(m.body, isAlphaSequence, max);
233
+ values = expandSequence(m.body, isAlphaSequence, max, maxLength);
230
234
  }
231
235
  else {
232
236
  let n = parseCommaParts(m.body);
@@ -244,9 +248,31 @@ function expand_(str, max, maxLength, isTop) {
244
248
  }
245
249
  /* c8 ignore stop */
246
250
  }
251
+ // Values that `combine` is going to drop as empty produce no result, so
252
+ // they must not count against `max` - otherwise `{a,,b}` with `max: 2`
253
+ // would stop at `['a', '']` and yield one result instead of two. Skipping
254
+ // them outright keeps `values` bounded while leaving `max` a bound on
255
+ // *kept* results.
256
+ let dropsEmpties = dropEmpties && !m.post.length && !pre;
257
+ for (let d = 0; dropsEmpties && d < acc.length; d++) {
258
+ if (acc[d]) {
259
+ dropsEmpties = false;
260
+ }
261
+ }
247
262
  values = [];
248
- for (let j = 0; j < n.length; j++) {
249
- values.push.apply(values, expand_(n[j], max, maxLength, false));
263
+ let valuesLength = 0;
264
+ outer: for (let j = 0; j < n.length; j++) {
265
+ const expanded = expand_(n[j], max, maxLength, false);
266
+ for (let k = 0; k < expanded.length; k++) {
267
+ const v = expanded[k];
268
+ if (dropsEmpties && !v)
269
+ continue;
270
+ if (values.length >= max || valuesLength + v.length > maxLength) {
271
+ break outer;
272
+ }
273
+ values.push(v);
274
+ valuesLength += v.length;
275
+ }
250
276
  }
251
277
  }
252
278
  acc = combine(acc, pre, values, max, maxLength, dropEmpties && !m.post.length);