__pragma__('js') bug?
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, python
- Domain
- compilers
Research direction
Start by reproducing issue #766 with the two pragma('js') import examples, then trace the compiler's import-resolution step after the JavaScript file is generated. Compare the module-name handling for five- and six-character names, and verify that both examples compile without looking for a truncated Python or JavaScript filename.
Written by the indexing model from the issue text.
Description
In trying to use an ES6 style JavaScript import rather than the Node require() function, the js pragma fails if the import module name is more than 5 characters long.
So this transpiles as expected:
__pragma__('js','''import * as test from 'abcde';''')
But this fails:
__pragma__('js','''import * as test from 'abcdef';''')
giving this error:
Error while compiling (offending file last):
File 'scratch_3', line 0, namely:
Import error, can't find any of:
/home/jennasys/.config/JetBrains/PyCharm2020.3/scratches/c.py
/home/jennasys/.config/JetBrains/PyCharm2020.3/scratches/c.js
/home/data/Python/Transcrypt/pymui/venv/lib/python3.7/site-packages/transcrypt/modules/c.py
/home/data/Python/Transcrypt/pymui/venv/lib/python3.7/site-packages/transcrypt/modules/c.js
/home/data/Python/Transcrypt/pymui/venv/bin/c.py
/home/data/Python/Transcrypt/pymui/venv/bin/c.js
/usr/lib/python3.7/c.py
/usr/lib/python3.7/c.js
/usr/lib/python3.7/lib-dynload/c.py
/usr/lib/python3.7/lib-dynload/c.js
/home/data/Python/Transcrypt/pymui/venv/lib/python3.7/site-packages/c.py
/home/data/Python/Transcrypt/pymui/venv/lib/python3.7/site-packages/c.js
/home/data/Python/Transcrypt/pymui/venv/lib/python3.7/site-packages/setuptools-40.8.0-py3.7.egg/c.py
/home/data/Python/Transcrypt/pymui/venv/lib/python3.7/site-packages/setuptools-40.8.0-py3.7.egg/c.js
/home/data/Python/Transcrypt/pymui/venv/lib/python3.7/site-packages/pip-19.0.3-py3.7.egg/c.py
/home/data/Python/Transcrypt/pymui/venv/lib/python3.7/site-packages/pip-19.0.3-py3.7.egg/c.js
Aborted
In the error, the "filename" it looks for is the name of the import module with the first 2 and last 3 characters removed. So similar to the above example, this:
__pragma__('js','''import * as test from 'abcdefghijk';''')
gives an error of:
Error while compiling (offending file last):
File 'scratch_3', line 0, namely:
Import error, can't find any of:
/home/jennasys/.config/JetBrains/PyCharm2020.3/scratches/cdefgh.py
/home/jennasys/.config/JetBrains/PyCharm2020.3/scratches/cdefgh.js
...
Update: It looks like the JavaScript file containing the ES6 import is actually being generated correctly and the compile error occurs at some point after that happens.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 218
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from TranscryptOrg/Transcrypt
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
TranscryptOrg/Transcrypt#913 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
TranscryptOrg/Transcrypt#911 · 2 comments ·
-
IS: bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
TranscryptOrg/Transcrypt#908 ·
-
SUB: documentation
Difficulty 1/5 Under an hour Newbie friendliness 62/100
TranscryptOrg/Transcrypt#656 · 7 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 76/100
TranscryptOrg/Transcrypt#914 ·
All issues in TranscryptOrg/Transcrypt
Similar issues
-
link-check link-check:sphinx-theme
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
OpenHands/extensions#626 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
CSCfi/sd-search-api#39 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100