1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-27 01:29:14 -05:00
denoland-deno/cli/compat
Bartek Iwańczuk a65ce33fab
feat(compat): CJS/ESM interoperability (#13553)
This commit adds CJS/ESM interoperability when running in --compat mode.

Before executing files, they are analyzed and all CommonJS modules are
transformed on the fly to a ES modules. This is done by utilizing analyze_cjs()
functionality from deno_ast. After discovering exports and reexports, an ES
module is rendered and saved in memory for later use.

There's a caveat that all files ending with ".js" extension are considered as
CommonJS modules (unless there's a related "package.json" with "type": "module").
2022-02-27 14:38:45 +01:00
..
testdata fix(compat): ESM resolver for package subpath (#13599) 2022-02-07 00:02:52 +01:00
errors.rs chore: update copyright to 2022 (#13306) 2022-01-07 22:09:52 -05:00
esm_resolver.rs chore: upgrade to Rust 1.59 (#13767) 2022-02-24 20:03:12 -05:00
mod.rs feat(compat): CJS/ESM interoperability (#13553) 2022-02-27 14:38:45 +01:00