@awsless/i18n 0.0.2 → 0.0.4
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/index.cjs +4 -4
- package/dist/index.js +2 -2
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -116,6 +116,7 @@ var import_glob = require("glob");
|
|
|
116
116
|
var import_path2 = require("path");
|
|
117
117
|
|
|
118
118
|
// src/find/svelte.ts
|
|
119
|
+
var import_estree_walker = require("estree-walker");
|
|
119
120
|
var import_line_column = __toESM(require("line-column"), 1);
|
|
120
121
|
var import_compiler = require("svelte/compiler");
|
|
121
122
|
var findSvelteTranslatable = (code) => {
|
|
@@ -138,12 +139,12 @@ var findSvelteTranslatable = (code) => {
|
|
|
138
139
|
found.push(content);
|
|
139
140
|
}
|
|
140
141
|
};
|
|
141
|
-
(0,
|
|
142
|
+
(0, import_estree_walker.walk)(ast.html, { enter });
|
|
142
143
|
if (ast.instance) {
|
|
143
|
-
(0,
|
|
144
|
+
(0, import_estree_walker.walk)(ast.instance.content, { enter });
|
|
144
145
|
}
|
|
145
146
|
if (ast.module) {
|
|
146
|
-
(0,
|
|
147
|
+
(0, import_estree_walker.walk)(ast.module.content, { enter });
|
|
147
148
|
}
|
|
148
149
|
return found;
|
|
149
150
|
};
|
|
@@ -220,7 +221,6 @@ var createI18nPlugin = (props) => {
|
|
|
220
221
|
transform(code) {
|
|
221
222
|
let replaced = false;
|
|
222
223
|
if (code.includes(`$t\``)) {
|
|
223
|
-
console.log(cache);
|
|
224
224
|
for (const item of cache.entries()) {
|
|
225
225
|
code = code.replaceAll(`$t\`${item.original}\``, () => {
|
|
226
226
|
replaced = true;
|
package/dist/index.js
CHANGED
|
@@ -78,8 +78,9 @@ import { glob } from "glob";
|
|
|
78
78
|
import { extname, join as join2 } from "path";
|
|
79
79
|
|
|
80
80
|
// src/find/svelte.ts
|
|
81
|
+
import { walk } from "estree-walker";
|
|
81
82
|
import lineColumn from "line-column";
|
|
82
|
-
import { parse as parseSvelte
|
|
83
|
+
import { parse as parseSvelte } from "svelte/compiler";
|
|
83
84
|
var findSvelteTranslatable = (code) => {
|
|
84
85
|
const found = [];
|
|
85
86
|
const origin = lineColumn(code);
|
|
@@ -182,7 +183,6 @@ var createI18nPlugin = (props) => {
|
|
|
182
183
|
transform(code) {
|
|
183
184
|
let replaced = false;
|
|
184
185
|
if (code.includes(`$t\``)) {
|
|
185
|
-
console.log(cache);
|
|
186
186
|
for (const item of cache.entries()) {
|
|
187
187
|
code = code.replaceAll(`$t\`${item.original}\``, () => {
|
|
188
188
|
replaced = true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/i18n",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@swc/core": "^1.3.70",
|
|
48
48
|
"@types/line-column": "^1.0.2",
|
|
49
|
+
"estree-walker": "^3.0.3",
|
|
49
50
|
"glob": "^10.3.9",
|
|
50
51
|
"line-column": "^1.0.2",
|
|
51
52
|
"openai": "^4.57.0",
|