2 |
3 | {{outlet}}
--------------------------------------------------------------------------------
/.template-lintrc.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports = {
4 | extends: 'recommended'
5 | };
6 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports = {
4 | name: require('./package').name
5 | };
6 |
--------------------------------------------------------------------------------
/tests/dummy/app/routes/index.js:
--------------------------------------------------------------------------------
1 | import Route from '@ember/routing/route';
2 |
3 | export default Route.extend({});
4 |
--------------------------------------------------------------------------------
/config/environment.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports = function(/* environment, appConfig */) {
4 | return { };
5 | };
6 |
--------------------------------------------------------------------------------
/tests/dummy/config/optional-features.json:
--------------------------------------------------------------------------------
1 | {
2 | "application-template-wrapper": false,
3 | "default-async-observers": true,
4 | "jquery-integration": false,
5 | "template-only-glimmer-components": true
6 | }
7 |
--------------------------------------------------------------------------------
/tests/test-helper.js:
--------------------------------------------------------------------------------
1 | import Application from '../app';
2 | import config from '../config/environment';
3 | import { setApplication } from '@ember/test-helpers';
4 | import { start } from 'ember-qunit';
5 |
6 | setApplication(Application.create(config.APP));
7 |
8 | start();
9 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | /bower_components
2 | /config/ember-try.js
3 | /dist
4 | /tests
5 | /tmp
6 | **/.gitkeep
7 | .bowerrc
8 | .editorconfig
9 | .ember-cli
10 | .gitignore
11 | .eslintrc.js
12 | .watchmanconfig
13 | .travis.yml
14 | bower.json
15 | ember-cli-build.js
16 | testem.js
17 |
--------------------------------------------------------------------------------
/tests/dummy/app/router.js:
--------------------------------------------------------------------------------
1 | import EmberRouter from '@ember/routing/router';
2 | import config from './config/environment';
3 |
4 | export default class Router extends EmberRouter {
5 | location = config.locationType;
6 | rootURL = config.rootURL;
7 | }
8 |
9 | Router.map(function() {
10 | });
11 |
--------------------------------------------------------------------------------
/.ember-cli:
--------------------------------------------------------------------------------
1 | {
2 | /**
3 | Ember CLI sends analytics information by default. The data is completely
4 | anonymous, but there are times when you might want to disable this behavior.
5 |
6 | Setting `disableAnalytics` to true will prevent any data from being sent.
7 | */
8 | "disableAnalytics": false
9 | }
10 |
--------------------------------------------------------------------------------
/tests/dummy/app/controllers/index.js:
--------------------------------------------------------------------------------
1 | export default class Index {
2 | static create(attrs) {
3 | return new this(attrs);
4 | }
5 |
6 | setProperties(properties) {
7 | Object.assign(this, properties);
8 | }
9 |
10 | static proto() {
11 | return {
12 | queryParams: []
13 | };
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/tests/dummy/config/targets.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const browsers = [
4 | 'last 1 Chrome versions',
5 | 'last 1 Firefox versions',
6 | 'last 1 Safari versions'
7 | ];
8 |
9 | const isCI = !!process.env.CI;
10 | const isProduction = process.env.EMBER_ENV === 'production';
11 |
12 | if (isCI || isProduction) {
13 | browsers.push('ie 11');
14 | }
15 |
16 | module.exports = {
17 | browsers
18 | };
19 |
--------------------------------------------------------------------------------
/tests/dummy/app/app.js:
--------------------------------------------------------------------------------
1 | import Application from '@ember/application';
2 | import Resolver from 'ember-strict-resolver';
3 | import loadInitializers from 'ember-load-initializers';
4 | import config from './config/environment';
5 |
6 | export default class App extends Application {
7 | modulePrefix = config.modulePrefix;
8 | podModulePrefix = config.podModulePrefix;
9 | Resolver = Resolver;
10 | }
11 |
12 | loadInitializers(App, config.modulePrefix);
13 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # EditorConfig helps developers define and maintain consistent
2 | # coding styles between different editors and IDEs
3 | # editorconfig.org
4 |
5 | root = true
6 |
7 |
8 | [*]
9 | end_of_line = lf
10 | charset = utf-8
11 | trim_trailing_whitespace = true
12 | insert_final_newline = true
13 | indent_style = space
14 | indent_size = 2
15 |
16 | [*.hbs]
17 | insert_final_newline = false
18 |
19 | [*.{diff,md}]
20 | trim_trailing_whitespace = false
21 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # compiled output
4 | /dist/
5 | /tmp/
6 |
7 | # dependencies
8 | /bower_components/
9 | /node_modules/
10 |
11 | # misc
12 | /.env*
13 | /.pnp*
14 | /.sass-cache
15 | /connect.lock
16 | /coverage/
17 | /libpeerconnection.log
18 | /npm-debug.log*
19 | /testem.log
20 | /yarn-error.log
21 |
22 | # ember-try
23 | /.node_modules.ember-try/
24 | /bower.json.ember-try
25 | /package.json.ember-try
26 |
--------------------------------------------------------------------------------
/ember-cli-build.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');
4 |
5 | module.exports = function(defaults) {
6 | let app = new EmberAddon(defaults, {
7 | // Add options here
8 | });
9 |
10 | /*
11 | This build file specifies the options for the dummy test app of this
12 | addon, located in `/tests/dummy`
13 | This build file does *not* influence how the addon or the app using it
14 | behave. You most likely want to be modifying `./index.js` or app's build file
15 | */
16 |
17 | return app.toTree();
18 | };
19 |
--------------------------------------------------------------------------------
/tests/dummy/public/crossdomain.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
15 |
16 |
--------------------------------------------------------------------------------
/testem.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports = {
4 | test_page: 'tests/index.html?hidepassed',
5 | disable_watching: true,
6 | launch_in_ci: [
7 | 'Chrome'
8 | ],
9 | launch_in_dev: [
10 | 'Chrome'
11 | ],
12 | browser_start_timeout: 120,
13 | browser_args: {
14 | Chrome: {
15 | ci: [
16 | // --no-sandbox is needed when running Chrome inside a container
17 | process.env.CI ? '--no-sandbox' : null,
18 | '--headless',
19 | '--disable-dev-shm-usage',
20 | '--disable-software-rasterizer',
21 | '--mute-audio',
22 | '--remote-debugging-port=0',
23 | '--window-size=1440,900'
24 | ].filter(Boolean)
25 | }
26 | }
27 | };
28 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # How To Contribute
2 |
3 | ## Installation
4 |
5 | * `git clone `
6 | * `cd ember-strict-resolver`
7 | * `npm install`
8 |
9 | ## Linting
10 |
11 | * `npm run lint:hbs`
12 | * `npm run lint:js`
13 | * `npm run lint:js -- --fix`
14 |
15 | ## Running tests
16 |
17 | * `ember test` – Runs the test suite on the current Ember version
18 | * `ember test --server` – Runs the test suite in "watch mode"
19 | * `ember try:each` – Runs the test suite against multiple Ember versions
20 |
21 | ## Running the dummy application
22 |
23 | * `ember serve`
24 | * Visit the dummy application at [http://localhost:4200](http://localhost:4200).
25 |
26 | For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).
27 |
--------------------------------------------------------------------------------
/tests/dummy/app/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Dummy
7 |
8 |
9 |
10 | {{content-for "head"}}
11 |
12 |
13 |
14 |
15 | {{content-for "head-footer"}}
16 |
17 |
18 | {{content-for "body"}}
19 |
20 |
21 |
22 |
23 | {{content-for "body-footer"}}
24 |
25 |
26 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 |
2 | ---
3 | language: node_js
4 | node_js:
5 | - "10"
6 |
7 | sudo: false
8 |
9 | cache:
10 | yarn: true
11 |
12 | env:
13 | EMBER_TRY_SCENARIO=ember-lts-3.12
14 | EMBER_TRY_SCENARIO=ember-lts-3.16
15 | EMBER_TRY_SCENARIO=ember-release
16 | EMBER_TRY_SCENARIO=ember-beta
17 | EMBER_TRY_SCENARIO=ember-canary
18 | EMBER_TRY_SCENARIO=ember-default-with-jquery
19 | EMBER_TRY_SCENARIO=ember-classic
20 |
21 | matrix:
22 | fast_finish: true
23 | allow_failures:
24 | - env: EMBER_TRY_SCENARIO=ember-canary
25 |
26 | before_install:
27 | - curl -o- -L https://yarnpkg.com/install.sh | bash
28 | - export PATH=$HOME/.yarn/bin:$PATH
29 | - yarn global add phantomjs-prebuilt
30 | - phantomjs --version
31 |
32 | install:
33 | - yarn install --no-lockfile
34 |
35 | script:
36 | # Usually, it's ok to finish the test scenario without reverting
37 | # to the addon's original dependency state, skipping "cleanup".
38 | - node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO test --skip-cleanup
39 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2020
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 |
7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 |
9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10 |
--------------------------------------------------------------------------------
/tests/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Dummy Tests
7 |
8 |
9 |
10 | {{content-for "head"}}
11 | {{content-for "test-head"}}
12 |
13 |
14 |
15 |
16 |
17 | {{content-for "head-footer"}}
18 | {{content-for "test-head-footer"}}
19 |
20 |
21 | {{content-for "body"}}
22 | {{content-for "test-body"}}
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | {{content-for "body-footer"}}
31 | {{content-for "test-body-footer"}}
32 |
33 |
34 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # 1.3.0 (10/09/2020)
2 |
3 | - [dependencies] bumps `ember-cli-htmlbars@4.2.3` -> `ember-cli-htmlbars@5.3.1`
4 |
5 | # 1.2.1 (08/24/2020)
6 |
7 | - [bug] resolver.moduleBasedResolver must be set for the ember router to enable loading substates, so set that property in the constructor.
8 |
9 | # 1.2.0 (05/25/2020)
10 |
11 | - [enhancement] bring down upstream, `ember-resolver`, parsing logic, ensures that we don't assert against types that are not required to be dasherized and also put that behind a debug flag
12 | - [bug] ensure that require key exists before trying to retrieve from the require registry
13 |
14 | # 1.1.1 (05/21/2020)
15 |
16 | - Ensure internal `layoutFor` lookups for namespaced templates works
17 |
18 | # 1.1.0 (04/07/2020)
19 |
20 | - Fix uses of resolveRegistration('config:environment'). This works in the ember-resolver/classic as there is a hard coded rule that says to not pluralize config. This adds a similar rule but in the form of a strict requirement rather than a part of a pluralize strategy like ember-resolver/classic.
21 |
22 | # 1.0.0 (03/30/2020)
23 |
24 | - bumps all dependencies to support ember>=3.12
25 |
26 | # 0.2.1 (03/27/2020)
27 |
28 | - Removes monkey patch for registry caching and make it an opt via readme instructions
29 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports = {
4 | root: true,
5 | parser: 'babel-eslint',
6 | parserOptions: {
7 | ecmaVersion: 2018,
8 | sourceType: 'module',
9 | ecmaFeatures: {
10 | legacyDecorators: true
11 | }
12 | },
13 | plugins: [
14 | 'ember'
15 | ],
16 | extends: [
17 | 'eslint:recommended',
18 | 'plugin:ember/recommended'
19 | ],
20 | env: {
21 | browser: true
22 | },
23 | rules: {
24 | 'ember/no-jquery': 'error'
25 | },
26 | overrides: [
27 | // node files
28 | {
29 | files: [
30 | '.eslintrc.js',
31 | '.template-lintrc.js',
32 | 'ember-cli-build.js',
33 | 'index.js',
34 | 'testem.js',
35 | 'blueprints/*/index.js',
36 | 'config/**/*.js',
37 | 'tests/dummy/config/**/*.js'
38 | ],
39 | excludedFiles: [
40 | 'addon/**',
41 | 'addon-test-support/**',
42 | 'app/**',
43 | 'tests/dummy/app/**'
44 | ],
45 | parserOptions: {
46 | sourceType: 'script'
47 | },
48 | env: {
49 | browser: false,
50 | node: true
51 | },
52 | plugins: ['node'],
53 | rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, {
54 | // add your custom rules and overrides for node files here
55 | })
56 | }
57 | ]
58 | };
59 |
--------------------------------------------------------------------------------
/tests/dummy/config/environment.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports = function(environment) {
4 | let ENV = {
5 | modulePrefix: 'dummy',
6 | environment,
7 | rootURL: '/',
8 | locationType: 'auto',
9 | EmberENV: {
10 | FEATURES: {
11 | // Here you can enable experimental features on an ember canary build
12 | // e.g. EMBER_NATIVE_DECORATOR_SUPPORT: true
13 | },
14 | EXTEND_PROTOTYPES: {
15 | // Prevent Ember Data from overriding Date.parse.
16 | Date: false
17 | }
18 | },
19 |
20 | APP: {
21 | // Here you can pass flags/options to your application instance
22 | // when it is created
23 | }
24 | };
25 |
26 | if (environment === 'development') {
27 | // ENV.APP.LOG_RESOLVER = true;
28 | // ENV.APP.LOG_ACTIVE_GENERATION = true;
29 | // ENV.APP.LOG_TRANSITIONS = true;
30 | // ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
31 | // ENV.APP.LOG_VIEW_LOOKUPS = true;
32 | }
33 |
34 | if (environment === 'test') {
35 | // Testem prefers this...
36 | ENV.locationType = 'none';
37 |
38 | // keep test console output quieter
39 | ENV.APP.LOG_ACTIVE_GENERATION = false;
40 | ENV.APP.LOG_VIEW_LOOKUPS = false;
41 |
42 | ENV.APP.rootElement = '#ember-testing';
43 | ENV.APP.autoboot = false;
44 | }
45 |
46 | if (environment === 'production') {
47 | // here you can enable a production-specific feature
48 | }
49 |
50 | return ENV;
51 | };
52 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ember-strict-resolver",
3 | "version": "1.3.0",
4 | "description": "A fast concise resolver for ember",
5 | "keywords": [
6 | "ember-addon"
7 | ],
8 | "license": "MIT",
9 | "author": "Stefan Penner = 12"
64 | },
65 | "ember": {
66 | "edition": "octane"
67 | },
68 | "ember-addon": {
69 | "configPath": "tests/dummy/config"
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/config/ember-try.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const getChannelURL = require('ember-source-channel-url');
4 |
5 | module.exports = async function() {
6 | return {
7 | useYarn: true,
8 | scenarios: [
9 | {
10 | name: 'ember-lts-3.12',
11 | npm: {
12 | devDependencies: {
13 | 'ember-source': '~3.12.0'
14 | }
15 | }
16 | },
17 | {
18 | name: 'ember-lts-3.16',
19 | npm: {
20 | devDependencies: {
21 | 'ember-source': '~3.16.0'
22 | }
23 | }
24 | },
25 | {
26 | name: 'ember-release',
27 | npm: {
28 | devDependencies: {
29 | 'ember-source': await getChannelURL('release')
30 | }
31 | }
32 | },
33 | {
34 | name: 'ember-beta',
35 | npm: {
36 | devDependencies: {
37 | 'ember-source': await getChannelURL('beta')
38 | }
39 | }
40 | },
41 | {
42 | name: 'ember-canary',
43 | npm: {
44 | devDependencies: {
45 | 'ember-source': await getChannelURL('canary')
46 | }
47 | }
48 | },
49 | // The default `.travis.yml` runs this scenario via `npm test`,
50 | // not via `ember try`. It's still included here so that running
51 | // `ember try:each` manually or from a customized CI config will run it
52 | // along with all the other scenarios.
53 | {
54 | name: 'ember-default',
55 | npm: {
56 | devDependencies: {}
57 | }
58 | },
59 | {
60 | name: 'ember-default-with-jquery',
61 | env: {
62 | EMBER_OPTIONAL_FEATURES: JSON.stringify({
63 | 'jquery-integration': true
64 | })
65 | },
66 | npm: {
67 | devDependencies: {
68 | '@ember/jquery': '^0.5.1'
69 | }
70 | }
71 | },
72 | {
73 | name: 'ember-classic',
74 | env: {
75 | EMBER_OPTIONAL_FEATURES: JSON.stringify({
76 | 'application-template-wrapper': true,
77 | 'default-async-observers': false,
78 | 'template-only-glimmer-components': false
79 | })
80 | },
81 | npm: {
82 | ember: {
83 | edition: 'classic'
84 | }
85 | }
86 | }
87 | ]
88 | };
89 | };
90 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ember-strict-resolver
2 |
3 | [](https://travis-ci.org/stefanpenner/ember-strict-resolver)
4 |
5 | Fast, concise, zero fun resolver for ember apps.
6 |
7 | ## installation
8 | ```
9 | ember install ember-strict-resolver
10 | ```
11 |
12 | ## Usage
13 |
14 | in app/resolver.js
15 | ```js
16 | export { default } from 'ember-strict-resolver';
17 | ```
18 |
19 | _For additional improvements when fully using the ember-strict-resolver monkey patching the registry to no longer cache and simply returning the values passed like the following can be produce extra performance._
20 |
21 | ```js
22 | // disable the normalization cache as we no longer normalize, the cache has become a bottle neck.
23 | Ember.Registry.prototype.normalize = function (i) { return i; }
24 | ```
25 |
26 | ## Migration
27 |
28 | Migrating away from use the _ember-resolver/classic_ can be done in piecemeal by supporting a sub-set of the old resolution formats.
29 |
30 | > normalize is needed, because without it you will get errors related to failing to be able to inject services that were never normalized in the registry.
31 |
32 | ```js
33 | // app/resolver.js
34 |
35 | import Resolver from 'ember-strict-resolver';
36 |
37 | export default class extends Resolver {
38 | legacyMappings = {
39 | 'service:camelCaseNotSupported': 'service:camel-case-not-supported'
40 | };
41 |
42 | resolve(_fullName) {
43 | return super.resolve(this.legacyMappings[_fullName] || _fullName);
44 | }
45 |
46 | normalize(_fullName) {
47 | return this.legacyMappings[_fullName] || _fullName;
48 | }
49 | }
50 | ```
51 |
52 | This will allow you file PRs with libraries that currently do not support the strict resolver in its entirety.
53 |
54 | In the event that you have a component that is failing to resolve correctly with the error `Attempted to lookup "helper:nameOfVariable". Use "helper:name-of-variable" instead.` please convert your template to use explicit-this. The template lint can be enabled by turning on [no-implicit-this](https://github.com/ember-template-lint/ember-template-lint/blob/master/docs/rule/no-implicit-this.md).
55 |
56 | An example of what this looks like is the following
57 |
58 | ```hbs
59 | // addon/components/templates/foo.hbs
60 |
61 |
62 | {{fullName}}
63 |
64 | ```
65 |
66 | This will result in the error, `Attempted to lookup "helper:fullName". Use "helper:full-name" instead.`. The fix for this would be to decide if this is a argument being passed into foo or if this is a local property.
67 |
68 | _fullName_ is coming from an invocation of _Foo_ like the following:
69 |
70 | ```
71 |
74 | ```
75 |
76 | Then the fix for your template would be:
77 |
78 | ```hbs
79 | // addon/components/templates/foo.hbs
80 |
81 |
82 | {{@fullName}}
83 |
84 | ```
85 |
86 | If _fullName_ is a property on your component the fix would be:
87 |
88 | ```hbs
89 | // addon/components/templates/foo.hbs
90 |
91 |