rip-lang 3.13.130 → 3.13.131
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/bin/rip +50 -52
- package/bin/rip-server +20 -0
- package/package.json +1 -1
package/bin/rip
CHANGED
|
@@ -32,14 +32,6 @@ function getRepoRoot() {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
function getWorkspaceServerPath() {
|
|
36
|
-
const repoRoot = getRepoRoot();
|
|
37
|
-
if (!repoRoot) return null;
|
|
38
|
-
|
|
39
|
-
const workspaceServerPath = join(repoRoot, 'packages', 'server', 'server.rip');
|
|
40
|
-
return isFile(workspaceServerPath) ? workspaceServerPath : null;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
35
|
function printHelp() {
|
|
44
36
|
console.log(`
|
|
45
37
|
Rip ${VERSION} - ${SUMMARY}
|
|
@@ -62,34 +54,28 @@ Options:
|
|
|
62
54
|
--shadow Show virtual TypeScript content (what rip check sees)
|
|
63
55
|
|
|
64
56
|
Subcommands:
|
|
65
|
-
rip server [flags] [app] Start server (watches *.rip, HTTPS, mDNS)
|
|
66
57
|
rip check [dir] Type-check all .rip files in directory
|
|
58
|
+
rip <name> [args] Run rip-<name> (repo bin/, node_modules, or PATH)
|
|
67
59
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
w:<n> Worker count (auto, half, 2x, 3x, or number)
|
|
60
|
+
Packages:
|
|
61
|
+
rip server [flags] [app] Start server (run 'rip server -h' for details)
|
|
62
|
+
rip db DuckDB server
|
|
63
|
+
rip csv CSV parser
|
|
64
|
+
rip print Syntax-highlighted code printer
|
|
74
65
|
|
|
75
66
|
Examples:
|
|
76
67
|
rip # Interactive REPL (terminal)
|
|
77
68
|
rip script.rip # Execute script directly
|
|
78
69
|
rip script.rip arg1 arg2 # Execute with arguments
|
|
79
|
-
rip server #
|
|
80
|
-
rip server
|
|
81
|
-
rip server
|
|
70
|
+
rip server # Start server (watches *.rip, HTTPS, mDNS)
|
|
71
|
+
rip server -c # Validate server config
|
|
72
|
+
rip server -s # Stop running server
|
|
82
73
|
rip -c example.rip # Compile and show JavaScript
|
|
83
74
|
rip -o output.js example.rip # Compile and save to file
|
|
84
75
|
rip -s example.rip # Show ONLY s-expressions
|
|
85
76
|
rip -t example.rip # Show ONLY tokens
|
|
86
|
-
rip -s -c example.rip # Show s-expressions AND JavaScript
|
|
87
|
-
rip -s -t -c example.rip # Show everything (full debug mode)
|
|
88
77
|
rip -d example.rip # Show type declarations
|
|
89
78
|
rip -m example.rip # Compile with inline source map
|
|
90
|
-
rip -cd example.rip # Show compiled JS and type declarations
|
|
91
|
-
rip --shadow example.rip # Show shadow TypeScript (for type-check debugging)
|
|
92
|
-
rip -q -c example.rip # Just the JS, no headers (for piping)
|
|
93
79
|
echo 'p 1 + 2' | rip # Execute from stdin
|
|
94
80
|
echo 'x = 1 + 2' | rip -c # Compile from stdin
|
|
95
81
|
|
|
@@ -141,7 +127,7 @@ async function main() {
|
|
|
141
127
|
process.exit(0);
|
|
142
128
|
}
|
|
143
129
|
|
|
144
|
-
// ---
|
|
130
|
+
// --- Built-in subcommands ---
|
|
145
131
|
|
|
146
132
|
if (args[0] === 'check') {
|
|
147
133
|
const { runCheck } = await import('../src/typecheck.js');
|
|
@@ -153,22 +139,48 @@ async function main() {
|
|
|
153
139
|
process.exit(exitCode);
|
|
154
140
|
}
|
|
155
141
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
142
|
+
// --- Subcommand dispatch: rip <name> → rip-<name> ---
|
|
143
|
+
|
|
144
|
+
if (scriptFileIndex >= 0) {
|
|
145
|
+
const candidate = args[scriptFileIndex];
|
|
146
|
+
if (!candidate.startsWith('-') && !isFile(candidate)) {
|
|
147
|
+
const name = candidate;
|
|
148
|
+
const subArgs = args.slice(scriptFileIndex + 1);
|
|
149
|
+
|
|
150
|
+
const repoRoot = getRepoRoot();
|
|
151
|
+
if (repoRoot) {
|
|
152
|
+
// 1. Repo package: bin/rip-<name>
|
|
153
|
+
const repoPkg = join(repoRoot, 'bin', `rip-${name}`);
|
|
154
|
+
if (existsSync(repoPkg)) {
|
|
155
|
+
const r = spawnSync(repoPkg, subArgs, { stdio: 'inherit', env: process.env });
|
|
156
|
+
process.exit(r.status ?? 1);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// 2. Repo script: bin/<name>
|
|
160
|
+
const repoScript = join(repoRoot, 'bin', name);
|
|
161
|
+
if (existsSync(repoScript)) {
|
|
162
|
+
const r = spawnSync(repoScript, subArgs, { stdio: 'inherit', env: process.env });
|
|
163
|
+
process.exit(r.status ?? 1);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// 3. Local node_modules: node_modules/.bin/rip-<name>
|
|
167
|
+
const localBin = join(repoRoot, 'node_modules', '.bin', `rip-${name}`);
|
|
168
|
+
if (existsSync(localBin)) {
|
|
169
|
+
const r = spawnSync(localBin, subArgs, { stdio: 'inherit', env: process.env });
|
|
170
|
+
process.exit(r.status ?? 1);
|
|
171
|
+
}
|
|
165
172
|
}
|
|
173
|
+
|
|
174
|
+
// 4. Global PATH: rip-<name>
|
|
175
|
+
const pathResult = spawnSync(`rip-${name}`, subArgs, { stdio: 'inherit', env: process.env });
|
|
176
|
+
if (pathResult.error?.code !== 'ENOENT') {
|
|
177
|
+
process.exit(pathResult.status ?? 1);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// 5. Not found
|
|
181
|
+
console.error(`rip: unknown command '${name}'\n\nRun 'rip --help' for usage.`);
|
|
182
|
+
process.exit(1);
|
|
166
183
|
}
|
|
167
|
-
const result = spawnSync('bun', ['--preload', loaderPath, serverPath, ...args.slice(1)], {
|
|
168
|
-
stdio: 'inherit',
|
|
169
|
-
env: process.env
|
|
170
|
-
});
|
|
171
|
-
process.exit(result.status ?? 1);
|
|
172
184
|
}
|
|
173
185
|
|
|
174
186
|
// --- REPL ---
|
|
@@ -256,20 +268,6 @@ async function main() {
|
|
|
256
268
|
process.exit(exitCode);
|
|
257
269
|
}
|
|
258
270
|
|
|
259
|
-
// Fallback: look for bin/{command} in git repo root
|
|
260
|
-
// Allows `rip migrate --status` to find and run {repo}/bin/migrate
|
|
261
|
-
if (inputFile && !inputFile.startsWith('-') && !isFile(inputFile)) {
|
|
262
|
-
try {
|
|
263
|
-
const repoRoot = getRepoRoot();
|
|
264
|
-
if (!repoRoot) throw new Error('No git repo root');
|
|
265
|
-
const binScript = join(repoRoot, 'bin', inputFile);
|
|
266
|
-
if (existsSync(binScript)) {
|
|
267
|
-
const r = spawnSync(binScript, scriptArgs, { stdio: 'inherit', env: process.env });
|
|
268
|
-
process.exit(r.status ?? 1);
|
|
269
|
-
}
|
|
270
|
-
} catch {}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
271
|
// --- Compile (with flags) ---
|
|
274
272
|
|
|
275
273
|
if (source === undefined) {
|
package/bin/rip-server
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
|
|
3
|
+
import { spawnSync } from 'child_process';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { dirname, join } from 'path';
|
|
6
|
+
|
|
7
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const loaderPath = join(__dirname, '../rip-loader.js');
|
|
9
|
+
const serverPath = join(__dirname, '../packages/server/server.rip');
|
|
10
|
+
|
|
11
|
+
const nodeModules = join(__dirname, '..', '..');
|
|
12
|
+
if (!process.env.NODE_PATH?.split(':').includes(nodeModules)) {
|
|
13
|
+
process.env.NODE_PATH = [nodeModules, process.env.NODE_PATH].filter(Boolean).join(':');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const result = spawnSync('bun', ['--preload', loaderPath, serverPath, ...process.argv.slice(2)], {
|
|
17
|
+
stdio: 'inherit',
|
|
18
|
+
env: process.env
|
|
19
|
+
});
|
|
20
|
+
process.exit(result.status ?? 1);
|