@apps-in-toss/plugins 1.14.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +152 -71
- package/dist/index.d.cts +28 -3
- package/dist/index.d.ts +28 -3
- package/dist/index.js +155 -78
- package/dist/internal.cjs +89 -275
- package/dist/internal.d.cts +3 -1
- package/dist/internal.d.ts +3 -1
- package/dist/internal.js +95 -283
- package/package.json +7 -6
package/dist/index.cjs
CHANGED
|
@@ -33,10 +33,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
33
|
));
|
|
34
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
35
|
|
|
36
|
-
// ../../../.yarn/__virtual__/tsup-virtual-
|
|
36
|
+
// ../../../.yarn/__virtual__/tsup-virtual-5946fc3428/0/cache/tsup-npm-8.4.0-f78d2622c9-c6636ffd6a.zip/node_modules/tsup/assets/cjs_shims.js
|
|
37
37
|
var getImportMetaUrl, importMetaUrl;
|
|
38
38
|
var init_cjs_shims = __esm({
|
|
39
|
-
"../../../.yarn/__virtual__/tsup-virtual-
|
|
39
|
+
"../../../.yarn/__virtual__/tsup-virtual-5946fc3428/0/cache/tsup-npm-8.4.0-f78d2622c9-c6636ffd6a.zip/node_modules/tsup/assets/cjs_shims.js"() {
|
|
40
40
|
"use strict";
|
|
41
41
|
getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
42
42
|
importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
@@ -64,11 +64,11 @@ var require_validateReport = __commonJS({
|
|
|
64
64
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
65
65
|
exports2._validateReport = void 0;
|
|
66
66
|
var _validateReport2 = (array) => {
|
|
67
|
-
const reportable = (
|
|
67
|
+
const reportable = (path9) => {
|
|
68
68
|
if (array.length === 0)
|
|
69
69
|
return true;
|
|
70
70
|
const last = array[array.length - 1].path;
|
|
71
|
-
return
|
|
71
|
+
return path9.length > last.length || last.substring(0, path9.length) !== path9;
|
|
72
72
|
};
|
|
73
73
|
return (exceptable, error2) => {
|
|
74
74
|
var _a;
|
|
@@ -124,24 +124,24 @@ var require_createStandardSchema = __commonJS({
|
|
|
124
124
|
PathParserState2[PathParserState2["StringKey"] = 2] = "StringKey";
|
|
125
125
|
PathParserState2[PathParserState2["NumberKey"] = 3] = "NumberKey";
|
|
126
126
|
})(PathParserState || (PathParserState = {}));
|
|
127
|
-
var typiaPathToStandardSchemaPath = (
|
|
128
|
-
if (!
|
|
129
|
-
throw new Error(`Invalid path: ${JSON.stringify(
|
|
127
|
+
var typiaPathToStandardSchemaPath = (path9) => {
|
|
128
|
+
if (!path9.startsWith("$input")) {
|
|
129
|
+
throw new Error(`Invalid path: ${JSON.stringify(path9)}`);
|
|
130
130
|
}
|
|
131
131
|
const segments = [];
|
|
132
132
|
let currentSegment = "";
|
|
133
133
|
let state = PathParserState.Start;
|
|
134
134
|
let index = "$input".length - 1;
|
|
135
|
-
while (index <
|
|
135
|
+
while (index < path9.length - 1) {
|
|
136
136
|
index++;
|
|
137
|
-
const char =
|
|
137
|
+
const char = path9[index];
|
|
138
138
|
if (state === PathParserState.Property) {
|
|
139
139
|
if (char === "." || char === "[") {
|
|
140
140
|
segments.push({
|
|
141
141
|
key: currentSegment
|
|
142
142
|
});
|
|
143
143
|
state = PathParserState.Start;
|
|
144
|
-
} else if (index ===
|
|
144
|
+
} else if (index === path9.length - 1) {
|
|
145
145
|
currentSegment += char;
|
|
146
146
|
segments.push({
|
|
147
147
|
key: currentSegment
|
|
@@ -159,9 +159,9 @@ var require_createStandardSchema = __commonJS({
|
|
|
159
159
|
index += 2;
|
|
160
160
|
state = PathParserState.Start;
|
|
161
161
|
} else if (char === "\\") {
|
|
162
|
-
currentSegment +=
|
|
162
|
+
currentSegment += path9[index];
|
|
163
163
|
index++;
|
|
164
|
-
currentSegment +=
|
|
164
|
+
currentSegment += path9[index];
|
|
165
165
|
} else {
|
|
166
166
|
currentSegment += char;
|
|
167
167
|
}
|
|
@@ -176,11 +176,11 @@ var require_createStandardSchema = __commonJS({
|
|
|
176
176
|
currentSegment += char;
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
if (state === PathParserState.Start && index <
|
|
180
|
-
const newChar =
|
|
179
|
+
if (state === PathParserState.Start && index < path9.length - 1) {
|
|
180
|
+
const newChar = path9[index];
|
|
181
181
|
currentSegment = "";
|
|
182
182
|
if (newChar === "[") {
|
|
183
|
-
if (
|
|
183
|
+
if (path9[index + 1] === '"') {
|
|
184
184
|
state = PathParserState.StringKey;
|
|
185
185
|
index++;
|
|
186
186
|
currentSegment = '"';
|
|
@@ -195,7 +195,7 @@ var require_createStandardSchema = __commonJS({
|
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
if (state !== PathParserState.Start) {
|
|
198
|
-
throw new Error(`Failed to parse path: ${JSON.stringify(
|
|
198
|
+
throw new Error(`Failed to parse path: ${JSON.stringify(path9)}`);
|
|
199
199
|
}
|
|
200
200
|
return segments;
|
|
201
201
|
};
|
|
@@ -208,7 +208,7 @@ var require_package = __commonJS({
|
|
|
208
208
|
module2.exports = {
|
|
209
209
|
name: "@apps-in-toss/plugins",
|
|
210
210
|
type: "module",
|
|
211
|
-
version: "
|
|
211
|
+
version: "2.0.0",
|
|
212
212
|
description: "The plugins for Apps In Toss",
|
|
213
213
|
scripts: {
|
|
214
214
|
test: "vitest --run",
|
|
@@ -245,15 +245,16 @@ var require_package = __commonJS({
|
|
|
245
245
|
vitest: "^3.2.4"
|
|
246
246
|
},
|
|
247
247
|
dependencies: {
|
|
248
|
-
"@apps-in-toss/ait-format": "
|
|
249
|
-
"@
|
|
250
|
-
"@granite-js/plugin-
|
|
251
|
-
"@granite-js/plugin-
|
|
252
|
-
"@granite-js/
|
|
248
|
+
"@apps-in-toss/ait-format": "1.0.0",
|
|
249
|
+
"@apps-in-toss/plugin-compat": "workspace:*",
|
|
250
|
+
"@granite-js/plugin-core": "catalog:granite-js",
|
|
251
|
+
"@granite-js/plugin-micro-frontend": "catalog:granite-js",
|
|
252
|
+
"@granite-js/plugin-sentry": "catalog:granite-js",
|
|
253
|
+
"@granite-js/utils": "catalog:granite-js",
|
|
253
254
|
archiver: "^7.0.1",
|
|
254
255
|
connect: "^3.7.0",
|
|
255
|
-
esbuild: "
|
|
256
|
-
execa: "
|
|
256
|
+
esbuild: "catalog:tooling",
|
|
257
|
+
execa: "catalog:tooling",
|
|
257
258
|
picocolors: "^1.1.1",
|
|
258
259
|
uuidv7: "^1.0.2"
|
|
259
260
|
}
|
|
@@ -268,6 +269,7 @@ __export(index_exports, {
|
|
|
268
269
|
appsInToss: () => appsInToss,
|
|
269
270
|
appsInTossAppJson: () => appsInTossAppJson,
|
|
270
271
|
appsInTossCreateArtifact: () => appsInTossCreateArtifact,
|
|
272
|
+
appsInTossCrypto: () => appsInTossCrypto,
|
|
271
273
|
appsInTossDevServer: () => appsInTossDevServer,
|
|
272
274
|
appsInTossEsbuildConfig: () => appsInTossEsbuildConfig,
|
|
273
275
|
appsInTossMetroConfig: () => appsInTossMetroConfig,
|
|
@@ -275,7 +277,10 @@ __export(index_exports, {
|
|
|
275
277
|
bedrockCompat: () => bedrockCompat,
|
|
276
278
|
collectDependencyVersions: () => collectDependencyVersions,
|
|
277
279
|
createArtifact: () => createArtifact,
|
|
280
|
+
cryptoPolyfillContent: () => cryptoPolyfillContent,
|
|
281
|
+
getAppsInTossBuildPlugins: () => getAppsInTossBuildPlugins,
|
|
278
282
|
getRuntimeSetupScript: () => getRuntimeSetupScript,
|
|
283
|
+
getSdkVersion: () => getSdkVersion,
|
|
279
284
|
nativeModuleProxyContent: () => nativeModuleProxyContent,
|
|
280
285
|
reactNativeModuleProxyContent: () => reactNativeModuleProxyContent,
|
|
281
286
|
requireMicroFrontendRuntime: () => requireMicroFrontendRuntime,
|
|
@@ -290,34 +295,38 @@ init_cjs_shims();
|
|
|
290
295
|
|
|
291
296
|
// src/appsInToss.ts
|
|
292
297
|
init_cjs_shims();
|
|
293
|
-
var
|
|
298
|
+
var import_path6 = __toESM(require("path"), 1);
|
|
299
|
+
var import_plugin_compat = require("@apps-in-toss/plugin-compat");
|
|
294
300
|
var import_plugin_micro_frontend = require("@granite-js/plugin-micro-frontend");
|
|
295
|
-
var
|
|
301
|
+
var import_utils6 = require("@granite-js/utils");
|
|
296
302
|
|
|
297
303
|
// src/constants.ts
|
|
298
304
|
init_cjs_shims();
|
|
299
|
-
var REACT_NATIVE_VERSION = "0.
|
|
305
|
+
var REACT_NATIVE_VERSION = "0.84.0";
|
|
300
306
|
var APP_MANIFEST_NAME = "app.json";
|
|
301
307
|
var MICRO_FRONTEND_HOST_NAME = "apps-in-toss-host";
|
|
302
308
|
var MICRO_FRONTEND_REMOTE_NAME = "apps-in-toss-service";
|
|
303
309
|
var MICRO_FRONTEND_REMOTE_EXPOSE_PATH = "./ServiceEntry";
|
|
304
310
|
var HOST_CONTEXT_IDENTIFIER = "__appsInTossHost";
|
|
305
311
|
var SERVICE_CONTEXT_IDENTIFIER = "__appsInToss";
|
|
306
|
-
var
|
|
312
|
+
var getSharedPackages = ({ reactNativeVersion }) => [
|
|
307
313
|
"@react-native-community/blur",
|
|
308
314
|
"@react-navigation/native",
|
|
309
315
|
"@react-navigation/native-stack",
|
|
316
|
+
"@sentry/react-native",
|
|
310
317
|
"@shopify/flash-list",
|
|
311
|
-
"lottie-react-native",
|
|
312
318
|
"react-native-safe-area-context",
|
|
313
319
|
"react-native-screens",
|
|
314
|
-
"react-native-fast-image",
|
|
315
320
|
"react-native-svg",
|
|
316
321
|
"react-native-gesture-handler",
|
|
317
322
|
"react-native",
|
|
318
323
|
"react",
|
|
319
|
-
"react-native-
|
|
320
|
-
"
|
|
324
|
+
"react-native-webview",
|
|
325
|
+
"@granite-js/image",
|
|
326
|
+
"@granite-js/lottie",
|
|
327
|
+
"@granite-js/video",
|
|
328
|
+
...reactNativeVersion === "0.84" ? ["brick-module", "@react-navigation/elements"] : [],
|
|
329
|
+
...reactNativeVersion === "0.72" ? ["react-native-fast-image", "lottie-react-native", "react-native-video"] : []
|
|
321
330
|
];
|
|
322
331
|
|
|
323
332
|
// src/log.ts
|
|
@@ -345,7 +354,8 @@ async function appsInTossAppJson(options) {
|
|
|
345
354
|
const appJsonPath = import_path.default.join(packageRoot, ".granite", APP_MANIFEST_NAME);
|
|
346
355
|
const appJsonObject = {
|
|
347
356
|
appName,
|
|
348
|
-
permissions: options.permissions
|
|
357
|
+
permissions: options.permissions,
|
|
358
|
+
...options.appType != null ? { appType: options.appType } : {}
|
|
349
359
|
};
|
|
350
360
|
await import_node_fs.default.promises.mkdir(import_path.default.dirname(appJsonPath), { recursive: true });
|
|
351
361
|
try {
|
|
@@ -353,7 +363,8 @@ async function appsInTossAppJson(options) {
|
|
|
353
363
|
const existingAppJsonObject = JSON.parse(existingAppJson);
|
|
354
364
|
Object.assign(appJsonObject, existingAppJsonObject, {
|
|
355
365
|
appName,
|
|
356
|
-
permissions: appJsonObject.permissions
|
|
366
|
+
permissions: appJsonObject.permissions,
|
|
367
|
+
...options.appType != null ? { appType: options.appType } : {}
|
|
357
368
|
});
|
|
358
369
|
} catch {
|
|
359
370
|
}
|
|
@@ -443,8 +454,8 @@ async function resolvePackageVersions(rootDir, packageNames) {
|
|
|
443
454
|
function createVirtualEntry(packageNames) {
|
|
444
455
|
return packageNames.map((packageName) => `import '${packageName}';`).join("\n");
|
|
445
456
|
}
|
|
446
|
-
function extractPackagePath(
|
|
447
|
-
const normalizedPath = normalizePath(
|
|
457
|
+
function extractPackagePath(path9, packageName) {
|
|
458
|
+
const normalizedPath = normalizePath(path9);
|
|
448
459
|
if (normalizedPath.endsWith("/package.json")) {
|
|
449
460
|
return normalizedPath.replace(/\/package\.json$/, "");
|
|
450
461
|
}
|
|
@@ -454,8 +465,8 @@ function extractPackagePath(path8, packageName) {
|
|
|
454
465
|
}
|
|
455
466
|
throw new Error(`Failed to extract path: ${packageName}`);
|
|
456
467
|
}
|
|
457
|
-
function normalizePath(
|
|
458
|
-
return
|
|
468
|
+
function normalizePath(path9) {
|
|
469
|
+
return path9.replace(/\\/g, "/");
|
|
459
470
|
}
|
|
460
471
|
async function getPackageVersion(packagePath) {
|
|
461
472
|
const packageJson = JSON.parse(await fs2.readFile(path2.join(packagePath, "package.json"), "utf-8"));
|
|
@@ -487,9 +498,10 @@ async function createArtifact(options) {
|
|
|
487
498
|
const unityMetaData = getUnityMetaDataEnv();
|
|
488
499
|
const appJsonContent = await fs3.readFile(appJsonPath, "utf-8");
|
|
489
500
|
const appJson = JSON.parse(appJsonContent);
|
|
490
|
-
const runtime = reactNativeVersion.replace(/\./g, "_");
|
|
491
501
|
const namedBundleFiles = bundleFiles.map((bundle) => {
|
|
492
|
-
const
|
|
502
|
+
const originalName = import_path2.default.basename(bundle.path);
|
|
503
|
+
const extension = import_path2.default.extname(originalName);
|
|
504
|
+
const runtime = (bundle.runtimeVersion ?? reactNativeVersion).replace(new RegExp(/\./g), "_");
|
|
493
505
|
return {
|
|
494
506
|
path: bundle.path,
|
|
495
507
|
name: `bundle.${bundle.platform}.${runtime}${extension === ".map" ? ".js.map" : extension}`
|
|
@@ -507,7 +519,7 @@ async function createArtifact(options) {
|
|
|
507
519
|
sdkVersion,
|
|
508
520
|
bundleFiles: namedBundleFiles.map(({ name }) => name),
|
|
509
521
|
packageJson: options.packageJson,
|
|
510
|
-
extra: { unityMetaData }
|
|
522
|
+
extra: { unityMetaData, ...options.extra }
|
|
511
523
|
});
|
|
512
524
|
for (const permission of appJson.permissions ?? []) {
|
|
513
525
|
writer.addPermission(permission.name, permission.access);
|
|
@@ -526,7 +538,7 @@ async function createArtifact(options) {
|
|
|
526
538
|
}
|
|
527
539
|
|
|
528
540
|
// src/plugins/artifact.ts
|
|
529
|
-
function appsInTossCreateArtifact(deploymentId, buildOption) {
|
|
541
|
+
function appsInTossCreateArtifact(deploymentId, buildOption, reactNativeVersion = REACT_NATIVE_VERSION) {
|
|
530
542
|
const packageRoot = (0, import_utils2.getPackageRoot)();
|
|
531
543
|
return {
|
|
532
544
|
name: "apps-in-toss:create-artifact",
|
|
@@ -540,7 +552,7 @@ function appsInTossCreateArtifact(deploymentId, buildOption) {
|
|
|
540
552
|
log("\uC571 \uBE4C\uB4DC \uC911...");
|
|
541
553
|
const { dependencies, devDependencies } = await collectDependencyVersions(cwd);
|
|
542
554
|
const artifactOutfile = await createArtifact({
|
|
543
|
-
reactNativeVersion
|
|
555
|
+
reactNativeVersion,
|
|
544
556
|
deploymentId,
|
|
545
557
|
sdkVersion: buildOption.sdkVersion,
|
|
546
558
|
isGame: buildOption.isGame,
|
|
@@ -725,6 +737,52 @@ function bedrockCompat({ isHost }) {
|
|
|
725
737
|
};
|
|
726
738
|
}
|
|
727
739
|
|
|
740
|
+
// src/plugins/crypto.ts
|
|
741
|
+
init_cjs_shims();
|
|
742
|
+
var import_fs2 = __toESM(require("fs"), 1);
|
|
743
|
+
var import_path5 = __toESM(require("path"), 1);
|
|
744
|
+
var import_utils4 = require("@granite-js/utils");
|
|
745
|
+
var cryptoPolyfillContent = `
|
|
746
|
+
(function (global) {
|
|
747
|
+
if (!global.__decrypt &&
|
|
748
|
+
global.nativeModuleProxy &&
|
|
749
|
+
global.nativeModuleProxy.TossCoreCryptoModule &&
|
|
750
|
+
global.nativeModuleProxy.TossCoreCryptoModule.decrypt) {
|
|
751
|
+
global.__decrypt = global.nativeModuleProxy.TossCoreCryptoModule.decrypt;
|
|
752
|
+
}
|
|
753
|
+
})(
|
|
754
|
+
typeof globalThis !== 'undefined'
|
|
755
|
+
? globalThis
|
|
756
|
+
: typeof global !== 'undefined'
|
|
757
|
+
? global
|
|
758
|
+
: typeof window !== 'undefined'
|
|
759
|
+
? window
|
|
760
|
+
: this
|
|
761
|
+
);
|
|
762
|
+
`;
|
|
763
|
+
function appsInTossCrypto({ isHost }) {
|
|
764
|
+
const metroPolyfillPath = import_path5.default.join((0, import_utils4.getLocalTempDirectoryPath)((0, import_utils4.getPackageRoot)()), "metro-crypto-polyfill.js");
|
|
765
|
+
import_fs2.default.writeFileSync(metroPolyfillPath, cryptoPolyfillContent);
|
|
766
|
+
return {
|
|
767
|
+
name: "apps-in-toss-crypto-plugin",
|
|
768
|
+
config: {
|
|
769
|
+
...isHost ? {
|
|
770
|
+
esbuild: {
|
|
771
|
+
banner: {
|
|
772
|
+
js: cryptoPolyfillContent
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
} : {},
|
|
776
|
+
metro: {
|
|
777
|
+
serializer: {
|
|
778
|
+
// Metro 단일 번들 환경에서는 Host/Remote 구분 없이 항상 polyfill 필요
|
|
779
|
+
getPolyfills: () => [metroPolyfillPath]
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
|
|
728
786
|
// src/plugins/devServer.ts
|
|
729
787
|
init_cjs_shims();
|
|
730
788
|
|
|
@@ -847,7 +905,7 @@ var __typia_transform__isFormatUuid = __toESM(require_isFormatUuid(), 1);
|
|
|
847
905
|
var __typia_transform__validateReport = __toESM(require_validateReport(), 1);
|
|
848
906
|
var __typia_transform__createStandardSchema = __toESM(require_createStandardSchema(), 1);
|
|
849
907
|
var validateAppManifest = (() => {
|
|
850
|
-
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));
|
|
908
|
+
const _io0 = (input) => "string" === typeof input.appName && (void 0 === input.appType || "general" === input.appType || "game" === input.appType) && (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));
|
|
851
909
|
const _io1 = (input) => "clipboard" === input.name && ("read" === input.access || "write" === input.access);
|
|
852
910
|
const _io2 = (input) => "geolocation" === input.name && "access" === input.access;
|
|
853
911
|
const _io3 = (input) => "contacts" === input.name && ("read" === input.access || "write" === input.access);
|
|
@@ -872,6 +930,10 @@ var validateAppManifest = (() => {
|
|
|
872
930
|
path: _path + ".appName",
|
|
873
931
|
expected: "string",
|
|
874
932
|
value: input.appName
|
|
933
|
+
}), void 0 === input.appType || "general" === input.appType || "game" === input.appType || _report(_exceptionable, {
|
|
934
|
+
path: _path + ".appType",
|
|
935
|
+
expected: '("game" | "general" | undefined)',
|
|
936
|
+
value: input.appType
|
|
875
937
|
}), (Array.isArray(input.permissions) || _report(_exceptionable, {
|
|
876
938
|
path: _path + ".permissions",
|
|
877
939
|
expected: "Array<Permission>",
|
|
@@ -1014,7 +1076,7 @@ var validateAppManifest = (() => {
|
|
|
1014
1076
|
});
|
|
1015
1077
|
})();
|
|
1016
1078
|
var validateAppInTossPluginOptions = (() => {
|
|
1017
|
-
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));
|
|
1079
|
+
const _io0 = (input) => (void 0 === input.target || "0.72.6" === input.target || "0.84.0" === input.target) && (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));
|
|
1018
1080
|
const _io1 = (input) => "string" === typeof input.displayName && "string" === typeof input.primaryColor && "string" === typeof input.icon;
|
|
1019
1081
|
const _io2 = (input) => "clipboard" === input.name && ("read" === input.access || "write" === input.access);
|
|
1020
1082
|
const _io3 = (input) => "geolocation" === input.name && "access" === input.access;
|
|
@@ -1048,7 +1110,11 @@ var validateAppInTossPluginOptions = (() => {
|
|
|
1048
1110
|
else
|
|
1049
1111
|
return false;
|
|
1050
1112
|
})();
|
|
1051
|
-
const _vo0 = (input, _path, _exceptionable = true) => [void 0 === input.
|
|
1113
|
+
const _vo0 = (input, _path, _exceptionable = true) => [void 0 === input.target || "0.72.6" === input.target || "0.84.0" === input.target || _report(_exceptionable, {
|
|
1114
|
+
path: _path + ".target",
|
|
1115
|
+
expected: '("0.72.6" | "0.84.0" | undefined)',
|
|
1116
|
+
value: input.target
|
|
1117
|
+
}), void 0 === input.appType || "general" === input.appType || "game" === input.appType || _report(_exceptionable, {
|
|
1052
1118
|
path: _path + ".appType",
|
|
1053
1119
|
expected: '("game" | "general" | undefined)',
|
|
1054
1120
|
value: input.appType
|
|
@@ -1279,21 +1345,23 @@ var validateAppInTossPluginOptions = (() => {
|
|
|
1279
1345
|
init_cjs_shims();
|
|
1280
1346
|
var import_uuidv7 = require("uuidv7");
|
|
1281
1347
|
function generateDeploymentId() {
|
|
1348
|
+
if (process.env.AIT_DEPLOYMENT_ID != null && process.env.AIT_DEPLOYMENT_ID.length > 0) {
|
|
1349
|
+
return process.env.AIT_DEPLOYMENT_ID;
|
|
1350
|
+
}
|
|
1282
1351
|
return (0, import_uuidv7.uuidv7)();
|
|
1283
1352
|
}
|
|
1284
1353
|
|
|
1285
|
-
// src/utils/
|
|
1354
|
+
// src/utils/getReactNativeTarget.ts
|
|
1286
1355
|
init_cjs_shims();
|
|
1287
|
-
function
|
|
1288
|
-
|
|
1289
|
-
return packageJson.version;
|
|
1356
|
+
function getReactNativeTarget(target) {
|
|
1357
|
+
return target ?? REACT_NATIVE_VERSION;
|
|
1290
1358
|
}
|
|
1291
1359
|
|
|
1292
1360
|
// src/utils/setupRuntimeSetupScript.ts
|
|
1293
1361
|
init_cjs_shims();
|
|
1294
1362
|
var import_node_fs2 = __toESM(require("fs"), 1);
|
|
1295
1363
|
var import_node_path = __toESM(require("path"), 1);
|
|
1296
|
-
var
|
|
1364
|
+
var import_utils5 = require("@granite-js/utils");
|
|
1297
1365
|
var import_esbuild = require("esbuild");
|
|
1298
1366
|
function setupRuntimeSetupScript(config) {
|
|
1299
1367
|
const script = getRuntimeSetupScript(
|
|
@@ -1338,7 +1406,7 @@ function getRuntimeSetupScript(metadata, identifier) {
|
|
|
1338
1406
|
}).code;
|
|
1339
1407
|
}
|
|
1340
1408
|
function writeRuntimeSetupScript(script) {
|
|
1341
|
-
const packageRoot = (0,
|
|
1409
|
+
const packageRoot = (0, import_utils5.getPackageRoot)();
|
|
1342
1410
|
const granitePath = import_node_path.default.join(packageRoot, ".granite");
|
|
1343
1411
|
try {
|
|
1344
1412
|
import_node_fs2.default.accessSync(granitePath);
|
|
@@ -1410,6 +1478,10 @@ function getMicroFrontendCompatScript() {
|
|
|
1410
1478
|
}
|
|
1411
1479
|
|
|
1412
1480
|
// src/appsInToss.ts
|
|
1481
|
+
function getAppsInTossBuildPlugins(options) {
|
|
1482
|
+
const plugins = [appsInTossDevServer(options), appsInTossPostNotice()];
|
|
1483
|
+
return plugins;
|
|
1484
|
+
}
|
|
1413
1485
|
function withAppsInTossCommon(plugins, options) {
|
|
1414
1486
|
const { contents, path: envScriptPath } = setupRuntimeSetupScript({
|
|
1415
1487
|
appType: options.appType,
|
|
@@ -1417,6 +1489,8 @@ function withAppsInTossCommon(plugins, options) {
|
|
|
1417
1489
|
deploymentId: options.deploymentId,
|
|
1418
1490
|
navigationBar: options.navigationBar
|
|
1419
1491
|
});
|
|
1492
|
+
const target = getReactNativeTarget(options.target);
|
|
1493
|
+
const reactNativeVersion = target.startsWith("0.72") ? "0.72" : "0.84";
|
|
1420
1494
|
return [
|
|
1421
1495
|
requireMicroFrontendRuntime(),
|
|
1422
1496
|
(0, import_plugin_micro_frontend.microFrontend)({
|
|
@@ -1424,15 +1498,20 @@ function withAppsInTossCommon(plugins, options) {
|
|
|
1424
1498
|
exposes: {
|
|
1425
1499
|
[MICRO_FRONTEND_REMOTE_EXPOSE_PATH]: options.exposePath
|
|
1426
1500
|
},
|
|
1427
|
-
shared:
|
|
1501
|
+
shared: getSharedPackages({
|
|
1502
|
+
reactNativeVersion
|
|
1503
|
+
}),
|
|
1428
1504
|
reactNativeBasePath: options.reactNativeBasePath
|
|
1429
1505
|
}),
|
|
1430
1506
|
appsInTossAppJson(options),
|
|
1507
|
+
(0, import_plugin_compat.reactNativeCompatibilityPlugin)({ target, rootDir: options.root }),
|
|
1508
|
+
(0, import_plugin_compat.reactNativeReverseCompatibilityPlugin)({ target, rootDir: options.root, isHost: false }),
|
|
1431
1509
|
appsInTossEsbuildConfig(contents),
|
|
1432
1510
|
appsInTossMetroConfig(envScriptPath),
|
|
1433
1511
|
bedrockCompat({ isHost: false }),
|
|
1512
|
+
reactNativeVersion === "0.84" ? appsInTossCrypto({ isHost: false }) : null,
|
|
1434
1513
|
...plugins
|
|
1435
|
-
];
|
|
1514
|
+
].filter((plugin) => plugin !== null);
|
|
1436
1515
|
}
|
|
1437
1516
|
function appsInToss(options) {
|
|
1438
1517
|
const result = validateAppInTossPluginOptions(options);
|
|
@@ -1441,23 +1520,14 @@ function appsInToss(options) {
|
|
|
1441
1520
|
process.exit(1);
|
|
1442
1521
|
}
|
|
1443
1522
|
const deploymentId = generateDeploymentId();
|
|
1444
|
-
const root = (0,
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
[appsInTossDevServer(options), appsInTossCreateArtifact(deploymentId, buildOptions), appsInTossPostNotice()],
|
|
1453
|
-
{
|
|
1454
|
-
...options,
|
|
1455
|
-
root,
|
|
1456
|
-
deploymentId,
|
|
1457
|
-
exposePath: import_path5.default.join(root, "./src/_app.tsx"),
|
|
1458
|
-
navigationBar: result.data.navigationBar
|
|
1459
|
-
}
|
|
1460
|
-
);
|
|
1523
|
+
const root = (0, import_utils6.getPackageRoot)();
|
|
1524
|
+
return withAppsInTossCommon(getAppsInTossBuildPlugins(options), {
|
|
1525
|
+
...options,
|
|
1526
|
+
root,
|
|
1527
|
+
deploymentId,
|
|
1528
|
+
exposePath: import_path6.default.join(root, "./src/_app.tsx"),
|
|
1529
|
+
navigationBar: result.data.navigationBar
|
|
1530
|
+
});
|
|
1461
1531
|
}
|
|
1462
1532
|
|
|
1463
1533
|
// src/analytics.ts
|
|
@@ -1520,12 +1590,20 @@ function analytics() {
|
|
|
1520
1590
|
}
|
|
1521
1591
|
};
|
|
1522
1592
|
}
|
|
1593
|
+
|
|
1594
|
+
// src/utils/getSdkVersion.ts
|
|
1595
|
+
init_cjs_shims();
|
|
1596
|
+
function getSdkVersion() {
|
|
1597
|
+
const packageJson = require_package();
|
|
1598
|
+
return packageJson.version;
|
|
1599
|
+
}
|
|
1523
1600
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1524
1601
|
0 && (module.exports = {
|
|
1525
1602
|
analytics,
|
|
1526
1603
|
appsInToss,
|
|
1527
1604
|
appsInTossAppJson,
|
|
1528
1605
|
appsInTossCreateArtifact,
|
|
1606
|
+
appsInTossCrypto,
|
|
1529
1607
|
appsInTossDevServer,
|
|
1530
1608
|
appsInTossEsbuildConfig,
|
|
1531
1609
|
appsInTossMetroConfig,
|
|
@@ -1533,7 +1611,10 @@ function analytics() {
|
|
|
1533
1611
|
bedrockCompat,
|
|
1534
1612
|
collectDependencyVersions,
|
|
1535
1613
|
createArtifact,
|
|
1614
|
+
cryptoPolyfillContent,
|
|
1615
|
+
getAppsInTossBuildPlugins,
|
|
1536
1616
|
getRuntimeSetupScript,
|
|
1617
|
+
getSdkVersion,
|
|
1537
1618
|
nativeModuleProxyContent,
|
|
1538
1619
|
reactNativeModuleProxyContent,
|
|
1539
1620
|
requireMicroFrontendRuntime,
|
package/dist/index.d.cts
CHANGED
|
@@ -27,6 +27,7 @@ type CameraPermission = {
|
|
|
27
27
|
type Permission = ClipboardPermission | GeolocationPermission | ContactsPermission | PhotosPermission | CameraPermission;
|
|
28
28
|
type AppManifest = {
|
|
29
29
|
appName: string;
|
|
30
|
+
appType?: 'general' | 'game';
|
|
30
31
|
permissions: Permission[];
|
|
31
32
|
_metadata: {
|
|
32
33
|
bundleFiles: string[];
|
|
@@ -49,6 +50,7 @@ interface InitialAccessoryButton {
|
|
|
49
50
|
}
|
|
50
51
|
declare const validateAppManifest: ((input: unknown) => typia.IValidation<AppManifest>) & _standard_schema_spec.StandardSchemaV1<unknown, AppManifest>;
|
|
51
52
|
interface AppsInTossPluginOptions {
|
|
53
|
+
target?: '0.72.6' | '0.84.0';
|
|
52
54
|
appType?: 'general' | 'game';
|
|
53
55
|
brand: {
|
|
54
56
|
displayName: string;
|
|
@@ -64,6 +66,7 @@ interface AppsInTossPluginOptions {
|
|
|
64
66
|
}
|
|
65
67
|
declare const validateAppInTossPluginOptions: ((input: unknown) => typia.IValidation<AppsInTossPluginOptions>) & _standard_schema_spec.StandardSchemaV1<unknown, AppsInTossPluginOptions>;
|
|
66
68
|
|
|
69
|
+
declare function getAppsInTossBuildPlugins(options: Pick<AppsInTossPluginOptions, 'permissions'>): GranitePluginCore[];
|
|
67
70
|
declare function withAppsInTossCommon(plugins: (GranitePluginCore | Promise<GranitePluginCore>)[], options: AppsInTossPluginOptions & {
|
|
68
71
|
root: string;
|
|
69
72
|
deploymentId: string;
|
|
@@ -92,6 +95,7 @@ interface CreateArtifactOptions {
|
|
|
92
95
|
bundleFiles: {
|
|
93
96
|
path: string;
|
|
94
97
|
platform: 'ios' | 'android';
|
|
98
|
+
runtimeVersion?: string;
|
|
95
99
|
}[];
|
|
96
100
|
reactNativeVersion: string;
|
|
97
101
|
sdkVersion: string;
|
|
@@ -105,6 +109,7 @@ interface CreateArtifactOptions {
|
|
|
105
109
|
path: string;
|
|
106
110
|
name: string;
|
|
107
111
|
}[];
|
|
112
|
+
extra?: Record<string, unknown>;
|
|
108
113
|
}
|
|
109
114
|
declare function createArtifact(options: CreateArtifactOptions): Promise<string>;
|
|
110
115
|
|
|
@@ -128,13 +133,15 @@ declare function collectDependencyVersions(rootDir: string): Promise<{
|
|
|
128
133
|
devDependencies: Record<string, string>;
|
|
129
134
|
}>;
|
|
130
135
|
|
|
131
|
-
declare function
|
|
136
|
+
declare function getSdkVersion(): string;
|
|
137
|
+
|
|
138
|
+
declare function appsInTossAppJson(options: Pick<AppsInTossPluginOptions, 'permissions' | 'appType'>): Promise<GranitePluginCore>;
|
|
132
139
|
|
|
133
140
|
declare function appsInTossCreateArtifact(deploymentId: string, buildOption: {
|
|
134
141
|
isGame: boolean;
|
|
135
142
|
sdkVersion: string;
|
|
136
143
|
isWeb: boolean;
|
|
137
|
-
}): GranitePluginCore;
|
|
144
|
+
}, reactNativeVersion?: string): GranitePluginCore;
|
|
138
145
|
|
|
139
146
|
declare function appsInTossEsbuildConfig(envScript: string): GranitePluginCore;
|
|
140
147
|
declare function appsInTossMetroConfig(envScriptPath: string): GranitePluginCore;
|
|
@@ -155,10 +162,28 @@ declare function bedrockCompat({ isHost }: {
|
|
|
155
162
|
isHost: boolean;
|
|
156
163
|
}): GranitePluginCore;
|
|
157
164
|
|
|
165
|
+
/**
|
|
166
|
+
* TossCoreCryptoModule의 decrypt 메서드를 global.__decrypt로 노출하는 polyfill 코드
|
|
167
|
+
*
|
|
168
|
+
* - global.__decrypt가 이미 존재하는 경우 덮어쓰지 않음
|
|
169
|
+
* - TossCoreCryptoModule.decrypt가 존재할 때만 할당하여 런타임 에러 방지
|
|
170
|
+
*/
|
|
171
|
+
declare const cryptoPolyfillContent = "\n(function (global) {\n if (!global.__decrypt &&\n global.nativeModuleProxy &&\n global.nativeModuleProxy.TossCoreCryptoModule &&\n global.nativeModuleProxy.TossCoreCryptoModule.decrypt) {\n global.__decrypt = global.nativeModuleProxy.TossCoreCryptoModule.decrypt;\n }\n})(\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof global !== 'undefined'\n ? global\n : typeof window !== 'undefined'\n ? window\n : this\n);\n";
|
|
172
|
+
/**
|
|
173
|
+
* TossCoreCryptoModule을 전역에서 접근 가능하도록 설정하는 Granite 플러그인
|
|
174
|
+
*
|
|
175
|
+
* @param isHost - Host 번들 여부
|
|
176
|
+
* - true: Host 번들 (esbuild banner에 polyfill 포함)
|
|
177
|
+
* - false: Remote 번들 (esbuild banner에서 제외, Host에서 이미 로드됨)
|
|
178
|
+
*/
|
|
179
|
+
declare function appsInTossCrypto({ isHost }: {
|
|
180
|
+
isHost: boolean;
|
|
181
|
+
}): GranitePluginCore;
|
|
182
|
+
|
|
158
183
|
declare function appsInTossDevServer(options: Pick<AppsInTossPluginOptions, 'permissions'>): GranitePluginCore;
|
|
159
184
|
|
|
160
185
|
declare function appsInTossPostNotice(): GranitePluginCore;
|
|
161
186
|
|
|
162
187
|
declare function requireMicroFrontendRuntime(): GranitePluginCore;
|
|
163
188
|
|
|
164
|
-
export { type AppManifest, type AppsInTossPluginOptions, type BuildResult, type CreateArtifactOptions, type InitialAccessoryButton, type Permission, analytics, appsInToss, appsInTossAppJson, appsInTossCreateArtifact, appsInTossDevServer, appsInTossEsbuildConfig, appsInTossMetroConfig, appsInTossPostNotice, bedrockCompat, collectDependencyVersions, createArtifact, getRuntimeSetupScript, nativeModuleProxyContent, reactNativeModuleProxyContent, requireMicroFrontendRuntime, setupHostRuntimeSetupScript, setupRuntimeSetupScript, validateAppInTossPluginOptions, validateAppManifest, withAppsInTossCommon };
|
|
189
|
+
export { type AppManifest, type AppsInTossPluginOptions, type BuildResult, type CreateArtifactOptions, type InitialAccessoryButton, type Permission, analytics, appsInToss, appsInTossAppJson, appsInTossCreateArtifact, appsInTossCrypto, appsInTossDevServer, appsInTossEsbuildConfig, appsInTossMetroConfig, appsInTossPostNotice, bedrockCompat, collectDependencyVersions, createArtifact, cryptoPolyfillContent, getAppsInTossBuildPlugins, getRuntimeSetupScript, getSdkVersion, nativeModuleProxyContent, reactNativeModuleProxyContent, requireMicroFrontendRuntime, setupHostRuntimeSetupScript, setupRuntimeSetupScript, validateAppInTossPluginOptions, validateAppManifest, withAppsInTossCommon };
|