@base44-preview/cli 0.3.4-pr.702.1894d21 → 0.3.5-pr.703.cda6ca8
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/cli/index.js +302 -45
- package/dist/cli/index.js.map +17 -16
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -31560,7 +31560,7 @@ function cleanDoc(doc) {
|
|
|
31560
31560
|
return mapDoc(doc, (currentDoc) => cleanDocFn(currentDoc));
|
|
31561
31561
|
}
|
|
31562
31562
|
function replaceEndOfLine(doc, replacement = literalline) {
|
|
31563
|
-
return mapDoc(doc, (currentDoc) => typeof currentDoc === "string" ?
|
|
31563
|
+
return mapDoc(doc, (currentDoc) => typeof currentDoc === "string" ? join33(replacement, currentDoc.split(`
|
|
31564
31564
|
`)) : currentDoc);
|
|
31565
31565
|
}
|
|
31566
31566
|
function canBreakFn(doc) {
|
|
@@ -31640,7 +31640,7 @@ function indentIfBreak(contents, options) {
|
|
|
31640
31640
|
negate: options.negate
|
|
31641
31641
|
};
|
|
31642
31642
|
}
|
|
31643
|
-
function
|
|
31643
|
+
function join33(separator, docs) {
|
|
31644
31644
|
assertDoc(separator);
|
|
31645
31645
|
assertDocArray(docs);
|
|
31646
31646
|
const parts = [];
|
|
@@ -32351,7 +32351,7 @@ var init_doc = __esm(() => {
|
|
|
32351
32351
|
MODE_FLAT = Symbol("MODE_FLAT");
|
|
32352
32352
|
DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
|
|
32353
32353
|
builders = {
|
|
32354
|
-
join:
|
|
32354
|
+
join: join33,
|
|
32355
32355
|
line,
|
|
32356
32356
|
softline,
|
|
32357
32357
|
hardline,
|
|
@@ -125190,7 +125190,7 @@ var require2, __filename2, __dirname3, __create2, __defProp3, __getOwnPropDesc2,
|
|
|
125190
125190
|
}
|
|
125191
125191
|
}
|
|
125192
125192
|
}, ast_path_default, is_object_default, skipWhitespace, skipSpaces, skipToLineEnd, skipEverythingButNewLine, isNewlineCharacter = (character) => character === `
|
|
125193
|
-
` || character === "\r" || character === "\u2028" || character === "\u2029", skip_newline_default, has_newline_default, is_non_empty_array_default, get_sorted_child_nodes_default, childNodesCache, returnFalse = () => false, isAllEmptyAndNoLineBreak = (text) => !/[\S\n\u2028\u2029]/u.test(text), is_previous_line_empty_default, breakParent2, hardline2, indent2,
|
|
125193
|
+
` || character === "\r" || character === "\u2028" || character === "\u2029", skip_newline_default, has_newline_default, is_non_empty_array_default, get_sorted_child_nodes_default, childNodesCache, returnFalse = () => false, isAllEmptyAndNoLineBreak = (text) => !/[\S\n\u2028\u2029]/u.test(text), is_previous_line_empty_default, breakParent2, hardline2, indent2, join35, line22, lineSuffix2, create_print_pre_check_function_default = () => noop_default2, core_options_evaluate_default, arrayToReversed, toReversed, method_to_reversed_default, import_n_readlines, get_interpreter_default, getFileBasename = (file) => {
|
|
125194
125194
|
try {
|
|
125195
125195
|
return path112.basename(toPath3(file));
|
|
125196
125196
|
} catch {
|
|
@@ -135219,7 +135219,7 @@ ${codeblock}`, options8);
|
|
|
135219
135219
|
breakParent: breakParent2,
|
|
135220
135220
|
hardline: hardline2,
|
|
135221
135221
|
indent: indent2,
|
|
135222
|
-
join:
|
|
135222
|
+
join: join35,
|
|
135223
135223
|
line: line22,
|
|
135224
135224
|
lineSuffix: lineSuffix2
|
|
135225
135225
|
} = builders);
|
|
@@ -228529,6 +228529,20 @@ class AppNotPublishedError extends UserError {
|
|
|
228529
228529
|
});
|
|
228530
228530
|
}
|
|
228531
228531
|
}
|
|
228532
|
+
|
|
228533
|
+
class DeploymentExistsError extends UserError {
|
|
228534
|
+
code = "DEPLOYMENT_EXISTS";
|
|
228535
|
+
constructor(gitHash, options) {
|
|
228536
|
+
super(`Commit ${gitHash.slice(0, 12)} already has a different build, so this one was not deployed`, {
|
|
228537
|
+
hints: options?.hints ?? [
|
|
228538
|
+
{
|
|
228539
|
+
message: "Run the same command again with --overwrite to replace that build, or commit your changes and deploy the new commit"
|
|
228540
|
+
}
|
|
228541
|
+
],
|
|
228542
|
+
cause: options?.cause
|
|
228543
|
+
});
|
|
228544
|
+
}
|
|
228545
|
+
}
|
|
228532
228546
|
var MAX_RESPONSE_TEXT_CHARS = 500;
|
|
228533
228547
|
async function readResponseText(response) {
|
|
228534
228548
|
try {
|
|
@@ -228875,7 +228889,7 @@ function normalizeBase44Env() {
|
|
|
228875
228889
|
loadProjectEnvFiles();
|
|
228876
228890
|
|
|
228877
228891
|
// src/cli/index.ts
|
|
228878
|
-
import { dirname as dirname31, join as
|
|
228892
|
+
import { dirname as dirname31, join as join43 } from "node:path";
|
|
228879
228893
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
228880
228894
|
|
|
228881
228895
|
// ../../node_modules/@clack/core/dist/index.mjs
|
|
@@ -236614,6 +236628,9 @@ var DeployResponseSchema = object({
|
|
|
236614
236628
|
var PublishedUrlResponseSchema = object({
|
|
236615
236629
|
url: string2()
|
|
236616
236630
|
});
|
|
236631
|
+
var DeploymentExistsRefusalSchema = object({
|
|
236632
|
+
error: object({ code: literal("deployment_already_exists") })
|
|
236633
|
+
});
|
|
236617
236634
|
var CreateDeploymentResponseSchema = object({
|
|
236618
236635
|
deployment_id: string2(),
|
|
236619
236636
|
session_id: string2(),
|
|
@@ -239447,7 +239464,7 @@ import { join as join13 } from "node:path";
|
|
|
239447
239464
|
// package.json
|
|
239448
239465
|
var package_default = {
|
|
239449
239466
|
name: "base44",
|
|
239450
|
-
version: "0.3.
|
|
239467
|
+
version: "0.3.5",
|
|
239451
239468
|
description: "Base44 CLI - Unified interface for managing Base44 applications",
|
|
239452
239469
|
type: "module",
|
|
239453
239470
|
bin: {
|
|
@@ -239714,7 +239731,11 @@ async function createDeployment(request) {
|
|
|
239714
239731
|
timeout: 120000
|
|
239715
239732
|
});
|
|
239716
239733
|
} catch (error) {
|
|
239717
|
-
|
|
239734
|
+
const apiError = await ApiError.fromHttpError(error, "creating deployment");
|
|
239735
|
+
if (apiError.statusCode === 409 && DeploymentExistsRefusalSchema.safeParse(apiError.responseBody).success) {
|
|
239736
|
+
throw new DeploymentExistsError(request.git_hash, { cause: apiError });
|
|
239737
|
+
}
|
|
239738
|
+
throw apiError;
|
|
239718
239739
|
}
|
|
239719
239740
|
const result = CreateDeploymentResponseSchema.safeParse(await response.json());
|
|
239720
239741
|
if (!result.success) {
|
|
@@ -240351,7 +240372,7 @@ async function putPresignedBody(upload, body) {
|
|
|
240351
240372
|
// src/core/site/deployment.ts
|
|
240352
240373
|
var NO_ASSETS = { manifest: {}, filesByHash: new Map };
|
|
240353
240374
|
async function deployToDeployments(options) {
|
|
240354
|
-
const { projectRoot, outputDir, gitHash, concurrency, progress } = options;
|
|
240375
|
+
const { projectRoot, outputDir, gitHash, concurrency, overwrite, progress } = options;
|
|
240355
240376
|
const worker = await resolveWorkerBuild(projectRoot, progress);
|
|
240356
240377
|
const assetsDir = worker ? worker.assetsDir : outputDir;
|
|
240357
240378
|
const assets = assetsDir ? await buildAssetManifest(assetsDir, getAppContext().id) : NO_ASSETS;
|
|
@@ -240361,7 +240382,8 @@ async function deployToDeployments(options) {
|
|
|
240361
240382
|
const created = await createDeployment({
|
|
240362
240383
|
git_hash: gitHash,
|
|
240363
240384
|
config: worker?.config,
|
|
240364
|
-
asset_manifest: assets.manifest
|
|
240385
|
+
asset_manifest: assets.manifest,
|
|
240386
|
+
overwrite
|
|
240365
240387
|
});
|
|
240366
240388
|
const completionJwt = await uploadDeploymentAssets(created.assetUploads, assets, { concurrency, progress });
|
|
240367
240389
|
const completion = worker ? { kind: "worker", modules: worker.modules, completionJwt } : await resolveStaticCompletion(assetsDir, assets, created.indexHtmlStaged);
|
|
@@ -247064,6 +247086,7 @@ async function shipCommit(projectRoot, outputDir, gitHash, options) {
|
|
|
247064
247086
|
projectRoot,
|
|
247065
247087
|
outputDir,
|
|
247066
247088
|
gitHash,
|
|
247089
|
+
overwrite: options?.overwrite,
|
|
247067
247090
|
progress: {
|
|
247068
247091
|
onWarning: (message) => options?.onSiteProgress?.(message),
|
|
247069
247092
|
onAssets: ({ totalAssets, newAssets }) => options?.onSiteProgress?.(`Found ${totalAssets} static assets (${newAssets} new)`)
|
|
@@ -252184,6 +252207,7 @@ ${summaryLines.join(`
|
|
|
252184
252207
|
let actorCompleted = 0;
|
|
252185
252208
|
const result = await deployAll(projectData, {
|
|
252186
252209
|
gitHash: options.gitHash,
|
|
252210
|
+
overwrite: options.overwrite,
|
|
252187
252211
|
onSiteProgress: (message) => {
|
|
252188
252212
|
log.message(theme.styles.dim(message));
|
|
252189
252213
|
},
|
|
@@ -252225,7 +252249,7 @@ ${summaryLines.join(`
|
|
|
252225
252249
|
return { outroMessage: "App deployed successfully" };
|
|
252226
252250
|
}
|
|
252227
252251
|
function getDeployCommand3() {
|
|
252228
|
-
return new Base44Command("deploy").description("Deploy all project resources (entities, functions, actors, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").option("--build", "Build the site before deploying (skips the prompt)").option("--no-build", "Deploy without building (skips the prompt)").addOption(new Option2("--git-hash <hash>", "Deploy by the commit the build came from, through the deployments API").argParser(parseGitHash)).action(deployAction);
|
|
252252
|
+
return new Base44Command("deploy").description("Deploy all project resources (entities, functions, actors, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").option("--build", "Build the site before deploying (skips the prompt)").option("--no-build", "Deploy without building (skips the prompt)").addOption(new Option2("--git-hash <hash>", "Deploy by the commit the build came from, through the deployments API").argParser(parseGitHash)).option("--overwrite", "Replace the build the commit already has (with --git-hash)").action(deployAction);
|
|
252229
252253
|
}
|
|
252230
252254
|
async function handleOAuthConnectors(connectorResults, isNonInteractive, options, log) {
|
|
252231
252255
|
const needsOAuth = filterPendingOAuth(connectorResults);
|
|
@@ -252845,6 +252869,33 @@ function declaredActor({
|
|
|
252845
252869
|
static_egress: staticEgress
|
|
252846
252870
|
};
|
|
252847
252871
|
}
|
|
252872
|
+
function declaredRoutes({
|
|
252873
|
+
pages,
|
|
252874
|
+
home,
|
|
252875
|
+
entityPages,
|
|
252876
|
+
entityFreePaths
|
|
252877
|
+
}) {
|
|
252878
|
+
return {
|
|
252879
|
+
pages: pages.map(({ path, name, file, requiresAuth, binding, segmentValues }) => ({
|
|
252880
|
+
path,
|
|
252881
|
+
name,
|
|
252882
|
+
file,
|
|
252883
|
+
...requiresAuth ? { requires_auth: true } : {},
|
|
252884
|
+
...binding ? {
|
|
252885
|
+
binding: {
|
|
252886
|
+
entity: binding.entity,
|
|
252887
|
+
param: binding.param,
|
|
252888
|
+
field: binding.field,
|
|
252889
|
+
...binding.extraParams ? { extra_params: binding.extraParams } : {}
|
|
252890
|
+
}
|
|
252891
|
+
} : {},
|
|
252892
|
+
...segmentValues ? { segment_values: segmentValues } : {}
|
|
252893
|
+
})),
|
|
252894
|
+
home,
|
|
252895
|
+
...entityPages ? { entity_pages: entityPages } : {},
|
|
252896
|
+
...entityFreePaths ? { entity_free_paths: entityFreePaths } : {}
|
|
252897
|
+
};
|
|
252898
|
+
}
|
|
252848
252899
|
function actorUploadPath(actor) {
|
|
252849
252900
|
return `actors/${actor.name}.mjs`;
|
|
252850
252901
|
}
|
|
@@ -252907,6 +252958,7 @@ async function createVersion(artifacts, options = {}) {
|
|
|
252907
252958
|
agents: artifacts.agents,
|
|
252908
252959
|
mcp_config: artifacts.mcpConfig,
|
|
252909
252960
|
agent_skills: artifacts.agentSkills,
|
|
252961
|
+
...artifacts.routes ? { routes: declaredRoutes(artifacts.routes) } : {},
|
|
252910
252962
|
source_commit: options.sourceCommit
|
|
252911
252963
|
}, "declaring a version")).json(), "declare");
|
|
252912
252964
|
const declaredFiles = [
|
|
@@ -252952,7 +253004,7 @@ async function setEnvironmentVersion(environment, versionId, options = {}) {
|
|
|
252952
253004
|
}
|
|
252953
253005
|
// src/core/version/artifacts.ts
|
|
252954
253006
|
import { createHash as createHash3 } from "node:crypto";
|
|
252955
|
-
import { join as
|
|
253007
|
+
import { join as join31, resolve as resolve14 } from "node:path";
|
|
252956
253008
|
|
|
252957
253009
|
// src/core/version/actors.ts
|
|
252958
253010
|
import { dirname as dirname22, relative as relative7, resolve as resolve13 } from "node:path";
|
|
@@ -264699,6 +264751,205 @@ async function publishVersion(artifacts, options = {}) {
|
|
|
264699
264751
|
};
|
|
264700
264752
|
}
|
|
264701
264753
|
|
|
264754
|
+
// src/core/version/routes.ts
|
|
264755
|
+
import { join as join30 } from "node:path";
|
|
264756
|
+
var RoutesFileSchema = object({
|
|
264757
|
+
pages: array(object({
|
|
264758
|
+
path: string2().startsWith("/"),
|
|
264759
|
+
name: string2().min(1),
|
|
264760
|
+
file: string2().min(1),
|
|
264761
|
+
requires_auth: boolean2().optional(),
|
|
264762
|
+
binding: object({
|
|
264763
|
+
entity: string2().min(1),
|
|
264764
|
+
param: string2().min(1),
|
|
264765
|
+
field: string2().min(1),
|
|
264766
|
+
extra_params: record(string2(), string2()).optional()
|
|
264767
|
+
}).optional(),
|
|
264768
|
+
segment_values: record(string2(), array(string2())).optional()
|
|
264769
|
+
})),
|
|
264770
|
+
home: string2().nullable().optional(),
|
|
264771
|
+
entity_pages: record(string2(), array(string2())).optional(),
|
|
264772
|
+
entity_free_paths: array(string2()).optional()
|
|
264773
|
+
}).transform((data) => ({
|
|
264774
|
+
pages: data.pages.map((page) => ({
|
|
264775
|
+
path: page.path,
|
|
264776
|
+
name: page.name,
|
|
264777
|
+
file: page.file,
|
|
264778
|
+
...page.requires_auth ? { requiresAuth: true } : {},
|
|
264779
|
+
...page.binding ? {
|
|
264780
|
+
binding: {
|
|
264781
|
+
entity: page.binding.entity,
|
|
264782
|
+
param: page.binding.param,
|
|
264783
|
+
field: page.binding.field,
|
|
264784
|
+
...page.binding.extra_params ? { extraParams: page.binding.extra_params } : {}
|
|
264785
|
+
}
|
|
264786
|
+
} : {},
|
|
264787
|
+
...page.segment_values ? { segmentValues: page.segment_values } : {}
|
|
264788
|
+
})),
|
|
264789
|
+
home: data.home ?? null,
|
|
264790
|
+
...data.entity_pages ? { entityPages: data.entity_pages } : {},
|
|
264791
|
+
...data.entity_free_paths ? { entityFreePaths: data.entity_free_paths } : {}
|
|
264792
|
+
}));
|
|
264793
|
+
async function readRoutesFile(path) {
|
|
264794
|
+
const parsed = RoutesFileSchema.safeParse(await readJsonFile(path));
|
|
264795
|
+
if (!parsed.success) {
|
|
264796
|
+
throw new SchemaValidationError("Invalid routes file", parsed.error, path);
|
|
264797
|
+
}
|
|
264798
|
+
return parsed.data;
|
|
264799
|
+
}
|
|
264800
|
+
async function collectRoutes(projectRoot, routesFile) {
|
|
264801
|
+
if (routesFile) {
|
|
264802
|
+
return await readRoutesFile(routesFile);
|
|
264803
|
+
}
|
|
264804
|
+
const pages = await collectPages(projectRoot);
|
|
264805
|
+
return pages ? { pages, home: pages[0]?.name ?? null } : null;
|
|
264806
|
+
}
|
|
264807
|
+
var ROUTES_DIR = "src/routes";
|
|
264808
|
+
var ROUTE_TREE = "src/routeTree.gen.ts";
|
|
264809
|
+
var ROUTE_EXTENSIONS = [".tsx", ".ts", ".jsx", ".js"];
|
|
264810
|
+
var DOT_SPLIT = /\.(?![^[]*\])/;
|
|
264811
|
+
var BRACKETS = /\[([^\]]*)\]/g;
|
|
264812
|
+
var BRACE_PARAM = /\{(-?)\$([^{}[\]]+)\}(?![^[]*\])/;
|
|
264813
|
+
var COMPANION_SUFFIXES = new Set([
|
|
264814
|
+
"component",
|
|
264815
|
+
"errorComponent",
|
|
264816
|
+
"notFoundComponent",
|
|
264817
|
+
"pendingComponent",
|
|
264818
|
+
"loader"
|
|
264819
|
+
]);
|
|
264820
|
+
var SERVER_KEY = /\bserver\s*:\s*\{/;
|
|
264821
|
+
var COMPONENT_KEY = /\bcomponent['"]?\s*[:,}(]/;
|
|
264822
|
+
|
|
264823
|
+
class Segment {
|
|
264824
|
+
text;
|
|
264825
|
+
url;
|
|
264826
|
+
leadEscaped;
|
|
264827
|
+
literal;
|
|
264828
|
+
constructor(raw) {
|
|
264829
|
+
this.text = raw.replace(BRACKETS, "$1");
|
|
264830
|
+
this.leadEscaped = raw.startsWith("[");
|
|
264831
|
+
this.literal = raw === this.text;
|
|
264832
|
+
const name = raw.length > 1 && raw.endsWith("_") ? raw.slice(0, -1) : raw;
|
|
264833
|
+
const param = BRACE_PARAM.exec(name);
|
|
264834
|
+
this.url = param ? `:${param[2]}${param[1] ? "?" : ""}` : name.replace(BRACKETS, "$1");
|
|
264835
|
+
}
|
|
264836
|
+
isToken(...tokens) {
|
|
264837
|
+
return this.literal && tokens.includes(this.text);
|
|
264838
|
+
}
|
|
264839
|
+
isPathless() {
|
|
264840
|
+
return !this.leadEscaped && this.text.startsWith("_");
|
|
264841
|
+
}
|
|
264842
|
+
isGroup() {
|
|
264843
|
+
return !this.leadEscaped && this.text.startsWith("(") && this.text.endsWith(")");
|
|
264844
|
+
}
|
|
264845
|
+
}
|
|
264846
|
+
function segmentsOf(relativePath) {
|
|
264847
|
+
const segments = [];
|
|
264848
|
+
for (const name of relativePath.split("/")) {
|
|
264849
|
+
if (name.startsWith("-")) {
|
|
264850
|
+
return null;
|
|
264851
|
+
}
|
|
264852
|
+
for (const raw of name.split(DOT_SPLIT)) {
|
|
264853
|
+
if (!raw) {
|
|
264854
|
+
continue;
|
|
264855
|
+
}
|
|
264856
|
+
const segment = new Segment(raw);
|
|
264857
|
+
if (!segment.text || !segment.leadEscaped && segment.text.startsWith("__")) {
|
|
264858
|
+
return null;
|
|
264859
|
+
}
|
|
264860
|
+
segments.push(segment);
|
|
264861
|
+
}
|
|
264862
|
+
}
|
|
264863
|
+
return segments.length > 0 ? segments : null;
|
|
264864
|
+
}
|
|
264865
|
+
function pageName(parts) {
|
|
264866
|
+
if (parts.length === 0) {
|
|
264867
|
+
return "Home";
|
|
264868
|
+
}
|
|
264869
|
+
return parts.flatMap((part) => part.split(/[^A-Za-z0-9]/)).filter(Boolean).map((piece) => piece.charAt(0).toUpperCase() + piece.slice(1)).join("");
|
|
264870
|
+
}
|
|
264871
|
+
function pageOfRouteFile(relativePath) {
|
|
264872
|
+
const segments = segmentsOf(relativePath);
|
|
264873
|
+
if (segments === null || segments[0].isToken("api")) {
|
|
264874
|
+
return null;
|
|
264875
|
+
}
|
|
264876
|
+
if (segments[segments.length - 1].isToken("lazy")) {
|
|
264877
|
+
segments.pop();
|
|
264878
|
+
}
|
|
264879
|
+
const last = () => segments[segments.length - 1];
|
|
264880
|
+
if (last()?.isToken(...COMPANION_SUFFIXES)) {
|
|
264881
|
+
return null;
|
|
264882
|
+
}
|
|
264883
|
+
let poppedIndex = false;
|
|
264884
|
+
while (last()?.isToken("index", "route")) {
|
|
264885
|
+
poppedIndex ||= last()?.text === "index";
|
|
264886
|
+
segments.pop();
|
|
264887
|
+
}
|
|
264888
|
+
const end = last();
|
|
264889
|
+
if (end && !poppedIndex && (end.isPathless() || end.isGroup())) {
|
|
264890
|
+
return null;
|
|
264891
|
+
}
|
|
264892
|
+
const urlSegments = [];
|
|
264893
|
+
for (const segment of segments) {
|
|
264894
|
+
if (segment.isPathless() || segment.isGroup()) {
|
|
264895
|
+
continue;
|
|
264896
|
+
}
|
|
264897
|
+
let url = segment.url;
|
|
264898
|
+
if (!segment.leadEscaped && url === "$") {
|
|
264899
|
+
return null;
|
|
264900
|
+
}
|
|
264901
|
+
if (!segment.leadEscaped && url.startsWith("$")) {
|
|
264902
|
+
url = `:${url.slice(1)}`;
|
|
264903
|
+
}
|
|
264904
|
+
urlSegments.push(url);
|
|
264905
|
+
}
|
|
264906
|
+
return { path: `/${urlSegments.join("/")}`, name: pageName(urlSegments) };
|
|
264907
|
+
}
|
|
264908
|
+
function isServerOnly(source) {
|
|
264909
|
+
return SERVER_KEY.test(source) && !COMPONENT_KEY.test(source);
|
|
264910
|
+
}
|
|
264911
|
+
function byCodePoint2(a, b) {
|
|
264912
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
264913
|
+
}
|
|
264914
|
+
async function collectPages(projectRoot) {
|
|
264915
|
+
if (!await pathExists(join30(projectRoot, ROUTE_TREE))) {
|
|
264916
|
+
return null;
|
|
264917
|
+
}
|
|
264918
|
+
const routesDir = join30(projectRoot, ROUTES_DIR);
|
|
264919
|
+
const files = await pathExists(routesDir) ? await globby("**/*", {
|
|
264920
|
+
cwd: routesDir,
|
|
264921
|
+
onlyFiles: true,
|
|
264922
|
+
followSymbolicLinks: false
|
|
264923
|
+
}) : [];
|
|
264924
|
+
const byPath = new Map;
|
|
264925
|
+
for (const relativeFile of files.sort(byCodePoint2)) {
|
|
264926
|
+
const extension = ROUTE_EXTENSIONS.find((ext) => relativeFile.endsWith(ext));
|
|
264927
|
+
if (!extension || relativeFile.endsWith(".d.ts")) {
|
|
264928
|
+
continue;
|
|
264929
|
+
}
|
|
264930
|
+
const page = pageOfRouteFile(relativeFile.slice(0, -extension.length));
|
|
264931
|
+
if (page === null || byPath.has(page.path)) {
|
|
264932
|
+
continue;
|
|
264933
|
+
}
|
|
264934
|
+
if (isServerOnly(await readTextFile(join30(routesDir, relativeFile)))) {
|
|
264935
|
+
continue;
|
|
264936
|
+
}
|
|
264937
|
+
byPath.set(page.path, {
|
|
264938
|
+
name: page.name,
|
|
264939
|
+
file: `${ROUTES_DIR}/${relativeFile}`
|
|
264940
|
+
});
|
|
264941
|
+
}
|
|
264942
|
+
const taken = new Set;
|
|
264943
|
+
return [...byPath].sort(([a], [b]) => a === "/" ? -1 : b === "/" ? 1 : byCodePoint2(a, b)).map(([path, { name, file }]) => {
|
|
264944
|
+
let unique = name;
|
|
264945
|
+
for (let n = 2;taken.has(unique); n++) {
|
|
264946
|
+
unique = `${name}${n}`;
|
|
264947
|
+
}
|
|
264948
|
+
taken.add(unique);
|
|
264949
|
+
return { path, name: unique, file };
|
|
264950
|
+
});
|
|
264951
|
+
}
|
|
264952
|
+
|
|
264702
264953
|
// src/core/version/artifacts.ts
|
|
264703
264954
|
var MAX_FILE_COUNT = 50000;
|
|
264704
264955
|
var HASH_CONCURRENCY = 32;
|
|
@@ -264759,12 +265010,12 @@ async function readRawResources(dir) {
|
|
|
264759
265010
|
const payloads = {};
|
|
264760
265011
|
for (const relativePath of files.sort()) {
|
|
264761
265012
|
const name = relativePath.replace(/\.jsonc?$/, "");
|
|
264762
|
-
payloads[name] = await readJsonFile(
|
|
265013
|
+
payloads[name] = await readJsonFile(join31(dir, ...relativePath.split("/")));
|
|
264763
265014
|
}
|
|
264764
265015
|
return payloads;
|
|
264765
265016
|
}
|
|
264766
265017
|
async function readMcpConfig(configDir) {
|
|
264767
|
-
const path =
|
|
265018
|
+
const path = join31(configDir, "mcp", "config.json");
|
|
264768
265019
|
return await pathExists(path) ? await readTextFile(path) : "";
|
|
264769
265020
|
}
|
|
264770
265021
|
async function readAgentSkillFiles(dir) {
|
|
@@ -264778,30 +265029,32 @@ async function readAgentSkillFiles(dir) {
|
|
|
264778
265029
|
});
|
|
264779
265030
|
const skills = {};
|
|
264780
265031
|
for (const file of files.sort()) {
|
|
264781
|
-
skills[file.replace(/\.md$/, "")] = await readTextFile(
|
|
265032
|
+
skills[file.replace(/\.md$/, "")] = await readTextFile(join31(dir, file));
|
|
264782
265033
|
}
|
|
264783
265034
|
return skills;
|
|
264784
265035
|
}
|
|
264785
265036
|
async function collectResources(configDir, dirs) {
|
|
264786
265037
|
const [entities, agents, mcpConfig, agentSkills] = await Promise.all([
|
|
264787
|
-
readRawResources(
|
|
264788
|
-
readRawResources(
|
|
265038
|
+
readRawResources(join31(configDir, dirs.entitiesDir)),
|
|
265039
|
+
readRawResources(join31(configDir, dirs.agentsDir)),
|
|
264789
265040
|
readMcpConfig(configDir),
|
|
264790
|
-
readAgentSkillFiles(
|
|
265041
|
+
readAgentSkillFiles(join31(configDir, dirs.agentSkillsDir))
|
|
264791
265042
|
]);
|
|
264792
265043
|
return { entities, agents, mcpConfig, agentSkills };
|
|
264793
265044
|
}
|
|
264794
|
-
async function collectArtifacts(target) {
|
|
265045
|
+
async function collectArtifacts(target, options = {}) {
|
|
264795
265046
|
const built = await resolveFullStackBuild(target.root);
|
|
264796
265047
|
const siteWorker = built ? await describeSiteWorker(built) : null;
|
|
265048
|
+
const routes = await collectRoutes(target.root, options.routesFile);
|
|
264797
265049
|
return {
|
|
264798
265050
|
assets: built ? built.assetsDir ? await collectBuildOutput(built.assetsDir) : [] : await collectBuildOutput(target.outputDir, {
|
|
264799
265051
|
entryFile: ENTRY2
|
|
264800
265052
|
}),
|
|
264801
265053
|
...siteWorker ? { siteWorker } : {},
|
|
264802
|
-
backendBundles: await tagStep2("build", () => compileBackendBundles(target.root,
|
|
264803
|
-
actors: await tagStep2("build", () => compileActors(
|
|
264804
|
-
...await collectResources(target.configDir, target)
|
|
265054
|
+
backendBundles: await tagStep2("build", () => compileBackendBundles(target.root, join31(target.configDir, target.functionsDir))),
|
|
265055
|
+
actors: await tagStep2("build", () => compileActors(join31(target.configDir, target.actorsDir))),
|
|
265056
|
+
...await collectResources(target.configDir, target),
|
|
265057
|
+
...routes ? { routes } : {}
|
|
264805
265058
|
};
|
|
264806
265059
|
}
|
|
264807
265060
|
// src/core/version/gate.ts
|
|
@@ -264820,6 +265073,9 @@ function targetOption() {
|
|
|
264820
265073
|
function gitHashOption() {
|
|
264821
265074
|
return new Option2("--git-hash <hash>", "Commit the build came from (defaults to the checkout's HEAD)").argParser(parseGitHash);
|
|
264822
265075
|
}
|
|
265076
|
+
function routesFileOption() {
|
|
265077
|
+
return new Option2("--routes-file <path>", "The app's routes as JSON, instead of reading them from its route files");
|
|
265078
|
+
}
|
|
264823
265079
|
function concurrencyOption() {
|
|
264824
265080
|
return new Option2("--concurrency <n>", "Parallel file uploads").default(DEFAULT_VERSION_UPLOAD_CONCURRENCY).argParser((value) => {
|
|
264825
265081
|
const parsed = Number(value);
|
|
@@ -264844,7 +265100,7 @@ async function publishAction(ctx, options) {
|
|
|
264844
265100
|
}
|
|
264845
265101
|
const gitHash = await resolveProvenanceCommit(target.root, options.gitHash);
|
|
264846
265102
|
const result = await runTask("Publishing...", async (updateMessage) => {
|
|
264847
|
-
const artifacts = await tagStep2("create_version", () => collectArtifacts(target));
|
|
265103
|
+
const artifacts = await tagStep2("create_version", () => collectArtifacts(target, { routesFile: options.routesFile }));
|
|
264848
265104
|
return await publishVersion(artifacts, {
|
|
264849
265105
|
sourceCommit: gitHash,
|
|
264850
265106
|
target: options.target,
|
|
@@ -264865,7 +265121,7 @@ async function publishAction(ctx, options) {
|
|
|
264865
265121
|
};
|
|
264866
265122
|
}
|
|
264867
265123
|
function getPublishCommand() {
|
|
264868
|
-
return new Base44Command("publish").description("Build the app, record it as a version, and serve that version").option("--no-build", "Publish the existing build output without rebuilding").addOption(outputDirOption()).addOption(targetOption()).addOption(gitHashOption()).addOption(concurrencyOption()).action(publishAction);
|
|
265124
|
+
return new Base44Command("publish").description("Build the app, record it as a version, and serve that version").option("--no-build", "Publish the existing build output without rebuilding").addOption(outputDirOption()).addOption(targetOption()).addOption(gitHashOption()).addOption(concurrencyOption()).addOption(routesFileOption()).action(publishAction);
|
|
264869
265125
|
}
|
|
264870
265126
|
|
|
264871
265127
|
// src/core/resources/sandbox/schema.ts
|
|
@@ -265773,7 +266029,7 @@ async function prepareSessionImages(content) {
|
|
|
265773
266029
|
import { createReadStream as createReadStream3 } from "node:fs";
|
|
265774
266030
|
import { realpath, rm as rm3, stat as stat6 } from "node:fs/promises";
|
|
265775
266031
|
import { homedir as homedir4 } from "node:os";
|
|
265776
|
-
import { dirname as dirname23, join as
|
|
266032
|
+
import { dirname as dirname23, join as join32 } from "node:path";
|
|
265777
266033
|
import { createInterface as createInterface2 } from "node:readline";
|
|
265778
266034
|
|
|
265779
266035
|
// ../../node_modules/tmp-promise/index.js
|
|
@@ -265786,8 +266042,8 @@ var $dir = async (options) => dirWithOptions(options);
|
|
|
265786
266042
|
var $tmpName = promisify12(tmp.tmpName);
|
|
265787
266043
|
|
|
265788
266044
|
// src/core/session-import/sessions.ts
|
|
265789
|
-
var claudeDir = () => process.env.CLAUDE_CONFIG_DIR ||
|
|
265790
|
-
var codexDir = () => process.env.CODEX_HOME ||
|
|
266045
|
+
var claudeDir = () => process.env.CLAUDE_CONFIG_DIR || join32(homedir4(), ".claude");
|
|
266046
|
+
var codexDir = () => process.env.CODEX_HOME || join32(homedir4(), ".codex");
|
|
265791
266047
|
async function scanLines(path, pick, maxLines = Number.POSITIVE_INFINITY) {
|
|
265792
266048
|
const lines = createInterface2({ input: createReadStream3(path) });
|
|
265793
266049
|
let count = 0;
|
|
@@ -265943,7 +266199,7 @@ async function teleportSession(sessionId, cwd) {
|
|
|
265943
266199
|
throw new InvalidInputError("Run this from a folder with the app's GitHub repository, so the session can be checked out.");
|
|
265944
266200
|
}
|
|
265945
266201
|
const tmp = await $dir({ unsafeCleanup: true });
|
|
265946
|
-
const repo =
|
|
266202
|
+
const repo = join32(tmp.path, "repo");
|
|
265947
266203
|
let projectFolder;
|
|
265948
266204
|
try {
|
|
265949
266205
|
await execa("git", ["clone", "--quiet", origin.stdout, repo]);
|
|
@@ -266142,6 +266398,7 @@ async function deployToDeploymentsApi(ctx, project, options) {
|
|
|
266142
266398
|
outputDir,
|
|
266143
266399
|
gitHash,
|
|
266144
266400
|
concurrency: options.concurrency,
|
|
266401
|
+
overwrite: options.overwrite,
|
|
266145
266402
|
progress: {
|
|
266146
266403
|
onWarning: (message) => {
|
|
266147
266404
|
warnings.push(message);
|
|
@@ -266193,7 +266450,7 @@ function siteOutputDir(project) {
|
|
|
266193
266450
|
return resolve17(project.root, outputDirectory);
|
|
266194
266451
|
}
|
|
266195
266452
|
function getSiteDeployCommand() {
|
|
266196
|
-
return new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").option("--build", "Build the site before deploying (skips the prompt)").option("--no-build", "Deploy without building (skips the prompt)").option("--publish", "Serve this build in production once it is deployed").addOption(new Option2("--git-hash <hash>", "Deploy by the commit the build came from, through the deployments API").argParser(parseGitHash)).addOption(new Option2("--concurrency <n>", "Parallel asset uploads").default(DEFAULT_UPLOAD_CONCURRENCY).argParser(parseConcurrency)).action(deployAction2);
|
|
266453
|
+
return new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").option("--build", "Build the site before deploying (skips the prompt)").option("--no-build", "Deploy without building (skips the prompt)").option("--publish", "Serve this build in production once it is deployed").option("--overwrite", "Replace the build the commit already has (with --git-hash)").addOption(new Option2("--git-hash <hash>", "Deploy by the commit the build came from, through the deployments API").argParser(parseGitHash)).addOption(new Option2("--concurrency <n>", "Parallel asset uploads").default(DEFAULT_UPLOAD_CONCURRENCY).argParser(parseConcurrency)).action(deployAction2);
|
|
266197
266454
|
}
|
|
266198
266455
|
function parseConcurrency(value) {
|
|
266199
266456
|
const parsed = Number(value);
|
|
@@ -266531,10 +266788,10 @@ function toPascalCase(name) {
|
|
|
266531
266788
|
return name.split(/[-_\s]+/).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("");
|
|
266532
266789
|
}
|
|
266533
266790
|
// src/core/types/update-project.ts
|
|
266534
|
-
import { join as
|
|
266791
|
+
import { join as join36 } from "node:path";
|
|
266535
266792
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
266536
266793
|
async function updateProjectConfig(projectRoot) {
|
|
266537
|
-
const tsconfigPath =
|
|
266794
|
+
const tsconfigPath = join36(projectRoot, "tsconfig.json");
|
|
266538
266795
|
if (!await pathExists(tsconfigPath)) {
|
|
266539
266796
|
return false;
|
|
266540
266797
|
}
|
|
@@ -266590,7 +266847,7 @@ async function createAction2(ctx, options) {
|
|
|
266590
266847
|
outputDir: options.outputDir
|
|
266591
266848
|
});
|
|
266592
266849
|
const gitHash = await resolveProvenanceCommit(target.root, options.gitHash);
|
|
266593
|
-
const version = await runTask("Creating version...", async (updateMessage) => await createVersion(await collectArtifacts(target), {
|
|
266850
|
+
const version = await runTask("Creating version...", async (updateMessage) => await createVersion(await collectArtifacts(target, { routesFile: options.routesFile }), {
|
|
266594
266851
|
sourceCommit: gitHash,
|
|
266595
266852
|
concurrency: options.concurrency,
|
|
266596
266853
|
progress: {
|
|
@@ -266608,7 +266865,7 @@ async function createAction2(ctx, options) {
|
|
|
266608
266865
|
};
|
|
266609
266866
|
}
|
|
266610
266867
|
function getVersionCreateCommand() {
|
|
266611
|
-
return new Base44Command("create").description("Record the built output as a version, without deploying it").addOption(outputDirOption()).addOption(gitHashOption()).addOption(concurrencyOption()).action(createAction2);
|
|
266868
|
+
return new Base44Command("create").description("Record the built output as a version, without deploying it").addOption(outputDirOption()).addOption(gitHashOption()).addOption(concurrencyOption()).addOption(routesFileOption()).action(createAction2);
|
|
266612
266869
|
}
|
|
266613
266870
|
|
|
266614
266871
|
// src/cli/commands/versions/deploy.ts
|
|
@@ -267015,7 +267272,7 @@ function getWorkspaceCommand() {
|
|
|
267015
267272
|
// src/cli/dev/dev-server/main.ts
|
|
267016
267273
|
var import_cors = __toESM(require_lib4(), 1);
|
|
267017
267274
|
var import_express6 = __toESM(require_express(), 1);
|
|
267018
|
-
import { dirname as dirname29, join as
|
|
267275
|
+
import { dirname as dirname29, join as join41 } from "node:path";
|
|
267019
267276
|
|
|
267020
267277
|
// ../../node_modules/get-port/index.js
|
|
267021
267278
|
import net from "node:net";
|
|
@@ -267136,7 +267393,7 @@ var import_http_proxy_middleware2 = __toESM(require_dist2(), 1);
|
|
|
267136
267393
|
|
|
267137
267394
|
// src/cli/dev/dev-server/function-manager.ts
|
|
267138
267395
|
import { spawn as spawn3 } from "node:child_process";
|
|
267139
|
-
import { dirname as dirname26, join as
|
|
267396
|
+
import { dirname as dirname26, join as join37 } from "node:path";
|
|
267140
267397
|
import { pathToFileURL as pathToFileURL6 } from "node:url";
|
|
267141
267398
|
|
|
267142
267399
|
// src/cli/dev/dev-server/base-function-manager.ts
|
|
@@ -267241,7 +267498,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
267241
267498
|
}
|
|
267242
267499
|
spawnFunction(func, port) {
|
|
267243
267500
|
this.logger.log(`Spawning function "${func.name}" on port ${port}`);
|
|
267244
|
-
const importMapPath =
|
|
267501
|
+
const importMapPath = join37(dirname26(this.wrapperPath), "import-map.json");
|
|
267245
267502
|
const process2 = spawn3("deno", ["run", "--allow-all", "--import-map", importMapPath, this.wrapperPath], {
|
|
267246
267503
|
env: {
|
|
267247
267504
|
...globalThis.process.env,
|
|
@@ -267315,7 +267572,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
267315
267572
|
import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
267316
267573
|
import { isBuiltin as isBuiltin3 } from "node:module";
|
|
267317
267574
|
import { homedir as homedir5 } from "node:os";
|
|
267318
|
-
import { join as
|
|
267575
|
+
import { join as join38 } from "node:path";
|
|
267319
267576
|
import { pathToFileURL as pathToFileURL7 } from "node:url";
|
|
267320
267577
|
var depsPromise;
|
|
267321
267578
|
function loadDeps() {
|
|
@@ -267436,9 +267693,9 @@ export default {
|
|
|
267436
267693
|
};
|
|
267437
267694
|
`;
|
|
267438
267695
|
function ensureBundlerConfig() {
|
|
267439
|
-
const dir =
|
|
267696
|
+
const dir = join38(homedir5(), ".base44", "function-bundler");
|
|
267440
267697
|
mkdirSync2(dir, { recursive: true });
|
|
267441
|
-
const configPath =
|
|
267698
|
+
const configPath = join38(dir, "deno.json");
|
|
267442
267699
|
writeFileSync2(configPath, `${JSON.stringify({ nodeModulesDir: "auto" }, null, 2)}
|
|
267443
267700
|
`);
|
|
267444
267701
|
return configPath;
|
|
@@ -270767,8 +271024,8 @@ async function createDevServer(options) {
|
|
|
270767
271024
|
broadcastEntityEvent(io, appId, entityName, event);
|
|
270768
271025
|
};
|
|
270769
271026
|
const base44ConfigWatcher = new WatchBase44({
|
|
270770
|
-
functions:
|
|
270771
|
-
entities:
|
|
271027
|
+
functions: join41(dirname29(project.configPath), project.functionsDir),
|
|
271028
|
+
entities: join41(dirname29(project.configPath), project.entitiesDir)
|
|
270772
271029
|
}, devLogger);
|
|
270773
271030
|
base44ConfigWatcher.on("change", async (name) => {
|
|
270774
271031
|
try {
|
|
@@ -270971,7 +271228,7 @@ function readExecEnvTarget(env = process.env) {
|
|
|
270971
271228
|
// src/core/exec/run-script.ts
|
|
270972
271229
|
import { spawn as spawn4 } from "node:child_process";
|
|
270973
271230
|
import { readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "node:fs";
|
|
270974
|
-
import { join as
|
|
271231
|
+
import { join as join42 } from "node:path";
|
|
270975
271232
|
var SDK_SPECIFIER = '"npm:@base44/sdk"';
|
|
270976
271233
|
function wrapperSource(sdkVersion) {
|
|
270977
271234
|
const source = readFileSync4(getExecWrapperPath(), "utf-8");
|
|
@@ -271018,7 +271275,7 @@ async function runScript(options) {
|
|
|
271018
271275
|
writeFileSync3(tempWrapper.path, wrapperSource(sdkVersion), "utf-8");
|
|
271019
271276
|
const configDir = await $dir({ unsafeCleanup: true });
|
|
271020
271277
|
cleanupFns.push(configDir.cleanup);
|
|
271021
|
-
const configPath =
|
|
271278
|
+
const configPath = join42(configDir.path, "deno.json");
|
|
271022
271279
|
writeFileSync3(configPath, JSON.stringify(DENO_CONFIG), "utf-8");
|
|
271023
271280
|
try {
|
|
271024
271281
|
const exitCode = await new Promise((resolvePromise) => {
|
|
@@ -275310,7 +275567,7 @@ function addCommandInfoToErrorReporter(program, errorReporter) {
|
|
|
275310
275567
|
// src/cli/index.ts
|
|
275311
275568
|
var __dirname4 = dirname31(fileURLToPath7(import.meta.url));
|
|
275312
275569
|
async function runCLI(options) {
|
|
275313
|
-
ensureNpmAssets(
|
|
275570
|
+
ensureNpmAssets(join43(__dirname4, "../assets"));
|
|
275314
275571
|
const errorReporter = new ErrorReporter;
|
|
275315
275572
|
errorReporter.registerProcessErrorHandlers();
|
|
275316
275573
|
const jsonMode = process.argv.includes("--json");
|
|
@@ -275349,4 +275606,4 @@ export {
|
|
|
275349
275606
|
runCLI
|
|
275350
275607
|
};
|
|
275351
275608
|
|
|
275352
|
-
//# debugId=
|
|
275609
|
+
//# debugId=427BD69CACE6446D64756E2164756E21
|