Comments (6)
Another option is to allow users to specify JSKit npm package version in package.json
at the top of user code, then bundle it by carton bundle
.
$ carton init
$ tree -L 2
.
├── Package.swift
├── README.md
├── Sources
│ └── MyApp
├── Tests
│ ├── LinuxMain.swift
│ └── MyAppTests
├── node_modules
│ └── javascript-kit-swift
├── package-lock.json
└── package.json
$ cat package.json
{
"name": "MyApp",
"private": true,
"dependencies": {
"javascript-kit-swift": "^0.14.0"
}
}
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.
from javascriptkit.
Keeping this open until Swift 5.7 and SwiftWasm 5.7 are available with apple/swift-package-manager#4306 included in those releases.
from javascriptkit.
Another option is esbuild
, which has a path to downloading directly from npm without having Node installed. Something to be aware of is that neither swc nor esbuild support type checking, so there would have to be a GitHub Action to make sure things stay type-safe.
Avoiding compilation entirely is also very possible — we could switch to using plain .js
files with JSDoc-based type annotations. One small caveat with this is that we would no longer be able to use enums as they are not a native JS feature (but there are plenty of alternate ways this could be handled).
from javascriptkit.
Ah, I forgot about esbuild
. Could try that as well and see what's easier to use and better documented. I like TypeScript quite a lot, so would prefer to keep using it. As for type checking, you're right that GHA job would catch issues, and probably it's reasonable to expect that developers of JSKit have a proper TS compiler/type checker installed for the development process.
from javascriptkit.
Glad to see that esbuild
supports bundling and minification. Maybe we could utilize that in carton bundle
when detecting that esbuild
is available in SwiftPM dependency tree as a build tool. I also find it somewhat better documented than SWC.
from javascriptkit.
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 BigInt
changes, and I'm tired of rebuilding carton
entrypoints every time anything changes in JSKit runtime. Especially when I only want to try latest commits in JSKit main
branch.
from javascriptkit.
Related Issues (20)
- Enchancement: Add a link to the docs HOT 4
- Export function returning a JSValue HOT 2
- Arguments in JSClosure HOT 4
- JSPromise(resolver:) usage HOT 3
- Asynchronous calls in JSClosure HOT 5
- Making JSObject hashable HOT 5
- Compile error on macOS 12.2.1 HOT 6
- UserAgent support? HOT 1
- WebSockets implementation HOT 2
- `JSNumber` type to support `long long` type in Web API IDL
- PUT request using Fetch HOT 2
- Occasional JSClosure has been already released by Swift side HOT 4
- Compiled module was created by a different version of the compiler; rebuild 'JavaScriptKit' and try again HOT 2
- Cannot perform DataView.prototype.setBigUint64 on a detached ArrayBuffer HOT 2
- JSClosure will be overriden from other closure HOT 1
- Are JSValue bitmasks possible? HOT 2
- `JSClosure.async` doesn't work at all
- Init `JSUInt8ClampedArray` from `[UInt8]` failed
- When targeting macOS, v0.19.0 Requires macOS 14 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from javascriptkit.