Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upSupport named exports on bundles. #3352
Conversation
8daadd7
to
54bc5cc
@@ -0,0 +1,178 @@ | |||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. |
This comment has been minimized.
This comment has been minimized.
ry
Nov 15, 2019
Collaborator
This file is the output of deno bundle command? I think it would be good to automatically generate it during the tests.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
kitsonk
Nov 16, 2019
Author
Contributor
The only problem is that we don't support a pre-req in our integration tests, and I can't be guaranteed execution order or dependency. So to get one integration test to output it, and one integration test to consume it seems fragile, right?
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
kitsonk
Nov 16, 2019
Author
Contributor
Yes, but our integration tests don't support two invocations of Deno.
This comment has been minimized.
This comment has been minimized.
ry
Nov 16, 2019
Collaborator
You’d need to write a custom one. See for example the js_unit_tests https://github.com/denoland/deno/blob/master/cli/tests/integration_tests.rs#L41
This comment has been minimized.
This comment has been minimized.
This patch is awesome. I tried it with I did get a failure when trying it with |
This comment has been minimized.
This comment has been minimized.
Cool, need a test case. I will have a look and see what is wrong with that. |
This comment has been minimized.
This comment has been minimized.
Ok, it appears that it does export a symbol named |
This comment has been minimized.
This comment has been minimized.
Ok, I found a better compiler API that will give you all the exported members names, even if they are re-exports of another module. The one downside is that it also picks up "type only" exports as well. They should just result in |
// check the output of the test.ts program. | ||
assert_eq!(output.stdout, b"Hello\n"); | ||
assert_eq!(output.stderr, b""); | ||
} |
This comment has been minimized.
This comment has been minimized.
ry
Nov 20, 2019
Collaborator
@kitsonk I've modified the test - I think this is functionally equivalent to what you had before. PTAL.
This comment has been minimized.
This comment has been minimized.
kitsonk
Nov 20, 2019
Author
Contributor
Ha! I was working on it right now... just haven't had as much as I would like, but yeah, this looks like what I was doing. Thank you.
LGTM |
// check the output of the test.ts program. | ||
assert_eq!(output.stdout, b"Hello\n"); | ||
assert_eq!(output.stderr, b""); | ||
} |
This comment has been minimized.
This comment has been minimized.
kitsonk
Nov 20, 2019
Author
Contributor
Ha! I was working on it right now... just haven't had as much as I would like, but yeah, this looks like what I was doing. Thank you.
LGTM |
kitsonk commentedNov 15, 2019
Fixes #3283
This PR re-exports the exports of the main module passed on the command line. So if your main module looked something like this:
And you generated it into a bundle named
myLib.bundle.js
you could consume it like this:There was a partial solution tabled in #3283 to provide all the exports of the main module as the default export for the bundle. Looking into how to determine what is exported out of the main module, it was actually fairly easy to just generate the named export code.