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

esbuild-plugin-less

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esbuild-plugin-less - npm Package Compare versions

Comparing version 1.3.2 to 1.3.3

2

build/cjs.js

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

var D=Object.create;var m=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,$=Object.prototype.hasOwnProperty;var C=(e,t)=>{for(var s in t)m(e,s,{get:t[s],enumerable:!0})},v=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of w(t))!$.call(e,r)&&r!==s&&m(e,r,{get:()=>t[r],enumerable:!(i=I(t,r))||i.enumerable});return e};var p=(e,t,s)=>(s=e!=null?D(S(e)):{},v(t||!e||!e.__esModule?m(s,"default",{value:e,enumerable:!0}):s,e)),E=e=>v(m({},"__esModule",{value:!0}),e);var U={};C(U,{lessLoader:()=>F});module.exports=E(U);var d=p(require("path")),L=require("fs"),y=p(require("less"));var f=p(require("fs")),l=p(require("path")),M=/@import.*?["']([^"']+)["'].*?/,O=/@import.*?["']([^"']+)["'].*?/g,P=/(?:\/\*(?:[\s\S]*?)\*\/)|(\/\/(?:.*)$)/gm,k=[".css",".less"];function h(e,t=[]){try{let s=l.default.dirname(e),n=(f.default.readFileSync(e).toString("utf8").replace(P,"").match(O)||[]).map(o=>o.match(M)[1]).filter(o=>!!o).map(o=>{let a=l.default.resolve(s,l.default.extname(o)?o:`${o}.less`);if(!f.default.existsSync(a))for(let c=0;c<t.length;c++){let x=l.default.resolve(t[c],l.default.extname(o)?o:`${o}.less`);if(f.default.existsSync(x)){a=x;break}}return a});return n.reduce((o,a)=>[...o,...h(a,t)],n).filter(o=>k.includes(l.default.extname(o).toLowerCase()))}catch{return[]}}function g(e){let t=e.extract.filter(i=>i),s=t.length===3?t[1]:t[0];return{text:e.message,location:{namespace:"file",file:e.filename,line:e.line,column:e.column,lineText:s}}}function F(e={},t={}){return{name:"less-loader",setup:s=>{let i=t.filter;s.onResolve({filter:i||/\.less$/,namespace:"file"},async r=>{let n=(await s.resolve(r.path,{kind:r.kind,importer:r.importer,resolveDir:r.resolveDir,pluginData:r.pluginData})).path;return{path:n,watchFiles:[n,...h(n,e.paths||[])]}}),s.onLoad({filter:i||/\.less$/,namespace:"file"},async r=>{let u=await L.promises.readFile(r.path,"utf-8"),n=d.default.dirname(r.path),o=d.default.basename(r.path).endsWith(".module.less")?"local-css":"css",a={filename:r.path,relativeUrls:!0,...e,paths:[...e.paths||[],n]};try{return{contents:(await y.default.render(u,a)).css,loader:o,resolveDir:n}}catch(c){return{errors:[g(c)],resolveDir:n}}})}}}0&&(module.exports={lessLoader});
var D=Object.create;var m=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,$=Object.prototype.hasOwnProperty;var C=(e,t)=>{for(var s in t)m(e,s,{get:t[s],enumerable:!0})},v=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of w(t))!$.call(e,r)&&r!==s&&m(e,r,{get:()=>t[r],enumerable:!(i=I(t,r))||i.enumerable});return e};var p=(e,t,s)=>(s=e!=null?D(S(e)):{},v(t||!e||!e.__esModule?m(s,"default",{value:e,enumerable:!0}):s,e)),E=e=>v(m({},"__esModule",{value:!0}),e);var U={};C(U,{lessLoader:()=>O});module.exports=E(U);var L=require("fs"),d=p(require("path")),y=p(require("less"));var f=p(require("fs")),c=p(require("path")),M=/@import.*?["']([^"']+)["'].*?/,P=/@import.*?["']([^"']+)["'].*?/g,k=/(?:\/\*(?:[\s\S]*?)\*\/)|(\/\/(?:.*)$)/gm,F=[".css",".less"];function h(e,t=[]){try{let s=c.default.dirname(e),n=(f.default.readFileSync(e).toString("utf8").replace(k,"").match(P)||[]).map(o=>o.match(M)[1]).filter(o=>!!o).map(o=>{let a=c.default.resolve(s,c.default.extname(o)?o:`${o}.less`);if(!f.default.existsSync(a))for(let l=0;l<t.length;l++){let x=c.default.resolve(t[l],c.default.extname(o)?o:`${o}.less`);if(f.default.existsSync(x)){a=x;break}}return a});return n.reduce((o,a)=>[...o,...h(a,t)],n).filter(o=>F.includes(c.default.extname(o).toLowerCase()))}catch{return[]}}function g(e){let t=e.extract.filter(i=>i),s=t.length===3?t[1]:t[0];return{text:e.message,location:{namespace:"file",file:e.filename,line:e.line,column:e.column,lineText:s}}}function O(e={},t={}){return{name:"less-loader",setup:s=>{let i=t.filter;s.onResolve({filter:i||/\.less$/,namespace:"file"},async r=>{let n=(await s.resolve(r.path,{kind:r.kind,importer:r.importer,resolveDir:r.resolveDir,pluginData:r.pluginData})).path;return{path:n,watchFiles:[n,...h(n,e.paths||[])]}}),s.onLoad({filter:i||/\.less$/,namespace:"file"},async r=>{let u=await L.promises.readFile(r.path,"utf-8"),n=d.default.dirname(r.path),o=d.default.basename(r.path).endsWith(".module.less")?"local-css":"css",a={filename:r.path,relativeUrls:!0,...e,paths:[...e.paths||[],n]};try{return{contents:(await y.default.render(u,a)).css,loader:o,resolveDir:n}}catch(l){return{errors:[g(l)],resolveDir:n}}})}}}0&&(module.exports={lessLoader});

