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

Make identifiers pretty instead of mangled. #8

Open
Tracked by #10
tbranyen opened this issue Jan 19, 2014 · 6 comments
Open
Tracked by #10

Make identifiers pretty instead of mangled. #8

tbranyen opened this issue Jan 19, 2014 · 6 comments

Comments

@tbranyen
Copy link
Collaborator

Run the moduleName through a function that can generate a pretty and valid JavaScript identifier. This will help avoid the need to mangle the identifier for uniqueness.

@jugglinmike
Copy link
Owner

I was thinking about this, and I´m not sure how we could do it reliably. A naive approach might transform the module ID 1a-b;c to _1a_b_c, but then we would have to avoid collisions with a module originally named _1a_b_c.

Instead, could we just define a __MODULES__ namespace and attach modules as properties to that using moduleNames as a key directly?

@tbranyen
Copy link
Collaborator Author

I agree. If you specify a namespace, we shouldn't have to mangle anything, we can instead directly attach:

__MODULES__["Number"] = {};
__MODULES__["123_INVALID--;IDENTIFER"] = {};

@jugglinmike
Copy link
Owner

Will we still need to procedurally generate names for anonymous modules?

@tbranyen
Copy link
Collaborator Author

We can remove generated identifiers if we are okay with enforcing a namespace. That may be a better way of going about this anyways.

@jugglinmike
Copy link
Owner

Do we generate names for anonymous modules from the file path?

@jugglinmike
Copy link
Owner

Rather: will we generate names for anonymous modules from the file path?

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

2 participants