Support for legacy script (#1)

This commit is contained in:
CelloSerenity 2026-06-29 05:10:34 -06:00 • committed by GitHub
parent 5bdecfcafa
commit 2320badda8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 128 additions and 13 deletions

View file

@ -2,9 +2,9 @@ import Foundation
enum BundledScript {
static func universalJS() throws -> String {
static func source(for script: StikJIT.Script) throws -> String {
let bundle = Bundle(for: BundleToken.self)
guard let url = bundle.url(forResource: "universal", withExtension: "js"),
guard let url = bundle.url(forResource: script.resourceName, withExtension: "js"),
let source = try? String(contentsOf: url, encoding: .utf8),
!source.isEmpty else {
throw StikJITError.scriptUnavailable