fix: Switch to Tailwind v3 - v4 incompatible with Astro
This commit is contained in:
217
node_modules/jiti/README.md
generated
vendored
217
node_modules/jiti/README.md
generated
vendored
@@ -1,152 +1,90 @@
|
||||
# jiti
|
||||
|
||||
<!-- automd:badges color=F0DB4F bundlephobia -->
|
||||
[![npm version][npm-version-src]][npm-version-href]
|
||||
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
||||
[![bundle][bundle-src]][bundle-href]
|
||||
[![License][license-src]][license-href]
|
||||
|
||||
[](https://npmjs.com/package/jiti)
|
||||
[](https://npmjs.com/package/jiti)
|
||||
[](https://bundlephobia.com/package/jiti)
|
||||
|
||||
<!-- /automd -->
|
||||
|
||||
> This is the active development branch. Check out [jiti/v1](https://github.com/unjs/jiti/tree/v1) for legacy v1 docs and code.
|
||||
|
||||
## 🌟 Used in
|
||||
|
||||
[Docusaurus](https://docusaurus.io/), [ESLint](https://github.com/eslint/eslint), [FormKit](https://formkit.com/), [Histoire](https://histoire.dev/), [Knip](https://knip.dev/), [Nitro](https://nitro.unjs.io/), [Nuxt](https://nuxt.com/), [PostCSS loader](https://github.com/webpack-contrib/postcss-loader), [Rsbuild](https://rsbuild.dev/), [Size Limit](https://github.com/ai/size-limit), [Slidev](https://sli.dev/), [Tailwindcss](https://tailwindcss.com/), [Tokenami](https://github.com/tokenami/tokenami), [UnoCSS](https://unocss.dev/), [WXT](https://wxt.dev/), [Winglang](https://www.winglang.io/), [Graphql code generator](https://the-guild.dev/graphql/codegen), [Lingui](https://lingui.dev/), [Scaffdog](https://scaff.dog/), [Storybook](https://storybook.js.org), [...UnJS ecosystem](https://unjs.io/), [...60M+ npm monthly downloads](https://npm.chart.dev/jiti), [...6M+ public repositories](https://github.com/unjs/jiti/network/dependents).
|
||||
|
||||
## ✅ Features
|
||||
|
||||
- Seamless TypeScript and ESM syntax support for Node.js
|
||||
- Seamless interoperability between ESM and CommonJS
|
||||
- Asynchronous API to replace `import()`
|
||||
- Synchronous API to replace `require()` (deprecated)
|
||||
- Super slim and zero dependency
|
||||
- Custom resolve aliases
|
||||
- Smart syntax detection to avoid extra transforms
|
||||
- Node.js native `require.cache` integration
|
||||
- Filesystem transpile with hard disk caches
|
||||
- ESM Loader support
|
||||
- JSX support (opt-in)
|
||||
Runtime Typescript and ESM support for Node.js.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> To enhance compatibility, jiti `>=2.1` enabled [`interopDefault`](#interopdefault) using a new Proxy method. If you migrated to `2.0.0` earlier, this might have caused behavior changes. In case of any issues during the upgrade, please [report](https://github.com/unjs/jiti/issues) so we can investigate to solve them. 🙏🏼
|
||||
> This is the support branch for jiti v1. Check out [jiti/main](https://github.com/unjs/jiti/tree/main) for the latest version and [unjs/jiti#174](https://github.com/unjs/jiti/issues/174) for the roadmap.
|
||||
|
||||
## 💡 Usage
|
||||
## Features
|
||||
|
||||
### CLI
|
||||
- Seamless typescript and ESM syntax support
|
||||
- Seamless interoperability between ESM and CommonJS
|
||||
- Synchronous API to replace `require`
|
||||
- Super slim and zero dependency
|
||||
- Smart syntax detection to avoid extra transforms
|
||||
- CommonJS cache integration
|
||||
- Filesystem transpile hard cache
|
||||
- V8 compile cache
|
||||
- Custom resolve alias
|
||||
|
||||
You can use `jiti` CLI to quickly run any script with TypeScript and native ESM support!
|
||||
|
||||
```bash
|
||||
npx jiti ./index.ts
|
||||
```
|
||||
## Usage
|
||||
|
||||
### Programmatic
|
||||
|
||||
Initialize a jiti instance:
|
||||
|
||||
```js
|
||||
// ESM
|
||||
import { createJiti } from "jiti";
|
||||
const jiti = createJiti(import.meta.url);
|
||||
const jiti = require("jiti")(__filename);
|
||||
|
||||
// CommonJS (deprecated)
|
||||
const { createJiti } = require("jiti");
|
||||
const jiti = createJiti(__filename);
|
||||
jiti("./path/to/file.ts");
|
||||
```
|
||||
|
||||
Import (async) and resolve with ESM compatibility:
|
||||
You can also pass options as second argument:
|
||||
|
||||
```js
|
||||
// jiti.import(id) is similar to import(id)
|
||||
const mod = await jiti.import("./path/to/file.ts");
|
||||
|
||||
// jiti.esmResolve(id) is similar to import.meta.resolve(id)
|
||||
const resolvedPath = jiti.esmResolve("./src");
|
||||
const jiti = require("jiti")(__filename, { debug: true });
|
||||
```
|
||||
|
||||
If you need the default export of module, you can use `jiti.import(id, { default: true })` as shortcut to `mod?.default ?? mod`.
|
||||
|
||||
```js
|
||||
// shortcut to mod?.default ?? mod
|
||||
const modDefault = await jiti.import("./path/to/file.ts", { default: true });
|
||||
```
|
||||
|
||||
CommonJS (sync & deprecated):
|
||||
|
||||
```js
|
||||
// jiti() is similar to require(id)
|
||||
const mod = jiti("./path/to/file.ts");
|
||||
|
||||
// jiti.resolve() is similar to require.resolve(id)
|
||||
const resolvedPath = jiti.resolve("./src");
|
||||
```
|
||||
|
||||
You can also pass options as the second argument:
|
||||
|
||||
```js
|
||||
const jiti = createJiti(import.meta.url, { debug: true });
|
||||
```
|
||||
|
||||
### Register global ESM loader
|
||||
|
||||
You can globally register jiti using [global hooks](https://nodejs.org/api/module.html#initialize). (Important: Requires Node.js > 20)
|
||||
|
||||
```js
|
||||
import "jiti/register";
|
||||
```
|
||||
|
||||
Or:
|
||||
### CLI
|
||||
|
||||
```bash
|
||||
node --import jiti/register index.ts
|
||||
jiti index.ts
|
||||
# or npx jiti index.ts
|
||||
```
|
||||
|
||||
## 🎈 `jiti/native`
|
||||
### Register require hook
|
||||
|
||||
You can alias `jiti` to `jiti/native` to directly depend on runtime's [`import.meta.resolve`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta/resolve) and dynamic [`import()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import) support. This allows easing up the ecosystem transition to runtime native support by giving the same API of jiti.
|
||||
```bash
|
||||
node -r jiti/register index.ts
|
||||
```
|
||||
|
||||
## ⚙️ Options
|
||||
Alternatively, you can register `jiti` as a require hook programmatically:
|
||||
|
||||
```js
|
||||
const jiti = require("jiti")();
|
||||
const unregister = jiti.register();
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### `debug`
|
||||
|
||||
- Type: Boolean
|
||||
- Default: `false`
|
||||
- Environment variable: `JITI_DEBUG`
|
||||
- Environment Variable: `JITI_DEBUG`
|
||||
|
||||
Enable verbose logging. You can use `JITI_DEBUG=1 <your command>` to enable it.
|
||||
Enable debug to see which files are transpiled
|
||||
|
||||
### `fsCache`
|
||||
### `cache`
|
||||
|
||||
- Type: Boolean | String
|
||||
- Default: `true`
|
||||
- Environment variable: `JITI_FS_CACHE`
|
||||
- Environment Variable: `JITI_CACHE`
|
||||
|
||||
Filesystem source cache (enabled by default)
|
||||
Use transpile cache
|
||||
|
||||
By default (when is `true`), jiti uses `node_modules/.cache/jiti` (if exists) or `{TMP_DIR}/jiti`.
|
||||
If set to `true` will use `node_modules/.cache/jiti` (if exists) or `{TMP_DIR}/node-jiti`
|
||||
|
||||
**Note:** It is recommended that this option be enabled for better performance.
|
||||
### `esmResolve`
|
||||
|
||||
### `rebuildFsCache`
|
||||
|
||||
- Type: Boolean
|
||||
- Type: Boolean | String
|
||||
- Default: `false`
|
||||
- Environment variable: `JITI_REBUILD_FS_CACHE`
|
||||
- Environment Variable: `JITI_ESM_RESOLVE`
|
||||
|
||||
Rebuild filesystem source cache created by `fsCache`.
|
||||
|
||||
### `moduleCache`
|
||||
|
||||
- Type: String
|
||||
- Default: `true`
|
||||
- Environment variable: `JITI_MODULE_CACHE`
|
||||
|
||||
Runtime module cache (enabled by default).
|
||||
|
||||
Disabling allows editing code and importing the same module multiple times.
|
||||
|
||||
When enabled, jiti integrates with Node.js native CommonJS cache-store.
|
||||
Using esm resolution algorithm to support `import` condition.
|
||||
|
||||
### `transform`
|
||||
|
||||
@@ -159,65 +97,48 @@ Transform function. See [src/babel](./src/babel.ts) for more details
|
||||
|
||||
- Type: Boolean
|
||||
- Default `false`
|
||||
- Environment variable: `JITI_SOURCE_MAPS`
|
||||
- Environment Variable: `JITI_SOURCE_MAPS`
|
||||
|
||||
Add inline source map to transformed source for better debugging.
|
||||
|
||||
### `interopDefault`
|
||||
|
||||
- Type: Boolean
|
||||
- Default: `true`
|
||||
- Environment variable: `JITI_INTEROP_DEFAULT`
|
||||
- Default: `false`
|
||||
|
||||
Jiti combines module exports with the `default` export using an internal Proxy to improve compatibility with mixed CJS/ESM usage. You can check the current implementation [here](https://github.com/unjs/jiti/blob/main/src/utils.ts#L105).
|
||||
Return the `.default` export of a module at the top-level.
|
||||
|
||||
### `alias`
|
||||
|
||||
- Type: Object
|
||||
- Default: -
|
||||
- Environment variable: `JITI_ALIAS`
|
||||
- Environment Variable: `JITI_ALIAS`
|
||||
|
||||
You can also pass an object to the environment variable for inline config. Example: `JITI_ALIAS='{"~/*": "./src/*"}' jiti ...`.
|
||||
|
||||
Custom alias map used to resolve IDs.
|
||||
Custom alias map used to resolve ids.
|
||||
|
||||
### `nativeModules`
|
||||
|
||||
- Type: Array
|
||||
- Default: ['typescript']
|
||||
- Environment variable: `JITI_NATIVE_MODULES`
|
||||
- Default: ['typescript`]
|
||||
- Environment Variable: `JITI_NATIVE_MODULES`
|
||||
|
||||
List of modules (within `node_modules`) to always use native `require()` for them.
|
||||
List of modules (within `node_modules`) to always use native require for them.
|
||||
|
||||
### `transformModules`
|
||||
|
||||
- Type: Array
|
||||
- Default: []
|
||||
- Environment variable: `JITI_TRANSFORM_MODULES`
|
||||
- Environment Variable: `JITI_TRANSFORM_MODULES`
|
||||
|
||||
List of modules (within `node_modules`) to transform them regardless of syntax.
|
||||
|
||||
### `importMeta`
|
||||
|
||||
Parent module's [`import.meta`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta) context to use for ESM resolution. (only used for `jiti/native` import).
|
||||
|
||||
### `tryNative`
|
||||
### `experimentalBun`
|
||||
|
||||
- Type: Boolean
|
||||
- Default: Enabled if bun is detected
|
||||
- Environment variable: `JITI_TRY_NATIVE`
|
||||
- Default: Enabled if `process.versions.bun` exists (Bun runtime)
|
||||
- Environment Variable: `JITI_EXPERIMENTAL_BUN`
|
||||
|
||||
Try to use native require and import without jiti transformations first.
|
||||
|
||||
### `jsx`
|
||||
|
||||
- Type: Boolean | {options}
|
||||
- Default: `false`
|
||||
- Environment Variable: `JITI_JSX`
|
||||
|
||||
Enable JSX support using [`@babel/plugin-transform-react-jsx`](https://babeljs.io/docs/babel-plugin-transform-react-jsx).
|
||||
|
||||
See [`test/fixtures/jsx`](./test/fixtures/jsx) for framework integration examples.
|
||||
Enable experimental native Bun support for transformations.
|
||||
|
||||
## Development
|
||||
|
||||
@@ -229,15 +150,15 @@ See [`test/fixtures/jsx`](./test/fixtures/jsx) for framework integration example
|
||||
|
||||
## License
|
||||
|
||||
<!-- automd:contributors license=MIT author="pi0" -->
|
||||
MIT. Made with 💖
|
||||
|
||||
Published under the [MIT](https://github.com/unjs/jiti/blob/main/LICENSE) license.
|
||||
Made by [@pi0](https://github.com/pi0) and [community](https://github.com/unjs/jiti/graphs/contributors) 💛
|
||||
<br><br>
|
||||
<a href="https://github.com/unjs/jiti/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=unjs/jiti" />
|
||||
</a>
|
||||
<!-- Badged -->
|
||||
|
||||
<!-- /automd -->
|
||||
|
||||
<!-- automd:with-automd -->
|
||||
[npm-version-src]: https://img.shields.io/npm/v/jiti?style=flat&colorA=18181B&colorB=F0DB4F
|
||||
[npm-version-href]: https://npmjs.com/package/jiti
|
||||
[npm-downloads-src]: https://img.shields.io/npm/dm/jiti?style=flat&colorA=18181B&colorB=F0DB4F
|
||||
[npm-downloads-href]: https://npmjs.com/package/jiti
|
||||
[bundle-src]: https://img.shields.io/bundlephobia/minzip/jiti?style=flat&colorA=18181B&colorB=F0DB4F
|
||||
[bundle-href]: https://bundlephobia.com/result?p=h3
|
||||
[license-src]: https://img.shields.io/github/license/unjs/jiti.svg?style=flat&colorA=18181B&colorB=F0DB4F
|
||||
[license-href]: https://github.com/unjs/jiti/blob/main/LICENSE
|
||||
|
||||
16
node_modules/jiti/bin/jiti.js
generated
vendored
Executable file
16
node_modules/jiti/bin/jiti.js
generated
vendored
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const { resolve } = require("node:path");
|
||||
|
||||
const script = process.argv.splice(2, 1)[0];
|
||||
|
||||
if (!script) {
|
||||
|
||||
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);
|
||||
246
node_modules/jiti/dist/babel.cjs
generated
vendored
246
node_modules/jiti/dist/babel.cjs
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/jiti/dist/babel.d.ts
generated
vendored
Normal file
2
node_modules/jiti/dist/babel.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { TransformOptions, TRANSFORM_RESULT } from "./types";
|
||||
export default function transform(opts: TransformOptions): TRANSFORM_RESULT;
|
||||
227
node_modules/jiti/dist/babel.js
generated
vendored
Normal file
227
node_modules/jiti/dist/babel.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/jiti/dist/jiti.cjs
generated
vendored
1
node_modules/jiti/dist/jiti.cjs
generated
vendored
File diff suppressed because one or more lines are too long
20
node_modules/jiti/dist/jiti.d.ts
generated
vendored
Normal file
20
node_modules/jiti/dist/jiti.d.ts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import { Module } from "module";
|
||||
import { TransformOptions, JITIOptions, JITIImportOptions } from "./types";
|
||||
export type { JITIOptions, TransformOptions } from "./types";
|
||||
type Require = typeof require;
|
||||
type Module = typeof module;
|
||||
type ModuleCache = Record<string, Module>;
|
||||
export type EvalModuleOptions = Partial<{
|
||||
id: string;
|
||||
filename: string;
|
||||
ext: string;
|
||||
cache: ModuleCache;
|
||||
}>;
|
||||
export interface JITI extends Require {
|
||||
transform: (opts: TransformOptions) => string;
|
||||
register: () => () => void;
|
||||
evalModule: (source: string, options?: EvalModuleOptions) => unknown;
|
||||
/** @experimental Behavior of `jiti.import` might change in the future. */
|
||||
import: (id: string, importOptions: JITIImportOptions) => Promise<unknown>;
|
||||
}
|
||||
export default function createJITI(_filename: string, opts?: JITIOptions, parentModule?: Module, parentCache?: ModuleCache): JITI;
|
||||
1
node_modules/jiti/dist/jiti.js
generated
vendored
Normal file
1
node_modules/jiti/dist/jiti.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
4
node_modules/jiti/dist/plugins/babel-plugin-transform-import-meta.d.ts
generated
vendored
Normal file
4
node_modules/jiti/dist/plugins/babel-plugin-transform-import-meta.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import type { PluginObj } from "@babel/core";
|
||||
export declare function TransformImportMetaPlugin(_ctx: any, opts: {
|
||||
filename?: string;
|
||||
}): PluginObj;
|
||||
5
node_modules/jiti/dist/plugins/import-meta-env.d.ts
generated
vendored
Normal file
5
node_modules/jiti/dist/plugins/import-meta-env.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
* Forked from https://github.com/iendeavor/import-meta-env/tree/main/packages/babel 0.4.2 (MIT License - Copyright (c) 2021 Ernest)
|
||||
*/
|
||||
import type { PluginObj } from "@babel/core";
|
||||
export declare function importMetaEnvPlugin({ template, types }: any): PluginObj;
|
||||
35
node_modules/jiti/dist/types.d.ts
generated
vendored
Normal file
35
node_modules/jiti/dist/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
export type TransformOptions = {
|
||||
source: string;
|
||||
filename?: string;
|
||||
ts?: boolean;
|
||||
retainLines?: boolean;
|
||||
legacy?: boolean;
|
||||
[key: string]: any;
|
||||
};
|
||||
export type TRANSFORM_RESULT = {
|
||||
code: string;
|
||||
error?: any;
|
||||
};
|
||||
export type JITIOptions = {
|
||||
transform?: (opts: TransformOptions) => TRANSFORM_RESULT;
|
||||
debug?: boolean;
|
||||
cache?: boolean | string;
|
||||
sourceMaps?: boolean;
|
||||
requireCache?: boolean;
|
||||
v8cache?: boolean;
|
||||
interopDefault?: boolean;
|
||||
esmResolve?: boolean;
|
||||
cacheVersion?: string;
|
||||
onError?: (error: Error) => void;
|
||||
legacy?: boolean;
|
||||
extensions?: string[];
|
||||
transformOptions?: Omit<TransformOptions, "source">;
|
||||
alias?: Record<string, string>;
|
||||
nativeModules?: string[];
|
||||
transformModules?: string[];
|
||||
experimentalBun?: boolean;
|
||||
};
|
||||
export interface JITIImportOptions {
|
||||
/** @internal */
|
||||
_import?: () => Promise<any>;
|
||||
}
|
||||
8
node_modules/jiti/dist/utils.d.ts
generated
vendored
Normal file
8
node_modules/jiti/dist/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { PackageJson } from "pkg-types";
|
||||
export declare function getCacheDir(): string;
|
||||
export declare function isDir(filename: string): boolean;
|
||||
export declare function isWritable(filename: string): boolean;
|
||||
export declare function md5(content: string, len?: number): string;
|
||||
export declare function detectLegacySyntax(code: string): RegExpMatchArray | null;
|
||||
export declare function isObject(val: any): boolean;
|
||||
export declare function readNearestPackageJSON(path: string): PackageJson | undefined;
|
||||
15
node_modules/jiti/lib/index.js
generated
vendored
Normal file
15
node_modules/jiti/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
function onError(err) {
|
||||
throw err; /* ↓ Check stack trace ↓ */
|
||||
}
|
||||
|
||||
module.exports = function jiti(filename, opts) {
|
||||
const jiti = require("../dist/jiti");
|
||||
|
||||
opts = { onError, ...opts };
|
||||
|
||||
if (!opts.transform) {
|
||||
opts.transform = require("../dist/babel");
|
||||
}
|
||||
|
||||
return jiti(filename, opts);
|
||||
};
|
||||
34
node_modules/jiti/lib/jiti-cli.mjs
generated
vendored
34
node_modules/jiti/lib/jiti-cli.mjs
generated
vendored
@@ -1,34 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import { resolve } from "node:path";
|
||||
import nodeModule from "node:module";
|
||||
|
||||
const script = process.argv.splice(2, 1)[0];
|
||||
|
||||
if (!script) {
|
||||
console.error("Usage: jiti <path> [...arguments]");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// https://nodejs.org/api/module.html#moduleenablecompilecachecachedir
|
||||
// https://github.com/nodejs/node/pull/54501
|
||||
if (nodeModule.enableCompileCache && !process.env.NODE_DISABLE_COMPILE_CACHE) {
|
||||
try {
|
||||
nodeModule.enableCompileCache();
|
||||
} catch {
|
||||
// Ignore errors
|
||||
}
|
||||
}
|
||||
|
||||
const pwd = process.cwd();
|
||||
|
||||
const { createJiti } = await import("./jiti.cjs");
|
||||
|
||||
const jiti = createJiti(pwd);
|
||||
|
||||
const resolved = (process.argv[1] = jiti.resolve(resolve(pwd, script)));
|
||||
|
||||
await jiti.import(resolved).catch((error) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
124
node_modules/jiti/lib/jiti-hooks.mjs
generated
vendored
124
node_modules/jiti/lib/jiti-hooks.mjs
generated
vendored
@@ -1,124 +0,0 @@
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { existsSync } from "node:fs";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { isBuiltin } from "node:module";
|
||||
import { createJiti } from "./jiti.mjs";
|
||||
|
||||
let jiti;
|
||||
|
||||
// https://nodejs.org/api/module.html#initialize
|
||||
export async function initialize() {
|
||||
jiti = createJiti();
|
||||
}
|
||||
|
||||
// https://nodejs.org/api/module.html#resolvespecifier-context-nextresolve
|
||||
export async function resolve(specifier, context, nextResolve) {
|
||||
if (_shouldSkip(specifier)) {
|
||||
return nextResolve(specifier, context);
|
||||
}
|
||||
const resolvedPath = jiti.esmResolve(specifier, {
|
||||
parentURL: context?.parentURL,
|
||||
conditions: context?.conditions,
|
||||
});
|
||||
return {
|
||||
url: resolvedPath,
|
||||
shortCircuit: true,
|
||||
};
|
||||
}
|
||||
|
||||
// https://nodejs.org/api/module.html#loadurl-context-nextload
|
||||
export async function load(url, context, nextLoad) {
|
||||
if (_shouldSkip(url)) {
|
||||
return nextLoad(url, context);
|
||||
}
|
||||
|
||||
const filename = fileURLToPath(url);
|
||||
|
||||
if (url.endsWith(".js")) {
|
||||
const pkg = await _findClosestPackageJson(dirname(filename));
|
||||
if (pkg && pkg.type === "module") {
|
||||
return nextLoad(url, context);
|
||||
}
|
||||
}
|
||||
|
||||
const rawSource = await readFile(filename, "utf8");
|
||||
|
||||
if (url.endsWith(".json")) {
|
||||
const pkg = await _findClosestPackageJson(dirname(filename));
|
||||
return pkg && pkg.type === "module"
|
||||
? {
|
||||
source: `export default ${rawSource}`,
|
||||
format: "module",
|
||||
shortCircuit: true,
|
||||
}
|
||||
: {
|
||||
source: `module.exports = ${rawSource}`,
|
||||
format: "commonjs",
|
||||
shortCircuit: true,
|
||||
};
|
||||
}
|
||||
|
||||
const transpiledSource = jiti.transform({
|
||||
source: rawSource,
|
||||
filename: filename,
|
||||
ts: url.endsWith("ts"),
|
||||
retainLines: true,
|
||||
async: true,
|
||||
jsx: jiti.options.jsx,
|
||||
});
|
||||
|
||||
if (url.endsWith(".js") && !transpiledSource.includes("jitiImport")) {
|
||||
return {
|
||||
source: transpiledSource,
|
||||
format: "commonjs",
|
||||
shortCircuit: true,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
source: _wrapSource(transpiledSource, filename),
|
||||
format: "module",
|
||||
shortCircuit: true,
|
||||
};
|
||||
}
|
||||
|
||||
function _wrapSource(source, filename) {
|
||||
const _jitiPath = new URL("jiti.mjs", import.meta.url).href;
|
||||
return /*js*/ `import { createJiti as __createJiti__ } from ${JSON.stringify(_jitiPath)};async function _module(exports, require, module, __filename, __dirname, jitiImport) { ${source}\n};
|
||||
// GENERATED BY JITI ESM LOADER
|
||||
const filename = ${JSON.stringify(filename)};
|
||||
const dirname = ${JSON.stringify(dirname(filename))};
|
||||
const jiti = __createJiti__(filename);
|
||||
const module = { exports: Object.create(null) };
|
||||
await _module(module.exports, jiti, module, filename, dirname, jiti.import);
|
||||
if (module.exports && module.exports.__JITI_ERROR__) {
|
||||
const { filename, line, column, code, message } =
|
||||
module.exports.__JITI_ERROR__;
|
||||
const loc = [filename, line, column].join(':');
|
||||
const err = new Error(code + ": " + message + " " + loc);
|
||||
Error.captureStackTrace(err, _module);
|
||||
throw err;
|
||||
}
|
||||
export default module.exports;
|
||||
`;
|
||||
}
|
||||
|
||||
function _shouldSkip(url) {
|
||||
return (
|
||||
!jiti ||
|
||||
url.endsWith(".mjs") ||
|
||||
url.endsWith(".cjs") ||
|
||||
(!url.startsWith("./") && !url.startsWith("file://")) ||
|
||||
isBuiltin(url)
|
||||
);
|
||||
}
|
||||
|
||||
async function _findClosestPackageJson(dir) {
|
||||
if (dir === "/") return null;
|
||||
const packageJsonPath = join(dir, "package.json");
|
||||
if (existsSync(packageJsonPath)) {
|
||||
return JSON.parse(await readFile(packageJsonPath, "utf8"));
|
||||
}
|
||||
return _findClosestPackageJson(dirname(dir));
|
||||
}
|
||||
121
node_modules/jiti/lib/jiti-native.mjs
generated
vendored
121
node_modules/jiti/lib/jiti-native.mjs
generated
vendored
@@ -1,121 +0,0 @@
|
||||
/**
|
||||
* @typedef {import('./types').Jiti} Jiti
|
||||
* @typedef {import('./types').JitiOptions} JitiOptions
|
||||
*/
|
||||
|
||||
const isDeno = "Deno" in globalThis;
|
||||
|
||||
/**
|
||||
* @param {string|URL} [parentURL]
|
||||
* @param {JitiOptions} [jitiOptions]
|
||||
* @returns {Jiti}
|
||||
*/
|
||||
export function createJiti(parentURL, jitiOptions) {
|
||||
parentURL = normalizeParentURL(parentURL);
|
||||
|
||||
/** @type {Jiti} */
|
||||
function jiti() {
|
||||
throw unsupportedError(
|
||||
"`jiti()` is not supported in native mode, use `jiti.import()` instead.",
|
||||
);
|
||||
}
|
||||
|
||||
jiti.resolve = () => {
|
||||
throw unsupportedError("`jiti.resolve()` is not supported in native mode.");
|
||||
};
|
||||
|
||||
jiti.esmResolve = (id, opts) => {
|
||||
try {
|
||||
const importMeta = jitiOptions?.importMeta || import.meta;
|
||||
if (isDeno) {
|
||||
// Deno throws TypeError: Invalid arguments when passing parentURL
|
||||
return importMeta.resolve(id);
|
||||
}
|
||||
const parent = normalizeParentURL(opts?.parentURL || parentURL);
|
||||
return importMeta.resolve(id, parent);
|
||||
} catch (error) {
|
||||
if (opts?.try) {
|
||||
return undefined;
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
jiti.import = async function (id, opts) {
|
||||
for (const suffix of ["", "/index"]) {
|
||||
// prettier-ignore
|
||||
for (const ext of ["", ".js", ".mjs", ".cjs", ".ts", ".tsx", ".mts", ".cts"]) {
|
||||
try {
|
||||
const resolved = this.esmResolve(id + suffix + ext, opts);
|
||||
if (!resolved) {
|
||||
continue;
|
||||
}
|
||||
let importAttrs = undefined
|
||||
if (resolved.endsWith('.json')) {
|
||||
importAttrs = { with: { type: 'json'}}
|
||||
}
|
||||
return await import(resolved, importAttrs);
|
||||
} catch (error) {
|
||||
if (error.code === 'ERR_MODULE_NOT_FOUND' || error.code === 'ERR_UNSUPPORTED_DIR_IMPORT') {
|
||||
continue
|
||||
}
|
||||
if (opts?.try) {
|
||||
return undefined;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!opts?.try) {
|
||||
const parent = normalizeParentURL(opts?.parentURL || parentURL);
|
||||
const error = new Error(
|
||||
`[jiti] [ERR_MODULE_NOT_FOUND] Cannot import '${id}' from '${parent}'.`,
|
||||
);
|
||||
error.code = "ERR_MODULE_NOT_FOUND";
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
jiti.transform = () => {
|
||||
throw unsupportedError(
|
||||
"`jiti.transform()` is not supported in native mode.",
|
||||
);
|
||||
};
|
||||
|
||||
jiti.evalModule = () => {
|
||||
throw unsupportedError(
|
||||
"`jiti.evalModule()` is not supported in native mode.",
|
||||
);
|
||||
};
|
||||
|
||||
jiti.main = undefined;
|
||||
jiti.extensions = Object.create(null);
|
||||
jiti.cache = Object.create(null);
|
||||
|
||||
return jiti;
|
||||
}
|
||||
|
||||
export default createJiti;
|
||||
|
||||
/**
|
||||
* @param {string} message
|
||||
*/
|
||||
function unsupportedError(message) {
|
||||
throw new Error(
|
||||
`[jiti] ${message} (import or require 'jiti' instead of 'jiti/native' for more features).`,
|
||||
);
|
||||
}
|
||||
|
||||
function normalizeParentURL(input) {
|
||||
if (!input) {
|
||||
return "file:///";
|
||||
}
|
||||
if (typeof filename !== "string" || input.startsWith("file://")) {
|
||||
return input;
|
||||
}
|
||||
if (input.endsWith("/")) {
|
||||
input += "_"; // append a dummy filename
|
||||
}
|
||||
return `file://${input}`;
|
||||
}
|
||||
1
node_modules/jiti/lib/jiti-register.d.mts
generated
vendored
1
node_modules/jiti/lib/jiti-register.d.mts
generated
vendored
@@ -1 +0,0 @@
|
||||
// eslint-disable-next-line unicorn/no-empty-file
|
||||
4
node_modules/jiti/lib/jiti-register.mjs
generated
vendored
4
node_modules/jiti/lib/jiti-register.mjs
generated
vendored
@@ -1,4 +0,0 @@
|
||||
// https://nodejs.org/api/module.html#moduleregisterspecifier-parenturl-options
|
||||
import { register } from "node:module";
|
||||
|
||||
register("./jiti-hooks.mjs", import.meta.url, {});
|
||||
30
node_modules/jiti/lib/jiti.cjs
generated
vendored
30
node_modules/jiti/lib/jiti.cjs
generated
vendored
@@ -1,30 +0,0 @@
|
||||
const { createRequire } = require("node:module");
|
||||
const _createJiti = require("../dist/jiti.cjs");
|
||||
|
||||
function onError(err) {
|
||||
throw err; /* ↓ Check stack trace ↓ */
|
||||
}
|
||||
|
||||
const nativeImport = (id) => import(id);
|
||||
|
||||
let _transform;
|
||||
function lazyTransform(...args) {
|
||||
if (!_transform) {
|
||||
_transform = require("../dist/babel.cjs");
|
||||
}
|
||||
return _transform(...args);
|
||||
}
|
||||
|
||||
function createJiti(id, opts = {}) {
|
||||
if (!opts.transform) {
|
||||
opts = { ...opts, transform: lazyTransform };
|
||||
}
|
||||
return _createJiti(id, opts, {
|
||||
onError,
|
||||
nativeImport,
|
||||
createRequire,
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = createJiti;
|
||||
module.exports.createJiti = createJiti;
|
||||
8
node_modules/jiti/lib/jiti.d.cts
generated
vendored
8
node_modules/jiti/lib/jiti.d.cts
generated
vendored
@@ -1,8 +0,0 @@
|
||||
import * as types from "./types.js";
|
||||
declare const allExports: typeof types & {
|
||||
/**
|
||||
* @deprecated Please use `const { createJiti } = require("jiti")` or use ESM import.
|
||||
*/
|
||||
(...args: Parameters<typeof types.createJiti>): types.Jiti;
|
||||
};
|
||||
export = allExports;
|
||||
8
node_modules/jiti/lib/jiti.d.mts
generated
vendored
8
node_modules/jiti/lib/jiti.d.mts
generated
vendored
@@ -1,8 +0,0 @@
|
||||
import { createJiti } from "./types.js";
|
||||
|
||||
export * from "./types.js";
|
||||
|
||||
/**
|
||||
* @deprecated Please use `import { createJiti } from "jiti"`
|
||||
*/
|
||||
export default createJiti;
|
||||
29
node_modules/jiti/lib/jiti.mjs
generated
vendored
29
node_modules/jiti/lib/jiti.mjs
generated
vendored
@@ -1,29 +0,0 @@
|
||||
import { createRequire } from "node:module";
|
||||
import _createJiti from "../dist/jiti.cjs";
|
||||
|
||||
function onError(err) {
|
||||
throw err; /* ↓ Check stack trace ↓ */
|
||||
}
|
||||
|
||||
const nativeImport = (id) => import(id);
|
||||
|
||||
let _transform;
|
||||
function lazyTransform(...args) {
|
||||
if (!_transform) {
|
||||
_transform = createRequire(import.meta.url)("../dist/babel.cjs");
|
||||
}
|
||||
return _transform(...args);
|
||||
}
|
||||
|
||||
export function createJiti(id, opts = {}) {
|
||||
if (!opts.transform) {
|
||||
opts = { ...opts, transform: lazyTransform };
|
||||
}
|
||||
return _createJiti(id, opts, {
|
||||
onError,
|
||||
nativeImport,
|
||||
createRequire,
|
||||
});
|
||||
}
|
||||
|
||||
export default createJiti;
|
||||
363
node_modules/jiti/lib/types.d.ts
generated
vendored
363
node_modules/jiti/lib/types.d.ts
generated
vendored
@@ -1,363 +0,0 @@
|
||||
/**
|
||||
* Creates a new {@linkcode Jiti} instance with custom options.
|
||||
*
|
||||
* @param id - Instance id, usually the current filename.
|
||||
* @param userOptions - Custom options to override the default options.
|
||||
* @returns A {@linkcode Jiti} instance.
|
||||
*
|
||||
* @example
|
||||
* <caption>ESM Usage</caption>
|
||||
*
|
||||
* ```ts
|
||||
* import { createJiti } from "jiti";
|
||||
*
|
||||
* const jiti = createJiti(import.meta.url, { debug: true });
|
||||
* ```
|
||||
*
|
||||
* @example
|
||||
* <caption>CommonJS Usage **(deprecated)**</caption>
|
||||
*
|
||||
* ```ts
|
||||
* const { createJiti } = require("jiti");
|
||||
*
|
||||
* const jiti = createJiti(__filename, { debug: true });
|
||||
* ```
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export declare function createJiti(id: string, userOptions?: JitiOptions): Jiti;
|
||||
|
||||
/**
|
||||
* Jiti instance
|
||||
*
|
||||
* Calling `jiti()` is similar to CommonJS {@linkcode require()} but adds
|
||||
* extra features such as TypeScript and ESM compatibility.
|
||||
*
|
||||
* **Note:** It is recommended to use
|
||||
* {@linkcode Jiti.import | await jiti.import()} instead.
|
||||
*/
|
||||
export interface Jiti extends NodeRequire {
|
||||
/**
|
||||
* Resolved options
|
||||
*/
|
||||
options: JitiOptions;
|
||||
|
||||
/**
|
||||
* ESM import a module with additional TypeScript and ESM compatibility.
|
||||
*
|
||||
* If you need the default export of module, you can use
|
||||
* `jiti.import(id, { default: true })` as shortcut to `mod?.default ?? mod`.
|
||||
*/
|
||||
import<T = unknown>(
|
||||
id: string,
|
||||
opts?: JitiResolveOptions & { default?: true },
|
||||
): Promise<T>;
|
||||
|
||||
/**
|
||||
* Resolve with ESM import conditions.
|
||||
*/
|
||||
esmResolve(id: string, parentURL?: string): string;
|
||||
esmResolve<T extends JitiResolveOptions = JitiResolveOptions>(
|
||||
id: string,
|
||||
opts?: T,
|
||||
): T["try"] extends true ? string | undefined : string;
|
||||
|
||||
/**
|
||||
* Transform source code
|
||||
*/
|
||||
transform: (opts: TransformOptions) => string;
|
||||
|
||||
/**
|
||||
* Evaluate transformed code as a module
|
||||
*/
|
||||
evalModule: (source: string, options?: EvalModuleOptions) => unknown;
|
||||
}
|
||||
|
||||
/**
|
||||
* Jiti instance options
|
||||
*/
|
||||
export interface JitiOptions {
|
||||
/**
|
||||
* Filesystem source cache
|
||||
*
|
||||
* An string can be passed to set the custom cache directory.
|
||||
*
|
||||
* By default (when set to `true`), jiti uses
|
||||
* `node_modules/.cache/jiti` (if exists) or `{TMP_DIR}/jiti`.
|
||||
*
|
||||
* This option can also be disabled using
|
||||
* `JITI_FS_CACHE=false` environment variable.
|
||||
*
|
||||
* **Note:** It is recommended to keep this option
|
||||
* enabled for better performance.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
fsCache?: boolean | string;
|
||||
|
||||
/**
|
||||
* Rebuild the filesystem source cache
|
||||
*
|
||||
* This option can also be enabled using
|
||||
* `JITI_REBUILD_FS_CACHE=true` environment variable.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
rebuildFsCache?: boolean;
|
||||
|
||||
/**
|
||||
* @deprecated Use the {@linkcode fsCache} option.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
cache?: boolean | string;
|
||||
|
||||
/**
|
||||
* Runtime module cache
|
||||
*
|
||||
* Disabling allows editing code and importing same module multiple times.
|
||||
*
|
||||
* When enabled, jiti integrates with Node.js native CommonJS cache store.
|
||||
*
|
||||
* This option can also be disabled using
|
||||
* `JITI_MODULE_CACHE=false` environment variable.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
moduleCache?: boolean;
|
||||
|
||||
/**
|
||||
* @deprecated Use the {@linkcode moduleCache} option.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
requireCache?: boolean;
|
||||
|
||||
/**
|
||||
* Custom transform function
|
||||
*/
|
||||
transform?: (opts: TransformOptions) => TransformResult;
|
||||
|
||||
/**
|
||||
* Enable verbose debugging.
|
||||
*
|
||||
* Can also be enabled using `JITI_DEBUG=1` environment variable.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
debug?: boolean;
|
||||
|
||||
/**
|
||||
* Enable sourcemaps for transformed code.
|
||||
*
|
||||
* Can also be disabled using `JITI_SOURCE_MAPS=0` environment variable.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
sourceMaps?: boolean;
|
||||
|
||||
/**
|
||||
* Jiti combines module exports with the `default` export using an
|
||||
* internal Proxy to improve compatibility with mixed CJS/ESM usage.
|
||||
* You can check the current implementation
|
||||
* {@link https://github.com/unjs/jiti/blob/main/src/utils.ts#L105 here}.
|
||||
*
|
||||
* Can be disabled using `JITI_INTEROP_DEFAULT=0` environment variable.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
interopDefault?: boolean;
|
||||
|
||||
/**
|
||||
* Jiti hard source cache version.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
cacheVersion?: string;
|
||||
|
||||
/**
|
||||
* Supported extensions to resolve.
|
||||
*
|
||||
* @default [".js", ".mjs", ".cjs", ".ts", ".tsx", ".mts", ".cts", ".mtsx", ".ctsx", ".json"]
|
||||
*/
|
||||
extensions?: string[];
|
||||
|
||||
/**
|
||||
* Transform options
|
||||
*/
|
||||
transformOptions?: Omit<TransformOptions, "source">;
|
||||
|
||||
/**
|
||||
* Resolve aliases
|
||||
*
|
||||
* You can use `JITI_ALIAS` environment variable to set aliases as
|
||||
* a JSON string.
|
||||
*
|
||||
* @default {}
|
||||
*/
|
||||
alias?: Record<string, string>;
|
||||
|
||||
/**
|
||||
* List of modules (within `node_modules`) to always use native
|
||||
* require/import for them.
|
||||
*
|
||||
* You can use `JITI_NATIVE_MODULES` environment variable to set
|
||||
* native modules as a JSON string.
|
||||
*
|
||||
* @default []
|
||||
*/
|
||||
nativeModules?: string[];
|
||||
|
||||
/**
|
||||
* List of modules (within `node_modules`) to transform them
|
||||
* regardless of syntax.
|
||||
*
|
||||
* You can use `JITI_TRANSFORM_MODULES` environment variable to set
|
||||
* transform modules as a JSON string.
|
||||
*
|
||||
* @default []
|
||||
*/
|
||||
transformModules?: string[];
|
||||
|
||||
/**
|
||||
* Parent module's {@linkcode ImportMeta | import.meta} context to use
|
||||
* for ESM resolution.
|
||||
*
|
||||
* (Only used for `jiti/native` import)
|
||||
*/
|
||||
importMeta?: ImportMeta;
|
||||
|
||||
/**
|
||||
* Try to use native require and import without jiti transformations first.
|
||||
*
|
||||
* Enabled if Bun is detected.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
tryNative?: boolean;
|
||||
|
||||
/**
|
||||
* Enable JSX support Enable JSX support using
|
||||
* {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx | `@babel/plugin-transform-react-jsx`}.
|
||||
*
|
||||
* You can also use `JITI_JSX=1` environment variable to enable JSX support.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
jsx?: boolean | JSXOptions;
|
||||
}
|
||||
|
||||
interface NodeRequire {
|
||||
/**
|
||||
* Module cache
|
||||
*/
|
||||
cache: ModuleCache;
|
||||
|
||||
/**
|
||||
* @deprecated Prefer {@linkcode Jiti.import | await jiti.import()}
|
||||
* for better compatibility.
|
||||
*/
|
||||
(id: string): any;
|
||||
|
||||
/**
|
||||
* @deprecated Prefer {@linkcode Jiti.esmResolve | jiti.esmResolve}
|
||||
* for better compatibility.
|
||||
*/
|
||||
resolve: {
|
||||
/** @deprecated */
|
||||
(id: string, options?: { paths?: string[] | undefined }): string;
|
||||
/** @deprecated */
|
||||
paths(request: string): string[] | null;
|
||||
};
|
||||
|
||||
/** @deprecated CommonJS API */
|
||||
extensions: Record<
|
||||
".js" | ".json" | ".node",
|
||||
(m: NodeModule, filename: string) => any | undefined
|
||||
>;
|
||||
|
||||
/** @deprecated CommonJS API */
|
||||
main: NodeModule | undefined;
|
||||
}
|
||||
|
||||
export interface NodeModule {
|
||||
/**
|
||||
* `true` if the module is running during the Node.js preload.
|
||||
*/
|
||||
isPreloading: boolean;
|
||||
exports: any;
|
||||
require: NodeRequire;
|
||||
id: string;
|
||||
filename: string;
|
||||
loaded: boolean;
|
||||
/**
|
||||
* @deprecated since Node.js **v14.6.0** Please use
|
||||
* {@linkcode NodeRequire.main | require.main} and
|
||||
* {@linkcode NodeModule.children | module.children} instead.
|
||||
*/
|
||||
parent: NodeModule | null | undefined;
|
||||
children: NodeModule[];
|
||||
/**
|
||||
* The directory name of the module.
|
||||
* This is usually the same as the `path.dirname()` of the `module.id`.
|
||||
*
|
||||
* @since Node.js **v11.14.0**
|
||||
*/
|
||||
path: string;
|
||||
paths: string[];
|
||||
}
|
||||
|
||||
export type ModuleCache = Record<string, NodeModule>;
|
||||
|
||||
export type EvalModuleOptions = Partial<{
|
||||
id: string;
|
||||
filename: string;
|
||||
ext: string;
|
||||
cache: ModuleCache;
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
async: boolean;
|
||||
forceTranspile: boolean;
|
||||
}>;
|
||||
|
||||
export interface TransformOptions {
|
||||
source: string;
|
||||
filename?: string;
|
||||
ts?: boolean;
|
||||
retainLines?: boolean;
|
||||
interopDefault?: boolean;
|
||||
/**
|
||||
* @default false
|
||||
*/
|
||||
async?: boolean;
|
||||
/**
|
||||
* @default false
|
||||
*/
|
||||
jsx?: boolean | JSXOptions;
|
||||
babel?: Record<string, any>;
|
||||
}
|
||||
|
||||
export interface TransformResult {
|
||||
code: string;
|
||||
error?: any;
|
||||
}
|
||||
|
||||
export interface JitiResolveOptions {
|
||||
conditions?: string[];
|
||||
parentURL?: string | URL;
|
||||
try?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx#options | Reference}
|
||||
*/
|
||||
export interface JSXOptions {
|
||||
throwIfNamespace?: boolean;
|
||||
runtime?: "classic" | "automatic";
|
||||
importSource?: string;
|
||||
pragma?: string;
|
||||
pragmaFrag?: string;
|
||||
useBuiltIns?: boolean;
|
||||
useSpread?: boolean;
|
||||
}
|
||||
166
node_modules/jiti/package.json
generated
vendored
166
node_modules/jiti/package.json
generated
vendored
@@ -1,133 +1,81 @@
|
||||
{
|
||||
"name": "jiti",
|
||||
"version": "2.6.1",
|
||||
"version": "1.21.7",
|
||||
"description": "Runtime typescript and ESM support for Node.js",
|
||||
"repository": "unjs/jiti",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./lib/jiti.d.mts",
|
||||
"default": "./lib/jiti.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./lib/jiti.d.cts",
|
||||
"default": "./lib/jiti.cjs"
|
||||
}
|
||||
},
|
||||
"./register": {
|
||||
"types": "./lib/jiti-register.d.mts",
|
||||
"import": "./lib/jiti-register.mjs"
|
||||
},
|
||||
"./native": {
|
||||
"types": "./lib/jiti.d.mts",
|
||||
"import": "./lib/jiti-native.mjs"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"main": "./lib/jiti.cjs",
|
||||
"module": "./lib/jiti.mjs",
|
||||
"types": "./lib/jiti.d.cts",
|
||||
"typesVersions": {
|
||||
"*": {
|
||||
"register": [
|
||||
"./lib/jiti-register.d.mts"
|
||||
],
|
||||
"native": [
|
||||
"./lib/jiti.d.mts"
|
||||
]
|
||||
}
|
||||
},
|
||||
"bin": {
|
||||
"jiti": "./lib/jiti-cli.mjs"
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"types": "dist/jiti.d.ts",
|
||||
"bin": "bin/jiti.js",
|
||||
"files": [
|
||||
"lib",
|
||||
"dist",
|
||||
"register.cjs"
|
||||
"register.js"
|
||||
],
|
||||
"scripts": {
|
||||
"bench": "node test/bench.mjs && deno -A test/bench.mjs && bun --bun test/bench.mjs",
|
||||
"build": "pnpm clean && pnpm rspack",
|
||||
"build": "pnpm clean && NODE_ENV=production pnpm webpack",
|
||||
"clean": "rm -rf dist",
|
||||
"dev": "pnpm clean && pnpm rspack --watch",
|
||||
"jiti": "JITI_DEBUG=1 JITI_JSX=1 lib/jiti-cli.mjs",
|
||||
"dev": "pnpm clean && pnpm webpack --watch",
|
||||
"jiti": "JITI_DEBUG=1 JITI_CACHE=false JITI_REQUIRE_CACHE=false ./bin/jiti.js",
|
||||
"jiti:legacy": "JITI_DEBUG=1 npx node@12 ./bin/jiti.js",
|
||||
"lint": "eslint . && prettier -c src lib test stubs",
|
||||
"lint:fix": "eslint --fix . && prettier -w src lib test stubs",
|
||||
"prepack": "pnpm build",
|
||||
"release": "pnpm build && pnpm test && changelogen --release --push --publish",
|
||||
"test": "pnpm lint && pnpm test:types && vitest run --coverage && pnpm test:node-register && pnpm test:bun && pnpm test:native",
|
||||
"test:bun": "bun --bun test test/bun",
|
||||
"test:native": "pnpm test:native:bun && pnpm test:native:node && pnpm test:native:deno",
|
||||
"test:native:bun": "bun --bun test test/native/bun.test.ts",
|
||||
"test:native:deno": "deno test -A --no-check test/native/deno.test.ts",
|
||||
"test:native:node": "node --test --experimental-strip-types test/native/node.test.ts",
|
||||
"test:node-register": "JITI_JSX=1 node --test test/node-register.test.mjs",
|
||||
"test:types": "tsc --noEmit"
|
||||
"release": "pnpm build && pnpm test && changelogen --release --push && npm publish --tag 1x",
|
||||
"test": "pnpm lint && vitest run --coverage && pnpm test:bun",
|
||||
"test:bun": "bun --bun test test/bun"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.28.4",
|
||||
"@babel/helper-module-imports": "^7.27.1",
|
||||
"@babel/helper-module-transforms": "^7.28.3",
|
||||
"@babel/helper-plugin-utils": "^7.27.1",
|
||||
"@babel/helper-simple-access": "^7.27.1",
|
||||
"@babel/plugin-proposal-decorators": "^7.28.0",
|
||||
"@babel/core": "^7.26.0",
|
||||
"@babel/plugin-proposal-decorators": "^7.25.9",
|
||||
"@babel/plugin-syntax-class-properties": "^7.12.13",
|
||||
"@babel/plugin-syntax-import-assertions": "^7.27.1",
|
||||
"@babel/plugin-syntax-jsx": "^7.27.1",
|
||||
"@babel/plugin-transform-export-namespace-from": "^7.27.1",
|
||||
"@babel/plugin-transform-react-jsx": "^7.27.1",
|
||||
"@babel/plugin-transform-typescript": "^7.28.0",
|
||||
"@babel/preset-typescript": "^7.27.1",
|
||||
"@babel/template": "^7.27.2",
|
||||
"@babel/traverse": "^7.28.4",
|
||||
"@babel/types": "^7.28.4",
|
||||
"@rspack/cli": "^1.5.8",
|
||||
"@rspack/core": "^1.5.8",
|
||||
"@babel/plugin-syntax-import-assertions": "^7.26.0",
|
||||
"@babel/plugin-transform-export-namespace-from": "^7.25.9",
|
||||
"@babel/plugin-transform-modules-commonjs": "^7.26.3",
|
||||
"@babel/plugin-transform-nullish-coalescing-operator": "^7.25.9",
|
||||
"@babel/plugin-transform-optional-chaining": "^7.25.9",
|
||||
"@babel/plugin-transform-typescript": "^7.26.3",
|
||||
"@babel/preset-typescript": "^7.26.0",
|
||||
"@babel/template": "^7.25.9",
|
||||
"@babel/types": "^7.26.3",
|
||||
"@types/babel__core": "^7.20.5",
|
||||
"@types/babel__helper-module-imports": "^7.18.3",
|
||||
"@types/babel__helper-plugin-utils": "^7.10.3",
|
||||
"@types/babel__template": "^7.4.4",
|
||||
"@types/babel__traverse": "^7.28.0",
|
||||
"@types/node": "^24.6.1",
|
||||
"@vitest/coverage-v8": "^3.2.4",
|
||||
"acorn": "^8.15.0",
|
||||
"@types/node": "^22.10.2",
|
||||
"@types/object-hash": "^3.0.6",
|
||||
"@types/resolve": "^1.20.6",
|
||||
"@types/semver": "^7.5.8",
|
||||
"@vitest/coverage-v8": "^2.1.8",
|
||||
"acorn": "^8.14.0",
|
||||
"babel-plugin-dynamic-import-node": "^2.3.3",
|
||||
"babel-plugin-parameter-decorator": "^1.0.16",
|
||||
"changelogen": "^0.6.2",
|
||||
"config": "^4.1.1",
|
||||
"consola": "^3.4.2",
|
||||
"defu": "^6.1.4",
|
||||
"destr": "^2.0.5",
|
||||
"babel-plugin-transform-typescript-metadata": "^0.3.2",
|
||||
"changelogen": "^0.5.7",
|
||||
"config": "^3.3.12",
|
||||
"create-require": "^1.1.1",
|
||||
"destr": "^2.0.3",
|
||||
"escape-string-regexp": "^5.0.0",
|
||||
"eslint": "^9.36.0",
|
||||
"eslint-config-unjs": "^0.5.0",
|
||||
"eslint": "^9.17.0",
|
||||
"eslint-config-unjs": "^0.4.2",
|
||||
"esm": "^3.2.25",
|
||||
"estree-walker": "^3.0.3",
|
||||
"etag": "^1.8.1",
|
||||
"fast-glob": "^3.3.3",
|
||||
"is-installed-globally": "^1.0.0",
|
||||
"mime": "^4.1.0",
|
||||
"mlly": "^1.8.0",
|
||||
"moment-timezone": "^0.6.0",
|
||||
"nano-jsx": "^0.2.0",
|
||||
"pathe": "^2.0.3",
|
||||
"pkg-types": "^2.3.0",
|
||||
"preact": "^10.27.2",
|
||||
"preact-render-to-string": "^6.6.2",
|
||||
"prettier": "^3.6.2",
|
||||
"react": "^19.1.1",
|
||||
"react-dom": "^19.1.1",
|
||||
"execa": "^9.5.2",
|
||||
"fast-glob": "^3.3.2",
|
||||
"mlly": "^1.7.3",
|
||||
"object-hash": "^3.0.0",
|
||||
"pathe": "^1.1.2",
|
||||
"pirates": "^4.0.6",
|
||||
"pkg-types": "^1.2.1",
|
||||
"prettier": "^3.4.2",
|
||||
"reflect-metadata": "^0.2.2",
|
||||
"solid-js": "^1.9.9",
|
||||
"std-env": "^3.9.0",
|
||||
"terser-webpack-plugin": "^5.3.14",
|
||||
"tinyexec": "^1.0.1",
|
||||
"ts-loader": "^9.5.4",
|
||||
"typescript": "^5.9.3",
|
||||
"vitest": "^3.2.4",
|
||||
"vue": "^3.5.22",
|
||||
"yoctocolors": "^2.1.2",
|
||||
"zod": "^4.1.11"
|
||||
"semver": "^7.6.3",
|
||||
"std-env": "^3.8.0",
|
||||
"terser-webpack-plugin": "^5.3.11",
|
||||
"ts-loader": "^9.5.1",
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.7.2",
|
||||
"vite": "^6.0.3",
|
||||
"vitest": "^2.1.8",
|
||||
"webpack": "^5.97.1",
|
||||
"webpack-cli": "^5.1.4"
|
||||
},
|
||||
"packageManager": "pnpm@10.17.1"
|
||||
"packageManager": "pnpm@9.15.0"
|
||||
}
|
||||
|
||||
3
node_modules/jiti/register.js
generated
vendored
Normal file
3
node_modules/jiti/register.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
const jiti = require(".")();
|
||||
|
||||
jiti.register();
|
||||
Reference in New Issue
Block a user