supportRelativeURL bombs when Node "path" object is not present
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript
- Ambito
- devtools
Direzione di ricerca
Inizia da supportRelativeURL e mapSourcePosition, dove l’issue segnala errori quando il Node path object o i relativi metodi non sono disponibili. Confronta questa gestione con i controlli fs esistenti e determina se la soluzione prevista consiste in un comportamento resiliente o nella documentazione in README; il lavoro è completato quando l’ambiente Unreal-style segnalato non fallisce più oppure i suoi requisiti sono documentati chiaramente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I am attempting to use source-map-support with a platform where v8 is embedded directly into an application, which is not Node or a browser (it's a plugin for the Unreal game engine). I do not know if this is a use case you support, but source-map-support does have many options that seem intended for making it work in unusual environments.
The Unreal environment does not have full fs or path objects (both are available through require, but return empty objects). It does have a dedicated function for loading a file into a string from disk. I am currently running this:
require('source-map-support').install({overrideRetrieveSourceMap: true, retrieveSourceMap: function(source:string) {
if (!source.startsWith("file:///")) { return null }
let name = decodeURIComponent(source.substr(8)) + ".map"
let result = JavascriptLibrary.ReadStringFromFile(null, name)
if (!result) { return null }
return { url: source, map: result }
}
})
This works except for the supportRelativeURL function, which calls both path.dirname and path.resolve without checking. In my testing, source-map-support fails 100% because supportRelativeURL gets called by mapSourcePosition. (mapSourcePosition actually calls supportRelativeURL twice. In my testing, the second one is the only one that is triggering, comment "Only return the original position if a matching line was found…". As a side note though the first call is interesting, since in cases where it does trigger, it seems to only be about maintaining the fileContentsCache. However if the user is using overrideRetrieveSourceMap— which I am— the fileContentsCache is unused, so this clause is useless work…).
If I replace the contents of supportRelativeURL with return url, source-map-support overall works great.
I am not completely sure how to proceed here. I could potentially add the missing path methods to the environment (although path.resolve concerns me since that involves per-OS support to do properly). It does seem too bad though that source-map-support almost allows me to configure it into no dependence on the filesystem, then falls down in this one function.
I think my expected behavior is that source-map-support should check for the presence of the methods on path it needs, and be resistant to path being null, since after all it already goes to the bother of doing this with fs. If this is not practical, it might help for people in unusual situations to document in the README that the path, path.dirname and path.resolve objects are required (how is it requiring "path" works in the browser, anyway?).
- Lingua principale
- JavaScript
- Stelle
- 2.2k
- Fork
- 221
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di evanw/node-source-map-support
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
evanw/node-source-map-support#344 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
evanw/node-source-map-support#343 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
evanw/node-source-map-support#337 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 20/100
evanw/node-source-map-support#333 ·
-
Provide esm versionAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 28/100
evanw/node-source-map-support#330 · 2 commenti · 9 reazioni ·
Tutte le issue di evanw/node-source-map-support
Issue simili
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
andromarces/agent-loops#886 ·
I maintainer di solito rispondono entro 1 giorno
-
bug effort:low model:light plan planner:gpt-6-1-sol tests
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
B: visual
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
FreeTubeApp/FreeTube#9929 ·
I maintainer di solito rispondono entro 1 giorno
-
🐛 Bug: `--clear-screen` not very useful (at least not for dealing with large test/error output)Apertastatus: in triage type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
mochajs/mocha#6428 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Fixed-position outer <svg> lands outside a clip after scroll; fixed HTML boxes are re-anchoredAperta🔧 in development
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100