Support import defer #47

Closed
opened 2025-09-03 09:38:40 +02:00 by SirPepe · 8 comments
SirPepe commented 2025-09-03 09:38:40 +02:00 (Migrated from github.com)

This exists as of TS 5.9 and is a Stage 3 proposal:

import defer * as feature from "./some-feature.js";

Current result:

Script(ImportDeclaration(import,VariableDefinition,⚠),ExpressionStatement(VariableName,⚠),ExpressionStatement(VariableName,⚠),ExpressionStatement(VariableName,⚠),ExpressionStatement(String,";"))
This exists as of [TS 5.9](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-9.html) and is a [Stage 3 proposal](https://github.com/tc39/proposal-defer-import-eval/): ```typescript import defer * as feature from "./some-feature.js"; ``` Current result: ``` Script(ImportDeclaration(import,VariableDefinition,⚠),ExpressionStatement(VariableName,⚠),ExpressionStatement(VariableName,⚠),ExpressionStatement(VariableName,⚠),ExpressionStatement(String,";")) ```
marijnh commented 2025-09-03 11:41:19 +02:00 (Migrated from github.com)

Attached patch adds this.

Attached patch adds this.
SirPepe commented 2025-09-03 11:50:33 +02:00 (Migrated from github.com)

Great, thank you! This is (for once) all I have for today, you can cut a release if you like 🙃

Great, thank you! This is (for once) all I have for today, you can cut a release if you like 🙃
marijnh commented 2025-09-04 11:23:22 +02:00 (Migrated from github.com)

I've tagged a version 1.5.2

I've tagged a version 1.5.2
bmeurer commented 2025-09-09 10:47:13 +02:00 (Migrated from github.com)

@marijnh I think you also need to add defer to src/highlight.js, as it's not styled as keyword with your patch.

@marijnh I think you also need to add `defer` to `src/highlight.js`, as it's not styled as keyword with your patch.
marijnh commented 2025-09-09 11:41:45 +02:00 (Migrated from github.com)

Thanks for pointing that out. Attached patch fixes that.

Thanks for pointing that out. Attached patch fixes that.
bmeurer commented 2025-09-09 12:25:19 +02:00 (Migrated from github.com)

Can you tag a new version with the fix please?

Can you tag a new version with the fix please?
marijnh commented 2025-09-09 12:37:05 +02:00 (Migrated from github.com)

Of course. See 1.5.3

Of course. See 1.5.3
bmeurer commented 2025-09-09 12:54:48 +02:00 (Migrated from github.com)

Awesome, thanks!

Awesome, thanks!
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lezer/javascript#47
No description provided.