Skip to content

feat: stabilize text imports#34238

Merged
bartlomieju merged 2 commits into
denoland:mainfrom
crowlKats:unflag-text-imports
May 20, 2026
Merged

feat: stabilize text imports#34238
bartlomieju merged 2 commits into
denoland:mainfrom
crowlKats:unflag-text-imports

Conversation

@crowlKats

@crowlKats crowlKats commented May 19, 2026

Copy link
Copy Markdown
Member

This stabilizes text imports, so that:

import hello from "./hello.txt" with { type: "text" };

will not require the --unstable-raw-imports flag.

This is as the tc39 proposal is stage 3, and the html spec changes required are already landed.

Comment thread cli/graph_util.rs
locker: locker.as_mut().map(|l| l as _),
unstable_bytes_imports: self.cli_options.unstable_raw_imports(),
unstable_text_imports: self.cli_options.unstable_raw_imports(),
unstable_text_imports: true,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you open a PR to deno_graph yo remove this setting?

@bartlomieju bartlomieju left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe update some tests to not use the flag?

@fibibot fibibot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a direct regression test for the stabilized behavior. The PR updates the missing-unstable dynamic case from text to bytes, which preserves the negative coverage for bytes, but I don't see a positive spec that runs with { type: "text" } without --unstable-raw-imports. Most existing text import specs still opt into raw-imports, so CI can pass without proving the stable path works for static and/or dynamic text imports.

Please update one of the existing text-import specs to drop the unstable flag, or add a focused spec that imports text without --unstable-raw-imports.

- Add tests/specs/run/bytes_and_text_imports/stable_text spec that
  exercises static and dynamic text imports without
  --unstable-raw-imports, proving the stabilized path works.
- cli/tools/doc.rs: set unstable_text_imports to true for the builtin
  types graph for consistency with cli/graph_util.rs.
@crowlbot

Copy link
Copy Markdown
Contributor

Pushed a fix addressing the review:

  • Added tests/specs/run/bytes_and_text_imports/stable_text — a focused spec that exercises both static and dynamic with { type: "text" } imports without --unstable-raw-imports (no unstable entry in any deno.json), proving the stable path.
  • Drive-by: cli/tools/doc.rs was still setting unstable_text_imports: false for the builtin-types graph. Flipped to true to match the change in cli/graph_util.rs.

@crowlKats
crowlKats requested a review from bartlomieju May 20, 2026 00:08
@bartlomieju
bartlomieju merged commit 4799e13 into denoland:main May 20, 2026
136 checks passed
crowlKats added a commit to crowlKats/deno that referenced this pull request Jun 2, 2026
Text imports were stabilized in denoland#34238, but `deno publish` still
rejected `with { type: "text" }` imports as `unstable-raw-import`
because the publish diagnostic flagged any asset import (both text and
bytes). Only bytes imports remain unstable, so the diagnostic now only
flags `type: "bytes"` imports.

Closes denoland#34389
littledivy pushed a commit to crowlKats/deno that referenced this pull request Jun 10, 2026
This stabilizes `text` imports, so that:
```ts
import hello from "./hello.txt" with { type: "text" };
```
will not require the `--unstable-raw-imports` flag.

This is as the tc39 proposal is stage 3, and the html spec changes
required are already landed.

---------

Co-authored-by: crowlbot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants