esbuild-css-modules-plugin
Advanced tools
Comparing version 2.0.7 to 2.0.8
17
index.js
const path = require('path'); | ||
const { createHash } = require('crypto'); | ||
const fse = require('fs-extra'); | ||
@@ -104,7 +105,7 @@ const fs = require('fs'); | ||
setup(build) { | ||
const { outdir, bundle, logLevel, watch } = build.initialOptions; | ||
const { v2 } = options; | ||
const tmpFiles = new Set(); | ||
const rootDir = process.cwd(); | ||
const tmpDirPath = tmp.dirSync().name; | ||
const { outdir, bundle, logLevel, watch } = build.initialOptions; | ||
const { v2 } = options; | ||
@@ -118,3 +119,9 @@ const outputLogs = logLevel === 'debug' || logLevel === 'verbose'; | ||
const fullPath = args.path; | ||
const tmpDir = tmp.dirSync().name; | ||
const hex = createHash('sha256').update(fullPath).digest('hex'); | ||
const tmpDir = path.resolve( | ||
process.cwd(), | ||
outdir, | ||
'.esbuild_plugin_css_modules', | ||
hex.slice(hex.length - 255, hex.length) | ||
); | ||
@@ -139,3 +146,3 @@ const tmpCssFile = path.join( | ||
tmpFiles.add(tmpCssFile); | ||
tmpFiles.add(tmpDir); | ||
@@ -154,3 +161,3 @@ return Promise.resolve({ | ||
try { | ||
fs.unlinkSync(f); | ||
fse.removeSync(f); | ||
} catch (error) {} | ||
@@ -157,0 +164,0 @@ }); |
{ | ||
"name": "esbuild-css-modules-plugin", | ||
"version": "2.0.7", | ||
"version": "2.0.8", | ||
"description": "A esbuild plugin to bundle css modules into js(x)/ts(x).", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -48,2 +48,3 @@ const esbuild = require('esbuild'); | ||
entryPoints: ['app.jsx'], | ||
entryNames: '[name]-[hash]', | ||
format: 'esm', | ||
@@ -50,0 +51,0 @@ target: ['es2020'], |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21628
295