ember-cli 4.12.0-beta.0 → 4.13.0-beta.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.
Files changed (59) hide show
  1. package/.github/workflows/ci.yml +4 -5
  2. package/CHANGELOG.md +47 -3
  3. package/CONTRIBUTING.md +1 -1
  4. package/bin/ember +0 -0
  5. package/blueprints/addon/files/.github/workflows/ci.yml +3 -3
  6. package/blueprints/addon/files/.travis.yml +1 -1
  7. package/blueprints/addon/files/README.md +1 -1
  8. package/blueprints/addon/files/npmignore +0 -6
  9. package/blueprints/app/files/.eslintignore +0 -12
  10. package/blueprints/app/files/.github/workflows/ci.yml +2 -2
  11. package/blueprints/app/files/.prettierignore +1 -13
  12. package/blueprints/app/files/.travis.yml +1 -1
  13. package/blueprints/app/files/.watchmanconfig +1 -1
  14. package/blueprints/app/files/gitignore +0 -8
  15. package/blueprints/app/files/package.json +16 -16
  16. package/blueprints/in-repo-addon/files/__root__/__name__/index.js +0 -0
  17. package/blueprints/in-repo-addon/index.js +0 -0
  18. package/blueprints/lib/index.js +0 -0
  19. package/blueprints/server/index.js +0 -27
  20. package/docs/build/data.json +628 -812
  21. package/lib/broccoli/default-packager.js +2 -79
  22. package/lib/broccoli/ember-addon.js +0 -4
  23. package/lib/broccoli/ember-app.js +19 -460
  24. package/lib/cli/cli.js +0 -9
  25. package/lib/commands/addon.js +0 -1
  26. package/lib/commands/init.js +0 -8
  27. package/lib/commands/install.js +2 -2
  28. package/lib/commands/new.js +0 -1
  29. package/lib/commands/serve.js +1 -1
  30. package/lib/experiments/index.js +2 -2
  31. package/lib/models/addon.js +38 -113
  32. package/lib/models/blueprint.js +0 -115
  33. package/lib/models/command.js +3 -4
  34. package/lib/models/package-info-cache/package-info.js +1 -5
  35. package/lib/models/project.js +2 -87
  36. package/lib/tasks/interactive-new.js +1 -1
  37. package/lib/tasks/npm-task.js +0 -15
  38. package/lib/tasks/server/express-server.js +0 -1
  39. package/lib/tasks/server/middleware/broccoli-watcher/index.js +5 -5
  40. package/lib/tasks/server/middleware/history-support/index.js +6 -7
  41. package/lib/tasks/server/middleware/testem-url-rewriter/index.js +0 -10
  42. package/lib/tasks/server/middleware/tests-server/index.js +8 -9
  43. package/lib/utilities/ember-app-utils.js +1 -21
  44. package/lib/utilities/get-serve-url.js +2 -2
  45. package/package.json +13 -23
  46. package/tests/helpers/acceptance.js +1 -3
  47. package/tests/helpers/command-generator.js +2 -2
  48. package/tests/helpers/default-packager.js +3 -9
  49. package/tests/helpers/init-app.js +1 -1
  50. package/tests/helpers/mock-project.js +1 -1
  51. package/tests/helpers/package-cache.js +2 -19
  52. package/blueprints/server/files/server/.jshintrc +0 -3
  53. package/blueprints/vendor-shim/files/vendor/shims/__name__.js +0 -12
  54. package/blueprints/vendor-shim/index.js +0 -30
  55. package/lib/broccoli/babel-process-modules-only.js +0 -18
  56. package/lib/models/installation-checker.js +0 -87
  57. package/lib/tasks/bower-install.js +0 -175
  58. package/lib/utilities/ember-cli-babel-config-key.js +0 -12
  59. package/lib/utilities/find-addon-by-name.js +0 -39
@@ -9,16 +9,11 @@ const p = require('ember-cli-preprocess-registry/preprocessors');
9
9
  const chalk = require('chalk');
10
10
  const resolve = require('resolve');
11
11
 
12
+ const assert = require('../debug/assert');
12
13
  const Project = require('../models/project');
13
14
 
14
- let preprocessJs = p.preprocessJs;
15
- let isType = p.isType;
16
-
17
- let preprocessTemplates = p.preprocessTemplates;
18
-
19
15
  const concat = require('broccoli-concat');
