@psnext/slingcli 2.4.20260507-2 → 2.4.20260509-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 (396) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/bin/sling.js +56 -14
  4. package/node_modules/@aws-sdk/client-bedrock-runtime/package.json +2 -2
  5. package/node_modules/@aws-sdk/token-providers/package.json +1 -1
  6. package/node_modules/{@mariozechner → @earendil-works}/pi-agent-core/dist/agent-loop.js +1 -1
  7. package/node_modules/{@mariozechner → @earendil-works}/pi-agent-core/dist/agent.js +4 -3
  8. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +526 -0
  9. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js +243 -0
  10. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +616 -0
  11. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js +348 -0
  12. package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution-env.js +3 -0
  13. package/node_modules/@earendil-works/pi-agent-core/dist/harness/factory.js +9 -0
  14. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js +102 -0
  15. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.js +194 -0
  16. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/jsonl.js +92 -0
  17. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/memory.js +42 -0
  18. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/shared.js +31 -0
  19. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js +196 -0
  20. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/jsonl.js +170 -0
  21. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/memory.js +90 -0
  22. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.js +258 -0
  23. package/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.js +30 -0
  24. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js +16 -0
  25. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js +97 -0
  26. package/node_modules/@earendil-works/pi-agent-core/dist/index.js +26 -0
  27. package/node_modules/{@mariozechner → @earendil-works}/pi-agent-core/dist/proxy.js +1 -1
  28. package/node_modules/{@mariozechner → @earendil-works}/pi-agent-core/package.json +7 -5
  29. package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/cli.js +6 -6
  30. package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/env-api-keys.js +1 -0
  31. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +307 -0
  32. package/node_modules/@earendil-works/pi-ai/dist/image-models.js +23 -0
  33. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.js +22 -0
  34. package/node_modules/@earendil-works/pi-ai/dist/images.js +14 -0
  35. package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/index.js +4 -0
  36. package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/models.generated.js +427 -122
  37. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.js +129 -0
  38. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.js +34 -0
  39. package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/providers/openai-codex-responses.js +1 -1
  40. package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/openai-completions.js +150 -122
  41. package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/providers/openai-responses-shared.js +14 -1
  42. package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/utils/oauth/openai-codex.js +25 -14
  43. package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/overflow.js +3 -0
  44. package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/package.json +5 -4
  45. package/node_modules/@earendil-works/pi-coding-agent/dist/bun/register-bedrock.js +4 -0
  46. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/cli/args.js +1 -0
  47. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/cli/config-selector.js +1 -1
  48. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/cli/list-models.js +1 -1
  49. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/cli/session-picker.js +1 -1
  50. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/config.js +52 -30
  51. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/agent-session.js +1 -1
  52. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/auth-storage.js +2 -2
  53. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/compaction/branch-summarization.js +1 -1
  54. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/compaction/compaction.js +1 -1
  55. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/utils.js +153 -0
  56. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/export-html/template.css +45 -1
  57. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/export-html/template.js +68 -4
  58. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/extensions/loader.js +26 -12
  59. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/keybindings.js +1 -1
  60. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/model-registry.js +3 -2
  61. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/model-resolver.js +2 -1
  62. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/package-manager.js +22 -5
  63. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/provider-display-names.js +1 -0
  64. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/sdk.js +3 -3
  65. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/bash.js +1 -1
  66. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/edit.js +1 -1
  67. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/find.js +1 -1
  68. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/grep.js +1 -1
  69. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/ls.js +1 -1
  70. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/read.js +3 -2
  71. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/render-utils.js +1 -1
  72. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/truncate.js +205 -0
  73. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/write.js +1 -1
  74. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/main.js +2 -2
  75. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/migrations.js +3 -3
  76. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/assistant-message.js +1 -1
  77. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/bash-execution.js +1 -1
  78. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/bordered-loader.js +1 -1
  79. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.js +1 -1
  80. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.js +1 -1
  81. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/config-selector.js +25 -3
  82. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/custom-editor.js +1 -1
  83. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/custom-message.js +1 -1
  84. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/earendil-announcement.js +1 -1
  85. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/extension-editor.js +1 -1
  86. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/extension-input.js +1 -1
  87. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/extension-selector.js +1 -1
  88. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/footer.js +1 -1
  89. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/keybinding-hints.js +36 -0
  90. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/login-dialog.js +4 -3
  91. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/model-selector.js +2 -2
  92. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/oauth-selector.js +1 -1
  93. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/scoped-models-selector.js +1 -1
  94. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/session-selector-search.js +1 -1
  95. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/session-selector.js +1 -1
  96. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/settings-selector.js +4 -2
  97. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/show-images-selector.js +1 -1
  98. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.js +1 -1
  99. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/theme-selector.js +1 -1
  100. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/thinking-selector.js +1 -1
  101. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +1 -1
  102. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/tree-selector.js +3 -2
  103. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/user-message-selector.js +1 -1
  104. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/user-message.js +1 -1
  105. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/visual-truncate.js +1 -1
  106. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/interactive-mode.js +47 -32
  107. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/theme/dark.json +1 -1
  108. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/theme/light.json +1 -1
  109. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/theme/theme.js +1 -1
  110. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/package-manager-cli.js +42 -39
  111. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/clipboard.js +9 -2
  112. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/paths.js +16 -0
  113. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/version-check.js +9 -2
  114. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/package.json +9 -8
  115. package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/image.js +14 -7
  116. package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/markdown.js +24 -84
  117. package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/terminal-image.js +10 -4
  118. package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/tui.js +73 -4
  119. package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/utils.js +33 -7
  120. package/node_modules/{@mariozechner → @earendil-works}/pi-tui/package.json +3 -3
  121. package/node_modules/@mariozechner/clipboard/README.md +58 -0
  122. package/node_modules/@mariozechner/clipboard/index.d.ts +23 -0
  123. package/node_modules/@mariozechner/clipboard-linux-x64-gnu/README.md +3 -0
  124. package/node_modules/@types/node/README.md +1 -1
  125. package/node_modules/@types/node/http2.d.ts +4 -1
  126. package/node_modules/@types/node/package.json +2 -2
  127. package/node_modules/@types/node/stream/web.d.ts +4 -0
  128. package/node_modules/brace-expansion/dist/commonjs/index.js +1 -1
  129. package/node_modules/brace-expansion/dist/commonjs/index.js.map +1 -1
  130. package/node_modules/brace-expansion/dist/esm/index.js +1 -1
  131. package/node_modules/brace-expansion/dist/esm/index.js.map +1 -1
  132. package/node_modules/brace-expansion/package.json +1 -1
  133. package/node_modules/fast-xml-builder/CHANGELOG.md +4 -0
  134. package/node_modules/fast-xml-builder/lib/fxb.cjs +1 -1
  135. package/node_modules/fast-xml-builder/lib/fxb.d.cts +91 -1
  136. package/node_modules/fast-xml-builder/lib/fxb.min.js +1 -1
  137. package/node_modules/fast-xml-builder/lib/fxb.min.js.map +1 -1
  138. package/node_modules/fast-xml-builder/package.json +3 -2
  139. package/node_modules/fast-xml-builder/src/fxb.d.ts +92 -3
  140. package/node_modules/fast-xml-builder/src/fxb.js +92 -31
  141. package/node_modules/fast-xml-builder/src/orderedJs2Xml.js +87 -33
  142. package/node_modules/get-east-asian-width/lookup-data.js +15 -12
  143. package/node_modules/get-east-asian-width/lookup.js +25 -22
  144. package/node_modules/get-east-asian-width/package.json +1 -1
  145. package/node_modules/jiti/README.md +258 -0
  146. package/node_modules/jiti/dist/babel.cjs +257 -0
  147. package/node_modules/jiti/dist/jiti.cjs +1 -0
  148. package/node_modules/jiti/lib/jiti.mjs +29 -0
  149. package/node_modules/jiti/lib/types.d.ts +420 -0
  150. package/node_modules/jiti/package.json +146 -0
  151. package/node_modules/protobufjs/dist/light/protobuf.js +5 -3
  152. package/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
  153. package/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
  154. package/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
  155. package/node_modules/protobufjs/dist/minimal/protobuf.js +2 -2
  156. package/node_modules/protobufjs/dist/minimal/protobuf.min.js +2 -2
  157. package/node_modules/protobufjs/dist/protobuf.js +5 -3
  158. package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
  159. package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
  160. package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
  161. package/node_modules/protobufjs/package.json +1 -1
  162. package/node_modules/protobufjs/src/namespace.js +3 -1
  163. package/node_modules/semver/README.md +19 -4
  164. package/node_modules/semver/bin/semver.js +14 -10
  165. package/node_modules/semver/functions/truncate.js +48 -0
  166. package/node_modules/semver/index.js +2 -0
  167. package/node_modules/semver/internal/re.js +1 -1
  168. package/node_modules/semver/package.json +3 -3
  169. package/node_modules/semver/range.bnf +5 -4
  170. package/node_modules/socks/package.json +2 -2
  171. package/node_modules/strnum/CHANGELOG.md +3 -0
  172. package/node_modules/strnum/package.json +3 -2
  173. package/node_modules/strnum/strnum.js +12 -10
  174. package/node_modules/xml-naming/README.md +189 -0
  175. package/node_modules/xml-naming/package.json +54 -0
  176. package/node_modules/xml-naming/src/index.d.ts +74 -0
  177. package/node_modules/xml-naming/src/index.js +270 -0
  178. package/package.json +6 -6
  179. package/sling-default-packages.json +2 -1
  180. package/slingshot/index.js +442 -23
  181. package/node_modules/@mariozechner/jiti/dist/babel.cjs +0 -246
  182. package/node_modules/@mariozechner/jiti/dist/jiti.cjs +0 -1
  183. package/node_modules/@mariozechner/jiti/package.json +0 -96
  184. package/node_modules/@mariozechner/pi-agent-core/dist/index.js +0 -9
  185. package/node_modules/@mariozechner/pi-agent-core/node_modules/@mariozechner/pi-ai/dist/cli.js +0 -116
  186. package/node_modules/@mariozechner/pi-agent-core/node_modules/@mariozechner/pi-ai/dist/env-api-keys.js +0 -166
  187. package/node_modules/@mariozechner/pi-agent-core/node_modules/@mariozechner/pi-ai/dist/index.js +0 -15
  188. package/node_modules/@mariozechner/pi-agent-core/node_modules/@mariozechner/pi-ai/dist/models.generated.js +0 -16568
  189. package/node_modules/@mariozechner/pi-agent-core/node_modules/@mariozechner/pi-ai/dist/providers/amazon-bedrock.js +0 -753
  190. package/node_modules/@mariozechner/pi-agent-core/node_modules/@mariozechner/pi-ai/dist/providers/openai-codex-responses.js +0 -909
  191. package/node_modules/@mariozechner/pi-agent-core/node_modules/@mariozechner/pi-ai/dist/providers/openai-responses-shared.js +0 -479
  192. package/node_modules/@mariozechner/pi-agent-core/node_modules/@mariozechner/pi-ai/dist/utils/oauth/openai-codex.js +0 -374
  193. package/node_modules/@mariozechner/pi-ai/dist/api-registry.js +0 -44
  194. package/node_modules/@mariozechner/pi-ai/dist/bedrock-provider.js +0 -6
  195. package/node_modules/@mariozechner/pi-ai/dist/models.js +0 -71
  196. package/node_modules/@mariozechner/pi-ai/dist/oauth.js +0 -2
  197. package/node_modules/@mariozechner/pi-ai/dist/providers/anthropic.js +0 -951
  198. package/node_modules/@mariozechner/pi-ai/dist/providers/azure-openai-responses.js +0 -208
  199. package/node_modules/@mariozechner/pi-ai/dist/providers/cloudflare.js +0 -26
  200. package/node_modules/@mariozechner/pi-ai/dist/providers/faux.js +0 -368
  201. package/node_modules/@mariozechner/pi-ai/dist/providers/github-copilot-headers.js +0 -29
  202. package/node_modules/@mariozechner/pi-ai/dist/providers/google-shared.js +0 -329
  203. package/node_modules/@mariozechner/pi-ai/dist/providers/google-vertex.js +0 -442
  204. package/node_modules/@mariozechner/pi-ai/dist/providers/google.js +0 -400
  205. package/node_modules/@mariozechner/pi-ai/dist/providers/mistral.js +0 -535
  206. package/node_modules/@mariozechner/pi-ai/dist/providers/openai-completions.js +0 -908
  207. package/node_modules/@mariozechner/pi-ai/dist/providers/openai-responses.js +0 -220
  208. package/node_modules/@mariozechner/pi-ai/dist/providers/register-builtins.js +0 -243
  209. package/node_modules/@mariozechner/pi-ai/dist/providers/simple-options.js +0 -39
  210. package/node_modules/@mariozechner/pi-ai/dist/providers/transform-messages.js +0 -184
  211. package/node_modules/@mariozechner/pi-ai/dist/stream.js +0 -27
  212. package/node_modules/@mariozechner/pi-ai/dist/types.js +0 -2
  213. package/node_modules/@mariozechner/pi-ai/dist/utils/event-stream.js +0 -81
  214. package/node_modules/@mariozechner/pi-ai/dist/utils/hash.js +0 -14
  215. package/node_modules/@mariozechner/pi-ai/dist/utils/headers.js +0 -8
  216. package/node_modules/@mariozechner/pi-ai/dist/utils/json-parse.js +0 -113
  217. package/node_modules/@mariozechner/pi-ai/dist/utils/oauth/anthropic.js +0 -335
  218. package/node_modules/@mariozechner/pi-ai/dist/utils/oauth/github-copilot.js +0 -292
  219. package/node_modules/@mariozechner/pi-ai/dist/utils/oauth/index.js +0 -121
  220. package/node_modules/@mariozechner/pi-ai/dist/utils/oauth/oauth-page.js +0 -105
  221. package/node_modules/@mariozechner/pi-ai/dist/utils/oauth/pkce.js +0 -31
  222. package/node_modules/@mariozechner/pi-ai/dist/utils/oauth/types.js +0 -2
  223. package/node_modules/@mariozechner/pi-ai/dist/utils/overflow.js +0 -146
  224. package/node_modules/@mariozechner/pi-ai/dist/utils/sanitize-unicode.js +0 -26
  225. package/node_modules/@mariozechner/pi-ai/dist/utils/typebox-helpers.js +0 -21
  226. package/node_modules/@mariozechner/pi-ai/dist/utils/validation.js +0 -281
  227. package/node_modules/@mariozechner/pi-ai/package.json +0 -108
  228. package/node_modules/@mariozechner/pi-coding-agent/dist/bun/register-bedrock.js +0 -4
  229. package/node_modules/@mariozechner/pi-coding-agent/dist/modes/interactive/components/keybinding-hints.js +0 -22
  230. package/node_modules/@mariozechner/pi-coding-agent/node_modules/@mariozechner/pi-agent-core/dist/agent-loop.js +0 -458
  231. package/node_modules/@mariozechner/pi-coding-agent/node_modules/@mariozechner/pi-agent-core/dist/agent.js +0 -398
  232. package/node_modules/@mariozechner/pi-coding-agent/node_modules/@mariozechner/pi-agent-core/dist/index.js +0 -9
  233. package/node_modules/@mariozechner/pi-coding-agent/node_modules/@mariozechner/pi-agent-core/dist/proxy.js +0 -278
  234. package/node_modules/@mariozechner/pi-coding-agent/node_modules/@mariozechner/pi-agent-core/dist/types.js +0 -2
  235. package/node_modules/@mariozechner/pi-coding-agent/node_modules/@mariozechner/pi-agent-core/package.json +0 -45
  236. package/node_modules/socks/.claude/settings.local.json +0 -26
  237. package/node_modules/std-env/LICENCE +0 -22
  238. package/node_modules/std-env/README.md +0 -118
  239. package/node_modules/std-env/dist/index.cjs +0 -1
  240. package/node_modules/std-env/dist/index.d.cts +0 -92
  241. package/node_modules/std-env/dist/index.d.mts +0 -92
  242. package/node_modules/std-env/dist/index.d.ts +0 -92
  243. package/node_modules/std-env/dist/index.mjs +0 -1
  244. package/node_modules/std-env/package.json +0 -46
  245. package/node_modules/yoctocolors/base.d.ts +0 -47
  246. package/node_modules/yoctocolors/base.js +0 -94
  247. package/node_modules/yoctocolors/index.d.ts +0 -2
  248. package/node_modules/yoctocolors/index.js +0 -2
  249. package/node_modules/yoctocolors/license +0 -9
  250. package/node_modules/yoctocolors/package.json +0 -69
  251. package/node_modules/yoctocolors/readme.md +0 -138
  252. /package/node_modules/{@mariozechner/pi-coding-agent/dist/core → @earendil-works/pi-agent-core/dist/harness}/compaction/utils.js +0 -0
  253. /package/node_modules/{@mariozechner/pi-coding-agent/dist/core/tools → @earendil-works/pi-agent-core/dist/harness/utils}/truncate.js +0 -0
  254. /package/node_modules/{@mariozechner → @earendil-works}/pi-agent-core/dist/types.js +0 -0
  255. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/api-registry.js +0 -0
  256. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/bedrock-provider.js +0 -0
  257. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/models.js +0 -0
  258. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/oauth.js +0 -0
  259. /package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/providers/amazon-bedrock.js +0 -0
  260. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/anthropic.js +0 -0
  261. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/azure-openai-responses.js +0 -0
  262. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/cloudflare.js +0 -0
  263. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/faux.js +0 -0
  264. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/github-copilot-headers.js +0 -0
  265. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/google-shared.js +0 -0
  266. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/google-vertex.js +0 -0
  267. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/google.js +0 -0
  268. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/mistral.js +0 -0
  269. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/openai-responses.js +0 -0
  270. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/register-builtins.js +0 -0
  271. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/simple-options.js +0 -0
  272. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/transform-messages.js +0 -0
  273. /package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/session-resources.js +0 -0
  274. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/stream.js +0 -0
  275. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/types.js +0 -0
  276. /package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/utils/diagnostics.js +0 -0
  277. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/event-stream.js +0 -0
  278. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/hash.js +0 -0
  279. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/headers.js +0 -0
  280. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/json-parse.js +0 -0
  281. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/oauth/anthropic.js +0 -0
  282. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/oauth/github-copilot.js +0 -0
  283. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/oauth/index.js +0 -0
  284. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/oauth/oauth-page.js +0 -0
  285. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/oauth/pkce.js +0 -0
  286. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/oauth/types.js +0 -0
  287. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/sanitize-unicode.js +0 -0
  288. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/typebox-helpers.js +0 -0
  289. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/validation.js +0 -0
  290. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/bun/cli.js +0 -0
  291. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/bun/restore-sandbox-env.js +0 -0
  292. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/cli/file-processor.js +0 -0
  293. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/cli/initial-message.js +0 -0
  294. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/cli.js +0 -0
  295. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/agent-session-runtime.js +0 -0
  296. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/agent-session-services.js +0 -0
  297. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/auth-guidance.js +0 -0
  298. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/bash-executor.js +0 -0
  299. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/compaction/index.js +0 -0
  300. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/defaults.js +0 -0
  301. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/diagnostics.js +0 -0
  302. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/event-bus.js +0 -0
  303. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/exec.js +0 -0
  304. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/export-html/ansi-to-html.js +0 -0
  305. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/export-html/index.js +0 -0
  306. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/export-html/template.html +0 -0
  307. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/export-html/tool-renderer.js +0 -0
  308. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/export-html/vendor/highlight.min.js +0 -0
  309. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/export-html/vendor/marked.min.js +0 -0
  310. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/extensions/index.js +0 -0
  311. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/extensions/runner.js +0 -0
  312. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/extensions/types.js +0 -0
  313. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/extensions/wrapper.js +0 -0
  314. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/footer-data-provider.js +0 -0
  315. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/index.js +0 -0
  316. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/messages.js +0 -0
  317. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/output-guard.js +0 -0
  318. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/prompt-templates.js +0 -0
  319. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/resolve-config-value.js +0 -0
  320. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/resource-loader.js +0 -0
  321. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/session-cwd.js +0 -0
  322. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/session-manager.js +0 -0
  323. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/settings-manager.js +0 -0
  324. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/skills.js +0 -0
  325. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/slash-commands.js +0 -0
  326. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/source-info.js +0 -0
  327. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/system-prompt.js +0 -0
  328. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/telemetry.js +0 -0
  329. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/timings.js +0 -0
  330. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/edit-diff.js +0 -0
  331. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/file-mutation-queue.js +0 -0
  332. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/index.js +0 -0
  333. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/output-accumulator.js +0 -0
  334. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/path-utils.js +0 -0
  335. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/tool-definition-wrapper.js +0 -0
  336. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/index.js +0 -0
  337. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/index.js +0 -0
  338. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/assets/clankolas.png +0 -0
  339. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/armin.js +0 -0
  340. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/countdown-timer.js +0 -0
  341. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/daxnuts.js +0 -0
  342. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/diff.js +0 -0
  343. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/dynamic-border.js +0 -0
  344. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/index.js +0 -0
  345. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/theme/theme-schema.json +0 -0
  346. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/print-mode.js +0 -0
  347. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/rpc/jsonl.js +0 -0
  348. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/rpc/rpc-client.js +0 -0
  349. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/rpc/rpc-mode.js +0 -0
  350. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/rpc/rpc-types.js +0 -0
  351. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/changelog.js +0 -0
  352. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/child-process.js +0 -0
  353. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/clipboard-image.js +0 -0
  354. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/clipboard-native.js +0 -0
  355. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/exif-orientation.js +0 -0
  356. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/frontmatter.js +0 -0
  357. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/fs-watch.js +0 -0
  358. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/git.js +0 -0
  359. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/image-convert.js +0 -0
  360. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/image-resize.js +0 -0
  361. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/mime.js +0 -0
  362. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/photon.js +0 -0
  363. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/pi-user-agent.js +0 -0
  364. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/shell.js +0 -0
  365. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/sleep.js +0 -0
  366. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/tools-manager.js +0 -0
  367. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/autocomplete.js +0 -0
  368. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/box.js +0 -0
  369. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/cancellable-loader.js +0 -0
  370. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/editor.js +0 -0
  371. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/input.js +0 -0
  372. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/loader.js +0 -0
  373. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/select-list.js +0 -0
  374. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/settings-list.js +0 -0
  375. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/spacer.js +0 -0
  376. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/text.js +0 -0
  377. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/truncated-text.js +0 -0
  378. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/editor-component.js +0 -0
  379. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/fuzzy.js +0 -0
  380. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/index.js +0 -0
  381. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/keybindings.js +0 -0
  382. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/keys.js +0 -0
  383. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/kill-ring.js +0 -0
  384. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/stdin-buffer.js +0 -0
  385. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/terminal.js +0 -0
  386. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/undo-stack.js +0 -0
  387. /package/node_modules/{@mariozechner/jiti → jiti}/LICENSE +0 -0
  388. /package/node_modules/{@mariozechner/jiti → jiti}/lib/jiti-cli.mjs +0 -0
  389. /package/node_modules/{@mariozechner/jiti → jiti}/lib/jiti-hooks.mjs +0 -0
  390. /package/node_modules/{@mariozechner/jiti → jiti}/lib/jiti-native.mjs +0 -0
  391. /package/node_modules/{@mariozechner/jiti → jiti}/lib/jiti-register.d.mts +0 -0
  392. /package/node_modules/{@mariozechner/jiti → jiti}/lib/jiti-register.mjs +0 -0
  393. /package/node_modules/{@mariozechner/jiti/lib/jiti.mjs → jiti/lib/jiti-static.mjs} +0 -0
  394. /package/node_modules/{@mariozechner/jiti → jiti}/lib/jiti.cjs +0 -0
  395. /package/node_modules/{@mariozechner/jiti → jiti}/lib/jiti.d.cts +0 -0
  396. /package/node_modules/{@mariozechner/jiti → jiti}/lib/jiti.d.mts +0 -0
