Skip to content

Generate JavaScriptKit .js runtime with SwiftPM build tool #191

Closed
@MaxDesiatov

Description

@MaxDesiatov

I'm proposing to declare Runtime/lib directory as SwiftPM resource as described in SE-0271. With a few adjustments to carton, this will allow us to separate carton entrypoint files from JSKit runtime files, and simplify our release process as well. The end result would be that we can simply tag a new JSKit release without a need to update carton entrypoints and tag a new carton release each time.

The complication is that we need to keep .js files in Runtime/lib fresh and in sync with the .ts source files. I'm currently investigating whether SwiftPM build tools proposal can help us generate .js files at SwiftPM build time. While rollup.js requires Node.js to be installed to work, I'm looking at using swc.rs as a build tool, as it provides self-contained binaries for all most popular platforms. Bundling and minification with SWC is still marked as unstable, but with ES6 modules supported in all recent browsers, I wonder if we can keep JSKit runtime supplied in separate files, which could make it slightly easier to debug as well.

Bundling and minification of resulting .js files can then be left to the user, making it more flexible. As a future direction, rollup.js config could be supplied with carton, which it then could use when it runs carton bundle and detects that Node.js and rollup.js are installed and available on user's machine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions