pnpm 11.0.0-alpha.1 → 11.0.0-alpha.2

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 (157) hide show
  1. package/README.md +0 -7
  2. package/bin/pnpm.cjs +3 -0
  3. package/bin/pnpx.cjs +3 -0
  4. package/dist/node_modules/.modules.yaml +19 -19
  5. package/dist/node_modules/.pnpm/lock.yaml +51 -45
  6. package/dist/node_modules/.pnpm-workspace-state-v1.json +1 -1
  7. package/dist/node_modules/@isaacs/balanced-match/dist/commonjs/index.d.ts.map +1 -0
  8. package/dist/node_modules/@isaacs/balanced-match/dist/commonjs/index.js +59 -0
  9. package/dist/node_modules/@isaacs/balanced-match/dist/commonjs/index.js.map +1 -0
  10. package/dist/node_modules/@isaacs/balanced-match/dist/esm/index.d.ts.map +1 -0
  11. package/dist/node_modules/@isaacs/balanced-match/dist/esm/index.js +54 -0
  12. package/dist/node_modules/@isaacs/balanced-match/dist/esm/index.js.map +1 -0
  13. package/dist/node_modules/@isaacs/balanced-match/package.json +79 -0
  14. package/dist/node_modules/{brace-expansion → @isaacs/brace-expansion}/LICENSE +3 -1
  15. package/dist/node_modules/@isaacs/brace-expansion/dist/commonjs/index.d.ts.map +1 -0
  16. package/dist/node_modules/@isaacs/brace-expansion/dist/commonjs/index.js +196 -0
  17. package/dist/node_modules/@isaacs/brace-expansion/dist/commonjs/index.js.map +1 -0
  18. package/dist/node_modules/@isaacs/brace-expansion/dist/commonjs/package.json +3 -0
  19. package/dist/node_modules/@isaacs/brace-expansion/dist/esm/index.d.ts.map +1 -0
  20. package/dist/node_modules/@isaacs/brace-expansion/dist/esm/index.js +193 -0
  21. package/dist/node_modules/@isaacs/brace-expansion/dist/esm/index.js.map +1 -0
  22. package/dist/node_modules/@isaacs/brace-expansion/dist/esm/package.json +3 -0
  23. package/dist/node_modules/@isaacs/brace-expansion/package.json +71 -0
  24. package/dist/node_modules/cross-spawn/node_modules/isexe/package.json +31 -0
  25. package/dist/node_modules/{glob → cross-spawn/node_modules/which}/LICENSE +1 -1
  26. package/dist/node_modules/cross-spawn/node_modules/which/package.json +43 -0
  27. package/dist/node_modules/glob/dist/commonjs/glob.js.map +1 -1
  28. package/dist/node_modules/glob/dist/commonjs/has-magic.d.ts.map +1 -1
  29. package/dist/node_modules/glob/dist/esm/bin.mjs +111 -35
  30. package/dist/node_modules/glob/dist/esm/bin.mjs.map +1 -1
  31. package/dist/node_modules/glob/dist/esm/glob.js.map +1 -1
  32. package/dist/node_modules/glob/dist/esm/has-magic.d.ts.map +1 -1
  33. package/dist/node_modules/glob/package.json +18 -20
  34. package/dist/node_modules/isexe/LICENSE +1 -1
  35. package/dist/node_modules/isexe/dist/cjs/package.json +3 -0
  36. package/dist/node_modules/isexe/dist/mjs/package.json +3 -0
  37. package/dist/node_modules/isexe/package.json +79 -14
  38. package/dist/node_modules/jackspeak/dist/commonjs/index.d.ts.map +1 -1
  39. package/dist/node_modules/jackspeak/dist/commonjs/index.js +237 -300
  40. package/dist/node_modules/jackspeak/dist/commonjs/index.js.map +1 -1
  41. package/dist/node_modules/jackspeak/dist/esm/index.d.ts.map +1 -1
  42. package/dist/node_modules/jackspeak/dist/esm/index.js +232 -296
  43. package/dist/node_modules/jackspeak/dist/esm/index.js.map +1 -1
  44. package/dist/node_modules/jackspeak/package.json +13 -14
  45. package/dist/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map +1 -1
  46. package/dist/node_modules/minimatch/dist/commonjs/ast.d.ts.map +1 -1
  47. package/dist/node_modules/minimatch/dist/commonjs/ast.js +4 -5
  48. package/dist/node_modules/minimatch/dist/commonjs/ast.js.map +1 -1
  49. package/dist/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map +1 -1
  50. package/dist/node_modules/minimatch/dist/commonjs/brace-expressions.js.map +1 -1
  51. package/dist/node_modules/minimatch/dist/commonjs/escape.d.ts.map +1 -1
  52. package/dist/node_modules/minimatch/dist/commonjs/escape.js +10 -2
  53. package/dist/node_modules/minimatch/dist/commonjs/escape.js.map +1 -1
  54. package/dist/node_modules/minimatch/dist/commonjs/index.d.ts.map +1 -1
  55. package/dist/node_modules/minimatch/dist/commonjs/index.js +20 -8
  56. package/dist/node_modules/minimatch/dist/commonjs/index.js.map +1 -1
  57. package/dist/node_modules/minimatch/dist/commonjs/unescape.d.ts.map +1 -1
  58. package/dist/node_modules/minimatch/dist/commonjs/unescape.js +22 -8
  59. package/dist/node_modules/minimatch/dist/commonjs/unescape.js.map +1 -1
  60. package/dist/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map +1 -1
  61. package/dist/node_modules/minimatch/dist/esm/ast.d.ts.map +1 -1
  62. package/dist/node_modules/minimatch/dist/esm/ast.js +4 -5
  63. package/dist/node_modules/minimatch/dist/esm/ast.js.map +1 -1
  64. package/dist/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map +1 -1
  65. package/dist/node_modules/minimatch/dist/esm/brace-expressions.js.map +1 -1
  66. package/dist/node_modules/minimatch/dist/esm/escape.d.ts.map +1 -1
  67. package/dist/node_modules/minimatch/dist/esm/escape.js +10 -2
  68. package/dist/node_modules/minimatch/dist/esm/escape.js.map +1 -1
  69. package/dist/node_modules/minimatch/dist/esm/index.d.ts.map +1 -1
  70. package/dist/node_modules/minimatch/dist/esm/index.js +19 -4
  71. package/dist/node_modules/minimatch/dist/esm/index.js.map +1 -1
  72. package/dist/node_modules/minimatch/dist/esm/unescape.d.ts.map +1 -1
  73. package/dist/node_modules/minimatch/dist/esm/unescape.js +22 -8
  74. package/dist/node_modules/minimatch/dist/esm/unescape.js.map +1 -1
  75. package/dist/node_modules/minimatch/package.json +17 -21
  76. package/dist/node_modules/path-scurry/dist/commonjs/index.d.ts.map +1 -1
  77. package/dist/node_modules/path-scurry/dist/commonjs/index.js +6 -2
  78. package/dist/node_modules/path-scurry/dist/commonjs/index.js.map +1 -1
  79. package/dist/node_modules/path-scurry/dist/esm/index.d.ts.map +1 -1
  80. package/dist/node_modules/path-scurry/dist/esm/index.js +6 -2
  81. package/dist/node_modules/path-scurry/dist/esm/index.js.map +1 -1
  82. package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.d.ts.map +1 -0
  83. package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +1585 -0
  84. package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js.map +1 -0
  85. package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.min.js +2 -0
  86. package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.min.js.map +7 -0
  87. package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/package.json +3 -0
  88. package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.d.ts.map +1 -0
  89. package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.js +1581 -0
  90. package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.js.map +1 -0
  91. package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.min.js +2 -0
  92. package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.min.js.map +7 -0
  93. package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/esm/package.json +3 -0
  94. package/dist/node_modules/path-scurry/node_modules/lru-cache/package.json +101 -0
  95. package/dist/node_modules/path-scurry/package.json +15 -16
  96. package/dist/node_modules/which/package.json +29 -20
  97. package/dist/pnpm.mjs +11697 -16820
  98. package/dist/worker.js +126 -507
  99. package/package.json +1 -1
  100. package/dist/node_modules/@pkgjs/parseargs/LICENSE +0 -201
  101. package/dist/node_modules/@pkgjs/parseargs/index.js +0 -396
  102. package/dist/node_modules/@pkgjs/parseargs/internal/errors.js +0 -47
  103. package/dist/node_modules/@pkgjs/parseargs/internal/primordials.js +0 -393
  104. package/dist/node_modules/@pkgjs/parseargs/internal/util.js +0 -14
  105. package/dist/node_modules/@pkgjs/parseargs/internal/validators.js +0 -89
  106. package/dist/node_modules/@pkgjs/parseargs/package.json +0 -36
  107. package/dist/node_modules/@pkgjs/parseargs/utils.js +0 -198
  108. package/dist/node_modules/balanced-match/.github/FUNDING.yml +0 -2
  109. package/dist/node_modules/balanced-match/index.js +0 -62
  110. package/dist/node_modules/balanced-match/package.json +0 -48
  111. package/dist/node_modules/brace-expansion/.github/FUNDING.yml +0 -2
  112. package/dist/node_modules/brace-expansion/index.js +0 -203
  113. package/dist/node_modules/brace-expansion/package.json +0 -49
  114. package/dist/node_modules/jackspeak/dist/commonjs/parse-args-cjs.cjs.map +0 -1
  115. package/dist/node_modules/jackspeak/dist/commonjs/parse-args-cjs.d.cts.map +0 -1
  116. package/dist/node_modules/jackspeak/dist/commonjs/parse-args.js +0 -50
  117. package/dist/node_modules/jackspeak/dist/esm/parse-args.d.ts.map +0 -1
  118. package/dist/node_modules/jackspeak/dist/esm/parse-args.js +0 -26
  119. package/dist/node_modules/jackspeak/dist/esm/parse-args.js.map +0 -1
  120. package/dist/node_modules/minimatch/LICENSE +0 -15
  121. package/dist/node_modules/node-gyp/node_modules/isexe/LICENSE +0 -15
  122. package/dist/node_modules/node-gyp/node_modules/isexe/package.json +0 -96
  123. package/dist/node_modules/node-gyp/node_modules/which/package.json +0 -52
  124. /package/dist/node_modules/{node-gyp/node_modules/isexe/dist/cjs → @isaacs/balanced-match/dist/commonjs}/package.json +0 -0
  125. /package/dist/node_modules/{node-gyp/node_modules/isexe/dist/mjs → @isaacs/balanced-match/dist/esm}/package.json +0 -0
  126. /package/dist/node_modules/{node-gyp/node_modules/which → cross-spawn/node_modules/isexe}/LICENSE +0 -0
  127. /package/dist/node_modules/{isexe → cross-spawn/node_modules/isexe}/index.js +0 -0
  128. /package/dist/node_modules/{isexe → cross-spawn/node_modules/isexe}/mode.js +0 -0
  129. /package/dist/node_modules/{isexe → cross-spawn/node_modules/isexe}/windows.js +0 -0
  130. /package/dist/node_modules/{which → cross-spawn/node_modules/which}/bin/node-which +0 -0
  131. /package/dist/node_modules/{which → cross-spawn/node_modules/which}/which.js +0 -0
  132. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/cjs/index.d.ts.map +0 -0
  133. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/cjs/index.js +0 -0
  134. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/cjs/index.js.map +0 -0
  135. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/cjs/options.d.ts.map +0 -0
  136. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/cjs/options.js +0 -0
  137. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/cjs/options.js.map +0 -0
  138. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/cjs/posix.d.ts.map +0 -0
  139. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/cjs/posix.js +0 -0
  140. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/cjs/posix.js.map +0 -0
  141. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/cjs/win32.d.ts.map +0 -0
  142. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/cjs/win32.js +0 -0
  143. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/cjs/win32.js.map +0 -0
  144. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/mjs/index.d.ts.map +0 -0
  145. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/mjs/index.js +0 -0
  146. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/mjs/index.js.map +0 -0
  147. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/mjs/options.d.ts.map +0 -0
  148. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/mjs/options.js +0 -0
  149. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/mjs/options.js.map +0 -0
  150. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/mjs/posix.d.ts.map +0 -0
  151. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/mjs/posix.js +0 -0
  152. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/mjs/posix.js.map +0 -0
  153. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/mjs/win32.d.ts.map +0 -0
  154. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/mjs/win32.js +0 -0
  155. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/mjs/win32.js.map +0 -0
  156. /package/dist/node_modules/{node-gyp/node_modules/which → which}/bin/which.js +0 -0
  157. /package/dist/node_modules/{node-gyp/node_modules/which → which}/lib/index.js +0 -0
package/README.md CHANGED
@@ -144,13 +144,6 @@ To quote the [Rush](https://rushjs.io/) team:
144
144
  </picture>
145
145
  </a>
146
146
  </td>
147
- <td align="center" valign="middle">
148
- <a href="https://opensource.mercedes-benz.com/?utm_source=pnpm&utm_medium=readme" target="_blank">
149
- <img src="https://pnpm.io/img/users/mercedes.svg" width="32" alt="Vite">
150
- </a>
151
- </td>
152
- </tr>
153
- <tr>
154
147
  <td align="center" valign="middle">
155
148
  <a href="https://oomol.com/?utm_source=pnpm&utm_medium=readme" target="_blank">
156
149
  <picture>
package/bin/pnpm.cjs ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ // CommonJS shim for compatibility with older Corepack versions
3
+ import('./pnpm.mjs')
package/bin/pnpx.cjs ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ // CommonJS shim for compatibility with older Corepack versions
3
+ import('./pnpx.mjs')
@@ -1,6 +1,10 @@
1
1
  hoistPattern:
2
2
  - '*'
3
3
  hoistedLocations:
4
+ '@isaacs/balanced-match@4.0.1':
5
+ - node_modules/@isaacs/balanced-match
6
+ '@isaacs/brace-expansion@5.0.0':
7
+ - node_modules/@isaacs/brace-expansion
4
8
  '@isaacs/cliui@8.0.2':
5
9
  - node_modules/@isaacs/cliui
6
10
  '@isaacs/fs-minipass@4.0.1':
@@ -9,26 +13,20 @@ hoistedLocations:
9
13
  - node_modules/@npmcli/agent
10
14
  '@npmcli/fs@4.0.0':
11
15
  - node_modules/@npmcli/fs
12
- '@pkgjs/parseargs@0.11.0':
13
- - node_modules/@pkgjs/parseargs
14
16
  abbrev@3.0.1:
15
17
  - node_modules/abbrev
16
18
  agent-base@7.1.4:
17
19
  - node_modules/agent-base
18
20
  ansi-regex@5.0.1:
21
+ - node_modules/wrap-ansi-cjs/node_modules/ansi-regex
19
22
  - node_modules/strip-ansi-cjs/node_modules/ansi-regex
20
23
  - node_modules/string-width-cjs/node_modules/ansi-regex
21
- - node_modules/wrap-ansi-cjs/node_modules/ansi-regex
22
24
  ansi-regex@6.2.2:
23
25
  - node_modules/ansi-regex
24
26
  ansi-styles@4.3.0:
25
27
  - node_modules/wrap-ansi-cjs/node_modules/ansi-styles
26
28
  ansi-styles@6.2.3:
27
29
  - node_modules/ansi-styles
28
- balanced-match@1.0.2:
29
- - node_modules/balanced-match
30
- brace-expansion@2.0.2:
31
- - node_modules/brace-expansion
32
30
  cacache@19.0.1:
33
31
  - node_modules/cacache
34
32
  chownr@3.0.0:
@@ -44,8 +42,8 @@ hoistedLocations:
44
42
  eastasianwidth@0.2.0:
45
43
  - node_modules/eastasianwidth
46
44
  emoji-regex@8.0.0:
47
- - node_modules/string-width-cjs/node_modules/emoji-regex
48
45
  - node_modules/wrap-ansi-cjs/node_modules/emoji-regex
46
+ - node_modules/string-width-cjs/node_modules/emoji-regex
49
47
  emoji-regex@9.2.2:
50
48
  - node_modules/emoji-regex
51
49
  encoding@0.1.13:
@@ -62,7 +60,7 @@ hoistedLocations:
62
60
  - node_modules/foreground-child
63
61
  fs-minipass@3.0.3:
64
62
  - node_modules/fs-minipass
65
- glob@10.4.5:
63
+ glob@11.1.0:
66
64
  - node_modules/glob
67
65
  graceful-fs@4.2.11:
68
66
  - node_modules/graceful-fs
@@ -81,16 +79,18 @@ hoistedLocations:
81
79
  is-fullwidth-code-point@3.0.0:
82
80
  - node_modules/is-fullwidth-code-point
83
81
  isexe@2.0.0:
84
- - node_modules/isexe
82
+ - node_modules/cross-spawn/node_modules/isexe
85
83
  isexe@3.1.1:
86
- - node_modules/node-gyp/node_modules/isexe
87
- jackspeak@3.4.3:
84
+ - node_modules/isexe
85
+ jackspeak@4.1.1:
88
86
  - node_modules/jackspeak
89
87
  lru-cache@10.4.3:
90
88
  - node_modules/lru-cache
89
+ lru-cache@11.2.4:
90
+ - node_modules/path-scurry/node_modules/lru-cache
91
91
  make-fetch-happen@14.0.3:
92
92
  - node_modules/make-fetch-happen
93
- minimatch@9.0.5:
93
+ minimatch@10.1.1:
94
94
  - node_modules/minimatch
95
95
  minipass-collect@2.0.1:
96
96
  - node_modules/minipass-collect
@@ -124,7 +124,7 @@ hoistedLocations:
124
124
  - node_modules/package-json-from-dist
125
125
  path-key@3.1.1:
126
126
  - node_modules/path-key
127
- path-scurry@1.11.1:
127
+ path-scurry@2.0.1:
128
128
  - node_modules/path-scurry
129
129
  picomatch@4.0.3:
130
130
  - node_modules/picomatch
@@ -158,8 +158,8 @@ hoistedLocations:
158
158
  string-width@5.1.2:
159
159
  - node_modules/string-width
160
160
  strip-ansi@6.0.1:
161
- - node_modules/string-width-cjs/node_modules/strip-ansi
162
161
  - node_modules/wrap-ansi-cjs/node_modules/strip-ansi
162
+ - node_modules/string-width-cjs/node_modules/strip-ansi
163
163
  - node_modules/strip-ansi-cjs
164
164
  strip-ansi@7.1.2:
165
165
  - node_modules/strip-ansi
@@ -174,9 +174,9 @@ hoistedLocations:
174
174
  v8-compile-cache@2.4.0:
175
175
  - node_modules/v8-compile-cache
176
176
  which@2.0.2:
177
- - node_modules/which
177
+ - node_modules/cross-spawn/node_modules/which
178
178
  which@5.0.0:
179
- - node_modules/node-gyp/node_modules/which
179
+ - node_modules/which
180
180
  wrap-ansi@7.0.0:
181
181
  - node_modules/wrap-ansi-cjs
182
182
  wrap-ansi@8.1.0:
@@ -194,9 +194,9 @@ included:
194
194
  injectedDeps: {}
195
195
  layoutVersion: 5
196
196
  nodeLinker: hoisted
197
- packageManager: pnpm@10.22.0
197
+ packageManager: pnpm@11.0.0-alpha.1
198
198
  pendingBuilds: []
199
- prunedAt: Thu, 13 Nov 2025 17:30:23 GMT
199
+ prunedAt: Mon, 15 Dec 2025 14:17:44 GMT
200
200
  publicHoistPattern: []
201
201
  registries:
202
202
  '@jsr': https://npm.jsr.io/
@@ -6,20 +6,23 @@ settings:
6
6
 
7
7
  overrides:
8
8
  '@yarnpkg/fslib@2': '3'
9
- body-parser@<1.20.3: ^1.20.3
9
+ body-parser@<2.2.1: ^2.2.1
10
10
  clipanion: 3.2.0-rc.6
11
11
  cookie@<0.7.0: '>=0.7.0'
12
12
  cross-spawn@<7.0.5: '>=7.0.5'
13
13
  debug@<3.1.0: '>=3.1.0'
14
- express@<4.20.0: ^4.20.0
14
+ express@<4.22.1: ^4.22.1
15
15
  follow-redirects@<=1.15.5: '>=1.15.6'
16
16
  glob-parent@<5.1.2: '>=5.1.2'
17
+ glob@>=10.3.7 <=11.0.3: ^11.1.0
17
18
  hosted-git-info@1: npm:@pnpm/hosted-git-info@1.0.0
18
19
  http-proxy-middleware@<2.0.7: ^2.0.7
19
20
  istanbul-reports: npm:@zkochan/istanbul-reports
21
+ js-yaml@<3.14.2: ^3.14.2
20
22
  js-yaml@^4.0.0: npm:@zkochan/js-yaml@0.0.10
21
23
  json5@<2.2.2: ^2.2.3
22
24
  jsonwebtoken@<=8.5.1: '>=9.0.0'
25
+ jws@<3.2.3: ^3.2.3
23
26
  nopt@5: npm:@pnpm/nopt@^0.2.1
24
27
  on-headers@<1.1.0: '>=1.1.0'
25
28
  path-to-regexp@<0.1.12: ^0.1.12
@@ -32,6 +35,7 @@ overrides:
32
35
  socks@2: ^2.8.1
33
36
  tmp@<=0.2.3: '>=0.2.4'
34
37
  tough-cookie@<4.1.3: '>=4.1.3'
38
+ validator@<13.15.22: '>=13.15.22'
35
39
  yaml@<2.2.2: '>=2.2.2'
36
40
 
37
41
  importers:
@@ -48,6 +52,14 @@ importers:
48
52
 
49
53
  packages:
50
54
 
55
+ '@isaacs/balanced-match@4.0.1':
56
+ resolution: {integrity: sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==}
57
+ engines: {node: 20 || >=22}
58
+
59
+ '@isaacs/brace-expansion@5.0.0':
60
+ resolution: {integrity: sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA==}
61
+ engines: {node: 20 || >=22}
62
+
51
63
  '@isaacs/cliui@8.0.2':
52
64
  resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==}
53
65
  engines: {node: '>=12'}
@@ -64,10 +76,6 @@ packages:
64
76
  resolution: {integrity: sha512-/xGlezI6xfGO9NwuJlnwz/K14qD1kCSAGtacBHnGzeAIuJGazcp45KP5NuyARXoKb7cwulAGWVsbeSxdG/cb0Q==}
65
77
  engines: {node: ^18.17.0 || >=20.5.0}
66
78
 
67
- '@pkgjs/parseargs@0.11.0':
68
- resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==}
69
- engines: {node: '>=14'}
70
-
71
79
  abbrev@3.0.1:
72
80
  resolution: {integrity: sha512-AO2ac6pjRB3SJmGJo+v5/aK6Omggp6fsLrs6wN9bd35ulu4cCwaAU9+7ZhXjeqHVkaHThLuzH0nZr0YpCDhygg==}
73
81
  engines: {node: ^18.17.0 || >=20.5.0}
@@ -92,12 +100,6 @@ packages:
92
100
  resolution: {integrity: sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==}
93
101
  engines: {node: '>=12'}
94
102
 
95
- balanced-match@1.0.2:
96
- resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==}
97
-
98
- brace-expansion@2.0.2:
99
- resolution: {integrity: sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==}
100
-
101
103
  cacache@19.0.1:
