sass-embedded 1.0.0-beta.4 → 1.0.0-rc.1
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 +40 -0
- package/dist/.gitignore +1 -0
- package/dist/lib/index.js +40 -11
- 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/importer.js +186 -0
- package/dist/lib/src/legacy/importer.js.map +1 -0
- package/dist/lib/src/legacy/index.js +261 -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} +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 +96 -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 +22 -5
- package/dist/lib/src/value/boolean.js.map +1 -1
- 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 -14
- 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 +16 -3
- package/dist/lib/src/value/null.js.map +1 -1
- package/dist/lib/src/value/number.js +41 -46
- package/dist/lib/src/value/number.js.map +1 -1
- package/dist/lib/src/value/string.js +18 -12
- package/dist/lib/src/value/string.js.map +1 -1
- package/dist/lib/src/value/utils.js +27 -2
- package/dist/lib/src/value/utils.js.map +1 -1
- package/dist/lib/src/vendor/embedded-protocol/embedded_sass_pb.js +1395 -101
- package/dist/lib/src/vendor/embedded-protocol/embedded_sass_pb.js.map +1 -1
- package/dist/package.json +23 -20
- package/dist/tool/utils.js +50 -18
- 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 +23 -20
- package/dist/lib/index.d.ts +0 -7
- 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 -12
- package/dist/lib/src/value/boolean.d.ts +0 -25
- 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 -36
- package/dist/lib/src/value/value.d.ts +0 -103
- 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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync-compiler.js","sourceRoot":"","sources":["../../../lib/src/s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021 Google LLC. Use of this source code is governed by an
|
|
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
|
-
//# sourceMappingURL=
|
|
6
|
+
//# sourceMappingURL=event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event.js","sourceRoot":"","sources":["../../../../lib/src/sync-process/event.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
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.SyncProcess = void 0;
|
|
7
|
+
const fs = require("fs");
|
|
8
|
+
const p = require("path");
|
|
9
|
+
const stream = require("stream");
|
|
10
|
+
const worker_threads_1 = require("worker_threads");
|
|
11
|
+
const sync_message_port_1 = require("./sync-message-port");
|
|
12
|
+
// TODO(nex3): Factor this out into its own package.
|
|
13
|
+
/**
|
|
14
|
+
* A child process that runs synchronously while also allowing the user to
|
|
15
|
+
* interact with it before it shuts down.
|
|
16
|
+
*/
|
|
17
|
+
class SyncProcess {
|
|
18
|
+
constructor(command, argsOrOptions, options) {
|
|
19
|
+
let args;
|
|
20
|
+
if (Array.isArray(argsOrOptions)) {
|
|
21
|
+
args = argsOrOptions;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
args = [];
|
|
25
|
+
options = argsOrOptions;
|
|
26
|
+
}
|
|
27
|
+
const { port1, port2 } = sync_message_port_1.SyncMessagePort.createChannel();
|
|
28
|
+
this.port = new sync_message_port_1.SyncMessagePort(port1);
|
|
29
|
+
this.worker = spawnWorker(p.join(p.dirname(__filename), 'worker'), {
|
|
30
|
+
workerData: { port: port2, command, args, options },
|
|
31
|
+
transferList: [port2],
|
|
32
|
+
});
|
|
33
|
+
// The worker shouldn't emit any errors unless it breaks in development.
|
|
34
|
+
this.worker.on('error', console.error);
|
|
35
|
+
this.stdin = new stream.Writable({
|
|
36
|
+
write: (chunk, encoding, callback) => {
|
|
37
|
+
this.port.postMessage({
|
|
38
|
+
type: 'stdin',
|
|
39
|
+
data: chunk,
|
|
40
|
+
}, [chunk.buffer]);
|
|
41
|
+
callback();
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
// Unfortunately, there's no built-in event or callback that will reliably
|
|
45
|
+
// *synchronously* notify us that the stdin stream has been closed. (The
|
|
46
|
+
// `final` callback works in Node v16 but not v14.) Instead, we wrap the
|
|
47
|
+
// methods themselves that are used to close the stream.
|
|
48
|
+
const oldEnd = this.stdin.end.bind(this.stdin);
|
|
49
|
+
this.stdin.end = ((a1, a2, a3) => {
|
|
50
|
+
oldEnd(a1, a2, a3);
|
|
51
|
+
this.port.postMessage({ type: 'stdinClosed' });
|
|
52
|
+
});
|
|
53
|
+
const oldDestroy = this.stdin.destroy.bind(this.stdin);
|
|
54
|
+
this.stdin.destroy = ((a1) => {
|
|
55
|
+
oldDestroy(a1);
|
|
56
|
+
this.port.postMessage({ type: 'stdinClosed' });
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Blocks until the child process is ready to emit another event, then returns
|
|
61
|
+
* that event.
|
|
62
|
+
*
|
|
63
|
+
* If there's an error running the child process, this will throw that error.
|
|
64
|
+
* This may not be called after it emits an `ExitEvent` or throws an error.
|
|
65
|
+
*/
|
|
66
|
+
yield() {
|
|
67
|
+
if (this.stdin.destroyed) {
|
|
68
|
+
throw new Error("Can't call SyncProcess.yield() after the process has exited.");
|
|
69
|
+
}
|
|
70
|
+
const message = this.port.receiveMessage();
|
|
71
|
+
switch (message.type) {
|
|
72
|
+
case 'stdout':
|
|
73
|
+
return { type: 'stdout', data: Buffer.from(message.data.buffer) };
|
|
74
|
+
case 'stderr':
|
|
75
|
+
return { type: 'stderr', data: Buffer.from(message.data.buffer) };
|
|
76
|
+
case 'error':
|
|
77
|
+
this.close();
|
|
78
|
+
throw message.error;
|
|
79
|
+
case 'exit':
|
|
80
|
+
this.close();
|
|
81
|
+
return message;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// TODO(nex3): Add a non-blocking `yieldIfReady()` function that returns
|
|
85
|
+
// `null` if the worker hasn't queued up an event.
|
|
86
|
+
// TODO(nex3): Add a `yieldAsync()` function that returns a `Promise<Event>`.
|
|
87
|
+
/**
|
|
88
|
+
* Sends a signal (`SIGTERM` by default) to the child process.
|
|
89
|
+
*
|
|
90
|
+
* This has no effect if the process has already exited.
|
|
91
|
+
*/
|
|
92
|
+
kill(signal) {
|
|
93
|
+
this.port.postMessage({ type: 'kill', signal });
|
|
94
|
+
}
|
|
95
|
+
/** Closes down the worker thread and the stdin stream. */
|
|
96
|
+
close() {
|
|
97
|
+
this.port.close();
|
|
98
|
+
this.worker.terminate();
|
|
99
|
+
this.stdin.destroy();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.SyncProcess = SyncProcess;
|
|
103
|
+
/**
|
|
104
|
+
* Spawns a worker for the given `fileWithoutExtension` in either a JS or TS
|
|
105
|
+
* worker, depending on which file exists.
|
|
106
|
+
*/
|
|
107
|
+
function spawnWorker(fileWithoutExtension, options) {
|
|
108
|
+
// The released version always spawns the JS worker. The TS worker is only
|
|
109
|
+
// used for development.
|
|
110
|
+
const jsFile = fileWithoutExtension + '.js';
|
|
111
|
+
if (fs.existsSync(jsFile))
|
|
112
|
+
return new worker_threads_1.Worker(jsFile, options);
|
|
113
|
+
const tsFile = fileWithoutExtension + '.ts';
|
|
114
|
+
if (fs.existsSync(tsFile)) {
|
|
115
|
+
return new worker_threads_1.Worker(`
|
|
116
|
+
require('ts-node').register();
|
|
117
|
+
require(${JSON.stringify(tsFile)});
|
|
118
|
+
`, { ...options, eval: true });
|
|
119
|
+
}
|
|
120
|
+
throw new Error(`Neither "${jsFile}" nor ".ts" exists.`);
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/src/sync-process/index.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,yBAAyB;AACzB,0BAA0B;AAC1B,iCAAiC;AACjC,mDAAqD;AAErD,2DAAoD;AAKpD,oDAAoD;AAEpD;;;GAGG;AACH,MAAa,WAAW;IActB,YACE,OAAe,EACf,aAAkC,EAClC,OAAiB;QAEjB,IAAI,IAAc,CAAC;QACnB,IAAI,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;YAChC,IAAI,GAAG,aAAa,CAAC;SACtB;aAAM;YACL,IAAI,GAAG,EAAE,CAAC;YACV,OAAO,GAAG,aAAa,CAAC;SACzB;QAED,MAAM,EAAC,KAAK,EAAE,KAAK,EAAC,GAAG,mCAAe,CAAC,aAAa,EAAE,CAAC;QACvD,IAAI,CAAC,IAAI,GAAG,IAAI,mCAAe,CAAC,KAAK,CAAC,CAAC;QAEvC,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,EAAE;YACjE,UAAU,EAAE,EAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAC;YACjD,YAAY,EAAE,CAAC,KAAK,CAAC;SACtB,CAAC,CAAC;QAEH,wEAAwE;QACxE,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QAEvC,IAAI,CAAC,KAAK,GAAG,IAAI,MAAM,CAAC,QAAQ,CAAC;YAC/B,KAAK,EAAE,CAAC,KAA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AE;QACzB,OAAO,IAAI,uBAAM,CACf;;kBAEY,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;OACjC,EACD,EAAC,GAAG,OAAO,EAAE,IAAI,EAAE,IAAI,EAAC,CACzB,CAAC;KACH;IAED,MAAM,IAAI,KAAK,CAAC,YAAY,MAAM,qBAAqB,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
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 state indicating that the channel has been closed. This never
|
|
31
|
+
* transitions to any other states.
|
|
32
|
+
*/
|
|
33
|
+
BufferState[BufferState["Closed"] = 2] = "Closed";
|
|
34
|
+
})(BufferState || (BufferState = {}));
|
|
35
|
+
/**
|
|
36
|
+
* A communication port that can receive messages synchronously from another
|
|
37
|
+
* `SyncMessagePort`.
|
|
38
|
+
*
|
|
39
|
+
* This also emits the same asynchronous events as `MessagePort`.
|
|
40
|
+
*/
|
|
41
|
+
class SyncMessagePort extends events_1.EventEmitter {
|
|
42
|
+
/**
|
|
43
|
+
* Creates a new message port. The `port` must be created by
|
|
44
|
+
* `SyncMessagePort.createChannel()` and must connect to a port passed to
|
|
45
|
+
* another `SyncMessagePort` in another worker.
|
|
46
|
+
*/
|
|
47
|
+
constructor(port) {
|
|
48
|
+
var _a;
|
|
49
|
+
super();
|
|
50
|
+
this.port = port;
|
|
51
|
+
const buffer = (_a = (0, worker_threads_1.receiveMessageOnPort)(this.port)) === null || _a === void 0 ? void 0 : _a.message;
|
|
52
|
+
if (!buffer) {
|
|
53
|
+
throw new Error('new SyncMessagePort() must be passed a port from ' +
|
|
54
|
+
'SyncMessagePort.createChannel().');
|
|
55
|
+
}
|
|
56
|
+
this.buffer = new Int32Array(buffer);
|
|
57
|
+
this.on('newListener', (event, listener) => {
|
|
58
|
+
this.port.on(event, listener);
|
|
59
|
+
});
|
|
60
|
+
this.on('removeListener', (event, listener) => this.port.removeListener(event, listener));
|
|
61
|
+
}
|
|
62
|
+
/** Creates a channel whose ports can be passed to `new SyncMessagePort()`. */
|
|
63
|
+
static createChannel() {
|
|
64
|
+
const channel = new worker_threads_1.MessageChannel();
|
|
65
|
+
// Four bytes is the minimum necessary to use `Atomics.wait()`.
|
|
66
|
+
const buffer = new SharedArrayBuffer(4);
|
|
67
|
+
// Queue up messages on each port so the caller doesn't have to explicitly
|
|
68
|
+
// pass the buffer around along with them.
|
|
69
|
+
channel.port1.postMessage(buffer);
|
|
70
|
+
channel.port2.postMessage(buffer);
|
|
71
|
+
return channel;
|
|
72
|
+
}
|
|
73
|
+
/** See `MessagePort.postMesage()`. */
|
|
74
|
+
postMessage(value, transferList) {
|
|
75
|
+
this.port.postMessage(value, transferList);
|
|
76
|
+
// If the other port is waiting for a new message, notify it that the
|
|
77
|
+
// message is ready. Use `Atomics.compareExchange` so that we don't
|
|
78
|
+
// overwrite the "closed" state.
|
|
79
|
+
if (Atomics.compareExchange(this.buffer, 0, BufferState.AwaitingMessage, BufferState.MessageSent) === BufferState.AwaitingMessage) {
|
|
80
|
+
Atomics.notify(this.buffer, 0);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// TODO(nex3):
|
|
84
|
+
// * Add a non-blocking `receiveMessage()`
|
|
85
|
+
// * Add a timeout option to `receiveMessage()`
|
|
86
|
+
// * Add an option to `receiveMessage()` to return a special value if the
|
|
87
|
+
// channel is closed.
|
|
88
|
+
/**
|
|
89
|
+
* Blocks and returns the next message sent by the other port.
|
|
90
|
+
*
|
|
91
|
+
* This may not be called while this has a listener for the `'message'` event.
|
|
92
|
+
* Throws an error if the channel is closed, including if it closes while this
|
|
93
|
+
* is waiting for a message.
|
|
94
|
+
*/
|
|
95
|
+
receiveMessage() {
|
|
96
|
+
if (this.listenerCount('message')) {
|
|
97
|
+
throw new Error('SyncMessageChannel.receiveMessage() may not be called while there ' +
|
|
98
|
+
'are message listeners.');
|
|
99
|
+
}
|
|
100
|
+
// Set the "new message" indicator to zero before we check for new messages.
|
|
101
|
+
// That way if the other port sets it to 1 between the call to
|
|
102
|
+
// `receiveMessageOnPort` and the call to `Atomics.wait()`, we won't
|
|
103
|
+
// overwrite it. Use `Atomics.compareExchange` so that we don't overwrite
|
|
104
|
+
// the "closed" state.
|
|
105
|
+
if (Atomics.compareExchange(this.buffer, 0, BufferState.MessageSent, BufferState.AwaitingMessage) === BufferState.Closed) {
|
|
106
|
+
throw new Error("The SyncMessagePort's channel is closed.");
|
|
107
|
+
}
|
|
108
|
+
let message = (0, worker_threads_1.receiveMessageOnPort)(this.port);
|
|
109
|
+
if (message)
|
|
110
|
+
return message.message;
|
|
111
|
+
// If there's no new message, wait for the other port to flip the "new
|
|
112
|
+
// message" indicator to 1. If it's been set to 1 since we stored 0, this
|
|
113
|
+
// will terminate immediately.
|
|
114
|
+
Atomics.wait(this.buffer, 0, BufferState.AwaitingMessage);
|
|
115
|
+
message = (0, worker_threads_1.receiveMessageOnPort)(this.port);
|
|
116
|
+
if (message)
|
|
117
|
+
return message.message;
|
|
118
|
+
assert_1.strict.equal(Atomics.load(this.buffer, 0), BufferState.Closed);
|
|
119
|
+
throw new Error("The SyncMessagePort's channel is closed.");
|
|
120
|
+
}
|
|
121
|
+
/** See `MessagePort.close()`. */
|
|
122
|
+
close() {
|
|
123
|
+
Atomics.store(this.buffer, 0, BufferState.Closed);
|
|
124
|
+
this.port.close();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.SyncMessagePort = SyncMessagePort;
|
|
128
|
+
//# sourceMappingURL=sync-message-port.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,WAkBJ;AAlBD,WAAK,WAAW;IACd;;;;OAIG;IACH,mEAAe,CAAA;IACf;;;;OAIG;IACH,2DAAW,CAAA;IACX;;;OAGG;IACH,iDAAM,CAAA;AACR,CAAC,EAlBI,WAAW,KAAX,WAAW,QAkBf;AAED;;;;;GAKG;AACH,MAAa,eAAgB,SAAQ,qBAAY;IAwB/C;;;;OAIG;IACH,YAA6B,IAAiB;;QAC5C,KAAK,EAAE,CAAC;QADmB,SAAI,GAAJ,IAAI,CAAa;QAG5C,MAAM,MAAM,GAAG,MAAA,IAAA,qCAAoB,EAAC,IAAI,CAAC,IAAI,CAAC,0CAAE,OAAO,CAAC;QACxD,IAAI,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AM,CAAC,CAAC;QAClD,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC;CACF;AA5HD,0CA4HC"}
|
|
@@ -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
|
+
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
|
|
@@ -0,0 +1 @@
|
|
|
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;QAC5B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,IAAc,CAAC,CAAC;KAC7C;SAAM,IAAI,OAAO,CAAC,IAAI,KAAK,aAAa,EAAE;QACzC,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;KACrB;SAAM;QACL,eAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CA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+3,37 @@
|
|
|
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.putIfAbsent = exports.protofySyntax = exports.withoutExtension = exports.fileUrlToPathCrossPlatform = exports.pathToUrlString = exports.valueError = exports.hostError = exports.mandatoryError = exports.compilerError = exports.asImmutableList = exports.isNullOrUndefined = exports.catchOr = exports.thenOr = void 0;
|
|
6
7
|
const immutable_1 = require("immutable");
|
|
8
|
+
const p = require("path");
|
|
9
|
+
const url = require("url");
|
|
10
|
+
const proto = require("./vendor/embedded-protocol/embedded_sass_pb");
|
|
11
|
+
/**
|
|
12
|
+
* The equivalent of `Promise.then()`, except that if the first argument is a
|
|
13
|
+
* plain value it synchronously invokes `callback()` and returns its result.
|
|
14
|
+
*/
|
|
15
|
+
function thenOr(promiseOrValue, callback) {
|
|
16
|
+
return promiseOrValue instanceof Promise
|
|
17
|
+
? promiseOrValue.then(callback)
|
|
18
|
+
: callback(promiseOrValue);
|
|
19
|
+
}
|
|
20
|
+
exports.thenOr = thenOr;
|
|
21
|
+
/**
|
|
22
|
+
* The equivalent of `Promise.catch()`, except that if the first argument throws
|
|
23
|
+
* synchronously it synchronously invokes `callback()` and returns its result.
|
|
24
|
+
*/
|
|
25
|
+
function catchOr(promiseOrValueCallback, callback) {
|
|
26
|
+
try {
|
|
27
|
+
const result = promiseOrValueCallback();
|
|
28
|
+
return result instanceof Promise
|
|
29
|
+
? result.catch(callback)
|
|
30
|
+
: result;
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
return callback(error);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.catchOr = catchOr;
|
|
7
37
|
/** Checks for null or undefined. */
|
|
8
38
|
function isNullOrUndefined(object) {
|
|
9
39
|
return object === null || object === undefined;
|
|
@@ -11,7 +41,7 @@ function isNullOrUndefined(object) {
|
|
|
11
41
|
exports.isNullOrUndefined = isNullOrUndefined;
|
|
12
42
|
/** Returns `collection` as an immutable List. */
|
|
13
43
|
function asImmutableList(collection) {
|
|
14
|
-
return immutable_1.List.isList(collection) ? collection : immutable_1.List(collection);
|
|
44
|
+
return immutable_1.List.isList(collection) ? collection : (0, immutable_1.List)(collection);
|
|
15
45
|
}
|
|
16
46
|
exports.asImmutableList = asImmutableList;
|
|
17
47
|
/** Constructs a compiler-caused Error. */
|
|
@@ -19,6 +49,14 @@ function compilerError(message) {
|
|
|
19
49
|
return Error(`Compiler caused error: ${message}.`);
|
|
20
50
|
}
|
|
21
51
|
exports.compilerError = compilerError;
|
|
52
|
+
/**
|
|
53
|
+
* Returns a `compilerError()` indicating that the given `field` should have
|
|
54
|
+
* been included but was not.
|
|
55
|
+
*/
|
|
56
|
+
function mandatoryError(field) {
|
|
57
|
+
return compilerError(`Missing mandatory field ${field}`);
|
|
58
|
+
}
|
|
59
|
+
exports.mandatoryError = mandatoryError;
|
|
22
60
|
/** Constructs a host-caused Error. */
|
|
23
61
|
function hostError(message) {
|
|
24
62
|
return Error(`Compiler reported error: ${message}.`);
|
|
@@ -29,4 +67,61 @@ function valueError(message, name) {
|
|
|
29
67
|
return Error(name ? `$${name}: ${message}.` : `${message}.`);
|
|
30
68
|
}
|
|
31
69
|
exports.valueError = valueError;
|
|
70
|
+
/** Converts a (possibly relative) path on the local filesystem to a URL. */
|
|
71
|
+
function pathToUrlString(path) {
|
|
72
|
+
if (p.isAbsolute(path))
|
|
73
|
+
return url.pathToFileURL(path).toString();
|
|
74
|
+
const components = p.sep === '\\' ? path.split(/[/\\]/) : path.split('/');
|
|
75
|
+
return components.map(encodeURIComponent).join('/');
|
|
76
|
+
}
|
|
77
|
+
exports.pathToUrlString = pathToUrlString;
|
|
78
|
+
/**
|
|
79
|
+
* Like `url.fileURLToPath`, but returns the same result for Windows-style file
|
|
80
|
+
* URLs on all platforms.
|
|
81
|
+
*/
|
|
82
|
+
function fileUrlToPathCrossPlatform(fileUrl) {
|
|
83
|
+
const path = url.fileURLToPath(fileUrl);
|
|
84
|
+
// Windows file: URLs begin with `file:///C:/` (or another drive letter),
|
|
85
|
+
// which `fileURLToPath` converts to `"/C:/"` on non-Windows systems. We want
|
|
86
|
+
// to ensure the behavior is consistent across OSes, so we normalize this back
|
|
87
|
+
// to a Windows-style path.
|
|
88
|
+
return /^\/[A-Za-z]:\//.test(path) ? path.substring(1) : path;
|
|
89
|
+
}
|
|
90
|
+
exports.fileUrlToPathCrossPlatform = fileUrlToPathCrossPlatform;
|
|
91
|
+
/** Returns `path` without an extension, if it had one. */
|
|
92
|
+
function withoutExtension(path) {
|
|
93
|
+
const extension = p.extname(path);
|
|
94
|
+
return path.substring(0, path.length - extension.length);
|
|
95
|
+
}
|
|
96
|
+
exports.withoutExtension = withoutExtension;
|
|
97
|
+
/** Converts a JS syntax string into a protobuf syntax enum. */
|
|
98
|
+
function protofySyntax(syntax) {
|
|
99
|
+
switch (syntax) {
|
|
100
|
+
case 'scss':
|
|
101
|
+
return proto.Syntax.SCSS;
|
|
102
|
+
case 'indented':
|
|
103
|
+
return proto.Syntax.INDENTED;
|
|
104
|
+
case 'css':
|
|
105
|
+
return proto.Syntax.CSS;
|
|
106
|
+
default:
|
|
107
|
+
throw new Error(`Unknown syntax: "${syntax}"`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
exports.protofySyntax = protofySyntax;
|
|
111
|
+
/**
|
|
112
|
+
* Dart-style utility. See
|
|
113
|
+
* http://go/dart-api/stable/2.8.4/dart-core/Map/putIfAbsent.html.
|
|
114
|
+
*/
|
|
115
|
+
function putIfAbsent(map, key, provider) {
|
|
116
|
+
const val = map.get(key);
|
|
117
|
+
if (val !== undefined) {
|
|
118
|
+
return val;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
const newVal = provider();
|
|
122
|
+
map.set(key, newVal);
|
|
123
|
+
return newVal;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
exports.putIfAbsent = putIfAbsent;
|
|
32
127
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../lib/src/utils.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../lib/src/utils.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,yCAA+B;AAC/B,0BAA0B;AAC1B,2BAA2B;AAE3B,qEAAqE;AAcrE;;;GAGG;AACH,SAAgB,MAAM,CACpB,cAAkC,EAClC,QAA0C;IAE1C,OAAO,cAAc,YAAY,OAAO;QACtC,CAAC,CAAE,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAwB;QACvD,CAAC,CAAC,QAAQ,CAAC,cAAmB,CAAC,CAAC;AACpC,CAAC;AAPD,wBAOC;AAED;;;GAGG;AACH,SAAgB,OAAO,CACrB,sBAAgD,EAChD,QAAgD;IAEhD,IAAI;QACF,MAAM,MAAM,GAAG,sBAAsB,EAAE,CAAC;QACxC,OAAO,MAAM,YAAY,OAAO;YAC9B,CAAC,CAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAwB;YAChD,CAAC,CAAC,MAAM,CAAC;KACZ;IAAC,OAAO,KAAc,EAAE;QACvB,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;KACxB;AACH,CAAC;AAZD,0BAYC;AAED,oCAAoC;AACpC,SAAgB,iBAAiB,CAC/B,MAA4B;IAE5B,OAAO,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS,CAAC;AACjD,CAAC;AAJD,8CAIC;AAED,iDAAiD;AACjD,SAAgB,eAAe,CAAI,UAAyB;IAC1D,OAAO,gBAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,gBAAI,EAAC,UAA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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.SassArgumentList = void 0;
|
|
7
|
+
const immutable_1 = require("immutable");
|
|
8
|
+
const list_1 = require("./list");
|
|
9
|
+
class SassArgumentList extends list_1.SassList {
|
|
10
|
+
constructor(contents, keywords, separator, id) {
|
|
11
|
+
super(contents, { separator });
|
|
12
|
+
/**
|
|
13
|
+
* Whether the `keywords` getter has been accessed.
|
|
14
|
+
*
|
|
15
|
+
* This is marked as public so that the protofier can access it, but it's not
|
|
16
|
+
* part of the package's public API and should not be accessed by user code.
|
|
17
|
+
* It may be renamed or removed without warning in the future.
|
|
18
|
+
*/
|
|
19
|
+
this.keywordsAccessed = false;
|
|
20
|
+
this.keywordsInternal = (0, immutable_1.isOrderedMap)(keywords)
|
|
21
|
+
? keywords
|
|
22
|
+
: (0, immutable_1.OrderedMap)(keywords);
|
|
23
|
+
this.id = id !== null && id !== void 0 ? id : 0;
|
|
24
|
+
}
|
|
25
|
+
get keywords() {
|
|
26
|
+
this.keywordsAccessed = true;
|
|
27
|
+
return this.keywordsInternal;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.SassArgumentList = SassArgumentList;
|
|
31
|
+
//# sourceMappingURL=argument-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"argument-list.js","sourceRoot":"","sources":["../../../../lib/src/value/argument-list.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,yCAAyD;AAEzD,iCAA+C;AAG/C,MAAa,gBAAiB,SAAQ,eAAQ;IAsC5C,YACE,QAA+B,EAC/B,QAA2D,EAC3D,SAAyB,EACzB,EAAW;QAEX,KAAK,CAAC,QAAQ,EAAE,EAAC,SAAS,EAAC,CAAC,CAAC;QApB/B;;;;;;WAMG;QACH,qBAAgB,GAAG,KAAK,CAAC;QAcvB,IAAI,CAAC,gBAAgB,GAAG,IAAA,wBAAY,EAAC,QAAQ,CAAC;YAC5C,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,IAAA,sBAAU,EAAC,QAAQ,CAAC,CAAC;QACzB,IAAI,CAAC,EAAE,GAAG,EAAE,aAAF,EAAE,cAAF,EAAE,GAAI,CAAC,CAAC;IACpB,CAAC;IAhBD,IAAI,QAAQ;QACV,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC7B,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;CAcF;AAlDD,4CAkDC"}
|
|
@@ -3,14 +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.sassFalse = exports.sassTrue = exports.SassBooleanInternal = void 0;
|
|
6
7
|
const immutable_1 = require("immutable");
|
|
7
|
-
const
|
|
8
|
-
const trueHash = immutable_1.hash(true);
|
|
9
|
-
const falseHash = immutable_1.hash(false);
|
|
10
|
-
class SassBooleanInternal extends
|
|
8
|
+
const index_1 = require("./index");
|
|
9
|
+
const trueHash = (0, immutable_1.hash)(true);
|
|
10
|
+
const falseHash = (0, immutable_1.hash)(false);
|
|
11
|
+
class SassBooleanInternal extends index_1.Value {
|
|
11
12
|
constructor(valueInternal) {
|
|
12
13
|
super();
|
|
13
14
|
this.valueInternal = valueInternal;
|
|
15
|
+
if (!SassBooleanInternal.constructionAllowed) {
|
|
16
|
+
throw ("new sass.types.Boolean() isn't allowed.\n" +
|
|
17
|
+
'Use sass.types.Boolean.TRUE or sass.types.Boolean.FALSE instead.');
|
|
18
|
+
}
|
|
14
19
|
Object.freeze(this);
|
|
15
20
|
}
|
|
16
21
|
get value() {
|
|
@@ -23,7 +28,7 @@ class SassBooleanInternal extends value_1.Value {
|
|
|
23
28
|
return this;
|
|
24
29
|
}
|
|
25
30
|
equals(other) {
|
|
26
|
-
return
|
|
31
|
+
return this === other;
|
|
27
32
|
}
|
|
28
33
|
hashCode() {
|
|
29
34
|
return this.value ? trueHash : falseHash;
|
|
@@ -31,9 +36,21 @@ class SassBooleanInternal extends value_1.Value {
|
|
|
31
36
|
toString() {
|
|
32
37
|
return this.value ? 'sassTrue' : 'sassFalse';
|
|
33
38
|
}
|
|
39
|
+
getValue() {
|
|
40
|
+
return this.value;
|
|
41
|
+
}
|
|
34
42
|
}
|
|
43
|
+
exports.SassBooleanInternal = SassBooleanInternal;
|
|
44
|
+
// Whether callers are allowed to construct this class. This is set to
|
|
45
|
+
// `false` once the two constants are constructed so that the constructor
|
|
46
|
+
// throws an error for future calls, in accordance with the legacy API.
|
|
47
|
+
SassBooleanInternal.constructionAllowed = true;
|
|
35
48
|
/** The singleton instance of SassScript true. */
|
|
36
49
|
exports.sassTrue = new SassBooleanInternal(true);
|
|
37
50
|
/** The singleton instance of SassScript false. */
|
|
38
51
|
exports.sassFalse = new SassBooleanInternal(false);
|
|
52
|
+
// Legacy API support
|
|
53
|
+
SassBooleanInternal.constructionAllowed = false;
|
|
54
|
+
SassBooleanInternal.TRUE = exports.sassTrue;
|
|
55
|
+
SassBooleanInternal.FALSE = exports.sassFalse;
|
|
39
56
|
//# sourceMappingURL=boolean.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../../../lib/src/value/boolean.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC
|
|
1
|
+
{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../../../lib/src/value/boolean.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,yCAA+B;AAE/B,mCAA8B;AAY9B,MAAM,QAAQ,GAAG,IAAA,gBAAI,EAAC,IAAI,CAAC,CAAC;AAC5B,MAA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