sass-embedded 1.0.0-beta.3 → 1.0.0-beta.8
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 +44 -0
- package/dist/.gitignore +1 -0
- package/dist/lib/index.js +36 -2
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/src/{embedded-compiler/compiler.js → async-compiler.js} +13 -13
- package/dist/lib/src/async-compiler.js.map +1 -0
- package/dist/lib/src/compile.js +187 -85
- 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/deprotofy-span.js +51 -0
- package/dist/lib/src/deprotofy-span.js.map +1 -0
- package/dist/lib/src/{embedded-protocol/dispatcher.js → dispatcher.js} +47 -41
- 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.js +133 -0
- package/dist/lib/src/legacy.js.map +1 -0
- package/dist/lib/src/{embedded-protocol/message-transformer.js → message-transformer.js} +11 -10
- package/dist/lib/src/message-transformer.js.map +1 -0
- package/dist/lib/src/{embedded-compiler/packet-transformer.js → packet-transformer.js} +2 -1
- 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} +1 -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 +88 -0
- 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 +40 -0
- package/dist/lib/src/value/boolean.js.map +1 -0
- package/dist/lib/src/value/color.js +258 -0
- package/dist/lib/src/value/color.js.map +1 -0
- 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} +28 -17
- package/dist/lib/src/value/index.js.map +1 -0
- package/dist/lib/src/value/list.js +99 -0
- package/dist/lib/src/value/list.js.map +1 -0
- package/dist/lib/src/value/map.js +91 -0
- package/dist/lib/src/value/map.js.map +1 -0
- package/dist/lib/src/value/null.js +10 -6
- package/dist/lib/src/value/null.js.map +1 -1
- package/dist/lib/src/value/number.js +579 -0
- package/dist/lib/src/value/number.js.map +1 -0
- package/dist/lib/src/value/string.js +117 -0
- package/dist/lib/src/value/string.js.map +1 -0
- package/dist/lib/src/value/utils.js +120 -0
- package/dist/lib/src/value/utils.js.map +1 -0
- package/dist/lib/src/vendor/embedded-protocol/embedded_sass_pb.js +994 -8
- package/dist/lib/src/vendor/embedded-protocol/embedded_sass_pb.js.map +1 -1
- package/dist/package.json +63 -0
- package/dist/tool/utils.js +85 -91
- 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 +76 -0
- package/dist/types/legacy/exception.d.ts +54 -0
- package/dist/types/legacy/function.d.ts +700 -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 +408 -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/download-compiler-for-end-user.js +1 -6
- package/package.json +23 -19
- package/dist/lib/index.d.ts +0 -1
- package/dist/lib/src/compile.d.ts +0 -20
- 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 +0 -52
- 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 -36
- 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 -60
- package/dist/lib/src/node-sass/render.js +0 -126
- package/dist/lib/src/node-sass/render.js.map +0 -1
- package/dist/lib/src/utils.d.ts +0 -9
- package/dist/lib/src/value/null.d.ts +0 -11
- package/dist/lib/src/value/value.d.ts +0 -98
- 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 -29
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,47 @@
|
|
|
1
|
+
## 1.0.0-beta.8
|
|
2
|
+
|
|
3
|
+
* Fully support the new JS API:
|
|
4
|
+
* Support custom importers for the new JS API.
|
|
5
|
+
* Support custom loggers for the new JS API.
|
|
6
|
+
* Support the `SassArgumentList` value type.
|
|
7
|
+
* Support the `SassFunction` value type.
|
|
8
|
+
|
|
9
|
+
## 1.0.0-beta.7
|
|
10
|
+
|
|
11
|
+
* Expose the `Exception` class and ensure that syntax errors match the official
|
|
12
|
+
JS API.
|
|
13
|
+
|
|
14
|
+
* Add support for the `style`, `alertColor`, `alertAscii`, `quietDeps`,
|
|
15
|
+
`verbose`, and `functions` options in `compile()`, `compileString()`,
|
|
16
|
+
`compileAsync()`, and `compileStringAsync()`.
|
|
17
|
+
|
|
18
|
+
* Add support for `CompileResult.loadedUrls`.
|
|
19
|
+
|
|
20
|
+
## 1.0.0-beta.6
|
|
21
|
+
|
|
22
|
+
* Expose (as yet incomplete) `compile()`, `compileString()`, `compileAsync()`,
|
|
23
|
+
and `compileStringAsync()` functions.
|
|
24
|
+
|
|
25
|
+
* Include the official TypeScript definition files.
|
|
26
|
+
|
|
27
|
+
## 1.0.0-beta.5
|
|
28
|
+
|
|
29
|
+
- Function and Values API
|
|
30
|
+
- Add `SassColor` class.
|
|
31
|
+
- Add `SassList` and `SassMap` classes.
|
|
32
|
+
|
|
33
|
+
- Add `indentedSyntax` option to `render()`
|
|
34
|
+
|
|
35
|
+
## 1.0.0-beta.4
|
|
36
|
+
|
|
37
|
+
- Allow installing on arm64.
|
|
38
|
+
|
|
39
|
+
- Function and Values API
|
|
40
|
+
- Add `sassTrue` and `sassFalse` singletons.
|
|
41
|
+
- Add `SassColor` class.
|
|
42
|
+
- Add `SassNumber` class.
|
|
43
|
+
- Add `SassString` class.
|
|
44
|
+
|
|
1
45
|
## 1.0.0-beta.3
|
|
2
46
|
|
|
3
47
|
- Properly handle `data:` URIs in sourceMap sources.
|
package/dist/.gitignore
CHANGED
package/dist/lib/index.js
CHANGED
|
@@ -3,6 +3,40 @@
|
|
|
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
|
-
|
|
7
|
-
|
|
6
|
+
exports.Logger = exports.info = exports.render = exports.compileStringAsync = exports.compileAsync = exports.compileString = exports.compile = exports.Exception = 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
|
+
const pkg = require("../package.json");
|
|
8
|
+
var list_1 = require("./src/value/list");
|
|
9
|
+
Object.defineProperty(exports, "SassList", { enumerable: true, get: function () { return list_1.SassList; } });
|
|
10
|
+
var argument_list_1 = require("./src/value/argument-list");
|
|
11
|
+
Object.defineProperty(exports, "SassArgumentList", { enumerable: true, get: function () { return argument_list_1.SassArgumentList; } });
|
|
12
|
+
var boolean_1 = require("./src/value/boolean");
|
|
13
|
+
Object.defineProperty(exports, "sassFalse", { enumerable: true, get: function () { return boolean_1.sassFalse; } });
|
|
14
|
+
Object.defineProperty(exports, "sassTrue", { enumerable: true, get: function () { return boolean_1.sassTrue; } });
|
|
15
|
+
var color_1 = require("./src/value/color");
|
|
16
|
+
Object.defineProperty(exports, "SassColor", { enumerable: true, get: function () { return color_1.SassColor; } });
|
|
17
|
+
var function_1 = require("./src/value/function");
|
|
18
|
+
Object.defineProperty(exports, "SassFunction", { enumerable: true, get: function () { return function_1.SassFunction; } });
|
|
19
|
+
var map_1 = require("./src/value/map");
|
|
20
|
+
Object.defineProperty(exports, "SassMap", { enumerable: true, get: function () { return map_1.SassMap; } });
|
|
21
|
+
var number_1 = require("./src/value/number");
|
|
22
|
+
Object.defineProperty(exports, "SassNumber", { enumerable: true, get: function () { return number_1.SassNumber; } });
|
|
23
|
+
var string_1 = require("./src/value/string");
|
|
24
|
+
Object.defineProperty(exports, "SassString", { enumerable: true, get: function () { return string_1.SassString; } });
|
|
25
|
+
var value_1 = require("./src/value");
|
|
26
|
+
Object.defineProperty(exports, "Value", { enumerable: true, get: function () { return value_1.Value; } });
|
|
27
|
+
var null_1 = require("./src/value/null");
|
|
28
|
+
Object.defineProperty(exports, "sassNull", { enumerable: true, get: function () { return null_1.sassNull; } });
|
|
29
|
+
var exception_1 = require("./src/exception");
|
|
30
|
+
Object.defineProperty(exports, "Exception", { enumerable: true, get: function () { return exception_1.Exception; } });
|
|
31
|
+
var compile_1 = require("./src/compile");
|
|
32
|
+
Object.defineProperty(exports, "compile", { enumerable: true, get: function () { return compile_1.compile; } });
|
|
33
|
+
Object.defineProperty(exports, "compileString", { enumerable: true, get: function () { return compile_1.compileString; } });
|
|
34
|
+
Object.defineProperty(exports, "compileAsync", { enumerable: true, get: function () { return compile_1.compileAsync; } });
|
|
35
|
+
Object.defineProperty(exports, "compileStringAsync", { enumerable: true, get: function () { return compile_1.compileStringAsync; } });
|
|
36
|
+
var legacy_1 = require("./src/legacy");
|
|
37
|
+
Object.defineProperty(exports, "render", { enumerable: true, get: function () { return legacy_1.render; } });
|
|
38
|
+
exports.info = `sass-embedded\t${pkg.version}`;
|
|
39
|
+
exports.Logger = {
|
|
40
|
+
silent: { warn() { }, debug() { } },
|
|
41
|
+
};
|
|
8
42
|
//# 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
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,uCAAuC;AAEvC,yCAAyD;AAAlC,gGAAA,QAAQ,OAAA;AAC/B,2DAA2D;AAAnD,iHAAA,gBAAgB,OAAA;AACxB,+CAAqE;AAAhD,oGAAA,SAAS,OAAA;AAAE,mGAAA,QAAQ,OAAA;AACxC,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,6CAA0C;AAAlC,sGAAA,SAAS,OAAA;AACjB,yCAKuB;AAJrB,kGAAA,OAAO,OAAA;AACP,wGAAA,aAAa,OAAA;AACb,uGAAA,YAAY,OAAA;AACZ,6GAAA,kBAAkB,OAAA;AAEpB,uCAAoC;AAA5B,gGAAA,MAAM,OAAA;AAED,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"}
|
|
@@ -3,31 +3,31 @@
|
|
|
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.AsyncEmbeddedCompiler = void 0;
|
|
6
7
|
const child_process_1 = require("child_process");
|
|
7
|
-
const path_1 = require("path");
|
|
8
8
|
const rxjs_1 = require("rxjs");
|
|
9
9
|
const operators_1 = require("rxjs/operators");
|
|
10
|
+
const compiler_path_1 = require("./compiler-path");
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
12
|
+
* An asynchronous wrapper for the embedded Sass compiler that exposes its stdio
|
|
13
|
+
* streams as Observables.
|
|
13
14
|
*/
|
|
14
|
-
class
|
|
15
|
+
class AsyncEmbeddedCompiler {
|
|
15
16
|
constructor() {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
});
|
|
17
|
+
/** The underlying process that's being wrapped. */
|
|
18
|
+
this.process = (0, child_process_1.spawn)(compiler_path_1.compilerPath, { windowsHide: true });
|
|
19
19
|
/** The child process's exit event. */
|
|
20
|
-
this.exit$ = new
|
|
21
|
-
this.process.on('exit', code =>
|
|
20
|
+
this.exit$ = new Promise(resolve => {
|
|
21
|
+
this.process.on('exit', code => resolve(code));
|
|
22
22
|
});
|
|
23
23
|
/** The buffers emitted by the child process's stdout. */
|
|
24
24
|
this.stdout$ = new rxjs_1.Observable(observer => {
|
|
25
25
|
this.process.stdout.on('data', buffer => observer.next(buffer));
|
|
26
|
-
}).pipe(operators_1.takeUntil(this.exit$));
|
|
26
|
+
}).pipe((0, operators_1.takeUntil)(this.exit$));
|
|
27
27
|
/** The buffers emitted by the child process's stderr. */
|
|
28
28
|
this.stderr$ = new rxjs_1.Observable(observer => {
|
|
29
29
|
this.process.stderr.on('data', buffer => observer.next(buffer));
|
|
30
|
-
}).pipe(operators_1.takeUntil(this.exit$));
|
|
30
|
+
}).pipe((0, operators_1.takeUntil)(this.exit$));
|
|
31
31
|
}
|
|
32
32
|
/** Writes `buffer` to the child process's stdin. */
|
|
33
33
|
writeStdin(buffer) {
|
|
@@ -38,5 +38,5 @@ class EmbeddedCompiler {
|
|
|
38
38
|
this.process.stdin.end();
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
exports.
|
|
42
|
-
//# 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,114 +3,216 @@
|
|
|
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
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
});
|
|
23
|
-
const response = await compileRequest(request);
|
|
24
|
-
if (options.sourceMap) {
|
|
25
|
-
options.sourceMap(response.sourceMap);
|
|
26
|
-
}
|
|
27
|
-
return response.css;
|
|
6
|
+
exports.compileStringAsync = exports.compileAsync = exports.compileString = exports.compile = void 0;
|
|
7
|
+
const supportsColor = require("supports-color");
|
|
8
|
+
const proto = require("./vendor/embedded-protocol/embedded_sass_pb");
|
|
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);
|
|
28
22
|
}
|
|
29
23
|
exports.compile = compile;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
*/
|
|
34
|
-
async function compileString(options) {
|
|
35
|
-
// TODO(awjin): Create logger, importer, function registries.
|
|
36
|
-
const request = newCompileStringRequest({
|
|
37
|
-
source: options.source,
|
|
38
|
-
sourceMap: !!options.sourceMap,
|
|
39
|
-
url: options.url instanceof url_1.URL ? options.url.toString() : options.url,
|
|
40
|
-
});
|
|
41
|
-
const response = await compileRequest(request);
|
|
42
|
-
if (options.sourceMap) {
|
|
43
|
-
options.sourceMap(response.sourceMap);
|
|
44
|
-
}
|
|
45
|
-
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);
|
|
46
27
|
}
|
|
47
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;
|
|
48
39
|
// Creates a request for compiling a file.
|
|
49
|
-
function
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
request.setPath(options.path);
|
|
53
|
-
request.setSourceMap(options.sourceMap);
|
|
40
|
+
function newCompilePathRequest(path, importers, options) {
|
|
41
|
+
const request = newCompileRequest(importers, options);
|
|
42
|
+
request.setPath(path);
|
|
54
43
|
return request;
|
|
55
44
|
}
|
|
56
45
|
// Creates a request for compiling a string.
|
|
57
|
-
function newCompileStringRequest(options) {
|
|
58
|
-
|
|
59
|
-
const input = new
|
|
60
|
-
input.setSource(
|
|
61
|
-
|
|
46
|
+
function newCompileStringRequest(source, importers, options) {
|
|
47
|
+
var _a;
|
|
48
|
+
const input = new proto.InboundMessage.CompileRequest.StringInput();
|
|
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)
|
|
62
52
|
input.setUrl(options.url.toString());
|
|
63
|
-
|
|
53
|
+
if (options && 'importer' in options) {
|
|
54
|
+
input.setImporter(importers.register(options.importer));
|
|
55
|
+
}
|
|
56
|
+
const request = newCompileRequest(importers, options);
|
|
64
57
|
request.setString(input);
|
|
65
|
-
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.setAlertColor((_b = options === null || options === void 0 ? void 0 : options.alertColor) !== null && _b !== void 0 ? _b : !!supportsColor.stdout);
|
|
69
|
+
request.setAlertAscii(!!(options === null || options === void 0 ? void 0 : options.alertAscii));
|
|
70
|
+
request.setQuietDeps(!!(options === null || options === void 0 ? void 0 : options.quietDeps));
|
|
71
|
+
request.setVerbose(!!(options === null || options === void 0 ? void 0 : options.verbose));
|
|
72
|
+
switch ((_c = options === null || options === void 0 ? void 0 : options.style) !== null && _c !== void 0 ? _c : 'expanded') {
|
|
73
|
+
case 'expanded':
|
|
74
|
+
request.setStyle(proto.OutputStyle.EXPANDED);
|
|
75
|
+
break;
|
|
76
|
+
case 'compressed':
|
|
77
|
+
request.setStyle(proto.OutputStyle.COMPRESSED);
|
|
78
|
+
break;
|
|
79
|
+
default:
|
|
80
|
+
throw new Error(`Unknown options.style: "${options === null || options === void 0 ? void 0 : options.style}"`);
|
|
81
|
+
}
|
|
66
82
|
return request;
|
|
67
83
|
}
|
|
68
84
|
// Spins up a compiler, then sends it a compile request. Returns a promise that
|
|
69
85
|
// resolves with the CompileResult. Throws if there were any protocol or
|
|
70
86
|
// compilation errors. Shuts down the compiler after compilation.
|
|
71
|
-
async function
|
|
72
|
-
const
|
|
87
|
+
async function compileRequestAsync(request, importers, options) {
|
|
88
|
+
const functions = new function_registry_1.FunctionRegistry(options === null || options === void 0 ? void 0 : options.functions);
|
|
89
|
+
const embeddedCompiler = new async_compiler_1.AsyncEmbeddedCompiler();
|
|
73
90
|
try {
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
},
|
|
82
|
-
handleFileImportRequest: () => {
|
|
83
|
-
throw Error('Custom file importers not yet implemented.');
|
|
84
|
-
},
|
|
85
|
-
handleCanonicalizeRequest: () => {
|
|
86
|
-
throw Error('Canonicalize not yet implemented.');
|
|
87
|
-
},
|
|
88
|
-
handleFunctionCallRequest: () => {
|
|
89
|
-
throw Error('Custom functions not yet implemented.');
|
|
90
|
-
},
|
|
91
|
+
const dispatcher = createDispatcher(embeddedCompiler.stdout$, buffer => {
|
|
92
|
+
embeddedCompiler.writeStdin(buffer);
|
|
93
|
+
}, {
|
|
94
|
+
handleImportRequest: request => importers.import(request),
|
|
95
|
+
handleFileImportRequest: request => importers.fileImport(request),
|
|
96
|
+
handleCanonicalizeRequest: request => importers.canonicalize(request),
|
|
97
|
+
handleFunctionCallRequest: request => functions.call(request),
|
|
91
98
|
});
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const sourceMap = success.getSourceMap();
|
|
97
|
-
if (request.getSourceMap() && sourceMap === undefined) {
|
|
98
|
-
throw Error('Compiler did not provide sourceMap.');
|
|
99
|
+
dispatcher.logEvents$.subscribe(event => handleLogEvent(options, event));
|
|
100
|
+
return handleCompileResponse(await new Promise((resolve, reject) => dispatcher.sendCompileRequest(request, (err, response) => {
|
|
101
|
+
if (err) {
|
|
102
|
+
reject(err);
|
|
99
103
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
+
else {
|
|
105
|
+
resolve(response);
|
|
106
|
+
}
|
|
107
|
+
})));
|
|
108
|
+
}
|
|
109
|
+
finally {
|
|
110
|
+
embeddedCompiler.close();
|
|
111
|
+
await embeddedCompiler.exit$;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// Spins up a compiler, then sends it a compile request. Returns a promise that
|
|
115
|
+
// resolves with the CompileResult. Throws if there were any protocol or
|
|
116
|
+
// compilation errors. Shuts down the compiler after compilation.
|
|
117
|
+
function compileRequestSync(request, importers, options) {
|
|
118
|
+
const functions = new function_registry_1.FunctionRegistry(options === null || options === void 0 ? void 0 : options.functions);
|
|
119
|
+
const embeddedCompiler = new sync_compiler_1.SyncEmbeddedCompiler();
|
|
120
|
+
try {
|
|
121
|
+
const dispatcher = createDispatcher(embeddedCompiler.stdout$, buffer => {
|
|
122
|
+
embeddedCompiler.writeStdin(buffer);
|
|
123
|
+
}, {
|
|
124
|
+
handleImportRequest: request => importers.import(request),
|
|
125
|
+
handleFileImportRequest: request => importers.fileImport(request),
|
|
126
|
+
handleCanonicalizeRequest: request => importers.canonicalize(request),
|
|
127
|
+
handleFunctionCallRequest: request => functions.call(request),
|
|
128
|
+
});
|
|
129
|
+
dispatcher.logEvents$.subscribe(event => handleLogEvent(options, event));
|
|
130
|
+
let error;
|
|
131
|
+
let response;
|
|
132
|
+
dispatcher.sendCompileRequest(request, (error_, response_) => {
|
|
133
|
+
if (error_) {
|
|
134
|
+
error = error_;
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
response = response_;
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
for (;;) {
|
|
141
|
+
if (!embeddedCompiler.yield()) {
|
|
142
|
+
throw utils.compilerError('Embedded compiler exited unexpectedly.');
|
|
143
|
+
}
|
|
144
|
+
if (error)
|
|
145
|
+
throw error;
|
|
146
|
+
if (response)
|
|
147
|
+
return handleCompileResponse(response);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
finally {
|
|
151
|
+
embeddedCompiler.close();
|
|
152
|
+
embeddedCompiler.yieldUntilExit();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Creates a dispatcher that dispatches messages from the given `stdout` stream.
|
|
157
|
+
*/
|
|
158
|
+
function createDispatcher(stdout, writeStdin, handlers) {
|
|
159
|
+
const packetTransformer = new packet_transformer_1.PacketTransformer(stdout, writeStdin);
|
|
160
|
+
const messageTransformer = new message_transformer_1.MessageTransformer(packetTransformer.outboundProtobufs$, packet => packetTransformer.writeInboundProtobuf(packet));
|
|
161
|
+
return new dispatcher_1.Dispatcher(messageTransformer.outboundMessages$, message => messageTransformer.writeInboundMessage(message), handlers);
|
|
162
|
+
}
|
|
163
|
+
/** Handles a log event according to `options`. */
|
|
164
|
+
function handleLogEvent(options, event) {
|
|
165
|
+
var _a, _b;
|
|
166
|
+
if (event.getType() === proto.LogEventType.DEBUG) {
|
|
167
|
+
if ((_a = options === null || options === void 0 ? void 0 : options.logger) === null || _a === void 0 ? void 0 : _a.debug) {
|
|
168
|
+
options.logger.debug(event.getMessage(), {
|
|
169
|
+
span: (0, deprotofy_span_1.deprotofySourceSpan)(event.getSpan()),
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
console.error(event.getFormatted());
|
|
104
174
|
}
|
|
105
|
-
|
|
106
|
-
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
if ((_b = options === null || options === void 0 ? void 0 : options.logger) === null || _b === void 0 ? void 0 : _b.warn) {
|
|
178
|
+
const params = {
|
|
179
|
+
deprecation: event.getType() === proto.LogEventType.DEPRECATION_WARNING,
|
|
180
|
+
};
|
|
181
|
+
const spanProto = event.getSpan();
|
|
182
|
+
if (spanProto)
|
|
183
|
+
params.span = (0, deprotofy_span_1.deprotofySourceSpan)(spanProto);
|
|
184
|
+
const stack = event.getStackTrace();
|
|
185
|
+
if (stack)
|
|
186
|
+
params.stack = stack;
|
|
187
|
+
options.logger.warn(event.getMessage(), params);
|
|
107
188
|
}
|
|
108
189
|
else {
|
|
109
|
-
|
|
190
|
+
console.error(event.getFormatted());
|
|
110
191
|
}
|
|
111
192
|
}
|
|
112
|
-
|
|
113
|
-
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Converts a `CompileResponse` into a `CompileResult`.
|
|
196
|
+
*
|
|
197
|
+
* Throws a `SassException` if the compilation failed.
|
|
198
|
+
*/
|
|
199
|
+
function handleCompileResponse(response) {
|
|
200
|
+
if (response.getSuccess()) {
|
|
201
|
+
const success = response.getSuccess();
|
|
202
|
+
const result = {
|
|
203
|
+
css: success.getCss(),
|
|
204
|
+
loadedUrls: success.getLoadedUrlsList().map(url => new URL(url)),
|
|
205
|
+
};
|
|
206
|
+
const sourceMap = success.getSourceMap();
|
|
207
|
+
if (sourceMap)
|
|
208
|
+
result.sourceMap = JSON.parse(sourceMap);
|
|
209
|
+
return result;
|
|
210
|
+
}
|
|
211
|
+
else if (response.getFailure()) {
|
|
212
|
+
throw new exception_1.Exception(response.getFailure());
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
throw utils.compilerError('Compiler sent empty CompileResponse.');
|
|
114
216
|
}
|
|
115
217
|
}
|
|
116
218
|
//# 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
|
|
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,OAAO,CAAC,CAAC;IAChD,OAAO,kBAAkB,CACvB,qBAAqB,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,EAC/C,SAAS,EACT,OAAO,CACR,CAAC;AACJ,CAAC;AAVD,0BAUC;AAED,SAAgB,aAAa,CAC3B,MAAc,EACd,OAAyB;IAEzB,MAAM,SAAS,GAAG,IAAI,oCAAgB,CAAC,OAAO,CAAC,CAAC;IAChD,OAAO,kBAAkB,CACvB,uBAAuB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EACnD,SAAS,EACT,OAAO,CACR,CAAC;AACJ,CAAC;AAVD,sCAUC;AAED,SAAgB,YAAY,CAC1B,IAAY,EACZ,OAA0B;IAE1B,MAAM,SAAS,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AE,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"}
|
|
@@ -0,0 +1,51 @@
|
|
|
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.deprotofySourceSpan = void 0;
|
|
7
|
+
const url_1 = require("url");
|
|
8
|
+
const utils_1 = require("./utils");
|
|
9
|
+
// Creates a SourceSpan from the given protocol `buffer`. Throws if the buffer
|
|
10
|
+
// has invalid fields.
|
|
11
|
+
function deprotofySourceSpan(buffer) {
|
|
12
|
+
const text = buffer.getText();
|
|
13
|
+
if (buffer.getStart() === undefined) {
|
|
14
|
+
throw (0, utils_1.compilerError)('Expected SourceSpan to have start.');
|
|
15
|
+
}
|
|
16
|
+
const start = deprotofySourceLocation(buffer.getStart());
|
|
17
|
+
let end;
|
|
18
|
+
if (buffer.getEnd() === undefined) {
|
|
19
|
+
if (text !== '') {
|
|
20
|
+
throw (0, utils_1.compilerError)('Expected SourceSpan text to be empty.');
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
end = start;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
end = deprotofySourceLocation(buffer.getEnd());
|
|
28
|
+
if (end.offset < start.offset) {
|
|
29
|
+
throw (0, utils_1.compilerError)('Expected SourceSpan end to be after start.');
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const url = buffer.getUrl() === '' ? undefined : new url_1.URL(buffer.getUrl());
|
|
33
|
+
const context = buffer.getContext() === '' ? undefined : buffer.getContext();
|
|
34
|
+
return {
|
|
35
|
+
text,
|
|
36
|
+
start,
|
|
37
|
+
end,
|
|
38
|
+
url,
|
|
39
|
+
context,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
exports.deprotofySourceSpan = deprotofySourceSpan;
|
|
43
|
+
// Creates a SourceLocation from the given protocol `buffer`.
|
|
44
|
+
function deprotofySourceLocation(buffer) {
|
|
45
|
+
return {
|
|
46
|
+
offset: buffer.getOffset(),
|
|
47
|
+
line: buffer.getLine(),
|
|
48
|
+
column: buffer.getColumn(),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=deprotofy-span.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deprotofy-span.js","sourceRoot":"","sources":["../../../lib/src/deprotofy-span.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,6BAAwB;AAIxB,mCAAsC;AAEtC,8EAA8E;AAC9E,sBAAsB;AACtB,SAAgB,mBAAmB,CAAC,MAAwB;IAC1D,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;IAE9B,IAAI,MAAM,CAAC,QAAQ,EAAE,KAAK,SAAS,EAAE;QACnC,MAAM,IAAA,qBAAa,EAAC,oCAAoC,CAAC,CAAC;KAC3D;IACD,MAAM,KAAK,GAAG,uBAAuB,CAAC,MAAM,CAAC,QA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