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

@file-services/typescript

Package Overview
Dependencies
Maintainers
2
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@file-services/typescript - npm Package Compare versions

Comparing version 0.5.0 to 1.0.0

2

cjs/create-host.js

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

try {
return readFileSync(filePath);
return readFileSync(filePath, 'utf8');
}

@@ -59,0 +59,0 @@ catch (_a) {

@@ -51,3 +51,3 @@ import ts from 'typescript';

try {
return readFileSync(filePath);
return readFileSync(filePath, 'utf8');
}

@@ -54,0 +54,0 @@ catch (_a) {

{
"name": "@file-services/typescript",
"description": "Helpers for creation of TypeScript hosts",
"version": "0.5.0",
"version": "1.0.0",
"main": "cjs/index.js",

@@ -18,3 +18,3 @@ "module": "esm/index.js",

"dependencies": {
"@file-services/types": "^0.4.11"
"@file-services/types": "^1.0.0"
},

@@ -28,3 +28,3 @@ "files": [

"license": "MIT",
"repository": "https://github.com/wixplosives/file-services/tree/master/packages/memory",
"repository": "https://github.com/wixplosives/file-services/tree/master/packages/typescript",
"homepage": "https://github.com/wixplosives/file-services",

@@ -35,3 +35,3 @@ "publishConfig": {

"sideEffects": false,
"gitHead": "d077e3795b175547ed2dbb821b90c12fbd29bcb5"
"gitHead": "b7770933845945aa3e9fe054c4ecbfb46b0c12c9"
}

@@ -1,8 +0,8 @@

import ts from 'typescript'
import { IFileSystemSync, IFileSystemPath } from '@file-services/types'
import ts from 'typescript';
import { IFileSystemSync, IFileSystemPath } from '@file-services/types';
const UNIX_NEW_LINE = '\n'
const identity = (val: string) => val
const toLowerCase = (val: string) => val.toLowerCase()
const defaultGetNewLine = ts.sys ? () => ts.sys.newLine : () => UNIX_NEW_LINE
const UNIX_NEW_LINE = '\n';
const identity = (val: string) => val;
const toLowerCase = (val: string) => val.toLowerCase();
const defaultGetNewLine = ts.sys ? () => ts.sys.newLine : () => UNIX_NEW_LINE;
/**

@@ -13,13 +13,13 @@ * Combines all required functionality for parsing config files,

export interface IBaseHost extends ts.ParseConfigHost, ts.FormatDiagnosticsHost, ts.ModuleResolutionHost {
getCurrentDirectory: IFileSystemSync['cwd']
directoryExists: IFileSystemSync['directoryExistsSync']
getCurrentDirectory: IFileSystemSync['cwd'];
directoryExists: IFileSystemSync['directoryExistsSync'];
readDirectory: NonNullable<ts.LanguageServiceHost['readDirectory']>
getDirectories: NonNullable<ts.ModuleResolutionHost['getDirectories']>
readDirectory: NonNullable<ts.LanguageServiceHost['readDirectory']>;
getDirectories: NonNullable<ts.ModuleResolutionHost['getDirectories']>;
getScriptVersion: ts.LanguageServiceHost['getScriptVersion']
getScriptVersion: ts.LanguageServiceHost['getScriptVersion'];
dirname: IFileSystemPath['dirname']
normalize: IFileSystemPath['normalize']
join: IFileSystemPath['join']
dirname: IFileSystemPath['dirname'];
normalize: IFileSystemPath['normalize'];
join: IFileSystemPath['join'];
}

@@ -47,19 +47,19 @@

path: { join, dirname, normalize }
} = fs
} = fs;
function getFileSystemEntries(path: string): { files: string[]; directories: string[] } {
const files: string[] = []
const directories: string[] = []
const files: string[] = [];
const directories: string[] = [];
try {
const dirEntries = readdirSync(path)
const dirEntries = readdirSync(path);
for (const entryName of dirEntries) {
const entryStats = statSync(join(path, entryName))
const entryStats = statSync(join(path, entryName));
if (!entryStats) {
continue
continue;
}
if (entryStats.isFile()) {
files.push(entryName)
files.push(entryName);
} else if (entryStats.isDirectory()) {
directories.push(entryName)
directories.push(entryName);
}

@@ -71,3 +71,3 @@ }

return { files, directories }
return { files, directories };
}

@@ -86,6 +86,6 @@

getFileSystemEntries
)
);
},
getDirectories(path) {
return getFileSystemEntries(path).directories
return getFileSystemEntries(path).directories;
},

@@ -96,5 +96,5 @@ fileExists: fileExistsSync,

try {
return readFileSync(filePath)
return readFileSync(filePath, 'utf8');
} catch {
return undefined
return undefined;
}

@@ -104,5 +104,5 @@ },

try {
return `${statSync(filePath).mtime.getTime()}`
return `${statSync(filePath).mtime.getTime()}`;
} catch {
return `${Date.now()}`
return `${Date.now()}`;
}

@@ -118,3 +118,3 @@ },

join
}
};
}

@@ -140,3 +140,3 @@

): ts.LanguageServiceHost {
const { readFile, join, useCaseSensitiveFileNames, getNewLine } = baseHost
const { readFile, join, useCaseSensitiveFileNames, getNewLine } = baseHost;

@@ -149,4 +149,4 @@ return {

getScriptSnapshot(filePath) {
const fileContents = readFile(filePath)
return fileContents !== undefined ? ts.ScriptSnapshot.fromString(fileContents) : undefined
const fileContents = readFile(filePath);
return fileContents !== undefined ? ts.ScriptSnapshot.fromString(fileContents) : undefined;
},

@@ -156,3 +156,3 @@ getNewLine: () => ts.getNewLineCharacter(getCompilationSettings(), getNewLine),

useCaseSensitiveFileNames: () => useCaseSensitiveFileNames
}
};
}

@@ -1,1 +0,1 @@

export * from './create-host'
export * from './create-host';

@@ -1,2 +0,2 @@

import ts from 'typescript'
import ts from 'typescript';

@@ -14,8 +14,8 @@ declare module 'typescript' {

getFileSystemEntries: (path: string) => FileSystemEntries
): string[]
): string[];
// used by matchFiles above
export interface FileSystemEntries {
readonly files: ReadonlyArray<string>
readonly directories: ReadonlyArray<string>
readonly files: ReadonlyArray<string>;
readonly directories: ReadonlyArray<string>;
}

@@ -27,3 +27,3 @@

getNewLine?: () => string
): string
): string;
}

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

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

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