Skip to content

fix: better cjs vs esm module detection and upgrade swc #28810

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

Merged
merged 5 commits into from
Apr 15, 2025

Conversation

Copy link
Contributor

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

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

LGTM

@dsherret
Copy link
Member Author

dsherret commented Apr 8, 2025

Looks like there is an swc bug: swc-project/swc#10329

@dsherret dsherret changed the title fix: better cjs vs esm module detection and ensure top level usings have correct scope fix: better cjs vs esm module detection and use v8 for explicit resource management in typescript files Apr 8, 2025
@dsherret
Copy link
Member Author

dsherret commented Apr 8, 2025

Fixed by now using v8 to do explicit resource management:

% cat asdf.ts
using _ = {
  [Symbol.dispose]: () => {
    console.log("disposed");
  },
};
function a() {
  console.log("test");
}
export function b() {
  a();
}
b();
% deno asdf.ts
disposed
error: Uncaught (in promise) ReferenceError: a is not defined
  a();
  ^
    at b (file:///Users/david/dev/deno/asdf.ts:10:3)
    at file:///Users/david/dev/deno/asdf.ts:12:1
% ./target/debug/deno asdf.ts
test
disposed

@dsherret
Copy link
Member Author

dsherret commented Apr 9, 2025

We ran into this bug https://issues.chromium.org/issues/409478039

@dsherret dsherret changed the title fix: better cjs vs esm module detection and use v8 for explicit resource management in typescript files fix: better cjs vs esm module detection and upgrade swc Apr 15, 2025
@dsherret dsherret enabled auto-merge (squash) April 15, 2025 16:37
@dsherret dsherret merged commit 6a3db6c into denoland:main Apr 15, 2025
18 checks passed
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.

Top-level using hides local symbols Consider .js file with top level await as esm?
3 participants