@absolutejs/absolute 0.19.0-beta.931 → 0.19.0-beta.933
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 +285 -136
- package/dist/angular/index.js.map +6 -5
- package/dist/angular/server.js +267 -118
- package/dist/angular/server.js.map +6 -5
- package/dist/build.js +807 -584
- package/dist/build.js.map +17 -16
- package/dist/dev/client/handlers/angularHmrShim.ts +4 -1
- package/dist/dev/client/handlers/angularRemount.ts +2 -2
- package/dist/dev/client/handlers/angularRemountWiring.ts +1 -4
- package/dist/dev/client/vendor/lview/lViewOps.ts +8 -6
- package/dist/index.js +925 -651
- package/dist/index.js.map +21 -19
- package/dist/islands/index.js +105 -2
- package/dist/islands/index.js.map +5 -4
- package/dist/react/index.js +167 -18
- package/dist/react/index.js.map +6 -5
- package/dist/react/server.js +63 -17
- package/dist/react/server.js.map +3 -3
- package/dist/src/core/normalizeIslandProps.d.ts +15 -0
- package/dist/src/core/vueServerModule.d.ts +1 -0
- package/dist/src/utils/defineConvention.d.ts +3 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/vue/Island.browser.d.ts +36 -12
- package/dist/src/vue/Island.d.ts +35 -11
- package/dist/src/vue/pageHandler.d.ts +8 -0
- package/dist/svelte/index.js +167 -18
- package/dist/svelte/index.js.map +6 -5
- package/dist/svelte/server.js +63 -17
- package/dist/svelte/server.js.map +3 -3
- package/dist/types/conventions.d.ts +5 -0
- package/dist/vue/browser.js +57 -4
- package/dist/vue/browser.js.map +5 -4
- package/dist/vue/index.js +234 -24
- package/dist/vue/index.js.map +9 -7
- package/dist/vue/server.js +73 -20
- package/dist/vue/server.js.map +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7553,6 +7553,100 @@ var init_svelteServerModule = __esm(() => {
|
|
|
7553
7553
|
});
|
|
7554
7554
|
});
|
|
7555
7555
|
|
|
7556
|
+
// src/core/vueServerModule.ts
|
|
7557
|
+
import { mkdir as mkdir3 } from "fs/promises";
|
|
7558
|
+
import { dirname as dirname6, join as join7, relative as relative3, resolve as resolve6 } from "path";
|
|
7559
|
+
var {Transpiler } = globalThis.Bun;
|
|
7560
|
+
var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, transpiler2, ensureRelativeImportPath2 = (from, target) => {
|
|
7561
|
+
const importPath = relative3(dirname6(from), target).replace(/\\/g, "/");
|
|
7562
|
+
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
7563
|
+
}, getCachedModulePath2 = (sourcePath) => {
|
|
7564
|
+
const relativeSourcePath = relative3(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
7565
|
+
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
7566
|
+
return join7(serverCacheRoot2, `${normalizedSourcePath}.server.js`);
|
|
7567
|
+
}, writeIfChanged2 = async (path, content) => {
|
|
7568
|
+
const targetFile = Bun.file(path);
|
|
7569
|
+
if (await targetFile.exists()) {
|
|
7570
|
+
const currentContent = await targetFile.text();
|
|
7571
|
+
if (currentContent === content)
|
|
7572
|
+
return;
|
|
7573
|
+
}
|
|
7574
|
+
await Bun.write(path, content);
|
|
7575
|
+
}, stripExports = (code) => code.replace(/export\s+default/, "const script ="), mergeVueImports = (code) => {
|
|
7576
|
+
const lines = code.split(`
|
|
7577
|
+
`);
|
|
7578
|
+
const specifierSet = new Set;
|
|
7579
|
+
const vueImportRegex = /^import\s+{([^}]+)}\s+from\s+['"]vue['"];?$/;
|
|
7580
|
+
lines.forEach((line) => {
|
|
7581
|
+
const match = line.match(vueImportRegex);
|
|
7582
|
+
if (match?.[1])
|
|
7583
|
+
match[1].split(",").forEach((importSpecifier) => specifierSet.add(importSpecifier.trim()));
|
|
7584
|
+
});
|
|
7585
|
+
const nonVueLines = lines.filter((line) => !vueImportRegex.test(line));
|
|
7586
|
+
return specifierSet.size ? [
|
|
7587
|
+
`import { ${[...specifierSet].join(", ")} } from "vue";`,
|
|
7588
|
+
...nonVueLines
|
|
7589
|
+
].join(`
|
|
7590
|
+
`) : nonVueLines.join(`
|
|
7591
|
+
`);
|
|
7592
|
+
}, extractRelativeVueImports = (sourceCode) => Array.from(sourceCode.matchAll(/import\s+[\s\S]+?['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((importPath) => typeof importPath === "string" && importPath.startsWith(".") && importPath.endsWith(".vue")), compileVueServerModule = async (sourcePath) => {
|
|
7593
|
+
const cachedModulePath = compiledModuleCache2.get(sourcePath);
|
|
7594
|
+
if (cachedModulePath)
|
|
7595
|
+
return cachedModulePath;
|
|
7596
|
+
const compiler = await import("@vue/compiler-sfc");
|
|
7597
|
+
const source = await Bun.file(sourcePath).text();
|
|
7598
|
+
const { descriptor } = compiler.parse(source, { filename: sourcePath });
|
|
7599
|
+
const componentId = Bun.hash(sourcePath).toString(BASE_36_RADIX).slice(0, ISLAND_COMPONENT_ID_LENGTH);
|
|
7600
|
+
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
7601
|
+
const compiledScript = hasScript ? compiler.compileScript(descriptor, {
|
|
7602
|
+
id: componentId,
|
|
7603
|
+
inlineTemplate: false
|
|
7604
|
+
}) : { bindings: {}, content: "export default {};" };
|
|
7605
|
+
const renderCode = descriptor.template ? compiler.compileTemplate({
|
|
7606
|
+
compilerOptions: {
|
|
7607
|
+
bindingMetadata: compiledScript.bindings,
|
|
7608
|
+
expressionPlugins: ["typescript"],
|
|
7609
|
+
prefixIdentifiers: true,
|
|
7610
|
+
isCustomElement: (tag) => tag === "absolute-island"
|
|
7611
|
+
},
|
|
7612
|
+
filename: sourcePath,
|
|
7613
|
+
id: componentId,
|
|
7614
|
+
scoped: descriptor.styles.some((styleBlock) => styleBlock.scoped),
|
|
7615
|
+
source: descriptor.template.content,
|
|
7616
|
+
ssr: true,
|
|
7617
|
+
ssrCssVars: descriptor.cssVars
|
|
7618
|
+
}).code : "const ssrRender = () => {};";
|
|
7619
|
+
const childImportPaths = extractRelativeVueImports(compiledScript.content);
|
|
7620
|
+
const compiledChildren = await Promise.all(childImportPaths.map(async (relativeImport) => ({
|
|
7621
|
+
compiledPath: await compileVueServerModule(resolve6(dirname6(sourcePath), relativeImport)),
|
|
7622
|
+
spec: relativeImport
|
|
7623
|
+
})));
|
|
7624
|
+
const strippedScript = stripExports(compiledScript.content);
|
|
7625
|
+
const transpiledScript = transpiler2.transformSync(strippedScript);
|
|
7626
|
+
const assembled = mergeVueImports([
|
|
7627
|
+
transpiledScript,
|
|
7628
|
+
renderCode,
|
|
7629
|
+
"script.ssrRender = ssrRender;",
|
|
7630
|
+
"export default script;"
|
|
7631
|
+
].join(`
|
|
7632
|
+
`));
|
|
7633
|
+
const compiledModulePath = getCachedModulePath2(sourcePath);
|
|
7634
|
+
let rewritten = assembled;
|
|
7635
|
+
for (const child of compiledChildren) {
|
|
7636
|
+
rewritten = rewritten.replaceAll(child.spec, ensureRelativeImportPath2(compiledModulePath, child.compiledPath));
|
|
7637
|
+
}
|
|
7638
|
+
await mkdir3(dirname6(compiledModulePath), { recursive: true });
|
|
7639
|
+
await writeIfChanged2(compiledModulePath, rewritten);
|
|
7640
|
+
compiledModuleCache2.set(sourcePath, compiledModulePath);
|
|
7641
|
+
return compiledModulePath;
|
|
7642
|
+
};
|
|
7643
|
+
var init_vueServerModule = __esm(() => {
|
|
7644
|
+
init_constants();
|
|
7645
|
+
serverCacheRoot2 = join7(process.cwd(), ".absolutejs", "islands", "vue");
|
|
7646
|
+
compiledModuleCache2 = new Map;
|
|
7647
|
+
transpiler2 = new Transpiler({ loader: "ts", target: "browser" });
|
|
7648
|
+
});
|
|
7649
|
+
|
|
7556
7650
|
// src/core/islandMarkupAttributes.ts
|
|
7557
7651
|
var getIslandMarkerAttributes = (props, islandId) => ({
|
|
7558
7652
|
"data-component": props.component,
|
|
@@ -7588,9 +7682,17 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
|
|
|
7588
7682
|
const loadPromise = loadAndCompileServerBuildComponent(buildReferencePath);
|
|
7589
7683
|
resolvedServerBuildComponentCache.set(buildReferencePath, loadPromise);
|
|
7590
7684
|
return loadPromise;
|
|
7685
|
+
}, resolveRuntimeImportTarget = async (resolvedModulePath) => {
|
|
7686
|
+
if (resolvedModulePath.endsWith(".svelte")) {
|
|
7687
|
+
return compileSvelteServerModule(resolvedModulePath);
|
|
7688
|
+
}
|
|
7689
|
+
if (resolvedModulePath.endsWith(".vue")) {
|
|
7690
|
+
return compileVueServerModule(resolvedModulePath);
|
|
7691
|
+
}
|
|
7692
|
+
return resolvedModulePath;
|
|
7591
7693
|
}, loadServerImportComponent = async (resolvedComponent, exportName) => {
|
|
7592
7694
|
const resolvedModulePath = resolvedComponent.startsWith(".") ? new URL(resolvedComponent, import.meta.url).pathname : resolvedComponent;
|
|
7593
|
-
const importTarget =
|
|
7695
|
+
const importTarget = await resolveRuntimeImportTarget(resolvedModulePath);
|
|
7594
7696
|
const loadedModule = await import(importTarget);
|
|
7595
7697
|
if (exportName && exportName !== "default" && exportName in loadedModule) {
|
|
7596
7698
|
return loadedModule[exportName];
|
|
@@ -7694,6 +7796,7 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
|
|
|
7694
7796
|
var init_renderIslandMarkup = __esm(() => {
|
|
7695
7797
|
init_islandSsr();
|
|
7696
7798
|
init_svelteServerModule();
|
|
7799
|
+
init_vueServerModule();
|
|
7697
7800
|
init_islandMarkupAttributes();
|
|
7698
7801
|
init_islands();
|
|
7699
7802
|
resolvedServerComponentCache = new Map;
|
|
@@ -7702,7 +7805,7 @@ var init_renderIslandMarkup = __esm(() => {
|
|
|
7702
7805
|
|
|
7703
7806
|
// src/build/islandEntries.ts
|
|
7704
7807
|
import { mkdirSync, rmSync, writeFileSync as writeFileSync2 } from "fs";
|
|
7705
|
-
import { dirname as
|
|
7808
|
+
import { dirname as dirname7, extname as extname3, join as join8, relative as relative4, resolve as resolve7 } from "path";
|
|
7706
7809
|
import ts from "typescript";
|
|
7707
7810
|
var frameworks, isRecord4 = (value) => typeof value === "object" && value !== null, resolveRegistryExport = (mod) => {
|
|
7708
7811
|
if (isRecord4(mod.islandRegistry))
|
|
@@ -7711,13 +7814,13 @@ var frameworks, isRecord4 = (value) => typeof value === "object" && value !== nu
|
|
|
7711
7814
|
return mod.default;
|
|
7712
7815
|
throw new Error("Island registry module must export `islandRegistry` or a default registry object.");
|
|
7713
7816
|
}, hasSvelteImport = (source) => /from\s+['"][^'"]+\.svelte['"]/.test(source), normalizeImportPath = (wrapperPath, targetPath) => {
|
|
7714
|
-
const importPath =
|
|
7817
|
+
const importPath = relative4(dirname7(wrapperPath), targetPath).replace(/\\/g, "/");
|
|
7715
7818
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
7716
7819
|
}, isIdentifier = (value) => /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(value), resolveIslandSourcePath = (registryPath, sourcePath) => {
|
|
7717
7820
|
if (sourcePath.startsWith("file://")) {
|
|
7718
7821
|
return new URL(sourcePath).pathname;
|
|
7719
7822
|
}
|
|
7720
|
-
return
|
|
7823
|
+
return resolve7(dirname7(registryPath), sourcePath);
|
|
7721
7824
|
}, getObjectPropertyName = (name) => {
|
|
7722
7825
|
if (ts.isIdentifier(name) || ts.isStringLiteral(name)) {
|
|
7723
7826
|
return name.text;
|
|
@@ -7935,16 +8038,16 @@ export default component;
|
|
|
7935
8038
|
buildPath,
|
|
7936
8039
|
clientPathMaps = {}
|
|
7937
8040
|
}) => {
|
|
7938
|
-
const generatedRoot =
|
|
8041
|
+
const generatedRoot = join8(buildPath, "_island_entries");
|
|
7939
8042
|
rmSync(generatedRoot, { force: true, recursive: true });
|
|
7940
8043
|
const entries = [];
|
|
7941
8044
|
for (const definition of buildInfo.definitions) {
|
|
7942
|
-
const entryPath =
|
|
8045
|
+
const entryPath = join8(generatedRoot, "islands", definition.framework, `${definition.component}.ts`);
|
|
7943
8046
|
const { buildReference } = definition;
|
|
7944
8047
|
const source = buildReference ? resolveIslandSourcePath(buildInfo.resolvedRegistryPath, buildReference.source) : null;
|
|
7945
8048
|
const compiledSourcePath = source && shouldUseCompiledClientPath(definition.framework, source) ? clientPathMaps[definition.framework]?.get(source) : undefined;
|
|
7946
8049
|
const entrySource = source && (compiledSourcePath || !shouldUseCompiledClientPath(definition.framework, source)) ? createDirectEntrySource(entryPath, compiledSourcePath ?? source, compiledSourcePath ? undefined : buildReference?.export) : createRegistryEntrySource(entryPath, buildInfo.resolvedRegistryPath, buildInfo.hasNamedExport, definition.framework, definition.component);
|
|
7947
|
-
mkdirSync(
|
|
8050
|
+
mkdirSync(dirname7(entryPath), { recursive: true });
|
|
7948
8051
|
writeFileSync2(entryPath, entrySource);
|
|
7949
8052
|
entries.push({
|
|
7950
8053
|
component: definition.component,
|
|
@@ -7957,7 +8060,7 @@ export default component;
|
|
|
7957
8060
|
generatedRoot
|
|
7958
8061
|
};
|
|
7959
8062
|
}, loadIslandRegistryBuildInfo = async (registryPath) => {
|
|
7960
|
-
const resolvedRegistryPath =
|
|
8063
|
+
const resolvedRegistryPath = resolve7(registryPath);
|
|
7961
8064
|
const registrySource = Bun.file(resolvedRegistryPath);
|
|
7962
8065
|
const registrySourceText = await registrySource.text();
|
|
7963
8066
|
const parsedInfo = parseIslandRegistryBuildInfo(registrySourceText, resolvedRegistryPath);
|
|
@@ -8310,7 +8413,7 @@ var init_sourceMetadata = __esm(() => {
|
|
|
8310
8413
|
|
|
8311
8414
|
// src/islands/pageMetadata.ts
|
|
8312
8415
|
import { readFileSync as readFileSync7 } from "fs";
|
|
8313
|
-
import { dirname as
|
|
8416
|
+
import { dirname as dirname8, resolve as resolve10 } from "path";
|
|
8314
8417
|
var pagePatterns, getPageDirs = (config) => [
|
|
8315
8418
|
{ dir: config.angularDirectory, framework: "angular" },
|
|
8316
8419
|
{ dir: config.emberDirectory, framework: "ember" },
|
|
@@ -8330,15 +8433,15 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
8330
8433
|
const source = definition.buildReference?.source;
|
|
8331
8434
|
if (!source)
|
|
8332
8435
|
continue;
|
|
8333
|
-
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname :
|
|
8334
|
-
lookup.set(`${definition.framework}:${definition.component}`,
|
|
8436
|
+
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve10(dirname8(buildInfo.resolvedRegistryPath), source);
|
|
8437
|
+
lookup.set(`${definition.framework}:${definition.component}`, resolve10(resolvedSource));
|
|
8335
8438
|
}
|
|
8336
8439
|
return lookup;
|
|
8337
8440
|
}, getCurrentPageIslandMetadata = () => globalThis.__absolutePageIslandMetadata ?? new Map, metadataUsesSource = (metadata2, target) => metadata2.islands.some((usage) => {
|
|
8338
8441
|
const candidate = usage.source;
|
|
8339
|
-
return candidate ?
|
|
8442
|
+
return candidate ? resolve10(candidate) === target : false;
|
|
8340
8443
|
}), getPagesUsingIslandSource = (sourcePath) => {
|
|
8341
|
-
const target =
|
|
8444
|
+
const target = resolve10(sourcePath);
|
|
8342
8445
|
return [...getCurrentPageIslandMetadata().values()].filter((metadata2) => metadataUsesSource(metadata2, target)).map((metadata2) => metadata2.pagePath);
|
|
8343
8446
|
}, resolveIslandUsages = (islands, islandSourceLookup) => islands.map((usage) => {
|
|
8344
8447
|
const sourcePath = islandSourceLookup.get(`${usage.framework}:${usage.component}`);
|
|
@@ -8350,13 +8453,13 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
8350
8453
|
const pattern = pagePatterns[entry.framework];
|
|
8351
8454
|
if (!pattern)
|
|
8352
8455
|
return;
|
|
8353
|
-
const files = await scanEntryPoints(
|
|
8456
|
+
const files = await scanEntryPoints(resolve10(entry.dir), pattern);
|
|
8354
8457
|
for (const filePath of files) {
|
|
8355
8458
|
const source = readFileSync7(filePath, "utf-8");
|
|
8356
8459
|
const islands = extractIslandUsagesFromSource(source);
|
|
8357
|
-
pageMetadata.set(
|
|
8460
|
+
pageMetadata.set(resolve10(filePath), {
|
|
8358
8461
|
islands: resolveIslandUsages(islands, islandSourceLookup),
|
|
8359
|
-
pagePath:
|
|
8462
|
+
pagePath: resolve10(filePath)
|
|
8360
8463
|
});
|
|
8361
8464
|
}
|
|
8362
8465
|
}, loadPageIslandMetadata = async (config) => {
|
|
@@ -8561,12 +8664,12 @@ var init_startupBanner = __esm(() => {
|
|
|
8561
8664
|
// src/utils/logger.ts
|
|
8562
8665
|
var colors2, frameworkColors, formatPath = (filePath) => {
|
|
8563
8666
|
const cwd = process.cwd();
|
|
8564
|
-
let
|
|
8565
|
-
|
|
8566
|
-
if (!
|
|
8567
|
-
|
|
8667
|
+
let relative5 = filePath.startsWith(cwd) ? filePath.slice(cwd.length + 1) : filePath;
|
|
8668
|
+
relative5 = relative5.replace(/\\/g, "/");
|
|
8669
|
+
if (!relative5.startsWith("/")) {
|
|
8670
|
+
relative5 = `/${relative5}`;
|
|
8568
8671
|
}
|
|
8569
|
-
return
|
|
8672
|
+
return relative5;
|
|
8570
8673
|
}, getFrameworkColor = (framework) => frameworkColors[framework] || colors2.white, log = (action, options) => {
|
|
8571
8674
|
const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
|
|
8572
8675
|
const tag = `${colors2.cyan}[hmr]${colors2.reset}`;
|
|
@@ -8669,9 +8772,9 @@ var getManifestKey = (folder, pascalName, isClientComponent, isReact, isVue, isS
|
|
|
8669
8772
|
}, generateManifest = (outputs, buildPath) => outputs.reduce((manifest, artifact) => {
|
|
8670
8773
|
const normalizedArtifactPath = normalizePath(artifact.path);
|
|
8671
8774
|
const normalizedBuildPath = normalizePath(buildPath);
|
|
8672
|
-
let
|
|
8673
|
-
|
|
8674
|
-
const segments =
|
|
8775
|
+
let relative5 = normalizedArtifactPath.startsWith(normalizedBuildPath) ? normalizedArtifactPath.slice(normalizedBuildPath.length) : normalizedArtifactPath;
|
|
8776
|
+
relative5 = relative5.replace(/^\/+/, "");
|
|
8777
|
+
const segments = relative5.split("/");
|
|
8675
8778
|
const fileWithHash = segments.pop();
|
|
8676
8779
|
if (!fileWithHash)
|
|
8677
8780
|
return manifest;
|
|
@@ -8685,15 +8788,15 @@ var getManifestKey = (folder, pascalName, isClientComponent, isReact, isVue, isS
|
|
|
8685
8788
|
if (segments.includes("server"))
|
|
8686
8789
|
return manifest;
|
|
8687
8790
|
const cssKey = getCssKey(pascalName, segments);
|
|
8688
|
-
if (manifest[cssKey] && manifest[cssKey] !== `/${
|
|
8689
|
-
logWarn(`Duplicate manifest key "${cssKey}" \u2014 "${manifest[cssKey]}" will be overwritten by "/${
|
|
8690
|
-
manifest[cssKey] = `/${
|
|
8791
|
+
if (manifest[cssKey] && manifest[cssKey] !== `/${relative5}`)
|
|
8792
|
+
logWarn(`Duplicate manifest key "${cssKey}" \u2014 "${manifest[cssKey]}" will be overwritten by "/${relative5}". Use unique page names across frameworks.`);
|
|
8793
|
+
manifest[cssKey] = `/${relative5}`;
|
|
8691
8794
|
return manifest;
|
|
8692
8795
|
}
|
|
8693
8796
|
const frameworkSegment = islandIndex > UNFOUND_INDEX ? segments[islandIndex + 1] : undefined;
|
|
8694
8797
|
if (frameworkSegment === "react" || frameworkSegment === "svelte" || frameworkSegment === "vue" || frameworkSegment === "angular") {
|
|
8695
8798
|
const manifestKey2 = getIslandManifestKey(frameworkSegment, pascalName);
|
|
8696
|
-
manifest[manifestKey2] = `/${
|
|
8799
|
+
manifest[manifestKey2] = `/${relative5}`;
|
|
8697
8800
|
return manifest;
|
|
8698
8801
|
}
|
|
8699
8802
|
const idx = segments.findIndex((seg) => seg === "indexes" || seg === "pages" || seg === "client");
|
|
@@ -8704,10 +8807,10 @@ var getManifestKey = (folder, pascalName, isClientComponent, isReact, isVue, isS
|
|
|
8704
8807
|
const isAngular = segments.some((seg) => seg === "angular");
|
|
8705
8808
|
const isClientComponent = segments.includes("client");
|
|
8706
8809
|
const manifestKey = getManifestKey(folder, pascalName, isClientComponent, isReact, isVue, isSvelte, isAngular);
|
|
8707
|
-
if (manifest[manifestKey] && manifest[manifestKey] !== `/${
|
|
8708
|
-
logWarn(`Duplicate manifest key "${manifestKey}" \u2014 "${manifest[manifestKey]}" will be overwritten by "/${
|
|
8810
|
+
if (manifest[manifestKey] && manifest[manifestKey] !== `/${relative5}`) {
|
|
8811
|
+
logWarn(`Duplicate manifest key "${manifestKey}" \u2014 "${manifest[manifestKey]}" will be overwritten by "/${relative5}". Use unique page names across frameworks.`);
|
|
8709
8812
|
}
|
|
8710
|
-
manifest[manifestKey] = `/${
|
|
8813
|
+
manifest[manifestKey] = `/${relative5}`;
|
|
8711
8814
|
return manifest;
|
|
8712
8815
|
}, {});
|
|
8713
8816
|
var init_generateManifest = __esm(() => {
|
|
@@ -8716,7 +8819,7 @@ var init_generateManifest = __esm(() => {
|
|
|
8716
8819
|
});
|
|
8717
8820
|
|
|
8718
8821
|
// src/build/verifyAngularCoreUniqueness.ts
|
|
8719
|
-
import { resolve as
|
|
8822
|
+
import { resolve as resolve11 } from "path";
|
|
8720
8823
|
var ANGULAR_CORE_IMPORT_RE, ANGULAR_CORE_PACKAGE_RE, classifySpecifier = (specifier, artifactPath, serverOutDir) => {
|
|
8721
8824
|
if (!ANGULAR_CORE_PACKAGE_RE.test(specifier))
|
|
8722
8825
|
return null;
|
|
@@ -8726,9 +8829,9 @@ var ANGULAR_CORE_IMPORT_RE, ANGULAR_CORE_PACKAGE_RE, classifySpecifier = (specif
|
|
|
8726
8829
|
if (specifier.startsWith("/")) {
|
|
8727
8830
|
absolute = specifier;
|
|
8728
8831
|
} else if (specifier.startsWith(".")) {
|
|
8729
|
-
absolute =
|
|
8832
|
+
absolute = resolve11(artifactPath, "..", specifier);
|
|
8730
8833
|
} else {
|
|
8731
|
-
absolute = serverOutDir ?
|
|
8834
|
+
absolute = serverOutDir ? resolve11(serverOutDir, specifier) : resolve11(artifactPath, "..", specifier);
|
|
8732
8835
|
}
|
|
8733
8836
|
return {
|
|
8734
8837
|
kind: "resolved",
|
|
@@ -8793,18 +8896,18 @@ var init_verifyAngularCoreUniqueness = __esm(() => {
|
|
|
8793
8896
|
// src/build/generateReactIndexes.ts
|
|
8794
8897
|
import { existsSync as existsSync7, mkdirSync as mkdirSync2 } from "fs";
|
|
8795
8898
|
import { readdir as readdir2, rm, writeFile } from "fs/promises";
|
|
8796
|
-
import { basename as basename3, join as
|
|
8899
|
+
import { basename as basename3, join as join9, relative as relative5, resolve as resolve12, sep } from "path";
|
|
8797
8900
|
var {Glob: Glob2 } = globalThis.Bun;
|
|
8798
8901
|
var indexContentCache, resolveDevClientDir = () => {
|
|
8799
8902
|
const projectRoot = process.cwd();
|
|
8800
|
-
const fromSource =
|
|
8903
|
+
const fromSource = resolve12(import.meta.dir, "../dev/client");
|
|
8801
8904
|
if (existsSync7(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
8802
8905
|
return fromSource;
|
|
8803
8906
|
}
|
|
8804
|
-
const fromNodeModules =
|
|
8907
|
+
const fromNodeModules = resolve12(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
8805
8908
|
if (existsSync7(fromNodeModules))
|
|
8806
8909
|
return fromNodeModules;
|
|
8807
|
-
return
|
|
8910
|
+
return resolve12(import.meta.dir, "./dev/client");
|
|
8808
8911
|
}, devClientDir, errorOverlayPath, hmrClientPath, refreshSetupPath, generateReactIndexFiles = async (reactPagesDirectory, reactIndexesDirectory, isDev2 = false) => {
|
|
8809
8912
|
if (!existsSync7(reactIndexesDirectory)) {
|
|
8810
8913
|
mkdirSync2(reactIndexesDirectory, { recursive: true });
|
|
@@ -8826,13 +8929,13 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
8826
8929
|
});
|
|
8827
8930
|
if (staleIndexes.length > 0) {
|
|
8828
8931
|
await Promise.all(staleIndexes.map((indexFile) => {
|
|
8829
|
-
indexContentCache.delete(
|
|
8830
|
-
return rm(
|
|
8932
|
+
indexContentCache.delete(join9(reactIndexesDirectory, indexFile));
|
|
8933
|
+
return rm(join9(reactIndexesDirectory, indexFile), {
|
|
8831
8934
|
force: true
|
|
8832
8935
|
});
|
|
8833
8936
|
}));
|
|
8834
8937
|
}
|
|
8835
|
-
const pagesRelPath =
|
|
8938
|
+
const pagesRelPath = relative5(resolve12(reactIndexesDirectory), resolve12(reactPagesDirectory)).split(sep).join("/");
|
|
8836
8939
|
const promises = files.map(async (file2) => {
|
|
8837
8940
|
const fileName = basename3(file2);
|
|
8838
8941
|
const componentName = fileName.split(".")[0];
|
|
@@ -9106,11 +9209,11 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
9106
9209
|
`
|
|
9107
9210
|
// Pre-warm: import the page module from the module server`,
|
|
9108
9211
|
`// immediately so the browser caches all /@src/ URLs.`,
|
|
9109
|
-
`import('/@src/${
|
|
9212
|
+
`import('/@src/${relative5(process.cwd(), resolve12(reactPagesDirectory, `${componentName}.tsx`)).replace(/\\/g, "/")}').catch(() => {});`
|
|
9110
9213
|
] : []
|
|
9111
9214
|
].join(`
|
|
9112
9215
|
`);
|
|
9113
|
-
const indexPath =
|
|
9216
|
+
const indexPath = join9(reactIndexesDirectory, `${componentName}.tsx`);
|
|
9114
9217
|
const hasher = new Bun.CryptoHasher("md5");
|
|
9115
9218
|
hasher.update(content);
|
|
9116
9219
|
const contentHash = hasher.digest("hex");
|
|
@@ -9124,7 +9227,7 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
9124
9227
|
if (!isDev2) {
|
|
9125
9228
|
return;
|
|
9126
9229
|
}
|
|
9127
|
-
const refreshPath =
|
|
9230
|
+
const refreshPath = join9(reactIndexesDirectory, "_refresh.tsx");
|
|
9128
9231
|
if (!existsSync7(refreshPath)) {
|
|
9129
9232
|
await writeFile(refreshPath, `import '${refreshSetupPath}';
|
|
9130
9233
|
import 'react';
|
|
@@ -9135,9 +9238,9 @@ import 'react-dom/client';
|
|
|
9135
9238
|
var init_generateReactIndexes = __esm(() => {
|
|
9136
9239
|
indexContentCache = new Map;
|
|
9137
9240
|
devClientDir = resolveDevClientDir();
|
|
9138
|
-
errorOverlayPath =
|
|
9139
|
-
hmrClientPath =
|
|
9140
|
-
refreshSetupPath =
|
|
9241
|
+
errorOverlayPath = join9(devClientDir, "errorOverlay.ts").replace(/\\/g, "/");
|
|
9242
|
+
hmrClientPath = join9(devClientDir, "hmrClient.ts").replace(/\\/g, "/");
|
|
9243
|
+
refreshSetupPath = join9(devClientDir, "reactRefreshSetup.ts").replace(/\\/g, "/");
|
|
9141
9244
|
});
|
|
9142
9245
|
|
|
9143
9246
|
// src/build/wrapHTMLScript.ts
|
|
@@ -9274,7 +9377,7 @@ var init_scanCssEntryPoints = __esm(() => {
|
|
|
9274
9377
|
|
|
9275
9378
|
// src/utils/imageProcessing.ts
|
|
9276
9379
|
import { existsSync as existsSync10, mkdirSync as mkdirSync3, readFileSync as readFileSync8, writeFileSync as writeFileSync4 } from "fs";
|
|
9277
|
-
import { join as
|
|
9380
|
+
import { join as join10, resolve as resolve13 } from "path";
|
|
9278
9381
|
var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_ENDPOINT = "/_absolute/image", BLUR_DEVIATION = 20, sharpModule = undefined, sharpLoaded = false, sharpWarned = false, snapToSize = (target, sizes) => {
|
|
9279
9382
|
for (const size of sizes) {
|
|
9280
9383
|
if (size >= target)
|
|
@@ -9329,7 +9432,7 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
|
|
|
9329
9432
|
const image2 = config?.imageSizes ?? DEFAULT_IMAGE_SIZES;
|
|
9330
9433
|
return [...device, ...image2].sort((left, right) => left - right);
|
|
9331
9434
|
}, getCacheDir = (buildDir) => {
|
|
9332
|
-
const dir =
|
|
9435
|
+
const dir = join10(buildDir, ".cache", "images");
|
|
9333
9436
|
if (!existsSync10(dir))
|
|
9334
9437
|
mkdirSync3(dir, { recursive: true });
|
|
9335
9438
|
return dir;
|
|
@@ -9386,8 +9489,8 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
|
|
|
9386
9489
|
return toBuffer(buffer);
|
|
9387
9490
|
}
|
|
9388
9491
|
}, readFromCache = (cacheDir, cacheKey) => {
|
|
9389
|
-
const metaPath =
|
|
9390
|
-
const dataPath =
|
|
9492
|
+
const metaPath = join10(cacheDir, `${cacheKey}.meta`);
|
|
9493
|
+
const dataPath = join10(cacheDir, `${cacheKey}.data`);
|
|
9391
9494
|
if (!existsSync10(metaPath) || !existsSync10(dataPath))
|
|
9392
9495
|
return null;
|
|
9393
9496
|
try {
|
|
@@ -9402,7 +9505,7 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
|
|
|
9402
9505
|
return sharpModule;
|
|
9403
9506
|
sharpLoaded = true;
|
|
9404
9507
|
try {
|
|
9405
|
-
const sharpPath =
|
|
9508
|
+
const sharpPath = resolve13(process.cwd(), "node_modules/sharp");
|
|
9406
9509
|
const mod = await import(sharpPath);
|
|
9407
9510
|
sharpModule = mod.default ?? mod;
|
|
9408
9511
|
return sharpModule;
|
|
@@ -9414,8 +9517,8 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
|
|
|
9414
9517
|
return null;
|
|
9415
9518
|
}
|
|
9416
9519
|
}, writeToCache = (cacheDir, cacheKey, buffer, meta) => {
|
|
9417
|
-
const metaPath =
|
|
9418
|
-
const dataPath =
|
|
9520
|
+
const metaPath = join10(cacheDir, `${cacheKey}.meta`);
|
|
9521
|
+
const dataPath = join10(cacheDir, `${cacheKey}.data`);
|
|
9419
9522
|
writeFileSync4(dataPath, buffer);
|
|
9420
9523
|
writeFileSync4(metaPath, JSON.stringify(meta));
|
|
9421
9524
|
};
|
|
@@ -9503,7 +9606,7 @@ var init_optimizeHtmlImages = __esm(() => {
|
|
|
9503
9606
|
// src/cli/scripts/telemetry.ts
|
|
9504
9607
|
import { existsSync as existsSync11, mkdirSync as mkdirSync4, readFileSync as readFileSync9, writeFileSync as writeFileSync5 } from "fs";
|
|
9505
9608
|
import { homedir } from "os";
|
|
9506
|
-
import { join as
|
|
9609
|
+
import { join as join11 } from "path";
|
|
9507
9610
|
var configDir, configPath, getTelemetryConfig = () => {
|
|
9508
9611
|
try {
|
|
9509
9612
|
if (!existsSync11(configPath))
|
|
@@ -9516,14 +9619,14 @@ var configDir, configPath, getTelemetryConfig = () => {
|
|
|
9516
9619
|
}
|
|
9517
9620
|
};
|
|
9518
9621
|
var init_telemetry = __esm(() => {
|
|
9519
|
-
configDir =
|
|
9520
|
-
configPath =
|
|
9622
|
+
configDir = join11(homedir(), ".absolutejs");
|
|
9623
|
+
configPath = join11(configDir, "telemetry.json");
|
|
9521
9624
|
});
|
|
9522
9625
|
|
|
9523
9626
|
// src/cli/telemetryEvent.ts
|
|
9524
9627
|
import { existsSync as existsSync12, readFileSync as readFileSync10 } from "fs";
|
|
9525
9628
|
import { arch, platform } from "os";
|
|
9526
|
-
import { dirname as
|
|
9629
|
+
import { dirname as dirname9, join as join12, parse } from "path";
|
|
9527
9630
|
var checkCandidate = (candidate) => {
|
|
9528
9631
|
if (!existsSync12(candidate)) {
|
|
9529
9632
|
return null;
|
|
@@ -9543,12 +9646,12 @@ var checkCandidate = (candidate) => {
|
|
|
9543
9646
|
}, findPackageVersion = () => {
|
|
9544
9647
|
let { dir } = import.meta;
|
|
9545
9648
|
while (dir !== parse(dir).root) {
|
|
9546
|
-
const candidate =
|
|
9649
|
+
const candidate = join12(dir, "package.json");
|
|
9547
9650
|
const version = checkCandidate(candidate);
|
|
9548
9651
|
if (version) {
|
|
9549
9652
|
return version;
|
|
9550
9653
|
}
|
|
9551
|
-
dir =
|
|
9654
|
+
dir = dirname9(dir);
|
|
9552
9655
|
}
|
|
9553
9656
|
return "unknown";
|
|
9554
9657
|
}, sendTelemetryEvent = (event, payload) => {
|
|
@@ -9634,18 +9737,18 @@ var init_updateAssetPaths = __esm(() => {
|
|
|
9634
9737
|
|
|
9635
9738
|
// src/dev/buildHMRClient.ts
|
|
9636
9739
|
import { existsSync as existsSync13 } from "fs";
|
|
9637
|
-
import { resolve as
|
|
9740
|
+
import { resolve as resolve14 } from "path";
|
|
9638
9741
|
var {build: bunBuild } = globalThis.Bun;
|
|
9639
9742
|
var resolveHmrClientPath = () => {
|
|
9640
9743
|
const projectRoot = process.cwd();
|
|
9641
|
-
const fromSource =
|
|
9744
|
+
const fromSource = resolve14(import.meta.dir, "client/hmrClient.ts");
|
|
9642
9745
|
if (existsSync13(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
9643
9746
|
return fromSource;
|
|
9644
9747
|
}
|
|
9645
|
-
const fromNodeModules =
|
|
9748
|
+
const fromNodeModules = resolve14(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client/hmrClient.ts");
|
|
9646
9749
|
if (existsSync13(fromNodeModules))
|
|
9647
9750
|
return fromNodeModules;
|
|
9648
|
-
return
|
|
9751
|
+
return resolve14(import.meta.dir, "dev/client/hmrClient.ts");
|
|
9649
9752
|
}, hmrClientPath2, buildHMRClient = async () => {
|
|
9650
9753
|
const entryPoint = hmrClientPath2;
|
|
9651
9754
|
const result = await bunBuild({
|
|
@@ -9675,7 +9778,7 @@ var init_buildHMRClient = __esm(() => {
|
|
|
9675
9778
|
// src/build/nativeRewrite.ts
|
|
9676
9779
|
import { dlopen, FFIType, ptr } from "bun:ffi";
|
|
9677
9780
|
import { platform as platform2, arch as arch2 } from "os";
|
|
9678
|
-
import { resolve as
|
|
9781
|
+
import { resolve as resolve15 } from "path";
|
|
9679
9782
|
var ffiDefinition, nativeLib = null, loadNative = () => {
|
|
9680
9783
|
if (nativeLib !== null)
|
|
9681
9784
|
return nativeLib;
|
|
@@ -9693,7 +9796,7 @@ var ffiDefinition, nativeLib = null, loadNative = () => {
|
|
|
9693
9796
|
if (!libPath)
|
|
9694
9797
|
return null;
|
|
9695
9798
|
try {
|
|
9696
|
-
const fullPath =
|
|
9799
|
+
const fullPath = resolve15(import.meta.dir, "../../native/packages", libPath);
|
|
9697
9800
|
const lib = dlopen(fullPath, ffiDefinition);
|
|
9698
9801
|
nativeLib = lib.symbols;
|
|
9699
9802
|
return nativeLib;
|
|
@@ -9839,7 +9942,7 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
|
|
|
9839
9942
|
|
|
9840
9943
|
// src/build/angularLinkerPlugin.ts
|
|
9841
9944
|
import { existsSync as existsSync14, mkdirSync as mkdirSync5, readFileSync as readFileSync11, writeFileSync as writeFileSync6 } from "fs";
|
|
9842
|
-
import { dirname as
|
|
9945
|
+
import { dirname as dirname10, join as join13, relative as relative6, resolve as resolve16 } from "path";
|
|
9843
9946
|
import { createHash as createHash3 } from "crypto";
|
|
9844
9947
|
var CACHE_ROOT, createAngularLinkerPlugin = (linkerJitMode) => ({
|
|
9845
9948
|
name: "angular-linker",
|
|
@@ -9847,7 +9950,7 @@ var CACHE_ROOT, createAngularLinkerPlugin = (linkerJitMode) => ({
|
|
|
9847
9950
|
let needsLinking;
|
|
9848
9951
|
let babelTransform;
|
|
9849
9952
|
let linkerPlugin;
|
|
9850
|
-
const cacheDir =
|
|
9953
|
+
const cacheDir = join13(CACHE_ROOT, linkerJitMode ? "jit" : "aot");
|
|
9851
9954
|
bld.onLoad({ filter: /[\\/]@angular[\\/].*\.m?js$/ }, async (args) => {
|
|
9852
9955
|
const source = await Bun.file(args.path).text();
|
|
9853
9956
|
if (!needsLinking) {
|
|
@@ -9860,7 +9963,7 @@ var CACHE_ROOT, createAngularLinkerPlugin = (linkerJitMode) => ({
|
|
|
9860
9963
|
return;
|
|
9861
9964
|
}
|
|
9862
9965
|
const hash = createHash3("md5").update(source).digest("hex");
|
|
9863
|
-
const cachePath =
|
|
9966
|
+
const cachePath = join13(cacheDir, `${hash}.js`);
|
|
9864
9967
|
if (existsSync14(cachePath)) {
|
|
9865
9968
|
return {
|
|
9866
9969
|
contents: readFileSync11(cachePath, "utf-8"),
|
|
@@ -9877,11 +9980,11 @@ var CACHE_ROOT, createAngularLinkerPlugin = (linkerJitMode) => ({
|
|
|
9877
9980
|
const mod = await import(linkerSpecifier);
|
|
9878
9981
|
linkerPlugin = mod.createEs2015LinkerPlugin({
|
|
9879
9982
|
fileSystem: {
|
|
9880
|
-
dirname:
|
|
9983
|
+
dirname: dirname10,
|
|
9881
9984
|
exists: existsSync14,
|
|
9882
9985
|
readFile: readFileSync11,
|
|
9883
|
-
relative:
|
|
9884
|
-
resolve:
|
|
9986
|
+
relative: relative6,
|
|
9987
|
+
resolve: resolve16
|
|
9885
9988
|
},
|
|
9886
9989
|
linkerJitMode,
|
|
9887
9990
|
logger: {
|
|
@@ -9912,7 +10015,7 @@ var CACHE_ROOT, createAngularLinkerPlugin = (linkerJitMode) => ({
|
|
|
9912
10015
|
}
|
|
9913
10016
|
}), angularLinkerPlugin;
|
|
9914
10017
|
var init_angularLinkerPlugin = __esm(() => {
|
|
9915
|
-
CACHE_ROOT =
|
|
10018
|
+
CACHE_ROOT = resolve16(".absolutejs", "cache", "angular-linker");
|
|
9916
10019
|
angularLinkerPlugin = createAngularLinkerPlugin(false);
|
|
9917
10020
|
});
|
|
9918
10021
|
|
|
@@ -9923,7 +10026,7 @@ __export(exports_hmrInjectionPlugin, {
|
|
|
9923
10026
|
applyAngularHmrInjection: () => applyAngularHmrInjection
|
|
9924
10027
|
});
|
|
9925
10028
|
import { readFile as readFile5 } from "fs/promises";
|
|
9926
|
-
import { relative as
|
|
10029
|
+
import { relative as relative7, resolve as resolve17 } from "path";
|
|
9927
10030
|
var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames = (jsSource) => {
|
|
9928
10031
|
const names = new Set;
|
|
9929
10032
|
IMPORT_RE.lastIndex = 0;
|
|
@@ -10086,7 +10189,7 @@ var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames =
|
|
|
10086
10189
|
}
|
|
10087
10190
|
`, applyAngularHmrInjection = (jsSource, componentJsAbsPath, params) => {
|
|
10088
10191
|
const { generatedAngularRoot, userAngularRoot, projectRoot } = params;
|
|
10089
|
-
const normalizedGenRoot =
|
|
10192
|
+
const normalizedGenRoot = resolve17(generatedAngularRoot).replace(/\\/g, "/");
|
|
10090
10193
|
const normalizedPath = componentJsAbsPath.replace(/\\/g, "/");
|
|
10091
10194
|
if (!normalizedPath.startsWith(normalizedGenRoot + "/"))
|
|
10092
10195
|
return;
|
|
@@ -10103,9 +10206,9 @@ var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames =
|
|
|
10103
10206
|
}
|
|
10104
10207
|
if (classNames.length === 0)
|
|
10105
10208
|
return;
|
|
10106
|
-
const relFromGenRoot =
|
|
10107
|
-
const userTsPath =
|
|
10108
|
-
const projectRel =
|
|
10209
|
+
const relFromGenRoot = relative7(generatedAngularRoot, componentJsAbsPath).replace(/\\/g, "/");
|
|
10210
|
+
const userTsPath = resolve17(userAngularRoot, relFromGenRoot.replace(/\.js$/, ".ts"));
|
|
10211
|
+
const projectRel = relative7(projectRoot, userTsPath).replace(/\\/g, "/");
|
|
10109
10212
|
const tail = classNames.map((className) => {
|
|
10110
10213
|
const id = `${projectRel}@${className}`;
|
|
10111
10214
|
return buildHmrTail(className, JSON.stringify(id));
|
|
@@ -10139,17 +10242,17 @@ var init_hmrInjectionPlugin = __esm(() => {
|
|
|
10139
10242
|
|
|
10140
10243
|
// src/utils/cleanStaleOutputs.ts
|
|
10141
10244
|
import { rm as rm2 } from "fs/promises";
|
|
10142
|
-
import { resolve as
|
|
10245
|
+
import { resolve as resolve18 } from "path";
|
|
10143
10246
|
var {Glob: Glob5 } = globalThis.Bun;
|
|
10144
10247
|
var HASHED_FILE_PATTERN, cleanStaleOutputs = async (buildPath, currentOutputPaths) => {
|
|
10145
|
-
const currentPaths = new Set(currentOutputPaths.map((path) =>
|
|
10248
|
+
const currentPaths = new Set(currentOutputPaths.map((path) => resolve18(path)));
|
|
10146
10249
|
const glob = new Glob5("**/*");
|
|
10147
10250
|
const removals = [];
|
|
10148
|
-
for (const
|
|
10149
|
-
const absolute =
|
|
10251
|
+
for (const relative8 of glob.scanSync({ cwd: buildPath })) {
|
|
10252
|
+
const absolute = resolve18(buildPath, relative8);
|
|
10150
10253
|
if (currentPaths.has(absolute))
|
|
10151
10254
|
continue;
|
|
10152
|
-
if (!HASHED_FILE_PATTERN.test(
|
|
10255
|
+
if (!HASHED_FILE_PATTERN.test(relative8))
|
|
10153
10256
|
continue;
|
|
10154
10257
|
removals.push(rm2(absolute, { force: true }));
|
|
10155
10258
|
}
|
|
@@ -10165,20 +10268,20 @@ __export(exports_generatedDir, {
|
|
|
10165
10268
|
getGeneratedRoot: () => getGeneratedRoot,
|
|
10166
10269
|
getFrameworkGeneratedDir: () => getFrameworkGeneratedDir
|
|
10167
10270
|
});
|
|
10168
|
-
import { join as
|
|
10169
|
-
var GENERATED_DIR_NAME = "generated", ABSOLUTE_CACHE_DIR_NAME = ".absolutejs", getGeneratedRoot = (projectRoot = process.cwd()) =>
|
|
10271
|
+
import { join as join14 } from "path";
|
|
10272
|
+
var GENERATED_DIR_NAME = "generated", ABSOLUTE_CACHE_DIR_NAME = ".absolutejs", getGeneratedRoot = (projectRoot = process.cwd()) => join14(projectRoot, ABSOLUTE_CACHE_DIR_NAME, GENERATED_DIR_NAME), getFrameworkGeneratedDir = (framework, projectRoot = process.cwd()) => join14(getGeneratedRoot(projectRoot), framework);
|
|
10170
10273
|
var init_generatedDir = () => {};
|
|
10171
10274
|
|
|
10172
10275
|
// src/utils/cleanup.ts
|
|
10173
10276
|
import { rm as rm3 } from "fs/promises";
|
|
10174
|
-
import { join as
|
|
10277
|
+
import { join as join15 } from "path";
|
|
10175
10278
|
var removeIfExists = (path) => rm3(path, { force: true, recursive: true }), cleanFramework = (framework, frameworkDir, skipGenerated = false) => {
|
|
10176
10279
|
const tasks = [];
|
|
10177
10280
|
if (!skipGenerated) {
|
|
10178
10281
|
tasks.push(removeIfExists(getFrameworkGeneratedDir(framework)));
|
|
10179
10282
|
}
|
|
10180
10283
|
if (frameworkDir)
|
|
10181
|
-
tasks.push(removeIfExists(
|
|
10284
|
+
tasks.push(removeIfExists(join15(frameworkDir, "generated")));
|
|
10182
10285
|
return Promise.all(tasks);
|
|
10183
10286
|
}, cleanup = async ({
|
|
10184
10287
|
angularDir,
|
|
@@ -10217,7 +10320,7 @@ var init_commonAncestor = () => {};
|
|
|
10217
10320
|
|
|
10218
10321
|
// src/utils/buildDirectoryLock.ts
|
|
10219
10322
|
import { mkdirSync as mkdirSync6, unlinkSync, writeFileSync as writeFileSync7, readFileSync as readFileSync12 } from "fs";
|
|
10220
|
-
import { dirname as
|
|
10323
|
+
import { dirname as dirname11, join as join16 } from "path";
|
|
10221
10324
|
var heldLocks, HELD_LOCKS_ENV = "ABSOLUTE_HELD_BUILD_DIRECTORY_LOCKS", exitHandlersRegistered = false, registerExitHandlersOnce = () => {
|
|
10222
10325
|
if (exitHandlersRegistered)
|
|
10223
10326
|
return;
|
|
@@ -10243,7 +10346,7 @@ var heldLocks, HELD_LOCKS_ENV = "ABSOLUTE_HELD_BUILD_DIRECTORY_LOCKS", exitHandl
|
|
|
10243
10346
|
releaseAllSync();
|
|
10244
10347
|
throw err;
|
|
10245
10348
|
});
|
|
10246
|
-
}, isAlreadyExistsError = (error) => error instanceof Error && ("code" in error) && error.code === "EEXIST", lockPathForBuildDirectory = (buildDirectory) =>
|
|
10349
|
+
}, isAlreadyExistsError = (error) => error instanceof Error && ("code" in error) && error.code === "EEXIST", lockPathForBuildDirectory = (buildDirectory) => join16(dirname11(buildDirectory), ".absolutejs", "build.lock"), readHeldLockEnv = () => new Set((process.env[HELD_LOCKS_ENV] ?? "").split(`
|
|
10247
10350
|
`).filter((entry) => entry.length > 0)), writeHeldLockEnv = (locks) => {
|
|
10248
10351
|
if (locks.size === 0) {
|
|
10249
10352
|
delete process.env[HELD_LOCKS_ENV];
|
|
@@ -10260,7 +10363,7 @@ var heldLocks, HELD_LOCKS_ENV = "ABSOLUTE_HELD_BUILD_DIRECTORY_LOCKS", exitHandl
|
|
|
10260
10363
|
locks.delete(buildDirectory);
|
|
10261
10364
|
writeHeldLockEnv(locks);
|
|
10262
10365
|
}, writeLockFileSync = (lockPath, metadata2) => {
|
|
10263
|
-
mkdirSync6(
|
|
10366
|
+
mkdirSync6(dirname11(lockPath), { recursive: true });
|
|
10264
10367
|
writeFileSync7(lockPath, JSON.stringify(metadata2, null, 2), { flag: "wx" });
|
|
10265
10368
|
}, readLockMetadata = (lockPath) => {
|
|
10266
10369
|
try {
|
|
@@ -10380,11 +10483,11 @@ var init_buildDirectoryLock = __esm(() => {
|
|
|
10380
10483
|
});
|
|
10381
10484
|
|
|
10382
10485
|
// src/utils/validateSafePath.ts
|
|
10383
|
-
import { resolve as
|
|
10486
|
+
import { resolve as resolve19, relative as relative8 } from "path";
|
|
10384
10487
|
var validateSafePath = (targetPath, baseDirectory) => {
|
|
10385
|
-
const absoluteBase =
|
|
10386
|
-
const absoluteTarget =
|
|
10387
|
-
const relativePath = normalizePath(
|
|
10488
|
+
const absoluteBase = resolve19(baseDirectory);
|
|
10489
|
+
const absoluteTarget = resolve19(baseDirectory, targetPath);
|
|
10490
|
+
const relativePath = normalizePath(relative8(absoluteBase, absoluteTarget));
|
|
10388
10491
|
if (relativePath.startsWith("../") || relativePath === "..") {
|
|
10389
10492
|
throw new Error(`Unsafe path: ${targetPath}`);
|
|
10390
10493
|
}
|
|
@@ -10455,32 +10558,32 @@ __export(exports_compileSvelte, {
|
|
|
10455
10558
|
clearSvelteCompilerCache: () => clearSvelteCompilerCache
|
|
10456
10559
|
});
|
|
10457
10560
|
import { existsSync as existsSync15 } from "fs";
|
|
10458
|
-
import { mkdir as
|
|
10561
|
+
import { mkdir as mkdir4, stat as stat2 } from "fs/promises";
|
|
10459
10562
|
import {
|
|
10460
|
-
dirname as
|
|
10461
|
-
join as
|
|
10563
|
+
dirname as dirname12,
|
|
10564
|
+
join as join17,
|
|
10462
10565
|
basename as basename5,
|
|
10463
10566
|
extname as extname5,
|
|
10464
|
-
resolve as
|
|
10465
|
-
relative as
|
|
10567
|
+
resolve as resolve20,
|
|
10568
|
+
relative as relative9,
|
|
10466
10569
|
sep as sep2
|
|
10467
10570
|
} from "path";
|
|
10468
10571
|
import { env as env2 } from "process";
|
|
10469
|
-
var {write, file: file2, Transpiler } = globalThis.Bun;
|
|
10572
|
+
var {write, file: file2, Transpiler: Transpiler2 } = globalThis.Bun;
|
|
10470
10573
|
var resolveDevClientDir2 = () => {
|
|
10471
10574
|
const projectRoot = process.cwd();
|
|
10472
|
-
const fromSource =
|
|
10575
|
+
const fromSource = resolve20(import.meta.dir, "../dev/client");
|
|
10473
10576
|
if (existsSync15(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
10474
10577
|
return fromSource;
|
|
10475
10578
|
}
|
|
10476
|
-
const fromNodeModules =
|
|
10579
|
+
const fromNodeModules = resolve20(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
10477
10580
|
if (existsSync15(fromNodeModules))
|
|
10478
10581
|
return fromNodeModules;
|
|
10479
|
-
return
|
|
10582
|
+
return resolve20(import.meta.dir, "./dev/client");
|
|
10480
10583
|
}, devClientDir2, hmrClientPath3, persistentCache, sourceHashCache, clearSvelteCompilerCache = () => {
|
|
10481
10584
|
persistentCache.clear();
|
|
10482
10585
|
sourceHashCache.clear();
|
|
10483
|
-
},
|
|
10586
|
+
}, transpiler3, removeUnusedRequireHelper = (code) => {
|
|
10484
10587
|
const helperStart = code.indexOf("var __require = /* @__PURE__ */");
|
|
10485
10588
|
if (helperStart === -1) {
|
|
10486
10589
|
return code;
|
|
@@ -10506,7 +10609,7 @@ var resolveDevClientDir2 = () => {
|
|
|
10506
10609
|
}, resolveRelativeModule2 = async (spec, from) => {
|
|
10507
10610
|
if (!spec.startsWith("."))
|
|
10508
10611
|
return null;
|
|
10509
|
-
const basePath =
|
|
10612
|
+
const basePath = resolve20(dirname12(from), spec);
|
|
10510
10613
|
const candidates = [
|
|
10511
10614
|
basePath,
|
|
10512
10615
|
`${basePath}.ts`,
|
|
@@ -10517,14 +10620,14 @@ var resolveDevClientDir2 = () => {
|
|
|
10517
10620
|
`${basePath}.svelte`,
|
|
10518
10621
|
`${basePath}.svelte.ts`,
|
|
10519
10622
|
`${basePath}.svelte.js`,
|
|
10520
|
-
|
|
10521
|
-
|
|
10522
|
-
|
|
10523
|
-
|
|
10524
|
-
|
|
10525
|
-
|
|
10526
|
-
|
|
10527
|
-
|
|
10623
|
+
join17(basePath, "index.ts"),
|
|
10624
|
+
join17(basePath, "index.js"),
|
|
10625
|
+
join17(basePath, "index.mjs"),
|
|
10626
|
+
join17(basePath, "index.cjs"),
|
|
10627
|
+
join17(basePath, "index.json"),
|
|
10628
|
+
join17(basePath, "index.svelte"),
|
|
10629
|
+
join17(basePath, "index.svelte.ts"),
|
|
10630
|
+
join17(basePath, "index.svelte.js")
|
|
10528
10631
|
];
|
|
10529
10632
|
const checks = await Promise.all(candidates.map(exists));
|
|
10530
10633
|
return candidates.find((_2, index) => checks[index]) ?? null;
|
|
@@ -10533,7 +10636,7 @@ var resolveDevClientDir2 = () => {
|
|
|
10533
10636
|
const resolved = resolvePackageImport(spec);
|
|
10534
10637
|
return resolved && /\.svelte(\.(?:ts|js))?$/.test(resolved) ? resolved : null;
|
|
10535
10638
|
}
|
|
10536
|
-
const basePath =
|
|
10639
|
+
const basePath = resolve20(dirname12(from), spec);
|
|
10537
10640
|
const explicit = /\.(svelte|svelte\.(?:ts|js))$/.test(basePath);
|
|
10538
10641
|
if (!explicit) {
|
|
10539
10642
|
const extensions = [".svelte", ".svelte.ts", ".svelte.js"];
|
|
@@ -10554,8 +10657,8 @@ var resolveDevClientDir2 = () => {
|
|
|
10554
10657
|
return jsPath;
|
|
10555
10658
|
return null;
|
|
10556
10659
|
}, addModuleRewrite = (rewrites, rawSpec, resolvedModule, ssrOutputDir, clientOutputDir) => {
|
|
10557
|
-
const toServer =
|
|
10558
|
-
const toClient =
|
|
10660
|
+
const toServer = relative9(ssrOutputDir, resolvedModule).replace(/\\/g, "/");
|
|
10661
|
+
const toClient = relative9(clientOutputDir, resolvedModule).replace(/\\/g, "/");
|
|
10559
10662
|
rewrites.set(rawSpec, {
|
|
10560
10663
|
client: toClient.startsWith(".") || toClient.startsWith("/") ? toClient : `./${toClient}`,
|
|
10561
10664
|
server: toServer.startsWith(".") ? toServer : `./${toServer}`
|
|
@@ -10563,10 +10666,10 @@ var resolveDevClientDir2 = () => {
|
|
|
10563
10666
|
}, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev2 = false, stylePreprocessors) => {
|
|
10564
10667
|
const { compile, compileModule, preprocess } = await import("svelte/compiler");
|
|
10565
10668
|
const generatedDir = getFrameworkGeneratedDir("svelte");
|
|
10566
|
-
const clientDir =
|
|
10567
|
-
const indexDir =
|
|
10568
|
-
const serverDir =
|
|
10569
|
-
await Promise.all([clientDir, indexDir, serverDir].map((dir) =>
|
|
10669
|
+
const clientDir = join17(generatedDir, "client");
|
|
10670
|
+
const indexDir = join17(generatedDir, "indexes");
|
|
10671
|
+
const serverDir = join17(generatedDir, "server");
|
|
10672
|
+
await Promise.all([clientDir, indexDir, serverDir].map((dir) => mkdir4(dir, { recursive: true })));
|
|
10570
10673
|
const dev = env2.NODE_ENV !== "production";
|
|
10571
10674
|
const build2 = async (src) => {
|
|
10572
10675
|
const memoized = cache.get(src);
|
|
@@ -10591,10 +10694,10 @@ var resolveDevClientDir2 = () => {
|
|
|
10591
10694
|
const svelteStylePreprocessor = createSvelteStylePreprocessor(stylePreprocessors);
|
|
10592
10695
|
const preprocessedServer = isModule ? loweredServerSource.code : (await preprocess(loweredServerSource.code, svelteStylePreprocessor)).code;
|
|
10593
10696
|
const preprocessedClient = isModule ? loweredClientSource.code : (await preprocess(loweredClientSource.code, svelteStylePreprocessor)).code;
|
|
10594
|
-
const transpiledServer = src.endsWith(".ts") || src.endsWith(".svelte.ts") ?
|
|
10595
|
-
const transpiledClient = src.endsWith(".ts") || src.endsWith(".svelte.ts") ?
|
|
10596
|
-
const rawRel =
|
|
10597
|
-
const relDir = rawRel.startsWith("..") ? `_ext/${
|
|
10697
|
+
const transpiledServer = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler3.transformSync(preprocessedServer) : preprocessedServer;
|
|
10698
|
+
const transpiledClient = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler3.transformSync(preprocessedClient) : preprocessedClient;
|
|
10699
|
+
const rawRel = dirname12(relative9(svelteRoot, src)).replace(/\\/g, "/");
|
|
10700
|
+
const relDir = rawRel.startsWith("..") ? `_ext/${relative9(process.cwd(), dirname12(src)).replace(/\\/g, "/")}` : rawRel;
|
|
10598
10701
|
const baseName = basename5(src).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
10599
10702
|
const importPaths = Array.from(transpiledServer.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((path) => path !== undefined);
|
|
10600
10703
|
const resolvedModuleImports = await Promise.all(importPaths.map((importPath) => resolveRelativeModule2(importPath, src)));
|
|
@@ -10603,8 +10706,8 @@ var resolveDevClientDir2 = () => {
|
|
|
10603
10706
|
const childBuilt = await Promise.all(childSources.map((child) => build2(child)));
|
|
10604
10707
|
const hasAwaitSlotFromChildren = childBuilt.some((child) => child.hasAwaitSlot);
|
|
10605
10708
|
const externalRewrites = new Map;
|
|
10606
|
-
const ssrOutputDir =
|
|
10607
|
-
const clientOutputDir =
|
|
10709
|
+
const ssrOutputDir = dirname12(join17(serverDir, relDir, `${baseName}.js`));
|
|
10710
|
+
const clientOutputDir = dirname12(join17(clientDir, relDir, `${baseName}.js`));
|
|
10608
10711
|
for (let idx = 0;idx < importPaths.length; idx++) {
|
|
10609
10712
|
const rawSpec = importPaths[idx];
|
|
10610
10713
|
if (!rawSpec)
|
|
@@ -10615,15 +10718,15 @@ var resolveDevClientDir2 = () => {
|
|
|
10615
10718
|
addModuleRewrite(externalRewrites, rawSpec, resolvedModule, ssrOutputDir, clientOutputDir);
|
|
10616
10719
|
if (!resolved)
|
|
10617
10720
|
continue;
|
|
10618
|
-
const childRel =
|
|
10721
|
+
const childRel = relative9(svelteRoot, resolved).replace(/\\/g, "/");
|
|
10619
10722
|
if (!childRel.startsWith(".."))
|
|
10620
10723
|
continue;
|
|
10621
10724
|
const childBuilt2 = cache.get(resolved);
|
|
10622
10725
|
if (!childBuilt2)
|
|
10623
10726
|
continue;
|
|
10624
10727
|
const origSpec = rawSpec.replace(/\.svelte(?:\.(?:ts|js))?$/, ".js");
|
|
10625
|
-
const toServer =
|
|
10626
|
-
const toClient =
|
|
10728
|
+
const toServer = relative9(ssrOutputDir, childBuilt2.ssr).replace(/\\/g, "/");
|
|
10729
|
+
const toClient = relative9(clientOutputDir, childBuilt2.client).replace(/\\/g, "/");
|
|
10627
10730
|
externalRewrites.set(origSpec, {
|
|
10628
10731
|
client: toClient.startsWith(".") ? toClient : `./${toClient}`,
|
|
10629
10732
|
server: toServer.startsWith(".") ? toServer : `./${toServer}`
|
|
@@ -10657,7 +10760,7 @@ var resolveDevClientDir2 = () => {
|
|
|
10657
10760
|
}).js.code;
|
|
10658
10761
|
let code = compiled.replace(/\.svelte(?:\.(?:ts|js))?(['"])/g, ".js$1");
|
|
10659
10762
|
if (mode === "client" && isDev2) {
|
|
10660
|
-
const moduleKey = `/@src/${
|
|
10763
|
+
const moduleKey = `/@src/${relative9(process.cwd(), src).replace(/\\/g, "/")}`;
|
|
10661
10764
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
10662
10765
|
if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
10663
10766
|
var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleKey)}] = cb; };`);
|
|
@@ -10669,11 +10772,11 @@ var resolveDevClientDir2 = () => {
|
|
|
10669
10772
|
code += islandMetadataExports;
|
|
10670
10773
|
return code;
|
|
10671
10774
|
};
|
|
10672
|
-
const ssrPath =
|
|
10673
|
-
const clientPath =
|
|
10775
|
+
const ssrPath = join17(serverDir, relDir, `${baseName}.js`);
|
|
10776
|
+
const clientPath = join17(clientDir, relDir, `${baseName}.js`);
|
|
10674
10777
|
await Promise.all([
|
|
10675
|
-
|
|
10676
|
-
|
|
10778
|
+
mkdir4(dirname12(ssrPath), { recursive: true }),
|
|
10779
|
+
mkdir4(dirname12(clientPath), { recursive: true })
|
|
10677
10780
|
]);
|
|
10678
10781
|
if (isModule) {
|
|
10679
10782
|
const bundle = rewriteExternalImports(generate("client"), "client");
|
|
@@ -10700,10 +10803,10 @@ var resolveDevClientDir2 = () => {
|
|
|
10700
10803
|
};
|
|
10701
10804
|
const roots = await Promise.all(entryPoints.map(build2));
|
|
10702
10805
|
await Promise.all(roots.map(async ({ client: client2, hasAwaitSlot }) => {
|
|
10703
|
-
const relClientDir =
|
|
10806
|
+
const relClientDir = dirname12(relative9(clientDir, client2));
|
|
10704
10807
|
const name = basename5(client2, extname5(client2));
|
|
10705
|
-
const indexPath =
|
|
10706
|
-
const importRaw =
|
|
10808
|
+
const indexPath = join17(indexDir, relClientDir, `${name}.js`);
|
|
10809
|
+
const importRaw = relative9(dirname12(indexPath), client2).split(sep2).join("/");
|
|
10707
10810
|
const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
|
|
10708
10811
|
const hmrImports = isDev2 ? `window.__HMR_FRAMEWORK__ = "svelte";
|
|
10709
10812
|
import "${hmrClientPath3}";
|
|
@@ -10774,14 +10877,14 @@ if (typeof window !== "undefined") {
|
|
|
10774
10877
|
setTimeout(releaseStreamingSlots, 0);
|
|
10775
10878
|
}
|
|
10776
10879
|
}`;
|
|
10777
|
-
await
|
|
10880
|
+
await mkdir4(dirname12(indexPath), { recursive: true });
|
|
10778
10881
|
return write(indexPath, bootstrap);
|
|
10779
10882
|
}));
|
|
10780
10883
|
return {
|
|
10781
10884
|
svelteClientPaths: roots.map(({ client: client2 }) => client2),
|
|
10782
10885
|
svelteIndexPaths: roots.map(({ client: client2 }) => {
|
|
10783
|
-
const rel =
|
|
10784
|
-
return
|
|
10886
|
+
const rel = dirname12(relative9(clientDir, client2));
|
|
10887
|
+
return join17(indexDir, rel, basename5(client2));
|
|
10785
10888
|
}),
|
|
10786
10889
|
svelteServerPaths: roots.map(({ ssr }) => ssr)
|
|
10787
10890
|
};
|
|
@@ -10796,10 +10899,10 @@ var init_compileSvelte = __esm(() => {
|
|
|
10796
10899
|
init_lowerAwaitSlotSyntax();
|
|
10797
10900
|
init_renderToReadableStream();
|
|
10798
10901
|
devClientDir2 = resolveDevClientDir2();
|
|
10799
|
-
hmrClientPath3 =
|
|
10902
|
+
hmrClientPath3 = join17(devClientDir2, "hmrClient.ts").replace(/\\/g, "/");
|
|
10800
10903
|
persistentCache = new Map;
|
|
10801
10904
|
sourceHashCache = new Map;
|
|
10802
|
-
|
|
10905
|
+
transpiler3 = new Transpiler2({ loader: "ts", target: "browser" });
|
|
10803
10906
|
});
|
|
10804
10907
|
|
|
10805
10908
|
// src/build/vueAutoRouterTransform.ts
|
|
@@ -10863,27 +10966,27 @@ __export(exports_compileVue, {
|
|
|
10863
10966
|
clearVueHmrCaches: () => clearVueHmrCaches
|
|
10864
10967
|
});
|
|
10865
10968
|
import { existsSync as existsSync16 } from "fs";
|
|
10866
|
-
import { mkdir as
|
|
10969
|
+
import { mkdir as mkdir5 } from "fs/promises";
|
|
10867
10970
|
import {
|
|
10868
10971
|
basename as basename6,
|
|
10869
|
-
dirname as
|
|
10972
|
+
dirname as dirname13,
|
|
10870
10973
|
isAbsolute as isAbsolute3,
|
|
10871
|
-
join as
|
|
10872
|
-
relative as
|
|
10873
|
-
resolve as
|
|
10974
|
+
join as join18,
|
|
10975
|
+
relative as relative10,
|
|
10976
|
+
resolve as resolve21
|
|
10874
10977
|
} from "path";
|
|
10875
|
-
var {file: file3, write: write2, Transpiler:
|
|
10978
|
+
var {file: file3, write: write2, Transpiler: Transpiler3 } = globalThis.Bun;
|
|
10876
10979
|
var resolveDevClientDir3 = () => {
|
|
10877
10980
|
const projectRoot = process.cwd();
|
|
10878
|
-
const fromSource =
|
|
10981
|
+
const fromSource = resolve21(import.meta.dir, "../dev/client");
|
|
10879
10982
|
if (existsSync16(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
10880
10983
|
return fromSource;
|
|
10881
10984
|
}
|
|
10882
|
-
const fromNodeModules =
|
|
10985
|
+
const fromNodeModules = resolve21(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
10883
10986
|
if (existsSync16(fromNodeModules))
|
|
10884
10987
|
return fromNodeModules;
|
|
10885
|
-
return
|
|
10886
|
-
}, devClientDir3, hmrClientPath4,
|
|
10988
|
+
return resolve21(import.meta.dir, "./dev/client");
|
|
10989
|
+
}, devClientDir3, hmrClientPath4, transpiler4, scriptCache, scriptSetupCache, templateCache, styleCache, persistentBuildCache, vueSourceHashCache, vueHmrMetadata, clearVueHmrCaches = () => {
|
|
10887
10990
|
scriptCache.clear();
|
|
10888
10991
|
scriptSetupCache.clear();
|
|
10889
10992
|
templateCache.clear();
|
|
@@ -10921,19 +11024,19 @@ var resolveDevClientDir3 = () => {
|
|
|
10921
11024
|
return "template-only";
|
|
10922
11025
|
}
|
|
10923
11026
|
return "full";
|
|
10924
|
-
}, generateVueHmrId = (sourceFilePath, vueRootDir) =>
|
|
11027
|
+
}, generateVueHmrId = (sourceFilePath, vueRootDir) => relative10(vueRootDir, sourceFilePath).replace(/\\/g, "/").replace(/\.vue$/, ""), extractImports = (sourceCode) => Array.from(sourceCode.matchAll(/import\s+[\s\S]+?['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((importPath) => importPath !== undefined), toJs = (filePath, sourceDir) => {
|
|
10925
11028
|
if (filePath.endsWith(".vue"))
|
|
10926
11029
|
return filePath.replace(/\.vue$/, ".js");
|
|
10927
11030
|
if (filePath.endsWith(".ts"))
|
|
10928
11031
|
return filePath.replace(/\.ts$/, ".js");
|
|
10929
11032
|
if (isStylePath(filePath)) {
|
|
10930
11033
|
if (sourceDir && (filePath.startsWith("./") || filePath.startsWith("../"))) {
|
|
10931
|
-
return
|
|
11034
|
+
return resolve21(sourceDir, filePath);
|
|
10932
11035
|
}
|
|
10933
11036
|
return filePath;
|
|
10934
11037
|
}
|
|
10935
11038
|
return `${filePath}.js`;
|
|
10936
|
-
},
|
|
11039
|
+
}, stripExports2 = (code) => code.replace(/export\s+default/, "const script ="), mergeVueImports2 = (code) => {
|
|
10937
11040
|
const lines = code.split(`
|
|
10938
11041
|
`);
|
|
10939
11042
|
const specifierSet = new Set;
|
|
@@ -10954,7 +11057,7 @@ var resolveDevClientDir3 = () => {
|
|
|
10954
11057
|
const cachedResult = cacheMap.get(sourceFilePath);
|
|
10955
11058
|
if (cachedResult)
|
|
10956
11059
|
return cachedResult;
|
|
10957
|
-
const relativeFilePath =
|
|
11060
|
+
const relativeFilePath = relative10(vueRootDir, sourceFilePath).replace(/\\/g, "/");
|
|
10958
11061
|
const relativeWithoutExtension = relativeFilePath.replace(/\.vue$/, "");
|
|
10959
11062
|
const fileBaseName = basename6(sourceFilePath, ".vue");
|
|
10960
11063
|
const componentId = toKebab(fileBaseName);
|
|
@@ -10992,12 +11095,12 @@ var resolveDevClientDir3 = () => {
|
|
|
10992
11095
|
const childComponentPaths = importPaths.filter((path) => path.startsWith(".") && path.endsWith(".vue"));
|
|
10993
11096
|
const packageComponentPaths = Array.from(resolvedPackageVueImports.entries());
|
|
10994
11097
|
const helperModulePaths = importPaths.filter((path) => path.startsWith(".") && !path.endsWith(".vue") && !isStylePath(path));
|
|
10995
|
-
const stylePathsImported = importPaths.filter((path) => (path.startsWith(".") || isAbsolute3(path)) && isStylePath(path)).map((path) => isAbsolute3(path) ? path :
|
|
11098
|
+
const stylePathsImported = importPaths.filter((path) => (path.startsWith(".") || isAbsolute3(path)) && isStylePath(path)).map((path) => isAbsolute3(path) ? path : resolve21(dirname13(sourceFilePath), path));
|
|
10996
11099
|
for (const stylePath of stylePathsImported) {
|
|
10997
11100
|
addStyleImporter(sourceFilePath, stylePath);
|
|
10998
11101
|
}
|
|
10999
11102
|
const childBuildResults = await Promise.all([
|
|
11000
|
-
...childComponentPaths.map((relativeChildPath) => compileVueFile(
|
|
11103
|
+
...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve21(dirname13(sourceFilePath), relativeChildPath), outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors)),
|
|
11001
11104
|
...packageComponentPaths.map(([, absolutePath]) => compileVueFile(absolutePath, outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors))
|
|
11002
11105
|
]);
|
|
11003
11106
|
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
@@ -11005,9 +11108,9 @@ var resolveDevClientDir3 = () => {
|
|
|
11005
11108
|
id: componentId,
|
|
11006
11109
|
inlineTemplate: false
|
|
11007
11110
|
}) : { bindings: {}, content: "export default {};" };
|
|
11008
|
-
const strippedScript =
|
|
11009
|
-
const sourceDir =
|
|
11010
|
-
const transpiledScript =
|
|
11111
|
+
const strippedScript = stripExports2(compiledScript.content);
|
|
11112
|
+
const sourceDir = dirname13(sourceFilePath);
|
|
11113
|
+
const transpiledScript = transpiler4.transformSync(strippedScript).replace(/(['"])(\.{1,2}\/[^'"]+)(['"])/g, (_2, quoteStart, relativeImport, quoteEnd) => `${quoteStart}${toJs(relativeImport, sourceDir)}${quoteEnd}`);
|
|
11011
11114
|
const packageImportRewrites = new Map;
|
|
11012
11115
|
for (const [bareImport, absolutePath] of packageComponentPaths) {
|
|
11013
11116
|
const childResult = cacheMap.get(absolutePath);
|
|
@@ -11021,6 +11124,8 @@ var resolveDevClientDir3 = () => {
|
|
|
11021
11124
|
const generateRenderFunction = (ssr) => compiler.compileTemplate({
|
|
11022
11125
|
compilerOptions: {
|
|
11023
11126
|
bindingMetadata: compiledScript.bindings,
|
|
11127
|
+
expressionPlugins: ["typescript"],
|
|
11128
|
+
isCustomElement: (tag) => tag === "absolute-island",
|
|
11024
11129
|
prefixIdentifiers: true
|
|
11025
11130
|
},
|
|
11026
11131
|
filename: sourceFilePath,
|
|
@@ -11043,8 +11148,8 @@ var resolveDevClientDir3 = () => {
|
|
|
11043
11148
|
];
|
|
11044
11149
|
let cssOutputPaths = [];
|
|
11045
11150
|
if (isEntryPoint && allCss.length) {
|
|
11046
|
-
const cssOutputFile =
|
|
11047
|
-
await
|
|
11151
|
+
const cssOutputFile = join18(outputDirs.css, `${toKebab(fileBaseName)}-compiled.css`);
|
|
11152
|
+
await mkdir5(dirname13(cssOutputFile), { recursive: true });
|
|
11048
11153
|
await write2(cssOutputFile, allCss.join(`
|
|
11049
11154
|
`));
|
|
11050
11155
|
cssOutputPaths = [cssOutputFile];
|
|
@@ -11062,7 +11167,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
11062
11167
|
window.__VUE_HMR_COMPONENTS__[script.__hmrId] = script;
|
|
11063
11168
|
}
|
|
11064
11169
|
}` : "";
|
|
11065
|
-
return
|
|
11170
|
+
return mergeVueImports2([
|
|
11066
11171
|
transpiledScript,
|
|
11067
11172
|
renderCode,
|
|
11068
11173
|
`script.${renderFnName} = ${renderFnName};`,
|
|
@@ -11074,9 +11179,9 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
11074
11179
|
};
|
|
11075
11180
|
const clientCode = assembleModule(generateRenderFunction(false), "render", true) + islandMetadataExports;
|
|
11076
11181
|
const serverCode = assembleModule(generateRenderFunction(true), "ssrRender", false) + islandMetadataExports;
|
|
11077
|
-
const clientOutputPath =
|
|
11078
|
-
const serverOutputPath =
|
|
11079
|
-
const relDir =
|
|
11182
|
+
const clientOutputPath = join18(outputDirs.client, `${relativeWithoutExtension}.js`);
|
|
11183
|
+
const serverOutputPath = join18(outputDirs.server, `${relativeWithoutExtension}.js`);
|
|
11184
|
+
const relDir = dirname13(relativeFilePath);
|
|
11080
11185
|
const relDepth = relDir === "." ? 0 : relDir.split("/").length;
|
|
11081
11186
|
const adjustImports = (code) => code.replace(/(from\s+['"])(\.\.\/(?:\.\.\/)*)/g, (_2, prefix, dots) => {
|
|
11082
11187
|
const upCount = dots.split("/").length - 1;
|
|
@@ -11088,15 +11193,15 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
11088
11193
|
let result2 = code;
|
|
11089
11194
|
for (const [bareImport, paths] of packageImportRewrites) {
|
|
11090
11195
|
const targetPath = mode === "server" ? paths.server : paths.client;
|
|
11091
|
-
let rel =
|
|
11196
|
+
let rel = relative10(dirname13(outputPath), targetPath).replace(/\\/g, "/");
|
|
11092
11197
|
if (!rel.startsWith("."))
|
|
11093
11198
|
rel = `./${rel}`;
|
|
11094
11199
|
result2 = result2.replaceAll(bareImport, rel);
|
|
11095
11200
|
}
|
|
11096
11201
|
return result2;
|
|
11097
11202
|
};
|
|
11098
|
-
await
|
|
11099
|
-
await
|
|
11203
|
+
await mkdir5(dirname13(clientOutputPath), { recursive: true });
|
|
11204
|
+
await mkdir5(dirname13(serverOutputPath), { recursive: true });
|
|
11100
11205
|
await write2(clientOutputPath, rewritePackageImports(adjustImports(clientCode), clientOutputPath, "client"));
|
|
11101
11206
|
await write2(serverOutputPath, rewritePackageImports(adjustImports(serverCode), serverOutputPath, "server"));
|
|
11102
11207
|
const result = {
|
|
@@ -11106,7 +11211,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
11106
11211
|
hmrId,
|
|
11107
11212
|
serverPath: serverOutputPath,
|
|
11108
11213
|
tsHelperPaths: [
|
|
11109
|
-
...helperModulePaths.map((helper) =>
|
|
11214
|
+
...helperModulePaths.map((helper) => resolve21(dirname13(sourceFilePath), helper.endsWith(".ts") ? helper : `${helper}.ts`)),
|
|
11110
11215
|
...childBuildResults.flatMap((child) => child.tsHelperPaths)
|
|
11111
11216
|
]
|
|
11112
11217
|
};
|
|
@@ -11116,36 +11221,36 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
11116
11221
|
}, compileVue = async (entryPoints, vueRootDir, isDev2 = false, stylePreprocessors) => {
|
|
11117
11222
|
const compiler = await import("@vue/compiler-sfc");
|
|
11118
11223
|
const generatedDir = getFrameworkGeneratedDir("vue");
|
|
11119
|
-
const clientOutputDir =
|
|
11120
|
-
const indexOutputDir =
|
|
11121
|
-
const serverOutputDir =
|
|
11122
|
-
const cssOutputDir =
|
|
11224
|
+
const clientOutputDir = join18(generatedDir, "client");
|
|
11225
|
+
const indexOutputDir = join18(generatedDir, "indexes");
|
|
11226
|
+
const serverOutputDir = join18(generatedDir, "server");
|
|
11227
|
+
const cssOutputDir = join18(generatedDir, "compiled");
|
|
11123
11228
|
await Promise.all([
|
|
11124
|
-
|
|
11125
|
-
|
|
11126
|
-
|
|
11127
|
-
|
|
11229
|
+
mkdir5(clientOutputDir, { recursive: true }),
|
|
11230
|
+
mkdir5(indexOutputDir, { recursive: true }),
|
|
11231
|
+
mkdir5(serverOutputDir, { recursive: true }),
|
|
11232
|
+
mkdir5(cssOutputDir, { recursive: true })
|
|
11128
11233
|
]);
|
|
11129
11234
|
const buildCache = new Map;
|
|
11130
11235
|
const allTsHelperPaths = new Set;
|
|
11131
11236
|
const compiledPages = await Promise.all(entryPoints.map(async (entryPath) => {
|
|
11132
|
-
const result = await compileVueFile(
|
|
11237
|
+
const result = await compileVueFile(resolve21(entryPath), {
|
|
11133
11238
|
client: clientOutputDir,
|
|
11134
11239
|
css: cssOutputDir,
|
|
11135
11240
|
server: serverOutputDir
|
|
11136
11241
|
}, buildCache, true, vueRootDir, compiler, stylePreprocessors);
|
|
11137
11242
|
result.tsHelperPaths.forEach((path) => allTsHelperPaths.add(path));
|
|
11138
11243
|
const entryBaseName = basename6(entryPath, ".vue");
|
|
11139
|
-
const indexOutputFile =
|
|
11140
|
-
const clientOutputFile =
|
|
11141
|
-
await
|
|
11244
|
+
const indexOutputFile = join18(indexOutputDir, `${entryBaseName}.js`);
|
|
11245
|
+
const clientOutputFile = join18(clientOutputDir, relative10(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
|
|
11246
|
+
await mkdir5(dirname13(indexOutputFile), { recursive: true });
|
|
11142
11247
|
const vueHmrImports = isDev2 ? [
|
|
11143
11248
|
`window.__HMR_FRAMEWORK__ = "vue";`,
|
|
11144
11249
|
`import "${hmrClientPath4}";`
|
|
11145
11250
|
] : [];
|
|
11146
11251
|
await write2(indexOutputFile, [
|
|
11147
11252
|
...vueHmrImports,
|
|
11148
|
-
`import Comp, * as PageModule from "${
|
|
11253
|
+
`import Comp, * as PageModule from "${relative10(dirname13(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
|
|
11149
11254
|
'import { createSSRApp, createApp } from "vue";',
|
|
11150
11255
|
"",
|
|
11151
11256
|
"// HMR State Preservation: Check for preserved state from HMR",
|
|
@@ -11288,12 +11393,12 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
11288
11393
|
}));
|
|
11289
11394
|
await Promise.all(Array.from(allTsHelperPaths).map(async (tsPath) => {
|
|
11290
11395
|
const sourceCode = await file3(tsPath).text();
|
|
11291
|
-
const transpiledCode =
|
|
11292
|
-
const relativeJsPath =
|
|
11293
|
-
const outClientPath =
|
|
11294
|
-
const outServerPath =
|
|
11295
|
-
await
|
|
11296
|
-
await
|
|
11396
|
+
const transpiledCode = transpiler4.transformSync(sourceCode);
|
|
11397
|
+
const relativeJsPath = relative10(vueRootDir, tsPath).replace(/\.ts$/, ".js");
|
|
11398
|
+
const outClientPath = join18(clientOutputDir, relativeJsPath);
|
|
11399
|
+
const outServerPath = join18(serverOutputDir, relativeJsPath);
|
|
11400
|
+
await mkdir5(dirname13(outClientPath), { recursive: true });
|
|
11401
|
+
await mkdir5(dirname13(outServerPath), { recursive: true });
|
|
11297
11402
|
await write2(outClientPath, transpiledCode);
|
|
11298
11403
|
await write2(outServerPath, transpiledCode);
|
|
11299
11404
|
}));
|
|
@@ -11313,8 +11418,8 @@ var init_compileVue = __esm(() => {
|
|
|
11313
11418
|
init_vueAutoRouterTransform();
|
|
11314
11419
|
init_stylePreprocessor();
|
|
11315
11420
|
devClientDir3 = resolveDevClientDir3();
|
|
11316
|
-
hmrClientPath4 =
|
|
11317
|
-
|
|
11421
|
+
hmrClientPath4 = join18(devClientDir3, "hmrClient.ts").replace(/\\/g, "/");
|
|
11422
|
+
transpiler4 = new Transpiler3({ loader: "ts", target: "browser" });
|
|
11318
11423
|
scriptCache = new Map;
|
|
11319
11424
|
scriptSetupCache = new Map;
|
|
11320
11425
|
templateCache = new Map;
|
|
@@ -11794,17 +11899,17 @@ __export(exports_compileAngular, {
|
|
|
11794
11899
|
compileAngular: () => compileAngular
|
|
11795
11900
|
});
|
|
11796
11901
|
import { existsSync as existsSync17, readFileSync as readFileSync13, promises as fs } from "fs";
|
|
11797
|
-
import { join as
|
|
11902
|
+
import { join as join19, basename as basename7, sep as sep3, dirname as dirname14, resolve as resolve22, relative as relative11 } from "path";
|
|
11798
11903
|
import ts2 from "typescript";
|
|
11799
11904
|
var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
11800
11905
|
const tracePhase = globalThis.__absoluteBuildTracePhase;
|
|
11801
11906
|
return tracePhase ? tracePhase(`compile/angular/${name}`, fn2, metadata2) : await fn2();
|
|
11802
11907
|
}, readTsconfigPathAliases = () => {
|
|
11803
11908
|
try {
|
|
11804
|
-
const configPath2 =
|
|
11909
|
+
const configPath2 = resolve22(process.cwd(), "tsconfig.json");
|
|
11805
11910
|
const config = ts2.readConfigFile(configPath2, ts2.sys.readFile).config;
|
|
11806
11911
|
const compilerOptions = config?.compilerOptions ?? {};
|
|
11807
|
-
const baseUrl =
|
|
11912
|
+
const baseUrl = resolve22(process.cwd(), compilerOptions.baseUrl ?? ".");
|
|
11808
11913
|
const aliases = Object.entries(compilerOptions.paths ?? {}).map(([pattern, replacements]) => ({ pattern, replacements }));
|
|
11809
11914
|
return { aliases, baseUrl };
|
|
11810
11915
|
} catch {
|
|
@@ -11824,7 +11929,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
11824
11929
|
const wildcardValue = exactMatch ? "" : specifier.slice(prefix.length, specifier.length - suffix.length);
|
|
11825
11930
|
for (const replacement of alias.replacements) {
|
|
11826
11931
|
const candidate = replacement.replace("*", wildcardValue);
|
|
11827
|
-
const resolved = resolveSourceFile(
|
|
11932
|
+
const resolved = resolveSourceFile(resolve22(baseUrl, candidate));
|
|
11828
11933
|
if (resolved)
|
|
11829
11934
|
return resolved;
|
|
11830
11935
|
}
|
|
@@ -11836,20 +11941,20 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
11836
11941
|
`${candidate}.tsx`,
|
|
11837
11942
|
`${candidate}.js`,
|
|
11838
11943
|
`${candidate}.jsx`,
|
|
11839
|
-
|
|
11840
|
-
|
|
11841
|
-
|
|
11842
|
-
|
|
11944
|
+
join19(candidate, "index.ts"),
|
|
11945
|
+
join19(candidate, "index.tsx"),
|
|
11946
|
+
join19(candidate, "index.js"),
|
|
11947
|
+
join19(candidate, "index.jsx")
|
|
11843
11948
|
];
|
|
11844
11949
|
return candidates.find((file4) => existsSync17(file4));
|
|
11845
11950
|
}, createLegacyAngularAnimationUsageResolver = (rootDir) => {
|
|
11846
|
-
const baseDir =
|
|
11951
|
+
const baseDir = resolve22(rootDir);
|
|
11847
11952
|
const tsconfigAliases = readTsconfigPathAliases();
|
|
11848
|
-
const
|
|
11953
|
+
const transpiler5 = new Bun.Transpiler({ loader: "tsx" });
|
|
11849
11954
|
const scanCache = new Map;
|
|
11850
11955
|
const resolveLocalImport = (specifier, fromDir) => {
|
|
11851
11956
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
11852
|
-
return resolveSourceFile(
|
|
11957
|
+
return resolveSourceFile(resolve22(fromDir, specifier));
|
|
11853
11958
|
}
|
|
11854
11959
|
const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile);
|
|
11855
11960
|
if (aliased)
|
|
@@ -11858,7 +11963,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
11858
11963
|
const resolved = Bun.resolveSync(specifier, fromDir);
|
|
11859
11964
|
if (resolved.includes("/node_modules/"))
|
|
11860
11965
|
return;
|
|
11861
|
-
const absolute =
|
|
11966
|
+
const absolute = resolve22(resolved);
|
|
11862
11967
|
if (!absolute.startsWith(baseDir))
|
|
11863
11968
|
return;
|
|
11864
11969
|
return resolveSourceFile(absolute);
|
|
@@ -11874,7 +11979,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
11874
11979
|
usesLegacyAnimations: false
|
|
11875
11980
|
});
|
|
11876
11981
|
}
|
|
11877
|
-
const resolved =
|
|
11982
|
+
const resolved = resolve22(actualPath);
|
|
11878
11983
|
const cached = scanCache.get(resolved);
|
|
11879
11984
|
if (cached)
|
|
11880
11985
|
return cached;
|
|
@@ -11887,7 +11992,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
11887
11992
|
}
|
|
11888
11993
|
let imports;
|
|
11889
11994
|
try {
|
|
11890
|
-
imports =
|
|
11995
|
+
imports = transpiler5.scanImports(sourceCode);
|
|
11891
11996
|
} catch {
|
|
11892
11997
|
return { imports: [], usesLegacyAnimations: false };
|
|
11893
11998
|
}
|
|
@@ -11903,7 +12008,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
11903
12008
|
const actualPath = resolveSourceFile(filePath);
|
|
11904
12009
|
if (!actualPath)
|
|
11905
12010
|
return false;
|
|
11906
|
-
const resolved =
|
|
12011
|
+
const resolved = resolve22(actualPath);
|
|
11907
12012
|
if (visited.has(resolved))
|
|
11908
12013
|
return false;
|
|
11909
12014
|
visited.add(resolved);
|
|
@@ -11911,7 +12016,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
11911
12016
|
if (scan.usesLegacyAnimations)
|
|
11912
12017
|
return true;
|
|
11913
12018
|
for (const specifier of scan.imports) {
|
|
11914
|
-
const importedPath = resolveLocalImport(specifier,
|
|
12019
|
+
const importedPath = resolveLocalImport(specifier, dirname14(resolved));
|
|
11915
12020
|
if (importedPath && await visit(importedPath, visited)) {
|
|
11916
12021
|
return true;
|
|
11917
12022
|
}
|
|
@@ -11921,14 +12026,14 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
11921
12026
|
return (entryPath) => visit(entryPath);
|
|
11922
12027
|
}, resolveDevClientDir4 = () => {
|
|
11923
12028
|
const projectRoot = process.cwd();
|
|
11924
|
-
const fromSource =
|
|
12029
|
+
const fromSource = resolve22(import.meta.dir, "../dev/client");
|
|
11925
12030
|
if (existsSync17(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
11926
12031
|
return fromSource;
|
|
11927
12032
|
}
|
|
11928
|
-
const fromNodeModules =
|
|
12033
|
+
const fromNodeModules = resolve22(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
11929
12034
|
if (existsSync17(fromNodeModules))
|
|
11930
12035
|
return fromNodeModules;
|
|
11931
|
-
return
|
|
12036
|
+
return resolve22(import.meta.dir, "./dev/client");
|
|
11932
12037
|
}, devClientDir4, hmrClientPath5, formatDiagnosticMessage = (diagnostic) => {
|
|
11933
12038
|
try {
|
|
11934
12039
|
return ts2.flattenDiagnosticMessageText(diagnostic.messageText, `
|
|
@@ -11970,12 +12075,12 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
11970
12075
|
return `${path.replace(/\.ts$/, ".js")}${query}`;
|
|
11971
12076
|
if (hasJsLikeExtension(path))
|
|
11972
12077
|
return `${path}${query}`;
|
|
11973
|
-
const importerDir =
|
|
11974
|
-
const fileCandidate =
|
|
12078
|
+
const importerDir = dirname14(importerOutputPath);
|
|
12079
|
+
const fileCandidate = resolve22(importerDir, `${path}.js`);
|
|
11975
12080
|
if (outputFiles?.has(fileCandidate) || existsSync17(fileCandidate)) {
|
|
11976
12081
|
return `${path}.js${query}`;
|
|
11977
12082
|
}
|
|
11978
|
-
const indexCandidate =
|
|
12083
|
+
const indexCandidate = resolve22(importerDir, path, "index.js");
|
|
11979
12084
|
if (outputFiles?.has(indexCandidate) || existsSync17(indexCandidate)) {
|
|
11980
12085
|
return `${path}/index.js${query}`;
|
|
11981
12086
|
}
|
|
@@ -12003,18 +12108,18 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
12003
12108
|
}, resolveLocalTsImport = (fromFile, specifier) => {
|
|
12004
12109
|
if (!isRelativeModuleSpecifier(specifier))
|
|
12005
12110
|
return null;
|
|
12006
|
-
const basePath =
|
|
12111
|
+
const basePath = resolve22(dirname14(fromFile), specifier);
|
|
12007
12112
|
const candidates = /\.[cm]?[tj]sx?$/.test(basePath) ? [basePath] : [
|
|
12008
12113
|
`${basePath}.ts`,
|
|
12009
12114
|
`${basePath}.tsx`,
|
|
12010
12115
|
`${basePath}.mts`,
|
|
12011
12116
|
`${basePath}.cts`,
|
|
12012
|
-
|
|
12013
|
-
|
|
12014
|
-
|
|
12015
|
-
|
|
12117
|
+
join19(basePath, "index.ts"),
|
|
12118
|
+
join19(basePath, "index.tsx"),
|
|
12119
|
+
join19(basePath, "index.mts"),
|
|
12120
|
+
join19(basePath, "index.cts")
|
|
12016
12121
|
];
|
|
12017
|
-
return candidates.map((candidate) =>
|
|
12122
|
+
return candidates.map((candidate) => resolve22(candidate)).find((candidate) => existsSync17(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
12018
12123
|
}, readFileForAotTransform = async (fileName, readFile6) => {
|
|
12019
12124
|
const hostSource = readFile6?.(fileName);
|
|
12020
12125
|
if (typeof hostSource === "string")
|
|
@@ -12038,18 +12143,18 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
12038
12143
|
const paths = [];
|
|
12039
12144
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
12040
12145
|
if (templateUrlMatch?.[1])
|
|
12041
|
-
paths.push(
|
|
12146
|
+
paths.push(join19(fileDir, templateUrlMatch[1]));
|
|
12042
12147
|
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
12043
12148
|
if (styleUrlMatch?.[1])
|
|
12044
|
-
paths.push(
|
|
12149
|
+
paths.push(join19(fileDir, styleUrlMatch[1]));
|
|
12045
12150
|
const styleUrlsMatch = findUncommentedMatch(source, /styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
12046
12151
|
const urlMatches = styleUrlsMatch?.[1]?.match(/['"]([^'"]+)['"]/g);
|
|
12047
12152
|
if (urlMatches) {
|
|
12048
12153
|
for (const urlMatch of urlMatches) {
|
|
12049
|
-
paths.push(
|
|
12154
|
+
paths.push(join19(fileDir, urlMatch.replace(/['"]/g, "")));
|
|
12050
12155
|
}
|
|
12051
12156
|
}
|
|
12052
|
-
return paths.map((path) =>
|
|
12157
|
+
return paths.map((path) => resolve22(path));
|
|
12053
12158
|
}, readResourceCacheFile = async (cachePath) => {
|
|
12054
12159
|
try {
|
|
12055
12160
|
const entry = JSON.parse(await fs.readFile(cachePath, "utf-8"));
|
|
@@ -12061,13 +12166,13 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
12061
12166
|
return null;
|
|
12062
12167
|
}
|
|
12063
12168
|
}, writeResourceCacheFile = async (cachePath, source) => {
|
|
12064
|
-
await fs.mkdir(
|
|
12169
|
+
await fs.mkdir(dirname14(cachePath), { recursive: true });
|
|
12065
12170
|
await fs.writeFile(cachePath, JSON.stringify({
|
|
12066
12171
|
source,
|
|
12067
12172
|
version: 1
|
|
12068
12173
|
}), "utf-8");
|
|
12069
12174
|
}, resolveResourceTransformCachePath = async (filePath, source, stylePreprocessors) => {
|
|
12070
|
-
const resourcePaths = collectAngularResourcePaths(source,
|
|
12175
|
+
const resourcePaths = collectAngularResourcePaths(source, dirname14(filePath));
|
|
12071
12176
|
const resourceContents = await Promise.all(resourcePaths.map(async (resourcePath) => {
|
|
12072
12177
|
const content = await fs.readFile(resourcePath, "utf-8");
|
|
12073
12178
|
return `${resourcePath}\x00${content}`;
|
|
@@ -12080,7 +12185,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
12080
12185
|
safeStableStringify(stylePreprocessors ?? null)
|
|
12081
12186
|
].join("\x00");
|
|
12082
12187
|
const cacheKey2 = Bun.hash(cacheInput).toString(BASE_36_RADIX);
|
|
12083
|
-
return
|
|
12188
|
+
return join19(process.cwd(), ".absolutejs", "cache", "angular-resources", `${cacheKey2}.json`);
|
|
12084
12189
|
}, precomputeAotResourceTransforms = async (inputPaths, readFile6, stylePreprocessors) => {
|
|
12085
12190
|
const transformedSources = new Map;
|
|
12086
12191
|
const visited = new Set;
|
|
@@ -12091,7 +12196,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
12091
12196
|
transformedFiles: 0
|
|
12092
12197
|
};
|
|
12093
12198
|
const transformFile = async (filePath) => {
|
|
12094
|
-
const resolvedPath =
|
|
12199
|
+
const resolvedPath = resolve22(filePath);
|
|
12095
12200
|
if (visited.has(resolvedPath))
|
|
12096
12201
|
return;
|
|
12097
12202
|
visited.add(resolvedPath);
|
|
@@ -12107,7 +12212,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
12107
12212
|
transformedSource = cached.source;
|
|
12108
12213
|
} else {
|
|
12109
12214
|
stats.cacheMisses += 1;
|
|
12110
|
-
const transformed = await inlineResources(source,
|
|
12215
|
+
const transformed = await inlineResources(source, dirname14(resolvedPath), stylePreprocessors);
|
|
12111
12216
|
transformedSource = transformed.source;
|
|
12112
12217
|
await writeResourceCacheFile(cachePath, transformedSource);
|
|
12113
12218
|
}
|
|
@@ -12126,7 +12231,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
12126
12231
|
return { stats, transformedSources };
|
|
12127
12232
|
}, compileAngularFiles = async (inputPaths, outDir, stylePreprocessors) => {
|
|
12128
12233
|
const islandMetadataByOutputPath = await traceAngularPhase("aot/island-metadata", () => new Map(inputPaths.map((inputPath) => {
|
|
12129
|
-
const outputPath =
|
|
12234
|
+
const outputPath = resolve22(join19(outDir, relative11(process.cwd(), resolve22(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
|
|
12130
12235
|
return [
|
|
12131
12236
|
outputPath,
|
|
12132
12237
|
buildIslandMetadataExports(readFileSync13(inputPath, "utf-8"))
|
|
@@ -12136,8 +12241,8 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
12136
12241
|
const { readConfiguration, performCompilation, EmitFlags } = await traceAngularPhase("aot/import-compiler-cli", () => import("@angular/compiler-cli"));
|
|
12137
12242
|
const tsLibDir = await traceAngularPhase("aot/resolve-typescript-lib", () => {
|
|
12138
12243
|
const tsPath = __require.resolve("typescript");
|
|
12139
|
-
const tsRootDir =
|
|
12140
|
-
return tsRootDir.endsWith("lib") ? tsRootDir :
|
|
12244
|
+
const tsRootDir = dirname14(tsPath);
|
|
12245
|
+
return tsRootDir.endsWith("lib") ? tsRootDir : resolve22(tsRootDir, "lib");
|
|
12141
12246
|
});
|
|
12142
12247
|
const config = await traceAngularPhase("aot/read-configuration", () => readConfiguration("./tsconfig.json"));
|
|
12143
12248
|
const options = {
|
|
@@ -12173,13 +12278,13 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
12173
12278
|
const originalGetSourceFile = host.getSourceFile;
|
|
12174
12279
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
12175
12280
|
if (fileName.startsWith("lib.") && fileName.endsWith(".d.ts") && tsLibDir) {
|
|
12176
|
-
const resolvedPath =
|
|
12281
|
+
const resolvedPath = join19(tsLibDir, fileName);
|
|
12177
12282
|
return originalGetSourceFile?.call(host, resolvedPath, languageVersion, onError);
|
|
12178
12283
|
}
|
|
12179
12284
|
return originalGetSourceFile?.call(host, fileName, languageVersion, onError);
|
|
12180
12285
|
};
|
|
12181
12286
|
const emitted = {};
|
|
12182
|
-
const resolvedOutDir =
|
|
12287
|
+
const resolvedOutDir = resolve22(outDir);
|
|
12183
12288
|
host.writeFile = (fileName, text) => {
|
|
12184
12289
|
const relativePath = resolveRelativePath(fileName, resolvedOutDir, outDir);
|
|
12185
12290
|
emitted[relativePath] = text;
|
|
@@ -12201,12 +12306,12 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
12201
12306
|
if (!fileName.endsWith(".ts") || fileName.endsWith(".d.ts")) {
|
|
12202
12307
|
return source;
|
|
12203
12308
|
}
|
|
12204
|
-
const resolvedPath =
|
|
12309
|
+
const resolvedPath = resolve22(fileName);
|
|
12205
12310
|
return transformedSources.get(resolvedPath) ?? source;
|
|
12206
12311
|
};
|
|
12207
12312
|
const originalGetSourceFileForCompile = host.getSourceFile;
|
|
12208
12313
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
12209
|
-
const source = transformedSources.get(
|
|
12314
|
+
const source = transformedSources.get(resolve22(fileName));
|
|
12210
12315
|
if (source) {
|
|
12211
12316
|
return ts2.createSourceFile(fileName, source, languageVersion, true);
|
|
12212
12317
|
}
|
|
@@ -12228,9 +12333,9 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
12228
12333
|
const entries = await traceAngularPhase("aot/postprocess-emitted-js", () => {
|
|
12229
12334
|
const rawEntries = Object.entries(emitted).filter(([fileName]) => fileName.endsWith(".js")).map(([fileName, content]) => ({
|
|
12230
12335
|
content,
|
|
12231
|
-
target:
|
|
12336
|
+
target: join19(outDir, fileName)
|
|
12232
12337
|
}));
|
|
12233
|
-
const outputFiles = new Set(rawEntries.map(({ target }) =>
|
|
12338
|
+
const outputFiles = new Set(rawEntries.map(({ target }) => resolve22(target)));
|
|
12234
12339
|
return rawEntries.map(({ content, target }) => {
|
|
12235
12340
|
let processedContent = content.replace(/from\s+(['"])(\.\.?\/[^'"]+)(\1)/g, (match, quote, path) => {
|
|
12236
12341
|
const rewritten = rewriteRelativeJsSpecifier(target, path, outputFiles);
|
|
@@ -12245,12 +12350,12 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
12245
12350
|
return cleaned ? `import { ${cleaned}, InternalInjectFlags } from '@angular/core'` : `import { InternalInjectFlags } from '@angular/core'`;
|
|
12246
12351
|
});
|
|
12247
12352
|
processedContent = processedContent.replace(/\b(?<!Internal)InjectFlags\b/g, "InternalInjectFlags");
|
|
12248
|
-
processedContent += islandMetadataByOutputPath.get(
|
|
12353
|
+
processedContent += islandMetadataByOutputPath.get(resolve22(target)) ?? "";
|
|
12249
12354
|
return { content: processedContent, target };
|
|
12250
12355
|
});
|
|
12251
12356
|
});
|
|
12252
12357
|
await traceAngularPhase("aot/write-output", () => Promise.all(entries.map(async ({ target, content }) => {
|
|
12253
|
-
await fs.mkdir(
|
|
12358
|
+
await fs.mkdir(dirname14(target), { recursive: true });
|
|
12254
12359
|
await fs.writeFile(target, content, "utf-8");
|
|
12255
12360
|
})), { outputs: entries.length });
|
|
12256
12361
|
return await traceAngularPhase("aot/collect-output-paths", () => entries.map(({ target }) => target), { outputs: entries.length });
|
|
@@ -12266,7 +12371,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
12266
12371
|
}
|
|
12267
12372
|
return null;
|
|
12268
12373
|
}, resolveAngularDeferImportSpecifier = () => {
|
|
12269
|
-
const sourceEntry =
|
|
12374
|
+
const sourceEntry = resolve22(import.meta.dir, "../angular/components/index.ts");
|
|
12270
12375
|
if (existsSync17(sourceEntry)) {
|
|
12271
12376
|
return sourceEntry.replace(/\\/g, "/");
|
|
12272
12377
|
}
|
|
@@ -12403,7 +12508,7 @@ ${fields}
|
|
|
12403
12508
|
}, inlineTemplateAndLowerDefer = async (source, fileDir) => {
|
|
12404
12509
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
12405
12510
|
if (templateUrlMatch?.[1]) {
|
|
12406
|
-
const templatePath =
|
|
12511
|
+
const templatePath = join19(fileDir, templateUrlMatch[1]);
|
|
12407
12512
|
if (!existsSync17(templatePath)) {
|
|
12408
12513
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
12409
12514
|
}
|
|
@@ -12434,7 +12539,7 @@ ${fields}
|
|
|
12434
12539
|
}, inlineTemplateAndLowerDeferSync = (source, fileDir) => {
|
|
12435
12540
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
12436
12541
|
if (templateUrlMatch?.[1]) {
|
|
12437
|
-
const templatePath =
|
|
12542
|
+
const templatePath = join19(fileDir, templateUrlMatch[1]);
|
|
12438
12543
|
if (!existsSync17(templatePath)) {
|
|
12439
12544
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
12440
12545
|
}
|
|
@@ -12471,7 +12576,7 @@ ${fields}
|
|
|
12471
12576
|
return source;
|
|
12472
12577
|
const stylePromises = urlMatches.map((urlMatch) => {
|
|
12473
12578
|
const styleUrl = urlMatch.replace(/['"]/g, "");
|
|
12474
|
-
return readAndEscapeFile(
|
|
12579
|
+
return readAndEscapeFile(join19(fileDir, styleUrl), stylePreprocessors);
|
|
12475
12580
|
});
|
|
12476
12581
|
const results = await Promise.all(stylePromises);
|
|
12477
12582
|
const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
|
|
@@ -12482,7 +12587,7 @@ ${fields}
|
|
|
12482
12587
|
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
12483
12588
|
if (!styleUrlMatch?.[1])
|
|
12484
12589
|
return source;
|
|
12485
|
-
const escaped = await readAndEscapeFile(
|
|
12590
|
+
const escaped = await readAndEscapeFile(join19(fileDir, styleUrlMatch[1]), stylePreprocessors);
|
|
12486
12591
|
if (!escaped)
|
|
12487
12592
|
return source;
|
|
12488
12593
|
return source.slice(0, styleUrlMatch.index) + `styles: [\`${escaped}\`]` + source.slice(styleUrlMatch.index + styleUrlMatch[0].length);
|
|
@@ -12496,10 +12601,10 @@ ${fields}
|
|
|
12496
12601
|
source: result
|
|
12497
12602
|
};
|
|
12498
12603
|
}, compileAngularFileJIT = async (inputPath, outDir, rootDir, stylePreprocessors, cacheBuster) => {
|
|
12499
|
-
const entryPath =
|
|
12604
|
+
const entryPath = resolve22(inputPath);
|
|
12500
12605
|
const allOutputs = [];
|
|
12501
12606
|
const visited = new Set;
|
|
12502
|
-
const baseDir =
|
|
12607
|
+
const baseDir = resolve22(rootDir ?? process.cwd());
|
|
12503
12608
|
let usesLegacyAnimations = false;
|
|
12504
12609
|
const angularTranspiler = new Bun.Transpiler({
|
|
12505
12610
|
loader: "ts",
|
|
@@ -12517,16 +12622,16 @@ ${fields}
|
|
|
12517
12622
|
`${candidate}.tsx`,
|
|
12518
12623
|
`${candidate}.js`,
|
|
12519
12624
|
`${candidate}.jsx`,
|
|
12520
|
-
|
|
12521
|
-
|
|
12522
|
-
|
|
12523
|
-
|
|
12625
|
+
join19(candidate, "index.ts"),
|
|
12626
|
+
join19(candidate, "index.tsx"),
|
|
12627
|
+
join19(candidate, "index.js"),
|
|
12628
|
+
join19(candidate, "index.jsx")
|
|
12524
12629
|
];
|
|
12525
12630
|
return candidates.find((file4) => existsSync17(file4));
|
|
12526
12631
|
};
|
|
12527
12632
|
const resolveLocalImport = (specifier, fromDir) => {
|
|
12528
12633
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
12529
|
-
return resolveSourceFile2(
|
|
12634
|
+
return resolveSourceFile2(resolve22(fromDir, specifier));
|
|
12530
12635
|
}
|
|
12531
12636
|
const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile2);
|
|
12532
12637
|
if (aliased)
|
|
@@ -12535,7 +12640,7 @@ ${fields}
|
|
|
12535
12640
|
const resolved = Bun.resolveSync(specifier, fromDir);
|
|
12536
12641
|
if (resolved.includes("/node_modules/"))
|
|
12537
12642
|
return;
|
|
12538
|
-
const absolute =
|
|
12643
|
+
const absolute = resolve22(resolved);
|
|
12539
12644
|
if (!absolute.startsWith(baseDir))
|
|
12540
12645
|
return;
|
|
12541
12646
|
return resolveSourceFile2(absolute);
|
|
@@ -12544,10 +12649,10 @@ ${fields}
|
|
|
12544
12649
|
}
|
|
12545
12650
|
};
|
|
12546
12651
|
const toOutputPath = (sourcePath) => {
|
|
12547
|
-
const inputDir =
|
|
12652
|
+
const inputDir = dirname14(sourcePath);
|
|
12548
12653
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
12549
12654
|
const fileBase = basename7(sourcePath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
12550
|
-
return
|
|
12655
|
+
return join19(outDir, relativeDir, fileBase);
|
|
12551
12656
|
};
|
|
12552
12657
|
const withCacheBuster = (specifier) => {
|
|
12553
12658
|
if (!cacheBuster)
|
|
@@ -12584,13 +12689,13 @@ ${fields}
|
|
|
12584
12689
|
return `${prefix}${dots}`;
|
|
12585
12690
|
return `${prefix}../${dots}`;
|
|
12586
12691
|
});
|
|
12587
|
-
if (
|
|
12692
|
+
if (resolve22(actualPath) === entryPath) {
|
|
12588
12693
|
processedContent += buildIslandMetadataExports(sourceCode);
|
|
12589
12694
|
}
|
|
12590
12695
|
return processedContent;
|
|
12591
12696
|
};
|
|
12592
12697
|
const transpileFile = async (filePath) => {
|
|
12593
|
-
const resolved =
|
|
12698
|
+
const resolved = resolve22(filePath);
|
|
12594
12699
|
if (visited.has(resolved))
|
|
12595
12700
|
return;
|
|
12596
12701
|
visited.add(resolved);
|
|
@@ -12600,12 +12705,12 @@ ${fields}
|
|
|
12600
12705
|
if (!existsSync17(actualPath))
|
|
12601
12706
|
return;
|
|
12602
12707
|
let sourceCode = await fs.readFile(actualPath, "utf-8");
|
|
12603
|
-
const inlined = await inlineResources(sourceCode,
|
|
12604
|
-
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source,
|
|
12605
|
-
const inputDir =
|
|
12708
|
+
const inlined = await inlineResources(sourceCode, dirname14(actualPath), stylePreprocessors);
|
|
12709
|
+
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname14(actualPath)).source;
|
|
12710
|
+
const inputDir = dirname14(actualPath);
|
|
12606
12711
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
12607
12712
|
const fileBase = basename7(actualPath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
12608
|
-
const targetDir =
|
|
12713
|
+
const targetDir = join19(outDir, relativeDir);
|
|
12609
12714
|
const targetPath = toOutputPath(actualPath);
|
|
12610
12715
|
const localImports = [];
|
|
12611
12716
|
const importRewrites = new Map;
|
|
@@ -12627,12 +12732,12 @@ ${fields}
|
|
|
12627
12732
|
const resolved2 = resolveLocalImport(specifier, inputDir);
|
|
12628
12733
|
if (!resolved2)
|
|
12629
12734
|
return null;
|
|
12630
|
-
const relativeImport =
|
|
12735
|
+
const relativeImport = relative11(targetDir, toOutputPath(resolved2)).replace(/\\/g, "/").replace(/\.js$/, "");
|
|
12631
12736
|
const relativeRewrite = relativeImport.startsWith(".") ? relativeImport : `./${relativeImport}`;
|
|
12632
12737
|
importRewrites.set(specifier, relativeRewrite);
|
|
12633
12738
|
return resolved2;
|
|
12634
12739
|
}).filter((path) => Boolean(path));
|
|
12635
|
-
const isEntry =
|
|
12740
|
+
const isEntry = resolve22(actualPath) === resolve22(entryPath);
|
|
12636
12741
|
const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
|
|
12637
12742
|
const cacheKey2 = actualPath;
|
|
12638
12743
|
const shouldWriteFile = cacheBuster && isEntry ? true : jitContentCache.get(cacheKey2) !== contentHash || !existsSync17(targetPath);
|
|
@@ -12666,13 +12771,13 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
12666
12771
|
return { clientPaths: [...emptyPaths], serverPaths: [...emptyPaths] };
|
|
12667
12772
|
}
|
|
12668
12773
|
const compiledRoot = compiledParent;
|
|
12669
|
-
const indexesDir =
|
|
12774
|
+
const indexesDir = join19(compiledParent, "indexes");
|
|
12670
12775
|
await traceAngularPhase("setup/create-indexes-dir", () => fs.mkdir(indexesDir, { recursive: true }));
|
|
12671
|
-
const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) =>
|
|
12776
|
+
const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) => resolve22(entry)), compiledRoot, stylePreprocessors), { entries: entryPoints.length });
|
|
12672
12777
|
const usesLegacyAngularAnimations = await traceAngularPhase("setup/legacy-animation-resolver", () => createLegacyAngularAnimationUsageResolver(outRoot));
|
|
12673
12778
|
const compileTasks = entryPoints.map(async (entry) => {
|
|
12674
|
-
const resolvedEntry =
|
|
12675
|
-
const relativeEntry =
|
|
12779
|
+
const resolvedEntry = resolve22(entry);
|
|
12780
|
+
const relativeEntry = relative11(outRoot, resolvedEntry).replace(/\.[tj]s$/, ".js");
|
|
12676
12781
|
const compileEntry = () => compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot, stylePreprocessors);
|
|
12677
12782
|
let outputs = hmr ? await traceAngularPhase("jit/compile-entry", compileEntry, {
|
|
12678
12783
|
entry: resolvedEntry
|
|
@@ -12680,13 +12785,13 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
12680
12785
|
const fileBase = basename7(resolvedEntry).replace(/\.[tj]s$/, "");
|
|
12681
12786
|
const jsName = `${fileBase}.js`;
|
|
12682
12787
|
const compiledFallbackPaths = [
|
|
12683
|
-
|
|
12684
|
-
|
|
12685
|
-
|
|
12686
|
-
].map((file4) =>
|
|
12788
|
+
join19(compiledRoot, relativeEntry),
|
|
12789
|
+
join19(compiledRoot, "pages", jsName),
|
|
12790
|
+
join19(compiledRoot, jsName)
|
|
12791
|
+
].map((file4) => resolve22(file4));
|
|
12687
12792
|
const resolveRawServerFile = (candidatePaths) => {
|
|
12688
12793
|
const normalizedCandidates = [
|
|
12689
|
-
...candidatePaths.map((file4) =>
|
|
12794
|
+
...candidatePaths.map((file4) => resolve22(file4)),
|
|
12690
12795
|
...compiledFallbackPaths
|
|
12691
12796
|
];
|
|
12692
12797
|
let candidate = normalizedCandidates.find((file4) => existsSync17(file4) && file4.endsWith(`${sep3}pages${sep3}${jsName}`));
|
|
@@ -12727,7 +12832,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
12727
12832
|
const usesLegacyAnimations = await traceAngularPhase("wrapper/detect-legacy-animations", () => usesLegacyAngularAnimations(resolvedEntry), { entry: resolvedEntry });
|
|
12728
12833
|
const serverContentHash = Bun.hash(original).toString(BASE_36_RADIX);
|
|
12729
12834
|
const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
|
|
12730
|
-
const clientFile =
|
|
12835
|
+
const clientFile = join19(indexesDir, jsName);
|
|
12731
12836
|
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync17(clientFile) && (usesLegacyAnimations || !original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__")) && (!usesLegacyAnimations || original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__"))) {
|
|
12732
12837
|
return {
|
|
12733
12838
|
clientPath: clientFile,
|
|
@@ -12754,7 +12859,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
12754
12859
|
`;
|
|
12755
12860
|
}
|
|
12756
12861
|
await traceAngularPhase("wrapper/write-server-output", () => fs.writeFile(rawServerFile, rewritten, "utf-8"), { entry: resolvedEntry });
|
|
12757
|
-
const relativePath =
|
|
12862
|
+
const relativePath = relative11(indexesDir, rawServerFile).replace(/\\/g, "/");
|
|
12758
12863
|
const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
12759
12864
|
const hmrPreamble = hmr ? `window.__HMR_FRAMEWORK__ = "angular";
|
|
12760
12865
|
import "${hmrClientPath5}";
|
|
@@ -12958,14 +13063,14 @@ var init_compileAngular = __esm(() => {
|
|
|
12958
13063
|
init_stylePreprocessor();
|
|
12959
13064
|
init_generatedDir();
|
|
12960
13065
|
devClientDir4 = resolveDevClientDir4();
|
|
12961
|
-
hmrClientPath5 =
|
|
13066
|
+
hmrClientPath5 = join19(devClientDir4, "hmrClient.ts").replace(/\\/g, "/");
|
|
12962
13067
|
jitContentCache = new Map;
|
|
12963
13068
|
wrapperOutputCache = new Map;
|
|
12964
13069
|
});
|
|
12965
13070
|
|
|
12966
13071
|
// node_modules/content-tag/pkg/node/content_tag.cjs
|
|
12967
13072
|
var require_content_tag = __commonJS((exports, module) => {
|
|
12968
|
-
var __dirname = "/
|
|
13073
|
+
var __dirname = "/home/alexkahn/abs/absolutejs/node_modules/content-tag/pkg/node";
|
|
12969
13074
|
var imports = {};
|
|
12970
13075
|
imports["__wbindgen_placeholder__"] = exports;
|
|
12971
13076
|
var wasm;
|
|
@@ -13403,7 +13508,7 @@ __export(exports_compileEmber, {
|
|
|
13403
13508
|
getEmberServerCompiledDir: () => getEmberServerCompiledDir,
|
|
13404
13509
|
getEmberCompiledRoot: () => getEmberCompiledRoot,
|
|
13405
13510
|
getEmberClientCompiledDir: () => getEmberClientCompiledDir,
|
|
13406
|
-
dirname: () =>
|
|
13511
|
+
dirname: () => dirname15,
|
|
13407
13512
|
compileEmberFileSource: () => compileEmberFileSource,
|
|
13408
13513
|
compileEmberFile: () => compileEmberFile,
|
|
13409
13514
|
compileEmber: () => compileEmber,
|
|
@@ -13411,16 +13516,16 @@ __export(exports_compileEmber, {
|
|
|
13411
13516
|
basename: () => basename8
|
|
13412
13517
|
});
|
|
13413
13518
|
import { existsSync as existsSync18 } from "fs";
|
|
13414
|
-
import { mkdir as
|
|
13415
|
-
import { basename as basename8, dirname as
|
|
13416
|
-
var {build: bunBuild2, Transpiler:
|
|
13519
|
+
import { mkdir as mkdir6, rm as rm4 } from "fs/promises";
|
|
13520
|
+
import { basename as basename8, dirname as dirname15, extname as extname6, join as join20, resolve as resolve23 } from "path";
|
|
13521
|
+
var {build: bunBuild2, Transpiler: Transpiler4, write: write3, file: file4 } = globalThis.Bun;
|
|
13417
13522
|
var cachedPreprocessor = null, getPreprocessor = async () => {
|
|
13418
13523
|
if (cachedPreprocessor)
|
|
13419
13524
|
return cachedPreprocessor;
|
|
13420
13525
|
const module = await Promise.resolve().then(() => __toESM(require_node(), 1));
|
|
13421
13526
|
cachedPreprocessor = new module.Preprocessor;
|
|
13422
13527
|
return cachedPreprocessor;
|
|
13423
|
-
},
|
|
13528
|
+
}, transpiler5, isTemplateTagFile = (entry) => {
|
|
13424
13529
|
const ext = extname6(entry);
|
|
13425
13530
|
return ext === ".gjs" || ext === ".gts";
|
|
13426
13531
|
}, rewriteTemplateEvalToScope = (source) => {
|
|
@@ -13508,7 +13613,7 @@ export const importSync = (specifier) => {
|
|
|
13508
13613
|
const originalImporter = stagedSourceMap.get(args.importer);
|
|
13509
13614
|
if (!originalImporter)
|
|
13510
13615
|
return;
|
|
13511
|
-
const candidateBase =
|
|
13616
|
+
const candidateBase = resolve23(dirname15(originalImporter), args.path);
|
|
13512
13617
|
const extensionsToTry = ["", ".gts", ".gjs", ".ts", ".js"];
|
|
13513
13618
|
for (const ext of extensionsToTry) {
|
|
13514
13619
|
const candidate = candidateBase + ext;
|
|
@@ -13525,13 +13630,13 @@ export const importSync = (specifier) => {
|
|
|
13525
13630
|
filename: args.path
|
|
13526
13631
|
});
|
|
13527
13632
|
const rewritten = rewriteTemplateEvalToScope(result.code);
|
|
13528
|
-
const transpiled =
|
|
13633
|
+
const transpiled = transpiler5.transformSync(rewritten);
|
|
13529
13634
|
return { contents: transpiled, loader: "js" };
|
|
13530
13635
|
});
|
|
13531
13636
|
build2.onResolve({ filter: /^@(?:ember|glimmer|simple-dom)\// }, (args) => {
|
|
13532
13637
|
if (standalonePackages.has(args.path))
|
|
13533
13638
|
return;
|
|
13534
|
-
const internal =
|
|
13639
|
+
const internal = join20(cwd, "node_modules/ember-source/dist/packages", args.path, "index.js");
|
|
13535
13640
|
if (existsSync18(internal))
|
|
13536
13641
|
return { path: internal };
|
|
13537
13642
|
return;
|
|
@@ -13567,7 +13672,7 @@ export const renderToHTML = (props = {}) => {
|
|
|
13567
13672
|
export { PageComponent };
|
|
13568
13673
|
export default PageComponent;
|
|
13569
13674
|
`, compileEmberFile = async (entry, compiledRoot, cwd = process.cwd()) => {
|
|
13570
|
-
const resolvedEntry =
|
|
13675
|
+
const resolvedEntry = resolve23(entry);
|
|
13571
13676
|
const source = await file4(resolvedEntry).text();
|
|
13572
13677
|
let preprocessed = source;
|
|
13573
13678
|
if (isTemplateTagFile(resolvedEntry)) {
|
|
@@ -13577,18 +13682,18 @@ export default PageComponent;
|
|
|
13577
13682
|
});
|
|
13578
13683
|
preprocessed = rewriteTemplateEvalToScope(result.code);
|
|
13579
13684
|
}
|
|
13580
|
-
const transpiled =
|
|
13685
|
+
const transpiled = transpiler5.transformSync(preprocessed);
|
|
13581
13686
|
const baseName = basename8(resolvedEntry).replace(/\.(gjs|gts|ts|js)$/, "");
|
|
13582
|
-
const tmpDir =
|
|
13583
|
-
const serverDir =
|
|
13584
|
-
const clientDir =
|
|
13687
|
+
const tmpDir = join20(compiledRoot, "_tmp");
|
|
13688
|
+
const serverDir = join20(compiledRoot, "server");
|
|
13689
|
+
const clientDir = join20(compiledRoot, "client");
|
|
13585
13690
|
await Promise.all([
|
|
13586
|
-
|
|
13587
|
-
|
|
13588
|
-
|
|
13691
|
+
mkdir6(tmpDir, { recursive: true }),
|
|
13692
|
+
mkdir6(serverDir, { recursive: true }),
|
|
13693
|
+
mkdir6(clientDir, { recursive: true })
|
|
13589
13694
|
]);
|
|
13590
|
-
const tmpPagePath =
|
|
13591
|
-
const tmpHarnessPath =
|
|
13695
|
+
const tmpPagePath = resolve23(join20(tmpDir, `${baseName}.module.js`));
|
|
13696
|
+
const tmpHarnessPath = resolve23(join20(tmpDir, `${baseName}.harness.js`));
|
|
13592
13697
|
await Promise.all([
|
|
13593
13698
|
write3(tmpPagePath, transpiled),
|
|
13594
13699
|
write3(tmpHarnessPath, generateServerHarness(tmpPagePath))
|
|
@@ -13596,7 +13701,7 @@ export default PageComponent;
|
|
|
13596
13701
|
const stagedSourceMap = new Map([
|
|
13597
13702
|
[tmpPagePath, resolvedEntry]
|
|
13598
13703
|
]);
|
|
13599
|
-
const serverPath =
|
|
13704
|
+
const serverPath = join20(serverDir, `${baseName}.js`);
|
|
13600
13705
|
const buildResult = await bunBuild2({
|
|
13601
13706
|
entrypoints: [tmpHarnessPath],
|
|
13602
13707
|
format: "esm",
|
|
@@ -13613,7 +13718,7 @@ export default PageComponent;
|
|
|
13613
13718
|
console.warn(`\u26A0\uFE0F Ember server build for ${baseName} had errors:`, buildResult.logs);
|
|
13614
13719
|
}
|
|
13615
13720
|
await rm4(tmpDir, { force: true, recursive: true });
|
|
13616
|
-
const clientPath =
|
|
13721
|
+
const clientPath = join20(clientDir, `${baseName}.js`);
|
|
13617
13722
|
await write3(clientPath, transpiled);
|
|
13618
13723
|
return { clientPath, serverPath };
|
|
13619
13724
|
}, compileEmber = async (entries, emberDir, cwd = process.cwd(), _hmr = false) => {
|
|
@@ -13630,7 +13735,7 @@ export default PageComponent;
|
|
|
13630
13735
|
serverPaths: outputs.map((o) => o.serverPath)
|
|
13631
13736
|
};
|
|
13632
13737
|
}, compileEmberFileSource = async (entry) => {
|
|
13633
|
-
const resolvedEntry =
|
|
13738
|
+
const resolvedEntry = resolve23(entry);
|
|
13634
13739
|
const source = await file4(resolvedEntry).text();
|
|
13635
13740
|
let preprocessed = source;
|
|
13636
13741
|
if (isTemplateTagFile(resolvedEntry)) {
|
|
@@ -13640,11 +13745,11 @@ export default PageComponent;
|
|
|
13640
13745
|
});
|
|
13641
13746
|
preprocessed = rewriteTemplateEvalToScope(result.code);
|
|
13642
13747
|
}
|
|
13643
|
-
return
|
|
13644
|
-
}, clearEmberCompilerCache = () => {}, getEmberCompiledRoot = (_emberDir) => getFrameworkGeneratedDir("ember"), getEmberServerCompiledDir = (emberDir) =>
|
|
13748
|
+
return transpiler5.transformSync(preprocessed);
|
|
13749
|
+
}, clearEmberCompilerCache = () => {}, getEmberCompiledRoot = (_emberDir) => getFrameworkGeneratedDir("ember"), getEmberServerCompiledDir = (emberDir) => join20(getEmberCompiledRoot(emberDir), "server"), getEmberClientCompiledDir = (emberDir) => join20(getEmberCompiledRoot(emberDir), "client");
|
|
13645
13750
|
var init_compileEmber = __esm(() => {
|
|
13646
13751
|
init_generatedDir();
|
|
13647
|
-
|
|
13752
|
+
transpiler5 = new Transpiler4({
|
|
13648
13753
|
loader: "ts",
|
|
13649
13754
|
target: "browser",
|
|
13650
13755
|
tsconfig: JSON.stringify({
|
|
@@ -13663,24 +13768,24 @@ __export(exports_buildReactVendor, {
|
|
|
13663
13768
|
buildReactVendor: () => buildReactVendor
|
|
13664
13769
|
});
|
|
13665
13770
|
import { existsSync as existsSync19, mkdirSync as mkdirSync7 } from "fs";
|
|
13666
|
-
import { join as
|
|
13771
|
+
import { join as join21, resolve as resolve24 } from "path";
|
|
13667
13772
|
import { rm as rm5 } from "fs/promises";
|
|
13668
13773
|
var {build: bunBuild3 } = globalThis.Bun;
|
|
13669
13774
|
var resolveJsxDevRuntimeCompatPath = () => {
|
|
13670
13775
|
const candidates = [
|
|
13671
|
-
|
|
13672
|
-
|
|
13673
|
-
|
|
13674
|
-
|
|
13675
|
-
|
|
13676
|
-
|
|
13776
|
+
resolve24(import.meta.dir, "react", "jsxDevRuntimeCompat.js"),
|
|
13777
|
+
resolve24(import.meta.dir, "src", "react", "jsxDevRuntimeCompat.ts"),
|
|
13778
|
+
resolve24(import.meta.dir, "..", "react", "jsxDevRuntimeCompat.js"),
|
|
13779
|
+
resolve24(import.meta.dir, "..", "src", "react", "jsxDevRuntimeCompat.ts"),
|
|
13780
|
+
resolve24(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
13781
|
+
resolve24(import.meta.dir, "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
13677
13782
|
];
|
|
13678
13783
|
for (const candidate of candidates) {
|
|
13679
13784
|
if (existsSync19(candidate)) {
|
|
13680
13785
|
return candidate.replace(/\\/g, "/");
|
|
13681
13786
|
}
|
|
13682
13787
|
}
|
|
13683
|
-
return (candidates[0] ??
|
|
13788
|
+
return (candidates[0] ?? resolve24(import.meta.dir, "react", "jsxDevRuntimeCompat.js")).replace(/\\/g, "/");
|
|
13684
13789
|
}, jsxDevRuntimeCompatPath, reactSpecifiers, isResolvable = (specifier) => {
|
|
13685
13790
|
try {
|
|
13686
13791
|
Bun.resolveSync(specifier, process.cwd());
|
|
@@ -13717,14 +13822,14 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
13717
13822
|
`)}
|
|
13718
13823
|
`;
|
|
13719
13824
|
}, buildReactVendor = async (buildDir) => {
|
|
13720
|
-
const vendorDir =
|
|
13825
|
+
const vendorDir = join21(buildDir, "react", "vendor");
|
|
13721
13826
|
mkdirSync7(vendorDir, { recursive: true });
|
|
13722
|
-
const tmpDir =
|
|
13827
|
+
const tmpDir = join21(buildDir, "_vendor_tmp");
|
|
13723
13828
|
mkdirSync7(tmpDir, { recursive: true });
|
|
13724
13829
|
const specifiers = resolveVendorSpecifiers();
|
|
13725
13830
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
13726
13831
|
const safeName = toSafeFileName(specifier);
|
|
13727
|
-
const entryPath =
|
|
13832
|
+
const entryPath = join21(tmpDir, `${safeName}.ts`);
|
|
13728
13833
|
const source = await generateEntrySource(specifier);
|
|
13729
13834
|
await Bun.write(entryPath, source);
|
|
13730
13835
|
return entryPath;
|
|
@@ -13789,7 +13894,7 @@ __export(exports_buildAngularVendor, {
|
|
|
13789
13894
|
buildAngularServerVendor: () => buildAngularServerVendor
|
|
13790
13895
|
});
|
|
13791
13896
|
import { mkdirSync as mkdirSync8 } from "fs";
|
|
13792
|
-
import { join as
|
|
13897
|
+
import { join as join22 } from "path";
|
|
13793
13898
|
import { rm as rm6 } from "fs/promises";
|
|
13794
13899
|
var {build: bunBuild4, Glob: Glob6 } = globalThis.Bun;
|
|
13795
13900
|
var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => jitMode ? [...REQUIRED_ANGULAR_SPECIFIERS_BASE, "@angular/compiler"] : REQUIRED_ANGULAR_SPECIFIERS_BASE, SERVER_ONLY_ANGULAR_SPECIFIERS, BUILD_ONLY_ANGULAR_SPECIFIER_PREFIXES, isBuildOnlyAngularSpecifier = (spec) => BUILD_ONLY_ANGULAR_SPECIFIER_PREFIXES.some((prefix) => spec === prefix || spec.startsWith(`${prefix}/`)), SCAN_SKIP_DIRS, isResolvable2 = (specifier) => {
|
|
@@ -13802,7 +13907,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
13802
13907
|
}, isBareSpecifier = (spec) => !spec.startsWith(".") && !spec.startsWith("/") && !spec.startsWith("@src/"), isAngularBrowserSpecifier = (spec) => spec.startsWith("@angular/") && !SERVER_ONLY_ANGULAR_SPECIFIERS.has(spec) && !isBuildOnlyAngularSpecifier(spec), scanSourceImports = async (directories) => {
|
|
13803
13908
|
const angular = new Set;
|
|
13804
13909
|
const transitiveRoots = new Set;
|
|
13805
|
-
const
|
|
13910
|
+
const transpiler6 = new Bun.Transpiler({ loader: "tsx" });
|
|
13806
13911
|
const glob = new Glob6("**/*.{ts,tsx,js,jsx}");
|
|
13807
13912
|
for (const dir of directories) {
|
|
13808
13913
|
try {
|
|
@@ -13813,7 +13918,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
13813
13918
|
continue;
|
|
13814
13919
|
try {
|
|
13815
13920
|
const content = await Bun.file(file5).text();
|
|
13816
|
-
for (const imp of
|
|
13921
|
+
for (const imp of transpiler6.scanImports(content)) {
|
|
13817
13922
|
if (isAngularBrowserSpecifier(imp.path)) {
|
|
13818
13923
|
angular.add(imp.path);
|
|
13819
13924
|
} else if (isBareSpecifier(imp.path)) {
|
|
@@ -13827,7 +13932,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
13827
13932
|
return { angular, transitiveRoots };
|
|
13828
13933
|
}, PARTIAL_DECL_MARKERS, containsPartialDeclarations = (source) => PARTIAL_DECL_MARKERS.some((marker) => source.includes(marker)), collectTransitiveAngularSpecs = async (roots, angularFound) => {
|
|
13829
13934
|
const { readFileSync: readFileSync14 } = await import("fs");
|
|
13830
|
-
const
|
|
13935
|
+
const transpiler6 = new Bun.Transpiler({ loader: "js" });
|
|
13831
13936
|
const visited = new Set;
|
|
13832
13937
|
const frontier = [];
|
|
13833
13938
|
for (const r of roots)
|
|
@@ -13856,7 +13961,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
13856
13961
|
}
|
|
13857
13962
|
let imports;
|
|
13858
13963
|
try {
|
|
13859
|
-
imports =
|
|
13964
|
+
imports = transpiler6.scanImports(content);
|
|
13860
13965
|
} catch {
|
|
13861
13966
|
continue;
|
|
13862
13967
|
}
|
|
@@ -13886,14 +13991,14 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
13886
13991
|
await collectTransitiveAngularSpecs([...angular, ...transitiveRoots], angular);
|
|
13887
13992
|
return Array.from(angular).filter(isResolvable2);
|
|
13888
13993
|
}, buildAngularVendor = async (buildDir, directories = [], linkerJitMode = false, depVendorSpecifiers = []) => {
|
|
13889
|
-
const vendorDir =
|
|
13994
|
+
const vendorDir = join22(buildDir, "angular", "vendor");
|
|
13890
13995
|
mkdirSync8(vendorDir, { recursive: true });
|
|
13891
|
-
const tmpDir =
|
|
13996
|
+
const tmpDir = join22(buildDir, "_angular_vendor_tmp");
|
|
13892
13997
|
mkdirSync8(tmpDir, { recursive: true });
|
|
13893
13998
|
const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
13894
13999
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
13895
14000
|
const safeName = toSafeFileName2(specifier);
|
|
13896
|
-
const entryPath =
|
|
14001
|
+
const entryPath = join22(tmpDir, `${safeName}.ts`);
|
|
13897
14002
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
13898
14003
|
return entryPath;
|
|
13899
14004
|
}));
|
|
@@ -13924,9 +14029,9 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
13924
14029
|
const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
13925
14030
|
return computeAngularVendorPaths(specifiers);
|
|
13926
14031
|
}, buildAngularServerVendor = async (buildDir, directories = [], linkerJitMode = false) => {
|
|
13927
|
-
const vendorDir =
|
|
14032
|
+
const vendorDir = join22(buildDir, "angular", "vendor", "server");
|
|
13928
14033
|
mkdirSync8(vendorDir, { recursive: true });
|
|
13929
|
-
const tmpDir =
|
|
14034
|
+
const tmpDir = join22(buildDir, "_angular_server_vendor_tmp");
|
|
13930
14035
|
mkdirSync8(tmpDir, { recursive: true });
|
|
13931
14036
|
const browserSpecs = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
13932
14037
|
const allSpecs = new Set(browserSpecs);
|
|
@@ -13937,7 +14042,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
13937
14042
|
const specifiers = Array.from(allSpecs);
|
|
13938
14043
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
13939
14044
|
const safeName = toSafeFileName2(specifier);
|
|
13940
|
-
const entryPath =
|
|
14045
|
+
const entryPath = join22(tmpDir, `${safeName}.ts`);
|
|
13941
14046
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
13942
14047
|
return entryPath;
|
|
13943
14048
|
}));
|
|
@@ -13959,9 +14064,9 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
13959
14064
|
return specifiers;
|
|
13960
14065
|
}, computeAngularServerVendorPaths = (buildDir, specifiers) => {
|
|
13961
14066
|
const paths = {};
|
|
13962
|
-
const vendorDir =
|
|
14067
|
+
const vendorDir = join22(buildDir, "angular", "vendor", "server");
|
|
13963
14068
|
for (const specifier of specifiers) {
|
|
13964
|
-
paths[specifier] =
|
|
14069
|
+
paths[specifier] = join22(vendorDir, `${toSafeFileName2(specifier)}.js`);
|
|
13965
14070
|
}
|
|
13966
14071
|
return paths;
|
|
13967
14072
|
}, computeAngularServerVendorPathsAsync = async (buildDir, directories = [], linkerJitMode = true) => {
|
|
@@ -14017,17 +14122,17 @@ __export(exports_buildVueVendor, {
|
|
|
14017
14122
|
buildVueVendor: () => buildVueVendor
|
|
14018
14123
|
});
|
|
14019
14124
|
import { mkdirSync as mkdirSync9 } from "fs";
|
|
14020
|
-
import { join as
|
|
14125
|
+
import { join as join23 } from "path";
|
|
14021
14126
|
import { rm as rm7 } from "fs/promises";
|
|
14022
14127
|
var {build: bunBuild5 } = globalThis.Bun;
|
|
14023
14128
|
var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"), buildVueVendor = async (buildDir) => {
|
|
14024
|
-
const vendorDir =
|
|
14129
|
+
const vendorDir = join23(buildDir, "vue", "vendor");
|
|
14025
14130
|
mkdirSync9(vendorDir, { recursive: true });
|
|
14026
|
-
const tmpDir =
|
|
14131
|
+
const tmpDir = join23(buildDir, "_vue_vendor_tmp");
|
|
14027
14132
|
mkdirSync9(tmpDir, { recursive: true });
|
|
14028
14133
|
const entrypoints = await Promise.all(vueSpecifiers.map(async (specifier) => {
|
|
14029
14134
|
const safeName = toSafeFileName3(specifier);
|
|
14030
|
-
const entryPath =
|
|
14135
|
+
const entryPath = join23(tmpDir, `${safeName}.ts`);
|
|
14031
14136
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
14032
14137
|
`);
|
|
14033
14138
|
return entryPath;
|
|
@@ -14055,7 +14160,7 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
|
|
|
14055
14160
|
const { readFileSync: readFileSync14, writeFileSync: writeFileSync8, readdirSync } = await import("fs");
|
|
14056
14161
|
const files = readdirSync(vendorDir).filter((f2) => f2.endsWith(".js"));
|
|
14057
14162
|
for (const file5 of files) {
|
|
14058
|
-
const filePath =
|
|
14163
|
+
const filePath = join23(vendorDir, file5);
|
|
14059
14164
|
const content = readFileSync14(filePath, "utf-8");
|
|
14060
14165
|
if (!content.includes("__VUE_HMR_RUNTIME__"))
|
|
14061
14166
|
continue;
|
|
@@ -14082,7 +14187,7 @@ __export(exports_buildSvelteVendor, {
|
|
|
14082
14187
|
buildSvelteVendor: () => buildSvelteVendor
|
|
14083
14188
|
});
|
|
14084
14189
|
import { mkdirSync as mkdirSync10 } from "fs";
|
|
14085
|
-
import { join as
|
|
14190
|
+
import { join as join24 } from "path";
|
|
14086
14191
|
import { rm as rm8 } from "fs/promises";
|
|
14087
14192
|
var {build: bunBuild6 } = globalThis.Bun;
|
|
14088
14193
|
var svelteSpecifiers, isResolvable3 = (specifier) => {
|
|
@@ -14096,13 +14201,13 @@ var svelteSpecifiers, isResolvable3 = (specifier) => {
|
|
|
14096
14201
|
const specifiers = resolveVendorSpecifiers2();
|
|
14097
14202
|
if (specifiers.length === 0)
|
|
14098
14203
|
return;
|
|
14099
|
-
const vendorDir =
|
|
14204
|
+
const vendorDir = join24(buildDir, "svelte", "vendor");
|
|
14100
14205
|
mkdirSync10(vendorDir, { recursive: true });
|
|
14101
|
-
const tmpDir =
|
|
14206
|
+
const tmpDir = join24(buildDir, "_svelte_vendor_tmp");
|
|
14102
14207
|
mkdirSync10(tmpDir, { recursive: true });
|
|
14103
14208
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
14104
14209
|
const safeName = toSafeFileName4(specifier);
|
|
14105
|
-
const entryPath =
|
|
14210
|
+
const entryPath = join24(tmpDir, `${safeName}.ts`);
|
|
14106
14211
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
14107
14212
|
`);
|
|
14108
14213
|
return entryPath;
|
|
@@ -14152,7 +14257,7 @@ __export(exports_rewriteImportsPlugin, {
|
|
|
14152
14257
|
buildWithImportRewrite: () => buildWithImportRewrite
|
|
14153
14258
|
});
|
|
14154
14259
|
import { readdir as readdir3 } from "fs/promises";
|
|
14155
|
-
import { join as
|
|
14260
|
+
import { join as join25 } from "path";
|
|
14156
14261
|
var escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewriteImports = (content, replacements) => {
|
|
14157
14262
|
let result = content;
|
|
14158
14263
|
for (const [specifier, webPath] of replacements) {
|
|
@@ -14281,7 +14386,7 @@ ${content}`;
|
|
|
14281
14386
|
const entries = await readdir3(dir);
|
|
14282
14387
|
for (const entry of entries) {
|
|
14283
14388
|
if (entry.endsWith(".js"))
|
|
14284
|
-
allFiles.push(
|
|
14389
|
+
allFiles.push(join25(dir, entry));
|
|
14285
14390
|
}
|
|
14286
14391
|
} catch {}
|
|
14287
14392
|
}
|
|
@@ -14330,7 +14435,7 @@ import {
|
|
|
14330
14435
|
statSync,
|
|
14331
14436
|
writeFileSync as writeFileSync8
|
|
14332
14437
|
} from "fs";
|
|
14333
|
-
import { basename as basename9, dirname as
|
|
14438
|
+
import { basename as basename9, dirname as dirname16, extname as extname7, join as join26, relative as relative12, resolve as resolve25 } from "path";
|
|
14334
14439
|
import { cwd, env as env3, exit } from "process";
|
|
14335
14440
|
var {build: bunBuild7, Glob: Glob7 } = globalThis.Bun;
|
|
14336
14441
|
var isDev2, isBuildTraceEnabled = () => {
|
|
@@ -14408,8 +14513,8 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
14408
14513
|
mkdirSync11(htmxDestDir, { recursive: true });
|
|
14409
14514
|
const glob = new Glob7("htmx*.min.js");
|
|
14410
14515
|
for (const relPath of glob.scanSync({ cwd: htmxDir })) {
|
|
14411
|
-
const src =
|
|
14412
|
-
const dest =
|
|
14516
|
+
const src = join26(htmxDir, relPath);
|
|
14517
|
+
const dest = join26(htmxDestDir, "htmx.min.js");
|
|
14413
14518
|
copyFileSync(src, dest);
|
|
14414
14519
|
return;
|
|
14415
14520
|
}
|
|
@@ -14421,8 +14526,8 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
14421
14526
|
}
|
|
14422
14527
|
}, resolveAbsoluteVersion = async () => {
|
|
14423
14528
|
const candidates = [
|
|
14424
|
-
|
|
14425
|
-
|
|
14529
|
+
resolve25(import.meta.dir, "..", "..", "package.json"),
|
|
14530
|
+
resolve25(import.meta.dir, "..", "package.json")
|
|
14426
14531
|
];
|
|
14427
14532
|
const resolveCandidate = async (remaining) => {
|
|
14428
14533
|
const [candidate, ...rest] = remaining;
|
|
@@ -14438,7 +14543,7 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
14438
14543
|
};
|
|
14439
14544
|
await resolveCandidate(candidates);
|
|
14440
14545
|
}, SKIP_DIRS, addWorkerPathIfExists = (file5, relPath, workerPaths) => {
|
|
14441
|
-
const absPath =
|
|
14546
|
+
const absPath = resolve25(file5, "..", relPath);
|
|
14442
14547
|
try {
|
|
14443
14548
|
statSync(absPath);
|
|
14444
14549
|
workerPaths.add(absPath);
|
|
@@ -14484,7 +14589,7 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
14484
14589
|
vuePagesPath
|
|
14485
14590
|
}) => {
|
|
14486
14591
|
const { readdirSync: readDir } = await import("fs");
|
|
14487
|
-
const devIndexDir =
|
|
14592
|
+
const devIndexDir = join26(buildPath, "_src_indexes");
|
|
14488
14593
|
mkdirSync11(devIndexDir, { recursive: true });
|
|
14489
14594
|
if (reactIndexesPath && reactPagesPath) {
|
|
14490
14595
|
copyReactDevIndexes(reactIndexesPath, reactPagesPath, devIndexDir, readDir);
|
|
@@ -14500,37 +14605,37 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
14500
14605
|
return;
|
|
14501
14606
|
}
|
|
14502
14607
|
const indexFiles = readDir(reactIndexesPath).filter((file5) => file5.endsWith(".tsx"));
|
|
14503
|
-
const pagesRel =
|
|
14608
|
+
const pagesRel = relative12(process.cwd(), resolve25(reactPagesPath)).replace(/\\/g, "/");
|
|
14504
14609
|
for (const file5 of indexFiles) {
|
|
14505
|
-
let content = readFileSync14(
|
|
14610
|
+
let content = readFileSync14(join26(reactIndexesPath, file5), "utf-8");
|
|
14506
14611
|
content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
|
|
14507
|
-
writeFileSync8(
|
|
14612
|
+
writeFileSync8(join26(devIndexDir, file5), content);
|
|
14508
14613
|
}
|
|
14509
14614
|
}, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
|
|
14510
|
-
const svelteIndexDir =
|
|
14511
|
-
const sveltePageEntries = svelteEntries.filter((file5) =>
|
|
14615
|
+
const svelteIndexDir = join26(getFrameworkGeneratedDir("svelte"), "indexes");
|
|
14616
|
+
const sveltePageEntries = svelteEntries.filter((file5) => resolve25(file5).startsWith(resolve25(sveltePagesPath)));
|
|
14512
14617
|
for (const entry of sveltePageEntries) {
|
|
14513
14618
|
const name = basename9(entry).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
14514
|
-
const indexFile =
|
|
14619
|
+
const indexFile = join26(svelteIndexDir, "pages", `${name}.js`);
|
|
14515
14620
|
if (!existsSync20(indexFile))
|
|
14516
14621
|
continue;
|
|
14517
14622
|
let content = readFileSync14(indexFile, "utf-8");
|
|
14518
|
-
const srcRel =
|
|
14623
|
+
const srcRel = relative12(process.cwd(), resolve25(entry)).replace(/\\/g, "/");
|
|
14519
14624
|
content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
|
|
14520
|
-
writeFileSync8(
|
|
14625
|
+
writeFileSync8(join26(devIndexDir, `${name}.svelte.js`), content);
|
|
14521
14626
|
}
|
|
14522
14627
|
}, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
|
|
14523
|
-
const vueIndexDir =
|
|
14524
|
-
const vuePageEntries = vueEntries.filter((file5) =>
|
|
14628
|
+
const vueIndexDir = join26(getFrameworkGeneratedDir("vue"), "indexes");
|
|
14629
|
+
const vuePageEntries = vueEntries.filter((file5) => resolve25(file5).startsWith(resolve25(vuePagesPath)));
|
|
14525
14630
|
for (const entry of vuePageEntries) {
|
|
14526
14631
|
const name = basename9(entry, ".vue");
|
|
14527
|
-
const indexFile =
|
|
14632
|
+
const indexFile = join26(vueIndexDir, `${name}.js`);
|
|
14528
14633
|
if (!existsSync20(indexFile))
|
|
14529
14634
|
continue;
|
|
14530
14635
|
let content = readFileSync14(indexFile, "utf-8");
|
|
14531
|
-
const srcRel =
|
|
14636
|
+
const srcRel = relative12(process.cwd(), resolve25(entry)).replace(/\\/g, "/");
|
|
14532
14637
|
content = content.replace(/import\s+Comp(?:\s*,\s*\*\s+as\s+\w+)?\s+from\s+['"]([^'"]+)['"]/, (match) => match.replace(/from\s+['"][^'"]+['"]/, `from "/@src/${srcRel}"`));
|
|
14533
|
-
writeFileSync8(
|
|
14638
|
+
writeFileSync8(join26(devIndexDir, `${name}.vue.js`), content);
|
|
14534
14639
|
}
|
|
14535
14640
|
}, resolveVueRuntimeId = (content, firstUseName, outputPath, projectRoot) => {
|
|
14536
14641
|
const varIdx = content.indexOf(`var ${firstUseName} =`);
|
|
@@ -14541,7 +14646,7 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
14541
14646
|
const last = allComments[allComments.length - 1];
|
|
14542
14647
|
if (!last?.[1])
|
|
14543
14648
|
return JSON.stringify(outputPath);
|
|
14544
|
-
const srcPath =
|
|
14649
|
+
const srcPath = resolve25(projectRoot, last[1].replace("/client/", "/").replace(/\.js$/, ".ts"));
|
|
14545
14650
|
return JSON.stringify(srcPath);
|
|
14546
14651
|
}, QUOTE_CHARS, OPEN_BRACES, CLOSE_BRACES, findFunctionExpressionEnd = (content, startPos) => {
|
|
14547
14652
|
let depth = 0;
|
|
@@ -14603,7 +14708,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14603
14708
|
}, buildDevUrlFileMap = (urlReferencedFiles, projectRoot) => {
|
|
14604
14709
|
const urlFileMap = new Map;
|
|
14605
14710
|
for (const srcPath of urlReferencedFiles) {
|
|
14606
|
-
const rel =
|
|
14711
|
+
const rel = relative12(projectRoot, srcPath).replace(/\\/g, "/");
|
|
14607
14712
|
const name = basename9(srcPath);
|
|
14608
14713
|
const mtime = Math.round(statSync(srcPath).mtimeMs);
|
|
14609
14714
|
const url = `/@src/${rel}?v=${mtime}`;
|
|
@@ -14618,7 +14723,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14618
14723
|
const output = nonReactClientOutputs.find((artifact) => basename9(artifact.path).startsWith(`${srcBase}.`));
|
|
14619
14724
|
if (!output)
|
|
14620
14725
|
continue;
|
|
14621
|
-
urlFileMap.set(basename9(srcPath), `/${
|
|
14726
|
+
urlFileMap.set(basename9(srcPath), `/${relative12(buildPath, output.path).replace(/\\/g, "/")}`);
|
|
14622
14727
|
}
|
|
14623
14728
|
return urlFileMap;
|
|
14624
14729
|
}, buildUrlFileMap = (urlReferencedFiles, hmr, projectRoot, buildPath, nonReactClientOutputs) => {
|
|
@@ -14752,10 +14857,10 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14752
14857
|
restoreTracePhase();
|
|
14753
14858
|
return;
|
|
14754
14859
|
}
|
|
14755
|
-
const traceDir =
|
|
14860
|
+
const traceDir = join26(buildPath2, ".absolute-trace");
|
|
14756
14861
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
14757
14862
|
mkdirSync11(traceDir, { recursive: true });
|
|
14758
|
-
writeFileSync8(
|
|
14863
|
+
writeFileSync8(join26(traceDir, `build-trace-${timestamp}.json`), JSON.stringify({
|
|
14759
14864
|
events: traceEvents,
|
|
14760
14865
|
frameworks: traceFrameworkNames,
|
|
14761
14866
|
generatedAt: new Date().toISOString(),
|
|
@@ -14786,15 +14891,15 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14786
14891
|
const stylesPath = typeof stylesConfig === "string" ? stylesConfig : stylesConfig?.path;
|
|
14787
14892
|
const stylesIgnore = typeof stylesConfig === "object" ? stylesConfig.ignore : undefined;
|
|
14788
14893
|
const stylesDir = stylesPath && validateSafePath(stylesPath, projectRoot);
|
|
14789
|
-
const reactIndexesPath = reactDir &&
|
|
14790
|
-
const reactPagesPath = reactDir &&
|
|
14791
|
-
const htmlPagesPath = htmlDir &&
|
|
14792
|
-
const htmlScriptsPath = htmlDir &&
|
|
14793
|
-
const sveltePagesPath = svelteDir &&
|
|
14794
|
-
const vuePagesPath = vueDir &&
|
|
14795
|
-
const htmxPagesPath = htmxDir &&
|
|
14796
|
-
const angularPagesPath = angularDir &&
|
|
14797
|
-
const emberPagesPath = emberDir &&
|
|
14894
|
+
const reactIndexesPath = reactDir && join26(getFrameworkGeneratedDir("react"), "indexes");
|
|
14895
|
+
const reactPagesPath = reactDir && join26(reactDir, "pages");
|
|
14896
|
+
const htmlPagesPath = htmlDir && join26(htmlDir, "pages");
|
|
14897
|
+
const htmlScriptsPath = htmlDir && join26(htmlDir, "scripts");
|
|
14898
|
+
const sveltePagesPath = svelteDir && join26(svelteDir, "pages");
|
|
14899
|
+
const vuePagesPath = vueDir && join26(vueDir, "pages");
|
|
14900
|
+
const htmxPagesPath = htmxDir && join26(htmxDir, "pages");
|
|
14901
|
+
const angularPagesPath = angularDir && join26(angularDir, "pages");
|
|
14902
|
+
const emberPagesPath = emberDir && join26(emberDir, "pages");
|
|
14798
14903
|
const frontends = [
|
|
14799
14904
|
reactDir,
|
|
14800
14905
|
htmlDir,
|
|
@@ -14825,7 +14930,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14825
14930
|
const sourceClientRoots = [
|
|
14826
14931
|
htmlDir,
|
|
14827
14932
|
htmxDir,
|
|
14828
|
-
islandBootstrapPath &&
|
|
14933
|
+
islandBootstrapPath && dirname16(islandBootstrapPath)
|
|
14829
14934
|
].filter((dir) => Boolean(dir));
|
|
14830
14935
|
const usesGenerated = Boolean(reactDir) || Boolean(svelteDir) || Boolean(vueDir) || Boolean(angularDir);
|
|
14831
14936
|
if (usesGenerated)
|
|
@@ -14853,8 +14958,8 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14853
14958
|
const [firstEntry] = serverDirMap;
|
|
14854
14959
|
if (!firstEntry)
|
|
14855
14960
|
throw new Error("Expected at least one server directory entry");
|
|
14856
|
-
serverRoot =
|
|
14857
|
-
serverOutDir =
|
|
14961
|
+
serverRoot = join26(firstEntry.dir, firstEntry.subdir);
|
|
14962
|
+
serverOutDir = join26(buildPath, basename9(firstEntry.dir));
|
|
14858
14963
|
} else if (serverDirMap.length > 1) {
|
|
14859
14964
|
serverRoot = commonAncestor(serverDirMap.map((entry) => entry.dir), projectRoot);
|
|
14860
14965
|
serverOutDir = buildPath;
|
|
@@ -14866,13 +14971,13 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14866
14971
|
const filterToIncrementalEntries = (entryPoints, mapToSource) => {
|
|
14867
14972
|
if (!isIncremental || !incrementalFiles)
|
|
14868
14973
|
return entryPoints;
|
|
14869
|
-
const normalizedIncremental = new Set(incrementalFiles.map((f2) =>
|
|
14974
|
+
const normalizedIncremental = new Set(incrementalFiles.map((f2) => resolve25(f2)));
|
|
14870
14975
|
const matchingEntries = [];
|
|
14871
14976
|
for (const entry of entryPoints) {
|
|
14872
14977
|
const sourceFile = mapToSource(entry);
|
|
14873
14978
|
if (!sourceFile)
|
|
14874
14979
|
continue;
|
|
14875
|
-
if (!normalizedIncremental.has(
|
|
14980
|
+
if (!normalizedIncremental.has(resolve25(sourceFile)))
|
|
14876
14981
|
continue;
|
|
14877
14982
|
matchingEntries.push(entry);
|
|
14878
14983
|
}
|
|
@@ -14882,7 +14987,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14882
14987
|
await tracePhase("react/index-generation", () => generateReactIndexFiles(reactPagesPath, reactIndexesPath, hmr));
|
|
14883
14988
|
}
|
|
14884
14989
|
if (assetsPath && (!isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/assets/")))) {
|
|
14885
|
-
await tracePhase("assets/copy", () => cpSync(assetsPath,
|
|
14990
|
+
await tracePhase("assets/copy", () => cpSync(assetsPath, join26(buildPath, "assets"), {
|
|
14886
14991
|
force: true,
|
|
14887
14992
|
recursive: true
|
|
14888
14993
|
}));
|
|
@@ -14892,6 +14997,15 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14892
14997
|
conventions: undefined,
|
|
14893
14998
|
pageFiles: []
|
|
14894
14999
|
};
|
|
15000
|
+
const htmlConventionDirs = [
|
|
15001
|
+
reactPagesPath,
|
|
15002
|
+
sveltePagesPath,
|
|
15003
|
+
vuePagesPath,
|
|
15004
|
+
angularPagesPath,
|
|
15005
|
+
emberPagesPath,
|
|
15006
|
+
htmlPagesPath,
|
|
15007
|
+
htmxPagesPath
|
|
15008
|
+
].filter((path) => Boolean(path));
|
|
14895
15009
|
const [
|
|
14896
15010
|
,
|
|
14897
15011
|
allReactEntries,
|
|
@@ -14901,6 +15015,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14901
15015
|
vueConventionResult,
|
|
14902
15016
|
angularConventionResult,
|
|
14903
15017
|
emberConventionResult,
|
|
15018
|
+
htmlConventionResults,
|
|
14904
15019
|
allGlobalCssEntries
|
|
14905
15020
|
] = await Promise.all([
|
|
14906
15021
|
tailwindPromise,
|
|
@@ -14911,6 +15026,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14911
15026
|
vuePagesPath ? tracePhase("scan/vue-conventions", () => scanConventions(vuePagesPath, "*.vue")) : emptyConventionResult,
|
|
14912
15027
|
angularPagesPath ? tracePhase("scan/angular-conventions", () => scanConventions(angularPagesPath, "*.ts")) : emptyConventionResult,
|
|
14913
15028
|
emberPagesPath ? tracePhase("scan/ember-conventions", () => scanConventions(emberPagesPath, "*.{gjs,gts,ts}")) : emptyConventionResult,
|
|
15029
|
+
tracePhase("scan/html-conventions", async () => Promise.all(htmlConventionDirs.map((dir) => scanConventions(dir, "*.html")))),
|
|
14914
15030
|
stylesDir ? tracePhase("scan/css", () => scanCssEntryPoints(stylesDir, stylesIgnore)) : []
|
|
14915
15031
|
]);
|
|
14916
15032
|
const allSvelteEntries = svelteConventionResult.pageFiles;
|
|
@@ -14928,15 +15044,99 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14928
15044
|
conventionsMap.angular = angularConventionResult.conventions;
|
|
14929
15045
|
if (emberConventionResult.conventions)
|
|
14930
15046
|
conventionsMap.ember = emberConventionResult.conventions;
|
|
14931
|
-
const
|
|
15047
|
+
const htmlDefaults = {};
|
|
15048
|
+
const htmlPages = {};
|
|
15049
|
+
const htmlConventionSources = [];
|
|
15050
|
+
for (let idx = 0;idx < htmlConventionResults.length; idx++) {
|
|
15051
|
+
const result = htmlConventionResults[idx];
|
|
15052
|
+
if (!result?.conventions)
|
|
15053
|
+
continue;
|
|
15054
|
+
const dirLabel = htmlConventionDirs[idx] ?? "<unknown>";
|
|
15055
|
+
const { defaults: scannedDefaults, pages: scannedPages } = result.conventions;
|
|
15056
|
+
if (scannedDefaults?.error) {
|
|
15057
|
+
if (htmlDefaults.error) {
|
|
15058
|
+
logWarn(`Multiple error.html files found; using ${htmlDefaults.error} and ignoring ${scannedDefaults.error} (${dirLabel}).`);
|
|
15059
|
+
} else {
|
|
15060
|
+
htmlDefaults.error = scannedDefaults.error;
|
|
15061
|
+
htmlConventionSources.push(scannedDefaults.error);
|
|
15062
|
+
}
|
|
15063
|
+
}
|
|
15064
|
+
if (scannedDefaults?.notFound) {
|
|
15065
|
+
if (htmlDefaults.notFound) {
|
|
15066
|
+
logWarn(`Multiple not-found.html files found; using ${htmlDefaults.notFound} and ignoring ${scannedDefaults.notFound} (${dirLabel}).`);
|
|
15067
|
+
} else {
|
|
15068
|
+
htmlDefaults.notFound = scannedDefaults.notFound;
|
|
15069
|
+
htmlConventionSources.push(scannedDefaults.notFound);
|
|
15070
|
+
}
|
|
15071
|
+
}
|
|
15072
|
+
if (scannedDefaults?.loading && !htmlDefaults.loading) {
|
|
15073
|
+
htmlDefaults.loading = scannedDefaults.loading;
|
|
15074
|
+
htmlConventionSources.push(scannedDefaults.loading);
|
|
15075
|
+
}
|
|
15076
|
+
if (scannedPages) {
|
|
15077
|
+
for (const [pageName, page] of Object.entries(scannedPages)) {
|
|
15078
|
+
if (!htmlPages[pageName])
|
|
15079
|
+
htmlPages[pageName] = {};
|
|
15080
|
+
if (page.error && !htmlPages[pageName].error) {
|
|
15081
|
+
htmlPages[pageName].error = page.error;
|
|
15082
|
+
htmlConventionSources.push(page.error);
|
|
15083
|
+
}
|
|
15084
|
+
if (page.loading && !htmlPages[pageName].loading) {
|
|
15085
|
+
htmlPages[pageName].loading = page.loading;
|
|
15086
|
+
htmlConventionSources.push(page.loading);
|
|
15087
|
+
}
|
|
15088
|
+
}
|
|
15089
|
+
}
|
|
15090
|
+
}
|
|
15091
|
+
if (htmlDefaults.error || htmlDefaults.notFound || htmlDefaults.loading || Object.keys(htmlPages).length > 0) {
|
|
15092
|
+
const htmlConventionsOutDir = join26(buildPath, "conventions", "html");
|
|
15093
|
+
mkdirSync11(htmlConventionsOutDir, { recursive: true });
|
|
15094
|
+
const htmlPathRemap = new Map;
|
|
15095
|
+
for (const sourcePath of htmlConventionSources) {
|
|
15096
|
+
const dest = join26(htmlConventionsOutDir, basename9(sourcePath));
|
|
15097
|
+
cpSync(sourcePath, dest, { force: true });
|
|
15098
|
+
htmlPathRemap.set(sourcePath, dest);
|
|
15099
|
+
}
|
|
15100
|
+
const remap = (path) => path ? htmlPathRemap.get(path) ?? path : undefined;
|
|
15101
|
+
const htmlConventions = {};
|
|
15102
|
+
const remappedDefaults = {};
|
|
15103
|
+
const errorRemap = remap(htmlDefaults.error);
|
|
15104
|
+
if (errorRemap)
|
|
15105
|
+
remappedDefaults.error = errorRemap;
|
|
15106
|
+
const notFoundRemap = remap(htmlDefaults.notFound);
|
|
15107
|
+
if (notFoundRemap)
|
|
15108
|
+
remappedDefaults.notFound = notFoundRemap;
|
|
15109
|
+
const loadingRemap = remap(htmlDefaults.loading);
|
|
15110
|
+
if (loadingRemap)
|
|
15111
|
+
remappedDefaults.loading = loadingRemap;
|
|
15112
|
+
if (remappedDefaults.error || remappedDefaults.notFound || remappedDefaults.loading) {
|
|
15113
|
+
htmlConventions.defaults = remappedDefaults;
|
|
15114
|
+
}
|
|
15115
|
+
if (Object.keys(htmlPages).length > 0) {
|
|
15116
|
+
const remappedPages = {};
|
|
15117
|
+
for (const [pageName, page] of Object.entries(htmlPages)) {
|
|
15118
|
+
const entry = {};
|
|
15119
|
+
const errorPath = remap(page.error);
|
|
15120
|
+
if (errorPath)
|
|
15121
|
+
entry.error = errorPath;
|
|
15122
|
+
const loadingPath = remap(page.loading);
|
|
15123
|
+
if (loadingPath)
|
|
15124
|
+
entry.loading = loadingPath;
|
|
15125
|
+
remappedPages[pageName] = entry;
|
|
15126
|
+
}
|
|
15127
|
+
htmlConventions.pages = remappedPages;
|
|
15128
|
+
}
|
|
15129
|
+
conventionsMap.html = htmlConventions;
|
|
15130
|
+
}
|
|
15131
|
+
const notFoundFrameworks = ["react", "svelte", "vue", "angular", "ember", "html"].filter((framework) => conventionsMap[framework]?.defaults?.notFound);
|
|
14932
15132
|
if (notFoundFrameworks.length > 1) {
|
|
14933
15133
|
logWarn(`Multiple frameworks define not-found convention files: ${notFoundFrameworks.join(", ")}. Only one will be used (priority: ${notFoundFrameworks[0]}). Remove not-found files from other frameworks to avoid ambiguity.`);
|
|
14934
15134
|
}
|
|
14935
15135
|
const shouldIncludeHtmlAssets = !isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/html/") && (f2.endsWith(".html") || isStylePath(f2)));
|
|
14936
15136
|
const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
|
|
14937
|
-
if (entry.startsWith(
|
|
15137
|
+
if (entry.startsWith(resolve25(reactIndexesPath))) {
|
|
14938
15138
|
const pageName = basename9(entry, ".tsx");
|
|
14939
|
-
return
|
|
15139
|
+
return join26(reactPagesPath, `${pageName}.tsx`);
|
|
14940
15140
|
}
|
|
14941
15141
|
return null;
|
|
14942
15142
|
}) : allReactEntries;
|
|
@@ -15013,7 +15213,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15013
15213
|
const clientPath = islandSvelteClientPaths[idx];
|
|
15014
15214
|
if (!sourcePath || !clientPath)
|
|
15015
15215
|
continue;
|
|
15016
|
-
islandSvelteClientPathMap.set(
|
|
15216
|
+
islandSvelteClientPathMap.set(resolve25(sourcePath), clientPath);
|
|
15017
15217
|
}
|
|
15018
15218
|
const islandVueClientPathMap = new Map;
|
|
15019
15219
|
for (let idx = 0;idx < islandVueSources.length; idx++) {
|
|
@@ -15021,7 +15221,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15021
15221
|
const clientPath = islandVueClientPaths[idx];
|
|
15022
15222
|
if (!sourcePath || !clientPath)
|
|
15023
15223
|
continue;
|
|
15024
|
-
islandVueClientPathMap.set(
|
|
15224
|
+
islandVueClientPathMap.set(resolve25(sourcePath), clientPath);
|
|
15025
15225
|
}
|
|
15026
15226
|
const islandAngularClientPathMap = new Map;
|
|
15027
15227
|
for (let idx = 0;idx < islandAngularSources.length; idx++) {
|
|
@@ -15029,7 +15229,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15029
15229
|
const clientPath = islandAngularClientPaths[idx];
|
|
15030
15230
|
if (!sourcePath || !clientPath)
|
|
15031
15231
|
continue;
|
|
15032
|
-
islandAngularClientPathMap.set(
|
|
15232
|
+
islandAngularClientPathMap.set(resolve25(sourcePath), clientPath);
|
|
15033
15233
|
}
|
|
15034
15234
|
const reactConventionSources = collectConventionSourceFiles(conventionsMap.react);
|
|
15035
15235
|
const svelteConventionSources = collectConventionSourceFiles(conventionsMap.svelte);
|
|
@@ -15040,7 +15240,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15040
15240
|
const compileReactConventions = async () => {
|
|
15041
15241
|
if (reactConventionSources.length === 0)
|
|
15042
15242
|
return emptyStringArray;
|
|
15043
|
-
const destDir =
|
|
15243
|
+
const destDir = join26(buildPath, "conventions", "react");
|
|
15044
15244
|
rmSync2(destDir, { force: true, recursive: true });
|
|
15045
15245
|
mkdirSync11(destDir, { recursive: true });
|
|
15046
15246
|
const destPaths = [];
|
|
@@ -15056,7 +15256,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15056
15256
|
naming: `${idx}-[name].[ext]`,
|
|
15057
15257
|
outdir: destDir,
|
|
15058
15258
|
plugins: [stylePreprocessorPlugin2],
|
|
15059
|
-
root:
|
|
15259
|
+
root: dirname16(source),
|
|
15060
15260
|
target: "bun",
|
|
15061
15261
|
throw: false,
|
|
15062
15262
|
tsconfig: "./tsconfig.json"
|
|
@@ -15084,7 +15284,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15084
15284
|
angularConventionSources.length > 0 && angularDir ? tracePhase("compile/convention-angular", () => Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(angularConventionSources, angularDir, hmr, styleTransformConfig))) : { serverPaths: emptyStringArray }
|
|
15085
15285
|
]);
|
|
15086
15286
|
const bundleConventionFiles = async (framework, compiledPaths) => {
|
|
15087
|
-
const destDir =
|
|
15287
|
+
const destDir = join26(buildPath, "conventions", framework);
|
|
15088
15288
|
rmSync2(destDir, { force: true, recursive: true });
|
|
15089
15289
|
mkdirSync11(destDir, { recursive: true });
|
|
15090
15290
|
const destPaths = [];
|
|
@@ -15158,7 +15358,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15158
15358
|
}
|
|
15159
15359
|
})) : {
|
|
15160
15360
|
entries: [],
|
|
15161
|
-
generatedRoot:
|
|
15361
|
+
generatedRoot: join26(buildPath, "_island_entries")
|
|
15162
15362
|
};
|
|
15163
15363
|
const islandClientEntryPoints = islandEntryResult.entries.map((entry) => entry.entryPath);
|
|
15164
15364
|
if (serverEntryPoints.length === 0 && reactClientEntryPoints.length === 0 && nonReactClientEntryPoints.length === 0 && islandClientEntryPoints.length === 0 && htmxDir === undefined && htmlDir === undefined) {
|
|
@@ -15194,7 +15394,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15194
15394
|
return {};
|
|
15195
15395
|
}
|
|
15196
15396
|
if (hmr && reactIndexesPath && reactClientEntryPoints.length > 0) {
|
|
15197
|
-
const refreshEntry =
|
|
15397
|
+
const refreshEntry = join26(reactIndexesPath, "_refresh.tsx");
|
|
15198
15398
|
if (!reactClientEntryPoints.includes(refreshEntry))
|
|
15199
15399
|
reactClientEntryPoints.push(refreshEntry);
|
|
15200
15400
|
}
|
|
@@ -15293,19 +15493,19 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15293
15493
|
throw: false
|
|
15294
15494
|
}, resolveBunBuildOverride(bunBuildConfig, "reactClient")) : undefined;
|
|
15295
15495
|
if (reactDir && reactClientEntryPoints.length > 0) {
|
|
15296
|
-
rmSync2(
|
|
15496
|
+
rmSync2(join26(buildPath, "react", "generated", "indexes"), {
|
|
15297
15497
|
force: true,
|
|
15298
15498
|
recursive: true
|
|
15299
15499
|
});
|
|
15300
15500
|
}
|
|
15301
15501
|
if (angularDir && angularClientPaths.length > 0) {
|
|
15302
|
-
rmSync2(
|
|
15502
|
+
rmSync2(join26(buildPath, "angular", "indexes"), {
|
|
15303
15503
|
force: true,
|
|
15304
15504
|
recursive: true
|
|
15305
15505
|
});
|
|
15306
15506
|
}
|
|
15307
15507
|
if (islandClientEntryPoints.length > 0) {
|
|
15308
|
-
rmSync2(
|
|
15508
|
+
rmSync2(join26(buildPath, "islands"), {
|
|
15309
15509
|
force: true,
|
|
15310
15510
|
recursive: true
|
|
15311
15511
|
});
|
|
@@ -15388,7 +15588,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15388
15588
|
globalCssEntries.length > 0 ? tracePhase("bun/global-css", () => bunBuild7(mergeBunBuildConfig({
|
|
15389
15589
|
entrypoints: globalCssEntries,
|
|
15390
15590
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
15391
|
-
outdir: stylesDir ?
|
|
15591
|
+
outdir: stylesDir ? join26(buildPath, basename9(stylesDir)) : buildPath,
|
|
15392
15592
|
plugins: [stylePreprocessorPlugin2],
|
|
15393
15593
|
root: stylesDir || clientRoot,
|
|
15394
15594
|
target: "browser",
|
|
@@ -15397,7 +15597,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15397
15597
|
vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () => bunBuild7(mergeBunBuildConfig({
|
|
15398
15598
|
entrypoints: vueCssPaths,
|
|
15399
15599
|
naming: `[name].[hash].[ext]`,
|
|
15400
|
-
outdir:
|
|
15600
|
+
outdir: join26(buildPath, assetsPath ? basename9(assetsPath) : "assets", "css"),
|
|
15401
15601
|
target: "browser",
|
|
15402
15602
|
throw: false
|
|
15403
15603
|
}, resolveBunBuildOverride(bunBuildConfig, "vueCss")))) : undefined
|
|
@@ -15464,10 +15664,10 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15464
15664
|
if (serverOutputs.length > 0 && angularServerVendorPaths2 && Object.keys(angularServerVendorPaths2).length > 0) {
|
|
15465
15665
|
const { rewriteBuildOutputsWith: rewriteBuildOutputsWith2 } = await Promise.resolve().then(() => (init_rewriteImportsPlugin(), exports_rewriteImportsPlugin));
|
|
15466
15666
|
await tracePhase("postprocess/server-angular-vendor-imports", () => rewriteBuildOutputsWith2(serverOutputs, (artifact) => {
|
|
15467
|
-
const fileDir =
|
|
15667
|
+
const fileDir = dirname16(artifact.path);
|
|
15468
15668
|
const relativePaths = {};
|
|
15469
15669
|
for (const [specifier, absolute] of Object.entries(angularServerVendorPaths2)) {
|
|
15470
|
-
const rel =
|
|
15670
|
+
const rel = relative12(fileDir, absolute);
|
|
15471
15671
|
relativePaths[specifier] = rel.startsWith(".") ? rel : `./${rel}`;
|
|
15472
15672
|
}
|
|
15473
15673
|
return relativePaths;
|
|
@@ -15536,7 +15736,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15536
15736
|
if (skipAngularClientBundle) {
|
|
15537
15737
|
for (const clientPath of angularClientPaths) {
|
|
15538
15738
|
const fileBase = basename9(clientPath, ".js");
|
|
15539
|
-
const relFromCwd =
|
|
15739
|
+
const relFromCwd = relative12(projectRoot, clientPath).replace(/\\/g, "/");
|
|
15540
15740
|
manifest[`${toPascal(fileBase)}Index`] = `/@src/${relFromCwd}`;
|
|
15541
15741
|
}
|
|
15542
15742
|
}
|
|
@@ -15558,7 +15758,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15558
15758
|
const processHtmlPages = async () => {
|
|
15559
15759
|
if (!(htmlDir && htmlPagesPath))
|
|
15560
15760
|
return;
|
|
15561
|
-
const outputHtmlPages = isSingle ?
|
|
15761
|
+
const outputHtmlPages = isSingle ? join26(buildPath, "pages") : join26(buildPath, basename9(htmlDir), "pages");
|
|
15562
15762
|
mkdirSync11(outputHtmlPages, { recursive: true });
|
|
15563
15763
|
cpSync(htmlPagesPath, outputHtmlPages, {
|
|
15564
15764
|
force: true,
|
|
@@ -15580,14 +15780,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15580
15780
|
const processHtmxPages = async () => {
|
|
15581
15781
|
if (!(htmxDir && htmxPagesPath))
|
|
15582
15782
|
return;
|
|
15583
|
-
const outputHtmxPages = isSingle ?
|
|
15783
|
+
const outputHtmxPages = isSingle ? join26(buildPath, "pages") : join26(buildPath, basename9(htmxDir), "pages");
|
|
15584
15784
|
mkdirSync11(outputHtmxPages, { recursive: true });
|
|
15585
15785
|
cpSync(htmxPagesPath, outputHtmxPages, {
|
|
15586
15786
|
force: true,
|
|
15587
15787
|
recursive: true
|
|
15588
15788
|
});
|
|
15589
15789
|
if (shouldCopyHtmx) {
|
|
15590
|
-
const htmxDestDir = isSingle ? buildPath :
|
|
15790
|
+
const htmxDestDir = isSingle ? buildPath : join26(buildPath, basename9(htmxDir));
|
|
15591
15791
|
copyHtmxVendor(htmxDir, htmxDestDir);
|
|
15592
15792
|
}
|
|
15593
15793
|
if (shouldUpdateHtmxAssetPaths) {
|
|
@@ -15649,9 +15849,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15649
15849
|
writeBuildTrace(buildPath);
|
|
15650
15850
|
return { conventions: conventionsMap, manifest };
|
|
15651
15851
|
}
|
|
15652
|
-
writeFileSync8(
|
|
15852
|
+
writeFileSync8(join26(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
|
|
15653
15853
|
if (Object.keys(conventionsMap).length > 0) {
|
|
15654
|
-
writeFileSync8(
|
|
15854
|
+
writeFileSync8(join26(buildPath, "conventions.json"), JSON.stringify(conventionsMap, null, "\t"));
|
|
15655
15855
|
}
|
|
15656
15856
|
writeBuildTrace(buildPath);
|
|
15657
15857
|
if (tailwind && mode === "production") {
|
|
@@ -15752,7 +15952,7 @@ var init_build = __esm(() => {
|
|
|
15752
15952
|
|
|
15753
15953
|
// src/build/buildEmberVendor.ts
|
|
15754
15954
|
import { mkdirSync as mkdirSync12, existsSync as existsSync21 } from "fs";
|
|
15755
|
-
import { join as
|
|
15955
|
+
import { join as join27 } from "path";
|
|
15756
15956
|
import { rm as rm9 } from "fs/promises";
|
|
15757
15957
|
var {build: bunBuild8 } = globalThis.Bun;
|
|
15758
15958
|
var toSafeFileName5 = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_"), generateMacrosShim = () => `// Generated shim for @embroider/macros \u2014 provides minimal runtime
|
|
@@ -15804,7 +16004,7 @@ export const importSync = (specifier) => {
|
|
|
15804
16004
|
if (standaloneSpecifiers.has(specifier)) {
|
|
15805
16005
|
return { resolveTo: specifier, specifier };
|
|
15806
16006
|
}
|
|
15807
|
-
const emberInternalPath =
|
|
16007
|
+
const emberInternalPath = join27(cwd2, "node_modules/ember-source/dist/packages", specifier, "index.js");
|
|
15808
16008
|
if (!existsSync21(emberInternalPath)) {
|
|
15809
16009
|
throw new Error(`Ember vendor build: cannot find ${specifier} at ${emberInternalPath}. ` + `Is ember-source installed and at least 6.12?`);
|
|
15810
16010
|
}
|
|
@@ -15836,7 +16036,7 @@ export const importSync = (specifier) => {
|
|
|
15836
16036
|
if (standalonePackages.has(args.path)) {
|
|
15837
16037
|
return;
|
|
15838
16038
|
}
|
|
15839
|
-
const internal =
|
|
16039
|
+
const internal = join27(cwd2, "node_modules/ember-source/dist/packages", args.path, "index.js");
|
|
15840
16040
|
if (existsSync21(internal)) {
|
|
15841
16041
|
return { path: internal };
|
|
15842
16042
|
}
|
|
@@ -15844,16 +16044,16 @@ export const importSync = (specifier) => {
|
|
|
15844
16044
|
});
|
|
15845
16045
|
}
|
|
15846
16046
|
}), buildEmberVendor = async (buildDir, cwd2 = process.cwd()) => {
|
|
15847
|
-
const vendorDir =
|
|
16047
|
+
const vendorDir = join27(buildDir, "ember", "vendor");
|
|
15848
16048
|
mkdirSync12(vendorDir, { recursive: true });
|
|
15849
|
-
const tmpDir =
|
|
16049
|
+
const tmpDir = join27(buildDir, "_ember_vendor_tmp");
|
|
15850
16050
|
mkdirSync12(tmpDir, { recursive: true });
|
|
15851
|
-
const macrosShimPath =
|
|
16051
|
+
const macrosShimPath = join27(tmpDir, "embroider_macros_shim.js");
|
|
15852
16052
|
await Bun.write(macrosShimPath, generateMacrosShim());
|
|
15853
16053
|
const resolutions = REQUIRED_EMBER_SPECIFIERS.map((specifier) => resolveEmberSpecifier(specifier, cwd2));
|
|
15854
16054
|
const entrypoints = await Promise.all(resolutions.map(async (resolution) => {
|
|
15855
16055
|
const safeName = toSafeFileName5(resolution.specifier);
|
|
15856
|
-
const entryPath =
|
|
16056
|
+
const entryPath = join27(tmpDir, `${safeName}.js`);
|
|
15857
16057
|
const source = resolution.specifier === "@embroider/macros" ? `export * from ${JSON.stringify(macrosShimPath)};
|
|
15858
16058
|
` : generateVendorEntrySource2(resolution);
|
|
15859
16059
|
await Bun.write(entryPath, source);
|
|
@@ -15899,7 +16099,7 @@ var init_buildEmberVendor = __esm(() => {
|
|
|
15899
16099
|
// src/dev/dependencyGraph.ts
|
|
15900
16100
|
import { existsSync as existsSync22, readFileSync as readFileSync15 } from "fs";
|
|
15901
16101
|
var {Glob: Glob8 } = globalThis.Bun;
|
|
15902
|
-
import { resolve as
|
|
16102
|
+
import { resolve as resolve26 } from "path";
|
|
15903
16103
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
15904
16104
|
const lower = filePath.toLowerCase();
|
|
15905
16105
|
if (lower.endsWith(".ts") || lower.endsWith(".tsx") || lower.endsWith(".jsx"))
|
|
@@ -15913,8 +16113,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15913
16113
|
if (!importPath.startsWith(".") && !importPath.startsWith("/")) {
|
|
15914
16114
|
return null;
|
|
15915
16115
|
}
|
|
15916
|
-
const fromDir =
|
|
15917
|
-
const normalized =
|
|
16116
|
+
const fromDir = resolve26(fromFile, "..");
|
|
16117
|
+
const normalized = resolve26(fromDir, importPath);
|
|
15918
16118
|
const extensions = [
|
|
15919
16119
|
".ts",
|
|
15920
16120
|
".tsx",
|
|
@@ -15944,7 +16144,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15944
16144
|
dependents.delete(normalizedPath);
|
|
15945
16145
|
}
|
|
15946
16146
|
}, addFileToGraph = (graph, filePath) => {
|
|
15947
|
-
const normalizedPath =
|
|
16147
|
+
const normalizedPath = resolve26(filePath);
|
|
15948
16148
|
if (!existsSync22(normalizedPath))
|
|
15949
16149
|
return;
|
|
15950
16150
|
const dependencies = extractDependencies(normalizedPath);
|
|
@@ -15961,10 +16161,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15961
16161
|
}, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
|
|
15962
16162
|
const processedFiles = new Set;
|
|
15963
16163
|
const glob = new Glob8("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
|
|
15964
|
-
const resolvedDirs = directories.map((dir) =>
|
|
16164
|
+
const resolvedDirs = directories.map((dir) => resolve26(dir)).filter((dir) => existsSync22(dir));
|
|
15965
16165
|
const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
|
|
15966
16166
|
for (const file5 of allFiles) {
|
|
15967
|
-
const fullPath =
|
|
16167
|
+
const fullPath = resolve26(file5);
|
|
15968
16168
|
if (IGNORED_SEGMENTS.some((seg) => fullPath.includes(seg)))
|
|
15969
16169
|
continue;
|
|
15970
16170
|
if (processedFiles.has(fullPath))
|
|
@@ -16019,8 +16219,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
16019
16219
|
resolveRegexMatches(styleUrlSingularRegex, content, filePath, dependencies);
|
|
16020
16220
|
extractStyleUrlsDependencies(content, filePath, dependencies);
|
|
16021
16221
|
}, extractJsDependencies = (filePath, content, loader) => {
|
|
16022
|
-
const
|
|
16023
|
-
const imports =
|
|
16222
|
+
const transpiler6 = loader === "tsx" ? tsTranspiler : jsTranspiler;
|
|
16223
|
+
const imports = transpiler6.scanImports(content);
|
|
16024
16224
|
const dependencies = [];
|
|
16025
16225
|
for (const imp of imports) {
|
|
16026
16226
|
const resolved = resolveImportPath2(imp.path, filePath);
|
|
@@ -16077,7 +16277,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
16077
16277
|
return [];
|
|
16078
16278
|
}
|
|
16079
16279
|
}, getAffectedFiles = (graph, changedFile) => {
|
|
16080
|
-
const normalizedPath =
|
|
16280
|
+
const normalizedPath = resolve26(changedFile);
|
|
16081
16281
|
const affected = new Set;
|
|
16082
16282
|
const toProcess = [normalizedPath];
|
|
16083
16283
|
const processNode = (current) => {
|
|
@@ -16117,7 +16317,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
16117
16317
|
}
|
|
16118
16318
|
graph.dependents.delete(normalizedPath);
|
|
16119
16319
|
}, removeFileFromGraph = (graph, filePath) => {
|
|
16120
|
-
const normalizedPath =
|
|
16320
|
+
const normalizedPath = resolve26(filePath);
|
|
16121
16321
|
removeDepsForFile(graph, normalizedPath);
|
|
16122
16322
|
removeDependentsForFile(graph, normalizedPath);
|
|
16123
16323
|
};
|
|
@@ -16160,12 +16360,12 @@ var globalVersionCounter = 0, createModuleVersionTracker = () => new Map, getNex
|
|
|
16160
16360
|
};
|
|
16161
16361
|
|
|
16162
16362
|
// src/dev/configResolver.ts
|
|
16163
|
-
import { resolve as
|
|
16363
|
+
import { resolve as resolve27 } from "path";
|
|
16164
16364
|
var resolveBuildPaths = (config) => {
|
|
16165
16365
|
const cwd2 = process.cwd();
|
|
16166
16366
|
const normalize = (path) => path.replace(/\\/g, "/");
|
|
16167
|
-
const withDefault = (value, fallback) => normalize(
|
|
16168
|
-
const optional = (value) => value ? normalize(
|
|
16367
|
+
const withDefault = (value, fallback) => normalize(resolve27(cwd2, value ?? fallback));
|
|
16368
|
+
const optional = (value) => value ? normalize(resolve27(cwd2, value)) : undefined;
|
|
16169
16369
|
return {
|
|
16170
16370
|
angularDir: optional(config.angularDirectory),
|
|
16171
16371
|
assetsDir: optional(config.assetsDirectory),
|
|
@@ -16218,7 +16418,7 @@ var init_clientManager = __esm(() => {
|
|
|
16218
16418
|
|
|
16219
16419
|
// src/dev/pathUtils.ts
|
|
16220
16420
|
import { existsSync as existsSync23, readdirSync, readFileSync as readFileSync16 } from "fs";
|
|
16221
|
-
import { dirname as
|
|
16421
|
+
import { dirname as dirname17, resolve as resolve28 } from "path";
|
|
16222
16422
|
var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
16223
16423
|
if (shouldIgnorePath(filePath, resolved)) {
|
|
16224
16424
|
return "ignored";
|
|
@@ -16294,7 +16494,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
16294
16494
|
return "unknown";
|
|
16295
16495
|
}, collectAngularResourceDirs = (angularDir) => {
|
|
16296
16496
|
const out = new Set;
|
|
16297
|
-
const angularRoot =
|
|
16497
|
+
const angularRoot = resolve28(angularDir);
|
|
16298
16498
|
const angularRootNormalized = normalizePath(angularRoot);
|
|
16299
16499
|
const walk = (dir) => {
|
|
16300
16500
|
let entries;
|
|
@@ -16307,7 +16507,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
16307
16507
|
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
16308
16508
|
continue;
|
|
16309
16509
|
}
|
|
16310
|
-
const full =
|
|
16510
|
+
const full = resolve28(dir, entry.name);
|
|
16311
16511
|
if (entry.isDirectory()) {
|
|
16312
16512
|
walk(full);
|
|
16313
16513
|
continue;
|
|
@@ -16346,10 +16546,10 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
16346
16546
|
refs.push(strMatch[1]);
|
|
16347
16547
|
}
|
|
16348
16548
|
}
|
|
16349
|
-
const componentDir =
|
|
16549
|
+
const componentDir = dirname17(full);
|
|
16350
16550
|
for (const ref of refs) {
|
|
16351
|
-
const refAbs = normalizePath(
|
|
16352
|
-
const refDir = normalizePath(
|
|
16551
|
+
const refAbs = normalizePath(resolve28(componentDir, ref));
|
|
16552
|
+
const refDir = normalizePath(dirname17(refAbs));
|
|
16353
16553
|
if (refDir === angularRootNormalized || refDir.startsWith(angularRootNormalized + "/")) {
|
|
16354
16554
|
continue;
|
|
16355
16555
|
}
|
|
@@ -16365,7 +16565,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
16365
16565
|
const push = (path) => {
|
|
16366
16566
|
if (!path)
|
|
16367
16567
|
return;
|
|
16368
|
-
const abs = normalizePath(
|
|
16568
|
+
const abs = normalizePath(resolve28(cwd2, path));
|
|
16369
16569
|
if (!roots.includes(abs))
|
|
16370
16570
|
roots.push(abs);
|
|
16371
16571
|
};
|
|
@@ -16390,7 +16590,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
16390
16590
|
push(cfg.assetsDir);
|
|
16391
16591
|
push(cfg.stylesDir);
|
|
16392
16592
|
for (const candidate of ["src", "db", "assets", "styles"]) {
|
|
16393
|
-
const abs = normalizePath(
|
|
16593
|
+
const abs = normalizePath(resolve28(cwd2, candidate));
|
|
16394
16594
|
if (existsSync23(abs) && !roots.includes(abs))
|
|
16395
16595
|
roots.push(abs);
|
|
16396
16596
|
}
|
|
@@ -16461,7 +16661,7 @@ var init_pathUtils = __esm(() => {
|
|
|
16461
16661
|
// src/dev/fileWatcher.ts
|
|
16462
16662
|
import { watch } from "fs";
|
|
16463
16663
|
import { existsSync as existsSync24 } from "fs";
|
|
16464
|
-
import { join as
|
|
16664
|
+
import { join as join28, resolve as resolve29 } from "path";
|
|
16465
16665
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
16466
16666
|
try {
|
|
16467
16667
|
removeFileFromGraph(graph, fullPath);
|
|
@@ -16488,7 +16688,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
16488
16688
|
if (shouldSkipFilename(filename, isStylesDir)) {
|
|
16489
16689
|
return;
|
|
16490
16690
|
}
|
|
16491
|
-
const fullPath =
|
|
16691
|
+
const fullPath = join28(absolutePath, filename).replace(/\\/g, "/");
|
|
16492
16692
|
if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
|
|
16493
16693
|
return;
|
|
16494
16694
|
}
|
|
@@ -16506,7 +16706,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
16506
16706
|
}, addFileWatchers = (state, paths, onFileChange) => {
|
|
16507
16707
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
16508
16708
|
paths.forEach((path) => {
|
|
16509
|
-
const absolutePath =
|
|
16709
|
+
const absolutePath = resolve29(path).replace(/\\/g, "/");
|
|
16510
16710
|
if (!existsSync24(absolutePath)) {
|
|
16511
16711
|
return;
|
|
16512
16712
|
}
|
|
@@ -16517,7 +16717,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
16517
16717
|
const watchPaths = getWatchPaths(config, state.resolvedPaths);
|
|
16518
16718
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
16519
16719
|
watchPaths.forEach((path) => {
|
|
16520
|
-
const absolutePath =
|
|
16720
|
+
const absolutePath = resolve29(path).replace(/\\/g, "/");
|
|
16521
16721
|
if (!existsSync24(absolutePath)) {
|
|
16522
16722
|
return;
|
|
16523
16723
|
}
|
|
@@ -16532,13 +16732,13 @@ var init_fileWatcher = __esm(() => {
|
|
|
16532
16732
|
});
|
|
16533
16733
|
|
|
16534
16734
|
// src/dev/assetStore.ts
|
|
16535
|
-
import { resolve as
|
|
16735
|
+
import { resolve as resolve30 } from "path";
|
|
16536
16736
|
import { readdir as readdir4, unlink } from "fs/promises";
|
|
16537
16737
|
var mimeTypes, getMimeType = (filePath) => {
|
|
16538
16738
|
const ext = filePath.slice(filePath.lastIndexOf("."));
|
|
16539
16739
|
return mimeTypes[ext] ?? "application/octet-stream";
|
|
16540
16740
|
}, HASHED_FILE_RE, stripHash = (webPath) => webPath.replace(/\.[a-z0-9]{8}(\.(js|css|mjs))$/, "$1"), processWalkEntry = (entry, dir, liveByIdentity, walkAndClean) => {
|
|
16541
|
-
const fullPath =
|
|
16741
|
+
const fullPath = resolve30(dir, entry.name);
|
|
16542
16742
|
if (entry.isDirectory()) {
|
|
16543
16743
|
return walkAndClean(fullPath);
|
|
16544
16744
|
}
|
|
@@ -16554,10 +16754,10 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
16554
16754
|
}, cleanStaleAssets = async (store, manifest, buildDir) => {
|
|
16555
16755
|
const liveByIdentity = new Map;
|
|
16556
16756
|
for (const webPath of store.keys()) {
|
|
16557
|
-
const diskPath =
|
|
16757
|
+
const diskPath = resolve30(buildDir, webPath.slice(1));
|
|
16558
16758
|
liveByIdentity.set(stripHash(diskPath), diskPath);
|
|
16559
16759
|
}
|
|
16560
|
-
const absBuildDir =
|
|
16760
|
+
const absBuildDir = resolve30(buildDir);
|
|
16561
16761
|
Object.values(manifest).forEach((val) => {
|
|
16562
16762
|
if (!HASHED_FILE_RE.test(val))
|
|
16563
16763
|
return;
|
|
@@ -16575,7 +16775,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
16575
16775
|
} catch {}
|
|
16576
16776
|
}, lookupAsset = (store, path) => store.get(path), processScanEntry = (entry, dir, prefix, store, scanDir) => {
|
|
16577
16777
|
if (entry.isDirectory()) {
|
|
16578
|
-
return scanDir(
|
|
16778
|
+
return scanDir(resolve30(dir, entry.name), `${prefix}${entry.name}/`);
|
|
16579
16779
|
}
|
|
16580
16780
|
if (!entry.name.startsWith("chunk-")) {
|
|
16581
16781
|
return null;
|
|
@@ -16584,7 +16784,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
16584
16784
|
if (store.has(webPath)) {
|
|
16585
16785
|
return null;
|
|
16586
16786
|
}
|
|
16587
|
-
return Bun.file(
|
|
16787
|
+
return Bun.file(resolve30(dir, entry.name)).bytes().then((bytes) => {
|
|
16588
16788
|
store.set(webPath, bytes);
|
|
16589
16789
|
return;
|
|
16590
16790
|
}).catch(() => {});
|
|
@@ -16606,7 +16806,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
16606
16806
|
for (const webPath of newIdentities.values()) {
|
|
16607
16807
|
if (store.has(webPath))
|
|
16608
16808
|
continue;
|
|
16609
|
-
loadPromises.push(Bun.file(
|
|
16809
|
+
loadPromises.push(Bun.file(resolve30(buildDir, webPath.slice(1))).bytes().then((bytes) => {
|
|
16610
16810
|
store.set(webPath, bytes);
|
|
16611
16811
|
return;
|
|
16612
16812
|
}).catch(() => {}));
|
|
@@ -16732,9 +16932,9 @@ var init_transformCache = __esm(() => {
|
|
|
16732
16932
|
});
|
|
16733
16933
|
|
|
16734
16934
|
// src/dev/reactComponentClassifier.ts
|
|
16735
|
-
import { resolve as
|
|
16935
|
+
import { resolve as resolve31 } from "path";
|
|
16736
16936
|
var classifyComponent = (filePath) => {
|
|
16737
|
-
const normalizedPath =
|
|
16937
|
+
const normalizedPath = resolve31(filePath);
|
|
16738
16938
|
if (normalizedPath.includes("/react/pages/")) {
|
|
16739
16939
|
return "server";
|
|
16740
16940
|
}
|
|
@@ -16746,7 +16946,7 @@ var classifyComponent = (filePath) => {
|
|
|
16746
16946
|
var init_reactComponentClassifier = () => {};
|
|
16747
16947
|
|
|
16748
16948
|
// src/dev/moduleMapper.ts
|
|
16749
|
-
import { basename as basename10, resolve as
|
|
16949
|
+
import { basename as basename10, resolve as resolve32 } from "path";
|
|
16750
16950
|
var buildModulePaths = (moduleKeys, manifest) => {
|
|
16751
16951
|
const modulePaths = {};
|
|
16752
16952
|
moduleKeys.forEach((key) => {
|
|
@@ -16756,7 +16956,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
16756
16956
|
});
|
|
16757
16957
|
return modulePaths;
|
|
16758
16958
|
}, processChangedFile = (sourceFile, framework, manifest, resolvedPaths, processedFiles) => {
|
|
16759
|
-
const normalizedFile =
|
|
16959
|
+
const normalizedFile = resolve32(sourceFile);
|
|
16760
16960
|
const normalizedPath = normalizedFile.replace(/\\/g, "/");
|
|
16761
16961
|
if (processedFiles.has(normalizedFile)) {
|
|
16762
16962
|
return null;
|
|
@@ -16792,7 +16992,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
16792
16992
|
});
|
|
16793
16993
|
return grouped;
|
|
16794
16994
|
}, mapSourceFileToManifestKeys = (sourceFile, framework, resolvedPaths) => {
|
|
16795
|
-
const normalizedFile =
|
|
16995
|
+
const normalizedFile = resolve32(sourceFile);
|
|
16796
16996
|
const fileName = basename10(normalizedFile);
|
|
16797
16997
|
const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|css|html)$/, "");
|
|
16798
16998
|
const pascalName = toPascal(baseName);
|
|
@@ -16967,7 +17167,7 @@ __export(exports_moduleServer, {
|
|
|
16967
17167
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
16968
17168
|
});
|
|
16969
17169
|
import { existsSync as existsSync25, readFileSync as readFileSync18, statSync as statSync2 } from "fs";
|
|
16970
|
-
import { basename as basename11, dirname as
|
|
17170
|
+
import { basename as basename11, dirname as dirname18, extname as extname8, join as join29, resolve as resolve33, relative as relative13 } from "path";
|
|
16971
17171
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
16972
17172
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
16973
17173
|
const allExports = [];
|
|
@@ -16987,7 +17187,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
|
|
|
16987
17187
|
${stubs}
|
|
16988
17188
|
`;
|
|
16989
17189
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
16990
|
-
const found = extensions.find((ext) => existsSync25(
|
|
17190
|
+
const found = extensions.find((ext) => existsSync25(resolve33(projectRoot, srcPath + ext)));
|
|
16991
17191
|
return found ? srcPath + found : srcPath;
|
|
16992
17192
|
}, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
16993
17193
|
const entries = Object.entries(vendorPaths).sort(([a], [b2]) => b2.length - a.length);
|
|
@@ -17002,7 +17202,7 @@ ${stubs}
|
|
|
17002
17202
|
return invalidationVersion > 0 ? `${mtime}.${invalidationVersion}` : `${mtime}`;
|
|
17003
17203
|
}, srcUrl = (relPath, projectRoot) => {
|
|
17004
17204
|
const base = `${SRC_PREFIX}${relPath.replace(/\\/g, "/")}`;
|
|
17005
|
-
const absPath =
|
|
17205
|
+
const absPath = resolve33(projectRoot, relPath);
|
|
17006
17206
|
const cached = mtimeCache.get(absPath);
|
|
17007
17207
|
if (cached !== undefined)
|
|
17008
17208
|
return `${base}?v=${buildVersion(cached, absPath)}`;
|
|
@@ -17014,12 +17214,12 @@ ${stubs}
|
|
|
17014
17214
|
return base;
|
|
17015
17215
|
}
|
|
17016
17216
|
}, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
|
|
17017
|
-
const absPath =
|
|
17018
|
-
const rel =
|
|
17217
|
+
const absPath = resolve33(fileDir, relPath);
|
|
17218
|
+
const rel = relative13(projectRoot, absPath);
|
|
17019
17219
|
const extension = extname8(rel);
|
|
17020
17220
|
let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
|
|
17021
17221
|
if (extname8(srcPath) === ".svelte") {
|
|
17022
|
-
srcPath =
|
|
17222
|
+
srcPath = relative13(projectRoot, resolveSvelteModulePath(resolve33(projectRoot, srcPath)));
|
|
17023
17223
|
}
|
|
17024
17224
|
return srcUrl(srcPath, projectRoot);
|
|
17025
17225
|
}, NODE_BUILTIN_RE, resolveAbsoluteSpecifier = (specifier, projectRoot) => {
|
|
@@ -17031,27 +17231,27 @@ ${stubs}
|
|
|
17031
17231
|
"import"
|
|
17032
17232
|
]);
|
|
17033
17233
|
if (fromExports)
|
|
17034
|
-
return
|
|
17234
|
+
return relative13(projectRoot, fromExports);
|
|
17035
17235
|
try {
|
|
17036
17236
|
const isScoped = specifier.startsWith("@");
|
|
17037
17237
|
const parts = specifier.split("/");
|
|
17038
17238
|
const packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];
|
|
17039
17239
|
const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
|
|
17040
17240
|
if (!subpath) {
|
|
17041
|
-
const pkgDir =
|
|
17042
|
-
const pkgJsonPath =
|
|
17241
|
+
const pkgDir = resolve33(projectRoot, "node_modules", packageName ?? "");
|
|
17242
|
+
const pkgJsonPath = join29(pkgDir, "package.json");
|
|
17043
17243
|
if (existsSync25(pkgJsonPath)) {
|
|
17044
17244
|
const pkg = JSON.parse(readFileSync18(pkgJsonPath, "utf-8"));
|
|
17045
17245
|
const esmEntry = typeof pkg.module === "string" && pkg.module || typeof pkg.browser === "string" && pkg.browser;
|
|
17046
17246
|
if (esmEntry) {
|
|
17047
|
-
const resolved =
|
|
17247
|
+
const resolved = resolve33(pkgDir, esmEntry);
|
|
17048
17248
|
if (existsSync25(resolved))
|
|
17049
|
-
return
|
|
17249
|
+
return relative13(projectRoot, resolved);
|
|
17050
17250
|
}
|
|
17051
17251
|
}
|
|
17052
17252
|
}
|
|
17053
17253
|
} catch {}
|
|
17054
|
-
return
|
|
17254
|
+
return relative13(projectRoot, Bun.resolveSync(specifier, projectRoot));
|
|
17055
17255
|
} catch {
|
|
17056
17256
|
return;
|
|
17057
17257
|
}
|
|
@@ -17076,28 +17276,28 @@ ${stubs}
|
|
|
17076
17276
|
};
|
|
17077
17277
|
result = result.replace(/^((?:import\s+[\s\S]+?\s+from|export\s+[\s\S]+?\s+from|import)\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
|
|
17078
17278
|
result = result.replace(/(import\s*\(\s*["'])([^"'./][^"']*)(["']\s*\))/g, stubReplace);
|
|
17079
|
-
const fileDir =
|
|
17279
|
+
const fileDir = dirname18(filePath);
|
|
17080
17280
|
result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
17081
17281
|
result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
17082
17282
|
result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}`);
|
|
17083
17283
|
const rewriteAbsoluteToSrc = (_match, prefix, absPath, _ext, suffix) => {
|
|
17084
17284
|
if (absPath.startsWith(projectRoot)) {
|
|
17085
|
-
const rel2 =
|
|
17285
|
+
const rel2 = relative13(projectRoot, absPath).replace(/\\/g, "/");
|
|
17086
17286
|
return `${prefix}${srcUrl(rel2, projectRoot)}${suffix}`;
|
|
17087
17287
|
}
|
|
17088
|
-
const rel =
|
|
17288
|
+
const rel = relative13(projectRoot, absPath).replace(/\\/g, "/");
|
|
17089
17289
|
return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
|
|
17090
17290
|
};
|
|
17091
17291
|
result = result.replace(/((?:from|import)\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["'])/g, rewriteAbsoluteToSrc);
|
|
17092
17292
|
result = result.replace(/(import\s*\(\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["']\s*\))/g, rewriteAbsoluteToSrc);
|
|
17093
17293
|
result = result.replace(/new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g, (_match, relPath) => {
|
|
17094
|
-
const absPath =
|
|
17095
|
-
const rel =
|
|
17294
|
+
const absPath = resolve33(fileDir, relPath);
|
|
17295
|
+
const rel = relative13(projectRoot, absPath);
|
|
17096
17296
|
return `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;
|
|
17097
17297
|
});
|
|
17098
17298
|
result = result.replace(/import\.meta\.resolve\(\s*["'](\.\.?\/[^"']+)["']\s*\)/g, (_match, relPath) => {
|
|
17099
|
-
const absPath =
|
|
17100
|
-
const rel =
|
|
17299
|
+
const absPath = resolve33(fileDir, relPath);
|
|
17300
|
+
const rel = relative13(projectRoot, absPath);
|
|
17101
17301
|
return `'${srcUrl(rel, projectRoot)}'`;
|
|
17102
17302
|
});
|
|
17103
17303
|
return result;
|
|
@@ -17153,7 +17353,7 @@ ${code}`;
|
|
|
17153
17353
|
transpiled = `var $RefreshReg$ = window.$RefreshReg$ || function(){};
|
|
17154
17354
|
` + `var $RefreshSig$ = window.$RefreshSig$ || function(){ return function(t){ return t; }; };
|
|
17155
17355
|
${transpiled}`;
|
|
17156
|
-
const relPath =
|
|
17356
|
+
const relPath = relative13(projectRoot, filePath).replace(/\\/g, "/");
|
|
17157
17357
|
transpiled = transpiled.replace(/\binput\.tsx:/g, `${relPath}:`);
|
|
17158
17358
|
transpiled += buildIslandMetadataExports(raw);
|
|
17159
17359
|
return rewriteImports(transpiled, filePath, projectRoot, rewriter);
|
|
@@ -17162,13 +17362,13 @@ ${transpiled}`;
|
|
|
17162
17362
|
const ext = extname8(filePath);
|
|
17163
17363
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
17164
17364
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
17165
|
-
let
|
|
17365
|
+
let transpiler6 = jsTranspiler2;
|
|
17166
17366
|
if (isTSX)
|
|
17167
|
-
|
|
17367
|
+
transpiler6 = tsxTranspiler;
|
|
17168
17368
|
else if (isTS)
|
|
17169
|
-
|
|
17170
|
-
const valueExports = isTS ?
|
|
17171
|
-
let transpiled =
|
|
17369
|
+
transpiler6 = tsTranspiler2;
|
|
17370
|
+
const valueExports = isTS ? transpiler6.scan(raw).exports : [];
|
|
17371
|
+
let transpiled = transpiler6.transformSync(raw);
|
|
17172
17372
|
if (isTS) {
|
|
17173
17373
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
17174
17374
|
}
|
|
@@ -17314,11 +17514,11 @@ ${code}`;
|
|
|
17314
17514
|
if (compiled.css?.code) {
|
|
17315
17515
|
const cssPath = `${filePath}.css`;
|
|
17316
17516
|
svelteExternalCss.set(cssPath, compiled.css.code);
|
|
17317
|
-
const cssUrl = srcUrl(
|
|
17517
|
+
const cssUrl = srcUrl(relative13(projectRoot, cssPath), projectRoot);
|
|
17318
17518
|
code = `import "${cssUrl}";
|
|
17319
17519
|
${code}`;
|
|
17320
17520
|
}
|
|
17321
|
-
const moduleUrl = `${SRC_PREFIX}${
|
|
17521
|
+
const moduleUrl = `${SRC_PREFIX}${relative13(projectRoot, filePath).replace(/\\/g, "/")}`;
|
|
17322
17522
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
17323
17523
|
` + ` if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
17324
17524
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
@@ -17344,6 +17544,8 @@ ${code}`;
|
|
|
17344
17544
|
const templateResult = compiler.compileTemplate({
|
|
17345
17545
|
compilerOptions: {
|
|
17346
17546
|
bindingMetadata: compiledScript.bindings,
|
|
17547
|
+
expressionPlugins: ["typescript"],
|
|
17548
|
+
isCustomElement: (tag) => tag === "absolute-island",
|
|
17347
17549
|
prefixIdentifiers: true
|
|
17348
17550
|
},
|
|
17349
17551
|
filename: filePath,
|
|
@@ -17407,8 +17609,8 @@ ${code}`;
|
|
|
17407
17609
|
code = injectVueHmr(code, filePath, projectRoot, vueDir);
|
|
17408
17610
|
return rewriteImports(code, filePath, projectRoot, rewriter);
|
|
17409
17611
|
}, injectVueHmr = (code, filePath, projectRoot, vueDir) => {
|
|
17410
|
-
const hmrBase = vueDir ?
|
|
17411
|
-
const hmrId =
|
|
17612
|
+
const hmrBase = vueDir ? resolve33(vueDir) : projectRoot;
|
|
17613
|
+
const hmrId = relative13(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
|
|
17412
17614
|
let result = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
|
|
17413
17615
|
result += [
|
|
17414
17616
|
"",
|
|
@@ -17571,7 +17773,7 @@ export default {};
|
|
|
17571
17773
|
const escaped = virtualCss.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
17572
17774
|
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);`);
|
|
17573
17775
|
}, resolveSourcePath = (relPath, projectRoot) => {
|
|
17574
|
-
const filePath =
|
|
17776
|
+
const filePath = resolve33(projectRoot, relPath);
|
|
17575
17777
|
const ext = extname8(filePath);
|
|
17576
17778
|
if (ext === ".svelte")
|
|
17577
17779
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
@@ -17598,7 +17800,7 @@ export default {};
|
|
|
17598
17800
|
if (!TRANSPILABLE.has(ext))
|
|
17599
17801
|
return;
|
|
17600
17802
|
const stat3 = statSync2(filePath);
|
|
17601
|
-
const resolvedVueDir = vueDir ?
|
|
17803
|
+
const resolvedVueDir = vueDir ? resolve33(vueDir) : undefined;
|
|
17602
17804
|
let content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
|
|
17603
17805
|
const isComponentJs = ext === ".js" && filePath.endsWith(".component.js") && filePath.replace(/\\/g, "/").includes("/.absolutejs/generated/angular/");
|
|
17604
17806
|
if (isComponentJs) {
|
|
@@ -17657,7 +17859,7 @@ export default {};
|
|
|
17657
17859
|
const relPath = pathname.slice(SRC_PREFIX.length);
|
|
17658
17860
|
if (relPath === "bun:wrap" || relPath.startsWith("bun:wrap?"))
|
|
17659
17861
|
return handleBunWrapRequest();
|
|
17660
|
-
const virtualCssResponse = handleVirtualSvelteCss(
|
|
17862
|
+
const virtualCssResponse = handleVirtualSvelteCss(resolve33(projectRoot, relPath));
|
|
17661
17863
|
if (virtualCssResponse)
|
|
17662
17864
|
return virtualCssResponse;
|
|
17663
17865
|
const { filePath, ext } = resolveSourcePath(relPath, projectRoot);
|
|
@@ -17673,11 +17875,11 @@ export default {};
|
|
|
17673
17875
|
SRC_IMPORT_RE.lastIndex = 0;
|
|
17674
17876
|
while ((match = SRC_IMPORT_RE.exec(content)) !== null) {
|
|
17675
17877
|
if (match[1])
|
|
17676
|
-
files.push(
|
|
17878
|
+
files.push(resolve33(projectRoot, match[1]));
|
|
17677
17879
|
}
|
|
17678
17880
|
return files;
|
|
17679
17881
|
}, invalidateModule = (filePath) => {
|
|
17680
|
-
const resolved =
|
|
17882
|
+
const resolved = resolve33(filePath);
|
|
17681
17883
|
invalidate(filePath);
|
|
17682
17884
|
if (resolved !== filePath)
|
|
17683
17885
|
invalidate(resolved);
|
|
@@ -17824,7 +18026,7 @@ __export(exports_resolveOwningComponents, {
|
|
|
17824
18026
|
invalidateResourceIndex: () => invalidateResourceIndex
|
|
17825
18027
|
});
|
|
17826
18028
|
import { readdirSync as readdirSync2, readFileSync as readFileSync19, statSync as statSync3 } from "fs";
|
|
17827
|
-
import { dirname as
|
|
18029
|
+
import { dirname as dirname19, extname as extname9, join as join30, resolve as resolve34 } from "path";
|
|
17828
18030
|
import ts3 from "typescript";
|
|
17829
18031
|
var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") || file5.endsWith(".tsx"), walkAngularSourceFiles = (root) => {
|
|
17830
18032
|
const out = [];
|
|
@@ -17839,7 +18041,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
17839
18041
|
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
17840
18042
|
continue;
|
|
17841
18043
|
}
|
|
17842
|
-
const full =
|
|
18044
|
+
const full = join30(dir, entry.name);
|
|
17843
18045
|
if (entry.isDirectory()) {
|
|
17844
18046
|
visit(full);
|
|
17845
18047
|
} else if (entry.isFile() && isAngularSourceFile(entry.name)) {
|
|
@@ -17937,7 +18139,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
17937
18139
|
};
|
|
17938
18140
|
visit(sourceFile);
|
|
17939
18141
|
return out;
|
|
17940
|
-
}, safeNormalize = (path) =>
|
|
18142
|
+
}, safeNormalize = (path) => resolve34(path).replace(/\\/g, "/"), resolveOwningComponents = (params) => {
|
|
17941
18143
|
const { changedFilePath, userAngularRoot } = params;
|
|
17942
18144
|
const changedAbs = safeNormalize(changedFilePath);
|
|
17943
18145
|
const out = [];
|
|
@@ -17978,7 +18180,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
17978
18180
|
return null;
|
|
17979
18181
|
}
|
|
17980
18182
|
const sf = ts3.createSourceFile(childFilePath, source, ts3.ScriptTarget.ES2022, true, ts3.ScriptKind.TS);
|
|
17981
|
-
const childDir =
|
|
18183
|
+
const childDir = dirname19(childFilePath);
|
|
17982
18184
|
for (const stmt of sf.statements) {
|
|
17983
18185
|
if (!ts3.isImportDeclaration(stmt))
|
|
17984
18186
|
continue;
|
|
@@ -18006,7 +18208,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
18006
18208
|
if (!spec.startsWith(".") && !spec.startsWith("/")) {
|
|
18007
18209
|
return null;
|
|
18008
18210
|
}
|
|
18009
|
-
const base =
|
|
18211
|
+
const base = resolve34(childDir, spec);
|
|
18010
18212
|
const candidates = [
|
|
18011
18213
|
`${base}.ts`,
|
|
18012
18214
|
`${base}.tsx`,
|
|
@@ -18035,7 +18237,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
18035
18237
|
const parentFile = new Map;
|
|
18036
18238
|
for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
|
|
18037
18239
|
const classes = parseDecoratedClasses(tsPath);
|
|
18038
|
-
const componentDir =
|
|
18240
|
+
const componentDir = dirname19(tsPath);
|
|
18039
18241
|
for (const cls of classes) {
|
|
18040
18242
|
const entity = {
|
|
18041
18243
|
className: cls.className,
|
|
@@ -18044,7 +18246,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
18044
18246
|
};
|
|
18045
18247
|
if (cls.kind === "component") {
|
|
18046
18248
|
for (const url of [...cls.templateUrls, ...cls.styleUrls]) {
|
|
18047
|
-
const abs = safeNormalize(
|
|
18249
|
+
const abs = safeNormalize(resolve34(componentDir, url));
|
|
18048
18250
|
const existing = resource.get(abs);
|
|
18049
18251
|
if (existing)
|
|
18050
18252
|
existing.push(entity);
|
|
@@ -18124,8 +18326,6 @@ class Context {
|
|
|
18124
18326
|
}
|
|
18125
18327
|
|
|
18126
18328
|
// src/dev/angular/vendor/translator/translator.ts
|
|
18127
|
-
import * as o from "@angular/compiler";
|
|
18128
|
-
|
|
18129
18329
|
class ExpressionTranslatorVisitor {
|
|
18130
18330
|
factory;
|
|
18131
18331
|
imports;
|
|
@@ -18181,7 +18381,9 @@ class ExpressionTranslatorVisitor {
|
|
|
18181
18381
|
return this.setSourceMapRange(this.factory.createRegularExpressionLiteral(ast.body, ast.flags), ast.sourceSpan);
|
|
18182
18382
|
}
|
|
18183
18383
|
visitLocalizedString(ast, context) {
|
|
18184
|
-
const elements = [
|
|
18384
|
+
const elements = [
|
|
18385
|
+
createTemplateElement(ast.serializeI18nHead())
|
|
18386
|
+
];
|
|
18185
18387
|
const expressions = [];
|
|
18186
18388
|
for (let i = 0;i < ast.expressions.length; i++) {
|
|
18187
18389
|
const placeholder = this.setSourceMapRange(ast.expressions[i].visitExpression(this, context), ast.getPlaceholderSourceSpan(i));
|
|
@@ -18189,7 +18391,10 @@ class ExpressionTranslatorVisitor {
|
|
|
18189
18391
|
elements.push(createTemplateElement(ast.serializeI18nTemplatePart(i + 1)));
|
|
18190
18392
|
}
|
|
18191
18393
|
const localizeTag = this.factory.createIdentifier("$localize");
|
|
18192
|
-
return this.setSourceMapRange(this.createTaggedTemplateExpression(localizeTag, {
|
|
18394
|
+
return this.setSourceMapRange(this.createTaggedTemplateExpression(localizeTag, {
|
|
18395
|
+
elements,
|
|
18396
|
+
expressions
|
|
18397
|
+
}), ast.sourceSpan);
|
|
18193
18398
|
}
|
|
18194
18399
|
visitBuiltinType(ast) {
|
|
18195
18400
|
let builtInType;
|
|
@@ -18246,7 +18451,10 @@ class ExpressionTranslatorVisitor {
|
|
|
18246
18451
|
cooked.push(this.factory.setSourceMapRange(this.factory.createLiteral(element.cooked), element.range));
|
|
18247
18452
|
raw.push(this.factory.setSourceMapRange(this.factory.createLiteral(element.raw), element.range));
|
|
18248
18453
|
}
|
|
18249
|
-
const templateHelperCall = this.factory.createCallExpression(__makeTemplateObjectHelper, [
|
|
18454
|
+
const templateHelperCall = this.factory.createCallExpression(__makeTemplateObjectHelper, [
|
|
18455
|
+
this.factory.createArrayLiteral(cooked),
|
|
18456
|
+
this.factory.createArrayLiteral(raw)
|
|
18457
|
+
], false);
|
|
18250
18458
|
return this.factory.createCallExpression(tagHandler, [templateHelperCall, ...expressions], false);
|
|
18251
18459
|
}
|
|
18252
18460
|
visitExternalExpr(ast, _context) {
|
|
@@ -18276,7 +18484,9 @@ class ExpressionTranslatorVisitor {
|
|
|
18276
18484
|
visitDynamicImportExpr(ast, context) {
|
|
18277
18485
|
const urlExpression = typeof ast.url === "string" ? this.factory.createLiteral(ast.url) : ast.url.visitExpression(this, context);
|
|
18278
18486
|
if (ast.urlComment) {
|
|
18279
|
-
this.factory.attachComments(urlExpression, [
|
|
18487
|
+
this.factory.attachComments(urlExpression, [
|
|
18488
|
+
o.leadingComment(ast.urlComment, true)
|
|
18489
|
+
]);
|
|
18280
18490
|
}
|
|
18281
18491
|
return this.factory.createDynamicImport(urlExpression);
|
|
18282
18492
|
}
|
|
@@ -18416,8 +18626,16 @@ function createRange(span) {
|
|
|
18416
18626
|
end: { offset: end.offset, line: end.line, column: end.col }
|
|
18417
18627
|
};
|
|
18418
18628
|
}
|
|
18419
|
-
var UNARY_OPERATORS, BINARY_OPERATORS;
|
|
18629
|
+
var o, UNARY_OPERATORS, BINARY_OPERATORS;
|
|
18420
18630
|
var init_translator = __esm(() => {
|
|
18631
|
+
o = (() => {
|
|
18632
|
+
try {
|
|
18633
|
+
return __require("@angular/compiler");
|
|
18634
|
+
} catch {
|
|
18635
|
+
const stub = new Proxy(function() {}, { apply: () => stub, construct: () => stub, get: () => stub });
|
|
18636
|
+
return stub;
|
|
18637
|
+
}
|
|
18638
|
+
})();
|
|
18421
18639
|
UNARY_OPERATORS = /* @__PURE__ */ new Map([
|
|
18422
18640
|
[o.UnaryOperator.Minus, "-"],
|
|
18423
18641
|
[o.UnaryOperator.Plus, "+"]
|
|
@@ -18552,7 +18770,9 @@ class TypeScriptAstFactory {
|
|
|
18552
18770
|
createElementAccess = ts6.factory.createElementAccessExpression;
|
|
18553
18771
|
createExpressionStatement = ts6.factory.createExpressionStatement;
|
|
18554
18772
|
createDynamicImport(url) {
|
|
18555
|
-
return ts6.factory.createCallExpression(ts6.factory.createToken(ts6.SyntaxKind.ImportKeyword), undefined, [
|
|
18773
|
+
return ts6.factory.createCallExpression(ts6.factory.createToken(ts6.SyntaxKind.ImportKeyword), undefined, [
|
|
18774
|
+
typeof url === "string" ? ts6.factory.createStringLiteral(url) : url
|
|
18775
|
+
]);
|
|
18556
18776
|
}
|
|
18557
18777
|
createFunctionDeclaration(functionName, parameters, body) {
|
|
18558
18778
|
if (!ts6.isBlock(body)) {
|
|
@@ -18755,9 +18975,18 @@ var init_typescript_ast_factory = __esm(() => {
|
|
|
18755
18975
|
function translateStatement(contextFile, statement, imports, options = {}) {
|
|
18756
18976
|
return statement.visitStatement(new ExpressionTranslatorVisitor(new TypeScriptAstFactory(options.annotateForClosureCompiler === true), imports, contextFile, options), new Context(true));
|
|
18757
18977
|
}
|
|
18978
|
+
var o2;
|
|
18758
18979
|
var init_typescript_translator = __esm(() => {
|
|
18759
18980
|
init_translator();
|
|
18760
18981
|
init_typescript_ast_factory();
|
|
18982
|
+
o2 = (() => {
|
|
18983
|
+
try {
|
|
18984
|
+
return __require("@angular/compiler");
|
|
18985
|
+
} catch {
|
|
18986
|
+
const stub = new Proxy(function() {}, { apply: () => stub, construct: () => stub, get: () => stub });
|
|
18987
|
+
return stub;
|
|
18988
|
+
}
|
|
18989
|
+
})();
|
|
18761
18990
|
});
|
|
18762
18991
|
|
|
18763
18992
|
// src/dev/angular/fastHmrCompiler.ts
|
|
@@ -18769,7 +18998,7 @@ __export(exports_fastHmrCompiler, {
|
|
|
18769
18998
|
invalidateFingerprintCache: () => invalidateFingerprintCache
|
|
18770
18999
|
});
|
|
18771
19000
|
import { existsSync as existsSync26, readFileSync as readFileSync20, statSync as statSync4 } from "fs";
|
|
18772
|
-
import { dirname as
|
|
19001
|
+
import { dirname as dirname20, extname as extname10, relative as relative14, resolve as resolve35 } from "path";
|
|
18773
19002
|
import ts7 from "typescript";
|
|
18774
19003
|
var fail = (reason, detail, location) => ({
|
|
18775
19004
|
ok: false,
|
|
@@ -18991,7 +19220,7 @@ var fail = (reason, detail, location) => ({
|
|
|
18991
19220
|
if (!spec.startsWith(".") && !spec.startsWith("/")) {
|
|
18992
19221
|
return true;
|
|
18993
19222
|
}
|
|
18994
|
-
const base =
|
|
19223
|
+
const base = resolve35(componentDir, spec);
|
|
18995
19224
|
const candidates = [
|
|
18996
19225
|
`${base}.ts`,
|
|
18997
19226
|
`${base}.tsx`,
|
|
@@ -19566,7 +19795,10 @@ var fail = (reason, detail, location) => ({
|
|
|
19566
19795
|
try {
|
|
19567
19796
|
source = readFileSync20(filePath, "utf-8");
|
|
19568
19797
|
} catch {
|
|
19569
|
-
childComponentInfoCache.set(cacheKey2, {
|
|
19798
|
+
childComponentInfoCache.set(cacheKey2, {
|
|
19799
|
+
info: null,
|
|
19800
|
+
mtimeMs: stat3.mtimeMs
|
|
19801
|
+
});
|
|
19570
19802
|
return null;
|
|
19571
19803
|
}
|
|
19572
19804
|
const sf = ts7.createSourceFile(filePath, source, ts7.ScriptTarget.Latest, true);
|
|
@@ -19754,7 +19986,7 @@ var fail = (reason, detail, location) => ({
|
|
|
19754
19986
|
});
|
|
19755
19987
|
if (!names.includes(className))
|
|
19756
19988
|
continue;
|
|
19757
|
-
const nextDts = resolveDtsFromSpec(fromPath,
|
|
19989
|
+
const nextDts = resolveDtsFromSpec(fromPath, dirname20(startDtsPath));
|
|
19758
19990
|
if (!nextDts)
|
|
19759
19991
|
continue;
|
|
19760
19992
|
const found = findDtsContainingClass(nextDts, className, visited);
|
|
@@ -19764,7 +19996,7 @@ var fail = (reason, detail, location) => ({
|
|
|
19764
19996
|
const starReExportRe = /export\s*\*\s*from\s*["']([^"']+)["']/g;
|
|
19765
19997
|
while ((m = starReExportRe.exec(content)) !== null) {
|
|
19766
19998
|
const fromPath = m[1] || "";
|
|
19767
|
-
const nextDts = resolveDtsFromSpec(fromPath,
|
|
19999
|
+
const nextDts = resolveDtsFromSpec(fromPath, dirname20(startDtsPath));
|
|
19768
20000
|
if (!nextDts)
|
|
19769
20001
|
continue;
|
|
19770
20002
|
const found = findDtsContainingClass(nextDts, className, visited);
|
|
@@ -19774,7 +20006,7 @@ var fail = (reason, detail, location) => ({
|
|
|
19774
20006
|
return null;
|
|
19775
20007
|
}, resolveDtsFromSpec = (spec, fromDir) => {
|
|
19776
20008
|
const stripped = spec.replace(/\.[mc]?js$/, "");
|
|
19777
|
-
const base =
|
|
20009
|
+
const base = resolve35(fromDir, stripped);
|
|
19778
20010
|
const candidates = [
|
|
19779
20011
|
`${base}.d.ts`,
|
|
19780
20012
|
`${base}.d.mts`,
|
|
@@ -19798,7 +20030,7 @@ var fail = (reason, detail, location) => ({
|
|
|
19798
20030
|
return null;
|
|
19799
20031
|
}, resolveChildComponentInfo = (className, spec, componentDir, projectRoot) => {
|
|
19800
20032
|
if (spec.startsWith(".") || spec.startsWith("/")) {
|
|
19801
|
-
const base =
|
|
20033
|
+
const base = resolve35(componentDir, spec);
|
|
19802
20034
|
const candidates = [
|
|
19803
20035
|
`${base}.ts`,
|
|
19804
20036
|
`${base}.tsx`,
|
|
@@ -19968,13 +20200,13 @@ var fail = (reason, detail, location) => ({
|
|
|
19968
20200
|
}
|
|
19969
20201
|
if (!matches)
|
|
19970
20202
|
continue;
|
|
19971
|
-
const resolved =
|
|
20203
|
+
const resolved = resolve35(componentDir, spec);
|
|
19972
20204
|
for (const ext of TS_EXTENSIONS) {
|
|
19973
20205
|
const candidate = resolved + ext;
|
|
19974
20206
|
if (existsSync26(candidate))
|
|
19975
20207
|
return candidate;
|
|
19976
20208
|
}
|
|
19977
|
-
const indexCandidate =
|
|
20209
|
+
const indexCandidate = resolve35(resolved, "index.ts");
|
|
19978
20210
|
if (existsSync26(indexCandidate))
|
|
19979
20211
|
return indexCandidate;
|
|
19980
20212
|
}
|
|
@@ -20161,7 +20393,7 @@ ${transpiled}
|
|
|
20161
20393
|
}
|
|
20162
20394
|
}${staticPatch}`;
|
|
20163
20395
|
}, STYLE_PREPROCESSED_EXT, resolveAndReadStyleResource = (componentDir, url) => {
|
|
20164
|
-
const abs =
|
|
20396
|
+
const abs = resolve35(componentDir, url);
|
|
20165
20397
|
if (!existsSync26(abs))
|
|
20166
20398
|
return null;
|
|
20167
20399
|
const ext = extname10(abs).toLowerCase();
|
|
@@ -20201,7 +20433,7 @@ ${block}
|
|
|
20201
20433
|
const cached = projectOptionsCache.get(projectRoot);
|
|
20202
20434
|
if (cached !== undefined)
|
|
20203
20435
|
return cached;
|
|
20204
|
-
const tsconfigPath =
|
|
20436
|
+
const tsconfigPath = resolve35(projectRoot, "tsconfig.json");
|
|
20205
20437
|
const opts = {};
|
|
20206
20438
|
if (existsSync26(tsconfigPath)) {
|
|
20207
20439
|
try {
|
|
@@ -20247,7 +20479,7 @@ ${block}
|
|
|
20247
20479
|
}
|
|
20248
20480
|
const kind = params.kind ?? "component";
|
|
20249
20481
|
if (kind !== "component") {
|
|
20250
|
-
const entityId = encodeURIComponent(`${
|
|
20482
|
+
const entityId = encodeURIComponent(`${relative14(projectRoot, componentFilePath).replace(/\\/g, "/")}@${className}`);
|
|
20251
20483
|
const currentEntityFingerprint = extractEntityFingerprint(classNode, className, sourceFile);
|
|
20252
20484
|
const cachedEntityFingerprint = entityFingerprintCache.get(entityId);
|
|
20253
20485
|
if (cachedEntityFingerprint !== undefined && !entityFingerprintsEqual(cachedEntityFingerprint, currentEntityFingerprint)) {
|
|
@@ -20265,7 +20497,7 @@ ${block}
|
|
|
20265
20497
|
ok: true
|
|
20266
20498
|
};
|
|
20267
20499
|
}
|
|
20268
|
-
if (inheritsDecoratedClass(classNode, sourceFile,
|
|
20500
|
+
if (inheritsDecoratedClass(classNode, sourceFile, dirname20(componentFilePath), projectRoot)) {
|
|
20269
20501
|
return fail("inherits-decorated-class");
|
|
20270
20502
|
}
|
|
20271
20503
|
const decorator = findComponentDecorator(classNode);
|
|
@@ -20277,14 +20509,14 @@ ${block}
|
|
|
20277
20509
|
const projectDefaults = readProjectAngularCompilerOptions(projectRoot);
|
|
20278
20510
|
const decoratorMeta = readDecoratorMeta(decoratorArgs, projectDefaults);
|
|
20279
20511
|
const advancedMetadata = extractAdvancedMetadata(classNode, decoratorArgs, compiler);
|
|
20280
|
-
const componentDir =
|
|
20512
|
+
const componentDir = dirname20(componentFilePath);
|
|
20281
20513
|
let templateText;
|
|
20282
20514
|
let templatePath;
|
|
20283
20515
|
if (decoratorMeta.template !== null) {
|
|
20284
20516
|
templateText = decoratorMeta.template;
|
|
20285
20517
|
templatePath = componentFilePath;
|
|
20286
20518
|
} else if (decoratorMeta.templateUrl) {
|
|
20287
|
-
const tplAbs =
|
|
20519
|
+
const tplAbs = resolve35(componentDir, decoratorMeta.templateUrl);
|
|
20288
20520
|
if (!existsSync26(tplAbs)) {
|
|
20289
20521
|
return fail("template-resource-not-found", `Template file not found: ${tplAbs}`, { file: componentFilePath });
|
|
20290
20522
|
}
|
|
@@ -20329,13 +20561,8 @@ ${block}
|
|
|
20329
20561
|
if (!className_)
|
|
20330
20562
|
return fail("class-not-found", "anonymous class");
|
|
20331
20563
|
const wrappedClass = new compiler.WrappedNodeExpr(className_);
|
|
20332
|
-
const {
|
|
20333
|
-
|
|
20334
|
-
outputs,
|
|
20335
|
-
hasDecoratorIO,
|
|
20336
|
-
hasSignalIO
|
|
20337
|
-
} = extractInputsAndOutputs(classNode, compiler);
|
|
20338
|
-
const projectRelPath = relative13(projectRoot, componentFilePath).replace(/\\/g, "/");
|
|
20564
|
+
const { inputs, outputs, hasDecoratorIO, hasSignalIO } = extractInputsAndOutputs(classNode, compiler);
|
|
20565
|
+
const projectRelPath = relative14(projectRoot, componentFilePath).replace(/\\/g, "/");
|
|
20339
20566
|
const fingerprintId = encodeURIComponent(`${projectRelPath}@${className}`);
|
|
20340
20567
|
const currentFingerprint = extractFingerprint(classNode, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
|
|
20341
20568
|
const cachedFingerprint = fingerprintCache.get(fingerprintId);
|
|
@@ -20538,11 +20765,7 @@ var init_fastHmrCompiler = __esm(() => {
|
|
|
20538
20765
|
fingerprintCache = new Map;
|
|
20539
20766
|
pendingModuleCache = new Map;
|
|
20540
20767
|
entityFingerprintCache = new Map;
|
|
20541
|
-
ENTITY_DECORATOR_NAMES = new Set([
|
|
20542
|
-
"Pipe",
|
|
20543
|
-
"Directive",
|
|
20544
|
-
"Injectable"
|
|
20545
|
-
]);
|
|
20768
|
+
ENTITY_DECORATOR_NAMES = new Set(["Pipe", "Directive", "Injectable"]);
|
|
20546
20769
|
VIEW_ENCAPSULATION_VALUES = {
|
|
20547
20770
|
Emulated: 0,
|
|
20548
20771
|
ExperimentalIsolatedShadowDom: 4,
|
|
@@ -20589,7 +20812,7 @@ __export(exports_hmrCompiler, {
|
|
|
20589
20812
|
getApplyMetadataModule: () => getApplyMetadataModule,
|
|
20590
20813
|
encodeHmrComponentId: () => encodeHmrComponentId
|
|
20591
20814
|
});
|
|
20592
|
-
import { dirname as
|
|
20815
|
+
import { dirname as dirname21, relative as relative15, resolve as resolve36 } from "path";
|
|
20593
20816
|
import { performance as performance2 } from "perf_hooks";
|
|
20594
20817
|
var getApplyMetadataModule = async (encodedId) => {
|
|
20595
20818
|
const decoded = decodeURIComponent(encodedId);
|
|
@@ -20598,8 +20821,8 @@ var getApplyMetadataModule = async (encodedId) => {
|
|
|
20598
20821
|
return null;
|
|
20599
20822
|
const filePathRel = decoded.slice(0, at2);
|
|
20600
20823
|
const className = decoded.slice(at2 + 1);
|
|
20601
|
-
const componentFilePath =
|
|
20602
|
-
const projectRelPath =
|
|
20824
|
+
const componentFilePath = resolve36(process.cwd(), filePathRel);
|
|
20825
|
+
const projectRelPath = relative15(process.cwd(), componentFilePath).replace(/\\/g, "/");
|
|
20603
20826
|
const cacheKey2 = encodeURIComponent(`${projectRelPath}@${className}`);
|
|
20604
20827
|
const { takePendingModule: takePendingModule2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
|
|
20605
20828
|
const cached = takePendingModule2(cacheKey2);
|
|
@@ -20609,9 +20832,9 @@ var getApplyMetadataModule = async (encodedId) => {
|
|
|
20609
20832
|
const { resolveOwningComponents: resolveOwningComponents2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
|
|
20610
20833
|
const owners = resolveOwningComponents2({
|
|
20611
20834
|
changedFilePath: componentFilePath,
|
|
20612
|
-
userAngularRoot:
|
|
20835
|
+
userAngularRoot: dirname21(componentFilePath)
|
|
20613
20836
|
});
|
|
20614
|
-
const owner = owners.find((
|
|
20837
|
+
const owner = owners.find((o3) => o3.className === className);
|
|
20615
20838
|
const kind = owner?.kind ?? "component";
|
|
20616
20839
|
const fastStart = performance2.now();
|
|
20617
20840
|
const fast = await tryFastHmr({ className, componentFilePath, kind });
|
|
@@ -20621,7 +20844,7 @@ var getApplyMetadataModule = async (encodedId) => {
|
|
|
20621
20844
|
}
|
|
20622
20845
|
return null;
|
|
20623
20846
|
}, encodeHmrComponentId = (absoluteFilePath, className) => {
|
|
20624
|
-
const projectRel =
|
|
20847
|
+
const projectRel = relative15(process.cwd(), absoluteFilePath).replace(/\\/g, "/");
|
|
20625
20848
|
return `${projectRel}@${className}`;
|
|
20626
20849
|
};
|
|
20627
20850
|
var init_hmrCompiler = __esm(() => {
|
|
@@ -20760,11 +20983,11 @@ var exports_simpleHTMLHMR = {};
|
|
|
20760
20983
|
__export(exports_simpleHTMLHMR, {
|
|
20761
20984
|
handleHTMLUpdate: () => handleHTMLUpdate
|
|
20762
20985
|
});
|
|
20763
|
-
import { resolve as
|
|
20986
|
+
import { resolve as resolve37 } from "path";
|
|
20764
20987
|
var handleHTMLUpdate = async (htmlFilePath) => {
|
|
20765
20988
|
let htmlContent;
|
|
20766
20989
|
try {
|
|
20767
|
-
const resolvedPath =
|
|
20990
|
+
const resolvedPath = resolve37(htmlFilePath);
|
|
20768
20991
|
const file5 = Bun.file(resolvedPath);
|
|
20769
20992
|
if (!await file5.exists()) {
|
|
20770
20993
|
return null;
|
|
@@ -20790,11 +21013,11 @@ var exports_simpleHTMXHMR = {};
|
|
|
20790
21013
|
__export(exports_simpleHTMXHMR, {
|
|
20791
21014
|
handleHTMXUpdate: () => handleHTMXUpdate
|
|
20792
21015
|
});
|
|
20793
|
-
import { resolve as
|
|
21016
|
+
import { resolve as resolve38 } from "path";
|
|
20794
21017
|
var handleHTMXUpdate = async (htmxFilePath) => {
|
|
20795
21018
|
let htmlContent;
|
|
20796
21019
|
try {
|
|
20797
|
-
const resolvedPath =
|
|
21020
|
+
const resolvedPath = resolve38(htmxFilePath);
|
|
20798
21021
|
const file5 = Bun.file(resolvedPath);
|
|
20799
21022
|
if (!await file5.exists()) {
|
|
20800
21023
|
return null;
|
|
@@ -20817,7 +21040,7 @@ var init_simpleHTMXHMR = () => {};
|
|
|
20817
21040
|
|
|
20818
21041
|
// src/dev/rebuildTrigger.ts
|
|
20819
21042
|
import { existsSync as existsSync27 } from "fs";
|
|
20820
|
-
import { basename as basename12, dirname as
|
|
21043
|
+
import { basename as basename12, dirname as dirname22, relative as relative16, resolve as resolve39, sep as sep4 } from "path";
|
|
20821
21044
|
var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequentially = (items, action) => items.reduce((chain, item) => chain.then(() => action(item)), Promise.resolve()), getStyleTransformConfig = (config) => createStyleTransformConfig(config.stylePreprocessors, config.postcss), recompileTailwindForFastPath = async (state, config, files) => {
|
|
20822
21045
|
if (!config.tailwind)
|
|
20823
21046
|
return;
|
|
@@ -20909,7 +21132,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20909
21132
|
state.fileHashes.delete(filePathInSet);
|
|
20910
21133
|
try {
|
|
20911
21134
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, filePathInSet);
|
|
20912
|
-
const deletedPathResolved =
|
|
21135
|
+
const deletedPathResolved = resolve39(filePathInSet);
|
|
20913
21136
|
affectedFiles.forEach((affectedFile) => {
|
|
20914
21137
|
if (isValidDeletedAffectedFile(affectedFile, deletedPathResolved, processedFiles)) {
|
|
20915
21138
|
validFiles.push(affectedFile);
|
|
@@ -20953,7 +21176,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20953
21176
|
if (storedHash !== undefined && storedHash === fileHash) {
|
|
20954
21177
|
return;
|
|
20955
21178
|
}
|
|
20956
|
-
const normalizedFilePath =
|
|
21179
|
+
const normalizedFilePath = resolve39(filePathInSet);
|
|
20957
21180
|
if (!processedFiles.has(normalizedFilePath)) {
|
|
20958
21181
|
validFiles.push(normalizedFilePath);
|
|
20959
21182
|
processedFiles.add(normalizedFilePath);
|
|
@@ -21057,8 +21280,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21057
21280
|
return;
|
|
21058
21281
|
}
|
|
21059
21282
|
if (framework === "unknown") {
|
|
21060
|
-
invalidate(
|
|
21061
|
-
const relPath =
|
|
21283
|
+
invalidate(resolve39(filePath));
|
|
21284
|
+
const relPath = relative16(process.cwd(), filePath);
|
|
21062
21285
|
logHmrUpdate(relPath);
|
|
21063
21286
|
return;
|
|
21064
21287
|
}
|
|
@@ -21084,7 +21307,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21084
21307
|
const userEditedFiles = new Set;
|
|
21085
21308
|
state.fileChangeQueue.forEach((filePaths) => {
|
|
21086
21309
|
for (const filePath2 of filePaths) {
|
|
21087
|
-
userEditedFiles.add(
|
|
21310
|
+
userEditedFiles.add(resolve39(filePath2));
|
|
21088
21311
|
}
|
|
21089
21312
|
});
|
|
21090
21313
|
state.lastUserEditedFiles = userEditedFiles;
|
|
@@ -21113,7 +21336,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21113
21336
|
}
|
|
21114
21337
|
if (!graph)
|
|
21115
21338
|
return componentFile;
|
|
21116
|
-
const dependents = graph.dependents.get(
|
|
21339
|
+
const dependents = graph.dependents.get(resolve39(componentFile));
|
|
21117
21340
|
if (!dependents)
|
|
21118
21341
|
return componentFile;
|
|
21119
21342
|
for (const dep of dependents) {
|
|
@@ -21122,7 +21345,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21122
21345
|
}
|
|
21123
21346
|
return componentFile;
|
|
21124
21347
|
}, resolveAngularPageEntries = (state, angularFiles, angularPagesPath) => {
|
|
21125
|
-
const pageEntries = angularFiles.filter((file5) => file5.endsWith(".ts") &&
|
|
21348
|
+
const pageEntries = angularFiles.filter((file5) => file5.endsWith(".ts") && resolve39(file5).startsWith(angularPagesPath));
|
|
21126
21349
|
if (pageEntries.length > 0 || !state.dependencyGraph) {
|
|
21127
21350
|
return pageEntries;
|
|
21128
21351
|
}
|
|
@@ -21131,7 +21354,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21131
21354
|
const lookupFile = resolveComponentLookupFile(componentFile, state.dependencyGraph);
|
|
21132
21355
|
const affected = getAffectedFiles(state.dependencyGraph, lookupFile);
|
|
21133
21356
|
affected.forEach((file5) => {
|
|
21134
|
-
if (file5.endsWith(".ts") &&
|
|
21357
|
+
if (file5.endsWith(".ts") && resolve39(file5).startsWith(angularPagesPath)) {
|
|
21135
21358
|
resolvedPages.add(file5);
|
|
21136
21359
|
}
|
|
21137
21360
|
});
|
|
@@ -21403,16 +21626,16 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21403
21626
|
};
|
|
21404
21627
|
const fire = () => {
|
|
21405
21628
|
ctx.debounceTimer = null;
|
|
21406
|
-
const
|
|
21629
|
+
const resolve40 = ctx.debouncedResolve;
|
|
21407
21630
|
ctx.debouncedResolve = null;
|
|
21408
21631
|
ctx.debouncedPromise = null;
|
|
21409
21632
|
if (ctx.inFlight) {
|
|
21410
21633
|
ctx.pending = true;
|
|
21411
|
-
ctx.inFlight.finally(() =>
|
|
21634
|
+
ctx.inFlight.finally(() => resolve40?.());
|
|
21412
21635
|
return;
|
|
21413
21636
|
}
|
|
21414
21637
|
ctx.inFlight = drive();
|
|
21415
|
-
ctx.inFlight.finally(() =>
|
|
21638
|
+
ctx.inFlight.finally(() => resolve40?.());
|
|
21416
21639
|
};
|
|
21417
21640
|
return ({ immediate = false } = {}) => {
|
|
21418
21641
|
if (!ctx.debouncedPromise) {
|
|
@@ -21439,9 +21662,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21439
21662
|
const diskRefreshPromise = (async () => {
|
|
21440
21663
|
if (!angularDir || editedFiles.size === 0)
|
|
21441
21664
|
return;
|
|
21442
|
-
const angularDirAbs =
|
|
21665
|
+
const angularDirAbs = resolve39(angularDir);
|
|
21443
21666
|
const filesUnderAngular = Array.from(editedFiles).filter((file5) => {
|
|
21444
|
-
const abs =
|
|
21667
|
+
const abs = resolve39(file5);
|
|
21445
21668
|
return abs === angularDirAbs || abs.startsWith(angularDirAbs + sep4);
|
|
21446
21669
|
});
|
|
21447
21670
|
if (filesUnderAngular.length === 0)
|
|
@@ -21463,7 +21686,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21463
21686
|
if (!ext)
|
|
21464
21687
|
continue;
|
|
21465
21688
|
if (ext === ".ts" || ext === ".tsx") {
|
|
21466
|
-
tsFilesToRefresh.add(
|
|
21689
|
+
tsFilesToRefresh.add(resolve39(file5));
|
|
21467
21690
|
continue;
|
|
21468
21691
|
}
|
|
21469
21692
|
const owners = resolveOwningComponents2({
|
|
@@ -21471,7 +21694,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21471
21694
|
userAngularRoot: angularDirAbs
|
|
21472
21695
|
});
|
|
21473
21696
|
for (const owner of owners) {
|
|
21474
|
-
tsFilesToRefresh.add(
|
|
21697
|
+
tsFilesToRefresh.add(resolve39(owner.componentFilePath));
|
|
21475
21698
|
}
|
|
21476
21699
|
}
|
|
21477
21700
|
if (tsFilesToRefresh.size === 0)
|
|
@@ -21482,8 +21705,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21482
21705
|
try {
|
|
21483
21706
|
const { invalidateModule: invalidateModule2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
21484
21707
|
for (const tsFile of tsFilesToRefresh) {
|
|
21485
|
-
const rel =
|
|
21486
|
-
const compiledFile =
|
|
21708
|
+
const rel = relative16(angularDirAbs, tsFile).replace(/\\/g, "/").replace(/\.[tj]sx?$/, ".js");
|
|
21709
|
+
const compiledFile = resolve39(compiledRoot, rel);
|
|
21487
21710
|
invalidateModule2(compiledFile);
|
|
21488
21711
|
}
|
|
21489
21712
|
} catch {}
|
|
@@ -21512,7 +21735,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21512
21735
|
serverPaths.forEach((serverPath, idx) => {
|
|
21513
21736
|
const fileBase = basename12(serverPath, ".js");
|
|
21514
21737
|
const ssrPath = ssrPaths[idx] ?? serverPath;
|
|
21515
|
-
state.manifest[toPascal(fileBase)] =
|
|
21738
|
+
state.manifest[toPascal(fileBase)] = resolve39(ssrPath);
|
|
21516
21739
|
});
|
|
21517
21740
|
if (clientPaths.length > 0) {
|
|
21518
21741
|
await bundleAngularClient(state, clientPaths, state.resolvedPaths.buildDir, angularDir);
|
|
@@ -21521,9 +21744,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21521
21744
|
const angularDir = config.angularDirectory ?? "";
|
|
21522
21745
|
const angularFiles = filesToRebuild.filter((file5) => detectFramework(file5, state.resolvedPaths) === "angular");
|
|
21523
21746
|
for (const file5 of angularFiles) {
|
|
21524
|
-
state.fileHashes.set(
|
|
21747
|
+
state.fileHashes.set(resolve39(file5), computeFileHash(file5));
|
|
21525
21748
|
}
|
|
21526
|
-
const angularPagesPath =
|
|
21749
|
+
const angularPagesPath = resolve39(angularDir, "pages");
|
|
21527
21750
|
const pageEntries = resolveAngularPageEntries(state, angularFiles, angularPagesPath);
|
|
21528
21751
|
const tierStart = performance.now();
|
|
21529
21752
|
const verdict = await decideAngularTier(state, angularDir);
|
|
@@ -21553,7 +21776,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21553
21776
|
}, getModuleUrl = async (pageFile) => {
|
|
21554
21777
|
const { invalidateModule: invalidateModule2, warmCache: warmCache2, SRC_URL_PREFIX: SRC_URL_PREFIX2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
21555
21778
|
invalidateModule2(pageFile);
|
|
21556
|
-
const rel =
|
|
21779
|
+
const rel = relative16(process.cwd(), pageFile).replace(/\\/g, "/");
|
|
21557
21780
|
const url = `${SRC_URL_PREFIX2}${rel}`;
|
|
21558
21781
|
warmCache2(url);
|
|
21559
21782
|
return url;
|
|
@@ -21562,11 +21785,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21562
21785
|
if (isComponentFile2)
|
|
21563
21786
|
return primaryFile;
|
|
21564
21787
|
const { findNearestComponent: findNearestComponent2 } = await Promise.resolve().then(() => (init_transformCache(), exports_transformCache));
|
|
21565
|
-
const nearest = findNearestComponent2(
|
|
21788
|
+
const nearest = findNearestComponent2(resolve39(primaryFile));
|
|
21566
21789
|
return nearest ?? primaryFile;
|
|
21567
21790
|
}, handleReactModuleServerPath = async (state, reactFiles, startTime, onRebuildComplete) => {
|
|
21568
21791
|
for (const file5 of reactFiles) {
|
|
21569
|
-
state.fileHashes.set(
|
|
21792
|
+
state.fileHashes.set(resolve39(file5), computeFileHash(file5));
|
|
21570
21793
|
}
|
|
21571
21794
|
markSsrCacheDirty("react");
|
|
21572
21795
|
const primaryFile = reactFiles.find((file5) => !file5.replace(/\\/g, "/").includes("/pages/")) ?? reactFiles[0];
|
|
@@ -21585,7 +21808,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21585
21808
|
const pageModuleUrl = await getReactModuleUrl(broadcastTarget);
|
|
21586
21809
|
if (pageModuleUrl) {
|
|
21587
21810
|
const serverDuration = Date.now() - startTime;
|
|
21588
|
-
state.lastHmrPath =
|
|
21811
|
+
state.lastHmrPath = relative16(process.cwd(), primaryFile).replace(/\\/g, "/");
|
|
21589
21812
|
state.lastHmrFramework = "react";
|
|
21590
21813
|
broadcastToClients(state, {
|
|
21591
21814
|
data: {
|
|
@@ -21648,7 +21871,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21648
21871
|
});
|
|
21649
21872
|
}, handleSvelteModuleServerPath = async (state, svelteFiles, startTime, onRebuildComplete) => {
|
|
21650
21873
|
for (const file5 of svelteFiles) {
|
|
21651
|
-
state.fileHashes.set(
|
|
21874
|
+
state.fileHashes.set(resolve39(file5), computeFileHash(file5));
|
|
21652
21875
|
}
|
|
21653
21876
|
markSsrCacheDirty("svelte");
|
|
21654
21877
|
const serverDuration = Date.now() - startTime;
|
|
@@ -21673,8 +21896,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21673
21896
|
const serverEntries = [...svelteServerPaths];
|
|
21674
21897
|
const clientEntries = [...svelteIndexPaths, ...svelteClientPaths];
|
|
21675
21898
|
const { getFrameworkGeneratedDir: getFrameworkGeneratedDir2 } = await Promise.resolve().then(() => (init_generatedDir(), exports_generatedDir));
|
|
21676
|
-
const serverRoot =
|
|
21677
|
-
const serverOutDir =
|
|
21899
|
+
const serverRoot = resolve39(getFrameworkGeneratedDir2("svelte"), "server");
|
|
21900
|
+
const serverOutDir = resolve39(buildDir, basename12(svelteDir));
|
|
21678
21901
|
const [serverResult, clientResult] = await Promise.all([
|
|
21679
21902
|
serverEntries.length > 0 ? bunBuild9({
|
|
21680
21903
|
entrypoints: serverEntries,
|
|
@@ -21771,7 +21994,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21771
21994
|
});
|
|
21772
21995
|
}, handleVueModuleServerPath = async (state, vueFiles, nonVueFiles, startTime, onRebuildComplete) => {
|
|
21773
21996
|
for (const file5 of [...vueFiles, ...nonVueFiles]) {
|
|
21774
|
-
state.fileHashes.set(
|
|
21997
|
+
state.fileHashes.set(resolve39(file5), computeFileHash(file5));
|
|
21775
21998
|
}
|
|
21776
21999
|
markSsrCacheDirty("vue");
|
|
21777
22000
|
await invalidateNonVueModules(nonVueFiles);
|
|
@@ -21799,7 +22022,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21799
22022
|
recursive: true,
|
|
21800
22023
|
withFileTypes: true
|
|
21801
22024
|
});
|
|
21802
|
-
return entries.filter((entry) => entry.isFile() && EMBER_PAGE_EXTENSIONS.some((ext) => entry.name.endsWith(ext))).map((entry) =>
|
|
22025
|
+
return entries.filter((entry) => entry.isFile() && EMBER_PAGE_EXTENSIONS.some((ext) => entry.name.endsWith(ext))).map((entry) => resolve39(emberPagesPath, entry.name));
|
|
21803
22026
|
} catch {
|
|
21804
22027
|
return [];
|
|
21805
22028
|
}
|
|
@@ -21811,10 +22034,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21811
22034
|
return state.manifest;
|
|
21812
22035
|
}
|
|
21813
22036
|
for (const file5 of emberFiles) {
|
|
21814
|
-
state.fileHashes.set(
|
|
22037
|
+
state.fileHashes.set(resolve39(file5), computeFileHash(file5));
|
|
21815
22038
|
}
|
|
21816
|
-
const emberPagesPath =
|
|
21817
|
-
const directPageEntries = emberFiles.filter((file5) =>
|
|
22039
|
+
const emberPagesPath = resolve39(emberDir, "pages");
|
|
22040
|
+
const directPageEntries = emberFiles.filter((file5) => resolve39(file5).startsWith(emberPagesPath));
|
|
21818
22041
|
const allPageEntries = directPageEntries.length > 0 ? directPageEntries : await collectAllEmberPages(emberPagesPath);
|
|
21819
22042
|
if (allPageEntries.length === 0) {
|
|
21820
22043
|
onRebuildComplete({ hmrState: state, manifest: state.manifest });
|
|
@@ -21824,14 +22047,14 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21824
22047
|
const { serverPaths } = await compileEmber2(allPageEntries, emberDir, process.cwd(), true);
|
|
21825
22048
|
for (const serverPath of serverPaths) {
|
|
21826
22049
|
const fileBase = basename12(serverPath, ".js");
|
|
21827
|
-
state.manifest[toPascal(fileBase)] =
|
|
22050
|
+
state.manifest[toPascal(fileBase)] = resolve39(serverPath);
|
|
21828
22051
|
}
|
|
21829
22052
|
const { invalidateEmberSsrCache: invalidateEmberSsrCache2 } = await Promise.resolve().then(() => (init_ember(), exports_ember));
|
|
21830
22053
|
invalidateEmberSsrCache2();
|
|
21831
22054
|
const duration = Date.now() - startTime;
|
|
21832
22055
|
const [primary] = emberFiles;
|
|
21833
22056
|
if (primary) {
|
|
21834
|
-
state.lastHmrPath =
|
|
22057
|
+
state.lastHmrPath = relative16(process.cwd(), primary).replace(/\\/g, "/");
|
|
21835
22058
|
state.lastHmrFramework = "ember";
|
|
21836
22059
|
logHmrUpdate(primary, "ember", duration);
|
|
21837
22060
|
}
|
|
@@ -21916,8 +22139,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21916
22139
|
if (!buildReference?.source) {
|
|
21917
22140
|
return;
|
|
21918
22141
|
}
|
|
21919
|
-
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname :
|
|
21920
|
-
islandFiles.add(
|
|
22142
|
+
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve39(dirname22(buildInfo.resolvedRegistryPath), buildReference.source);
|
|
22143
|
+
islandFiles.add(resolve39(sourcePath));
|
|
21921
22144
|
}, resolveIslandSourceFiles = async (config) => {
|
|
21922
22145
|
const registryPath = config.islands?.registry;
|
|
21923
22146
|
if (!registryPath) {
|
|
@@ -21925,7 +22148,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21925
22148
|
}
|
|
21926
22149
|
const buildInfo = await loadIslandRegistryBuildInfo(registryPath);
|
|
21927
22150
|
const islandFiles = new Set([
|
|
21928
|
-
|
|
22151
|
+
resolve39(buildInfo.resolvedRegistryPath)
|
|
21929
22152
|
]);
|
|
21930
22153
|
for (const definition of buildInfo.definitions) {
|
|
21931
22154
|
resolveIslandDefinitionSource(definition, buildInfo, islandFiles);
|
|
@@ -21936,7 +22159,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21936
22159
|
if (islandFiles.size === 0) {
|
|
21937
22160
|
return false;
|
|
21938
22161
|
}
|
|
21939
|
-
return filesToRebuild.some((file5) => islandFiles.has(
|
|
22162
|
+
return filesToRebuild.some((file5) => islandFiles.has(resolve39(file5)));
|
|
21940
22163
|
}, handleIslandSourceReload = async (state, config, filesToRebuild, manifest) => {
|
|
21941
22164
|
const shouldReload = await didStaticPagesNeedIslandRefresh(config, filesToRebuild);
|
|
21942
22165
|
if (!shouldReload) {
|
|
@@ -21971,10 +22194,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21971
22194
|
}, computeOutputPagesDir = (state, config, framework) => {
|
|
21972
22195
|
const isSingle = !config.reactDirectory && !config.svelteDirectory && !config.vueDirectory && (framework === "html" ? !config.htmxDirectory : !config.htmlDirectory);
|
|
21973
22196
|
if (isSingle) {
|
|
21974
|
-
return
|
|
22197
|
+
return resolve39(state.resolvedPaths.buildDir, "pages");
|
|
21975
22198
|
}
|
|
21976
22199
|
const dirName = framework === "html" ? basename12(config.htmlDirectory ?? "html") : basename12(config.htmxDirectory ?? "htmx");
|
|
21977
|
-
return
|
|
22200
|
+
return resolve39(state.resolvedPaths.buildDir, dirName, "pages");
|
|
21978
22201
|
}, processHtmlPageUpdate = async (state, pageFile, builtHtmlPagePath, manifest, duration) => {
|
|
21979
22202
|
try {
|
|
21980
22203
|
const { handleHTMLUpdate: handleHTMLUpdate2 } = await Promise.resolve().then(() => (init_simpleHTMLHMR(), exports_simpleHTMLHMR));
|
|
@@ -22013,7 +22236,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22013
22236
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmlPages, "*.html") : htmlPageFiles;
|
|
22014
22237
|
await runSequentially(pageFilesToUpdate, async (pageFile) => {
|
|
22015
22238
|
const htmlPageName = basename12(pageFile);
|
|
22016
|
-
const builtHtmlPagePath =
|
|
22239
|
+
const builtHtmlPagePath = resolve39(outputHtmlPages, htmlPageName);
|
|
22017
22240
|
await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration);
|
|
22018
22241
|
});
|
|
22019
22242
|
}, handleVueCssOnlyUpdate = (state, vueCssFiles, manifest, duration) => {
|
|
@@ -22074,11 +22297,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22074
22297
|
const baseName = fileName.replace(/\.vue$/, "");
|
|
22075
22298
|
const pascalName = toPascal(baseName);
|
|
22076
22299
|
const vueRoot = config.vueDirectory;
|
|
22077
|
-
const hmrId = vueRoot ?
|
|
22300
|
+
const hmrId = vueRoot ? relative16(vueRoot, vuePagePath).replace(/\\/g, "/").replace(/\.vue$/, "") : baseName;
|
|
22078
22301
|
const cssKey = `${pascalName}CSS`;
|
|
22079
22302
|
const cssUrl = manifest[cssKey] || null;
|
|
22080
22303
|
const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
|
|
22081
|
-
const hmrMeta = vueHmrMetadata2.get(
|
|
22304
|
+
const hmrMeta = vueHmrMetadata2.get(resolve39(vuePagePath));
|
|
22082
22305
|
const changeType = hmrMeta?.changeType ?? "full";
|
|
22083
22306
|
if (changeType === "style-only") {
|
|
22084
22307
|
broadcastVueStyleOnly(state, vuePagePath, baseName, cssUrl, hmrId, manifest, duration);
|
|
@@ -22263,7 +22486,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22263
22486
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmxPages, "*.html") : htmxPageFiles;
|
|
22264
22487
|
await runSequentially(pageFilesToUpdate, async (htmxPageFile) => {
|
|
22265
22488
|
const htmxPageName = basename12(htmxPageFile);
|
|
22266
|
-
const builtHtmxPagePath =
|
|
22489
|
+
const builtHtmxPagePath = resolve39(outputHtmxPages, htmxPageName);
|
|
22267
22490
|
await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration);
|
|
22268
22491
|
});
|
|
22269
22492
|
}, collectUpdatedModulePaths = (allModuleUpdates) => {
|
|
@@ -22372,7 +22595,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22372
22595
|
html = html.slice(0, bodyClose.index) + hmrScript + html.slice(bodyClose.index);
|
|
22373
22596
|
writeFs(destPath, html);
|
|
22374
22597
|
}, processMarkupFileFastPath = async (state, sourceFile, outputDir, framework, startTime, updateAssetPaths2, handleUpdate, readFs, writeFs) => {
|
|
22375
|
-
const destPath =
|
|
22598
|
+
const destPath = resolve39(outputDir, basename12(sourceFile));
|
|
22376
22599
|
const hmrScript = extractHmrScript(destPath, readFs);
|
|
22377
22600
|
const source = await Bun.file(sourceFile).text();
|
|
22378
22601
|
await Bun.write(destPath, source);
|
|
@@ -22662,7 +22885,7 @@ __export(exports_buildDepVendor, {
|
|
|
22662
22885
|
buildDepVendor: () => buildDepVendor
|
|
22663
22886
|
});
|
|
22664
22887
|
import { mkdirSync as mkdirSync13 } from "fs";
|
|
22665
|
-
import { join as
|
|
22888
|
+
import { join as join31 } from "path";
|
|
22666
22889
|
import { rm as rm10 } from "fs/promises";
|
|
22667
22890
|
var {build: bunBuild9, Glob: Glob9 } = globalThis.Bun;
|
|
22668
22891
|
var toSafeFileName6 = (specifier) => {
|
|
@@ -22675,12 +22898,12 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22675
22898
|
} catch {
|
|
22676
22899
|
return false;
|
|
22677
22900
|
}
|
|
22678
|
-
}, isBareSpecifier2 = (spec) => !spec.startsWith(".") && !spec.startsWith("/") && !spec.startsWith("@src/"), isAbsolutePackageSpecifier = (spec) => spec === "@absolutejs/absolute" || spec.startsWith("@absolutejs/absolute/"), FRAMEWORK_SPECIFIERS, FRAMEWORK_NAMESPACE_PREFIXES, isFrameworkSpecifier = (spec) => FRAMEWORK_SPECIFIERS.has(spec) || FRAMEWORK_NAMESPACE_PREFIXES.some((prefix) => spec.startsWith(prefix)), FRAMEWORK_EXTERNALS, isSkippedFile = (file5) => file5.includes("node_modules") || file5.includes("/build/") || file5.includes("/dist/") || file5.includes("/indexes/"), isDepSpecifier = (path) => isBareSpecifier2(path) && !isFrameworkSpecifier(path) && !isAbsolutePackageSpecifier(path), isFrameworkRootCandidate = (path) => isBareSpecifier2(path) && isFrameworkSpecifier(path) && !isAbsolutePackageSpecifier(path), readFileSpecifiers = async (file5,
|
|
22901
|
+
}, isBareSpecifier2 = (spec) => !spec.startsWith(".") && !spec.startsWith("/") && !spec.startsWith("@src/"), isAbsolutePackageSpecifier = (spec) => spec === "@absolutejs/absolute" || spec.startsWith("@absolutejs/absolute/"), FRAMEWORK_SPECIFIERS, FRAMEWORK_NAMESPACE_PREFIXES, isFrameworkSpecifier = (spec) => FRAMEWORK_SPECIFIERS.has(spec) || FRAMEWORK_NAMESPACE_PREFIXES.some((prefix) => spec.startsWith(prefix)), FRAMEWORK_EXTERNALS, isSkippedFile = (file5) => file5.includes("node_modules") || file5.includes("/build/") || file5.includes("/dist/") || file5.includes("/indexes/"), isDepSpecifier = (path) => isBareSpecifier2(path) && !isFrameworkSpecifier(path) && !isAbsolutePackageSpecifier(path), isFrameworkRootCandidate = (path) => isBareSpecifier2(path) && isFrameworkSpecifier(path) && !isAbsolutePackageSpecifier(path), readFileSpecifiers = async (file5, transpiler6) => {
|
|
22679
22902
|
const dep = [];
|
|
22680
22903
|
const framework = [];
|
|
22681
22904
|
try {
|
|
22682
22905
|
const content = await Bun.file(file5).text();
|
|
22683
|
-
for (const imp of
|
|
22906
|
+
for (const imp of transpiler6.scanImports(content)) {
|
|
22684
22907
|
if (isDepSpecifier(imp.path))
|
|
22685
22908
|
dep.push(imp.path);
|
|
22686
22909
|
else if (isFrameworkRootCandidate(imp.path))
|
|
@@ -22697,9 +22920,9 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22697
22920
|
} catch {
|
|
22698
22921
|
return empty;
|
|
22699
22922
|
}
|
|
22700
|
-
}, collectDirSpecifiers = async (dir,
|
|
22923
|
+
}, collectDirSpecifiers = async (dir, transpiler6, dep, framework) => {
|
|
22701
22924
|
const files = await scanDirFiles(dir);
|
|
22702
|
-
const results = await Promise.all(files.map((file5) => readFileSpecifiers(file5,
|
|
22925
|
+
const results = await Promise.all(files.map((file5) => readFileSpecifiers(file5, transpiler6)));
|
|
22703
22926
|
for (const result of results) {
|
|
22704
22927
|
for (const spec of result.dep)
|
|
22705
22928
|
dep.add(spec);
|
|
@@ -22709,15 +22932,15 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22709
22932
|
}, scanBareImports = async (directories) => {
|
|
22710
22933
|
const dep = new Set;
|
|
22711
22934
|
const framework = new Set;
|
|
22712
|
-
const
|
|
22713
|
-
await Promise.all(directories.map((dir) => collectDirSpecifiers(dir,
|
|
22935
|
+
const transpiler6 = new Bun.Transpiler({ loader: "tsx" });
|
|
22936
|
+
await Promise.all(directories.map((dir) => collectDirSpecifiers(dir, transpiler6, dep, framework)));
|
|
22714
22937
|
return {
|
|
22715
22938
|
dep: Array.from(dep).filter(isResolvable4),
|
|
22716
22939
|
framework: Array.from(framework).filter(isResolvable4)
|
|
22717
22940
|
};
|
|
22718
22941
|
}, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
|
|
22719
22942
|
const { readFileSync: readFileSync21 } = await import("fs");
|
|
22720
|
-
const
|
|
22943
|
+
const transpiler6 = new Bun.Transpiler({ loader: "js" });
|
|
22721
22944
|
const newSpecs = new Set;
|
|
22722
22945
|
for (const spec of specs) {
|
|
22723
22946
|
if (alreadyScanned.has(spec))
|
|
@@ -22737,7 +22960,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22737
22960
|
}
|
|
22738
22961
|
let imports;
|
|
22739
22962
|
try {
|
|
22740
|
-
imports =
|
|
22963
|
+
imports = transpiler6.scanImports(content);
|
|
22741
22964
|
} catch {
|
|
22742
22965
|
continue;
|
|
22743
22966
|
}
|
|
@@ -22773,7 +22996,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22773
22996
|
}), buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
|
|
22774
22997
|
const entries = await Promise.all(specifiers.map(async (specifier) => {
|
|
22775
22998
|
const safeName = toSafeFileName6(specifier);
|
|
22776
|
-
const entryPath =
|
|
22999
|
+
const entryPath = join31(tmpDir, `${safeName}.ts`);
|
|
22777
23000
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
22778
23001
|
return { entryPath, specifier };
|
|
22779
23002
|
}));
|
|
@@ -22834,9 +23057,9 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22834
23057
|
const { dep: initialSpecs, framework: frameworkRoots } = await scanBareImports(directories);
|
|
22835
23058
|
if (initialSpecs.length === 0 && frameworkRoots.length === 0)
|
|
22836
23059
|
return {};
|
|
22837
|
-
const vendorDir =
|
|
23060
|
+
const vendorDir = join31(buildDir, "vendor");
|
|
22838
23061
|
mkdirSync13(vendorDir, { recursive: true });
|
|
22839
|
-
const tmpDir =
|
|
23062
|
+
const tmpDir = join31(buildDir, "_dep_vendor_tmp");
|
|
22840
23063
|
mkdirSync13(tmpDir, { recursive: true });
|
|
22841
23064
|
const allSpecs = new Set(initialSpecs);
|
|
22842
23065
|
const alreadyScanned = new Set;
|
|
@@ -22919,7 +23142,7 @@ __export(exports_devBuild, {
|
|
|
22919
23142
|
});
|
|
22920
23143
|
import { readdir as readdir5 } from "fs/promises";
|
|
22921
23144
|
import { statSync as statSync5 } from "fs";
|
|
22922
|
-
import { resolve as
|
|
23145
|
+
import { resolve as resolve40 } from "path";
|
|
22923
23146
|
var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
22924
23147
|
const configuredDirs = [
|
|
22925
23148
|
config.reactDirectory,
|
|
@@ -22942,7 +23165,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
22942
23165
|
return Object.keys(config).length > 0 ? config : null;
|
|
22943
23166
|
}, reloadConfig = async () => {
|
|
22944
23167
|
try {
|
|
22945
|
-
const configPath2 =
|
|
23168
|
+
const configPath2 = resolve40(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
22946
23169
|
const source = await Bun.file(configPath2).text();
|
|
22947
23170
|
return parseDirectoryConfig(source);
|
|
22948
23171
|
} catch {
|
|
@@ -23027,7 +23250,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
23027
23250
|
state.fileChangeQueue.clear();
|
|
23028
23251
|
}
|
|
23029
23252
|
}, handleCachedReload = async () => {
|
|
23030
|
-
const serverMtime = statSync5(
|
|
23253
|
+
const serverMtime = statSync5(resolve40(Bun.main)).mtimeMs;
|
|
23031
23254
|
const lastMtime = globalThis.__hmrServerMtime;
|
|
23032
23255
|
globalThis.__hmrServerMtime = serverMtime;
|
|
23033
23256
|
const cached = globalThis.__hmrDevResult;
|
|
@@ -23064,8 +23287,8 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
23064
23287
|
return true;
|
|
23065
23288
|
}, resolveAbsoluteVersion2 = async () => {
|
|
23066
23289
|
const candidates = [
|
|
23067
|
-
|
|
23068
|
-
|
|
23290
|
+
resolve40(import.meta.dir, "..", "..", "package.json"),
|
|
23291
|
+
resolve40(import.meta.dir, "..", "package.json")
|
|
23069
23292
|
];
|
|
23070
23293
|
const [candidate, ...remaining] = candidates;
|
|
23071
23294
|
if (!candidate) {
|
|
@@ -23091,7 +23314,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
23091
23314
|
const entries = await readdir5(vendorDir).catch(() => emptyStringArray);
|
|
23092
23315
|
await Promise.all(entries.filter((entry) => entry.endsWith(".js")).map(async (entry) => {
|
|
23093
23316
|
const webPath = `/${framework}/vendor/${entry}`;
|
|
23094
|
-
const bytes = await Bun.file(
|
|
23317
|
+
const bytes = await Bun.file(resolve40(vendorDir, entry)).bytes();
|
|
23095
23318
|
assetStore.set(webPath, bytes);
|
|
23096
23319
|
}));
|
|
23097
23320
|
}, devBuild = async (config) => {
|
|
@@ -23159,11 +23382,11 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
23159
23382
|
cleanStaleAssets(state.assetStore, manifest, state.resolvedPaths.buildDir);
|
|
23160
23383
|
recordStep("populate asset store", stepStartedAt);
|
|
23161
23384
|
stepStartedAt = performance.now();
|
|
23162
|
-
const reactVendorDir =
|
|
23163
|
-
const angularVendorDir =
|
|
23164
|
-
const svelteVendorDir =
|
|
23165
|
-
const vueVendorDir =
|
|
23166
|
-
const depVendorDir =
|
|
23385
|
+
const reactVendorDir = resolve40(state.resolvedPaths.buildDir, "react", "vendor");
|
|
23386
|
+
const angularVendorDir = resolve40(state.resolvedPaths.buildDir, "angular", "vendor");
|
|
23387
|
+
const svelteVendorDir = resolve40(state.resolvedPaths.buildDir, "svelte", "vendor");
|
|
23388
|
+
const vueVendorDir = resolve40(state.resolvedPaths.buildDir, "vue", "vendor");
|
|
23389
|
+
const depVendorDir = resolve40(state.resolvedPaths.buildDir, "vendor");
|
|
23167
23390
|
const { buildDepVendor: buildDepVendor2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
|
|
23168
23391
|
const [, angularSpecs, , , , , depPaths] = await Promise.all([
|
|
23169
23392
|
config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
|
|
@@ -23241,7 +23464,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
23241
23464
|
manifest
|
|
23242
23465
|
};
|
|
23243
23466
|
globalThis.__hmrDevResult = result;
|
|
23244
|
-
globalThis.__hmrServerMtime = statSync5(
|
|
23467
|
+
globalThis.__hmrServerMtime = statSync5(resolve40(Bun.main)).mtimeMs;
|
|
23245
23468
|
return result;
|
|
23246
23469
|
};
|
|
23247
23470
|
var init_devBuild = __esm(() => {
|
|
@@ -23386,8 +23609,8 @@ var STORE_KEY = "__elysiaStore", getGlobalValue = (key) => Reflect.get(globalThi
|
|
|
23386
23609
|
return null;
|
|
23387
23610
|
if (!pathname.startsWith("/"))
|
|
23388
23611
|
return null;
|
|
23389
|
-
const { resolve:
|
|
23390
|
-
const candidate =
|
|
23612
|
+
const { resolve: resolve41, normalize } = await import("path");
|
|
23613
|
+
const candidate = resolve41(buildDir, pathname.slice(1));
|
|
23391
23614
|
const normalizedBuild = normalize(buildDir);
|
|
23392
23615
|
if (!candidate.startsWith(normalizedBuild))
|
|
23393
23616
|
return null;
|
|
@@ -23471,12 +23694,12 @@ __export(exports_devtoolsJson, {
|
|
|
23471
23694
|
devtoolsJson: () => devtoolsJson
|
|
23472
23695
|
});
|
|
23473
23696
|
import { existsSync as existsSync28, mkdirSync as mkdirSync14, readFileSync as readFileSync21, writeFileSync as writeFileSync9 } from "fs";
|
|
23474
|
-
import { dirname as
|
|
23697
|
+
import { dirname as dirname23, join as join32, resolve as resolve41 } from "path";
|
|
23475
23698
|
import { Elysia as Elysia3 } from "elysia";
|
|
23476
23699
|
var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_KEY = "__absoluteDevtoolsWorkspaceUuid", getGlobalUuid = () => Reflect.get(globalThis, UUID_CACHE_KEY), setGlobalUuid = (uuid) => {
|
|
23477
23700
|
Reflect.set(globalThis, UUID_CACHE_KEY, uuid);
|
|
23478
23701
|
return uuid;
|
|
23479
|
-
}, isUuidV4 = (value) => /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value), resolveDevtoolsUuidCachePath = (buildDir, uuidCachePath) =>
|
|
23702
|
+
}, isUuidV4 = (value) => /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value), resolveDevtoolsUuidCachePath = (buildDir, uuidCachePath) => resolve41(uuidCachePath ?? join32(buildDir, ".absolute", "chrome-devtools-workspace-uuid")), readCachedUuid = (cachePath) => {
|
|
23480
23703
|
if (!existsSync28(cachePath))
|
|
23481
23704
|
return null;
|
|
23482
23705
|
try {
|
|
@@ -23498,11 +23721,11 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
|
|
|
23498
23721
|
if (cachedUuid)
|
|
23499
23722
|
return setGlobalUuid(cachedUuid);
|
|
23500
23723
|
const uuid = crypto.randomUUID();
|
|
23501
|
-
mkdirSync14(
|
|
23724
|
+
mkdirSync14(dirname23(cachePath), { recursive: true });
|
|
23502
23725
|
writeFileSync9(cachePath, uuid, "utf-8");
|
|
23503
23726
|
return setGlobalUuid(uuid);
|
|
23504
23727
|
}, devtoolsJson = (buildDir, options = {}) => {
|
|
23505
|
-
const rootPath =
|
|
23728
|
+
const rootPath = resolve41(options.projectRoot ?? process.cwd());
|
|
23506
23729
|
const root = options.normalizeForWindowsContainer === false ? rootPath : normalizeDevtoolsWorkspaceRoot(rootPath);
|
|
23507
23730
|
const uuid = getOrCreateUuid(buildDir, options);
|
|
23508
23731
|
return new Elysia3({ name: "absolute-devtools-json" }).get(ENDPOINT, () => ({
|
|
@@ -23515,11 +23738,11 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
|
|
|
23515
23738
|
if (process.env.WSL_DISTRO_NAME) {
|
|
23516
23739
|
const distro = process.env.WSL_DISTRO_NAME;
|
|
23517
23740
|
const withoutLeadingSlash = root.replace(/^\//, "");
|
|
23518
|
-
return
|
|
23741
|
+
return join32("\\\\wsl.localhost", distro, withoutLeadingSlash).replace(/\//g, "\\");
|
|
23519
23742
|
}
|
|
23520
23743
|
if (process.env.DOCKER_DESKTOP && !root.startsWith("\\\\")) {
|
|
23521
23744
|
const withoutLeadingSlash = root.replace(/^\//, "");
|
|
23522
|
-
return
|
|
23745
|
+
return join32("\\\\wsl.localhost", "docker-desktop-data", withoutLeadingSlash).replace(/\//g, "\\");
|
|
23523
23746
|
}
|
|
23524
23747
|
return root;
|
|
23525
23748
|
};
|
|
@@ -23531,7 +23754,7 @@ __export(exports_imageOptimizer, {
|
|
|
23531
23754
|
imageOptimizer: () => imageOptimizer
|
|
23532
23755
|
});
|
|
23533
23756
|
import { existsSync as existsSync29 } from "fs";
|
|
23534
|
-
import { resolve as
|
|
23757
|
+
import { resolve as resolve42 } from "path";
|
|
23535
23758
|
import { Elysia as Elysia4 } from "elysia";
|
|
23536
23759
|
var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avifInProgress, safeResolve = (path, baseDir) => {
|
|
23537
23760
|
try {
|
|
@@ -23544,7 +23767,7 @@ var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avi
|
|
|
23544
23767
|
}
|
|
23545
23768
|
}, resolveLocalImage = (url, buildDir) => {
|
|
23546
23769
|
const cleanPath = url.startsWith("/") ? url.slice(1) : url;
|
|
23547
|
-
return safeResolve(cleanPath, buildDir) ?? safeResolve(cleanPath,
|
|
23770
|
+
return safeResolve(cleanPath, buildDir) ?? safeResolve(cleanPath, resolve42(process.cwd()));
|
|
23548
23771
|
}, parseQueryParams = (query, allowedSizes, defaultQuality) => {
|
|
23549
23772
|
const url = typeof query["url"] === "string" ? query["url"] : undefined;
|
|
23550
23773
|
const wParam = typeof query["w"] === "string" ? query["w"] : undefined;
|
|
@@ -23836,7 +24059,7 @@ __export(exports_prerender, {
|
|
|
23836
24059
|
PRERENDER_BYPASS_HEADER: () => PRERENDER_BYPASS_HEADER
|
|
23837
24060
|
});
|
|
23838
24061
|
import { mkdirSync as mkdirSync15, readFileSync as readFileSync22 } from "fs";
|
|
23839
|
-
import { join as
|
|
24062
|
+
import { join as join33 } from "path";
|
|
23840
24063
|
var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_TIMEOUT_MS = 30000, PRERENDER_BYPASS_HEADER = "X-Absolute-Prerender-Bypass", routeToFilename = (route) => route === "/" ? "index.html" : `${route.slice(1).replace(/\//g, "-")}.html`, writeTimestamp = async (htmlPath) => {
|
|
23841
24064
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
23842
24065
|
await Bun.write(metaPath, String(Date.now()));
|
|
@@ -23902,7 +24125,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
|
|
|
23902
24125
|
return false;
|
|
23903
24126
|
const html = await res.text();
|
|
23904
24127
|
const fileName = routeToFilename(route);
|
|
23905
|
-
const filePath =
|
|
24128
|
+
const filePath = join33(prerenderDir, fileName);
|
|
23906
24129
|
await Bun.write(filePath, html);
|
|
23907
24130
|
await writeTimestamp(filePath);
|
|
23908
24131
|
return true;
|
|
@@ -23928,13 +24151,13 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
|
|
|
23928
24151
|
}
|
|
23929
24152
|
const html = await res.text();
|
|
23930
24153
|
const fileName = routeToFilename(route);
|
|
23931
|
-
const filePath =
|
|
24154
|
+
const filePath = join33(prerenderDir, fileName);
|
|
23932
24155
|
await Bun.write(filePath, html);
|
|
23933
24156
|
await writeTimestamp(filePath);
|
|
23934
24157
|
result.routes.set(route, filePath);
|
|
23935
24158
|
log2?.(` Pre-rendered ${route} \u2192 ${fileName} (${html.length} bytes)`);
|
|
23936
24159
|
}, prerender = async (port, outDir, staticConfig, log2) => {
|
|
23937
|
-
const prerenderDir =
|
|
24160
|
+
const prerenderDir = join33(outDir, "_prerendered");
|
|
23938
24161
|
mkdirSync15(prerenderDir, { recursive: true });
|
|
23939
24162
|
const baseUrl = `http://localhost:${port}`;
|
|
23940
24163
|
let routes;
|
|
@@ -24533,11 +24756,11 @@ var handleHTMXPageRequest = async (pagePath) => {
|
|
|
24533
24756
|
};
|
|
24534
24757
|
// src/core/prepare.ts
|
|
24535
24758
|
import { existsSync as existsSync30, readdirSync as readdirSync3, readFileSync as readFileSync23 } from "fs";
|
|
24536
|
-
import { basename as basename13, join as
|
|
24759
|
+
import { basename as basename13, join as join34, relative as relative17, resolve as resolve43 } from "path";
|
|
24537
24760
|
import { Elysia as Elysia5 } from "elysia";
|
|
24538
24761
|
|
|
24539
24762
|
// src/utils/loadConfig.ts
|
|
24540
|
-
import { resolve as
|
|
24763
|
+
import { resolve as resolve8 } from "path";
|
|
24541
24764
|
var RESERVED_TOP_LEVEL_KEYS = new Set([
|
|
24542
24765
|
"assetsDirectory",
|
|
24543
24766
|
"astroDirectory",
|
|
@@ -24630,7 +24853,7 @@ var loadConfig = async (configPath) => {
|
|
|
24630
24853
|
return config;
|
|
24631
24854
|
};
|
|
24632
24855
|
var loadRawConfig = async (configPath) => {
|
|
24633
|
-
const resolved =
|
|
24856
|
+
const resolved = resolve8(configPath ?? process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
24634
24857
|
const mod = await import(resolved);
|
|
24635
24858
|
const config = mod.default ?? mod.config;
|
|
24636
24859
|
if (!config) {
|
|
@@ -24645,7 +24868,7 @@ Expected: export default defineConfig({ ... })`);
|
|
|
24645
24868
|
|
|
24646
24869
|
// src/core/loadIslandRegistry.ts
|
|
24647
24870
|
init_islandEntries();
|
|
24648
|
-
import { resolve as
|
|
24871
|
+
import { resolve as resolve9 } from "path";
|
|
24649
24872
|
var isRecord6 = (value) => typeof value === "object" && value !== null;
|
|
24650
24873
|
var resolveRegistryExport2 = (mod) => {
|
|
24651
24874
|
if (isRecord6(mod.islandRegistry))
|
|
@@ -24657,7 +24880,7 @@ var resolveRegistryExport2 = (mod) => {
|
|
|
24657
24880
|
var isRegistryModuleExport = (value) => isRecord6(value);
|
|
24658
24881
|
var isIslandRegistryInput = (value) => isRecord6(value);
|
|
24659
24882
|
var loadIslandRegistry = async (registryPath) => {
|
|
24660
|
-
const resolvedRegistryPath =
|
|
24883
|
+
const resolvedRegistryPath = resolve9(registryPath);
|
|
24661
24884
|
const buildInfo = await loadIslandRegistryBuildInfo(resolvedRegistryPath);
|
|
24662
24885
|
if (buildInfo.definitions.length > 0) {
|
|
24663
24886
|
return buildInfo.registry;
|
|
@@ -24723,16 +24946,22 @@ var setConventions = (map) => {
|
|
|
24723
24946
|
};
|
|
24724
24947
|
var isDev = () => true;
|
|
24725
24948
|
var buildErrorProps = (error) => {
|
|
24726
|
-
|
|
24727
|
-
|
|
24728
|
-
|
|
24949
|
+
if (error instanceof Error) {
|
|
24950
|
+
return {
|
|
24951
|
+
name: error.name,
|
|
24952
|
+
message: error.message,
|
|
24953
|
+
...isDev() && error.stack ? { stack: error.stack } : {}
|
|
24954
|
+
};
|
|
24955
|
+
}
|
|
24956
|
+
return { name: "Error", message: String(error) };
|
|
24729
24957
|
};
|
|
24730
24958
|
var renderReactError = async (conventionPath, errorProps) => {
|
|
24731
24959
|
const { createElement } = await import("react");
|
|
24732
24960
|
const { renderToReadableStream } = await import("react-dom/server");
|
|
24733
24961
|
const mod = await import(conventionPath);
|
|
24734
|
-
const
|
|
24735
|
-
|
|
24962
|
+
const ErrorComponent = mod.default;
|
|
24963
|
+
if (typeof ErrorComponent !== "function")
|
|
24964
|
+
return null;
|
|
24736
24965
|
const element = createElement(ErrorComponent, errorProps);
|
|
24737
24966
|
const stream = await renderToReadableStream(element);
|
|
24738
24967
|
return new Response(stream, {
|
|
@@ -24744,6 +24973,8 @@ var renderSvelteError = async (conventionPath, errorProps) => {
|
|
|
24744
24973
|
const { render } = await import("svelte/server");
|
|
24745
24974
|
const mod = await import(conventionPath);
|
|
24746
24975
|
const ErrorComponent = mod.default;
|
|
24976
|
+
if (!ErrorComponent)
|
|
24977
|
+
return null;
|
|
24747
24978
|
const { head, body } = render(ErrorComponent, {
|
|
24748
24979
|
props: errorProps
|
|
24749
24980
|
});
|
|
@@ -24766,6 +24997,8 @@ var renderVueError = async (conventionPath, errorProps) => {
|
|
|
24766
24997
|
const { renderToString } = await import("vue/server-renderer");
|
|
24767
24998
|
const mod = await import(conventionPath);
|
|
24768
24999
|
const ErrorComponent = mod.default;
|
|
25000
|
+
if (!ErrorComponent)
|
|
25001
|
+
return null;
|
|
24769
25002
|
const app = createSSRApp({
|
|
24770
25003
|
render: () => h2(ErrorComponent, errorProps)
|
|
24771
25004
|
});
|
|
@@ -24779,10 +25012,20 @@ var renderVueError = async (conventionPath, errorProps) => {
|
|
|
24779
25012
|
};
|
|
24780
25013
|
var renderAngularError = async (conventionPath, errorProps) => {
|
|
24781
25014
|
const mod = await import(conventionPath);
|
|
24782
|
-
const
|
|
24783
|
-
if (typeof
|
|
25015
|
+
const renderFn = mod.default;
|
|
25016
|
+
if (typeof renderFn !== "function")
|
|
24784
25017
|
return null;
|
|
24785
|
-
const html =
|
|
25018
|
+
const html = renderFn(errorProps);
|
|
25019
|
+
return new Response(html, {
|
|
25020
|
+
headers: { "Content-Type": "text/html" },
|
|
25021
|
+
status: 500
|
|
25022
|
+
});
|
|
25023
|
+
};
|
|
25024
|
+
var escapeHtml = (value) => value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
25025
|
+
var replaceErrorTokens = (template, errorProps) => template.replace(/\{\{\s*name\s*\}\}/g, escapeHtml(errorProps.name)).replace(/\{\{\s*message\s*\}\}/g, escapeHtml(errorProps.message)).replace(/\{\{\s*stack\s*\}\}/g, errorProps.stack ? escapeHtml(errorProps.stack) : "");
|
|
25026
|
+
var renderHtmlError = async (conventionPath, errorProps) => {
|
|
25027
|
+
const template = await Bun.file(conventionPath).text();
|
|
25028
|
+
const html = replaceErrorTokens(template, errorProps);
|
|
24786
25029
|
return new Response(html, {
|
|
24787
25030
|
headers: { "Content-Type": "text/html" },
|
|
24788
25031
|
status: 500
|
|
@@ -24801,11 +25044,12 @@ var renderEmberNotFound = async () => null;
|
|
|
24801
25044
|
var ERROR_RENDERERS = {
|
|
24802
25045
|
angular: renderAngularError,
|
|
24803
25046
|
ember: renderEmberError,
|
|
25047
|
+
html: renderHtmlError,
|
|
24804
25048
|
react: renderReactError,
|
|
24805
25049
|
svelte: renderSvelteError,
|
|
24806
25050
|
vue: renderVueError
|
|
24807
25051
|
};
|
|
24808
|
-
var
|
|
25052
|
+
var tryFrameworkErrorConvention = async (framework, pageName, errorProps, error) => {
|
|
24809
25053
|
let conventionPath = resolveErrorConventionPath(framework, pageName);
|
|
24810
25054
|
if (!conventionPath && error instanceof Error && error.stack) {
|
|
24811
25055
|
for (const match of error.stack.matchAll(/^\s*at\s+([A-Za-z_$][\w$]*)/gm)) {
|
|
@@ -24819,7 +25063,6 @@ var renderConventionError = async (framework, pageName, error) => {
|
|
|
24819
25063
|
}
|
|
24820
25064
|
if (!conventionPath)
|
|
24821
25065
|
return null;
|
|
24822
|
-
const errorProps = buildErrorProps(error);
|
|
24823
25066
|
const renderer = ERROR_RENDERERS[framework];
|
|
24824
25067
|
if (!renderer)
|
|
24825
25068
|
return null;
|
|
@@ -24830,12 +25073,25 @@ var renderConventionError = async (framework, pageName, error) => {
|
|
|
24830
25073
|
}
|
|
24831
25074
|
return null;
|
|
24832
25075
|
};
|
|
25076
|
+
var renderConventionError = async (framework, pageName, error) => {
|
|
25077
|
+
const errorProps = buildErrorProps(error);
|
|
25078
|
+
const frameworkResponse = await tryFrameworkErrorConvention(framework, pageName, errorProps, error);
|
|
25079
|
+
if (frameworkResponse)
|
|
25080
|
+
return frameworkResponse;
|
|
25081
|
+
if (framework !== "html") {
|
|
25082
|
+
const htmlResponse = await tryFrameworkErrorConvention("html", pageName, errorProps, error);
|
|
25083
|
+
if (htmlResponse)
|
|
25084
|
+
return htmlResponse;
|
|
25085
|
+
}
|
|
25086
|
+
return null;
|
|
25087
|
+
};
|
|
24833
25088
|
var renderReactNotFound = async (conventionPath) => {
|
|
24834
25089
|
const { createElement } = await import("react");
|
|
24835
25090
|
const { renderToReadableStream } = await import("react-dom/server");
|
|
24836
25091
|
const mod = await import(conventionPath);
|
|
24837
|
-
const
|
|
24838
|
-
|
|
25092
|
+
const NotFoundComponent = mod.default;
|
|
25093
|
+
if (typeof NotFoundComponent !== "function")
|
|
25094
|
+
return null;
|
|
24839
25095
|
const element = createElement(NotFoundComponent);
|
|
24840
25096
|
const stream = await renderToReadableStream(element);
|
|
24841
25097
|
return new Response(stream, {
|
|
@@ -24847,6 +25103,8 @@ var renderSvelteNotFound = async (conventionPath) => {
|
|
|
24847
25103
|
const { render } = await import("svelte/server");
|
|
24848
25104
|
const mod = await import(conventionPath);
|
|
24849
25105
|
const NotFoundComponent = mod.default;
|
|
25106
|
+
if (!NotFoundComponent)
|
|
25107
|
+
return null;
|
|
24850
25108
|
const { head, body } = render(NotFoundComponent);
|
|
24851
25109
|
const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
|
|
24852
25110
|
return new Response(html, {
|
|
@@ -24859,6 +25117,8 @@ var renderVueNotFound = async (conventionPath) => {
|
|
|
24859
25117
|
const { renderToString } = await import("vue/server-renderer");
|
|
24860
25118
|
const mod = await import(conventionPath);
|
|
24861
25119
|
const NotFoundComponent = mod.default;
|
|
25120
|
+
if (!NotFoundComponent)
|
|
25121
|
+
return null;
|
|
24862
25122
|
const app = createSSRApp({
|
|
24863
25123
|
render: () => h2(NotFoundComponent)
|
|
24864
25124
|
});
|
|
@@ -24872,10 +25132,17 @@ var renderVueNotFound = async (conventionPath) => {
|
|
|
24872
25132
|
};
|
|
24873
25133
|
var renderAngularNotFound = async (conventionPath) => {
|
|
24874
25134
|
const mod = await import(conventionPath);
|
|
24875
|
-
const
|
|
24876
|
-
if (typeof
|
|
25135
|
+
const renderFn = mod.default;
|
|
25136
|
+
if (typeof renderFn !== "function")
|
|
24877
25137
|
return null;
|
|
24878
|
-
const html =
|
|
25138
|
+
const html = renderFn();
|
|
25139
|
+
return new Response(html, {
|
|
25140
|
+
headers: { "Content-Type": "text/html" },
|
|
25141
|
+
status: 404
|
|
25142
|
+
});
|
|
25143
|
+
};
|
|
25144
|
+
var renderHtmlNotFound = async (conventionPath) => {
|
|
25145
|
+
const html = await Bun.file(conventionPath).text();
|
|
24879
25146
|
return new Response(html, {
|
|
24880
25147
|
headers: { "Content-Type": "text/html" },
|
|
24881
25148
|
status: 404
|
|
@@ -24884,6 +25151,7 @@ var renderAngularNotFound = async (conventionPath) => {
|
|
|
24884
25151
|
var NOT_FOUND_RENDERERS = {
|
|
24885
25152
|
angular: renderAngularNotFound,
|
|
24886
25153
|
ember: renderEmberNotFound,
|
|
25154
|
+
html: renderHtmlNotFound,
|
|
24887
25155
|
react: renderReactNotFound,
|
|
24888
25156
|
svelte: renderSvelteNotFound,
|
|
24889
25157
|
vue: renderVueNotFound
|
|
@@ -24906,7 +25174,8 @@ var NOT_FOUND_PRIORITY = [
|
|
|
24906
25174
|
"react",
|
|
24907
25175
|
"svelte",
|
|
24908
25176
|
"vue",
|
|
24909
|
-
"angular"
|
|
25177
|
+
"angular",
|
|
25178
|
+
"html"
|
|
24910
25179
|
];
|
|
24911
25180
|
var renderFirstNotFound = async () => {
|
|
24912
25181
|
const renderNext = async (frameworks2) => {
|
|
@@ -24956,7 +25225,7 @@ var collectPrewarmFiles = async (prewarmDirs) => {
|
|
|
24956
25225
|
for (const { dir, pattern } of prewarmDirs) {
|
|
24957
25226
|
const glob = new Glob10(pattern);
|
|
24958
25227
|
const matches = [
|
|
24959
|
-
...glob.scanSync({ absolute: true, cwd:
|
|
25228
|
+
...glob.scanSync({ absolute: true, cwd: resolve43(dir) })
|
|
24960
25229
|
];
|
|
24961
25230
|
files.push(...matches);
|
|
24962
25231
|
}
|
|
@@ -24967,7 +25236,7 @@ var warmPrewarmDirs = async (prewarmDirs, warmCache2, SRC_URL_PREFIX2) => {
|
|
|
24967
25236
|
for (const file5 of files) {
|
|
24968
25237
|
if (file5.includes("/node_modules/"))
|
|
24969
25238
|
continue;
|
|
24970
|
-
const rel =
|
|
25239
|
+
const rel = relative17(process.cwd(), file5).replace(/\\/g, "/");
|
|
24971
25240
|
warmCache2(`${SRC_URL_PREFIX2}${rel}`);
|
|
24972
25241
|
}
|
|
24973
25242
|
};
|
|
@@ -24992,10 +25261,10 @@ var patchManifestIndexes = (manifest, devIndexDir, SRC_URL_PREFIX2) => {
|
|
|
24992
25261
|
const fileName = resolveDevIndexFileName(manifest[key], baseName);
|
|
24993
25262
|
if (!fileName)
|
|
24994
25263
|
continue;
|
|
24995
|
-
const srcPath =
|
|
25264
|
+
const srcPath = resolve43(devIndexDir, fileName);
|
|
24996
25265
|
if (!existsSync30(srcPath))
|
|
24997
25266
|
continue;
|
|
24998
|
-
const rel =
|
|
25267
|
+
const rel = relative17(process.cwd(), srcPath).replace(/\\/g, "/");
|
|
24999
25268
|
manifest[key] = `${SRC_URL_PREFIX2}${rel}`;
|
|
25000
25269
|
}
|
|
25001
25270
|
};
|
|
@@ -25065,7 +25334,7 @@ var prepareDev = async (config, buildDir) => {
|
|
|
25065
25334
|
stepStartedAt = performance.now();
|
|
25066
25335
|
const hmrPlugin = hmr2(result.hmrState, result.manifest, moduleHandler);
|
|
25067
25336
|
const { devtoolsJson: devtoolsJson2 } = await Promise.resolve().then(() => (init_devtoolsJson(), exports_devtoolsJson));
|
|
25068
|
-
const devIndexDir =
|
|
25337
|
+
const devIndexDir = resolve43(buildDir, "_src_indexes");
|
|
25069
25338
|
patchManifestIndexes(result.manifest, devIndexDir, SRC_URL_PREFIX2);
|
|
25070
25339
|
recordStep("configure dev plugins", stepStartedAt);
|
|
25071
25340
|
stepStartedAt = performance.now();
|
|
@@ -25114,7 +25383,7 @@ var loadPrerenderMap = (prerenderDir) => {
|
|
|
25114
25383
|
continue;
|
|
25115
25384
|
const name = basename13(entry, ".html");
|
|
25116
25385
|
const route = name === "index" ? "/" : `/${name}`;
|
|
25117
|
-
map.set(route,
|
|
25386
|
+
map.set(route, join34(prerenderDir, entry));
|
|
25118
25387
|
}
|
|
25119
25388
|
return map;
|
|
25120
25389
|
};
|
|
@@ -25146,7 +25415,7 @@ var prepare = async (configOrPath) => {
|
|
|
25146
25415
|
recordStep("load config", stepStartedAt);
|
|
25147
25416
|
const nodeEnv = process.env["NODE_ENV"];
|
|
25148
25417
|
const isDev3 = nodeEnv === "development";
|
|
25149
|
-
const buildDir =
|
|
25418
|
+
const buildDir = resolve43(process.env.ABSOLUTE_BUILD_DIR ?? config.buildDirectory ?? "build");
|
|
25150
25419
|
if (isDev3) {
|
|
25151
25420
|
stepStartedAt = performance.now();
|
|
25152
25421
|
const result = await prepareDev(config, buildDir);
|
|
@@ -25163,7 +25432,7 @@ var prepare = async (configOrPath) => {
|
|
|
25163
25432
|
setCurrentPageIslandMetadata(await loadPageIslandMetadata(config));
|
|
25164
25433
|
recordStep("load production manifest and island metadata", stepStartedAt);
|
|
25165
25434
|
stepStartedAt = performance.now();
|
|
25166
|
-
const conventionsPath =
|
|
25435
|
+
const conventionsPath = join34(buildDir, "conventions.json");
|
|
25167
25436
|
if (existsSync30(conventionsPath)) {
|
|
25168
25437
|
const conventions2 = JSON.parse(readFileSync23(conventionsPath, "utf-8"));
|
|
25169
25438
|
setConventions(conventions2);
|
|
@@ -25179,7 +25448,7 @@ var prepare = async (configOrPath) => {
|
|
|
25179
25448
|
});
|
|
25180
25449
|
recordStep("create static plugin", stepStartedAt);
|
|
25181
25450
|
stepStartedAt = performance.now();
|
|
25182
|
-
const prerenderDir =
|
|
25451
|
+
const prerenderDir = join34(buildDir, "_prerendered");
|
|
25183
25452
|
const prerenderMap = loadPrerenderMap(prerenderDir);
|
|
25184
25453
|
recordStep("load prerender map", stepStartedAt);
|
|
25185
25454
|
if (prerenderMap.size > 0) {
|
|
@@ -25238,10 +25507,10 @@ var {env: env4 } = globalThis.Bun;
|
|
|
25238
25507
|
|
|
25239
25508
|
// src/dev/devCert.ts
|
|
25240
25509
|
import { existsSync as existsSync31, mkdirSync as mkdirSync16, readFileSync as readFileSync24, rmSync as rmSync3 } from "fs";
|
|
25241
|
-
import { join as
|
|
25242
|
-
var CERT_DIR =
|
|
25243
|
-
var CERT_PATH =
|
|
25244
|
-
var KEY_PATH =
|
|
25510
|
+
import { join as join35 } from "path";
|
|
25511
|
+
var CERT_DIR = join35(process.cwd(), ".absolutejs");
|
|
25512
|
+
var CERT_PATH = join35(CERT_DIR, "cert.pem");
|
|
25513
|
+
var KEY_PATH = join35(CERT_DIR, "key.pem");
|
|
25245
25514
|
var CERT_VALIDITY_DAYS = 365;
|
|
25246
25515
|
var devLog = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[36m[dev]\x1B[0m ${msg}`);
|
|
25247
25516
|
var devWarn = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[33m[dev]\x1B[0m \x1B[33m${msg}\x1B[0m`);
|
|
@@ -25436,6 +25705,9 @@ var pageRouterPlugin = () => {
|
|
|
25436
25705
|
init_devtoolsJson();
|
|
25437
25706
|
// src/utils/defineConfig.ts
|
|
25438
25707
|
var defineConfig = (config) => config;
|
|
25708
|
+
// src/utils/defineConvention.ts
|
|
25709
|
+
var defineRenderErrorPage = (fn2) => fn2;
|
|
25710
|
+
var defineRenderNotFoundPage = (fn2) => fn2;
|
|
25439
25711
|
// src/utils/generateHeadElement.ts
|
|
25440
25712
|
var renderRobotsContent = (robots) => {
|
|
25441
25713
|
const directives = [];
|
|
@@ -25574,7 +25846,7 @@ var jsonLd2 = (schema) => {
|
|
|
25574
25846
|
// src/utils/defineEnv.ts
|
|
25575
25847
|
var {env: bunEnv } = globalThis.Bun;
|
|
25576
25848
|
import { existsSync as existsSync32, readFileSync as readFileSync25 } from "fs";
|
|
25577
|
-
import { resolve as
|
|
25849
|
+
import { resolve as resolve44 } from "path";
|
|
25578
25850
|
|
|
25579
25851
|
// node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
|
|
25580
25852
|
var exports_value = {};
|
|
@@ -31609,7 +31881,7 @@ ${lines.join(`
|
|
|
31609
31881
|
};
|
|
31610
31882
|
var checkEnvFileSecurity = (properties) => {
|
|
31611
31883
|
const cwd2 = process.cwd();
|
|
31612
|
-
const envPath =
|
|
31884
|
+
const envPath = resolve44(cwd2, ".env");
|
|
31613
31885
|
if (!existsSync32(envPath))
|
|
31614
31886
|
return;
|
|
31615
31887
|
const sensitiveKeys = Object.keys(properties).filter(isSensitive);
|
|
@@ -31619,7 +31891,7 @@ var checkEnvFileSecurity = (properties) => {
|
|
|
31619
31891
|
const presentKeys = sensitiveKeys.filter((key) => envContent.includes(`${key}=`));
|
|
31620
31892
|
if (presentKeys.length === 0)
|
|
31621
31893
|
return;
|
|
31622
|
-
const gitignorePath =
|
|
31894
|
+
const gitignorePath = resolve44(cwd2, ".gitignore");
|
|
31623
31895
|
if (existsSync32(gitignorePath)) {
|
|
31624
31896
|
const gitignore = readFileSync25(gitignorePath, "utf-8");
|
|
31625
31897
|
if (gitignore.split(`
|
|
@@ -31766,6 +32038,8 @@ export {
|
|
|
31766
32038
|
enhanceHtmlResponseWithStreamingSlots,
|
|
31767
32039
|
disposeTailwindCompiler,
|
|
31768
32040
|
devtoolsJson,
|
|
32041
|
+
defineRenderNotFoundPage,
|
|
32042
|
+
defineRenderErrorPage,
|
|
31769
32043
|
defineIslandRegistry,
|
|
31770
32044
|
defineIslandComponent,
|
|
31771
32045
|
defineEnv,
|
|
@@ -31859,5 +32133,5 @@ export {
|
|
|
31859
32133
|
ANGULAR_INIT_TIMEOUT_MS
|
|
31860
32134
|
};
|
|
31861
32135
|
|
|
31862
|
-
//# debugId=
|
|
32136
|
+
//# debugId=9C2372C8227007A564756E2164756E21
|
|
31863
32137
|
//# sourceMappingURL=index.js.map
|