@absolutejs/absolute 0.20.0-beta.31 → 0.20.0-beta.32
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 +1 -0
- package/dist/dev/client/hmrClient.ts +5 -2
- package/dist/dev/client/hmrTiming.ts +2 -0
- package/dist/index.js +284 -204
- package/dist/index.js.map +10 -9
- package/dist/mobile/index.js +190 -31
- package/dist/mobile/index.js.map +8 -5
- package/dist/mobile/remoteMacAgentEntry.js +5 -5
- 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/core/prepare.d.ts +340 -0
- package/dist/src/mobile/index.d.ts +1 -0
- package/dist/src/mobile/mobilePreview.d.ts +174 -0
- package/dist/src/mobile/mobilePreviewClient.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 {
|
|
@@ -5778,9 +5863,80 @@ var createAbsoluteMobileCompatibilityDispatcher = (options) => {
|
|
|
5778
5863
|
applyMobileCorsHeaders(responseValue, origin);
|
|
5779
5864
|
}).as("global");
|
|
5780
5865
|
};
|
|
5866
|
+
// src/mobile/mobilePreview.ts
|
|
5867
|
+
init_telemetryEvent();
|
|
5868
|
+
import { Elysia as Elysia3 } from "elysia";
|
|
5869
|
+
var ABSOLUTE_MOBILE_PREVIEW_PATH = "/__absolute/mobile-preview";
|
|
5870
|
+
var escapeHtml2 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """);
|
|
5871
|
+
var isRecord8 = (value) => typeof value === "object" && value !== null;
|
|
5872
|
+
var normalizeEntry2 = (entry) => {
|
|
5873
|
+
const parsed = new URL(entry ?? "/", "https://absolute.invalid");
|
|
5874
|
+
return `${parsed.pathname}${parsed.search}${parsed.hash}`;
|
|
5875
|
+
};
|
|
5876
|
+
var absoluteMobilePreviewDocument = (mobile) => {
|
|
5877
|
+
const entry = normalizeEntry2(mobile.entry);
|
|
5878
|
+
const appName = mobile.appName?.trim() || "AbsoluteJS App";
|
|
5879
|
+
const boot = JSON.stringify({ appName, entry }).replaceAll("<", "\\u003c");
|
|
5880
|
+
return `<!doctype html>
|
|
5881
|
+
<html lang="en">
|
|
5882
|
+
<head>
|
|
5883
|
+
<meta charset="utf-8">
|
|
5884
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
5885
|
+
<meta name="color-scheme" content="dark">
|
|
5886
|
+
<link rel="icon" href="data:,">
|
|
5887
|
+
<title>${escapeHtml2(appName)} \xB7 Mobile Preview</title>
|
|
5888
|
+
<style>
|
|
5889
|
+
: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}}
|
|
5890
|
+
</style>
|
|
5891
|
+
</head>
|
|
5892
|
+
<body>
|
|
5893
|
+
<main class="shell">
|
|
5894
|
+
<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>
|
|
5895
|
+
<aside class="panel">
|
|
5896
|
+
<h1>${escapeHtml2(appName)}</h1><p class="sub">AbsoluteJS mobile runtime preview</p>
|
|
5897
|
+
<div class="status" id="status"><span class="dot"></span><span id="statusText">Starting runtime\u2026</span></div>
|
|
5898
|
+
<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>
|
|
5899
|
+
<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>
|
|
5900
|
+
<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>
|
|
5901
|
+
<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>
|
|
5902
|
+
<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>
|
|
5903
|
+
<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>
|
|
5904
|
+
<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>
|
|
5905
|
+
</aside>
|
|
5906
|
+
</main>
|
|
5907
|
+
<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>
|
|
5908
|
+
</body>
|
|
5909
|
+
</html>`;
|
|
5910
|
+
};
|
|
5911
|
+
var createAbsoluteMobilePreviewPlugin = (mobile) => {
|
|
5912
|
+
if (!mobile)
|
|
5913
|
+
return new Elysia3({ name: "absolutejs-mobile-preview-disabled" });
|
|
5914
|
+
return new Elysia3({ name: "absolutejs-mobile-preview" }).get(ABSOLUTE_MOBILE_PREVIEW_PATH, () => new Response(absoluteMobilePreviewDocument(mobile), {
|
|
5915
|
+
headers: {
|
|
5916
|
+
"Cache-Control": "no-store",
|
|
5917
|
+
"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:",
|
|
5918
|
+
"Content-Type": "text/html; charset=utf-8",
|
|
5919
|
+
"X-Robots-Tag": "noindex, nofollow"
|
|
5920
|
+
}
|
|
5921
|
+
})).post("/__absolute/mobile-preview-telemetry", ({ body, status }) => {
|
|
5922
|
+
const value = isRecord8(body) ? body : undefined;
|
|
5923
|
+
const durationMs = value?.durationMs;
|
|
5924
|
+
const platform2 = value?.platform;
|
|
5925
|
+
if (typeof durationMs !== "number" || !Number.isFinite(durationMs) || durationMs < 0 || durationMs > 300000 || platform2 !== "android" && platform2 !== "ios") {
|
|
5926
|
+
return status(400, { error: "invalid-preview-telemetry" });
|
|
5927
|
+
}
|
|
5928
|
+
sendTelemetryEvent("mobile:preview-ready", {
|
|
5929
|
+
durationMs: Math.round(durationMs),
|
|
5930
|
+
platform: platform2,
|
|
5931
|
+
provider: "capacitor",
|
|
5932
|
+
target: "mobile-preview"
|
|
5933
|
+
});
|
|
5934
|
+
return status(204);
|
|
5935
|
+
});
|
|
5936
|
+
};
|
|
5781
5937
|
// src/mobile/nativeDeepLinks.ts
|
|
5782
5938
|
import { readFile as readFile14, rename as rename11, writeFile as writeFile12 } from "fs/promises";
|
|
5783
|
-
import { join as
|
|
5939
|
+
import { join as join17 } from "path";
|
|
5784
5940
|
var START_MARKER = "<!-- absolutejs:deep-links:start -->";
|
|
5785
5941
|
var END_MARKER = "<!-- absolutejs:deep-links:end -->";
|
|
5786
5942
|
var IOS_ENTITLEMENTS = "App/AbsoluteJS.entitlements";
|
|
@@ -5837,7 +5993,7 @@ ${hosts}
|
|
|
5837
5993
|
`;
|
|
5838
5994
|
};
|
|
5839
5995
|
var configureAndroid = async (config) => {
|
|
5840
|
-
const path =
|
|
5996
|
+
const path = join17(config.nativeProjectDirectory, "android/app/src/main/AndroidManifest.xml");
|
|
5841
5997
|
const source = await readFile14(path, "utf8");
|
|
5842
5998
|
const mainActivity = source.indexOf('android:name=".MainActivity"');
|
|
5843
5999
|
if (mainActivity === NOT_FOUND) {
|
|
@@ -5863,7 +6019,7 @@ var iosSchemeRegion = (scheme) => ` ${START_MARKER}
|
|
|
5863
6019
|
${END_MARKER}
|
|
5864
6020
|
`;
|
|
5865
6021
|
var configureIosInfo = async (config) => {
|
|
5866
|
-
const path =
|
|
6022
|
+
const path = join17(config.nativeProjectDirectory, "ios/App/App/Info.plist");
|
|
5867
6023
|
const source = await readFile14(path, "utf8");
|
|
5868
6024
|
const region = config.deepLinkScheme ? iosSchemeRegion(config.deepLinkScheme) : ` ${START_MARKER}
|
|
5869
6025
|
${END_MARKER}
|
|
@@ -5887,7 +6043,7 @@ ${domains}
|
|
|
5887
6043
|
`;
|
|
5888
6044
|
};
|
|
5889
6045
|
var configureIosEntitlements = async (config) => {
|
|
5890
|
-
const path =
|
|
6046
|
+
const path = join17(config.nativeProjectDirectory, "ios/App/AbsoluteJS.entitlements");
|
|
5891
6047
|
let current = "";
|
|
5892
6048
|
try {
|
|
5893
6049
|
current = await readFile14(path, "utf8");
|
|
@@ -5905,7 +6061,7 @@ var configureIosEntitlements = async (config) => {
|
|
|
5905
6061
|
return true;
|
|
5906
6062
|
};
|
|
5907
6063
|
var configureIosProject = async (config) => {
|
|
5908
|
-
const path =
|
|
6064
|
+
const path = join17(config.nativeProjectDirectory, "ios/App/App.xcodeproj/project.pbxproj");
|
|
5909
6065
|
const source = await readFile14(path, "utf8");
|
|
5910
6066
|
const declarations = [
|
|
5911
6067
|
...source.matchAll(/CODE_SIGN_ENTITLEMENTS = ([^;]+);/g)
|
|
@@ -5935,18 +6091,18 @@ var configureIos = async (config) => {
|
|
|
5935
6091
|
return changed.some(Boolean);
|
|
5936
6092
|
};
|
|
5937
6093
|
var applyAbsoluteNativeDeepLinks = async (config, platforms = config.platforms) => {
|
|
5938
|
-
const results = await Promise.all(platforms.map(async (
|
|
5939
|
-
const didChange =
|
|
5940
|
-
return { didChange, platform };
|
|
6094
|
+
const results = await Promise.all(platforms.map(async (platform2) => {
|
|
6095
|
+
const didChange = platform2 === "android" ? await configureAndroid(config) : await configureIos(config);
|
|
6096
|
+
return { didChange, platform: platform2 };
|
|
5941
6097
|
}));
|
|
5942
6098
|
return {
|
|
5943
|
-
changed: results.filter(({ didChange }) => didChange).map(({ platform }) =>
|
|
6099
|
+
changed: results.filter(({ didChange }) => didChange).map(({ platform: platform2 }) => platform2)
|
|
5944
6100
|
};
|
|
5945
6101
|
};
|
|
5946
6102
|
// src/mobile/nativeDeviceCapabilities.ts
|
|
5947
6103
|
init_deviceCapabilities();
|
|
5948
6104
|
import { readFile as readFile15, rename as rename12, writeFile as writeFile13 } from "fs/promises";
|
|
5949
|
-
import { join as
|
|
6105
|
+
import { join as join18 } from "path";
|
|
5950
6106
|
var START_MARKER2 = "<!-- absolutejs:device-capabilities:start -->";
|
|
5951
6107
|
var END_MARKER2 = "<!-- absolutejs:device-capabilities:end -->";
|
|
5952
6108
|
var NOT_FOUND2 = -1;
|
|
@@ -6096,7 +6252,7 @@ var writeIosPrivacyManifest = async (path, current, source) => {
|
|
|
6096
6252
|
var configureIosPrivacyProject = async (config, requirements) => {
|
|
6097
6253
|
if (requirements.iosPrivacyAccessedApis.length === 0)
|
|
6098
6254
|
return false;
|
|
6099
|
-
const projectPath =
|
|
6255
|
+
const projectPath = join18(config.nativeProjectDirectory, "ios/App/App.xcodeproj/project.pbxproj");
|
|
6100
6256
|
const project = await readFile15(projectPath, "utf8");
|
|
6101
6257
|
return writeChangedFile2(projectPath, addIosPrivacyProjectReference(project));
|
|
6102
6258
|
};
|
|
@@ -6149,7 +6305,7 @@ ${next.slice(index)}`;
|
|
|
6149
6305
|
return next;
|
|
6150
6306
|
};
|
|
6151
6307
|
var configureIos2 = async (config, plan) => {
|
|
6152
|
-
const path =
|
|
6308
|
+
const path = join18(config.nativeProjectDirectory, "ios/App/App/Info.plist");
|
|
6153
6309
|
const source = await readFile15(path, "utf8");
|
|
6154
6310
|
const requirements = absoluteDeviceNativeRequirements(plan);
|
|
6155
6311
|
const existingSystemBars = source.match(/<key>UIViewControllerBasedStatusBarAppearance<\/key>\s*<(true|false)\s*\/>/u);
|
|
@@ -6170,7 +6326,7 @@ ${content}
|
|
|
6170
6326
|
${END_MARKER2}
|
|
6171
6327
|
` : "";
|
|
6172
6328
|
const infoChanged = await writeChangedFile2(path, managed(source, region, source.lastIndexOf("</dict>")));
|
|
6173
|
-
const privacyPath =
|
|
6329
|
+
const privacyPath = join18(config.nativeProjectDirectory, "ios/App/App/PrivacyInfo.xcprivacy");
|
|
6174
6330
|
const privacyCurrent = await optionalSource(privacyPath);
|
|
6175
6331
|
const privacySource = privacyManifestSource(privacyCurrent, requirements);
|
|
6176
6332
|
const [privacyChanged, projectChanged, pushChanged] = await Promise.all([
|
|
@@ -6181,7 +6337,7 @@ ${content}
|
|
|
6181
6337
|
return infoChanged || privacyChanged || projectChanged || pushChanged;
|
|
6182
6338
|
};
|
|
6183
6339
|
var configureIosPushNotifications = async (config, enabled) => {
|
|
6184
|
-
const entitlementsPath =
|
|
6340
|
+
const entitlementsPath = join18(config.nativeProjectDirectory, "ios/App/AbsoluteJS.entitlements");
|
|
6185
6341
|
const entitlements = await optionalSource(entitlementsPath);
|
|
6186
6342
|
if (entitlements === null && !enabled)
|
|
6187
6343
|
return false;
|
|
@@ -6193,7 +6349,7 @@ var configureIosPushNotifications = async (config, enabled) => {
|
|
|
6193
6349
|
<!-- ${PUSH_END_MARKER} -->
|
|
6194
6350
|
` : "";
|
|
6195
6351
|
const nextEntitlements = replacePushRegion(entitlements, entitlementRegion, entitlements.lastIndexOf("</dict>"));
|
|
6196
|
-
const delegatePath =
|
|
6352
|
+
const delegatePath = join18(config.nativeProjectDirectory, "ios/App/App/AppDelegate.swift");
|
|
6197
6353
|
const delegate = await optionalSource(delegatePath);
|
|
6198
6354
|
if (delegate === null && !enabled)
|
|
6199
6355
|
return false;
|
|
@@ -6242,7 +6398,7 @@ var replacePushRegion = (source, region, insertion) => {
|
|
|
6242
6398
|
return `${source.slice(0, insertion)}${region}${source.slice(insertion)}`;
|
|
6243
6399
|
};
|
|
6244
6400
|
var configureAndroid2 = async (config, plan) => {
|
|
6245
|
-
const path =
|
|
6401
|
+
const path = join18(config.nativeProjectDirectory, "android/app/src/main/AndroidManifest.xml");
|
|
6246
6402
|
const source = await readFile15(path, "utf8");
|
|
6247
6403
|
const permissions = absoluteDeviceNativeRequirements(plan).androidPermissions;
|
|
6248
6404
|
const content = permissions.map((permission) => ` <uses-permission android:name="${escapeXml2(permission)}" />`).join(`
|
|
@@ -6278,17 +6434,17 @@ ${content}
|
|
|
6278
6434
|
throw new TypeError(`Android google-services.json does not contain package ${config.appId}.`);
|
|
6279
6435
|
const [manifestChanged, firebaseChanged] = await Promise.all([
|
|
6280
6436
|
writeChangedFile2(path, nextManifest),
|
|
6281
|
-
writeOptionalChangedFile(
|
|
6437
|
+
writeOptionalChangedFile(join18(config.nativeProjectDirectory, "android/app/google-services.json"), firebaseSource)
|
|
6282
6438
|
]);
|
|
6283
6439
|
return manifestChanged || firebaseChanged;
|
|
6284
6440
|
};
|
|
6285
6441
|
var applyAbsoluteNativeDeviceCapabilities = async (projectRoot, config, platforms = config.platforms, plan = resolveAbsoluteDeviceCapabilityPlan(projectRoot)) => {
|
|
6286
|
-
const results = await Promise.all(platforms.map(async (
|
|
6287
|
-
didChange:
|
|
6288
|
-
platform
|
|
6442
|
+
const results = await Promise.all(platforms.map(async (platform2) => ({
|
|
6443
|
+
didChange: platform2 === "ios" ? await configureIos2(config, plan) : await configureAndroid2(config, plan),
|
|
6444
|
+
platform: platform2
|
|
6289
6445
|
})));
|
|
6290
6446
|
return {
|
|
6291
|
-
changed: results.filter(({ didChange }) => didChange).map(({ platform }) =>
|
|
6447
|
+
changed: results.filter(({ didChange }) => didChange).map(({ platform: platform2 }) => platform2)
|
|
6292
6448
|
};
|
|
6293
6449
|
};
|
|
6294
6450
|
// src/mobile/releasePublisher.ts
|
|
@@ -6316,8 +6472,8 @@ var prepareAbsoluteAndroidRelease = async (publisher, options) => {
|
|
|
6316
6472
|
}
|
|
6317
6473
|
return versionCode;
|
|
6318
6474
|
};
|
|
6319
|
-
var
|
|
6320
|
-
var isPublisher = (value) =>
|
|
6475
|
+
var isRecord9 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6476
|
+
var isPublisher = (value) => isRecord9(value) && typeof value.publish === "function";
|
|
6321
6477
|
var publisherModulePath = (projectRoot, requested) => {
|
|
6322
6478
|
const root = resolve13(projectRoot);
|
|
6323
6479
|
const path = resolve13(root, requested);
|
|
@@ -6333,7 +6489,7 @@ var loadAbsoluteNativeReleasePublisher = async (projectRoot, requestedModulePath
|
|
|
6333
6489
|
throw new TypeError(`Native release registry module does not exist: ${modulePath}`);
|
|
6334
6490
|
});
|
|
6335
6491
|
const loaded = await import(pathToFileURL3(modulePath).href);
|
|
6336
|
-
const publisher =
|
|
6492
|
+
const publisher = isRecord9(loaded) ? loaded.default ?? loaded.registry : undefined;
|
|
6337
6493
|
if (!isPublisher(publisher)) {
|
|
6338
6494
|
throw new TypeError("Native release registry module must default-export a registry with publish(options).");
|
|
6339
6495
|
}
|
|
@@ -6390,8 +6546,8 @@ var publishAbsoluteIosRelease = async (options) => {
|
|
|
6390
6546
|
return publication;
|
|
6391
6547
|
};
|
|
6392
6548
|
// src/mobile/routeMetadataTransform.ts
|
|
6393
|
-
import { existsSync as
|
|
6394
|
-
import { dirname as
|
|
6549
|
+
import { existsSync as existsSync5, readFileSync as readFileSync7 } from "fs";
|
|
6550
|
+
import { dirname as dirname11, extname as extname4, relative as relative11, resolve as resolve14 } from "path";
|
|
6395
6551
|
import ts2 from "typescript";
|
|
6396
6552
|
var ROUTE_METHODS = new Set(["get", "head"]);
|
|
6397
6553
|
var SOURCE_FILTER = /\.[cm]?[jt]sx?$/;
|
|
@@ -6442,10 +6598,10 @@ var PAGE_HANDLERS = new Map([
|
|
|
6442
6598
|
]
|
|
6443
6599
|
]);
|
|
6444
6600
|
var posixPath = (value) => value.replace(/\\/g, "/");
|
|
6445
|
-
var findTsconfig = (entry, projectRoot) => ts2.findConfigFile(
|
|
6601
|
+
var findTsconfig = (entry, projectRoot) => ts2.findConfigFile(dirname11(entry), existsSync5, "tsconfig.json") ?? ts2.findConfigFile(projectRoot, existsSync5, "tsconfig.json");
|
|
6446
6602
|
var createProgram = (entry, projectRoot) => {
|
|
6447
|
-
const
|
|
6448
|
-
if (!
|
|
6603
|
+
const configPath2 = findTsconfig(entry, projectRoot);
|
|
6604
|
+
if (!configPath2) {
|
|
6449
6605
|
return ts2.createProgram([entry], {
|
|
6450
6606
|
allowJs: true,
|
|
6451
6607
|
jsx: ts2.JsxEmit.ReactJSX,
|
|
@@ -6454,7 +6610,7 @@ var createProgram = (entry, projectRoot) => {
|
|
|
6454
6610
|
target: ts2.ScriptTarget.ESNext
|
|
6455
6611
|
});
|
|
6456
6612
|
}
|
|
6457
|
-
const parsed = ts2.parseJsonConfigFileContent(ts2.readConfigFile(
|
|
6613
|
+
const parsed = ts2.parseJsonConfigFileContent(ts2.readConfigFile(configPath2, (path) => readFileSync7(path, "utf8")).config, ts2.sys, dirname11(configPath2));
|
|
6458
6614
|
if (!parsed.fileNames.includes(entry))
|
|
6459
6615
|
parsed.fileNames.push(entry);
|
|
6460
6616
|
return ts2.createProgram(parsed.fileNames, parsed.options);
|
|
@@ -7202,6 +7358,7 @@ export {
|
|
|
7202
7358
|
createAbsoluteRemoteIosDevProject,
|
|
7203
7359
|
createAbsoluteMobileUpgradeResponse,
|
|
7204
7360
|
createAbsoluteMobileRouteMetadataPlugin,
|
|
7361
|
+
createAbsoluteMobilePreviewPlugin,
|
|
7205
7362
|
createAbsoluteMobilePageRequest,
|
|
7206
7363
|
createAbsoluteMobilePageErrorResponse,
|
|
7207
7364
|
createAbsoluteMobileInvalidRequestResponse,
|
|
@@ -7225,6 +7382,7 @@ export {
|
|
|
7225
7382
|
acceptsAbsoluteMobilePage,
|
|
7226
7383
|
absoluteRemoteProjectSyncCommands,
|
|
7227
7384
|
absoluteRemoteMacSshBase,
|
|
7385
|
+
absoluteMobilePreviewDocument,
|
|
7228
7386
|
absoluteDeviceNativeRequirements,
|
|
7229
7387
|
MOBILE_PAGE_REQUEST_HEADERS,
|
|
7230
7388
|
AbsoluteMobilePageProtocolError,
|
|
@@ -7238,6 +7396,7 @@ export {
|
|
|
7238
7396
|
ABSOLUTE_MOBILE_TRANSFORM_PROTOCOL,
|
|
7239
7397
|
ABSOLUTE_MOBILE_ROUTE_DETAIL,
|
|
7240
7398
|
ABSOLUTE_MOBILE_RETAINED_GENERATIONS,
|
|
7399
|
+
ABSOLUTE_MOBILE_PREVIEW_PATH,
|
|
7241
7400
|
ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION,
|
|
7242
7401
|
ABSOLUTE_MOBILE_PAGE_MEDIA_TYPE,
|
|
7243
7402
|
ABSOLUTE_MOBILE_MATERIALIZED_BUNDLE_FORMAT,
|
|
@@ -7249,5 +7408,5 @@ export {
|
|
|
7249
7408
|
ABSOLUTE_ANDROID_RELEASE_FORMAT
|
|
7250
7409
|
};
|
|
7251
7410
|
|
|
7252
|
-
//# debugId=
|
|
7411
|
+
//# debugId=A29607482483B57664756E2164756E21
|
|
7253
7412
|
//# sourceMappingURL=index.js.map
|