melonykit 0.4.0 → 0.4.1

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.
@@ -0,0 +1,5 @@
1
+ export default function debug(error) {
2
+ if (!process.env.DEBUG === 'true') return;
3
+
4
+ console.log('[DEBUG] ', error);
5
+ };
@@ -0,0 +1,17 @@
1
+ import { fileURLToPath, pathToFileURL } from 'node:url';
2
+ import { globSync } from 'glob';
3
+
4
+ export default async function importModules(
5
+ srcFolder,
6
+ filePathPatterns,
7
+ callback
8
+ ) {
9
+ const cwd = fileURLToPath(new URL(srcFolder, import.meta.url));
10
+ const filePaths = globSync(filePathPatterns, { cwd, absolute: true });
11
+
12
+ for (const filePath of filePaths) {
13
+ const module = await import(pathToFileURL(filePath).href);
14
+
15
+ await callback?.(module);
16
+ }
17
+ };
@@ -1 +1,3 @@
1
- export { default as importServerModules } from './_import-server-modules.js';
1
+ export { default as importModules } from './_import-modules.js';
2
+ export { default as importRestEndpoints } from './_import-rest-endpoints.js';
3
+ export { default as debug } from './_debug.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Vadim Hermann",
3
3
  "name": "melonykit",
4
- "version": "0.4.0",
4
+ "version": "0.4.1",
5
5
  "type": "module",
6
6
  "description": "Preact based ui and utility functions toolkit",
7
7
  "main": "./dist/index.js",