Skip to content

Conversation

thescientist13
Copy link
Member

@thescientist13 thescientist13 commented Nov 9, 2024

Related Issue

related to #1323

See example / demo repos here:

Summary of Changes

  1. Add GitHub Actions for Bun
  2. Had to alter import for node-html-parser

Documentation

  1. Add a PR to the website (home page, hosting, etc) (assuming all actions pass)

TODO

  1. Actually use bun for npm scripts / github actions 🤦‍♂️
  2. Some test cases are failing
    • e.g., images coming back as text/javascript
  3. Validate / support custom loaders equivalent - see [demo] Bun thescientist13/greenwood-lit-ssr#31
  4. Upgrade to latest node-html-parser (standalone issue / PR) - https://github.com/thescientist13/bun-node-compat-tests?tab=readme-ov-file#-node-html-parser
  5. Upgrade to apollo/server v4 (standalone issue / PR) - https://github.com/thescientist13/bun-node-compat-tests?tab=readme-ov-file#%EF%B8%8F-apollo-graphql-server-playground

Upstreams / Issues

  1. node-html-parser import - giving this one a pass for now - https://github.com/thescientist13/bun-node-compat-tests?tab=readme-ov-file#node-html-parser

       TypeError: htmlparser.parse is not a function. (In 'htmlparser.parse(html, {
         script: !0,
         style: !0
       })', 'htmlparser.parse' is undefined)
           at /Users/owenbuckley/Workspace/github/greenwood-bun/node_modules/@greenwood/cli/src/lib/resource-utils.js:116:27
           at trackResourcesForRoute (/Users/owenbuckley/Workspace/github/greenwood-bun/node_modules/@greenwood/cli/src/lib/resource-utils.js:114:39)
           at /Users/owenbuckley/Workspace/github/greenwood-bun/node_modules/@greenwood/cli/src/lifecycles/prerender.js:168:11
       
  2. Had to check for an unexpected URL coming from Rollup - can't reproduce?

        {
           id: "\u0000commonjsHelpers.js",
           idUrl: URL {
             href: "file://commonjshelpers.js/",
             origin: "null",
             protocol: "file:",
             username: "",
             password: "",
             host: "commonjshelpers.js",
             hostname: "commonjshelpers.js",
             port: "",
             pathname: "/",
             hash: "",
             search: "",
             searchParams: URLSearchParams {},
             toJSON: [Function: toJSON],
             toString: [Function: toString],
           },
         }
       
  3. Lit SSR - can not reproduce

         building from local sources...
         200 |   #onClose(e) {
         201 |     this.#onExitPromise = e.code, this.emit("exit", e.code);
         202 |   }
         203 |   #onError(event) {
         204 |     let error = event?.error;
         205 |       error = new Error(event.message, { cause: event });
                             ^
         error: 1 | /**
         2 |  * @license
         3 |  * Copyright 2017 Google LLC
         4 |  * SPDX-License-Identifier: BSD-3-Clause
         5 |  */
         6 | const t=globalThis,i=t.trustedTypes,s=i?i.createPolicy("lit-html",{createHTML:t=>t}):void 0,e="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o="?"+h,n=`<${o}>`,r=void 0===t.document?{createTreeWalker:()=>({})}:document,l=()=>r.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=Array.isArray,u=t=>a(t)||"function"==typeof t?.[Symbol.iterator],d="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,_=/>/g,m=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p=/'/g,g=/"/g,$=/^(?:script|style|textarea|title)$/i,y=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x=y(1),T=y(2),b=y(3),w=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),A=new WeakMap,C=r.createTreeWalker(r,129);function P(t,i){if(!a(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s?s.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"":3===i?"":"",c=f;for(let i=0;i TypeError: r.createTreeWalker is not a function. (In 'r.createTreeWalker(r, 129)', 'r.createTreeWalker' is undefined)
           at /Users/owenbuckley/Workspace/github/greenwood-lit-ssr/node_modules/lit-html/node/lit-html.js:6:750
     
           at #onError (node:worker_threads:205:15)
     
     Bun v1.2.2 (macOS arm64)
     error: script "build" exited with code 1
    
  4. GraphQL failing - looks like we just need to upgrade to @apollo/server v4 - https://github.com/thescientist13/bun-node-compat-tests?tab=readme-ov-file#%EF%B8%8F-apollo-graphql-server-playground

       OPTIONS - /graphql failed
       30 |         }
       31 |         var connectionHandler = (function (socket, request) {
       32 |             socket.upgradeReq = request;
       33 |             if (socket.protocol === undefined ||
       34 |                 (socket.protocol.indexOf(protocol_1.GRAPHQL_WS) === -1 && socket.protocol.indexOf(protocol_1.GRAPHQL_SUBSCRIPTIONS) === -1)) {
       35 |                 socket.close(1002);
                                   ^
       TypeError: socket.close is not a function. (In 'socket.close(1002)', 'socket.close' is undefined)
             at connectionHandler (/Users/owenbuckley/Workspace/project-evergreen/greenwood/node_modules/subscriptions-transport-ws/dist/server.js:35:24)
       
  5. Mocha test cases seem to run foreveeeeeer, since failing tests cases pass when run individually - Investigate why mocha is very slow oven-sh/bun#13087

@thescientist13 thescientist13 added enhancement Improve something existing (e.g. no docs, new APIs, etc) documentation Greenwood specific docs CLI labels Nov 9, 2024
@thescientist13 thescientist13 added this to the 1.0 milestone Nov 9, 2024
@thescientist13 thescientist13 changed the title add github actions for bun feature/issue 953 validate support for Bun Nov 9, 2024
@thescientist13 thescientist13 added feature New feature or request question Further information is requested and removed enhancement Improve something existing (e.g. no docs, new APIs, etc) labels Nov 9, 2024
thescientist13

This comment was marked as duplicate.

@thescientist13 thescientist13 changed the title feature/issue 953 validate support for Bun feature/issue 953 support for Bun Nov 11, 2024
@thescientist13 thescientist13 mentioned this pull request Nov 25, 2024
40 tasks
@thescientist13 thescientist13 linked an issue Nov 28, 2024 that may be closed by this pull request
@thescientist13 thescientist13 removed this from the 1.0 milestone Nov 28, 2024
@thescientist13 thescientist13 force-pushed the feature/issue-953-bun-compat branch from d11db6b to 2f55bb7 Compare January 2, 2025 17:54
@thescientist13 thescientist13 self-assigned this Jan 2, 2025
@thescientist13 thescientist13 force-pushed the feature/issue-953-bun-compat branch from fa3acc0 to 41d563c Compare February 21, 2025 22:37
@thescientist13 thescientist13 changed the title feature/issue 953 support for Bun feature/issue 1323 support for Bun Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI documentation Greenwood specific docs feature New feature or request question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bun runtime support
1 participant