20
16
  const BroccoliDebug = require('broccoli-debug');
21
- const AmdFunnel = require('broccoli-amd-funnel');
22
17
  const mergeTrees = require('./merge-trees');
23
18
  const broccoliMergeTrees = require('broccoli-merge-trees');
24
19
  const WatchedDir = require('broccoli-source').WatchedDir;
@@ -29,11 +24,7 @@ const Funnel = require('broccoli-funnel');
29
24
  const logger = require('heimdalljs-logger')('ember-cli:ember-app');
30
25
  const addonProcessTree = require('../utilities/addon-process-tree');
31
26
  const lintAddonsByType = require('../utilities/lint-addons-by-type');
32
- const emberCLIBabelConfigKey = require('../utilities/ember-cli-babel-config-key');
33
- const { isExperimentEnabled } = require('../experiments');
34
- const semver = require('semver');
35
27
  const DefaultPackager = require('./default-packager');
36
- const { deprecate } = require('../debug');
37
28
 
38
29
  let DEFAULT_CONFIG = {
39
30
  storeConfigInMeta: true,
@@ -62,7 +53,6 @@ let DEFAULT_CONFIG = {
62
53
  },
63
54
  sourcemaps: {},
64
55
  trees: {},
65
- jshintrc: {},
66
56
  addons: {},
67
57
  };
68
58
 
@@ -77,10 +67,8 @@ class EmberApp {
77
67
  - autoRun, defaults to `true`
78
68
  - outputPaths, defaults to `{}`
79
69
  - minifyCSS, defaults to `{enabled: !!isProduction,options: { relativeTo: 'assets' }}
80
- - minifyJS, defaults to `{enabled: !!isProduction}
81
70
  - sourcemaps, defaults to `{}`
82
71
  - trees, defaults to `{}`
83
- - jshintrc, defaults to `{}`
84
72
  - vendorFiles, defaults to `{}`
85
73
  - addons, defaults to `{ exclude: [], include: [] }`
86
74
 
@@ -106,8 +94,6 @@ class EmberApp {
106
94
 
107
95
  this.registry = options.registry || p.defaultRegistry(this);
108
96
 
109
- this.bowerDirectory = this.project._bowerDirectory;
110
-
111
97
  this._initTestsAndHinting(options);
112
98
  this._initOptions(options);
113
99
  this._initVendorFiles();
@@ -164,16 +150,13 @@ class EmberApp {
164
150
  },
165
151
  });
166
152
 
167
- this._isPackageHookSupplied = typeof this.options.package === 'function';
168
153
  this._cachedAddonBundles = {};
169
154
 
