Skip to content
This repository has been archived by the owner on May 18, 2023. It is now read-only.

Commit

Permalink
Merge pull request #29 from sass/update
Browse files Browse the repository at this point in the history
Make some small protocol improvements
  • Loading branch information
nex3 authored Nov 26, 2019
2 parents f17d6ba + bae06f1 commit cd92719
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 35 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ scalar-typed fields.
When one endpoint detects that the other is violating this protocol, it must
send a `ProtocolError` message to the other endpoint. If the error was detected
when processing a request, the `ProtocolError` must have its `id` field set to
the request's id. Otherwise, the `id` field must be set to `-1`.
the request's id. Otherwise, even if the error was detected while processing a
response with an id, the `id` field must be set to `-1`.

A `ProtocolError` must be sent whenever any requirements set out by this
protocol (including the documentation in `embedded_sass.proto`) are violated.
Expand All @@ -117,6 +118,9 @@ This includes, but is not limited to:
* Sending a response with an ID that doesn't correspond to an in-flight
request's ID.

* Sending a response with an ID that corresponds to the ID of an in-flight
request ID of the incorrect type.

* Sending a message with a `null` value for a mandatory field.

The `ProtocolError` message must *not* be used to report Sass errors or errors
Expand Down
38 changes: 4 additions & 34 deletions embedded_sass.proto
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ message InboundMessage {
// including scheme.
string url = 2;

// A path on disk to look for the file to load. The host must resolve
// A path on disk to look for the file to load. The compiler must resolve
// partials, file extensions, and index files to determine whether a file
// actually exists and what its canonical URL is.
//
Expand Down Expand Up @@ -152,6 +152,8 @@ message InboundMessage {
// This should be a `file:` URL if one is available, but an `http:` URL is
// acceptable as well. If no URL is supplied, a `data:` URL is generated
// automatically from `contents`.
//
// If this is provided, it must be an absolute URL, including scheme.
string sourceMapUrl = 3;
}

Expand All @@ -165,27 +167,6 @@ message InboundMessage {
}
}

// A request that the compiler invoke a first-class Sass function passed as a
// `Value.CompilerFunction`.
//
// If the function invocation fails, the compiler must throw an error and stop
// compilation. It must not return the error to the host.
message FunctionCallRequest {
uint32 id = 1;

// The ID of the function to invoke. This must match the ID of a
// `Value.CompilerFunction` that was passed from the compiler to the host
// during this compilation.
uint32 function_id = 2;

// The arguments to pass by position to the function.
repeated Value positional = 3;

// The arguments to pass by name to the function. Each name must include the
// prefix character `$`.
map<string, Value> named = 4;
}

// A response indicating the result of calling a custom Sass function defined
// in the host.
message FunctionCallResponse {
Expand Down Expand Up @@ -219,7 +200,6 @@ message InboundMessage {
CompileRequest compileRequest = 2;
CanonicalizeResponse canonicalizeResponse = 3;
ImportResponse importResponse = 4;
FunctionCallRequest functionCallRequest = 5;
FunctionCallResponse functionCallResponse = 6;
}
}
Expand Down Expand Up @@ -388,7 +368,7 @@ message OutboundMessage {

// A request for a custom importer to load the contents of a stylesheet.
message ImportRequest {
uint32 id =1;
uint32 id = 1;

// The request id for the compilation that triggered the message. Mandatory.
uint32 compilation_id = 2;
Expand Down Expand Up @@ -436,15 +416,6 @@ message OutboundMessage {
repeated Value arguments = 5;
}

// A response indicating the result of calling a first-class Sass function
// defined in the compiler.
message FunctionCallResponse {
uint32 id = 1;

// The return value of a successful function call.
Value result = 2;
}

// The wrapped message. Mandatory.
oneof message {
ProtocolError error = 1;
Expand All @@ -453,7 +424,6 @@ message OutboundMessage {
CanonicalizeRequest canonicalizeRequest = 4;
ImportRequest importRequest = 5;
FunctionCallRequest functionCallRequest = 6;
FunctionCallResponse functionCallResponse = 7;
}
}

Expand Down

0 comments on commit cd92719

Please sign in to comment.