@apps-in-toss/plugins 1.9.4 → 1.10.1
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.cjs +492 -446
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +509 -462
- package/dist/internal.cjs +128 -707
- package/dist/internal.js +140 -743
- package/package.json +4 -2
package/dist/internal.js
CHANGED
|
@@ -1,215 +1,79 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
2
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
3
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
4
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
5
|
}) : x)(function(x) {
|
|
11
6
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
7
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
8
|
});
|
|
14
|
-
var __esm = (fn, res) => function __init() {
|
|
15
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
16
|
-
};
|
|
17
9
|
var __commonJS = (cb, mod) => function __require2() {
|
|
18
10
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
19
11
|
};
|
|
20
|
-
var __copyProps = (to, from, except, desc) => {
|
|
21
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
-
for (let key of __getOwnPropNames(from))
|
|
23
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
-
}
|
|
26
|
-
return to;
|
|
27
|
-
};
|
|
28
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
-
mod
|
|
35
|
-
));
|
|
36
|
-
|
|
37
|
-
// ../../../.yarn/__virtual__/tsup-virtual-dc9661456a/0/cache/tsup-npm-8.4.0-f78d2622c9-c6636ffd6a.zip/node_modules/tsup/assets/esm_shims.js
|
|
38
|
-
var init_esm_shims = __esm({
|
|
39
|
-
"../../../.yarn/__virtual__/tsup-virtual-dc9661456a/0/cache/tsup-npm-8.4.0-f78d2622c9-c6636ffd6a.zip/node_modules/tsup/assets/esm_shims.js"() {
|
|
40
|
-
"use strict";
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
// ../../../.yarn/__virtual__/typia-virtual-6e1bbef80b/0/cache/typia-npm-9.7.2-987d15a303-1b19baddfe.zip/node_modules/typia/lib/internal/_isFormatUuid.js
|
|
45
|
-
var require_isFormatUuid = __commonJS({
|
|
46
|
-
"../../../.yarn/__virtual__/typia-virtual-6e1bbef80b/0/cache/typia-npm-9.7.2-987d15a303-1b19baddfe.zip/node_modules/typia/lib/internal/_isFormatUuid.js"(exports) {
|
|
47
|
-
"use strict";
|
|
48
|
-
init_esm_shims();
|
|
49
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports._isFormatUuid = void 0;
|
|
51
|
-
var _isFormatUuid2 = (str) => PATTERN.test(str);
|
|
52
|
-
exports._isFormatUuid = _isFormatUuid2;
|
|
53
|
-
var PATTERN = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
// ../../../.yarn/__virtual__/typia-virtual-6e1bbef80b/0/cache/typia-npm-9.7.2-987d15a303-1b19baddfe.zip/node_modules/typia/lib/internal/_validateReport.js
|
|
58
|
-
var require_validateReport = __commonJS({
|
|
59
|
-
"../../../.yarn/__virtual__/typia-virtual-6e1bbef80b/0/cache/typia-npm-9.7.2-987d15a303-1b19baddfe.zip/node_modules/typia/lib/internal/_validateReport.js"(exports) {
|
|
60
|
-
"use strict";
|
|
61
|
-
init_esm_shims();
|
|
62
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
63
|
-
exports._validateReport = void 0;
|
|
64
|
-
var _validateReport2 = (array) => {
|
|
65
|
-
const reportable = (path9) => {
|
|
66
|
-
if (array.length === 0)
|
|
67
|
-
return true;
|
|
68
|
-
const last = array[array.length - 1].path;
|
|
69
|
-
return path9.length > last.length || last.substring(0, path9.length) !== path9;
|
|
70
|
-
};
|
|
71
|
-
return (exceptable, error) => {
|
|
72
|
-
var _a;
|
|
73
|
-
if (exceptable && reportable(error.path)) {
|
|
74
|
-
if (error.value === void 0)
|
|
75
|
-
(_a = error.description) !== null && _a !== void 0 ? _a : error.description = [
|
|
76
|
-
"The value at this path is `undefined`.",
|
|
77
|
-
"",
|
|
78
|
-
`Please fill the \`${error.expected}\` typed value next time.`
|
|
79
|
-
].join("\n");
|
|
80
|
-
array.push(error);
|
|
81
|
-
}
|
|
82
|
-
return false;
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
exports._validateReport = _validateReport2;
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
12
|
|
|
89
|
-
//
|
|
90
|
-
var
|
|
91
|
-
"
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
currentSegment += char;
|
|
144
|
-
segments.push({
|
|
145
|
-
key: currentSegment
|
|
146
|
-
});
|
|
147
|
-
index++;
|
|
148
|
-
state = PathParserState.Start;
|
|
149
|
-
} else {
|
|
150
|
-
currentSegment += char;
|
|
151
|
-
}
|
|
152
|
-
} else if (state === PathParserState.StringKey) {
|
|
153
|
-
if (char === '"') {
|
|
154
|
-
segments.push({
|
|
155
|
-
key: JSON.parse(currentSegment + char)
|
|
156
|
-
});
|
|
157
|
-
index += 2;
|
|
158
|
-
state = PathParserState.Start;
|
|
159
|
-
} else if (char === "\\") {
|
|
160
|
-
currentSegment += path9[index];
|
|
161
|
-
index++;
|
|
162
|
-
currentSegment += path9[index];
|
|
163
|
-
} else {
|
|
164
|
-
currentSegment += char;
|
|
165
|
-
}
|
|
166
|
-
} else if (state === PathParserState.NumberKey) {
|
|
167
|
-
if (char === "]") {
|
|
168
|
-
segments.push({
|
|
169
|
-
key: Number.parseInt(currentSegment)
|
|
170
|
-
});
|
|
171
|
-
index++;
|
|
172
|
-
state = PathParserState.Start;
|
|
173
|
-
} else {
|
|
174
|
-
currentSegment += char;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
if (state === PathParserState.Start && index < path9.length - 1) {
|
|
178
|
-
const newChar = path9[index];
|
|
179
|
-
currentSegment = "";
|
|
180
|
-
if (newChar === "[") {
|
|
181
|
-
if (path9[index + 1] === '"') {
|
|
182
|
-
state = PathParserState.StringKey;
|
|
183
|
-
index++;
|
|
184
|
-
currentSegment = '"';
|
|
185
|
-
} else {
|
|
186
|
-
state = PathParserState.NumberKey;
|
|
187
|
-
}
|
|
188
|
-
} else if (newChar === ".") {
|
|
189
|
-
state = PathParserState.Property;
|
|
190
|
-
} else {
|
|
191
|
-
throw new Error("Unreachable: pointer points invalid character");
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
if (state !== PathParserState.Start) {
|
|
196
|
-
throw new Error(`Failed to parse path: ${JSON.stringify(path9)}`);
|
|
13
|
+
// package.json
|
|
14
|
+
var require_package = __commonJS({
|
|
15
|
+
"package.json"(exports, module) {
|
|
16
|
+
module.exports = {
|
|
17
|
+
name: "@apps-in-toss/plugins",
|
|
18
|
+
type: "module",
|
|
19
|
+
version: "1.10.1",
|
|
20
|
+
description: "The plugins for Apps In Toss",
|
|
21
|
+
scripts: {
|
|
22
|
+
test: "vitest --run",
|
|
23
|
+
typecheck: "tsc --noEmit",
|
|
24
|
+
lint: "eslint .",
|
|
25
|
+
build: "tsup"
|
|
26
|
+
},
|
|
27
|
+
main: "./dist/index.cjs",
|
|
28
|
+
module: "./dist/index.js",
|
|
29
|
+
types: "./dist/index.d.ts",
|
|
30
|
+
exports: {
|
|
31
|
+
".": {
|
|
32
|
+
types: "./dist/index.d.ts",
|
|
33
|
+
import: "./dist/index.js",
|
|
34
|
+
require: "./dist/index.cjs"
|
|
35
|
+
},
|
|
36
|
+
"./internal": {
|
|
37
|
+
types: "./dist/internal.d.ts",
|
|
38
|
+
import: "./dist/internal.js",
|
|
39
|
+
require: "./dist/internal.cjs"
|
|
40
|
+
},
|
|
41
|
+
"./package.json": "./package.json"
|
|
42
|
+
},
|
|
43
|
+
files: [
|
|
44
|
+
"dist/**/*"
|
|
45
|
+
],
|
|
46
|
+
devDependencies: {
|
|
47
|
+
"@ryoppippi/unplugin-typia": "^2.6.5",
|
|
48
|
+
"@types/archiver": "^6.0.3",
|
|
49
|
+
"@types/connect": "^3",
|
|
50
|
+
tsup: "^8.4.0",
|
|
51
|
+
typescript: "5.8.3",
|
|
52
|
+
typia: "^9.3.0",
|
|
53
|
+
vitest: "^3.2.4"
|
|
54
|
+
},
|
|
55
|
+
dependencies: {
|
|
56
|
+
"@apps-in-toss/ait-format": "^1.0.0",
|
|
57
|
+
"@granite-js/plugin-core": "0.1.31",
|
|
58
|
+
"@granite-js/plugin-micro-frontend": "0.1.31",
|
|
59
|
+
"@granite-js/plugin-sentry": "0.1.31",
|
|
60
|
+
"@granite-js/utils": "0.1.31",
|
|
61
|
+
archiver: "^7.0.1",
|
|
62
|
+
connect: "^3.7.0",
|
|
63
|
+
esbuild: "0.25.5",
|
|
64
|
+
execa: "9.3.0",
|
|
65
|
+
picocolors: "^1.1.1",
|
|
66
|
+
uuidv7: "^1.0.2"
|
|
197
67
|
}
|
|
198
|
-
return segments;
|
|
199
68
|
};
|
|
200
69
|
}
|
|
201
70
|
});
|
|
202
71
|
|
|
203
|
-
// src/internal.ts
|
|
204
|
-
init_esm_shims();
|
|
205
|
-
|
|
206
72
|
// src/appsInTossHost.ts
|
|
207
|
-
init_esm_shims();
|
|
208
73
|
import { microFrontend } from "@granite-js/plugin-micro-frontend";
|
|
209
74
|
import { sentry } from "@granite-js/plugin-sentry";
|
|
210
75
|
|
|
211
76
|
// src/constants.ts
|
|
212
|
-
init_esm_shims();
|
|
213
77
|
var REACT_NATIVE_VERSION = "0.72.6";
|
|
214
78
|
var APP_MANIFEST_NAME = "app.json";
|
|
215
79
|
var MICRO_FRONTEND_HOST_NAME = "apps-in-toss-host";
|
|
@@ -231,11 +95,7 @@ var SHRED_PACKAGES = [
|
|
|
231
95
|
"react-native-webview"
|
|
232
96
|
];
|
|
233
97
|
|
|
234
|
-
// src/plugins/index.ts
|
|
235
|
-
init_esm_shims();
|
|
236
|
-
|
|
237
98
|
// src/plugins/appJson.ts
|
|
238
|
-
init_esm_shims();
|
|
239
99
|
import fs from "node:fs";
|
|
240
100
|
import path from "path";
|
|
241
101
|
import { getPackageRoot } from "@granite-js/utils";
|
|
@@ -277,14 +137,12 @@ async function appsInTossAppJson(options) {
|
|
|
277
137
|
}
|
|
278
138
|
|
|
279
139
|
// src/plugins/artifact.ts
|
|
280
|
-
|
|
281
|
-
import path6 from "path";
|
|
140
|
+
import path4 from "path";
|
|
282
141
|
import { isBuildFailure, isBuildSuccess } from "@granite-js/plugin-core";
|
|
283
|
-
import { getPackageRoot as
|
|
142
|
+
import { getPackageRoot as getPackageRoot2 } from "@granite-js/utils";
|
|
284
143
|
import pc2 from "picocolors";
|
|
285
144
|
|
|
286
145
|
// src/log.ts
|
|
287
|
-
init_esm_shims();
|
|
288
146
|
import pc from "picocolors";
|
|
289
147
|
var TAG = pc.bold(pc.cyan("[AppsInToss]"));
|
|
290
148
|
function log(...args) {
|
|
@@ -292,7 +150,6 @@ function log(...args) {
|
|
|
292
150
|
}
|
|
293
151
|
|
|
294
152
|
// src/utils/collectDependencyVersions.ts
|
|
295
|
-
init_esm_shims();
|
|
296
153
|
import * as fs2 from "fs/promises";
|
|
297
154
|
import * as path2 from "path";
|
|
298
155
|
import * as esbuild from "esbuild";
|
|
@@ -351,8 +208,8 @@ async function resolvePackageVersions(rootDir, packageNames) {
|
|
|
351
208
|
function createVirtualEntry(packageNames) {
|
|
352
209
|
return packageNames.map((packageName) => `import '${packageName}';`).join("\n");
|
|
353
210
|
}
|
|
354
|
-
function extractPackagePath(
|
|
355
|
-
const normalizedPath = normalizePath(
|
|
211
|
+
function extractPackagePath(path7, packageName) {
|
|
212
|
+
const normalizedPath = normalizePath(path7);
|
|
356
213
|
if (normalizedPath.endsWith("/package.json")) {
|
|
357
214
|
return normalizedPath.replace(/\/package\.json$/, "");
|
|
358
215
|
}
|
|
@@ -362,8 +219,8 @@ function extractPackagePath(path9, packageName) {
|
|
|
362
219
|
}
|
|
363
220
|
throw new Error(`Failed to extract path: ${packageName}`);
|
|
364
221
|
}
|
|
365
|
-
function normalizePath(
|
|
366
|
-
return
|
|
222
|
+
function normalizePath(path7) {
|
|
223
|
+
return path7.replace(/\\/g, "/");
|
|
367
224
|
}
|
|
368
225
|
async function getPackageVersion(packagePath) {
|
|
369
226
|
const packageJson = JSON.parse(await fs2.readFile(path2.join(packagePath, "package.json"), "utf-8"));
|
|
@@ -371,530 +228,69 @@ async function getPackageVersion(packagePath) {
|
|
|
371
228
|
}
|
|
372
229
|
|
|
373
230
|
// src/utils/createArtifact.ts
|
|
374
|
-
|
|
375
|
-
import
|
|
376
|
-
import {
|
|
377
|
-
|
|
378
|
-
// src/utils/
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
outputStream.on("close", () => resolve(outfile));
|
|
389
|
-
outputStream.on("error", (error) => reject(error));
|
|
390
|
-
archive.on("error", (error) => reject(error)).pipe(outputStream);
|
|
391
|
-
files.forEach(({ path: filePath, name }) => {
|
|
392
|
-
const fileName = name ?? path3.basename(filePath);
|
|
393
|
-
archive.append(fs3.createReadStream(filePath), { name: fileName });
|
|
394
|
-
});
|
|
395
|
-
archive.finalize();
|
|
396
|
-
});
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
// src/utils/updateAppJsonMetadata.ts
|
|
400
|
-
init_esm_shims();
|
|
401
|
-
import * as fs4 from "fs/promises";
|
|
402
|
-
import * as path4 from "path";
|
|
403
|
-
import { getPackageRoot as getPackageRoot2 } from "@granite-js/utils";
|
|
404
|
-
async function resolveAppManifestPath() {
|
|
405
|
-
const cwd = getPackageRoot2();
|
|
406
|
-
const appManifestPath = path4.join(cwd, ".granite", APP_MANIFEST_NAME);
|
|
407
|
-
await fs4.access(appManifestPath, fs4.constants.F_OK);
|
|
408
|
-
return appManifestPath;
|
|
409
|
-
}
|
|
410
|
-
async function readAppJson(appJsonPath) {
|
|
411
|
-
const appJson = await fs4.readFile(appJsonPath, "utf8");
|
|
412
|
-
return JSON.parse(appJson);
|
|
413
|
-
}
|
|
414
|
-
async function writeAppJson(appJsonPath, content) {
|
|
415
|
-
await fs4.writeFile(appJsonPath, JSON.stringify(content));
|
|
416
|
-
}
|
|
417
|
-
async function updateAppJsonMetadata(metadata) {
|
|
418
|
-
const appJsonPath = await resolveAppManifestPath();
|
|
419
|
-
const appJson = await readAppJson(appJsonPath);
|
|
420
|
-
await writeAppJson(appJsonPath, {
|
|
421
|
-
...appJson,
|
|
422
|
-
_metadata: metadata
|
|
423
|
-
});
|
|
231
|
+
import * as fs3 from "fs/promises";
|
|
232
|
+
import path3 from "path";
|
|
233
|
+
import { AppsInTossBundle, PlatformType } from "@apps-in-toss/ait-format";
|
|
234
|
+
|
|
235
|
+
// src/utils/getUnityMetaDataEnv.ts
|
|
236
|
+
function getUnityMetaDataEnv() {
|
|
237
|
+
const metaData = process.env.UNITY_METADATA;
|
|
238
|
+
if (!metaData) return {};
|
|
239
|
+
try {
|
|
240
|
+
return JSON.parse(metaData);
|
|
241
|
+
} catch (e) {
|
|
242
|
+
console.warn("UNITY_METADATA is not a valid JSON:", e);
|
|
243
|
+
return {};
|
|
244
|
+
}
|
|
424
245
|
}
|
|
425
246
|
|
|
426
|
-
// src/types.ts
|
|
427
|
-
init_esm_shims();
|
|
428
|
-
var __typia_transform__isFormatUuid = __toESM(require_isFormatUuid(), 1);
|
|
429
|
-
var __typia_transform__validateReport = __toESM(require_validateReport(), 1);
|
|
430
|
-
var __typia_transform__createStandardSchema = __toESM(require_createStandardSchema(), 1);
|
|
431
|
-
var validateAppManifest = (() => {
|
|
432
|
-
const _io0 = (input) => "string" === typeof input.appName && (Array.isArray(input.permissions) && input.permissions.every((elem) => "object" === typeof elem && null !== elem && _iu0(elem))) && ("object" === typeof input._metadata && null !== input._metadata && _io6(input._metadata));
|
|
433
|
-
const _io1 = (input) => "clipboard" === input.name && ("read" === input.access || "write" === input.access);
|
|
434
|
-
const _io2 = (input) => "geolocation" === input.name && "access" === input.access;
|
|
435
|
-
const _io3 = (input) => "contacts" === input.name && ("read" === input.access || "write" === input.access);
|
|
436
|
-
const _io4 = (input) => "photos" === input.name && ("read" === input.access || "write" === input.access);
|
|
437
|
-
const _io5 = (input) => "camera" === input.name && "access" === input.access;
|
|
438
|
-
const _io6 = (input) => Array.isArray(input.bundleFiles) && input.bundleFiles.every((elem) => "string" === typeof elem) && ("string" === typeof input.deploymentId && __typia_transform__isFormatUuid._isFormatUuid(input.deploymentId));
|
|
439
|
-
const _iu0 = (input) => (() => {
|
|
440
|
-
if ("camera" === input.name)
|
|
441
|
-
return _io5(input);
|
|
442
|
-
else if ("photos" === input.name)
|
|
443
|
-
return _io4(input);
|
|
444
|
-
else if ("contacts" === input.name)
|
|
445
|
-
return _io3(input);
|
|
446
|
-
else if ("geolocation" === input.name)
|
|
447
|
-
return _io2(input);
|
|
448
|
-
else if ("clipboard" === input.name)
|
|
449
|
-
return _io1(input);
|
|
450
|
-
else
|
|
451
|
-
return false;
|
|
452
|
-
})();
|
|
453
|
-
const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.appName || _report(_exceptionable, {
|
|
454
|
-
path: _path + ".appName",
|
|
455
|
-
expected: "string",
|
|
456
|
-
value: input.appName
|
|
457
|
-
}), (Array.isArray(input.permissions) || _report(_exceptionable, {
|
|
458
|
-
path: _path + ".permissions",
|
|
459
|
-
expected: "Array<Permission>",
|
|
460
|
-
value: input.permissions
|
|
461
|
-
})) && input.permissions.map((elem, _index3) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
462
|
-
path: _path + ".permissions[" + _index3 + "]",
|
|
463
|
-
expected: "(CameraPermission | ClipboardPermission | ContactsPermission | GeolocationPermission | PhotosPermission)",
|
|
464
|
-
value: elem
|
|
465
|
-
})) && _vu0(elem, _path + ".permissions[" + _index3 + "]", _exceptionable) || _report(_exceptionable, {
|
|
466
|
-
path: _path + ".permissions[" + _index3 + "]",
|
|
467
|
-
expected: "(CameraPermission | ClipboardPermission | ContactsPermission | GeolocationPermission | PhotosPermission)",
|
|
468
|
-
value: elem
|
|
469
|
-
})).every((flag) => flag) || _report(_exceptionable, {
|
|
470
|
-
path: _path + ".permissions",
|
|
471
|
-
expected: "Array<Permission>",
|
|
472
|
-
value: input.permissions
|
|
473
|
-
}), ("object" === typeof input._metadata && null !== input._metadata || _report(_exceptionable, {
|
|
474
|
-
path: _path + "._metadata",
|
|
475
|
-
expected: "__type",
|
|
476
|
-
value: input._metadata
|
|
477
|
-
})) && _vo6(input._metadata, _path + "._metadata", _exceptionable) || _report(_exceptionable, {
|
|
478
|
-
path: _path + "._metadata",
|
|
479
|
-
expected: "__type",
|
|
480
|
-
value: input._metadata
|
|
481
|
-
})].every((flag) => flag);
|
|
482
|
-
const _vo1 = (input, _path, _exceptionable = true) => ["clipboard" === input.name || _report(_exceptionable, {
|
|
483
|
-
path: _path + ".name",
|
|
484
|
-
expected: '"clipboard"',
|
|
485
|
-
value: input.name
|
|
486
|
-
}), "read" === input.access || "write" === input.access || _report(_exceptionable, {
|
|
487
|
-
path: _path + ".access",
|
|
488
|
-
expected: '("read" | "write")',
|
|
489
|
-
value: input.access
|
|
490
|
-
})].every((flag) => flag);
|
|
491
|
-
const _vo2 = (input, _path, _exceptionable = true) => ["geolocation" === input.name || _report(_exceptionable, {
|
|
492
|
-
path: _path + ".name",
|
|
493
|
-
expected: '"geolocation"',
|
|
494
|
-
value: input.name
|
|
495
|
-
}), "access" === input.access || _report(_exceptionable, {
|
|
496
|
-
path: _path + ".access",
|
|
497
|
-
expected: '"access"',
|
|
498
|
-
value: input.access
|
|
499
|
-
})].every((flag) => flag);
|
|
500
|
-
const _vo3 = (input, _path, _exceptionable = true) => ["contacts" === input.name || _report(_exceptionable, {
|
|
501
|
-
path: _path + ".name",
|
|
502
|
-
expected: '"contacts"',
|
|
503
|
-
value: input.name
|
|
504
|
-
}), "read" === input.access || "write" === input.access || _report(_exceptionable, {
|
|
505
|
-
path: _path + ".access",
|
|
506
|
-
expected: '("read" | "write")',
|
|
507
|
-
value: input.access
|
|
508
|
-
})].every((flag) => flag);
|
|
509
|
-
const _vo4 = (input, _path, _exceptionable = true) => ["photos" === input.name || _report(_exceptionable, {
|
|
510
|
-
path: _path + ".name",
|
|
511
|
-
expected: '"photos"',
|
|
512
|
-
value: input.name
|
|
513
|
-
}), "read" === input.access || "write" === input.access || _report(_exceptionable, {
|
|
514
|
-
path: _path + ".access",
|
|
515
|
-
expected: '("read" | "write")',
|
|
516
|
-
value: input.access
|
|
517
|
-
})].every((flag) => flag);
|
|
518
|
-
const _vo5 = (input, _path, _exceptionable = true) => ["camera" === input.name || _report(_exceptionable, {
|
|
519
|
-
path: _path + ".name",
|
|
520
|
-
expected: '"camera"',
|
|
521
|
-
value: input.name
|
|
522
|
-
}), "access" === input.access || _report(_exceptionable, {
|
|
523
|
-
path: _path + ".access",
|
|
524
|
-
expected: '"access"',
|
|
525
|
-
value: input.access
|
|
526
|
-
})].every((flag) => flag);
|
|
527
|
-
const _vo6 = (input, _path, _exceptionable = true) => [(Array.isArray(input.bundleFiles) || _report(_exceptionable, {
|
|
528
|
-
path: _path + ".bundleFiles",
|
|
529
|
-
expected: "Array<string>",
|
|
530
|
-
value: input.bundleFiles
|
|
531
|
-
})) && input.bundleFiles.map((elem, _index4) => "string" === typeof elem || _report(_exceptionable, {
|
|
532
|
-
path: _path + ".bundleFiles[" + _index4 + "]",
|
|
533
|
-
expected: "string",
|
|
534
|
-
value: elem
|
|
535
|
-
})).every((flag) => flag) || _report(_exceptionable, {
|
|
536
|
-
path: _path + ".bundleFiles",
|
|
537
|
-
expected: "Array<string>",
|
|
538
|
-
value: input.bundleFiles
|
|
539
|
-
}), "string" === typeof input.deploymentId && (__typia_transform__isFormatUuid._isFormatUuid(input.deploymentId) || _report(_exceptionable, {
|
|
540
|
-
path: _path + ".deploymentId",
|
|
541
|
-
expected: 'string & Format<"uuid">',
|
|
542
|
-
value: input.deploymentId
|
|
543
|
-
})) || _report(_exceptionable, {
|
|
544
|
-
path: _path + ".deploymentId",
|
|
545
|
-
expected: '(string & Format<"uuid">)',
|
|
546
|
-
value: input.deploymentId
|
|
547
|
-
})].every((flag) => flag);
|
|
548
|
-
const _vu0 = (input, _path, _exceptionable = true) => (() => {
|
|
549
|
-
if ("camera" === input.name)
|
|
550
|
-
return _vo5(input, _path, _exceptionable);
|
|
551
|
-
else if ("photos" === input.name)
|
|
552
|
-
return _vo4(input, _path, _exceptionable);
|
|
553
|
-
else if ("contacts" === input.name)
|
|
554
|
-
return _vo3(input, _path, _exceptionable);
|
|
555
|
-
else if ("geolocation" === input.name)
|
|
556
|
-
return _vo2(input, _path, _exceptionable);
|
|
557
|
-
else if ("clipboard" === input.name)
|
|
558
|
-
return _vo1(input, _path, _exceptionable);
|
|
559
|
-
else
|
|
560
|
-
return _report(_exceptionable, {
|
|
561
|
-
path: _path,
|
|
562
|
-
expected: "(CameraPermission | PhotosPermission | ContactsPermission | GeolocationPermission | ClipboardPermission)",
|
|
563
|
-
value: input
|
|
564
|
-
});
|
|
565
|
-
})();
|
|
566
|
-
const __is = (input) => "object" === typeof input && null !== input && _io0(input);
|
|
567
|
-
let errors;
|
|
568
|
-
let _report;
|
|
569
|
-
return __typia_transform__createStandardSchema._createStandardSchema((input) => {
|
|
570
|
-
if (false === __is(input)) {
|
|
571
|
-
errors = [];
|
|
572
|
-
_report = __typia_transform__validateReport._validateReport(errors);
|
|
573
|
-
((input2, _path, _exceptionable = true) => ("object" === typeof input2 && null !== input2 || _report(true, {
|
|
574
|
-
path: _path + "",
|
|
575
|
-
expected: "AppManifest",
|
|
576
|
-
value: input2
|
|
577
|
-
})) && _vo0(input2, _path + "", true) || _report(true, {
|
|
578
|
-
path: _path + "",
|
|
579
|
-
expected: "AppManifest",
|
|
580
|
-
value: input2
|
|
581
|
-
}))(input, "$input", true);
|
|
582
|
-
const success = 0 === errors.length;
|
|
583
|
-
return success ? {
|
|
584
|
-
success,
|
|
585
|
-
data: input
|
|
586
|
-
} : {
|
|
587
|
-
success,
|
|
588
|
-
errors,
|
|
589
|
-
data: input
|
|
590
|
-
};
|
|
591
|
-
}
|
|
592
|
-
return {
|
|
593
|
-
success: true,
|
|
594
|
-
data: input
|
|
595
|
-
};
|
|
596
|
-
});
|
|
597
|
-
})();
|
|
598
|
-
var validateAppInTossPluginOptions = (() => {
|
|
599
|
-
const _io0 = (input) => (void 0 === input.appType || "general" === input.appType || "game" === input.appType) && ("object" === typeof input.brand && null !== input.brand && _io1(input.brand)) && (Array.isArray(input.permissions) && input.permissions.every((elem) => "object" === typeof elem && null !== elem && _iu0(elem))) && (void 0 === input.navigationBar || "object" === typeof input.navigationBar && null !== input.navigationBar && false === Array.isArray(input.navigationBar) && _io7(input.navigationBar));
|
|
600
|
-
const _io1 = (input) => "string" === typeof input.displayName && "string" === typeof input.primaryColor && "string" === typeof input.icon;
|
|
601
|
-
const _io2 = (input) => "clipboard" === input.name && ("read" === input.access || "write" === input.access);
|
|
602
|
-
const _io3 = (input) => "geolocation" === input.name && "access" === input.access;
|
|
603
|
-
const _io4 = (input) => "contacts" === input.name && ("read" === input.access || "write" === input.access);
|
|
604
|
-
const _io5 = (input) => "photos" === input.name && ("read" === input.access || "write" === input.access);
|
|
605
|
-
const _io6 = (input) => "camera" === input.name && "access" === input.access;
|
|
606
|
-
const _io7 = (input) => (void 0 === input.withBackButton || "boolean" === typeof input.withBackButton) && (void 0 === input.withHomeButton || "boolean" === typeof input.withHomeButton) && (void 0 === input.initialAccessoryButton || "object" === typeof input.initialAccessoryButton && null !== input.initialAccessoryButton && _io8(input.initialAccessoryButton));
|
|
607
|
-
const _io8 = (input) => "string" === typeof input.id && "string" === typeof input.title && ("object" === typeof input.icon && null !== input.icon && _iu1(input.icon));
|
|
608
|
-
const _io9 = (input) => "object" === typeof input.source && null !== input.source && _io10(input.source) && (null !== input.name && void 0 === input.name);
|
|
609
|
-
const _io10 = (input) => "string" === typeof input.uri;
|
|
610
|
-
const _io11 = (input) => "string" === typeof input.name && (null !== input.source && void 0 === input.source);
|
|
611
|
-
const _iu0 = (input) => (() => {
|
|
612
|
-
if ("camera" === input.name)
|
|
613
|
-
return _io6(input);
|
|
614
|
-
else if ("photos" === input.name)
|
|
615
|
-
return _io5(input);
|
|
616
|
-
else if ("contacts" === input.name)
|
|
617
|
-
return _io4(input);
|
|
618
|
-
else if ("geolocation" === input.name)
|
|
619
|
-
return _io3(input);
|
|
620
|
-
else if ("clipboard" === input.name)
|
|
621
|
-
return _io2(input);
|
|
622
|
-
else
|
|
623
|
-
return false;
|
|
624
|
-
})();
|
|
625
|
-
const _iu1 = (input) => (() => {
|
|
626
|
-
if ("string" === typeof input.name)
|
|
627
|
-
return _io11(input);
|
|
628
|
-
else if ("object" === typeof input.source && null !== input.source && _io10(input.source))
|
|
629
|
-
return _io9(input);
|
|
630
|
-
else
|
|
631
|
-
return false;
|
|
632
|
-
})();
|
|
633
|
-
const _vo0 = (input, _path, _exceptionable = true) => [void 0 === input.appType || "general" === input.appType || "game" === input.appType || _report(_exceptionable, {
|
|
634
|
-
path: _path + ".appType",
|
|
635
|
-
expected: '("game" | "general" | undefined)',
|
|
636
|
-
value: input.appType
|
|
637
|
-
}), ("object" === typeof input.brand && null !== input.brand || _report(_exceptionable, {
|
|
638
|
-
path: _path + ".brand",
|
|
639
|
-
expected: "__type",
|
|
640
|
-
value: input.brand
|
|
641
|
-
})) && _vo1(input.brand, _path + ".brand", _exceptionable) || _report(_exceptionable, {
|
|
642
|
-
path: _path + ".brand",
|
|
643
|
-
expected: "__type",
|
|
644
|
-
value: input.brand
|
|
645
|
-
}), (Array.isArray(input.permissions) || _report(_exceptionable, {
|
|
646
|
-
path: _path + ".permissions",
|
|
647
|
-
expected: "Array<Permission>",
|
|
648
|
-
value: input.permissions
|
|
649
|
-
})) && input.permissions.map((elem, _index2) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
650
|
-
path: _path + ".permissions[" + _index2 + "]",
|
|
651
|
-
expected: "(CameraPermission | ClipboardPermission | ContactsPermission | GeolocationPermission | PhotosPermission)",
|
|
652
|
-
value: elem
|
|
653
|
-
})) && _vu0(elem, _path + ".permissions[" + _index2 + "]", _exceptionable) || _report(_exceptionable, {
|
|
654
|
-
path: _path + ".permissions[" + _index2 + "]",
|
|
655
|
-
expected: "(CameraPermission | ClipboardPermission | ContactsPermission | GeolocationPermission | PhotosPermission)",
|
|
656
|
-
value: elem
|
|
657
|
-
})).every((flag) => flag) || _report(_exceptionable, {
|
|
658
|
-
path: _path + ".permissions",
|
|
659
|
-
expected: "Array<Permission>",
|
|
660
|
-
value: input.permissions
|
|
661
|
-
}), void 0 === input.navigationBar || ("object" === typeof input.navigationBar && null !== input.navigationBar && false === Array.isArray(input.navigationBar) || _report(_exceptionable, {
|
|
662
|
-
path: _path + ".navigationBar",
|
|
663
|
-
expected: "(__type.o1 | undefined)",
|
|
664
|
-
value: input.navigationBar
|
|
665
|
-
})) && _vo7(input.navigationBar, _path + ".navigationBar", _exceptionable) || _report(_exceptionable, {
|
|
666
|
-
path: _path + ".navigationBar",
|
|
667
|
-
expected: "(__type.o1 | undefined)",
|
|
668
|
-
value: input.navigationBar
|
|
669
|
-
})].every((flag) => flag);
|
|
670
|
-
const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.displayName || _report(_exceptionable, {
|
|
671
|
-
path: _path + ".displayName",
|
|
672
|
-
expected: "string",
|
|
673
|
-
value: input.displayName
|
|
674
|
-
}), "string" === typeof input.primaryColor || _report(_exceptionable, {
|
|
675
|
-
path: _path + ".primaryColor",
|
|
676
|
-
expected: "string",
|
|
677
|
-
value: input.primaryColor
|
|
678
|
-
}), "string" === typeof input.icon || _report(_exceptionable, {
|
|
679
|
-
path: _path + ".icon",
|
|
680
|
-
expected: "string",
|
|
681
|
-
value: input.icon
|
|
682
|
-
})].every((flag) => flag);
|
|
683
|
-
const _vo2 = (input, _path, _exceptionable = true) => ["clipboard" === input.name || _report(_exceptionable, {
|
|
684
|
-
path: _path + ".name",
|
|
685
|
-
expected: '"clipboard"',
|
|
686
|
-
value: input.name
|
|
687
|
-
}), "read" === input.access || "write" === input.access || _report(_exceptionable, {
|
|
688
|
-
path: _path + ".access",
|
|
689
|
-
expected: '("read" | "write")',
|
|
690
|
-
value: input.access
|
|
691
|
-
})].every((flag) => flag);
|
|
692
|
-
const _vo3 = (input, _path, _exceptionable = true) => ["geolocation" === input.name || _report(_exceptionable, {
|
|
693
|
-
path: _path + ".name",
|
|
694
|
-
expected: '"geolocation"',
|
|
695
|
-
value: input.name
|
|
696
|
-
}), "access" === input.access || _report(_exceptionable, {
|
|
697
|
-
path: _path + ".access",
|
|
698
|
-
expected: '"access"',
|
|
699
|
-
value: input.access
|
|
700
|
-
})].every((flag) => flag);
|
|
701
|
-
const _vo4 = (input, _path, _exceptionable = true) => ["contacts" === input.name || _report(_exceptionable, {
|
|
702
|
-
path: _path + ".name",
|
|
703
|
-
expected: '"contacts"',
|
|
704
|
-
value: input.name
|
|
705
|
-
}), "read" === input.access || "write" === input.access || _report(_exceptionable, {
|
|
706
|
-
path: _path + ".access",
|
|
707
|
-
expected: '("read" | "write")',
|
|
708
|
-
value: input.access
|
|
709
|
-
})].every((flag) => flag);
|
|
710
|
-
const _vo5 = (input, _path, _exceptionable = true) => ["photos" === input.name || _report(_exceptionable, {
|
|
711
|
-
path: _path + ".name",
|
|
712
|
-
expected: '"photos"',
|
|
713
|
-
value: input.name
|
|
714
|
-
}), "read" === input.access || "write" === input.access || _report(_exceptionable, {
|
|
715
|
-
path: _path + ".access",
|
|
716
|
-
expected: '("read" | "write")',
|
|
717
|
-
value: input.access
|
|
718
|
-
})].every((flag) => flag);
|
|
719
|
-
const _vo6 = (input, _path, _exceptionable = true) => ["camera" === input.name || _report(_exceptionable, {
|
|
720
|
-
path: _path + ".name",
|
|
721
|
-
expected: '"camera"',
|
|
722
|
-
value: input.name
|
|
723
|
-
}), "access" === input.access || _report(_exceptionable, {
|
|
724
|
-
path: _path + ".access",
|
|
725
|
-
expected: '"access"',
|
|
726
|
-
value: input.access
|
|
727
|
-
})].every((flag) => flag);
|
|
728
|
-
const _vo7 = (input, _path, _exceptionable = true) => [void 0 === input.withBackButton || "boolean" === typeof input.withBackButton || _report(_exceptionable, {
|
|
729
|
-
path: _path + ".withBackButton",
|
|
730
|
-
expected: "(boolean | undefined)",
|
|
731
|
-
value: input.withBackButton
|
|
732
|
-
}), void 0 === input.withHomeButton || "boolean" === typeof input.withHomeButton || _report(_exceptionable, {
|
|
733
|
-
path: _path + ".withHomeButton",
|
|
734
|
-
expected: "(boolean | undefined)",
|
|
735
|
-
value: input.withHomeButton
|
|
736
|
-
}), void 0 === input.initialAccessoryButton || ("object" === typeof input.initialAccessoryButton && null !== input.initialAccessoryButton || _report(_exceptionable, {
|
|
737
|
-
path: _path + ".initialAccessoryButton",
|
|
738
|
-
expected: "(InitialAccessoryButton | undefined)",
|
|
739
|
-
value: input.initialAccessoryButton
|
|
740
|
-
})) && _vo8(input.initialAccessoryButton, _path + ".initialAccessoryButton", _exceptionable) || _report(_exceptionable, {
|
|
741
|
-
path: _path + ".initialAccessoryButton",
|
|
742
|
-
expected: "(InitialAccessoryButton | undefined)",
|
|
743
|
-
value: input.initialAccessoryButton
|
|
744
|
-
})].every((flag) => flag);
|
|
745
|
-
const _vo8 = (input, _path, _exceptionable = true) => ["string" === typeof input.id || _report(_exceptionable, {
|
|
746
|
-
path: _path + ".id",
|
|
747
|
-
expected: "string",
|
|
748
|
-
value: input.id
|
|
749
|
-
}), "string" === typeof input.title || _report(_exceptionable, {
|
|
750
|
-
path: _path + ".title",
|
|
751
|
-
expected: "string",
|
|
752
|
-
value: input.title
|
|
753
|
-
}), ("object" === typeof input.icon && null !== input.icon || _report(_exceptionable, {
|
|
754
|
-
path: _path + ".icon",
|
|
755
|
-
expected: "(__type.o2 | __type.o4)",
|
|
756
|
-
value: input.icon
|
|
757
|
-
})) && _vu1(input.icon, _path + ".icon", _exceptionable) || _report(_exceptionable, {
|
|
758
|
-
path: _path + ".icon",
|
|
759
|
-
expected: "(__type.o2 | __type.o4)",
|
|
760
|
-
value: input.icon
|
|
761
|
-
})].every((flag) => flag);
|
|
762
|
-
const _vo9 = (input, _path, _exceptionable = true) => [("object" === typeof input.source && null !== input.source || _report(_exceptionable, {
|
|
763
|
-
path: _path + ".source",
|
|
764
|
-
expected: "__type.o3",
|
|
765
|
-
value: input.source
|
|
766
|
-
})) && _vo10(input.source, _path + ".source", _exceptionable) || _report(_exceptionable, {
|
|
767
|
-
path: _path + ".source",
|
|
768
|
-
expected: "__type.o3",
|
|
769
|
-
value: input.source
|
|
770
|
-
}), (null !== input.name || _report(_exceptionable, {
|
|
771
|
-
path: _path + ".name",
|
|
772
|
-
expected: "undefined",
|
|
773
|
-
value: input.name
|
|
774
|
-
})) && (void 0 === input.name || _report(_exceptionable, {
|
|
775
|
-
path: _path + ".name",
|
|
776
|
-
expected: "undefined",
|
|
777
|
-
value: input.name
|
|
778
|
-
}))].every((flag) => flag);
|
|
779
|
-
const _vo10 = (input, _path, _exceptionable = true) => ["string" === typeof input.uri || _report(_exceptionable, {
|
|
780
|
-
path: _path + ".uri",
|
|
781
|
-
expected: "string",
|
|
782
|
-
value: input.uri
|
|
783
|
-
})].every((flag) => flag);
|
|
784
|
-
const _vo11 = (input, _path, _exceptionable = true) => ["string" === typeof input.name || _report(_exceptionable, {
|
|
785
|
-
path: _path + ".name",
|
|
786
|
-
expected: "string",
|
|
787
|
-
value: input.name
|
|
788
|
-
}), (null !== input.source || _report(_exceptionable, {
|
|
789
|
-
path: _path + ".source",
|
|
790
|
-
expected: "undefined",
|
|
791
|
-
value: input.source
|
|
792
|
-
})) && (void 0 === input.source || _report(_exceptionable, {
|
|
793
|
-
path: _path + ".source",
|
|
794
|
-
expected: "undefined",
|
|
795
|
-
value: input.source
|
|
796
|
-
}))].every((flag) => flag);
|
|
797
|
-
const _vu0 = (input, _path, _exceptionable = true) => (() => {
|
|
798
|
-
if ("camera" === input.name)
|
|
799
|
-
return _vo6(input, _path, _exceptionable);
|
|
800
|
-
else if ("photos" === input.name)
|
|
801
|
-
return _vo5(input, _path, _exceptionable);
|
|
802
|
-
else if ("contacts" === input.name)
|
|
803
|
-
return _vo4(input, _path, _exceptionable);
|
|
804
|
-
else if ("geolocation" === input.name)
|
|
805
|
-
return _vo3(input, _path, _exceptionable);
|
|
806
|
-
else if ("clipboard" === input.name)
|
|
807
|
-
return _vo2(input, _path, _exceptionable);
|
|
808
|
-
else
|
|
809
|
-
return _report(_exceptionable, {
|
|
810
|
-
path: _path,
|
|
811
|
-
expected: "(CameraPermission | PhotosPermission | ContactsPermission | GeolocationPermission | ClipboardPermission)",
|
|
812
|
-
value: input
|
|
813
|
-
});
|
|
814
|
-
})();
|
|
815
|
-
const _vu1 = (input, _path, _exceptionable = true) => (() => {
|
|
816
|
-
if ("string" === typeof input.name)
|
|
817
|
-
return _vo11(input, _path, _exceptionable);
|
|
818
|
-
else if ("object" === typeof input.source && null !== input.source && _vo10(input.source, _path + ".source", false))
|
|
819
|
-
return _vo9(input, _path, _exceptionable);
|
|
820
|
-
else
|
|
821
|
-
return _report(_exceptionable, {
|
|
822
|
-
path: _path,
|
|
823
|
-
expected: "(__type.o4 | __type.o2)",
|
|
824
|
-
value: input
|
|
825
|
-
});
|
|
826
|
-
})();
|
|
827
|
-
const __is = (input) => "object" === typeof input && null !== input && _io0(input);
|
|
828
|
-
let errors;
|
|
829
|
-
let _report;
|
|
830
|
-
return __typia_transform__createStandardSchema._createStandardSchema((input) => {
|
|
831
|
-
if (false === __is(input)) {
|
|
832
|
-
errors = [];
|
|
833
|
-
_report = __typia_transform__validateReport._validateReport(errors);
|
|
834
|
-
((input2, _path, _exceptionable = true) => ("object" === typeof input2 && null !== input2 || _report(true, {
|
|
835
|
-
path: _path + "",
|
|
836
|
-
expected: "AppsInTossPluginOptions",
|
|
837
|
-
value: input2
|
|
838
|
-
})) && _vo0(input2, _path + "", true) || _report(true, {
|
|
839
|
-
path: _path + "",
|
|
840
|
-
expected: "AppsInTossPluginOptions",
|
|
841
|
-
value: input2
|
|
842
|
-
}))(input, "$input", true);
|
|
843
|
-
const success = 0 === errors.length;
|
|
844
|
-
return success ? {
|
|
845
|
-
success,
|
|
846
|
-
data: input
|
|
847
|
-
} : {
|
|
848
|
-
success,
|
|
849
|
-
errors,
|
|
850
|
-
data: input
|
|
851
|
-
};
|
|
852
|
-
}
|
|
853
|
-
return {
|
|
854
|
-
success: true,
|
|
855
|
-
data: input
|
|
856
|
-
};
|
|
857
|
-
});
|
|
858
|
-
})();
|
|
859
|
-
|
|
860
247
|
// src/utils/createArtifact.ts
|
|
861
|
-
async function validateZip(zipPath) {
|
|
862
|
-
const appJsonString = await readZipContent(zipPath, "app.json");
|
|
863
|
-
const appJson = JSON.parse(appJsonString);
|
|
864
|
-
const validated = validateAppManifest(appJson);
|
|
865
|
-
if (!validated.success) {
|
|
866
|
-
throw new Error("granite.config.ts \uAC12\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.");
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
248
|
async function createArtifact(options) {
|
|
870
|
-
const { bundleFiles, outfile, appJsonPath, reactNativeVersion } = options;
|
|
249
|
+
const { bundleFiles, outfile, appJsonPath, reactNativeVersion, sdkVersion, isGame } = options;
|
|
250
|
+
const unityMetaData = getUnityMetaDataEnv();
|
|
251
|
+
const appJsonContent = await fs3.readFile(appJsonPath, "utf-8");
|
|
252
|
+
const appJson = JSON.parse(appJsonContent);
|
|
253
|
+
const runtime = reactNativeVersion.replace(/\./g, "_");
|
|
871
254
|
const namedBundleFiles = bundleFiles.map((bundle) => {
|
|
872
|
-
const
|
|
873
|
-
const extension = path5.extname(originalName);
|
|
874
|
-
const runtime = reactNativeVersion.replace(new RegExp(/\./g), "_");
|
|
255
|
+
const extension = path3.extname(bundle.path);
|
|
875
256
|
return {
|
|
876
257
|
path: bundle.path,
|
|
877
|
-
|
|
878
|
-
name: `bundle.${bundle.platform}.${runtime}${extension === ".map" ? `.js.map` : extension}`
|
|
258
|
+
name: `bundle.${bundle.platform}.${runtime}${extension === ".map" ? ".js.map" : extension}`
|
|
879
259
|
};
|
|
880
260
|
});
|
|
881
|
-
|
|
882
|
-
runtimeVersion: reactNativeVersion,
|
|
883
|
-
bundleFiles: namedBundleFiles.map(({ name }) => name),
|
|
261
|
+
const writer = AppsInTossBundle.writer({
|
|
884
262
|
deploymentId: options.deploymentId,
|
|
885
|
-
|
|
263
|
+
appName: appJson.appName,
|
|
264
|
+
createdBy: "@apps-in-toss/plugins"
|
|
886
265
|
});
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
266
|
+
writer.setMetadata({
|
|
267
|
+
platform: PlatformType.REACT_NATIVE,
|
|
268
|
+
runtimeVersion: reactNativeVersion,
|
|
269
|
+
isGame,
|
|
270
|
+
sdkVersion,
|
|
271
|
+
bundleFiles: namedBundleFiles.map(({ name }) => name),
|
|
272
|
+
packageJson: options.packageJson,
|
|
273
|
+
extra: { unityMetaData }
|
|
890
274
|
});
|
|
891
|
-
|
|
275
|
+
for (const permission of appJson.permissions ?? []) {
|
|
276
|
+
writer.addPermission(permission.name, permission.access);
|
|
277
|
+
}
|
|
278
|
+
for (const bundle of namedBundleFiles) {
|
|
279
|
+
const content = await fs3.readFile(bundle.path);
|
|
280
|
+
writer.addFile(bundle.name, new Uint8Array(content));
|
|
281
|
+
}
|
|
282
|
+
for (const file of options.additionalFilesToZip ?? []) {
|
|
283
|
+
const content = await fs3.readFile(file.path);
|
|
284
|
+
writer.addFile(file.name, new Uint8Array(content));
|
|
285
|
+
}
|
|
286
|
+
const buffer = await writer.toBuffer();
|
|
287
|
+
await fs3.writeFile(outfile, buffer);
|
|
892
288
|
return outfile;
|
|
893
289
|
}
|
|
894
290
|
|
|
895
291
|
// src/plugins/artifact.ts
|
|
896
|
-
function appsInTossCreateArtifact(deploymentId) {
|
|
897
|
-
const packageRoot =
|
|
292
|
+
function appsInTossCreateArtifact(deploymentId, buildOption) {
|
|
293
|
+
const packageRoot = getPackageRoot2();
|
|
898
294
|
return {
|
|
899
295
|
name: "apps-in-toss:create-artifact",
|
|
900
296
|
build: {
|
|
@@ -909,6 +305,8 @@ function appsInTossCreateArtifact(deploymentId) {
|
|
|
909
305
|
const artifactOutfile = await createArtifact({
|
|
910
306
|
reactNativeVersion: REACT_NATIVE_VERSION,
|
|
911
307
|
deploymentId,
|
|
308
|
+
sdkVersion: buildOption.sdkVersion,
|
|
309
|
+
isGame: buildOption.isGame,
|
|
912
310
|
packageJson: { dependencies, devDependencies },
|
|
913
311
|
bundleFiles: buildResults.filter(isBuildSuccess).map(({ outfile, sourcemapOutfile, platform }) => [
|
|
914
312
|
{
|
|
@@ -920,13 +318,13 @@ function appsInTossCreateArtifact(deploymentId) {
|
|
|
920
318
|
platform
|
|
921
319
|
}
|
|
922
320
|
]).flat(),
|
|
923
|
-
outfile:
|
|
924
|
-
appJsonPath:
|
|
321
|
+
outfile: path4.join(cwd, `${appName}.ait`),
|
|
322
|
+
appJsonPath: path4.join(packageRoot, ".granite", APP_MANIFEST_NAME)
|
|
925
323
|
});
|
|
926
324
|
if (!artifactOutfile) {
|
|
927
325
|
throw new Error("\uC544\uD2F0\uD329\uD2B8 \uC0DD\uC131\uC5D0 \uC2E4\uD328\uD588\uC5B4\uC694.");
|
|
928
326
|
}
|
|
929
|
-
const filename =
|
|
327
|
+
const filename = path4.basename(artifactOutfile);
|
|
930
328
|
log(`\u2705 ${pc2.green(`${filename}`)} \uBE4C\uB4DC \uC644\uB8CC`);
|
|
931
329
|
}
|
|
932
330
|
}
|
|
@@ -934,7 +332,6 @@ function appsInTossCreateArtifact(deploymentId) {
|
|
|
934
332
|
}
|
|
935
333
|
|
|
936
334
|
// src/plugins/build.ts
|
|
937
|
-
init_esm_shims();
|
|
938
335
|
function appsInTossEsbuildConfig(envScript) {
|
|
939
336
|
return {
|
|
940
337
|
name: "apps-in-toss:esbuild-config",
|
|
@@ -961,10 +358,9 @@ function appsInTossMetroConfig(envScriptPath) {
|
|
|
961
358
|
}
|
|
962
359
|
|
|
963
360
|
// src/plugins/compat.ts
|
|
964
|
-
|
|
965
|
-
import
|
|
966
|
-
import
|
|
967
|
-
import { getLocalTempDirectoryPath, getPackageRoot as getPackageRoot4 } from "@granite-js/utils";
|
|
361
|
+
import fs4 from "fs";
|
|
362
|
+
import path5 from "path";
|
|
363
|
+
import { getLocalTempDirectoryPath, getPackageRoot as getPackageRoot3 } from "@granite-js/utils";
|
|
968
364
|
var nativeModuleProxyContent = `
|
|
969
365
|
(function () {
|
|
970
366
|
global.nativeModuleProxy = new Proxy(global.nativeModuleProxy, {
|
|
@@ -1070,8 +466,8 @@ var reactNativeModuleProxyContent = `
|
|
|
1070
466
|
);
|
|
1071
467
|
`;
|
|
1072
468
|
function bedrockCompat({ isHost }) {
|
|
1073
|
-
const metroPolyfillContent =
|
|
1074
|
-
|
|
469
|
+
const metroPolyfillContent = path5.join(getLocalTempDirectoryPath(getPackageRoot3()), "metro-native-module-proxy.js");
|
|
470
|
+
fs4.writeFileSync(metroPolyfillContent, nativeModuleProxyContent);
|
|
1075
471
|
return {
|
|
1076
472
|
name: "bedrock-compat-plugin",
|
|
1077
473
|
config: {
|
|
@@ -1089,11 +485,7 @@ function bedrockCompat({ isHost }) {
|
|
|
1089
485
|
};
|
|
1090
486
|
}
|
|
1091
487
|
|
|
1092
|
-
// src/plugins/devServer.ts
|
|
1093
|
-
init_esm_shims();
|
|
1094
|
-
|
|
1095
488
|
// src/utils/createServerPermissionsMiddleware.ts
|
|
1096
|
-
init_esm_shims();
|
|
1097
489
|
function createServerPermissionsMiddleware(permissions) {
|
|
1098
490
|
const parsedPermissions = parsePermissions(permissions);
|
|
1099
491
|
return (req, res, next) => {
|
|
@@ -1110,12 +502,12 @@ function createServerPermissionsMiddleware(permissions) {
|
|
|
1110
502
|
function parsePermissions(permissions) {
|
|
1111
503
|
const permissionMap = /* @__PURE__ */ new Map();
|
|
1112
504
|
for (const permission of permissions) {
|
|
1113
|
-
const { name, access
|
|
505
|
+
const { name, access } = permission;
|
|
1114
506
|
if (!permissionMap.has(name)) {
|
|
1115
507
|
permissionMap.set(name, /* @__PURE__ */ new Set());
|
|
1116
508
|
}
|
|
1117
509
|
let accessValue = null;
|
|
1118
|
-
switch (
|
|
510
|
+
switch (access) {
|
|
1119
511
|
case "read":
|
|
1120
512
|
accessValue = "r";
|
|
1121
513
|
break;
|
|
@@ -1148,11 +540,7 @@ function appsInTossDevServer(options) {
|
|
|
1148
540
|
};
|
|
1149
541
|
}
|
|
1150
542
|
|
|
1151
|
-
// src/plugins/notice.ts
|
|
1152
|
-
init_esm_shims();
|
|
1153
|
-
|
|
1154
543
|
// src/plugins/resolve.ts
|
|
1155
|
-
init_esm_shims();
|
|
1156
544
|
import Module from "module";
|
|
1157
545
|
function getRequire() {
|
|
1158
546
|
return typeof __require === "function" ? __require : Module.createRequire(import.meta.url);
|
|
@@ -1176,17 +564,21 @@ function requireMicroFrontendRuntime() {
|
|
|
1176
564
|
}
|
|
1177
565
|
|
|
1178
566
|
// src/utils/generateDeploymentId.ts
|
|
1179
|
-
init_esm_shims();
|
|
1180
567
|
import { uuidv7 } from "uuidv7";
|
|
1181
568
|
function generateDeploymentId() {
|
|
1182
569
|
return uuidv7();
|
|
1183
570
|
}
|
|
1184
571
|
|
|
572
|
+
// src/utils/getSdkVersion.ts
|
|
573
|
+
function getSdkVersion() {
|
|
574
|
+
const packageJson = require_package();
|
|
575
|
+
return packageJson.version;
|
|
576
|
+
}
|
|
577
|
+
|
|
1185
578
|
// src/utils/setupRuntimeSetupScript.ts
|
|
1186
|
-
|
|
1187
|
-
import
|
|
1188
|
-
import
|
|
1189
|
-
import { getPackageRoot as getPackageRoot5 } from "@granite-js/utils";
|
|
579
|
+
import fs5 from "node:fs";
|
|
580
|
+
import path6 from "node:path";
|
|
581
|
+
import { getPackageRoot as getPackageRoot4 } from "@granite-js/utils";
|
|
1190
582
|
import { transformSync } from "esbuild";
|
|
1191
583
|
function setupHostRuntimeSetupScript(metadata) {
|
|
1192
584
|
const script = getRuntimeSetupScript(metadata, HOST_CONTEXT_IDENTIFIER);
|
|
@@ -1216,15 +608,15 @@ function getRuntimeSetupScript(metadata, identifier) {
|
|
|
1216
608
|
}).code;
|
|
1217
609
|
}
|
|
1218
610
|
function writeRuntimeSetupScript(script) {
|
|
1219
|
-
const packageRoot =
|
|
1220
|
-
const granitePath =
|
|
611
|
+
const packageRoot = getPackageRoot4();
|
|
612
|
+
const granitePath = path6.join(packageRoot, ".granite");
|
|
1221
613
|
try {
|
|
1222
|
-
|
|
614
|
+
fs5.accessSync(granitePath);
|
|
1223
615
|
} catch {
|
|
1224
|
-
|
|
616
|
+
fs5.mkdirSync(granitePath, { recursive: true });
|
|
1225
617
|
}
|
|
1226
|
-
const envFilePath =
|
|
1227
|
-
|
|
618
|
+
const envFilePath = path6.join(granitePath, ".apps-in-toss.env.js");
|
|
619
|
+
fs5.writeFileSync(envFilePath, script, "utf-8");
|
|
1228
620
|
return envFilePath;
|
|
1229
621
|
}
|
|
1230
622
|
function getBedrockCompatScript() {
|
|
@@ -1295,6 +687,11 @@ function appsInTossHost(options) {
|
|
|
1295
687
|
deploymentId,
|
|
1296
688
|
environment: getHostEnvironment()
|
|
1297
689
|
});
|
|
690
|
+
const sdkVersion = getSdkVersion();
|
|
691
|
+
const buildOptions = {
|
|
692
|
+
sdkVersion,
|
|
693
|
+
isGame: false
|
|
694
|
+
};
|
|
1298
695
|
return [
|
|
1299
696
|
requireMicroFrontendRuntime(),
|
|
1300
697
|
microFrontend({
|
|
@@ -1310,7 +707,7 @@ function appsInTossHost(options) {
|
|
|
1310
707
|
}),
|
|
1311
708
|
appsInTossAppJson({ permissions: PERMISSIONS }),
|
|
1312
709
|
appsInTossDevServer({ permissions: PERMISSIONS }),
|
|
1313
|
-
appsInTossCreateArtifact(deploymentId),
|
|
710
|
+
appsInTossCreateArtifact(deploymentId, buildOptions),
|
|
1314
711
|
appsInTossEsbuildConfig(contents),
|
|
1315
712
|
appsInTossMetroConfig(envFilePath),
|
|
1316
713
|
bedrockCompat({ isHost: true }),
|