@oml/cli 0.12.0 → 0.14.0
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 +29 -21
- package/out/{auth.d.ts → auth/auth.d.ts} +7 -0
- package/out/{auth.js → auth/auth.js} +42 -3
- package/out/auth/auth.js.map +1 -0
- package/out/{platform-constants.js → auth/constants.js} +1 -1
- package/out/auth/constants.js.map +1 -0
- package/out/{platform.d.ts → auth/platform.d.ts} +5 -7
- package/out/{platform.js → auth/platform.js} +39 -17
- package/out/auth/platform.js.map +1 -0
- package/out/cli.d.ts +6 -0
- package/out/cli.js +214 -59
- package/out/cli.js.map +1 -1
- package/out/commands/export.d.ts +8 -0
- package/out/commands/export.js +27 -0
- package/out/commands/export.js.map +1 -0
- package/out/commands/lint.d.ts +22 -2
- package/out/commands/lint.js +64 -18
- package/out/commands/lint.js.map +1 -1
- package/out/commands/reason.d.ts +2 -9
- package/out/commands/reason.js +52 -48
- package/out/commands/reason.js.map +1 -1
- package/out/commands/render.d.ts +1 -9
- package/out/commands/render.js +15 -726
- package/out/commands/render.js.map +1 -1
- package/out/commands/server/actions.d.ts +22 -0
- package/out/commands/server/actions.js +394 -0
- package/out/commands/server/actions.js.map +1 -0
- package/out/commands/server/require.d.ts +1 -0
- package/out/commands/server/require.js +89 -0
- package/out/commands/server/require.js.map +1 -0
- package/out/commands/server/rest.d.ts +2 -0
- package/out/commands/server/rest.js +117 -0
- package/out/commands/server/rest.js.map +1 -0
- package/out/commands/validate.d.ts +3 -3
- package/out/commands/validate.js +35 -171
- package/out/commands/validate.js.map +1 -1
- package/package.json +5 -7
- package/src/{auth.ts → auth/auth.ts} +54 -3
- package/src/{platform.ts → auth/platform.ts} +41 -17
- package/src/cli.ts +249 -59
- package/src/commands/export.ts +54 -0
- package/src/commands/lint.ts +88 -18
- package/src/commands/reason.ts +69 -56
- package/src/commands/render.ts +23 -995
- package/src/commands/server/actions.ts +480 -0
- package/src/commands/server/require.ts +99 -0
- package/src/commands/server/rest.ts +135 -0
- package/src/commands/validate.ts +46 -207
- package/out/auth.js.map +0 -1
- package/out/backend/backend-types.d.ts +0 -21
- package/out/backend/backend-types.js +0 -3
- package/out/backend/backend-types.js.map +0 -1
- package/out/backend/create-backend.d.ts +0 -2
- package/out/backend/create-backend.js +0 -6
- package/out/backend/create-backend.js.map +0 -1
- package/out/backend/direct-backend.d.ts +0 -20
- package/out/backend/direct-backend.js +0 -150
- package/out/backend/direct-backend.js.map +0 -1
- package/out/backend/reasoned-output.d.ts +0 -38
- package/out/backend/reasoned-output.js +0 -568
- package/out/backend/reasoned-output.js.map +0 -1
- package/out/commands/closure.d.ts +0 -33
- package/out/commands/closure.js +0 -537
- package/out/commands/closure.js.map +0 -1
- package/out/commands/compile.d.ts +0 -11
- package/out/commands/compile.js +0 -63
- package/out/commands/compile.js.map +0 -1
- package/out/platform-constants.js.map +0 -1
- package/out/platform.js.map +0 -1
- package/src/backend/backend-types.ts +0 -27
- package/src/backend/create-backend.ts +0 -8
- package/src/backend/direct-backend.ts +0 -169
- package/src/backend/reasoned-output.ts +0 -697
- package/src/commands/closure.ts +0 -624
- package/src/commands/compile.ts +0 -88
- /package/out/{platform-constants.d.ts → auth/constants.d.ts} +0 -0
- /package/src/{platform-constants.ts → auth/constants.ts} +0 -0
package/src/commands/compile.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2026 Modelware. All rights reserved.
|
|
2
|
-
|
|
3
|
-
import { createOmlServices } from '@oml/language';
|
|
4
|
-
import chalk from 'chalk';
|
|
5
|
-
import { NodeFileSystem } from 'langium/node';
|
|
6
|
-
import { URI } from 'langium';
|
|
7
|
-
import * as fs from 'node:fs/promises';
|
|
8
|
-
import * as path from 'node:path';
|
|
9
|
-
import { normalizeFormatExtension, writeCompiledWorkspace } from '../backend/reasoned-output.js';
|
|
10
|
-
import { failCli } from '../cli-error.js';
|
|
11
|
-
import { formatDuration } from '../util.js';
|
|
12
|
-
import { lintAction } from './lint.js';
|
|
13
|
-
|
|
14
|
-
export type CompileOptions = {
|
|
15
|
-
workspace?: string,
|
|
16
|
-
owl?: string,
|
|
17
|
-
format?: string,
|
|
18
|
-
clean?: boolean,
|
|
19
|
-
pretty?: boolean,
|
|
20
|
-
only?: boolean
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export const compileAction = async (opts: CompileOptions): Promise<void> => {
|
|
24
|
-
const workspaceRoot = resolveCompileWorkspaceRoot(opts.workspace);
|
|
25
|
-
const outputRoot = resolveCompileOutputRoot(workspaceRoot, opts.owl);
|
|
26
|
-
const format = normalizeFormatExtension(opts.format);
|
|
27
|
-
|
|
28
|
-
if (!opts.only) {
|
|
29
|
-
await lintAction({ workspace: workspaceRoot });
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const workspaceStat = await fs.stat(workspaceRoot).catch(() => undefined);
|
|
33
|
-
if (!workspaceStat || !workspaceStat.isDirectory()) {
|
|
34
|
-
failCli(chalk.red(`Workspace folder does not exist: ${workspaceRoot}`));
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const sourceFiles = await findOmlFiles(workspaceRoot);
|
|
38
|
-
if (sourceFiles.length === 0) {
|
|
39
|
-
console.log(chalk.yellow(`No .oml files found under ${workspaceRoot}.`));
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (opts.clean) {
|
|
44
|
-
await fs.rm(outputRoot, { recursive: true, force: true });
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const startedAt = Date.now();
|
|
48
|
-
const servicesBundle = createOmlServices(NodeFileSystem);
|
|
49
|
-
await servicesBundle.Oml.shared.workspace.WorkspaceManager.initializeWorkspace([
|
|
50
|
-
{ uri: URI.file(workspaceRoot).toString(), name: path.basename(workspaceRoot) }
|
|
51
|
-
]);
|
|
52
|
-
const entries = await writeCompiledWorkspace(servicesBundle.Oml, workspaceRoot, outputRoot, format, opts.pretty === true);
|
|
53
|
-
|
|
54
|
-
console.log(
|
|
55
|
-
chalk.green(
|
|
56
|
-
`compile: ${entries.length} OML file(s) converted to .${format} in ${path.relative(process.cwd(), outputRoot) || outputRoot} [${formatDuration(Date.now() - startedAt)}]`
|
|
57
|
-
)
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export function resolveCompileWorkspaceRoot(workspace: string | undefined): string {
|
|
62
|
-
return path.resolve(workspace ?? '.');
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export function resolveCompileOutputRoot(workspaceRoot: string, owl: string | undefined): string {
|
|
66
|
-
return path.resolve(owl ?? path.join(workspaceRoot, 'build', 'owl'));
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
async function findOmlFiles(root: string): Promise<string[]> {
|
|
70
|
-
const entries = await fs.readdir(root, { withFileTypes: true });
|
|
71
|
-
const results: string[] = [];
|
|
72
|
-
|
|
73
|
-
for (const entry of entries) {
|
|
74
|
-
const fullPath = path.join(root, entry.name);
|
|
75
|
-
if (entry.isDirectory()) {
|
|
76
|
-
if (entry.name === 'node_modules' || entry.name.startsWith('.')) {
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
results.push(...await findOmlFiles(fullPath));
|
|
80
|
-
continue;
|
|
81
|
-
}
|
|
82
|
-
if (entry.isFile() && entry.name.toLowerCase().endsWith('.oml')) {
|
|
83
|
-
results.push(fullPath);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return results;
|
|
88
|
-
}
|
|
File without changes
|
|
File without changes
|