sass-embedded 1.67.0 → 1.69.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/dist/jest.config.js +8 -0
- package/dist/jest.config.js.map +1 -0
- package/dist/lib/index.js +3 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +5 -0
- package/dist/lib/src/importer-registry.js +15 -4
- package/dist/lib/src/importer-registry.js.map +1 -1
- package/dist/lib/src/message-transformer.test.js +81 -0
- package/dist/lib/src/message-transformer.test.js.map +1 -0
- package/dist/lib/src/packet-transformer.test.js +124 -0
- package/dist/lib/src/packet-transformer.test.js.map +1 -0
- package/dist/lib/src/protofier.js +8 -0
- package/dist/lib/src/protofier.js.map +1 -1
- package/dist/lib/src/request-tracker.test.js +71 -0
- package/dist/lib/src/request-tracker.test.js.map +1 -0
- package/dist/lib/src/sync-process/index.js +1 -1
- package/dist/lib/src/sync-process/index.js.map +1 -1
- package/dist/lib/src/sync-process/index.test.js +129 -0
- package/dist/lib/src/sync-process/index.test.js.map +1 -0
- package/dist/lib/src/sync-process/sync-message-port.test.js +125 -0
- package/dist/lib/src/sync-process/sync-message-port.test.js.map +1 -0
- package/dist/lib/src/utils.test.js +32 -0
- package/dist/lib/src/utils.test.js.map +1 -0
- package/dist/lib/src/value/index.js +10 -0
- package/dist/lib/src/value/index.js.map +1 -1
- package/dist/lib/src/value/mixin.js +29 -0
- package/dist/lib/src/value/mixin.js.map +1 -0
- package/dist/lib/src/vendor/embedded_sass_pb.js +79 -18
- package/dist/lib/src/vendor/embedded_sass_pb.js.map +1 -1
- package/dist/package.json +18 -14
- package/dist/test/dependencies.test.js +18 -0
- package/dist/test/dependencies.test.js.map +1 -0
- package/dist/test/sandbox.js +35 -0
- package/dist/test/sandbox.js.map +1 -0
- package/dist/test/utils.js +58 -0
- package/dist/test/utils.js.map +1 -0
- package/dist/tool/get-embedded-compiler.js +1 -1
- package/dist/tool/get-language-repo.js +2 -1
- package/dist/tool/get-language-repo.js.map +1 -1
- package/dist/tool/init.js +1 -1
- package/dist/tool/init.js.map +1 -1
- package/dist/tool/prepare-optional-release.js +1 -1
- package/dist/tool/prepare-optional-release.js.map +1 -1
- package/dist/tool/prepare-release.js +1 -1
- package/dist/tool/prepare-release.js.map +1 -1
- package/dist/tool/utils.js +8 -3
- package/dist/tool/utils.js.map +1 -1
- package/dist/types/importer.d.ts +48 -14
- package/dist/types/index.d.ts +7 -1
- package/dist/types/value/index.d.ts +10 -0
- package/dist/types/value/mixin.d.ts +14 -0
- package/package.json +18 -14
|
@@ -0,0 +1,129 @@
|
|
|
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 fs = require("fs");
|
|
7
|
+
const p = require("path");
|
|
8
|
+
const del = require("del");
|
|
9
|
+
const index_1 = require("./index");
|
|
10
|
+
describe('SyncProcess', () => {
|
|
11
|
+
describe('stdio', () => {
|
|
12
|
+
it('emits stdout', () => {
|
|
13
|
+
withJSProcess('console.log("hello, world!");', node => {
|
|
14
|
+
expectStdout(node.yield(), 'hello, world!\n');
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
it('emits stderr', () => {
|
|
18
|
+
withJSProcess('console.error("hello, world!");', node => {
|
|
19
|
+
expectStderr(node.yield(), 'hello, world!\n');
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
it('receives stdin', () => {
|
|
23
|
+
withJSProcess('process.stdin.on("data", (data) => process.stdout.write(data));', node => {
|
|
24
|
+
node.stdin.write('hi there!\n');
|
|
25
|
+
expectStdout(node.yield(), 'hi there!\n');
|
|
26
|
+
node.stdin.write('fblthp\n');
|
|
27
|
+
expectStdout(node.yield(), 'fblthp\n');
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
it('closes stdin', () => {
|
|
31
|
+
withJSProcess(`
|
|
32
|
+
process.stdin.on("data", () => {});
|
|
33
|
+
process.stdin.on("end", () => console.log("closed!"));
|
|
34
|
+
`, node => {
|
|
35
|
+
node.stdin.end();
|
|
36
|
+
expectStdout(node.yield(), 'closed!\n');
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
describe('emits exit', () => {
|
|
41
|
+
it('with code 0 by default', () => {
|
|
42
|
+
withJSProcess('', node => {
|
|
43
|
+
expectExit(node.yield(), 0);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
it('with a non-0 code', () => {
|
|
47
|
+
withJSProcess('process.exit(123);', node => {
|
|
48
|
+
expectExit(node.yield(), 123);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
it('with a signal code', () => {
|
|
52
|
+
withJSProcess('for (;;) {}', node => {
|
|
53
|
+
node.kill('SIGINT');
|
|
54
|
+
expectExit(node.yield(), 'SIGINT');
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
it('passes options to the subprocess', () => {
|
|
59
|
+
withJSFile('console.log(process.env.SYNC_PROCESS_TEST);', file => {
|
|
60
|
+
const node = new index_1.SyncProcess(process.argv0, [file], {
|
|
61
|
+
env: { ...process.env, SYNC_PROCESS_TEST: 'abcdef' },
|
|
62
|
+
});
|
|
63
|
+
expectStdout(node.yield(), 'abcdef\n');
|
|
64
|
+
node.kill();
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
/** Asserts that `event` is a `StdoutEvent` with text `text`. */
|
|
69
|
+
function expectStdout(event, text) {
|
|
70
|
+
if (event.type === 'stderr') {
|
|
71
|
+
throw `Expected stdout event, was stderr event: ${event.data.toString()}`;
|
|
72
|
+
}
|
|
73
|
+
expect(event.type).toEqual('stdout');
|
|
74
|
+
expect(event.data.toString()).toEqual(text);
|
|
75
|
+
}
|
|
76
|
+
/** Asserts that `event` is a `StderrEvent` with text `text`. */
|
|
77
|
+
function expectStderr(event, text) {
|
|
78
|
+
if (event.type === 'stdout') {
|
|
79
|
+
throw `Expected stderr event, was stdout event: ${event.data.toString()}`;
|
|
80
|
+
}
|
|
81
|
+
expect(event.type).toEqual('stderr');
|
|
82
|
+
expect(event.data.toString()).toEqual(text);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Asserts that `event` is an `ExitEvent` with either the given exit code (if
|
|
86
|
+
* `codeOrSignal` is a number) or signal (if `codeOrSignal` is a string).
|
|
87
|
+
*/
|
|
88
|
+
function expectExit(event, codeOrSignal) {
|
|
89
|
+
if (event.type !== 'exit') {
|
|
90
|
+
throw (`Expected exit event, was ${event.type} event: ` + event.data.toString());
|
|
91
|
+
}
|
|
92
|
+
expect(event).toEqual(typeof codeOrSignal === 'number'
|
|
93
|
+
? { type: 'exit', code: codeOrSignal }
|
|
94
|
+
: { type: 'exit', signal: codeOrSignal });
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Starts a `SyncProcess` running a JS file with the given `contents` and passes
|
|
98
|
+
* it to `callback`.
|
|
99
|
+
*/
|
|
100
|
+
function withJSProcess(contents, callback) {
|
|
101
|
+
return withJSFile(contents, file => {
|
|
102
|
+
const node = new index_1.SyncProcess(process.argv0, [file]);
|
|
103
|
+
try {
|
|
104
|
+
callback(node);
|
|
105
|
+
}
|
|
106
|
+
finally {
|
|
107
|
+
node.kill();
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Creates a JS file with the given `contents` for the duration of `callback`.
|
|
113
|
+
*
|
|
114
|
+
* The `callback` is passed the name of the created file.
|
|
115
|
+
*/
|
|
116
|
+
function withJSFile(contents, callback) {
|
|
117
|
+
const testDir = p.join('spec', 'sandbox', `${Math.random()}`.slice(2));
|
|
118
|
+
fs.mkdirSync(testDir, { recursive: true });
|
|
119
|
+
const file = p.join(testDir, 'script.js');
|
|
120
|
+
fs.writeFileSync(file, contents);
|
|
121
|
+
try {
|
|
122
|
+
callback(file);
|
|
123
|
+
}
|
|
124
|
+
finally {
|
|
125
|
+
// TODO(awjin): Change this to rmSync once we drop support for Node 12.
|
|
126
|
+
del.sync(testDir, { force: true });
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=index.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../../lib/src/sync-process/index.test.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;AAEvC,yBAAyB;AACzB,0BAA0B;AAC1B,2BAA2B;AAE3B,mCAAqE;AAErE,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;QACrB,EAAE,CAAC,cAAc,EAAE,GAAG,EAAE;YACtB,aAAa,CAAC,+BAA+B,EAAE,IAAI,CAAC,EAAE;gBACpD,YAAY,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,iBAAiB,CAAC,CAAC;YAChD,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,cAAc,EAAE,GAAG,EAAE;YACtB,aAAa,CAAC,iCAAiC,EAAE,IAAI,CAAC,EAAE;gBACtD,YAAY,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,iBAAiB,CAAC,CAAC;YAChD,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,gBAAgB,EAAE,GAAG,EAAE;YACxB,aAAa,CACX,iEAAiE,EACjE,IAAI,CAAC,EAAE;gBACL,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;gBAChC,YAAY,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,aAAa,CAAC,CAAC;gBAC1C,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;g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,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAC;KAClC;AACH,CAAC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
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 fs = require("fs");
|
|
7
|
+
const p = require("path");
|
|
8
|
+
const worker_threads_1 = require("worker_threads");
|
|
9
|
+
const sync_message_port_1 = require("./sync-message-port");
|
|
10
|
+
describe('SyncMessagePort', () => {
|
|
11
|
+
describe('sends a message', () => {
|
|
12
|
+
it('before the other endpoint calls receiveMessage()', () => {
|
|
13
|
+
const channel = sync_message_port_1.SyncMessagePort.createChannel();
|
|
14
|
+
const port1 = new sync_message_port_1.SyncMessagePort(channel.port1);
|
|
15
|
+
port1.postMessage('hi there!');
|
|
16
|
+
const port2 = new sync_message_port_1.SyncMessagePort(channel.port2);
|
|
17
|
+
expect(port2.receiveMessage()).toEqual('hi there!');
|
|
18
|
+
});
|
|
19
|
+
it('after the other endpoint calls receiveMessage()', () => {
|
|
20
|
+
const channel = sync_message_port_1.SyncMessagePort.createChannel();
|
|
21
|
+
const port = new sync_message_port_1.SyncMessagePort(channel.port1);
|
|
22
|
+
spawnWorker(`
|
|
23
|
+
// Wait a little bit just to make entirely sure that the parent thread
|
|
24
|
+
// is awaiting a message.
|
|
25
|
+
setTimeout(() => {
|
|
26
|
+
port.postMessage('done!');
|
|
27
|
+
port.close();
|
|
28
|
+
}, 100);
|
|
29
|
+
`, channel.port2);
|
|
30
|
+
expect(port.receiveMessage()).toEqual('done!');
|
|
31
|
+
});
|
|
32
|
+
it('multiple times before the other endpoint starts reading', () => {
|
|
33
|
+
const channel = sync_message_port_1.SyncMessagePort.createChannel();
|
|
34
|
+
const port1 = new sync_message_port_1.SyncMessagePort(channel.port1);
|
|
35
|
+
port1.postMessage('message1');
|
|
36
|
+
port1.postMessage('message2');
|
|
37
|
+
port1.postMessage('message3');
|
|
38
|
+
port1.postMessage('message4');
|
|
39
|
+
const port2 = new sync_message_port_1.SyncMessagePort(channel.port2);
|
|
40
|
+
expect(port2.receiveMessage()).toEqual('message1');
|
|
41
|
+
expect(port2.receiveMessage()).toEqual('message2');
|
|
42
|
+
expect(port2.receiveMessage()).toEqual('message3');
|
|
43
|
+
expect(port2.receiveMessage()).toEqual('message4');
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
describe('with an asynchronous listener', () => {
|
|
47
|
+
it('receives a message sent before listening', async () => {
|
|
48
|
+
const channel = sync_message_port_1.SyncMessagePort.createChannel();
|
|
49
|
+
const port1 = new sync_message_port_1.SyncMessagePort(channel.port1);
|
|
50
|
+
port1.postMessage('hi there!');
|
|
51
|
+
const port2 = new sync_message_port_1.SyncMessagePort(channel.port2);
|
|
52
|
+
// Wait a macrotask to make sure the message is as queued up as it's going
|
|
53
|
+
// to be.
|
|
54
|
+
await new Promise(process.nextTick);
|
|
55
|
+
const promise = new Promise(resolve => port2.once('message', resolve));
|
|
56
|
+
await expect(promise).resolves.toEqual('hi there!');
|
|
57
|
+
port1.close();
|
|
58
|
+
});
|
|
59
|
+
it('receives a message sent after listening', async () => {
|
|
60
|
+
const channel = sync_message_port_1.SyncMessagePort.createChannel();
|
|
61
|
+
const port1 = new sync_message_port_1.SyncMessagePort(channel.port1);
|
|
62
|
+
const promise = new Promise(resolve => port1.once('message', resolve));
|
|
63
|
+
// Wait a macrotask to make sure the message is as queued up as it's going
|
|
64
|
+
// to be.
|
|
65
|
+
await new Promise(process.nextTick);
|
|
66
|
+
const port2 = new sync_message_port_1.SyncMessagePort(channel.port2);
|
|
67
|
+
port2.postMessage('hi there!');
|
|
68
|
+
await expect(promise).resolves.toEqual('hi there!');
|
|
69
|
+
port1.close();
|
|
70
|
+
});
|
|
71
|
+
it('receiveMessage() throws an error after listening', async () => {
|
|
72
|
+
const channel = sync_message_port_1.SyncMessagePort.createChannel();
|
|
73
|
+
const port1 = new sync_message_port_1.SyncMessagePort(channel.port1);
|
|
74
|
+
port1.on('message', () => { });
|
|
75
|
+
expect(port1.receiveMessage).toThrow();
|
|
76
|
+
port1.close();
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
describe('close()', () => {
|
|
80
|
+
it('closing one port closes the other', async () => {
|
|
81
|
+
const channel = sync_message_port_1.SyncMessagePort.createChannel();
|
|
82
|
+
const port1 = new sync_message_port_1.SyncMessagePort(channel.port1);
|
|
83
|
+
const port2 = new sync_message_port_1.SyncMessagePort(channel.port2);
|
|
84
|
+
port1.close();
|
|
85
|
+
// Should resolve.
|
|
86
|
+
await new Promise(resolve => port2.once('close', resolve));
|
|
87
|
+
});
|
|
88
|
+
it('receiveMessage() throws an error for a closed port', () => {
|
|
89
|
+
const channel = sync_message_port_1.SyncMessagePort.createChannel();
|
|
90
|
+
const port1 = new sync_message_port_1.SyncMessagePort(channel.port1);
|
|
91
|
+
const port2 = new sync_message_port_1.SyncMessagePort(channel.port2);
|
|
92
|
+
port1.close();
|
|
93
|
+
expect(port1.receiveMessage).toThrow();
|
|
94
|
+
expect(port2.receiveMessage).toThrow();
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
/**
|
|
99
|
+
* Spawns a worker that executes the given TypeScript `source`.
|
|
100
|
+
*
|
|
101
|
+
* Automatically initializes a `SyncMessageChannel` named `port` connected to
|
|
102
|
+
* `port`.
|
|
103
|
+
*/
|
|
104
|
+
function spawnWorker(source, port) {
|
|
105
|
+
fs.mkdirSync('spec/sandbox', { recursive: true });
|
|
106
|
+
const file = p.join('spec/sandbox', `${Math.random()}.ts`.slice(2));
|
|
107
|
+
fs.writeFileSync(file, `
|
|
108
|
+
const {SyncMessagePort} = require(${JSON.stringify(p.join(p.dirname(__filename), 'sync-message-port'))});
|
|
109
|
+
const {workerData} = require('worker_threads');
|
|
110
|
+
|
|
111
|
+
const port = new SyncMessagePort(workerData);
|
|
112
|
+
|
|
113
|
+
${source}
|
|
114
|
+
`);
|
|
115
|
+
const worker = new worker_threads_1.Worker(`
|
|
116
|
+
require('ts-node').register();
|
|
117
|
+
require(${JSON.stringify(p.resolve(file.substring(0, file.length - 3)))});
|
|
118
|
+
`, { eval: true, workerData: port, transferList: [port] });
|
|
119
|
+
worker.on('error', error => {
|
|
120
|
+
throw error;
|
|
121
|
+
});
|
|
122
|
+
worker.on('exit', () => fs.unlinkSync(file));
|
|
123
|
+
return worker;
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=sync-message-port.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync-message-port.test.js","sourceRoot":"","sources":["../../../../lib/src/sync-process/sync-message-port.test.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;AAEvC,yBAAyB;AACzB,0BAA0B;AAC1B,mDAAmD;AAEnD,2DAAoD;AAEpD,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;QAC/B,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;YAC1D,MAAM,OAAO,GAAG,mCAAe,CAAC,aAAa,EAAE,CAAC;YAChD,MAAM,KAAK,GAAG,IAAI,mCAAe,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACjD,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;YAE/B,MAAM,KAAK,GAAG,IAAI,mCAAe,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACjD,MAAM,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;YACzD,MAAM,OAAO,GAAG,mCAAe,CAAC,aAAa,EAAE,CAAC;YAChD,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value: true });
|
|
3
|
+
const url_1 = require("url");
|
|
4
|
+
const utils_1 = require("./utils");
|
|
5
|
+
describe('utils', () => {
|
|
6
|
+
describe('pathToUrlString', () => {
|
|
7
|
+
it('encode relative path like `pathToFileURL`', () => {
|
|
8
|
+
const baseURL = (0, url_1.pathToFileURL)('').toString();
|
|
9
|
+
for (let i = 0; i < 128; i++) {
|
|
10
|
+
const char = String.fromCharCode(i);
|
|
11
|
+
const filename = `${i}-${char}`;
|
|
12
|
+
expect((0, utils_1.pathToUrlString)(filename)).toEqual((0, url_1.pathToFileURL)(filename)
|
|
13
|
+
.toString()
|
|
14
|
+
.slice(baseURL.length + 1));
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
it('encode percent encoded string like `pathToFileURL`', () => {
|
|
18
|
+
const baseURL = (0, url_1.pathToFileURL)('').toString();
|
|
19
|
+
for (let i = 0; i < 128; i++) {
|
|
20
|
+
const lowercase = `%${i < 10 ? '0' : ''}${i.toString(16)}`;
|
|
21
|
+
expect((0, utils_1.pathToUrlString)(lowercase)).toEqual((0, url_1.pathToFileURL)(lowercase)
|
|
22
|
+
.toString()
|
|
23
|
+
.slice(baseURL.length + 1));
|
|
24
|
+
const uppercase = lowercase.toUpperCase();
|
|
25
|
+
expect((0, utils_1.pathToUrlString)(uppercase)).toEqual((0, url_1.pathToFileURL)(uppercase)
|
|
26
|
+
.toString()
|
|
27
|
+
.slice(baseURL.length + 1));
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=utils.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.test.js","sourceRoot":"","sources":["../../../lib/src/utils.test.ts"],"names":[],"mappings":";;AAAA,6BAAkC;AAClC,mCAAwC;AAExC,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACrB,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;QAC/B,EAAE,CAAC,2CAA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,IAAA,mBAAa,EAAC,SAAS,CAAC;qBACrB,QAAQ,EAAE;qBACV,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAC7B,CAAC;aACH;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -117,6 +117,16 @@ class Value {
|
|
|
117
117
|
throw (0, utils_1.valueError)(`${this} is not a function reference`, name);
|
|
118
118
|
// TODO(awjin): Narrow the return type to SassFunction.
|
|
119
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Casts `this` to `SassMixin`; throws if `this` isn't a mixin
|
|
122
|
+
* reference.
|
|
123
|
+
*
|
|
124
|
+
* If `this` came from a function argument, `name` is the argument name
|
|
125
|
+
* (without the `$`) and is used for error reporting.
|
|
126
|
+
*/
|
|
127
|
+
assertMixin(name) {
|
|
128
|
+
throw (0, utils_1.valueError)(`${this} is not a mixin reference`, name);
|
|
129
|
+
}
|
|
120
130
|
/**
|
|
121
131
|
* Casts `this` to `SassMap`; throws if `this` isn't a map.
|
|
122
132
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/src/value/index.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,yCAA4C;AAQ5C,oCAAoC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/src/value/index.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,yCAA4C;AAQ5C,oCAAoC;AAIpC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAsB,KAAK;IACzB,uCAAuC;IACvC,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0EAA0E;IAC1E,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IAED,wBAAwB;IACxB,IAAI,MAAM;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IACzD,CAAC;IAED;;;;;OAKG;IACH,WAAW,CAAC,IAAa;QACvB,MAAM,IAAA,kBAAU,EAAC,GAAG,IAAI,iBAAiB,EAAE,IAAI,CAAC,CAAC;IACnD,CAAC;IAED;;;;;;OAMG;IACH,cAAc,CAAC,IAAa;QAC1B,MAAM,IAAA,kBAAU,EAAC,GAAG,IAAI,8BAA8B,EAAE,IAAI,CAAC,CAAC;QAC9D,uDAAuD;IACzD,CAAC;IAED;;;;;;OAMG;IACH,WAAW,CAAC,IAAa;QACvB,MAAM,IAAA,kBAAU,EAAC,GAAG,IAAI,2BAA2B,EAAE,IAAI,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;OAKG;IACH,SAAS,CAAC,IAAa;QACrB,MAAM,IAAA,kBAAU,EAAC,GAAG,IAAI,eAAe,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IAED;;;OAGG;IACH,MAAM;QACJ,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACH,YAAY,CAAC,IAAa;QACxB,MAAM,IAAA,kBAAU,EAAC,GAAG,IAAI,kBAAkB,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC;IAED;;;;;OAKG;IACH,YAAY,CAAC,IAAa;QACxB,MAAM,IAAA,kBAAU,EAAC,GAAG,IAAI,kBAAkB,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC;CAUF;AAtKD,sBAsKC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
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.SassMixin = void 0;
|
|
7
|
+
const immutable_1 = require("immutable");
|
|
8
|
+
const index_1 = require("./index");
|
|
9
|
+
/** A first-class SassScript mixin. */
|
|
10
|
+
class SassMixin extends index_1.Value {
|
|
11
|
+
constructor(id) {
|
|
12
|
+
super();
|
|
13
|
+
this.id = id;
|
|
14
|
+
}
|
|
15
|
+
equals(other) {
|
|
16
|
+
return other instanceof SassMixin && other.id === this.id;
|
|
17
|
+
}
|
|
18
|
+
hashCode() {
|
|
19
|
+
return (0, immutable_1.hash)(this.id);
|
|
20
|
+
}
|
|
21
|
+
toString() {
|
|
22
|
+
return `<compiler mixin ${this.id}>`;
|
|
23
|
+
}
|
|
24
|
+
assertMixin() {
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.SassMixin = SassMixin;
|
|
29
|
+
//# sourceMappingURL=mixin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mixin.js","sourceRoot":"","sources":["../../../../lib/src/value/mixin.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,yCAA+B;AAE/B,mCAA8B;AAE9B,sCAAsC;AACtC,MAAa,SAAU,SAAQ,aAAK;IAWlC,YAAY,EAAU;QACpB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IAED,MAAM,CAAC,KAAY;QACjB,OAAO,KAAK,YAAY,SAAS,IAAI,KAAK,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;IAC5D,CAAC;IAED,QAAQ;QACN,OAAO,IAAA,gBAAI,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACvB,CAAC;IAED,QAAQ;QACN,OAAO,mBAAmB,IAAI,CAAC,EAAE,GAAG,CAAC;IACvC,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA/BD,8BA+BC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
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.Value_Calculation_CalculationOperation = exports.Value_Calculation_CalculationValue = exports.Value_Calculation = exports.Value_ArgumentList = exports.Value_HostFunction = exports.Value_CompilerFunction = exports.Value_Map_Entry = exports.Value_Map = exports.Value_List = exports.Value_HwbColor = exports.Value_HslColor = exports.Value_RgbColor = exports.Value_Number = exports.Value_String = exports.Value = exports.SourceSpan_SourceLocation = exports.SourceSpan = exports.ProtocolError = exports.OutboundMessage_FunctionCallRequest = exports.OutboundMessage_FileImportRequest = exports.OutboundMessage_ImportRequest = exports.OutboundMessage_CanonicalizeRequest = exports.OutboundMessage_LogEvent = exports.OutboundMessage_CompileResponse_CompileFailure = exports.OutboundMessage_CompileResponse_CompileSuccess = exports.OutboundMessage_CompileResponse = exports.OutboundMessage_VersionResponse = exports.OutboundMessage = exports.InboundMessage_FunctionCallResponse = exports.InboundMessage_FileImportResponse = exports.InboundMessage_ImportResponse_ImportSuccess = exports.InboundMessage_ImportResponse = exports.InboundMessage_CanonicalizeResponse = exports.InboundMessage_CompileRequest_Importer = exports.InboundMessage_CompileRequest_StringInput = exports.InboundMessage_CompileRequest = exports.InboundMessage_VersionRequest = exports.InboundMessage = exports.CalculationOperator = exports.SingletonValue = exports.ListSeparator = exports.ProtocolErrorType = exports.LogEventType = exports.Syntax = exports.OutputStyle = void 0;
|
|
6
|
+
exports.Value_Calculation_CalculationOperation = exports.Value_Calculation_CalculationValue = exports.Value_Calculation = exports.Value_ArgumentList = exports.Value_CompilerMixin = exports.Value_HostFunction = exports.Value_CompilerFunction = exports.Value_Map_Entry = exports.Value_Map = exports.Value_List = exports.Value_HwbColor = exports.Value_HslColor = exports.Value_RgbColor = exports.Value_Number = exports.Value_String = exports.Value = exports.SourceSpan_SourceLocation = exports.SourceSpan = exports.ProtocolError = exports.OutboundMessage_FunctionCallRequest = exports.OutboundMessage_FileImportRequest = exports.OutboundMessage_ImportRequest = exports.OutboundMessage_CanonicalizeRequest = exports.OutboundMessage_LogEvent = exports.OutboundMessage_CompileResponse_CompileFailure = exports.OutboundMessage_CompileResponse_CompileSuccess = exports.OutboundMessage_CompileResponse = exports.OutboundMessage_VersionResponse = exports.OutboundMessage = exports.InboundMessage_FunctionCallResponse = exports.InboundMessage_FileImportResponse = exports.InboundMessage_ImportResponse_ImportSuccess = exports.InboundMessage_ImportResponse = exports.InboundMessage_CanonicalizeResponse = exports.InboundMessage_CompileRequest_Importer = exports.InboundMessage_CompileRequest_StringInput = exports.InboundMessage_CompileRequest = exports.InboundMessage_VersionRequest = exports.InboundMessage = exports.CalculationOperator = exports.SingletonValue = exports.ListSeparator = exports.ProtocolErrorType = exports.LogEventType = exports.Syntax = exports.OutputStyle = void 0;
|
|
7
7
|
const protobuf_1 = require("@bufbuild/protobuf");
|
|
8
8
|
/**
|
|
9
9
|
* Possible ways to format the CSS output. The compiler is not required to
|
|
@@ -522,6 +522,17 @@ class InboundMessage_CompileRequest_Importer extends protobuf_1.Message {
|
|
|
522
522
|
* @generated from oneof sass.embedded_protocol.InboundMessage.CompileRequest.Importer.importer
|
|
523
523
|
*/
|
|
524
524
|
this.importer = { case: undefined };
|
|
525
|
+
/**
|
|
526
|
+
* The set of URL schemes that are considered *non-canonical* for this
|
|
527
|
+
* importer. This must be empty unless `importer.importer_id` is set.
|
|
528
|
+
*
|
|
529
|
+
* If any element of this contains a character other than a lowercase
|
|
530
|
+
* ASCII letter, an ASCII numeral, U+002B (`+`), U+002D (`-`), or U+002E
|
|
531
|
+
* (`.`), the compiler must treat the compilation as failed.
|
|
532
|
+
*
|
|
533
|
+
* @generated from field: repeated string non_canonical_scheme = 4;
|
|
534
|
+
*/
|
|
535
|
+
this.nonCanonicalScheme = [];
|
|
525
536
|
protobuf_1.proto3.util.initPartial(data, this);
|
|
526
537
|
}
|
|
527
538
|
static fromBinary(bytes, options) {
|
|
@@ -544,6 +555,7 @@ InboundMessage_CompileRequest_Importer.fields = protobuf_1.proto3.util.newFieldL
|
|
|
544
555
|
{ no: 1, name: "path", kind: "scalar", T: 9 /* ScalarType.STRING */, oneof: "importer" },
|
|
545
556
|
{ no: 2, name: "importer_id", kind: "scalar", T: 13 /* ScalarType.UINT32 */, oneof: "importer" },
|
|
546
557
|
{ no: 3, name: "file_importer_id", kind: "scalar", T: 13 /* ScalarType.UINT32 */, oneof: "importer" },
|
|
558
|
+
{ no: 4, name: "non_canonical_scheme", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true },
|
|
547
559
|
]);
|
|
548
560
|
/**
|
|
549
561
|
* A response indicating the result of canonicalizing an imported URL.
|
|
@@ -1181,14 +1193,14 @@ class OutboundMessage_CanonicalizeRequest extends protobuf_1.Message {
|
|
|
1181
1193
|
*/
|
|
1182
1194
|
this.url = "";
|
|
1183
1195
|
/**
|
|
1184
|
-
*
|
|
1185
|
-
*
|
|
1186
|
-
*
|
|
1187
|
-
*
|
|
1188
|
-
*
|
|
1189
|
-
*
|
|
1190
|
-
*
|
|
1191
|
-
*
|
|
1196
|
+
* Whether this request comes from an `@import` rule.
|
|
1197
|
+
*
|
|
1198
|
+
* When evaluating `@import` rules, URLs should canonicalize to an
|
|
1199
|
+
* [import-only file] if one exists for the URL being canonicalized.
|
|
1200
|
+
* Otherwise, canonicalization should be identical for `@import` and `@use`
|
|
1201
|
+
* rules.
|
|
1202
|
+
*
|
|
1203
|
+
* [import-only file]: https://sass-lang.com/documentation/at-rules/import#import-only-files
|
|
1192
1204
|
*
|
|
1193
1205
|
* @generated from field: bool from_import = 5;
|
|
1194
1206
|
*/
|
|
@@ -1216,6 +1228,7 @@ OutboundMessage_CanonicalizeRequest.fields = protobuf_1.proto3.util.newFieldList
|
|
|
1216
1228
|
{ no: 3, name: "importer_id", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
|
|
1217
1229
|
{ no: 4, name: "url", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
1218
1230
|
{ no: 5, name: "from_import", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
|
|
1231
|
+
{ no: 6, name: "containing_url", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
1219
1232
|
]);
|
|
1220
1233
|
/**
|
|
1221
1234
|
* A request for a custom importer to load the contents of a stylesheet.
|
|
@@ -1285,8 +1298,13 @@ OutboundMessage_ImportRequest.fields = protobuf_1.proto3.util.newFieldList(() =>
|
|
|
1285
1298
|
* * Let `fromImport` be `true` if the importer is being run for an
|
|
1286
1299
|
* `@import` and `false` otherwise.
|
|
1287
1300
|
*
|
|
1301
|
+
* * Let `containingUrl` be the canonical URL of the [current source file]
|
|
1302
|
+
* if it has one, or undefined otherwise.
|
|
1303
|
+
*
|
|
1304
|
+
*
|
|
1288
1305
|
* * Let `response` be the result of sending a `FileImportRequest` with
|
|
1289
|
-
* `string` as its `url
|
|
1306
|
+
* `string` as its `url`, `fromImport` as `from_import`, and
|
|
1307
|
+
* `containingUrl` as `containing_url`.
|
|
1290
1308
|
*
|
|
1291
1309
|
* * If `response.result` is null, return null.
|
|
1292
1310
|
*
|
|
@@ -1310,6 +1328,7 @@ OutboundMessage_ImportRequest.fields = protobuf_1.proto3.util.newFieldList(() =>
|
|
|
1310
1328
|
*
|
|
1311
1329
|
* * Return `text`, `syntax`, and `resolved`.
|
|
1312
1330
|
*
|
|
1331
|
+
* [current source file]: ../spec.md#current-source-file
|
|
1313
1332
|
* [resolving `url`]: https://github.com/sass/sass/tree/main/spec/modules.md#resolving-a-file-url
|
|
1314
1333
|
*
|
|
1315
1334
|
* @generated from message sass.embedded_protocol.OutboundMessage.FileImportRequest
|
|
@@ -1336,14 +1355,14 @@ class OutboundMessage_FileImportRequest extends protobuf_1.Message {
|
|
|
1336
1355
|
*/
|
|
1337
1356
|
this.url = "";
|
|
1338
1357
|
/**
|
|
1339
|
-
*
|
|
1340
|
-
*
|
|
1341
|
-
*
|
|
1342
|
-
*
|
|
1343
|
-
*
|
|
1344
|
-
*
|
|
1345
|
-
*
|
|
1346
|
-
*
|
|
1358
|
+
* Whether this request comes from an `@import` rule.
|
|
1359
|
+
*
|
|
1360
|
+
* When evaluating `@import` rules, filesystem importers should load an
|
|
1361
|
+
* [import-only file] if one exists for the URL being canonicalized.
|
|
1362
|
+
* Otherwise, canonicalization should be identical for `@import` and `@use`
|
|
1363
|
+
* rules.
|
|
1364
|
+
*
|
|
1365
|
+
* [import-only file]: https://sass-lang.com/documentation/at-rules/import#import-only-files
|
|
1347
1366
|
*
|
|
1348
1367
|
* @generated from field: bool from_import = 5;
|
|
1349
1368
|
*/
|
|
@@ -1371,6 +1390,7 @@ OutboundMessage_FileImportRequest.fields = protobuf_1.proto3.util.newFieldList((
|
|
|
1371
1390
|
{ no: 3, name: "importer_id", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
|
|
1372
1391
|
{ no: 4, name: "url", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
1373
1392
|
{ no: 5, name: "from_import", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
|
|
1393
|
+
{ no: 6, name: "containing_url", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
1374
1394
|
]);
|
|
1375
1395
|
/**
|
|
1376
1396
|
* A request to invoke a custom Sass function and return its result.
|
|
@@ -1634,6 +1654,7 @@ Value.fields = protobuf_1.proto3.util.newFieldList(() => [
|
|
|
1634
1654
|
{ no: 10, name: "argument_list", kind: "message", T: Value_ArgumentList, oneof: "value" },
|
|
1635
1655
|
{ no: 11, name: "hwb_color", kind: "message", T: Value_HwbColor, oneof: "value" },
|
|
1636
1656
|
{ no: 12, name: "calculation", kind: "message", T: Value_Calculation, oneof: "value" },
|
|
1657
|
+
{ no: 13, name: "compiler_mixin", kind: "message", T: Value_CompilerMixin, oneof: "value" },
|
|
1637
1658
|
]);
|
|
1638
1659
|
/**
|
|
1639
1660
|
* A SassScript string value.
|
|
@@ -2129,6 +2150,46 @@ Value_HostFunction.fields = protobuf_1.proto3.util.newFieldList(() => [
|
|
|
2129
2150
|
{ no: 1, name: "id", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
|
|
2130
2151
|
{ no: 2, name: "signature", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
2131
2152
|
]);
|
|
2153
|
+
/**
|
|
2154
|
+
* A first-class mixin defined in the compiler. New `CompilerMixin`s may
|
|
2155
|
+
* only be created by the compiler, but the host may pass `CompilerMixin`s
|
|
2156
|
+
* back to the compiler as long as their IDs match IDs of mixins received
|
|
2157
|
+
* by the host during that same compilation.
|
|
2158
|
+
*
|
|
2159
|
+
* @generated from message sass.embedded_protocol.Value.CompilerMixin
|
|
2160
|
+
*/
|
|
2161
|
+
class Value_CompilerMixin extends protobuf_1.Message {
|
|
2162
|
+
constructor(data) {
|
|
2163
|
+
super();
|
|
2164
|
+
/**
|
|
2165
|
+
* A unique ID for this mixin. The compiler is responsible for generating
|
|
2166
|
+
* this ID and ensuring it's unique across all mixins passed to the host
|
|
2167
|
+
* for this compilation. Mandatory.
|
|
2168
|
+
*
|
|
2169
|
+
* @generated from field: uint32 id = 1;
|
|
2170
|
+
*/
|
|
2171
|
+
this.id = 0;
|
|
2172
|
+
protobuf_1.proto3.util.initPartial(data, this);
|
|
2173
|
+
}
|
|
2174
|
+
static fromBinary(bytes, options) {
|
|
2175
|
+
return new Value_CompilerMixin().fromBinary(bytes, options);
|
|
2176
|
+
}
|
|
2177
|
+
static fromJson(jsonValue, options) {
|
|
2178
|
+
return new Value_CompilerMixin().fromJson(jsonValue, options);
|
|
2179
|
+
}
|
|
2180
|
+
static fromJsonString(jsonString, options) {
|
|
2181
|
+
return new Value_CompilerMixin().fromJsonString(jsonString, options);
|
|
2182
|
+
}
|
|
2183
|
+
static equals(a, b) {
|
|
2184
|
+
return protobuf_1.proto3.util.equals(Value_CompilerMixin, a, b);
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2187
|
+
exports.Value_CompilerMixin = Value_CompilerMixin;
|
|
2188
|
+
Value_CompilerMixin.runtime = protobuf_1.proto3;
|
|
2189
|
+
Value_CompilerMixin.typeName = "sass.embedded_protocol.Value.CompilerMixin";
|
|
2190
|
+
Value_CompilerMixin.fields = protobuf_1.proto3.util.newFieldList(() => [
|
|
2191
|
+
{ no: 1, name: "id", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
|
|
2192
|
+
]);
|
|
2132
2193
|
/**
|
|
2133
2194
|
* A SassScript argument list value. This represents rest arguments passed to
|
|
2134
2195
|
* a function's `$arg...` parameter. Unlike a normal `List`, an argument list
|