forked from matrix/element-web
Remove go-sqlite-js and just use sql.js directly
This commit is contained in:
parent
d80285d971
commit
6f43a14c43
|
@ -64,8 +64,6 @@
|
||||||
"favico.js": "^0.3.10",
|
"favico.js": "^0.3.10",
|
||||||
"gemini-scrollbar": "github:matrix-org/gemini-scrollbar#91e1e566",
|
"gemini-scrollbar": "github:matrix-org/gemini-scrollbar#91e1e566",
|
||||||
"gfm.css": "^1.1.2",
|
"gfm.css": "^1.1.2",
|
||||||
"go-sqlite-js": "^0.1.0",
|
|
||||||
"go-http-js-libp2p": "^0.1.0",
|
|
||||||
"highlight.js": "^9.13.1",
|
"highlight.js": "^9.13.1",
|
||||||
"matrix-js-sdk": "3.0.0",
|
"matrix-js-sdk": "3.0.0",
|
||||||
"matrix-react-sdk": "1.7.6",
|
"matrix-react-sdk": "1.7.6",
|
||||||
|
@ -76,6 +74,7 @@
|
||||||
"react": "^16.9.0",
|
"react": "^16.9.0",
|
||||||
"react-dom": "^16.9.0",
|
"react-dom": "^16.9.0",
|
||||||
"sanitize-html": "^1.19.1",
|
"sanitize-html": "^1.19.1",
|
||||||
|
"sql.js": "^1.2.1",
|
||||||
"ua-parser-js": "^0.7.19",
|
"ua-parser-js": "^0.7.19",
|
||||||
"url": "^0.11.0"
|
"url": "^0.11.0"
|
||||||
},
|
},
|
||||||
|
|
|
@ -16,11 +16,11 @@
|
||||||
|
|
||||||
const bundle_path = self.location.href.replace("/dendrite_sw.js", "")
|
const bundle_path = self.location.href.replace("/dendrite_sw.js", "")
|
||||||
|
|
||||||
const version = "0.0.1"
|
const version = "0.0.3"
|
||||||
|
|
||||||
self.importScripts(`${bundle_path}/wasm_exec.js`,
|
self.importScripts(`${bundle_path}/wasm_exec.js`,
|
||||||
`${bundle_path}/go_http_bridge.js`,
|
`${bundle_path}/go_http_bridge.js`,
|
||||||
`${bundle_path}/sqlite_bridge.js`)
|
`${bundle_path}/sqlitejs.js`)
|
||||||
|
|
||||||
function initDendrite() {
|
function initDendrite() {
|
||||||
console.log(`dendrite-sw.js: v${version} SW init`)
|
console.log(`dendrite-sw.js: v${version} SW init`)
|
||||||
|
@ -41,7 +41,7 @@ function initDendrite() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const go = new Go();
|
const go = new Go();
|
||||||
return sqlite_bridge.init(config).then(()=>{
|
return sqlitejs.init(config).then(()=>{
|
||||||
console.log(`dendrite-sw.js: v${version} starting dendrite.wasm...`)
|
console.log(`dendrite-sw.js: v${version} starting dendrite.wasm...`)
|
||||||
return WebAssembly.instantiateStreaming(fetch(`${bundle_path}/../../dendrite.wasm`), go.importObject)
|
return WebAssembly.instantiateStreaming(fetch(`${bundle_path}/../../dendrite.wasm`), go.importObject)
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,22 @@
|
||||||
|
// Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
import initSqlJs from 'sql.js'
|
||||||
|
|
||||||
|
export function init(config) {
|
||||||
|
return initSqlJs(config).then(SQL => {
|
||||||
|
global._go_sqlite = SQL;
|
||||||
|
console.log("Loaded sqlite")
|
||||||
|
})
|
||||||
|
}
|
|
@ -35,9 +35,9 @@ module.exports = (env, argv) => {
|
||||||
"indexeddb_worker": "./src/vector/indexeddb-worker.js",
|
"indexeddb_worker": "./src/vector/indexeddb-worker.js",
|
||||||
"dendrite_sw": "./src/vector/dendrite-sw.js",
|
"dendrite_sw": "./src/vector/dendrite-sw.js",
|
||||||
"mobileguide": "./src/vector/mobile_guide/index.js",
|
"mobileguide": "./src/vector/mobile_guide/index.js",
|
||||||
"sqlite_bridge": "./node_modules/go-sqlite-js/js/bridge.js",
|
"sqlitejs": "./src/vector/sqlitejs.js",
|
||||||
"go_http_bridge": "./node_modules/go-http-js-libp2p/js/bridge.js",
|
"go_http_bridge": "./node_modules/go-http-js-libp2p/js/bridge.js",
|
||||||
"sql_wasm": "./node_modules/go-sqlite-js/node_modules/sql.js/dist/sql-wasm.wasm",
|
"sql_wasm": "./node_modules/sql.js/dist/sql-wasm.wasm",
|
||||||
"dendrite_wasm": "./src/vector/dendrite.wasm",
|
"dendrite_wasm": "./src/vector/dendrite.wasm",
|
||||||
"wasm_exec": "./src/vector/wasm_exec.js",
|
"wasm_exec": "./src/vector/wasm_exec.js",
|
||||||
|
|
||||||
|
@ -364,6 +364,7 @@ module.exports = (env, argv) => {
|
||||||
// tedious in Riot since that can take a while.
|
// tedious in Riot since that can take a while.
|
||||||
hot: false,
|
hot: false,
|
||||||
inline: false,
|
inline: false,
|
||||||
|
writeToDisk: true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -11116,6 +11116,11 @@ sprintf-js@~1.0.2:
|
||||||
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
|
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
|
||||||
integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=
|
integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=
|
||||||
|
|
||||||
|
sql.js@^1.2.1:
|
||||||
|
version "1.2.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/sql.js/-/sql.js-1.2.1.tgz#17881611a6aee06d25d0ea2f35b4609ba80f788b"
|
||||||
|
integrity sha512-i4jlJPfyUG7AAALlgNzZ8ZDMtJq+Q4InuZv/YZ2BjuNfglDKWL+cf65ncXZgoabTz/5Z000ZkbPPM23yzEJbRA==
|
||||||
|
|
||||||
srcset@^1.0.0:
|
srcset@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/srcset/-/srcset-1.0.0.tgz#a5669de12b42f3b1d5e83ed03c71046fc48f41ef"
|
resolved "https://registry.yarnpkg.com/srcset/-/srcset-1.0.0.tgz#a5669de12b42f3b1d5e83ed03c71046fc48f41ef"
|
||||||
|
|
Loading…
Reference in New Issue