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

Support jsxImportSource #233

Closed
mcandeia opened this issue Dec 13, 2023 · 17 comments · Fixed by #301
Closed

Support jsxImportSource #233

mcandeia opened this issue Dec 13, 2023 · 17 comments · Fixed by #301
Assignees

Comments

@mcandeia
Copy link

Chore

Describe the chore

Currently deno supports jsxImportSource via deno.json, https://docs.deno.com/runtime/manual/advanced/jsx_dom/jsx

is there a way to support the same passing as parameter of createworker?

@andreespirela andreespirela self-assigned this Jan 18, 2024
@mcandeia
Copy link
Author

hey @andreespirela is there a way to get it running quickly? where I need to change to force a specific jsxImportSource?

@mcandeia
Copy link
Author

By the way: I managed to have it working by changing all .tsx files and added manually the jsx pragma: https://docs.deno.com/runtime/manual/advanced/jsx_dom/jsx

Sadly, it's not scalable. Is there a way to add this in a single place? even within my internal fork.

@mcandeia
Copy link
Author

Hey @nyannyacha, can you help us? We have an entire company (https://deco.cx) waiting for this. so this can unblock running https://github.com/denoland/fresh sites.

@mcandeia
Copy link
Author

Perhaps @laktek 👀 can you provide some guidance? I’m not a pro rust programmer but I think would be a good first issue

@andreespirela
Copy link
Collaborator

@mcandeia Hey there! Will be taking care of this this week.

@mcandeia
Copy link
Author

Amazing @andreespirela, please let me know if you have any progress on this, can be a WIP. We are planning to have a launch of our new product version on April 1st and would be amazing to have edge-runtime running our sites, don't hesitate to reach me out if needed

https://deco.day/

@mcandeia
Copy link
Author

Hey @andreespirela any progress on this? Looking forward to see it running fresh sites

@mcandeia
Copy link
Author

Just to let you know, I managed to have it working with an old version of this repository. But when I tried to apply my changes in the latest versions it did not work. looks a regression for me, I'm receiving a "Path not found" for a dependency that is required,

image

To reproduce just clone and run (./scripts/run.sh) the following PR
https://github.com/deco-cx/edge-runtime/pull/2/files

@nyannyacha
Copy link
Collaborator

nyannyacha commented Mar 25, 2024

Just to let you know, I managed to have it working with an old version of this repository. But when I tried to apply my changes in the latest versions it did not work. looks a regression for me, I'm receiving a "Path not found" for a dependency that is required,

Note:

return Err(std::io::Error::new(
std::io::ErrorKind::NotFound,
"path not found",
));
}
};
let mut final_path = self.root_path.clone();
let mut current_entry = VfsEntryRef::Dir(&self.dir);
for component in relative_path.components() {
let component = component.as_os_str().to_string_lossy();
let current_dir = match current_entry {
VfsEntryRef::Dir(dir) => {
final_path.push(component.as_ref());
dir
}
VfsEntryRef::Symlink(symlink) => {
let dest = symlink.resolve_dest_from_root(&self.root_path);
let (resolved_path, entry) = self.find_entry_inner(&dest, seen)?;
final_path = resolved_path; // overwrite with the new resolved path
match entry {
VfsEntryRef::Dir(dir) => {
final_path.push(component.as_ref());
dir
}
_ => {
return Err(std::io::Error::new(
std::io::ErrorKind::NotFound,
"path not found",
));
}
}
}
_ => {
return Err(std::io::Error::new(
std::io::ErrorKind::NotFound,
"path not found",
));
}
};
match current_dir
.entries
.binary_search_by(|e| e.name().cmp(&component))
{
Ok(index) => {
current_entry = current_dir.entries[index].as_ref();
}
Err(_) => {
return Err(std::io::Error::new(
std::io::ErrorKind::NotFound,
"path not found",
));

if is_file_in_vfs {
let res = self.files.get(path).unwrap().to_vec();
Ok(res)
} else {
Err(std::io::Error::new(std::io::ErrorKind::NotFound, "path not found").into())
}

cc @andreespirela

@mcandeia
Copy link
Author

Just to let you know, I managed to have it working with an old version of this repository. But when I tried to apply my changes in the latest versions it did not work. looks a regression for me, I'm receiving a "Path not found" for a dependency that is required,

Note:

return Err(std::io::Error::new(
std::io::ErrorKind::NotFound,
"path not found",
));
}
};
let mut final_path = self.root_path.clone();
let mut current_entry = VfsEntryRef::Dir(&self.dir);
for component in relative_path.components() {
let component = component.as_os_str().to_string_lossy();
let current_dir = match current_entry {
VfsEntryRef::Dir(dir) => {
final_path.push(component.as_ref());
dir
}
VfsEntryRef::Symlink(symlink) => {
let dest = symlink.resolve_dest_from_root(&self.root_path);
let (resolved_path, entry) = self.find_entry_inner(&dest, seen)?;
final_path = resolved_path; // overwrite with the new resolved path
match entry {
VfsEntryRef::Dir(dir) => {
final_path.push(component.as_ref());
dir
}
_ => {
return Err(std::io::Error::new(
std::io::ErrorKind::NotFound,
"path not found",
));
}
}
}
_ => {
return Err(std::io::Error::new(
std::io::ErrorKind::NotFound,
"path not found",
));
}
};
match current_dir
.entries
.binary_search_by(|e| e.name().cmp(&component))
{
Ok(index) => {
current_entry = current_dir.entries[index].as_ref();
}
Err(_) => {
return Err(std::io::Error::new(
std::io::ErrorKind::NotFound,
"path not found",
));

if is_file_in_vfs {
let res = self.files.get(path).unwrap().to_vec();
Ok(res)
} else {
Err(std::io::Error::new(std::io::ErrorKind::NotFound, "path not found").into())
}

cc @andreespirela

I'm trying to understand the overall architecture, will try to fix it. npm dependencies should be fetched from vfs or static fs ? It looks like a symlink to me, maybe a hard instead of a soft ? Will check

@mcandeia
Copy link
Author

mcandeia commented Mar 25, 2024

I've removed the dependency of @opentelemetry then it starts to work again... except that the Web Worker interface is not available, I'm not sure if this is also a changed that happened in the latest releases of this code was't not being executed in my previous tests.

Error:
image

code: https://denopkg.com/deco-sites/std@1.22.0/utils/worker.ts

Then I removed the worker code and Path not found strikes again:

image

@mcandeia
Copy link
Author

There's a lot of work to do, but I'm pretty confident that is possible to run fresh sites.

@andreespirela
Copy link
Collaborator

andreespirela commented Mar 26, 2024

There's a PR out for this #301 . Should be merged either today or tomorrow. Thanks for the wait @mcandeia

@mcandeia
Copy link
Author

mcandeia commented Mar 26, 2024

Awesome @andreespirela!!

How about the other problems I mentioned (web workers and path not found errors)? Should I create a different issue for those or do you have any clue about that?

@andreespirela
Copy link
Collaborator

@mcandeia I believe it will be fixed with this PR

@nyannyacha nyannyacha linked a pull request Mar 27, 2024 that will close this issue
@mcandeia
Copy link
Author

@andreespirela you mean the WebWorker error and the path not found? It seems unrelated to me, but I'll very happy if it fixes both problems.

@mcandeia
Copy link
Author

mcandeia commented Apr 1, 2024

Looking forward for it @andreespirela !

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

Successfully merging a pull request may close this issue.

3 participants