Socket
Socket
Sign inDemoInstall

esbuild-jest

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esbuild-jest - npm Package Compare versions

Comparing version 0.3.0-beta.0 to 0.3.0-beta.1

22

esbuild-jest.es.js
import { transformSync } from 'esbuild';
import { extname, resolve } from 'path';
import { existsSync, readFileSync } from 'fs';
import { extname } from 'path';
const getOptions = () => {
var _a;
const tsconfigPath = resolve("tsconfig.json");
const tsconfig = existsSync(tsconfigPath) ? JSON.parse(readFileSync(resolve("tsconfig.json"), "utf-8")) : {compilerOptions: {target: "es2018"}};
return {
format: "cjs",
target: ((_a = tsconfig.compilerOptions) == null ? void 0 : _a.target) || "es2018",
sourcemap: true
};
};
function process(content, filename) {
const options = getOptions();
const result = transformSync(content, {
loader: extname(filename).slice(1),
sourcefile: filename,
...options
sourcemap: true,
format: "cjs",
target: "es2018"
});
return {
code: result.js,
code: result.code,
map: {
...JSON.parse(result.jsSourceMap),
...JSON.parse(result.map),
sourcesContent: null

@@ -27,0 +17,0 @@ }

@@ -7,25 +7,15 @@ 'use strict';

var path = require('path');
var fs = require('fs');
const getOptions = () => {
var _a;
const tsconfigPath = path.resolve("tsconfig.json");
const tsconfig = fs.existsSync(tsconfigPath) ? JSON.parse(fs.readFileSync(path.resolve("tsconfig.json"), "utf-8")) : {compilerOptions: {target: "es2018"}};
return {
format: "cjs",
target: ((_a = tsconfig.compilerOptions) == null ? void 0 : _a.target) || "es2018",
sourcemap: true
};
};
function process(content, filename) {
const options = getOptions();
const result = esbuild.transformSync(content, {
loader: path.extname(filename).slice(1),
sourcefile: filename,
...options
sourcemap: true,
format: "cjs",
target: "es2018"
});
return {
code: result.js,
code: result.code,
map: {
...JSON.parse(result.jsSourceMap),
...JSON.parse(result.map),
sourcesContent: null

@@ -32,0 +22,0 @@ }

{
"name": "esbuild-jest",
"version": "0.3.0-beta.0",
"version": "0.3.0-beta.1",
"description": "Jest plugin to use esbuild for transformation",

@@ -5,0 +5,0 @@ "main": "esbuild-jest.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