rip-lang 3.10.8 → 3.10.9

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.
Binary file
@@ -7,7 +7,7 @@
7
7
  <link rel="preconnect" href="https://fonts.googleapis.com">
8
8
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
9
9
  <link href="https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,400;0,500;0,700;1,400&family=Nothing+You+Could+Do&display=swap" rel="stylesheet">
10
- <script type="module" src="../dist/rip-ui.min.js"></script>
10
+ <script type="module" src="../dist/rip-ui.min.js" data-hash="true"></script>
11
11
  <style>
12
12
  /* ==========================================================================
13
13
  Lab Results — Styles
@@ -1119,12 +1119,5 @@ export Gauge = component
1119
1119
  .gauge__units units
1120
1120
  </script>
1121
1121
 
1122
- <!-- ===== Boot ===== -->
1123
-
1124
- <script type="text/rip">
1125
- { launch } = importRip! '/rip/ui.rip'
1126
- launch hash: true
1127
- </script>
1128
-
1129
1122
  </body>
1130
1123
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rip-lang",
3
- "version": "3.10.8",
3
+ "version": "3.10.9",
4
4
  "description": "A modern language that compiles to JavaScript",
5
5
  "type": "module",
6
6
  "main": "src/compiler.js",
package/src/browser.js CHANGED
@@ -136,12 +136,27 @@ if (typeof globalThis !== 'undefined') {
136
136
  globalThis.__ripExports = { compile, compileToJS, formatSExpr, VERSION, BUILD_DATE, getReactiveRuntime, getComponentRuntime };
137
137
  }
138
138
 
139
- // Auto-process <script type="text/rip"> blocks.
139
+ // Auto-launch: if rip-ui is bundled and the page has component scripts or a data-url,
140
+ // call launch() automatically with config from the script tag's data attributes.
141
+ async function autoLaunch() {
142
+ if (globalThis.__ripLaunched) return;
143
+ const ui = importRip.modules?.['ui.rip'];
144
+ if (!ui?.launch) return;
145
+ const cfg = document.querySelector('script[data-hash], script[data-url]');
146
+ const url = cfg?.getAttribute('data-url') || '';
147
+ const hasComponents = document.querySelectorAll('script[type="text/rip"][data-name]').length > 0;
148
+ if (!hasComponents && !url) return;
149
+ const opts = {};
150
+ if (cfg?.hasAttribute('data-hash')) opts.hash = cfg.getAttribute('data-hash') !== 'false';
151
+ await ui.launch(url, opts);
152
+ }
153
+
154
+ // Auto-process <script type="text/rip"> blocks, then auto-launch if applicable.
140
155
  // Deferred via queueMicrotask so bundled entry code (e.g. rip-ui.min.js registering
141
156
  // importRip.modules) runs before script processing begins.
142
157
  if (typeof document !== 'undefined') {
143
158
  globalThis.__ripScriptsReady = new Promise(resolve => {
144
- const run = () => processRipScripts().then(resolve);
159
+ const run = () => processRipScripts().then(autoLaunch).then(resolve);
145
160
  if (document.readyState === 'loading') {
146
161
  document.addEventListener('DOMContentLoaded', () => queueMicrotask(run));
147
162
  } else {
@@ -214,7 +214,7 @@ grammar =
214
214
  o 'Assignable EFFECT Block' , '["effect", 1, 3]'
215
215
  o 'EFFECT Expression' , '["effect", null, 2]'
216
216
  o 'EFFECT TERMINATOR Expression' , '["effect", null, 3]'
217
- o 'EFFECT Block' , '["effect", null, 3]'
217
+ o 'EFFECT Block' , '["effect", null, 2]'
218
218
  ]
219
219
 
220
220
  # ============================================================================
package/src/parser.js CHANGED
@@ -37,8 +37,7 @@ const parserInstance = {
37
37
  case 79: return ["readonly", $[$0-4], $[$0-1]];
38
38
  case 80: case 82: return ["effect", $[$0-2], $[$0]];
39
39
  case 81: return ["effect", $[$0-3], $[$0]];
40
- case 83: case 84: return ["effect", null, $[$0]];
41
- case 85: return ["effect", null, $[$01]];
40
+ case 83: case 84: case 85: return ["effect", null, $[$0]];
42
41
  case 91: case 100: case 138: return [".", $[$0-2], $[$0]];
43
42
  case 92: case 101: case 139: return ["?.", $[$0-2], $[$0]];
44
43
  case 93: case 95: case 102: case 140: return ["[]", $[$0-3], $[$0-1]];