gt 2.14.65 → 2.14.66

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # gtx-cli
2
2
 
3
+ ## 2.14.66
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1929](https://github.com/generaltranslation/gt/pull/1929) [`f53bb5e`](https://github.com/generaltranslation/gt/commit/f53bb5ea4b4989a2a4ad3aebf464011f01e029ad) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Replace the FormatJS ICU parser and runtime formatter dependencies with the new dependency-free `@generaltranslation/icu` package.
8
+
9
+ - Updated dependencies [[`bbf4eb0`](https://github.com/generaltranslation/gt/commit/bbf4eb0cf77160baa615776619acd7afe35697ba), [`f53bb5e`](https://github.com/generaltranslation/gt/commit/f53bb5ea4b4989a2a4ad3aebf464011f01e029ad)]:
10
+ - generaltranslation@9.0.4
11
+ - @generaltranslation/icu@0.1.0
12
+ - @generaltranslation/format@0.1.3
13
+ - @generaltranslation/python-extractor@0.2.31
14
+ - @generaltranslation/supported-locales@2.1.11
15
+
3
16
  ## 2.14.65
4
17
 
5
18
  ### Patch Changes
@@ -1 +1 @@
1
- export declare const PACKAGE_VERSION = "2.14.65";
1
+ export declare const PACKAGE_VERSION = "2.14.66";
@@ -1,5 +1,5 @@
1
1
  //#region src/generated/version.ts
2
- const PACKAGE_VERSION = "2.14.65";
2
+ const PACKAGE_VERSION = "2.14.66";
3
3
  //#endregion
4
4
  export { PACKAGE_VERSION };
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","names":[],"sources":["../../src/generated/version.ts"],"sourcesContent":["// This file is auto-generated. Do not edit manually.\nexport const PACKAGE_VERSION = '2.14.65';\n"],"mappings":";AACA,MAAa,kBAAkB"}
1
+ {"version":3,"file":"version.js","names":[],"sources":["../../src/generated/version.ts"],"sourcesContent":["// This file is auto-generated. Do not edit manually.\nexport const PACKAGE_VERSION = '2.14.66';\n"],"mappings":";AACA,MAAa,kBAAkB"}
@@ -1,5 +1,5 @@
1
1
  import * as t from "@babel/types";
2
- import { parse } from "@formatjs/icu-messageformat-parser";
2
+ import { parse } from "@generaltranslation/icu";
3
3
  //#region src/react/jsx/evaluateJsx.ts
4
4
  const MEANINGFUL_REGEX = /[\p{L}\p{N}]/u;
5
5
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"evaluateJsx.js","names":[],"sources":["../../../src/react/jsx/evaluateJsx.ts"],"sourcesContent":["import * as t from '@babel/types';\nimport { parse } from '@formatjs/icu-messageformat-parser';\n\nconst MEANINGFUL_REGEX = /[\\p{L}\\p{N}]/u;\n\n/**\n * Checks if a node is meaningful. Does not recurse into children.\n * @param node - The node to check\n * @returns Whether the node is meaningful\n */\nexport function isMeaningful(node: t.Node): boolean {\n if (t.isStringLiteral(node) || t.isJSXText(node)) {\n return MEANINGFUL_REGEX.test(node.value);\n }\n // Handle template literals without expressions\n if (t.isTemplateLiteral(node) && node.expressions.length === 0) {\n return MEANINGFUL_REGEX.test(node.quasis[0].value.raw);\n }\n if (t.isJSXExpressionContainer(node)) {\n const value = isStaticExpression(node.expression);\n if (value.isStatic && value.value) {\n return MEANINGFUL_REGEX.test(value.value);\n }\n }\n if (t.isBinaryExpression(node)) {\n if (node.operator === '+') {\n return isMeaningful(node.left) || isMeaningful(node.right);\n }\n }\n return false;\n}\n\nexport function isStaticExpression(\n expr: t.Expression | t.JSXEmptyExpression,\n jsxStatic?: false\n): {\n isStatic: boolean;\n value?: string;\n};\nexport function isStaticExpression(\n expr: t.Expression | t.JSXEmptyExpression,\n jsxStatic?: true\n): {\n isStatic: boolean;\n value?: string | boolean | null;\n};\nexport function isStaticExpression(\n expr: t.Expression | t.JSXEmptyExpression,\n jsxStatic?: boolean\n): {\n isStatic: boolean;\n value?: string | boolean | null;\n};\n/**\n * Checks if an expression is a static expression (does not contain any variables which could change at runtime).\n * @param expr - The expression to check\n * @param jsxStatic - Whether to return JSX-compatible values (boolean, null) in addition to strings\n * @returns An object containing the result of the static check\n */\nexport function isStaticExpression(\n expr: t.Expression | t.JSXEmptyExpression,\n jsxStatic = false\n): {\n isStatic: boolean;\n value?: string | boolean | null;\n} {\n // Handle empty expressions\n if (t.isJSXEmptyExpression(expr)) {\n return { isStatic: true, value: '' };\n }\n\n // Handle direct string literals\n if (t.isStringLiteral(expr)) {\n return { isStatic: true, value: expr.value };\n }\n\n // Handle template literals without expressions\n if (t.isTemplateLiteral(expr) && expr.expressions.length === 0) {\n return {\n isStatic: true,\n value: jsxStatic ? expr.quasis[0].value.cooked : expr.quasis[0].value.raw,\n };\n }\n\n // Binary expressions are not derivable\n if (t.isBinaryExpression(expr)) {\n // Not a derivable expression\n return { isStatic: false };\n }\n\n // Handle parenthesized expressions\n if (t.isParenthesizedExpression(expr)) {\n return isStaticExpression(expr.expression, jsxStatic);\n }\n\n // Handle numeric literals by converting them to strings\n if (t.isNumericLiteral(expr)) {\n return { isStatic: true, value: String(expr.value) };\n }\n\n // Handle unary expressions by converting them to strings\n if (t.isUnaryExpression(expr)) {\n let value: string;\n let operator = '';\n if (expr.operator === '-') {\n operator = expr.operator;\n }\n if (t.isNumericLiteral(expr.argument)) {\n if (expr.argument.value === 0) {\n value = '0';\n } else {\n value = operator + expr.argument.value.toString();\n }\n } else {\n // invalid\n return { isStatic: false };\n }\n\n return { isStatic: true, value };\n }\n\n // Handle boolean literals by converting them to strings\n if (t.isBooleanLiteral(expr)) {\n return {\n isStatic: true,\n value: jsxStatic ? expr.value : String(expr.value),\n };\n }\n\n // Handle null literal\n if (t.isNullLiteral(expr)) {\n return { isStatic: true, value: jsxStatic ? null : 'null' };\n }\n\n // Not a derivable expression\n return { isStatic: false };\n}\n\n/**\n * Checks if an expression is a static value (a string, number, or template literal).\n * @param expr - The expression to check\n * @returns Whether the expression is a static value\n */\nexport function isStaticValue(\n expr: t.Expression | t.JSXEmptyExpression\n): boolean {\n if (t.isStringLiteral(expr)) {\n return true;\n }\n if (t.isNumericLiteral(expr)) {\n return true;\n }\n if (t.isTemplateLiteral(expr)) {\n return true;\n }\n return false;\n}\n\n/**\n * Checks if a string is a valid ICU message format.\n * @param string - The string to check\n * @returns Whether the string is a valid ICU message format\n */\nexport function isValidIcu(string: string): {\n isValid: boolean;\n error?: string;\n} {\n try {\n parse(string);\n } catch (error) {\n return {\n isValid: false,\n error: error instanceof Error ? error.message : String(error),\n };\n }\n return { isValid: true };\n}\n"],"mappings":";;;AAGA,MAAM,mBAAmB;;;;;;AAOzB,SAAgB,aAAa,MAAuB;AAClD,KAAI,EAAE,gBAAgB,KAAK,IAAI,EAAE,UAAU,KAAK,CAC9C,QAAO,iBAAiB,KAAK,KAAK,MAAM;AAG1C,KAAI,EAAE,kBAAkB,KAAK,IAAI,KAAK,YAAY,WAAW,EAC3D,QAAO,iBAAiB,KAAK,KAAK,OAAO,GAAG,MAAM,IAAI;AAExD,KAAI,EAAE,yBAAyB,KAAK,EAAE;EACpC,MAAM,QAAQ,mBAAmB,KAAK,WAAW;AACjD,MAAI,MAAM,YAAY,MAAM,MAC1B,QAAO,iBAAiB,KAAK,MAAM,MAAM;;AAG7C,KAAI,EAAE,mBAAmB,KAAK;MACxB,KAAK,aAAa,IACpB,QAAO,aAAa,KAAK,KAAK,IAAI,aAAa,KAAK,MAAM;;AAG9D,QAAO;;;;;;;;AA8BT,SAAgB,mBACd,MACA,YAAY,OAIZ;AAEA,KAAI,EAAE,qBAAqB,KAAK,CAC9B,QAAO;EAAE,UAAU;EAAM,OAAO;EAAI;AAItC,KAAI,EAAE,gBAAgB,KAAK,CACzB,QAAO;EAAE,UAAU;EAAM,OAAO,KAAK;EAAO;AAI9C,KAAI,EAAE,kBAAkB,KAAK,IAAI,KAAK,YAAY,WAAW,EAC3D,QAAO;EACL,UAAU;EACV,OAAO,YAAY,KAAK,OAAO,GAAG,MAAM,SAAS,KAAK,OAAO,GAAG,MAAM;EACvE;AAIH,KAAI,EAAE,mBAAmB,KAAK,CAE5B,QAAO,EAAE,UAAU,OAAO;AAI5B,KAAI,EAAE,0BAA0B,KAAK,CACnC,QAAO,mBAAmB,KAAK,YAAY,UAAU;AAIvD,KAAI,EAAE,iBAAiB,KAAK,CAC1B,QAAO;EAAE,UAAU;EAAM,OAAO,OAAO,KAAK,MAAM;EAAE;AAItD,KAAI,EAAE,kBAAkB,KAAK,EAAE;EAC7B,IAAI;EACJ,IAAI,WAAW;AACf,MAAI,KAAK,aAAa,IACpB,YAAW,KAAK;AAElB,MAAI,EAAE,iBAAiB,KAAK,SAAS,CACnC,KAAI,KAAK,SAAS,UAAU,EAC1B,SAAQ;MAER,SAAQ,WAAW,KAAK,SAAS,MAAM,UAAU;MAInD,QAAO,EAAE,UAAU,OAAO;AAG5B,SAAO;GAAE,UAAU;GAAM;GAAO;;AAIlC,KAAI,EAAE,iBAAiB,KAAK,CAC1B,QAAO;EACL,UAAU;EACV,OAAO,YAAY,KAAK,QAAQ,OAAO,KAAK,MAAM;EACnD;AAIH,KAAI,EAAE,cAAc,KAAK,CACvB,QAAO;EAAE,UAAU;EAAM,OAAO,YAAY,OAAO;EAAQ;AAI7D,QAAO,EAAE,UAAU,OAAO;;;;;;;AAQ5B,SAAgB,cACd,MACS;AACT,KAAI,EAAE,gBAAgB,KAAK,CACzB,QAAO;AAET,KAAI,EAAE,iBAAiB,KAAK,CAC1B,QAAO;AAET,KAAI,EAAE,kBAAkB,KAAK,CAC3B,QAAO;AAET,QAAO;;;;;;;AAQT,SAAgB,WAAW,QAGzB;AACA,KAAI;AACF,QAAM,OAAO;UACN,OAAO;AACd,SAAO;GACL,SAAS;GACT,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;GAC9D;;AAEH,QAAO,EAAE,SAAS,MAAM"}
1
+ {"version":3,"file":"evaluateJsx.js","names":[],"sources":["../../../src/react/jsx/evaluateJsx.ts"],"sourcesContent":["import * as t from '@babel/types';\nimport { parse } from '@generaltranslation/icu';\n\nconst MEANINGFUL_REGEX = /[\\p{L}\\p{N}]/u;\n\n/**\n * Checks if a node is meaningful. Does not recurse into children.\n * @param node - The node to check\n * @returns Whether the node is meaningful\n */\nexport function isMeaningful(node: t.Node): boolean {\n if (t.isStringLiteral(node) || t.isJSXText(node)) {\n return MEANINGFUL_REGEX.test(node.value);\n }\n // Handle template literals without expressions\n if (t.isTemplateLiteral(node) && node.expressions.length === 0) {\n return MEANINGFUL_REGEX.test(node.quasis[0].value.raw);\n }\n if (t.isJSXExpressionContainer(node)) {\n const value = isStaticExpression(node.expression);\n if (value.isStatic && value.value) {\n return MEANINGFUL_REGEX.test(value.value);\n }\n }\n if (t.isBinaryExpression(node)) {\n if (node.operator === '+') {\n return isMeaningful(node.left) || isMeaningful(node.right);\n }\n }\n return false;\n}\n\nexport function isStaticExpression(\n expr: t.Expression | t.JSXEmptyExpression,\n jsxStatic?: false\n): {\n isStatic: boolean;\n value?: string;\n};\nexport function isStaticExpression(\n expr: t.Expression | t.JSXEmptyExpression,\n jsxStatic?: true\n): {\n isStatic: boolean;\n value?: string | boolean | null;\n};\nexport function isStaticExpression(\n expr: t.Expression | t.JSXEmptyExpression,\n jsxStatic?: boolean\n): {\n isStatic: boolean;\n value?: string | boolean | null;\n};\n/**\n * Checks if an expression is a static expression (does not contain any variables which could change at runtime).\n * @param expr - The expression to check\n * @param jsxStatic - Whether to return JSX-compatible values (boolean, null) in addition to strings\n * @returns An object containing the result of the static check\n */\nexport function isStaticExpression(\n expr: t.Expression | t.JSXEmptyExpression,\n jsxStatic = false\n): {\n isStatic: boolean;\n value?: string | boolean | null;\n} {\n // Handle empty expressions\n if (t.isJSXEmptyExpression(expr)) {\n return { isStatic: true, value: '' };\n }\n\n // Handle direct string literals\n if (t.isStringLiteral(expr)) {\n return { isStatic: true, value: expr.value };\n }\n\n // Handle template literals without expressions\n if (t.isTemplateLiteral(expr) && expr.expressions.length === 0) {\n return {\n isStatic: true,\n value: jsxStatic ? expr.quasis[0].value.cooked : expr.quasis[0].value.raw,\n };\n }\n\n // Binary expressions are not derivable\n if (t.isBinaryExpression(expr)) {\n // Not a derivable expression\n return { isStatic: false };\n }\n\n // Handle parenthesized expressions\n if (t.isParenthesizedExpression(expr)) {\n return isStaticExpression(expr.expression, jsxStatic);\n }\n\n // Handle numeric literals by converting them to strings\n if (t.isNumericLiteral(expr)) {\n return { isStatic: true, value: String(expr.value) };\n }\n\n // Handle unary expressions by converting them to strings\n if (t.isUnaryExpression(expr)) {\n let value: string;\n let operator = '';\n if (expr.operator === '-') {\n operator = expr.operator;\n }\n if (t.isNumericLiteral(expr.argument)) {\n if (expr.argument.value === 0) {\n value = '0';\n } else {\n value = operator + expr.argument.value.toString();\n }\n } else {\n // invalid\n return { isStatic: false };\n }\n\n return { isStatic: true, value };\n }\n\n // Handle boolean literals by converting them to strings\n if (t.isBooleanLiteral(expr)) {\n return {\n isStatic: true,\n value: jsxStatic ? expr.value : String(expr.value),\n };\n }\n\n // Handle null literal\n if (t.isNullLiteral(expr)) {\n return { isStatic: true, value: jsxStatic ? null : 'null' };\n }\n\n // Not a derivable expression\n return { isStatic: false };\n}\n\n/**\n * Checks if an expression is a static value (a string, number, or template literal).\n * @param expr - The expression to check\n * @returns Whether the expression is a static value\n */\nexport function isStaticValue(\n expr: t.Expression | t.JSXEmptyExpression\n): boolean {\n if (t.isStringLiteral(expr)) {\n return true;\n }\n if (t.isNumericLiteral(expr)) {\n return true;\n }\n if (t.isTemplateLiteral(expr)) {\n return true;\n }\n return false;\n}\n\n/**\n * Checks if a string is a valid ICU message format.\n * @param string - The string to check\n * @returns Whether the string is a valid ICU message format\n */\nexport function isValidIcu(string: string): {\n isValid: boolean;\n error?: string;\n} {\n try {\n parse(string);\n } catch (error) {\n return {\n isValid: false,\n error: error instanceof Error ? error.message : String(error),\n };\n }\n return { isValid: true };\n}\n"],"mappings":";;;AAGA,MAAM,mBAAmB;;;;;;AAOzB,SAAgB,aAAa,MAAuB;AAClD,KAAI,EAAE,gBAAgB,KAAK,IAAI,EAAE,UAAU,KAA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KAAK,SAAS,MAAM,UAAU;MAInD,QAAO,EAAE,UAAU,OAAO;AAG5B,SAAO;GAAE,UAAU;GAAM;GAAO;;AAIlC,KAAI,EAAE,iBAAiB,KAAK,CAC1B,QAAO;EACL,UAAU;EACV,OAAO,YAAY,KAAK,QAAQ,OAAO,KAAK,MAAM;EACnD;AAIH,KAAI,EAAE,cAAc,KAAK,CACvB,QAAO;EAAE,UAAU;EAAM,OAAO,YAAY,OAAO;EAAQ;AAI7D,QAAO,EAAE,UAAU,OAAO;;;;;;;AAQ5B,SAAgB,cACd,MACS;AACT,KAAI,EAAE,gBAAgB,KAAK,CACzB,QAAO;AAET,KAAI,EAAE,iBAAiB,KAAK,CAC1B,QAAO;AAET,KAAI,EAAE,kBAAkB,KAAK,CAC3B,QAAO;AAET,QAAO;;;;;;;AAQT,SAAgB,WAAW,QAGzB;AACA,KAAI;AACF,QAAM,OAAO;UACN,OAAO;AACd,SAAO;GACL,SAAS;GACT,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;GAC9D;;AAEH,QAAO,EAAE,SAAS,MAAM"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gt",
3
- "version": "2.14.65",
3
+ "version": "2.14.66",
4
4
  "main": "dist/index.js",
5
5
  "bin": "bin/main.js",
6
6
  "files": [
@@ -86,7 +86,6 @@
86
86
  "@babel/traverse": "^7.25.7",
87
87
  "@babel/types": "^7.25.7",
88
88
  "@clack/prompts": "1.0.0-alpha.6",
89
- "@formatjs/icu-messageformat-parser": "^2.11.4",
90
89
  "chalk": "^5.4.1",
91
90
  "commander": "^12.1.0",
92
91
  "dotenv": "^16.4.5",
@@ -115,10 +114,11 @@
115
114
  "unified": "^11.0.5",
116
115
  "unist-util-visit": "^5.0.0",
117
116
  "yaml": "^2.8.0",
118
- "@generaltranslation/format": "0.1.2",
119
- "@generaltranslation/python-extractor": "0.2.30",
120
- "@generaltranslation/supported-locales": "2.1.10",
121
- "generaltranslation": "9.0.3",
117
+ "@generaltranslation/icu": "0.1.0",
118
+ "@generaltranslation/format": "0.1.3",
119
+ "@generaltranslation/python-extractor": "0.2.31",
120
+ "@generaltranslation/supported-locales": "2.1.11",
121
+ "generaltranslation": "9.0.4",
122
122
  "gt-remark": "1.0.11"
123
123
  },
124
124
  "devDependencies": {