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

esbuild-css-modules-plugin

Package Overview
Dependencies
Maintainers
1
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esbuild-css-modules-plugin - npm Package Compare versions

Comparing version 2.6.1-beta.1 to 2.6.2

40

lib/utils.js

@@ -110,7 +110,7 @@ const path = require('path');

/**
* getPackageVersion
* getPackageInfo
* @param {import('..').Build} build
* @returns {string}
* @returns {{name: string; version: string;}}
*/
const getPackageVersion = (build) => {
const getPackageInfo = (build) => {
const rootDir = getRootDir(build);

@@ -120,5 +120,5 @@ const packageJsonFile = path.resolve(rootDir, './package.json');

fs.accessSync(packageJsonFile, fs.constants.R_OK);
return require(packageJsonFile).version ?? '';
return require(packageJsonFile);
} catch (error) {
return '';
return { name: '', version: '' };
}

@@ -128,2 +128,11 @@ };

/**
* getPackageVersion
* @param {import('..').Build} build
* @returns {string}
*/
const getPackageVersion = (build) => {
return getPackageInfo(build).version;
};
/**
* getRelativePath

@@ -152,3 +161,3 @@ * @description get relative path from build root

const buildRoot = getRootDir(build);
const packageVersion = getPackageVersion(build);
const { version: packageVersion, name: packageName } = getPackageInfo(build);
let entries = [];

@@ -164,10 +173,12 @@ if (Array.isArray(entryPoints)) {

}
const entryContents = packageVersion + (
await Promise.all(
entries.map(async (p) => {
const absPath = path.isAbsolute(p) ? p : path.resolve(buildRoot, p);
return (await readFile(absPath, { encoding: 'utf8' })).trim();
})
)
).join('');
const entryContents =
`// ${packageName}@${packageVersion}\n` +
(
await Promise.all(
entries.map(async (p) => {
const absPath = path.isAbsolute(p) ? p : path.resolve(buildRoot, p);
return (await readFile(absPath, { encoding: 'utf8' })).trim();
})
)
).join('\n');
return createHash('sha256').update(entryContents).digest('hex');

@@ -246,3 +257,4 @@ };

validateNamedExport,
getPackageInfo,
getPackageVersion
};
{
"name": "esbuild-css-modules-plugin",
"version": "2.6.1-beta.1",
"version": "2.6.2",
"description": "A esbuild plugin to bundle css modules into js(x)/ts(x).",

@@ -5,0 +5,0 @@ "main": "./index.js",

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