ember-source 5.7.0-beta.1 → 5.7.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.
@@ -1,9 +1,33 @@
1
1
  const { dasherize } = require('ember-cli-string-utils');
2
+ const { EOL } = require('os');
3
+
4
+ function generateComponentSignature(componentName) {
5
+ let args = ` // The arguments accepted by the component${EOL} Args: {};`;
6
+
7
+ let blocks =
8
+ ` // Any blocks yielded by the component${EOL}` +
9
+ ` Blocks: {${EOL}` +
10
+ ` default: []${EOL}` +
11
+ ` };`;
12
+
13
+ let element =
14
+ ` // The element to which \`...attributes\` is applied in the component template${EOL}` +
15
+ ` Element: null;`;
16
+
17
+ return (
18
+ `export interface ${componentName}Signature {${EOL}` +
19
+ `${args}${EOL}` +
20
+ `${blocks}${EOL}` +
21
+ `${element}${EOL}` +
22
+ `}${EOL}`
23
+ );
24
+ }
2
25
 
3
26
  function modulePrefixForProject(project) {
4
27
  return dasherize(project.config().modulePrefix);
5
28
  }
6
29
 
7
30
  module.exports = {
31
+ generateComponentSignature,
8
32
  modulePrefixForProject,
9
33
  };
@@ -9,6 +9,7 @@ const getPathOption = require('ember-cli-get-component-path-option');
9
9
  const normalizeEntityName = require('ember-cli-normalize-entity-name');
10
10
  const { EOL } = require('os');
11
11
  const { has } = require('@ember/edition-utils');
12
+ const { generateComponentSignature } = require('../-utils');
12
13
 
13
14
  const maybePolyfillTypeScriptBlueprints = require('../-maybe-polyfill-typescript-blueprints');
14
15
 
@@ -273,7 +274,7 @@ module.exports = {
273
274
  case '@glimmer/component':
274
275
  importComponent = `import Component from '@glimmer/component';`;
275
276
  if (this._isUsingTS) {
276
- componentSignature = signatureFor(classifiedModuleName);
277
+ componentSignature = generateComponentSignature(classifiedModuleName);
277
278
  defaultExport = `class ${classifiedModuleName}Component extends Component<${classifiedModuleName}Signature> {}`;
278
279
  } else {
279
280
  defaultExport = `class ${classifiedModuleName}Component extends Component {}`;
@@ -282,7 +283,7 @@ module.exports = {
282
283
  case '@ember/component/template-only':
283
284
  importComponent = `import templateOnly from '@ember/component/template-only';`;
284
285
  if (this._isUsingTS) {
285
- componentSignature = signatureFor(classifiedModuleName);
286
+ componentSignature = generateComponentSignature(classifiedModuleName);
286
287
  defaultExport = `templateOnly<${classifiedModuleName}Signature>();`;
287
288
  } else {
288
289
  defaultExport = `templateOnly();`;
@@ -300,25 +301,3 @@ module.exports = {
300
301
  };
301
302
  },
302
303
  };
303
-
304
- function signatureFor(classifiedModuleName) {
305
- let args = ` // The arguments accepted by the component${EOL} Args: {};`;
306
-
307
- let blocks =
308
- ` // Any blocks yielded by the component${EOL}` +
309
- ` Blocks: {${EOL}` +
310
- ` default: []${EOL}` +
311
- ` };`;
312
-
313
- let element =
314
- ` // The element to which \`...attributes\` is applied in the component template${EOL}` +
315
- ` Element: null;`;
316
-
317
- return (
318
- `interface ${classifiedModuleName}Signature {${EOL}` +
319
- `${args}${EOL}` +
320
- `${blocks}${EOL}` +
321
- `${element}${EOL}` +
322
- `}${EOL}`
323
- );
324
- }
@@ -1,3 +1,4 @@
1
1
  <%= importComponent %>
2
2
  <%= importTemplate %>
3
+ <%= componentSignature %>
3
4
  export default <%= defaultExport %>
@@ -8,6 +8,7 @@ const getPathOption = require('ember-cli-get-component-path-option');
8
8
  const normalizeEntityName = require('ember-cli-normalize-entity-name');
9
9
  const { EOL } = require('os');
10
10
  const { has } = require('@ember/edition-utils');
11
+ const { generateComponentSignature } = require('../-utils');
11
12
 
12
13
  const maybePolyfillTypeScriptBlueprints = require('../-maybe-polyfill-typescript-blueprints');
13
14
 
@@ -49,9 +50,17 @@ module.exports = {
49
50
  },
50
51
  ],
51
52
 
53
+ /**
54
+ Flag to let us correctly handle the case where we are running against a
55
+ version of Ember CLI which does not support TS-based emit, and where we
56
+ therefore *must* not emit a `defaultExport` local which includes a type
57
+ parameter in the exported function call or class definition.
58
+ */
59
+ _isUsingTS: false,
60
+
52
61
  init() {
53
62
  this._super && this._super.init.apply(this, arguments);
54
- maybePolyfillTypeScriptBlueprints(this);
63
+ this._isUsingTS = maybePolyfillTypeScriptBlueprints(this);
55
64
  let isOctane = has('octane');
56
65
 
57
66
  this.availableOptions.forEach((option) => {
@@ -134,6 +143,7 @@ module.exports = {
134
143
  let importComponent = '';
135
144
  let importTemplate = '';
136
145
  let defaultExport = '';
146
+ let componentSignature = '';
137
147
 
138
148
  // if we're in an addon, build import statement
139
149
  if (options.project.isEmberCLIAddon() || (options.inRepoAddon && !options.inDummy)) {
@@ -161,17 +171,28 @@ module.exports = {
161
171
  break;
162
172
  case '@glimmer/component':
163
173
  importComponent = `import Component from '@glimmer/component';`;
164
- defaultExport = `class ${classifiedModuleName}Component extends Component {}`;
174
+ if (this._isUsingTS) {
175
+ componentSignature = generateComponentSignature(classifiedModuleName);
176
+ defaultExport = `class ${classifiedModuleName}Component extends Component<${classifiedModuleName}Signature> {}`;
177
+ } else {
178
+ defaultExport = `class ${classifiedModuleName}Component extends Component {}`;
179
+ }
165
180
  break;
166
181
  case '@ember/component/template-only':
167
182
  importComponent = `import templateOnly from '@ember/component/template-only';`;
168
- defaultExport = `templateOnly();`;
183
+ if (this._isUsingTS) {
184
+ componentSignature = generateComponentSignature(classifiedModuleName);
185
+ defaultExport = `templateOnly<${classifiedModuleName}Signature>();`;
186
+ } else {
187
+ defaultExport = `templateOnly();`;
188
+ }
169
189
  break;
170
190
  }
171
191
 
172
192
  return {
173
193
  importTemplate,
174
194
  importComponent,
195
+ componentSignature,
175
196
  defaultExport,
176
197
  path: getPathOption(options),
177
198
  componentClass,
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "5.7.0-beta.1",
2
+ "version": "5.7.0",
3
3
  "buildType": "tag",
4
- "SHA": "5300d0afde214d7c3b89732a5b0521e43ae8f7ee",
5
- "assetPath": "/tag/shas/5300d0afde214d7c3b89732a5b0521e43ae8f7ee.tgz"
4
+ "SHA": "787174f49e5a6c253d0c09723cf1bc2ba5593108",
5
+ "assetPath": "/tag/shas/787174f49e5a6c253d0c09723cf1bc2ba5593108.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 5.7.0-beta.1
9
+ * @version 5.7.0
10
10
  */
11
11
 
12
12
  /* eslint-disable no-var */
@@ -281,6 +281,19 @@ define("@ember/-internals/environment/index", ["exports"], function (_exports) {
281
281
  @private
282
282
  */
283
283
  _DEFAULT_ASYNC_OBSERVERS: false,
284
+ /**
285
+ Whether the app still has default record-loading behavior in the model
286
+ hook from RFC https://rfcs.emberjs.com/id/0774-implicit-record-route-loading
287
+ This will also remove the default store property from the route.
288
+ This is not intended to be set directly, as the implementation may change in
289
+ the future. Use `@ember/optional-features` instead.
290
+ @property _NO_IMPLICIT_ROUTE_MODEL
291
+ @for EmberENV
292
+ @type Boolean
293
+ @default false
294
+ @private
295
+ */
296
+ _NO_IMPLICIT_ROUTE_MODEL: false,
284
297
  /**
285
298
  Controls the maximum number of scheduled rerenders without "settling". In general,
286
299
  applications should not need to modify this environment variable, but please
@@ -16564,7 +16577,7 @@ define("ember/version", ["exports"], function (_exports) {
16564
16577
  value: true
16565
16578
  });
16566
16579
  _exports.default = void 0;
16567
- var _default = _exports.default = "5.7.0-beta.1";
16580
+ var _default = _exports.default = "5.7.0";
16568
16581
  });
16569
16582
  define("simple-html-tokenizer", ["exports"], function (_exports) {
16570
16583
  "use strict";