endojs / endo

Endo is a distributed secure JavaScript sandbox, based on SES
Apache License 2.0
829 stars 72 forks source link

Import bundle should unconditionally generate source map URL #1906

Open kriskowal opened 10 months ago

kriskowal commented 10 months ago

What is the Problem Being Solved?

We need to reveal source maps in IDEs for programs transformed by the static-module-record precompiler.

Description of the Design

Some IDEs support a configuration that will translate source map URLs to physical file URLs ad hoc based on their protocol [citation needed]. We can easily alter importBundle to inject a source map URL of the form endo://${sourcehash}.map.json.

Bundles currently entrain the hash of the precompiled source JSON. We would need to inject source hash into the generated compartment-map.json to make this work for some degenerate cases.

To complete the circle, we ought to have an endo where source-map command that reveals the URL a developer will need to configure their IDE with the location of the source map cache that bundle-source dumps into.

This issue is resolved when clear documentation is socialized and evidence exists for a nice debug experience.

Security Considerations

Scaling Considerations

Test Plan

Upgrade Considerations

kriskowal commented 10 months ago

attn @mhofman for details on IDE config and credit to @mhofman for this design direction.

kriskowal commented 4 months ago

Notes: