Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettgu10 committed Mar 1, 2024
1 parent a315d58 commit ba75bbd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .changeset/kind-ducks-pay.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"wrangler": minor
---

Python support for remote dev
feature: Python support for remote dev
13 changes: 4 additions & 9 deletions packages/wrangler/src/deployment-bundle/source-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import fs from "node:fs";
import { pathToFileURL } from "url";
import type { CfModule } from "./worker";

function withSourceURL(source: string, sourcePath: string, isPython = false) {
if (isPython) {
return `${source}\n# sourceURL=${pathToFileURL(sourcePath)}`;
}
function withSourceURL(source: string, sourcePath: string) {
return `${source}\n//# sourceURL=${pathToFileURL(sourcePath)}`;
}

Expand All @@ -20,11 +17,9 @@ export function withSourceURLs(
modules: CfModule[]
): { entrypointSource: string; modules: CfModule[] } {
let entrypointSource = fs.readFileSync(entrypointPath, "utf8");
entrypointSource = withSourceURL(
entrypointSource,
entrypointPath,
entrypointPath.endsWith(".py")
);
if (!entrypointPath.endsWith(".py")) {
entrypointSource = withSourceURL(entrypointSource, entrypointPath);
}

modules = modules.map((module) => {
if (
Expand Down

0 comments on commit ba75bbd

Please sign in to comment.