@@ -4,6 +4,7 @@ import buildFromOrderedJs from './orderedJs2Xml.js';
4
4
  import getIgnoreAttributesFn from "./ignoreAttributes.js";
5
5
  import { Expression, Matcher } from 'path-expression-matcher';
6
6
  import { safeComment, safeCdata, escapeAttribute } from './util.js';
7
+ import { qName } from 'xml-naming';
7
8
 
8
9
  const defaultOptions = {
9
10
  attributeNamePrefix: '@_',
@@ -38,7 +39,11 @@ const defaultOptions = {
38
39
  // transformAttributeName: false,
39
40
  oneListGroup: false,
40
41
  maxNestedTags: 100,
41
- jPath: true // When true, callbacks receive string jPath; when false, receive Matcher instance
42
+ jPath: true, // When true, callbacks receive string jPath; when false, receive Matcher instance
43
+ sanitizeName: false // false = allow all names as-is (default, backward-compatible).
44
+ // Set to a function (name, { isAttribute, matcher }) => string to
45
+ // validate/sanitize tag and attribute names. Throw inside the function
46
+ // to reject an invalid name.
42
47
  };
43
48
 
44
49
  export default function Builder(options) {
@@ -95,6 +100,44 @@ export default function Builder(options) {
95
100
  }
96
101
  }
97
102
 
103
+ /**
104
+ * Detect XML version from the ?xml declaration at the root of a plain-object input.
105
+ * Checks both attributesGroupName and flat attribute forms.
106
+ * Returns '1.0' if no declaration is found.
107
+ */
108
+ function detectXmlVersionFromObj(jObj, options) {
109
+ const decl = jObj['?xml'];
110
+ if (decl && typeof decl === 'object') {
111
+ // attributesGroupName path e.g. { '$$': { '@_version': '1.1' } }
112
+ if (options.attributesGroupName && decl[options.attributesGroupName]) {
113
+ const v = decl[options.attributesGroupName][options.attributeNamePrefix + 'version'];
114
+ if (v) return v;
115
+ }
116
+ // flat attribute path e.g. { '@_version': '1.1' }
117
+ const v = decl[options.attributeNamePrefix + 'version'];
118
+ if (v) return v;
119
+ }
120
+ return '1.0';
121
+ }
122
+
123
+ /**
124
+ * Resolve a tag or attribute name through sanitizeName if configured.
125
+ * Validation via xml-naming's qName is performed first; the sanitizeName
126
+ * callback is invoked only when the name is invalid. If sanitizeName is
127
+ * false (default), no validation occurs and the name is used as-is.
128
+ *
129
+ * @param {string} name - raw name from the JS object
130
+ * @param {boolean} isAttribute - true when resolving an attribute name
131
+ * @param {object} options
132
+ * @param {Matcher} matcher - current matcher state (readonly from callback perspective)
133
+ * @param {string} xmlVersion - '1.0' or '1.1', forwarded to xml-naming
134
+ */
135
+ function resolveTagName(name, isAttribute, options, matcher, xmlVersion) {
136
+ if (!options.sanitizeName) return name;
137
+ if (qName(name, { xmlVersion })) return name;
138
+ return options.sanitizeName(name, { isAttribute, matcher: matcher.readOnly() });
139
+ }
140
+
98
141
  Builder.prototype.build = function (jObj) {
99
142
  if (this.options.preserveOrder) {
100
143
  return buildFromOrderedJs(jObj, this.options);
@@ -106,11 +149,12 @@ Builder.prototype.build = function (jObj) {
106
149
  }
107
150
  // Initialize matcher for path tracking
108
151
  const matcher = new Matcher();
109
- return this.j2x(jObj, 0, matcher).val;
152
+ const xmlVersion = detectXmlVersionFromObj(jObj, this.options);
153
+ return this.j2x(jObj, 0, matcher, xmlVersion).val;
110
154
  }
111
155
  };
112
156
 
113
- Builder.prototype.j2x = function (jObj, level, matcher) {
157
+ Builder.prototype.j2x = function (jObj, level, matcher, xmlVersion) {
114
158
  let attrStr = '';
115
159
  let val = '';
116
160
  if (this.options.maxNestedTags && matcher.getDepth() >= this.options.maxNestedTags) {
@@ -124,6 +168,22 @@ Builder.prototype.j2x = function (jObj, level, matcher) {
124
168
 
125
169
  for (let key in jObj) {
126
170
  if (!Object.prototype.hasOwnProperty.call(jObj, key)) continue;
171
+
172
+ // Resolve the key through sanitizeName before any use.
173
+ // Special keys (textNodeName, cdataPropName, commentPropName, attributeNamePrefix,
174
+ // attributesGroupName, "?" PI tags) are exempt — they are builder-internal conventions,
175
+ // not user-supplied XML names.
176
+ const isSpecialKey = key === this.options.textNodeName
177
+ || key === this.options.cdataPropName
178
+ || key === this.options.commentPropName
179
+ || (this.options.attributesGroupName && key === this.options.attributesGroupName)
180
+ || this.isAttribute(key)
181
+ || key[0] === '?';
182
+
183
+ const resolvedKey = isSpecialKey
184
+ ? key
185
+ : resolveTagName(key, false, this.options, matcher, xmlVersion);
186
+
127
187
  if (typeof jObj[key] === 'undefined') {
128
188
  // supress undefined node only if it is not an attribute
129
189
  if (this.isAttribute(key)) {
@@ -133,21 +193,22 @@ Builder.prototype.j2x = function (jObj, level, matcher) {
133
193
  // null attribute should be ignored by the attribute list, but should not cause the tag closing
134
194
  if (this.isAttribute(key)) {
135
195
  val += '';
136
- } else if (key === this.options.cdataPropName || key === this.options.commentPropName) {
196
+ } else if (resolvedKey === this.options.cdataPropName || resolvedKey === this.options.commentPropName) {
137
197
  val += '';
138
- } else if (key[0] === '?') {
139
- val += this.indentate(level) + '<' + key + '?' + this.tagEndChar;
198
+ } else if (resolvedKey[0] === '?') {
199
+ val += this.indentate(level) + '<' + resolvedKey + '?' + this.tagEndChar;
140
200
  } else {
141
- val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
201
+ val += this.indentate(level) + '<' + resolvedKey + '/' + this.tagEndChar;
142
202
  }
143
- // val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
144
203
  } else if (jObj[key] instanceof Date) {
145
- val += this.buildTextValNode(jObj[key], key, '', level, matcher);
204
+ val += this.buildTextValNode(jObj[key], resolvedKey, '', level, matcher);
146
205
  } else if (typeof jObj[key] !== 'object') {
147
206
  //premitive type
148
207
  const attr = this.isAttribute(key);
149
208
  if (attr && !this.ignoreAttributesFn(attr, jPath)) {
150
- attrStr += this.buildAttrPairStr(attr, '' + jObj[key], isCurrentStopNode);
209
+ // Resolve the attribute name through sanitizeName
210
+ const resolvedAttr = resolveTagName(attr, true, this.options, matcher, xmlVersion);
211
+ attrStr += this.buildAttrPairStr(resolvedAttr, '' + jObj[key], isCurrentStopNode);
151
212
  } else if (!attr) {
152
213
  //tag value
153
214
  if (key === this.options.textNodeName) {
@@ -155,7 +216,7 @@ Builder.prototype.j2x = function (jObj, level, matcher) {
155
216
  val += this.replaceEntitiesValue(newval);
156
217
  } else {
157
218
  // Check if this is a stopNode before building
158
- matcher.push(key);
219
+ matcher.push(resolvedKey);
159
220
  const isStopNode = this.checkStopNode(matcher);
160
221
  matcher.pop();
161
222
 
@@ -163,12 +224,12 @@ Builder.prototype.j2x = function (jObj, level, matcher) {
163
224
  // Build as raw content without encoding
164
225
  const textValue = '' + jObj[key];
165
226
  if (textValue === '') {
166
- val += this.indentate(level) + '<' + key + this.closeTag(key) + this.tagEndChar;
227
+ val += this.indentate(level) + '<' + resolvedKey + this.closeTag(resolvedKey) + this.tagEndChar;
167
228
  } else {
168
- val += this.indentate(level) + '<' + key + '>' + textValue + '</' + key + this.tagEndChar;
229
+ val += this.indentate(level) + '<' + resolvedKey + '>' + textValue + '</' + resolvedKey + this.tagEndChar;
169
230
  }
170
231
  } else {
171
- val += this.buildTextValNode(jObj[key], key, '', level, matcher);
232
+ val += this.buildTextValNode(jObj[key], resolvedKey, '', level, matcher);
172
233
  }
173
234
  }
174
235
  }
@@ -182,14 +243,13 @@ Builder.prototype.j2x = function (jObj, level, matcher) {
182
243
  if (typeof item === 'undefined') {
183
244
  // supress undefined node
184
245
  } else if (item === null) {
185
- if (key[0] === "?") val += this.indentate(level) + '<' + key + '?' + this.tagEndChar;
186
- else val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
187
- // val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
246
+ if (resolvedKey[0] === "?") val += this.indentate(level) + '<' + resolvedKey + '?' + this.tagEndChar;
247
+ else val += this.indentate(level) + '<' + resolvedKey + '/' + this.tagEndChar;
188
248
  } else if (typeof item === 'object') {
189
249
  if (this.options.oneListGroup) {
190
250
  // Push tag to matcher before recursive call
191
- matcher.push(key);
192
- const result = this.j2x(item, level + 1, matcher);
251
+ matcher.push(resolvedKey);
252
+ const result = this.j2x(item, level + 1, matcher, xmlVersion);
193
253
  // Pop tag from matcher after recursive call
194
254
  matcher.pop();
195
255
 
@@ -198,16 +258,16 @@ Builder.prototype.j2x = function (jObj, level, matcher) {
198
258
  listTagAttr += result.attrStr
199
259
  }
200
260
  } else {
201
- listTagVal += this.processTextOrObjNode(item, key, level, matcher)
261
+ listTagVal += this.processTextOrObjNode(item, resolvedKey, level, matcher, xmlVersion)
202
262
  }
203
263
  } else {
204
264
  if (this.options.oneListGroup) {
205
- let textValue = this.options.tagValueProcessor(key, item);
265
+ let textValue = this.options.tagValueProcessor(resolvedKey, item);
206
266
  textValue = this.replaceEntitiesValue(textValue);
207
267
  listTagVal += textValue;
208
268
  } else {
209
269
  // Check if this is a stopNode before building
210
- matcher.push(key);
270
+ matcher.push(resolvedKey);
211
271
  const isStopNode = this.checkStopNode(matcher);
212
272
  matcher.pop();
213
273
 
@@ -215,18 +275,18 @@ Builder.prototype.j2x = function (jObj, level, matcher) {
215
275
  // Build as raw content without encoding
216
276
  const textValue = '' + item;
217
277
  if (textValue === '') {
218
- listTagVal += this.indentate(level) + '<' + key + this.closeTag(key) + this.tagEndChar;
278
+ listTagVal += this.indentate(level) + '<' + resolvedKey + this.closeTag(resolvedKey) + this.tagEndChar;
219
279
  } else {
220
- listTagVal += this.indentate(level) + '<' + key + '>' + textValue + '</' + key + this.tagEndChar;
280
+ listTagVal += this.indentate(level) + '<' + resolvedKey + '>' + textValue + '</' + resolvedKey + this.tagEndChar;
221
281
  }
222
282
  } else {
223
- listTagVal += this.buildTextValNode(item, key, '', level, matcher);
283
+ listTagVal += this.buildTextValNode(item, resolvedKey, '', level, matcher);
224
284
  }
225
285
  }
226
286
  }
227
287
  }
228
288
  if (this.options.oneListGroup) {
229
- listTagVal = this.buildObjectNode(listTagVal, key, listTagAttr, level);
289
+ listTagVal = this.buildObjectNode(listTagVal, resolvedKey, listTagAttr, level);
230
290
  }
231
291
  val += listTagVal;
232
292
  } else {
@@ -235,10 +295,12 @@ Builder.prototype.j2x = function (jObj, level, matcher) {
235
295
  const Ks = Object.keys(jObj[key]);
236
296
  const L = Ks.length;
237
297
  for (let j = 0; j < L; j++) {
238
- attrStr += this.buildAttrPairStr(Ks[j], '' + jObj[key][Ks[j]], isCurrentStopNode);
298
+ // Resolve attribute names inside attributesGroupName
299
+ const resolvedAttr = resolveTagName(Ks[j], true, this.options, matcher, xmlVersion);
300
+ attrStr += this.buildAttrPairStr(resolvedAttr, '' + jObj[key][Ks[j]], isCurrentStopNode);
239
301
  }
240
302
  } else {
241
- val += this.processTextOrObjNode(jObj[key], key, level, matcher)
303
+ val += this.processTextOrObjNode(jObj[key], resolvedKey, level, matcher, xmlVersion)
242
304
  }
243
305
  }
244
306
  }
@@ -255,7 +317,7 @@ Builder.prototype.buildAttrPairStr = function (attrName, val, isStopNode) {
255
317
  } else return ' ' + attrName + '="' + escapeAttribute(val) + '"';
256
318
  }
257
319
 
258
- function processTextOrObjNode(object, key, level, matcher) {
320
+ function processTextOrObjNode(object, key, level, matcher, xmlVersion) {
259
321
  // Extract attributes to pass to matcher
260
322
  const attrValues = this.extractAttributes(object);
261
323
 
@@ -273,7 +335,7 @@ function processTextOrObjNode(object, key, level, matcher) {
273
335
  return this.buildObjectNode(rawContent, key, attrStr, level);
274
336
  }
275
337
 
276
- const result = this.j2x(object, level + 1, matcher);
338
+ const result = this.j2x(object, level + 1, matcher, xmlVersion);
277
339
  // Pop tag from matcher after recursion
278
340
  matcher.pop();
279
341
 
@@ -486,7 +548,6 @@ function buildEmptyObjNode(val, key, attrStr, level) {
486
548
  if (key[0] === "?") return this.indentate(level) + '<' + key + attrStr + '?' + this.tagEndChar;
487
549
  else {
488
550
  return this.indentate(level) + '<' + key + attrStr + '/' + this.tagEndChar;
489
- // return this.buildTagStr(level,key, attrStr);
490
551
  }
491
552
  }
492
553
  }
@@ -1,13 +1,53 @@
1
1
  import { Expression, Matcher } from 'path-expression-matcher';
2
2
  import { safeComment, safeCdata, escapeAttribute } from "./util.js";
3
+ import { qName } from 'xml-naming';
3
4
 
4
5
  const EOL = "\n";
5
6
 
6
7
  /**
7
- *
8
- * @param {array} jArray
9
- * @param {any} options
10
- * @returns
8
+ * Detect XML version from the first element of the ordered array input.
9
+ * The first element must be a ?xml processing instruction with a version attribute.
10
+ * Returns '1.0' if not found.
11
+ *
12
+ * @param {array} jArray
13
+ * @param {object} options
14
+ */
15
+ function detectXmlVersionFromArray(jArray, options) {
16
+ if (!Array.isArray(jArray) || jArray.length === 0) return '1.0';
17
+ const first = jArray[0];
18
+ const firstKey = propName(first);
19
+ if (firstKey === '?xml') {
20
+ const attrs = first[':@'];
21
+ if (attrs) {
22
+ const versionKey = options.attributeNamePrefix + 'version';
23
+ if (attrs[versionKey]) return attrs[versionKey];
24
+ }
25
+ }
26
+ return '1.0';
27
+ }
28
+
29
+ /**
30
+ * Resolve a tag or attribute name through sanitizeName if configured.
31
+ * Validation via xml-naming's qName is performed first; the sanitizeName
32
+ * callback is invoked only when the name is invalid. If sanitizeName is
33
+ * false (default), no validation occurs and the name is used as-is.
34
+ *
35
+ * @param {string} name - raw name from the JS object
36
+ * @param {boolean} isAttribute - true when resolving an attribute name
37
+ * @param {object} options
38
+ * @param {Matcher} matcher - current matcher state (readonly from callback perspective)
39
+ * @param {string} xmlVersion - '1.0' or '1.1', forwarded to xml-naming
40
+ */
41
+ function resolveTagName(name, isAttribute, options, matcher, xmlVersion) {
42
+ if (!options.sanitizeName) return name;
43
+ if (qName(name, { xmlVersion })) return name;
44
+ return options.sanitizeName(name, { isAttribute, matcher: matcher.readOnly() });
45
+ }
46
+
47
+ /**
48
+ * @param {array} jArray
49
+ * @param {any} options
50
+ * @returns
11
51
  */
12
52
  export default function toXml(jArray, options) {
13
53
  let indentation = "";
@@ -28,13 +68,16 @@ export default function toXml(jArray, options) {
28
68
  }
29
69
  }
30
70
 
71
+ // Detect XML version for use in name validation
72
+ const xmlVersion = detectXmlVersionFromArray(jArray, options);
73
+
31
74
  // Initialize matcher for path tracking
32
75
  const matcher = new Matcher();
33
76
 
34
- return arrToStr(jArray, options, indentation, matcher, stopNodeExpressions);
77
+ return arrToStr(jArray, options, indentation, matcher, stopNodeExpressions, xmlVersion);
35
78
  }
36
79
 
37
- function arrToStr(arr, options, indentation, matcher, stopNodeExpressions) {
80
+ function arrToStr(arr, options, indentation, matcher, stopNodeExpressions, xmlVersion) {
38
81
  let xmlStr = "";
39
82
  let isPreviousElementTag = false;
40
83
 
@@ -54,20 +97,32 @@ function arrToStr(arr, options, indentation, matcher, stopNodeExpressions) {
54
97
 
55
98
  for (let i = 0; i < arr.length; i++) {
56
99
  const tagObj = arr[i];
57
- const tagName = propName(tagObj);
58
- if (tagName === undefined) continue;
100
+ const rawTagName = propName(tagObj);
101
+ if (rawTagName === undefined) continue;
102
+
103
+ // Special names are exempt from sanitizeName: internal conventions and PI tags
104
+ // are not user-supplied XML element names.
105
+ const isSpecialName = rawTagName === options.textNodeName
106
+ || rawTagName === options.cdataPropName
107
+ || rawTagName === options.commentPropName
108
+ || rawTagName[0] === '?';
109
+
110
+ // Resolve tag name (may transform it; may throw for invalid names)
111
+ const tagName = isSpecialName
112
+ ? rawTagName
113
+ : resolveTagName(rawTagName, false, options, matcher, xmlVersion);
59
114
 
60
115
  // Extract attributes from ":@" property
61
116
  const attrValues = extractAttributeValues(tagObj[":@"], options);
62
117
 
63
- // Push tag to matcher WITH attributes
118
+ // Push resolved tag to matcher WITH attributes
64
119
  matcher.push(tagName, attrValues);
65
120
 
66
121
  // Check if this is a stop node using Expression matching
67
122
  const isStopNode = checkStopNode(matcher, stopNodeExpressions);
68
123
 
69
124
  if (tagName === options.textNodeName) {
70
- let tagText = tagObj[tagName];
125
+ let tagText = tagObj[rawTagName];
71
126
  if (!isStopNode) {
72
127
  tagText = options.tagValueProcessor(tagName, tagText);
73
128
  tagText = replaceEntitiesValue(tagText, options);
@@ -83,21 +138,21 @@ function arrToStr(arr, options, indentation, matcher, stopNodeExpressions) {
83
138
  if (isPreviousElementTag) {
84
139
  xmlStr += indentation;
85
140
  }
86
- const val = tagObj[tagName][0][options.textNodeName];
141
+ const val = tagObj[rawTagName][0][options.textNodeName];
87
142
  const safeVal = safeCdata(val);
88
143
  xmlStr += `<![CDATA[${safeVal}]]>`;
89
144
  isPreviousElementTag = false;
90
145
  matcher.pop();
91
146
  continue;
92
147
  } else if (tagName === options.commentPropName) {
93
- const val = tagObj[tagName][0][options.textNodeName]
94
- const safeVal = safeComment(val)
148
+ const val = tagObj[rawTagName][0][options.textNodeName];
149
+ const safeVal = safeComment(val);
95
150
  xmlStr += indentation + `<!--${safeVal}-->`;
96
151
  isPreviousElementTag = true;
97
152
  matcher.pop();
98
153
  continue;
99
154
  } else if (tagName[0] === "?") {
100
- const attStr = attr_to_str(tagObj[":@"], options, isStopNode);
155
+ const attStr = attr_to_str(tagObj[":@"], options, isStopNode, matcher, xmlVersion);
101
156
  const tempInd = tagName === "?xml" ? "" : indentation;
102
157
  // Text node content on PI/XML declaration tags is intentionally ignored.
103
158
  // Only attributes are valid on these tags per the XML spec.
@@ -113,16 +168,15 @@ function arrToStr(arr, options, indentation, matcher, stopNodeExpressions) {
113
168
  }
114
169
 
115
170
  // Pass isStopNode to attr_to_str so attributes are also not processed for stopNodes
116
- const attStr = attr_to_str(tagObj[":@"], options, isStopNode);
171
+ const attStr = attr_to_str(tagObj[":@"], options, isStopNode, matcher, xmlVersion);
117
172
  const tagStart = indentation + `<${tagName}${attStr}`;
118
173
 
119
174
  // If this is a stopNode, get raw content without processing
120
175
  let tagValue;
121
176
  if (isStopNode) {
122
- tagValue = getRawContent(tagObj[tagName], options);
177
+ tagValue = getRawContent(tagObj[rawTagName], options);
123
178
  } else {
124
-
125
- tagValue = arrToStr(tagObj[tagName], options, newIdentation, matcher, stopNodeExpressions);
179
+ tagValue = arrToStr(tagObj[rawTagName], options, newIdentation, matcher, stopNodeExpressions, xmlVersion);
126
180
  }
127
181
 
128
182
  if (options.unpairedTags.indexOf(tagName) !== -1) {
@@ -204,9 +258,7 @@ function getRawContent(arr, options) {
204
258
  // Processing instruction - skip for stopNodes
205
259
  continue;
206
260
  } else if (tagName) {
207
- // Nested tags within stopNode
208
- // Recursively get raw content and reconstruct the tag
209
- // For stopNodes, we don't process attributes either
261
+ // Nested tags within stopNode — no sanitizeName, content is raw
210
262
  const attStr = attr_to_str_raw(item[":@"], options);
211
263
  const nestedContent = getRawContent(item[tagName], options);
212
264
 
@@ -249,13 +301,23 @@ function propName(obj) {
249
301
  }
250
302
  }
251
303
 
252
- function attr_to_str(attrMap, options, isStopNode) {
304
+ /**
305
+ * Build attribute string, resolving attribute names through sanitizeName when configured.
306
+ * Accepts matcher so the callback has path context.
307
+ */
308
+ function attr_to_str(attrMap, options, isStopNode, matcher, xmlVersion) {
253
309
  let attrStr = "";
254
310
  if (attrMap && !options.ignoreAttributes) {
255
311
  for (let attr in attrMap) {
256
312
  if (!Object.prototype.hasOwnProperty.call(attrMap, attr)) continue;
257
- let attrVal;
258
313
 
314
+ // Strip prefix to get the clean XML attribute name, then optionally sanitize it
315
+ const cleanAttrName = attr.substr(options.attributeNamePrefix.length);
316
+ const resolvedAttrName = isStopNode
317
+ ? cleanAttrName // stopNodes are raw — skip sanitizeName for attr names too
318
+ : resolveTagName(cleanAttrName, true, options, matcher, xmlVersion);
319
+
320
+ let attrVal;
259
321
  if (isStopNode) {
260
322
  // For stopNodes, use raw value without any processing
261
323
  attrVal = attrMap[attr];
@@ -266,9 +328,9 @@ function attr_to_str(attrMap, options, isStopNode) {
266
328
  }
267
329
 
268
330
  if (attrVal === true && options.suppressBooleanAttributes) {
269
- attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}`;
331
+ attrStr += ` ${resolvedAttrName}`;
270
332
  } else {
271
- attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}="${escapeAttribute(attrVal)}"`;
333
+ attrStr += ` ${resolvedAttrName}="${escapeAttribute(attrVal)}"`;
272
334
  }
273
335
  }
274
336
  }
@@ -294,12 +356,4 @@ function replaceEntitiesValue(textValue, options) {
294
356
  }
295
357
  }
296
358
  return textValue;
297
- }
298
-
299
- function cdataVal(val) {
300
-
301
- }
302
-
303
- function commentVal(val) {
304
-
305
359
  }
@@ -1,18 +1,21 @@
1
1
  // Generated by scripts/build.js
2
2
 
3
- // prettier-ignore
4
- const ambiguousRanges = [161, 161, 164, 164, 167, 168, 170, 170, 173, 174, 176, 180, 182, 186, 188, 191, 198, 198, 208, 208, 215, 216, 222, 225, 230, 230, 232, 234, 236, 237, 240, 240, 242, 243, 247, 250, 252, 252, 254, 254, 257, 257, 273, 273, 275, 275, 283, 283, 294, 295, 299, 299, 305, 307, 312, 312, 319, 322, 324, 324, 328, 331, 333, 333, 338, 339, 358, 359, 363, 363, 462, 462, 464, 464, 466, 466, 468, 468, 470, 470, 472, 472, 474, 474, 476, 476, 593, 593, 609, 609, 708, 708, 711, 711, 713, 715, 717, 717, 720, 720, 728, 731, 733, 733, 735, 735, 768, 879, 913, 929, 931, 937, 945, 961, 963, 969, 1025, 1025, 1040, 1103, 1105, 1105, 8208, 8208, 8211, 8214, 8216, 8217, 8220, 8221, 8224, 8226, 8228, 8231, 8240, 8240, 8242, 8243, 8245, 8245, 8251, 8251, 8254, 8254, 8308, 8308, 8319, 8319, 8321, 8324, 8364, 8364, 8451, 8451, 8453, 8453, 8457, 8457, 8467, 8467, 8470, 8470, 8481, 8482, 8486, 8486, 8491, 8491, 8531, 8532, 8539, 8542, 8544, 8555, 8560, 8569, 8585, 8585, 8592, 8601, 8632, 8633, 8658, 8658, 8660, 8660, 8679, 8679, 8704, 8704, 8706, 8707, 8711, 8712, 8715, 8715, 8719, 8719, 8721, 8721, 8725, 8725, 8730, 8730, 8733, 8736, 8739, 8739, 8741, 8741, 8743, 8748, 8750, 8750, 8756, 8759, 8764, 8765, 8776, 8776, 8780, 8780, 8786, 8786, 8800, 8801, 8804, 8807, 8810, 8811, 8814, 8815, 8834, 8835, 8838, 8839, 8853, 8853, 8857, 8857, 8869, 8869, 8895, 8895, 8978, 8978, 9312, 9449, 9451, 9547, 9552, 9587, 9600, 9615, 9618, 9621, 9632, 9633, 9635, 9641, 9650, 9651, 9654, 9655, 9660, 9661, 9664, 9665, 9670, 9672, 9675, 9675, 9678, 9681, 9698, 9701, 9711, 9711, 9733, 9734, 9737, 9737, 9742, 9743, 9756, 9756, 9758, 9758, 9792, 9792, 9794, 9794, 9824, 9825, 9827, 9829, 9831, 9834, 9836, 9837, 9839, 9839, 9886, 9887, 9919, 9919, 9926, 9933, 9935, 9939, 9941, 9953, 9955, 9955, 9960, 9961, 9963, 9969, 9972, 9972, 9974, 9977, 9979, 9980, 9982, 9983, 10045, 10045, 10102, 10111, 11094, 11097, 12872, 12879, 57344, 63743, 65024, 65039, 65533, 65533, 127232, 127242, 127248, 127277, 127280, 127337, 127344, 127373, 127375, 127376, 127387, 127404, 917760, 917999, 983040, 1048573, 1048576, 1114109];
3
+ export const ambiguousMinimalCodePoint = 161;
4
+ export const ambiguousMaximumCodePoint = 1114109;
5
+ export const ambiguousRanges = [161, 161, 164, 164, 167, 168, 170, 170, 173, 174, 176, 180, 182, 186, 188, 191, 198, 198, 208, 208, 215, 216, 222, 225, 230, 230, 232, 234, 236, 237, 240, 240, 242, 243, 247, 250, 252, 252, 254, 254, 257, 257, 273, 273, 275, 275, 283, 283, 294, 295, 299, 299, 305, 307, 312, 312, 319, 322, 324, 324, 328, 331, 333, 333, 338, 339, 358, 359, 363, 363, 462, 462, 464, 464, 466, 466, 468, 468, 470, 470, 472, 472, 474, 474, 476, 476, 593, 593, 609, 609, 708, 708, 711, 711, 713, 715, 717, 717, 720, 720, 728, 731, 733, 733, 735, 735, 768, 879, 913, 929, 931, 937, 945, 961, 963, 969, 1025, 1025, 1040, 1103, 1105, 1105, 8208, 8208, 8211, 8214, 8216, 8217, 8220, 8221, 8224, 8226, 8228, 8231, 8240, 8240, 8242, 8243, 8245, 8245, 8251, 8251, 8254, 8254, 8308, 8308, 8319, 8319, 8321, 8324, 8364, 8364, 8451, 8451, 8453, 8453, 8457, 8457, 8467, 8467, 8470, 8470, 8481, 8482, 8486, 8486, 8491, 8491, 8531, 8532, 8539, 8542, 8544, 8555, 8560, 8569, 8585, 8585, 8592, 8601, 8632, 8633, 8658, 8658, 8660, 8660, 8679, 8679, 8704, 8704, 8706, 8707, 8711, 8712, 8715, 8715, 8719, 8719, 8721, 8721, 8725, 8725, 8730, 8730, 8733, 8736, 8739, 8739, 8741, 8741, 8743, 8748, 8750, 8750, 8756, 8759, 8764, 8765, 8776, 8776, 8780, 8780, 8786, 8786, 8800, 8801, 8804, 8807, 8810, 8811, 8814, 8815, 8834, 8835, 8838, 8839, 8853, 8853, 8857, 8857, 8869, 8869, 8895, 8895, 8978, 8978, 9312, 9449, 9451, 9547, 9552, 9587, 9600, 9615, 9618, 9621, 9632, 9633, 9635, 9641, 9650, 9651, 9654, 9655, 9660, 9661, 9664, 9665, 9670, 9672, 9675, 9675, 9678, 9681, 9698, 9701, 9711, 9711, 9733, 9734, 9737, 9737, 9742, 9743, 9756, 9756, 9758, 9758, 9792, 9792, 9794, 9794, 9824, 9825, 9827, 9829, 9831, 9834, 9836, 9837, 9839, 9839, 9886, 9887, 9919, 9919, 9926, 9933, 9935, 9939, 9941, 9953, 9955, 9955, 9960, 9961, 9963, 9969, 9972, 9972, 9974, 9977, 9979, 9980, 9982, 9983, 10045, 10045, 10102, 10111, 11094, 11097, 12872, 12879, 57344, 63743, 65024, 65039, 65533, 65533, 127232, 127242, 127248, 127277, 127280, 127337, 127344, 127373, 127375, 127376, 127387, 127404, 917760, 917999, 983040, 1048573, 1048576, 1114109];
5
6
 
6
- // prettier-ignore
7
- const fullwidthRanges = [12288, 12288, 65281, 65376, 65504, 65510];
7
+ export const fullwidthMinimalCodePoint = 12288;
8
+ export const fullwidthMaximumCodePoint = 65510;
9
+ export const fullwidthRanges = [12288, 12288, 65281, 65376, 65504, 65510];
8
10
 
9
- // prettier-ignore
10
- const halfwidthRanges = [8361, 8361, 65377, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65512, 65518];
11
+ export const halfwidthMinimalCodePoint = 8361;
12
+ export const halfwidthMaximumCodePoint = 65518;
13
+ export const halfwidthRanges = [8361, 8361, 65377, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65512, 65518];
11
14
 
12
- // prettier-ignore
13
- const narrowRanges = [32, 126, 162, 163, 165, 166, 172, 172, 175, 175, 10214, 10221, 10629, 10630];
15
+ export const narrowMinimalCodePoint = 32;
16
+ export const narrowMaximumCodePoint = 10630;
17
+ export const narrowRanges = [32, 126, 162, 163, 165, 166, 172, 172, 175, 175, 10214, 10221, 10629, 10630];
14
18
 
15
- // prettier-ignore
16
- const wideRanges = [4352, 4447, 8986, 8987, 9001, 9002, 9193, 9196, 9200, 9200, 9203, 9203, 9725, 9726, 9748, 9749, 9776, 9783, 9800, 9811, 9855, 9855, 9866, 9871, 9875, 9875, 9889, 9889, 9898, 9899, 9917, 9918, 9924, 9925, 9934, 9934, 9940, 9940, 9962, 9962, 9970, 9971, 9973, 9973, 9978, 9978, 9981, 9981, 9989, 9989, 9994, 9995, 10024, 10024, 10060, 10060, 10062, 10062, 10067, 10069, 10071, 10071, 10133, 10135, 10160, 10160, 10175, 10175, 11035, 11036, 11088, 11088, 11093, 11093, 11904, 11929, 11931, 12019, 12032, 12245, 12272, 12287, 12289, 12350, 12353, 12438, 12441, 12543, 12549, 12591, 12593, 12686, 12688, 12773, 12783, 12830, 12832, 12871, 12880, 42124, 42128, 42182, 43360, 43388, 44032, 55203, 63744, 64255, 65040, 65049, 65072, 65106, 65108, 65126, 65128, 65131, 94176, 94180, 94192, 94198, 94208, 101589, 101631, 101662, 101760, 101874, 110576, 110579, 110581, 110587, 110589, 110590, 110592, 110882, 110898, 110898, 110928, 110930, 110933, 110933, 110948, 110951, 110960, 111355, 119552, 119638, 119648, 119670, 126980, 126980, 127183, 127183, 127374, 127374, 127377, 127386, 127488, 127490, 127504, 127547, 127552, 127560, 127568, 127569, 127584, 127589, 127744, 127776, 127789, 127797, 127799, 127868, 127870, 127891, 127904, 127946, 127951, 127955, 127968, 127984, 127988, 127988, 127992, 128062, 128064, 128064, 128066, 128252, 128255, 128317, 128331, 128334, 128336, 128359, 128378, 128378, 128405, 128406, 128420, 128420, 128507, 128591, 128640, 128709, 128716, 128716, 128720, 128722, 128725, 128728, 128732, 128735, 128747, 128748, 128756, 128764, 128992, 129003, 129008, 129008, 129292, 129338, 129340, 129349, 129351, 129535, 129648, 129660, 129664, 129674, 129678, 129734, 129736, 129736, 129741, 129756, 129759, 129770, 129775, 129784, 131072, 196605, 196608, 262141];
17
-
18
- export {ambiguousRanges, fullwidthRanges, halfwidthRanges, narrowRanges, wideRanges};
19
+ export const wideMinimalCodePoint = 4352;
20
+ export const wideMaximumCodePoint = 262141;
21
+ export const wideRanges = [4352, 4447, 8986, 8987, 9001, 9002, 9193, 9196, 9200, 9200, 9203, 9203, 9725, 9726, 9748, 9749, 9776, 9783, 9800, 9811, 9855, 9855, 9866, 9871, 9875, 9875, 9889, 9889, 9898, 9899, 9917, 9918, 9924, 9925, 9934, 9934, 9940, 9940, 9962, 9962, 9970, 9971, 9973, 9973, 9978, 9978, 9981, 9981, 9989, 9989, 9994, 9995, 10024, 10024, 10060, 10060, 10062, 10062, 10067, 10069, 10071, 10071, 10133, 10135, 10160, 10160, 10175, 10175, 11035, 11036, 11088, 11088, 11093, 11093, 11904, 11929, 11931, 12019, 12032, 12245, 12272, 12287, 12289, 12350, 12353, 12438, 12441, 12543, 12549, 12591, 12593, 12686, 12688, 12773, 12783, 12830, 12832, 12871, 12880, 42124, 42128, 42182, 43360, 43388, 44032, 55203, 63744, 64255, 65040, 65049, 65072, 65106, 65108, 65126, 65128, 65131, 94176, 94180, 94192, 94198, 94208, 101589, 101631, 101662, 101760, 101874, 110576, 110579, 110581, 110587, 110589, 110590, 110592, 110882, 110898, 110898, 110928, 110930, 110933, 110933, 110948, 110951, 110960, 111355, 119552, 119638, 119648, 119670, 126980, 126980, 127183, 127183, 127374, 127374, 127377, 127386, 127488, 127490, 127504, 127547, 127552, 127560, 127568, 127569, 127584, 127589, 127744, 127776, 127789, 127797, 127799, 127868, 127870, 127891, 127904, 127946, 127951, 127955, 127968, 127984, 127988, 127988, 127992, 128062, 128064, 128064, 128066, 128252, 128255, 128317, 128331, 128334, 128336, 128359, 128378, 128378, 128405, 128406, 128420, 128420, 128507, 128591, 128640, 128709, 128716, 128716, 128720, 128722, 128725, 128728, 128732, 128735, 128747, 128748, 128756, 128764, 128992, 129003, 129008, 129008, 129292, 129338, 129340, 129349, 129351, 129535, 129648, 129660, 129664, 129674, 129678, 129734, 129736, 129736, 129741, 129756, 129759, 129770, 129775, 129784, 131072, 196605, 196608, 262141];
@@ -1,25 +1,28 @@
1
1
  import {
2
+ ambiguousMinimalCodePoint,
3
+ ambiguousMaximumCodePoint,
2
4
  ambiguousRanges,
5
+
6
+ fullwidthMinimalCodePoint,
7
+ fullwidthMaximumCodePoint,
3
8
  fullwidthRanges,
9
+
10
+ halfwidthMinimalCodePoint,
11
+ halfwidthMaximumCodePoint,
4
12
  halfwidthRanges,
13
+
14
+ narrowMinimalCodePoint,
15
+ narrowMaximumCodePoint,
5
16
  narrowRanges,
17
+
18
+ wideMinimalCodePoint,
19
+ wideMaximumCodePoint,
6
20
  wideRanges,
7
21
  } from './lookup-data.js';
8
22
  import {isInRange} from './utilities.js';
9
23
 
10
- const minimumAmbiguousCodePoint = ambiguousRanges[0];
11
- const maximumAmbiguousCodePoint = ambiguousRanges.at(-1);
12
- const minimumFullWidthCodePoint = fullwidthRanges[0];
13
- const maximumFullWidthCodePoint = fullwidthRanges.at(-1);
14
- const minimumHalfWidthCodePoint = halfwidthRanges[0];
15
- const maximumHalfWidthCodePoint = halfwidthRanges.at(-1);
16
- const minimumNarrowCodePoint = narrowRanges[0];
17
- const maximumNarrowCodePoint = narrowRanges.at(-1);
18
- const minimumWideCodePoint = wideRanges[0];
19
- const maximumWideCodePoint = wideRanges.at(-1);
20
-
21
24
  const commonCjkCodePoint = 0x4E_00;
22
- const [wideFastPathStart, wideFastPathEnd] = findWideFastPathRange(wideRanges);
25
+ const [wideFastPathStart, wideFastPathEnd] = /* #__PURE__ */ findWideFastPathRange(wideRanges);
23
26
 
24
27
  // Use a hot-path range so common `isWide` calls can skip binary search.
25
28
  // The range containing U+4E00 covers common CJK ideographs;
@@ -50,8 +53,8 @@ function findWideFastPathRange(ranges) {
50
53
 
51
54
  export const isAmbiguous = codePoint => {
52
55
  if (
53
- codePoint < minimumAmbiguousCodePoint
54
- || codePoint > maximumAmbiguousCodePoint
56
+ codePoint < ambiguousMinimalCodePoint
57
+ || codePoint > ambiguousMaximumCodePoint
55
58
  ) {
56
59
  return false;
57
60
  }
@@ -61,8 +64,8 @@ export const isAmbiguous = codePoint => {
61
64
 
62
65
  export const isFullWidth = codePoint => {
63
66
  if (
64
- codePoint < minimumFullWidthCodePoint
65
- || codePoint > maximumFullWidthCodePoint
67
+ codePoint < fullwidthMinimalCodePoint
68
+ || codePoint > fullwidthMaximumCodePoint
66
69
  ) {
67
70
  return false;
68
71
  }
@@ -72,8 +75,8 @@ export const isFullWidth = codePoint => {
72
75
 
73
76
  const isHalfWidth = codePoint => {
74
77
  if (
75
- codePoint < minimumHalfWidthCodePoint
76
- || codePoint > maximumHalfWidthCodePoint
78
+ codePoint < halfwidthMinimalCodePoint
79
+ || codePoint > halfwidthMaximumCodePoint
77
80
  ) {
78
81
  return false;
79
82
  }
@@ -83,8 +86,8 @@ const isHalfWidth = codePoint => {
83
86
 
84
87
  const isNarrow = codePoint => {
85
88
  if (
86
- codePoint < minimumNarrowCodePoint
87
- || codePoint > maximumNarrowCodePoint
89
+ codePoint < narrowMinimalCodePoint
90
+ || codePoint > narrowMaximumCodePoint
88
91
  ) {
89
92
  return false;
90
93
  }
@@ -101,8 +104,8 @@ export const isWide = codePoint => {
101
104
  }
102
105
 
103
106
  if (
104
- codePoint < minimumWideCodePoint
105
- || codePoint > maximumWideCodePoint
107
+ codePoint < wideMinimalCodePoint
108
+ || codePoint > wideMaximumCodePoint
106
109
  ) {
107
110
  return false;
108
111
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "get-east-asian-width",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Determine the East Asian Width of a Unicode character",
5
5
  "license": "MIT",
6
6
  "repository": "sindresorhus/get-east-asian-width",