@absolutejs/absolute 0.19.0-beta.931 → 0.19.0-beta.932
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 +736 -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 +854 -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
|
}));
|
|
@@ -14901,6 +15006,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14901
15006
|
vueConventionResult,
|
|
14902
15007
|
angularConventionResult,
|
|
14903
15008
|
emberConventionResult,
|
|
15009
|
+
htmlConventionResult,
|
|
14904
15010
|
allGlobalCssEntries
|
|
14905
15011
|
] = await Promise.all([
|
|
14906
15012
|
tailwindPromise,
|
|
@@ -14911,6 +15017,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14911
15017
|
vuePagesPath ? tracePhase("scan/vue-conventions", () => scanConventions(vuePagesPath, "*.vue")) : emptyConventionResult,
|
|
14912
15018
|
angularPagesPath ? tracePhase("scan/angular-conventions", () => scanConventions(angularPagesPath, "*.ts")) : emptyConventionResult,
|
|
14913
15019
|
emberPagesPath ? tracePhase("scan/ember-conventions", () => scanConventions(emberPagesPath, "*.{gjs,gts,ts}")) : emptyConventionResult,
|
|
15020
|
+
htmlPagesPath ? tracePhase("scan/html-conventions", () => scanConventions(htmlPagesPath, "*.html")) : emptyConventionResult,
|
|
14914
15021
|
stylesDir ? tracePhase("scan/css", () => scanCssEntryPoints(stylesDir, stylesIgnore)) : []
|
|
14915
15022
|
]);
|
|
14916
15023
|
const allSvelteEntries = svelteConventionResult.pageFiles;
|
|
@@ -14928,15 +15035,37 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14928
15035
|
conventionsMap.angular = angularConventionResult.conventions;
|
|
14929
15036
|
if (emberConventionResult.conventions)
|
|
14930
15037
|
conventionsMap.ember = emberConventionResult.conventions;
|
|
14931
|
-
|
|
15038
|
+
if (htmlConventionResult.conventions && htmlDir && htmlPagesPath) {
|
|
15039
|
+
const outputHtmlPages = isSingle ? join26(buildPath, "pages") : join26(buildPath, basename9(htmlDir), "pages");
|
|
15040
|
+
const remap = (sourcePath) => join26(outputHtmlPages, relative12(htmlPagesPath, sourcePath));
|
|
15041
|
+
const htmlConventions = htmlConventionResult.conventions;
|
|
15042
|
+
if (htmlConventions.defaults) {
|
|
15043
|
+
if (htmlConventions.defaults.error)
|
|
15044
|
+
htmlConventions.defaults.error = remap(htmlConventions.defaults.error);
|
|
15045
|
+
if (htmlConventions.defaults.notFound)
|
|
15046
|
+
htmlConventions.defaults.notFound = remap(htmlConventions.defaults.notFound);
|
|
15047
|
+
if (htmlConventions.defaults.loading)
|
|
15048
|
+
htmlConventions.defaults.loading = remap(htmlConventions.defaults.loading);
|
|
15049
|
+
}
|
|
15050
|
+
if (htmlConventions.pages) {
|
|
15051
|
+
for (const page of Object.values(htmlConventions.pages)) {
|
|
15052
|
+
if (page.error)
|
|
15053
|
+
page.error = remap(page.error);
|
|
15054
|
+
if (page.loading)
|
|
15055
|
+
page.loading = remap(page.loading);
|
|
15056
|
+
}
|
|
15057
|
+
}
|
|
15058
|
+
conventionsMap.html = htmlConventions;
|
|
15059
|
+
}
|
|
15060
|
+
const notFoundFrameworks = ["react", "svelte", "vue", "angular", "ember", "html"].filter((framework) => conventionsMap[framework]?.defaults?.notFound);
|
|
14932
15061
|
if (notFoundFrameworks.length > 1) {
|
|
14933
15062
|
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
15063
|
}
|
|
14935
15064
|
const shouldIncludeHtmlAssets = !isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/html/") && (f2.endsWith(".html") || isStylePath(f2)));
|
|
14936
15065
|
const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
|
|
14937
|
-
if (entry.startsWith(
|
|
15066
|
+
if (entry.startsWith(resolve25(reactIndexesPath))) {
|
|
14938
15067
|
const pageName = basename9(entry, ".tsx");
|
|
14939
|
-
return
|
|
15068
|
+
return join26(reactPagesPath, `${pageName}.tsx`);
|
|
14940
15069
|
}
|
|
14941
15070
|
return null;
|
|
14942
15071
|
}) : allReactEntries;
|
|
@@ -15013,7 +15142,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15013
15142
|
const clientPath = islandSvelteClientPaths[idx];
|
|
15014
15143
|
if (!sourcePath || !clientPath)
|
|
15015
15144
|
continue;
|
|
15016
|
-
islandSvelteClientPathMap.set(
|
|
15145
|
+
islandSvelteClientPathMap.set(resolve25(sourcePath), clientPath);
|
|
15017
15146
|
}
|
|
15018
15147
|
const islandVueClientPathMap = new Map;
|
|
15019
15148
|
for (let idx = 0;idx < islandVueSources.length; idx++) {
|
|
@@ -15021,7 +15150,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15021
15150
|
const clientPath = islandVueClientPaths[idx];
|
|
15022
15151
|
if (!sourcePath || !clientPath)
|
|
15023
15152
|
continue;
|
|
15024
|
-
islandVueClientPathMap.set(
|
|
15153
|
+
islandVueClientPathMap.set(resolve25(sourcePath), clientPath);
|
|
15025
15154
|
}
|
|
15026
15155
|
const islandAngularClientPathMap = new Map;
|
|
15027
15156
|
for (let idx = 0;idx < islandAngularSources.length; idx++) {
|
|
@@ -15029,7 +15158,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15029
15158
|
const clientPath = islandAngularClientPaths[idx];
|
|
15030
15159
|
if (!sourcePath || !clientPath)
|
|
15031
15160
|
continue;
|
|
15032
|
-
islandAngularClientPathMap.set(
|
|
15161
|
+
islandAngularClientPathMap.set(resolve25(sourcePath), clientPath);
|
|
15033
15162
|
}
|
|
15034
15163
|
const reactConventionSources = collectConventionSourceFiles(conventionsMap.react);
|
|
15035
15164
|
const svelteConventionSources = collectConventionSourceFiles(conventionsMap.svelte);
|
|
@@ -15040,7 +15169,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15040
15169
|
const compileReactConventions = async () => {
|
|
15041
15170
|
if (reactConventionSources.length === 0)
|
|
15042
15171
|
return emptyStringArray;
|
|
15043
|
-
const destDir =
|
|
15172
|
+
const destDir = join26(buildPath, "conventions", "react");
|
|
15044
15173
|
rmSync2(destDir, { force: true, recursive: true });
|
|
15045
15174
|
mkdirSync11(destDir, { recursive: true });
|
|
15046
15175
|
const destPaths = [];
|
|
@@ -15056,7 +15185,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15056
15185
|
naming: `${idx}-[name].[ext]`,
|
|
15057
15186
|
outdir: destDir,
|
|
15058
15187
|
plugins: [stylePreprocessorPlugin2],
|
|
15059
|
-
root:
|
|
15188
|
+
root: dirname16(source),
|
|
15060
15189
|
target: "bun",
|
|
15061
15190
|
throw: false,
|
|
15062
15191
|
tsconfig: "./tsconfig.json"
|
|
@@ -15084,7 +15213,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15084
15213
|
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
15214
|
]);
|
|
15086
15215
|
const bundleConventionFiles = async (framework, compiledPaths) => {
|
|
15087
|
-
const destDir =
|
|
15216
|
+
const destDir = join26(buildPath, "conventions", framework);
|
|
15088
15217
|
rmSync2(destDir, { force: true, recursive: true });
|
|
15089
15218
|
mkdirSync11(destDir, { recursive: true });
|
|
15090
15219
|
const destPaths = [];
|
|
@@ -15158,7 +15287,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15158
15287
|
}
|
|
15159
15288
|
})) : {
|
|
15160
15289
|
entries: [],
|
|
15161
|
-
generatedRoot:
|
|
15290
|
+
generatedRoot: join26(buildPath, "_island_entries")
|
|
15162
15291
|
};
|
|
15163
15292
|
const islandClientEntryPoints = islandEntryResult.entries.map((entry) => entry.entryPath);
|
|
15164
15293
|
if (serverEntryPoints.length === 0 && reactClientEntryPoints.length === 0 && nonReactClientEntryPoints.length === 0 && islandClientEntryPoints.length === 0 && htmxDir === undefined && htmlDir === undefined) {
|
|
@@ -15194,7 +15323,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15194
15323
|
return {};
|
|
15195
15324
|
}
|
|
15196
15325
|
if (hmr && reactIndexesPath && reactClientEntryPoints.length > 0) {
|
|
15197
|
-
const refreshEntry =
|
|
15326
|
+
const refreshEntry = join26(reactIndexesPath, "_refresh.tsx");
|
|
15198
15327
|
if (!reactClientEntryPoints.includes(refreshEntry))
|
|
15199
15328
|
reactClientEntryPoints.push(refreshEntry);
|
|
15200
15329
|
}
|
|
@@ -15293,19 +15422,19 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15293
15422
|
throw: false
|
|
15294
15423
|
}, resolveBunBuildOverride(bunBuildConfig, "reactClient")) : undefined;
|
|
15295
15424
|
if (reactDir && reactClientEntryPoints.length > 0) {
|
|
15296
|
-
rmSync2(
|
|
15425
|
+
rmSync2(join26(buildPath, "react", "generated", "indexes"), {
|
|
15297
15426
|
force: true,
|
|
15298
15427
|
recursive: true
|
|
15299
15428
|
});
|
|
15300
15429
|
}
|
|
15301
15430
|
if (angularDir && angularClientPaths.length > 0) {
|
|
15302
|
-
rmSync2(
|
|
15431
|
+
rmSync2(join26(buildPath, "angular", "indexes"), {
|
|
15303
15432
|
force: true,
|
|
15304
15433
|
recursive: true
|
|
15305
15434
|
});
|
|
15306
15435
|
}
|
|
15307
15436
|
if (islandClientEntryPoints.length > 0) {
|
|
15308
|
-
rmSync2(
|
|
15437
|
+
rmSync2(join26(buildPath, "islands"), {
|
|
15309
15438
|
force: true,
|
|
15310
15439
|
recursive: true
|
|
15311
15440
|
});
|
|
@@ -15388,7 +15517,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15388
15517
|
globalCssEntries.length > 0 ? tracePhase("bun/global-css", () => bunBuild7(mergeBunBuildConfig({
|
|
15389
15518
|
entrypoints: globalCssEntries,
|
|
15390
15519
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
15391
|
-
outdir: stylesDir ?
|
|
15520
|
+
outdir: stylesDir ? join26(buildPath, basename9(stylesDir)) : buildPath,
|
|
15392
15521
|
plugins: [stylePreprocessorPlugin2],
|
|
15393
15522
|
root: stylesDir || clientRoot,
|
|
15394
15523
|
target: "browser",
|
|
@@ -15397,7 +15526,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15397
15526
|
vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () => bunBuild7(mergeBunBuildConfig({
|
|
15398
15527
|
entrypoints: vueCssPaths,
|
|
15399
15528
|
naming: `[name].[hash].[ext]`,
|
|
15400
|
-
outdir:
|
|
15529
|
+
outdir: join26(buildPath, assetsPath ? basename9(assetsPath) : "assets", "css"),
|
|
15401
15530
|
target: "browser",
|
|
15402
15531
|
throw: false
|
|
15403
15532
|
}, resolveBunBuildOverride(bunBuildConfig, "vueCss")))) : undefined
|
|
@@ -15464,10 +15593,10 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15464
15593
|
if (serverOutputs.length > 0 && angularServerVendorPaths2 && Object.keys(angularServerVendorPaths2).length > 0) {
|
|
15465
15594
|
const { rewriteBuildOutputsWith: rewriteBuildOutputsWith2 } = await Promise.resolve().then(() => (init_rewriteImportsPlugin(), exports_rewriteImportsPlugin));
|
|
15466
15595
|
await tracePhase("postprocess/server-angular-vendor-imports", () => rewriteBuildOutputsWith2(serverOutputs, (artifact) => {
|
|
15467
|
-
const fileDir =
|
|
15596
|
+
const fileDir = dirname16(artifact.path);
|
|
15468
15597
|
const relativePaths = {};
|
|
15469
15598
|
for (const [specifier, absolute] of Object.entries(angularServerVendorPaths2)) {
|
|
15470
|
-
const rel =
|
|
15599
|
+
const rel = relative12(fileDir, absolute);
|
|
15471
15600
|
relativePaths[specifier] = rel.startsWith(".") ? rel : `./${rel}`;
|
|
15472
15601
|
}
|
|
15473
15602
|
return relativePaths;
|
|
@@ -15536,7 +15665,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15536
15665
|
if (skipAngularClientBundle) {
|
|
15537
15666
|
for (const clientPath of angularClientPaths) {
|
|
15538
15667
|
const fileBase = basename9(clientPath, ".js");
|
|
15539
|
-
const relFromCwd =
|
|
15668
|
+
const relFromCwd = relative12(projectRoot, clientPath).replace(/\\/g, "/");
|
|
15540
15669
|
manifest[`${toPascal(fileBase)}Index`] = `/@src/${relFromCwd}`;
|
|
15541
15670
|
}
|
|
15542
15671
|
}
|
|
@@ -15558,7 +15687,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15558
15687
|
const processHtmlPages = async () => {
|
|
15559
15688
|
if (!(htmlDir && htmlPagesPath))
|
|
15560
15689
|
return;
|
|
15561
|
-
const outputHtmlPages = isSingle ?
|
|
15690
|
+
const outputHtmlPages = isSingle ? join26(buildPath, "pages") : join26(buildPath, basename9(htmlDir), "pages");
|
|
15562
15691
|
mkdirSync11(outputHtmlPages, { recursive: true });
|
|
15563
15692
|
cpSync(htmlPagesPath, outputHtmlPages, {
|
|
15564
15693
|
force: true,
|
|
@@ -15580,14 +15709,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15580
15709
|
const processHtmxPages = async () => {
|
|
15581
15710
|
if (!(htmxDir && htmxPagesPath))
|
|
15582
15711
|
return;
|
|
15583
|
-
const outputHtmxPages = isSingle ?
|
|
15712
|
+
const outputHtmxPages = isSingle ? join26(buildPath, "pages") : join26(buildPath, basename9(htmxDir), "pages");
|
|
15584
15713
|
mkdirSync11(outputHtmxPages, { recursive: true });
|
|
15585
15714
|
cpSync(htmxPagesPath, outputHtmxPages, {
|
|
15586
15715
|
force: true,
|
|
15587
15716
|
recursive: true
|
|
15588
15717
|
});
|
|
15589
15718
|
if (shouldCopyHtmx) {
|
|
15590
|
-
const htmxDestDir = isSingle ? buildPath :
|
|
15719
|
+
const htmxDestDir = isSingle ? buildPath : join26(buildPath, basename9(htmxDir));
|
|
15591
15720
|
copyHtmxVendor(htmxDir, htmxDestDir);
|
|
15592
15721
|
}
|
|
15593
15722
|
if (shouldUpdateHtmxAssetPaths) {
|
|
@@ -15649,9 +15778,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15649
15778
|
writeBuildTrace(buildPath);
|
|
15650
15779
|
return { conventions: conventionsMap, manifest };
|
|
15651
15780
|
}
|
|
15652
|
-
writeFileSync8(
|
|
15781
|
+
writeFileSync8(join26(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
|
|
15653
15782
|
if (Object.keys(conventionsMap).length > 0) {
|
|
15654
|
-
writeFileSync8(
|
|
15783
|
+
writeFileSync8(join26(buildPath, "conventions.json"), JSON.stringify(conventionsMap, null, "\t"));
|
|
15655
15784
|
}
|
|
15656
15785
|
writeBuildTrace(buildPath);
|
|
15657
15786
|
if (tailwind && mode === "production") {
|
|
@@ -15752,7 +15881,7 @@ var init_build = __esm(() => {
|
|
|
15752
15881
|
|
|
15753
15882
|
// src/build/buildEmberVendor.ts
|
|
15754
15883
|
import { mkdirSync as mkdirSync12, existsSync as existsSync21 } from "fs";
|
|
15755
|
-
import { join as
|
|
15884
|
+
import { join as join27 } from "path";
|
|
15756
15885
|
import { rm as rm9 } from "fs/promises";
|
|
15757
15886
|
var {build: bunBuild8 } = globalThis.Bun;
|
|
15758
15887
|
var toSafeFileName5 = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_"), generateMacrosShim = () => `// Generated shim for @embroider/macros \u2014 provides minimal runtime
|
|
@@ -15804,7 +15933,7 @@ export const importSync = (specifier) => {
|
|
|
15804
15933
|
if (standaloneSpecifiers.has(specifier)) {
|
|
15805
15934
|
return { resolveTo: specifier, specifier };
|
|
15806
15935
|
}
|
|
15807
|
-
const emberInternalPath =
|
|
15936
|
+
const emberInternalPath = join27(cwd2, "node_modules/ember-source/dist/packages", specifier, "index.js");
|
|
15808
15937
|
if (!existsSync21(emberInternalPath)) {
|
|
15809
15938
|
throw new Error(`Ember vendor build: cannot find ${specifier} at ${emberInternalPath}. ` + `Is ember-source installed and at least 6.12?`);
|
|
15810
15939
|
}
|
|
@@ -15836,7 +15965,7 @@ export const importSync = (specifier) => {
|
|
|
15836
15965
|
if (standalonePackages.has(args.path)) {
|
|
15837
15966
|
return;
|
|
15838
15967
|
}
|
|
15839
|
-
const internal =
|
|
15968
|
+
const internal = join27(cwd2, "node_modules/ember-source/dist/packages", args.path, "index.js");
|
|
15840
15969
|
if (existsSync21(internal)) {
|
|
15841
15970
|
return { path: internal };
|
|
15842
15971
|
}
|
|
@@ -15844,16 +15973,16 @@ export const importSync = (specifier) => {
|
|
|
15844
15973
|
});
|
|
15845
15974
|
}
|
|
15846
15975
|
}), buildEmberVendor = async (buildDir, cwd2 = process.cwd()) => {
|
|
15847
|
-
const vendorDir =
|
|
15976
|
+
const vendorDir = join27(buildDir, "ember", "vendor");
|
|
15848
15977
|
mkdirSync12(vendorDir, { recursive: true });
|
|
15849
|
-
const tmpDir =
|
|
15978
|
+
const tmpDir = join27(buildDir, "_ember_vendor_tmp");
|
|
15850
15979
|
mkdirSync12(tmpDir, { recursive: true });
|
|
15851
|
-
const macrosShimPath =
|
|
15980
|
+
const macrosShimPath = join27(tmpDir, "embroider_macros_shim.js");
|
|
15852
15981
|
await Bun.write(macrosShimPath, generateMacrosShim());
|
|
15853
15982
|
const resolutions = REQUIRED_EMBER_SPECIFIERS.map((specifier) => resolveEmberSpecifier(specifier, cwd2));
|
|
15854
15983
|
const entrypoints = await Promise.all(resolutions.map(async (resolution) => {
|
|
15855
15984
|
const safeName = toSafeFileName5(resolution.specifier);
|
|
15856
|
-
const entryPath =
|
|
15985
|
+
const entryPath = join27(tmpDir, `${safeName}.js`);
|
|
15857
15986
|
const source = resolution.specifier === "@embroider/macros" ? `export * from ${JSON.stringify(macrosShimPath)};
|
|
15858
15987
|
` : generateVendorEntrySource2(resolution);
|
|
15859
15988
|
await Bun.write(entryPath, source);
|
|
@@ -15899,7 +16028,7 @@ var init_buildEmberVendor = __esm(() => {
|
|
|
15899
16028
|
// src/dev/dependencyGraph.ts
|
|
15900
16029
|
import { existsSync as existsSync22, readFileSync as readFileSync15 } from "fs";
|
|
15901
16030
|
var {Glob: Glob8 } = globalThis.Bun;
|
|
15902
|
-
import { resolve as
|
|
16031
|
+
import { resolve as resolve26 } from "path";
|
|
15903
16032
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
15904
16033
|
const lower = filePath.toLowerCase();
|
|
15905
16034
|
if (lower.endsWith(".ts") || lower.endsWith(".tsx") || lower.endsWith(".jsx"))
|
|
@@ -15913,8 +16042,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15913
16042
|
if (!importPath.startsWith(".") && !importPath.startsWith("/")) {
|
|
15914
16043
|
return null;
|
|
15915
16044
|
}
|
|
15916
|
-
const fromDir =
|
|
15917
|
-
const normalized =
|
|
16045
|
+
const fromDir = resolve26(fromFile, "..");
|
|
16046
|
+
const normalized = resolve26(fromDir, importPath);
|
|
15918
16047
|
const extensions = [
|
|
15919
16048
|
".ts",
|
|
15920
16049
|
".tsx",
|
|
@@ -15944,7 +16073,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15944
16073
|
dependents.delete(normalizedPath);
|
|
15945
16074
|
}
|
|
15946
16075
|
}, addFileToGraph = (graph, filePath) => {
|
|
15947
|
-
const normalizedPath =
|
|
16076
|
+
const normalizedPath = resolve26(filePath);
|
|
15948
16077
|
if (!existsSync22(normalizedPath))
|
|
15949
16078
|
return;
|
|
15950
16079
|
const dependencies = extractDependencies(normalizedPath);
|
|
@@ -15961,10 +16090,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15961
16090
|
}, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
|
|
15962
16091
|
const processedFiles = new Set;
|
|
15963
16092
|
const glob = new Glob8("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
|
|
15964
|
-
const resolvedDirs = directories.map((dir) =>
|
|
16093
|
+
const resolvedDirs = directories.map((dir) => resolve26(dir)).filter((dir) => existsSync22(dir));
|
|
15965
16094
|
const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
|
|
15966
16095
|
for (const file5 of allFiles) {
|
|
15967
|
-
const fullPath =
|
|
16096
|
+
const fullPath = resolve26(file5);
|
|
15968
16097
|
if (IGNORED_SEGMENTS.some((seg) => fullPath.includes(seg)))
|
|
15969
16098
|
continue;
|
|
15970
16099
|
if (processedFiles.has(fullPath))
|
|
@@ -16019,8 +16148,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
16019
16148
|
resolveRegexMatches(styleUrlSingularRegex, content, filePath, dependencies);
|
|
16020
16149
|
extractStyleUrlsDependencies(content, filePath, dependencies);
|
|
16021
16150
|
}, extractJsDependencies = (filePath, content, loader) => {
|
|
16022
|
-
const
|
|
16023
|
-
const imports =
|
|
16151
|
+
const transpiler6 = loader === "tsx" ? tsTranspiler : jsTranspiler;
|
|
16152
|
+
const imports = transpiler6.scanImports(content);
|
|
16024
16153
|
const dependencies = [];
|
|
16025
16154
|
for (const imp of imports) {
|
|
16026
16155
|
const resolved = resolveImportPath2(imp.path, filePath);
|
|
@@ -16077,7 +16206,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
16077
16206
|
return [];
|
|
16078
16207
|
}
|
|
16079
16208
|
}, getAffectedFiles = (graph, changedFile) => {
|
|
16080
|
-
const normalizedPath =
|
|
16209
|
+
const normalizedPath = resolve26(changedFile);
|
|
16081
16210
|
const affected = new Set;
|
|
16082
16211
|
const toProcess = [normalizedPath];
|
|
16083
16212
|
const processNode = (current) => {
|
|
@@ -16117,7 +16246,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
16117
16246
|
}
|
|
16118
16247
|
graph.dependents.delete(normalizedPath);
|
|
16119
16248
|
}, removeFileFromGraph = (graph, filePath) => {
|
|
16120
|
-
const normalizedPath =
|
|
16249
|
+
const normalizedPath = resolve26(filePath);
|
|
16121
16250
|
removeDepsForFile(graph, normalizedPath);
|
|
16122
16251
|
removeDependentsForFile(graph, normalizedPath);
|
|
16123
16252
|
};
|
|
@@ -16160,12 +16289,12 @@ var globalVersionCounter = 0, createModuleVersionTracker = () => new Map, getNex
|
|
|
16160
16289
|
};
|
|
16161
16290
|
|
|
16162
16291
|
// src/dev/configResolver.ts
|
|
16163
|
-
import { resolve as
|
|
16292
|
+
import { resolve as resolve27 } from "path";
|
|
16164
16293
|
var resolveBuildPaths = (config) => {
|
|
16165
16294
|
const cwd2 = process.cwd();
|
|
16166
16295
|
const normalize = (path) => path.replace(/\\/g, "/");
|
|
16167
|
-
const withDefault = (value, fallback) => normalize(
|
|
16168
|
-
const optional = (value) => value ? normalize(
|
|
16296
|
+
const withDefault = (value, fallback) => normalize(resolve27(cwd2, value ?? fallback));
|
|
16297
|
+
const optional = (value) => value ? normalize(resolve27(cwd2, value)) : undefined;
|
|
16169
16298
|
return {
|
|
16170
16299
|
angularDir: optional(config.angularDirectory),
|
|
16171
16300
|
assetsDir: optional(config.assetsDirectory),
|
|
@@ -16218,7 +16347,7 @@ var init_clientManager = __esm(() => {
|
|
|
16218
16347
|
|
|
16219
16348
|
// src/dev/pathUtils.ts
|
|
16220
16349
|
import { existsSync as existsSync23, readdirSync, readFileSync as readFileSync16 } from "fs";
|
|
16221
|
-
import { dirname as
|
|
16350
|
+
import { dirname as dirname17, resolve as resolve28 } from "path";
|
|
16222
16351
|
var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
16223
16352
|
if (shouldIgnorePath(filePath, resolved)) {
|
|
16224
16353
|
return "ignored";
|
|
@@ -16294,7 +16423,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
16294
16423
|
return "unknown";
|
|
16295
16424
|
}, collectAngularResourceDirs = (angularDir) => {
|
|
16296
16425
|
const out = new Set;
|
|
16297
|
-
const angularRoot =
|
|
16426
|
+
const angularRoot = resolve28(angularDir);
|
|
16298
16427
|
const angularRootNormalized = normalizePath(angularRoot);
|
|
16299
16428
|
const walk = (dir) => {
|
|
16300
16429
|
let entries;
|
|
@@ -16307,7 +16436,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
16307
16436
|
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
16308
16437
|
continue;
|
|
16309
16438
|
}
|
|
16310
|
-
const full =
|
|
16439
|
+
const full = resolve28(dir, entry.name);
|
|
16311
16440
|
if (entry.isDirectory()) {
|
|
16312
16441
|
walk(full);
|
|
16313
16442
|
continue;
|
|
@@ -16346,10 +16475,10 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
16346
16475
|
refs.push(strMatch[1]);
|
|
16347
16476
|
}
|
|
16348
16477
|
}
|
|
16349
|
-
const componentDir =
|
|
16478
|
+
const componentDir = dirname17(full);
|
|
16350
16479
|
for (const ref of refs) {
|
|
16351
|
-
const refAbs = normalizePath(
|
|
16352
|
-
const refDir = normalizePath(
|
|
16480
|
+
const refAbs = normalizePath(resolve28(componentDir, ref));
|
|
16481
|
+
const refDir = normalizePath(dirname17(refAbs));
|
|
16353
16482
|
if (refDir === angularRootNormalized || refDir.startsWith(angularRootNormalized + "/")) {
|
|
16354
16483
|
continue;
|
|
16355
16484
|
}
|
|
@@ -16365,7 +16494,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
16365
16494
|
const push = (path) => {
|
|
16366
16495
|
if (!path)
|
|
16367
16496
|
return;
|
|
16368
|
-
const abs = normalizePath(
|
|
16497
|
+
const abs = normalizePath(resolve28(cwd2, path));
|
|
16369
16498
|
if (!roots.includes(abs))
|
|
16370
16499
|
roots.push(abs);
|
|
16371
16500
|
};
|
|
@@ -16390,7 +16519,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
16390
16519
|
push(cfg.assetsDir);
|
|
16391
16520
|
push(cfg.stylesDir);
|
|
16392
16521
|
for (const candidate of ["src", "db", "assets", "styles"]) {
|
|
16393
|
-
const abs = normalizePath(
|
|
16522
|
+
const abs = normalizePath(resolve28(cwd2, candidate));
|
|
16394
16523
|
if (existsSync23(abs) && !roots.includes(abs))
|
|
16395
16524
|
roots.push(abs);
|
|
16396
16525
|
}
|
|
@@ -16461,7 +16590,7 @@ var init_pathUtils = __esm(() => {
|
|
|
16461
16590
|
// src/dev/fileWatcher.ts
|
|
16462
16591
|
import { watch } from "fs";
|
|
16463
16592
|
import { existsSync as existsSync24 } from "fs";
|
|
16464
|
-
import { join as
|
|
16593
|
+
import { join as join28, resolve as resolve29 } from "path";
|
|
16465
16594
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
16466
16595
|
try {
|
|
16467
16596
|
removeFileFromGraph(graph, fullPath);
|
|
@@ -16488,7 +16617,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
16488
16617
|
if (shouldSkipFilename(filename, isStylesDir)) {
|
|
16489
16618
|
return;
|
|
16490
16619
|
}
|
|
16491
|
-
const fullPath =
|
|
16620
|
+
const fullPath = join28(absolutePath, filename).replace(/\\/g, "/");
|
|
16492
16621
|
if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
|
|
16493
16622
|
return;
|
|
16494
16623
|
}
|
|
@@ -16506,7 +16635,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
16506
16635
|
}, addFileWatchers = (state, paths, onFileChange) => {
|
|
16507
16636
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
16508
16637
|
paths.forEach((path) => {
|
|
16509
|
-
const absolutePath =
|
|
16638
|
+
const absolutePath = resolve29(path).replace(/\\/g, "/");
|
|
16510
16639
|
if (!existsSync24(absolutePath)) {
|
|
16511
16640
|
return;
|
|
16512
16641
|
}
|
|
@@ -16517,7 +16646,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
16517
16646
|
const watchPaths = getWatchPaths(config, state.resolvedPaths);
|
|
16518
16647
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
16519
16648
|
watchPaths.forEach((path) => {
|
|
16520
|
-
const absolutePath =
|
|
16649
|
+
const absolutePath = resolve29(path).replace(/\\/g, "/");
|
|
16521
16650
|
if (!existsSync24(absolutePath)) {
|
|
16522
16651
|
return;
|
|
16523
16652
|
}
|
|
@@ -16532,13 +16661,13 @@ var init_fileWatcher = __esm(() => {
|
|
|
16532
16661
|
});
|
|
16533
16662
|
|
|
16534
16663
|
// src/dev/assetStore.ts
|
|
16535
|
-
import { resolve as
|
|
16664
|
+
import { resolve as resolve30 } from "path";
|
|
16536
16665
|
import { readdir as readdir4, unlink } from "fs/promises";
|
|
16537
16666
|
var mimeTypes, getMimeType = (filePath) => {
|
|
16538
16667
|
const ext = filePath.slice(filePath.lastIndexOf("."));
|
|
16539
16668
|
return mimeTypes[ext] ?? "application/octet-stream";
|
|
16540
16669
|
}, HASHED_FILE_RE, stripHash = (webPath) => webPath.replace(/\.[a-z0-9]{8}(\.(js|css|mjs))$/, "$1"), processWalkEntry = (entry, dir, liveByIdentity, walkAndClean) => {
|
|
16541
|
-
const fullPath =
|
|
16670
|
+
const fullPath = resolve30(dir, entry.name);
|
|
16542
16671
|
if (entry.isDirectory()) {
|
|
16543
16672
|
return walkAndClean(fullPath);
|
|
16544
16673
|
}
|
|
@@ -16554,10 +16683,10 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
16554
16683
|
}, cleanStaleAssets = async (store, manifest, buildDir) => {
|
|
16555
16684
|
const liveByIdentity = new Map;
|
|
16556
16685
|
for (const webPath of store.keys()) {
|
|
16557
|
-
const diskPath =
|
|
16686
|
+
const diskPath = resolve30(buildDir, webPath.slice(1));
|
|
16558
16687
|
liveByIdentity.set(stripHash(diskPath), diskPath);
|
|
16559
16688
|
}
|
|
16560
|
-
const absBuildDir =
|
|
16689
|
+
const absBuildDir = resolve30(buildDir);
|
|
16561
16690
|
Object.values(manifest).forEach((val) => {
|
|
16562
16691
|
if (!HASHED_FILE_RE.test(val))
|
|
16563
16692
|
return;
|
|
@@ -16575,7 +16704,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
16575
16704
|
} catch {}
|
|
16576
16705
|
}, lookupAsset = (store, path) => store.get(path), processScanEntry = (entry, dir, prefix, store, scanDir) => {
|
|
16577
16706
|
if (entry.isDirectory()) {
|
|
16578
|
-
return scanDir(
|
|
16707
|
+
return scanDir(resolve30(dir, entry.name), `${prefix}${entry.name}/`);
|
|
16579
16708
|
}
|
|
16580
16709
|
if (!entry.name.startsWith("chunk-")) {
|
|
16581
16710
|
return null;
|
|
@@ -16584,7 +16713,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
16584
16713
|
if (store.has(webPath)) {
|
|
16585
16714
|
return null;
|
|
16586
16715
|
}
|
|
16587
|
-
return Bun.file(
|
|
16716
|
+
return Bun.file(resolve30(dir, entry.name)).bytes().then((bytes) => {
|
|
16588
16717
|
store.set(webPath, bytes);
|
|
16589
16718
|
return;
|
|
16590
16719
|
}).catch(() => {});
|
|
@@ -16606,7 +16735,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
16606
16735
|
for (const webPath of newIdentities.values()) {
|
|
16607
16736
|
if (store.has(webPath))
|
|
16608
16737
|
continue;
|
|
16609
|
-
loadPromises.push(Bun.file(
|
|
16738
|
+
loadPromises.push(Bun.file(resolve30(buildDir, webPath.slice(1))).bytes().then((bytes) => {
|
|
16610
16739
|
store.set(webPath, bytes);
|
|
16611
16740
|
return;
|
|
16612
16741
|
}).catch(() => {}));
|
|
@@ -16732,9 +16861,9 @@ var init_transformCache = __esm(() => {
|
|
|
16732
16861
|
});
|
|
16733
16862
|
|
|
16734
16863
|
// src/dev/reactComponentClassifier.ts
|
|
16735
|
-
import { resolve as
|
|
16864
|
+
import { resolve as resolve31 } from "path";
|
|
16736
16865
|
var classifyComponent = (filePath) => {
|
|
16737
|
-
const normalizedPath =
|
|
16866
|
+
const normalizedPath = resolve31(filePath);
|
|
16738
16867
|
if (normalizedPath.includes("/react/pages/")) {
|
|
16739
16868
|
return "server";
|
|
16740
16869
|
}
|
|
@@ -16746,7 +16875,7 @@ var classifyComponent = (filePath) => {
|
|
|
16746
16875
|
var init_reactComponentClassifier = () => {};
|
|
16747
16876
|
|
|
16748
16877
|
// src/dev/moduleMapper.ts
|
|
16749
|
-
import { basename as basename10, resolve as
|
|
16878
|
+
import { basename as basename10, resolve as resolve32 } from "path";
|
|
16750
16879
|
var buildModulePaths = (moduleKeys, manifest) => {
|
|
16751
16880
|
const modulePaths = {};
|
|
16752
16881
|
moduleKeys.forEach((key) => {
|
|
@@ -16756,7 +16885,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
16756
16885
|
});
|
|
16757
16886
|
return modulePaths;
|
|
16758
16887
|
}, processChangedFile = (sourceFile, framework, manifest, resolvedPaths, processedFiles) => {
|
|
16759
|
-
const normalizedFile =
|
|
16888
|
+
const normalizedFile = resolve32(sourceFile);
|
|
16760
16889
|
const normalizedPath = normalizedFile.replace(/\\/g, "/");
|
|
16761
16890
|
if (processedFiles.has(normalizedFile)) {
|
|
16762
16891
|
return null;
|
|
@@ -16792,7 +16921,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
16792
16921
|
});
|
|
16793
16922
|
return grouped;
|
|
16794
16923
|
}, mapSourceFileToManifestKeys = (sourceFile, framework, resolvedPaths) => {
|
|
16795
|
-
const normalizedFile =
|
|
16924
|
+
const normalizedFile = resolve32(sourceFile);
|
|
16796
16925
|
const fileName = basename10(normalizedFile);
|
|
16797
16926
|
const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|css|html)$/, "");
|
|
16798
16927
|
const pascalName = toPascal(baseName);
|
|
@@ -16967,7 +17096,7 @@ __export(exports_moduleServer, {
|
|
|
16967
17096
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
16968
17097
|
});
|
|
16969
17098
|
import { existsSync as existsSync25, readFileSync as readFileSync18, statSync as statSync2 } from "fs";
|
|
16970
|
-
import { basename as basename11, dirname as
|
|
17099
|
+
import { basename as basename11, dirname as dirname18, extname as extname8, join as join29, resolve as resolve33, relative as relative13 } from "path";
|
|
16971
17100
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
16972
17101
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
16973
17102
|
const allExports = [];
|
|
@@ -16987,7 +17116,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
|
|
|
16987
17116
|
${stubs}
|
|
16988
17117
|
`;
|
|
16989
17118
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
16990
|
-
const found = extensions.find((ext) => existsSync25(
|
|
17119
|
+
const found = extensions.find((ext) => existsSync25(resolve33(projectRoot, srcPath + ext)));
|
|
16991
17120
|
return found ? srcPath + found : srcPath;
|
|
16992
17121
|
}, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
16993
17122
|
const entries = Object.entries(vendorPaths).sort(([a], [b2]) => b2.length - a.length);
|
|
@@ -17002,7 +17131,7 @@ ${stubs}
|
|
|
17002
17131
|
return invalidationVersion > 0 ? `${mtime}.${invalidationVersion}` : `${mtime}`;
|
|
17003
17132
|
}, srcUrl = (relPath, projectRoot) => {
|
|
17004
17133
|
const base = `${SRC_PREFIX}${relPath.replace(/\\/g, "/")}`;
|
|
17005
|
-
const absPath =
|
|
17134
|
+
const absPath = resolve33(projectRoot, relPath);
|
|
17006
17135
|
const cached = mtimeCache.get(absPath);
|
|
17007
17136
|
if (cached !== undefined)
|
|
17008
17137
|
return `${base}?v=${buildVersion(cached, absPath)}`;
|
|
@@ -17014,12 +17143,12 @@ ${stubs}
|
|
|
17014
17143
|
return base;
|
|
17015
17144
|
}
|
|
17016
17145
|
}, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
|
|
17017
|
-
const absPath =
|
|
17018
|
-
const rel =
|
|
17146
|
+
const absPath = resolve33(fileDir, relPath);
|
|
17147
|
+
const rel = relative13(projectRoot, absPath);
|
|
17019
17148
|
const extension = extname8(rel);
|
|
17020
17149
|
let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
|
|
17021
17150
|
if (extname8(srcPath) === ".svelte") {
|
|
17022
|
-
srcPath =
|
|
17151
|
+
srcPath = relative13(projectRoot, resolveSvelteModulePath(resolve33(projectRoot, srcPath)));
|
|
17023
17152
|
}
|
|
17024
17153
|
return srcUrl(srcPath, projectRoot);
|
|
17025
17154
|
}, NODE_BUILTIN_RE, resolveAbsoluteSpecifier = (specifier, projectRoot) => {
|
|
@@ -17031,27 +17160,27 @@ ${stubs}
|
|
|
17031
17160
|
"import"
|
|
17032
17161
|
]);
|
|
17033
17162
|
if (fromExports)
|
|
17034
|
-
return
|
|
17163
|
+
return relative13(projectRoot, fromExports);
|
|
17035
17164
|
try {
|
|
17036
17165
|
const isScoped = specifier.startsWith("@");
|
|
17037
17166
|
const parts = specifier.split("/");
|
|
17038
17167
|
const packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];
|
|
17039
17168
|
const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
|
|
17040
17169
|
if (!subpath) {
|
|
17041
|
-
const pkgDir =
|
|
17042
|
-
const pkgJsonPath =
|
|
17170
|
+
const pkgDir = resolve33(projectRoot, "node_modules", packageName ?? "");
|
|
17171
|
+
const pkgJsonPath = join29(pkgDir, "package.json");
|
|
17043
17172
|
if (existsSync25(pkgJsonPath)) {
|
|
17044
17173
|
const pkg = JSON.parse(readFileSync18(pkgJsonPath, "utf-8"));
|
|
17045
17174
|
const esmEntry = typeof pkg.module === "string" && pkg.module || typeof pkg.browser === "string" && pkg.browser;
|
|
17046
17175
|
if (esmEntry) {
|
|
17047
|
-
const resolved =
|
|
17176
|
+
const resolved = resolve33(pkgDir, esmEntry);
|
|
17048
17177
|
if (existsSync25(resolved))
|
|
17049
|
-
return
|
|
17178
|
+
return relative13(projectRoot, resolved);
|
|
17050
17179
|
}
|
|
17051
17180
|
}
|
|
17052
17181
|
}
|
|
17053
17182
|
} catch {}
|
|
17054
|
-
return
|
|
17183
|
+
return relative13(projectRoot, Bun.resolveSync(specifier, projectRoot));
|
|
17055
17184
|
} catch {
|
|
17056
17185
|
return;
|
|
17057
17186
|
}
|
|
@@ -17076,28 +17205,28 @@ ${stubs}
|
|
|
17076
17205
|
};
|
|
17077
17206
|
result = result.replace(/^((?:import\s+[\s\S]+?\s+from|export\s+[\s\S]+?\s+from|import)\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
|
|
17078
17207
|
result = result.replace(/(import\s*\(\s*["'])([^"'./][^"']*)(["']\s*\))/g, stubReplace);
|
|
17079
|
-
const fileDir =
|
|
17208
|
+
const fileDir = dirname18(filePath);
|
|
17080
17209
|
result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
17081
17210
|
result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
17082
17211
|
result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}`);
|
|
17083
17212
|
const rewriteAbsoluteToSrc = (_match, prefix, absPath, _ext, suffix) => {
|
|
17084
17213
|
if (absPath.startsWith(projectRoot)) {
|
|
17085
|
-
const rel2 =
|
|
17214
|
+
const rel2 = relative13(projectRoot, absPath).replace(/\\/g, "/");
|
|
17086
17215
|
return `${prefix}${srcUrl(rel2, projectRoot)}${suffix}`;
|
|
17087
17216
|
}
|
|
17088
|
-
const rel =
|
|
17217
|
+
const rel = relative13(projectRoot, absPath).replace(/\\/g, "/");
|
|
17089
17218
|
return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
|
|
17090
17219
|
};
|
|
17091
17220
|
result = result.replace(/((?:from|import)\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["'])/g, rewriteAbsoluteToSrc);
|
|
17092
17221
|
result = result.replace(/(import\s*\(\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["']\s*\))/g, rewriteAbsoluteToSrc);
|
|
17093
17222
|
result = result.replace(/new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g, (_match, relPath) => {
|
|
17094
|
-
const absPath =
|
|
17095
|
-
const rel =
|
|
17223
|
+
const absPath = resolve33(fileDir, relPath);
|
|
17224
|
+
const rel = relative13(projectRoot, absPath);
|
|
17096
17225
|
return `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;
|
|
17097
17226
|
});
|
|
17098
17227
|
result = result.replace(/import\.meta\.resolve\(\s*["'](\.\.?\/[^"']+)["']\s*\)/g, (_match, relPath) => {
|
|
17099
|
-
const absPath =
|
|
17100
|
-
const rel =
|
|
17228
|
+
const absPath = resolve33(fileDir, relPath);
|
|
17229
|
+
const rel = relative13(projectRoot, absPath);
|
|
17101
17230
|
return `'${srcUrl(rel, projectRoot)}'`;
|
|
17102
17231
|
});
|
|
17103
17232
|
return result;
|
|
@@ -17153,7 +17282,7 @@ ${code}`;
|
|
|
17153
17282
|
transpiled = `var $RefreshReg$ = window.$RefreshReg$ || function(){};
|
|
17154
17283
|
` + `var $RefreshSig$ = window.$RefreshSig$ || function(){ return function(t){ return t; }; };
|
|
17155
17284
|
${transpiled}`;
|
|
17156
|
-
const relPath =
|
|
17285
|
+
const relPath = relative13(projectRoot, filePath).replace(/\\/g, "/");
|
|
17157
17286
|
transpiled = transpiled.replace(/\binput\.tsx:/g, `${relPath}:`);
|
|
17158
17287
|
transpiled += buildIslandMetadataExports(raw);
|
|
17159
17288
|
return rewriteImports(transpiled, filePath, projectRoot, rewriter);
|
|
@@ -17162,13 +17291,13 @@ ${transpiled}`;
|
|
|
17162
17291
|
const ext = extname8(filePath);
|
|
17163
17292
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
17164
17293
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
17165
|
-
let
|
|
17294
|
+
let transpiler6 = jsTranspiler2;
|
|
17166
17295
|
if (isTSX)
|
|
17167
|
-
|
|
17296
|
+
transpiler6 = tsxTranspiler;
|
|
17168
17297
|
else if (isTS)
|
|
17169
|
-
|
|
17170
|
-
const valueExports = isTS ?
|
|
17171
|
-
let transpiled =
|
|
17298
|
+
transpiler6 = tsTranspiler2;
|
|
17299
|
+
const valueExports = isTS ? transpiler6.scan(raw).exports : [];
|
|
17300
|
+
let transpiled = transpiler6.transformSync(raw);
|
|
17172
17301
|
if (isTS) {
|
|
17173
17302
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
17174
17303
|
}
|
|
@@ -17314,11 +17443,11 @@ ${code}`;
|
|
|
17314
17443
|
if (compiled.css?.code) {
|
|
17315
17444
|
const cssPath = `${filePath}.css`;
|
|
17316
17445
|
svelteExternalCss.set(cssPath, compiled.css.code);
|
|
17317
|
-
const cssUrl = srcUrl(
|
|
17446
|
+
const cssUrl = srcUrl(relative13(projectRoot, cssPath), projectRoot);
|
|
17318
17447
|
code = `import "${cssUrl}";
|
|
17319
17448
|
${code}`;
|
|
17320
17449
|
}
|
|
17321
|
-
const moduleUrl = `${SRC_PREFIX}${
|
|
17450
|
+
const moduleUrl = `${SRC_PREFIX}${relative13(projectRoot, filePath).replace(/\\/g, "/")}`;
|
|
17322
17451
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
17323
17452
|
` + ` if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
17324
17453
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
@@ -17344,6 +17473,8 @@ ${code}`;
|
|
|
17344
17473
|
const templateResult = compiler.compileTemplate({
|
|
17345
17474
|
compilerOptions: {
|
|
17346
17475
|
bindingMetadata: compiledScript.bindings,
|
|
17476
|
+
expressionPlugins: ["typescript"],
|
|
17477
|
+
isCustomElement: (tag) => tag === "absolute-island",
|
|
17347
17478
|
prefixIdentifiers: true
|
|
17348
17479
|
},
|
|
17349
17480
|
filename: filePath,
|
|
@@ -17407,8 +17538,8 @@ ${code}`;
|
|
|
17407
17538
|
code = injectVueHmr(code, filePath, projectRoot, vueDir);
|
|
17408
17539
|
return rewriteImports(code, filePath, projectRoot, rewriter);
|
|
17409
17540
|
}, injectVueHmr = (code, filePath, projectRoot, vueDir) => {
|
|
17410
|
-
const hmrBase = vueDir ?
|
|
17411
|
-
const hmrId =
|
|
17541
|
+
const hmrBase = vueDir ? resolve33(vueDir) : projectRoot;
|
|
17542
|
+
const hmrId = relative13(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
|
|
17412
17543
|
let result = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
|
|
17413
17544
|
result += [
|
|
17414
17545
|
"",
|
|
@@ -17571,7 +17702,7 @@ export default {};
|
|
|
17571
17702
|
const escaped = virtualCss.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
17572
17703
|
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
17704
|
}, resolveSourcePath = (relPath, projectRoot) => {
|
|
17574
|
-
const filePath =
|
|
17705
|
+
const filePath = resolve33(projectRoot, relPath);
|
|
17575
17706
|
const ext = extname8(filePath);
|
|
17576
17707
|
if (ext === ".svelte")
|
|
17577
17708
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
@@ -17598,7 +17729,7 @@ export default {};
|
|
|
17598
17729
|
if (!TRANSPILABLE.has(ext))
|
|
17599
17730
|
return;
|
|
17600
17731
|
const stat3 = statSync2(filePath);
|
|
17601
|
-
const resolvedVueDir = vueDir ?
|
|
17732
|
+
const resolvedVueDir = vueDir ? resolve33(vueDir) : undefined;
|
|
17602
17733
|
let content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
|
|
17603
17734
|
const isComponentJs = ext === ".js" && filePath.endsWith(".component.js") && filePath.replace(/\\/g, "/").includes("/.absolutejs/generated/angular/");
|
|
17604
17735
|
if (isComponentJs) {
|
|
@@ -17657,7 +17788,7 @@ export default {};
|
|
|
17657
17788
|
const relPath = pathname.slice(SRC_PREFIX.length);
|
|
17658
17789
|
if (relPath === "bun:wrap" || relPath.startsWith("bun:wrap?"))
|
|
17659
17790
|
return handleBunWrapRequest();
|
|
17660
|
-
const virtualCssResponse = handleVirtualSvelteCss(
|
|
17791
|
+
const virtualCssResponse = handleVirtualSvelteCss(resolve33(projectRoot, relPath));
|
|
17661
17792
|
if (virtualCssResponse)
|
|
17662
17793
|
return virtualCssResponse;
|
|
17663
17794
|
const { filePath, ext } = resolveSourcePath(relPath, projectRoot);
|
|
@@ -17673,11 +17804,11 @@ export default {};
|
|
|
17673
17804
|
SRC_IMPORT_RE.lastIndex = 0;
|
|
17674
17805
|
while ((match = SRC_IMPORT_RE.exec(content)) !== null) {
|
|
17675
17806
|
if (match[1])
|
|
17676
|
-
files.push(
|
|
17807
|
+
files.push(resolve33(projectRoot, match[1]));
|
|
17677
17808
|
}
|
|
17678
17809
|
return files;
|
|
17679
17810
|
}, invalidateModule = (filePath) => {
|
|
17680
|
-
const resolved =
|
|
17811
|
+
const resolved = resolve33(filePath);
|
|
17681
17812
|
invalidate(filePath);
|
|
17682
17813
|
if (resolved !== filePath)
|
|
17683
17814
|
invalidate(resolved);
|
|
@@ -17824,7 +17955,7 @@ __export(exports_resolveOwningComponents, {
|
|
|
17824
17955
|
invalidateResourceIndex: () => invalidateResourceIndex
|
|
17825
17956
|
});
|
|
17826
17957
|
import { readdirSync as readdirSync2, readFileSync as readFileSync19, statSync as statSync3 } from "fs";
|
|
17827
|
-
import { dirname as
|
|
17958
|
+
import { dirname as dirname19, extname as extname9, join as join30, resolve as resolve34 } from "path";
|
|
17828
17959
|
import ts3 from "typescript";
|
|
17829
17960
|
var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") || file5.endsWith(".tsx"), walkAngularSourceFiles = (root) => {
|
|
17830
17961
|
const out = [];
|
|
@@ -17839,7 +17970,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
17839
17970
|
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
17840
17971
|
continue;
|
|
17841
17972
|
}
|
|
17842
|
-
const full =
|
|
17973
|
+
const full = join30(dir, entry.name);
|
|
17843
17974
|
if (entry.isDirectory()) {
|
|
17844
17975
|
visit(full);
|
|
17845
17976
|
} else if (entry.isFile() && isAngularSourceFile(entry.name)) {
|
|
@@ -17937,7 +18068,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
17937
18068
|
};
|
|
17938
18069
|
visit(sourceFile);
|
|
17939
18070
|
return out;
|
|
17940
|
-
}, safeNormalize = (path) =>
|
|
18071
|
+
}, safeNormalize = (path) => resolve34(path).replace(/\\/g, "/"), resolveOwningComponents = (params) => {
|
|
17941
18072
|
const { changedFilePath, userAngularRoot } = params;
|
|
17942
18073
|
const changedAbs = safeNormalize(changedFilePath);
|
|
17943
18074
|
const out = [];
|
|
@@ -17978,7 +18109,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
17978
18109
|
return null;
|
|
17979
18110
|
}
|
|
17980
18111
|
const sf = ts3.createSourceFile(childFilePath, source, ts3.ScriptTarget.ES2022, true, ts3.ScriptKind.TS);
|
|
17981
|
-
const childDir =
|
|
18112
|
+
const childDir = dirname19(childFilePath);
|
|
17982
18113
|
for (const stmt of sf.statements) {
|
|
17983
18114
|
if (!ts3.isImportDeclaration(stmt))
|
|
17984
18115
|
continue;
|
|
@@ -18006,7 +18137,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
18006
18137
|
if (!spec.startsWith(".") && !spec.startsWith("/")) {
|
|
18007
18138
|
return null;
|
|
18008
18139
|
}
|
|
18009
|
-
const base =
|
|
18140
|
+
const base = resolve34(childDir, spec);
|
|
18010
18141
|
const candidates = [
|
|
18011
18142
|
`${base}.ts`,
|
|
18012
18143
|
`${base}.tsx`,
|
|
@@ -18035,7 +18166,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
18035
18166
|
const parentFile = new Map;
|
|
18036
18167
|
for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
|
|
18037
18168
|
const classes = parseDecoratedClasses(tsPath);
|
|
18038
|
-
const componentDir =
|
|
18169
|
+
const componentDir = dirname19(tsPath);
|
|
18039
18170
|
for (const cls of classes) {
|
|
18040
18171
|
const entity = {
|
|
18041
18172
|
className: cls.className,
|
|
@@ -18044,7 +18175,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
18044
18175
|
};
|
|
18045
18176
|
if (cls.kind === "component") {
|
|
18046
18177
|
for (const url of [...cls.templateUrls, ...cls.styleUrls]) {
|
|
18047
|
-
const abs = safeNormalize(
|
|
18178
|
+
const abs = safeNormalize(resolve34(componentDir, url));
|
|
18048
18179
|
const existing = resource.get(abs);
|
|
18049
18180
|
if (existing)
|
|
18050
18181
|
existing.push(entity);
|
|
@@ -18124,8 +18255,6 @@ class Context {
|
|
|
18124
18255
|
}
|
|
18125
18256
|
|
|
18126
18257
|
// src/dev/angular/vendor/translator/translator.ts
|
|
18127
|
-
import * as o from "@angular/compiler";
|
|
18128
|
-
|
|
18129
18258
|
class ExpressionTranslatorVisitor {
|
|
18130
18259
|
factory;
|
|
18131
18260
|
imports;
|
|
@@ -18181,7 +18310,9 @@ class ExpressionTranslatorVisitor {
|
|
|
18181
18310
|
return this.setSourceMapRange(this.factory.createRegularExpressionLiteral(ast.body, ast.flags), ast.sourceSpan);
|
|
18182
18311
|
}
|
|
18183
18312
|
visitLocalizedString(ast, context) {
|
|
18184
|
-
const elements = [
|
|
18313
|
+
const elements = [
|
|
18314
|
+
createTemplateElement(ast.serializeI18nHead())
|
|
18315
|
+
];
|
|
18185
18316
|
const expressions = [];
|
|
18186
18317
|
for (let i = 0;i < ast.expressions.length; i++) {
|
|
18187
18318
|
const placeholder = this.setSourceMapRange(ast.expressions[i].visitExpression(this, context), ast.getPlaceholderSourceSpan(i));
|
|
@@ -18189,7 +18320,10 @@ class ExpressionTranslatorVisitor {
|
|
|
18189
18320
|
elements.push(createTemplateElement(ast.serializeI18nTemplatePart(i + 1)));
|
|
18190
18321
|
}
|
|
18191
18322
|
const localizeTag = this.factory.createIdentifier("$localize");
|
|
18192
|
-
return this.setSourceMapRange(this.createTaggedTemplateExpression(localizeTag, {
|
|
18323
|
+
return this.setSourceMapRange(this.createTaggedTemplateExpression(localizeTag, {
|
|
18324
|
+
elements,
|
|
18325
|
+
expressions
|
|
18326
|
+
}), ast.sourceSpan);
|
|
18193
18327
|
}
|
|
18194
18328
|
visitBuiltinType(ast) {
|
|
18195
18329
|
let builtInType;
|
|
@@ -18246,7 +18380,10 @@ class ExpressionTranslatorVisitor {
|
|
|
18246
18380
|
cooked.push(this.factory.setSourceMapRange(this.factory.createLiteral(element.cooked), element.range));
|
|
18247
18381
|
raw.push(this.factory.setSourceMapRange(this.factory.createLiteral(element.raw), element.range));
|
|
18248
18382
|
}
|
|
18249
|
-
const templateHelperCall = this.factory.createCallExpression(__makeTemplateObjectHelper, [
|
|
18383
|
+
const templateHelperCall = this.factory.createCallExpression(__makeTemplateObjectHelper, [
|
|
18384
|
+
this.factory.createArrayLiteral(cooked),
|
|
18385
|
+
this.factory.createArrayLiteral(raw)
|
|
18386
|
+
], false);
|
|
18250
18387
|
return this.factory.createCallExpression(tagHandler, [templateHelperCall, ...expressions], false);
|
|
18251
18388
|
}
|
|
18252
18389
|
visitExternalExpr(ast, _context) {
|
|
@@ -18276,7 +18413,9 @@ class ExpressionTranslatorVisitor {
|
|
|
18276
18413
|
visitDynamicImportExpr(ast, context) {
|
|
18277
18414
|
const urlExpression = typeof ast.url === "string" ? this.factory.createLiteral(ast.url) : ast.url.visitExpression(this, context);
|
|
18278
18415
|
if (ast.urlComment) {
|
|
18279
|
-
this.factory.attachComments(urlExpression, [
|
|
18416
|
+
this.factory.attachComments(urlExpression, [
|
|
18417
|
+
o.leadingComment(ast.urlComment, true)
|
|
18418
|
+
]);
|
|
18280
18419
|
}
|
|
18281
18420
|
return this.factory.createDynamicImport(urlExpression);
|
|
18282
18421
|
}
|
|
@@ -18416,8 +18555,16 @@ function createRange(span) {
|
|
|
18416
18555
|
end: { offset: end.offset, line: end.line, column: end.col }
|
|
18417
18556
|
};
|
|
18418
18557
|
}
|
|
18419
|
-
var UNARY_OPERATORS, BINARY_OPERATORS;
|
|
18558
|
+
var o, UNARY_OPERATORS, BINARY_OPERATORS;
|
|
18420
18559
|
var init_translator = __esm(() => {
|
|
18560
|
+
o = (() => {
|
|
18561
|
+
try {
|
|
18562
|
+
return __require("@angular/compiler");
|
|
18563
|
+
} catch {
|
|
18564
|
+
const stub = new Proxy(function() {}, { apply: () => stub, construct: () => stub, get: () => stub });
|
|
18565
|
+
return stub;
|
|
18566
|
+
}
|
|
18567
|
+
})();
|
|
18421
18568
|
UNARY_OPERATORS = /* @__PURE__ */ new Map([
|
|
18422
18569
|
[o.UnaryOperator.Minus, "-"],
|
|
18423
18570
|
[o.UnaryOperator.Plus, "+"]
|
|
@@ -18552,7 +18699,9 @@ class TypeScriptAstFactory {
|
|
|
18552
18699
|
createElementAccess = ts6.factory.createElementAccessExpression;
|
|
18553
18700
|
createExpressionStatement = ts6.factory.createExpressionStatement;
|
|
18554
18701
|
createDynamicImport(url) {
|
|
18555
|
-
return ts6.factory.createCallExpression(ts6.factory.createToken(ts6.SyntaxKind.ImportKeyword), undefined, [
|
|
18702
|
+
return ts6.factory.createCallExpression(ts6.factory.createToken(ts6.SyntaxKind.ImportKeyword), undefined, [
|
|
18703
|
+
typeof url === "string" ? ts6.factory.createStringLiteral(url) : url
|
|
18704
|
+
]);
|
|
18556
18705
|
}
|
|
18557
18706
|
createFunctionDeclaration(functionName, parameters, body) {
|
|
18558
18707
|
if (!ts6.isBlock(body)) {
|
|
@@ -18755,9 +18904,18 @@ var init_typescript_ast_factory = __esm(() => {
|
|
|
18755
18904
|
function translateStatement(contextFile, statement, imports, options = {}) {
|
|
18756
18905
|
return statement.visitStatement(new ExpressionTranslatorVisitor(new TypeScriptAstFactory(options.annotateForClosureCompiler === true), imports, contextFile, options), new Context(true));
|
|
18757
18906
|
}
|
|
18907
|
+
var o2;
|
|
18758
18908
|
var init_typescript_translator = __esm(() => {
|
|
18759
18909
|
init_translator();
|
|
18760
18910
|
init_typescript_ast_factory();
|
|
18911
|
+
o2 = (() => {
|
|
18912
|
+
try {
|
|
18913
|
+
return __require("@angular/compiler");
|
|
18914
|
+
} catch {
|
|
18915
|
+
const stub = new Proxy(function() {}, { apply: () => stub, construct: () => stub, get: () => stub });
|
|
18916
|
+
return stub;
|
|
18917
|
+
}
|
|
18918
|
+
})();
|
|
18761
18919
|
});
|
|
18762
18920
|
|
|
18763
18921
|
// src/dev/angular/fastHmrCompiler.ts
|
|
@@ -18769,7 +18927,7 @@ __export(exports_fastHmrCompiler, {
|
|
|
18769
18927
|
invalidateFingerprintCache: () => invalidateFingerprintCache
|
|
18770
18928
|
});
|
|
18771
18929
|
import { existsSync as existsSync26, readFileSync as readFileSync20, statSync as statSync4 } from "fs";
|
|
18772
|
-
import { dirname as
|
|
18930
|
+
import { dirname as dirname20, extname as extname10, relative as relative14, resolve as resolve35 } from "path";
|
|
18773
18931
|
import ts7 from "typescript";
|
|
18774
18932
|
var fail = (reason, detail, location) => ({
|
|
18775
18933
|
ok: false,
|
|
@@ -18991,7 +19149,7 @@ var fail = (reason, detail, location) => ({
|
|
|
18991
19149
|
if (!spec.startsWith(".") && !spec.startsWith("/")) {
|
|
18992
19150
|
return true;
|
|
18993
19151
|
}
|
|
18994
|
-
const base =
|
|
19152
|
+
const base = resolve35(componentDir, spec);
|
|
18995
19153
|
const candidates = [
|
|
18996
19154
|
`${base}.ts`,
|
|
18997
19155
|
`${base}.tsx`,
|
|
@@ -19566,7 +19724,10 @@ var fail = (reason, detail, location) => ({
|
|
|
19566
19724
|
try {
|
|
19567
19725
|
source = readFileSync20(filePath, "utf-8");
|
|
19568
19726
|
} catch {
|
|
19569
|
-
childComponentInfoCache.set(cacheKey2, {
|
|
19727
|
+
childComponentInfoCache.set(cacheKey2, {
|
|
19728
|
+
info: null,
|
|
19729
|
+
mtimeMs: stat3.mtimeMs
|
|
19730
|
+
});
|
|
19570
19731
|
return null;
|
|
19571
19732
|
}
|
|
19572
19733
|
const sf = ts7.createSourceFile(filePath, source, ts7.ScriptTarget.Latest, true);
|
|
@@ -19754,7 +19915,7 @@ var fail = (reason, detail, location) => ({
|
|
|
19754
19915
|
});
|
|
19755
19916
|
if (!names.includes(className))
|
|
19756
19917
|
continue;
|
|
19757
|
-
const nextDts = resolveDtsFromSpec(fromPath,
|
|
19918
|
+
const nextDts = resolveDtsFromSpec(fromPath, dirname20(startDtsPath));
|
|
19758
19919
|
if (!nextDts)
|
|
19759
19920
|
continue;
|
|
19760
19921
|
const found = findDtsContainingClass(nextDts, className, visited);
|
|
@@ -19764,7 +19925,7 @@ var fail = (reason, detail, location) => ({
|
|
|
19764
19925
|
const starReExportRe = /export\s*\*\s*from\s*["']([^"']+)["']/g;
|
|
19765
19926
|
while ((m = starReExportRe.exec(content)) !== null) {
|
|
19766
19927
|
const fromPath = m[1] || "";
|
|
19767
|
-
const nextDts = resolveDtsFromSpec(fromPath,
|
|
19928
|
+
const nextDts = resolveDtsFromSpec(fromPath, dirname20(startDtsPath));
|
|
19768
19929
|
if (!nextDts)
|
|
19769
19930
|
continue;
|
|
19770
19931
|
const found = findDtsContainingClass(nextDts, className, visited);
|
|
@@ -19774,7 +19935,7 @@ var fail = (reason, detail, location) => ({
|
|
|
19774
19935
|
return null;
|
|
19775
19936
|
}, resolveDtsFromSpec = (spec, fromDir) => {
|
|
19776
19937
|
const stripped = spec.replace(/\.[mc]?js$/, "");
|
|
19777
|
-
const base =
|
|
19938
|
+
const base = resolve35(fromDir, stripped);
|
|
19778
19939
|
const candidates = [
|
|
19779
19940
|
`${base}.d.ts`,
|
|
19780
19941
|
`${base}.d.mts`,
|
|
@@ -19798,7 +19959,7 @@ var fail = (reason, detail, location) => ({
|
|
|
19798
19959
|
return null;
|
|
19799
19960
|
}, resolveChildComponentInfo = (className, spec, componentDir, projectRoot) => {
|
|
19800
19961
|
if (spec.startsWith(".") || spec.startsWith("/")) {
|
|
19801
|
-
const base =
|
|
19962
|
+
const base = resolve35(componentDir, spec);
|
|
19802
19963
|
const candidates = [
|
|
19803
19964
|
`${base}.ts`,
|
|
19804
19965
|
`${base}.tsx`,
|
|
@@ -19968,13 +20129,13 @@ var fail = (reason, detail, location) => ({
|
|
|
19968
20129
|
}
|
|
19969
20130
|
if (!matches)
|
|
19970
20131
|
continue;
|
|
19971
|
-
const resolved =
|
|
20132
|
+
const resolved = resolve35(componentDir, spec);
|
|
19972
20133
|
for (const ext of TS_EXTENSIONS) {
|
|
19973
20134
|
const candidate = resolved + ext;
|
|
19974
20135
|
if (existsSync26(candidate))
|
|
19975
20136
|
return candidate;
|
|
19976
20137
|
}
|
|
19977
|
-
const indexCandidate =
|
|
20138
|
+
const indexCandidate = resolve35(resolved, "index.ts");
|
|
19978
20139
|
if (existsSync26(indexCandidate))
|
|
19979
20140
|
return indexCandidate;
|
|
19980
20141
|
}
|
|
@@ -20161,7 +20322,7 @@ ${transpiled}
|
|
|
20161
20322
|
}
|
|
20162
20323
|
}${staticPatch}`;
|
|
20163
20324
|
}, STYLE_PREPROCESSED_EXT, resolveAndReadStyleResource = (componentDir, url) => {
|
|
20164
|
-
const abs =
|
|
20325
|
+
const abs = resolve35(componentDir, url);
|
|
20165
20326
|
if (!existsSync26(abs))
|
|
20166
20327
|
return null;
|
|
20167
20328
|
const ext = extname10(abs).toLowerCase();
|
|
@@ -20201,7 +20362,7 @@ ${block}
|
|
|
20201
20362
|
const cached = projectOptionsCache.get(projectRoot);
|
|
20202
20363
|
if (cached !== undefined)
|
|
20203
20364
|
return cached;
|
|
20204
|
-
const tsconfigPath =
|
|
20365
|
+
const tsconfigPath = resolve35(projectRoot, "tsconfig.json");
|
|
20205
20366
|
const opts = {};
|
|
20206
20367
|
if (existsSync26(tsconfigPath)) {
|
|
20207
20368
|
try {
|
|
@@ -20247,7 +20408,7 @@ ${block}
|
|
|
20247
20408
|
}
|
|
20248
20409
|
const kind = params.kind ?? "component";
|
|
20249
20410
|
if (kind !== "component") {
|
|
20250
|
-
const entityId = encodeURIComponent(`${
|
|
20411
|
+
const entityId = encodeURIComponent(`${relative14(projectRoot, componentFilePath).replace(/\\/g, "/")}@${className}`);
|
|
20251
20412
|
const currentEntityFingerprint = extractEntityFingerprint(classNode, className, sourceFile);
|
|
20252
20413
|
const cachedEntityFingerprint = entityFingerprintCache.get(entityId);
|
|
20253
20414
|
if (cachedEntityFingerprint !== undefined && !entityFingerprintsEqual(cachedEntityFingerprint, currentEntityFingerprint)) {
|
|
@@ -20265,7 +20426,7 @@ ${block}
|
|
|
20265
20426
|
ok: true
|
|
20266
20427
|
};
|
|
20267
20428
|
}
|
|
20268
|
-
if (inheritsDecoratedClass(classNode, sourceFile,
|
|
20429
|
+
if (inheritsDecoratedClass(classNode, sourceFile, dirname20(componentFilePath), projectRoot)) {
|
|
20269
20430
|
return fail("inherits-decorated-class");
|
|
20270
20431
|
}
|
|
20271
20432
|
const decorator = findComponentDecorator(classNode);
|
|
@@ -20277,14 +20438,14 @@ ${block}
|
|
|
20277
20438
|
const projectDefaults = readProjectAngularCompilerOptions(projectRoot);
|
|
20278
20439
|
const decoratorMeta = readDecoratorMeta(decoratorArgs, projectDefaults);
|
|
20279
20440
|
const advancedMetadata = extractAdvancedMetadata(classNode, decoratorArgs, compiler);
|
|
20280
|
-
const componentDir =
|
|
20441
|
+
const componentDir = dirname20(componentFilePath);
|
|
20281
20442
|
let templateText;
|
|
20282
20443
|
let templatePath;
|
|
20283
20444
|
if (decoratorMeta.template !== null) {
|
|
20284
20445
|
templateText = decoratorMeta.template;
|
|
20285
20446
|
templatePath = componentFilePath;
|
|
20286
20447
|
} else if (decoratorMeta.templateUrl) {
|
|
20287
|
-
const tplAbs =
|
|
20448
|
+
const tplAbs = resolve35(componentDir, decoratorMeta.templateUrl);
|
|
20288
20449
|
if (!existsSync26(tplAbs)) {
|
|
20289
20450
|
return fail("template-resource-not-found", `Template file not found: ${tplAbs}`, { file: componentFilePath });
|
|
20290
20451
|
}
|
|
@@ -20329,13 +20490,8 @@ ${block}
|
|
|
20329
20490
|
if (!className_)
|
|
20330
20491
|
return fail("class-not-found", "anonymous class");
|
|
20331
20492
|
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, "/");
|
|
20493
|
+
const { inputs, outputs, hasDecoratorIO, hasSignalIO } = extractInputsAndOutputs(classNode, compiler);
|
|
20494
|
+
const projectRelPath = relative14(projectRoot, componentFilePath).replace(/\\/g, "/");
|
|
20339
20495
|
const fingerprintId = encodeURIComponent(`${projectRelPath}@${className}`);
|
|
20340
20496
|
const currentFingerprint = extractFingerprint(classNode, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
|
|
20341
20497
|
const cachedFingerprint = fingerprintCache.get(fingerprintId);
|
|
@@ -20538,11 +20694,7 @@ var init_fastHmrCompiler = __esm(() => {
|
|
|
20538
20694
|
fingerprintCache = new Map;
|
|
20539
20695
|
pendingModuleCache = new Map;
|
|
20540
20696
|
entityFingerprintCache = new Map;
|
|
20541
|
-
ENTITY_DECORATOR_NAMES = new Set([
|
|
20542
|
-
"Pipe",
|
|
20543
|
-
"Directive",
|
|
20544
|
-
"Injectable"
|
|
20545
|
-
]);
|
|
20697
|
+
ENTITY_DECORATOR_NAMES = new Set(["Pipe", "Directive", "Injectable"]);
|
|
20546
20698
|
VIEW_ENCAPSULATION_VALUES = {
|
|
20547
20699
|
Emulated: 0,
|
|
20548
20700
|
ExperimentalIsolatedShadowDom: 4,
|
|
@@ -20589,7 +20741,7 @@ __export(exports_hmrCompiler, {
|
|
|
20589
20741
|
getApplyMetadataModule: () => getApplyMetadataModule,
|
|
20590
20742
|
encodeHmrComponentId: () => encodeHmrComponentId
|
|
20591
20743
|
});
|
|
20592
|
-
import { dirname as
|
|
20744
|
+
import { dirname as dirname21, relative as relative15, resolve as resolve36 } from "path";
|
|
20593
20745
|
import { performance as performance2 } from "perf_hooks";
|
|
20594
20746
|
var getApplyMetadataModule = async (encodedId) => {
|
|
20595
20747
|
const decoded = decodeURIComponent(encodedId);
|
|
@@ -20598,8 +20750,8 @@ var getApplyMetadataModule = async (encodedId) => {
|
|
|
20598
20750
|
return null;
|
|
20599
20751
|
const filePathRel = decoded.slice(0, at2);
|
|
20600
20752
|
const className = decoded.slice(at2 + 1);
|
|
20601
|
-
const componentFilePath =
|
|
20602
|
-
const projectRelPath =
|
|
20753
|
+
const componentFilePath = resolve36(process.cwd(), filePathRel);
|
|
20754
|
+
const projectRelPath = relative15(process.cwd(), componentFilePath).replace(/\\/g, "/");
|
|
20603
20755
|
const cacheKey2 = encodeURIComponent(`${projectRelPath}@${className}`);
|
|
20604
20756
|
const { takePendingModule: takePendingModule2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
|
|
20605
20757
|
const cached = takePendingModule2(cacheKey2);
|
|
@@ -20609,9 +20761,9 @@ var getApplyMetadataModule = async (encodedId) => {
|
|
|
20609
20761
|
const { resolveOwningComponents: resolveOwningComponents2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
|
|
20610
20762
|
const owners = resolveOwningComponents2({
|
|
20611
20763
|
changedFilePath: componentFilePath,
|
|
20612
|
-
userAngularRoot:
|
|
20764
|
+
userAngularRoot: dirname21(componentFilePath)
|
|
20613
20765
|
});
|
|
20614
|
-
const owner = owners.find((
|
|
20766
|
+
const owner = owners.find((o3) => o3.className === className);
|
|
20615
20767
|
const kind = owner?.kind ?? "component";
|
|
20616
20768
|
const fastStart = performance2.now();
|
|
20617
20769
|
const fast = await tryFastHmr({ className, componentFilePath, kind });
|
|
@@ -20621,7 +20773,7 @@ var getApplyMetadataModule = async (encodedId) => {
|
|
|
20621
20773
|
}
|
|
20622
20774
|
return null;
|
|
20623
20775
|
}, encodeHmrComponentId = (absoluteFilePath, className) => {
|
|
20624
|
-
const projectRel =
|
|
20776
|
+
const projectRel = relative15(process.cwd(), absoluteFilePath).replace(/\\/g, "/");
|
|
20625
20777
|
return `${projectRel}@${className}`;
|
|
20626
20778
|
};
|
|
20627
20779
|
var init_hmrCompiler = __esm(() => {
|
|
@@ -20760,11 +20912,11 @@ var exports_simpleHTMLHMR = {};
|
|
|
20760
20912
|
__export(exports_simpleHTMLHMR, {
|
|
20761
20913
|
handleHTMLUpdate: () => handleHTMLUpdate
|
|
20762
20914
|
});
|
|
20763
|
-
import { resolve as
|
|
20915
|
+
import { resolve as resolve37 } from "path";
|
|
20764
20916
|
var handleHTMLUpdate = async (htmlFilePath) => {
|
|
20765
20917
|
let htmlContent;
|
|
20766
20918
|
try {
|
|
20767
|
-
const resolvedPath =
|
|
20919
|
+
const resolvedPath = resolve37(htmlFilePath);
|
|
20768
20920
|
const file5 = Bun.file(resolvedPath);
|
|
20769
20921
|
if (!await file5.exists()) {
|
|
20770
20922
|
return null;
|
|
@@ -20790,11 +20942,11 @@ var exports_simpleHTMXHMR = {};
|
|
|
20790
20942
|
__export(exports_simpleHTMXHMR, {
|
|
20791
20943
|
handleHTMXUpdate: () => handleHTMXUpdate
|
|
20792
20944
|
});
|
|
20793
|
-
import { resolve as
|
|
20945
|
+
import { resolve as resolve38 } from "path";
|
|
20794
20946
|
var handleHTMXUpdate = async (htmxFilePath) => {
|
|
20795
20947
|
let htmlContent;
|
|
20796
20948
|
try {
|
|
20797
|
-
const resolvedPath =
|
|
20949
|
+
const resolvedPath = resolve38(htmxFilePath);
|
|
20798
20950
|
const file5 = Bun.file(resolvedPath);
|
|
20799
20951
|
if (!await file5.exists()) {
|
|
20800
20952
|
return null;
|
|
@@ -20817,7 +20969,7 @@ var init_simpleHTMXHMR = () => {};
|
|
|
20817
20969
|
|
|
20818
20970
|
// src/dev/rebuildTrigger.ts
|
|
20819
20971
|
import { existsSync as existsSync27 } from "fs";
|
|
20820
|
-
import { basename as basename12, dirname as
|
|
20972
|
+
import { basename as basename12, dirname as dirname22, relative as relative16, resolve as resolve39, sep as sep4 } from "path";
|
|
20821
20973
|
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
20974
|
if (!config.tailwind)
|
|
20823
20975
|
return;
|
|
@@ -20909,7 +21061,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20909
21061
|
state.fileHashes.delete(filePathInSet);
|
|
20910
21062
|
try {
|
|
20911
21063
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, filePathInSet);
|
|
20912
|
-
const deletedPathResolved =
|
|
21064
|
+
const deletedPathResolved = resolve39(filePathInSet);
|
|
20913
21065
|
affectedFiles.forEach((affectedFile) => {
|
|
20914
21066
|
if (isValidDeletedAffectedFile(affectedFile, deletedPathResolved, processedFiles)) {
|
|
20915
21067
|
validFiles.push(affectedFile);
|
|
@@ -20953,7 +21105,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20953
21105
|
if (storedHash !== undefined && storedHash === fileHash) {
|
|
20954
21106
|
return;
|
|
20955
21107
|
}
|
|
20956
|
-
const normalizedFilePath =
|
|
21108
|
+
const normalizedFilePath = resolve39(filePathInSet);
|
|
20957
21109
|
if (!processedFiles.has(normalizedFilePath)) {
|
|
20958
21110
|
validFiles.push(normalizedFilePath);
|
|
20959
21111
|
processedFiles.add(normalizedFilePath);
|
|
@@ -21057,8 +21209,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21057
21209
|
return;
|
|
21058
21210
|
}
|
|
21059
21211
|
if (framework === "unknown") {
|
|
21060
|
-
invalidate(
|
|
21061
|
-
const relPath =
|
|
21212
|
+
invalidate(resolve39(filePath));
|
|
21213
|
+
const relPath = relative16(process.cwd(), filePath);
|
|
21062
21214
|
logHmrUpdate(relPath);
|
|
21063
21215
|
return;
|
|
21064
21216
|
}
|
|
@@ -21084,7 +21236,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21084
21236
|
const userEditedFiles = new Set;
|
|
21085
21237
|
state.fileChangeQueue.forEach((filePaths) => {
|
|
21086
21238
|
for (const filePath2 of filePaths) {
|
|
21087
|
-
userEditedFiles.add(
|
|
21239
|
+
userEditedFiles.add(resolve39(filePath2));
|
|
21088
21240
|
}
|
|
21089
21241
|
});
|
|
21090
21242
|
state.lastUserEditedFiles = userEditedFiles;
|
|
@@ -21113,7 +21265,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21113
21265
|
}
|
|
21114
21266
|
if (!graph)
|
|
21115
21267
|
return componentFile;
|
|
21116
|
-
const dependents = graph.dependents.get(
|
|
21268
|
+
const dependents = graph.dependents.get(resolve39(componentFile));
|
|
21117
21269
|
if (!dependents)
|
|
21118
21270
|
return componentFile;
|
|
21119
21271
|
for (const dep of dependents) {
|
|
@@ -21122,7 +21274,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21122
21274
|
}
|
|
21123
21275
|
return componentFile;
|
|
21124
21276
|
}, resolveAngularPageEntries = (state, angularFiles, angularPagesPath) => {
|
|
21125
|
-
const pageEntries = angularFiles.filter((file5) => file5.endsWith(".ts") &&
|
|
21277
|
+
const pageEntries = angularFiles.filter((file5) => file5.endsWith(".ts") && resolve39(file5).startsWith(angularPagesPath));
|
|
21126
21278
|
if (pageEntries.length > 0 || !state.dependencyGraph) {
|
|
21127
21279
|
return pageEntries;
|
|
21128
21280
|
}
|
|
@@ -21131,7 +21283,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21131
21283
|
const lookupFile = resolveComponentLookupFile(componentFile, state.dependencyGraph);
|
|
21132
21284
|
const affected = getAffectedFiles(state.dependencyGraph, lookupFile);
|
|
21133
21285
|
affected.forEach((file5) => {
|
|
21134
|
-
if (file5.endsWith(".ts") &&
|
|
21286
|
+
if (file5.endsWith(".ts") && resolve39(file5).startsWith(angularPagesPath)) {
|
|
21135
21287
|
resolvedPages.add(file5);
|
|
21136
21288
|
}
|
|
21137
21289
|
});
|
|
@@ -21403,16 +21555,16 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21403
21555
|
};
|
|
21404
21556
|
const fire = () => {
|
|
21405
21557
|
ctx.debounceTimer = null;
|
|
21406
|
-
const
|
|
21558
|
+
const resolve40 = ctx.debouncedResolve;
|
|
21407
21559
|
ctx.debouncedResolve = null;
|
|
21408
21560
|
ctx.debouncedPromise = null;
|
|
21409
21561
|
if (ctx.inFlight) {
|
|
21410
21562
|
ctx.pending = true;
|
|
21411
|
-
ctx.inFlight.finally(() =>
|
|
21563
|
+
ctx.inFlight.finally(() => resolve40?.());
|
|
21412
21564
|
return;
|
|
21413
21565
|
}
|
|
21414
21566
|
ctx.inFlight = drive();
|
|
21415
|
-
ctx.inFlight.finally(() =>
|
|
21567
|
+
ctx.inFlight.finally(() => resolve40?.());
|
|
21416
21568
|
};
|
|
21417
21569
|
return ({ immediate = false } = {}) => {
|
|
21418
21570
|
if (!ctx.debouncedPromise) {
|
|
@@ -21439,9 +21591,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21439
21591
|
const diskRefreshPromise = (async () => {
|
|
21440
21592
|
if (!angularDir || editedFiles.size === 0)
|
|
21441
21593
|
return;
|
|
21442
|
-
const angularDirAbs =
|
|
21594
|
+
const angularDirAbs = resolve39(angularDir);
|
|
21443
21595
|
const filesUnderAngular = Array.from(editedFiles).filter((file5) => {
|
|
21444
|
-
const abs =
|
|
21596
|
+
const abs = resolve39(file5);
|
|
21445
21597
|
return abs === angularDirAbs || abs.startsWith(angularDirAbs + sep4);
|
|
21446
21598
|
});
|
|
21447
21599
|
if (filesUnderAngular.length === 0)
|
|
@@ -21463,7 +21615,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21463
21615
|
if (!ext)
|
|
21464
21616
|
continue;
|
|
21465
21617
|
if (ext === ".ts" || ext === ".tsx") {
|
|
21466
|
-
tsFilesToRefresh.add(
|
|
21618
|
+
tsFilesToRefresh.add(resolve39(file5));
|
|
21467
21619
|
continue;
|
|
21468
21620
|
}
|
|
21469
21621
|
const owners = resolveOwningComponents2({
|
|
@@ -21471,7 +21623,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21471
21623
|
userAngularRoot: angularDirAbs
|
|
21472
21624
|
});
|
|
21473
21625
|
for (const owner of owners) {
|
|
21474
|
-
tsFilesToRefresh.add(
|
|
21626
|
+
tsFilesToRefresh.add(resolve39(owner.componentFilePath));
|
|
21475
21627
|
}
|
|
21476
21628
|
}
|
|
21477
21629
|
if (tsFilesToRefresh.size === 0)
|
|
@@ -21482,8 +21634,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21482
21634
|
try {
|
|
21483
21635
|
const { invalidateModule: invalidateModule2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
21484
21636
|
for (const tsFile of tsFilesToRefresh) {
|
|
21485
|
-
const rel =
|
|
21486
|
-
const compiledFile =
|
|
21637
|
+
const rel = relative16(angularDirAbs, tsFile).replace(/\\/g, "/").replace(/\.[tj]sx?$/, ".js");
|
|
21638
|
+
const compiledFile = resolve39(compiledRoot, rel);
|
|
21487
21639
|
invalidateModule2(compiledFile);
|
|
21488
21640
|
}
|
|
21489
21641
|
} catch {}
|
|
@@ -21512,7 +21664,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21512
21664
|
serverPaths.forEach((serverPath, idx) => {
|
|
21513
21665
|
const fileBase = basename12(serverPath, ".js");
|
|
21514
21666
|
const ssrPath = ssrPaths[idx] ?? serverPath;
|
|
21515
|
-
state.manifest[toPascal(fileBase)] =
|
|
21667
|
+
state.manifest[toPascal(fileBase)] = resolve39(ssrPath);
|
|
21516
21668
|
});
|
|
21517
21669
|
if (clientPaths.length > 0) {
|
|
21518
21670
|
await bundleAngularClient(state, clientPaths, state.resolvedPaths.buildDir, angularDir);
|
|
@@ -21521,9 +21673,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21521
21673
|
const angularDir = config.angularDirectory ?? "";
|
|
21522
21674
|
const angularFiles = filesToRebuild.filter((file5) => detectFramework(file5, state.resolvedPaths) === "angular");
|
|
21523
21675
|
for (const file5 of angularFiles) {
|
|
21524
|
-
state.fileHashes.set(
|
|
21676
|
+
state.fileHashes.set(resolve39(file5), computeFileHash(file5));
|
|
21525
21677
|
}
|
|
21526
|
-
const angularPagesPath =
|
|
21678
|
+
const angularPagesPath = resolve39(angularDir, "pages");
|
|
21527
21679
|
const pageEntries = resolveAngularPageEntries(state, angularFiles, angularPagesPath);
|
|
21528
21680
|
const tierStart = performance.now();
|
|
21529
21681
|
const verdict = await decideAngularTier(state, angularDir);
|
|
@@ -21553,7 +21705,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21553
21705
|
}, getModuleUrl = async (pageFile) => {
|
|
21554
21706
|
const { invalidateModule: invalidateModule2, warmCache: warmCache2, SRC_URL_PREFIX: SRC_URL_PREFIX2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
21555
21707
|
invalidateModule2(pageFile);
|
|
21556
|
-
const rel =
|
|
21708
|
+
const rel = relative16(process.cwd(), pageFile).replace(/\\/g, "/");
|
|
21557
21709
|
const url = `${SRC_URL_PREFIX2}${rel}`;
|
|
21558
21710
|
warmCache2(url);
|
|
21559
21711
|
return url;
|
|
@@ -21562,11 +21714,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21562
21714
|
if (isComponentFile2)
|
|
21563
21715
|
return primaryFile;
|
|
21564
21716
|
const { findNearestComponent: findNearestComponent2 } = await Promise.resolve().then(() => (init_transformCache(), exports_transformCache));
|
|
21565
|
-
const nearest = findNearestComponent2(
|
|
21717
|
+
const nearest = findNearestComponent2(resolve39(primaryFile));
|
|
21566
21718
|
return nearest ?? primaryFile;
|
|
21567
21719
|
}, handleReactModuleServerPath = async (state, reactFiles, startTime, onRebuildComplete) => {
|
|
21568
21720
|
for (const file5 of reactFiles) {
|
|
21569
|
-
state.fileHashes.set(
|
|
21721
|
+
state.fileHashes.set(resolve39(file5), computeFileHash(file5));
|
|
21570
21722
|
}
|
|
21571
21723
|
markSsrCacheDirty("react");
|
|
21572
21724
|
const primaryFile = reactFiles.find((file5) => !file5.replace(/\\/g, "/").includes("/pages/")) ?? reactFiles[0];
|
|
@@ -21585,7 +21737,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21585
21737
|
const pageModuleUrl = await getReactModuleUrl(broadcastTarget);
|
|
21586
21738
|
if (pageModuleUrl) {
|
|
21587
21739
|
const serverDuration = Date.now() - startTime;
|
|
21588
|
-
state.lastHmrPath =
|
|
21740
|
+
state.lastHmrPath = relative16(process.cwd(), primaryFile).replace(/\\/g, "/");
|
|
21589
21741
|
state.lastHmrFramework = "react";
|
|
21590
21742
|
broadcastToClients(state, {
|
|
21591
21743
|
data: {
|
|
@@ -21648,7 +21800,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21648
21800
|
});
|
|
21649
21801
|
}, handleSvelteModuleServerPath = async (state, svelteFiles, startTime, onRebuildComplete) => {
|
|
21650
21802
|
for (const file5 of svelteFiles) {
|
|
21651
|
-
state.fileHashes.set(
|
|
21803
|
+
state.fileHashes.set(resolve39(file5), computeFileHash(file5));
|
|
21652
21804
|
}
|
|
21653
21805
|
markSsrCacheDirty("svelte");
|
|
21654
21806
|
const serverDuration = Date.now() - startTime;
|
|
@@ -21673,8 +21825,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21673
21825
|
const serverEntries = [...svelteServerPaths];
|
|
21674
21826
|
const clientEntries = [...svelteIndexPaths, ...svelteClientPaths];
|
|
21675
21827
|
const { getFrameworkGeneratedDir: getFrameworkGeneratedDir2 } = await Promise.resolve().then(() => (init_generatedDir(), exports_generatedDir));
|
|
21676
|
-
const serverRoot =
|
|
21677
|
-
const serverOutDir =
|
|
21828
|
+
const serverRoot = resolve39(getFrameworkGeneratedDir2("svelte"), "server");
|
|
21829
|
+
const serverOutDir = resolve39(buildDir, basename12(svelteDir));
|
|
21678
21830
|
const [serverResult, clientResult] = await Promise.all([
|
|
21679
21831
|
serverEntries.length > 0 ? bunBuild9({
|
|
21680
21832
|
entrypoints: serverEntries,
|
|
@@ -21771,7 +21923,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21771
21923
|
});
|
|
21772
21924
|
}, handleVueModuleServerPath = async (state, vueFiles, nonVueFiles, startTime, onRebuildComplete) => {
|
|
21773
21925
|
for (const file5 of [...vueFiles, ...nonVueFiles]) {
|
|
21774
|
-
state.fileHashes.set(
|
|
21926
|
+
state.fileHashes.set(resolve39(file5), computeFileHash(file5));
|
|
21775
21927
|
}
|
|
21776
21928
|
markSsrCacheDirty("vue");
|
|
21777
21929
|
await invalidateNonVueModules(nonVueFiles);
|
|
@@ -21799,7 +21951,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21799
21951
|
recursive: true,
|
|
21800
21952
|
withFileTypes: true
|
|
21801
21953
|
});
|
|
21802
|
-
return entries.filter((entry) => entry.isFile() && EMBER_PAGE_EXTENSIONS.some((ext) => entry.name.endsWith(ext))).map((entry) =>
|
|
21954
|
+
return entries.filter((entry) => entry.isFile() && EMBER_PAGE_EXTENSIONS.some((ext) => entry.name.endsWith(ext))).map((entry) => resolve39(emberPagesPath, entry.name));
|
|
21803
21955
|
} catch {
|
|
21804
21956
|
return [];
|
|
21805
21957
|
}
|
|
@@ -21811,10 +21963,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21811
21963
|
return state.manifest;
|
|
21812
21964
|
}
|
|
21813
21965
|
for (const file5 of emberFiles) {
|
|
21814
|
-
state.fileHashes.set(
|
|
21966
|
+
state.fileHashes.set(resolve39(file5), computeFileHash(file5));
|
|
21815
21967
|
}
|
|
21816
|
-
const emberPagesPath =
|
|
21817
|
-
const directPageEntries = emberFiles.filter((file5) =>
|
|
21968
|
+
const emberPagesPath = resolve39(emberDir, "pages");
|
|
21969
|
+
const directPageEntries = emberFiles.filter((file5) => resolve39(file5).startsWith(emberPagesPath));
|
|
21818
21970
|
const allPageEntries = directPageEntries.length > 0 ? directPageEntries : await collectAllEmberPages(emberPagesPath);
|
|
21819
21971
|
if (allPageEntries.length === 0) {
|
|
21820
21972
|
onRebuildComplete({ hmrState: state, manifest: state.manifest });
|
|
@@ -21824,14 +21976,14 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21824
21976
|
const { serverPaths } = await compileEmber2(allPageEntries, emberDir, process.cwd(), true);
|
|
21825
21977
|
for (const serverPath of serverPaths) {
|
|
21826
21978
|
const fileBase = basename12(serverPath, ".js");
|
|
21827
|
-
state.manifest[toPascal(fileBase)] =
|
|
21979
|
+
state.manifest[toPascal(fileBase)] = resolve39(serverPath);
|
|
21828
21980
|
}
|
|
21829
21981
|
const { invalidateEmberSsrCache: invalidateEmberSsrCache2 } = await Promise.resolve().then(() => (init_ember(), exports_ember));
|
|
21830
21982
|
invalidateEmberSsrCache2();
|
|
21831
21983
|
const duration = Date.now() - startTime;
|
|
21832
21984
|
const [primary] = emberFiles;
|
|
21833
21985
|
if (primary) {
|
|
21834
|
-
state.lastHmrPath =
|
|
21986
|
+
state.lastHmrPath = relative16(process.cwd(), primary).replace(/\\/g, "/");
|
|
21835
21987
|
state.lastHmrFramework = "ember";
|
|
21836
21988
|
logHmrUpdate(primary, "ember", duration);
|
|
21837
21989
|
}
|
|
@@ -21916,8 +22068,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21916
22068
|
if (!buildReference?.source) {
|
|
21917
22069
|
return;
|
|
21918
22070
|
}
|
|
21919
|
-
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname :
|
|
21920
|
-
islandFiles.add(
|
|
22071
|
+
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve39(dirname22(buildInfo.resolvedRegistryPath), buildReference.source);
|
|
22072
|
+
islandFiles.add(resolve39(sourcePath));
|
|
21921
22073
|
}, resolveIslandSourceFiles = async (config) => {
|
|
21922
22074
|
const registryPath = config.islands?.registry;
|
|
21923
22075
|
if (!registryPath) {
|
|
@@ -21925,7 +22077,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21925
22077
|
}
|
|
21926
22078
|
const buildInfo = await loadIslandRegistryBuildInfo(registryPath);
|
|
21927
22079
|
const islandFiles = new Set([
|
|
21928
|
-
|
|
22080
|
+
resolve39(buildInfo.resolvedRegistryPath)
|
|
21929
22081
|
]);
|
|
21930
22082
|
for (const definition of buildInfo.definitions) {
|
|
21931
22083
|
resolveIslandDefinitionSource(definition, buildInfo, islandFiles);
|
|
@@ -21936,7 +22088,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21936
22088
|
if (islandFiles.size === 0) {
|
|
21937
22089
|
return false;
|
|
21938
22090
|
}
|
|
21939
|
-
return filesToRebuild.some((file5) => islandFiles.has(
|
|
22091
|
+
return filesToRebuild.some((file5) => islandFiles.has(resolve39(file5)));
|
|
21940
22092
|
}, handleIslandSourceReload = async (state, config, filesToRebuild, manifest) => {
|
|
21941
22093
|
const shouldReload = await didStaticPagesNeedIslandRefresh(config, filesToRebuild);
|
|
21942
22094
|
if (!shouldReload) {
|
|
@@ -21971,10 +22123,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21971
22123
|
}, computeOutputPagesDir = (state, config, framework) => {
|
|
21972
22124
|
const isSingle = !config.reactDirectory && !config.svelteDirectory && !config.vueDirectory && (framework === "html" ? !config.htmxDirectory : !config.htmlDirectory);
|
|
21973
22125
|
if (isSingle) {
|
|
21974
|
-
return
|
|
22126
|
+
return resolve39(state.resolvedPaths.buildDir, "pages");
|
|
21975
22127
|
}
|
|
21976
22128
|
const dirName = framework === "html" ? basename12(config.htmlDirectory ?? "html") : basename12(config.htmxDirectory ?? "htmx");
|
|
21977
|
-
return
|
|
22129
|
+
return resolve39(state.resolvedPaths.buildDir, dirName, "pages");
|
|
21978
22130
|
}, processHtmlPageUpdate = async (state, pageFile, builtHtmlPagePath, manifest, duration) => {
|
|
21979
22131
|
try {
|
|
21980
22132
|
const { handleHTMLUpdate: handleHTMLUpdate2 } = await Promise.resolve().then(() => (init_simpleHTMLHMR(), exports_simpleHTMLHMR));
|
|
@@ -22013,7 +22165,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22013
22165
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmlPages, "*.html") : htmlPageFiles;
|
|
22014
22166
|
await runSequentially(pageFilesToUpdate, async (pageFile) => {
|
|
22015
22167
|
const htmlPageName = basename12(pageFile);
|
|
22016
|
-
const builtHtmlPagePath =
|
|
22168
|
+
const builtHtmlPagePath = resolve39(outputHtmlPages, htmlPageName);
|
|
22017
22169
|
await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration);
|
|
22018
22170
|
});
|
|
22019
22171
|
}, handleVueCssOnlyUpdate = (state, vueCssFiles, manifest, duration) => {
|
|
@@ -22074,11 +22226,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22074
22226
|
const baseName = fileName.replace(/\.vue$/, "");
|
|
22075
22227
|
const pascalName = toPascal(baseName);
|
|
22076
22228
|
const vueRoot = config.vueDirectory;
|
|
22077
|
-
const hmrId = vueRoot ?
|
|
22229
|
+
const hmrId = vueRoot ? relative16(vueRoot, vuePagePath).replace(/\\/g, "/").replace(/\.vue$/, "") : baseName;
|
|
22078
22230
|
const cssKey = `${pascalName}CSS`;
|
|
22079
22231
|
const cssUrl = manifest[cssKey] || null;
|
|
22080
22232
|
const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
|
|
22081
|
-
const hmrMeta = vueHmrMetadata2.get(
|
|
22233
|
+
const hmrMeta = vueHmrMetadata2.get(resolve39(vuePagePath));
|
|
22082
22234
|
const changeType = hmrMeta?.changeType ?? "full";
|
|
22083
22235
|
if (changeType === "style-only") {
|
|
22084
22236
|
broadcastVueStyleOnly(state, vuePagePath, baseName, cssUrl, hmrId, manifest, duration);
|
|
@@ -22263,7 +22415,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22263
22415
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmxPages, "*.html") : htmxPageFiles;
|
|
22264
22416
|
await runSequentially(pageFilesToUpdate, async (htmxPageFile) => {
|
|
22265
22417
|
const htmxPageName = basename12(htmxPageFile);
|
|
22266
|
-
const builtHtmxPagePath =
|
|
22418
|
+
const builtHtmxPagePath = resolve39(outputHtmxPages, htmxPageName);
|
|
22267
22419
|
await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration);
|
|
22268
22420
|
});
|
|
22269
22421
|
}, collectUpdatedModulePaths = (allModuleUpdates) => {
|
|
@@ -22372,7 +22524,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22372
22524
|
html = html.slice(0, bodyClose.index) + hmrScript + html.slice(bodyClose.index);
|
|
22373
22525
|
writeFs(destPath, html);
|
|
22374
22526
|
}, processMarkupFileFastPath = async (state, sourceFile, outputDir, framework, startTime, updateAssetPaths2, handleUpdate, readFs, writeFs) => {
|
|
22375
|
-
const destPath =
|
|
22527
|
+
const destPath = resolve39(outputDir, basename12(sourceFile));
|
|
22376
22528
|
const hmrScript = extractHmrScript(destPath, readFs);
|
|
22377
22529
|
const source = await Bun.file(sourceFile).text();
|
|
22378
22530
|
await Bun.write(destPath, source);
|
|
@@ -22662,7 +22814,7 @@ __export(exports_buildDepVendor, {
|
|
|
22662
22814
|
buildDepVendor: () => buildDepVendor
|
|
22663
22815
|
});
|
|
22664
22816
|
import { mkdirSync as mkdirSync13 } from "fs";
|
|
22665
|
-
import { join as
|
|
22817
|
+
import { join as join31 } from "path";
|
|
22666
22818
|
import { rm as rm10 } from "fs/promises";
|
|
22667
22819
|
var {build: bunBuild9, Glob: Glob9 } = globalThis.Bun;
|
|
22668
22820
|
var toSafeFileName6 = (specifier) => {
|
|
@@ -22675,12 +22827,12 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22675
22827
|
} catch {
|
|
22676
22828
|
return false;
|
|
22677
22829
|
}
|
|
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,
|
|
22830
|
+
}, 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
22831
|
const dep = [];
|
|
22680
22832
|
const framework = [];
|
|
22681
22833
|
try {
|
|
22682
22834
|
const content = await Bun.file(file5).text();
|
|
22683
|
-
for (const imp of
|
|
22835
|
+
for (const imp of transpiler6.scanImports(content)) {
|
|
22684
22836
|
if (isDepSpecifier(imp.path))
|
|
22685
22837
|
dep.push(imp.path);
|
|
22686
22838
|
else if (isFrameworkRootCandidate(imp.path))
|
|
@@ -22697,9 +22849,9 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22697
22849
|
} catch {
|
|
22698
22850
|
return empty;
|
|
22699
22851
|
}
|
|
22700
|
-
}, collectDirSpecifiers = async (dir,
|
|
22852
|
+
}, collectDirSpecifiers = async (dir, transpiler6, dep, framework) => {
|
|
22701
22853
|
const files = await scanDirFiles(dir);
|
|
22702
|
-
const results = await Promise.all(files.map((file5) => readFileSpecifiers(file5,
|
|
22854
|
+
const results = await Promise.all(files.map((file5) => readFileSpecifiers(file5, transpiler6)));
|
|
22703
22855
|
for (const result of results) {
|
|
22704
22856
|
for (const spec of result.dep)
|
|
22705
22857
|
dep.add(spec);
|
|
@@ -22709,15 +22861,15 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22709
22861
|
}, scanBareImports = async (directories) => {
|
|
22710
22862
|
const dep = new Set;
|
|
22711
22863
|
const framework = new Set;
|
|
22712
|
-
const
|
|
22713
|
-
await Promise.all(directories.map((dir) => collectDirSpecifiers(dir,
|
|
22864
|
+
const transpiler6 = new Bun.Transpiler({ loader: "tsx" });
|
|
22865
|
+
await Promise.all(directories.map((dir) => collectDirSpecifiers(dir, transpiler6, dep, framework)));
|
|
22714
22866
|
return {
|
|
22715
22867
|
dep: Array.from(dep).filter(isResolvable4),
|
|
22716
22868
|
framework: Array.from(framework).filter(isResolvable4)
|
|
22717
22869
|
};
|
|
22718
22870
|
}, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
|
|
22719
22871
|
const { readFileSync: readFileSync21 } = await import("fs");
|
|
22720
|
-
const
|
|
22872
|
+
const transpiler6 = new Bun.Transpiler({ loader: "js" });
|
|
22721
22873
|
const newSpecs = new Set;
|
|
22722
22874
|
for (const spec of specs) {
|
|
22723
22875
|
if (alreadyScanned.has(spec))
|
|
@@ -22737,7 +22889,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22737
22889
|
}
|
|
22738
22890
|
let imports;
|
|
22739
22891
|
try {
|
|
22740
|
-
imports =
|
|
22892
|
+
imports = transpiler6.scanImports(content);
|
|
22741
22893
|
} catch {
|
|
22742
22894
|
continue;
|
|
22743
22895
|
}
|
|
@@ -22773,7 +22925,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22773
22925
|
}), buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
|
|
22774
22926
|
const entries = await Promise.all(specifiers.map(async (specifier) => {
|
|
22775
22927
|
const safeName = toSafeFileName6(specifier);
|
|
22776
|
-
const entryPath =
|
|
22928
|
+
const entryPath = join31(tmpDir, `${safeName}.ts`);
|
|
22777
22929
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
22778
22930
|
return { entryPath, specifier };
|
|
22779
22931
|
}));
|
|
@@ -22834,9 +22986,9 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22834
22986
|
const { dep: initialSpecs, framework: frameworkRoots } = await scanBareImports(directories);
|
|
22835
22987
|
if (initialSpecs.length === 0 && frameworkRoots.length === 0)
|
|
22836
22988
|
return {};
|
|
22837
|
-
const vendorDir =
|
|
22989
|
+
const vendorDir = join31(buildDir, "vendor");
|
|
22838
22990
|
mkdirSync13(vendorDir, { recursive: true });
|
|
22839
|
-
const tmpDir =
|
|
22991
|
+
const tmpDir = join31(buildDir, "_dep_vendor_tmp");
|
|
22840
22992
|
mkdirSync13(tmpDir, { recursive: true });
|
|
22841
22993
|
const allSpecs = new Set(initialSpecs);
|
|
22842
22994
|
const alreadyScanned = new Set;
|
|
@@ -22919,7 +23071,7 @@ __export(exports_devBuild, {
|
|
|
22919
23071
|
});
|
|
22920
23072
|
import { readdir as readdir5 } from "fs/promises";
|
|
22921
23073
|
import { statSync as statSync5 } from "fs";
|
|
22922
|
-
import { resolve as
|
|
23074
|
+
import { resolve as resolve40 } from "path";
|
|
22923
23075
|
var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
22924
23076
|
const configuredDirs = [
|
|
22925
23077
|
config.reactDirectory,
|
|
@@ -22942,7 +23094,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
22942
23094
|
return Object.keys(config).length > 0 ? config : null;
|
|
22943
23095
|
}, reloadConfig = async () => {
|
|
22944
23096
|
try {
|
|
22945
|
-
const configPath2 =
|
|
23097
|
+
const configPath2 = resolve40(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
22946
23098
|
const source = await Bun.file(configPath2).text();
|
|
22947
23099
|
return parseDirectoryConfig(source);
|
|
22948
23100
|
} catch {
|
|
@@ -23027,7 +23179,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
23027
23179
|
state.fileChangeQueue.clear();
|
|
23028
23180
|
}
|
|
23029
23181
|
}, handleCachedReload = async () => {
|
|
23030
|
-
const serverMtime = statSync5(
|
|
23182
|
+
const serverMtime = statSync5(resolve40(Bun.main)).mtimeMs;
|
|
23031
23183
|
const lastMtime = globalThis.__hmrServerMtime;
|
|
23032
23184
|
globalThis.__hmrServerMtime = serverMtime;
|
|
23033
23185
|
const cached = globalThis.__hmrDevResult;
|
|
@@ -23064,8 +23216,8 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
23064
23216
|
return true;
|
|
23065
23217
|
}, resolveAbsoluteVersion2 = async () => {
|
|
23066
23218
|
const candidates = [
|
|
23067
|
-
|
|
23068
|
-
|
|
23219
|
+
resolve40(import.meta.dir, "..", "..", "package.json"),
|
|
23220
|
+
resolve40(import.meta.dir, "..", "package.json")
|
|
23069
23221
|
];
|
|
23070
23222
|
const [candidate, ...remaining] = candidates;
|
|
23071
23223
|
if (!candidate) {
|
|
@@ -23091,7 +23243,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
23091
23243
|
const entries = await readdir5(vendorDir).catch(() => emptyStringArray);
|
|
23092
23244
|
await Promise.all(entries.filter((entry) => entry.endsWith(".js")).map(async (entry) => {
|
|
23093
23245
|
const webPath = `/${framework}/vendor/${entry}`;
|
|
23094
|
-
const bytes = await Bun.file(
|
|
23246
|
+
const bytes = await Bun.file(resolve40(vendorDir, entry)).bytes();
|
|
23095
23247
|
assetStore.set(webPath, bytes);
|
|
23096
23248
|
}));
|
|
23097
23249
|
}, devBuild = async (config) => {
|
|
@@ -23159,11 +23311,11 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
23159
23311
|
cleanStaleAssets(state.assetStore, manifest, state.resolvedPaths.buildDir);
|
|
23160
23312
|
recordStep("populate asset store", stepStartedAt);
|
|
23161
23313
|
stepStartedAt = performance.now();
|
|
23162
|
-
const reactVendorDir =
|
|
23163
|
-
const angularVendorDir =
|
|
23164
|
-
const svelteVendorDir =
|
|
23165
|
-
const vueVendorDir =
|
|
23166
|
-
const depVendorDir =
|
|
23314
|
+
const reactVendorDir = resolve40(state.resolvedPaths.buildDir, "react", "vendor");
|
|
23315
|
+
const angularVendorDir = resolve40(state.resolvedPaths.buildDir, "angular", "vendor");
|
|
23316
|
+
const svelteVendorDir = resolve40(state.resolvedPaths.buildDir, "svelte", "vendor");
|
|
23317
|
+
const vueVendorDir = resolve40(state.resolvedPaths.buildDir, "vue", "vendor");
|
|
23318
|
+
const depVendorDir = resolve40(state.resolvedPaths.buildDir, "vendor");
|
|
23167
23319
|
const { buildDepVendor: buildDepVendor2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
|
|
23168
23320
|
const [, angularSpecs, , , , , depPaths] = await Promise.all([
|
|
23169
23321
|
config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
|
|
@@ -23241,7 +23393,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
23241
23393
|
manifest
|
|
23242
23394
|
};
|
|
23243
23395
|
globalThis.__hmrDevResult = result;
|
|
23244
|
-
globalThis.__hmrServerMtime = statSync5(
|
|
23396
|
+
globalThis.__hmrServerMtime = statSync5(resolve40(Bun.main)).mtimeMs;
|
|
23245
23397
|
return result;
|
|
23246
23398
|
};
|
|
23247
23399
|
var init_devBuild = __esm(() => {
|
|
@@ -23386,8 +23538,8 @@ var STORE_KEY = "__elysiaStore", getGlobalValue = (key) => Reflect.get(globalThi
|
|
|
23386
23538
|
return null;
|
|
23387
23539
|
if (!pathname.startsWith("/"))
|
|
23388
23540
|
return null;
|
|
23389
|
-
const { resolve:
|
|
23390
|
-
const candidate =
|
|
23541
|
+
const { resolve: resolve41, normalize } = await import("path");
|
|
23542
|
+
const candidate = resolve41(buildDir, pathname.slice(1));
|
|
23391
23543
|
const normalizedBuild = normalize(buildDir);
|
|
23392
23544
|
if (!candidate.startsWith(normalizedBuild))
|
|
23393
23545
|
return null;
|
|
@@ -23471,12 +23623,12 @@ __export(exports_devtoolsJson, {
|
|
|
23471
23623
|
devtoolsJson: () => devtoolsJson
|
|
23472
23624
|
});
|
|
23473
23625
|
import { existsSync as existsSync28, mkdirSync as mkdirSync14, readFileSync as readFileSync21, writeFileSync as writeFileSync9 } from "fs";
|
|
23474
|
-
import { dirname as
|
|
23626
|
+
import { dirname as dirname23, join as join32, resolve as resolve41 } from "path";
|
|
23475
23627
|
import { Elysia as Elysia3 } from "elysia";
|
|
23476
23628
|
var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_KEY = "__absoluteDevtoolsWorkspaceUuid", getGlobalUuid = () => Reflect.get(globalThis, UUID_CACHE_KEY), setGlobalUuid = (uuid) => {
|
|
23477
23629
|
Reflect.set(globalThis, UUID_CACHE_KEY, uuid);
|
|
23478
23630
|
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) =>
|
|
23631
|
+
}, 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
23632
|
if (!existsSync28(cachePath))
|
|
23481
23633
|
return null;
|
|
23482
23634
|
try {
|
|
@@ -23498,11 +23650,11 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
|
|
|
23498
23650
|
if (cachedUuid)
|
|
23499
23651
|
return setGlobalUuid(cachedUuid);
|
|
23500
23652
|
const uuid = crypto.randomUUID();
|
|
23501
|
-
mkdirSync14(
|
|
23653
|
+
mkdirSync14(dirname23(cachePath), { recursive: true });
|
|
23502
23654
|
writeFileSync9(cachePath, uuid, "utf-8");
|
|
23503
23655
|
return setGlobalUuid(uuid);
|
|
23504
23656
|
}, devtoolsJson = (buildDir, options = {}) => {
|
|
23505
|
-
const rootPath =
|
|
23657
|
+
const rootPath = resolve41(options.projectRoot ?? process.cwd());
|
|
23506
23658
|
const root = options.normalizeForWindowsContainer === false ? rootPath : normalizeDevtoolsWorkspaceRoot(rootPath);
|
|
23507
23659
|
const uuid = getOrCreateUuid(buildDir, options);
|
|
23508
23660
|
return new Elysia3({ name: "absolute-devtools-json" }).get(ENDPOINT, () => ({
|
|
@@ -23515,11 +23667,11 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
|
|
|
23515
23667
|
if (process.env.WSL_DISTRO_NAME) {
|
|
23516
23668
|
const distro = process.env.WSL_DISTRO_NAME;
|
|
23517
23669
|
const withoutLeadingSlash = root.replace(/^\//, "");
|
|
23518
|
-
return
|
|
23670
|
+
return join32("\\\\wsl.localhost", distro, withoutLeadingSlash).replace(/\//g, "\\");
|
|
23519
23671
|
}
|
|
23520
23672
|
if (process.env.DOCKER_DESKTOP && !root.startsWith("\\\\")) {
|
|
23521
23673
|
const withoutLeadingSlash = root.replace(/^\//, "");
|
|
23522
|
-
return
|
|
23674
|
+
return join32("\\\\wsl.localhost", "docker-desktop-data", withoutLeadingSlash).replace(/\//g, "\\");
|
|
23523
23675
|
}
|
|
23524
23676
|
return root;
|
|
23525
23677
|
};
|
|
@@ -23531,7 +23683,7 @@ __export(exports_imageOptimizer, {
|
|
|
23531
23683
|
imageOptimizer: () => imageOptimizer
|
|
23532
23684
|
});
|
|
23533
23685
|
import { existsSync as existsSync29 } from "fs";
|
|
23534
|
-
import { resolve as
|
|
23686
|
+
import { resolve as resolve42 } from "path";
|
|
23535
23687
|
import { Elysia as Elysia4 } from "elysia";
|
|
23536
23688
|
var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avifInProgress, safeResolve = (path, baseDir) => {
|
|
23537
23689
|
try {
|
|
@@ -23544,7 +23696,7 @@ var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avi
|
|
|
23544
23696
|
}
|
|
23545
23697
|
}, resolveLocalImage = (url, buildDir) => {
|
|
23546
23698
|
const cleanPath = url.startsWith("/") ? url.slice(1) : url;
|
|
23547
|
-
return safeResolve(cleanPath, buildDir) ?? safeResolve(cleanPath,
|
|
23699
|
+
return safeResolve(cleanPath, buildDir) ?? safeResolve(cleanPath, resolve42(process.cwd()));
|
|
23548
23700
|
}, parseQueryParams = (query, allowedSizes, defaultQuality) => {
|
|
23549
23701
|
const url = typeof query["url"] === "string" ? query["url"] : undefined;
|
|
23550
23702
|
const wParam = typeof query["w"] === "string" ? query["w"] : undefined;
|
|
@@ -23836,7 +23988,7 @@ __export(exports_prerender, {
|
|
|
23836
23988
|
PRERENDER_BYPASS_HEADER: () => PRERENDER_BYPASS_HEADER
|
|
23837
23989
|
});
|
|
23838
23990
|
import { mkdirSync as mkdirSync15, readFileSync as readFileSync22 } from "fs";
|
|
23839
|
-
import { join as
|
|
23991
|
+
import { join as join33 } from "path";
|
|
23840
23992
|
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
23993
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
23842
23994
|
await Bun.write(metaPath, String(Date.now()));
|
|
@@ -23902,7 +24054,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
|
|
|
23902
24054
|
return false;
|
|
23903
24055
|
const html = await res.text();
|
|
23904
24056
|
const fileName = routeToFilename(route);
|
|
23905
|
-
const filePath =
|
|
24057
|
+
const filePath = join33(prerenderDir, fileName);
|
|
23906
24058
|
await Bun.write(filePath, html);
|
|
23907
24059
|
await writeTimestamp(filePath);
|
|
23908
24060
|
return true;
|
|
@@ -23928,13 +24080,13 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
|
|
|
23928
24080
|
}
|
|
23929
24081
|
const html = await res.text();
|
|
23930
24082
|
const fileName = routeToFilename(route);
|
|
23931
|
-
const filePath =
|
|
24083
|
+
const filePath = join33(prerenderDir, fileName);
|
|
23932
24084
|
await Bun.write(filePath, html);
|
|
23933
24085
|
await writeTimestamp(filePath);
|
|
23934
24086
|
result.routes.set(route, filePath);
|
|
23935
24087
|
log2?.(` Pre-rendered ${route} \u2192 ${fileName} (${html.length} bytes)`);
|
|
23936
24088
|
}, prerender = async (port, outDir, staticConfig, log2) => {
|
|
23937
|
-
const prerenderDir =
|
|
24089
|
+
const prerenderDir = join33(outDir, "_prerendered");
|
|
23938
24090
|
mkdirSync15(prerenderDir, { recursive: true });
|
|
23939
24091
|
const baseUrl = `http://localhost:${port}`;
|
|
23940
24092
|
let routes;
|
|
@@ -24533,11 +24685,11 @@ var handleHTMXPageRequest = async (pagePath) => {
|
|
|
24533
24685
|
};
|
|
24534
24686
|
// src/core/prepare.ts
|
|
24535
24687
|
import { existsSync as existsSync30, readdirSync as readdirSync3, readFileSync as readFileSync23 } from "fs";
|
|
24536
|
-
import { basename as basename13, join as
|
|
24688
|
+
import { basename as basename13, join as join34, relative as relative17, resolve as resolve43 } from "path";
|
|
24537
24689
|
import { Elysia as Elysia5 } from "elysia";
|
|
24538
24690
|
|
|
24539
24691
|
// src/utils/loadConfig.ts
|
|
24540
|
-
import { resolve as
|
|
24692
|
+
import { resolve as resolve8 } from "path";
|
|
24541
24693
|
var RESERVED_TOP_LEVEL_KEYS = new Set([
|
|
24542
24694
|
"assetsDirectory",
|
|
24543
24695
|
"astroDirectory",
|
|
@@ -24630,7 +24782,7 @@ var loadConfig = async (configPath) => {
|
|
|
24630
24782
|
return config;
|
|
24631
24783
|
};
|
|
24632
24784
|
var loadRawConfig = async (configPath) => {
|
|
24633
|
-
const resolved =
|
|
24785
|
+
const resolved = resolve8(configPath ?? process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
24634
24786
|
const mod = await import(resolved);
|
|
24635
24787
|
const config = mod.default ?? mod.config;
|
|
24636
24788
|
if (!config) {
|
|
@@ -24645,7 +24797,7 @@ Expected: export default defineConfig({ ... })`);
|
|
|
24645
24797
|
|
|
24646
24798
|
// src/core/loadIslandRegistry.ts
|
|
24647
24799
|
init_islandEntries();
|
|
24648
|
-
import { resolve as
|
|
24800
|
+
import { resolve as resolve9 } from "path";
|
|
24649
24801
|
var isRecord6 = (value) => typeof value === "object" && value !== null;
|
|
24650
24802
|
var resolveRegistryExport2 = (mod) => {
|
|
24651
24803
|
if (isRecord6(mod.islandRegistry))
|
|
@@ -24657,7 +24809,7 @@ var resolveRegistryExport2 = (mod) => {
|
|
|
24657
24809
|
var isRegistryModuleExport = (value) => isRecord6(value);
|
|
24658
24810
|
var isIslandRegistryInput = (value) => isRecord6(value);
|
|
24659
24811
|
var loadIslandRegistry = async (registryPath) => {
|
|
24660
|
-
const resolvedRegistryPath =
|
|
24812
|
+
const resolvedRegistryPath = resolve9(registryPath);
|
|
24661
24813
|
const buildInfo = await loadIslandRegistryBuildInfo(resolvedRegistryPath);
|
|
24662
24814
|
if (buildInfo.definitions.length > 0) {
|
|
24663
24815
|
return buildInfo.registry;
|
|
@@ -24723,16 +24875,22 @@ var setConventions = (map) => {
|
|
|
24723
24875
|
};
|
|
24724
24876
|
var isDev = () => true;
|
|
24725
24877
|
var buildErrorProps = (error) => {
|
|
24726
|
-
|
|
24727
|
-
|
|
24728
|
-
|
|
24878
|
+
if (error instanceof Error) {
|
|
24879
|
+
return {
|
|
24880
|
+
name: error.name,
|
|
24881
|
+
message: error.message,
|
|
24882
|
+
...isDev() && error.stack ? { stack: error.stack } : {}
|
|
24883
|
+
};
|
|
24884
|
+
}
|
|
24885
|
+
return { name: "Error", message: String(error) };
|
|
24729
24886
|
};
|
|
24730
24887
|
var renderReactError = async (conventionPath, errorProps) => {
|
|
24731
24888
|
const { createElement } = await import("react");
|
|
24732
24889
|
const { renderToReadableStream } = await import("react-dom/server");
|
|
24733
24890
|
const mod = await import(conventionPath);
|
|
24734
|
-
const
|
|
24735
|
-
|
|
24891
|
+
const ErrorComponent = mod.default;
|
|
24892
|
+
if (typeof ErrorComponent !== "function")
|
|
24893
|
+
return null;
|
|
24736
24894
|
const element = createElement(ErrorComponent, errorProps);
|
|
24737
24895
|
const stream = await renderToReadableStream(element);
|
|
24738
24896
|
return new Response(stream, {
|
|
@@ -24744,6 +24902,8 @@ var renderSvelteError = async (conventionPath, errorProps) => {
|
|
|
24744
24902
|
const { render } = await import("svelte/server");
|
|
24745
24903
|
const mod = await import(conventionPath);
|
|
24746
24904
|
const ErrorComponent = mod.default;
|
|
24905
|
+
if (!ErrorComponent)
|
|
24906
|
+
return null;
|
|
24747
24907
|
const { head, body } = render(ErrorComponent, {
|
|
24748
24908
|
props: errorProps
|
|
24749
24909
|
});
|
|
@@ -24766,6 +24926,8 @@ var renderVueError = async (conventionPath, errorProps) => {
|
|
|
24766
24926
|
const { renderToString } = await import("vue/server-renderer");
|
|
24767
24927
|
const mod = await import(conventionPath);
|
|
24768
24928
|
const ErrorComponent = mod.default;
|
|
24929
|
+
if (!ErrorComponent)
|
|
24930
|
+
return null;
|
|
24769
24931
|
const app = createSSRApp({
|
|
24770
24932
|
render: () => h2(ErrorComponent, errorProps)
|
|
24771
24933
|
});
|
|
@@ -24779,10 +24941,20 @@ var renderVueError = async (conventionPath, errorProps) => {
|
|
|
24779
24941
|
};
|
|
24780
24942
|
var renderAngularError = async (conventionPath, errorProps) => {
|
|
24781
24943
|
const mod = await import(conventionPath);
|
|
24782
|
-
const
|
|
24783
|
-
if (typeof
|
|
24944
|
+
const renderFn = mod.default;
|
|
24945
|
+
if (typeof renderFn !== "function")
|
|
24784
24946
|
return null;
|
|
24785
|
-
const html =
|
|
24947
|
+
const html = renderFn(errorProps);
|
|
24948
|
+
return new Response(html, {
|
|
24949
|
+
headers: { "Content-Type": "text/html" },
|
|
24950
|
+
status: 500
|
|
24951
|
+
});
|
|
24952
|
+
};
|
|
24953
|
+
var escapeHtml = (value) => value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
24954
|
+
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) : "");
|
|
24955
|
+
var renderHtmlError = async (conventionPath, errorProps) => {
|
|
24956
|
+
const template = await Bun.file(conventionPath).text();
|
|
24957
|
+
const html = replaceErrorTokens(template, errorProps);
|
|
24786
24958
|
return new Response(html, {
|
|
24787
24959
|
headers: { "Content-Type": "text/html" },
|
|
24788
24960
|
status: 500
|
|
@@ -24801,11 +24973,12 @@ var renderEmberNotFound = async () => null;
|
|
|
24801
24973
|
var ERROR_RENDERERS = {
|
|
24802
24974
|
angular: renderAngularError,
|
|
24803
24975
|
ember: renderEmberError,
|
|
24976
|
+
html: renderHtmlError,
|
|
24804
24977
|
react: renderReactError,
|
|
24805
24978
|
svelte: renderSvelteError,
|
|
24806
24979
|
vue: renderVueError
|
|
24807
24980
|
};
|
|
24808
|
-
var
|
|
24981
|
+
var tryFrameworkErrorConvention = async (framework, pageName, errorProps, error) => {
|
|
24809
24982
|
let conventionPath = resolveErrorConventionPath(framework, pageName);
|
|
24810
24983
|
if (!conventionPath && error instanceof Error && error.stack) {
|
|
24811
24984
|
for (const match of error.stack.matchAll(/^\s*at\s+([A-Za-z_$][\w$]*)/gm)) {
|
|
@@ -24819,7 +24992,6 @@ var renderConventionError = async (framework, pageName, error) => {
|
|
|
24819
24992
|
}
|
|
24820
24993
|
if (!conventionPath)
|
|
24821
24994
|
return null;
|
|
24822
|
-
const errorProps = buildErrorProps(error);
|
|
24823
24995
|
const renderer = ERROR_RENDERERS[framework];
|
|
24824
24996
|
if (!renderer)
|
|
24825
24997
|
return null;
|
|
@@ -24830,12 +25002,25 @@ var renderConventionError = async (framework, pageName, error) => {
|
|
|
24830
25002
|
}
|
|
24831
25003
|
return null;
|
|
24832
25004
|
};
|
|
25005
|
+
var renderConventionError = async (framework, pageName, error) => {
|
|
25006
|
+
const errorProps = buildErrorProps(error);
|
|
25007
|
+
const frameworkResponse = await tryFrameworkErrorConvention(framework, pageName, errorProps, error);
|
|
25008
|
+
if (frameworkResponse)
|
|
25009
|
+
return frameworkResponse;
|
|
25010
|
+
if (framework !== "html") {
|
|
25011
|
+
const htmlResponse = await tryFrameworkErrorConvention("html", pageName, errorProps, error);
|
|
25012
|
+
if (htmlResponse)
|
|
25013
|
+
return htmlResponse;
|
|
25014
|
+
}
|
|
25015
|
+
return null;
|
|
25016
|
+
};
|
|
24833
25017
|
var renderReactNotFound = async (conventionPath) => {
|
|
24834
25018
|
const { createElement } = await import("react");
|
|
24835
25019
|
const { renderToReadableStream } = await import("react-dom/server");
|
|
24836
25020
|
const mod = await import(conventionPath);
|
|
24837
|
-
const
|
|
24838
|
-
|
|
25021
|
+
const NotFoundComponent = mod.default;
|
|
25022
|
+
if (typeof NotFoundComponent !== "function")
|
|
25023
|
+
return null;
|
|
24839
25024
|
const element = createElement(NotFoundComponent);
|
|
24840
25025
|
const stream = await renderToReadableStream(element);
|
|
24841
25026
|
return new Response(stream, {
|
|
@@ -24847,6 +25032,8 @@ var renderSvelteNotFound = async (conventionPath) => {
|
|
|
24847
25032
|
const { render } = await import("svelte/server");
|
|
24848
25033
|
const mod = await import(conventionPath);
|
|
24849
25034
|
const NotFoundComponent = mod.default;
|
|
25035
|
+
if (!NotFoundComponent)
|
|
25036
|
+
return null;
|
|
24850
25037
|
const { head, body } = render(NotFoundComponent);
|
|
24851
25038
|
const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
|
|
24852
25039
|
return new Response(html, {
|
|
@@ -24859,6 +25046,8 @@ var renderVueNotFound = async (conventionPath) => {
|
|
|
24859
25046
|
const { renderToString } = await import("vue/server-renderer");
|
|
24860
25047
|
const mod = await import(conventionPath);
|
|
24861
25048
|
const NotFoundComponent = mod.default;
|
|
25049
|
+
if (!NotFoundComponent)
|
|
25050
|
+
return null;
|
|
24862
25051
|
const app = createSSRApp({
|
|
24863
25052
|
render: () => h2(NotFoundComponent)
|
|
24864
25053
|
});
|
|
@@ -24872,10 +25061,17 @@ var renderVueNotFound = async (conventionPath) => {
|
|
|
24872
25061
|
};
|
|
24873
25062
|
var renderAngularNotFound = async (conventionPath) => {
|
|
24874
25063
|
const mod = await import(conventionPath);
|
|
24875
|
-
const
|
|
24876
|
-
if (typeof
|
|
25064
|
+
const renderFn = mod.default;
|
|
25065
|
+
if (typeof renderFn !== "function")
|
|
24877
25066
|
return null;
|
|
24878
|
-
const html =
|
|
25067
|
+
const html = renderFn();
|
|
25068
|
+
return new Response(html, {
|
|
25069
|
+
headers: { "Content-Type": "text/html" },
|
|
25070
|
+
status: 404
|
|
25071
|
+
});
|
|
25072
|
+
};
|
|
25073
|
+
var renderHtmlNotFound = async (conventionPath) => {
|
|
25074
|
+
const html = await Bun.file(conventionPath).text();
|
|
24879
25075
|
return new Response(html, {
|
|
24880
25076
|
headers: { "Content-Type": "text/html" },
|
|
24881
25077
|
status: 404
|
|
@@ -24884,6 +25080,7 @@ var renderAngularNotFound = async (conventionPath) => {
|
|
|
24884
25080
|
var NOT_FOUND_RENDERERS = {
|
|
24885
25081
|
angular: renderAngularNotFound,
|
|
24886
25082
|
ember: renderEmberNotFound,
|
|
25083
|
+
html: renderHtmlNotFound,
|
|
24887
25084
|
react: renderReactNotFound,
|
|
24888
25085
|
svelte: renderSvelteNotFound,
|
|
24889
25086
|
vue: renderVueNotFound
|
|
@@ -24906,7 +25103,8 @@ var NOT_FOUND_PRIORITY = [
|
|
|
24906
25103
|
"react",
|
|
24907
25104
|
"svelte",
|
|
24908
25105
|
"vue",
|
|
24909
|
-
"angular"
|
|
25106
|
+
"angular",
|
|
25107
|
+
"html"
|
|
24910
25108
|
];
|
|
24911
25109
|
var renderFirstNotFound = async () => {
|
|
24912
25110
|
const renderNext = async (frameworks2) => {
|
|
@@ -24956,7 +25154,7 @@ var collectPrewarmFiles = async (prewarmDirs) => {
|
|
|
24956
25154
|
for (const { dir, pattern } of prewarmDirs) {
|
|
24957
25155
|
const glob = new Glob10(pattern);
|
|
24958
25156
|
const matches = [
|
|
24959
|
-
...glob.scanSync({ absolute: true, cwd:
|
|
25157
|
+
...glob.scanSync({ absolute: true, cwd: resolve43(dir) })
|
|
24960
25158
|
];
|
|
24961
25159
|
files.push(...matches);
|
|
24962
25160
|
}
|
|
@@ -24967,7 +25165,7 @@ var warmPrewarmDirs = async (prewarmDirs, warmCache2, SRC_URL_PREFIX2) => {
|
|
|
24967
25165
|
for (const file5 of files) {
|
|
24968
25166
|
if (file5.includes("/node_modules/"))
|
|
24969
25167
|
continue;
|
|
24970
|
-
const rel =
|
|
25168
|
+
const rel = relative17(process.cwd(), file5).replace(/\\/g, "/");
|
|
24971
25169
|
warmCache2(`${SRC_URL_PREFIX2}${rel}`);
|
|
24972
25170
|
}
|
|
24973
25171
|
};
|
|
@@ -24992,10 +25190,10 @@ var patchManifestIndexes = (manifest, devIndexDir, SRC_URL_PREFIX2) => {
|
|
|
24992
25190
|
const fileName = resolveDevIndexFileName(manifest[key], baseName);
|
|
24993
25191
|
if (!fileName)
|
|
24994
25192
|
continue;
|
|
24995
|
-
const srcPath =
|
|
25193
|
+
const srcPath = resolve43(devIndexDir, fileName);
|
|
24996
25194
|
if (!existsSync30(srcPath))
|
|
24997
25195
|
continue;
|
|
24998
|
-
const rel =
|
|
25196
|
+
const rel = relative17(process.cwd(), srcPath).replace(/\\/g, "/");
|
|
24999
25197
|
manifest[key] = `${SRC_URL_PREFIX2}${rel}`;
|
|
25000
25198
|
}
|
|
25001
25199
|
};
|
|
@@ -25065,7 +25263,7 @@ var prepareDev = async (config, buildDir) => {
|
|
|
25065
25263
|
stepStartedAt = performance.now();
|
|
25066
25264
|
const hmrPlugin = hmr2(result.hmrState, result.manifest, moduleHandler);
|
|
25067
25265
|
const { devtoolsJson: devtoolsJson2 } = await Promise.resolve().then(() => (init_devtoolsJson(), exports_devtoolsJson));
|
|
25068
|
-
const devIndexDir =
|
|
25266
|
+
const devIndexDir = resolve43(buildDir, "_src_indexes");
|
|
25069
25267
|
patchManifestIndexes(result.manifest, devIndexDir, SRC_URL_PREFIX2);
|
|
25070
25268
|
recordStep("configure dev plugins", stepStartedAt);
|
|
25071
25269
|
stepStartedAt = performance.now();
|
|
@@ -25114,7 +25312,7 @@ var loadPrerenderMap = (prerenderDir) => {
|
|
|
25114
25312
|
continue;
|
|
25115
25313
|
const name = basename13(entry, ".html");
|
|
25116
25314
|
const route = name === "index" ? "/" : `/${name}`;
|
|
25117
|
-
map.set(route,
|
|
25315
|
+
map.set(route, join34(prerenderDir, entry));
|
|
25118
25316
|
}
|
|
25119
25317
|
return map;
|
|
25120
25318
|
};
|
|
@@ -25146,7 +25344,7 @@ var prepare = async (configOrPath) => {
|
|
|
25146
25344
|
recordStep("load config", stepStartedAt);
|
|
25147
25345
|
const nodeEnv = process.env["NODE_ENV"];
|
|
25148
25346
|
const isDev3 = nodeEnv === "development";
|
|
25149
|
-
const buildDir =
|
|
25347
|
+
const buildDir = resolve43(process.env.ABSOLUTE_BUILD_DIR ?? config.buildDirectory ?? "build");
|
|
25150
25348
|
if (isDev3) {
|
|
25151
25349
|
stepStartedAt = performance.now();
|
|
25152
25350
|
const result = await prepareDev(config, buildDir);
|
|
@@ -25163,7 +25361,7 @@ var prepare = async (configOrPath) => {
|
|
|
25163
25361
|
setCurrentPageIslandMetadata(await loadPageIslandMetadata(config));
|
|
25164
25362
|
recordStep("load production manifest and island metadata", stepStartedAt);
|
|
25165
25363
|
stepStartedAt = performance.now();
|
|
25166
|
-
const conventionsPath =
|
|
25364
|
+
const conventionsPath = join34(buildDir, "conventions.json");
|
|
25167
25365
|
if (existsSync30(conventionsPath)) {
|
|
25168
25366
|
const conventions2 = JSON.parse(readFileSync23(conventionsPath, "utf-8"));
|
|
25169
25367
|
setConventions(conventions2);
|
|
@@ -25179,7 +25377,7 @@ var prepare = async (configOrPath) => {
|
|
|
25179
25377
|
});
|
|
25180
25378
|
recordStep("create static plugin", stepStartedAt);
|
|
25181
25379
|
stepStartedAt = performance.now();
|
|
25182
|
-
const prerenderDir =
|
|
25380
|
+
const prerenderDir = join34(buildDir, "_prerendered");
|
|
25183
25381
|
const prerenderMap = loadPrerenderMap(prerenderDir);
|
|
25184
25382
|
recordStep("load prerender map", stepStartedAt);
|
|
25185
25383
|
if (prerenderMap.size > 0) {
|
|
@@ -25238,10 +25436,10 @@ var {env: env4 } = globalThis.Bun;
|
|
|
25238
25436
|
|
|
25239
25437
|
// src/dev/devCert.ts
|
|
25240
25438
|
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 =
|
|
25439
|
+
import { join as join35 } from "path";
|
|
25440
|
+
var CERT_DIR = join35(process.cwd(), ".absolutejs");
|
|
25441
|
+
var CERT_PATH = join35(CERT_DIR, "cert.pem");
|
|
25442
|
+
var KEY_PATH = join35(CERT_DIR, "key.pem");
|
|
25245
25443
|
var CERT_VALIDITY_DAYS = 365;
|
|
25246
25444
|
var devLog = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[36m[dev]\x1B[0m ${msg}`);
|
|
25247
25445
|
var devWarn = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[33m[dev]\x1B[0m \x1B[33m${msg}\x1B[0m`);
|
|
@@ -25436,6 +25634,9 @@ var pageRouterPlugin = () => {
|
|
|
25436
25634
|
init_devtoolsJson();
|
|
25437
25635
|
// src/utils/defineConfig.ts
|
|
25438
25636
|
var defineConfig = (config) => config;
|
|
25637
|
+
// src/utils/defineConvention.ts
|
|
25638
|
+
var defineRenderErrorPage = (fn2) => fn2;
|
|
25639
|
+
var defineRenderNotFoundPage = (fn2) => fn2;
|
|
25439
25640
|
// src/utils/generateHeadElement.ts
|
|
25440
25641
|
var renderRobotsContent = (robots) => {
|
|
25441
25642
|
const directives = [];
|
|
@@ -25574,7 +25775,7 @@ var jsonLd2 = (schema) => {
|
|
|
25574
25775
|
// src/utils/defineEnv.ts
|
|
25575
25776
|
var {env: bunEnv } = globalThis.Bun;
|
|
25576
25777
|
import { existsSync as existsSync32, readFileSync as readFileSync25 } from "fs";
|
|
25577
|
-
import { resolve as
|
|
25778
|
+
import { resolve as resolve44 } from "path";
|
|
25578
25779
|
|
|
25579
25780
|
// node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
|
|
25580
25781
|
var exports_value = {};
|
|
@@ -31609,7 +31810,7 @@ ${lines.join(`
|
|
|
31609
31810
|
};
|
|
31610
31811
|
var checkEnvFileSecurity = (properties) => {
|
|
31611
31812
|
const cwd2 = process.cwd();
|
|
31612
|
-
const envPath =
|
|
31813
|
+
const envPath = resolve44(cwd2, ".env");
|
|
31613
31814
|
if (!existsSync32(envPath))
|
|
31614
31815
|
return;
|
|
31615
31816
|
const sensitiveKeys = Object.keys(properties).filter(isSensitive);
|
|
@@ -31619,7 +31820,7 @@ var checkEnvFileSecurity = (properties) => {
|
|
|
31619
31820
|
const presentKeys = sensitiveKeys.filter((key) => envContent.includes(`${key}=`));
|
|
31620
31821
|
if (presentKeys.length === 0)
|
|
31621
31822
|
return;
|
|
31622
|
-
const gitignorePath =
|
|
31823
|
+
const gitignorePath = resolve44(cwd2, ".gitignore");
|
|
31623
31824
|
if (existsSync32(gitignorePath)) {
|
|
31624
31825
|
const gitignore = readFileSync25(gitignorePath, "utf-8");
|
|
31625
31826
|
if (gitignore.split(`
|
|
@@ -31766,6 +31967,8 @@ export {
|
|
|
31766
31967
|
enhanceHtmlResponseWithStreamingSlots,
|
|
31767
31968
|
disposeTailwindCompiler,
|
|
31768
31969
|
devtoolsJson,
|
|
31970
|
+
defineRenderNotFoundPage,
|
|
31971
|
+
defineRenderErrorPage,
|
|
31769
31972
|
defineIslandRegistry,
|
|
31770
31973
|
defineIslandComponent,
|
|
31771
31974
|
defineEnv,
|
|
@@ -31859,5 +32062,5 @@ export {
|
|
|
31859
32062
|
ANGULAR_INIT_TIMEOUT_MS
|
|
31860
32063
|
};
|
|
31861
32064
|
|
|
31862
|
-
//# debugId=
|
|
32065
|
+
//# debugId=1D5D4C42226608CC64756E2164756E21
|
|
31863
32066
|
//# sourceMappingURL=index.js.map
|