@getcronit/pylon 3.0.0-canary-20250218210337.5fd3a977d589c14cc224729b00d712f57339cb3d → 3.0.0-canary-20250219195325.e978949d02ea426b3a5c9890a83d38d4d1b34075

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.
package/dist/index.js CHANGED
@@ -819,73 +819,70 @@ import path2 from "path";
819
819
  import { html } from "hono/html";
820
820
  function useViewer() {
821
821
  return {
822
- onRequest: async ({ request, fetchAPI, endResponse, url }) => {
823
- const c = getContext();
824
- if (request.method === "GET" && url.pathname === "/viewer") {
825
- endResponse(
826
- c.html(
827
- await html`
828
- <!DOCTYPE html>
829
- <html>
830
- <head>
831
- <title>Pylon Viewer</title>
832
- <script src="https://cdn.jsdelivr.net/npm/react@16/umd/react.production.min.js"></script>
833
- <script src="https://cdn.jsdelivr.net/npm/react-dom@16/umd/react-dom.production.min.js"></script>
822
+ setup: (app2) => {
823
+ app2.get("/viewer", async (c) => {
824
+ return c.html(
825
+ await html`
826
+ <!DOCTYPE html>
827
+ <html>
828
+ <head>
829
+ <title>Pylon Viewer</title>
830
+ <script src="https://cdn.jsdelivr.net/npm/react@16/umd/react.production.min.js"></script>
831
+ <script src="https://cdn.jsdelivr.net/npm/react-dom@16/umd/react-dom.production.min.js"></script>
834
832
 
835
- <link
836
- rel="stylesheet"
837
- href="https://cdn.jsdelivr.net/npm/graphql-voyager/dist/voyager.css"
838
- />
839
- <style>
840
- body {
841
- padding: 0;
842
- margin: 0;
843
- width: 100%;
844
- height: 100vh;
845
- overflow: hidden;
846
- }
833
+ <link
834
+ rel="stylesheet"
835
+ href="https://cdn.jsdelivr.net/npm/graphql-voyager/dist/voyager.css"
836
+ />
837
+ <style>
838
+ body {
839
+ padding: 0;
840
+ margin: 0;
841
+ width: 100%;
842
+ height: 100vh;
843
+ overflow: hidden;
844
+ }
847
845
 
848
- #voyager {
849
- height: 100%;
850
- position: relative;
851
- }
846
+ #voyager {
847
+ height: 100%;
848
+ position: relative;
852
849
  }
853
- </style>
854
- <script src="https://cdn.jsdelivr.net/npm/graphql-voyager/dist/voyager.min.js"></script>
855
- </head>
856
- <body>
857
- <div id="voyager">Loading...</div>
858
- <script>
859
- function introspectionProvider(introspectionQuery) {
860
- // ... do a call to server using introspectionQuery provided
861
- // or just return pre-fetched introspection
850
+ }
851
+ </style>
852
+ <script src="https://cdn.jsdelivr.net/npm/graphql-voyager/dist/voyager.min.js"></script>
853
+ </head>
854
+ <body>
855
+ <div id="voyager">Loading...</div>
856
+ <script>
857
+ function introspectionProvider(introspectionQuery) {
858
+ // ... do a call to server using introspectionQuery provided
859
+ // or just return pre-fetched introspection
862
860
 
863
- // Endpoint is current path instead of root/graphql
864
- const endpoint = window.location.pathname.replace(
865
- '/viewer',
866
- '/graphql'
867
- )
861
+ // Endpoint is current path instead of root/graphql
862
+ const endpoint = window.location.pathname.replace(
863
+ '/viewer',
864
+ '/graphql'
865
+ )
868
866
 
869
- return fetch(endpoint, {
870
- method: 'post',
871
- headers: {
872
- 'Content-Type': 'application/json'
873
- },
874
- body: JSON.stringify({query: introspectionQuery})
875
- }).then(response => response.json())
876
- }
867
+ return fetch(endpoint, {
868
+ method: 'post',
869
+ headers: {
870
+ 'Content-Type': 'application/json'
871
+ },
872
+ body: JSON.stringify({query: introspectionQuery})
873
+ }).then(response => response.json())
874
+ }
877
875
 
878
- // Render <Voyager />
879
- GraphQLVoyager.init(document.getElementById('voyager'), {
880
- introspection: introspectionProvider
881
- })
882
- </script>
883
- </body>
884
- </html>
885
- `
886
- )
876
+ // Render <Voyager />
877
+ GraphQLVoyager.init(document.getElementById('voyager'), {
878
+ introspection: introspectionProvider
879
+ })
880
+ </script>
881
+ </body>
882
+ </html>
883
+ `
887
884
  );
888
- }
885
+ });
889
886
  }
890
887
  };
891
888
  }
