@webspatial/builder 1.6.1 → 2.0.0
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/dist/index.js +3 -2
- package/dist/lib/cmds/build.js +4 -1
- package/dist/lib/cmds/launch.js +4 -1
- package/dist/lib/cmds/shutdown.js +4 -1
- package/dist/lib/cmds/test.js +1 -126
- package/dist/lib/cmds/version.js +35 -2
- package/dist/lib/pwa/index.d.ts +0 -1
- package/dist/lib/pwa/index.js +34 -3
- package/dist/lib/pwa/validate.js +3 -3
- package/dist/lib/resource/file.js +34 -1
- package/dist/lib/resource/imageHelper.d.ts +2 -3
- package/dist/lib/resource/imageHelper.js +40 -3
- package/dist/lib/resource/index.d.ts +1 -2
- package/dist/lib/resource/index.js +35 -2
- package/dist/lib/resource/load.d.ts +2 -3
- package/dist/lib/resource/load.js +37 -4
- package/dist/lib/utils/FetchUtils-1.d.ts +0 -2
- package/dist/lib/utils/FetchUtils-1.js +0 -4
- package/dist/lib/utils/fetch.js +35 -2
- package/dist/lib/utils/history.js +34 -1
- package/dist/lib/utils/utils.js +34 -1
- package/dist/lib/xcode/index.js +6 -3
- package/dist/lib/xcode/xcodebuild.js +35 -2
- package/dist/lib/xcode/xcodeproject.js +41 -6
- package/dist/lib/xcode/xcrun.d.ts +0 -1
- package/dist/lib/xcode/xcrun.js +43 -8
- package/package.json +6 -5
package/dist/index.js
CHANGED
|
@@ -9,10 +9,11 @@ const fetch_1 = require("./lib/utils/fetch");
|
|
|
9
9
|
const launch_1 = require("./lib/cmds/launch");
|
|
10
10
|
const shutdown_1 = require("./lib/cmds/shutdown");
|
|
11
11
|
const test_1 = require("./lib/cmds/test");
|
|
12
|
+
const MIN_SUPPORTED_NODE_MAJOR = 22;
|
|
12
13
|
module.exports = async () => {
|
|
13
|
-
if ((0, semver_1.major)(process.versions.node) <
|
|
14
|
+
if ((0, semver_1.major)(process.versions.node) < MIN_SUPPORTED_NODE_MAJOR) {
|
|
14
15
|
throw new Error(`Current Node.js version is ${process.versions.node}.` +
|
|
15
|
-
|
|
16
|
+
` Node.js version ${MIN_SUPPORTED_NODE_MAJOR} or above is required to run XRAPP BUILDER.`);
|
|
16
17
|
}
|
|
17
18
|
const program = new commander_1.Command();
|
|
18
19
|
FetchUtils_1_1.fetchUtils.setFetch(fetch_1.fetch);
|
package/dist/lib/cmds/build.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.build = build;
|
|
4
7
|
exports.store = store;
|
|
@@ -7,7 +10,7 @@ const pwa_1 = require("../pwa");
|
|
|
7
10
|
const resource_1 = require("../resource");
|
|
8
11
|
const xcode_1 = require("../xcode");
|
|
9
12
|
const check_1 = require("./check");
|
|
10
|
-
const history_1 = require("../utils/history");
|
|
13
|
+
const history_1 = __importDefault(require("../utils/history"));
|
|
11
14
|
// build and export ipa
|
|
12
15
|
async function build(args) {
|
|
13
16
|
var _a;
|
package/dist/lib/cmds/launch.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.launch = launch;
|
|
4
|
-
const xcrun_1 = require("../xcode/xcrun");
|
|
7
|
+
const xcrun_1 = __importDefault(require("../xcode/xcrun"));
|
|
5
8
|
async function launch(args) {
|
|
6
9
|
var _a;
|
|
7
10
|
const bundleId = (_a = args['bundleId']) !== null && _a !== void 0 ? _a : 'com.webspatial.test';
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.shutdown = shutdown;
|
|
4
|
-
const xcrun_1 = require("../xcode/xcrun");
|
|
7
|
+
const xcrun_1 = __importDefault(require("../xcode/xcrun"));
|
|
5
8
|
async function shutdown(args) {
|
|
6
9
|
xcrun_1.default.shutdownSimulator();
|
|
7
10
|
return true;
|
package/dist/lib/cmds/test.js
CHANGED
|
@@ -1,129 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.test = test;
|
|
4
|
-
|
|
5
|
-
function configStartUrl(manifestStartUrl, base, manifestUrl, isNet) {
|
|
6
|
-
let start_url = manifestStartUrl !== null && manifestStartUrl !== void 0 ? manifestStartUrl : '/index.html';
|
|
7
|
-
if (!start_url.match(/\.html(\?|$)/)) {
|
|
8
|
-
const [path, query] = start_url.split('?');
|
|
9
|
-
start_url = path.endsWith('/') ? `${path}index.html` : `${path}/index.html`;
|
|
10
|
-
if (query)
|
|
11
|
-
start_url += `?${query}`;
|
|
12
|
-
}
|
|
13
|
-
const isStartUrl = validateURL(start_url);
|
|
14
|
-
const hasBase = base.length > 0;
|
|
15
|
-
if (hasBase) {
|
|
16
|
-
const isBaseUrl = validateURL(base);
|
|
17
|
-
if (!isStartUrl && !isBaseUrl) {
|
|
18
|
-
const staticWebRoot = (0, path_1.resolve)('./static-web');
|
|
19
|
-
let resolvedPath = (0, path_1.join)(base, start_url);
|
|
20
|
-
const normalizedPath = (0, path_1.normalize)(resolvedPath);
|
|
21
|
-
const safePath = (0, path_1.join)(staticWebRoot, normalizedPath);
|
|
22
|
-
start_url = (0, path_1.relative)(process.cwd(), safePath)
|
|
23
|
-
.replace(/^(\.\.\/)+/, './')
|
|
24
|
-
.replace(/\/$/, '');
|
|
25
|
-
}
|
|
26
|
-
else if (isStartUrl && !isBaseUrl) {
|
|
27
|
-
const startUrl = new URL(start_url);
|
|
28
|
-
const fullPath = (0, path_1.join)(base, startUrl.pathname) + startUrl.search + startUrl.hash;
|
|
29
|
-
let newBase = new URL('/', startUrl.origin);
|
|
30
|
-
start_url = new URL(fullPath, newBase).href;
|
|
31
|
-
}
|
|
32
|
-
else if (!isStartUrl && isBaseUrl) {
|
|
33
|
-
if (start_url.startsWith('/')) {
|
|
34
|
-
const baseUrl = new URL(base);
|
|
35
|
-
start_url = baseUrl.origin + (0, path_1.join)(baseUrl.pathname, start_url);
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
start_url = new URL(start_url, base).href;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
else if (isStartUrl && isBaseUrl) {
|
|
42
|
-
const startUrl = new URL(start_url);
|
|
43
|
-
const baseUrl = new URL(base);
|
|
44
|
-
const startFullPath = startUrl.pathname + startUrl.search + startUrl.hash;
|
|
45
|
-
start_url = new URL(startFullPath, baseUrl.origin + baseUrl.pathname).href;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
if (isNet) {
|
|
50
|
-
const murl = new URL(manifestUrl);
|
|
51
|
-
if (!isStartUrl) {
|
|
52
|
-
const newStartUrl = new URL(start_url, murl.origin);
|
|
53
|
-
start_url = newStartUrl.href;
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
const startUrl = new URL(start_url);
|
|
57
|
-
start_url =
|
|
58
|
-
murl.origin + startUrl.pathname + startUrl.search + startUrl.hash;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
else if (!isStartUrl) {
|
|
62
|
-
const staticWebRoot = (0, path_1.resolve)('./static-web');
|
|
63
|
-
const resolvedPath = (0, path_1.resolve)(staticWebRoot, start_url);
|
|
64
|
-
const normalizedPath = (0, path_1.normalize)(resolvedPath);
|
|
65
|
-
const safePath = (0, path_1.join)(staticWebRoot, normalizedPath);
|
|
66
|
-
start_url = (0, path_1.relative)(process.cwd(), safePath)
|
|
67
|
-
.replace(/^(\.\.\/)+/, './')
|
|
68
|
-
.replace(/\/$/, '');
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return start_url;
|
|
72
|
-
}
|
|
73
|
-
function configScope(start_url, scope) {
|
|
74
|
-
const isStartUrl = validateURL(start_url);
|
|
75
|
-
const isUrl = validateURL(scope);
|
|
76
|
-
if (isStartUrl && isUrl) {
|
|
77
|
-
const scopeURL = new URL(scope);
|
|
78
|
-
const startURL = new URL(start_url);
|
|
79
|
-
if (scopeURL.host !== startURL.host || start_url.indexOf(scope) !== 0) {
|
|
80
|
-
scope = parseRouter(start_url);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
else if (isStartUrl && !isUrl) {
|
|
84
|
-
scope = new URL(scope, start_url).href;
|
|
85
|
-
}
|
|
86
|
-
else if (!isStartUrl && isUrl) {
|
|
87
|
-
const cleanPath = start_url.replace(/\/[^\/]+$/, '');
|
|
88
|
-
scope = (0, path_1.normalize)(cleanPath + '/');
|
|
89
|
-
}
|
|
90
|
-
// else {
|
|
91
|
-
// scope = join(parseRouter(start_url), scope)
|
|
92
|
-
// }
|
|
93
|
-
// scope = scope
|
|
94
|
-
return scope;
|
|
95
|
-
}
|
|
96
|
-
function validateURL(url) {
|
|
97
|
-
try {
|
|
98
|
-
new URL(url);
|
|
99
|
-
return true;
|
|
100
|
-
}
|
|
101
|
-
catch (error) {
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
function parseRouter(url) {
|
|
106
|
-
let urlParts = url.split('/');
|
|
107
|
-
urlParts.pop();
|
|
108
|
-
let pathUrl = urlParts.join();
|
|
109
|
-
while (pathUrl.indexOf(',') >= 0) {
|
|
110
|
-
pathUrl = pathUrl.replace(',', '/');
|
|
111
|
-
}
|
|
112
|
-
return pathUrl;
|
|
113
|
-
}
|
|
114
|
-
function testStartUrl() {
|
|
115
|
-
console.log(configStartUrl('/', '', '/manifest.json', false));
|
|
116
|
-
console.log(configStartUrl('http://www.baidu.com', '', 'http://www.baidu.com/manifest.json', true));
|
|
117
|
-
console.log(configStartUrl('/', '/', '/manifest.json', false));
|
|
118
|
-
console.log(configStartUrl('/a.html?a=1', '/', '/manifest.json', false));
|
|
119
|
-
console.log(configStartUrl('http://www.baidu.com/test/a.html?a=1', '/xx', '/manifest.json', false));
|
|
120
|
-
console.log(configStartUrl('http://www.baidu.com/a.html?a=1', 'http://www.google.com/test', '/manifest.json', false));
|
|
121
|
-
console.log(configStartUrl('/test/index.html', '/public/aaa', '/manifest.json', false));
|
|
122
|
-
}
|
|
123
|
-
function testScope() {
|
|
124
|
-
console.log(configScope('/test/index.html', '/test'));
|
|
125
|
-
}
|
|
126
|
-
function test() {
|
|
127
|
-
// testStartUrl()
|
|
128
|
-
// testScope()
|
|
129
|
-
}
|
|
4
|
+
function test() { }
|
package/dist/lib/cmds/version.js
CHANGED
|
@@ -1,8 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.getVersion = getVersion;
|
|
4
|
-
const fs = require("fs");
|
|
5
|
-
const path = require("path");
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
6
39
|
async function getVersion() {
|
|
7
40
|
const packageJsonFile = path.join(__dirname, '../../../package.json');
|
|
8
41
|
const packageJsonContents = await (await fs.promises.readFile(packageJsonFile)).toString();
|
package/dist/lib/pwa/index.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export declare class PWAGenerator {
|
|
|
3
3
|
static DisplayModes: string[];
|
|
4
4
|
private static defaultBundleId;
|
|
5
5
|
private static defaultManifestJson;
|
|
6
|
-
private static useDefaultManifestJson;
|
|
7
6
|
static generator(args: PWAInitArgs, isDev?: boolean): Promise<ManifestInfo>;
|
|
8
7
|
static validate(args: PWAInitArgs, isDev?: boolean): Promise<ManifestInfo>;
|
|
9
8
|
private static compareManifest;
|
package/dist/lib/pwa/index.js
CHANGED
|
@@ -1,11 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.PWAGenerator = void 0;
|
|
4
37
|
const path_1 = require("path");
|
|
5
38
|
const config_1 = require("./config");
|
|
6
39
|
const load_1 = require("../resource/load");
|
|
7
40
|
const validate_1 = require("./validate");
|
|
8
|
-
const fs = require("fs");
|
|
41
|
+
const fs = __importStar(require("fs"));
|
|
9
42
|
const utils_1 = require("../utils/utils");
|
|
10
43
|
class PWAGenerator {
|
|
11
44
|
static async generator(args, isDev = false) {
|
|
@@ -51,7 +84,6 @@ class PWAGenerator {
|
|
|
51
84
|
: await (0, load_1.loadJsonFromDisk)(url);
|
|
52
85
|
manifest =
|
|
53
86
|
isDev && !useDefault ? this.compareManifest(manifest) : manifest;
|
|
54
|
-
this.useDefaultManifestJson = useDefault;
|
|
55
87
|
}
|
|
56
88
|
// check manifest.json
|
|
57
89
|
(0, validate_1.checkManifestJson)(manifest, isDev);
|
|
@@ -103,4 +135,3 @@ PWAGenerator.defaultManifestJson = {
|
|
|
103
135
|
start_url: '/',
|
|
104
136
|
scope: '/',
|
|
105
137
|
};
|
|
106
|
-
PWAGenerator.useDefaultManifestJson = false;
|
package/dist/lib/pwa/validate.js
CHANGED
|
@@ -106,10 +106,10 @@ async function checkIcons(manifest, manifestUrl, isDev = false) {
|
|
|
106
106
|
image = !imgUrl.startsWith('http')
|
|
107
107
|
? await (0, load_1.loadImageFromDisk)(imgUrl)
|
|
108
108
|
: await (0, load_1.loadImageFromNet)(imgUrl);
|
|
109
|
-
if (image.
|
|
109
|
+
if (image.width >= 1024 && image.height >= 1024) {
|
|
110
110
|
has1024 = true;
|
|
111
|
-
if (image.
|
|
112
|
-
imageSize = image.
|
|
111
|
+
if (image.width > imageSize) {
|
|
112
|
+
imageSize = image.width;
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -1,8 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.copyDir = copyDir;
|
|
4
37
|
exports.clearDir = clearDir;
|
|
5
|
-
const fs = require("fs");
|
|
38
|
+
const fs = __importStar(require("fs"));
|
|
6
39
|
function copyDir(from, to) {
|
|
7
40
|
const paths = fs.readdirSync(from);
|
|
8
41
|
paths.forEach(path => {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import Jimp = require('jimp');
|
|
2
1
|
export declare class ImageHelper {
|
|
3
|
-
static createImg(size: number):
|
|
2
|
+
static createImg(size: number): any;
|
|
4
3
|
static webp2PngBuffer(buffer: Buffer): Promise<Buffer>;
|
|
5
4
|
static svg2img(svg: string): Promise<Buffer>;
|
|
6
|
-
static isFullyOpaque(image:
|
|
5
|
+
static isFullyOpaque(image: any): boolean;
|
|
7
6
|
}
|
|
@@ -1,12 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.ImageHelper = void 0;
|
|
4
|
-
const
|
|
37
|
+
const JimpModule = __importStar(require("jimp"));
|
|
5
38
|
const sharp = require("sharp");
|
|
6
39
|
const resvg_js_1 = require("@resvg/resvg-js");
|
|
7
40
|
class ImageHelper {
|
|
8
41
|
static createImg(size) {
|
|
9
|
-
return new Jimp(
|
|
42
|
+
return new JimpModule.Jimp({
|
|
43
|
+
width: size,
|
|
44
|
+
height: size,
|
|
45
|
+
color: 0x00000000,
|
|
46
|
+
});
|
|
10
47
|
}
|
|
11
48
|
static async webp2PngBuffer(buffer) {
|
|
12
49
|
return await sharp(buffer).toFormat('png').toBuffer();
|
|
@@ -24,7 +61,7 @@ class ImageHelper {
|
|
|
24
61
|
return pngBuffer;
|
|
25
62
|
}
|
|
26
63
|
static isFullyOpaque(image) {
|
|
27
|
-
const pixelNum = image.
|
|
64
|
+
const pixelNum = image.width * image.height;
|
|
28
65
|
for (var i = 0; i < pixelNum; i++) {
|
|
29
66
|
const idx = i * 4 + 3;
|
|
30
67
|
if (image.bitmap.data[idx] < 255) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ManifestInfo } from '../types';
|
|
2
|
-
import * as Jimp from 'jimp';
|
|
3
2
|
export declare let PROJECT_DIRECTORY: string;
|
|
4
3
|
export declare let PROJECT_BUILD_DIRECTORY: string;
|
|
5
4
|
export declare let PROJECT_EXPORT_DIRECTORY: string;
|
|
@@ -11,7 +10,7 @@ export declare const MIDDLE_APPICON_DIRECTORY: string;
|
|
|
11
10
|
export declare const LOGO_DIRECTORY: string;
|
|
12
11
|
export declare class ResourceManager {
|
|
13
12
|
static moveProjectFrom(dir: string): Promise<void>;
|
|
14
|
-
static generateIcon(info: ManifestInfo): Promise<
|
|
13
|
+
static generateIcon(info: ManifestInfo): Promise<any>;
|
|
15
14
|
static initPlatform(platform: string): void;
|
|
16
15
|
static setupTempPath(platform: string): void;
|
|
17
16
|
/**
|
|
@@ -1,7 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.ResourceManager = exports.LOGO_DIRECTORY = exports.MIDDLE_APPICON_DIRECTORY = exports.BACK_APPICON_DIRECTORY = exports.ASSET_DIRECTORY = exports.WEB_PROJECT_DIRECTORY = exports.PROJECT_TEST_DIRECTORY = exports.PROJECT_EXPORT_DIRECTORY = exports.PROJECT_BUILD_DIRECTORY = exports.PROJECT_DIRECTORY = void 0;
|
|
4
|
-
const fs = require("fs");
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
5
38
|
const path_1 = require("path");
|
|
6
39
|
const file_1 = require("./file");
|
|
7
40
|
const load_1 = require("./load");
|
|
@@ -44,7 +77,7 @@ class ResourceManager {
|
|
|
44
77
|
const icon = !imgUrl.startsWith('http')
|
|
45
78
|
? await (0, load_1.loadImageFromDisk)(imgUrl)
|
|
46
79
|
: await (0, load_1.loadImageFromNet)(imgUrl);
|
|
47
|
-
icon.resize(1024, 1024);
|
|
80
|
+
icon.resize({ w: 1024, h: 1024 });
|
|
48
81
|
return icon;
|
|
49
82
|
}
|
|
50
83
|
static initPlatform(platform) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import Jimp = require('jimp');
|
|
2
1
|
export declare function loadJsonFromNet(url: String): Promise<Record<string, any>>;
|
|
3
2
|
export declare function loadJsonFromDisk(url: String): Promise<Record<string, any>>;
|
|
4
|
-
export declare function loadImageFromNet(src: string): Promise<
|
|
5
|
-
export declare function loadImageFromDisk(src: string): Promise<
|
|
3
|
+
export declare function loadImageFromNet(src: string): Promise<any>;
|
|
4
|
+
export declare function loadImageFromDisk(src: string): Promise<any>;
|
|
6
5
|
export declare function loadFileString(url: String): Promise<string>;
|
|
@@ -1,14 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.loadJsonFromNet = loadJsonFromNet;
|
|
4
37
|
exports.loadJsonFromDisk = loadJsonFromDisk;
|
|
5
38
|
exports.loadImageFromNet = loadImageFromNet;
|
|
6
39
|
exports.loadImageFromDisk = loadImageFromDisk;
|
|
7
40
|
exports.loadFileString = loadFileString;
|
|
8
|
-
const fs = require("fs");
|
|
41
|
+
const fs = __importStar(require("fs"));
|
|
9
42
|
const FetchUtils_1_1 = require("../utils/FetchUtils-1");
|
|
10
43
|
const CustomError_1 = require("../utils/CustomError");
|
|
11
|
-
const
|
|
44
|
+
const JimpModule = __importStar(require("jimp"));
|
|
12
45
|
const imageHelper_1 = require("./imageHelper");
|
|
13
46
|
async function loadJsonFromNet(url) {
|
|
14
47
|
const response = await FetchUtils_1_1.fetchUtils.fetch(url, { encoding: 'binary' });
|
|
@@ -110,10 +143,10 @@ async function loadImageFromNet(src) {
|
|
|
110
143
|
if (contentType.startsWith('image/webp')) {
|
|
111
144
|
body = await imageHelper_1.ImageHelper.webp2PngBuffer(body);
|
|
112
145
|
}
|
|
113
|
-
return await Jimp.read(Buffer.from(body));
|
|
146
|
+
return await JimpModule.Jimp.read(Buffer.from(body));
|
|
114
147
|
}
|
|
115
148
|
async function loadImageFromDisk(src) {
|
|
116
|
-
return await Jimp.read(src);
|
|
149
|
+
return await JimpModule.Jimp.read(src);
|
|
117
150
|
}
|
|
118
151
|
async function loadFileString(url) {
|
|
119
152
|
let file = await fs.promises.readFile(url.toString());
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
declare class FetchUtils {
|
|
2
|
-
private fetchEngine;
|
|
3
2
|
fetch: any;
|
|
4
3
|
downloadFile: any;
|
|
5
4
|
decompressResponseBuffer: any;
|
|
6
|
-
setFetchEngine(newFetchEngine: any): void;
|
|
7
5
|
setFetch(newFetch: any): void;
|
|
8
6
|
setDownloadFile(newDownloadFile: any): void;
|
|
9
7
|
setDecompressResponseBuffer(newDecompressResponseBuffer: any): void;
|
|
@@ -3,14 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.fetchUtils = void 0;
|
|
4
4
|
class FetchUtils {
|
|
5
5
|
constructor() {
|
|
6
|
-
this.fetchEngine = null;
|
|
7
6
|
this.fetch = null;
|
|
8
7
|
this.downloadFile = null;
|
|
9
8
|
this.decompressResponseBuffer = null;
|
|
10
9
|
}
|
|
11
|
-
setFetchEngine(newFetchEngine) {
|
|
12
|
-
this.fetchEngine = newFetchEngine;
|
|
13
|
-
}
|
|
14
10
|
setFetch(newFetch) {
|
|
15
11
|
this.fetch = newFetch;
|
|
16
12
|
}
|
package/dist/lib/utils/fetch.js
CHANGED
|
@@ -1,11 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.fetch = fetch;
|
|
4
37
|
exports.downloadFile = downloadFile;
|
|
5
38
|
exports.decompressResponseBuffer = decompressResponseBuffer;
|
|
6
39
|
const fetch_h2_1 = require("fetch-h2");
|
|
7
|
-
const fs = require("fs");
|
|
8
|
-
const zlib = require("zlib");
|
|
40
|
+
const fs = __importStar(require("fs"));
|
|
41
|
+
const zlib = __importStar(require("zlib"));
|
|
9
42
|
// const userAgent = 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0';
|
|
10
43
|
const userAgent = 'Mozilla/5.0 (X11; Linux x86_64; PICO 4 OS5.5.0 like Quest) AppleWebKit/537.36 (KHTML, like Gecko) PicoBrowser/3.3.24 Chrome/105.0.5195.68 VR Safari/537.36 OculusBrowser/7.0';
|
|
11
44
|
const fetchh2Ctx = (0, fetch_h2_1.context)({ userAgent: userAgent, overwriteUserAgent: true });
|
|
@@ -1,7 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
const path_1 = require("path");
|
|
4
|
-
const fs = require("fs");
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
5
38
|
const utils_1 = require("./utils");
|
|
6
39
|
const resource_1 = require("../resource");
|
|
7
40
|
/*
|
package/dist/lib/utils/utils.js
CHANGED
|
@@ -1,9 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.CliLog = void 0;
|
|
4
37
|
exports.parseRouter = parseRouter;
|
|
5
38
|
exports.getInstalledPackageVersion = getInstalledPackageVersion;
|
|
6
|
-
const fs = require("fs");
|
|
39
|
+
const fs = __importStar(require("fs"));
|
|
7
40
|
const path_1 = require("path");
|
|
8
41
|
const Log_1 = require("./Log");
|
|
9
42
|
function parseRouter(url) {
|
package/dist/lib/xcode/index.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.XcodeManager = void 0;
|
|
4
7
|
const resource_1 = require("../resource");
|
|
5
|
-
const xcodeproject_1 = require("./xcodeproject");
|
|
6
|
-
const xcodebuild_1 = require("./xcodebuild");
|
|
7
|
-
const xcrun_1 = require("./xcrun");
|
|
8
|
+
const xcodeproject_1 = __importDefault(require("./xcodeproject"));
|
|
9
|
+
const xcodebuild_1 = __importDefault(require("./xcodebuild"));
|
|
10
|
+
const xcrun_1 = __importDefault(require("./xcrun"));
|
|
8
11
|
const path_1 = require("path");
|
|
9
12
|
class XcodeManager {
|
|
10
13
|
static async parseProject(option, isDev = false) {
|
|
@@ -1,12 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.XcodebuildCMD = void 0;
|
|
4
|
-
const fs = require("fs");
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
5
38
|
const path_1 = require("path");
|
|
6
39
|
const resource_1 = require("../resource");
|
|
7
40
|
const semver_1 = require("semver");
|
|
8
41
|
const file_1 = require("../resource/file");
|
|
9
|
-
const { execSync
|
|
42
|
+
const { execSync } = require('child_process');
|
|
10
43
|
class Xcodebuild {
|
|
11
44
|
static async project() {
|
|
12
45
|
try {
|
|
@@ -1,6 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const fs = require("fs");
|
|
36
|
+
const fs = __importStar(require("fs"));
|
|
4
37
|
const resource_1 = require("../resource");
|
|
5
38
|
const path_1 = require("path");
|
|
6
39
|
const load_1 = require("../resource/load");
|
|
@@ -144,11 +177,13 @@ class XcodeProject {
|
|
|
144
177
|
};
|
|
145
178
|
}
|
|
146
179
|
static async bindIcon(icon) {
|
|
180
|
+
var _a;
|
|
147
181
|
if (icon) {
|
|
148
182
|
// The application icon of Apple Vision Pro requires at least 2 images, one of which is a completely opaque base image. Therefore, Spatial Web is required to provide the base image, and CLI will generate an additional completely transparent image as the middle layer.
|
|
183
|
+
const iconMime = (_a = icon.mime) !== null && _a !== void 0 ? _a : 'image/png';
|
|
149
184
|
const iconConfigDirectory = (0, path_1.join)(resource_1.PROJECT_DIRECTORY, resource_1.BACK_APPICON_DIRECTORY);
|
|
150
185
|
const iconConfigPath = (0, path_1.join)(iconConfigDirectory, 'Contents.json');
|
|
151
|
-
const iconFileName = 'icon.' +
|
|
186
|
+
const iconFileName = 'icon.' + iconMime.replace('image/', '');
|
|
152
187
|
const iconFullPath = (0, path_1.join)(iconConfigDirectory, iconFileName);
|
|
153
188
|
let iconConfig = await (0, load_1.loadJsonFromDisk)(iconConfigPath);
|
|
154
189
|
/*
|
|
@@ -159,7 +194,7 @@ class XcodeProject {
|
|
|
159
194
|
}
|
|
160
195
|
*/
|
|
161
196
|
iconConfig.images[0]['filename'] = iconFileName;
|
|
162
|
-
await icon.
|
|
197
|
+
await icon.write(iconFullPath);
|
|
163
198
|
await fs.writeFileSync(iconConfigPath, JSON.stringify(iconConfig));
|
|
164
199
|
const middleIconConfigDirectory = (0, path_1.join)(resource_1.PROJECT_DIRECTORY, resource_1.MIDDLE_APPICON_DIRECTORY);
|
|
165
200
|
const middleIconConfigPath = (0, path_1.join)(middleIconConfigDirectory, 'Contents.json');
|
|
@@ -168,15 +203,15 @@ class XcodeProject {
|
|
|
168
203
|
let middleConfig = await (0, load_1.loadJsonFromDisk)(middleIconConfigPath);
|
|
169
204
|
let middleIcon = imageHelper_1.ImageHelper.createImg(512);
|
|
170
205
|
middleConfig.images[0]['filename'] = middleIconFileName;
|
|
171
|
-
await middleIcon.
|
|
206
|
+
await middleIcon.write(middleIconFullPath);
|
|
172
207
|
await fs.writeFileSync(middleIconConfigPath, JSON.stringify(middleConfig));
|
|
173
208
|
const logoConfigDirectory = (0, path_1.join)(resource_1.PROJECT_DIRECTORY, resource_1.LOGO_DIRECTORY);
|
|
174
209
|
const logoConfigPath = (0, path_1.join)(logoConfigDirectory, 'Contents.json');
|
|
175
210
|
let logoConfig = await (0, load_1.loadJsonFromDisk)(logoConfigPath);
|
|
176
|
-
const logoFileName = 'logo.' +
|
|
211
|
+
const logoFileName = 'logo.' + iconMime.replace('image/', '');
|
|
177
212
|
const logoFullPath = (0, path_1.join)(logoConfigDirectory, logoFileName);
|
|
178
213
|
logoConfig.images[0]['filename'] = logoFileName;
|
|
179
|
-
await icon.
|
|
214
|
+
await icon.write(logoFullPath);
|
|
180
215
|
await fs.writeFileSync(logoConfigPath, JSON.stringify(logoConfig));
|
|
181
216
|
}
|
|
182
217
|
}
|
|
@@ -30,7 +30,6 @@ export default class Xcrun {
|
|
|
30
30
|
static shutdownSimulator(): Promise<void>;
|
|
31
31
|
private static launchSimulator;
|
|
32
32
|
private static buildTestApp;
|
|
33
|
-
private static terminateApp;
|
|
34
33
|
private static installApp;
|
|
35
34
|
private static uninstallApp;
|
|
36
35
|
private static launchApp;
|
package/dist/lib/xcode/xcrun.js
CHANGED
|
@@ -1,13 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
2
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
39
|
const child_process_1 = require("child_process");
|
|
4
40
|
const resource_1 = require("../resource");
|
|
5
41
|
const path_1 = require("path");
|
|
6
|
-
const fs = require("fs");
|
|
42
|
+
const fs = __importStar(require("fs"));
|
|
7
43
|
const xcodebuild_1 = require("./xcodebuild");
|
|
8
44
|
const file_1 = require("../resource/file");
|
|
9
45
|
const utils_1 = require("../utils/utils");
|
|
10
|
-
const history_1 = require("../utils/history");
|
|
46
|
+
const history_1 = __importDefault(require("../utils/history"));
|
|
11
47
|
class Xcrun {
|
|
12
48
|
static async validate(path, key1, key2, useAccount) {
|
|
13
49
|
const cmd = new XcrunCMD().altool();
|
|
@@ -173,9 +209,6 @@ class Xcrun {
|
|
|
173
209
|
console.log('------------------- build end -------------------');
|
|
174
210
|
return true;
|
|
175
211
|
}
|
|
176
|
-
static terminateApp(deviceId, appId) {
|
|
177
|
-
(0, child_process_1.execSync)(new XcrunCMD().simctl().terminate(deviceId, appId).line);
|
|
178
|
-
}
|
|
179
212
|
static installApp(path, deviceId, appName) {
|
|
180
213
|
const appFile = (0, path_1.join)(path, `Build/Products/Debug-xrsimulator/${appName}.app`);
|
|
181
214
|
let cmd = new XcrunCMD().simctl();
|
|
@@ -291,16 +324,18 @@ class Xcrun {
|
|
|
291
324
|
static parseDeviceInfo(device) {
|
|
292
325
|
var _a;
|
|
293
326
|
const uuidRegex = /[A-F0-9]{8}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{12}/i;
|
|
294
|
-
const uuidMatch = (_a = device.match(uuidRegex)) !== null && _a !== void 0 ? _a : [
|
|
327
|
+
const uuidMatch = (_a = device.match(uuidRegex)) !== null && _a !== void 0 ? _a : ['()'];
|
|
295
328
|
const deviceId = uuidMatch[0];
|
|
296
329
|
const name = device.substring(0, device.indexOf(deviceId) - 1).trim();
|
|
297
|
-
const statePart = device
|
|
330
|
+
const statePart = device
|
|
331
|
+
.substring(device.indexOf(deviceId) + deviceId.length)
|
|
332
|
+
.trim();
|
|
298
333
|
const stateMatch = statePart.match(/\(([^)]+)\)/);
|
|
299
334
|
const state = stateMatch ? stateMatch[1].trim() : 'Unknown';
|
|
300
335
|
return {
|
|
301
336
|
name: name,
|
|
302
337
|
deviceId: deviceId,
|
|
303
|
-
state: state
|
|
338
|
+
state: state,
|
|
304
339
|
};
|
|
305
340
|
}
|
|
306
341
|
// Try to find an available simulator, if not, create one and save the running record for the next time direct use.
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webspatial/builder",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Client CLI tool to Generate XRApp project for Apple Vision Pro",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"engines": {
|
|
7
|
-
"node": ">=
|
|
7
|
+
"node": ">=22"
|
|
8
8
|
},
|
|
9
9
|
"bin": {
|
|
10
10
|
"webspatial-builder": "bin/bundlepwa.js"
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"commander": "^13.1.0",
|
|
34
34
|
"fetch-h2": "^2.5.1",
|
|
35
35
|
"inquirer": "^8.2.4",
|
|
36
|
-
"jimp": "^
|
|
36
|
+
"jimp": "^1.6.1",
|
|
37
37
|
"mime-types": "^2.1.27",
|
|
38
38
|
"minimist": "^1.2.8",
|
|
39
39
|
"node-fetch": "2.6.7",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"sharp": "^0.33.5",
|
|
42
42
|
"valid-url": "^1.0.9",
|
|
43
43
|
"xcode": "^3.0.1",
|
|
44
|
-
"@webspatial/platform-visionos": "^
|
|
44
|
+
"@webspatial/platform-visionos": "^2.0.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@rollup/plugin-terser": "^0.4.3",
|
|
@@ -52,12 +52,13 @@
|
|
|
52
52
|
"@types/minimist": "^1.2.0",
|
|
53
53
|
"@types/node": "^12.20.1",
|
|
54
54
|
"@types/node-fetch": "^2.5.10",
|
|
55
|
+
"@types/pngjs": "^6.0.5",
|
|
55
56
|
"@types/semver": "^7.3.1",
|
|
56
57
|
"@types/valid-url": "^1.0.3",
|
|
57
58
|
"fs-extra": "^11.1.1",
|
|
58
59
|
"glob": "^10.3.4",
|
|
59
60
|
"javascript-obfuscator": "^4.0.1",
|
|
60
|
-
"rollup": "^
|
|
61
|
+
"rollup": "^4.60.2",
|
|
61
62
|
"tslib": "^2.6.0",
|
|
62
63
|
"typescript": "^5.1.5"
|
|
63
64
|
},
|