opencode-gbk-tools 0.1.21 → 0.1.22

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.
@@ -16307,17 +16307,13 @@ async function assertPathAllowed(filePath, context, allowExternal = false) {
16307
16307
  var STREAMING_FILE_SIZE_THRESHOLD_BYTES = 1024 * 1024;
16308
16308
  var STREAM_READ_CHUNK_SIZE_BYTES = 1024 * 1024;
16309
16309
  var gbkLineIndexCache = /* @__PURE__ */ new Map();
16310
- var ANSI_RED = "\x1B[31m";
16311
- var ANSI_GREEN = "\x1B[32m";
16312
- var ANSI_DIM = "\x1B[2m";
16313
- var ANSI_RESET = "\x1B[0m";
16314
16310
  function buildGbkLineDiffPreview(filePath, encoding, beforeText, afterText) {
16315
16311
  const beforeLines = normalizeNewlines(beforeText).split("\n");
16316
16312
  const afterLines = normalizeNewlines(afterText).split("\n");
16317
16313
  const maxLines = Math.max(beforeLines.length, afterLines.length);
16318
16314
  const lines = [
16319
- `${ANSI_DIM}--- ${path2.basename(filePath)} (${encoding})${ANSI_RESET}`,
16320
- `${ANSI_DIM}+++ ${path2.basename(filePath)} (${encoding})${ANSI_RESET}`
16315
+ `--- ${path2.basename(filePath)} (${encoding})`,
16316
+ `+++ ${path2.basename(filePath)} (${encoding})`
16321
16317
  ];
16322
16318
  for (let index = 0; index < maxLines; index += 1) {
16323
16319
  const before = beforeLines[index];
@@ -16327,13 +16323,13 @@ function buildGbkLineDiffPreview(filePath, encoding, beforeText, afterText) {
16327
16323
  continue;
16328
16324
  }
16329
16325
  if (before !== void 0) {
16330
- lines.push(`${ANSI_RED}-${before}${ANSI_RESET}`);
16326
+ lines.push(`-${before}`);
16331
16327
  }
16332
16328
  if (after !== void 0) {
16333
- lines.push(`${ANSI_GREEN}+${after}${ANSI_RESET}`);
16329
+ lines.push(`+${after}`);
16334
16330
  }
16335
16331
  }
16336
- return "\n" + lines.join("\n");
16332
+ return lines.join("\n");
16337
16333
  }
16338
16334
  function toSafeNumber(value) {
16339
16335
  return typeof value === "bigint" ? Number(value) : value;
@@ -16577,17 +16577,13 @@ function assertInsertArguments(input) {
16577
16577
  throw createTextError("GBK_INVALID_ARGUMENT", "\u63D2\u5165\u6A21\u5F0F\u4E0D\u652F\u6301 startLine/endLine/startAnchor/endAnchor");
16578
16578
  }
16579
16579
  }
16580
- var ANSI_RED = "\x1B[31m";
16581
- var ANSI_GREEN = "\x1B[32m";
16582
- var ANSI_DIM = "\x1B[2m";
16583
- var ANSI_RESET = "\x1B[0m";
16584
16580
  function buildLineDiffPreview(filePath, encoding, beforeText, afterText) {
16585
16581
  const beforeLines = normalizeNewlines(beforeText).split("\n");
16586
16582
  const afterLines = normalizeNewlines(afterText).split("\n");
16587
16583
  const maxLines = Math.max(beforeLines.length, afterLines.length);
16588
16584
  const lines = [
16589
- `${ANSI_DIM}--- ${path3.basename(filePath)} (${encoding})${ANSI_RESET}`,
16590
- `${ANSI_DIM}+++ ${path3.basename(filePath)} (${encoding})${ANSI_RESET}`
16585
+ `--- ${path3.basename(filePath)} (${encoding})`,
16586
+ `+++ ${path3.basename(filePath)} (${encoding})`
16591
16587
  ];
16592
16588
  for (let index = 0; index < maxLines; index += 1) {
16593
16589
  const before = beforeLines[index];
@@ -16597,13 +16593,13 @@ function buildLineDiffPreview(filePath, encoding, beforeText, afterText) {
16597
16593
  continue;
16598
16594
  }
16599
16595
  if (before !== void 0) {
16600
- lines.push(`${ANSI_RED}-${before}${ANSI_RESET}`);
16596
+ lines.push(`-${before}`);
16601
16597
  }
16602
16598
  if (after !== void 0) {
16603
- lines.push(`${ANSI_GREEN}+${after}${ANSI_RESET}`);
16599
+ lines.push(`+${after}`);
16604
16600
  }
16605
16601
  }
16606
- return "\n" + lines.join("\n");
16602
+ return lines.join("\n");
16607
16603
  }
16608
16604
  function buildInsertOutput(text, mode, anchor, content, occurrence, ifExists, newlineStyle) {
16609
16605
  const alignedContent = alignTextToNewlineStyle(content, newlineStyle);
@@ -16308,17 +16308,13 @@ async function assertPathAllowed(filePath, context, allowExternal = false) {
16308
16308
  var STREAMING_FILE_SIZE_THRESHOLD_BYTES = 1024 * 1024;
16309
16309
  var STREAM_READ_CHUNK_SIZE_BYTES = 1024 * 1024;
16310
16310
  var gbkLineIndexCache = /* @__PURE__ */ new Map();
16311
- var ANSI_RED = "\x1B[31m";
16312
- var ANSI_GREEN = "\x1B[32m";
16313
- var ANSI_DIM = "\x1B[2m";
16314
- var ANSI_RESET = "\x1B[0m";
16315
16311
  function buildGbkLineDiffPreview(filePath, encoding, beforeText, afterText) {
16316
16312
  const beforeLines = normalizeNewlines(beforeText).split("\n");
16317
16313
  const afterLines = normalizeNewlines(afterText).split("\n");
16318
16314
  const maxLines = Math.max(beforeLines.length, afterLines.length);
16319
16315
  const lines = [
16320
- `${ANSI_DIM}--- ${path2.basename(filePath)} (${encoding})${ANSI_RESET}`,
16321
- `${ANSI_DIM}+++ ${path2.basename(filePath)} (${encoding})${ANSI_RESET}`
16316
+ `--- ${path2.basename(filePath)} (${encoding})`,
16317
+ `+++ ${path2.basename(filePath)} (${encoding})`
16322
16318
  ];
16323
16319
  for (let index = 0; index < maxLines; index += 1) {
16324
16320
  const before = beforeLines[index];
@@ -16328,13 +16324,13 @@ function buildGbkLineDiffPreview(filePath, encoding, beforeText, afterText) {
16328
16324
  continue;
16329
16325
  }
16330
16326
  if (before !== void 0) {
16331
- lines.push(`${ANSI_RED}-${before}${ANSI_RESET}`);
16327
+ lines.push(`-${before}`);
16332
16328
  }
16333
16329
  if (after !== void 0) {
16334
- lines.push(`${ANSI_GREEN}+${after}${ANSI_RESET}`);
16330
+ lines.push(`+${after}`);
16335
16331
  }
16336
16332
  }
16337
- return "\n" + lines.join("\n");
16333
+ return lines.join("\n");
16338
16334
  }
16339
16335
  function toSafeNumber(value) {
16340
16336
  return typeof value === "bigint" ? Number(value) : value;
@@ -18055,17 +18051,13 @@ function assertInsertArguments2(input) {
18055
18051
  throw createTextError("GBK_INVALID_ARGUMENT", "\u63D2\u5165\u6A21\u5F0F\u4E0D\u652F\u6301 startLine/endLine/startAnchor/endAnchor");
18056
18052
  }
18057
18053
  }
18058
- var ANSI_RED2 = "\x1B[31m";
18059
- var ANSI_GREEN2 = "\x1B[32m";
18060
- var ANSI_DIM2 = "\x1B[2m";
18061
- var ANSI_RESET2 = "\x1B[0m";
18062
18054
  function buildLineDiffPreview(filePath, encoding, beforeText, afterText) {
18063
18055
  const beforeLines = normalizeNewlines2(beforeText).split("\n");
18064
18056
  const afterLines = normalizeNewlines2(afterText).split("\n");
18065
18057
  const maxLines = Math.max(beforeLines.length, afterLines.length);
18066
18058
  const lines = [
18067
- `${ANSI_DIM2}--- ${path3.basename(filePath)} (${encoding})${ANSI_RESET2}`,
18068
- `${ANSI_DIM2}+++ ${path3.basename(filePath)} (${encoding})${ANSI_RESET2}`
18059
+ `--- ${path3.basename(filePath)} (${encoding})`,
18060
+ `+++ ${path3.basename(filePath)} (${encoding})`
18069
18061
  ];
18070
18062
  for (let index = 0; index < maxLines; index += 1) {
18071
18063
  const before = beforeLines[index];
@@ -18075,13 +18067,13 @@ function buildLineDiffPreview(filePath, encoding, beforeText, afterText) {
18075
18067
  continue;
18076
18068
  }
18077
18069
  if (before !== void 0) {
18078
- lines.push(`${ANSI_RED2}-${before}${ANSI_RESET2}`);
18070
+ lines.push(`-${before}`);
18079
18071
  }
18080
18072
  if (after !== void 0) {
18081
- lines.push(`${ANSI_GREEN2}+${after}${ANSI_RESET2}`);
18073
+ lines.push(`+${after}`);
18082
18074
  }
18083
18075
  }
18084
- return "\n" + lines.join("\n");
18076
+ return lines.join("\n");
18085
18077
  }
18086
18078
  function buildInsertOutput(text, mode, anchor, content, occurrence, ifExists, newlineStyle) {
18087
18079
  const alignedContent = alignTextToNewlineStyle2(content, newlineStyle);
@@ -16308,17 +16308,13 @@ async function assertPathAllowed(filePath, context, allowExternal = false) {
16308
16308
  var STREAMING_FILE_SIZE_THRESHOLD_BYTES = 1024 * 1024;
16309
16309
  var STREAM_READ_CHUNK_SIZE_BYTES = 1024 * 1024;
16310
16310
  var gbkLineIndexCache = /* @__PURE__ */ new Map();
16311
- var ANSI_RED = "\x1B[31m";
16312
- var ANSI_GREEN = "\x1B[32m";
16313
- var ANSI_DIM = "\x1B[2m";
16314
- var ANSI_RESET = "\x1B[0m";
16315
16311
  function buildGbkLineDiffPreview(filePath, encoding, beforeText, afterText) {
16316
16312
  const beforeLines = normalizeNewlines(beforeText).split("\n");
16317
16313
  const afterLines = normalizeNewlines(afterText).split("\n");
16318
16314
  const maxLines = Math.max(beforeLines.length, afterLines.length);
16319
16315
  const lines = [
16320
- `${ANSI_DIM}--- ${path2.basename(filePath)} (${encoding})${ANSI_RESET}`,
16321
- `${ANSI_DIM}+++ ${path2.basename(filePath)} (${encoding})${ANSI_RESET}`
16316
+ `--- ${path2.basename(filePath)} (${encoding})`,
16317
+ `+++ ${path2.basename(filePath)} (${encoding})`
16322
16318
  ];
16323
16319
  for (let index = 0; index < maxLines; index += 1) {
16324
16320
  const before = beforeLines[index];
@@ -16328,13 +16324,13 @@ function buildGbkLineDiffPreview(filePath, encoding, beforeText, afterText) {
16328
16324
  continue;
16329
16325
  }
16330
16326
  if (before !== void 0) {
16331
- lines.push(`${ANSI_RED}-${before}${ANSI_RESET}`);
16327
+ lines.push(`-${before}`);
16332
16328
  }
16333
16329
  if (after !== void 0) {
16334
- lines.push(`${ANSI_GREEN}+${after}${ANSI_RESET}`);
16330
+ lines.push(`+${after}`);
16335
16331
  }
16336
16332
  }
16337
- return "\n" + lines.join("\n");
16333
+ return lines.join("\n");
16338
16334
  }
16339
16335
  function toSafeNumber(value) {
16340
16336
  return typeof value === "bigint" ? Number(value) : value;
@@ -18055,17 +18051,13 @@ function assertInsertArguments2(input) {
18055
18051
  throw createTextError("GBK_INVALID_ARGUMENT", "\u63D2\u5165\u6A21\u5F0F\u4E0D\u652F\u6301 startLine/endLine/startAnchor/endAnchor");
18056
18052
  }
18057
18053
  }
18058
- var ANSI_RED2 = "\x1B[31m";
18059
- var ANSI_GREEN2 = "\x1B[32m";
18060
- var ANSI_DIM2 = "\x1B[2m";
18061
- var ANSI_RESET2 = "\x1B[0m";
18062
18054
  function buildLineDiffPreview(filePath, encoding, beforeText, afterText) {
18063
18055
  const beforeLines = normalizeNewlines2(beforeText).split("\n");
18064
18056
  const afterLines = normalizeNewlines2(afterText).split("\n");
18065
18057
  const maxLines = Math.max(beforeLines.length, afterLines.length);
18066
18058
  const lines = [
18067
- `${ANSI_DIM2}--- ${path3.basename(filePath)} (${encoding})${ANSI_RESET2}`,
18068
- `${ANSI_DIM2}+++ ${path3.basename(filePath)} (${encoding})${ANSI_RESET2}`
18059
+ `--- ${path3.basename(filePath)} (${encoding})`,
18060
+ `+++ ${path3.basename(filePath)} (${encoding})`
18069
18061
  ];
18070
18062
  for (let index = 0; index < maxLines; index += 1) {
18071
18063
  const before = beforeLines[index];
@@ -18075,13 +18067,13 @@ function buildLineDiffPreview(filePath, encoding, beforeText, afterText) {
18075
18067
  continue;
18076
18068
  }
18077
18069
  if (before !== void 0) {
18078
- lines.push(`${ANSI_RED2}-${before}${ANSI_RESET2}`);
18070
+ lines.push(`-${before}`);
18079
18071
  }
18080
18072
  if (after !== void 0) {
18081
- lines.push(`${ANSI_GREEN2}+${after}${ANSI_RESET2}`);
18073
+ lines.push(`+${after}`);
18082
18074
  }
18083
18075
  }
18084
- return "\n" + lines.join("\n");
18076
+ return lines.join("\n");
18085
18077
  }
18086
18078
  function buildInsertOutput(text, mode, anchor, content, occurrence, ifExists, newlineStyle) {
18087
18079
  const alignedContent = alignTextToNewlineStyle2(content, newlineStyle);
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "manifestVersion": 1,
3
3
  "packageName": "opencode-gbk-tools",
4
- "packageVersion": "0.1.19",
4
+ "packageVersion": "0.1.21",
5
5
  "artifacts": [
6
6
  {
7
7
  "relativePath": "plugins/opencode-gbk-tools.js",
8
8
  "kind": "plugin",
9
- "expectedHash": "481836ea0b68a3b872d46346cfa1bc270966d57d566b66846df882aa4885972e",
9
+ "expectedHash": "d0407b86c21d2515bf4642c3bbede9bc26083224d316f19c3d40decb7fea4461",
10
10
  "hashAlgorithm": "sha256"
11
11
  }
12
12
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-gbk-tools",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
4
4
  "description": "Auto-encoding text tools plus GBK/GB18030 tools for OpenCode",
5
5
  "type": "module",
6
6
  "main": "./dist/plugin/index.js",