<commit_before>my class CompUnit::Repository::NodeJs does CompUnit::Repository does CompUnit::Repository::Locally {
    method need(
        CompUnit::DependencySpecification $spec,
        CompUnit::PrecompilationRepository $precomp = self.precomp-repository(),
        --> CompUnit:D)
    {

        if $spec.from eq 'node.js' {
            my $module = nqp::getcomp('JavaScript').eval(
              'return function(name, prefix) {return require(require.resolve(name, {paths: [prefix]}))}'
            )($spec.short-name, $.prefix.Str);


            my $stash = Stash.new();

            my sub export {
                Map.new($spec.short-name, $module);
            }

            my $handle = (CompUnit::Handle.from-unit($stash) does my role :: {
                has &!EXPORT;
                submethod with-export(&EXPORT) {
                    &!EXPORT := &EXPORT;
                    self<commit_msg>[js] Use ops for requring node.js modules<commit_after>my class CompUnit::Repository::NodeJs does CompUnit::Repository does CompUnit::Repository::Locally {
    method need(
        CompUnit::DependencySpecification $spec,
        CompUnit::PrecompilationRepository $precomp = self.precomp-repository(),
        --> CompUnit:D)
    {

        if $spec.from eq 'node.js' {
            my $module = $*W && $*W.is_precompilation_mode()
              ?? nqp::jscompiletimerequire($spec.short-name, $.prefix.Str)
              !! nqp::jsruntimerequire($spec.short-name, $.prefix.Str);

            my $stash = Stash.new();

            my sub export {
                Map.new($spec.short-name, $module);
            }

            my $handle = (CompUnit::Handle.from-unit($stash) does my role :: {
                has &!EXPORT;
                submethod with-export(&EXPORT) {
                    &!EXPORT := &EXPORT;
                    self
{'fraction_non_alphanumeric': 0.13427179209528967, 'fraction_numerical': 0.0, 'mean_word_length': 1.9951377633711507, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '810713', 'n_tokens_mistral': 532, 'n_tokens_neox': 498, 'n_words': 105}