Socket
Socket
Sign inDemoInstall

jiti

Package Overview
Dependencies
Maintainers
0
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jiti - npm Package Compare versions

Comparing version 2.0.0-beta.2 to 2.0.0-beta.3

23

lib/types.d.ts

@@ -14,11 +14,12 @@ export declare function createJiti(id: string, userOptions?: JitiOptions): Jiti;

*/
import: (id: string) => Promise<unknown>;
import(id: string, opts?: JitiResolveOptions): Promise<unknown>;
/**
* Resolve with ESM import conditions.
*/
importResolve: (
esmResolve<T extends JitiResolveOptions = JitiResolveOptions>(
id: string,
parentURL?: string,
opts?: { conditions?: string[] },
) => string;
opts?: T,
): T["try"] extends true ? string | undefined : string;
/**

@@ -28,2 +29,3 @@ * Transform source code

transform: (opts: TransformOptions) => string;
/**

@@ -44,3 +46,3 @@ * Evaluate transformed code as a module

*
* By default (when is `true`), jiti uses `node_modules/.cache/jiti` (if exists) or `{TMP_DIR}/node-jiti`.
* By default (when is `true`), jiti uses `node_modules/.cache/jiti` (if exists) or `{TMP_DIR}/jiti`.
*

@@ -91,2 +93,4 @@ * This option can also be disabled using `JITI_FS_CACHE=false` environment variable.

* Interop default export (disabled by default)
*
* Can be enabled using `JITI_INTEROP_DEFAULT=1` environment variable.
*/

@@ -155,2 +159,3 @@ interopDefault?: boolean;

retainLines?: boolean;
interopDefault?: boolean;
async: boolean;

@@ -164,1 +169,7 @@ [key: string]: any;

}
export interface JitiResolveOptions {
conditions?: string[];
parentURL?: string | URL;
try?: boolean;
}
{
"name": "jiti",
"version": "2.0.0-beta.2",
"version": "2.0.0-beta.3",
"description": "Runtime typescript and ESM support for Node.js",

@@ -42,2 +42,3 @@ "repository": "unjs/jiti",

"lint:fix": "eslint --fix . && prettier -w src lib test stubs",
"prepack": "pnpm build",
"release": "pnpm build && pnpm test && changelogen --release --prerelease --push --publish --publishTag 2x",

@@ -70,3 +71,2 @@ "test": "pnpm lint && vitest run --coverage && pnpm test:register && pnpm test:bun",

"config": "^3.3.12",
"create-require": "^1.1.1",
"destr": "^2.0.3",

@@ -92,5 +92,6 @@ "escape-string-regexp": "^5.0.0",

"webpack-cli": "^5.1.4",
"webpack-license-plugin": "^4.4.2"
"webpack-license-plugin": "^4.4.2",
"yoctocolors": "^2.1.0"
},
"packageManager": "pnpm@9.4.0"
}

@@ -71,2 +71,4 @@ # jiti

```js
// --- Initialize ---
// ESM

@@ -80,7 +82,17 @@ import { createJiti } from "jiti";

// --- ESM Compatible APIs ---
// jiti.import() acts like import() with Typescript support
await jiti.import("./path/to/file.ts");
// jiti.esmResolve() acts like import.meta.resolve() with additional features
const resolvedPath = jiti.esmResolve("./src");
// --- CJS Compatible APIs ---
// jiti() acts like require() with Typescript and (non async) ESM support
jiti("./path/to/file.ts");
// jiti.resolve() acts like require.resolve() with additional features
const resolvedPath = jiti.resolve("./src");
```

@@ -116,5 +128,5 @@

- Default: `false`
- Environment Variable: `JITI_DEBUG`
- Environment variable: `JITI_DEBUG`
Enable debug to see which files are transpiled
Enable verbose logging. You can use `JITI_DEBUG=1 <your command>` to enable it.

@@ -125,7 +137,7 @@ ### `fsCache`

- Default: `true`
- Environment Variable: `JITI_FS_CACHE`
- Environment variable: `JITI_FS_CACHE`
Filesystem source cache (enabled by default)
By default (when is `true`), jiti uses `node_modules/.cache/jiti` (if exists) or `{TMP_DIR}/node-jiti`.
By default (when is `true`), jiti uses `node_modules/.cache/jiti` (if exists) or `{TMP_DIR}/jiti`.

@@ -138,3 +150,3 @@ **Note:** It is recommended to keep this option enabled for better performance.

- Default: `true`
- Environment Variable: `JITI_MODULE_CACHE`
- Environment variable: `JITI_MODULE_CACHE`

@@ -158,3 +170,3 @@ Runtime module cache (enabled by default).

- Default `false`
- Environment Variable: `JITI_SOURCE_MAPS`
- Environment variable: `JITI_SOURCE_MAPS`

@@ -167,2 +179,3 @@ Add inline source map to transformed source for better debugging.

- Default: `false`
- Environment variable: `JITI_INTEROP_DEFAULT`

@@ -175,3 +188,3 @@ Return the `.default` export of a module at the top-level.

- Default: -
- Environment Variable: `JITI_ALIAS`
- Environment variable: `JITI_ALIAS`

@@ -184,3 +197,3 @@ Custom alias map used to resolve ids.

- Default: ['typescript`]
- Environment Variable: `JITI_NATIVE_MODULES`
- Environment variable: `JITI_NATIVE_MODULES`

@@ -193,3 +206,3 @@ List of modules (within `node_modules`) to always use native require for them.

- Default: []
- Environment Variable: `JITI_TRANSFORM_MODULES`
- Environment variable: `JITI_TRANSFORM_MODULES`

@@ -202,3 +215,3 @@ List of modules (within `node_modules`) to transform them regardless of syntax.

- Default: Enabled if `process.versions.bun` exists (Bun runtime)
- Environment Variable: `JITI_EXPERIMENTAL_BUN`
- Environment variable: `JITI_EXPERIMENTAL_BUN`

@@ -205,0 +218,0 @@ Enable experimental native Bun support for transformations.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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