@@ -6,3 +6,5 @@ /// <reference types="less" />

}
/** Less-loader for esbuild */
export declare function lessLoader(options?: Less.Options, loaderOptions?: LoaderOptions): Plugin;
/**
* `esbuild` loader for `.less` files
*/
export declare function lessLoader(lessOptions?: Less.Options, loaderOptions?: LoaderOptions): Plugin;
{
"name": "esbuild-plugin-less",
"version": "1.3.2",
"version": "1.3.3",
"description": "esbuild plugin for less files",

@@ -49,17 +49,17 @@ "repository": "https://github.com/iam-medvedev/esbuild-plugin-less.git",

"@semantic-release/github": "9.2.6",
"@semantic-release/npm": "11.0.2",
"@semantic-release/npm": "11.0.3",
"@semantic-release/release-notes-generator": "12.1.0",
"@types/node": "^20.11.9",
"@vitest/coverage-v8": "^1.2.2",
"@types/node": "20.11.26",
"@vitest/coverage-v8": "1.3.1",
"cz-conventional-changelog": "3.3.0",
"esbuild": "^0.20.0",
"esbuild": "0.20.1",
"git-cz": "4.9.0",
"husky": "^9.0.6",
"lint-staged": "15.2.0",
"prettier": "3.2.4",
"semantic-release": "23.0.0",
"tsx": "4.7.0",
"typescript": "5.3.3",
"vite": "^5.0.12",
"vitest": "^1.2.2"
"husky": "9.0.11",
"lint-staged": "15.2.2",
"prettier": "3.2.5",
"semantic-release": "23.0.2",
"tsx": "4.7.1",
"typescript": "5.4.2",
"vite": "5.1.6",
"vitest": "1.3.1"
},

@@ -69,2 +69,5 @@ "peerDependencies": {

},
"resolutions": {
"esbuild": "0.20.1"
},
"dependencies": {

@@ -80,4 +83,4 @@ "@types/less": "^3.0.6",

"volta": {
"node": "20.11.0",
"yarn": "1.22.21"
"node": "20.11.1",
"yarn": "1.22.22"
},

@@ -99,3 +102,3 @@ "husky": {

},
"packageManager": "yarn@4.0.2"
"packageManager": "yarn@4.1.1"
}

@@ -7,3 +7,2 @@ [![License: WTFPL](https://img.shields.io/badge/License-WTFPL-brightgreen.svg)](http://www.wtfpl.net/about/)

[![libraries.io](https://img.shields.io/librariesio/release/npm/esbuild-plugin-less)](https://libraries.io/github/iam-medvedev/esbuild-plugin-less)
[![Codecov](https://img.shields.io/codecov/c/github/iam-medvedev/esbuild-plugin-less)](https://codecov.io/gh/iam-medvedev/esbuild-plugin-less)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fiam-medvedev%2Fesbuild-plugin-less.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fiam-medvedev%2Fesbuild-plugin-less?ref=badge_shield)

@@ -14,7 +13,7 @@ [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)

[esbuild](https://github.com/evanw/esbuild) plugin for less files
[esbuild](https://github.com/evanw/esbuild) plugin for less files.
## Install
## Installation
```
```sh
yarn add esbuild-plugin-less -D

@@ -25,4 +24,2 @@ ```

### Simple example
You can see the example [here](./example).

@@ -38,3 +35,3 @@

outdir: path.resolve(__dirname, 'output'),
plugins: [lessLoader()],
plugins: [lessLoader()], // Just plug in
loader: {

@@ -46,34 +43,11 @@ '.ts': 'ts',

### Watch mode
## Configuration
More information about watch mode [here](https://esbuild.github.io/api/#watch).
```ts
import { build } from 'esbuild';
import { lessLoader } from 'esbuild-plugin-less';
build({
watch: true, // enable watch mode
entryPoints: [path.resolve(__dirname, 'index.ts')],
bundle: true,
outdir: path.resolve(__dirname, 'output'),
plugins: [lessLoader()],
loader: {
'.ts': 'ts',
},
});
lessLoader(lessOptions: Less.Options = {}, loaderOptions: LoaderOptions = {})
```
## Options
- `options` — Accepts all valid options from less.js. You can find a complete list of options [here](http://lesscss.org/usage/#less-options).
- `loaderOptions` — Options for the loader. Supports custom esbuild [filter](https://esbuild.github.io/plugins/#filters).
`lessLoader` accepts all valid options from less.js. You can find a complete list of options [here](http://lesscss.org/usage/#less-options).
`LoaderOptions` loader options, support custom [filter](https://esbuild.github.io/plugins/#filters)
```
{
filter: /\.less$/,
}
```
## License

@@ -80,0 +54,0 @@

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