@yhwh-script/sqlite 1.2.7 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,14 +1,2 @@
1
- # Description
2
- A [yhwh-script](https://github.com/yhwh-script) project with [SQLite WASM](https://www.npmjs.com/package/@sqlite.org/sqlite-wasm) built on <a title="Vite" href="https://vitejs.dev"><img height="20" alt="Vitejs-logo" src="https://vitejs.dev/logo.svg"></a> without examples.
3
-
4
- # Quick Start
5
- Just call `npm install` and `npm run dev`.
6
-
7
- # FYI
8
- You can create Single File Web-Components in dedicated `.html` files inside the `public/elements` folder. `npm run dev` and `npm run build` will generate maps in `src/elements/index.js` which are being fetched in the `/src/main.js` script for defining your CustomElements.
9
-
10
- Please understand that the project structure is leaned on [valid-custom-element-names](https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name), i.e. using a dash ("-") is mandatory.
11
-
12
- In `/src/publicApis/index.js` you can define APIs for your custom-elements (for example to the SQLite module) via the window object.
13
-
14
- Just stick to the examples and you are good to go. Have fun!
1
+ # sqlite
2
+ A production-ready serverless SQLite database inside your browser.
@@ -1,15 +1,20 @@
1
1
  import sqlite3InitModule from '@sqlite.org/sqlite-wasm';
2
- import { log, error } from '../logger'
3
2
 
4
3
  // https://www.npmjs.com/package/@sqlite.org/sqlite-wasm
5
4
  // https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers
6
5
 
6
+ export const name = "sqlite";
7
+
7
8
  const workers = {};
8
- let publicAPI = {};
9
9
 
10
- export function getWorker(name = 'default') {
11
- let worker = workers[name];
12
- return worker ? worker : undefined;
10
+ function initalizeWorker(name) {
11
+ let worker = new Worker(new URL('./sqliteWorker.js', import.meta.url), { type: 'module' });
12
+ if (workers[name]) {
13
+ console.error("InstantiationError: already taken");
14
+ worker.terminate();
15
+ } else {
16
+ workers[name] = worker;
17
+ }
13
18
  }
14
19
 
15
20
  export function createDB(name = 'default') {
@@ -29,7 +34,40 @@ export function createDB(name = 'default') {
29
34
  });
30
35
  }
31
36
 
32
- export function executeQuery({ sql, values }, name = 'default') {
37
+ export async function deleteAndTerminateDB(name) {
38
+ var root = await navigator.storage.getDirectory();
39
+ let fileSystemFileHandle = await root.getFileHandle(`${name}.sqlite3`);
40
+ if (fileSystemFileHandle) {
41
+ let worker = workers[name];
42
+ worker.onmessage = async function ({ data }) {
43
+ const { type } = data;
44
+ if (type === 'closed') {
45
+ console.log("Removing...", fileSystemFileHandle);
46
+ await fileSystemFileHandle.remove();
47
+ await worker.terminate();
48
+ }
49
+ delete workers[name];
50
+ }
51
+ worker.postMessage({ action: 'closeDB' });
52
+ }
53
+ }
54
+
55
+ export function downloadDB(name = 'default') {
56
+ let worker = workers[name];
57
+ if (worker) {
58
+ worker.onmessage = function ({ data }) {
59
+ const { type } = data;
60
+ if (type === 'application/vnd.sqlite3') {
61
+ let downloadChannel = new BroadcastChannel("download_channel");
62
+ downloadChannel.postMessage(data);
63
+ downloadChannel.close();
64
+ }
65
+ }
66
+ worker.postMessage({ action: 'downloadDB' });
67
+ }
68
+ }
69
+
70
+ export function executeQuery(sql, name = 'default') {
33
71
  return new Promise((resolve, reject) => {
34
72
  let worker = getWorker(name);
35
73
  if (worker) {
@@ -43,42 +81,51 @@ export function executeQuery({ sql, values }, name = 'default') {
43
81
  worker.onerror = (error) => {
44
82
  reject(error);
45
83
  };
46
- if (values && sql.indexOf("$") != -1) {
47
- values.forEach(
48
- function replacePlaceholder(item, index) {
49
- sql = sql.replace("$" + (index + 1), `'${item}'`);
50
- }
51
- );
52
- }
53
84
  worker.postMessage({ action: "executeQuery", sql });
54
85
  } else {
55
86
  reject(new Error("No worker"));
56
87
  }
57
- })
88
+ });
58
89
  }
59
90
 
60
- export function downloadDB(name = 'default') {
61
- let worker = workers[name];
62
- if (worker) {
63
- worker.onmessage = function ({ data }) {
64
- const { type } = data;
65
- if (type === 'application/vnd.sqlite3') {
66
- let downloadChannel = new BroadcastChannel("download_channel");
67
- downloadChannel.postMessage(data);
68
- downloadChannel.close();
91
+ export function executeStatement({ sql, values, name = "default" }) {
92
+ return new Promise((resolve, reject) => {
93
+ let worker = getWorker(name);
94
+ if (worker) {
95
+ worker.onmessage = function ({ data }) {
96
+ const { type } = data;
97
+ if (type === 'application/json') {
98
+ const { result } = data;
99
+ resolve(result);
100
+ }
69
101
  }
102
+ worker.onerror = (error) => {
103
+ reject(error);
104
+ };
105
+ worker.postMessage({ action: "prepareStatement", sql, values });
106
+ } else {
107
+ reject(new Error("No worker"));
70
108
  }
71
- worker.postMessage({ action: 'downloadDB' });
72
- }
109
+ });
110
+ }
111
+
112
+ export function getWorker(name = 'default') {
113
+ let worker = workers[name];
114
+ return worker ? worker : undefined;
115
+ }
116
+
117
+ export function getWorkers() {
118
+ return workers;
73
119
  }
74
120
 
75
121
  export function uploadDB(fileName, arrayBuffer) {
76
122
  let [name, extension] = fileName.split(".");
77
- if (extension === 'sqlite3') {
123
+ if (['sqlite', 'sqlite3'].includes(extension)) {
78
124
  let worker = workers[name];
79
125
  if (!worker) {
80
126
  initalizeWorker(name);
81
127
  worker = getWorker(name);
128
+ console.log({worker})
82
129
  } // TODO: allow overwrite
83
130
  worker.postMessage({ action: 'uploadDB', name, arrayBuffer });
84
131
  } else {
@@ -86,41 +133,20 @@ export function uploadDB(fileName, arrayBuffer) {
86
133
  }
87
134
  }
88
135
 
89
- export async function deleteDB(name) {
90
- var root = await navigator.storage.getDirectory();
91
- let fileSystemFileHandle = await root.getFileHandle(`${name}.sqlite3`);
92
- if (fileSystemFileHandle) {
93
- let worker = workers[name];
94
- worker.onmessage = async function ({ data }) {
95
- const { type } = data;
96
- if (type === 'closed') {
97
- log("Removing...", fileSystemFileHandle);
98
- await fileSystemFileHandle.remove();
99
- await worker.terminate();
100
- }
101
- delete workers[name];
102
- }
103
- worker.postMessage({ action: 'closeDB' });
104
- }
105
- }
106
-
107
- function initalizeWorker(name) {
108
- let worker = new Worker(new URL('./sqliteWorker.js', import.meta.url), { type: 'module' });
109
- if (workers[name]) {
110
- error("InstantiationError: already taken");
111
- worker.terminate();
112
- } else {
113
- workers[name] = worker;
114
- }
136
+ export function terminate(name = 'default') {
137
+ let worker = workers[name];
138
+ if (worker) {
139
+ worker.postMessage({ command: 'terminate' });
140
+ }
115
141
  }
116
142
 
117
143
  if (window.Worker) {
118
144
  try {
119
145
  // instantiation test
120
- const sqlite3 = await sqlite3InitModule({ print: log, printErr: error });
121
- log('Running SQLite3 version', sqlite3.version.libVersion);
146
+ const sqlite3 = await sqlite3InitModule({ print: console.log, printErr: console.error });
147
+ console.log('Running SQLite3 version', sqlite3.version.libVersion);
122
148
  } catch (err) {
123
- error('Initialization error:', err.name, err.message);
149
+ console.error('Initialization error:', err.name, err.message);
124
150
  }
125
151
  } else {
126
152
  console.error('Your browser doesn\'t support web workers.');
package/package.json CHANGED
@@ -3,29 +3,20 @@
3
3
  "bugs": {
4
4
  "url": "https://github.com/yhwh-script/sqlite/issues"
5
5
  },
6
- "devDependencies": {
7
- "@vitejs/plugin-basic-ssl": "^2.0.0",
8
- "vite": "^6.2.0"
9
- },
6
+ "description": "A production-ready serverless SQLite database inside your browser.",
10
7
  "dependencies": {
11
- "@sqlite.org/sqlite-wasm": "^3.49.1-build2"
8
+ "@sqlite.org/sqlite-wasm":"^3.51.2-build5"
12
9
  },
13
- "description": "This is a @yhwh-script app with SQLite support.",
14
10
  "homepage": "https://github.com/yhwh-script/sqlite#readme",
15
11
  "keywords": [
16
- "CSS",
17
- "CustomElements",
18
- "HTML",
19
12
  "JavaScript",
20
- "OPFS",
21
- "SFC",
22
- "Single File Components",
23
13
  "SQLite",
24
- "Vanilla",
25
- "Vite",
26
- "WebComponents"
14
+ "OPFS",
15
+ "WebAssembly",
16
+ "vanilla"
27
17
  ],
28
18
  "license": "Unlicense",
19
+ "main": "index.js",
29
20
  "name": "@yhwh-script/sqlite",
30
21
  "publishConfig": {
31
22
  "access": "public"
@@ -34,12 +25,6 @@
34
25
  "type": "git",
35
26
  "url": "git+https://github.com/yhwh-script/sqlite.git"
36
27
  },
37
- "scripts": {
38
- "dev": "npm run gen && vite",
39
- "gen": "node gen.cjs",
40
- "build": "npm run gen && vite build",
41
- "preview": "vite preview"
42
- },
43
28
  "type": "module",
44
- "version": "1.2.7"
29
+ "version": "2.0.1"
45
30
  }
@@ -16,14 +16,51 @@ onmessage = async function ({ data }) {
16
16
  }
17
17
  case 'executeQuery': {
18
18
  const { sql } = data;
19
- log(sql);
20
19
  try {
21
- const result = db.exec({ sql, returnValue: "resultRows" });
20
+ const result = await db.exec({ sql, returnValue: "resultRows" });
21
+ // console.log(sql, result);
22
22
  postMessage({ result, type: "application/json" });
23
23
  } catch (e) {
24
24
  if (e.message.indexOf("SQLITE_CANTOPEN") != -1) {
25
- info("Info: Currently no SQLite database available for this worker. Upload a new database or reload the page.")
25
+ info("Info: Currently no SQLite database available for this worker. Upload a new database or reload the page.");
26
26
  }
27
+ if (e.message.indexOf("SQLITE_CONSTRAINT_UNIQUE") != -1) {
28
+ error("Error executing SQL statement", sql, e.message);
29
+ }
30
+ }
31
+ break;
32
+ }
33
+ case 'prepareStatement': {
34
+ const { sql, values } = data;
35
+ let stmt;
36
+ try {
37
+ // console.log(sql, values);
38
+ stmt = await db.prepare(sql, values);
39
+ const columns = stmt.getColumnNames();
40
+ // console.log("columns", columns);
41
+ stmt.bind(values);
42
+ // console.log("stmt", stmt)
43
+ const result = [];
44
+ while (stmt.step()) {
45
+ let row = stmt.get([]);
46
+ let zipped = columns.map(function (columnName, index) {
47
+ return [columnName, row[index]];
48
+ });
49
+ let obj = Object.fromEntries(zipped);
50
+ result.push(obj);
51
+ }
52
+ // console.log("RESULT", result)
53
+ postMessage({ result, type: "application/json" });
54
+ } catch (e) {
55
+ if (e.message.indexOf("SQLITE_CANTOPEN") != -1) {
56
+ info("Info: Currently no SQLite database available for this worker. Upload a new database or reload the page.");
57
+ } else if (e.message.indexOf("SQLITE_CONSTRAINT_UNIQUE") != -1) {
58
+ error("Error executing SQL statement", sql, e.message);
59
+ } else {
60
+ error("Error executing SQL statement", sql, e.message);
61
+ }
62
+ } finally {
63
+ stmt.finalize();
27
64
  }
28
65
  break;
29
66
  }
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="32" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path fill="#F7DF1E" d="M0 0h256v256H0V0Z"></path><path d="m67.312 213.932l19.59-11.856c3.78 6.701 7.218 12.371 15.465 12.371c7.905 0 12.89-3.092 12.89-15.12v-81.798h24.057v82.138c0 24.917-14.606 36.259-35.916 36.259c-19.245 0-30.416-9.967-36.087-21.996m85.07-2.576l19.588-11.341c5.157 8.421 11.859 14.607 23.715 14.607c9.969 0 16.325-4.984 16.325-11.858c0-8.248-6.53-11.17-17.528-15.98l-6.013-2.58c-17.357-7.387-28.87-16.667-28.87-36.257c0-18.044 13.747-31.792 35.228-31.792c15.294 0 26.292 5.328 34.196 19.247l-18.732 12.03c-4.125-7.389-8.591-10.31-15.465-10.31c-7.046 0-11.514 4.468-11.514 10.31c0 7.217 4.468 10.14 14.778 14.608l6.014 2.577c20.45 8.765 31.963 17.7 31.963 37.804c0 21.654-17.012 33.51-39.867 33.51c-22.339 0-36.774-10.654-43.819-24.574"></path></svg>
@@ -1,6 +0,0 @@
1
- :root {
2
- * {
3
- box-sizing: border-box;
4
- margin: 0;
5
- }
6
- }
package/gen.cjs DELETED
@@ -1,32 +0,0 @@
1
- const fs = require('fs')
2
- const { join } = require('path');
3
-
4
- const constants = {
5
- ELEMENTS_DIR: join('.', 'elements'),
6
- PUBLIC_ELEMENTS_DIR: join('.', 'public', 'elements'),
7
- SRC_ELEMENTS_DIR: join('.', 'src', 'elements'),
8
- }
9
-
10
- const elements = [];
11
-
12
- fs.readdirSync(constants.PUBLIC_ELEMENTS_DIR, { withFileTypes: true })
13
- .filter((dir) => dir.isDirectory())
14
- .forEach((folder) => {
15
- console.log(folder);
16
- const fileNames = fs.readdirSync(
17
- join(constants.PUBLIC_ELEMENTS_DIR, folder.name)
18
- );
19
- fileNames.forEach((fileName) => {
20
- const dashSplit = fileName.split('-');
21
- const prefix = dashSplit[0];
22
- const dotSplit = dashSplit[1].split('.');
23
- const suffix = dotSplit[0];
24
-
25
- elements.push(join(constants.ELEMENTS_DIR, folder.name, prefix + '-' + suffix + '.html'))
26
- });
27
- });
28
-
29
- fs.writeFileSync(
30
- join(constants.SRC_ELEMENTS_DIR, 'index.js'),
31
- `export const htmlFiles=${JSON.stringify(elements)};`
32
- )
package/index.html DELETED
@@ -1,19 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
-
4
- <head>
5
- <link rel="icon" type="image/svg+xml" href="./assets/javascript.svg" />
6
- <link rel="stylesheet" href="./assets/style/default.css">
7
- <meta charset="UTF-8">
8
- <meta name="description" content="yhwh-script is a vite build on top of vanilla JavaScript WebComponents with an optional SQLite WASM database.">
9
- <meta name="keywords" content="HTML, CSS, JavaScript, WebComponents, CustomElements, SFC, Vite, SQLite">
10
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
11
- <title>@yhwh-script/sqlite</title>
12
- </head>
13
-
14
- <body>
15
- <sqlite-control></sqlite-control>
16
- <script type="module" src="/src/main.js" defer></script>
17
- </body>
18
-
19
- </html>
@@ -1 +0,0 @@
1
- export const htmlFiles=["elements/animals/animals-li.html","elements/animals/animals-view.html","elements/home/home-app.html","elements/home/home-header.html","elements/home/home-navigation.html","elements/home/home-switch.html","elements/quick/quick-delete.html"];
@@ -1,86 +0,0 @@
1
- <script>
2
- const { log, error } = window.Logger;
3
- const { uploadDB, downloadDB, deleteDB } = window.SQLite;
4
-
5
- const uploadButton = shadowDocument.querySelector('#uploadButton');
6
- uploadButton.querySelector('click', (e) => {
7
- let confirmation = prompt("Pressing OK will overwrite current database! Please write OK.", "");
8
- if (confirmation && confirmation.toLowerCase() == "ok") {
9
- log("OK to overwrite current database...");
10
- } else {
11
- alert("Canceled.");
12
- e.preventDefault();
13
- }
14
- });
15
- uploadButton.addEventListener('change', () => {
16
- // TODO accept sqlite3 files only
17
- try {
18
- const file = uploadButton.files[0];
19
- if (!file) return;
20
- const reader = new FileReader();
21
- reader.addEventListener('load', (e) => {
22
- uploadDB(file.name, e.target.result); // e.target.result is an ArrayBuffer with the file's contents
23
- });
24
- reader.readAsArrayBuffer(file);
25
- } catch (e) {
26
- error(e);
27
- }
28
- });
29
-
30
- const downloadButton = shadowDocument.querySelector('#downloadButton');
31
- downloadButton.addEventListener('click', (e) => {
32
- let databaseName = prompt("Please enter the name of the database to download.", "");
33
- const downloadChannel = new BroadcastChannel("download_channel");
34
- downloadChannel.onmessage = (message) => {
35
- if (message.data.error) {
36
- switch (message.data.error) {
37
- case "SQLITE_NOMEM":
38
- alert("Nothing to download. DB empty.");
39
- break;
40
- default:
41
- alert("Unknown Error.");
42
- }
43
- } else {
44
- const a = shadowDocument.querySelector('#downloadLink');
45
- a.href = window.URL.createObjectURL(message.data);
46
- a.download = (`${databaseName}.sqlite3`);
47
- a.addEventListener('click', function () {
48
- setTimeout(function () {
49
- window.URL.revokeObjectURL(a.href);
50
- a.remove();
51
- }, 500);
52
- });
53
- a.click();
54
- }
55
- };
56
- downloadDB(databaseName);
57
- });
58
-
59
- const resetButton = shadowDocument.querySelector('#resetButton');
60
- resetButton.addEventListener('click', async (e) => {
61
- let databaseName = null;
62
- try {
63
- databaseName = prompt("Pressing OK will reset specified database! Please enter the name of the database.", "");
64
- if (databaseName && databaseName.toLowerCase()) {
65
- deleteDB(databaseName);
66
- } else {
67
- alert("Canceled.");
68
- e.preventDefault();
69
- }
70
- } catch (err) {
71
- if (err.name === 'NotFoundError') {
72
- error(`${err.name} (${databaseName}.sqlite3): ${err.message}`)
73
- }
74
- }
75
- });
76
- </script>
77
-
78
- <template>
79
- <span>
80
- <label for="uploadButton">Upload DB</label>
81
- <input type="file" id="uploadButton" />
82
- </span>
83
- <button type="button" id="downloadButton">Download DB</button>
84
- <button type="button" id="resetButton">Reset DB</button>
85
- <a id="downloadLink" hidden></a>
86
- </template>
@@ -1 +0,0 @@
1
- export const htmlFiles=["elements/sqlite/sqlite-control.html"];
package/src/main.js DELETED
@@ -1,94 +0,0 @@
1
- import './publicApis'
2
- import { htmlFiles } from './elements';
3
-
4
- for (const filePath of htmlFiles) {
5
- const fileName = filePath.split("/").pop();
6
- const dashSplit = fileName.split('-');
7
- const prefix = dashSplit[0];
8
- const dotSplit = dashSplit[1].split('.');
9
- const suffix = dotSplit[0];
10
-
11
- fetch(filePath).then(file => file.text()).then(html => {
12
- const fragment = document.createRange().createContextualFragment(html);
13
- const scriptFragment = fragment.querySelector("script");
14
- const styleFragment = fragment.querySelector("style");
15
- const templateFragment = fragment.querySelector("template");
16
-
17
- customElements.define(`${prefix}-${suffix}`, class extends HTMLElement {
18
- static observedAttributes = ["data-state"];
19
- constructor() {
20
- super();
21
- this.attachShadow({ mode: "open" });
22
- }
23
- connectedCallback() {
24
- this.hostDataIDs = []; // the hostDataIDs are used to getDOM from the script
25
- this.dataset.id = Math.random().toString(16).substring(2, 8);
26
- let hostElement = this;
27
- while (hostElement && hostElement.dataset.id) {
28
- this.hostDataIDs.push(hostElement.dataset.id);
29
- hostElement = hostElement.getRootNode().host;
30
- }
31
- this.shadowRoot.replaceChildren();
32
- if (scriptFragment?.getAttributeNames().includes('prefer')) {
33
- this.#appendScript();
34
- this.#appendTemplate();
35
- this.#appendStyle();
36
- } else {
37
- this.#appendTemplate();
38
- this.#appendStyle();
39
- this.#appendScript();
40
- }
41
- }
42
- attributeChangedCallback(name, oldValue, newValue) {
43
- if (this.isConnected) {
44
- if (oldValue != newValue) {
45
- this.replaceWith(this.cloneNode(false)); // remove all listeners and reconstruct
46
- }
47
- }
48
- }
49
- #createScript() {
50
- const scriptElement = document.createElement("script");
51
- scriptElement.setAttribute("type", "module");
52
- scriptElement.textContent = `
53
- const shadowDocument = (function getDOM(hostDataIDs = '${this.hostDataIDs.toReversed().toString()}') {
54
- let shadowDocument = document;
55
- for (let hostDataID of hostDataIDs.split(',')) {
56
- const host = shadowDocument.querySelector('[data-id="' + hostDataID + '"]');
57
- if (host) {
58
- shadowDocument = host.shadowRoot;
59
- } else {
60
- return null;
61
- }
62
- }
63
- return shadowDocument;
64
- })();
65
-
66
- const $ = (query) => shadowDocument.querySelector(query);
67
- const $$ = (query) => shadowDocument.querySelectorAll(query);
68
- const state = shadowDocument.host.dataset.state ? JSON.parse(shadowDocument.host.dataset.state) : undefined;
69
-
70
- ${scriptFragment ? scriptFragment.textContent : ''}
71
- `;
72
- return scriptElement;
73
- }
74
- #appendScript() {
75
- if (scriptFragment) {
76
- let scriptElement = this.#createScript(); // TODO: compile template to use state
77
- this.shadowRoot.appendChild(scriptElement);
78
- }
79
- }
80
- #appendStyle() {
81
- if (styleFragment) {
82
- let clonedStyle = styleFragment.cloneNode(true);
83
- this.shadowRoot.appendChild(clonedStyle);
84
- }
85
- }
86
- #appendTemplate() {
87
- if (templateFragment) {
88
- let documentFragment = document.createRange().createContextualFragment(templateFragment.innerHTML)
89
- this.shadowRoot.appendChild(documentFragment);
90
- }
91
- }
92
- });
93
- });
94
- }
@@ -1,11 +0,0 @@
1
- const LOG_LEVEL = 5; // 2 ERROR, 3 WARN, 4 INFO, 5 DEBUG
2
-
3
- export function error(...args) { if (LOG_LEVEL >= 2) console.error(...args); }
4
-
5
- export function warn(...args) { if (LOG_LEVEL >= 3) console.warn(...args); }
6
-
7
- export function log(...args) { if (LOG_LEVEL >= 4) console.log(...args); }
8
-
9
- export function info(...args) { if (LOG_LEVEL >= 4) console.info(...args); }
10
- // For DEBUG log level: verbose must be turned on in Dev Tools
11
- export function debug(...args) { if (LOG_LEVEL >= 5) console.debug(...args); }
@@ -1 +0,0 @@
1
- Please, do not import sqlite module directly. Use an API!
@@ -1,3 +0,0 @@
1
- import { createDB, executeQuery, downloadDB, uploadDB, deleteDB } from '../modules/sqlite'
2
-
3
- export { createDB, executeQuery, downloadDB, uploadDB, deleteDB };
@@ -1,5 +0,0 @@
1
- import * as Logger from '../modules/logger'
2
- window.Logger = Logger;
3
-
4
- import * as SQLite from './SQLite.js'
5
- window.SQLite = SQLite;
package/vite.config.js DELETED
@@ -1,21 +0,0 @@
1
- import { defineConfig } from 'vite';
2
- import basicSsl from '@vitejs/plugin-basic-ssl';
3
-
4
- export default defineConfig({
5
- build: {
6
- target: 'esnext'
7
- },
8
- server: {
9
- port: 3443,
10
- headers: {
11
- 'Cross-Origin-Opener-Policy': 'same-origin',
12
- 'Cross-Origin-Embedder-Policy': 'require-corp',
13
- },
14
- },
15
- optimizeDeps: {
16
- exclude: ['@sqlite.org/sqlite-wasm'],
17
- },
18
- plugins: [
19
- basicSsl()
20
- ]
21
- });
File without changes