starfederation / datastar

A real-time hypermedia framework.
https://data-star.dev/
MIT License
722 stars 41 forks source link

Docs: example for loading the minified JS has invalid URL #169

Closed pdf closed 1 month ago

pdf commented 1 month ago

Attempting to use the example from the getting_started docs:

<script
  type="module"
  defer
  src="https://cdn.jsdelivr.net/npm/@sudodevnull/0.19.5/dist/datastar.min.js"
"></script>
></script>

Results in a 404 from jsdelivr.

Also note the extra closing bracket and tag on the last line, and extra quote on the second-to-last line.

bencroker commented 1 month ago

Fixed in https://github.com/delaneyj/datastar/commit/0a577e3e8e4e88c5e0d32af8d3ef6338d3ed32ac, thanks!

pdf commented 1 month ago

That commit doesn't appear to modify the URL, this is the result from hitting the generated URL in the current docs:

curl -sSL -v https://cdn.jsdelivr.net/npm/@sudodevnull/0.19.6/dist/datastar.min.js                                                                        111ms 693µs  ⎈ bbscloud-dev-au 
* Host cdn.jsdelivr.net:443 was resolved.
* IPv6: 2a04:4e42:600::485, 2a04:4e42:400::485, 2a04:4e42:200::485, 2a04:4e42::485
* IPv4: 151.101.65.229, 151.101.1.229, 151.101.193.229, 151.101.129.229
*   Trying [2a04:4e42:600::485]:443...
* ALPN: curl offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
*  CAfile: /etc/ssl/certs/ca-certificates.crt
*  CApath: none
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256 / x25519 / RSASSA-PSS
* ALPN: server accepted h2
* Server certificate:
*  subject: CN=jsdelivr.net
*  start date: Jul 30 15:36:05 2024 GMT
*  expire date: Aug 31 15:36:04 2025 GMT
*  subjectAltName: host "cdn.jsdelivr.net" matched cert's "*.jsdelivr.net"
*  issuer: C=BE; O=GlobalSign nv-sa; CN=GlobalSign Atlas R3 DV TLS CA 2024 Q3
*  SSL certificate verify ok.
*   Certificate level 0: Public key type RSA (2048/112 Bits/secBits), signed using sha256WithRSAEncryption
*   Certificate level 1: Public key type RSA (2048/112 Bits/secBits), signed using sha256WithRSAEncryption
*   Certificate level 2: Public key type RSA (2048/112 Bits/secBits), signed using sha256WithRSAEncryption
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* Connected to cdn.jsdelivr.net (2a04:4e42:600::485) port 443
* using HTTP/2
* [HTTP/2] [1] OPENED stream for https://cdn.jsdelivr.net/npm/@sudodevnull/0.19.6/dist/datastar.min.js
* [HTTP/2] [1] [:method: GET]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: cdn.jsdelivr.net]
* [HTTP/2] [1] [:path: /npm/@sudodevnull/0.19.6/dist/datastar.min.js]
* [HTTP/2] [1] [user-agent: curl/8.10.1]
* [HTTP/2] [1] [accept: */*]
> GET /npm/@sudodevnull/0.19.6/dist/datastar.min.js HTTP/2
> Host: cdn.jsdelivr.net
> User-Agent: curl/8.10.1
> Accept: */*
> 
* Request completely sent off
< HTTP/2 404 
< access-control-allow-origin: *
< access-control-expose-headers: *
< timing-allow-origin: *
< cache-control: public, max-age=600, s-maxage=600
< cross-origin-resource-policy: cross-origin
< x-content-type-options: nosniff
< strict-transport-security: max-age=31536000; includeSubDomains; preload
< content-type: text/plain; charset=utf-8
< etag: W/"35-Kii8xnVLf8pbwTHDSmOWmbO0PdY"
< accept-ranges: bytes
< date: Sun, 20 Oct 2024 17:46:06 GMT
< age: 7
< x-served-by: cache-fra-etou8220111-FRA, cache-mel11264-MEL
< x-cache: MISS, HIT
< vary: Accept-Encoding
< alt-svc: h3=":443";ma=86400,h3-29=":443";ma=86400,h3-27=":443";ma=86400
< content-length: 53
< 
* Connection #0 to host cdn.jsdelivr.net left intact
Failed to fetch version info for @sudodevnull/0.19.6.
bencroker commented 1 month ago

Ah, I missed the bad URL. Fixed in https://github.com/delaneyj/datastar/commit/4f92bc75454a516a418a966eac1c5c4aade80f26.