102
104
  resolution: {integrity: sha512-hdsUxulXCi5STId78vRVYEtDAjq99ICAUktLTeTYsLoTE6Z8dS0c8pWNCxwdrk9YfJeobDZc2Y186hD/5ZQgFQ==}
103
105
  engines: {node: ^18.17.0 || >=20.5.0}
@@ -165,8 +167,9 @@ packages:
165
167
  resolution: {integrity: sha512-XUBA9XClHbnJWSfBzjkm6RvPsyg3sryZt06BEQoXcF7EK/xpGaQYJgQKDJSUH5SGZ76Y7pFx1QBnXz09rU5Fbw==}
166
168
  engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
167
169
 
168
- glob@10.4.5:
169
- resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==}
170
+ glob@11.1.0:
171
+ resolution: {integrity: sha512-vuNwKSaKiqm7g0THUBu2x7ckSs3XJLXE+2ssL7/MfTGPLLcrJQ/4Uq1CjPTtO5cCIiRxqvN6Twy1qOwhL0Xjcw==}
172
+ engines: {node: 20 || >=22}
170
173
  hasBin: true
171
174
 
172
175
  graceful-fs@4.2.11:
@@ -206,19 +209,24 @@ packages:
206
209
  resolution: {integrity: sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==}
207
210
  engines: {node: '>=16'}
