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

hylite

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hylite - npm Package Compare versions

Comparing version 0.3.0 to 1.0.0

.github/workflows/node.yml

2

package.json
{
"name": "hylite",
"version": "0.3.0",
"version": "1.0.0",
"description": "A command line tool for highlighting code",

@@ -5,0 +5,0 @@ "author": "Peter @peterbe Bengtsson",

@@ -6,1 +6,21 @@ await Bun.build({

});
await retroFix();
async function retroFix() {
// Got this from
// https://github.com/oven-sh/bun/issues/5707#issuecomment-1730511178
const IMPORT_META_REQUIRE_POLYFILL = `import { createRequire as createImportMetaRequire } from "module"; import.meta.require ||= (id) => createImportMetaRequire(import.meta.url)(id);`;
const DIST_FILE = "./dist/index.js";
const outputFile = Bun.file(DIST_FILE);
const output = await outputFile.text();
const newLines: string[] = [];
for (const line of output.split("\n")) {
newLines.push(line);
if (line.startsWith("#!")) {
newLines.push(IMPORT_META_REQUIRE_POLYFILL);
}
}
const newOutput = newLines.join("\n");
await Bun.write(DIST_FILE, newOutput);
}
#!/usr/bin/env bun
import fs from "fs";
import { readFile, writeFile } from "fs/promises";
import { readdir } from "fs/promises";

@@ -39,3 +41,3 @@ import { extname } from "path";

}
code = await Bun.file(args[0]).text();
code = fs.readFileSync(args[0], "utf8");
} else {

@@ -47,5 +49,4 @@ code = args[0];

} else {
for await (const line of console) {
code += line + "\n";
}
const stdinBuffer = fs.readFileSync(0); // STDIN_FILENO = 0
code = stdinBuffer.toString();
}

@@ -118,4 +119,6 @@

if (css && !code && !previewServer) {
const cssFile = Bun.file(`node_modules/highlight.js/styles/${css}.css`);
cssContent = await cssFile.text();
cssContent = await readFile(
`node_modules/highlight.js/styles/${css}.css`,
"utf-8",
);
process.stdout.write(cssContent);

@@ -146,3 +149,3 @@ return;

if (outputFile) {
await Bun.write(outputFile, html);
await writeFile(outputFile, html, "utf-8");
} else {

@@ -152,3 +155,3 @@ process.stdout.write(html);

} else if (outputFile) {
await Bun.write(outputFile, output);
await writeFile(outputFile, output, "utf-8");
} else {

@@ -164,4 +167,3 @@ if (wrapped) {

async function getCSS(name = "default") {
const cssFile = Bun.file(`node_modules/highlight.js/styles/${name}.css`);
return await cssFile.text();
return readFile(`node_modules/highlight.js/styles/${name}.css`, "utf-8");
}

@@ -168,0 +170,0 @@

Sorry, the diff of this file is too big to display

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