toolcraft-openapi 0.0.749 → 0.0.750

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.
@@ -6,6 +6,11 @@
6
6
  "version": "0.0.1",
7
7
  "license": "MIT"
8
8
  },
9
+ {
10
+ "name": "@poe-code/terminal-text",
11
+ "version": "0.0.1",
12
+ "license": "MIT"
13
+ },
9
14
  {
10
15
  "name": "fast-string-truncated-width",
11
16
  "version": "3.0.3",
@@ -33,12 +38,12 @@
33
38
  },
34
39
  {
35
40
  "name": "toolcraft-openapi",
36
- "version": "0.0.749",
41
+ "version": "0.0.750",
37
42
  "license": "MIT"
38
43
  },
39
44
  {
40
45
  "name": "toolcraft-schema",
41
- "version": "0.0.749",
46
+ "version": "0.0.750",
42
47
  "license": "MIT"
43
48
  },
44
49
  {
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Poe Platform
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,12 @@
1
+ # Terminal text
2
+
3
+ Make untrusted text safe to display in terminal fields without dropping characters.
4
+ Works in browsers, Workers and Node.js with no runtime dependencies.
5
+
6
+ ```ts
7
+ import { escapeTerminalText } from "@poe-code/terminal-text";
8
+
9
+ escapeTerminalText("Résumé 日本語"); // ordinary Unicode is unchanged
10
+ ```
11
+
12
+ Control characters and bidirectional formatting marks become visible Unicode escapes.
@@ -0,0 +1,2 @@
1
+ /** Makes untrusted text safe to embed in a human-readable terminal field. */
2
+ export declare function escapeTerminalText(text: string): string;
@@ -0,0 +1,20 @@
1
+ /** Makes untrusted text safe to embed in a human-readable terminal field. */
2
+ export function escapeTerminalText(text) {
3
+ let result = "";
4
+ for (const character of text) {
5
+ const code = character.codePointAt(0);
6
+ if (code <= 0x1f ||
7
+ (code >= 0x7f && code <= 0x9f) ||
8
+ code === 0x061c ||
9
+ code === 0x200e ||
10
+ code === 0x200f ||
11
+ (code >= 0x202a && code <= 0x202e) ||
12
+ (code >= 0x2066 && code <= 0x2069)) {
13
+ result += `\\u${code.toString(16).padStart(4, "0")}`;
14
+ }
15
+ else {
16
+ result += character;
17
+ }
18
+ }
19
+ return result;
20
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "private": true,
3
+ "license": "MIT",
4
+ "type": "module",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "LICENSE"
16
+ ],
17
+ "scripts": {
18
+ "build": "node ../../scripts/guard-package-dist.mjs && tsc",
19
+ "test:unit": "cd ../.. && vitest run packages/terminal-text",
20
+ "lint": "eslint src && tsc --noEmit"
21
+ }
22
+ }
@@ -236,6 +236,12 @@ function wrapDetailValue(value, width) {
236
236
  let chunk = "";
237
237
  let index = 0;
238
238
  while (index < word.length) {
239
+ if (isAnsiSequence(word, index)) {
240
+ const ansi = readAnsiSequence(word, index);
241
+ chunk += ansi.sequence;
242
+ index = ansi.nextIndex;
243
+ continue;
244
+ }
239
245
  const cluster = readPrintableCluster(word, index);
240
246
  if (displayWidth(`${chunk}${cluster}`) > width) {
241
247
  break;
@@ -1,2 +1 @@
1
- /** Makes untrusted text safe to embed in a human-readable terminal field. */
2
- export declare function escapeTerminalText(text: string): string;
1
+ export { escapeTerminalText } from "@poe-code/terminal-text";
@@ -1,20 +1 @@
1
- /** Makes untrusted text safe to embed in a human-readable terminal field. */
2
- export function escapeTerminalText(text) {
3
- let result = "";
4
- for (const character of text) {
5
- const code = character.codePointAt(0);
6
- if (code <= 0x1f ||
7
- (code >= 0x7f && code <= 0x9f) ||
8
- code === 0x061c ||
9
- code === 0x200e ||
10
- code === 0x200f ||
11
- (code >= 0x202a && code <= 0x202e) ||
12
- (code >= 0x2066 && code <= 0x2069)) {
13
- result += `\\u${code.toString(16).padStart(4, "0")}`;
14
- }
15
- else {
16
- result += character;
17
- }
18
- }
19
- return result;
20
- }
1
+ export { escapeTerminalText } from "@poe-code/terminal-text";
@@ -1,4 +1,5 @@
1
1
  import { FrontmatterParseError, parseFrontmatter } from "@poe-code/frontmatter";
2
+ const utf8Encoder = new TextEncoder();
2
3
  export function extractFrontmatter(markdown) {
3
4
  let parsed;
4
5
  try {
@@ -19,7 +20,7 @@ export function extractFrontmatter(markdown) {
19
20
  body: parsed.body
20
21
  }, {
21
22
  start: 0,
22
- end: Buffer.byteLength(markdown.slice(0, markdown.length - parsed.body.length), "utf8")
23
+ end: utf8Encoder.encode(markdown.slice(0, markdown.length - parsed.body.length)).byteLength
23
24
  });
24
25
  }
25
26
  function withRange(result, range) {
@@ -1,4 +1,5 @@
1
1
  import { parseBlockDocument } from "./parser/block.js";
2
+ const utf8Encoder = new TextEncoder();
2
3
  export function parse(markdown) {
3
4
  const { frontmatter, frontmatterRange, children } = parseBlockDocument(markdown);
4
5
  const ast = withRange({
@@ -8,7 +9,7 @@ export function parse(markdown) {
8
9
  : [createFrontmatterNode(frontmatter, frontmatterRange), ...children]
9
10
  }, {
10
11
  start: 0,
11
- end: Buffer.byteLength(markdown, "utf8")
12
+ end: utf8Encoder.encode(markdown).byteLength
12
13
  });
13
14
  return {
14
15
  ...(frontmatter === undefined ? {} : { frontmatter }),
@@ -18,6 +18,9 @@ export function dialectFor(schema, inherited) {
18
18
  return inherited;
19
19
  }
20
20
  export function resolveUri(reference, baseUri) {
21
+ if (typeof URL === "undefined" && (reference === "" || reference.startsWith("#"))) {
22
+ return `${withoutFragment(baseUri)}${reference}`;
23
+ }
21
24
  try {
22
25
  return new URL(reference, baseUri).href;
23
26
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toolcraft-schema",
3
- "version": "0.0.749",
3
+ "version": "0.0.750",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toolcraft-openapi",
3
- "version": "0.0.749",
3
+ "version": "0.0.750",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -19,8 +19,8 @@
19
19
  "build": "rm -rf dist && tsc",
20
20
  "test": "cd ../.. && vitest run packages/toolcraft-openapi/src",
21
21
  "test:unit": "cd ../.. && vitest run packages/toolcraft-openapi/src",
22
- "prepack": "\"$npm_node_execpath\" \"$npm_execpath\" --prefix ../.. run build:workspaces -- --workspace=\"$npm_package_name\" >&2 && node ../../scripts/set-bin-executable.mjs && node ../../scripts/manage-bundled-workspace-deps.mjs prepare . toolcraft-schema toolcraft-design @poe-code/frontmatter fast-string-width fast-wrap-ansi sisteransi yaml",
23
- "postpack": "node ../../scripts/manage-bundled-workspace-deps.mjs cleanup . toolcraft-schema toolcraft-design @poe-code/frontmatter fast-string-width fast-wrap-ansi sisteransi yaml"
22
+ "prepack": "\"$npm_node_execpath\" \"$npm_execpath\" --prefix ../.. run build:workspaces -- --workspace=\"$npm_package_name\" >&2 && node ../../scripts/set-bin-executable.mjs && node ../../scripts/manage-bundled-workspace-deps.mjs prepare . toolcraft-schema toolcraft-design @poe-code/frontmatter fast-string-width fast-wrap-ansi sisteransi yaml @poe-code/terminal-text",
23
+ "postpack": "node ../../scripts/manage-bundled-workspace-deps.mjs cleanup . toolcraft-schema toolcraft-design @poe-code/frontmatter fast-string-width fast-wrap-ansi sisteransi yaml @poe-code/terminal-text"
24
24
  },
25
25
  "files": [
26
26
  "LICENSE",
@@ -30,7 +30,7 @@
30
30
  "toolcraft-openapi-generate": "dist/bin/generate.js"
31
31
  },
32
32
  "dependencies": {
33
- "toolcraft": "0.0.749",
33
+ "toolcraft": "0.0.750",
34
34
  "fast-string-width": "^3.0.2",
35
35
  "fast-wrap-ansi": "^0.2.0",
36
36
  "sisteransi": "^1.0.5",
@@ -45,9 +45,10 @@
45
45
  "directory": "packages/toolcraft-openapi"
46
46
  },
47
47
  "optionalDependencies": {
48
- "toolcraft-schema": "0.0.749",
48
+ "toolcraft-schema": "0.0.750",
49
49
  "toolcraft-design": "*",
50
- "@poe-code/frontmatter": "*"
50
+ "@poe-code/frontmatter": "*",
51
+ "@poe-code/terminal-text": "*"
51
52
  },
52
53
  "bundleDependencies": [
53
54
  "toolcraft-schema",
@@ -56,6 +57,7 @@
56
57
  "fast-string-width",
57
58
  "fast-wrap-ansi",
58
59
  "sisteransi",
59
- "yaml"
60
+ "yaml",
61
+ "@poe-code/terminal-text"
60
62
  ]
61
63
  }