New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fib-typify

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fib-typify

just write fibjs with typescript : )

  • 0.1.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

fib-typify

Build Status NPM version

just write fibjs with typescript : )

Introduction

fib-typify allows you write fibjs with typescript in compilation or in runtime. It depends on original typescript stable version. As typescript is written with nodejs, it's not restricted in nodejs runtime: you can also compile typescript in browser or ANY other pure Javascript runtime. That is, you can use it in fibjs also.

renderer

fib-typify's core is jstransformer-typescript (which is one jstransformer aimed to typescript) like, but this core is only valid in fibjs rather than pure javascript

Usage

APIs

NOTE All TSCompilerOptions is just typescript's compilerOptions


compileRaw: (tsRaw: string, tsCompilerOptions: TSCompilerOptions) => string

compile tsRaw to javascript.

compileRawToFile: (tsRaw: string, targetpath: string, tsCompilerOptions: TSCompilerOptions) => void

compile tsRaw to javascript, then write to targetpath

compileRawToSandbox: (tsRaw: string, sboxOpts: any, tsCompilerOptions: TSCompilerOptions) => any

compile tsRaw to javascript, then read it as sandbox

compileFile: (filepath?: string, tsCompilerOptions: TSCompilerOptions) => string

compile content in filepath to javascript.

compileFileTo: (srcpath?: string, targetpath: string, tsCompilerOptions: TSCompilerOptions) => void

compile content in filepath to javascript, then write to targetpath

compileRawToFile: (filepath?: string, tsCompilerOptions: TSCompilerOptions) => string

compile content in filepath to javascript, then read it as sandbox

compileDirectoryTo: (baseDir: string, distDir: string, compileDirToOpts: any) => void

ParamTypeRequired/Default
baseDirstringY / -
distDirstringY / -
compileDirToOptscompileDirToOptsN / -

compile files in directory baseDir recursively to distDir, view options in view compileDirToOpts


compileDirToOpts

FieldTypeRequired/DefaultExplanation
compilerOptionsbooleanY / falsetypescript's compilerOptions
fileglobsToCopyArray, '*'N / ['*.js', '*.jsc', '*.json']whitelist for extensions of globnames to copy when recursive walk to one
includeLeveledGlobsstringstring[]N / ['*', '!node_modules', '!.ts']
filterFileName(filename: string): booleanN / -whether compile File, file would be compiled if returning true

notice compileDirToOpts.extsToCopy is depreacated, if you pass it,compileDirToOpts.fileglobsToCopy get invalid.

File Filter Priority

High -> Low:

  1. includeLeveledGlobs
  2. fileglobsToCopy
  3. filterFileName

File Writing Priority

  1. [compileResult]
  2. fileglobsToCopy

TODO

  • There is no official *.d.ts for fibjs yet. I will support generating fibjs.d.ts when compilation. ---> Just use fib-types
  • better options for compileDirectoryTo
    • hooks before, when, after compiling
    • on walk to one file recursively
    • customizable recursive
    • support fileglobsToCopy with higher priorty than extsToCopy
  • compile '.ts' to '.jsc' directly
  • pack compiled '.jsc' to binary and extract one zipped file.

Contributions

If you wanna contribute to this package, just learn about fibjs first, then fork this repo :)

Keywords

FAQs

Package last updated on 17 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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