@ethlete/core 5.0.0-next.38 → 5.0.0-next.39

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,5 +1,11 @@
1
1
  # @ethlete/core
2
2
 
3
+ ## 5.0.0-next.39
4
+
5
+ ### Patch Changes
6
+
7
+ - [`74850e3`](https://github.com/ethlete-io/ethdk/commit/74850e3a62339565c13bdeb89c4334993eefd2b3) Thanks [@TomTomB](https://github.com/TomTomB)! - The provider-definition doc comments no longer spell the pure annotation out verbatim, so Rollup stops warning about (and stripping) an annotation it cannot attach to a call while bundling `@ethlete/core`.
8
+
3
9
  ## 5.0.0-next.38
4
10
 
5
11
  ### Minor Changes
@@ -175,7 +175,15 @@ const createProviders = (token, factory, extraToken) => [
175
175
  { provide: token, useFactory: factory },
176
176
  ...(extraToken ? [{ provide: extraToken, useExisting: token }] : []),
177
177
  ];
178
-
178
+ /**
179
+ * Defines a provider that a subtree opts into - `provideX()` in some component's `providers`, then
180
+ * `injectX()` below it. Nothing is created until the subtree provides it.
181
+ *
182
+ * Assign the result to one `const`, name the halves with {@link toProvideFn} / {@link toInjectFn} /
183
+ * {@link toToken}, and put a `__PURE__` annotation comment on each of those declarations. Never destructure
184
+ * the definition: that declaration cannot be tree-shaken, so it ships the factory's whole closure to
185
+ * every consumer. Enforced by `ethlete/no-impure-top-level-provider`.
186
+ */
179
187
  const defineProvider = (factory, options) => {
180
188
  const token = new InjectionToken(options?.name ?? createComponentId('provider'));
181
189
  return {
@@ -226,7 +234,7 @@ const defineStaticRootProvider = (defaultValue, options) => {
226
234
  token,
227
235
  };
228
236
  };
229
-
237
+ /** The `provideX` half of a provider definition. A call, so a `__PURE__` annotation makes it droppable. */
230
238
  const toProvideFn = (definition) => definition.provide;
231
239
  /** The `injectX` half of a provider definition. */
232
240
  const toInjectFn = (definition) => definition.inject;