From 4df2868eccd49dd50de05ccb3e9c04dbf44061f9 Mon Sep 17 00:00:00 2001 From: indooorsman Date: Thu, 19 Jan 2023 17:13:14 +0800 Subject: [PATCH] 2.7.1 --- changelog.md | 3 +++ index.d.ts | 2 ++ lib/plugin.js | 7 ++----- package.json | 10 +++++----- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/changelog.md b/changelog.md index 7001b8a..126833a 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,6 @@ +## V2.7.1 +- support esbuild@^0.17 + ## V2.7.0 - fix inject logic to avoid styles missing in some micro-frontend framework - ***Important***: there's a breaking change of inject logic, before this version the inject method would be deleted once it's called, from this verson it will ***not*** be deleted anymore, for people using custom inject method please pay attention. diff --git a/index.d.ts b/index.d.ts index f580c9c..70a9f4f 100644 --- a/index.d.ts +++ b/index.d.ts @@ -70,6 +70,8 @@ declare interface PluginOptions { version?: string; }; usePascalCase?: boolean; + /** since esbuild@0.17 has removed the `watch` option, you have to set it here explicitly */ + watch?: boolean; } declare interface BuildContext { diff --git a/lib/plugin.js b/lib/plugin.js index dd5fdb5..f019f9f 100644 --- a/lib/plugin.js +++ b/lib/plugin.js @@ -189,10 +189,7 @@ const onResolveModulesCss = async (args, build) => { pluginName }; - if (initialOptions.watch) { - log('watching', rpath); - result.watchFiles = [absPath]; - } + result.watchFiles = [absPath]; return result; }; @@ -214,7 +211,7 @@ const onLoadModulesCss = async (build, options, args) => { log(`loading ${rpath}${args.suffix}`); - const useCache = build.initialOptions.watch; + const useCache = build.initialOptions.watch ?? options.watch ?? false; useCache && log(`checking cache for`, rpath); const cached = useCache && (await cache.get(absPath)); diff --git a/package.json b/package.json index 1c96f7b..da2e5a3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "esbuild-css-modules-plugin", - "version": "2.7.0", + "version": "2.7.1", "description": "A esbuild plugin to bundle css modules into js(x)/ts(x).", "main": "./index.js", "types": "./index.d.ts", @@ -11,7 +11,7 @@ "css modules" ], "engines": { - "node": ">= 14" + "node": ">= 16" }, "author": "indooorsman@gmail.com", "license": "MIT", @@ -22,16 +22,16 @@ }, "devDependencies": { "@types/node": "^17.0.23", - "esbuild": "^0.16.2" + "esbuild": "^0.17.3" }, "peerDependencies": { "esbuild": "*" }, "dependencies": { - "lightningcss": "^1.17.1", + "lightningcss": "^1.18.0", "fs-extra": "^10.1.0", "lodash": "^4.17.21", - "postcss": "^8.4.19", + "postcss": "^8.4.21", "postcss-modules": "^6.0.0", "tmp": "^0.2.1" },