toolcraft 0.0.116 → 0.0.118
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/composition.json +42 -2
- package/dist/composition.json +42 -2
- package/node_modules/@poe-code/agent-mcp-config/package.json +0 -3
- package/node_modules/@poe-code/config-mutations/package.json +0 -5
- package/node_modules/@poe-code/frontmatter/package.json +0 -3
- package/node_modules/@poe-code/process-runner/package.json +0 -3
- package/node_modules/@poe-code/task-list/package.json +0 -3
- package/node_modules/fast-string-truncated-width/dist/index.d.ts +4 -0
- package/node_modules/fast-string-truncated-width/dist/index.js +111 -0
- package/node_modules/fast-string-truncated-width/dist/types.d.ts +19 -0
- package/node_modules/fast-string-truncated-width/dist/types.js +2 -0
- package/node_modules/fast-string-truncated-width/dist/utils.d.ts +4 -0
- package/node_modules/fast-string-truncated-width/dist/utils.js +20 -0
- package/node_modules/fast-string-truncated-width/license +21 -0
- package/node_modules/fast-string-truncated-width/package.json +35 -0
- package/node_modules/fast-string-truncated-width/readme.md +59 -0
- package/node_modules/fast-string-width/dist/index.d.ts +4 -0
- package/node_modules/fast-string-width/dist/index.js +14 -0
- package/node_modules/fast-string-width/license +21 -0
- package/node_modules/fast-string-width/package.json +34 -0
- package/node_modules/fast-string-width/readme.md +42 -0
- package/node_modules/fast-wrap-ansi/LICENSE +23 -0
- package/node_modules/fast-wrap-ansi/README.md +26 -0
- package/node_modules/fast-wrap-ansi/lib/main.d.ts +6 -0
- package/node_modules/fast-wrap-ansi/lib/main.js +218 -0
- package/node_modules/fast-wrap-ansi/package.json +51 -0
- package/node_modules/ignore/LICENSE-MIT +21 -0
- package/node_modules/ignore/README.md +412 -0
- package/node_modules/ignore/index.d.ts +61 -0
- package/node_modules/ignore/index.js +636 -0
- package/node_modules/ignore/legacy.js +559 -0
- package/node_modules/ignore/package.json +74 -0
- package/node_modules/jsonc-parser/CHANGELOG.md +76 -0
- package/node_modules/jsonc-parser/LICENSE.md +21 -0
- package/node_modules/jsonc-parser/README.md +364 -0
- package/node_modules/jsonc-parser/SECURITY.md +41 -0
- package/node_modules/jsonc-parser/lib/esm/impl/edit.js +185 -0
- package/node_modules/jsonc-parser/lib/esm/impl/format.js +261 -0
- package/node_modules/jsonc-parser/lib/esm/impl/parser.js +659 -0
- package/node_modules/jsonc-parser/lib/esm/impl/scanner.js +443 -0
- package/node_modules/jsonc-parser/lib/esm/impl/string-intern.js +29 -0
- package/node_modules/jsonc-parser/lib/esm/main.d.ts +351 -0
- package/node_modules/jsonc-parser/lib/esm/main.js +178 -0
- package/node_modules/jsonc-parser/lib/umd/impl/edit.js +201 -0
- package/node_modules/jsonc-parser/lib/umd/impl/format.js +275 -0
- package/node_modules/jsonc-parser/lib/umd/impl/parser.js +682 -0
- package/node_modules/jsonc-parser/lib/umd/impl/scanner.js +456 -0
- package/node_modules/jsonc-parser/lib/umd/impl/string-intern.js +42 -0
- package/node_modules/jsonc-parser/lib/umd/main.d.ts +351 -0
- package/node_modules/jsonc-parser/lib/umd/main.js +194 -0
- package/node_modules/jsonc-parser/package.json +37 -0
- package/node_modules/sisteransi/license +21 -0
- package/node_modules/sisteransi/package.json +34 -0
- package/node_modules/sisteransi/readme.md +113 -0
- package/node_modules/sisteransi/src/index.js +58 -0
- package/node_modules/sisteransi/src/sisteransi.d.ts +35 -0
- package/node_modules/smol-toml/LICENSE +24 -0
- package/node_modules/smol-toml/README.md +239 -0
- package/node_modules/smol-toml/dist/date.d.ts +41 -0
- package/node_modules/smol-toml/dist/date.js +127 -0
- package/node_modules/smol-toml/dist/error.d.ts +38 -0
- package/node_modules/smol-toml/dist/error.js +63 -0
- package/node_modules/smol-toml/dist/extract.d.ts +30 -0
- package/node_modules/smol-toml/dist/extract.js +100 -0
- package/node_modules/smol-toml/dist/index.cjs +897 -0
- package/node_modules/smol-toml/dist/index.d.ts +43 -0
- package/node_modules/smol-toml/dist/index.js +33 -0
- package/node_modules/smol-toml/dist/parse.d.ts +37 -0
- package/node_modules/smol-toml/dist/parse.js +148 -0
- package/node_modules/smol-toml/dist/primitive.d.ts +31 -0
- package/node_modules/smol-toml/dist/primitive.js +179 -0
- package/node_modules/smol-toml/dist/stringify.d.ts +31 -0
- package/node_modules/smol-toml/dist/stringify.js +167 -0
- package/node_modules/smol-toml/dist/struct.d.ts +32 -0
- package/node_modules/smol-toml/dist/struct.js +184 -0
- package/node_modules/smol-toml/dist/util.d.ts +42 -0
- package/node_modules/smol-toml/dist/util.js +111 -0
- package/node_modules/smol-toml/package.json +54 -0
- package/node_modules/tiny-stdio-mcp-server/dist/composition.json +1 -1
- package/node_modules/tiny-stdio-mcp-server/dist/server.js +9 -21
- package/node_modules/tiny-stdio-mcp-server/dist/uri-template.d.ts +6 -0
- package/node_modules/tiny-stdio-mcp-server/dist/uri-template.js +363 -0
- package/node_modules/tiny-stdio-mcp-server/package.json +0 -4
- package/node_modules/toolcraft-design/package.json +0 -5
- package/node_modules/toolcraft-schema/package.json +3 -2
- package/node_modules/yaml/LICENSE +13 -0
- package/node_modules/yaml/README.md +172 -0
- package/node_modules/yaml/bin.mjs +11 -0
- package/node_modules/yaml/browser/dist/compose/compose-collection.js +88 -0
- package/node_modules/yaml/browser/dist/compose/compose-doc.js +43 -0
- package/node_modules/yaml/browser/dist/compose/compose-node.js +109 -0
- package/node_modules/yaml/browser/dist/compose/compose-scalar.js +86 -0
- package/node_modules/yaml/browser/dist/compose/composer.js +219 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +115 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +198 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +49 -0
- package/node_modules/yaml/browser/dist/compose/resolve-end.js +37 -0
- package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +207 -0
- package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +225 -0
- package/node_modules/yaml/browser/dist/compose/resolve-props.js +146 -0
- package/node_modules/yaml/browser/dist/compose/util-contains-newline.js +34 -0
- package/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +26 -0
- package/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +15 -0
- package/node_modules/yaml/browser/dist/compose/util-map-includes.js +13 -0
- package/node_modules/yaml/browser/dist/doc/Document.js +335 -0
- package/node_modules/yaml/browser/dist/doc/anchors.js +71 -0
- package/node_modules/yaml/browser/dist/doc/applyReviver.js +55 -0
- package/node_modules/yaml/browser/dist/doc/createNode.js +88 -0
- package/node_modules/yaml/browser/dist/doc/directives.js +176 -0
- package/node_modules/yaml/browser/dist/errors.js +57 -0
- package/node_modules/yaml/browser/dist/index.js +17 -0
- package/node_modules/yaml/browser/dist/log.js +11 -0
- package/node_modules/yaml/browser/dist/nodes/Alias.js +116 -0
- package/node_modules/yaml/browser/dist/nodes/Collection.js +147 -0
- package/node_modules/yaml/browser/dist/nodes/Node.js +38 -0
- package/node_modules/yaml/browser/dist/nodes/Pair.js +36 -0
- package/node_modules/yaml/browser/dist/nodes/Scalar.js +24 -0
- package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +144 -0
- package/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +113 -0
- package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +63 -0
- package/node_modules/yaml/browser/dist/nodes/identity.js +36 -0
- package/node_modules/yaml/browser/dist/nodes/toJS.js +37 -0
- package/node_modules/yaml/browser/dist/parse/cst-scalar.js +214 -0
- package/node_modules/yaml/browser/dist/parse/cst-stringify.js +61 -0
- package/node_modules/yaml/browser/dist/parse/cst-visit.js +97 -0
- package/node_modules/yaml/browser/dist/parse/cst.js +98 -0
- package/node_modules/yaml/browser/dist/parse/lexer.js +721 -0
- package/node_modules/yaml/browser/dist/parse/line-counter.js +39 -0
- package/node_modules/yaml/browser/dist/parse/parser.js +975 -0
- package/node_modules/yaml/browser/dist/public-api.js +102 -0
- package/node_modules/yaml/browser/dist/schema/Schema.js +37 -0
- package/node_modules/yaml/browser/dist/schema/common/map.js +17 -0
- package/node_modules/yaml/browser/dist/schema/common/null.js +15 -0
- package/node_modules/yaml/browser/dist/schema/common/seq.js +17 -0
- package/node_modules/yaml/browser/dist/schema/common/string.js +14 -0
- package/node_modules/yaml/browser/dist/schema/core/bool.js +19 -0
- package/node_modules/yaml/browser/dist/schema/core/float.js +43 -0
- package/node_modules/yaml/browser/dist/schema/core/int.js +38 -0
- package/node_modules/yaml/browser/dist/schema/core/schema.js +23 -0
- package/node_modules/yaml/browser/dist/schema/json/schema.js +62 -0
- package/node_modules/yaml/browser/dist/schema/tags.js +96 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +58 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +26 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +46 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +71 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +67 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +74 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +78 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +39 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +93 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +101 -0
- package/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +146 -0
- package/node_modules/yaml/browser/dist/stringify/stringify.js +129 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +153 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyComment.js +20 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +85 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +25 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +150 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyString.js +336 -0
- package/node_modules/yaml/browser/dist/util.js +11 -0
- package/node_modules/yaml/browser/dist/visit.js +233 -0
- package/node_modules/yaml/browser/index.js +5 -0
- package/node_modules/yaml/browser/package.json +3 -0
- package/node_modules/yaml/dist/cli.d.ts +8 -0
- package/node_modules/yaml/dist/cli.mjs +201 -0
- package/node_modules/yaml/dist/compose/compose-collection.d.ts +11 -0
- package/node_modules/yaml/dist/compose/compose-collection.js +90 -0
- package/node_modules/yaml/dist/compose/compose-doc.d.ts +7 -0
- package/node_modules/yaml/dist/compose/compose-doc.js +45 -0
- package/node_modules/yaml/dist/compose/compose-node.d.ts +29 -0
- package/node_modules/yaml/dist/compose/compose-node.js +112 -0
- package/node_modules/yaml/dist/compose/compose-scalar.d.ts +5 -0
- package/node_modules/yaml/dist/compose/compose-scalar.js +88 -0
- package/node_modules/yaml/dist/compose/composer.d.ts +63 -0
- package/node_modules/yaml/dist/compose/composer.js +224 -0
- package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-block-map.js +117 -0
- package/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +11 -0
- package/node_modules/yaml/dist/compose/resolve-block-scalar.js +200 -0
- package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-block-seq.js +51 -0
- package/node_modules/yaml/dist/compose/resolve-end.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-end.js +39 -0
- package/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +7 -0
- package/node_modules/yaml/dist/compose/resolve-flow-collection.js +209 -0
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +10 -0
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +227 -0
- package/node_modules/yaml/dist/compose/resolve-props.d.ts +23 -0
- package/node_modules/yaml/dist/compose/resolve-props.js +148 -0
- package/node_modules/yaml/dist/compose/util-contains-newline.d.ts +2 -0
- package/node_modules/yaml/dist/compose/util-contains-newline.js +36 -0
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +2 -0
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.js +28 -0
- package/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +3 -0
- package/node_modules/yaml/dist/compose/util-flow-indent-check.js +17 -0
- package/node_modules/yaml/dist/compose/util-map-includes.d.ts +4 -0
- package/node_modules/yaml/dist/compose/util-map-includes.js +15 -0
- package/node_modules/yaml/dist/doc/Document.d.ts +141 -0
- package/node_modules/yaml/dist/doc/Document.js +337 -0
- package/node_modules/yaml/dist/doc/anchors.d.ts +24 -0
- package/node_modules/yaml/dist/doc/anchors.js +76 -0
- package/node_modules/yaml/dist/doc/applyReviver.d.ts +9 -0
- package/node_modules/yaml/dist/doc/applyReviver.js +57 -0
- package/node_modules/yaml/dist/doc/createNode.d.ts +17 -0
- package/node_modules/yaml/dist/doc/createNode.js +90 -0
- package/node_modules/yaml/dist/doc/directives.d.ts +49 -0
- package/node_modules/yaml/dist/doc/directives.js +178 -0
- package/node_modules/yaml/dist/errors.d.ts +21 -0
- package/node_modules/yaml/dist/errors.js +62 -0
- package/node_modules/yaml/dist/index.d.ts +25 -0
- package/node_modules/yaml/dist/index.js +50 -0
- package/node_modules/yaml/dist/log.d.ts +3 -0
- package/node_modules/yaml/dist/log.js +19 -0
- package/node_modules/yaml/dist/nodes/Alias.d.ts +29 -0
- package/node_modules/yaml/dist/nodes/Alias.js +118 -0
- package/node_modules/yaml/dist/nodes/Collection.d.ts +73 -0
- package/node_modules/yaml/dist/nodes/Collection.js +151 -0
- package/node_modules/yaml/dist/nodes/Node.d.ts +53 -0
- package/node_modules/yaml/dist/nodes/Node.js +40 -0
- package/node_modules/yaml/dist/nodes/Pair.d.ts +22 -0
- package/node_modules/yaml/dist/nodes/Pair.js +39 -0
- package/node_modules/yaml/dist/nodes/Scalar.d.ts +47 -0
- package/node_modules/yaml/dist/nodes/Scalar.js +27 -0
- package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +53 -0
- package/node_modules/yaml/dist/nodes/YAMLMap.js +147 -0
- package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +60 -0
- package/node_modules/yaml/dist/nodes/YAMLSeq.js +115 -0
- package/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +4 -0
- package/node_modules/yaml/dist/nodes/addPairToJSMap.js +65 -0
- package/node_modules/yaml/dist/nodes/identity.d.ts +23 -0
- package/node_modules/yaml/dist/nodes/identity.js +53 -0
- package/node_modules/yaml/dist/nodes/toJS.d.ts +29 -0
- package/node_modules/yaml/dist/nodes/toJS.js +39 -0
- package/node_modules/yaml/dist/options.d.ts +350 -0
- package/node_modules/yaml/dist/parse/cst-scalar.d.ts +64 -0
- package/node_modules/yaml/dist/parse/cst-scalar.js +218 -0
- package/node_modules/yaml/dist/parse/cst-stringify.d.ts +8 -0
- package/node_modules/yaml/dist/parse/cst-stringify.js +63 -0
- package/node_modules/yaml/dist/parse/cst-visit.d.ts +39 -0
- package/node_modules/yaml/dist/parse/cst-visit.js +99 -0
- package/node_modules/yaml/dist/parse/cst.d.ts +109 -0
- package/node_modules/yaml/dist/parse/cst.js +112 -0
- package/node_modules/yaml/dist/parse/lexer.d.ts +87 -0
- package/node_modules/yaml/dist/parse/lexer.js +723 -0
- package/node_modules/yaml/dist/parse/line-counter.d.ts +22 -0
- package/node_modules/yaml/dist/parse/line-counter.js +41 -0
- package/node_modules/yaml/dist/parse/parser.d.ts +84 -0
- package/node_modules/yaml/dist/parse/parser.js +980 -0
- package/node_modules/yaml/dist/public-api.d.ts +44 -0
- package/node_modules/yaml/dist/public-api.js +107 -0
- package/node_modules/yaml/dist/schema/Schema.d.ts +17 -0
- package/node_modules/yaml/dist/schema/Schema.js +39 -0
- package/node_modules/yaml/dist/schema/common/map.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/map.js +19 -0
- package/node_modules/yaml/dist/schema/common/null.d.ts +4 -0
- package/node_modules/yaml/dist/schema/common/null.js +17 -0
- package/node_modules/yaml/dist/schema/common/seq.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/seq.js +19 -0
- package/node_modules/yaml/dist/schema/common/string.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/string.js +16 -0
- package/node_modules/yaml/dist/schema/core/bool.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/bool.js +21 -0
- package/node_modules/yaml/dist/schema/core/float.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/float.js +47 -0
- package/node_modules/yaml/dist/schema/core/int.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/int.js +42 -0
- package/node_modules/yaml/dist/schema/core/schema.d.ts +1 -0
- package/node_modules/yaml/dist/schema/core/schema.js +25 -0
- package/node_modules/yaml/dist/schema/json/schema.d.ts +2 -0
- package/node_modules/yaml/dist/schema/json/schema.js +64 -0
- package/node_modules/yaml/dist/schema/json-schema.d.ts +69 -0
- package/node_modules/yaml/dist/schema/tags.d.ts +48 -0
- package/node_modules/yaml/dist/schema/tags.js +99 -0
- package/node_modules/yaml/dist/schema/types.d.ts +92 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +2 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +70 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +7 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.js +29 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +4 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/float.js +50 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +5 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/int.js +76 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/merge.d.ts +9 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/merge.js +71 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +22 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +77 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +10 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +82 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +1 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.js +41 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +28 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/set.js +96 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +6 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +105 -0
- package/node_modules/yaml/dist/stringify/foldFlowLines.d.ts +34 -0
- package/node_modules/yaml/dist/stringify/foldFlowLines.js +151 -0
- package/node_modules/yaml/dist/stringify/stringify.d.ts +21 -0
- package/node_modules/yaml/dist/stringify/stringify.js +132 -0
- package/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +17 -0
- package/node_modules/yaml/dist/stringify/stringifyCollection.js +155 -0
- package/node_modules/yaml/dist/stringify/stringifyComment.d.ts +10 -0
- package/node_modules/yaml/dist/stringify/stringifyComment.js +24 -0
- package/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +4 -0
- package/node_modules/yaml/dist/stringify/stringifyDocument.js +87 -0
- package/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +2 -0
- package/node_modules/yaml/dist/stringify/stringifyNumber.js +27 -0
- package/node_modules/yaml/dist/stringify/stringifyPair.d.ts +3 -0
- package/node_modules/yaml/dist/stringify/stringifyPair.js +152 -0
- package/node_modules/yaml/dist/stringify/stringifyString.d.ts +9 -0
- package/node_modules/yaml/dist/stringify/stringifyString.js +338 -0
- package/node_modules/yaml/dist/test-events.d.ts +4 -0
- package/node_modules/yaml/dist/test-events.js +134 -0
- package/node_modules/yaml/dist/util.d.ts +16 -0
- package/node_modules/yaml/dist/util.js +28 -0
- package/node_modules/yaml/dist/visit.d.ts +102 -0
- package/node_modules/yaml/dist/visit.js +236 -0
- package/node_modules/yaml/package.json +97 -0
- package/node_modules/yaml/util.js +2 -0
- package/package.json +12 -7
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
4
|
+
*
|
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
|
6
|
+
* modification, are permitted provided that the following conditions are met:
|
|
7
|
+
*
|
|
8
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
* list of conditions and the following disclaimer.
|
|
10
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
* this list of conditions and the following disclaimer in the
|
|
12
|
+
* documentation and/or other materials provided with the distribution.
|
|
13
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
14
|
+
* may be used to endorse or promote products derived from this software without
|
|
15
|
+
* specific prior written permission.
|
|
16
|
+
*
|
|
17
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
18
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
19
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
20
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
21
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
22
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
23
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
24
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
25
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
26
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
+
*/
|
|
28
|
+
import { type IntegersAsBigInt } from './primitive.js';
|
|
29
|
+
import { type TomlTable, type TomlValue } from './util.js';
|
|
30
|
+
export declare function parseKey(str: string, ptr: number, end?: string): [string[], number];
|
|
31
|
+
export declare function parseInlineTable(str: string, ptr: number, depth: number, integersAsBigInt: IntegersAsBigInt): [TomlTable, number];
|
|
32
|
+
export declare function parseArray(str: string, ptr: number, depth: number, integersAsBigInt: IntegersAsBigInt): [TomlValue[], number];
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
4
|
+
*
|
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
|
6
|
+
* modification, are permitted provided that the following conditions are met:
|
|
7
|
+
*
|
|
8
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
* list of conditions and the following disclaimer.
|
|
10
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
* this list of conditions and the following disclaimer in the
|
|
12
|
+
* documentation and/or other materials provided with the distribution.
|
|
13
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
14
|
+
* may be used to endorse or promote products derived from this software without
|
|
15
|
+
* specific prior written permission.
|
|
16
|
+
*
|
|
17
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
18
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
19
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
20
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
21
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
22
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
23
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
24
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
25
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
26
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
+
*/
|
|
28
|
+
import { parseString } from './primitive.js';
|
|
29
|
+
import { extractValue } from './extract.js';
|
|
30
|
+
import { getStringEnd, indexOfNewline, skipComment, skipVoid } from './util.js';
|
|
31
|
+
import { TomlError } from './error.js';
|
|
32
|
+
let KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
|
|
33
|
+
export function parseKey(str, ptr, end = '=') {
|
|
34
|
+
let dot = ptr - 1;
|
|
35
|
+
let parsed = [];
|
|
36
|
+
let endPtr = str.indexOf(end, ptr);
|
|
37
|
+
if (endPtr < 0) {
|
|
38
|
+
throw new TomlError('incomplete key-value: cannot find end of key', {
|
|
39
|
+
toml: str,
|
|
40
|
+
ptr: ptr,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
do {
|
|
44
|
+
let c = str[ptr = ++dot];
|
|
45
|
+
// If it's whitespace, ignore
|
|
46
|
+
if (c !== ' ' && c !== '\t') {
|
|
47
|
+
// If it's a string
|
|
48
|
+
if (c === '"' || c === '\'') {
|
|
49
|
+
if (c === str[ptr + 1] && c === str[ptr + 2]) {
|
|
50
|
+
throw new TomlError('multiline strings are not allowed in keys', {
|
|
51
|
+
toml: str,
|
|
52
|
+
ptr: ptr,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
let eos = getStringEnd(str, ptr);
|
|
56
|
+
if (eos < 0) {
|
|
57
|
+
throw new TomlError('unfinished string encountered', {
|
|
58
|
+
toml: str,
|
|
59
|
+
ptr: ptr,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
dot = str.indexOf('.', eos);
|
|
63
|
+
let strEnd = str.slice(eos, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
64
|
+
let newLine = indexOfNewline(strEnd);
|
|
65
|
+
if (newLine > -1) {
|
|
66
|
+
throw new TomlError('newlines are not allowed in keys', {
|
|
67
|
+
toml: str,
|
|
68
|
+
ptr: ptr + dot + newLine,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (strEnd.trimStart()) {
|
|
72
|
+
throw new TomlError('found extra tokens after the string part', {
|
|
73
|
+
toml: str,
|
|
74
|
+
ptr: eos,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
if (endPtr < eos) {
|
|
78
|
+
endPtr = str.indexOf(end, eos);
|
|
79
|
+
if (endPtr < 0) {
|
|
80
|
+
throw new TomlError('incomplete key-value: cannot find end of key', {
|
|
81
|
+
toml: str,
|
|
82
|
+
ptr: ptr,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
parsed.push(parseString(str, ptr, eos));
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
// Normal raw key part consumption and validation
|
|
90
|
+
dot = str.indexOf('.', ptr);
|
|
91
|
+
let part = str.slice(ptr, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
92
|
+
if (!KEY_PART_RE.test(part)) {
|
|
93
|
+
throw new TomlError('only letter, numbers, dashes and underscores are allowed in keys', {
|
|
94
|
+
toml: str,
|
|
95
|
+
ptr: ptr,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
parsed.push(part.trimEnd());
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
// Until there's no more dot
|
|
102
|
+
} while (dot + 1 && dot < endPtr);
|
|
103
|
+
return [parsed, skipVoid(str, endPtr + 1, true, true)];
|
|
104
|
+
}
|
|
105
|
+
export function parseInlineTable(str, ptr, depth, integersAsBigInt) {
|
|
106
|
+
let res = {};
|
|
107
|
+
let seen = new Set();
|
|
108
|
+
let c;
|
|
109
|
+
ptr++;
|
|
110
|
+
while ((c = str[ptr++]) !== '}' && c) {
|
|
111
|
+
if (c === ',') {
|
|
112
|
+
throw new TomlError('expected value, found comma', {
|
|
113
|
+
toml: str,
|
|
114
|
+
ptr: ptr - 1,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
else if (c === '#')
|
|
118
|
+
ptr = skipComment(str, ptr);
|
|
119
|
+
else if (c !== ' ' && c !== '\t' && c !== '\n' && c !== '\r') {
|
|
120
|
+
let k;
|
|
121
|
+
let t = res;
|
|
122
|
+
let hasOwn = false;
|
|
123
|
+
let [key, keyEndPtr] = parseKey(str, ptr - 1);
|
|
124
|
+
for (let i = 0; i < key.length; i++) {
|
|
125
|
+
if (i)
|
|
126
|
+
t = hasOwn ? t[k] : (t[k] = {});
|
|
127
|
+
k = key[i];
|
|
128
|
+
if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== 'object' || seen.has(t[k]))) {
|
|
129
|
+
throw new TomlError('trying to redefine an already defined value', {
|
|
130
|
+
toml: str,
|
|
131
|
+
ptr: ptr,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
if (!hasOwn && k === '__proto__') {
|
|
135
|
+
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (hasOwn) {
|
|
139
|
+
throw new TomlError('trying to redefine an already defined value', {
|
|
140
|
+
toml: str,
|
|
141
|
+
ptr: ptr,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
let [value, valueEndPtr] = extractValue(str, keyEndPtr, '}', depth - 1, integersAsBigInt);
|
|
145
|
+
seen.add(value);
|
|
146
|
+
t[k] = value;
|
|
147
|
+
ptr = valueEndPtr;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (!c) {
|
|
151
|
+
throw new TomlError('unfinished table encountered', {
|
|
152
|
+
toml: str,
|
|
153
|
+
ptr: ptr,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
return [res, ptr];
|
|
157
|
+
}
|
|
158
|
+
export function parseArray(str, ptr, depth, integersAsBigInt) {
|
|
159
|
+
let res = [];
|
|
160
|
+
let c;
|
|
161
|
+
ptr++;
|
|
162
|
+
while ((c = str[ptr++]) !== ']' && c) {
|
|
163
|
+
if (c === ',') {
|
|
164
|
+
throw new TomlError('expected value, found comma', {
|
|
165
|
+
toml: str,
|
|
166
|
+
ptr: ptr - 1,
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
else if (c === '#')
|
|
170
|
+
ptr = skipComment(str, ptr);
|
|
171
|
+
else if (c !== ' ' && c !== '\t' && c !== '\n' && c !== '\r') {
|
|
172
|
+
let e = extractValue(str, ptr - 1, ']', depth - 1, integersAsBigInt);
|
|
173
|
+
res.push(e[0]);
|
|
174
|
+
ptr = e[1];
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (!c) {
|
|
178
|
+
throw new TomlError('unfinished array encountered', {
|
|
179
|
+
toml: str,
|
|
180
|
+
ptr: ptr,
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
return [res, ptr];
|
|
184
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
4
|
+
*
|
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
|
6
|
+
* modification, are permitted provided that the following conditions are met:
|
|
7
|
+
*
|
|
8
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
* list of conditions and the following disclaimer.
|
|
10
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
* this list of conditions and the following disclaimer in the
|
|
12
|
+
* documentation and/or other materials provided with the distribution.
|
|
13
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
14
|
+
* may be used to endorse or promote products derived from this software without
|
|
15
|
+
* specific prior written permission.
|
|
16
|
+
*
|
|
17
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
18
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
19
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
20
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
21
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
22
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
23
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
24
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
25
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
26
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
+
*/
|
|
28
|
+
import type { TomlDate } from './date.js';
|
|
29
|
+
export type TomlPrimitive = string | number | bigint | boolean | TomlDate;
|
|
30
|
+
export type TomlTable = {
|
|
31
|
+
[key: string]: TomlValue;
|
|
32
|
+
};
|
|
33
|
+
export type TomlValue = TomlPrimitive | TomlValue[] | TomlTable;
|
|
34
|
+
export type TomlTableWithoutBigInt = {
|
|
35
|
+
[key: string]: TomlValueWithoutBigInt;
|
|
36
|
+
};
|
|
37
|
+
export type TomlValueWithoutBigInt = Exclude<TomlPrimitive, bigint> | TomlValueWithoutBigInt[] | TomlTableWithoutBigInt;
|
|
38
|
+
export declare function indexOfNewline(str: string, start?: number, end?: number): number;
|
|
39
|
+
export declare function skipComment(str: string, ptr: number): number;
|
|
40
|
+
export declare function skipVoid(str: string, ptr: number, banNewLines?: boolean, banComments?: boolean): number;
|
|
41
|
+
export declare function skipUntil(str: string, ptr: number, sep: string, end?: string, banNewLines?: boolean): number;
|
|
42
|
+
export declare function getStringEnd(str: string, seek: number): number;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
4
|
+
*
|
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
|
6
|
+
* modification, are permitted provided that the following conditions are met:
|
|
7
|
+
*
|
|
8
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
* list of conditions and the following disclaimer.
|
|
10
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
* this list of conditions and the following disclaimer in the
|
|
12
|
+
* documentation and/or other materials provided with the distribution.
|
|
13
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
14
|
+
* may be used to endorse or promote products derived from this software without
|
|
15
|
+
* specific prior written permission.
|
|
16
|
+
*
|
|
17
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
18
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
19
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
20
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
21
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
22
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
23
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
24
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
25
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
26
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
+
*/
|
|
28
|
+
import { TomlError } from './error.js';
|
|
29
|
+
function isEscaped(str, ptr) {
|
|
30
|
+
let i = 0;
|
|
31
|
+
while (str[ptr - ++i] === '\\')
|
|
32
|
+
;
|
|
33
|
+
return --i && (i % 2);
|
|
34
|
+
}
|
|
35
|
+
export function indexOfNewline(str, start = 0, end = str.length) {
|
|
36
|
+
let idx = str.indexOf('\n', start);
|
|
37
|
+
if (str[idx - 1] === '\r')
|
|
38
|
+
idx--;
|
|
39
|
+
return idx <= end ? idx : -1;
|
|
40
|
+
}
|
|
41
|
+
export function skipComment(str, ptr) {
|
|
42
|
+
for (let i = ptr; i < str.length; i++) {
|
|
43
|
+
let c = str[i];
|
|
44
|
+
if (c === '\n')
|
|
45
|
+
return i;
|
|
46
|
+
if (c === '\r' && str[i + 1] === '\n')
|
|
47
|
+
return i + 1;
|
|
48
|
+
if ((c < '\x20' && c !== '\t') || c === '\x7f') {
|
|
49
|
+
throw new TomlError('control characters are not allowed in comments', {
|
|
50
|
+
toml: str,
|
|
51
|
+
ptr: ptr,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return str.length;
|
|
56
|
+
}
|
|
57
|
+
export function skipVoid(str, ptr, banNewLines, banComments) {
|
|
58
|
+
let c;
|
|
59
|
+
while (1) {
|
|
60
|
+
while ((c = str[ptr]) === ' ' || c === '\t' || (!banNewLines && (c === '\n' || c === '\r' && str[ptr + 1] === '\n')))
|
|
61
|
+
ptr++;
|
|
62
|
+
// Tucking the return statement here would save 5 characters >:)
|
|
63
|
+
// But TypeScript fails to detect there is no way to exit the loop so it complains about the lack of final return
|
|
64
|
+
if (banComments || c !== '#')
|
|
65
|
+
break;
|
|
66
|
+
ptr = skipComment(str, ptr);
|
|
67
|
+
}
|
|
68
|
+
return ptr;
|
|
69
|
+
}
|
|
70
|
+
export function skipUntil(str, ptr, sep, end, banNewLines = false) {
|
|
71
|
+
if (!end) {
|
|
72
|
+
ptr = indexOfNewline(str, ptr);
|
|
73
|
+
return ptr < 0 ? str.length : ptr;
|
|
74
|
+
}
|
|
75
|
+
for (let i = ptr; i < str.length; i++) {
|
|
76
|
+
let c = str[i];
|
|
77
|
+
if (c === '#') {
|
|
78
|
+
i = indexOfNewline(str, i);
|
|
79
|
+
}
|
|
80
|
+
else if (c === sep) {
|
|
81
|
+
return i + 1;
|
|
82
|
+
}
|
|
83
|
+
else if (c === end || (banNewLines && (c === '\n' || (c === '\r' && str[i + 1] === '\n')))) {
|
|
84
|
+
return i;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
throw new TomlError('cannot find end of structure', {
|
|
88
|
+
toml: str,
|
|
89
|
+
ptr: ptr
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
export function getStringEnd(str, seek) {
|
|
93
|
+
let first = str[seek];
|
|
94
|
+
let target = first === str[seek + 1] && str[seek + 1] === str[seek + 2]
|
|
95
|
+
? str.slice(seek, seek + 3)
|
|
96
|
+
: first;
|
|
97
|
+
seek += target.length - 1;
|
|
98
|
+
do
|
|
99
|
+
seek = str.indexOf(target, ++seek);
|
|
100
|
+
while (seek > -1 && first !== "'" && isEscaped(str, seek));
|
|
101
|
+
if (seek > -1) {
|
|
102
|
+
seek += target.length;
|
|
103
|
+
if (target.length > 1) {
|
|
104
|
+
if (str[seek] === first)
|
|
105
|
+
seek++;
|
|
106
|
+
if (str[seek] === first)
|
|
107
|
+
seek++;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return seek;
|
|
111
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "smol-toml",
|
|
3
|
+
"license": "BSD-3-Clause",
|
|
4
|
+
"version": "1.6.1",
|
|
5
|
+
"description": "A small, fast, and correct TOML parser/serializer",
|
|
6
|
+
"author": "Cynthia <cyyynthia@borkenware.com>",
|
|
7
|
+
"repository": "github:squirrelchat/smol-toml",
|
|
8
|
+
"bugs": "https://github.com/squirrelchat/smol-toml/issues",
|
|
9
|
+
"funding": "https://github.com/sponsors/cyyynthia",
|
|
10
|
+
"keywords": [
|
|
11
|
+
"toml",
|
|
12
|
+
"parser",
|
|
13
|
+
"serializer"
|
|
14
|
+
],
|
|
15
|
+
"type": "module",
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">= 18"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@iarna/toml": "3.0.0",
|
|
21
|
+
"@ltd/j-toml": "^1.38.0",
|
|
22
|
+
"@tsconfig/node-lts": "^24.0.0",
|
|
23
|
+
"@tsconfig/strictest": "^2.0.8",
|
|
24
|
+
"@types/node": "^25.5.0",
|
|
25
|
+
"@vitest/ui": "^4.1.1",
|
|
26
|
+
"esbuild": "^0.27.4",
|
|
27
|
+
"fast-toml": "^0.5.4",
|
|
28
|
+
"pin-github-action": "^3.4.0",
|
|
29
|
+
"typescript": "^5.9.3",
|
|
30
|
+
"vitest": "^4.1.1"
|
|
31
|
+
},
|
|
32
|
+
"main": "./dist/index.cjs",
|
|
33
|
+
"module": "./dist/index.js",
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
35
|
+
"exports": {
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
37
|
+
"import": "./dist/index.js",
|
|
38
|
+
"require": "./dist/index.cjs"
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"README.md",
|
|
42
|
+
"LICENSE",
|
|
43
|
+
"dist"
|
|
44
|
+
],
|
|
45
|
+
"scripts": {
|
|
46
|
+
"test": "vitest",
|
|
47
|
+
"test-ui": "vitest --ui",
|
|
48
|
+
"bench": "vitest bench",
|
|
49
|
+
"build": "pnpm run build:mjs && pnpm run build:cjs && node test/package/package-test.mjs",
|
|
50
|
+
"build:mjs": "tsc",
|
|
51
|
+
"build:cjs": "esbuild dist/index.js --bundle --platform=node --target=node18 --format=cjs --outfile=dist/index.cjs",
|
|
52
|
+
"update-gha": "pin-github-action .github/workflows"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as readline from "readline";
|
|
2
2
|
import { compileJsonSchema, formatIssues } from "toolcraft-schema";
|
|
3
|
-
import uriTemplateParser from "uri-template";
|
|
4
|
-
import UriTemplate from "uri-template-lite";
|
|
5
3
|
import { JSON_RPC_ERROR_CODES, ToolError } from "./types.js";
|
|
6
4
|
import { parseMessage, formatSuccessResponse, formatErrorResponse } from "./jsonrpc.js";
|
|
5
|
+
import { parseUriTemplate } from "./uri-template.js";
|
|
7
6
|
import { toContentBlocks } from "./content/convert.js";
|
|
8
7
|
const PROTOCOL_VERSION = "2025-11-25";
|
|
9
8
|
const SUPPORTED_PROTOCOL_VERSIONS = new Set(["2025-03-26", "2025-06-18", PROTOCOL_VERSION]);
|
|
@@ -228,7 +227,7 @@ export function createServer(options) {
|
|
|
228
227
|
if (method === "resources/templates/list") {
|
|
229
228
|
return {
|
|
230
229
|
result: {
|
|
231
|
-
resourceTemplates: [...resourceTemplates.values()].map(({ handler: _handler, ...resourceTemplate }) => resourceTemplate)
|
|
230
|
+
resourceTemplates: [...resourceTemplates.values()].map(({ handler: _handler, template: _template, ...resourceTemplate }) => resourceTemplate)
|
|
232
231
|
}
|
|
233
232
|
};
|
|
234
233
|
}
|
|
@@ -451,12 +450,11 @@ export function createServer(options) {
|
|
|
451
450
|
return server;
|
|
452
451
|
},
|
|
453
452
|
resourceTemplate(definition, handler) {
|
|
454
|
-
|
|
455
|
-
new UriTemplate(definition.uriTemplate);
|
|
453
|
+
const template = parseReadableUriTemplate(definition.uriTemplate);
|
|
456
454
|
if (resourceTemplates.has(definition.uriTemplate)) {
|
|
457
455
|
throw new Error(`Resource template already registered: ${definition.uriTemplate}`);
|
|
458
456
|
}
|
|
459
|
-
resourceTemplates.set(definition.uriTemplate, { ...definition, handler });
|
|
457
|
+
resourceTemplates.set(definition.uriTemplate, { ...definition, handler, template });
|
|
460
458
|
return server;
|
|
461
459
|
},
|
|
462
460
|
method(name, handler) {
|
|
@@ -660,14 +658,12 @@ function assertNonEmptyName(name, message) {
|
|
|
660
658
|
throw new Error(message);
|
|
661
659
|
}
|
|
662
660
|
}
|
|
663
|
-
function
|
|
664
|
-
const
|
|
665
|
-
|
|
666
|
-
get: (_target, property) => (typeof property === "string" ? "value" : undefined)
|
|
667
|
-
}));
|
|
668
|
-
if (typeof expanded !== "string" || !isValidUri(expanded)) {
|
|
661
|
+
function parseReadableUriTemplate(uriTemplate) {
|
|
662
|
+
const template = parseUriTemplate(uriTemplate);
|
|
663
|
+
if (!isValidUri(template.expand({}))) {
|
|
669
664
|
throw new Error(`Invalid resource URI template: ${uriTemplate}`);
|
|
670
665
|
}
|
|
666
|
+
return template;
|
|
671
667
|
}
|
|
672
668
|
function toStringArguments(value) {
|
|
673
669
|
if (value === undefined) {
|
|
@@ -693,15 +689,7 @@ function findReadableResource(uri, resources, resourceTemplates) {
|
|
|
693
689
|
if (resource !== undefined) {
|
|
694
690
|
return resource;
|
|
695
691
|
}
|
|
696
|
-
return [...resourceTemplates.values()].find((template) =>
|
|
697
|
-
}
|
|
698
|
-
function matchesUriTemplate(template, uri) {
|
|
699
|
-
try {
|
|
700
|
-
return new UriTemplate(template).match(uri) !== null;
|
|
701
|
-
}
|
|
702
|
-
catch {
|
|
703
|
-
return false;
|
|
704
|
-
}
|
|
692
|
+
return [...resourceTemplates.values()].find((template) => template.template.match(uri) !== null);
|
|
705
693
|
}
|
|
706
694
|
function isCallToolResult(value) {
|
|
707
695
|
if (!hasContentArray(value) || !value.content.every(isContentItem)) {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type UriTemplateValue = string | string[] | Record<string, string>;
|
|
2
|
+
export interface UriTemplate {
|
|
3
|
+
expand(variables: Record<string, UriTemplateValue>): string;
|
|
4
|
+
match(uri: string): Record<string, string> | null;
|
|
5
|
+
}
|
|
6
|
+
export declare function parseUriTemplate(template: string): UriTemplate;
|