rip-lang 3.7.3 → 3.8.8

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.
@@ -0,0 +1,5 @@
1
+ <svg width="420" height="420" viewBox="0 0 420 420" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <circle cx="210" cy="210" r="210" fill="white"/>
3
+ <path d="M114.5 263C79.772 263 45.7872 275.051 34.271 283.579C33.4994 284.151 34.012 285.229 34.9656 285.117C73.1916 280.629 115.309 292.74 146.5 304C178.5 315.552 221 336 269 336C314.651 336 372.074 310.499 386.401 293.944C387.038 293.208 386.301 292.353 385.435 292.799C376.614 297.341 364.243 306.018 316.073 306.948C265.273 307.928 159 263 114.5 263Z" fill="#0389FF"/>
4
+ <path d="M223.46 84C239.53 84 253.592 86.9253 265.645 92.7754C277.697 98.6254 287.071 107.048 293.767 118.043C300.462 129.038 303.811 142.219 303.811 157.584C303.811 173.09 300.357 186.165 293.449 196.808C287.068 206.742 278.259 214.402 267.026 219.792L309.603 297.958C297.885 297.851 283.094 295.413 266.52 291.62C257.58 289.574 248.214 287.157 238.645 284.547L209.127 229.054H188.782V270.333C176.996 266.968 165.515 263.788 154.823 261.15C146.038 258.984 137.665 257.152 130 255.885V84H223.46ZM188.782 183.381H209.505C216.412 183.381 222.297 182.535 227.16 180.844C232.094 179.082 235.865 176.297 238.473 172.491C241.151 168.685 242.49 163.716 242.49 157.584C242.49 151.382 241.151 146.342 238.473 142.466C235.865 138.519 232.094 135.628 227.16 133.796C222.297 131.893 216.412 130.941 209.505 130.941H188.782V183.381Z" fill="#BB0000"/>
5
+ </svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rip-lang",
3
- "version": "3.7.3",
3
+ "version": "3.8.8",
4
4
  "description": "A modern language that compiles to JavaScript",
5
5
  "type": "module",
6
6
  "main": "src/compiler.js",
@@ -67,7 +67,7 @@
67
67
  "author": "Steve Shreeve <steve.shreeve@gmail.com>",
68
68
  "license": "MIT",
69
69
  "devDependencies": {
70
- "@rip-lang/api": "1.1.5",
71
- "@rip-lang/ui": "0.2.0"
70
+ "@rip-lang/api": "workspace:*",
71
+ "@rip-lang/ui": "workspace:*"
72
72
  }
73
73
  }
package/scripts/serve.js CHANGED
@@ -23,7 +23,8 @@ const MIME_TYPES = {
23
23
  '.png': 'image/png',
24
24
  '.jpg': 'image/jpeg',
25
25
  '.svg': 'image/svg+xml',
26
- '.ico': 'image/x-icon'
26
+ '.ico': 'image/x-icon',
27
+ '.rip': 'text/plain; charset=utf-8'
27
28
  };
28
29
 
29
30
  // Request handler for serving files
@@ -53,7 +54,7 @@ function handleRequest(req) {
53
54
  headers: {
54
55
  'Content-Type': MIME_TYPES[ext] || 'application/octet-stream',
55
56
  'Content-Encoding': 'br',
56
- 'Cache-Control': 'public, max-age=31536000'
57
+ 'Cache-Control': 'no-cache'
57
58
  }
58
59
  });
59
60
  } catch (e) {
package/src/browser.js CHANGED
@@ -9,8 +9,8 @@ export { CodeGenerator, Compiler, compile, compileToJS, formatSExpr, getReactive
9
9
  export const VERSION = "0.0.0";
10
10
  export const BUILD_DATE = "0000-00-00@00:00:00GMT";
11
11
 
12
- // Import compileToJS for use in rip() function
13
- import { compileToJS, getReactiveRuntime } from './compiler.js';
12
+ // Import compiler functions for use in rip() function and globalThis registration
13
+ import { compile, compileToJS, formatSExpr, getReactiveRuntime, getComponentRuntime } from './compiler.js';
14
14
 
15
15
  // Eagerly register Rip's reactive primitives on globalThis so that
16
16
  // framework code (ui.rip) can use them directly without the compiler
@@ -26,6 +26,7 @@ const dedent = s => {
26
26
  }
27
27
 
28
28
  // Browser runtime for executing <script type="text/rip"> tags
29
+ // Supports both inline scripts and external files via src attribute
29
30
  async function processRipScripts() {
30
31
  const scripts = document.querySelectorAll('script[type="text/rip"]');
31
32
 
@@ -33,29 +34,37 @@ async function processRipScripts() {
33
34
  if (script.hasAttribute('data-rip-processed')) continue;
34
35
 
35
36
  try {
36
- const ripCode = dedent(script.textContent);
37
- const jsCode = compileToJS(ripCode);
37
+ let ripCode;
38
+ if (script.src) {
39
+ const response = await fetch(script.src);
40
+ if (!response.ok) {
41
+ console.error(`Rip: failed to fetch ${script.src} (${response.status})`);
42
+ continue;
43
+ }
44
+ ripCode = await response.text();
45
+ } else {
46
+ ripCode = dedent(script.textContent);
47
+ }
48
+
49
+ let jsCode;
50
+ try {
51
+ jsCode = compileToJS(ripCode);
52
+ } catch (compileError) {
53
+ console.error('Rip compile error:', compileError.message);
54
+ console.error('Source:', ripCode);
55
+ continue;
56
+ }
38
57
 
39
58
  // Execute as async to support await (importRip!, etc.)
40
59
  await (0, eval)(`(async()=>{\n${jsCode}\n})()`);
41
60
 
42
61
  script.setAttribute('data-rip-processed', 'true');
43
62
  } catch (error) {
44
- console.error('Error compiling Rip script:', error);
45
- console.error('Script content:', script.textContent);
63
+ console.error('Rip runtime error:', error);
46
64
  }
47
65
  }
48
66
  }
49
67
 
50
- // Auto-process scripts when this module loads
51
- if (typeof document !== 'undefined') {
52
- if (document.readyState === 'loading') {
53
- document.addEventListener('DOMContentLoaded', processRipScripts);
54
- } else {
55
- processRipScripts();
56
- }
57
- }
58
-
59
68
  export { processRipScripts };
60
69
 
61
70
  /**
@@ -111,9 +120,22 @@ export function rip(code) {
111
120
  }
112
121
  }
113
122
 
114
- // Make key functions available globally for console and <script type="text/rip"> use
123
+ // Register globals BEFORE auto-processing scripts (order matters in bundled output)
115
124
  if (typeof globalThis !== 'undefined') {
116
125
  globalThis.rip = rip;
117
126
  globalThis.importRip = importRip;
118
127
  globalThis.compileToJS = compileToJS;
128
+ globalThis.__ripExports = { compile, compileToJS, formatSExpr, VERSION, BUILD_DATE, getReactiveRuntime, getComponentRuntime };
129
+ }
130
+
131
+ // Auto-process scripts when this module loads
132
+ // Expose __ripScriptsReady promise so other modules can await completion
133
+ if (typeof document !== 'undefined') {
134
+ if (document.readyState === 'loading') {
135
+ globalThis.__ripScriptsReady = new Promise(resolve => {
136
+ document.addEventListener('DOMContentLoaded', () => processRipScripts().then(resolve));
137
+ });
138
+ } else {
139
+ globalThis.__ripScriptsReady = processRipScripts();
140
+ }
119
141
  }