typenative 0.0.20 → 0.0.21
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/.github/workflows/npm-publish-github-packages.yml +13 -5
- package/CHANGELOG.md +32 -0
- package/TODO.md +34 -0
- package/bin/cli.js +62 -0
- package/bin/index.js +104 -132
- package/bin/main.js +31 -0
- package/bin/parse-native.js +37 -0
- package/bin/parse-node.js +110 -0
- package/bin/prompt.js +29 -0
- package/bin/transpiler.js +1046 -310
- package/package.json +5 -7
- package/tsparser/go.mod +14 -0
- package/tsparser/go.sum +22 -0
- package/tsparser/main.go +279 -0
- package/tsparser/tsparser.exe +0 -0
- package/types/typenative-npm.d.ts +44 -0
package/bin/prompt.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Interactive prompts for the self-hosted native binary.
|
|
2
|
+
// Implemented exclusively with TypeNative-mapped APIs (node:readline → Go helper)
|
|
3
|
+
// so this module transpiles. Under Node the namespace import of node:readline is
|
|
4
|
+
// valid but `question` is only available once transpiled — the Node CLI wrapper
|
|
5
|
+
// (src/cli.ts) resolves prompts via inquirer instead and never calls these.
|
|
6
|
+
import * as readlineSync from 'node:readline';
|
|
7
|
+
export function ask(message) {
|
|
8
|
+
let input = readlineSync.question(message + ' ');
|
|
9
|
+
while (input.trim() === '') {
|
|
10
|
+
console.log('Please enter a non-empty value.');
|
|
11
|
+
input = readlineSync.question(message + ' ');
|
|
12
|
+
}
|
|
13
|
+
return input.trim();
|
|
14
|
+
}
|
|
15
|
+
export function askMultiline(message) {
|
|
16
|
+
console.log(message);
|
|
17
|
+
console.log("(finish with a line containing only 'END')");
|
|
18
|
+
const lines = [];
|
|
19
|
+
let line = readlineSync.question('');
|
|
20
|
+
while (line.trim() !== 'END') {
|
|
21
|
+
lines.push(line);
|
|
22
|
+
line = readlineSync.question('');
|
|
23
|
+
}
|
|
24
|
+
return lines.join('\n');
|
|
25
|
+
}
|
|
26
|
+
export function confirm(message) {
|
|
27
|
+
const answer = readlineSync.question(message + ' (y/n): ');
|
|
28
|
+
return answer.trim().toLowerCase() === 'y';
|
|
29
|
+
}
|