@teambit/scope 1.0.227 → 1.0.229

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 (36) hide show
  1. package/artifacts/__bit_junit.xml +1 -1
  2. package/artifacts/preview/teambit_scope_scope-preview.js +1 -1
  3. package/artifacts/schema.json +3062 -1561
  4. package/dist/clear-cache-action.d.ts +7 -0
  5. package/dist/exceptions/component-not-found.d.ts +9 -0
  6. package/dist/exceptions/index.d.ts +2 -0
  7. package/dist/exceptions/no-id-match-pattern.d.ts +4 -0
  8. package/dist/get-scope-options.d.ts +19 -0
  9. package/dist/index.d.ts +10 -0
  10. package/dist/{preview-1712719054377.js → preview-1712822929999.js} +2 -2
  11. package/dist/routes/action.route.d.ts +10 -0
  12. package/dist/routes/delete.route.d.ts +10 -0
  13. package/dist/routes/fetch.route.d.ts +12 -0
  14. package/dist/routes/index.d.ts +4 -0
  15. package/dist/routes/put.route.d.ts +11 -0
  16. package/dist/scope-aspects-loader.d.ts +91 -0
  17. package/dist/scope-cmd.d.ts +10 -0
  18. package/dist/scope-component-loader.d.ts +36 -0
  19. package/dist/scope.aspect.d.ts +3 -0
  20. package/dist/scope.composition.d.ts +1 -0
  21. package/dist/scope.graphql.d.ts +37 -0
  22. package/dist/scope.main.runtime.d.ts +405 -0
  23. package/dist/scope.main.runtime.js +3 -0
  24. package/dist/scope.main.runtime.js.map +1 -1
  25. package/dist/scope.ui-root.d.ts +25 -0
  26. package/dist/scope.ui.drawer.d.ts +18 -0
  27. package/dist/scope.ui.runtime.d.ts +210 -0
  28. package/dist/staged-config.d.ts +29 -0
  29. package/dist/types.d.ts +10 -0
  30. package/dist/ui/menu/index.d.ts +1 -0
  31. package/dist/ui/menu/menu.d.ts +10 -0
  32. package/dist/ui/scope-overview/index.d.ts +1 -0
  33. package/dist/ui/scope-overview/scope-overview.d.ts +31 -0
  34. package/dist/ui/scope.d.ts +30 -0
  35. package/package.json +26 -26
  36. package/tsconfig.json +1 -55
