Skip to content

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

Merged
dsherret merged 5 commits intodenoland:mainfrom
dsherret:fix_deno_ast_0_46_3
Apr 15, 2025
Merged

fix: better cjs vs esm module detection and upgrade swc#28810
dsherret merged 5 commits intodenoland:mainfrom
dsherret:fix_deno_ast_0_46_3

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
@dsherret dsherret deleted the fix_deno_ast_0_46_3 branch April 24, 2025 18:49
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