@absolutejs/absolute 0.19.0-beta.987 → 0.19.0-beta.988
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.map +2 -2
- package/dist/angular/server.js.map +2 -2
- package/dist/build.js +841 -662
- package/dist/build.js.map +8 -7
- package/dist/index.js +874 -695
- package/dist/index.js.map +8 -7
- package/dist/src/build/compileVue.d.ts +1 -1
- package/dist/src/build/scanVueSsrOnlyPages.d.ts +6 -0
- package/dist/src/vue/pageHandler.d.ts +20 -10
- package/dist/vue/index.js +242 -102
- package/dist/vue/index.js.map +7 -4
- package/dist/vue/server.js +145 -5
- package/dist/vue/server.js.map +7 -4
- package/package.json +1 -1
package/dist/vue/server.js
CHANGED
|
@@ -1091,6 +1091,131 @@ var normalizeSlug = (str) => str.trim().replace(/\s+/g, "-").replace(/[^A-Za-z0-
|
|
|
1091
1091
|
return normalizeSlug(str).split(/[-_]/).filter(Boolean).map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1).toLowerCase()).join("");
|
|
1092
1092
|
};
|
|
1093
1093
|
|
|
1094
|
+
// src/cli/scripts/telemetry.ts
|
|
1095
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
1096
|
+
import { homedir } from "os";
|
|
1097
|
+
import { join } from "path";
|
|
1098
|
+
var configDir, configPath, getTelemetryConfig = () => {
|
|
1099
|
+
try {
|
|
1100
|
+
if (!existsSync(configPath))
|
|
1101
|
+
return null;
|
|
1102
|
+
const raw = readFileSync(configPath, "utf-8");
|
|
1103
|
+
const config = JSON.parse(raw);
|
|
1104
|
+
return config;
|
|
1105
|
+
} catch {
|
|
1106
|
+
return null;
|
|
1107
|
+
}
|
|
1108
|
+
};
|
|
1109
|
+
var init_telemetry = __esm(() => {
|
|
1110
|
+
configDir = join(homedir(), ".absolutejs");
|
|
1111
|
+
configPath = join(configDir, "telemetry.json");
|
|
1112
|
+
});
|
|
1113
|
+
|
|
1114
|
+
// src/cli/telemetryEvent.ts
|
|
1115
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
1116
|
+
import { arch, platform } from "os";
|
|
1117
|
+
import { dirname, join as join2, parse } from "path";
|
|
1118
|
+
var checkCandidate = (candidate) => {
|
|
1119
|
+
if (!existsSync2(candidate)) {
|
|
1120
|
+
return null;
|
|
1121
|
+
}
|
|
1122
|
+
const pkg = JSON.parse(readFileSync2(candidate, "utf-8"));
|
|
1123
|
+
if (pkg.name === "@absolutejs/absolute") {
|
|
1124
|
+
const ver = pkg.version;
|
|
1125
|
+
return ver;
|
|
1126
|
+
}
|
|
1127
|
+
return null;
|
|
1128
|
+
}, getVersion = () => {
|
|
1129
|
+
try {
|
|
1130
|
+
return findPackageVersion();
|
|
1131
|
+
} catch {
|
|
1132
|
+
return "unknown";
|
|
1133
|
+
}
|
|
1134
|
+
}, findPackageVersion = () => {
|
|
1135
|
+
let { dir } = import.meta;
|
|
1136
|
+
while (dir !== parse(dir).root) {
|
|
1137
|
+
const candidate = join2(dir, "package.json");
|
|
1138
|
+
const version = checkCandidate(candidate);
|
|
1139
|
+
if (version) {
|
|
1140
|
+
return version;
|
|
1141
|
+
}
|
|
1142
|
+
dir = dirname(dir);
|
|
1143
|
+
}
|
|
1144
|
+
return "unknown";
|
|
1145
|
+
}, sendTelemetryEvent = (event, payload) => {
|
|
1146
|
+
try {
|
|
1147
|
+
if (process.env.TELEMETRY_OFF === "1")
|
|
1148
|
+
return;
|
|
1149
|
+
const config = getTelemetryConfig();
|
|
1150
|
+
if (!config?.enabled)
|
|
1151
|
+
return;
|
|
1152
|
+
const body = {
|
|
1153
|
+
anonymousId: config.anonymousId,
|
|
1154
|
+
arch: arch(),
|
|
1155
|
+
bunVersion: Bun.version,
|
|
1156
|
+
event,
|
|
1157
|
+
os: platform(),
|
|
1158
|
+
payload,
|
|
1159
|
+
timestamp: new Date().toISOString(),
|
|
1160
|
+
version: getVersion()
|
|
1161
|
+
};
|
|
1162
|
+
fetch("https://absolutejs.com/api/telemetry", {
|
|
1163
|
+
body: JSON.stringify(body),
|
|
1164
|
+
headers: { "Content-Type": "application/json" },
|
|
1165
|
+
method: "POST"
|
|
1166
|
+
}).catch(() => {
|
|
1167
|
+
return;
|
|
1168
|
+
});
|
|
1169
|
+
} catch {}
|
|
1170
|
+
};
|
|
1171
|
+
var init_telemetryEvent = __esm(() => {
|
|
1172
|
+
init_telemetry();
|
|
1173
|
+
});
|
|
1174
|
+
|
|
1175
|
+
// src/dev/buildHMRClient.ts
|
|
1176
|
+
var exports_buildHMRClient = {};
|
|
1177
|
+
__export(exports_buildHMRClient, {
|
|
1178
|
+
buildHMRClient: () => buildHMRClient
|
|
1179
|
+
});
|
|
1180
|
+
import { existsSync as existsSync3 } from "fs";
|
|
1181
|
+
import { resolve } from "path";
|
|
1182
|
+
var {build: bunBuild } = globalThis.Bun;
|
|
1183
|
+
var resolveHmrClientPath = () => {
|
|
1184
|
+
const projectRoot = process.cwd();
|
|
1185
|
+
const fromSource = resolve(import.meta.dir, "client/hmrClient.ts");
|
|
1186
|
+
if (existsSync3(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
1187
|
+
return fromSource;
|
|
1188
|
+
}
|
|
1189
|
+
const fromNodeModules = resolve(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client/hmrClient.ts");
|
|
1190
|
+
if (existsSync3(fromNodeModules))
|
|
1191
|
+
return fromNodeModules;
|
|
1192
|
+
return resolve(import.meta.dir, "dev/client/hmrClient.ts");
|
|
1193
|
+
}, hmrClientPath, buildHMRClient = async () => {
|
|
1194
|
+
const entryPoint = hmrClientPath;
|
|
1195
|
+
const result = await bunBuild({
|
|
1196
|
+
entrypoints: [entryPoint],
|
|
1197
|
+
format: "iife",
|
|
1198
|
+
minify: false,
|
|
1199
|
+
target: "browser"
|
|
1200
|
+
});
|
|
1201
|
+
if (!result.success) {
|
|
1202
|
+
console.error("Failed to build HMR client:", result.logs);
|
|
1203
|
+
sendTelemetryEvent("hmr:client-build-failed", {
|
|
1204
|
+
logCount: result.logs.length,
|
|
1205
|
+
message: result.logs.map((log2) => log2.message).join("; ")
|
|
1206
|
+
});
|
|
1207
|
+
return "// HMR client build failed";
|
|
1208
|
+
}
|
|
1209
|
+
const [firstOutput] = result.outputs;
|
|
1210
|
+
if (!firstOutput)
|
|
1211
|
+
return "// HMR client build failed";
|
|
1212
|
+
return firstOutput.text();
|
|
1213
|
+
};
|
|
1214
|
+
var init_buildHMRClient = __esm(() => {
|
|
1215
|
+
init_telemetryEvent();
|
|
1216
|
+
hmrClientPath = resolveHmrClientPath();
|
|
1217
|
+
});
|
|
1218
|
+
|
|
1094
1219
|
// src/core/streamingSlotRegistrar.ts
|
|
1095
1220
|
var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
|
|
1096
1221
|
var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
|
|
@@ -1202,7 +1327,7 @@ var runWithStreamingSlotRegistry = async (task) => {
|
|
|
1202
1327
|
// src/vue/pageHandler.ts
|
|
1203
1328
|
init_constants();
|
|
1204
1329
|
import { readdir } from "fs/promises";
|
|
1205
|
-
import { basename as basename2, dirname } from "path";
|
|
1330
|
+
import { basename as basename2, dirname as dirname2 } from "path";
|
|
1206
1331
|
|
|
1207
1332
|
// src/core/islandPageContext.ts
|
|
1208
1333
|
init_constants();
|
|
@@ -1838,7 +1963,7 @@ var readSetupAppHook = (value) => {
|
|
|
1838
1963
|
};
|
|
1839
1964
|
var readDefaultExport = (value) => isRecord2(value) ? value.default : undefined;
|
|
1840
1965
|
var resolveCurrentGeneratedVueModulePath = async (pagePath) => {
|
|
1841
|
-
const pageDirectory =
|
|
1966
|
+
const pageDirectory = dirname2(pagePath);
|
|
1842
1967
|
const expectedPrefix = `${basename2(pagePath, ".js").split(".")[0]}.`;
|
|
1843
1968
|
try {
|
|
1844
1969
|
const pageEntries = await readdir(pageDirectory, {
|
|
@@ -1868,14 +1993,28 @@ var primeVueStream = async (stream) => {
|
|
|
1868
1993
|
const firstChunk = await reader.read();
|
|
1869
1994
|
return { firstChunk, reader };
|
|
1870
1995
|
};
|
|
1996
|
+
var cachedSsrOnlyHmrShim = null;
|
|
1997
|
+
var getSsrOnlyHmrShim = () => {
|
|
1998
|
+
if (cachedSsrOnlyHmrShim)
|
|
1999
|
+
return cachedSsrOnlyHmrShim;
|
|
2000
|
+
cachedSsrOnlyHmrShim = (async () => {
|
|
2001
|
+
const { buildHMRClient: buildHMRClient2 } = await Promise.resolve().then(() => (init_buildHMRClient(), exports_buildHMRClient));
|
|
2002
|
+
const bundle = await buildHMRClient2();
|
|
2003
|
+
return `<script>window.__HMR_FRAMEWORK__="vue";</script><script data-hmr-client>${bundle}</script>`;
|
|
2004
|
+
})();
|
|
2005
|
+
return cachedSsrOnlyHmrShim;
|
|
2006
|
+
};
|
|
1871
2007
|
var handleVuePageRequest = async (input) => {
|
|
1872
2008
|
const passedPageComponent = input.Page;
|
|
1873
2009
|
const resolvedHeadTag = input.headTag ?? "<head></head>";
|
|
1874
|
-
const resolvedIndexPath = input.indexPath;
|
|
1875
2010
|
const resolvedOptions = input;
|
|
1876
2011
|
const resolvedPagePath = input.pagePath;
|
|
1877
2012
|
const maybeProps = input.props;
|
|
1878
2013
|
const clientMode = input.client ?? "auto";
|
|
2014
|
+
const resolvedIndexPath = input.indexPath;
|
|
2015
|
+
if (clientMode === "auto" && !resolvedIndexPath) {
|
|
2016
|
+
throw new Error('handleVuePageRequest: `indexPath` is required when `client` is `"auto"` (the default). Pass `client: "none"` to ship a SSR-only page with no client bundle.');
|
|
2017
|
+
}
|
|
1879
2018
|
try {
|
|
1880
2019
|
const handlerCallsite = resolvedOptions?.collectStreamingSlots === true ? undefined : getCurrentRouteRegistrationCallsite() ?? captureStreamingSlotWarningCallsite();
|
|
1881
2020
|
const renderPageResponse = async () => {
|
|
@@ -1931,7 +2070,8 @@ var handleVuePageRequest = async (input) => {
|
|
|
1931
2070
|
const bodyStream = renderToWebStream(app);
|
|
1932
2071
|
const { firstChunk, reader } = await primeVueStream(bodyStream);
|
|
1933
2072
|
const head = `<!DOCTYPE html><html>${resolvedHeadTag}<body><div id="root">`;
|
|
1934
|
-
const
|
|
2073
|
+
const ssrOnlyHmrShim = clientMode === "none" ? await getSsrOnlyHmrShim() : "";
|
|
2074
|
+
const tail = clientMode === "none" ? `</div>${ssrOnlyHmrShim}</body></html>` : `</div><script>window.__INITIAL_PROPS__=${JSON.stringify(maybeProps ?? {})}</script><script type="module" src="${resolvedIndexPath}"></script></body></html>`;
|
|
1935
2075
|
const stream = new ReadableStream({
|
|
1936
2076
|
start(controller) {
|
|
1937
2077
|
controller.enqueue(head);
|
|
@@ -1991,5 +2131,5 @@ export {
|
|
|
1991
2131
|
applyVueRouterRedirect
|
|
1992
2132
|
};
|
|
1993
2133
|
|
|
1994
|
-
//# debugId=
|
|
2134
|
+
//# debugId=F925C9676FC0E5B064756E2164756E21
|
|
1995
2135
|
//# sourceMappingURL=server.js.map
|