@gringow/gringow 0.0.8 → 0.0.9

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/dist/config.d.mts CHANGED
@@ -44,10 +44,10 @@ declare const awaitedConfig: Promise<{
44
44
  llm: {
45
45
  choice: "gemini" | "anthropic" | "huggingface";
46
46
  model: string | null;
47
- prePrompt?: string | undefined;
48
- postPrompt?: string | undefined;
49
47
  temperature?: number | undefined;
50
48
  sleep?: number | undefined;
49
+ prePrompt?: string | undefined;
50
+ postPrompt?: string | undefined;
51
51
  prePromptReplace?: string | undefined;
52
52
  postPromptReplace?: string | undefined;
53
53
  prePromptAppend?: string | undefined;
@@ -42,7 +42,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
42
42
  mod
43
43
  ));
44
44
 
45
- // ../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.4/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
45
+ // ../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
46
46
  function encodeInteger(builder, num, relative2) {
47
47
  let delta = num - relative2;
48
48
  delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
@@ -81,7 +81,7 @@ function encode(decoded) {
81
81
  }
82
82
  var comma2, semicolon, chars2, intToChar2, charToInt2, bufLength, td, StringWriter;
83
83
  var init_sourcemap_codec = __esm({
84
- "../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.4/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs"() {
84
+ "../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs"() {
85
85
  comma2 = ",".charCodeAt(0);
86
86
  semicolon = ";".charCodeAt(0);
87
87
  chars2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
@@ -129,7 +129,7 @@ var init_sourcemap_codec = __esm({
129
129
  }
130
130
  });
131
131
 
132
- // ../node_modules/.pnpm/magic-string@0.30.17/node_modules/magic-string/dist/magic-string.es.mjs
132
+ // ../node_modules/.pnpm/magic-string@0.30.19/node_modules/magic-string/dist/magic-string.es.mjs
133
133
  var magic_string_es_exports = {};
134
134
  __export(magic_string_es_exports, {
135
135
  Bundle: () => Bundle,
@@ -205,7 +205,7 @@ function getLocator(source) {
205
205
  }
206
206
  var BitSet, Chunk, btoa, SourceMap, toString4, wordRegex, Mappings, n, warned, MagicString, hasOwnProp, Bundle;
207
207
  var init_magic_string_es = __esm({
208
- "../node_modules/.pnpm/magic-string@0.30.17/node_modules/magic-string/dist/magic-string.es.mjs"() {
208
+ "../node_modules/.pnpm/magic-string@0.30.19/node_modules/magic-string/dist/magic-string.es.mjs"() {
209
209
  init_sourcemap_codec();
210
210
  BitSet = class _BitSet {
211
211
  constructor(arg) {
@@ -576,6 +576,9 @@ var init_magic_string_es = __esm({
576
576
  }
577
577
  if (chunk.outro.length) mappings.advance(chunk.outro);
578
578
  });
579
+ if (this.outro) {
580
+ mappings.advance(this.outro);
581
+ }
579
582
  return {
580
583
  file: options.file ? options.file.split(/[/\\]/).pop() : void 0,
581
584
  sources: [
@@ -933,10 +936,13 @@ var init_magic_string_es = __esm({
933
936
  _split(index) {
934
937
  if (this.byStart[index] || this.byEnd[index]) return;
935
938
  let chunk = this.lastSearchedChunk;
939
+ let previousChunk = chunk;
936
940
  const searchForward = index > chunk.end;
937
941
  while (chunk) {
938
942
  if (chunk.contains(index)) return this._splitChunk(chunk, index);
939
943
  chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
944
+ if (chunk === previousChunk) return;
945
+ previousChunk = chunk;
940
946
  }
941
947
  }
942
948
  _splitChunk(chunk, index) {
@@ -1083,7 +1089,12 @@ var init_magic_string_es = __esm({
1083
1089
  const { original } = this;
1084
1090
  const index = original.indexOf(string2);
1085
1091
  if (index !== -1) {
1086
- this.overwrite(index, index + string2.length, replacement);
1092
+ if (typeof replacement === "function") {
1093
+ replacement = replacement(string2, index, original);
1094
+ }
1095
+ if (string2 !== replacement) {
1096
+ this.overwrite(index, index + string2.length, replacement);
1097
+ }
1087
1098
  }
1088
1099
  return this;
1089
1100
  }
@@ -1098,7 +1109,11 @@ var init_magic_string_es = __esm({
1098
1109
  const stringLength = string2.length;
1099
1110
  for (let index = original.indexOf(string2); index !== -1; index = original.indexOf(string2, index + stringLength)) {
1100
1111
  const previous = original.slice(index, index + stringLength);
1101
- if (previous !== replacement) this.overwrite(index, index + stringLength, replacement);
1112
+ let _replacement = replacement;
1113
+ if (typeof replacement === "function") {
1114
+ _replacement = replacement(previous, index, original);
1115
+ }
1116
+ if (previous !== _replacement) this.overwrite(index, index + stringLength, _replacement);
1102
1117
  }
1103
1118
  return this;
1104
1119
  }
@@ -39,7 +39,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
39
39
  mod
40
40
  ));
41
41
 
42
- // ../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.4/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
42
+ // ../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
43
43
  function encodeInteger(builder, num, relative2) {
44
44
  let delta = num - relative2;
45
45
  delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
@@ -78,7 +78,7 @@ function encode(decoded) {
78
78
  }
79
79
  var comma2, semicolon, chars2, intToChar2, charToInt2, bufLength, td, StringWriter;
80
80
  var init_sourcemap_codec = __esm({
81
- "../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.4/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs"() {
81
+ "../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs"() {
82
82
  comma2 = ",".charCodeAt(0);
83
83
  semicolon = ";".charCodeAt(0);
84
84
  chars2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
@@ -126,7 +126,7 @@ var init_sourcemap_codec = __esm({
126
126
  }
127
127
  });
128
128
 
129
- // ../node_modules/.pnpm/magic-string@0.30.17/node_modules/magic-string/dist/magic-string.es.mjs
129
+ // ../node_modules/.pnpm/magic-string@0.30.19/node_modules/magic-string/dist/magic-string.es.mjs
130
130
  var magic_string_es_exports = {};
131
131
  __export(magic_string_es_exports, {
132
132
  Bundle: () => Bundle,
@@ -202,7 +202,7 @@ function getLocator(source) {
202
202
  }
203
203
  var BitSet, Chunk, btoa, SourceMap, toString4, wordRegex, Mappings, n, warned, MagicString, hasOwnProp, Bundle;
204
204
  var init_magic_string_es = __esm({
205
- "../node_modules/.pnpm/magic-string@0.30.17/node_modules/magic-string/dist/magic-string.es.mjs"() {
205
+ "../node_modules/.pnpm/magic-string@0.30.19/node_modules/magic-string/dist/magic-string.es.mjs"() {
206
206
  init_sourcemap_codec();
207
207
  BitSet = class _BitSet {
208
208
  constructor(arg) {
@@ -573,6 +573,9 @@ var init_magic_string_es = __esm({
573
573
  }
574
574
  if (chunk.outro.length) mappings.advance(chunk.outro);
575
575
  });
576
+ if (this.outro) {
577
+ mappings.advance(this.outro);
578
+ }
576
579
  return {
577
580
  file: options.file ? options.file.split(/[/\\]/).pop() : void 0,
578
581
  sources: [
@@ -930,10 +933,13 @@ var init_magic_string_es = __esm({
930
933
  _split(index) {
931
934
  if (this.byStart[index] || this.byEnd[index]) return;
932
935
  let chunk = this.lastSearchedChunk;
936
+ let previousChunk = chunk;
933
937
  const searchForward = index > chunk.end;
934
938
  while (chunk) {
935
939
  if (chunk.contains(index)) return this._splitChunk(chunk, index);
936
940
  chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
941
+ if (chunk === previousChunk) return;
942
+ previousChunk = chunk;
937
943
  }
938
944
  }
939
945
  _splitChunk(chunk, index) {
@@ -1080,7 +1086,12 @@ var init_magic_string_es = __esm({
1080
1086
  const { original } = this;
1081
1087
  const index = original.indexOf(string2);
1082
1088
  if (index !== -1) {
1083
- this.overwrite(index, index + string2.length, replacement);
1089
+ if (typeof replacement === "function") {
1090
+ replacement = replacement(string2, index, original);
1091
+ }
1092
+ if (string2 !== replacement) {
1093
+ this.overwrite(index, index + string2.length, replacement);
1094
+ }
1084
1095
  }
1085
1096
  return this;
1086
1097
  }
@@ -1095,7 +1106,11 @@ var init_magic_string_es = __esm({
1095
1106
  const stringLength = string2.length;
1096
1107
  for (let index = original.indexOf(string2); index !== -1; index = original.indexOf(string2, index + stringLength)) {
1097
1108
  const previous = original.slice(index, index + stringLength);
1098
- if (previous !== replacement) this.overwrite(index, index + stringLength, replacement);
1109
+ let _replacement = replacement;
1110
+ if (typeof replacement === "function") {
1111
+ _replacement = replacement(previous, index, original);
1112
+ }
1113
+ if (previous !== _replacement) this.overwrite(index, index + stringLength, _replacement);
1099
1114
  }
1100
1115
  return this;
1101
1116
  }
package/dist/gringow.mjs CHANGED
@@ -600,7 +600,7 @@ function parseGemini(unparsed) {
600
600
  return parsed;
601
601
  }
602
602
 
603
- // src/io/huggingface/languagesMap.ts
603
+ // src/io/huggingface/languages-map.ts
604
604
  var languagesMap = {
605
605
  "en-US": "eng_Latn",
606
606
  "en-GB": "eng_Latn",
package/dist/index.mjs CHANGED
@@ -622,7 +622,7 @@ function parseGemini(unparsed) {
622
622
  return parsed;
623
623
  }
624
624
 
625
- // src/io/huggingface/languagesMap.ts
625
+ // src/io/huggingface/languages-map.ts
626
626
  var languagesMap = {
627
627
  "en-US": "eng_Latn",
628
628
  "en-GB": "eng_Latn",
@@ -268,7 +268,7 @@ function parseGemini(unparsed) {
268
268
  return parsed;
269
269
  }
270
270
 
271
- // src/io/huggingface/languagesMap.ts
271
+ // src/io/huggingface/languages-map.ts
272
272
  var languagesMap = {
273
273
  "en-US": "eng_Latn",
274
274
  "en-GB": "eng_Latn",
@@ -147,7 +147,7 @@ function postPrompt(config) {
147
147
  ].join(" ").trim();
148
148
  }
149
149
 
150
- // src/io/huggingface/languagesMap.ts
150
+ // src/io/huggingface/languages-map.ts
151
151
  var languagesMap = {
152
152
  "en-US": "eng_Latn",
153
153
  "en-GB": "eng_Latn",
@@ -147,7 +147,7 @@ function postPrompt(config) {
147
147
  ].join(" ").trim();
148
148
  }
149
149
 
150
- // src/io/huggingface/languagesMap.ts
150
+ // src/io/huggingface/languages-map.ts
151
151
  var languagesMap = {
152
152
  "en-US": "eng_Latn",
153
153
  "en-GB": "eng_Latn",
@@ -1,4 +1,4 @@
1
- // src/io/huggingface/languagesMap.ts
1
+ // src/io/huggingface/languages-map.ts
2
2
  var languagesMap = {
3
3
  "en-US": "eng_Latn",
4
4
  "en-GB": "eng_Latn",
@@ -39,7 +39,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
39
39
  mod
40
40
  ));
41
41
 
42
- // ../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.4/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
42
+ // ../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
43
43
  function encodeInteger(builder, num, relative2) {
44
44
  let delta = num - relative2;
45
45
  delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
@@ -78,7 +78,7 @@ function encode(decoded) {
78
78
  }
79
79
  var comma2, semicolon, chars2, intToChar2, charToInt2, bufLength, td, StringWriter;
80
80
  var init_sourcemap_codec = __esm({
81
- "../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.4/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs"() {
81
+ "../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs"() {
82
82
  comma2 = ",".charCodeAt(0);
83
83
  semicolon = ";".charCodeAt(0);
84
84
  chars2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
@@ -126,7 +126,7 @@ var init_sourcemap_codec = __esm({
126
126
  }
127
127
  });
128
128
 
129
- // ../node_modules/.pnpm/magic-string@0.30.17/node_modules/magic-string/dist/magic-string.es.mjs
129
+ // ../node_modules/.pnpm/magic-string@0.30.19/node_modules/magic-string/dist/magic-string.es.mjs
130
130
  var magic_string_es_exports = {};
131
131
  __export(magic_string_es_exports, {
132
132
  Bundle: () => Bundle,
@@ -202,7 +202,7 @@ function getLocator(source) {
202
202
  }
203
203
  var BitSet, Chunk, btoa, SourceMap, toString4, wordRegex, Mappings, n, warned, MagicString, hasOwnProp, Bundle;
204
204
  var init_magic_string_es = __esm({
205
- "../node_modules/.pnpm/magic-string@0.30.17/node_modules/magic-string/dist/magic-string.es.mjs"() {
205
+ "../node_modules/.pnpm/magic-string@0.30.19/node_modules/magic-string/dist/magic-string.es.mjs"() {
206
206
  init_sourcemap_codec();
207
207
  BitSet = class _BitSet {
208
208
  constructor(arg) {
@@ -573,6 +573,9 @@ var init_magic_string_es = __esm({
573
573
  }
574
574
  if (chunk.outro.length) mappings.advance(chunk.outro);
575
575
  });
576
+ if (this.outro) {
577
+ mappings.advance(this.outro);
578
+ }
576
579
  return {
577
580
  file: options.file ? options.file.split(/[/\\]/).pop() : void 0,
578
581
  sources: [
@@ -930,10 +933,13 @@ var init_magic_string_es = __esm({
930
933
  _split(index) {
931
934
  if (this.byStart[index] || this.byEnd[index]) return;
932
935
  let chunk = this.lastSearchedChunk;
936
+ let previousChunk = chunk;
933
937
  const searchForward = index > chunk.end;
934
938
  while (chunk) {
935
939
  if (chunk.contains(index)) return this._splitChunk(chunk, index);
936
940
  chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
941
+ if (chunk === previousChunk) return;
942
+ previousChunk = chunk;
937
943
  }
938
944
  }
939
945
  _splitChunk(chunk, index) {
@@ -1080,7 +1086,12 @@ var init_magic_string_es = __esm({
1080
1086
  const { original } = this;
1081
1087
  const index = original.indexOf(string2);
1082
1088
  if (index !== -1) {
1083
- this.overwrite(index, index + string2.length, replacement);
1089
+ if (typeof replacement === "function") {
1090
+ replacement = replacement(string2, index, original);
1091
+ }
1092
+ if (string2 !== replacement) {
1093
+ this.overwrite(index, index + string2.length, replacement);
1094
+ }
1084
1095
  }
1085
1096
  return this;
1086
1097
  }
@@ -1095,7 +1106,11 @@ var init_magic_string_es = __esm({
1095
1106
  const stringLength = string2.length;
1096
1107
  for (let index = original.indexOf(string2); index !== -1; index = original.indexOf(string2, index + stringLength)) {
1097
1108
  const previous = original.slice(index, index + stringLength);
1098
- if (previous !== replacement) this.overwrite(index, index + stringLength, replacement);
1109
+ let _replacement = replacement;
1110
+ if (typeof replacement === "function") {
1111
+ _replacement = replacement(previous, index, original);
1112
+ }
1113
+ if (previous !== _replacement) this.overwrite(index, index + stringLength, _replacement);
1099
1114
  }
1100
1115
  return this;
1101
1116
  }
@@ -53,10 +53,10 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
53
53
  }, "strip", z.ZodTypeAny, {
54
54
  choice: "gemini" | "anthropic" | "huggingface";
55
55
  model: string | null;
56
- prePrompt?: string | undefined;
57
- postPrompt?: string | undefined;
58
56
  temperature?: number | undefined;
59
57
  sleep?: number | undefined;
58
+ prePrompt?: string | undefined;
59
+ postPrompt?: string | undefined;
60
60
  prePromptReplace?: string | undefined;
61
61
  postPromptReplace?: string | undefined;
62
62
  prePromptAppend?: string | undefined;
@@ -64,10 +64,10 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
64
64
  }, {
65
65
  choice: "gemini" | "anthropic" | "huggingface";
66
66
  model: string | null;
67
- prePrompt?: string | undefined;
68
- postPrompt?: string | undefined;
69
67
  temperature?: number | undefined;
70
68
  sleep?: number | undefined;
69
+ prePrompt?: string | undefined;
70
+ postPrompt?: string | undefined;
71
71
  prePromptReplace?: string | undefined;
72
72
  postPromptReplace?: string | undefined;
73
73
  prePromptAppend?: string | undefined;
@@ -93,10 +93,10 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
93
93
  llm: {
94
94
  choice: "gemini" | "anthropic" | "huggingface";
95
95
  model: string | null;
96
- prePrompt?: string | undefined;
97
- postPrompt?: string | undefined;
98
96
  temperature?: number | undefined;
99
97
  sleep?: number | undefined;
98
+ prePrompt?: string | undefined;
99
+ postPrompt?: string | undefined;
100
100
  prePromptReplace?: string | undefined;
101
101
  postPromptReplace?: string | undefined;
102
102
  prePromptAppend?: string | undefined;
@@ -123,10 +123,10 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
123
123
  llm: {
124
124
  choice: "gemini" | "anthropic" | "huggingface";
125
125
  model: string | null;
126
- prePrompt?: string | undefined;
127
- postPrompt?: string | undefined;
128
126
  temperature?: number | undefined;
129
127
  sleep?: number | undefined;
128
+ prePrompt?: string | undefined;
129
+ postPrompt?: string | undefined;
130
130
  prePromptReplace?: string | undefined;
131
131
  postPromptReplace?: string | undefined;
132
132
  prePromptAppend?: string | undefined;
@@ -153,10 +153,10 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
153
153
  llm: {
154
154
  choice: "gemini" | "anthropic" | "huggingface";
155
155
  model: string | null;
156
- prePrompt?: string | undefined;
157
- postPrompt?: string | undefined;
158
156
  temperature?: number | undefined;
159
157
  sleep?: number | undefined;
158
+ prePrompt?: string | undefined;
159
+ postPrompt?: string | undefined;
160
160
  prePromptReplace?: string | undefined;
161
161
  postPromptReplace?: string | undefined;
162
162
  prePromptAppend?: string | undefined;
@@ -183,10 +183,10 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
183
183
  llm: {
184
184
  choice: "gemini" | "anthropic" | "huggingface";
185
185
  model: string | null;
186
- prePrompt?: string | undefined;
187
- postPrompt?: string | undefined;
188
186
  temperature?: number | undefined;
189
187
  sleep?: number | undefined;
188
+ prePrompt?: string | undefined;
189
+ postPrompt?: string | undefined;
190
190
  prePromptReplace?: string | undefined;
191
191
  postPromptReplace?: string | undefined;
192
192
  prePromptAppend?: string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gringow/gringow",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -21,14 +21,17 @@
21
21
  "import": "./dist/browser.mjs"
22
22
  }
23
23
  },
24
- "author": "Renato Gaspar <renato.gaspar@gmail.com>",
24
+ "author": "Renato Gaspar <rntgspr@gmail.com>",
25
+ "license": "MIT",
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
25
29
  "contributors": [
26
30
  {
27
31
  "name": "Renato Gaspar",
28
- "email": "renato.gaspar@gmail.com"
32
+ "email": "rntgspr@gmail.com"
29
33
  }
30
34
  ],
31
- "license": "MIT",
32
35
  "description": "AI-powered translation library for template strings using multiple LLM providers",
33
36
  "files": [
34
37
  "dist/",