HarperFast / HarperFast/harper

Legacy SQL stack (alasql, mathjs, moment) is ~33MB of every install and the root cause of the react-native tree

Open
#2,606 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
89
Forks
10
Avg merge
2d 6h
Merged PRs (30d)
200

Description

## Summary

Three of the heaviest always-installed dependencies exist to serve the legacy SQL translator:

| dep | size | role |
|---|---|---|
| mathjs | 17M | expression evaluation in sqlTranslator / alaSQLExtension |
| alasql | 10M | legacy SQL engine |
| moment | 6M | date functions in the SQL path + jobs/validation (8 files total) |

alasql is also the sole reason the react-native problem (#1937) exists: `alasql@4.17.3` declares `react-native-fs` as an `optionalDependency`, which pulls react-native + hermes-compiler + metro + react-devtools (~140MB) into any install where the shrinkwrap prune doesn't apply — which per #2172 will be **every** npm 12 install. The shrinkwrap prune treats the symptom; removing (or replacing) alasql removes the cause.

The in-tree `sqlEngine/` (v2, #2101) is the successor to the legacy engine (#1648). This issue is the dependency-footprint case for finishing that migration and dropping alasql — or, if the migration timeline is long, interim options:

1. Upstream PR to alasql moving `react-native-fs` behind an install condition that can't fire in Node server installs (the repo is active).
2. Publishing a trimmed alasql build under `@harperfast/` with the react-native edge removed (heavier maintenance).

Note: the `overrides: { alasql: { xlsx: "0.18.5" } }` in package.json is dead config — alasql 4.17.3 no longer depends on xlsx, and root-level overrides never applied to consumers anyway (only the shrinkwrap propagated pins).

mathjs and moment deserve their own usage pass regardless (`dependencies.md` bar): mathjs is import-confined to the SQL path; moment appears in 8 files (jobs, readLogValidator, common_utils, date functions) and is deprecated upstream — `Temporal`/date-fns are drop-in-scale replacements.

## Method

`npm install harper@5.2.7 --omit=dev` on darwin/arm64, npm 11.16.0; per-package `du -sm`; import sites via grep excluding tests/dist. Package profile unchanged at 5.2.12 (unpackedSize within 0.3%). The react-native chain verified with `npm ls react-native`: harper → alasql → react-native-fs → react-native 0.84.1 (+ hermes-compiler 47M, metro 6M, react-devtools-core 17M).

## References

- #1648 — [Epic] Legacy SQL (alasql) engine
- #2101 — [Epic] SQL engine (v2)
- #1937 / #2043 — the react-native symptom, treated at the shrinkwrap/Docker level
- #2164 — install footprint umbrella (this is lever 4's largest slice)
- #2172 — npm 12 drops shrinkwrap support, which is what makes the alasql edge live again

---

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Contributor guide

Open the contributing guide

Research direction

Start by reading the legacy sqlTranslator and alaSQLExtension paths, the in-tree sqlEngine/ successor, package.json, and dependencies.md. Use the referenced npm install and npm ls react-native checks to establish the dependency footprint. Done means the migration or an explicitly scoped interim dependency solution is complete, with the legacy dependency chain and its react-native edge removed or addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
backend, build-system, databases
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.