File tree Expand file tree Collapse file tree 8 files changed +75
-5
lines changed Expand file tree Collapse file tree 8 files changed +75
-5
lines changed Original file line number Diff line number Diff line change @@ -74,9 +74,9 @@ These dependencies are made available in different ways depending on context.
74
74
### Local Development
75
75
76
76
When developing locally, you can download all of these dependencies by running
77
- ` npm run init ` . This provides the following options for ` compiler ` (for the
78
- embedded compiler), ` protocol ` (for the embedded protocol ), and ` api ` (for the
79
- JS API):
77
+ ` npm install ` and then ` npm run init` . This provides the following options for
78
+ ` compiler ` (for the embedded compiler ), ` protocol ` (for the embedded protocol),
79
+ and ` api ` (for the JS API):
80
80
81
81
* ` --<type>-path ` : The local filesystem path of the package to use. This is
82
82
useful when doing local development on both the host and its dependencies at
@@ -85,6 +85,9 @@ JS API):
85
85
* ` --<type>-ref ` : A Git reference for the GitHub repository of the package to
86
86
clone.
87
87
88
+ If developing locally, you will need to specify both the compiler and language.
89
+ For example: ` npm run init -- --compiler-path=dart-sass --language-path=language ` .
90
+
88
91
By default:
89
92
90
93
* This uses the version of the embedded protocol and compiler specified by
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ export const SassBoolean = sass.SassBoolean;
13
13
export const SassCalculation = sass . SassCalculation
14
14
export const SassColor = sass . SassColor ;
15
15
export const SassFunction = sass . SassFunction ;
16
+ export const SassMixin = sass . SassMixin ;
16
17
export const SassList = sass . SassList ;
17
18
export const SassMap = sass . SassMap ;
18
19
export const SassNumber = sass . SassNumber ;
@@ -95,6 +96,10 @@ export default {
95
96
defaultExportDeprecation ( ) ;
96
97
return sass . SassFunction ;
97
98
} ,
99
+ get SassMixin ( ) {
100
+ defaultExportDeprecation ( ) ;
101
+ return sass . SassMixin ;
102
+ } ,
98
103
get SassList ( ) {
99
104
defaultExportDeprecation ( ) ;
100
105
return sass . SassList ;
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ export {sassFalse, sassTrue} from './src/value/boolean';
12
12
export { SassColor } from './src/value/color' ;
13
13
export { SassFunction } from './src/value/function' ;
14
14
export { SassMap } from './src/value/map' ;
15
+ export { SassMixin } from './src/value/mixin' ;
15
16
export { SassNumber } from './src/value/number' ;
16
17
export { SassString } from './src/value/string' ;
17
18
export { Value } from './src/value' ;
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import {
24
24
CalculationOperation ,
25
25
CalculationOperator ,
26
26
} from './value/calculations' ;
27
+ import { SassMixin } from './value/mixin' ;
27
28
28
29
/**
29
30
* A class that converts [Value] objects into protobufs.
@@ -119,6 +120,10 @@ export class Protofier {
119
120
fn . signature = value . signature ! ;
120
121
result . value = { case : 'hostFunction' , value : fn } ;
121
122
}
123
+ } else if ( value instanceof SassMixin ) {
124
+ const mixin = new proto . Value_CompilerMixin ( ) ;
125
+ mixin . id = value . id ;
126
+ result . value = { case : 'compilerMixin' , value : mixin } ;
122
127
} else if ( value instanceof SassCalculation ) {
123
128
result . value = {
124
129
case : 'calculation' ,
@@ -322,6 +327,9 @@ export class Protofier {
322
327
'The compiler may not send Value.host_function.'
323
328
) ;
324
329
330
+ case 'compilerMixin' :
331
+ return new SassMixin ( value . value . value . id ) ;
332
+
325
333
case 'calculation' :
326
334
return this . deprotofyCalculation ( value . value . value ) ;
327
335
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import {SassNumber} from './number';
12
12
import { SassString } from './string' ;
13
13
import { valueError } from '../utils' ;
14
14
import { SassCalculation } from './calculations' ;
15
+ import { SassMixin } from './mixin' ;
15
16
16
17
/**
17
18
* A SassScript value.
@@ -139,6 +140,17 @@ export abstract class Value implements ValueObject {
139
140
// TODO(awjin): Narrow the return type to SassFunction.
140
141
}
141
142
143
+ /**
144
+ * Casts `this` to `SassMixin`; throws if `this` isn't a mixin
145
+ * reference.
146
+ *
147
+ * If `this` came from a function argument, `name` is the argument name
148
+ * (without the `$`) and is used for error reporting.
149
+ */
150
+ assertMixin ( name ?: string ) : SassMixin {
151
+ throw valueError ( `${ this } is not a mixin reference` , name ) ;
152
+ }
153
+
142
154
/**
143
155
* Casts `this` to `SassMap`; throws if `this` isn't a map.
144
156
*
Original file line number Diff line number Diff line change
1
+ // Copyright 2021 Google LLC. Use of this source code is governed by an
2
+ // MIT-style license that can be found in the LICENSE file or at
3
+ // https://opensource.org/licenses/MIT.
4
+
5
+ import { hash } from 'immutable' ;
6
+
7
+ import { Value } from './index' ;
8
+
9
+ /** A first-class SassScript mixin. */
10
+ export class SassMixin extends Value {
11
+ /**
12
+ * This is the unique ID that the compiler uses to determine which mixin it
13
+ * refers to.
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
+ readonly id : number ;
20
+
21
+ constructor ( id : number ) {
22
+ super ( ) ;
23
+ this . id = id ;
24
+ }
25
+
26
+ equals ( other : Value ) : boolean {
27
+ return other instanceof SassMixin && other . id === this . id ;
28
+ }
29
+
30
+ hashCode ( ) : number {
31
+ return hash ( this . id ) ;
32
+ }
33
+
34
+ toString ( ) : string {
35
+ return `<compiler mixin ${ this . id } >` ;
36
+ }
37
+
38
+ assertMixin ( ) : SassMixin {
39
+ return this ;
40
+ }
41
+ }
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " sass-embedded" ,
3
3
"version" : " 1.68.0" ,
4
- "protocol-version" : " 2.2 .0" ,
4
+ "protocol-version" : " 2.3 .0" ,
5
5
"compiler-version" : " 1.68.0" ,
6
6
"description" : " Node.js library that communicates with Embedded Dart Sass using the Embedded Sass protocol" ,
7
7
"repository" : " sass/embedded-host-node" ,
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import * as shell from 'shelljs';
8
8
import * as utils from './utils' ;
9
9
10
10
/**
11
- * Downlaods and builds the Embedded Dart Sass compiler.
11
+ * Downloads and builds the Embedded Dart Sass compiler.
12
12
*
13
13
* Can check out and build the source from a Git `ref` or build from the source
14
14
* at `path`. By default, checks out the latest revision from GitHub.
You can’t perform that action at this time.
0 commit comments