Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable importAttributes and explicitResourceManagement for extractor #2009

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading