@webspatial/builder 0.1.15 → 0.1.17

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.
@@ -1 +1,208 @@
1
- 'use strict';const _0x5ddbb7=_0x2a3d;(function(_0x5aa333,_0x3e4c66){const _0x1564ef=_0x2a3d,_0x53ed58=_0x5aa333();while(!![]){try{const _0x25d156=parseInt(_0x1564ef(0x119))/0x1+-parseInt(_0x1564ef(0x160))/0x2+-parseInt(_0x1564ef(0x16d))/0x3+-parseInt(_0x1564ef(0x124))/0x4+-parseInt(_0x1564ef(0x13d))/0x5*(-parseInt(_0x1564ef(0x11d))/0x6)+-parseInt(_0x1564ef(0x146))/0x7*(-parseInt(_0x1564ef(0x12d))/0x8)+parseInt(_0x1564ef(0x167))/0x9*(parseInt(_0x1564ef(0x159))/0xa);if(_0x25d156===_0x3e4c66)break;else _0x53ed58['push'](_0x53ed58['shift']());}catch(_0x3446d6){_0x53ed58['push'](_0x53ed58['shift']());}}}(_0x40f0,0xa8a4a));Object[_0x5ddbb7(0x149)](exports,_0x5ddbb7(0x16a),{'value':!![]}),exports[_0x5ddbb7(0x13e)]=void 0x0,exports[_0x5ddbb7(0x134)]=configId,exports[_0x5ddbb7(0x12b)]=configStartUrl,exports[_0x5ddbb7(0x139)]=configScope,exports[_0x5ddbb7(0x164)]=configDisplay,exports['configMainScene']=configMainScene,exports[_0x5ddbb7(0x133)]=configDeeplink;const utils_1=require('../utils/utils'),validate_1=require(_0x5ddbb7(0x12c)),path_1=require(_0x5ddbb7(0x162));function _0x40f0(){const _0x1fc3a5=['configStartUrl','./validate','8sJbEse','normalize','height','resolve','standalone','relative','configDeeplink','configId','href','includes','length','startsWith','configScope','sftp','xmpp','mode','1855585NygZQp','safelist','contentSize','parseRouter','width','scope','sip','url','host','620963LquMfm','irc','smsto','defineProperty','ircs','magnet','automatic','news','mms','webcal','mainScene','string','protocol_handlers','object','./static-web','reverse','sms','urn','ftps','88330GWjKpW','display','origin','display_override','indexOf','index','map','2722160rBqpoC','replace','path','ftp','configDisplay','join','split','765bLCSzr','defaultSize','mailto','__esModule','validateURL','contentMinSize','340920NzELev','wtai','web+','982260yztaJM','start_url','\x20\x20is\x20not\x20a\x20valid\x20url','openpgp4fpr','6efBzcU','splice','cwd','hash','sort','nntp','xr_main_scene','109636kfJkge','fullscreen','pathname','search','resizability','default_size','filter'];_0x40f0=function(){return _0x1fc3a5;};return _0x40f0();}function configId(_0x87cfef,_0x24a122){const _0x3894ac=_0x5ddbb7;if(_0x24a122)_0x87cfef['id']=_0x24a122;else try{const _0x19b4be=new URL(_0x87cfef['id']);let _0x6755db=_0x19b4be[_0x3894ac(0x145)][_0x3894ac(0x166)]('.')[_0x3894ac(0x155)]();_0x87cfef['id']=_0x6755db[_0x3894ac(0x165)]('.');}catch(_0x208ffe){throw new Error('id:'+_0x87cfef['id']+_0x3894ac(0x11b));}}function configStartUrl(_0x345577,_0x1d9ab4,_0x15fcfa,_0x4eee3c){const _0x25165f=_0x5ddbb7;var _0x149876;let _0x32c97b=(_0x149876=_0x345577['start_url'])!==null&&_0x149876!==void 0x0?_0x149876:'/';const _0x3cefe4=(0x0,validate_1['validateURL'])(_0x32c97b),_0x2efbb9=_0x1d9ab4[_0x25165f(0x137)]>0x0;if(_0x2efbb9){const _0x3572d6=(0x0,validate_1['validateURL'])(_0x1d9ab4);if(!_0x3cefe4&&!_0x3572d6){const _0xed8319=(0x0,path_1[_0x25165f(0x130)])(_0x25165f(0x154)),_0x49e09d=(0x0,path_1[_0x25165f(0x130)])(_0xed8319,_0x1d9ab4,_0x32c97b),_0x56582f=(0x0,path_1['normalize'])(_0x49e09d),_0x4068dd=(0x0,path_1['join'])(_0xed8319,_0x56582f);_0x32c97b=(0x0,path_1['relative'])(process[_0x25165f(0x11f)](),_0x4068dd)[_0x25165f(0x161)](/^(\.\.\/)+/,'./')[_0x25165f(0x161)](/\/$/,'');}else{if(_0x3cefe4&&!_0x3572d6){const _0x1ac2f2=new URL(_0x32c97b),_0x100a86=_0x1ac2f2[_0x25165f(0x126)]+_0x1ac2f2['search']+_0x1ac2f2[_0x25165f(0x120)];let _0x4ae894=new URL(_0x1d9ab4,_0x1ac2f2['origin']);_0x32c97b=new URL(_0x100a86,_0x4ae894)[_0x25165f(0x135)];}else{if(!_0x3cefe4&&_0x3572d6){if(_0x32c97b[_0x25165f(0x138)]('/')){const _0x2c1069=new URL(_0x1d9ab4);_0x32c97b=_0x2c1069[_0x25165f(0x15b)]+(0x0,path_1[_0x25165f(0x165)])(_0x2c1069[_0x25165f(0x126)],_0x32c97b);}else _0x32c97b=new URL(_0x32c97b,_0x1d9ab4)['href'];}else{if(_0x3cefe4&&_0x3572d6){const _0x4daffe=new URL(_0x32c97b),_0x678de2=new URL(_0x1d9ab4),_0x225920=_0x4daffe[_0x25165f(0x126)]+_0x4daffe[_0x25165f(0x127)]+_0x4daffe[_0x25165f(0x120)];_0x32c97b=new URL(_0x225920,_0x678de2['origin']+_0x678de2['pathname'])[_0x25165f(0x135)];}}}}}else{if(_0x4eee3c){const _0x4501c7=new URL(_0x15fcfa);if(!_0x3cefe4){const _0x5cc720=new URL(_0x32c97b,_0x4501c7['origin']);_0x32c97b=_0x5cc720[_0x25165f(0x135)];}else{const _0x38fd51=new URL(_0x32c97b);_0x32c97b=_0x4501c7[_0x25165f(0x15b)]+_0x38fd51[_0x25165f(0x126)]+_0x38fd51['search']+_0x38fd51[_0x25165f(0x120)];}}else{if(!_0x3cefe4){const _0x5898a2=(0x0,path_1[_0x25165f(0x130)])(_0x25165f(0x154)),_0x3db9b0=(0x0,path_1[_0x25165f(0x130)])(_0x5898a2,_0x32c97b),_0x4d8479=(0x0,path_1[_0x25165f(0x12e)])(_0x3db9b0),_0x1b9326=(0x0,path_1[_0x25165f(0x165)])(_0x5898a2,_0x4d8479);_0x32c97b=(0x0,path_1[_0x25165f(0x132)])(process['cwd'](),_0x1b9326)[_0x25165f(0x161)](/^(\.\.\/)+/,'./')[_0x25165f(0x161)](/\/$/,'');}}}return _0x32c97b;}function _0x2a3d(_0xea70f5,_0x490d68){const _0x40f0c6=_0x40f0();return _0x2a3d=function(_0x2a3d84,_0x28464f){_0x2a3d84=_0x2a3d84-0x117;let _0xa1e030=_0x40f0c6[_0x2a3d84];return _0xa1e030;},_0x2a3d(_0xea70f5,_0x490d68);}function configScope(_0x1196c9){const _0x8ea497=_0x5ddbb7;var _0x1d7312;let _0x440459=(_0x1d7312=_0x1196c9['scope'])!==null&&_0x1d7312!==void 0x0?_0x1d7312:'/';const _0x2ef073=(0x0,validate_1[_0x8ea497(0x16b)])(_0x1196c9['start_url']),_0x73abda=(0x0,validate_1[_0x8ea497(0x16b)])(_0x440459);if(_0x2ef073&&_0x73abda){const _0xefe19a=new URL(_0x440459),_0x3dbf98=new URL(_0x1196c9['start_url']);(_0xefe19a[_0x8ea497(0x145)]!==_0x3dbf98['host']||_0x1196c9[_0x8ea497(0x11a)][_0x8ea497(0x15d)](_0x440459)!==0x0)&&(_0x440459=(0x0,utils_1[_0x8ea497(0x140)])(_0x1196c9[_0x8ea497(0x11a)]));}else{if(_0x2ef073&&!_0x73abda)_0x440459=new URL(_0x440459,_0x1196c9[_0x8ea497(0x11a)])[_0x8ea497(0x135)];else{if(!_0x2ef073&&_0x73abda){const _0xb05cb7=_0x1196c9[_0x8ea497(0x11a)]['replace'](/\/[^\/]+$/,'');_0x440459=(0x0,path_1['normalize'])(_0xb05cb7+'/');}else _0x440459=(0x0,path_1[_0x8ea497(0x165)])((0x0,utils_1[_0x8ea497(0x140)])(_0x1196c9[_0x8ea497(0x11a)]),_0x440459);}}_0x1196c9['scope']=_0x440459;}function configDisplay(_0xac2bc){const _0x1e5b45=_0x5ddbb7;let _0xb9a576=_0xac2bc['display'];const _0x2569c1=['minimal-ui',_0x1e5b45(0x131),_0x1e5b45(0x125)];!_0x2569c1[_0x1e5b45(0x136)](_0xb9a576)&&(_0xb9a576=_0x1e5b45(0x131));if(_0xac2bc['display_override']&&_0xac2bc[_0x1e5b45(0x15c)][_0x1e5b45(0x137)]>0x0){const _0x16f1a0=_0xac2bc['display_override'][_0x1e5b45(0x15f)]((_0x40cabe,_0x4a3add)=>({'mode':_0x40cabe,'index':_0x4a3add}))[_0x1e5b45(0x12a)](({mode:_0x489f28})=>_0x2569c1[_0x1e5b45(0x136)](_0x489f28))[_0x1e5b45(0x121)]((_0x4fa230,_0xf99863)=>_0x4fa230[_0x1e5b45(0x15e)]-_0xf99863['index']);_0x16f1a0['length']>0x0&&(_0xb9a576=_0x16f1a0[0x0][_0x1e5b45(0x13c)]);}_0xac2bc[_0x1e5b45(0x15a)]=_0xb9a576;}function configMainScene(_0x28e81f){const _0x20def4=_0x5ddbb7;var _0x2f05f5,_0x391056;const _0x15703c=['automatic',_0x20def4(0x16c),_0x20def4(0x13f)];let _0x454fd1={'defaultSize':{'width':0x500,'height':0x500},'resizability':_0x20def4(0x14c)};if(_0x28e81f[_0x20def4(0x123)]){if(typeof _0x28e81f[_0x20def4(0x123)]===_0x20def4(0x153))_0x454fd1[_0x20def4(0x168)][_0x20def4(0x141)]=Number((_0x2f05f5=_0x28e81f['xr_main_scene'][_0x20def4(0x129)])===null||_0x2f05f5===void 0x0?void 0x0:_0x2f05f5[_0x20def4(0x141)])>0x0?_0x28e81f[_0x20def4(0x123)][_0x20def4(0x129)][_0x20def4(0x141)]:0x500,_0x454fd1['defaultSize'][_0x20def4(0x12f)]=Number((_0x391056=_0x28e81f[_0x20def4(0x123)][_0x20def4(0x129)])===null||_0x391056===void 0x0?void 0x0:_0x391056[_0x20def4(0x12f)])>0x0?_0x28e81f[_0x20def4(0x123)][_0x20def4(0x129)][_0x20def4(0x12f)]:0x500,_0x454fd1[_0x20def4(0x128)]=_0x15703c['includes'](_0x28e81f[_0x20def4(0x123)][_0x20def4(0x128)])?_0x28e81f[_0x20def4(0x123)][_0x20def4(0x128)]:'automatic',_0x28e81f[_0x20def4(0x150)]=_0x454fd1;else typeof _0x28e81f[_0x20def4(0x123)]===_0x20def4(0x151)&&(_0x28e81f['mainScene']='dynamic');}}function configDeeplink(_0x303196){const _0x57f591=_0x5ddbb7;if(_0x303196[_0x57f591(0x152)]&&_0x303196[_0x57f591(0x152)][_0x57f591(0x137)]>0x0)for(var _0x42d30c=0x0;_0x42d30c<_0x303196[_0x57f591(0x152)][_0x57f591(0x137)];_0x42d30c++){const _0x212dca=_0x303196[_0x57f591(0x152)][_0x42d30c];if(_0x212dca['protocol']&&(exports[_0x57f591(0x13e)][_0x57f591(0x136)](_0x212dca['protocol'])||_0x212dca['protocol'][_0x57f591(0x15d)](_0x57f591(0x118))===0x0)){if(!((0x0,validate_1[_0x57f591(0x16b)])(_0x212dca[_0x57f591(0x144)])&&_0x212dca[_0x57f591(0x144)][_0x57f591(0x15d)](_0x303196[_0x57f591(0x142)])<0x0))continue;}_0x303196[_0x57f591(0x152)][_0x57f591(0x11e)](_0x42d30c,0x1),_0x42d30c--;}}exports[_0x5ddbb7(0x13e)]=['bitcoin',_0x5ddbb7(0x163),_0x5ddbb7(0x158),'geo','im',_0x5ddbb7(0x147),_0x5ddbb7(0x14a),_0x5ddbb7(0x14b),_0x5ddbb7(0x169),'matrix',_0x5ddbb7(0x14e),_0x5ddbb7(0x14d),_0x5ddbb7(0x122),_0x5ddbb7(0x11c),_0x5ddbb7(0x13a),_0x5ddbb7(0x143),_0x5ddbb7(0x156),_0x5ddbb7(0x148),'ssh','tel',_0x5ddbb7(0x157),_0x5ddbb7(0x14f),_0x5ddbb7(0x117),_0x5ddbb7(0x13b)];
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.safelist = void 0;
4
+ exports.configId = configId;
5
+ exports.configStartUrl = configStartUrl;
6
+ exports.configScope = configScope;
7
+ exports.configDisplay = configDisplay;
8
+ exports.configMainScene = configMainScene;
9
+ exports.configDeeplink = configDeeplink;
10
+ const utils_1 = require("../utils/utils");
11
+ const validate_1 = require("./validate");
12
+ const path_1 = require("path");
13
+ function configId(manifestJson, bundleId) {
14
+ if (bundleId) {
15
+ manifestJson.id = bundleId;
16
+ }
17
+ else {
18
+ try {
19
+ const url = new URL(manifestJson.id);
20
+ let arr = url.host.split('.').reverse();
21
+ manifestJson.id = arr.join('.');
22
+ }
23
+ catch (e) {
24
+ throw new Error(`id:${manifestJson.id} is not a valid url`);
25
+ }
26
+ }
27
+ }
28
+ function configStartUrl(manifestJson, base, manifestUrl, isNet) {
29
+ var _a;
30
+ let start_url = (_a = manifestJson.start_url) !== null && _a !== void 0 ? _a : '/';
31
+ const isStartUrl = (0, validate_1.validateURL)(start_url);
32
+ const hasBase = base.length > 0;
33
+ if (hasBase) {
34
+ const isBaseUrl = (0, validate_1.validateURL)(base);
35
+ if (!isStartUrl && !isBaseUrl) {
36
+ const staticWebRoot = (0, path_1.resolve)('./static-web');
37
+ const resolvedPath = (0, path_1.resolve)(staticWebRoot, base, start_url);
38
+ const normalizedPath = (0, path_1.normalize)(resolvedPath);
39
+ const safePath = (0, path_1.join)(staticWebRoot, normalizedPath);
40
+ start_url = (0, path_1.relative)(process.cwd(), safePath)
41
+ .replace(/^(\.\.\/)+/, './')
42
+ .replace(/\/$/, '');
43
+ }
44
+ else if (isStartUrl && !isBaseUrl) {
45
+ const startUrl = new URL(start_url);
46
+ const fullPath = startUrl.pathname + startUrl.search + startUrl.hash;
47
+ let newBase = new URL(base, startUrl.origin);
48
+ start_url = new URL(fullPath, newBase).href;
49
+ }
50
+ else if (!isStartUrl && isBaseUrl) {
51
+ if (start_url.startsWith('/')) {
52
+ const baseUrl = new URL(base);
53
+ start_url = baseUrl.origin + (0, path_1.join)(baseUrl.pathname, start_url);
54
+ }
55
+ else {
56
+ start_url = new URL(start_url, base).href;
57
+ }
58
+ }
59
+ else if (isStartUrl && isBaseUrl) {
60
+ const startUrl = new URL(start_url);
61
+ const baseUrl = new URL(base);
62
+ const startFullPath = startUrl.pathname + startUrl.search + startUrl.hash;
63
+ start_url = new URL(startFullPath, baseUrl.origin + baseUrl.pathname).href;
64
+ }
65
+ }
66
+ else {
67
+ if (isNet) {
68
+ const murl = new URL(manifestUrl);
69
+ if (!isStartUrl) {
70
+ const newStartUrl = new URL(start_url, murl.origin);
71
+ start_url = newStartUrl.href;
72
+ }
73
+ else {
74
+ const startUrl = new URL(start_url);
75
+ start_url =
76
+ murl.origin + startUrl.pathname + startUrl.search + startUrl.hash;
77
+ }
78
+ }
79
+ else if (!isStartUrl) {
80
+ const staticWebRoot = (0, path_1.resolve)('./static-web');
81
+ const resolvedPath = (0, path_1.resolve)(staticWebRoot, start_url);
82
+ const normalizedPath = (0, path_1.normalize)(resolvedPath);
83
+ const safePath = (0, path_1.join)(staticWebRoot, normalizedPath);
84
+ start_url = (0, path_1.relative)(process.cwd(), safePath)
85
+ .replace(/^(\.\.\/)+/, './')
86
+ .replace(/\/$/, '');
87
+ }
88
+ }
89
+ return start_url;
90
+ }
91
+ function configScope(manifestJson) {
92
+ var _a;
93
+ let scope = (_a = manifestJson.scope) !== null && _a !== void 0 ? _a : '/';
94
+ const isStartUrl = (0, validate_1.validateURL)(manifestJson.start_url);
95
+ const isUrl = (0, validate_1.validateURL)(scope);
96
+ if (isStartUrl && isUrl) {
97
+ const scopeURL = new URL(scope);
98
+ const startURL = new URL(manifestJson.start_url);
99
+ if (scopeURL.host !== startURL.host ||
100
+ manifestJson.start_url.indexOf(scope) !== 0) {
101
+ scope = (0, utils_1.parseRouter)(manifestJson.start_url);
102
+ }
103
+ }
104
+ else if (isStartUrl && !isUrl) {
105
+ scope = new URL(scope, manifestJson.start_url).href;
106
+ }
107
+ else if (!isStartUrl && isUrl) {
108
+ const cleanPath = manifestJson.start_url.replace(/\/[^\/]+$/, '');
109
+ scope = (0, path_1.normalize)(cleanPath + '/');
110
+ }
111
+ else {
112
+ scope = (0, path_1.join)((0, utils_1.parseRouter)(manifestJson.start_url), scope);
113
+ }
114
+ manifestJson.scope = scope;
115
+ }
116
+ function configDisplay(manifestJson) {
117
+ let display = manifestJson.display;
118
+ const modes = ['minimal-ui', 'standalone', 'fullscreen'];
119
+ if (!modes.includes(display)) {
120
+ display = 'standalone';
121
+ }
122
+ if (manifestJson.display_override &&
123
+ manifestJson.display_override.length > 0) {
124
+ const validModes = manifestJson.display_override
125
+ .map((mode, index) => ({ mode, index }))
126
+ .filter(({ mode }) => modes.includes(mode))
127
+ .sort((a, b) => a.index - b.index);
128
+ if (validModes.length > 0) {
129
+ display = validModes[0].mode;
130
+ }
131
+ }
132
+ manifestJson.display = display;
133
+ }
134
+ function configMainScene(manifestJson) {
135
+ var _a, _b;
136
+ const resizabilities = ['automatic', 'contentMinSize', 'contentSize'];
137
+ let mainScene = {
138
+ defaultSize: {
139
+ width: 1280,
140
+ height: 1280,
141
+ },
142
+ resizability: 'automatic',
143
+ };
144
+ if (manifestJson.xr_main_scene) {
145
+ if (typeof manifestJson.xr_main_scene === 'object') {
146
+ mainScene.defaultSize.width =
147
+ Number((_a = manifestJson.xr_main_scene.default_size) === null || _a === void 0 ? void 0 : _a.width) > 0
148
+ ? manifestJson.xr_main_scene.default_size.width
149
+ : 1280;
150
+ mainScene.defaultSize.height =
151
+ Number((_b = manifestJson.xr_main_scene.default_size) === null || _b === void 0 ? void 0 : _b.height) > 0
152
+ ? manifestJson.xr_main_scene.default_size.height
153
+ : 1280;
154
+ mainScene.resizability = resizabilities.includes(manifestJson.xr_main_scene.resizability)
155
+ ? manifestJson.xr_main_scene.resizability
156
+ : 'automatic';
157
+ manifestJson.mainScene = mainScene;
158
+ }
159
+ else if (typeof manifestJson.xr_main_scene === 'string') {
160
+ manifestJson.mainScene = 'dynamic'; // only support this
161
+ }
162
+ // other type like string should be ignored
163
+ }
164
+ }
165
+ function configDeeplink(manifestJson) {
166
+ if (manifestJson.protocol_handlers &&
167
+ manifestJson.protocol_handlers.length > 0) {
168
+ for (var i = 0; i < manifestJson.protocol_handlers.length; i++) {
169
+ const item = manifestJson.protocol_handlers[i];
170
+ // The DeepLink protocol must be on the security list or start with web+
171
+ if (item.protocol &&
172
+ (exports.safelist.includes(item.protocol) ||
173
+ item.protocol.indexOf('web+') === 0)) {
174
+ // If the URL is an absolute path, it must be within the scope range
175
+ if (!((0, validate_1.validateURL)(item.url) && item.url.indexOf(manifestJson.scope) < 0))
176
+ continue;
177
+ }
178
+ manifestJson.protocol_handlers.splice(i, 1);
179
+ i--;
180
+ }
181
+ }
182
+ }
183
+ exports.safelist = [
184
+ 'bitcoin',
185
+ 'ftp',
186
+ 'ftps',
187
+ 'geo',
188
+ 'im',
189
+ 'irc',
190
+ 'ircs',
191
+ 'magnet',
192
+ 'mailto',
193
+ 'matrix',
194
+ 'mms',
195
+ 'news',
196
+ 'nntp',
197
+ 'openpgp4fpr',
198
+ 'sftp',
199
+ 'sip',
200
+ 'sms',
201
+ 'smsto',
202
+ 'ssh',
203
+ 'tel',
204
+ 'urn',
205
+ 'webcal',
206
+ 'wtai',
207
+ 'xmpp',
208
+ ];
@@ -1 +1,92 @@
1
- 'use strict';function _0x22dc(){const _0x35e558=['4433MtlrXc','configId','checkManifestJson','loadJsonFromNet','__esModule','check\x20manifest.json:\x20ok','1048576tvGDYn','configDisplay','configMainScene','join','8427430OikYWV','com.webspatial.test','public/manifest.webmanifest','54NskXND','8WqQmKS','standalone','configScope','minimal-ui','manifest','bundle-id','manifest.json\x20or\x20manifest.webmanifest\x20not\x20found,\x20use\x20default\x20in\x20run\x20mode','json','useDefaultManifestJson','PWAGenerator','52vbRcjH','manifest-url','6UjpOaK','35678bIWGVn','../utils/utils','configDeeplink','reset\x20manifest.json:\x20ok','13848hsXJDR','./validate','existsSync','defaultBundleId','log','config','../resource/load','manifest.json\x20or\x20manifest.webmanifest\x20not\x20found','start_url','public/manifest.json','validate','1037232MHkbgU','cwd','1313367TOGNmh','checkId','3729995EyMtjN','generator'];_0x22dc=function(){return _0x35e558;};return _0x22dc();}const _0x50f9ba=_0x1736;(function(_0x52e308,_0x1cd2a8){const _0x537d3f=_0x1736,_0x189a89=_0x52e308();while(!![]){try{const _0x196049=-parseInt(_0x537d3f(0x17d))/0x1*(-parseInt(_0x537d3f(0x180))/0x2)+parseInt(_0x537d3f(0x161))/0x3*(parseInt(_0x537d3f(0x173))/0x4)+parseInt(_0x537d3f(0x163))/0x5*(-parseInt(_0x537d3f(0x17f))/0x6)+-parseInt(_0x537d3f(0x15f))/0x7+parseInt(_0x537d3f(0x16b))/0x8*(-parseInt(_0x537d3f(0x172))/0x9)+parseInt(_0x537d3f(0x16f))/0xa+parseInt(_0x537d3f(0x165))/0xb*(-parseInt(_0x537d3f(0x184))/0xc);if(_0x196049===_0x1cd2a8)break;else _0x189a89['push'](_0x189a89['shift']());}catch(_0x389b09){_0x189a89['push'](_0x189a89['shift']());}}}(_0x22dc,0x7a238));Object['defineProperty'](exports,_0x50f9ba(0x169),{'value':!![]}),exports[_0x50f9ba(0x17c)]=void 0x0;const path_1=require('path'),config_1=require('./config'),load_1=require(_0x50f9ba(0x15a)),validate_1=require(_0x50f9ba(0x155)),fs=require('fs'),utils_1=require(_0x50f9ba(0x181));function _0x1736(_0x5505c2,_0x313ce1){const _0x22dc15=_0x22dc();return _0x1736=function(_0x173652,_0x340cf8){_0x173652=_0x173652-0x155;let _0xd7035=_0x22dc15[_0x173652];return _0xd7035;},_0x1736(_0x5505c2,_0x313ce1);}class PWAGenerator{static async[_0x50f9ba(0x164)](_0x426c07,_0x2a839d=![]){const _0x562780=_0x50f9ba;let _0x193b0d=await this[_0x562780(0x15e)](_0x426c07,_0x2a839d);return console['log'](_0x562780(0x16a)),await this['config'](_0x193b0d,_0x426c07,_0x2a839d),console[_0x562780(0x158)](_0x562780(0x183)),_0x193b0d;}static async[_0x50f9ba(0x15e)](_0x3b217c,_0x22b51a=![]){const _0x54f723=_0x50f9ba;var _0x526b1f,_0x570250;let _0x20905f={},_0xef61ca='',_0x576cfc=![],_0xd25c54=![];if(_0x3b217c[_0x54f723(0x17e)])_0xef61ca=_0x3b217c[_0x54f723(0x17e)],_0x576cfc=!![],_0x20905f=await(0x0,load_1[_0x54f723(0x168)])(_0x3b217c[_0x54f723(0x17e)]);else{_0x3b217c[_0x54f723(0x177)]?_0xef61ca=(0x0,path_1[_0x54f723(0x16e)])(process[_0x54f723(0x160)](),_0x3b217c['manifest']):(_0xef61ca=(0x0,path_1[_0x54f723(0x16e)])(process['cwd'](),_0x54f723(0x15d)),!fs[_0x54f723(0x156)](_0xef61ca)&&(_0xef61ca=(0x0,path_1[_0x54f723(0x16e)])(process[_0x54f723(0x160)](),_0x54f723(0x171))));if(!fs[_0x54f723(0x156)](_0xef61ca)){if(_0x22b51a)_0xd25c54=!![],utils_1['CliLog']['warn'](_0x54f723(0x179));else throw new Error(_0x54f723(0x15b));}_0x20905f=_0xd25c54?this['defaultManifestJson']:await(0x0,load_1['loadJsonFromDisk'])(_0xef61ca),this[_0x54f723(0x17b)]=_0xd25c54;}(0x0,validate_1[_0x54f723(0x167)])(_0x20905f,_0x22b51a);let _0x28e325=(0x0,config_1['configStartUrl'])(_0x20905f,(_0x526b1f=_0x3b217c['base'])!==null&&_0x526b1f!==void 0x0?_0x526b1f:'',_0xef61ca,_0x576cfc);var _0x1efd2f=(0x0,validate_1['checkStartUrl'])(_0x28e325,_0xef61ca,_0x576cfc,_0x22b51a);_0x20905f[_0x54f723(0x15c)]=_0x28e325;if(!_0x22b51a)(0x0,validate_1[_0x54f723(0x162)])(_0x20905f,(_0x570250=_0x3b217c[_0x54f723(0x178)])!==null&&_0x570250!==void 0x0?_0x570250:'');return await(0x0,validate_1['checkIcons'])(_0x20905f,_0xef61ca,_0x22b51a),{'json':_0x20905f,'url':_0xef61ca,'fromNet':_0x1efd2f};}static[_0x50f9ba(0x159)](_0x28c6c0,_0x54c77b,_0x5c0299){const _0x3b998b=_0x50f9ba;var _0x3d7095;let _0x1e5198=(_0x3d7095=_0x54c77b[_0x3b998b(0x178)])!==null&&_0x3d7095!==void 0x0?_0x3d7095:'';_0x5c0299&&!_0x28c6c0[_0x3b998b(0x17a)]['id']&&(_0x1e5198=this[_0x3b998b(0x157)]),(0x0,config_1[_0x3b998b(0x166)])(_0x28c6c0[_0x3b998b(0x17a)],_0x1e5198),(0x0,config_1[_0x3b998b(0x175)])(_0x28c6c0[_0x3b998b(0x17a)]),(0x0,config_1[_0x3b998b(0x16c)])(_0x28c6c0['json']),(0x0,config_1[_0x3b998b(0x182)])(_0x28c6c0['json']),(0x0,config_1[_0x3b998b(0x16d)])(_0x28c6c0['json']);}}exports[_0x50f9ba(0x17c)]=PWAGenerator,PWAGenerator['DisplayModes']=[_0x50f9ba(0x174),_0x50f9ba(0x176)],PWAGenerator[_0x50f9ba(0x157)]=_0x50f9ba(0x170),PWAGenerator['defaultManifestJson']={'name':'WebSpatialTest','display':_0x50f9ba(0x176),'start_url':'/','scope':'/'},PWAGenerator[_0x50f9ba(0x17b)]=![];
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PWAGenerator = void 0;
4
+ const path_1 = require("path");
5
+ const config_1 = require("./config");
6
+ const load_1 = require("../resource/load");
7
+ const validate_1 = require("./validate");
8
+ const fs = require("fs");
9
+ const utils_1 = require("../utils/utils");
10
+ class PWAGenerator {
11
+ static async generator(args, isDev = false) {
12
+ let manifestInfo = await this.validate(args, isDev);
13
+ console.log('check manifest.json: ok');
14
+ await this.config(manifestInfo, args, isDev);
15
+ console.log('reset manifest.json: ok');
16
+ return manifestInfo;
17
+ }
18
+ static async validate(args, isDev = false) {
19
+ var _a, _b;
20
+ let manifest = {};
21
+ let url = '';
22
+ let fromNet = false;
23
+ let useDefault = false;
24
+ // load manifest.json
25
+ if (args['manifestUrl']) {
26
+ url = args['manifestUrl'];
27
+ fromNet = true;
28
+ manifest = await (0, load_1.loadJsonFromNet)(args['manifestUrl']);
29
+ }
30
+ else {
31
+ if (args['manifest']) {
32
+ url = (0, path_1.join)(process.cwd(), args['manifest']);
33
+ }
34
+ else {
35
+ url = (0, path_1.join)(process.cwd(), 'public/manifest.json');
36
+ if (!fs.existsSync(url)) {
37
+ url = (0, path_1.join)(process.cwd(), 'public/manifest.webmanifest');
38
+ }
39
+ }
40
+ if (!fs.existsSync(url)) {
41
+ if (isDev) {
42
+ useDefault = true;
43
+ utils_1.CliLog.warn('manifest.json or manifest.webmanifest not found, use default in run mode');
44
+ }
45
+ else {
46
+ throw new Error('manifest.json or manifest.webmanifest not found');
47
+ }
48
+ }
49
+ manifest = useDefault
50
+ ? this.defaultManifestJson
51
+ : await (0, load_1.loadJsonFromDisk)(url);
52
+ this.useDefaultManifestJson = useDefault;
53
+ }
54
+ // check manifest.json
55
+ (0, validate_1.checkManifestJson)(manifest, isDev);
56
+ let start_url = (0, config_1.configStartUrl)(manifest, (_a = args['base']) !== null && _a !== void 0 ? _a : '', url, fromNet);
57
+ var isNetWeb = (0, validate_1.checkStartUrl)(start_url, url, fromNet, isDev);
58
+ manifest.start_url = start_url;
59
+ if (!isDev)
60
+ (0, validate_1.checkId)(manifest, (_b = args['bundleId']) !== null && _b !== void 0 ? _b : '');
61
+ await (0, validate_1.checkIcons)(manifest, url, isDev);
62
+ return {
63
+ json: manifest,
64
+ url,
65
+ fromNet: isNetWeb,
66
+ };
67
+ }
68
+ // generate manifest
69
+ static config(manifestInfo, args, isDev) {
70
+ var _a;
71
+ let bundleId = (_a = args['bundleId']) !== null && _a !== void 0 ? _a : '';
72
+ if (isDev && !manifestInfo.json.id) {
73
+ bundleId = this.defaultBundleId;
74
+ }
75
+ (0, config_1.configId)(manifestInfo.json, bundleId);
76
+ (0, config_1.configScope)(manifestInfo.json);
77
+ (0, config_1.configDisplay)(manifestInfo.json);
78
+ (0, config_1.configDeeplink)(manifestInfo.json);
79
+ (0, config_1.configMainScene)(manifestInfo.json);
80
+ }
81
+ }
82
+ exports.PWAGenerator = PWAGenerator;
83
+ // Supported display modes for TWA
84
+ PWAGenerator.DisplayModes = ['standalone', 'minimal-ui'];
85
+ PWAGenerator.defaultBundleId = 'com.webspatial.test';
86
+ PWAGenerator.defaultManifestJson = {
87
+ name: 'WebSpatialTest',
88
+ display: 'minimal-ui',
89
+ start_url: '/',
90
+ scope: '/',
91
+ };
92
+ PWAGenerator.useDefaultManifestJson = false;
@@ -1 +1,240 @@
1
- 'use strict';const _0x5346c4=_0x5f77;(function(_0x5311bd,_0x1d2c3b){const _0x46357d=_0x5f77,_0x3c1cb9=_0x5311bd();while(!![]){try{const _0x3e7e3f=parseInt(_0x46357d(0x11f))/0x1*(-parseInt(_0x46357d(0x125))/0x2)+-parseInt(_0x46357d(0x11a))/0x3+parseInt(_0x46357d(0x102))/0x4*(parseInt(_0x46357d(0xf6))/0x5)+parseInt(_0x46357d(0x109))/0x6*(-parseInt(_0x46357d(0x10a))/0x7)+parseInt(_0x46357d(0xf8))/0x8+parseInt(_0x46357d(0x10f))/0x9+-parseInt(_0x46357d(0x103))/0xa;if(_0x3e7e3f===_0x1d2c3b)break;else _0x3c1cb9['push'](_0x3c1cb9['shift']());}catch(_0x362429){_0x3c1cb9['push'](_0x3c1cb9['shift']());}}}(_0x26f8,0xd26b2));Object[_0x5346c4(0x100)](exports,_0x5346c4(0x10d),{'value':!![]}),exports[_0x5346c4(0xf9)]=checkManifestJson,exports[_0x5346c4(0x101)]=checkStartUrl,exports[_0x5346c4(0x112)]=checkIcons,exports[_0x5346c4(0x121)]=checkId,exports[_0x5346c4(0x120)]=validateBundleId,exports[_0x5346c4(0x104)]=validateURL;const path_1=require(_0x5346c4(0x117)),CustomError_1=require(_0x5346c4(0x124)),utils_1=require(_0x5346c4(0xfc)),imageHelper_1=require('../resource/imageHelper'),load_1=require(_0x5346c4(0x119)),utils_2=require('../utils/utils');function _0x5f77(_0x4e54a1,_0x53b549){const _0x26f8d7=_0x26f8();return _0x5f77=function(_0x5f77bb,_0x5c7943){_0x5f77bb=_0x5f77bb-0xf4;let _0x270ec4=_0x26f8d7[_0x5f77bb];return _0x270ec4;},_0x5f77(_0x4e54a1,_0x53b549);}function _0x26f8(){const _0x28b3f5=['In\x20the\x20Web\x20Spatial\x20App\x20Manifest,\x20the\x20start_url\x20property\x20must\x20be\x20provided','1243128nqUgSq','checkManifestJson','src','icons','../utils/utils','icon\x20not\x20found,\x20use\x20default\x20in\x20run\x20mode','http','forEach','defineProperty','checkStartUrl','531644wMokVd','11750230AqbiwD','validateURL','getWidth','purpose','In\x20the\x20Web\x20Spatial\x20App\x20Manifest,\x20the\x20icons\x20property\x20must\x20be\x20provided\x20and\x20it\x20should\x20include\x20at\x20least\x20one\x20icon\x20object','../../assets/icon-default.png','348FwSboB','16765ZGTCsF','CliLog','split','__esModule','start_url','8935299GFCoTe','join','startsWith','checkIcons','getHeight','loadImageFromDisk','sizes','In\x20the\x20Web\x20Spatial\x20App\x20Manifest,\x20the\x20start_url\x20must\x20use\x20https','path','In\x20the\x20Web\x20Spatial\x20App\x20on\x20VisionPro,\x20must\x20be\x20a\x20fully\x20opaque\x20bitmap.','../resource/load','899205nxeRXk','indexOf','maskable','warn','1024x1024','134681kZtARP','validateBundleId','checkId','name','CustomError','../utils/CustomError','2OsvWKH','length','In\x20the\x20Web\x20Spatial\x20App\x20Manifest,\x20it\x20is\x20necessary\x20to\x20provide\x20the\x20name\x20property\x20or\x20short_name\x20property\x20(preferably\x20both)','Local\x20manifest\x20cannot\x20package\x20network\x20project','https://','In\x20the\x20Web\x20Spatial\x20App\x20on\x20VisionPro,\x20the\x20icon\x20must\x20be\x20greater\x20than\x20or\x20equal\x20to\x201024x1024,\x20and\x20the\x20purpose\x20parameter\x20must\x20include\x20maskable','loadImageFromNet','test','http://','In\x20the\x20Web\x20Spatial\x20App\x20Manifest,\x20the\x20id\x20or\x20start_url\x20must\x20be\x20a\x20valid\x20URL,\x20or\x20provide\x20it\x20use\x20--bundle-id','push','55WCiCSp'];_0x26f8=function(){return _0x28b3f5;};return _0x26f8();}function checkManifestJson(_0x4dedd9,_0x2cd5ae=![]){const _0x4c197e=_0x5346c4;var _0xdaff02;const _0x9f925=[];!_0x4dedd9[_0x4c197e(0x122)]&&!_0x4dedd9['short_name']&&!_0x2cd5ae&&_0x9f925['push']({'code':0xbbe,'message':_0x4c197e(0x127),'message_staring_params':{}});!((_0xdaff02=_0x4dedd9[_0x4c197e(0xfb)])===null||_0xdaff02===void 0x0?void 0x0:_0xdaff02['length'])&&!_0x2cd5ae&&_0x9f925[_0x4c197e(0xf5)]({'code':0xbbf,'message':_0x4c197e(0x107),'message_staring_params':{}});!_0x4dedd9[_0x4c197e(0x10e)]&&!_0x2cd5ae&&_0x9f925[_0x4c197e(0xf5)]({'code':0xbc0,'message':_0x4c197e(0xf7),'message_staring_params':{}});if(_0x9f925[_0x4c197e(0x126)])throw new CustomError_1[(_0x4c197e(0x123))](_0x9f925);}function checkStartUrl(_0x312a27,_0x13ba4d,_0x32ed8a,_0x368149=![]){const _0x411759=_0x5346c4;var _0x35cb38=![];if(_0x368149)return _0x312a27[_0x411759(0x111)](_0x411759(0x129))||_0x312a27[_0x411759(0x111)](_0x411759(0x12d));if(_0x32ed8a){if(_0x312a27[_0x411759(0x111)](_0x411759(0x129))){const _0x1d4fc2=new URL(_0x312a27),_0x2575c8=new URL(_0x13ba4d);if(_0x1d4fc2['host']!==_0x2575c8['host'])throw new CustomError_1[(_0x411759(0x123))]({'code':0xfa0,'message':'In\x20the\x20WebSpatial\x20App\x20Manifest,\x20the\x20start_url\x20must\x20be\x20the\x20same\x20origin\x20with\x20manifest','message_staring_params':{}});}else{if(_0x312a27['startsWith'](_0x411759(0x12d)))throw new CustomError_1[(_0x411759(0x123))]({'code':0xfa0,'message':_0x411759(0x116),'message_staring_params':{}});}}else{if(_0x312a27[_0x411759(0x111)](_0x411759(0x129))||_0x312a27['startsWith'](_0x411759(0x12d)))throw new CustomError_1[(_0x411759(0x123))]({'code':0xfa0,'message':_0x411759(0x128),'message_staring_params':{}});}return _0x35cb38;}async function checkIcons(_0x115018,_0x567841,_0x29dce6=![]){const _0x1640ac=_0x5346c4;var _0x1e33aa,_0x3ec758;if(!((_0x1e33aa=_0x115018[_0x1640ac(0xfb)])===null||_0x1e33aa===void 0x0?void 0x0:_0x1e33aa[_0x1640ac(0x126)])&&_0x29dce6){_0x115018['icons']=[{'src':(0x0,path_1[_0x1640ac(0x110)])(__dirname,_0x1640ac(0x108)),'sizes':'1024x1024','purpose':_0x1640ac(0x11c)}],utils_2[_0x1640ac(0x10b)][_0x1640ac(0x11d)](_0x1640ac(0xfd));return;}const _0x3d8e10=(0x0,utils_1['parseRouter'])(_0x567841);let _0x55b0cd,_0x20e777,_0x44c9f1,_0xfba592=0x0;for(var _0x112223=0x0;_0x112223<_0x115018[_0x1640ac(0xfb)][_0x1640ac(0x126)];_0x112223++){const _0x2074df=_0x115018[_0x1640ac(0xfb)][_0x112223];let _0x569bfc=((_0x3ec758=_0x2074df['purpose'])===null||_0x3ec758===void 0x0?void 0x0:_0x3ec758[_0x1640ac(0x11b)]('maskable'))>=0x0;if(!_0x569bfc)continue;let _0xe59e82=![],_0xa3fd0c=_0x2074df[_0x1640ac(0xfa)],_0x1b5c0b,_0x488523=0x0;!validateURL(_0xa3fd0c)&&(_0xa3fd0c=(0x0,path_1[_0x1640ac(0x110)])(_0x3d8e10,_0xa3fd0c));if(_0x2074df[_0x1640ac(0x115)]){const _0x55a2a6=_0x2074df[_0x1640ac(0x115)][_0x1640ac(0x10c)]('\x20');_0x55a2a6[_0x1640ac(0xff)](_0x5a20e2=>{const _0x18d11e=_0x1640ac;let _0x2af879=_0x5a20e2[_0x18d11e(0x10c)]('x');Number(_0x2af879[0x0])>=0x400&&Number(_0x2af879[0x1])>=0x400&&(_0xe59e82=!![],Number(_0x2af879[0x0])>_0x488523&&(_0x488523=Number(_0x2af879[0x0])));});}else _0x1b5c0b=!_0xa3fd0c[_0x1640ac(0x111)](_0x1640ac(0xfe))?await(0x0,load_1[_0x1640ac(0x114)])(_0xa3fd0c):await(0x0,load_1[_0x1640ac(0x12b)])(_0xa3fd0c),_0x1b5c0b[_0x1640ac(0x105)]()>=0x400&&_0x1b5c0b[_0x1640ac(0x113)]()>=0x400&&(_0xe59e82=!![],_0x1b5c0b[_0x1640ac(0x105)]()>_0x488523&&(_0x488523=_0x1b5c0b[_0x1640ac(0x105)]()));_0xe59e82&&_0x569bfc&&(_0x488523>_0xfba592&&(_0xfba592=_0x488523,_0x55b0cd=_0x1b5c0b,_0x20e777=_0xa3fd0c,_0x44c9f1=_0x2074df[_0x1640ac(0x106)]));}if(_0xfba592===0x0){if(_0x29dce6){_0x115018[_0x1640ac(0xfb)]=[{'src':(0x0,path_1['join'])(__dirname,'../../assets/icon-default.png'),'sizes':_0x1640ac(0x11e),'purpose':'maskable'}],utils_2[_0x1640ac(0x10b)][_0x1640ac(0x11d)](_0x1640ac(0x12a)),utils_2[_0x1640ac(0x10b)]['warn']('icon\x20does\x20not\x20meet\x20the\x20standard,\x20use\x20default\x20icon\x20in\x20run\x20mode');return;}throw new CustomError_1[(_0x1640ac(0x123))]({'code':0xfa0,'message':_0x1640ac(0x12a),'message_staring_params':{}});}else _0x20e777&&(_0x55b0cd=!_0x20e777['startsWith'](_0x1640ac(0xfe))?await(0x0,load_1[_0x1640ac(0x114)])(_0x20e777):await(0x0,load_1[_0x1640ac(0x12b)])(_0x20e777));if(_0x55b0cd&&!imageHelper_1['ImageHelper']['isFullyOpaque'](_0x55b0cd)){if(_0x29dce6){utils_2[_0x1640ac(0x10b)][_0x1640ac(0x11d)](_0x1640ac(0x12a));return;}throw new CustomError_1[(_0x1640ac(0x123))]({'code':0xfa0,'message':_0x1640ac(0x118),'message_staring_params':{}});}_0x115018[_0x1640ac(0xfb)]=[{'src':_0x20e777,'sizes':_0xfba592+'x'+_0xfba592,'purpose':_0x44c9f1}];}function checkId(_0x4cdb5d,_0x43cb19){const _0x2d381c=_0x5346c4;if(_0x43cb19){if(!validateBundleId(_0x43cb19))throw new CustomError_1[(_0x2d381c(0x123))]({'code':0xfa0,'message':'In\x20the\x20Web\x20Spatial\x20App\x20Manifest,\x20the\x20bundle\x20ID\x20must\x20be\x20in\x20reverse\x20domain\x20format\x20(e.g.\x20com.example.app)\x20and\x20no\x20longer\x20than\x20128\x20characters','message_staring_params':{}});return;}!_0x4cdb5d['id']&&(_0x4cdb5d['id']=_0x4cdb5d[_0x2d381c(0x10e)]);if(!validateURL(_0x4cdb5d['id'])&&!_0x43cb19)throw new CustomError_1[(_0x2d381c(0x123))]({'code':0xfa0,'message':_0x2d381c(0xf4),'message_staring_params':{}});}function validateBundleId(_0x4eaff4){const _0x551765=_0x5346c4,_0x3c6ffc=/^(?=.{1,128}$)(?!.*\.\.)(?!^\.|.*\.$)[A-Za-z_][A-Za-z0-9_-]*(?:\.[A-Za-z_][A-Za-z0-9_-]*)+$/;return _0x3c6ffc[_0x551765(0x12c)](_0x4eaff4);}function validateURL(_0x48da53){try{return new URL(_0x48da53),!![];}catch(_0x2158ee){return![];}}
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkManifestJson = checkManifestJson;
4
+ exports.checkStartUrl = checkStartUrl;
5
+ exports.checkIcons = checkIcons;
6
+ exports.checkId = checkId;
7
+ exports.validateBundleId = validateBundleId;
8
+ exports.validateURL = validateURL;
9
+ const path_1 = require("path");
10
+ const CustomError_1 = require("../utils/CustomError");
11
+ const utils_1 = require("../utils/utils");
12
+ const imageHelper_1 = require("../resource/imageHelper");
13
+ const load_1 = require("../resource/load");
14
+ const utils_2 = require("../utils/utils");
15
+ function checkManifestJson(manifestJson, isDev = false) {
16
+ var _a;
17
+ const errors = [];
18
+ if (!manifestJson.name && !manifestJson['short_name'] && !isDev) {
19
+ errors.push({
20
+ code: 3006,
21
+ message: 'In the Web Spatial App Manifest, it is necessary to provide the name property or short_name property (preferably both)',
22
+ // eslint-disable-next-line @typescript-eslint/camelcase
23
+ message_staring_params: {},
24
+ });
25
+ }
26
+ if (!((_a = manifestJson.icons) === null || _a === void 0 ? void 0 : _a.length) && !isDev) {
27
+ errors.push({
28
+ code: 3007,
29
+ message: 'In the Web Spatial App Manifest, the icons property must be provided and it should include at least one icon object',
30
+ // eslint-disable-next-line @typescript-eslint/camelcase
31
+ message_staring_params: {},
32
+ });
33
+ }
34
+ if (!manifestJson['start_url'] && !isDev) {
35
+ errors.push({
36
+ code: 3008,
37
+ message: 'In the Web Spatial App Manifest, the start_url property must be provided',
38
+ // eslint-disable-next-line @typescript-eslint/camelcase
39
+ message_staring_params: {},
40
+ });
41
+ }
42
+ if (errors.length) {
43
+ throw new CustomError_1.CustomError(errors);
44
+ }
45
+ }
46
+ function checkStartUrl(startUrl, manifestUrl, isNet, isDev = false) {
47
+ var isNetWeb = false;
48
+ if (isDev) {
49
+ return startUrl.startsWith('https://') || startUrl.startsWith('http://');
50
+ }
51
+ if (isNet) {
52
+ // Determine whether it is of the same origin as the manifest
53
+ if (startUrl.startsWith('https://')) {
54
+ const urlStart = new URL(startUrl);
55
+ const urlManifest = new URL(manifestUrl);
56
+ // The start_url and manifest need to be of the same origin
57
+ if (urlStart.host !== urlManifest.host) {
58
+ throw new CustomError_1.CustomError({
59
+ code: 4000,
60
+ // eslint-disable-next-line @typescript-eslint/camelcase
61
+ message: 'In the WebSpatial App Manifest, the start_url must be the same origin with manifest',
62
+ message_staring_params: {},
63
+ });
64
+ }
65
+ }
66
+ // Start_url must be HTTPS protocol
67
+ else if (startUrl.startsWith('http://')) {
68
+ throw new CustomError_1.CustomError({
69
+ code: 4000,
70
+ // eslint-disable-next-line @typescript-eslint/camelcase
71
+ message: 'In the Web Spatial App Manifest, the start_url must use https',
72
+ message_staring_params: {},
73
+ });
74
+ }
75
+ }
76
+ else {
77
+ if (startUrl.startsWith('https://') || startUrl.startsWith('http://')) {
78
+ throw new CustomError_1.CustomError({
79
+ code: 4000,
80
+ // eslint-disable-next-line @typescript-eslint/camelcase
81
+ message: 'Local manifest cannot package network project',
82
+ message_staring_params: {},
83
+ });
84
+ }
85
+ }
86
+ return isNetWeb;
87
+ }
88
+ async function checkIcons(manifest, manifestUrl, isDev = false) {
89
+ var _a, _b;
90
+ if (!((_a = manifest.icons) === null || _a === void 0 ? void 0 : _a.length) && isDev) {
91
+ manifest.icons = [
92
+ {
93
+ src: (0, path_1.join)(__dirname, '../../assets/icon-default.png'),
94
+ sizes: '1024x1024',
95
+ purpose: 'maskable',
96
+ },
97
+ ];
98
+ utils_2.CliLog.warn('icon not found, use default in run mode');
99
+ return;
100
+ }
101
+ const relativeUrl = (0, utils_1.parseRouter)(manifestUrl);
102
+ let maxSizeImage;
103
+ let maxSizeImageUrl;
104
+ let maxSizePurpose;
105
+ let maxSize = 0;
106
+ for (var i = 0; i < manifest.icons.length; i++) {
107
+ const item = manifest.icons[i];
108
+ let hasMaskable = ((_b = item.purpose) === null || _b === void 0 ? void 0 : _b.indexOf('maskable')) >= 0;
109
+ if (!hasMaskable)
110
+ continue;
111
+ let has1024 = false;
112
+ let imgUrl = item.src;
113
+ let image;
114
+ let imageSize = 0;
115
+ if (!validateURL(imgUrl)) {
116
+ imgUrl = (0, path_1.join)(relativeUrl, imgUrl);
117
+ }
118
+ // If size has been configured, determine the size; otherwise, download the icon for judgment
119
+ if (item.sizes) {
120
+ const mulSize = item.sizes.split(' ');
121
+ mulSize.forEach((size) => {
122
+ let wh = size.split('x');
123
+ if (Number(wh[0]) >= 1024 && Number(wh[1]) >= 1024) {
124
+ has1024 = true;
125
+ if (Number(wh[0]) > imageSize) {
126
+ imageSize = Number(wh[0]);
127
+ }
128
+ }
129
+ });
130
+ }
131
+ else {
132
+ image = !imgUrl.startsWith('http')
133
+ ? await (0, load_1.loadImageFromDisk)(imgUrl)
134
+ : await (0, load_1.loadImageFromNet)(imgUrl);
135
+ if (image.getWidth() >= 1024 && image.getHeight() >= 1024) {
136
+ has1024 = true;
137
+ if (image.getWidth() > imageSize) {
138
+ imageSize = image.getWidth();
139
+ }
140
+ }
141
+ }
142
+ // Download all the icons used, check their width and height, and if they meet the size and maskability requirements, finally check their alpha
143
+ if (has1024 && hasMaskable) {
144
+ if (imageSize > maxSize) {
145
+ maxSize = imageSize;
146
+ maxSizeImage = image;
147
+ maxSizeImageUrl = imgUrl;
148
+ maxSizePurpose = item.purpose;
149
+ }
150
+ }
151
+ }
152
+ // There is no icon that satisfies both size>=1024 and purpose including Maskable
153
+ if (maxSize === 0) {
154
+ if (isDev) {
155
+ manifest.icons = [
156
+ {
157
+ src: (0, path_1.join)(__dirname, '../../assets/icon-default.png'),
158
+ sizes: '1024x1024',
159
+ purpose: 'maskable',
160
+ },
161
+ ];
162
+ utils_2.CliLog.warn('In the Web Spatial App on VisionPro, the icon must be greater than or equal to 1024x1024, and the purpose parameter must include maskable');
163
+ utils_2.CliLog.warn('icon does not meet the standard, use default icon in run mode');
164
+ return;
165
+ }
166
+ throw new CustomError_1.CustomError({
167
+ code: 4000,
168
+ // eslint-disable-next-line @typescript-eslint/camelcase
169
+ message: 'In the Web Spatial App on VisionPro, the icon must be greater than or equal to 1024x1024, and the purpose parameter must include maskable',
170
+ message_staring_params: {},
171
+ });
172
+ }
173
+ else if (maxSizeImageUrl) {
174
+ maxSizeImage = !maxSizeImageUrl.startsWith('http')
175
+ ? await (0, load_1.loadImageFromDisk)(maxSizeImageUrl)
176
+ : await (0, load_1.loadImageFromNet)(maxSizeImageUrl);
177
+ }
178
+ // Check if the image is completely opaque
179
+ if (maxSizeImage && !imageHelper_1.ImageHelper.isFullyOpaque(maxSizeImage)) {
180
+ if (isDev) {
181
+ utils_2.CliLog.warn('In the Web Spatial App on VisionPro, the icon must be greater than or equal to 1024x1024, and the purpose parameter must include maskable');
182
+ return;
183
+ }
184
+ throw new CustomError_1.CustomError({
185
+ code: 4000,
186
+ // eslint-disable-next-line @typescript-eslint/camelcase
187
+ message: 'In the Web Spatial App on VisionPro, must be a fully opaque bitmap.',
188
+ message_staring_params: {},
189
+ });
190
+ }
191
+ manifest.icons = [
192
+ {
193
+ src: maxSizeImageUrl,
194
+ sizes: maxSize + 'x' + maxSize,
195
+ purpose: maxSizePurpose,
196
+ },
197
+ ];
198
+ }
199
+ function checkId(manifest, bundleId) {
200
+ if (bundleId) {
201
+ if (!validateBundleId(bundleId)) {
202
+ throw new CustomError_1.CustomError({
203
+ code: 4000,
204
+ // eslint-disable-next-line @typescript-eslint/camelcase
205
+ message: 'In the Web Spatial App Manifest, the bundle ID must be in reverse domain format (e.g. com.example.app) and no longer than 128 characters',
206
+ message_staring_params: {},
207
+ });
208
+ }
209
+ return;
210
+ }
211
+ if (!manifest.id) {
212
+ manifest.id = manifest.start_url;
213
+ }
214
+ if (!validateURL(manifest.id) && !bundleId) {
215
+ throw new CustomError_1.CustomError({
216
+ code: 4000,
217
+ // eslint-disable-next-line @typescript-eslint/camelcase
218
+ message: 'In the Web Spatial App Manifest, the id or start_url must be a valid URL, or provide it use --bundle-id',
219
+ message_staring_params: {},
220
+ });
221
+ }
222
+ }
223
+ function validateBundleId(bundleId) {
224
+ // iOS official specification regex (supports reverse domain name format validation)
225
+ // 1. Allowed: letters/numbers/hyphens/underscores/dots
226
+ // 2. Disallow: consecutive dots/leading or trailing dots
227
+ // 3. Each part starts with a letter or underscore
228
+ // 4. Total length 1-128 characters
229
+ const iosBundleIdRegex = /^(?=.{1,128}$)(?!.*\.\.)(?!^\.|.*\.$)[A-Za-z_][A-Za-z0-9_-]*(?:\.[A-Za-z_][A-Za-z0-9_-]*)+$/;
230
+ return iosBundleIdRegex.test(bundleId);
231
+ }
232
+ function validateURL(url) {
233
+ try {
234
+ new URL(url);
235
+ return true;
236
+ }
237
+ catch (error) {
238
+ return false;
239
+ }
240
+ }
@@ -1 +1,45 @@
1
- 'use strict';const _0x4e20f6=_0x2392;(function(_0x5eee80,_0x179f7e){const _0x324bc4=_0x2392,_0x594d65=_0x5eee80();while(!![]){try{const _0x4048d2=-parseInt(_0x324bc4(0x18c))/0x1*(-parseInt(_0x324bc4(0x18f))/0x2)+parseInt(_0x324bc4(0x182))/0x3+parseInt(_0x324bc4(0x18b))/0x4*(-parseInt(_0x324bc4(0x185))/0x5)+-parseInt(_0x324bc4(0x197))/0x6*(parseInt(_0x324bc4(0x184))/0x7)+-parseInt(_0x324bc4(0x190))/0x8+parseInt(_0x324bc4(0x191))/0x9+-parseInt(_0x324bc4(0x17f))/0xa*(-parseInt(_0x324bc4(0x196))/0xb);if(_0x4048d2===_0x179f7e)break;else _0x594d65['push'](_0x594d65['shift']());}catch(_0x40bd44){_0x594d65['push'](_0x594d65['shift']());}}}(_0x59a8,0x70d97));function _0x2392(_0xcb2c1d,_0x2afd09){const _0x59a8d8=_0x59a8();return _0x2392=function(_0x239216,_0xfc6d67){_0x239216=_0x239216-0x17f;let _0x4531eb=_0x59a8d8[_0x239216];return _0x4531eb;},_0x2392(_0xcb2c1d,_0x2afd09);}Object['defineProperty'](exports,_0x4e20f6(0x194),{'value':!![]}),exports[_0x4e20f6(0x188)]=copyDir,exports[_0x4e20f6(0x193)]=clearDir;function _0x59a8(){const _0x428a95=['isDirectory','4216652TAaoFH','2208GNrGff','10BEfFsF','forEach','statSync','2018490fFtzcv','unlinkSync','12131YiDogk','119445zVzDtt','mkdirSync','readFileSync','copyDir','existsSync','readdirSync','16gytTHr','1zNxqGH','isFile','writeFileSync','532994fHPGnF','6449880RLhvJQ','6111963yFTWek','log','clearDir','__esModule'];_0x59a8=function(){return _0x428a95;};return _0x59a8();}const fs=require('fs');function copyDir(_0x37c266,_0x3b1700){const _0x41cf24=_0x4e20f6,_0x5926c4=fs[_0x41cf24(0x18a)](_0x37c266);_0x5926c4[_0x41cf24(0x180)](_0x17c51c=>{const _0x3850d4=_0x41cf24,_0x2269f7=_0x37c266+'/'+_0x17c51c,_0x40868d=_0x3b1700+'/'+_0x17c51c,_0x41bd04=fs['statSync'](_0x2269f7);if(_0x41bd04[_0x3850d4(0x18d)]())try{fs[_0x3850d4(0x18e)](_0x40868d,fs[_0x3850d4(0x187)](_0x2269f7));}catch(_0x540ac2){console[_0x3850d4(0x192)](_0x540ac2);}else _0x41bd04['isDirectory']()&&(!fs[_0x3850d4(0x189)](_0x40868d)&&fs[_0x3850d4(0x186)](_0x40868d,{'recursive':!![]}),copyDir(_0x2269f7,_0x40868d));});}function clearDir(_0x47097a){const _0x3ec8d3=_0x4e20f6,_0x2d8101=fs[_0x3ec8d3(0x18a)](_0x47097a);_0x2d8101[_0x3ec8d3(0x180)](_0x2fbee2=>{const _0x426d5d=_0x3ec8d3,_0x57a024=_0x47097a+'/'+_0x2fbee2,_0x15eee2=fs[_0x426d5d(0x181)](_0x57a024);if(_0x15eee2[_0x426d5d(0x18d)]())try{fs[_0x426d5d(0x183)](_0x57a024);}catch(_0xfe6062){console['log'](_0xfe6062);}else _0x15eee2[_0x426d5d(0x195)]()&&clearDir(_0x57a024);});}
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.copyDir = copyDir;
4
+ exports.clearDir = clearDir;
5
+ const fs = require("fs");
6
+ function copyDir(from, to) {
7
+ const paths = fs.readdirSync(from);
8
+ paths.forEach(path => {
9
+ const _from = from + '/' + path;
10
+ const _to = to + '/' + path;
11
+ const stat = fs.statSync(_from);
12
+ if (stat.isFile()) {
13
+ try {
14
+ fs.writeFileSync(_to, fs.readFileSync(_from));
15
+ }
16
+ catch (err) {
17
+ console.log(err);
18
+ }
19
+ }
20
+ else if (stat.isDirectory()) {
21
+ if (!fs.existsSync(_to)) {
22
+ fs.mkdirSync(_to, { recursive: true });
23
+ }
24
+ copyDir(_from, _to);
25
+ }
26
+ });
27
+ }
28
+ function clearDir(from) {
29
+ const paths = fs.readdirSync(from);
30
+ paths.forEach(path => {
31
+ const _from = from + '/' + path;
32
+ const stat = fs.statSync(_from);
33
+ if (stat.isFile()) {
34
+ try {
35
+ fs.unlinkSync(_from);
36
+ }
37
+ catch (err) {
38
+ console.log(err);
39
+ }
40
+ }
41
+ else if (stat.isDirectory()) {
42
+ clearDir(_from);
43
+ }
44
+ });
45
+ }