sass / dart-sass

The reference implementation of Sass, written in Dart.
https://sass-lang.com/dart-sass
MIT License
3.9k stars 352 forks source link

Properly support UNC paths on the command line #1258

Open dnaka91 opened 3 years ago

dnaka91 commented 3 years ago

As a new feature of the project trunk we auto-download dart-sass to the local device and then execute it as one of our pipelines. Before we used a directly compiled library that integrates with libsass but as that's deprecated we want to move to dart-sass.

In Rust, paths are quickly turned into UNC paths like \\?\C:\Users\Me\... through stdlib logic. We try to turn them back into the legacy-style C:\Users\Me\... paths but that may not always work due to path length limits and so on.

Therefore, it would be great if dart-sass could support UNC paths for input/output files.

jathak commented 3 years ago

Sass operates on URLs, not on paths, so we don't plan to add support for any OS-specific paths. If you're converting paths into another format anyway, should you instead convert to a file URL.

dnaka91 commented 3 years ago

I tried out using dart-sass with file URLs now and they don't work neither. Just to clarify, I'm talking about paths to files in the terminal that are passed to dart-sass and not import statements or anything alike.

So I added a conversion step before calling dart-sass, now passing file:///.... instead and that works neither on UNIX nor Windows systems. It fails with Duplicate source "file". similar to the problem with UNC paths.

dnaka91 commented 3 years ago

I think the actual problem is the <input>:<output> syntax so it misunderstands anything with a colon as this mapping.

jathak commented 3 years ago

Ah, I see. I misread this as an issue with using the API, not the command line. OS paths passed on the command line should indeed be converted to URLs, so I'll reopen this, targeted to fixing that for UNC paths

Awjin commented 3 years ago

Dart's path package currently does not support the \\?\ prefix for UNC paths. I've filed a bug with the path repo here: https://github.com/dart-lang/path/issues/106.