@base44-preview/cli 0.3.4-pr.702.1894d21 → 0.3.5-pr.703.0e7d6f3
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 +310 -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);
|
|
@@ -228045,6 +228045,14 @@ function object(shape, params) {
|
|
|
228045
228045
|
};
|
|
228046
228046
|
return new ZodObject(def);
|
|
228047
228047
|
}
|
|
228048
|
+
function strictObject(shape, params) {
|
|
228049
|
+
return new ZodObject({
|
|
228050
|
+
type: "object",
|
|
228051
|
+
shape,
|
|
228052
|
+
catchall: never(),
|
|
228053
|
+
...normalizeParams(params)
|
|
228054
|
+
});
|
|
228055
|
+
}
|
|
228048
228056
|
function looseObject(shape, params) {
|
|
228049
228057
|
return new ZodObject({
|
|
228050
228058
|
type: "object",
|
|
@@ -228529,6 +228537,20 @@ class AppNotPublishedError extends UserError {
|
|
|
228529
228537
|
});
|
|
228530
228538
|
}
|
|
228531
228539
|
}
|
|
228540
|
+
|
|
228541
|
+
class DeploymentExistsError extends UserError {
|
|
228542
|
+
code = "DEPLOYMENT_EXISTS";
|
|
228543
|
+
constructor(gitHash, options) {
|
|
228544
|
+
super(`Commit ${gitHash.slice(0, 12)} already has a different build, so this one was not deployed`, {
|
|
228545
|
+
hints: options?.hints ?? [
|
|
228546
|
+
{
|
|
228547
|
+
message: "Run the same command again with --overwrite to replace that build, or commit your changes and deploy the new commit"
|
|
228548
|
+
}
|
|
228549
|
+
],
|
|
228550
|
+
cause: options?.cause
|
|
228551
|
+
});
|
|
228552
|
+
}
|
|
228553
|
+
}
|
|
228532
228554
|
var MAX_RESPONSE_TEXT_CHARS = 500;
|
|
228533
228555
|
async function readResponseText(response) {
|
|
228534
228556
|
try {
|
|
@@ -228875,7 +228897,7 @@ function normalizeBase44Env() {
|
|
|
228875
228897
|
loadProjectEnvFiles();
|
|
228876
228898
|
|
|
228877
228899
|
// src/cli/index.ts
|
|
228878
|
-
import { dirname as dirname31, join as
|
|
228900
|
+
import { dirname as dirname31, join as join43 } from "node:path";
|
|
228879
228901
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
228880
228902
|
|
|
228881
228903
|
// ../../node_modules/@clack/core/dist/index.mjs
|
|
@@ -236614,6 +236636,9 @@ var DeployResponseSchema = object({
|
|
|
236614
236636
|
var PublishedUrlResponseSchema = object({
|
|
236615
236637
|
url: string2()
|
|
236616
236638
|
});
|
|
236639
|
+
var DeploymentExistsRefusalSchema = object({
|
|
236640
|
+
error: object({ code: literal("deployment_already_exists") })
|
|
236641
|
+
});
|
|
236617
236642
|
var CreateDeploymentResponseSchema = object({
|
|
236618
236643
|
deployment_id: string2(),
|
|
236619
236644
|
session_id: string2(),
|
|
@@ -239447,7 +239472,7 @@ import { join as join13 } from "node:path";
|
|
|
239447
239472
|
// package.json
|
|
239448
239473
|
var package_default = {
|
|
239449
239474
|
name: "base44",
|
|
239450
|
-
version: "0.3.
|
|
239475
|
+
version: "0.3.5",
|
|
239451
239476
|
description: "Base44 CLI - Unified interface for managing Base44 applications",
|
|
239452
239477
|
type: "module",
|
|
239453
239478
|
bin: {
|
|
@@ -239714,7 +239739,11 @@ async function createDeployment(request) {
|
|
|
239714
239739
|
timeout: 120000
|
|
239715
239740
|
});
|
|
239716
239741
|
} catch (error) {
|
|
239717
|
-
|
|
239742
|
+
const apiError = await ApiError.fromHttpError(error, "creating deployment");
|
|
239743
|
+
if (apiError.statusCode === 409 && DeploymentExistsRefusalSchema.safeParse(apiError.responseBody).success) {
|
|
239744
|
+
throw new DeploymentExistsError(request.git_hash, { cause: apiError });
|
|
239745
|
+
}
|
|
239746
|
+
throw apiError;
|
|
239718
239747
|
}
|
|
239719
239748
|
const result = CreateDeploymentResponseSchema.safeParse(await response.json());
|
|
239720
239749
|
if (!result.success) {
|
|
@@ -240351,7 +240380,7 @@ async function putPresignedBody(upload, body) {
|
|
|
240351
240380
|
// src/core/site/deployment.ts
|
|
240352
240381
|
var NO_ASSETS = { manifest: {}, filesByHash: new Map };
|
|
240353
240382
|
async function deployToDeployments(options) {
|
|
240354
|
-
const { projectRoot, outputDir, gitHash, concurrency, progress } = options;
|
|
240383
|
+
const { projectRoot, outputDir, gitHash, concurrency, overwrite, progress } = options;
|
|
240355
240384
|
const worker = await resolveWorkerBuild(projectRoot, progress);
|
|
240356
240385
|
const assetsDir = worker ? worker.assetsDir : outputDir;
|
|
240357
240386
|
const assets = assetsDir ? await buildAssetManifest(assetsDir, getAppContext().id) : NO_ASSETS;
|
|
@@ -240361,7 +240390,8 @@ async function deployToDeployments(options) {
|
|
|
240361
240390
|
const created = await createDeployment({
|
|
240362
240391
|
git_hash: gitHash,
|
|
240363
240392
|
config: worker?.config,
|
|
240364
|
-
asset_manifest: assets.manifest
|
|
240393
|
+
asset_manifest: assets.manifest,
|
|
240394
|
+
overwrite
|
|
240365
240395
|
});
|
|
240366
240396
|
const completionJwt = await uploadDeploymentAssets(created.assetUploads, assets, { concurrency, progress });
|
|
240367
240397
|
const completion = worker ? { kind: "worker", modules: worker.modules, completionJwt } : await resolveStaticCompletion(assetsDir, assets, created.indexHtmlStaged);
|
|
@@ -247064,6 +247094,7 @@ async function shipCommit(projectRoot, outputDir, gitHash, options) {
|
|
|
247064
247094
|
projectRoot,
|
|
247065
247095
|
outputDir,
|
|
247066
247096
|
gitHash,
|
|
247097
|
+
overwrite: options?.overwrite,
|
|
247067
247098
|
progress: {
|
|
247068
247099
|
onWarning: (message) => options?.onSiteProgress?.(message),
|
|
247069
247100
|
onAssets: ({ totalAssets, newAssets }) => options?.onSiteProgress?.(`Found ${totalAssets} static assets (${newAssets} new)`)
|
|
@@ -252184,6 +252215,7 @@ ${summaryLines.join(`
|
|
|
252184
252215
|
let actorCompleted = 0;
|
|
252185
252216
|
const result = await deployAll(projectData, {
|
|
252186
252217
|
gitHash: options.gitHash,
|
|
252218
|
+
overwrite: options.overwrite,
|
|
252187
252219
|
onSiteProgress: (message) => {
|
|
252188
252220
|
log.message(theme.styles.dim(message));
|
|
252189
252221
|
},
|
|
@@ -252225,7 +252257,7 @@ ${summaryLines.join(`
|
|
|
252225
252257
|
return { outroMessage: "App deployed successfully" };
|
|
252226
252258
|
}
|
|
252227
252259
|
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);
|
|
252260
|
+
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
252261
|
}
|
|
252230
252262
|
async function handleOAuthConnectors(connectorResults, isNonInteractive, options, log) {
|
|
252231
252263
|
const needsOAuth = filterPendingOAuth(connectorResults);
|
|
@@ -252845,6 +252877,33 @@ function declaredActor({
|
|
|
252845
252877
|
static_egress: staticEgress
|
|
252846
252878
|
};
|
|
252847
252879
|
}
|
|
252880
|
+
function declaredRoutes({
|
|
252881
|
+
pages,
|
|
252882
|
+
home,
|
|
252883
|
+
entityPages,
|
|
252884
|
+
entityFreePaths
|
|
252885
|
+
}) {
|
|
252886
|
+
return {
|
|
252887
|
+
pages: pages.map(({ path, name, file, requiresAuth, binding, segmentValues }) => ({
|
|
252888
|
+
path,
|
|
252889
|
+
name,
|
|
252890
|
+
file,
|
|
252891
|
+
...requiresAuth ? { requires_auth: true } : {},
|
|
252892
|
+
...binding ? {
|
|
252893
|
+
binding: {
|
|
252894
|
+
entity: binding.entity,
|
|
252895
|
+
param: binding.param,
|
|
252896
|
+
field: binding.field,
|
|
252897
|
+
...binding.extraParams ? { extra_params: binding.extraParams } : {}
|
|
252898
|
+
}
|
|
252899
|
+
} : {},
|
|
252900
|
+
...segmentValues ? { segment_values: segmentValues } : {}
|
|
252901
|
+
})),
|
|
252902
|
+
home,
|
|
252903
|
+
...entityPages ? { entity_pages: entityPages } : {},
|
|
252904
|
+
...entityFreePaths ? { entity_free_paths: entityFreePaths } : {}
|
|
252905
|
+
};
|
|
252906
|
+
}
|
|
252848
252907
|
function actorUploadPath(actor) {
|
|
252849
252908
|
return `actors/${actor.name}.mjs`;
|
|
252850
252909
|
}
|
|
@@ -252907,6 +252966,7 @@ async function createVersion(artifacts, options = {}) {
|
|
|
252907
252966
|
agents: artifacts.agents,
|
|
252908
252967
|
mcp_config: artifacts.mcpConfig,
|
|
252909
252968
|
agent_skills: artifacts.agentSkills,
|
|
252969
|
+
...artifacts.routes ? { routes: declaredRoutes(artifacts.routes) } : {},
|
|
252910
252970
|
source_commit: options.sourceCommit
|
|
252911
252971
|
}, "declaring a version")).json(), "declare");
|
|
252912
252972
|
const declaredFiles = [
|
|
@@ -252952,7 +253012,7 @@ async function setEnvironmentVersion(environment, versionId, options = {}) {
|
|
|
252952
253012
|
}
|
|
252953
253013
|
// src/core/version/artifacts.ts
|
|
252954
253014
|
import { createHash as createHash3 } from "node:crypto";
|
|
252955
|
-
import { join as
|
|
253015
|
+
import { join as join31, resolve as resolve14 } from "node:path";
|
|
252956
253016
|
|
|
252957
253017
|
// src/core/version/actors.ts
|
|
252958
253018
|
import { dirname as dirname22, relative as relative7, resolve as resolve13 } from "node:path";
|
|
@@ -264699,6 +264759,205 @@ async function publishVersion(artifacts, options = {}) {
|
|
|
264699
264759
|
};
|
|
264700
264760
|
}
|
|
264701
264761
|
|
|
264762
|
+
// src/core/version/routes.ts
|
|
264763
|
+
import { join as join30 } from "node:path";
|
|
264764
|
+
var RoutesFileSchema = strictObject({
|
|
264765
|
+
pages: array(strictObject({
|
|
264766
|
+
path: string2().startsWith("/"),
|
|
264767
|
+
name: string2().min(1),
|
|
264768
|
+
file: string2().min(1),
|
|
264769
|
+
requires_auth: boolean2().optional(),
|
|
264770
|
+
binding: strictObject({
|
|
264771
|
+
entity: string2().min(1),
|
|
264772
|
+
param: string2().min(1),
|
|
264773
|
+
field: string2().min(1),
|
|
264774
|
+
extra_params: record(string2(), string2()).optional()
|
|
264775
|
+
}).optional(),
|
|
264776
|
+
segment_values: record(string2(), array(string2())).optional()
|
|
264777
|
+
})),
|
|
264778
|
+
home: string2().nullable().optional(),
|
|
264779
|
+
entity_pages: record(string2(), array(string2())).optional(),
|
|
264780
|
+
entity_free_paths: array(string2()).optional()
|
|
264781
|
+
}).transform((data) => ({
|
|
264782
|
+
pages: data.pages.map((page) => ({
|
|
264783
|
+
path: page.path,
|
|
264784
|
+
name: page.name,
|
|
264785
|
+
file: page.file,
|
|
264786
|
+
...page.requires_auth ? { requiresAuth: true } : {},
|
|
264787
|
+
...page.binding ? {
|
|
264788
|
+
binding: {
|
|
264789
|
+
entity: page.binding.entity,
|
|
264790
|
+
param: page.binding.param,
|
|
264791
|
+
field: page.binding.field,
|
|
264792
|
+
...page.binding.extra_params ? { extraParams: page.binding.extra_params } : {}
|
|
264793
|
+
}
|
|
264794
|
+
} : {},
|
|
264795
|
+
...page.segment_values ? { segmentValues: page.segment_values } : {}
|
|
264796
|
+
})),
|
|
264797
|
+
home: data.home ?? null,
|
|
264798
|
+
...data.entity_pages ? { entityPages: data.entity_pages } : {},
|
|
264799
|
+
...data.entity_free_paths ? { entityFreePaths: data.entity_free_paths } : {}
|
|
264800
|
+
}));
|
|
264801
|
+
async function readRoutesFile(path) {
|
|
264802
|
+
const parsed = RoutesFileSchema.safeParse(await readJsonFile(path));
|
|
264803
|
+
if (!parsed.success) {
|
|
264804
|
+
throw new SchemaValidationError("Invalid routes file", parsed.error, path);
|
|
264805
|
+
}
|
|
264806
|
+
return parsed.data;
|
|
264807
|
+
}
|
|
264808
|
+
async function collectRoutes(projectRoot, routesFile) {
|
|
264809
|
+
if (routesFile) {
|
|
264810
|
+
return await readRoutesFile(routesFile);
|
|
264811
|
+
}
|
|
264812
|
+
const pages = await collectPages(projectRoot);
|
|
264813
|
+
return pages ? { pages, home: pages[0]?.name ?? null } : null;
|
|
264814
|
+
}
|
|
264815
|
+
var ROUTES_DIR = "src/routes";
|
|
264816
|
+
var ROUTE_TREE = "src/routeTree.gen.ts";
|
|
264817
|
+
var ROUTE_EXTENSIONS = [".tsx", ".ts", ".jsx", ".js"];
|
|
264818
|
+
var DOT_SPLIT = /\.(?![^[]*\])/;
|
|
264819
|
+
var BRACKETS = /\[([^\]]*)\]/g;
|
|
264820
|
+
var BRACE_PARAM = /\{(-?)\$([^{}[\]]+)\}(?![^[]*\])/;
|
|
264821
|
+
var COMPANION_SUFFIXES = new Set([
|
|
264822
|
+
"component",
|
|
264823
|
+
"errorComponent",
|
|
264824
|
+
"notFoundComponent",
|
|
264825
|
+
"pendingComponent",
|
|
264826
|
+
"loader"
|
|
264827
|
+
]);
|
|
264828
|
+
var SERVER_KEY = /\bserver\s*:\s*\{/;
|
|
264829
|
+
var COMPONENT_KEY = /\bcomponent['"]?\s*[:,}(]/;
|
|
264830
|
+
|
|
264831
|
+
class Segment {
|
|
264832
|
+
text;
|
|
264833
|
+
url;
|
|
264834
|
+
leadEscaped;
|
|
264835
|
+
literal;
|
|
264836
|
+
constructor(raw) {
|
|
264837
|
+
this.text = raw.replace(BRACKETS, "$1");
|
|
264838
|
+
this.leadEscaped = raw.startsWith("[");
|
|
264839
|
+
this.literal = raw === this.text;
|
|
264840
|
+
const name = raw.length > 1 && raw.endsWith("_") ? raw.slice(0, -1) : raw;
|
|
264841
|
+
const param = BRACE_PARAM.exec(name);
|
|
264842
|
+
this.url = param ? `:${param[2]}${param[1] ? "?" : ""}` : name.replace(BRACKETS, "$1");
|
|
264843
|
+
}
|
|
264844
|
+
isToken(...tokens) {
|
|
264845
|
+
return this.literal && tokens.includes(this.text);
|
|
264846
|
+
}
|
|
264847
|
+
isPathless() {
|
|
264848
|
+
return !this.leadEscaped && this.text.startsWith("_");
|
|
264849
|
+
}
|
|
264850
|
+
isGroup() {
|
|
264851
|
+
return !this.leadEscaped && this.text.startsWith("(") && this.text.endsWith(")");
|
|
264852
|
+
}
|
|
264853
|
+
}
|
|
264854
|
+
function segmentsOf(relativePath) {
|
|
264855
|
+
const segments = [];
|
|
264856
|
+
for (const name of relativePath.split("/")) {
|
|
264857
|
+
if (name.startsWith("-")) {
|
|
264858
|
+
return null;
|
|
264859
|
+
}
|
|
264860
|
+
for (const raw of name.split(DOT_SPLIT)) {
|
|
264861
|
+
if (!raw) {
|
|
264862
|
+
continue;
|
|
264863
|
+
}
|
|
264864
|
+
const segment = new Segment(raw);
|
|
264865
|
+
if (!segment.text || !segment.leadEscaped && segment.text.startsWith("__")) {
|
|
264866
|
+
return null;
|
|
264867
|
+
}
|
|
264868
|
+
segments.push(segment);
|
|
264869
|
+
}
|
|
264870
|
+
}
|
|
264871
|
+
return segments.length > 0 ? segments : null;
|
|
264872
|
+
}
|
|
264873
|
+
function pageName(parts) {
|
|
264874
|
+
if (parts.length === 0) {
|
|
264875
|
+
return "Home";
|
|
264876
|
+
}
|
|
264877
|
+
return parts.flatMap((part) => part.split(/[^A-Za-z0-9]/)).filter(Boolean).map((piece) => piece.charAt(0).toUpperCase() + piece.slice(1)).join("");
|
|
264878
|
+
}
|
|
264879
|
+
function pageOfRouteFile(relativePath) {
|
|
264880
|
+
const segments = segmentsOf(relativePath);
|
|
264881
|
+
if (segments === null || segments[0].isToken("api")) {
|
|
264882
|
+
return null;
|
|
264883
|
+
}
|
|
264884
|
+
if (segments[segments.length - 1].isToken("lazy")) {
|
|
264885
|
+
segments.pop();
|
|
264886
|
+
}
|
|
264887
|
+
const last = () => segments[segments.length - 1];
|
|
264888
|
+
if (last()?.isToken(...COMPANION_SUFFIXES)) {
|
|
264889
|
+
return null;
|
|
264890
|
+
}
|
|
264891
|
+
let poppedIndex = false;
|
|
264892
|
+
while (last()?.isToken("index", "route")) {
|
|
264893
|
+
poppedIndex ||= last()?.text === "index";
|
|
264894
|
+
segments.pop();
|
|
264895
|
+
}
|
|
264896
|
+
const end = last();
|
|
264897
|
+
if (end && !poppedIndex && (end.isPathless() || end.isGroup())) {
|
|
264898
|
+
return null;
|
|
264899
|
+
}
|
|
264900
|
+
const urlSegments = [];
|
|
264901
|
+
for (const segment of segments) {
|
|
264902
|
+
if (segment.isPathless() || segment.isGroup()) {
|
|
264903
|
+
continue;
|
|
264904
|
+
}
|
|
264905
|
+
let url = segment.url;
|
|
264906
|
+
if (!segment.leadEscaped && url === "$") {
|
|
264907
|
+
return null;
|
|
264908
|
+
}
|
|
264909
|
+
if (!segment.leadEscaped && url.startsWith("$")) {
|
|
264910
|
+
url = `:${url.slice(1)}`;
|
|
264911
|
+
}
|
|
264912
|
+
urlSegments.push(url);
|
|
264913
|
+
}
|
|
264914
|
+
return { path: `/${urlSegments.join("/")}`, name: pageName(urlSegments) };
|
|
264915
|
+
}
|
|
264916
|
+
function isServerOnly(source) {
|
|
264917
|
+
return SERVER_KEY.test(source) && !COMPONENT_KEY.test(source);
|
|
264918
|
+
}
|
|
264919
|
+
function byCodePoint2(a, b) {
|
|
264920
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
264921
|
+
}
|
|
264922
|
+
async function collectPages(projectRoot) {
|
|
264923
|
+
if (!await pathExists(join30(projectRoot, ROUTE_TREE))) {
|
|
264924
|
+
return null;
|
|
264925
|
+
}
|
|
264926
|
+
const routesDir = join30(projectRoot, ROUTES_DIR);
|
|
264927
|
+
const files = await pathExists(routesDir) ? await globby("**/*", {
|
|
264928
|
+
cwd: routesDir,
|
|
264929
|
+
onlyFiles: true,
|
|
264930
|
+
followSymbolicLinks: false
|
|
264931
|
+
}) : [];
|
|
264932
|
+
const byPath = new Map;
|
|
264933
|
+
for (const relativeFile of files.sort(byCodePoint2)) {
|
|
264934
|
+
const extension = ROUTE_EXTENSIONS.find((ext) => relativeFile.endsWith(ext));
|
|
264935
|
+
if (!extension || relativeFile.endsWith(".d.ts")) {
|
|
264936
|
+
continue;
|
|
264937
|
+
}
|
|
264938
|
+
const page = pageOfRouteFile(relativeFile.slice(0, -extension.length));
|
|
264939
|
+
if (page === null || byPath.has(page.path)) {
|
|
264940
|
+
continue;
|
|
264941
|
+
}
|
|
264942
|
+
if (isServerOnly(await readTextFile(join30(routesDir, relativeFile)))) {
|
|
264943
|
+
continue;
|
|
264944
|
+
}
|
|
264945
|
+
byPath.set(page.path, {
|
|
264946
|
+
name: page.name,
|
|
264947
|
+
file: `${ROUTES_DIR}/${relativeFile}`
|
|
264948
|
+
});
|
|
264949
|
+
}
|
|
264950
|
+
const taken = new Set;
|
|
264951
|
+
return [...byPath].sort(([a], [b]) => a === "/" ? -1 : b === "/" ? 1 : byCodePoint2(a, b)).map(([path, { name, file }]) => {
|
|
264952
|
+
let unique = name;
|
|
264953
|
+
for (let n = 2;taken.has(unique); n++) {
|
|
264954
|
+
unique = `${name}${n}`;
|
|
264955
|
+
}
|
|
264956
|
+
taken.add(unique);
|
|
264957
|
+
return { path, name: unique, file };
|
|
264958
|
+
});
|
|
264959
|
+
}
|
|
264960
|
+
|
|
264702
264961
|
// src/core/version/artifacts.ts
|
|
264703
264962
|
var MAX_FILE_COUNT = 50000;
|
|
264704
264963
|
var HASH_CONCURRENCY = 32;
|
|
@@ -264759,12 +265018,12 @@ async function readRawResources(dir) {
|
|
|
264759
265018
|
const payloads = {};
|
|
264760
265019
|
for (const relativePath of files.sort()) {
|
|
264761
265020
|
const name = relativePath.replace(/\.jsonc?$/, "");
|
|
264762
|
-
payloads[name] = await readJsonFile(
|
|
265021
|
+
payloads[name] = await readJsonFile(join31(dir, ...relativePath.split("/")));
|
|
264763
265022
|
}
|
|
264764
265023
|
return payloads;
|
|
264765
265024
|
}
|
|
264766
265025
|
async function readMcpConfig(configDir) {
|
|
264767
|
-
const path =
|
|
265026
|
+
const path = join31(configDir, "mcp", "config.json");
|
|
264768
265027
|
return await pathExists(path) ? await readTextFile(path) : "";
|
|
264769
265028
|
}
|
|
264770
265029
|
async function readAgentSkillFiles(dir) {
|
|
@@ -264778,30 +265037,32 @@ async function readAgentSkillFiles(dir) {
|
|
|
264778
265037
|
});
|
|
264779
265038
|
const skills = {};
|
|
264780
265039
|
for (const file of files.sort()) {
|
|
264781
|
-
skills[file.replace(/\.md$/, "")] = await readTextFile(
|
|
265040
|
+
skills[file.replace(/\.md$/, "")] = await readTextFile(join31(dir, file));
|
|
264782
265041
|
}
|
|
264783
265042
|
return skills;
|
|
264784
265043
|
}
|
|
264785
265044
|
async function collectResources(configDir, dirs) {
|
|
264786
265045
|
const [entities, agents, mcpConfig, agentSkills] = await Promise.all([
|
|
264787
|
-
readRawResources(
|
|
264788
|
-
readRawResources(
|
|
265046
|
+
readRawResources(join31(configDir, dirs.entitiesDir)),
|
|
265047
|
+
readRawResources(join31(configDir, dirs.agentsDir)),
|
|
264789
265048
|
readMcpConfig(configDir),
|
|
264790
|
-
readAgentSkillFiles(
|
|
265049
|
+
readAgentSkillFiles(join31(configDir, dirs.agentSkillsDir))
|
|
264791
265050
|
]);
|
|
264792
265051
|
return { entities, agents, mcpConfig, agentSkills };
|
|
264793
265052
|
}
|
|
264794
|
-
async function collectArtifacts(target) {
|
|
265053
|
+
async function collectArtifacts(target, options = {}) {
|
|
264795
265054
|
const built = await resolveFullStackBuild(target.root);
|
|
264796
265055
|
const siteWorker = built ? await describeSiteWorker(built) : null;
|
|
265056
|
+
const routes = await collectRoutes(target.root, options.routesFile);
|
|
264797
265057
|
return {
|
|
264798
265058
|
assets: built ? built.assetsDir ? await collectBuildOutput(built.assetsDir) : [] : await collectBuildOutput(target.outputDir, {
|
|
264799
265059
|
entryFile: ENTRY2
|
|
264800
265060
|
}),
|
|
264801
265061
|
...siteWorker ? { siteWorker } : {},
|
|
264802
|
-
backendBundles: await tagStep2("build", () => compileBackendBundles(target.root,
|
|
264803
|
-
actors: await tagStep2("build", () => compileActors(
|
|
264804
|
-
...await collectResources(target.configDir, target)
|
|
265062
|
+
backendBundles: await tagStep2("build", () => compileBackendBundles(target.root, join31(target.configDir, target.functionsDir))),
|
|
265063
|
+
actors: await tagStep2("build", () => compileActors(join31(target.configDir, target.actorsDir))),
|
|
265064
|
+
...await collectResources(target.configDir, target),
|
|
265065
|
+
...routes ? { routes } : {}
|
|
264805
265066
|
};
|
|
264806
265067
|
}
|
|
264807
265068
|
// src/core/version/gate.ts
|
|
@@ -264820,6 +265081,9 @@ function targetOption() {
|
|
|
264820
265081
|
function gitHashOption() {
|
|
264821
265082
|
return new Option2("--git-hash <hash>", "Commit the build came from (defaults to the checkout's HEAD)").argParser(parseGitHash);
|
|
264822
265083
|
}
|
|
265084
|
+
function routesFileOption() {
|
|
265085
|
+
return new Option2("--routes-file <path>", "The app's routes as JSON, instead of reading them from its route files");
|
|
265086
|
+
}
|
|
264823
265087
|
function concurrencyOption() {
|
|
264824
265088
|
return new Option2("--concurrency <n>", "Parallel file uploads").default(DEFAULT_VERSION_UPLOAD_CONCURRENCY).argParser((value) => {
|
|
264825
265089
|
const parsed = Number(value);
|
|
@@ -264844,7 +265108,7 @@ async function publishAction(ctx, options) {
|
|
|
264844
265108
|
}
|
|
264845
265109
|
const gitHash = await resolveProvenanceCommit(target.root, options.gitHash);
|
|
264846
265110
|
const result = await runTask("Publishing...", async (updateMessage) => {
|
|
264847
|
-
const artifacts = await tagStep2("create_version", () => collectArtifacts(target));
|
|
265111
|
+
const artifacts = await tagStep2("create_version", () => collectArtifacts(target, { routesFile: options.routesFile }));
|
|
264848
265112
|
return await publishVersion(artifacts, {
|
|
264849
265113
|
sourceCommit: gitHash,
|
|
264850
265114
|
target: options.target,
|
|
@@ -264865,7 +265129,7 @@ async function publishAction(ctx, options) {
|
|
|
264865
265129
|
};
|
|
264866
265130
|
}
|
|
264867
265131
|
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);
|
|
265132
|
+
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
265133
|
}
|
|
264870
265134
|
|
|
264871
265135
|
// src/core/resources/sandbox/schema.ts
|
|
@@ -265773,7 +266037,7 @@ async function prepareSessionImages(content) {
|
|
|
265773
266037
|
import { createReadStream as createReadStream3 } from "node:fs";
|
|
265774
266038
|
import { realpath, rm as rm3, stat as stat6 } from "node:fs/promises";
|
|
265775
266039
|
import { homedir as homedir4 } from "node:os";
|
|
265776
|
-
import { dirname as dirname23, join as
|
|
266040
|
+
import { dirname as dirname23, join as join32 } from "node:path";
|
|
265777
266041
|
import { createInterface as createInterface2 } from "node:readline";
|
|
265778
266042
|
|
|
265779
266043
|
// ../../node_modules/tmp-promise/index.js
|
|
@@ -265786,8 +266050,8 @@ var $dir = async (options) => dirWithOptions(options);
|
|
|
265786
266050
|
var $tmpName = promisify12(tmp.tmpName);
|
|
265787
266051
|
|
|
265788
266052
|
// src/core/session-import/sessions.ts
|
|
265789
|
-
var claudeDir = () => process.env.CLAUDE_CONFIG_DIR ||
|
|
265790
|
-
var codexDir = () => process.env.CODEX_HOME ||
|
|
266053
|
+
var claudeDir = () => process.env.CLAUDE_CONFIG_DIR || join32(homedir4(), ".claude");
|
|
266054
|
+
var codexDir = () => process.env.CODEX_HOME || join32(homedir4(), ".codex");
|
|
265791
266055
|
async function scanLines(path, pick, maxLines = Number.POSITIVE_INFINITY) {
|
|
265792
266056
|
const lines = createInterface2({ input: createReadStream3(path) });
|
|
265793
266057
|
let count = 0;
|
|
@@ -265943,7 +266207,7 @@ async function teleportSession(sessionId, cwd) {
|
|
|
265943
266207
|
throw new InvalidInputError("Run this from a folder with the app's GitHub repository, so the session can be checked out.");
|
|
265944
266208
|
}
|
|
265945
266209
|
const tmp = await $dir({ unsafeCleanup: true });
|
|
265946
|
-
const repo =
|
|
266210
|
+
const repo = join32(tmp.path, "repo");
|
|
265947
266211
|
let projectFolder;
|
|
265948
266212
|
try {
|
|
265949
266213
|
await execa("git", ["clone", "--quiet", origin.stdout, repo]);
|
|
@@ -266142,6 +266406,7 @@ async function deployToDeploymentsApi(ctx, project, options) {
|
|
|
266142
266406
|
outputDir,
|
|
266143
266407
|
gitHash,
|
|
266144
266408
|
concurrency: options.concurrency,
|
|
266409
|
+
overwrite: options.overwrite,
|
|
266145
266410
|
progress: {
|
|
266146
266411
|
onWarning: (message) => {
|
|
266147
266412
|
warnings.push(message);
|
|
@@ -266193,7 +266458,7 @@ function siteOutputDir(project) {
|
|
|
266193
266458
|
return resolve17(project.root, outputDirectory);
|
|
266194
266459
|
}
|
|
266195
266460
|
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);
|
|
266461
|
+
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
266462
|
}
|
|
266198
266463
|
function parseConcurrency(value) {
|
|
266199
266464
|
const parsed = Number(value);
|
|
@@ -266531,10 +266796,10 @@ function toPascalCase(name) {
|
|
|
266531
266796
|
return name.split(/[-_\s]+/).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("");
|
|
266532
266797
|
}
|
|
266533
266798
|
// src/core/types/update-project.ts
|
|
266534
|
-
import { join as
|
|
266799
|
+
import { join as join36 } from "node:path";
|
|
266535
266800
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
266536
266801
|
async function updateProjectConfig(projectRoot) {
|
|
266537
|
-
const tsconfigPath =
|
|
266802
|
+
const tsconfigPath = join36(projectRoot, "tsconfig.json");
|
|
266538
266803
|
if (!await pathExists(tsconfigPath)) {
|
|
266539
266804
|
return false;
|
|
266540
266805
|
}
|
|
@@ -266590,7 +266855,7 @@ async function createAction2(ctx, options) {
|
|
|
266590
266855
|
outputDir: options.outputDir
|
|
266591
266856
|
});
|
|
266592
266857
|
const gitHash = await resolveProvenanceCommit(target.root, options.gitHash);
|
|
266593
|
-
const version = await runTask("Creating version...", async (updateMessage) => await createVersion(await collectArtifacts(target), {
|
|
266858
|
+
const version = await runTask("Creating version...", async (updateMessage) => await createVersion(await collectArtifacts(target, { routesFile: options.routesFile }), {
|
|
266594
266859
|
sourceCommit: gitHash,
|
|
266595
266860
|
concurrency: options.concurrency,
|
|
266596
266861
|
progress: {
|
|
@@ -266608,7 +266873,7 @@ async function createAction2(ctx, options) {
|
|
|
266608
266873
|
};
|
|
266609
266874
|
}
|
|
266610
266875
|
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);
|
|
266876
|
+
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
266877
|
}
|
|
266613
266878
|
|
|
266614
266879
|
// src/cli/commands/versions/deploy.ts
|
|
@@ -267015,7 +267280,7 @@ function getWorkspaceCommand() {
|
|
|
267015
267280
|
// src/cli/dev/dev-server/main.ts
|
|
267016
267281
|
var import_cors = __toESM(require_lib4(), 1);
|
|
267017
267282
|
var import_express6 = __toESM(require_express(), 1);
|
|
267018
|
-
import { dirname as dirname29, join as
|
|
267283
|
+
import { dirname as dirname29, join as join41 } from "node:path";
|
|
267019
267284
|
|
|
267020
267285
|
// ../../node_modules/get-port/index.js
|
|
267021
267286
|
import net from "node:net";
|
|
@@ -267136,7 +267401,7 @@ var import_http_proxy_middleware2 = __toESM(require_dist2(), 1);
|
|
|
267136
267401
|
|
|
267137
267402
|
// src/cli/dev/dev-server/function-manager.ts
|
|
267138
267403
|
import { spawn as spawn3 } from "node:child_process";
|
|
267139
|
-
import { dirname as dirname26, join as
|
|
267404
|
+
import { dirname as dirname26, join as join37 } from "node:path";
|
|
267140
267405
|
import { pathToFileURL as pathToFileURL6 } from "node:url";
|
|
267141
267406
|
|
|
267142
267407
|
// src/cli/dev/dev-server/base-function-manager.ts
|
|
@@ -267241,7 +267506,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
267241
267506
|
}
|
|
267242
267507
|
spawnFunction(func, port) {
|
|
267243
267508
|
this.logger.log(`Spawning function "${func.name}" on port ${port}`);
|
|
267244
|
-
const importMapPath =
|
|
267509
|
+
const importMapPath = join37(dirname26(this.wrapperPath), "import-map.json");
|
|
267245
267510
|
const process2 = spawn3("deno", ["run", "--allow-all", "--import-map", importMapPath, this.wrapperPath], {
|
|
267246
267511
|
env: {
|
|
267247
267512
|
...globalThis.process.env,
|
|
@@ -267315,7 +267580,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
267315
267580
|
import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
267316
267581
|
import { isBuiltin as isBuiltin3 } from "node:module";
|
|
267317
267582
|
import { homedir as homedir5 } from "node:os";
|
|
267318
|
-
import { join as
|
|
267583
|
+
import { join as join38 } from "node:path";
|
|
267319
267584
|
import { pathToFileURL as pathToFileURL7 } from "node:url";
|
|
267320
267585
|
var depsPromise;
|
|
267321
267586
|
function loadDeps() {
|
|
@@ -267436,9 +267701,9 @@ export default {
|
|
|
267436
267701
|
};
|
|
267437
267702
|
`;
|
|
267438
267703
|
function ensureBundlerConfig() {
|
|
267439
|
-
const dir =
|
|
267704
|
+
const dir = join38(homedir5(), ".base44", "function-bundler");
|
|
267440
267705
|
mkdirSync2(dir, { recursive: true });
|
|
267441
|
-
const configPath =
|
|
267706
|
+
const configPath = join38(dir, "deno.json");
|
|
267442
267707
|
writeFileSync2(configPath, `${JSON.stringify({ nodeModulesDir: "auto" }, null, 2)}
|
|
267443
267708
|
`);
|
|
267444
267709
|
return configPath;
|
|
@@ -270767,8 +271032,8 @@ async function createDevServer(options) {
|
|
|
270767
271032
|
broadcastEntityEvent(io, appId, entityName, event);
|
|
270768
271033
|
};
|
|
270769
271034
|
const base44ConfigWatcher = new WatchBase44({
|
|
270770
|
-
functions:
|
|
270771
|
-
entities:
|
|
271035
|
+
functions: join41(dirname29(project.configPath), project.functionsDir),
|
|
271036
|
+
entities: join41(dirname29(project.configPath), project.entitiesDir)
|
|
270772
271037
|
}, devLogger);
|
|
270773
271038
|
base44ConfigWatcher.on("change", async (name) => {
|
|
270774
271039
|
try {
|
|
@@ -270971,7 +271236,7 @@ function readExecEnvTarget(env = process.env) {
|
|
|
270971
271236
|
// src/core/exec/run-script.ts
|
|
270972
271237
|
import { spawn as spawn4 } from "node:child_process";
|
|
270973
271238
|
import { readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "node:fs";
|
|
270974
|
-
import { join as
|
|
271239
|
+
import { join as join42 } from "node:path";
|
|
270975
271240
|
var SDK_SPECIFIER = '"npm:@base44/sdk"';
|
|
270976
271241
|
function wrapperSource(sdkVersion) {
|
|
270977
271242
|
const source = readFileSync4(getExecWrapperPath(), "utf-8");
|
|
@@ -271018,7 +271283,7 @@ async function runScript(options) {
|
|
|
271018
271283
|
writeFileSync3(tempWrapper.path, wrapperSource(sdkVersion), "utf-8");
|
|
271019
271284
|
const configDir = await $dir({ unsafeCleanup: true });
|
|
271020
271285
|
cleanupFns.push(configDir.cleanup);
|
|
271021
|
-
const configPath =
|
|
271286
|
+
const configPath = join42(configDir.path, "deno.json");
|
|
271022
271287
|
writeFileSync3(configPath, JSON.stringify(DENO_CONFIG), "utf-8");
|
|
271023
271288
|
try {
|
|
271024
271289
|
const exitCode = await new Promise((resolvePromise) => {
|
|
@@ -275310,7 +275575,7 @@ function addCommandInfoToErrorReporter(program, errorReporter) {
|
|
|
275310
275575
|
// src/cli/index.ts
|
|
275311
275576
|
var __dirname4 = dirname31(fileURLToPath7(import.meta.url));
|
|
275312
275577
|
async function runCLI(options) {
|
|
275313
|
-
ensureNpmAssets(
|
|
275578
|
+
ensureNpmAssets(join43(__dirname4, "../assets"));
|
|
275314
275579
|
const errorReporter = new ErrorReporter;
|
|
275315
275580
|
errorReporter.registerProcessErrorHandlers();
|
|
275316
275581
|
const jsonMode = process.argv.includes("--json");
|
|
@@ -275349,4 +275614,4 @@ export {
|
|
|
275349
275614
|
runCLI
|
|
275350
275615
|
};
|
|
275351
275616
|
|
|
275352
|
-
//# debugId=
|
|
275617
|
+
//# debugId=E189FA51139F7E2864756E2164756E21
|