sass-embedded 1.0.0-beta.5 → 1.49.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2379 -22
- package/README.md +95 -9
- package/dist/.gitignore +1 -1
- package/dist/lib/index.js +34 -12
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/src/{embedded-compiler/compiler.js → async-compiler.js} +9 -17
- package/dist/lib/src/async-compiler.js.map +1 -0
- package/dist/lib/src/compile.js +186 -96
- package/dist/lib/src/compile.js.map +1 -1
- package/dist/lib/src/compiler-path.js +18 -0
- package/dist/lib/src/compiler-path.js.map +1 -0
- package/dist/lib/src/{embedded-protocol/utils.js → deprotofy-span.js} +16 -18
- package/dist/lib/src/deprotofy-span.js.map +1 -0
- package/dist/lib/src/{embedded-protocol/dispatcher.js → dispatcher.js} +45 -40
- package/dist/lib/src/dispatcher.js.map +1 -0
- package/dist/lib/src/exception.js +20 -0
- package/dist/lib/src/exception.js.map +1 -0
- package/dist/lib/src/function-registry.js +92 -0
- package/dist/lib/src/function-registry.js.map +1 -0
- package/dist/lib/src/importer-registry.js +127 -0
- package/dist/lib/src/importer-registry.js.map +1 -0
- package/dist/lib/src/legacy/importer.js +186 -0
- package/dist/lib/src/legacy/importer.js.map +1 -0
- package/dist/lib/src/legacy/index.js +262 -0
- package/dist/lib/src/legacy/index.js.map +1 -0
- package/dist/lib/src/legacy/resolve-path.js +101 -0
- package/dist/lib/src/legacy/resolve-path.js.map +1 -0
- package/dist/lib/src/legacy/value/base.js +17 -0
- package/dist/lib/src/legacy/value/base.js.map +1 -0
- package/dist/lib/src/legacy/value/color.js +64 -0
- package/dist/lib/src/legacy/value/color.js.map +1 -0
- package/dist/lib/src/legacy/value/index.js +23 -0
- package/dist/lib/src/legacy/value/index.js.map +1 -0
- package/dist/lib/src/legacy/value/list.js +50 -0
- package/dist/lib/src/legacy/value/list.js.map +1 -0
- package/dist/lib/src/legacy/value/map.js +74 -0
- package/dist/lib/src/legacy/value/map.js.map +1 -0
- package/dist/lib/src/legacy/value/number.js +60 -0
- package/dist/lib/src/legacy/value/number.js.map +1 -0
- package/dist/lib/src/legacy/value/string.js +27 -0
- package/dist/lib/src/legacy/value/string.js.map +1 -0
- package/dist/lib/src/legacy/value/wrap.js +83 -0
- package/dist/lib/src/legacy/value/wrap.js.map +1 -0
- package/dist/lib/src/{embedded-protocol/message-transformer.js → message-transformer.js} +2 -2
- package/dist/lib/src/message-transformer.js.map +1 -0
- package/dist/lib/src/{embedded-compiler/packet-transformer.js → packet-transformer.js} +0 -0
- package/dist/lib/src/packet-transformer.js.map +1 -0
- package/dist/lib/src/protofier.js +272 -0
- package/dist/lib/src/protofier.js.map +1 -0
- package/dist/lib/src/{embedded-protocol/request-tracker.js → request-tracker.js} +0 -0
- package/dist/lib/src/request-tracker.js.map +1 -0
- package/dist/lib/src/sync-compiler.js +52 -0
- package/dist/lib/src/sync-compiler.js.map +1 -0
- package/dist/lib/src/{exception/span.js → sync-process/event.js} +2 -2
- package/dist/lib/src/sync-process/event.js.map +1 -0
- package/dist/lib/src/sync-process/index.js +122 -0
- package/dist/lib/src/sync-process/index.js.map +1 -0
- package/dist/lib/src/sync-process/sync-message-port.js +128 -0
- package/dist/lib/src/sync-process/sync-message-port.js.map +1 -0
- package/dist/lib/src/sync-process/worker.js +51 -0
- package/dist/lib/src/sync-process/worker.js.map +1 -0
- package/dist/lib/src/utils.js +79 -1
- package/dist/lib/src/utils.js.map +1 -1
- package/dist/lib/src/value/argument-list.js +31 -0
- package/dist/lib/src/value/argument-list.js.map +1 -0
- package/dist/lib/src/value/boolean.js +20 -4
- package/dist/lib/src/value/boolean.js.map +1 -1
- package/dist/lib/src/value/color.js +89 -98
- package/dist/lib/src/value/color.js.map +1 -1
- package/dist/lib/src/value/function.js +34 -0
- package/dist/lib/src/value/function.js.map +1 -0
- package/dist/lib/src/value/{value.js → index.js} +5 -1
- package/dist/lib/src/value/index.js.map +1 -0
- package/dist/lib/src/value/list.js +15 -18
- package/dist/lib/src/value/list.js.map +1 -1
- package/dist/lib/src/value/map.js +17 -10
- package/dist/lib/src/value/map.js.map +1 -1
- package/dist/lib/src/value/null.js +15 -3
- package/dist/lib/src/value/null.js.map +1 -1
- package/dist/lib/src/value/number.js +20 -26
- package/dist/lib/src/value/number.js.map +1 -1
- package/dist/lib/src/value/string.js +14 -9
- package/dist/lib/src/value/string.js.map +1 -1
- package/dist/lib/src/value/utils.js +7 -1
- package/dist/lib/src/value/utils.js.map +1 -1
- package/dist/lib/src/vendor/embedded-protocol/embedded_sass_pb.js +1438 -121
- package/dist/lib/src/vendor/embedded-protocol/embedded_sass_pb.js.map +1 -1
- package/dist/package.json +6 -4
- package/dist/tool/utils.js +47 -16
- package/dist/tool/utils.js.map +1 -1
- package/dist/types/compile.d.ts +152 -0
- package/dist/types/exception.d.ts +41 -0
- package/dist/types/importer.d.ts +294 -0
- package/dist/types/index.d.ts +80 -0
- package/dist/types/legacy/exception.d.ts +54 -0
- package/dist/types/legacy/function.d.ts +756 -0
- package/dist/types/legacy/importer.d.ts +168 -0
- package/dist/types/legacy/options.d.ts +642 -0
- package/dist/types/legacy/plugin_this.d.ts +73 -0
- package/dist/types/legacy/render.d.ts +139 -0
- package/dist/types/logger/index.d.ts +94 -0
- package/dist/types/logger/source_location.d.ts +21 -0
- package/dist/types/logger/source_span.d.ts +34 -0
- package/dist/types/options.d.ts +418 -0
- package/dist/types/util/promise_or.d.ts +17 -0
- package/dist/types/value/argument_list.d.ts +47 -0
- package/dist/types/value/boolean.d.ts +29 -0
- package/dist/types/value/color.d.ts +107 -0
- package/dist/types/value/function.d.ts +22 -0
- package/dist/types/value/index.d.ts +173 -0
- package/dist/types/value/list.d.ts +54 -0
- package/dist/types/value/map.d.ts +41 -0
- package/dist/types/value/number.d.ts +305 -0
- package/dist/types/value/string.d.ts +84 -0
- package/package.json +6 -4
- package/dist/lib/index.d.ts +0 -10
- package/dist/lib/src/compile.d.ts +0 -22
- package/dist/lib/src/embedded-compiler/compiler.d.ts +0 -19
- package/dist/lib/src/embedded-compiler/compiler.js.map +0 -1
- package/dist/lib/src/embedded-compiler/packet-transformer.d.ts +0 -34
- package/dist/lib/src/embedded-compiler/packet-transformer.js.map +0 -1
- package/dist/lib/src/embedded-protocol/dispatcher.d.ts +0 -60
- package/dist/lib/src/embedded-protocol/dispatcher.js.map +0 -1
- package/dist/lib/src/embedded-protocol/message-transformer.d.ts +0 -47
- package/dist/lib/src/embedded-protocol/message-transformer.js.map +0 -1
- package/dist/lib/src/embedded-protocol/request-tracker.d.ts +0 -20
- package/dist/lib/src/embedded-protocol/request-tracker.js.map +0 -1
- package/dist/lib/src/embedded-protocol/utils.d.ts +0 -7
- package/dist/lib/src/embedded-protocol/utils.js.map +0 -1
- package/dist/lib/src/exception/exception.d.ts +0 -19
- package/dist/lib/src/exception/exception.js +0 -37
- package/dist/lib/src/exception/exception.js.map +0 -1
- package/dist/lib/src/exception/location.d.ts +0 -11
- package/dist/lib/src/exception/location.js +0 -6
- package/dist/lib/src/exception/location.js.map +0 -1
- package/dist/lib/src/exception/span.d.ts +0 -29
- package/dist/lib/src/exception/span.js.map +0 -1
- package/dist/lib/src/node-sass/render.d.ts +0 -61
- package/dist/lib/src/node-sass/render.js +0 -127
- package/dist/lib/src/node-sass/render.js.map +0 -1
- package/dist/lib/src/utils.d.ts +0 -16
- package/dist/lib/src/value/boolean.d.ts +0 -25
- package/dist/lib/src/value/color.d.ts +0 -89
- package/dist/lib/src/value/list.d.ts +0 -41
- package/dist/lib/src/value/map.d.ts +0 -26
- package/dist/lib/src/value/null.d.ts +0 -12
- package/dist/lib/src/value/number.d.ts +0 -189
- package/dist/lib/src/value/string.d.ts +0 -56
- package/dist/lib/src/value/utils.d.ts +0 -44
- package/dist/lib/src/value/value.d.ts +0 -108
- package/dist/lib/src/value/value.js.map +0 -1
- package/dist/lib/src/vendor/embedded-protocol/embedded_sass_pb.d.ts +0 -1
- package/dist/tool/utils.d.ts +0 -32
package/README.md
CHANGED
|
@@ -1,13 +1,99 @@
|
|
|
1
1
|
## Embedded Sass Host
|
|
2
2
|
|
|
3
|
-
This is
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
[
|
|
11
|
-
|
|
3
|
+
This package is an alternative to the [`sass`] package. It supports the same JS
|
|
4
|
+
API as `sass` and is maintained by the same team, but where the `sass` package
|
|
5
|
+
is pure JavaScript, `sass-embedded` is instead a JavaScript wrapper around a
|
|
6
|
+
native Dart executable. This means `sass-embedded` will generally be much faster
|
|
7
|
+
especially for large Sass compilations, but it can only be installed on the
|
|
8
|
+
platforms that Dart supports: Windows, Mac OS, and Linux.
|
|
9
|
+
|
|
10
|
+
[`sass`]: https://www.npmjs.com/package/sass
|
|
11
|
+
|
|
12
|
+
Despite being different packages, both `sass` and `sass-embedded` are considered
|
|
13
|
+
"Dart Sass" since they have the same underlying implementation. Since the first
|
|
14
|
+
stable release of the `sass-embedded` package, both packages are released at the
|
|
15
|
+
same time and share the same version number.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
This package provides the same JavaScript API as the `sass` package, and can be
|
|
20
|
+
used as a drop-in replacement:
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
const sass = require('sass-embedded');
|
|
24
|
+
|
|
25
|
+
const result = sass.compile(scssFilename);
|
|
26
|
+
|
|
27
|
+
// OR
|
|
28
|
+
|
|
29
|
+
const result = await sass.compileAsync(scssFilename);
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Unlike the `sass` package, the asynchronous API in `sass-embedded` will
|
|
33
|
+
generally be faster than the synchronous API since the Sass compilation logic is
|
|
34
|
+
happening in a different process.
|
|
35
|
+
|
|
36
|
+
See [the Sass website] for full API documentation.
|
|
37
|
+
|
|
38
|
+
[the Sass website]: https://sass-lang.com/documentation/js-api
|
|
39
|
+
|
|
40
|
+
### Legacy API
|
|
41
|
+
|
|
42
|
+
The `sass-embedded` package also supports the older JavaScript API that's fully
|
|
43
|
+
compatible with [Node Sass] (with a few exceptions listed below), with support
|
|
44
|
+
for both the [`render()`] and [`renderSync()`] functions. This API is considered
|
|
45
|
+
deprecated and will be removed in Dart Sass 2.0.0, so it should be avoided in
|
|
46
|
+
new projects.
|
|
47
|
+
|
|
48
|
+
[Node Sass]: https://github.com/sass/node-sass
|
|
49
|
+
[`render()`]: https://sass-lang.com/documentation/js-api/modules#render
|
|
50
|
+
[`renderSync()`]: https://sass-lang.com/documentation/js-api/modules#renderSync
|
|
51
|
+
|
|
52
|
+
Sass's support for the legacy JavaScript API has the following limitations:
|
|
53
|
+
|
|
54
|
+
* Only the `"expanded"` and `"compressed"` values of [`outputStyle`] are
|
|
55
|
+
supported.
|
|
56
|
+
|
|
57
|
+
* The `sass-embedded` package doesn't support the [`precision`] option. Dart
|
|
58
|
+
Sass defaults to a sufficiently high precision for all existing browsers, and
|
|
59
|
+
making this customizable would make the code substantially less efficient.
|
|
60
|
+
|
|
61
|
+
* The `sass-embedded` package doesn't support the [`sourceComments`] option.
|
|
62
|
+
Source maps are the recommended way of locating the origin of generated
|
|
63
|
+
selectors.
|
|
64
|
+
|
|
65
|
+
* The `sass-embedded` package doesn't support the [`indentWidth`],
|
|
66
|
+
[`indentType`], or [`linefeed`] options. It implements the legacy API as a
|
|
67
|
+
wrapper around the new API, and the new API has dropped support for these
|
|
68
|
+
options.
|
|
69
|
+
|
|
70
|
+
[`outputStyle`]: https://sass-lang.com/documentation/js-api/interfaces/LegacySharedOptions#outputStyle
|
|
71
|
+
[`precision`]: https://github.com/sass/node-sass#precision
|
|
72
|
+
[`indentWidth`]: https://sass-lang.com/documentation/js-api/interfaces/LegacySharedOptions#indentWidth
|
|
73
|
+
[`indentType`]: https://sass-lang.com/documentation/js-api/interfaces/LegacySharedOptions#indentType
|
|
74
|
+
[`linefeed`]: https://sass-lang.com/documentation/js-api/interfaces/LegacySharedOptions#linefeed
|
|
75
|
+
|
|
76
|
+
## How Does It Work?
|
|
77
|
+
|
|
78
|
+
The `sass-embedded` runs the Dart Sass [embedded compiler] as a separate
|
|
79
|
+
executable and uses the [Embedded Sass Protocol] to communicate with it over its
|
|
80
|
+
stdin and stdout streams. This protocol is designed to make it possible not only
|
|
81
|
+
to start a Sass compilation, but to control aspects of it that are exposed by an
|
|
82
|
+
API. This includes defining custom importers, functions, and loggers, all of
|
|
83
|
+
which are invoked by messages from the embedded compiler back to the host.
|
|
84
|
+
|
|
85
|
+
[embedded compiler]: https://github.com/sass/dart-sass-embedded
|
|
86
|
+
[Embedded Sass Protocol]: https://github.com/sass/embedded-protocol#readme
|
|
87
|
+
|
|
88
|
+
Although this sort of two-way communication with an embedded process is
|
|
89
|
+
inherently asynchronous in Node.js, this package supports the synchronous
|
|
90
|
+
`compile()` API using a custom [synchronous message-passing library] that's
|
|
91
|
+
implemented with the [`Atomics.wait()`] primitive. We hope to release this
|
|
92
|
+
library as a stand-alone package at some point in the future.
|
|
93
|
+
|
|
94
|
+
[synchronous message-passing library]: https://github.com/sass/embedded-host-node/blob/main/lib/src/sync-process/sync-message-port.ts
|
|
95
|
+
[`Atomics.wait()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/wait
|
|
96
|
+
|
|
97
|
+
---
|
|
12
98
|
|
|
13
99
|
Disclaimer: this is not an official Google product.
|
package/dist/.gitignore
CHANGED
package/dist/lib/index.js
CHANGED
|
@@ -3,26 +3,48 @@
|
|
|
3
3
|
// MIT-style license that can be found in the LICENSE file or at
|
|
4
4
|
// https://opensource.org/licenses/MIT.
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.info = exports.render = exports.
|
|
6
|
+
exports.NULL = exports.FALSE = exports.TRUE = exports.Logger = exports.info = exports.renderSync = exports.render = exports.compileStringAsync = exports.compileAsync = exports.compileString = exports.compile = exports.Exception = exports.types = exports.sassNull = exports.Value = exports.SassString = exports.SassNumber = exports.SassMap = exports.SassFunction = exports.SassColor = exports.sassTrue = exports.sassFalse = exports.SassArgumentList = exports.SassList = void 0;
|
|
7
7
|
const pkg = require("../package.json");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var boolean_1 = require("./src/value/boolean");
|
|
11
|
-
Object.defineProperty(exports, "sassFalse", { enumerable: true, get: function () { return boolean_1.sassFalse; } });
|
|
12
|
-
Object.defineProperty(exports, "sassTrue", { enumerable: true, get: function () { return boolean_1.sassTrue; } });
|
|
13
|
-
var color_1 = require("./src/value/color");
|
|
14
|
-
Object.defineProperty(exports, "SassColor", { enumerable: true, get: function () { return color_1.SassColor; } });
|
|
8
|
+
const boolean_1 = require("./src/value/boolean");
|
|
9
|
+
const null_1 = require("./src/value/null");
|
|
15
10
|
var list_1 = require("./src/value/list");
|
|
16
11
|
Object.defineProperty(exports, "SassList", { enumerable: true, get: function () { return list_1.SassList; } });
|
|
12
|
+
var argument_list_1 = require("./src/value/argument-list");
|
|
13
|
+
Object.defineProperty(exports, "SassArgumentList", { enumerable: true, get: function () { return argument_list_1.SassArgumentList; } });
|
|
14
|
+
var boolean_2 = require("./src/value/boolean");
|
|
15
|
+
Object.defineProperty(exports, "sassFalse", { enumerable: true, get: function () { return boolean_2.sassFalse; } });
|
|
16
|
+
Object.defineProperty(exports, "sassTrue", { enumerable: true, get: function () { return boolean_2.sassTrue; } });
|
|
17
|
+
var color_1 = require("./src/value/color");
|
|
18
|
+
Object.defineProperty(exports, "SassColor", { enumerable: true, get: function () { return color_1.SassColor; } });
|
|
19
|
+
var function_1 = require("./src/value/function");
|
|
20
|
+
Object.defineProperty(exports, "SassFunction", { enumerable: true, get: function () { return function_1.SassFunction; } });
|
|
17
21
|
var map_1 = require("./src/value/map");
|
|
18
22
|
Object.defineProperty(exports, "SassMap", { enumerable: true, get: function () { return map_1.SassMap; } });
|
|
19
|
-
var null_1 = require("./src/value/null");
|
|
20
|
-
Object.defineProperty(exports, "sassNull", { enumerable: true, get: function () { return null_1.sassNull; } });
|
|
21
23
|
var number_1 = require("./src/value/number");
|
|
22
24
|
Object.defineProperty(exports, "SassNumber", { enumerable: true, get: function () { return number_1.SassNumber; } });
|
|
23
25
|
var string_1 = require("./src/value/string");
|
|
24
26
|
Object.defineProperty(exports, "SassString", { enumerable: true, get: function () { return string_1.SassString; } });
|
|
25
|
-
var
|
|
26
|
-
Object.defineProperty(exports, "
|
|
27
|
+
var value_1 = require("./src/value");
|
|
28
|
+
Object.defineProperty(exports, "Value", { enumerable: true, get: function () { return value_1.Value; } });
|
|
29
|
+
var null_2 = require("./src/value/null");
|
|
30
|
+
Object.defineProperty(exports, "sassNull", { enumerable: true, get: function () { return null_2.sassNull; } });
|
|
31
|
+
exports.types = require("./src/legacy/value");
|
|
32
|
+
var exception_1 = require("./src/exception");
|
|
33
|
+
Object.defineProperty(exports, "Exception", { enumerable: true, get: function () { return exception_1.Exception; } });
|
|
34
|
+
var compile_1 = require("./src/compile");
|
|
35
|
+
Object.defineProperty(exports, "compile", { enumerable: true, get: function () { return compile_1.compile; } });
|
|
36
|
+
Object.defineProperty(exports, "compileString", { enumerable: true, get: function () { return compile_1.compileString; } });
|
|
37
|
+
Object.defineProperty(exports, "compileAsync", { enumerable: true, get: function () { return compile_1.compileAsync; } });
|
|
38
|
+
Object.defineProperty(exports, "compileStringAsync", { enumerable: true, get: function () { return compile_1.compileStringAsync; } });
|
|
39
|
+
var legacy_1 = require("./src/legacy");
|
|
40
|
+
Object.defineProperty(exports, "render", { enumerable: true, get: function () { return legacy_1.render; } });
|
|
41
|
+
Object.defineProperty(exports, "renderSync", { enumerable: true, get: function () { return legacy_1.renderSync; } });
|
|
27
42
|
exports.info = `sass-embedded\t${pkg.version}`;
|
|
43
|
+
exports.Logger = {
|
|
44
|
+
silent: { warn() { }, debug() { } },
|
|
45
|
+
};
|
|
46
|
+
// Legacy JS API
|
|
47
|
+
exports.TRUE = boolean_1.sassTrue;
|
|
48
|
+
exports.FALSE = boolean_1.sassFalse;
|
|
49
|
+
exports.NULL = null_1.sassNull;
|
|
28
50
|
//# sourceMappingURL=index.js.map
|
package/dist/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,uCAAuC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,uCAAuC;AACvC,iDAAwD;AACxD,2CAA0C;AAE1C,yCAAyD;AAAlC,gGAAA,QAAQ,OAAA;AAC/B,2DAA2D;AAAnD,iHAAA,gBAAgB,OAAA;AACxB,+CAAwD;AAAhD,oGAAA,SAAS,OAAA;AAAE,mGAAA,QAAQ,OAAA;AAC3B,2CAA4C;AAApC,kGAAA,SAAS,OAAA;AACjB,iDAAkD;AAA1C,wGAAA,YAAY,OAAA;AACpB,uCAAwC;AAAhC,8FAAA,OAAO,OAAA;AACf,6CAA8C;AAAtC,oGAAA,UAAU,OAAA;AAClB,6CAA8C;AAAtC,oGAAA,UAAU,OAAA;AAClB,qCAAkC;AAA1B,8FAAA,KAAK,OAAA;AACb,yCAA0C;AAAlC,gGAAA,QAAQ,OAAA;AAEhB,8CAA4C;AAC5C,6CAA0C;AAAlC,sGAAA,SAAS,OAAA;AACjB,yCAKuB;AAJrB,kGAAA,OAAO,OAAA;AACP,wGAAA,aAAa,OAAA;AACb,uGAAA,YAAY,OAAA;AACZ,6GAAA,kBAAkB,OAAA;AAEpB,uCAAgD;AAAxC,gGAAA,MAAM,OAAA;AAAE,oGAAA,UAAU,OAAA;AAEb,QAAA,IAAI,GAAG,kBAAkB,GAAG,CAAC,OAAO,EAAE,CAAC;AAEvC,QAAA,MAAM,GAAG;IACpB,MAAM,EAAE,EAAC,IAAI,KAAI,CAAC,EAAE,KAAK,KAAI,CAAC,EAAC;CAChC,CAAC;AAEF,gBAAgB;AAEH,QAAA,IAAI,GAAG,kBAAQ,CAAC;AAChB,QAAA,KAAK,GAAG,mBAAS,CAAC;AAClB,QAAA,IAAI,GAAG,eAAQ,CAAC"}
|
|
@@ -3,27 +3,19 @@
|
|
|
3
3
|
// MIT-style license that can be found in the LICENSE file or at
|
|
4
4
|
// https://opensource.org/licenses/MIT.
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
const fs = require("fs");
|
|
6
|
+
exports.AsyncEmbeddedCompiler = void 0;
|
|
8
7
|
const child_process_1 = require("child_process");
|
|
9
|
-
const path_1 = require("path");
|
|
10
8
|
const rxjs_1 = require("rxjs");
|
|
11
9
|
const operators_1 = require("rxjs/operators");
|
|
10
|
+
const compiler_path_1 = require("./compiler-path");
|
|
12
11
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* An asynchronous wrapper for the embedded Sass compiler that exposes its stdio
|
|
13
|
+
* streams as Observables.
|
|
15
14
|
*/
|
|
16
|
-
class
|
|
15
|
+
class AsyncEmbeddedCompiler {
|
|
17
16
|
constructor() {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const executable = (0, path_1.resolve)(__dirname, path, `dart-sass-embedded/dart-sass-embedded${process.platform === 'win32' ? '.bat' : ''}`);
|
|
21
|
-
if (fs.existsSync(executable)) {
|
|
22
|
-
return (0, child_process_1.spawn)(executable, { windowsHide: true });
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
throw new Error("Embedded Dart Sass couldn't find the embedded compiler executable.");
|
|
26
|
-
})();
|
|
17
|
+
/** The underlying process that's being wrapped. */
|
|
18
|
+
this.process = (0, child_process_1.spawn)(compiler_path_1.compilerPath, { windowsHide: true });
|
|
27
19
|
/** The child process's exit event. */
|
|
28
20
|
this.exit$ = new Promise(resolve => {
|
|
29
21
|
this.process.on('exit', code => resolve(code));
|
|
@@ -46,5 +38,5 @@ class EmbeddedCompiler {
|
|
|
46
38
|
this.process.stdin.end();
|
|
47
39
|
}
|
|
48
40
|
}
|
|
49
|
-
exports.
|
|
50
|
-
//# sourceMappingURL=compiler.js.map
|
|
41
|
+
exports.AsyncEmbeddedCompiler = AsyncEmbeddedCompiler;
|
|
42
|
+
//# sourceMappingURL=async-compiler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async-compiler.js","sourceRoot":"","sources":["../../../lib/src/async-compiler.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,iDAAoC;AACpC,+BAAgC;AAChC,8CAAyC;AAEzC,mDAA6C;AAE7C;;;GAGG;AACH,MAAa,qBAAqB;IAAlC;QACE,mDAAmD;QAClC,YAAO,GAAG,IAAA,qBAAK,EAAC,4BAAY,EAAE,EAAC,WAAW,EAAE,IAAI,EAAC,CAAC,CAAC;QAEpE,sCAAsC;QAC7B,UAAK,GAAG,IAAI,OAAO,CAAgB,OAAO,CAAC,EAAE;YACpD,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;QAEH,yDAAyD;QAChD,YAAO,GAAG,IAAI,iBAAU,CAAS,QAAQ,CAAC,EAAE;YACnD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAA,qBAAS,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAE/B,yDAAyD;QAChD,YAAO,GAAG,IAAI,iBAAU,CAAS,QAAQ,CAAC,EAAE;YACnD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAA,qBAAS,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAWjC,CAAC;IATC,oDAAoD;IACpD,UAAU,CAAC,MAAc;QACvB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED,uEAAuE;IACvE,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;IAC3B,CAAC;CACF;AA5BD,sDA4BC"}
|
package/dist/lib/src/compile.js
CHANGED
|
@@ -3,127 +3,217 @@
|
|
|
3
3
|
// MIT-style license that can be found in the LICENSE file or at
|
|
4
4
|
// https://opensource.org/licenses/MIT.
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.compileString = exports.compile = void 0;
|
|
7
|
-
const
|
|
8
|
-
const compiler_1 = require("./embedded-compiler/compiler");
|
|
9
|
-
const packet_transformer_1 = require("./embedded-compiler/packet-transformer");
|
|
10
|
-
const message_transformer_1 = require("./embedded-protocol/message-transformer");
|
|
11
|
-
const dispatcher_1 = require("./embedded-protocol/dispatcher");
|
|
12
|
-
const utils_1 = require("./embedded-protocol/utils");
|
|
6
|
+
exports.compileStringAsync = exports.compileAsync = exports.compileString = exports.compile = void 0;
|
|
7
|
+
const supportsColor = require("supports-color");
|
|
13
8
|
const proto = require("./vendor/embedded-protocol/embedded_sass_pb");
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
return response.css;
|
|
9
|
+
const utils = require("./utils");
|
|
10
|
+
const async_compiler_1 = require("./async-compiler");
|
|
11
|
+
const dispatcher_1 = require("./dispatcher");
|
|
12
|
+
const exception_1 = require("./exception");
|
|
13
|
+
const function_registry_1 = require("./function-registry");
|
|
14
|
+
const importer_registry_1 = require("./importer-registry");
|
|
15
|
+
const message_transformer_1 = require("./message-transformer");
|
|
16
|
+
const packet_transformer_1 = require("./packet-transformer");
|
|
17
|
+
const sync_compiler_1 = require("./sync-compiler");
|
|
18
|
+
const deprotofy_span_1 = require("./deprotofy-span");
|
|
19
|
+
function compile(path, options) {
|
|
20
|
+
const importers = new importer_registry_1.ImporterRegistry(options);
|
|
21
|
+
return compileRequestSync(newCompilePathRequest(path, importers, options), importers, options);
|
|
29
22
|
}
|
|
30
23
|
exports.compile = compile;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
*/
|
|
35
|
-
async function compileString(options) {
|
|
36
|
-
// TODO(awjin): Create logger, importer, function registries.
|
|
37
|
-
var _a;
|
|
38
|
-
const request = newCompileStringRequest({
|
|
39
|
-
source: options.source,
|
|
40
|
-
sourceMap: !!options.sourceMap,
|
|
41
|
-
url: options.url instanceof url_1.URL ? options.url.toString() : options.url,
|
|
42
|
-
syntax: (_a = options.syntax) !== null && _a !== void 0 ? _a : 'scss',
|
|
43
|
-
});
|
|
44
|
-
const response = await compileRequest(request);
|
|
45
|
-
if (options.sourceMap) {
|
|
46
|
-
options.sourceMap(response.sourceMap);
|
|
47
|
-
}
|
|
48
|
-
return response.css;
|
|
24
|
+
function compileString(source, options) {
|
|
25
|
+
const importers = new importer_registry_1.ImporterRegistry(options);
|
|
26
|
+
return compileRequestSync(newCompileStringRequest(source, importers, options), importers, options);
|
|
49
27
|
}
|
|
50
28
|
exports.compileString = compileString;
|
|
29
|
+
function compileAsync(path, options) {
|
|
30
|
+
const importers = new importer_registry_1.ImporterRegistry(options);
|
|
31
|
+
return compileRequestAsync(newCompilePathRequest(path, importers, options), importers, options);
|
|
32
|
+
}
|
|
33
|
+
exports.compileAsync = compileAsync;
|
|
34
|
+
function compileStringAsync(source, options) {
|
|
35
|
+
const importers = new importer_registry_1.ImporterRegistry(options);
|
|
36
|
+
return compileRequestAsync(newCompileStringRequest(source, importers, options), importers, options);
|
|
37
|
+
}
|
|
38
|
+
exports.compileStringAsync = compileStringAsync;
|
|
51
39
|
// Creates a request for compiling a file.
|
|
52
|
-
function
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
request.setPath(options.path);
|
|
56
|
-
request.setSourceMap(options.sourceMap);
|
|
40
|
+
function newCompilePathRequest(path, importers, options) {
|
|
41
|
+
const request = newCompileRequest(importers, options);
|
|
42
|
+
request.setPath(path);
|
|
57
43
|
return request;
|
|
58
44
|
}
|
|
59
45
|
// Creates a request for compiling a string.
|
|
60
|
-
function newCompileStringRequest(options) {
|
|
61
|
-
|
|
46
|
+
function newCompileStringRequest(source, importers, options) {
|
|
47
|
+
var _a;
|
|
62
48
|
const input = new proto.InboundMessage.CompileRequest.StringInput();
|
|
63
|
-
input.setSource(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
else if (options.syntax === 'indented') {
|
|
68
|
-
input.setSyntax(proto.Syntax['INDENTED']);
|
|
69
|
-
}
|
|
70
|
-
else if (options.syntax === 'css') {
|
|
71
|
-
input.setSyntax(proto.Syntax['CSS']);
|
|
72
|
-
}
|
|
73
|
-
if (options.url)
|
|
49
|
+
input.setSource(source);
|
|
50
|
+
input.setSyntax(utils.protofySyntax((_a = options === null || options === void 0 ? void 0 : options.syntax) !== null && _a !== void 0 ? _a : 'scss'));
|
|
51
|
+
if (options === null || options === void 0 ? void 0 : options.url)
|
|
74
52
|
input.setUrl(options.url.toString());
|
|
75
|
-
|
|
53
|
+
if (options && 'importer' in options && options.importer) {
|
|
54
|
+
input.setImporter(importers.register(options.importer));
|
|
55
|
+
}
|
|
56
|
+
const request = newCompileRequest(importers, options);
|
|
76
57
|
request.setString(input);
|
|
77
|
-
request
|
|
58
|
+
return request;
|
|
59
|
+
}
|
|
60
|
+
// Creates a compilation request for the given `options` without adding any
|
|
61
|
+
// input-specific options.
|
|
62
|
+
function newCompileRequest(importers, options) {
|
|
63
|
+
var _a, _b, _c;
|
|
64
|
+
const request = new proto.InboundMessage.CompileRequest();
|
|
65
|
+
request.setImportersList(importers.importers);
|
|
66
|
+
request.setGlobalFunctionsList(Object.keys((_a = options === null || options === void 0 ? void 0 : options.functions) !== null && _a !== void 0 ? _a : {}));
|
|
67
|
+
request.setSourceMap(!!(options === null || options === void 0 ? void 0 : options.sourceMap));
|
|
68
|
+
request.setSourceMapIncludeSources(!!(options === null || options === void 0 ? void 0 : options.sourceMapIncludeSources));
|
|
69
|
+
request.setAlertColor((_b = options === null || options === void 0 ? void 0 : options.alertColor) !== null && _b !== void 0 ? _b : !!supportsColor.stdout);
|
|
70
|
+
request.setAlertAscii(!!(options === null || options === void 0 ? void 0 : options.alertAscii));
|
|
71
|
+
request.setQuietDeps(!!(options === null || options === void 0 ? void 0 : options.quietDeps));
|
|
72
|
+
request.setVerbose(!!(options === null || options === void 0 ? void 0 : options.verbose));
|
|
73
|
+
switch ((_c = options === null || options === void 0 ? void 0 : options.style) !== null && _c !== void 0 ? _c : 'expanded') {
|
|
74
|
+
case 'expanded':
|
|
75
|
+
request.setStyle(proto.OutputStyle.EXPANDED);
|
|
76
|
+
break;
|
|
77
|
+
case 'compressed':
|
|
78
|
+
request.setStyle(proto.OutputStyle.COMPRESSED);
|
|
79
|
+
break;
|
|
80
|
+
default:
|
|
81
|
+
throw new Error(`Unknown options.style: "${options === null || options === void 0 ? void 0 : options.style}"`);
|
|
82
|
+
}
|
|
78
83
|
return request;
|
|
79
84
|
}
|
|
80
85
|
// Spins up a compiler, then sends it a compile request. Returns a promise that
|
|
81
86
|
// resolves with the CompileResult. Throws if there were any protocol or
|
|
82
87
|
// compilation errors. Shuts down the compiler after compilation.
|
|
83
|
-
async function
|
|
84
|
-
const
|
|
88
|
+
async function compileRequestAsync(request, importers, options) {
|
|
89
|
+
const functions = new function_registry_1.FunctionRegistry(options === null || options === void 0 ? void 0 : options.functions);
|
|
90
|
+
const embeddedCompiler = new async_compiler_1.AsyncEmbeddedCompiler();
|
|
85
91
|
try {
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
},
|
|
94
|
-
handleFileImportRequest: () => {
|
|
95
|
-
throw Error('Custom file importers not yet implemented.');
|
|
96
|
-
},
|
|
97
|
-
handleCanonicalizeRequest: () => {
|
|
98
|
-
throw Error('Canonicalize not yet implemented.');
|
|
99
|
-
},
|
|
100
|
-
handleFunctionCallRequest: () => {
|
|
101
|
-
throw Error('Custom functions not yet implemented.');
|
|
102
|
-
},
|
|
92
|
+
const dispatcher = createDispatcher(embeddedCompiler.stdout$, buffer => {
|
|
93
|
+
embeddedCompiler.writeStdin(buffer);
|
|
94
|
+
}, {
|
|
95
|
+
handleImportRequest: request => importers.import(request),
|
|
96
|
+
handleFileImportRequest: request => importers.fileImport(request),
|
|
97
|
+
handleCanonicalizeRequest: request => importers.canonicalize(request),
|
|
98
|
+
handleFunctionCallRequest: request => functions.call(request),
|
|
103
99
|
});
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
const sourceMap = success.getSourceMap();
|
|
109
|
-
if (request.getSourceMap() && sourceMap === undefined) {
|
|
110
|
-
throw Error('Compiler did not provide sourceMap.');
|
|
100
|
+
dispatcher.logEvents$.subscribe(event => handleLogEvent(options, event));
|
|
101
|
+
return handleCompileResponse(await new Promise((resolve, reject) => dispatcher.sendCompileRequest(request, (err, response) => {
|
|
102
|
+
if (err) {
|
|
103
|
+
reject(err);
|
|
111
104
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
105
|
+
else {
|
|
106
|
+
resolve(response);
|
|
107
|
+
}
|
|
108
|
+
})));
|
|
109
|
+
}
|
|
110
|
+
finally {
|
|
111
|
+
embeddedCompiler.close();
|
|
112
|
+
await embeddedCompiler.exit$;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
// Spins up a compiler, then sends it a compile request. Returns a promise that
|
|
116
|
+
// resolves with the CompileResult. Throws if there were any protocol or
|
|
117
|
+
// compilation errors. Shuts down the compiler after compilation.
|
|
118
|
+
function compileRequestSync(request, importers, options) {
|
|
119
|
+
const functions = new function_registry_1.FunctionRegistry(options === null || options === void 0 ? void 0 : options.functions);
|
|
120
|
+
const embeddedCompiler = new sync_compiler_1.SyncEmbeddedCompiler();
|
|
121
|
+
try {
|
|
122
|
+
const dispatcher = createDispatcher(embeddedCompiler.stdout$, buffer => {
|
|
123
|
+
embeddedCompiler.writeStdin(buffer);
|
|
124
|
+
}, {
|
|
125
|
+
handleImportRequest: request => importers.import(request),
|
|
126
|
+
handleFileImportRequest: request => importers.fileImport(request),
|
|
127
|
+
handleCanonicalizeRequest: request => importers.canonicalize(request),
|
|
128
|
+
handleFunctionCallRequest: request => functions.call(request),
|
|
129
|
+
});
|
|
130
|
+
dispatcher.logEvents$.subscribe(event => handleLogEvent(options, event));
|
|
131
|
+
let error;
|
|
132
|
+
let response;
|
|
133
|
+
dispatcher.sendCompileRequest(request, (error_, response_) => {
|
|
134
|
+
if (error_) {
|
|
135
|
+
error = error_;
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
response = response_;
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
for (;;) {
|
|
142
|
+
if (!embeddedCompiler.yield()) {
|
|
143
|
+
throw utils.compilerError('Embedded compiler exited unexpectedly.');
|
|
144
|
+
}
|
|
145
|
+
if (error)
|
|
146
|
+
throw error;
|
|
147
|
+
if (response)
|
|
148
|
+
return handleCompileResponse(response);
|
|
116
149
|
}
|
|
117
|
-
|
|
118
|
-
|
|
150
|
+
}
|
|
151
|
+
finally {
|
|
152
|
+
embeddedCompiler.close();
|
|
153
|
+
embeddedCompiler.yieldUntilExit();
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Creates a dispatcher that dispatches messages from the given `stdout` stream.
|
|
158
|
+
*/
|
|
159
|
+
function createDispatcher(stdout, writeStdin, handlers) {
|
|
160
|
+
const packetTransformer = new packet_transformer_1.PacketTransformer(stdout, writeStdin);
|
|
161
|
+
const messageTransformer = new message_transformer_1.MessageTransformer(packetTransformer.outboundProtobufs$, packet => packetTransformer.writeInboundProtobuf(packet));
|
|
162
|
+
return new dispatcher_1.Dispatcher(messageTransformer.outboundMessages$, message => messageTransformer.writeInboundMessage(message), handlers);
|
|
163
|
+
}
|
|
164
|
+
/** Handles a log event according to `options`. */
|
|
165
|
+
function handleLogEvent(options, event) {
|
|
166
|
+
var _a, _b;
|
|
167
|
+
if (event.getType() === proto.LogEventType.DEBUG) {
|
|
168
|
+
if ((_a = options === null || options === void 0 ? void 0 : options.logger) === null || _a === void 0 ? void 0 : _a.debug) {
|
|
169
|
+
options.logger.debug(event.getMessage(), {
|
|
170
|
+
span: (0, deprotofy_span_1.deprotofySourceSpan)(event.getSpan()),
|
|
171
|
+
});
|
|
119
172
|
}
|
|
120
173
|
else {
|
|
121
|
-
|
|
174
|
+
console.error(event.getFormatted());
|
|
122
175
|
}
|
|
123
176
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
177
|
+
else {
|
|
178
|
+
if ((_b = options === null || options === void 0 ? void 0 : options.logger) === null || _b === void 0 ? void 0 : _b.warn) {
|
|
179
|
+
const params = {
|
|
180
|
+
deprecation: event.getType() === proto.LogEventType.DEPRECATION_WARNING,
|
|
181
|
+
};
|
|
182
|
+
const spanProto = event.getSpan();
|
|
183
|
+
if (spanProto)
|
|
184
|
+
params.span = (0, deprotofy_span_1.deprotofySourceSpan)(spanProto);
|
|
185
|
+
const stack = event.getStackTrace();
|
|
186
|
+
if (stack)
|
|
187
|
+
params.stack = stack;
|
|
188
|
+
options.logger.warn(event.getMessage(), params);
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
console.error(event.getFormatted());
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Converts a `CompileResponse` into a `CompileResult`.
|
|
197
|
+
*
|
|
198
|
+
* Throws a `SassException` if the compilation failed.
|
|
199
|
+
*/
|
|
200
|
+
function handleCompileResponse(response) {
|
|
201
|
+
if (response.getSuccess()) {
|
|
202
|
+
const success = response.getSuccess();
|
|
203
|
+
const result = {
|
|
204
|
+
css: success.getCss(),
|
|
205
|
+
loadedUrls: success.getLoadedUrlsList().map(url => new URL(url)),
|
|
206
|
+
};
|
|
207
|
+
const sourceMap = success.getSourceMap();
|
|
208
|
+
if (sourceMap)
|
|
209
|
+
result.sourceMap = JSON.parse(sourceMap);
|
|
210
|
+
return result;
|
|
211
|
+
}
|
|
212
|
+
else if (response.getFailure()) {
|
|
213
|
+
throw new exception_1.Exception(response.getFailure());
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
throw utils.compilerError('Compiler sent empty CompileResponse.');
|
|
127
217
|
}
|
|
128
218
|
}
|
|
129
219
|
//# sourceMappingURL=compile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../../../lib/src/compile.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAGvC,
|
|
1
|
+
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../../../lib/src/compile.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAGvC,gDAAgD;AAEhD,qEAAqE;AACrE,iCAAiC;AACjC,qDAAuD;AAEvD,6CAA4D;AAC5D,2CAAsC;AACtC,2DAAqD;AACrD,2DAAqD;AACrD,+DAAyD;AACzD,6DAAuD;AACvD,mDAAqD;AACrD,qDAAqD;AAErD,SAAgB,OAAO,CACrB,IAAY,EACZ,OAAyB;IAEzB,MAAM,SAAS,GAAG,IAAI,oCAAgB,CAAC,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,MAAM,CAAC,IAAI,GAAG,IAAA,oCAAmB,EAAC,SAAS,CAAC,CAAC;YAE5D,MAAM,KAAK,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;YACpC,IAAI,KAAK;gBAAE,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;YAEhC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,EAAE,MAAM,CAAC,CAAC;SACjD;aAAM;YACL,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC;SACrC;KACF;AACH,CAAC;AAED;;;;GAIG;AACH,SAAS,qBAAqB,CAC5B,QAA+C;IAE/C,IAAI,QAAQ,CAAC,UAAU,EAAE,EAAE;QACzB,MAAM,OAAO,GAAG,QAAQ,CAAC,UAAU,EAAG,CAAC;QACvC,MAAM,MAAM,GAAkB;YAC5B,GAAG,EAAE,OAAO,CAAC,MAAM,EAAE;YACrB,UAAU,EAAE,OAAO,CAAC,iBAAiB,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;SACjE,CAAC;QAEF,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;QACzC,IAAI,SAAS;YAAE,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACxD,OAAO,MAAM,CAAC;KACf;SAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,EAAE;QAChC,MAAM,IAAI,qBAAS,CAAC,QAAQ,CAAC,UAAU,EAAG,CAAC,CAAC;KAC7C;SAAM;QACL,MAAM,KAAK,CAAC,aAAa,CAAC,sCAAsC,CAAC,CAAC;KACnE;AACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2021 Google LLC. Use of this source code is governed by an
|
|
3
|
+
// MIT-style license that can be found in the LICENSE file or at
|
|
4
|
+
// https://opensource.org/licenses/MIT.
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.compilerPath = void 0;
|
|
7
|
+
const fs = require("fs");
|
|
8
|
+
const p = require("path");
|
|
9
|
+
/** The path to the embedded compiler executable. */
|
|
10
|
+
exports.compilerPath = (() => {
|
|
11
|
+
for (const path of ['vendor', '../../../lib/src/vendor']) {
|
|
12
|
+
const executable = p.resolve(__dirname, path, `dart-sass-embedded/dart-sass-embedded${process.platform === 'win32' ? '.bat' : ''}`);
|
|
13
|
+
if (fs.existsSync(executable))
|
|
14
|
+
return executable;
|
|
15
|
+
}
|
|
16
|
+
throw new Error("Embedded Dart Sass couldn't find the embedded compiler executable.");
|
|
17
|
+
})();
|
|
18
|
+
//# sourceMappingURL=compiler-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler-path.js","sourceRoot":"","sources":["../../../lib/src/compiler-path.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,yBAAyB;AACzB,0BAA0B;AAE1B,oDAAoD;AACvC,QAAA,YAAY,GAAG,CAAC,GAAG,EAAE;IAChC,KAAK,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE,yBAAyB,CAAC,EAAE;QACxD,MAAM,UAAU,GAAG,CAAC,CAAC,OAAO,CAC1B,SAAS,EACT,IAAI,EACJ,wCACE,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAC1C,EAAE,CACH,CAAC;QAEF,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC;YAAE,OAAO,UAAU,CAAC;KAClD;IAED,MAAM,IAAI,KAAK,CACb,oEAAoE,CACrE,CAAC;AACJ,CAAC,CAAC,EAAE,CAAC"}
|