Allow .mjs files as sources. - #1451
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
functionalscript | 3d0b03f | Commit Preview URL Branch Preview URL |
Aug 07 2026, 08:53 PM |
o2alexanderfedin
left a comment
There was a problem hiding this comment.
Checked this out and exercised it locally. The allowJs / checkJs flip and the two-pass prepack both hold up — see the verification notes at the bottom. One thing to fix.
**/*.mjs in files packs a non-package file
Adding **/*.mjs pulls the dev benchmark into the tarball. On this branch:
$ npm pack --dry-run
npm notice 4.8kB fjs/types/bigint/benchmark.mjs
npm notice total files: 513
fjs/types/bigint/benchmark.mjs is the only .mjs in the tree right now, so **/*.mjs currently means "ship the benchmark". That contradicts the rule the repo already states in fjs/ci/todo/publishing-packages.md:79, which #1449 keeps verbatim:
NPM must include both runtime extensions and both declaration extensions. Non-package
.mjsfiles must remain excluded from the packed archive.
A negation entry is enough — I verified it:
"files": [
"**/*.js",
"**/*.d.ts",
"**/*.mjs",
"**/*.d.mts",
"!**/benchmark.mjs"
]→ benchmark gone, total files: 512.
Verified good
npx tscis clean withallowJs/checkJsenabled, sobenchmark.mjsalready passes validation — that resolves the "make the benchmark pass or delete it" prerequisite inpublishing-packages.md.- I specifically checked the case enabling
allowJscould plausibly break: runningnpx tscin a tree that already contains the 254 generated.jsfiles from an earlierprepack. Still clean, so repeated local builds don't regress. - The two-pass
prepack+npm packcompletes. - Fixing the pre-existing
--NoEmit→--noEmitcasing along the way is a nice catch.
|
Decision: keep |
o2alexanderfedin
left a comment
There was a problem hiding this comment.
Approving at 3d0b03f8.
My packaging concern is resolved, and resolved the better way — you corrected the rule rather than the code. fjs/ci/todo/f-mjs-package-support.md on main now says it explicitly ("Do not add special exclusions merely for non-public authored .mjs files", "Non-public authored .mjs files do not require special package exclusions"), and publishing-packages.md:88 records why packing benchmark.mjs is harmless. That's a real answer with a rationale attached, not a workaround, and it removes the contradiction I was pointing at. No objection.
Re-verified on this head:
npx tscclean.npm testin a clean worktree:pass: 2354, fail: 0, total: 2354.npm packsucceeds; the archive carriesbenchmark.mjsplusbenchmark.d.mts, and that declaration is justexport {};— no references to omitted files, which satisfies the "Verify emitted.d.mtscontains no references to omitted package files" checklist item.
One pre-existing footgun, not caused by this PR
Worth a todo/ note rather than a change here. Running npm test in a tree that already holds generated output runs every proof twice:
clean tree: pass: 2354
after a local prepack: pass: 4708
I confirmed this reproduces identically on main at 18af44b9, so it predates this PR. The cause is that shouldLoad matches both .f.ts and .f.js, and a prepack emits 111 proof.f.js beside the 111 authored proof.f.ts. Because .gitignore:131 ignores **/*.js, those files are invisible to git status, so the doubling is easy to miss.
I mention it here only because #1449 just dropped the clean:generated requirement on the reasoning that stale outputs can't leak into package jobs from developer machines. That reasoning is correct for package jobs — this is a different consequence of the same stale outputs, in the local test loop. The sharp edge is a stale generated proof from an earlier revision continuing to run against current sources. Given AGENTS.md already devotes a section to fake-pass hazards from wrong invocation, this seems worth recording as its own upstream todo.
No description provided.