@teambit/aspect-loader 1.0.107 → 1.0.108

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.
@@ -0,0 +1,51 @@
1
+ import { Component } from '@teambit/component';
2
+
3
+ export type AspectDefinitionProps = {
4
+ id?: string;
5
+ component?: Component;
6
+ aspectPath: string;
7
+ runtimePath: string | null;
8
+ aspectFilePath: string | null;
9
+ local?: boolean;
10
+ };
11
+
12
+ export class AspectDefinition {
13
+ constructor(
14
+ /**
15
+ * path to the root directory of the aspect module.
16
+ */
17
+ readonly aspectPath: string,
18
+
19
+ /**
20
+ * path to the aspect file (.aspect).
21
+ */
22
+ readonly aspectFilePath: string | null,
23
+
24
+ /**
25
+ * path to the runtime entry
26
+ */
27
+ readonly runtimePath: string | null,
28
+ /**
29
+ * aspect component
30
+ */
31
+ readonly component?: Component,
32
+ /**
33
+ * id of the component (used instead of component in the case of core aspect)
34
+ */
35
+ readonly id?: string,
36
+ /**
37
+ * aspect defined using 'file://' protocol
38
+ */
39
+ readonly local?: boolean
40
+ ) {}
41
+
42
+ get getId() {
43
+ if (this.component) return this.component.id.toString();
44
+ if (this.id) return this.id;
45
+ return null;
46
+ }
47
+
48
+ static from({ component, aspectPath, aspectFilePath, runtimePath, id, local }: AspectDefinitionProps) {
49
+ return new AspectDefinition(aspectPath, aspectFilePath, runtimePath, component, id, local);
50
+ }
51
+ }
@@ -0,0 +1,8 @@
1
+ import { Aspect } from '@teambit/harmony';
2
+
3
+ export const AspectLoaderAspect = Aspect.create({
4
+ id: 'teambit.harmony/aspect-loader',
5
+ dependencies: [],
6
+ });
7
+
8
+ export default AspectLoaderAspect;