Skip to content

Commit ff8b868

Browse files
authored
chore: 🤖 bump dependencies and update readme (iam-medvedev#119)
1 parent 41181ee commit ff8b868

File tree

9 files changed

+1689
-1439
lines changed

9 files changed

+1689
-1439
lines changed

‎.github/workflows/release.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Setup Node.js
1616
uses: actions/setup-node@v4
1717
with:
18-
node-version: 20.11.0
18+
node-version: 20.11.1
1919
cache: 'yarn'
2020

2121
- name: Install dependencies

‎.github/workflows/test.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Setup Node.js
1515
uses: actions/setup-node@v4
1616
with:
17-
node-version: 20.11.0
17+
node-version: 20.11.1
1818
cache: 'yarn'
1919

2020
- name: Install dependencies
Lines changed: 336 additions & 336 deletions
Large diffs are not rendered by default.

‎.yarnrc.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ enableGlobalCache: false
44

55
nodeLinker: node-modules
66

7-
yarnPath: .yarn/releases/yarn-4.0.2.cjs
7+
yarnPath: .yarn/releases/yarn-4.1.1.cjs

‎README.md‎

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,16 @@
1010

1111
# esbuild-plugin-less
1212

13-
[esbuild](https://github.com/evanw/esbuild) plugin for less files
13+
[esbuild](https://github.com/evanw/esbuild) plugin for less files.
1414

15-
## Install
15+
## Installation
1616

17-
```
17+
```sh
1818
yarn add esbuild-plugin-less -D
1919
```
2020

2121
## Usage
2222

23-
### Simple example
24-
2523
You can see the example [here](./example).
2624

2725
```ts
@@ -32,44 +30,21 @@ build({
3230
entryPoints: [path.resolve(__dirname, 'index.ts')],
3331
bundle: true,
3432
outdir: path.resolve(__dirname, 'output'),
35-
plugins: [lessLoader()],
33+
plugins: [lessLoader()], // Just plug in
3634
loader: {
3735
'.ts': 'ts',
3836
},
3937
});
4038
```
4139

42-
### Watch mode
43-
44-
More information about watch mode [here](https://esbuild.github.io/api/#watch).
40+
## Configuration
4541

4642
```ts
47-
import { build } from 'esbuild';
48-
import { lessLoader } from 'esbuild-plugin-less';
49-
50-
build({
51-
watch: true, // enable watch mode
52-
entryPoints: [path.resolve(__dirname, 'index.ts')],
53-
bundle: true,
54-
outdir: path.resolve(__dirname, 'output'),
55-
plugins: [lessLoader()],
56-
loader: {
57-
'.ts': 'ts',
58-
},
59-
});
60-
```
61-
62-
## Options
63-
64-
`lessLoader` accepts all valid options from less.js. You can find a complete list of options [here](http://lesscss.org/usage/#less-options).
65-
66-
`LoaderOptions` loader options, support custom [filter](https://esbuild.github.io/plugins/#filters)
67-
```
68-
{
69-
filter: /\.less$/,
70-
}
43+
lessLoader(lessOptions: Less.Options = {}, loaderOptions: LoaderOptions = {})
7144
```
7245

46+
- `options` — Accepts all valid options from less.js. You can find a complete list of options [here](http://lesscss.org/usage/#less-options).
47+
- `loaderOptions` — Options for the loader. Supports custom esbuild [filter](https://esbuild.github.io/plugins/#filters).
7348

7449
## License
7550

‎package.json‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,21 @@
4646
"@semantic-release/changelog": "6.0.3",
4747
"@semantic-release/commit-analyzer": "11.1.0",
4848
"@semantic-release/github": "9.2.6",
49-
"@semantic-release/npm": "11.0.2",
49+
"@semantic-release/npm": "11.0.3",
5050
"@semantic-release/release-notes-generator": "12.1.0",
51-
"@types/node": "^20.11.9",
52-
"@vitest/coverage-v8": "^1.2.2",
51+
"@types/node": "20.11.26",
52+
"@vitest/coverage-v8": "1.3.1",
5353
"cz-conventional-changelog": "3.3.0",
54-
"esbuild": "^0.20.0",
54+
"esbuild": "0.20.1",
5555
"git-cz": "4.9.0",
56-
"husky": "^9.0.6",
57-
"lint-staged": "15.2.0",
58-
"prettier": "3.2.4",
59-
"semantic-release": "23.0.0",
60-
"tsx": "4.7.0",
61-
"typescript": "5.3.3",
62-
"vite": "^5.0.12",
63-
"vitest": "^1.2.2"
56+
"husky": "9.0.11",
57+
"lint-staged": "15.2.2",
58+
"prettier": "3.2.5",
59+
"semantic-release": "23.0.2",
60+
"tsx": "4.7.1",
61+
"typescript": "5.4.2",
62+
"vite": "5.1.6",
63+
"vitest": "1.3.1"
6464
},
6565
"peerDependencies": {
6666
"esbuild": "^0.14.x || ^0.15.0 || ^0.16.0 || ^0.17.0 || ^0.18.0 || ^0.19.0 || ^0.20.0"
@@ -75,8 +75,8 @@
7575
"less"
7676
],
7777
"volta": {
78-
"node": "20.11.0",
79-
"yarn": "1.22.21"
78+
"node": "20.11.1",
79+
"yarn": "1.22.22"
8080
},
8181
"husky": {
8282
"hooks": {
@@ -93,5 +93,5 @@
9393
"path": "./node_modules/cz-conventional-changelog"
9494
}
9595
},
96-
"packageManager": "yarn@4.0.2"
96+
"packageManager": "yarn@4.1.1"
9797
}

‎scripts/build.ts‎

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,30 @@ function getOutputFilename(format: Format) {
1212
}
1313
}
1414

15-
function createBuild() {
16-
formats.map((format) => {
15+
async function createBuild() {
16+
for (const format of formats) {
1717
const outputFilename = getOutputFilename(format);
1818

19-
build({
20-
entryPoints: [path.resolve(__dirname, '..', 'src', 'index.ts')],
21-
bundle: true,
22-
minify: true,
23-
platform: 'node',
24-
loader: {
25-
'.ts': 'ts',
26-
},
27-
external: ['less', 'path', 'fs'],
28-
outfile: path.resolve(__dirname, '..', 'build', outputFilename),
29-
format,
30-
})
31-
.then(() => {
32-
console.info(`— ${outputFilename} was built`);
33-
})
34-
.catch((e) => {
35-
console.info(`🚨 ${outputFilename} build error:`);
36-
console.error(e);
19+
try {
20+
await build({
21+
entryPoints: [path.resolve(__dirname, '..', 'src', 'index.ts')],
22+
bundle: true,
23+
minify: true,
24+
platform: 'node',
25+
loader: {
26+
'.ts': 'ts',
27+
},
28+
external: ['less', 'path', 'fs'],
29+
outfile: path.resolve(__dirname, '..', 'build', outputFilename),
30+
format,
3731
});
38-
});
32+
33+
console.info(`— ${outputFilename} was built`);
34+
} catch (e) {
35+
console.info(`🚨 ${outputFilename} build error:`);
36+
console.error(e);
37+
}
38+
}
3939
}
4040

4141
createBuild();

‎src/index.ts‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
import type { Loader, Plugin } from 'esbuild';
2-
import path from 'path';
32
import { promises as fs } from 'fs';
3+
import path from 'path';
44
import less from 'less';
55
import { convertLessError, getLessImports } from './less-utils';
66

77
export interface LoaderOptions {
8-
/* custom filter */
8+
/* Custom filter */
99
filter?: RegExp;
1010
}
1111

12-
/** Less-loader for esbuild */
13-
export function lessLoader(options: Less.Options = {}, loaderOptions: LoaderOptions = {}): Plugin {
12+
/**
13+
* `esbuild` loader for `.less` files
14+
*/
15+
export function lessLoader(lessOptions: Less.Options = {}, loaderOptions: LoaderOptions = {}): Plugin {
1416
return {
1517
name: 'less-loader',
1618
setup: (build) => {
@@ -28,7 +30,7 @@ export function lessLoader(options: Less.Options = {}, loaderOptions: LoaderOpti
2830

2931
return {
3032
path: filePath,
31-
watchFiles: [filePath, ...getLessImports(filePath, options.paths || [])],
33+
watchFiles: [filePath, ...getLessImports(filePath, lessOptions.paths || [])],
3234
};
3335
});
3436

@@ -43,8 +45,8 @@ export function lessLoader(options: Less.Options = {}, loaderOptions: LoaderOpti
4345
const opts: Less.Options & { relativeUrls: boolean } = {
4446
filename: args.path,
4547
relativeUrls: true,
46-
...options,
47-
paths: [...(options.paths || []), dir],
48+
...lessOptions,
49+
paths: [...(lessOptions.paths || []), dir],
4850
};
4951

5052
try {

0 commit comments

Comments
 (0)