@apps-in-toss/web-framework 0.0.7 → 0.0.8

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.
Files changed (59) hide show
  1. package/dist/chunk-5AYTRYXW.js +27 -0
  2. package/dist/chunk-MHAJE5QI.js +34 -0
  3. package/dist/cli.cjs +4528 -543
  4. package/dist/cli.d.cts +2 -1
  5. package/dist/cli.d.ts +2 -1
  6. package/dist/cli.js +3486 -493
  7. package/dist/config/index.cjs +17 -4
  8. package/dist/config/index.d.cts +19 -3
  9. package/dist/config/index.d.ts +19 -3
  10. package/dist/config/index.js +7714 -23
  11. package/dist/lib-EUN4APCZ.js +1007 -0
  12. package/dist/lib-OD73GAMK.js +1007 -0
  13. package/package.json +14 -12
  14. package/src-web/closeView.d.ts +24 -0
  15. package/src-web/generateHapticFeedback.d.ts +52 -0
  16. package/src-web/getDeviceId.d.ts +32 -0
  17. package/src-web/getLocale.d.ts +31 -0
  18. package/src-web/getNetworkStatus.d.ts +55 -0
  19. package/src-web/getSchemeUri.d.ts +26 -0
  20. package/src-web/index.js +1 -0
  21. package/src-web/setScreenAwakeMode.d.ts +69 -0
  22. package/src-web/setSecureScreen.d.ts +34 -0
  23. package/src-web/share.d.ts +37 -0
  24. package/dist/chunk-CH3CIAIW.js +0 -7688
  25. package/dist/chunk-DI2VGQ6M.js +0 -53
  26. package/dist/chunk-HL7M3JLX.js +0 -53
  27. package/dist/chunk-I3ZDGLIW.js +0 -19
  28. package/dist/chunk-LJBVSTWE.js +0 -7687
  29. package/dist/chunk-OMIGZ2S7.js +0 -7689
  30. package/dist/chunk-TZCMTMV7.js +0 -38
  31. package/dist/cli/index.cjs +0 -644
  32. package/dist/cli/index.d.cts +0 -2
  33. package/dist/cli/index.d.ts +0 -2
  34. package/dist/cli/index.js +0 -592
  35. package/dist/closeView.d.ts +0 -1
  36. package/dist/generateHapticFeedback.d.ts +0 -1
  37. package/dist/getDeviceId.d.ts +0 -1
  38. package/dist/getLocale.d.ts +0 -1
  39. package/dist/getNetworkStatus.d.ts +0 -1
  40. package/dist/getSchemeUri.d.ts +0 -1
  41. package/dist/index.cjs +0 -18
  42. package/dist/index.d.cts +0 -2
  43. package/dist/index.js +0 -1
  44. package/dist/plugins/index.cjs +0 -7682
  45. package/dist/plugins/index.d.cts +0 -15
  46. package/dist/plugins/index.d.ts +0 -15
  47. package/dist/plugins/index.js +0 -11
  48. package/dist/setScreenAwakeMode.d.ts +0 -1
  49. package/dist/setSecureScreen.d.ts +0 -1
  50. package/dist/share.d.ts +0 -1
  51. package/react-native/.bedrock/.env.js +0 -4
  52. /package/{dist → src-web}/fetchAlbumPhotos.d.ts +0 -0
  53. /package/{dist → src-web}/fetchContacts.d.ts +0 -0
  54. /package/{dist → src-web}/getClipboardText.d.ts +0 -0
  55. /package/{dist → src-web}/getCurrentLocation.d.ts +0 -0
  56. /package/{dist → src-web}/index.d.ts +0 -0
  57. /package/{dist → src-web}/openCamera.d.ts +0 -0
  58. /package/{dist → src-web}/setClipboardText.d.ts +0 -0
  59. /package/{dist → src-web}/startUpdateLocation.d.ts +0 -0
