Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include Metadata as part of BuildResult #352

Closed
eulores opened this issue Aug 27, 2020 · 4 comments
Closed

Include Metadata as part of BuildResult #352

eulores opened this issue Aug 27, 2020 · 4 comments

Comments

@eulores
Copy link

eulores commented Aug 27, 2020

Can you please expose Metadata as part of BuildResult, in particular if write is false.
That would be similar to exposing outputFiles.

Right now I have to write out that information to disk using metafile, only to then read it in and parse the JSON.
Thanks!

This is related to #15 and #140.

@evanw
Copy link
Owner

evanw commented Sep 2, 2020

Metadata is included as part of BuildResult if write is false. It's included as one of the outputFiles. You do not need to read it from disk. This is verified by the above commit.

@eulores
Copy link
Author

eulores commented Sep 2, 2020

Thanks!

@eulores eulores closed this as completed Sep 2, 2020
@lomadurov
Copy link

@evanw but BuildResult doesn't contain imports. How can I get a list of imports if write is false?

@evanw
Copy link
Owner

evanw commented Sep 28, 2020

The imports should be contained in the metafile. This is the format of the data, which does include imports:

esbuild/lib/types.ts

Lines 100 to 123 in 36343c2

// This is the type information for the "metafile" JSON format
export interface Metadata {
inputs: {
[path: string]: {
bytes: number
imports: {
path: string
}[]
}
}
outputs: {
[path: string]: {
bytes: number
inputs: {
[path: string]: {
bytesInOutput: number
}
}
imports: {
path: string
}[]
}
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants