rip-lang 3.13.79 → 3.13.81

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 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.79-blue.svg" alt="Version"></a>
12
+ <a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-3.13.81-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,7 +32,6 @@ Usage:
32
32
  Options:
33
33
  -c, --compile Show compiled JavaScript output
34
34
  -d, --dts Show type declarations
35
- -l, --lsp Show LSP TypeScript output (DTS + typed code for IntelliSense)
36
35
  -m, --map Embed inline source map in compiled output
37
36
  -h, --help Show this help message
38
37
  -o, --output <file> Write JavaScript to file
@@ -162,7 +161,6 @@ async function main() {
162
161
  const showSExpr = ripOptions.includes('-s') || ripOptions.includes('--sexpr');
163
162
  const showCompiled = ripOptions.includes('-c') || ripOptions.includes('--compile');
164
163
  const generateDts = ripOptions.includes('-d') || ripOptions.includes('--dts');
165
- const showLsp = ripOptions.includes('-l') || ripOptions.includes('--lsp');
166
164
  const generateMap = ripOptions.includes('-m') || ripOptions.includes('--map');
167
165
  const quiet = ripOptions.includes('-q') || ripOptions.includes('--quiet');
168
166
 
@@ -176,7 +174,7 @@ async function main() {
176
174
  }
177
175
 
178
176
  // Stdin handling — read into memory; only write temp file for the execute path
179
- const hasCompileFlag = showCompiled || showTokens || showSExpr || generateDts || showLsp || generateMap || outputFile;
177
+ const hasCompileFlag = showCompiled || showTokens || showSExpr || generateDts || generateMap || outputFile;
180
178
  let source;
181
179
 
182
180
  if (!inputFile) {
@@ -257,24 +255,20 @@ async function main() {
257
255
 
258
256
  try {
259
257
  const compiler = new Compiler({ showTokens, showSExpr, quiet,
260
- types: (generateDts || showLsp) ? 'emit' : undefined,
258
+ types: generateDts ? 'emit' : undefined,
261
259
  sourceMap: generateMap ? 'inline' : undefined,
262
- mode: showLsp ? 'lsp' : undefined,
263
260
  });
264
261
  const result = compiler.compile(source);
265
262
 
266
263
  if (outputFile) {
267
264
  writeFileSync(outputFile, result.code, 'utf-8');
268
265
  if (!quiet) console.log(`Compiled to ${outputFile}`);
269
- } else if (showLsp) {
270
- if (!quiet) console.log(`// == LSP TypeScript output by Rip ${VERSION} == //\n`);
271
- console.log(result.code);
272
266
  } else if (showCompiled) {
273
267
  if (!quiet) console.log(`// == JavaScript output by Rip ${VERSION} == //\n`);
274
268
  console.log(result.code);
275
269
  }
276
270
 
277
- if (generateDts && !showLsp && result.dts) {
271
+ if (generateDts && result.dts) {
278
272
  if (!quiet) console.log(`// == Type declarations == //\n`);
279
273
  console.log(result.dts);
280
274
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rip-lang",
3
- "version": "3.13.79",
3
+ "version": "3.13.81",
4
4
  "description": "A modern language that compiles to JavaScript",
5
5
  "type": "module",
6
6
  "main": "src/compiler.js",
package/src/compiler.js CHANGED
@@ -671,32 +671,26 @@ export class CodeGenerator {
671
671
  }
672
672
  }
673
673
 
674
- if (this.options.lspMode && (this.usesReactivity || this.usesTemplates)) {
675
- if (needsBlank) code += '\n';
676
- code += getLspRuntimeDeclarations();
677
- needsBlank = true;
678
- } else {
679
- if (this.usesReactivity && !skip) {
680
- if (skipRT) {
681
- code += 'var { __state, __computed, __effect, __batch, __readonly, __setErrorHandler, __handleError, __catchErrors } = globalThis.__rip;\n';
682
- } else if (typeof globalThis !== 'undefined' && globalThis.__rip) {
683
- code += 'const { __state, __computed, __effect, __batch, __readonly, __setErrorHandler, __handleError, __catchErrors } = globalThis.__rip;\n';
684
- } else {
685
- code += this.getReactiveRuntime();
686
- }
687
- needsBlank = true;
674
+ if (this.usesReactivity && !skip) {
675
+ if (skipRT) {
676
+ code += 'var { __state, __computed, __effect, __batch, __readonly, __setErrorHandler, __handleError, __catchErrors } = globalThis.__rip;\n';
677
+ } else if (typeof globalThis !== 'undefined' && globalThis.__rip) {
678
+ code += 'const { __state, __computed, __effect, __batch, __readonly, __setErrorHandler, __handleError, __catchErrors } = globalThis.__rip;\n';
679
+ } else {
680
+ code += this.getReactiveRuntime();
688
681
  }
682
+ needsBlank = true;
683
+ }
689
684
 
690
- if (this.usesTemplates && !skip) {
691
- if (skipRT) {
692
- code += 'var { __pushComponent, __popComponent, setContext, getContext, hasContext, __clsx, __lis, __reconcile, __transition, __handleComponentError, __Component } = globalThis.__ripComponent;\n';
693
- } else if (typeof globalThis !== 'undefined' && globalThis.__ripComponent) {
694
- code += 'const { __pushComponent, __popComponent, setContext, getContext, hasContext, __clsx, __lis, __reconcile, __transition, __handleComponentError, __Component } = globalThis.__ripComponent;\n';
695
- } else {
696
- code += this.getComponentRuntime();
697
- }
698
- needsBlank = true;
685
+ if (this.usesTemplates && !skip) {
686
+ if (skipRT) {
687
+ code += 'var { __pushComponent, __popComponent, setContext, getContext, hasContext, __clsx, __lis, __reconcile, __transition, __handleComponentError, __Component } = globalThis.__ripComponent;\n';
688
+ } else if (typeof globalThis !== 'undefined' && globalThis.__ripComponent) {
689
+ code += 'const { __pushComponent, __popComponent, setContext, getContext, hasContext, __clsx, __lis, __reconcile, __transition, __handleComponentError, __Component } = globalThis.__ripComponent;\n';
690
+ } else {
691
+ code += this.getComponentRuntime();
699
692
  }
693
+ needsBlank = true;
700
694
  }
701
695
 
702
696
  if (this.dataSection !== null && this.dataSection !== undefined && !skip) {
@@ -3295,15 +3289,13 @@ export class Compiler {
3295
3289
  sourceMap = new SourceMapGenerator(file, sourceFile, source);
3296
3290
  }
3297
3291
 
3298
- let lspMode = this.options.mode === 'lsp';
3299
-
3300
3292
  let generator = new CodeGenerator({
3301
3293
  dataSection,
3302
- skipPreamble: lspMode || this.options.skipPreamble,
3294
+ skipPreamble: this.options.skipPreamble,
3303
3295
  skipRuntimes: this.options.skipRuntimes,
3304
3296
  skipExports: this.options.skipExports,
3297
+ stubComponents: this.options.stubComponents,
3305
3298
  reactiveVars: this.options.reactiveVars,
3306
- lspMode,
3307
3299
  sourceMap,
3308
3300
  });
3309
3301
  let code = generator.compile(sexpr);
@@ -3322,11 +3314,6 @@ export class Compiler {
3322
3314
  dts = emitTypes(typeTokens, sexpr);
3323
3315
  }
3324
3316
 
3325
- // LSP mode: prepend DTS to code for a single combined output
3326
- if (lspMode && dts) {
3327
- code = dts.trimEnd() + '\n\n' + code;
3328
- }
3329
-
3330
3317
  return { tokens, sexpr, code, dts, map, reverseMap, data: dataSection, reactiveVars: generator.reactiveVars };
3331
3318
  }
3332
3319
 
@@ -3388,20 +3375,4 @@ export function getComponentRuntime() {
3388
3375
  return new CodeGenerator({}).getComponentRuntime();
3389
3376
  }
3390
3377
 
3391
- export function getLspRuntimeDeclarations() {
3392
- return `\
3393
- interface Signal<T> { value: T; read(): T; }
3394
- interface Computed<T> { readonly value: T; read(): T; }
3395
- declare function __state<T>(v: T): Signal<T>;
3396
- declare function __computed<T>(fn: () => T): Computed<T>;
3397
- declare function __effect(fn: () => void | (() => void)): () => void;
3398
- declare function __batch<T>(fn: () => T): T;
3399
- declare function __readonly<T>(v: T): Readonly<{ value: T }>;
3400
- declare function setContext(key: string, value: any): void;
3401
- declare function getContext(key: string): any;
3402
- declare function hasContext(key: string): boolean;
3403
- declare class __Component { constructor(props?: any); [key: string]: any; }
3404
- `;
3405
- }
3406
-
3407
3378
  export { formatSExpr };
package/src/components.js CHANGED
@@ -669,6 +669,8 @@ export function installComponentSupport(CodeGenerator, Lexer) {
669
669
  * Pattern: ["component", null, ["block", ...statements]]
670
670
  */
671
671
  proto.generateComponent = function(head, rest, context, sexpr) {
672
+ if (this.options.stubComponents) return 'class {}';
673
+
672
674
  const [, body] = rest;
673
675
 
674
676
  this.usesTemplates = true;
@@ -788,22 +790,7 @@ export function installComponentSupport(CodeGenerator, Lexer) {
788
790
  lines.push('class extends __Component {');
789
791
 
790
792
  // --- Init (called by __Component constructor) ---
791
- if (this.options.lspMode) {
792
- const typedProps = [];
793
- for (const v of [...readonlyVars, ...stateVars]) {
794
- if (v.isPublic) {
795
- const t = v.type || 'any';
796
- typedProps.push(`${v.name}?: ${t}`);
797
- typedProps.push(`__bind_${v.name}__?: ${t}`);
798
- }
799
- }
800
- const propsType = typedProps.length > 0
801
- ? `{ ${typedProps.join(', ')}, [key: string]: any }`
802
- : 'any';
803
- lines.push(` _init(props: ${propsType}) {`);
804
- } else {
805
- lines.push(' _init(props) {');
806
- }
793
+ lines.push(' _init(props) {');
807
794
 
808
795
  // Constants (readonly)
809
796
  for (const { name, value, isPublic } of readonlyVars) {
@@ -884,7 +871,7 @@ export function installComponentSupport(CodeGenerator, Lexer) {
884
871
  }
885
872
 
886
873
  // --- Render block (fine-grained) ---
887
- if (renderBlock && !this.options.lspMode) {
874
+ if (renderBlock) {
888
875
  const renderBody = renderBlock[1];
889
876
  const result = this.buildRender(renderBody);
890
877
 
package/src/typecheck.js CHANGED
@@ -44,6 +44,9 @@ export const SKIP_CODES = new Set([
44
44
  1064, // Return type of async function must be Promise
45
45
  2582, // Cannot find name 'test' (test runner globals)
46
46
  2593, // Cannot find name 'describe' (test runner globals)
47
+ 7005, // Variable implicitly has an 'any' type (compiler-generated locals)
48
+ 7006, // Parameter implicitly has an 'any' type (compiler-generated params)
49
+ 7034, // Variable implicitly has type 'any' in some locations (compiler-generated)
47
50
  ]);
48
51
 
49
52
  // Base TypeScript compiler settings for type-checking. Callers can
@@ -64,12 +67,13 @@ export function createTypeCheckSettings(ts, overrides = {}) {
64
67
 
65
68
  // ── Shared compilation pipeline ────────────────────────────────────
66
69
 
67
- // Compile a .rip file for type-checking. Uses mode: 'lsp' which emits
68
- // DTS + typed runtime declarations + compiled code in a single output.
69
- // Builds bidirectional source maps for the LSP and CLI checker.
70
+ // Compile a .rip file for type-checking. Prepends DTS declarations to
71
+ // compiled JS, detects type annotations, and builds bidirectional
72
+ // source maps. Returns everything both the CLI and LSP need.
70
73
  export function compileForCheck(filePath, source, compiler) {
71
- const result = compiler.compile(source, { sourceMap: true, types: 'emit', mode: 'lsp' });
74
+ const result = compiler.compile(source, { sourceMap: true, types: 'emit', skipPreamble: true, stubComponents: true });
72
75
  let code = result.code || '';
76
+ const dts = result.dts ? result.dts.trimEnd() + '\n' : '';
73
77
 
74
78
  // Determine if this file should be type-checked
75
79
  const hasOwnTypes = hasTypeAnnotations(source);
@@ -90,9 +94,8 @@ export function compileForCheck(filePath, source, compiler) {
90
94
  // Ensure every file is treated as a module (not a global script)
91
95
  if (!/\bexport\b/.test(code) && !/\bimport\b/.test(code)) code += '\nexport {};\n';
92
96
 
93
- const dts = result.dts ? result.dts.trimEnd() + '\n' : '';
94
- const tsContent = code;
95
- const headerLines = hasTypes && dts ? countLines(dts + '\n') : 1;
97
+ const tsContent = (hasTypes ? dts + '\n' : '') + code;
98
+ const headerLines = hasTypes ? countLines(dts + '\n') : 1;
96
99
 
97
100
  // Build bidirectional line maps
98
101
  const { srcToGen, genToSrc } = buildLineMap(result.reverseMap, result.map, headerLines);
@@ -141,7 +144,7 @@ export function compileForCheck(filePath, source, compiler) {
141
144
  }
142
145
  }
143
146
 
144
- return { tsContent, headerLines, hasTypes, srcToGen, genToSrc, source };
147
+ return { tsContent, headerLines, hasTypes, srcToGen, genToSrc, source, dts };
145
148
  }
146
149
 
147
150
  // ── Source mapping helpers ──────────────────────────────────────────
@@ -244,7 +247,7 @@ export async function runCheck(targetDir, opts = {}) {
244
247
  }
245
248
 
246
249
  // Create TypeScript language service
247
- const settings = createTypeCheckSettings(ts, { noImplicitAny: true });
250
+ const settings = createTypeCheckSettings(ts);
248
251
 
249
252
  const host = {
250
253
  getScriptFileNames: () => [...compiled.keys()].map(toVirtual),