Skip to content

Publishing a package with a stable with { type: "text" } import fails server-side: registry analysis builds its graph with unstable_text_imports: false #1478

Description

@rickylabs

Summary

Publishing any package that uses a runtime-stable text import (with { type: "text" }, stabilized in Deno 2.8 via denoland/deno#34238) fails during registry-side processing with:

failed to build module graph: The import attribute type of "text" is unsupported.
  Specifier: file:///README.md
    at file:///cli.ts:18:27

deno publish --dry-run accepts the exact same package — the rejection only surfaces on the real authenticated publish, which makes it invisible to every local/CI preflight.

Originally filed against Deno as denoland/deno#35546. After tracing both codebases, the Deno CLI is not at fault: since denoland/deno#34692 the client-side publish path (graph build, diagnostics, tarball) permits stable text imports, and dry-run vs. real publish share an identical client pipeline (dry-run simply stops before upload). The error string originates in deno_graph's asset-load gate, raised from this repository's publishing-task analyzer, which builds its own module graph with text imports disabled.

Root cause (in this repo)

Pipeline: POST /scopes/.../versions/...process_publishing_task (api/src/publish.rs:188) → process_tarball (api/src/tarball.rs:102) → analyze_package (api/src/tarball.rs:340api/src/analysis.rs:79).

analyze_package_inner builds a fresh deno_graph::ModuleGraph over the uploaded tarball with:

unstable_bytes_imports: false,
unstable_text_imports: false,   // api/src/analysis.rs:167  ← rejects stable text imports
unstable_css_imports: false,

deno_graph then classifies the import as an asset load and graph.valid() surfaces UnsupportedImportAttributeType (deno_graph src/graph.rs:3040 / :5545), which api/src/tarball.rs:643 wraps into the publish error.

A second identical omission exists in the npm-tarball rebuild path (rebuild_npm_tarball_inner, api/src/analysis.rs:566-609, flags at :602-605).

Reproduction

Any minimal package with import text from "./asset.txt" with { type: "text" }: deno publish --dry-run → success; real publish → the error above. Hit in production publishing @netscript/mcp@0.0.1-beta.10 on 2026-07-17 (Deno 2.9.0); internal tracking: rickylabs/netscript#810.

Notes

  • Bytes imports remain unstable in Deno, so keeping unstable_bytes_imports: false is presumably still correct — this report is about text imports only.
  • One policy consideration for maintainers: JSR's npm compatibility layer does not rewrite with { type: "text" } for Node consumers, so you may want to sequence npm-tarball handling (e.g. inlining) with the flag flip. A proposed minimal fix follows in a comment.

Cross-references: denoland/deno#35546 (original report, can be closed/transferred in favor of this one), denoland/deno#34238 (stabilization), denoland/deno#34692 (client-side publish fix), rickylabs/netscript#810 (production impact).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Needs Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions