stealjs / steal-tools

Build easy. Load fast.
https://stealjs.com/docs/steal-tools.html
MIT License
67 stars 23 forks source link

Proposal: Move away from CLI use REPL #1079

Closed frank-dspeed closed 5 years ago

frank-dspeed commented 5 years ago

This can be backward Compatible via the CLI interface but we will add

The Repl will be also shared via a local unix socket thats best practice on that and then we do a extra repl client that connects to that socket.

This way we can Programmatic control and use steal-tools directly from the repl we are also able to do remote imports directly from the repl and so are able to bundle projects even without installing them local!

That will allow us to compile only what we need and also use the new module flows desired by Node.

please lets discusse any questions

frank-dspeed commented 5 years ago

Examples:

Goal bypass npm install :dancer:

in future even node local projects will import modules and bundle tree shake to production :dagger:

matthewp commented 5 years ago

I don't think it's reason to assume people are going to start a repl to do a build. The CLI is useful for straightforward builds with no special configuration.

justinbmeyer commented 5 years ago

How does REPL fit in with bypassing npm install? I don't understand the connection? Is this two different things?

frank-dspeed commented 5 years ago

@justinbmeyer

import can from 'https://unpkg.com/can/core.mjs'
import jquery from 'https://unpkg.com/jquery@3.3.1/dist/jquery.slim.min.js'

The Main Concept of bypass Npm install is that import is not related to a path its related to a URL so we can also remote import and use that for local development we would have our regular caching proxys for domains like unpkg.

steal-tools would download both files and do its stuff as we would talk about npm packages but every javascript will export at the end as module till wasm takes over.

//import('https://unpkg.com/can/core.mjs').then(pkg=>pkg.Component).then(Compoent=>new Component)
frank-dspeed commented 5 years ago

@justinbmeyer oh and sorry a more current example for bypass npm i forgotten to show that

// writing to local file in a full example we would simply pipe into the steal-tools bundle stream :)
request('https://unpkg.com/can/core.mjs').pipe(fs.createWriteStream('core.mjs'))
frank-dspeed commented 5 years ago

The Concept of a REPL attaches to that because we could have some gist files for example that do some requests and bundle action and paste that directly into the repl the repl is a complet controll able shell that don't depends on windows or linux so its a cli the same as befor but it runs inside node it self so we could also easy have hosted steal-tools.

frank-dspeed commented 5 years ago

@matthewp the main idea behind the repl proposal is to attach later logging debugging and so on to that and also modify the Steal Object and play faster around with it. I think all kind of stuff can be done better directly via the javascript interface then via the console