rip-lang 3.13.130 → 3.13.132
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 +65 -52
- package/bin/rip-server +20 -0
- package/docs/dist/rip.js +6 -6
- package/docs/dist/rip.min.js +2 -2
- package/docs/dist/rip.min.js.br +0 -0
- package/package.json +1 -1
- package/src/compiler.js +2 -2
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.13.
|
|
12
|
+
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-3.13.132-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%2C436%2F1%2C436-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
|
@@ -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,63 @@ 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. Workspace package binary: packages/*/bin/rip-<name>
|
|
167
|
+
const pkgsDir = join(repoRoot, 'packages');
|
|
168
|
+
if (existsSync(pkgsDir)) {
|
|
169
|
+
try {
|
|
170
|
+
for (const d of readdirSync(pkgsDir, { withFileTypes: true })) {
|
|
171
|
+
if (!d.isDirectory()) continue;
|
|
172
|
+
const pkgBin = join(pkgsDir, d.name, 'bin', `rip-${name}`);
|
|
173
|
+
if (existsSync(pkgBin)) {
|
|
174
|
+
const r = spawnSync(pkgBin, subArgs, { stdio: 'inherit', env: process.env });
|
|
175
|
+
process.exit(r.status ?? 1);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
} catch {}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// 4. Local node_modules: node_modules/.bin/rip-<name>
|
|
182
|
+
const localBin = join(repoRoot, 'node_modules', '.bin', `rip-${name}`);
|
|
183
|
+
if (existsSync(localBin)) {
|
|
184
|
+
const r = spawnSync(localBin, subArgs, { stdio: 'inherit', env: process.env });
|
|
185
|
+
process.exit(r.status ?? 1);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// 5. Global PATH: rip-<name>
|
|
190
|
+
const pathResult = spawnSync(`rip-${name}`, subArgs, { stdio: 'inherit', env: process.env });
|
|
191
|
+
if (pathResult.error?.code !== 'ENOENT') {
|
|
192
|
+
process.exit(pathResult.status ?? 1);
|
|
165
193
|
}
|
|
194
|
+
|
|
195
|
+
// 6. Not found
|
|
196
|
+
console.error(`rip: unknown command '${name}'\n\nRun 'rip --help' for usage.`);
|
|
197
|
+
process.exit(1);
|
|
166
198
|
}
|
|
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
199
|
}
|
|
173
200
|
|
|
174
201
|
// --- REPL ---
|
|
@@ -256,20 +283,6 @@ async function main() {
|
|
|
256
283
|
process.exit(exitCode);
|
|
257
284
|
}
|
|
258
285
|
|
|
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
286
|
// --- Compile (with flags) ---
|
|
274
287
|
|
|
275
288
|
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);
|
package/docs/dist/rip.js
CHANGED
|
@@ -8670,8 +8670,6 @@ ${this.indent()}}`;
|
|
|
8670
8670
|
generateExport(head, rest) {
|
|
8671
8671
|
let [decl] = rest;
|
|
8672
8672
|
if (this.options.skipExports) {
|
|
8673
|
-
if (Array.isArray(decl) && decl.every((i) => typeof i === "string"))
|
|
8674
|
-
return "";
|
|
8675
8673
|
if (this.is(decl, "=")) {
|
|
8676
8674
|
const prev = this._componentName;
|
|
8677
8675
|
if (this.is(decl[2], "component"))
|
|
@@ -8680,10 +8678,10 @@ ${this.indent()}}`;
|
|
|
8680
8678
|
this._componentName = prev;
|
|
8681
8679
|
return result;
|
|
8682
8680
|
}
|
|
8681
|
+
if (Array.isArray(decl) && decl.every((i) => typeof i === "string"))
|
|
8682
|
+
return "";
|
|
8683
8683
|
return this.generate(decl, "statement");
|
|
8684
8684
|
}
|
|
8685
|
-
if (Array.isArray(decl) && decl.every((i) => typeof i === "string"))
|
|
8686
|
-
return `export { ${decl.join(", ")} }`;
|
|
8687
8685
|
if (this.is(decl, "=")) {
|
|
8688
8686
|
const prev = this._componentName;
|
|
8689
8687
|
if (this.is(decl[2], "component"))
|
|
@@ -8692,6 +8690,8 @@ ${this.indent()}}`;
|
|
|
8692
8690
|
this._componentName = prev;
|
|
8693
8691
|
return result;
|
|
8694
8692
|
}
|
|
8693
|
+
if (Array.isArray(decl) && decl.every((i) => typeof i === "string"))
|
|
8694
|
+
return `export { ${decl.join(", ")} }`;
|
|
8695
8695
|
return `export ${this.generate(decl, "statement")}`;
|
|
8696
8696
|
}
|
|
8697
8697
|
generateExportDefault(head, rest) {
|
|
@@ -10104,8 +10104,8 @@ globalThis.zip ??= (...a) => a[0].map((_, i) => a.map(b => b[i]));
|
|
|
10104
10104
|
return new CodeGenerator({}).getComponentRuntime();
|
|
10105
10105
|
}
|
|
10106
10106
|
// src/browser.js
|
|
10107
|
-
var VERSION = "3.13.
|
|
10108
|
-
var BUILD_DATE = "2026-04-
|
|
10107
|
+
var VERSION = "3.13.132";
|
|
10108
|
+
var BUILD_DATE = "2026-04-04@05:43:09GMT";
|
|
10109
10109
|
if (typeof globalThis !== "undefined") {
|
|
10110
10110
|
if (!globalThis.__rip)
|
|
10111
10111
|
new Function(getReactiveRuntime())();
|
package/docs/dist/rip.min.js
CHANGED
|
@@ -421,7 +421,7 @@ ${this.indent()}}`}}let u=`throw ${this.generate(_,"value")}`;return A==="value"
|
|
|
421
421
|
`}else F+=this.indent()+this.generate(z,"statement")+`;
|
|
422
422
|
`;this.indentLevel--}else{this.indentLevel++;for(let Y of W)if(this.is(Y,"=")&&Array.isArray(Y[1])&&Y[1][0]==="."&&Y[1][1]==="this")F+=this.indent()+`static ${Y[1][2]} = ${this.generate(Y[2],"value")};
|
|
423
423
|
`;else F+=this.indent()+this.generate(Y,"statement")+`;
|
|
424
|
-
`;this.indentLevel--}}}return F+=this.indent()+"}",F}generateSuper(f,w){if(w.length===0){if(this.currentMethodName&&this.currentMethodName!=="constructor")return`super.${this.currentMethodName}()`;return"super"}let A=w.map((_)=>this.unwrap(this.generate(_,"value"))).join(", ");if(this.currentMethodName&&this.currentMethodName!=="constructor")return`super.${this.currentMethodName}(${A})`;return`super(${A})`}generateImport(f,w,A,_){if(w.length===1){let U=`import(${this.generate(w[0],"value")})`;if(t(_[0],"await")===!0)return`(await ${U})`;return U}if(this.options.skipImports)return"";if(w.length===3){let[U,W,Z]=w,Y=this.addJsExtensionAndAssertions(Z);if(W[0]==="*"&&W.length===2)return`import ${U}, * as ${W[1]} from ${Y}`;let R=W.map((z)=>Array.isArray(z)&&z.length===2?`${z[0]} as ${z[1]}`:z).join(", ");return`import ${U}, { ${R} } from ${Y}`}let[u,$]=w,F=this.addJsExtensionAndAssertions($);if(typeof u==="string")return`import ${u} from ${F}`;if(Array.isArray(u)){if(u[0]==="*"&&u.length===2)return`import * as ${u[1]} from ${F}`;return`import { ${u.map((W)=>Array.isArray(W)&&W.length===2?`${W[0]} as ${W[1]}`:W).join(", ")} } from ${F}`}return`import ${this.generate(u,"value")} from ${F}`}generateExport(f,w){let[A]=w;if(this.options.skipExports){if(
|
|
424
|
+
`;this.indentLevel--}}}return F+=this.indent()+"}",F}generateSuper(f,w){if(w.length===0){if(this.currentMethodName&&this.currentMethodName!=="constructor")return`super.${this.currentMethodName}()`;return"super"}let A=w.map((_)=>this.unwrap(this.generate(_,"value"))).join(", ");if(this.currentMethodName&&this.currentMethodName!=="constructor")return`super.${this.currentMethodName}(${A})`;return`super(${A})`}generateImport(f,w,A,_){if(w.length===1){let U=`import(${this.generate(w[0],"value")})`;if(t(_[0],"await")===!0)return`(await ${U})`;return U}if(this.options.skipImports)return"";if(w.length===3){let[U,W,Z]=w,Y=this.addJsExtensionAndAssertions(Z);if(W[0]==="*"&&W.length===2)return`import ${U}, * as ${W[1]} from ${Y}`;let R=W.map((z)=>Array.isArray(z)&&z.length===2?`${z[0]} as ${z[1]}`:z).join(", ");return`import ${U}, { ${R} } from ${Y}`}let[u,$]=w,F=this.addJsExtensionAndAssertions($);if(typeof u==="string")return`import ${u} from ${F}`;if(Array.isArray(u)){if(u[0]==="*"&&u.length===2)return`import * as ${u[1]} from ${F}`;return`import { ${u.map((W)=>Array.isArray(W)&&W.length===2?`${W[0]} as ${W[1]}`:W).join(", ")} } from ${F}`}return`import ${this.generate(u,"value")} from ${F}`}generateExport(f,w){let[A]=w;if(this.options.skipExports){if(this.is(A,"=")){let _=this._componentName;if(this.is(A[2],"component"))this._componentName=m(A[1]);let u=`const ${A[1]} = ${this.generate(A[2],"value")}`;return this._componentName=_,u}if(Array.isArray(A)&&A.every((_)=>typeof _==="string"))return"";return this.generate(A,"statement")}if(this.is(A,"=")){let _=this._componentName;if(this.is(A[2],"component"))this._componentName=m(A[1]);let u=`export const ${A[1]} = ${this.generate(A[2],"value")}`;return this._componentName=_,u}if(Array.isArray(A)&&A.every((_)=>typeof _==="string"))return`export { ${A.join(", ")} }`;return`export ${this.generate(A,"statement")}`}generateExportDefault(f,w){let[A]=w;if(this.options.skipExports){if(this.is(A,"="))return`const ${A[1]} = ${this.generate(A[2],"value")}`;return this.generate(A,"statement")}if(this.is(A,"="))return`const ${A[1]} = ${this.generate(A[2],"value")};
|
|
425
425
|
export default ${A[1]}`;return`export default ${this.generate(A,"statement")}`}generateExportAll(f,w){if(this.options.skipExports)return"";return`export * from ${this.addJsExtensionAndAssertions(w[0])}`}generateExportFrom(f,w){if(this.options.skipExports)return"";let[A,_]=w,u=this.addJsExtensionAndAssertions(_);if(Array.isArray(A))return`export { ${A.map((F)=>Array.isArray(F)&&F.length===2?`${F[0]} as ${F[1]}`:F).join(", ")} } from ${u}`;return`export ${A} from ${u}`}generateDoIIFE(f,w){return`(${this.generate(w[0],"statement")})()`}generateRegex(f,w){return w.length===0?f:this.generate(w[0],"value")}generateTaggedTemplate(f,w){let[A,_]=w,u=this.generate(A,"value"),$=this.generate(_,"value");if($.startsWith("`"))return`${u}${$}`;if($.startsWith('"')||$.startsWith("'"))return`${u}\`${$.slice(1,-1)}\``;return`${u}\`${$}\``}generateString(f,w){let A="`";for(let _ of w)if(_ instanceof String)A+=this.extractStringContent(_);else if(typeof _==="string")if(_.startsWith('"')||_.startsWith("'")){if(this.options.debug)console.warn("[Rip] Unexpected quoted primitive in str:",_);A+=_.slice(1,-1)}else A+=_;else if(Array.isArray(_))if(_.length===1&&typeof _[0]==="string"&&!Array.isArray(_[0])){let u=_[0];A+=/^[\d"']/.test(u)?"${"+this.generate(u,"value")+"}":"${"+u+"}"}else{let u=_.length===1&&Array.isArray(_[0])?_[0]:_;A+="${"+this.generate(u,"value")+"}"}return A+"`"}findPostfixConditional(f){if(!Array.isArray(f))return null;let w=f[0];if(w==="if"&&f.length===3)return{type:w,condition:f[1],value:f[2]};if(w==="+"||w==="-"||w==="*"||w==="/")for(let A=1;A<f.length;A++){let _=this.findPostfixConditional(f[A]);if(_)return _.parentOp=w,_.operandIndex=A,_.otherOperands=f.slice(1).filter((u,$)=>$!==A-1),_}return null}rebuildWithoutConditional(f){let w=Array.isArray(f.value)&&f.value.length===1?f.value[0]:f.value;if(f.parentOp)return[f.parentOp,...f.otherOperands,w];return w}generateDestructuringPattern(f){return this.formatParam(f)}generateParamList(f){let w=f.findIndex((_)=>this.is(_,"expansion"));if(w!==-1){let _=f.slice(0,w),u=f.slice(w+1),$=_.map((F)=>this.formatParam(F)).join(", ");return this.expansionAfterParams=u,$?`${$}, ..._rest`:"..._rest"}let A=f.findIndex((_)=>this.is(_,"rest"));if(A!==-1&&A<f.length-1){let _=f.slice(0,A),u=f[A],$=f.slice(A+1),F=_.map((U)=>this.formatParam(U));return this.restMiddleParam={restName:u[1],afterParams:$,beforeCount:_.length},F.length>0?`${F.join(", ")}, ...${u[1]}`:`...${u[1]}`}return this.expansionAfterParams=null,this.restMiddleParam=null,f.map((_)=>this.formatParam(_)).join(", ")}formatParam(f){if(typeof f==="string")return f;if(f instanceof String)return f.valueOf();if(this.is(f,"rest"))return`...${f[1]}`;if(this.is(f,"default"))return`${f[1]} = ${this.generate(f[2],"value")}`;if(this.is(f,".")&&f[1]==="this")return f[2];if(this.is(f,"array"))return`[${f.slice(1).map((A)=>{if(A===",")return"";if(A==="...")return"";if(this.is(A,"..."))return`...${A[1]}`;if(this.is(A,"=")&&typeof A[1]==="string")return`${A[1]} = ${this.generate(A[2],"value")}`;if(typeof A==="string")return A;return this.formatParam(A)}).join(", ")}]`;if(this.is(f,"object"))return`{${f.slice(1).map((A)=>{if(this.is(A,"..."))return`...${A[1]}`;if(this.is(A,"default"))return`${A[1]} = ${this.generate(A[2],"value")}`;let[_,u,$]=A;if(_==="=")return`${u} = ${this.generate($,"value")}`;if(u===$)return u;return`${u}: ${this.formatParam($)}`}).join(", ")}}`;return JSON.stringify(f)}generateBodyWithReturns(f,w=[],A={}){let{sideEffectOnly:_=!1,autoAssignments:u=[],isConstructor:$=!1,hasExpansionParams:F=!1}=A,U=this.sideEffectOnly;this.sideEffectOnly=_;let W=new Set,Z=(J)=>{if(typeof J==="string")W.add(J);else if(Array.isArray(J)){if(J[0]==="rest"||J[0]==="..."){if(typeof J[1]==="string")W.add(J[1])}else if(J[0]==="default"){if(typeof J[1]==="string")W.add(J[1])}else if(J[0]==="array"||J[0]==="object")this.collectVarsFromArray(J,W)}};if(Array.isArray(w))w.forEach(Z);let Y=this.collectFunctionVariables(f),R=new Set([...Y].filter((J)=>!this.programVars.has(J)&&!this.reactiveVars?.has(J)&&!W.has(J)&&!this.scopeStack.some((O)=>O.has(J)))),z=["return","throw","break","continue"],M=["for-in","for-of","for-as","while","loop"];if(this.scopeStack.push(new Set([...R,...W])),this.is(f,"block")){let J=this.unwrapBlock(f);if(F&&this.expansionAfterParams?.length>0)J=[...this.expansionAfterParams.map((G,I)=>{return`const ${typeof G==="string"?G:JSON.stringify(G)} = _rest[_rest.length - ${this.expansionAfterParams.length-I}]`}),...J],this.expansionAfterParams=null;if(this.restMiddleParam){let{restName:X,afterParams:G}=this.restMiddleParam,I=G.length,E=[];if(G.forEach((K,H)=>{let P=typeof K==="string"?K:this.is(K,"default")?K[1]:JSON.stringify(K);E.push(`const ${P} = ${X}[${X}.length - ${I-H}]`)}),I>0)E.push(`${X} = ${X}.slice(0, -${I})`);J=[...E,...J],this.restMiddleParam=null}this.indentLevel++;let O=`{
|
|
426
426
|
`;if(R.size>0)O+=this.indent()+`let ${Array.from(R).sort().join(", ")};
|
|
427
427
|
`;let Q=u.length>0&&J.length>0&&Array.isArray(J[0])&&J[0][0]==="super",q=(X)=>{X.forEach((G,I)=>{let E=I===X.length-1,K=Array.isArray(G)?G[0]:null;if(!E&&K==="comprehension"){let[,L,B,h]=G;O+=this.indent()+this.generateComprehensionAsLoop(L,B,h)+`
|
|
@@ -735,7 +735,7 @@ globalThis.sleep ??= (ms) => new Promise(r => setTimeout(r, ms));
|
|
|
735
735
|
globalThis.todo ??= (msg) => { throw new Error(msg || "Not implemented"); };
|
|
736
736
|
globalThis.warn ??= console.warn;
|
|
737
737
|
globalThis.zip ??= (...a) => a[0].map((_, i) => a.map(b => b[i]));
|
|
738
|
-
`}function L1(){return new f1({}).getReactiveRuntime()}function N1(){return new f1({}).getComponentRuntime()}var c2="3.13.
|
|
738
|
+
`}function L1(){return new f1({}).getReactiveRuntime()}function N1(){return new f1({}).getComponentRuntime()}var c2="3.13.132",j2="2026-04-04@05:43:09GMT";if(typeof globalThis<"u"){if(!globalThis.__rip)Function(L1())();if(!globalThis.__ripComponent)Function(N1())()}var O4=(f)=>{let w=f.match(/^[ \t]*(?=\S)/gm),A=Math.min(...(w||[]).map((_)=>_.length));return f.replace(RegExp(`^[ ]{${A}}`,"gm"),"").trim()};async function y2(){let f=[],w=document.querySelector('script[src$="rip.min.js"], script[src$="rip.js"]'),A=w?.getAttribute("data-src");if(A){for(let _ of A.trim().split(/\s+/))if(_)f.push({url:_})}for(let _ of document.querySelectorAll('script[type="text/rip"]'))if(_.src)f.push({url:_.src});else{let u=O4(_.textContent);if(u)f.push({code:u})}if(f.length>0){let _=await Promise.allSettled(f.map(async(W)=>{if(!W.url)return;let Z=await fetch(W.url);if(!Z.ok)throw Error(`${W.url} (${Z.status})`);if(W.url.endsWith(".rip"))W.code=await Z.text();else{let Y=await Z.json();W.bundle=Y}}));for(let W of _)if(W.status==="rejected")console.warn("Rip: fetch failed:",W.reason.message);let u=[],$=[];for(let W of f)if(W.bundle)u.push(W.bundle);else if(W.code)$.push(W);let F=w?.getAttribute("data-router");if(F!=null&&u.length>0){let W={skipRuntimes:!0,skipExports:!0,skipImports:!0};if($.length>0){let Y="";for(let R of $)try{Y+=Y1(R.code,W)+`
|
|
739
739
|
`}catch(z){console.error(`Rip compile error in ${R.url||"inline"}:`,z.message)}if(Y)try{await(0,eval)(`(async()=>{
|
|
740
740
|
${Y}
|
|
741
741
|
})()`)}catch(R){console.error("Rip runtime error:",R)}}let Z=J1.modules?.["ui.rip"];if(Z?.launch){let Y=u[u.length-1],R=w.getAttribute("data-persist"),z={bundle:Y,hash:F==="hash"};if(R!=null)z.persist=R==="local"?"local":!0;await Z.launch("",z)}}else{let W=[];for(let R of u){for(let[z,M]of Object.entries(R.components||{}))W.push({code:M,url:z});if(R.data){let z=w?.getAttribute("data-state"),M={};if(z)try{M=JSON.parse(z)}catch{}Object.assign(M,R.data),w?.setAttribute("data-state",JSON.stringify(M))}}W.push(...$);let Z={skipRuntimes:!0,skipExports:!0,skipImports:!0},Y=[];for(let R of W){if(!R.code)continue;try{let z=Y1(R.code,Z);Y.push({js:z,url:R.url||"inline"})}catch(z){console.error(`Rip compile error in ${R.url||"inline"}:`,z.message)}}if(!globalThis.__ripApp&&w){let R=globalThis.stash;if(R){let z={},M=w.getAttribute("data-state");if(M)try{z=JSON.parse(M)}catch(O){console.error("Rip: invalid data-state JSON:",O.message)}let D=R({data:z});if(globalThis.__ripApp=D,typeof window<"u")window.app=D;let J=w.getAttribute("data-persist");if(J!=null&&globalThis.persistStash)globalThis.persistStash(D,{local:J==="local"})}}if(Y.length>0){let R=Y.map((M)=>M.js).join(`
|
package/docs/dist/rip.min.js.br
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/src/compiler.js
CHANGED
|
@@ -2186,7 +2186,6 @@ export class CodeGenerator {
|
|
|
2186
2186
|
generateExport(head, rest) {
|
|
2187
2187
|
let [decl] = rest;
|
|
2188
2188
|
if (this.options.skipExports) {
|
|
2189
|
-
if (Array.isArray(decl) && decl.every(i => typeof i === 'string')) return '';
|
|
2190
2189
|
if (this.is(decl, '=')) {
|
|
2191
2190
|
const prev = this._componentName;
|
|
2192
2191
|
if (this.is(decl[2], 'component')) this._componentName = str(decl[1]);
|
|
@@ -2194,9 +2193,9 @@ export class CodeGenerator {
|
|
|
2194
2193
|
this._componentName = prev;
|
|
2195
2194
|
return result;
|
|
2196
2195
|
}
|
|
2196
|
+
if (Array.isArray(decl) && decl.every(i => typeof i === 'string')) return '';
|
|
2197
2197
|
return this.generate(decl, 'statement');
|
|
2198
2198
|
}
|
|
2199
|
-
if (Array.isArray(decl) && decl.every(i => typeof i === 'string')) return `export { ${decl.join(', ')} }`;
|
|
2200
2199
|
if (this.is(decl, '=')) {
|
|
2201
2200
|
const prev = this._componentName;
|
|
2202
2201
|
if (this.is(decl[2], 'component')) this._componentName = str(decl[1]);
|
|
@@ -2204,6 +2203,7 @@ export class CodeGenerator {
|
|
|
2204
2203
|
this._componentName = prev;
|
|
2205
2204
|
return result;
|
|
2206
2205
|
}
|
|
2206
|
+
if (Array.isArray(decl) && decl.every(i => typeof i === 'string')) return `export { ${decl.join(', ')} }`;
|
|
2207
2207
|
return `export ${this.generate(decl, 'statement')}`;
|
|
2208
2208
|
}
|
|
2209
2209
|
|