Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
fib-typify
Advanced tools
just write fibjs with typescript : )
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.
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
# locally
fibjs --install fib-typify
# or globally
npm i -g fib-typify
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
compileFileToSandBox: (filepath?: string, tsCompilerOptions: TSCompilerOptions) => string
compile content in filepath
to javascript, then read it as sandbox
compileDirectoryTo: (baseDir: string, distDir: string, compileDirToOpts: any) => void
Param | Type | Required/Default |
---|---|---|
baseDir | string | Y / - |
distDir | string | Y / - |
compileDirToOpts | compileDirToOpts | N / - |
compile files in directory baseDir
recursively to distDir
, view options in view compileDirToOpts
Field | Type | Required/Default | Explanation |
---|---|---|---|
compilerOptions | boolean | Y / false | typescript's compilerOptions |
fileglobsToCopy | Array, '*' | N / ['*.js', '*.jsc', '*.json'] | whitelist for extensions of globnames to copy when recursive walk to one |
includeLeveledGlobs | string | string[] | N / ['*', '!node_modules', '!.ts'] |
filterFileName | (filename: string): boolean | N / - | whether compile File, file would be compiled if returning true |
notice compileDirToOpts.extsToCopy
is depreacated, if you pass it,compileDirToOpts.fileglobsToCopy
get invalid.
High -> Low:
Started from 0.2.0
, you can run fib-typify
in CLI.
fib-typify src -o lib -c .typify.json
Command above means compiling directory src
to directory lib
with configuration file .typify.json
. The default tsCompilerOptions is
{
target: 'es6',
module: 'commonjs'
}
if you want to extend it, just write .json/.js/.jsc file, and put its path relateive to cwd()
after -c
/--config-file
CLI option.
I only provided one simple and crude error exception mechanism, so in some cases it may be not friendly as you like, it's welcome to take PR to help optimizting this part of fib-typify
:)
*.d.ts
for fibjs yet. I will support generating fibjs.d.ts
when compilation.compileDirectoryTo
recursive
fileglobsToCopy
with higher priorty than extsToCopy
--help
CLI option for cliIf you wanna contribute to this package, just learn about fibjs first, then fork this repo :)
FAQs
just write fibjs with typescript : )
The npm package fib-typify receives a total of 2 weekly downloads. As such, fib-typify popularity was classified as not popular.
We found that fib-typify demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.