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

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.2.2 to 0.3.0-beta.0

7

esbuild-jest.d.ts

@@ -1,5 +0,6 @@

declare const _default: {
process(content: string, filename: string): {};
declare function process(content: string, filename: string): {
code: string;
map: any;
};
export default _default;
export { process };

@@ -1,36 +0,31 @@

import { resolve } from 'path';
import { buildSync } from 'esbuild';
import { builtinModules } from 'module';
import { transformSync } from 'esbuild';
import { extname, resolve } from 'path';
import { existsSync, readFileSync } from 'fs';
var _a, _b, _c;
const pkg = require(resolve("package.json"));
const external = [
...builtinModules,
...Object.keys((_a = pkg.dependencies) != null ? _a : {}),
...Object.keys((_b = pkg.devDependencies) != null ? _b : {}),
...Object.keys((_c = pkg.peerDependencies) != null ? _c : {})
];
const build = (filename) => {
const {outputFiles} = buildSync({
entryPoints: [filename],
outdir: "./dist",
minify: false,
bundle: true,
write: false,
target: "es2018",
sourcemap: true,
external
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
});
return outputFiles.reduce((cur, item) => {
const key = item.path.includes(".map") ? "map" : "code";
cur[key] = Buffer.from(item.contents).toString();
return cur;
}, {});
};
var index = {
process(content, filename) {
return build(filename);
}
};
return {
code: result.js,
map: {
...JSON.parse(result.jsSourceMap),
sourcesContent: null
}
};
}
export default index;
export { process };
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var esbuild = require('esbuild');
var path = require('path');
var esbuild = require('esbuild');
var module$1 = require('module');
var fs = require('fs');
var _a, _b, _c;
const pkg = require(path.resolve("package.json"));
const external = [
...module$1.builtinModules,
...Object.keys((_a = pkg.dependencies) != null ? _a : {}),
...Object.keys((_b = pkg.devDependencies) != null ? _b : {}),
...Object.keys((_c = pkg.peerDependencies) != null ? _c : {})
];
const build = (filename) => {
const {outputFiles} = esbuild.buildSync({
entryPoints: [filename],
outdir: "./dist",
minify: false,
bundle: true,
write: false,
target: "es2018",
sourcemap: true,
external
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
});
return outputFiles.reduce((cur, item) => {
const key = item.path.includes(".map") ? "map" : "code";
cur[key] = Buffer.from(item.contents).toString();
return cur;
}, {});
};
var index = {
process(content, filename) {
return build(filename);
}
};
return {
code: result.js,
map: {
...JSON.parse(result.jsSourceMap),
sourcesContent: null
}
};
}
module.exports = index;
exports.process = process;
{
"name": "esbuild-jest",
"version": "0.2.2",
"version": "0.3.0-beta.0",
"description": "Jest plugin to use esbuild for transformation",

@@ -23,5 +23,5 @@ "main": "esbuild-jest.js",

"homepage": "https://github.com/aelbore/esbuild-jest#readme",
"dependencies": {
"esbuild": "^0.6.16"
"peerDependencies": {
"esbuild": ">=0.7.8"
}
}

@@ -11,3 +11,3 @@ # esbuild-jest

```bash
npm install --save-dev esbuild-jest
npm install --save-dev esbuild-jest esbuild
```

@@ -14,0 +14,0 @@

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