ember-template-imports
Advanced tools
Comparing version 4.0.0 to 4.1.0
@@ -6,2 +6,27 @@ | ||
## v4.1.0 (2024-02-05) | ||
#### :rocket: Enhancement | ||
* [#230](https://github.com/ember-template-imports/ember-template-imports/pull/230) Bump content-tag and add inline_source_map option ([@vstefanovic97](https://github.com/vstefanovic97)) | ||
#### :memo: Documentation | ||
* [#231](https://github.com/ember-template-imports/ember-template-imports/pull/231) add import guide for components, helpers, modifiers ([@Parrryy](https://github.com/Parrryy)) | ||
#### :house: Internal | ||
* [#211](https://github.com/ember-template-imports/ember-template-imports/pull/211) Add failing test for v4 / content-tag not respecting imports, demonstrate fix by rolling for a new lockfile and cleaning up resulting peer errors ([@NullVoxPopuli](https://github.com/NullVoxPopuli)) | ||
* [#155](https://github.com/ember-template-imports/ember-template-imports/pull/155) Incorrectly parses some regular expressions ([@ef4](https://github.com/ef4)) | ||
* [#174](https://github.com/ember-template-imports/ember-template-imports/pull/174) add failing test for #171 ([@patricklx](https://github.com/patricklx)) | ||
* [#210](https://github.com/ember-template-imports/ember-template-imports/pull/210) Upgrade and fix lint deps ([@NullVoxPopuli](https://github.com/NullVoxPopuli)) | ||
* [#209](https://github.com/ember-template-imports/ember-template-imports/pull/209) Remove unused dependencies as well as template-lint ([@NullVoxPopuli](https://github.com/NullVoxPopuli)) | ||
* [#208](https://github.com/ember-template-imports/ember-template-imports/pull/208) upgrade test dependencies ([@NullVoxPopuli](https://github.com/NullVoxPopuli)) | ||
#### Committers: 6 | ||
- Chris Parry ([@Parrryy](https://github.com/Parrryy)) | ||
- Edward Faulkner ([@ef4](https://github.com/ef4)) | ||
- Ignace Maes ([@IgnaceMaes](https://github.com/IgnaceMaes)) | ||
- Patrick Pircher ([@patricklx](https://github.com/patricklx)) | ||
- Vuk ([@vstefanovic97](https://github.com/vstefanovic97)) | ||
- [@NullVoxPopuli](https://github.com/NullVoxPopuli) | ||
## v4.0.0 (2023-10-18) | ||
@@ -8,0 +33,0 @@ |
@@ -13,3 +13,3 @@ 'use strict'; | ||
let emberCliHtmlBars = new VersionChecker(this.project).for( | ||
'ember-cli-htmlbars' | ||
'ember-cli-htmlbars', | ||
); | ||
@@ -34,3 +34,3 @@ let emberCliBabel = new VersionChecker(this.project).for('ember-cli-babel'); | ||
throw new Error( | ||
'ember-template-imports requires' + '\n\t' + errors.join('\n\t') | ||
'ember-template-imports requires' + '\n\t' + errors.join('\n\t'), | ||
); | ||
@@ -43,5 +43,17 @@ } | ||
let TemplateImportPreprocessor = require('./src/preprocessor-plugin'); | ||
registry.add('js', new TemplateImportPreprocessor()); | ||
registry.add( | ||
'js', | ||
new TemplateImportPreprocessor(this._getAddonOptions()), | ||
); | ||
} | ||
}, | ||
_getAddonOptions() { | ||
let parentOptions = this.parent && this.parent.options; | ||
let appOptions = this.app && this.app.options; | ||
const options = parentOptions || appOptions || {}; | ||
return options['ember-template-imports'] || { inline_source_map: false }; | ||
}, | ||
}; |
{ | ||
"name": "ember-template-imports", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"description": "The default blueprint for ember-cli addons.", | ||
@@ -21,4 +21,2 @@ "keywords": [ | ||
"lint:fix": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*:fix", | ||
"lint:hbs": "ember-template-lint .", | ||
"lint:hbs:fix": "ember-template-lint . --fix", | ||
"lint:js": "eslint . --cache", | ||
@@ -33,3 +31,3 @@ "lint:js:fix": "eslint . --fix", | ||
"broccoli-stew": "^3.0.0", | ||
"content-tag": "^1.1.2", | ||
"content-tag": "^2.0.1", | ||
"ember-cli-version-checker": "^5.1.2" | ||
@@ -39,22 +37,15 @@ }, | ||
"@babel/core": "^7.22.20", | ||
"@babel/traverse": "^7.19.6", | ||
"@babel/types": "^7.19.4", | ||
"@babel/eslint-parser": "^7.22.15", | ||
"@ember/optional-features": "^2.0.0", | ||
"@ember/string": "^3.0.1", | ||
"@ember/test-helpers": "^2.2.0", | ||
"@ember/test-helpers": "^3.2.0", | ||
"@embroider/test-setup": "^3.0.2", | ||
"@glimmer/component": "^1.0.3", | ||
"@glimmer/component": "^1.1.2", | ||
"@glimmer/syntax": "0.84.3", | ||
"@glimmer/tracking": "^1.0.3", | ||
"@glimmer/tracking": "^1.1.2", | ||
"@release-it-plugins/lerna-changelog": "^6.0.0", | ||
"@types/babel__traverse": "^7.20.2", | ||
"@types/line-column": "^1.0.0", | ||
"@types/node": "^20.8.6", | ||
"@types/string.prototype.matchall": "^4.0.1", | ||
"@typescript-eslint/eslint-plugin": "^5.5.0", | ||
"@typescript-eslint/parser": "^5.5.0", | ||
"babel-eslint": "^10.1.0", | ||
"broccoli-asset-rev": "^3.0.0", | ||
"@typescript-eslint/eslint-plugin": "^6.8.0", | ||
"@typescript-eslint/parser": "^6.8.0", | ||
"ember-auto-import": "^2.6.3", | ||
"ember-cli": "~4.12.1", | ||
"ember-cli": "~4.12.2", | ||
"ember-cli-babel": "^8.2.0", | ||
@@ -66,22 +57,19 @@ "ember-cli-dependency-checker": "^3.2.0", | ||
"ember-load-initializers": "^2.1.2", | ||
"ember-maybe-import-regenerator": "^1.0.0", | ||
"ember-page-title": "^6.2.1", | ||
"ember-qunit": "^5.1.2", | ||
"ember-qunit": "^8.0.1", | ||
"ember-resolver": "^10.0.0", | ||
"ember-source": "~4.8.2", | ||
"ember-source-channel-url": "^3.0.0", | ||
"ember-template-lint": "^2.18.1", | ||
"ember-try": "^3.0.0", | ||
"eslint": "^7.20.0", | ||
"eslint-config-prettier": "^7.2.0", | ||
"eslint-plugin-ember": "^10.2.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"eslint": "^8.52.0", | ||
"eslint-config-prettier": "^9.0.0", | ||
"eslint-plugin-ember": "^11.11.1", | ||
"eslint-plugin-n": "^16.2.0", | ||
"eslint-plugin-prettier": "^5.0.1", | ||
"loader.js": "^4.7.0", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^2.2.1", | ||
"prettier": "^3.0.3", | ||
"qunit": "^2.14.0", | ||
"qunit-dom": "^2.0.0", | ||
"qunit-dom": "^3.0.0", | ||
"release-it": "^16.2.1", | ||
"typescript": "^4.5.2", | ||
"typescript": "^4.9.5", | ||
"webpack": "^5.64.4" | ||
@@ -88,0 +76,0 @@ }, |
@@ -256,2 +256,39 @@ ember-template-imports | ||
Template tag components can also be used for writing tests. In fact, this aligned syntax between app code and test code is one of the big advantages of the new authoring format. | ||
Just like in app code, the template tag has access to the outer scope. This means you can reference variables directly in your tests: | ||
```js | ||
// tests/integration/components/hello-test.gjs | ||
import Hello from 'example-app/components/hello'; | ||
import { module, test } from 'qunit'; | ||
import { setupRenderingTest } from 'ember-qunit'; | ||
import { render } from '@ember/test-helpers'; | ||
module('Integration | Component | hello', function (hooks) { | ||
setupRenderingTest(hooks); | ||
test('renders name argument', async function (assert) { | ||
const name = 'world'; | ||
await render(<template><Hello @name={{name}} /></template>); | ||
assert.dom('[data-test-id="some-selector"]').hasText(name); | ||
}); | ||
}); | ||
``` | ||
## Sourcemap Generation | ||
This can be useful for development and test purposes, it should be disabled for production | ||
```js | ||
// ember-cli-build.js | ||
module.exports = function (defaults) { | ||
let app = new EmberAddon(defaults, { | ||
'ember-template-imports': { | ||
inline_source_map: true | ||
} | ||
}); | ||
``` | ||
## Reference: built-in helpers, modifiers, components | ||
@@ -274,3 +311,28 @@ | ||
## Reference: import external helpers, modifiers, components | ||
You can import non `.gjs/.gts` helpers, modifiers and components from apps/addons | ||
you may already be using when migrating your own components. To determine | ||
the import path: | ||
1. Check the app | ||
1. If found, import that | ||
2. If not found, | ||
1. Check all addon's app folders | ||
1. When found, look in the matching file to see what the re-export is -- this is what you can use in your app | ||
2. Check all v2-addon's ember-addon#app-js configs in package.json | ||
1. When found, look in the matching file to see what the re-export is -- this is what you can use in | ||
For example: | ||
```js | ||
import BasicDropdown from 'ember-basic-dropdown/components/basic-dropdown'; | ||
<template> | ||
<BasicDropdown> | ||
<!-- Your component implementation here --> | ||
</BasicDropdown> | ||
</template> | ||
``` | ||
## History | ||
@@ -277,0 +339,0 @@ |
@@ -7,5 +7,7 @@ const stew = require('broccoli-stew'); | ||
#processor; | ||
#inline_source_map; | ||
constructor() { | ||
constructor({ inline_source_map = false }) { | ||
this.name = 'template-imports-preprocessor'; | ||
this.#inline_source_map = inline_source_map; | ||
this.#processor = new Preprocessor(); | ||
@@ -16,3 +18,6 @@ } | ||
let compiled = stew.map(tree, `**/*.{gjs,gts}`, (string, relativePath) => { | ||
let transformed = this.#processor.process(string, relativePath); | ||
let transformed = this.#processor.process(string, { | ||
filename: relativePath, | ||
inline_source_map: this.#inline_source_map, | ||
}); | ||
@@ -19,0 +24,0 @@ return transformed; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
38
373
0
1
37300
13
91
+ Addedcontent-tag@2.0.3(transitive)
- Removedcontent-tag@1.2.2(transitive)
Updatedcontent-tag@^2.0.1