Skip to content

Step 4, first part: the Query class, the query runner and the join loop as ES modules, sharing internals through a second install parameter - #2836

Merged
mathiasrw merged 11 commits into
feature/rollupfrom
fix/step4-prototype-internal
Oct 21, 2026
Merged

mathiasrw merged 11 commits into
feature/rollupfrom
fix/step4-prototype-internal

Conversation

@mathiasrw

Copy link
Copy Markdown
Member

The first part of step 4 of the ES6 conversion (context/roadmap-phase-1.md), built as the prototype that settled how one module reaches another's internals.

File Module Similarity
src/25queryclass.js src/data/query.js 92%
src/38query.js src/select/queryfn.js 98%
src/39dojoin.js src/select/dojoin.js 98%

38query.js and 39dojoin.js are step 6 files by the roadmap, done early because they are where the internals are (doJoin, queryfn); docs/src-map.md says so.

The mechanism, decided 2026-10-22

Every install takes a second parameter, internal, an object made in src/index.js beside the instance and passed to every install, the generated legacy module included. A module puts what other modules need on it (internal.doJoin = doJoin) and a module installed later reads it at install (var doJoin = internal.doJoin). Nothing is added to the alasql object: the API snapshot is identical to 4.21.0 apart from the names already allowed.

Compared on this prototype with alasql.private (branch deleted): same parity, same suite, same merge behaviour, compile within noise (101 against 98), and no API surface for users to reach.

Plain imports for stateless helpers

hash, cloneDeep, deepEqual, arrayUnionDeep, arrayExceptDeep and arrayIntersectDeep moved out of install() in src/utils/helpers.js as exports; install() still puts them on alasql.utils. queryfn.js imports them, as the old code used them by bare name. Calls through alasql.utils.x stay as they are. As exports the six functions have a .name where they had none; those five paths are listed with the reason in test/parity/api-allowed.txt.

Checks

suite 2447 pass, 213 skip, 0 fail at every commit
parity on the tip 0 differences over 76,999 statements; API identical apart from the allowed names
smokes browser global, worker, CLI, ESM import, alasql.min.js under node, Node 16
compile, 7 runs against feature/rollup 101 (Bun 99, Node 103), within the noise of 2
rehearsed develop fix the inverse of #2611 on the old 38query.js, merged into this branch: lands in src/select/queryfn.js without a conflict

tools/wrap.js takes --internal name, --bind name=expr and --import "<line>" for these wraps.

@mathiasrw
mathiasrw merged commit 821b571 into feature/rollup Oct 21, 2026
19 checks passed
@mathiasrw
mathiasrw deleted the fix/step4-prototype-internal branch October 21, 2026 16:26
@mathiasrw
mathiasrw restored the fix/step4-prototype-internal branch October 21, 2026 16:28
@mathiasrw
mathiasrw deleted the fix/step4-prototype-internal branch October 21, 2026 16:33
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.

1 participant