@lark-apaas/fullstack-cli 1.1.66-alpha.20260902172318 → 1.1.66-alpha.20260902192310
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/package.json
CHANGED
package/templates/scripts/dev.js
CHANGED
|
@@ -42,6 +42,17 @@ const MAX_DELAY = 8;
|
|
|
42
42
|
const LEGACY_SERVER_PORT = process.env.SERVER_PORT || '3000';
|
|
43
43
|
const PLATFORM_HANDOFF_PUBLIC_PORT = 3000;
|
|
44
44
|
const MAX_HANDOFF_READINESS_RESPONSE_BYTES = 64 * 1024;
|
|
45
|
+
const CLIENT_BASE_PATH =
|
|
46
|
+
process.env.CLIENT_BASE_PATH?.startsWith('/') &&
|
|
47
|
+
!process.env.CLIENT_BASE_PATH.startsWith('//')
|
|
48
|
+
? process.env.CLIENT_BASE_PATH.replace(/\/+$/, '')
|
|
49
|
+
: '';
|
|
50
|
+
const HANDOFF_READINESS_PATHS = [
|
|
51
|
+
'/__innerapi__/capability/list',
|
|
52
|
+
...(CLIENT_BASE_PATH
|
|
53
|
+
? [`${CLIENT_BASE_PATH}/__innerapi__/capability/list`]
|
|
54
|
+
: []),
|
|
55
|
+
];
|
|
45
56
|
const CLIENT_DEV_PORT = process.env.CLIENT_DEV_PORT || '8080';
|
|
46
57
|
// This is an ownership receipt, not the raw TCC flag. The sandbox entrypoint
|
|
47
58
|
// sets it only after the handoff runtime has bound the public port and
|
|
@@ -334,7 +345,7 @@ function readStrictHandoffOwner() {
|
|
|
334
345
|
return owner;
|
|
335
346
|
}
|
|
336
347
|
|
|
337
|
-
function
|
|
348
|
+
function publicServerPathReachable(requestPath) {
|
|
338
349
|
return new Promise(resolve => {
|
|
339
350
|
let settled = false;
|
|
340
351
|
const finish = reachable => {
|
|
@@ -346,7 +357,7 @@ function publicServerReachable() {
|
|
|
346
357
|
{
|
|
347
358
|
host: '127.0.0.1',
|
|
348
359
|
port: PUBLIC_SERVER_PORT,
|
|
349
|
-
path:
|
|
360
|
+
path: requestPath,
|
|
350
361
|
},
|
|
351
362
|
response => {
|
|
352
363
|
if (response.statusCode !== 200) {
|
|
@@ -393,6 +404,13 @@ function publicServerReachable() {
|
|
|
393
404
|
});
|
|
394
405
|
}
|
|
395
406
|
|
|
407
|
+
async function publicServerReachable() {
|
|
408
|
+
for (const requestPath of HANDOFF_READINESS_PATHS) {
|
|
409
|
+
if (await publicServerPathReachable(requestPath)) return true;
|
|
410
|
+
}
|
|
411
|
+
return false;
|
|
412
|
+
}
|
|
413
|
+
|
|
396
414
|
function registryMatchesOwner(registry, owner) {
|
|
397
415
|
if (
|
|
398
416
|
!hasExactKeys(registry, [
|
|
@@ -72,6 +72,16 @@ const publicPort = Number(process.env.SERVER_PORT || 3000);
|
|
|
72
72
|
const logDir = path.resolve(projectRoot, process.env.LOG_DIR || 'logs');
|
|
73
73
|
const readinessPath =
|
|
74
74
|
process.env.MIAODA_NEST_READINESS_PATH || '/__innerapi__/capability/list';
|
|
75
|
+
function resolveSourceReadinessPath(baseEnv) {
|
|
76
|
+
const clientBasePath =
|
|
77
|
+
baseEnv.CLIENT_BASE_PATH?.startsWith('/') &&
|
|
78
|
+
!baseEnv.CLIENT_BASE_PATH.startsWith('//')
|
|
79
|
+
? baseEnv.CLIENT_BASE_PATH.replace(/\/+$/, '')
|
|
80
|
+
: '';
|
|
81
|
+
return clientBasePath
|
|
82
|
+
? `${clientBasePath}/__innerapi__/capability/list`
|
|
83
|
+
: readinessPath;
|
|
84
|
+
}
|
|
75
85
|
const sourceReadyTimeoutMs = positiveDuration(
|
|
76
86
|
'MIAODA_NEST_SOURCE_READY_TIMEOUT_MS',
|
|
77
87
|
60_000
|
|
@@ -837,7 +847,13 @@ async function terminateOwned(record) {
|
|
|
837
847
|
publishProcessRegistry();
|
|
838
848
|
}
|
|
839
849
|
|
|
840
|
-
function waitForHttp(
|
|
850
|
+
function waitForHttp(
|
|
851
|
+
record,
|
|
852
|
+
upstream,
|
|
853
|
+
timeoutMs,
|
|
854
|
+
expectedCapabilityIds,
|
|
855
|
+
requestPath = readinessPath
|
|
856
|
+
) {
|
|
841
857
|
const deadline = Date.now() + timeoutMs;
|
|
842
858
|
return new Promise((resolve, reject) => {
|
|
843
859
|
let settled = false;
|
|
@@ -872,7 +888,7 @@ function waitForHttp(record, upstream, timeoutMs, expectedCapabilityIds) {
|
|
|
872
888
|
{
|
|
873
889
|
host: upstream.host,
|
|
874
890
|
port: upstream.port,
|
|
875
|
-
path:
|
|
891
|
+
path: requestPath,
|
|
876
892
|
},
|
|
877
893
|
response => {
|
|
878
894
|
if (attemptSettled || settled) {
|
|
@@ -1652,7 +1668,8 @@ async function startAndPromoteSource(baseEnv, expectedCapabilityIds) {
|
|
|
1652
1668
|
sourceRecord,
|
|
1653
1669
|
candidate,
|
|
1654
1670
|
sourceReadyTimeoutMs,
|
|
1655
|
-
expectedCapabilityIds
|
|
1671
|
+
expectedCapabilityIds,
|
|
1672
|
+
resolveSourceReadinessPath(baseEnv)
|
|
1656
1673
|
);
|
|
1657
1674
|
} catch (error) {
|
|
1658
1675
|
try {
|