Skip to content

V3#75

Open
schettn wants to merge 164 commits intomainfrom
v3
Open

V3#75
schettn wants to merge 164 commits intomainfrom
v3

Conversation

@schettn
Copy link
Contributor

@schettn schettn commented Feb 19, 2025

This pull request includes significant updates to the @getcronit/pylon packages, introducing major changes and new features, as well as some minor improvements and bug fixes. The most important changes include the integration of @getcronit/pylon-builder into @getcronit/pylon-dev, enhancements to the authentication system, and improvements to the plugin system.

Major Changes:

  • Integration of @getcronit/pylon-builder into @getcronit/pylon-dev:

    • Removed the pylon-builder package.
    • The builder now uses esbuild watch mode for faster and more efficient development.
    • Implemented pm2 for process management, restarting the server automatically after builds, and logging with consola.
  • Overhaul of the authentication system:

    • Introduced the useAuth plugin, which automatically sets up authentication routes (/auth/login, /auth/callback, /auth/logout), manages token cookies, and enhances role-based route protection.
    • Updated documentation to reflect the new authentication system and its configuration. [1] [2]

Minor Changes:

  • Enhancements to the plugin system:

    • Extended the plugin system with setup, middleware, and build functions.
    • Integrated the viewer via a built-in useViewer plugin.
    • Custom plugins can now access the app instance and register routes, middleware, and custom build steps.
  • New usePages plugin:

    • Added support for file-based (Fullstack React) routing.
  • Option to disable playground and introspection:

    • Added a configuration option to disable the playground and introspection in the Pylon configuration.

Patch Changes:

  • Fixes and improvements in create-pylon:

    • Used consola for clearer interactive prompts and logs.
    • Removed certain flags in favor of the GQty CLI.
    • Improved package manager detection and dependency installation.
    • Enhanced error handling and messaging.
  • Bug fix:

    • Fixed broken field descriptions in schema parsing.

These updates improve the overall functionality, performance, and developer experience of the @getcronit/pylon packages.

@changeset-bot
Copy link

changeset-bot bot commented Feb 19, 2025

🦋 Changeset detected

Latest commit: 1a39ad4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@getcronit/pylon-dev Major
@getcronit/pylon Major
create-pylon Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Feb 19, 2025

🚀 Snapshot Release (canary)

The latest changes of this PR are available as canary on npm (based on the declared changesets):

Package Version Info
create-pylon 1.1.5-canary-20260317113404.1a39ad4b34ee59425656d7efe6deca94c22a84a8 npm ↗︎ unpkg ↗︎
@getcronit/pylon 3.0.0-canary-20260317113404.1a39ad4b34ee59425656d7efe6deca94c22a84a8 npm ↗︎ unpkg ↗︎
@getcronit/pylon-dev 2.0.0-canary-20260317113404.1a39ad4b34ee59425656d7efe6deca94c22a84a8 npm ↗︎ unpkg ↗︎

enable source maps for client and server builds and update external dependencies
This fixes the the documentation of type fields (e.g. interfaces) in the
schema parser.
Previously, the return type of the property was used to determine the
description of the field. If a type property used the `Date` type,
the description of the `Date` type was used instead of the actual description
of the field.

This commit changes the behavior to use the property symbol instead of the
return type of the property.

closes #76
Nico Schett added 30 commits February 13, 2026 19:49
- Added compression
- Added etag caching
- Improved serve-file-path
- Update setup/index.tsx to wrap request handling in AsyncLocalStorage for proper client scoping.
- Update build-client.ts to disable suspense in createReactClient defaults and expose the raw client.
- Implement WeakMap based caching for selection set extraction.
- Cache unique field identifiers for abstract types to avoid repeated O(N^2) field comparisons.
- Optimize array resolution by memoizing selection set findings.
- Ensure memory safety by using WeakMaps keyed by schema types and AST nodes.
- Remove `etag()` from the wildcard SSR route in the pages plugin
 to enable true streaming and reduce TTFB/CPU usage.
- Implement `X-Pylon-Internal` header to identify internal sub-requests
 from loaders and GraphQL clients.
- Add [skipInternal](cci:1:/pylon/packages/pylon/src/app/index.ts:9:0-16:1)
 utility in the core app to bypass redundant global middleware (compression, Sentry, logging, ID generation) for internal sub-requests.
- Significantly reduce CPU overhead and memory pressure during recursive
 SSR rendering of layouts and pages.
Removed the manual assignment of `crypto.randomUUID()` to `c.req.id` in `pylon/src/app/index.ts`.
This property was not used elsewhere in the codebase and required a `// @ts-ignore` as it's not a standard Hono request property.
- Implements a robust versioning strategy to prevent data inconsistencies
 when new deployments occur while users are actively navigating the application.

Key improvements:

- Added unique version ID generation synchronized across client and server
 build contexts via a promise-based grouping mechanism in the watcher.
- Injected version ID into client-side hydration logic as window.__PYLON_VERSION__.
- Updated page loaders and GraphQL fetchers to detect version mismatches
 and trigger automatic full-page reloads.
- Safeguarded mutations (POST requests) from being lost by deferring
 reloads on version mismatches until the next idempotent request or navigation.
- Propagated version information through X-Pylon-Version headers and
 JSON data snapshots.
…nd introduce `createGateway` for interacting with them.
…lection and `api` context for patch functions.
…solvers

Previously, `PatchSchema` aggressively unwrapped function signatures down to their awaited return types. This caused nested resolvers (e.g., `collections.nodes[0].products`) to incorrectly lose their callable signatures and argument definitions.

This update:
- Modifies `PatchSchema` to infer and retain original arguments (`(...args: infer Args)`), applying the schema patch exclusively to the function's return type.
- Updates `NeedsMap` to safely unwrap function signatures, ensuring nested field selections (`needs`) can still be accurately mapped to the underlying return types.
…s and adjust scalar type resolution in `getType`.
Previously, `wrapResolver` failed to map data correctly when remote
schemas returned fields under their alias keys instead of schema keys.
Furthermore, mixing unaliased and aliased queries for the same field
(e.g., `products` and `a: products`) caused the execution to eagerly
resolve using the schema key, dropping the aliased data.

This update modifies the complex node resolution step to scan
`childNodes` for the presence of any aliases. If aliases are found,
it defers to a dynamic resolver function. At execution time, this
function dynamically prioritizes looking up the specific `aliasKey`
from the resolved data object before falling back to the standard
`schemaKey`.

This ensures robust compatibility with underlying engines when
delegating heavily aliased queries to remote schemas.
Previously, if a user provided a patch function in `PylonGateway` but
did not explicitly spread the original `data` object in their return
statement, any dynamically aliased fields returned by the remote schema
were silently dropped. This caused deeply nested aliased queries to fail
and return null during downstream execution.

This update modifies `PylonPatchTransform` to automatically merge the
original `processedData` with the `patchedData` returned by the user's
patch function. This guarantees that all underlying remote data and
aliases are strictly preserved for the local GraphQL engine to resolve,
regardless of how the patch function is written.
- Add support for generating indexable multi-file feeds.
- Support standard cache revalidation exports for caching integration.
- Introduce MetadataRoute namespace to bundle nested sitemap types.
- Automatically expand relative paths into absolute URLs using the request origin.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unknown package manager Pylon’s New Pages Router – Full-Stack Support Coming! Feedback Wanted!

2 participants