@absolutejs/absolute 0.19.0-beta.1051 → 0.19.0-beta.1053
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/angular/browser.js +3 -2
- package/dist/angular/browser.js.map +6 -6
- package/dist/angular/components/constants.js +6 -0
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/hmrPreserveCore.ts +2 -8
- package/dist/angular/index.js +3 -2
- package/dist/angular/index.js.map +8 -8
- package/dist/angular/server.js +3 -2
- package/dist/angular/server.js.map +5 -5
- package/dist/build.js +49 -15
- package/dist/build.js.map +24 -24
- package/dist/cli/config/client.js +1 -1
- package/dist/cli/config/server.js +93 -28
- package/dist/cli/index.js +413 -121
- package/dist/client/index.js.map +1 -1
- package/dist/dev/client/errorOverlay.ts +4 -4
- package/dist/dev/client/handlers/angularHmrShim.ts +1 -1
- package/dist/dev/client/handlers/angularRemount.ts +1 -4
- package/dist/dev/client/handlers/angularRemountWiring.ts +0 -1
- package/dist/index.js +50 -15
- package/dist/index.js.map +26 -26
- package/dist/islands/browser.js.map +1 -1
- package/dist/islands/index.js +3 -2
- package/dist/islands/index.js.map +4 -4
- package/dist/react/browser.js.map +1 -1
- package/dist/react/components/index.js +3 -2
- package/dist/react/components/index.js.map +3 -3
- package/dist/react/hooks/index.js.map +1 -1
- package/dist/react/index.js +3 -2
- package/dist/react/index.js.map +6 -6
- package/dist/react/server.js +3 -2
- package/dist/react/server.js.map +5 -5
- package/dist/src/angular/components/constants.d.ts +1 -0
- package/dist/src/cli/scripts/db.d.ts +20 -0
- package/dist/src/constants.d.ts +1 -0
- package/dist/svelte/browser.js.map +1 -1
- package/dist/svelte/index.js +3 -2
- package/dist/svelte/index.js.map +6 -6
- package/dist/svelte/router/hashMode.ts +1 -1
- package/dist/svelte/router/prefetchCache.ts +3 -3
- package/dist/svelte/server.js +3 -2
- package/dist/svelte/server.js.map +5 -5
- package/dist/types/globals.d.ts +1 -3
- package/dist/vue/browser.js.map +1 -1
- package/dist/vue/components/Image.js +3 -2
- package/dist/vue/components/Image.js.map +3 -3
- package/dist/vue/components/index.js +3 -2
- package/dist/vue/components/index.js.map +3 -3
- package/dist/vue/index.js +3 -2
- package/dist/vue/index.js.map +7 -7
- package/dist/vue/server.js +3 -2
- package/dist/vue/server.js.map +6 -6
- package/package.json +2 -1
package/dist/cli/index.js
CHANGED
|
@@ -172272,7 +172272,9 @@ var import_typescript3, VIRTUAL_NAME = "__absolute_type_introspect__.ts", MAX_DE
|
|
|
172272
172272
|
const candidates = specifier === "@absolutejs/absolute" ? [
|
|
172273
172273
|
resolve11(cwd, "node_modules", "@absolutejs", "absolute", "package.json"),
|
|
172274
172274
|
resolve11(cwd, "package.json")
|
|
172275
|
-
] : [
|
|
172275
|
+
] : [
|
|
172276
|
+
resolve11(cwd, "node_modules", ...specifier.split("/"), "package.json")
|
|
172277
|
+
];
|
|
172276
172278
|
for (const candidate of candidates) {
|
|
172277
172279
|
try {
|
|
172278
172280
|
const { version: version2 } = JSON.parse(readFileSync16(candidate, "utf-8"));
|
|
@@ -174055,7 +174057,10 @@ var init_authScaffolds = __esm(() => {
|
|
|
174055
174057
|
configKey: "compliance",
|
|
174056
174058
|
exportName: "complianceConfig",
|
|
174057
174059
|
fields: [
|
|
174058
|
-
{
|
|
174060
|
+
{
|
|
174061
|
+
name: "deleteUserData",
|
|
174062
|
+
value: TODO("erase or anonymize the user in your stores")
|
|
174063
|
+
},
|
|
174059
174064
|
{ name: "exportUserData", value: "async ({ user }) => ({})" },
|
|
174060
174065
|
{ name: "getUserId", value: "(user) => user.sub" }
|
|
174061
174066
|
],
|
|
@@ -174069,10 +174074,19 @@ var init_authScaffolds = __esm(() => {
|
|
|
174069
174074
|
configKey: "credentials",
|
|
174070
174075
|
exportName: "credentialsConfig",
|
|
174071
174076
|
fields: [
|
|
174072
|
-
{
|
|
174077
|
+
{
|
|
174078
|
+
name: "credentialStore",
|
|
174079
|
+
value: "createInMemoryCredentialStore()"
|
|
174080
|
+
},
|
|
174073
174081
|
{ name: "getUserByEmail", value: TODO("look up a user by email") },
|
|
174074
|
-
{
|
|
174075
|
-
|
|
174082
|
+
{
|
|
174083
|
+
name: "onCreateCredentialUser",
|
|
174084
|
+
value: TODO("create and return the user for identity.email")
|
|
174085
|
+
},
|
|
174086
|
+
{
|
|
174087
|
+
name: "onSendEmail",
|
|
174088
|
+
value: TODO("send the verification / reset email containing message.token")
|
|
174089
|
+
},
|
|
174076
174090
|
{ name: "requireEmailVerification", value: "false" }
|
|
174077
174091
|
],
|
|
174078
174092
|
generic: true,
|
|
@@ -174101,7 +174115,10 @@ var init_authScaffolds = __esm(() => {
|
|
|
174101
174115
|
fields: [
|
|
174102
174116
|
{ name: "mfaStore", value: "createInMemoryMfaStore()" },
|
|
174103
174117
|
{ name: "getUserId", value: "(user) => user.sub" },
|
|
174104
|
-
{
|
|
174118
|
+
{
|
|
174119
|
+
name: "getChallengeUser",
|
|
174120
|
+
value: TODO("resolve the parked challenge identity to a user")
|
|
174121
|
+
},
|
|
174105
174122
|
{ name: "issuer", value: "'YourApp'" }
|
|
174106
174123
|
],
|
|
174107
174124
|
generic: true,
|
|
@@ -174115,7 +174132,10 @@ var init_authScaffolds = __esm(() => {
|
|
|
174115
174132
|
exportName: "organizationsConfig",
|
|
174116
174133
|
fields: [
|
|
174117
174134
|
{ name: "getUserId", value: "(user) => user.sub" },
|
|
174118
|
-
{
|
|
174135
|
+
{
|
|
174136
|
+
name: "organizationStore",
|
|
174137
|
+
value: "createInMemoryOrganizationStore()"
|
|
174138
|
+
}
|
|
174119
174139
|
],
|
|
174120
174140
|
generic: true,
|
|
174121
174141
|
imports: ["createInMemoryOrganizationStore"],
|
|
@@ -174127,9 +174147,15 @@ var init_authScaffolds = __esm(() => {
|
|
|
174127
174147
|
configKey: "passwordless",
|
|
174128
174148
|
exportName: "passwordlessConfig",
|
|
174129
174149
|
fields: [
|
|
174130
|
-
{
|
|
174150
|
+
{
|
|
174151
|
+
name: "passwordlessTokenStore",
|
|
174152
|
+
value: "createInMemoryPasswordlessTokenStore()"
|
|
174153
|
+
},
|
|
174131
174154
|
{ name: "getUserByEmail", value: TODO("look up a user by email") },
|
|
174132
|
-
{
|
|
174155
|
+
{
|
|
174156
|
+
name: "onSendMagicLink",
|
|
174157
|
+
value: TODO("email the magic link containing message.token")
|
|
174158
|
+
}
|
|
174133
174159
|
],
|
|
174134
174160
|
generic: true,
|
|
174135
174161
|
imports: ["createInMemoryPasswordlessTokenStore"],
|
|
@@ -174141,7 +174167,10 @@ var init_authScaffolds = __esm(() => {
|
|
|
174141
174167
|
configKey: "portal",
|
|
174142
174168
|
exportName: "portalConfig",
|
|
174143
174169
|
fields: [
|
|
174144
|
-
{
|
|
174170
|
+
{
|
|
174171
|
+
name: "setupSessionStore",
|
|
174172
|
+
value: "createInMemorySetupSessionStore()"
|
|
174173
|
+
}
|
|
174145
174174
|
],
|
|
174146
174175
|
generic: false,
|
|
174147
174176
|
imports: ["createInMemorySetupSessionStore"],
|
|
@@ -174154,7 +174183,10 @@ var init_authScaffolds = __esm(() => {
|
|
|
174154
174183
|
exportName: "rolesConfig",
|
|
174155
174184
|
fields: [
|
|
174156
174185
|
{ name: "getUserId", value: "(user) => user.sub" },
|
|
174157
|
-
{
|
|
174186
|
+
{
|
|
174187
|
+
name: "organizationStore",
|
|
174188
|
+
value: "createInMemoryOrganizationStore()"
|
|
174189
|
+
},
|
|
174158
174190
|
{ name: "roleStore", value: "createInMemoryRoleStore()" }
|
|
174159
174191
|
],
|
|
174160
174192
|
generic: true,
|
|
@@ -174168,11 +174200,23 @@ var init_authScaffolds = __esm(() => {
|
|
|
174168
174200
|
exportName: "scimConfig",
|
|
174169
174201
|
fields: [
|
|
174170
174202
|
{ name: "scimTokenStore", value: "createInMemoryScimTokenStore()" },
|
|
174171
|
-
{
|
|
174203
|
+
{
|
|
174204
|
+
name: "getScimUser",
|
|
174205
|
+
value: TODO("return the SCIM user for { id, organizationId }")
|
|
174206
|
+
},
|
|
174172
174207
|
{ name: "listScimUsers", value: "async () => []" },
|
|
174173
|
-
{
|
|
174174
|
-
|
|
174175
|
-
|
|
174208
|
+
{
|
|
174209
|
+
name: "onScimUserCreate",
|
|
174210
|
+
value: TODO("create and return the SCIM user")
|
|
174211
|
+
},
|
|
174212
|
+
{
|
|
174213
|
+
name: "onScimUserDeactivate",
|
|
174214
|
+
value: TODO("deprovision the user (hard-delete or deactivate)")
|
|
174215
|
+
},
|
|
174216
|
+
{
|
|
174217
|
+
name: "onScimUserReplace",
|
|
174218
|
+
value: TODO("replace and return the SCIM user (undefined if unknown)")
|
|
174219
|
+
}
|
|
174176
174220
|
],
|
|
174177
174221
|
generic: false,
|
|
174178
174222
|
imports: ["createInMemoryScimTokenStore"],
|
|
@@ -174194,8 +174238,14 @@ var init_authScaffolds = __esm(() => {
|
|
|
174194
174238
|
configKey: "sso",
|
|
174195
174239
|
exportName: "ssoConfig",
|
|
174196
174240
|
fields: [
|
|
174197
|
-
{
|
|
174198
|
-
|
|
174241
|
+
{
|
|
174242
|
+
name: "ssoConnectionStore",
|
|
174243
|
+
value: "createInMemorySsoConnectionStore()"
|
|
174244
|
+
},
|
|
174245
|
+
{
|
|
174246
|
+
name: "getSsoUser",
|
|
174247
|
+
value: TODO("map the verified SSO identity to your user (create on first sign-in)")
|
|
174248
|
+
}
|
|
174199
174249
|
],
|
|
174200
174250
|
generic: true,
|
|
174201
174251
|
imports: ["createInMemorySsoConnectionStore"],
|
|
@@ -174207,9 +174257,15 @@ var init_authScaffolds = __esm(() => {
|
|
|
174207
174257
|
configKey: "webauthn",
|
|
174208
174258
|
exportName: "webauthnConfig",
|
|
174209
174259
|
fields: [
|
|
174210
|
-
{
|
|
174260
|
+
{
|
|
174261
|
+
name: "credentialStore",
|
|
174262
|
+
value: "createInMemoryWebAuthnCredentialStore()"
|
|
174263
|
+
},
|
|
174211
174264
|
{ name: "getUserId", value: "(user) => user.sub" },
|
|
174212
|
-
{
|
|
174265
|
+
{
|
|
174266
|
+
name: "getWebAuthnUser",
|
|
174267
|
+
value: TODO("resolve a stored credential userId back to a user")
|
|
174268
|
+
},
|
|
174213
174269
|
{ name: "origin", value: "'http://localhost:3000'" },
|
|
174214
174270
|
{ name: "rpId", value: "'localhost'" },
|
|
174215
174271
|
{ name: "rpName", value: "'YourApp'" },
|
|
@@ -174219,7 +174275,10 @@ var init_authScaffolds = __esm(() => {
|
|
|
174219
174275
|
}
|
|
174220
174276
|
],
|
|
174221
174277
|
generic: true,
|
|
174222
|
-
imports: [
|
|
174278
|
+
imports: [
|
|
174279
|
+
"createInMemoryWebAuthnCredentialStore",
|
|
174280
|
+
"type WebAuthnAdapter"
|
|
174281
|
+
],
|
|
174223
174282
|
note: "Provide a real `webauthnAdapter` wrapping a vetted library (e.g. @simplewebauthn/server); set origin/rpId/rpName for your domain.",
|
|
174224
174283
|
packages: [],
|
|
174225
174284
|
typeName: "WebAuthnConfig"
|
|
@@ -175465,6 +175524,215 @@ var init_env = __esm(() => {
|
|
|
175465
175524
|
STATUS_WIDTH2 = "missing".length;
|
|
175466
175525
|
});
|
|
175467
175526
|
|
|
175527
|
+
// src/cli/scripts/db.ts
|
|
175528
|
+
var exports_db = {};
|
|
175529
|
+
__export(exports_db, {
|
|
175530
|
+
runDb: () => runDb,
|
|
175531
|
+
quoteIdent: () => quoteIdent,
|
|
175532
|
+
encodeValue: () => encodeValue,
|
|
175533
|
+
dependencyOrder: () => dependencyOrder,
|
|
175534
|
+
conflictClause: () => conflictClause,
|
|
175535
|
+
chunkRows: () => chunkRows
|
|
175536
|
+
});
|
|
175537
|
+
import { existsSync as existsSync30, mkdirSync as mkdirSync13, readFileSync as readFileSync29, writeFileSync as writeFileSync16 } from "fs";
|
|
175538
|
+
import { join as join27 } from "path";
|
|
175539
|
+
var {env: env4, spawn: spawn2, SQL } = globalThis.Bun;
|
|
175540
|
+
var BACKUP_FORMAT_VERSION = 1, RESTORE_CHUNK_ROWS = 500, URL_ENV_KEYS, JSON_DATA_TYPES, SEED_CANDIDATES, VALUE_FLAGS, paint = (text, color) => `${color}${text}${colors.reset}`, chunkRows = (items, size) => Array.from({ length: Math.ceil(items.length / size) }, (_, idx) => items.slice(idx * size, idx * size + size)), quoteIdent = (name) => `"${name.replace(/"/g, '""')}"`, resolveUrl = (explicit) => {
|
|
175541
|
+
const found = explicit ?? URL_ENV_KEYS.map((key) => env4[key]).find((value) => typeof value === "string" && value !== "");
|
|
175542
|
+
if (found === undefined || found === "")
|
|
175543
|
+
throw new Error(`No database URL found. Set ${URL_ENV_KEYS.join(" or ")}, or pass --url <url>.`);
|
|
175544
|
+
return found;
|
|
175545
|
+
}, keepTable = (name, options) => (options.only.length === 0 || options.only.includes(name)) && !options.exclude.includes(name), listTables = async (sql) => {
|
|
175546
|
+
const rows = await sql`select table_name from information_schema.tables where table_schema = ${"public"} and table_type = ${"BASE TABLE"} order by table_name`;
|
|
175547
|
+
return rows.map((row) => row.table_name);
|
|
175548
|
+
}, columnsFor = async (sql, name) => {
|
|
175549
|
+
const rows = await sql.unsafe(`select column_name, data_type from information_schema.columns where table_schema = $1 and table_name = $2 order by ordinal_position`, ["public", name]);
|
|
175550
|
+
return rows.map((row) => ({
|
|
175551
|
+
isJson: JSON_DATA_TYPES.includes(row.data_type),
|
|
175552
|
+
name: row.column_name
|
|
175553
|
+
}));
|
|
175554
|
+
}, primaryKeyFor = async (sql, name) => {
|
|
175555
|
+
const rows = await sql.unsafe(`select a.attname as col from pg_index i join pg_attribute a on a.attrelid = i.indrelid and a.attnum = any(i.indkey) where i.indrelid = $1::regclass and i.indisprimary order by a.attnum`, [`public.${quoteIdent(name)}`]);
|
|
175556
|
+
return rows.map((row) => row.col);
|
|
175557
|
+
}, tableMeta = async (sql, name) => {
|
|
175558
|
+
const [columns, primaryKey] = await Promise.all([
|
|
175559
|
+
columnsFor(sql, name),
|
|
175560
|
+
primaryKeyFor(sql, name)
|
|
175561
|
+
]);
|
|
175562
|
+
return { columns, name, primaryKey };
|
|
175563
|
+
}, foreignLinks = async (sql) => {
|
|
175564
|
+
const rows = await sql.unsafe(`select tc.table_name as child, ccu.table_name as parent from information_schema.table_constraints tc join information_schema.constraint_column_usage ccu on ccu.constraint_name = tc.constraint_name and ccu.table_schema = tc.table_schema where tc.constraint_type = 'FOREIGN KEY' and tc.table_schema = $1`, ["public"]);
|
|
175565
|
+
return rows.map((row) => ({
|
|
175566
|
+
from: row.child,
|
|
175567
|
+
to: row.parent
|
|
175568
|
+
}));
|
|
175569
|
+
}, conflictClause = (meta) => {
|
|
175570
|
+
if (meta.primaryKey.length === 0)
|
|
175571
|
+
return "on conflict do nothing";
|
|
175572
|
+
const target = meta.primaryKey.map(quoteIdent).join(", ");
|
|
175573
|
+
const updatable = meta.columns.map((col) => col.name).filter((name) => !meta.primaryKey.includes(name));
|
|
175574
|
+
if (updatable.length === 0)
|
|
175575
|
+
return `on conflict (${target}) do nothing`;
|
|
175576
|
+
const sets = updatable.map((name) => `${quoteIdent(name)} = excluded.${quoteIdent(name)}`).join(", ");
|
|
175577
|
+
return `on conflict (${target}) do update set ${sets}`;
|
|
175578
|
+
}, dependencyOrder = (names, links) => {
|
|
175579
|
+
const present = new Set(names);
|
|
175580
|
+
const edges = links.filter((link) => present.has(link.from) && present.has(link.to) && link.from !== link.to);
|
|
175581
|
+
const indegree = new Map(names.map((name) => [name, 0]));
|
|
175582
|
+
edges.forEach((link) => indegree.set(link.from, (indegree.get(link.from) ?? 0) + 1));
|
|
175583
|
+
const ready = names.filter((name) => (indegree.get(name) ?? 0) === 0);
|
|
175584
|
+
const ordered = [];
|
|
175585
|
+
const release = (parent) => edges.filter((link) => link.to === parent).forEach((link) => {
|
|
175586
|
+
const next = (indegree.get(link.from) ?? 0) - 1;
|
|
175587
|
+
indegree.set(link.from, next);
|
|
175588
|
+
if (next === 0)
|
|
175589
|
+
ready.push(link.from);
|
|
175590
|
+
});
|
|
175591
|
+
const drain = () => {
|
|
175592
|
+
const head = ready.shift();
|
|
175593
|
+
if (head === undefined)
|
|
175594
|
+
return;
|
|
175595
|
+
ordered.push(head);
|
|
175596
|
+
release(head);
|
|
175597
|
+
drain();
|
|
175598
|
+
};
|
|
175599
|
+
drain();
|
|
175600
|
+
names.forEach((name) => {
|
|
175601
|
+
if (!ordered.includes(name))
|
|
175602
|
+
ordered.push(name);
|
|
175603
|
+
});
|
|
175604
|
+
return ordered;
|
|
175605
|
+
}, encodeValue = (col, value) => {
|
|
175606
|
+
if (value === null || value === undefined)
|
|
175607
|
+
return null;
|
|
175608
|
+
if (col.isJson)
|
|
175609
|
+
return JSON.stringify(value);
|
|
175610
|
+
return value;
|
|
175611
|
+
}, insertChunk = async (sql, meta, rows) => {
|
|
175612
|
+
const colNames = meta.columns.map((col) => col.name);
|
|
175613
|
+
const groups = rows.map((_, rowIdx) => {
|
|
175614
|
+
const base = rowIdx * colNames.length;
|
|
175615
|
+
const slots = [...colNames.keys()].map((colIdx) => `$${base + colIdx + 1}`);
|
|
175616
|
+
return `(${slots.join(", ")})`;
|
|
175617
|
+
});
|
|
175618
|
+
const params = rows.flatMap((row) => meta.columns.map((col) => encodeValue(col, row[col.name])));
|
|
175619
|
+
const columnList = colNames.map(quoteIdent).join(", ");
|
|
175620
|
+
const query = `insert into ${quoteIdent(meta.name)} (${columnList}) values ${groups.join(", ")} ${conflictClause(meta)}`;
|
|
175621
|
+
await sql.unsafe(query, params);
|
|
175622
|
+
}, restoreTable = async (sql, meta, rows) => {
|
|
175623
|
+
if (meta === undefined || rows.length === 0)
|
|
175624
|
+
return;
|
|
175625
|
+
await chunkRows(rows, RESTORE_CHUNK_ROWS).reduce(async (prev, part) => {
|
|
175626
|
+
await prev;
|
|
175627
|
+
return insertChunk(sql, meta, part);
|
|
175628
|
+
}, Promise.resolve());
|
|
175629
|
+
}, truncateAll = async (sql, names) => {
|
|
175630
|
+
if (names.length === 0)
|
|
175631
|
+
return;
|
|
175632
|
+
const list = names.map(quoteIdent).join(", ");
|
|
175633
|
+
await sql.unsafe(`truncate ${list} restart identity cascade`);
|
|
175634
|
+
}, runBackup = async (options) => {
|
|
175635
|
+
const sql = new SQL(options.url);
|
|
175636
|
+
const chosen = (await listTables(sql)).filter((name) => keepTable(name, options));
|
|
175637
|
+
const dumps = await Promise.all(chosen.map(async (name) => {
|
|
175638
|
+
const rows = await sql.unsafe(`select * from ${quoteIdent(name)}`);
|
|
175639
|
+
return [name, rows];
|
|
175640
|
+
}));
|
|
175641
|
+
await sql.end();
|
|
175642
|
+
const tables = Object.fromEntries(dumps);
|
|
175643
|
+
const payload = {
|
|
175644
|
+
at: new Date().toISOString(),
|
|
175645
|
+
tables,
|
|
175646
|
+
v: BACKUP_FORMAT_VERSION
|
|
175647
|
+
};
|
|
175648
|
+
const dir = options.out ?? join27(process.cwd(), "backups");
|
|
175649
|
+
mkdirSync13(dir, { recursive: true });
|
|
175650
|
+
const json = JSON.stringify(payload, (_, value) => typeof value === "bigint" ? value.toString() : value);
|
|
175651
|
+
const file = join27(dir, `backup-${payload.at.replace(/[:.]/g, "-")}.json`);
|
|
175652
|
+
writeFileSync16(file, json);
|
|
175653
|
+
writeFileSync16(join27(dir, "latest.json"), json);
|
|
175654
|
+
const total = chosen.reduce((sum, name) => sum + (tables[name]?.length ?? 0), 0);
|
|
175655
|
+
console.log(paint(`\u2713 backup \u2192 ${file}`, colors.green));
|
|
175656
|
+
console.log(paint(` ${chosen.length} tables, ${total} rows`, colors.dim));
|
|
175657
|
+
}, runRestore = async (file, options) => {
|
|
175658
|
+
if (!existsSync30(file))
|
|
175659
|
+
throw new Error(`Backup not found: ${file}`);
|
|
175660
|
+
const payload = JSON.parse(readFileSync29(file, "utf-8"));
|
|
175661
|
+
const names = Object.keys(payload.tables).filter((name) => keepTable(name, options));
|
|
175662
|
+
const sql = new SQL(options.url);
|
|
175663
|
+
const order = dependencyOrder(names, await foreignLinks(sql));
|
|
175664
|
+
const metas = await Promise.all(order.map((name) => tableMeta(sql, name)));
|
|
175665
|
+
const metaByName = new Map(metas.map((meta) => [meta.name, meta]));
|
|
175666
|
+
const aborted = options.truncate && !options.yes && prompt(paint(`\u26A0 TRUNCATE ${order.length} tables before restore? type "yes": `, colors.yellow)) !== "yes";
|
|
175667
|
+
if (aborted) {
|
|
175668
|
+
await sql.end();
|
|
175669
|
+
console.log(paint("aborted", colors.yellow));
|
|
175670
|
+
return;
|
|
175671
|
+
}
|
|
175672
|
+
if (options.truncate)
|
|
175673
|
+
await truncateAll(sql, [...order].reverse());
|
|
175674
|
+
await order.reduce(async (prev, name) => {
|
|
175675
|
+
await prev;
|
|
175676
|
+
return restoreTable(sql, metaByName.get(name), payload.tables[name] ?? []);
|
|
175677
|
+
}, Promise.resolve());
|
|
175678
|
+
await sql.end();
|
|
175679
|
+
const total = order.reduce((sum, name) => sum + (payload.tables[name]?.length ?? 0), 0);
|
|
175680
|
+
console.log(paint(`\u2713 restored ${order.length} tables, ${total} rows (idempotent upsert by primary key)`, colors.green));
|
|
175681
|
+
}, runSeed = async (entry) => {
|
|
175682
|
+
const target = entry ?? SEED_CANDIDATES.find((candidate) => existsSync30(join27(process.cwd(), candidate)));
|
|
175683
|
+
if (target === undefined)
|
|
175684
|
+
throw new Error(`No seed script found (looked for ${SEED_CANDIDATES.join(", ")}). Pass a path: absolute db seed <file>.`);
|
|
175685
|
+
console.log(paint(`seeding via ${target}\u2026`, colors.cyan));
|
|
175686
|
+
const proc = spawn2(["bun", "run", target], {
|
|
175687
|
+
stderr: "inherit",
|
|
175688
|
+
stdin: "inherit",
|
|
175689
|
+
stdout: "inherit"
|
|
175690
|
+
});
|
|
175691
|
+
const code = await proc.exited;
|
|
175692
|
+
if (code !== 0)
|
|
175693
|
+
throw new Error(`Seed failed (exit ${code}).`);
|
|
175694
|
+
}, flagValue = (rest, flag) => {
|
|
175695
|
+
const idx = rest.indexOf(flag);
|
|
175696
|
+
return idx === UNFOUND_INDEX ? undefined : rest[idx + 1];
|
|
175697
|
+
}, listValue = (rest, flag) => (flagValue(rest, flag) ?? "").split(",").map((part) => part.trim()).filter((part) => part !== ""), parseOptions = (rest) => ({
|
|
175698
|
+
exclude: listValue(rest, "--exclude"),
|
|
175699
|
+
only: listValue(rest, "--only"),
|
|
175700
|
+
out: flagValue(rest, "--out"),
|
|
175701
|
+
truncate: rest.includes("--truncate"),
|
|
175702
|
+
url: resolveUrl(flagValue(rest, "--url")),
|
|
175703
|
+
yes: rest.includes("--yes") || rest.includes("-y")
|
|
175704
|
+
}), positionalArgs = (rest) => rest.filter((arg, idx) => !arg.startsWith("-") && !VALUE_FLAGS.includes(rest[idx - 1] ?? "")), usage = () => {
|
|
175705
|
+
console.error("Usage: absolute db <backup|restore|seed> [options]");
|
|
175706
|
+
console.error(" backup [--out <dir>] [--only a,b] [--exclude a,b] [--url <url>] Dump tables \u2192 JSON (+ latest.json)");
|
|
175707
|
+
console.error(" restore [file] [--truncate] [--only a,b] [--exclude a,b] [-y] Idempotent upsert by primary key");
|
|
175708
|
+
console.error(" seed [file] Run the project\u2019s seed script");
|
|
175709
|
+
process.exit(1);
|
|
175710
|
+
}, runDb = async (args) => {
|
|
175711
|
+
const [sub, ...rest] = args;
|
|
175712
|
+
if (sub === "backup") {
|
|
175713
|
+
await runBackup(parseOptions(rest));
|
|
175714
|
+
return;
|
|
175715
|
+
}
|
|
175716
|
+
if (sub === "restore") {
|
|
175717
|
+
const file = positionalArgs(rest)[0] ?? join27(process.cwd(), "backups", "latest.json");
|
|
175718
|
+
await runRestore(file, parseOptions(rest));
|
|
175719
|
+
return;
|
|
175720
|
+
}
|
|
175721
|
+
if (sub === "seed") {
|
|
175722
|
+
await runSeed(positionalArgs(rest)[0]);
|
|
175723
|
+
return;
|
|
175724
|
+
}
|
|
175725
|
+
usage();
|
|
175726
|
+
};
|
|
175727
|
+
var init_db = __esm(() => {
|
|
175728
|
+
init_constants();
|
|
175729
|
+
init_tuiPrimitives();
|
|
175730
|
+
URL_ENV_KEYS = ["DATABASE_URL", "POSTGRES_URL", "DATABASE_URL_UNPOOLED"];
|
|
175731
|
+
JSON_DATA_TYPES = ["json", "jsonb"];
|
|
175732
|
+
SEED_CANDIDATES = ["db/seed.ts", "src/db/seed.ts", "seed.ts"];
|
|
175733
|
+
VALUE_FLAGS = ["--out", "--url", "--only", "--exclude"];
|
|
175734
|
+
});
|
|
175735
|
+
|
|
175468
175736
|
// src/cli/scripts/logs.ts
|
|
175469
175737
|
var exports_logs = {};
|
|
175470
175738
|
__export(exports_logs, {
|
|
@@ -175472,7 +175740,7 @@ __export(exports_logs, {
|
|
|
175472
175740
|
});
|
|
175473
175741
|
import {
|
|
175474
175742
|
closeSync as closeSync2,
|
|
175475
|
-
existsSync as
|
|
175743
|
+
existsSync as existsSync31,
|
|
175476
175744
|
openSync as openSync4,
|
|
175477
175745
|
readSync as readSync2,
|
|
175478
175746
|
statSync as statSync4,
|
|
@@ -175539,7 +175807,7 @@ var DEFAULT_LINES = 40, POLL_MS = 250, LINES_FLAG_SPAN = 2, readFrom = (path, st
|
|
|
175539
175807
|
printAvailable(instances);
|
|
175540
175808
|
return;
|
|
175541
175809
|
}
|
|
175542
|
-
if (match.logFile === null || !
|
|
175810
|
+
if (match.logFile === null || !existsSync31(match.logFile)) {
|
|
175543
175811
|
printDim3(`"${name}" has no captured log (untracked, or started outside the CLI).`);
|
|
175544
175812
|
return;
|
|
175545
175813
|
}
|
|
@@ -175562,10 +175830,10 @@ var exports_doctor = {};
|
|
|
175562
175830
|
__export(exports_doctor, {
|
|
175563
175831
|
runDoctor: () => runDoctor
|
|
175564
175832
|
});
|
|
175565
|
-
import { existsSync as
|
|
175833
|
+
import { existsSync as existsSync32, mkdirSync as mkdirSync14, readFileSync as readFileSync30, writeFileSync as writeFileSync17 } from "fs";
|
|
175566
175834
|
import { createRequire } from "module";
|
|
175567
175835
|
import { arch as arch4, platform as platform5 } from "os";
|
|
175568
|
-
import { join as
|
|
175836
|
+
import { join as join28 } from "path";
|
|
175569
175837
|
var FRAMEWORK_FIELDS2, projectRequire, check = (status2, label, detail) => ({
|
|
175570
175838
|
detail,
|
|
175571
175839
|
label,
|
|
@@ -175600,7 +175868,7 @@ var FRAMEWORK_FIELDS2, projectRequire, check = (status2, label, detail) => ({
|
|
|
175600
175868
|
return [];
|
|
175601
175869
|
const label = `${field.replace("Directory", "")} pages`;
|
|
175602
175870
|
return [
|
|
175603
|
-
|
|
175871
|
+
existsSync32(join28(process.cwd(), dir)) ? check("ok", label, dir) : check("fail", label, `${dir} (missing)`)
|
|
175604
175872
|
];
|
|
175605
175873
|
}), envCheck = async () => {
|
|
175606
175874
|
const vars = await collectEnvVars();
|
|
@@ -175633,7 +175901,7 @@ ${colors.dim}${checks.length} checks \xB7 ${colors.reset}${summary}${colors.dim}
|
|
|
175633
175901
|
}, gatherChecks = async () => {
|
|
175634
175902
|
const config = await loadConfigOrNull();
|
|
175635
175903
|
const configCheck = config === null ? check("fail", "Config", "absolute.config.ts not found or invalid") : check("ok", "Config", "absolute.config.ts loaded");
|
|
175636
|
-
const [
|
|
175904
|
+
const [env5, port] = await Promise.all([
|
|
175637
175905
|
envCheck(),
|
|
175638
175906
|
config === null ? check("warn", "Dev port", "skipped (no config)") : portCheck(config)
|
|
175639
175907
|
]);
|
|
@@ -175643,16 +175911,16 @@ ${colors.dim}${checks.length} checks \xB7 ${colors.reset}${summary}${colors.dim}
|
|
|
175643
175911
|
checkNative(),
|
|
175644
175912
|
configCheck,
|
|
175645
175913
|
...config === null ? [] : frameworkChecks(config),
|
|
175646
|
-
|
|
175914
|
+
env5,
|
|
175647
175915
|
port
|
|
175648
175916
|
];
|
|
175649
175917
|
}, fixFrameworkDirs = (cwd, config) => {
|
|
175650
175918
|
const fixes = [];
|
|
175651
175919
|
for (const field of FRAMEWORK_FIELDS2) {
|
|
175652
175920
|
const dir = readString(config, field);
|
|
175653
|
-
if (dir === undefined ||
|
|
175921
|
+
if (dir === undefined || existsSync32(join28(cwd, dir)))
|
|
175654
175922
|
continue;
|
|
175655
|
-
|
|
175923
|
+
mkdirSync14(join28(cwd, dir, "pages"), { recursive: true });
|
|
175656
175924
|
fixes.push(`created ${dir}/pages`);
|
|
175657
175925
|
}
|
|
175658
175926
|
return fixes;
|
|
@@ -175660,8 +175928,8 @@ ${colors.dim}${checks.length} checks \xB7 ${colors.reset}${summary}${colors.dim}
|
|
|
175660
175928
|
const missing = (await collectEnvVars()).filter((entry) => !entry.set);
|
|
175661
175929
|
if (missing.length === 0)
|
|
175662
175930
|
return null;
|
|
175663
|
-
const envExample =
|
|
175664
|
-
const existing =
|
|
175931
|
+
const envExample = join28(cwd, ".env.example");
|
|
175932
|
+
const existing = existsSync32(envExample) ? readFileSync30(envExample, "utf-8") : "";
|
|
175665
175933
|
const existingKeys = new Set(existing.split(`
|
|
175666
175934
|
`).map((line) => line.split("=")[0]?.trim()));
|
|
175667
175935
|
const toAdd = missing.filter((entry) => !existingKeys.has(entry.key));
|
|
@@ -175670,7 +175938,7 @@ ${colors.dim}${checks.length} checks \xB7 ${colors.reset}${summary}${colors.dim}
|
|
|
175670
175938
|
const prefix = existing === "" || existing.endsWith(`
|
|
175671
175939
|
`) ? existing : `${existing}
|
|
175672
175940
|
`;
|
|
175673
|
-
|
|
175941
|
+
writeFileSync17(envExample, `${prefix}${toAdd.map((entry) => `${entry.key}=`).join(`
|
|
175674
175942
|
`)}
|
|
175675
175943
|
`);
|
|
175676
175944
|
return `added ${toAdd.length} key(s) to .env.example`;
|
|
@@ -175716,7 +175984,7 @@ var init_doctor = __esm(() => {
|
|
|
175716
175984
|
"htmlDirectory",
|
|
175717
175985
|
"htmxDirectory"
|
|
175718
175986
|
];
|
|
175719
|
-
projectRequire = createRequire(
|
|
175987
|
+
projectRequire = createRequire(join28(process.cwd(), "package.json"));
|
|
175720
175988
|
STATUS_MARK = {
|
|
175721
175989
|
fail: `${colors.red}\u2717${colors.reset}`,
|
|
175722
175990
|
ok: `${colors.green}\u2713${colors.reset}`,
|
|
@@ -176020,10 +176288,10 @@ var init_inspect = __esm(() => {
|
|
|
176020
176288
|
});
|
|
176021
176289
|
|
|
176022
176290
|
// src/build/scanEntryPoints.ts
|
|
176023
|
-
import { existsSync as
|
|
176291
|
+
import { existsSync as existsSync33 } from "fs";
|
|
176024
176292
|
var {Glob: Glob4 } = globalThis.Bun;
|
|
176025
176293
|
var scanEntryPoints = async (dir, pattern) => {
|
|
176026
|
-
if (!
|
|
176294
|
+
if (!existsSync33(dir))
|
|
176027
176295
|
return [];
|
|
176028
176296
|
const entryPaths = [];
|
|
176029
176297
|
const glob = new Glob4(pattern);
|
|
@@ -176053,10 +176321,10 @@ var islandFrameworks, islandHydrationModes, isIslandFramework = (value) => islan
|
|
|
176053
176321
|
framework,
|
|
176054
176322
|
hydrate: hydrateCandidate && isIslandHydrate(hydrateCandidate) ? hydrateCandidate : undefined
|
|
176055
176323
|
};
|
|
176056
|
-
}, normalizeUsage = (
|
|
176057
|
-
if (!
|
|
176324
|
+
}, normalizeUsage = (usage2) => `${usage2.framework}:${usage2.component}:${usage2.hydrate ?? ""}`, addUsage = (usageMap, usage2) => {
|
|
176325
|
+
if (!usage2)
|
|
176058
176326
|
return;
|
|
176059
|
-
usageMap.set(normalizeUsage(
|
|
176327
|
+
usageMap.set(normalizeUsage(usage2), usage2);
|
|
176060
176328
|
}, addRenderCallUsage = (usageMap, match) => {
|
|
176061
176329
|
const [, framework, component, hydrate] = match;
|
|
176062
176330
|
if (!framework || !component || !isIslandFramework(framework)) {
|
|
@@ -176105,7 +176373,7 @@ var init_sourceMetadata = __esm(() => {
|
|
|
176105
176373
|
});
|
|
176106
176374
|
|
|
176107
176375
|
// src/islands/pageMetadata.ts
|
|
176108
|
-
import { readFileSync as
|
|
176376
|
+
import { readFileSync as readFileSync31 } from "fs";
|
|
176109
176377
|
import { dirname as dirname12, resolve as resolve18 } from "path";
|
|
176110
176378
|
var pagePatterns, getPageDirs = (config) => [
|
|
176111
176379
|
{ dir: config.angularDirectory, framework: "angular" },
|
|
@@ -176130,19 +176398,19 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
176130
176398
|
lookup.set(`${definition.framework}:${definition.component}`, resolve18(resolvedSource));
|
|
176131
176399
|
}
|
|
176132
176400
|
return lookup;
|
|
176133
|
-
}, resolveIslandUsages = (islands, islandSourceLookup) => islands.map((
|
|
176134
|
-
const sourcePath = islandSourceLookup.get(`${
|
|
176401
|
+
}, resolveIslandUsages = (islands, islandSourceLookup) => islands.map((usage2) => {
|
|
176402
|
+
const sourcePath = islandSourceLookup.get(`${usage2.framework}:${usage2.component}`);
|
|
176135
176403
|
return sourcePath ? {
|
|
176136
|
-
...
|
|
176404
|
+
...usage2,
|
|
176137
176405
|
source: sourcePath
|
|
176138
|
-
} :
|
|
176406
|
+
} : usage2;
|
|
176139
176407
|
}), loadPageIslandFiles = async (entry, islandSourceLookup, pageMetadata) => {
|
|
176140
176408
|
const pattern = pagePatterns[entry.framework];
|
|
176141
176409
|
if (!pattern)
|
|
176142
176410
|
return;
|
|
176143
176411
|
const files = await scanEntryPoints(resolve18(entry.dir), pattern);
|
|
176144
176412
|
for (const filePath of files) {
|
|
176145
|
-
const source =
|
|
176413
|
+
const source = readFileSync31(filePath, "utf-8");
|
|
176146
176414
|
const islands = extractIslandUsagesFromSource(source);
|
|
176147
176415
|
pageMetadata.set(resolve18(filePath), {
|
|
176148
176416
|
islands: resolveIslandUsages(islands, islandSourceLookup),
|
|
@@ -176175,8 +176443,8 @@ var exports_islands = {};
|
|
|
176175
176443
|
__export(exports_islands, {
|
|
176176
176444
|
runIslands: () => runIslands
|
|
176177
176445
|
});
|
|
176178
|
-
import { existsSync as
|
|
176179
|
-
import { join as
|
|
176446
|
+
import { existsSync as existsSync34, readFileSync as readFileSync32, statSync as statSync5 } from "fs";
|
|
176447
|
+
import { join as join29, relative as relative10, resolve as resolve19 } from "path";
|
|
176180
176448
|
var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim6 = (message) => process.stdout.write(`${colors.dim}${message}${colors.reset}
|
|
176181
176449
|
`), hostFrameworkOf = (pagePath, cwd, config) => {
|
|
176182
176450
|
const resolved = resolve19(cwd, pagePath);
|
|
@@ -176194,13 +176462,13 @@ var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim6 = (message) => process.stdout.
|
|
|
176194
176462
|
return 0;
|
|
176195
176463
|
}
|
|
176196
176464
|
}, readManifestSizes2 = (manifestDir) => {
|
|
176197
|
-
const manifestPath =
|
|
176198
|
-
if (!
|
|
176465
|
+
const manifestPath = join29(manifestDir, "manifest.json");
|
|
176466
|
+
if (!existsSync34(manifestPath))
|
|
176199
176467
|
return null;
|
|
176200
|
-
const manifest = JSON.parse(
|
|
176468
|
+
const manifest = JSON.parse(readFileSync32(manifestPath, "utf-8"));
|
|
176201
176469
|
const sizes = new Map;
|
|
176202
176470
|
for (const [key, value] of Object.entries(manifest)) {
|
|
176203
|
-
sizes.set(key, fileSize3(
|
|
176471
|
+
sizes.set(key, fileSize3(join29(manifestDir, value.replace(/^\//, ""))));
|
|
176204
176472
|
}
|
|
176205
176473
|
return sizes;
|
|
176206
176474
|
}, collectIslands = async (cwd, config, sizes) => {
|
|
@@ -176211,13 +176479,13 @@ var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim6 = (message) => process.stdout.
|
|
|
176211
176479
|
const pageMetadata = await loadPageIslandMetadata(config);
|
|
176212
176480
|
const usages = [...pageMetadata.values()].flatMap((meta) => meta.islands.map((island) => ({ ...island, page: meta.pagePath })));
|
|
176213
176481
|
return buildInfo.definitions.map((definition) => {
|
|
176214
|
-
const mounts = usages.filter((
|
|
176215
|
-
const hostFramework = hostFrameworkOf(
|
|
176482
|
+
const mounts = usages.filter((usage2) => usage2.framework === definition.framework && usage2.component === definition.component).map((usage2) => {
|
|
176483
|
+
const hostFramework = hostFrameworkOf(usage2.page, cwd, config);
|
|
176216
176484
|
return {
|
|
176217
176485
|
crossFramework: hostFramework !== null && hostFramework !== definition.framework,
|
|
176218
176486
|
hostFramework,
|
|
176219
|
-
hydrate:
|
|
176220
|
-
page: relative10(cwd, resolve19(cwd,
|
|
176487
|
+
hydrate: usage2.hydrate ?? "load",
|
|
176488
|
+
page: relative10(cwd, resolve19(cwd, usage2.page))
|
|
176221
176489
|
};
|
|
176222
176490
|
});
|
|
176223
176491
|
const key = getIslandManifestKey(definition.framework, definition.component);
|
|
@@ -176335,8 +176603,8 @@ var init_islands2 = __esm(() => {
|
|
|
176335
176603
|
});
|
|
176336
176604
|
|
|
176337
176605
|
// src/build/externalAssetPlugin.ts
|
|
176338
|
-
import { copyFileSync as copyFileSync2, existsSync as
|
|
176339
|
-
import { basename as basename6, dirname as dirname13, join as
|
|
176606
|
+
import { copyFileSync as copyFileSync2, existsSync as existsSync35, mkdirSync as mkdirSync15, statSync as statSync6 } from "fs";
|
|
176607
|
+
import { basename as basename6, dirname as dirname13, join as join30, resolve as resolve20 } from "path";
|
|
176340
176608
|
var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
|
|
176341
176609
|
name: "absolute-external-asset",
|
|
176342
176610
|
setup(bld) {
|
|
@@ -176357,14 +176625,14 @@ var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
|
|
|
176357
176625
|
if (!relPath)
|
|
176358
176626
|
continue;
|
|
176359
176627
|
const assetPath = resolve20(sourceDir, relPath);
|
|
176360
|
-
if (!
|
|
176628
|
+
if (!existsSync35(assetPath))
|
|
176361
176629
|
continue;
|
|
176362
176630
|
if (!statSync6(assetPath).isFile())
|
|
176363
176631
|
continue;
|
|
176364
|
-
const targetPath =
|
|
176365
|
-
if (
|
|
176632
|
+
const targetPath = join30(outDir, basename6(assetPath));
|
|
176633
|
+
if (existsSync35(targetPath))
|
|
176366
176634
|
continue;
|
|
176367
|
-
|
|
176635
|
+
mkdirSync15(dirname13(targetPath), { recursive: true });
|
|
176368
176636
|
copyFileSync2(assetPath, targetPath);
|
|
176369
176637
|
}
|
|
176370
176638
|
return;
|
|
@@ -176379,19 +176647,19 @@ __export(exports_compile, {
|
|
|
176379
176647
|
shouldEmbedCompiledAsset: () => shouldEmbedCompiledAsset,
|
|
176380
176648
|
compile: () => compile
|
|
176381
176649
|
});
|
|
176382
|
-
var {env:
|
|
176650
|
+
var {env: env5 } = globalThis.Bun;
|
|
176383
176651
|
import {
|
|
176384
176652
|
cpSync,
|
|
176385
|
-
existsSync as
|
|
176386
|
-
mkdirSync as
|
|
176653
|
+
existsSync as existsSync36,
|
|
176654
|
+
mkdirSync as mkdirSync16,
|
|
176387
176655
|
readdirSync as readdirSync7,
|
|
176388
|
-
readFileSync as
|
|
176656
|
+
readFileSync as readFileSync33,
|
|
176389
176657
|
rmSync as rmSync5,
|
|
176390
176658
|
statSync as statSync7,
|
|
176391
176659
|
unlinkSync as unlinkSync4,
|
|
176392
|
-
writeFileSync as
|
|
176660
|
+
writeFileSync as writeFileSync18
|
|
176393
176661
|
} from "fs";
|
|
176394
|
-
import { basename as basename7, dirname as dirname14, join as
|
|
176662
|
+
import { basename as basename7, dirname as dirname14, join as join31, relative as relative11, resolve as resolve21 } from "path";
|
|
176395
176663
|
var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`, compileBanner = (version2) => {
|
|
176396
176664
|
const resolvedVersion = version2 || "unknown";
|
|
176397
176665
|
console.log("");
|
|
@@ -176404,7 +176672,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
176404
176672
|
const entry = pending.pop();
|
|
176405
176673
|
if (!entry)
|
|
176406
176674
|
continue;
|
|
176407
|
-
const fullPath =
|
|
176675
|
+
const fullPath = join31(entry.parentPath, entry.name);
|
|
176408
176676
|
if (entry.isDirectory())
|
|
176409
176677
|
pending = pending.concat(readdirSync7(fullPath, { withFileTypes: true }));
|
|
176410
176678
|
else
|
|
@@ -176424,7 +176692,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
176424
176692
|
const entry = pending.pop();
|
|
176425
176693
|
if (!entry)
|
|
176426
176694
|
continue;
|
|
176427
|
-
const fullPath =
|
|
176695
|
+
const fullPath = join31(entry.parentPath, entry.name);
|
|
176428
176696
|
if (entry.isDirectory()) {
|
|
176429
176697
|
if (SERVER_RUNTIME_SCAN_SKIP_DIRS.has(entry.name))
|
|
176430
176698
|
continue;
|
|
@@ -176439,7 +176707,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
176439
176707
|
const normalizedOutdir = resolve21(outdir);
|
|
176440
176708
|
const copyReference = (filePath, relPath) => {
|
|
176441
176709
|
const assetSource = resolve21(dirname14(filePath), relPath);
|
|
176442
|
-
if (!
|
|
176710
|
+
if (!existsSync36(assetSource) || !statSync7(assetSource).isFile())
|
|
176443
176711
|
return;
|
|
176444
176712
|
const assetTarget = resolve21(normalizedOutdir, relPath.replace(/^\.\//, ""));
|
|
176445
176713
|
if (assetTarget !== normalizedOutdir && !assetTarget.startsWith(`${normalizedOutdir}/`))
|
|
@@ -176447,11 +176715,11 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
176447
176715
|
if (copied.has(assetTarget))
|
|
176448
176716
|
return;
|
|
176449
176717
|
copied.add(assetTarget);
|
|
176450
|
-
|
|
176718
|
+
mkdirSync16(dirname14(assetTarget), { recursive: true });
|
|
176451
176719
|
cpSync(assetSource, assetTarget, { force: true });
|
|
176452
176720
|
};
|
|
176453
176721
|
for (const filePath of collectProjectSourceFiles(process.cwd())) {
|
|
176454
|
-
const source =
|
|
176722
|
+
const source = readFileSync33(filePath, "utf-8");
|
|
176455
176723
|
SERVER_RUNTIME_ASSET_RE.lastIndex = 0;
|
|
176456
176724
|
let match;
|
|
176457
176725
|
while ((match = SERVER_RUNTIME_ASSET_RE.exec(source)) !== null) {
|
|
@@ -176480,7 +176748,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
176480
176748
|
}
|
|
176481
176749
|
}, readPackageVersion4 = (candidate) => {
|
|
176482
176750
|
try {
|
|
176483
|
-
const pkg = JSON.parse(
|
|
176751
|
+
const pkg = JSON.parse(readFileSync33(candidate, "utf-8"));
|
|
176484
176752
|
if (pkg.name !== "@absolutejs/absolute")
|
|
176485
176753
|
return null;
|
|
176486
176754
|
const ver = pkg.version;
|
|
@@ -176523,7 +176791,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
176523
176791
|
resolve21(import.meta.dir, "..", "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
176524
176792
|
];
|
|
176525
176793
|
for (const candidate of candidates) {
|
|
176526
|
-
if (
|
|
176794
|
+
if (existsSync36(candidate))
|
|
176527
176795
|
return candidate;
|
|
176528
176796
|
}
|
|
176529
176797
|
return resolve21(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js");
|
|
@@ -176539,7 +176807,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
176539
176807
|
return true;
|
|
176540
176808
|
}, tryReadNodePackageJson = (packageDir) => {
|
|
176541
176809
|
try {
|
|
176542
|
-
return JSON.parse(
|
|
176810
|
+
return JSON.parse(readFileSync33(join31(packageDir, "package.json"), "utf-8"));
|
|
176543
176811
|
} catch {
|
|
176544
176812
|
return null;
|
|
176545
176813
|
}
|
|
@@ -176551,7 +176819,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
176551
176819
|
if (!pkg)
|
|
176552
176820
|
return;
|
|
176553
176821
|
seen.add(specifier);
|
|
176554
|
-
const destDir =
|
|
176822
|
+
const destDir = join31(outdir, "node_modules", ...specifier.split("/"));
|
|
176555
176823
|
rmSync5(destDir, { force: true, recursive: true });
|
|
176556
176824
|
cpSync(srcDir, destDir, {
|
|
176557
176825
|
force: true,
|
|
@@ -176574,7 +176842,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
176574
176842
|
if (!buildConfig.angularDirectory)
|
|
176575
176843
|
return;
|
|
176576
176844
|
const angularScopeDir = resolve21(process.cwd(), "node_modules", "@angular");
|
|
176577
|
-
const angularPackages =
|
|
176845
|
+
const angularPackages = existsSync36(angularScopeDir) ? readdirSync7(angularScopeDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).filter((entry) => entry.name !== "compiler-cli").map((entry) => `@angular/${entry.name}`) : [];
|
|
176578
176846
|
const roots = new Set([...angularPackages, "rxjs", "tslib", "typescript"]);
|
|
176579
176847
|
const seen = new Set;
|
|
176580
176848
|
for (const specifier of roots) {
|
|
@@ -176592,15 +176860,15 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
176592
176860
|
copyAngularRuntimePackages(buildConfig, outdir);
|
|
176593
176861
|
copyChunkReferencedPackages(outdir, seen);
|
|
176594
176862
|
}, collectRuntimePackageSpecifiers = (distDir) => {
|
|
176595
|
-
const nodeModulesDir =
|
|
176596
|
-
if (!
|
|
176863
|
+
const nodeModulesDir = join31(distDir, "node_modules");
|
|
176864
|
+
if (!existsSync36(nodeModulesDir))
|
|
176597
176865
|
return [];
|
|
176598
176866
|
const specifiers = [];
|
|
176599
176867
|
for (const entry of readdirSync7(nodeModulesDir, { withFileTypes: true })) {
|
|
176600
176868
|
if (!entry.isDirectory())
|
|
176601
176869
|
continue;
|
|
176602
176870
|
if (entry.name.startsWith("@")) {
|
|
176603
|
-
const scopeDir =
|
|
176871
|
+
const scopeDir = join31(nodeModulesDir, entry.name);
|
|
176604
176872
|
for (const scopedEntry of readdirSync7(scopeDir, {
|
|
176605
176873
|
withFileTypes: true
|
|
176606
176874
|
})) {
|
|
@@ -176632,18 +176900,18 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
176632
176900
|
const packageSpecifier = packageSpecifiers.find((root) => specifier === root || specifier.startsWith(`${root}/`));
|
|
176633
176901
|
if (!packageSpecifier)
|
|
176634
176902
|
return null;
|
|
176635
|
-
const packageDir =
|
|
176903
|
+
const packageDir = join31(distDir, "node_modules", ...packageSpecifier.split("/"));
|
|
176636
176904
|
const subpath = specifier.slice(packageSpecifier.length);
|
|
176637
|
-
const subPackageDir = subpath ?
|
|
176638
|
-
const resolvedPackageDir = subPackageDir &&
|
|
176639
|
-
const packageJsonPath =
|
|
176640
|
-
if (!
|
|
176905
|
+
const subPackageDir = subpath ? join31(packageDir, ...subpath.slice(1).split("/")) : null;
|
|
176906
|
+
const resolvedPackageDir = subPackageDir && existsSync36(join31(subPackageDir, "package.json")) ? subPackageDir : packageDir;
|
|
176907
|
+
const packageJsonPath = join31(resolvedPackageDir, "package.json");
|
|
176908
|
+
if (!existsSync36(packageJsonPath))
|
|
176641
176909
|
return null;
|
|
176642
|
-
const pkg = JSON.parse(
|
|
176910
|
+
const pkg = JSON.parse(readFileSync33(packageJsonPath, "utf-8"));
|
|
176643
176911
|
const exportKey = resolvedPackageDir !== subPackageDir && subpath ? `.${subpath}` : ".";
|
|
176644
176912
|
const rootExport = pkg.exports?.[exportKey];
|
|
176645
176913
|
const entry = pickExportEntry(rootExport) ?? (resolvedPackageDir === subPackageDir || !subpath ? pkg.module ?? pkg.main ?? "index.js" : `.${subpath}`);
|
|
176646
|
-
return
|
|
176914
|
+
return join31(resolvedPackageDir, entry);
|
|
176647
176915
|
}, RUNTIME_JS_EXTENSIONS, MODULE_SPECIFIER_RE, isRuntimeJsFile = (filePath) => RUNTIME_JS_EXTENSIONS.some((extension) => filePath.endsWith(extension)), isNodeModulesPath = (filePath) => filePath.split(/[\\/]/).includes("node_modules"), isFile = (filePath) => {
|
|
176648
176916
|
try {
|
|
176649
176917
|
return statSync7(filePath).isFile();
|
|
@@ -176656,13 +176924,13 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
176656
176924
|
const candidates = [
|
|
176657
176925
|
candidate,
|
|
176658
176926
|
...RUNTIME_JS_EXTENSIONS.map((extension) => `${candidate}${extension}`),
|
|
176659
|
-
...RUNTIME_JS_EXTENSIONS.map((extension) =>
|
|
176927
|
+
...RUNTIME_JS_EXTENSIONS.map((extension) => join31(candidate, `index${extension}`))
|
|
176660
176928
|
];
|
|
176661
176929
|
return candidates.find((filePath) => isRuntimeJsFile(filePath) && isFile(filePath)) ?? null;
|
|
176662
176930
|
}, findContainingRuntimePackageDir = (filePath) => {
|
|
176663
176931
|
let dir = dirname14(filePath);
|
|
176664
176932
|
while (dir !== dirname14(dir)) {
|
|
176665
|
-
if (isNodeModulesPath(dir) &&
|
|
176933
|
+
if (isNodeModulesPath(dir) && existsSync36(join31(dir, "package.json"))) {
|
|
176666
176934
|
return dir;
|
|
176667
176935
|
}
|
|
176668
176936
|
dir = dirname14(dir);
|
|
@@ -176678,13 +176946,13 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
176678
176946
|
const entry = pickExportEntry(pkg?.imports?.[specifier]);
|
|
176679
176947
|
if (!entry)
|
|
176680
176948
|
return null;
|
|
176681
|
-
return
|
|
176949
|
+
return join31(packageDir, entry);
|
|
176682
176950
|
}, collectRuntimeRewriteRoots = (distDir) => collectFiles2(distDir).filter((filePath) => isRuntimeJsFile(filePath) && !isNodeModulesPath(filePath)), toTopLevelPackage = (specifier) => specifier.split("/").slice(0, specifier.startsWith("@") ? 2 : 1).join("/"), FRAMEWORK_PACKAGE_NAME = "@absolutejs/absolute", copyChunkReferencedPackages = (distDir, seen) => {
|
|
176683
176951
|
const distRoot = resolve21(distDir);
|
|
176684
176952
|
for (const filePath of collectRuntimeRewriteRoots(distDir)) {
|
|
176685
176953
|
if (resolve21(dirname14(filePath)) === distRoot)
|
|
176686
176954
|
continue;
|
|
176687
|
-
const source =
|
|
176955
|
+
const source = readFileSync33(filePath, "utf-8");
|
|
176688
176956
|
for (const match of source.matchAll(MODULE_SPECIFIER_RE)) {
|
|
176689
176957
|
const specifier = match[3];
|
|
176690
176958
|
if (!specifier || specifier.startsWith(".") || specifier.startsWith("/") || specifier.startsWith("#") || specifier.startsWith("node:") || specifier.startsWith("bun:")) {
|
|
@@ -176714,7 +176982,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
176714
176982
|
if (!filePath || seen.has(filePath))
|
|
176715
176983
|
continue;
|
|
176716
176984
|
seen.add(filePath);
|
|
176717
|
-
const source =
|
|
176985
|
+
const source = readFileSync33(filePath, "utf-8");
|
|
176718
176986
|
const rewritten = source.replace(MODULE_SPECIFIER_RE, (match, prefix, quote, specifier) => {
|
|
176719
176987
|
if (typeof specifier === "string" && specifier.startsWith(".")) {
|
|
176720
176988
|
enqueue(resolveRuntimeJsFile(resolve21(dirname14(filePath), specifier)));
|
|
@@ -176732,7 +177000,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
176732
177000
|
return `${prefix}${quote}${ensureRelativeModuleSpecifier(filePath, target)}${quote}`;
|
|
176733
177001
|
});
|
|
176734
177002
|
if (rewritten !== source) {
|
|
176735
|
-
|
|
177003
|
+
writeFileSync18(filePath, rewritten);
|
|
176736
177004
|
}
|
|
176737
177005
|
}
|
|
176738
177006
|
}, generateEntrypoint = (distDir, serverEntry, prerenderMap, version2, buildConfig) => {
|
|
@@ -177186,7 +177454,7 @@ console.log(\`
|
|
|
177186
177454
|
const resolvedOutdir = resolve21(outdir ?? "dist");
|
|
177187
177455
|
await withBuildDirectoryLock(resolvedOutdir, () => compileUnlocked(serverEntry, resolvedOutdir, outfile, configPath2));
|
|
177188
177456
|
}, compileUnlocked = async (serverEntry, resolvedOutdir, outfile, configPath2) => {
|
|
177189
|
-
const prerenderPort = Number(
|
|
177457
|
+
const prerenderPort = Number(env5.COMPILE_PORT) || Number(env5.PORT) || DEFAULT_PORT + 1;
|
|
177190
177458
|
killStaleProcesses(prerenderPort);
|
|
177191
177459
|
const entryName = basename7(serverEntry).replace(/\.[^.]+$/, "");
|
|
177192
177460
|
const resolvedOutfile = resolve21(outfile ?? "compiled-server");
|
|
@@ -177251,11 +177519,11 @@ console.log(\`
|
|
|
177251
177519
|
process.exit(1);
|
|
177252
177520
|
}
|
|
177253
177521
|
const outputPath = resolve21(resolvedOutdir, `${entryName}.js`);
|
|
177254
|
-
if (!
|
|
177522
|
+
if (!existsSync36(outputPath)) {
|
|
177255
177523
|
console.error(cliTag4("\x1B[31m", `Expected output not found: ${outputPath}`));
|
|
177256
177524
|
process.exit(1);
|
|
177257
177525
|
}
|
|
177258
|
-
if (
|
|
177526
|
+
if (existsSync36(resolve21(resolvedOutdir, "angular", "vendor", "server"))) {
|
|
177259
177527
|
const vendorDir = resolve21(resolvedOutdir, "angular", "vendor", "server");
|
|
177260
177528
|
const vendorEntries = readdirSync7(vendorDir).filter((f) => f.endsWith(".js"));
|
|
177261
177529
|
const angularServerVendorPaths = {};
|
|
@@ -177277,7 +177545,7 @@ console.log(\`
|
|
|
177277
177545
|
copyServerRuntimeAssetReferences(resolvedOutdir);
|
|
177278
177546
|
const prerenderStart = performance.now();
|
|
177279
177547
|
process.stdout.write(cliTag4("\x1B[36m", "Pre-rendering pages"));
|
|
177280
|
-
rmSync5(
|
|
177548
|
+
rmSync5(join31(resolvedOutdir, "_prerendered"), {
|
|
177281
177549
|
force: true,
|
|
177282
177550
|
recursive: true
|
|
177283
177551
|
});
|
|
@@ -177296,9 +177564,9 @@ console.log(\`
|
|
|
177296
177564
|
const compileStart = performance.now();
|
|
177297
177565
|
process.stdout.write(cliTag4("\x1B[36m", "Compiling standalone executable"));
|
|
177298
177566
|
const entrypointCode = generateEntrypoint(resolvedOutdir, serverEntry, prerenderMap, absoluteVersion, buildConfig);
|
|
177299
|
-
const entrypointPath =
|
|
177567
|
+
const entrypointPath = join31(resolvedOutdir, "_compile_entrypoint.ts");
|
|
177300
177568
|
await Bun.write(entrypointPath, entrypointCode);
|
|
177301
|
-
|
|
177569
|
+
mkdirSync16(dirname14(resolvedOutfile), { recursive: true });
|
|
177302
177570
|
const result = await Bun.build({
|
|
177303
177571
|
compile: { outfile: resolvedOutfile },
|
|
177304
177572
|
define: { "process.env.NODE_ENV": '"production"' },
|
|
@@ -177392,11 +177660,11 @@ var exports_typecheck = {};
|
|
|
177392
177660
|
__export(exports_typecheck, {
|
|
177393
177661
|
typecheck: () => typecheck
|
|
177394
177662
|
});
|
|
177395
|
-
import { resolve as resolve22, join as
|
|
177396
|
-
import { existsSync as
|
|
177663
|
+
import { resolve as resolve22, join as join32 } from "path";
|
|
177664
|
+
import { existsSync as existsSync37, readFileSync as readFileSync34 } from "fs";
|
|
177397
177665
|
import { mkdir as mkdir2, writeFile } from "fs/promises";
|
|
177398
177666
|
var isCommandService3 = (service) => service.kind === "command" || Array.isArray(service.command), resolveConfigPath = (configPath2) => resolve22(configPath2 ?? process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts"), getTypecheckTargets = async (configPath2) => {
|
|
177399
|
-
if (!
|
|
177667
|
+
if (!existsSync37(resolveConfigPath(configPath2))) {
|
|
177400
177668
|
return [{}];
|
|
177401
177669
|
}
|
|
177402
177670
|
const rawConfig = await loadRawConfig(configPath2);
|
|
@@ -177417,7 +177685,7 @@ var isCommandService3 = (service) => service.kind === "command" || Array.isArray
|
|
|
177417
177685
|
return { exitCode, name, output: (stdout + stderr).trim() };
|
|
177418
177686
|
}, shellEscape = (value) => `'${value.replaceAll("'", "'\\''")}'`, runShell = async (name, command) => run(name, ["/bin/bash", "-lc", command]), findBin = (name) => {
|
|
177419
177687
|
const local = resolve22("node_modules", ".bin", name);
|
|
177420
|
-
return
|
|
177688
|
+
return existsSync37(local) ? local : null;
|
|
177421
177689
|
}, ANSI_COLOR_REGEX, ANSI_PURPLE_REGEX, ANSI_CYAN_REGEX, ANSI_TOKEN_END_REGEX, stripAnsi3 = (str) => str.replace(ANSI_COLOR_REGEX, ""), formatSvelteOutput = (output) => {
|
|
177422
177690
|
const cwd = `${process.cwd()}/`;
|
|
177423
177691
|
const summaryMatch = stripAnsi3(output).match(/svelte-check found (\d+) error/);
|
|
@@ -177469,10 +177737,10 @@ Found ${errorCount} error${suffix}.`;
|
|
|
177469
177737
|
resolve22(import.meta.dir, "../../types", fileName),
|
|
177470
177738
|
resolve22(import.meta.dir, "../../../types", fileName)
|
|
177471
177739
|
];
|
|
177472
|
-
return candidates.find((candidate) =>
|
|
177740
|
+
return candidates.find((candidate) => existsSync37(candidate)) ?? candidates[0];
|
|
177473
177741
|
}, ABSOLUTE_TYPECHECK_FILES, readProjectTsconfig = () => {
|
|
177474
177742
|
try {
|
|
177475
|
-
return JSON.parse(
|
|
177743
|
+
return JSON.parse(readFileSync34(resolve22("tsconfig.json"), "utf-8"));
|
|
177476
177744
|
} catch {
|
|
177477
177745
|
return {};
|
|
177478
177746
|
}
|
|
@@ -177500,7 +177768,7 @@ Found ${errorCount} error${suffix}.`;
|
|
|
177500
177768
|
console.error("\x1B[31m\u2717\x1B[0m vue-tsc is required for Vue type checking. Install it: bun add -d vue-tsc");
|
|
177501
177769
|
process.exit(1);
|
|
177502
177770
|
}
|
|
177503
|
-
const vueTsconfigPath =
|
|
177771
|
+
const vueTsconfigPath = join32(cacheDir, "tsconfig.vue-check.json");
|
|
177504
177772
|
return writeFile(vueTsconfigPath, JSON.stringify({
|
|
177505
177773
|
compilerOptions: {
|
|
177506
177774
|
rootDir: ".."
|
|
@@ -177515,7 +177783,7 @@ Found ${errorCount} error${suffix}.`;
|
|
|
177515
177783
|
resolve22(vueTsconfigPath),
|
|
177516
177784
|
"--incremental",
|
|
177517
177785
|
"--tsBuildInfoFile",
|
|
177518
|
-
|
|
177786
|
+
join32(cacheDir, "vue-tsc.tsbuildinfo"),
|
|
177519
177787
|
"--pretty"
|
|
177520
177788
|
]));
|
|
177521
177789
|
}, buildAngularCheck = async (cacheDir, angularDir) => {
|
|
@@ -177524,7 +177792,7 @@ Found ${errorCount} error${suffix}.`;
|
|
|
177524
177792
|
console.error("\x1B[31m\u2717\x1B[0m @angular/compiler-cli is required for Angular type checking. Install it: bun add -d @angular/compiler-cli");
|
|
177525
177793
|
process.exit(1);
|
|
177526
177794
|
}
|
|
177527
|
-
const angularTsconfigPath =
|
|
177795
|
+
const angularTsconfigPath = join32(cacheDir, "tsconfig.angular-check.json");
|
|
177528
177796
|
await writeFile(angularTsconfigPath, JSON.stringify({
|
|
177529
177797
|
angularCompilerOptions: {
|
|
177530
177798
|
strictTemplates: true
|
|
@@ -177544,7 +177812,7 @@ Found ${errorCount} error${suffix}.`;
|
|
|
177544
177812
|
console.error("\x1B[31m\u2717\x1B[0m typescript is required for type checking. Install it: bun add -d typescript");
|
|
177545
177813
|
process.exit(1);
|
|
177546
177814
|
}
|
|
177547
|
-
const tscConfigPath =
|
|
177815
|
+
const tscConfigPath = join32(cacheDir, "tsconfig.typecheck.json");
|
|
177548
177816
|
return writeFile(tscConfigPath, JSON.stringify({
|
|
177549
177817
|
compilerOptions: {
|
|
177550
177818
|
rootDir: ".."
|
|
@@ -177559,7 +177827,7 @@ Found ${errorCount} error${suffix}.`;
|
|
|
177559
177827
|
resolve22(tscConfigPath),
|
|
177560
177828
|
"--incremental",
|
|
177561
177829
|
"--tsBuildInfoFile",
|
|
177562
|
-
|
|
177830
|
+
join32(cacheDir, "tsc.tsbuildinfo"),
|
|
177563
177831
|
"--pretty"
|
|
177564
177832
|
]));
|
|
177565
177833
|
}, buildSvelteCheck = async (cacheDir, svelteDir) => {
|
|
@@ -177568,7 +177836,7 @@ Found ${errorCount} error${suffix}.`;
|
|
|
177568
177836
|
console.error("\x1B[31m\u2717\x1B[0m svelte-check is required for Svelte type checking. Install it: bun add -d svelte-check");
|
|
177569
177837
|
process.exit(1);
|
|
177570
177838
|
}
|
|
177571
|
-
const svelteTsconfigPath =
|
|
177839
|
+
const svelteTsconfigPath = join32(cacheDir, "tsconfig.svelte-check.json");
|
|
177572
177840
|
await writeFile(svelteTsconfigPath, JSON.stringify({
|
|
177573
177841
|
extends: resolve22("tsconfig.json"),
|
|
177574
177842
|
files: ABSOLUTE_TYPECHECK_FILES,
|
|
@@ -177718,7 +177986,10 @@ var DEFAULT_RELAY_PORT = 8787, DEFAULT_REQUEST_TIMEOUT_MS = 30000, headersToObje
|
|
|
177718
177986
|
open(ws) {
|
|
177719
177987
|
if (ws.data.control) {
|
|
177720
177988
|
client = ws;
|
|
177721
|
-
ws.send(encodeTunnelMessage({
|
|
177989
|
+
ws.send(encodeTunnelMessage({
|
|
177990
|
+
publicUrl: options.publicUrl ?? "",
|
|
177991
|
+
type: "ready"
|
|
177992
|
+
}));
|
|
177722
177993
|
return;
|
|
177723
177994
|
}
|
|
177724
177995
|
publicSockets.set(ws.data.id, ws);
|
|
@@ -177736,7 +178007,9 @@ var DEFAULT_RELAY_PORT = 8787, DEFAULT_REQUEST_TIMEOUT_MS = 30000, headersToObje
|
|
|
177736
178007
|
if (url.searchParams.get("token") !== options.token) {
|
|
177737
178008
|
return new Response("Forbidden", { status: 403 });
|
|
177738
178009
|
}
|
|
177739
|
-
const upgraded = srv.upgrade(request, {
|
|
178010
|
+
const upgraded = srv.upgrade(request, {
|
|
178011
|
+
data: { control: true }
|
|
178012
|
+
});
|
|
177740
178013
|
return upgraded ? undefined : new Response("Upgrade failed", { status: 426 });
|
|
177741
178014
|
}
|
|
177742
178015
|
if (!client) {
|
|
@@ -177774,7 +178047,9 @@ var DEFAULT_RELAY_PORT = 8787, DEFAULT_REQUEST_TIMEOUT_MS = 30000, headersToObje
|
|
|
177774
178047
|
const result = await Promise.race([responsePromise, timeout]);
|
|
177775
178048
|
pending.delete(id);
|
|
177776
178049
|
if (result.type === "error") {
|
|
177777
|
-
return new Response(`Tunnel error: ${result.message}`, {
|
|
178050
|
+
return new Response(`Tunnel error: ${result.message}`, {
|
|
178051
|
+
status: 504
|
|
178052
|
+
});
|
|
177778
178053
|
}
|
|
177779
178054
|
if (result.type !== "response") {
|
|
177780
178055
|
return new Response("Tunnel protocol error", { status: 502 });
|
|
@@ -177831,7 +178106,12 @@ var controlSocketUrl = (relayUrl, token) => {
|
|
|
177831
178106
|
url.search = `?token=${encodeURIComponent(token)}`;
|
|
177832
178107
|
return url.toString();
|
|
177833
178108
|
};
|
|
177834
|
-
var STRIPPED_REQUEST_HEADERS = new Set([
|
|
178109
|
+
var STRIPPED_REQUEST_HEADERS = new Set([
|
|
178110
|
+
"host",
|
|
178111
|
+
"connection",
|
|
178112
|
+
"content-length",
|
|
178113
|
+
TUNNEL_FORWARDED_HOST_HEADER
|
|
178114
|
+
]);
|
|
177835
178115
|
var startTunnelClient = (options) => {
|
|
177836
178116
|
const publicUrl = options.relayUrl.replace(/\/$/, "");
|
|
177837
178117
|
const localWsOrigin = options.localOrigin.replace(/^http/, "ws");
|
|
@@ -177875,7 +178155,12 @@ var startTunnelClient = (options) => {
|
|
|
177875
178155
|
});
|
|
177876
178156
|
local.addEventListener("error", () => {
|
|
177877
178157
|
if (!entry.ready) {
|
|
177878
|
-
socket?.send(encodeTunnelMessage({
|
|
178158
|
+
socket?.send(encodeTunnelMessage({
|
|
178159
|
+
error: "local ws failed",
|
|
178160
|
+
id,
|
|
178161
|
+
ok: false,
|
|
178162
|
+
type: "ws_open_ack"
|
|
178163
|
+
}));
|
|
177879
178164
|
}
|
|
177880
178165
|
});
|
|
177881
178166
|
};
|
|
@@ -181226,15 +181511,15 @@ var stripNamedArgs = (...flags) => args.filter((_, idx) => flags.every((flag) =>
|
|
|
181226
181511
|
if (command === "dev") {
|
|
181227
181512
|
sendTelemetryEvent("cli:command", { command });
|
|
181228
181513
|
const configPath2 = parseNamedArg("--config");
|
|
181229
|
-
const
|
|
181230
|
-
const serverEntry =
|
|
181514
|
+
const positionalArgs2 = stripNamedArgs("--config");
|
|
181515
|
+
const serverEntry = positionalArgs2[0] ?? DEFAULT_SERVER_ENTRY;
|
|
181231
181516
|
await dev(serverEntry, configPath2);
|
|
181232
181517
|
} else if (command === "start") {
|
|
181233
181518
|
sendTelemetryEvent("cli:command", { command });
|
|
181234
181519
|
const outdir = parseNamedArg("--outdir");
|
|
181235
181520
|
const configPath2 = parseNamedArg("--config");
|
|
181236
|
-
const
|
|
181237
|
-
const serverEntry =
|
|
181521
|
+
const positionalArgs2 = stripNamedArgs("--outdir", "--config");
|
|
181522
|
+
const serverEntry = positionalArgs2[0] ?? DEFAULT_SERVER_ENTRY;
|
|
181238
181523
|
await start(serverEntry, outdir, configPath2);
|
|
181239
181524
|
} else if (command === "build") {
|
|
181240
181525
|
sendTelemetryEvent("cli:command", { command });
|
|
@@ -181302,6 +181587,12 @@ if (command === "dev") {
|
|
|
181302
181587
|
sendTelemetryEvent("cli:command", { command: "env" });
|
|
181303
181588
|
const { runEnv: runEnv2 } = await Promise.resolve().then(() => (init_env(), exports_env));
|
|
181304
181589
|
await runEnv2(args);
|
|
181590
|
+
} else if (command === "db") {
|
|
181591
|
+
sendTelemetryEvent("cli:command", {
|
|
181592
|
+
command: `db:${workspaceCommand ?? "unknown"}`
|
|
181593
|
+
});
|
|
181594
|
+
const { runDb: runDb2 } = await Promise.resolve().then(() => (init_db(), exports_db));
|
|
181595
|
+
await runDb2(args);
|
|
181305
181596
|
} else if (command === "logs") {
|
|
181306
181597
|
sendTelemetryEvent("cli:command", { command: "logs" });
|
|
181307
181598
|
const { runLogs: runLogs2 } = await Promise.resolve().then(() => (init_logs(), exports_logs));
|
|
@@ -181333,8 +181624,8 @@ if (command === "dev") {
|
|
|
181333
181624
|
const outdir = parseNamedArg("--outdir");
|
|
181334
181625
|
const outfile = parseNamedArg("--outfile");
|
|
181335
181626
|
const configPath2 = parseNamedArg("--config");
|
|
181336
|
-
const
|
|
181337
|
-
const serverEntry =
|
|
181627
|
+
const positionalArgs2 = stripNamedArgs("--outdir", "--outfile", "--config");
|
|
181628
|
+
const serverEntry = positionalArgs2[0] ?? DEFAULT_SERVER_ENTRY;
|
|
181338
181629
|
const { compile: compile2 } = await Promise.resolve().then(() => (init_compile(), exports_compile));
|
|
181339
181630
|
await compile2(serverEntry, outdir, outfile, configPath2);
|
|
181340
181631
|
} else if (command === "typecheck") {
|
|
@@ -181361,6 +181652,7 @@ if (command === "dev") {
|
|
|
181361
181652
|
console.error(" start [entry] [--outdir dir] Start production server");
|
|
181362
181653
|
console.error(" compile [entry] [--outdir dir] [--outfile path] Compile standalone executable");
|
|
181363
181654
|
console.error(" config [--port n] Open the unified config UI (ESLint, tsconfig, Prettier)");
|
|
181655
|
+
console.error(" db <backup|restore|seed> Backup/restore any Postgres DB (ORM-agnostic, upsert by PK) or run the seed script");
|
|
181364
181656
|
console.error(" doctor [--fix] [--json] Diagnose the project (bun, config, framework dirs, env, port)");
|
|
181365
181657
|
console.error(" env [--check] [--json] Report env vars the app reads (getEnv) and which are missing");
|
|
181366
181658
|
console.error(" add <framework> [--no-install] Add a framework (deps, config, starter page)");
|