Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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,056 changes: 583 additions & 473 deletions Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export async function createInstantiator(options, swift) {
let tmpParamInts = [];
let tmpParamF32s = [];
let tmpParamF64s = [];


return {
/**
Expand Down Expand Up @@ -84,7 +83,6 @@ export async function createInstantiator(options, swift) {
bjs["swift_js_pop_param_f64"] = function() {
return tmpParamF64s.pop();
}

const TestModule = importObject["TestModule"] = importObject["TestModule"] || {};
TestModule["bjs_checkArray"] = function bjs_checkArray(a) {
try {
Expand All @@ -111,17 +109,15 @@ export async function createInstantiator(options, swift) {
setInstance: (i) => {
instance = i;
memory = instance.exports.memory;

setException = (error) => {
instance.exports._swift_js_exception.value = swift.memory.retain(error)
}
},
/** @param {WebAssembly.Instance} instance */
createExports: (instance) => {
const js = swift.memory.heap;

return {

};
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export async function createInstantiator(options, swift) {
let tmpParamInts = [];
let tmpParamF32s = [];
let tmpParamF64s = [];


return {
/**
Expand Down Expand Up @@ -84,21 +83,18 @@ export async function createInstantiator(options, swift) {
bjs["swift_js_pop_param_f64"] = function() {
return tmpParamF64s.pop();
}


},
setInstance: (i) => {
instance = i;
memory = instance.exports.memory;

setException = (error) => {
instance.exports._swift_js_exception.value = swift.memory.retain(error)
}
},
/** @param {WebAssembly.Instance} instance */
createExports: (instance) => {
const js = swift.memory.heap;

return {
asyncReturnVoid: function bjs_asyncReturnVoid() {
const ret = instance.exports.bjs_asyncReturnVoid();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export async function createInstantiator(options, swift) {
let tmpParamInts = [];
let tmpParamF32s = [];
let tmpParamF64s = [];


return {
/**
Expand Down Expand Up @@ -84,7 +83,6 @@ export async function createInstantiator(options, swift) {
bjs["swift_js_pop_param_f64"] = function() {
return tmpParamF64s.pop();
}

const TestModule = importObject["TestModule"] = importObject["TestModule"] || {};
TestModule["bjs_asyncReturnVoid"] = function bjs_asyncReturnVoid() {
try {
Expand Down Expand Up @@ -155,17 +153,15 @@ export async function createInstantiator(options, swift) {
setInstance: (i) => {
instance = i;
memory = instance.exports.memory;

setException = (error) => {
instance.exports._swift_js_exception.value = swift.memory.retain(error)
}
},
/** @param {WebAssembly.Instance} instance */
createExports: (instance) => {
const js = swift.memory.heap;

return {

};
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,6 @@ const __bjs_createNetworkingResultHelpers = () => {
}
});
};

if (typeof globalThis.Utilities === 'undefined') {
globalThis.Utilities = {};
}
Expand Down Expand Up @@ -433,13 +432,10 @@ export async function createInstantiator(options, swift) {
bjs["swift_js_pop_param_f64"] = function() {
return tmpParamF64s.pop();
}


},
setInstance: (i) => {
instance = i;
memory = instance.exports.memory;


const APIResultHelpers = __bjs_createAPIResultHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift);
enumHelpers.APIResult = APIResultHelpers;
Expand All @@ -460,7 +456,6 @@ export async function createInstantiator(options, swift) {
/** @param {WebAssembly.Instance} instance */
createExports: (instance) => {
const js = swift.memory.heap;

return {
handle: function bjs_handle(result) {
const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.APIResult.lower(result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export const PublicStatus = {
Success: 0,
};


export async function createInstantiator(options, swift) {
let instance;
let memory;
Expand All @@ -46,7 +45,6 @@ export async function createInstantiator(options, swift) {
let tmpParamInts = [];
let tmpParamF32s = [];
let tmpParamF64s = [];


return {
/**
Expand Down Expand Up @@ -109,21 +107,18 @@ export async function createInstantiator(options, swift) {
bjs["swift_js_pop_param_f64"] = function() {
return tmpParamF64s.pop();
}


},
setInstance: (i) => {
instance = i;
memory = instance.exports.memory;

setException = (error) => {
instance.exports._swift_js_exception.value = swift.memory.retain(error)
}
},
/** @param {WebAssembly.Instance} instance */
createExports: (instance) => {
const js = swift.memory.heap;

return {
setDirection: function bjs_setDirection(direction) {
instance.exports.bjs_setDirection(direction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export const SupportedMethod = {
Post: 1,
};


if (typeof globalThis.Networking === 'undefined') {
globalThis.Networking = {};
}
Expand Down Expand Up @@ -68,7 +67,6 @@ export async function createInstantiator(options, swift) {
let tmpParamInts = [];
let tmpParamF32s = [];
let tmpParamF64s = [];


return {
/**
Expand Down Expand Up @@ -147,12 +145,11 @@ export async function createInstantiator(options, swift) {
const obj = TestServer.__construct(pointer);
return swift.memory.retain(obj);
};

},
setInstance: (i) => {
instance = i;
memory = instance.exports.memory;

setException = (error) => {
instance.exports._swift_js_exception.value = swift.memory.retain(error)
}
Expand Down Expand Up @@ -183,8 +180,7 @@ export async function createInstantiator(options, swift) {
static __construct(ptr) {
return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Converter_deinit, Converter.prototype);
}



constructor() {
const ret = instance.exports.bjs_Converter_init();
return Converter.__construct(ret);
Expand All @@ -200,8 +196,7 @@ export async function createInstantiator(options, swift) {
static __construct(ptr) {
return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_HTTPServer_deinit, HTTPServer.prototype);
}



constructor() {
const ret = instance.exports.bjs_HTTPServer_init();
return HTTPServer.__construct(ret);
Expand All @@ -214,8 +209,7 @@ export async function createInstantiator(options, swift) {
static __construct(ptr) {
return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_TestServer_deinit, TestServer.prototype);
}



constructor() {
const ret = instance.exports.bjs_TestServer_init();
return TestServer.__construct(ret);
Expand All @@ -229,7 +223,6 @@ export async function createInstantiator(options, swift) {
HTTPServer,
TestServer,
};

if (typeof globalThis.Networking === 'undefined') {
globalThis.Networking = {};
}
Expand All @@ -248,7 +241,6 @@ export async function createInstantiator(options, swift) {
globalThis.Utils.Converter = exports.Converter;
globalThis.Networking.API.HTTPServer = exports.HTTPServer;
globalThis.Networking.APIV2.Internal.TestServer = exports.TestServer;

return exports;
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ export const Ratio = {
Pi: 3.14159,
};


export async function createInstantiator(options, swift) {
let instance;
let memory;
Expand All @@ -97,7 +96,6 @@ export async function createInstantiator(options, swift) {
let tmpParamInts = [];
let tmpParamF32s = [];
let tmpParamF64s = [];


return {
/**
Expand Down Expand Up @@ -160,21 +158,18 @@ export async function createInstantiator(options, swift) {
bjs["swift_js_pop_param_f64"] = function() {
return tmpParamF64s.pop();
}


},
setInstance: (i) => {
instance = i;
memory = instance.exports.memory;

setException = (error) => {
instance.exports._swift_js_exception.value = swift.memory.retain(error)
}
},
/** @param {WebAssembly.Instance} instance */
createExports: (instance) => {
const js = swift.memory.heap;

return {
setTheme: function bjs_setTheme(theme) {
const themeBytes = textEncoder.encode(theme);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export async function createInstantiator(options, swift) {
let tmpParamInts = [];
let tmpParamF32s = [];
let tmpParamF64s = [];


return {
/**
Expand Down Expand Up @@ -84,7 +83,6 @@ export async function createInstantiator(options, swift) {
bjs["swift_js_pop_param_f64"] = function() {
return tmpParamF64s.pop();
}

const TestModule = importObject["TestModule"] = importObject["TestModule"] || {};
TestModule["bjs_returnAnimatable"] = function bjs_returnAnimatable() {
try {
Expand Down Expand Up @@ -117,17 +115,15 @@ export async function createInstantiator(options, swift) {
setInstance: (i) => {
instance = i;
memory = instance.exports.memory;

setException = (error) => {
instance.exports._swift_js_exception.value = swift.memory.retain(error)
}
},
/** @param {WebAssembly.Instance} instance */
createExports: (instance) => {
const js = swift.memory.heap;

return {

};
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export async function createInstantiator(options, swift) {
let tmpParamInts = [];
let tmpParamF32s = [];
let tmpParamF64s = [];


return {
/**
Expand Down Expand Up @@ -84,7 +83,6 @@ export async function createInstantiator(options, swift) {
bjs["swift_js_pop_param_f64"] = function() {
return tmpParamF64s.pop();
}

const TestModule = importObject["TestModule"] = importObject["TestModule"] || {};
TestModule["bjs_createArrayBuffer"] = function bjs_createArrayBuffer() {
try {
Expand Down Expand Up @@ -187,17 +185,15 @@ export async function createInstantiator(options, swift) {
setInstance: (i) => {
instance = i;
memory = instance.exports.memory;

setException = (error) => {
instance.exports._swift_js_exception.value = swift.memory.retain(error)
}
},
/** @param {WebAssembly.Instance} instance */
createExports: (instance) => {
const js = swift.memory.heap;

return {

};
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export async function createInstantiator(options, swift) {
let tmpParamInts = [];
let tmpParamF32s = [];
let tmpParamF64s = [];


return {
/**
Expand Down Expand Up @@ -84,7 +83,6 @@ export async function createInstantiator(options, swift) {
bjs["swift_js_pop_param_f64"] = function() {
return tmpParamF64s.pop();
}

const TestModule = importObject["TestModule"] = importObject["TestModule"] || {};
TestModule["bjs_createDatabaseConnection"] = function bjs_createDatabaseConnection(config) {
try {
Expand Down Expand Up @@ -221,17 +219,15 @@ export async function createInstantiator(options, swift) {
setInstance: (i) => {
instance = i;
memory = instance.exports.memory;

setException = (error) => {
instance.exports._swift_js_exception.value = swift.memory.retain(error)
}
},
/** @param {WebAssembly.Instance} instance */
createExports: (instance) => {
const js = swift.memory.heap;

return {

};
},
}
Expand Down
Loading
Loading