@apps-in-toss/web-framework 0.0.0-dev.1742352748804 → 0.0.0-dev.1742869301025

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/cli/index.js CHANGED
@@ -86516,14 +86516,13 @@ init_esm_shims2();
86516
86516
  var __typia_transform__isFormatUuid = __toESM2(require_isFormatUuid(), 1);
86517
86517
  var __typia_transform__validateReport = __toESM2(require_validateReport(), 1);
86518
86518
  var validateAppManifest = /* @__PURE__ */ (() => {
86519
- 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.oauth && null !== input.oauth && _io6(input.oauth)) && ("object" === typeof input._metadata && null !== input._metadata && _io7(input._metadata));
86519
+ 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));
86520
86520
  const _io1 = (input) => "clipboard" === input.name && ("read" === input.access || "write" === input.access);
86521
86521
  const _io2 = (input) => "geolocation" === input.name && "access" === input.access;
86522
86522
  const _io3 = (input) => "contacts" === input.name && ("read" === input.access || "write" === input.access);
86523
86523
  const _io4 = (input) => "photos" === input.name && ("read" === input.access || "write" === input.access);
86524
86524
  const _io5 = (input) => "camera" === input.name && "access" === input.access;
86525
- const _io6 = (input) => Array.isArray(input.scopes) && input.scopes.every((elem) => "user_name" === elem || "user_phone" === elem || "user_birthday" === elem || "user_ci" === elem || "user_gender" === elem || "user_nationality" === elem || "user_email" === elem);
86526
- const _io7 = (input) => Array.isArray(input.bundleFiles) && input.bundleFiles.every((elem) => "string" === typeof elem) && ("string" === typeof input.deploymentId && __typia_transform__isFormatUuid._isFormatUuid(input.deploymentId));
86525
+ const _io6 = (input) => Array.isArray(input.bundleFiles) && input.bundleFiles.every((elem) => "string" === typeof elem) && ("string" === typeof input.deploymentId && __typia_transform__isFormatUuid._isFormatUuid(input.deploymentId));
86527
86526
  const _iu0 = (input) => (() => {
86528
86527
  if ("camera" === input.name)
86529
86528
  return _io5(input);
@@ -86546,33 +86545,25 @@ var validateAppManifest = /* @__PURE__ */ (() => {
86546
86545
  path: _path + ".permissions",
86547
86546
  expected: "Array<Permission>",
86548
86547
  value: input.permissions
86549
- })) && input.permissions.map((elem, _index4) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
86550
- path: _path + ".permissions[" + _index4 + "]",
86548
+ })) && input.permissions.map((elem, _index3) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
86549
+ path: _path + ".permissions[" + _index3 + "]",
86551
86550
  expected: "(CameraPermission | ClipboardPermission | ContactsPermission | GeolocationPermission | PhotosPermission)",
86552
86551
  value: elem
86553
- })) && _vu0(elem, _path + ".permissions[" + _index4 + "]", _exceptionable) || _report(_exceptionable, {
86554
- path: _path + ".permissions[" + _index4 + "]",
86552
+ })) && _vu0(elem, _path + ".permissions[" + _index3 + "]", _exceptionable) || _report(_exceptionable, {
86553
+ path: _path + ".permissions[" + _index3 + "]",
86555
86554
  expected: "(CameraPermission | ClipboardPermission | ContactsPermission | GeolocationPermission | PhotosPermission)",
86556
86555
  value: elem
86557
86556
  })).every((flag) => flag) || _report(_exceptionable, {
86558
86557
  path: _path + ".permissions",
86559
86558
  expected: "Array<Permission>",
86560
86559
  value: input.permissions
86561
- }), ("object" === typeof input.oauth && null !== input.oauth || _report(_exceptionable, {
86562
- path: _path + ".oauth",
86563
- expected: "__type",
86564
- value: input.oauth
86565
- })) && _vo6(input.oauth, _path + ".oauth", _exceptionable) || _report(_exceptionable, {
86566
- path: _path + ".oauth",
86567
- expected: "__type",
86568
- value: input.oauth
86569
86560
  }), ("object" === typeof input._metadata && null !== input._metadata || _report(_exceptionable, {
86570
86561
  path: _path + "._metadata",
86571
- expected: "__type.o1",
86562
+ expected: "__type",
86572
86563
  value: input._metadata
86573
- })) && _vo7(input._metadata, _path + "._metadata", _exceptionable) || _report(_exceptionable, {
86564
+ })) && _vo6(input._metadata, _path + "._metadata", _exceptionable) || _report(_exceptionable, {
86574
86565
  path: _path + "._metadata",
86575
- expected: "__type.o1",
86566
+ expected: "__type",
86576
86567
  value: input._metadata
86577
86568
  })].every((flag) => flag);
86578
86569
  const _vo1 = (input, _path, _exceptionable = true) => ["clipboard" === input.name || _report(_exceptionable, {
@@ -86620,25 +86611,12 @@ var validateAppManifest = /* @__PURE__ */ (() => {
86620
86611
  expected: '"access"',
86621
86612
  value: input.access
86622
86613
  })].every((flag) => flag);
86623
- const _vo6 = (input, _path, _exceptionable = true) => [(Array.isArray(input.scopes) || _report(_exceptionable, {
86624
- path: _path + ".scopes",
86625
- expected: "Array<OAuthScope>",
86626
- value: input.scopes
86627
- })) && input.scopes.map((elem, _index5) => "user_name" === elem || "user_phone" === elem || "user_birthday" === elem || "user_ci" === elem || "user_gender" === elem || "user_nationality" === elem || "user_email" === elem || _report(_exceptionable, {
86628
- path: _path + ".scopes[" + _index5 + "]",
86629
- expected: '("user_birthday" | "user_ci" | "user_email" | "user_gender" | "user_name" | "user_nationality" | "user_phone")',
86630
- value: elem
86631
- })).every((flag) => flag) || _report(_exceptionable, {
86632
- path: _path + ".scopes",
86633
- expected: "Array<OAuthScope>",
86634
- value: input.scopes
86635
- })].every((flag) => flag);
86636
- const _vo7 = (input, _path, _exceptionable = true) => [(Array.isArray(input.bundleFiles) || _report(_exceptionable, {
86614
+ const _vo6 = (input, _path, _exceptionable = true) => [(Array.isArray(input.bundleFiles) || _report(_exceptionable, {
86637
86615
  path: _path + ".bundleFiles",
86638
86616
  expected: "Array<string>",
86639
86617
  value: input.bundleFiles
86640
- })) && input.bundleFiles.map((elem, _index6) => "string" === typeof elem || _report(_exceptionable, {
86641
- path: _path + ".bundleFiles[" + _index6 + "]",
86618
+ })) && input.bundleFiles.map((elem, _index4) => "string" === typeof elem || _report(_exceptionable, {
86619
+ path: _path + ".bundleFiles[" + _index4 + "]",
86642
86620
  expected: "string",
86643
86621
  value: elem
86644
86622
  })).every((flag) => flag) || _report(_exceptionable, {
@@ -86734,15 +86712,13 @@ async function createArtifact(options, deps) {
86734
86712
  init_esm_shims2();
86735
86713
  init_esm_shims2();
86736
86714
  init_esm_shims2();
86737
- init_esm_shims2();
86738
86715
  async function appsInTossAppJson(options) {
86739
86716
  const packageRoot = getPackageRoot2();
86740
86717
  const handleAppJson = async (appName) => {
86741
86718
  const appJsonPath = path12.join(packageRoot, ".bedrock", APP_MANIFEST_NAME);
86742
86719
  const appJsonObject = {
86743
86720
  appName,
86744
- permissions: options.permissions,
86745
- oauth: options.oauth
86721
+ permissions: options.permissions
86746
86722
  };
86747
86723
  await fs5.promises.mkdir(path12.dirname(appJsonPath), { recursive: true });
86748
86724
  try {
@@ -86750,8 +86726,7 @@ async function appsInTossAppJson(options) {
86750
86726
  const existingAppJsonObject = JSON.parse(existingAppJson);
86751
86727
  Object.assign(appJsonObject, existingAppJsonObject, {
86752
86728
  appName,
86753
- permissions: appJsonObject.permissions,
86754
- oauth: appJsonObject.oauth
86729
+ permissions: appJsonObject.permissions
86755
86730
  });
86756
86731
  } catch (error) {
86757
86732
  }
@@ -93980,9 +93955,8 @@ async function resolvePlugins(plugins) {
93980
93955
 
93981
93956
  // src/runPrebuildToBuild.ts
93982
93957
  async function babelBuild({
93983
- appName,
93984
- outdir,
93985
93958
  platform: platform3,
93959
+ config,
93986
93960
  buildNumber,
93987
93961
  deploymentId
93988
93962
  }) {
@@ -93995,11 +93969,12 @@ async function babelBuild({
93995
93969
  babelJsonReplacementPlugin,
93996
93970
  {
93997
93971
  json: {
93998
- appName,
93972
+ appName: config.appName,
93999
93973
  webPort: "NOOP",
94000
93974
  webHost: "NOOP",
94001
93975
  buildNumber,
94002
- deploymentId
93976
+ deploymentId,
93977
+ ...config.webViewProps
94003
93978
  },
94004
93979
  identifierName: "Ait"
94005
93980
  }
@@ -94009,8 +93984,8 @@ async function babelBuild({
94009
93984
  if (!result?.code) {
94010
93985
  throw new Error(`Failed to build ${platform3}`);
94011
93986
  }
94012
- await fs8.promises.mkdir(path20.join(packageRoot, outdir), { recursive: true });
94013
- await fs8.promises.writeFile(path20.join(packageRoot, outdir, `${appName}.${platform3}.js`), result.code);
93987
+ await fs8.promises.mkdir(path20.join(packageRoot, config.outdir), { recursive: true });
93988
+ await fs8.promises.writeFile(path20.join(packageRoot, config.outdir, `${config.appName}.${platform3}.js`), result.code);
94014
93989
  }
94015
93990
  function getBuildNumber() {
94016
93991
  const date = /* @__PURE__ */ new Date();
@@ -94025,11 +94000,9 @@ function getBuildNumber() {
94025
94000
  async function runPrebuildToBuild(cwd, config) {
94026
94001
  const buildNumber = getBuildNumber();
94027
94002
  const deploymentId = uuidv7();
94028
- const { outdir = "dist" } = config;
94029
94003
  const resolvedPlugins = await resolvePlugins([
94030
94004
  appsInTossWeb(deploymentId, {
94031
94005
  commands: config.web.commands,
94032
- oauth: config.oauth,
94033
94006
  permissions: config.permissions
94034
94007
  })
94035
94008
  ]);
@@ -94038,7 +94011,7 @@ async function runPrebuildToBuild(cwd, config) {
94038
94011
  cwd,
94039
94012
  entryFile: "",
94040
94013
  appName: config.appName,
94041
- outdir,
94014
+ outdir: config.outdir,
94042
94015
  buildResults: []
94043
94016
  });
94044
94017
  }
@@ -94047,8 +94020,7 @@ async function runPrebuildToBuild(cwd, config) {
94047
94020
  title: `Building ${platform3}`,
94048
94021
  task: async () => {
94049
94022
  await babelBuild({
94050
- appName: config.appName,
94051
- outdir,
94023
+ config,
94052
94024
  platform: platform3,
94053
94025
  buildNumber,
94054
94026
  deploymentId
@@ -94069,28 +94041,30 @@ async function runPrebuildToBuild(cwd, config) {
94069
94041
  cwd,
94070
94042
  entryFile: "",
94071
94043
  appName: config.appName,
94072
- outdir,
94044
+ outdir: config.outdir,
94073
94045
  buildResults: [
94074
94046
  {
94075
94047
  errors: [],
94076
94048
  warnings: [],
94077
94049
  tag: `${config.appName}-ios`,
94078
- outfile: path20.join(cwd, outdir, `${config.appName}.ios.js`),
94050
+ outfile: path20.join(cwd, config.outdir, `${config.appName}.ios.js`),
94079
94051
  extra: {},
94080
94052
  outputFiles: [],
94081
94053
  metafile: { inputs: {}, outputs: {} },
94082
94054
  mangleCache: {},
94055
+ bundle: {},
94083
94056
  ...prodIos
94084
94057
  },
94085
94058
  {
94086
94059
  errors: [],
94087
94060
  warnings: [],
94088
94061
  tag: `${config.appName}-android`,
94089
- outfile: path20.join(cwd, outdir, `${config.appName}.android.js`),
94062
+ outfile: path20.join(cwd, config.outdir, `${config.appName}.android.js`),
94090
94063
  extra: {},
94091
94064
  outputFiles: [],
94092
94065
  metafile: { inputs: {}, outputs: {} },
94093
94066
  mangleCache: {},
94067
+ bundle: {},
94094
94068
  ...prodAndroid
94095
94069
  }
94096
94070
  ]
@@ -96206,12 +96180,7 @@ function parsePermissions(permissions) {
96206
96180
  }
96207
96181
  return Array.from(permissionMap.entries()).map(([name, accesses]) => `${name}:${Array.from(accesses).sort().join("")}`).sort().join(",");
96208
96182
  }
96209
- var createApp = ({
96210
- appName,
96211
- web,
96212
- oauth,
96213
- permissions
96214
- }) => {
96183
+ var createApp = ({ appName, web, permissions, webViewProps }) => {
96215
96184
  const app = new Hono2();
96216
96185
  app.get("/status", (c5) => {
96217
96186
  c5.header("X-React-Native-Project-Root", path21.resolve(__dirname, "..", "react-native"));
@@ -96220,10 +96189,6 @@ var createApp = ({
96220
96189
  app.get("/permissions", (c5) => {
96221
96190
  return c5.text(parsePermissions(permissions));
96222
96191
  });
96223
- app.get("/oauth/scope", (c5) => {
96224
- const scope = oauth.scopes.sort().join(";");
96225
- return c5.text(scope);
96226
- });
96227
96192
  app.get("/index.bundle", async (c5) => {
96228
96193
  const platform3 = c5.req.query("platform");
96229
96194
  const prebuilt = import.meta.resolve(`@apps-in-toss/web-framework/prebuilt/dev/${platform3}`).replace("file://", "");
@@ -96241,7 +96206,8 @@ var createApp = ({
96241
96206
  json: {
96242
96207
  appName,
96243
96208
  webPort: web.port,
96244
- webHost: web.host
96209
+ webHost: web.host,
96210
+ ...webViewProps
96245
96211
  },
96246
96212
  identifierName: "Ait"
96247
96213
  }
@@ -96289,15 +96255,7 @@ var DevCommand = class extends Command {
96289
96255
  async execute() {
96290
96256
  const packageRoot = getPackageRoot();
96291
96257
  const config = await loadConfig();
96292
- const app = createApp({
96293
- appName: config.appName,
96294
- web: {
96295
- port: config.web.port,
96296
- host: config.web.host ?? "localhost"
96297
- },
96298
- oauth: config.oauth,
96299
- permissions: config.permissions
96300
- });
96258
+ const app = createApp(config);
96301
96259
  serve(
96302
96260
  {
96303
96261
  hostname: "0.0.0.0",
@@ -1,3 +1,9 @@
1
+ type NotNill<T> = T extends null | undefined ? never : T;
2
+ type Primitive = undefined | null | boolean | string | number;
3
+ type DeepRequired<T> = T extends Primitive ? NotNill<T> : T extends Array<infer U> ? Array<DeepRequired<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepRequired<U>> : {
4
+ [P in keyof T]-?: DeepRequired<T[P]>;
5
+ };
6
+
1
7
  type PermissionReadWrite = 'read' | 'write';
2
8
  type PermissionAccess = 'access';
3
9
  type ClipboardPermission = {
@@ -21,18 +27,6 @@ type CameraPermission = {
21
27
  access: PermissionAccess;
22
28
  };
23
29
  type Permission = ClipboardPermission | GeolocationPermission | ContactsPermission | PhotosPermission | CameraPermission;
24
- /**
25
- * OAuth 인증시 사용할 수 있는 Scope 값이에요.
26
- *
27
- * - `user_name`: 유저 이름이에요.
28
- * - `user_phone`: 유저 휴대폰 번호예요.
29
- * - `user_birthday`: 유저 생년월일이에요.
30
- * - `user_ci`: 유저를 식별하는 키인 CI(Connection Information) 값이에요.
31
- * - `user_gender`: 유저의 성별이에요.
32
- * - `user_nationality`: 유저의 국적이에요.
33
- * - `user_email`: 유저의 이메일이에요. 토스 회원의 email이 존재하지 않는 경우 null 응답을 반환해요.
34
- */
35
- type OAuthScope = 'user_name' | 'user_phone' | 'user_birthday' | 'user_ci' | 'user_gender' | 'user_nationality' | 'user_email';
36
30
  interface AppsInTossWebConfig {
37
31
  appName: string;
38
32
  web: {
@@ -46,15 +40,48 @@ interface AppsInTossWebConfig {
46
40
  build: string;
47
41
  };
48
42
  };
49
- permissions: Permission[];
50
- oauth: {
51
- scopes: OAuthScope[];
43
+ webViewProps?: {
44
+ /**
45
+ *
46
+ * @default false
47
+ * @platform — ios
48
+ *
49
+ * Boolean that determines whether HTML5 videos play inline or use the native full-screen controller. The default value is false.
50
+ * NOTE : In order for video to play inline, not only does this property need to be set to true, but the video element in the HTML document must also include the webkit-playsinline attribute.
51
+ */
52
+ allowsInlineMediaPlayback?: boolean;
53
+ /**
54
+ * @default true
55
+ * @platform — ios
56
+ *
57
+ * Boolean value that determines whether the web view bounces when it reaches the edge of the content.
58
+ *
59
+ */
60
+ bounces?: boolean;
61
+ /**
62
+ *
63
+ * @default true
64
+ * @platform - ios
65
+ * Boolean value that determines whether a pull to refresh gesture is available in the WebView. The default value is false. If true, sets bounces automatically to true
66
+ */
67
+ pullToRefreshEnabled?: boolean;
68
+ /**
69
+ * https://developer.android.com/reference/android/view/View#OVER_SCROLL_NEVER Sets the overScrollMode. Possible values are:
70
+ * 'always' (default)
71
+ * 'content'
72
+ * 'never'
73
+ * @platform — android
74
+ * @default 'always'
75
+ */
76
+ overScrollMode?: 'never' | 'always' | 'auto';
52
77
  };
78
+ permissions: Permission[];
53
79
  /**
54
80
  * @default 'dist'
55
81
  */
56
82
  outdir?: string;
57
83
  }
58
- declare const defineConfig: (config: AppsInTossWebConfig) => AppsInTossWebConfig;
84
+ type AppsInTossWebConfigResponse = DeepRequired<AppsInTossWebConfig>;
85
+ declare const defineConfig: (config: AppsInTossWebConfig) => AppsInTossWebConfigResponse;
59
86
 
60
- export { type AppsInTossWebConfig, defineConfig };
87
+ export { type AppsInTossWebConfig, type AppsInTossWebConfigResponse, defineConfig };
@@ -1,12 +1,57 @@
1
- // src/config/defineConfig.ts
2
- var defineConfig = (config) => {
3
- if (!config.outdir) {
4
- config.outdir = "dist";
1
+ // ../../.yarn/cache/es-toolkit-npm-1.32.0-019fc7c155-56ba965570.zip/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
2
+ function isPlainObject(value) {
3
+ if (!value || typeof value !== "object") {
4
+ return false;
5
+ }
6
+ const proto = Object.getPrototypeOf(value);
7
+ const hasObjectPrototype = proto === null || proto === Object.prototype || Object.getPrototypeOf(proto) === null;
8
+ if (!hasObjectPrototype) {
9
+ return false;
5
10
  }
6
- if (!config.web.host) {
7
- config.web.host = "localhost";
11
+ return Object.prototype.toString.call(value) === "[object Object]";
12
+ }
13
+
14
+ // ../../.yarn/cache/es-toolkit-npm-1.32.0-019fc7c155-56ba965570.zip/node_modules/es-toolkit/dist/object/merge.mjs
15
+ function merge(target, source) {
16
+ const sourceKeys = Object.keys(source);
17
+ for (let i = 0; i < sourceKeys.length; i++) {
18
+ const key = sourceKeys[i];
19
+ const sourceValue = source[key];
20
+ const targetValue = target[key];
21
+ if (Array.isArray(sourceValue)) {
22
+ if (Array.isArray(targetValue)) {
23
+ target[key] = merge(targetValue, sourceValue);
24
+ } else {
25
+ target[key] = merge([], sourceValue);
26
+ }
27
+ } else if (isPlainObject(sourceValue)) {
28
+ if (isPlainObject(targetValue)) {
29
+ target[key] = merge(targetValue, sourceValue);
30
+ } else {
31
+ target[key] = merge({}, sourceValue);
32
+ }
33
+ } else if (targetValue === void 0 || sourceValue !== void 0) {
34
+ target[key] = sourceValue;
35
+ }
8
36
  }
9
- return config;
37
+ return target;
38
+ }
39
+
40
+ // src/config/defineConfig.ts
41
+ var defineConfig = (config) => {
42
+ const defaultConfig = {
43
+ outdir: "dist",
44
+ web: {
45
+ host: "localhost"
46
+ },
47
+ webViewProps: {
48
+ allowsInlineMediaPlayback: false,
49
+ bounces: true,
50
+ pullToRefreshEnabled: true,
51
+ overScrollMode: "always"
52
+ }
53
+ };
54
+ return merge(defaultConfig, config);
10
55
  };
11
56
  export {
12
57
  defineConfig