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

Rename JS library files from library_foo.js to libfoo.js #23348

Merged
merged 1 commit into from
Jan 18, 2025

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Jan 9, 2025

At the same time, move all the library file into a separate src/lib
directory. This helps distinguish library files from other files
in the lib directory, which is currently very overcrowded/overloaded.

These files were also includ-able via -lfoo and we previously had to
use a special case for system libraries where library_foo.js could be
used in addition to more standed libfoo.js. This change removes to
special case.

This only file that was not renamed using the simple pattern was
library.py itself which becomes libcore.py. I also considered
libemscripten.js.

To some this may seem like needless churn, but for years now the src
directory (IMHO) has been asking for cleanup. I think having files
logically separated into directories helps a lot with understanding the
project structure for both newcomers and old timers alike.

As a followup, I am also considering moving all the runtime files into
src/include (since these are all files that get #included into the
generated code directly. That would leave the src directory
containing only the JS compiler code itself which I think is another
important distinction.

@sbc100 sbc100 marked this pull request as draft January 9, 2025 04:04
@sbc100
Copy link
Collaborator Author

sbc100 commented Jan 9, 2025

Marking as draft for now.

@sbc100 sbc100 force-pushed the library_rename branch 3 times, most recently from 64743d3 to 49a1a75 Compare January 17, 2025 00:26
@sbc100 sbc100 marked this pull request as ready for review January 17, 2025 00:26
@sbc100 sbc100 changed the title Rename system library files from library_foo.js to libfoo.js Rename JS library files from library_foo.js to libfoo.js Jan 17, 2025
src/lib/libstrings.js Outdated Show resolved Hide resolved
src/modules.mjs Outdated Show resolved Hide resolved
test/test_other.py Outdated Show resolved Hide resolved
@sbc100 sbc100 force-pushed the library_rename branch 4 times, most recently from 5a3327c to cf00d64 Compare January 17, 2025 19:48
sbc100 added a commit that referenced this pull request Jan 17, 2025
Files references via #include can now either relative to the including
file or come from the system library. Previously only relative paths
were allowed.

Also we now give a nicer error message when the file is not found.

Split out from #23348
@sbc100
Copy link
Collaborator Author

sbc100 commented Jan 17, 2025

Much cleaner PR now that #23449 landed

At the same time, move all the library file into a separate `src/lib`
directory.  This helps distinguish library files from other files
in the `lib` directory, which is currently very overcrowded/overloaded.

These files were also includ-able via `-lfoo` and we previously had to
use a special case for system libraries where `library_foo.js` could be
used in addition to more standed `libfoo.js`.  This change removes to
special case.

This only file that was not renamed using the simple pattern was
`library.py` itself which becomes `libcore.py`.  I also considered
`libemscripten.js`.

To some this may seem like needless churn, but for years now the `src`
directory (IMHO) has been asking for cleanup.  I think having files
logically separated into directories helps a lot with understanding the
project structure for both newcomers and old timers alike.

As a followup, I am also considering moving all the runtime files into
`src/include` (since these are all files that get `#included` into the
generated code directly.  That would leave the `src` directory
containing only the JS compiler code itself which I think is another
important distinction.
@sbc100
Copy link
Collaborator Author

sbc100 commented Jan 17, 2025

Added a ChangeLog entry

@kripken
Copy link
Member

kripken commented Jan 17, 2025

lgtm

@sbc100 sbc100 merged commit 9a39610 into emscripten-core:main Jan 18, 2025
29 checks passed
@sbc100 sbc100 deleted the library_rename branch January 18, 2025 01:12
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

Successfully merging this pull request may close these issues.

2 participants