Skip to content

Conversation

@karlseguin
Copy link
Contributor

support for ES2020 arbitrary module namespace identifier names, which allows using string literals as export/import names.

Examples:

export { foo as "string-name" }
import { "string-name" as foo }
export * as "string-name" from "./mod.js"

See https://tc39.es/ecma262/#prod-ModuleExportName

support for ES2020 arbitrary module namespace identifier names, which allows
using string literals as export/import names.

Examples:

```js
export { foo as "string-name" }
import { "string-name" as foo }
export * as "string-name" from "./mod.js"
```
@saghul
Copy link
Contributor

saghul commented Oct 12, 2025

Nice! Do you know if test262 covers this? Great that you added a test btw!

@karlseguin
Copy link
Contributor Author

Yes, I believe they're all under the arbitrary-module-namespace-names feature, which is being skipepd (if I'm following correctly). This PR doesn't make them all pass, just some.

@saghul
Copy link
Contributor

saghul commented Oct 13, 2025

Can you enable the feature so we start testing it? I'd say partial support is ok, just check in the failures so we can track them.

Added another export case, export name as string:

```js
export { "☿" } from ...
```
@karlseguin
Copy link
Contributor Author

There are now 3 cases failing, but they're all error cases that should return an error. Two are related to erroring on invalid unicode. I couldn't find an example of making sure a TOK_STRING is a valid unicode, but I imagine it exists and it would be easy to add if someone wants to point me to it.

Copy link
Contributor

@bnoordhuis bnoordhuis left a comment

Choose a reason for hiding this comment

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

LGTM module some style comments.

quickjs.c Outdated
Comment on lines 29353 to 29354
js_parse_error(s, "identifier or string expected");
return -1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can be condensed to (here and elsewhere):

Suggested change
js_parse_error(s, "identifier or string expected");
return -1;
return js_parse_error(s, "identifier or string expected");

@bnoordhuis bnoordhuis merged commit 8c526f6 into quickjs-ng:master Oct 16, 2025
@bnoordhuis
Copy link
Contributor

Thanks, Karl!

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.

3 participants