chore: import upstream snapshot with attribution
Deploy (to testing) and Test Playground Preview Worker / Deploy Playground Preview Worker (testing) (push) Has been skipped
Deploy Workers Shared Staging / Deploy Workers Shared Staging (push) Failing after 0s
Prerelease / build (push) Has been skipped
Handle Changesets / Handle Changesets (push) Has been cancelled
Semgrep OSS scan / semgrep-oss (push) Has been cancelled
Deploy (to testing) and Test Playground Preview Worker / Deploy Playground Preview Worker (testing) (push) Has been skipped
Deploy Workers Shared Staging / Deploy Workers Shared Staging (push) Failing after 0s
Prerelease / build (push) Has been skipped
Handle Changesets / Handle Changesets (push) Has been cancelled
Semgrep OSS scan / semgrep-oss (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1 @@
|
||||
module.exports = "common";
|
||||
@@ -0,0 +1 @@
|
||||
export default "bundled";
|
||||
@@ -0,0 +1 @@
|
||||
export default "dynamic";
|
||||
@@ -0,0 +1 @@
|
||||
SELECT * FROM users;
|
||||
@@ -0,0 +1,32 @@
|
||||
import common from "./common.cjs";
|
||||
import dep from "./dep";
|
||||
import sql from "./example.sql";
|
||||
import text from "./text.txt";
|
||||
|
||||
export default <ExportedHandler>{
|
||||
async fetch(request) {
|
||||
const url = new URL(request.url);
|
||||
if (url.pathname === "/dep") {
|
||||
return new Response(dep);
|
||||
}
|
||||
if (url.pathname === "/text") {
|
||||
return new Response(text);
|
||||
}
|
||||
if (url.pathname === "/sql") {
|
||||
return new Response(sql);
|
||||
}
|
||||
if (url.pathname === "/common") {
|
||||
return new Response(common);
|
||||
}
|
||||
if (url.pathname === "/dynamic") {
|
||||
return new Response((await import("./dynamic.js")).default);
|
||||
}
|
||||
if (url.pathname.startsWith("/lang/")) {
|
||||
// Build the path dynamically to ensure esbuild doesn't inline the import.
|
||||
const language =
|
||||
"./lang/" + url.pathname.substring("/lang/".length) + ".js";
|
||||
return new Response((await import(language)).default.hello);
|
||||
}
|
||||
return new Response("Not Found", { status: 404 });
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
export default { hello: "hello" };
|
||||
@@ -0,0 +1 @@
|
||||
export default { hello: "bonjour" };
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
declare module "*.txt" {
|
||||
const value: string;
|
||||
export default value;
|
||||
}
|
||||
|
||||
declare module "*.sql" {
|
||||
const value: string;
|
||||
export default value;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
test
|
||||
Reference in New Issue
Block a user