Skip to content
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

feat: add ext/node for require support #15362

Merged
merged 21 commits into from
Aug 9, 2022
Merged

Conversation

bartlomieju
Copy link
Member

@bartlomieju bartlomieju commented Jul 31, 2022

This commit adds "ext/node" extension that implementes CommonJS module system.

In the future this extension might be extended to actually contain implementation of
Node compatibility layer in favor of "deno_std/node".

Currently this functionality is not publicly exposed, it is available via "Deno[Deno.internal].require"
namespace and is meant to be used by other functionality to be landed soon.

This is a minimal first pass, things that still don't work:

  • support for dynamic imports in CJS
  • conditional exports

cli/compat/mod.rs Outdated Show resolved Hide resolved
cli/main.rs Outdated Show resolved Hide resolved
cli/tools/bench.rs Outdated Show resolved Hide resolved
cli/tools/test.rs Outdated Show resolved Hide resolved
ext/node/Cargo.toml Outdated Show resolved Hide resolved
ext/node/lib.rs Show resolved Hide resolved
require_test/example.js Outdated Show resolved Hide resolved
@bartlomieju bartlomieju changed the title [WIP] add ext/node for require support feat: add ext/node for require support Aug 9, 2022
Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

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

LGTM!

@bartlomieju bartlomieju merged commit 1f54d87 into denoland:main Aug 9, 2022
@bartlomieju bartlomieju deleted the ext_node branch August 9, 2022 19:06
}

#[op]
fn op_require_read_file(filename: String) -> Result<String, AnyError> {
Copy link
Member

Choose a reason for hiding this comment

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

Missing permission checks. Will open a PR to fix.

bartlomieju added a commit to littledivy/deno that referenced this pull request Aug 11, 2022
This commit adds "ext/node" extension that implementes CommonJS module system.

In the future this extension might be extended to actually contain implementation of
Node compatibility layer in favor of "deno_std/node".

Currently this functionality is not publicly exposed, it is available via "Deno[Deno.internal].require"
namespace and is meant to be used by other functionality to be landed soon.

This is a minimal first pass, things that still don't work:

support for dynamic imports in CJS
conditional exports
dsherret pushed a commit that referenced this pull request Aug 11, 2022
This commit adds "ext/node" extension that implementes CommonJS module system.

In the future this extension might be extended to actually contain implementation of
Node compatibility layer in favor of "deno_std/node".

Currently this functionality is not publicly exposed, it is available via "Deno[Deno.internal].require"
namespace and is meant to be used by other functionality to be landed soon.

This is a minimal first pass, things that still don't work:

support for dynamic imports in CJS
conditional exports
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.

None yet

2 participants