fix(node): support re-exported esm modules in cjs export analysis (#28379)

Adds support for re-exporting an ES module from a CJS one and then
importing the CJS module from ESM. Also fixes a bug where require esm
wasn't working in deno compile.
This commit is contained in:
David Sherret 2025-03-05 16:37:46 -05:00 committed by GitHub
parent 0c0757fe66
commit 2292eb1c92
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 366 additions and 166 deletions

View file

@ -9,7 +9,6 @@ use deno_runtime::deno_permissions::PermissionsOptions;
use deno_runtime::deno_telemetry::OtelConfig;
use deno_semver::Version;
use indexmap::IndexMap;
use node_resolver::analyze::CjsAnalysisExports;
use serde::Deserialize;
use serde::Serialize;
use url::Url;
@ -130,7 +129,8 @@ impl<'a> DenoRtDeserializable<'a> for SpecifierId {
#[derive(Deserialize, Serialize)]
pub enum CjsExportAnalysisEntry {
Esm,
Cjs(CjsAnalysisExports),
Cjs(Vec<String>),
Error(String),
}
const HAS_TRANSPILED_FLAG: u8 = 1 << 0;