Socket
Socket
Sign inDemoInstall

jiti

Package Overview
Dependencies
0
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.16.0 to 1.16.1

16

bin/jiti.js
#!/usr/bin/env node
const { resolve } = require('path')
const { resolve } = require("path");
const script = process.argv.splice(2, 1)[0]
const script = process.argv.splice(2, 1)[0];
if (!script) {
// eslint-disable-next-line no-console
console.error('Usage: jiti <path> [...arguments]')
process.exit(1)
console.error("Usage: jiti <path> [...arguments]");
process.exit(1);
}
const pwd = process.cwd()
const jiti = require('..')(pwd)
const resolved = process.argv[1] = jiti.resolve(resolve(pwd, script))
jiti(resolved)
const pwd = process.cwd();
const jiti = require("..")(pwd);
const resolved = (process.argv[1] = jiti.resolve(resolve(pwd, script)));
jiti(resolved);

@@ -1,2 +0,2 @@

import { TransformOptions, TRANSFORM_RESULT } from './types';
import { TransformOptions, TRANSFORM_RESULT } from "./types";
export default function transform(opts: TransformOptions): TRANSFORM_RESULT;
/// <reference types="node" />
import { TransformOptions, JITIOptions } from './types';
declare type Require = typeof require;
import { TransformOptions, JITIOptions } from "./types";
type Require = typeof require;
export interface JITI extends Require {
transform: (opts: TransformOptions) => string;
register: () => (() => void);
register: () => () => void;
}
export default function createJITI(_filename: string, opts?: JITIOptions, parentModule?: typeof module): JITI;
export {};

@@ -1,4 +0,4 @@

import type { PluginObj } from '@babel/core';
import type { PluginObj } from "@babel/core";
export declare function TransformImportMetaPlugin(_ctx: any, opts: {
filename?: string;
}): PluginObj<import("@babel/core").PluginPass>;

@@ -1,2 +0,2 @@

