diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2023-12-11 11:23:50 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-11 17:23:50 +0100 |
commit | 98121de5be6f948740c5869095381d6e7a18b9ea (patch) | |
tree | fb0b533ed5a309113622a51bcb16595505f140d6 | |
parent | 7bf267c197fc6a5cbafa0e72992b1cc7629ff989 (diff) |
fix: allow reserved word 'mod' in exports (#21537)
This problem occurred trying to load tensorflow.js
```
> import * as tf from 'npm:@tensorflow/tfjs';
Uncaught SyntaxError: Identifier 'mod' has already been declared at file:///Users/ry/Library/Caches/deno/npm/registry.npmjs.org/@tensorflow/tfjs/4.14.0/dist/tf.node.js:167:14
at async <anonymous>:1:33
```
-rw-r--r-- | cli/tests/testdata/npm/registry/@denotest/reserved-word-exports/1.0.0/index.cjs | 1 | ||||
-rw-r--r-- | cli/tests/testdata/npm/reserved_word_exports/main.out | 2 | ||||
-rw-r--r-- | ext/node/analyze.rs | 1 |
3 files changed, 4 insertions, 0 deletions
diff --git a/cli/tests/testdata/npm/registry/@denotest/reserved-word-exports/1.0.0/index.cjs b/cli/tests/testdata/npm/registry/@denotest/reserved-word-exports/1.0.0/index.cjs index 78e0563e4..73f00fad4 100644 --- a/cli/tests/testdata/npm/registry/@denotest/reserved-word-exports/1.0.0/index.cjs +++ b/cli/tests/testdata/npm/registry/@denotest/reserved-word-exports/1.0.0/index.cjs @@ -38,6 +38,7 @@ exports["int"] = "int"; exports["interface"] = "interface"; exports["let"] = "let"; exports["long"] = "long"; +exports["mod"] = "mod"; exports["native"] = "native"; exports["new"] = "new"; exports["null"] = "null"; diff --git a/cli/tests/testdata/npm/reserved_word_exports/main.out b/cli/tests/testdata/npm/reserved_word_exports/main.out index b98d1004d..345a7012f 100644 --- a/cli/tests/testdata/npm/reserved_word_exports/main.out +++ b/cli/tests/testdata/npm/reserved_word_exports/main.out @@ -56,6 +56,7 @@ Download http://localhost:4545/npm/registry/@denotest/reserved-word-exports/1.0. interface: "interface", let: "let", long: "long", + mod: "mod", native: "native", new: "new", null: "null", @@ -109,6 +110,7 @@ Download http://localhost:4545/npm/registry/@denotest/reserved-word-exports/1.0. interface: "interface", let: "let", long: "long", + mod: "mod", native: "native", new: "new", null: "null", diff --git a/ext/node/analyze.rs b/ext/node/analyze.rs index c2d3c79c0..173ce5385 100644 --- a/ext/node/analyze.rs +++ b/ext/node/analyze.rs @@ -351,6 +351,7 @@ static RESERVED_WORDS: Lazy<HashSet<&str>> = Lazy::new(|| { "interface", "let", "long", + "mod", "native", "new", "null", |