@lark-apaas/fullstack-cli 1.1.59-alpha.20260721012847 → 1.1.59-alpha.20260721164103
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/dist/index.js
CHANGED
|
@@ -8632,8 +8632,8 @@ import { spawnSync as spawnSync8 } from "child_process";
|
|
|
8632
8632
|
import * as crypto from "crypto";
|
|
8633
8633
|
import * as fs30 from "fs";
|
|
8634
8634
|
import * as path26 from "path";
|
|
8635
|
-
var PREVIEW_ARTIFACT_SCHEMA_VERSION =
|
|
8636
|
-
var PREVIEW_ARTIFACT_PROTOCOL_VERSION =
|
|
8635
|
+
var PREVIEW_ARTIFACT_SCHEMA_VERSION = 3;
|
|
8636
|
+
var PREVIEW_ARTIFACT_PROTOCOL_VERSION = 3;
|
|
8637
8637
|
var MANIFEST_FILE = "manifest.json";
|
|
8638
8638
|
var PROBE_FILE = "probe.json";
|
|
8639
8639
|
var SERVER_FILE = "server.bundle.cjs";
|
|
@@ -8652,7 +8652,10 @@ var RUNTIME_ONLY_ENVIRONMENT_KEYS = /* @__PURE__ */ new Set([
|
|
|
8652
8652
|
"SERVER_PORT",
|
|
8653
8653
|
"preview_run_id"
|
|
8654
8654
|
]);
|
|
8655
|
-
var RUNTIME_ONLY_ENVIRONMENT_PREFIXES = [
|
|
8655
|
+
var RUNTIME_ONLY_ENVIRONMENT_PREFIXES = [
|
|
8656
|
+
"MIAODA_PREVIEW_PHASE_",
|
|
8657
|
+
"PREVIEW_ARTIFACT_"
|
|
8658
|
+
];
|
|
8656
8659
|
function previewArtifactBuildEnvironment(environment, appBasePath) {
|
|
8657
8660
|
const buildEnvironment = {};
|
|
8658
8661
|
for (const [key, value] of Object.entries(environment ?? {})) {
|
|
@@ -8662,7 +8665,8 @@ function previewArtifactBuildEnvironment(environment, appBasePath) {
|
|
|
8662
8665
|
}
|
|
8663
8666
|
buildEnvironment.ASSETS_CDN_PATH = appBasePath;
|
|
8664
8667
|
buildEnvironment.CLIENT_BASE_PATH = appBasePath;
|
|
8665
|
-
buildEnvironment.
|
|
8668
|
+
buildEnvironment.MIAODA_BUILD_TARGET = "preview-artifact";
|
|
8669
|
+
buildEnvironment.NODE_ENV = "development";
|
|
8666
8670
|
return buildEnvironment;
|
|
8667
8671
|
}
|
|
8668
8672
|
function previewArtifactBuildEnvironmentHash(environment, appBasePath) {
|
|
@@ -9187,7 +9191,7 @@ function readPreviewArtifactEnvironmentFile(filePath) {
|
|
|
9187
9191
|
function previewArtifactRuntimeEnvironment(environment) {
|
|
9188
9192
|
return {
|
|
9189
9193
|
...environment,
|
|
9190
|
-
NODE_ENV:
|
|
9194
|
+
NODE_ENV: "development",
|
|
9191
9195
|
// Probe and switcher connect through 127.0.0.1. Linux may resolve
|
|
9192
9196
|
// `localhost` to IPv6-only ::1, so the isolated Nest process must bind to
|
|
9193
9197
|
// the same explicit private endpoint instead of inheriting app defaults.
|
|
@@ -9431,15 +9435,45 @@ function defaultGenerationId() {
|
|
|
9431
9435
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[-:.TZ]/g, "");
|
|
9432
9436
|
return `${timestamp}-${crypto2.randomBytes(5).toString("hex")}`;
|
|
9433
9437
|
}
|
|
9434
|
-
function
|
|
9435
|
-
const
|
|
9436
|
-
|
|
9437
|
-
|
|
9438
|
-
|
|
9439
|
-
|
|
9440
|
-
|
|
9441
|
-
|
|
9442
|
-
|
|
9438
|
+
function defaultPreviewBundleBuildCommands(projectRootInput) {
|
|
9439
|
+
const projectRoot = path30.resolve(projectRootInput);
|
|
9440
|
+
const executableSuffix = process.platform === "win32" ? ".cmd" : "";
|
|
9441
|
+
const localBinary = (name) => path30.join(
|
|
9442
|
+
projectRoot,
|
|
9443
|
+
"node_modules",
|
|
9444
|
+
".bin",
|
|
9445
|
+
`${name}${executableSuffix}`
|
|
9446
|
+
);
|
|
9447
|
+
const nodeBuildCommand = (label, binary, args) => process.platform === "win32" ? { label, command: binary, args } : { label, command: process.execPath, args: [binary, ...args] };
|
|
9448
|
+
return [
|
|
9449
|
+
nodeBuildCommand("server", localBinary("nest"), ["build"]),
|
|
9450
|
+
nodeBuildCommand("client", localBinary("vite"), [
|
|
9451
|
+
"build",
|
|
9452
|
+
"--mode",
|
|
9453
|
+
"development",
|
|
9454
|
+
"--config",
|
|
9455
|
+
"vite.config.ts"
|
|
9456
|
+
])
|
|
9457
|
+
];
|
|
9458
|
+
}
|
|
9459
|
+
function runBuildCommands(projectRoot, buildCommands, environment) {
|
|
9460
|
+
for (const buildCommand of buildCommands) {
|
|
9461
|
+
const result = spawnSync8(buildCommand.command, buildCommand.args, {
|
|
9462
|
+
cwd: projectRoot,
|
|
9463
|
+
env: { ...process.env, ...environment },
|
|
9464
|
+
encoding: "utf8",
|
|
9465
|
+
maxBuffer: 10 * 1024 * 1024
|
|
9466
|
+
});
|
|
9467
|
+
if (result.status !== 0) {
|
|
9468
|
+
const diagnostic = `${result.stdout ?? ""}
|
|
9469
|
+
${result.stderr ?? ""}`.trim().slice(-8 * 1024);
|
|
9470
|
+
return [
|
|
9471
|
+
`preview bundle ${buildCommand.label} build failed with exit ${result.status ?? "unknown"}${result.error ? `: ${result.error.message}` : ""}${diagnostic ? `
|
|
9472
|
+
${diagnostic}` : ""}`
|
|
9473
|
+
];
|
|
9474
|
+
}
|
|
9475
|
+
}
|
|
9476
|
+
return [];
|
|
9443
9477
|
}
|
|
9444
9478
|
function createClientArchive(clientDir, archivePath) {
|
|
9445
9479
|
if (!fs34.existsSync(path30.join(clientDir, "index.html"))) {
|
|
@@ -9480,9 +9514,10 @@ async function producePreviewArtifactGeneration(options) {
|
|
|
9480
9514
|
options.environment,
|
|
9481
9515
|
options.appBasePath
|
|
9482
9516
|
);
|
|
9483
|
-
const
|
|
9517
|
+
const buildCommands = options.buildCommands ?? (options.buildCommand ? [{ label: "custom", ...options.buildCommand }] : defaultPreviewBundleBuildCommands(projectRoot));
|
|
9518
|
+
const buildReasons = runBuildCommands(
|
|
9484
9519
|
projectRoot,
|
|
9485
|
-
|
|
9520
|
+
buildCommands,
|
|
9486
9521
|
buildEnvironment
|
|
9487
9522
|
);
|
|
9488
9523
|
if (buildReasons.length > 0) return failed(buildReasons);
|
package/package.json
CHANGED
|
@@ -160,7 +160,8 @@ function registerPreviewPhaseProducerViaShellServer(
|
|
|
160
160
|
);
|
|
161
161
|
}
|
|
162
162
|
if (envelope?.success !== true || envelope?.data?.success !== true) {
|
|
163
|
-
const detail =
|
|
163
|
+
const detail =
|
|
164
|
+
envelope?.data?.error || envelope?.error || envelope?.message || 'rejected';
|
|
164
165
|
const detailText = String(detail);
|
|
165
166
|
let code = 'PREVIEW_PHASE_PRODUCER_REGISTRATION_REJECTED';
|
|
166
167
|
if (detailText.includes('registration acknowledgement unknown')) {
|