-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate JavaScriptKit .js
runtime with SwiftPM build tool
#191
Comments
Another option is Avoiding compilation entirely is also very possible — we could switch to using plain |
Ah, I forgot about |
Glad to see that |
Another option is to allow users to specify JSKit npm package version in
This option doesn't solve the potential version mismatch problem between the runtime npm package and SwiftPM package, but we can reuse many parts of the existing JS ecosystem, and no need to sync ts artifacts. |
I think JSKit version mismatch and npm/JS ecosystem interaction are two separate topics. Both deserve to be solved, but in my opinion the version mismatch and release engineering issues are more pressing. For now I'm inclined to try the SwiftPM resources approach first in my own branches and see how that works before submitting any PRs here. I'm trying to get WebGL/WebGPU stuff fixed in WebAPIKit, but that's blocked by |
.js
runtime as SwiftPM resources.js
runtime with SwiftPM build tool
Keeping this open until Swift 5.7 and SwiftWasm 5.7 are available with swiftlang/swift-package-manager#4306 included in those releases. |
I'm proposing to declare
Runtime/lib
directory as SwiftPM resource as described in SE-0271. With a few adjustments tocarton
, this will allow us to separatecarton
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 updatecarton
entrypoints and tag a newcarton
release each time.The complication is that we need to keep
.js
files inRuntime/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 withcarton
, which it then could use when it runscarton bundle
and detects that Node.js and rollup.js are installed and available on user's machine.The text was updated successfully, but these errors were encountered: