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

feat(jsr): support JSR #2662

Merged
merged 30 commits into from
May 24, 2024
Merged

feat(jsr): support JSR #2662

merged 30 commits into from
May 24, 2024

Conversation

yusukebe
Copy link
Member

@yusukebe yusukebe commented May 12, 2024

This PR will enable Hono to support the JSR.

We've done:

  • Added type annotations to reduce Slow Types. perf(types): add type annotations #2663
  • I added the jsr-dry-run command in CI to check if it's ready to publish JSR. 8b24707
  • Added deno.json. 7ac6306 And modified.
  • Made JSX be exported from hono/jsx/jsx-runtime not global. 5bd2b71
  • Made hono-base.ts does not use dynamicClass. b902590
  • Made ExecutionContext is not declared in global. cf020c6
  • Removed deno_dist and denoify completely. 0c776fa
  • Made deno.json exports ./, ./jsx/jsx-runtime, ./middleware, and ./helper.
  • Made deno.json exports each helper, middleware, and adapter following @nakasyou's comment. 90892be

Usage

Currently, we are uploading Hono as @hono/do-not-use-this on the JSR.

deno add @hono/do-not-use-this

You don't use it, but you can use it for experimental purposes.

We will support both npm and JSR

Though this PR will merged and Hono supports JSR, we don't stop supporting the npm. I'm thinking we can do it with the following publishing steps:

  1. Publish the npm package with the np command on my local machine.
  2. The new commit and tag will be pushed to this repo.
  3. If the tag is created, the GitHub Action will execute and release the new version of the JSR package to the JSR. Can we do it with this? https://github.com/dsherret/jsr-publish-on-tag

Differences between npm package

It can't use declare global if it will be published in JSR. So you can't use ContextVariableMap. Instead, you can use the Variables type exported from the middleware.

import { Hono } from '@hono/hono'
import { jwt } from '@hono/hono/jwt'
import type { JwtVariables } from '@hono/hono/jwt'

type Env = {
  Variables: JwtVariables
}

const app = new Hono<Env>()

Goodbye Denoify

We have to say Goodbye to Deonify if this PR is merged.

We were using it heavily to support publishing Hono on deno.land/x. But with this PR, it's not necessary because the --unstable-sloppy-imports option can be used. I've removed the deno_dist directory completely.

Thanks Denoify.

TODO

  • Review the PR.
  • Add a GitHub action to release it to the JSR if the new tag is created. Can we use this? https://github.com/dsherret/jsr-publish-on-tag e91d92e
  • Publish the RC versions and try them in the real world. => later
  • Add module docs in the source. => later
  • Update website docs. => later
  • Add badges for the JSR. => later
  • Update jsr.json to prepare publishing.

@yusukebe yusukebe added the v4.4 label May 12, 2024
@nakasyou
Copy link
Contributor

I think that JSR can instead npm registry, also it's not only for Deno.
JSR users use JSR with runtimes such as Node.js, Bun, CF Workers and Browsers, not limited Deno. So instead of merging it like the traditional middleware.ts, I recommend to exports detailed name such as ./jwt, ./timing, ./logger and etc...

In the same way, we should not export only Deno adapter like serve-static middleware. I think that exporting all runtime adapter like current package.json is good.

@yusukebe
Copy link
Member Author

Thanks for the comment @nakasyou !

It makes sense. I'll do it now.

@KnorpelSenf
Copy link

@yusukebe are you going to publish dually to both npm and JSR? How are you planning on doing the build step?

Context: I am myself maintaining a library for Telegram bots (https://github.com/grammyjs) and we're planning on switching over to JSR, as well, but we are not ready to ditch npm entirely. We are discussing several strategies at the moment in grammyjs/grammY#559 and I'm curious what your take on registry support is. (Side-note: there's actually a grammY-hono integration.)

@yusukebe yusukebe marked this pull request as ready for review May 12, 2024 13:55
@yusukebe
Copy link
Member Author

Hi @KnorpelSenf

Yes. Both npm and JSR. Exactly, it's important to make the publishing steps. I've updated the description of this PR, please read it.

@yusukebe
Copy link
Member Author

Hey @nakasyou @usualoma @ryuapp @watany-dev and others!

Please see this PR. We don't need a detailed review at first. I want to know if this approach is the right one. I would also like you to use the package @hono/do-not-use-this because it is already available.

@usualoma
Copy link
Member

Great nice work! I am fine with this approach.

@usualoma
Copy link
Member

Oh, one comment.

I think SuperClass should be invisible to the user.

CleanShot 2024-05-13 at 11 46 21@2x

I think it would be better to simply define it as a property in Hono itself.

diff --git a/src/hono-base.ts b/src/hono-base.ts
index f15ee2fd..47e8a053 100644
--- a/src/hono-base.ts
+++ b/src/hono-base.ts
@@ -76,28 +76,22 @@ export type HonoOptions<E extends Env> = {
   getPath?: GetPath<E>
 }
 
-abstract class SuperClass<
-  E extends Env = Env,
-  S extends Schema = {},
-  BasePath extends string = '/'
-> {
-  // The implementations of these methods are fake.
-  get: HandlerInterface<E, 'get', S, BasePath> = () => new Hono<any>()
-  post: HandlerInterface<E, 'post', S, BasePath> = () => new Hono<any>()
-  put: HandlerInterface<E, 'put', S, BasePath> = () => new Hono<any>()
-  delete: HandlerInterface<E, 'delete', S, BasePath> = () => new Hono<any>()
-  options: HandlerInterface<E, 'options', S, BasePath> = () => new Hono<any>()
-  patch: HandlerInterface<E, 'patch', S, BasePath> = () => new Hono<any>()
-  all: HandlerInterface<E, 'all', S, BasePath> = () => new Hono<any>()
-  on: OnHandlerInterface<E, S, BasePath> = () => new Hono<any>()
-  use: MiddlewareHandlerInterface<E, S, BasePath> = () => new Hono<any>()
-}
-
 class Hono<
   E extends Env = Env,
   S extends Schema = {},
   BasePath extends string = '/'
-> extends SuperClass<E, S, BasePath> {
+> {
+  // Theses methods are dynamically initialized in the constructor.
+  get!: HandlerInterface<E, 'get', S, BasePath>
+  post!: HandlerInterface<E, 'post', S, BasePath>
+  put!: HandlerInterface<E, 'put', S, BasePath>
+  delete!: HandlerInterface<E, 'delete', S, BasePath>
+  options!: HandlerInterface<E, 'options', S, BasePath>
+  patch!: HandlerInterface<E, 'patch', S, BasePath>
+  all!: HandlerInterface<E, 'all', S, BasePath>
+  on: OnHandlerInterface<E, S, BasePath>
+  use: MiddlewareHandlerInterface<E, S, BasePath>
+
   /*
     This class is like an abstract class and does not have a router.
     To use it, inherit the class and implement router in the constructor.
@@ -111,8 +105,6 @@ class Hono<
   routes: RouterRoute[] = []
 
   constructor(options: HonoOptions<E> = {}) {
-    super()
-
     // Implementation of app.get(...handlers[]) or app.get(path, ...handlers[])
     const allMethods = [...METHODS, METHOD_NAME_ALL_LOWERCASE]
     allMethods.forEach((method) => {

@imcotton
Copy link
Contributor

imcotton commented May 13, 2024

The pkg naming jsr:@hono/hono seemed repetitive, does alternative like jsr:@hono/core on the table?

@nakasyou
Copy link
Contributor

nakasyou commented May 13, 2024

The pkg naming jsr:@hono/hono seemed repetitive, does alternative like jsr:@hono/core on the table?

I don't have any opinion, but in reference, Oak uses @oak/oak.

@imcotton
Copy link
Contributor

That's fair, and it is absolutely non-critical, just brought to attention.

* feat(jsr): remove helper.ts and middleware.ts

* fix: fix test
@yusukebe yusukebe changed the base branch from main to next May 22, 2024 20:36
@usualoma
Copy link
Member

Thanks for the great results.
I think it's good!

@kt3k
Copy link
Contributor

kt3k commented May 23, 2024

Hi @yusukebe. Thanks for working on this!

I also tried @hono/do-not-use-this. The hello world server started without issue on my end. example repo: https://github.com/kt3k/hono-jsr-test

One thing I noticed is that the route context variable doesn't look typed correctly with @hono/do-not-use-this:

Screenshot 2024-05-23 at 11 21 18

The same variable looks typed more accurately when I import Hono from deno.land/x/:

Screenshot 2024-05-23 at 11 21 51

@yusukebe
Copy link
Member Author

Hi @kt3k !

Thanks! In my environment, it is typed correctly:

CleanShot 2024-05-23 at 11 32 47@2x

Maybe the cache or something makes it bad?

@kt3k
Copy link
Contributor

kt3k commented May 23, 2024

I was able to fix the issue if I changed the version to 0.0.6, but I still see the same issue with 0.0.7. I'll take a look in more details later.

Screenshot 2024-05-23 at 12 28 54 Screenshot 2024-05-23 at 12 29 19

@usualoma
Copy link
Member

Actually, I confirmed the same site as @kt3k , although I skipped it because I thought it was an issue dependent on my environment, since I could no longer reproduce it at hand.

CleanShot 2024-05-23 at 13 04 11@2x

After adding one line, import type { HandlerInterface } from '@hono/do-not-use-this/types' , the problem went away and has not occurred since. And no matter how I try, I can't reproduce it.

CleanShot 2024-05-23 at 13 07 01@2x

@kt3k
Copy link
Contributor

kt3k commented May 23, 2024

Oh, adding import type { HandlerInterface } from "jsr:@hono/[email protected]/types"; resolved the issue for me, and if the issue once resolved, it doesn't reproduce even if I removed that workaround..

(BTW if I restart the language server from the command palette of VS Code (selecting Deno: Restart Language Server), then I can still reproduce it)

@yusukebe
Copy link
Member Author

Hi @usualoma @kt3k

I've modified some and uploaded 0.0.8. Could you try it and let me know the result?

@kt3k
Copy link
Contributor

kt3k commented May 23, 2024

Tested with 0.0.8. I still see the issue only after hitting Deno: Restart Language Server command, but if I changed anything in the file, that error disappears. I feel this is minor enough issue and probably can be ignored?

@usualoma
Copy link
Member

I updated to 0.0.8 and types.ts was again unreadable in my environment. Then I added a line and explicitly loaded it and it was resolved again. I have a Deno: Restart Language Server that is unreproducible; after adding one line, I can never reproduce it again. The problem may not be caused by hono, but by Deno's language server.

@kt3k
Copy link
Contributor

kt3k commented May 23, 2024

The problem may not be caused by hono, but by Deno's language server.

Sounds true to me. If I check the script with deno check command, then the context object is correctly typed. Looks like deno lsp issue to me.

@yusukebe
Copy link
Member Author

@usualoma @kt3k

Thank you very much! I think we should go with this.

P.S. The DX for using JSR is good! There is no need to build, it is easy to publish, and the docs are generated automatically. These are great!

@yusukebe
Copy link
Member Author

The time has come. Let's land it!

@yusukebe yusukebe merged commit 1b2a4c0 into next May 24, 2024
11 checks passed
@yusukebe yusukebe deleted the feat/jsr branch May 24, 2024 08:47
@yusukebe
Copy link
Member Author

Publishing the RC version to JSR is a success! You can use @hono/hono by editing the deno.json:

{
  "imports": {
    "@hono/hono": "jsr:@hono/[email protected]"
  }
}

main.ts:

import { Hono } from '@hono/hono'

const app = new Hono()

app.get('/', (c) => {
  return c.text('Hello JSR!')
})

export default app

@yusukebe yusukebe mentioned this pull request May 31, 2024
@riderx
Copy link

riderx commented Jun 5, 2024

Hello I'm trying to migrate from Denoland to JSR, here is my code (I publish the same code in Deno, Node.js and Cloudflare workers)

import { env, getRuntimeKey } from 'hono/adapter'
import type { Context } from 'hono'

export function existInEnv(c: Context, key: string): boolean {
  return key in env(c)
}

export function getEnv(c: Context, key: string): string {
  if (key in env(c))
    return env(c)[key] ?? ''
  return ''
}

The error i get:

error: TS2345 [ERROR]: Argument of type 'import("https://jsr.io/@hono/hono/4.4.2/src/context.ts").Context<any, any, {}>' is not assignable to parameter of type 'import("file:///Users/martindonadieu/Documents/Projects.tmp/capgo/capgo-app/node_modules/.deno/[email protected]/node_modules/hono/dist/types/context.d.ts").Context<any, any, {}>'.
  Property '#private' in type 'Context' refers to a different member that cannot be accessed from within type 'Context'.
  return key in env(c)
                    ^
    at file:///Users/martindonadieu/Documents/Projects.tmp/capgo/capgo-app/supabase/functions/_backend/utils/utils.ts:100:21

TS2345 [ERROR]: Argument of type 'import("https://jsr.io/@hono/hono/4.4.2/src/context.ts").Context<any, any, {}>' is not assignable to parameter of type 'import("file:///Users/martindonadieu/Documents/Projects.tmp/capgo/capgo-app/node_modules/.deno/[email protected]/node_modules/hono/dist/types/context.d.ts").Context<any, any, {}>'.
  if (key in env(c))
                 ^
    at file:///Users/martindonadieu/Documents/Projects.tmp/capgo/capgo-app/supabase/functions/_backend/utils/utils.ts:104:18

TS2345 [ERROR]: Argument of type 'import("https://jsr.io/@hono/hono/4.4.2/src/context.ts").Context<any, any, {}>' is not assignable to parameter of type 'import("file:///Users/martindonadieu/Documents/Projects.tmp/capgo/capgo-app/node_modules/.deno/[email protected]/node_modules/hono/dist/types/context.d.ts").Context<any, any, {}>'.
    return env(c)[key] ?? ''
               ^
    at file:///Users/martindonadieu/Documents/Projects.tmp/capgo/capgo-app/supabase/functions/_backend/utils/utils.ts:105:16

Found 3 errors.

In the doc I see c.env() is obsolete. Use getRuntimeKey() but I don't understand, both functions do very different things.
My import map changed:
CleanShot 2024-06-05 at 02 21 07@2x
So i'm not sure how to migrate, on the doc website there is no mention of deprecation of env()

@yusukebe
Copy link
Member Author

yusukebe commented Jun 5, 2024

Hi @riderx

@hono/sentry is not on the JSR. So use npm:@hono/sentry as is. And if it will not be resolved, you can't use mix both npm:@hono/* and jsr:@hono/hono. Please use both npm specifiers.

@riderx
Copy link

riderx commented Jun 5, 2024

Thanks, sadly the problem is not related to Sentry package, so i changed it and still have the same problem.
It seems related to the Typing.

@riderx
Copy link

riderx commented Jun 5, 2024

@riderx
Copy link

riderx commented Jun 5, 2024

I updated my code example to be more precise

@yusukebe
Copy link
Member Author

yusukebe commented Jun 5, 2024

@riderx

I don't know why it will be so, but the there are two hono packages are used in the project. npm: and jsr:

CleanShot 2024-06-05 at 09 59 08@2x

CleanShot 2024-06-05 at 09 59 11@2x

This mismatch causet the problem. I can't find a good way immediately but you can use full URL to solve it:

import { env, getRuntimeKey } from 'jsr:@hono/[email protected]/adapter'
import type { SupabaseClient } from '@supabase/supabase-js'
import type { Context } from 'jsr:@hono/[email protected]'
import type { Database } from './supabase.types.ts'

@riderx
Copy link

riderx commented Jun 5, 2024

I don't think I can use the JSR prefix, since I'm deploying in 3 envs.
That why I use import map.
But you made me realize one issue, the new import name is @hono/hono and I didn't migrate it so it still used the NPM one for others env.
So I did now the migration and found a way to make it work in Deno, but now the Cloudflare workers doesn't work as the schema used in Deno doesn't work anymore.
So i updated my branch and now my current problem is this:

 ⛅️ wrangler 3.57.2 (update available 3.59.0)
-------------------------------------------------------

✘ [ERROR] Could not resolve "@hono/tiny"

    cloudflare_workers/index.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/http-exception"

    cloudflare_workers/index.ts:5:30:
      5 │ import { HTTPException } from '@hono/http-exception'~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "@hono/http-exception" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/plugins/channel_self.ts:5:21:
      5 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/plugins/stats.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/plugins/updates.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/private/config.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/private/delete_failed_version.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/private/devices.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/private/download_link.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/private/log_as.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/private/plans.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/private/public_stats.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/private/stats.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/private/store_top.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/private/stripe_checkout.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/private/stripe_portal.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/private/upload_link.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/public/bundles.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/public/channel.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/public/devices.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/public/ok.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/triggers/clear_app_cache.ts:3:21:
      3 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/triggers/clear_device_cache.ts:3:21:
      3 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/triggers/cron_clear_versions.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/triggers/cron_email.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/triggers/cron_plan.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/triggers/cron_scrapper.ts:2:21:
      2 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/triggers/cron_stats.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/triggers/logsnag_insights.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/triggers/on_app_create.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/triggers/on_channel_update.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/triggers/on_organization_create.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/triggers/on_user_create.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/triggers/on_user_delete.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/triggers/on_user_update.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/triggers/on_version_create.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/triggers/on_version_delete.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/triggers/on_version_update.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/tiny"

    supabase/functions/_backend/triggers/stripe_event.ts:1:21:
      1 │ import { Hono } from '@hono/tiny'~~~~~~~~~~~~

  You can mark the path "@hono/tiny" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/utils/buffer"

    supabase/functions/_backend/utils/hono.ts:1:32:
      1 │ import { timingSafeEqual } from '@hono/utils/buffer'~~~~~~~~~~~~~~~~~~~~

  You can mark the path "@hono/utils/buffer" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/http-exception"

    supabase/functions/_backend/utils/hono.ts:3:30:
      3 │ import { HTTPException } from '@hono/http-exception'~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "@hono/http-exception" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/cors"

    supabase/functions/_backend/utils/hono.ts:4:21:
      4 │ import { cors } from '@hono/cors'~~~~~~~~~~~~

  You can mark the path "@hono/cors" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/adapter"

    supabase/functions/_backend/utils/pg.ts:6:30:
      6 │ import { getRuntimeKey } from '@hono/adapter'~~~~~~~~~~~~~~~

  You can mark the path "@hono/adapter" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/adapter"

    supabase/functions/_backend/utils/stats.ts:2:30:
      2 │ import { getRuntimeKey } from '@hono/adapter'~~~~~~~~~~~~~~~

  You can mark the path "@hono/adapter" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "@hono/adapter"

    supabase/functions/_backend/utils/utils.ts:1:35:
      1 │ import { env, getRuntimeKey } from '@hono/adapter'~~~~~~~~~~~~~~~

  You can mark the path "@hono/adapter" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Build failed with 45 errors:

  cloudflare_workers/index.ts:1:21: ERROR: Could not resolve "@hono/tiny"
  cloudflare_workers/index.ts:5:30: ERROR: Could not resolve "@hono/http-exception"
  supabase/functions/_backend/plugins/channel_self.ts:5:21: ERROR: Could not resolve "@hono/tiny"
  supabase/functions/_backend/plugins/stats.ts:1:21: ERROR: Could not resolve "@hono/tiny"
  supabase/functions/_backend/plugins/updates.ts:1:21: ERROR: Could not resolve "@hono/tiny"
  ...


🪵  Logs were written to "/Users/martindonadieu/Library/Preferences/.wrangler/logs/wrangler-2024-06-05_02-03-22_577.log"

Before the import where structured the same on all platforms, so I didn't have the issue

@riderx
Copy link

riderx commented Jun 5, 2024

@yusukebe thanks a lot I found my way to JSR, here was my required change:
CleanShot 2024-06-05 at 04 22 44@2x
And in import:
CleanShot 2024-06-05 at 04 23 51@2x
And package json:
CleanShot 2024-06-05 at 04 24 30@2x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants