@absolutejs/absolute 0.20.0-beta.13 → 0.20.0-beta.14
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/README.md +33 -0
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/build.js +822 -561
- package/dist/build.js.map +7 -5
- package/dist/cli/index.js +834 -515
- package/dist/index.js +904 -643
- package/dist/index.js.map +7 -5
- package/dist/mobile/index.js +310 -36
- package/dist/mobile/index.js.map +10 -7
- package/dist/mobile/shellSync.js +3 -1
- package/dist/src/build/pwa.d.ts +2 -1
- package/dist/src/mobile/capacitorBundle.d.ts +3 -0
- package/dist/src/mobile/index.d.ts +1 -0
- package/dist/src/mobile/shellSync.d.ts +2 -2
- package/dist/src/mobile/syncSchema.d.ts +9 -0
- package/dist/src/mobile/transport.d.ts +2 -0
- package/dist/types/build.d.ts +1 -1
- package/package.json +11 -11
package/dist/cli/index.js
CHANGED
|
@@ -3458,7 +3458,7 @@ import {
|
|
|
3458
3458
|
resolve as resolvePath,
|
|
3459
3459
|
sep as sep4
|
|
3460
3460
|
} from "path";
|
|
3461
|
-
var PROFILE_FORMAT = 1, PROFILE_NAME, SSH_DESTINATION, defaultProfilePath = () => join11(homedir4(), ".absolutejs", "mobile", "remote-macs.json"), emptyStore = () => ({
|
|
3461
|
+
var PROFILE_FORMAT = 1, REMOTE_STDIN_FLUSH_ATTEMPTS = 3, PROFILE_NAME, SSH_DESTINATION, defaultProfilePath = () => join11(homedir4(), ".absolutejs", "mobile", "remote-macs.json"), emptyStore = () => ({
|
|
3462
3462
|
format: PROFILE_FORMAT,
|
|
3463
3463
|
profiles: {}
|
|
3464
3464
|
}), loadStore = async (path = defaultProfilePath()) => {
|
|
@@ -3913,8 +3913,17 @@ var PROFILE_FORMAT = 1, PROFILE_NAME, SSH_DESTINATION, defaultProfilePath = () =
|
|
|
3913
3913
|
const response = new Promise((resolve8, reject) => pending.set(id, { reject, resolve: resolve8 }));
|
|
3914
3914
|
process2.stdin.write(`${JSON.stringify({ command: commandName, id, v: 1 })}
|
|
3915
3915
|
`);
|
|
3916
|
-
|
|
3917
|
-
|
|
3916
|
+
const flush = async () => {
|
|
3917
|
+
for (let attempt = 0;attempt < REMOTE_STDIN_FLUSH_ATTEMPTS; attempt++) {
|
|
3918
|
+
try {
|
|
3919
|
+
await process2.stdin.flush();
|
|
3920
|
+
return;
|
|
3921
|
+
} catch {
|
|
3922
|
+
await Promise.resolve();
|
|
3923
|
+
}
|
|
3924
|
+
}
|
|
3925
|
+
};
|
|
3926
|
+
return flush().then(() => response);
|
|
3918
3927
|
};
|
|
3919
3928
|
let closed = false;
|
|
3920
3929
|
const close = async () => {
|
|
@@ -6107,7 +6116,12 @@ ${authImport}${syncImport}void startAbsoluteMobileShell(${options});
|
|
|
6107
6116
|
endpoint: new URL("/__absolute/sync/background", options.config.productionOrigin).href,
|
|
6108
6117
|
intervalMinutes: 15
|
|
6109
6118
|
},
|
|
6110
|
-
socketTickets: true
|
|
6119
|
+
socketTickets: true,
|
|
6120
|
+
storageSchema: options.syncSchema ?? {
|
|
6121
|
+
components: [
|
|
6122
|
+
{ id: "@absolutejs/app", version: 1 }
|
|
6123
|
+
]
|
|
6124
|
+
}
|
|
6111
6125
|
}
|
|
6112
6126
|
} : {}
|
|
6113
6127
|
};
|
|
@@ -6289,9 +6303,260 @@ var init_materializedBundle = __esm(() => {
|
|
|
6289
6303
|
BUNDLE_ID_PATTERN = /^amb_[a-f0-9]{64}$/;
|
|
6290
6304
|
});
|
|
6291
6305
|
|
|
6306
|
+
// node_modules/@absolutejs/sync/dist/client/index.js
|
|
6307
|
+
var RUNTIME_TRANSPORT, host, isRegistry = (value) => typeof value === "object" && value !== null && Array.isArray(Reflect.get(value, "installations")), registry, SyncLocalStoreSchemaError, positiveVersion = (value, label) => {
|
|
6308
|
+
if (!Number.isSafeInteger(value) || value < 1)
|
|
6309
|
+
throw new SyncLocalStoreSchemaError("INVALID_PLAN", `${label} must be a positive safe integer`);
|
|
6310
|
+
return value;
|
|
6311
|
+
}, isSchemaBundle = (schema) => ("components" in schema), normalizeSyncLocalSchemaComponents = (schema = { version: 1 }) => {
|
|
6312
|
+
const components = isSchemaBundle(schema) ? [...schema.components] : [{ ...schema, id: "@absolutejs/app" }];
|
|
6313
|
+
const ids = new Set;
|
|
6314
|
+
for (const component of components) {
|
|
6315
|
+
if (typeof component.id !== "string" || component.id.trim() !== component.id || component.id.length === 0)
|
|
6316
|
+
throw new SyncLocalStoreSchemaError("INVALID_PLAN", "Sync schema component id must be non-empty and trimmed");
|
|
6317
|
+
if (ids.has(component.id))
|
|
6318
|
+
throw new SyncLocalStoreSchemaError("INVALID_PLAN", `Sync schema component "${component.id}" is declared more than once`);
|
|
6319
|
+
ids.add(component.id);
|
|
6320
|
+
}
|
|
6321
|
+
return components.sort((a, b) => a.id.localeCompare(b.id));
|
|
6322
|
+
}, resolveSyncLocalSchemaComponents = (storedVersions, schema = { version: 1 }) => {
|
|
6323
|
+
const components = normalizeSyncLocalSchemaComponents(schema).map((component) => {
|
|
6324
|
+
const current = resolveSyncLocalMigrations(component.version, component);
|
|
6325
|
+
return {
|
|
6326
|
+
id: component.id,
|
|
6327
|
+
...resolveSyncLocalMigrations(storedVersions[component.id] ?? current.minimumCompatibleVersion, component)
|
|
6328
|
+
};
|
|
6329
|
+
});
|
|
6330
|
+
const active = new Set(components.map((component) => component.id));
|
|
6331
|
+
const orphanedComponents = Object.keys(storedVersions).filter((id) => !active.has(id)).sort();
|
|
6332
|
+
return { components, orphanedComponents };
|
|
6333
|
+
}, resolveSyncLocalMigrations = (storedVersion, schema = { version: 1 }) => {
|
|
6334
|
+
positiveVersion(storedVersion, "Stored Sync schema version");
|
|
6335
|
+
const targetVersion = positiveVersion(schema.version, "Target Sync schema version");
|
|
6336
|
+
const migrations = [...schema.migrations ?? []].sort((a, b) => a.toVersion - b.toVersion);
|
|
6337
|
+
const versions = new Set;
|
|
6338
|
+
for (const migration of migrations) {
|
|
6339
|
+
positiveVersion(migration.toVersion, "Sync migration toVersion");
|
|
6340
|
+
if (versions.has(migration.toVersion))
|
|
6341
|
+
throw new SyncLocalStoreSchemaError("INVALID_PLAN", `Sync migration ${migration.toVersion} is declared more than once`);
|
|
6342
|
+
versions.add(migration.toVersion);
|
|
6343
|
+
}
|
|
6344
|
+
const inferredMinimum = migrations[0] ? migrations[0].toVersion - 1 : targetVersion;
|
|
6345
|
+
const minimumCompatibleVersion = positiveVersion(schema.minimumCompatibleVersion ?? inferredMinimum, "Minimum compatible Sync schema version");
|
|
6346
|
+
if (minimumCompatibleVersion > targetVersion)
|
|
6347
|
+
throw new SyncLocalStoreSchemaError("INVALID_PLAN", "Minimum compatible Sync schema version cannot exceed its target");
|
|
6348
|
+
if (storedVersion > targetVersion)
|
|
6349
|
+
throw new SyncLocalStoreSchemaError("SCHEMA_TOO_NEW", `Stored Sync schema ${storedVersion} is newer than this runtime's schema ${targetVersion}`, { storedVersion, targetVersion });
|
|
6350
|
+
if (storedVersion < minimumCompatibleVersion)
|
|
6351
|
+
throw new SyncLocalStoreSchemaError("SCHEMA_TOO_OLD", `Stored Sync schema ${storedVersion} is older than the minimum compatible schema ${minimumCompatibleVersion}`, { storedVersion, targetVersion });
|
|
6352
|
+
const steps = [];
|
|
6353
|
+
for (let version2 = storedVersion + 1;version2 <= targetVersion; version2++) {
|
|
6354
|
+
const migration = migrations.find((candidate) => candidate.toVersion === version2);
|
|
6355
|
+
if (migration === undefined)
|
|
6356
|
+
throw new SyncLocalStoreSchemaError("MIGRATION_MISSING", `Sync migration ${version2 - 1} -> ${version2} is missing`, { storedVersion, targetVersion });
|
|
6357
|
+
steps.push(migration);
|
|
6358
|
+
}
|
|
6359
|
+
return { minimumCompatibleVersion, steps, targetVersion };
|
|
6360
|
+
};
|
|
6361
|
+
var init_client2 = __esm(() => {
|
|
6362
|
+
RUNTIME_TRANSPORT = Symbol.for("@absolutejs/sync/client-runtime-transport");
|
|
6363
|
+
host = globalThis;
|
|
6364
|
+
registry = (() => {
|
|
6365
|
+
const existing = host[RUNTIME_TRANSPORT];
|
|
6366
|
+
if (isRegistry(existing))
|
|
6367
|
+
return existing;
|
|
6368
|
+
const created = { installations: [] };
|
|
6369
|
+
Object.defineProperty(host, RUNTIME_TRANSPORT, {
|
|
6370
|
+
configurable: false,
|
|
6371
|
+
enumerable: false,
|
|
6372
|
+
value: created,
|
|
6373
|
+
writable: false
|
|
6374
|
+
});
|
|
6375
|
+
return created;
|
|
6376
|
+
})();
|
|
6377
|
+
SyncLocalStoreSchemaError = class SyncLocalStoreSchemaError extends Error {
|
|
6378
|
+
code;
|
|
6379
|
+
storedVersion;
|
|
6380
|
+
targetVersion;
|
|
6381
|
+
constructor(code, message, versions = {}) {
|
|
6382
|
+
super(message);
|
|
6383
|
+
this.name = "SyncLocalStoreSchemaError";
|
|
6384
|
+
this.code = code;
|
|
6385
|
+
this.storedVersion = versions.storedVersion;
|
|
6386
|
+
this.targetVersion = versions.targetVersion;
|
|
6387
|
+
}
|
|
6388
|
+
};
|
|
6389
|
+
});
|
|
6390
|
+
|
|
6391
|
+
// src/mobile/syncSchema.ts
|
|
6392
|
+
import { readFileSync as readFileSync11 } from "fs";
|
|
6393
|
+
import { dirname as dirname12, join as join19, resolve as resolve15 } from "path";
|
|
6394
|
+
var object = (value) => typeof value === "object" && value !== null && !Array.isArray(value), manifestAt = (path) => {
|
|
6395
|
+
try {
|
|
6396
|
+
const value = JSON.parse(readFileSync11(path, "utf8"));
|
|
6397
|
+
return object(value) ? value : undefined;
|
|
6398
|
+
} catch {
|
|
6399
|
+
return;
|
|
6400
|
+
}
|
|
6401
|
+
}, localSchemaMetadata = (manifest) => {
|
|
6402
|
+
const absolutejs = Reflect.get(manifest, "absolutejs");
|
|
6403
|
+
if (!object(absolutejs))
|
|
6404
|
+
return;
|
|
6405
|
+
const sync = Reflect.get(absolutejs, "sync");
|
|
6406
|
+
if (!object(sync))
|
|
6407
|
+
return;
|
|
6408
|
+
return Reflect.get(sync, "localSchema");
|
|
6409
|
+
}, packageManifestPath = (projectRoot, packageName) => {
|
|
6410
|
+
let directory = resolve15(projectRoot);
|
|
6411
|
+
while (true) {
|
|
6412
|
+
const candidate = join19(directory, "node_modules", packageName, "package.json");
|
|
6413
|
+
const manifest = manifestAt(candidate);
|
|
6414
|
+
if (manifest && Reflect.get(manifest, "name") === packageName)
|
|
6415
|
+
return candidate;
|
|
6416
|
+
const parent = dirname12(directory);
|
|
6417
|
+
if (parent === directory)
|
|
6418
|
+
return;
|
|
6419
|
+
directory = parent;
|
|
6420
|
+
}
|
|
6421
|
+
}, metadataError = (id, detail) => new TypeError(`Invalid AbsoluteJS Sync schema metadata for ${id}: ${detail}`), positiveVersion2 = (value, id, field) => {
|
|
6422
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 1)
|
|
6423
|
+
throw metadataError(id, `${field} must be a positive safe integer.`);
|
|
6424
|
+
return value;
|
|
6425
|
+
}, nonEmpty = (value, id, field) => {
|
|
6426
|
+
if (typeof value !== "string" || value.trim() !== value || value.length === 0)
|
|
6427
|
+
throw metadataError(id, `${field} must be a non-empty trimmed string.`);
|
|
6428
|
+
return value;
|
|
6429
|
+
}, requireObject = (value, id, detail) => {
|
|
6430
|
+
if (!object(value))
|
|
6431
|
+
throw metadataError(id, detail);
|
|
6432
|
+
return value;
|
|
6433
|
+
}, normalizeJsonValue = (value, id, field) => {
|
|
6434
|
+
if (value === null || typeof value === "string" || typeof value === "boolean")
|
|
6435
|
+
return value;
|
|
6436
|
+
if (typeof value === "number" && Number.isFinite(value))
|
|
6437
|
+
return value;
|
|
6438
|
+
if (Array.isArray(value))
|
|
6439
|
+
return value.map((entry) => normalizeJsonValue(entry, id, field));
|
|
6440
|
+
if (object(value))
|
|
6441
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [
|
|
6442
|
+
key,
|
|
6443
|
+
normalizeJsonValue(entry, id, field)
|
|
6444
|
+
]));
|
|
6445
|
+
throw metadataError(id, `${field} must be JSON-safe.`);
|
|
6446
|
+
}, operation = (value, id, index) => {
|
|
6447
|
+
const record = requireObject(value, id, `migration operation ${index} must be an object.`);
|
|
6448
|
+
const type = Reflect.get(record, "type");
|
|
6449
|
+
const collection = nonEmpty(Reflect.get(record, "collection"), id, `operation ${index}.collection`);
|
|
6450
|
+
if (type === "delete-collection")
|
|
6451
|
+
return { collection, type };
|
|
6452
|
+
if (type === "rename-field")
|
|
6453
|
+
return {
|
|
6454
|
+
collection,
|
|
6455
|
+
from: nonEmpty(Reflect.get(record, "from"), id, `operation ${index}.from`),
|
|
6456
|
+
to: nonEmpty(Reflect.get(record, "to"), id, `operation ${index}.to`),
|
|
6457
|
+
type
|
|
6458
|
+
};
|
|
6459
|
+
const field = nonEmpty(Reflect.get(record, "field"), id, `operation ${index}.field`);
|
|
6460
|
+
if (type === "remove-field")
|
|
6461
|
+
return { collection, field, type };
|
|
6462
|
+
if (type === "set-default")
|
|
6463
|
+
return {
|
|
6464
|
+
collection,
|
|
6465
|
+
field,
|
|
6466
|
+
type,
|
|
6467
|
+
value: normalizeJsonValue(Reflect.get(record, "value"), id, `operation ${index}.value`)
|
|
6468
|
+
};
|
|
6469
|
+
throw metadataError(id, `operation ${index}.type is not supported.`);
|
|
6470
|
+
}, migration = (value, id, index) => {
|
|
6471
|
+
const record = requireObject(value, id, `migration ${index} must be an object.`);
|
|
6472
|
+
const allowed = new Set(["operations", "toVersion"]);
|
|
6473
|
+
const unsupported = Object.keys(record).find((key) => !allowed.has(key));
|
|
6474
|
+
if (unsupported)
|
|
6475
|
+
throw metadataError(id, `migration ${index}.${unsupported} is not declarative metadata.`);
|
|
6476
|
+
const declaredOperations = Reflect.get(record, "operations");
|
|
6477
|
+
if (declaredOperations !== undefined && !Array.isArray(declaredOperations))
|
|
6478
|
+
throw metadataError(id, `migration ${index}.operations must be an array.`);
|
|
6479
|
+
const operations = Array.isArray(declaredOperations) ? declaredOperations : [];
|
|
6480
|
+
return {
|
|
6481
|
+
operations: operations.map((entry, operationIndex) => operation(entry, id, operationIndex)),
|
|
6482
|
+
toVersion: positiveVersion2(Reflect.get(record, "toVersion"), id, `migration ${index}.toVersion`)
|
|
6483
|
+
};
|
|
6484
|
+
}, component = (id, value) => {
|
|
6485
|
+
const record = requireObject(value, id, "localSchema must be an object.");
|
|
6486
|
+
const allowed = new Set([
|
|
6487
|
+
"migrations",
|
|
6488
|
+
"minimumCompatibleVersion",
|
|
6489
|
+
"version"
|
|
6490
|
+
]);
|
|
6491
|
+
const unsupported = Object.keys(record).find((key) => !allowed.has(key));
|
|
6492
|
+
if (unsupported)
|
|
6493
|
+
throw metadataError(id, `${unsupported} is not supported.`);
|
|
6494
|
+
const version2 = positiveVersion2(Reflect.get(record, "version"), id, "version");
|
|
6495
|
+
const declaredMinimum = Reflect.get(record, "minimumCompatibleVersion");
|
|
6496
|
+
const minimumCompatibleVersion = declaredMinimum === undefined ? Math.max(1, version2 - 2) : positiveVersion2(declaredMinimum, id, "minimumCompatibleVersion");
|
|
6497
|
+
const declaredMigrations = Reflect.get(record, "migrations");
|
|
6498
|
+
if (declaredMigrations !== undefined && !Array.isArray(declaredMigrations))
|
|
6499
|
+
throw metadataError(id, "migrations must be an array.");
|
|
6500
|
+
const migrations = Array.isArray(declaredMigrations) ? declaredMigrations : undefined;
|
|
6501
|
+
return {
|
|
6502
|
+
id,
|
|
6503
|
+
minimumCompatibleVersion,
|
|
6504
|
+
...Array.isArray(migrations) ? {
|
|
6505
|
+
migrations: migrations.map((entry, index) => migration(entry, id, index))
|
|
6506
|
+
} : {},
|
|
6507
|
+
version: version2
|
|
6508
|
+
};
|
|
6509
|
+
}, dependencyNames = (manifest) => [
|
|
6510
|
+
Reflect.get(manifest, "dependencies"),
|
|
6511
|
+
Reflect.get(manifest, "optionalDependencies"),
|
|
6512
|
+
Reflect.get(manifest, "devDependencies"),
|
|
6513
|
+
Reflect.get(manifest, "peerDependencies")
|
|
6514
|
+
].flatMap((dependencies) => object(dependencies) ? Object.keys(dependencies) : []).filter((name, index, names) => names.indexOf(name) === index).sort(), discoverAbsoluteSyncSchema = (projectRoot) => {
|
|
6515
|
+
const appManifestPath = join19(resolve15(projectRoot), "package.json");
|
|
6516
|
+
const appManifest = manifestAt(appManifestPath);
|
|
6517
|
+
if (!appManifest)
|
|
6518
|
+
return {
|
|
6519
|
+
components: [
|
|
6520
|
+
{
|
|
6521
|
+
id: "@absolutejs/app",
|
|
6522
|
+
minimumCompatibleVersion: 1,
|
|
6523
|
+
version: 1
|
|
6524
|
+
}
|
|
6525
|
+
],
|
|
6526
|
+
sources: []
|
|
6527
|
+
};
|
|
6528
|
+
const appMetadata = localSchemaMetadata(appManifest);
|
|
6529
|
+
const components = [
|
|
6530
|
+
appMetadata === undefined ? { id: "@absolutejs/app", minimumCompatibleVersion: 1, version: 1 } : component("@absolutejs/app", appMetadata)
|
|
6531
|
+
];
|
|
6532
|
+
const sources = [
|
|
6533
|
+
{ id: "@absolutejs/app", manifestPath: appManifestPath }
|
|
6534
|
+
];
|
|
6535
|
+
for (const name of dependencyNames(appManifest)) {
|
|
6536
|
+
const manifestPath = packageManifestPath(projectRoot, name);
|
|
6537
|
+
if (!manifestPath)
|
|
6538
|
+
continue;
|
|
6539
|
+
const manifest = manifestAt(manifestPath);
|
|
6540
|
+
if (!manifest)
|
|
6541
|
+
continue;
|
|
6542
|
+
const metadata = localSchemaMetadata(manifest);
|
|
6543
|
+
if (metadata === undefined)
|
|
6544
|
+
continue;
|
|
6545
|
+
components.push(component(name, metadata));
|
|
6546
|
+
sources.push({ id: name, manifestPath });
|
|
6547
|
+
}
|
|
6548
|
+
components.sort((left, right) => left.id.localeCompare(right.id));
|
|
6549
|
+
sources.sort((left, right) => left.id.localeCompare(right.id));
|
|
6550
|
+
resolveSyncLocalSchemaComponents({}, { components });
|
|
6551
|
+
return { components, sources };
|
|
6552
|
+
};
|
|
6553
|
+
var init_syncSchema = __esm(() => {
|
|
6554
|
+
init_client2();
|
|
6555
|
+
});
|
|
6556
|
+
|
|
6292
6557
|
// src/mobile/buildPipeline.ts
|
|
6293
6558
|
import { readFile as readFile10 } from "fs/promises";
|
|
6294
|
-
import { join as
|
|
6559
|
+
import { join as join20, resolve as resolve16 } from "path";
|
|
6295
6560
|
import { pathToFileURL } from "url";
|
|
6296
6561
|
var isElysiaApp = (value) => typeof value === "object" && value !== null && typeof Reflect.get(value, "compile") === "function" && Array.isArray(Reflect.get(value, "routes")), isStringRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && Object.values(value).every((entry) => typeof entry === "string"), serverExportName = (loaded, app) => {
|
|
6297
6562
|
if (loaded.server === app)
|
|
@@ -6320,11 +6585,11 @@ var isElysiaApp = (value) => typeof value === "object" && value !== null && type
|
|
|
6320
6585
|
const exportName = serverExportName(loaded, app);
|
|
6321
6586
|
return { app, exportName };
|
|
6322
6587
|
}, finalizeAbsoluteMobileCompatibilityBuild = async (options) => {
|
|
6323
|
-
const buildDirectory =
|
|
6588
|
+
const buildDirectory = resolve16(options.buildDirectory);
|
|
6324
6589
|
const mobile = normalizeAbsoluteMobileConfig(options.mobile, options.projectRoot);
|
|
6325
|
-
const root =
|
|
6590
|
+
const root = join20(buildDirectory, ".absolutejs", "mobile-compatibility");
|
|
6326
6591
|
const [manifestSource, previous] = await Promise.all([
|
|
6327
|
-
readFile10(
|
|
6592
|
+
readFile10(join20(buildDirectory, "manifest.json"), "utf8"),
|
|
6328
6593
|
readAbsoluteMobileMaterializedReleases(root)
|
|
6329
6594
|
]);
|
|
6330
6595
|
const manifest = JSON.parse(manifestSource);
|
|
@@ -6337,11 +6602,11 @@ var isElysiaApp = (value) => typeof value === "object" && value !== null && type
|
|
|
6337
6602
|
process.env.ABSOLUTE_BUILD_DIR = buildDirectory;
|
|
6338
6603
|
process.env.ABSOLUTE_COMPILED_RUNTIME = "1";
|
|
6339
6604
|
if (options.configPath) {
|
|
6340
|
-
process.env.ABSOLUTE_CONFIG =
|
|
6605
|
+
process.env.ABSOLUTE_CONFIG = resolve16(options.projectRoot, options.configPath);
|
|
6341
6606
|
}
|
|
6342
6607
|
let loaded;
|
|
6343
6608
|
try {
|
|
6344
|
-
loaded = await loadServerApp(
|
|
6609
|
+
loaded = await loadServerApp(resolve16(options.producerPath));
|
|
6345
6610
|
} finally {
|
|
6346
6611
|
restoreEnvironmentVariable("ABSOLUTE_BUILD_DIR", previousBuildDirectory);
|
|
6347
6612
|
restoreEnvironmentVariable("ABSOLUTE_COMPILED_RUNTIME", previousCompiledRuntime);
|
|
@@ -6354,11 +6619,12 @@ var isElysiaApp = (value) => typeof value === "object" && value !== null && type
|
|
|
6354
6619
|
manifest,
|
|
6355
6620
|
previousArtifacts: previous.map(({ artifact }) => artifact),
|
|
6356
6621
|
producerExport: loaded.exportName,
|
|
6357
|
-
producerPath:
|
|
6622
|
+
producerPath: resolve16(options.producerPath),
|
|
6358
6623
|
runtime: String(ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION)
|
|
6359
6624
|
});
|
|
6360
6625
|
const auth = resolveAbsoluteMobileAuthManifest(options.projectRoot, mobile);
|
|
6361
6626
|
const sync = auth !== undefined && projectUsesAbsoluteSync(options.projectRoot);
|
|
6627
|
+
const syncSchema = sync ? discoverAbsoluteSyncSchema(options.projectRoot) : undefined;
|
|
6362
6628
|
if (auth && !loaded.app.routes.some((route) => route.path === "/.well-known/openid-configuration")) {
|
|
6363
6629
|
throw new TypeError("@absolutejs/auth is installed, but its OIDC provider is not mounted. Native authentication requires the auth oidc configuration so AbsoluteJS can provision a public PKCE client.");
|
|
6364
6630
|
}
|
|
@@ -6377,7 +6643,8 @@ var isElysiaApp = (value) => typeof value === "object" && value !== null && type
|
|
|
6377
6643
|
...auth ? { auth } : {},
|
|
6378
6644
|
buildDirectory,
|
|
6379
6645
|
config: mobile,
|
|
6380
|
-
...sync ? { sync: true } : {}
|
|
6646
|
+
...sync ? { sync: true } : {},
|
|
6647
|
+
...syncSchema ? { syncSchema: { components: syncSchema.components } } : {}
|
|
6381
6648
|
});
|
|
6382
6649
|
return current.artifact;
|
|
6383
6650
|
};
|
|
@@ -6389,13 +6656,14 @@ var init_buildPipeline = __esm(() => {
|
|
|
6389
6656
|
init_pageProtocol();
|
|
6390
6657
|
init_releaseArtifact();
|
|
6391
6658
|
init_nativeAuth();
|
|
6659
|
+
init_syncSchema();
|
|
6392
6660
|
});
|
|
6393
6661
|
|
|
6394
6662
|
// src/mobile/routeMetadataTransform.ts
|
|
6395
|
-
import { existsSync as existsSync10, readFileSync as
|
|
6396
|
-
import { dirname as
|
|
6663
|
+
import { existsSync as existsSync10, readFileSync as readFileSync12 } from "fs";
|
|
6664
|
+
import { dirname as dirname13, extname as extname5, relative as relative11, resolve as resolve17 } from "path";
|
|
6397
6665
|
import ts4 from "typescript";
|
|
6398
|
-
var ROUTE_METHODS, SOURCE_FILTER, PAGE_HANDLERS, posixPath = (value) => value.replace(/\\/g, "/"), findTsconfig = (entry, projectRoot) => ts4.findConfigFile(
|
|
6666
|
+
var ROUTE_METHODS, SOURCE_FILTER, PAGE_HANDLERS, posixPath = (value) => value.replace(/\\/g, "/"), findTsconfig = (entry, projectRoot) => ts4.findConfigFile(dirname13(entry), existsSync10, "tsconfig.json") ?? ts4.findConfigFile(projectRoot, existsSync10, "tsconfig.json"), createProgram = (entry, projectRoot) => {
|
|
6399
6667
|
const configPath2 = findTsconfig(entry, projectRoot);
|
|
6400
6668
|
if (!configPath2) {
|
|
6401
6669
|
return ts4.createProgram([entry], {
|
|
@@ -6406,7 +6674,7 @@ var ROUTE_METHODS, SOURCE_FILTER, PAGE_HANDLERS, posixPath = (value) => value.re
|
|
|
6406
6674
|
target: ts4.ScriptTarget.ESNext
|
|
6407
6675
|
});
|
|
6408
6676
|
}
|
|
6409
|
-
const parsed = ts4.parseJsonConfigFileContent(ts4.readConfigFile(configPath2, (path) =>
|
|
6677
|
+
const parsed = ts4.parseJsonConfigFileContent(ts4.readConfigFile(configPath2, (path) => readFileSync12(path, "utf8")).config, ts4.sys, dirname13(configPath2));
|
|
6410
6678
|
if (!parsed.fileNames.includes(entry))
|
|
6411
6679
|
parsed.fileNames.push(entry);
|
|
6412
6680
|
return ts4.createProgram(parsed.fileNames, parsed.options);
|
|
@@ -6418,8 +6686,8 @@ var ROUTE_METHODS, SOURCE_FILTER, PAGE_HANDLERS, posixPath = (value) => value.re
|
|
|
6418
6686
|
if (ts4.isStringLiteralLike(property.name))
|
|
6419
6687
|
return property.name.text;
|
|
6420
6688
|
return;
|
|
6421
|
-
}, objectPropertyExpression = (
|
|
6422
|
-
const property =
|
|
6689
|
+
}, objectPropertyExpression = (object2, name) => {
|
|
6690
|
+
const property = object2.properties.find((candidate) => propertyName(candidate) === name);
|
|
6423
6691
|
if (property && ts4.isPropertyAssignment(property)) {
|
|
6424
6692
|
return property.initializer;
|
|
6425
6693
|
}
|
|
@@ -6605,8 +6873,8 @@ var ROUTE_METHODS, SOURCE_FILTER, PAGE_HANDLERS, posixPath = (value) => value.re
|
|
|
6605
6873
|
if (!ts4.isCallExpression(expression))
|
|
6606
6874
|
return;
|
|
6607
6875
|
return callableObject(expression, checker);
|
|
6608
|
-
}, objectAssetKey = (
|
|
6609
|
-
for (const property of [...
|
|
6876
|
+
}, objectAssetKey = (object2, name, checker, bindings = new Map) => {
|
|
6877
|
+
for (const property of [...object2.properties].reverse()) {
|
|
6610
6878
|
if (propertyName(property) === name && ts4.isShorthandPropertyAssignment(property)) {
|
|
6611
6879
|
return assetKeyWithBindings(property.name, checker, bindings);
|
|
6612
6880
|
}
|
|
@@ -6734,7 +7002,7 @@ var ROUTE_METHODS, SOURCE_FILTER, PAGE_HANDLERS, posixPath = (value) => value.re
|
|
|
6734
7002
|
const checker = program.getTypeChecker();
|
|
6735
7003
|
const analyzed = new Map;
|
|
6736
7004
|
for (const sourceFile of program.getSourceFiles()) {
|
|
6737
|
-
const resolvedFile =
|
|
7005
|
+
const resolvedFile = resolve17(sourceFile.fileName);
|
|
6738
7006
|
if (!isProjectSource(sourceFile, resolvedFile, projectRoot))
|
|
6739
7007
|
continue;
|
|
6740
7008
|
const analysis = analyzeSourceFile(sourceFile, checker, projectRoot);
|
|
@@ -6820,14 +7088,14 @@ var ROUTE_METHODS, SOURCE_FILTER, PAGE_HANDLERS, posixPath = (value) => value.re
|
|
|
6820
7088
|
result.dispose();
|
|
6821
7089
|
}
|
|
6822
7090
|
}, createAbsoluteMobileRouteMetadataPlugin = (options) => {
|
|
6823
|
-
const projectRoot =
|
|
6824
|
-
const entry =
|
|
7091
|
+
const projectRoot = resolve17(options.projectRoot ?? process.cwd());
|
|
7092
|
+
const entry = resolve17(options.entry);
|
|
6825
7093
|
const analyzed = analyzeProgram(createProgram(entry, projectRoot), projectRoot);
|
|
6826
7094
|
return {
|
|
6827
7095
|
name: "absolute-mobile-route-metadata",
|
|
6828
7096
|
setup(build) {
|
|
6829
7097
|
build.onLoad({ filter: SOURCE_FILTER }, async ({ path }) => {
|
|
6830
|
-
const analysis = analyzed.get(
|
|
7098
|
+
const analysis = analyzed.get(resolve17(path));
|
|
6831
7099
|
if (!analysis)
|
|
6832
7100
|
return;
|
|
6833
7101
|
const source = await Bun.file(path).text();
|
|
@@ -6894,7 +7162,7 @@ var init_routeMetadataTransform = __esm(() => {
|
|
|
6894
7162
|
});
|
|
6895
7163
|
|
|
6896
7164
|
// src/cli/elysiaOpenApiTypeboxPlugin.ts
|
|
6897
|
-
import { dirname as
|
|
7165
|
+
import { dirname as dirname14, resolve as resolve18 } from "path";
|
|
6898
7166
|
var OPENAPI_TYPEBOX_PREFIX = "../node_modules/typebox/", OPENAPI_DISTRIBUTION_SEGMENT = "/@elysia/openapi/dist/", createElysiaOpenApiTypeboxPlugin = () => ({
|
|
6899
7167
|
name: "absolute-elysia-openapi-typebox",
|
|
6900
7168
|
setup(build) {
|
|
@@ -6904,9 +7172,9 @@ var OPENAPI_TYPEBOX_PREFIX = "../node_modules/typebox/", OPENAPI_DISTRIBUTION_SE
|
|
|
6904
7172
|
return;
|
|
6905
7173
|
}
|
|
6906
7174
|
const relativePath = args.path.slice(OPENAPI_TYPEBOX_PREFIX.length);
|
|
6907
|
-
const typeboxEntry = Bun.resolveSync("typebox",
|
|
7175
|
+
const typeboxEntry = Bun.resolveSync("typebox", dirname14(args.importer));
|
|
6908
7176
|
return {
|
|
6909
|
-
path:
|
|
7177
|
+
path: resolve18(dirname14(typeboxEntry), "..", relativePath)
|
|
6910
7178
|
};
|
|
6911
7179
|
});
|
|
6912
7180
|
}
|
|
@@ -6966,15 +7234,15 @@ __export(exports_prerender, {
|
|
|
6966
7234
|
prerender: () => prerender,
|
|
6967
7235
|
PRERENDER_BYPASS_HEADER: () => PRERENDER_BYPASS_HEADER
|
|
6968
7236
|
});
|
|
6969
|
-
import { mkdirSync as mkdirSync6, readFileSync as
|
|
6970
|
-
import { join as
|
|
7237
|
+
import { mkdirSync as mkdirSync6, readFileSync as readFileSync13 } from "fs";
|
|
7238
|
+
import { join as join21 } from "path";
|
|
6971
7239
|
var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_TIMEOUT_MS = 30000, DEFAULT_FETCH_TIMEOUT_MS = 1e4, PRERENDER_BYPASS_HEADER = "X-Absolute-Prerender-Bypass", routeToFilename = (route) => route === "/" ? "index.html" : `${route.slice(1).replace(/\//g, "-")}.html`, writeTimestamp = async (htmlPath) => {
|
|
6972
7240
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
6973
7241
|
await Bun.write(metaPath, String(Date.now()));
|
|
6974
7242
|
}, readTimestamp = (htmlPath) => {
|
|
6975
7243
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
6976
7244
|
try {
|
|
6977
|
-
const content =
|
|
7245
|
+
const content = readFileSync13(metaPath, "utf-8");
|
|
6978
7246
|
return Number(content) || 0;
|
|
6979
7247
|
} catch {
|
|
6980
7248
|
return 0;
|
|
@@ -7037,7 +7305,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
|
|
|
7037
7305
|
if (!isCompleteHtml(html))
|
|
7038
7306
|
return false;
|
|
7039
7307
|
const fileName = routeToFilename(route);
|
|
7040
|
-
const filePath =
|
|
7308
|
+
const filePath = join21(prerenderDir, fileName);
|
|
7041
7309
|
await Bun.write(filePath, html);
|
|
7042
7310
|
await writeTimestamp(filePath);
|
|
7043
7311
|
return true;
|
|
@@ -7067,13 +7335,13 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
|
|
|
7067
7335
|
return;
|
|
7068
7336
|
}
|
|
7069
7337
|
const fileName = routeToFilename(route);
|
|
7070
|
-
const filePath =
|
|
7338
|
+
const filePath = join21(prerenderDir, fileName);
|
|
7071
7339
|
await Bun.write(filePath, html);
|
|
7072
7340
|
await writeTimestamp(filePath);
|
|
7073
7341
|
result.routes.set(route, filePath);
|
|
7074
7342
|
log?.(` Pre-rendered ${route} \u2192 ${fileName} (${html.length} bytes)`);
|
|
7075
7343
|
}, prerender = async (port, outDir, staticConfig, log) => {
|
|
7076
|
-
const prerenderDir =
|
|
7344
|
+
const prerenderDir = join21(outDir, "_prerendered");
|
|
7077
7345
|
mkdirSync6(prerenderDir, { recursive: true });
|
|
7078
7346
|
const baseUrl = `http://localhost:${port}`;
|
|
7079
7347
|
let routes;
|
|
@@ -7449,7 +7717,7 @@ var init_maskLiterals = __esm(() => {
|
|
|
7449
7717
|
// src/build/nativeRewrite.ts
|
|
7450
7718
|
import { dlopen, FFIType, ptr } from "bun:ffi";
|
|
7451
7719
|
import { platform as platform4, arch as arch3 } from "os";
|
|
7452
|
-
import { resolve as
|
|
7720
|
+
import { resolve as resolve19 } from "path";
|
|
7453
7721
|
var ffiDefinition, nativeLib = null, loadNative = () => {
|
|
7454
7722
|
if (nativeLib !== null)
|
|
7455
7723
|
return nativeLib;
|
|
@@ -7467,7 +7735,7 @@ var ffiDefinition, nativeLib = null, loadNative = () => {
|
|
|
7467
7735
|
if (!libPath)
|
|
7468
7736
|
return null;
|
|
7469
7737
|
try {
|
|
7470
|
-
const fullPath =
|
|
7738
|
+
const fullPath = resolve19(import.meta.dir, "../../native/packages", libPath);
|
|
7471
7739
|
const lib = dlopen(fullPath, ffiDefinition);
|
|
7472
7740
|
nativeLib = lib.symbols;
|
|
7473
7741
|
return nativeLib;
|
|
@@ -7509,7 +7777,7 @@ var init_nativeRewrite = __esm(() => {
|
|
|
7509
7777
|
|
|
7510
7778
|
// src/build/rewriteImportsPlugin.ts
|
|
7511
7779
|
import { readdir as readdir3 } from "fs/promises";
|
|
7512
|
-
import { join as
|
|
7780
|
+
import { join as join22 } from "path";
|
|
7513
7781
|
var escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewriteImports = (content, replacements) => {
|
|
7514
7782
|
let result = content;
|
|
7515
7783
|
for (const [specifier, webPath] of replacements) {
|
|
@@ -7588,7 +7856,7 @@ ${content}`;
|
|
|
7588
7856
|
const entries = await readdir3(dir);
|
|
7589
7857
|
for (const entry of entries) {
|
|
7590
7858
|
if (entry.endsWith(".js"))
|
|
7591
|
-
allFiles.push(
|
|
7859
|
+
allFiles.push(join22(dir, entry));
|
|
7592
7860
|
}
|
|
7593
7861
|
} catch {}
|
|
7594
7862
|
}
|
|
@@ -7663,8 +7931,8 @@ var init_rewriteImports = __esm(() => {
|
|
|
7663
7931
|
|
|
7664
7932
|
// src/cli/scripts/start.ts
|
|
7665
7933
|
var {env: env2 } = globalThis.Bun;
|
|
7666
|
-
import { existsSync as existsSync11, readFileSync as
|
|
7667
|
-
import { basename as basename8, join as
|
|
7934
|
+
import { existsSync as existsSync11, readFileSync as readFileSync14, rmSync as rmSync4 } from "fs";
|
|
7935
|
+
import { basename as basename8, join as join23, resolve as resolve20 } from "path";
|
|
7668
7936
|
var cliTag2 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`, resolvePackageVersion = (candidates) => {
|
|
7669
7937
|
for (const candidate of candidates) {
|
|
7670
7938
|
const version2 = readPackageVersion2(candidate);
|
|
@@ -7675,7 +7943,7 @@ var cliTag2 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
7675
7943
|
return "";
|
|
7676
7944
|
}, readPackageVersion2 = (candidate) => {
|
|
7677
7945
|
try {
|
|
7678
|
-
const pkg = JSON.parse(
|
|
7946
|
+
const pkg = JSON.parse(readFileSync14(candidate, "utf-8"));
|
|
7679
7947
|
if (pkg.name !== "@absolutejs/absolute")
|
|
7680
7948
|
return null;
|
|
7681
7949
|
const ver = pkg.version;
|
|
@@ -7713,18 +7981,18 @@ var cliTag2 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
7713
7981
|
process.exit(1);
|
|
7714
7982
|
}, resolveJsxDevRuntimeCompatPath = () => {
|
|
7715
7983
|
const candidates = [
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7984
|
+
resolve20(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
7985
|
+
resolve20(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js"),
|
|
7986
|
+
resolve20(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.ts"),
|
|
7987
|
+
resolve20(import.meta.dir, "..", "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
7988
|
+
resolve20(import.meta.dir, "..", "..", "..", "react", "jsxDevRuntimeCompat.js"),
|
|
7989
|
+
resolve20(import.meta.dir, "..", "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
7722
7990
|
];
|
|
7723
7991
|
for (const candidate of candidates) {
|
|
7724
7992
|
if (existsSync11(candidate))
|
|
7725
7993
|
return candidate;
|
|
7726
7994
|
}
|
|
7727
|
-
return
|
|
7995
|
+
return resolve20(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js");
|
|
7728
7996
|
}, jsxDevRuntimeCompatPath, prerenderStaticPages = async (outputPath, prerenderPort, resolvedOutdir, staticConfig, absoluteVersion, configPath2) => {
|
|
7729
7997
|
const prerenderStart = performance.now();
|
|
7730
7998
|
process.stdout.write(cliTag2("\x1B[36m", "Pre-rendering static pages"));
|
|
@@ -7758,7 +8026,7 @@ var cliTag2 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
7758
8026
|
serverEntry,
|
|
7759
8027
|
totalDuration
|
|
7760
8028
|
}) => {
|
|
7761
|
-
const usesDocker = existsSync11(
|
|
8029
|
+
const usesDocker = existsSync11(resolve20(COMPOSE_PATH));
|
|
7762
8030
|
const scripts = usesDocker ? await readDbScripts() : null;
|
|
7763
8031
|
if (scripts)
|
|
7764
8032
|
await startDatabase(scripts);
|
|
@@ -7849,10 +8117,10 @@ var cliTag2 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
7849
8117
|
const port = Number(env2.PORT) || DEFAULT_PORT;
|
|
7850
8118
|
killStaleProcesses(port);
|
|
7851
8119
|
const entryName = basename8(serverEntry).replace(/\.[^.]+$/, "");
|
|
7852
|
-
const resolvedOutdir =
|
|
8120
|
+
const resolvedOutdir = resolve20(outdir ?? "dist");
|
|
7853
8121
|
const absoluteVersion = resolvePackageVersion([
|
|
7854
|
-
|
|
7855
|
-
|
|
8122
|
+
resolve20(import.meta.dir, "..", "..", "..", "package.json"),
|
|
8123
|
+
resolve20(import.meta.dir, "..", "..", "package.json")
|
|
7856
8124
|
]);
|
|
7857
8125
|
const buildConfig = await loadConfig(configPath2);
|
|
7858
8126
|
buildConfig.buildDirectory = resolvedOutdir;
|
|
@@ -7867,7 +8135,7 @@ var cliTag2 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
7867
8135
|
buildConfig.vueDirectory && "vue",
|
|
7868
8136
|
buildConfig.angularDirectory && "angular"
|
|
7869
8137
|
].filter((val) => Boolean(val));
|
|
7870
|
-
const outputPath =
|
|
8138
|
+
const outputPath = resolve20(resolvedOutdir, `${entryName}.js`);
|
|
7871
8139
|
if (options.prebuilt) {
|
|
7872
8140
|
if (!existsSync11(outputPath)) {
|
|
7873
8141
|
throw new Error(`Prepared production server not found: ${outputPath}`);
|
|
@@ -7890,13 +8158,13 @@ var cliTag2 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
7890
8158
|
process.stdout.write(cliTag2("\x1B[36m", `Building assets`));
|
|
7891
8159
|
try {
|
|
7892
8160
|
const build = await resolveBuildModule([
|
|
7893
|
-
|
|
7894
|
-
|
|
8161
|
+
resolve20(import.meta.dir, "..", "..", "core", "build"),
|
|
8162
|
+
resolve20(import.meta.dir, "..", "build")
|
|
7895
8163
|
]);
|
|
7896
8164
|
if (!build)
|
|
7897
8165
|
throw new Error("Could not locate build module");
|
|
7898
8166
|
await build(buildConfig);
|
|
7899
|
-
rmSync4(
|
|
8167
|
+
rmSync4(join23(resolvedOutdir, "_prerendered"), {
|
|
7900
8168
|
force: true,
|
|
7901
8169
|
recursive: true
|
|
7902
8170
|
});
|
|
@@ -7973,17 +8241,17 @@ var cliTag2 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
7973
8241
|
}
|
|
7974
8242
|
};
|
|
7975
8243
|
const islandRegistrySpec = buildConfig.islands?.registry;
|
|
7976
|
-
const islandRegistryPlugin = islandRegistrySpec ? createIslandRegistryDefinitionPlugin(await loadIslandRegistryBuildInfo(
|
|
8244
|
+
const islandRegistryPlugin = islandRegistrySpec ? createIslandRegistryDefinitionPlugin(await loadIslandRegistryBuildInfo(resolve20(islandRegistrySpec))) : undefined;
|
|
7977
8245
|
const serverBundle = await Bun.build({
|
|
7978
8246
|
define: { "process.env.NODE_ENV": '"production"' },
|
|
7979
|
-
entrypoints: [
|
|
8247
|
+
entrypoints: [resolve20(serverEntry)],
|
|
7980
8248
|
external: resolveServerBundleExternals(buildConfig),
|
|
7981
8249
|
outdir: resolvedOutdir,
|
|
7982
8250
|
plugins: [
|
|
7983
8251
|
...islandRegistryPlugin ? [islandRegistryPlugin] : [],
|
|
7984
8252
|
...buildConfig.mobile ? [
|
|
7985
8253
|
createAbsoluteMobileRouteMetadataPlugin({
|
|
7986
|
-
entry:
|
|
8254
|
+
entry: resolve20(serverEntry)
|
|
7987
8255
|
})
|
|
7988
8256
|
] : [],
|
|
7989
8257
|
createElysiaOpenApiTypeboxPlugin(),
|
|
@@ -8000,9 +8268,9 @@ var cliTag2 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
8000
8268
|
console.error(cliTag2("\x1B[31m", `Expected output not found: ${outputPath}`));
|
|
8001
8269
|
process.exit(1);
|
|
8002
8270
|
}
|
|
8003
|
-
if (existsSync11(
|
|
8271
|
+
if (existsSync11(resolve20(resolvedOutdir, "angular", "vendor", "server"))) {
|
|
8004
8272
|
const { readdirSync: readdirSync2 } = await import("fs");
|
|
8005
|
-
const vendorDir =
|
|
8273
|
+
const vendorDir = resolve20(resolvedOutdir, "angular", "vendor", "server");
|
|
8006
8274
|
const vendorEntries = readdirSync2(vendorDir).filter((fileName) => fileName.endsWith(".js"));
|
|
8007
8275
|
const angularServerVendorPaths = {};
|
|
8008
8276
|
const { relative: pathRelative, dirname: pathDirname } = await import("path");
|
|
@@ -8012,7 +8280,7 @@ var cliTag2 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
8012
8280
|
if (scope !== "angular" || rest.length === 0)
|
|
8013
8281
|
continue;
|
|
8014
8282
|
const specifier = `@angular/${rest.join("/")}`;
|
|
8015
|
-
const relPath = pathRelative(pathDirname(outputPath),
|
|
8283
|
+
const relPath = pathRelative(pathDirname(outputPath), resolve20(vendorDir, file));
|
|
8016
8284
|
angularServerVendorPaths[specifier] = relPath.startsWith(".") ? relPath : `./${relPath}`;
|
|
8017
8285
|
}
|
|
8018
8286
|
if (Object.keys(angularServerVendorPaths).length > 0) {
|
|
@@ -8199,17 +8467,17 @@ var exports_build = {};
|
|
|
8199
8467
|
__export(exports_build, {
|
|
8200
8468
|
build: () => build
|
|
8201
8469
|
});
|
|
8202
|
-
import { existsSync as existsSync13, readdirSync as readdirSync3, readFileSync as
|
|
8203
|
-
import { join as
|
|
8470
|
+
import { existsSync as existsSync13, readdirSync as readdirSync3, readFileSync as readFileSync16 } from "fs";
|
|
8471
|
+
import { join as join24, resolve as resolve22 } from "path";
|
|
8204
8472
|
var PROFILE_TOP = 15, PROFILE_COL = 8, FRAMEWORK_KEYS, cliTag3 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`, printProfile = (buildDir) => {
|
|
8205
|
-
const traceDir =
|
|
8473
|
+
const traceDir = join24(buildDir, ".absolute-trace");
|
|
8206
8474
|
if (!existsSync13(traceDir))
|
|
8207
8475
|
return;
|
|
8208
8476
|
const files = readdirSync3(traceDir).filter((file) => file.endsWith(".json")).sort();
|
|
8209
8477
|
const latest = files[files.length - 1];
|
|
8210
8478
|
if (latest === undefined)
|
|
8211
8479
|
return;
|
|
8212
|
-
const trace = JSON.parse(
|
|
8480
|
+
const trace = JSON.parse(readFileSync16(join24(traceDir, latest), "utf-8"));
|
|
8213
8481
|
const events = Array.isArray(trace.events) ? trace.events : [];
|
|
8214
8482
|
if (events.length === 0)
|
|
8215
8483
|
return;
|
|
@@ -8246,7 +8514,7 @@ var PROFILE_TOP = 15, PROFILE_COL = 8, FRAMEWORK_KEYS, cliTag3 = (color, message
|
|
|
8246
8514
|
}
|
|
8247
8515
|
return resolveBuildModule2(remaining);
|
|
8248
8516
|
}, build = async (outdir, configPath2, profile = false) => {
|
|
8249
|
-
const resolvedOutdir =
|
|
8517
|
+
const resolvedOutdir = resolve22(outdir ?? "build");
|
|
8250
8518
|
const buildStart = performance.now();
|
|
8251
8519
|
if (profile)
|
|
8252
8520
|
process.env.ABSOLUTE_BUILD_TRACE = "1";
|
|
@@ -8256,8 +8524,8 @@ var PROFILE_TOP = 15, PROFILE_COL = 8, FRAMEWORK_KEYS, cliTag3 = (color, message
|
|
|
8256
8524
|
buildConfig.mode = "production";
|
|
8257
8525
|
try {
|
|
8258
8526
|
const buildApp = await resolveBuildModule2([
|
|
8259
|
-
|
|
8260
|
-
|
|
8527
|
+
resolve22(import.meta.dir, "..", "..", "core", "build"),
|
|
8528
|
+
resolve22(import.meta.dir, "..", "build")
|
|
8261
8529
|
]);
|
|
8262
8530
|
if (!buildApp)
|
|
8263
8531
|
throw new Error("Could not locate build module");
|
|
@@ -8306,14 +8574,14 @@ import {
|
|
|
8306
8574
|
lstatSync,
|
|
8307
8575
|
mkdirSync as mkdirSync8,
|
|
8308
8576
|
mkdtempSync,
|
|
8309
|
-
readFileSync as
|
|
8577
|
+
readFileSync as readFileSync17,
|
|
8310
8578
|
realpathSync,
|
|
8311
8579
|
renameSync as renameSync2,
|
|
8312
8580
|
rmSync as rmSync5,
|
|
8313
8581
|
writeFileSync as writeFileSync7
|
|
8314
8582
|
} from "fs";
|
|
8315
8583
|
import { tmpdir as tmpdir3 } from "os";
|
|
8316
|
-
import { delimiter, dirname as
|
|
8584
|
+
import { delimiter, dirname as dirname15, relative as relative12, resolve as resolve23 } from "path";
|
|
8317
8585
|
var DEFAULT_PROOF_LOCATION = ".absolutejs/lint-proof.json", PROOF_CONTRACT_VERSION = 2, FLAG_NOT_FOUND = -1, CHUNKED_FLAG = "--chunked", TSCONFIG_PATTERN, ABSOLUTE_BINARY, runGit = (args, options) => {
|
|
8318
8586
|
const proc = Bun.spawnSync(["git", ...args], {
|
|
8319
8587
|
cwd: options.cwd,
|
|
@@ -8326,7 +8594,7 @@ var DEFAULT_PROOF_LOCATION = ".absolutejs/lint-proof.json", PROOF_CONTRACT_VERSI
|
|
|
8326
8594
|
throw new Error(detail || `git ${args.join(" ")} failed`);
|
|
8327
8595
|
}
|
|
8328
8596
|
return proc.stdout.toString().trim();
|
|
8329
|
-
}, gitRoot = (cwd) =>
|
|
8597
|
+
}, gitRoot = (cwd) => resolve23(runGit(["rev-parse", "--show-toplevel"], { cwd })), isInside3 = (parent, candidate) => {
|
|
8330
8598
|
const path = relative12(parent, candidate);
|
|
8331
8599
|
return path === "" || !path.startsWith("../") && path !== "..";
|
|
8332
8600
|
}, attestationPayload = (proof) => Buffer.from([
|
|
@@ -8339,17 +8607,17 @@ var DEFAULT_PROOF_LOCATION = ".absolutejs/lint-proof.json", PROOF_CONTRACT_VERSI
|
|
|
8339
8607
|
sourceTree: proof.sourceTree
|
|
8340
8608
|
})
|
|
8341
8609
|
].join("\x00")), publicKeyId = (key) => createHash11("sha256").update(key.export({ format: "der", type: "spki" })).digest("hex"), readEd25519PrivateKey = (cwd, location) => {
|
|
8342
|
-
const path =
|
|
8610
|
+
const path = resolve23(cwd, location);
|
|
8343
8611
|
if (isInside3(realpathSync(gitRoot(cwd)), realpathSync(path))) {
|
|
8344
8612
|
throw new Error("lint proof signing key must live outside the Git working tree");
|
|
8345
8613
|
}
|
|
8346
|
-
const key = createPrivateKey(
|
|
8614
|
+
const key = createPrivateKey(readFileSync17(path));
|
|
8347
8615
|
if (key.asymmetricKeyType !== "ed25519") {
|
|
8348
8616
|
throw new Error("lint proof signing key must be an Ed25519 private key");
|
|
8349
8617
|
}
|
|
8350
8618
|
return key;
|
|
8351
8619
|
}, readEd25519PublicKey = (cwd, location) => {
|
|
8352
|
-
const key = createPublicKey(
|
|
8620
|
+
const key = createPublicKey(readFileSync17(resolve23(cwd, location)));
|
|
8353
8621
|
if (key.asymmetricKeyType !== "ed25519") {
|
|
8354
8622
|
throw new Error("trusted lint proof key must be an Ed25519 public key");
|
|
8355
8623
|
}
|
|
@@ -8387,17 +8655,17 @@ var DEFAULT_PROOF_LOCATION = ".absolutejs/lint-proof.json", PROOF_CONTRACT_VERSI
|
|
|
8387
8655
|
].sort();
|
|
8388
8656
|
}, createLintSourceTree = (cwd = process.cwd(), proofLocation = DEFAULT_PROOF_LOCATION, command = []) => {
|
|
8389
8657
|
const root = gitRoot(cwd);
|
|
8390
|
-
const proofPath =
|
|
8658
|
+
const proofPath = resolve23(cwd, proofLocation);
|
|
8391
8659
|
const proofRelative = relative12(root, proofPath).replaceAll("\\", "/");
|
|
8392
8660
|
if (proofRelative === ".." || proofRelative.startsWith("../") || proofRelative === "") {
|
|
8393
8661
|
throw new Error("lint proof must live inside the Git working tree");
|
|
8394
8662
|
}
|
|
8395
|
-
const temporaryDirectory = mkdtempSync(
|
|
8396
|
-
const temporaryIndex =
|
|
8397
|
-
const temporaryObjects =
|
|
8663
|
+
const temporaryDirectory = mkdtempSync(resolve23(tmpdir3(), "absolute-lint-proof-"));
|
|
8664
|
+
const temporaryIndex = resolve23(temporaryDirectory, "index");
|
|
8665
|
+
const temporaryObjects = resolve23(temporaryDirectory, "objects");
|
|
8398
8666
|
mkdirSync8(temporaryObjects, { recursive: true });
|
|
8399
8667
|
const repositoryObjectsPath = runGit(["rev-parse", "--git-path", "objects"], { cwd: root });
|
|
8400
|
-
const repositoryObjects =
|
|
8668
|
+
const repositoryObjects = resolve23(root, repositoryObjectsPath);
|
|
8401
8669
|
const existingAlternates = process.env.GIT_ALTERNATE_OBJECT_DIRECTORIES?.trim();
|
|
8402
8670
|
const env3 = {
|
|
8403
8671
|
GIT_ALTERNATE_OBJECT_DIRECTORIES: [
|
|
@@ -8421,7 +8689,7 @@ var DEFAULT_PROOF_LOCATION = ".absolutejs/lint-proof.json", PROOF_CONTRACT_VERSI
|
|
|
8421
8689
|
if (!path || path === proofRelative)
|
|
8422
8690
|
return false;
|
|
8423
8691
|
try {
|
|
8424
|
-
lstatSync(
|
|
8692
|
+
lstatSync(resolve23(root, path));
|
|
8425
8693
|
return true;
|
|
8426
8694
|
} catch {
|
|
8427
8695
|
return false;
|
|
@@ -8445,7 +8713,7 @@ var DEFAULT_PROOF_LOCATION = ".absolutejs/lint-proof.json", PROOF_CONTRACT_VERSI
|
|
|
8445
8713
|
}, writeLintProof = (command, options = {}) => {
|
|
8446
8714
|
const cwd = options.cwd ?? process.cwd();
|
|
8447
8715
|
const proofLocation = options.proofLocation ?? DEFAULT_PROOF_LOCATION;
|
|
8448
|
-
const path =
|
|
8716
|
+
const path = resolve23(cwd, proofLocation);
|
|
8449
8717
|
const temporary = `${path}.${process.pid}.tmp`;
|
|
8450
8718
|
const proof = createLintProof(command, { cwd, proofLocation });
|
|
8451
8719
|
if (options.signingKeyLocation) {
|
|
@@ -8457,7 +8725,7 @@ var DEFAULT_PROOF_LOCATION = ".absolutejs/lint-proof.json", PROOF_CONTRACT_VERSI
|
|
|
8457
8725
|
signature: sign(null, attestationPayload(proof), privateKey).toString("base64")
|
|
8458
8726
|
};
|
|
8459
8727
|
}
|
|
8460
|
-
mkdirSync8(
|
|
8728
|
+
mkdirSync8(dirname15(path), { recursive: true });
|
|
8461
8729
|
writeFileSync7(temporary, `${JSON.stringify(proof, null, 2)}
|
|
8462
8730
|
`);
|
|
8463
8731
|
renameSync2(temporary, path);
|
|
@@ -8501,12 +8769,12 @@ var DEFAULT_PROOF_LOCATION = ".absolutejs/lint-proof.json", PROOF_CONTRACT_VERSI
|
|
|
8501
8769
|
}, verifyLintProof = (command, options = {}) => {
|
|
8502
8770
|
const cwd = options.cwd ?? process.cwd();
|
|
8503
8771
|
const proofLocation = options.proofLocation ?? DEFAULT_PROOF_LOCATION;
|
|
8504
|
-
const path =
|
|
8772
|
+
const path = resolve23(cwd, proofLocation);
|
|
8505
8773
|
if (!existsSync14(path))
|
|
8506
8774
|
return { reason: `missing lint proof: ${proofLocation}`, valid: false };
|
|
8507
8775
|
let proof;
|
|
8508
8776
|
try {
|
|
8509
|
-
proof = JSON.parse(
|
|
8777
|
+
proof = JSON.parse(readFileSync17(path, "utf-8"));
|
|
8510
8778
|
} catch {
|
|
8511
8779
|
return { reason: `invalid lint proof: ${proofLocation}`, valid: false };
|
|
8512
8780
|
}
|
|
@@ -8567,8 +8835,8 @@ var DEFAULT_PROOF_LOCATION = ".absolutejs/lint-proof.json", PROOF_CONTRACT_VERSI
|
|
|
8567
8835
|
console.log(`\x1B[32m\u2713\x1B[0m Lint proof matches the source tree, command, and lint toolchain${parsed.trustedKeyLocation ? ", with a trusted signature" : ""}`);
|
|
8568
8836
|
return 0;
|
|
8569
8837
|
}, runLintProof = async (args) => {
|
|
8570
|
-
const [
|
|
8571
|
-
if (
|
|
8838
|
+
const [operation2] = args;
|
|
8839
|
+
if (operation2 !== "run" && operation2 !== "verify") {
|
|
8572
8840
|
console.error("Usage: absolute lint-proof <run|verify> [--proof path] [--signing-key path | --trusted-key path] -- <lint command>");
|
|
8573
8841
|
return 2;
|
|
8574
8842
|
}
|
|
@@ -8583,15 +8851,15 @@ var DEFAULT_PROOF_LOCATION = ".absolutejs/lint-proof.json", PROOF_CONTRACT_VERSI
|
|
|
8583
8851
|
console.error("A lint command is required after --");
|
|
8584
8852
|
return 2;
|
|
8585
8853
|
}
|
|
8586
|
-
if (
|
|
8854
|
+
if (operation2 === "run" && parsed.trustedKeyLocation) {
|
|
8587
8855
|
console.error("--trusted-key is only valid with lint-proof verify");
|
|
8588
8856
|
return 2;
|
|
8589
8857
|
}
|
|
8590
|
-
if (
|
|
8858
|
+
if (operation2 === "verify" && parsed.signingKeyLocation) {
|
|
8591
8859
|
console.error("--signing-key is only valid with lint-proof run");
|
|
8592
8860
|
return 2;
|
|
8593
8861
|
}
|
|
8594
|
-
if (
|
|
8862
|
+
if (operation2 === "verify")
|
|
8595
8863
|
return runVerification(parsed);
|
|
8596
8864
|
const proc = Bun.spawn(parsed.command, {
|
|
8597
8865
|
stderr: "inherit",
|
|
@@ -8671,8 +8939,8 @@ var exports_ls = {};
|
|
|
8671
8939
|
__export(exports_ls, {
|
|
8672
8940
|
runLs: () => runLs
|
|
8673
8941
|
});
|
|
8674
|
-
import { existsSync as existsSync16, readFileSync as
|
|
8675
|
-
import { basename as basename10, extname as extname6, join as
|
|
8942
|
+
import { existsSync as existsSync16, readFileSync as readFileSync18, statSync } from "fs";
|
|
8943
|
+
import { basename as basename10, extname as extname6, join as join25, relative as relative13 } from "path";
|
|
8676
8944
|
var DEFAULT_BUILD_DIR = "build", LABEL_ORDER, ARTIFACT_SUFFIXES, FRAMEWORK_FIELDS, readStringField = (source, key) => {
|
|
8677
8945
|
const value = Reflect.get(source, key);
|
|
8678
8946
|
return typeof value === "string" ? value : undefined;
|
|
@@ -8694,13 +8962,13 @@ var DEFAULT_BUILD_DIR = "build", LABEL_ORDER, ARTIFACT_SUFFIXES, FRAMEWORK_FIELD
|
|
|
8694
8962
|
const dir = readStringField(source, framework.field);
|
|
8695
8963
|
return dir === undefined ? [] : [
|
|
8696
8964
|
{
|
|
8697
|
-
dir:
|
|
8965
|
+
dir: join25(baseDir, dir),
|
|
8698
8966
|
label: framework.label,
|
|
8699
8967
|
pattern: framework.pattern
|
|
8700
8968
|
}
|
|
8701
8969
|
];
|
|
8702
8970
|
}), scanFramework = async (spec) => {
|
|
8703
|
-
const { pageFiles } = await scanConventions(
|
|
8971
|
+
const { pageFiles } = await scanConventions(join25(spec.dir, "pages"), spec.pattern);
|
|
8704
8972
|
if (pageFiles.length === 0)
|
|
8705
8973
|
return null;
|
|
8706
8974
|
const pages = pageFiles.map((file) => ({
|
|
@@ -8724,10 +8992,10 @@ var DEFAULT_BUILD_DIR = "build", LABEL_ORDER, ARTIFACT_SUFFIXES, FRAMEWORK_FIELD
|
|
|
8724
8992
|
}, resolveDiskPath = (buildDir, value) => {
|
|
8725
8993
|
if (existsSync16(value))
|
|
8726
8994
|
return value;
|
|
8727
|
-
const underBuild =
|
|
8995
|
+
const underBuild = join25(buildDir, value);
|
|
8728
8996
|
if (existsSync16(underBuild))
|
|
8729
8997
|
return underBuild;
|
|
8730
|
-
return
|
|
8998
|
+
return join25(process.cwd(), value);
|
|
8731
8999
|
}, fileSize = (diskPath) => {
|
|
8732
9000
|
try {
|
|
8733
9001
|
return statSync(diskPath).size;
|
|
@@ -8735,7 +9003,7 @@ var DEFAULT_BUILD_DIR = "build", LABEL_ORDER, ARTIFACT_SUFFIXES, FRAMEWORK_FIELD
|
|
|
8735
9003
|
return 0;
|
|
8736
9004
|
}
|
|
8737
9005
|
}, readManifestSizes = (manifestDir) => {
|
|
8738
|
-
const manifest = JSON.parse(
|
|
9006
|
+
const manifest = JSON.parse(readFileSync18(join25(manifestDir, "manifest.json"), "utf-8"));
|
|
8739
9007
|
const sizes = new Map;
|
|
8740
9008
|
Object.entries(manifest).forEach(([key, value]) => {
|
|
8741
9009
|
sizes.set(key, fileSize(resolveDiskPath(manifestDir, value)));
|
|
@@ -8754,7 +9022,7 @@ var DEFAULT_BUILD_DIR = "build", LABEL_ORDER, ARTIFACT_SUFFIXES, FRAMEWORK_FIELD
|
|
|
8754
9022
|
}))
|
|
8755
9023
|
})), manifestAge = (manifestPath) => getDurationString(Date.now() - statSync(manifestPath).mtimeMs), firstBuildDir = (candidates) => candidates.map((candidate) => {
|
|
8756
9024
|
const dir = readStringField(candidate.source, "buildDirectory");
|
|
8757
|
-
return dir === undefined ? undefined :
|
|
9025
|
+
return dir === undefined ? undefined : join25(candidate.baseDir, dir);
|
|
8758
9026
|
}).find((dir) => dir !== undefined), resolveSizesDir = (args, candidates) => parseFlagValue(args, "--outdir") ?? firstBuildDir(candidates) ?? DEFAULT_BUILD_DIR, formatSize = (bytes) => {
|
|
8759
9027
|
if (bytes === null || bytes === 0)
|
|
8760
9028
|
return "-";
|
|
@@ -8852,7 +9120,7 @@ ${colors.dim}${frameworkCount} ${frameworkCount === 1 ? "framework" : "framework
|
|
|
8852
9120
|
return;
|
|
8853
9121
|
}
|
|
8854
9122
|
const sizesDir = resolveSizesDir(args, candidates);
|
|
8855
|
-
const manifestPath =
|
|
9123
|
+
const manifestPath = join25(sizesDir, "manifest.json");
|
|
8856
9124
|
if (!existsSync16(manifestPath)) {
|
|
8857
9125
|
printDim(`No build at ${relativeOrSelf(manifestPath)}. Run \`absolute build\` first, or pass \`--outdir <dir>\`.`);
|
|
8858
9126
|
return;
|
|
@@ -8976,22 +9244,22 @@ var init_discoverInstances = __esm(() => {
|
|
|
8976
9244
|
// src/cli/instanceStatus.ts
|
|
8977
9245
|
import { createConnection as createConnection2 } from "net";
|
|
8978
9246
|
var {$: $4 } = globalThis.Bun;
|
|
8979
|
-
var displayHost = (
|
|
8980
|
-
const { promise, resolve:
|
|
8981
|
-
const socket = createConnection2({ host: displayHost(
|
|
9247
|
+
var displayHost = (host2) => host2 === "0.0.0.0" || host2 === "::" ? "localhost" : host2, probePort = (host2, port) => {
|
|
9248
|
+
const { promise, resolve: resolve24 } = Promise.withResolvers();
|
|
9249
|
+
const socket = createConnection2({ host: displayHost(host2), port });
|
|
8982
9250
|
const timeout = setTimeout(() => {
|
|
8983
9251
|
socket.destroy();
|
|
8984
|
-
|
|
9252
|
+
resolve24(false);
|
|
8985
9253
|
}, INSTANCE_PROBE_TIMEOUT_MS);
|
|
8986
9254
|
socket.once("connect", () => {
|
|
8987
9255
|
clearTimeout(timeout);
|
|
8988
9256
|
socket.end();
|
|
8989
|
-
|
|
9257
|
+
resolve24(true);
|
|
8990
9258
|
});
|
|
8991
9259
|
socket.once("error", () => {
|
|
8992
9260
|
clearTimeout(timeout);
|
|
8993
9261
|
socket.destroy();
|
|
8994
|
-
|
|
9262
|
+
resolve24(false);
|
|
8995
9263
|
});
|
|
8996
9264
|
return promise;
|
|
8997
9265
|
}, probeStatus = async (record) => {
|
|
@@ -9703,9 +9971,9 @@ var exports_heapDiff = {};
|
|
|
9703
9971
|
__export(exports_heapDiff, {
|
|
9704
9972
|
runHeapDiff: () => runHeapDiff
|
|
9705
9973
|
});
|
|
9706
|
-
import { existsSync as existsSync17, readFileSync as
|
|
9974
|
+
import { existsSync as existsSync17, readFileSync as readFileSync19 } from "fs";
|
|
9707
9975
|
var TOP = 15, STRING_TYPES, aggregate = (path) => {
|
|
9708
|
-
const data = JSON.parse(
|
|
9976
|
+
const data = JSON.parse(readFileSync19(path, "utf-8"));
|
|
9709
9977
|
const { nodes, strings } = data;
|
|
9710
9978
|
const { node_fields: fields, node_types: nodeTypes } = data.snapshot.meta;
|
|
9711
9979
|
const [typeNames] = nodeTypes;
|
|
@@ -9857,14 +10125,14 @@ import ts5 from "typescript";
|
|
|
9857
10125
|
import {
|
|
9858
10126
|
existsSync as existsSync18,
|
|
9859
10127
|
mkdirSync as mkdirSync9,
|
|
9860
|
-
readFileSync as
|
|
10128
|
+
readFileSync as readFileSync20,
|
|
9861
10129
|
statSync as statSync2,
|
|
9862
10130
|
writeFileSync as writeFileSync8
|
|
9863
10131
|
} from "fs";
|
|
9864
|
-
import { resolve as
|
|
10132
|
+
import { resolve as resolve24 } from "path";
|
|
9865
10133
|
var VIRTUAL_NAME = "__absolute_type_introspect__.ts", MAX_DEPTH = 6, isFrameworkRepo = (cwd) => {
|
|
9866
10134
|
try {
|
|
9867
|
-
const pkg = JSON.parse(
|
|
10135
|
+
const pkg = JSON.parse(readFileSync20(resolve24(cwd, "package.json"), "utf-8"));
|
|
9868
10136
|
return pkg?.name === "@absolutejs/absolute";
|
|
9869
10137
|
} catch {
|
|
9870
10138
|
return false;
|
|
@@ -9885,14 +10153,14 @@ var VIRTUAL_NAME = "__absolute_type_introspect__.ts", MAX_DEPTH = 6, isFramework
|
|
|
9885
10153
|
};
|
|
9886
10154
|
}, SCHEMA_VERSION = 1, packageVersion = (cwd, specifier) => {
|
|
9887
10155
|
const candidates = specifier === "@absolutejs/absolute" ? [
|
|
9888
|
-
|
|
9889
|
-
|
|
10156
|
+
resolve24(cwd, "node_modules", "@absolutejs", "absolute", "package.json"),
|
|
10157
|
+
resolve24(cwd, "package.json")
|
|
9890
10158
|
] : [
|
|
9891
|
-
|
|
10159
|
+
resolve24(cwd, "node_modules", ...specifier.split("/"), "package.json")
|
|
9892
10160
|
];
|
|
9893
10161
|
for (const candidate of candidates) {
|
|
9894
10162
|
try {
|
|
9895
|
-
const { version: version2 } = JSON.parse(
|
|
10163
|
+
const { version: version2 } = JSON.parse(readFileSync20(candidate, "utf-8"));
|
|
9896
10164
|
if (typeof version2 === "string")
|
|
9897
10165
|
return version2;
|
|
9898
10166
|
} catch {}
|
|
@@ -9903,16 +10171,16 @@ var VIRTUAL_NAME = "__absolute_type_introspect__.ts", MAX_DEPTH = 6, isFramework
|
|
|
9903
10171
|
if (local) {
|
|
9904
10172
|
const file = typeName === "PackageJson" ? "packageJson.ts" : "build.ts";
|
|
9905
10173
|
try {
|
|
9906
|
-
signature += `:${statSync2(
|
|
10174
|
+
signature += `:${statSync2(resolve24(cwd, "types", file)).mtimeMs}`;
|
|
9907
10175
|
} catch {}
|
|
9908
10176
|
}
|
|
9909
10177
|
return signature;
|
|
9910
10178
|
}, cacheSlug = (specifier) => specifier.replace("@", "").split("/").join("-"), cacheFile = (cwd, typeName, specifier) => {
|
|
9911
10179
|
const name = specifier === "@absolutejs/absolute" ? typeName : `${typeName}.${cacheSlug(specifier)}`;
|
|
9912
|
-
return
|
|
10180
|
+
return resolve24(cwd, ".absolutejs", "config-schema", `${name}.json`);
|
|
9913
10181
|
}, readDiskCache = (cwd, typeName, signature, specifier) => {
|
|
9914
10182
|
try {
|
|
9915
|
-
const cached = JSON.parse(
|
|
10183
|
+
const cached = JSON.parse(readFileSync20(cacheFile(cwd, typeName, specifier), "utf-8"));
|
|
9916
10184
|
if (isRecord9(cached) && cached.signature === signature && Array.isArray(cached.fields)) {
|
|
9917
10185
|
return cached.fields;
|
|
9918
10186
|
}
|
|
@@ -9920,7 +10188,7 @@ var VIRTUAL_NAME = "__absolute_type_introspect__.ts", MAX_DEPTH = 6, isFramework
|
|
|
9920
10188
|
return null;
|
|
9921
10189
|
}, writeDiskCache = (cwd, typeName, signature, fields, specifier) => {
|
|
9922
10190
|
try {
|
|
9923
|
-
mkdirSync9(
|
|
10191
|
+
mkdirSync9(resolve24(cwd, ".absolutejs", "config-schema"), {
|
|
9924
10192
|
recursive: true
|
|
9925
10193
|
});
|
|
9926
10194
|
writeFileSync8(cacheFile(cwd, typeName, specifier), JSON.stringify({ fields, signature }));
|
|
@@ -10007,19 +10275,19 @@ var VIRTUAL_NAME = "__absolute_type_introspect__.ts", MAX_DEPTH = 6, isFramework
|
|
|
10007
10275
|
}
|
|
10008
10276
|
return opaque();
|
|
10009
10277
|
}, introspectFrom = (cwd, specifier, typeName, options, exclude) => {
|
|
10010
|
-
const virtualPath =
|
|
10278
|
+
const virtualPath = resolve24(cwd, VIRTUAL_NAME);
|
|
10011
10279
|
const source = `import type { ${typeName} } from '${specifier}';
|
|
10012
10280
|
declare const value: ${typeName};
|
|
10013
10281
|
export { value };
|
|
10014
10282
|
`;
|
|
10015
|
-
const
|
|
10016
|
-
const getSourceFile =
|
|
10017
|
-
|
|
10018
|
-
const fileExists =
|
|
10019
|
-
|
|
10020
|
-
const readFile11 =
|
|
10021
|
-
|
|
10022
|
-
const program = ts5.createProgram([virtualPath], options,
|
|
10283
|
+
const host2 = ts5.createCompilerHost(options, true);
|
|
10284
|
+
const getSourceFile = host2.getSourceFile.bind(host2);
|
|
10285
|
+
host2.getSourceFile = (fileName, languageVersion, onError, shouldCreate) => fileName === virtualPath ? ts5.createSourceFile(fileName, source, languageVersion, true) : getSourceFile(fileName, languageVersion, onError, shouldCreate);
|
|
10286
|
+
const fileExists = host2.fileExists.bind(host2);
|
|
10287
|
+
host2.fileExists = (fileName) => fileName === virtualPath ? true : fileExists(fileName);
|
|
10288
|
+
const readFile11 = host2.readFile.bind(host2);
|
|
10289
|
+
host2.readFile = (fileName) => fileName === virtualPath ? source : readFile11(fileName);
|
|
10290
|
+
const program = ts5.createProgram([virtualPath], options, host2);
|
|
10023
10291
|
const checker = program.getTypeChecker();
|
|
10024
10292
|
const sourceFile = program.getSourceFile(virtualPath);
|
|
10025
10293
|
if (!sourceFile)
|
|
@@ -10050,7 +10318,7 @@ export { value };
|
|
|
10050
10318
|
const cached = cache.get(cacheKey);
|
|
10051
10319
|
if (cached)
|
|
10052
10320
|
return cached;
|
|
10053
|
-
const local = specifier === "@absolutejs/absolute" && isFrameworkRepo(cwd) && existsSync18(
|
|
10321
|
+
const local = specifier === "@absolutejs/absolute" && isFrameworkRepo(cwd) && existsSync18(resolve24(cwd, "types/index.ts"));
|
|
10054
10322
|
const signature = cacheSignature(cwd, typeName, local, specifier);
|
|
10055
10323
|
const fromDisk = readDiskCache(cwd, typeName, signature, specifier);
|
|
10056
10324
|
if (fromDisk) {
|
|
@@ -10078,15 +10346,15 @@ var init_fromType = __esm(() => {
|
|
|
10078
10346
|
|
|
10079
10347
|
// src/cli/config/absolute/resolveAbsoluteConfig.ts
|
|
10080
10348
|
import ts6 from "typescript";
|
|
10081
|
-
import { existsSync as existsSync19, readFileSync as
|
|
10082
|
-
import { resolve as
|
|
10349
|
+
import { existsSync as existsSync19, readFileSync as readFileSync21 } from "fs";
|
|
10350
|
+
import { resolve as resolve25 } from "path";
|
|
10083
10351
|
var CONFIG_CANDIDATES2, RUNTIME_FIELDS, findConfigPath = (cwd, override) => {
|
|
10084
10352
|
if (override) {
|
|
10085
|
-
const resolved =
|
|
10353
|
+
const resolved = resolve25(cwd, override);
|
|
10086
10354
|
return existsSync19(resolved) ? resolved : null;
|
|
10087
10355
|
}
|
|
10088
10356
|
for (const name of CONFIG_CANDIDATES2) {
|
|
10089
|
-
const candidate =
|
|
10357
|
+
const candidate = resolve25(cwd, name);
|
|
10090
10358
|
if (existsSync19(candidate))
|
|
10091
10359
|
return candidate;
|
|
10092
10360
|
}
|
|
@@ -10108,7 +10376,7 @@ var CONFIG_CANDIDATES2, RUNTIME_FIELDS, findConfigPath = (cwd, override) => {
|
|
|
10108
10376
|
}
|
|
10109
10377
|
return null;
|
|
10110
10378
|
}, parseConfigObject = (configPath2) => {
|
|
10111
|
-
const text =
|
|
10379
|
+
const text = readFileSync21(configPath2, "utf-8");
|
|
10112
10380
|
return { object: findConfigObject(parseSource(configPath2, text)), text };
|
|
10113
10381
|
}, evalLiteral = (node) => {
|
|
10114
10382
|
if (ts6.isStringLiteralLike(node)) {
|
|
@@ -10140,7 +10408,7 @@ var CONFIG_CANDIDATES2, RUNTIME_FIELDS, findConfigPath = (cwd, override) => {
|
|
|
10140
10408
|
return { opaque: false, value: items };
|
|
10141
10409
|
}
|
|
10142
10410
|
if (ts6.isObjectLiteralExpression(node)) {
|
|
10143
|
-
const
|
|
10411
|
+
const object2 = {};
|
|
10144
10412
|
for (const property of node.properties) {
|
|
10145
10413
|
if (!ts6.isPropertyAssignment(property) || !(ts6.isIdentifier(property.name) || ts6.isStringLiteral(property.name))) {
|
|
10146
10414
|
return { opaque: true, value: undefined };
|
|
@@ -10148,18 +10416,18 @@ var CONFIG_CANDIDATES2, RUNTIME_FIELDS, findConfigPath = (cwd, override) => {
|
|
|
10148
10416
|
const result = evalLiteral(property.initializer);
|
|
10149
10417
|
if (result.opaque)
|
|
10150
10418
|
return { opaque: true, value: undefined };
|
|
10151
|
-
|
|
10419
|
+
object2[property.name.text] = result.value;
|
|
10152
10420
|
}
|
|
10153
|
-
return { opaque: false, value:
|
|
10421
|
+
return { opaque: false, value: object2 };
|
|
10154
10422
|
}
|
|
10155
10423
|
return { opaque: true, value: undefined };
|
|
10156
10424
|
}, readCurrent = (configPath2) => {
|
|
10157
10425
|
const current = {};
|
|
10158
10426
|
const opaqueKeys = [];
|
|
10159
|
-
const { object } = parseConfigObject(configPath2);
|
|
10160
|
-
if (!
|
|
10427
|
+
const { object: object2 } = parseConfigObject(configPath2);
|
|
10428
|
+
if (!object2)
|
|
10161
10429
|
return { current, opaqueKeys };
|
|
10162
|
-
for (const property of
|
|
10430
|
+
for (const property of object2.properties) {
|
|
10163
10431
|
if (!ts6.isPropertyAssignment(property) || !(ts6.isIdentifier(property.name) || ts6.isStringLiteral(property.name))) {
|
|
10164
10432
|
continue;
|
|
10165
10433
|
}
|
|
@@ -10319,8 +10587,8 @@ var init_frameworks = __esm(() => {
|
|
|
10319
10587
|
});
|
|
10320
10588
|
|
|
10321
10589
|
// src/cli/generate/context.ts
|
|
10322
|
-
import { dirname as
|
|
10323
|
-
var asString = (value) => typeof value === "string" ? value : undefined, isRecord10 = (value) => typeof value === "object" && value !== null, resolveDir = (cwd, value) => isAbsolute5(value) ? value :
|
|
10590
|
+
import { dirname as dirname16, isAbsolute as isAbsolute5, join as join26, relative as relative14, resolve as resolve26 } from "path";
|
|
10591
|
+
var asString = (value) => typeof value === "string" ? value : undefined, isRecord10 = (value) => typeof value === "object" && value !== null, resolveDir = (cwd, value) => isAbsolute5(value) ? value : resolve26(cwd, value), resolveStylesDir = (cwd, config) => {
|
|
10324
10592
|
const styles = config.stylesConfig;
|
|
10325
10593
|
if (typeof styles === "string")
|
|
10326
10594
|
return resolveDir(cwd, styles);
|
|
@@ -10329,10 +10597,10 @@ var asString = (value) => typeof value === "string" ? value : undefined, isRecor
|
|
|
10329
10597
|
if (indexes)
|
|
10330
10598
|
return resolveDir(cwd, indexes);
|
|
10331
10599
|
}
|
|
10332
|
-
return
|
|
10600
|
+
return resolve26(cwd, "src/frontend/styles/indexes");
|
|
10333
10601
|
}, configuredFrameworks = (project) => FRAMEWORK_KEYS2.filter((key) => project.frameworkDirs[key] !== undefined), frontendRootFor = (project, framework) => {
|
|
10334
10602
|
const dir = project.frameworkDirs[framework];
|
|
10335
|
-
return dir ?
|
|
10603
|
+
return dir ? dirname16(dir) : resolve26(project.cwd, "src/frontend");
|
|
10336
10604
|
}, resolveProject = async (cwd, configOverride) => {
|
|
10337
10605
|
const loaded = await loadConfig(configOverride);
|
|
10338
10606
|
const config = isRecord10(loaded) ? loaded : {};
|
|
@@ -10382,7 +10650,7 @@ var asString = (value) => typeof value === "string" ? value : undefined, isRecor
|
|
|
10382
10650
|
message: `Multiple frameworks configured (${configured.join(", ")}). Pass --framework <name>.`,
|
|
10383
10651
|
ok: false
|
|
10384
10652
|
};
|
|
10385
|
-
}, sharedDirFor = (project, framework) =>
|
|
10653
|
+
}, sharedDirFor = (project, framework) => join26(frontendRootFor(project, framework), "shared"), toModuleSpecifier = (fromDir, toFileNoExt) => {
|
|
10386
10654
|
const rel = relative14(fromDir, toFileNoExt).split("\\").join("/");
|
|
10387
10655
|
return rel.startsWith(".") ? rel : `./${rel}`;
|
|
10388
10656
|
};
|
|
@@ -10411,8 +10679,8 @@ var emptyOutcome = () => ({
|
|
|
10411
10679
|
|
|
10412
10680
|
// src/cli/generate/routeWiring.ts
|
|
10413
10681
|
import ts7 from "typescript";
|
|
10414
|
-
import { existsSync as existsSync20, readFileSync as
|
|
10415
|
-
import { dirname as
|
|
10682
|
+
import { existsSync as existsSync20, readFileSync as readFileSync22, readdirSync as readdirSync4, writeFileSync as writeFileSync9 } from "fs";
|
|
10683
|
+
import { dirname as dirname17, join as join27 } from "path";
|
|
10416
10684
|
var DEFAULT_SEPARATOR = `
|
|
10417
10685
|
`, BOUNDARY_USE, applyEdits = (text, edits) => {
|
|
10418
10686
|
const ordered = [...edits].sort((first, second) => second.start - first.start);
|
|
@@ -10562,7 +10830,7 @@ ${newLines.join(`
|
|
|
10562
10830
|
}, hasChain = (path) => {
|
|
10563
10831
|
if (!existsSync20(path))
|
|
10564
10832
|
return false;
|
|
10565
|
-
const sourceFile = parse2(path,
|
|
10833
|
+
const sourceFile = parse2(path, readFileSync22(path, "utf-8"));
|
|
10566
10834
|
const found = findElysiaNew(sourceFile);
|
|
10567
10835
|
return found !== null;
|
|
10568
10836
|
}, firstChainFile = (pluginsDir) => {
|
|
@@ -10571,14 +10839,14 @@ ${newLines.join(`
|
|
|
10571
10839
|
for (const name of readdirSync4(pluginsDir)) {
|
|
10572
10840
|
if (!name.endsWith(".ts"))
|
|
10573
10841
|
continue;
|
|
10574
|
-
const candidate =
|
|
10842
|
+
const candidate = join27(pluginsDir, name);
|
|
10575
10843
|
if (hasChain(candidate))
|
|
10576
10844
|
return candidate;
|
|
10577
10845
|
}
|
|
10578
10846
|
return null;
|
|
10579
10847
|
}, findRoutingFile = (serverEntry) => {
|
|
10580
|
-
const pluginsDir =
|
|
10581
|
-
const preferred =
|
|
10848
|
+
const pluginsDir = join27(dirname17(serverEntry), "plugins");
|
|
10849
|
+
const preferred = join27(pluginsDir, "pagesPlugin.ts");
|
|
10582
10850
|
if (hasChain(preferred))
|
|
10583
10851
|
return preferred;
|
|
10584
10852
|
const scanned = firstChainFile(pluginsDir);
|
|
@@ -10588,7 +10856,7 @@ ${newLines.join(`
|
|
|
10588
10856
|
return serverEntry;
|
|
10589
10857
|
return null;
|
|
10590
10858
|
}, buildRouteContext = (input, routingFile) => {
|
|
10591
|
-
const specifier = `${toModuleSpecifier(
|
|
10859
|
+
const specifier = `${toModuleSpecifier(dirname17(routingFile), stripExtension(input.pageFileAbs))}${input.def.pageImportExtension ?? ""}`;
|
|
10592
10860
|
return {
|
|
10593
10861
|
cssAssetKey: input.cssAssetKey,
|
|
10594
10862
|
indexKey: input.indexKey,
|
|
@@ -10611,7 +10879,7 @@ ${newLines.join(`
|
|
|
10611
10879
|
};
|
|
10612
10880
|
if (!hasChain(serverEntry))
|
|
10613
10881
|
return fallback;
|
|
10614
|
-
const text =
|
|
10882
|
+
const text = readFileSync22(serverEntry, "utf-8");
|
|
10615
10883
|
const sourceFile = parse2(serverEntry, text);
|
|
10616
10884
|
const newExpr = findElysiaNew(sourceFile);
|
|
10617
10885
|
if (!newExpr)
|
|
@@ -10640,7 +10908,7 @@ ${newLines.join(`
|
|
|
10640
10908
|
${routeExpr}`
|
|
10641
10909
|
};
|
|
10642
10910
|
}
|
|
10643
|
-
const text =
|
|
10911
|
+
const text = readFileSync22(routingFile, "utf-8");
|
|
10644
10912
|
const sourceFile = parse2(routingFile, text);
|
|
10645
10913
|
const newExpr = findElysiaNew(sourceFile);
|
|
10646
10914
|
if (!newExpr) {
|
|
@@ -10670,7 +10938,7 @@ var init_routeWiring = __esm(() => {
|
|
|
10670
10938
|
|
|
10671
10939
|
// src/cli/generate/generateApi.ts
|
|
10672
10940
|
import { existsSync as existsSync21, mkdirSync as mkdirSync10, writeFileSync as writeFileSync10 } from "fs";
|
|
10673
|
-
import { dirname as
|
|
10941
|
+
import { dirname as dirname18, join as join28 } from "path";
|
|
10674
10942
|
var apiPluginTemplate = (pluginName, base) => `import { Elysia } from 'elysia';
|
|
10675
10943
|
|
|
10676
10944
|
export const ${pluginName} = new Elysia()
|
|
@@ -10682,8 +10950,8 @@ export const ${pluginName} = new Elysia()
|
|
|
10682
10950
|
const pluginName = `${camel}Plugin`;
|
|
10683
10951
|
const base = `/api/${kebab}`;
|
|
10684
10952
|
const outcome = { ...emptyOutcome(), route: base };
|
|
10685
|
-
const pluginsDir =
|
|
10686
|
-
const fileAbs =
|
|
10953
|
+
const pluginsDir = join28(dirname18(project.serverEntry), "plugins");
|
|
10954
|
+
const fileAbs = join28(pluginsDir, `${pluginName}.ts`);
|
|
10687
10955
|
if (existsSync21(fileAbs)) {
|
|
10688
10956
|
outcome.notes.push(`${pluginName} already exists at ${fileAbs} \u2014 skipped.`);
|
|
10689
10957
|
return outcome;
|
|
@@ -10691,7 +10959,7 @@ export const ${pluginName} = new Elysia()
|
|
|
10691
10959
|
mkdirSync10(pluginsDir, { recursive: true });
|
|
10692
10960
|
writeFileSync10(fileAbs, apiPluginTemplate(pluginName, base), "utf-8");
|
|
10693
10961
|
outcome.created.push(fileAbs);
|
|
10694
|
-
const specifier = toModuleSpecifier(
|
|
10962
|
+
const specifier = toModuleSpecifier(dirname18(project.serverEntry), fileAbs.replace(/\.ts$/, ""));
|
|
10695
10963
|
const wired = wirePluginUse(project.serverEntry, pluginName, specifier);
|
|
10696
10964
|
if (wired.kind === "edited")
|
|
10697
10965
|
outcome.updated.push(wired.routingFile);
|
|
@@ -10758,7 +11026,7 @@ var init_componentTemplates = __esm(() => {
|
|
|
10758
11026
|
|
|
10759
11027
|
// src/cli/generate/generateComponent.ts
|
|
10760
11028
|
import { existsSync as existsSync22, mkdirSync as mkdirSync11, writeFileSync as writeFileSync11 } from "fs";
|
|
10761
|
-
import { dirname as
|
|
11029
|
+
import { dirname as dirname19, join as join29 } from "path";
|
|
10762
11030
|
var generateComponent = (project, framework, rawName) => {
|
|
10763
11031
|
const def = frameworks6[framework];
|
|
10764
11032
|
const pascal = toPascalCase(rawName);
|
|
@@ -10769,12 +11037,12 @@ var generateComponent = (project, framework, rawName) => {
|
|
|
10769
11037
|
outcome.manual = { reason: "framework directory missing", snippet: "" };
|
|
10770
11038
|
return outcome;
|
|
10771
11039
|
}
|
|
10772
|
-
const fileAbs =
|
|
11040
|
+
const fileAbs = join29(frameworkDir, "components", def.componentFile({ kebab, pascal }));
|
|
10773
11041
|
if (existsSync22(fileAbs)) {
|
|
10774
11042
|
outcome.notes.push(`${pascal} already exists at ${fileAbs} \u2014 skipped.`);
|
|
10775
11043
|
return outcome;
|
|
10776
11044
|
}
|
|
10777
|
-
mkdirSync11(
|
|
11045
|
+
mkdirSync11(dirname19(fileAbs), { recursive: true });
|
|
10778
11046
|
writeFileSync11(fileAbs, componentTemplates[framework]({
|
|
10779
11047
|
kebab,
|
|
10780
11048
|
pascal,
|
|
@@ -10791,7 +11059,7 @@ var init_generateComponent = __esm(() => {
|
|
|
10791
11059
|
// src/cli/generate/cssStrategy.ts
|
|
10792
11060
|
import ts8 from "typescript";
|
|
10793
11061
|
import { existsSync as existsSync23 } from "fs";
|
|
10794
|
-
import { join as
|
|
11062
|
+
import { join as join30 } from "path";
|
|
10795
11063
|
var CSS_SUFFIX = "CSS", SHARED_MIN_USES = 2, DEFAULT_CSS = `main {
|
|
10796
11064
|
margin: 0 auto;
|
|
10797
11065
|
max-width: 64rem;
|
|
@@ -10830,7 +11098,7 @@ var CSS_SUFFIX = "CSS", SHARED_MIN_USES = 2, DEFAULT_CSS = `main {
|
|
|
10830
11098
|
return null;
|
|
10831
11099
|
}, fileForKey = (stylesDir, assetKey2) => {
|
|
10832
11100
|
const base = assetKey2.endsWith(CSS_SUFFIX) ? assetKey2.slice(0, -CSS_SUFFIX.length) : assetKey2;
|
|
10833
|
-
return
|
|
11101
|
+
return join30(stylesDir, `${toKebabCase(base)}.css`);
|
|
10834
11102
|
}, planCss = (routingText, stylesDir, pascal, kebab) => {
|
|
10835
11103
|
const sharedKey = detectSharedKey(routingText);
|
|
10836
11104
|
if (sharedKey) {
|
|
@@ -10843,7 +11111,7 @@ var CSS_SUFFIX = "CSS", SHARED_MIN_USES = 2, DEFAULT_CSS = `main {
|
|
|
10843
11111
|
shared: true
|
|
10844
11112
|
};
|
|
10845
11113
|
}
|
|
10846
|
-
const cssFileAbs =
|
|
11114
|
+
const cssFileAbs = join30(stylesDir, `${kebab}.css`);
|
|
10847
11115
|
return {
|
|
10848
11116
|
assetKey: `${pascal}${CSS_SUFFIX}`,
|
|
10849
11117
|
contents: DEFAULT_CSS,
|
|
@@ -10856,8 +11124,8 @@ var init_cssStrategy = () => {};
|
|
|
10856
11124
|
|
|
10857
11125
|
// src/cli/generate/navData.ts
|
|
10858
11126
|
import ts9 from "typescript";
|
|
10859
|
-
import { existsSync as existsSync24, mkdirSync as mkdirSync12, readFileSync as
|
|
10860
|
-
import { dirname as
|
|
11127
|
+
import { existsSync as existsSync24, mkdirSync as mkdirSync12, readFileSync as readFileSync23, writeFileSync as writeFileSync12 } from "fs";
|
|
11128
|
+
import { dirname as dirname20 } from "path";
|
|
10861
11129
|
var NAV_DATA_TEMPLATE = `type NavItem = {
|
|
10862
11130
|
href: string;
|
|
10863
11131
|
label: string;
|
|
@@ -10877,8 +11145,8 @@ export const navData: NavItem[] = [];
|
|
|
10877
11145
|
};
|
|
10878
11146
|
visit(sourceFile);
|
|
10879
11147
|
return found;
|
|
10880
|
-
}, readStringProperty = (
|
|
10881
|
-
const property =
|
|
11148
|
+
}, readStringProperty = (object2, name) => {
|
|
11149
|
+
const property = object2.properties.find((candidate) => ts9.isPropertyAssignment(candidate) && ts9.isIdentifier(candidate.name) && candidate.name.text === name);
|
|
10882
11150
|
if (!property || !ts9.isStringLiteralLike(property.initializer)) {
|
|
10883
11151
|
return null;
|
|
10884
11152
|
}
|
|
@@ -10897,7 +11165,7 @@ export const navData: NavItem[] = [];
|
|
|
10897
11165
|
}, readNavItems = (navDataPath) => {
|
|
10898
11166
|
if (!existsSync24(navDataPath))
|
|
10899
11167
|
return [];
|
|
10900
|
-
const text =
|
|
11168
|
+
const text = readFileSync23(navDataPath, "utf-8");
|
|
10901
11169
|
const sourceFile = ts9.createSourceFile(navDataPath, text, ts9.ScriptTarget.Latest, true);
|
|
10902
11170
|
const array = findNavArray(sourceFile);
|
|
10903
11171
|
return array ? parseNavItems(array) : [];
|
|
@@ -10934,14 +11202,14 @@ ${indent}${entry}`;
|
|
|
10934
11202
|
}, upsertNavItem = (navDataPath, item) => {
|
|
10935
11203
|
const created = !existsSync24(navDataPath);
|
|
10936
11204
|
if (created) {
|
|
10937
|
-
mkdirSync12(
|
|
11205
|
+
mkdirSync12(dirname20(navDataPath), { recursive: true });
|
|
10938
11206
|
writeFileSync12(navDataPath, NAV_DATA_TEMPLATE, "utf-8");
|
|
10939
11207
|
}
|
|
10940
11208
|
const existing = readNavItems(navDataPath);
|
|
10941
11209
|
if (existing.some((candidate) => candidate.href === item.href)) {
|
|
10942
11210
|
return { changed: created, created, items: existing };
|
|
10943
11211
|
}
|
|
10944
|
-
const text =
|
|
11212
|
+
const text = readFileSync23(navDataPath, "utf-8");
|
|
10945
11213
|
const sourceFile = ts9.createSourceFile(navDataPath, text, ts9.ScriptTarget.Latest, true);
|
|
10946
11214
|
const array = findNavArray(sourceFile);
|
|
10947
11215
|
if (!array)
|
|
@@ -11100,19 +11368,19 @@ var init_pageTemplates = __esm(() => {
|
|
|
11100
11368
|
import {
|
|
11101
11369
|
existsSync as existsSync25,
|
|
11102
11370
|
mkdirSync as mkdirSync13,
|
|
11103
|
-
readFileSync as
|
|
11371
|
+
readFileSync as readFileSync24,
|
|
11104
11372
|
readdirSync as readdirSync5,
|
|
11105
11373
|
writeFileSync as writeFileSync13
|
|
11106
11374
|
} from "fs";
|
|
11107
|
-
import { dirname as
|
|
11375
|
+
import { dirname as dirname21, join as join31, relative as relative15 } from "path";
|
|
11108
11376
|
var writeNew = (path, contents) => {
|
|
11109
|
-
mkdirSync13(
|
|
11377
|
+
mkdirSync13(dirname21(path), { recursive: true });
|
|
11110
11378
|
writeFileSync13(path, contents, "utf-8");
|
|
11111
11379
|
}, toHref = (fromDir, toFile) => {
|
|
11112
11380
|
const rel = relative15(fromDir, toFile).split("\\").join("/");
|
|
11113
11381
|
return rel.startsWith(".") ? rel : `./${rel}`;
|
|
11114
|
-
}, staticPageFiles = (project) => ["html", "htmx"].map((key) => project.frameworkDirs[key]).map((dir) => dir ?
|
|
11115
|
-
const html =
|
|
11382
|
+
}, staticPageFiles = (project) => ["html", "htmx"].map((key) => project.frameworkDirs[key]).map((dir) => dir ? join31(dir, "pages") : null).filter((pagesDir) => pagesDir !== null && existsSync25(pagesDir)).flatMap((pagesDir) => readdirSync5(pagesDir).filter((name) => name.endsWith(".html")).map((name) => join31(pagesDir, name))), resyncPage = (file, items) => {
|
|
11383
|
+
const html = readFileSync24(file, "utf-8");
|
|
11116
11384
|
const synced = syncStaticNav(html, items);
|
|
11117
11385
|
if (synced === null || synced === html)
|
|
11118
11386
|
return false;
|
|
@@ -11139,19 +11407,19 @@ var writeNew = (path, contents) => {
|
|
|
11139
11407
|
outcome.manual = { reason: "framework directory missing", snippet: "" };
|
|
11140
11408
|
return outcome;
|
|
11141
11409
|
}
|
|
11142
|
-
const pageFileAbs =
|
|
11410
|
+
const pageFileAbs = join31(frameworkDir, "pages", def.pageFile({ kebab, pascal }));
|
|
11143
11411
|
if (existsSync25(pageFileAbs)) {
|
|
11144
11412
|
outcome.notes.push(`${pascal} already exists at ${pageFileAbs} \u2014 skipped.`);
|
|
11145
11413
|
return outcome;
|
|
11146
11414
|
}
|
|
11147
11415
|
const routingFile = findRoutingFile(project.serverEntry);
|
|
11148
|
-
const routingText = routingFile ?
|
|
11416
|
+
const routingText = routingFile ? readFileSync24(routingFile, "utf-8") : "";
|
|
11149
11417
|
const css = planCss(routingText, project.stylesDir, pascal, kebab);
|
|
11150
|
-
const navDataPath =
|
|
11418
|
+
const navDataPath = join31(sharedDirFor(project, framework), "navData.ts");
|
|
11151
11419
|
const nav = upsertNavItem(navDataPath, { href: route, label: title });
|
|
11152
|
-
const navImportPath = toModuleSpecifier(
|
|
11420
|
+
const navImportPath = toModuleSpecifier(dirname21(pageFileAbs), navDataPath.replace(/\.ts$/, ""));
|
|
11153
11421
|
writeNew(pageFileAbs, pageTemplates[framework]({
|
|
11154
|
-
cssHref: toHref(
|
|
11422
|
+
cssHref: toHref(dirname21(pageFileAbs), css.cssFileAbs),
|
|
11155
11423
|
kebab,
|
|
11156
11424
|
navImportPath,
|
|
11157
11425
|
navItems: nav.items,
|
|
@@ -11334,25 +11602,25 @@ var init_serialize = () => {};
|
|
|
11334
11602
|
|
|
11335
11603
|
// src/cli/config/absolute/editAbsoluteConfig.ts
|
|
11336
11604
|
import ts10 from "typescript";
|
|
11337
|
-
import { readFileSync as
|
|
11605
|
+
import { readFileSync as readFileSync25, writeFileSync as writeFileSync14 } from "fs";
|
|
11338
11606
|
var lineStartOffset = (text, position) => {
|
|
11339
11607
|
let index = position;
|
|
11340
11608
|
while (index > 0 && text[index - 1] !== `
|
|
11341
11609
|
`)
|
|
11342
11610
|
index -= 1;
|
|
11343
11611
|
return index;
|
|
11344
|
-
}, indentBefore2 = (text, position) => text.slice(lineStartOffset(text, position), position), findProperty = (
|
|
11612
|
+
}, indentBefore2 = (text, position) => text.slice(lineStartOffset(text, position), position), findProperty = (object2, name) => object2.properties.find((property) => ts10.isPropertyAssignment(property) && (ts10.isIdentifier(property.name) || ts10.isStringLiteral(property.name)) && property.name.text === name), applyAbsoluteConfigEdit = (configPath2, request) => {
|
|
11345
11613
|
try {
|
|
11346
|
-
const text =
|
|
11614
|
+
const text = readFileSync25(configPath2, "utf-8");
|
|
11347
11615
|
const sourceFile = ts10.createSourceFile(configPath2, text, ts10.ScriptTarget.Latest, true);
|
|
11348
|
-
const
|
|
11349
|
-
if (!
|
|
11616
|
+
const object2 = findConfigObject(sourceFile);
|
|
11617
|
+
if (!object2) {
|
|
11350
11618
|
return {
|
|
11351
11619
|
message: "Could not find defineConfig({ ... }) in the config file.",
|
|
11352
11620
|
ok: false
|
|
11353
11621
|
};
|
|
11354
11622
|
}
|
|
11355
|
-
const existing = findProperty(
|
|
11623
|
+
const existing = findProperty(object2, request.name);
|
|
11356
11624
|
if (request.remove) {
|
|
11357
11625
|
if (!existing)
|
|
11358
11626
|
return { message: `${request.name} is not set`, ok: true };
|
|
@@ -11373,7 +11641,7 @@ var lineStartOffset = (text, position) => {
|
|
|
11373
11641
|
writeFileSync14(configPath2, text.slice(0, start2) + valueText + text.slice(end), "utf-8");
|
|
11374
11642
|
return { message: `Updated ${request.name}`, ok: true };
|
|
11375
11643
|
}
|
|
11376
|
-
const { properties } =
|
|
11644
|
+
const { properties } = object2;
|
|
11377
11645
|
const entry = `${request.name}: ${valueText}`;
|
|
11378
11646
|
if (properties.length > 0) {
|
|
11379
11647
|
const last = properties[properties.length - 1];
|
|
@@ -11392,11 +11660,11 @@ var lineStartOffset = (text, position) => {
|
|
|
11392
11660
|
${indent}${entry}`;
|
|
11393
11661
|
writeFileSync14(configPath2, text.slice(0, insertionIndex) + insertion + text.slice(insertionIndex), "utf-8");
|
|
11394
11662
|
} else {
|
|
11395
|
-
const insertionIndex =
|
|
11396
|
-
const indent = `${indentBefore2(text,
|
|
11663
|
+
const insertionIndex = object2.getStart(sourceFile) + 1;
|
|
11664
|
+
const indent = `${indentBefore2(text, object2.getStart(sourceFile))} `;
|
|
11397
11665
|
const insertion = `
|
|
11398
11666
|
${indent}${entry}
|
|
11399
|
-
${indentBefore2(text,
|
|
11667
|
+
${indentBefore2(text, object2.getStart(sourceFile))}`;
|
|
11400
11668
|
writeFileSync14(configPath2, text.slice(0, insertionIndex) + insertion + text.slice(insertionIndex), "utf-8");
|
|
11401
11669
|
}
|
|
11402
11670
|
return { message: `Updated ${request.name}`, ok: true };
|
|
@@ -11526,14 +11794,14 @@ var init_catalog = __esm(() => {
|
|
|
11526
11794
|
});
|
|
11527
11795
|
|
|
11528
11796
|
// src/cli/integrations/addPlugin.ts
|
|
11529
|
-
import { existsSync as existsSync26, readFileSync as
|
|
11530
|
-
import { join as
|
|
11797
|
+
import { existsSync as existsSync26, readFileSync as readFileSync26 } from "fs";
|
|
11798
|
+
import { join as join32 } from "path";
|
|
11531
11799
|
var isRecord11 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), readPackageJson = (cwd) => {
|
|
11532
|
-
const path =
|
|
11800
|
+
const path = join32(cwd, "package.json");
|
|
11533
11801
|
if (!existsSync26(path))
|
|
11534
11802
|
return null;
|
|
11535
11803
|
try {
|
|
11536
|
-
const parsed = JSON.parse(
|
|
11804
|
+
const parsed = JSON.parse(readFileSync26(path, "utf-8"));
|
|
11537
11805
|
return isRecord11(parsed) ? parsed : null;
|
|
11538
11806
|
} catch {
|
|
11539
11807
|
return null;
|
|
@@ -12025,15 +12293,15 @@ var init_authCatalog = __esm(() => {
|
|
|
12025
12293
|
|
|
12026
12294
|
// src/cli/config/auth/resolveAuthSettings.ts
|
|
12027
12295
|
import ts11 from "typescript";
|
|
12028
|
-
import { existsSync as existsSync27, readFileSync as
|
|
12029
|
-
import { resolve as
|
|
12296
|
+
import { existsSync as existsSync27, readFileSync as readFileSync27 } from "fs";
|
|
12297
|
+
import { resolve as resolve27 } from "path";
|
|
12030
12298
|
var AUTH_PACKAGE = "@absolutejs/auth", CONFIG_CANDIDATES3, findAuthSettingsPath = (cwd, override) => {
|
|
12031
12299
|
if (override) {
|
|
12032
|
-
const resolved =
|
|
12300
|
+
const resolved = resolve27(cwd, override);
|
|
12033
12301
|
return existsSync27(resolved) ? resolved : null;
|
|
12034
12302
|
}
|
|
12035
12303
|
for (const name of CONFIG_CANDIDATES3) {
|
|
12036
|
-
const candidate =
|
|
12304
|
+
const candidate = resolve27(cwd, name);
|
|
12037
12305
|
if (existsSync27(candidate))
|
|
12038
12306
|
return candidate;
|
|
12039
12307
|
}
|
|
@@ -12055,7 +12323,7 @@ var AUTH_PACKAGE = "@absolutejs/auth", CONFIG_CANDIDATES3, findAuthSettingsPath
|
|
|
12055
12323
|
}
|
|
12056
12324
|
return null;
|
|
12057
12325
|
}, parseAuthSettingsObject = (configPath2) => {
|
|
12058
|
-
const text =
|
|
12326
|
+
const text = readFileSync27(configPath2, "utf-8");
|
|
12059
12327
|
return {
|
|
12060
12328
|
object: findAuthSettingsObject(parseSource2(configPath2, text)),
|
|
12061
12329
|
text
|
|
@@ -12092,10 +12360,10 @@ var AUTH_PACKAGE = "@absolutejs/auth", CONFIG_CANDIDATES3, findAuthSettingsPath
|
|
|
12092
12360
|
}, readCurrent2 = (configPath2) => {
|
|
12093
12361
|
const current = {};
|
|
12094
12362
|
const opaqueKeys = [];
|
|
12095
|
-
const { object } = parseAuthSettingsObject(configPath2);
|
|
12096
|
-
if (!
|
|
12363
|
+
const { object: object2 } = parseAuthSettingsObject(configPath2);
|
|
12364
|
+
if (!object2)
|
|
12097
12365
|
return { current, opaqueKeys };
|
|
12098
|
-
for (const property of
|
|
12366
|
+
for (const property of object2.properties) {
|
|
12099
12367
|
if (!ts11.isPropertyAssignment(property) || !(ts11.isIdentifier(property.name) || ts11.isStringLiteral(property.name))) {
|
|
12100
12368
|
continue;
|
|
12101
12369
|
}
|
|
@@ -12130,13 +12398,13 @@ var init_resolveAuthSettings = __esm(() => {
|
|
|
12130
12398
|
|
|
12131
12399
|
// src/cli/config/auth/resolveAuthState.ts
|
|
12132
12400
|
import ts12 from "typescript";
|
|
12133
|
-
import { existsSync as existsSync28, readdirSync as readdirSync6, readFileSync as
|
|
12134
|
-
import { join as
|
|
12401
|
+
import { existsSync as existsSync28, readdirSync as readdirSync6, readFileSync as readFileSync28 } from "fs";
|
|
12402
|
+
import { join as join33, relative as relative17, resolve as resolve28 } from "path";
|
|
12135
12403
|
var AUTH_PACKAGE2 = "@absolutejs/auth", REPO_URL = "https://github.com/absolutejs/absolute-auth", NPM_URL = "https://www.npmjs.com/package/@absolutejs/auth", SKIP_DIRS, MAX_FILES = 4000, SETUP_EXPORTS, isRecord12 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), readJson = (path) => {
|
|
12136
12404
|
if (!existsSync28(path))
|
|
12137
12405
|
return null;
|
|
12138
12406
|
try {
|
|
12139
|
-
const parsed = JSON.parse(
|
|
12407
|
+
const parsed = JSON.parse(readFileSync28(path, "utf-8"));
|
|
12140
12408
|
return isRecord12(parsed) ? parsed : null;
|
|
12141
12409
|
} catch {
|
|
12142
12410
|
return null;
|
|
@@ -12145,7 +12413,7 @@ var AUTH_PACKAGE2 = "@absolutejs/auth", REPO_URL = "https://github.com/absolutej
|
|
|
12145
12413
|
const value = record?.[key];
|
|
12146
12414
|
return typeof value === "string" ? value : null;
|
|
12147
12415
|
}, declaredVersionFor = (cwd) => {
|
|
12148
|
-
const pkg = readJson(
|
|
12416
|
+
const pkg = readJson(join33(cwd, "package.json"));
|
|
12149
12417
|
if (!pkg)
|
|
12150
12418
|
return null;
|
|
12151
12419
|
for (const field of ["dependencies", "devDependencies"]) {
|
|
@@ -12157,14 +12425,14 @@ var AUTH_PACKAGE2 = "@absolutejs/auth", REPO_URL = "https://github.com/absolutej
|
|
|
12157
12425
|
return version2;
|
|
12158
12426
|
}
|
|
12159
12427
|
return null;
|
|
12160
|
-
}, installedVersionFor = (cwd) => stringField(readJson(
|
|
12428
|
+
}, installedVersionFor = (cwd) => stringField(readJson(join33(cwd, "node_modules", AUTH_PACKAGE2, "package.json")), "version"), SOURCE_FILE, safeReaddir = (dir) => {
|
|
12161
12429
|
try {
|
|
12162
12430
|
return readdirSync6(dir, { withFileTypes: true });
|
|
12163
12431
|
} catch {
|
|
12164
12432
|
return [];
|
|
12165
12433
|
}
|
|
12166
12434
|
}, sortEntry = (dir, entry, found, dirs) => {
|
|
12167
|
-
const full =
|
|
12435
|
+
const full = join33(dir, entry.name);
|
|
12168
12436
|
if (entry.isDirectory()) {
|
|
12169
12437
|
if (SKIP_DIRS.has(entry.name) || entry.name.startsWith("."))
|
|
12170
12438
|
return;
|
|
@@ -12208,11 +12476,11 @@ var AUTH_PACKAGE2 = "@absolutejs/auth", REPO_URL = "https://github.com/absolutej
|
|
|
12208
12476
|
return null;
|
|
12209
12477
|
}
|
|
12210
12478
|
return property.initializer.properties.length;
|
|
12211
|
-
}, readConfigKeys = (
|
|
12479
|
+
}, readConfigKeys = (object2) => {
|
|
12212
12480
|
const keys = new Set;
|
|
12213
12481
|
let providerCount = null;
|
|
12214
|
-
const usesSpread =
|
|
12215
|
-
for (const property of
|
|
12482
|
+
const usesSpread = object2.properties.some((property) => ts12.isSpreadAssignment(property));
|
|
12483
|
+
for (const property of object2.properties) {
|
|
12216
12484
|
const { name } = property;
|
|
12217
12485
|
if (name === undefined || !ts12.isIdentifier(name))
|
|
12218
12486
|
continue;
|
|
@@ -12229,7 +12497,7 @@ var AUTH_PACKAGE2 = "@absolutejs/auth", REPO_URL = "https://github.com/absolutej
|
|
|
12229
12497
|
return { keys: new Set, providerCount: null, usesSpread: true };
|
|
12230
12498
|
}, readFileOrNull = (path) => {
|
|
12231
12499
|
try {
|
|
12232
|
-
return
|
|
12500
|
+
return readFileSync28(path, "utf-8");
|
|
12233
12501
|
} catch {
|
|
12234
12502
|
return null;
|
|
12235
12503
|
}
|
|
@@ -12262,7 +12530,7 @@ var AUTH_PACKAGE2 = "@absolutejs/auth", REPO_URL = "https://github.com/absolutej
|
|
|
12262
12530
|
scaffoldable: isScaffoldableFeature(feature.id)
|
|
12263
12531
|
})), resolveAuthState = (cwd) => {
|
|
12264
12532
|
const installedVersion = installedVersionFor(cwd);
|
|
12265
|
-
const root = existsSync28(
|
|
12533
|
+
const root = existsSync28(join33(cwd, "src")) ? join33(cwd, "src") : cwd;
|
|
12266
12534
|
let match = null;
|
|
12267
12535
|
let setupPath = null;
|
|
12268
12536
|
for (const file of candidateFiles(root)) {
|
|
@@ -12270,7 +12538,7 @@ var AUTH_PACKAGE2 = "@absolutejs/auth", REPO_URL = "https://github.com/absolutej
|
|
|
12270
12538
|
if (found === null)
|
|
12271
12539
|
continue;
|
|
12272
12540
|
match = found;
|
|
12273
|
-
setupPath = relative17(cwd,
|
|
12541
|
+
setupPath = relative17(cwd, resolve28(file));
|
|
12274
12542
|
break;
|
|
12275
12543
|
}
|
|
12276
12544
|
const keys = match?.keys ?? new Set;
|
|
@@ -12308,7 +12576,7 @@ var init_resolveAuthState = __esm(() => {
|
|
|
12308
12576
|
|
|
12309
12577
|
// src/cli/config/auth/scaffoldAuthFeature.ts
|
|
12310
12578
|
import { existsSync as existsSync29, writeFileSync as writeFileSync15 } from "fs";
|
|
12311
|
-
import { dirname as
|
|
12579
|
+
import { dirname as dirname22, join as join34, relative as relative18, resolve as resolve29 } from "path";
|
|
12312
12580
|
var renderScaffold = (scaffold) => {
|
|
12313
12581
|
const importNames = [...scaffold.imports, `type ${scaffold.typeName}`];
|
|
12314
12582
|
const importLine = `import { ${importNames.join(", ")} } from '@absolutejs/auth';`;
|
|
@@ -12333,8 +12601,8 @@ ${body}
|
|
|
12333
12601
|
}, targetDir = (cwd) => {
|
|
12334
12602
|
const { setupPath } = resolveAuthState(cwd);
|
|
12335
12603
|
if (setupPath)
|
|
12336
|
-
return
|
|
12337
|
-
const src =
|
|
12604
|
+
return dirname22(resolve29(cwd, setupPath));
|
|
12605
|
+
const src = join34(cwd, "src");
|
|
12338
12606
|
return existsSync29(src) ? src : cwd;
|
|
12339
12607
|
}, spreadFor = (scaffold) => `import { ${scaffold.exportName} } from './${scaffold.exportName}';
|
|
12340
12608
|
// add to your auth() call:
|
|
@@ -12348,7 +12616,7 @@ ${scaffold.configKey}: ${scaffold.exportName}`, failure2 = (message) => ({
|
|
|
12348
12616
|
const scaffold = AUTH_SCAFFOLDS[id];
|
|
12349
12617
|
if (!scaffold)
|
|
12350
12618
|
return failure2(`Unknown auth feature "${id}".`);
|
|
12351
|
-
const filePath =
|
|
12619
|
+
const filePath = join34(targetDir(cwd), `${scaffold.exportName}.ts`);
|
|
12352
12620
|
const relPath = relative18(cwd, filePath);
|
|
12353
12621
|
if (existsSync29(filePath)) {
|
|
12354
12622
|
return {
|
|
@@ -12377,12 +12645,12 @@ var init_scaffoldAuthFeature = __esm(() => {
|
|
|
12377
12645
|
});
|
|
12378
12646
|
|
|
12379
12647
|
// src/cli/htmx/install.ts
|
|
12380
|
-
import { existsSync as existsSync30, mkdirSync as mkdirSync14, readFileSync as
|
|
12381
|
-
import { join as
|
|
12648
|
+
import { existsSync as existsSync30, mkdirSync as mkdirSync14, readFileSync as readFileSync29, writeFileSync as writeFileSync16 } from "fs";
|
|
12649
|
+
import { join as join35 } from "path";
|
|
12382
12650
|
var VENDORED_HTMX_VERSION = "2.0.6", vendoredHtmxFile = () => [
|
|
12383
|
-
|
|
12384
|
-
|
|
12385
|
-
|
|
12651
|
+
join35(import.meta.dir, "htmx.min.js"),
|
|
12652
|
+
join35(import.meta.dir, "htmx", "htmx.min.js"),
|
|
12653
|
+
join35(import.meta.dir, "..", "htmx", "htmx.min.js")
|
|
12386
12654
|
].find((path) => existsSync30(path)) ?? null, detectHtmxVersion = (content) => {
|
|
12387
12655
|
const match = content.match(/version:"([0-9.]+)"/);
|
|
12388
12656
|
return match ? match[1] : null;
|
|
@@ -12394,16 +12662,16 @@ var VENDORED_HTMX_VERSION = "2.0.6", vendoredHtmxFile = () => [
|
|
|
12394
12662
|
}
|
|
12395
12663
|
return response.text();
|
|
12396
12664
|
}, installedHtmxVersion = (htmxDir) => {
|
|
12397
|
-
const file =
|
|
12665
|
+
const file = join35(htmxDir, "htmx.min.js");
|
|
12398
12666
|
if (!existsSync30(file))
|
|
12399
12667
|
return null;
|
|
12400
|
-
return detectHtmxVersion(
|
|
12668
|
+
return detectHtmxVersion(readFileSync29(file, "utf-8"));
|
|
12401
12669
|
}, readVendoredHtmx = () => {
|
|
12402
12670
|
const file = vendoredHtmxFile();
|
|
12403
|
-
return file ?
|
|
12671
|
+
return file ? readFileSync29(file, "utf-8") : null;
|
|
12404
12672
|
}, writeHtmx = (htmxDir, content) => {
|
|
12405
12673
|
mkdirSync14(htmxDir, { recursive: true });
|
|
12406
|
-
const file =
|
|
12674
|
+
const file = join35(htmxDir, "htmx.min.js");
|
|
12407
12675
|
writeFileSync16(file, content, "utf-8");
|
|
12408
12676
|
return file;
|
|
12409
12677
|
};
|
|
@@ -12414,7 +12682,7 @@ var exports_add = {};
|
|
|
12414
12682
|
__export(exports_add, {
|
|
12415
12683
|
runAdd: () => runAdd
|
|
12416
12684
|
});
|
|
12417
|
-
import { dirname as
|
|
12685
|
+
import { dirname as dirname23, join as join36, relative as relative19 } from "path";
|
|
12418
12686
|
var write2 = (text) => process.stdout.write(`${text}
|
|
12419
12687
|
`), fail2 = (message) => {
|
|
12420
12688
|
process.stdout.write(`${colors.red}${message}${colors.reset}
|
|
@@ -12429,7 +12697,7 @@ var write2 = (text) => process.stdout.write(`${text}
|
|
|
12429
12697
|
}, frontendRoot = (project, cwd) => {
|
|
12430
12698
|
const [firstKey] = configuredFrameworks(project);
|
|
12431
12699
|
const firstDir = firstKey ? project.frameworkDirs[firstKey] : undefined;
|
|
12432
|
-
return firstDir ?
|
|
12700
|
+
return firstDir ? dirname23(firstDir) : join36(cwd, "src", "frontend");
|
|
12433
12701
|
}, addIntegrationCli = (id, install) => {
|
|
12434
12702
|
const result = addIntegration(process.cwd(), id, { install });
|
|
12435
12703
|
if (!result.ok) {
|
|
@@ -12493,7 +12761,7 @@ var write2 = (text) => process.stdout.write(`${text}
|
|
|
12493
12761
|
write2(`${colors.yellow}!${colors.reset} ${frameworks6[framework].label} is already configured \u2014 nothing to do.`);
|
|
12494
12762
|
return;
|
|
12495
12763
|
}
|
|
12496
|
-
const dirAbs =
|
|
12764
|
+
const dirAbs = join36(frontendRoot(project, cwd), framework);
|
|
12497
12765
|
const dirRel = `./${relative19(cwd, dirAbs).split("\\").join("/")}`;
|
|
12498
12766
|
let depNote = "Skipped dependency install (--no-install).";
|
|
12499
12767
|
if (!noInstall) {
|
|
@@ -12563,8 +12831,8 @@ var exports_analyze = {};
|
|
|
12563
12831
|
__export(exports_analyze, {
|
|
12564
12832
|
runAnalyze: () => runAnalyze
|
|
12565
12833
|
});
|
|
12566
|
-
import { existsSync as existsSync31, readFileSync as
|
|
12567
|
-
import { join as
|
|
12834
|
+
import { existsSync as existsSync31, readFileSync as readFileSync30, statSync as statSync3, writeFileSync as writeFileSync17 } from "fs";
|
|
12835
|
+
import { join as join37, resolve as resolve30 } from "path";
|
|
12568
12836
|
var BASELINE_FILE = ".absolute-size-baseline.json", TOP_CHANGES = 12, CATEGORY_WIDTH = 16, SIZE_WIDTH = 12, CHANGE_WIDTH = 10, CATEGORY_ORDER, categoryOf = (key) => {
|
|
12569
12837
|
if (key.startsWith("Island"))
|
|
12570
12838
|
return "Islands";
|
|
@@ -12584,21 +12852,21 @@ var BASELINE_FILE = ".absolute-size-baseline.json", TOP_CHANGES = 12, CATEGORY_W
|
|
|
12584
12852
|
return 0;
|
|
12585
12853
|
}
|
|
12586
12854
|
}, readSizes = (manifestDir) => {
|
|
12587
|
-
const manifestPath =
|
|
12855
|
+
const manifestPath = join37(manifestDir, "manifest.json");
|
|
12588
12856
|
if (!existsSync31(manifestPath))
|
|
12589
12857
|
return null;
|
|
12590
|
-
const manifest = JSON.parse(
|
|
12858
|
+
const manifest = JSON.parse(readFileSync30(manifestPath, "utf-8"));
|
|
12591
12859
|
const sizes = {};
|
|
12592
12860
|
for (const [key, value] of Object.entries(manifest)) {
|
|
12593
|
-
sizes[key] = fileSize2(
|
|
12861
|
+
sizes[key] = fileSize2(join37(manifestDir, value.replace(/^\//, "")));
|
|
12594
12862
|
}
|
|
12595
12863
|
return sizes;
|
|
12596
12864
|
}, readBaseline = (cwd) => {
|
|
12597
|
-
const path =
|
|
12865
|
+
const path = join37(cwd, BASELINE_FILE);
|
|
12598
12866
|
if (!existsSync31(path))
|
|
12599
12867
|
return null;
|
|
12600
12868
|
try {
|
|
12601
|
-
const parsed = JSON.parse(
|
|
12869
|
+
const parsed = JSON.parse(readFileSync30(path, "utf-8"));
|
|
12602
12870
|
return parsed;
|
|
12603
12871
|
} catch {
|
|
12604
12872
|
return null;
|
|
@@ -12676,14 +12944,14 @@ var BASELINE_FILE = ".absolute-size-baseline.json", TOP_CHANGES = 12, CATEGORY_W
|
|
|
12676
12944
|
const config = await loadConfig(configIndex >= 0 ? args[configIndex + 1] : undefined);
|
|
12677
12945
|
const outdirIndex = args.indexOf("--outdir");
|
|
12678
12946
|
const outdir = outdirIndex >= 0 ? args[outdirIndex + 1] : config.buildDirectory;
|
|
12679
|
-
const sizes = readSizes(
|
|
12947
|
+
const sizes = readSizes(resolve30(cwd, outdir ?? "build"));
|
|
12680
12948
|
if (sizes === null) {
|
|
12681
12949
|
process.stdout.write(`${colors.dim}No build found. Run \`absolute build\` first.${colors.reset}
|
|
12682
12950
|
`);
|
|
12683
12951
|
return;
|
|
12684
12952
|
}
|
|
12685
12953
|
if (args.includes("--save")) {
|
|
12686
|
-
writeFileSync17(
|
|
12954
|
+
writeFileSync17(join37(cwd, BASELINE_FILE), `${JSON.stringify(sizes, null, 2)}
|
|
12687
12955
|
`);
|
|
12688
12956
|
process.stdout.write(`${colors.green}\u2713${colors.reset} Saved size baseline (${Object.keys(sizes).length} entries) to ${BASELINE_FILE}
|
|
12689
12957
|
`);
|
|
@@ -12845,10 +13113,10 @@ var METHOD_COLOR2, HTTP_METHODS, printDim2 = (message) => process.stdout.write(`
|
|
|
12845
13113
|
}, getProp = (value, key) => typeof value === "object" && value !== null ? Reflect.get(value, key) : undefined, propertyNames = (schema) => {
|
|
12846
13114
|
const properties = getProp(schema, "properties");
|
|
12847
13115
|
return typeof properties === "object" && properties !== null ? Object.keys(properties) : [];
|
|
12848
|
-
}, summarize = (
|
|
12849
|
-
const parameters = getProp(
|
|
13116
|
+
}, summarize = (operation2) => {
|
|
13117
|
+
const parameters = getProp(operation2, "parameters");
|
|
12850
13118
|
const names = Array.isArray(parameters) ? parameters.map((param) => getProp(param, "name")).filter((name) => typeof name === "string") : [];
|
|
12851
|
-
const json = getProp(getProp(
|
|
13119
|
+
const json = getProp(getProp(operation2, "requestBody"), "content");
|
|
12852
13120
|
const body = propertyNames(getProp(getProp(json, "application/json"), "schema"));
|
|
12853
13121
|
const parts = [];
|
|
12854
13122
|
if (names.length > 0)
|
|
@@ -12860,10 +13128,10 @@ var METHOD_COLOR2, HTTP_METHODS, printDim2 = (message) => process.stdout.write(`
|
|
|
12860
13128
|
const paths = Reflect.get(spec ?? {}, "paths");
|
|
12861
13129
|
if (typeof paths !== "object" || paths === null)
|
|
12862
13130
|
return [];
|
|
12863
|
-
return Object.entries(paths).filter(([path]) => !isInternal(path)).flatMap(([path, methods]) => Object.entries(methods ?? {}).filter(([method]) => HTTP_METHODS.has(method)).map(([method,
|
|
13131
|
+
return Object.entries(paths).filter(([path]) => !isInternal(path)).flatMap(([path, methods]) => Object.entries(methods ?? {}).filter(([method]) => HTTP_METHODS.has(method)).map(([method, operation2]) => ({
|
|
12864
13132
|
method: method.toUpperCase(),
|
|
12865
13133
|
path,
|
|
12866
|
-
summary: summarize(
|
|
13134
|
+
summary: summarize(operation2)
|
|
12867
13135
|
})));
|
|
12868
13136
|
}, runApi = async (args) => {
|
|
12869
13137
|
const server = await findServer();
|
|
@@ -12929,7 +13197,7 @@ var exports_remove = {};
|
|
|
12929
13197
|
__export(exports_remove, {
|
|
12930
13198
|
runRemove: () => runRemove
|
|
12931
13199
|
});
|
|
12932
|
-
import { existsSync as existsSync32, readFileSync as
|
|
13200
|
+
import { existsSync as existsSync32, readFileSync as readFileSync31 } from "fs";
|
|
12933
13201
|
import { relative as relative20 } from "path";
|
|
12934
13202
|
var write3 = (text) => process.stdout.write(`${text}
|
|
12935
13203
|
`), fail3 = (message) => {
|
|
@@ -12943,7 +13211,7 @@ var write3 = (text) => process.stdout.write(`${text}
|
|
|
12943
13211
|
if (file === null || seen.has(file) || !existsSync32(file))
|
|
12944
13212
|
return false;
|
|
12945
13213
|
seen.add(file);
|
|
12946
|
-
return
|
|
13214
|
+
return readFileSync31(file, "utf-8").includes(handler);
|
|
12947
13215
|
});
|
|
12948
13216
|
}, runRemove = async (args) => {
|
|
12949
13217
|
const [framework] = args.filter((arg) => !arg.startsWith("--"));
|
|
@@ -13070,15 +13338,15 @@ __export(exports_env, {
|
|
|
13070
13338
|
runEnv: () => runEnv,
|
|
13071
13339
|
collectEnvVars: () => collectEnvVars
|
|
13072
13340
|
});
|
|
13073
|
-
import { existsSync as existsSync33, readFileSync as
|
|
13074
|
-
import { join as
|
|
13341
|
+
import { existsSync as existsSync33, readFileSync as readFileSync32 } from "fs";
|
|
13342
|
+
import { join as join38 } from "path";
|
|
13075
13343
|
var {env: env3, Glob: Glob3 } = globalThis.Bun;
|
|
13076
|
-
var EXTENSIONS = "ts,tsx,js,jsx,mjs,cjs,svelte,vue", STATUS_WIDTH2, keysInFile = (text) => [...text.matchAll(/getEnv\(\s*['"]([^'"]+)['"]\s*\)/g)].map((match) => match[1]).filter((key) => key !== undefined), scanPatterns = () => existsSync33(
|
|
13344
|
+
var EXTENSIONS = "ts,tsx,js,jsx,mjs,cjs,svelte,vue", STATUS_WIDTH2, keysInFile = (text) => [...text.matchAll(/getEnv\(\s*['"]([^'"]+)['"]\s*\)/g)].map((match) => match[1]).filter((key) => key !== undefined), scanPatterns = () => existsSync33(join38(process.cwd(), "src")) ? [`src/**/*.{${EXTENSIONS}}`] : [`*.{${EXTENSIONS}}`], scanEnvUsage = async () => {
|
|
13077
13345
|
const scans = scanPatterns().map((pattern) => Array.fromAsync(new Glob3(pattern).scan({ cwd: process.cwd() })));
|
|
13078
13346
|
const files = (await Promise.all(scans)).flat();
|
|
13079
13347
|
const usage = new Map;
|
|
13080
13348
|
files.forEach((file) => {
|
|
13081
|
-
keysInFile(
|
|
13349
|
+
keysInFile(readFileSync32(file, "utf-8")).forEach((key) => {
|
|
13082
13350
|
usage.set(key, [...usage.get(key) ?? [], file]);
|
|
13083
13351
|
});
|
|
13084
13352
|
});
|
|
@@ -13139,8 +13407,8 @@ __export(exports_db, {
|
|
|
13139
13407
|
conflictClause: () => conflictClause,
|
|
13140
13408
|
chunkRows: () => chunkRows
|
|
13141
13409
|
});
|
|
13142
|
-
import { existsSync as existsSync34, mkdirSync as mkdirSync15, readFileSync as
|
|
13143
|
-
import { join as
|
|
13410
|
+
import { existsSync as existsSync34, mkdirSync as mkdirSync15, readFileSync as readFileSync33, writeFileSync as writeFileSync18 } from "fs";
|
|
13411
|
+
import { join as join39 } from "path";
|
|
13144
13412
|
var {env: env4, spawn: spawn2, SQL } = globalThis.Bun;
|
|
13145
13413
|
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) => {
|
|
13146
13414
|
const found = explicit ?? URL_ENV_KEYS.map((key) => env4[key]).find((value) => typeof value === "string" && value !== "");
|
|
@@ -13250,19 +13518,19 @@ var BACKUP_FORMAT_VERSION = 1, RESTORE_CHUNK_ROWS = 500, URL_ENV_KEYS, JSON_DATA
|
|
|
13250
13518
|
tables,
|
|
13251
13519
|
v: BACKUP_FORMAT_VERSION
|
|
13252
13520
|
};
|
|
13253
|
-
const dir = options.out ??
|
|
13521
|
+
const dir = options.out ?? join39(process.cwd(), "backups");
|
|
13254
13522
|
mkdirSync15(dir, { recursive: true });
|
|
13255
13523
|
const json = JSON.stringify(payload, (_, value) => typeof value === "bigint" ? value.toString() : value);
|
|
13256
|
-
const file =
|
|
13524
|
+
const file = join39(dir, `backup-${payload.at.replace(/[:.]/g, "-")}.json`);
|
|
13257
13525
|
writeFileSync18(file, json);
|
|
13258
|
-
writeFileSync18(
|
|
13526
|
+
writeFileSync18(join39(dir, "latest.json"), json);
|
|
13259
13527
|
const total = chosen.reduce((sum, name) => sum + (tables[name]?.length ?? 0), 0);
|
|
13260
13528
|
console.log(paint(`\u2713 backup \u2192 ${file}`, colors.green));
|
|
13261
13529
|
console.log(paint(` ${chosen.length} tables, ${total} rows`, colors.dim));
|
|
13262
13530
|
}, runRestore = async (file, options) => {
|
|
13263
13531
|
if (!existsSync34(file))
|
|
13264
13532
|
throw new Error(`Backup not found: ${file}`);
|
|
13265
|
-
const payload = JSON.parse(
|
|
13533
|
+
const payload = JSON.parse(readFileSync33(file, "utf-8"));
|
|
13266
13534
|
const names = Object.keys(payload.tables).filter((name) => keepTable(name, options));
|
|
13267
13535
|
const sql = new SQL(options.url);
|
|
13268
13536
|
const order = dependencyOrder(names, await foreignLinks(sql));
|
|
@@ -13284,7 +13552,7 @@ var BACKUP_FORMAT_VERSION = 1, RESTORE_CHUNK_ROWS = 500, URL_ENV_KEYS, JSON_DATA
|
|
|
13284
13552
|
const total = order.reduce((sum, name) => sum + (payload.tables[name]?.length ?? 0), 0);
|
|
13285
13553
|
console.log(paint(`\u2713 restored ${order.length} tables, ${total} rows (idempotent upsert by primary key)`, colors.green));
|
|
13286
13554
|
}, runSeed = async (entry) => {
|
|
13287
|
-
const target = entry ?? SEED_CANDIDATES.find((candidate) => existsSync34(
|
|
13555
|
+
const target = entry ?? SEED_CANDIDATES.find((candidate) => existsSync34(join39(process.cwd(), candidate)));
|
|
13288
13556
|
if (target === undefined)
|
|
13289
13557
|
throw new Error(`No seed script found (looked for ${SEED_CANDIDATES.join(", ")}). Pass a path: absolute db seed <file>.`);
|
|
13290
13558
|
console.log(paint(`seeding via ${target}\u2026`, colors.cyan));
|
|
@@ -13319,7 +13587,7 @@ var BACKUP_FORMAT_VERSION = 1, RESTORE_CHUNK_ROWS = 500, URL_ENV_KEYS, JSON_DATA
|
|
|
13319
13587
|
return;
|
|
13320
13588
|
}
|
|
13321
13589
|
if (sub === "restore") {
|
|
13322
|
-
const file = positionalArgs(rest)[0] ??
|
|
13590
|
+
const file = positionalArgs(rest)[0] ?? join39(process.cwd(), "backups", "latest.json");
|
|
13323
13591
|
await runRestore(file, parseOptions(rest));
|
|
13324
13592
|
return;
|
|
13325
13593
|
}
|
|
@@ -13433,16 +13701,16 @@ var init_logs = __esm(() => {
|
|
|
13433
13701
|
// src/cli/typeGraphCoherence.ts
|
|
13434
13702
|
import {
|
|
13435
13703
|
existsSync as existsSync36,
|
|
13436
|
-
readFileSync as
|
|
13704
|
+
readFileSync as readFileSync34,
|
|
13437
13705
|
realpathSync as realpathSync2,
|
|
13438
13706
|
rmSync as rmSync6,
|
|
13439
13707
|
writeFileSync as writeFileSync19
|
|
13440
13708
|
} from "fs";
|
|
13441
13709
|
import { createRequire } from "module";
|
|
13442
|
-
import { dirname as
|
|
13710
|
+
import { dirname as dirname24, join as join40, resolve as resolve31, sep as sep5 } from "path";
|
|
13443
13711
|
var DEPENDENCY_FIELDS, TYPE_GRAPH_PACKAGES, readManifest = (path) => {
|
|
13444
13712
|
try {
|
|
13445
|
-
const parsed = JSON.parse(
|
|
13713
|
+
const parsed = JSON.parse(readFileSync34(path, "utf-8"));
|
|
13446
13714
|
return isRecord9(parsed) ? parsed : null;
|
|
13447
13715
|
} catch {
|
|
13448
13716
|
return null;
|
|
@@ -13450,7 +13718,7 @@ var DEPENDENCY_FIELDS, TYPE_GRAPH_PACKAGES, readManifest = (path) => {
|
|
|
13450
13718
|
}, dependencyRecord = (manifest, field) => {
|
|
13451
13719
|
const value = Reflect.get(manifest, field);
|
|
13452
13720
|
return isRecord9(value) ? value : {};
|
|
13453
|
-
},
|
|
13721
|
+
}, dependencyNames2 = (manifest) => [
|
|
13454
13722
|
...new Set(DEPENDENCY_FIELDS.flatMap((field) => Object.keys(dependencyRecord(manifest, field))))
|
|
13455
13723
|
], declaresPackage = (manifest, name) => DEPENDENCY_FIELDS.some((field) => Object.hasOwn(dependencyRecord(manifest, field), name)), manifestName = (manifest, fallback) => {
|
|
13456
13724
|
const name = Reflect.get(manifest, "name");
|
|
@@ -13459,13 +13727,13 @@ var DEPENDENCY_FIELDS, TYPE_GRAPH_PACKAGES, readManifest = (path) => {
|
|
|
13459
13727
|
const version2 = Reflect.get(manifest, "version");
|
|
13460
13728
|
return typeof version2 === "string" ? version2 : "unknown";
|
|
13461
13729
|
}, packageJsonFromEntry = (entry, expectedName) => {
|
|
13462
|
-
let directory =
|
|
13730
|
+
let directory = dirname24(entry);
|
|
13463
13731
|
for (;; ) {
|
|
13464
|
-
const candidate =
|
|
13732
|
+
const candidate = join40(directory, "package.json");
|
|
13465
13733
|
const manifest = readManifest(candidate);
|
|
13466
13734
|
if (manifest && manifestName(manifest, "") === expectedName)
|
|
13467
13735
|
return candidate;
|
|
13468
|
-
const parent =
|
|
13736
|
+
const parent = dirname24(directory);
|
|
13469
13737
|
if (parent === directory)
|
|
13470
13738
|
return null;
|
|
13471
13739
|
directory = parent;
|
|
@@ -13481,27 +13749,27 @@ var DEPENDENCY_FIELDS, TYPE_GRAPH_PACKAGES, readManifest = (path) => {
|
|
|
13481
13749
|
}
|
|
13482
13750
|
}
|
|
13483
13751
|
}, findInstallRoot = (cwd) => {
|
|
13484
|
-
let directory =
|
|
13752
|
+
let directory = resolve31(cwd);
|
|
13485
13753
|
for (;; ) {
|
|
13486
|
-
if (existsSync36(
|
|
13754
|
+
if (existsSync36(join40(directory, "bun.lock")) || existsSync36(join40(directory, "bun.lockb"))) {
|
|
13487
13755
|
return directory;
|
|
13488
13756
|
}
|
|
13489
|
-
const parent =
|
|
13757
|
+
const parent = dirname24(directory);
|
|
13490
13758
|
if (parent === directory)
|
|
13491
|
-
return
|
|
13759
|
+
return resolve31(cwd);
|
|
13492
13760
|
directory = parent;
|
|
13493
13761
|
}
|
|
13494
13762
|
}, findProjectManifest = (cwd, installRoot) => {
|
|
13495
|
-
let directory =
|
|
13763
|
+
let directory = resolve31(cwd);
|
|
13496
13764
|
for (;; ) {
|
|
13497
|
-
const candidate =
|
|
13765
|
+
const candidate = join40(directory, "package.json");
|
|
13498
13766
|
if (existsSync36(candidate))
|
|
13499
13767
|
return candidate;
|
|
13500
13768
|
if (directory === installRoot)
|
|
13501
|
-
return
|
|
13502
|
-
const parent =
|
|
13769
|
+
return join40(installRoot, "package.json");
|
|
13770
|
+
const parent = dirname24(directory);
|
|
13503
13771
|
if (parent === directory)
|
|
13504
|
-
return
|
|
13772
|
+
return join40(installRoot, "package.json");
|
|
13505
13773
|
directory = parent;
|
|
13506
13774
|
}
|
|
13507
13775
|
}, appendConsumer = (consumers, consumerPaths, path, manifest) => {
|
|
@@ -13539,7 +13807,7 @@ var DEPENDENCY_FIELDS, TYPE_GRAPH_PACKAGES, readManifest = (path) => {
|
|
|
13539
13807
|
appendConsumer(consumers, consumerPaths, inspection.consumer.path, inspection.consumer.manifest);
|
|
13540
13808
|
}, inspectTypeGraph = (cwd) => {
|
|
13541
13809
|
const installRoot = findInstallRoot(cwd);
|
|
13542
|
-
const rootManifestPath =
|
|
13810
|
+
const rootManifestPath = join40(installRoot, "package.json");
|
|
13543
13811
|
const rootManifest = readManifest(rootManifestPath) ?? {};
|
|
13544
13812
|
const consumers = [
|
|
13545
13813
|
{ manifest: rootManifest, path: rootManifestPath }
|
|
@@ -13550,7 +13818,7 @@ var DEPENDENCY_FIELDS, TYPE_GRAPH_PACKAGES, readManifest = (path) => {
|
|
|
13550
13818
|
const projectConsumers = [...consumers];
|
|
13551
13819
|
projectConsumers.forEach((consumer) => {
|
|
13552
13820
|
const projectRequire = createRequire(consumer.path);
|
|
13553
|
-
|
|
13821
|
+
dependencyNames2(consumer.manifest).forEach((dependency) => {
|
|
13554
13822
|
const path = resolvePackageJson(projectRequire, dependency);
|
|
13555
13823
|
if (!path)
|
|
13556
13824
|
return;
|
|
@@ -13575,7 +13843,7 @@ var DEPENDENCY_FIELDS, TYPE_GRAPH_PACKAGES, readManifest = (path) => {
|
|
|
13575
13843
|
const duplicates = duplicateTypeGraphPackages(report);
|
|
13576
13844
|
if (duplicates.length === 0)
|
|
13577
13845
|
return [];
|
|
13578
|
-
const manifestPath =
|
|
13846
|
+
const manifestPath = join40(report.installRoot, "package.json");
|
|
13579
13847
|
const manifest = readManifest(manifestPath);
|
|
13580
13848
|
if (!manifest)
|
|
13581
13849
|
return [];
|
|
@@ -13597,7 +13865,7 @@ var DEPENDENCY_FIELDS, TYPE_GRAPH_PACKAGES, readManifest = (path) => {
|
|
|
13597
13865
|
}
|
|
13598
13866
|
return changes;
|
|
13599
13867
|
}, removeDuplicateTypeGraphPackages = (report) => {
|
|
13600
|
-
const manifest = readManifest(
|
|
13868
|
+
const manifest = readManifest(join40(report.installRoot, "package.json")) ?? {};
|
|
13601
13869
|
const rootName = manifestName(manifest, "<workspace>");
|
|
13602
13870
|
const installPrefix = `${realpathSync2(report.installRoot)}${sep5}`;
|
|
13603
13871
|
const nodeModulesSegment = `${sep5}node_modules${sep5}`;
|
|
@@ -13609,7 +13877,7 @@ var DEPENDENCY_FIELDS, TYPE_GRAPH_PACKAGES, readManifest = (path) => {
|
|
|
13609
13877
|
for (const stalePath of stalePaths) {
|
|
13610
13878
|
if (!stalePath.startsWith(installPrefix) || !stalePath.includes(nodeModulesSegment))
|
|
13611
13879
|
continue;
|
|
13612
|
-
rmSync6(
|
|
13880
|
+
rmSync6(dirname24(stalePath), { force: true, recursive: true });
|
|
13613
13881
|
removed.push(stalePath);
|
|
13614
13882
|
}
|
|
13615
13883
|
return removed;
|
|
@@ -13636,10 +13904,10 @@ var exports_doctor = {};
|
|
|
13636
13904
|
__export(exports_doctor, {
|
|
13637
13905
|
runDoctor: () => runDoctor
|
|
13638
13906
|
});
|
|
13639
|
-
import { existsSync as existsSync37, mkdirSync as mkdirSync16, readFileSync as
|
|
13907
|
+
import { existsSync as existsSync37, mkdirSync as mkdirSync16, readFileSync as readFileSync35, writeFileSync as writeFileSync20 } from "fs";
|
|
13640
13908
|
import { createRequire as createRequire2 } from "module";
|
|
13641
13909
|
import { arch as arch4, platform as platform5 } from "os";
|
|
13642
|
-
import { join as
|
|
13910
|
+
import { join as join41 } from "path";
|
|
13643
13911
|
var FRAMEWORK_FIELDS2, projectRequire, check = (status2, label, detail) => ({
|
|
13644
13912
|
detail,
|
|
13645
13913
|
label,
|
|
@@ -13674,7 +13942,7 @@ var FRAMEWORK_FIELDS2, projectRequire, check = (status2, label, detail) => ({
|
|
|
13674
13942
|
return [];
|
|
13675
13943
|
const label = `${field.replace("Directory", "")} pages`;
|
|
13676
13944
|
return [
|
|
13677
|
-
existsSync37(
|
|
13945
|
+
existsSync37(join41(process.cwd(), dir)) ? check("ok", label, dir) : check("fail", label, `${dir} (missing)`)
|
|
13678
13946
|
];
|
|
13679
13947
|
}), envCheck = async () => {
|
|
13680
13948
|
const vars = await collectEnvVars();
|
|
@@ -13736,9 +14004,9 @@ ${colors.dim}${checks.length} checks \xB7 ${colors.reset}${summary}${colors.dim}
|
|
|
13736
14004
|
const fixes = [];
|
|
13737
14005
|
for (const field of FRAMEWORK_FIELDS2) {
|
|
13738
14006
|
const dir = readString2(config, field);
|
|
13739
|
-
if (dir === undefined || existsSync37(
|
|
14007
|
+
if (dir === undefined || existsSync37(join41(cwd, dir)))
|
|
13740
14008
|
continue;
|
|
13741
|
-
mkdirSync16(
|
|
14009
|
+
mkdirSync16(join41(cwd, dir, "pages"), { recursive: true });
|
|
13742
14010
|
fixes.push(`created ${dir}/pages`);
|
|
13743
14011
|
}
|
|
13744
14012
|
return fixes;
|
|
@@ -13746,8 +14014,8 @@ ${colors.dim}${checks.length} checks \xB7 ${colors.reset}${summary}${colors.dim}
|
|
|
13746
14014
|
const missing = (await collectEnvVars()).filter((entry) => !entry.set);
|
|
13747
14015
|
if (missing.length === 0)
|
|
13748
14016
|
return null;
|
|
13749
|
-
const envExample =
|
|
13750
|
-
const existing = existsSync37(envExample) ?
|
|
14017
|
+
const envExample = join41(cwd, ".env.example");
|
|
14018
|
+
const existing = existsSync37(envExample) ? readFileSync35(envExample, "utf-8") : "";
|
|
13751
14019
|
const existingKeys = new Set(existing.split(`
|
|
13752
14020
|
`).map((line) => line.split("=")[0]?.trim()));
|
|
13753
14021
|
const toAdd = missing.filter((entry) => !existingKeys.has(entry.key));
|
|
@@ -13817,7 +14085,7 @@ var init_doctor = __esm(() => {
|
|
|
13817
14085
|
"htmlDirectory",
|
|
13818
14086
|
"htmxDirectory"
|
|
13819
14087
|
];
|
|
13820
|
-
projectRequire = createRequire2(
|
|
14088
|
+
projectRequire = createRequire2(join41(process.cwd(), "package.json"));
|
|
13821
14089
|
STATUS_MARK = {
|
|
13822
14090
|
fail: `${colors.red}\u2717${colors.reset}`,
|
|
13823
14091
|
ok: `${colors.green}\u2713${colors.reset}`,
|
|
@@ -14141,8 +14409,8 @@ var islandFrameworks, islandHydrationModes, isIslandFramework = (value) => islan
|
|
|
14141
14409
|
const componentMatch = attributeString.match(/\bcomponent\s*=\s*["']([^"']+)["']/);
|
|
14142
14410
|
const hydrateMatch = attributeString.match(/\bhydrate\s*=\s*["']([^"']+)["']/);
|
|
14143
14411
|
const framework = frameworkMatch?.[1];
|
|
14144
|
-
const
|
|
14145
|
-
if (!framework || !
|
|
14412
|
+
const component2 = componentMatch?.[1];
|
|
14413
|
+
if (!framework || !component2) {
|
|
14146
14414
|
return null;
|
|
14147
14415
|
}
|
|
14148
14416
|
if (!isIslandFramework(framework)) {
|
|
@@ -14150,7 +14418,7 @@ var islandFrameworks, islandHydrationModes, isIslandFramework = (value) => islan
|
|
|
14150
14418
|
}
|
|
14151
14419
|
const hydrateCandidate = hydrateMatch?.[1];
|
|
14152
14420
|
return {
|
|
14153
|
-
component,
|
|
14421
|
+
component: component2,
|
|
14154
14422
|
framework,
|
|
14155
14423
|
hydrate: hydrateCandidate && isIslandHydrate(hydrateCandidate) ? hydrateCandidate : undefined
|
|
14156
14424
|
};
|
|
@@ -14159,12 +14427,12 @@ var islandFrameworks, islandHydrationModes, isIslandFramework = (value) => islan
|
|
|
14159
14427
|
return;
|
|
14160
14428
|
usageMap.set(normalizeUsage(usage2), usage2);
|
|
14161
14429
|
}, addRenderCallUsage = (usageMap, match) => {
|
|
14162
|
-
const [, framework,
|
|
14163
|
-
if (!framework || !
|
|
14430
|
+
const [, framework, component2, hydrate] = match;
|
|
14431
|
+
if (!framework || !component2 || !isIslandFramework(framework)) {
|
|
14164
14432
|
return;
|
|
14165
14433
|
}
|
|
14166
14434
|
addUsage(usageMap, {
|
|
14167
|
-
component,
|
|
14435
|
+
component: component2,
|
|
14168
14436
|
framework,
|
|
14169
14437
|
hydrate: hydrate && isIslandHydrate(hydrate) ? hydrate : undefined
|
|
14170
14438
|
});
|
|
@@ -14206,8 +14474,8 @@ var init_sourceMetadata = __esm(() => {
|
|
|
14206
14474
|
});
|
|
14207
14475
|
|
|
14208
14476
|
// src/islands/pageMetadata.ts
|
|
14209
|
-
import { readFileSync as
|
|
14210
|
-
import { dirname as
|
|
14477
|
+
import { readFileSync as readFileSync36 } from "fs";
|
|
14478
|
+
import { dirname as dirname25, resolve as resolve32 } from "path";
|
|
14211
14479
|
var pagePatterns, getPageDirs = (config) => [
|
|
14212
14480
|
{ dir: config.angularDirectory, framework: "angular" },
|
|
14213
14481
|
{ dir: config.emberDirectory, framework: "ember" },
|
|
@@ -14227,8 +14495,8 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
14227
14495
|
const source = definition.buildReference?.source;
|
|
14228
14496
|
if (!source)
|
|
14229
14497
|
continue;
|
|
14230
|
-
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname :
|
|
14231
|
-
lookup.set(`${definition.framework}:${definition.component}`,
|
|
14498
|
+
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve32(dirname25(buildInfo.resolvedRegistryPath), source);
|
|
14499
|
+
lookup.set(`${definition.framework}:${definition.component}`, resolve32(resolvedSource));
|
|
14232
14500
|
}
|
|
14233
14501
|
return lookup;
|
|
14234
14502
|
}, resolveIslandUsages = (islands, islandSourceLookup) => islands.map((usage2) => {
|
|
@@ -14241,13 +14509,13 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
14241
14509
|
const pattern = pagePatterns[entry.framework];
|
|
14242
14510
|
if (!pattern)
|
|
14243
14511
|
return;
|
|
14244
|
-
const files = await scanEntryPoints(
|
|
14512
|
+
const files = await scanEntryPoints(resolve32(entry.dir), pattern);
|
|
14245
14513
|
for (const filePath of files) {
|
|
14246
|
-
const source =
|
|
14514
|
+
const source = readFileSync36(filePath, "utf-8");
|
|
14247
14515
|
const islands = extractIslandUsagesFromSource(source);
|
|
14248
|
-
pageMetadata.set(
|
|
14516
|
+
pageMetadata.set(resolve32(filePath), {
|
|
14249
14517
|
islands: resolveIslandUsages(islands, islandSourceLookup),
|
|
14250
|
-
pagePath:
|
|
14518
|
+
pagePath: resolve32(filePath)
|
|
14251
14519
|
});
|
|
14252
14520
|
}
|
|
14253
14521
|
}, loadPageIslandMetadata = async (config) => {
|
|
@@ -14276,14 +14544,14 @@ var exports_islands = {};
|
|
|
14276
14544
|
__export(exports_islands, {
|
|
14277
14545
|
runIslands: () => runIslands
|
|
14278
14546
|
});
|
|
14279
|
-
import { existsSync as existsSync39, readFileSync as
|
|
14280
|
-
import { join as
|
|
14547
|
+
import { existsSync as existsSync39, readFileSync as readFileSync37, statSync as statSync5 } from "fs";
|
|
14548
|
+
import { join as join42, relative as relative21, resolve as resolve33 } from "path";
|
|
14281
14549
|
var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim6 = (message) => process.stdout.write(`${colors.dim}${message}${colors.reset}
|
|
14282
14550
|
`), hostFrameworkOf = (pagePath, cwd, config) => {
|
|
14283
|
-
const resolved =
|
|
14551
|
+
const resolved = resolve33(cwd, pagePath);
|
|
14284
14552
|
for (const [framework, key] of Object.entries(FRAMEWORK_DIR_KEY)) {
|
|
14285
14553
|
const dir = config[key];
|
|
14286
|
-
if (typeof dir === "string" && resolved.startsWith(
|
|
14554
|
+
if (typeof dir === "string" && resolved.startsWith(resolve33(cwd, dir))) {
|
|
14287
14555
|
return framework;
|
|
14288
14556
|
}
|
|
14289
14557
|
}
|
|
@@ -14295,20 +14563,20 @@ var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim6 = (message) => process.stdout.
|
|
|
14295
14563
|
return 0;
|
|
14296
14564
|
}
|
|
14297
14565
|
}, readManifestSizes2 = (manifestDir) => {
|
|
14298
|
-
const manifestPath =
|
|
14566
|
+
const manifestPath = join42(manifestDir, "manifest.json");
|
|
14299
14567
|
if (!existsSync39(manifestPath))
|
|
14300
14568
|
return null;
|
|
14301
|
-
const manifest = JSON.parse(
|
|
14569
|
+
const manifest = JSON.parse(readFileSync37(manifestPath, "utf-8"));
|
|
14302
14570
|
const sizes = new Map;
|
|
14303
14571
|
for (const [key, value] of Object.entries(manifest)) {
|
|
14304
|
-
sizes.set(key, fileSize3(
|
|
14572
|
+
sizes.set(key, fileSize3(join42(manifestDir, value.replace(/^\//, ""))));
|
|
14305
14573
|
}
|
|
14306
14574
|
return sizes;
|
|
14307
14575
|
}, collectIslands = async (cwd, config, sizes) => {
|
|
14308
14576
|
const registryPath = config.islands?.registry;
|
|
14309
14577
|
if (typeof registryPath !== "string")
|
|
14310
14578
|
return null;
|
|
14311
|
-
const buildInfo = await loadIslandRegistryBuildInfo(
|
|
14579
|
+
const buildInfo = await loadIslandRegistryBuildInfo(resolve33(cwd, registryPath));
|
|
14312
14580
|
const pageMetadata = await loadPageIslandMetadata(config);
|
|
14313
14581
|
const usages = [...pageMetadata.values()].flatMap((meta) => meta.islands.map((island) => ({ ...island, page: meta.pagePath })));
|
|
14314
14582
|
return buildInfo.definitions.map((definition) => {
|
|
@@ -14318,7 +14586,7 @@ var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim6 = (message) => process.stdout.
|
|
|
14318
14586
|
crossFramework: hostFramework !== null && hostFramework !== definition.framework,
|
|
14319
14587
|
hostFramework,
|
|
14320
14588
|
hydrate: usage2.hydrate ?? "load",
|
|
14321
|
-
page: relative21(cwd,
|
|
14589
|
+
page: relative21(cwd, resolve33(cwd, usage2.page))
|
|
14322
14590
|
};
|
|
14323
14591
|
});
|
|
14324
14592
|
const key = getIslandManifestKey(definition.framework, definition.component);
|
|
@@ -14387,7 +14655,7 @@ var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim6 = (message) => process.stdout.
|
|
|
14387
14655
|
}
|
|
14388
14656
|
const outdirIndex = args.indexOf("--outdir");
|
|
14389
14657
|
const outdir = outdirIndex >= 0 ? args[outdirIndex + 1] : config.buildDirectory;
|
|
14390
|
-
const sizes = args.includes("--sizes") ? readManifestSizes2(
|
|
14658
|
+
const sizes = args.includes("--sizes") ? readManifestSizes2(resolve33(cwd, outdir ?? "build")) : null;
|
|
14391
14659
|
const islands = await collectIslands(cwd, config, sizes);
|
|
14392
14660
|
if (islands === null) {
|
|
14393
14661
|
printDim6('No island registry configured. Set `islands: { registry: "..." }` in absolute.config.ts.');
|
|
@@ -14437,12 +14705,12 @@ var init_islands2 = __esm(() => {
|
|
|
14437
14705
|
|
|
14438
14706
|
// src/build/externalAssetPlugin.ts
|
|
14439
14707
|
import { copyFileSync as copyFileSync2, existsSync as existsSync40, mkdirSync as mkdirSync17, statSync as statSync6 } from "fs";
|
|
14440
|
-
import { basename as basename11, dirname as
|
|
14708
|
+
import { basename as basename11, dirname as dirname26, join as join43, resolve as resolve34 } from "path";
|
|
14441
14709
|
var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
|
|
14442
14710
|
name: "absolute-external-asset",
|
|
14443
14711
|
setup(bld) {
|
|
14444
14712
|
const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
|
|
14445
|
-
const skipRoots = userSourceRoots.map((root) =>
|
|
14713
|
+
const skipRoots = userSourceRoots.map((root) => resolve34(root));
|
|
14446
14714
|
const isUserSource = (path) => skipRoots.some((root) => path.startsWith(`${root}/`));
|
|
14447
14715
|
bld.onLoad({ filter: /\.[mc]?[jt]sx?$/ }, async (args) => {
|
|
14448
14716
|
if (isUserSource(args.path))
|
|
@@ -14452,20 +14720,20 @@ var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
|
|
|
14452
14720
|
return;
|
|
14453
14721
|
urlPattern.lastIndex = 0;
|
|
14454
14722
|
let match;
|
|
14455
|
-
const sourceDir =
|
|
14723
|
+
const sourceDir = dirname26(args.path);
|
|
14456
14724
|
while ((match = urlPattern.exec(source)) !== null) {
|
|
14457
14725
|
const relPath = match[1];
|
|
14458
14726
|
if (!relPath)
|
|
14459
14727
|
continue;
|
|
14460
|
-
const assetPath =
|
|
14728
|
+
const assetPath = resolve34(sourceDir, relPath);
|
|
14461
14729
|
if (!existsSync40(assetPath))
|
|
14462
14730
|
continue;
|
|
14463
14731
|
if (!statSync6(assetPath).isFile())
|
|
14464
14732
|
continue;
|
|
14465
|
-
const targetPath =
|
|
14733
|
+
const targetPath = join43(outDir, basename11(assetPath));
|
|
14466
14734
|
if (existsSync40(targetPath))
|
|
14467
14735
|
continue;
|
|
14468
|
-
mkdirSync17(
|
|
14736
|
+
mkdirSync17(dirname26(targetPath), { recursive: true });
|
|
14469
14737
|
copyFileSync2(assetPath, targetPath);
|
|
14470
14738
|
}
|
|
14471
14739
|
return;
|
|
@@ -14486,7 +14754,7 @@ import {
|
|
|
14486
14754
|
existsSync as existsSync41,
|
|
14487
14755
|
mkdirSync as mkdirSync18,
|
|
14488
14756
|
readdirSync as readdirSync7,
|
|
14489
|
-
readFileSync as
|
|
14757
|
+
readFileSync as readFileSync38,
|
|
14490
14758
|
rmSync as rmSync7,
|
|
14491
14759
|
statSync as statSync7,
|
|
14492
14760
|
unlinkSync as unlinkSync4,
|
|
@@ -14495,11 +14763,11 @@ import {
|
|
|
14495
14763
|
import { createRequire as createRequire3 } from "module";
|
|
14496
14764
|
import {
|
|
14497
14765
|
basename as basename12,
|
|
14498
|
-
dirname as
|
|
14766
|
+
dirname as dirname27,
|
|
14499
14767
|
isAbsolute as isAbsolute6,
|
|
14500
|
-
join as
|
|
14768
|
+
join as join44,
|
|
14501
14769
|
relative as relative22,
|
|
14502
|
-
resolve as
|
|
14770
|
+
resolve as resolve35
|
|
14503
14771
|
} from "path";
|
|
14504
14772
|
var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`, compileBanner = (version2) => {
|
|
14505
14773
|
const resolvedVersion = version2 || "unknown";
|
|
@@ -14513,7 +14781,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
14513
14781
|
const entry = pending.pop();
|
|
14514
14782
|
if (!entry)
|
|
14515
14783
|
continue;
|
|
14516
|
-
const fullPath =
|
|
14784
|
+
const fullPath = join44(entry.parentPath, entry.name);
|
|
14517
14785
|
if (entry.isDirectory())
|
|
14518
14786
|
pending = pending.concat(readdirSync7(fullPath, { withFileTypes: true }));
|
|
14519
14787
|
else
|
|
@@ -14521,7 +14789,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
14521
14789
|
}
|
|
14522
14790
|
return result;
|
|
14523
14791
|
}, INLINE_SOURCE_MAP_RE, rebaseInlineSourceMap = (filePath) => {
|
|
14524
|
-
const source =
|
|
14792
|
+
const source = readFileSync38(filePath, "utf-8");
|
|
14525
14793
|
const match = source.match(INLINE_SOURCE_MAP_RE);
|
|
14526
14794
|
const encoded = match?.[1];
|
|
14527
14795
|
if (!encoded)
|
|
@@ -14532,7 +14800,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
14532
14800
|
if (!Array.isArray(map.sources))
|
|
14533
14801
|
return;
|
|
14534
14802
|
const sourceRoot = typeof map.sourceRoot === "string" ? map.sourceRoot : "";
|
|
14535
|
-
const bundleDirectory =
|
|
14803
|
+
const bundleDirectory = dirname27(filePath);
|
|
14536
14804
|
map.sources = map.sources.map((entry) => {
|
|
14537
14805
|
if (/^[A-Za-z][A-Za-z0-9+.-]*:/.test(entry))
|
|
14538
14806
|
return entry;
|
|
@@ -14541,7 +14809,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
14541
14809
|
if (/^[A-Za-z][A-Za-z0-9+.-]*:/.test(sourceRoot)) {
|
|
14542
14810
|
return new URL(entry, sourceRoot).href;
|
|
14543
14811
|
}
|
|
14544
|
-
return
|
|
14812
|
+
return resolve35(bundleDirectory, sourceRoot, entry);
|
|
14545
14813
|
});
|
|
14546
14814
|
delete map.sourceRoot;
|
|
14547
14815
|
const rebased = Buffer.from(JSON.stringify(map)).toString("base64");
|
|
@@ -14559,7 +14827,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
14559
14827
|
const entry = pending.pop();
|
|
14560
14828
|
if (!entry)
|
|
14561
14829
|
continue;
|
|
14562
|
-
const fullPath =
|
|
14830
|
+
const fullPath = join44(entry.parentPath, entry.name);
|
|
14563
14831
|
if (entry.isDirectory()) {
|
|
14564
14832
|
if (SERVER_RUNTIME_SCAN_SKIP_DIRS.has(entry.name))
|
|
14565
14833
|
continue;
|
|
@@ -14571,22 +14839,22 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
14571
14839
|
return result;
|
|
14572
14840
|
}, copyServerRuntimeAssetReferences = (outdir) => {
|
|
14573
14841
|
const copied = new Set;
|
|
14574
|
-
const normalizedOutdir =
|
|
14842
|
+
const normalizedOutdir = resolve35(outdir);
|
|
14575
14843
|
const copyReference = (filePath, relPath) => {
|
|
14576
|
-
const assetSource =
|
|
14844
|
+
const assetSource = resolve35(dirname27(filePath), relPath);
|
|
14577
14845
|
if (!existsSync41(assetSource) || !statSync7(assetSource).isFile())
|
|
14578
14846
|
return;
|
|
14579
|
-
const assetTarget =
|
|
14847
|
+
const assetTarget = resolve35(normalizedOutdir, relPath.replace(/^\.\//, ""));
|
|
14580
14848
|
if (assetTarget !== normalizedOutdir && !assetTarget.startsWith(`${normalizedOutdir}/`))
|
|
14581
14849
|
return;
|
|
14582
14850
|
if (copied.has(assetTarget))
|
|
14583
14851
|
return;
|
|
14584
14852
|
copied.add(assetTarget);
|
|
14585
|
-
mkdirSync18(
|
|
14853
|
+
mkdirSync18(dirname27(assetTarget), { recursive: true });
|
|
14586
14854
|
cpSync(assetSource, assetTarget, { force: true });
|
|
14587
14855
|
};
|
|
14588
14856
|
for (const filePath of collectProjectSourceFiles(process.cwd())) {
|
|
14589
|
-
const source =
|
|
14857
|
+
const source = readFileSync38(filePath, "utf-8");
|
|
14590
14858
|
SERVER_RUNTIME_ASSET_RE.lastIndex = 0;
|
|
14591
14859
|
let match;
|
|
14592
14860
|
while ((match = SERVER_RUNTIME_ASSET_RE.exec(source)) !== null) {
|
|
@@ -14615,7 +14883,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
14615
14883
|
}
|
|
14616
14884
|
}, readPackageVersion4 = (candidate) => {
|
|
14617
14885
|
try {
|
|
14618
|
-
const pkg = JSON.parse(
|
|
14886
|
+
const pkg = JSON.parse(readFileSync38(candidate, "utf-8"));
|
|
14619
14887
|
if (pkg.name !== "@absolutejs/absolute")
|
|
14620
14888
|
return null;
|
|
14621
14889
|
const ver = pkg.version;
|
|
@@ -14650,18 +14918,18 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
14650
14918
|
return resolveBuildModule3(remaining);
|
|
14651
14919
|
}, resolveJsxDevRuntimeCompatPath2 = () => {
|
|
14652
14920
|
const candidates = [
|
|
14653
|
-
|
|
14654
|
-
|
|
14655
|
-
|
|
14656
|
-
|
|
14657
|
-
|
|
14658
|
-
|
|
14921
|
+
resolve35(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
14922
|
+
resolve35(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js"),
|
|
14923
|
+
resolve35(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.ts"),
|
|
14924
|
+
resolve35(import.meta.dir, "..", "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
14925
|
+
resolve35(import.meta.dir, "..", "..", "..", "react", "jsxDevRuntimeCompat.js"),
|
|
14926
|
+
resolve35(import.meta.dir, "..", "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
14659
14927
|
];
|
|
14660
14928
|
for (const candidate of candidates) {
|
|
14661
14929
|
if (existsSync41(candidate))
|
|
14662
14930
|
return candidate;
|
|
14663
14931
|
}
|
|
14664
|
-
return
|
|
14932
|
+
return resolve35(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js");
|
|
14665
14933
|
}, jsxDevRuntimeCompatPath2, shouldEmbedCompiledAsset = (relativePath, skip = new Set) => {
|
|
14666
14934
|
if (skip.has(relativePath))
|
|
14667
14935
|
return false;
|
|
@@ -14686,7 +14954,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
14686
14954
|
return true;
|
|
14687
14955
|
}), requireForCompile, resolveNativeAssetForRuntime = (specifier) => {
|
|
14688
14956
|
if (specifier.startsWith("."))
|
|
14689
|
-
return
|
|
14957
|
+
return resolve35(process.cwd(), specifier);
|
|
14690
14958
|
if (specifier.startsWith("/"))
|
|
14691
14959
|
return specifier;
|
|
14692
14960
|
return requireForCompile.resolve(specifier, { paths: [process.cwd()] });
|
|
@@ -14698,11 +14966,11 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
14698
14966
|
return nativeAssetEnv;
|
|
14699
14967
|
}, tryReadNodePackageJson = (packageDir) => {
|
|
14700
14968
|
try {
|
|
14701
|
-
return JSON.parse(
|
|
14969
|
+
return JSON.parse(readFileSync38(join44(packageDir, "package.json"), "utf-8"));
|
|
14702
14970
|
} catch {
|
|
14703
14971
|
return null;
|
|
14704
14972
|
}
|
|
14705
|
-
}, resolveProjectPackageDir = (specifier) =>
|
|
14973
|
+
}, resolveProjectPackageDir = (specifier) => resolve35(process.cwd(), "node_modules", ...specifier.split("/")), copyPackageToBuild = (specifier, outdir, seen) => {
|
|
14706
14974
|
if (seen.has(specifier))
|
|
14707
14975
|
return;
|
|
14708
14976
|
const srcDir = resolveProjectPackageDir(specifier);
|
|
@@ -14710,7 +14978,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
14710
14978
|
if (!pkg)
|
|
14711
14979
|
return;
|
|
14712
14980
|
seen.add(specifier);
|
|
14713
|
-
const destDir =
|
|
14981
|
+
const destDir = join44(outdir, "node_modules", ...specifier.split("/"));
|
|
14714
14982
|
rmSync7(destDir, { force: true, recursive: true });
|
|
14715
14983
|
cpSync(srcDir, destDir, {
|
|
14716
14984
|
force: true,
|
|
@@ -14732,7 +15000,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
14732
15000
|
}, copyAngularRuntimePackages = (buildConfig, outdir) => {
|
|
14733
15001
|
if (!buildConfig.angularDirectory)
|
|
14734
15002
|
return;
|
|
14735
|
-
const angularScopeDir =
|
|
15003
|
+
const angularScopeDir = resolve35(process.cwd(), "node_modules", "@angular");
|
|
14736
15004
|
const angularPackages = existsSync41(angularScopeDir) ? readdirSync7(angularScopeDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).filter((entry) => entry.name !== "compiler-cli").map((entry) => `@angular/${entry.name}`) : [];
|
|
14737
15005
|
const roots = new Set([...angularPackages, "rxjs", "tslib", "typescript"]);
|
|
14738
15006
|
const seen = new Set;
|
|
@@ -14751,7 +15019,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
14751
15019
|
copyAngularRuntimePackages(buildConfig, outdir);
|
|
14752
15020
|
copyChunkReferencedPackages(outdir, seen);
|
|
14753
15021
|
}, collectRuntimePackageSpecifiers = (distDir) => {
|
|
14754
|
-
const nodeModulesDir =
|
|
15022
|
+
const nodeModulesDir = join44(distDir, "node_modules");
|
|
14755
15023
|
if (!existsSync41(nodeModulesDir))
|
|
14756
15024
|
return [];
|
|
14757
15025
|
const specifiers = [];
|
|
@@ -14759,7 +15027,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
14759
15027
|
if (!entry.isDirectory())
|
|
14760
15028
|
continue;
|
|
14761
15029
|
if (entry.name.startsWith("@")) {
|
|
14762
|
-
const scopeDir =
|
|
15030
|
+
const scopeDir = join44(nodeModulesDir, entry.name);
|
|
14763
15031
|
for (const scopedEntry of readdirSync7(scopeDir, {
|
|
14764
15032
|
withFileTypes: true
|
|
14765
15033
|
})) {
|
|
@@ -14773,7 +15041,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
14773
15041
|
}
|
|
14774
15042
|
return specifiers.sort((firstSpecifier, secondSpecifier) => secondSpecifier.length - firstSpecifier.length);
|
|
14775
15043
|
}, ensureRelativeModuleSpecifier = (fromFile, toFile) => {
|
|
14776
|
-
const rel = relative22(
|
|
15044
|
+
const rel = relative22(dirname27(fromFile), toFile).replace(/\\/g, "/");
|
|
14777
15045
|
return rel.startsWith(".") ? rel : `./${rel}`;
|
|
14778
15046
|
}, pickExportEntry = (value) => {
|
|
14779
15047
|
if (typeof value === "string")
|
|
@@ -14790,18 +15058,18 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
14790
15058
|
const packageSpecifier = packageSpecifiers.find((root) => specifier === root || specifier.startsWith(`${root}/`));
|
|
14791
15059
|
if (!packageSpecifier)
|
|
14792
15060
|
return null;
|
|
14793
|
-
const packageDir =
|
|
15061
|
+
const packageDir = join44(distDir, "node_modules", ...packageSpecifier.split("/"));
|
|
14794
15062
|
const subpath = specifier.slice(packageSpecifier.length);
|
|
14795
|
-
const subPackageDir = subpath ?
|
|
14796
|
-
const resolvedPackageDir = subPackageDir && existsSync41(
|
|
14797
|
-
const packageJsonPath =
|
|
15063
|
+
const subPackageDir = subpath ? join44(packageDir, ...subpath.slice(1).split("/")) : null;
|
|
15064
|
+
const resolvedPackageDir = subPackageDir && existsSync41(join44(subPackageDir, "package.json")) ? subPackageDir : packageDir;
|
|
15065
|
+
const packageJsonPath = join44(resolvedPackageDir, "package.json");
|
|
14798
15066
|
if (!existsSync41(packageJsonPath))
|
|
14799
15067
|
return null;
|
|
14800
|
-
const pkg = JSON.parse(
|
|
15068
|
+
const pkg = JSON.parse(readFileSync38(packageJsonPath, "utf-8"));
|
|
14801
15069
|
const exportKey = resolvedPackageDir !== subPackageDir && subpath ? `.${subpath}` : ".";
|
|
14802
15070
|
const rootExport = pkg.exports?.[exportKey];
|
|
14803
15071
|
const entry = pickExportEntry(rootExport) ?? (resolvedPackageDir === subPackageDir || !subpath ? pkg.module ?? pkg.main ?? "index.js" : `.${subpath}`);
|
|
14804
|
-
return
|
|
15072
|
+
return join44(resolvedPackageDir, entry);
|
|
14805
15073
|
}, 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) => {
|
|
14806
15074
|
try {
|
|
14807
15075
|
return statSync7(filePath).isFile();
|
|
@@ -14814,16 +15082,16 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
14814
15082
|
const candidates = [
|
|
14815
15083
|
candidate,
|
|
14816
15084
|
...RUNTIME_JS_EXTENSIONS.map((extension) => `${candidate}${extension}`),
|
|
14817
|
-
...RUNTIME_JS_EXTENSIONS.map((extension) =>
|
|
15085
|
+
...RUNTIME_JS_EXTENSIONS.map((extension) => join44(candidate, `index${extension}`))
|
|
14818
15086
|
];
|
|
14819
15087
|
return candidates.find((filePath) => isRuntimeJsFile(filePath) && isFile(filePath)) ?? null;
|
|
14820
15088
|
}, findContainingRuntimePackageDir = (filePath) => {
|
|
14821
|
-
let dir =
|
|
14822
|
-
while (dir !==
|
|
14823
|
-
if (isNodeModulesPath(dir) && existsSync41(
|
|
15089
|
+
let dir = dirname27(filePath);
|
|
15090
|
+
while (dir !== dirname27(dir)) {
|
|
15091
|
+
if (isNodeModulesPath(dir) && existsSync41(join44(dir, "package.json"))) {
|
|
14824
15092
|
return dir;
|
|
14825
15093
|
}
|
|
14826
|
-
dir =
|
|
15094
|
+
dir = dirname27(dir);
|
|
14827
15095
|
}
|
|
14828
15096
|
return null;
|
|
14829
15097
|
}, resolvePackageImportEntryFile = (fromFile, specifier) => {
|
|
@@ -14836,13 +15104,13 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
14836
15104
|
const entry = pickExportEntry(pkg?.imports?.[specifier]);
|
|
14837
15105
|
if (!entry)
|
|
14838
15106
|
return null;
|
|
14839
|
-
return
|
|
15107
|
+
return join44(packageDir, entry);
|
|
14840
15108
|
}, 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) => {
|
|
14841
|
-
const distRoot =
|
|
15109
|
+
const distRoot = resolve35(distDir);
|
|
14842
15110
|
for (const filePath of collectRuntimeRewriteRoots(distDir)) {
|
|
14843
|
-
if (
|
|
15111
|
+
if (resolve35(dirname27(filePath)) === distRoot)
|
|
14844
15112
|
continue;
|
|
14845
|
-
const source =
|
|
15113
|
+
const source = readFileSync38(filePath, "utf-8");
|
|
14846
15114
|
for (const match of source.matchAll(MODULE_SPECIFIER_RE)) {
|
|
14847
15115
|
const [, , , specifier] = match;
|
|
14848
15116
|
if (!specifier || specifier.startsWith(".") || specifier.startsWith("/") || specifier.startsWith("#") || specifier.startsWith("node:") || specifier.startsWith("bun:")) {
|
|
@@ -14872,11 +15140,11 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
14872
15140
|
if (!filePath || seen.has(filePath))
|
|
14873
15141
|
continue;
|
|
14874
15142
|
seen.add(filePath);
|
|
14875
|
-
const source =
|
|
15143
|
+
const source = readFileSync38(filePath, "utf-8");
|
|
14876
15144
|
const { masked, restore } = maskLiterals(source);
|
|
14877
15145
|
const rewrittenMasked = masked.replace(MODULE_SPECIFIER_RE, (match, prefix, quote, specifier) => {
|
|
14878
15146
|
if (typeof specifier === "string" && specifier.startsWith(".")) {
|
|
14879
|
-
enqueue(resolveRuntimeJsFile(
|
|
15147
|
+
enqueue(resolveRuntimeJsFile(resolve35(dirname27(filePath), specifier)));
|
|
14880
15148
|
return match;
|
|
14881
15149
|
}
|
|
14882
15150
|
const packageImportTarget = resolveRuntimeJsFile(resolvePackageImportEntryFile(filePath, specifier) ?? "");
|
|
@@ -14920,7 +15188,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
14920
15188
|
const nativeAssets = resolveCompileNativeAssets(buildConfig);
|
|
14921
15189
|
nativeAssets.forEach((asset, idx) => {
|
|
14922
15190
|
const varName = `__native${idx}`;
|
|
14923
|
-
const importSpecifier = asset.import.startsWith(".") ?
|
|
15191
|
+
const importSpecifier = asset.import.startsWith(".") ? resolve35(process.cwd(), asset.import) : asset.import;
|
|
14924
15192
|
nativeImports.push(`import ${varName} from ${JSON.stringify(importSpecifier)} with { type: "file" };`);
|
|
14925
15193
|
nativeMappings.push(` [${JSON.stringify(asset.env)}, resolveNativeAssetPath(${varName})],`);
|
|
14926
15194
|
});
|
|
@@ -14979,7 +15247,7 @@ import { buildGlobalWSHandler } from "elysia/ws";
|
|
|
14979
15247
|
const SERVER_MODULE = (runtimeDir: string) => import(pathToFileURL(join(runtimeDir, ${JSON.stringify(serverBundleName)})).href);
|
|
14980
15248
|
const RUNTIME_BUILD_ID = ${JSON.stringify(runtimeBuildId)};
|
|
14981
15249
|
const RUNTIME_CONFIG_SOURCE = ${JSON.stringify(runtimeConfigSource)};
|
|
14982
|
-
const ORIGINAL_BUILD_DIR = ${JSON.stringify(
|
|
15250
|
+
const ORIGINAL_BUILD_DIR = ${JSON.stringify(resolve35(distDir))};
|
|
14983
15251
|
const ORIGINAL_BUILD_DIR_NORMALIZED = ORIGINAL_BUILD_DIR.replace(/\\\\/g, "/");
|
|
14984
15252
|
const EMBEDDED_NATIVE_AUTH_CLIENTS = ${JSON.stringify(process.env[ABSOLUTE_NATIVE_AUTH_CLIENTS_ENV])};
|
|
14985
15253
|
|
|
@@ -15400,17 +15668,17 @@ console.log(\`
|
|
|
15400
15668
|
});
|
|
15401
15669
|
}
|
|
15402
15670
|
}), compile = async (serverEntry, outdir, outfile, configPath2) => {
|
|
15403
|
-
const resolvedOutdir =
|
|
15671
|
+
const resolvedOutdir = resolve35(outdir ?? "dist");
|
|
15404
15672
|
await withBuildDirectoryLock(resolvedOutdir, () => compileUnlocked(serverEntry, resolvedOutdir, outfile, configPath2));
|
|
15405
15673
|
}, compileUnlocked = async (serverEntry, resolvedOutdir, outfile, configPath2) => {
|
|
15406
15674
|
const configuredPrerenderPort = env5.COMPILE_PORT === undefined ? Number(env5.PORT) : Number(env5.COMPILE_PORT);
|
|
15407
15675
|
const prerenderPort = configuredPrerenderPort > 0 ? configuredPrerenderPort : await findFreePort();
|
|
15408
15676
|
killStaleProcesses(prerenderPort);
|
|
15409
15677
|
const entryName = basename12(serverEntry).replace(/\.[^.]+$/, "");
|
|
15410
|
-
const resolvedOutfile =
|
|
15678
|
+
const resolvedOutfile = resolve35(outfile ?? "compiled-server");
|
|
15411
15679
|
const absoluteVersion = resolvePackageVersion3([
|
|
15412
|
-
|
|
15413
|
-
|
|
15680
|
+
resolve35(import.meta.dir, "..", "..", "..", "package.json"),
|
|
15681
|
+
resolve35(import.meta.dir, "..", "..", "package.json")
|
|
15414
15682
|
]);
|
|
15415
15683
|
compileBanner(absoluteVersion);
|
|
15416
15684
|
const totalStart = performance.now();
|
|
@@ -15423,8 +15691,8 @@ console.log(\`
|
|
|
15423
15691
|
installAbsoluteMobileAuthEnvironment(process.cwd(), normalizeAbsoluteMobileConfig(buildConfig.mobile, process.cwd()));
|
|
15424
15692
|
try {
|
|
15425
15693
|
const build2 = await resolveBuildModule3([
|
|
15426
|
-
|
|
15427
|
-
|
|
15694
|
+
resolve35(import.meta.dir, "..", "..", "core", "build"),
|
|
15695
|
+
resolve35(import.meta.dir, "..", "build")
|
|
15428
15696
|
]);
|
|
15429
15697
|
if (!build2)
|
|
15430
15698
|
throw new Error("Could not locate build module");
|
|
@@ -15446,11 +15714,11 @@ console.log(\`
|
|
|
15446
15714
|
buildConfig.htmxDirectory
|
|
15447
15715
|
].filter((dir) => Boolean(dir));
|
|
15448
15716
|
const islandRegistrySpec = buildConfig.islands?.registry;
|
|
15449
|
-
const islandRegistryPlugin = islandRegistrySpec ? createIslandRegistryDefinitionPlugin(await loadIslandRegistryBuildInfo(
|
|
15450
|
-
const serverBundleEntryDirectory =
|
|
15717
|
+
const islandRegistryPlugin = islandRegistrySpec ? createIslandRegistryDefinitionPlugin(await loadIslandRegistryBuildInfo(resolve35(islandRegistrySpec))) : undefined;
|
|
15718
|
+
const serverBundleEntryDirectory = join44(resolvedOutdir, ".absolutejs-server-entry");
|
|
15451
15719
|
mkdirSync18(serverBundleEntryDirectory, { recursive: true });
|
|
15452
|
-
const typeboxSetupEntry =
|
|
15453
|
-
const serverBundleEntry =
|
|
15720
|
+
const typeboxSetupEntry = join44(serverBundleEntryDirectory, "_typebox_setup.ts");
|
|
15721
|
+
const serverBundleEntry = join44(serverBundleEntryDirectory, basename12(serverEntry));
|
|
15454
15722
|
writeFileSync21(typeboxSetupEntry, `import { setupTypebox } from 'elysia';
|
|
15455
15723
|
import * as compile from 'typebox/compile';
|
|
15456
15724
|
import * as schema from 'typebox/schema';
|
|
@@ -15461,7 +15729,7 @@ import * as value from 'typebox/value';
|
|
|
15461
15729
|
setupTypebox({ typebox: { compile, schema, system, type, value } });
|
|
15462
15730
|
`);
|
|
15463
15731
|
writeFileSync21(serverBundleEntry, `import './_typebox_setup';
|
|
15464
|
-
import * as serverModule from ${JSON.stringify(
|
|
15732
|
+
import * as serverModule from ${JSON.stringify(resolve35(serverEntry))};
|
|
15465
15733
|
|
|
15466
15734
|
export const server = serverModule.server ?? serverModule.app ?? serverModule.default;
|
|
15467
15735
|
export default server;
|
|
@@ -15475,7 +15743,7 @@ export default server;
|
|
|
15475
15743
|
...islandRegistryPlugin ? [islandRegistryPlugin] : [],
|
|
15476
15744
|
...buildConfig.mobile ? [
|
|
15477
15745
|
createAbsoluteMobileRouteMetadataPlugin({
|
|
15478
|
-
entry:
|
|
15746
|
+
entry: resolve35(serverEntry)
|
|
15479
15747
|
})
|
|
15480
15748
|
] : [],
|
|
15481
15749
|
createElysiaOpenApiTypeboxPlugin(),
|
|
@@ -15499,13 +15767,13 @@ export default server;
|
|
|
15499
15767
|
console.error(cliTag4("\x1B[31m", "Server bundle failed."));
|
|
15500
15768
|
process.exit(1);
|
|
15501
15769
|
}
|
|
15502
|
-
const outputPath =
|
|
15770
|
+
const outputPath = resolve35(resolvedOutdir, `${entryName}.js`);
|
|
15503
15771
|
if (!existsSync41(outputPath)) {
|
|
15504
15772
|
console.error(cliTag4("\x1B[31m", `Expected output not found: ${outputPath}`));
|
|
15505
15773
|
process.exit(1);
|
|
15506
15774
|
}
|
|
15507
|
-
if (existsSync41(
|
|
15508
|
-
const vendorDir =
|
|
15775
|
+
if (existsSync41(resolve35(resolvedOutdir, "angular", "vendor", "server"))) {
|
|
15776
|
+
const vendorDir = resolve35(resolvedOutdir, "angular", "vendor", "server");
|
|
15509
15777
|
const vendorEntries = readdirSync7(vendorDir).filter((fileName) => fileName.endsWith(".js"));
|
|
15510
15778
|
const angularServerVendorPaths = {};
|
|
15511
15779
|
for (const file of vendorEntries) {
|
|
@@ -15514,7 +15782,7 @@ export default server;
|
|
|
15514
15782
|
if (scope !== "angular" || rest.length === 0)
|
|
15515
15783
|
continue;
|
|
15516
15784
|
const specifier = `@angular/${rest.join("/")}`;
|
|
15517
|
-
const relPath = relative22(
|
|
15785
|
+
const relPath = relative22(dirname27(outputPath), resolve35(vendorDir, file));
|
|
15518
15786
|
angularServerVendorPaths[specifier] = relPath.startsWith(".") ? relPath : `./${relPath}`;
|
|
15519
15787
|
}
|
|
15520
15788
|
if (Object.keys(angularServerVendorPaths).length > 0) {
|
|
@@ -15526,7 +15794,7 @@ export default server;
|
|
|
15526
15794
|
copyServerRuntimeAssetReferences(resolvedOutdir);
|
|
15527
15795
|
const prerenderStart = performance.now();
|
|
15528
15796
|
process.stdout.write(cliTag4("\x1B[36m", "Pre-rendering pages"));
|
|
15529
|
-
rmSync7(
|
|
15797
|
+
rmSync7(join44(resolvedOutdir, "_prerendered"), {
|
|
15530
15798
|
force: true,
|
|
15531
15799
|
recursive: true
|
|
15532
15800
|
});
|
|
@@ -15556,9 +15824,9 @@ export default server;
|
|
|
15556
15824
|
const compileStart = performance.now();
|
|
15557
15825
|
process.stdout.write(cliTag4("\x1B[36m", "Compiling standalone executable"));
|
|
15558
15826
|
const entrypointCode = generateEntrypoint(resolvedOutdir, serverEntry, prerenderMap, absoluteVersion, buildConfig);
|
|
15559
|
-
const entrypointPath =
|
|
15827
|
+
const entrypointPath = join44(resolvedOutdir, "_compile_entrypoint.ts");
|
|
15560
15828
|
await Bun.write(entrypointPath, entrypointCode);
|
|
15561
|
-
mkdirSync18(
|
|
15829
|
+
mkdirSync18(dirname27(resolvedOutfile), { recursive: true });
|
|
15562
15830
|
const result = await Bun.build({
|
|
15563
15831
|
compile: { outfile: resolvedOutfile },
|
|
15564
15832
|
define: { "process.env.NODE_ENV": '"production"' },
|
|
@@ -15642,7 +15910,7 @@ var init_compile = __esm(() => {
|
|
|
15642
15910
|
|
|
15643
15911
|
// src/mobile/nativeDeepLinks.ts
|
|
15644
15912
|
import { readFile as readFile11, rename as rename8, writeFile as writeFile9 } from "fs/promises";
|
|
15645
|
-
import { join as
|
|
15913
|
+
import { join as join45 } from "path";
|
|
15646
15914
|
var START_MARKER = "<!-- absolutejs:deep-links:start -->", END_MARKER = "<!-- absolutejs:deep-links:end -->", IOS_ENTITLEMENTS = "App/AbsoluteJS.entitlements", NOT_FOUND = -1, escapeXml = (value) => value.replaceAll("&", "&").replaceAll('"', """).replaceAll("'", "'").replaceAll("<", "<").replaceAll(">", ">"), writeChangedFile = async (path, source) => {
|
|
15647
15915
|
const current = await readFile11(path, "utf8");
|
|
15648
15916
|
if (current === source)
|
|
@@ -15671,7 +15939,7 @@ var START_MARKER = "<!-- absolutejs:deep-links:start -->", END_MARKER = "<!-- ab
|
|
|
15671
15939
|
}
|
|
15672
15940
|
return `${source.slice(0, index)}${region}${source.slice(index)}`;
|
|
15673
15941
|
}, androidRegion = (config) => {
|
|
15674
|
-
const hosts = config.deepLinkHosts.map((
|
|
15942
|
+
const hosts = config.deepLinkHosts.map((host2) => ` <data android:scheme="https" android:host="${escapeXml(host2)}" />`).join(`
|
|
15675
15943
|
`);
|
|
15676
15944
|
const customScheme = config.deepLinkScheme ? `
|
|
15677
15945
|
|
|
@@ -15691,7 +15959,7 @@ ${hosts}
|
|
|
15691
15959
|
${END_MARKER}
|
|
15692
15960
|
`;
|
|
15693
15961
|
}, configureAndroid = async (config) => {
|
|
15694
|
-
const path =
|
|
15962
|
+
const path = join45(config.nativeProjectDirectory, "android/app/src/main/AndroidManifest.xml");
|
|
15695
15963
|
const source = await readFile11(path, "utf8");
|
|
15696
15964
|
const mainActivity = source.indexOf('android:name=".MainActivity"');
|
|
15697
15965
|
if (mainActivity === NOT_FOUND) {
|
|
@@ -15715,7 +15983,7 @@ ${hosts}
|
|
|
15715
15983
|
</array>
|
|
15716
15984
|
${END_MARKER}
|
|
15717
15985
|
`, configureIosInfo = async (config) => {
|
|
15718
|
-
const path =
|
|
15986
|
+
const path = join45(config.nativeProjectDirectory, "ios/App/App/Info.plist");
|
|
15719
15987
|
const source = await readFile11(path, "utf8");
|
|
15720
15988
|
const region = config.deepLinkScheme ? iosSchemeRegion(config.deepLinkScheme) : ` ${START_MARKER}
|
|
15721
15989
|
${END_MARKER}
|
|
@@ -15723,7 +15991,7 @@ ${hosts}
|
|
|
15723
15991
|
const updated = replaceManagedRegion(source, region, () => source.lastIndexOf("</dict>"));
|
|
15724
15992
|
return writeChangedFile(path, updated);
|
|
15725
15993
|
}, iosEntitlementsSource = (config) => {
|
|
15726
|
-
const domains = config.deepLinkHosts.map((
|
|
15994
|
+
const domains = config.deepLinkHosts.map((host2) => ` <string>applinks:${escapeXml(host2)}</string>`).join(`
|
|
15727
15995
|
`);
|
|
15728
15996
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
15729
15997
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
@@ -15737,7 +16005,7 @@ ${domains}
|
|
|
15737
16005
|
</plist>
|
|
15738
16006
|
`;
|
|
15739
16007
|
}, configureIosEntitlements = async (config) => {
|
|
15740
|
-
const path =
|
|
16008
|
+
const path = join45(config.nativeProjectDirectory, "ios/App/AbsoluteJS.entitlements");
|
|
15741
16009
|
let current = "";
|
|
15742
16010
|
try {
|
|
15743
16011
|
current = await readFile11(path, "utf8");
|
|
@@ -15754,7 +16022,7 @@ ${domains}
|
|
|
15754
16022
|
await rename8(temporary, path);
|
|
15755
16023
|
return true;
|
|
15756
16024
|
}, configureIosProject = async (config) => {
|
|
15757
|
-
const path =
|
|
16025
|
+
const path = join45(config.nativeProjectDirectory, "ios/App/App.xcodeproj/project.pbxproj");
|
|
15758
16026
|
const source = await readFile11(path, "utf8");
|
|
15759
16027
|
const declarations = [
|
|
15760
16028
|
...source.matchAll(/CODE_SIGN_ENTITLEMENTS = ([^;]+);/g)
|
|
@@ -15794,7 +16062,7 @@ var init_nativeDeepLinks = () => {};
|
|
|
15794
16062
|
|
|
15795
16063
|
// src/mobile/nativeBackgroundSync.ts
|
|
15796
16064
|
import { readFile as readFile12, rename as rename9, writeFile as writeFile10 } from "fs/promises";
|
|
15797
|
-
import { join as
|
|
16065
|
+
import { join as join46 } from "path";
|
|
15798
16066
|
var writeChanged = async (path, source) => {
|
|
15799
16067
|
const current = await readFile12(path, "utf8");
|
|
15800
16068
|
if (current === source)
|
|
@@ -15877,10 +16145,10 @@ ${makeRegion(values)} </array>
|
|
|
15877
16145
|
if (!platforms.includes("ios") || !projectUsesAbsoluteAuth(projectRoot) || !projectUsesAbsoluteSync(projectRoot))
|
|
15878
16146
|
return { changed: false };
|
|
15879
16147
|
const identifier = `${config.appId}.absolutejs.background-sync`;
|
|
15880
|
-
const infoPath =
|
|
16148
|
+
const infoPath = join46(config.nativeProjectDirectory, "ios/App/App/Info.plist");
|
|
15881
16149
|
const info2 = await readFile12(infoPath, "utf8");
|
|
15882
16150
|
const nextInfo = ensurePlistArrayValues(ensurePlistArrayValues(info2, "BGTaskSchedulerPermittedIdentifiers", [identifier], "background-sync-identifiers"), "UIBackgroundModes", ["fetch", "processing"], "background-sync-modes");
|
|
15883
|
-
const delegatePath =
|
|
16151
|
+
const delegatePath = join46(config.nativeProjectDirectory, "ios/App/App/AppDelegate.swift");
|
|
15884
16152
|
let delegate = await readFile12(delegatePath, "utf8");
|
|
15885
16153
|
if (!delegate.includes("import AbsoluteSyncCapacitor")) {
|
|
15886
16154
|
const importIndex = delegate.lastIndexOf("import Capacitor");
|
|
@@ -15920,7 +16188,7 @@ import {
|
|
|
15920
16188
|
rm as rm7,
|
|
15921
16189
|
writeFile as writeFile11
|
|
15922
16190
|
} from "fs/promises";
|
|
15923
|
-
import { resolve as
|
|
16191
|
+
import { resolve as resolve36 } from "path";
|
|
15924
16192
|
import { Elysia } from "elysia";
|
|
15925
16193
|
var OWNERSHIP_FILE = ".absolutejs-mobile-associations.json", HTTP_OK = 200, VERIFY_TIMEOUT_MS = 1e4, ANDROID_ASSOCIATION_PATH = "/.well-known/assetlinks.json", APPLE_ASSOCIATION_PATH = "/.well-known/apple-app-site-association", missingIdentity = (field, platform6) => new TypeError(`${field} is required to publish ${platform6} deep-link association files.`), createAppleDocument = (config, requireAll) => {
|
|
15926
16194
|
if (!config.platforms.includes("ios"))
|
|
@@ -15993,7 +16261,7 @@ var OWNERSHIP_FILE = ".absolutejs-mobile-associations.json", HTTP_OK = 200, VERI
|
|
|
15993
16261
|
return false;
|
|
15994
16262
|
}
|
|
15995
16263
|
}, assertOwnedOutput = async (root) => {
|
|
15996
|
-
const path =
|
|
16264
|
+
const path = resolve36(root, OWNERSHIP_FILE);
|
|
15997
16265
|
let ownership;
|
|
15998
16266
|
try {
|
|
15999
16267
|
ownership = JSON.parse(await readFile13(path, "utf8"));
|
|
@@ -16019,34 +16287,34 @@ var OWNERSHIP_FILE = ".absolutejs-mobile-associations.json", HTTP_OK = 200, VERI
|
|
|
16019
16287
|
}
|
|
16020
16288
|
if (hasCurrent)
|
|
16021
16289
|
await rm7(backup, { force: true, recursive: true });
|
|
16022
|
-
}, materializeHost = async (root,
|
|
16023
|
-
const directory =
|
|
16290
|
+
}, materializeHost = async (root, host2, files) => {
|
|
16291
|
+
const directory = resolve36(root, host2, ".well-known");
|
|
16024
16292
|
await mkdir10(directory, { recursive: true });
|
|
16025
16293
|
return Promise.all(files.map(async ([name, document]) => {
|
|
16026
|
-
const path =
|
|
16294
|
+
const path = resolve36(directory, name);
|
|
16027
16295
|
await writeAtomic(path, `${JSON.stringify(document, null, 2)}
|
|
16028
16296
|
`);
|
|
16029
16297
|
return path;
|
|
16030
16298
|
}));
|
|
16031
|
-
}, associationEndpoints = (config, documents) => config.deepLinkHosts.flatMap((
|
|
16299
|
+
}, associationEndpoints = (config, documents) => config.deepLinkHosts.flatMap((host2) => {
|
|
16032
16300
|
const endpoints = [];
|
|
16033
16301
|
if (documents.android)
|
|
16034
16302
|
endpoints.push({
|
|
16035
16303
|
document: documents.android,
|
|
16036
|
-
host,
|
|
16304
|
+
host: host2,
|
|
16037
16305
|
path: ANDROID_ASSOCIATION_PATH,
|
|
16038
16306
|
platform: "Android"
|
|
16039
16307
|
});
|
|
16040
16308
|
if (documents.apple)
|
|
16041
16309
|
endpoints.push({
|
|
16042
16310
|
document: documents.apple,
|
|
16043
|
-
host,
|
|
16311
|
+
host: host2,
|
|
16044
16312
|
path: APPLE_ASSOCIATION_PATH,
|
|
16045
16313
|
platform: "Apple"
|
|
16046
16314
|
});
|
|
16047
16315
|
return endpoints;
|
|
16048
16316
|
}), materializeAbsoluteMobileAssociationFiles = async (config, outputDirectory) => {
|
|
16049
|
-
const root =
|
|
16317
|
+
const root = resolve36(outputDirectory);
|
|
16050
16318
|
const temporary = `${root}.${crypto.randomUUID()}.tmp`;
|
|
16051
16319
|
const documents = createAbsoluteMobileAssociationDocuments(config, {
|
|
16052
16320
|
requireAll: true
|
|
@@ -16059,11 +16327,11 @@ var OWNERSHIP_FILE = ".absolutejs-mobile-associations.json", HTTP_OK = 200, VERI
|
|
|
16059
16327
|
}
|
|
16060
16328
|
await mkdir10(temporary, { recursive: true });
|
|
16061
16329
|
try {
|
|
16062
|
-
const temporaryPaths = (await Promise.all(config.deepLinkHosts.map((
|
|
16063
|
-
await writeAtomic(
|
|
16330
|
+
const temporaryPaths = (await Promise.all(config.deepLinkHosts.map((host2) => materializeHost(temporary, host2, files)))).flat();
|
|
16331
|
+
await writeAtomic(resolve36(temporary, OWNERSHIP_FILE), `${JSON.stringify({ format: 1, hosts: config.deepLinkHosts }, null, 2)}
|
|
16064
16332
|
`);
|
|
16065
16333
|
await publishGeneratedDirectory(temporary, root);
|
|
16066
|
-
const written = temporaryPaths.map((path) =>
|
|
16334
|
+
const written = temporaryPaths.map((path) => resolve36(root, path.slice(temporary.length + 1)));
|
|
16067
16335
|
return { root, written };
|
|
16068
16336
|
} catch (error) {
|
|
16069
16337
|
await rm7(temporary, { force: true, recursive: true });
|
|
@@ -16105,7 +16373,7 @@ var init_associationFiles = __esm(() => {
|
|
|
16105
16373
|
|
|
16106
16374
|
// src/mobile/androidWebView.ts
|
|
16107
16375
|
import { mkdir as mkdir11, writeFile as writeFile12 } from "fs/promises";
|
|
16108
|
-
import { dirname as
|
|
16376
|
+
import { dirname as dirname28, resolve as resolve37 } from "path";
|
|
16109
16377
|
|
|
16110
16378
|
class CdpConnection {
|
|
16111
16379
|
diagnostics = [];
|
|
@@ -16376,8 +16644,8 @@ var CDP_COMMAND_TIMEOUT_MS = 1e4, WEBVIEW_ATTACH_TIMEOUT_MS = 30000, WEBVIEW_POL
|
|
|
16376
16644
|
if (typeof data !== "string") {
|
|
16377
16645
|
throw new Error("Android WebView screenshot returned no image data.");
|
|
16378
16646
|
}
|
|
16379
|
-
const absolutePath =
|
|
16380
|
-
await mkdir11(
|
|
16647
|
+
const absolutePath = resolve37(path);
|
|
16648
|
+
await mkdir11(dirname28(absolutePath), { recursive: true });
|
|
16381
16649
|
await writeFile12(absolutePath, Buffer.from(data, "base64"));
|
|
16382
16650
|
return absolutePath;
|
|
16383
16651
|
}
|
|
@@ -16497,7 +16765,7 @@ var DEFAULT_ROUTE_TIMEOUT_MS = 30000, DEFAULT_HMR_TIMEOUT_MS = 30000, routeExpre
|
|
|
16497
16765
|
|
|
16498
16766
|
// src/mobile/releaseDoctor.ts
|
|
16499
16767
|
import { access as access8, readFile as readFile14, readdir as readdir4 } from "fs/promises";
|
|
16500
|
-
import { extname as extname7, join as
|
|
16768
|
+
import { extname as extname7, join as join47, relative as relative23 } from "path";
|
|
16501
16769
|
var HMR_ASSET_PATTERN, RELEASE_ASSET_EXTENSIONS, pathExists5 = async (path) => {
|
|
16502
16770
|
try {
|
|
16503
16771
|
await access8(path);
|
|
@@ -16516,7 +16784,7 @@ var HMR_ASSET_PATTERN, RELEASE_ASSET_EXTENSIONS, pathExists5 = async (path) => {
|
|
|
16516
16784
|
if (!await pathExists5(root))
|
|
16517
16785
|
return;
|
|
16518
16786
|
const entries = await readdir4(root, { withFileTypes: true });
|
|
16519
|
-
const matches = await Promise.all(entries.map((entry) => inspectReleaseAsset(
|
|
16787
|
+
const matches = await Promise.all(entries.map((entry) => inspectReleaseAsset(join47(root, entry.name), entry.isDirectory(), entry.isFile())));
|
|
16520
16788
|
return matches.find((match) => match !== undefined);
|
|
16521
16789
|
}, pass = (id, detail, path) => ({ detail, id, path, status: "pass" }), fail5 = (id, detail, path, remediation) => ({
|
|
16522
16790
|
detail,
|
|
@@ -16560,12 +16828,23 @@ var HMR_ASSET_PATTERN, RELEASE_ASSET_EXTENSIONS, pathExists5 = async (path) => {
|
|
|
16560
16828
|
}, hmrAssetsReleaseCheck = async (publicRoot) => {
|
|
16561
16829
|
const hmrAsset = await findHmrAsset(publicRoot);
|
|
16562
16830
|
return hmrAsset ? fail5("android.hmr-assets", "A packaged Android asset contains the development HMR client.", hmrAsset, "Rebuild the production mobile bundle and run Capacitor sync again.") : pass("android.hmr-assets", "Packaged Android assets contain no development HMR markers.", publicRoot);
|
|
16831
|
+
}, syncSchemaReleaseCheck = (projectRoot) => {
|
|
16832
|
+
if (!projectUsesAbsoluteSync(projectRoot))
|
|
16833
|
+
return;
|
|
16834
|
+
const manifestPath = join47(projectRoot, "package.json");
|
|
16835
|
+
try {
|
|
16836
|
+
const schema = discoverAbsoluteSyncSchema(projectRoot);
|
|
16837
|
+
const versions = schema.components.map((component2) => `${component2.id}@${component2.version}`).join(", ");
|
|
16838
|
+
return pass("sync.storage-schema", `Generated offline schema is compatible: ${versions}.`, manifestPath);
|
|
16839
|
+
} catch (error) {
|
|
16840
|
+
return fail5("sync.storage-schema", error instanceof Error ? error.message : "Generated offline schema metadata is invalid.", manifestPath, "Fix absolutejs.sync.localSchema metadata in the named app or package before releasing.");
|
|
16841
|
+
}
|
|
16563
16842
|
}, inspectAndroidRelease = async (config, projectRoot) => {
|
|
16564
|
-
const androidRoot =
|
|
16565
|
-
const nativeConfigPath =
|
|
16566
|
-
const manifestPath =
|
|
16567
|
-
const publicRoot =
|
|
16568
|
-
const journalPath =
|
|
16843
|
+
const androidRoot = join47(config.nativeProjectDirectory, "android");
|
|
16844
|
+
const nativeConfigPath = join47(androidRoot, "app", "src", "main", "assets", "capacitor.config.json");
|
|
16845
|
+
const manifestPath = join47(androidRoot, "app", "src", "main", "AndroidManifest.xml");
|
|
16846
|
+
const publicRoot = join47(androidRoot, "app", "src", "main", "assets", "public");
|
|
16847
|
+
const journalPath = join47(projectRoot, ".absolutejs", "mobile", "dev-session", "journal.json");
|
|
16569
16848
|
const checks = await Promise.all([
|
|
16570
16849
|
journalReleaseCheck(journalPath, "android"),
|
|
16571
16850
|
capacitorConfigReleaseCheck(nativeConfigPath),
|
|
@@ -16577,11 +16856,11 @@ var HMR_ASSET_PATTERN, RELEASE_ASSET_EXTENSIONS, pathExists5 = async (path) => {
|
|
|
16577
16856
|
path: check2.path ? relative23(projectRoot, check2.path).replaceAll("\\", "/") || "." : undefined
|
|
16578
16857
|
}));
|
|
16579
16858
|
}, inspectIosRelease = async (config, projectRoot) => {
|
|
16580
|
-
const iosAppRoot =
|
|
16581
|
-
const nativeConfigPath =
|
|
16582
|
-
const infoPath =
|
|
16583
|
-
const publicRoot =
|
|
16584
|
-
const journalPath =
|
|
16859
|
+
const iosAppRoot = join47(config.nativeProjectDirectory, "ios", "App", "App");
|
|
16860
|
+
const nativeConfigPath = join47(iosAppRoot, "capacitor.config.json");
|
|
16861
|
+
const infoPath = join47(iosAppRoot, "Info.plist");
|
|
16862
|
+
const publicRoot = join47(iosAppRoot, "public");
|
|
16863
|
+
const journalPath = join47(projectRoot, ".absolutejs", "mobile", "ios-dev-session", "journal.json");
|
|
16585
16864
|
const checks = [
|
|
16586
16865
|
await journalReleaseCheck(journalPath, "ios")
|
|
16587
16866
|
];
|
|
@@ -16614,12 +16893,21 @@ var HMR_ASSET_PATTERN, RELEASE_ASSET_EXTENSIONS, pathExists5 = async (path) => {
|
|
|
16614
16893
|
if (config.platforms.includes("ios")) {
|
|
16615
16894
|
checks.push(...await inspectIosRelease(config, projectRoot));
|
|
16616
16895
|
}
|
|
16896
|
+
const syncSchema = syncSchemaReleaseCheck(projectRoot);
|
|
16897
|
+
if (syncSchema) {
|
|
16898
|
+
checks.push({
|
|
16899
|
+
...syncSchema,
|
|
16900
|
+
path: syncSchema.path ? relative23(projectRoot, syncSchema.path).replaceAll("\\", "/") || "." : undefined
|
|
16901
|
+
});
|
|
16902
|
+
}
|
|
16617
16903
|
return {
|
|
16618
16904
|
checks,
|
|
16619
16905
|
ready: checks.length > 0 && checks.every((check2) => check2.status === "pass")
|
|
16620
16906
|
};
|
|
16621
16907
|
};
|
|
16622
16908
|
var init_releaseDoctor = __esm(() => {
|
|
16909
|
+
init_nativeAuth();
|
|
16910
|
+
init_syncSchema();
|
|
16623
16911
|
HMR_ASSET_PATTERN = /(?:__HMR_WS__|hmr-timing|__absolute_target|absolutejs-error-overlay)/u;
|
|
16624
16912
|
RELEASE_ASSET_EXTENSIONS = new Set([".html", ".js", ".mjs"]);
|
|
16625
16913
|
});
|
|
@@ -16637,7 +16925,7 @@ import {
|
|
|
16637
16925
|
stat as stat2,
|
|
16638
16926
|
writeFile as writeFile13
|
|
16639
16927
|
} from "fs/promises";
|
|
16640
|
-
import { dirname as
|
|
16928
|
+
import { dirname as dirname29, isAbsolute as isAbsolute7, join as join48, relative as relative24, resolve as resolve38, sep as sep6 } from "path";
|
|
16641
16929
|
var ABSOLUTE_ANDROID_RELEASE_FORMAT = 1, isRecord13 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), requireManifest2 = (value) => {
|
|
16642
16930
|
if (!isRecord13(value) || typeof value.appBuild !== "string" || typeof value.appId !== "string" || typeof value.runtime !== "string") {
|
|
16643
16931
|
throw new TypeError("Invalid embedded AbsoluteJS mobile manifest.");
|
|
@@ -16688,19 +16976,19 @@ var ABSOLUTE_ANDROID_RELEASE_FORMAT = 1, isRecord13 = (value) => typeof value ==
|
|
|
16688
16976
|
]);
|
|
16689
16977
|
return result.exitCode === 0 && /jar verified/iu.test(result.stdout);
|
|
16690
16978
|
}, sha256File2 = async (path) => createHash12("sha256").update(await readFile15(path)).digest("hex"), safeOutputDirectory2 = (projectRoot, requested) => {
|
|
16691
|
-
const root =
|
|
16692
|
-
const output =
|
|
16979
|
+
const root = resolve38(projectRoot);
|
|
16980
|
+
const output = resolve38(root, requested ?? ".absolutejs/mobile/releases/android");
|
|
16693
16981
|
const projectRelative = relative24(root, output);
|
|
16694
16982
|
if (projectRelative === ".." || projectRelative.startsWith(`..${sep6}`) || isAbsolute7(projectRelative)) {
|
|
16695
16983
|
throw new TypeError("mobile build --outdir must remain inside the project.");
|
|
16696
16984
|
}
|
|
16697
16985
|
return output;
|
|
16698
16986
|
}, installRelease2 = async (artifactPath, metadata, outputRoot) => {
|
|
16699
|
-
const releaseRoot =
|
|
16987
|
+
const releaseRoot = join48(outputRoot, metadata.releaseId);
|
|
16700
16988
|
const artifactName = "app-release.aab";
|
|
16701
|
-
const destination =
|
|
16989
|
+
const destination = join48(releaseRoot, artifactName);
|
|
16702
16990
|
if (await pathExists6(releaseRoot)) {
|
|
16703
|
-
const existing = requireManifestIdentity(JSON.parse(await readFile15(
|
|
16991
|
+
const existing = requireManifestIdentity(JSON.parse(await readFile15(join48(releaseRoot, "release.json"), "utf8")), metadata);
|
|
16704
16992
|
const [installedBytes, installedSha256] = await Promise.all([
|
|
16705
16993
|
stat2(destination).then(({ size }) => size),
|
|
16706
16994
|
sha256File2(destination)
|
|
@@ -16710,15 +16998,15 @@ var ABSOLUTE_ANDROID_RELEASE_FORMAT = 1, isRecord13 = (value) => typeof value ==
|
|
|
16710
16998
|
}
|
|
16711
16999
|
return { artifactPath: destination, metadata: existing, releaseRoot };
|
|
16712
17000
|
}
|
|
16713
|
-
await mkdir12(
|
|
16714
|
-
const staging = await mkdtemp5(
|
|
17001
|
+
await mkdir12(dirname29(releaseRoot), { recursive: true });
|
|
17002
|
+
const staging = await mkdtemp5(join48(dirname29(releaseRoot), ".android-stage-"));
|
|
16715
17003
|
try {
|
|
16716
|
-
await copyFile5(artifactPath,
|
|
17004
|
+
await copyFile5(artifactPath, join48(staging, artifactName));
|
|
16717
17005
|
const complete = {
|
|
16718
17006
|
...metadata,
|
|
16719
17007
|
artifact: artifactName
|
|
16720
17008
|
};
|
|
16721
|
-
await writeFile13(
|
|
17009
|
+
await writeFile13(join48(staging, "release.json"), `${JSON.stringify(complete, null, "\t")}
|
|
16722
17010
|
`, { flag: "wx" });
|
|
16723
17011
|
await rename11(staging, releaseRoot);
|
|
16724
17012
|
return { artifactPath: destination, metadata: complete, releaseRoot };
|
|
@@ -16743,11 +17031,11 @@ var ABSOLUTE_ANDROID_RELEASE_FORMAT = 1, isRecord13 = (value) => typeof value ==
|
|
|
16743
17031
|
if (options.versionCode !== undefined && (!Number.isSafeInteger(options.versionCode) || options.versionCode < 1 || options.versionCode > 2100000000)) {
|
|
16744
17032
|
throw new TypeError("Android versionCode must be an integer from 1 through 2100000000.");
|
|
16745
17033
|
}
|
|
16746
|
-
const projectRoot =
|
|
16747
|
-
const
|
|
16748
|
-
const androidRoot = options.androidRoot ?? process.env.ANDROID_HOME ?? process.env.ANDROID_SDK_ROOT ?? absoluteManagedAndroidSdkRoot(
|
|
16749
|
-
const nativeDirectory =
|
|
16750
|
-
const manifest = requireManifest2(JSON.parse(await readFile15(
|
|
17034
|
+
const projectRoot = resolve38(options.projectRoot);
|
|
17035
|
+
const host2 = options.host ?? detectAbsoluteMobileHost();
|
|
17036
|
+
const androidRoot = options.androidRoot ?? process.env.ANDROID_HOME ?? process.env.ANDROID_SDK_ROOT ?? absoluteManagedAndroidSdkRoot(host2);
|
|
17037
|
+
const nativeDirectory = join48(options.config.nativeProjectDirectory, "android");
|
|
17038
|
+
const manifest = requireManifest2(JSON.parse(await readFile15(join48(options.config.bundleDirectory, "absolute-mobile-manifest.json"), "utf8")));
|
|
16751
17039
|
if (manifest.appId !== options.config.appId) {
|
|
16752
17040
|
throw new TypeError("Embedded mobile manifest appId does not match mobile.appId.");
|
|
16753
17041
|
}
|
|
@@ -16766,7 +17054,7 @@ var ABSOLUTE_ANDROID_RELEASE_FORMAT = 1, isRecord13 = (value) => typeof value ==
|
|
|
16766
17054
|
project: {
|
|
16767
17055
|
androidRoot,
|
|
16768
17056
|
config: options.config,
|
|
16769
|
-
host,
|
|
17057
|
+
host: host2,
|
|
16770
17058
|
nativeDirectory,
|
|
16771
17059
|
projectRoot
|
|
16772
17060
|
},
|
|
@@ -16871,7 +17159,7 @@ var init_iosConformance = __esm(() => {
|
|
|
16871
17159
|
|
|
16872
17160
|
// src/mobile/releasePublisher.ts
|
|
16873
17161
|
import { access as access10 } from "fs/promises";
|
|
16874
|
-
import { isAbsolute as isAbsolute8, relative as relative25, resolve as
|
|
17162
|
+
import { isAbsolute as isAbsolute8, relative as relative25, resolve as resolve39, sep as sep7 } from "path";
|
|
16875
17163
|
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
16876
17164
|
var prepareAbsoluteIosRelease = async (publisher, options) => {
|
|
16877
17165
|
if (typeof publisher.prepareIosRelease !== "function") {
|
|
@@ -16893,8 +17181,8 @@ var prepareAbsoluteIosRelease = async (publisher, options) => {
|
|
|
16893
17181
|
}
|
|
16894
17182
|
return versionCode;
|
|
16895
17183
|
}, isRecord14 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), isPublisher = (value) => isRecord14(value) && typeof value.publish === "function", publisherModulePath = (projectRoot, requested) => {
|
|
16896
|
-
const root =
|
|
16897
|
-
const path =
|
|
17184
|
+
const root = resolve39(projectRoot);
|
|
17185
|
+
const path = resolve39(root, requested);
|
|
16898
17186
|
const projectRelative = relative25(root, path);
|
|
16899
17187
|
if (projectRelative === ".." || projectRelative.startsWith(`..${sep7}`) || isAbsolute8(projectRelative)) {
|
|
16900
17188
|
throw new TypeError("mobile publish --registry must remain inside the project.");
|
|
@@ -16968,10 +17256,10 @@ __export(exports_mobile, {
|
|
|
16968
17256
|
runMobile: () => runMobile
|
|
16969
17257
|
});
|
|
16970
17258
|
import { access as access11, mkdir as mkdir13, readFile as readFile17, writeFile as writeFile14 } from "fs/promises";
|
|
16971
|
-
import { join as
|
|
17259
|
+
import { join as join49, resolve as resolve40 } from "path";
|
|
16972
17260
|
import { createInterface } from "readline/promises";
|
|
16973
17261
|
var NOT_FOUND2 = -1, isRecord15 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), CAPACITOR_PACKAGES, CAPACITOR_PACKAGE_SPECS, CAPACITOR_SYNC_PACKAGE_SPECS, packageNameFromSpec = (spec) => spec.slice(0, spec.lastIndexOf("@")), directProjectPackages = async (projectRoot) => {
|
|
16974
|
-
const manifest = JSON.parse(await readFile17(
|
|
17262
|
+
const manifest = JSON.parse(await readFile17(join49(projectRoot, "package.json"), "utf8"));
|
|
16975
17263
|
if (!isRecord15(manifest))
|
|
16976
17264
|
throw new TypeError("Application package.json must contain an object.");
|
|
16977
17265
|
const names = new Set;
|
|
@@ -17008,7 +17296,7 @@ var NOT_FOUND2 = -1, isRecord15 = (value) => typeof value === "object" && value
|
|
|
17008
17296
|
}
|
|
17009
17297
|
return value;
|
|
17010
17298
|
}, capacitorExecutable = async (projectRoot) => {
|
|
17011
|
-
const executable =
|
|
17299
|
+
const executable = join49(projectRoot, "node_modules", ".bin", "cap");
|
|
17012
17300
|
try {
|
|
17013
17301
|
await access11(executable);
|
|
17014
17302
|
return executable;
|
|
@@ -17094,7 +17382,7 @@ var NOT_FOUND2 = -1, isRecord15 = (value) => typeof value === "object" && value
|
|
|
17094
17382
|
await applyAbsoluteNativeBackgroundSync(projectRoot, mobile, platforms);
|
|
17095
17383
|
}, associations = async (args) => {
|
|
17096
17384
|
const { mobile, projectRoot } = await loadMobile(valueAfter(args, "--config"));
|
|
17097
|
-
const outputDirectory =
|
|
17385
|
+
const outputDirectory = resolve40(projectRoot, valueAfter(args, "--outdir") ?? ".absolutejs/mobile/associations");
|
|
17098
17386
|
if (args.includes("--verify")) {
|
|
17099
17387
|
const result2 = await verifyAbsoluteMobileAssociationFiles(mobile);
|
|
17100
17388
|
console.log(`Verified ${result2.results.length} hosted association files`);
|
|
@@ -17324,7 +17612,7 @@ Mobile release transport checks failed.`);
|
|
|
17324
17612
|
const durationMs = Math.round(performance.now() - startedAt);
|
|
17325
17613
|
console.log(`Built ${release.metadata.signed ? "signed" : "unsigned"} Android App Bundle in ${getDurationString(durationMs)}.`);
|
|
17326
17614
|
console.log(`Artifact: ${release.artifactPath}`);
|
|
17327
|
-
console.log(`Metadata: ${
|
|
17615
|
+
console.log(`Metadata: ${join49(release.releaseRoot, "release.json")}`);
|
|
17328
17616
|
return release;
|
|
17329
17617
|
} finally {
|
|
17330
17618
|
sendTelemetryEvent("mobile:android-release-build", {
|
|
@@ -17424,7 +17712,7 @@ Mobile release transport checks failed.`);
|
|
|
17424
17712
|
const durationMs = Math.round(performance.now() - startedAt);
|
|
17425
17713
|
console.log(`Built ${release.metadata.signed ? "signed" : "unsigned"} iOS IPA ${release.metadata.marketingVersion}${release.metadata.buildNumber ? ` (${release.metadata.buildNumber})` : ""} in ${getDurationString(durationMs)}.`);
|
|
17426
17714
|
console.log(`Artifact: ${release.artifactPath}`);
|
|
17427
|
-
console.log(`Metadata: ${
|
|
17715
|
+
console.log(`Metadata: ${join49(release.releaseRoot, "release.json")}`);
|
|
17428
17716
|
return release;
|
|
17429
17717
|
} finally {
|
|
17430
17718
|
sendTelemetryEvent("mobile:ios-release-build", {
|
|
@@ -17523,6 +17811,28 @@ Mobile release transport checks failed.`);
|
|
|
17523
17811
|
}
|
|
17524
17812
|
];
|
|
17525
17813
|
}
|
|
17814
|
+
}, appendSyncSchemaDoctorCheck = (checks, projectRoot) => {
|
|
17815
|
+
if (!projectUsesAbsoluteSync(projectRoot))
|
|
17816
|
+
return;
|
|
17817
|
+
try {
|
|
17818
|
+
const schema = discoverAbsoluteSyncSchema(projectRoot);
|
|
17819
|
+
checks.push({
|
|
17820
|
+
id: "sync.storage-schema",
|
|
17821
|
+
label: `Offline schema ${schema.components.map((component2) => `${component2.id}@${component2.version}`).join(", ")}`,
|
|
17822
|
+
path: join49(projectRoot, "package.json"),
|
|
17823
|
+
platform: "host",
|
|
17824
|
+
status: "pass"
|
|
17825
|
+
});
|
|
17826
|
+
} catch (error) {
|
|
17827
|
+
checks.push({
|
|
17828
|
+
id: "sync.storage-schema",
|
|
17829
|
+
label: "Offline schema metadata is invalid",
|
|
17830
|
+
path: join49(projectRoot, "package.json"),
|
|
17831
|
+
platform: "host",
|
|
17832
|
+
remediation: error instanceof Error ? error.message : String(error),
|
|
17833
|
+
status: "fail"
|
|
17834
|
+
});
|
|
17835
|
+
}
|
|
17526
17836
|
}, doctor = async (args) => {
|
|
17527
17837
|
if (args.includes("release")) {
|
|
17528
17838
|
await runReleaseDoctor(args);
|
|
@@ -17542,6 +17852,7 @@ Mobile release transport checks failed.`);
|
|
|
17542
17852
|
return;
|
|
17543
17853
|
}
|
|
17544
17854
|
const checks = await inspectAbsoluteMobileToolchain();
|
|
17855
|
+
appendSyncSchemaDoctorCheck(checks, process.cwd());
|
|
17545
17856
|
const selected = platform6 ? checks.filter((check2) => check2.platform === "host" || check2.platform === platform6) : checks;
|
|
17546
17857
|
if (args.includes("--json")) {
|
|
17547
17858
|
if (args.includes("--fix")) {
|
|
@@ -17601,7 +17912,7 @@ Emulator setup verification:`);
|
|
|
17601
17912
|
}
|
|
17602
17913
|
return { https: args.includes("--https"), port };
|
|
17603
17914
|
}
|
|
17604
|
-
const instances = listLiveInstances().filter((instance2) =>
|
|
17915
|
+
const instances = listLiveInstances().filter((instance2) => resolve40(instance2.cwd) === resolve40(projectRoot) && instance2.source === "dev" && instance2.port !== null);
|
|
17605
17916
|
if (instances.length !== 1) {
|
|
17606
17917
|
throw new TypeError(instances.length === 0 ? "No running AbsoluteJS dev server was found for this project. Start `bun dev`, wait for Android to report ready, then run `absolute mobile test android`." : "Multiple dev servers are running for this project. Select one with mobile test android --port <port>.");
|
|
17607
17918
|
}
|
|
@@ -17644,8 +17955,8 @@ Emulator setup verification:`);
|
|
|
17644
17955
|
}
|
|
17645
17956
|
return selected;
|
|
17646
17957
|
}, safeArtifactRoot = (projectRoot, value) => {
|
|
17647
|
-
const root =
|
|
17648
|
-
if (root !== projectRoot && !root.startsWith(`${
|
|
17958
|
+
const root = resolve40(projectRoot, value ?? ".absolutejs/mobile/test-artifacts");
|
|
17959
|
+
if (root !== projectRoot && !root.startsWith(`${resolve40(projectRoot)}/`)) {
|
|
17649
17960
|
throw new TypeError("mobile test --artifacts must remain inside the project.");
|
|
17650
17961
|
}
|
|
17651
17962
|
return root;
|
|
@@ -17670,10 +17981,10 @@ Emulator setup verification:`);
|
|
|
17670
17981
|
});
|
|
17671
17982
|
}, writeAndroidFailureArtifacts = async (options) => {
|
|
17672
17983
|
await mkdir13(options.artifactRoot, { recursive: true });
|
|
17673
|
-
const screenshot = options.session ? await options.session.screenshot(
|
|
17984
|
+
const screenshot = options.session ? await options.session.screenshot(join49(options.artifactRoot, "android-failure.png")).catch(() => {
|
|
17674
17985
|
return;
|
|
17675
17986
|
}) : undefined;
|
|
17676
|
-
const diagnosticPath =
|
|
17987
|
+
const diagnosticPath = join49(options.artifactRoot, "android-failure.json");
|
|
17677
17988
|
await writeFile14(diagnosticPath, `${JSON.stringify({
|
|
17678
17989
|
diagnostics: options.session?.diagnostics ?? [],
|
|
17679
17990
|
error: options.error instanceof Error ? options.error.message : String(options.error),
|
|
@@ -17764,14 +18075,14 @@ Emulator setup verification:`);
|
|
|
17764
18075
|
const port = Number(explicit);
|
|
17765
18076
|
if (!Number.isInteger(port) || port < 1 || port > 65535)
|
|
17766
18077
|
throw new TypeError("mobile test --port must be a valid TCP port.");
|
|
17767
|
-
const instance2 = listLiveInstances().find((candidate) =>
|
|
18078
|
+
const instance2 = listLiveInstances().find((candidate) => resolve40(candidate.cwd) === resolve40(projectRoot) && candidate.source === "dev" && candidate.port === port);
|
|
17768
18079
|
return {
|
|
17769
18080
|
https: instance2?.https ?? args.includes("--https"),
|
|
17770
18081
|
instance: instance2,
|
|
17771
18082
|
port
|
|
17772
18083
|
};
|
|
17773
18084
|
}
|
|
17774
|
-
const instances = listLiveInstances().filter((instance2) =>
|
|
18085
|
+
const instances = listLiveInstances().filter((instance2) => resolve40(instance2.cwd) === resolve40(projectRoot) && instance2.source === "dev" && instance2.port !== null);
|
|
17775
18086
|
if (instances.length !== 1)
|
|
17776
18087
|
throw new TypeError(instances.length === 0 ? "No running AbsoluteJS dev server was found for this project. Start `bun dev`, wait for iOS to report ready, then run `absolute mobile test ios`." : "Multiple dev servers are running for this project. Select one with mobile test ios --port <port>.");
|
|
17777
18088
|
const [instance] = instances;
|
|
@@ -17851,7 +18162,7 @@ Emulator setup verification:`);
|
|
|
17851
18162
|
return result;
|
|
17852
18163
|
}, writeIosFailureArtifacts = async (options) => {
|
|
17853
18164
|
await mkdir13(options.artifactRoot, { recursive: true });
|
|
17854
|
-
const screenshot =
|
|
18165
|
+
const screenshot = join49(options.artifactRoot, "ios-failure.png");
|
|
17855
18166
|
const screenshotResult = captureCommand4([
|
|
17856
18167
|
options.xcrun,
|
|
17857
18168
|
"simctl",
|
|
@@ -17860,7 +18171,7 @@ Emulator setup verification:`);
|
|
|
17860
18171
|
"screenshot",
|
|
17861
18172
|
screenshot
|
|
17862
18173
|
]);
|
|
17863
|
-
const diagnosticPath =
|
|
18174
|
+
const diagnosticPath = join49(options.artifactRoot, "ios-failure.json");
|
|
17864
18175
|
await writeFile14(diagnosticPath, `${JSON.stringify({
|
|
17865
18176
|
appId: options.appId,
|
|
17866
18177
|
error: options.error instanceof Error ? options.error.message : String(options.error),
|
|
@@ -17906,7 +18217,7 @@ Emulator setup verification:`);
|
|
|
17906
18217
|
], "iOS app launch");
|
|
17907
18218
|
await waitForIosHmrClient({ https, port, timeoutMs });
|
|
17908
18219
|
await mkdir13(artifactRoot, { recursive: true });
|
|
17909
|
-
const screenshot =
|
|
18220
|
+
const screenshot = join49(artifactRoot, "ios-simulator.png");
|
|
17910
18221
|
requireCapturedIosCommand([xcrun, "simctl", "io", simulator.udid, "screenshot", screenshot], "iOS simulator screenshot");
|
|
17911
18222
|
const hmrApply = await waitForRequestedIosHmr(args, instance, timeoutMs);
|
|
17912
18223
|
const report = {
|
|
@@ -18030,6 +18341,7 @@ var init_mobile = __esm(() => {
|
|
|
18030
18341
|
init_getDurationString();
|
|
18031
18342
|
init_remoteMacProtocol();
|
|
18032
18343
|
init_nativeAuth();
|
|
18344
|
+
init_syncSchema();
|
|
18033
18345
|
CAPACITOR_PACKAGES = [
|
|
18034
18346
|
"@capacitor/core",
|
|
18035
18347
|
"@capacitor/app",
|
|
@@ -18055,7 +18367,7 @@ var init_mobile = __esm(() => {
|
|
|
18055
18367
|
"@absolutejs/devices-capacitor@0.1.3"
|
|
18056
18368
|
];
|
|
18057
18369
|
CAPACITOR_SYNC_PACKAGE_SPECS = [
|
|
18058
|
-
"@absolutejs/sync-capacitor@0.
|
|
18370
|
+
"@absolutejs/sync-capacitor@0.6.1",
|
|
18059
18371
|
"@capacitor-community/sqlite@8.1.1"
|
|
18060
18372
|
];
|
|
18061
18373
|
});
|
|
@@ -18065,10 +18377,10 @@ var exports_typecheck = {};
|
|
|
18065
18377
|
__export(exports_typecheck, {
|
|
18066
18378
|
typecheck: () => typecheck
|
|
18067
18379
|
});
|
|
18068
|
-
import { resolve as
|
|
18069
|
-
import { existsSync as existsSync42, readFileSync as
|
|
18380
|
+
import { resolve as resolve41, join as join50 } from "path";
|
|
18381
|
+
import { existsSync as existsSync42, readFileSync as readFileSync39 } from "fs";
|
|
18070
18382
|
import { mkdir as mkdir14, writeFile as writeFile15 } from "fs/promises";
|
|
18071
|
-
var isCommandService3 = (service) => service.kind === "command" || Array.isArray(service.command), resolveConfigPath = (configPath2) =>
|
|
18383
|
+
var isCommandService3 = (service) => service.kind === "command" || Array.isArray(service.command), resolveConfigPath = (configPath2) => resolve41(configPath2 ?? process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts"), getTypecheckTargets = async (configPath2) => {
|
|
18072
18384
|
if (!existsSync42(resolveConfigPath(configPath2))) {
|
|
18073
18385
|
const defaultService = {};
|
|
18074
18386
|
return [defaultService];
|
|
@@ -18090,7 +18402,7 @@ var isCommandService3 = (service) => service.kind === "command" || Array.isArray
|
|
|
18090
18402
|
const exitCode = await proc.exited;
|
|
18091
18403
|
return { exitCode, name, output: (stdout + stderr).trim() };
|
|
18092
18404
|
}, shellEscape = (value) => `'${value.replaceAll("'", "'\\''")}'`, runShell = async (name, command) => run(name, ["/bin/bash", "-lc", command]), findBin = (name) => {
|
|
18093
|
-
const local =
|
|
18405
|
+
const local = resolve41("node_modules", ".bin", name);
|
|
18094
18406
|
return existsSync42(local) ? local : null;
|
|
18095
18407
|
}, ANSI_COLOR_REGEX, ANSI_PURPLE_REGEX, ANSI_CYAN_REGEX, ANSI_TOKEN_END_REGEX, stripAnsi4 = (str) => str.replace(ANSI_COLOR_REGEX, ""), formatSvelteOutput = (output) => {
|
|
18096
18408
|
const cwd = `${process.cwd()}/`;
|
|
@@ -18138,15 +18450,15 @@ Found ${errorCount} error${suffix}.`;
|
|
|
18138
18450
|
return formatted;
|
|
18139
18451
|
}, ABSOLUTE_INTERNAL_EXCLUDES, resolveAbsoluteTypeFile = (fileName) => {
|
|
18140
18452
|
const candidates = [
|
|
18141
|
-
|
|
18142
|
-
|
|
18143
|
-
|
|
18144
|
-
|
|
18453
|
+
resolve41("node_modules/@absolutejs/absolute/dist/types", fileName),
|
|
18454
|
+
resolve41(import.meta.dir, "../types", fileName),
|
|
18455
|
+
resolve41(import.meta.dir, "../../types", fileName),
|
|
18456
|
+
resolve41(import.meta.dir, "../../../types", fileName)
|
|
18145
18457
|
];
|
|
18146
18458
|
return candidates.find((candidate) => existsSync42(candidate)) ?? candidates[0];
|
|
18147
18459
|
}, ABSOLUTE_TYPECHECK_FILES, readProjectTsconfig = () => {
|
|
18148
18460
|
try {
|
|
18149
|
-
return JSON.parse(
|
|
18461
|
+
return JSON.parse(readFileSync39(resolve41("tsconfig.json"), "utf-8"));
|
|
18150
18462
|
} catch {
|
|
18151
18463
|
return {};
|
|
18152
18464
|
}
|
|
@@ -18168,37 +18480,44 @@ Found ${errorCount} error${suffix}.`;
|
|
|
18168
18480
|
...excludes.map(toGeneratedConfigPath)
|
|
18169
18481
|
])
|
|
18170
18482
|
];
|
|
18171
|
-
}, buildVueTscCheck = (cacheDir) => {
|
|
18483
|
+
}, buildVueTscCheck = async (cacheDir) => {
|
|
18172
18484
|
const vueTscBin = findBin("vue-tsc");
|
|
18173
18485
|
if (!vueTscBin) {
|
|
18174
18486
|
console.error("\x1B[31m\u2717\x1B[0m vue-tsc is required for Vue type checking. Install it: bun add -d vue-tsc");
|
|
18175
18487
|
process.exit(1);
|
|
18176
18488
|
}
|
|
18177
|
-
const vueTsconfigPath =
|
|
18178
|
-
|
|
18489
|
+
const vueTsconfigPath = join50(cacheDir, "tsconfig.vue-check.json");
|
|
18490
|
+
await writeFile15(vueTsconfigPath, JSON.stringify({
|
|
18179
18491
|
compilerOptions: {
|
|
18180
18492
|
rootDir: ".."
|
|
18181
18493
|
},
|
|
18182
18494
|
exclude: getProjectTypecheckExcludes(),
|
|
18183
|
-
extends:
|
|
18495
|
+
extends: resolve41("tsconfig.json"),
|
|
18184
18496
|
include: getProjectTypecheckIncludes()
|
|
18185
|
-
}, null, "\t"))
|
|
18497
|
+
}, null, "\t"));
|
|
18498
|
+
const base = [
|
|
18186
18499
|
vueTscBin,
|
|
18187
18500
|
"--noEmit",
|
|
18188
18501
|
"--project",
|
|
18189
|
-
|
|
18502
|
+
resolve41(vueTsconfigPath),
|
|
18503
|
+
"--pretty"
|
|
18504
|
+
];
|
|
18505
|
+
const cached = await run("vue-tsc", [
|
|
18506
|
+
...base,
|
|
18190
18507
|
"--incremental",
|
|
18191
18508
|
"--tsBuildInfoFile",
|
|
18192
|
-
|
|
18193
|
-
|
|
18194
|
-
|
|
18509
|
+
join50(cacheDir, "vue-tsc.tsbuildinfo")
|
|
18510
|
+
]);
|
|
18511
|
+
if (cached.exitCode === 0 || cached.output.length > 0)
|
|
18512
|
+
return cached;
|
|
18513
|
+
return run("vue-tsc", base);
|
|
18195
18514
|
}, buildAngularCheck = async (cacheDir, angularDir) => {
|
|
18196
18515
|
const ngcBin = findBin("ngc");
|
|
18197
18516
|
if (!ngcBin) {
|
|
18198
18517
|
console.error("\x1B[31m\u2717\x1B[0m @angular/compiler-cli is required for Angular type checking. Install it: bun add -d @angular/compiler-cli");
|
|
18199
18518
|
process.exit(1);
|
|
18200
18519
|
}
|
|
18201
|
-
const angularTsconfigPath =
|
|
18520
|
+
const angularTsconfigPath = join50(cacheDir, "tsconfig.angular-check.json");
|
|
18202
18521
|
await writeFile15(angularTsconfigPath, JSON.stringify({
|
|
18203
18522
|
angularCompilerOptions: {
|
|
18204
18523
|
strictTemplates: true
|
|
@@ -18208,32 +18527,32 @@ Found ${errorCount} error${suffix}.`;
|
|
|
18208
18527
|
rootDir: ".."
|
|
18209
18528
|
},
|
|
18210
18529
|
exclude: ABSOLUTE_INTERNAL_EXCLUDES.map(toGeneratedConfigPath),
|
|
18211
|
-
extends:
|
|
18530
|
+
extends: resolve41("tsconfig.json"),
|
|
18212
18531
|
include: [`../${angularDir}/**/*`]
|
|
18213
18532
|
}, null, "\t"));
|
|
18214
|
-
return runShell("ngc", `${shellEscape(ngcBin)} -p ${shellEscape(
|
|
18533
|
+
return runShell("ngc", `${shellEscape(ngcBin)} -p ${shellEscape(resolve41(angularTsconfigPath))}`);
|
|
18215
18534
|
}, buildTscCheck = (cacheDir) => {
|
|
18216
18535
|
const tscBin = findBin("tsc");
|
|
18217
18536
|
if (!tscBin) {
|
|
18218
18537
|
console.error("\x1B[31m\u2717\x1B[0m typescript is required for type checking. Install it: bun add -d typescript");
|
|
18219
18538
|
process.exit(1);
|
|
18220
18539
|
}
|
|
18221
|
-
const tscConfigPath =
|
|
18540
|
+
const tscConfigPath = join50(cacheDir, "tsconfig.typecheck.json");
|
|
18222
18541
|
return writeFile15(tscConfigPath, JSON.stringify({
|
|
18223
18542
|
compilerOptions: {
|
|
18224
18543
|
rootDir: ".."
|
|
18225
18544
|
},
|
|
18226
18545
|
exclude: getProjectTypecheckExcludes(),
|
|
18227
|
-
extends:
|
|
18546
|
+
extends: resolve41("tsconfig.json"),
|
|
18228
18547
|
include: getProjectTypecheckIncludes()
|
|
18229
18548
|
}, null, "\t")).then(() => run("tsc", [
|
|
18230
18549
|
tscBin,
|
|
18231
18550
|
"--noEmit",
|
|
18232
18551
|
"--project",
|
|
18233
|
-
|
|
18552
|
+
resolve41(tscConfigPath),
|
|
18234
18553
|
"--incremental",
|
|
18235
18554
|
"--tsBuildInfoFile",
|
|
18236
|
-
|
|
18555
|
+
join50(cacheDir, "tsc.tsbuildinfo"),
|
|
18237
18556
|
"--pretty"
|
|
18238
18557
|
]));
|
|
18239
18558
|
}, buildSvelteCheck = async (cacheDir, svelteDir) => {
|
|
@@ -18242,16 +18561,16 @@ Found ${errorCount} error${suffix}.`;
|
|
|
18242
18561
|
console.error("\x1B[31m\u2717\x1B[0m svelte-check is required for Svelte type checking. Install it: bun add -d svelte-check");
|
|
18243
18562
|
process.exit(1);
|
|
18244
18563
|
}
|
|
18245
|
-
const svelteTsconfigPath =
|
|
18564
|
+
const svelteTsconfigPath = join50(cacheDir, "tsconfig.svelte-check.json");
|
|
18246
18565
|
await writeFile15(svelteTsconfigPath, JSON.stringify({
|
|
18247
|
-
extends:
|
|
18566
|
+
extends: resolve41("tsconfig.json"),
|
|
18248
18567
|
files: ABSOLUTE_TYPECHECK_FILES,
|
|
18249
18568
|
include: [`../${svelteDir}/**/*`]
|
|
18250
18569
|
}, null, "\t"));
|
|
18251
18570
|
return run("svelte-check", [
|
|
18252
18571
|
svelteBin,
|
|
18253
18572
|
"--tsconfig",
|
|
18254
|
-
|
|
18573
|
+
resolve41(svelteTsconfigPath),
|
|
18255
18574
|
"--threshold",
|
|
18256
18575
|
"error",
|
|
18257
18576
|
"--compiler-warnings",
|
|
@@ -18331,9 +18650,9 @@ var DEFAULT_RELAY_PORT = 8787, DEFAULT_REQUEST_TIMEOUT_MS = 30000, headersToObje
|
|
|
18331
18650
|
if (options.publicUrl)
|
|
18332
18651
|
return options.publicUrl.replace(/\/$/, "");
|
|
18333
18652
|
const url = new URL(request.url);
|
|
18334
|
-
const
|
|
18653
|
+
const host2 = request.headers.get("x-forwarded-host") ?? url.host;
|
|
18335
18654
|
const proto = request.headers.get("x-forwarded-proto") ?? url.protocol.replace(":", "");
|
|
18336
|
-
return `${proto}://${
|
|
18655
|
+
return `${proto}://${host2}`;
|
|
18337
18656
|
};
|
|
18338
18657
|
const isWebSocketUpgrade = (request) => request.headers.get("upgrade")?.toLowerCase() === "websocket";
|
|
18339
18658
|
const server = Bun.serve({
|
|
@@ -18445,11 +18764,11 @@ var DEFAULT_RELAY_PORT = 8787, DEFAULT_REQUEST_TIMEOUT_MS = 30000, headersToObje
|
|
|
18445
18764
|
url: url.pathname + url.search,
|
|
18446
18765
|
...bodyBytes && bodyBytes.length > 0 ? { bodyBase64: Buffer.from(bodyBytes).toString("base64") } : {}
|
|
18447
18766
|
};
|
|
18448
|
-
const responsePromise = new Promise((
|
|
18449
|
-
pending.set(id,
|
|
18767
|
+
const responsePromise = new Promise((resolve42) => {
|
|
18768
|
+
pending.set(id, resolve42);
|
|
18450
18769
|
});
|
|
18451
18770
|
client.send(encodeTunnelMessage(message));
|
|
18452
|
-
const timeout = new Promise((
|
|
18771
|
+
const timeout = new Promise((resolve42) => setTimeout(() => resolve42({ id, message: "timeout", type: "error" }), requestTimeoutMs));
|
|
18453
18772
|
const result = await Promise.race([responsePromise, timeout]);
|
|
18454
18773
|
pending.delete(id);
|
|
18455
18774
|
if (result.type === "error") {
|
|
@@ -20701,12 +21020,12 @@ import {
|
|
|
20701
21020
|
existsSync as existsSync12,
|
|
20702
21021
|
mkdirSync as mkdirSync7,
|
|
20703
21022
|
readdirSync as readdirSync2,
|
|
20704
|
-
readFileSync as
|
|
21023
|
+
readFileSync as readFileSync15,
|
|
20705
21024
|
unlinkSync as unlinkSync3,
|
|
20706
21025
|
writeFileSync as writeFileSync6
|
|
20707
21026
|
} from "fs";
|
|
20708
21027
|
import { createConnection } from "net";
|
|
20709
|
-
import { resolve as
|
|
21028
|
+
import { resolve as resolve21 } from "path";
|
|
20710
21029
|
|
|
20711
21030
|
// src/cli/workspaceTui.ts
|
|
20712
21031
|
init_constants();
|
|
@@ -21268,18 +21587,18 @@ var createWorkspaceTui = ({
|
|
|
21268
21587
|
|
|
21269
21588
|
// src/cli/scripts/workspace.ts
|
|
21270
21589
|
init_utils();
|
|
21271
|
-
var sourceServerBootstrap2 =
|
|
21272
|
-
var serverBootstrap2 = existsSync12(sourceServerBootstrap2) ? sourceServerBootstrap2 :
|
|
21590
|
+
var sourceServerBootstrap2 = resolve21(import.meta.dir, "../../dev/serverBootstrap.ts");
|
|
21591
|
+
var serverBootstrap2 = existsSync12(sourceServerBootstrap2) ? sourceServerBootstrap2 : resolve21(import.meta.dir, "../dev/serverBootstrap.js");
|
|
21273
21592
|
var ANSI_REGEX2 = new RegExp(`${String.fromCharCode(ANSI_ESCAPE_CODE)}\\[[0-?]*[ -/]*[@-~]`, "g");
|
|
21274
21593
|
var sleep = (durationMs) => Bun.sleep(durationMs);
|
|
21275
21594
|
var stripAnsi3 = (value) => value.replace(ANSI_REGEX2, "");
|
|
21276
21595
|
var sanitizeLogFileName = (value) => value.replace(/[^a-zA-Z0-9._-]/g, "_") || "unknown";
|
|
21277
21596
|
var createWorkspaceLogSink = (appendLog) => {
|
|
21278
|
-
const logDirectory =
|
|
21597
|
+
const logDirectory = resolve21(".absolutejs", "workspace", "logs");
|
|
21279
21598
|
mkdirSync7(logDirectory, { recursive: true });
|
|
21280
|
-
readdirSync2(logDirectory).filter((file) => file.endsWith(".log")).forEach((file) => unlinkSync3(
|
|
21281
|
-
writeFileSync6(
|
|
21282
|
-
writeFileSync6(
|
|
21599
|
+
readdirSync2(logDirectory).filter((file) => file.endsWith(".log")).forEach((file) => unlinkSync3(resolve21(logDirectory, file)));
|
|
21600
|
+
writeFileSync6(resolve21(logDirectory, "all.log"), "");
|
|
21601
|
+
writeFileSync6(resolve21(logDirectory, "workspace.log"), "");
|
|
21283
21602
|
const initializedSources = new Set(["workspace"]);
|
|
21284
21603
|
const writeLog = (source, message, level) => {
|
|
21285
21604
|
const cleanMessage = stripAnsi3(message).trimEnd();
|
|
@@ -21289,13 +21608,13 @@ var createWorkspaceLogSink = (appendLog) => {
|
|
|
21289
21608
|
const timestamp = new Date().toISOString();
|
|
21290
21609
|
const line = `[${timestamp}] [${level}] [${source}] ${cleanMessage}
|
|
21291
21610
|
`;
|
|
21292
|
-
const sourceFile =
|
|
21611
|
+
const sourceFile = resolve21(logDirectory, `${sanitizeLogFileName(source)}.log`);
|
|
21293
21612
|
if (!initializedSources.has(source)) {
|
|
21294
21613
|
writeFileSync6(sourceFile, "");
|
|
21295
21614
|
initializedSources.add(source);
|
|
21296
21615
|
}
|
|
21297
21616
|
appendFileSync(sourceFile, line);
|
|
21298
|
-
appendFileSync(
|
|
21617
|
+
appendFileSync(resolve21(logDirectory, "all.log"), line);
|
|
21299
21618
|
};
|
|
21300
21619
|
return {
|
|
21301
21620
|
appendLog: (source, message, level = "info") => {
|
|
@@ -21307,7 +21626,7 @@ var createWorkspaceLogSink = (appendLog) => {
|
|
|
21307
21626
|
};
|
|
21308
21627
|
var readPackageVersion3 = (candidate) => {
|
|
21309
21628
|
try {
|
|
21310
|
-
const pkg = JSON.parse(
|
|
21629
|
+
const pkg = JSON.parse(readFileSync15(candidate, "utf-8"));
|
|
21311
21630
|
if (pkg.name !== "@absolutejs/absolute") {
|
|
21312
21631
|
return null;
|
|
21313
21632
|
}
|
|
@@ -21319,9 +21638,9 @@ var readPackageVersion3 = (candidate) => {
|
|
|
21319
21638
|
};
|
|
21320
21639
|
var resolvePackageVersion2 = () => {
|
|
21321
21640
|
const candidates = [
|
|
21322
|
-
|
|
21323
|
-
|
|
21324
|
-
|
|
21641
|
+
resolve21(import.meta.dir, "..", "..", "package.json"),
|
|
21642
|
+
resolve21(import.meta.dir, "..", "..", "..", "package.json"),
|
|
21643
|
+
resolve21(import.meta.dir, "..", "..", "..", "..", "package.json")
|
|
21325
21644
|
];
|
|
21326
21645
|
for (const candidate of candidates) {
|
|
21327
21646
|
const version2 = readPackageVersion3(candidate);
|
|
@@ -21657,11 +21976,11 @@ var appendRemainingLogBuffer = (buffer, name, level, appendLog) => {
|
|
|
21657
21976
|
appendLog(name, buffer, level);
|
|
21658
21977
|
};
|
|
21659
21978
|
var getServicePublicHost = (service) => {
|
|
21660
|
-
const
|
|
21661
|
-
if (
|
|
21979
|
+
const host2 = service.env?.HOST ?? process.env.HOST ?? "localhost";
|
|
21980
|
+
if (host2 === "0.0.0.0" || host2 === "::") {
|
|
21662
21981
|
return "localhost";
|
|
21663
21982
|
}
|
|
21664
|
-
return
|
|
21983
|
+
return host2;
|
|
21665
21984
|
};
|
|
21666
21985
|
var getServiceProtocol = (service) => service.env?.ABSOLUTE_HTTPS === "true" || process.env.ABSOLUTE_HTTPS === "true" ? "https" : "http";
|
|
21667
21986
|
var createWorkspaceServiceEnv = (services) => {
|
|
@@ -21675,15 +21994,15 @@ var createWorkspaceServiceEnv = (services) => {
|
|
|
21675
21994
|
var getDefinedProcessEnv = () => Object.fromEntries(Object.entries(process.env).filter((entry) => typeof entry[1] === "string"));
|
|
21676
21995
|
var resolveAbsoluteServiceConfigPath = (service, cwd, options) => {
|
|
21677
21996
|
if (service.config)
|
|
21678
|
-
return
|
|
21997
|
+
return resolve21(cwd, service.config);
|
|
21679
21998
|
if (options.configPath)
|
|
21680
|
-
return
|
|
21999
|
+
return resolve21(options.configPath);
|
|
21681
22000
|
if (process.env.ABSOLUTE_CONFIG)
|
|
21682
|
-
return
|
|
22001
|
+
return resolve21(process.env.ABSOLUTE_CONFIG);
|
|
21683
22002
|
return;
|
|
21684
22003
|
};
|
|
21685
22004
|
var resolveService = (name, service, workspaceEnv, options) => {
|
|
21686
|
-
const cwd =
|
|
22005
|
+
const cwd = resolve21(service.cwd ?? ".");
|
|
21687
22006
|
const envVars = Object.assign(getDefinedProcessEnv(), workspaceEnv, service.port ? { PORT: String(service.port) } : {}, service.env, {
|
|
21688
22007
|
ABSOLUTE_INSTANCE_MANAGED: "1",
|
|
21689
22008
|
ABSOLUTE_WORKSPACE_MANAGED: "1",
|
|
@@ -21695,7 +22014,7 @@ var resolveService = (name, service, workspaceEnv, options) => {
|
|
|
21695
22014
|
if (isAbsoluteService(service)) {
|
|
21696
22015
|
const configPath2 = resolveAbsoluteServiceConfigPath(service, cwd, options);
|
|
21697
22016
|
Object.assign(envVars, configPath2 ? { ABSOLUTE_CONFIG: configPath2 } : {}, {
|
|
21698
|
-
ABSOLUTE_SERVER_ENTRY:
|
|
22017
|
+
ABSOLUTE_SERVER_ENTRY: resolve21(cwd, service.entry ?? DEFAULT_SERVER_ENTRY)
|
|
21699
22018
|
});
|
|
21700
22019
|
const command = [
|
|
21701
22020
|
process.execPath,
|
|
@@ -21725,8 +22044,8 @@ var resolveService = (name, service, workspaceEnv, options) => {
|
|
|
21725
22044
|
var resolveServiceBuildDirectory = (service) => {
|
|
21726
22045
|
if (!isAbsoluteService(service))
|
|
21727
22046
|
return null;
|
|
21728
|
-
const cwd =
|
|
21729
|
-
return
|
|
22047
|
+
const cwd = resolve21(service.cwd ?? ".");
|
|
22048
|
+
return resolve21(cwd, service.buildDirectory ?? "build");
|
|
21730
22049
|
};
|
|
21731
22050
|
var findSharedWorkspaceBuildDirectories = (services) => {
|
|
21732
22051
|
const byBuildDirectory = new Map;
|
|
@@ -21944,7 +22263,7 @@ var workspace = async (subcommand, options) => {
|
|
|
21944
22263
|
frameworks: [],
|
|
21945
22264
|
host: getServicePublicHost(resolved.service),
|
|
21946
22265
|
https: getServiceProtocol(resolved.service) === "https",
|
|
21947
|
-
logFile:
|
|
22266
|
+
logFile: resolve21(workspaceLogs.logDirectory, `${sanitizeLogFileName(name)}.log`),
|
|
21948
22267
|
name,
|
|
21949
22268
|
pid: processHandle.pid,
|
|
21950
22269
|
port: resolved.service.port ?? null,
|