@@ -0,0 +1,405 @@
1
+ import { GlobalConfigMain } from '@teambit/global-config';
2
+ import { Graph } from '@teambit/graph.cleargraph';
3
+ import type { AspectLoaderMain } from '@teambit/aspect-loader';
4
+ import { RawBuilderData } from '@teambit/builder';
5
+ import { AspectDefinition } from '@teambit/aspect-loader';
6
+ import { CLIMain } from '@teambit/cli';
7
+ import type { AspectData, ComponentMain, ComponentMap, ResolveAspectsOptions } from '@teambit/component';
8
+ import { Component, ComponentFactory, Snap, State } from '@teambit/component';
9
+ import type { GraphqlMain } from '@teambit/graphql';
10
+ import { Harmony, SlotRegistry } from '@teambit/harmony';
11
+ import { IsolateComponentsOptions, IsolatorMain } from '@teambit/isolator';
12
+ import { LoggerMain, Logger } from '@teambit/logger';
13
+ import { ExpressMain } from '@teambit/express';
14
+ import type { UiMain } from '@teambit/ui';
15
+ import { ComponentIdList, ComponentID } from '@teambit/component-id';
16
+ import { ModelComponent, Lane, Version } from '@teambit/legacy/dist/scope/models';
17
+ import LegacyScope, { LegacyOnTagResult } from '@teambit/legacy/dist/scope/scope';
18
+ import { LegacyComponentLog as ComponentLog } from '@teambit/legacy-component-log';
19
+ import { PersistOptions } from '@teambit/legacy/dist/scope/types';
20
+ import { DependencyResolverMain, NodeLinker } from '@teambit/dependency-resolver';
21
+ import { Remotes } from '@teambit/legacy/dist/remotes';
22
+ import { CompIdGraph } from '@teambit/graph';
23
+ import { Types } from '@teambit/legacy/dist/scope/object-registrar';
24
+ import { FETCH_OPTIONS } from '@teambit/legacy/dist/api/scope/lib/fetch';
25
+ import { ObjectList } from '@teambit/legacy/dist/scope/objects/object-list';
26
+ import { RequireableComponent } from '@teambit/harmony.modules.requireable-component';
27
+ import { SnapsDistance } from '@teambit/legacy/dist/scope/component-ops/snaps-distance';
28
+ import { AuthData } from '@teambit/legacy/dist/scope/network/http/http';
29
+ import ConsumerComponent from '@teambit/legacy/dist/consumer/component';
30
+ import { BitId } from '@teambit/legacy-bit-id';
31
+ import { ExtensionDataList } from '@teambit/legacy/dist/consumer/config';
32
+ import { EnvsMain } from '@teambit/envs';
33
+ import { DepEdge } from '@teambit/legacy/dist/scope/models/version';
34
+ import { ScopeComponentLoader } from './scope-component-loader';
35
+ import { StagedConfig } from './staged-config';
36
+ import { ScopeAspectsLoader, ScopeLoadAspectsOptions } from './scope-aspects-loader';
37
+ type RemoteEventMetadata = {
38
+ auth?: AuthData;
39
+ headers?: {};
40
+ };
41
+ type RemoteEvent<Data> = (data: Data, metadata: RemoteEventMetadata, errors?: Array<string | Error>) => Promise<void>;
42
+ type OnPostPutData = {
43
+ ids: ComponentID[];
44
+ lanes: Lane[];
45
+ };
46
+ type OnPostDeleteData = {
47
+ ids: ComponentID[];
48
+ };
49
+ type OnPreFetchObjectData = {
50
+ ids: string[];
51
+ fetchOptions: FETCH_OPTIONS;
52
+ };
53
+ type OnPostPut = RemoteEvent<OnPostPutData>;
54
+ type OnPostExport = RemoteEvent<OnPostPutData>;
55
+ type OnPostDelete = RemoteEvent<OnPostDeleteData>;
56
+ type OnPostObjectsPersist = RemoteEvent<undefined>;
57
+ type OnPreFetchObjects = RemoteEvent<OnPreFetchObjectData>;
58
+ type OnCompAspectReCalc = (component: Component) => Promise<AspectData | undefined>;
59
+ export type OnPostPutSlot = SlotRegistry<OnPostPut>;
60
+ export type OnPostDeleteSlot = SlotRegistry<OnPostDelete>;
61
+ export type OnPostExportSlot = SlotRegistry<OnPostExport>;
62
+ export type OnPostObjectsPersistSlot = SlotRegistry<OnPostObjectsPersist>;
63
+ export type OnPreFetchObjectsSlot = SlotRegistry<OnPreFetchObjects>;
64
+ export type OnCompAspectReCalcSlot = SlotRegistry<OnCompAspectReCalc>;
65
+ export type LoadOptions = {
66
+ /**
67
+ * In case the component we are loading is app, whether to load it as app (in a scope aspects capsule)
68
+ */
69
+ loadApps?: boolean;
70
+ /**
71
+ * In case the component we are loading is env, whether to load it as env (in a scope aspects capsule)
72
+ */
73
+ loadEnvs?: boolean;
74
+ };
75
+ export type ScopeConfig = {
76
+ httpTimeOut: number;
77
+ description?: string;
78
+ icon?: string;
79
+ backgroundIconColor?: string;
80
+ /**
81
+ * Set a different package manager for the aspects capsules
82
+ */
83
+ aspectsPackageManager?: string;
84
+ /**
85
+ * Set a different node linker for the aspects capsules
86
+ */
87
+ aspectsNodeLinker?: NodeLinker;
88
+ };
89
+ export declare class ScopeMain implements ComponentFactory {
90
+ /**
91
+ * private reference to the instance of Harmony.
92
+ */
93
+ private harmony;
94
+ /**
95
+ * legacy scope
96
+ */
97
+ readonly legacyScope: LegacyScope;
98
+ /**
99
+ * component extension.
100
+ */
101
+ readonly componentExtension: ComponentMain;
102
+ /**
103
+ * slot registry for subscribing to build
104
+ */
105
+ readonly config: ScopeConfig;
106
+ private postPutSlot;
107
+ private postDeleteSlot;
108
+ private postExportSlot;
109
+ private postObjectsPersist;
110
+ preFetchObjects: OnPreFetchObjectsSlot;
111
+ private OnCompAspectReCalcSlot;
112
+ private isolator;
113
+ private aspectLoader;
114
+ private logger;
115
+ private envs;
116
+ private dependencyResolver;
117
+ private globalConfig;
118
+ componentLoader: ScopeComponentLoader;
119
+ constructor(
120
+ /**
121
+ * private reference to the instance of Harmony.
122
+ */
123
+ harmony: Harmony,
124
+ /**
125
+ * legacy scope
126
+ */
127
+ legacyScope: LegacyScope,
128
+ /**
129
+ * component extension.
130
+ */
131
+ componentExtension: ComponentMain,
132
+ /**
133
+ * slot registry for subscribing to build
134
+ */
135
+ config: ScopeConfig, postPutSlot: OnPostPutSlot, postDeleteSlot: OnPostDeleteSlot, postExportSlot: OnPostExportSlot, postObjectsPersist: OnPostObjectsPersistSlot, preFetchObjects: OnPreFetchObjectsSlot, OnCompAspectReCalcSlot: OnCompAspectReCalcSlot, isolator: IsolatorMain, aspectLoader: AspectLoaderMain, logger: Logger, envs: EnvsMain, dependencyResolver: DependencyResolverMain, globalConfig: GlobalConfigMain);
136
+ priority?: boolean | undefined;
137
+ localAspects: string[];
138
+ /**
139
+ * name of the scope
140
+ */
141
+ get name(): string;
142
+ get icon(): string | undefined;
143
+ get backgroundIconColor(): string | undefined;
144
+ get description(): string | undefined;
145
+ get path(): string;
146
+ get isLegacy(): boolean;
147
+ get isGlobalScope(): boolean;
148
+ get aspectsPackageManager(): string | undefined;
149
+ get aspectsNodeLinker(): NodeLinker | undefined;
150
+ reloadAspectsWithNewVersion(components: ConsumerComponent[]): Promise<void>;
151
+ loadAspects(ids: string[], throwOnError?: boolean | undefined, neededFor?: string | undefined, lane?: Lane, opts?: ScopeLoadAspectsOptions): Promise<string[]>;
152
+ resolveAspects(runtimeName?: string | undefined, componentIds?: ComponentID[] | undefined, opts?: ResolveAspectsOptions | undefined): Promise<AspectDefinition[]>;
153
+ getResolvedAspects(components: Component[], opts?: {
154
+ skipIfExists?: boolean;
155
+ packageManagerConfigRootDir?: string;
156
+ workspaceName?: string;
157
+ }): Promise<RequireableComponent[]>;
158
+ executeOnCompAspectReCalcSlot(component: Component): Promise<Component>;
159
+ getDependencies(component: Component): import("@teambit/dependency-resolver").DependencyList;
160
+ componentPackageName(component: Component): string;
161
+ private upsertExtensionData;
162
+ private getDataEntry;
163
+ getIsolateAspectsOpts(opts?: {
164
+ skipIfExists?: boolean;
165
+ packageManagerConfigRootDir?: string;
166
+ workspaceName?: string;
167
+ }): IsolateComponentsOptions;
168
+ getAspectCapsulePath(): string;
169
+ shouldUseHashForCapsules(): boolean;
170
+ getManyByLegacy(components: ConsumerComponent[]): Promise<Component[]>;
171
+ getScopeAspectsLoader(): ScopeAspectsLoader;
172
+ clearCache(): Promise<void>;
173
+ builderDataMapToLegacyOnTagResults(builderDataComponentMap: ComponentMap<RawBuilderData>): LegacyOnTagResult[];
174
+ /**
175
+ * register to the post-export slot.
176
+ */
177
+ onPostPut(postPutFn: OnPostPut): this;
178
+ /**
179
+ * register to the post-delete slot.
180
+ */
181
+ onPostDelete(postDeleteFn: OnPostDelete): this;
182
+ /**
183
+ * register to the post-export slot.
184
+ */
185
+ registerOnPostExport(postExportFn: OnPostExport): this;
186
+ registerOnPreFetchObjects(preFetchObjectsFn: OnPreFetchObjects): this;
187
+ registerOnCompAspectReCalc(compAspectReCalcSlotFn: OnCompAspectReCalc): void;
188
+ registerOnPostObjectsPersist(postObjectsPersistFn: OnPostObjectsPersist): this;
189
+ /**
190
+ * Will fetch a list of components into the current scope.
191
+ * This will only fetch the object and won't write the files to the actual FS
192
+ */
193
+ fetch(ids: ComponentIdList): void;
194
+ /**
195
+ * This function will get a component and sealed it's current state into the scope
196
+ *
197
+ * @param {Component[]} components A list of components to seal with specific persist options (such as message and version number)
198
+ * @param {PersistOptions} persistGeneralOptions General persistence options such as verbose
199
+ */
200
+ persist(components: Component[], options: PersistOptions): void;
201
+ delete({ ids, force, lanes }: {
202
+ ids: string[];
203
+ force: boolean;
204
+ lanes: boolean;
205
+ }, headers?: Record<string, any>): Promise<import("@teambit/legacy/dist/scope/removed-components").RemovedObjectSerialized>;
206
+ isExported(id: ComponentID): boolean;
207
+ /**
208
+ * for long-running processes, such as `bit start` or `bit watch`, it's important to keep the following data up to date:
209
+ * 1. scope-index (.bit/index.json file).
210
+ * 2. remote-refs (.bit/refs/*).
211
+ * it's possible that other commands (e.g. `bit import`) modified these files, while these processes are running.
212
+ * Because these data are kept in memory, they're not up to date anymore.
213
+ */
214
+ watchScopeInternalFiles(): Promise<void>;
215
+ toObjectList(types: Types): Promise<ObjectList>;
216
+ private toJs;
217
+ getGraph(ids?: ComponentID[]): Promise<Graph<Component, string>>;
218
+ getGraphIds(ids?: ComponentID[]): Promise<CompIdGraph>;
219
+ getFlattenedEdges(id: ComponentID): Promise<DepEdge[] | undefined>;
220
+ private getSavedGraphOfComponentIfExist;
221
+ /**
222
+ * import components into the scope.
223
+ */
224
+ import(ids: ComponentID[], { useCache, reFetchUnBuiltVersion, preferDependencyGraph, lane, reason, }?: {
225
+ /**
226
+ * if the component exists locally, don't go to the server to search for updates.
227
+ */
228
+ useCache?: boolean;
229
+ /**
230
+ * if the Version objects exists locally, but its `buildStatus` is Pending or Failed, reach the remote to find
231
+ * whether the version was already built there.
232
+ */
233
+ reFetchUnBuiltVersion?: boolean;
234
+ /**
235
+ * if the component is on a lane, provide the lane object. the component will be fetched from the lane-scope and
236
+ * not from the component-scope.
237
+ */
238
+ lane?: Lane;
239
+ /**
240
+ * if an external is missing and the remote has it with the dependency graph, don't fetch all its dependencies
241
+ */
242
+ preferDependencyGraph?: boolean;
243
+ /**
244
+ * reason why this import is needed (to show in the terminal)
245
+ */
246
+ reason?: string;
247
+ }): Promise<void>;
248
+ get(id: ComponentID, useCache?: boolean, importIfMissing?: boolean): Promise<Component | undefined>;
249
+ getFromConsumerComponent(consumerComponent: ConsumerComponent): Promise<Component>;
250
+ /**
251
+ * get a component from a remote without importing it
252
+ */
253
+ getRemoteComponent(id: ComponentID): Promise<Component>;
254
+ /**
255
+ * get a component from a remote without importing it
256
+ */
257
+ getManyRemoteComponents(ids: ComponentID[]): Promise<Component[]>;
258
+ /**
259
+ * list all components in the scope.
260
+ */
261
+ list(filter?: {
262
+ offset: number;
263
+ limit: number;
264
+ namespaces?: string[];
265
+ }, includeCache?: boolean, includeFromLanes?: boolean, includeDeleted?: boolean): Promise<Component[]>;
266
+ /**
267
+ * for now, list of invalid components are mostly useful for the workspace.
268
+ * in the future, this can return components that failed to load in the scope due to objects file
269
+ * corruption or similar issues.
270
+ */
271
+ listInvalid(): Promise<never[]>;
272
+ /**
273
+ * get ids of all scope components.
274
+ * @param includeCache whether or not include components that their scope-name is different than the current scope-name
275
+ */
276
+ listIds(includeCache?: boolean, includeFromLanes?: boolean, patterns?: string[]): Promise<ComponentID[]>;
277
+ /**
278
+ * Check if a specific id exist in the scope
279
+ * @param componentId
280
+ */
281
+ hasId(componentId: ComponentID, includeCache?: boolean): Promise<boolean>;
282
+ hasIdNested(componentId: ComponentID, includeCache?: boolean): Promise<boolean>;
283
+ /**
284
+ * determine whether a component exists in the scope.
285
+ */
286
+ exists(modelComponent: ModelComponent): boolean;
287
+ getMany(ids: ComponentID[], throwIfNotExist?: boolean): Promise<Component[]>;
288
+ /**
289
+ * important! you probably want to use `getMany`, which returns the components from the scope.
290
+ * this method loads all aspects of the loaded components. (which hurts performance)
291
+ */
292
+ loadMany(ids: ComponentID[], lane?: Lane, opts?: LoadOptions): Promise<Component[]>;
293
+ loadManyCompsAspects(components: Component[], lane?: Lane): Promise<Component[]>;
294
+ /**
295
+ * get a component and throw an exception if not found.
296
+ * @param id component id
297
+ */
298
+ getOrThrow(id: ComponentID): Promise<Component>;
299
+ /**
300
+ * returns a specific state of a component.
301
+ * @param id component ID.
302
+ * @param hash state hash.
303
+ */
304
+ getState(id: ComponentID, hash: string): Promise<State>;
305
+ getSnap(id: ComponentID, hash: string): Promise<Snap>;
306
+ /**
307
+ * get component log sorted by the timestamp in ascending order (from the earliest to the latest)
308
+ */
309
+ getLogs(id: ComponentID, shortHash?: boolean, startsFrom?: string): Promise<ComponentLog[]>;
310
+ getStagedConfig(): Promise<StagedConfig>;
311
+ /**
312
+ * wether a component is soft-removed.
313
+ * the version is required as it can be removed on a lane. in which case, the version is the head in the lane.
314
+ */
315
+ isComponentRemoved(id: ComponentID): Promise<Boolean>;
316
+ /**
317
+ * resolve a component ID.
318
+ * @param id component ID.
319
+ */
320
+ resolveComponentId(id: string | BitId | ComponentID): Promise<ComponentID>;
321
+ private resolveComponentIdFromBitId;
322
+ resolveMultipleComponentIds(ids: Array<string | ComponentID | ComponentID>): Promise<ComponentID[]>;
323
+ /**
324
+ * @deprecated use `this.idsByPattern` instead for consistency, which supports also negation and list of patterns.
325
+ */
326
+ byPattern(patterns: string[], scope?: string): Promise<Component[]>;
327
+ /**
328
+ * get component-ids matching the given pattern. a pattern can have multiple patterns separated by a comma.
329
+ * it uses multimatch (https://www.npmjs.com/package/multimatch) package for the matching algorithm, which supports
330
+ * (among others) negate character "!" to exclude ids. See the package page for more supported characters.
331
+ */
332
+ idsByPattern(pattern: string, throwForNoMatch?: boolean): Promise<ComponentID[]>;
333
+ filterIdsFromPoolIdsByPattern(pattern: string, ids: ComponentID[], throwForNoMatch?: boolean, filterByStateFunc?: (state: any, poolIds: ComponentID[]) => Promise<ComponentID[]>): Promise<ComponentID[]>;
334
+ getSnapDistance(id: ComponentID, throws?: boolean): Promise<SnapsDistance>;
335
+ /**
336
+ * get the distance for a component between two lanes. for example, lane-b forked from lane-a and lane-b added some new snaps
337
+ * @param componentId
338
+ * @param sourceHead head on the source lane. leave empty if the source is main
339
+ * @param targetHead head on the target lane. leave empty if the target is main
340
+ * @returns
341
+ */
342
+ getSnapsDistanceBetweenTwoSnaps(componentId: ComponentID, sourceHead?: string, targetHead?: string, throws?: boolean): Promise<SnapsDistance>;
343
+ getExactVersionBySemverRange(id: ComponentID, range: string): Promise<string | undefined>;
344
+ resumeExport(exportId: string, remotes: string[]): Promise<string[]>;
345
+ /**
346
+ * @deprecated use `this.resolveComponentId` instead.
347
+ */
348
+ resolveId(id: string): Promise<ComponentID>;
349
+ _legacyRemotes(): Promise<Remotes>;
350
+ /**
351
+ * list all component ids from a remote-scope
352
+ */
353
+ listRemoteScope(scopeName: string): Promise<ComponentID[]>;
354
+ getLegacyMinimal(id: ComponentID): Promise<ConsumerComponent | undefined>;
355
+ /**
356
+ * ModelComponent is of type `BitObject` which gets saved into the local scope as an object file.
357
+ * It has data about the tags and the component head. It doesn't have any data about the source-files/artifacts etc.
358
+ */
359
+ getBitObjectModelComponent(id: ComponentID, throwIfNotExist?: boolean): Promise<ModelComponent | undefined>;
360
+ /**
361
+ * Version BitObject holds the data of the source files and build artifacts of a specific snap/tag.
362
+ */
363
+ getBitObjectVersion(modelComponent: ModelComponent, version: string, throwIfNotExist?: boolean): Promise<Version | undefined>;
364
+ getBitObjectVersionById(id: ComponentID, throwIfNotExist?: boolean): Promise<Version | undefined>;
365
+ /**
366
+ * get a component and load its aspect
367
+ */
368
+ load(id: ComponentID, lane?: Lane, opts?: LoadOptions): Promise<Component | undefined>;
369
+ loadCompAspects(component: Component, lane?: Lane, opts?: LoadOptions): Promise<Component>;
370
+ loadComponentsAspect(component: Component): Promise<void>;
371
+ addAspectsFromConfigObject(component: Component, configObject: Record<string, any>): Promise<void>;
372
+ createAspectListFromExtensionDataList(extensionDataList: ExtensionDataList): Promise<import("@teambit/component").AspectList>;
373
+ private extensionDataEntryToAspectEntry;
374
+ getLastMergedPath(): string;
375
+ isModified(): Promise<boolean>;
376
+ write(): Promise<void>;
377
+ /**
378
+ * declare the slots of scope extension.
379
+ */
380
+ static slots: (((registerFn: () => string) => SlotRegistry<OnPostPut>) | ((registerFn: () => string) => SlotRegistry<OnPostObjectsPersist>) | ((registerFn: () => string) => SlotRegistry<OnPreFetchObjects>) | ((registerFn: () => string) => SlotRegistry<OnCompAspectReCalc>))[];
381
+ static runtime: import("@teambit/harmony").RuntimeDefinition;
382
+ static dependencies: import("@teambit/harmony").Aspect[];
383
+ static defaultConfig: ScopeConfig;
384
+ static provider([componentExt, ui, graphql, cli, isolator, aspectLoader, express, loggerMain, envs, depsResolver, globalConfig]: [
385
+ ComponentMain,
386
+ UiMain,
387
+ GraphqlMain,
388
+ CLIMain,
389
+ IsolatorMain,
390
+ AspectLoaderMain,
391
+ ExpressMain,
392
+ LoggerMain,
393
+ EnvsMain,
394
+ DependencyResolverMain,
395
+ GlobalConfigMain
396
+ ], config: ScopeConfig, [postPutSlot, postDeleteSlot, postExportSlot, postObjectsPersistSlot, preFetchObjectsSlot, OnCompAspectReCalcSlot,]: [
397
+ OnPostPutSlot,
398
+ OnPostDeleteSlot,
399
+ OnPostExportSlot,
400
+ OnPostObjectsPersistSlot,
401
+ OnPreFetchObjectsSlot,
402
+ OnCompAspectReCalcSlot
403
+ ], harmony: Harmony): Promise<ScopeMain | undefined>;
404
+ }
405
+ export {};
@@ -496,6 +496,9 @@ class ScopeMain {
496
496
  getDependencies(component) {
497
497
  return this.dependencyResolver.getDependencies(component);
498
498
  }
499
+ componentPackageName(component) {
500
+ return this.dependencyResolver.getPackageName(component);
501
+ }
499
502
  async upsertExtensionData(component, extension, data) {
500
503
  if (!data) return;
501
504
  const existingExtension = component.state._consumer.extensions.findExtension(extension);