1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.DIR_TARGET = exports.DEFAULT_TARGET = exports.Target = exports.Platform = void 0;
|
4 | const builder_util_1 = require("builder-util");
|
5 | class Platform {
|
6 | constructor(name, buildConfigurationKey, nodeName) {
|
7 | this.name = name;
|
8 | this.buildConfigurationKey = buildConfigurationKey;
|
9 | this.nodeName = nodeName;
|
10 | }
|
11 | toString() {
|
12 | return this.name;
|
13 | }
|
14 | createTarget(type, ...archs) {
|
15 | if (type == null && (archs == null || archs.length === 0)) {
|
16 | return new Map([[this, new Map()]]);
|
17 | }
|
18 | const archToType = new Map();
|
19 | for (const arch of archs == null || archs.length === 0 ? [(0, builder_util_1.archFromString)(process.arch)] : archs) {
|
20 | archToType.set(arch, type == null ? [] : Array.isArray(type) ? type : [type]);
|
21 | }
|
22 | return new Map([[this, archToType]]);
|
23 | }
|
24 | static current() {
|
25 | return Platform.fromString(process.platform);
|
26 | }
|
27 | static fromString(name) {
|
28 | name = name.toLowerCase();
|
29 | switch (name) {
|
30 | case Platform.MAC.nodeName:
|
31 | case Platform.MAC.name:
|
32 | return Platform.MAC;
|
33 | case Platform.WINDOWS.nodeName:
|
34 | case Platform.WINDOWS.name:
|
35 | case Platform.WINDOWS.buildConfigurationKey:
|
36 | return Platform.WINDOWS;
|
37 | case Platform.LINUX.nodeName:
|
38 | return Platform.LINUX;
|
39 | default:
|
40 | throw new Error(`Unknown platform: ${name}`);
|
41 | }
|
42 | }
|
43 | }
|
44 | exports.Platform = Platform;
|
45 | Platform.MAC = new Platform("mac", "mac", "darwin");
|
46 | Platform.LINUX = new Platform("linux", "linux", "linux");
|
47 | Platform.WINDOWS = new Platform("windows", "win", "win32");
|
48 | class Target {
|
49 | constructor(name, isAsyncSupported = true) {
|
50 | this.name = name;
|
51 | this.isAsyncSupported = isAsyncSupported;
|
52 | }
|
53 | async checkOptions() {
|
54 |
|
55 | }
|
56 | finishBuild() {
|
57 | return Promise.resolve();
|
58 | }
|
59 | }
|
60 | exports.Target = Target;
|
61 | exports.DEFAULT_TARGET = "default";
|
62 | exports.DIR_TARGET = "dir";
|
63 |
|
\ | No newline at end of file |