@atcute/lex-cli 2.5.3 → 2.6.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/dist/codegen.d.ts +1 -7
- package/dist/codegen.d.ts.map +1 -1
- package/dist/codegen.js +7 -16
- package/dist/codegen.js.map +1 -1
- package/dist/commands/export.d.ts +2 -6
- package/dist/commands/export.d.ts.map +1 -1
- package/dist/commands/export.js +21 -28
- package/dist/commands/export.js.map +1 -1
- package/dist/commands/generate.d.ts +2 -6
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +22 -15
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/pull.d.ts +2 -6
- package/dist/commands/pull.d.ts.map +1 -1
- package/dist/commands/pull.js +37 -37
- package/dist/commands/pull.js.map +1 -1
- package/dist/config.d.ts +23 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +21 -1
- package/dist/config.js.map +1 -1
- package/dist/formatter.d.ts +21 -0
- package/dist/formatter.d.ts.map +1 -0
- package/dist/formatter.js +122 -0
- package/dist/formatter.js.map +1 -0
- package/dist/git.d.ts.map +1 -1
- package/dist/git.js.map +1 -1
- package/dist/index.d.ts +2 -66
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lexicon-loader.d.ts.map +1 -1
- package/dist/lexicon-loader.js +9 -1
- package/dist/lexicon-loader.js.map +1 -1
- package/dist/lexicon-metadata.js.map +1 -1
- package/dist/lsp-client.d.ts +20 -0
- package/dist/lsp-client.d.ts.map +1 -0
- package/dist/lsp-client.js +194 -0
- package/dist/lsp-client.js.map +1 -0
- package/dist/pull-sources/atproto.d.ts +3 -11
- package/dist/pull-sources/atproto.d.ts.map +1 -1
- package/dist/pull-sources/atproto.js.map +1 -1
- package/dist/pull-sources/git.d.ts +3 -7
- package/dist/pull-sources/git.d.ts.map +1 -1
- package/dist/pull-sources/git.js.map +1 -1
- package/dist/shared-options.d.ts +1 -1
- package/package.json +10 -9
- package/src/cli.ts +3 -3
- package/src/codegen.ts +7 -27
- package/src/commands/export.ts +25 -33
- package/src/commands/generate.ts +31 -22
- package/src/commands/pull.ts +43 -45
- package/src/config.ts +19 -1
- package/src/formatter.ts +157 -0
- package/src/index.ts +1 -1
- package/src/lsp-client.ts +283 -0
- package/src/pull-sources/atproto.ts +2 -2
- package/src/pull-sources/git.ts +3 -3
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import * as url from 'node:url';
|
|
3
|
+
import { getUtf8Length } from '@atcute/uint8array';
|
|
4
|
+
// #endregion
|
|
5
|
+
// #region text edits
|
|
6
|
+
const applyTextEdits = (code, edits) => {
|
|
7
|
+
if (edits.length === 0) {
|
|
8
|
+
return code;
|
|
9
|
+
}
|
|
10
|
+
// build line start offsets
|
|
11
|
+
const lineStarts = [0];
|
|
12
|
+
for (let i = 0; i < code.length; i++) {
|
|
13
|
+
if (code[i] === '\n') {
|
|
14
|
+
lineStarts.push(i + 1);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const positionToOffset = (pos) => {
|
|
18
|
+
return (lineStarts[pos.line] ?? code.length) + pos.character;
|
|
19
|
+
};
|
|
20
|
+
// sort edits in reverse document order so earlier positions stay valid
|
|
21
|
+
const sorted = edits.toSorted((a, b) => {
|
|
22
|
+
const lineDiff = b.range.start.line - a.range.start.line;
|
|
23
|
+
if (lineDiff !== 0) {
|
|
24
|
+
return lineDiff;
|
|
25
|
+
}
|
|
26
|
+
return b.range.start.character - a.range.start.character;
|
|
27
|
+
});
|
|
28
|
+
let result = code;
|
|
29
|
+
for (const edit of sorted) {
|
|
30
|
+
const start = positionToOffset(edit.range.start);
|
|
31
|
+
const end = positionToOffset(edit.range.end);
|
|
32
|
+
result = result.slice(0, start) + edit.newText + result.slice(end);
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
// #endregion
|
|
37
|
+
const inferLanguageId = (filepath) => {
|
|
38
|
+
if (filepath.endsWith('.ts') || filepath.endsWith('.tsx')) {
|
|
39
|
+
return 'typescript';
|
|
40
|
+
}
|
|
41
|
+
if (filepath.endsWith('.json')) {
|
|
42
|
+
return 'json';
|
|
43
|
+
}
|
|
44
|
+
if (filepath.endsWith('.md') || filepath.endsWith('.markdown')) {
|
|
45
|
+
return 'markdown';
|
|
46
|
+
}
|
|
47
|
+
return 'typescript';
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* creates an LSP client that communicates with a formatter over stdio
|
|
51
|
+
* @param command shell command to spawn the LSP server
|
|
52
|
+
* @param root project root for LSP rootUri
|
|
53
|
+
* @returns an initialized LSP client ready for formatting
|
|
54
|
+
*/
|
|
55
|
+
export const createLspClient = async (command, root) => {
|
|
56
|
+
const child = spawn('sh', ['-c', command], {
|
|
57
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
58
|
+
});
|
|
59
|
+
// prevent EPIPE crash when child exits mid-write; actual errors
|
|
60
|
+
// are handled by the close/error handlers below
|
|
61
|
+
child.stdin.on('error', () => { });
|
|
62
|
+
// #region JSON-RPC framing
|
|
63
|
+
const pending = new Map();
|
|
64
|
+
let nextId = 1;
|
|
65
|
+
let exited = false;
|
|
66
|
+
const sendMessage = (message) => {
|
|
67
|
+
if (exited) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const json = JSON.stringify(message);
|
|
71
|
+
const byteLength = getUtf8Length(json);
|
|
72
|
+
child.stdin.write(`Content-Length: ${byteLength}\r\n\r\n${json}`);
|
|
73
|
+
};
|
|
74
|
+
const sendRequest = (method, params) => {
|
|
75
|
+
if (exited) {
|
|
76
|
+
return Promise.reject(new Error(`LSP server has already exited`));
|
|
77
|
+
}
|
|
78
|
+
const id = nextId++;
|
|
79
|
+
const deferred = Promise.withResolvers();
|
|
80
|
+
pending.set(id, deferred);
|
|
81
|
+
sendMessage({ jsonrpc: '2.0', id, method, params });
|
|
82
|
+
return deferred.promise;
|
|
83
|
+
};
|
|
84
|
+
const sendNotification = (method, params) => {
|
|
85
|
+
sendMessage({ jsonrpc: '2.0', method, params });
|
|
86
|
+
};
|
|
87
|
+
// incremental message parser
|
|
88
|
+
const HEADER_SEPARATOR = Buffer.from('\r\n\r\n');
|
|
89
|
+
let buffer = Buffer.alloc(0);
|
|
90
|
+
let contentLength = -1;
|
|
91
|
+
const processBuffer = () => {
|
|
92
|
+
while (true) {
|
|
93
|
+
if (contentLength === -1) {
|
|
94
|
+
const separatorIndex = buffer.indexOf(HEADER_SEPARATOR);
|
|
95
|
+
if (separatorIndex === -1) {
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
const header = buffer.toString('utf8', 0, separatorIndex);
|
|
99
|
+
const match = header.match(/Content-Length:\s*(\d+)/i);
|
|
100
|
+
buffer = buffer.subarray(separatorIndex + 4);
|
|
101
|
+
if (!match) {
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
contentLength = parseInt(match[1], 10);
|
|
105
|
+
}
|
|
106
|
+
if (buffer.length < contentLength) {
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
const body = buffer.toString('utf8', 0, contentLength);
|
|
110
|
+
buffer = buffer.subarray(contentLength);
|
|
111
|
+
contentLength = -1;
|
|
112
|
+
let message;
|
|
113
|
+
try {
|
|
114
|
+
message = JSON.parse(body);
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
// dispatch responses to pending requests, ignore everything else
|
|
120
|
+
if (message.id != null) {
|
|
121
|
+
const entry = pending.get(message.id);
|
|
122
|
+
if (entry) {
|
|
123
|
+
pending.delete(message.id);
|
|
124
|
+
if (message.error) {
|
|
125
|
+
entry.reject(new Error(`LSP error ${message.error.code}: ${message.error.message}`));
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
entry.resolve(message.result);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
child.stdout.on('data', (chunk) => {
|
|
135
|
+
buffer = buffer.length > 0 ? Buffer.concat([buffer, chunk]) : chunk;
|
|
136
|
+
processBuffer();
|
|
137
|
+
});
|
|
138
|
+
const rejectPending = (error) => {
|
|
139
|
+
for (const [, entry] of pending) {
|
|
140
|
+
entry.reject(error);
|
|
141
|
+
}
|
|
142
|
+
pending.clear();
|
|
143
|
+
};
|
|
144
|
+
child.on('error', (err) => {
|
|
145
|
+
exited = true;
|
|
146
|
+
rejectPending(err);
|
|
147
|
+
});
|
|
148
|
+
child.on('close', (exitCode) => {
|
|
149
|
+
exited = true;
|
|
150
|
+
rejectPending(new Error(`LSP server exited unexpectedly with code ${exitCode}`));
|
|
151
|
+
});
|
|
152
|
+
// #endregion
|
|
153
|
+
// #region initialize handshake
|
|
154
|
+
const rootUri = url.pathToFileURL(root).href;
|
|
155
|
+
await sendRequest('initialize', {
|
|
156
|
+
processId: process.pid,
|
|
157
|
+
clientInfo: { name: 'lex-cli' },
|
|
158
|
+
rootUri,
|
|
159
|
+
capabilities: {},
|
|
160
|
+
});
|
|
161
|
+
sendNotification('initialized');
|
|
162
|
+
// #endregion
|
|
163
|
+
return {
|
|
164
|
+
async formatDocument(code, filepath) {
|
|
165
|
+
const uri = url.pathToFileURL(filepath).href;
|
|
166
|
+
const languageId = inferLanguageId(filepath);
|
|
167
|
+
sendNotification('textDocument/didOpen', {
|
|
168
|
+
textDocument: { uri, languageId, version: 1, text: code },
|
|
169
|
+
});
|
|
170
|
+
const edits = (await sendRequest('textDocument/formatting', {
|
|
171
|
+
textDocument: { uri },
|
|
172
|
+
options: { tabSize: 2, insertSpaces: false },
|
|
173
|
+
}));
|
|
174
|
+
sendNotification('textDocument/didClose', {
|
|
175
|
+
textDocument: { uri },
|
|
176
|
+
});
|
|
177
|
+
if (!edits || edits.length === 0) {
|
|
178
|
+
return code;
|
|
179
|
+
}
|
|
180
|
+
return applyTextEdits(code, edits);
|
|
181
|
+
},
|
|
182
|
+
async dispose() {
|
|
183
|
+
if (!exited) {
|
|
184
|
+
await sendRequest('shutdown', null);
|
|
185
|
+
sendNotification('exit');
|
|
186
|
+
}
|
|
187
|
+
if (!exited) {
|
|
188
|
+
child.kill();
|
|
189
|
+
await new Promise((resolve) => child.on('close', resolve));
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
//# sourceMappingURL=lsp-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lsp-client.js","sourceRoot":"","sources":["../src/lsp-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AA4BnD,aAAa;AAEb,qBAAqB;AAErB,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,KAAiB,EAAU,EAAE;IAClE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,2BAA2B;IAC3B,MAAM,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC;IACvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YACtB,UAAU,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACxB,CAAC;IACF,CAAC;IAED,MAAM,gBAAgB,GAAG,CAAC,GAAa,EAAU,EAAE;QAClD,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,SAAS,CAAC;IAC9D,CAAC,CAAC;IAEF,uEAAuE;IACvE,MAA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G,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE;aACzD,CAAC,CAAC;YAEH,MAAM,KAAK,GAAG,CAAC,MAAM,WAAW,CAAC,yBAAyB,EAAE;gBAC3D,YAAY,EAAE,EAAE,GAAG,EAAE;gBACrB,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE;aAC5C,CAAC,CAAsB,CAAC;YAEzB,gBAAgB,CAAC,uBAAuB,EAAE;gBACzC,YAAY,EAAE,EAAE,GAAG,EAAE;aACrB,CAAC,CAAC;YAEH,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAClC,OAAO,IAAI,CAAC;YACb,CAAC;YAED,OAAO,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACpC,CAAC;QAED,KAAK,CAAC,OAAO;YACZ,IAAI,CAAC,MAAM,EAAE,CAAC;gBACb,MAAM,WAAW,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;gBACpC,gBAAgB,CAAC,MAAM,CAAC,CAAC;YAC1B,CAAC;YAED,IAAI,CAAC,MAAM,EAAE,CAAC;gBACb,KAAK,CAAC,IAAI,EAAE,CAAC;gBACb,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;YAClE,CAAC;QACF,CAAC;KACD,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AtprotoSourceConfig } from '../config.ts';
|
|
2
|
+
import type { PullResult } from './types.ts';
|
|
2
3
|
/**
|
|
3
4
|
* pulls lexicon documents from AT Protocol network resolution
|
|
4
5
|
* @param source atproto source configuration
|
|
5
6
|
* @returns pulled lexicons and ISO timestamp
|
|
6
7
|
*/
|
|
7
|
-
export declare const pullAtprotoSource: (source:
|
|
8
|
-
type: "atproto";
|
|
9
|
-
mode: "nsids";
|
|
10
|
-
nsids: `${string}.${string}.${string}`[];
|
|
11
|
-
} | {
|
|
12
|
-
type: "atproto";
|
|
13
|
-
mode: "authority";
|
|
14
|
-
authority: `${string}.${string}` | `did:plc:${string}` | `did:web:${string}`;
|
|
15
|
-
pattern?: string[] | undefined;
|
|
16
|
-
}) => Promise<PullResult>;
|
|
8
|
+
export declare const pullAtprotoSource: (source: AtprotoSourceConfig) => Promise<PullResult>;
|
|
17
9
|
//# sourceMappingURL=atproto.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atproto.d.ts","sourceRoot":"","sources":["../../src/pull-sources/atproto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"atproto.d.ts","sourceRoot":"","sources":["../../src/pull-sources/atproto.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,KAAK,EAAE,UAAU,EAAkB,MAAM,YAAY,CAAC;AAoE7D;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,WAAkB,mBAAmB,KAAG,OAAO,CAAC,UAAU,CAmJvF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atproto.js","sourceRoot":"","sources":["../../src/pull-sources/atproto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhE,OAAO,EACN,4BAA4B,EAC5B,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,GACvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAmB,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,+BAA+B,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAClG,OAAO,EACN,QAAQ,EACR,MAAM,EACN,yBAAyB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O,EAAE,CAAC,CAAC;QAC/C,CAAC;IACF,CAAC;IAED,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAChE,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,YAAY,MAAM,EAAE,CAAC,CAAC;IAE5E,OAAO,EAAE,MAAM,EAAE,CAAC;AACnB,CAAC,CAAC"}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import type { LexiconDoc } from '@atcute/lexicon-doc';
|
|
2
|
-
import type {
|
|
2
|
+
import type { GitSourceConfig } from '../config.ts';
|
|
3
|
+
import type { PullResult, SourceLocation } from './types.ts';
|
|
3
4
|
/**
|
|
4
5
|
* pulls lexicon documents from a git repository source
|
|
5
6
|
* @param source git source configuration
|
|
6
7
|
* @param parseLexiconFile function to parse and validate lexicon files
|
|
7
8
|
* @returns pulled lexicons and commit hash
|
|
8
9
|
*/
|
|
9
|
-
export declare const pullGitSource: (source:
|
|
10
|
-
type: "git";
|
|
11
|
-
remote: string;
|
|
12
|
-
ref?: string | undefined;
|
|
13
|
-
pattern: string[];
|
|
14
|
-
}, parseLexiconFile: (loc: SourceLocation) => Promise<LexiconDoc>) => Promise<PullResult>;
|
|
10
|
+
export declare const pullGitSource: (source: GitSourceConfig, parseLexiconFile: (loc: SourceLocation) => Promise<LexiconDoc>) => Promise<PullResult>;
|
|
15
11
|
//# sourceMappingURL=git.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/pull-sources/git.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/pull-sources/git.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAItD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAGpD,OAAO,KAAK,EAAE,UAAU,EAAiB,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5E;;;;;GAKG;AACH,eAAO,MAAM,aAAa,WACjB,eAAe,oBACL,CAAC,GAAG,EAAE,cAAc,KAAK,OAAO,CAAC,UAAU,CAAC,KAC5D,OAAO,CAAC,UAAU,CAkFpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/pull-sources/git.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAIlC,OAAO,EAAE,MAAM,YAAY,CAAC;AAG5B,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAI7C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EACjC,MAAuB,EACvB,gBAA8D,EACxC,EAAE
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/pull-sources/git.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAIlC,OAAO,EAAE,MAAM,YAAY,CAAC;AAG5B,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAI7C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EACjC,MAAuB,EACvB,gBAA8D,EACxC,EAAE;IACxB,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC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IAAI,EAAE,CAAC;IAC5B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,IAAI,GAAG,YAAY,QAAQ,EAAE,CAAC;YAC7B,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,4BAA4B,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;YAC7E,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;YACzC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC;QAED,MAAM,GAAG,CAAC;IACX,CAAC;IAED,MAAM,EAAE,CAAC,EAAE,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAE1D,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AACxB,CAAC,CAAC"}
|
package/dist/shared-options.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const sharedOptions: import("@optique/core/parser").Parser<{
|
|
1
|
+
export declare const sharedOptions: import("@optique/core/parser").Parser<"sync", {
|
|
2
2
|
readonly config: string | undefined;
|
|
3
3
|
}, {
|
|
4
4
|
readonly config: [import("@optique/core/valueparser").ValueParserResult<string> | undefined] | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atcute/lex-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"description": "cli tool to generate type definitions for atcute",
|
|
5
5
|
"license": "0BSD",
|
|
6
6
|
"repository": {
|
|
@@ -25,19 +25,20 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@badrap/valita": "^0.4.6",
|
|
28
|
-
"@optique/core": "^0.
|
|
29
|
-
"@optique/run": "^0.
|
|
28
|
+
"@optique/core": "^0.10.7",
|
|
29
|
+
"@optique/run": "^0.10.7",
|
|
30
30
|
"picocolors": "^1.1.1",
|
|
31
|
-
"prettier": "^3.
|
|
32
|
-
"@atcute/identity": "^1.1.
|
|
33
|
-
"@atcute/lexicon-doc": "^2.1.0",
|
|
31
|
+
"prettier": "^3.8.1",
|
|
32
|
+
"@atcute/identity": "^1.1.4",
|
|
34
33
|
"@atcute/identity-resolver": "^1.2.2",
|
|
35
|
-
"@atcute/lexicons": "^1.2.
|
|
34
|
+
"@atcute/lexicons": "^1.2.10",
|
|
35
|
+
"@atcute/lexicon-doc": "^2.1.2",
|
|
36
36
|
"@atcute/lexicon-resolver": "^0.1.6"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@types/node": "^
|
|
40
|
-
"tschema": "^3.2.0"
|
|
39
|
+
"@types/node": "^25.5.2",
|
|
40
|
+
"tschema": "^3.2.0",
|
|
41
|
+
"@atcute/uint8array": "^1.1.1"
|
|
41
42
|
},
|
|
42
43
|
"scripts": {
|
|
43
44
|
"build": "pnpm run generate:schema && tsgo",
|
package/src/cli.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { or } from '@optique/core/constructs';
|
|
2
2
|
import { run } from '@optique/run';
|
|
3
3
|
|
|
4
|
-
import { exportCommandSchema, runExport } from './commands/export.
|
|
5
|
-
import { generateCommandSchema, runGenerate } from './commands/generate.
|
|
6
|
-
import { pullCommandSchema, runPull } from './commands/pull.
|
|
4
|
+
import { exportCommandSchema, runExport } from './commands/export.ts';
|
|
5
|
+
import { generateCommandSchema, runGenerate } from './commands/generate.ts';
|
|
6
|
+
import { pullCommandSchema, runPull } from './commands/pull.ts';
|
|
7
7
|
|
|
8
8
|
const parser = or(generateCommandSchema, pullCommandSchema, exportCommandSchema);
|
|
9
9
|
|
package/src/codegen.ts
CHANGED
|
@@ -16,8 +16,6 @@ import type {
|
|
|
16
16
|
} from '@atcute/lexicon-doc';
|
|
17
17
|
import { formatLexiconRef, parseLexiconRef, type ParsedLexiconRef } from '@atcute/lexicon-doc';
|
|
18
18
|
|
|
19
|
-
import * as prettier from 'prettier';
|
|
20
|
-
|
|
21
19
|
export interface SourceFile {
|
|
22
20
|
filename: string;
|
|
23
21
|
code: string;
|
|
@@ -34,13 +32,6 @@ export interface LexiconApiOptions {
|
|
|
34
32
|
modules: {
|
|
35
33
|
importSuffix: string;
|
|
36
34
|
};
|
|
37
|
-
prettier: {
|
|
38
|
-
cwd: string;
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export interface LexiconApiResult {
|
|
43
|
-
files: SourceFile[];
|
|
44
35
|
}
|
|
45
36
|
|
|
46
37
|
type DocumentMap = Map<string, LexiconDoc>;
|
|
@@ -68,7 +59,7 @@ const resolveExternalImport = (nsid: string, mappings: ImportMapping[]): ImportM
|
|
|
68
59
|
|
|
69
60
|
const PURE = `/*#__PURE__*/`;
|
|
70
61
|
|
|
71
|
-
export
|
|
62
|
+
export function* generateLexiconApi(opts: LexiconApiOptions): Generator<SourceFile> {
|
|
72
63
|
const importExt = opts.modules?.importSuffix;
|
|
73
64
|
|
|
74
65
|
const documents = opts.documents.toSorted((a, b) => {
|
|
@@ -83,7 +74,6 @@ export const generateLexiconApi = async (opts: LexiconApiOptions): Promise<Lexic
|
|
|
83
74
|
});
|
|
84
75
|
|
|
85
76
|
const map: DocumentMap = new Map(documents.map((doc) => [doc.id, doc]));
|
|
86
|
-
const files: SourceFile[] = [];
|
|
87
77
|
const generatedIds = new Set<string>();
|
|
88
78
|
|
|
89
79
|
for (const doc of documents) {
|
|
@@ -336,7 +326,7 @@ export const generateLexiconApi = async (opts: LexiconApiOptions): Promise<Lexic
|
|
|
336
326
|
if (file.exports) {
|
|
337
327
|
generatedIds.add(doc.id);
|
|
338
328
|
|
|
339
|
-
|
|
329
|
+
yield {
|
|
340
330
|
filename: filename,
|
|
341
331
|
code:
|
|
342
332
|
file.imports +
|
|
@@ -354,7 +344,7 @@ export const generateLexiconApi = async (opts: LexiconApiOptions): Promise<Lexic
|
|
|
354
344
|
file.sinterfaces +
|
|
355
345
|
`\n\n` +
|
|
356
346
|
file.ambients,
|
|
357
|
-
}
|
|
347
|
+
};
|
|
358
348
|
}
|
|
359
349
|
}
|
|
360
350
|
|
|
@@ -369,23 +359,12 @@ export const generateLexiconApi = async (opts: LexiconApiOptions): Promise<Lexic
|
|
|
369
359
|
code += `export * as ${toTitleCase(doc.id)} from ${lit(`./types/${doc.id.replaceAll('.', '/')}${importExt}`)};\n`;
|
|
370
360
|
}
|
|
371
361
|
|
|
372
|
-
|
|
362
|
+
yield {
|
|
373
363
|
filename: 'index.ts',
|
|
374
364
|
code: code,
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
if (opts.prettier) {
|
|
379
|
-
const config = await prettier.resolveConfig(opts.prettier.cwd, { editorconfig: true });
|
|
380
|
-
|
|
381
|
-
for (const file of files) {
|
|
382
|
-
const formatted = await prettier.format(file.code, { ...config, parser: 'typescript' });
|
|
383
|
-
file.code = formatted;
|
|
384
|
-
}
|
|
365
|
+
};
|
|
385
366
|
}
|
|
386
|
-
|
|
387
|
-
return { files };
|
|
388
|
-
};
|
|
367
|
+
}
|
|
389
368
|
|
|
390
369
|
const generateXrpcQuery = (imports: ImportSet, path: ParsedLexiconRef, spec: LexXrpcQuery): string => {
|
|
391
370
|
const params = generateXrpcParameters(imports, path, spec.parameters);
|
|
@@ -729,6 +708,7 @@ const generateType = (
|
|
|
729
708
|
const refPath = resolvePath(path, ref);
|
|
730
709
|
return { path: refPath, uri: formatLexiconRef(refPath) };
|
|
731
710
|
})
|
|
711
|
+
// oxlint-disable-next-line unicorn/no-array-sort -- map already clones
|
|
732
712
|
.sort((a, b) => {
|
|
733
713
|
if (a.uri < b.uri) {
|
|
734
714
|
return -1;
|
package/src/commands/export.ts
CHANGED
|
@@ -8,11 +8,11 @@ import { message } from '@optique/core/message';
|
|
|
8
8
|
import { type InferValue } from '@optique/core/parser';
|
|
9
9
|
import { command, constant } from '@optique/core/primitives';
|
|
10
10
|
import pc from 'picocolors';
|
|
11
|
-
import prettier from 'prettier';
|
|
12
11
|
|
|
13
|
-
import { loadConfig, type ExportConfig, type NormalizedConfig } from '../config.
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
12
|
+
import { loadConfig, type ExportConfig, type NormalizedConfig } from '../config.ts';
|
|
13
|
+
import { createFormatter, type Formatter } from '../formatter.ts';
|
|
14
|
+
import { loadLexicons } from '../lexicon-loader.ts';
|
|
15
|
+
import { sharedOptions } from '../shared-options.ts';
|
|
16
16
|
|
|
17
17
|
export const exportCommandSchema = command(
|
|
18
18
|
'export',
|
|
@@ -44,27 +44,17 @@ const ensureExportConfig = (config: NormalizedConfig): ExportConfig => {
|
|
|
44
44
|
return config.export;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
/**
|
|
48
|
-
* writes a lexicon document to disk as formatted JSON
|
|
49
|
-
* @param outdir output directory
|
|
50
|
-
* @param nsid the NSID of the lexicon
|
|
51
|
-
* @param doc the lexicon document
|
|
52
|
-
* @param prettierConfig prettier configuration
|
|
53
|
-
*/
|
|
54
47
|
const writeLexicon = async (
|
|
55
48
|
outdir: string,
|
|
56
49
|
nsid: string,
|
|
57
50
|
doc: LexiconDoc,
|
|
58
|
-
|
|
51
|
+
formatter: Formatter,
|
|
59
52
|
): Promise<void> => {
|
|
60
53
|
const nsidPath = nsid.replaceAll('.', '/');
|
|
61
54
|
const target = path.join(outdir, `${nsidPath}.json`);
|
|
62
55
|
const dirname = path.dirname(target);
|
|
63
56
|
|
|
64
|
-
const code = await
|
|
65
|
-
...prettierConfig,
|
|
66
|
-
parser: 'json',
|
|
67
|
-
});
|
|
57
|
+
const code = await formatter.format(JSON.stringify(doc, null, 2), target);
|
|
68
58
|
|
|
69
59
|
await fs.mkdir(dirname, { recursive: true });
|
|
70
60
|
await fs.writeFile(target, code);
|
|
@@ -81,27 +71,29 @@ export const runExport = async (args: ExportCommand): Promise<void> => {
|
|
|
81
71
|
// use export.files if specified, otherwise fall back to root files config
|
|
82
72
|
const files = exportConfig.files ?? config.files;
|
|
83
73
|
const outdir = path.resolve(config.root, exportConfig.outdir);
|
|
84
|
-
const
|
|
74
|
+
const formatter = await createFormatter(config.formatter, config.root);
|
|
85
75
|
|
|
86
|
-
|
|
87
|
-
|
|
76
|
+
try {
|
|
77
|
+
// load lexicons from files
|
|
78
|
+
const loaded = await loadLexicons(files, config.root);
|
|
88
79
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
80
|
+
if (loaded.length === 0) {
|
|
81
|
+
console.warn(pc.yellow(`warning: no lexicons found to export`));
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
93
84
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
85
|
+
// clean output directory if requested
|
|
86
|
+
if (exportConfig.clean) {
|
|
87
|
+
await fs.rm(outdir, { recursive: true, force: true });
|
|
88
|
+
}
|
|
98
89
|
|
|
99
|
-
|
|
90
|
+
await fs.mkdir(outdir, { recursive: true });
|
|
100
91
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
await writeLexicon(outdir, nsid, doc, prettierConfig);
|
|
104
|
-
}
|
|
92
|
+
// write each lexicon as JSON
|
|
93
|
+
await Promise.all(loaded.map(({ nsid, doc }) => writeLexicon(outdir, nsid, doc, formatter)));
|
|
105
94
|
|
|
106
|
-
|
|
95
|
+
console.log(pc.green(`exported ${loaded.length} lexicon(s) to ${outdir}`));
|
|
96
|
+
} finally {
|
|
97
|
+
await formatter.dispose();
|
|
98
|
+
}
|
|
107
99
|
};
|
package/src/commands/generate.ts
CHANGED
|
@@ -7,11 +7,12 @@ import { type InferValue } from '@optique/core/parser';
|
|
|
7
7
|
import { command, constant } from '@optique/core/primitives';
|
|
8
8
|
import pc from 'picocolors';
|
|
9
9
|
|
|
10
|
-
import { generateLexiconApi, type ImportMapping } from '../codegen.
|
|
11
|
-
import { loadConfig } from '../config.
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
10
|
+
import { generateLexiconApi, type ImportMapping } from '../codegen.ts';
|
|
11
|
+
import { loadConfig } from '../config.ts';
|
|
12
|
+
import { createFormatter } from '../formatter.ts';
|
|
13
|
+
import { loadLexicons } from '../lexicon-loader.ts';
|
|
14
|
+
import { packageJsonSchema } from '../lexicon-metadata.ts';
|
|
15
|
+
import { sharedOptions } from '../shared-options.ts';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* resolves package imports to ImportMapping[]
|
|
@@ -147,24 +148,32 @@ export const runGenerate = async (args: GenerateCommand): Promise<void> => {
|
|
|
147
148
|
const loaded = await loadLexicons(config.files, config.root);
|
|
148
149
|
const documents = loaded.map((l) => l.doc);
|
|
149
150
|
|
|
150
|
-
const generationResult = await generateLexiconApi({
|
|
151
|
-
documents: documents,
|
|
152
|
-
mappings: allMappings,
|
|
153
|
-
modules: {
|
|
154
|
-
importSuffix: config.modules?.importSuffix ?? '.js',
|
|
155
|
-
},
|
|
156
|
-
prettier: {
|
|
157
|
-
cwd: process.cwd(),
|
|
158
|
-
},
|
|
159
|
-
});
|
|
160
|
-
|
|
161
151
|
const outdir = path.join(config.root, config.outdir);
|
|
152
|
+
const formatter = await createFormatter(config.formatter, config.root);
|
|
153
|
+
|
|
154
|
+
try {
|
|
155
|
+
const pending: Promise<void>[] = [];
|
|
156
|
+
|
|
157
|
+
for (const file of generateLexiconApi({
|
|
158
|
+
documents: documents,
|
|
159
|
+
mappings: allMappings,
|
|
160
|
+
modules: {
|
|
161
|
+
importSuffix: config.modules?.importSuffix ?? '.js',
|
|
162
|
+
},
|
|
163
|
+
})) {
|
|
164
|
+
const filename = path.join(outdir, file.filename);
|
|
165
|
+
|
|
166
|
+
pending.push(
|
|
167
|
+
(async () => {
|
|
168
|
+
const formatted = await formatter.format(file.code, filename);
|
|
169
|
+
await fs.mkdir(path.dirname(filename), { recursive: true });
|
|
170
|
+
await fs.writeFile(filename, formatted);
|
|
171
|
+
})(),
|
|
172
|
+
);
|
|
173
|
+
}
|
|
162
174
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
await fs.mkdir(dirname, { recursive: true });
|
|
168
|
-
await fs.writeFile(filename, file.code);
|
|
175
|
+
await Promise.all(pending);
|
|
176
|
+
} finally {
|
|
177
|
+
await formatter.dispose();
|
|
169
178
|
}
|
|
170
179
|
};
|