@vizualmodel/vmblu-cli 0.3.0 → 0.3.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.
- package/README.md +2 -1
- package/commands/profile/index.js +36 -3
- package/commands/profile/profile.bundle.js +23342 -0
- package/package.json +11 -3
- package/commands/profile/find-handlers.js +0 -351
- package/commands/profile/find-transmissions.js +0 -54
- package/commands/profile/profile.js +0 -271
- package/commands/profile/rollup.config.js +0 -22
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# CLI for vmblu
|
|
2
|
-
This folder contains the CLI commands that are available for vmblu.
|
|
2
|
+
This folder contains the CLI commands that are available for vmblu.
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
## Folder layout
|
|
@@ -9,6 +9,7 @@ vmblu/
|
|
|
9
9
|
cli/ # your CLI source
|
|
10
10
|
commands/
|
|
11
11
|
init/
|
|
12
|
+
profile/
|
|
12
13
|
migrate/
|
|
13
14
|
templates/
|
|
14
15
|
0.8.2/
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
const bundleUrl = new URL('./profile.bundle.js', import.meta.url);
|
|
2
|
+
const sourceUrl = new URL('./profile.js', import.meta.url);
|
|
3
|
+
|
|
4
|
+
let profileModulePromise;
|
|
2
5
|
|
|
3
6
|
export const command = 'profile <model-file>';
|
|
4
7
|
export const describe = 'Find message handlers and message transmissions.';
|
|
@@ -9,8 +12,38 @@ export const builder = [
|
|
|
9
12
|
{ flag: '--changed <files...>', desc: 'only check changed files' },
|
|
10
13
|
{ flag: '--deleted <files...>', desc: 'remove data from deleted files' },
|
|
11
14
|
{ flag: '--delta-file <path>', desc: 'write the delta to a file' },
|
|
12
|
-
{ flag: '--reason <text>', desc: 'information' }
|
|
15
|
+
{ flag: '--reason <text>', desc: 'information' }
|
|
13
16
|
];
|
|
14
17
|
|
|
15
|
-
export
|
|
18
|
+
export async function profile(argv) {
|
|
19
|
+
const mod = await getProfileModule();
|
|
20
|
+
if (typeof mod.profile !== 'function') {
|
|
21
|
+
throw new Error('Profile module does not export a runnable profile function.');
|
|
22
|
+
}
|
|
23
|
+
return mod.profile(argv);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const handler = async (argv) => profile(argv);
|
|
27
|
+
|
|
28
|
+
function getProfileModule() {
|
|
29
|
+
if (!profileModulePromise) {
|
|
30
|
+
profileModulePromise = loadProfileModule();
|
|
31
|
+
}
|
|
32
|
+
return profileModulePromise;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async function loadProfileModule() {
|
|
36
|
+
try {
|
|
37
|
+
return await import(bundleUrl);
|
|
38
|
+
} catch (err) {
|
|
39
|
+
if (isModuleNotFound(err)) {
|
|
40
|
+
return import(sourceUrl);
|
|
41
|
+
}
|
|
42
|
+
throw err;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
16
45
|
|
|
46
|
+
function isModuleNotFound(err) {
|
|
47
|
+
const message = err?.message ?? '';
|
|
48
|
+
return err?.code === 'ERR_MODULE_NOT_FOUND' || message.includes('Cannot find module');
|
|
49
|
+
}
|