aboutsummaryrefslogtreecommitdiff
path: root/packages/bun-debug-adapter-protocol/src/debugger/fixtures/with-sourcemap.ts
blob: f245ebf76236bfc8b2745ff0890928dedd9ae9f4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
export default {
  fetch(request: Request): Response {
    const animal = getAnimal(request.url);
    const voice = animal.talk();
    return new Response(voice);
  },
};

function getAnimal(query: string): Animal {
  switch (query.split("/").pop()) {
    case "dog":
      return new Dog();
    case "cat":
      return new Cat();
  }
  return new Bird();
}

interface Animal {
  readonly name: string;
  talk(): string;
}

class Dog implements Animal {
  name = "dog";

  talk(): string {
    return "woof";
  }
}

class Cat implements Animal {
  name = "cat";

  talk(): string {
    return "meow";
  }
}

class Bird implements Animal {
  name = "bird";

  talk(): string {
    return "chirp";
  }
}