sass-embedded 1.56.2 → 1.58.2
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/dist/lib/src/compile.js +43 -39
- package/dist/lib/src/compile.js.map +1 -1
- package/dist/lib/src/compiler-path.js +6 -6
- package/dist/lib/src/compiler-path.js.map +1 -1
- package/dist/lib/src/deprotofy-span.js +9 -18
- package/dist/lib/src/deprotofy-span.js.map +1 -1
- package/dist/lib/src/dispatcher.js +48 -48
- package/dist/lib/src/dispatcher.js.map +1 -1
- package/dist/lib/src/exception.js +4 -4
- package/dist/lib/src/exception.js.map +1 -1
- package/dist/lib/src/function-registry.js +24 -25
- package/dist/lib/src/function-registry.js.map +1 -1
- package/dist/lib/src/importer-registry.js +57 -64
- package/dist/lib/src/importer-registry.js.map +1 -1
- package/dist/lib/src/legacy/index.js +1 -1
- package/dist/lib/src/legacy/index.js.map +1 -1
- package/dist/lib/src/message-transformer.js +8 -81
- package/dist/lib/src/message-transformer.js.map +1 -1
- package/dist/lib/src/messages.js +6 -0
- package/dist/lib/src/messages.js.map +1 -0
- package/dist/lib/src/packet-transformer.js.map +1 -1
- package/dist/lib/src/protofier.js +99 -116
- package/dist/lib/src/protofier.js.map +1 -1
- package/dist/lib/src/sync-compiler.js +5 -2
- package/dist/lib/src/sync-compiler.js.map +1 -1
- package/dist/lib/src/utils.js +1 -1
- package/dist/lib/src/utils.js.map +1 -1
- package/dist/package.json +23 -24
- package/dist/tool/get-embedded-compiler.js +68 -0
- package/dist/tool/get-embedded-compiler.js.map +1 -0
- package/dist/tool/get-embedded-protocol.js +41 -0
- package/dist/tool/get-embedded-protocol.js.map +1 -0
- package/dist/tool/get-js-api.js +33 -0
- package/dist/tool/get-js-api.js.map +1 -0
- package/dist/tool/{prepare-dev-environment.js → init.js} +18 -38
- package/dist/tool/init.js.map +1 -0
- package/dist/tool/prepare-optional-release.js +94 -3
- package/dist/tool/prepare-optional-release.js.map +1 -1
- package/dist/tool/prepare-release.js +4 -4
- package/dist/tool/prepare-release.js.map +1 -1
- package/dist/tool/utils.js +6 -248
- package/dist/tool/utils.js.map +1 -1
- package/package.json +23 -24
- package/CHANGELOG.md +0 -2761
- package/dist/.gitignore +0 -18
- package/dist/lib/src/vendor/embedded-protocol/embedded_sass_pb.js +0 -9031
- package/dist/lib/src/vendor/embedded-protocol/embedded_sass_pb.js.map +0 -1
- package/dist/tool/prepare-dev-environment.js.map +0 -1
package/dist/lib/src/compile.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.compileStringAsync = exports.compileAsync = exports.compileString = exports.compile = void 0;
|
|
7
7
|
const p = require("path");
|
|
8
8
|
const supportsColor = require("supports-color");
|
|
9
|
-
const proto = require("./vendor/
|
|
9
|
+
const proto = require("./vendor/embedded_sass_pb");
|
|
10
10
|
const utils = require("./utils");
|
|
11
11
|
const async_compiler_1 = require("./async-compiler");
|
|
12
12
|
const dispatcher_1 = require("./dispatcher");
|
|
@@ -41,55 +41,57 @@ exports.compileStringAsync = compileStringAsync;
|
|
|
41
41
|
// Creates a request for compiling a file.
|
|
42
42
|
function newCompilePathRequest(path, importers, options) {
|
|
43
43
|
const request = newCompileRequest(importers, options);
|
|
44
|
-
request.
|
|
44
|
+
request.input = { case: 'path', value: path };
|
|
45
45
|
return request;
|
|
46
46
|
}
|
|
47
47
|
// Creates a request for compiling a string.
|
|
48
48
|
function newCompileStringRequest(source, importers, options) {
|
|
49
49
|
var _a, _b;
|
|
50
|
-
const input = new proto.
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
const input = new proto.InboundMessage_CompileRequest_StringInput({
|
|
51
|
+
source,
|
|
52
|
+
syntax: utils.protofySyntax((_a = options === null || options === void 0 ? void 0 : options.syntax) !== null && _a !== void 0 ? _a : 'scss'),
|
|
53
|
+
});
|
|
53
54
|
const url = (_b = options === null || options === void 0 ? void 0 : options.url) === null || _b === void 0 ? void 0 : _b.toString();
|
|
54
55
|
if (url && url !== importer_1.legacyImporterProtocol) {
|
|
55
|
-
input.
|
|
56
|
+
input.url = url;
|
|
56
57
|
}
|
|
57
58
|
if (options && 'importer' in options && options.importer) {
|
|
58
|
-
input.
|
|
59
|
+
input.importer = importers.register(options.importer);
|
|
59
60
|
}
|
|
60
61
|
else if (url === importer_1.legacyImporterProtocol) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
input.importer = new proto.InboundMessage_CompileRequest_Importer({
|
|
63
|
+
importer: { case: 'path', value: p.resolve('.') },
|
|
64
|
+
});
|
|
64
65
|
}
|
|
65
66
|
else {
|
|
66
67
|
// When importer is not set on the host, the compiler will set a
|
|
67
68
|
// FileSystemImporter if `url` is set to a file: url or a NoOpImporter.
|
|
68
69
|
}
|
|
69
70
|
const request = newCompileRequest(importers, options);
|
|
70
|
-
request.
|
|
71
|
+
request.input = { case: 'string', value: input };
|
|
71
72
|
return request;
|
|
72
73
|
}
|
|
73
74
|
// Creates a compilation request for the given `options` without adding any
|
|
74
75
|
// input-specific options.
|
|
75
76
|
function newCompileRequest(importers, options) {
|
|
76
77
|
var _a, _b, _c, _d;
|
|
77
|
-
const request = new proto.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
78
|
+
const request = new proto.InboundMessage_CompileRequest({
|
|
79
|
+
importers: importers.importers,
|
|
80
|
+
globalFunctions: Object.keys((_a = options === null || options === void 0 ? void 0 : options.functions) !== null && _a !== void 0 ? _a : {}),
|
|
81
|
+
sourceMap: !!(options === null || options === void 0 ? void 0 : options.sourceMap),
|
|
82
|
+
sourceMapIncludeSources: !!(options === null || options === void 0 ? void 0 : options.sourceMapIncludeSources),
|
|
83
|
+
alertColor: (_b = options === null || options === void 0 ? void 0 : options.alertColor) !== null && _b !== void 0 ? _b : !!supportsColor.stdout,
|
|
84
|
+
alertAscii: !!(options === null || options === void 0 ? void 0 : options.alertAscii),
|
|
85
|
+
quietDeps: !!(options === null || options === void 0 ? void 0 : options.quietDeps),
|
|
86
|
+
verbose: !!(options === null || options === void 0 ? void 0 : options.verbose),
|
|
87
|
+
charset: !!((_c = options === null || options === void 0 ? void 0 : options.charset) !== null && _c !== void 0 ? _c : true),
|
|
88
|
+
});
|
|
87
89
|
switch ((_d = options === null || options === void 0 ? void 0 : options.style) !== null && _d !== void 0 ? _d : 'expanded') {
|
|
88
90
|
case 'expanded':
|
|
89
|
-
request.
|
|
91
|
+
request.style = proto.OutputStyle.EXPANDED;
|
|
90
92
|
break;
|
|
91
93
|
case 'compressed':
|
|
92
|
-
request.
|
|
94
|
+
request.style = proto.OutputStyle.COMPRESSED;
|
|
93
95
|
break;
|
|
94
96
|
default:
|
|
95
97
|
throw new Error(`Unknown options.style: "${options === null || options === void 0 ? void 0 : options.style}"`);
|
|
@@ -102,6 +104,7 @@ function newCompileRequest(importers, options) {
|
|
|
102
104
|
async function compileRequestAsync(request, importers, options) {
|
|
103
105
|
const functions = new function_registry_1.FunctionRegistry(options === null || options === void 0 ? void 0 : options.functions);
|
|
104
106
|
const embeddedCompiler = new async_compiler_1.AsyncEmbeddedCompiler();
|
|
107
|
+
embeddedCompiler.stderr$.subscribe(data => process.stderr.write(data));
|
|
105
108
|
try {
|
|
106
109
|
const dispatcher = createDispatcher(embeddedCompiler.stdout$, buffer => {
|
|
107
110
|
embeddedCompiler.writeStdin(buffer);
|
|
@@ -132,6 +135,7 @@ async function compileRequestAsync(request, importers, options) {
|
|
|
132
135
|
function compileRequestSync(request, importers, options) {
|
|
133
136
|
const functions = new function_registry_1.FunctionRegistry(options === null || options === void 0 ? void 0 : options.functions);
|
|
134
137
|
const embeddedCompiler = new sync_compiler_1.SyncEmbeddedCompiler();
|
|
138
|
+
embeddedCompiler.stderr$.subscribe(data => process.stderr.write(data));
|
|
135
139
|
try {
|
|
136
140
|
const dispatcher = createDispatcher(embeddedCompiler.stdout$, buffer => {
|
|
137
141
|
embeddedCompiler.writeStdin(buffer);
|
|
@@ -178,31 +182,31 @@ function createDispatcher(stdout, writeStdin, handlers) {
|
|
|
178
182
|
/** Handles a log event according to `options`. */
|
|
179
183
|
function handleLogEvent(options, event) {
|
|
180
184
|
var _a, _b;
|
|
181
|
-
if (event.
|
|
185
|
+
if (event.type === proto.LogEventType.DEBUG) {
|
|
182
186
|
if ((_a = options === null || options === void 0 ? void 0 : options.logger) === null || _a === void 0 ? void 0 : _a.debug) {
|
|
183
|
-
options.logger.debug(event.
|
|
184
|
-
span: (0, deprotofy_span_1.deprotofySourceSpan)(event.
|
|
187
|
+
options.logger.debug(event.message, {
|
|
188
|
+
span: (0, deprotofy_span_1.deprotofySourceSpan)(event.span),
|
|
185
189
|
});
|
|
186
190
|
}
|
|
187
191
|
else {
|
|
188
|
-
console.error(event.
|
|
192
|
+
console.error(event.formatted);
|
|
189
193
|
}
|
|
190
194
|
}
|
|
191
195
|
else {
|
|
192
196
|
if ((_b = options === null || options === void 0 ? void 0 : options.logger) === null || _b === void 0 ? void 0 : _b.warn) {
|
|
193
197
|
const params = {
|
|
194
|
-
deprecation: event.
|
|
198
|
+
deprecation: event.type === proto.LogEventType.DEPRECATION_WARNING,
|
|
195
199
|
};
|
|
196
|
-
const spanProto = event.
|
|
200
|
+
const spanProto = event.span;
|
|
197
201
|
if (spanProto)
|
|
198
202
|
params.span = (0, deprotofy_span_1.deprotofySourceSpan)(spanProto);
|
|
199
|
-
const stack = event.
|
|
203
|
+
const stack = event.stackTrace;
|
|
200
204
|
if (stack)
|
|
201
205
|
params.stack = stack;
|
|
202
|
-
options.logger.warn(event.
|
|
206
|
+
options.logger.warn(event.message, params);
|
|
203
207
|
}
|
|
204
208
|
else {
|
|
205
|
-
console.error(event.
|
|
209
|
+
console.error(event.formatted);
|
|
206
210
|
}
|
|
207
211
|
}
|
|
208
212
|
}
|
|
@@ -212,19 +216,19 @@ function handleLogEvent(options, event) {
|
|
|
212
216
|
* Throws a `SassException` if the compilation failed.
|
|
213
217
|
*/
|
|
214
218
|
function handleCompileResponse(response) {
|
|
215
|
-
if (response.
|
|
216
|
-
const success = response.
|
|
219
|
+
if (response.result.case === 'success') {
|
|
220
|
+
const success = response.result.value;
|
|
217
221
|
const result = {
|
|
218
|
-
css: success.
|
|
219
|
-
loadedUrls: success.
|
|
222
|
+
css: success.css,
|
|
223
|
+
loadedUrls: success.loadedUrls.map(url => new URL(url)),
|
|
220
224
|
};
|
|
221
|
-
const sourceMap = success.
|
|
225
|
+
const sourceMap = success.sourceMap;
|
|
222
226
|
if (sourceMap)
|
|
223
227
|
result.sourceMap = JSON.parse(sourceMap);
|
|
224
228
|
return result;
|
|
225
229
|
}
|
|
226
|
-
else if (response.
|
|
227
|
-
throw new exception_1.Exception(response.
|
|
230
|
+
else if (response.result.case === 'failure') {
|
|
231
|
+
throw new exception_1.Exception(response.result.value);
|
|
228
232
|
}
|
|
229
233
|
else {
|
|
230
234
|
throw utils.compilerError('Compiler sent empty CompileResponse.');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../../../lib/src/compile.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,0BAA0B;AAE1B,gDAAgD;AAEhD,
|
|
1
|
+
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../../../lib/src/compile.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,0BAA0B;AAE1B,gDAAgD;AAEhD,mDAAmD;AACnD,iCAAiC;AACjC,qDAAuD;AAEvD,6CAA4D;AAC5D,2CAAsC;AACtC,2DAAqD;AACrD,2DAAqD;AACrD,+DAAyD;AACzD,6DAAuD;AACvD,mDAAqD;AACrD,qDAAqD;AACrD,gDAAyD;AAEzD,SAAgB,OAAO,CACrB,IAAY,EACZ,OAAyB;IAEzB,MAAM,SAAS,GAAG,IAAI,oCAAgB,C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C,IAAI,SAAS;YAAE,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACxD,OAAO,MAAM,CAAC;KACf;SAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE;QAC7C,MAAM,IAAI,qBAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;KAC5C;SAAM;QACL,MAAM,KAAK,CAAC,aAAa,CAAC,sCAAsC,CAAC,CAAC;KACnE;AACH,CAAC"}
|
|
@@ -9,6 +9,12 @@ const p = require("path");
|
|
|
9
9
|
const utils_1 = require("./utils");
|
|
10
10
|
/** The path to the embedded compiler executable. */
|
|
11
11
|
exports.compilerPath = (() => {
|
|
12
|
+
// find for development
|
|
13
|
+
for (const path of ['vendor', '../../../lib/src/vendor']) {
|
|
14
|
+
const executable = p.resolve(__dirname, path, `dart-sass-embedded/dart-sass-embedded${process.platform === 'win32' ? '.bat' : ''}`);
|
|
15
|
+
if (fs.existsSync(executable))
|
|
16
|
+
return executable;
|
|
17
|
+
}
|
|
12
18
|
try {
|
|
13
19
|
return require.resolve(`sass-embedded-${process.platform}-${process.arch}/` +
|
|
14
20
|
'dart-sass-embedded/dart-sass-embedded' +
|
|
@@ -19,12 +25,6 @@ exports.compilerPath = (() => {
|
|
|
19
25
|
throw e;
|
|
20
26
|
}
|
|
21
27
|
}
|
|
22
|
-
// find for development
|
|
23
|
-
for (const path of ['vendor', '../../../lib/src/vendor']) {
|
|
24
|
-
const executable = p.resolve(__dirname, path, `dart-sass-embedded/dart-sass-embedded${process.platform === 'win32' ? '.bat' : ''}`);
|
|
25
|
-
if (fs.existsSync(executable))
|
|
26
|
-
return executable;
|
|
27
|
-
}
|
|
28
28
|
throw new Error("Embedded Dart Sass couldn't find the embedded compiler executable. " +
|
|
29
29
|
'Please make sure the optional dependency ' +
|
|
30
30
|
`sass-embedded-${process.platform}-${process.arch} is installed in ` +
|
|
@@ -1 +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;AAC1B,mCAAyC;AAEzC,oDAAoD;AACvC,QAAA,YAAY,GAAG,CAAC,GAAG,EAAE;IAChC,
|
|
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;AAC1B,mCAAyC;AAEzC,oDAAoD;AACvC,QAAA,YAAY,GAAG,CAAC,GAAG,EAAE;IAChC,uBAAuB;IACvB,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,IAAI;QACF,OAAO,OAAO,CAAC,OAAO,CACpB,iBAAiB,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,GAAG;YAClD,uCAAuC;YACvC,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAC/C,CAAC;KACH;IAAC,OAAO,CAAU,EAAE;QACnB,IAAI,CAAC,CAAC,IAAA,wBAAgB,EAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,kBAAkB,CAAC,EAAE;YAC3D,MAAM,CAAC,CAAC;SACT;KACF;IAED,MAAM,IAAI,KAAK,CACb,qEAAqE;QACnE,2CAA2C;QAC3C,iBAAiB,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,mBAAmB;QACpE,eAAe,CAClB,CAAC;AACJ,CAAC,CAAC,EAAE,CAAC"}
|
|
@@ -9,43 +9,34 @@ const utils_1 = require("./utils");
|
|
|
9
9
|
// Creates a SourceSpan from the given protocol `buffer`. Throws if the buffer
|
|
10
10
|
// has invalid fields.
|
|
11
11
|
function deprotofySourceSpan(buffer) {
|
|
12
|
-
const text = buffer.
|
|
13
|
-
if (buffer.
|
|
12
|
+
const text = buffer.text;
|
|
13
|
+
if (buffer.start === undefined) {
|
|
14
14
|
throw (0, utils_1.compilerError)('Expected SourceSpan to have start.');
|
|
15
15
|
}
|
|
16
|
-
const start = deprotofySourceLocation(buffer.getStart());
|
|
17
16
|
let end;
|
|
18
|
-
if (buffer.
|
|
17
|
+
if (buffer.end === undefined) {
|
|
19
18
|
if (text !== '') {
|
|
20
19
|
throw (0, utils_1.compilerError)('Expected SourceSpan text to be empty.');
|
|
21
20
|
}
|
|
22
21
|
else {
|
|
23
|
-
end = start;
|
|
22
|
+
end = buffer.start;
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
25
|
else {
|
|
27
|
-
end =
|
|
28
|
-
if (end.offset < start.offset) {
|
|
26
|
+
end = buffer.end;
|
|
27
|
+
if (end.offset < buffer.start.offset) {
|
|
29
28
|
throw (0, utils_1.compilerError)('Expected SourceSpan end to be after start.');
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
|
-
const url = buffer.
|
|
33
|
-
const context = buffer.
|
|
31
|
+
const url = buffer.url === '' ? undefined : new url_1.URL(buffer.url);
|
|
32
|
+
const context = buffer.context === '' ? undefined : buffer.context;
|
|
34
33
|
return {
|
|
35
34
|
text,
|
|
36
|
-
start,
|
|
35
|
+
start: buffer.start,
|
|
37
36
|
end,
|
|
38
37
|
url,
|
|
39
38
|
context,
|
|
40
39
|
};
|
|
41
40
|
}
|
|
42
41
|
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
42
|
//# sourceMappingURL=deprotofy-span.js.map
|
|
@@ -1 +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,
|
|
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,IAAI,CAAC;IAEzB,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,EAAE;QAC9B,MAAM,IAAA,qBAAa,EAAC,oCAAoC,CAAC,CAAC;KAC3D;IAED,IAAI,GAAG,CAAC;IACR,IAAI,MAAM,CAAC,GAAG,KAAK,SAAS,EAAE;QAC5B,IAAI,IAAI,KAAK,EAAE,EAAE;YACf,MAAM,IAAA,qBAAa,EAAC,uCAAuC,CAAC,CAAC;SAC9D;aAAM;YACL,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC;SACpB;KACF;SAAM;QACL,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;QACjB,IAAI,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE;YACpC,MAAM,IAAA,qBAAa,EAAC,4CAA4C,CAAC,CAAC;SACnE;KACF;IAED,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,SAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAEhE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;IAEnE,OAAO;QACL,IAAI;QACJ,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,GAAG;QACH,GAAG;QACH,OAAO;KACR,CAAC;AACJ,CAAC;AAhCD,kDAgCC"}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.Dispatcher = void 0;
|
|
7
7
|
const rxjs_1 = require("rxjs");
|
|
8
8
|
const operators_1 = require("rxjs/operators");
|
|
9
|
-
const
|
|
9
|
+
const proto = require("./vendor/embedded_sass_pb");
|
|
10
10
|
const request_tracker_1 = require("./request-tracker");
|
|
11
11
|
const utils_1 = require("./utils");
|
|
12
12
|
/**
|
|
@@ -56,7 +56,7 @@ class Dispatcher {
|
|
|
56
56
|
* Outbound log events. If an error occurs, the dispatcher closes this
|
|
57
57
|
* silently.
|
|
58
58
|
*/
|
|
59
|
-
this.logEvents$ = this.messages$.pipe((0, operators_1.filter)(message => message.
|
|
59
|
+
this.logEvents$ = this.messages$.pipe((0, operators_1.filter)(message => message.message.case === 'logEvent'), (0, operators_1.map)(message => message.message.value));
|
|
60
60
|
this.outboundMessages$
|
|
61
61
|
.pipe((0, operators_1.mergeMap)(message => {
|
|
62
62
|
const result = this.handleOutboundMessage(message);
|
|
@@ -82,7 +82,7 @@ class Dispatcher {
|
|
|
82
82
|
* events synchronously, `callback` will be called synchronously.
|
|
83
83
|
*/
|
|
84
84
|
sendCompileRequest(request, callback) {
|
|
85
|
-
this.handleInboundRequest(request,
|
|
85
|
+
this.handleInboundRequest({ value: request, case: 'compileRequest' }, 'compileResponse', callback);
|
|
86
86
|
}
|
|
87
87
|
// Rejects with `error` all promises awaiting an outbound response, and
|
|
88
88
|
// silently closes all subscriptions awaiting outbound events.
|
|
@@ -95,90 +95,90 @@ class Dispatcher {
|
|
|
95
95
|
// contains a request, runs the appropriate callback to generate an inbound
|
|
96
96
|
// response, and then sends it inbound.
|
|
97
97
|
handleOutboundMessage(message) {
|
|
98
|
-
switch (message.
|
|
99
|
-
case
|
|
98
|
+
switch (message.message.case) {
|
|
99
|
+
case 'logEvent':
|
|
100
|
+
// Handled separately by `logEvents$`.
|
|
100
101
|
return undefined;
|
|
101
|
-
case
|
|
102
|
-
this.pendingInboundRequests.resolve(message.
|
|
102
|
+
case 'compileResponse':
|
|
103
|
+
this.pendingInboundRequests.resolve(message.message.value.id, message.message.case);
|
|
103
104
|
return undefined;
|
|
104
|
-
case
|
|
105
|
-
const request = message.
|
|
106
|
-
const id = request.
|
|
107
|
-
const type =
|
|
105
|
+
case 'importRequest': {
|
|
106
|
+
const request = message.message.value;
|
|
107
|
+
const id = request.id;
|
|
108
|
+
const type = 'importResponse';
|
|
108
109
|
this.pendingOutboundRequests.add(id, type);
|
|
109
110
|
return (0, utils_1.thenOr)(this.outboundRequestHandlers.handleImportRequest(request), response => {
|
|
110
|
-
this.sendInboundMessage(id,
|
|
111
|
+
this.sendInboundMessage(id, { case: type, value: response });
|
|
111
112
|
});
|
|
112
113
|
}
|
|
113
|
-
case
|
|
114
|
-
const request = message.
|
|
115
|
-
const id = request.
|
|
116
|
-
const type =
|
|
114
|
+
case 'fileImportRequest': {
|
|
115
|
+
const request = message.message.value;
|
|
116
|
+
const id = request.id;
|
|
117
|
+
const type = 'fileImportResponse';
|
|
117
118
|
this.pendingOutboundRequests.add(id, type);
|
|
118
119
|
return (0, utils_1.thenOr)(this.outboundRequestHandlers.handleFileImportRequest(request), response => {
|
|
119
|
-
this.sendInboundMessage(id,
|
|
120
|
+
this.sendInboundMessage(id, { case: type, value: response });
|
|
120
121
|
});
|
|
121
122
|
}
|
|
122
|
-
case
|
|
123
|
-
const request = message.
|
|
124
|
-
const id = request.
|
|
125
|
-
const type =
|
|
123
|
+
case 'canonicalizeRequest': {
|
|
124
|
+
const request = message.message.value;
|
|
125
|
+
const id = request.id;
|
|
126
|
+
const type = 'canonicalizeResponse';
|
|
126
127
|
this.pendingOutboundRequests.add(id, type);
|
|
127
128
|
return (0, utils_1.thenOr)(this.outboundRequestHandlers.handleCanonicalizeRequest(request), response => {
|
|
128
|
-
this.sendInboundMessage(id,
|
|
129
|
+
this.sendInboundMessage(id, { case: type, value: response });
|
|
129
130
|
});
|
|
130
131
|
}
|
|
131
|
-
case
|
|
132
|
-
const request = message.
|
|
133
|
-
const id = request.
|
|
134
|
-
const type =
|
|
132
|
+
case 'functionCallRequest': {
|
|
133
|
+
const request = message.message.value;
|
|
134
|
+
const id = request.id;
|
|
135
|
+
const type = 'functionCallResponse';
|
|
135
136
|
this.pendingOutboundRequests.add(id, type);
|
|
136
137
|
return (0, utils_1.thenOr)(this.outboundRequestHandlers.handleFunctionCallRequest(request), response => {
|
|
137
|
-
this.sendInboundMessage(id,
|
|
138
|
+
this.sendInboundMessage(id, { case: type, value: response });
|
|
138
139
|
});
|
|
139
140
|
}
|
|
141
|
+
case 'error':
|
|
142
|
+
throw (0, utils_1.hostError)(message.message.value.message);
|
|
140
143
|
default:
|
|
141
|
-
throw
|
|
144
|
+
throw (0, utils_1.compilerError)(`Unknown message type ${message.message.case}`);
|
|
142
145
|
}
|
|
143
146
|
}
|
|
144
|
-
// Sends
|
|
145
|
-
//
|
|
146
|
-
//
|
|
147
|
-
handleInboundRequest(request,
|
|
147
|
+
// Sends `request` inbound. Once it's done, calls `callback` with either the
|
|
148
|
+
// corresponding outbound response of type `responseType`, or an error if any
|
|
149
|
+
// protocol errors were encountered.
|
|
150
|
+
handleInboundRequest(request, responseType, callback) {
|
|
148
151
|
if (this.messages$.isStopped) {
|
|
149
152
|
callback(new Error('Tried writing to closed dispatcher'), undefined);
|
|
150
153
|
return;
|
|
151
154
|
}
|
|
152
155
|
this.messages$
|
|
153
|
-
.pipe((0, operators_1.filter)(message => message.
|
|
156
|
+
.pipe((0, operators_1.filter)(message => message.message.case === responseType), (0, operators_1.map)(message => message.message.value), (0, operators_1.filter)(response => response.id === request.value.id))
|
|
154
157
|
.subscribe({ next: response => callback(null, response) });
|
|
155
158
|
this.error$.subscribe({ error: error => callback(error, undefined) });
|
|
156
159
|
try {
|
|
157
|
-
this.sendInboundMessage(this.pendingInboundRequests.nextId, request
|
|
160
|
+
this.sendInboundMessage(this.pendingInboundRequests.nextId, request);
|
|
158
161
|
}
|
|
159
162
|
catch (error) {
|
|
160
163
|
this.throwAndClose(error);
|
|
161
164
|
}
|
|
162
165
|
}
|
|
163
166
|
// Sends a message inbound. Keeps track of all pending inbound requests.
|
|
164
|
-
sendInboundMessage(id,
|
|
165
|
-
|
|
166
|
-
if (
|
|
167
|
-
this.pendingInboundRequests.add(id,
|
|
167
|
+
sendInboundMessage(id, message) {
|
|
168
|
+
message.value.id = id;
|
|
169
|
+
if (message.case === 'compileRequest') {
|
|
170
|
+
this.pendingInboundRequests.add(id, 'compileResponse');
|
|
168
171
|
}
|
|
169
|
-
else if (
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
this.pendingOutboundRequests.resolve(id,
|
|
172
|
+
else if (message.case === 'importResponse' ||
|
|
173
|
+
message.case === 'fileImportResponse' ||
|
|
174
|
+
message.case === 'canonicalizeResponse' ||
|
|
175
|
+
message.case === 'functionCallResponse') {
|
|
176
|
+
this.pendingOutboundRequests.resolve(id, message.case);
|
|
174
177
|
}
|
|
175
178
|
else {
|
|
176
|
-
throw Error(`Unknown message type ${
|
|
179
|
+
throw Error(`Unknown message type ${message.case}`);
|
|
177
180
|
}
|
|
178
|
-
this.writeInboundMessage({
|
|
179
|
-
payload,
|
|
180
|
-
type,
|
|
181
|
-
});
|
|
181
|
+
this.writeInboundMessage(new proto.InboundMessage({ message }));
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
exports.Dispatcher = Dispatcher;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatcher.js","sourceRoot":"","sources":["../../../lib/src/dispatcher.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,+BAAyC;AACzC,8CAAqD;
|
|
1
|
+
{"version":3,"file":"dispatcher.js","sourceRoot":"","sources":["../../../lib/src/dispatcher.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,+BAAyC;AACzC,8CAAqD;AAOrD,mDAAmD;AACnD,uDAAiD;AACjD,mCAAoE;AAEpE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAa,UAAU;IAiCrB,YACmB,iBAAoD,EACpD,mBAER,EACQ,uBAAiD;QAJjD,sBAAiB,GAAjB,iBAAiB,CAAmC;QACpD,wBAAmB,GAAnB,mBAAmB,CAE3B;QACQ,4BAAuB,GAAvB,uBAAuB,CAA0B;QArCpE,6EAA6E;QAC7E,kCAAkC;QACjB,2BAAsB,GAAG,IAAI,gCAAc,EAAE,CAAC;QAE/D,6EAA6E;QAC7E,kCAAkC;QACjB,4BAAuB,GAAG,IAAI,gCAAc,EAAE,CAAC;QAEhE,6EAA6E;QAC7E,kBAAkB;QACD,cAAS,GAAG,IAAI,cAAO,EAAyB,CAAC;QAElE,yEAAyE;QACzE,oCAAoC;QACnB,mBAAc,GAAG,IAAI,cAAO,EAAQ,CAAC;QAEtD;;;;WAIG;QACM,WAAM,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;QAE7C;;;WAGG;QACM,eAAU,GAAG,IAAI,CAAC,SAAS,CAA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AwE;IAChE,kBAAkB,CACxB,EAAU,EACV,OAAoE;QAEpE,OAAO,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;QAEtB,IAAI,OAAO,CAAC,IAAI,KAAK,gBAAgB,EAAE;YACrC,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,EAAE,EAAE,iBAAiB,CAAC,CAAC;SACxD;aAAM,IACL,OAAO,CAAC,IAAI,KAAK,gBAAgB;YACjC,OAAO,CAAC,IAAI,KAAK,oBAAoB;YACrC,OAAO,CAAC,IAAI,KAAK,sBAAsB;YACvC,OAAO,CAAC,IAAI,KAAK,sBAAsB,EACvC;YACA,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;SACxD;aAAM;YACL,MAAM,KAAK,CAAC,wBAAwB,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;SACrD;QAED,IAAI,CAAC,mBAAmB,CAAC,IAAI,KAAK,CAAC,cAAc,CAAC,EAAC,OAAO,EAAC,CAAC,CAAC,CAAC;IAChE,CAAC;CACF;AA5ND,gCA4NC"}
|
|
@@ -7,10 +7,10 @@ exports.Exception = void 0;
|
|
|
7
7
|
const deprotofy_span_1 = require("./deprotofy-span");
|
|
8
8
|
class Exception extends Error {
|
|
9
9
|
constructor(failure) {
|
|
10
|
-
super(failure.
|
|
11
|
-
this.sassMessage = failure.
|
|
12
|
-
this.sassStack = failure.
|
|
13
|
-
this.span = (0, deprotofy_span_1.deprotofySourceSpan)(failure.
|
|
10
|
+
super(failure.formatted);
|
|
11
|
+
this.sassMessage = failure.message;
|
|
12
|
+
this.sassStack = failure.stackTrace;
|
|
13
|
+
this.span = (0, deprotofy_span_1.deprotofySourceSpan)(failure.span);
|
|
14
14
|
}
|
|
15
15
|
toString() {
|
|
16
16
|
return this.message;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exception.js","sourceRoot":"","sources":["../../../lib/src/exception.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAIvC,qDAAqD;AAErD,MAAa,SAAU,SAAQ,KAAK;IAKlC,YAAY,OAA6D;QACvE,KAAK,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"exception.js","sourceRoot":"","sources":["../../../lib/src/exception.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAIvC,qDAAqD;AAErD,MAAa,SAAU,SAAQ,KAAK;IAKlC,YAAY,OAA6D;QACvE,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAEzB,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;QACnC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC;QACpC,IAAI,CAAC,IAAI,GAAG,IAAA,oCAAmB,EAAC,OAAO,CAAC,IAAK,CAAC,CAAC;IACjD,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF;AAhBD,8BAgBC"}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.FunctionRegistry = void 0;
|
|
7
7
|
const util_1 = require("util");
|
|
8
8
|
const utils = require("./utils");
|
|
9
|
-
const
|
|
9
|
+
const proto = require("./vendor/embedded_sass_pb");
|
|
10
10
|
const utils_1 = require("./utils");
|
|
11
11
|
const protofier_1 = require("./protofier");
|
|
12
12
|
const value_1 = require("./value");
|
|
@@ -48,43 +48,42 @@ class FunctionRegistry {
|
|
|
48
48
|
const protofier = new protofier_1.Protofier(this);
|
|
49
49
|
const fn = this.get(request);
|
|
50
50
|
return (0, utils_1.catchOr)(() => {
|
|
51
|
-
return (0, utils_1.thenOr)(fn(request
|
|
52
|
-
.getArgumentsList()
|
|
53
|
-
.map(value => protofier.deprotofy(value))), result => {
|
|
51
|
+
return (0, utils_1.thenOr)(fn(request.arguments.map(value => protofier.deprotofy(value))), result => {
|
|
54
52
|
if (!(result instanceof value_1.Value)) {
|
|
55
|
-
const name = request.
|
|
56
|
-
?
|
|
57
|
-
:
|
|
53
|
+
const name = request.identifier.case === 'name'
|
|
54
|
+
? `"${request.identifier.value}"`
|
|
55
|
+
: 'anonymous function';
|
|
58
56
|
throw (`options.functions: ${name} returned non-Value: ` +
|
|
59
57
|
(0, util_1.inspect)(result));
|
|
60
58
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
return new proto.InboundMessage_FunctionCallResponse({
|
|
60
|
+
result: { case: 'success', value: protofier.protofy(result) },
|
|
61
|
+
accessedArgumentLists: protofier.accessedArgumentLists,
|
|
62
|
+
});
|
|
65
63
|
});
|
|
66
|
-
}, error => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
return response;
|
|
70
|
-
});
|
|
64
|
+
}, error => new proto.InboundMessage_FunctionCallResponse({
|
|
65
|
+
result: { case: 'error', value: `${error}` },
|
|
66
|
+
}));
|
|
71
67
|
}
|
|
72
68
|
/** Returns the function to which `request` refers. */
|
|
73
69
|
get(request) {
|
|
74
|
-
if (request.
|
|
75
|
-
|
|
76
|
-
const fn = this.functionsByName.get(request.getName());
|
|
70
|
+
if (request.identifier.case === 'name') {
|
|
71
|
+
const fn = this.functionsByName.get(request.identifier.value);
|
|
77
72
|
if (fn)
|
|
78
73
|
return fn;
|
|
79
|
-
throw
|
|
80
|
-
`named "${request.
|
|
74
|
+
throw (0, utils_1.compilerError)('Invalid OutboundMessage_FunctionCallRequest: there is no function ' +
|
|
75
|
+
`named "${request.identifier.value}"`);
|
|
81
76
|
}
|
|
82
|
-
else {
|
|
83
|
-
const fn = this.functionsById.get(request.
|
|
77
|
+
else if (request.identifier.case === 'functionId') {
|
|
78
|
+
const fn = this.functionsById.get(request.identifier.value);
|
|
84
79
|
if (fn)
|
|
85
80
|
return fn;
|
|
86
|
-
throw
|
|
87
|
-
`with ID "${request.
|
|
81
|
+
throw (0, utils_1.compilerError)('Invalid OutboundMessage_FunctionCallRequest: there is no function ' +
|
|
82
|
+
`with ID "${request.identifier.value}"`);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
throw (0, utils_1.compilerError)('Invalid OutboundMessage_FunctionCallRequest: function identifier is ' +
|
|
86
|
+
'unset');
|
|
88
87
|
}
|
|
89
88
|
}
|
|
90
89
|
}
|