@base44-preview/cli 0.1.2-pr.563.7cff4d1 → 0.1.2-pr.563.b19219e
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 +29 -7
- package/dist/cli/index.js.map +6 -6
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -243424,9 +243424,14 @@ var FunctionConfigSchema = exports_external.object({
|
|
|
243424
243424
|
entry: exports_external.string().min(1, "Entry point cannot be empty"),
|
|
243425
243425
|
automations: exports_external.array(AutomationSchema).optional()
|
|
243426
243426
|
});
|
|
243427
|
+
var OutOfBoundsImportSchema = exports_external.object({
|
|
243428
|
+
importer: exports_external.string(),
|
|
243429
|
+
specifier: exports_external.string()
|
|
243430
|
+
});
|
|
243427
243431
|
var BackendFunctionSchema = FunctionConfigSchema.extend({
|
|
243428
243432
|
entryPath: exports_external.string().min(1, "Entry path cannot be empty"),
|
|
243429
243433
|
filePaths: exports_external.array(exports_external.string()).min(1, "Function must have at least one file"),
|
|
243434
|
+
outOfBoundsImports: exports_external.array(OutOfBoundsImportSchema).optional().default([]),
|
|
243430
243435
|
source: ResourceSourceSchema
|
|
243431
243436
|
});
|
|
243432
243437
|
var DeploySingleFunctionResponseSchema = exports_external.object({
|
|
@@ -243570,6 +243575,7 @@ async function collectReachableBackendFiles(_entryPath, functionFilePaths, backe
|
|
|
243570
243575
|
const visited = new Set(functionFilePaths);
|
|
243571
243576
|
const queue = [...functionFilePaths];
|
|
243572
243577
|
const extra = [];
|
|
243578
|
+
const outOfBounds = [];
|
|
243573
243579
|
while (queue.length > 0) {
|
|
243574
243580
|
const filePath = queue.shift();
|
|
243575
243581
|
let content;
|
|
@@ -243585,8 +243591,10 @@ async function collectReachableBackendFiles(_entryPath, functionFilePaths, backe
|
|
|
243585
243591
|
if (!resolved)
|
|
243586
243592
|
continue;
|
|
243587
243593
|
const rel = relative(backendRoot, resolved);
|
|
243588
|
-
if (rel.startsWith(".."))
|
|
243594
|
+
if (rel.startsWith("..")) {
|
|
243595
|
+
outOfBounds.push({ importer: filePath, specifier });
|
|
243589
243596
|
continue;
|
|
243597
|
+
}
|
|
243590
243598
|
if (!visited.has(resolved)) {
|
|
243591
243599
|
visited.add(resolved);
|
|
243592
243600
|
queue.push(resolved);
|
|
@@ -243595,7 +243603,10 @@ async function collectReachableBackendFiles(_entryPath, functionFilePaths, backe
|
|
|
243595
243603
|
}
|
|
243596
243604
|
}
|
|
243597
243605
|
const functionSet = new Set(functionFilePaths);
|
|
243598
|
-
return
|
|
243606
|
+
return {
|
|
243607
|
+
extra: extra.filter((p) => !functionSet.has(p)),
|
|
243608
|
+
outOfBounds
|
|
243609
|
+
};
|
|
243599
243610
|
}
|
|
243600
243611
|
|
|
243601
243612
|
// src/core/resources/function/config.ts
|
|
@@ -243620,12 +243631,13 @@ async function readFunction(configPath, backendRoot) {
|
|
|
243620
243631
|
cwd: functionDir,
|
|
243621
243632
|
absolute: true
|
|
243622
243633
|
});
|
|
243623
|
-
const
|
|
243624
|
-
const allFilePaths = [...new Set([...filePaths, ...
|
|
243634
|
+
const { extra, outOfBounds } = await collectReachableBackendFiles(entryPath, filePaths, backendRoot);
|
|
243635
|
+
const allFilePaths = [...new Set([...filePaths, ...extra])];
|
|
243625
243636
|
const functionData = {
|
|
243626
243637
|
...config7,
|
|
243627
243638
|
entryPath,
|
|
243628
243639
|
filePaths: allFilePaths,
|
|
243640
|
+
outOfBoundsImports: outOfBounds,
|
|
243629
243641
|
source: { type: "project" }
|
|
243630
243642
|
};
|
|
243631
243643
|
return functionData;
|
|
@@ -243653,8 +243665,8 @@ async function readAllFunctions(functionsDir) {
|
|
|
243653
243665
|
cwd: functionDir,
|
|
243654
243666
|
absolute: true
|
|
243655
243667
|
});
|
|
243656
|
-
const
|
|
243657
|
-
const allFilePaths = [...new Set([...filePaths, ...
|
|
243668
|
+
const { extra, outOfBounds } = await collectReachableBackendFiles(entryFile, filePaths, backendRoot);
|
|
243669
|
+
const allFilePaths = [...new Set([...filePaths, ...extra])];
|
|
243658
243670
|
const name2 = relative2(functionsDir, functionDir).split(/[/\\]/).join("/");
|
|
243659
243671
|
if (!name2) {
|
|
243660
243672
|
throw new InvalidInputError("entry.ts found directly in the functions directory — it must be inside a named subfolder", {
|
|
@@ -243671,6 +243683,7 @@ async function readAllFunctions(functionsDir) {
|
|
|
243671
243683
|
entry,
|
|
243672
243684
|
entryPath: entryFile,
|
|
243673
243685
|
filePaths: allFilePaths,
|
|
243686
|
+
outOfBoundsImports: outOfBounds,
|
|
243674
243687
|
source: { type: "project" }
|
|
243675
243688
|
};
|
|
243676
243689
|
return functionData;
|
|
@@ -253097,6 +253110,15 @@ async function deployFunctionsAction({ log }, names, options) {
|
|
|
253097
253110
|
};
|
|
253098
253111
|
}
|
|
253099
253112
|
log.info(`Found ${toDeploy.length} ${toDeploy.length === 1 ? "function" : "functions"} to deploy`);
|
|
253113
|
+
for (const fn of toDeploy) {
|
|
253114
|
+
if (fn.outOfBoundsImports && fn.outOfBoundsImports.length > 0) {
|
|
253115
|
+
for (const { importer, specifier } of fn.outOfBoundsImports) {
|
|
253116
|
+
const rel = importer.includes(fn.name) ? importer.slice(importer.lastIndexOf(fn.name)) : importer;
|
|
253117
|
+
log.error(`[${fn.name}] Cannot import "${specifier}" in ${rel}: the file is outside base44/ and cannot be uploaded. Move it to base44/shared/ to share it across functions. Functions run on Deno — use npm: or jsr: specifiers (not package.json) for external packages.`);
|
|
253118
|
+
}
|
|
253119
|
+
throw new CLIExitError(1);
|
|
253120
|
+
}
|
|
253121
|
+
}
|
|
253100
253122
|
let completed = 0;
|
|
253101
253123
|
const total = toDeploy.length;
|
|
253102
253124
|
const results = await deployFunctionsSequentially(toDeploy, {
|
|
@@ -262598,4 +262620,4 @@ export {
|
|
|
262598
262620
|
CLIExitError
|
|
262599
262621
|
};
|
|
262600
262622
|
|
|
262601
|
-
//# debugId=
|
|
262623
|
+
//# debugId=B8C7F17D9436926E64756E2164756E21
|