Re: [w3c/FileAPI] Support `Response` in `URL.createObjectURL` (#97)

@guest271314

> Not following
> > 2 modules with the same source text it would collide.

`data:` does not make new records whenever you import them, so you get into a strange situation where things get shared across potentially unrelated graphs:

```html
<script type="module">
  import data from "data:application/javascript,export%20default%20{};";
  // prints 1
  setTimeout(() => console.log(data.x), 1000);
</script>
<script type="module">
  import data from "data:application/javascript,export%20default%20{};";
  data.x = 1;
</script>
```

So you have to use some different scheme for generic transforms that might generate the same source text.

----

Your code does exhibit the use case to some degree, but doesn't have the ability to intercept specifiers and referrers like https://github.com/bmeck/esm-http-server/blob/public/instrument.js is doing. Also, transformation of the `moduleBody` is unnecessary when you can redirect to a newly generated URL like `blob:` allows to the transformed `moduleBody`.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/FileAPI/issues/97#issuecomment-366766121

Received on Monday, 19 February 2018 18:00:43 UTC