Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new Svelte 5 adapter & playground with Typescript included #1871

Closed
wants to merge 17 commits into from

Conversation

jamesst20
Copy link

@jamesst20 jamesst20 commented May 9, 2024

May 16: For those interested, have a look into my fork in the meantime:
https://www.npmjs.com/~jamesstp20
https://www.npmjs.com/package/@jamesst20/inertia-svelte5
https://github.com/jamesst20/inertia
https://github.com/jamesst20/inertia/tree/svelte5-adapter-playground

Original

  • Include my Svelte 5 upgrade Upgrade inertia to svelte 5 #1870 +
  • Heavily inspired TS upgrade Add Svelte TypeScript support #1866 without any extra changes other than adding types
  • All the changes are in a new Svelte5 adapter so no existing code is edited
  • I was forced to switch to pnpm (yarn would work too) because otherwise it's impossible to build the adapter. Deleting svelte4 adapter and playground resolve the error and allows to build the v5 so it's likely that NPM is not scoping packages properly. Here is the error:
> svelte-kit sync && svelte-package && publint

> Unexpected character '@'
    at error (/Users/james/Projects/inertia-perso/node_modules/svelte/compiler.cjs:14256:16)
    at Parser.error (/Users/james/Projects/inertia-perso/node_modules/svelte/compiler.cjs:14404:3)
    at Parser.acorn_error (/Users/james/Projects/inertia-perso/node_modules/svelte/compiler.cjs:14391:8)
    at read_expression (/Users/james/Projects/inertia-perso/node_modules/svelte/compiler.cjs:9641:10)
    at mustache (/Users/james/Projects/inertia-perso/node_modules/svelte/compiler.cjs:13965:22)
    at new Parser (/Users/james/Projects/inertia-perso/node_modules/svelte/compiler.cjs:14352:12)
    at parse (/Users/james/Projects/inertia-perso/node_modules/svelte/compiler.cjs:14529:17)
    at parseHtmlx (/Users/james/Projects/inertia-perso/node_modules/svelte2tsx/index.js:1559:22)
    at processSvelteTemplate (/Users/james/Projects/inertia-perso/node_modules/svelte2tsx/index.js:6497:32)
    at svelte2tsx (/Users/james/Projects/inertia-perso/node_modules/svelte2tsx/index.js:6714:178)
  • PS: With pnpm I could refer from the playground to the adapter like this which is pretty useful "@inertiajs/svelte5": "workspace:*"
  • Edit: Required many attempts but I successfully got the build green!

@jamesst20 jamesst20 force-pushed the svelte5-ts branch 4 times, most recently from 084f0aa to cd4343b Compare May 9, 2024 05:38
@jamesst20 jamesst20 force-pushed the svelte5-ts branch 2 times, most recently from ed44f8b to 257f3dd Compare May 9, 2024 06:13
@jamesst20
Copy link
Author

jamesst20 commented May 10, 2024

As stated here #1870

Inertia doesn't want a new Svelte adapter nor want to upgrade to Svelte 5 new syntax, runes, etc.

Closing

Edit: May 12 2024: Latest version of this branch is here:
https://github.com/jamesst20/inertia/tree/svelte5-adapter-playground

@jamesst20 jamesst20 deleted the svelte5-ts branch May 12, 2024 15:35
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.

None yet

2 participants