From 0938dc861da2cde680ac58131d672ae5d3140cd9 Mon Sep 17 00:00:00 2001 From: Gabriel De Los Rios Date: Sat, 27 Dec 2025 20:14:38 -0300 Subject: [PATCH] build: add wrapped wa-sqlite for angular --- angular.json | 20 +++++++- package-lock.json | 103 +++++++++++++++++++++++++++++++++++++++++- package.json | 3 +- src/app/app.config.ts | 2 + 4 files changed, 124 insertions(+), 4 deletions(-) diff --git a/angular.json b/angular.json index ec4eba0..f701ebf 100644 --- a/angular.json +++ b/angular.json @@ -27,6 +27,16 @@ { "glob": "**/*", "input": "public" + }, + { + "glob": "**/*.js", + "input": "./node_modules/angular-web-sqlite/src/lib/assets", + "output": "./sqlite-client/" + }, + { + "glob": "**/*", + "input": "./node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/", + "output": "./sqlite-client/" } ], "styles": [ @@ -67,7 +77,13 @@ "buildTarget": "groceries-price-tracker:build:development" } }, - "defaultConfiguration": "development" + "defaultConfiguration": "development", + "options": { + "headers": { + "Cross-Origin-Opener-Policy": "same-origin", + "Cross-Origin-Embedder-Policy": "require-corp" + } + } }, "test": { "builder": "@angular/build:unit-test" @@ -75,4 +91,4 @@ } } } -} +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index c8ecbe5..1e1b390 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ "@angular/forms": "^21.0.0", "@angular/platform-browser": "^21.0.0", "@angular/router": "^21.0.0", + "angular-web-sqlite": "^1.0.34", "rxjs": "~7.8.0", "tslib": "^2.3.0" }, @@ -1927,6 +1928,41 @@ } } }, + "node_modules/@ionic/angular": { + "version": "8.7.15", + "resolved": "https://registry.npmjs.org/@ionic/angular/-/angular-8.7.15.tgz", + "integrity": "sha512-2FFmOCoE3CRHR/WAsx+DX084ywxCNEdqrDuqy0iUmi1jbXrYFcC3xnbvBLKRsQtN56nFLS07DkL6wLCCOY7M4A==", + "license": "MIT", + "peer": true, + "dependencies": { + "@ionic/core": "8.7.15", + "ionicons": "^8.0.13", + "jsonc-parser": "^3.0.0", + "tslib": "^2.3.0" + }, + "peerDependencies": { + "@angular/core": ">=16.0.0", + "@angular/forms": ">=16.0.0", + "@angular/router": ">=16.0.0", + "rxjs": ">=7.5.0", + "zone.js": ">=0.13.0" + } + }, + "node_modules/@ionic/core": { + "version": "8.7.15", + "resolved": "https://registry.npmjs.org/@ionic/core/-/core-8.7.15.tgz", + "integrity": "sha512-u1w9c6dx2iuatXIW5X1JY0ighDhQPjBwOHZsrOcnpm891pktuEjJDdyhDulWFa6kKVkXw1q7khwxXBEurvKc2g==", + "license": "MIT", + "peer": true, + "dependencies": { + "@stencil/core": "4.38.0", + "ionicons": "^8.0.13", + "tslib": "^2.1.0" + }, + "engines": { + "node": ">= 16" + } + }, "node_modules/@isaacs/balanced-match": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz", @@ -3899,12 +3935,45 @@ "node": "^20.17.0 || >=22.9.0" } }, + "node_modules/@sqlite.org/sqlite-wasm": { + "version": "3.44.0-build2", + "resolved": "https://registry.npmjs.org/@sqlite.org/sqlite-wasm/-/sqlite-wasm-3.44.0-build2.tgz", + "integrity": "sha512-zFfqHoYxuGQ15+A9W00JGQEfQ+f1b+NNpZRD98I31G0x7es+IiGIh8n52vBoub+q9bZLW++Xa6T1QXuw4eGSDQ==", + "license": "Apache-2.0", + "bin": { + "sqlite-wasm": "bin/index.js" + } + }, "node_modules/@standard-schema/spec": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==", "license": "MIT" }, + "node_modules/@stencil/core": { + "version": "4.38.0", + "resolved": "https://registry.npmjs.org/@stencil/core/-/core-4.38.0.tgz", + "integrity": "sha512-oC3QFKO0X1yXVvETgc8OLY525MNKhn9vISBrbtKnGoPlokJ6rI8Vk1RK22TevnNrHLI4SExNLbcDnqilKR35JQ==", + "license": "MIT", + "peer": true, + "bin": { + "stencil": "bin/stencil" + }, + "engines": { + "node": ">=16.0.0", + "npm": ">=7.10.0" + }, + "optionalDependencies": { + "@rollup/rollup-darwin-arm64": "4.34.9", + "@rollup/rollup-darwin-x64": "4.34.9", + "@rollup/rollup-linux-arm64-gnu": "4.34.9", + "@rollup/rollup-linux-arm64-musl": "4.34.9", + "@rollup/rollup-linux-x64-gnu": "4.34.9", + "@rollup/rollup-linux-x64-musl": "4.34.9", + "@rollup/rollup-win32-arm64-msvc": "4.34.9", + "@rollup/rollup-win32-x64-msvc": "4.34.9" + } + }, "node_modules/@tufjs/canonical-json": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@tufjs/canonical-json/-/canonical-json-2.0.0.tgz", @@ -4211,6 +4280,22 @@ "node": ">= 14.0.0" } }, + "node_modules/angular-web-sqlite": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/angular-web-sqlite/-/angular-web-sqlite-1.0.34.tgz", + "integrity": "sha512-OfV/vA8FEBfb2SjbPB5529ZcjalAUf6WiI+RZcW3V/N1OgRNbM7HrxmIuYJCQ2cm8ZYO6LgOQRmN+ufeAIdM1g==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "@sqlite.org/sqlite-wasm": "3.44.0-build2", + "tslib": "^2.6.2" + }, + "peerDependencies": { + "@angular/common": "13.x || 14.x || 15.x || 16.x || 17.x || 18.x || 19.x || 20.x || 21.x || 22.x", + "@angular/core": "13.x || 14.x || 15.x || 16.x || 17.x || 18.x || 19.x || 20.x || 21.x || 22.x", + "@ionic/angular": "5.x || 6.x || 7.x || 8.x" + } + }, "node_modules/ansi-escapes": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-7.2.0.tgz", @@ -5754,6 +5839,16 @@ "node": "^18.17.0 || >=20.5.0" } }, + "node_modules/ionicons": { + "version": "8.0.13", + "resolved": "https://registry.npmjs.org/ionicons/-/ionicons-8.0.13.tgz", + "integrity": "sha512-2QQVyG2P4wszne79jemMjWYLp0DBbDhr4/yFroPCxvPP1wtMxgdIV3l5n+XZ5E9mgoXU79w7yTWpm2XzJsISxQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "@stencil/core": "^4.35.3" + } + }, "node_modules/ip-address": { "version": "10.1.0", "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.1.0.tgz", @@ -6020,7 +6115,6 @@ "version": "3.3.1", "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.3.1.tgz", "integrity": "sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==", - "dev": true, "license": "MIT" }, "node_modules/jsonparse": { @@ -9291,6 +9385,13 @@ "peerDependencies": { "zod": "^3.25 || ^4" } + }, + "node_modules/zone.js": { + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.16.0.tgz", + "integrity": "sha512-LqLPpIQANebrlxY6jKcYKdgN5DTXyyHAKnnWWjE5pPfEQ4n7j5zn7mOEEpwNZVKGqx3kKKmvplEmoBrvpgROTA==", + "license": "MIT", + "peer": true } } } diff --git a/package.json b/package.json index e39d4fd..6900320 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "@angular/forms": "^21.0.0", "@angular/platform-browser": "^21.0.0", "@angular/router": "^21.0.0", + "angular-web-sqlite": "^1.0.34", "rxjs": "~7.8.0", "tslib": "^2.3.0" }, @@ -40,4 +41,4 @@ "typescript": "~5.9.2", "vitest": "^4.0.8" } -} \ No newline at end of file +} diff --git a/src/app/app.config.ts b/src/app/app.config.ts index cb1270e..3ce8ae9 100644 --- a/src/app/app.config.ts +++ b/src/app/app.config.ts @@ -2,9 +2,11 @@ import { ApplicationConfig, provideBrowserGlobalErrorListeners } from '@angular/ import { provideRouter } from '@angular/router'; import { routes } from './app.routes'; +import { WebSqlite } from 'angular-web-sqlite'; export const appConfig: ApplicationConfig = { providers: [ + {provide: WebSqlite, useClass: WebSqlite}, provideBrowserGlobalErrorListeners(), provideRouter(routes) ]