@lark-apaas/fullstack-cli 1.1.66-alpha.20260902172318 → 1.1.66-alpha.20260902183957
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,14 @@ 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
|
+
const clientBasePath =
|
|
76
|
+
process.env.CLIENT_BASE_PATH?.startsWith('/') &&
|
|
77
|
+
!process.env.CLIENT_BASE_PATH.startsWith('//')
|
|
78
|
+
? process.env.CLIENT_BASE_PATH.replace(/\/+$/, '')
|
|
79
|
+
: '';
|
|
80
|
+
const sourceReadinessPath = clientBasePath
|
|
81
|
+
? `${clientBasePath}/__innerapi__/capability/list`
|
|
82
|
+
: readinessPath;
|
|
75
83
|
const sourceReadyTimeoutMs = positiveDuration(
|
|
76
84
|
'MIAODA_NEST_SOURCE_READY_TIMEOUT_MS',
|
|
77
85
|
60_000
|
|
@@ -837,7 +845,13 @@ async function terminateOwned(record) {
|
|
|
837
845
|
publishProcessRegistry();
|
|
838
846
|
}
|
|
839
847
|
|
|
840
|
-
function waitForHttp(
|
|
848
|
+
function waitForHttp(
|
|
849
|
+
record,
|
|
850
|
+
upstream,
|
|
851
|
+
timeoutMs,
|
|
852
|
+
expectedCapabilityIds,
|
|
853
|
+
requestPath = readinessPath
|
|
854
|
+
) {
|
|
841
855
|
const deadline = Date.now() + timeoutMs;
|
|
842
856
|
return new Promise((resolve, reject) => {
|
|
843
857
|
let settled = false;
|
|
@@ -872,7 +886,7 @@ function waitForHttp(record, upstream, timeoutMs, expectedCapabilityIds) {
|
|
|
872
886
|
{
|
|
873
887
|
host: upstream.host,
|
|
874
888
|
port: upstream.port,
|
|
875
|
-
path:
|
|
889
|
+
path: requestPath,
|
|
876
890
|
},
|
|
877
891
|
response => {
|
|
878
892
|
if (attemptSettled || settled) {
|
|
@@ -1652,7 +1666,8 @@ async function startAndPromoteSource(baseEnv, expectedCapabilityIds) {
|
|
|
1652
1666
|
sourceRecord,
|
|
1653
1667
|
candidate,
|
|
1654
1668
|
sourceReadyTimeoutMs,
|
|
1655
|
-
expectedCapabilityIds
|
|
1669
|
+
expectedCapabilityIds,
|
|
1670
|
+
sourceReadinessPath
|
|
1656
1671
|
);
|
|
1657
1672
|
} catch (error) {
|
|
1658
1673
|
try {
|