@constatic/base 0.0.1-beta.10 → 0.0.1-beta.11
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/bootstrap.d.ts +1 -4
- package/dist/modules.d.ts +3 -2
- package/dist/modules.js +10 -7
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/bootstrap.d.ts
CHANGED
|
@@ -12,8 +12,5 @@ export interface BootstrapOptions extends CustomClientOptions {
|
|
|
12
12
|
}
|
|
13
13
|
export declare function bootstrap(options: BootstrapOptions): Promise<{
|
|
14
14
|
client: Client<boolean>;
|
|
15
|
-
imports:
|
|
16
|
-
module: any;
|
|
17
|
-
filepath: string;
|
|
18
|
-
}[];
|
|
15
|
+
imports: import("./modules.js").ModuleImported[];
|
|
19
16
|
}>;
|
package/dist/modules.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface ModuleImported {
|
|
2
2
|
module: any;
|
|
3
3
|
filepath: string;
|
|
4
|
-
}
|
|
4
|
+
}
|
|
5
|
+
export declare function loadModules(meta: ImportMeta, modules?: string[]): Promise<ModuleImported[]>;
|
package/dist/modules.js
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
// src/modules.ts
|
|
2
2
|
import { glob } from "node:fs/promises";
|
|
3
|
-
import
|
|
3
|
+
import { join } from "node:path";
|
|
4
4
|
async function loadModules(meta, modules = []) {
|
|
5
|
-
const exclude = modules.filter((
|
|
5
|
+
const exclude = modules.filter((path) => path.charAt(0) == "!").map((path) => path.slice(1));
|
|
6
6
|
const filepaths = await Array.fromAsync(glob(modules, { cwd: meta.dirname, exclude }));
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
const loadModules2 = [];
|
|
8
|
+
for (const path of filepaths) {
|
|
9
|
+
await import(join(meta.dirname, path)).then((imported) => loadModules2.push({
|
|
10
|
+
module: imported,
|
|
11
|
+
filepath: path
|
|
12
|
+
}));
|
|
13
|
+
}
|
|
14
|
+
return loadModules2;
|
|
12
15
|
}
|
|
13
16
|
export {
|
|
14
17
|
loadModules
|
package/dist/version.js
CHANGED