Skip to content

Conversation

@voxelstack
Copy link

@voxelstack voxelstack commented Dec 28, 2025

Closes #285

I considered updating search_node_modules to return a command that may or may not include "node" but since including it fixes the Windows issue without breaking other platforms I went with this smaller change instead. This is also consistent with the jsdocinvocation where "node" is always part of the command.

On my windows machine the version call succeeds now but the project I'm testing it on is throwing an unrelated error about ESM URL schemes. Because of that I still haven't gotten a successful run after my changes, working on it now.

nox is also causing errors when I run it locally so after I get a successful run I'll try and check the tests locally with WSL.

@voxelstack
Copy link
Author

voxelstack commented Dec 28, 2025

I guess there are more issues with Windows apart from running typedoc. What I'm seeing now is:

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

I suspect that must be caused by importHooks.mjs but the fallbackUrl starts with file: and TYPEDOC_NODE_MODULES is being set to the correct path. Having a little trouble with this one.
It's caused by paths being given to --import, so that is easily solvable by adding "file:///" + to the imports when running on Windows.

Now what I'm investigating is why the resolver is getting two absolute paths joined together: 'file:///D:/dev/ceres/docs/file:/C:/Users/voxel/pipx/venvs/sphinx-autobuild/Lib/site-packages/sphinx_js/js/main.ts'

dir = Path(__file__).parent.resolve() / "js"
command.add("--tsconfig", str(dir / "tsconfig.json"))
command.add("--import", str(dir / "registerImportHook.mjs"))
command.add("--import", "file:///" + str(dir / "registerImportHook.mjs"))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like there must be a cleaner way to add a protocol to a path.

source_paths = abs_source_paths
if os.name == "nt":
source_paths = map(
lambda path: str(posixpath.join(*str(path).split(os.sep))),
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hate this, my first attempt was path.split(os.sep) but that errors out because WindowsPath doesn't have a split apparently.
Would love suggestions on how to make this better, the only thing that's important here is that these source paths use forward slashes.

@voxelstack
Copy link
Author

voxelstack commented Jan 8, 2026

It works!

I'd appreciate help cleaning up the changes and running all checks locally but these changes were enough to get it working on my Windows machine.

@voxelstack voxelstack marked this pull request as ready for review January 8, 2026 01:58
@hoodmane
Copy link
Member

hoodmane commented Jan 8, 2026

Can you add a windows CI job?

@hoodmane
Copy link
Member

hoodmane commented Jan 8, 2026

And it looks like CI is broken so I'll have to fix that first...

@voxelstack
Copy link
Author

With some pointers I can look into why CI is broken, I just didn't know where to start since the error is on a file that wasn't changed.
I'm not familiar with most of the tools used on the checks and I want to do more research on them but haven't had a lot of time for it lately.
I marked it as ready for review because it's working for my use case but I will continue to work on it.

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 this pull request may close these issues.

Windows build fails with "WinError 193" when js_language = 'typescript'

2 participants