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/dist/beanbagdb.esm.js +146 -79
- package/dist/beanbagdb.esm.js.map +1 -1
- package/package.json +1 -1
- package/rollup.config.js +20 -20
- package/src/index.js +1 -0
- package/src/utils.js +34 -29
- package/dist/beanbagdb.cjs.js +0 -153242
- package/dist/beanbagdb.cjs.js.map +0 -1
package/package.json
CHANGED
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
package/src/utils.js
CHANGED
|
@@ -1,40 +1,45 @@
|
|
|
1
|
-
import {
|
|
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
|
-
//
|
|
10
|
-
|
|
3
|
+
// import { readFile } from 'fs/promises';
|
|
4
|
+
// import { fileURLToPath } from 'url';
|
|
5
|
+
// import { dirname, join } from 'path';
|
|
11
6
|
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
//
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
34
|
-
} else {
|
|
35
|
-
|
|
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);
|