summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-09-02 17:33:07 +0200
committerGitHub <noreply@github.com>2024-09-02 15:33:07 +0000
commit3015f16fbf3ab064aa938c49df6f2f0404e12fe3 (patch)
treeb1477a59bdd270d1e95852fc575f1f64230e4d95
parentbc51eca70000e809ef3b64f66e9482316768e02a (diff)
fix: remove entrypoint hack for Deno 2.0 (#25332)
-rw-r--r--cli/args/flags.rs48
-rw-r--r--tests/specs/run/netlify_edge_bundler_hack/__test__.jsonc9
-rw-r--r--tests/specs/run/netlify_edge_bundler_hack/main.out1
-rw-r--r--tests/specs/run/netlify_edge_bundler_hack/node_modules/@netlify/edge-bundler/deno/config.ts1
-rw-r--r--tests/specs/run/netlify_edge_bundler_hack/node_modules/@netlify/edge-bundler/package.json5
-rw-r--r--tests/specs/run/netlify_edge_bundler_hack/package.json4
6 files changed, 0 insertions, 68 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs
index 991e71b06..f810fd637 100644
--- a/cli/args/flags.rs
+++ b/cli/args/flags.rs
@@ -4521,53 +4521,6 @@ fn run_parse(
app: Command,
bare: bool,
) -> clap::error::Result<()> {
- // todo(dsherret): remove this in Deno 2.0
- // This is a hack to make https://github.com/netlify/build/pull/5767 work
- // for old versions of @netlify/edge-bundler with new versions of Deno
- // where Deno has gotten smarter at resolving config files.
- //
- // It's an unfortunate scenario, but Netlify has the version at least
- // pinned to 1.x in old versions so we can remove this in Deno 2.0 in
- // a few months.
- fn temp_netlify_deno_1_hack(flags: &mut Flags, script_arg: &str) {
- fn is_netlify_edge_bundler_entrypoint(
- flags: &Flags,
- script_arg: &str,
- ) -> bool {
- // based on diff here: https://github.com/netlify/edge-bundler/blame/f1d33b74ca7aeec19a7c2149316d4547a94e43fb/node/config.ts#L85
- if flags.permissions.allow_read.is_none()
- || flags.permissions.allow_write.is_none()
- || flags.config_flag != ConfigFlag::Discover
- {
- return false;
- }
- if !script_arg.contains("@netlify") {
- return false;
- }
- let path = PathBuf::from(script_arg);
- if !path.ends_with("deno/config.ts") {
- return false;
- }
- let mut found_node_modules = false;
- for component in path.components().filter_map(|c| c.as_os_str().to_str())
- {
- if !found_node_modules {
- found_node_modules = component == "node_modules";
- } else {
- // make this work with pnpm and other package managers
- if component.contains("@netlify") {
- return true;
- }
- }
- }
- false
- }
-
- if is_netlify_edge_bundler_entrypoint(flags, script_arg) {
- flags.config_flag = ConfigFlag::Disabled;
- }
- }
-
runtime_args_parse(flags, matches, true, true);
ext_arg_parse(flags, matches);
@@ -4576,7 +4529,6 @@ fn run_parse(
if let Some(mut script_arg) = matches.remove_many::<String>("script_arg") {
let script = script_arg.next().unwrap();
flags.argv.extend(script_arg);
- temp_netlify_deno_1_hack(flags, &script);
flags.subcommand = DenoSubcommand::Run(RunFlags {
script,
watch: watch_arg_parse_with_paths(matches),
diff --git a/tests/specs/run/netlify_edge_bundler_hack/__test__.jsonc b/tests/specs/run/netlify_edge_bundler_hack/__test__.jsonc
deleted file mode 100644
index 4ae0ebe86..000000000
--- a/tests/specs/run/netlify_edge_bundler_hack/__test__.jsonc
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "args": [
- "run",
- "--allow-read",
- "--allow-write",
- "node_modules/@netlify/edge-bundler/deno/config.ts"
- ],
- "output": "main.out"
-}
diff --git a/tests/specs/run/netlify_edge_bundler_hack/main.out b/tests/specs/run/netlify_edge_bundler_hack/main.out
deleted file mode 100644
index 35821117c..000000000
--- a/tests/specs/run/netlify_edge_bundler_hack/main.out
+++ /dev/null
@@ -1 +0,0 @@
-Success
diff --git a/tests/specs/run/netlify_edge_bundler_hack/node_modules/@netlify/edge-bundler/deno/config.ts b/tests/specs/run/netlify_edge_bundler_hack/node_modules/@netlify/edge-bundler/deno/config.ts
deleted file mode 100644
index f1b207f5b..000000000
--- a/tests/specs/run/netlify_edge_bundler_hack/node_modules/@netlify/edge-bundler/deno/config.ts
+++ /dev/null
@@ -1 +0,0 @@
-console.log("Success");
diff --git a/tests/specs/run/netlify_edge_bundler_hack/node_modules/@netlify/edge-bundler/package.json b/tests/specs/run/netlify_edge_bundler_hack/node_modules/@netlify/edge-bundler/package.json
deleted file mode 100644
index d6043710f..000000000
--- a/tests/specs/run/netlify_edge_bundler_hack/node_modules/@netlify/edge-bundler/package.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "name": "@netlify/edge-bundler",
- "version": "1.0.0",
- "exports": "./index.js",
-} \ No newline at end of file
diff --git a/tests/specs/run/netlify_edge_bundler_hack/package.json b/tests/specs/run/netlify_edge_bundler_hack/package.json
deleted file mode 100644
index bd0ecbc6e..000000000
--- a/tests/specs/run/netlify_edge_bundler_hack/package.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "name": "my-package",
- "version": "1.0.0"
-}