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

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

Open
ArtskydJ opened this issue Jul 11, 2022 · 0 comments
Open

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

ArtskydJ opened this issue Jul 11, 2022 · 0 comments

Comments

@ArtskydJ
Copy link
Contributor

ArtskydJ commented Jul 11, 2022

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.

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

No branches or pull requests

1 participant