NB: this is a mega work-in-progress.
- better tests
- set up some fixtures etc
- actually 'linking' the dependencies
- config file (prefer real JS to json)
- get typescript to dead tree shake I guess
goal:
- learn stuff
- be able to use node_modules/naked imports normally in the source code
- have dependencies included automagically, with as little-to-minimal configuration as possible (for educational/simplicity sake)
- the
mrs-tiny-server
referenced is the home-grown dev-server, which currently resides here. (Also a WIP and currently locally included via the filesystem, etc.)
- get dependency information
- read package.json
- get dependency list
- make a Set and remove duplicates while adding recursively
- get dependencies somewhere
- copy every one of the
dependencies
to some known location
- copy every one of the
- move source files to build folder
- rewrite source file imports IN THE BUILD folder
- these are both sloooooooow ... and I believe equivalent to what I'm doing?
npm ls --prod --json
: json tree of dependencies in prod envnpm ls --prod --parseable
: deduped set of dependencies as paths to their folders
- a
requires
is a"module-name": "0.1.2"
(some semver) pair - a
dependencies
is a whole nother tree, which may itself haverequires
, etc etc - kinds of
requires
/dependencies
relationships:- 0
requires
, 0dependencies
- => no dependencies
- 0
requires
, 1+dependencies
- => ??? what the heck? this DOES happen
- 1+
requires
, 0dependencies
- =>
dependencies
are already somewhere above us in the tree with the version that we want
- =>
- 1+
requires
, 1+dependencies
- =>
requires
that are not also in the dependencies of this object- => these
requires
are listd somewhere higher in the tree w/ right version
- => these
- =>
dependencies
- => these are a version that DIFFERS from what is needed above -- so we are including it here as a dependency because it is more specific and local to this dependency tree
- e.g., the top module needs
fast-parser v12.0.1
but this module requiresfast-parser v2.0.4
-- 12.0.1 should exist elsewhere up higher probs at the top level, but since we need a DIFFERENT version, it becomes a dependency of this subtree
- =>
- 0
- top level module = the actual project
- instead of semvers, say we map "recipe-name": "recipe-version"
- and for kicks a fake key of, idk, people invited
dependencies
:version
integrity
resolved
optional
-> should still be included apparentlyrequires
:- "hey, I require these things to function"
- mapping of
"module-name": "0.0.0semver
- version should match either in our
dependencies
(this object), or in one higher