export declare type TransformOptions = {
export type TransformOptions = {
source: string;

@@ -9,7 +9,7 @@ filename?: string;

};
export declare type TRANSFORM_RESULT = {
export type TRANSFORM_RESULT = {
code: string;
error?: any;
};
export declare type JITIOptions = {
export type JITIOptions = {
transform?: (opts: TransformOptions) => TRANSFORM_RESULT;

@@ -27,3 +27,3 @@ debug?: boolean;

extensions?: string[];
transformOptions?: Omit<TransformOptions, 'source'>;
transformOptions?: Omit<TransformOptions, "source">;
alias?: Record<string, string>;

@@ -30,0 +30,0 @@ nativeModules?: string[];

@@ -1,2 +0,2 @@

import type { PackageJson } from 'pkg-types';
import type { PackageJson } from "pkg-types";
export declare function isDir(filename: string): boolean;

@@ -3,0 +3,0 @@ export declare function isWritable(filename: string): boolean;

@@ -1,15 +0,15 @@

function onError (err) {
throw err /* ↓ Check stack trace ↓ */
function onError(err) {
throw err; /* ↓ Check stack trace ↓ */
}
module.exports = function (filename, opts) {
const jiti = require('../dist/jiti')
const jiti = require("../dist/jiti");
opts = { onError, ...opts }
opts = { onError, ...opts };
if (!opts.transform) {
opts.transform = require('../dist/babel')
opts.transform = require("../dist/babel");
}
return jiti(filename, opts)
}
return jiti(filename, opts);
};
{
"name": "jiti",
"version": "1.16.0",
"description": "Runtime typescript and ESM support for Node.js (CommonJS)",
"version": "1.16.1",
"description": "Runtime typescript and ESM support for Node.js",
"repository": "unjs/jiti",

@@ -16,23 +16,22 @@ "license": "MIT",

"devDependencies": {
"@babel/core": "^7.19.1",
"@babel/plugin-proposal-decorators": "^7.19.1",
"@babel/core": "^7.20.7",
"@babel/plugin-proposal-decorators": "^7.20.7",
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
"@babel/plugin-proposal-optional-chaining": "^7.18.9",
"@babel/plugin-proposal-optional-chaining": "^7.20.7",
"@babel/plugin-syntax-class-properties": "^7.12.13",
"@babel/plugin-transform-modules-commonjs": "^7.18.6",
"@babel/plugin-transform-typescript": "^7.19.1",
"@babel/plugin-transform-modules-commonjs": "^7.20.11",
"@babel/plugin-transform-typescript": "^7.20.7",
"@babel/preset-typescript": "^7.18.6",
"@babel/template": "^7.18.10",
"@babel/types": "^7.19.0",
"@nuxtjs/eslint-config-typescript": "^11.0.0",
"@types/babel__core": "^7.1.19",
"@babel/template": "^7.20.7",
"@babel/types": "^7.20.7",
"@types/babel__core": "^7.1.20",
"@types/babel__template": "^7.4.1",
"@types/mkdirp": "^1.0.2",
"@types/node": "^18.7.18",
"@types/object-hash": "^2.2.1",
"@types/node": "^18.11.18",
"@types/object-hash": "^3.0.2",
"@types/resolve": "^1.20.2",
"@types/semver": "^7.3.12",
"@vitest/coverage-c8": "^0.23.4",
"acorn": "^8.8.0",
"@types/semver": "^7.3.13",
"@vitest/coverage-c8": "^0.26.3",
"acorn": "^8.8.1",
"babel-plugin-dynamic-import-node": "^2.3.3",

@@ -43,5 +42,6 @@ "babel-plugin-parameter-decorator": "^1.0.16",

"cross-env": "^7.0.3",
"destr": "^1.1.1",
"destr": "^1.2.2",
"escape-string-regexp": "^5.0.0",
"eslint": "^8.23.1",
"eslint": "^8.31.0",
"eslint-config-unjs": "^0.0.3",
"esm": "^3.2.25",

@@ -52,18 +52,19 @@ "estree-walker": "^3.0.1",

"mkdirp": "^1.0.4",
"mlly": "^0.5.14",
"mlly": "^1.0.0",
"object-hash": "^3.0.0",
"pathe": "^0.3.8",
"pathe": "^1.0.0",
"pirates": "^4.0.5",
"pkg-types": "^0.3.5",
"semver": "^7.3.7",
"pkg-types": "^1.0.1",
"prettier": "^2.8.1",
"semver": "^7.3.8",
"standard-version": "^9.5.0",
"terser-webpack-plugin": "^5.3.6",
"ts-loader": "^9.4.0",
"tslib": "^2.4.0",
"typescript": "^4.8.3",
"vitest": "^0.23.4",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
"ts-loader": "^9.4.2",
"tslib": "^2.4.1",
"typescript": "^4.9.4",
"vitest": "^0.26.3",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1"
},
"packageManager": "pnpm@7.12.0",
"packageManager": "pnpm@7.21.0",
"scripts": {

@@ -75,3 +76,3 @@ "build": "pnpm clean && cross-env NODE_ENV=production pnpm webpack",

"jiti:legacy": "cross-env JITI_DEBUG=1 npx node@12 ./bin/jiti.js",
"lint": "eslint --ext .ts,.js .",
"lint": "eslint --ext .ts,.js . && prettier -c .",
"release": "pnpm build && pnpm test && pnpm standard-version && git push --follow-tags && pnpm publish",

@@ -78,0 +79,0 @@ "test": "pnpm lint && vitest run --coverage"

# jiti
> Runtime typescript and ESM support for Node.js (CommonJS)
> Runtime typescript and ESM support for Node.js

@@ -26,5 +26,5 @@ [![version][npm-v-src]][npm-v-href]

```js
const jiti = require('jiti')(__filename)
const jiti = require("jiti")(__filename);
jiti('./path/to/file.ts')
jiti("./path/to/file.ts");
```

@@ -35,3 +35,3 @@

```js
const jiti = require('jiti')(__filename, { debug: true })
const jiti = require("jiti")(__filename, { debug: true });
```

@@ -53,5 +53,6 @@

Alternatively, you can register `jiti` as a require hook programmatically:
```js
const jiti = require('jiti')()
const unregister = jiti.register()
const jiti = require("jiti")();
const unregister = jiti.register();
```

@@ -135,7 +136,7 @@

- Clone Repo
- Run `yarn`
- Run `yarn build`
- Run `yarn dev`
- Run `yarn jiti ./test/path/to/file.ts`
- Clone this repository
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable`
- Install dependencies using `pnpm install`
- Run `pnpm dev`
- Run `pnpm jiti ./test/path/to/file.ts`

@@ -147,12 +148,10 @@ ## License

<!-- Refs -->
[npm-v-src]: https://img.shields.io/npm/v/jiti?style=flat-square
[npm-v-href]: https://npmjs.com/package/jiti
[npm-d-src]: https://img.shields.io/npm/dm/jiti?style=flat-square
[npm-d-href]: https://npmjs.com/package/jiti
[github-actions-src]: https://img.shields.io/github/workflow/status/unjs/jiti/ci/master?style=flat-square
[github-actions-href]: https://github.com/unjs/jiti/actions?query=workflow%3Aci
[size-src]: https://packagephobia.now.sh/badge?p=jiti
[size-href]: https://packagephobia.now.sh/result?p=jiti

@@ -1,3 +0,3 @@

const jiti = require('.')()
const jiti = require(".")();
jiti.register()
jiti.register();

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

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc