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

esbuild-sass-plugin

Package Overview
Dependencies
Maintainers
1
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esbuild-sass-plugin - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

0

lib/cache.d.ts

@@ -0,0 +0,0 @@ import { SassPluginOptions } from './index';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { OnLoadResult } from 'esbuild';

@@ -0,0 +0,0 @@ "use strict";

import { Plugin } from 'esbuild';
import { SassPluginOptions } from './index';
export declare function sassPlugin(options?: SassPluginOptions): Plugin;

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { SassPluginOptions } from './index';

23

lib/render.js

@@ -64,5 +64,6 @@ "use strict";

const requireOptions = { paths: ['.', ...loadPaths] };
const sepTilde = `${path_1.sep}~`;
return function (path) {
const basedir = (0, path_1.dirname)(path);
let source = fs_1.default.readFileSync(path, 'utf8');
let source = fs_1.default.readFileSync(path, 'utf-8');
if (options.precompile) {

@@ -80,11 +81,11 @@ source = options.precompile(source, path);

load(canonicalUrl) {
const filename = path_1.sep === '/' ? canonicalUrl.pathname : canonicalUrl.pathname.slice(1);
let contents = fs_1.default.readFileSync(filename, 'utf8');
const pathname = (0, url_1.fileURLToPath)(canonicalUrl);
let contents = fs_1.default.readFileSync(pathname, 'utf8');
if (options.precompile) {
contents = options.precompile(contents, filename);
contents = options.precompile(contents, canonicalUrl.pathname);
}
return {
contents,
syntax: (0, utils_1.fileSyntax)(filename),
sourceMapUrl: sourcemap ? (0, url_1.pathToFileURL)(filename) : undefined
syntax: (0, utils_1.fileSyntax)(pathname),
sourceMapUrl: sourcemap ? canonicalUrl : undefined
};

@@ -95,3 +96,3 @@ },

if (url.startsWith('~')) {
filename = url.slice(1);
filename = decodeURI(url.slice(1));
try {

@@ -105,4 +106,4 @@ requireOptions.paths[0] = basedir;

else if (url.startsWith('file://')) {
filename = path_1.sep === '/' ? url.slice(7) : url.slice(8);
let joint = filename.lastIndexOf('/~');
filename = (0, url_1.fileURLToPath)(url);
let joint = filename.lastIndexOf(sepTilde);
if (joint >= 0) {

@@ -120,3 +121,3 @@ const basedir = filename.slice(0, joint);

else {
filename = url;
filename = decodeURI(url);
}

@@ -151,3 +152,3 @@ if (options.importMapper) {

css: sourcemap ? `${cssText}\n${(0, utils_1.sourceMappingURL)(sourceMap)}` : cssText,
watchFiles: [path, ...loadedUrls.map(url => path_1.sep === '/' ? url.pathname : url.pathname.slice(1))]
watchFiles: [path, ...loadedUrls.map(url_1.fileURLToPath)]
};

@@ -154,0 +155,0 @@ };

@@ -0,0 +0,0 @@ import { Type } from './index';

@@ -53,3 +53,3 @@ "use strict";

function sourceMappingURL(sourceMap) {
const data = Buffer.from(JSON.stringify(sourceMap), 'utf8').toString('base64');
const data = Buffer.from(JSON.stringify(sourceMap), 'utf-8').toString('base64');
return `/*# sourceMappingURL=data:application/json;charset=utf-8;base64,${data} */`;

@@ -56,0 +56,0 @@ }

{
"name": "esbuild-sass-plugin",
"version": "2.1.0",
"version": "2.2.0",
"description": "esbuild plugin for sass/scss files supporting both css loader and css result import (lit-element)",

@@ -10,3 +10,6 @@ "main": "lib/index.js",

"sass",
"scss"
"scss",
"css",
"postcss",
"css-modules"
],

@@ -13,0 +16,0 @@ "files": [

![cooltext394785080075403](https://user-images.githubusercontent.com/160981/136289874-26ce7269-ea08-47dd-be31-9bf0ef7a0b8d.png)
![image](https://user-images.githubusercontent.com/160981/147304513-386dac37-7098-43d9-a17a-d10cc719d8ba.png)
![image](https://user-images.githubusercontent.com/160981/150880682-4915c4dd-726b-4fea-8f3b-597d191f05bc.png)

@@ -263,12 +263,13 @@ [![Build Status][travis-image]][travis-url]

### Benchmarks
**Windows 10** Pro - **i7-4770K** CPU @ **3.50**GHz - RAM **24**GB - SSD **500**GB
Given 24 × 24 = 576 lit-element files & 576 imported CSS styles plus the import of the full bootstrap 5.1
| | dart sass | dart sass (no cache) | node-sass* | node-sass (no cache) |
|------------------------|------------|-----------------------|-------------|----------------------|
| **initial build** | 2.946s | 2.945s | 1.903s | 1.858s |
| rebuild (.ts change) | 285.959ms | 1.950s | 797.098ms | 1.689s |
| rebuild (.ts change) | 260.791ms | 1.799s | 768.213ms | 1.790s |
| rebuild (.scss change) | 234.152ms | 1.801s | 770.619ms | 1.652s |
| rebuild (.scss change) | 267.857ms | 1.738s | 750.743ms | 1.682s |
| | dart sass | dart sass (no cache) | node-sass* | node-sass (no cache) |
|------------------------|-----------|-----------------------|-------------|----------------------|
| **initial build** | 2.750s | 2.750s | 1.903s | 1.858s |
| rebuild (.ts change) | 285.959ms | 1.950s | 797.098ms | 1.689s |
| rebuild (.ts change) | 260.791ms | 1.799s | 768.213ms | 1.790s |
| rebuild (.scss change) | 234.152ms | 1.801s | 770.619ms | 1.652s |
| rebuild (.scss change) | 267.857ms | 1.738s | 750.743ms | 1.682s |

@@ -275,0 +276,0 @@ (*) node-sass is here just to give a term of comparison ...those samples were taken from 1.8.x

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

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