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

square brackets in path to telefunc file cause error in sveltekit build #71

Closed
samuba opened this issue Apr 28, 2023 · 6 comments
Closed
Labels
bug 💥 Something isn't working

Comments

@samuba
Copy link
Contributor

samuba commented Apr 28, 2023

Just added telefunc (which looks awesome by the way) to my sveltekit project and it explodes on build.
I'm using sveltekit 1.15.9 vite 4.3.3 nothing fancy going on in the telefunc'tions.

The logs told me to post these information:

Error: [telefunc@0.1.52][Bug] You stumbled upon a bug in Telefunc's source code.

{
  "sourceFiles": [
    "/__telefunc_typeToShield.ts",
    "/Users/sabach/private-source/eventa2/vite.config.ts",
    "/Users/sabach/private-source/eventa2/.svelte-kit/ambient.d.ts",
    "/Users/sabach/private-source/eventa2/src/app.d.ts",
    "/Users/sabach/private-source/eventa2/src/hooks.client.ts",
    "/Users/sabach/private-source/eventa2/src/hooks.server.ts",
    "/Users/sabach/private-source/eventa2/src/telefunc.d.ts",
    "/Users/sabach/private-source/eventa2/tests/common.ts",
    "/Users/sabach/private-source/eventa2/tests/event.spec.ts",
    "/Users/sabach/private-source/eventa2/tests/guest.spec.ts",
    "/Users/sabach/private-source/eventa2/tests/home.spec.ts",
    "/Users/sabach/private-source/eventa2/src/lib/actions.ts",
    "/Users/sabach/private-source/eventa2/src/lib/analytics.ts",
    "/Users/sabach/private-source/eventa2/src/lib/common.ts",
    "/Users/sabach/private-source/eventa2/src/lib/currentEvent.ts",
    "/Users/sabach/private-source/eventa2/src/lib/database.types.ts",
    "/Users/sabach/private-source/eventa2/src/lib/eventTypes.ts",
    "/Users/sabach/private-source/eventa2/src/lib/formSchemas.ts",
    "/Users/sabach/private-source/eventa2/src/lib/routes.ts",
    "/Users/sabach/private-source/eventa2/src/lib/supabase.server.ts",
    "/Users/sabach/private-source/eventa2/src/lib/supabase.ts",
    "/Users/sabach/private-source/eventa2/src/lib/types.d.ts",
    "/Users/sabach/private-source/eventa2/src/lib/user.ts",
    "/Users/sabach/private-source/eventa2/src/routes/+page.server.ts",
    "/Users/sabach/private-source/eventa2/src/lib/server/email.ts",
    "/Users/sabach/private-source/eventa2/src/lib/server/event.ts",
    "/Users/sabach/private-source/eventa2/src/routes/_telefunc/+server.ts",
    "/Users/sabach/private-source/eventa2/.svelte-kit/types/src/routes/$types.d.ts",
    "/Users/sabach/private-source/eventa2/.svelte-kit/types/src/routes/proxy+page.server.ts",
    "/Users/sabach/private-source/eventa2/src/routes/e/[slug]/__telefunc_shieldGen_event.telefunc.ts",
    "/Users/sabach/private-source/eventa2/src/routes/e/[slug]/+page.server.ts",
    "/Users/sabach/private-source/eventa2/src/routes/e/[slug]/event.telefunc.ts",
    "/Users/sabach/private-source/eventa2/src/routes/e/new/+page.server.ts",
    "/Users/sabach/private-source/eventa2/.svelte-kit/types/src/routes/_telefunc/$types.d.ts",
    "/Users/sabach/private-source/eventa2/src/routes/e/[slug]/delete/+server.ts",
    "/Users/sabach/private-source/eventa2/src/routes/e/[slug]/edit/+page.server.ts",
    "/Users/sabach/private-source/eventa2/.svelte-kit/types/src/routes/e/[slug]/$types.d.ts",
    "/Users/sabach/private-source/eventa2/.svelte-kit/types/src/routes/e/[slug]/proxy+page.server.ts",
    "/Users/sabach/private-source/eventa2/.svelte-kit/types/src/routes/e/new/$types.d.ts",
    "/Users/sabach/private-source/eventa2/.svelte-kit/types/src/routes/e/[slug]/delete/$types.d.ts",
    "/Users/sabach/private-source/eventa2/.svelte-kit/types/src/routes/e/[slug]/edit/$types.d.ts"
  ]
}
at getProject (/Users/sabach/private-source/eventa2/node_modules/telefunc/dist/cjs/node/server/shield/codegen/generateShield.js:66:28)
    at generateShield (/Users/sabach/private-source/eventa2/node_modules/telefunc/dist/cjs/node/server/shield/codegen/generateShield.js:17:62)
    at transformTelefuncFileServerSide (/Users/sabach/private-source/eventa2/node_modules/telefunc/dist/cjs/node/transformer/transformTelefuncFileServerSide.js:13:52)
    at async Object.transform (/Users/sabach/private-source/eventa2/node_modules/telefunc/dist/cjs/node/vite/plugins/transform.js:29:24)
    at async transform (file:///Users/sabach/private-source/eventa2/node_modules/rollup/dist/es/shared/node-entry.js:23499:16)
    at async ModuleLoader.addModuleSource (file:///Users/sabach/private-source/eventa2/node_modules/rollup/dist/es/shared/node-entry.js:23705:30)

@samuba
Copy link
Contributor Author

samuba commented Apr 28, 2023

It looks like this happens when the path to a telefunc file contains square brackets. Was able to reproduce it here:
https://stackblitz.com/edit/sveltejs-kit-template-default-vwsxet?file=src/routes/+page.svelte
just run npm run build in the terminal

@samuba samuba changed the title error during sveltekit build square brackets in path to teleefunc file cause error in sveltekit build Apr 28, 2023
@samuba samuba changed the title square brackets in path to teleefunc file cause error in sveltekit build square brackets in path to telefunc file cause error in sveltekit build Apr 28, 2023
@brillout brillout added the bug 💥 Something isn't working label Apr 28, 2023
@brillout
Copy link
Owner

I could reproduce indeed. Please publish the reproduction on GitHub.

@brillout
Copy link
Owner

Nevermind, I'm seeing that I can download the repo from StackBlitz.

@brillout
Copy link
Owner

Fix released in 0.1.53.

In case you think you can convince your employer: https://github.com/sponsors/brillout.

@samuba
Copy link
Contributor Author

samuba commented Apr 29, 2023

In using it for a small side project, but would definetly ask my employer if he were involved. You really delivered on that 24h bug fix promise 🔥

@brillout
Copy link
Owner

Thanks, I appreciate it! And I'm glad you like it :-).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 💥 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants