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

@parcel/transformer-sass

Package Overview
Dependencies
Maintainers
1
Versions
884
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@parcel/transformer-sass - npm Package Compare versions

Comparing version 2.0.0-canary.1749 to 2.0.0-canary.1759

36

lib/modern.js

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

let containingPath = (0, _url().fileURLToPath)(containingUrl);
let containingPath = containingUrl ? (0, _url().fileURLToPath)(containingUrl) : asset.filePath;
if (!containingUrl && url.startsWith('file:')) {
// If containingUrl is not provided, then url should be an absolute file:/// URL.
let filePath = (0, _url().fileURLToPath)(url);
url = _path().default.relative(_path().default.dirname(containingPath), filePath);
}
let paths = [_path().default.dirname(containingPath)];

@@ -118,12 +123,35 @@ if (loadPaths) {

}
// The importer should look for stylesheets by adding the prefix _ to the URL's basename,
// and by adding the extensions .sass and .scss if the URL doesn't already have one of those extensions.
const urls = [url];
const urlFileName = _path().default.basename(url);
if (urlFileName[0] !== '_') {
urls.push(_path().default.join(_path().default.dirname(url), `_${urlFileName}`));
urls.push(_path().default.posix.join(_path().default.dirname(url), `_${urlFileName}`));
}
let ext = _path().default.extname(urlFileName);
if (ext !== '.sass' && ext !== '.scss') {
for (let url of [...urls]) {
urls.push(url + '.sass');
urls.push(url + '.scss');
}
}
// If none of the possible paths is valid, the importer should perform the same resolution on the URL followed by /index.
urls.push(_path().default.posix.join(url, 'index.sass'));
urls.push(_path().default.posix.join(url, 'index.scss'));
urls.push(_path().default.posix.join(url, '_index.sass'));
urls.push(_path().default.posix.join(url, '_index.scss'));
if (url[0] !== '~') {
for (let p of paths) {
for (let u of urls) {
const filePath = _path().default.resolve(p, u);
if (await asset.fs.exists(filePath)) {
var _stat;
let filePath = _path().default.resolve(p, u);
let stat;
try {
stat = await asset.fs.stat(filePath);
} catch (err) {
// ignore.
}
if ((_stat = stat) !== null && _stat !== void 0 && _stat.isFile()) {
return (0, _url().pathToFileURL)(filePath);

@@ -130,0 +158,0 @@ }

8

package.json
{
"name": "@parcel/transformer-sass",
"version": "2.0.0-canary.1749+a53f8f3ba",
"version": "2.0.0-canary.1759+4d27ec8b8",
"license": "MIT",

@@ -20,10 +20,10 @@ "publishConfig": {

"node": ">= 16.0.0",
"parcel": "^2.0.0-canary.1747+a53f8f3ba"
"parcel": "^2.0.0-canary.1757+4d27ec8b8"
},
"dependencies": {
"@parcel/plugin": "2.0.0-canary.1749+a53f8f3ba",
"@parcel/plugin": "2.0.0-canary.1759+4d27ec8b8",
"@parcel/source-map": "^2.1.1",
"sass": "^1.38.0"
},
"gitHead": "a53f8f3ba1025c7ea8653e9719e0a61ef9717079"
"gitHead": "4d27ec8b8bd1792f536811fef86e74a31fa0e704"
}

@@ -98,3 +98,11 @@ // @flow

let containingPath = fileURLToPath(containingUrl);
let containingPath = containingUrl
? fileURLToPath(containingUrl)
: asset.filePath;
if (!containingUrl && url.startsWith('file:')) {
// If containingUrl is not provided, then url should be an absolute file:/// URL.
let filePath = fileURLToPath(url);
url = path.relative(path.dirname(containingPath), filePath);
}
let paths = [path.dirname(containingPath)];

@@ -114,13 +122,35 @@ if (loadPaths) {

// The importer should look for stylesheets by adding the prefix _ to the URL's basename,
// and by adding the extensions .sass and .scss if the URL doesn't already have one of those extensions.
const urls = [url];
const urlFileName = path.basename(url);
if (urlFileName[0] !== '_') {
urls.push(path.join(path.dirname(url), `_${urlFileName}`));
urls.push(path.posix.join(path.dirname(url), `_${urlFileName}`));
}
let ext = path.extname(urlFileName);
if (ext !== '.sass' && ext !== '.scss') {
for (let url of [...urls]) {
urls.push(url + '.sass');
urls.push(url + '.scss');
}
}
// If none of the possible paths is valid, the importer should perform the same resolution on the URL followed by /index.
urls.push(path.posix.join(url, 'index.sass'));
urls.push(path.posix.join(url, 'index.scss'));
urls.push(path.posix.join(url, '_index.sass'));
urls.push(path.posix.join(url, '_index.scss'));
if (url[0] !== '~') {
for (let p of paths) {
for (let u of urls) {
const filePath = path.resolve(p, u);
if (await asset.fs.exists(filePath)) {
let filePath = path.resolve(p, u);
let stat;
try {
stat = await asset.fs.stat(filePath);
} catch (err) {
// ignore.
}
if (stat?.isFile()) {
return pathToFileURL(filePath);

@@ -127,0 +157,0 @@ }

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