Compare commits

...

3 Commits

Author SHA1 Message Date
d3153f9e8a Added webpack and built 2021-03-02 21:12:39 -08:00
eef8fb4284 Corrected default export 2021-03-02 21:11:25 -08:00
bfd39ee013 Add webpack dependency 2021-03-02 21:09:10 -08:00
6 changed files with 1213 additions and 2 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
node_modules
.jshintrc

1030
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -28,4 +28,4 @@
"webpack": "5.x", "webpack": "5.x",
"webpack-cli": "4.x" "webpack-cli": "4.x"
} }
} }

View File

@ -2,7 +2,7 @@ import { PSQLAdapterError } from "./psql_adapter_error.mjs";
import { log, enableDebug } from "./log.mjs"; import { log, enableDebug } from "./log.mjs";
export const PSQLAdapter = { export default {
name: "PawSQLiteCordovaAdapter", name: "PawSQLiteCordovaAdapter",
open: (dbName) => new Promise((resolve, reject) => { open: (dbName) => new Promise((resolve, reject) => {

View File

@ -0,0 +1,178 @@
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "./src/log.mjs":
/*!*********************!*\
!*** ./src/log.mjs ***!
\*********************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "log": () => (/* binding */ log),
/* harmony export */ "enableDebug": () => (/* binding */ enableDebug)
/* harmony export */ });
let DEBUG = false;
function log(...args) {
if (DEBUG) {
console.log(...args);
}
}
function enableDebug(active) {
DEBUG = !!active;
log("PawSQLite-Cordova-Adapter: debugging " + (
DEBUG ? "enabled" : "disabled")
);
}
/***/ }),
/***/ "./src/psql_adapter_error.mjs":
/*!************************************!*\
!*** ./src/psql_adapter_error.mjs ***!
\************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "PSQLAdapterError": () => (/* binding */ PSQLAdapterError)
/* harmony export */ });
class PSQLAdapterError extends Error {
constructor(response) {
if (response.hasOwnProperty("message")) {
super(response.message);
} else {
super();
}
if (response.hasOwnProperty("name")) {
this.name = response.name;
} else {
this.name = "PSQLAdapterError";
}
if (response.hasOwnProperty("trace")) {
this.trace = response.trace;
}
}
toString() {
let str = this.name;
if (this.hasOwnProperty("message")) {
str += ": " + this.message;
}
if (this.hasOwnProperty("trace")) {
str += "\n" + this.trace;
}
return str;
}
}
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(__webpack_module_cache__[moduleId]) {
/******/ return __webpack_module_cache__[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
/*!******************************!*\
!*** ./src/psql_adapter.mjs ***!
\******************************/
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _psql_adapter_error_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./psql_adapter_error.mjs */ "./src/psql_adapter_error.mjs");
/* harmony import */ var _log_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./log.mjs */ "./src/log.mjs");
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
name: "PawSQLiteCordovaAdapter",
open: (dbName) => new Promise((resolve, reject) => {
cordova.exec(resolve, (e) => {
reject(new _psql_adapter_error_mjs__WEBPACK_IMPORTED_MODULE_0__.PSQLAdapterError(e));
}, "PawSQLite", "open", [dbName]);
}),
close: (dbName) => new Promise((resolve, reject) => {
cordova.exec(resolve, (e) => {
reject(new _psql_adapter_error_mjs__WEBPACK_IMPORTED_MODULE_0__.PSQLAdapterError(e));
}, "PawSQLite", "close", [dbName]);
}),
sql: (dbName, sql, ...args) => new Promise((resolve, reject) => {
(0,_log_mjs__WEBPACK_IMPORTED_MODULE_1__.log)(sql);
cordova.exec(resolve, (e) => {
reject(new _psql_adapter_error_mjs__WEBPACK_IMPORTED_MODULE_0__.PSQLAdapterError(e));
}, "PawSQLite", "sql", [dbName, sql, ...args]);
}),
delete: (dbName) => new Promise((resolve, reject) => {
cordova.exec(resolve, (e) => {
reject(new _psql_adapter_error_mjs__WEBPACK_IMPORTED_MODULE_0__.PSQLAdapterError(e));
}, "PawSQLite", "delete", [dbName]);
}),
debug: _log_mjs__WEBPACK_IMPORTED_MODULE_1__.enableDebug
});
})();
module.exports = __webpack_exports__.default;
/******/ })()
;
//# sourceMappingURL=pawsqlite-cordova-adapter.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["webpack://pawsqlite-cordova-adapter/./src/log.mjs","webpack://pawsqlite-cordova-adapter/./src/psql_adapter_error.mjs","webpack://pawsqlite-cordova-adapter/webpack/bootstrap","webpack://pawsqlite-cordova-adapter/webpack/runtime/define property getters","webpack://pawsqlite-cordova-adapter/webpack/runtime/hasOwnProperty shorthand","webpack://pawsqlite-cordova-adapter/webpack/runtime/make namespace object","webpack://pawsqlite-cordova-adapter/./src/psql_adapter.mjs"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;AAEO;AACP;AACA;AACA,G;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA,C;;;;;;;;;;;;;;ACbO;AACP;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,C;;;;;;UC3BA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCrBA;WACA;WACA;WACA;WACA,wCAAwC,yCAAyC;WACjF;WACA;WACA,E;;;;;WCPA,wF;;;;;WCAA;WACA;WACA;WACA,sDAAsD,kBAAkB;WACxE;WACA,+CAA+C,cAAc;WAC7D,E;;;;;;;;;;;;;;;;ACN4D;AACf;;;AAG7C,iEAAe;AACf;;AAEA;AACA;AACA,iBAAiB,qEAAgB;AACjC,KAAK;AACL,GAAG;AACH;AACA;AACA,iBAAiB,qEAAgB;AACjC,KAAK;AACL,GAAG;AACH;AACA,IAAI,6CAAG;AACP;AACA,iBAAiB,qEAAgB;AACjC,KAAK;AACL,GAAG;AACH;AACA;AACA,iBAAiB,qEAAgB;AACjC,KAAK;AACL,GAAG;;AAEH,SAAS,iDAAW;AACpB,CAAC,EAAC","file":"pawsqlite-cordova-adapter.js","sourcesContent":["let DEBUG = false;\n\nexport function log(...args) {\n if (DEBUG) {\n console.log(...args);\n } \n}\n\nexport function enableDebug(active) {\n DEBUG = !!active;\n log(\"PawSQLite-Cordova-Adapter: debugging \" + (\n DEBUG ? \"enabled\" : \"disabled\")\n );\n}","export class PSQLAdapterError extends Error {\n constructor(response) {\n if (response.hasOwnProperty(\"message\")) {\n super(response.message);\n } else {\n super();\n }\n if (response.hasOwnProperty(\"name\")) {\n this.name = response.name;\n } else {\n this.name = \"PSQLAdapterError\";\n }\n if (response.hasOwnProperty(\"trace\")) {\n this.trace = response.trace;\n }\n }\n\n toString() {\n let str = this.name;\n if (this.hasOwnProperty(\"message\")) {\n str += \": \" + this.message;\n }\n if (this.hasOwnProperty(\"trace\")) {\n str += \"\\n\" + this.trace;\n }\n return str;\n }\n}","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { PSQLAdapterError } from \"./psql_adapter_error.mjs\";\nimport { log, enableDebug } from \"./log.mjs\";\n\n\nexport default {\n name: \"PawSQLiteCordovaAdapter\",\n\n open: (dbName) => new Promise((resolve, reject) => {\n cordova.exec(resolve, (e) => {\n reject(new PSQLAdapterError(e));\n }, \"PawSQLite\", \"open\", [dbName]);\n }),\n close: (dbName) => new Promise((resolve, reject) => {\n cordova.exec(resolve, (e) => {\n reject(new PSQLAdapterError(e));\n }, \"PawSQLite\", \"close\", [dbName]);\n }),\n sql: (dbName, sql, ...args) => new Promise((resolve, reject) => {\n log(sql);\n cordova.exec(resolve, (e) => {\n reject(new PSQLAdapterError(e));\n }, \"PawSQLite\", \"sql\", [dbName, sql, ...args]);\n }),\n delete: (dbName) => new Promise((resolve, reject) => {\n cordova.exec(resolve, (e) => {\n reject(new PSQLAdapterError(e));\n }, \"PawSQLite\", \"delete\", [dbName]);\n }),\n\n debug: enableDebug\n};\n"],"sourceRoot":""}