Skip to content

"node:"-prefixed URLs are not supported #96

Description

@ArtskydJ

Node.js allows for imports like this:

import test from 'node:test';

const { createHmac } = await import('node:crypto');

const EventEmitter = require('node:events');

const fs = require('node:fs');

For some builtin modules, it's the required syntax:

This module is only available under the node: scheme. The following will not work:

import test from 'test';

HyperClick doesn't recognize node modules starting with "node:".


I've worked around this issue using these HyperClick settings:

// ...
            "regexes": [
                "^import\\s+['\"](.+)['\"];?$",
                ".*from\\s+['\"](?:node:)?(.+)['\"];?$",
                ".*require\\(['\"`](.+?)['\"`]\\).*",
                ".*import\\((?:\\/\\*.+?\\*\\/\\s+)?['\"`](?:node:)?(.+)['\"`]\\)(?:[;\\.,])?"
            ],
// ...

However, I don't think that the regex is the correct place to parse out the "node:" prefix.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions