Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sass-embedded

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sass-embedded - npm Package Compare versions

Comparing version 1.0.0-beta.3 to 1.0.0-beta.4

dist/lib/src/value/boolean.d.ts

9

CHANGELOG.md

@@ -0,1 +1,10 @@

## 1.0.0-beta.4
- Allow installing on arm64.
- Function and Values API
- Add `sassTrue` and `sassFalse` singletons.
- Add `SassNumber` class.
- Add `SassString` class.
## 1.0.0-beta.3

@@ -2,0 +11,0 @@

@@ -0,1 +1,7 @@

export { Value } from './src/value/value';
export { SassBoolean, sassFalse, sassTrue } from './src/value/boolean';
export { sassNull } from './src/value/null';
export { SassNumber } from './src/value/number';
export { SassString } from './src/value/string';
export { render, RenderOptions, RenderResult, RenderError, } from './src/node-sass/render';
export declare const info: string;

@@ -6,4 +6,17 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const pkg = require("../package.json");
var value_1 = require("./src/value/value");
exports.Value = value_1.Value;
var boolean_1 = require("./src/value/boolean");
exports.sassFalse = boolean_1.sassFalse;
exports.sassTrue = boolean_1.sassTrue;
var null_1 = require("./src/value/null");
exports.sassNull = null_1.sassNull;
var number_1 = require("./src/value/number");
exports.SassNumber = number_1.SassNumber;
var string_1 = require("./src/value/string");
exports.SassString = string_1.SassString;
var render_1 = require("./src/node-sass/render");
exports.render = render_1.render;
exports.info = `sass-embedded\t${pkg.version}`;
//# sourceMappingURL=index.js.map

3

dist/lib/src/utils.d.ts

@@ -0,4 +1,7 @@

import { List } from 'immutable';
export declare type PromiseOr<T> = T | Promise<T>;
/** Checks for null or undefined. */
export declare function isNullOrUndefined<T>(object: T): boolean;
/** Returns `collection` as an immutable List. */
export declare function asImmutableList<T>(collection: T[] | List<T>): List<T>;
/** Constructs a compiler-caused Error. */

@@ -5,0 +8,0 @@ export declare function compilerError(message: string): Error;

@@ -6,2 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const immutable_1 = require("immutable");
/** Checks for null or undefined. */

@@ -12,2 +13,7 @@ function isNullOrUndefined(object) {

exports.isNullOrUndefined = isNullOrUndefined;
/** Returns `collection` as an immutable List. */
function asImmutableList(collection) {
return immutable_1.List.isList(collection) ? collection : immutable_1.List(collection);
}
exports.asImmutableList = asImmutableList;
/** Constructs a compiler-caused Error. */

@@ -14,0 +20,0 @@ function compilerError(message) {

3

dist/lib/src/value/null.d.ts
import { Value } from './value';
declare class SassNull extends Value {
private readonly _hashCode;
constructor();
get isTruthy(): boolean;

@@ -8,2 +8,3 @@ get realNull(): null;

hashCode(): number;
toString(): string;
}

@@ -10,0 +11,0 @@ /** The singleton instance of SassScript null. */

@@ -8,2 +8,3 @@ "use strict";

const value_1 = require("./value");
const hashCode = immutable_1.hash(null);
// SassScript null. Cannot be constructed; exists only as the exported

@@ -13,4 +14,4 @@ // singleton.

constructor() {
super(...arguments);
this._hashCode = immutable_1.hash(null);
super();
Object.freeze(this);
}

@@ -27,8 +28,10 @@ get isTruthy() {

hashCode() {
return this._hashCode;
return hashCode;
}
toString() {
return 'sassNull';
}
}
/** The singleton instance of SassScript null. */
exports.sassNull = new SassNull();
Object.freeze(exports.sassNull);
//# sourceMappingURL=null.js.map
import { List, OrderedMap, ValueObject } from 'immutable';
import { SassBoolean } from './boolean';
import { SassNumber } from './number';
import { SassString } from './string';
/**

@@ -52,3 +55,3 @@ * A SassScript value.

*/
assertBoolean(name?: string): Value;
assertBoolean(name?: string): SassBoolean;
/**

@@ -87,3 +90,3 @@ * Casts `this` to `SassColor`; throws if `this` isn't a color.

*/
assertNumber(name?: string): Value;
assertNumber(name?: string): SassNumber;
/**

@@ -95,3 +98,3 @@ * Casts `this` to `SassString`; throws if `this` isn't a string.

*/
assertString(name?: string): Value;
assertString(name?: string): SassString;
/** Whether `this == other` in SassScript. */

@@ -101,2 +104,4 @@ abstract equals(other: Value): boolean;

abstract hashCode(): number;
/** A meaningful descriptor for this value. */
abstract toString(): string;
}

@@ -74,3 +74,2 @@ "use strict";

throw utils_1.valueError(`${this} is not a boolean`, name);
// TODO(awjin): Narrow the return type to SassBoolean.
}

