@platformatic/next 2.5.4 → 2.5.5-alpha.2
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/index.js +13 -12
- package/package.json +6 -6
- package/schema.json +1 -1
package/index.js
CHANGED
|
@@ -24,7 +24,6 @@ const supportedVersions = '^14.0.0'
|
|
|
24
24
|
export class NextStackable extends BaseStackable {
|
|
25
25
|
#basePath
|
|
26
26
|
#next
|
|
27
|
-
#manager
|
|
28
27
|
#child
|
|
29
28
|
#server
|
|
30
29
|
|
|
@@ -73,7 +72,7 @@ export class NextStackable extends BaseStackable {
|
|
|
73
72
|
})
|
|
74
73
|
} else {
|
|
75
74
|
const exitPromise = once(this.#child, 'exit')
|
|
76
|
-
await this
|
|
75
|
+
await this.childManager.close()
|
|
77
76
|
process.kill(this.#child.pid, 'SIGKILL')
|
|
78
77
|
await exitPromise
|
|
79
78
|
}
|
|
@@ -129,7 +128,7 @@ export class NextStackable extends BaseStackable {
|
|
|
129
128
|
port: port || 0
|
|
130
129
|
}
|
|
131
130
|
|
|
132
|
-
this
|
|
131
|
+
this.childManager = new ChildManager({
|
|
133
132
|
loader: loaderUrl,
|
|
134
133
|
context: {
|
|
135
134
|
id: this.id,
|
|
@@ -141,25 +140,27 @@ export class NextStackable extends BaseStackable {
|
|
|
141
140
|
}
|
|
142
141
|
})
|
|
143
142
|
|
|
144
|
-
const promise = once(this
|
|
143
|
+
const promise = once(this.childManager, 'url')
|
|
145
144
|
await this.#startDevelopmentNext(serverOptions)
|
|
146
|
-
|
|
145
|
+
const [url, clientWs] = await promise
|
|
146
|
+
this.url = url
|
|
147
|
+
this.clientWs = clientWs
|
|
147
148
|
}
|
|
148
149
|
|
|
149
150
|
async #startDevelopmentNext (serverOptions) {
|
|
150
151
|
const { nextDev } = await importFile(pathResolve(this.#next, './dist/cli/next-dev.js'))
|
|
151
152
|
|
|
152
|
-
this
|
|
153
|
+
this.childManager.on('config', config => {
|
|
153
154
|
this.#basePath = config.basePath
|
|
154
155
|
})
|
|
155
156
|
|
|
156
157
|
try {
|
|
157
|
-
await this
|
|
158
|
+
await this.childManager.inject()
|
|
158
159
|
const childPromise = createChildProcessListener()
|
|
159
160
|
await nextDev(serverOptions, 'default', this.root)
|
|
160
161
|
this.#child = await childPromise
|
|
161
162
|
} finally {
|
|
162
|
-
await this
|
|
163
|
+
await this.childManager.eject()
|
|
163
164
|
}
|
|
164
165
|
}
|
|
165
166
|
|
|
@@ -174,7 +175,7 @@ export class NextStackable extends BaseStackable {
|
|
|
174
175
|
return this.startWithCommand(command, loaderUrl)
|
|
175
176
|
}
|
|
176
177
|
|
|
177
|
-
this
|
|
178
|
+
this.childManager = new ChildManager({
|
|
178
179
|
loader: loaderUrl,
|
|
179
180
|
context: {
|
|
180
181
|
id: this.id,
|
|
@@ -191,7 +192,7 @@ export class NextStackable extends BaseStackable {
|
|
|
191
192
|
|
|
192
193
|
async #startProductionNext () {
|
|
193
194
|
try {
|
|
194
|
-
await this
|
|
195
|
+
await this.childManager.inject()
|
|
195
196
|
const { nextStart } = await importFile(pathResolve(this.#next, './dist/cli/next-start.js'))
|
|
196
197
|
|
|
197
198
|
const { hostname, port } = this.serverConfig ?? {}
|
|
@@ -205,7 +206,7 @@ export class NextStackable extends BaseStackable {
|
|
|
205
206
|
this.#basePath = config.basePath
|
|
206
207
|
})
|
|
207
208
|
|
|
208
|
-
this
|
|
209
|
+
this.childManager.register()
|
|
209
210
|
const serverPromise = createServerListener(
|
|
210
211
|
(this.isEntrypoint ? serverOptions?.port : undefined) ?? true,
|
|
211
212
|
(this.isEntrypoint ? serverOptions?.hostname : undefined) ?? true
|
|
@@ -216,7 +217,7 @@ export class NextStackable extends BaseStackable {
|
|
|
216
217
|
this.#server = await serverPromise
|
|
217
218
|
this.url = getServerUrl(this.#server)
|
|
218
219
|
} finally {
|
|
219
|
-
await this
|
|
220
|
+
await this.childManager.eject()
|
|
220
221
|
}
|
|
221
222
|
}
|
|
222
223
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/next",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.5-alpha.2",
|
|
4
4
|
"description": "Platformatic Next.js Stackable",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"@babel/traverse": "^7.25.3",
|
|
21
21
|
"@babel/types": "^7.25.2",
|
|
22
22
|
"semver": "^7.6.3",
|
|
23
|
-
"@platformatic/basic": "2.5.
|
|
24
|
-
"@platformatic/utils": "2.5.
|
|
25
|
-
"@platformatic/config": "2.5.
|
|
23
|
+
"@platformatic/basic": "2.5.5-alpha.2",
|
|
24
|
+
"@platformatic/utils": "2.5.5-alpha.2",
|
|
25
|
+
"@platformatic/config": "2.5.5-alpha.2"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@fastify/reply-from": "^11.0.0",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"react-dom": "^18.3.1",
|
|
37
37
|
"typescript": "^5.5.4",
|
|
38
38
|
"ws": "^8.18.0",
|
|
39
|
-
"@platformatic/
|
|
40
|
-
"@platformatic/
|
|
39
|
+
"@platformatic/service": "2.5.5-alpha.2",
|
|
40
|
+
"@platformatic/composer": "2.5.5-alpha.2"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"test": "npm run lint && borp --concurrency=1 --no-timeout",
|
package/schema.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$id": "https://schemas.platformatic.dev/@platformatic/next/2.5.
|
|
2
|
+
"$id": "https://schemas.platformatic.dev/@platformatic/next/2.5.5-alpha.2.json",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
4
|
"title": "Platformatic Next.js Stackable",
|
|
5
5
|
"type": "object",
|