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

@chialab/esbuild-rna

Package Overview
Dependencies
Maintainers
2
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chialab/esbuild-rna - npm Package Compare versions

Comparing version 0.15.0 to 0.15.1

14

lib/helpers.js

@@ -77,10 +77,10 @@ import path from 'path';

const dependencies = context.dependencies = context.dependencies || {};
for (const out of Object.values(resultMeta.outputs)) {
if (!out.entryPoint) {
continue;
}
const entryPoint = out.entryPoint;
for (const out of Object.entries(result.dependencies)) {
const entryPoint = out[0];
const list = dependencies[entryPoint] = dependencies[entryPoint] || [];
list.push(...Object.keys(out.inputs).map((file) => file));
out[1].forEach((dep) => {
if (!list.includes(dep)) {
list.push(dep);
}
});
}

@@ -87,0 +87,0 @@ }

@@ -112,2 +112,24 @@ import path from 'path';

/**
* Create file path replacing esbuild patterns.
* @see https://esbuild.github.io/api/#chunk-names
* @param {string} pattern The esbuild pattern.
* @param {string} filePath The full file path.
* @param {Buffer|string} buffer The file contents.
* @return {string}
*/
export function computeName(pattern, filePath, buffer) {
const inputFile = path.basename(filePath);
return `${pattern
.replace('[name]', path.basename(inputFile, path.extname(inputFile)))
.replace('[ext]', path.extname(inputFile))
.replace('[hash]', () => {
const hash = crypto.createHash('sha1');
hash.update(/** @type {Buffer} */ (buffer));
return hash.digest('hex').substr(0, 8);
})
}${path.extname(inputFile)}`;
}
/**
* Enrich the esbuild build with a transformation pipeline and emit methods.

@@ -285,16 +307,7 @@ * @param {import('esbuild').PluginBuild} build The esbuild build.

const { assetNames = '[name]' } = build.initialOptions;
const ext = path.extname(source);
const basename = path.basename(source, ext);
buffer = buffer || await readFile(source);
const computedName = assetNames
.replace('[name]', basename)
.replace('[hash]', () => {
const hash = crypto.createHash('sha1');
hash.update(/** @type {Buffer} */ (buffer));
return hash.digest('hex').substr(0, 8);
});
const outputFile = path.join(fullOutDir, `${computedName}${ext}`);
const computedName = computeName(assetNames, source, buffer);
const outputFile = path.join(fullOutDir, computedName);
const bytes = buffer.length;

@@ -559,2 +572,3 @@ if (write) {

rnaBuild.files.forEach((result) => assignToResult(rnaResult, result));
console.log(rnaResult.dependencies);

@@ -561,0 +575,0 @@ if (buildResult.outputFiles && buildResult.outputFiles.length) {

{
"name": "@chialab/esbuild-rna",
"type": "module",
"version": "0.15.0",
"version": "0.15.1",
"description": "A framework for esbuild plugins with transform and emit capabilities.",

@@ -38,3 +38,3 @@ "main": "lib/index.js",

},
"gitHead": "7e89cbdd47fc575af90e1b4410f40fbed3289498"
"gitHead": "348a03347fd67f2e9994bcab093f307eb4fc1b1e"
}
/// <reference types="node" />
/**
* Create file path replacing esbuild patterns.
* @see https://esbuild.github.io/api/#chunk-names
* @param {string} pattern The esbuild pattern.
* @param {string} filePath The full file path.
* @param {Buffer|string} buffer The file contents.
* @return {string}
*/
export function computeName(pattern: string, filePath: string, buffer: Buffer | string): string;
/**
* Enrich the esbuild build with a transformation pipeline and emit methods.

@@ -4,0 +13,0 @@ * @param {import('esbuild').PluginBuild} build The esbuild build.

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