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 3.0.0-beta.4 to 4.0.0-beta.0

dist/load.interfaces.d.ts

20

dist/main.d.ts

@@ -1,19 +0,7 @@

import * as tsc from 'typescript';
export interface LoadOptions {
compilerOptions: tsc.CompilerOptions;
}
export declare let defaultLoadOptions: {
compilerOptions: {
outDir: string;
downlevelIteration: boolean;
emitDecoratorMetadata: boolean;
experimentalDecorators: boolean;
module: tsc.ModuleKind;
resolveJsonModule: boolean;
rootDir: string;
skipLibCheck: boolean;
target: tsc.ScriptTarget;
};
import { LoadMode, LoadOptions } from './load.interfaces';
export declare const defaultLoadOptions: {
mode: LoadMode;
};
export declare const load: (tsRelativePath: string, options?: Partial<LoadOptions>) => Promise<any>;
export declare const loadSync: (tsRelativePath: string, options?: Partial<LoadOptions>) => any;
export * from './load.interfaces';

42

dist/main.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadSync = exports.load = exports.defaultLoadOptions = void 0;
const compiler = require("./modules/compiler");
const tslib_1 = require("tslib");
const crossPlatform = require("./modules/cross-platform");
const path = require("path");
const tsc = require("typescript");
const utils = require("./utils");
const load_interfaces_1 = require("./load.interfaces");
const options_defaults_1 = require("options-defaults");
const providers_1 = require("./providers/providers");
exports.defaultLoadOptions = {
compilerOptions: {
outDir: path.resolve(__dirname, `..`, `cache`),
downlevelIteration: true,
emitDecoratorMetadata: true,
experimentalDecorators: true,
module: tsc.ModuleKind.CommonJS,
resolveJsonModule: true,
rootDir: `/`,
skipLibCheck: true,
target: tsc.ScriptTarget.ES2015,
},
mode: load_interfaces_1.LoadMode.Transpile,
};
const load = async (tsRelativePath, options) => {
const config = (0, options_defaults_1.defaults)(exports.defaultLoadOptions, options);
const loadConfig = (0, options_defaults_1.defaults)(exports.defaultLoadOptions, options);
const providers = providers_1.providersMap[loadConfig.mode];
const config = providers.getConfig(loadConfig);
const cwd = process.cwd();
const cacheDir = config.compilerOptions.outDir;
const cacheDir = providers.getCacheDir(config);
const tsPath = path.resolve(cwd, tsRelativePath);

@@ -39,6 +32,4 @@ let jsAfterCachePath = crossPlatform.getJsAfterCachePath(tsPath);

}
compiler.compile({
tsPath,
compilerOptions: config.compilerOptions,
});
await providers.load(Object.assign({ tsPath,
jsPath }, config));
const loaded = await Promise.resolve().then(() => require(jsPath));

@@ -49,5 +40,7 @@ return loaded;

const loadSync = (tsRelativePath, options) => {
const config = (0, options_defaults_1.defaults)(exports.defaultLoadOptions, options);
const loadConfig = (0, options_defaults_1.defaults)(exports.defaultLoadOptions, options);
const providers = providers_1.providersMap[loadConfig.mode];
const config = providers.getConfig(loadConfig);
const cwd = process.cwd();
const cacheDir = config.compilerOptions.outDir;
const cacheDir = providers.getCacheDir(config);
const tsPath = path.resolve(cwd, tsRelativePath);

@@ -67,6 +60,4 @@ let jsAfterCachePath = crossPlatform.getJsAfterCachePath(tsPath);

}
compiler.compile({
tsPath,
compilerOptions: config.compilerOptions,
});
providers.loadSync(Object.assign({ tsPath,
jsPath }, config));
const loaded = require(jsPath);

@@ -76,2 +67,3 @@ return loaded;

exports.loadSync = loadSync;
tslib_1.__exportStar(require("./load.interfaces"), exports);
//# sourceMappingURL=main.js.map
export * from './compile';
export * from './transpile';

@@ -5,2 +5,3 @@ "use strict";

tslib_1.__exportStar(require("./compile"), exports);
tslib_1.__exportStar(require("./transpile"), exports);
//# sourceMappingURL=index.js.map
{
"name": "ts-import",
"version": "3.0.0-beta.4",
"version": "4.0.0-beta.0",
"description": "Import (compile and cache on the fly) TypeScript files dynamically with ease.",

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

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