SukkaW / nolyfill

Speed up your package installation process, reduce your disk usage, and extend the lifespan of your precious SSD.
MIT License
1.1k stars 15 forks source link

Is there just a list of the overrides in case we are hit with out of memory issues? #85

Open NullVoxPopuli opened 4 months ago

NullVoxPopuli commented 4 months ago

I can't use the CLI, because even with 32G of max-old-space-size, I get the OOM error, reported here: https://github.com/SukkaW/nolyfill/issues/33

We don't need a CLI -- we can copy-paste a list of overrides -- any packages we don't actually use would no-op.

imcotton commented 4 months ago

I made a lightweight CLI^1 with performance in mind that integrating meta data of nolyfill as one of presets.

Basically it streaming lockfile line-by-line by doing plain filtering on package names and nothing more. Still in earlier stage, feedback is welcome.

SukkaW commented 4 months ago

Basically it streaming lockfile line-by-line

Stream parsing is almost impossible for YAML format (which is the format of pnpm-lock.yaml).

imcotton commented 4 months ago

Yes, support all kinds of lockfiles would be an epic effort, thus I'd shortcut by calling npm shrinkwrap and use npm-shrinkwrap.json as single source of truth, at least for now.

imcotton commented 3 months ago
const headers = { 'Content-Type': 'text/html' };

const html = `

<!doctype html>

<head>
    <script type="importmap">
      {
        "imports": {
          "pkg-fence/": "https://esm.sh/jsr/@imcotton/pkg-fence@0.6.0/"
        }
      }
    </script>

    <script type="module">

        import { nolyfill } from 'pkg-fence/presets';

        console.log(nolyfill.list.length);
        console.log(nolyfill.list.slice(0, 5));
        console.log(nolyfill.check('hasown'));

    </script>
</head>

<body>
    <p>hello, JSR via esm.sh</p>
</body>

`;

export default {
    fetch () {
        return new Response(html, { headers });
    },
};

For sake of demonstration, save above code snippet as demo.js and try:

deno serve demo.js