Skip to content

Commit 173feb2

Browse files
committed
2.6.3
1 parent f64cdba commit 173feb2

File tree

4 files changed

+27
-20
lines changed

4 files changed

+27
-20
lines changed

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## V2.6.3
2+
- upgrade dependencies
3+
- fix #45 #46, thanks to @markdalgleish
4+
15
## V2.6.0
26
- `@parcel/css` now named `lightningcss`
37
- support pascal case by @FuriouZz [#43](https://github.com/indooorsman/esbuild-css-modules-plugin/pull/43)

lib/plugin.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ const prepareBuild = async (build, options) => {
167167
*/
168168
const onResolveModulesCss = async (args, build) => {
169169
const { resolve, initialOptions, context } = build;
170-
const { resolveDir, path: p, pluginData = {} } = args;
170+
const { resolveDir, path: p, pluginData = {}, kind } = args;
171171
const { log, relative } = context;
172-
const { path: absPath } = await resolve(p, { resolveDir });
172+
const { path: absPath } = await resolve(p, { resolveDir, kind });
173173
const rpath = relative(absPath);
174174
log('resolve', p, 'to', rpath, 'from build root');
175175

@@ -455,13 +455,13 @@ const setup = async (build, options) => {
455455
const builtModulesCssRegExp = getBuiltModulesCssRegExp(options);
456456

457457
// resolve xxx.module.css to xxx.module.css?esbuild-css-modules-plugin-building
458-
build.onResolve({ filter: modulesCssRegExp, namespace: 'file' }, async (args) => {
459-
return await onResolveModulesCss(args, build);
458+
build.onResolve({ filter: modulesCssRegExp, namespace: 'file' }, (args) => {
459+
return onResolveModulesCss(args, build);
460460
});
461461

462462
// load xxx.module.css?esbuild-css-modules-plugin-building
463-
build.onLoad({ filter: modulesCssRegExp, namespace: pluginNamespace }, async (args) => {
464-
return await onLoadModulesCss(build, options, args);
463+
build.onLoad({ filter: modulesCssRegExp, namespace: pluginNamespace }, (args) => {
464+
return onLoadModulesCss(build, options, args);
465465
});
466466

467467
// resolve virtual path xxx.module.css?esbuild-css-modules-plugin-built
@@ -470,8 +470,8 @@ const setup = async (build, options) => {
470470
filter: builtModulesCssRegExp,
471471
namespace: pluginNamespace
472472
},
473-
async (args) => {
474-
return await onResolveBuiltModulesCss(args, build);
473+
(args) => {
474+
return onResolveBuiltModulesCss(args, build);
475475
}
476476
);
477477

@@ -481,13 +481,13 @@ const setup = async (build, options) => {
481481
filter: builtModulesCssRegExp,
482482
namespace: pluginNamespace
483483
},
484-
async (args) => {
485-
return await onLoadBuiltModulesCss(args, build);
484+
(args) => {
485+
return onLoadBuiltModulesCss(args, build);
486486
}
487487
);
488488

489489
build.onEnd(async (result) => {
490-
await onEnd(build, options, result);
490+
onEnd(build, options, result);
491491
});
492492
};
493493

lib/utils.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ const getBuildId = async (build) => {
160160
if (Array.isArray(entryPoints)) {
161161
entries = [...entryPoints];
162162
} else {
163-
Object.keys(entryPoints)
163+
Object.keys(entryPoints ?? {})
164164
.sort()
165165
.forEach((k) => {
166166
entries.push(entryPoints[k]);
@@ -170,9 +170,12 @@ const getBuildId = async (build) => {
170170
`// ${packageName}@${packageVersion}\n` +
171171
(
172172
await Promise.all(
173-
entries.map(async (p) => {
173+
entries.map((p) => {
174+
if (!p) {
175+
return Promise.resolve('');
176+
}
174177
const absPath = path.isAbsolute(p) ? p : path.resolve(buildRoot, p);
175-
return (await readFile(absPath, { encoding: 'utf8' })).trim();
178+
return readFile(absPath, { encoding: 'utf8' }).catch(() => '');
176179
})
177180
)
178181
).join('\n');

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "esbuild-css-modules-plugin",
3-
"version": "2.6.2",
3+
"version": "2.6.3",
44
"description": "A esbuild plugin to bundle css modules into js(x)/ts(x).",
55
"main": "./index.js",
66
"types": "./index.d.ts",
@@ -22,17 +22,17 @@
2222
},
2323
"devDependencies": {
2424
"@types/node": "^17.0.23",
25-
"esbuild": "^0.15.5"
25+
"esbuild": "^0.16.2"
2626
},
2727
"peerDependencies": {
28-
"esbuild": "^0.14.0 || ^0.15.0"
28+
"esbuild": "*"
2929
},
3030
"dependencies": {
31-
"lightningcss": "^1.16.0",
31+
"lightningcss": "^1.17.1",
3232
"fs-extra": "^10.1.0",
3333
"lodash": "^4.17.21",
34-
"postcss": "^8.4.12",
35-
"postcss-modules": "^4.3.1",
34+
"postcss": "^8.4.19",
35+
"postcss-modules": "^6.0.0",
3636
"tmp": "^0.2.1"
3737
},
3838
"publishConfig": {

0 commit comments

Comments
 (0)