curveball / core

The Curveball framework is a TypeScript framework for node.js with support for modern HTTP features.
https://curveballjs.org/
MIT License
525 stars 7 forks source link

Consider not releasing the sources as part of the package #185

Closed ericmorand closed 2 years ago

ericmorand commented 2 years ago

Current @curveball/core package comes with the compiled artifacts (the JavaScript files and the type definitions, inside dist) but also comes with the TypeScript sources (inside src). It looks like a deliberate move since the src directory is explicitly present in the files property of the project manifest.

"files": [
    "package.json",
    "README.md",
    "dist",
    "LICENSE",
    "src"
]

@curveball/core is a runtime dependency for most projects, which means that its sources are present in the deployed environments even though they are totally useless there.

I suggest that they are removed from the distributed package.

evert commented 2 years ago

The benefit of packing them is step-through debugging. This does come at a minor package-size cost, but imho it's worth having!

ericmorand commented 2 years ago

Does it mean that it is a temporary situation until first stable release?

evert commented 2 years ago

No, this is useful for end-users as well as core developers. More complex issues might require a developer to trace exactly the path the interpreter takes. Especially when for example dealing with higher-order functions, you might need to see when/why Curveball calls one of your functions.

Given that the cost is relatively low, I don't see a huge problem with this. Don't get me wrong, I love a small node_modules, but I think the best lever to achieve this is to have shallow dependency trees. I'm not too worried about a few extra files.

ericmorand commented 2 years ago

I'm not sure I understand your point. The TypeScript code present in src is not executed, hence it doesn't serve any purpose for debugging. The JavaScript code is executed and this one can be used for debugging purpose.

evert commented 2 years ago

Most debuggers can take the .map files and let you step through the original pre-compiled source. One way to do this with node is to start node with --inspect-brk, and open about:inspect in chrome. It works quite nicely, and would recommend you give it a shot if you haven't seen this in action!

The purpose of the .map files is to create a byte-by-byte mapping of the original source and compiled source.

ericmorand commented 2 years ago

Do you mean that the source maps are included in the distributed npm package?

evert commented 2 years ago

Yep!

evert commented 2 years ago

I think I will close this ticket, but happy to discuss further if you feel like it.