With the following code:
sass.compileString('a {b:}', {url: `file://${process.cwd()}/test.scss`})
sass produces:
sass.Exception [Error]: Expected expression.
╷
1 │ a {b:}
│ ^
╵
test.scss 1:6 root stylesheet
sass-embedded produces:
Exception [Error]: Error: Expected expression.
╷
1 │ a {b:}
│ ^
╵
../../../../test.scss 1:6 root stylesheet
How does it work internally:
-
sassStack internally is a Trace object
|
Trace get trace => Trace([frameForSpan(span, "root stylesheet")]); |
-
trace.toString() internal calls path.prettyUri(uri)
-
path.prettyUri(uri) convert absolute file uri to relative uri, from the current working directory.
Now, here is the problem:
In native dart sass or npm sass package, it's more or less limited by the fact that the context of sassStack is the current working directory of the running dart vm or node vm. However, in npm sass-embedded package, because the working directory of the host and the compiler is different, it produces a ../../../../ prefix on sassStack.
Concurrent implementation of the host allows the host side to concurrently submit different compilation requests in different working directory, and then they can change directory before the compilation is completed. So, the definition of what should be the relative context for sassStack on the host time itself can be ambiguous.
With the following code:
sassproduces:sass-embeddedproduces:How does it work internally:
sassStackinternally is aTraceobjectdart-sass/lib/src/exception.dart
Line 23 in 5fd18c7
trace.toString()internal callspath.prettyUri(uri)path.prettyUri(uri)convert absolute file uri to relative uri, from the current working directory.Now, here is the problem:
In native dart sass or npm sass package, it's more or less limited by the fact that the context of sassStack is the current working directory of the running dart vm or node vm. However, in npm sass-embedded package, because the working directory of the host and the compiler is different, it produces a
../../../../prefix onsassStack.Concurrent implementation of the host allows the host side to concurrently submit different compilation requests in different working directory, and then they can change directory before the compilation is completed. So, the definition of what should be the relative context for
sassStackon the host time itself can be ambiguous.