@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/mobile/index.js
CHANGED
|
@@ -167,6 +167,257 @@ var normalizeSlug = (str) => str.trim().replace(/\s+/g, "-").replace(/[^A-Za-z0-
|
|
|
167
167
|
return normalizeSlug(str).split(/[-_]/).filter(Boolean).map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1).toLowerCase()).join("");
|
|
168
168
|
};
|
|
169
169
|
|
|
170
|
+
// node_modules/@absolutejs/sync/dist/client/index.js
|
|
171
|
+
var RUNTIME_TRANSPORT, host, isRegistry = (value) => typeof value === "object" && value !== null && Array.isArray(Reflect.get(value, "installations")), registry, SyncLocalStoreSchemaError, positiveVersion = (value, label) => {
|
|
172
|
+
if (!Number.isSafeInteger(value) || value < 1)
|
|
173
|
+
throw new SyncLocalStoreSchemaError("INVALID_PLAN", `${label} must be a positive safe integer`);
|
|
174
|
+
return value;
|
|
175
|
+
}, isSchemaBundle = (schema) => ("components" in schema), normalizeSyncLocalSchemaComponents = (schema = { version: 1 }) => {
|
|
176
|
+
const components = isSchemaBundle(schema) ? [...schema.components] : [{ ...schema, id: "@absolutejs/app" }];
|
|
177
|
+
const ids = new Set;
|
|
178
|
+
for (const component of components) {
|
|
179
|
+
if (typeof component.id !== "string" || component.id.trim() !== component.id || component.id.length === 0)
|
|
180
|
+
throw new SyncLocalStoreSchemaError("INVALID_PLAN", "Sync schema component id must be non-empty and trimmed");
|
|
181
|
+
if (ids.has(component.id))
|
|
182
|
+
throw new SyncLocalStoreSchemaError("INVALID_PLAN", `Sync schema component "${component.id}" is declared more than once`);
|
|
183
|
+
ids.add(component.id);
|
|
184
|
+
}
|
|
185
|
+
return components.sort((a, b) => a.id.localeCompare(b.id));
|
|
186
|
+
}, resolveSyncLocalSchemaComponents = (storedVersions, schema = { version: 1 }) => {
|
|
187
|
+
const components = normalizeSyncLocalSchemaComponents(schema).map((component) => {
|
|
188
|
+
const current = resolveSyncLocalMigrations(component.version, component);
|
|
189
|
+
return {
|
|
190
|
+
id: component.id,
|
|
191
|
+
...resolveSyncLocalMigrations(storedVersions[component.id] ?? current.minimumCompatibleVersion, component)
|
|
192
|
+
};
|
|
193
|
+
});
|
|
194
|
+
const active = new Set(components.map((component) => component.id));
|
|
195
|
+
const orphanedComponents = Object.keys(storedVersions).filter((id) => !active.has(id)).sort();
|
|
196
|
+
return { components, orphanedComponents };
|
|
197
|
+
}, resolveSyncLocalMigrations = (storedVersion, schema = { version: 1 }) => {
|
|
198
|
+
positiveVersion(storedVersion, "Stored Sync schema version");
|
|
199
|
+
const targetVersion = positiveVersion(schema.version, "Target Sync schema version");
|
|
200
|
+
const migrations = [...schema.migrations ?? []].sort((a, b) => a.toVersion - b.toVersion);
|
|
201
|
+
const versions = new Set;
|
|
202
|
+
for (const migration of migrations) {
|
|
203
|
+
positiveVersion(migration.toVersion, "Sync migration toVersion");
|
|
204
|
+
if (versions.has(migration.toVersion))
|
|
205
|
+
throw new SyncLocalStoreSchemaError("INVALID_PLAN", `Sync migration ${migration.toVersion} is declared more than once`);
|
|
206
|
+
versions.add(migration.toVersion);
|
|
207
|
+
}
|
|
208
|
+
const inferredMinimum = migrations[0] ? migrations[0].toVersion - 1 : targetVersion;
|
|
209
|
+
const minimumCompatibleVersion = positiveVersion(schema.minimumCompatibleVersion ?? inferredMinimum, "Minimum compatible Sync schema version");
|
|
210
|
+
if (minimumCompatibleVersion > targetVersion)
|
|
211
|
+
throw new SyncLocalStoreSchemaError("INVALID_PLAN", "Minimum compatible Sync schema version cannot exceed its target");
|
|
212
|
+
if (storedVersion > targetVersion)
|
|
213
|
+
throw new SyncLocalStoreSchemaError("SCHEMA_TOO_NEW", `Stored Sync schema ${storedVersion} is newer than this runtime's schema ${targetVersion}`, { storedVersion, targetVersion });
|
|
214
|
+
if (storedVersion < minimumCompatibleVersion)
|
|
215
|
+
throw new SyncLocalStoreSchemaError("SCHEMA_TOO_OLD", `Stored Sync schema ${storedVersion} is older than the minimum compatible schema ${minimumCompatibleVersion}`, { storedVersion, targetVersion });
|
|
216
|
+
const steps = [];
|
|
217
|
+
for (let version = storedVersion + 1;version <= targetVersion; version++) {
|
|
218
|
+
const migration = migrations.find((candidate) => candidate.toVersion === version);
|
|
219
|
+
if (migration === undefined)
|
|
220
|
+
throw new SyncLocalStoreSchemaError("MIGRATION_MISSING", `Sync migration ${version - 1} -> ${version} is missing`, { storedVersion, targetVersion });
|
|
221
|
+
steps.push(migration);
|
|
222
|
+
}
|
|
223
|
+
return { minimumCompatibleVersion, steps, targetVersion };
|
|
224
|
+
};
|
|
225
|
+
var init_client = __esm(() => {
|
|
226
|
+
RUNTIME_TRANSPORT = Symbol.for("@absolutejs/sync/client-runtime-transport");
|
|
227
|
+
host = globalThis;
|
|
228
|
+
registry = (() => {
|
|
229
|
+
const existing = host[RUNTIME_TRANSPORT];
|
|
230
|
+
if (isRegistry(existing))
|
|
231
|
+
return existing;
|
|
232
|
+
const created = { installations: [] };
|
|
233
|
+
Object.defineProperty(host, RUNTIME_TRANSPORT, {
|
|
234
|
+
configurable: false,
|
|
235
|
+
enumerable: false,
|
|
236
|
+
value: created,
|
|
237
|
+
writable: false
|
|
238
|
+
});
|
|
239
|
+
return created;
|
|
240
|
+
})();
|
|
241
|
+
SyncLocalStoreSchemaError = class SyncLocalStoreSchemaError extends Error {
|
|
242
|
+
code;
|
|
243
|
+
storedVersion;
|
|
244
|
+
targetVersion;
|
|
245
|
+
constructor(code, message, versions = {}) {
|
|
246
|
+
super(message);
|
|
247
|
+
this.name = "SyncLocalStoreSchemaError";
|
|
248
|
+
this.code = code;
|
|
249
|
+
this.storedVersion = versions.storedVersion;
|
|
250
|
+
this.targetVersion = versions.targetVersion;
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
// src/mobile/syncSchema.ts
|
|
256
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
257
|
+
import { dirname as dirname9, join as join12, resolve as resolve10 } from "path";
|
|
258
|
+
var object = (value) => typeof value === "object" && value !== null && !Array.isArray(value), manifestAt = (path) => {
|
|
259
|
+
try {
|
|
260
|
+
const value = JSON.parse(readFileSync3(path, "utf8"));
|
|
261
|
+
return object(value) ? value : undefined;
|
|
262
|
+
} catch {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
}, localSchemaMetadata = (manifest) => {
|
|
266
|
+
const absolutejs = Reflect.get(manifest, "absolutejs");
|
|
267
|
+
if (!object(absolutejs))
|
|
268
|
+
return;
|
|
269
|
+
const sync = Reflect.get(absolutejs, "sync");
|
|
270
|
+
if (!object(sync))
|
|
271
|
+
return;
|
|
272
|
+
return Reflect.get(sync, "localSchema");
|
|
273
|
+
}, packageManifestPath = (projectRoot, packageName) => {
|
|
274
|
+
let directory = resolve10(projectRoot);
|
|
275
|
+
while (true) {
|
|
276
|
+
const candidate = join12(directory, "node_modules", packageName, "package.json");
|
|
277
|
+
const manifest = manifestAt(candidate);
|
|
278
|
+
if (manifest && Reflect.get(manifest, "name") === packageName)
|
|
279
|
+
return candidate;
|
|
280
|
+
const parent = dirname9(directory);
|
|
281
|
+
if (parent === directory)
|
|
282
|
+
return;
|
|
283
|
+
directory = parent;
|
|
284
|
+
}
|
|
285
|
+
}, metadataError = (id, detail) => new TypeError(`Invalid AbsoluteJS Sync schema metadata for ${id}: ${detail}`), positiveVersion2 = (value, id, field) => {
|
|
286
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 1)
|
|
287
|
+
throw metadataError(id, `${field} must be a positive safe integer.`);
|
|
288
|
+
return value;
|
|
289
|
+
}, nonEmpty = (value, id, field) => {
|
|
290
|
+
if (typeof value !== "string" || value.trim() !== value || value.length === 0)
|
|
291
|
+
throw metadataError(id, `${field} must be a non-empty trimmed string.`);
|
|
292
|
+
return value;
|
|
293
|
+
}, requireObject = (value, id, detail) => {
|
|
294
|
+
if (!object(value))
|
|
295
|
+
throw metadataError(id, detail);
|
|
296
|
+
return value;
|
|
297
|
+
}, normalizeJsonValue2 = (value, id, field) => {
|
|
298
|
+
if (value === null || typeof value === "string" || typeof value === "boolean")
|
|
299
|
+
return value;
|
|
300
|
+
if (typeof value === "number" && Number.isFinite(value))
|
|
301
|
+
return value;
|
|
302
|
+
if (Array.isArray(value))
|
|
303
|
+
return value.map((entry) => normalizeJsonValue2(entry, id, field));
|
|
304
|
+
if (object(value))
|
|
305
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [
|
|
306
|
+
key,
|
|
307
|
+
normalizeJsonValue2(entry, id, field)
|
|
308
|
+
]));
|
|
309
|
+
throw metadataError(id, `${field} must be JSON-safe.`);
|
|
310
|
+
}, operation = (value, id, index) => {
|
|
311
|
+
const record = requireObject(value, id, `migration operation ${index} must be an object.`);
|
|
312
|
+
const type = Reflect.get(record, "type");
|
|
313
|
+
const collection = nonEmpty(Reflect.get(record, "collection"), id, `operation ${index}.collection`);
|
|
314
|
+
if (type === "delete-collection")
|
|
315
|
+
return { collection, type };
|
|
316
|
+
if (type === "rename-field")
|
|
317
|
+
return {
|
|
318
|
+
collection,
|
|
319
|
+
from: nonEmpty(Reflect.get(record, "from"), id, `operation ${index}.from`),
|
|
320
|
+
to: nonEmpty(Reflect.get(record, "to"), id, `operation ${index}.to`),
|
|
321
|
+
type
|
|
322
|
+
};
|
|
323
|
+
const field = nonEmpty(Reflect.get(record, "field"), id, `operation ${index}.field`);
|
|
324
|
+
if (type === "remove-field")
|
|
325
|
+
return { collection, field, type };
|
|
326
|
+
if (type === "set-default")
|
|
327
|
+
return {
|
|
328
|
+
collection,
|
|
329
|
+
field,
|
|
330
|
+
type,
|
|
331
|
+
value: normalizeJsonValue2(Reflect.get(record, "value"), id, `operation ${index}.value`)
|
|
332
|
+
};
|
|
333
|
+
throw metadataError(id, `operation ${index}.type is not supported.`);
|
|
334
|
+
}, migration = (value, id, index) => {
|
|
335
|
+
const record = requireObject(value, id, `migration ${index} must be an object.`);
|
|
336
|
+
const allowed = new Set(["operations", "toVersion"]);
|
|
337
|
+
const unsupported = Object.keys(record).find((key) => !allowed.has(key));
|
|
338
|
+
if (unsupported)
|
|
339
|
+
throw metadataError(id, `migration ${index}.${unsupported} is not declarative metadata.`);
|
|
340
|
+
const declaredOperations = Reflect.get(record, "operations");
|
|
341
|
+
if (declaredOperations !== undefined && !Array.isArray(declaredOperations))
|
|
342
|
+
throw metadataError(id, `migration ${index}.operations must be an array.`);
|
|
343
|
+
const operations = Array.isArray(declaredOperations) ? declaredOperations : [];
|
|
344
|
+
return {
|
|
345
|
+
operations: operations.map((entry, operationIndex) => operation(entry, id, operationIndex)),
|
|
346
|
+
toVersion: positiveVersion2(Reflect.get(record, "toVersion"), id, `migration ${index}.toVersion`)
|
|
347
|
+
};
|
|
348
|
+
}, component = (id, value) => {
|
|
349
|
+
const record = requireObject(value, id, "localSchema must be an object.");
|
|
350
|
+
const allowed = new Set([
|
|
351
|
+
"migrations",
|
|
352
|
+
"minimumCompatibleVersion",
|
|
353
|
+
"version"
|
|
354
|
+
]);
|
|
355
|
+
const unsupported = Object.keys(record).find((key) => !allowed.has(key));
|
|
356
|
+
if (unsupported)
|
|
357
|
+
throw metadataError(id, `${unsupported} is not supported.`);
|
|
358
|
+
const version = positiveVersion2(Reflect.get(record, "version"), id, "version");
|
|
359
|
+
const declaredMinimum = Reflect.get(record, "minimumCompatibleVersion");
|
|
360
|
+
const minimumCompatibleVersion = declaredMinimum === undefined ? Math.max(1, version - 2) : positiveVersion2(declaredMinimum, id, "minimumCompatibleVersion");
|
|
361
|
+
const declaredMigrations = Reflect.get(record, "migrations");
|
|
362
|
+
if (declaredMigrations !== undefined && !Array.isArray(declaredMigrations))
|
|
363
|
+
throw metadataError(id, "migrations must be an array.");
|
|
364
|
+
const migrations = Array.isArray(declaredMigrations) ? declaredMigrations : undefined;
|
|
365
|
+
return {
|
|
366
|
+
id,
|
|
367
|
+
minimumCompatibleVersion,
|
|
368
|
+
...Array.isArray(migrations) ? {
|
|
369
|
+
migrations: migrations.map((entry, index) => migration(entry, id, index))
|
|
370
|
+
} : {},
|
|
371
|
+
version
|
|
372
|
+
};
|
|
373
|
+
}, dependencyNames = (manifest) => [
|
|
374
|
+
Reflect.get(manifest, "dependencies"),
|
|
375
|
+
Reflect.get(manifest, "optionalDependencies"),
|
|
376
|
+
Reflect.get(manifest, "devDependencies"),
|
|
377
|
+
Reflect.get(manifest, "peerDependencies")
|
|
378
|
+
].flatMap((dependencies) => object(dependencies) ? Object.keys(dependencies) : []).filter((name, index, names) => names.indexOf(name) === index).sort(), discoverAbsoluteSyncSchema = (projectRoot) => {
|
|
379
|
+
const appManifestPath = join12(resolve10(projectRoot), "package.json");
|
|
380
|
+
const appManifest = manifestAt(appManifestPath);
|
|
381
|
+
if (!appManifest)
|
|
382
|
+
return {
|
|
383
|
+
components: [
|
|
384
|
+
{
|
|
385
|
+
id: "@absolutejs/app",
|
|
386
|
+
minimumCompatibleVersion: 1,
|
|
387
|
+
version: 1
|
|
388
|
+
}
|
|
389
|
+
],
|
|
390
|
+
sources: []
|
|
391
|
+
};
|
|
392
|
+
const appMetadata = localSchemaMetadata(appManifest);
|
|
393
|
+
const components = [
|
|
394
|
+
appMetadata === undefined ? { id: "@absolutejs/app", minimumCompatibleVersion: 1, version: 1 } : component("@absolutejs/app", appMetadata)
|
|
395
|
+
];
|
|
396
|
+
const sources = [
|
|
397
|
+
{ id: "@absolutejs/app", manifestPath: appManifestPath }
|
|
398
|
+
];
|
|
399
|
+
for (const name of dependencyNames(appManifest)) {
|
|
400
|
+
const manifestPath = packageManifestPath(projectRoot, name);
|
|
401
|
+
if (!manifestPath)
|
|
402
|
+
continue;
|
|
403
|
+
const manifest = manifestAt(manifestPath);
|
|
404
|
+
if (!manifest)
|
|
405
|
+
continue;
|
|
406
|
+
const metadata = localSchemaMetadata(manifest);
|
|
407
|
+
if (metadata === undefined)
|
|
408
|
+
continue;
|
|
409
|
+
components.push(component(name, metadata));
|
|
410
|
+
sources.push({ id: name, manifestPath });
|
|
411
|
+
}
|
|
412
|
+
components.sort((left, right) => left.id.localeCompare(right.id));
|
|
413
|
+
sources.sort((left, right) => left.id.localeCompare(right.id));
|
|
414
|
+
resolveSyncLocalSchemaComponents({}, { components });
|
|
415
|
+
return { components, sources };
|
|
416
|
+
};
|
|
417
|
+
var init_syncSchema = __esm(() => {
|
|
418
|
+
init_client();
|
|
419
|
+
});
|
|
420
|
+
|
|
170
421
|
// src/mobile/artifactStore.ts
|
|
171
422
|
import { createHash as createHash2 } from "crypto";
|
|
172
423
|
import {
|
|
@@ -2576,6 +2827,7 @@ var ABSOLUTE_REMOTE_MAC_PROTOCOL_VERSION = 1;
|
|
|
2576
2827
|
|
|
2577
2828
|
// src/mobile/remoteMacProtocol.ts
|
|
2578
2829
|
var PROFILE_FORMAT = 1;
|
|
2830
|
+
var REMOTE_STDIN_FLUSH_ATTEMPTS = 3;
|
|
2579
2831
|
var PROFILE_NAME = /^[a-z0-9](?:[a-z0-9._-]{0,62}[a-z0-9])?$/u;
|
|
2580
2832
|
var SSH_DESTINATION = /^(?:[A-Za-z0-9._-]+@)?[A-Za-z0-9._:-]+$/u;
|
|
2581
2833
|
var defaultProfilePath = () => join7(homedir2(), ".absolutejs", "mobile", "remote-macs.json");
|
|
@@ -3067,8 +3319,17 @@ var startAbsoluteRemoteIosDevSession = async (options) => {
|
|
|
3067
3319
|
const response = new Promise((resolve6, reject) => pending.set(id, { reject, resolve: resolve6 }));
|
|
3068
3320
|
process2.stdin.write(`${JSON.stringify({ command: commandName, id, v: 1 })}
|
|
3069
3321
|
`);
|
|
3070
|
-
|
|
3071
|
-
|
|
3322
|
+
const flush = async () => {
|
|
3323
|
+
for (let attempt = 0;attempt < REMOTE_STDIN_FLUSH_ATTEMPTS; attempt++) {
|
|
3324
|
+
try {
|
|
3325
|
+
await process2.stdin.flush();
|
|
3326
|
+
return;
|
|
3327
|
+
} catch {
|
|
3328
|
+
await Promise.resolve();
|
|
3329
|
+
}
|
|
3330
|
+
}
|
|
3331
|
+
};
|
|
3332
|
+
return flush().then(() => response);
|
|
3072
3333
|
};
|
|
3073
3334
|
let closed = false;
|
|
3074
3335
|
const close = async () => {
|
|
@@ -3495,7 +3756,7 @@ var parseAbsoluteMobileBuildPageMetadata = (value) => {
|
|
|
3495
3756
|
};
|
|
3496
3757
|
// src/mobile/buildPipeline.ts
|
|
3497
3758
|
import { readFile as readFile13 } from "fs/promises";
|
|
3498
|
-
import { join as
|
|
3759
|
+
import { join as join13, resolve as resolve11 } from "path";
|
|
3499
3760
|
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
3500
3761
|
|
|
3501
3762
|
// src/mobile/buildRelease.ts
|
|
@@ -4325,7 +4586,12 @@ var materializeAbsoluteCapacitorWebBundle = async (options) => {
|
|
|
4325
4586
|
endpoint: new URL("/__absolute/sync/background", options.config.productionOrigin).href,
|
|
4326
4587
|
intervalMinutes: 15
|
|
4327
4588
|
},
|
|
4328
|
-
socketTickets: true
|
|
4589
|
+
socketTickets: true,
|
|
4590
|
+
storageSchema: options.syncSchema ?? {
|
|
4591
|
+
components: [
|
|
4592
|
+
{ id: "@absolutejs/app", version: 1 }
|
|
4593
|
+
]
|
|
4594
|
+
}
|
|
4329
4595
|
}
|
|
4330
4596
|
} : {}
|
|
4331
4597
|
};
|
|
@@ -4573,6 +4839,7 @@ var serializeAbsoluteMobileAuthEnvironment = (config, auth) => auth === undefine
|
|
|
4573
4839
|
]);
|
|
4574
4840
|
|
|
4575
4841
|
// src/mobile/buildPipeline.ts
|
|
4842
|
+
init_syncSchema();
|
|
4576
4843
|
var isElysiaApp = (value) => typeof value === "object" && value !== null && typeof Reflect.get(value, "compile") === "function" && Array.isArray(Reflect.get(value, "routes"));
|
|
4577
4844
|
var isStringRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && Object.values(value).every((entry) => typeof entry === "string");
|
|
4578
4845
|
var serverExportName = (loaded, app) => {
|
|
@@ -4606,11 +4873,11 @@ var loadServerApp = async (producerPath) => {
|
|
|
4606
4873
|
return { app, exportName };
|
|
4607
4874
|
};
|
|
4608
4875
|
var finalizeAbsoluteMobileCompatibilityBuild = async (options) => {
|
|
4609
|
-
const buildDirectory =
|
|
4876
|
+
const buildDirectory = resolve11(options.buildDirectory);
|
|
4610
4877
|
const mobile = normalizeAbsoluteMobileConfig(options.mobile, options.projectRoot);
|
|
4611
|
-
const root =
|
|
4878
|
+
const root = join13(buildDirectory, ".absolutejs", "mobile-compatibility");
|
|
4612
4879
|
const [manifestSource, previous] = await Promise.all([
|
|
4613
|
-
readFile13(
|
|
4880
|
+
readFile13(join13(buildDirectory, "manifest.json"), "utf8"),
|
|
4614
4881
|
readAbsoluteMobileMaterializedReleases(root)
|
|
4615
4882
|
]);
|
|
4616
4883
|
const manifest = JSON.parse(manifestSource);
|
|
@@ -4623,11 +4890,11 @@ var finalizeAbsoluteMobileCompatibilityBuild = async (options) => {
|
|
|
4623
4890
|
process.env.ABSOLUTE_BUILD_DIR = buildDirectory;
|
|
4624
4891
|
process.env.ABSOLUTE_COMPILED_RUNTIME = "1";
|
|
4625
4892
|
if (options.configPath) {
|
|
4626
|
-
process.env.ABSOLUTE_CONFIG =
|
|
4893
|
+
process.env.ABSOLUTE_CONFIG = resolve11(options.projectRoot, options.configPath);
|
|
4627
4894
|
}
|
|
4628
4895
|
let loaded;
|
|
4629
4896
|
try {
|
|
4630
|
-
loaded = await loadServerApp(
|
|
4897
|
+
loaded = await loadServerApp(resolve11(options.producerPath));
|
|
4631
4898
|
} finally {
|
|
4632
4899
|
restoreEnvironmentVariable("ABSOLUTE_BUILD_DIR", previousBuildDirectory);
|
|
4633
4900
|
restoreEnvironmentVariable("ABSOLUTE_COMPILED_RUNTIME", previousCompiledRuntime);
|
|
@@ -4640,11 +4907,12 @@ var finalizeAbsoluteMobileCompatibilityBuild = async (options) => {
|
|
|
4640
4907
|
manifest,
|
|
4641
4908
|
previousArtifacts: previous.map(({ artifact }) => artifact),
|
|
4642
4909
|
producerExport: loaded.exportName,
|
|
4643
|
-
producerPath:
|
|
4910
|
+
producerPath: resolve11(options.producerPath),
|
|
4644
4911
|
runtime: String(ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION)
|
|
4645
4912
|
});
|
|
4646
4913
|
const auth = resolveAbsoluteMobileAuthManifest(options.projectRoot, mobile);
|
|
4647
4914
|
const sync = auth !== undefined && projectUsesAbsoluteSync(options.projectRoot);
|
|
4915
|
+
const syncSchema = sync ? discoverAbsoluteSyncSchema(options.projectRoot) : undefined;
|
|
4648
4916
|
if (auth && !loaded.app.routes.some((route) => route.path === "/.well-known/openid-configuration")) {
|
|
4649
4917
|
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.");
|
|
4650
4918
|
}
|
|
@@ -4663,10 +4931,15 @@ var finalizeAbsoluteMobileCompatibilityBuild = async (options) => {
|
|
|
4663
4931
|
...auth ? { auth } : {},
|
|
4664
4932
|
buildDirectory,
|
|
4665
4933
|
config: mobile,
|
|
4666
|
-
...sync ? { sync: true } : {}
|
|
4934
|
+
...sync ? { sync: true } : {},
|
|
4935
|
+
...syncSchema ? { syncSchema: { components: syncSchema.components } } : {}
|
|
4667
4936
|
});
|
|
4668
4937
|
return current.artifact;
|
|
4669
4938
|
};
|
|
4939
|
+
|
|
4940
|
+
// src/mobile/index.ts
|
|
4941
|
+
init_syncSchema();
|
|
4942
|
+
|
|
4670
4943
|
// src/mobile/compatibilityDispatcher.ts
|
|
4671
4944
|
import { Elysia as Elysia2 } from "elysia";
|
|
4672
4945
|
|
|
@@ -4808,7 +5081,7 @@ var createAbsoluteMobileCompatibilityDispatcher = (options) => {
|
|
|
4808
5081
|
};
|
|
4809
5082
|
// src/mobile/nativeDeepLinks.ts
|
|
4810
5083
|
import { readFile as readFile14, rename as rename11, writeFile as writeFile12 } from "fs/promises";
|
|
4811
|
-
import { join as
|
|
5084
|
+
import { join as join14 } from "path";
|
|
4812
5085
|
var START_MARKER = "<!-- absolutejs:deep-links:start -->";
|
|
4813
5086
|
var END_MARKER = "<!-- absolutejs:deep-links:end -->";
|
|
4814
5087
|
var IOS_ENTITLEMENTS = "App/AbsoluteJS.entitlements";
|
|
@@ -4844,7 +5117,7 @@ var replaceManagedRegion = (source, region, insertAt) => {
|
|
|
4844
5117
|
return `${source.slice(0, index)}${region}${source.slice(index)}`;
|
|
4845
5118
|
};
|
|
4846
5119
|
var androidRegion = (config) => {
|
|
4847
|
-
const hosts = config.deepLinkHosts.map((
|
|
5120
|
+
const hosts = config.deepLinkHosts.map((host2) => ` <data android:scheme="https" android:host="${escapeXml(host2)}" />`).join(`
|
|
4848
5121
|
`);
|
|
4849
5122
|
const customScheme = config.deepLinkScheme ? `
|
|
4850
5123
|
|
|
@@ -4865,7 +5138,7 @@ ${hosts}
|
|
|
4865
5138
|
`;
|
|
4866
5139
|
};
|
|
4867
5140
|
var configureAndroid = async (config) => {
|
|
4868
|
-
const path =
|
|
5141
|
+
const path = join14(config.nativeProjectDirectory, "android/app/src/main/AndroidManifest.xml");
|
|
4869
5142
|
const source = await readFile14(path, "utf8");
|
|
4870
5143
|
const mainActivity = source.indexOf('android:name=".MainActivity"');
|
|
4871
5144
|
if (mainActivity === NOT_FOUND) {
|
|
@@ -4891,7 +5164,7 @@ var iosSchemeRegion = (scheme) => ` ${START_MARKER}
|
|
|
4891
5164
|
${END_MARKER}
|
|
4892
5165
|
`;
|
|
4893
5166
|
var configureIosInfo = async (config) => {
|
|
4894
|
-
const path =
|
|
5167
|
+
const path = join14(config.nativeProjectDirectory, "ios/App/App/Info.plist");
|
|
4895
5168
|
const source = await readFile14(path, "utf8");
|
|
4896
5169
|
const region = config.deepLinkScheme ? iosSchemeRegion(config.deepLinkScheme) : ` ${START_MARKER}
|
|
4897
5170
|
${END_MARKER}
|
|
@@ -4900,7 +5173,7 @@ var configureIosInfo = async (config) => {
|
|
|
4900
5173
|
return writeChangedFile(path, updated);
|
|
4901
5174
|
};
|
|
4902
5175
|
var iosEntitlementsSource = (config) => {
|
|
4903
|
-
const domains = config.deepLinkHosts.map((
|
|
5176
|
+
const domains = config.deepLinkHosts.map((host2) => ` <string>applinks:${escapeXml(host2)}</string>`).join(`
|
|
4904
5177
|
`);
|
|
4905
5178
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
4906
5179
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
@@ -4915,7 +5188,7 @@ ${domains}
|
|
|
4915
5188
|
`;
|
|
4916
5189
|
};
|
|
4917
5190
|
var configureIosEntitlements = async (config) => {
|
|
4918
|
-
const path =
|
|
5191
|
+
const path = join14(config.nativeProjectDirectory, "ios/App/AbsoluteJS.entitlements");
|
|
4919
5192
|
let current = "";
|
|
4920
5193
|
try {
|
|
4921
5194
|
current = await readFile14(path, "utf8");
|
|
@@ -4933,7 +5206,7 @@ var configureIosEntitlements = async (config) => {
|
|
|
4933
5206
|
return true;
|
|
4934
5207
|
};
|
|
4935
5208
|
var configureIosProject = async (config) => {
|
|
4936
|
-
const path =
|
|
5209
|
+
const path = join14(config.nativeProjectDirectory, "ios/App/App.xcodeproj/project.pbxproj");
|
|
4937
5210
|
const source = await readFile14(path, "utf8");
|
|
4938
5211
|
const declarations = [
|
|
4939
5212
|
...source.matchAll(/CODE_SIGN_ENTITLEMENTS = ([^;]+);/g)
|
|
@@ -4973,7 +5246,7 @@ var applyAbsoluteNativeDeepLinks = async (config, platforms = config.platforms)
|
|
|
4973
5246
|
};
|
|
4974
5247
|
// src/mobile/releasePublisher.ts
|
|
4975
5248
|
import { access as access9 } from "fs/promises";
|
|
4976
|
-
import { isAbsolute as isAbsolute6, relative as relative9, resolve as
|
|
5249
|
+
import { isAbsolute as isAbsolute6, relative as relative9, resolve as resolve12, sep as sep6 } from "path";
|
|
4977
5250
|
import { pathToFileURL as pathToFileURL3 } from "url";
|
|
4978
5251
|
var prepareAbsoluteIosRelease = async (publisher, options) => {
|
|
4979
5252
|
if (typeof publisher.prepareIosRelease !== "function") {
|
|
@@ -4999,8 +5272,8 @@ var prepareAbsoluteAndroidRelease = async (publisher, options) => {
|
|
|
4999
5272
|
var isRecord8 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5000
5273
|
var isPublisher = (value) => isRecord8(value) && typeof value.publish === "function";
|
|
5001
5274
|
var publisherModulePath = (projectRoot, requested) => {
|
|
5002
|
-
const root =
|
|
5003
|
-
const path =
|
|
5275
|
+
const root = resolve12(projectRoot);
|
|
5276
|
+
const path = resolve12(root, requested);
|
|
5004
5277
|
const projectRelative = relative9(root, path);
|
|
5005
5278
|
if (projectRelative === ".." || projectRelative.startsWith(`..${sep6}`) || isAbsolute6(projectRelative)) {
|
|
5006
5279
|
throw new TypeError("mobile publish --registry must remain inside the project.");
|
|
@@ -5070,8 +5343,8 @@ var publishAbsoluteIosRelease = async (options) => {
|
|
|
5070
5343
|
return publication;
|
|
5071
5344
|
};
|
|
5072
5345
|
// src/mobile/routeMetadataTransform.ts
|
|
5073
|
-
import { existsSync as existsSync3, readFileSync as
|
|
5074
|
-
import { dirname as
|
|
5346
|
+
import { existsSync as existsSync3, readFileSync as readFileSync4 } from "fs";
|
|
5347
|
+
import { dirname as dirname10, extname as extname3, relative as relative10, resolve as resolve13 } from "path";
|
|
5075
5348
|
import ts from "typescript";
|
|
5076
5349
|
var ROUTE_METHODS = new Set(["get", "head"]);
|
|
5077
5350
|
var SOURCE_FILTER = /\.[cm]?[jt]sx?$/;
|
|
@@ -5122,7 +5395,7 @@ var PAGE_HANDLERS = new Map([
|
|
|
5122
5395
|
]
|
|
5123
5396
|
]);
|
|
5124
5397
|
var posixPath = (value) => value.replace(/\\/g, "/");
|
|
5125
|
-
var findTsconfig = (entry, projectRoot) => ts.findConfigFile(
|
|
5398
|
+
var findTsconfig = (entry, projectRoot) => ts.findConfigFile(dirname10(entry), existsSync3, "tsconfig.json") ?? ts.findConfigFile(projectRoot, existsSync3, "tsconfig.json");
|
|
5126
5399
|
var createProgram = (entry, projectRoot) => {
|
|
5127
5400
|
const configPath = findTsconfig(entry, projectRoot);
|
|
5128
5401
|
if (!configPath) {
|
|
@@ -5134,7 +5407,7 @@ var createProgram = (entry, projectRoot) => {
|
|
|
5134
5407
|
target: ts.ScriptTarget.ESNext
|
|
5135
5408
|
});
|
|
5136
5409
|
}
|
|
5137
|
-
const parsed = ts.parseJsonConfigFileContent(ts.readConfigFile(configPath, (path) =>
|
|
5410
|
+
const parsed = ts.parseJsonConfigFileContent(ts.readConfigFile(configPath, (path) => readFileSync4(path, "utf8")).config, ts.sys, dirname10(configPath));
|
|
5138
5411
|
if (!parsed.fileNames.includes(entry))
|
|
5139
5412
|
parsed.fileNames.push(entry);
|
|
5140
5413
|
return ts.createProgram(parsed.fileNames, parsed.options);
|
|
@@ -5148,8 +5421,8 @@ var propertyName = (property) => {
|
|
|
5148
5421
|
return property.name.text;
|
|
5149
5422
|
return;
|
|
5150
5423
|
};
|
|
5151
|
-
var objectPropertyExpression = (
|
|
5152
|
-
const property =
|
|
5424
|
+
var objectPropertyExpression = (object2, name) => {
|
|
5425
|
+
const property = object2.properties.find((candidate) => propertyName(candidate) === name);
|
|
5153
5426
|
if (property && ts.isPropertyAssignment(property)) {
|
|
5154
5427
|
return property.initializer;
|
|
5155
5428
|
}
|
|
@@ -5345,8 +5618,8 @@ var spreadObject = (expression, checker, bindings) => {
|
|
|
5345
5618
|
return;
|
|
5346
5619
|
return callableObject(expression, checker);
|
|
5347
5620
|
};
|
|
5348
|
-
var objectAssetKey = (
|
|
5349
|
-
for (const property of [...
|
|
5621
|
+
var objectAssetKey = (object2, name, checker, bindings = new Map) => {
|
|
5622
|
+
for (const property of [...object2.properties].reverse()) {
|
|
5350
5623
|
if (propertyName(property) === name && ts.isShorthandPropertyAssignment(property)) {
|
|
5351
5624
|
return assetKeyWithBindings(property.name, checker, bindings);
|
|
5352
5625
|
}
|
|
@@ -5479,7 +5752,7 @@ var analyzeProgram = (program, projectRoot) => {
|
|
|
5479
5752
|
const checker = program.getTypeChecker();
|
|
5480
5753
|
const analyzed = new Map;
|
|
5481
5754
|
for (const sourceFile of program.getSourceFiles()) {
|
|
5482
|
-
const resolvedFile =
|
|
5755
|
+
const resolvedFile = resolve13(sourceFile.fileName);
|
|
5483
5756
|
if (!isProjectSource(sourceFile, resolvedFile, projectRoot))
|
|
5484
5757
|
continue;
|
|
5485
5758
|
const analysis = analyzeSourceFile(sourceFile, checker, projectRoot);
|
|
@@ -5572,14 +5845,14 @@ var transformFile = (source, fileName, analysis) => {
|
|
|
5572
5845
|
};
|
|
5573
5846
|
var ABSOLUTE_MOBILE_TRANSFORM_PROTOCOL = ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION;
|
|
5574
5847
|
var createAbsoluteMobileRouteMetadataPlugin = (options) => {
|
|
5575
|
-
const projectRoot =
|
|
5576
|
-
const entry =
|
|
5848
|
+
const projectRoot = resolve13(options.projectRoot ?? process.cwd());
|
|
5849
|
+
const entry = resolve13(options.entry);
|
|
5577
5850
|
const analyzed = analyzeProgram(createProgram(entry, projectRoot), projectRoot);
|
|
5578
5851
|
return {
|
|
5579
5852
|
name: "absolute-mobile-route-metadata",
|
|
5580
5853
|
setup(build) {
|
|
5581
5854
|
build.onLoad({ filter: SOURCE_FILTER }, async ({ path }) => {
|
|
5582
|
-
const analysis = analyzed.get(
|
|
5855
|
+
const analysis = analyzed.get(resolve13(path));
|
|
5583
5856
|
if (!analysis)
|
|
5584
5857
|
return;
|
|
5585
5858
|
const source = await Bun.file(path).text();
|
|
@@ -5592,8 +5865,8 @@ var createAbsoluteMobileRouteMetadataPlugin = (options) => {
|
|
|
5592
5865
|
};
|
|
5593
5866
|
};
|
|
5594
5867
|
var inspectAbsoluteMobileRouteMetadata = (options) => {
|
|
5595
|
-
const projectRoot =
|
|
5596
|
-
const entry =
|
|
5868
|
+
const projectRoot = resolve13(options.projectRoot ?? process.cwd());
|
|
5869
|
+
const entry = resolve13(options.entry);
|
|
5597
5870
|
const analyzed = analyzeProgram(createProgram(entry, projectRoot), projectRoot);
|
|
5598
5871
|
return [...analyzed.entries()].flatMap(([file, analysis]) => [...analysis.byRouteCall.values()].map(({ metadata }) => ({
|
|
5599
5872
|
file: posixPath(relative10(projectRoot, file)),
|
|
@@ -5663,6 +5936,7 @@ export {
|
|
|
5663
5936
|
finalizeAbsoluteMobileCompatibilityBuild,
|
|
5664
5937
|
fetchAbsoluteMobilePage,
|
|
5665
5938
|
disposeAbsoluteMobilePage,
|
|
5939
|
+
discoverAbsoluteSyncSchema,
|
|
5666
5940
|
createAbsoluteRemoteIosDevProject,
|
|
5667
5941
|
createAbsoluteMobileUpgradeResponse,
|
|
5668
5942
|
createAbsoluteMobileRouteMetadataPlugin,
|
|
@@ -5710,5 +5984,5 @@ export {
|
|
|
5710
5984
|
ABSOLUTE_ANDROID_RELEASE_FORMAT
|
|
5711
5985
|
};
|
|
5712
5986
|
|
|
5713
|
-
//# debugId=
|
|
5987
|
+
//# debugId=3502D864F8FBB90464756E2164756E21
|
|
5714
5988
|
//# sourceMappingURL=index.js.map
|