ember-cli 4.0.0 → 4.2.0-beta.1

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 (115) hide show
  1. package/.github/workflows/ci.yml +8 -4
  2. package/CHANGELOG.md +43 -2
  3. package/README.md +1 -1
  4. package/blueprints/addon/additional-dev-dependencies.json +1 -1
  5. package/blueprints/addon/files/CONTRIBUTING.md +1 -1
  6. package/blueprints/app/files/README.md +2 -2
  7. package/blueprints/app/files/package.json +8 -8
  8. package/docs/build/data.json +64 -3
  9. package/lib/debug/assert.js +37 -0
  10. package/lib/debug/deprecate.js +111 -0
  11. package/lib/debug/index.js +6 -0
  12. package/lib/models/host-info-cache.js +3 -5
  13. package/lib/models/per-bundle-addon-cache/index.js +2 -3
  14. package/lib/tasks/npm-task.js +1 -1
  15. package/lib/utilities/get-lang-arg.js +45 -45
  16. package/package.json +31 -31
  17. package/.github/ISSUE_TEMPLATE.md +0 -12
  18. package/.github/dependabot.yml +0 -15
  19. package/.github/workflows/coverage.yml +0 -31
  20. package/docs/analytics.md +0 -44
  21. package/docs/architecture.md +0 -316
  22. package/docs/assets/architecture/Ember-CLI architecture.png +0 -0
  23. package/docs/assets/architecture/Ember-CLI architecture.xml +0 -1
  24. package/docs/assets/architecture/README.md +0 -5
  25. package/docs/brocfile-transition.md +0 -46
  26. package/docs/build/api.js +0 -44
  27. package/docs/build/assets/css/external-small.png +0 -0
  28. package/docs/build/assets/css/logo.png +0 -0
  29. package/docs/build/assets/css/main.css +0 -555
  30. package/docs/build/assets/favicon.ico +0 -0
  31. package/docs/build/assets/img/spinner.gif +0 -0
  32. package/docs/build/assets/index.html +0 -10
  33. package/docs/build/assets/js/api-filter.js +0 -56
  34. package/docs/build/assets/js/api-list.js +0 -255
  35. package/docs/build/assets/js/api-search.js +0 -98
  36. package/docs/build/assets/js/apidocs.js +0 -376
  37. package/docs/build/assets/js/yui-prettify.js +0 -17
  38. package/docs/build/assets/vendor/prettify/CHANGES.html +0 -130
  39. package/docs/build/assets/vendor/prettify/COPYING +0 -202
  40. package/docs/build/assets/vendor/prettify/README.html +0 -203
  41. package/docs/build/assets/vendor/prettify/prettify-min.css +0 -1
  42. package/docs/build/assets/vendor/prettify/prettify-min.js +0 -1
  43. package/docs/build/classes/Addon.html +0 -4318
  44. package/docs/build/classes/AmdTransformAddon.html +0 -202
  45. package/docs/build/classes/Blueprint.html +0 -4796
  46. package/docs/build/classes/Builder.html +0 -611
  47. package/docs/build/classes/CLI.html +0 -810
  48. package/docs/build/classes/Command.html +0 -1655
  49. package/docs/build/classes/DefaultPackager.html +0 -202
  50. package/docs/build/classes/EmberAddon.html +0 -2207
  51. package/docs/build/classes/EmberApp.html +0 -2225
  52. package/docs/build/classes/HardwareInfo.html +0 -620
  53. package/docs/build/classes/HistorySupportAddon.html +0 -203
  54. package/docs/build/classes/Instrumentation.html +0 -695
  55. package/docs/build/classes/NodeModulesList.html +0 -460
  56. package/docs/build/classes/NpmTask.html +0 -333
  57. package/docs/build/classes/PackageInfo.html +0 -1390
  58. package/docs/build/classes/PackageInfoCache.html +0 -963
  59. package/docs/build/classes/PerBundleAddonCache {.html +0 -1010
  60. package/docs/build/classes/Project.html +0 -2083
  61. package/docs/build/classes/ServeFilesAddon.html +0 -260
  62. package/docs/build/classes/TestsServerAddon.html +0 -203
  63. package/docs/build/classes/WatcherAddon.html +0 -204
  64. package/docs/build/classes/WindowsSymlinkChecker.html +0 -1505
  65. package/docs/build/files/lib_broccoli_default-packager.js.html +0 -1426
  66. package/docs/build/files/lib_broccoli_ember-addon.js.html +0 -159
  67. package/docs/build/files/lib_broccoli_ember-app.js.html +0 -1913
  68. package/docs/build/files/lib_cli_cli.js.html +0 -417
  69. package/docs/build/files/lib_models_addon-info.js.html +0 -112
  70. package/docs/build/files/lib_models_addon.js.html +0 -1866
  71. package/docs/build/files/lib_models_blueprint.js.html +0 -1678
  72. package/docs/build/files/lib_models_builder.js.html +0 -417
  73. package/docs/build/files/lib_models_command.js.html +0 -804
  74. package/docs/build/files/lib_models_hardware-info.js.html +0 -479
  75. package/docs/build/files/lib_models_host-info-cache.js.html +0 -428
  76. package/docs/build/files/lib_models_installation-checker.js.html +0 -181
  77. package/docs/build/files/lib_models_instantiate-addons.js.html +0 -191
  78. package/docs/build/files/lib_models_instrumentation.js.html +0 -433
  79. package/docs/build/files/lib_models_package-info-cache_index.js.html +0 -793
  80. package/docs/build/files/lib_models_package-info-cache_node-modules-list.js.html +0 -208
  81. package/docs/build/files/lib_models_package-info-cache_package-info.js.html +0 -661
  82. package/docs/build/files/lib_models_per-bundle-addon-cache_addon-proxy.js.html +0 -252
  83. package/docs/build/files/lib_models_per-bundle-addon-cache_index.js.html +0 -485
  84. package/docs/build/files/lib_models_per-bundle-addon-cache_target-instance.js.html +0 -108
  85. package/docs/build/files/lib_models_project.js.html +0 -913
  86. package/docs/build/files/lib_models_task.js.html +0 -117
  87. package/docs/build/files/lib_tasks_build-watch.js.html +0 -157
  88. package/docs/build/files/lib_tasks_npm-task.js.html +0 -463
  89. package/docs/build/files/lib_tasks_serve.js.html +0 -207
  90. package/docs/build/files/lib_tasks_server_middleware_broccoli-serve-files_index.js.html +0 -127
  91. package/docs/build/files/lib_tasks_server_middleware_broccoli-watcher_index.js.html +0 -158
  92. package/docs/build/files/lib_tasks_server_middleware_history-support_index.js.html +0 -181
  93. package/docs/build/files/lib_tasks_server_middleware_tests-server_index.js.html +0 -171
  94. package/docs/build/files/lib_tasks_test-server.js.html +0 -167
  95. package/docs/build/files/lib_tasks_transforms_amd_index.js.html +0 -143
  96. package/docs/build/files/lib_utilities_ember-app-utils.js.html +0 -292
  97. package/docs/build/files/lib_utilities_insert-into-file.js.html +0 -219
  98. package/docs/build/files/lib_utilities_is-lazy-engine.js.html +0 -125
  99. package/docs/build/files/lib_utilities_is-yarn-project.js.html +0 -120
  100. package/docs/build/files/lib_utilities_valid-project-name.js.html +0 -142
  101. package/docs/build/files/lib_utilities_will-interrupt-process.js.html +0 -290
  102. package/docs/build/files/lib_utilities_windows-admin.js.html +0 -230
  103. package/docs/build/index.html +0 -125
  104. package/docs/build/modules/ember-cli.html +0 -152
  105. package/docs/build/modules/is-lazy-engine.html +0 -106
  106. package/docs/build-concurrency.md +0 -15
  107. package/docs/build-pipeline-debugging.md +0 -33
  108. package/docs/code-coverage.md +0 -14
  109. package/docs/error-propagation.md +0 -136
  110. package/docs/experiments.md +0 -53
  111. package/docs/node-support.md +0 -43
  112. package/docs/perf-guide.md +0 -250
  113. package/docs/project_version_preprocessor.js +0 -8
  114. package/docs/sourcemaps.md +0 -60
  115. package/docs/yuidoc.json +0 -13
@@ -14,6 +14,10 @@ on:
14
14
  schedule:
15
15
  - cron: '0 3 * * *' # daily, at 3am
16
16
 
17
+ concurrency:
18
+ group: ci-${{ github.head_ref || github.ref }}
19
+ cancel-in-progress: true
20
+
17
21
  jobs:
18
22
  linting:
19
23
  name: Linting
@@ -21,7 +25,7 @@ jobs:
21
25
 
22
26
  steps:
23
27
  - uses: actions/checkout@v2
24
- - uses: actions/setup-node@v2.1.5
28
+ - uses: actions/setup-node@v2.5.1
25
29
  with:
26
30
  node-version: 12.x
27
31
  cache: 'yarn'
@@ -39,7 +43,7 @@ jobs:
39
43
 
40
44
  steps:
41
45
  - uses: actions/checkout@v2
42
- - uses: actions/setup-node@v2.1.5
46
+ - uses: actions/setup-node@v2.5.1
43
47
  with:
44
48
  node-version: 12.x
45
49
  cache: 'yarn'
@@ -61,7 +65,7 @@ jobs:
61
65
 
62
66
  steps:
63
67
  - uses: actions/checkout@v2
64
- - uses: actions/setup-node@v2.1.5
68
+ - uses: actions/setup-node@v2.5.1
65
69
  with:
66
70
  node-version: ${{ matrix.node-version }}
67
71
  cache: 'yarn'
@@ -86,7 +90,7 @@ jobs:
86
90
 
87
91
  steps:
88
92
  - uses: actions/checkout@v2
89
- - uses: actions/setup-node@v2.1.5
93
+ - uses: actions/setup-node@v2.5.1
90
94
  with:
91
95
  node-version: 12.x
92
96
  cache: 'yarn'
package/CHANGELOG.md CHANGED
@@ -1,5 +1,48 @@
1
1
  # ember-cli Changelog
2
2
 
3
+ ## v4.2.0-beta.1
4
+
5
+ #### Blueprint Changes
6
+
7
+ - [`ember new` diff](https://github.com/ember-cli/ember-new-output/compare/v4.1.0...v4.2.0-beta.1)
8
+ - [`ember addon` diff](https://github.com/ember-cli/ember-addon-output/compare/v4.1.0...v4.2.0-beta.1)
9
+
10
+ #### Changelog
11
+
12
+ - [#9681](https://github.com/ember-cli/ember-cli/pull/9681) Update URL to Ember CLI website everywhere [@bertdeblock](https://github.com/bertdeblock)
13
+ - [#9726](https://github.com/ember-cli/ember-cli/pull/9726) Cancel stale workflows when starting a new one. [@rwjblue](https://github.com/rwjblue)
14
+ - [#9731](https://github.com/ember-cli/ember-cli/pull/9731) Add an `assert` and a `deprecate` utility [@bertdeblock](https://github.com/bertdeblock)
15
+ - [#9753](https://github.com/ember-cli/ember-cli/pull/9753) Upgrade to `ember-template-lint` v4 in blueprint [@bmish](https://github.com/bmish)
16
+
17
+ Thank you to all who took the time to contribute!
18
+
19
+ ## v4.1.0
20
+
21
+ #### Blueprint Changes
22
+
23
+ - [`ember new` diff](https://github.com/ember-cli/ember-new-output/compare/v4.0.1...v4.1.0)
24
+ - [`ember addon` diff](https://github.com/ember-cli/ember-addon-output/compare/v4.0.1...v4.1.0)
25
+
26
+ #### Changelog
27
+
28
+ - [#9700](https://github.com/ember-cli/ember-cli/pull/9700) [Chore] Update .npmignore to ignore .github and docs folders [@SergeAstapov](https://github.com/SergeAstapov)
29
+ - [#9729](https://github.com/ember-cli/ember-cli/pull/9729) is-language-code@^3.1.0 [@kellyselden](https://github.com/kellyselden)
30
+
31
+ Thank you to all who took the time to contribute!
32
+
33
+ ## v4.0.1
34
+
35
+ #### Blueprint Changes
36
+
37
+ - [`ember new` diff](https://github.com/ember-cli/ember-new-output/compare/v4.0.0...v4.0.1)
38
+ - [`ember addon` diff](https://github.com/ember-cli/ember-addon-output/compare/v4.0.0...v4.0.1)
39
+
40
+ #### Changelog
41
+
42
+ - [#9675](https://github.com/ember-cli/ember-cli/pull/9675) Fix using `pnpm` install inadvertently [@balinterdi](https://github.com/balinterdi)
43
+
44
+ Thank you to all who took the time to contribute!
45
+
3
46
  ## v4.0.0
4
47
 
5
48
  #### Blueprint Changes
@@ -12,13 +55,11 @@
12
55
  - [#9679](https://github.com/ember-cli/ember-cli/pull/9679) Bump ember-page-title from v6.2.2 to v7.0.0 [@raido](https://github.com/raido)
13
56
  - [#9694](https://github.com/ember-cli/ember-cli/pull/9694) test in node 16 LTS [@kellyselden](https://github.com/kellyselden)
14
57
  - [#9696](https://github.com/ember-cli/ember-cli/pull/9696) commands/init: Fix `--yarn` usage [@Turbo87](https://github.com/Turbo87)
15
-
16
58
  - [#9659](https://github.com/ember-cli/ember-cli/pull/9659) Ensure `ember-classic` ember-try scenario uses Ember 3.x [@rwjblue](https://github.com/rwjblue)
17
59
  - [#9661](https://github.com/ember-cli/ember-cli/pull/9661) Set default CI config blueprints to run all builds [@elwayman02](https://github.com/elwayman02)
18
60
  - [#9666](https://github.com/ember-cli/ember-cli/pull/9666) Remove IE11 comments from `config/target.js` in app blueprint [@bertdeblock](https://github.com/bertdeblock)
19
61
  - [#9667](https://github.com/ember-cli/ember-cli/pull/9667) Update eslint-plugin-qunit to v7 in blueprint [@bmish](https://github.com/bmish)
20
62
  - [#9670](https://github.com/ember-cli/ember-cli/pull/9670) Don't emit an error when the `lint:fix` script fails post blueprint generation [@bertdeblock](https://github.com/bertdeblock)
21
-
22
63
  - [#9574](https://github.com/ember-cli/ember-cli/pull/9574) Update link to Discord in README.md [@MelSumner](https://github.com/MelSumner)
23
64
  - [#9613](https://github.com/ember-cli/ember-cli/pull/9613) Fix test that started failing with v2.17.0 of qunit [@kategengler](https://github.com/kategengler)
24
65
  - [#9579](https://github.com/ember-cli/ember-cli/pull/9579) Add `--ci-provider` option to `ember new` and `ember addon` [@snewcomer](https://github.com/snewcomer)
package/README.md CHANGED
@@ -65,7 +65,7 @@ Community
65
65
 
66
66
  - Discord: [Get your invite](https://discord.gg/emberjs)
67
67
  - Issues: [ember-cli/issues](https://github.com/ember-cli/ember-cli/issues)
68
- - Documentation: [ember-cli.com](https://cli.emberjs.com/release/)
68
+ - Documentation: [cli.emberjs.com](https://cli.emberjs.com/release/)
69
69
 
70
70
 
71
71
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "devDependencies": {
3
- "@embroider/test-setup": "^0.48.1",
3
+ "@embroider/test-setup": "^0.50.0",
4
4
  "ember-disable-prototype-extensions": "^1.1.3",
5
5
  "ember-try": "^2.0.0",
6
6
  "ember-source-channel-url": "^3.0.0"
@@ -22,4 +22,4 @@
22
22
  * `ember serve`
23
23
  * Visit the dummy application at [http://localhost:4200](http://localhost:4200).
24
24
 
25
- For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).
25
+ For more information on using ember-cli, visit [https://cli.emberjs.com/release/](https://cli.emberjs.com/release/).
@@ -10,7 +10,7 @@ You will need the following things properly installed on your computer.
10
10
  * [Git](https://git-scm.com/)
11
11
  * [Node.js](https://nodejs.org/)<% if (yarn) { %>
12
12
  * [Yarn](https://yarnpkg.com/)<% } else { %> (with npm)<% } %>
13
- * [Ember CLI](https://ember-cli.com/)
13
+ * [Ember CLI](https://cli.emberjs.com/release/)
14
14
  * [Google Chrome](https://google.com/chrome/)
15
15
 
16
16
  ## Installation
@@ -51,7 +51,7 @@ Specify what it takes to deploy your app.
51
51
  ## Further Reading / Useful Links
52
52
 
53
53
  * [ember.js](https://emberjs.com/)
54
- * [ember-cli](https://ember-cli.com/)
54
+ * [ember-cli](https://cli.emberjs.com/release/)
55
55
  * Development Browser Extensions
56
56
  * [ember inspector for chrome](https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi)
57
57
  * [ember inspector for firefox](https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/)
@@ -25,9 +25,9 @@
25
25
  "devDependencies": {
26
26
  "@ember/optional-features": "^2.0.0",
27
27
  "@ember/test-helpers": "^2.6.0<% if (embroider) { %>",
28
- "@embroider/compat": "^0.48.1",
29
- "@embroider/core": "^0.48.1",
30
- "@embroider/webpack": "^0.48.1<% } %>",
28
+ "@embroider/compat": "^0.50.0",
29
+ "@embroider/core": "^0.50.0",
30
+ "@embroider/webpack": "^0.50.0<% } %>",
31
31
  "@glimmer/component": "^1.0.4",
32
32
  "@glimmer/tracking": "^1.0.4",
33
33
  "babel-eslint": "^10.1.0",
@@ -35,22 +35,22 @@
35
35
  "ember-auto-import": "^2.2.4",
36
36
  "ember-cli": "~<%= emberCLIVersion %>",
37
37
  "ember-cli-app-version": "^5.0.0",
38
- "ember-cli-babel": "^7.26.8",
38
+ "ember-cli-babel": "^7.26.11",
39
39
  "ember-cli-dependency-checker": "^3.2.0",
40
40
  "ember-cli-htmlbars": "^6.0.1",
41
41
  "ember-cli-inject-live-reload": "^2.1.0",
42
42
  "ember-cli-sri": "^2.1.1",
43
43
  "ember-cli-terser": "^4.0.2",
44
- "ember-data": "~4.0.2",
44
+ "ember-data": "~4.2.0-beta.0",
45
45
  "ember-export-application-global": "^2.0.1",
46
46
  "ember-fetch": "^8.1.1",
47
47
  "ember-load-initializers": "^2.1.2",
48
48
  "ember-page-title": "^7.0.0",
49
49
  "ember-qunit": "^5.1.5",
50
50
  "ember-resolver": "^8.0.3",
51
- "ember-source": "~4.0.1",
52
- "ember-template-lint": "^3.15.0<% if (welcome) { %>",
53
- "ember-welcome-page": "^6.0.0<% } %>",
51
+ "ember-source": "~4.2.0-beta.1",
52
+ "ember-template-lint": "^4.0.0<% if (welcome) { %>",
53
+ "ember-welcome-page": "^6.1.0<% } %>",
54
54
  "eslint": "^7.32.0",
55
55
  "eslint-config-prettier": "^8.3.0",
56
56
  "eslint-plugin-ember": "^10.5.8",
@@ -3,7 +3,7 @@
3
3
  "logo": "https://ember-cli.com/assets/images/ember-cli-logo-small-dark.png",
4
4
  "name": "ember-cli",
5
5
  "description": "Command line tool for developing ambitious ember.js apps",
6
- "version": "4.0.0-release-b4cbb1029f"
6
+ "version": "4.2.0-beta.1-beta-1a2aea2e64"
7
7
  },
8
8
  "files": {
9
9
  "lib/broccoli/default-packager.js": {
@@ -44,6 +44,20 @@
44
44
  "fors": {},
45
45
  "namespaces": {}
46
46
  },
47
+ "lib/debug/assert.js": {
48
+ "name": "lib/debug/assert.js",
49
+ "modules": {},
50
+ "classes": {},
51
+ "fors": {},
52
+ "namespaces": {}
53
+ },
54
+ "lib/debug/deprecate.js": {
55
+ "name": "lib/debug/deprecate.js",
56
+ "modules": {},
57
+ "classes": {},
58
+ "fors": {},
59
+ "namespaces": {}
60
+ },
47
61
  "lib/models/package-info-cache/index.js": {
48
62
  "name": "lib/models/package-info-cache/index.js",
49
63
  "modules": {},
@@ -1571,6 +1585,53 @@
1571
1585
  "class": "CLI",
1572
1586
  "module": "ember-cli"
1573
1587
  },
1588
+ {
1589
+ "file": "lib/debug/assert.js",
1590
+ "line": 3,
1591
+ "description": "Verify that a certain condition is met, or throw an error if otherwise.\n\nThis is useful for communicating expectations in the code to other human\nreaders as well as catching bugs that accidentally violate these expectations.\n\n```js\nconst { assert } = require('ember-cli/lib/debug');\n\n// Test for truthiness:\nassert('Must pass a string.', typeof str === 'string');\n\n// Fail unconditionally:\nassert('This code path should never run.');\n```",
1592
+ "itemtype": "method",
1593
+ "name": "assert",
1594
+ "params": [
1595
+ {
1596
+ "name": "description",
1597
+ "description": "Describes the condition.\nThis will become the message of the error thrown if the assertion fails.",
1598
+ "type": "String"
1599
+ },
1600
+ {
1601
+ "name": "condition",
1602
+ "description": "Must be truthy for the assertion to pass.\nIf falsy, an error will be thrown.",
1603
+ "type": "Any"
1604
+ }
1605
+ ],
1606
+ "class": "PackageInfoCache",
1607
+ "module": "ember-cli"
1608
+ },
1609
+ {
1610
+ "file": "lib/debug/deprecate.js",
1611
+ "line": 7,
1612
+ "description": "Display a deprecation message.\n\n```js\nconst { deprecate } = require('ember-cli/lib/debug');\n\ndeprecate('The `foo` method is deprecated.', false, {\n for: 'ember-cli',\n id: 'ember-cli.foo-method',\n since: {\n available: '4.1.0',\n enabled: '4.2.0',\n },\n until: '5.0.0',\n url: 'https://example.com',\n});\n```",
1613
+ "itemtype": "method",
1614
+ "name": "deprecate",
1615
+ "params": [
1616
+ {
1617
+ "name": "description",
1618
+ "description": "Describes the deprecation.",
1619
+ "type": "String"
1620
+ },
1621
+ {
1622
+ "name": "condition",
1623
+ "description": "If falsy, the deprecation message will be displayed.",
1624
+ "type": "Any"
1625
+ },
1626
+ {
1627
+ "name": "options",
1628
+ "description": "An object including the deprecation's details:\n- `for` The library that the deprecation is for\n- `id` The deprecation's unique id\n- `since.available` A SemVer version indicating when the deprecation was made available\n- `since.enabled` A SemVer version indicating when the deprecation was enabled\n- `until` A SemVer version indicating until when the deprecation will be active\n- `url` A URL that refers to additional information about the deprecation",
1629
+ "type": "Object"
1630
+ }
1631
+ ],
1632
+ "class": "PackageInfoCache",
1633
+ "module": "ember-cli"
1634
+ },
1574
1635
  {
1575
1636
  "file": "lib/models/package-info-cache/index.js",
1576
1637
  "line": 36,
@@ -2378,7 +2439,7 @@
2378
2439
  },
2379
2440
  {
2380
2441
  "file": "lib/models/per-bundle-addon-cache/index.js",
2381
- "line": 248,
2442
+ "line": 247,
2382
2443
  "description": "Called from PackageInfo.getAddonInstance(), return an instance of the requested\naddon or a Proxy, based on the type of addon and its bundle host.",
2383
2444
  "itemtype": "method",
2384
2445
  "name": "getAddonInstance",
@@ -5651,7 +5712,7 @@
5651
5712
  },
5652
5713
  {
5653
5714
  "file": "lib/models/host-info-cache.js",
5654
- "line": 272,
5715
+ "line": 270,
5655
5716
  "description": "This returns the LCA host for a given engine; we use the associated package info\nto compute this (see `getHostAddonInfo` above); this finds the lowest common ancestor\nthat is considered a host amongst _all_ engines by the same name in the project. This\nfunction is intended to replace the original behavior in `ember-engines`.\n\nFor more info, see the original implementation here:\n\nhttps://github.com/ember-engines/ember-engines/blob/master/packages/ember-engines/lib/utils/find-lca-host.js",
5656
5717
  "itemtype": "method",
5657
5718
  "name": "findLCAHost",
@@ -0,0 +1,37 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Verify that a certain condition is met, or throw an error if otherwise.
5
+ *
6
+ * This is useful for communicating expectations in the code to other human
7
+ * readers as well as catching bugs that accidentally violate these expectations.
8
+ *
9
+ * ```js
10
+ * const { assert } = require('ember-cli/lib/debug');
11
+ *
12
+ * // Test for truthiness:
13
+ * assert('Must pass a string.', typeof str === 'string');
14
+ *
15
+ * // Fail unconditionally:
16
+ * assert('This code path should never run.');
17
+ * ```
18
+ *
19
+ * @method assert
20
+ * @param {String} description Describes the condition.
21
+ * This will become the message of the error thrown if the assertion fails.
22
+ * @param {Any} condition Must be truthy for the assertion to pass.
23
+ * If falsy, an error will be thrown.
24
+ */
25
+ function assert(description, condition) {
26
+ if (!description) {
27
+ throw new Error('When calling `assert`, you must provide a description as the first argument.');
28
+ }
29
+
30
+ if (condition) {
31
+ return;
32
+ }
33
+
34
+ throw new Error(`ASSERTION FAILED: ${description}`);
35
+ }
36
+
37
+ module.exports = assert;
@@ -0,0 +1,111 @@
1
+ 'use strict';
2
+
3
+ const chalk = require('chalk');
4
+ const semver = require('semver');
5
+ const assert = require('./assert');
6
+
7
+ /**
8
+ * Display a deprecation message.
9
+ *
10
+ * ```js
11
+ * const { deprecate } = require('ember-cli/lib/debug');
12
+ *
13
+ * deprecate('The `foo` method is deprecated.', false, {
14
+ * for: 'ember-cli',
15
+ * id: 'ember-cli.foo-method',
16
+ * since: {
17
+ * available: '4.1.0',
18
+ * enabled: '4.2.0',
19
+ * },
20
+ * until: '5.0.0',
21
+ * url: 'https://example.com',
22
+ * });
23
+ * ```
24
+ *
25
+ * @method deprecate
26
+ * @param {String} description Describes the deprecation.
27
+ * @param {Any} condition If falsy, the deprecation message will be displayed.
28
+ * @param {Object} options An object including the deprecation's details:
29
+ * - `for` The library that the deprecation is for
30
+ * - `id` The deprecation's unique id
31
+ * - `since.available` A SemVer version indicating when the deprecation was made available
32
+ * - `since.enabled` A SemVer version indicating when the deprecation was enabled
33
+ * - `until` A SemVer version indicating until when the deprecation will be active
34
+ * - `url` A URL that refers to additional information about the deprecation
35
+ */
36
+ function deprecate(description, condition, options) {
37
+ assert('When calling `deprecate`, you must provide a description as the first argument.', description);
38
+ assert('When calling `deprecate`, you must provide a condition as the second argument.', arguments.length > 1);
39
+
40
+ assert(
41
+ 'When calling `deprecate`, you must provide an options object as the third argument. The options object must include the `for`, `id`, `since` and `until` options (`url` is optional).',
42
+ options
43
+ );
44
+
45
+ assert('When calling `deprecate`, you must provide the `for` option.', options.for);
46
+ assert('When calling `deprecate`, you must provide the `id` option.', options.id);
47
+
48
+ assert(
49
+ 'When calling `deprecate`, you must provide the `since` option. `since` must include the `available` and/or the `enabled` option.',
50
+ options.since
51
+ );
52
+
53
+ assert(
54
+ 'When calling `deprecate`, you must provide the `since.available` and/or the `since.enabled` option.',
55
+ options.since.available || options.since.enabled
56
+ );
57
+
58
+ assert(
59
+ '`since.available` must be a valid SemVer version.',
60
+ !options.since.available || isSemVer(options.since.available)
61
+ );
62
+
63
+ assert('`since.enabled` must be a valid SemVer version.', !options.since.enabled || isSemVer(options.since.enabled));
64
+
65
+ assert(
66
+ 'When calling `deprecate`, you must provide a valid SemVer version for the `until` option.',
67
+ isSemVer(options.until)
68
+ );
69
+
70
+ if (condition) {
71
+ return;
72
+ }
73
+
74
+ let message = formatMessage(description, options);
75
+
76
+ warn(message);
77
+ warn(getStackTrace());
78
+
79
+ // Return the message for testing purposes.
80
+ // This can be removed once we can register deprecation handlers.
81
+ return message;
82
+ }
83
+
84
+ function isSemVer(version) {
85
+ return semver.valid(version) !== null;
86
+ }
87
+
88
+ function formatMessage(description, options) {
89
+ let message = [`DEPRECATION: ${description}`, `[ID: ${options.id}]`];
90
+
91
+ if (options.url) {
92
+ message.push(`See ${options.url} for more details.`);
93
+ }
94
+
95
+ return message.join(' ');
96
+ }
97
+
98
+ function getStackTrace() {
99
+ let error = new Error();
100
+ let lines = error.stack.split('\n');
101
+
102
+ lines.shift(); // Remove the word `Error`.
103
+
104
+ return lines.map((line) => line.trim()).join('\n');
105
+ }
106
+
107
+ function warn(message) {
108
+ console.warn(chalk.yellow(message));
109
+ }
110
+
111
+ module.exports = deprecate;
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ assert: require('./assert'),
5
+ deprecate: require('./deprecate'),
6
+ };
@@ -242,11 +242,9 @@ class HostInfoCache {
242
242
  path.push(currentPackageInfo);
243
243
 
244
244
  queue.push(
245
- ...[
246
- ...inRepoAddons,
247
- ...Object.values(dependencyPackages),
248
- ...Object.values(devDependencyPackages),
249
- ].map((pkgInfo) => ({ pkgInfo, path: [...path] }))
245
+ ...[...inRepoAddons, ...Object.values(dependencyPackages), ...Object.values(devDependencyPackages)].map(
246
+ (pkgInfo) => ({ pkgInfo, path: [...path] })
247
+ )
250
248
  );
251
249
  }
252
250
  }
@@ -234,9 +234,8 @@ class PerBundleAddonCache {
234
234
  return bundleHost;
235
235
  }
236
236
 
237
- let { hostPackageInfo, hostAndAncestorBundledPackageInfos } = this.project.hostInfoCache.getHostAddonInfo(
238
- bundleHost
239
- );
237
+ let { hostPackageInfo, hostAndAncestorBundledPackageInfos } =
238
+ this.project.hostInfoCache.getHostAddonInfo(bundleHost);
240
239
 
241
240
  if (!hostAndAncestorBundledPackageInfos.has(addonPkgInfo)) {
242
241
  return bundleHost;
@@ -187,7 +187,7 @@ class NpmTask extends Task {
187
187
  logger.info('yarn.lock not found');
188
188
  }
189
189
 
190
- if (this.hasPNPMLock()) {
190
+ if (await this.hasPNPMLock()) {
191
191
  logger.info('pnpm-lock.yaml found -> trying pnpm');
192
192
  try {
193
193
  let result = await this.checkPNPM();