@@ -123,3 +122,2 @@ /**

throw utils_1.valueError(`${this} is not a number`, name);
// TODO(awjin): Narrow the return type to SassNumber.
}

@@ -134,3 +132,2 @@ /**

throw utils_1.valueError(`${this} is not a string`, name);
// TODO(awjin): Narrow the return type to SassString.
}

@@ -137,0 +134,0 @@ }

/**
* Gets the latest version of the Embedded Protocol. Throws if an error occurs.
* Gets the Embedded Protocol.
*
* @param version - The Git ref to check out and build. Defaults to `main`.
* @param path - Build from this path instead of pulling from Github.
* @param release - Download the latest release instead of building from source.
* Can download the release `version`, check out and build the source from a Git
* `ref`, or build from the source at `path`.
*
* By default, downloads the release version specified in package.json. Throws
* if an error occurs.
*/
export declare function getEmbeddedProtocol(options: {
outPath: string;
version?: string;
path?: string;
release?: boolean;
export declare function getEmbeddedProtocol(outPath: string, options?: {
version: string;
} | {
ref: string;
} | {
path: string;
}): Promise<void>;
/**
* Gets the latest version of the Dart Sass wrapper for the Embedded Compiler.
* Throws if an error occurs.
* Gets the Dart Sass wrapper for the Embedded Compiler.
*
* @param version - If `release` is true, the version of the released binary to
* download (defaults to the latest version). If it's false, the Git ref to
* check out and build (defaults to main).
* @param path - Build from this path instead of pulling from Github.
* @param release - Download the latest release instead of building from source.
* Can download the release `version`, check out and build the source from a Git
* `ref`, or build from the source at `path`.
*
* By default, downloads the release version specified in package.json. Throws
* if an error occurs.
*/
export declare function getDartSassEmbedded(options: {
outPath: string;
version?: string;
path?: string;
release?: boolean;
export declare function getDartSassEmbedded(outPath: string, options?: {
version: string;
} | {
ref: string;
} | {
path: string;
}): Promise<void>;

@@ -10,5 +10,5 @@ "use strict";

const p = require("path");
const semver_1 = require("semver");
const shell = require("shelljs");
const tar_1 = require("tar");
const pkg = require("../package.json");
shell.config.fatal = true;

@@ -39,2 +39,7 @@ // The current platform's operating system. Throws if the operating system

return 'x64';
// TODO: This is blocked until Github Actions supports compiling Dart Sass
// for arm64. Until then, download the x64 binary for arm64 users.
// https://github.com/sass/dart-sass/issues/1125
case 'arm64':
return 'x64';
default:

@@ -49,108 +54,70 @@ throw Error(`Architecure ${process.arch} is not supported.`);

/**
* Gets the latest version of the Embedded Protocol. Throws if an error occurs.
* Gets the Embedded Protocol.
*
* @param version - The Git ref to check out and build. Defaults to `main`.
* @param path - Build from this path instead of pulling from Github.
* @param release - Download the latest release instead of building from source.
* Can download the release `version`, check out and build the source from a Git
* `ref`, or build from the source at `path`.
*
* By default, downloads the release version specified in package.json. Throws
* if an error occurs.
*/
async function getEmbeddedProtocol(options) {
async function getEmbeddedProtocol(outPath, options) {
var _a;
const repo = 'embedded-protocol';
if (options.release) {
const latestRelease = await getLatestReleaseInfo({
repo,
tag: true,
});
if (!options || 'version' in options) {
const version = (_a = options === null || options === void 0 ? void 0 : options.version) !== null && _a !== void 0 ? _a : pkg['protocol-version'];
await downloadRelease({
repo,
assetUrl: `https://github.com/sass/${repo}/archive/` +
`${latestRelease.name.replace(' ', '-')}` +
ARCHIVE_EXTENSION,
assetUrl: `https://github.com/sass/${repo}/archive/${version}${ARCHIVE_EXTENSION}`,
outPath: BUILD_PATH,
});
fs_1.promises.rename(p.join(BUILD_PATH, `${repo}-${latestRelease.name.replace(' ', '-')}`), p.join(BUILD_PATH, repo));
fs_1.promises.rename(p.join(BUILD_PATH, `${repo}-${version}`), p.join(BUILD_PATH, repo));
}
else if (!options.path) {
else if ('ref' in options) {
fetchRepo({
repo,
outPath: BUILD_PATH,
ref: options.version,
ref: options.ref,
});
}
const repoPath = (_a = options.path) !== null && _a !== void 0 ? _a : p.join(BUILD_PATH, repo);
buildEmbeddedProtocol(repoPath);
await linkBuiltFiles(repoPath, p.join(options.outPath, repo));
const source = options && 'path' in options ? options.path : p.join(BUILD_PATH, repo);
buildEmbeddedProtocol(source);
await linkBuiltFiles(source, p.join(outPath, repo));
}
exports.getEmbeddedProtocol = getEmbeddedProtocol;
/**
* Gets the latest version of the Dart Sass wrapper for the Embedded Compiler.
* Throws if an error occurs.
* Gets the Dart Sass wrapper for the Embedded Compiler.
*
* @param version - If `release` is true, the version of the released binary to
* download (defaults to the latest version). If it's false, the Git ref to
* check out and build (defaults to main).
* @param path - Build from this path instead of pulling from Github.
* @param release - Download the latest release instead of building from source.
* Can download the release `version`, check out and build the source from a Git
* `ref`, or build from the source at `path`.
*
* By default, downloads the release version specified in package.json. Throws
* if an error occurs.
*/
async function getDartSassEmbedded(options) {
async function getDartSassEmbedded(outPath, options) {
var _a;
const repo = 'dart-sass-embedded';
if (options.release) {
const release = options.version
? { tag_name: options.version, name: `sass_embedded ${options.version}` }
: await getLatestReleaseInfo({
repo,
});
if (!options || 'version' in options) {
const version = (_a = options === null || options === void 0 ? void 0 : options.version) !== null && _a !== void 0 ? _a : pkg['compiler-version'];
await downloadRelease({
repo,
assetUrl: `https://github.com/sass/${repo}/releases/download/` +
`${release.tag_name}/` +
`${release.name.replace(' ', '-')}-` +
`${OS}-${ARCH}` +
ARCHIVE_EXTENSION,
outPath: options.outPath,
`${version}/sass_embedded-${version}-` +
`${OS}-${ARCH}${ARCHIVE_EXTENSION}`,
outPath,
});
fs_1.promises.rename(p.join(options.outPath, 'sass_embedded'), p.join(options.outPath, repo));
fs_1.promises.rename(p.join(outPath, 'sass_embedded'), p.join(outPath, repo));
return;
}
else if (options.path) {
buildDartSassEmbedded(options.path);
await linkBuiltFiles(p.join(options.path, 'build'), p.join(options.outPath, repo));
}
else {
if ('ref' in options) {
fetchRepo({
repo,
outPath: BUILD_PATH,
ref: options.version,
ref: options.ref,
});
buildDartSassEmbedded(p.join(BUILD_PATH, repo));
await linkBuiltFiles(p.join(BUILD_PATH, repo, 'build'), p.join(options.outPath, repo));
}
const source = 'path' in options ? options.path : p.join(BUILD_PATH, repo);
buildDartSassEmbedded(source);
await linkBuiltFiles(p.join(source, 'build'), p.join(outPath, repo));
}
exports.getDartSassEmbedded = getDartSassEmbedded;
// Gets the ReleaseInfo of the latest release for `repo`. If `version` is given,
// throws an error if the latest version is not semver-compatible with
// `version`. If `tag` is true, gets the latest tag instead of release.
async function getLatestReleaseInfo(options) {
console.log(`Getting version info for ${options.repo}.`);
const response = await node_fetch_1.default('https://api.github.com/repos/sass/' +
`${options.repo}/${options.tag ? 'tags' : 'releases'}`, {
redirect: 'follow',
});
if (!response.ok) {
throw Error(`Failed to get version info for ${options.repo}: ${response.statusText}`);
}
const latestRelease = JSON.parse(await response.text())[0];
const latestVersion = options.tag
? latestRelease.name
: latestRelease.tag_name;
if (options.versionConstraint) {
try {
semver_1.satisfies(latestVersion, options.versionConstraint);
}
catch (_a) {
throw Error(`Latest release ${latestVersion} is not compatible with ${options.versionConstraint}.`);
}
}
console.log(`Latest release for ${options.repo} is ${latestVersion}.`);
return latestRelease;
}
// Downloads the release for `repo` located at `assetUrl`, then unzips it into

@@ -187,3 +154,2 @@ // `outPath`.

function fetchRepo(options) {
var _a;
if (!fs_1.existsSync(p.join(options.outPath, options.repo))) {

@@ -196,12 +162,8 @@ console.log(`Cloning ${options.repo} into ${options.outPath}.`);

}
const version = options.ref ? `commit ${options.ref}` : 'latest update';
const version = options.ref === 'main' ? 'latest update' : `commit ${options.ref}`;
console.log(`Fetching ${version} for ${options.repo}.`);
shell.exec(`git fetch --depth=1 origin ${(_a = options.ref) !== null && _a !== void 0 ? _a : 'main'}`, {
shell.exec(`git fetch --depth=1 origin ${options.ref} && git reset --hard FETCH_HEAD`, {
silent: true,
cwd: p.join(options.outPath, options.repo),
});
shell.exec('git reset --hard FETCH_HEAD', {
silent: true,
cwd: p.join(options.outPath, options.repo),
});
}

@@ -208,0 +170,0 @@ // Builds the embedded proto at `repoPath` into a pbjs with TS declaration file.

@@ -10,11 +10,6 @@ // Copyright 2021 Google Inc. Use of this source code is governed by an

const getDartSassEmbedded = require('./dist/tool/utils.js').getDartSassEmbedded;
const pkg = require('./package.json');
(async () => {
try {
await getDartSassEmbedded({
outPath: './dist/lib/src/vendor',
release: true,
version: pkg['compiler-version'],
});
await getDartSassEmbedded('./dist/lib/src/vendor');
} catch (error) {

@@ -21,0 +16,0 @@ console.error(error);

{
"name": "sass-embedded",
"version": "1.0.0-beta.3",
"version": "1.0.0-beta.4",
"protocol-version": "1.0.0-beta.11",
"compiler-version": "1.0.0-beta.9",

@@ -5,0 +6,0 @@ "description": "Node.js library that communicates with Embedded Dart Sass using the Embedded Sass protocol",

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc