sass-embedded
Advanced tools
Comparing version 1.54.4 to 1.54.8
@@ -9,4 +9,16 @@ "use strict"; | ||
const p = require("path"); | ||
const utils_1 = require("./utils"); | ||
/** The path to the embedded compiler executable. */ | ||
exports.compilerPath = (() => { | ||
try { | ||
return require.resolve(`sass-embedded-${process.platform}-${process.arch}/` + | ||
'dart-sass-embedded/dart-sass-embedded' + | ||
(process.platform === 'win32' ? '.bat' : '')); | ||
} | ||
catch (e) { | ||
if (!((0, utils_1.isErrnoException)(e) && e.code === 'MODULE_NOT_FOUND')) { | ||
throw e; | ||
} | ||
} | ||
// find for development | ||
for (const path of ['vendor', '../../../lib/src/vendor']) { | ||
@@ -17,4 +29,7 @@ const executable = p.resolve(__dirname, path, `dart-sass-embedded/dart-sass-embedded${process.platform === 'win32' ? '.bat' : ''}`); | ||
} | ||
throw new Error("Embedded Dart Sass couldn't find the embedded compiler executable."); | ||
throw new Error("Embedded Dart Sass couldn't find the embedded compiler executable. " + | ||
'Please make sure the optional dependency ' + | ||
'sass-embedded-${process.platform}-${process.arch} is installed in ' + | ||
'node_modules.'); | ||
})(); | ||
//# sourceMappingURL=compiler-path.js.map |
{ | ||
"name": "sass-embedded", | ||
"version": "1.54.4", | ||
"version": "1.54.8", | ||
"protocol-version": "1.1.0", | ||
"compiler-version": "1.54.4", | ||
"compiler-version": "1.54.8", | ||
"description": "Node.js library that communicates with Embedded Dart Sass using the Embedded Sass protocol", | ||
@@ -21,10 +21,21 @@ "repository": "sass/embedded-host-node", | ||
"init": "ts-node ./tool/prepare-dev-environment.ts", | ||
"check": "gts check", | ||
"check": "npm-run-all check:gts check:tsc", | ||
"check:gts": "gts check", | ||
"check:tsc": "tsc --noEmit", | ||
"clean": "gts clean", | ||
"compile": "tsc", | ||
"fix": "gts fix", | ||
"postinstall": "node ./download-compiler-for-end-user.js", | ||
"prepublishOnly": "npm run clean && ts-node ./tool/prepare-release.ts", | ||
"test": "jest" | ||
}, | ||
"optionalDependencies": { | ||
"sass-embedded-darwin-arm64": "1.54.8", | ||
"sass-embedded-darwin-x64": "1.54.8", | ||
"sass-embedded-linux-arm": "1.54.8", | ||
"sass-embedded-linux-arm64": "1.54.8", | ||
"sass-embedded-linux-ia32": "1.54.8", | ||
"sass-embedded-linux-x64": "1.54.8", | ||
"sass-embedded-win32-ia32": "1.54.8", | ||
"sass-embedded-win32-x64": "1.54.8" | ||
}, | ||
"dependencies": { | ||
@@ -55,5 +66,6 @@ "buffer-builder": "^0.2.0", | ||
"del": "^6.0.0", | ||
"gts": "^3.1.0", | ||
"gts": "^4.0.0", | ||
"jest": "^27.2.5", | ||
"minipass": "3.2.1", | ||
"npm-run-all": "^4.1.5", | ||
"protoc": "^1.0.4", | ||
@@ -60,0 +72,0 @@ "source-map-js": "^0.6.1", |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getJSApi = exports.getDartSassEmbedded = exports.getEmbeddedProtocol = void 0; | ||
exports.getJSApi = exports.getDartSassEmbedded = exports.getEmbeddedProtocol = exports.nodeArchToDartArch = exports.nodePlatformToDartPlatform = void 0; | ||
const make_fetch_happen_1 = require("make-fetch-happen"); | ||
@@ -18,6 +18,8 @@ const extractZip = require("extract-zip"); | ||
shell.config.fatal = true; | ||
// The current platform's operating system. Throws if the operating system | ||
// is not supported by Dart Sass Embedded. | ||
const OS = (() => { | ||
const platform = process.env.npm_config_platform || process.platform; | ||
// Directory that holds source files. | ||
const BUILD_PATH = 'build'; | ||
// Converts a Node-style platform name as returned by `process.platform` into a | ||
// name used by Dart Sass. Throws if the operating system is not supported by | ||
// Dart Sass Embedded. | ||
function nodePlatformToDartPlatform(platform) { | ||
switch (platform) { | ||
@@ -33,7 +35,8 @@ case 'linux': | ||
} | ||
})(); | ||
// The current platform's architecture. Throws if the architecture is not | ||
// supported by Dart Sass Embedded. | ||
const ARCH = (() => { | ||
const arch = process.env.npm_config_arch || process.arch; | ||
} | ||
exports.nodePlatformToDartPlatform = nodePlatformToDartPlatform; | ||
// Converts a Node-style architecture name as returned by `process.arch` into a | ||
// name used by Dart Sass. Throws if the architecture is not supported by Dart | ||
// Sass Embedded. | ||
function nodeArchToDartArch(arch) { | ||
switch (arch) { | ||
@@ -46,2 +49,4 @@ case 'ia32': | ||
return 'x64'; | ||
case 'arm': | ||
return 'arm'; | ||
case 'arm64': | ||
@@ -52,7 +57,8 @@ return 'arm64'; | ||
} | ||
})(); | ||
// The current platform's file extension for archives. | ||
const ARCHIVE_EXTENSION = OS === 'windows' ? '.zip' : '.tar.gz'; | ||
// Directory that holds source files. | ||
const BUILD_PATH = 'build'; | ||
} | ||
exports.nodeArchToDartArch = nodeArchToDartArch; | ||
// Get the platform's file extension for archives. | ||
function getArchiveExtension(platform) { | ||
return platform === 'windows' ? '.zip' : '.tar.gz'; | ||
} | ||
/** | ||
@@ -74,3 +80,3 @@ * Gets the Embedded Protocol. | ||
repo, | ||
assetUrl: `https://github.com/sass/${repo}/archive/${version}${ARCHIVE_EXTENSION}`, | ||
assetUrl: `https://github.com/sass/${repo}/archive/${version}.tar.gz`, | ||
outPath: BUILD_PATH, | ||
@@ -101,3 +107,3 @@ }); | ||
*/ | ||
async function getDartSassEmbedded(outPath, options) { | ||
async function getDartSassEmbedded(outPath, platform, arch, options) { | ||
const repo = 'dart-sass-embedded'; | ||
@@ -112,3 +118,3 @@ options !== null && options !== void 0 ? options : (options = defaultVersionOption('compiler-version')); | ||
`${version}/sass_embedded-${version}-` + | ||
`${OS}-${ARCH}${ARCHIVE_EXTENSION}`, | ||
`${platform}-${arch}${getArchiveExtension(platform)}`, | ||
outPath, | ||
@@ -202,5 +208,8 @@ }); | ||
await cleanDir(p.join(options.outPath, options.repo)); | ||
const zippedAssetPath = `${options.outPath}/${options.repo}${ARCHIVE_EXTENSION}`; | ||
const archiveExtension = options.assetUrl.endsWith('.zip') | ||
? '.zip' | ||
: '.tar.gz'; | ||
const zippedAssetPath = options.outPath + '/' + options.repo + archiveExtension; | ||
await fs_1.promises.writeFile(zippedAssetPath, releaseAsset); | ||
if (OS === 'windows') { | ||
if (archiveExtension === '.zip') { | ||
await extractZip(zippedAssetPath, { | ||
@@ -239,6 +248,6 @@ dir: p.join(process.cwd(), options.outPath), | ||
console.log(`Building pbjs and TS declaration file from ${proto}.`); | ||
const protocPath = OS === 'windows' | ||
const protocPath = process.platform === 'win32' | ||
? '%CD%/node_modules/protoc/protoc/bin/protoc.exe' | ||
: 'node_modules/protoc/protoc/bin/protoc'; | ||
const pluginPath = OS === 'windows' | ||
const pluginPath = process.platform === 'win32' | ||
? '%CD%/node_modules/.bin/protoc-gen-ts.cmd' | ||
@@ -276,3 +285,3 @@ : 'node_modules/.bin/protoc-gen-ts'; | ||
await cleanDir(destination); | ||
if (OS === 'windows') { | ||
if (process.platform === 'win32') { | ||
console.log(`Copying ${source} into ${destination}.`); | ||
@@ -279,0 +288,0 @@ shell.cp('-R', source, destination); |
{ | ||
"name": "sass-embedded", | ||
"version": "1.54.4", | ||
"version": "1.54.8", | ||
"protocol-version": "1.1.0", | ||
"compiler-version": "1.54.4", | ||
"compiler-version": "1.54.8", | ||
"description": "Node.js library that communicates with Embedded Dart Sass using the Embedded Sass protocol", | ||
@@ -21,10 +21,21 @@ "repository": "sass/embedded-host-node", | ||
"init": "ts-node ./tool/prepare-dev-environment.ts", | ||
"check": "gts check", | ||
"check": "npm-run-all check:gts check:tsc", | ||
"check:gts": "gts check", | ||
"check:tsc": "tsc --noEmit", | ||
"clean": "gts clean", | ||
"compile": "tsc", | ||
"fix": "gts fix", | ||
"postinstall": "node ./download-compiler-for-end-user.js", | ||
"prepublishOnly": "npm run clean && ts-node ./tool/prepare-release.ts", | ||
"test": "jest" | ||
}, | ||
"optionalDependencies": { | ||
"sass-embedded-darwin-arm64": "1.54.8", | ||
"sass-embedded-darwin-x64": "1.54.8", | ||
"sass-embedded-linux-arm": "1.54.8", | ||
"sass-embedded-linux-arm64": "1.54.8", | ||
"sass-embedded-linux-ia32": "1.54.8", | ||
"sass-embedded-linux-x64": "1.54.8", | ||
"sass-embedded-win32-ia32": "1.54.8", | ||
"sass-embedded-win32-x64": "1.54.8" | ||
}, | ||
"dependencies": { | ||
@@ -55,5 +66,6 @@ "buffer-builder": "^0.2.0", | ||
"del": "^6.0.0", | ||
"gts": "^3.1.0", | ||
"gts": "^4.0.0", | ||
"jest": "^27.2.5", | ||
"minipass": "3.2.1", | ||
"npm-run-all": "^4.1.5", | ||
"protoc": "^1.0.4", | ||
@@ -60,0 +72,0 @@ "source-map-js": "^0.6.1", |
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
Sorry, the diff of this file is not supported yet
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
1198001
122
17621
0
19
22
12