expo-http-server 0.1.11 → 0.1.13
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/android/build.gradle +24 -67
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -1
package/android/build.gradle
CHANGED
|
@@ -1,85 +1,43 @@
|
|
|
1
1
|
apply plugin: 'com.android.library'
|
|
2
|
-
apply plugin: 'kotlin-android'
|
|
3
|
-
apply plugin: 'maven-publish'
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
ext.kotlinVersion()
|
|
24
|
-
} else {
|
|
25
|
-
ext.safeExtGet("kotlinVersion", "1.8.10")
|
|
3
|
+
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
4
|
+
|
|
5
|
+
apply from: expoModulesCorePlugin
|
|
6
|
+
applyKotlinExpoModulesCorePlugin()
|
|
7
|
+
useCoreDependencies()
|
|
8
|
+
useExpoPublishing()
|
|
9
|
+
|
|
10
|
+
// If you want to use the managed Android SDK versions from expo-modules-core, set this to true.
|
|
11
|
+
// The Android SDK versions will be bumped from time to time in SDK releases and may introduce breaking changes in your module code.
|
|
12
|
+
// Most of the time, you may like to manage the Android SDK versions yourself.
|
|
13
|
+
def useManagedAndroidSdkVersions = true
|
|
14
|
+
if (useManagedAndroidSdkVersions) {
|
|
15
|
+
useDefaultAndroidSdkVersions()
|
|
16
|
+
} else {
|
|
17
|
+
buildscript {
|
|
18
|
+
// Simple helper that allows the root project to override versions declared by this library.
|
|
19
|
+
ext.safeExtGet = { prop, fallback ->
|
|
20
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
26
21
|
}
|
|
27
22
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
dependencies {
|
|
34
|
-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}")
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
afterEvaluate {
|
|
39
|
-
publishing {
|
|
40
|
-
publications {
|
|
41
|
-
release(MavenPublication) {
|
|
42
|
-
from components.release
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
repositories {
|
|
46
|
-
maven {
|
|
47
|
-
url = mavenLocal().url
|
|
48
|
-
}
|
|
23
|
+
project.android {
|
|
24
|
+
compileSdkVersion safeExtGet("compileSdkVersion", 34)
|
|
25
|
+
defaultConfig {
|
|
26
|
+
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
27
|
+
targetSdkVersion safeExtGet("targetSdkVersion", 34)
|
|
49
28
|
}
|
|
50
29
|
}
|
|
51
30
|
}
|
|
52
31
|
|
|
53
32
|
android {
|
|
54
|
-
compileSdkVersion safeExtGet("compileSdkVersion", 33)
|
|
55
|
-
|
|
56
|
-
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
|
|
57
|
-
if (agpVersion.tokenize('.')[0].toInteger() < 8) {
|
|
58
|
-
compileOptions {
|
|
59
|
-
sourceCompatibility JavaVersion.VERSION_11
|
|
60
|
-
targetCompatibility JavaVersion.VERSION_11
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
kotlinOptions {
|
|
64
|
-
jvmTarget = JavaVersion.VERSION_11.majorVersion
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
33
|
namespace "expo.modules.httpserver"
|
|
69
34
|
defaultConfig {
|
|
70
|
-
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
71
|
-
targetSdkVersion safeExtGet("targetSdkVersion", 34)
|
|
72
35
|
versionCode 1
|
|
73
36
|
versionName "0.1.0"
|
|
74
37
|
}
|
|
75
38
|
lintOptions {
|
|
76
39
|
abortOnError false
|
|
77
40
|
}
|
|
78
|
-
publishing {
|
|
79
|
-
singleVariant("release") {
|
|
80
|
-
withSourcesJar()
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
41
|
}
|
|
84
42
|
|
|
85
43
|
repositories {
|
|
@@ -88,7 +46,6 @@ repositories {
|
|
|
88
46
|
|
|
89
47
|
dependencies {
|
|
90
48
|
implementation project(':expo-modules-core')
|
|
91
|
-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
|
|
92
49
|
implementation 'com.github.fengzhizi715.AndroidServer:core:1.3.3'
|
|
93
50
|
implementation 'com.github.fengzhizi715.AndroidServer:gson:1.3.3'
|
|
94
|
-
}
|
|
51
|
+
}
|
package/build/index.d.ts
CHANGED
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,SAAS,CAAC;AACvE;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAE5E,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAA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;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,IAAY,EACZ,cAA6C,EAC7C,EAAE;IACF,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,CAAC,WAAW,CAAc,gBAAgB,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YACjE,cAAc,CAAC,KAAK,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;IACL,CAAC;IACD,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAG,GAAG,EAAE,CAAC,oBAAoB,CAAC,IAAI,EAAE,CAAC","sourcesContent":["import { EventEmitter } from \"expo-modules-core\";\n\nimport ExpoHttpServerModule from \"./ExpoHttpServerModule\";\n\nconst emitter = new EventEmitter(ExpoHttpServerModule);\nconst requestCallbacks: Callback[] = [];\n\nexport type HttpMethod = \"GET\" | \"POST\" | \"PUT\" | \"DELETE\";\n/**\n * PAUSED AND RESUMED are iOS only\n */\nexport type Status = \"STARTED\" | \"PAUSED\" | \"RESUMED\" | \"STOPPED\" | \"ERROR\";\n\nexport interface StatusEvent {\n status: Status;\n message: string;\n}\n\nexport interface RequestEvent {\n uuid: string;\n method: string;\n path: string;\n body: string;\n headersJson: string;\n paramsJson: string;\n cookiesJson: string;\n}\n\nexport interface Response {\n statusCode?: number;\n statusDescription?: string;\n contentType?: string;\n headers?: Record<string, string>;\n body?: string;\n}\n\nexport interface Callback {\n method: string;\n path: string;\n uuid: string;\n callback: (request: RequestEvent) => Promise<Response>;\n}\n\nexport const start = () => {\n emitter.addListener<RequestEvent>(\"onRequest\", async (event) => {\n const responseHandler = requestCallbacks.find((c) => c.uuid === event.uuid);\n if (!responseHandler) {\n ExpoHttpServerModule.respond(\n event.uuid,\n 404,\n \"Not Found\",\n \"application/json\",\n {},\n JSON.stringify({ error: \"Handler not found\" }),\n );\n return;\n }\n const response = await responseHandler.callback(event);\n ExpoHttpServerModule.respond(\n event.uuid,\n response.statusCode || 200,\n response.statusDescription || \"OK\",\n response.contentType || \"application/json\",\n response.headers || {},\n response.body || \"{}\",\n );\n });\n ExpoHttpServerModule.start();\n};\n\nexport const route = (\n path: string,\n method: HttpMethod,\n callback: (request: RequestEvent) => Promise<Response>,\n) => {\n const uuid = Math.random().toString(16).slice(2);\n requestCallbacks.push({\n method,\n path,\n uuid,\n callback,\n });\n ExpoHttpServerModule.route(path, method, uuid);\n};\n\nexport const setup = (\n port: number,\n onStatusUpdate?: (event: StatusEvent) => void,\n) => {\n if (onStatusUpdate) {\n emitter.addListener<StatusEvent>(\"onStatusUpdate\", async (event) => {\n onStatusUpdate(event);\n });\n }\n ExpoHttpServerModule.setup(port);\n};\n\nexport const stop = () => ExpoHttpServerModule.stop();\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAE1D,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,oBAAoB,CAAC,CAAC;AACvD,MAAM,gBAAgB,GAAe,EAAE,CAAC;AAsCxC,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,EAAE;IACxB,OAAO,CAAC,WAAW,CAAe,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QAC7D,MAAM,eAAe,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,CAAC,CAAC;QAC5E,IAAI,CAAC,eAAe,EAAE,CAAC;YACrB,oBAAoB,CAAC,OAAO,CAC1B,KAAK,CAAC,IAAI,EACV,GAAG,EACH,WAAW,EACX,kBAAkB,EAClB,EAAE,EACF,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,mBAAmB,EAAE,CAAC,CAC/C,CAAC;YACF,OAAO;QACT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\"expo-modules-core\";\n\nimport ExpoHttpServerModule from \"./ExpoHttpServerModule\";\n\nconst emitter = new EventEmitter(ExpoHttpServerModule);\nconst requestCallbacks: Callback[] = [];\n\nexport type HttpMethod = \"GET\" | \"POST\" | \"PUT\" | \"DELETE\" | \"OPTIONS\";\n/**\n * PAUSED AND RESUMED are iOS only\n */\nexport type Status = \"STARTED\" | \"PAUSED\" | \"RESUMED\" | \"STOPPED\" | \"ERROR\";\n\nexport interface StatusEvent {\n status: Status;\n message: string;\n}\n\nexport interface RequestEvent {\n uuid: string;\n method: string;\n path: string;\n body: string;\n headersJson: string;\n paramsJson: string;\n cookiesJson: string;\n}\n\nexport interface Response {\n statusCode?: number;\n statusDescription?: string;\n contentType?: string;\n headers?: Record<string, string>;\n body?: string;\n}\n\nexport interface Callback {\n method: string;\n path: string;\n uuid: string;\n callback: (request: RequestEvent) => Promise<Response>;\n}\n\nexport const start = () => {\n emitter.addListener<RequestEvent>(\"onRequest\", async (event) => {\n const responseHandler = requestCallbacks.find((c) => c.uuid === event.uuid);\n if (!responseHandler) {\n ExpoHttpServerModule.respond(\n event.uuid,\n 404,\n \"Not Found\",\n \"application/json\",\n {},\n JSON.stringify({ error: \"Handler not found\" }),\n );\n return;\n }\n const response = await responseHandler.callback(event);\n ExpoHttpServerModule.respond(\n event.uuid,\n response.statusCode || 200,\n response.statusDescription || \"OK\",\n response.contentType || \"application/json\",\n response.headers || {},\n response.body || \"{}\",\n );\n });\n ExpoHttpServerModule.start();\n};\n\nexport const route = (\n path: string,\n method: HttpMethod,\n callback: (request: RequestEvent) => Promise<Response>,\n) => {\n const uuid = Math.random().toString(16).slice(2);\n requestCallbacks.push({\n method,\n path,\n uuid,\n callback,\n });\n ExpoHttpServerModule.route(path, method, uuid);\n};\n\nexport const setup = (\n port: number,\n onStatusUpdate?: (event: StatusEvent) => void,\n) => {\n if (onStatusUpdate) {\n emitter.addListener<StatusEvent>(\"onStatusUpdate\", async (event) => {\n onStatusUpdate(event);\n });\n }\n ExpoHttpServerModule.setup(port);\n};\n\nexport const stop = () => ExpoHttpServerModule.stop();\n"]}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -5,7 +5,7 @@ import ExpoHttpServerModule from "./ExpoHttpServerModule";
|
|
|
5
5
|
const emitter = new EventEmitter(ExpoHttpServerModule);
|
|
6
6
|
const requestCallbacks: Callback[] = [];
|
|
7
7
|
|
|
8
|
-
export type HttpMethod = "GET" | "POST" | "PUT" | "DELETE";
|
|
8
|
+
export type HttpMethod = "GET" | "POST" | "PUT" | "DELETE" | "OPTIONS";
|
|
9
9
|
/**
|
|
10
10
|
* PAUSED AND RESUMED are iOS only
|
|
11
11
|
*/
|