sass-embedded 1.0.0-beta.5 → 1.0.0-beta.7
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 +18 -0
- package/dist/.gitignore +1 -1
- package/dist/lib/index.js +11 -4
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/src/{embedded-compiler/compiler.js → async-compiler.js} +9 -17
- package/dist/lib/src/async-compiler.js.map +1 -0
- package/dist/lib/src/compile.js +167 -79
- 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/{embedded-protocol/utils.js → deprotofy-span.js} +16 -18
- package/dist/lib/src/deprotofy-span.js.map +1 -0
- package/dist/lib/src/{embedded-protocol/dispatcher.js → dispatcher.js} +45 -40
- 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 +81 -0
- package/dist/lib/src/function-registry.js.map +1 -0
- package/dist/lib/src/{node-sass/render.js → legacy.js} +45 -39
- package/dist/lib/src/legacy.js.map +1 -0
- package/dist/lib/src/{embedded-protocol/message-transformer.js → message-transformer.js} +2 -2
- package/dist/lib/src/message-transformer.js.map +1 -0
- package/dist/lib/src/{embedded-compiler/packet-transformer.js → packet-transformer.js} +0 -0
- package/dist/lib/src/packet-transformer.js.map +1 -0
- package/dist/lib/src/protofier.js +205 -0
- package/dist/lib/src/protofier.js.map +1 -0
- package/dist/lib/src/{embedded-protocol/request-tracker.js → request-tracker.js} +0 -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 +43 -1
- package/dist/lib/src/utils.js.map +1 -1
- package/dist/lib/src/value/boolean.js +3 -3
- package/dist/lib/src/value/boolean.js.map +1 -1
- package/dist/lib/src/value/color.js +89 -98
- package/dist/lib/src/value/color.js.map +1 -1
- package/dist/lib/src/value/{value.js → index.js} +5 -1
- package/dist/lib/src/value/index.js.map +1 -0
- package/dist/lib/src/value/list.js +15 -18
- package/dist/lib/src/value/list.js.map +1 -1
- package/dist/lib/src/value/map.js +17 -10
- package/dist/lib/src/value/map.js.map +1 -1
- package/dist/lib/src/value/null.js +2 -2
- package/dist/lib/src/value/number.js +20 -26
- package/dist/lib/src/value/number.js.map +1 -1
- package/dist/lib/src/value/string.js +14 -9
- package/dist/lib/src/value/string.js.map +1 -1
- package/dist/lib/src/value/utils.js +7 -1
- 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 +6 -4
- package/dist/tool/utils.js +34 -9
- 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 +76 -0
- package/dist/types/legacy/exception.d.ts +54 -0
- package/dist/types/legacy/function.d.ts +652 -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 +70 -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 +408 -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 +6 -4
- package/dist/lib/index.d.ts +0 -10
- package/dist/lib/src/compile.d.ts +0 -22
- 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.map +0 -1
- package/dist/lib/src/exception/exception.d.ts +0 -19
- package/dist/lib/src/exception/exception.js +0 -37
- 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 -61
- package/dist/lib/src/node-sass/render.js.map +0 -1
- package/dist/lib/src/utils.d.ts +0 -16
- package/dist/lib/src/value/boolean.d.ts +0 -25
- package/dist/lib/src/value/color.d.ts +0 -89
- package/dist/lib/src/value/list.d.ts +0 -41
- package/dist/lib/src/value/map.d.ts +0 -26
- 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 -44
- package/dist/lib/src/value/value.d.ts +0 -108
- 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
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { InboundResponseType, OutboundResponseType } from './message-transformer';
|
|
2
|
-
/**
|
|
3
|
-
* Manages pending inbound and outbound requests. Ensures that requests and
|
|
4
|
-
* responses interact correctly and obey the Embedded Protocol.
|
|
5
|
-
*/
|
|
6
|
-
export declare class RequestTracker {
|
|
7
|
-
private readonly requests;
|
|
8
|
-
/** The next available request ID. */
|
|
9
|
-
get nextId(): number;
|
|
10
|
-
/**
|
|
11
|
-
* Adds an entry for a pending request with ID `id`. The entry stores the
|
|
12
|
-
* expected response type. Throws an error if the Protocol Error is violated.
|
|
13
|
-
*/
|
|
14
|
-
add(id: number, expectedResponseType: InboundResponseType | OutboundResponseType): void;
|
|
15
|
-
/**
|
|
16
|
-
* Resolves a pending request with matching ID `id` and expected response type
|
|
17
|
-
* `type`. Throws an error if the Protocol Error is violated.
|
|
18
|
-
*/
|
|
19
|
-
resolve(id: number, type: InboundResponseType | OutboundResponseType): void;
|
|
20
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request-tracker.js","sourceRoot":"","sources":["../../../../lib/src/embedded-protocol/request-tracker.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAIvC;;;GAGG;AACH,MAAa,cAAc;IAA3B;QACE,4EAA4E;QAC5E,8CAA8C;QAC7B,aAAQ,GAErB,EAAE,CAAC;IA4CT,CA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@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as proto from '../vendor/embedded-protocol/embedded_sass_pb';
|
|
2
|
-
import { SassException } from '../exception/exception';
|
|
3
|
-
/**
|
|
4
|
-
* Creates a SassException from the given protocol `buffer`. Throws if the
|
|
5
|
-
* buffer has invalid fields.
|
|
6
|
-
*/
|
|
7
|
-
export declare function deprotifyException(buffer: proto.OutboundMessage.CompileResponse.CompileFailure): SassException;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../lib/src/embedded-protocol/utils.ts"],"names":[],"mappings":";;;AAGA,oCAAuC;AACvC,sDAAqD;AAErD;;;GAGG;AACH,SAAgB,kBAAkB,CAChC,MAA4D;IAE5D,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;IAE9B,OAAO,IAAI,yBAAa,CACtB,MAAM,CAAC,UAAU,EAAE,EACnB,MAAM,CAAC,YAAY,EAAE,EACrB,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,EAC5C,MAAM,CAAC,aAAa,EAAE,CACvB,CAAC;AACJ,CAAC;AAXD,gDAWC;AAED,8EAA8E;AAC9E,sBAAsB;AACtB,SAAS,mBAAmB,CAAC,MAAwB;IACnD,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;IAE9B,IAAI,MAAM,CAAC,QAAQ,EAAE,KAAK,SAAS,EAAE;QACnC,MAAM,IAAA,qBAAa,EAAC,oCAAoC,CAAC,CAAC;KAC3D;IACD,MAAM,KAAK,GAAG,uBAAuB,CAAC,MAAM,CAAC,QAAQ,EAAG,CAAC,CAAC;IAE1D,IAAI,GAAG,CAAC;IACR,IAAI,MAAM,CAAC,MAAM,EAAE,KAAK,SAAS,EAAE;QACjC,IAAI,IAAI,KAAK,EAAE,EAAE;YACf,MAAM,IAAA,qBAAa,EAAC,uCAAuC,CAAC,CAAC;SAC9D;KACF;SAAM;QACL,GAAG,GAAG,uBAAuB,CAAC,MAAM,CAAC,MAAM,EAAG,CAAC,CAAC;QAChD,IAAI,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,EAAE;YAC7B,MAAM,IAAA,qBAAa,EAAC,4CAA4C,CAAC,CAAC;SACnE;KACF;IAED,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;IAEjE,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;IAE7E,OAAO;QACL,IAAI;QACJ,KAAK;QACL,GAAG;QACH,GAAG;QACH,OAAO;KACR,CAAC;AACJ,CAAC;AAED,6DAA6D;AAC7D,SAAS,uBAAuB,CAC9B,MAAuC;IAEvC,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE;QAC1B,IAAI,EAAE,MAAM,CAAC,OAAO,EAAE;QACtB,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE;KAC3B,CAAC;AACJ,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { SourceSpan } from './span';
|
|
2
|
-
/**
|
|
3
|
-
* An exception thrown by Sass.
|
|
4
|
-
*/
|
|
5
|
-
export declare class SassException extends Error {
|
|
6
|
-
readonly message: string;
|
|
7
|
-
private readonly formatted;
|
|
8
|
-
readonly span?: SourceSpan | undefined;
|
|
9
|
-
readonly trace?: string | undefined;
|
|
10
|
-
/**
|
|
11
|
-
* @param message - The error message.
|
|
12
|
-
* @param formatted - The formatted error message. Includes the message, span,
|
|
13
|
-
* and trace.
|
|
14
|
-
* @param [span] - The source span associated with the error.
|
|
15
|
-
* @param [trace] - The trace associated with the error.
|
|
16
|
-
*/
|
|
17
|
-
constructor(message: string, formatted: string, span?: SourceSpan | undefined, trace?: string | undefined);
|
|
18
|
-
toString(): string;
|
|
19
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright 2020 Google Inc. 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.SassException = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* An exception thrown by Sass.
|
|
9
|
-
*/
|
|
10
|
-
class SassException extends Error {
|
|
11
|
-
/**
|
|
12
|
-
* @param message - The error message.
|
|
13
|
-
* @param formatted - The formatted error message. Includes the message, span,
|
|
14
|
-
* and trace.
|
|
15
|
-
* @param [span] - The source span associated with the error.
|
|
16
|
-
* @param [trace] - The trace associated with the error.
|
|
17
|
-
*/
|
|
18
|
-
constructor(message, formatted, span, trace) {
|
|
19
|
-
var _a;
|
|
20
|
-
super(message);
|
|
21
|
-
this.message = message;
|
|
22
|
-
this.formatted = formatted;
|
|
23
|
-
this.span = span;
|
|
24
|
-
this.trace = trace;
|
|
25
|
-
if (formatted === '')
|
|
26
|
-
this.formatted = `Error: ${message}`;
|
|
27
|
-
if (trace === '')
|
|
28
|
-
this.trace = undefined;
|
|
29
|
-
// Inject the entire Sass error into the JS stack trace.
|
|
30
|
-
this.stack = (_a = this.stack) === null || _a === void 0 ? void 0 : _a.replace(new RegExp(`^Error: ${message}`), this.formatted);
|
|
31
|
-
}
|
|
32
|
-
toString() {
|
|
33
|
-
return this.formatted;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.SassException = SassException;
|
|
37
|
-
//# sourceMappingURL=exception.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exception.js","sourceRoot":"","sources":["../../../../lib/src/exception/exception.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAIvC;;GAEG;AACH,MAAa,aAAc,SAAQ,KAAK;IACtC;;;;;;OAMG;IACH,YACW,OAAe,EACP,SAAiB,EACzB,IAAiB,EACjB,KAAc;;QAEvB,KAAK,CAAC,OAAO,CAAC,CAAC;QALN,YAAO,GAAP,OAAO,CAAQ;QACP,cAAS,GAAT,SAAS,CAAQ;QACzB,SAAI,GAAJ,IAAI,CAAa;QACjB,UAAK,GAAL,KAAK,CAAS;QAIvB,IAAI,SAAS,KAAK,EAAE;YAAE,IAAI,CAAC,SAAS,GAAG,UAAU,OAAO,EAAE,CAAC;QAC3D,IAAI,KAAK,KAAK,EAAE;YAAE,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QAEzC,wDAAwD;QACxD,IAAI,CAAC,KAAK,GAAG,MAAA,IAAI,CAAC,KAAK,0CAAE,OAAO,CAC9B,IAAI,MAAM,CAAC,WAAW,OAAO,EAAE,CAAC,EAChC,IAAI,CAAC,SAAS,CACf,CAAC;IACJ,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF;AA7BD,sCA6BC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A single point in a source file.
|
|
3
|
-
*/
|
|
4
|
-
export interface SourceLocation {
|
|
5
|
-
/** 0-based offset of this location within the source file. */
|
|
6
|
-
readonly offset: number;
|
|
7
|
-
/** 0-based line number of this location within the source file. */
|
|
8
|
-
readonly line: number;
|
|
9
|
-
/** 0-based column number of this location within its line. */
|
|
10
|
-
readonly column: number;
|
|
11
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright 2020 Google Inc. 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
|
-
//# sourceMappingURL=location.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"location.js","sourceRoot":"","sources":["../../../../lib/src/exception/location.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { SourceLocation } from './location';
|
|
2
|
-
/**
|
|
3
|
-
* A chunk of a source file.
|
|
4
|
-
*/
|
|
5
|
-
export interface SourceSpan {
|
|
6
|
-
/**
|
|
7
|
-
* The text covered by the span, between `start.offset` and `end.offset` in
|
|
8
|
-
* the source file referred to by `url`.
|
|
9
|
-
*/
|
|
10
|
-
readonly text: string;
|
|
11
|
-
/** The location of the first character in the span. */
|
|
12
|
-
readonly start: SourceLocation;
|
|
13
|
-
/**
|
|
14
|
-
* The location of the first character after the span. If omitted, indicates
|
|
15
|
-
* that the span is empty and points immediately before `start`.
|
|
16
|
-
*/
|
|
17
|
-
readonly end?: SourceLocation;
|
|
18
|
-
/**
|
|
19
|
-
* The URL of the file to which this span refers. If omitted, indicates that
|
|
20
|
-
* the span refers to a string that doesn't specify a URL.
|
|
21
|
-
*/
|
|
22
|
-
readonly url?: string;
|
|
23
|
-
/**
|
|
24
|
-
* Additional source text surrounding the span. Usually contains the full
|
|
25
|
-
* lines the span begins and ends on if the span itself doesn't cover the full
|
|
26
|
-
* lines.
|
|
27
|
-
*/
|
|
28
|
-
readonly context?: string;
|
|
29
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"span.js","sourceRoot":"","sources":["../../../../lib/src/exception/span.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/**
|
|
3
|
-
* Options that are passed to render().
|
|
4
|
-
*
|
|
5
|
-
* This attempts to match the Node Sass render options as closely as possible
|
|
6
|
-
* (see: https://github.com/sass/node-sass#options).
|
|
7
|
-
*/
|
|
8
|
-
export declare type RenderOptions = (FileOptions | StringOptions) & SharedOptions;
|
|
9
|
-
interface FileOptions extends SharedOptions {
|
|
10
|
-
file: string;
|
|
11
|
-
}
|
|
12
|
-
interface StringOptions extends SharedOptions {
|
|
13
|
-
data: string;
|
|
14
|
-
file?: string;
|
|
15
|
-
indentedSyntax?: boolean;
|
|
16
|
-
}
|
|
17
|
-
interface SharedOptions {
|
|
18
|
-
omitSourceMapUrl?: boolean;
|
|
19
|
-
outFile?: string | null;
|
|
20
|
-
sourceMap?: boolean | string;
|
|
21
|
-
sourceMapEmbed?: boolean;
|
|
22
|
-
sourceMapRoot?: string;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* The result returned by render().
|
|
26
|
-
*
|
|
27
|
-
* This attempts to match the Node Sass result object as closely as possible
|
|
28
|
-
* (see: https://github.com/sass/node-sass#result-object).
|
|
29
|
-
*/
|
|
30
|
-
export interface RenderResult {
|
|
31
|
-
css: Buffer;
|
|
32
|
-
map?: Buffer;
|
|
33
|
-
stats: {
|
|
34
|
-
start: number;
|
|
35
|
-
end: number;
|
|
36
|
-
duration: number;
|
|
37
|
-
entry: string;
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* An error thrown by render().
|
|
42
|
-
*
|
|
43
|
-
* This attempts to match the Node Sass error object as closely as possible
|
|
44
|
-
* (see: https://github.com/sass/node-sass#error-object).
|
|
45
|
-
*/
|
|
46
|
-
export interface RenderError extends Error {
|
|
47
|
-
status: number;
|
|
48
|
-
message: string;
|
|
49
|
-
formatted?: string;
|
|
50
|
-
line?: number;
|
|
51
|
-
column?: number;
|
|
52
|
-
file?: string;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Converts Sass to CSS.
|
|
56
|
-
*
|
|
57
|
-
* This attempts to match the Node Sass `render()` API as closely as possible
|
|
58
|
-
* (see: https://github.com/sass/node-sass#usage).
|
|
59
|
-
*/
|
|
60
|
-
export declare function render(options: RenderOptions, callback: (error?: RenderError, result?: RenderResult) => void): void;
|
|
61
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../../../lib/src/node-sass/render.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,0BAA0B;AAE1B,6BAAiD;AAEjD,wCAAkD;AAClD,sDAAqD;AACrD,oCAA8E;AAqE9E;;;;;GAKG;AACH,SAAgB,MAAM,CACpB,OAAsB,EACtB,QAA8D;IAE9D,MAAM,WAAW,GAAG,OAAsB,CAAC;IAC3C,MAAM,aAAa,GAAG,OAAwB,CAAC;IAE/C,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,IAAA,yBAAiB,EAAC,aAAa,CAAC,IAAI,CAAC,EAAE;QAC9D,QAAQ,CACN,cAAc,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC,CAC1E,CAAC;QACF,OAAO;KACR;IAED,IAAI,SAAmC,CAAC;IACxC,MAAM,YAAY,GAAG,qBAAqB,CAAC,OAAO,CAAC;QACjD,CAAC,CAAC,CAAC,GAAiB,EAAE,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC;QAC1C,CAAC,CAAC,SAAS,CAAC;IAEd,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACzB,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI;QACpC,CAAC,CAAC,IAAA,uBAAa,EAAC;YACZ,MAAM,EAAE,aAAa,CAAC,IAAI;YAC1B,SAAS,EAAE,YAAY;YACvB,GAAG,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,IAAA,mBAAa,EAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO;YACrE,MAAM,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM;SAC3D,CAAC;QACJ,CAAC,CAAC,IAAA,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AAC,MAAM,GAAG,CAAC;QAChC,IAAI;KACL,CAAC,CAAC;AACL,CAAC"}
|
package/dist/lib/src/utils.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { List } from 'immutable';
|
|
2
|
-
export declare type PromiseOr<T> = T | Promise<T>;
|
|
3
|
-
/** Checks for null or undefined. */
|
|
4
|
-
export declare function isNullOrUndefined<T>(object: T): boolean;
|
|
5
|
-
/** Returns `collection` as an immutable List. */
|
|
6
|
-
export declare function asImmutableList<T>(collection: T[] | List<T>): List<T>;
|
|
7
|
-
/** Constructs a compiler-caused Error. */
|
|
8
|
-
export declare function compilerError(message: string): Error;
|
|
9
|
-
/** Constructs a host-caused Error. */
|
|
10
|
-
export declare function hostError(message: string): Error;
|
|
11
|
-
/** Constructs an error caused by an invalid value type. */
|
|
12
|
-
export declare function valueError(message: string, name?: string): Error;
|
|
13
|
-
/** Converts a (possibly relative) path on the local filesystem to a URL. */
|
|
14
|
-
export declare function pathToUrlString(path: string): string;
|
|
15
|
-
/** Returns `path` without an extension, if it had one. */
|
|
16
|
-
export declare function withoutExtension(path: string): string;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Value } from './value';
|
|
2
|
-
/**
|
|
3
|
-
* Sass boolean.
|
|
4
|
-
*
|
|
5
|
-
* Cannot be constructed; exists only as an interface and the exported
|
|
6
|
-
* singletons.
|
|
7
|
-
*/
|
|
8
|
-
export interface SassBoolean extends Value {
|
|
9
|
-
readonly value: boolean;
|
|
10
|
-
}
|
|
11
|
-
declare class SassBooleanInternal extends Value implements SassBoolean {
|
|
12
|
-
private readonly valueInternal;
|
|
13
|
-
constructor(valueInternal: boolean);
|
|
14
|
-
get value(): boolean;
|
|
15
|
-
get isTruthy(): boolean;
|
|
16
|
-
assertBoolean(): SassBoolean;
|
|
17
|
-
equals(other: Value): boolean;
|
|
18
|
-
hashCode(): number;
|
|
19
|
-
toString(): string;
|
|
20
|
-
}
|
|
21
|
-
/** The singleton instance of SassScript true. */
|
|
22
|
-
export declare const sassTrue: SassBooleanInternal;
|
|
23
|
-
/** The singleton instance of SassScript false. */
|
|
24
|
-
export declare const sassFalse: SassBooleanInternal;
|
|
25
|
-
export {};
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { Value } from './value';
|
|
2
|
-
/** A SassScript color. */
|
|
3
|
-
export declare class SassColor extends Value {
|
|
4
|
-
private redInternal?;
|
|
5
|
-
private greenInternal?;
|
|
6
|
-
private blueInternal?;
|
|
7
|
-
private hueInternal?;
|
|
8
|
-
private saturationInternal?;
|
|
9
|
-
private lightnessInternal?;
|
|
10
|
-
private readonly alphaInternal;
|
|
11
|
-
private constructor();
|
|
12
|
-
/**
|
|
13
|
-
* Creates an RGB color.
|
|
14
|
-
*
|
|
15
|
-
* Throws an error if `red`, `green`, and `blue` aren't between `0` and `255`,
|
|
16
|
-
* or if `alpha` isn't between `0` and `1`.
|
|
17
|
-
*/
|
|
18
|
-
static rgb(red: number, green: number, blue: number, alpha?: number): SassColor;
|
|
19
|
-
/**
|
|
20
|
-
* Creates an HSL color.
|
|
21
|
-
*
|
|
22
|
-
* Throws an error if `saturation` or `lightness` aren't between `0` and
|
|
23
|
-
* `100`, or if `alpha` isn't between `0` and `1`.
|
|
24
|
-
*/
|
|
25
|
-
static hsl(hue: number, saturation: number, lightness: number, alpha?: number): SassColor;
|
|
26
|
-
/**
|
|
27
|
-
* Creates an HWB color.
|
|
28
|
-
*
|
|
29
|
-
* Throws an error if `whiteness` or `blackness` aren't between `0` and `100`,
|
|
30
|
-
* or if `alpha` isn't between `0` and `1`.
|
|
31
|
-
*/
|
|
32
|
-
static hwb(hue: number, whiteness: number, blackness: number, alpha?: number): SassColor;
|
|
33
|
-
/** `this`'s red channel. */
|
|
34
|
-
get red(): number;
|
|
35
|
-
/** `this`'s blue channel. */
|
|
36
|
-
get blue(): number;
|
|
37
|
-
/** `this`'s green channel. */
|
|
38
|
-
get green(): number;
|
|
39
|
-
/** `this`'s hue value. */
|
|
40
|
-
get hue(): number;
|
|
41
|
-
/** `this`'s saturation value. */
|
|
42
|
-
get saturation(): number;
|
|
43
|
-
/** `this`'s hue value. */
|
|
44
|
-
get lightness(): number;
|
|
45
|
-
/** `this`'s whiteness value. */
|
|
46
|
-
get whiteness(): number;
|
|
47
|
-
/** `this`'s blackness value. */
|
|
48
|
-
get blackness(): number;
|
|
49
|
-
/** `this`'s alpha channel. */
|
|
50
|
-
get alpha(): number;
|
|
51
|
-
assertColor(): SassColor;
|
|
52
|
-
/**
|
|
53
|
-
* Returns a copy of `this` with its RGB channels changed to `red`, `green`,
|
|
54
|
-
* `blue`, and/or `alpha`.
|
|
55
|
-
*/
|
|
56
|
-
changeRgb(options: {
|
|
57
|
-
red?: number;
|
|
58
|
-
green?: number;
|
|
59
|
-
blue?: number;
|
|
60
|
-
alpha?: number;
|
|
61
|
-
}): SassColor;
|
|
62
|
-
/**
|
|
63
|
-
* Returns a copy of `this` with its HSL values changed to `hue`,
|
|
64
|
-
* `saturation`, `lightness`, and/or `alpha`.
|
|
65
|
-
*/
|
|
66
|
-
changeHsl(options: {
|
|
67
|
-
hue?: number;
|
|
68
|
-
saturation?: number;
|
|
69
|
-
lightness?: number;
|
|
70
|
-
alpha?: number;
|
|
71
|
-
}): SassColor;
|
|
72
|
-
/**
|
|
73
|
-
* Returns a copy of `this` with its HWB values changed to `hue`, `whiteness`,
|
|
74
|
-
* `blackness`, and/or `alpha`.
|
|
75
|
-
*/
|
|
76
|
-
changeHwb(options: {
|
|
77
|
-
hue?: number;
|
|
78
|
-
whiteness?: number;
|
|
79
|
-
blackness?: number;
|
|
80
|
-
alpha?: number;
|
|
81
|
-
}): SassColor;
|
|
82
|
-
/** Returns a copy of `this` with its alpha channel changed to `alpha`. */
|
|
83
|
-
changeAlpha(alpha: number): SassColor;
|
|
84
|
-
equals(other: Value): boolean;
|
|
85
|
-
hashCode(): number;
|
|
86
|
-
toString(): string;
|
|
87
|
-
private rgbToHsl;
|
|
88
|
-
private hslToRgb;
|
|
89
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { List, OrderedMap } from 'immutable';
|
|
2
|
-
import { Value } from './value';
|
|
3
|
-
import { SassMap } from './map';
|
|
4
|
-
/** The types of separator that a SassList can have. */
|
|
5
|
-
export declare type ListSeparator = ',' | '/' | ' ' | null;
|
|
6
|
-
/** A SassScript list. */
|
|
7
|
-
export declare class SassList extends Value {
|
|
8
|
-
private readonly contentsInternal;
|
|
9
|
-
private readonly separatorInternal;
|
|
10
|
-
private readonly hasBracketsInternal;
|
|
11
|
-
/**
|
|
12
|
-
* Returns a list that contains `contents`, with the given `separator` and
|
|
13
|
-
* `brackets`.
|
|
14
|
-
*/
|
|
15
|
-
constructor(contents: Value[] | List<Value>, options?: {
|
|
16
|
-
/** @default ',' */ separator?: ListSeparator;
|
|
17
|
-
/** @default false */ brackets?: boolean;
|
|
18
|
-
});
|
|
19
|
-
/** Returns an empty list with the given `separator` and `brackets`. */
|
|
20
|
-
static empty(options?: {
|
|
21
|
-
/** @default null */ separator?: ListSeparator;
|
|
22
|
-
/** @default false */ brackets?: boolean;
|
|
23
|
-
}): SassList;
|
|
24
|
-
get asList(): List<Value>;
|
|
25
|
-
/** Whether `this` has brackets. */
|
|
26
|
-
get hasBrackets(): boolean;
|
|
27
|
-
/** `this`'s list separator. */
|
|
28
|
-
get separator(): ListSeparator;
|
|
29
|
-
protected get lengthAsList(): number;
|
|
30
|
-
assertList(): SassList;
|
|
31
|
-
assertMap(name?: string): SassMap;
|
|
32
|
-
/**
|
|
33
|
-
* If `this` is empty, returns an empty OrderedMap.
|
|
34
|
-
*
|
|
35
|
-
* Otherwise, returns null.
|
|
36
|
-
*/
|
|
37
|
-
tryMap(): OrderedMap<Value, Value> | null;
|
|
38
|
-
equals(other: Value): boolean;
|
|
39
|
-
hashCode(): number;
|
|
40
|
-
toString(): string;
|
|
41
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { List, OrderedMap } from 'immutable';
|
|
2
|
-
import { Value } from './value';
|
|
3
|
-
import { ListSeparator } from './list';
|
|
4
|
-
/** A SassScript map */
|
|
5
|
-
export declare class SassMap extends Value {
|
|
6
|
-
private readonly contentsInternal;
|
|
7
|
-
/** Returns a map that contains `contents`. */
|
|
8
|
-
constructor(contents: OrderedMap<Value, Value>);
|
|
9
|
-
/** Returns an empty map. */
|
|
10
|
-
static empty(): SassMap;
|
|
11
|
-
/** The separator for `this`'s contents as a list. */
|
|
12
|
-
get separator(): ListSeparator;
|
|
13
|
-
/** `this`'s contents. */
|
|
14
|
-
get contents(): OrderedMap<Value, Value>;
|
|
15
|
-
/**
|
|
16
|
-
* Returns an immutable list of `contents`'s keys and values as two-element
|
|
17
|
-
* `SassList`s.
|
|
18
|
-
*/
|
|
19
|
-
get asList(): List<Value>;
|
|
20
|
-
protected get lengthAsList(): number;
|
|
21
|
-
assertMap(): SassMap;
|
|
22
|
-
tryMap(): OrderedMap<Value, Value>;
|
|
23
|
-
equals(other: Value): boolean;
|
|
24
|
-
hashCode(): number;
|
|
25
|
-
toString(): string;
|
|
26
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Value } from './value';
|
|
2
|
-
declare class SassNull extends Value {
|
|
3
|
-
constructor();
|
|
4
|
-
get isTruthy(): boolean;
|
|
5
|
-
get realNull(): null;
|
|
6
|
-
equals(other: Value): boolean;
|
|
7
|
-
hashCode(): number;
|
|
8
|
-
toString(): string;
|
|
9
|
-
}
|
|
10
|
-
/** The singleton instance of SassScript null. */
|
|
11
|
-
export declare const sassNull: SassNull;
|
|
12
|
-
export {};
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import { List } from 'immutable';
|
|
2
|
-
import { Value } from './value';
|
|
3
|
-
/** A SassScript number. */
|
|
4
|
-
export declare class SassNumber extends Value {
|
|
5
|
-
private valueInternal;
|
|
6
|
-
private numeratorUnitsInternal;
|
|
7
|
-
private denominatorUnitsInternal;
|
|
8
|
-
/** Creates a number, optionally with a single numerator unit. */
|
|
9
|
-
constructor(value: number, unit?: string);
|
|
10
|
-
/**
|
|
11
|
-
* Creates a number with `numeratorUnits` and `denominatorUnits`.
|
|
12
|
-
*
|
|
13
|
-
* Upon construction, any compatible numerator and denominator units are
|
|
14
|
-
* simplified away according to the conversion factor between them.
|
|
15
|
-
*/
|
|
16
|
-
static withUnits(value: number, options?: {
|
|
17
|
-
numeratorUnits?: string[] | List<string>;
|
|
18
|
-
denominatorUnits?: string[] | List<string>;
|
|
19
|
-
}): SassNumber;
|
|
20
|
-
/** `this`'s value. */
|
|
21
|
-
get value(): number;
|
|
22
|
-
/** Whether `value` is an integer. */
|
|
23
|
-
get isInt(): boolean;
|
|
24
|
-
/**
|
|
25
|
-
* If `value` is an integer according to `isInt`, returns `value` rounded to
|
|
26
|
-
* that integer.
|
|
27
|
-
*
|
|
28
|
-
* Otherwise, returns null.
|
|
29
|
-
*/
|
|
30
|
-
get asInt(): number | null;
|
|
31
|
-
/** `this`'s numerator units. */
|
|
32
|
-
get numeratorUnits(): List<string>;
|
|
33
|
-
/** `this`'s denominator units. */
|
|
34
|
-
get denominatorUnits(): List<string>;
|
|
35
|
-
/** Whether `this` has any units. */
|
|
36
|
-
get hasUnits(): boolean;
|
|
37
|
-
assertNumber(): SassNumber;
|
|
38
|
-
/**
|
|
39
|
-
* If `value` is an integer according to `isInt`, returns it as an integer.
|
|
40
|
-
*
|
|
41
|
-
* Otherwise, throws an error.
|
|
42
|
-
*
|
|
43
|
-
* If `this` came from a function argument, `name` is the argument name
|
|
44
|
-
* (without the `$`) and is used for error reporting.
|
|
45
|
-
*/
|
|
46
|
-
assertInt(name?: string): number;
|
|
47
|
-
/**
|
|
48
|
-
* If `value` is within `min` and `max`, returns `value`, or if it
|
|
49
|
-
* `fuzzyEquals` `min` or `max`, returns `value` clamped to that value.
|
|
50
|
-
*
|
|
51
|
-
* Otherwise, throws an error.
|
|
52
|
-
*
|
|
53
|
-
* If `this` came from a function argument, `name` is the argument name
|
|
54
|
-
* (without the `$`) and is used for error reporting.
|
|
55
|
-
*/
|
|
56
|
-
assertInRange(min: number, max: number, name?: string): number;
|
|
57
|
-
/**
|
|
58
|
-
* If `this` has no units, returns `this`.
|
|
59
|
-
*
|
|
60
|
-
* Otherwise, throws an error.
|
|
61
|
-
*
|
|
62
|
-
* If `this` came from a function argument, `name` is the argument name
|
|
63
|
-
* (without the `$`) and is used for error reporting.
|
|
64
|
-
*/
|
|
65
|
-
assertNoUnits(name?: string): SassNumber;
|
|
66
|
-
/**
|
|
67
|
-
* If `this` has `unit` as its only unit (and as a numerator), returns `this`.
|
|
68
|
-
*
|
|
69
|
-
* Otherwise, throws an error.
|
|
70
|
-
*
|
|
71
|
-
* If `this` came from a function argument, `name` is the argument name
|
|
72
|
-
* (without the `$`) and is used for error reporting.
|
|
73
|
-
*/
|
|
74
|
-
assertUnit(unit: string, name?: string): SassNumber;
|
|
75
|
-
/** Whether `this` has `unit` as its only unit (and as a numerator). */
|
|
76
|
-
hasUnit(unit: string): boolean;
|
|
77
|
-
/** Whether `this` is compatible with `unit`. */
|
|
78
|
-
compatibleWithUnit(unit: string): boolean;
|
|
79
|
-
/**
|
|
80
|
-
* Returns a copy of `this`, converted to the units represented by
|
|
81
|
-
* `newNumerators` and `newDenominators`.
|
|
82
|
-
*
|
|
83
|
-
* Throws an error if `this`'s units are incompatible with `newNumerators` and
|
|
84
|
-
* `newDenominators`. Also throws an error if `this` is unitless and either
|
|
85
|
-
* `newNumerators` or `newDenominators` are not empty, or vice-versa.
|
|
86
|
-
*
|
|
87
|
-
* If `this` came from a function argument, `name` is the argument name
|
|
88
|
-
* (without the `$`) and is used for error reporting.
|
|
89
|
-
*/
|
|
90
|
-
convert(newNumerators: string[] | List<string>, newDenominators: string[] | List<string>, name?: string): SassNumber;
|
|
91
|
-
/**
|
|
92
|
-
* Returns `value`, converted to the units represented by `newNumerators` and
|
|
93
|
-
* `newDenominators`.
|
|
94
|
-
*
|
|
95
|
-
* Throws an error if `this`'s units are incompatible with `newNumerators` and
|
|
96
|
-
* `newDenominators`. Also throws an error if `this` is unitless and either
|
|
97
|
-
* `newNumerators` or `newDenominators` are not empty, or vice-versa.
|
|
98
|
-
*
|
|
99
|
-
* If `this` came from a function argument, `name` is the argument name
|
|
100
|
-
* (without the `$`) and is used for error reporting.
|
|
101
|
-
*/
|
|
102
|
-
convertValue(newNumerators: string[] | List<string>, newDenominators: string[] | List<string>, name?: string): number;
|
|
103
|
-
/**
|
|
104
|
-
* Returns a copy of `this`, converted to the same units as `other`.
|
|
105
|
-
*
|
|
106
|
-
* Throws an error if `this`'s units are incompatible with `other`'s units, or
|
|
107
|
-
* if either number is unitless but the other is not.
|
|
108
|
-
*
|
|
109
|
-
* If `this` came from a function argument, `name` is the argument name
|
|
110
|
-
* and `otherName` is the argument name for `other` (both without the `$`).
|
|
111
|
-
* They are used for error reporting.
|
|
112
|
-
*/
|
|
113
|
-
convertToMatch(other: SassNumber, name?: string, otherName?: string): SassNumber;
|
|
114
|
-
/**
|
|
115
|
-
* Returns `value`, converted to the same units as `other`.
|
|
116
|
-
*
|
|
117
|
-
* Throws an error if `this`'s units are incompatible with `other`'s units, or
|
|
118
|
-
* if either number is unitless but the other is not.
|
|
119
|
-
*
|
|
120
|
-
* If `this` came from a function argument, `name` is the argument name
|
|
121
|
-
* and `otherName` is the argument name for `other` (both without the `$`).
|
|
122
|
-
* They are used for error reporting.
|
|
123
|
-
*/
|
|
124
|
-
convertValueToMatch(other: SassNumber, name?: string, otherName?: string): number;
|
|
125
|
-
/**
|
|
126
|
-
* Returns a copy of `this`, converted to the units represented by
|
|
127
|
-
* `newNumerators` and `newDenominators`.
|
|
128
|
-
*
|
|
129
|
-
* Does *not* throw an error if this number is unitless and either
|
|
130
|
-
* `newNumerators` or `newDenominators` are not empty, or vice-versa. Instead,
|
|
131
|
-
* it treats all unitless numbers as convertible to and from all units
|
|
132
|
-
* without changing the value.
|
|
133
|
-
*
|
|
134
|
-
* Throws an error if `this`'s units are incompatible with `newNumerators` and
|
|
135
|
-
* `newDenominators`.
|
|
136
|
-
*
|
|
137
|
-
* If `this` came from a function argument, `name` is the argument name
|
|
138
|
-
* (without the `$`) and is used for error reporting.
|
|
139
|
-
*/
|
|
140
|
-
coerce(newNumerators: string[] | List<string>, newDenominators: string[] | List<string>, name?: string): SassNumber;
|
|
141
|
-
/**
|
|
142
|
-
* Returns `value`, converted to the units represented by `newNumerators` and
|
|
143
|
-
* `newDenominators`.
|
|
144
|
-
*
|
|
145
|
-
* Does *not* throw an error if this number is unitless and either
|
|
146
|
-
* `newNumerators` or `newDenominators` are not empty, or vice-versa. Instead,
|
|
147
|
-
* it treats all unitless numbers as convertible to and from all units
|
|
148
|
-
* without changing the value.
|
|
149
|
-
*
|
|
150
|
-
* Throws an error if `this`'s units are incompatible with `newNumerators` and
|
|
151
|
-
* `newDenominators`.
|
|
152
|
-
*
|
|
153
|
-
* If `this` came from a function argument, `name` is the argument name
|
|
154
|
-
* (without the `$`) and is used for error reporting.
|
|
155
|
-
*/
|
|
156
|
-
coerceValue(newNumerators: string[] | List<string>, newDenominators: string[] | List<string>, name?: string): number;
|
|
157
|
-
/**
|
|
158
|
-
* Returns a copy of `this`, converted to the same units as `other`.
|
|
159
|
-
*
|
|
160
|
-
* Does *not* throw an error if `this` is unitless and `other` is not, or
|
|
161
|
-
* vice-versa. Instead, it treats all unitless numbers as convertible to and
|
|
162
|
-
* from all units without changing the value.
|
|
163
|
-
*
|
|
164
|
-
* Throws an error if `this`'s units are incompatible with `other`'s units.
|
|
165
|
-
*
|
|
166
|
-
* If `this` came from a function argument, `name` is the argument name
|
|
167
|
-
* and `otherName` is the argument name for `other` (both without the `$`).
|
|
168
|
-
* They are used for error reporting.
|
|
169
|
-
*/
|
|
170
|
-
coerceToMatch(other: SassNumber, name?: string, otherName?: string): SassNumber;
|
|
171
|
-
/**
|
|
172
|
-
* Returns `value`, converted to the same units as `other`.
|
|
173
|
-
*
|
|
174
|
-
* Does *not* throw an error if `this` is unitless and `other` is not, or
|
|
175
|
-
* vice-versa. Instead, it treats all unitless numbers as convertible to and
|
|
176
|
-
* from all units without changing the value.
|
|
177
|
-
*
|
|
178
|
-
* Throws an error if `this`'s units are incompatible with `other`'s units.
|
|
179
|
-
*
|
|
180
|
-
* If `this` came from a function argument, `name` is the argument name
|
|
181
|
-
* and `otherName` is the argument name for `other` (both without the `$`).
|
|
182
|
-
* They are used for error reporting.
|
|
183
|
-
*/
|
|
184
|
-
coerceValueToMatch(other: SassNumber, name?: string, otherName?: string): number;
|
|
185
|
-
equals(other: Value): boolean;
|
|
186
|
-
hashCode(): number;
|
|
187
|
-
toString(): string;
|
|
188
|
-
private convertOrCoerce;
|
|
189
|
-
}
|