@absolutejs/absolute 0.20.0-beta.31 → 0.20.0-beta.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +5 -1
- package/dist/angular/index.js.map +3 -3
- package/dist/angular/server.js +5 -1
- package/dist/angular/server.js.map +3 -3
- package/dist/build.js +7 -1
- package/dist/build.js.map +4 -4
- package/dist/cli/config/server.js +4 -0
- package/dist/cli/index.js +314 -90
- package/dist/dev/client/hmrClient.ts +5 -2
- package/dist/dev/client/hmrTiming.ts +2 -0
- package/dist/index.js +324 -230
- package/dist/index.js.map +11 -10
- package/dist/mobile/index.js +212 -31
- package/dist/mobile/index.js.map +11 -8
- package/dist/mobile/remoteMacAgentEntry.js +8 -8
- package/dist/react/index.js +5 -1
- package/dist/react/index.js.map +3 -3
- package/dist/react/server.js +5 -1
- package/dist/react/server.js.map +3 -3
- package/dist/src/cli/config/server.d.ts +1 -1
- package/dist/src/cli/scripts/dev.d.ts +1 -0
- package/dist/src/core/prepare.d.ts +340 -0
- package/dist/src/dev/devCert.d.ts +6 -4
- package/dist/src/mobile/androidEmulatorController.d.ts +8 -1
- package/dist/src/mobile/index.d.ts +1 -0
- package/dist/src/mobile/iosSimulatorController.d.ts +2 -0
- package/dist/src/mobile/mobilePreview.d.ts +174 -0
- package/dist/src/mobile/mobilePreviewClient.d.ts +1 -0
- package/dist/src/mobile/remoteMacProtocol.d.ts +1 -0
- package/dist/src/plugins/imageOptimizer.d.ts +1 -1
- package/dist/src/react/hooks/useMediaQuery.d.ts +1 -1
- package/dist/src/utils/logger.d.ts +1 -0
- package/dist/src/utils/startupBanner.d.ts +1 -0
- package/dist/src/utils/userAgentFunctions.d.ts +1 -1
- package/dist/svelte/index.js +5 -1
- package/dist/svelte/index.js.map +3 -3
- package/dist/svelte/server.js +5 -1
- package/dist/svelte/server.js.map +3 -3
- package/dist/types/messages.d.ts +1 -1
- package/dist/vue/index.js +5 -1
- package/dist/vue/index.js.map +3 -3
- package/dist/vue/server.js +5 -1
- package/dist/vue/server.js.map +3 -3
- package/package.json +1 -1
package/dist/mobile/index.js
CHANGED
|
@@ -118,6 +118,7 @@ var colors, MONTHS, formatTimestamp = () => {
|
|
|
118
118
|
port,
|
|
119
119
|
host,
|
|
120
120
|
networkUrl,
|
|
121
|
+
mobilePreviewUrl,
|
|
121
122
|
protocol = "http"
|
|
122
123
|
} = options;
|
|
123
124
|
const name = `${colors.cyan}${colors.bold}ABSOLUTEJS${colors.reset}`;
|
|
@@ -131,6 +132,9 @@ var colors, MONTHS, formatTimestamp = () => {
|
|
|
131
132
|
if (networkUrl) {
|
|
132
133
|
console.log(` ${colors.green}\u279C${colors.reset} ${colors.bold}Network:${colors.reset} ${networkUrl}`);
|
|
133
134
|
}
|
|
135
|
+
if (mobilePreviewUrl) {
|
|
136
|
+
console.log(` ${colors.green}\u279C${colors.reset} ${colors.bold}Mobile:${colors.reset} ${mobilePreviewUrl}`);
|
|
137
|
+
}
|
|
134
138
|
console.log("");
|
|
135
139
|
};
|
|
136
140
|
var init_startupBanner = __esm(() => {
|
|
@@ -855,6 +859,87 @@ var init_deviceCapabilities = __esm(() => {
|
|
|
855
859
|
];
|
|
856
860
|
});
|
|
857
861
|
|
|
862
|
+
// src/cli/scripts/telemetry.ts
|
|
863
|
+
import { existsSync as existsSync3, mkdirSync, readFileSync as readFileSync5, writeFileSync } from "fs";
|
|
864
|
+
import { homedir as homedir3 } from "os";
|
|
865
|
+
import { join as join15 } from "path";
|
|
866
|
+
var configDir, configPath, getTelemetryConfig = () => {
|
|
867
|
+
try {
|
|
868
|
+
if (!existsSync3(configPath))
|
|
869
|
+
return null;
|
|
870
|
+
const raw = readFileSync5(configPath, "utf-8");
|
|
871
|
+
const config = JSON.parse(raw);
|
|
872
|
+
return config;
|
|
873
|
+
} catch {
|
|
874
|
+
return null;
|
|
875
|
+
}
|
|
876
|
+
};
|
|
877
|
+
var init_telemetry = __esm(() => {
|
|
878
|
+
configDir = join15(homedir3(), ".absolutejs");
|
|
879
|
+
configPath = join15(configDir, "telemetry.json");
|
|
880
|
+
});
|
|
881
|
+
|
|
882
|
+
// src/cli/telemetryEvent.ts
|
|
883
|
+
import { existsSync as existsSync4, readFileSync as readFileSync6 } from "fs";
|
|
884
|
+
import { arch, platform } from "os";
|
|
885
|
+
import { dirname as dirname10, join as join16, parse } from "path";
|
|
886
|
+
var checkCandidate = (candidate) => {
|
|
887
|
+
if (!existsSync4(candidate)) {
|
|
888
|
+
return null;
|
|
889
|
+
}
|
|
890
|
+
const pkg = JSON.parse(readFileSync6(candidate, "utf-8"));
|
|
891
|
+
if (pkg.name === "@absolutejs/absolute") {
|
|
892
|
+
const ver = pkg.version;
|
|
893
|
+
return ver;
|
|
894
|
+
}
|
|
895
|
+
return null;
|
|
896
|
+
}, getVersion = () => {
|
|
897
|
+
try {
|
|
898
|
+
return findPackageVersion();
|
|
899
|
+
} catch {
|
|
900
|
+
return "unknown";
|
|
901
|
+
}
|
|
902
|
+
}, findPackageVersion = () => {
|
|
903
|
+
let { dir } = import.meta;
|
|
904
|
+
while (dir !== parse(dir).root) {
|
|
905
|
+
const candidate = join16(dir, "package.json");
|
|
906
|
+
const version = checkCandidate(candidate);
|
|
907
|
+
if (version) {
|
|
908
|
+
return version;
|
|
909
|
+
}
|
|
910
|
+
dir = dirname10(dir);
|
|
911
|
+
}
|
|
912
|
+
return "unknown";
|
|
913
|
+
}, sendTelemetryEvent = (event, payload) => {
|
|
914
|
+
try {
|
|
915
|
+
if (process.env.TELEMETRY_OFF === "1")
|
|
916
|
+
return;
|
|
917
|
+
const config = getTelemetryConfig();
|
|
918
|
+
if (!config?.enabled)
|
|
919
|
+
return;
|
|
920
|
+
const body = {
|
|
921
|
+
anonymousId: config.anonymousId,
|
|
922
|
+
arch: arch(),
|
|
923
|
+
bunVersion: Bun.version,
|
|
924
|
+
event,
|
|
925
|
+
os: platform(),
|
|
926
|
+
payload,
|
|
927
|
+
timestamp: new Date().toISOString(),
|
|
928
|
+
version: getVersion()
|
|
929
|
+
};
|
|
930
|
+
fetch("https://absolutejs.com/api/telemetry", {
|
|
931
|
+
body: JSON.stringify(body),
|
|
932
|
+
headers: { "Content-Type": "application/json" },
|
|
933
|
+
method: "POST"
|
|
934
|
+
}).catch(() => {
|
|
935
|
+
return;
|
|
936
|
+
});
|
|
937
|
+
} catch {}
|
|
938
|
+
};
|
|
939
|
+
var init_telemetryEvent = __esm(() => {
|
|
940
|
+
init_telemetry();
|
|
941
|
+
});
|
|
942
|
+
|
|
858
943
|
// src/mobile/artifactStore.ts
|
|
859
944
|
import { createHash as createHash2 } from "crypto";
|
|
860
945
|
import {
|
|
@@ -2615,6 +2700,22 @@ var requireSuccess2 = async (command, label, run, options) => {
|
|
|
2615
2700
|
if (exitCode !== 0)
|
|
2616
2701
|
throw new Error(`${label} failed with status ${exitCode}.`);
|
|
2617
2702
|
};
|
|
2703
|
+
var trustIosSimulatorDevelopmentCa = async (options, udid, run, log) => {
|
|
2704
|
+
if (!options.https)
|
|
2705
|
+
return;
|
|
2706
|
+
if (!options.certificateAuthorityPath) {
|
|
2707
|
+
throw new Error("iOS Simulator HTTPS requires the AbsoluteJS development CA certificate.");
|
|
2708
|
+
}
|
|
2709
|
+
await requireSuccess2([
|
|
2710
|
+
options.project.xcrun,
|
|
2711
|
+
"simctl",
|
|
2712
|
+
"keychain",
|
|
2713
|
+
udid,
|
|
2714
|
+
"add-root-cert",
|
|
2715
|
+
options.certificateAuthorityPath
|
|
2716
|
+
], "iOS Simulator development CA trust", run, { signal: options.signal });
|
|
2717
|
+
log("Installed the AbsoluteJS development CA into this iOS Simulator trust store.");
|
|
2718
|
+
};
|
|
2618
2719
|
var requireCapturedSuccess = (result, label) => {
|
|
2619
2720
|
if (result.exitCode !== 0) {
|
|
2620
2721
|
throw new Error(`${label} failed: ${result.stderr.trim() || result.stdout.trim() || `status ${result.exitCode}`}`);
|
|
@@ -3138,6 +3239,7 @@ var startAbsoluteIosDevSession = async (options) => {
|
|
|
3138
3239
|
transition("connecting");
|
|
3139
3240
|
await waitForBootedSimulator(project, device.udid, capture, sleep, options.signal);
|
|
3140
3241
|
await requireSuccess2([project.xcrun, "simctl", "bootstatus", device.udid, "-b"], "iOS simulator boot readiness", run, { signal: options.signal });
|
|
3242
|
+
await trustIosSimulatorDevelopmentCa(options, device.udid, run, log);
|
|
3141
3243
|
const fingerprint = await fingerprintPromise;
|
|
3142
3244
|
transition("checking-native");
|
|
3143
3245
|
const nativeCacheHit = await ensureIosDebugApp({
|
|
@@ -3733,6 +3835,7 @@ var startAbsoluteRemoteIosDevSession = async (options) => {
|
|
|
3733
3835
|
await syncProject(options.project);
|
|
3734
3836
|
const syncDuration = performance.now() - syncStartedAt;
|
|
3735
3837
|
const encodedConfig = Buffer.from(JSON.stringify(portableMobileConfig(options.project))).toString("base64url");
|
|
3838
|
+
const encodedCertificateAuthority = options.certificateAuthorityPath ? (await readFile8(options.certificateAuthorityPath)).toString("base64url") : undefined;
|
|
3736
3839
|
const remoteCommand = [
|
|
3737
3840
|
`cd ${shellQuote(options.project.remoteProjectRoot)}`,
|
|
3738
3841
|
"&&",
|
|
@@ -3743,6 +3846,10 @@ var startAbsoluteRemoteIosDevSession = async (options) => {
|
|
|
3743
3846
|
String(options.port),
|
|
3744
3847
|
"--mobile-config",
|
|
3745
3848
|
shellQuote(encodedConfig),
|
|
3849
|
+
...encodedCertificateAuthority ? [
|
|
3850
|
+
"--certificate-authority",
|
|
3851
|
+
shellQuote(encodedCertificateAuthority)
|
|
3852
|
+
] : [],
|
|
3746
3853
|
...options.https ? ["--https"] : []
|
|
3747
3854
|
].join(" ");
|
|
3748
3855
|
const command = [
|
|
@@ -5778,9 +5885,80 @@ var createAbsoluteMobileCompatibilityDispatcher = (options) => {
|
|
|
5778
5885
|
applyMobileCorsHeaders(responseValue, origin);
|
|
5779
5886
|
}).as("global");
|
|
5780
5887
|
};
|
|
5888
|
+
// src/mobile/mobilePreview.ts
|
|
5889
|
+
init_telemetryEvent();
|
|
5890
|
+
import { Elysia as Elysia3 } from "elysia";
|
|
5891
|
+
var ABSOLUTE_MOBILE_PREVIEW_PATH = "/__absolute/mobile-preview";
|
|
5892
|
+
var escapeHtml2 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """);
|
|
5893
|
+
var isRecord8 = (value) => typeof value === "object" && value !== null;
|
|
5894
|
+
var normalizeEntry2 = (entry) => {
|
|
5895
|
+
const parsed = new URL(entry ?? "/", "https://absolute.invalid");
|
|
5896
|
+
return `${parsed.pathname}${parsed.search}${parsed.hash}`;
|
|
5897
|
+
};
|
|
5898
|
+
var absoluteMobilePreviewDocument = (mobile) => {
|
|
5899
|
+
const entry = normalizeEntry2(mobile.entry);
|
|
5900
|
+
const appName = mobile.appName?.trim() || "AbsoluteJS App";
|
|
5901
|
+
const boot = JSON.stringify({ appName, entry }).replaceAll("<", "\\u003c");
|
|
5902
|
+
return `<!doctype html>
|
|
5903
|
+
<html lang="en">
|
|
5904
|
+
<head>
|
|
5905
|
+
<meta charset="utf-8">
|
|
5906
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
5907
|
+
<meta name="color-scheme" content="dark">
|
|
5908
|
+
<link rel="icon" href="data:,">
|
|
5909
|
+
<title>${escapeHtml2(appName)} \xB7 Mobile Preview</title>
|
|
5910
|
+
<style>
|
|
5911
|
+
:root{font-family:Inter,ui-sans-serif,system-ui,sans-serif;color:#e8ecf3;background:#080b12;color-scheme:dark}*{box-sizing:border-box}body{margin:0;min-height:100vh;background:radial-gradient(circle at 30% 0,#17213a 0,#080b12 42%)}button,input,select{font:inherit}.shell{display:grid;grid-template-columns:minmax(320px,1fr) 292px;gap:24px;min-height:100vh;padding:24px}.stage{display:grid;place-items:center;min-width:0}.device{position:relative;width:min(100%,430px);height:min(880px,calc(100vh - 48px));min-height:620px;padding:12px;border:1px solid #343c4d;border-radius:48px;background:#111620;box-shadow:0 35px 80px #0009,inset 0 0 0 1px #ffffff0d}.device.android{border-radius:30px}.screen{position:relative;width:100%;height:100%;overflow:hidden;border-radius:37px;background:#fff}.android .screen{border-radius:20px}.island{position:absolute;z-index:2;top:17px;left:50%;width:112px;height:30px;transform:translateX(-50%);border-radius:18px;background:#080b12;pointer-events:none}.android .island{width:9px;height:9px;top:10px}.app{width:100%;height:100%;border:0;background:#fff}.panel{align-self:start;position:sticky;top:24px;max-height:calc(100vh - 48px);overflow:auto;padding:18px;border:1px solid #262d3a;border-radius:20px;background:#0e131dcc;box-shadow:0 18px 50px #0005;backdrop-filter:blur(18px)}h1{font-size:18px;margin:0}.sub{margin:5px 0 18px;color:#8f9aae;font-size:12px}.status{display:flex;align-items:center;gap:8px;margin-bottom:18px;padding:9px 11px;border-radius:10px;background:#151c28;color:#aeb8ca;font-size:12px}.dot{width:8px;height:8px;border-radius:50%;background:#eab308}.ready .dot{background:#22c55e}.group{padding:14px 0;border-top:1px solid #252c39}.group:first-of-type{border-top:0}.label{display:block;margin-bottom:8px;color:#97a3b7;font-size:11px;font-weight:700;letter-spacing:.08em;text-transform:uppercase}.row{display:flex;gap:8px}.row>*{min-width:0}.grow{flex:1}button,select,input{border:1px solid #30394a;border-radius:9px;background:#171e2b;color:#e8ecf3;padding:9px 10px}button{cursor:pointer}button:hover{border-color:#64748b;background:#202a3a}button.active{border-color:#60a5fa;background:#172b48;color:#bfdbfe}input{width:100%}.events{height:84px;overflow:auto;margin-top:8px;padding:8px;border-radius:9px;background:#090d14;color:#8290a7;font:11px/1.5 ui-monospace,monospace}.hint{margin-top:12px;color:#64748b;font-size:11px;line-height:1.45}@media(max-width:840px){.shell{grid-template-columns:1fr;padding:12px}.device{height:720px}.panel{position:static;max-height:none}}
|
|
5912
|
+
</style>
|
|
5913
|
+
</head>
|
|
5914
|
+
<body>
|
|
5915
|
+
<main class="shell">
|
|
5916
|
+
<section class="stage"><div class="device" id="device"><div class="island"></div><div class="screen"><iframe class="app" id="app" title="${escapeHtml2(appName)} mobile runtime"></iframe></div></div></section>
|
|
5917
|
+
<aside class="panel">
|
|
5918
|
+
<h1>${escapeHtml2(appName)}</h1><p class="sub">AbsoluteJS mobile runtime preview</p>
|
|
5919
|
+
<div class="status" id="status"><span class="dot"></span><span id="statusText">Starting runtime\u2026</span></div>
|
|
5920
|
+
<div class="group"><span class="label">Device</span><div class="row"><button id="ios" class="grow active">iOS</button><button id="android" class="grow">Android</button></div></div>
|
|
5921
|
+
<div class="group"><label class="label" for="route">Route / deep link</label><div class="row"><input id="route" value="${escapeHtml2(entry)}"><button id="go">Go</button></div><div class="row" style="margin-top:8px"><button id="deepLink" class="grow">Emit deep link</button><button id="back" class="grow">Hardware back</button></div></div>
|
|
5922
|
+
<div class="group"><span class="label">Connection</span><div class="row"><button id="online" class="grow active">Wi-Fi</button><button id="cellular" class="grow">Cellular</button><button id="offline" class="grow">Offline</button></div></div>
|
|
5923
|
+
<div class="group"><span class="label">Lifecycle</span><div class="row"><button id="active" class="grow active">Active</button><button id="background" class="grow">Background</button><button id="inactive" class="grow">Inactive</button></div></div>
|
|
5924
|
+
<div class="group"><span class="label">Keyboard</span><div class="row"><button id="keyboardShow" class="grow">Show</button><button id="keyboardHide" class="grow">Hide</button></div></div>
|
|
5925
|
+
<div class="group"><label class="label" for="permission">Permissions</label><div class="row"><select id="permission" class="grow"><option value="camera">Camera</option><option value="location">Location</option><option value="notifications">Notifications</option></select><select id="permissionState" class="grow"><option value="prompt">Prompt</option><option value="granted">Granted</option><option value="denied">Denied</option><option value="blocked">Blocked</option></select></div><button id="applyPermission" style="width:100%;margin-top:8px">Apply permission state</button></div>
|
|
5926
|
+
<div class="group"><span class="label">Runtime events</span><div class="events" id="events" aria-live="polite"></div><p class="hint">This runs the same development pages, HMR client, provider-neutral HTTP, and Devices contracts as an installed target. Native rendering, signing, push delivery, and OS scheduling still require a simulator or physical device.</p></div>
|
|
5927
|
+
</aside>
|
|
5928
|
+
</main>
|
|
5929
|
+
<script>const config=${boot};const frame=document.getElementById('app');const device=document.getElementById('device');const status=document.getElementById('status');const statusText=document.getElementById('statusText');const events=document.getElementById('events');let platform='ios';const event=(text)=>{const line=document.createElement('div');line.textContent=new Date().toLocaleTimeString()+' \xB7 '+text;events.prepend(line)};const routeUrl=()=>{const value=document.getElementById('route').value.trim()||config.entry;const url=new URL(value,location.origin);if(url.origin!==location.origin)throw new TypeError('Preview routes must stay on this dev server.');url.searchParams.set('__absolute_target','mobile-preview');url.searchParams.set('__absolute_preview_platform',platform);return url};const load=()=>{try{status.classList.remove('ready');statusText.textContent='Starting runtime\u2026';frame.src=routeUrl().href;event('loaded '+routeUrl().pathname)}catch(error){statusText.textContent=error.message}};const send=(message)=>{if(!frame.contentWindow)return;frame.contentWindow.postMessage(message,location.origin);event(message.type.replace('absolute-preview:',''))};const select=(ids,active)=>ids.forEach(id=>document.getElementById(id).classList.toggle('active',id===active));document.getElementById('ios').onclick=()=>{platform='ios';device.classList.remove('android');select(['ios','android'],'ios');load()};document.getElementById('android').onclick=()=>{platform='android';device.classList.add('android');select(['ios','android'],'android');load()};document.getElementById('go').onclick=load;document.getElementById('route').onkeydown=e=>{if(e.key==='Enter')load()};document.getElementById('deepLink').onclick=()=>send({type:'absolute-preview:deep-link',url:new URL(document.getElementById('route').value,location.origin).href});document.getElementById('back').onclick=()=>send({type:'absolute-preview:back'});[['online',true,'wifi'],['cellular',true,'cellular'],['offline',false,'none']].forEach(([id,connected,connectionType])=>document.getElementById(id).onclick=()=>{select(['online','cellular','offline'],id);send({type:'absolute-preview:network',connected,connectionType})});['active','background','inactive'].forEach(id=>document.getElementById(id).onclick=()=>{select(['active','background','inactive'],id);send({type:'absolute-preview:lifecycle',state:id})});document.getElementById('keyboardShow').onclick=()=>send({type:'absolute-preview:keyboard',visible:true,heightPx:320});document.getElementById('keyboardHide').onclick=()=>send({type:'absolute-preview:keyboard',visible:false,heightPx:0});document.getElementById('applyPermission').onclick=()=>send({type:'absolute-preview:permission',capability:document.getElementById('permission').value,state:document.getElementById('permissionState').value});addEventListener('message',e=>{if(e.origin!==location.origin||e.source!==frame.contentWindow||!e.data||typeof e.data.type!=='string'||!e.data.type.startsWith('absolute-preview:'))return;if(e.data.type==='absolute-preview:ready'){status.classList.add('ready');statusText.textContent=platform==='ios'?'iOS runtime connected':'Android runtime connected'}event(e.data.event||e.data.type.replace('absolute-preview:',''))});load();</script>
|
|
5930
|
+
</body>
|
|
5931
|
+
</html>`;
|
|
5932
|
+
};
|
|
5933
|
+
var createAbsoluteMobilePreviewPlugin = (mobile) => {
|
|
5934
|
+
if (!mobile)
|
|
5935
|
+
return new Elysia3({ name: "absolutejs-mobile-preview-disabled" });
|
|
5936
|
+
return new Elysia3({ name: "absolutejs-mobile-preview" }).get(ABSOLUTE_MOBILE_PREVIEW_PATH, () => new Response(absoluteMobilePreviewDocument(mobile), {
|
|
5937
|
+
headers: {
|
|
5938
|
+
"Cache-Control": "no-store",
|
|
5939
|
+
"Content-Security-Policy": "default-src 'self'; script-src 'unsafe-inline' 'self'; style-src 'unsafe-inline'; frame-src 'self'; img-src 'self' data: blob:; connect-src 'self' ws: wss:",
|
|
5940
|
+
"Content-Type": "text/html; charset=utf-8",
|
|
5941
|
+
"X-Robots-Tag": "noindex, nofollow"
|
|
5942
|
+
}
|
|
5943
|
+
})).post("/__absolute/mobile-preview-telemetry", ({ body, status }) => {
|
|
5944
|
+
const value = isRecord8(body) ? body : undefined;
|
|
5945
|
+
const durationMs = value?.durationMs;
|
|
5946
|
+
const platform2 = value?.platform;
|
|
5947
|
+
if (typeof durationMs !== "number" || !Number.isFinite(durationMs) || durationMs < 0 || durationMs > 300000 || platform2 !== "android" && platform2 !== "ios") {
|
|
5948
|
+
return status(400, { error: "invalid-preview-telemetry" });
|
|
5949
|
+
}
|
|
5950
|
+
sendTelemetryEvent("mobile:preview-ready", {
|
|
5951
|
+
durationMs: Math.round(durationMs),
|
|
5952
|
+
platform: platform2,
|
|
5953
|
+
provider: "capacitor",
|
|
5954
|
+
target: "mobile-preview"
|
|
5955
|
+
});
|
|
5956
|
+
return status(204);
|
|
5957
|
+
});
|
|
5958
|
+
};
|
|
5781
5959
|
// src/mobile/nativeDeepLinks.ts
|
|
5782
5960
|
import { readFile as readFile14, rename as rename11, writeFile as writeFile12 } from "fs/promises";
|
|
5783
|
-
import { join as
|
|
5961
|
+
import { join as join17 } from "path";
|
|
5784
5962
|
var START_MARKER = "<!-- absolutejs:deep-links:start -->";
|
|
5785
5963
|
var END_MARKER = "<!-- absolutejs:deep-links:end -->";
|
|
5786
5964
|
var IOS_ENTITLEMENTS = "App/AbsoluteJS.entitlements";
|
|
@@ -5837,7 +6015,7 @@ ${hosts}
|
|
|
5837
6015
|
`;
|
|
5838
6016
|
};
|
|
5839
6017
|
var configureAndroid = async (config) => {
|
|
5840
|
-
const path =
|
|
6018
|
+
const path = join17(config.nativeProjectDirectory, "android/app/src/main/AndroidManifest.xml");
|
|
5841
6019
|
const source = await readFile14(path, "utf8");
|
|
5842
6020
|
const mainActivity = source.indexOf('android:name=".MainActivity"');
|
|
5843
6021
|
if (mainActivity === NOT_FOUND) {
|
|
@@ -5863,7 +6041,7 @@ var iosSchemeRegion = (scheme) => ` ${START_MARKER}
|
|
|
5863
6041
|
${END_MARKER}
|
|
5864
6042
|
`;
|
|
5865
6043
|
var configureIosInfo = async (config) => {
|
|
5866
|
-
const path =
|
|
6044
|
+
const path = join17(config.nativeProjectDirectory, "ios/App/App/Info.plist");
|
|
5867
6045
|
const source = await readFile14(path, "utf8");
|
|
5868
6046
|
const region = config.deepLinkScheme ? iosSchemeRegion(config.deepLinkScheme) : ` ${START_MARKER}
|
|
5869
6047
|
${END_MARKER}
|
|
@@ -5887,7 +6065,7 @@ ${domains}
|
|
|
5887
6065
|
`;
|
|
5888
6066
|
};
|
|
5889
6067
|
var configureIosEntitlements = async (config) => {
|
|
5890
|
-
const path =
|
|
6068
|
+
const path = join17(config.nativeProjectDirectory, "ios/App/AbsoluteJS.entitlements");
|
|
5891
6069
|
let current = "";
|
|
5892
6070
|
try {
|
|
5893
6071
|
current = await readFile14(path, "utf8");
|
|
@@ -5905,7 +6083,7 @@ var configureIosEntitlements = async (config) => {
|
|
|
5905
6083
|
return true;
|
|
5906
6084
|
};
|
|
5907
6085
|
var configureIosProject = async (config) => {
|
|
5908
|
-
const path =
|
|
6086
|
+
const path = join17(config.nativeProjectDirectory, "ios/App/App.xcodeproj/project.pbxproj");
|
|
5909
6087
|
const source = await readFile14(path, "utf8");
|
|
5910
6088
|
const declarations = [
|
|
5911
6089
|
...source.matchAll(/CODE_SIGN_ENTITLEMENTS = ([^;]+);/g)
|
|
@@ -5935,18 +6113,18 @@ var configureIos = async (config) => {
|
|
|
5935
6113
|
return changed.some(Boolean);
|
|
5936
6114
|
};
|
|
5937
6115
|
var applyAbsoluteNativeDeepLinks = async (config, platforms = config.platforms) => {
|
|
5938
|
-
const results = await Promise.all(platforms.map(async (
|
|
5939
|
-
const didChange =
|
|
5940
|
-
return { didChange, platform };
|
|
6116
|
+
const results = await Promise.all(platforms.map(async (platform2) => {
|
|
6117
|
+
const didChange = platform2 === "android" ? await configureAndroid(config) : await configureIos(config);
|
|
6118
|
+
return { didChange, platform: platform2 };
|
|
5941
6119
|
}));
|
|
5942
6120
|
return {
|
|
5943
|
-
changed: results.filter(({ didChange }) => didChange).map(({ platform }) =>
|
|
6121
|
+
changed: results.filter(({ didChange }) => didChange).map(({ platform: platform2 }) => platform2)
|
|
5944
6122
|
};
|
|
5945
6123
|
};
|
|
5946
6124
|
// src/mobile/nativeDeviceCapabilities.ts
|
|
5947
6125
|
init_deviceCapabilities();
|
|
5948
6126
|
import { readFile as readFile15, rename as rename12, writeFile as writeFile13 } from "fs/promises";
|
|
5949
|
-
import { join as
|
|
6127
|
+
import { join as join18 } from "path";
|
|
5950
6128
|
var START_MARKER2 = "<!-- absolutejs:device-capabilities:start -->";
|
|
5951
6129
|
var END_MARKER2 = "<!-- absolutejs:device-capabilities:end -->";
|
|
5952
6130
|
var NOT_FOUND2 = -1;
|
|
@@ -6096,7 +6274,7 @@ var writeIosPrivacyManifest = async (path, current, source) => {
|
|
|
6096
6274
|
var configureIosPrivacyProject = async (config, requirements) => {
|
|
6097
6275
|
if (requirements.iosPrivacyAccessedApis.length === 0)
|
|
6098
6276
|
return false;
|
|
6099
|
-
const projectPath =
|
|
6277
|
+
const projectPath = join18(config.nativeProjectDirectory, "ios/App/App.xcodeproj/project.pbxproj");
|
|
6100
6278
|
const project = await readFile15(projectPath, "utf8");
|
|
6101
6279
|
return writeChangedFile2(projectPath, addIosPrivacyProjectReference(project));
|
|
6102
6280
|
};
|
|
@@ -6149,7 +6327,7 @@ ${next.slice(index)}`;
|
|
|
6149
6327
|
return next;
|
|
6150
6328
|
};
|
|
6151
6329
|
var configureIos2 = async (config, plan) => {
|
|
6152
|
-
const path =
|
|
6330
|
+
const path = join18(config.nativeProjectDirectory, "ios/App/App/Info.plist");
|
|
6153
6331
|
const source = await readFile15(path, "utf8");
|
|
6154
6332
|
const requirements = absoluteDeviceNativeRequirements(plan);
|
|
6155
6333
|
const existingSystemBars = source.match(/<key>UIViewControllerBasedStatusBarAppearance<\/key>\s*<(true|false)\s*\/>/u);
|
|
@@ -6170,7 +6348,7 @@ ${content}
|
|
|
6170
6348
|
${END_MARKER2}
|
|
6171
6349
|
` : "";
|
|
6172
6350
|
const infoChanged = await writeChangedFile2(path, managed(source, region, source.lastIndexOf("</dict>")));
|
|
6173
|
-
const privacyPath =
|
|
6351
|
+
const privacyPath = join18(config.nativeProjectDirectory, "ios/App/App/PrivacyInfo.xcprivacy");
|
|
6174
6352
|
const privacyCurrent = await optionalSource(privacyPath);
|
|
6175
6353
|
const privacySource = privacyManifestSource(privacyCurrent, requirements);
|
|
6176
6354
|
const [privacyChanged, projectChanged, pushChanged] = await Promise.all([
|
|
@@ -6181,7 +6359,7 @@ ${content}
|
|
|
6181
6359
|
return infoChanged || privacyChanged || projectChanged || pushChanged;
|
|
6182
6360
|
};
|
|
6183
6361
|
var configureIosPushNotifications = async (config, enabled) => {
|
|
6184
|
-
const entitlementsPath =
|
|
6362
|
+
const entitlementsPath = join18(config.nativeProjectDirectory, "ios/App/AbsoluteJS.entitlements");
|
|
6185
6363
|
const entitlements = await optionalSource(entitlementsPath);
|
|
6186
6364
|
if (entitlements === null && !enabled)
|
|
6187
6365
|
return false;
|
|
@@ -6193,7 +6371,7 @@ var configureIosPushNotifications = async (config, enabled) => {
|
|
|
6193
6371
|
<!-- ${PUSH_END_MARKER} -->
|
|
6194
6372
|
` : "";
|
|
6195
6373
|
const nextEntitlements = replacePushRegion(entitlements, entitlementRegion, entitlements.lastIndexOf("</dict>"));
|
|
6196
|
-
const delegatePath =
|
|
6374
|
+
const delegatePath = join18(config.nativeProjectDirectory, "ios/App/App/AppDelegate.swift");
|
|
6197
6375
|
const delegate = await optionalSource(delegatePath);
|
|
6198
6376
|
if (delegate === null && !enabled)
|
|
6199
6377
|
return false;
|
|
@@ -6242,7 +6420,7 @@ var replacePushRegion = (source, region, insertion) => {
|
|
|
6242
6420
|
return `${source.slice(0, insertion)}${region}${source.slice(insertion)}`;
|
|
6243
6421
|
};
|
|
6244
6422
|
var configureAndroid2 = async (config, plan) => {
|
|
6245
|
-
const path =
|
|
6423
|
+
const path = join18(config.nativeProjectDirectory, "android/app/src/main/AndroidManifest.xml");
|
|
6246
6424
|
const source = await readFile15(path, "utf8");
|
|
6247
6425
|
const permissions = absoluteDeviceNativeRequirements(plan).androidPermissions;
|
|
6248
6426
|
const content = permissions.map((permission) => ` <uses-permission android:name="${escapeXml2(permission)}" />`).join(`
|
|
@@ -6278,17 +6456,17 @@ ${content}
|
|
|
6278
6456
|
throw new TypeError(`Android google-services.json does not contain package ${config.appId}.`);
|
|
6279
6457
|
const [manifestChanged, firebaseChanged] = await Promise.all([
|
|
6280
6458
|
writeChangedFile2(path, nextManifest),
|
|
6281
|
-
writeOptionalChangedFile(
|
|
6459
|
+
writeOptionalChangedFile(join18(config.nativeProjectDirectory, "android/app/google-services.json"), firebaseSource)
|
|
6282
6460
|
]);
|
|
6283
6461
|
return manifestChanged || firebaseChanged;
|
|
6284
6462
|
};
|
|
6285
6463
|
var applyAbsoluteNativeDeviceCapabilities = async (projectRoot, config, platforms = config.platforms, plan = resolveAbsoluteDeviceCapabilityPlan(projectRoot)) => {
|
|
6286
|
-
const results = await Promise.all(platforms.map(async (
|
|
6287
|
-
didChange:
|
|
6288
|
-
platform
|
|
6464
|
+
const results = await Promise.all(platforms.map(async (platform2) => ({
|
|
6465
|
+
didChange: platform2 === "ios" ? await configureIos2(config, plan) : await configureAndroid2(config, plan),
|
|
6466
|
+
platform: platform2
|
|
6289
6467
|
})));
|
|
6290
6468
|
return {
|
|
6291
|
-
changed: results.filter(({ didChange }) => didChange).map(({ platform }) =>
|
|
6469
|
+
changed: results.filter(({ didChange }) => didChange).map(({ platform: platform2 }) => platform2)
|
|
6292
6470
|
};
|
|
6293
6471
|
};
|
|
6294
6472
|
// src/mobile/releasePublisher.ts
|
|
@@ -6316,8 +6494,8 @@ var prepareAbsoluteAndroidRelease = async (publisher, options) => {
|
|
|
6316
6494
|
}
|
|
6317
6495
|
return versionCode;
|
|
6318
6496
|
};
|
|
6319
|
-
var
|
|
6320
|
-
var isPublisher = (value) =>
|
|
6497
|
+
var isRecord9 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6498
|
+
var isPublisher = (value) => isRecord9(value) && typeof value.publish === "function";
|
|
6321
6499
|
var publisherModulePath = (projectRoot, requested) => {
|
|
6322
6500
|
const root = resolve13(projectRoot);
|
|
6323
6501
|
const path = resolve13(root, requested);
|
|
@@ -6333,7 +6511,7 @@ var loadAbsoluteNativeReleasePublisher = async (projectRoot, requestedModulePath
|
|
|
6333
6511
|
throw new TypeError(`Native release registry module does not exist: ${modulePath}`);
|
|
6334
6512
|
});
|
|
6335
6513
|
const loaded = await import(pathToFileURL3(modulePath).href);
|
|
6336
|
-
const publisher =
|
|
6514
|
+
const publisher = isRecord9(loaded) ? loaded.default ?? loaded.registry : undefined;
|
|
6337
6515
|
if (!isPublisher(publisher)) {
|
|
6338
6516
|
throw new TypeError("Native release registry module must default-export a registry with publish(options).");
|
|
6339
6517
|
}
|
|
@@ -6390,8 +6568,8 @@ var publishAbsoluteIosRelease = async (options) => {
|
|
|
6390
6568
|
return publication;
|
|
6391
6569
|
};
|
|
6392
6570
|
// src/mobile/routeMetadataTransform.ts
|
|
6393
|
-
import { existsSync as
|
|
6394
|
-
import { dirname as
|
|
6571
|
+
import { existsSync as existsSync5, readFileSync as readFileSync7 } from "fs";
|
|
6572
|
+
import { dirname as dirname11, extname as extname4, relative as relative11, resolve as resolve14 } from "path";
|
|
6395
6573
|
import ts2 from "typescript";
|
|
6396
6574
|
var ROUTE_METHODS = new Set(["get", "head"]);
|
|
6397
6575
|
var SOURCE_FILTER = /\.[cm]?[jt]sx?$/;
|
|
@@ -6442,10 +6620,10 @@ var PAGE_HANDLERS = new Map([
|
|
|
6442
6620
|
]
|
|
6443
6621
|
]);
|
|
6444
6622
|
var posixPath = (value) => value.replace(/\\/g, "/");
|
|
6445
|
-
var findTsconfig = (entry, projectRoot) => ts2.findConfigFile(
|
|
6623
|
+
var findTsconfig = (entry, projectRoot) => ts2.findConfigFile(dirname11(entry), existsSync5, "tsconfig.json") ?? ts2.findConfigFile(projectRoot, existsSync5, "tsconfig.json");
|
|
6446
6624
|
var createProgram = (entry, projectRoot) => {
|
|
6447
|
-
const
|
|
6448
|
-
if (!
|
|
6625
|
+
const configPath2 = findTsconfig(entry, projectRoot);
|
|
6626
|
+
if (!configPath2) {
|
|
6449
6627
|
return ts2.createProgram([entry], {
|
|
6450
6628
|
allowJs: true,
|
|
6451
6629
|
jsx: ts2.JsxEmit.ReactJSX,
|
|
@@ -6454,7 +6632,7 @@ var createProgram = (entry, projectRoot) => {
|
|
|
6454
6632
|
target: ts2.ScriptTarget.ESNext
|
|
6455
6633
|
});
|
|
6456
6634
|
}
|
|
6457
|
-
const parsed = ts2.parseJsonConfigFileContent(ts2.readConfigFile(
|
|
6635
|
+
const parsed = ts2.parseJsonConfigFileContent(ts2.readConfigFile(configPath2, (path) => readFileSync7(path, "utf8")).config, ts2.sys, dirname11(configPath2));
|
|
6458
6636
|
if (!parsed.fileNames.includes(entry))
|
|
6459
6637
|
parsed.fileNames.push(entry);
|
|
6460
6638
|
return ts2.createProgram(parsed.fileNames, parsed.options);
|
|
@@ -7202,6 +7380,7 @@ export {
|
|
|
7202
7380
|
createAbsoluteRemoteIosDevProject,
|
|
7203
7381
|
createAbsoluteMobileUpgradeResponse,
|
|
7204
7382
|
createAbsoluteMobileRouteMetadataPlugin,
|
|
7383
|
+
createAbsoluteMobilePreviewPlugin,
|
|
7205
7384
|
createAbsoluteMobilePageRequest,
|
|
7206
7385
|
createAbsoluteMobilePageErrorResponse,
|
|
7207
7386
|
createAbsoluteMobileInvalidRequestResponse,
|
|
@@ -7225,6 +7404,7 @@ export {
|
|
|
7225
7404
|
acceptsAbsoluteMobilePage,
|
|
7226
7405
|
absoluteRemoteProjectSyncCommands,
|
|
7227
7406
|
absoluteRemoteMacSshBase,
|
|
7407
|
+
absoluteMobilePreviewDocument,
|
|
7228
7408
|
absoluteDeviceNativeRequirements,
|
|
7229
7409
|
MOBILE_PAGE_REQUEST_HEADERS,
|
|
7230
7410
|
AbsoluteMobilePageProtocolError,
|
|
@@ -7238,6 +7418,7 @@ export {
|
|
|
7238
7418
|
ABSOLUTE_MOBILE_TRANSFORM_PROTOCOL,
|
|
7239
7419
|
ABSOLUTE_MOBILE_ROUTE_DETAIL,
|
|
7240
7420
|
ABSOLUTE_MOBILE_RETAINED_GENERATIONS,
|
|
7421
|
+
ABSOLUTE_MOBILE_PREVIEW_PATH,
|
|
7241
7422
|
ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION,
|
|
7242
7423
|
ABSOLUTE_MOBILE_PAGE_MEDIA_TYPE,
|
|
7243
7424
|
ABSOLUTE_MOBILE_MATERIALIZED_BUNDLE_FORMAT,
|
|
@@ -7249,5 +7430,5 @@ export {
|
|
|
7249
7430
|
ABSOLUTE_ANDROID_RELEASE_FORMAT
|
|
7250
7431
|
};
|
|
7251
7432
|
|
|
7252
|
-
//# debugId=
|
|
7433
|
+
//# debugId=558FB72C0F151C5864756E2164756E21
|
|
7253
7434
|
//# sourceMappingURL=index.js.map
|