Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ts-import

Package Overview
Dependencies
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-import - npm Package Compare versions

Comparing version 4.0.0-beta.5 to 4.0.0-beta.6

2

dist/main.d.ts

@@ -7,3 +7,3 @@ import { LoadMode, LoadOptions } from './load.interfaces';

export declare const load: (tsRelativePath: string, options?: LoadOptions) => Promise<any>;
export declare const loadSync: (tsRelativePath: string, options?: LoadOptions) => Promise<any>;
export declare const loadSync: (tsRelativePath: string, options?: LoadOptions) => any;
export * from './load.interfaces';

@@ -44,5 +44,5 @@ "use strict";

exports.load = load;
const loadSync = async (tsRelativePath, options) => {
const loadSync = (tsRelativePath, options) => {
if (options === null || options === void 0 ? void 0 : options.allowConfigurationWithComments) {
const commentConfig = await commentParser.getTsImportCommentConfig(tsRelativePath);
const commentConfig = commentParser.getTsImportCommentConfigSync(tsRelativePath);
options = (0, options_defaults_1.defaults)(options, commentConfig);

@@ -49,0 +49,0 @@ }

{
"name": "ts-import",
"version": "4.0.0-beta.5",
"version": "4.0.0-beta.6",
"description": "Import (compile and cache on the fly) TypeScript files dynamically with ease.",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -25,3 +25,5 @@ <p align="center">

const filePath = `/home/user/file.ts`;
const asyncResult = await tsImport.load(filePath);
const asyncResult = await tsImport.load(filePath, {
// allowConfigurationWithComments: false,
});
const syncResult = tsImport.loadSync(filePath);

@@ -33,2 +35,20 @@ };

### allowConfigurationWithComments
You can define if file should be imported in the default `transpile` mode or `compile` mode by placing a comment on top of the specific file.
Compile mode is slower, but allows the specified file to be part of a complex program - it can import other files etc.
```ts
/**
* @tsImport
* { "mode": "compile" }
*/
import { getOtherVariable } from './get-other-variable';
const result = getOtherVariable();
export { result };
```
## Features

@@ -35,0 +55,0 @@

@@ -6,3 +6,5 @@ ```ts

const filePath = `/home/user/file.ts`;
const asyncResult = await tsImport.load(filePath);
const asyncResult = await tsImport.load(filePath, {
// allowConfigurationWithComments: false,
});
const syncResult = tsImport.loadSync(filePath);

@@ -13,1 +15,19 @@ };

```
### allowConfigurationWithComments
You can define if file should be imported in the default `transpile` mode or `compile` mode by placing a comment on top of the specific file.
Compile mode is slower, but allows the specified file to be part of a complex program - it can import other files etc.
```ts
/**
* @tsImport
* { "mode": "compile" }
*/
import { getOtherVariable } from './get-other-variable';
const result = getOtherVariable();
export { result };
```

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