Skip to content

Commit

Permalink
Move underlying JS interpreter to QuickJS (#3)
Browse files Browse the repository at this point in the history
* quickjs experiment

* memory stuff

* more memory fixes

* comments

* various things

* made the result discardable

* package updates

* Added perform(...) to do things on the JS thread

* package & test updates.

* Removed extraneous file

* Bring back the version file

* and again
  • Loading branch information
bsneed authored May 17, 2024
1 parent 3239112 commit 9951294
Show file tree
Hide file tree
Showing 78 changed files with 80,132 additions and 2,893 deletions.
58 changes: 26 additions & 32 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,50 +1,44 @@
// swift-tools-version:5.3
// swift-tools-version: 5.8
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

#if canImport(JavaScriptCore)
let targets: [Target] = [
.target(name: "Substrata")
]
#elseif os(Windows)
// Windows iTunes installs JSC at: C:/Program Files/iTunes/JavaScriptCore.dll
// See also: https://pub.dev/packages/flutter_jscore#windows
let targets: [Target] = [
.target(name: "Substrata",
linkerSettings: [
.linkedLibrary("Kernel32", .when(platforms: [.windows])),
.linkedLibrary("JavaScriptCore", .when(platforms: [.windows])),
.linkedLibrary("CoreFoundation", .when(platforms: [.windows])),
.linkedLibrary("WTF", .when(platforms: [.windows])),
.linkedLibrary("ASL", .when(platforms: [.windows])),
])
]
#else // no native JavaScriptCore falls back to javascriptcoregtk
let targets: [Target] = [
.systemLibrary(name: "CJavaScriptCore",
pkgConfig: "javascriptcoregtk-4.0",
providers: [.apt(["libjavascriptcoregtk-4.0-dev"]), .yum(["webkit2gtk"])]),
.target(name: "Substrata", dependencies: ["CJavaScriptCore"], cSettings: [.headerSearchPath("../CJavaScriptCore/header_maps")])
]
#endif

let package = Package(
name: "Substrata",
platforms: [
.macOS("10.15"),
.iOS("13.0"),
.tvOS("11.0"),
.tvOS("11.0")
],
products: [
.library(name: "Substrata", targets: ["Substrata"]),
// Products define the executables and libraries a package produces, making them visible to other packages.
.library(
name: "Substrata",
targets: ["Substrata"]),
],
targets: targets + [
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products from dependencies.
.target(
name: "SubstrataQuickJS"
/*cSettings: [
/*.unsafeFlags([
"-Wno-implicit-int-float-conversion",
"-Wno-conversion"
]),*/
.define("CONFIG_BIGNUM"),
.define("CONFIG_ATOMICS"),
//.define("DUMP_LEAKS")
]*/
),
.target(
name: "Substrata",
dependencies: ["SubstrataQuickJS"]),
.testTarget(
name: "SubstrataTests",
dependencies: ["Substrata"],
resources: [
.copy("TestHelpers/ConversionTestData.js"),
.copy("TestHelpers/BundleTest.js")
.copy("Support/ConversionTestData.js")
])
]
)
26 changes: 0 additions & 26 deletions Sources/CJavaScriptCore/header_maps/JavaScriptCore/JSBase.h

This file was deleted.

26 changes: 0 additions & 26 deletions Sources/CJavaScriptCore/header_maps/JavaScriptCore/JSContextRef.h

This file was deleted.

26 changes: 0 additions & 26 deletions Sources/CJavaScriptCore/header_maps/JavaScriptCore/JSObjectRef.h

This file was deleted.

26 changes: 0 additions & 26 deletions Sources/CJavaScriptCore/header_maps/JavaScriptCore/JSStringRef.h

This file was deleted.

26 changes: 0 additions & 26 deletions Sources/CJavaScriptCore/header_maps/JavaScriptCore/JSTypedArray.h

This file was deleted.

26 changes: 0 additions & 26 deletions Sources/CJavaScriptCore/header_maps/JavaScriptCore/JSValueRef.h

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions Sources/CJavaScriptCore/include/jscore_c.h

This file was deleted.

5 changes: 0 additions & 5 deletions Sources/CJavaScriptCore/include/module.modulemap

This file was deleted.

1 change: 0 additions & 1 deletion Sources/CJavaScriptCore/jsshim.c

This file was deleted.

6 changes: 0 additions & 6 deletions Sources/CJavaScriptCore/module.modulemap

This file was deleted.

105 changes: 0 additions & 105 deletions Sources/Substrata/Core/Callbacks/Classes.swift

This file was deleted.

Loading

0 comments on commit 9951294

Please sign in to comment.