sass-embedded
Advanced tools
Comparing version 1.0.0-beta.1 to 1.0.0-beta.3
@@ -0,4 +1,16 @@ | ||
## 1.0.0-beta.3 | ||
- Properly handle `data:` URIs in sourceMap sources. | ||
- Function and Values API | ||
- Add `Value` abstract class. | ||
- Add `sassNull` singleton. | ||
## 1.0.0-beta.2 | ||
- No user visible changes. | ||
## 1.0.0-beta.1 | ||
- Downlaod the compiler binary to the correct directory on Windows. | ||
- Download the compiler binary to the correct directory on Windows. | ||
@@ -5,0 +17,0 @@ ## 1.0.0-beta.0 |
@@ -7,7 +7,7 @@ "use strict"; | ||
const url_1 = require("url"); | ||
const compiler_1 = require("./embedded/compiler"); | ||
const dispatcher_1 = require("./embedded/dispatcher"); | ||
const message_transformer_1 = require("./embedded/message-transformer"); | ||
const packet_transformer_1 = require("./embedded/packet-transformer"); | ||
const utils_1 = require("./utils"); | ||
const compiler_1 = require("./embedded-compiler/compiler"); | ||
const packet_transformer_1 = require("./embedded-compiler/packet-transformer"); | ||
const message_transformer_1 = require("./embedded-protocol/message-transformer"); | ||
const dispatcher_1 = require("./embedded-protocol/dispatcher"); | ||
const utils_1 = require("./embedded-protocol/utils"); | ||
const embedded_sass_pb_1 = require("./vendor/embedded-protocol/embedded_sass_pb"); | ||
@@ -14,0 +14,0 @@ /** |
@@ -67,5 +67,6 @@ "use strict"; | ||
sourceMap.sources = sourceMap.sources.map(source => { | ||
if (source === 'stdin') | ||
return source; | ||
return p.relative(sourceMapDir, url_1.fileURLToPath(source)); | ||
if (source.startsWith('file://')) { | ||
return p.relative(sourceMapDir, url_1.fileURLToPath(source)); | ||
} | ||
return source; | ||
}); | ||
@@ -72,0 +73,0 @@ sourceMapBytes = Buffer.from(JSON.stringify(sourceMap)); |
@@ -1,3 +0,1 @@ | ||
import { SassException } from './exception/exception'; | ||
import * as proto from './vendor/embedded-protocol/embedded_sass_pb'; | ||
export declare type PromiseOr<T> = T | Promise<T>; | ||
@@ -10,6 +8,3 @@ /** Checks for null or undefined. */ | ||
export declare function hostError(message: string): Error; | ||
/** | ||
* Creates a SassException from the given protocol `buffer`. Throws if the | ||
* buffer has invalid fields. | ||
*/ | ||
export declare function deprotifyException(buffer: proto.OutboundMessage.CompileResponse.CompileFailure): SassException; | ||
/** Constructs an error caused by an invalid value type. */ | ||
export declare function valueError(message: string, name?: string): Error; |
@@ -6,3 +6,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const exception_1 = require("./exception/exception"); | ||
/** Checks for null or undefined. */ | ||
@@ -23,49 +22,7 @@ function isNullOrUndefined(object) { | ||
exports.hostError = hostError; | ||
/** | ||
* Creates a SassException from the given protocol `buffer`. Throws if the | ||
* buffer has invalid fields. | ||
*/ | ||
function deprotifyException(buffer) { | ||
const span = buffer.getSpan(); | ||
return new exception_1.SassException(buffer.getMessage(), buffer.getFormatted(), span ? deprotifySourceSpan(span) : undefined, buffer.getStackTrace()); | ||
/** Constructs an error caused by an invalid value type. */ | ||
function valueError(message, name) { | ||
return Error(name ? `$${name}: ${message}.` : `${message}.`); | ||
} | ||
exports.deprotifyException = deprotifyException; | ||
// Creates a SourceSpan from the given protocol `buffer`. Throws if the buffer | ||
// has invalid fields. | ||
function deprotifySourceSpan(buffer) { | ||
const text = buffer.getText(); | ||
if (buffer.getStart() === undefined) { | ||
throw compilerError('Expected SourceSpan to have start.'); | ||
} | ||
const start = deprotifySourceLocation(buffer.getStart()); | ||
let end; | ||
if (buffer.getEnd() === undefined) { | ||
if (text !== '') { | ||
throw compilerError('Expected SourceSpan text to be empty.'); | ||
} | ||
} | ||
else { | ||
end = deprotifySourceLocation(buffer.getEnd()); | ||
if (end.offset < start.offset) { | ||
throw compilerError('Expected SourceSpan end to be after start.'); | ||
} | ||
} | ||
const url = buffer.getUrl() === '' ? undefined : buffer.getUrl(); | ||
const context = buffer.getContext() === '' ? undefined : buffer.getContext(); | ||
return { | ||
text, | ||
start, | ||
end, | ||
url, | ||
context, | ||
}; | ||
} | ||
// Creates a SourceLocation from the given protocol `buffer`. | ||
function deprotifySourceLocation(buffer) { | ||
return { | ||
offset: buffer.getOffset(), | ||
line: buffer.getLine(), | ||
column: buffer.getColumn(), | ||
}; | ||
} | ||
exports.valueError = valueError; | ||
//# sourceMappingURL=utils.js.map |
/** | ||
* Gets the latest version of the Embedded Protocol. Throws if an error occurs. | ||
* | ||
* @param version - The Git ref to check out and build. Defaults to `master`. | ||
* @param version - The Git ref to check out and build. Defaults to `main`. | ||
* @param path - Build from this path instead of pulling from Github. | ||
@@ -20,3 +20,3 @@ * @param release - Download the latest release instead of building from source. | ||
* download (defaults to the latest version). If it's false, the Git ref to | ||
* check out and build (defaults to master). | ||
* check out and build (defaults to main). | ||
* @param path - Build from this path instead of pulling from Github. | ||
@@ -23,0 +23,0 @@ * @param release - Download the latest release instead of building from source. |
@@ -49,3 +49,3 @@ "use strict"; | ||
* | ||
* @param version - The Git ref to check out and build. Defaults to `master`. | ||
* @param version - The Git ref to check out and build. Defaults to `main`. | ||
* @param path - Build from this path instead of pulling from Github. | ||
@@ -89,3 +89,3 @@ * @param release - Download the latest release instead of building from source. | ||
* download (defaults to the latest version). If it's false, the Git ref to | ||
* check out and build (defaults to master). | ||
* check out and build (defaults to main). | ||
* @param path - Build from this path instead of pulling from Github. | ||
@@ -196,3 +196,3 @@ * @param release - Download the latest release instead of building from source. | ||
console.log(`Fetching ${version} for ${options.repo}.`); | ||
shell.exec(`git fetch --depth=1 origin ${(_a = options.ref) !== null && _a !== void 0 ? _a : 'master'}`, { | ||
shell.exec(`git fetch --depth=1 origin ${(_a = options.ref) !== null && _a !== void 0 ? _a : 'main'}`, { | ||
silent: true, | ||
@@ -199,0 +199,0 @@ cwd: p.join(options.outPath, options.repo), |
{ | ||
"name": "sass-embedded", | ||
"version": "1.0.0-beta.1", | ||
"compiler-version": "1.0.0-beta.7", | ||
"version": "1.0.0-beta.3", | ||
"compiler-version": "1.0.0-beta.9", | ||
"description": "Node.js library that communicates with Embedded Dart Sass using the Embedded Sass protocol", | ||
@@ -16,6 +16,6 @@ "repository": "sass/embedded-host-node", | ||
"engines": { | ||
"node": ">=12.18.2" | ||
"node": ">=14.0.0" | ||
}, | ||
"scripts": { | ||
"build": "ts-node ./tool/prepare-dev-environment.ts", | ||
"init": "ts-node ./tool/prepare-dev-environment.ts", | ||
"check": "gts check", | ||
@@ -22,0 +22,0 @@ "clean": "gts clean", |
@@ -9,6 +9,6 @@ ## Embedded Sass Host | ||
[Embedded Sass protocol]: https://github.com/sass/sass-embedded-protocol/blob/master/README.md#readme | ||
[Dart Sass]: https://sass-lang.com/dart-sass | ||
[Dart Sass compiled to JavaScript]: https://www.npmjs.com/package/sass | ||
[embedded sass protocol]: https://github.com/sass/sass-embedded-protocol/blob/main/README.md#readme | ||
[dart sass]: https://sass-lang.com/dart-sass | ||
[dart sass compiled to javascript]: https://www.npmjs.com/package/sass | ||
Disclaimer: this is not an official Google product. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
680923
57
9834