@expo/cli 54.1.0-canary-20251008-6acbc1c → 54.1.0-canary-20251009-9919e08

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.
@@ -1,84 +0,0 @@
1
- /**
2
- * Copyright © 2025 650 Industries.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */ "use strict";
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- Object.defineProperty(exports, "InstallDevPackageMiddleware", {
11
- enumerable: true,
12
- get: function() {
13
- return InstallDevPackageMiddleware;
14
- }
15
- });
16
- const _ExpoMiddleware = require("./ExpoMiddleware");
17
- const _installAsync = require("../../../install/installAsync");
18
- const debug = require('debug')('expo:start:server:middleware:install');
19
- class InstallDevPackageMiddleware extends _ExpoMiddleware.ExpoMiddleware {
20
- constructor(projectRoot){
21
- super(projectRoot, [
22
- '/_expo/install-pkg'
23
- ]), this.projectRoot = projectRoot;
24
- }
25
- async parseRawBody(req) {
26
- const rawBody = await new Promise((resolve, reject)=>{
27
- let body = '';
28
- req.on('data', (chunk)=>{
29
- body += chunk.toString();
30
- });
31
- req.on('end', ()=>{
32
- resolve(body);
33
- });
34
- req.on('error', (err)=>{
35
- reject(err);
36
- });
37
- });
38
- const properties = JSON.parse(rawBody);
39
- this.assertPkgBody(properties);
40
- return properties;
41
- }
42
- assertPkgBody(body) {
43
- if (typeof body !== 'object' || body == null) {
44
- throw new Error('Expected object');
45
- }
46
- if (typeof body.pkg !== 'string') {
47
- throw new Error('Expected "pkg" in body to be string');
48
- }
49
- }
50
- async handleRequestAsync(req, res) {
51
- if (req.method !== 'POST') {
52
- res.statusCode = 405;
53
- res.end('Method Not Allowed');
54
- return;
55
- }
56
- let properties;
57
- try {
58
- properties = await this.parseRawBody(req);
59
- } catch (e) {
60
- debug('Error parsing request body', e);
61
- res.statusCode = 400;
62
- res.end('Bad Request');
63
- return;
64
- }
65
- debug(`Requested: %O`, properties);
66
- try {
67
- await (0, _installAsync.installAsync)([
68
- properties.pkg
69
- ], {
70
- projectRoot: this.projectRoot
71
- });
72
- } catch (e) {
73
- debug('Error writing file', e);
74
- res.statusCode = 500;
75
- res.end('Error writing file.');
76
- return;
77
- }
78
- debug(`File created`);
79
- res.statusCode = 200;
80
- res.end('OK');
81
- }
82
- }
83
-
84
- //# sourceMappingURL=InstallDevPackageMiddleware.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/start/server/middleware/InstallDevPackageMiddleware.ts"],"sourcesContent":["/**\n * Copyright © 2025 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { ExpoMiddleware } from './ExpoMiddleware';\nimport { ServerRequest, ServerResponse } from './server.types';\nimport { installAsync } from '../../../install/installAsync';\n\nconst debug = require('debug')('expo:start:server:middleware:install') as typeof console.log;\n\nexport type InstallDevPackageBody = {\n pkg: string;\n};\n\n/**\n * Middleware for installing packages in the project given a `POST` request with\n * `{ pkg: string }` in the body.\n */\nexport class InstallDevPackageMiddleware extends ExpoMiddleware {\n constructor(protected projectRoot: string) {\n super(projectRoot, ['/_expo/install-pkg']);\n }\n\n protected async parseRawBody(req: ServerRequest): Promise<InstallDevPackageBody> {\n const rawBody = await new Promise<string>((resolve, reject) => {\n let body = '';\n req.on('data', (chunk) => {\n body += chunk.toString();\n });\n req.on('end', () => {\n resolve(body);\n });\n req.on('error', (err) => {\n reject(err);\n });\n });\n\n const properties = JSON.parse(rawBody);\n this.assertPkgBody(properties);\n\n return properties;\n }\n\n private assertPkgBody(body: any): asserts body is InstallDevPackageBody {\n if (typeof body !== 'object' || body == null) {\n throw new Error('Expected object');\n }\n if (typeof body.pkg !== 'string') {\n throw new Error('Expected \"pkg\" in body to be string');\n }\n }\n\n async handleRequestAsync(req: ServerRequest, res: ServerResponse): Promise<void> {\n if (req.method !== 'POST') {\n res.statusCode = 405;\n res.end('Method Not Allowed');\n return;\n }\n\n let properties: InstallDevPackageBody;\n\n try {\n properties = await this.parseRawBody(req);\n } catch (e) {\n debug('Error parsing request body', e);\n res.statusCode = 400;\n res.end('Bad Request');\n return;\n }\n debug(`Requested: %O`, properties);\n\n try {\n await installAsync([properties.pkg], {\n projectRoot: this.projectRoot,\n });\n } catch (e) {\n debug('Error writing file', e);\n res.statusCode = 500;\n res.end('Error writing file.');\n return;\n }\n\n debug(`File created`);\n res.statusCode = 200;\n res.end('OK');\n }\n}\n"],"names":["InstallDevPackageMiddleware","debug","require","ExpoMiddleware","constructor","projectRoot","parseRawBody","req","rawBody","Promise","resolve","reject","body","on","chunk","toString","err","properties","JSON","parse","assertPkgBody","Error","pkg","handleRequestAsync","res","method","statusCode","end","e","installAsync"],"mappings":"AAAA;;;;;CAKC;;;;+BAgBYA;;;eAAAA;;;gCAdkB;8BAEF;AAE7B,MAAMC,QAAQC,QAAQ,SAAS;AAUxB,MAAMF,oCAAoCG,8BAAc;IAC7DC,YAAY,AAAUC,WAAmB,CAAE;QACzC,KAAK,CAACA,aAAa;YAAC;SAAqB,QADrBA,cAAAA;IAEtB;IAEA,MAAgBC,aAAaC,GAAkB,EAAkC;QAC/E,MAAMC,UAAU,MAAM,IAAIC,QAAgB,CAACC,SAASC;YAClD,IAAIC,OAAO;YACXL,IAAIM,EAAE,CAAC,QAAQ,CAACC;gBACdF,QAAQE,MAAMC,QAAQ;YACxB;YACAR,IAAIM,EAAE,CAAC,OAAO;gBACZH,QAAQE;YACV;YACAL,IAAIM,EAAE,CAAC,SAAS,CAACG;gBACfL,OAAOK;YACT;QACF;QAEA,MAAMC,aAAaC,KAAKC,KAAK,CAACX;QAC9B,IAAI,CAACY,aAAa,CAACH;QAEnB,OAAOA;IACT;IAEQG,cAAcR,IAAS,EAAyC;QACtE,IAAI,OAAOA,SAAS,YAAYA,QAAQ,MAAM;YAC5C,MAAM,IAAIS,MAAM;QAClB;QACA,IAAI,OAAOT,KAAKU,GAAG,KAAK,UAAU;YAChC,MAAM,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