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

ts-creator

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-creator - npm Package Compare versions

Comparing version 1.0.5 to 1.0.10

2

package.json
{
"name": "ts-creator",
"version": "1.0.5",
"version": "1.0.10",
"description": "A code generator to generate TypeScript code generator from TypeScript code",

@@ -5,0 +5,0 @@ "main": "dist/src/index.js",

@@ -7,2 +7,25 @@ # ts-creator

## How to use it:
```
npm install ts-creator
```
### 1. generate from code
```ts
import creator from 'ts-creator'
const generatedFactoryCode = creator(`const foo = "your code here"`)
```
### 2. transform source file
```ts
import { transformSourceFile } from 'ts-creator'
declare const file: ts.SourceFile
const factoryFile = transformSourceFile(file)
```
## How does it work?

@@ -70,10 +93,2 @@

## How to use it:
```ts
import creator from 'ts-creator'
const generatedFactoryCode = creator(`const foo = "your code here"`)
```
## TODO:

@@ -80,0 +95,0 @@

@@ -17,3 +17,3 @@ import * as ts from 'typescript'

interface Options {
export interface Options {
prettierOptions?: prettier.Options

@@ -1284,2 +1284,6 @@ }

export function transformNode(node: ts.Node): ts.Expression {
return transformVisitor(node)
}
export function transformSourceFile(sourceFile: ts.SourceFile): ts.SourceFile {

@@ -1293,3 +1297,3 @@ return ts.updateSourceFileNode(sourceFile, [

const printer = ts.createPrinter()
const file = ts.createSourceFile('unknow.ts', code, ts.ScriptTarget.Latest)
const file = ts.createSourceFile('templory.ts', code, ts.ScriptTarget.Latest)
const factoryFile = transformSourceFile(file)

@@ -1296,0 +1300,0 @@ const factoryCode = printer.printFile(factoryFile)

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