ember-source 4.11.0-beta.1 → 4.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,9 +1,11 @@
1
1
  # Ember Changelog
2
2
 
3
- ## v4.11.0-beta.1 (January 12, 2023)
3
+ ## v4.11.0 (February 20, 2023)
4
4
 
5
5
  - [#20288](https://github.com/emberjs/ember.js/pull/20288) [FEATURE] Stable types for `@ember/owner`
6
6
  - [#20323](https://github.com/emberjs/ember.js/pull/20323) [FEATURE] Introduce stable types for `@ember/error`
7
+ - [#20361](https://github.com/emberjs/ember.js/pull/20361) [BUGFIX] Support a `router.ts` file when generating routes
8
+ - [#20373](https://github.com/emberjs/ember.js/pull/20373) / [#20374](https://github.com/emberjs/ember.js/pull/20374) [BUGFIX] Make the type for `SafeString` public
7
9
  - [#20345](https://github.com/emberjs/ember.js/pull/20345) [CLEANUP] Remove flags for released features
8
10
  - [#20285](https://github.com/emberjs/ember.js/pull/20285) Update to TS v4.9
9
11
 
@@ -5,6 +5,7 @@ const path = require('path');
5
5
  const chalk = require('chalk');
6
6
  const stringUtil = require('ember-cli-string-utils');
7
7
  const EmberRouterGenerator = require('ember-router-generator');
8
+ const SilentError = require('silent-error');
8
9
 
9
10
  const maybePolyfillTypeScriptBlueprints = require('../-maybe-polyfill-typescript-blueprints');
10
11
 
@@ -148,21 +149,42 @@ function updateRouter(action, options) {
148
149
  }
149
150
  }
150
151
 
151
- function findRouter(options) {
152
+ function findRouterPath(options) {
152
153
  let routerPathParts = [options.project.root];
153
- let root = 'app';
154
154
 
155
155
  if (options.dummy && options.project.isEmberCLIAddon()) {
156
- routerPathParts = routerPathParts.concat(['tests', 'dummy', root, 'router.js']);
156
+ routerPathParts.push('tests', 'dummy', 'app');
157
157
  } else {
158
- routerPathParts = routerPathParts.concat([root, 'router.js']);
158
+ routerPathParts.push('app');
159
159
  }
160
160
 
161
- return routerPathParts;
161
+ let jsRouterPath = path.join(...routerPathParts, 'router.js');
162
+ let tsRouterPath = path.join(...routerPathParts, 'router.ts');
163
+
164
+ let jsRouterPathExists = fs.existsSync(jsRouterPath);
165
+ let tsRouterPathExists = fs.existsSync(tsRouterPath);
166
+
167
+ if (jsRouterPathExists && tsRouterPathExists) {
168
+ throw new SilentError(
169
+ 'Found both a `router.js` and `router.ts` file. Please make sure your project only has one or the other.'
170
+ );
171
+ }
172
+
173
+ if (jsRouterPathExists) {
174
+ return jsRouterPath;
175
+ }
176
+
177
+ if (tsRouterPathExists) {
178
+ return tsRouterPath;
179
+ }
180
+
181
+ throw new SilentError(
182
+ 'Could not find a router file. Please make sure your project has a `router.js` or `router.ts` file.'
183
+ );
162
184
  }
163
185
 
164
186
  function writeRoute(action, name, options) {
165
- let routerPath = path.join.apply(null, findRouter(options));
187
+ let routerPath = findRouterPath(options);
166
188
  let source = fs.readFileSync(routerPath, 'utf-8');
167
189
 
168
190
  let routes = new EmberRouterGenerator(source);
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "4.11.0-beta.1",
2
+ "version": "4.11.0",
3
3
  "buildType": "tag",
4
- "SHA": "6daf65cc3291902f22dbe1e66f579eb36c4a6b8e",
5
- "assetPath": "/tag/shas/6daf65cc3291902f22dbe1e66f579eb36c4a6b8e.tgz"
4
+ "SHA": "2b1011f1ef06befc12da863a75fe8cc5e7042769",
5
+ "assetPath": "/tag/shas/2b1011f1ef06befc12da863a75fe8cc5e7042769.tgz"
6
6
  }
@@ -6,7 +6,7 @@
6
6
  * Portions Copyright 2008-2011 Apple Inc. All rights reserved.
7
7
  * @license Licensed under MIT license
8
8
  * See https://raw.github.com/emberjs/ember.js/master/LICENSE
9
- * @version 4.11.0-beta.1
9
+ * @version 4.11.0
10
10
  */
11
11
 
12
12
  /* eslint-disable no-var */
@@ -16465,7 +16465,7 @@ define("ember/version", ["exports"], function (_exports) {
16465
16465
  value: true
16466
16466
  });
16467
16467
  _exports.default = void 0;
16468
- var _default = "4.11.0-beta.1";
16468
+ var _default = "4.11.0";
16469
16469
  _exports.default = _default;
16470
16470
  });
16471
16471
  define("simple-html-tokenizer", ["exports"], function (_exports) {