@awsless/i18n 0.0.16 → 0.0.17

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.
Files changed (2) hide show
  1. package/dist/index.js +23 -10
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -147,21 +147,34 @@ var findSvelteTranslatable = (code) => {
147
147
  // src/find/typescript.ts
148
148
  import { parse } from "@swc/core";
149
149
  import { simple } from "swc-walk";
150
+ import { BaseVisitor } from "swc-walk/baseVisitor";
151
+ var PatchedBaseVisitor = class extends BaseVisitor {
152
+ FunctionBody(node, state, callback) {
153
+ for (const statement of node.stmts) {
154
+ callback(statement, state);
155
+ }
156
+ }
157
+ };
158
+ var baseVisitor = new PatchedBaseVisitor();
150
159
  var findTypescriptTranslatable = async (code) => {
151
160
  const found = [];
152
161
  const ast = await parse(code, { syntax: "typescript" });
153
162
  const bytes = Buffer.from(code, "utf8");
154
- simple(ast, {
155
- TaggedTemplateExpression(node) {
156
- if (node.tag.type === "MemberExpression" && node.tag.object.type === "Identifier" && node.tag.object.value === "lang" && node.tag.property.type === "Identifier" && node.tag.property.value === "t") {
157
- const content = bytes.subarray(
158
- node.template.span.start - ast.span.start + 1,
159
- node.template.span.end - ast.span.start - 1
160
- ).toString("utf8");
161
- found.push(content);
163
+ simple(
164
+ ast,
165
+ {
166
+ TaggedTemplateExpression(node) {
167
+ if (node.tag.type === "MemberExpression" && node.tag.object.type === "Identifier" && node.tag.object.value === "lang" && node.tag.property.type === "Identifier" && node.tag.property.value === "t") {
168
+ const content = bytes.subarray(
169
+ node.template.span.start - ast.span.start + 1,
170
+ node.template.span.end - ast.span.start - 1
171
+ ).toString("utf8");
172
+ found.push(content);
173
+ }
162
174
  }
163
- }
164
- });
175
+ },
176
+ baseVisitor
177
+ );
165
178
  return found;
166
179
  };
167
180
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/i18n",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -60,7 +60,7 @@
60
60
  "glob": "^10.3.9",
61
61
  "line-column": "^1.0.2",
62
62
  "magic-string": "^0.30.18",
63
- "swc-walk": "1.0.0-rc.2",
63
+ "swc-walk": "3.0.0-rc.0",
64
64
  "zod": "^4.1.11"
65
65
  },
66
66
  "scripts": {