-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement
sass --embedded
in pure JS mode
- Loading branch information
Showing
13 changed files
with
104 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2024 Google Inc. Use of this source code is governed by an | ||
// MIT-style license that can be found in the LICENSE file or at | ||
// https://opensource.org/licenses/MIT. | ||
|
||
import 'dart:js_interop'; | ||
|
||
import '../compilation_dispatcher.dart'; | ||
|
||
@JS('sass_embedded') | ||
extension type SassEmbedded._(JSObject o) implements JSObject { | ||
external static void main(JSExportedDartFunction createCompilationDispatcher); | ||
} | ||
|
||
void main(List<String> args) { | ||
try { | ||
SassEmbedded.main(spawnCompilationDispatcher.toJS); | ||
} catch (error) { | ||
print(error); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2024 Google Inc. Use of this source code is governed by an | ||
// MIT-style license that can be found in the LICENSE file or at | ||
// https://opensource.org/licenses/MIT. | ||
|
||
import 'dart:js_interop'; | ||
import 'dart:typed_data'; | ||
|
||
/// MessagePort from JS wrapped as SendPort in Dart | ||
@JS() | ||
extension type SendPort._(JSObject o) implements JSObject { | ||
@JS('postMessage') | ||
external void _postMessage(JSAny message); | ||
void send(Uint8List message) => _postMessage(message.toJS); | ||
} | ||
|
||
@JS() | ||
extension type Isolate._(JSObject o) implements JSObject { | ||
static Never exit([SendPort? finalMessagePort, Uint8List? message]) { | ||
if (message != null) { | ||
finalMessagePort?.send(message); | ||
} | ||
throw Error(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright 2024 Google Inc. Use of this source code is governed by an | ||
// MIT-style license that can be found in the LICENSE file or at | ||
// https://opensource.org/licenses/MIT. | ||
|
||
import 'dart:js_interop'; | ||
import 'dart:typed_data'; | ||
|
||
/// SyncMessagePort from JS wrapped as Mailbox in Dart | ||
@JS() | ||
extension type Mailbox._(JSObject o) implements JSObject { | ||
@JS('receiveMessage') | ||
external JSAny _receiveMessage(); | ||
Uint8List take() => (_receiveMessage() as JSUint8Array).toDart; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters