rip-lang 3.10.12 → 3.10.14
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 +1 -1
- package/bin/rip +14 -18
- package/docs/dist/rip-ui.min.js +105 -104
- package/docs/dist/rip-ui.min.js.br +0 -0
- package/docs/dist/rip.browser.min.js +95 -94
- package/docs/dist/rip.browser.min.js.br +0 -0
- package/package.json +1 -1
- package/src/compiler.js +20 -51
- package/src/typecheck.js +38 -1
- package/src/types.js +30 -38
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
12
|
-
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-3.10.
|
|
12
|
+
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-3.10.14-blue.svg" alt="Version"></a>
|
|
13
13
|
<a href="#zero-dependencies"><img src="https://img.shields.io/badge/dependencies-ZERO-brightgreen.svg" alt="Dependencies"></a>
|
|
14
14
|
<a href="#"><img src="https://img.shields.io/badge/tests-1%2C243%2F1%2C243-brightgreen.svg" alt="Tests"></a>
|
|
15
15
|
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License"></a>
|
package/bin/rip
CHANGED
|
@@ -25,7 +25,7 @@ Usage:
|
|
|
25
25
|
|
|
26
26
|
Options:
|
|
27
27
|
-c, --compile Show compiled JavaScript output
|
|
28
|
-
-d, --dts
|
|
28
|
+
-d, --dts Show type declarations
|
|
29
29
|
-m, --map Embed inline source map in compiled output
|
|
30
30
|
-h, --help Show this help message
|
|
31
31
|
-o, --output <file> Write JavaScript to file
|
|
@@ -49,9 +49,9 @@ Examples:
|
|
|
49
49
|
rip -t example.rip # Show ONLY tokens
|
|
50
50
|
rip -s -c example.rip # Show s-expressions AND JavaScript
|
|
51
51
|
rip -s -t -c example.rip # Show everything (full debug mode)
|
|
52
|
-
rip -d example.rip #
|
|
52
|
+
rip -d example.rip # Show type declarations
|
|
53
53
|
rip -m example.rip # Compile with inline source map
|
|
54
|
-
rip -cd example.rip #
|
|
54
|
+
rip -cd example.rip # Show compiled JS and type declarations
|
|
55
55
|
rip -q -c example.rip # Just the JS, no headers (for piping)
|
|
56
56
|
rip -w # Launch browser REPL (auto-opens)
|
|
57
57
|
echo 'x = 1 + 2' | rip -c # Compile from stdin
|
|
@@ -81,9 +81,14 @@ async function main() {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
// Split into rip options and script arguments
|
|
84
|
-
const
|
|
84
|
+
const rawOptions = scriptFileIndex === -1 ? args : args.slice(0, scriptFileIndex);
|
|
85
85
|
const scriptArgs = scriptFileIndex === -1 ? [] : args.slice(scriptFileIndex + 1);
|
|
86
86
|
|
|
87
|
+
// Expand combined short flags: -dq → -d -q, -sct → -s -c -t
|
|
88
|
+
const ripOptions = rawOptions.flatMap(arg =>
|
|
89
|
+
/^-[a-zA-Z]{2,}$/.test(arg) ? [...arg.slice(1)].map(ch => `-${ch}`) : [arg]
|
|
90
|
+
);
|
|
91
|
+
|
|
87
92
|
// Only check ripOptions for rip's flags (not script args!)
|
|
88
93
|
if (ripOptions.includes('-h') || ripOptions.includes('--help')) {
|
|
89
94
|
printHelp();
|
|
@@ -257,7 +262,7 @@ async function main() {
|
|
|
257
262
|
|
|
258
263
|
// Determine if we should show compiled output
|
|
259
264
|
// Show compiled JS if: -c flag, OR no debug flags (default mode), OR saving to file
|
|
260
|
-
const shouldShowCompiled = showCompiled || (!showTokens && !showSExpr) || outputFile;
|
|
265
|
+
const shouldShowCompiled = showCompiled || (!showTokens && !showSExpr && !generateDts) || outputFile;
|
|
261
266
|
|
|
262
267
|
// Output
|
|
263
268
|
if (outputFile) {
|
|
@@ -274,21 +279,12 @@ async function main() {
|
|
|
274
279
|
console.log(result.code);
|
|
275
280
|
}
|
|
276
281
|
|
|
277
|
-
//
|
|
282
|
+
// Show .d.ts type declarations to stdout
|
|
278
283
|
if (generateDts && result.dts) {
|
|
279
|
-
if (
|
|
280
|
-
|
|
281
|
-
writeFileSync(dtsFile, result.dts, 'utf-8');
|
|
282
|
-
if (!options.quiet) {
|
|
283
|
-
console.log(`Generated ${dtsFile}`);
|
|
284
|
-
}
|
|
285
|
-
} else {
|
|
286
|
-
// stdin — print .d.ts to stdout
|
|
287
|
-
if (!options.quiet) {
|
|
288
|
-
console.log(`// == Type declarations == //\n`);
|
|
289
|
-
}
|
|
290
|
-
console.log(result.dts);
|
|
284
|
+
if (!options.quiet) {
|
|
285
|
+
console.log(`// == Type declarations == //\n`);
|
|
291
286
|
}
|
|
287
|
+
console.log(result.dts);
|
|
292
288
|
}
|
|
293
289
|
|
|
294
290
|
} catch (error) {
|