@apps-in-toss/web-framework 0.0.11 → 0.0.12

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
@@ -93980,9 +93980,8 @@ async function resolvePlugins(plugins) {
93980
93980
 
93981
93981
  // src/runPrebuildToBuild.ts
93982
93982
  async function babelBuild({
93983
- appName,
93984
- outdir,
93985
93983
  platform: platform3,
93984
+ config,
93986
93985
  buildNumber,
93987
93986
  deploymentId
93988
93987
  }) {
@@ -93995,11 +93994,12 @@ async function babelBuild({
93995
93994
  babelJsonReplacementPlugin,
93996
93995
  {
93997
93996
  json: {
93998
- appName,
93997
+ appName: config.appName,
93999
93998
  webPort: "NOOP",
94000
93999
  webHost: "NOOP",
94001
94000
  buildNumber,
94002
- deploymentId
94001
+ deploymentId,
94002
+ ...config.webViewProps
94003
94003
  },
94004
94004
  identifierName: "Ait"
94005
94005
  }
@@ -94009,8 +94009,8 @@ async function babelBuild({
94009
94009
  if (!result?.code) {
94010
94010
  throw new Error(`Failed to build ${platform3}`);
94011
94011
  }
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);
94012
+ await fs8.promises.mkdir(path20.join(packageRoot, config.outdir), { recursive: true });
94013
+ await fs8.promises.writeFile(path20.join(packageRoot, config.outdir, `${config.appName}.${platform3}.js`), result.code);
94014
94014
  }
94015
94015
  function getBuildNumber() {
94016
94016
  const date = /* @__PURE__ */ new Date();
@@ -94025,7 +94025,6 @@ function getBuildNumber() {
94025
94025
  async function runPrebuildToBuild(cwd, config) {
94026
94026
  const buildNumber = getBuildNumber();
94027
94027
  const deploymentId = uuidv7();
94028
- const { outdir = "dist" } = config;
94029
94028
  const resolvedPlugins = await resolvePlugins([
94030
94029
  appsInTossWeb(deploymentId, {
94031
94030
  commands: config.web.commands,
@@ -94038,7 +94037,7 @@ async function runPrebuildToBuild(cwd, config) {
94038
94037
  cwd,
94039
94038
  entryFile: "",
94040
94039
  appName: config.appName,
94041
- outdir,
94040
+ outdir: config.outdir,
94042
94041
  buildResults: []
94043
94042
  });
94044
94043
  }
@@ -94047,8 +94046,7 @@ async function runPrebuildToBuild(cwd, config) {
94047
94046
  title: `Building ${platform3}`,
94048
94047
  task: async () => {
94049
94048
  await babelBuild({
94050
- appName: config.appName,
94051
- outdir,
94049
+ config,
94052
94050
  platform: platform3,
94053
94051
  buildNumber,
94054
94052
  deploymentId
@@ -94069,13 +94067,13 @@ async function runPrebuildToBuild(cwd, config) {
94069
94067
  cwd,
94070
94068
  entryFile: "",
94071
94069
  appName: config.appName,
94072
- outdir,
94070
+ outdir: config.outdir,
94073
94071
  buildResults: [
94074
94072
  {
94075
94073
  errors: [],
94076
94074
  warnings: [],
94077
94075
  tag: `${config.appName}-ios`,
94078
- outfile: path20.join(cwd, outdir, `${config.appName}.ios.js`),
94076
+ outfile: path20.join(cwd, config.outdir, `${config.appName}.ios.js`),
94079
94077
  extra: {},
94080
94078
  outputFiles: [],
94081
94079
  metafile: { inputs: {}, outputs: {} },
@@ -94087,7 +94085,7 @@ async function runPrebuildToBuild(cwd, config) {
94087
94085
  errors: [],
94088
94086
  warnings: [],
94089
94087
  tag: `${config.appName}-android`,
94090
- outfile: path20.join(cwd, outdir, `${config.appName}.android.js`),
94088
+ outfile: path20.join(cwd, config.outdir, `${config.appName}.android.js`),
94091
94089
  extra: {},
94092
94090
  outputFiles: [],
94093
94091
  metafile: { inputs: {}, outputs: {} },
@@ -96208,12 +96206,7 @@ function parsePermissions(permissions) {
96208
96206
  }
96209
96207
  return Array.from(permissionMap.entries()).map(([name, accesses]) => `${name}:${Array.from(accesses).sort().join("")}`).sort().join(",");
96210
96208
  }
96211
- var createApp = ({
96212
- appName,
96213
- web,
96214
- oauth,
96215
- permissions
96216
- }) => {
96209
+ var createApp = ({ appName, web, oauth, permissions, webViewProps }) => {
96217
96210
  const app = new Hono2();
96218
96211
  app.get("/status", (c5) => {
96219
96212
  c5.header("X-React-Native-Project-Root", path21.resolve(__dirname, "..", "react-native"));
@@ -96243,7 +96236,8 @@ var createApp = ({
96243
96236
  json: {
96244
96237
  appName,
96245
96238
  webPort: web.port,
96246
- webHost: web.host
96239
+ webHost: web.host,
96240
+ ...webViewProps
96247
96241
  },
96248
96242
  identifierName: "Ait"
96249
96243
  }
@@ -96291,15 +96285,7 @@ var DevCommand = class extends Command {
96291
96285
  async execute() {
96292
96286
  const packageRoot = getPackageRoot();
96293
96287
  const config = await loadConfig();
96294
- const app = createApp({
96295
- appName: config.appName,
96296
- web: {
96297
- port: config.web.port,
96298
- host: config.web.host ?? "localhost"
96299
- },
96300
- oauth: config.oauth,
96301
- permissions: config.permissions
96302
- });
96288
+ const app = createApp(config);
96303
96289
  serve(
96304
96290
  {
96305
96291
  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 = {
@@ -46,6 +52,41 @@ interface AppsInTossWebConfig {
46
52
  build: string;
47
53
  };
48
54
  };
55
+ webViewProps?: {
56
+ /**
57
+ *
58
+ * @default false
59
+ * @platform — ios
60
+ *
61
+ * Boolean that determines whether HTML5 videos play inline or use the native full-screen controller. The default value is false.
62
+ * 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.
63
+ */
64
+ allowsInlineMediaPlayback?: boolean;
65
+ /**
66
+ * @default true
67
+ * @platform — ios
68
+ *
69
+ * Boolean value that determines whether the web view bounces when it reaches the edge of the content.
70
+ *
71
+ */
72
+ bounces?: boolean;
73
+ /**
74
+ *
75
+ * @default true
76
+ * @platform - ios
77
+ * 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
78
+ */
79
+ pullToRefreshEnabled?: boolean;
80
+ /**
81
+ * https://developer.android.com/reference/android/view/View#OVER_SCROLL_NEVER Sets the overScrollMode. Possible values are:
82
+ * 'always' (default)
83
+ * 'content'
84
+ * 'never'
85
+ * @platform — android
86
+ * @default 'always'
87
+ */
88
+ overScrollMode?: 'never' | 'always' | 'auto';
89
+ };
49
90
  permissions: Permission[];
50
91
  oauth: {
51
92
  scopes: OAuthScope[];
@@ -55,6 +96,7 @@ interface AppsInTossWebConfig {
55
96
  */
56
97
  outdir?: string;
57
98
  }
58
- declare const defineConfig: (config: AppsInTossWebConfig) => AppsInTossWebConfig;
99
+ type AppsInTossWebConfigResponse = DeepRequired<AppsInTossWebConfig>;
100
+ declare const defineConfig: (config: AppsInTossWebConfig) => AppsInTossWebConfigResponse;
59
101
 
60
- export { type AppsInTossWebConfig, defineConfig };
102
+ 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
@@ -154810,18 +154810,8 @@ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, e
154810
154810
  }));
154811
154811
  case 7:
154812
154812
  albumPhotos = _context5.sent;
154813
- if (!options.base64) {
154814
- _context5.next = 10;
154815
- break;
154816
- }
154817
- return _context5.abrupt("return", albumPhotos.map(function (photo) {
154818
- return _objectSpread(_objectSpread({}, photo), {}, {
154819
- dataUri: "data:image/jpeg;base64,".concat(photo.dataUri)
154820
- });
154821
- }));
154822
- case 10:
154823
154813
  return _context5.abrupt("return", albumPhotos);
154824
- case 11:
154814
+ case 9:
154825
154815
  case "end":
154826
154816
  return _context5.stop();
154827
154817
  }
@@ -154957,6 +154947,12 @@ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, e
154957
154947
  return _getOperationalEnvironment;
154958
154948
  }
154959
154949
  });
154950
+ var _env = {
154951
+ getDeploymentId: function getDeploymentId() {
154952
+ var _global$__appsInToss;
154953
+ return __DEV__ ? "local" : (_global$__appsInToss = global.__appsInToss) === null || _global$__appsInToss === void 0 ? void 0 : _global$__appsInToss.deploymentId;
154954
+ }
154955
+ };
154960
154956
  var event_bridges_exports = {};
154961
154957
  __export(event_bridges_exports, {
154962
154958
  startUpdateLocation: function startUpdateLocation() {
@@ -154972,7 +154968,12 @@ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, e
154972
154968
  if (__DEV__) {
154973
154969
  return "http://".concat(local.host, ":").concat(local.port);
154974
154970
  }
154975
- return AppsInTossModule.getWebBundleURL({}).url;
154971
+ var url = new URL(AppsInTossModule.getWebBundleURL({}).url);
154972
+ var deploymentId = _env.getDeploymentId();
154973
+ if (deploymentId) {
154974
+ url.searchParams.set("_deploymentId", deploymentId);
154975
+ }
154976
+ return url.toString();
154976
154977
  }, [local]);
154977
154978
  var handler = (0, import_react_native_bedrock4.useBridgeHandler)({
154978
154979
  onMessage: onMessage,
@@ -154988,6 +154989,8 @@ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, e
154988
154989
  },
154989
154990
  sharedCookiesEnabled: true,
154990
154991
  thirdPartyCookiesEnabled: true,
154992
+ cacheEnabled: false,
154993
+ cacheMode: "LOAD_NO_CACHE",
154991
154994
  onMessage: handler.onMessage,
154992
154995
  injectedJavaScript: handler.injectedJavaScript,
154993
154996
  injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript
@@ -155020,12 +155023,6 @@ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, e
155020
155023
  }, [accuracy, distanceInterval, timeInterval, isVisible]);
155021
155024
  return location;
155022
155025
  }
155023
- var _env = {
155024
- getDeploymentId: function getDeploymentId() {
155025
- var _global$__appsInToss;
155026
- return __DEV__ ? "local" : (_global$__appsInToss = global.__appsInToss) === null || _global$__appsInToss === void 0 ? void 0 : _global$__appsInToss.deploymentId;
155027
- }
155028
- };
155029
155026
  var Accuracy2 = function (Accuracy3) {
155030
155027
  Accuracy3[Accuracy3["Lowest"] = 1] = "Lowest";
155031
155028
  Accuracy3[Accuracy3["Low"] = 2] = "Low";
@@ -155794,7 +155791,11 @@ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, e
155794
155791
  local: {
155795
155792
  port: Ait.webPort,
155796
155793
  host: Ait.webHost
155797
- }
155794
+ },
155795
+ allowsInlineMediaPlayback: Ait.allowsInlineMediaPlayback,
155796
+ bounces: Ait.bounces,
155797
+ overScrollMode: Ait.overScrollMode,
155798
+ pullToRefreshEnabled: Ait.pullToRefreshEnabled
155798
155799
  })
155799
155800
  });
155800
155801
  }
@@ -154637,18 +154637,8 @@ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, e
154637
154637
  }));
154638
154638
  case 7:
154639
154639
  albumPhotos = _context5.sent;
154640
- if (!options.base64) {
154641
- _context5.next = 10;
154642
- break;
154643
- }
154644
- return _context5.abrupt("return", albumPhotos.map(function (photo) {
154645
- return _objectSpread(_objectSpread({}, photo), {}, {
154646
- dataUri: "data:image/jpeg;base64,".concat(photo.dataUri)
154647
- });
154648
- }));
154649
- case 10:
154650
154640
  return _context5.abrupt("return", albumPhotos);
154651
- case 11:
154641
+ case 9:
154652
154642
  case "end":
154653
154643
  return _context5.stop();
154654
154644
  }
@@ -154784,6 +154774,12 @@ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, e
154784
154774
  return _getOperationalEnvironment;
154785
154775
  }
154786
154776
  });
154777
+ var _env = {
154778
+ getDeploymentId: function getDeploymentId() {
154779
+ var _global$__appsInToss;
154780
+ return __DEV__ ? "local" : (_global$__appsInToss = global.__appsInToss) === null || _global$__appsInToss === void 0 ? void 0 : _global$__appsInToss.deploymentId;
154781
+ }
154782
+ };
154787
154783
  var event_bridges_exports = {};
154788
154784
  __export(event_bridges_exports, {
154789
154785
  startUpdateLocation: function startUpdateLocation() {
@@ -154799,7 +154795,12 @@ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, e
154799
154795
  if (__DEV__) {
154800
154796
  return "http://".concat(local.host, ":").concat(local.port);
154801
154797
  }
154802
- return AppsInTossModule.getWebBundleURL({}).url;
154798
+ var url = new URL(AppsInTossModule.getWebBundleURL({}).url);
154799
+ var deploymentId = _env.getDeploymentId();
154800
+ if (deploymentId) {
154801
+ url.searchParams.set("_deploymentId", deploymentId);
154802
+ }
154803
+ return url.toString();
154803
154804
  }, [local]);
154804
154805
  var handler = (0, import_react_native_bedrock4.useBridgeHandler)({
154805
154806
  onMessage: onMessage,
@@ -154815,6 +154816,8 @@ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, e
154815
154816
  },
154816
154817
  sharedCookiesEnabled: true,
154817
154818
  thirdPartyCookiesEnabled: true,
154819
+ cacheEnabled: false,
154820
+ cacheMode: "LOAD_NO_CACHE",
154818
154821
  onMessage: handler.onMessage,
154819
154822
  injectedJavaScript: handler.injectedJavaScript,
154820
154823
  injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript
@@ -154847,12 +154850,6 @@ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, e
154847
154850
  }, [accuracy, distanceInterval, timeInterval, isVisible]);
154848
154851
  return location;
154849
154852
  }
154850
- var _env = {
154851
- getDeploymentId: function getDeploymentId() {
154852
- var _global$__appsInToss;
154853
- return __DEV__ ? "local" : (_global$__appsInToss = global.__appsInToss) === null || _global$__appsInToss === void 0 ? void 0 : _global$__appsInToss.deploymentId;
154854
- }
154855
- };
154856
154853
  var Accuracy2 = function (Accuracy3) {
154857
154854
  Accuracy3[Accuracy3["Lowest"] = 1] = "Lowest";
154858
154855
  Accuracy3[Accuracy3["Low"] = 2] = "Low";
@@ -155735,7 +155732,11 @@ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, e
155735
155732
  local: {
155736
155733
  port: Ait.webPort,
155737
155734
  host: Ait.webHost
155738
- }
155735
+ },
155736
+ allowsInlineMediaPlayback: Ait.allowsInlineMediaPlayback,
155737
+ bounces: Ait.bounces,
155738
+ overScrollMode: Ait.overScrollMode,
155739
+ pullToRefreshEnabled: Ait.pullToRefreshEnabled
155739
155740
  })
155740
155741
  });
155741
155742
  }