matthewp / haunted

React's Hooks API implemented for web components 👻
BSD 2-Clause "Simplified" License
2.59k stars 92 forks source link

Demos failing on SyntaxError in haunted.js from unpkg #404

Open superchris opened 2 years ago

superchris commented 2 years ago

Attempting to run demo which does this:

import {
  html,
  component,
  useState,
} from "https://unpkg.com/haunted/haunted.js";

Browser console:

Uncaught SyntaxError: Unexpected token ':' (at haunted.js:21:67)
geocine commented 1 year ago

Were you able to find a workaround?

micahjon commented 1 year ago

The syntax error is in the haunted.js file that is bundled with the 5.0.0 release on npm, which in turn is distributed by unpkg, CDNJS, etc.

Looks like @matthewp has been working on automating/upgrading the testing and release pipeline, so I'm guessing it's related to that. I also noticed that a bunch of compiled js and d.ts files for the npm release were committed by a bot to the top level repo, which is probably also unintentional, but hopefully easy to reverse.

@bennypowers might also be able to fix this. I'm a bit out of my depth here unfortunately.

bennypowers commented 1 year ago

Unfortunately my best suggestion will be to redo the docs build altogether. I think there are two good options:

  1. Redo it with 11ty, replacing the rocket-specific plugins
  2. Redo it with rocket, which was rewritten to remove 11ty, rewriting the rocket plugins

either way, the plugins need to be removed or rewritten.

I've got some plans to port my rocket plugins to 11ty, but no timeline

geocine commented 1 year ago

I had some luck using deno's cdn

https://esm.sh/haunted
micahjon commented 1 year ago

Unfortunately my best suggestion will be to redo the docs build altogether. I think there are two good options:

  1. Redo it with 11ty, replacing the rocket-specific plugins
  2. Redo it with rocket, which was rewritten to remove 11ty, rewriting the rocket plugins

either way, the plugins need to be removed or rewritten.

I've got some plans to port my rocket plugins to 11ty, but no timeline

Thanks @bennypowers. I spent the morning playing around with both options and I'm currently leaning towards option 1 (just use 11ty) as Rocket appears to be evolving much more quickly and is much less widely used. As a sidenote, it's unfortunate that the name "Rocket" is already used by the Rust web framework as it makes searching difficult.

I took at stab at rewriting the docs in 11ty and soon realized that the layout files are not committed to this repo. Where is layout-home defined? Is it built-in to an old version of Rocket? I couldn't find it in the Rocket repo either.

Appreciate your help with this. Hopefully it's something I can knock out in the coming week or so.

bennypowers commented 1 year ago

yeah it's likely an old-rocket thing

In old-rocket, a 'preset' was a bundle of eleventy plugin + templates + includes + data which could be then used throughout the app. AFAICT 11ty never provided an 'official' way to do this.