170
155
  if (this.project.perBundleAddonCache && this.project.perBundleAddonCache.numProxies > 0) {
171
156
  if (this.options.addons.include && this.options.addons.include.length) {
172
- let optionKey = this.options.addons.hasWhitelist ? 'whitelist' : 'include';
173
-
174
157
  throw new Error(
175
158
  [
176
- `[ember-cli] addon bundle caching is disabled for apps that specify an addon "${optionKey}"`,
159
+ `[ember-cli] addon bundle caching is disabled for apps that specify an addon "include"`,
177
160
  '',
178
161
  'All addons using bundle caching:',
179
162
  ...this.project.perBundleAddonCache.getPathsToAddonsOptedIn(),
@@ -182,11 +165,9 @@ class EmberApp {
182
165
  }
183
166
 
184
167
  if (this.options.addons.exclude && this.options.addons.exclude.length) {
185
- let optionKey = this.options.addons.hasBlacklist ? 'blacklist' : 'exclude';
186
-
187
168
  throw new Error(
188
169
  [
189
- `[ember-cli] addon bundle caching is disabled for apps that specify an addon "${optionKey}"`,
170
+ `[ember-cli] addon bundle caching is disabled for apps that specify an addon "exclude"`,
190
171
  '',
191
172
  'All addons using bundle caching:',
192
173
  ...this.project.perBundleAddonCache.getPathsToAddonsOptedIn(),
@@ -272,8 +253,6 @@ class EmberApp {
272
253
  let trees = (options && options.trees) || {};
273
254
 
274
255
  let appTree = buildTreeFor('app', trees.app);
275
-
276
- let testsPath = typeof trees.tests === 'string' ? resolvePathFor('tests', trees.tests) : null;
277
256
  let testsTree = buildTreeFor('tests', trees.tests, options.tests);
278
257
 
279
258
  // these are contained within app/ no need to watch again
@@ -286,47 +265,15 @@ class EmberApp {
286
265
  }
287
266
 
288
267
  let templatesTree = buildTreeFor('app/templates', trees.templates, false);
289
-
290
- // do not watch bower's default directory by default
291
- let bowerTree = buildTreeFor(this.bowerDirectory, null, !!this.project._watchmanInfo.enabled);
292
-
293
- // Set the flag to make sure:
294
- //
295
- // - we do not blow up if there is no bower_components folder
296
- // - we do not attempt to merge bower and vendor together if they are the
297
- // same tree
298
- this._bowerEnabled = this.bowerDirectory !== 'vendor' && fs.existsSync(this.bowerDirectory);
299
-
300
268
  let vendorTree = buildTreeFor('vendor', trees.vendor);
301
269
  let publicTree = buildTreeFor('public', trees.public);
302
270
 
303
271
  let detectedDefaultOptions = {
304
272
  babel: {},
305
- jshintrc: {
306
- app: this.project.root,
307
- tests: testsPath,
308
- },
309
273
  minifyCSS: {
310
274
  enabled: this.isProduction,
311
275
  options: { processImport: false },
312
276
  },
313
- // TODO: remove this with a deprecation (nothing in the default app/addon setup consumes it)
314
- minifyJS: {
315
- enabled: this.isProduction,
316
- options: {
317
- compress: {
318
- // this is adversely affects heuristics for IIFE eval
319
- // eslint-disable-next-line camelcase
320
- negate_iife: false,
321
- // limit sequences because of memory issues during parsing
322
- sequences: 30,
323
- },
324
- output: {
325
- // no difference in size and much easier to debug
326
- semicolons: false,
327
- },
328
- },
329
- },
330
277
  outputPaths: {
331
278
  app: {
332
279
  css: {
@@ -344,7 +291,6 @@ class EmberApp {
344
291
  tests: testsTree,
345
292
  styles: stylesTree,
346
293
  templates: templatesTree,
347
- bower: bowerTree,
348
294
  vendor: vendorTree,
349
295
  public: publicTree,
350
296
  },
@@ -352,84 +298,12 @@ class EmberApp {
352
298
 
353
299
  let emberCLIBabelInstance = this.project.findAddonByName('ember-cli-babel');
354
300
  if (emberCLIBabelInstance) {
355
- let version = this.project.require('ember-cli-babel/package.json').version;
356
- if (semver.lt(version, '6.0.0-alpha.1')) {
357
- detectedDefaultOptions.babel = {
358
- modules: 'amdStrict',
359
- moduleIds: true,
360
- resolveModuleSource: require('amd-name-resolver').moduleResolve,
361
- };
362
- }
363
-
364
- let emberCLIBabelConfigKey = this._emberCLIBabelConfigKey();
365
- detectedDefaultOptions[emberCLIBabelConfigKey] = detectedDefaultOptions[emberCLIBabelConfigKey] || {};
366
- detectedDefaultOptions[emberCLIBabelConfigKey].compileModules = true;
301
+ detectedDefaultOptions['ember-cli-babel'] = detectedDefaultOptions['ember-cli-babel'] || {};
302
+ detectedDefaultOptions['ember-cli-babel'].compileModules = true;
367
303
  }
368
304
 
369
305
  this.options = defaultsDeep(options, detectedDefaultOptions, DEFAULT_CONFIG);
370
306
 
371
- if (this.options.addons.blacklist) {
372
- deprecate(
373
- 'Using the `addons.blacklist` build option is deprecated. Please use `addons.exclude` instead.',
374
- false,
375
- {
376
- for: 'ember-cli',
377
- id: 'ember-cli.blacklist-whitelist-build-options',
378
- since: {
379
- available: '4.4.0',
380
- enabled: '4.4.0',
381
- },
382
- until: '5.0.0',
383
- }
384
- );
385
-
386
- if (this.options.addons.exclude) {
387
- throw new Error('Specifying both "blacklist" and "exclude" is not supported. Please use only one.');
388
- }
389
-
390
- this.options.addons.hasBlacklist = true;
391
- this.options.addons.exclude = this.options.addons.blacklist;
392
- }
393
-
394
- Object.defineProperty(this.options.addons, 'blacklist', {
395
- get() {
396
- console.log(chalk.yellow('Please use "exclude" instead of "blacklist".'));
397
-
398
- return this.exclude;
399
- },
400
- });
401
-
402
- if (this.options.addons.whitelist) {
403
- deprecate(
404
- 'Using the `addons.whitelist` build option is deprecated. Please use `addons.include` instead.',
405
- false,
406
- {
407
- for: 'ember-cli',
408
- id: 'ember-cli.blacklist-whitelist-build-options',
409
- since: {
410
- available: '4.4.0',
411
- enabled: '4.4.0',
412
- },
413
- until: '5.0.0',
414
- }
415
- );
416
-
417
- if (this.options.addons.include) {
418
- throw new Error('Specifying both "whitelist" and "include" is not supported. Please use only one.');
419
- }
420
-
421
- this.options.addons.hasWhitelist = true;
422
- this.options.addons.include = this.options.addons.whitelist;
423
- }
424
-
425
- Object.defineProperty(this.options.addons, 'whitelist', {
426
- get() {
427
- console.log(chalk.yellow('Please use "include" instead of "whitelist".'));
428
-
429
- return this.include;
430
- },
431
- });
432
-
433
307
  // For now we must disable Babel sourcemaps due to unforeseen
434
308
  // performance regressions.
435
309
  if (!('sourceMaps' in this.options.babel)) {
@@ -443,12 +317,6 @@ class EmberApp {
443
317
  this.options.fingerprint.exclude.push('testem');
444
318
  }
445
319
 
446
- _emberCLIBabelConfigKey() {
447
- let emberCLIBabelInstance = this.project.findAddonByName('ember-cli-babel');
448
-
449
- return emberCLIBabelConfigKey(emberCLIBabelInstance);
450
- }
451
-
452
320
  /**
453
321
  Resolves a path relative to the project's root
454
322
 
@@ -464,118 +332,26 @@ class EmberApp {
464
332
  @method _initVendorFiles
465
333
  */
466
334
  _initVendorFiles() {
467
- let bowerDeps = this.project._bowerDependencies();
468
- let ember = this.project.findAddonByName('ember-source');
469
- let addonEmberCliShims = this.project.findAddonByName('ember-cli-shims');
470
- let bowerEmberCliShims = bowerDeps['ember-cli-shims'];
471
- let developmentEmber;
472
- let productionEmber;
473
- let emberTesting;
474
- let emberShims = null;
475
-
476
- if (ember) {
477
- developmentEmber = ember.paths.debug;
478
- productionEmber = ember.paths.prod;
479
- emberTesting = ember.paths.testing;
480
- emberShims = ember.paths.shims;
481
- } else {
482
- if (bowerEmberCliShims) {
483
- emberShims = `${this.bowerDirectory}/ember-cli-shims/app-shims.js`;
484
- }
335
+ let emberSource = this.project.findAddonByName('ember-source');
485
336
 
486
- // in Ember 1.10 and higher `ember.js` is deprecated in favor of
487
- // the more aptly named `ember.debug.js`.
488
- productionEmber = `${this.bowerDirectory}/ember/ember.prod.js`;
489
- developmentEmber = `${this.bowerDirectory}/ember/ember.debug.js`;
490
- if (!fs.existsSync(this._resolveLocal(developmentEmber))) {
491
- developmentEmber = `${this.bowerDirectory}/ember/ember.js`;
492
- }
493
- emberTesting = `${this.bowerDirectory}/ember/ember-testing.js`;
494
- }
495
-
496
- let handlebarsVendorFiles;
497
- if ('handlebars' in bowerDeps) {
498
- handlebarsVendorFiles = {
499
- development: `${this.bowerDirectory}/handlebars/handlebars.js`,
500
- production: `${this.bowerDirectory}/handlebars/handlebars.runtime.js`,
501
- };
502
- } else {
503
- handlebarsVendorFiles = null;
504
- }
337
+ assert(
338
+ 'Could not find `ember-source`. Please install `ember-source` by running `ember install ember-source`.',
339
+ emberSource
340
+ );
505
341
 
506
342
  this.vendorFiles = omitBy(
507
343
  merge(
508
344
  {
509
- 'handlebars.js': handlebarsVendorFiles,
510
345
  'ember.js': {
511
- development: developmentEmber,
512
- production: productionEmber,
346
+ development: emberSource.paths.debug,
347
+ production: emberSource.paths.prod,
513
348
  },
514
- 'ember-testing.js': [emberTesting, { type: 'test' }],
515
- 'app-shims.js': emberShims,
516
- 'ember-resolver.js': [
517
- `${this.bowerDirectory}/ember-resolver/dist/modules/ember-resolver.js`,
518
- {
519
- exports: {
520
- 'ember/resolver': ['default'],
521
- },
522
- },
523
- ],
349
+ 'ember-testing.js': [emberSource.paths.testing, { type: 'test' }],
524
350
  },
525
351
  this.options.vendorFiles
526
352
  ),
527
353
  isNull
528
354
  );
529
-
530
- this._addJqueryInLegacyEmber();
531
-
532
- if (this._addonInstalled('ember-resolver') || !bowerDeps['ember-resolver']) {
533
- // if the project is using `ember-resolver` as an addon
534
- // remove it from `vendorFiles` (the npm version properly works
535
- // without `app.import`s)
536
- delete this.vendorFiles['ember-resolver.js'];
537
- }
538
-
539
- // Warn if ember-cli-shims is not included.
540
- // certain versions of `ember-source` bundle them by default,
541
- // so we must check if that is the load mechanism of ember
542
- // before checking `bower`.
543
- let emberCliShimsRequired = this._checkEmberCliBabel(this.project.addons);
544
- if (!emberShims && !addonEmberCliShims && !bowerEmberCliShims && emberCliShimsRequired) {
545
- this.project.ui.writeWarnLine(
546
- "You have not included `ember-cli-shims` in your project's `bower.json` or `package.json`. This only works if you provide an alternative yourself and unset `app.vendorFiles['app-shims.js']`."
547
- );
548
- }
549
-
550
- // If ember-testing.js is coming from Bower (not ember-source) and it does not
551
- // exist, then we remove it from vendor files. This is needed to support versions
552
- // of Ember older than 1.8.0 (when ember-testing.js was incldued in ember.js itself)
553
- if (!ember && this.vendorFiles['ember-testing.js'] && !fs.existsSync(this.vendorFiles['ember-testing.js'][0])) {
554
- delete this.vendorFiles['ember-testing.js'];
555
- }
556
- }
557
-
558
- _addJqueryInLegacyEmber() {
559
- if (this.project.findAddonByName('@ember/jquery')) {
560
- return;
561
- }
562
- let ember = this.project.findAddonByName('ember-source');
563
- let jqueryPath;
564
- if (ember) {
565
- let optionFeatures = this.project.findAddonByName('@ember/optional-features');
566
- if (optionFeatures && !optionFeatures.isFeatureEnabled('jquery-integration')) {
567
- return;
568
- }
569
- this.project.ui.writeDeprecateLine(
570
- 'The integration of jQuery into Ember has been deprecated and will be removed with Ember 4.0. You can either' +
571
- ' opt-out of using jQuery, or install the `@ember/jquery` addon to provide the jQuery integration. Please' +
572
- ' consult the deprecation guide for further details: https://emberjs.com/deprecations/v3.x#toc_jquery-apis'
573
- );
574
- jqueryPath = ember.paths.jquery;
575
- } else {
576
- jqueryPath = `${this.bowerDirectory}/jquery/dist/jquery.js`;
577
- }
578
- this.vendorFiles = merge({ 'jquery.js': jqueryPath }, this.vendorFiles);
579
355
  }
580
356
 
581
357
  /**
@@ -639,34 +415,6 @@ class EmberApp {
639
415
  return !!include && include.indexOf(addon.name) === -1;
640
416
  }
641
417
 
642
- /**
643
- @private
644
- @method _checkEmberCliBabel
645
- @param {Addons} addons
646
- @return {Boolean}
647
- */
648
- _checkEmberCliBabel(addons, result, roots) {
649
- addons = addons || [];
650
- result = result || false;
651
- roots = roots || {};
652
-
653
- let babelInstance = addons.find((addon) => addon.name === 'ember-cli-babel');
654
- if (babelInstance) {
655
- let version = babelInstance.pkg.version;
656
- if (semver.lt(version, '6.6.0')) {
657
- result = true;
658
- }
659
- if (semver.lt(version, '6.0.0') && !roots[babelInstance.root]) {
660
- roots[babelInstance.root] = true;
661
- this.project.ui.writeDeprecateLine(
662
- `ember-cli-babel 5.x has been deprecated. Please upgrade to at least ember-cli-babel 6.6. Version ${version} located: ${babelInstance.root}`
663
- );
664
- }
665
- }
666
-
667
- return addons.some((addon) => this._checkEmberCliBabel(addon.addons, result, roots)) || result;
668
- }
669
-
670
418
  /**
671
419
  Returns whether an addon should be added to the project
672
420
 
@@ -693,21 +441,17 @@ class EmberApp {
693
441
  let addonNames = this.project.addons.map((addon) => addon.name);
694
442
 
695
443
  if (this.options.addons.exclude) {
696
- let optionKey = this.options.addons.hasBlacklist ? 'blacklist' : 'exclude';
697
-
698
444
  this.options.addons.exclude.forEach((addonName) => {
699
445
  if (addonNames.indexOf(addonName) === -1) {
700
- throw new Error(`Addon "${addonName}" defined in "${optionKey}" is not found`);
446
+ throw new Error(`Addon "${addonName}" defined in "exclude" is not found`);
701
447
  }
702
448
  });
703
449
  }
704
450
 
705
451
  if (this.options.addons.include) {
706
- let optionKey = this.options.addons.hasWhitelist ? 'whitelist' : 'include';
707
-
708
452
  this.options.addons.include.forEach((addonName) => {
709
453
  if (addonNames.indexOf(addonName) === -1) {
710
- throw new Error(`Addon "${addonName}" defined in "${optionKey}" is not found`);
454
+ throw new Error(`Addon "${addonName}" defined in "include" is not found`);
711
455
  }
712
456
  });
713
457
  }
@@ -811,93 +555,6 @@ class EmberApp {
811
555
  return this._addonTreesFor(type).map((addonBundle) => addonBundle.tree);
812
556
  }
813
557
 
814
- _getDefaultPluginForType(type) {
815
- let plugins = this.registry.load(type);
816
- let defaultsForType = plugins.filter((plugin) => plugin.isDefaultForType);
817
-
818
- if (defaultsForType.length > 1) {
819
- throw new Error(
820
- `There are multiple preprocessor plugins marked as default for '${type}': ${defaultsForType
821
- .map((p) => p.name)
822
- .join(', ')}`
823
- );
824
- }
825
-
826
- return defaultsForType[0];
827
- }
828
-
829
- _compileAddonTemplates(tree) {
830
- let defaultPluginForType = this._getDefaultPluginForType('template');
831
- let options = {
832
- annotation: `_compileAddonTemplates`,
833
- registry: this.registry,
834
- };
835
-
836
- if (defaultPluginForType) {
837
- tree = defaultPluginForType.toTree(tree, options);
838
- } else {
839
- tree = preprocessTemplates(tree, options);
840
- }
841
-
842
- return tree;
843
- }
844
-
845
- _compileAddonJs(tree) {
846
- let defaultPluginForType = this._getDefaultPluginForType('js');
847
- let options = {
848
- annotation: '_compileAddonJs',
849
- registry: this.registry,
850
- };
851
-
852
- if (defaultPluginForType) {
853
- tree = defaultPluginForType.toTree(tree, options);
854
- } else {
855
- tree = preprocessJs(tree, '/', '/', options);
856
- }
857
-
858
- return tree;
859
- }
860
-
861
- _compileAddonTree(tree, skipTemplates) {
862
- if (!skipTemplates) {
863
- tree = this._compileAddonTemplates(tree);
864
- }
865
- tree = this._compileAddonJs(tree);
866
-
867
- return tree;
868
- }
869
-
870
- _precompileAppJsTree(tree) {
871
- let emberCLIBabelConfigKey = this._emberCLIBabelConfigKey();
872
-
873
- let original = this.options[emberCLIBabelConfigKey];
874
-
875
- // the app will handle transpilation after it tree-shakes
876
- // do it here instead of the constructor because
877
- // ember-data and others do their own compilation in their
878
- // treeForAddon without calling super
879
- // they need the original params preserved because they call
880
- // babel themselves and expect compilation the old way
881
- this.options[emberCLIBabelConfigKey] = Object.assign({}, original, {
882
- compileModules: false,
883
- disablePresetEnv: true,
884
- disableDebugTooling: true,
885
- disableEmberModulesAPIPolyfill: true,
886
- });
887
-
888
- tree = preprocessJs(tree, '/', '/', {
889
- annotation: `_precompileAppJsTree`,
890
- registry: this.registry,
891
- treeType: 'app',
892
- });
893
-
894
- // return the original params because there are multiple
895
- // entrances to preprocessJs
896
- this.options[emberCLIBabelConfigKey] = original;
897
-
898
- return tree;
899
- }
900
-
901
558
  /**
902
559
  Runs addon post-processing on a given tree and returns the processed tree.
903
560
 
@@ -1076,7 +733,7 @@ class EmberApp {
1076
733
  * @method getAppJavascript
1077
734
  * @return {BroccoliTree}
1078
735
  */
1079
- getAppJavascript(isPackageHookSupplied) {
736
+ getAppJavascript() {
1080
737
  let appTrees = [].concat(this.addonTreesFor('app'), this.trees.app).filter(Boolean);
1081
738
 
1082
739
  let mergedApp = mergeTrees(appTrees, {
@@ -1090,10 +747,6 @@ class EmberApp {
1090
747
  annotation: 'ProcessedAppTree',
1091
748
  });
1092
749
 
1093
- if (isExperimentEnabled('PACKAGER') && isPackageHookSupplied) {
1094
- appTree = this._precompileAppJsTree(appTree);
1095
- }
1096
-
1097
750
  return appTree;
1098
751
  }
1099
752
 
@@ -1248,7 +901,6 @@ class EmberApp {
1248
901
  *
1249
902
  * + app `vendor` files
1250
903
  * + add-ons' `vendor` files
1251
- * + bower packages
1252
904
  * + node modules
1253
905
  *
1254
906
  * Resulting tree:
@@ -1256,7 +908,6 @@ class EmberApp {
1256
908
  * ```
1257
909
  * /
1258
910
  * ├── addon-tree-output/
1259
- * ├── bower_components/
1260
911
  * └── vendor/
1261
912
  * ```
1262
913
  *
@@ -1278,13 +929,7 @@ class EmberApp {
1278
929
  );
1279
930
 
1280
931
  let addons = this.addonTree();
1281
-
1282
932
  let trees = [vendor].concat(addons);
1283
- if (this._bowerEnabled) {
1284
- let bower = this._defaultPackager.packageBower(this.trees.bower, this.bowerDirectory);
1285
-
1286
- trees.push(bower);
1287
- }
1288
933
 
1289
934
  trees = this._nodeModuleTrees().concat(trees);
1290
935
 
@@ -1426,16 +1071,6 @@ class EmberApp {
1426
1071
  });
1427
1072
  }
1428
1073
 
1429
- /**
1430
- * @private
1431
- * @method _addonInstalled
1432
- * @param {String} addonName The name of the addon we are checking to see if it's installed
1433
- * @return {Boolean}
1434
- */
1435
- _addonInstalled(addonName) {
1436
- return !!this.registry.availablePlugins[addonName];
1437
- }
1438
-
1439
1074
  /**
1440
1075
  @public
1441
1076
  @method dependencies
@@ -1479,7 +1114,7 @@ class EmberApp {
1479
1114
  }
1480
1115
 
1481
1116
  let directory = path.dirname(assetPath);
1482
- let subdirectory = directory.replace(new RegExp(`^vendor/|${this.bowerDirectory}|node_modules/`), '');
1117
+ let subdirectory = directory.replace(new RegExp(`^vendor/|node_modules/`), '');
1483
1118
  let extension = path.extname(assetPath);
1484
1119
 
1485
1120
  if (!extension) {
@@ -1504,7 +1139,7 @@ class EmberApp {
1504
1139
  // TODO: refactor, this has gotten very messy. Relevant tests: tests/unit/broccoli/ember-app-test.js
1505
1140
  let basename = path.basename(assetPath);
1506
1141
 
1507
- if (isType(assetPath, 'js', { registry: this.registry })) {
1142
+ if (p.isType(assetPath, 'js', { registry: this.registry })) {
1508
1143
  if (options.using) {
1509
1144
  if (!Array.isArray(options.using)) {
1510
1145
  throw new Error('You must pass an array of transformations for `using` option');
@@ -1631,77 +1266,10 @@ class EmberApp {
1631
1266
  this.getTests(),
1632
1267
  this.getExternalTree(),
1633
1268
  this.getPublic(),
1634
- this.getAppJavascript(this._isPackageHookSupplied),
1269
+ this.getAppJavascript(),
1635
1270
  ].filter(Boolean);
1636
1271
  }
1637
1272
 
1638
- _legacyAddonCompile(type, outputDir, _options) {
1639
- let options = Object.assign(
1640
- {
1641
- // moduleNormalizerDisabled: this.options.moduleNormalizerDisabled,
1642
- amdFunnelDisabled: this.options.amdFunnelDisabled,
1643
- skipTemplates: false,
1644
- },
1645
- _options
1646
- );
1647
-
1648
- let addonBundles = this._cachedAddonBundles[type];
1649
-
1650
- let addonTrees = addonBundles.map((addonBundle) => {
1651
- let { name, tree, root } = addonBundle;
1652
-
1653
- let precompiledSource = tree;
1654
-
1655
- if (!options.amdFunnelDisabled) {
1656
- // don't want to double compile the AMD modules
1657
- let hasAlreadyPrintedAmdDeprecation;
1658
- precompiledSource = new AmdFunnel(precompiledSource, {
1659
- callback: () => {
1660
- if (!hasAlreadyPrintedAmdDeprecation) {
1661
- this.project.ui.writeDeprecateLine(
1662
- `Addon "${name}" (found at "${root}") is manually generating AMD modules. Code should be ES6 modules only. Support for this will be removed in a future version.`
1663
- );
1664
- hasAlreadyPrintedAmdDeprecation = true;
1665
- }
1666
- },
1667
- annotation: `AmdFunnel (${type} ${name})`,
1668
- });
1669
- }
1670
-
1671
- return [tree, precompiledSource];
1672
- });
1673
-
1674
- let precompiledSource = addonTrees.map((pair) => pair[1]);
1675
- addonTrees = addonTrees.map((pair) => pair[0]);
1676
-
1677
- precompiledSource = mergeTrees(precompiledSource, {
1678
- overwrite: true,
1679
- annotation: `TreeMerger (${type})`,
1680
- });
1681
-
1682
- precompiledSource = this._debugTree(precompiledSource, `precompiledAddonTree:${type}`);
1683
-
1684
- let compiledSource = this._compileAddonTree(precompiledSource, options.skipTemplates);
1685
-
1686
- compiledSource = this._debugTree(compiledSource, `postcompiledAddonTree:${type}`);
1687
-
1688
- let combinedAddonTree;
1689
-
1690
- if (options.amdFunnelDisabled) {
1691
- combinedAddonTree = compiledSource;
1692
- } else {
1693
- combinedAddonTree = mergeTrees(addonTrees.concat(compiledSource), {
1694
- overwrite: true,
1695
- annotation: `AmdFunnel TreeMerger (${type})`,
1696
- });
1697
- }
1698
-
1699
- return new Funnel(combinedAddonTree, {
1700
- destDir: outputDir,
1701
- annotation: `Funnel: ${outputDir} ${type}`,
1702
- });
1703
- }
1704
-
1705
1273
  _legacyPackage(fullTree) {
1706
1274
  let javascriptTree = this._defaultPackager.packageJavascript(fullTree);
1707
1275
  let stylesTree = this._defaultPackager.packageStyles(fullTree);
@@ -1731,7 +1299,6 @@ class EmberApp {
1731
1299
  */
1732
1300
  toTree(additionalTrees) {
1733
1301
  let packagedTree;
1734
- let packageFn = this.options.package;
1735
1302
 
1736
1303
  let fullTree = mergeTrees(this.toArray(), {
1737
1304
  overwrite: true,
@@ -1740,14 +1307,6 @@ class EmberApp {
1740
1307
 
1741
1308
  fullTree = this._debugTree(fullTree, 'prepackage');
1742
1309
 
1743
- if (isExperimentEnabled('PACKAGER')) {
1744
- if (this._isPackageHookSupplied) {
1745
- packagedTree = packageFn.call(this, fullTree);
1746
- } else {
1747
- this.project.ui.writeWarnLine('`package` hook must be a function, falling back to default packaging.');
1748
- }
1749
- }
1750
-
1751
1310
  if (!packagedTree) {
1752
1311
  packagedTree = this._legacyPackage(fullTree);
1753
1312
  }