Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Sources/JavaScriptKit/Runtime linguist-generated
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ jobs:
SWIFT_VERSION=${{ matrix.entry.toolchain }} make bootstrap
echo ${{ matrix.entry.toolchain }} > .swift-version
make test
- name: Check if SwiftPM resources are stale
run:
git diff --exit-code Sources/JavaScriptKit/Runtime

native-build:
# Check native build to make it easy to develop applications by Xcode
name: Build for native target
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@ run_benchmark:
.PHONY: perf-tester
perf-tester:
cd ci/perf-tester && npm ci

.PHONY: regenerate_swiftpm_resources
regenerate_swiftpm_resources:
npm run build
cp Runtime/lib/index.{js,mjs} Sources/JavaScriptKit/Runtime
5 changes: 3 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.2
// swift-tools-version:5.3

import PackageDescription

Expand All @@ -12,7 +12,8 @@ let package = Package(
targets: [
.target(
name: "JavaScriptKit",
dependencies: ["_CJavaScriptKit"]
dependencies: ["_CJavaScriptKit"],
resources: [.copy("Runtime")]
),
.target(name: "_CJavaScriptKit"),
.target(
Expand Down
2 changes: 1 addition & 1 deletion Runtime/src/closure-heap.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ExportedFunctions } from "./types";
import { ExportedFunctions } from "./types.js";

/// Memory lifetime of closures in Swift are managed by Swift side
export class SwiftClosureDeallocator {
Expand Down
8 changes: 4 additions & 4 deletions Runtime/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { SwiftClosureDeallocator } from "./closure-heap";
import { SwiftClosureDeallocator } from "./closure-heap.js";
import {
LibraryFeatures,
ExportedFunctions,
ref,
pointer,
TypedArray,
ImportedFunctions,
} from "./types";
import * as JSValue from "./js-value";
import { Memory } from "./memory";
} from "./types.js";
import * as JSValue from "./js-value.js";
import { Memory } from "./memory.js";

export class SwiftRuntime {
private _instance: WebAssembly.Instance | null;
Expand Down
4 changes: 2 additions & 2 deletions Runtime/src/js-value.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Memory } from "./memory";
import { assertNever, pointer } from "./types";
import { Memory } from "./memory.js";
import { assertNever, pointer } from "./types.js";

export const enum Kind {
Boolean = 0,
Expand Down
4 changes: 2 additions & 2 deletions Runtime/src/memory.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SwiftRuntimeHeap } from "./object-heap";
import { pointer } from "./types";
import { SwiftRuntimeHeap } from "./object-heap.js";
import { pointer } from "./types.js";

export class Memory {
readonly rawMemory: WebAssembly.Memory;
Expand Down
4 changes: 2 additions & 2 deletions Runtime/src/object-heap.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { globalVariable } from "./find-global";
import { ref } from "./types";
import { globalVariable } from "./find-global.js";
import { ref } from "./types.js";

type SwiftRuntimeHeapEntry = {
id: number;
Expand Down
2 changes: 1 addition & 1 deletion Runtime/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as JSValue from "./js-value";
import * as JSValue from "./js-value.js";

export type ref = number;
export type pointer = number;
Expand Down
Loading