rip-lang 3.13.9 → 3.13.11

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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rip-lang",
3
- "version": "3.13.9",
3
+ "version": "3.13.11",
4
4
  "description": "A modern language that compiles to JavaScript",
5
5
  "type": "module",
6
6
  "main": "src/compiler.js",
package/src/app.rip CHANGED
@@ -908,9 +908,13 @@ export launch = (appBase = '', opts = {}) ->
908
908
  el.id = target.replace(/^#/, '')
909
909
  document.body.prepend el
910
910
 
911
- # Get the app bundle — explicit, static files, inline DOM, or server fetch
911
+ # Get the app bundle — explicit object, literal URL, static files, inline DOM, or server fetch
912
912
  if opts.bundle
913
913
  bundle = opts.bundle
914
+ else if opts.bundleUrl
915
+ res = await fetch(opts.bundleUrl, cache: 'no-cache')
916
+ throw new Error "launch: #{opts.bundleUrl} (#{res.status})" unless res.ok
917
+ bundle = res.json!
914
918
  else if opts.components and Array.isArray(opts.components)
915
919
  components = {}
916
920
  for url in opts.components
package/src/browser.js CHANGED
@@ -134,22 +134,20 @@ if (typeof globalThis !== 'undefined') {
134
134
  globalThis.__ripExports = { compile, compileToJS, formatSExpr, getStdlibCode, VERSION, BUILD_DATE, getReactiveRuntime, getComponentRuntime };
135
135
  }
136
136
 
137
- // Auto-launch: discover how to start the Rip App, in order of priority:
138
- // 1. Nothing on the page → do nothing
139
- // 2. Inline data-name scripts → compile and mount those
140
- // 3. data-url="bundle" (or path) → fetch components from server
141
- // 4. data-url="" (empty) → do nothing (explicit opt-out)
137
+ // Auto-launch: requires data-url or inline data-name scripts.
138
+ // data-url is the literal fetch URL for the component bundle.
142
139
  async function autoLaunch() {
143
140
  if (globalThis.__ripLaunched) return;
144
141
  const ui = importRip.modules?.['app.rip'];
145
142
  if (!ui?.launch) return;
146
- const cfg = document.querySelector('script[data-hash], script[data-url]');
143
+ const cfg = document.querySelector('script[data-url], script[data-hash]');
147
144
  const tag = document.querySelectorAll('script[type="text/rip"][data-name]').length > 0;
145
+ if (!cfg && !tag) return;
148
146
  const url = cfg?.getAttribute('data-url') || '';
149
- if (!tag && !url) return;
150
147
  const hash = cfg?.getAttribute('data-hash');
151
148
  const opts = { hash: hash !== 'false' };
152
- await ui.launch(url, opts);
149
+ if (url) opts.bundleUrl = url;
150
+ await ui.launch('', opts);
153
151
  }
154
152
 
155
153
  // Auto-process <script type="text/rip"> blocks, then auto-launch if applicable.
package/src/components.js CHANGED
@@ -317,7 +317,7 @@ export function installComponentSupport(CodeGenerator, Lexer) {
317
317
  token[1] = token[1] + '#' + nextNext[1];
318
318
  if (nextNext.spaced) token.spaced = true;
319
319
  tokens.splice(i + 1, 2);
320
- return 1;
320
+ return 0;
321
321
  }
322
322
  }
323
323
 
@@ -1651,6 +1651,7 @@ export function installComponentSupport(CodeGenerator, Lexer) {
1651
1651
  this._createLines.push(`(this._children || (this._children = [])).push(${instVar});`);
1652
1652
 
1653
1653
  this._setupLines.push(`if (${instVar}._setup) ${instVar}._setup();`);
1654
+ this._setupLines.push(`if (${instVar}.mounted) ${instVar}.mounted();`);
1654
1655
 
1655
1656
  for (const { key, valueCode } of reactiveProps) {
1656
1657
  this._setupLines.push(`__effect(() => { if (${instVar}.${key}) ${instVar}.${key}.value = ${valueCode}; });`);