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

@typeonly/loader

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@typeonly/loader - npm Package Compare versions

Comparing version 0.5.0 to 0.5.1

tests/loader-types.spec.ts

14

dist/api.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.literals = exports.isSyncReadModulesOptions = exports.readModules = void 0;
exports.literals = exports.isSyncReadModulesOptions = exports.loadModules = void 0;
const fs = require("fs");

@@ -10,9 +10,9 @@ const path_1 = require("path");

const readFile = util_1.promisify(fs.readFile);
function readModules(options) {
function loadModules(options) {
if (isSyncReadModulesOptions(options))
return readModulesSync(options);
return loadModulesSync(options);
else
return readModulesAsync(options);
return loadModulesAsync(options);
}
exports.readModules = readModules;
exports.loadModules = loadModules;
function isSyncReadModulesOptions(options) {

@@ -22,3 +22,3 @@ return !!options["bundle"];

exports.isSyncReadModulesOptions = isSyncReadModulesOptions;
function readModulesSync(options) {
function loadModulesSync(options) {
let { modulePaths, bundle } = options;

@@ -36,3 +36,3 @@ const rtoModuleProvider = (modulePath) => {

}
async function readModulesAsync(options) {
async function loadModulesAsync(options) {
let { modulePaths, rtoModuleProvider } = options;

@@ -39,0 +39,0 @@ if (rtoModuleProvider) {

@@ -27,4 +27,4 @@ // -- API Definitions --

export declare type RtoModuleProvider = (modulePath: string) => Promise<any> | any
export declare function readModules(options: SyncReadModulesOptions): Modules
export declare function readModules(options: AsyncReadModulesOptions): Promise<Modules>
export declare function loadModules(options: SyncReadModulesOptions): Modules
export declare function loadModules(options: AsyncReadModulesOptions): Promise<Modules>
export declare function isSyncReadModulesOptions(options: ReadModulesOptions): options is SyncReadModulesOptions

@@ -31,0 +31,0 @@ export declare function literals(type: Type, only: "string"): string[]

{
"name": "@typeonly/loader",
"version": "0.5.0",
"version": "0.5.1",
"description": "Brings types and interfaces from TypeScript at runtime.",

@@ -5,0 +5,0 @@ "author": "Paroi",

@@ -24,5 +24,5 @@ # @typeonly/loader

// src/main.js
const { readModules, literals } = require("@typeonly/loader");
const { loadModules, literals } = require("@typeonly/loader");
const modules = readModules({
const modules = loadModules({
bundle: require(`./types.to.json`)

@@ -29,0 +29,0 @@ });

@@ -38,9 +38,9 @@ import * as fs from "fs"

export function readModules(options: SyncReadModulesOptions): Modules
export function readModules(options: AsyncReadModulesOptions): Promise<Modules>
export function readModules(options: ReadModulesOptions): any {
export function loadModules(options: SyncReadModulesOptions): Modules
export function loadModules(options: AsyncReadModulesOptions): Promise<Modules>
export function loadModules(options: ReadModulesOptions): any {
if (isSyncReadModulesOptions(options))
return readModulesSync(options)
return loadModulesSync(options)
else
return readModulesAsync(options)
return loadModulesAsync(options)
}

@@ -52,3 +52,3 @@

function readModulesSync(options: SyncReadModulesOptions): Modules {
function loadModulesSync(options: SyncReadModulesOptions): Modules {
let { modulePaths, bundle } = options

@@ -67,3 +67,3 @@ const rtoModuleProvider = (modulePath: string) => {

async function readModulesAsync(options: AsyncReadModulesOptions): Promise<Modules> {
async function loadModulesAsync(options: AsyncReadModulesOptions): Promise<Modules> {
let { modulePaths, rtoModuleProvider } = options

@@ -70,0 +70,0 @@ if (rtoModuleProvider) {

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