package/dist/cli/index.js DELETED
@@ -1,592 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import {
3
- __dirname,
4
- __require,
5
- loadConfig
6
- } from "../chunk-DI2VGQ6M.js";
7
-
8
- // src/cli/index.ts
9
- import { Cli } from "clipanion";
10
-
11
- // src/cli/BuildCommand/BuildCommand.ts
12
- import { generateDeploymentId } from "@apps-in-toss/framework/cli-presets";
13
- import { Command, Option } from "clipanion";
14
- import picocolors from "picocolors";
15
-
16
- // src/cli/BuildCommand/build.ts
17
- import fs from "fs";
18
- import path from "path";
19
- import { createArtifact, getPreset } from "@apps-in-toss/framework/cli-presets";
20
- import * as mpack from "@react-native-bedrock/mpack-next";
21
- import { statusPlugin } from "@react-native-bedrock/mpack-next/plugins";
22
- import { execa } from "execa";
23
- import presets from "react-native-bedrock/presets";
24
-
25
- // src/cli/utils/getPackageManager.ts
26
- function getPackageManager({ isExecutor = false } = {}) {
27
- const userAgent = process.env.npm_config_user_agent;
28
- const packageManagerCommands = {
29
- npm: isExecutor ? "npx" : "npm",
30
- pnpm: "pnpm",
31
- yarn: "yarn"
32
- };
33
- if (!userAgent) {
34
- return {
35
- packageManager: packageManagerCommands["npm"],
36
- version: "0.0.0"
37
- };
38
- }
39
- const [packageManagerInfo] = userAgent.match(/(\w+)\/(\d+\.\d+\.\d+)/) || [];
40
- const [packageManager, version2] = packageManagerInfo?.split("/") ?? ["npm", null];
41
- if (!packageManager) {
42
- return {
43
- packageManager: packageManagerCommands["npm"],
44
- version: "0.0.0"
45
- };
46
- }
47
- return {
48
- packageManager: packageManagerCommands[packageManager],
49
- version: version2 ?? "0.0.0"
50
- };
51
- }
52
-
53
- // src/cli/BuildCommand/build.ts
54
- async function build({
55
- distDirname,
56
- cache,
57
- deploymentId
58
- }) {
59
- const config = await loadConfig();
60
- const rootDir = process.cwd();
61
- const reactNativeProjectDir = path.resolve(__dirname, "..", "react-native");
62
- const projectRootTmp = path.resolve(process.cwd(), ".bedrock");
63
- await fs.promises.mkdir(projectRootTmp, { recursive: true });
64
- await fs.promises.writeFile(
65
- path.join(projectRootTmp, "metadata.json"),
66
- JSON.stringify({ appName: config.appName, webPort: config.web.port })
67
- );
68
- const appName = config.appName;
69
- const { packageManager } = getPackageManager({ isExecutor: true });
70
- const distDir = path.join(rootDir, distDirname);
71
- const webDistDir = path.join(distDir, "web");
72
- await fs.promises.rm(distDir, { recursive: true, force: true });
73
- await execa(packageManager, config.web.commands.build.split(" "), {
74
- cwd: process.cwd(),
75
- stdio: "inherit"
76
- });
77
- await fs.promises.mkdir(webDistDir, { recursive: true });
78
- const items = await fs.promises.readdir(distDir);
79
- for (const item of items) {
80
- const src = path.join(distDir, item);
81
- const dest = path.join(webDistDir, item);
82
- if (src === webDistDir) {
83
- continue;
84
- }
85
- await fs.promises.rename(src, dest);
86
- }
87
- const appsInTossPreset = getPreset(deploymentId);
88
- const buildResults = await mpack.runBundle({
89
- clean: false,
90
- metafile: false,
91
- dev: false,
92
- rootDir: reactNativeProjectDir,
93
- cache,
94
- plugins: [statusPlugin],
95
- config: {
96
- appName,
97
- services: {
98
- sentry: {
99
- enabled: false
100
- }
101
- },
102
- concurrency: 2,
103
- tasks: [
104
- {
105
- tag: `${appName}-ios`,
106
- presets: [presets.service(), appsInTossPreset],
107
- build: {
108
- babel: {
109
- conditions: [(_code) => _code.includes("Ait")],
110
- plugins: [
111
- [
112
- __require.resolve("@apps-in-toss/babel-plugin-json"),
113
- { jsonPath: "./.bedrock/metadata.json", identifierName: "Ait" }
114
- ]
115
- ]
116
- },
117
- platform: "ios",
118
- entry: path.join(reactNativeProjectDir, "src", "_app.tsx"),
119
- outfile: path.join(distDir, `${appName}.ios.js`)
120
- }
121
- },
122
- {
123
- tag: `${appName}-android`,
124
- presets: [presets.service(), appsInTossPreset],
125
- build: {
126
- babel: {
127
- conditions: [(_code) => _code.includes("Ait")],
128
- plugins: [
129
- [
130
- __require.resolve("@apps-in-toss/babel-plugin-json"),
131
- { jsonPath: "./.bedrock/metadata.json", identifierName: "Ait" }
132
- ]
133
- ]
134
- },
135
- platform: "android",
136
- entry: path.join(reactNativeProjectDir, "src", "_app.tsx"),
137
- outfile: path.join(distDir, `${appName}.android.js`)
138
- }
139
- }
140
- ]
141
- }
142
- });
143
- const artifactOutfile = await createArtifact({
144
- buildResults,
145
- rootDir,
146
- deploymentId,
147
- reactNativeProjectDir,
148
- webOutDir: webDistDir
149
- });
150
- if (!artifactOutfile) {
151
- throw new Error("\uC544\uD2F0\uD329\uD2B8 \uC0DD\uC131\uC5D0 \uC2E4\uD328\uD588\uC5B4\uC694.");
152
- }
153
- return artifactOutfile;
154
- }
155
-
156
- // src/cli/constants.ts
157
- var APP_MANIFEST_NAME = "app.json";
158
- var DEFAULT_DIST_DIR = "dist";
159
- var DEFAULT_API_BASE_URL = "https://apps-in-toss.toss.im/console";
160
- var DEFAULT_LOCALHOST_PORT = 8081;
161
- var DEFAULT_HOST = "localhost";
162
-
163
- // src/cli/BuildCommand/BuildCommand.ts
164
- var BuildCommand = class extends Command {
165
- static paths = [[`build`]];
166
- static usage = Command.Usage({
167
- category: "Build",
168
- description: "Apps In Toss \uBE4C\uB4DC \uC544\uD2F0\uD329\uD2B8\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4",
169
- examples: [["\uBE4C\uB4DC \uC544\uD2F0\uD329\uD2B8 \uC0DD\uC131\uD558\uAE30", "ait build"]]
170
- });
171
- cache = Option.Boolean("--cache", true);
172
- async execute() {
173
- const deploymentId = generateDeploymentId();
174
- const artifactOutfile = await build({
175
- distDirname: DEFAULT_DIST_DIR,
176
- cache: this.cache,
177
- deploymentId
178
- });
179
- console.log(`
180
- ${picocolors.blue(artifactOutfile)}
181
- `);
182
- }
183
- };
184
-
185
- // src/cli/DeployCommand/DeployCommand.ts
186
- import assert from "assert";
187
- import path2 from "path";
188
- import { generateDeploymentId as generateDeploymentId2 } from "@apps-in-toss/framework/cli-presets";
189
- import * as p from "@clack/prompts";
190
- import { Command as Command2, Option as Option2 } from "clipanion";
191
- import Debug2 from "debug";
192
- import picocolors2 from "picocolors";
193
-
194
- // src/cli/DeployCommand/upload.ts
195
- import fs2 from "fs";
196
- import Debug from "debug";
197
- var debug = Debug("cli:deploy");
198
- async function uploadArtifact(config) {
199
- debug("uploadArtifact", config);
200
- const baseUrl = config.baseUrl ?? DEFAULT_API_BASE_URL;
201
- const response = await fetch(
202
- `${baseUrl}/api-public/v3/appsintossconsole/bundles/${config.appName}/deployments/${config.deploymentId}/upload`,
203
- {
204
- method: "POST",
205
- headers: {
206
- "Content-Type": "application/octet-stream",
207
- "X-Ait-Console-Api-Key": config.apiKey
208
- },
209
- body: fs2.createReadStream(config.artifactPath),
210
- duplex: "half"
211
- }
212
- );
213
- return handleResponse(response);
214
- }
215
- async function handleResponse(response) {
216
- debug(`Response ${response.status} ${response.statusText}`);
217
- if (!response.ok) {
218
- throw new Error(`HTTP ${response.status}: ${response.statusText}`);
219
- }
220
- const data = await response.clone().json();
221
- debug("uploadArtifact response", data);
222
- if (data.resultType !== "SUCCESS") {
223
- const errorCode = data?.error?.errorCode ?? "-1";
224
- const errorReason = data?.error.reason ?? "unknown";
225
- throw new Error(`${errorReason} (Code: ${errorCode})`);
226
- }
227
- }
228
-
229
- // src/cli/utils/readZipContent.ts
230
- import yauzl from "yauzl";
231
- function readZipContent(zipPath, fileName) {
232
- return new Promise((resolve, reject) => {
233
- yauzl.open(zipPath, { lazyEntries: true }, (error, zipFile) => {
234
- if (error) {
235
- reject(error);
236
- return;
237
- }
238
- zipFile.on("entry", (entry) => {
239
- if (entry.fileName === fileName) {
240
- zipFile.openReadStream(entry, (error2, readStream) => {
241
- if (error2) {
242
- throw error2;
243
- }
244
- let fileData = "";
245
- readStream.on("data", (chunk) => fileData += chunk.toString("utf8")).on("end", () => {
246
- zipFile.close();
247
- resolve(fileData);
248
- });
249
- });
250
- } else {
251
- zipFile.readEntry();
252
- }
253
- }).on("end", () => {
254
- zipFile.close();
255
- reject(new Error(`'${fileName}' not found in zip file`));
256
- }).on("error", (error2) => {
257
- zipFile.close();
258
- reject(error2);
259
- });
260
- zipFile.readEntry();
261
- });
262
- });
263
- }
264
-
265
- // src/cli/DeployCommand/DeployCommand.ts
266
- var debug2 = Debug2("cli:deploy");
267
- var DeployCommand = class extends Command2 {
268
- static paths = [["deploy"]];
269
- apiKey = Option2.String("--api-key", {
270
- required: false,
271
- description: "\uC54C\uD30C \uBC30\uD3EC\uB97C \uC704\uD55C API \uD0A4"
272
- });
273
- baseUrl = Option2.String("--base-url", {
274
- description: "API Base URL"
275
- });
276
- async execute() {
277
- const baseUrl = this.baseUrl;
278
- const apiKey = this.apiKey || await p.password({
279
- message: "\uC571\uC778\uD1A0\uC2A4 \uBC30\uD3EC API \uD0A4\uB97C \uC785\uB825\uD574\uC8FC\uC138\uC694",
280
- validate: (value) => {
281
- if (value.length === 0) {
282
- return "API \uD0A4\uB294 \uD544\uC218 \uC785\uB825 \uD56D\uBAA9\uC785\uB2C8\uB2E4.";
283
- }
284
- return;
285
- }
286
- });
287
- if (p.isCancel(apiKey)) {
288
- return;
289
- }
290
- try {
291
- const deploymentId = generateDeploymentId2();
292
- const artifactOutfile = await build({
293
- distDirname: DEFAULT_DIST_DIR,
294
- cache: false,
295
- deploymentId
296
- });
297
- const rootDir = process.cwd();
298
- const resolvedArtifactPath = path2.resolve(rootDir, artifactOutfile);
299
- const appIdentifier = await readZipContent(resolvedArtifactPath, APP_MANIFEST_NAME).then((rawAppManifest) => {
300
- const appManifest = JSON.parse(rawAppManifest);
301
- const appIdentifier2 = appManifest.appName;
302
- assert(typeof appIdentifier2 === "string", "invalid appName");
303
- return appIdentifier2;
304
- }).catch((error) => {
305
- debug2("invalid ait file", error);
306
- throw new Error("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 ait \uD30C\uC77C\uC785\uB2C8\uB2E4");
307
- });
308
- const colorAppName = picocolors2.underline(picocolors2.cyan(appIdentifier));
309
- await p.tasks([
310
- {
311
- title: `${colorAppName} \uC571 \uBC30\uD3EC \uC911...`,
312
- task: async () => {
313
- await uploadArtifact({
314
- artifactPath: resolvedArtifactPath,
315
- appName: appIdentifier,
316
- deploymentId,
317
- apiKey,
318
- baseUrl
319
- });
320
- return `${colorAppName} \uBC30\uD3EC\uAC00 \uC644\uB8CC\uB418\uC5C8\uC5B4\uC694`;
321
- }
322
- }
323
- ]);
324
- p.note(picocolors2.underline(picocolors2.green(`intoss-sandbox://${appIdentifier}?_deploymentId=${deploymentId}`)));
325
- } catch (error) {
326
- if (error instanceof Error) {
327
- p.log.error(error.message);
328
- } else {
329
- console.error(error);
330
- }
331
- process.exit(1);
332
- }
333
- }
334
- };
335
-
336
- // src/cli/DevCommand/DevCommand.ts
337
- import fs4 from "fs";
338
- import path4 from "path";
339
- import { createServePermissionsMiddleware } from "@apps-in-toss/framework/cli-presets";
340
- import * as mpack2 from "@react-native-bedrock/mpack-next";
341
- import { Command as Command3, Option as Option3 } from "clipanion";
342
- import { execa as execa2 } from "execa";
343
- import presets2 from "react-native-bedrock/presets";
344
-
345
- // src/cli/utils/getPackageRoot.ts
346
- import fs3 from "fs";
347
- import path3 from "path";
348
- function getPackageRoot() {
349
- let cwd = process.cwd();
350
- const root = path3.parse(cwd).root;
351
- while (cwd !== root) {
352
- if (fs3.existsSync(path3.join(cwd, "package.json"))) {
353
- return cwd;
354
- }
355
- cwd = path3.dirname(cwd);
356
- }
357
- return cwd;
358
- }
359
-
360
- // src/cli/DevCommand/DevCommand.ts
361
- var DevCommand = class extends Command3 {
362
- static paths = [[`dev`]];
363
- static usage = Command3.Usage({
364
- category: "Development",
365
- description: "AppsInToss \uAC1C\uBC1C \uC11C\uBC84\uB97C \uC2E4\uD589\uD569\uB2C8\uB2E4",
366
- examples: [["\uAC1C\uBC1C \uC11C\uBC84 \uC2E4\uD589\uD558\uAE30", "ait dev"]]
367
- });
368
- host = Option3.String("--host");
369
- port = Option3.String("--port");
370
- async execute() {
371
- const config = await loadConfig();
372
- const serverOptions = {
373
- host: this.host,
374
- port: this.port ? parseInt(this.port, 10) : void 0
375
- };
376
- const packageRoot = getPackageRoot();
377
- const cwd = path4.resolve(__dirname, "..", "react-native");
378
- const projectRootTmp = path4.resolve(process.cwd(), ".bedrock");
379
- const appsInTossSpecificMiddlewares = [await createServePermissionsMiddleware(packageRoot)];
380
- await fs4.promises.mkdir(projectRootTmp, { recursive: true });
381
- await fs4.promises.writeFile(
382
- path4.join(projectRootTmp, "metadata.json"),
383
- JSON.stringify({ appName: config.appName, webPort: config.web.port })
384
- );
385
- const appName = config.appName;
386
- await mpack2.runServer({
387
- host: serverOptions.host,
388
- port: serverOptions.port,
389
- middlewares: appsInTossSpecificMiddlewares,
390
- enableEmbeddedReactDevTools: true,
391
- enableRouterGen: false,
392
- onServerReady: async () => {
393
- this.context.stdout.write(
394
- `Server is running on http://${serverOptions.host || DEFAULT_HOST}:${serverOptions.port || DEFAULT_LOCALHOST_PORT}
395
- `
396
- );
397
- const { packageManager } = getPackageManager({ isExecutor: true });
398
- await execa2(packageManager, config.web.commands.dev.split(" "), {
399
- cwd: process.cwd(),
400
- stdio: "inherit"
401
- });
402
- },
403
- cwd,
404
- config: {
405
- appName,
406
- services: {
407
- sentry: {
408
- enabled: false
409
- }
410
- },
411
- devServer: {
412
- presets: [presets2.service()],
413
- build: {
414
- entry: "./src/_app.tsx"
415
- }
416
- },
417
- tasks: []
418
- }
419
- });
420
- }
421
- };
422
-
423
- // src/cli/InitCommand/InitCommand.ts
424
- import fs5 from "fs";
425
- import path5 from "path";
426
- import * as p2 from "@clack/prompts";
427
- import { Command as Command4 } from "clipanion";
428
- import { kebabCase, merge } from "es-toolkit";
429
- import { execa as execa3 } from "execa";
430
- import yaml from "yaml";
431
-
432
- // src/cli/InitCommand/templates/index.tsx
433
- var CONFIG_TEMPLATE = `import { defineConfig } from '@apps-in-toss/web-framework/config';
434
-
435
- export default defineConfig({
436
- appName: '%%appName%%',
437
- web: {
438
- port: %%webPort%%,
439
- commands: {
440
- dev: '%%webDevCommand%%',
441
- build: '%%webBuildCommand%%',
442
- },
443
- },
444
- });
445
- `;
446
-
447
- // src/cli/utils/transformTemplate.ts
448
- function transformTemplate(templateString, values) {
449
- let result = templateString;
450
- for (const key in values) {
451
- const placeholder = `%%${key}%%`;
452
- result = result.replace(new RegExp(placeholder, "g"), values[key]);
453
- }
454
- return result;
455
- }
456
-
457
- // src/cli/InitCommand/InitCommand.ts
458
- async function getPnpRoot() {
459
- try {
460
- const pnpapi = (await import.meta.resolve("pnpapi")).replace("file://", "");
461
- return path5.dirname(pnpapi);
462
- } catch {
463
- return null;
464
- }
465
- }
466
- var InitCommand = class extends Command4 {
467
- static paths = [[`init`]];
468
- async execute() {
469
- const cwd = getPackageRoot();
470
- p2.intro("\u{1F680} \uC571 \uCD08\uAE30\uD654\uB97C \uC2DC\uC791\uD569\uB2C8\uB2E4");
471
- const appName = await p2.text({
472
- message: "Enter app name",
473
- validate: (value) => {
474
- if (!value) {
475
- return "\uC571 \uC774\uB984\uC744 \uC785\uB825\uD574\uC8FC\uC138\uC694";
476
- }
477
- const kebabCaseValue = kebabCase(value);
478
- if (value !== kebabCaseValue) {
479
- return `\uC571 \uC774\uB984\uC740 \uCF00\uBC25-\uCF00\uC774\uC2A4 \uD615\uC2DD\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4 (\uC608\uC2DC: ${kebabCaseValue})`;
480
- }
481
- return;
482
- }
483
- });
484
- if (p2.isCancel(appName)) {
485
- p2.cancel("\uCD08\uAE30\uD654\uAC00 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4");
486
- return;
487
- }
488
- p2.log.step(`\uC571 \uC774\uB984\uC774 '${appName}'\uC73C\uB85C \uC124\uC815\uB418\uC5C8\uC2B5\uB2C8\uB2E4`);
489
- const webPort = await p2.text({
490
- message: "Enter web port",
491
- placeholder: "5173",
492
- defaultValue: "5173"
493
- });
494
- if (p2.isCancel(webPort)) {
495
- p2.cancel("\uCD08\uAE30\uD654\uAC00 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4");
496
- return;
497
- }
498
- p2.log.step("package.json \uC2A4\uD06C\uB9BD\uD2B8\uB97C \uC124\uC815\uD558\uB294 \uC911...");
499
- const packageJson = await fs5.promises.readFile(path5.join(cwd, "package.json"), {
500
- encoding: "utf-8"
501
- });
502
- const scripts = JSON.parse(packageJson);
503
- const original = {
504
- dev: scripts?.scripts?.dev || scripts?.scripts?.start,
505
- build: scripts?.scripts?.build
506
- };
507
- scripts.scripts.dev = "ait dev";
508
- scripts.scripts.build = "ait build";
509
- scripts.scripts.deploy = "ait deploy";
510
- await fs5.promises.writeFile(path5.join(cwd, "package.json"), JSON.stringify(scripts, null, 2), {
511
- encoding: "utf-8"
512
- });
513
- p2.log.step("apps-in-toss.config.web.ts \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uB294 \uC911...");
514
- const config = transformTemplate(CONFIG_TEMPLATE, {
515
- appName,
516
- webPort,
517
- webDevCommand: original.dev === "ait dev" ? "" : original.dev,
518
- webBuildCommand: original.build === "ait build" ? "" : original.build
519
- });
520
- await fs5.promises.writeFile(path5.join(cwd, "apps-in-toss.config.web.ts"), config, {
521
- encoding: "utf-8"
522
- });
523
- p2.log.step(".gitignore \uD30C\uC77C\uC744 \uC5C5\uB370\uC774\uD2B8\uD558\uB294 \uC911...");
524
- await fs5.promises.appendFile(path5.join(cwd, ".gitignore"), "\n.bedrock\n");
525
- p2.log.step("app.json \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uB294 \uC911...");
526
- await fs5.promises.writeFile(
527
- path5.join(cwd, "app.json"),
528
- JSON.stringify({
529
- clientId: "",
530
- appName,
531
- permissions: []
532
- }),
533
- {
534
- encoding: "utf-8"
535
- }
536
- );
537
- const pnpRoot = await getPnpRoot();
538
- if (pnpRoot) {
539
- const yarnrcPath = path5.join(pnpRoot, ".yarnrc.yml");
540
- let yarnrc = {};
541
- try {
542
- const yarnrcContent = await fs5.promises.readFile(yarnrcPath, { encoding: "utf-8" });
543
- yarnrc = yaml.parse(yarnrcContent);
544
- } catch {
545
- p2.log.info(".yarnrc.yml \uD30C\uC77C\uC774 \uC5C6\uC5B4 \uC0C8\uB85C \uC0DD\uC131\uD569\uB2C8\uB2E4.");
546
- }
547
- p2.log.step(".yarnrc.yml \uD30C\uC77C\uC744 \uC5C5\uB370\uC774\uD2B8\uD558\uB294 \uC911...");
548
- yarnrc = merge(yarnrc, {
549
- packageExtensions: {
550
- "@react-native-community/cli-debugger-ui@*": {
551
- dependencies: {
552
- "@babel/runtime": "^7"
553
- }
554
- },
555
- "react-native-video@*": {
556
- peerDependencies: {
557
- react: "*",
558
- "react-native": "*"
559
- }
560
- },
561
- "react-native-fast-image@*": {
562
- dependencies: {
563
- "@babel/runtime": "^7"
564
- }
565
- }
566
- }
567
- });
568
- await fs5.promises.writeFile(yarnrcPath, yaml.stringify(yarnrc), { encoding: "utf-8" });
569
- await execa3("yarn", ["install"], {
570
- cwd,
571
- stdio: "inherit"
572
- });
573
- }
574
- p2.outro("\u2728 \uCD08\uAE30\uD654\uAC00 \uC644\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4!");
575
- }
576
- };
577
-
578
- // package.json
579
- var version = "0.1.6-next.6";
580
-
581
- // src/cli/index.ts
582
- var cli = new Cli({
583
- binaryLabel: "apps-in-toss",
584
- binaryName: "apps-in-toss",
585
- binaryVersion: version,
586
- enableCapture: true
587
- });
588
- cli.register(InitCommand);
589
- cli.register(DevCommand);
590
- cli.register(BuildCommand);
591
- cli.register(DeployCommand);
592
- cli.runExit(process.argv.slice(2));
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
package/dist/index.cjs DELETED
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
-
16
- // src/index.ts
17
- var src_exports = {};
18
- module.exports = __toCommonJS(src_exports);
package/dist/index.d.cts DELETED
@@ -1,2 +0,0 @@
1
-
2
- export { }
package/dist/index.js DELETED
@@ -1 +0,0 @@
1
- export const createEvents=()=>({emit(event,args){for(let callbacks=this.events[event]||[],i=0,length=callbacks.length;i<length;i++){callbacks[i](args)}},events:{},on(event,cb){var _this_events,_event;((_this_events=this.events)[_event=event]||(_this_events[_event]=[])).push(cb);return()=>{var _this_events_event;this.events[event]=(_this_events_event=this.events[event])===null||_this_events_event===void 0?void 0:_this_events_event.filter(i=>cb!==i)}}});const createEventId=()=>Math.random().toString(36).substring(2,15);const deserializeError=value=>{if(value&&value.__isError){const err=new Error(value.message);err.name=value.name;err.stack=value.stack;return err}return value};window.__BEDROCK_NATIVE_EMITTER=createEvents();export function closeView(){if(!window.ReactNativeWebView){throw new Error("This closeView is not available in browser environment")}if("closeView"in window.__CONSTANT_HANDLER_MAP){return window.__CONSTANT_HANDLER_MAP["closeView"]}throw new Error("closeView is not a constant handler")}export function generateHapticFeedback(){if(!window.ReactNativeWebView){throw new Error("This generateHapticFeedback is not available in browser environment")}if("generateHapticFeedback"in window.__CONSTANT_HANDLER_MAP){return window.__CONSTANT_HANDLER_MAP["generateHapticFeedback"]}throw new Error("generateHapticFeedback is not a constant handler")}export function share(){if(!window.ReactNativeWebView){throw new Error("This share is not available in browser environment")}if("share"in window.__CONSTANT_HANDLER_MAP){return window.__CONSTANT_HANDLER_MAP["share"]}throw new Error("share is not a constant handler")}export function setSecureScreen(){if(!window.ReactNativeWebView){throw new Error("This setSecureScreen is not available in browser environment")}if("setSecureScreen"in window.__CONSTANT_HANDLER_MAP){return window.__CONSTANT_HANDLER_MAP["setSecureScreen"]}throw new Error("setSecureScreen is not a constant handler")}export function setScreenAwakeMode(){if(!window.ReactNativeWebView){throw new Error("This setScreenAwakeMode is not available in browser environment")}if("setScreenAwakeMode"in window.__CONSTANT_HANDLER_MAP){return window.__CONSTANT_HANDLER_MAP["setScreenAwakeMode"]}throw new Error("setScreenAwakeMode is not a constant handler")}export function getNetworkStatus(){if(!window.ReactNativeWebView){throw new Error("This getNetworkStatus is not available in browser environment")}if("getNetworkStatus"in window.__CONSTANT_HANDLER_MAP){return window.__CONSTANT_HANDLER_MAP["getNetworkStatus"]}throw new Error("getNetworkStatus is not a constant handler")}export function getLocale(){if(!window.ReactNativeWebView){throw new Error("This getLocale is not available in browser environment")}if("getLocale"in window.__CONSTANT_HANDLER_MAP){return window.__CONSTANT_HANDLER_MAP["getLocale"]}throw new Error("getLocale is not a constant handler")}export function getSchemeUri(){if(!window.ReactNativeWebView){throw new Error("This getSchemeUri is not available in browser environment")}if("getSchemeUri"in window.__CONSTANT_HANDLER_MAP){return window.__CONSTANT_HANDLER_MAP["getSchemeUri"]}throw new Error("getSchemeUri is not a constant handler")}export function getDeviceId(){if(!window.ReactNativeWebView){throw new Error("This getDeviceId is not available in browser environment")}if("getDeviceId"in window.__CONSTANT_HANDLER_MAP){return window.__CONSTANT_HANDLER_MAP["getDeviceId"]}throw new Error("getDeviceId is not a constant handler")}export function setClipboardText(...args){if(!window.ReactNativeWebView){throw new Error("This setClipboardText is not available in browser environment")}const eventId=createEventId();const emitters=[];const unsubscribe=()=>{for(const emitter of emitters){emitter()}};return new Promise((resolve,reject)=>{emitters.push(window.__BEDROCK_NATIVE_EMITTER.on(`setClipboardText/resolve/${eventId}`,args=>{unsubscribe();resolve(args)}));emitters.push(window.__BEDROCK_NATIVE_EMITTER.on(`setClipboardText/reject/${eventId}`,error=>{unsubscribe();reject(deserializeError(error))}));window.ReactNativeWebView.postMessage(JSON.stringify({type:"method",functionName:"setClipboardText",eventId,args}))})}export function getClipboardText(...args){if(!window.ReactNativeWebView){throw new Error("This getClipboardText is not available in browser environment")}const eventId=createEventId();const emitters=[];const unsubscribe=()=>{for(const emitter of emitters){emitter()}};return new Promise((resolve,reject)=>{emitters.push(window.__BEDROCK_NATIVE_EMITTER.on(`getClipboardText/resolve/${eventId}`,args=>{unsubscribe();resolve(args)}));emitters.push(window.__BEDROCK_NATIVE_EMITTER.on(`getClipboardText/reject/${eventId}`,error=>{unsubscribe();reject(deserializeError(error))}));window.ReactNativeWebView.postMessage(JSON.stringify({type:"method",functionName:"getClipboardText",eventId,args}))})}export function fetchContacts(...args){if(!window.ReactNativeWebView){throw new Error("This fetchContacts is not available in browser environment")}const eventId=createEventId();const emitters=[];const unsubscribe=()=>{for(const emitter of emitters){emitter()}};return new Promise((resolve,reject)=>{emitters.push(window.__BEDROCK_NATIVE_EMITTER.on(`fetchContacts/resolve/${eventId}`,args=>{unsubscribe();resolve(args)}));emitters.push(window.__BEDROCK_NATIVE_EMITTER.on(`fetchContacts/reject/${eventId}`,error=>{unsubscribe();reject(deserializeError(error))}));window.ReactNativeWebView.postMessage(JSON.stringify({type:"method",functionName:"fetchContacts",eventId,args}))})}export function fetchAlbumPhotos(...args){if(!window.ReactNativeWebView){throw new Error("This fetchAlbumPhotos is not available in browser environment")}const eventId=createEventId();const emitters=[];const unsubscribe=()=>{for(const emitter of emitters){emitter()}};return new Promise((resolve,reject)=>{emitters.push(window.__BEDROCK_NATIVE_EMITTER.on(`fetchAlbumPhotos/resolve/${eventId}`,args=>{unsubscribe();resolve(args)}));emitters.push(window.__BEDROCK_NATIVE_EMITTER.on(`fetchAlbumPhotos/reject/${eventId}`,error=>{unsubscribe();reject(deserializeError(error))}));window.ReactNativeWebView.postMessage(JSON.stringify({type:"method",functionName:"fetchAlbumPhotos",eventId,args}))})}export var Accuracy=function(Accuracy){Accuracy[Accuracy["Lowest"]=1]="Lowest";Accuracy[Accuracy["Low"]=2]="Low";Accuracy[Accuracy["Balanced"]=3]="Balanced";Accuracy[Accuracy["High"]=4]="High";Accuracy[Accuracy["Highest"]=5]="Highest";Accuracy[Accuracy["BestForNavigation"]=6]="BestForNavigation";return Accuracy}({});export function getCurrentLocation(...args){if(!window.ReactNativeWebView){throw new Error("This getCurrentLocation is not available in browser environment")}const eventId=createEventId();const emitters=[];const unsubscribe=()=>{for(const emitter of emitters){emitter()}};return new Promise((resolve,reject)=>{emitters.push(window.__BEDROCK_NATIVE_EMITTER.on(`getCurrentLocation/resolve/${eventId}`,args=>{unsubscribe();resolve(args)}));emitters.push(window.__BEDROCK_NATIVE_EMITTER.on(`getCurrentLocation/reject/${eventId}`,error=>{unsubscribe();reject(deserializeError(error))}));window.ReactNativeWebView.postMessage(JSON.stringify({type:"method",functionName:"getCurrentLocation",eventId,args}))})}export function openCamera(...args){if(!window.ReactNativeWebView){throw new Error("This openCamera is not available in browser environment")}const eventId=createEventId();const emitters=[];const unsubscribe=()=>{for(const emitter of emitters){emitter()}};return new Promise((resolve,reject)=>{emitters.push(window.__BEDROCK_NATIVE_EMITTER.on(`openCamera/resolve/${eventId}`,args=>{unsubscribe();resolve(args)}));emitters.push(window.__BEDROCK_NATIVE_EMITTER.on(`openCamera/reject/${eventId}`,error=>{unsubscribe();reject(deserializeError(error))}));window.ReactNativeWebView.postMessage(JSON.stringify({type:"method",functionName:"openCamera",eventId,args}))})}export function startUpdateLocation({onEvent,onError,options}){if(!window.ReactNativeWebView){onError(new Error("This startUpdateLocation is not available in browser environment"));return()=>{}}const eventId=createEventId();const removes=[window.__BEDROCK_NATIVE_EMITTER.on(`startUpdateLocation/onEvent/${eventId}`,response=>{onEvent(response)}),window.__BEDROCK_NATIVE_EMITTER.on(`startUpdateLocation/onError/${eventId}`,error=>{onError(deserializeError(error))})];window.ReactNativeWebView.postMessage(JSON.stringify({type:"addEventListener",functionName:"startUpdateLocation",eventId,args:options}));return()=>{window.ReactNativeWebView.postMessage(JSON.stringify({type:"removeEventListener",functionName:"startUpdateLocation",eventId}));for(const remove of removes){remove()}}}