208
211
 
209
- jackspeak@3.4.3:
210
- resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==}
212
+ jackspeak@4.1.1:
213
+ resolution: {integrity: sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ==}
214
+ engines: {node: 20 || >=22}
211
215
 
212
216
  lru-cache@10.4.3:
213
217
  resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==}
214
218
 
219
+ lru-cache@11.2.4:
220
+ resolution: {integrity: sha512-B5Y16Jr9LB9dHVkh6ZevG+vAbOsNOYCX+sXvFWFu7B3Iz5mijW3zdbMyhsh8ANd2mSWBYdJgnqi+mL7/LrOPYg==}
221
+ engines: {node: 20 || >=22}
222
+
215
223
  make-fetch-happen@14.0.3:
216
224
  resolution: {integrity: sha512-QMjGbFTP0blj97EeidG5hk/QhKQ3T4ICckQGLgz38QF7Vgbk6e6FTARN8KhKxyBbWn8R0HU+bnw8aSoFPD4qtQ==}
217
225
  engines: {node: ^18.17.0 || >=20.5.0}
218
226
 
219
- minimatch@9.0.5:
220
- resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==}
221
- engines: {node: '>=16 || 14 >=14.17'}
227
+ minimatch@10.1.1:
228
+ resolution: {integrity: sha512-enIvLvRAFZYXJzkCYG5RKmPfrFArdLv+R+lbQ53BmIMLIry74bjKzX6iHAm8WYamJkhSSEabrWN5D97XnKObjQ==}
229
+ engines: {node: 20 || >=22}
222
230
 
223
231
  minipass-collect@2.0.1:
224
232
  resolution: {integrity: sha512-D7V8PO9oaz7PWGLbCACuI1qEOsq7UKfLotx/C0Aet43fCUB/wfQ7DYeq2oR/svFJGYDHPr38SHATeaj/ZoKHKw==}
@@ -280,9 +288,9 @@ packages:
280
288
  resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==}
281
289
  engines: {node: '>=8'}
282
290
 
283
- path-scurry@1.11.1:
284
- resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==}
285
- engines: {node: '>=16 || 14 >=14.18'}
291
+ path-scurry@2.0.1:
292
+ resolution: {integrity: sha512-oWyT4gICAu+kaA7QWk/jvCHWarMKNs6pXOGWKDTr7cw4IGcUbW+PeTfbaQiLGheFRpjo6O9J0PmyMfQPjH71oA==}
293
+ engines: {node: 20 || >=22}
286
294
 
287
295
  picomatch@4.0.3:
288
296
  resolution: {integrity: sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==}
@@ -398,6 +406,14 @@ packages:
398
406
 
399
407
  snapshots:
400
408
 
