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

@codemod-utils/ast-template

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codemod-utils/ast-template - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

31

dist/ast/handlebars.d.ts

@@ -1,9 +0,28 @@

import { type AST, builders, type NodeVisitor, print } from 'ember-template-recast';
declare function _traverse(): (file: string, visitMethods?: NodeVisitor) => AST.Template;
type Tools = {
builders: typeof builders;
import { type AST as _AST, type NodeVisitor, print } from 'ember-template-recast';
declare function _traverse(): (file: string, visitMethods?: NodeVisitor) => _AST.Template;
/**
* Provides methods from `ember-template-recast` to help you parse
* and transform `*.hbs` files.
*
* @example
*
* ```ts
* import { AST } from '@codemod-utils/ast-template';
*
* function transformCode(file: string): string {
* const traverse = AST.traverse();
*
* const ast = traverse(file, {
* // Use AST.builders to transform the tree
* });
*
* return AST.print(ast);
* }
* ```
*/
export declare const AST: {
builders: import("ember-template-recast/lib/custom-nodes.js").Builders;
print: typeof print;
traverse: typeof _traverse;
};
declare const tools: Tools;
export default tools;
export {};

@@ -13,3 +13,23 @@ import { builders, print, transform, } from 'ember-template-recast';

}
const tools = {
/**
* Provides methods from `ember-template-recast` to help you parse
* and transform `*.hbs` files.
*
* @example
*
* ```ts
* import { AST } from '@codemod-utils/ast-template';
*
* function transformCode(file: string): string {
* const traverse = AST.traverse();
*
* const ast = traverse(file, {
* // Use AST.builders to transform the tree
* });
*
* return AST.print(ast);
* }
* ```
*/
export const AST = {
builders,

@@ -19,2 +39,1 @@ print,

};
export default tools;

2

dist/index.d.ts

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

export { default as AST } from './ast/handlebars.js';
export * from './ast/handlebars.js';

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

export { default as AST } from './ast/handlebars.js';
export * from './ast/handlebars.js';
{
"name": "@codemod-utils/ast-template",
"version": "1.0.0",
"version": "1.1.0",
"description": "Utilities for handling *.hbs files as abstract syntax tree",

@@ -43,11 +43,11 @@ "keywords": [

"@sondr3/minitest": "^0.1.2",
"@types/node": "^18.17.15",
"concurrently": "^8.2.1",
"eslint": "^8.49.0",
"@types/node": "^18.18.7",
"concurrently": "^8.2.2",
"eslint": "^8.52.0",
"prettier": "^3.0.3",
"typescript": "^5.2.2",
"@shared-configs/eslint-config-node": "0.0.0",
"@shared-configs/prettier": "0.0.0",
"@shared-configs/typescript": "0.0.0",
"@codemod-utils/tests": "1.0.0",
"@shared-configs/prettier": "0.0.0"
"@codemod-utils/tests": "1.1.1"
},

@@ -54,0 +54,0 @@ "engines": {

@@ -10,10 +10,8 @@ [![This project uses GitHub Actions for continuous integration.](https://github.com/ijlee2/codemod-utils/actions/workflows/ci.yml/badge.svg)](https://github.com/ijlee2/codemod-utils/actions/workflows/ci.yml)

`@codemod-utils/ast-template` wraps the methods from [`ember-template-recast`](https://github.com/ember-template-lint/ember-template-recast), a library that helps you parse and transform `*.hbs` files.
`@codemod-utils/ast-template` provides methods from [`ember-template-recast`](https://github.com/ember-template-lint/ember-template-recast) to help you parse and transform `*.hbs` files.
The wrappers help you read and write files of different types _in the same way_. This way, you can focus on learning the **builders** and **visit methods**, the building blocks for transforming code (library-dependent).
```js
```ts
import { AST } from '@codemod-utils/ast-template';
function transformCode(file) {
function transformCode(file: string): string {
const traverse = AST.traverse();

@@ -61,3 +59,3 @@

```js
```ts
/* Your file */

@@ -89,3 +87,3 @@ import { AST } from '@codemod-utils/ast-template';

```js
```ts
/* AST Explorer */

@@ -134,3 +132,3 @@ module.exports = function(env) {

See the [Contributing](../../CONTRIBUTING.md) guide for details.
See the [Contributing](../../../CONTRIBUTING.md) guide for details.

@@ -137,0 +135,0 @@

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