forked from preconstruct/preconstruct
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.ts
39 lines (37 loc) 路 839 Bytes
/
entrypoint.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import nodePath from "path";
import { Item } from "./item";
import { Package } from "./package";
import { JSONValue } from "./utils";
import normalizePath from "normalize-path";
export class Entrypoint extends Item<{
main?: JSONValue;
module?: JSONValue;
"umd:main"?: JSONValue;
browser?: JSONValue;
worker?: JSONValue;
preconstruct: {
source?: JSONValue;
umdName?: JSONValue;
};
}> {
package: Package;
source: string;
constructor(
filePath: string,
contents: string,
pkg: Package,
source: string
) {
super(filePath, contents, pkg._jsonDataByPath);
this.package = pkg;
this.source = source;
}
get name(): string {
return normalizePath(
nodePath.join(
this.package.name,
nodePath.relative(this.package.directory, this.directory)
)
);
}
}