ember-template-recast
Advanced tools
Comparing version 4.3.0 to 5.0.0
@@ -0,1 +1,19 @@ | ||
# Changelog | ||
## v5.0.0 (2020-11-04) | ||
#### :boom: Breaking Change | ||
* [#385](https://github.com/ember-template-lint/ember-template-recast/pull/385) Drop Node 13 support. ([@rwjblue](https://github.com/rwjblue)) | ||
* [#386](https://github.com/ember-template-lint/ember-template-recast/pull/386) Refactor command line transform API to match JS API. ([@rwjblue](https://github.com/rwjblue)) | ||
#### :house: Internal | ||
* [#389](https://github.com/ember-template-lint/ember-template-recast/pull/389) Update automated release setup. ([@rwjblue](https://github.com/rwjblue)) | ||
* [#387](https://github.com/ember-template-lint/ember-template-recast/pull/387) Update Typescript related dependencies to latest. ([@rwjblue](https://github.com/rwjblue)) | ||
* [#388](https://github.com/ember-template-lint/ember-template-recast/pull/388) Remove macOS from CI. ([@rwjblue](https://github.com/rwjblue)) | ||
#### Committers: 2 | ||
- Robert Jackson ([@rwjblue](https://github.com/rwjblue)) | ||
- [@dependabot-preview[bot]](https://github.com/apps/dependabot-preview) | ||
## v4.3.0 (2020-11-04) | ||
@@ -2,0 +20,0 @@ |
@@ -57,19 +57,11 @@ "use strict"; | ||
function applyTransform(plugin, filePath, contents) { | ||
const fileInfo = { | ||
path: filePath, | ||
source: contents, | ||
}; | ||
// TODO: deprecate `visit` and pass through full API from ./index.ts | ||
const templateRecast = { | ||
parse: index_1.parse, | ||
visit(ast, callback) { | ||
const results = index_1.transform(ast, callback); | ||
return results && results.code; | ||
}, | ||
}; | ||
const code = plugin(fileInfo, templateRecast); | ||
const results = index_1.transform({ | ||
template: contents, | ||
filePath, | ||
plugin, | ||
}); | ||
return { | ||
skipped: !code, | ||
changed: code !== contents, | ||
source: code, | ||
skipped: !results.code, | ||
changed: results.code !== contents, | ||
source: results.code, | ||
}; | ||
@@ -76,0 +68,0 @@ } |
{ | ||
"name": "ember-template-recast", | ||
"version": "4.3.0", | ||
"version": "5.0.0", | ||
"description": "Non-destructive template transformer.", | ||
@@ -18,2 +18,4 @@ "keywords": [ | ||
"author": "Robert Jackson <me@rwjblue.com>", | ||
"main": "lib/index.js", | ||
"bin": "lib/bin.js", | ||
"files": [ | ||
@@ -23,6 +25,3 @@ "lib/", | ||
], | ||
"main": "lib/index.js", | ||
"bin": "lib/bin.js", | ||
"scripts": { | ||
"changelog": "lerna-changelog", | ||
"build": "tsc", | ||
@@ -52,6 +51,6 @@ "lint": "npm-run-all lint:*", | ||
"@types/common-tags": "^1.8.0", | ||
"@types/jest": "^26.0.14", | ||
"@types/jest": "^26.0.15", | ||
"@types/workerpool": "^6.0.0", | ||
"@typescript-eslint/eslint-plugin": "^4.3.0", | ||
"@typescript-eslint/parser": "^4.3.0", | ||
"@typescript-eslint/eslint-plugin": "^4.6.1", | ||
"@typescript-eslint/parser": "^4.6.1", | ||
"broccoli-test-helper": "^2.0.0", | ||
@@ -65,12 +64,11 @@ "common-tags": "^1.8.0", | ||
"jest": "^26.6.1", | ||
"lerna-changelog": "^1.0.1", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^2.1.2", | ||
"release-it": "14.1.0", | ||
"release-it-lerna-changelog": "^2.4.0", | ||
"ts-jest": "^26.4.1", | ||
"typescript": "^4.0.3" | ||
"release-it": "^14.2.1", | ||
"release-it-lerna-changelog": "^3.1.0", | ||
"ts-jest": "^26.4.3", | ||
"typescript": "~4.0.5" | ||
}, | ||
"engines": { | ||
"node": "10.* || >= 12.*" | ||
"node": "10.* || 12.* || >= 14.*" | ||
}, | ||
@@ -93,3 +91,4 @@ "publishConfig": { | ||
"release-it-lerna-changelog": { | ||
"infile": "CHANGELOG.md" | ||
"infile": "CHANGELOG.md", | ||
"launchEditor": true | ||
} | ||
@@ -101,5 +100,6 @@ }, | ||
"github": { | ||
"release": true | ||
"release": true, | ||
"tokenRef": "GITHUB_AUTH" | ||
} | ||
} | ||
} |
@@ -35,3 +35,25 @@ # ember-template-recast | ||
``` | ||
## Command Line Usage | ||
ember-template-recast comes with a binary for running a transform across multiple | ||
files, similar to jscodeshift. | ||
``` | ||
npx ember-template-recast directory/of/templates -t transform.js | ||
``` | ||
Example transform plugin: | ||
```js | ||
module.exports = (env) => { | ||
let { builders: b } = env.syntax; | ||
return { | ||
MustacheStatement() { | ||
return b.mustache(b.path('wat-wat')); | ||
}, | ||
}; | ||
}; | ||
``` | ||
## APIs | ||
@@ -135,30 +157,2 @@ | ||
## Command Line Usage | ||
ember-template-recast comes with a binary for running a transform across multiple | ||
files, similar to jscodeshift. | ||
``` | ||
npm install -g ember-template-recast | ||
ember-template-recast directory/of/templates -t transform.js | ||
``` | ||
Example transform plugin: | ||
```js | ||
module.exports = function({ source, path }, { parse, visit }) { | ||
const ast = parse(source); | ||
return visit(ast, env => { | ||
let { builders: b } = env.syntax; | ||
return { | ||
MustacheStatement() { | ||
return b.mustache(b.path('wat-wat')); | ||
}, | ||
}; | ||
}); | ||
}; | ||
``` | ||
## SemVer Policy | ||
@@ -165,0 +159,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
89598
19
2
1343
188