409
+ '@isaacs/balanced-match@4.0.1':
410
+ optional: true
411
+
412
+ '@isaacs/brace-expansion@5.0.0':
413
+ dependencies:
414
+ '@isaacs/balanced-match': 4.0.1
415
+ optional: true
416
+
401
417
  '@isaacs/cliui@8.0.2':
402
418
  dependencies:
403
419
  string-width: 5.1.2
@@ -429,9 +445,6 @@ snapshots:
429
445
  semver: 7.7.3
430
446
  optional: true
431
447
 
432
- '@pkgjs/parseargs@0.11.0':
433
- optional: true
434
-
435
448
  abbrev@3.0.1:
436
449
  optional: true
437
450
 
@@ -452,19 +465,11 @@ snapshots:
452
465
  ansi-styles@6.2.3:
453
466
  optional: true
454
467
 
455
- balanced-match@1.0.2:
456
- optional: true
457
-
458
- brace-expansion@2.0.2:
459
- dependencies:
460
- balanced-match: 1.0.2
461
- optional: true
462
-
463
468
  cacache@19.0.1:
464
469
  dependencies:
465
470
  '@npmcli/fs': 4.0.0
466
471
  fs-minipass: 3.0.3
467
- glob: 10.4.5
472
+ glob: 11.1.0
468
473
  lru-cache: 10.4.3
469
474
  minipass: 7.1.2
470
475
  minipass-collect: 2.0.1
@@ -538,14 +543,14 @@ snapshots:
538
543
  minipass: 7.1.2
539
544
  optional: true
540
545
 
541
- glob@10.4.5:
546
+ glob@11.1.0:
542
547
  dependencies:
543
548
  foreground-child: 3.3.1
544
- jackspeak: 3.4.3
545
- minimatch: 9.0.5
549
+ jackspeak: 4.1.1
550
+ minimatch: 10.1.1
546
551
  minipass: 7.1.2
547
552
  package-json-from-dist: 1.0.1
548
- path-scurry: 1.11.1
553
+ path-scurry: 2.0.1
549
554
  optional: true
550
555
 
551
556
  graceful-fs@4.2.11:
@@ -590,16 +595,17 @@ snapshots:
590
595
  isexe@3.1.1:
591
596
  optional: true
592
597
 
593
- jackspeak@3.4.3:
598
+ jackspeak@4.1.1:
594
599
  dependencies:
595
600
  '@isaacs/cliui': 8.0.2
596
- optionalDependencies:
597
- '@pkgjs/parseargs': 0.11.0
598
601
  optional: true
599
602
 
600
603
  lru-cache@10.4.3:
601
604
  optional: true
602
605
 
606
+ lru-cache@11.2.4:
607
+ optional: true
608
+
603
609
  make-fetch-happen@14.0.3:
604
610
  dependencies:
605
611
  '@npmcli/agent': 3.0.0
@@ -617,9 +623,9 @@ snapshots:
617
623
  - supports-color
618
624
  optional: true
619
625
 
620
- minimatch@9.0.5:
626
+ minimatch@10.1.1:
621
627
  dependencies:
622
- brace-expansion: 2.0.2
628
+ '@isaacs/brace-expansion': 5.0.0
623
629
  optional: true
624
630
 
625
631
  minipass-collect@2.0.1:
@@ -700,9 +706,9 @@ snapshots:
700
706
  path-key@3.1.1:
701
707
  optional: true
702
708
 
703
- path-scurry@1.11.1:
709
+ path-scurry@2.0.1:
704
710
  dependencies:
705
- lru-cache: 10.4.3
711
+ lru-cache: 11.2.4
706
712
  minipass: 7.1.2
707
713
  optional: true
708
714
 
