diff --git a/package-lock.json b/package-lock.json index 59fcbd9..abf0382 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,20 +12,14 @@ "dependencies": { "@babel/core": "^7.29.0", "@babel/generator": "^7.29.1", - "@babel/plugin-proposal-class-properties": "^7.18.6", "@babel/plugin-proposal-decorators": "^7.29.0", "@babel/plugin-proposal-export-default-from": "^7.27.1", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6", - "@babel/plugin-proposal-object-rest-spread": "^7.20.7", - "@babel/plugin-proposal-optional-chaining": "^7.21.0", - "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/preset-env": "^7.29.5", "@babel/preset-flow": "^7.27.1", "@babel/preset-react": "^7.28.5", "@babel/preset-typescript": "^7.28.5", "@babel/template": "^7.28.6", "babel-plugin-ttag": "1.8.16", - "babel-preset-const-enum": "^1.0.0", "chalk": "^2.4.2", "cross-spawn": "^7.0.6", "estree-walker": "^2.0.1", @@ -516,23 +510,6 @@ "@babel/core": "^7.0.0" } }, - "node_modules/@babel/plugin-proposal-class-properties": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.18.6.tgz", - "integrity": "sha512-cumfXOF0+nzZrrN8Rf0t7M+tF6sZc7vhQwYQck9q1/5w2OExlD+b4v4RpMJFaV1Z7WcDRgO6FqvxqxGlwo+RHQ==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.", - "license": "MIT", - "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, "node_modules/@babel/plugin-proposal-decorators": { "version": "7.29.0", "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.29.0.tgz", @@ -565,61 +542,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-nullish-coalescing-operator": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.18.6.tgz", - "integrity": "sha512-wQxQzxYeJqHcfppzBDnm1yAY0jSRkUXR2z8RePZYrKwMKgMlE8+Z6LUno+bd6LvbGh8Gltvy74+9pIYkr+XkKA==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.", - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-object-rest-spread": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.20.7.tgz", - "integrity": "sha512-d2S98yCiLxDVmBmE8UjGcfPvNEUbA1U5q5WxaWFUGRzJSVAZqm5W6MbPct0jxnegUZ0niLeNX+IOzEs7wYg9Dg==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-object-rest-spread instead.", - "license": "MIT", - "dependencies": { - "@babel/compat-data": "^7.20.5", - "@babel/helper-compilation-targets": "^7.20.7", - "@babel/helper-plugin-utils": "^7.20.2", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-transform-parameters": "^7.20.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-optional-chaining": { - "version": "7.21.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.21.0.tgz", - "integrity": "sha512-p4zeefM72gpmEe2fkUr/OnOXpWEf8nAgk7ZYVqqfFiyIG7oFfVZcCrU64hWn5xp4tQ9LkV4bTIa5rD0KANpKNA==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.", - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.20.2", - "@babel/helper-skip-transparent-expression-wrappers": "^7.20.0", - "@babel/plugin-syntax-optional-chaining": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, "node_modules/@babel/plugin-proposal-private-property-in-object": { "version": "7.21.0-placeholder-for-preset-env.2", "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz", @@ -698,18 +620,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-dynamic-import": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz", - "integrity": "sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==", - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, "node_modules/@babel/plugin-syntax-flow": { "version": "7.28.6", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.28.6.tgz", @@ -805,6 +715,7 @@ "version": "7.8.3", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "dev": true, "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" } @@ -822,6 +733,7 @@ "version": "7.8.3", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" @@ -843,6 +755,7 @@ "version": "7.8.3", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" @@ -4315,18 +4228,6 @@ "node": ">=8" } }, - "node_modules/babel-plugin-const-enum": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/babel-plugin-const-enum/-/babel-plugin-const-enum-1.0.1.tgz", - "integrity": "sha512-6oGu63g1FS9psUPQyLCJM08ty6kGihGKTbzWGbAKHfUuCzCh7y9twh516cR6v0lM4d4NOoR+DgLb7uKVytyp6Q==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-typescript": "^7.3.3" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, "node_modules/babel-plugin-istanbul": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-7.0.1.tgz", @@ -4374,49 +4275,6 @@ "@types/babel__traverse": "*" } }, - "node_modules/babel-plugin-macros": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-3.1.0.tgz", - "integrity": "sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg==", - "optional": true, - "peer": true, - "dependencies": { - "@babel/runtime": "^7.12.5", - "cosmiconfig": "^7.0.0", - "resolve": "^1.19.0" - }, - "engines": { - "node": ">=10", - "npm": ">=6" - } - }, - "node_modules/babel-plugin-macros/node_modules/cosmiconfig": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", - "integrity": "sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==", - "optional": true, - "peer": true, - "dependencies": { - "@types/parse-json": "^4.0.0", - "import-fresh": "^3.2.1", - "parse-json": "^5.0.0", - "path-type": "^4.0.0", - "yaml": "^1.10.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/babel-plugin-macros/node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "optional": true, - "peer": true, - "engines": { - "node": ">=8" - } - }, "node_modules/babel-plugin-polyfill-corejs2": { "version": "0.4.17", "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.17.tgz", @@ -4526,18 +4384,6 @@ "node": ">=8" } }, - "node_modules/babel-preset-const-enum": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/babel-preset-const-enum/-/babel-preset-const-enum-1.0.0.tgz", - "integrity": "sha512-DHfcv3mkgIqPaFODzig3Esb91cCqZlnImSl7VAwJDtIsqJvx4H08kpl051um68gjqnAXg5up5nnn6NK+Cq0blA==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "babel-plugin-const-enum": "^1.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, "node_modules/babel-preset-current-node-syntax": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.2.0.tgz", @@ -11497,15 +11343,6 @@ "@babel/traverse": "^7.28.6" } }, - "@babel/plugin-proposal-class-properties": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.18.6.tgz", - "integrity": "sha512-cumfXOF0+nzZrrN8Rf0t7M+tF6sZc7vhQwYQck9q1/5w2OExlD+b4v4RpMJFaV1Z7WcDRgO6FqvxqxGlwo+RHQ==", - "requires": { - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - } - }, "@babel/plugin-proposal-decorators": { "version": "7.29.0", "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.29.0.tgz", @@ -11524,37 +11361,6 @@ "@babel/helper-plugin-utils": "^7.27.1" } }, - "@babel/plugin-proposal-nullish-coalescing-operator": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.18.6.tgz", - "integrity": "sha512-wQxQzxYeJqHcfppzBDnm1yAY0jSRkUXR2z8RePZYrKwMKgMlE8+Z6LUno+bd6LvbGh8Gltvy74+9pIYkr+XkKA==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" - } - }, - "@babel/plugin-proposal-object-rest-spread": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.20.7.tgz", - "integrity": "sha512-d2S98yCiLxDVmBmE8UjGcfPvNEUbA1U5q5WxaWFUGRzJSVAZqm5W6MbPct0jxnegUZ0niLeNX+IOzEs7wYg9Dg==", - "requires": { - "@babel/compat-data": "^7.20.5", - "@babel/helper-compilation-targets": "^7.20.7", - "@babel/helper-plugin-utils": "^7.20.2", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-transform-parameters": "^7.20.7" - } - }, - "@babel/plugin-proposal-optional-chaining": { - "version": "7.21.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.21.0.tgz", - "integrity": "sha512-p4zeefM72gpmEe2fkUr/OnOXpWEf8nAgk7ZYVqqfFiyIG7oFfVZcCrU64hWn5xp4tQ9LkV4bTIa5rD0KANpKNA==", - "requires": { - "@babel/helper-plugin-utils": "^7.20.2", - "@babel/helper-skip-transparent-expression-wrappers": "^7.20.0", - "@babel/plugin-syntax-optional-chaining": "^7.8.3" - } - }, "@babel/plugin-proposal-private-property-in-object": { "version": "7.21.0-placeholder-for-preset-env.2", "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz", @@ -11605,14 +11411,6 @@ "@babel/helper-plugin-utils": "^7.28.6" } }, - "@babel/plugin-syntax-dynamic-import": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz", - "integrity": "sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==", - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, "@babel/plugin-syntax-flow": { "version": "7.28.6", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.28.6.tgz", @@ -11676,6 +11474,7 @@ "version": "7.8.3", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.8.0" } @@ -11693,6 +11492,7 @@ "version": "7.8.3", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.8.0" } @@ -11710,6 +11510,7 @@ "version": "7.8.3", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.8.0" } @@ -14059,15 +13860,6 @@ } } }, - "babel-plugin-const-enum": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/babel-plugin-const-enum/-/babel-plugin-const-enum-1.0.1.tgz", - "integrity": "sha512-6oGu63g1FS9psUPQyLCJM08ty6kGihGKTbzWGbAKHfUuCzCh7y9twh516cR6v0lM4d4NOoR+DgLb7uKVytyp6Q==", - "requires": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-typescript": "^7.3.3" - } - }, "babel-plugin-istanbul": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-7.0.1.tgz", @@ -14105,41 +13897,6 @@ } } }, - "babel-plugin-macros": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-3.1.0.tgz", - "integrity": "sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg==", - "optional": true, - "peer": true, - "requires": { - "@babel/runtime": "^7.29.1", - "cosmiconfig": "^7.0.0", - "resolve": "^1.19.0" - }, - "dependencies": { - "cosmiconfig": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", - "integrity": "sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==", - "optional": true, - "peer": true, - "requires": { - "@types/parse-json": "^4.0.0", - "import-fresh": "^3.2.1", - "parse-json": "^5.0.0", - "path-type": "^4.0.0", - "yaml": "^1.10.3" - } - }, - "path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "optional": true, - "peer": true - } - } - }, "babel-plugin-polyfill-corejs2": { "version": "0.4.17", "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.17.tgz", @@ -14226,15 +13983,6 @@ } } }, - "babel-preset-const-enum": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/babel-preset-const-enum/-/babel-preset-const-enum-1.0.0.tgz", - "integrity": "sha512-DHfcv3mkgIqPaFODzig3Esb91cCqZlnImSl7VAwJDtIsqJvx4H08kpl051um68gjqnAXg5up5nnn6NK+Cq0blA==", - "requires": { - "@babel/helper-plugin-utils": "^7.0.0", - "babel-plugin-const-enum": "^1.0.0" - } - }, "babel-preset-current-node-syntax": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.2.0.tgz", diff --git a/package.json b/package.json index a338fe8..13c08e1 100644 --- a/package.json +++ b/package.json @@ -59,20 +59,14 @@ "dependencies": { "@babel/core": "^7.29.0", "@babel/generator": "^7.29.1", - "@babel/plugin-proposal-class-properties": "^7.18.6", "@babel/plugin-proposal-decorators": "^7.29.0", "@babel/plugin-proposal-export-default-from": "^7.27.1", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6", - "@babel/plugin-proposal-object-rest-spread": "^7.20.7", - "@babel/plugin-proposal-optional-chaining": "^7.21.0", - "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/preset-env": "^7.29.5", "@babel/preset-flow": "^7.27.1", "@babel/preset-react": "^7.28.5", "@babel/preset-typescript": "^7.28.5", "@babel/template": "^7.28.6", "babel-plugin-ttag": "1.8.16", - "babel-preset-const-enum": "^1.0.0", "chalk": "^2.4.2", "cross-spawn": "^7.0.6", "estree-walker": "^2.0.1", diff --git a/src/declarations.ts b/src/declarations.ts index 4da2604..a37161a 100644 --- a/src/declarations.ts +++ b/src/declarations.ts @@ -6,16 +6,10 @@ declare module "gettext-parser/lib/shared"; declare module "babel-plugin-ttag"; declare module "@babel/preset-react"; declare module "@babel/preset-env"; -declare module "@babel/plugin-proposal-class-properties"; -declare module "@babel/plugin-proposal-object-rest-spread"; declare module "@babel/plugin-proposal-export-default-from"; -declare module "@babel/plugin-syntax-dynamic-import"; declare module "@babel/plugin-proposal-decorators"; declare module "@babel/preset-typescript"; declare module "@babel/preset-flow"; -declare module "@babel/plugin-proposal-optional-chaining"; -declare module "@babel/plugin-proposal-nullish-coalescing-operator"; -declare module "babel-preset-const-enum"; declare module "magic-string" { export type SourceMap = any; } diff --git a/src/defaults.ts b/src/defaults.ts index 536ccfd..6cc98e6 100644 --- a/src/defaults.ts +++ b/src/defaults.ts @@ -8,32 +8,20 @@ import { TransformOptions, ConfigItem } from "@babel/core"; import * as ttagTypes from "./types"; // plugins -import * as classPropPlugin from "@babel/plugin-proposal-class-properties"; -import * as restSpreadPlugin from "@babel/plugin-proposal-object-rest-spread"; import * as exportDefaultFromPlugin from "@babel/plugin-proposal-export-default-from"; import * as babelTtagPlugin from "babel-plugin-ttag"; -import * as babelDynamicImportPlugin from "@babel/plugin-syntax-dynamic-import"; import * as babelPluginDecorators from "@babel/plugin-proposal-decorators"; -import * as optionalChaningPlugin from "@babel/plugin-proposal-optional-chaining"; -import * as nullishCoalescingOperatorPlugin from "@babel/plugin-proposal-nullish-coalescing-operator"; -import * as presetConstEnumTS from "babel-preset-const-enum"; export const defaultPlugins: ConfigItem[] = [ [babelPluginDecorators, { legacy: true }], - [classPropPlugin, { loose: true }], - restSpreadPlugin, exportDefaultFromPlugin, - babelDynamicImportPlugin, - optionalChaningPlugin, - nullishCoalescingOperatorPlugin ]; export const defaultPresets: ConfigItem[] = [ - presetTS, - presetConstEnumTS, presetFlow, [presetEnv, { loose: true, targets: "node 6.5" }], - presetReact + presetReact, + [presetTS, { allowDeclareFields: true }], ]; export function makeBabelConf(ttagOpts: ttagTypes.TtagOpts, cliOpts: ttagTypes.CliOpts ): TransformOptions { diff --git a/tests/commands/__snapshots__/test_extract.ts.snap b/tests/commands/__snapshots__/test_extract.ts.snap index 073d973..aa3cd5b 100644 --- a/tests/commands/__snapshots__/test_extract.ts.snap +++ b/tests/commands/__snapshots__/test_extract.ts.snap @@ -144,6 +144,18 @@ msgstr \\"\\" " `; +exports[`extract from ts with declare 1`] = ` +"msgid \\"\\" +msgstr \\"\\" +\\"Content-Type: text/plain; charset=utf-8\\\\n\\" +\\"Plural-Forms: nplurals=2; plural=(n!=1);\\\\n\\" + +#: tests/fixtures/tsDeclare.ts:23 +msgid \\"hi from a module with typescript declare\\" +msgstr \\"\\" +" +`; + exports[`extract from tsx 1`] = ` "msgid \\"\\" msgstr \\"\\" diff --git a/tests/commands/test_extract.ts b/tests/commands/test_extract.ts index 2376050..4af1828 100644 --- a/tests/commands/test_extract.ts +++ b/tests/commands/test_extract.ts @@ -21,6 +21,7 @@ const globalFn = path.resolve(__dirname, "../fixtures/globalFunc.js"); const tsPath = path.resolve(__dirname, "../fixtures/tSParse.ts"); const tsChaning = path.resolve(__dirname, "../fixtures/tsOptionalChaning.ts"); const tsConstEnum = path.resolve(__dirname, "../fixtures/tsConstEnum.ts"); +const tsDeclare = path.resolve(__dirname, "../fixtures/tsDeclare.ts"); const tsCoalescing = path.resolve( __dirname, "../fixtures/tsNullishCoalescing.ts" @@ -132,3 +133,9 @@ test("extract from ts with const enum", () => { const result = fs.readFileSync(potPath).toString(); expect(result).toMatchSnapshot(); }); + +test("extract from ts with declare", () => { + execSync(`ts-node src/index.ts extract -o ${potPath} ${tsDeclare}`); + const result = fs.readFileSync(potPath).toString(); + expect(result).toMatchSnapshot(); +}); diff --git a/tests/fixtures/tsDeclare.ts b/tests/fixtures/tsDeclare.ts new file mode 100644 index 0000000..829bfa4 --- /dev/null +++ b/tests/fixtures/tsDeclare.ts @@ -0,0 +1,23 @@ +import { t } from "ttag"; + +declare namespace MyNamespace { + function namespaceFunction(): void; +} + +declare function myFunction(): void; +declare const myConst: number; +declare const myLet: number; + +class MyClass { + declare myClassField: void; +} + +declare class MyClassDeclaration { + method(): void; +} + +declare module "hi" { + +} + +const x = t`hi from a module with typescript declare`