Skip to content

Commit

Permalink
feat: enable importAttributes and explicitResourceManagement for extr…
Browse files Browse the repository at this point in the history
…actor

feat: bump minimal @babel/parser version
  • Loading branch information
timofei-iatsenko committed Oct 4, 2024
1 parent 6b77971 commit 98b6ec7
Show file tree
Hide file tree
Showing 6 changed files with 271 additions and 1,499 deletions.
2 changes: 1 addition & 1 deletion packages/babel-plugin-extract-messages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
},
"devDependencies": {
"@babel/core": "^7.21.0",
"@babel/traverse": "7.20.12",
"@babel/traverse": "^7.20.12",
"@babel/types": "^7.20.7",
"@lingui/jest-mocks": "*",
"unbuild": "2.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"dependencies": {
"@babel/core": "^7.21.0",
"@babel/generator": "^7.21.1",
"@babel/parser": "^7.21.2",
"@babel/parser": "^7.22.0",
"@babel/runtime": "^7.21.0",
"@babel/types": "^7.21.2",
"@lingui/babel-plugin-extract-messages": "4.11.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/api/__snapshots__/compile.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exports[`createCompiledCatalog options.namespace should compile with global 1`]

exports[`createCompiledCatalog options.namespace should compile with json 1`] = `{"messages":{"key":["Hello ",["name"]]}}`;

exports[`createCompiledCatalog options.namespace should compile with ts 1`] = `/*eslint-disable*/import type{Messages}from"@lingui/core";export const messages=(JSON.parse("{\\"key\\":[\\"Hello \\",[\\"name\\"]]}")as Messages);`;
exports[`createCompiledCatalog options.namespace should compile with ts 1`] = `/*eslint-disable*/import type{Messages}from"@lingui/core";export const messages=JSON.parse("{\\"key\\":[\\"Hello \\",[\\"name\\"]]}")as Messages;`;

exports[`createCompiledCatalog options.namespace should compile with window 1`] = `/*eslint-disable*/window.test={messages:JSON.parse("{\\"key\\":[\\"Hello \\",[\\"name\\"]]}")};`;

Expand Down
5 changes: 4 additions & 1 deletion packages/cli/src/api/extractors/babel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,10 @@ const extractor: ExtractorType = {
const parserOptions = ctx.linguiConfig.extractorParserOptions

// https://babeljs.io/docs/en/babel-parser#latest-ecmascript-features
const parserPlugins: ParserPlugin[] = []
const parserPlugins: ParserPlugin[] = [
"importAttributes", // stage3
"explicitResourceManagement", // stage3,
]

if (
[/\.ts$/, /\.mts$/, /\.cts$/, /\.tsx$/].some((r) => filename.match(r))
Expand Down
6 changes: 3 additions & 3 deletions packages/macro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@
"babel-plugin-macros": "2 || 3"
},
"devDependencies": {
"@babel/core": "7.20.12",
"@babel/parser": "7.20.15",
"@babel/traverse": "7.20.12",
"@babel/core": "^7.20.12",
"@babel/parser": "^7.20.15",
"@babel/traverse": "^7.20.12",
"@types/babel-plugin-macros": "^2.8.5",
"prettier": "2.8.3",
"tsd": "^0.26.1",
Expand Down
Loading

0 comments on commit 98b6ec7

Please sign in to comment.