@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/index.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/islandManifest.ts
|
|
1095
1220
|
var toIslandFrameworkSegment = (framework) => framework[0]?.toUpperCase() + framework.slice(1), collectFrameworkIslands = (manifest, prefix) => {
|
|
1096
1221
|
const entries = {};
|
|
@@ -1167,24 +1292,24 @@ var requireCurrentIslandRegistry = () => {
|
|
|
1167
1292
|
};
|
|
1168
1293
|
|
|
1169
1294
|
// src/angular/resolveAngularPackage.ts
|
|
1170
|
-
import { existsSync, readFileSync } from "fs";
|
|
1171
|
-
import { join, resolve } from "path";
|
|
1295
|
+
import { existsSync as existsSync4, readFileSync as readFileSync3 } from "fs";
|
|
1296
|
+
import { join as join3, resolve as resolve2 } from "path";
|
|
1172
1297
|
var resolveAngularPackageDir = (specifier) => {
|
|
1173
|
-
const fromCompiledRuntime = process.env.ABSOLUTE_BUILD_DIR ?
|
|
1174
|
-
if (fromCompiledRuntime &&
|
|
1298
|
+
const fromCompiledRuntime = process.env.ABSOLUTE_BUILD_DIR ? resolve2(process.env.ABSOLUTE_BUILD_DIR, "node_modules", specifier) : null;
|
|
1299
|
+
if (fromCompiledRuntime && existsSync4(fromCompiledRuntime)) {
|
|
1175
1300
|
return fromCompiledRuntime;
|
|
1176
1301
|
}
|
|
1177
|
-
const fromProject =
|
|
1178
|
-
if (
|
|
1302
|
+
const fromProject = resolve2(process.cwd(), "node_modules", specifier);
|
|
1303
|
+
if (existsSync4(fromProject)) {
|
|
1179
1304
|
return fromProject;
|
|
1180
1305
|
}
|
|
1181
1306
|
return null;
|
|
1182
1307
|
}, resolvePackageEntry = (packageDir) => {
|
|
1183
1308
|
try {
|
|
1184
|
-
const pkg = JSON.parse(
|
|
1309
|
+
const pkg = JSON.parse(readFileSync3(join3(packageDir, "package.json"), "utf-8"));
|
|
1185
1310
|
const rootExport = pkg.exports?.["."];
|
|
1186
1311
|
const entry = (typeof rootExport === "string" ? rootExport : rootExport?.default) ?? pkg.module ?? pkg.main ?? "index.js";
|
|
1187
|
-
return
|
|
1312
|
+
return join3(packageDir, entry);
|
|
1188
1313
|
} catch {
|
|
1189
1314
|
return packageDir;
|
|
1190
1315
|
}
|
|
@@ -1196,11 +1321,11 @@ var resolveAngularPackageDir = (specifier) => {
|
|
|
1196
1321
|
}, toSafeVendorName = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_"), resolveAngularRuntimePath = (specifier) => {
|
|
1197
1322
|
const buildDirs = [
|
|
1198
1323
|
process.env.ABSOLUTE_BUILD_DIR,
|
|
1199
|
-
|
|
1324
|
+
resolve2(process.cwd(), "build")
|
|
1200
1325
|
].filter((value) => Boolean(value));
|
|
1201
1326
|
for (const buildDir of buildDirs) {
|
|
1202
|
-
const vendorPath =
|
|
1203
|
-
if (
|
|
1327
|
+
const vendorPath = join3(buildDir, "angular", "vendor", "server", `${toSafeVendorName(specifier)}.js`);
|
|
1328
|
+
if (existsSync4(vendorPath))
|
|
1204
1329
|
return vendorPath;
|
|
1205
1330
|
}
|
|
1206
1331
|
return resolveAngularPackage(specifier);
|
|
@@ -1759,8 +1884,8 @@ var init_islandSsr = __esm(() => {
|
|
|
1759
1884
|
});
|
|
1760
1885
|
|
|
1761
1886
|
// src/build/resolvePackageImport.ts
|
|
1762
|
-
import { resolve as
|
|
1763
|
-
import { existsSync as
|
|
1887
|
+
import { resolve as resolve3, join as join4 } from "path";
|
|
1888
|
+
import { existsSync as existsSync5, readFileSync as readFileSync4 } from "fs";
|
|
1764
1889
|
var resolveExportPath = (entry, conditions) => {
|
|
1765
1890
|
if (typeof entry === "string")
|
|
1766
1891
|
return entry;
|
|
@@ -1781,15 +1906,15 @@ var resolveExportPath = (entry, conditions) => {
|
|
|
1781
1906
|
const packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];
|
|
1782
1907
|
const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
|
|
1783
1908
|
const exportKey = subpath ? `./${subpath}` : ".";
|
|
1784
|
-
const currentPackageJsonPath =
|
|
1785
|
-
const currentPackageJson =
|
|
1909
|
+
const currentPackageJsonPath = resolve3(process.cwd(), "package.json");
|
|
1910
|
+
const currentPackageJson = existsSync5(currentPackageJsonPath) ? JSON.parse(readFileSync4(currentPackageJsonPath, "utf-8")) : null;
|
|
1786
1911
|
const currentPackageDir = currentPackageJson?.name === packageName ? process.cwd() : null;
|
|
1787
|
-
const packageDir = currentPackageDir ??
|
|
1788
|
-
const packageJsonPath =
|
|
1789
|
-
if (!
|
|
1912
|
+
const packageDir = currentPackageDir ?? resolve3(process.cwd(), "node_modules", packageName ?? "");
|
|
1913
|
+
const packageJsonPath = join4(packageDir, "package.json");
|
|
1914
|
+
if (!existsSync5(packageJsonPath))
|
|
1790
1915
|
return null;
|
|
1791
1916
|
try {
|
|
1792
|
-
const packageJson = currentPackageDir && currentPackageJson ? currentPackageJson : JSON.parse(
|
|
1917
|
+
const packageJson = currentPackageDir && currentPackageJson ? currentPackageJson : JSON.parse(readFileSync4(packageJsonPath, "utf-8"));
|
|
1793
1918
|
const { exports } = packageJson;
|
|
1794
1919
|
if (!exports)
|
|
1795
1920
|
return null;
|
|
@@ -1800,13 +1925,13 @@ var resolveExportPath = (entry, conditions) => {
|
|
|
1800
1925
|
if (!importPath)
|
|
1801
1926
|
return null;
|
|
1802
1927
|
if (currentPackageDir && importPath.startsWith("./dist/")) {
|
|
1803
|
-
const sourceCandidate =
|
|
1804
|
-
if (
|
|
1928
|
+
const sourceCandidate = resolve3(packageDir, importPath.replace(/^\.\/dist\//, "./src/"));
|
|
1929
|
+
if (existsSync5(sourceCandidate)) {
|
|
1805
1930
|
return sourceCandidate;
|
|
1806
1931
|
}
|
|
1807
1932
|
}
|
|
1808
|
-
const resolved =
|
|
1809
|
-
return
|
|
1933
|
+
const resolved = resolve3(packageDir, importPath);
|
|
1934
|
+
return existsSync5(resolved) ? resolved : null;
|
|
1810
1935
|
} catch {
|
|
1811
1936
|
return null;
|
|
1812
1937
|
}
|
|
@@ -1958,16 +2083,16 @@ __export(exports_stylePreprocessor, {
|
|
|
1958
2083
|
addStyleImporter: () => addStyleImporter
|
|
1959
2084
|
});
|
|
1960
2085
|
import { createHash } from "crypto";
|
|
1961
|
-
import { existsSync as
|
|
2086
|
+
import { existsSync as existsSync6, readFileSync as readFileSync5 } from "fs";
|
|
1962
2087
|
import { readFile } from "fs/promises";
|
|
1963
2088
|
import { createRequire } from "module";
|
|
1964
2089
|
import {
|
|
1965
|
-
dirname as
|
|
2090
|
+
dirname as dirname3,
|
|
1966
2091
|
extname,
|
|
1967
2092
|
isAbsolute,
|
|
1968
|
-
join as
|
|
2093
|
+
join as join5,
|
|
1969
2094
|
relative,
|
|
1970
|
-
resolve as
|
|
2095
|
+
resolve as resolve4
|
|
1971
2096
|
} from "path";
|
|
1972
2097
|
import { fileURLToPath, pathToFileURL } from "url";
|
|
1973
2098
|
var CSS_EXTENSION_PATTERN, STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATTERN, importOptionalPeer, requireOptionalPeer, requireFromCwd, isPreprocessableStylePath = (filePath) => STYLE_EXTENSION_PATTERN.test(filePath), isStyleModulePath = (filePath) => STYLE_MODULE_EXTENSION_PATTERN.test(filePath), isStylePath = (filePath) => /\.(css|s[ac]ss|less|styl(?:us)?)$/i.test(filePath), getStyleBaseName = (filePath) => filePath.replace(/\.(css|s[ac]ss|less|styl(?:us)?)$/i, ""), getStyleLanguage = (filePathOrLanguage) => {
|
|
@@ -2003,9 +2128,9 @@ ${message}`);
|
|
|
2003
2128
|
return requireOptionalPeer(specifier);
|
|
2004
2129
|
}
|
|
2005
2130
|
}, normalizeLoadPaths = (filePath, paths = []) => [
|
|
2006
|
-
|
|
2131
|
+
dirname3(filePath),
|
|
2007
2132
|
process.cwd(),
|
|
2008
|
-
...paths.map((path) =>
|
|
2133
|
+
...paths.map((path) => resolve4(process.cwd(), path))
|
|
2009
2134
|
], tsconfigAliasCache, stripJsonComments = (source) => source.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:])\/\/.*$/gm, "$1"), normalizeAliasEntries = (aliases) => Object.entries(aliases ?? {}).map(([pattern, value]) => ({
|
|
2010
2135
|
pattern,
|
|
2011
2136
|
replacements: Array.isArray(value) ? value : [value]
|
|
@@ -2013,16 +2138,16 @@ ${message}`);
|
|
|
2013
2138
|
const cwd = process.cwd();
|
|
2014
2139
|
if (tsconfigAliasCache?.cwd === cwd)
|
|
2015
2140
|
return tsconfigAliasCache;
|
|
2016
|
-
const tsconfigPath =
|
|
2141
|
+
const tsconfigPath = resolve4(cwd, "tsconfig.json");
|
|
2017
2142
|
const empty = { aliases: [], baseUrl: cwd, cwd };
|
|
2018
|
-
if (!
|
|
2143
|
+
if (!existsSync6(tsconfigPath)) {
|
|
2019
2144
|
tsconfigAliasCache = empty;
|
|
2020
2145
|
return empty;
|
|
2021
2146
|
}
|
|
2022
2147
|
try {
|
|
2023
|
-
const parsed = JSON.parse(stripJsonComments(
|
|
2148
|
+
const parsed = JSON.parse(stripJsonComments(readFileSync5(tsconfigPath, "utf-8")));
|
|
2024
2149
|
const compilerOptions = parsed.compilerOptions ?? {};
|
|
2025
|
-
const baseUrl =
|
|
2150
|
+
const baseUrl = resolve4(cwd, compilerOptions.baseUrl ?? ".");
|
|
2026
2151
|
tsconfigAliasCache = {
|
|
2027
2152
|
aliases: normalizeAliasEntries(compilerOptions.paths),
|
|
2028
2153
|
baseUrl,
|
|
@@ -2050,7 +2175,7 @@ ${message}`);
|
|
|
2050
2175
|
continue;
|
|
2051
2176
|
const wildcard = match[1] ?? "";
|
|
2052
2177
|
for (const replacement of alias.replacements) {
|
|
2053
|
-
targets.push(
|
|
2178
|
+
targets.push(resolve4(baseUrl, replacement.replace("*", wildcard)));
|
|
2054
2179
|
}
|
|
2055
2180
|
}
|
|
2056
2181
|
return targets;
|
|
@@ -2064,24 +2189,24 @@ ${message}`);
|
|
|
2064
2189
|
const ext = extname(basePath);
|
|
2065
2190
|
const paths = ext ? [basePath] : getLanguageExtensions(language).flatMap((extension) => [
|
|
2066
2191
|
`${basePath}${extension}`,
|
|
2067
|
-
|
|
2192
|
+
join5(basePath, `index${extension}`)
|
|
2068
2193
|
]);
|
|
2069
2194
|
if (language === "scss" || language === "sass") {
|
|
2070
2195
|
return paths.flatMap((path) => {
|
|
2071
|
-
const dir =
|
|
2196
|
+
const dir = dirname3(path);
|
|
2072
2197
|
const base = path.slice(dir.length + 1);
|
|
2073
|
-
return [path,
|
|
2198
|
+
return [path, join5(dir, `_${base}`)];
|
|
2074
2199
|
});
|
|
2075
2200
|
}
|
|
2076
2201
|
return paths;
|
|
2077
2202
|
}, resolveImportPath = (specifier, fromDirectory, loadPaths, language, config) => {
|
|
2078
2203
|
const rawCandidates = [
|
|
2079
2204
|
...resolveAliasTargets(specifier, config),
|
|
2080
|
-
isAbsolute(specifier) ? specifier :
|
|
2081
|
-
...loadPaths.map((path) =>
|
|
2205
|
+
isAbsolute(specifier) ? specifier : resolve4(fromDirectory, specifier),
|
|
2206
|
+
...loadPaths.map((path) => resolve4(path, specifier))
|
|
2082
2207
|
];
|
|
2083
2208
|
for (const candidate of rawCandidates.flatMap((path) => getCandidatePaths(path, language))) {
|
|
2084
|
-
if (
|
|
2209
|
+
if (existsSync6(candidate))
|
|
2085
2210
|
return candidate;
|
|
2086
2211
|
}
|
|
2087
2212
|
return null;
|
|
@@ -2094,8 +2219,8 @@ ${message}`);
|
|
|
2094
2219
|
path: url.slice(0, markerIndex)
|
|
2095
2220
|
};
|
|
2096
2221
|
}, rebaseCssUrls = (contents, sourceFile, entryFile) => {
|
|
2097
|
-
const sourceDir =
|
|
2098
|
-
const entryDir =
|
|
2222
|
+
const sourceDir = dirname3(sourceFile);
|
|
2223
|
+
const entryDir = dirname3(entryFile);
|
|
2099
2224
|
if (sourceDir === entryDir)
|
|
2100
2225
|
return contents;
|
|
2101
2226
|
return contents.replace(/url\(\s*(['"]?)([^'")]+)\1\s*\)/gi, (match, quote, rawUrl) => {
|
|
@@ -2103,7 +2228,7 @@ ${message}`);
|
|
|
2103
2228
|
if (!trimmedUrl || isExternalCssUrl(trimmedUrl))
|
|
2104
2229
|
return match;
|
|
2105
2230
|
const { marker, path } = splitCssUrl(trimmedUrl);
|
|
2106
|
-
const rebased = relative(entryDir,
|
|
2231
|
+
const rebased = relative(entryDir, resolve4(sourceDir, path)).replace(/\\/g, "/");
|
|
2107
2232
|
const normalized = rebased.startsWith(".") ? rebased : `./${rebased}`;
|
|
2108
2233
|
const nextQuote = quote || '"';
|
|
2109
2234
|
return `url(${nextQuote}${normalized}${marker}${nextQuote})`;
|
|
@@ -2111,7 +2236,7 @@ ${message}`);
|
|
|
2111
2236
|
}, rewriteAliasedStyleImports = (contents, sourceFile, loadPaths, language, config) => contents.replace(/(@(?:use|forward|import|require)\s+)(["'])([^"']+)\2/g, (match, prefix, quote, specifier) => {
|
|
2112
2237
|
if (specifier.startsWith(".") || isAbsolute(specifier) || isExternalCssUrl(specifier))
|
|
2113
2238
|
return match;
|
|
2114
|
-
const resolved = resolveImportPath(specifier,
|
|
2239
|
+
const resolved = resolveImportPath(specifier, dirname3(sourceFile), loadPaths, language, config);
|
|
2115
2240
|
return resolved ? `${prefix}${quote}${resolved}${quote}` : match;
|
|
2116
2241
|
}), preprocessLoadedStyle = (contents, sourceFile, entryFile, loadPaths = [], language, config) => {
|
|
2117
2242
|
const rebased = rebaseCssUrls(contents, sourceFile, entryFile);
|
|
@@ -2140,8 +2265,8 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2140
2265
|
return mod.default ?? mod;
|
|
2141
2266
|
}
|
|
2142
2267
|
return mod;
|
|
2143
|
-
}, loadPostcssConfigFile = async (
|
|
2144
|
-
const resolved =
|
|
2268
|
+
}, loadPostcssConfigFile = async (configPath2) => {
|
|
2269
|
+
const resolved = resolve4(process.cwd(), configPath2);
|
|
2145
2270
|
const loaded = resolved.endsWith(".cjs") || resolved.endsWith(".cts") ? requireOptionalPeerSync(resolved) : await importOptionalPeer(`${new URL(`file://${resolved}`).href}?t=${Date.now()}`);
|
|
2146
2271
|
const config = normalizePostcssModule(loaded);
|
|
2147
2272
|
const value = typeof config === "function" ? await config({
|
|
@@ -2201,9 +2326,9 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2201
2326
|
return result.css;
|
|
2202
2327
|
}, createSassImporter = (entryFile, loadPaths, language, config, deps) => ({
|
|
2203
2328
|
canonicalize(specifier, options) {
|
|
2204
|
-
const fromDirectory = options.containingUrl ?
|
|
2329
|
+
const fromDirectory = options.containingUrl ? dirname3(fileURLToPath(options.containingUrl)) : dirname3(entryFile);
|
|
2205
2330
|
const resolved = resolveImportPath(specifier, fromDirectory, loadPaths, language, config);
|
|
2206
|
-
return resolved ? new URL(pathToFileURL(
|
|
2331
|
+
return resolved ? new URL(pathToFileURL(resolve4(resolved)).href) : null;
|
|
2207
2332
|
},
|
|
2208
2333
|
load(canonicalUrl) {
|
|
2209
2334
|
const filePath = fileURLToPath(canonicalUrl);
|
|
@@ -2212,7 +2337,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2212
2337
|
if (fileLanguage !== "scss" && fileLanguage !== "sass" && fileLanguage !== null)
|
|
2213
2338
|
return null;
|
|
2214
2339
|
return {
|
|
2215
|
-
contents: preprocessLoadedStyle(
|
|
2340
|
+
contents: preprocessLoadedStyle(readFileSync5(filePath, "utf-8"), filePath, entryFile, loadPaths, language, config),
|
|
2216
2341
|
syntax: filePath.endsWith(".sass") ? "indented" : "scss"
|
|
2217
2342
|
};
|
|
2218
2343
|
}
|
|
@@ -2220,9 +2345,9 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2220
2345
|
install(less, pluginManager) {
|
|
2221
2346
|
const baseManager = new less.FileManager;
|
|
2222
2347
|
const manager = Object.create(baseManager);
|
|
2223
|
-
manager.supports = (filename, currentDirectory) => Boolean(resolveImportPath(filename,
|
|
2348
|
+
manager.supports = (filename, currentDirectory) => Boolean(resolveImportPath(filename, resolve4(currentDirectory), loadPaths, "less", config));
|
|
2224
2349
|
manager.loadFile = async (filename, currentDirectory) => {
|
|
2225
|
-
const resolved = resolveImportPath(filename,
|
|
2350
|
+
const resolved = resolveImportPath(filename, resolve4(currentDirectory), loadPaths, "less", config);
|
|
2226
2351
|
if (!resolved) {
|
|
2227
2352
|
throw new Error(`Unable to resolve Less import "${filename}"`);
|
|
2228
2353
|
}
|
|
@@ -2259,29 +2384,29 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2259
2384
|
const stylusDeps = renderer.deps?.();
|
|
2260
2385
|
if (Array.isArray(stylusDeps)) {
|
|
2261
2386
|
for (const dep of stylusDeps)
|
|
2262
|
-
deps.add(
|
|
2387
|
+
deps.add(resolve4(dep));
|
|
2263
2388
|
}
|
|
2264
2389
|
}
|
|
2265
2390
|
resolveCss(css ?? "");
|
|
2266
2391
|
});
|
|
2267
2392
|
});
|
|
2268
2393
|
}, styleDependencyGraph, styleOutputHashes, recordStyleDeps = (entry, deps) => {
|
|
2269
|
-
const key =
|
|
2394
|
+
const key = resolve4(entry);
|
|
2270
2395
|
const stripped = new Set;
|
|
2271
2396
|
for (const dep of deps) {
|
|
2272
|
-
const resolved =
|
|
2397
|
+
const resolved = resolve4(dep);
|
|
2273
2398
|
if (resolved !== key)
|
|
2274
2399
|
stripped.add(resolved);
|
|
2275
2400
|
}
|
|
2276
2401
|
styleDependencyGraph.set(key, stripped);
|
|
2277
2402
|
}, addStyleImporter = (importerPath, stylePath) => {
|
|
2278
|
-
const key =
|
|
2279
|
-
const target =
|
|
2403
|
+
const key = resolve4(importerPath);
|
|
2404
|
+
const target = resolve4(stylePath);
|
|
2280
2405
|
const deps = styleDependencyGraph.get(key) ?? new Set;
|
|
2281
2406
|
deps.add(target);
|
|
2282
2407
|
styleDependencyGraph.set(key, deps);
|
|
2283
2408
|
}, findStyleEntriesImporting = (changedPath) => {
|
|
2284
|
-
const target =
|
|
2409
|
+
const target = resolve4(changedPath);
|
|
2285
2410
|
const importers = [];
|
|
2286
2411
|
for (const [entry, deps] of styleDependencyGraph) {
|
|
2287
2412
|
if (deps.has(target))
|
|
@@ -2289,13 +2414,13 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2289
2414
|
}
|
|
2290
2415
|
return importers;
|
|
2291
2416
|
}, recordStyleOutput = (entry, css) => {
|
|
2292
|
-
const key =
|
|
2417
|
+
const key = resolve4(entry);
|
|
2293
2418
|
const hash = createHash("sha1").update(css).digest("hex");
|
|
2294
2419
|
const previous = styleOutputHashes.get(key);
|
|
2295
2420
|
styleOutputHashes.set(key, hash);
|
|
2296
2421
|
return previous !== hash;
|
|
2297
2422
|
}, forgetStyleEntry = (entry) => {
|
|
2298
|
-
const key =
|
|
2423
|
+
const key = resolve4(entry);
|
|
2299
2424
|
styleDependencyGraph.delete(key);
|
|
2300
2425
|
styleOutputHashes.delete(key);
|
|
2301
2426
|
}, compileStyleSource = async (filePath, source, languageHint, config) => {
|
|
@@ -2321,7 +2446,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2321
2446
|
loadPaths,
|
|
2322
2447
|
style: "expanded",
|
|
2323
2448
|
syntax: language === "sass" ? "indented" : "scss",
|
|
2324
|
-
url: new URL(pathToFileURL(
|
|
2449
|
+
url: new URL(pathToFileURL(resolve4(filePath)).href)
|
|
2325
2450
|
});
|
|
2326
2451
|
const css = await runPostcss(result.css, filePath, config);
|
|
2327
2452
|
const loadedUrls = result.loadedUrls ?? [];
|
|
@@ -2329,7 +2454,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2329
2454
|
if (url.protocol !== "file:")
|
|
2330
2455
|
continue;
|
|
2331
2456
|
const dep = fileURLToPath(url);
|
|
2332
|
-
if (
|
|
2457
|
+
if (resolve4(dep) === resolve4(filePath))
|
|
2333
2458
|
continue;
|
|
2334
2459
|
deps.add(dep);
|
|
2335
2460
|
}
|
|
@@ -2450,8 +2575,8 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2450
2575
|
const start = match.index ?? 0;
|
|
2451
2576
|
const end = start + match[0].length;
|
|
2452
2577
|
parts.push(content.slice(cursor, start));
|
|
2453
|
-
const fullPath = isAbsolute(importPath) ? importPath :
|
|
2454
|
-
if (visited.has(fullPath) || !
|
|
2578
|
+
const fullPath = isAbsolute(importPath) ? importPath : resolve4(baseDir, importPath);
|
|
2579
|
+
if (visited.has(fullPath) || !existsSync6(fullPath)) {
|
|
2455
2580
|
parts.push(visited.has(fullPath) ? "" : match[0]);
|
|
2456
2581
|
cursor = end;
|
|
2457
2582
|
continue;
|
|
@@ -2459,7 +2584,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2459
2584
|
const nextVisited = new Set(visited);
|
|
2460
2585
|
nextVisited.add(fullPath);
|
|
2461
2586
|
const imported = await readFile(fullPath, "utf-8");
|
|
2462
|
-
parts.push(await resolveCssImportsAsync(imported,
|
|
2587
|
+
parts.push(await resolveCssImportsAsync(imported, dirname3(fullPath), nextVisited));
|
|
2463
2588
|
cursor = end;
|
|
2464
2589
|
}
|
|
2465
2590
|
parts.push(content.slice(cursor));
|
|
@@ -2468,24 +2593,24 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2468
2593
|
if (!isPreprocessableStylePath(filePath)) {
|
|
2469
2594
|
const raw = await readFile(filePath, "utf-8");
|
|
2470
2595
|
const processed = await runPostcss(raw, filePath, config);
|
|
2471
|
-
return resolveCssImportsAsync(processed,
|
|
2596
|
+
return resolveCssImportsAsync(processed, dirname3(filePath), new Set([filePath]));
|
|
2472
2597
|
}
|
|
2473
2598
|
const compiled = await compileStyleSource(filePath, undefined, undefined, config);
|
|
2474
|
-
return resolveCssImportsAsync(compiled,
|
|
2599
|
+
return resolveCssImportsAsync(compiled, dirname3(filePath), new Set([filePath]));
|
|
2475
2600
|
}, resolveCssImportsSync = (content, baseDir, visited) => {
|
|
2476
2601
|
return content.replace(CSS_IMPORT_PATTERN, (match, importPath) => {
|
|
2477
|
-
const fullPath = isAbsolute(importPath) ? importPath :
|
|
2602
|
+
const fullPath = isAbsolute(importPath) ? importPath : resolve4(baseDir, importPath);
|
|
2478
2603
|
if (visited.has(fullPath))
|
|
2479
2604
|
return "";
|
|
2480
|
-
if (!
|
|
2605
|
+
if (!existsSync6(fullPath))
|
|
2481
2606
|
return match;
|
|
2482
2607
|
const nextVisited = new Set(visited);
|
|
2483
2608
|
nextVisited.add(fullPath);
|
|
2484
|
-
const imported =
|
|
2485
|
-
return resolveCssImportsSync(imported,
|
|
2609
|
+
const imported = readFileSync5(fullPath, "utf-8");
|
|
2610
|
+
return resolveCssImportsSync(imported, dirname3(fullPath), nextVisited);
|
|
2486
2611
|
});
|
|
2487
2612
|
}, compileStyleFileIfNeededSync = (filePath, config) => {
|
|
2488
|
-
const rawContents =
|
|
2613
|
+
const rawContents = readFileSync5(filePath, "utf-8");
|
|
2489
2614
|
const language = getStyleLanguage(filePath);
|
|
2490
2615
|
if (config?.postcss) {
|
|
2491
2616
|
throw new Error(`Unable to compile ${filePath}: PostCSS preprocessing is async-only.`);
|
|
@@ -2508,18 +2633,18 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2508
2633
|
loadPaths,
|
|
2509
2634
|
style: "expanded",
|
|
2510
2635
|
syntax: language === "sass" ? "indented" : "scss",
|
|
2511
|
-
url: new URL(pathToFileURL(
|
|
2636
|
+
url: new URL(pathToFileURL(resolve4(filePath)).href)
|
|
2512
2637
|
});
|
|
2513
2638
|
const loadedUrls = result.loadedUrls ?? [];
|
|
2514
2639
|
for (const url of loadedUrls) {
|
|
2515
2640
|
if (url.protocol !== "file:")
|
|
2516
2641
|
continue;
|
|
2517
2642
|
const dep = fileURLToPath(url);
|
|
2518
|
-
if (
|
|
2643
|
+
if (resolve4(dep) === resolve4(filePath))
|
|
2519
2644
|
continue;
|
|
2520
2645
|
addStyleImporter(filePath, dep);
|
|
2521
2646
|
}
|
|
2522
|
-
return resolveCssImportsSync(result.css,
|
|
2647
|
+
return resolveCssImportsSync(result.css, dirname3(filePath), new Set([filePath]));
|
|
2523
2648
|
}
|
|
2524
2649
|
if (language === "less") {
|
|
2525
2650
|
throw new Error(`Unable to compile ${filePath}: Less styleUrl preprocessing is async-only. Import the Less file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
|
|
@@ -2527,7 +2652,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2527
2652
|
if (language === "stylus") {
|
|
2528
2653
|
throw new Error(`Unable to compile ${filePath}: Stylus styleUrl preprocessing is async-only. Import the Stylus file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
|
|
2529
2654
|
}
|
|
2530
|
-
return resolveCssImportsSync(rawContents,
|
|
2655
|
+
return resolveCssImportsSync(rawContents, dirname3(filePath), new Set([filePath]));
|
|
2531
2656
|
}, getCssOutputExtension = (filePath) => isPreprocessableStylePath(filePath) ? ".css" : extname(filePath);
|
|
2532
2657
|
var init_stylePreprocessor = __esm(() => {
|
|
2533
2658
|
CSS_EXTENSION_PATTERN = /\.css$/i;
|
|
@@ -2536,7 +2661,7 @@ var init_stylePreprocessor = __esm(() => {
|
|
|
2536
2661
|
STYLE_LANGUAGE_PATTERN = /^(s[ac]ss|less|styl(?:us)?)$/i;
|
|
2537
2662
|
importOptionalPeer = new Function("specifier", "return import(specifier)");
|
|
2538
2663
|
requireOptionalPeer = new Function("specifier", "return require(specifier)");
|
|
2539
|
-
requireFromCwd = createRequire(
|
|
2664
|
+
requireFromCwd = createRequire(join5(process.cwd(), "package.json"));
|
|
2540
2665
|
styleDependencyGraph = new Map;
|
|
2541
2666
|
styleOutputHashes = new Map;
|
|
2542
2667
|
stylePreprocessorPlugin = createStylePreprocessorPlugin();
|
|
@@ -2545,13 +2670,13 @@ var init_stylePreprocessor = __esm(() => {
|
|
|
2545
2670
|
|
|
2546
2671
|
// src/core/svelteServerModule.ts
|
|
2547
2672
|
import { mkdir, readdir as readdir2 } from "fs/promises";
|
|
2548
|
-
import { basename as basename3, dirname as
|
|
2673
|
+
import { basename as basename3, dirname as dirname4, extname as extname2, join as join6, relative as relative2, resolve as resolve5 } from "path";
|
|
2549
2674
|
var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
|
|
2550
|
-
const importPath = relative2(
|
|
2675
|
+
const importPath = relative2(dirname4(from), target).replace(/\\/g, "/");
|
|
2551
2676
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
2552
2677
|
}, processDirectoryEntries = (entries, dir, targetFileName, stack) => {
|
|
2553
2678
|
for (const entry of entries) {
|
|
2554
|
-
const entryPath =
|
|
2679
|
+
const entryPath = join6(dir, entry.name);
|
|
2555
2680
|
if (entry.isDirectory())
|
|
2556
2681
|
stack.push(entryPath);
|
|
2557
2682
|
if (entry.isFile() && entry.name === targetFileName) {
|
|
@@ -2581,11 +2706,11 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2581
2706
|
if (cachedPath !== undefined) {
|
|
2582
2707
|
return cachedPath;
|
|
2583
2708
|
}
|
|
2584
|
-
if (!sourcePath.includes(`${
|
|
2709
|
+
if (!sourcePath.includes(`${join6(process.cwd(), "build")}${process.platform === "win32" ? "" : "/"}`) && !sourcePath.includes("/build/")) {
|
|
2585
2710
|
originalSourcePathCache.set(sourcePath, sourcePath);
|
|
2586
2711
|
return sourcePath;
|
|
2587
2712
|
}
|
|
2588
|
-
const resolvedSourcePath = await findSourceFileByBasename(
|
|
2713
|
+
const resolvedSourcePath = await findSourceFileByBasename(join6(process.cwd(), "src"), normalizeBuiltSvelteFileName(sourcePath));
|
|
2589
2714
|
const nextPath = resolvedSourcePath ?? sourcePath;
|
|
2590
2715
|
originalSourcePathCache.set(sourcePath, nextPath);
|
|
2591
2716
|
return nextPath;
|
|
@@ -2593,7 +2718,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2593
2718
|
if (!spec.startsWith(".")) {
|
|
2594
2719
|
return null;
|
|
2595
2720
|
}
|
|
2596
|
-
const basePath =
|
|
2721
|
+
const basePath = resolve5(dirname4(from), spec);
|
|
2597
2722
|
const candidates = [
|
|
2598
2723
|
basePath,
|
|
2599
2724
|
`${basePath}.ts`,
|
|
@@ -2601,11 +2726,11 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2601
2726
|
`${basePath}.mjs`,
|
|
2602
2727
|
`${basePath}.cjs`,
|
|
2603
2728
|
`${basePath}.json`,
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2729
|
+
join6(basePath, "index.ts"),
|
|
2730
|
+
join6(basePath, "index.js"),
|
|
2731
|
+
join6(basePath, "index.mjs"),
|
|
2732
|
+
join6(basePath, "index.cjs"),
|
|
2733
|
+
join6(basePath, "index.json")
|
|
2609
2734
|
];
|
|
2610
2735
|
const existResults = await Promise.all(candidates.map((candidate) => Bun.file(candidate).exists()));
|
|
2611
2736
|
const foundIndex = existResults.indexOf(true);
|
|
@@ -2613,7 +2738,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2613
2738
|
}, getCachedModulePath = (sourcePath) => {
|
|
2614
2739
|
const relativeSourcePath = relative2(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
2615
2740
|
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
2616
|
-
return
|
|
2741
|
+
return join6(serverCacheRoot, `${normalizedSourcePath}.server.js`);
|
|
2617
2742
|
}, resolveSvelteImport = async (spec, from) => {
|
|
2618
2743
|
if (!spec.startsWith(".") && !spec.startsWith("/")) {
|
|
2619
2744
|
const resolved = resolvePackageImport(spec);
|
|
@@ -2625,7 +2750,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2625
2750
|
if (!spec.startsWith(".")) {
|
|
2626
2751
|
return null;
|
|
2627
2752
|
}
|
|
2628
|
-
const explicitPath =
|
|
2753
|
+
const explicitPath = resolve5(dirname4(from), spec);
|
|
2629
2754
|
if (extname2(explicitPath) === ".svelte") {
|
|
2630
2755
|
return explicitPath;
|
|
2631
2756
|
}
|
|
@@ -2704,7 +2829,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2704
2829
|
compiledCode = compiledCode.replaceAll(spec, resolvedModuleImport);
|
|
2705
2830
|
}
|
|
2706
2831
|
const compiledModulePath = getCachedModulePath(sourcePath);
|
|
2707
|
-
await mkdir(
|
|
2832
|
+
await mkdir(dirname4(compiledModulePath), { recursive: true });
|
|
2708
2833
|
await writeIfChanged(compiledModulePath, compiledCode);
|
|
2709
2834
|
compiledModuleCache.set(sourcePath, compiledModulePath);
|
|
2710
2835
|
return compiledModulePath;
|
|
@@ -2714,7 +2839,7 @@ var init_svelteServerModule = __esm(() => {
|
|
|
2714
2839
|
init_lowerIslandSyntax();
|
|
2715
2840
|
init_lowerAwaitSlotSyntax();
|
|
2716
2841
|
init_stylePreprocessor();
|
|
2717
|
-
serverCacheRoot =
|
|
2842
|
+
serverCacheRoot = join6(process.cwd(), ".absolutejs", "islands", "svelte");
|
|
2718
2843
|
compiledModuleCache = new Map;
|
|
2719
2844
|
originalSourcePathCache = new Map;
|
|
2720
2845
|
transpiler = new Bun.Transpiler({
|
|
@@ -2725,15 +2850,15 @@ var init_svelteServerModule = __esm(() => {
|
|
|
2725
2850
|
|
|
2726
2851
|
// src/core/vueServerModule.ts
|
|
2727
2852
|
import { mkdir as mkdir2 } from "fs/promises";
|
|
2728
|
-
import { dirname as
|
|
2853
|
+
import { dirname as dirname5, join as join7, relative as relative3, resolve as resolve6 } from "path";
|
|
2729
2854
|
var {Transpiler } = globalThis.Bun;
|
|
2730
2855
|
var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, transpiler2, ensureRelativeImportPath2 = (from, target) => {
|
|
2731
|
-
const importPath = relative3(
|
|
2856
|
+
const importPath = relative3(dirname5(from), target).replace(/\\/g, "/");
|
|
2732
2857
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
2733
2858
|
}, getCachedModulePath2 = (sourcePath) => {
|
|
2734
2859
|
const relativeSourcePath = relative3(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
2735
2860
|
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
2736
|
-
return
|
|
2861
|
+
return join7(serverCacheRoot2, `${normalizedSourcePath}.server.js`);
|
|
2737
2862
|
}, writeIfChanged2 = async (path, content) => {
|
|
2738
2863
|
const targetFile = Bun.file(path);
|
|
2739
2864
|
if (await targetFile.exists()) {
|
|
@@ -2788,7 +2913,7 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, tran
|
|
|
2788
2913
|
}).code : "const ssrRender = () => {};";
|
|
2789
2914
|
const childImportPaths = extractRelativeVueImports(compiledScript.content);
|
|
2790
2915
|
const compiledChildren = await Promise.all(childImportPaths.map(async (relativeImport) => ({
|
|
2791
|
-
compiledPath: await compileVueServerModule(
|
|
2916
|
+
compiledPath: await compileVueServerModule(resolve6(dirname5(sourcePath), relativeImport)),
|
|
2792
2917
|
spec: relativeImport
|
|
2793
2918
|
})));
|
|
2794
2919
|
const strippedScript = stripExports(compiledScript.content);
|
|
@@ -2805,14 +2930,14 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, tran
|
|
|
2805
2930
|
for (const child of compiledChildren) {
|
|
2806
2931
|
rewritten = rewritten.replaceAll(child.spec, ensureRelativeImportPath2(compiledModulePath, child.compiledPath));
|
|
2807
2932
|
}
|
|
2808
|
-
await mkdir2(
|
|
2933
|
+
await mkdir2(dirname5(compiledModulePath), { recursive: true });
|
|
2809
2934
|
await writeIfChanged2(compiledModulePath, rewritten);
|
|
2810
2935
|
compiledModuleCache2.set(sourcePath, compiledModulePath);
|
|
2811
2936
|
return compiledModulePath;
|
|
2812
2937
|
};
|
|
2813
2938
|
var init_vueServerModule = __esm(() => {
|
|
2814
2939
|
init_constants();
|
|
2815
|
-
serverCacheRoot2 =
|
|
2940
|
+
serverCacheRoot2 = join7(process.cwd(), ".absolutejs", "islands", "vue");
|
|
2816
2941
|
compiledModuleCache2 = new Map;
|
|
2817
2942
|
transpiler2 = new Transpiler({ loader: "ts", target: "browser" });
|
|
2818
2943
|
});
|
|
@@ -3488,7 +3613,7 @@ var registerStreamSlotForSsr = (props) => {
|
|
|
3488
3613
|
// src/vue/pageHandler.ts
|
|
3489
3614
|
init_constants();
|
|
3490
3615
|
import { readdir } from "fs/promises";
|
|
3491
|
-
import { basename as basename2, dirname } from "path";
|
|
3616
|
+
import { basename as basename2, dirname as dirname2 } from "path";
|
|
3492
3617
|
|
|
3493
3618
|
// src/core/islandPageContext.ts
|
|
3494
3619
|
init_constants();
|
|
@@ -4124,7 +4249,7 @@ var readSetupAppHook = (value) => {
|
|
|
4124
4249
|
};
|
|
4125
4250
|
var readDefaultExport = (value) => isRecord2(value) ? value.default : undefined;
|
|
4126
4251
|
var resolveCurrentGeneratedVueModulePath = async (pagePath) => {
|
|
4127
|
-
const pageDirectory =
|
|
4252
|
+
const pageDirectory = dirname2(pagePath);
|
|
4128
4253
|
const expectedPrefix = `${basename2(pagePath, ".js").split(".")[0]}.`;
|
|
4129
4254
|
try {
|
|
4130
4255
|
const pageEntries = await readdir(pageDirectory, {
|
|
@@ -4154,14 +4279,28 @@ var primeVueStream = async (stream) => {
|
|
|
4154
4279
|
const firstChunk = await reader.read();
|
|
4155
4280
|
return { firstChunk, reader };
|
|
4156
4281
|
};
|
|
4282
|
+
var cachedSsrOnlyHmrShim = null;
|
|
4283
|
+
var getSsrOnlyHmrShim = () => {
|
|
4284
|
+
if (cachedSsrOnlyHmrShim)
|
|
4285
|
+
return cachedSsrOnlyHmrShim;
|
|
4286
|
+
cachedSsrOnlyHmrShim = (async () => {
|
|
4287
|
+
const { buildHMRClient: buildHMRClient2 } = await Promise.resolve().then(() => (init_buildHMRClient(), exports_buildHMRClient));
|
|
4288
|
+
const bundle = await buildHMRClient2();
|
|
4289
|
+
return `<script>window.__HMR_FRAMEWORK__="vue";</script><script data-hmr-client>${bundle}</script>`;
|
|
4290
|
+
})();
|
|
4291
|
+
return cachedSsrOnlyHmrShim;
|
|
4292
|
+
};
|
|
4157
4293
|
var handleVuePageRequest = async (input) => {
|
|
4158
4294
|
const passedPageComponent = input.Page;
|
|
4159
4295
|
const resolvedHeadTag = input.headTag ?? "<head></head>";
|
|
4160
|
-
const resolvedIndexPath = input.indexPath;
|
|
4161
4296
|
const resolvedOptions = input;
|
|
4162
4297
|
const resolvedPagePath = input.pagePath;
|
|
4163
4298
|
const maybeProps = input.props;
|
|
4164
4299
|
const clientMode = input.client ?? "auto";
|
|
4300
|
+
const resolvedIndexPath = input.indexPath;
|
|
4301
|
+
if (clientMode === "auto" && !resolvedIndexPath) {
|
|
4302
|
+
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.');
|
|
4303
|
+
}
|
|
4165
4304
|
try {
|
|
4166
4305
|
const handlerCallsite = resolvedOptions?.collectStreamingSlots === true ? undefined : getCurrentRouteRegistrationCallsite() ?? captureStreamingSlotWarningCallsite();
|
|
4167
4306
|
const renderPageResponse = async () => {
|
|
@@ -4217,7 +4356,8 @@ var handleVuePageRequest = async (input) => {
|
|
|
4217
4356
|
const bodyStream = renderToWebStream(app);
|
|
4218
4357
|
const { firstChunk, reader } = await primeVueStream(bodyStream);
|
|
4219
4358
|
const head = `<!DOCTYPE html><html>${resolvedHeadTag}<body><div id="root">`;
|
|
4220
|
-
const
|
|
4359
|
+
const ssrOnlyHmrShim = clientMode === "none" ? await getSsrOnlyHmrShim() : "";
|
|
4360
|
+
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>`;
|
|
4221
4361
|
const stream = new ReadableStream({
|
|
4222
4362
|
start(controller) {
|
|
4223
4363
|
controller.enqueue(head);
|
|
@@ -4648,5 +4788,5 @@ export {
|
|
|
4648
4788
|
Image
|
|
4649
4789
|
};
|
|
4650
4790
|
|
|
4651
|
-
//# debugId=
|
|
4791
|
+
//# debugId=7C428C2F2EAAB5D464756E2164756E21
|
|
4652
4792
|
//# sourceMappingURL=index.js.map
|