@platformatic/basic 2.0.0-alpha.3 → 2.0.0-alpha.4
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/config.d.ts +159 -0
- package/eslint.config.js +3 -1
- package/index.js +15 -2
- package/lib/base.js +7 -5
- package/lib/errors.js +8 -0
- package/lib/next.js +105 -0
- package/lib/schema.js +23 -0
- package/lib/server.js +8 -9
- package/lib/utils.js +5 -34
- package/lib/vite.js +105 -0
- package/lib/worker/child-manager.js +78 -0
- package/lib/worker/child-process.js +84 -0
- package/lib/worker/next-loader.js +137 -0
- package/lib/worker/server-listener.js +29 -0
- package/package.json +22 -8
- package/schema.json +522 -0
- package/test/express.test.js +9 -9
- package/test/fastify.test.js +9 -9
- package/test/fixtures/next/composer-autodetect-prefix/next.config.mjs +5 -0
- package/test/fixtures/next/composer-autodetect-prefix/package.json +15 -0
- package/test/fixtures/next/composer-autodetect-prefix/platformatic.application.json +8 -0
- package/test/fixtures/next/composer-autodetect-prefix/platformatic.runtime.json +21 -0
- package/test/fixtures/next/composer-autodetect-prefix/src/app/layout.js +7 -0
- package/test/fixtures/next/composer-autodetect-prefix/src/app/page.js +5 -0
- package/test/fixtures/next/composer-with-prefix/next.config.js +1 -0
- package/test/fixtures/next/composer-with-prefix/package.json +15 -0
- package/test/fixtures/next/composer-with-prefix/platformatic.application.json +11 -0
- package/test/fixtures/next/composer-with-prefix/platformatic.runtime.json +21 -0
- package/test/fixtures/next/composer-with-prefix/src/app/layout.js +7 -0
- package/test/fixtures/next/composer-with-prefix/src/app/page.js +5 -0
- package/test/fixtures/next/composer-without-prefix/next.config.mjs +3 -0
- package/test/fixtures/next/composer-without-prefix/package.json +15 -0
- package/test/fixtures/next/composer-without-prefix/platformatic.application.json +8 -0
- package/test/fixtures/next/composer-without-prefix/platformatic.runtime.json +21 -0
- package/test/fixtures/next/composer-without-prefix/src/app/layout.js +7 -0
- package/test/fixtures/next/composer-without-prefix/src/app/page.js +5 -0
- package/test/fixtures/next/standalone/next.config.mjs +3 -0
- package/test/fixtures/next/standalone/package.json +15 -0
- package/test/fixtures/next/standalone/platformatic.runtime.json +18 -0
- package/test/fixtures/next/standalone/src/app/layout.js +7 -0
- package/test/fixtures/next/standalone/src/app/page.js +5 -0
- package/test/fixtures/platformatic-composer/platformatic.composer.json +20 -0
- package/test/fixtures/platformatic-composer/platformatic.no-prefix.composer.json +23 -0
- package/test/fixtures/platformatic-composer/plugin.js +9 -0
- package/test/fixtures/vite/composer-autodetect-prefix/custom.vite.config.js +3 -0
- package/test/fixtures/vite/composer-autodetect-prefix/index.html +13 -0
- package/test/fixtures/vite/composer-autodetect-prefix/main.js +3 -0
- package/test/fixtures/vite/composer-autodetect-prefix/package.json +14 -0
- package/test/fixtures/vite/composer-autodetect-prefix/platformatic.application.json +11 -0
- package/test/fixtures/vite/composer-autodetect-prefix/platformatic.runtime.json +21 -0
- package/test/fixtures/vite/composer-with-prefix/index.html +13 -0
- package/test/fixtures/vite/composer-with-prefix/main.js +3 -0
- package/test/fixtures/vite/composer-with-prefix/package.json +14 -0
- package/test/fixtures/vite/composer-with-prefix/platformatic.application.json +11 -0
- package/test/fixtures/vite/composer-with-prefix/platformatic.runtime.json +21 -0
- package/test/fixtures/vite/composer-without-prefix/index.html +13 -0
- package/test/fixtures/vite/composer-without-prefix/main.js +3 -0
- package/test/fixtures/vite/composer-without-prefix/package.json +14 -0
- package/test/fixtures/vite/composer-without-prefix/platformatic.application.json +8 -0
- package/test/fixtures/vite/composer-without-prefix/platformatic.runtime.json +21 -0
- package/test/fixtures/vite/standalone/custom.vite.config.js +3 -0
- package/test/fixtures/vite/standalone/index.html +13 -0
- package/test/fixtures/vite/standalone/main.js +3 -0
- package/test/fixtures/vite/standalone/package.json +14 -0
- package/test/fixtures/vite/standalone/platformatic.runtime.json +18 -0
- package/test/helper.js +85 -14
- package/test/next.test.js +85 -0
- package/test/node.test.js +13 -13
- package/test/vite.test.js +89 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "next",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "next dev",
|
|
7
|
+
"build": "next build",
|
|
8
|
+
"start": "next start"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"react": "^18.0.0",
|
|
12
|
+
"react-dom": "^18.0.0",
|
|
13
|
+
"next": "^14.2.5"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
|
|
3
|
+
"entrypoint": "main",
|
|
4
|
+
"watch": false,
|
|
5
|
+
"managementApi": false,
|
|
6
|
+
"metrics": false,
|
|
7
|
+
"server": {
|
|
8
|
+
"logger": {
|
|
9
|
+
"level": "error"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"services": [
|
|
13
|
+
{
|
|
14
|
+
"id": "frontend",
|
|
15
|
+
"path": ".",
|
|
16
|
+
"config": "platformatic.application.json"
|
|
17
|
+
},
|
|
18
|
+
{ "id": "service", "config": "platformatic.service.json", "path": "../../platformatic-service" },
|
|
19
|
+
{ "id": "main", "config": "platformatic.composer.json", "path": "../../platformatic-composer" }
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "next",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "next dev",
|
|
7
|
+
"build": "next build",
|
|
8
|
+
"start": "next start"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"react": "^18.0.0",
|
|
12
|
+
"react-dom": "^18.0.0",
|
|
13
|
+
"next": "^14.2.5"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
|
|
3
|
+
"entrypoint": "main",
|
|
4
|
+
"watch": false,
|
|
5
|
+
"managementApi": false,
|
|
6
|
+
"metrics": false,
|
|
7
|
+
"server": {
|
|
8
|
+
"logger": {
|
|
9
|
+
"level": "error"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"services": [
|
|
13
|
+
{
|
|
14
|
+
"id": "frontend",
|
|
15
|
+
"path": ".",
|
|
16
|
+
"config": "platformatic.application.json"
|
|
17
|
+
},
|
|
18
|
+
{ "id": "service", "config": "platformatic.service.json", "path": "../../platformatic-service" },
|
|
19
|
+
{ "id": "main", "config": "platformatic.no-prefix.composer.json", "path": "../../platformatic-composer" }
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "next",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "next dev",
|
|
7
|
+
"build": "next build",
|
|
8
|
+
"start": "next start"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"react": "^18.0.0",
|
|
12
|
+
"react-dom": "^18.0.0",
|
|
13
|
+
"next": "^14.2.5"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
|
|
3
|
+
"entrypoint": "main",
|
|
4
|
+
"watch": false,
|
|
5
|
+
"managementApi": false,
|
|
6
|
+
"metrics": false,
|
|
7
|
+
"server": {
|
|
8
|
+
"logger": {
|
|
9
|
+
"level": "error"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"services": [
|
|
13
|
+
{
|
|
14
|
+
"id": "main",
|
|
15
|
+
"path": "."
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://schemas.platformatic.dev/@platformatic/composer/1.52.0.json",
|
|
3
|
+
"composer": {
|
|
4
|
+
"services": [
|
|
5
|
+
{
|
|
6
|
+
"id": "frontend"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"id": "service"
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
"plugins": {
|
|
14
|
+
"paths": [
|
|
15
|
+
{
|
|
16
|
+
"path": "./plugin.js"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://schemas.platformatic.dev/@platformatic/composer/1.52.0.json",
|
|
3
|
+
"composer": {
|
|
4
|
+
"services": [
|
|
5
|
+
{
|
|
6
|
+
"id": "frontend",
|
|
7
|
+
"proxy": {
|
|
8
|
+
"prefix": ""
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"id": "service"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"plugins": {
|
|
17
|
+
"paths": [
|
|
18
|
+
{
|
|
19
|
+
"path": "./plugin.js"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Vite App</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<script type="module" src="/main.js"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
|
|
3
|
+
"entrypoint": "main",
|
|
4
|
+
"watch": false,
|
|
5
|
+
"managementApi": false,
|
|
6
|
+
"metrics": false,
|
|
7
|
+
"server": {
|
|
8
|
+
"logger": {
|
|
9
|
+
"level": "error"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"services": [
|
|
13
|
+
{
|
|
14
|
+
"id": "frontend",
|
|
15
|
+
"path": ".",
|
|
16
|
+
"config": "platformatic.application.json"
|
|
17
|
+
},
|
|
18
|
+
{ "id": "service", "config": "platformatic.service.json", "path": "../../platformatic-service" },
|
|
19
|
+
{ "id": "main", "config": "platformatic.no-prefix.composer.json", "path": "../../platformatic-composer" }
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Vite App</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<script type="module" src="/main.js"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
|
|
3
|
+
"entrypoint": "main",
|
|
4
|
+
"watch": false,
|
|
5
|
+
"managementApi": false,
|
|
6
|
+
"metrics": false,
|
|
7
|
+
"server": {
|
|
8
|
+
"logger": {
|
|
9
|
+
"level": "error"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"services": [
|
|
13
|
+
{
|
|
14
|
+
"id": "frontend",
|
|
15
|
+
"path": ".",
|
|
16
|
+
"config": "platformatic.application.json"
|
|
17
|
+
},
|
|
18
|
+
{ "id": "service", "config": "platformatic.service.json", "path": "../../platformatic-service" },
|
|
19
|
+
{ "id": "main", "config": "platformatic.composer.json", "path": "../../platformatic-composer" }
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Vite App</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<script type="module" src="/main.js"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
|
|
3
|
+
"entrypoint": "main",
|
|
4
|
+
"watch": false,
|
|
5
|
+
"managementApi": false,
|
|
6
|
+
"metrics": false,
|
|
7
|
+
"server": {
|
|
8
|
+
"logger": {
|
|
9
|
+
"level": "error"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"services": [
|
|
13
|
+
{
|
|
14
|
+
"id": "frontend",
|
|
15
|
+
"path": ".",
|
|
16
|
+
"config": "platformatic.application.json"
|
|
17
|
+
},
|
|
18
|
+
{ "id": "service", "config": "platformatic.service.json", "path": "../../platformatic-service" },
|
|
19
|
+
{ "id": "main", "config": "platformatic.no-prefix.composer.json", "path": "../../platformatic-composer" }
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Vite App</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<script type="module" src="/main.js"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
|
|
3
|
+
"entrypoint": "main",
|
|
4
|
+
"watch": false,
|
|
5
|
+
"managementApi": false,
|
|
6
|
+
"metrics": false,
|
|
7
|
+
"server": {
|
|
8
|
+
"logger": {
|
|
9
|
+
"level": "error"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"services": [
|
|
13
|
+
{
|
|
14
|
+
"id": "main",
|
|
15
|
+
"path": "."
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
package/test/helper.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { createDirectory, withResolvers } from '@platformatic/utils'
|
|
2
|
+
import { deepStrictEqual, ok, strictEqual } from 'node:assert'
|
|
3
|
+
import { writeFile } from 'node:fs/promises'
|
|
4
|
+
import { dirname, resolve } from 'node:path'
|
|
3
5
|
import { setTimeout as sleep } from 'node:timers/promises'
|
|
4
6
|
import { Client, request } from 'undici'
|
|
7
|
+
import WebSocket from 'ws'
|
|
5
8
|
import { loadConfig } from '../../config/index.js'
|
|
6
9
|
import { buildServer, platformaticRuntime } from '../../runtime/index.js'
|
|
7
10
|
|
|
11
|
+
export { setTimeout as sleep } from 'node:timers/promises'
|
|
12
|
+
|
|
13
|
+
let hrmVersion = Date.now()
|
|
8
14
|
export const fixturesDir = resolve(import.meta.dirname, './fixtures')
|
|
9
15
|
|
|
10
16
|
export async function createRuntime (t, path) {
|
|
@@ -20,18 +26,6 @@ export async function createRuntime (t, path) {
|
|
|
20
26
|
return { runtime, url }
|
|
21
27
|
}
|
|
22
28
|
|
|
23
|
-
export async function verifyViaHTTP (baseUrl, path, expectedCode, expectedContent) {
|
|
24
|
-
const { statusCode, body } = await request(baseUrl + path)
|
|
25
|
-
strictEqual(statusCode, expectedCode)
|
|
26
|
-
deepStrictEqual(await body.json(), expectedContent)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export async function verifyViaInject (app, serviceId, method, url, expectedCode, expectedContent) {
|
|
30
|
-
const { statusCode, body } = await app.inject(serviceId, { method, url })
|
|
31
|
-
strictEqual(statusCode, expectedCode)
|
|
32
|
-
deepStrictEqual(JSON.parse(body), expectedContent)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
29
|
export async function getLogs (app) {
|
|
36
30
|
const client = new Client(
|
|
37
31
|
{
|
|
@@ -63,3 +57,80 @@ export async function getLogs (app) {
|
|
|
63
57
|
.filter(l => l)
|
|
64
58
|
.map(m => JSON.parse(m))
|
|
65
59
|
}
|
|
60
|
+
|
|
61
|
+
export async function updateHMRVersion () {
|
|
62
|
+
const versionFile = resolve(fixturesDir, '../tmp/version.js')
|
|
63
|
+
await createDirectory(dirname(versionFile))
|
|
64
|
+
await writeFile(versionFile, `export const version = ${hrmVersion++}\n`, 'utf-8')
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export async function verifyJSONViaHTTP (baseUrl, path, expectedCode, expectedContent) {
|
|
68
|
+
const { statusCode, body } = await request(baseUrl + path)
|
|
69
|
+
strictEqual(statusCode, expectedCode)
|
|
70
|
+
deepStrictEqual(await body.json(), expectedContent)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export async function verifyJSONViaInject (app, serviceId, method, url, expectedCode, expectedContent) {
|
|
74
|
+
const { statusCode, body } = await app.inject(serviceId, { method, url })
|
|
75
|
+
strictEqual(statusCode, expectedCode)
|
|
76
|
+
deepStrictEqual(JSON.parse(body), expectedContent)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export async function verifyHTMLViaHTTP (baseUrl, path, contents) {
|
|
80
|
+
const { statusCode, headers, body } = await request(baseUrl + path, { maxRedirections: 1 })
|
|
81
|
+
const html = await body.text()
|
|
82
|
+
|
|
83
|
+
deepStrictEqual(statusCode, 200)
|
|
84
|
+
ok(headers['content-type'].startsWith('text/html'))
|
|
85
|
+
|
|
86
|
+
for (const content of contents) {
|
|
87
|
+
ok(html.includes(content))
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export async function verifyHTMLViaInject (app, serviceId, url, contents) {
|
|
92
|
+
const { statusCode, headers, body: html } = await app.inject(serviceId, { method: 'GET', url })
|
|
93
|
+
|
|
94
|
+
deepStrictEqual(statusCode, 200)
|
|
95
|
+
ok(headers['content-type'].startsWith('text/html'))
|
|
96
|
+
|
|
97
|
+
for (const content of contents) {
|
|
98
|
+
ok(html.includes(content))
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export async function verifyHMR (baseUrl, path, versionFile, protocol, handler) {
|
|
103
|
+
const connection = withResolvers()
|
|
104
|
+
const reload = withResolvers()
|
|
105
|
+
const ac = new AbortController()
|
|
106
|
+
const timeout = sleep(10000, 'timeout', { signal: ac.signal })
|
|
107
|
+
|
|
108
|
+
const url = baseUrl.replace('http:', 'ws:') + path
|
|
109
|
+
const webSocket = new WebSocket(url, protocol)
|
|
110
|
+
|
|
111
|
+
webSocket.on('error', err => {
|
|
112
|
+
clearTimeout(timeout)
|
|
113
|
+
connection.reject(err)
|
|
114
|
+
reload.reject(err)
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
webSocket.on('message', data => {
|
|
118
|
+
handler(JSON.parse(data), connection.resolve, reload.resolve)
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
try {
|
|
122
|
+
if ((await Promise.race([connection.promise, timeout])) === 'timeout') {
|
|
123
|
+
throw new Error('Timeout while waiting for HMR connection')
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
await sleep(1000)
|
|
127
|
+
await updateHMRVersion()
|
|
128
|
+
|
|
129
|
+
if ((await Promise.race([reload.promise, timeout])) === 'timeout') {
|
|
130
|
+
throw new Error('Timeout while waiting for HMR reload')
|
|
131
|
+
}
|
|
132
|
+
} finally {
|
|
133
|
+
webSocket.terminate()
|
|
134
|
+
ac.abort()
|
|
135
|
+
}
|
|
136
|
+
}
|