Corrected ES6 exports

This commit is contained in:
Ben Ashton 2021-03-14 21:51:46 -07:00
parent a8af578582
commit 2de1f94b84
5 changed files with 13 additions and 7 deletions

View File

@ -8,6 +8,12 @@
"android" "android"
] ]
}, },
"main": "./www/pawsqlite-cordova-adapter.js",
"exports": {
"import": "./src/psql_adapter.mjs",
"require": "./www/pawsqlite-cordova-adapter.js"
},
"module": "./src/psql_adapter.mjs",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack" "build": "webpack"

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 default { export const PawSQLiteCordovaAdapter = {
name: "PawSQLiteCordovaAdapter", name: "PawSQLiteCordovaAdapter",
open: (dbName) => new Promise((resolve, reject) => { open: (dbName) => new Promise((resolve, reject) => {

View File

@ -9,7 +9,7 @@ var config = {
output: { output: {
path: __dirname + '/www', path: __dirname + '/www',
filename: outputFile, filename: outputFile,
libraryExport: 'default', libraryExport: 'PawSQLiteCordovaAdapter',
libraryTarget: 'commonjs2', libraryTarget: 'commonjs2',
} }
}; };

View File

@ -134,7 +134,7 @@ var __webpack_exports__ = {};
\******************************/ \******************************/
__webpack_require__.r(__webpack_exports__); __webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ "PawSQLiteCordovaAdapter": () => (/* binding */ PawSQLiteCordovaAdapter)
/* harmony 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 _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 import */ var _log_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./log.mjs */ "./src/log.mjs");
@ -142,7 +142,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ const PawSQLiteCordovaAdapter = {
name: "PawSQLiteCordovaAdapter", name: "PawSQLiteCordovaAdapter",
open: (dbName) => new Promise((resolve, reject) => { open: (dbName) => new Promise((resolve, reject) => {
@ -168,11 +168,11 @@ __webpack_require__.r(__webpack_exports__);
}), }),
debug: _log_mjs__WEBPACK_IMPORTED_MODULE_1__.enableDebug debug: _log_mjs__WEBPACK_IMPORTED_MODULE_1__.enableDebug
}); };
})(); })();
module.exports = __webpack_exports__.default; module.exports = __webpack_exports__.PawSQLiteCordovaAdapter;
/******/ })() /******/ })()
; ;
//# sourceMappingURL=pawsqlite-cordova-adapter.js.map //# sourceMappingURL=pawsqlite-cordova-adapter.js.map

View File

@ -1 +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":""} {"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;;;AAGtC;AACP;;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","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 const PawSQLiteCordovaAdapter = {\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":""}