Fixed webpack configuration issue and updated webpack
This commit is contained in:
parent
494cd97442
commit
fa986fcdc9
356
lib/pawsqlite.js
356
lib/pawsqlite.js
@ -1,102 +1,17 @@
|
||||
module.exports =
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = "./src/pawsqlite.mjs");
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ({
|
||||
/******/ (() => { // webpackBootstrap
|
||||
/******/ "use strict";
|
||||
/******/ var __webpack_modules__ = ({
|
||||
|
||||
/***/ "./src/adapter_wrapper.mjs":
|
||||
/*!*********************************!*\
|
||||
!*** ./src/adapter_wrapper.mjs ***!
|
||||
\*********************************/
|
||||
/*! exports provided: wrapAdapter */
|
||||
/***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
||||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wrapAdapter", function() { return wrapAdapter; });
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "wrapAdapter": () => (/* binding */ wrapAdapter)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./pawsqlite_error.mjs */ "./src/pawsqlite_error.mjs");
|
||||
|
||||
|
||||
@ -106,7 +21,7 @@ function wrapAdapter(adapter) {
|
||||
|
||||
["name", "open", "close", "delete", "sql"].forEach((prop) => {
|
||||
if (!(prop in adapter)) {
|
||||
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_0__["PawSQLiteError"](`Invalid adapter: missing property: ${ prop }`);
|
||||
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_0__.PawSQLiteError(`Invalid adapter: missing property: ${ prop }`);
|
||||
}
|
||||
|
||||
if (
|
||||
@ -118,7 +33,7 @@ function wrapAdapter(adapter) {
|
||||
typeof adapter[prop] !== "function"
|
||||
)
|
||||
) {
|
||||
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_0__["PawSQLiteError"]("Invalid adapter: invalid type for property: " +
|
||||
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_0__.PawSQLiteError("Invalid adapter: invalid type for property: " +
|
||||
prop);
|
||||
}
|
||||
|
||||
@ -127,7 +42,7 @@ function wrapAdapter(adapter) {
|
||||
try {
|
||||
return await adapter[prop](...args);
|
||||
} catch (err) {
|
||||
throw _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_0__["PawSQLiteError"].from(err);
|
||||
throw _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_0__.PawSQLiteError.from(err);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
@ -144,12 +59,12 @@ function wrapAdapter(adapter) {
|
||||
/*!**************************!*\
|
||||
!*** ./src/database.mjs ***!
|
||||
\**************************/
|
||||
/*! exports provided: Database */
|
||||
/***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
||||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Database", function() { return Database; });
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "Database": () => (/* binding */ Database)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var _transaction_manager_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./transaction_manager.mjs */ "./src/transaction_manager.mjs");
|
||||
|
||||
|
||||
@ -161,7 +76,7 @@ class Database {
|
||||
this.version = null;
|
||||
this.path = null;
|
||||
|
||||
this.transactionManager = new _transaction_manager_mjs__WEBPACK_IMPORTED_MODULE_0__["TransactionManager"](dbName, this.adapter);
|
||||
this.transactionManager = new _transaction_manager_mjs__WEBPACK_IMPORTED_MODULE_0__.TransactionManager(dbName, this.adapter);
|
||||
}
|
||||
|
||||
async open() {
|
||||
@ -222,13 +137,13 @@ class Database {
|
||||
/*!*********************!*\
|
||||
!*** ./src/log.mjs ***!
|
||||
\*********************/
|
||||
/*! exports provided: log, enableDebug */
|
||||
/***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
||||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "log", function() { return log; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "enableDebug", function() { return enableDebug; });
|
||||
/* 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) {
|
||||
@ -249,79 +164,16 @@ function enableDebug(active) {
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/pawsqlite.mjs":
|
||||
/*!***************************!*\
|
||||
!*** ./src/pawsqlite.mjs ***!
|
||||
\***************************/
|
||||
/*! exports provided: default */
|
||||
/***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony import */ var _database_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./database.mjs */ "./src/database.mjs");
|
||||
/* harmony import */ var _adapter_wrapper_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./adapter_wrapper.mjs */ "./src/adapter_wrapper.mjs");
|
||||
/* harmony import */ var _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./pawsqlite_error.mjs */ "./src/pawsqlite_error.mjs");
|
||||
/* harmony import */ var _log_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./log.mjs */ "./src/log.mjs");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const adapters = [];
|
||||
|
||||
|
||||
/* harmony default export */ __webpack_exports__["default"] = ({
|
||||
open: async function(dbName, options = {}) {
|
||||
const adapter = getAdapter(options.adapter);
|
||||
|
||||
let db = new _database_mjs__WEBPACK_IMPORTED_MODULE_0__["Database"](dbName, adapter);
|
||||
await db.open();
|
||||
return db;
|
||||
},
|
||||
delete: function(dbName, options = {}) {
|
||||
const adapter = getAdapter(options.adapter);
|
||||
|
||||
return adapter.delete(dbName);
|
||||
},
|
||||
registerAdapter: function(adapter) {
|
||||
const wrapped = Object(_adapter_wrapper_mjs__WEBPACK_IMPORTED_MODULE_1__["wrapAdapter"])(adapter);
|
||||
|
||||
if (getAdapter(wrapped.name)) {
|
||||
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_2__["PawSQLiteError"](`An adapter with the name: ${ wrapped.name } ` +
|
||||
`Already exists`);
|
||||
}
|
||||
|
||||
adapters.push(wrapped);
|
||||
},
|
||||
debug: _log_mjs__WEBPACK_IMPORTED_MODULE_3__["enableDebug"],
|
||||
Error: _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_2__["PawSQLiteError"]
|
||||
});
|
||||
|
||||
|
||||
|
||||
function getAdapter(adapterName, silent=false) {
|
||||
const adapter = adapters.find((a) => a.name === adapterName);
|
||||
|
||||
if (!(silent || adapter)) {
|
||||
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_2__["PawSQLiteError"](`Unknown Adapter: ${adapterName}`);
|
||||
}
|
||||
|
||||
return adapter;
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/pawsqlite_error.mjs":
|
||||
/*!*********************************!*\
|
||||
!*** ./src/pawsqlite_error.mjs ***!
|
||||
\*********************************/
|
||||
/*! exports provided: PawSQLiteError */
|
||||
/***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
||||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PawSQLiteError", function() { return PawSQLiteError; });
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "PawSQLiteError": () => (/* binding */ PawSQLiteError)
|
||||
/* harmony export */ });
|
||||
class PawSQLiteError extends Error {
|
||||
static from(err) {
|
||||
const p_err = new PawSQLiteError(err.toString());
|
||||
@ -341,12 +193,12 @@ class PawSQLiteError extends Error {
|
||||
/*!************************!*\
|
||||
!*** ./src/result.mjs ***!
|
||||
\************************/
|
||||
/*! exports provided: Result */
|
||||
/***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
||||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Result", function() { return Result; });
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "Result": () => (/* binding */ Result)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./pawsqlite_error.mjs */ "./src/pawsqlite_error.mjs");
|
||||
|
||||
|
||||
@ -374,12 +226,12 @@ class Result extends Array {
|
||||
/*!*****************************!*\
|
||||
!*** ./src/transaction.mjs ***!
|
||||
\*****************************/
|
||||
/*! exports provided: Transaction */
|
||||
/***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
||||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Transaction", function() { return Transaction; });
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "Transaction": () => (/* binding */ Transaction)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var _result_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./result.mjs */ "./src/result.mjs");
|
||||
/* harmony import */ var _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pawsqlite_error.mjs */ "./src/pawsqlite_error.mjs");
|
||||
|
||||
@ -402,7 +254,7 @@ class Transaction {
|
||||
|
||||
async sql(sql, ...args) {
|
||||
if (this._finalized) {
|
||||
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_1__["PawSQLiteError"]("Transaction has already completed");
|
||||
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_1__.PawSQLiteError("Transaction has already completed");
|
||||
}
|
||||
|
||||
if (!this._ready) {
|
||||
@ -430,7 +282,7 @@ class Transaction {
|
||||
.filter(Array.isArray)
|
||||
.map((a) => a.length);
|
||||
if (parts.length !== subParamLengths.length + 1) {
|
||||
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_1__["PawSQLiteError"]("Unable to build query: sub-" +
|
||||
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_1__.PawSQLiteError("Unable to build query: sub-" +
|
||||
"paramters do not match sub-paramters in query");
|
||||
}
|
||||
|
||||
@ -476,14 +328,14 @@ class Transaction {
|
||||
const match = reg.exec(sql);
|
||||
if (match) {
|
||||
const statement = match[1].toUpperCase();
|
||||
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_1__["PawSQLiteError"]("Manually managing transactions is " +
|
||||
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_1__.PawSQLiteError("Manually managing transactions is " +
|
||||
"forbidden. Found: \"" + statement + "\" statement.");
|
||||
}
|
||||
|
||||
const result = await this.adapter.sql(this.dbName,
|
||||
...this.buildQuery(sql, ...args));
|
||||
|
||||
return new _result_mjs__WEBPACK_IMPORTED_MODULE_0__["Result"](result);
|
||||
return new _result_mjs__WEBPACK_IMPORTED_MODULE_0__.Result(result);
|
||||
}
|
||||
|
||||
async _begin() {
|
||||
@ -492,7 +344,7 @@ class Transaction {
|
||||
|
||||
async _complete(sql) {
|
||||
if (this._finalized) {
|
||||
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_1__["PawSQLiteError"]("Transaction has already completed");
|
||||
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_1__.PawSQLiteError("Transaction has already completed");
|
||||
}
|
||||
this._finalized = true;
|
||||
|
||||
@ -517,7 +369,7 @@ class Transaction {
|
||||
throw error;
|
||||
}
|
||||
|
||||
return new _result_mjs__WEBPACK_IMPORTED_MODULE_0__["Result"](result);
|
||||
return new _result_mjs__WEBPACK_IMPORTED_MODULE_0__.Result(result);
|
||||
}
|
||||
}
|
||||
|
||||
@ -527,12 +379,12 @@ class Transaction {
|
||||
/*!*************************************!*\
|
||||
!*** ./src/transaction_manager.mjs ***!
|
||||
\*************************************/
|
||||
/*! exports provided: TransactionManager */
|
||||
/***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
||||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TransactionManager", function() { return TransactionManager; });
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "TransactionManager": () => (/* binding */ TransactionManager)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var _transaction_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./transaction.mjs */ "./src/transaction.mjs");
|
||||
|
||||
|
||||
@ -545,7 +397,7 @@ class TransactionManager {
|
||||
}
|
||||
|
||||
transaction() {
|
||||
return new _transaction_mjs__WEBPACK_IMPORTED_MODULE_0__["Transaction"](this.dbName, this.adapter,
|
||||
return new _transaction_mjs__WEBPACK_IMPORTED_MODULE_0__.Transaction(this.dbName, this.adapter,
|
||||
this.enqueue.bind(this));
|
||||
}
|
||||
|
||||
@ -592,5 +444,125 @@ class TransactionManager {
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ })["default"];
|
||||
/******/ });
|
||||
/************************************************************************/
|
||||
/******/ // 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/pawsqlite.mjs ***!
|
||||
\***************************/
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var _database_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./database.mjs */ "./src/database.mjs");
|
||||
/* harmony import */ var _adapter_wrapper_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./adapter_wrapper.mjs */ "./src/adapter_wrapper.mjs");
|
||||
/* harmony import */ var _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./pawsqlite_error.mjs */ "./src/pawsqlite_error.mjs");
|
||||
/* harmony import */ var _log_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./log.mjs */ "./src/log.mjs");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const adapters = [];
|
||||
|
||||
|
||||
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
||||
open: async function(dbName, options = {}) {
|
||||
const adapter = getAdapter(options.adapter);
|
||||
|
||||
let db = new _database_mjs__WEBPACK_IMPORTED_MODULE_0__.Database(dbName, adapter);
|
||||
await db.open();
|
||||
return db;
|
||||
},
|
||||
delete: function(dbName, options = {}) {
|
||||
const adapter = getAdapter(options.adapter);
|
||||
|
||||
return adapter.delete(dbName);
|
||||
},
|
||||
registerAdapter: function(adapter) {
|
||||
const wrapped = (0,_adapter_wrapper_mjs__WEBPACK_IMPORTED_MODULE_1__.wrapAdapter)(adapter);
|
||||
|
||||
if (getAdapter(wrapped.name)) {
|
||||
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_2__.PawSQLiteError(`An adapter with the name: ${ wrapped.name } ` +
|
||||
`Already exists`);
|
||||
}
|
||||
|
||||
adapters.push(wrapped);
|
||||
},
|
||||
debug: _log_mjs__WEBPACK_IMPORTED_MODULE_3__.enableDebug,
|
||||
Error: _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_2__.PawSQLiteError
|
||||
});
|
||||
|
||||
|
||||
|
||||
function getAdapter(adapterName, silent=false) {
|
||||
const adapter = adapters.find((a) => a.name === adapterName);
|
||||
|
||||
if (!(silent || adapter)) {
|
||||
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_2__.PawSQLiteError(`Unknown Adapter: ${adapterName}`);
|
||||
}
|
||||
|
||||
return adapter;
|
||||
}
|
||||
})();
|
||||
|
||||
module.exports = __webpack_exports__.default;
|
||||
/******/ })()
|
||||
;
|
||||
//# sourceMappingURL=pawsqlite.js.map
|
File diff suppressed because one or more lines are too long
3704
package-lock.json
generated
3704
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -15,7 +15,7 @@
|
||||
"author": "Ben Ashton",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"webpack": "^4.44.1",
|
||||
"webpack-cli": "^3.3.12"
|
||||
"webpack": "5.x",
|
||||
"webpack-cli": "4.x"
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ var config = {
|
||||
output: {
|
||||
path: __dirname + '/lib',
|
||||
filename: outputFile,
|
||||
library: libraryName,
|
||||
libraryExport: 'default',
|
||||
libraryTarget: 'commonjs2',
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user