beanbagdb 0.5.3 → 0.5.41

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "beanbagdb",
3
- "version": "0.5.3",
3
+ "version": "0.5.41",
4
4
  "description": "A JS library to introduce a schema layer to a No-SQL local database",
5
5
  "main": "dist/beanbagdb.esm.js",
6
6
  "module": "dist/beanbagdb.esm.js",
package/rollup.config.js CHANGED
@@ -6,26 +6,26 @@ import pkg from './package.json' assert { type: "json" }; // Import package.json
6
6
 
7
7
  export default [
8
8
  // For Node.js (CommonJS and ESM)
9
- {
10
- input: 'src/index.js',
11
- output: [
12
- // {
13
- // file: pkg.main, // Points to the CJS build in package.json
14
- // format: 'cjs', // CommonJS format
15
- // sourcemap: true,
16
- // },
17
- {
18
- file: pkg.module, // Points to the ES module build in package.json
19
- format: 'esm', // ES module format
20
- sourcemap: true,
21
- },
22
- ],
23
- plugins: [
24
- resolve(), // Help Rollup find Node modules
25
- commonjs(), // Convert CommonJS modules to ES6
26
- json(), // Allow importing package.json without import assertion issues
27
- ],
28
- },
9
+ // {
10
+ // input: 'src/index.js',
11
+ // output: [
12
+ // // {
13
+ // // file: pkg.main, // Points to the CJS build in package.json
14
+ // // format: 'cjs', // CommonJS format
15
+ // // sourcemap: true,
16
+ // // },
17
+ // {
18
+ // file: pkg.module, // Points to the ES module build in package.json
19
+ // format: 'esm', // ES module format
20
+ // sourcemap: true,
21
+ // },
22
+ // ],
23
+ // plugins: [
24
+ // resolve(), // Help Rollup find Node modules
25
+ // commonjs(), // Convert CommonJS modules to ES6
26
+ // json(), // Allow importing package.json without import assertion issues
27
+ // ],
28
+ // },
29
29
  // For browsers (ESM with a version number injected)
30
30
  {
31
31
  input: 'src/index.js',
package/src/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import "./utils"
1
2
  import BeanBagDB from "./beanbagdb";
2
3
  import BeanBagDB_CouchDB from "./couchdb";
3
4
  import BeanBagDB_PouchDB from "./pouchdb";
package/src/utils.js CHANGED
@@ -1,40 +1,45 @@
1
- import { readFile } from 'fs/promises';
2
- import { fileURLToPath } from 'url';
3
- import { dirname, join } from 'path';
4
-
5
- // Get the current directory
6
- const __filename = fileURLToPath(import.meta.url);
7
- const __dirname = dirname(__filename);
1
+ import pkg from '../package.json' assert { type: "json" }; // Import package.json directly
8
2
 
9
- // Adjust path to point to the correct location of package.json (move up from /src)
10
- const packageJsonPath = join(__dirname, '../package.json'); // Adjust to point to the correct folder
3
+ // import { readFile } from 'fs/promises';
4
+ // import { fileURLToPath } from 'url';
5
+ // import { dirname, join } from 'path';
11
6
 
12
- function isNode() {
13
- return typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
14
- }
7
+ // // Get the current directory
8
+ // const __filename = fileURLToPath(import.meta.url);
9
+ // const __dirname = dirname(__filename);
15
10
 
11
+ // // Adjust path to point to the correct location of package.json (move up from /src)
12
+ // const packageJsonPath = join(__dirname, '../package.json'); // Adjust to point to the correct folder
16
13
 
17
- // Function to read package.json and get the version
18
- async function getPackageVersionNode() {
19
- try {
20
- const data = await readFile(packageJsonPath, 'utf-8');
21
- const packageJson = JSON.parse(data);
22
- return packageJson.version;
23
- } catch (error) {
24
- console.error('Error reading package.json:', error);
25
- throw error;
26
- }
27
- }
14
+ // function isNode() {
15
+ // return typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
16
+ // }
28
17
 
29
18
 
19
+ // // Function to read package.json and get the version
20
+ // async function getPackageVersionNode() {
21
+ // try {
22
+ // const data = await readFile(packageJsonPath, 'utf-8');
23
+ // const packageJson = JSON.parse(data);
24
+ // return packageJson.version;
25
+ // } catch (error) {
26
+ // console.error('Error reading package.json:', error);
27
+ // throw error;
28
+ // }
29
+ // }
30
30
 
31
31
  export async function getPackageVersion() {
32
- if (isNode()) {
33
- return await getPackageVersionNode(); // Node.js environment
34
- } else {
35
- return process.env.PACKAGE_VERSION; // Browser environment
36
- }
32
+ //if (isNode()) {
33
+ // return await getPackageVersionNode(); // Node.js environment
34
+ //} else {
35
+ // return process.env.PACKAGE_VERSION; // Browser environment
36
+ //}
37
+ return pkg.version
37
38
  }
38
39
 
39
40
  // getPackageVersion().then(version => console.log('Package version:', version));
40
-
41
+ import { fileURLToPath } from 'url';
42
+ import { dirname } from 'path';
43
+
44
+ export const __filename = fileURLToPath(import.meta.url);
45
+ export const __dirname = dirname(__filename);