ember-cli-htmlbars
Advanced tools
Comparing version 4.3.1 to 5.0.0
@@ -0,1 +1,23 @@ | ||
## v5.0.0 (2020-05-04) | ||
#### :boom: Breaking Change | ||
* [#496](https://github.com/ember-cli/ember-cli-htmlbars/pull/496) Drop support for Ember < 3.8. ([@rwjblue](https://github.com/rwjblue)) | ||
* [#493](https://github.com/ember-cli/ember-cli-htmlbars/pull/493) Drop Node 8 support. ([@rwjblue](https://github.com/rwjblue)) | ||
* [#492](https://github.com/ember-cli/ember-cli-htmlbars/pull/492) Remove Bower support. ([@rwjblue](https://github.com/rwjblue)) | ||
#### :rocket: Enhancement | ||
* [#528](https://github.com/ember-cli/ember-cli-htmlbars/pull/528) Use smaller cache key for `ember-template-compiler` (reduce overall memory overhead of caching) ([@xg-wang](https://github.com/xg-wang)) | ||
* [#512](https://github.com/ember-cli/ember-cli-htmlbars/pull/512) Update Broccoli dependencies to latest. ([@rwjblue](https://github.com/rwjblue)) | ||
#### :house: Internal | ||
* [#514](https://github.com/ember-cli/ember-cli-htmlbars/pull/514) Update fixturify and qunit-dom to latest. ([@rwjblue](https://github.com/rwjblue)) | ||
* [#513](https://github.com/ember-cli/ember-cli-htmlbars/pull/513) Update semver to 7.1.2. ([@rwjblue](https://github.com/rwjblue)) | ||
* [#508](https://github.com/ember-cli/ember-cli-htmlbars/pull/508) Update to prettier@2. ([@rwjblue](https://github.com/rwjblue)) | ||
* [#507](https://github.com/ember-cli/ember-cli-htmlbars/pull/507) Update Babel related devDependencies. ([@rwjblue](https://github.com/rwjblue)) | ||
#### Committers: 2 | ||
- Robert Jackson ([@rwjblue](https://github.com/rwjblue)) | ||
- Thomas Wang ([@xg-wang](https://github.com/xg-wang)) | ||
## v4.3.1 (2020-04-09) | ||
@@ -2,0 +24,0 @@ |
@@ -18,3 +18,3 @@ function addDependencyTracker(plugin, enableInvalidation) { | ||
let lastDependencies = {}; | ||
let trackedPlugin = env => { | ||
let trackedPlugin = (env) => { | ||
let templateStackDepth = 0; | ||
@@ -42,3 +42,3 @@ let realPlugin = plugin(env); | ||
keys: origKeys, | ||
enter: node => { | ||
enter: (node) => { | ||
templateStackDepth++; | ||
@@ -53,3 +53,3 @@ if (templateStackDepth === 1) { | ||
}, | ||
exit: node => { | ||
exit: (node) => { | ||
if (templateStackDepth === 1) { | ||
@@ -66,3 +66,3 @@ if (realPlugin.dependencies) { | ||
}; | ||
trackedPlugin.getDependencies = relativePath => { | ||
trackedPlugin.getDependencies = (relativePath) => { | ||
return lastDependencies[relativePath] || []; | ||
@@ -69,0 +69,0 @@ }; |
// For ease of debuggin / tweaking: | ||
// https://astexplorer.net/#/gist/bcca584efdab6c981a75618642c76a22/1e1d262eaeb47b7da66150e0781a02b96e597b25 | ||
module.exports = function(babel) { | ||
module.exports = function (babel) { | ||
let t = babel.types; | ||
@@ -71,3 +71,5 @@ | ||
let defaultSpecifier = path.node.specifiers.find(spec => spec.exported.name === 'default'); | ||
let defaultSpecifier = path.node.specifiers.find( | ||
(spec) => spec.exported.name === 'default' | ||
); | ||
if (defaultSpecifier) { | ||
@@ -74,0 +76,0 @@ state.setComponentTemplateInjected = true; |
@@ -35,7 +35,7 @@ 'use strict'; | ||
inputHasFile(relativePath) { | ||
return !!this.currentEntries().find(e => e.relativePath === relativePath); | ||
return !!this.currentEntries().find((e) => e.relativePath === relativePath); | ||
} | ||
detectRootName() { | ||
let entries = this.currentEntries().filter(e => !e.isDirectory()); | ||
let entries = this.currentEntries().filter((e) => !e.isDirectory()); | ||
@@ -52,3 +52,3 @@ let [first] = entries; | ||
if (!entries.every(e => e.relativePath.startsWith(root))) { | ||
if (!entries.every((e) => e.relativePath.startsWith(root))) { | ||
root = null; | ||
@@ -208,3 +208,3 @@ } | ||
)}\n\tKnown files:\n${JSON.stringify( | ||
this.currentEntries().map(e => e.relativePath), | ||
this.currentEntries().map((e) => e.relativePath), | ||
null, | ||
@@ -211,0 +211,0 @@ 2 |
'use strict'; | ||
const path = require('path'); | ||
const SilentError = require('silent-error'); | ||
const utils = require('./utils'); | ||
@@ -28,7 +28,7 @@ | ||
let babel = this.parent.addons.find(a => a.name === 'ember-cli-babel'); | ||
let babel = this.parent.addons.find((a) => a.name === 'ember-cli-babel'); | ||
let hasBabel = babel !== undefined; | ||
let babelVersion = hasBabel && babel.pkg.version; | ||
let ember = this.project.addons.find(a => a.name === 'ember-source'); | ||
let ember = this.project.addons.find((a) => a.name === 'ember-source'); | ||
let hasEmberSource = ember !== undefined; | ||
@@ -104,3 +104,3 @@ let emberVersion = hasEmberSource && ember.pkg.version; | ||
let legacyInlinePrecompileAddon = this.parent.addons.find( | ||
a => a.name === 'ember-cli-htmlbars-inline-precompile' | ||
(a) => a.name === 'ember-cli-htmlbars-inline-precompile' | ||
); | ||
@@ -138,3 +138,3 @@ if (legacyInlinePrecompileAddon !== undefined) { | ||
// import hbs from 'ember-cli-htmlbars-inline-precompile'; | ||
legacyInlinePrecompileAddon.included = function() {}; | ||
legacyInlinePrecompileAddon.included = function () {}; | ||
} | ||
@@ -197,16 +197,14 @@ }, | ||
let ember = this.project.findAddonByName('ember-source'); | ||
if (ember) { | ||
return ember.absolutePaths.templateCompiler; | ||
} else if (!templateCompilerPath) { | ||
templateCompilerPath = this.project.bowerDirectory + '/ember/ember-template-compiler'; | ||
if (templateCompilerPath) { | ||
return templateCompilerPath; | ||
} | ||
let absolutePath = path.resolve(this.project.root, templateCompilerPath); | ||
if (path.extname(absolutePath) === '') { | ||
absolutePath += '.js'; | ||
let ember = this.project.findAddonByName('ember-source'); | ||
if (!ember) { | ||
throw new SilentError( | ||
`ember-cli-htmlbars: Cannot find the ember-source addon as part of the project, please ensure that 'ember-source' is in your projects dependencies or devDependencies` | ||
); | ||
} | ||
return absolutePath; | ||
return ember.absolutePaths.templateCompiler; | ||
}, | ||
@@ -213,0 +211,0 @@ |
'use strict'; | ||
const crypto = require('crypto'); | ||
const fs = require('fs'); | ||
@@ -17,3 +18,3 @@ const path = require('path'); | ||
function isInlinePrecompileBabelPluginRegistered(plugins) { | ||
return plugins.some(plugin => { | ||
return plugins.some((plugin) => { | ||
if (Array.isArray(plugin)) { | ||
@@ -46,3 +47,3 @@ let [pluginPathOrInstance, options] = plugin; | ||
return plugins.some( | ||
plugin => typeof plugin === 'string' && plugin === require.resolve('./colocated-babel-plugin') | ||
(plugin) => typeof plugin === 'string' && plugin === require.resolve('./colocated-babel-plugin') | ||
); | ||
@@ -161,3 +162,3 @@ } | ||
props.forEach(prop => { | ||
props.forEach((prop) => { | ||
templateCompiler._Ember.FEATURES[prop] = EmberENV.FEATURES[prop]; | ||
@@ -170,3 +171,3 @@ }); | ||
props.forEach(prop => { | ||
props.forEach((prop) => { | ||
if (prop === 'FEATURES') { | ||
@@ -214,3 +215,6 @@ return; | ||
let templateCompilerFullPath = require.resolve(templateCompilerPath); | ||
let templateCompilerCacheKey = fs.readFileSync(templateCompilerFullPath, { encoding: 'utf-8' }); | ||
let templateCompilerCacheKey = crypto | ||
.createHash('md5') | ||
.update(fs.readFileSync(templateCompilerFullPath, { encoding: 'utf-8' })) | ||
.digest('hex'); | ||
let cacheItems = [templateCompilerCacheKey, extra].concat(pluginInfo.cacheKeys.sort()); | ||
@@ -217,0 +221,0 @@ // extra may be undefined |
{ | ||
"name": "ember-cli-htmlbars", | ||
"version": "4.3.1", | ||
"version": "5.0.0", | ||
"description": "A library for adding htmlbars to ember CLI", | ||
@@ -19,7 +19,7 @@ "keywords": [ | ||
"author": "Jonathan Jackson & Chase McCarthy", | ||
"main": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"files": [ | ||
"lib/" | ||
], | ||
"main": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"scripts": { | ||
@@ -40,3 +40,3 @@ "build": "ember build", | ||
"broccoli-persistent-filter": "^2.3.1", | ||
"broccoli-plugin": "^3.1.0", | ||
"broccoli-plugin": "^4.0.3", | ||
"common-tags": "^1.8.0", | ||
@@ -48,27 +48,28 @@ "ember-cli-babel-plugin-helpers": "^1.1.0", | ||
"json-stable-stringify": "^1.0.1", | ||
"semver": "^6.3.0", | ||
"semver": "^7.3.2", | ||
"silent-error": "^1.1.1", | ||
"strip-bom": "^4.0.0", | ||
"walk-sync": "^2.0.2" | ||
"walk-sync": "^2.1.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.9.0", | ||
"@babel/core": "^7.9.6", | ||
"@babel/plugin-proposal-class-properties": "^7.8.3", | ||
"@babel/plugin-proposal-decorators": "^7.8.3", | ||
"@babel/plugin-transform-runtime": "^7.8.3", | ||
"@babel/plugin-transform-typescript": "^7.8.3", | ||
"@babel/runtime": "^7.8.4", | ||
"@babel/plugin-transform-runtime": "^7.9.6", | ||
"@babel/plugin-transform-typescript": "^7.9.6", | ||
"@babel/runtime": "^7.9.6", | ||
"@ember/optional-features": "^1.3.0", | ||
"babel-eslint": "^10.1.0", | ||
"babel-plugin-debug-macros": "^0.3.3", | ||
"broccoli-merge-trees": "^3.0.2", | ||
"broccoli-merge-trees": "^4.2.0", | ||
"broccoli-test-helper": "^2.0.0", | ||
"chai": "^4.2.0", | ||
"co": "^4.6.0", | ||
"ember-cli": "~3.15.2", | ||
"ember-cli": "~3.16.1", | ||
"ember-cli-app-version": "^3.2.0", | ||
"ember-cli-babel": "^7.18.0", | ||
"ember-cli-babel": "^7.19.0", | ||
"ember-cli-dependency-checker": "^3.2.0", | ||
"ember-cli-inject-live-reload": "^2.0.2", | ||
"ember-cli-template-lint": "^1.0.0", | ||
"ember-cli-version-checker": "^3.1.3", | ||
"ember-cli-version-checker": "^5.0.2", | ||
"ember-export-application-global": "^2.0.1", | ||
@@ -78,23 +79,23 @@ "ember-load-initializers": "^2.1.1", | ||
"ember-qunit": "^4.6.0", | ||
"ember-resolver": "^7.0.0", | ||
"ember-source": "~3.15.0", | ||
"ember-resolver": "^8.0.0", | ||
"ember-source": "~3.18.0", | ||
"ember-source-channel-url": "^2.0.1", | ||
"ember-try": "^1.4.0", | ||
"eslint": "^6.8.0", | ||
"eslint-config-prettier": "^6.10.0", | ||
"eslint-plugin-ember": "^7.10.1", | ||
"eslint-plugin-mocha": "^6.2.2", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-ember": "^8.4.0", | ||
"eslint-plugin-mocha": "^6.3.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-prettier": "^3.1.2", | ||
"fixturify": "^1.2.0", | ||
"eslint-plugin-prettier": "^3.1.3", | ||
"fixturify": "^2.1.0", | ||
"loader.js": "^4.7.0", | ||
"mocha": "^7.1.1", | ||
"mocha": "^7.1.2", | ||
"module-name-inliner": "link:./tests/dummy/lib/module-name-inliner", | ||
"prettier": "^1.19.1", | ||
"qunit-dom": "^0.9.2", | ||
"release-it": "^12.4.3", | ||
"release-it-lerna-changelog": "^1.0.3" | ||
"prettier": "^2.0.5", | ||
"qunit-dom": "^1.2.0", | ||
"release-it": "^13.5.8", | ||
"release-it-lerna-changelog": "^2.3.0" | ||
}, | ||
"engines": { | ||
"node": "8.* || 10.* || >= 12.*" | ||
"node": "10.* || >= 12.*" | ||
}, | ||
@@ -111,3 +112,4 @@ "publishConfig": { | ||
"release-it-lerna-changelog": { | ||
"infile": "CHANGELOG.md" | ||
"infile": "CHANGELOG.md", | ||
"launchEditor": true | ||
} | ||
@@ -119,5 +121,6 @@ }, | ||
"github": { | ||
"release": true | ||
"release": true, | ||
"tokenRef": "GITHUB_AUTH" | ||
} | ||
} | ||
} |
@@ -5,4 +5,10 @@ # Ember CLI HTMLBars | ||
### Registering a Plugin | ||
## Compatibility | ||
* Ember.js v3.8 or above | ||
* Ember CLI v3.8 or above | ||
* Node.js v10 or above | ||
## Registering a Plugin | ||
```javascript | ||
@@ -26,3 +32,3 @@ var SomeTransform = require('./some-path/transform'); | ||
#### Options for registering a `htmlbars-ast-plugin` | ||
### Options for registering a `htmlbars-ast-plugin` | ||
@@ -35,3 +41,3 @@ * `name` - String. The name of the AST transform for debugging purposes. | ||
#### Implementing Dependency Invalidation in an AST Plugin | ||
### Implementing Dependency Invalidation in an AST Plugin | ||
@@ -77,3 +83,3 @@ Plugins that set the `dependencyInvalidation` option to `true` can provide function for the `plugin` of type `ASTDependencyPlugin` as given below. | ||
### Precompile HTMLBars template strings within other addons | ||
## Precompile HTMLBars template strings within other addons | ||
@@ -100,3 +106,3 @@ ```javascript | ||
### Tagged Template Usage / Migrating from `htmlbars-inline-precompile` | ||
## Tagged Template Usage / Migrating from `htmlbars-inline-precompile` | ||
@@ -133,9 +139,21 @@ Starting with version 4.0, this addon now includes the testing helper from [ember-cli-htmlbars-inline-precompile](https://github.com/ember-cli/ember-cli-htmlbars-inline-precompile) | ||
### Handlebars 2.0 Support (Ember < 1.10) | ||
### Custom Template Compiler | ||
Handlebars 2.0 support has been removed. If you are using ember-cli-htmlbars with a 1.9.x project please continue | ||
to use ember-cli-htmlbars@0.6.x. | ||
You can still provide a custom path to the template compiler (e.g. to test | ||
custom template compiler tweaks in an application) by: | ||
### Using as a Broccoli Plugin | ||
```js | ||
// ember-cli-build.js | ||
module.exports = function(defaults) { | ||
let app = new EmberApp(defaults, { | ||
'ember-cli-htmlbars': { | ||
templateCompilerPath: `some_path/to/ember-template-compiler.js`, | ||
} | ||
}); | ||
}; | ||
``` | ||
## Using as a Broccoli Plugin | ||
```javascript | ||
@@ -142,0 +160,0 @@ var HtmlbarsCompiler = require('ember-cli-htmlbars'); |
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
56206
945
163
15
+ Addedsilent-error@^1.1.1
+ Addedbroccoli-output-wrapper@3.2.5(transitive)
+ Addedbroccoli-plugin@4.0.7(transitive)
+ Addedpromise-map-series@0.3.0(transitive)
+ Addedrimraf@3.0.2(transitive)
+ Addedsemver@7.6.3(transitive)
+ Addedsilent-error@1.1.1(transitive)
- Removedbroccoli-output-wrapper@2.0.0(transitive)
- Removedbroccoli-plugin@3.1.0(transitive)
- Removedsemver@6.3.1(transitive)
Updatedbroccoli-plugin@^4.0.3
Updatedsemver@^7.3.2
Updatedwalk-sync@^2.1.0