@@ -1,5 +1,5 @@
1
1
  {
2
- "lastValidatedTimestamp": 1763055023343,
2
+ "lastValidatedTimestamp": 1765808264576,
3
3
  "projects": {},
4
4
  "pnpmfiles": [],
5
5
  "settings": {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,GACnB,GAAG,MAAM,GAAG,MAAM,EAClB,GAAG,MAAM,GAAG,MAAM,EAClB,KAAK,MAAM;;;;;;aAgBZ,CAAA;AAOD,eAAO,MAAM,KAAK,GAChB,GAAG,MAAM,EACT,GAAG,MAAM,EACT,KAAK,MAAM,KACV,SAAS,GAAG,CAAC,MAAM,EAAE,MAAM,CA2C7B,CAAA"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.range = exports.balanced = void 0;
4
+ const balanced = (a, b, str) => {
5
+ const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
6
+ const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
7
+ const r = ma !== null && mb != null && (0, exports.range)(ma, mb, str);
8
+ return (r && {
9
+ start: r[0],
10
+ end: r[1],
11
+ pre: str.slice(0, r[0]),
12
+ body: str.slice(r[0] + ma.length, r[1]),
13
+ post: str.slice(r[1] + mb.length),
14
+ });
15
+ };
16
+ exports.balanced = balanced;
17
+ const maybeMatch = (reg, str) => {
18
+ const m = str.match(reg);
19
+ return m ? m[0] : null;
20
+ };
21
+ const range = (a, b, str) => {
22
+ let begs, beg, left, right = undefined, result;
23
+ let ai = str.indexOf(a);
24
+ let bi = str.indexOf(b, ai + 1);
25
+ let i = ai;
26
+ if (ai >= 0 && bi > 0) {
27
+ if (a === b) {
28
+ return [ai, bi];
29
+ }
30
+ begs = [];
31
+ left = str.length;
32
+ while (i >= 0 && !result) {
33
+ if (i === ai) {
34
+ begs.push(i);
35
+ ai = str.indexOf(a, i + 1);
36
+ }
37
+ else if (begs.length === 1) {
38
+ const r = begs.pop();
39
+ if (r !== undefined)
40
+ result = [r, bi];
41
+ }
42
+ else {
43
+ beg = begs.pop();
44
+ if (beg !== undefined && beg < left) {
45
+ left = beg;
46
+ right = bi;
47
+ }
48
+ bi = str.indexOf(b, i + 1);
49
+ }
50
+ i = ai < bi && ai >= 0 ? ai : bi;
51
+ }
52
+ if (begs.length && right !== undefined) {
53
+ result = [left, right];
54
+ }
55
+ }
56
+ return result;
57
+ };
58
+ exports.range = range;
59
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAO,MAAM,QAAQ,GAAG,CACtB,CAAkB,EAClB,CAAkB,EAClB,GAAW,EACX,EAAE;IACF,MAAM,EAAE,GAAG,CAAC,YAAY,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACvD,MAAM,EAAE,GAAG,CAAC,YAAY,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAEvD,MAAM,CAAC,GAAG,EAAE,KAAK,IAAI,IAAI,EAAE,IAAI,IAAI,IAAI,IAAA,aAAK,EAAC,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAA;IAEzD,OAAO,CACL,CAAC,IAAI;QACH,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;QACX,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;QACT,GAAG,EAAE,GAA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;YACzB,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;gBACb,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;gBACZ,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;YAC5B,CAAC;iBAAM,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC7B,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;gBACpB,IAAI,CAAC,KAAK,SAAS;oBAAE,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;YACvC,CAAC;iBAAM,CAAC;gBACN,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;gBAChB,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,GAAG,IAAI,EAAE,CAAC;oBACpC,IAAI,GAAG,GAAG,CAAA;oBACV,KAAK,GAAG,EAAE,CAAA;gBACZ,CAAC;gBAED,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;YAC5B,CAAC;YAED,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;QAClC,CAAC;QAED,IAAI,IAAI,CAAC,MAAM,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACvC,MAAM,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QACxB,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AA/CY,QAAA,KAAK,SA+CjB","sourcesContent":["export const balanced = (\n a: string | RegExp,\n b: string | RegExp,\n str: string,\n) => {\n const ma = a instanceof RegExp ? maybeMatch(a, str) : a\n const mb = b instanceof RegExp ? maybeMatch(b, str) : b\n\n const r = ma !== null && mb != null && range(ma, mb, str)\n\n return (\n r && {\n start: r[0],\n end: r[1],\n pre: str.slice(0, r[0]),\n body: str.slice(r[0] + ma.length, r[1]),\n post: str.slice(r[1] + mb.length),\n }\n )\n}\n\nconst maybeMatch = (reg: RegExp, str: string) => {\n const m = str.match(reg)\n return m ? m[0] : null\n}\n\nexport const range = (\n a: string,\n b: string,\n str: string,\n): undefined | [number, number] => {\n let begs: number[],\n beg: number | undefined,\n left: number,\n right: number | undefined = undefined,\n result: undefined | [number, number]\n let ai = str.indexOf(a)\n let bi = str.indexOf(b, ai + 1)\n let i = ai\n\n if (ai >= 0 && bi > 0) {\n if (a === b) {\n return [ai, bi]\n }\n begs = []\n left = str.length\n\n while (i >= 0 && !result) {\n if (i === ai) {\n begs.push(i)\n ai = str.indexOf(a, i + 1)\n } else if (begs.length === 1) {\n const r = begs.pop()\n if (r !== undefined) result = [r, bi]\n } else {\n beg = begs.pop()\n if (beg !== undefined && beg < left) {\n left = beg\n right = bi\n }\n\n bi = str.indexOf(b, i + 1)\n }\n\n i = ai < bi && ai >= 0 ? ai : bi\n }\n\n if (begs.length && right !== undefined) {\n result = [left, right]\n }\n }\n\n return result\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,GACnB,GAAG,MAAM,GAAG,MAAM,EAClB,GAAG,MAAM,GAAG,MAAM,EAClB,KAAK,MAAM;;;;;;aAgBZ,CAAA;AAOD,eAAO,MAAM,KAAK,GAChB,GAAG,MAAM,EACT,GAAG,MAAM,EACT,KAAK,MAAM,KACV,SAAS,GAAG,CAAC,MAAM,EAAE,MAAM,CA2C7B,CAAA"}
@@ -0,0 +1,54 @@
1
+ export const balanced = (a, b, str) => {
2
+ const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
3
+ const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
4
+ const r = ma !== null && mb != null && range(ma, mb, str);
5
+ return (r && {
6
+ start: r[0],
7
+ end: r[1],
8
+ pre: str.slice(0, r[0]),
9
+ body: str.slice(r[0] + ma.length, r[1]),
10
+ post: str.slice(r[1] + mb.length),
11
+ });
12
+ };
13
+ const maybeMatch = (reg, str) => {
14
+ const m = str.match(reg);
15
+ return m ? m[0] : null;
16
+ };
17
+ export const range = (a, b, str) => {
18
+ let begs, beg, left, right = undefined, result;
19
+ let ai = str.indexOf(a);
20
+ let bi = str.indexOf(b, ai + 1);
21
+ let i = ai;
22
+ if (ai >= 0 && bi > 0) {
23
+ if (a === b) {
24
+ return [ai, bi];
25
+ }
26
+ begs = [];
27
+ left = str.length;
28
+ while (i >= 0 && !result) {
29
+ if (i === ai) {
30
+ begs.push(i);
31
+ ai = str.indexOf(a, i + 1);
32
+ }
33
+ else if (begs.length === 1) {
34
+ const r = begs.pop();
35
+ if (r !== undefined)
36
+ result = [r, bi];
37
+ }
38
+ else {
39
+ beg = begs.pop();
40
+ if (beg !== undefined && beg < left) {
41
+ left = beg;
42
+ right = bi;
43
+ }
44
+ bi = str.indexOf(b, i + 1);
45
+ }
46
+ i = ai < bi && ai >= 0 ? ai : bi;
47
+ }
48
+ if (begs.length && right !== undefined) {
49
+ result = [left, right];
50
+ }
51
+ }
52
+ return result;
53
+ };
54
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,CAAkB,EAClB,CAAkB,EAClB,GAAW,EACX,EAAE;IACF,MAAM,EAAE,GAAG,CAAC,YAAY,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACvD,MAAM,EAAE,GAAG,CAAC,YAAY,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAEvD,MAAM,CAAC,GAAG,EAAE,KAAK,IAA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string | RegExp,\n b: string | RegExp,\n str: string,\n) => {\n const ma = a instanceof RegExp ? maybeMatch(a, str) : a\n const mb = b instanceof RegExp ? maybeMatch(b, str) : b\n\n const r = ma !== null && mb != null && range(ma, mb, str)\n\n return (\n r && {\n start: r[0],\n end: r[1],\n pre: str.slice(0, r[0]),\n body: str.slice(r[0] + ma.length, r[1]),\n post: str.slice(r[1] + mb.length),\n }\n )\n}\n\nconst maybeMatch = (reg: RegExp, str: string) => {\n const m = str.match(reg)\n return m ? m[0] : null\n}\n\nexport const range = (\n a: string,\n b: string,\n str: string,\n): undefined | [number, number] => {\n let begs: number[],\n beg: number | undefined,\n left: number,\n right: number | undefined = undefined,\n result: undefined | [number, number]\n let ai = str.indexOf(a)\n let bi = str.indexOf(b, ai + 1)\n let i = ai\n\n if (ai >= 0 && bi > 0) {\n if (a === b) {\n return [ai, bi]\n }\n begs = []\n left = str.length\n\n while (i >= 0 && !result) {\n if (i === ai) {\n begs.push(i)\n ai = str.indexOf(a, i + 1)\n } else if (begs.length === 1) {\n const r = begs.pop()\n if (r !== undefined) result = [r, bi]\n } else {\n beg = begs.pop()\n if (beg !== undefined && beg < left) {\n left = beg\n right = bi\n }\n\n bi = str.indexOf(b, i + 1)\n }\n\n i = ai < bi && ai >= 0 ? ai : bi\n }\n\n if (begs.length && right !== undefined) {\n result = [left, right]\n }\n }\n\n return result\n}\n"]}
@@ -0,0 +1,79 @@
1
+ {
2
+ "name": "@isaacs/balanced-match",
3
+ "description": "Match balanced character pairs, like \"{\" and \"}\"",
4
+ "version": "4.0.1",
5
+ "files": [
6
+ "dist"
7
+ ],
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git://github.com/isaacs/balanced-match.git"
11
+ },
12
+ "exports": {
13
+ "./package.json": "./package.json",
14
+ ".": {
15
+ "import": {
16
+ "types": "./dist/esm/index.d.ts",
17
+ "default": "./dist/esm/index.js"
18
+ },
19
+ "require": {
20
+ "types": "./dist/commonjs/index.d.ts",
21
+ "default": "./dist/commonjs/index.js"
22
+ }
23
+ }
24
+ },
25
+ "type": "module",
26
+ "scripts": {
27
+ "preversion": "npm test",
28
+ "postversion": "npm publish",
29
+ "prepublishOnly": "git push origin --follow-tags",
30
+ "prepare": "tshy",
31
+ "pretest": "npm run prepare",
32
+ "presnap": "npm run prepare",
33
+ "test": "tap",
34
+ "snap": "tap",
35
+ "format": "prettier --write . --loglevel warn",
36
+ "benchmark": "node benchmark/index.js",
37
+ "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts"
38
+ },
39
+ "prettier": {
40
+ "semi": false,
41
+ "printWidth": 80,
42
+ "tabWidth": 2,
43
+ "useTabs": false,
44
+ "singleQuote": true,
45
+ "jsxSingleQuote": false,
46
+ "bracketSameLine": true,
47
+ "arrowParens": "avoid",
48
+ "endOfLine": "lf"
49
+ },
50
+ "devDependencies": {
51
+ "@types/brace-expansion": "^1.1.2",
52
+ "@types/node": "^24.0.0",
53
+ "mkdirp": "^3.0.1",
54
+ "prettier": "^3.3.2",
55
+ "tap": "^21.1.0",
56
+ "tshy": "^3.0.2",
57
+ "typedoc": "^0.28.5"
58
+ },
59
+ "keywords": [
60
+ "match",
61
+ "regexp",
62
+ "test",
63
+ "balanced",
64
+ "parse"
65
+ ],
66
+ "license": "MIT",
67
+ "engines": {
68
+ "node": "20 || >=22"
69
+ },
70
+ "tshy": {
71
+ "exports": {
72
+ "./package.json": "./package.json",
73
+ ".": "./src/index.ts"
74
+ }
75
+ },
76
+ "main": "./dist/commonjs/index.js",
77
+ "types": "./dist/commonjs/index.d.ts",
78
+ "module": "./dist/esm/index.js"
79
+ }
@@ -1,6 +1,8 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
3
+ Copyright Julian Gruber <julian@juliangruber.com>
4
+
5
+ TypeScript port Copyright Isaac Z. Schlueter <i@izs.me>
4
6
 
5
7
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
8
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAwEA,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,YAgBjC"}