@base44-preview/cli 0.1.32-pr.658.bc0ac49 → 0.1.32-pr.660.017611e
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 +161 -79
- package/dist/cli/index.js.map +8 -8
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -221164,6 +221164,34 @@ var require_dist5 = __commonJS(function(exports, module) {
|
|
|
221164
221164
|
}
|
|
221165
221165
|
});
|
|
221166
221166
|
|
|
221167
|
+
// ../../node_modules/commander/index.js
|
|
221168
|
+
var exports_commander = {};
|
|
221169
|
+
__exportCjs(exports_commander, {
|
|
221170
|
+
program: () => $program,
|
|
221171
|
+
createCommand: () => $createCommand,
|
|
221172
|
+
createOption: () => $createOption,
|
|
221173
|
+
createArgument: () => $createArgument,
|
|
221174
|
+
Command: () => $Command,
|
|
221175
|
+
Option: () => $Option,
|
|
221176
|
+
Argument: () => $Argument,
|
|
221177
|
+
Help: () => $Help,
|
|
221178
|
+
CommanderError: () => $CommanderError,
|
|
221179
|
+
InvalidArgumentError: () => $InvalidArgumentError,
|
|
221180
|
+
InvalidOptionArgumentError: () => $InvalidOptionArgumentError
|
|
221181
|
+
}, {
|
|
221182
|
+
program: (value) => $program = value,
|
|
221183
|
+
createCommand: (value) => $createCommand = value,
|
|
221184
|
+
createOption: (value) => $createOption = value,
|
|
221185
|
+
createArgument: (value) => $createArgument = value,
|
|
221186
|
+
Command: (value) => $Command = value,
|
|
221187
|
+
Option: (value) => $Option = value,
|
|
221188
|
+
Argument: (value) => $Argument = value,
|
|
221189
|
+
Help: (value) => $Help = value,
|
|
221190
|
+
CommanderError: (value) => $CommanderError = value,
|
|
221191
|
+
InvalidArgumentError: (value) => $InvalidArgumentError = value,
|
|
221192
|
+
InvalidOptionArgumentError: (value) => $InvalidOptionArgumentError = value
|
|
221193
|
+
});
|
|
221194
|
+
|
|
221167
221195
|
// src/core/utils/env.ts
|
|
221168
221196
|
var import_dotenv = __toESM(require_main(), 1);
|
|
221169
221197
|
import { basename, dirname as dirname3, join } from "node:path";
|
|
@@ -229878,32 +229906,6 @@ class SimpleLogger {
|
|
|
229878
229906
|
}
|
|
229879
229907
|
}
|
|
229880
229908
|
// ../../node_modules/commander/index.js
|
|
229881
|
-
var exports_commander = {};
|
|
229882
|
-
__exportCjs(exports_commander, {
|
|
229883
|
-
program: () => $program,
|
|
229884
|
-
createCommand: () => $createCommand,
|
|
229885
|
-
createOption: () => $createOption,
|
|
229886
|
-
createArgument: () => $createArgument,
|
|
229887
|
-
Command: () => $Command,
|
|
229888
|
-
Option: () => $Option,
|
|
229889
|
-
Argument: () => $Argument,
|
|
229890
|
-
Help: () => $Help,
|
|
229891
|
-
CommanderError: () => $CommanderError,
|
|
229892
|
-
InvalidArgumentError: () => $InvalidArgumentError,
|
|
229893
|
-
InvalidOptionArgumentError: () => $InvalidOptionArgumentError
|
|
229894
|
-
}, {
|
|
229895
|
-
program: (value) => $program = value,
|
|
229896
|
-
createCommand: (value) => $createCommand = value,
|
|
229897
|
-
createOption: (value) => $createOption = value,
|
|
229898
|
-
createArgument: (value) => $createArgument = value,
|
|
229899
|
-
Command: (value) => $Command = value,
|
|
229900
|
-
Option: (value) => $Option = value,
|
|
229901
|
-
Argument: (value) => $Argument = value,
|
|
229902
|
-
Help: (value) => $Help = value,
|
|
229903
|
-
CommanderError: (value) => $CommanderError = value,
|
|
229904
|
-
InvalidArgumentError: (value) => $InvalidArgumentError = value,
|
|
229905
|
-
InvalidOptionArgumentError: (value) => $InvalidOptionArgumentError = value
|
|
229906
|
-
});
|
|
229907
229909
|
var { Argument } = require_argument();
|
|
229908
229910
|
var { Command } = require_command();
|
|
229909
229911
|
var { CommanderError, InvalidArgumentError } = require_error2();
|
|
@@ -236769,27 +236771,6 @@ function siteOrDefault(project) {
|
|
|
236769
236771
|
warnConfigFallback(`${project.configPath} has no 'site' block; using the default site commands.`);
|
|
236770
236772
|
return DEFAULT_SITE;
|
|
236771
236773
|
}
|
|
236772
|
-
var COMMAND_NOT_FOUND_EXIT_CODES = new Set([127, 9009]);
|
|
236773
|
-
async function runSiteCommandOrDefault(command, fallback, run) {
|
|
236774
|
-
try {
|
|
236775
|
-
return await run(command);
|
|
236776
|
-
} catch (error) {
|
|
236777
|
-
if (command === fallback || !isCommandNotFound(error)) {
|
|
236778
|
-
throw error;
|
|
236779
|
-
}
|
|
236780
|
-
warnSiteCommandFallback(command, fallback);
|
|
236781
|
-
return run(fallback);
|
|
236782
|
-
}
|
|
236783
|
-
}
|
|
236784
|
-
function warnSiteCommandFallback(command, fallback) {
|
|
236785
|
-
warnConfigFallback(`'${command}' could not start because its program is not installed; running '${fallback}' instead.`);
|
|
236786
|
-
}
|
|
236787
|
-
function isCommandNotFoundExit(code) {
|
|
236788
|
-
return typeof code === "number" && COMMAND_NOT_FOUND_EXIT_CODES.has(code);
|
|
236789
|
-
}
|
|
236790
|
-
function isCommandNotFound(error) {
|
|
236791
|
-
return typeof error === "object" && error !== null && "exitCode" in error && isCommandNotFoundExit(error.exitCode);
|
|
236792
|
-
}
|
|
236793
236774
|
function withoutKey(record, key) {
|
|
236794
236775
|
return Object.fromEntries(Object.entries(record).filter(([k]) => k !== key));
|
|
236795
236776
|
}
|
|
@@ -249772,11 +249753,11 @@ function getFunctionsCommand() {
|
|
|
249772
249753
|
|
|
249773
249754
|
// src/cli/commands/project/site-build.ts
|
|
249774
249755
|
async function runSiteBuild({ runTask }, { root, buildCommand = DEFAULT_SITE.buildCommand, appId }) {
|
|
249775
|
-
await runTask("Building site...", () =>
|
|
249756
|
+
await runTask("Building site...", () => execa({
|
|
249776
249757
|
cwd: root,
|
|
249777
249758
|
shell: true,
|
|
249778
249759
|
env: { VITE_BASE44_APP_ID: appId }
|
|
249779
|
-
})`${
|
|
249760
|
+
})`${buildCommand}`, {
|
|
249780
249761
|
successMessage: "Site built successfully",
|
|
249781
249762
|
errorMessage: "Build failed"
|
|
249782
249763
|
});
|
|
@@ -253293,7 +253274,97 @@ function installStaticEgressFetch() {
|
|
|
253293
253274
|
staticEgressFetchInstalled = true;
|
|
253294
253275
|
}
|
|
253295
253276
|
|
|
253277
|
+
// src/static-egress-tcp-core.mjs
|
|
253278
|
+
function normalizeHost(host) {
|
|
253279
|
+
return host.toLowerCase().replace(/^\\[(.*)\\]$/, "$1").replace(/\\.$/, "");
|
|
253280
|
+
}
|
|
253281
|
+
function destination(address) {
|
|
253282
|
+
const hostname4 = address?.hostname;
|
|
253283
|
+
const port = address?.port;
|
|
253284
|
+
if (typeof hostname4 !== "string" || !hostname4 || /[\\s/@\\\\?#%]/.test(hostname4) || hostname4.startsWith("[") && !hostname4.endsWith("]")) {
|
|
253285
|
+
throw new TypeError("staticEgress.connect requires a hostname or IP address, not a URL");
|
|
253286
|
+
}
|
|
253287
|
+
if (!Number.isInteger(port) || port < 1 || port > 65535) {
|
|
253288
|
+
throw new TypeError("staticEgress.connect requires an integer port between 1 and 65535");
|
|
253289
|
+
}
|
|
253290
|
+
const authority = hostname4.includes(":") && !hostname4.startsWith("[") ? \`[\${hostname4}]\` : hostname4;
|
|
253291
|
+
let url2;
|
|
253292
|
+
try {
|
|
253293
|
+
url2 = new URL(\`http://\${authority}\`);
|
|
253294
|
+
} catch {
|
|
253295
|
+
throw new TypeError("staticEgress.connect requires a valid hostname or IP address");
|
|
253296
|
+
}
|
|
253297
|
+
if (url2.port || url2.pathname !== "/" || !url2.hostname) {
|
|
253298
|
+
throw new TypeError("staticEgress.connect requires hostname and port as separate fields");
|
|
253299
|
+
}
|
|
253300
|
+
return { hostname: normalizeHost(url2.hostname), port };
|
|
253301
|
+
}
|
|
253302
|
+
function publicHost(host) {
|
|
253303
|
+
if (host === "localhost" || /\\.(localhost|local|internal)$/.test(host)) return false;
|
|
253304
|
+
if (host.includes(":")) return /^[23][0-9a-f]{3}:/.test(host);
|
|
253305
|
+
if (!/^\\d+\\.\\d+\\.\\d+\\.\\d+$/.test(host)) return host.includes(".");
|
|
253306
|
+
const [a2, b] = host.split(".").map(Number);
|
|
253307
|
+
return !(a2 === 0 || a2 === 10 || a2 === 127 || a2 >= 224 || a2 === 100 && b >= 64 && b <= 127 || a2 === 169 && b === 254 || a2 === 172 && b >= 16 && b <= 31 || a2 === 192 && b === 168 || a2 === 198 && (b === 18 || b === 19));
|
|
253308
|
+
}
|
|
253309
|
+
function configuredList(raw) {
|
|
253310
|
+
if (raw === void 0) return [];
|
|
253311
|
+
try {
|
|
253312
|
+
const parsed = JSON.parse(raw);
|
|
253313
|
+
if (Array.isArray(parsed)) return parsed;
|
|
253314
|
+
} catch {
|
|
253315
|
+
}
|
|
253316
|
+
throw new Error("Static egress destination restrictions are unavailable");
|
|
253317
|
+
}
|
|
253318
|
+
function createStaticEgress(readEnvironment) {
|
|
253319
|
+
return Object.freeze({
|
|
253320
|
+
async connect(address, options = {}) {
|
|
253321
|
+
if (options === null || typeof options !== "object" || Array.isArray(options) || Object.keys(options).some((key) => key !== "secureTransport") || options.secureTransport !== void 0 && options.secureTransport !== "off") {
|
|
253322
|
+
throw new TypeError("Static egress TCP currently supports only secureTransport: off; TLS and STARTTLS are not supported");
|
|
253323
|
+
}
|
|
253324
|
+
const target = destination(address);
|
|
253325
|
+
const env2 = readEnvironment();
|
|
253326
|
+
if (!env2) throw new Error("Static egress TCP requires an active server request");
|
|
253327
|
+
if (env2.BASE44_STATIC_EGRESS_ENABLED !== "1") {
|
|
253328
|
+
throw new Error("Workspace static egress is not enabled");
|
|
253329
|
+
}
|
|
253330
|
+
const binding = env2.STATIC_EGRESS;
|
|
253331
|
+
if (typeof binding?.connect !== "function") {
|
|
253332
|
+
throw new Error("Static egress TCP binding is unavailable; rebuild and redeploy with a supported runtime");
|
|
253333
|
+
}
|
|
253334
|
+
const excluded = [
|
|
253335
|
+
...configuredList(env2.BASE44_STATIC_EGRESS_EXCLUDED_HOSTS),
|
|
253336
|
+
...configuredList(env2.BASE44_PRIVATE_DATA_SOURCES).map((entry) => entry?.host)
|
|
253337
|
+
];
|
|
253338
|
+
if (!publicHost(target.hostname) || excluded.some((host) => {
|
|
253339
|
+
if (typeof host !== "string") return false;
|
|
253340
|
+
const normalized = normalizeHost(host);
|
|
253341
|
+
return normalized.startsWith(".") ? target.hostname === normalized.slice(1) || target.hostname.endsWith(normalized) : target.hostname === normalized;
|
|
253342
|
+
})) {
|
|
253343
|
+
throw new Error("Destination is not allowed through static egress TCP; use the configured private-data-source API for private services");
|
|
253344
|
+
}
|
|
253345
|
+
return binding.connect(target);
|
|
253346
|
+
}
|
|
253347
|
+
});
|
|
253348
|
+
}
|
|
253349
|
+
|
|
253350
|
+
// src/static-egress-tcp.ts
|
|
253351
|
+
import { getRuntimeManifest } from "base44:private-data-sources/runtime-manifest-store";
|
|
253352
|
+
function installStaticEgressTcp() {
|
|
253353
|
+
const staticEgress = createStaticEgress(() => {
|
|
253354
|
+
const context = currentWorkerRuntimeContext();
|
|
253355
|
+
if (!context) return void 0;
|
|
253356
|
+
const runtimeManifest = getRuntimeManifest();
|
|
253357
|
+
return {
|
|
253358
|
+
...context.workerEnv,
|
|
253359
|
+
BASE44_PRIVATE_DATA_SOURCES: runtimeManifest === void 0 ? context.workerEnv.BASE44_PRIVATE_DATA_SOURCES : runtimeManifest || "[]"
|
|
253360
|
+
};
|
|
253361
|
+
});
|
|
253362
|
+
const globals = globalThis;
|
|
253363
|
+
globals.Base44 = Object.assign(globals.Base44 ?? {}, { staticEgress });
|
|
253364
|
+
}
|
|
253365
|
+
|
|
253296
253366
|
// src/shim/entry.ts
|
|
253367
|
+
installStaticEgressTcp();
|
|
253297
253368
|
var registeredHandler = null;
|
|
253298
253369
|
var initContext = new AsyncLocalStorage();
|
|
253299
253370
|
function serve(arg1, arg2) {
|
|
@@ -254862,6 +254933,7 @@ export {
|
|
|
254862
254933
|
interface Base44Bridge {
|
|
254863
254934
|
waitUntil(promise: Promise<unknown>): void;
|
|
254864
254935
|
secrets: { get(name: string): string | undefined };
|
|
254936
|
+
staticEgress?: { connect(address: StaticEgressAddress, options?: StaticEgressOptions): Promise<StaticEgressSocket> };
|
|
254865
254937
|
}
|
|
254866
254938
|
|
|
254867
254939
|
function bridge(): Base44Bridge {
|
|
@@ -254882,6 +254954,31 @@ export const secrets: { get(name: string): string | undefined } = {
|
|
|
254882
254954
|
return bridge().secrets.get(name);
|
|
254883
254955
|
},
|
|
254884
254956
|
};
|
|
254957
|
+
|
|
254958
|
+
export interface StaticEgressAddress {
|
|
254959
|
+
hostname: string;
|
|
254960
|
+
port: number;
|
|
254961
|
+
}
|
|
254962
|
+
|
|
254963
|
+
export interface StaticEgressOptions {
|
|
254964
|
+
secureTransport?: "off";
|
|
254965
|
+
}
|
|
254966
|
+
|
|
254967
|
+
export interface StaticEgressSocket {
|
|
254968
|
+
readable: ReadableStream<Uint8Array>;
|
|
254969
|
+
writable: WritableStream<Uint8Array>;
|
|
254970
|
+
opened: Promise<{ remoteAddress?: string | null; localAddress?: string | null }>;
|
|
254971
|
+
closed: Promise<void>;
|
|
254972
|
+
close(): Promise<void>;
|
|
254973
|
+
}
|
|
254974
|
+
|
|
254975
|
+
export const staticEgress = Object.freeze({
|
|
254976
|
+
async connect(address: StaticEgressAddress, options?: StaticEgressOptions): Promise<StaticEgressSocket> {
|
|
254977
|
+
const api = bridge()?.staticEgress;
|
|
254978
|
+
if (!api) throw new Error("Static egress TCP is unavailable; rebuild and redeploy with a supported runtime");
|
|
254979
|
+
return api.connect(address, options);
|
|
254980
|
+
},
|
|
254981
|
+
});
|
|
254885
254982
|
`,
|
|
254886
254983
|
"runtime-context.ts": `import { AsyncLocalStorage } from "node:async_hooks";
|
|
254887
254984
|
|
|
@@ -255953,7 +256050,7 @@ export function redis(name: unknown) {
|
|
|
255953
256050
|
workerEnvironment,
|
|
255954
256051
|
} from "base44:internal/runtime-context";
|
|
255955
256052
|
`,
|
|
255956
|
-
"private-data-sources/runtime-manifest-store.ts": "// Private, single-instance channel for the handshake-delivered PDS manifest.\n//\n// The manifest carries plaintext VPC/DB credentials, so it must NOT be\n// reachable by user code. It lives here in module-private state: the activation\n// shim writes it (via `setRuntimeManifest`)
|
|
256053
|
+
"private-data-sources/runtime-manifest-store.ts": "// Private, single-instance channel for the handshake-delivered PDS manifest.\n//\n// The manifest carries plaintext VPC/DB credentials, so it must NOT be\n// reachable by user code. It lives here in module-private state: the activation\n// shim writes it (via `setRuntimeManifest`); `manifest.ts` and the trusted TCP\n// runtime read it (via `getRuntimeManifest`) from THIS module instance in the final\n// bundle, so the value never touches `globalThis`, `process.env`, or any\n// user-importable surface. User function code cannot import this module, via\n// two independent gates: (1) the bundler's private-data-sources virtual plugin\n// resolves the `base44:private-data-sources/runtime-manifest-store` specifier\n// ONLY when the importer is EXACTLY the injected activation or runtime shim's bundle-root\n// key (not a suffix/segment match — else a nested `x/__base44_activation.mjs`\n// could pose as it); (2) `assertNoReservedFilenames` rejects those basenames at\n// any depth in user files. The relative `./runtime-manifest-store` path only\n// resolves inside the plugin's namespace (the adapters + manifest.ts), never\n// from a user file.\n//\n// Single instance: both importers resolve to the SAME (namespace, path) pair,\n// so esbuild emits one module. The runtime-secrets e2e proves this end to end —\n// if the two ever diverged into separate instances, the shim would write one\n// and manifest.ts would read the other (empty), and the delivered manifest\n// would resolve as \"not bound\".\n\nlet runtimeManifestRaw: string | undefined;\n\nexport function setRuntimeManifest(raw: string | undefined): void {\n runtimeManifestRaw = raw;\n}\n\nexport function getRuntimeManifest(): string | undefined {\n return runtimeManifestRaw;\n}\n",
|
|
255957
256054
|
"private-data-sources/sqlserver.ts": `import { buildTediousConnectorFactory } from "./tedious-adapter";
|
|
255958
256055
|
import { privateDataSourceReference } from "./manifest";
|
|
255959
256056
|
import { buildTcpPrivateDataSource } from "./tcp";
|
|
@@ -256550,8 +256647,8 @@ function publicModulePath(specifier) {
|
|
|
256550
256647
|
return `${moduleName}.ts`;
|
|
256551
256648
|
}
|
|
256552
256649
|
var INTERNAL_STORE_SPECIFIER = `${PREFIX2}/runtime-manifest-store`;
|
|
256553
|
-
function
|
|
256554
|
-
return namespace === USER_NAMESPACE && importer === ACTIVATION_FILENAME;
|
|
256650
|
+
function isRuntimeShimImporter(namespace, importer) {
|
|
256651
|
+
return namespace === USER_NAMESPACE && (importer === ACTIVATION_FILENAME || importer === SHIM_FILENAME);
|
|
256555
256652
|
}
|
|
256556
256653
|
function relativeModulePath(importer, specifier) {
|
|
256557
256654
|
if (!specifier.startsWith("./") && !specifier.startsWith("../"))
|
|
@@ -256571,7 +256668,7 @@ function privateDataSourcesVirtualPlugin() {
|
|
|
256571
256668
|
setup(build) {
|
|
256572
256669
|
build.onResolve({ filter: /^base44:private-data-sources(?:\/.*)?$/ }, (args) => {
|
|
256573
256670
|
if (args.path === INTERNAL_STORE_SPECIFIER) {
|
|
256574
|
-
if (!
|
|
256671
|
+
if (!isRuntimeShimImporter(args.namespace, args.importer)) {
|
|
256575
256672
|
return {
|
|
256576
256673
|
errors: [
|
|
256577
256674
|
{
|
|
@@ -262348,25 +262445,14 @@ async function siteDevAction(ctx, forwarded) {
|
|
|
262348
262445
|
const site = siteOrDefault(project);
|
|
262349
262446
|
const serveCommand = site.serveCommand ?? DEFAULT_SERVE_COMMAND;
|
|
262350
262447
|
const command = [serveCommand, ...forwarded].join(" ");
|
|
262351
|
-
const
|
|
262352
|
-
|
|
262353
|
-
|
|
262354
|
-
|
|
262355
|
-
|
|
262356
|
-
|
|
262357
|
-
|
|
262358
|
-
|
|
262359
|
-
runner.onExit((code) => {
|
|
262360
|
-
if (line !== fallback && isCommandNotFoundExit(code)) {
|
|
262361
|
-
warnSiteCommandFallback(line, fallback);
|
|
262362
|
-
serve(fallback);
|
|
262363
|
-
return;
|
|
262364
|
-
}
|
|
262365
|
-
process.exit(code ?? 1);
|
|
262366
|
-
});
|
|
262367
|
-
runner.start();
|
|
262368
|
-
};
|
|
262369
|
-
serve(command);
|
|
262448
|
+
const runner = createServeCommandRunner({
|
|
262449
|
+
serveCommand: command,
|
|
262450
|
+
projectRoot: project.root,
|
|
262451
|
+
appId: app.id
|
|
262452
|
+
});
|
|
262453
|
+
stopRunnerOnProcessSignals(runner);
|
|
262454
|
+
runner.onExit((code) => process.exit(code ?? 1));
|
|
262455
|
+
runner.start();
|
|
262370
262456
|
return { outroMessage: `Frontend dev server running '${command}'` };
|
|
262371
262457
|
}
|
|
262372
262458
|
function getSiteDevCommand() {
|
|
@@ -262379,16 +262465,12 @@ async function installAction({
|
|
|
262379
262465
|
}) {
|
|
262380
262466
|
const project = await readProjectSettingsOrDefaults();
|
|
262381
262467
|
const { installCommand } = siteOrDefault(project);
|
|
262382
|
-
|
|
262383
|
-
await runTask("Installing site dependencies...", () => runSiteCommandOrDefault(installCommand, DEFAULT_SITE.installCommand, (command) => {
|
|
262384
|
-
ran = command;
|
|
262385
|
-
return execa({ cwd: project.root, shell: true })`${command}`;
|
|
262386
|
-
}), {
|
|
262468
|
+
await runTask("Installing site dependencies...", () => execa({ cwd: project.root, shell: true })`${installCommand}`, {
|
|
262387
262469
|
successMessage: "Dependencies installed",
|
|
262388
262470
|
errorMessage: "Install failed"
|
|
262389
262471
|
});
|
|
262390
262472
|
return {
|
|
262391
|
-
outroMessage: `Installed with ${theme.styles.bold(
|
|
262473
|
+
outroMessage: `Installed with ${theme.styles.bold(installCommand)}`
|
|
262392
262474
|
};
|
|
262393
262475
|
}
|
|
262394
262476
|
function getSiteInstallCommand() {
|
|
@@ -271320,4 +271402,4 @@ export {
|
|
|
271320
271402
|
runCLI
|
|
271321
271403
|
};
|
|
271322
271404
|
|
|
271323
|
-
//# debugId=
|
|
271405
|
+
//# debugId=5ADBB560F1D5EE5164756E2164756E21
|