sass-embedded 1.80.6 → 1.80.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/dist/lib/src/canonicalize-context.js +3 -1
- package/dist/lib/src/canonicalize-context.js.map +1 -1
- package/dist/lib/src/compiler/async.js +32 -30
- package/dist/lib/src/compiler/async.js.map +1 -1
- package/dist/lib/src/compiler/sync.js +31 -27
- package/dist/lib/src/compiler/sync.js.map +1 -1
- package/dist/lib/src/compiler/utils.js +22 -25
- package/dist/lib/src/compiler/utils.js.map +1 -1
- package/dist/lib/src/deprecations.js +3 -6
- package/dist/lib/src/deprecations.js.map +1 -1
- package/dist/lib/src/dispatcher.js +28 -24
- package/dist/lib/src/dispatcher.js.map +1 -1
- package/dist/lib/src/exception.js +3 -0
- package/dist/lib/src/exception.js.map +1 -1
- package/dist/lib/src/function-registry.js +6 -6
- package/dist/lib/src/function-registry.js.map +1 -1
- package/dist/lib/src/importer-registry.js +14 -15
- package/dist/lib/src/importer-registry.js.map +1 -1
- package/dist/lib/src/legacy/importer.js +12 -6
- package/dist/lib/src/legacy/importer.js.map +1 -1
- package/dist/lib/src/legacy/index.js +12 -18
- package/dist/lib/src/legacy/index.js.map +1 -1
- package/dist/lib/src/legacy/resolve-path.js +7 -7
- package/dist/lib/src/legacy/resolve-path.js.map +1 -1
- package/dist/lib/src/legacy/value/base.js +1 -0
- package/dist/lib/src/legacy/value/base.js.map +1 -1
- package/dist/lib/src/legacy/value/color.js +2 -1
- package/dist/lib/src/legacy/value/color.js.map +1 -1
- package/dist/lib/src/legacy/value/wrap.js.map +1 -1
- package/dist/lib/src/message-transformer.js +10 -8
- package/dist/lib/src/message-transformer.js.map +1 -1
- package/dist/lib/src/packet-transformer.js +28 -23
- package/dist/lib/src/packet-transformer.js.map +1 -1
- package/dist/lib/src/protofier.js +7 -7
- package/dist/lib/src/protofier.js.map +1 -1
- package/dist/lib/src/request-tracker.js +3 -5
- package/dist/lib/src/request-tracker.js.map +1 -1
- package/dist/lib/src/value/argument-list.js +23 -2
- package/dist/lib/src/value/argument-list.js.map +1 -1
- package/dist/lib/src/value/boolean.js +8 -4
- package/dist/lib/src/value/boolean.js.map +1 -1
- package/dist/lib/src/value/calculations.js +6 -0
- package/dist/lib/src/value/calculations.js.map +1 -1
- package/dist/lib/src/value/color.js +55 -54
- package/dist/lib/src/value/color.js.map +1 -1
- package/dist/lib/src/value/function.js +27 -0
- package/dist/lib/src/value/function.js.map +1 -1
- package/dist/lib/src/value/list.js +6 -4
- package/dist/lib/src/value/list.js.map +1 -1
- package/dist/lib/src/value/map.js +2 -1
- package/dist/lib/src/value/map.js.map +1 -1
- package/dist/lib/src/value/mixin.js +9 -0
- package/dist/lib/src/value/mixin.js.map +1 -1
- package/dist/lib/src/value/null.js +6 -4
- package/dist/lib/src/value/null.js.map +1 -1
- package/dist/lib/src/value/number.js +7 -6
- package/dist/lib/src/value/number.js.map +1 -1
- package/dist/lib/src/value/string.js +5 -4
- package/dist/lib/src/value/string.js.map +1 -1
- package/dist/lib/src/version.js +3 -0
- package/dist/lib/src/version.js.map +1 -1
- package/dist/package.json +25 -24
- package/dist/test/sandbox.js +2 -2
- package/dist/test/sandbox.js.map +1 -1
- package/dist/tool/get-embedded-compiler.js +1 -2
- package/dist/tool/get-embedded-compiler.js.map +1 -1
- package/dist/tool/get-language-repo.js +1 -2
- package/dist/tool/get-language-repo.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +25 -24
- package/dist/lib/src/sync-process/event.js +0 -6
- package/dist/lib/src/sync-process/event.js.map +0 -1
- package/dist/lib/src/sync-process/index.js +0 -122
- package/dist/lib/src/sync-process/index.js.map +0 -1
- package/dist/lib/src/sync-process/sync-message-port.js +0 -132
- package/dist/lib/src/sync-process/sync-message-port.js.map +0 -1
- package/dist/lib/src/sync-process/worker.js +0 -51
- package/dist/lib/src/sync-process/worker.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{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OAAO,EAAE,IAAI,EAAE,IAAI,EAAC,CACzB,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,YAAY,MAAM,qBAAqB,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -1,132 +0,0 @@
|
|
|
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.SyncMessagePort = void 0;
|
|
7
|
-
const assert_1 = require("assert");
|
|
8
|
-
const events_1 = require("events");
|
|
9
|
-
const worker_threads_1 = require("worker_threads");
|
|
10
|
-
// TODO(nex3): Make this its own package.
|
|
11
|
-
/**
|
|
12
|
-
* An enum of possible states for the shared buffer that two `SyncMessagePort`s
|
|
13
|
-
* use to communicate.
|
|
14
|
-
*/
|
|
15
|
-
var BufferState;
|
|
16
|
-
(function (BufferState) {
|
|
17
|
-
/**
|
|
18
|
-
* The initial state. When an endpoint is ready to receive messages, it'll set
|
|
19
|
-
* the buffer to this state so that it can use `Atomics.wait()` to be notified
|
|
20
|
-
* when it switches to `MessageSent`.
|
|
21
|
-
*/
|
|
22
|
-
BufferState[BufferState["AwaitingMessage"] = 0] = "AwaitingMessage";
|
|
23
|
-
/**
|
|
24
|
-
* The state indicating that a message has been sent. Whenever an endpoint
|
|
25
|
-
* sends a message, it'll set the buffer to this state so that the other
|
|
26
|
-
* endpoint's `Atomics.wait()` call terminates.
|
|
27
|
-
*/
|
|
28
|
-
BufferState[BufferState["MessageSent"] = 1] = "MessageSent";
|
|
29
|
-
/**
|
|
30
|
-
* The bitmask indicating that the channel has been closed. This is masked on
|
|
31
|
-
* top of AwaitingMessage and MessageSent state. It never transitions to any
|
|
32
|
-
* other states once closed.
|
|
33
|
-
*/
|
|
34
|
-
BufferState[BufferState["Closed"] = 2] = "Closed";
|
|
35
|
-
})(BufferState || (BufferState = {}));
|
|
36
|
-
/**
|
|
37
|
-
* A communication port that can receive messages synchronously from another
|
|
38
|
-
* `SyncMessagePort`.
|
|
39
|
-
*
|
|
40
|
-
* This also emits the same asynchronous events as `MessagePort`.
|
|
41
|
-
*/
|
|
42
|
-
class SyncMessagePort extends events_1.EventEmitter {
|
|
43
|
-
/** Creates a channel whose ports can be passed to `new SyncMessagePort()`. */
|
|
44
|
-
static createChannel() {
|
|
45
|
-
const channel = new worker_threads_1.MessageChannel();
|
|
46
|
-
// Four bytes is the minimum necessary to use `Atomics.wait()`.
|
|
47
|
-
const buffer = new SharedArrayBuffer(4);
|
|
48
|
-
// Queue up messages on each port so the caller doesn't have to explicitly
|
|
49
|
-
// pass the buffer around along with them.
|
|
50
|
-
channel.port1.postMessage(buffer);
|
|
51
|
-
channel.port2.postMessage(buffer);
|
|
52
|
-
return channel;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Creates a new message port. The `port` must be created by
|
|
56
|
-
* `SyncMessagePort.createChannel()` and must connect to a port passed to
|
|
57
|
-
* another `SyncMessagePort` in another worker.
|
|
58
|
-
*/
|
|
59
|
-
constructor(port) {
|
|
60
|
-
var _a;
|
|
61
|
-
super();
|
|
62
|
-
this.port = port;
|
|
63
|
-
const buffer = (_a = (0, worker_threads_1.receiveMessageOnPort)(this.port)) === null || _a === void 0 ? void 0 : _a.message;
|
|
64
|
-
if (!buffer) {
|
|
65
|
-
throw new Error('new SyncMessagePort() must be passed a port from ' +
|
|
66
|
-
'SyncMessagePort.createChannel().');
|
|
67
|
-
}
|
|
68
|
-
this.buffer = new Int32Array(buffer);
|
|
69
|
-
this.on('newListener', (event, listener) => {
|
|
70
|
-
this.port.on(event, listener);
|
|
71
|
-
});
|
|
72
|
-
this.on('removeListener', (event, listener) => this.port.removeListener(event, listener));
|
|
73
|
-
}
|
|
74
|
-
/** See `MessagePort.postMesage()`. */
|
|
75
|
-
postMessage(value, transferList) {
|
|
76
|
-
this.port.postMessage(value, transferList);
|
|
77
|
-
// If the other port is waiting for a new message, notify it that the
|
|
78
|
-
// message is ready. Use `Atomics.compareExchange` so that we don't
|
|
79
|
-
// overwrite the "closed" state.
|
|
80
|
-
if (Atomics.compareExchange(this.buffer, 0, BufferState.AwaitingMessage, BufferState.MessageSent) === BufferState.AwaitingMessage) {
|
|
81
|
-
Atomics.notify(this.buffer, 0);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
// TODO(nex3):
|
|
85
|
-
// * Add a non-blocking `receiveMessage()`
|
|
86
|
-
// * Add a timeout option to `receiveMessage()`
|
|
87
|
-
// * Add an option to `receiveMessage()` to return a special value if the
|
|
88
|
-
// channel is closed.
|
|
89
|
-
/**
|
|
90
|
-
* Blocks and returns the next message sent by the other port.
|
|
91
|
-
*
|
|
92
|
-
* This may not be called while this has a listener for the `'message'` event.
|
|
93
|
-
* Throws an error if the channel is closed, including if it closes while this
|
|
94
|
-
* is waiting for a message.
|
|
95
|
-
*/
|
|
96
|
-
receiveMessage() {
|
|
97
|
-
if (this.listenerCount('message')) {
|
|
98
|
-
throw new Error('SyncMessageChannel.receiveMessage() may not be called while there ' +
|
|
99
|
-
'are message listeners.');
|
|
100
|
-
}
|
|
101
|
-
// Set the "new message" indicator to zero before we check for new messages.
|
|
102
|
-
// That way if the other port sets it to 1 between the call to
|
|
103
|
-
// `receiveMessageOnPort` and the call to `Atomics.wait()`, we won't
|
|
104
|
-
// overwrite it. Use `Atomics.compareExchange` so that we don't overwrite
|
|
105
|
-
// the "closed" state.
|
|
106
|
-
if (Atomics.compareExchange(this.buffer, 0, BufferState.MessageSent, BufferState.AwaitingMessage) === BufferState.Closed) {
|
|
107
|
-
throw new Error("The SyncMessagePort's channel is closed.");
|
|
108
|
-
}
|
|
109
|
-
let message = (0, worker_threads_1.receiveMessageOnPort)(this.port);
|
|
110
|
-
if (message)
|
|
111
|
-
return message.message;
|
|
112
|
-
// If there's no new message, wait for the other port to flip the "new
|
|
113
|
-
// message" indicator to 1. If it's been set to 1 since we stored 0, this
|
|
114
|
-
// will terminate immediately.
|
|
115
|
-
Atomics.wait(this.buffer, 0, BufferState.AwaitingMessage);
|
|
116
|
-
message = (0, worker_threads_1.receiveMessageOnPort)(this.port);
|
|
117
|
-
if (message)
|
|
118
|
-
return message.message;
|
|
119
|
-
// Update the state to 0b10 after the last message is consumed.
|
|
120
|
-
const oldState = Atomics.and(this.buffer, 0, BufferState.Closed);
|
|
121
|
-
// Assert the old state was either 0b10 or 0b11.
|
|
122
|
-
assert_1.strict.equal(oldState & BufferState.Closed, BufferState.Closed);
|
|
123
|
-
throw new Error("The SyncMessagePort's channel is closed.");
|
|
124
|
-
}
|
|
125
|
-
/** See `MessagePort.close()`. */
|
|
126
|
-
close() {
|
|
127
|
-
Atomics.or(this.buffer, 0, BufferState.Closed);
|
|
128
|
-
this.port.close();
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
exports.SyncMessagePort = SyncMessagePort;
|
|
132
|
-
//# sourceMappingURL=sync-message-port.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sync-message-port.js","sourceRoot":"","sources":["../../../../lib/src/sync-process/sync-message-port.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,mCAAwC;AACxC,mCAAoC;AACpC,mDAKwB;AAExB,yCAAyC;AAEzC;;;GAGG;AACH,IAAK,WAmBJ;AAnBD,WAAK,WAAW;IACd;;;;OAIG;IACH,mEAAsB,CAAA;IACtB;;;;OAIG;IACH,2DAAkB,CAAA;IAClB;;;;OAIG;IACH,iDAAa,CAAA;AACf,CAAC,EAnBI,WAAW,KAAX,WAAW,QAmBf;AAED;;;;;GAKG;AACH,MAAa,eAAgB,SAAQ,qBAAY;IAC/C,8EAA8E;IAC9E,MAAM,CAAC,aAAa;QAClB,MAAM,OAAO,GAAG,IAAI,+BAAc,EAAE,CAAC;QACrC,+DAA+D;QAC/D,MAAM,MA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K,CAAC,QAAQ,GAAG,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;QAChE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IAED,iCAAiC;IACjC,KAAK;QACH,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;QAC/C,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC;CACF;AA/HD,0CA+HC"}
|
|
@@ -1,51 +0,0 @@
|
|
|
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
|
-
const worker_threads_1 = require("worker_threads");
|
|
7
|
-
const child_process_1 = require("child_process");
|
|
8
|
-
const assert_1 = require("assert");
|
|
9
|
-
const sync_message_port_1 = require("./sync-message-port");
|
|
10
|
-
const port = new sync_message_port_1.SyncMessagePort(worker_threads_1.workerData.port);
|
|
11
|
-
/** A more type-safe way to call `port.postMesage()` */
|
|
12
|
-
function emit(event, transferList) {
|
|
13
|
-
port.postMessage(event, transferList);
|
|
14
|
-
}
|
|
15
|
-
const process = (0, child_process_1.spawn)(worker_threads_1.workerData.command, worker_threads_1.workerData.args, worker_threads_1.workerData.options);
|
|
16
|
-
port.on('message', message => {
|
|
17
|
-
if (message.type === 'stdin') {
|
|
18
|
-
process.stdin.write(message.data);
|
|
19
|
-
}
|
|
20
|
-
else if (message.type === 'stdinClosed') {
|
|
21
|
-
process.stdin.end();
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
assert_1.strict.equal(message.type, 'kill');
|
|
25
|
-
process.kill(message.signal);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
process.stdout.on('data', data => {
|
|
29
|
-
emit({ type: 'stdout', data }, [data.buffer]);
|
|
30
|
-
});
|
|
31
|
-
process.stderr.on('data', data => {
|
|
32
|
-
emit({ type: 'stderr', data }, [data.buffer]);
|
|
33
|
-
});
|
|
34
|
-
process.on('error', error => {
|
|
35
|
-
emit({ type: 'error', error });
|
|
36
|
-
process.kill();
|
|
37
|
-
worker_threads_1.parentPort.close();
|
|
38
|
-
port.close();
|
|
39
|
-
});
|
|
40
|
-
process.on('exit', (code, signal) => {
|
|
41
|
-
if (code !== null) {
|
|
42
|
-
emit({ type: 'exit', code });
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
(0, assert_1.strict)(signal);
|
|
46
|
-
emit({ type: 'exit', signal });
|
|
47
|
-
}
|
|
48
|
-
worker_threads_1.parentPort.close();
|
|
49
|
-
port.close();
|
|
50
|
-
});
|
|
51
|
-
//# sourceMappingURL=worker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../../lib/src/sync-process/worker.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;AAEvC,mDAKwB;AACxB,iDAA8D;AAC9D,mCAAwC;AAExC,2DAAoD;AAGpD,MAAM,IAAI,GAAG,IAAI,mCAAe,CAAC,2BAAU,CAAC,IAAmB,CAAC,CAAC;AAEjE,uDAAuD;AACvD,SAAS,IAAI,CAAC,KAAoB,EAAE,YAAiC;IACnE,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,OAAO,GAAG,IAAA,qBAAK,EACnB,2BAAU,CAAC,OAAiB,EAC5B,2BAAU,CAAC,IAAgB,EAC3B,2BAAU,CAAC,OAA+C,CAC3D,CAAC;AAEF,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE;IAC3B,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC7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