Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions guides/release/in-depth-topics/which-dependencies-are-needed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
Not all modules need to be declared in the package.json, but for the most part

> [!important]
> If you import it, you must declare it (in `dependencies` or `peerDependencies` in your package.json)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs clarification, cause otherwise this contradicts the previous sentence. The "for the most part" isn't really cutting it.

something along the lines of:

"As a ground rule, every module that's imported needs to be declared either in dependencies or peerDependencies. However, there are some exceptions, where the imported modules are provided by the ember build tooling instead of the normal package resolution.

This document describes those exceptions."



## Available via build tools

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section should explicitly clarify that these dependencies do not need to be declared in the deps. "Available via build tools" does not mean much to a new user.


The following packages are provided by the `ember()` vite plugin from `@embroider/vite`, via the V2 Addon Format's spec feature: `renamed-modules` (and are public API).

### `@ember/*`

- `@ember/application`
- `@ember/array`
- `@ember/component`
- `@ember/controller`
- `@ember/debug`
- `@ember/destroyable`
- `@ember/engine`
- `@ember/enumerable`
- `@ember/helper`
- `@ember/modifier`
- `@ember/object`
- `@ember/owner`
- `@ember/reactive`
- `@ember/routing`
- `@ember/runloop`
- `@ember/service`
- `@ember/template-compilation`
- `@ember/template-compiler`
- `@ember/template-factory`
- `@ember/template`
- `@ember/test`
- `@ember/utils`
- `@ember/version`

### `@glimmer/*`

- `@glimmer/tracking`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I swear we were chasing down a few other @\glimmer/* ones before.. maybe runtime?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are a bunch more glimmer packages provided from build-plugins + ember-source, but I haven't listed them here because they aren't public

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ember-source/package.json#ember-addon.renamed-modules is the source of truth tho

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the latest release has this:

"@glimmer/destroyable/index.js": "ember-source/@glimmer/destroyable/index.js",
      "@glimmer/encoder/index.js": "ember-source/@glimmer/encoder/index.js",
      "@glimmer/env/index.js": "ember-source/@glimmer/env/index.js",
      "@glimmer/global-context/index.js": "ember-source/@glimmer/global-context/index.js",
      "@glimmer/manager/index.js": "ember-source/@glimmer/manager/index.js",
      "@glimmer/node/index.js": "ember-source/@glimmer/node/index.js",
      "@glimmer/opcode-compiler/index.js": "ember-source/@glimmer/opcode-compiler/index.js",
      "@glimmer/owner/index.js": "ember-source/@glimmer/owner/index.js",
      "@glimmer/program/index.js": "ember-source/@glimmer/program/index.js",
      "@glimmer/reference/index.js": "ember-source/@glimmer/reference/index.js",
      "@glimmer/runtime/index.js": "ember-source/@glimmer/runtime/index.js",
      "@glimmer/tracking/index.js": "ember-source/@glimmer/tracking/index.js",
      "@glimmer/tracking/primitives/cache/index.js": "ember-source/@glimmer/tracking/primitives/cache/index.js",
      "@glimmer/util/index.js": "ember-source/@glimmer/util/index.js",
      "@glimmer/validator/index.js": "ember-source/@glimmer/validator/index.js",
      "@glimmer/vm/index.js": "ember-source/@glimmer/vm/index.js",
      "@glimmer/wire-format/index.js": "ember-source/@glimmer/wire-format/index.js",

claude just tried to tell me I needed to install @glimmer/validator due to type compilation issue, we should at least make sure the full list (including private) is included somewhere like a skill we can have things pick it up easily

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No normal person should be concerned with thase packages tho. Experts, such as yourself, can have expert knowledge, like how to solve the issue you described.

However, the types for all glimmer packages are provided by ember-source, provided your default ember-source is new enough.

My fear is that including everything will mislead AI and it'll try to 'be clever', and lead users astray



### Other / Supporting

- `@embroider/macros` (requires babel)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the "requires babel" is a bit out of left field - does that mean babel needs to be a dep? devDep? Isn't babel always required anyway?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some libraries don't seed babel, is all

- `ember-testing`
- `rsvp`



## Must be present in package.json

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must be present where? as deps or devdeps?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally, I think this section should clarify it is re-emphasizing the base rule of "if import -> must declare"

The previous section were the exceptions, and here we're extra-clarifying certain packages that look similar to the exceptions do need to be declared.

So something like:

"These packages, despite looking very similar to some of the packages that are provided by the build tooling, do need to be declared, just like any other module import that is not in the list above."

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must be present where? as deps or devdeps?

Doesn't matter for apps,
Dependencies for libraries


These packages are not provided automatic by any build tooling, and exist as standalone packages on npm.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
These packages are not provided automatic by any build tooling, and exist as standalone packages on npm.
These packages are not provided automatically by any build tooling, and exist as standalone packages on npm.

All of these packages only consume public APIs from `ember-source`

- `@ember/string`
- `@ember/test-helpers`
- `@ember/test-waiters`
- `@glimmer/component`
- `@glint/template`



Loading