initial commit

This commit is contained in:
Zoe
2023-01-03 09:29:04 -06:00
commit 7851137d88
12889 changed files with 2557443 additions and 0 deletions

21
node_modules/jiti/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 UnJS
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

153
node_modules/jiti/README.md generated vendored Normal file
View File

@@ -0,0 +1,153 @@
# jiti
> Runtime typescript and ESM support for Node.js (CommonJS)
[![version][npm-v-src]][npm-v-href]
[![downloads][npm-d-src]][npm-d-href]
[![size][size-src]][size-href]
## Features
- 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
## Usage
### Programmatic
```js
const jiti = require('jiti')(__filename)
jiti('./path/to/file.ts')
```
You can also pass options as second argument:
```js
const jiti = require('jiti')(__filename, { debug: true })
```
### CLI
```bash
jiti index.ts
# or npx jiti index.ts
```
### Register require hook
```bash
node -r jiti/register index.ts
```
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`
Enable debug to see which files are transpiled
### `cache`
- Type: Boolean | String
- Default: `true`
- Environment Variable: `JITI_CACHE`
Use transpile cache
If set to `true` will use `node_modules/.cache/jiti` (if exists) or `{TMP_DIR}/node-jiti`
### `esmResolve`
- Type: Boolean | String
- Default: `false`
- Environment Variable: `JITI_ESM_RESOLVE`
Using esm resolution algorithm to support `import` condition.
### `transform`
- Type: Function
- Default: Babel (lazy loaded)
Transform function. See [src/babel](./src/babel.ts) for more details
### `sourceMaps`
- Type: Boolean
- Default `false`
- Environment Variable: `JITI_SOURCE_MAPS`
Add inline source map to transformed source for better debugging.
### `interopDefault`
- Type: Boolean
- Default: `false`
Return the `.default` export of a module at the top-level.
### `alias`
- Type: Object
- Default: -
- Environment Variable: `JITI_ALIAS`
Custom alias map used to resolve ids.
### `nativeModules`
- Type: Array
- Default: ['typescript`]
- Environment Variable: `JITI_NATIVE_MODULES`
List of modules (within `node_modules`) to always use native require for them.
### `transformModules`
- Type: Array
- Default: []
- Environment Variable: `JITI_TRANSFORM_MODULES`
List of modules (within `node_modules`) to transform them regardless of syntax.
## Development
- Clone Repo
- Run `yarn`
- Run `yarn build`
- Run `yarn dev`
- Run `yarn jiti ./test/path/to/file.ts`
## License
MIT. Made with 💖
<!-- 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

16
node_modules/jiti/bin/jiti.js generated vendored Executable file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/env node
const { resolve } = require('path')
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)
}
const pwd = process.cwd()
const jiti = require('..')(pwd)
const resolved = process.argv[1] = jiti.resolve(resolve(pwd, script))
jiti(resolved)

2
node_modules/jiti/dist/babel.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import { TransformOptions, TRANSFORM_RESULT } from './types';
export default function transform(opts: TransformOptions): TRANSFORM_RESULT;

1946
node_modules/jiti/dist/babel.js generated vendored Normal file

File diff suppressed because one or more lines are too long

9
node_modules/jiti/dist/jiti.d.ts generated vendored Normal file
View File

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

1
node_modules/jiti/dist/jiti.js generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

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

30
node_modules/jiti/dist/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,30 @@
export declare type TransformOptions = {
source: string;
filename?: string;
ts?: boolean;
retainLines?: boolean;
legacy?: boolean;
[key: string]: any;
};
export declare type TRANSFORM_RESULT = {
code: string;
error?: any;
};
export declare 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[];
};

7
node_modules/jiti/dist/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,7 @@
import type { PackageJson } from 'pkg-types';
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
View File

@@ -0,0 +1,15 @@
function onError (err) {
throw err /* ↓ Check stack trace ↓ */
}
module.exports = function (filename, opts) {
const jiti = require('../dist/jiti')
opts = { onError, ...opts }
if (!opts.transform) {
opts.transform = require('../dist/babel')
}
return jiti(filename, opts)
}

76
node_modules/jiti/package.json generated vendored Normal file
View File

@@ -0,0 +1,76 @@
{
"name": "jiti",
"version": "1.16.0",
"description": "Runtime typescript and ESM support for Node.js (CommonJS)",
"repository": "unjs/jiti",
"license": "MIT",
"main": "./lib/index.js",
"types": "dist/jiti.d.ts",
"bin": "bin/jiti.js",
"files": [
"lib",
"dist",
"register.js"
],
"devDependencies": {
"@babel/core": "^7.19.1",
"@babel/plugin-proposal-decorators": "^7.19.1",
"@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-syntax-class-properties": "^7.12.13",
"@babel/plugin-transform-modules-commonjs": "^7.18.6",
"@babel/plugin-transform-typescript": "^7.19.1",
"@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",
"@types/babel__template": "^7.4.1",
"@types/mkdirp": "^1.0.2",
"@types/node": "^18.7.18",
"@types/object-hash": "^2.2.1",
"@types/resolve": "^1.20.2",
"@types/semver": "^7.3.12",
"@vitest/coverage-c8": "^0.23.4",
"acorn": "^8.8.0",
"babel-plugin-dynamic-import-node": "^2.3.3",
"babel-plugin-parameter-decorator": "^1.0.16",
"config": "^3.3.8",
"create-require": "^1.1.1",
"cross-env": "^7.0.3",
"destr": "^1.1.1",
"escape-string-regexp": "^5.0.0",
"eslint": "^8.23.1",
"esm": "^3.2.25",
"estree-walker": "^3.0.1",
"execa": "^6.1.0",
"fast-glob": "^3.2.12",
"mkdirp": "^1.0.4",
"mlly": "^0.5.14",
"object-hash": "^3.0.0",
"pathe": "^0.3.8",
"pirates": "^4.0.5",
"pkg-types": "^0.3.5",
"semver": "^7.3.7",
"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"
},
"packageManager": "pnpm@7.12.0",
"scripts": {
"build": "pnpm clean && cross-env NODE_ENV=production pnpm webpack",
"clean": "rm -rf dist",
"dev": "pnpm clean && pnpm webpack --watch",
"jiti": "cross-env JITI_DEBUG=1 JITI_CACHE=false ./bin/jiti.js",
"jiti:legacy": "cross-env JITI_DEBUG=1 npx node@12 ./bin/jiti.js",
"lint": "eslint --ext .ts,.js .",
"release": "pnpm build && pnpm test && pnpm standard-version && git push --follow-tags && pnpm publish",
"test": "pnpm lint && vitest run --coverage"
}
}

3
node_modules/jiti/register.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
const jiti = require('.')()
jiti.register()