@@ -893,188 +890,186 @@ function useViewer() {
893
890
  // src/plugins/use-unhandled-route.ts
894
891
  import { getVersions } from "@getcronit/pylon-telemetry";
895
892
  import { html as html2 } from "hono/html";
896
- function useUnhandledRoute(args) {
893
+ function useUnhandledRoute() {
897
894
  const versions = getVersions();
898
895
  return {
899
896
  setup: (app2) => {
900
- app2.use(async (c, next) => {
901
- if (c.req.method === "GET" && c.req.path !== args.graphqlEndpoint) {
902
- return c.html(
903
- await html2`<!doctype html>
904
- <html lang="en">
905
- <head>
906
- <meta charset="utf-8" />
907
- <title>Welcome to Pylon</title>
908
- <link
909
- rel="icon"
910
- href="https://pylon.cronit.io/favicon/favicon.ico"
911
- />
912
- <style>
913
- body,
914
- html {
915
- padding: 0;
916
- margin: 0;
917
- height: 100%;
918
- font-family:
919
- 'Inter',
920
- -apple-system,
921
- BlinkMacSystemFont,
922
- 'Segoe UI',
923
- 'Roboto',
924
- 'Oxygen',
925
- 'Ubuntu',
926
- 'Cantarell',
927
- 'Fira Sans',
928
- 'Droid Sans',
929
- 'Helvetica Neue',
930
- sans-serif;
931
- color: white;
932
- background-color: black;
933
- }
934
-
935
- main > section.hero {
936
- display: flex;
937
- height: 90vh;
938
- justify-content: center;
939
- align-items: center;
940
- flex-direction: column;
941
- }
942
-
943
- .logo {
944
- display: flex;
945
- align-items: center;
946
- }
947
-
948
- .logo-svg {
949
- width: 100%
950
- }
951
-
952
- .buttons {
953
- margin-top: 24px;
954
- }
955
-
956
- h1 {
957
- font-size: 80px;
958
- }
959
-
960
- h2 {
961
- color: #888;
962
- max-width: 50%;
963
- margin-top: 0;
964
- text-align: center;
965
- }
966
-
967
- a {
968
- color: #fff;
969
- text-decoration: none;
970
- margin-left: 10px;
971
- margin-right: 10px;
972
- font-weight: bold;
973
- transition: color 0.3s ease;
974
- padding: 4px;
975
- overflow: visible;
976
- }
977
-
978
- a.graphiql:hover {
979
- color: rgba(255, 0, 255, 0.7);
980
- }
981
- a.docs:hover {
982
- color: rgba(28, 200, 238, 0.7);
983
- }
984
- a.tutorial:hover {
985
- color: rgba(125, 85, 245, 0.7);
986
- }
987
- svg {
988
- margin-right: 24px;
989
- }
990
-
991
- .not-what-your-looking-for {
992
- margin-top: 5vh;
993
- }
994
-
995
- .not-what-your-looking-for > * {
996
- margin-left: auto;
997
- margin-right: auto;
998
- }
999
-
1000
- .not-what-your-looking-for > p {
1001
- text-align: center;
1002
- }
1003
-
1004
- .not-what-your-looking-for > h2 {
1005
- color: #464646;
1006
- }
1007
-
1008
- .not-what-your-looking-for > p {
1009
- max-width: 600px;
1010
- line-height: 1.3em;
1011
- }
1012
-
1013
- .not-what-your-looking-for > pre {
1014
- max-width: 300px;
1015
- }
1016
- </style>
1017
- </head>
1018
- <body id="body">
1019
- <main>
1020
- <section class="hero">
1021
- <div class="logo">
1022
- <div>
1023
- <svg class="logo-svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" zoomAndPan="magnify" viewBox="0 0 286.5 121.500001" preserveAspectRatio="xMidYMid meet" version="1.0"><defs><g></g><clipPath id="38f6fcde47"><path d="M 0.339844 42 L 10 42 L 10 79 L 0.339844 79 Z M 0.339844 42 " clip-rule="nonzero"></path></clipPath><clipPath id="af000f7256"><path d="M 64 23.925781 L 72.789062 23.925781 L 72.789062 96.378906 L 64 96.378906 Z M 64 23.925781 " clip-rule="nonzero"></path></clipPath></defs><g fill="currentColor" fill-opacity="1"><g transform="translate(107.11969, 78.49768)"><g><path d="M 10.078125 -25.046875 C 11.109375 -26.398438 12.507812 -27.535156 14.28125 -28.453125 C 16.0625 -29.378906 18.070312 -29.84375 20.3125 -29.84375 C 22.863281 -29.84375 25.195312 -29.210938 27.3125 -27.953125 C 29.425781 -26.691406 31.085938 -24.921875 32.296875 -22.640625 C 33.503906 -20.367188 34.109375 -17.757812 34.109375 -14.8125 C 34.109375 -11.863281 33.503906 -9.222656 32.296875 -6.890625 C 31.085938 -4.566406 29.425781 -2.753906 27.3125 -1.453125 C 25.195312 -0.160156 22.863281 0.484375 20.3125 0.484375 C 18.070312 0.484375 16.078125 0.03125 14.328125 -0.875 C 12.585938 -1.78125 11.171875 -2.910156 10.078125 -4.265625 L 10.078125 13.96875 L 4 13.96875 L 4 -29.359375 L 10.078125 -29.359375 Z M 27.921875 -14.8125 C 27.921875 -16.84375 27.503906 -18.59375 26.671875 -20.0625 C 25.835938 -21.539062 24.734375 -22.660156 23.359375 -23.421875 C 21.992188 -24.179688 20.53125 -24.5625 18.96875 -24.5625 C 17.445312 -24.5625 16 -24.171875 14.625 -23.390625 C 13.257812 -22.609375 12.160156 -21.472656 11.328125 -19.984375 C 10.492188 -18.492188 10.078125 -16.734375 10.078125 -14.703125 C 10.078125 -12.679688 10.492188 -10.914062 11.328125 -9.40625 C 12.160156 -7.894531 13.257812 -6.75 14.625 -5.96875 C 16 -5.1875 17.445312 -4.796875 18.96875 -4.796875 C 20.53125 -4.796875 21.992188 -5.191406 23.359375 -5.984375 C 24.734375 -6.785156 25.835938 -7.953125 26.671875 -9.484375 C 27.503906 -11.015625 27.921875 -12.789062 27.921875 -14.8125 Z M 27.921875 -14.8125 "></path></g></g></g><g fill="currentColor" fill-opacity="1"><g transform="translate(143.259256, 78.49768)"><g><path d="M 30.4375 -29.359375 L 12.421875 13.796875 L 6.125 13.796875 L 12.09375 -0.484375 L 0.53125 -29.359375 L 7.296875 -29.359375 L 15.5625 -6.984375 L 24.140625 -29.359375 Z M 30.4375 -29.359375 "></path></g></g></g><g fill="currentColor" fill-opacity="1"><g transform="translate(174.281707, 78.49768)"><g><path d="M 10.078125 -39.4375 L 10.078125 0 L 4 0 L 4 -39.4375 Z M 10.078125 -39.4375 "></path></g></g></g><g fill="currentColor" fill-opacity="1"><g transform="translate(188.353752, 78.49768)"><g><path d="M 16.734375 0.484375 C 13.960938 0.484375 11.457031 -0.144531 9.21875 -1.40625 C 6.976562 -2.664062 5.21875 -4.441406 3.9375 -6.734375 C 2.664062 -9.035156 2.03125 -11.691406 2.03125 -14.703125 C 2.03125 -17.691406 2.6875 -20.335938 4 -22.640625 C 5.3125 -24.953125 7.101562 -26.726562 9.375 -27.96875 C 11.65625 -29.21875 14.195312 -29.84375 17 -29.84375 C 19.8125 -29.84375 22.351562 -29.21875 24.625 -27.96875 C 26.894531 -26.726562 28.6875 -24.953125 30 -22.640625 C 31.320312 -20.335938 31.984375 -17.691406 31.984375 -14.703125 C 31.984375 -11.722656 31.304688 -9.078125 29.953125 -6.765625 C 28.597656 -4.453125 26.757812 -2.664062 24.4375 -1.40625 C 22.113281 -0.144531 19.546875 0.484375 16.734375 0.484375 Z M 16.734375 -4.796875 C 18.296875 -4.796875 19.757812 -5.164062 21.125 -5.90625 C 22.5 -6.65625 23.613281 -7.773438 24.46875 -9.265625 C 25.320312 -10.765625 25.75 -12.578125 25.75 -14.703125 C 25.75 -16.835938 25.335938 -18.640625 24.515625 -20.109375 C 23.703125 -21.585938 22.617188 -22.695312 21.265625 -23.4375 C 19.910156 -24.1875 18.453125 -24.5625 16.890625 -24.5625 C 15.328125 -24.5625 13.878906 -24.1875 12.546875 -23.4375 C 11.210938 -22.695312 10.15625 -21.585938 9.375 -20.109375 C 8.59375 -18.640625 8.203125 -16.835938 8.203125 -14.703125 C 8.203125 -11.546875 9.007812 -9.101562 10.625 -7.375 C 12.25 -5.65625 14.285156 -4.796875 16.734375 -4.796875 Z M 16.734375 -4.796875 "></path></g></g></g><g fill="currentColor" fill-opacity="1"><g transform="translate(222.361196, 78.49768)"><g><path d="M 18.8125 -29.84375 C 21.125 -29.84375 23.191406 -29.363281 25.015625 -28.40625 C 26.847656 -27.445312 28.28125 -26.023438 29.3125 -24.140625 C 30.34375 -22.253906 30.859375 -19.984375 30.859375 -17.328125 L 30.859375 0 L 24.84375 0 L 24.84375 -16.421875 C 24.84375 -19.046875 24.179688 -21.054688 22.859375 -22.453125 C 21.546875 -23.859375 19.753906 -24.5625 17.484375 -24.5625 C 15.210938 -24.5625 13.410156 -23.859375 12.078125 -22.453125 C 10.742188 -21.054688 10.078125 -19.046875 10.078125 -16.421875 L 10.078125 0 L 4 0 L 4 -29.359375 L 10.078125 -29.359375 L 10.078125 -26.015625 C 11.066406 -27.222656 12.332031 -28.160156 13.875 -28.828125 C 15.425781 -29.503906 17.070312 -29.84375 18.8125 -29.84375 Z M 18.8125 -29.84375 "></path></g></g></g><path fill="currentColor" d="M 53.359375 31.652344 L 53.359375 88.6875 L 62.410156 90.859375 L 62.410156 29.484375 Z M 53.359375 31.652344 " fill-opacity="1" fill-rule="nonzero"></path><g clip-path="url(#38f6fcde47)"><path fill="currentColor" d="M 0.339844 47.433594 L 0.339844 72.910156 C 0.339844 73.34375 0.410156 73.769531 0.554688 74.179688 C 0.699219 74.59375 0.90625 74.96875 1.175781 75.3125 C 1.445312 75.65625 1.765625 75.945312 2.132812 76.179688 C 2.503906 76.414062 2.898438 76.582031 3.324219 76.683594 L 9.390625 78.140625 L 9.390625 42.195312 L 3.3125 43.660156 C 2.890625 43.761719 2.492188 43.929688 2.125 44.164062 C 1.761719 44.402344 1.441406 44.6875 1.171875 45.03125 C 0.902344 45.375 0.695312 45.75 0.554688 46.164062 C 0.410156 46.574219 0.339844 46.996094 0.339844 47.433594 Z M 0.339844 47.433594 " fill-opacity="1" fill-rule="nonzero"></path></g><g clip-path="url(#af000f7256)"><path fill="currentColor" d="M 64.996094 95.085938 L 64.996094 25.253906 C 64.996094 25.082031 65.027344 24.917969 65.09375 24.761719 C 65.160156 24.601562 65.253906 24.460938 65.375 24.339844 C 65.496094 24.21875 65.636719 24.125 65.792969 24.0625 C 65.953125 23.996094 66.117188 23.960938 66.289062 23.960938 L 71.460938 23.960938 C 71.632812 23.960938 71.796875 23.996094 71.957031 24.0625 C 72.113281 24.125 72.253906 24.21875 72.375 24.339844 C 72.496094 24.460938 72.589844 24.601562 72.65625 24.761719 C 72.722656 24.917969 72.753906 25.082031 72.753906 25.253906 L 72.753906 95.085938 C 72.753906 95.257812 72.722656 95.421875 72.65625 95.582031 C 72.589844 95.738281 72.496094 95.878906 72.375 96 C 72.253906 96.121094 72.113281 96.214844 71.957031 96.28125 C 71.796875 96.347656 71.632812 96.378906 71.460938 96.378906 L 66.289062 96.378906 C 66.117188 96.378906 65.953125 96.347656 65.792969 96.28125 C 65.636719 96.214844 65.496094 96.121094 65.375 96 C 65.253906 95.878906 65.160156 95.738281 65.09375 95.582031 C 65.027344 95.421875 64.996094 95.257812 64.996094 95.085938 Z M 64.996094 95.085938 " fill-opacity="1" fill-rule="nonzero"></path></g><path fill="currentColor" d="M 22.320312 81.238281 L 22.320312 39.101562 L 11.976562 41.585938 L 11.976562 78.757812 Z M 22.320312 81.238281 " fill-opacity="1" fill-rule="nonzero"></path><path fill="currentColor" d="M 50.769531 88.066406 L 50.769531 32.277344 L 37.839844 35.378906 L 37.839844 84.960938 Z M 50.769531 88.066406 " fill-opacity="1" fill-rule="nonzero"></path><path fill="currentColor" d="M 24.90625 81.863281 L 35.253906 84.34375 L 35.253906 35.996094 L 24.90625 38.480469 Z M 24.90625 81.863281 " fill-opacity="1" fill-rule="nonzero"></path></svg>
1024
- </div>
1025
- <p>Version: ${versions.pylonVersion}</p>
1026
- </div>
1027
- <h2>Enables TypeScript developers to easily build GraphQL APIs</h2>
1028
- <div class="buttons">
1029
- <a href="https://pylon.cronit.io/docs" class="docs"
1030
- >Read the Docs</add
1031
- >
1032
- <a href="/graphql" class="graphiql">Visit GraphiQL</a>
1033
- <a href="/viewer" class="graphiql">Visit Viewer</a>
897
+ app2.notFound((c) => {
898
+ return c.html(
899
+ html2`<!doctype html>
900
+ <html lang="en">
901
+ <head>
902
+ <meta charset="utf-8" />
903
+ <title>Welcome to Pylon</title>
904
+ <link
905
+ rel="icon"
906
+ href="https://pylon.cronit.io/favicon/favicon.ico"
907
+ />
908
+ <style>
909
+ body,
910
+ html {
911
+ padding: 0;
912
+ margin: 0;
913
+ height: 100%;
914
+ font-family:
915
+ 'Inter',
916
+ -apple-system,
917
+ BlinkMacSystemFont,
918
+ 'Segoe UI',
919
+ 'Roboto',
920
+ 'Oxygen',
921
+ 'Ubuntu',
922
+ 'Cantarell',
923
+ 'Fira Sans',
924
+ 'Droid Sans',
925
+ 'Helvetica Neue',
926
+ sans-serif;
927
+ color: white;
928
+ background-color: black;
929
+ }
930
+
931
+ main > section.hero {
932
+ display: flex;
933
+ height: 90vh;
934
+ justify-content: center;
935
+ align-items: center;
936
+ flex-direction: column;
937
+ }
938
+
939
+ .logo {
940
+ display: flex;
941
+ align-items: center;
942
+ }
943
+
944
+ .logo-svg {
945
+ width: 100%
946
+ }
947
+
948
+ .buttons {
949
+ margin-top: 24px;
950
+ }
951
+
952
+ h1 {
953
+ font-size: 80px;
954
+ }
955
+
956
+ h2 {
957
+ color: #888;
958
+ max-width: 50%;
959
+ margin-top: 0;
960
+ text-align: center;
961
+ }
962
+
963
+ a {
964
+ color: #fff;
965
+ text-decoration: none;
966
+ margin-left: 10px;
967
+ margin-right: 10px;
968
+ font-weight: bold;
969
+ transition: color 0.3s ease;
970
+ padding: 4px;
971
+ overflow: visible;
972
+ }
973
+
974
+ a.graphiql:hover {
975
+ color: rgba(255, 0, 255, 0.7);
976
+ }
977
+ a.docs:hover {
978
+ color: rgba(28, 200, 238, 0.7);
979
+ }
980
+ a.tutorial:hover {
981
+ color: rgba(125, 85, 245, 0.7);
982
+ }
983
+ svg {
984
+ margin-right: 24px;
985
+ }
986
+
987
+ .not-what-your-looking-for {
988
+ margin-top: 5vh;
989
+ }
990
+
991
+ .not-what-your-looking-for > * {
992
+ margin-left: auto;
993
+ margin-right: auto;
994
+ }
995
+
996
+ .not-what-your-looking-for > p {
997
+ text-align: center;
998
+ }
999
+
1000
+ .not-what-your-looking-for > h2 {
1001
+ color: #464646;
1002
+ }
1003
+
1004
+ .not-what-your-looking-for > p {
1005
+ max-width: 600px;
1006
+ line-height: 1.3em;
1007
+ }
1008
+
1009
+ .not-what-your-looking-for > pre {
1010
+ max-width: 300px;
1011
+ }
1012
+ </style>
1013
+ </head>
1014
+ <body id="body">
1015
+ <main>
1016
+ <section class="hero">
1017
+ <div class="logo">
1018
+ <div>
1019
+ <svg class="logo-svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" zoomAndPan="magnify" viewBox="0 0 286.5 121.500001" preserveAspectRatio="xMidYMid meet" version="1.0"><defs><g></g><clipPath id="38f6fcde47"><path d="M 0.339844 42 L 10 42 L 10 79 L 0.339844 79 Z M 0.339844 42 " clip-rule="nonzero"></path></clipPath><clipPath id="af000f7256"><path d="M 64 23.925781 L 72.789062 23.925781 L 72.789062 96.378906 L 64 96.378906 Z M 64 23.925781 " clip-rule="nonzero"></path></clipPath></defs><g fill="currentColor" fill-opacity="1"><g transform="translate(107.11969, 78.49768)"><g><path d="M 10.078125 -25.046875 C 11.109375 -26.398438 12.507812 -27.535156 14.28125 -28.453125 C 16.0625 -29.378906 18.070312 -29.84375 20.3125 -29.84375 C 22.863281 -29.84375 25.195312 -29.210938 27.3125 -27.953125 C 29.425781 -26.691406 31.085938 -24.921875 32.296875 -22.640625 C 33.503906 -20.367188 34.109375 -17.757812 34.109375 -14.8125 C 34.109375 -11.863281 33.503906 -9.222656 32.296875 -6.890625 C 31.085938 -4.566406 29.425781 -2.753906 27.3125 -1.453125 C 25.195312 -0.160156 22.863281 0.484375 20.3125 0.484375 C 18.070312 0.484375 16.078125 0.03125 14.328125 -0.875 C 12.585938 -1.78125 11.171875 -2.910156 10.078125 -4.265625 L 10.078125 13.96875 L 4 13.96875 L 4 -29.359375 L 10.078125 -29.359375 Z M 27.921875 -14.8125 C 27.921875 -16.84375 27.503906 -18.59375 26.671875 -20.0625 C 25.835938 -21.539062 24.734375 -22.660156 23.359375 -23.421875 C 21.992188 -24.179688 20.53125 -24.5625 18.96875 -24.5625 C 17.445312 -24.5625 16 -24.171875 14.625 -23.390625 C 13.257812 -22.609375 12.160156 -21.472656 11.328125 -19.984375 C 10.492188 -18.492188 10.078125 -16.734375 10.078125 -14.703125 C 10.078125 -12.679688 10.492188 -10.914062 11.328125 -9.40625 C 12.160156 -7.894531 13.257812 -6.75 14.625 -5.96875 C 16 -5.1875 17.445312 -4.796875 18.96875 -4.796875 C 20.53125 -4.796875 21.992188 -5.191406 23.359375 -5.984375 C 24.734375 -6.785156 25.835938 -7.953125 26.671875 -9.484375 C 27.503906 -11.015625 27.921875 -12.789062 27.921875 -14.8125 Z M 27.921875 -14.8125 "></path></g></g></g><g fill="currentColor" fill-opacity="1"><g transform="translate(143.259256, 78.49768)"><g><path d="M 30.4375 -29.359375 L 12.421875 13.796875 L 6.125 13.796875 L 12.09375 -0.484375 L 0.53125 -29.359375 L 7.296875 -29.359375 L 15.5625 -6.984375 L 24.140625 -29.359375 Z M 30.4375 -29.359375 "></path></g></g></g><g fill="currentColor" fill-opacity="1"><g transform="translate(174.281707, 78.49768)"><g><path d="M 10.078125 -39.4375 L 10.078125 0 L 4 0 L 4 -39.4375 Z M 10.078125 -39.4375 "></path></g></g></g><g fill="currentColor" fill-opacity="1"><g transform="translate(188.353752, 78.49768)"><g><path d="M 16.734375 0.484375 C 13.960938 0.484375 11.457031 -0.144531 9.21875 -1.40625 C 6.976562 -2.664062 5.21875 -4.441406 3.9375 -6.734375 C 2.664062 -9.035156 2.03125 -11.691406 2.03125 -14.703125 C 2.03125 -17.691406 2.6875 -20.335938 4 -22.640625 C 5.3125 -24.953125 7.101562 -26.726562 9.375 -27.96875 C 11.65625 -29.21875 14.195312 -29.84375 17 -29.84375 C 19.8125 -29.84375 22.351562 -29.21875 24.625 -27.96875 C 26.894531 -26.726562 28.6875 -24.953125 30 -22.640625 C 31.320312 -20.335938 31.984375 -17.691406 31.984375 -14.703125 C 31.984375 -11.722656 31.304688 -9.078125 29.953125 -6.765625 C 28.597656 -4.453125 26.757812 -2.664062 24.4375 -1.40625 C 22.113281 -0.144531 19.546875 0.484375 16.734375 0.484375 Z M 16.734375 -4.796875 C 18.296875 -4.796875 19.757812 -5.164062 21.125 -5.90625 C 22.5 -6.65625 23.613281 -7.773438 24.46875 -9.265625 C 25.320312 -10.765625 25.75 -12.578125 25.75 -14.703125 C 25.75 -16.835938 25.335938 -18.640625 24.515625 -20.109375 C 23.703125 -21.585938 22.617188 -22.695312 21.265625 -23.4375 C 19.910156 -24.1875 18.453125 -24.5625 16.890625 -24.5625 C 15.328125 -24.5625 13.878906 -24.1875 12.546875 -23.4375 C 11.210938 -22.695312 10.15625 -21.585938 9.375 -20.109375 C 8.59375 -18.640625 8.203125 -16.835938 8.203125 -14.703125 C 8.203125 -11.546875 9.007812 -9.101562 10.625 -7.375 C 12.25 -5.65625 14.285156 -4.796875 16.734375 -4.796875 Z M 16.734375 -4.796875 "></path></g></g></g><g fill="currentColor" fill-opacity="1"><g transform="translate(222.361196, 78.49768)"><g><path d="M 18.8125 -29.84375 C 21.125 -29.84375 23.191406 -29.363281 25.015625 -28.40625 C 26.847656 -27.445312 28.28125 -26.023438 29.3125 -24.140625 C 30.34375 -22.253906 30.859375 -19.984375 30.859375 -17.328125 L 30.859375 0 L 24.84375 0 L 24.84375 -16.421875 C 24.84375 -19.046875 24.179688 -21.054688 22.859375 -22.453125 C 21.546875 -23.859375 19.753906 -24.5625 17.484375 -24.5625 C 15.210938 -24.5625 13.410156 -23.859375 12.078125 -22.453125 C 10.742188 -21.054688 10.078125 -19.046875 10.078125 -16.421875 L 10.078125 0 L 4 0 L 4 -29.359375 L 10.078125 -29.359375 L 10.078125 -26.015625 C 11.066406 -27.222656 12.332031 -28.160156 13.875 -28.828125 C 15.425781 -29.503906 17.070312 -29.84375 18.8125 -29.84375 Z M 18.8125 -29.84375 "></path></g></g></g><path fill="currentColor" d="M 53.359375 31.652344 L 53.359375 88.6875 L 62.410156 90.859375 L 62.410156 29.484375 Z M 53.359375 31.652344 " fill-opacity="1" fill-rule="nonzero"></path><g clip-path="url(#38f6fcde47)"><path fill="currentColor" d="M 0.339844 47.433594 L 0.339844 72.910156 C 0.339844 73.34375 0.410156 73.769531 0.554688 74.179688 C 0.699219 74.59375 0.90625 74.96875 1.175781 75.3125 C 1.445312 75.65625 1.765625 75.945312 2.132812 76.179688 C 2.503906 76.414062 2.898438 76.582031 3.324219 76.683594 L 9.390625 78.140625 L 9.390625 42.195312 L 3.3125 43.660156 C 2.890625 43.761719 2.492188 43.929688 2.125 44.164062 C 1.761719 44.402344 1.441406 44.6875 1.171875 45.03125 C 0.902344 45.375 0.695312 45.75 0.554688 46.164062 C 0.410156 46.574219 0.339844 46.996094 0.339844 47.433594 Z M 0.339844 47.433594 " fill-opacity="1" fill-rule="nonzero"></path></g><g clip-path="url(#af000f7256)"><path fill="currentColor" d="M 64.996094 95.085938 L 64.996094 25.253906 C 64.996094 25.082031 65.027344 24.917969 65.09375 24.761719 C 65.160156 24.601562 65.253906 24.460938 65.375 24.339844 C 65.496094 24.21875 65.636719 24.125 65.792969 24.0625 C 65.953125 23.996094 66.117188 23.960938 66.289062 23.960938 L 71.460938 23.960938 C 71.632812 23.960938 71.796875 23.996094 71.957031 24.0625 C 72.113281 24.125 72.253906 24.21875 72.375 24.339844 C 72.496094 24.460938 72.589844 24.601562 72.65625 24.761719 C 72.722656 24.917969 72.753906 25.082031 72.753906 25.253906 L 72.753906 95.085938 C 72.753906 95.257812 72.722656 95.421875 72.65625 95.582031 C 72.589844 95.738281 72.496094 95.878906 72.375 96 C 72.253906 96.121094 72.113281 96.214844 71.957031 96.28125 C 71.796875 96.347656 71.632812 96.378906 71.460938 96.378906 L 66.289062 96.378906 C 66.117188 96.378906 65.953125 96.347656 65.792969 96.28125 C 65.636719 96.214844 65.496094 96.121094 65.375 96 C 65.253906 95.878906 65.160156 95.738281 65.09375 95.582031 C 65.027344 95.421875 64.996094 95.257812 64.996094 95.085938 Z M 64.996094 95.085938 " fill-opacity="1" fill-rule="nonzero"></path></g><path fill="currentColor" d="M 22.320312 81.238281 L 22.320312 39.101562 L 11.976562 41.585938 L 11.976562 78.757812 Z M 22.320312 81.238281 " fill-opacity="1" fill-rule="nonzero"></path><path fill="currentColor" d="M 50.769531 88.066406 L 50.769531 32.277344 L 37.839844 35.378906 L 37.839844 84.960938 Z M 50.769531 88.066406 " fill-opacity="1" fill-rule="nonzero"></path><path fill="currentColor" d="M 24.90625 81.863281 L 35.253906 84.34375 L 35.253906 35.996094 L 24.90625 38.480469 Z M 24.90625 81.863281 " fill-opacity="1" fill-rule="nonzero"></path></svg>
1034
1020
  </div>
1035
- </section>
1036
- <section class="not-what-your-looking-for">
1037
- <h2>Not the page you are looking for? 👀</h2>
1038
- <p>
1039
- This page is shown be default whenever a 404 is hit.<br />You can disable this by behavior
1040
- via the <code>landingPage</code> option in the Pylon config. Edit the <code>src/index.ts</code> file
1041
- and add the following code:
1042
- </p>
1043
- <pre>
1044
- <code>
1045
- export const config: PylonConfig = {
1046
- landingPage: false
1047
- }
1048
- </code>
1049
- </pre>
1050
-
1051
- <p>
1052
- When you define a route, this page will no longer be shown. For example, the following code
1053
- will show a "Hello, world!" message at the root of your app:
1054
- </p>
1055
- <pre>
1056
- <code>
1057
- import {app} from '@getcronit/pylon'
1058
-
1059
- app.get("/", c => {
1060
- return c.text("Hello, world!")
1061
- })
1062
- </code>
1063
- </pre>
1064
- </section>
1065
- </main>
1066
- </body>
1067
- </html>`,
1068
- 404
1069
- );
1070
- }
1071
- return next();
1021
+ <p>Version: ${versions.pylonVersion}</p>
1022
+ </div>
1023
+ <h2>Enables TypeScript developers to easily build GraphQL APIs</h2>
1024
+ <div class="buttons">
1025
+ <a href="https://pylon.cronit.io/docs" class="docs"
1026
+ >Read the Docs</add
1027
+ >
1028
+ <a href="/graphql" class="graphiql">Visit GraphiQL</a>
1029
+ <a href="/viewer" class="graphiql">Visit Viewer</a>
1030
+ </div>
1031
+ </section>
1032
+ <section class="not-what-your-looking-for">
1033
+ <h2>Not the page you are looking for? 👀</h2>
1034
+ <p>
1035
+ This page is shown be default whenever a 404 is hit.<br />You can disable this by behavior
1036
+ via the <code>landingPage</code> option in the Pylon config. Edit the <code>src/index.ts</code> file
1037
+ and add the following code:
1038
+ </p>
1039
+ <pre>
1040
+ <code>
1041
+ export const config: PylonConfig = {
1042
+ landingPage: false
1043
+ }
1044
+ </code>
1045
+ </pre>
1046
+
1047
+ <p>
1048
+ When you define a route, this page will no longer be shown. For example, the following code
1049
+ will show a "Hello, world!" message at the root of your app:
1050
+ </p>
1051
+ <pre>
1052
+ <code>
1053
+ import {app} from '@getcronit/pylon'
1054
+
1055
+ app.get("/", c => {
1056
+ return c.text("Hello, world!")
1057
+ })
1058
+ </code>
1059
+ </pre>
1060
+ </section>
1061
+ </main>
1062
+ </body>
1063
+ </html>`,
1064
+ 404
1065
+ );
1072
1066
  });
1073
1067
  }
1074
1068
  };
1075
1069
  }
1076
1070
 
1077
1071
  // src/app/pylon-handler.ts
1072
+ import { useDisableIntrospection } from "@graphql-yoga/plugin-disable-introspection";
1078
1073
  var resolveLazyObject = (obj) => {
1079
1074
  return typeof obj === "function" ? obj() : obj;
1080
1075
  };
@@ -1097,11 +1092,10 @@ var handler = (options) => {
1097
1092
  const config = resolveLazyObject(config$);
1098
1093
  const plugins = [useSentry(), useViewer(), ...config?.plugins || []];
1099
1094
  if (config?.landingPage ?? true) {
1100
- plugins.push(
1101
- useUnhandledRoute({
1102
- graphqlEndpoint: "/graphql"
1103
- })
1104
- );
1095
+ plugins.push(useUnhandledRoute());
1096
+ }
1097
+ if (config?.graphiql === false) {
1098
+ plugins.push(useDisableIntrospection());
1105
1099
  }
1106
1100
  loadPluginsMiddleware(plugins);
1107
1101
  if (!typeDefs) {
@@ -1160,16 +1154,16 @@ var handler = (options) => {
1160
1154
  }
1161
1155
  });
1162
1156
  const yoga = createYoga({
1157
+ graphqlEndpoint: "/graphql",
1158
+ ...config,
1163
1159
  landingPage: false,
1164
- graphiql: (req) => {
1160
+ graphiql: !!config?.graphiql ? (req) => {
1165
1161
  return {
1166
1162
  shouldPersistHeaders: true,
1167
1163
  title: "Pylon Playground",
1168
1164
  defaultQuery: `# Welcome to the Pylon Playground!`
1169
1165
  };
1170
- },
1171
- graphqlEndpoint: "/graphql",
1172
- ...config,
1166
+ } : false,
1173
1167
  plugins,
1174
1168
  schema
1175
1169
  });
@@ -1180,6 +1174,9 @@ var handler = (options) => {
1180
1174
  } catch (e) {
1181
1175
  }
1182
1176
  const response = await yoga.fetch(c.req.raw, c.env, executionContext);
1177
+ if (response.status === 404) {
1178
+ return c.notFound();
1179
+ }
1183
1180
  return c.newResponse(response.body, response);
1184
1181
  };
1185
1182
  return handler2;
@@ -1215,7 +1212,7 @@ import { createPubSub } from "graphql-yoga";
1215
1212
  import fs2 from "fs";
1216
1213
  import path3 from "path";
1217
1214
  import reactServer from "react-dom/server";
1218
- import { Readable } from "stream";
1215
+ import { PassThrough, Readable } from "stream";
1219
1216
 
1220
1217
  // src/plugins/use-pages/setup/app-loader.tsx
1221
1218
  import { useMemo } from "react";
@@ -1241,7 +1238,6 @@ var AppLoader = (props) => {
1241
1238
  // src/plugins/use-pages/setup/index.tsx
1242
1239
  import { trimTrailingSlash } from "hono/trailing-slash";
1243
1240
  import { StaticRouter } from "react-router";
1244
- import sharp from "sharp";
1245
1241
  import { createHash } from "crypto";
1246
1242
  import { tmpdir } from "os";
1247
1243
  import { pipeline } from "stream/promises";
@@ -1280,7 +1276,7 @@ var setup = (app2) => {
1280
1276
  App = module.default;
1281
1277
  }
1282
1278
  if (!client) {
1283
- client = await import(`${process.cwd()}/.pylon/client`);
1279
+ client = await import(`${process.cwd()}/.pylon/client/index.js`);
1284
1280
  }
1285
1281
  const pageProps = {
1286
1282
  params: c.req.param(),
@@ -1306,39 +1302,81 @@ var setup = (app2) => {
1306
1302
  )
1307
1303
  );
1308
1304
  cacheSnapshot = prepared.cacheSnapshot;
1309
- const stream = await reactServer.renderToReadableStream(
1310
- /* @__PURE__ */ jsx2(
1311
- AppLoader,
1305
+ if (reactServer.renderToReadableStream) {
1306
+ const stream = await reactServer.renderToReadableStream(
1307
+ /* @__PURE__ */ jsx2(
1308
+ AppLoader,
1309
+ {
1310
+ Router: StaticRouter,
1311
+ routerProps: {
1312
+ location: c.req.path
1313
+ },
1314
+ App,
1315
+ client,
1316
+ pylonData: {
1317
+ pageProps,
1318
+ cacheSnapshot: prepared.cacheSnapshot
1319
+ }
1320
+ }
1321
+ ),
1312
1322
  {
1313
- Router: StaticRouter,
1314
- routerProps: {
1315
- location: c.req.path
1316
- },
1317
- App,
1318
- client,
1319
- pylonData: {
1323
+ bootstrapModules: ["/__pylon/static/app.js"],
1324
+ bootstrapScriptContent: `window.__PYLON_DATA__ = ${JSON.stringify({
1320
1325
  pageProps,
1321
- cacheSnapshot: prepared.cacheSnapshot
1326
+ cacheSnapshot
1327
+ })}`
1328
+ }
1329
+ );
1330
+ return c.body(stream);
1331
+ } else if (reactServer.renderToPipeableStream) {
1332
+ let pipeableToReadable2 = function(pipeable) {
1333
+ const passThrough = new PassThrough();
1334
+ pipeable.pipe(passThrough);
1335
+ return Readable.toWeb(passThrough);
1336
+ };
1337
+ var pipeableToReadable = pipeableToReadable2;
1338
+ const pipableStream = reactServer.renderToPipeableStream(
1339
+ /* @__PURE__ */ jsx2(
1340
+ AppLoader,
1341
+ {
1342
+ Router: StaticRouter,
1343
+ routerProps: {
1344
+ location: c.req.path
1345
+ },
1346
+ App,
1347
+ client,
1348
+ pylonData: {
1349
+ pageProps,
1350
+ cacheSnapshot: prepared.cacheSnapshot
1351
+ }
1352
+ }
1353
+ ),
1354
+ {
1355
+ bootstrapModules: ["/__pylon/static/app.js"],
1356
+ bootstrapScriptContent: `window.__PYLON_DATA__ = ${JSON.stringify({
1357
+ pageProps,
1358
+ cacheSnapshot
1359
+ })}`,
1360
+ onShellReady: () => {
1361
+ c.header("Content-Type", "text/html");
1322
1362
  }
1323
1363
  }
1324
- ),
1325
- {
1326
- bootstrapModules: ["/__pylon/static/app.js"],
1327
- bootstrapScriptContent: `window.__PYLON_DATA__ = ${JSON.stringify({
1328
- pageProps,
1329
- cacheSnapshot
1330
- })}`
1331
- }
1332
- );
1333
- return c.body(stream);
1364
+ );
1365
+ const stream = pipeableToReadable2(pipableStream);
1366
+ return c.body(stream);
1367
+ }
1334
1368
  }
1335
1369
  );
1336
- const publicFilesPath = path3.resolve(process.cwd(), ".pylon", "__pylon", "public");
1370
+ const publicFilesPath = path3.resolve(
1371
+ process.cwd(),
1372
+ ".pylon",
1373
+ "__pylon",
1374
+ "public"
1375
+ );
1337
1376
  let publicFiles = [];
1338
1377
  try {
1339
1378
  publicFiles = fs2.readdirSync(publicFilesPath);
1340
1379
  } catch (error) {
1341
- console.error("Error reading public files", error);
1342
1380
  }
1343
1381
  app2.on(
1344
1382
  "GET",
@@ -1417,6 +1455,12 @@ var setup = (app2) => {
1417
1455
  });
1418
1456
  app2.get("/__pylon/image", async (c) => {
1419
1457
  try {
1458
+ let isSupportedFormat2 = function(format2) {
1459
+ const supportedFormats = sharp.format;
1460
+ return Object.keys(supportedFormats).includes(format2);
1461
+ };
1462
+ var isSupportedFormat = isSupportedFormat2;
1463
+ const sharp = (await import("sharp")).default;
1420
1464
  const { src, w, h, q = "75", format = "webp" } = c.req.query();
1421
1465
  const queryStringHash = createHash("sha256").update(JSON.stringify(c.req.query())).digest("hex");
1422
1466
  if (!src) {
@@ -1448,17 +1492,27 @@ var setup = (app2) => {
1448
1492
  );
1449
1493
  const cachePath = path3.join(IMAGE_CACHE_DIR, queryStringHash);
1450
1494
  let imageFormat = format.toLowerCase();
1451
- if (!isSupportedFormat(imageFormat)) {
1495
+ if (!isSupportedFormat2(imageFormat)) {
1452
1496
  throw new Error("Unsupported image format");
1453
1497
  }
1454
1498
  const quality = parseInt(q);
1455
- const image = await sharp(imagePath).resize(finalWidth, finalHeight).toFormat(imageFormat, {
1456
- quality
1457
- }).toFile(cachePath);
1458
- c.res.headers.set("Content-Type", getContentType(image.format));
1459
- return c.body(
1460
- Readable.toWeb(fs2.createReadStream(cachePath))
1461
- );
1499
+ if (IS_IMAGE_CACHE_POSSIBLE) {
1500
+ const image = await sharp(imagePath).resize(finalWidth, finalHeight).toFormat(imageFormat, {
1501
+ quality
1502
+ }).toFile(cachePath);
1503
+ c.res.headers.set("Content-Type", getContentType(image.format));
1504
+ return c.body(
1505
+ Readable.toWeb(
1506
+ fs2.createReadStream(cachePath)
1507
+ )
1508
+ );
1509
+ } else {
1510
+ const image = await sharp(imagePath).resize(finalWidth, finalHeight).toFormat(imageFormat, {
1511
+ quality
1512
+ }).toBuffer({ resolveWithObject: true });
1513
+ c.res.headers.set("Content-Type", getContentType(image.info.format));
1514
+ return c.body(image.data);
1515
+ }
1462
1516
  } catch (error) {
1463
1517
  console.error("Error processing the image:", error);
1464
1518
  return c.json({ error: "Error processing the image" }, 500);
@@ -1466,7 +1520,12 @@ var setup = (app2) => {
1466
1520
  });
1467
1521
  };
1468
1522
  var IMAGE_CACHE_DIR = path3.join(process.cwd(), ".cache/__pylon/images");
1469
- fs2.promises.mkdir(IMAGE_CACHE_DIR, { recursive: true });
1523
+ var IS_IMAGE_CACHE_POSSIBLE = true;
1524
+ try {
1525
+ await fs2.promises.mkdir(IMAGE_CACHE_DIR, { recursive: true });
1526
+ } catch (error) {
1527
+ IS_IMAGE_CACHE_POSSIBLE = false;
1528
+ }
1470
1529
  var calculateDimensions = (originalWidth, originalHeight, width, height) => {
1471
1530
  if (!width && !height) {
1472
1531
  return { width: originalWidth, height: originalHeight };
@@ -1478,10 +1537,6 @@ var calculateDimensions = (originalWidth, originalHeight, width, height) => {
1478
1537
  }
1479
1538
  return { width, height };
1480
1539
  };
1481
- function isSupportedFormat(format) {
1482
- const supportedFormats = sharp.format;
1483
- return Object.keys(supportedFormats).includes(format);
1484
- }
1485
1540
  var getContentType = (format) => {
1486
1541
  switch (format.toLowerCase()) {
1487
1542
  case "webp":
@@ -1685,7 +1740,6 @@ var injectAppHydrationPlugin = {
1685
1740
  // src/plugins/use-pages/build/plugins/image-plugin.ts
1686
1741
  import { createHash as createHash2 } from "crypto";
1687
1742
  import path6 from "path";
1688
- import sharp2 from "sharp";
1689
1743
  import fs4 from "fs/promises";
1690
1744
  var imagePlugin = {
1691
1745
  name: "image-plugin",
@@ -1710,7 +1764,8 @@ var imagePlugin = {
1710
1764
  };
1711
1765
  });
1712
1766
  build2.onLoad({ filter: /\.png$|\.jpg$/ }, async (args) => {
1713
- const image = sharp2(args.path);
1767
+ const sharp = (await import("sharp")).default;
1768
+ const image = sharp(args.path);
1714
1769
  const metadata = await image.metadata();
1715
1770
  const url = `${publicPath}/media/${path6.basename(args.path)}`;
1716
1771
  const searchParams = new URLSearchParams({});