Comparing version 2.0.40 to 3.0.0-beta.0
@@ -1,2 +0,2 @@ | ||
export * from './import-js-in-directory'; | ||
export * from './was-file-modified'; | ||
export * from './check-if-file-exists'; | ||
export * from './is-file-newer'; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
exports.__esModule = true; | ||
__exportStar(require("./import-js-in-directory"), exports); | ||
__exportStar(require("./was-file-modified"), exports); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./check-if-file-exists"), exports); | ||
tslib_1.__exportStar(require("./is-file-newer"), exports); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "ts-import", | ||
"version": "2.0.40", | ||
"version": "3.0.0-beta.0", | ||
"description": "Import (compile and cache on the fly) TypeScript files dynamically with ease.", | ||
@@ -18,14 +18,14 @@ "license": "MIT", | ||
"homepage": "https://github.com/radarsu/ts-import#readme", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"main": "dist/main.js", | ||
"types": "dist/main.d.ts", | ||
"dependencies": { | ||
"options-defaults": "^2.0.39" | ||
"options-defaults": "~2.0.39" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^27.0.3", | ||
"@types/node": "^14.18.0", | ||
"jest": "^27.4.3", | ||
"jest-cli": "^27.4.3", | ||
"ts-jest": "^27.1.0", | ||
"typescript": "^4.5.2" | ||
"@types/jest": "~27.5.1", | ||
"@types/node": "~16", | ||
"jest": "~28.1.0", | ||
"jest-cli": "~28.1.0", | ||
"ts-jest": "~28.0.2", | ||
"typescript": "~4.6" | ||
}, | ||
@@ -32,0 +32,0 @@ "engines": { |
@@ -14,29 +14,27 @@ <p align="center"> | ||
## Getting Started | ||
## Getting Started | ||
`npm i ts-import` | ||
## Usage | ||
## Usage | ||
```ts | ||
import { tsImport } from 'ts-import'; | ||
import * as tsImport from 'ts-import'; | ||
const bootstrap = async () => { | ||
const main = async () => { | ||
const filePath = `/home/user/file.ts`; | ||
const compiled = await tsImport.compile(filePath); | ||
const asyncResult = await tsImport.load(filePath); | ||
const syncResult = tsImport.loadSync(filePath); | ||
}; | ||
bootstrap(); | ||
void main(); | ||
``` | ||
## Features | ||
## Features | ||
- **Asynchronous** - uses **import** over **require**. | ||
- **Asynchronous and synchronous version** - uses **import** for async and **require** for sync. | ||
- **Caches JavaScript** files into directory inside **node_modules/ts-import/cache** (pretty much like **typescript-require**). Removing node_modules removes cache as well. | ||
- **Compiler class** - allows making multiple instances of compiler with different configurations and overriding default settings to all of them (i.e. logger) via static "defaults" property: `Compiler.defaults = { ...customDefaults }`. **tsImport** object is a default instance of Compiler class suitable for majority of use-cases. | ||
- **Fast** - I've benchmarked ways to compare detecting file changes with **fs** module and checking mtimeMs turned out to be fastest (https://jsperf.com/fs-stat-mtime-vs-mtimems). | ||
- **Highly flexible and configurable** - all **tsc** flags are available for customization. By default uses: `--module commonjs`, `--target es2015`, `--downlevelIteration`, `--emitDecoratorMetadata`, `--experimentalDecorators`, `--resolveJsonModule`. | ||
- **Fast** - I've benchmarked ways to compare detecting file changes with **fs** module and checking mtimeMs turned out to be fastest (https://jsperf.com/fs-stat-mtime-vs-mtimems). Also, compilation in version 3 is approximately 10x faster than in version 2. | ||
- **Highly flexible and configurable** - all compilerOptions are available under transpileOptions parameter. | ||
- **No interference** - doesn't interfere with native import, require etc. changing their behavior or impacting their performance. | ||
- **Only 1 dependency** - uses only 1 package maintained by myself (which has 0 dependencies). | ||
- **Only 1 dependency** - uses only 1 tiny package maintained by myself (which has 0 dependencies). |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
37879
27
141
1
40
7
Updatedoptions-defaults@~2.0.39