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

Can decompile the precompiled template #1443

Open
helvenk opened this issue Sep 12, 2023 · 4 comments
Open

Can decompile the precompiled template #1443

helvenk opened this issue Sep 12, 2023 · 4 comments

Comments

@helvenk
Copy link

helvenk commented Sep 12, 2023

I'm sorry that I'd like to know if the template can be decompiled? Such as the following code:

import { precompile } from '@glimmer/compiler';

const template = `<div>hello {{name}}</div>`;
const str = precompile(template);

// How to decompile the `str` to make them equal?
// decompile(str) === template  //  Can do this?
@NullVoxPopuli
Copy link
Contributor

Before i do investigation, can you provide more information about why you want to do this? 🙃
Thanks!

@helvenk
Copy link
Author

helvenk commented Sep 12, 2023

uh, I build application with ember.js,but in some reason I lost my files accidentally under local git repository,no stage、stash or commit... Fortunately, I have built the project once with sourcemap enabled。ember.js does not provide .hbs source file except component, I'm looking for help to find out my source files.

@NullVoxPopuli
Copy link
Contributor

iirc, it's possible, but there is no existing tool to do that. We have lots of file -> wireformat tests, but it's all opcodes and JSON, so I think it'd be totally possible to go the other way if someone wanted to implement that. The specific opcodes to use would be dependent on glimmer/ember-source version though

@jelhan
Copy link

jelhan commented Feb 16, 2024

Did you checked if the bundle contains the templates as inline comments? It may depend on the build of it does. But I often noticed them when debugging.

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