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.3 to 0.5.4

6

dist/api.js

@@ -8,4 +8,4 @@ "use strict";

const Project_1 = require("./loader/Project");
const readdir = util_1.promisify(fs.readdir);
const readFile = util_1.promisify(fs.readFile);
const readdir = (0, util_1.promisify)(fs.readdir);
const readFile = (0, util_1.promisify)(fs.readFile);
function loadModules(options) {

@@ -70,3 +70,3 @@ if (isSyncReadModulesOptions(options))

async function readRtoFile(baseDir, modulePath, encoding) {
const path = path_1.join(baseDir, modulePath);
const path = (0, path_1.join)(baseDir, modulePath);
try {

@@ -73,0 +73,0 @@ return await readFile(`${path}.rto.json`, encoding);

@@ -11,3 +11,3 @@ "use strict";

throw new Error(`Module path must start with './' or '../'`);
let parentDir = options.relativeToModule ? path_1.dirname(options.relativeToModule) : ".";
let parentDir = options.relativeToModule ? (0, path_1.dirname)(options.relativeToModule) : ".";
while (true) {

@@ -17,3 +17,3 @@ if (from.startsWith("./"))

else if (from.startsWith("../")) {
const newDir = path_1.dirname(parentDir);
const newDir = (0, path_1.dirname)(parentDir);
if (newDir === parentDir)

@@ -20,0 +20,0 @@ break;

// -- API Definitions --
/// <reference types="node" />
export declare type ReadModulesOptions = SyncReadModulesOptions | AsyncReadModulesOptions

@@ -20,3 +21,3 @@ export interface SyncReadModulesOptions {

baseDir?: string
encoding?: string
encoding?: BufferEncoding
rtoModuleProvider?: RtoModuleProvider

@@ -23,0 +24,0 @@ }

@@ -39,3 +39,3 @@ "use strict";

getModuleFactory(relPath) {
const modulePath = module_path_helpers_1.toModulePath(Object.assign(Object.assign({}, relPath), { removeExtensions: [".rto.json"] }));
const modulePath = (0, module_path_helpers_1.toModulePath)(Object.assign(Object.assign({}, relPath), { removeExtensions: [".rto.json"] }));
const factory = this.factories.get(modulePath);

@@ -47,3 +47,3 @@ if (!factory)

async loadRtoModule(relPath) {
const modulePath = module_path_helpers_1.toModulePath(Object.assign(Object.assign({}, relPath), { removeExtensions: [".rto.json"] }));
const modulePath = (0, module_path_helpers_1.toModulePath)(Object.assign(Object.assign({}, relPath), { removeExtensions: [".rto.json"] }));
let factory = this.factories.get(modulePath);

@@ -68,3 +68,3 @@ if (!factory) {

loadRtoModuleSync(relPath) {
const modulePath = module_path_helpers_1.toModulePath(Object.assign(Object.assign({}, relPath), { removeExtensions: [".rto.json"] }));
const modulePath = (0, module_path_helpers_1.toModulePath)(Object.assign(Object.assign({}, relPath), { removeExtensions: [".rto.json"] }));
let factory = this.factories.get(modulePath);

@@ -71,0 +71,0 @@ if (!factory) {

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

@@ -18,10 +18,10 @@ "author": "Paroi",

"devDependencies": {
"@types/jest": "^26.0.9",
"@types/node": "^14.0.27",
"jest": "^26.4.0",
"@types/jest": "^27.4.1",
"@types/node": "16",
"jest": "^27.5.1",
"rimraf": "^3.0.2",
"ts-jest": "^26.2.0",
"ts-jest": "^27.1.4",
"tslint": "^6.1.3",
"typeonly": "^0.4.2",
"typescript": "^3.9.7"
"typeonly": "^0.4.5",
"typescript": "^4.6.3"
},

@@ -28,0 +28,0 @@ "main": "dist/api.js",

@@ -29,3 +29,3 @@ import * as fs from "fs"

baseDir?: string
encoding?: string
encoding?: BufferEncoding
rtoModuleProvider?: RtoModuleProvider

@@ -94,3 +94,3 @@ }

function makeReadSourceFileRtoModuleProvider(options: { baseDir: string, encoding: string }): RtoModuleProvider {
function makeReadSourceFileRtoModuleProvider(options: { baseDir: string, encoding: BufferEncoding }): RtoModuleProvider {
return async (modulePath: string) => {

@@ -103,3 +103,3 @@ const { baseDir, encoding } = options

async function readRtoFile(baseDir: string, modulePath: string, encoding: string) {
async function readRtoFile(baseDir: string, modulePath: string, encoding: BufferEncoding) {
const path = join(baseDir, modulePath)

@@ -106,0 +106,0 @@ try {

@@ -51,3 +51,3 @@ import { createStandaloneRtoModule, parseTypeOnly } from "typeonly"

const namedType = modules["./mod1"]["namedTypes"]["T1"] as TypeName & BaseNamedType
delete namedType["module"]
delete (namedType as any)["module"]
expect(namedType).toEqual(source["output"])

@@ -109,3 +109,3 @@ }

expect(namedType.ref.module).toBeDefined()
delete namedType.ref.module
delete (namedType.ref as any).module
expect(namedType.ref).toEqual({

@@ -138,3 +138,3 @@ name: "B",

delete namedType.module
delete (namedType as any).module
expect(namedType).toEqual({

@@ -141,0 +141,0 @@ name: "T1",

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