Skip to content

#1173: point the main field at src/eoc.js - #1212

Open
morphqdd wants to merge 2 commits into
objectionary:masterfrom
morphqdd:1173
Open

morphqdd wants to merge 2 commits into
objectionary:masterfrom
morphqdd:1173

Conversation

@morphqdd

@morphqdd morphqdd commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

package.json had "main": "eoc", a file that does not exist, so require('eolang') failed. src/eoc.js runs the command line only under require.main === module and exports commandsDescription, canonicalLanguage, tcpPort and select, so main now points at it. The CLI under bin is not touched.

The new test/test_main.js requires the package root and checks two of the exports; it fails with the old main.

Closes #1173

@morphqdd
morphqdd force-pushed the 1173 branch 2 times, most recently from e4e9e02 to 7468b01 Compare August 31, 2026 16:32

yegor256 commented Sep 1, 2026

Copy link
Copy Markdown
Member

build/itest are red on this PR, same as everywhere else right now (#1233). Not merging until CI is green.


Generated by Claude Code

@yegor256
yegor256 self-requested a review September 1, 2026 06:36
@morphqdd
morphqdd force-pushed the 1173 branch 2 times, most recently from e4b2e03 to 1fdd71a Compare September 7, 2026 12:43

@zaguzovmaksim0-hue zaguzovmaksim0-hue left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The premise of this fix is no longer true on current master, so I don't think deleting main is the best resolution now.

src/eoc.js currently wraps CLI execution in if (require.main === module), so requiring that file does not call program.parseAsync(process.argv). It also deliberately exports commandsDescription, canonicalLanguage, and select, and the test suite imports this module directly. In other words, the entry file is now safe to load and already has a small programmatic surface.

With this PR, require('eolang') still fails — Node just falls back to a missing index.js. Changing main from eoc to src/eoc.js would instead fix the reported package-level import while preserving the CLI under bin.

Please update the metadata to point main at the guarded real entry file (and ideally add a regression that requires the package root) rather than removing the field.

@morphqdd morphqdd changed the title #1173: drop the main field that pointed at nothing #1173: point the main field at src/eoc.js Nov 7, 2026
@morphqdd

morphqdd commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

Agreed, changed it: main now points at src/eoc.js instead of being removed, and test/test_main.js requires the package root and checks commandsDescription and select. It fails with the old main.

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.

main field in package.json incorrectly pointing to non-existent eoc file, causing require failures

3 participants