@absolutejs/absolute 0.19.0-beta.282 → 0.19.0-beta.283
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/build.js +298 -101
- package/dist/build.js.map +6 -5
- package/dist/index.js +321 -124
- package/dist/index.js.map +6 -5
- package/dist/src/core/vueServerModule.d.ts +1 -0
- package/dist/src/svelte/pageHandler.d.ts +5 -1
- package/dist/svelte/index.js +5 -3
- package/dist/svelte/index.js.map +3 -3
- package/dist/svelte/server.js +5 -3
- package/dist/svelte/server.js.map +3 -3
- package/dist/vue/index.js +243 -2
- package/dist/vue/index.js.map +6 -4
- package/dist/vue/server.js +243 -2
- package/dist/vue/server.js.map +6 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -174852,7 +174852,7 @@ var ssrDirty3 = false, buildDirtyResponse2 = (indexPath, props) => {
|
|
|
174852
174852
|
return new Response(html, {
|
|
174853
174853
|
headers: { "Content-Type": "text/html" }
|
|
174854
174854
|
});
|
|
174855
|
-
}, handleSveltePageRequest = async (PageComponent, pagePath, indexPath, props) => {
|
|
174855
|
+
}, handleSveltePageRequest = async (PageComponent, pagePath, indexPath, props, options) => {
|
|
174856
174856
|
if (ssrDirty3) {
|
|
174857
174857
|
return buildDirtyResponse2(indexPath, props);
|
|
174858
174858
|
}
|
|
@@ -174880,8 +174880,10 @@ var ssrDirty3 = false, buildDirtyResponse2 = (indexPath, props) => {
|
|
|
174880
174880
|
const { renderToReadableStream: renderToReadableStream2 } = await Promise.resolve().then(() => (init_renderToReadableStream(), exports_renderToReadableStream));
|
|
174881
174881
|
const ImportedPageComponent = await resolvePageComponent();
|
|
174882
174882
|
const stream = await renderToReadableStream2(ImportedPageComponent, props, {
|
|
174883
|
+
bodyContent: options?.bodyContent,
|
|
174883
174884
|
bootstrapModules: indexPath ? [indexPath] : [],
|
|
174884
|
-
bootstrapScriptContent: `window.__INITIAL_PROPS__=${JSON.stringify(props)}
|
|
174885
|
+
bootstrapScriptContent: `window.__INITIAL_PROPS__=${JSON.stringify(props)}`,
|
|
174886
|
+
headContent: options?.headContent
|
|
174885
174887
|
});
|
|
174886
174888
|
return new Response(stream, {
|
|
174887
174889
|
headers: { "Content-Type": "text/html" }
|
|
@@ -174905,6 +174907,180 @@ var init_pageHandler3 = __esm(() => {
|
|
|
174905
174907
|
init_resolveConvention();
|
|
174906
174908
|
});
|
|
174907
174909
|
|
|
174910
|
+
// src/core/vueServerModule.ts
|
|
174911
|
+
import { mkdir as mkdir4 } from "fs/promises";
|
|
174912
|
+
import { dirname as dirname10, extname as extname5, join as join20, relative as relative10, resolve as resolve24 } from "path";
|
|
174913
|
+
var {Transpiler: Transpiler3 } = globalThis.Bun;
|
|
174914
|
+
var serverCacheRoot2, compiledModuleCache2, transpiler4, toJs2 = (filePath) => {
|
|
174915
|
+
if (filePath.endsWith(".vue"))
|
|
174916
|
+
return filePath.replace(/\.vue$/, ".js");
|
|
174917
|
+
if (filePath.endsWith(".ts"))
|
|
174918
|
+
return filePath.replace(/\.ts$/, ".js");
|
|
174919
|
+
return `${filePath}.js`;
|
|
174920
|
+
}, stripExports2 = (code) => code.replace(/export\s+default/, "const script =").replace(/^export\s+/gm, ""), mergeVueImports2 = (code) => {
|
|
174921
|
+
const lines = code.split(`
|
|
174922
|
+
`);
|
|
174923
|
+
const specifierSet = new Set;
|
|
174924
|
+
const vueImportRegex = /^import\s+{([^}]+)}\s+from\s+['"]vue['"];?$/;
|
|
174925
|
+
lines.forEach((line) => {
|
|
174926
|
+
const match = line.match(vueImportRegex);
|
|
174927
|
+
if (!match?.[1])
|
|
174928
|
+
return;
|
|
174929
|
+
match[1].split(",").forEach((specifier) => specifierSet.add(specifier.trim()));
|
|
174930
|
+
});
|
|
174931
|
+
const nonVueLines = lines.filter((line) => !vueImportRegex.test(line));
|
|
174932
|
+
if (specifierSet.size === 0) {
|
|
174933
|
+
return nonVueLines.join(`
|
|
174934
|
+
`);
|
|
174935
|
+
}
|
|
174936
|
+
return [
|
|
174937
|
+
`import { ${[...specifierSet].join(", ")} } from "vue";`,
|
|
174938
|
+
...nonVueLines
|
|
174939
|
+
].join(`
|
|
174940
|
+
`);
|
|
174941
|
+
}, ensureRelativeImportPath2 = (from, to) => {
|
|
174942
|
+
const importPath = relative10(dirname10(from), to).replace(/\\/g, "/");
|
|
174943
|
+
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
174944
|
+
}, resolveRelativeModule3 = async (spec, from) => {
|
|
174945
|
+
if (!spec.startsWith(".")) {
|
|
174946
|
+
return null;
|
|
174947
|
+
}
|
|
174948
|
+
const basePath = resolve24(dirname10(from), spec);
|
|
174949
|
+
const candidates = [
|
|
174950
|
+
basePath,
|
|
174951
|
+
`${basePath}.ts`,
|
|
174952
|
+
`${basePath}.js`,
|
|
174953
|
+
`${basePath}.mjs`,
|
|
174954
|
+
`${basePath}.cjs`,
|
|
174955
|
+
`${basePath}.json`,
|
|
174956
|
+
join20(basePath, "index.ts"),
|
|
174957
|
+
join20(basePath, "index.js"),
|
|
174958
|
+
join20(basePath, "index.mjs"),
|
|
174959
|
+
join20(basePath, "index.cjs"),
|
|
174960
|
+
join20(basePath, "index.json")
|
|
174961
|
+
];
|
|
174962
|
+
for (const candidate of candidates) {
|
|
174963
|
+
if (await Bun.file(candidate).exists() === true) {
|
|
174964
|
+
return candidate;
|
|
174965
|
+
}
|
|
174966
|
+
}
|
|
174967
|
+
return null;
|
|
174968
|
+
}, getCachedModulePath2 = (sourcePath) => {
|
|
174969
|
+
const relativeSourcePath = relative10(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
174970
|
+
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
174971
|
+
return join20(serverCacheRoot2, `${normalizedSourcePath}.server.js`);
|
|
174972
|
+
}, resolveVueImport = async (spec, from) => {
|
|
174973
|
+
if (spec.startsWith("/")) {
|
|
174974
|
+
return spec;
|
|
174975
|
+
}
|
|
174976
|
+
if (spec.startsWith(".")) {
|
|
174977
|
+
const explicitPath = resolve24(dirname10(from), spec);
|
|
174978
|
+
if (extname5(explicitPath) === ".vue") {
|
|
174979
|
+
return explicitPath;
|
|
174980
|
+
}
|
|
174981
|
+
const candidate = `${explicitPath}.vue`;
|
|
174982
|
+
if (await Bun.file(candidate).exists() === true) {
|
|
174983
|
+
return candidate;
|
|
174984
|
+
}
|
|
174985
|
+
return null;
|
|
174986
|
+
}
|
|
174987
|
+
const resolvedPath = resolvePackageImport(spec);
|
|
174988
|
+
if (resolvedPath?.endsWith(".vue")) {
|
|
174989
|
+
return resolvedPath;
|
|
174990
|
+
}
|
|
174991
|
+
return null;
|
|
174992
|
+
}, writeIfChanged2 = async (path, content) => {
|
|
174993
|
+
const targetFile = Bun.file(path);
|
|
174994
|
+
if (await targetFile.exists() === true) {
|
|
174995
|
+
const currentContent = await targetFile.text();
|
|
174996
|
+
if (currentContent === content) {
|
|
174997
|
+
return;
|
|
174998
|
+
}
|
|
174999
|
+
}
|
|
175000
|
+
await Bun.write(path, content);
|
|
175001
|
+
}, compileVueServerModule = async (sourcePath) => {
|
|
175002
|
+
const cachedModulePath = compiledModuleCache2.get(sourcePath);
|
|
175003
|
+
if (cachedModulePath) {
|
|
175004
|
+
return cachedModulePath;
|
|
175005
|
+
}
|
|
175006
|
+
const compiler = await import("@vue/compiler-sfc");
|
|
175007
|
+
const source = await Bun.file(sourcePath).text();
|
|
175008
|
+
const { descriptor } = compiler.parse(source, {
|
|
175009
|
+
filename: sourcePath
|
|
175010
|
+
});
|
|
175011
|
+
const componentId = Bun.hash(sourcePath).toString(36);
|
|
175012
|
+
const scriptSource = descriptor.scriptSetup?.content ?? descriptor.script?.content ?? "";
|
|
175013
|
+
const importSpecs = Array.from(scriptSource.matchAll(/import\s+[\s\S]+?['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((value) => value !== undefined);
|
|
175014
|
+
const resolvedVueImports = await Promise.all(importSpecs.map((spec) => resolveVueImport(spec, sourcePath)));
|
|
175015
|
+
const resolvedModuleImports = await Promise.all(importSpecs.map((spec) => resolveRelativeModule3(spec, sourcePath)));
|
|
175016
|
+
const childModulePaths = new Map;
|
|
175017
|
+
const rewrittenModulePaths = new Map;
|
|
175018
|
+
for (let index = 0;index < importSpecs.length; index += 1) {
|
|
175019
|
+
const spec = importSpecs[index];
|
|
175020
|
+
const resolvedChild = resolvedVueImports[index];
|
|
175021
|
+
if (!spec || !resolvedChild)
|
|
175022
|
+
continue;
|
|
175023
|
+
const compiledChildPath = await compileVueServerModule(resolvedChild);
|
|
175024
|
+
childModulePaths.set(spec, compiledChildPath);
|
|
175025
|
+
}
|
|
175026
|
+
for (let index = 0;index < importSpecs.length; index += 1) {
|
|
175027
|
+
const spec = importSpecs[index];
|
|
175028
|
+
const resolvedModuleImport = resolvedModuleImports[index];
|
|
175029
|
+
if (!spec || !resolvedModuleImport)
|
|
175030
|
+
continue;
|
|
175031
|
+
if (resolvedVueImports[index])
|
|
175032
|
+
continue;
|
|
175033
|
+
rewrittenModulePaths.set(spec, ensureRelativeImportPath2(getCachedModulePath2(sourcePath), resolvedModuleImport));
|
|
175034
|
+
}
|
|
175035
|
+
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
175036
|
+
const compiledScript = hasScript ? compiler.compileScript(descriptor, {
|
|
175037
|
+
id: componentId,
|
|
175038
|
+
inlineTemplate: false
|
|
175039
|
+
}) : { bindings: {}, content: "export default {};" };
|
|
175040
|
+
const strippedScript = stripExports2(compiledScript.content);
|
|
175041
|
+
const transpiledScript = transpiler4.transformSync(strippedScript).replace(/(['"])(\.{1,2}\/[^'"]+)(['"])/g, (_, quoteStart, relativeImport, quoteEnd) => `${quoteStart}${toJs2(relativeImport)}${quoteEnd}`);
|
|
175042
|
+
const ssrRenderCode = compiler.compileTemplate({
|
|
175043
|
+
compilerOptions: {
|
|
175044
|
+
bindingMetadata: compiledScript.bindings,
|
|
175045
|
+
prefixIdentifiers: true
|
|
175046
|
+
},
|
|
175047
|
+
filename: sourcePath,
|
|
175048
|
+
id: componentId,
|
|
175049
|
+
scoped: descriptor.styles.some((styleBlock) => styleBlock.scoped),
|
|
175050
|
+
source: descriptor.template?.content ?? "",
|
|
175051
|
+
ssr: true,
|
|
175052
|
+
ssrCssVars: descriptor.cssVars
|
|
175053
|
+
}).code.replace(/(['"])(\.{1,2}\/[^'"]+)(['"])/g, (_, quoteStart, relativeImport, quoteEnd) => `${quoteStart}${toJs2(relativeImport)}${quoteEnd}`);
|
|
175054
|
+
let serverCode = mergeVueImports2([
|
|
175055
|
+
transpiledScript,
|
|
175056
|
+
ssrRenderCode,
|
|
175057
|
+
"script.ssrRender = ssrRender;",
|
|
175058
|
+
descriptor.styles.some((styleBlock) => styleBlock.scoped) ? `script.__scopeId = "data-v-${componentId}";` : "",
|
|
175059
|
+
"export default script;"
|
|
175060
|
+
].filter(Boolean).join(`
|
|
175061
|
+
`));
|
|
175062
|
+
for (const [spec, compiledChildPath] of childModulePaths) {
|
|
175063
|
+
serverCode = serverCode.replaceAll(spec, ensureRelativeImportPath2(getCachedModulePath2(sourcePath), compiledChildPath));
|
|
175064
|
+
}
|
|
175065
|
+
for (const [spec, resolvedModuleImport] of rewrittenModulePaths) {
|
|
175066
|
+
serverCode = serverCode.replaceAll(spec, resolvedModuleImport);
|
|
175067
|
+
}
|
|
175068
|
+
const compiledModulePath = getCachedModulePath2(sourcePath);
|
|
175069
|
+
await mkdir4(dirname10(compiledModulePath), { recursive: true });
|
|
175070
|
+
await writeIfChanged2(compiledModulePath, serverCode);
|
|
175071
|
+
compiledModuleCache2.set(sourcePath, compiledModulePath);
|
|
175072
|
+
return compiledModulePath;
|
|
175073
|
+
};
|
|
175074
|
+
var init_vueServerModule = __esm(() => {
|
|
175075
|
+
init_resolvePackageImport();
|
|
175076
|
+
serverCacheRoot2 = join20(process.cwd(), ".absolutejs", "islands", "vue");
|
|
175077
|
+
compiledModuleCache2 = new Map;
|
|
175078
|
+
transpiler4 = new Transpiler3({
|
|
175079
|
+
loader: "ts",
|
|
175080
|
+
target: "browser"
|
|
175081
|
+
});
|
|
175082
|
+
});
|
|
175083
|
+
|
|
174908
175084
|
// src/vue/pageHandler.ts
|
|
174909
175085
|
var ssrDirty4 = false, buildDirtyResponse3 = (headTag, indexPath, maybeProps) => {
|
|
174910
175086
|
const propsScript = `window.__INITIAL_PROPS__=${JSON.stringify(maybeProps ?? {})};`;
|
|
@@ -174919,7 +175095,27 @@ var ssrDirty4 = false, buildDirtyResponse3 = (headTag, indexPath, maybeProps) =>
|
|
|
174919
175095
|
return buildDirtyResponse3(headTag, indexPath, maybeProps);
|
|
174920
175096
|
}
|
|
174921
175097
|
try {
|
|
174922
|
-
const
|
|
175098
|
+
const resolvePageComponent = async () => {
|
|
175099
|
+
const passedPageComponent = _PageComponent;
|
|
175100
|
+
if (typeof passedPageComponent === "function" || typeof passedPageComponent === "object" && passedPageComponent !== null) {
|
|
175101
|
+
return _PageComponent;
|
|
175102
|
+
}
|
|
175103
|
+
const loadCompiledSourcePath = async (sourcePath) => {
|
|
175104
|
+
const compiledModulePath = await compileVueServerModule(sourcePath);
|
|
175105
|
+
const loadedModule = await import(compiledModulePath);
|
|
175106
|
+
return loadedModule.default ?? loadedModule;
|
|
175107
|
+
};
|
|
175108
|
+
if (typeof passedPageComponent === "string" && passedPageComponent.endsWith(".vue")) {
|
|
175109
|
+
return loadCompiledSourcePath(passedPageComponent);
|
|
175110
|
+
}
|
|
175111
|
+
const importedPageModule = await import(pagePath);
|
|
175112
|
+
const importedPageComponent = importedPageModule.default ?? importedPageModule;
|
|
175113
|
+
if (typeof importedPageComponent === "string" && importedPageComponent.endsWith(".vue")) {
|
|
175114
|
+
return loadCompiledSourcePath(importedPageComponent);
|
|
175115
|
+
}
|
|
175116
|
+
return importedPageComponent;
|
|
175117
|
+
};
|
|
175118
|
+
const ImportedPageComponent = await resolvePageComponent();
|
|
174923
175119
|
const { createSSRApp, h } = await import("vue");
|
|
174924
175120
|
const { renderToWebStream } = await import("vue/server-renderer");
|
|
174925
175121
|
const app = createSSRApp({
|
|
@@ -174956,6 +175152,7 @@ var ssrDirty4 = false, buildDirtyResponse3 = (headTag, indexPath, maybeProps) =>
|
|
|
174956
175152
|
ssrDirty4 = true;
|
|
174957
175153
|
};
|
|
174958
175154
|
var init_pageHandler4 = __esm(() => {
|
|
175155
|
+
init_vueServerModule();
|
|
174959
175156
|
init_resolveConvention();
|
|
174960
175157
|
});
|
|
174961
175158
|
|
|
@@ -175032,7 +175229,7 @@ __export(exports_moduleServer, {
|
|
|
175032
175229
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
175033
175230
|
});
|
|
175034
175231
|
import { existsSync as existsSync19, readFileSync as readFileSync11, statSync as statSync2 } from "fs";
|
|
175035
|
-
import { basename as basename9, dirname as
|
|
175232
|
+
import { basename as basename9, dirname as dirname11, extname as extname6, resolve as resolve25, relative as relative11 } from "path";
|
|
175036
175233
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
175037
175234
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
175038
175235
|
const allExports = [];
|
|
@@ -175052,7 +175249,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
|
|
|
175052
175249
|
${stubs}
|
|
175053
175250
|
`;
|
|
175054
175251
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
175055
|
-
const found = extensions.find((ext) => existsSync19(
|
|
175252
|
+
const found = extensions.find((ext) => existsSync19(resolve25(projectRoot, srcPath + ext)));
|
|
175056
175253
|
return found ? srcPath + found : srcPath;
|
|
175057
175254
|
}, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
175058
175255
|
const entries = Object.entries(vendorPaths).sort(([a], [b]) => b.length - a.length);
|
|
@@ -175067,7 +175264,7 @@ ${stubs}
|
|
|
175067
175264
|
return invalidationVersion > 0 ? `${mtime}.${invalidationVersion}` : `${mtime}`;
|
|
175068
175265
|
}, srcUrl = (relPath, projectRoot) => {
|
|
175069
175266
|
const base = `${SRC_PREFIX}${relPath.replace(/\\/g, "/")}`;
|
|
175070
|
-
const absPath =
|
|
175267
|
+
const absPath = resolve25(projectRoot, relPath);
|
|
175071
175268
|
const cached = mtimeCache.get(absPath);
|
|
175072
175269
|
if (cached !== undefined)
|
|
175073
175270
|
return `${base}?v=${buildVersion(cached, absPath)}`;
|
|
@@ -175079,17 +175276,17 @@ ${stubs}
|
|
|
175079
175276
|
return base;
|
|
175080
175277
|
}
|
|
175081
175278
|
}, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
|
|
175082
|
-
const absPath =
|
|
175083
|
-
const rel =
|
|
175084
|
-
let srcPath =
|
|
175085
|
-
if (
|
|
175086
|
-
srcPath =
|
|
175279
|
+
const absPath = resolve25(fileDir, relPath);
|
|
175280
|
+
const rel = relative11(projectRoot, absPath);
|
|
175281
|
+
let srcPath = extname6(rel) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
|
|
175282
|
+
if (extname6(srcPath) === ".svelte") {
|
|
175283
|
+
srcPath = relative11(projectRoot, resolveSvelteModulePath(resolve25(projectRoot, srcPath)));
|
|
175087
175284
|
}
|
|
175088
175285
|
return srcUrl(srcPath, projectRoot);
|
|
175089
175286
|
}, resolveAbsoluteSpecifier = (specifier, projectRoot) => {
|
|
175090
175287
|
try {
|
|
175091
175288
|
const target = resolvePackageImport(specifier, ["browser", "import"]) ?? Bun.resolveSync(specifier, projectRoot);
|
|
175092
|
-
return
|
|
175289
|
+
return relative11(projectRoot, target);
|
|
175093
175290
|
} catch {
|
|
175094
175291
|
return;
|
|
175095
175292
|
}
|
|
@@ -175115,29 +175312,29 @@ ${stubs}
|
|
|
175115
175312
|
};
|
|
175116
175313
|
result = result.replace(/^((?:import\s+[\s\S]+?\s+from|export\s+[\s\S]+?\s+from|import)\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
|
|
175117
175314
|
result = result.replace(/(import\s*\(\s*["'])([^"'./][^"']*)(["']\s*\))/g, stubReplace);
|
|
175118
|
-
const fileDir =
|
|
175315
|
+
const fileDir = dirname11(filePath);
|
|
175119
175316
|
result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
175120
175317
|
result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
175121
175318
|
result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}`);
|
|
175122
175319
|
result = result.replace(/((?:from|import)\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["'])/g, (_match, prefix, absPath, _ext, suffix) => {
|
|
175123
175320
|
if (absPath.startsWith(projectRoot)) {
|
|
175124
|
-
const rel2 =
|
|
175321
|
+
const rel2 = relative11(projectRoot, absPath).replace(/\\/g, "/");
|
|
175125
175322
|
return `${prefix}${srcUrl(rel2, projectRoot)}${suffix}`;
|
|
175126
175323
|
}
|
|
175127
|
-
const rel =
|
|
175324
|
+
const rel = relative11(projectRoot, absPath).replace(/\\/g, "/");
|
|
175128
175325
|
if (!rel.startsWith("..")) {
|
|
175129
175326
|
return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
|
|
175130
175327
|
}
|
|
175131
175328
|
return _match;
|
|
175132
175329
|
});
|
|
175133
175330
|
result = result.replace(/new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g, (_match, relPath) => {
|
|
175134
|
-
const absPath =
|
|
175135
|
-
const rel =
|
|
175331
|
+
const absPath = resolve25(fileDir, relPath);
|
|
175332
|
+
const rel = relative11(projectRoot, absPath);
|
|
175136
175333
|
return `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;
|
|
175137
175334
|
});
|
|
175138
175335
|
result = result.replace(/import\.meta\.resolve\(\s*["'](\.\.?\/[^"']+)["']\s*\)/g, (_match, relPath) => {
|
|
175139
|
-
const absPath =
|
|
175140
|
-
const rel =
|
|
175336
|
+
const absPath = resolve25(fileDir, relPath);
|
|
175337
|
+
const rel = relative11(projectRoot, absPath);
|
|
175141
175338
|
return `'${srcUrl(rel, projectRoot)}'`;
|
|
175142
175339
|
});
|
|
175143
175340
|
return result;
|
|
@@ -175176,21 +175373,21 @@ ${code}`;
|
|
|
175176
175373
|
transpiled = `var $RefreshReg$ = window.$RefreshReg$ || function(){};
|
|
175177
175374
|
` + `var $RefreshSig$ = window.$RefreshSig$ || function(){ return function(t){ return t; }; };
|
|
175178
175375
|
${transpiled}`;
|
|
175179
|
-
const relPath =
|
|
175376
|
+
const relPath = relative11(projectRoot, filePath).replace(/\\/g, "/");
|
|
175180
175377
|
transpiled = transpiled.replace(/\binput\.tsx:/g, `${relPath}:`);
|
|
175181
175378
|
return rewriteImports2(transpiled, filePath, projectRoot, rewriter);
|
|
175182
175379
|
}, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
|
|
175183
175380
|
const raw = readFileSync11(filePath, "utf-8");
|
|
175184
|
-
const ext =
|
|
175381
|
+
const ext = extname6(filePath);
|
|
175185
175382
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
175186
175383
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
175187
|
-
let
|
|
175384
|
+
let transpiler5 = jsTranspiler2;
|
|
175188
175385
|
if (isTSX)
|
|
175189
|
-
|
|
175386
|
+
transpiler5 = tsxTranspiler;
|
|
175190
175387
|
else if (isTS)
|
|
175191
|
-
|
|
175192
|
-
const valueExports = isTS ?
|
|
175193
|
-
let transpiled =
|
|
175388
|
+
transpiler5 = tsTranspiler2;
|
|
175389
|
+
const valueExports = isTS ? transpiler5.scan(raw).exports : [];
|
|
175390
|
+
let transpiled = transpiler5.transformSync(raw);
|
|
175194
175391
|
if (isTS) {
|
|
175195
175392
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
175196
175393
|
}
|
|
@@ -175323,11 +175520,11 @@ ${code}`;
|
|
|
175323
175520
|
if (compiled.css?.code) {
|
|
175324
175521
|
const cssPath = `${filePath}.css`;
|
|
175325
175522
|
svelteExternalCss.set(cssPath, compiled.css.code);
|
|
175326
|
-
const cssUrl = srcUrl(
|
|
175523
|
+
const cssUrl = srcUrl(relative11(projectRoot, cssPath), projectRoot);
|
|
175327
175524
|
code = `import "${cssUrl}";
|
|
175328
175525
|
${code}`;
|
|
175329
175526
|
}
|
|
175330
|
-
const moduleUrl = `${SRC_PREFIX}${
|
|
175527
|
+
const moduleUrl = `${SRC_PREFIX}${relative11(projectRoot, filePath).replace(/\\/g, "/")}`;
|
|
175331
175528
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
175332
175529
|
` + ` if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
175333
175530
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
@@ -175404,8 +175601,8 @@ ${code}`;
|
|
|
175404
175601
|
code = injectVueHmr(code, filePath, projectRoot, vueDir);
|
|
175405
175602
|
return rewriteImports2(code, filePath, projectRoot, rewriter);
|
|
175406
175603
|
}, injectVueHmr = (code, filePath, projectRoot, vueDir) => {
|
|
175407
|
-
const hmrBase = vueDir ?
|
|
175408
|
-
const hmrId =
|
|
175604
|
+
const hmrBase = vueDir ? resolve25(vueDir) : projectRoot;
|
|
175605
|
+
const hmrId = relative11(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
|
|
175409
175606
|
let result = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
|
|
175410
175607
|
result += [
|
|
175411
175608
|
"",
|
|
@@ -175562,8 +175759,8 @@ export default {};
|
|
|
175562
175759
|
const escaped = virtualCss.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
175563
175760
|
return jsResponse(`var s=document.createElement('style');s.textContent=\`${escaped}\`;s.dataset.svelteHmr=${JSON.stringify(cssCheckPath)};var p=document.querySelector('style[data-svelte-hmr="${cssCheckPath}"]');if(p)p.remove();document.head.appendChild(s);`);
|
|
175564
175761
|
}, resolveSourcePath = (relPath, projectRoot) => {
|
|
175565
|
-
const filePath =
|
|
175566
|
-
const ext =
|
|
175762
|
+
const filePath = resolve25(projectRoot, relPath);
|
|
175763
|
+
const ext = extname6(filePath);
|
|
175567
175764
|
if (ext === ".svelte")
|
|
175568
175765
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
175569
175766
|
if (ext)
|
|
@@ -175589,7 +175786,7 @@ export default {};
|
|
|
175589
175786
|
if (!TRANSPILABLE.has(ext))
|
|
175590
175787
|
return;
|
|
175591
175788
|
const stat2 = statSync2(filePath);
|
|
175592
|
-
const resolvedVueDir = vueDir ?
|
|
175789
|
+
const resolvedVueDir = vueDir ? resolve25(vueDir) : undefined;
|
|
175593
175790
|
const content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
|
|
175594
175791
|
setTransformed(filePath, content, stat2.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
175595
175792
|
return jsResponse(content);
|
|
@@ -175620,7 +175817,7 @@ export default {};
|
|
|
175620
175817
|
if (!pathname.startsWith(SRC_PREFIX))
|
|
175621
175818
|
return;
|
|
175622
175819
|
const relPath = pathname.slice(SRC_PREFIX.length);
|
|
175623
|
-
const virtualCssResponse = handleVirtualSvelteCss(
|
|
175820
|
+
const virtualCssResponse = handleVirtualSvelteCss(resolve25(projectRoot, relPath));
|
|
175624
175821
|
if (virtualCssResponse)
|
|
175625
175822
|
return virtualCssResponse;
|
|
175626
175823
|
const { filePath, ext } = resolveSourcePath(relPath, projectRoot);
|
|
@@ -175636,11 +175833,11 @@ export default {};
|
|
|
175636
175833
|
SRC_IMPORT_RE.lastIndex = 0;
|
|
175637
175834
|
while ((match = SRC_IMPORT_RE.exec(content)) !== null) {
|
|
175638
175835
|
if (match[1])
|
|
175639
|
-
files.push(
|
|
175836
|
+
files.push(resolve25(projectRoot, match[1]));
|
|
175640
175837
|
}
|
|
175641
175838
|
return files;
|
|
175642
175839
|
}, invalidateModule = (filePath) => {
|
|
175643
|
-
const resolved =
|
|
175840
|
+
const resolved = resolve25(filePath);
|
|
175644
175841
|
invalidate(filePath);
|
|
175645
175842
|
if (resolved !== filePath)
|
|
175646
175843
|
invalidate(resolved);
|
|
@@ -175707,11 +175904,11 @@ var exports_simpleHTMLHMR = {};
|
|
|
175707
175904
|
__export(exports_simpleHTMLHMR, {
|
|
175708
175905
|
handleHTMLUpdate: () => handleHTMLUpdate
|
|
175709
175906
|
});
|
|
175710
|
-
import { resolve as
|
|
175907
|
+
import { resolve as resolve26 } from "path";
|
|
175711
175908
|
var handleHTMLUpdate = async (htmlFilePath) => {
|
|
175712
175909
|
let htmlContent;
|
|
175713
175910
|
try {
|
|
175714
|
-
const resolvedPath =
|
|
175911
|
+
const resolvedPath = resolve26(htmlFilePath);
|
|
175715
175912
|
const file4 = Bun.file(resolvedPath);
|
|
175716
175913
|
if (!await file4.exists()) {
|
|
175717
175914
|
return null;
|
|
@@ -175737,11 +175934,11 @@ var exports_simpleHTMXHMR = {};
|
|
|
175737
175934
|
__export(exports_simpleHTMXHMR, {
|
|
175738
175935
|
handleHTMXUpdate: () => handleHTMXUpdate
|
|
175739
175936
|
});
|
|
175740
|
-
import { resolve as
|
|
175937
|
+
import { resolve as resolve27 } from "path";
|
|
175741
175938
|
var handleHTMXUpdate = async (htmxFilePath) => {
|
|
175742
175939
|
let htmlContent;
|
|
175743
175940
|
try {
|
|
175744
|
-
const resolvedPath =
|
|
175941
|
+
const resolvedPath = resolve27(htmxFilePath);
|
|
175745
175942
|
const file4 = Bun.file(resolvedPath);
|
|
175746
175943
|
if (!await file4.exists()) {
|
|
175747
175944
|
return null;
|
|
@@ -175765,7 +175962,7 @@ var init_simpleHTMXHMR = () => {};
|
|
|
175765
175962
|
// src/dev/rebuildTrigger.ts
|
|
175766
175963
|
import { existsSync as existsSync20 } from "fs";
|
|
175767
175964
|
import { rm as rm8 } from "fs/promises";
|
|
175768
|
-
import { basename as basename10, relative as
|
|
175965
|
+
import { basename as basename10, relative as relative12, resolve as resolve28 } from "path";
|
|
175769
175966
|
var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseErrorLocationFromMessage = (msg) => {
|
|
175770
175967
|
const pathLineCol = msg.match(/^([^\s:]+):(\d+)(?::(\d+))?/);
|
|
175771
175968
|
if (pathLineCol) {
|
|
@@ -175837,7 +176034,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
175837
176034
|
state.fileHashes.delete(filePathInSet);
|
|
175838
176035
|
try {
|
|
175839
176036
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, filePathInSet);
|
|
175840
|
-
const deletedPathResolved =
|
|
176037
|
+
const deletedPathResolved = resolve28(filePathInSet);
|
|
175841
176038
|
affectedFiles.forEach((affectedFile) => {
|
|
175842
176039
|
if (isValidDeletedAffectedFile(affectedFile, deletedPathResolved, processedFiles)) {
|
|
175843
176040
|
validFiles.push(affectedFile);
|
|
@@ -175881,7 +176078,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
175881
176078
|
if (storedHash !== undefined && storedHash === fileHash) {
|
|
175882
176079
|
return;
|
|
175883
176080
|
}
|
|
175884
|
-
const normalizedFilePath =
|
|
176081
|
+
const normalizedFilePath = resolve28(filePathInSet);
|
|
175885
176082
|
if (!processedFiles.has(normalizedFilePath)) {
|
|
175886
176083
|
validFiles.push(normalizedFilePath);
|
|
175887
176084
|
processedFiles.add(normalizedFilePath);
|
|
@@ -175959,8 +176156,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
175959
176156
|
}
|
|
175960
176157
|
if (framework === "unknown") {
|
|
175961
176158
|
const { invalidate: invalidate2 } = (init_transformCache(), __toCommonJS(exports_transformCache));
|
|
175962
|
-
invalidate2(
|
|
175963
|
-
const relPath =
|
|
176159
|
+
invalidate2(resolve28(filePath));
|
|
176160
|
+
const relPath = relative12(process.cwd(), filePath);
|
|
175964
176161
|
logHmrUpdate(relPath);
|
|
175965
176162
|
return;
|
|
175966
176163
|
}
|
|
@@ -176005,7 +176202,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
176005
176202
|
}
|
|
176006
176203
|
if (!graph)
|
|
176007
176204
|
return componentFile;
|
|
176008
|
-
const dependents = graph.dependents.get(
|
|
176205
|
+
const dependents = graph.dependents.get(resolve28(componentFile));
|
|
176009
176206
|
if (!dependents)
|
|
176010
176207
|
return componentFile;
|
|
176011
176208
|
for (const dep of dependents) {
|
|
@@ -176014,7 +176211,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
176014
176211
|
}
|
|
176015
176212
|
return componentFile;
|
|
176016
176213
|
}, resolveAngularPageEntries = (state, angularFiles, angularPagesPath) => {
|
|
176017
|
-
const pageEntries = angularFiles.filter((file4) => file4.endsWith(".ts") &&
|
|
176214
|
+
const pageEntries = angularFiles.filter((file4) => file4.endsWith(".ts") && resolve28(file4).startsWith(angularPagesPath));
|
|
176018
176215
|
if (pageEntries.length > 0 || !state.dependencyGraph) {
|
|
176019
176216
|
return pageEntries;
|
|
176020
176217
|
}
|
|
@@ -176023,7 +176220,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
176023
176220
|
const lookupFile = resolveComponentLookupFile(componentFile, state.dependencyGraph);
|
|
176024
176221
|
const affected = getAffectedFiles(state.dependencyGraph, lookupFile);
|
|
176025
176222
|
affected.forEach((file4) => {
|
|
176026
|
-
if (file4.endsWith(".ts") &&
|
|
176223
|
+
if (file4.endsWith(".ts") && resolve28(file4).startsWith(angularPagesPath)) {
|
|
176027
176224
|
resolvedPages.add(file4);
|
|
176028
176225
|
}
|
|
176029
176226
|
});
|
|
@@ -176104,7 +176301,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
176104
176301
|
const { clientPaths, serverPaths } = await compileAngular2(pageEntries, angularDir, true);
|
|
176105
176302
|
serverPaths.forEach((serverPath) => {
|
|
176106
176303
|
const fileBase = basename10(serverPath, ".js");
|
|
176107
|
-
state.manifest[toPascal(fileBase)] =
|
|
176304
|
+
state.manifest[toPascal(fileBase)] = resolve28(serverPath);
|
|
176108
176305
|
});
|
|
176109
176306
|
if (clientPaths.length > 0) {
|
|
176110
176307
|
await bundleAngularClient(state, clientPaths, state.resolvedPaths.buildDir);
|
|
@@ -176113,16 +176310,16 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
176113
176310
|
const angularDir = config.angularDirectory ?? "";
|
|
176114
176311
|
const angularFiles = filesToRebuild.filter((file4) => detectFramework(file4, state.resolvedPaths) === "angular");
|
|
176115
176312
|
for (const file4 of angularFiles) {
|
|
176116
|
-
state.fileHashes.set(
|
|
176313
|
+
state.fileHashes.set(resolve28(file4), computeFileHash(file4));
|
|
176117
176314
|
}
|
|
176118
|
-
const angularPagesPath =
|
|
176315
|
+
const angularPagesPath = resolve28(angularDir, "pages");
|
|
176119
176316
|
const pageEntries = resolveAngularPageEntries(state, angularFiles, angularPagesPath);
|
|
176120
176317
|
if (pageEntries.length > 0) {
|
|
176121
176318
|
await compileAndBundleAngular(state, pageEntries, angularDir);
|
|
176122
176319
|
invalidateAngularSsrCache();
|
|
176123
176320
|
}
|
|
176124
176321
|
if (pageEntries.length > 0) {
|
|
176125
|
-
await rm8(
|
|
176322
|
+
await rm8(resolve28(angularDir, "generated"), {
|
|
176126
176323
|
force: true,
|
|
176127
176324
|
recursive: true
|
|
176128
176325
|
});
|
|
@@ -176136,7 +176333,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
176136
176333
|
return manifest;
|
|
176137
176334
|
}, resolveReactEntryForPageFile = (normalized, pagesPathResolved, reactIndexesPath) => {
|
|
176138
176335
|
const pageName = basename10(normalized, ".tsx");
|
|
176139
|
-
const indexPath =
|
|
176336
|
+
const indexPath = resolve28(reactIndexesPath, `${pageName}.tsx`);
|
|
176140
176337
|
if (!existsSync20(indexPath)) {
|
|
176141
176338
|
return;
|
|
176142
176339
|
}
|
|
@@ -176148,13 +176345,13 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
176148
176345
|
return;
|
|
176149
176346
|
}
|
|
176150
176347
|
const pageName = basename10(dep, ".tsx");
|
|
176151
|
-
const indexPath =
|
|
176348
|
+
const indexPath = resolve28(reactIndexesPath, `${pageName}.tsx`);
|
|
176152
176349
|
if (existsSync20(indexPath) && !reactEntries.includes(indexPath)) {
|
|
176153
176350
|
reactEntries.push(indexPath);
|
|
176154
176351
|
}
|
|
176155
176352
|
});
|
|
176156
176353
|
}, resolveReactEntryForFile = (state, file4, pagesPathResolved, reactIndexesPath, reactEntries) => {
|
|
176157
|
-
const normalized =
|
|
176354
|
+
const normalized = resolve28(file4);
|
|
176158
176355
|
if (!normalized.startsWith(pagesPathResolved)) {
|
|
176159
176356
|
resolveReactEntriesFromDeps(state, normalized, pagesPathResolved, reactIndexesPath, reactEntries);
|
|
176160
176357
|
return;
|
|
@@ -176165,7 +176362,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
176165
176362
|
}
|
|
176166
176363
|
}, collectReactEntries = (state, filesToRebuild, reactPagesPath, reactIndexesPath) => {
|
|
176167
176364
|
const reactEntries = [];
|
|
176168
|
-
const pagesPathResolved =
|
|
176365
|
+
const pagesPathResolved = resolve28(reactPagesPath);
|
|
176169
176366
|
filesToRebuild.forEach((file4) => {
|
|
176170
176367
|
resolveReactEntryForFile(state, file4, pagesPathResolved, reactIndexesPath, reactEntries);
|
|
176171
176368
|
});
|
|
@@ -176176,7 +176373,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
176176
176373
|
const { getDevVendorPaths: getDevVendorPaths2 } = await Promise.resolve().then(() => exports_devVendorPaths);
|
|
176177
176374
|
const { rewriteReactImports: rewriteReactImports2 } = await Promise.resolve().then(() => (init_rewriteReactImports(), exports_rewriteReactImports));
|
|
176178
176375
|
const clientRoot = await computeClientRoot(state.resolvedPaths);
|
|
176179
|
-
const refreshEntry =
|
|
176376
|
+
const refreshEntry = resolve28(reactIndexesPath, "_refresh.tsx");
|
|
176180
176377
|
if (!reactEntries.includes(refreshEntry)) {
|
|
176181
176378
|
reactEntries.push(refreshEntry);
|
|
176182
176379
|
}
|
|
@@ -176188,7 +176385,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
176188
176385
|
setDevVendorPaths2(vendorPaths);
|
|
176189
176386
|
}
|
|
176190
176387
|
const { rmSync: rmSync3 } = await import("fs");
|
|
176191
|
-
rmSync3(
|
|
176388
|
+
rmSync3(resolve28(buildDir, "react", "indexes"), {
|
|
176192
176389
|
force: true,
|
|
176193
176390
|
recursive: true
|
|
176194
176391
|
});
|
|
@@ -176217,7 +176414,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
176217
176414
|
}, getModuleUrl = async (pageFile) => {
|
|
176218
176415
|
const { invalidateModule: invalidateModule2, warmCache: warmCache2, SRC_URL_PREFIX: SRC_URL_PREFIX2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
176219
176416
|
invalidateModule2(pageFile);
|
|
176220
|
-
const rel =
|
|
176417
|
+
const rel = relative12(process.cwd(), pageFile).replace(/\\/g, "/");
|
|
176221
176418
|
const url = `${SRC_URL_PREFIX2}${rel}`;
|
|
176222
176419
|
warmCache2(url);
|
|
176223
176420
|
return url;
|
|
@@ -176226,11 +176423,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
176226
176423
|
if (isComponentFile2)
|
|
176227
176424
|
return primaryFile;
|
|
176228
176425
|
const { findNearestComponent: findNearestComponent2 } = await Promise.resolve().then(() => (init_transformCache(), exports_transformCache));
|
|
176229
|
-
const nearest = findNearestComponent2(
|
|
176426
|
+
const nearest = findNearestComponent2(resolve28(primaryFile));
|
|
176230
176427
|
return nearest ?? primaryFile;
|
|
176231
176428
|
}, handleReactModuleServerPath = async (state, reactFiles, startTime, onRebuildComplete) => {
|
|
176232
176429
|
for (const file4 of reactFiles) {
|
|
176233
|
-
state.fileHashes.set(
|
|
176430
|
+
state.fileHashes.set(resolve28(file4), computeFileHash(file4));
|
|
176234
176431
|
}
|
|
176235
176432
|
invalidateReactSsrCache();
|
|
176236
176433
|
const primaryFile = reactFiles.find((file4) => !file4.replace(/\\/g, "/").includes("/pages/")) ?? reactFiles[0];
|
|
@@ -176249,7 +176446,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
176249
176446
|
const pageModuleUrl = await getReactModuleUrl(broadcastTarget);
|
|
176250
176447
|
if (pageModuleUrl) {
|
|
176251
176448
|
const serverDuration = Date.now() - startTime;
|
|
176252
|
-
state.lastHmrPath =
|
|
176449
|
+
state.lastHmrPath = relative12(process.cwd(), primaryFile).replace(/\\/g, "/");
|
|
176253
176450
|
state.lastHmrFramework = "react";
|
|
176254
176451
|
broadcastToClients(state, {
|
|
176255
176452
|
data: {
|
|
@@ -176272,8 +176469,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
176272
176469
|
return state.manifest;
|
|
176273
176470
|
}, handleReactFastPath = async (state, config, filesToRebuild, startTime, onRebuildComplete) => {
|
|
176274
176471
|
const reactDir = config.reactDirectory ?? "";
|
|
176275
|
-
const reactPagesPath =
|
|
176276
|
-
const reactIndexesPath =
|
|
176472
|
+
const reactPagesPath = resolve28(reactDir, "pages");
|
|
176473
|
+
const reactIndexesPath = resolve28(reactDir, "generated", "indexes");
|
|
176277
176474
|
const { buildDir } = state.resolvedPaths;
|
|
176278
176475
|
const reactFiles = filesToRebuild.filter((file4) => detectFramework(file4, state.resolvedPaths) === "react");
|
|
176279
176476
|
if (reactFiles.length > 0) {
|
|
@@ -176285,7 +176482,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
176285
176482
|
if (reactEntries.length > 0) {
|
|
176286
176483
|
await bundleReactClient(state, reactEntries, reactIndexesPath, buildDir);
|
|
176287
176484
|
}
|
|
176288
|
-
await rm8(
|
|
176485
|
+
await rm8(resolve28(reactDir, "generated"), { force: true, recursive: true });
|
|
176289
176486
|
const { manifest } = state;
|
|
176290
176487
|
const duration = Date.now() - startTime;
|
|
176291
176488
|
const reactPageFiles = reactFiles.filter((file4) => file4.replace(/\\/g, "/").includes("/pages/"));
|
|
@@ -176337,7 +176534,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
176337
176534
|
});
|
|
176338
176535
|
}, handleSvelteModuleServerPath = async (state, svelteFiles, startTime, onRebuildComplete) => {
|
|
176339
176536
|
for (const file4 of svelteFiles) {
|
|
176340
|
-
state.fileHashes.set(
|
|
176537
|
+
state.fileHashes.set(resolve28(file4), computeFileHash(file4));
|
|
176341
176538
|
}
|
|
176342
176539
|
invalidateSvelteSsrCache();
|
|
176343
176540
|
const serverDuration = Date.now() - startTime;
|
|
@@ -176363,8 +176560,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
176363
176560
|
const { svelteServerPaths, svelteIndexPaths, svelteClientPaths } = await compileSvelte2(svelteFiles, svelteDir, new Map, true);
|
|
176364
176561
|
const serverEntries = [...svelteServerPaths];
|
|
176365
176562
|
const clientEntries = [...svelteIndexPaths, ...svelteClientPaths];
|
|
176366
|
-
const serverRoot =
|
|
176367
|
-
const serverOutDir =
|
|
176563
|
+
const serverRoot = resolve28(svelteDir, "generated", "server");
|
|
176564
|
+
const serverOutDir = resolve28(buildDir, basename10(svelteDir));
|
|
176368
176565
|
const [serverResult, clientResult] = await Promise.all([
|
|
176369
176566
|
serverEntries.length > 0 ? bunBuild7({
|
|
176370
176567
|
entrypoints: serverEntries,
|
|
@@ -176389,7 +176586,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
176389
176586
|
handleServerManifestUpdate(state, serverResult);
|
|
176390
176587
|
await handleClientManifestUpdate(state, clientResult, buildDir);
|
|
176391
176588
|
}
|
|
176392
|
-
await rm8(
|
|
176589
|
+
await rm8(resolve28(svelteDir, "generated"), {
|
|
176393
176590
|
force: true,
|
|
176394
176591
|
recursive: true
|
|
176395
176592
|
});
|
|
@@ -176452,7 +176649,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
176452
176649
|
});
|
|
176453
176650
|
}, handleVueModuleServerPath = async (state, vueFiles, nonVueFiles, startTime, onRebuildComplete) => {
|
|
176454
176651
|
for (const file4 of [...vueFiles, ...nonVueFiles]) {
|
|
176455
|
-
state.fileHashes.set(
|
|
176652
|
+
state.fileHashes.set(resolve28(file4), computeFileHash(file4));
|
|
176456
176653
|
}
|
|
176457
176654
|
invalidateVueSsrCache();
|
|
176458
176655
|
await invalidateNonVueModules(nonVueFiles);
|
|
@@ -176561,10 +176758,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
176561
176758
|
}, computeOutputPagesDir = (state, config, framework) => {
|
|
176562
176759
|
const isSingle = !config.reactDirectory && !config.svelteDirectory && !config.vueDirectory && (framework === "html" ? !config.htmxDirectory : !config.htmlDirectory);
|
|
176563
176760
|
if (isSingle) {
|
|
176564
|
-
return
|
|
176761
|
+
return resolve28(state.resolvedPaths.buildDir, "pages");
|
|
176565
176762
|
}
|
|
176566
176763
|
const dirName = framework === "html" ? basename10(config.htmlDirectory ?? "html") : basename10(config.htmxDirectory ?? "htmx");
|
|
176567
|
-
return
|
|
176764
|
+
return resolve28(state.resolvedPaths.buildDir, dirName, "pages");
|
|
176568
176765
|
}, processHtmlPageUpdate = async (state, pageFile, builtHtmlPagePath, manifest, duration) => {
|
|
176569
176766
|
try {
|
|
176570
176767
|
const { handleHTMLUpdate: handleHTMLUpdate2 } = await Promise.resolve().then(() => (init_simpleHTMLHMR(), exports_simpleHTMLHMR));
|
|
@@ -176600,7 +176797,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
176600
176797
|
const outputHtmlPages = computeOutputPagesDir(state, config, "html");
|
|
176601
176798
|
for (const pageFile of htmlPageFiles) {
|
|
176602
176799
|
const htmlPageName = basename10(pageFile);
|
|
176603
|
-
const builtHtmlPagePath =
|
|
176800
|
+
const builtHtmlPagePath = resolve28(outputHtmlPages, htmlPageName);
|
|
176604
176801
|
await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration);
|
|
176605
176802
|
}
|
|
176606
176803
|
}, handleVueCssOnlyUpdate = (state, vueCssFiles, manifest, duration) => {
|
|
@@ -176661,11 +176858,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
176661
176858
|
const baseName = fileName.replace(/\.vue$/, "");
|
|
176662
176859
|
const pascalName = toPascal(baseName);
|
|
176663
176860
|
const vueRoot = config.vueDirectory;
|
|
176664
|
-
const hmrId = vueRoot ?
|
|
176861
|
+
const hmrId = vueRoot ? relative12(vueRoot, vuePagePath).replace(/\\/g, "/").replace(/\.vue$/, "") : baseName;
|
|
176665
176862
|
const cssKey = `${pascalName}CSS`;
|
|
176666
176863
|
const cssUrl = manifest[cssKey] || null;
|
|
176667
176864
|
const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
|
|
176668
|
-
const hmrMeta = vueHmrMetadata2.get(
|
|
176865
|
+
const hmrMeta = vueHmrMetadata2.get(resolve28(vuePagePath));
|
|
176669
176866
|
const changeType = hmrMeta?.changeType ?? "full";
|
|
176670
176867
|
if (changeType === "style-only") {
|
|
176671
176868
|
broadcastVueStyleOnly(state, vuePagePath, baseName, cssUrl, hmrId, manifest, duration);
|
|
@@ -176899,7 +177096,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
176899
177096
|
const outputHtmxPages = computeOutputPagesDir(state, config, "htmx");
|
|
176900
177097
|
for (const htmxPageFile of htmxPageFiles) {
|
|
176901
177098
|
const htmxPageName = basename10(htmxPageFile);
|
|
176902
|
-
const builtHtmxPagePath =
|
|
177099
|
+
const builtHtmxPagePath = resolve28(outputHtmxPages, htmxPageName);
|
|
176903
177100
|
await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration);
|
|
176904
177101
|
}
|
|
176905
177102
|
}, collectUpdatedModulePaths = (allModuleUpdates) => {
|
|
@@ -177008,7 +177205,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
177008
177205
|
html = html.slice(0, bodyClose.index) + hmrScript + html.slice(bodyClose.index);
|
|
177009
177206
|
writeFs(destPath, html);
|
|
177010
177207
|
}, processMarkupFileFastPath = async (state, sourceFile, outputDir, framework, startTime, updateAssetPaths2, handleUpdate, readFs, writeFs) => {
|
|
177011
|
-
const destPath =
|
|
177208
|
+
const destPath = resolve28(outputDir, basename10(sourceFile));
|
|
177012
177209
|
const hmrScript = extractHmrScript(destPath, readFs);
|
|
177013
177210
|
const source = await Bun.file(sourceFile).text();
|
|
177014
177211
|
await Bun.write(destPath, source);
|
|
@@ -177235,7 +177432,7 @@ __export(exports_buildDepVendor, {
|
|
|
177235
177432
|
buildDepVendor: () => buildDepVendor
|
|
177236
177433
|
});
|
|
177237
177434
|
import { mkdirSync as mkdirSync11 } from "fs";
|
|
177238
|
-
import { join as
|
|
177435
|
+
import { join as join21 } from "path";
|
|
177239
177436
|
import { rm as rm9 } from "fs/promises";
|
|
177240
177437
|
var {build: bunBuild7, Glob: Glob8 } = globalThis.Bun;
|
|
177241
177438
|
var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g, "").replace(/-/g, "_"), isResolvable3 = (specifier) => {
|
|
@@ -177245,11 +177442,11 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
177245
177442
|
} catch {
|
|
177246
177443
|
return false;
|
|
177247
177444
|
}
|
|
177248
|
-
}, isBareSpecifier = (spec) => !spec.startsWith(".") && !spec.startsWith("/") && !spec.startsWith("@src/"), FRAMEWORK_SPECIFIERS, isSkippedFile = (file4) => file4.includes("node_modules") || file4.includes("/build/") || file4.includes("/dist/") || file4.includes("/indexes/"), isDepSpecifier = (path) => isBareSpecifier(path) && !FRAMEWORK_SPECIFIERS.has(path), readFileSpecifiers = async (file4,
|
|
177445
|
+
}, isBareSpecifier = (spec) => !spec.startsWith(".") && !spec.startsWith("/") && !spec.startsWith("@src/"), FRAMEWORK_SPECIFIERS, isSkippedFile = (file4) => file4.includes("node_modules") || file4.includes("/build/") || file4.includes("/dist/") || file4.includes("/indexes/"), isDepSpecifier = (path) => isBareSpecifier(path) && !FRAMEWORK_SPECIFIERS.has(path), readFileSpecifiers = async (file4, transpiler5) => {
|
|
177249
177446
|
const empty = [];
|
|
177250
177447
|
try {
|
|
177251
177448
|
const content = await Bun.file(file4).text();
|
|
177252
|
-
return
|
|
177449
|
+
return transpiler5.scanImports(content).map((imp) => imp.path).filter(isDepSpecifier);
|
|
177253
177450
|
} catch {
|
|
177254
177451
|
return empty;
|
|
177255
177452
|
}
|
|
@@ -177262,16 +177459,16 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
177262
177459
|
} catch {
|
|
177263
177460
|
return empty;
|
|
177264
177461
|
}
|
|
177265
|
-
}, collectDirSpecifiers = async (dir,
|
|
177462
|
+
}, collectDirSpecifiers = async (dir, transpiler5, specifiers) => {
|
|
177266
177463
|
const files = await scanDirFiles(dir);
|
|
177267
|
-
const results = await Promise.all(files.map((file4) => readFileSpecifiers(file4,
|
|
177464
|
+
const results = await Promise.all(files.map((file4) => readFileSpecifiers(file4, transpiler5)));
|
|
177268
177465
|
for (const spec of results.flat()) {
|
|
177269
177466
|
specifiers.add(spec);
|
|
177270
177467
|
}
|
|
177271
177468
|
}, scanBareImports = async (directories) => {
|
|
177272
177469
|
const specifiers = new Set;
|
|
177273
|
-
const
|
|
177274
|
-
await Promise.all(directories.map((dir) => collectDirSpecifiers(dir,
|
|
177470
|
+
const transpiler5 = new Bun.Transpiler({ loader: "tsx" });
|
|
177471
|
+
await Promise.all(directories.map((dir) => collectDirSpecifiers(dir, transpiler5, specifiers)));
|
|
177275
177472
|
return Array.from(specifiers).filter(isResolvable3);
|
|
177276
177473
|
}, generateEntrySource2 = (specifier) => `export * from '${specifier}';
|
|
177277
177474
|
`, rewriteVendorFiles = async (vendorDir) => {
|
|
@@ -177285,7 +177482,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
177285
177482
|
}, content);
|
|
177286
177483
|
const files = readdirSync2(vendorDir).filter((f) => f.endsWith(".js"));
|
|
177287
177484
|
for (const file4 of files) {
|
|
177288
|
-
const filePath =
|
|
177485
|
+
const filePath = join21(vendorDir, file4);
|
|
177289
177486
|
const original = readFileSync12(filePath, "utf-8");
|
|
177290
177487
|
const rewritten = rewriteContent(original);
|
|
177291
177488
|
if (rewritten !== original)
|
|
@@ -177295,13 +177492,13 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
177295
177492
|
const specifiers = await scanBareImports(directories);
|
|
177296
177493
|
if (specifiers.length === 0)
|
|
177297
177494
|
return {};
|
|
177298
|
-
const vendorDir =
|
|
177495
|
+
const vendorDir = join21(buildDir, "vendor");
|
|
177299
177496
|
mkdirSync11(vendorDir, { recursive: true });
|
|
177300
|
-
const tmpDir =
|
|
177497
|
+
const tmpDir = join21(buildDir, "_dep_vendor_tmp");
|
|
177301
177498
|
mkdirSync11(tmpDir, { recursive: true });
|
|
177302
177499
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
177303
177500
|
const safeName = toSafeFileName5(specifier);
|
|
177304
|
-
const entryPath =
|
|
177501
|
+
const entryPath = join21(tmpDir, `${safeName}.ts`);
|
|
177305
177502
|
const source = await generateEntrySource2(specifier);
|
|
177306
177503
|
await Bun.write(entryPath, source);
|
|
177307
177504
|
return entryPath;
|
|
@@ -177371,7 +177568,7 @@ __export(exports_devBuild, {
|
|
|
177371
177568
|
});
|
|
177372
177569
|
import { readdir as readdir3 } from "fs/promises";
|
|
177373
177570
|
import { statSync as statSync3 } from "fs";
|
|
177374
|
-
import { resolve as
|
|
177571
|
+
import { resolve as resolve29 } from "path";
|
|
177375
177572
|
var FRAMEWORK_DIR_KEYS, parseDirectoryConfig = (source) => {
|
|
177376
177573
|
const config = {};
|
|
177377
177574
|
const dirPattern = /(\w+Directory)\s*:\s*['"]([^'"]+)['"]/g;
|
|
@@ -177384,7 +177581,7 @@ var FRAMEWORK_DIR_KEYS, parseDirectoryConfig = (source) => {
|
|
|
177384
177581
|
return Object.keys(config).length > 0 ? config : null;
|
|
177385
177582
|
}, reloadConfig = async () => {
|
|
177386
177583
|
try {
|
|
177387
|
-
const configPath2 =
|
|
177584
|
+
const configPath2 = resolve29(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
177388
177585
|
const source = await Bun.file(configPath2).text();
|
|
177389
177586
|
return parseDirectoryConfig(source);
|
|
177390
177587
|
} catch {
|
|
@@ -177464,7 +177661,7 @@ var FRAMEWORK_DIR_KEYS, parseDirectoryConfig = (source) => {
|
|
|
177464
177661
|
state.fileChangeQueue.clear();
|
|
177465
177662
|
}
|
|
177466
177663
|
}, handleCachedReload = async () => {
|
|
177467
|
-
const serverMtime = statSync3(
|
|
177664
|
+
const serverMtime = statSync3(resolve29(Bun.main)).mtimeMs;
|
|
177468
177665
|
const lastMtime = globalThis.__hmrServerMtime;
|
|
177469
177666
|
globalThis.__hmrServerMtime = serverMtime;
|
|
177470
177667
|
const cached = globalThis.__hmrDevResult;
|
|
@@ -177498,8 +177695,8 @@ var FRAMEWORK_DIR_KEYS, parseDirectoryConfig = (source) => {
|
|
|
177498
177695
|
return true;
|
|
177499
177696
|
}, resolveAbsoluteVersion2 = async () => {
|
|
177500
177697
|
const candidates = [
|
|
177501
|
-
|
|
177502
|
-
|
|
177698
|
+
resolve29(import.meta.dir, "..", "..", "package.json"),
|
|
177699
|
+
resolve29(import.meta.dir, "..", "package.json")
|
|
177503
177700
|
];
|
|
177504
177701
|
for (const candidate of candidates) {
|
|
177505
177702
|
const found = await tryReadPackageVersion(candidate);
|
|
@@ -177512,7 +177709,7 @@ var FRAMEWORK_DIR_KEYS, parseDirectoryConfig = (source) => {
|
|
|
177512
177709
|
const entries = await readdir3(vendorDir).catch(() => emptyStringArray);
|
|
177513
177710
|
await Promise.all(entries.map(async (entry) => {
|
|
177514
177711
|
const webPath = `/${framework}/vendor/${entry}`;
|
|
177515
|
-
const bytes = await Bun.file(
|
|
177712
|
+
const bytes = await Bun.file(resolve29(vendorDir, entry)).bytes();
|
|
177516
177713
|
assetStore.set(webPath, bytes);
|
|
177517
177714
|
}));
|
|
177518
177715
|
}, devBuild = async (config) => {
|
|
@@ -177554,7 +177751,7 @@ var FRAMEWORK_DIR_KEYS, parseDirectoryConfig = (source) => {
|
|
|
177554
177751
|
await populateAssetStore(state.assetStore, manifest, state.resolvedPaths.buildDir);
|
|
177555
177752
|
cleanStaleAssets(state.assetStore, manifest, state.resolvedPaths.buildDir);
|
|
177556
177753
|
const buildReactVendorTask = config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir).then(async () => {
|
|
177557
|
-
const vendorDir =
|
|
177754
|
+
const vendorDir = resolve29(state.resolvedPaths.buildDir, "react", "vendor");
|
|
177558
177755
|
await loadVendorFiles(state.assetStore, vendorDir, "react");
|
|
177559
177756
|
if (!globalThis.__reactModuleRef) {
|
|
177560
177757
|
globalThis.__reactModuleRef = await import("react");
|
|
@@ -177562,17 +177759,17 @@ var FRAMEWORK_DIR_KEYS, parseDirectoryConfig = (source) => {
|
|
|
177562
177759
|
return true;
|
|
177563
177760
|
}) : undefined;
|
|
177564
177761
|
const buildAngularVendorTask = config.angularDirectory ? buildAngularVendor(state.resolvedPaths.buildDir).then(async () => {
|
|
177565
|
-
const vendorDir =
|
|
177762
|
+
const vendorDir = resolve29(state.resolvedPaths.buildDir, "angular", "vendor");
|
|
177566
177763
|
await loadVendorFiles(state.assetStore, vendorDir, "angular");
|
|
177567
177764
|
return true;
|
|
177568
177765
|
}) : undefined;
|
|
177569
177766
|
const buildSvelteVendorTask = config.svelteDirectory ? buildSvelteVendor(state.resolvedPaths.buildDir).then(async () => {
|
|
177570
|
-
const vendorDir =
|
|
177767
|
+
const vendorDir = resolve29(state.resolvedPaths.buildDir, "svelte", "vendor");
|
|
177571
177768
|
await loadVendorFiles(state.assetStore, vendorDir, "svelte");
|
|
177572
177769
|
return true;
|
|
177573
177770
|
}) : undefined;
|
|
177574
177771
|
const buildVueVendorTask = config.vueDirectory ? buildVueVendor(state.resolvedPaths.buildDir).then(async () => {
|
|
177575
|
-
const vendorDir =
|
|
177772
|
+
const vendorDir = resolve29(state.resolvedPaths.buildDir, "vue", "vendor");
|
|
177576
177773
|
await loadVendorFiles(state.assetStore, vendorDir, "vue");
|
|
177577
177774
|
return true;
|
|
177578
177775
|
}) : undefined;
|
|
@@ -177586,7 +177783,7 @@ var FRAMEWORK_DIR_KEYS, parseDirectoryConfig = (source) => {
|
|
|
177586
177783
|
config.htmxDirectory
|
|
177587
177784
|
].filter((dir) => Boolean(dir));
|
|
177588
177785
|
const buildDepVendorTask = buildDepVendor2(state.resolvedPaths.buildDir, sourceDirs).then(async (depPaths) => {
|
|
177589
|
-
const vendorDir =
|
|
177786
|
+
const vendorDir = resolve29(state.resolvedPaths.buildDir, "vendor");
|
|
177590
177787
|
await loadVendorFiles(state.assetStore, vendorDir, "vendor");
|
|
177591
177788
|
globalThis.__depVendorPaths = depPaths;
|
|
177592
177789
|
return true;
|
|
@@ -177617,7 +177814,7 @@ var FRAMEWORK_DIR_KEYS, parseDirectoryConfig = (source) => {
|
|
|
177617
177814
|
manifest
|
|
177618
177815
|
};
|
|
177619
177816
|
globalThis.__hmrDevResult = result;
|
|
177620
|
-
globalThis.__hmrServerMtime = statSync3(
|
|
177817
|
+
globalThis.__hmrServerMtime = statSync3(resolve29(Bun.main)).mtimeMs;
|
|
177621
177818
|
return result;
|
|
177622
177819
|
};
|
|
177623
177820
|
var init_devBuild = __esm(() => {
|
|
@@ -177760,7 +177957,7 @@ __export(exports_imageOptimizer, {
|
|
|
177760
177957
|
imageOptimizer: () => imageOptimizer
|
|
177761
177958
|
});
|
|
177762
177959
|
import { existsSync as existsSync21 } from "fs";
|
|
177763
|
-
import { resolve as
|
|
177960
|
+
import { resolve as resolve30 } from "path";
|
|
177764
177961
|
import { Elysia } from "elysia";
|
|
177765
177962
|
var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avifInProgress, safeResolve = (path, baseDir) => {
|
|
177766
177963
|
try {
|
|
@@ -177773,7 +177970,7 @@ var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avi
|
|
|
177773
177970
|
}
|
|
177774
177971
|
}, resolveLocalImage = (url, buildDir) => {
|
|
177775
177972
|
const cleanPath = url.startsWith("/") ? url.slice(1) : url;
|
|
177776
|
-
return safeResolve(cleanPath, buildDir) ?? safeResolve(cleanPath,
|
|
177973
|
+
return safeResolve(cleanPath, buildDir) ?? safeResolve(cleanPath, resolve30(process.cwd()));
|
|
177777
177974
|
}, parseQueryParams = (query, allowedSizes, defaultQuality) => {
|
|
177778
177975
|
const url = typeof query["url"] === "string" ? query["url"] : undefined;
|
|
177779
177976
|
const wParam = typeof query["w"] === "string" ? query["w"] : undefined;
|
|
@@ -178064,7 +178261,7 @@ __export(exports_prerender, {
|
|
|
178064
178261
|
PRERENDER_BYPASS_HEADER: () => PRERENDER_BYPASS_HEADER
|
|
178065
178262
|
});
|
|
178066
178263
|
import { mkdirSync as mkdirSync12, readFileSync as readFileSync12 } from "fs";
|
|
178067
|
-
import { join as
|
|
178264
|
+
import { join as join22 } from "path";
|
|
178068
178265
|
var MAX_STARTUP_ATTEMPTS = 50, STARTUP_POLL_INTERVAL_MS = 100, PRERENDER_BYPASS_HEADER = "X-Absolute-Prerender-Bypass", routeToFilename = (route) => route === "/" ? "index.html" : `${route.slice(1).replace(/\//g, "-")}.html`, writeTimestamp = async (htmlPath) => {
|
|
178069
178266
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
178070
178267
|
await Bun.write(metaPath, String(Date.now()));
|
|
@@ -178120,7 +178317,7 @@ var MAX_STARTUP_ATTEMPTS = 50, STARTUP_POLL_INTERVAL_MS = 100, PRERENDER_BYPASS_
|
|
|
178120
178317
|
return false;
|
|
178121
178318
|
const html = await res.text();
|
|
178122
178319
|
const fileName = routeToFilename(route);
|
|
178123
|
-
const filePath =
|
|
178320
|
+
const filePath = join22(prerenderDir, fileName);
|
|
178124
178321
|
await Bun.write(filePath, html);
|
|
178125
178322
|
await writeTimestamp(filePath);
|
|
178126
178323
|
return true;
|
|
@@ -178139,13 +178336,13 @@ var MAX_STARTUP_ATTEMPTS = 50, STARTUP_POLL_INTERVAL_MS = 100, PRERENDER_BYPASS_
|
|
|
178139
178336
|
}
|
|
178140
178337
|
const html = await res.text();
|
|
178141
178338
|
const fileName = routeToFilename(route);
|
|
178142
|
-
const filePath =
|
|
178339
|
+
const filePath = join22(prerenderDir, fileName);
|
|
178143
178340
|
await Bun.write(filePath, html);
|
|
178144
178341
|
await writeTimestamp(filePath);
|
|
178145
178342
|
result.routes.set(route, filePath);
|
|
178146
178343
|
log2?.(` Pre-rendered ${route} \u2192 ${fileName} (${html.length} bytes)`);
|
|
178147
178344
|
}, prerender = async (port, outDir, staticConfig, log2) => {
|
|
178148
|
-
const prerenderDir =
|
|
178345
|
+
const prerenderDir = join22(outDir, "_prerendered");
|
|
178149
178346
|
mkdirSync12(prerenderDir, { recursive: true });
|
|
178150
178347
|
const baseUrl = `http://localhost:${port}`;
|
|
178151
178348
|
let routes;
|
|
@@ -207416,7 +207613,7 @@ __export(exports_devCert, {
|
|
|
207416
207613
|
});
|
|
207417
207614
|
import { existsSync as existsSync23, mkdirSync as mkdirSync13, readFileSync as readFileSync14, rmSync as rmSync3 } from "fs";
|
|
207418
207615
|
import { platform as platform3 } from "os";
|
|
207419
|
-
import { join as
|
|
207616
|
+
import { join as join24 } from "path";
|
|
207420
207617
|
var CERT_DIR, CERT_PATH, KEY_PATH, CERT_VALIDITY_DAYS = 365, devLog = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[36m[dev]\x1B[0m ${msg}`), devWarn = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[33m[dev]\x1B[0m \x1B[33m${msg}\x1B[0m`), certFilesExist = () => existsSync23(CERT_PATH) && existsSync23(KEY_PATH), isCertExpired = () => {
|
|
207421
207618
|
try {
|
|
207422
207619
|
const certPem = readFileSync14(CERT_PATH, "utf-8");
|
|
@@ -207622,9 +207819,9 @@ var CERT_DIR, CERT_PATH, KEY_PATH, CERT_VALIDITY_DAYS = 365, devLog = (msg) => c
|
|
|
207622
207819
|
return true;
|
|
207623
207820
|
};
|
|
207624
207821
|
var init_devCert = __esm(() => {
|
|
207625
|
-
CERT_DIR =
|
|
207626
|
-
CERT_PATH =
|
|
207627
|
-
KEY_PATH =
|
|
207822
|
+
CERT_DIR = join24(process.cwd(), ".absolutejs");
|
|
207823
|
+
CERT_PATH = join24(CERT_DIR, "cert.pem");
|
|
207824
|
+
KEY_PATH = join24(CERT_DIR, "key.pem");
|
|
207628
207825
|
});
|
|
207629
207826
|
// types/client.ts
|
|
207630
207827
|
var hmrState = {
|
|
@@ -207656,7 +207853,7 @@ var handleHTMLPageRequest = (pagePath) => file(pagePath);
|
|
|
207656
207853
|
var handleHTMXPageRequest = (pagePath) => file(pagePath);
|
|
207657
207854
|
// src/core/prepare.ts
|
|
207658
207855
|
import { existsSync as existsSync22, readdirSync as readdirSync2, readFileSync as readFileSync13 } from "fs";
|
|
207659
|
-
import { basename as basename11, join as
|
|
207856
|
+
import { basename as basename11, join as join23, relative as relative13, resolve as resolve31 } from "path";
|
|
207660
207857
|
|
|
207661
207858
|
// src/utils/loadConfig.ts
|
|
207662
207859
|
import { resolve } from "path";
|
|
@@ -207700,7 +207897,7 @@ var collectPrewarmFiles = async (prewarmDirs) => {
|
|
|
207700
207897
|
for (const { dir, pattern } of prewarmDirs) {
|
|
207701
207898
|
const glob = new Glob9(pattern);
|
|
207702
207899
|
const matches = [
|
|
207703
|
-
...glob.scanSync({ absolute: true, cwd:
|
|
207900
|
+
...glob.scanSync({ absolute: true, cwd: resolve31(dir) })
|
|
207704
207901
|
];
|
|
207705
207902
|
files.push(...matches);
|
|
207706
207903
|
}
|
|
@@ -207711,7 +207908,7 @@ var warmPrewarmDirs = async (prewarmDirs, warmCache2, SRC_URL_PREFIX2) => {
|
|
|
207711
207908
|
for (const file4 of files) {
|
|
207712
207909
|
if (file4.includes("/node_modules/"))
|
|
207713
207910
|
continue;
|
|
207714
|
-
const rel =
|
|
207911
|
+
const rel = relative13(process.cwd(), file4).replace(/\\/g, "/");
|
|
207715
207912
|
warmCache2(`${SRC_URL_PREFIX2}${rel}`);
|
|
207716
207913
|
}
|
|
207717
207914
|
};
|
|
@@ -207736,10 +207933,10 @@ var patchManifestIndexes = (manifest, devIndexDir, SRC_URL_PREFIX2) => {
|
|
|
207736
207933
|
const fileName = resolveDevIndexFileName(manifest[key], baseName);
|
|
207737
207934
|
if (!fileName)
|
|
207738
207935
|
continue;
|
|
207739
|
-
const srcPath =
|
|
207936
|
+
const srcPath = resolve31(devIndexDir, fileName);
|
|
207740
207937
|
if (!existsSync22(srcPath))
|
|
207741
207938
|
continue;
|
|
207742
|
-
const rel =
|
|
207939
|
+
const rel = relative13(process.cwd(), srcPath).replace(/\\/g, "/");
|
|
207743
207940
|
manifest[key] = `${SRC_URL_PREFIX2}${rel}`;
|
|
207744
207941
|
}
|
|
207745
207942
|
};
|
|
@@ -207780,7 +207977,7 @@ var prepareDev = async (config, buildDir) => {
|
|
|
207780
207977
|
};
|
|
207781
207978
|
}
|
|
207782
207979
|
const hmrPlugin = hmr2(result.hmrState, result.manifest, moduleHandler);
|
|
207783
|
-
const devIndexDir =
|
|
207980
|
+
const devIndexDir = resolve31(buildDir, "_src_indexes");
|
|
207784
207981
|
patchManifestIndexes(result.manifest, devIndexDir, SRC_URL_PREFIX2);
|
|
207785
207982
|
if (result.conventions)
|
|
207786
207983
|
setConventions(result.conventions);
|
|
@@ -207808,7 +208005,7 @@ var loadPrerenderMap = (prerenderDir) => {
|
|
|
207808
208005
|
continue;
|
|
207809
208006
|
const name = basename11(entry, ".html");
|
|
207810
208007
|
const route = name === "index" ? "/" : `/${name}`;
|
|
207811
|
-
map.set(route,
|
|
208008
|
+
map.set(route, join23(prerenderDir, entry));
|
|
207812
208009
|
}
|
|
207813
208010
|
return map;
|
|
207814
208011
|
};
|
|
@@ -207830,18 +208027,18 @@ var prepare = async (configOrPath) => {
|
|
|
207830
208027
|
const config = await loadConfig(configOrPath);
|
|
207831
208028
|
const nodeEnv = process.env["NODE_ENV"];
|
|
207832
208029
|
const isDev3 = nodeEnv === "development";
|
|
207833
|
-
const buildDir =
|
|
208030
|
+
const buildDir = resolve31(isDev3 ? config.buildDirectory ?? "build" : process.env.ABSOLUTE_BUILD_DIR ?? config.buildDirectory ?? "build");
|
|
207834
208031
|
if (isDev3)
|
|
207835
208032
|
return prepareDev(config, buildDir);
|
|
207836
208033
|
const manifest = JSON.parse(readFileSync13(`${buildDir}/manifest.json`, "utf-8"));
|
|
207837
|
-
const conventionsPath =
|
|
208034
|
+
const conventionsPath = join23(buildDir, "conventions.json");
|
|
207838
208035
|
if (existsSync22(conventionsPath)) {
|
|
207839
208036
|
const conventions2 = JSON.parse(readFileSync13(conventionsPath, "utf-8"));
|
|
207840
208037
|
setConventions(conventions2);
|
|
207841
208038
|
}
|
|
207842
208039
|
const { staticPlugin } = await import("@elysiajs/static");
|
|
207843
208040
|
const staticFiles = staticPlugin({ assets: buildDir, prefix: "" });
|
|
207844
|
-
const prerenderDir =
|
|
208041
|
+
const prerenderDir = join23(buildDir, "_prerendered");
|
|
207845
208042
|
const prerenderMap = loadPrerenderMap(prerenderDir);
|
|
207846
208043
|
if (prerenderMap.size > 0) {
|
|
207847
208044
|
const { Elysia: Elysia2 } = await import("elysia");
|
|
@@ -208403,7 +208600,7 @@ var jsonLd2 = (schema) => {
|
|
|
208403
208600
|
// src/utils/defineEnv.ts
|
|
208404
208601
|
var {env: bunEnv } = globalThis.Bun;
|
|
208405
208602
|
import { existsSync as existsSync24, readFileSync as readFileSync15 } from "fs";
|
|
208406
|
-
import { resolve as
|
|
208603
|
+
import { resolve as resolve32 } from "path";
|
|
208407
208604
|
|
|
208408
208605
|
// node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
|
|
208409
208606
|
var exports_value = {};
|
|
@@ -214438,7 +214635,7 @@ ${lines.join(`
|
|
|
214438
214635
|
};
|
|
214439
214636
|
var checkEnvFileSecurity = (properties) => {
|
|
214440
214637
|
const cwd2 = process.cwd();
|
|
214441
|
-
const envPath =
|
|
214638
|
+
const envPath = resolve32(cwd2, ".env");
|
|
214442
214639
|
if (!existsSync24(envPath))
|
|
214443
214640
|
return;
|
|
214444
214641
|
const sensitiveKeys = Object.keys(properties).filter(isSensitive);
|
|
@@ -214448,7 +214645,7 @@ var checkEnvFileSecurity = (properties) => {
|
|
|
214448
214645
|
const presentKeys = sensitiveKeys.filter((key) => envContent.includes(`${key}=`));
|
|
214449
214646
|
if (presentKeys.length === 0)
|
|
214450
214647
|
return;
|
|
214451
|
-
const gitignorePath =
|
|
214648
|
+
const gitignorePath = resolve32(cwd2, ".gitignore");
|
|
214452
214649
|
if (existsSync24(gitignorePath)) {
|
|
214453
214650
|
const gitignore = readFileSync15(gitignorePath, "utf-8");
|
|
214454
214651
|
if (gitignore.split(`
|
|
@@ -214570,5 +214767,5 @@ export {
|
|
|
214570
214767
|
ANGULAR_INIT_TIMEOUT_MS
|
|
214571
214768
|
};
|
|
214572
214769
|
|
|
214573
|
-
//# debugId=
|
|
214770
|
+
//# debugId=2BB9A97BA5D1D9A264756E2164756E21
|
|
214574
214771
|
//# sourceMappingURL=index.js.map
|