@absolutejs/absolute 0.19.0-beta.928 → 0.19.0-beta.929
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 +221 -118
- package/dist/angular/index.js.map +5 -4
- package/dist/angular/server.js +203 -100
- package/dist/angular/server.js.map +5 -4
- package/dist/build.js +687 -565
- package/dist/build.js.map +9 -8
- package/dist/index.js +738 -616
- package/dist/index.js.map +9 -8
- package/dist/islands/index.js +105 -2
- package/dist/islands/index.js.map +5 -4
- package/dist/react/index.js +105 -2
- package/dist/react/index.js.map +5 -4
- package/dist/src/core/normalizeIslandProps.d.ts +15 -0
- package/dist/src/core/vueServerModule.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 +105 -2
- package/dist/svelte/index.js.map +5 -4
- package/dist/vue/browser.js +57 -4
- package/dist/vue/browser.js.map +5 -4
- package/dist/vue/index.js +172 -8
- package/dist/vue/index.js.map +8 -6
- package/dist/vue/server.js +11 -4
- package/dist/vue/server.js.map +3 -3
- 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,7 +13063,7 @@ 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
|
});
|
|
@@ -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
|
}));
|
|
@@ -14934,9 +15039,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14934
15039
|
}
|
|
14935
15040
|
const shouldIncludeHtmlAssets = !isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/html/") && (f2.endsWith(".html") || isStylePath(f2)));
|
|
14936
15041
|
const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
|
|
14937
|
-
if (entry.startsWith(
|
|
15042
|
+
if (entry.startsWith(resolve25(reactIndexesPath))) {
|
|
14938
15043
|
const pageName = basename9(entry, ".tsx");
|
|
14939
|
-
return
|
|
15044
|
+
return join26(reactPagesPath, `${pageName}.tsx`);
|
|
14940
15045
|
}
|
|
14941
15046
|
return null;
|
|
14942
15047
|
}) : allReactEntries;
|
|
@@ -15013,7 +15118,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15013
15118
|
const clientPath = islandSvelteClientPaths[idx];
|
|
15014
15119
|
if (!sourcePath || !clientPath)
|
|
15015
15120
|
continue;
|
|
15016
|
-
islandSvelteClientPathMap.set(
|
|
15121
|
+
islandSvelteClientPathMap.set(resolve25(sourcePath), clientPath);
|
|
15017
15122
|
}
|
|
15018
15123
|
const islandVueClientPathMap = new Map;
|
|
15019
15124
|
for (let idx = 0;idx < islandVueSources.length; idx++) {
|
|
@@ -15021,7 +15126,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15021
15126
|
const clientPath = islandVueClientPaths[idx];
|
|
15022
15127
|
if (!sourcePath || !clientPath)
|
|
15023
15128
|
continue;
|
|
15024
|
-
islandVueClientPathMap.set(
|
|
15129
|
+
islandVueClientPathMap.set(resolve25(sourcePath), clientPath);
|
|
15025
15130
|
}
|
|
15026
15131
|
const islandAngularClientPathMap = new Map;
|
|
15027
15132
|
for (let idx = 0;idx < islandAngularSources.length; idx++) {
|
|
@@ -15029,7 +15134,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15029
15134
|
const clientPath = islandAngularClientPaths[idx];
|
|
15030
15135
|
if (!sourcePath || !clientPath)
|
|
15031
15136
|
continue;
|
|
15032
|
-
islandAngularClientPathMap.set(
|
|
15137
|
+
islandAngularClientPathMap.set(resolve25(sourcePath), clientPath);
|
|
15033
15138
|
}
|
|
15034
15139
|
const reactConventionSources = collectConventionSourceFiles(conventionsMap.react);
|
|
15035
15140
|
const svelteConventionSources = collectConventionSourceFiles(conventionsMap.svelte);
|
|
@@ -15040,7 +15145,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15040
15145
|
const compileReactConventions = async () => {
|
|
15041
15146
|
if (reactConventionSources.length === 0)
|
|
15042
15147
|
return emptyStringArray;
|
|
15043
|
-
const destDir =
|
|
15148
|
+
const destDir = join26(buildPath, "conventions", "react");
|
|
15044
15149
|
rmSync2(destDir, { force: true, recursive: true });
|
|
15045
15150
|
mkdirSync11(destDir, { recursive: true });
|
|
15046
15151
|
const destPaths = [];
|
|
@@ -15056,7 +15161,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15056
15161
|
naming: `${idx}-[name].[ext]`,
|
|
15057
15162
|
outdir: destDir,
|
|
15058
15163
|
plugins: [stylePreprocessorPlugin2],
|
|
15059
|
-
root:
|
|
15164
|
+
root: dirname16(source),
|
|
15060
15165
|
target: "bun",
|
|
15061
15166
|
throw: false,
|
|
15062
15167
|
tsconfig: "./tsconfig.json"
|
|
@@ -15084,7 +15189,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15084
15189
|
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
15190
|
]);
|
|
15086
15191
|
const bundleConventionFiles = async (framework, compiledPaths) => {
|
|
15087
|
-
const destDir =
|
|
15192
|
+
const destDir = join26(buildPath, "conventions", framework);
|
|
15088
15193
|
rmSync2(destDir, { force: true, recursive: true });
|
|
15089
15194
|
mkdirSync11(destDir, { recursive: true });
|
|
15090
15195
|
const destPaths = [];
|
|
@@ -15158,7 +15263,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15158
15263
|
}
|
|
15159
15264
|
})) : {
|
|
15160
15265
|
entries: [],
|
|
15161
|
-
generatedRoot:
|
|
15266
|
+
generatedRoot: join26(buildPath, "_island_entries")
|
|
15162
15267
|
};
|
|
15163
15268
|
const islandClientEntryPoints = islandEntryResult.entries.map((entry) => entry.entryPath);
|
|
15164
15269
|
if (serverEntryPoints.length === 0 && reactClientEntryPoints.length === 0 && nonReactClientEntryPoints.length === 0 && islandClientEntryPoints.length === 0 && htmxDir === undefined && htmlDir === undefined) {
|
|
@@ -15194,7 +15299,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15194
15299
|
return {};
|
|
15195
15300
|
}
|
|
15196
15301
|
if (hmr && reactIndexesPath && reactClientEntryPoints.length > 0) {
|
|
15197
|
-
const refreshEntry =
|
|
15302
|
+
const refreshEntry = join26(reactIndexesPath, "_refresh.tsx");
|
|
15198
15303
|
if (!reactClientEntryPoints.includes(refreshEntry))
|
|
15199
15304
|
reactClientEntryPoints.push(refreshEntry);
|
|
15200
15305
|
}
|
|
@@ -15293,19 +15398,19 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15293
15398
|
throw: false
|
|
15294
15399
|
}, resolveBunBuildOverride(bunBuildConfig, "reactClient")) : undefined;
|
|
15295
15400
|
if (reactDir && reactClientEntryPoints.length > 0) {
|
|
15296
|
-
rmSync2(
|
|
15401
|
+
rmSync2(join26(buildPath, "react", "generated", "indexes"), {
|
|
15297
15402
|
force: true,
|
|
15298
15403
|
recursive: true
|
|
15299
15404
|
});
|
|
15300
15405
|
}
|
|
15301
15406
|
if (angularDir && angularClientPaths.length > 0) {
|
|
15302
|
-
rmSync2(
|
|
15407
|
+
rmSync2(join26(buildPath, "angular", "indexes"), {
|
|
15303
15408
|
force: true,
|
|
15304
15409
|
recursive: true
|
|
15305
15410
|
});
|
|
15306
15411
|
}
|
|
15307
15412
|
if (islandClientEntryPoints.length > 0) {
|
|
15308
|
-
rmSync2(
|
|
15413
|
+
rmSync2(join26(buildPath, "islands"), {
|
|
15309
15414
|
force: true,
|
|
15310
15415
|
recursive: true
|
|
15311
15416
|
});
|
|
@@ -15388,7 +15493,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15388
15493
|
globalCssEntries.length > 0 ? tracePhase("bun/global-css", () => bunBuild7(mergeBunBuildConfig({
|
|
15389
15494
|
entrypoints: globalCssEntries,
|
|
15390
15495
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
15391
|
-
outdir: stylesDir ?
|
|
15496
|
+
outdir: stylesDir ? join26(buildPath, basename9(stylesDir)) : buildPath,
|
|
15392
15497
|
plugins: [stylePreprocessorPlugin2],
|
|
15393
15498
|
root: stylesDir || clientRoot,
|
|
15394
15499
|
target: "browser",
|
|
@@ -15397,7 +15502,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15397
15502
|
vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () => bunBuild7(mergeBunBuildConfig({
|
|
15398
15503
|
entrypoints: vueCssPaths,
|
|
15399
15504
|
naming: `[name].[hash].[ext]`,
|
|
15400
|
-
outdir:
|
|
15505
|
+
outdir: join26(buildPath, assetsPath ? basename9(assetsPath) : "assets", "css"),
|
|
15401
15506
|
target: "browser",
|
|
15402
15507
|
throw: false
|
|
15403
15508
|
}, resolveBunBuildOverride(bunBuildConfig, "vueCss")))) : undefined
|
|
@@ -15464,10 +15569,10 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15464
15569
|
if (serverOutputs.length > 0 && angularServerVendorPaths2 && Object.keys(angularServerVendorPaths2).length > 0) {
|
|
15465
15570
|
const { rewriteBuildOutputsWith: rewriteBuildOutputsWith2 } = await Promise.resolve().then(() => (init_rewriteImportsPlugin(), exports_rewriteImportsPlugin));
|
|
15466
15571
|
await tracePhase("postprocess/server-angular-vendor-imports", () => rewriteBuildOutputsWith2(serverOutputs, (artifact) => {
|
|
15467
|
-
const fileDir =
|
|
15572
|
+
const fileDir = dirname16(artifact.path);
|
|
15468
15573
|
const relativePaths = {};
|
|
15469
15574
|
for (const [specifier, absolute] of Object.entries(angularServerVendorPaths2)) {
|
|
15470
|
-
const rel =
|
|
15575
|
+
const rel = relative12(fileDir, absolute);
|
|
15471
15576
|
relativePaths[specifier] = rel.startsWith(".") ? rel : `./${rel}`;
|
|
15472
15577
|
}
|
|
15473
15578
|
return relativePaths;
|
|
@@ -15536,7 +15641,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15536
15641
|
if (skipAngularClientBundle) {
|
|
15537
15642
|
for (const clientPath of angularClientPaths) {
|
|
15538
15643
|
const fileBase = basename9(clientPath, ".js");
|
|
15539
|
-
const relFromCwd =
|
|
15644
|
+
const relFromCwd = relative12(projectRoot, clientPath).replace(/\\/g, "/");
|
|
15540
15645
|
manifest[`${toPascal(fileBase)}Index`] = `/@src/${relFromCwd}`;
|
|
15541
15646
|
}
|
|
15542
15647
|
}
|
|
@@ -15558,7 +15663,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15558
15663
|
const processHtmlPages = async () => {
|
|
15559
15664
|
if (!(htmlDir && htmlPagesPath))
|
|
15560
15665
|
return;
|
|
15561
|
-
const outputHtmlPages = isSingle ?
|
|
15666
|
+
const outputHtmlPages = isSingle ? join26(buildPath, "pages") : join26(buildPath, basename9(htmlDir), "pages");
|
|
15562
15667
|
mkdirSync11(outputHtmlPages, { recursive: true });
|
|
15563
15668
|
cpSync(htmlPagesPath, outputHtmlPages, {
|
|
15564
15669
|
force: true,
|
|
@@ -15580,14 +15685,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15580
15685
|
const processHtmxPages = async () => {
|
|
15581
15686
|
if (!(htmxDir && htmxPagesPath))
|
|
15582
15687
|
return;
|
|
15583
|
-
const outputHtmxPages = isSingle ?
|
|
15688
|
+
const outputHtmxPages = isSingle ? join26(buildPath, "pages") : join26(buildPath, basename9(htmxDir), "pages");
|
|
15584
15689
|
mkdirSync11(outputHtmxPages, { recursive: true });
|
|
15585
15690
|
cpSync(htmxPagesPath, outputHtmxPages, {
|
|
15586
15691
|
force: true,
|
|
15587
15692
|
recursive: true
|
|
15588
15693
|
});
|
|
15589
15694
|
if (shouldCopyHtmx) {
|
|
15590
|
-
const htmxDestDir = isSingle ? buildPath :
|
|
15695
|
+
const htmxDestDir = isSingle ? buildPath : join26(buildPath, basename9(htmxDir));
|
|
15591
15696
|
copyHtmxVendor(htmxDir, htmxDestDir);
|
|
15592
15697
|
}
|
|
15593
15698
|
if (shouldUpdateHtmxAssetPaths) {
|
|
@@ -15649,9 +15754,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15649
15754
|
writeBuildTrace(buildPath);
|
|
15650
15755
|
return { conventions: conventionsMap, manifest };
|
|
15651
15756
|
}
|
|
15652
|
-
writeFileSync8(
|
|
15757
|
+
writeFileSync8(join26(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
|
|
15653
15758
|
if (Object.keys(conventionsMap).length > 0) {
|
|
15654
|
-
writeFileSync8(
|
|
15759
|
+
writeFileSync8(join26(buildPath, "conventions.json"), JSON.stringify(conventionsMap, null, "\t"));
|
|
15655
15760
|
}
|
|
15656
15761
|
writeBuildTrace(buildPath);
|
|
15657
15762
|
if (tailwind && mode === "production") {
|
|
@@ -15752,7 +15857,7 @@ var init_build = __esm(() => {
|
|
|
15752
15857
|
|
|
15753
15858
|
// src/build/buildEmberVendor.ts
|
|
15754
15859
|
import { mkdirSync as mkdirSync12, existsSync as existsSync21 } from "fs";
|
|
15755
|
-
import { join as
|
|
15860
|
+
import { join as join27 } from "path";
|
|
15756
15861
|
import { rm as rm9 } from "fs/promises";
|
|
15757
15862
|
var {build: bunBuild8 } = globalThis.Bun;
|
|
15758
15863
|
var toSafeFileName5 = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_"), generateMacrosShim = () => `// Generated shim for @embroider/macros \u2014 provides minimal runtime
|
|
@@ -15804,7 +15909,7 @@ export const importSync = (specifier) => {
|
|
|
15804
15909
|
if (standaloneSpecifiers.has(specifier)) {
|
|
15805
15910
|
return { resolveTo: specifier, specifier };
|
|
15806
15911
|
}
|
|
15807
|
-
const emberInternalPath =
|
|
15912
|
+
const emberInternalPath = join27(cwd2, "node_modules/ember-source/dist/packages", specifier, "index.js");
|
|
15808
15913
|
if (!existsSync21(emberInternalPath)) {
|
|
15809
15914
|
throw new Error(`Ember vendor build: cannot find ${specifier} at ${emberInternalPath}. ` + `Is ember-source installed and at least 6.12?`);
|
|
15810
15915
|
}
|
|
@@ -15836,7 +15941,7 @@ export const importSync = (specifier) => {
|
|
|
15836
15941
|
if (standalonePackages.has(args.path)) {
|
|
15837
15942
|
return;
|
|
15838
15943
|
}
|
|
15839
|
-
const internal =
|
|
15944
|
+
const internal = join27(cwd2, "node_modules/ember-source/dist/packages", args.path, "index.js");
|
|
15840
15945
|
if (existsSync21(internal)) {
|
|
15841
15946
|
return { path: internal };
|
|
15842
15947
|
}
|
|
@@ -15844,16 +15949,16 @@ export const importSync = (specifier) => {
|
|
|
15844
15949
|
});
|
|
15845
15950
|
}
|
|
15846
15951
|
}), buildEmberVendor = async (buildDir, cwd2 = process.cwd()) => {
|
|
15847
|
-
const vendorDir =
|
|
15952
|
+
const vendorDir = join27(buildDir, "ember", "vendor");
|
|
15848
15953
|
mkdirSync12(vendorDir, { recursive: true });
|
|
15849
|
-
const tmpDir =
|
|
15954
|
+
const tmpDir = join27(buildDir, "_ember_vendor_tmp");
|
|
15850
15955
|
mkdirSync12(tmpDir, { recursive: true });
|
|
15851
|
-
const macrosShimPath =
|
|
15956
|
+
const macrosShimPath = join27(tmpDir, "embroider_macros_shim.js");
|
|
15852
15957
|
await Bun.write(macrosShimPath, generateMacrosShim());
|
|
15853
15958
|
const resolutions = REQUIRED_EMBER_SPECIFIERS.map((specifier) => resolveEmberSpecifier(specifier, cwd2));
|
|
15854
15959
|
const entrypoints = await Promise.all(resolutions.map(async (resolution) => {
|
|
15855
15960
|
const safeName = toSafeFileName5(resolution.specifier);
|
|
15856
|
-
const entryPath =
|
|
15961
|
+
const entryPath = join27(tmpDir, `${safeName}.js`);
|
|
15857
15962
|
const source = resolution.specifier === "@embroider/macros" ? `export * from ${JSON.stringify(macrosShimPath)};
|
|
15858
15963
|
` : generateVendorEntrySource2(resolution);
|
|
15859
15964
|
await Bun.write(entryPath, source);
|
|
@@ -15899,7 +16004,7 @@ var init_buildEmberVendor = __esm(() => {
|
|
|
15899
16004
|
// src/dev/dependencyGraph.ts
|
|
15900
16005
|
import { existsSync as existsSync22, readFileSync as readFileSync15 } from "fs";
|
|
15901
16006
|
var {Glob: Glob8 } = globalThis.Bun;
|
|
15902
|
-
import { resolve as
|
|
16007
|
+
import { resolve as resolve26 } from "path";
|
|
15903
16008
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
15904
16009
|
const lower = filePath.toLowerCase();
|
|
15905
16010
|
if (lower.endsWith(".ts") || lower.endsWith(".tsx") || lower.endsWith(".jsx"))
|
|
@@ -15913,8 +16018,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15913
16018
|
if (!importPath.startsWith(".") && !importPath.startsWith("/")) {
|
|
15914
16019
|
return null;
|
|
15915
16020
|
}
|
|
15916
|
-
const fromDir =
|
|
15917
|
-
const normalized =
|
|
16021
|
+
const fromDir = resolve26(fromFile, "..");
|
|
16022
|
+
const normalized = resolve26(fromDir, importPath);
|
|
15918
16023
|
const extensions = [
|
|
15919
16024
|
".ts",
|
|
15920
16025
|
".tsx",
|
|
@@ -15944,7 +16049,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15944
16049
|
dependents.delete(normalizedPath);
|
|
15945
16050
|
}
|
|
15946
16051
|
}, addFileToGraph = (graph, filePath) => {
|
|
15947
|
-
const normalizedPath =
|
|
16052
|
+
const normalizedPath = resolve26(filePath);
|
|
15948
16053
|
if (!existsSync22(normalizedPath))
|
|
15949
16054
|
return;
|
|
15950
16055
|
const dependencies = extractDependencies(normalizedPath);
|
|
@@ -15961,10 +16066,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15961
16066
|
}, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
|
|
15962
16067
|
const processedFiles = new Set;
|
|
15963
16068
|
const glob = new Glob8("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
|
|
15964
|
-
const resolvedDirs = directories.map((dir) =>
|
|
16069
|
+
const resolvedDirs = directories.map((dir) => resolve26(dir)).filter((dir) => existsSync22(dir));
|
|
15965
16070
|
const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
|
|
15966
16071
|
for (const file5 of allFiles) {
|
|
15967
|
-
const fullPath =
|
|
16072
|
+
const fullPath = resolve26(file5);
|
|
15968
16073
|
if (IGNORED_SEGMENTS.some((seg) => fullPath.includes(seg)))
|
|
15969
16074
|
continue;
|
|
15970
16075
|
if (processedFiles.has(fullPath))
|
|
@@ -16019,8 +16124,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
16019
16124
|
resolveRegexMatches(styleUrlSingularRegex, content, filePath, dependencies);
|
|
16020
16125
|
extractStyleUrlsDependencies(content, filePath, dependencies);
|
|
16021
16126
|
}, extractJsDependencies = (filePath, content, loader) => {
|
|
16022
|
-
const
|
|
16023
|
-
const imports =
|
|
16127
|
+
const transpiler6 = loader === "tsx" ? tsTranspiler : jsTranspiler;
|
|
16128
|
+
const imports = transpiler6.scanImports(content);
|
|
16024
16129
|
const dependencies = [];
|
|
16025
16130
|
for (const imp of imports) {
|
|
16026
16131
|
const resolved = resolveImportPath2(imp.path, filePath);
|
|
@@ -16077,7 +16182,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
16077
16182
|
return [];
|
|
16078
16183
|
}
|
|
16079
16184
|
}, getAffectedFiles = (graph, changedFile) => {
|
|
16080
|
-
const normalizedPath =
|
|
16185
|
+
const normalizedPath = resolve26(changedFile);
|
|
16081
16186
|
const affected = new Set;
|
|
16082
16187
|
const toProcess = [normalizedPath];
|
|
16083
16188
|
const processNode = (current) => {
|
|
@@ -16117,7 +16222,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
16117
16222
|
}
|
|
16118
16223
|
graph.dependents.delete(normalizedPath);
|
|
16119
16224
|
}, removeFileFromGraph = (graph, filePath) => {
|
|
16120
|
-
const normalizedPath =
|
|
16225
|
+
const normalizedPath = resolve26(filePath);
|
|
16121
16226
|
removeDepsForFile(graph, normalizedPath);
|
|
16122
16227
|
removeDependentsForFile(graph, normalizedPath);
|
|
16123
16228
|
};
|
|
@@ -16160,12 +16265,12 @@ var globalVersionCounter = 0, createModuleVersionTracker = () => new Map, getNex
|
|
|
16160
16265
|
};
|
|
16161
16266
|
|
|
16162
16267
|
// src/dev/configResolver.ts
|
|
16163
|
-
import { resolve as
|
|
16268
|
+
import { resolve as resolve27 } from "path";
|
|
16164
16269
|
var resolveBuildPaths = (config) => {
|
|
16165
16270
|
const cwd2 = process.cwd();
|
|
16166
16271
|
const normalize = (path) => path.replace(/\\/g, "/");
|
|
16167
|
-
const withDefault = (value, fallback) => normalize(
|
|
16168
|
-
const optional = (value) => value ? normalize(
|
|
16272
|
+
const withDefault = (value, fallback) => normalize(resolve27(cwd2, value ?? fallback));
|
|
16273
|
+
const optional = (value) => value ? normalize(resolve27(cwd2, value)) : undefined;
|
|
16169
16274
|
return {
|
|
16170
16275
|
angularDir: optional(config.angularDirectory),
|
|
16171
16276
|
assetsDir: optional(config.assetsDirectory),
|
|
@@ -16218,7 +16323,7 @@ var init_clientManager = __esm(() => {
|
|
|
16218
16323
|
|
|
16219
16324
|
// src/dev/pathUtils.ts
|
|
16220
16325
|
import { existsSync as existsSync23, readdirSync, readFileSync as readFileSync16 } from "fs";
|
|
16221
|
-
import { dirname as
|
|
16326
|
+
import { dirname as dirname17, resolve as resolve28 } from "path";
|
|
16222
16327
|
var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
16223
16328
|
if (shouldIgnorePath(filePath, resolved)) {
|
|
16224
16329
|
return "ignored";
|
|
@@ -16294,7 +16399,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
16294
16399
|
return "unknown";
|
|
16295
16400
|
}, collectAngularResourceDirs = (angularDir) => {
|
|
16296
16401
|
const out = new Set;
|
|
16297
|
-
const angularRoot =
|
|
16402
|
+
const angularRoot = resolve28(angularDir);
|
|
16298
16403
|
const angularRootNormalized = normalizePath(angularRoot);
|
|
16299
16404
|
const walk = (dir) => {
|
|
16300
16405
|
let entries;
|
|
@@ -16307,7 +16412,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
16307
16412
|
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
16308
16413
|
continue;
|
|
16309
16414
|
}
|
|
16310
|
-
const full =
|
|
16415
|
+
const full = resolve28(dir, entry.name);
|
|
16311
16416
|
if (entry.isDirectory()) {
|
|
16312
16417
|
walk(full);
|
|
16313
16418
|
continue;
|
|
@@ -16346,10 +16451,10 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
16346
16451
|
refs.push(strMatch[1]);
|
|
16347
16452
|
}
|
|
16348
16453
|
}
|
|
16349
|
-
const componentDir =
|
|
16454
|
+
const componentDir = dirname17(full);
|
|
16350
16455
|
for (const ref of refs) {
|
|
16351
|
-
const refAbs = normalizePath(
|
|
16352
|
-
const refDir = normalizePath(
|
|
16456
|
+
const refAbs = normalizePath(resolve28(componentDir, ref));
|
|
16457
|
+
const refDir = normalizePath(dirname17(refAbs));
|
|
16353
16458
|
if (refDir === angularRootNormalized || refDir.startsWith(angularRootNormalized + "/")) {
|
|
16354
16459
|
continue;
|
|
16355
16460
|
}
|
|
@@ -16365,7 +16470,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
16365
16470
|
const push = (path) => {
|
|
16366
16471
|
if (!path)
|
|
16367
16472
|
return;
|
|
16368
|
-
const abs = normalizePath(
|
|
16473
|
+
const abs = normalizePath(resolve28(cwd2, path));
|
|
16369
16474
|
if (!roots.includes(abs))
|
|
16370
16475
|
roots.push(abs);
|
|
16371
16476
|
};
|
|
@@ -16390,7 +16495,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
16390
16495
|
push(cfg.assetsDir);
|
|
16391
16496
|
push(cfg.stylesDir);
|
|
16392
16497
|
for (const candidate of ["src", "db", "assets", "styles"]) {
|
|
16393
|
-
const abs = normalizePath(
|
|
16498
|
+
const abs = normalizePath(resolve28(cwd2, candidate));
|
|
16394
16499
|
if (existsSync23(abs) && !roots.includes(abs))
|
|
16395
16500
|
roots.push(abs);
|
|
16396
16501
|
}
|
|
@@ -16461,7 +16566,7 @@ var init_pathUtils = __esm(() => {
|
|
|
16461
16566
|
// src/dev/fileWatcher.ts
|
|
16462
16567
|
import { watch } from "fs";
|
|
16463
16568
|
import { existsSync as existsSync24 } from "fs";
|
|
16464
|
-
import { join as
|
|
16569
|
+
import { join as join28, resolve as resolve29 } from "path";
|
|
16465
16570
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
16466
16571
|
try {
|
|
16467
16572
|
removeFileFromGraph(graph, fullPath);
|
|
@@ -16488,7 +16593,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
16488
16593
|
if (shouldSkipFilename(filename, isStylesDir)) {
|
|
16489
16594
|
return;
|
|
16490
16595
|
}
|
|
16491
|
-
const fullPath =
|
|
16596
|
+
const fullPath = join28(absolutePath, filename).replace(/\\/g, "/");
|
|
16492
16597
|
if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
|
|
16493
16598
|
return;
|
|
16494
16599
|
}
|
|
@@ -16506,7 +16611,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
16506
16611
|
}, addFileWatchers = (state, paths, onFileChange) => {
|
|
16507
16612
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
16508
16613
|
paths.forEach((path) => {
|
|
16509
|
-
const absolutePath =
|
|
16614
|
+
const absolutePath = resolve29(path).replace(/\\/g, "/");
|
|
16510
16615
|
if (!existsSync24(absolutePath)) {
|
|
16511
16616
|
return;
|
|
16512
16617
|
}
|
|
@@ -16517,7 +16622,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
16517
16622
|
const watchPaths = getWatchPaths(config, state.resolvedPaths);
|
|
16518
16623
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
16519
16624
|
watchPaths.forEach((path) => {
|
|
16520
|
-
const absolutePath =
|
|
16625
|
+
const absolutePath = resolve29(path).replace(/\\/g, "/");
|
|
16521
16626
|
if (!existsSync24(absolutePath)) {
|
|
16522
16627
|
return;
|
|
16523
16628
|
}
|
|
@@ -16532,13 +16637,13 @@ var init_fileWatcher = __esm(() => {
|
|
|
16532
16637
|
});
|
|
16533
16638
|
|
|
16534
16639
|
// src/dev/assetStore.ts
|
|
16535
|
-
import { resolve as
|
|
16640
|
+
import { resolve as resolve30 } from "path";
|
|
16536
16641
|
import { readdir as readdir4, unlink } from "fs/promises";
|
|
16537
16642
|
var mimeTypes, getMimeType = (filePath) => {
|
|
16538
16643
|
const ext = filePath.slice(filePath.lastIndexOf("."));
|
|
16539
16644
|
return mimeTypes[ext] ?? "application/octet-stream";
|
|
16540
16645
|
}, HASHED_FILE_RE, stripHash = (webPath) => webPath.replace(/\.[a-z0-9]{8}(\.(js|css|mjs))$/, "$1"), processWalkEntry = (entry, dir, liveByIdentity, walkAndClean) => {
|
|
16541
|
-
const fullPath =
|
|
16646
|
+
const fullPath = resolve30(dir, entry.name);
|
|
16542
16647
|
if (entry.isDirectory()) {
|
|
16543
16648
|
return walkAndClean(fullPath);
|
|
16544
16649
|
}
|
|
@@ -16554,10 +16659,10 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
16554
16659
|
}, cleanStaleAssets = async (store, manifest, buildDir) => {
|
|
16555
16660
|
const liveByIdentity = new Map;
|
|
16556
16661
|
for (const webPath of store.keys()) {
|
|
16557
|
-
const diskPath =
|
|
16662
|
+
const diskPath = resolve30(buildDir, webPath.slice(1));
|
|
16558
16663
|
liveByIdentity.set(stripHash(diskPath), diskPath);
|
|
16559
16664
|
}
|
|
16560
|
-
const absBuildDir =
|
|
16665
|
+
const absBuildDir = resolve30(buildDir);
|
|
16561
16666
|
Object.values(manifest).forEach((val) => {
|
|
16562
16667
|
if (!HASHED_FILE_RE.test(val))
|
|
16563
16668
|
return;
|
|
@@ -16575,7 +16680,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
16575
16680
|
} catch {}
|
|
16576
16681
|
}, lookupAsset = (store, path) => store.get(path), processScanEntry = (entry, dir, prefix, store, scanDir) => {
|
|
16577
16682
|
if (entry.isDirectory()) {
|
|
16578
|
-
return scanDir(
|
|
16683
|
+
return scanDir(resolve30(dir, entry.name), `${prefix}${entry.name}/`);
|
|
16579
16684
|
}
|
|
16580
16685
|
if (!entry.name.startsWith("chunk-")) {
|
|
16581
16686
|
return null;
|
|
@@ -16584,7 +16689,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
16584
16689
|
if (store.has(webPath)) {
|
|
16585
16690
|
return null;
|
|
16586
16691
|
}
|
|
16587
|
-
return Bun.file(
|
|
16692
|
+
return Bun.file(resolve30(dir, entry.name)).bytes().then((bytes) => {
|
|
16588
16693
|
store.set(webPath, bytes);
|
|
16589
16694
|
return;
|
|
16590
16695
|
}).catch(() => {});
|
|
@@ -16606,7 +16711,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
16606
16711
|
for (const webPath of newIdentities.values()) {
|
|
16607
16712
|
if (store.has(webPath))
|
|
16608
16713
|
continue;
|
|
16609
|
-
loadPromises.push(Bun.file(
|
|
16714
|
+
loadPromises.push(Bun.file(resolve30(buildDir, webPath.slice(1))).bytes().then((bytes) => {
|
|
16610
16715
|
store.set(webPath, bytes);
|
|
16611
16716
|
return;
|
|
16612
16717
|
}).catch(() => {}));
|
|
@@ -16719,9 +16824,9 @@ var init_transformCache = __esm(() => {
|
|
|
16719
16824
|
});
|
|
16720
16825
|
|
|
16721
16826
|
// src/dev/reactComponentClassifier.ts
|
|
16722
|
-
import { resolve as
|
|
16827
|
+
import { resolve as resolve31 } from "path";
|
|
16723
16828
|
var classifyComponent = (filePath) => {
|
|
16724
|
-
const normalizedPath =
|
|
16829
|
+
const normalizedPath = resolve31(filePath);
|
|
16725
16830
|
if (normalizedPath.includes("/react/pages/")) {
|
|
16726
16831
|
return "server";
|
|
16727
16832
|
}
|
|
@@ -16733,7 +16838,7 @@ var classifyComponent = (filePath) => {
|
|
|
16733
16838
|
var init_reactComponentClassifier = () => {};
|
|
16734
16839
|
|
|
16735
16840
|
// src/dev/moduleMapper.ts
|
|
16736
|
-
import { basename as basename10, resolve as
|
|
16841
|
+
import { basename as basename10, resolve as resolve32 } from "path";
|
|
16737
16842
|
var buildModulePaths = (moduleKeys, manifest) => {
|
|
16738
16843
|
const modulePaths = {};
|
|
16739
16844
|
moduleKeys.forEach((key) => {
|
|
@@ -16743,7 +16848,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
16743
16848
|
});
|
|
16744
16849
|
return modulePaths;
|
|
16745
16850
|
}, processChangedFile = (sourceFile, framework, manifest, resolvedPaths, processedFiles) => {
|
|
16746
|
-
const normalizedFile =
|
|
16851
|
+
const normalizedFile = resolve32(sourceFile);
|
|
16747
16852
|
const normalizedPath = normalizedFile.replace(/\\/g, "/");
|
|
16748
16853
|
if (processedFiles.has(normalizedFile)) {
|
|
16749
16854
|
return null;
|
|
@@ -16779,7 +16884,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
16779
16884
|
});
|
|
16780
16885
|
return grouped;
|
|
16781
16886
|
}, mapSourceFileToManifestKeys = (sourceFile, framework, resolvedPaths) => {
|
|
16782
|
-
const normalizedFile =
|
|
16887
|
+
const normalizedFile = resolve32(sourceFile);
|
|
16783
16888
|
const fileName = basename10(normalizedFile);
|
|
16784
16889
|
const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|css|html)$/, "");
|
|
16785
16890
|
const pascalName = toPascal(baseName);
|
|
@@ -16954,7 +17059,7 @@ __export(exports_moduleServer, {
|
|
|
16954
17059
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
16955
17060
|
});
|
|
16956
17061
|
import { existsSync as existsSync25, readFileSync as readFileSync18, statSync as statSync2 } from "fs";
|
|
16957
|
-
import { basename as basename11, dirname as
|
|
17062
|
+
import { basename as basename11, dirname as dirname18, extname as extname8, join as join29, resolve as resolve33, relative as relative13 } from "path";
|
|
16958
17063
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
16959
17064
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
16960
17065
|
const allExports = [];
|
|
@@ -16974,7 +17079,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
|
|
|
16974
17079
|
${stubs}
|
|
16975
17080
|
`;
|
|
16976
17081
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
16977
|
-
const found = extensions.find((ext) => existsSync25(
|
|
17082
|
+
const found = extensions.find((ext) => existsSync25(resolve33(projectRoot, srcPath + ext)));
|
|
16978
17083
|
return found ? srcPath + found : srcPath;
|
|
16979
17084
|
}, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
16980
17085
|
const entries = Object.entries(vendorPaths).sort(([a], [b2]) => b2.length - a.length);
|
|
@@ -16989,7 +17094,7 @@ ${stubs}
|
|
|
16989
17094
|
return invalidationVersion > 0 ? `${mtime}.${invalidationVersion}` : `${mtime}`;
|
|
16990
17095
|
}, srcUrl = (relPath, projectRoot) => {
|
|
16991
17096
|
const base = `${SRC_PREFIX}${relPath.replace(/\\/g, "/")}`;
|
|
16992
|
-
const absPath =
|
|
17097
|
+
const absPath = resolve33(projectRoot, relPath);
|
|
16993
17098
|
const cached = mtimeCache.get(absPath);
|
|
16994
17099
|
if (cached !== undefined)
|
|
16995
17100
|
return `${base}?v=${buildVersion(cached, absPath)}`;
|
|
@@ -17001,12 +17106,12 @@ ${stubs}
|
|
|
17001
17106
|
return base;
|
|
17002
17107
|
}
|
|
17003
17108
|
}, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
|
|
17004
|
-
const absPath =
|
|
17005
|
-
const rel =
|
|
17109
|
+
const absPath = resolve33(fileDir, relPath);
|
|
17110
|
+
const rel = relative13(projectRoot, absPath);
|
|
17006
17111
|
const extension = extname8(rel);
|
|
17007
17112
|
let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
|
|
17008
17113
|
if (extname8(srcPath) === ".svelte") {
|
|
17009
|
-
srcPath =
|
|
17114
|
+
srcPath = relative13(projectRoot, resolveSvelteModulePath(resolve33(projectRoot, srcPath)));
|
|
17010
17115
|
}
|
|
17011
17116
|
return srcUrl(srcPath, projectRoot);
|
|
17012
17117
|
}, NODE_BUILTIN_RE, resolveAbsoluteSpecifier = (specifier, projectRoot) => {
|
|
@@ -17018,27 +17123,27 @@ ${stubs}
|
|
|
17018
17123
|
"import"
|
|
17019
17124
|
]);
|
|
17020
17125
|
if (fromExports)
|
|
17021
|
-
return
|
|
17126
|
+
return relative13(projectRoot, fromExports);
|
|
17022
17127
|
try {
|
|
17023
17128
|
const isScoped = specifier.startsWith("@");
|
|
17024
17129
|
const parts = specifier.split("/");
|
|
17025
17130
|
const packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];
|
|
17026
17131
|
const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
|
|
17027
17132
|
if (!subpath) {
|
|
17028
|
-
const pkgDir =
|
|
17029
|
-
const pkgJsonPath =
|
|
17133
|
+
const pkgDir = resolve33(projectRoot, "node_modules", packageName ?? "");
|
|
17134
|
+
const pkgJsonPath = join29(pkgDir, "package.json");
|
|
17030
17135
|
if (existsSync25(pkgJsonPath)) {
|
|
17031
17136
|
const pkg = JSON.parse(readFileSync18(pkgJsonPath, "utf-8"));
|
|
17032
17137
|
const esmEntry = typeof pkg.module === "string" && pkg.module || typeof pkg.browser === "string" && pkg.browser;
|
|
17033
17138
|
if (esmEntry) {
|
|
17034
|
-
const resolved =
|
|
17139
|
+
const resolved = resolve33(pkgDir, esmEntry);
|
|
17035
17140
|
if (existsSync25(resolved))
|
|
17036
|
-
return
|
|
17141
|
+
return relative13(projectRoot, resolved);
|
|
17037
17142
|
}
|
|
17038
17143
|
}
|
|
17039
17144
|
}
|
|
17040
17145
|
} catch {}
|
|
17041
|
-
return
|
|
17146
|
+
return relative13(projectRoot, Bun.resolveSync(specifier, projectRoot));
|
|
17042
17147
|
} catch {
|
|
17043
17148
|
return;
|
|
17044
17149
|
}
|
|
@@ -17063,28 +17168,28 @@ ${stubs}
|
|
|
17063
17168
|
};
|
|
17064
17169
|
result = result.replace(/^((?:import\s+[\s\S]+?\s+from|export\s+[\s\S]+?\s+from|import)\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
|
|
17065
17170
|
result = result.replace(/(import\s*\(\s*["'])([^"'./][^"']*)(["']\s*\))/g, stubReplace);
|
|
17066
|
-
const fileDir =
|
|
17171
|
+
const fileDir = dirname18(filePath);
|
|
17067
17172
|
result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
17068
17173
|
result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
17069
17174
|
result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}`);
|
|
17070
17175
|
const rewriteAbsoluteToSrc = (_match, prefix, absPath, _ext, suffix) => {
|
|
17071
17176
|
if (absPath.startsWith(projectRoot)) {
|
|
17072
|
-
const rel2 =
|
|
17177
|
+
const rel2 = relative13(projectRoot, absPath).replace(/\\/g, "/");
|
|
17073
17178
|
return `${prefix}${srcUrl(rel2, projectRoot)}${suffix}`;
|
|
17074
17179
|
}
|
|
17075
|
-
const rel =
|
|
17180
|
+
const rel = relative13(projectRoot, absPath).replace(/\\/g, "/");
|
|
17076
17181
|
return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
|
|
17077
17182
|
};
|
|
17078
17183
|
result = result.replace(/((?:from|import)\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["'])/g, rewriteAbsoluteToSrc);
|
|
17079
17184
|
result = result.replace(/(import\s*\(\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["']\s*\))/g, rewriteAbsoluteToSrc);
|
|
17080
17185
|
result = result.replace(/new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g, (_match, relPath) => {
|
|
17081
|
-
const absPath =
|
|
17082
|
-
const rel =
|
|
17186
|
+
const absPath = resolve33(fileDir, relPath);
|
|
17187
|
+
const rel = relative13(projectRoot, absPath);
|
|
17083
17188
|
return `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;
|
|
17084
17189
|
});
|
|
17085
17190
|
result = result.replace(/import\.meta\.resolve\(\s*["'](\.\.?\/[^"']+)["']\s*\)/g, (_match, relPath) => {
|
|
17086
|
-
const absPath =
|
|
17087
|
-
const rel =
|
|
17191
|
+
const absPath = resolve33(fileDir, relPath);
|
|
17192
|
+
const rel = relative13(projectRoot, absPath);
|
|
17088
17193
|
return `'${srcUrl(rel, projectRoot)}'`;
|
|
17089
17194
|
});
|
|
17090
17195
|
return result;
|
|
@@ -17140,7 +17245,7 @@ ${code}`;
|
|
|
17140
17245
|
transpiled = `var $RefreshReg$ = window.$RefreshReg$ || function(){};
|
|
17141
17246
|
` + `var $RefreshSig$ = window.$RefreshSig$ || function(){ return function(t){ return t; }; };
|
|
17142
17247
|
${transpiled}`;
|
|
17143
|
-
const relPath =
|
|
17248
|
+
const relPath = relative13(projectRoot, filePath).replace(/\\/g, "/");
|
|
17144
17249
|
transpiled = transpiled.replace(/\binput\.tsx:/g, `${relPath}:`);
|
|
17145
17250
|
transpiled += buildIslandMetadataExports(raw);
|
|
17146
17251
|
return rewriteImports(transpiled, filePath, projectRoot, rewriter);
|
|
@@ -17149,13 +17254,13 @@ ${transpiled}`;
|
|
|
17149
17254
|
const ext = extname8(filePath);
|
|
17150
17255
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
17151
17256
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
17152
|
-
let
|
|
17257
|
+
let transpiler6 = jsTranspiler2;
|
|
17153
17258
|
if (isTSX)
|
|
17154
|
-
|
|
17259
|
+
transpiler6 = tsxTranspiler;
|
|
17155
17260
|
else if (isTS)
|
|
17156
|
-
|
|
17157
|
-
const valueExports = isTS ?
|
|
17158
|
-
let transpiled =
|
|
17261
|
+
transpiler6 = tsTranspiler2;
|
|
17262
|
+
const valueExports = isTS ? transpiler6.scan(raw).exports : [];
|
|
17263
|
+
let transpiled = transpiler6.transformSync(raw);
|
|
17159
17264
|
if (isTS) {
|
|
17160
17265
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
17161
17266
|
}
|
|
@@ -17301,11 +17406,11 @@ ${code}`;
|
|
|
17301
17406
|
if (compiled.css?.code) {
|
|
17302
17407
|
const cssPath = `${filePath}.css`;
|
|
17303
17408
|
svelteExternalCss.set(cssPath, compiled.css.code);
|
|
17304
|
-
const cssUrl = srcUrl(
|
|
17409
|
+
const cssUrl = srcUrl(relative13(projectRoot, cssPath), projectRoot);
|
|
17305
17410
|
code = `import "${cssUrl}";
|
|
17306
17411
|
${code}`;
|
|
17307
17412
|
}
|
|
17308
|
-
const moduleUrl = `${SRC_PREFIX}${
|
|
17413
|
+
const moduleUrl = `${SRC_PREFIX}${relative13(projectRoot, filePath).replace(/\\/g, "/")}`;
|
|
17309
17414
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
17310
17415
|
` + ` if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
17311
17416
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
@@ -17331,6 +17436,8 @@ ${code}`;
|
|
|
17331
17436
|
const templateResult = compiler.compileTemplate({
|
|
17332
17437
|
compilerOptions: {
|
|
17333
17438
|
bindingMetadata: compiledScript.bindings,
|
|
17439
|
+
expressionPlugins: ["typescript"],
|
|
17440
|
+
isCustomElement: (tag) => tag === "absolute-island",
|
|
17334
17441
|
prefixIdentifiers: true
|
|
17335
17442
|
},
|
|
17336
17443
|
filename: filePath,
|
|
@@ -17394,8 +17501,8 @@ ${code}`;
|
|
|
17394
17501
|
code = injectVueHmr(code, filePath, projectRoot, vueDir);
|
|
17395
17502
|
return rewriteImports(code, filePath, projectRoot, rewriter);
|
|
17396
17503
|
}, injectVueHmr = (code, filePath, projectRoot, vueDir) => {
|
|
17397
|
-
const hmrBase = vueDir ?
|
|
17398
|
-
const hmrId =
|
|
17504
|
+
const hmrBase = vueDir ? resolve33(vueDir) : projectRoot;
|
|
17505
|
+
const hmrId = relative13(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
|
|
17399
17506
|
let result = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
|
|
17400
17507
|
result += [
|
|
17401
17508
|
"",
|
|
@@ -17558,7 +17665,7 @@ export default {};
|
|
|
17558
17665
|
const escaped = virtualCss.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
17559
17666
|
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);`);
|
|
17560
17667
|
}, resolveSourcePath = (relPath, projectRoot) => {
|
|
17561
|
-
const filePath =
|
|
17668
|
+
const filePath = resolve33(projectRoot, relPath);
|
|
17562
17669
|
const ext = extname8(filePath);
|
|
17563
17670
|
if (ext === ".svelte")
|
|
17564
17671
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
@@ -17585,7 +17692,7 @@ export default {};
|
|
|
17585
17692
|
if (!TRANSPILABLE.has(ext))
|
|
17586
17693
|
return;
|
|
17587
17694
|
const stat3 = statSync2(filePath);
|
|
17588
|
-
const resolvedVueDir = vueDir ?
|
|
17695
|
+
const resolvedVueDir = vueDir ? resolve33(vueDir) : undefined;
|
|
17589
17696
|
let content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
|
|
17590
17697
|
const isComponentJs = ext === ".js" && filePath.endsWith(".component.js") && filePath.replace(/\\/g, "/").includes("/.absolutejs/generated/angular/");
|
|
17591
17698
|
if (isComponentJs) {
|
|
@@ -17644,7 +17751,7 @@ export default {};
|
|
|
17644
17751
|
const relPath = pathname.slice(SRC_PREFIX.length);
|
|
17645
17752
|
if (relPath === "bun:wrap" || relPath.startsWith("bun:wrap?"))
|
|
17646
17753
|
return handleBunWrapRequest();
|
|
17647
|
-
const virtualCssResponse = handleVirtualSvelteCss(
|
|
17754
|
+
const virtualCssResponse = handleVirtualSvelteCss(resolve33(projectRoot, relPath));
|
|
17648
17755
|
if (virtualCssResponse)
|
|
17649
17756
|
return virtualCssResponse;
|
|
17650
17757
|
const { filePath, ext } = resolveSourcePath(relPath, projectRoot);
|
|
@@ -17660,11 +17767,11 @@ export default {};
|
|
|
17660
17767
|
SRC_IMPORT_RE.lastIndex = 0;
|
|
17661
17768
|
while ((match = SRC_IMPORT_RE.exec(content)) !== null) {
|
|
17662
17769
|
if (match[1])
|
|
17663
|
-
files.push(
|
|
17770
|
+
files.push(resolve33(projectRoot, match[1]));
|
|
17664
17771
|
}
|
|
17665
17772
|
return files;
|
|
17666
17773
|
}, invalidateModule = (filePath) => {
|
|
17667
|
-
const resolved =
|
|
17774
|
+
const resolved = resolve33(filePath);
|
|
17668
17775
|
invalidate(filePath);
|
|
17669
17776
|
if (resolved !== filePath)
|
|
17670
17777
|
invalidate(resolved);
|
|
@@ -17811,7 +17918,7 @@ __export(exports_resolveOwningComponents, {
|
|
|
17811
17918
|
invalidateResourceIndex: () => invalidateResourceIndex
|
|
17812
17919
|
});
|
|
17813
17920
|
import { readdirSync as readdirSync2, readFileSync as readFileSync19, statSync as statSync3 } from "fs";
|
|
17814
|
-
import { dirname as
|
|
17921
|
+
import { dirname as dirname19, extname as extname9, join as join30, resolve as resolve34 } from "path";
|
|
17815
17922
|
import ts3 from "typescript";
|
|
17816
17923
|
var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") || file5.endsWith(".tsx"), walkAngularSourceFiles = (root) => {
|
|
17817
17924
|
const out = [];
|
|
@@ -17826,7 +17933,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
17826
17933
|
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
17827
17934
|
continue;
|
|
17828
17935
|
}
|
|
17829
|
-
const full =
|
|
17936
|
+
const full = join30(dir, entry.name);
|
|
17830
17937
|
if (entry.isDirectory()) {
|
|
17831
17938
|
visit(full);
|
|
17832
17939
|
} else if (entry.isFile() && isAngularSourceFile(entry.name)) {
|
|
@@ -17924,7 +18031,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
17924
18031
|
};
|
|
17925
18032
|
visit(sourceFile);
|
|
17926
18033
|
return out;
|
|
17927
|
-
}, safeNormalize = (path) =>
|
|
18034
|
+
}, safeNormalize = (path) => resolve34(path).replace(/\\/g, "/"), resolveOwningComponents = (params) => {
|
|
17928
18035
|
const { changedFilePath, userAngularRoot } = params;
|
|
17929
18036
|
const changedAbs = safeNormalize(changedFilePath);
|
|
17930
18037
|
const out = [];
|
|
@@ -17965,7 +18072,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
17965
18072
|
return null;
|
|
17966
18073
|
}
|
|
17967
18074
|
const sf = ts3.createSourceFile(childFilePath, source, ts3.ScriptTarget.ES2022, true, ts3.ScriptKind.TS);
|
|
17968
|
-
const childDir =
|
|
18075
|
+
const childDir = dirname19(childFilePath);
|
|
17969
18076
|
for (const stmt of sf.statements) {
|
|
17970
18077
|
if (!ts3.isImportDeclaration(stmt))
|
|
17971
18078
|
continue;
|
|
@@ -17993,7 +18100,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
17993
18100
|
if (!spec.startsWith(".") && !spec.startsWith("/")) {
|
|
17994
18101
|
return null;
|
|
17995
18102
|
}
|
|
17996
|
-
const base =
|
|
18103
|
+
const base = resolve34(childDir, spec);
|
|
17997
18104
|
const candidates = [
|
|
17998
18105
|
`${base}.ts`,
|
|
17999
18106
|
`${base}.tsx`,
|
|
@@ -18022,7 +18129,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
18022
18129
|
const parentFile = new Map;
|
|
18023
18130
|
for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
|
|
18024
18131
|
const classes = parseDecoratedClasses(tsPath);
|
|
18025
|
-
const componentDir =
|
|
18132
|
+
const componentDir = dirname19(tsPath);
|
|
18026
18133
|
for (const cls of classes) {
|
|
18027
18134
|
const entity = {
|
|
18028
18135
|
className: cls.className,
|
|
@@ -18031,7 +18138,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
18031
18138
|
};
|
|
18032
18139
|
if (cls.kind === "component") {
|
|
18033
18140
|
for (const url of [...cls.templateUrls, ...cls.styleUrls]) {
|
|
18034
|
-
const abs = safeNormalize(
|
|
18141
|
+
const abs = safeNormalize(resolve34(componentDir, url));
|
|
18035
18142
|
const existing = resource.get(abs);
|
|
18036
18143
|
if (existing)
|
|
18037
18144
|
existing.push(entity);
|
|
@@ -18111,8 +18218,6 @@ class Context {
|
|
|
18111
18218
|
}
|
|
18112
18219
|
|
|
18113
18220
|
// src/dev/angular/vendor/translator/translator.ts
|
|
18114
|
-
import * as o from "@angular/compiler";
|
|
18115
|
-
|
|
18116
18221
|
class ExpressionTranslatorVisitor {
|
|
18117
18222
|
factory;
|
|
18118
18223
|
imports;
|
|
@@ -18403,8 +18508,16 @@ function createRange(span) {
|
|
|
18403
18508
|
end: { offset: end.offset, line: end.line, column: end.col }
|
|
18404
18509
|
};
|
|
18405
18510
|
}
|
|
18406
|
-
var UNARY_OPERATORS, BINARY_OPERATORS;
|
|
18511
|
+
var o, UNARY_OPERATORS, BINARY_OPERATORS;
|
|
18407
18512
|
var init_translator = __esm(() => {
|
|
18513
|
+
o = (() => {
|
|
18514
|
+
try {
|
|
18515
|
+
return __require("@angular/compiler");
|
|
18516
|
+
} catch {
|
|
18517
|
+
const stub = new Proxy(function() {}, { apply: () => stub, construct: () => stub, get: () => stub });
|
|
18518
|
+
return stub;
|
|
18519
|
+
}
|
|
18520
|
+
})();
|
|
18408
18521
|
UNARY_OPERATORS = /* @__PURE__ */ new Map([
|
|
18409
18522
|
[o.UnaryOperator.Minus, "-"],
|
|
18410
18523
|
[o.UnaryOperator.Plus, "+"]
|
|
@@ -18742,9 +18855,18 @@ var init_typescript_ast_factory = __esm(() => {
|
|
|
18742
18855
|
function translateStatement(contextFile, statement, imports, options = {}) {
|
|
18743
18856
|
return statement.visitStatement(new ExpressionTranslatorVisitor(new TypeScriptAstFactory(options.annotateForClosureCompiler === true), imports, contextFile, options), new Context(true));
|
|
18744
18857
|
}
|
|
18858
|
+
var o2;
|
|
18745
18859
|
var init_typescript_translator = __esm(() => {
|
|
18746
18860
|
init_translator();
|
|
18747
18861
|
init_typescript_ast_factory();
|
|
18862
|
+
o2 = (() => {
|
|
18863
|
+
try {
|
|
18864
|
+
return __require("@angular/compiler");
|
|
18865
|
+
} catch {
|
|
18866
|
+
const stub = new Proxy(function() {}, { apply: () => stub, construct: () => stub, get: () => stub });
|
|
18867
|
+
return stub;
|
|
18868
|
+
}
|
|
18869
|
+
})();
|
|
18748
18870
|
});
|
|
18749
18871
|
|
|
18750
18872
|
// src/dev/angular/fastHmrCompiler.ts
|
|
@@ -18756,7 +18878,7 @@ __export(exports_fastHmrCompiler, {
|
|
|
18756
18878
|
invalidateFingerprintCache: () => invalidateFingerprintCache
|
|
18757
18879
|
});
|
|
18758
18880
|
import { existsSync as existsSync26, readFileSync as readFileSync20, statSync as statSync4 } from "fs";
|
|
18759
|
-
import { dirname as
|
|
18881
|
+
import { dirname as dirname20, extname as extname10, relative as relative14, resolve as resolve35 } from "path";
|
|
18760
18882
|
import ts7 from "typescript";
|
|
18761
18883
|
var fail = (reason, detail, location) => ({
|
|
18762
18884
|
ok: false,
|
|
@@ -18978,7 +19100,7 @@ var fail = (reason, detail, location) => ({
|
|
|
18978
19100
|
if (!spec.startsWith(".") && !spec.startsWith("/")) {
|
|
18979
19101
|
return true;
|
|
18980
19102
|
}
|
|
18981
|
-
const base =
|
|
19103
|
+
const base = resolve35(componentDir, spec);
|
|
18982
19104
|
const candidates = [
|
|
18983
19105
|
`${base}.ts`,
|
|
18984
19106
|
`${base}.tsx`,
|
|
@@ -19741,7 +19863,7 @@ var fail = (reason, detail, location) => ({
|
|
|
19741
19863
|
});
|
|
19742
19864
|
if (!names.includes(className))
|
|
19743
19865
|
continue;
|
|
19744
|
-
const nextDts = resolveDtsFromSpec(fromPath,
|
|
19866
|
+
const nextDts = resolveDtsFromSpec(fromPath, dirname20(startDtsPath));
|
|
19745
19867
|
if (!nextDts)
|
|
19746
19868
|
continue;
|
|
19747
19869
|
const found = findDtsContainingClass(nextDts, className, visited);
|
|
@@ -19751,7 +19873,7 @@ var fail = (reason, detail, location) => ({
|
|
|
19751
19873
|
const starReExportRe = /export\s*\*\s*from\s*["']([^"']+)["']/g;
|
|
19752
19874
|
while ((m = starReExportRe.exec(content)) !== null) {
|
|
19753
19875
|
const fromPath = m[1] || "";
|
|
19754
|
-
const nextDts = resolveDtsFromSpec(fromPath,
|
|
19876
|
+
const nextDts = resolveDtsFromSpec(fromPath, dirname20(startDtsPath));
|
|
19755
19877
|
if (!nextDts)
|
|
19756
19878
|
continue;
|
|
19757
19879
|
const found = findDtsContainingClass(nextDts, className, visited);
|
|
@@ -19761,7 +19883,7 @@ var fail = (reason, detail, location) => ({
|
|
|
19761
19883
|
return null;
|
|
19762
19884
|
}, resolveDtsFromSpec = (spec, fromDir) => {
|
|
19763
19885
|
const stripped = spec.replace(/\.[mc]?js$/, "");
|
|
19764
|
-
const base =
|
|
19886
|
+
const base = resolve35(fromDir, stripped);
|
|
19765
19887
|
const candidates = [
|
|
19766
19888
|
`${base}.d.ts`,
|
|
19767
19889
|
`${base}.d.mts`,
|
|
@@ -19785,7 +19907,7 @@ var fail = (reason, detail, location) => ({
|
|
|
19785
19907
|
return null;
|
|
19786
19908
|
}, resolveChildComponentInfo = (className, spec, componentDir, projectRoot) => {
|
|
19787
19909
|
if (spec.startsWith(".") || spec.startsWith("/")) {
|
|
19788
|
-
const base =
|
|
19910
|
+
const base = resolve35(componentDir, spec);
|
|
19789
19911
|
const candidates = [
|
|
19790
19912
|
`${base}.ts`,
|
|
19791
19913
|
`${base}.tsx`,
|
|
@@ -19955,13 +20077,13 @@ var fail = (reason, detail, location) => ({
|
|
|
19955
20077
|
}
|
|
19956
20078
|
if (!matches)
|
|
19957
20079
|
continue;
|
|
19958
|
-
const resolved =
|
|
20080
|
+
const resolved = resolve35(componentDir, spec);
|
|
19959
20081
|
for (const ext of TS_EXTENSIONS) {
|
|
19960
20082
|
const candidate = resolved + ext;
|
|
19961
20083
|
if (existsSync26(candidate))
|
|
19962
20084
|
return candidate;
|
|
19963
20085
|
}
|
|
19964
|
-
const indexCandidate =
|
|
20086
|
+
const indexCandidate = resolve35(resolved, "index.ts");
|
|
19965
20087
|
if (existsSync26(indexCandidate))
|
|
19966
20088
|
return indexCandidate;
|
|
19967
20089
|
}
|
|
@@ -20148,7 +20270,7 @@ ${transpiled}
|
|
|
20148
20270
|
}
|
|
20149
20271
|
}${staticPatch}`;
|
|
20150
20272
|
}, STYLE_PREPROCESSED_EXT, resolveAndReadStyleResource = (componentDir, url) => {
|
|
20151
|
-
const abs =
|
|
20273
|
+
const abs = resolve35(componentDir, url);
|
|
20152
20274
|
if (!existsSync26(abs))
|
|
20153
20275
|
return null;
|
|
20154
20276
|
const ext = extname10(abs).toLowerCase();
|
|
@@ -20188,7 +20310,7 @@ ${block}
|
|
|
20188
20310
|
const cached = projectOptionsCache.get(projectRoot);
|
|
20189
20311
|
if (cached !== undefined)
|
|
20190
20312
|
return cached;
|
|
20191
|
-
const tsconfigPath =
|
|
20313
|
+
const tsconfigPath = resolve35(projectRoot, "tsconfig.json");
|
|
20192
20314
|
const opts = {};
|
|
20193
20315
|
if (existsSync26(tsconfigPath)) {
|
|
20194
20316
|
try {
|
|
@@ -20234,7 +20356,7 @@ ${block}
|
|
|
20234
20356
|
}
|
|
20235
20357
|
const kind = params.kind ?? "component";
|
|
20236
20358
|
if (kind !== "component") {
|
|
20237
|
-
const entityId = encodeURIComponent(`${
|
|
20359
|
+
const entityId = encodeURIComponent(`${relative14(projectRoot, componentFilePath).replace(/\\/g, "/")}@${className}`);
|
|
20238
20360
|
const currentEntityFingerprint = extractEntityFingerprint(classNode, className, sourceFile);
|
|
20239
20361
|
const cachedEntityFingerprint = entityFingerprintCache.get(entityId);
|
|
20240
20362
|
if (cachedEntityFingerprint !== undefined && !entityFingerprintsEqual(cachedEntityFingerprint, currentEntityFingerprint)) {
|
|
@@ -20252,7 +20374,7 @@ ${block}
|
|
|
20252
20374
|
ok: true
|
|
20253
20375
|
};
|
|
20254
20376
|
}
|
|
20255
|
-
if (inheritsDecoratedClass(classNode, sourceFile,
|
|
20377
|
+
if (inheritsDecoratedClass(classNode, sourceFile, dirname20(componentFilePath), projectRoot)) {
|
|
20256
20378
|
return fail("inherits-decorated-class");
|
|
20257
20379
|
}
|
|
20258
20380
|
const decorator = findComponentDecorator(classNode);
|
|
@@ -20264,14 +20386,14 @@ ${block}
|
|
|
20264
20386
|
const projectDefaults = readProjectAngularCompilerOptions(projectRoot);
|
|
20265
20387
|
const decoratorMeta = readDecoratorMeta(decoratorArgs, projectDefaults);
|
|
20266
20388
|
const advancedMetadata = extractAdvancedMetadata(classNode, decoratorArgs, compiler);
|
|
20267
|
-
const componentDir =
|
|
20389
|
+
const componentDir = dirname20(componentFilePath);
|
|
20268
20390
|
let templateText;
|
|
20269
20391
|
let templatePath;
|
|
20270
20392
|
if (decoratorMeta.template !== null) {
|
|
20271
20393
|
templateText = decoratorMeta.template;
|
|
20272
20394
|
templatePath = componentFilePath;
|
|
20273
20395
|
} else if (decoratorMeta.templateUrl) {
|
|
20274
|
-
const tplAbs =
|
|
20396
|
+
const tplAbs = resolve35(componentDir, decoratorMeta.templateUrl);
|
|
20275
20397
|
if (!existsSync26(tplAbs)) {
|
|
20276
20398
|
return fail("template-resource-not-found", `Template file not found: ${tplAbs}`, { file: componentFilePath });
|
|
20277
20399
|
}
|
|
@@ -20322,7 +20444,7 @@ ${block}
|
|
|
20322
20444
|
hasDecoratorIO,
|
|
20323
20445
|
hasSignalIO
|
|
20324
20446
|
} = extractInputsAndOutputs(classNode, compiler);
|
|
20325
|
-
const projectRelPath =
|
|
20447
|
+
const projectRelPath = relative14(projectRoot, componentFilePath).replace(/\\/g, "/");
|
|
20326
20448
|
const fingerprintId = encodeURIComponent(`${projectRelPath}@${className}`);
|
|
20327
20449
|
const currentFingerprint = extractFingerprint(classNode, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
|
|
20328
20450
|
const cachedFingerprint = fingerprintCache.get(fingerprintId);
|
|
@@ -20576,7 +20698,7 @@ __export(exports_hmrCompiler, {
|
|
|
20576
20698
|
getApplyMetadataModule: () => getApplyMetadataModule,
|
|
20577
20699
|
encodeHmrComponentId: () => encodeHmrComponentId
|
|
20578
20700
|
});
|
|
20579
|
-
import { dirname as
|
|
20701
|
+
import { dirname as dirname21, relative as relative15, resolve as resolve36 } from "path";
|
|
20580
20702
|
import { performance as performance2 } from "perf_hooks";
|
|
20581
20703
|
var getApplyMetadataModule = async (encodedId) => {
|
|
20582
20704
|
const decoded = decodeURIComponent(encodedId);
|
|
@@ -20585,8 +20707,8 @@ var getApplyMetadataModule = async (encodedId) => {
|
|
|
20585
20707
|
return null;
|
|
20586
20708
|
const filePathRel = decoded.slice(0, at2);
|
|
20587
20709
|
const className = decoded.slice(at2 + 1);
|
|
20588
|
-
const componentFilePath =
|
|
20589
|
-
const projectRelPath =
|
|
20710
|
+
const componentFilePath = resolve36(process.cwd(), filePathRel);
|
|
20711
|
+
const projectRelPath = relative15(process.cwd(), componentFilePath).replace(/\\/g, "/");
|
|
20590
20712
|
const cacheKey2 = encodeURIComponent(`${projectRelPath}@${className}`);
|
|
20591
20713
|
const { takePendingModule: takePendingModule2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
|
|
20592
20714
|
const cached = takePendingModule2(cacheKey2);
|
|
@@ -20596,9 +20718,9 @@ var getApplyMetadataModule = async (encodedId) => {
|
|
|
20596
20718
|
const { resolveOwningComponents: resolveOwningComponents2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
|
|
20597
20719
|
const owners = resolveOwningComponents2({
|
|
20598
20720
|
changedFilePath: componentFilePath,
|
|
20599
|
-
userAngularRoot:
|
|
20721
|
+
userAngularRoot: dirname21(componentFilePath)
|
|
20600
20722
|
});
|
|
20601
|
-
const owner = owners.find((
|
|
20723
|
+
const owner = owners.find((o3) => o3.className === className);
|
|
20602
20724
|
const kind = owner?.kind ?? "component";
|
|
20603
20725
|
const fastStart = performance2.now();
|
|
20604
20726
|
const fast = await tryFastHmr({ className, componentFilePath, kind });
|
|
@@ -20608,7 +20730,7 @@ var getApplyMetadataModule = async (encodedId) => {
|
|
|
20608
20730
|
}
|
|
20609
20731
|
return null;
|
|
20610
20732
|
}, encodeHmrComponentId = (absoluteFilePath, className) => {
|
|
20611
|
-
const projectRel =
|
|
20733
|
+
const projectRel = relative15(process.cwd(), absoluteFilePath).replace(/\\/g, "/");
|
|
20612
20734
|
return `${projectRel}@${className}`;
|
|
20613
20735
|
};
|
|
20614
20736
|
var init_hmrCompiler = __esm(() => {
|
|
@@ -20747,11 +20869,11 @@ var exports_simpleHTMLHMR = {};
|
|
|
20747
20869
|
__export(exports_simpleHTMLHMR, {
|
|
20748
20870
|
handleHTMLUpdate: () => handleHTMLUpdate
|
|
20749
20871
|
});
|
|
20750
|
-
import { resolve as
|
|
20872
|
+
import { resolve as resolve37 } from "path";
|
|
20751
20873
|
var handleHTMLUpdate = async (htmlFilePath) => {
|
|
20752
20874
|
let htmlContent;
|
|
20753
20875
|
try {
|
|
20754
|
-
const resolvedPath =
|
|
20876
|
+
const resolvedPath = resolve37(htmlFilePath);
|
|
20755
20877
|
const file5 = Bun.file(resolvedPath);
|
|
20756
20878
|
if (!await file5.exists()) {
|
|
20757
20879
|
return null;
|
|
@@ -20777,11 +20899,11 @@ var exports_simpleHTMXHMR = {};
|
|
|
20777
20899
|
__export(exports_simpleHTMXHMR, {
|
|
20778
20900
|
handleHTMXUpdate: () => handleHTMXUpdate
|
|
20779
20901
|
});
|
|
20780
|
-
import { resolve as
|
|
20902
|
+
import { resolve as resolve38 } from "path";
|
|
20781
20903
|
var handleHTMXUpdate = async (htmxFilePath) => {
|
|
20782
20904
|
let htmlContent;
|
|
20783
20905
|
try {
|
|
20784
|
-
const resolvedPath =
|
|
20906
|
+
const resolvedPath = resolve38(htmxFilePath);
|
|
20785
20907
|
const file5 = Bun.file(resolvedPath);
|
|
20786
20908
|
if (!await file5.exists()) {
|
|
20787
20909
|
return null;
|
|
@@ -20804,7 +20926,7 @@ var init_simpleHTMXHMR = () => {};
|
|
|
20804
20926
|
|
|
20805
20927
|
// src/dev/rebuildTrigger.ts
|
|
20806
20928
|
import { existsSync as existsSync27 } from "fs";
|
|
20807
|
-
import { basename as basename12, dirname as
|
|
20929
|
+
import { basename as basename12, dirname as dirname22, relative as relative16, resolve as resolve39, sep as sep4 } from "path";
|
|
20808
20930
|
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) => {
|
|
20809
20931
|
if (!config.tailwind)
|
|
20810
20932
|
return;
|
|
@@ -20896,7 +21018,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20896
21018
|
state.fileHashes.delete(filePathInSet);
|
|
20897
21019
|
try {
|
|
20898
21020
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, filePathInSet);
|
|
20899
|
-
const deletedPathResolved =
|
|
21021
|
+
const deletedPathResolved = resolve39(filePathInSet);
|
|
20900
21022
|
affectedFiles.forEach((affectedFile) => {
|
|
20901
21023
|
if (isValidDeletedAffectedFile(affectedFile, deletedPathResolved, processedFiles)) {
|
|
20902
21024
|
validFiles.push(affectedFile);
|
|
@@ -20940,7 +21062,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20940
21062
|
if (storedHash !== undefined && storedHash === fileHash) {
|
|
20941
21063
|
return;
|
|
20942
21064
|
}
|
|
20943
|
-
const normalizedFilePath =
|
|
21065
|
+
const normalizedFilePath = resolve39(filePathInSet);
|
|
20944
21066
|
if (!processedFiles.has(normalizedFilePath)) {
|
|
20945
21067
|
validFiles.push(normalizedFilePath);
|
|
20946
21068
|
processedFiles.add(normalizedFilePath);
|
|
@@ -21044,8 +21166,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21044
21166
|
return;
|
|
21045
21167
|
}
|
|
21046
21168
|
if (framework === "unknown") {
|
|
21047
|
-
invalidate(
|
|
21048
|
-
const relPath =
|
|
21169
|
+
invalidate(resolve39(filePath));
|
|
21170
|
+
const relPath = relative16(process.cwd(), filePath);
|
|
21049
21171
|
logHmrUpdate(relPath);
|
|
21050
21172
|
return;
|
|
21051
21173
|
}
|
|
@@ -21071,7 +21193,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21071
21193
|
const userEditedFiles = new Set;
|
|
21072
21194
|
state.fileChangeQueue.forEach((filePaths) => {
|
|
21073
21195
|
for (const filePath2 of filePaths) {
|
|
21074
|
-
userEditedFiles.add(
|
|
21196
|
+
userEditedFiles.add(resolve39(filePath2));
|
|
21075
21197
|
}
|
|
21076
21198
|
});
|
|
21077
21199
|
state.lastUserEditedFiles = userEditedFiles;
|
|
@@ -21100,7 +21222,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21100
21222
|
}
|
|
21101
21223
|
if (!graph)
|
|
21102
21224
|
return componentFile;
|
|
21103
|
-
const dependents = graph.dependents.get(
|
|
21225
|
+
const dependents = graph.dependents.get(resolve39(componentFile));
|
|
21104
21226
|
if (!dependents)
|
|
21105
21227
|
return componentFile;
|
|
21106
21228
|
for (const dep of dependents) {
|
|
@@ -21109,7 +21231,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21109
21231
|
}
|
|
21110
21232
|
return componentFile;
|
|
21111
21233
|
}, resolveAngularPageEntries = (state, angularFiles, angularPagesPath) => {
|
|
21112
|
-
const pageEntries = angularFiles.filter((file5) => file5.endsWith(".ts") &&
|
|
21234
|
+
const pageEntries = angularFiles.filter((file5) => file5.endsWith(".ts") && resolve39(file5).startsWith(angularPagesPath));
|
|
21113
21235
|
if (pageEntries.length > 0 || !state.dependencyGraph) {
|
|
21114
21236
|
return pageEntries;
|
|
21115
21237
|
}
|
|
@@ -21118,7 +21240,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21118
21240
|
const lookupFile = resolveComponentLookupFile(componentFile, state.dependencyGraph);
|
|
21119
21241
|
const affected = getAffectedFiles(state.dependencyGraph, lookupFile);
|
|
21120
21242
|
affected.forEach((file5) => {
|
|
21121
|
-
if (file5.endsWith(".ts") &&
|
|
21243
|
+
if (file5.endsWith(".ts") && resolve39(file5).startsWith(angularPagesPath)) {
|
|
21122
21244
|
resolvedPages.add(file5);
|
|
21123
21245
|
}
|
|
21124
21246
|
});
|
|
@@ -21390,16 +21512,16 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21390
21512
|
};
|
|
21391
21513
|
const fire = () => {
|
|
21392
21514
|
ctx.debounceTimer = null;
|
|
21393
|
-
const
|
|
21515
|
+
const resolve40 = ctx.debouncedResolve;
|
|
21394
21516
|
ctx.debouncedResolve = null;
|
|
21395
21517
|
ctx.debouncedPromise = null;
|
|
21396
21518
|
if (ctx.inFlight) {
|
|
21397
21519
|
ctx.pending = true;
|
|
21398
|
-
ctx.inFlight.finally(() =>
|
|
21520
|
+
ctx.inFlight.finally(() => resolve40?.());
|
|
21399
21521
|
return;
|
|
21400
21522
|
}
|
|
21401
21523
|
ctx.inFlight = drive();
|
|
21402
|
-
ctx.inFlight.finally(() =>
|
|
21524
|
+
ctx.inFlight.finally(() => resolve40?.());
|
|
21403
21525
|
};
|
|
21404
21526
|
return ({ immediate = false } = {}) => {
|
|
21405
21527
|
if (!ctx.debouncedPromise) {
|
|
@@ -21426,9 +21548,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21426
21548
|
const diskRefreshPromise = (async () => {
|
|
21427
21549
|
if (!angularDir || editedFiles.size === 0)
|
|
21428
21550
|
return;
|
|
21429
|
-
const angularDirAbs =
|
|
21551
|
+
const angularDirAbs = resolve39(angularDir);
|
|
21430
21552
|
const filesUnderAngular = Array.from(editedFiles).filter((file5) => {
|
|
21431
|
-
const abs =
|
|
21553
|
+
const abs = resolve39(file5);
|
|
21432
21554
|
return abs === angularDirAbs || abs.startsWith(angularDirAbs + sep4);
|
|
21433
21555
|
});
|
|
21434
21556
|
if (filesUnderAngular.length === 0)
|
|
@@ -21450,7 +21572,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21450
21572
|
if (!ext)
|
|
21451
21573
|
continue;
|
|
21452
21574
|
if (ext === ".ts" || ext === ".tsx") {
|
|
21453
|
-
tsFilesToRefresh.add(
|
|
21575
|
+
tsFilesToRefresh.add(resolve39(file5));
|
|
21454
21576
|
continue;
|
|
21455
21577
|
}
|
|
21456
21578
|
const owners = resolveOwningComponents2({
|
|
@@ -21458,7 +21580,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21458
21580
|
userAngularRoot: angularDirAbs
|
|
21459
21581
|
});
|
|
21460
21582
|
for (const owner of owners) {
|
|
21461
|
-
tsFilesToRefresh.add(
|
|
21583
|
+
tsFilesToRefresh.add(resolve39(owner.componentFilePath));
|
|
21462
21584
|
}
|
|
21463
21585
|
}
|
|
21464
21586
|
if (tsFilesToRefresh.size === 0)
|
|
@@ -21469,8 +21591,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21469
21591
|
try {
|
|
21470
21592
|
const { invalidateModule: invalidateModule2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
21471
21593
|
for (const tsFile of tsFilesToRefresh) {
|
|
21472
|
-
const rel =
|
|
21473
|
-
const compiledFile =
|
|
21594
|
+
const rel = relative16(angularDirAbs, tsFile).replace(/\\/g, "/").replace(/\.[tj]sx?$/, ".js");
|
|
21595
|
+
const compiledFile = resolve39(compiledRoot, rel);
|
|
21474
21596
|
invalidateModule2(compiledFile);
|
|
21475
21597
|
}
|
|
21476
21598
|
} catch {}
|
|
@@ -21499,7 +21621,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21499
21621
|
serverPaths.forEach((serverPath, idx) => {
|
|
21500
21622
|
const fileBase = basename12(serverPath, ".js");
|
|
21501
21623
|
const ssrPath = ssrPaths[idx] ?? serverPath;
|
|
21502
|
-
state.manifest[toPascal(fileBase)] =
|
|
21624
|
+
state.manifest[toPascal(fileBase)] = resolve39(ssrPath);
|
|
21503
21625
|
});
|
|
21504
21626
|
if (clientPaths.length > 0) {
|
|
21505
21627
|
await bundleAngularClient(state, clientPaths, state.resolvedPaths.buildDir, angularDir);
|
|
@@ -21508,9 +21630,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21508
21630
|
const angularDir = config.angularDirectory ?? "";
|
|
21509
21631
|
const angularFiles = filesToRebuild.filter((file5) => detectFramework(file5, state.resolvedPaths) === "angular");
|
|
21510
21632
|
for (const file5 of angularFiles) {
|
|
21511
|
-
state.fileHashes.set(
|
|
21633
|
+
state.fileHashes.set(resolve39(file5), computeFileHash(file5));
|
|
21512
21634
|
}
|
|
21513
|
-
const angularPagesPath =
|
|
21635
|
+
const angularPagesPath = resolve39(angularDir, "pages");
|
|
21514
21636
|
const pageEntries = resolveAngularPageEntries(state, angularFiles, angularPagesPath);
|
|
21515
21637
|
const tierStart = performance.now();
|
|
21516
21638
|
const verdict = await decideAngularTier(state, angularDir);
|
|
@@ -21540,7 +21662,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21540
21662
|
}, getModuleUrl = async (pageFile) => {
|
|
21541
21663
|
const { invalidateModule: invalidateModule2, warmCache: warmCache2, SRC_URL_PREFIX: SRC_URL_PREFIX2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
21542
21664
|
invalidateModule2(pageFile);
|
|
21543
|
-
const rel =
|
|
21665
|
+
const rel = relative16(process.cwd(), pageFile).replace(/\\/g, "/");
|
|
21544
21666
|
const url = `${SRC_URL_PREFIX2}${rel}`;
|
|
21545
21667
|
warmCache2(url);
|
|
21546
21668
|
return url;
|
|
@@ -21549,11 +21671,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21549
21671
|
if (isComponentFile2)
|
|
21550
21672
|
return primaryFile;
|
|
21551
21673
|
const { findNearestComponent: findNearestComponent2 } = await Promise.resolve().then(() => (init_transformCache(), exports_transformCache));
|
|
21552
|
-
const nearest = findNearestComponent2(
|
|
21674
|
+
const nearest = findNearestComponent2(resolve39(primaryFile));
|
|
21553
21675
|
return nearest ?? primaryFile;
|
|
21554
21676
|
}, handleReactModuleServerPath = async (state, reactFiles, startTime, onRebuildComplete) => {
|
|
21555
21677
|
for (const file5 of reactFiles) {
|
|
21556
|
-
state.fileHashes.set(
|
|
21678
|
+
state.fileHashes.set(resolve39(file5), computeFileHash(file5));
|
|
21557
21679
|
}
|
|
21558
21680
|
markSsrCacheDirty("react");
|
|
21559
21681
|
const primaryFile = reactFiles.find((file5) => !file5.replace(/\\/g, "/").includes("/pages/")) ?? reactFiles[0];
|
|
@@ -21572,7 +21694,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21572
21694
|
const pageModuleUrl = await getReactModuleUrl(broadcastTarget);
|
|
21573
21695
|
if (pageModuleUrl) {
|
|
21574
21696
|
const serverDuration = Date.now() - startTime;
|
|
21575
|
-
state.lastHmrPath =
|
|
21697
|
+
state.lastHmrPath = relative16(process.cwd(), primaryFile).replace(/\\/g, "/");
|
|
21576
21698
|
state.lastHmrFramework = "react";
|
|
21577
21699
|
broadcastToClients(state, {
|
|
21578
21700
|
data: {
|
|
@@ -21635,7 +21757,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21635
21757
|
});
|
|
21636
21758
|
}, handleSvelteModuleServerPath = async (state, svelteFiles, startTime, onRebuildComplete) => {
|
|
21637
21759
|
for (const file5 of svelteFiles) {
|
|
21638
|
-
state.fileHashes.set(
|
|
21760
|
+
state.fileHashes.set(resolve39(file5), computeFileHash(file5));
|
|
21639
21761
|
}
|
|
21640
21762
|
markSsrCacheDirty("svelte");
|
|
21641
21763
|
const serverDuration = Date.now() - startTime;
|
|
@@ -21660,8 +21782,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21660
21782
|
const serverEntries = [...svelteServerPaths];
|
|
21661
21783
|
const clientEntries = [...svelteIndexPaths, ...svelteClientPaths];
|
|
21662
21784
|
const { getFrameworkGeneratedDir: getFrameworkGeneratedDir2 } = await Promise.resolve().then(() => (init_generatedDir(), exports_generatedDir));
|
|
21663
|
-
const serverRoot =
|
|
21664
|
-
const serverOutDir =
|
|
21785
|
+
const serverRoot = resolve39(getFrameworkGeneratedDir2("svelte"), "server");
|
|
21786
|
+
const serverOutDir = resolve39(buildDir, basename12(svelteDir));
|
|
21665
21787
|
const [serverResult, clientResult] = await Promise.all([
|
|
21666
21788
|
serverEntries.length > 0 ? bunBuild9({
|
|
21667
21789
|
entrypoints: serverEntries,
|
|
@@ -21758,7 +21880,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21758
21880
|
});
|
|
21759
21881
|
}, handleVueModuleServerPath = async (state, vueFiles, nonVueFiles, startTime, onRebuildComplete) => {
|
|
21760
21882
|
for (const file5 of [...vueFiles, ...nonVueFiles]) {
|
|
21761
|
-
state.fileHashes.set(
|
|
21883
|
+
state.fileHashes.set(resolve39(file5), computeFileHash(file5));
|
|
21762
21884
|
}
|
|
21763
21885
|
markSsrCacheDirty("vue");
|
|
21764
21886
|
await invalidateNonVueModules(nonVueFiles);
|
|
@@ -21786,7 +21908,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21786
21908
|
recursive: true,
|
|
21787
21909
|
withFileTypes: true
|
|
21788
21910
|
});
|
|
21789
|
-
return entries.filter((entry) => entry.isFile() && EMBER_PAGE_EXTENSIONS.some((ext) => entry.name.endsWith(ext))).map((entry) =>
|
|
21911
|
+
return entries.filter((entry) => entry.isFile() && EMBER_PAGE_EXTENSIONS.some((ext) => entry.name.endsWith(ext))).map((entry) => resolve39(emberPagesPath, entry.name));
|
|
21790
21912
|
} catch {
|
|
21791
21913
|
return [];
|
|
21792
21914
|
}
|
|
@@ -21798,10 +21920,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21798
21920
|
return state.manifest;
|
|
21799
21921
|
}
|
|
21800
21922
|
for (const file5 of emberFiles) {
|
|
21801
|
-
state.fileHashes.set(
|
|
21923
|
+
state.fileHashes.set(resolve39(file5), computeFileHash(file5));
|
|
21802
21924
|
}
|
|
21803
|
-
const emberPagesPath =
|
|
21804
|
-
const directPageEntries = emberFiles.filter((file5) =>
|
|
21925
|
+
const emberPagesPath = resolve39(emberDir, "pages");
|
|
21926
|
+
const directPageEntries = emberFiles.filter((file5) => resolve39(file5).startsWith(emberPagesPath));
|
|
21805
21927
|
const allPageEntries = directPageEntries.length > 0 ? directPageEntries : await collectAllEmberPages(emberPagesPath);
|
|
21806
21928
|
if (allPageEntries.length === 0) {
|
|
21807
21929
|
onRebuildComplete({ hmrState: state, manifest: state.manifest });
|
|
@@ -21811,14 +21933,14 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21811
21933
|
const { serverPaths } = await compileEmber2(allPageEntries, emberDir, process.cwd(), true);
|
|
21812
21934
|
for (const serverPath of serverPaths) {
|
|
21813
21935
|
const fileBase = basename12(serverPath, ".js");
|
|
21814
|
-
state.manifest[toPascal(fileBase)] =
|
|
21936
|
+
state.manifest[toPascal(fileBase)] = resolve39(serverPath);
|
|
21815
21937
|
}
|
|
21816
21938
|
const { invalidateEmberSsrCache: invalidateEmberSsrCache2 } = await Promise.resolve().then(() => (init_ember(), exports_ember));
|
|
21817
21939
|
invalidateEmberSsrCache2();
|
|
21818
21940
|
const duration = Date.now() - startTime;
|
|
21819
21941
|
const [primary] = emberFiles;
|
|
21820
21942
|
if (primary) {
|
|
21821
|
-
state.lastHmrPath =
|
|
21943
|
+
state.lastHmrPath = relative16(process.cwd(), primary).replace(/\\/g, "/");
|
|
21822
21944
|
state.lastHmrFramework = "ember";
|
|
21823
21945
|
logHmrUpdate(primary, "ember", duration);
|
|
21824
21946
|
}
|
|
@@ -21903,8 +22025,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21903
22025
|
if (!buildReference?.source) {
|
|
21904
22026
|
return;
|
|
21905
22027
|
}
|
|
21906
|
-
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname :
|
|
21907
|
-
islandFiles.add(
|
|
22028
|
+
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve39(dirname22(buildInfo.resolvedRegistryPath), buildReference.source);
|
|
22029
|
+
islandFiles.add(resolve39(sourcePath));
|
|
21908
22030
|
}, resolveIslandSourceFiles = async (config) => {
|
|
21909
22031
|
const registryPath = config.islands?.registry;
|
|
21910
22032
|
if (!registryPath) {
|
|
@@ -21912,7 +22034,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21912
22034
|
}
|
|
21913
22035
|
const buildInfo = await loadIslandRegistryBuildInfo(registryPath);
|
|
21914
22036
|
const islandFiles = new Set([
|
|
21915
|
-
|
|
22037
|
+
resolve39(buildInfo.resolvedRegistryPath)
|
|
21916
22038
|
]);
|
|
21917
22039
|
for (const definition of buildInfo.definitions) {
|
|
21918
22040
|
resolveIslandDefinitionSource(definition, buildInfo, islandFiles);
|
|
@@ -21923,7 +22045,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21923
22045
|
if (islandFiles.size === 0) {
|
|
21924
22046
|
return false;
|
|
21925
22047
|
}
|
|
21926
|
-
return filesToRebuild.some((file5) => islandFiles.has(
|
|
22048
|
+
return filesToRebuild.some((file5) => islandFiles.has(resolve39(file5)));
|
|
21927
22049
|
}, handleIslandSourceReload = async (state, config, filesToRebuild, manifest) => {
|
|
21928
22050
|
const shouldReload = await didStaticPagesNeedIslandRefresh(config, filesToRebuild);
|
|
21929
22051
|
if (!shouldReload) {
|
|
@@ -21958,10 +22080,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21958
22080
|
}, computeOutputPagesDir = (state, config, framework) => {
|
|
21959
22081
|
const isSingle = !config.reactDirectory && !config.svelteDirectory && !config.vueDirectory && (framework === "html" ? !config.htmxDirectory : !config.htmlDirectory);
|
|
21960
22082
|
if (isSingle) {
|
|
21961
|
-
return
|
|
22083
|
+
return resolve39(state.resolvedPaths.buildDir, "pages");
|
|
21962
22084
|
}
|
|
21963
22085
|
const dirName = framework === "html" ? basename12(config.htmlDirectory ?? "html") : basename12(config.htmxDirectory ?? "htmx");
|
|
21964
|
-
return
|
|
22086
|
+
return resolve39(state.resolvedPaths.buildDir, dirName, "pages");
|
|
21965
22087
|
}, processHtmlPageUpdate = async (state, pageFile, builtHtmlPagePath, manifest, duration) => {
|
|
21966
22088
|
try {
|
|
21967
22089
|
const { handleHTMLUpdate: handleHTMLUpdate2 } = await Promise.resolve().then(() => (init_simpleHTMLHMR(), exports_simpleHTMLHMR));
|
|
@@ -22000,7 +22122,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22000
22122
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmlPages, "*.html") : htmlPageFiles;
|
|
22001
22123
|
await runSequentially(pageFilesToUpdate, async (pageFile) => {
|
|
22002
22124
|
const htmlPageName = basename12(pageFile);
|
|
22003
|
-
const builtHtmlPagePath =
|
|
22125
|
+
const builtHtmlPagePath = resolve39(outputHtmlPages, htmlPageName);
|
|
22004
22126
|
await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration);
|
|
22005
22127
|
});
|
|
22006
22128
|
}, handleVueCssOnlyUpdate = (state, vueCssFiles, manifest, duration) => {
|
|
@@ -22061,11 +22183,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22061
22183
|
const baseName = fileName.replace(/\.vue$/, "");
|
|
22062
22184
|
const pascalName = toPascal(baseName);
|
|
22063
22185
|
const vueRoot = config.vueDirectory;
|
|
22064
|
-
const hmrId = vueRoot ?
|
|
22186
|
+
const hmrId = vueRoot ? relative16(vueRoot, vuePagePath).replace(/\\/g, "/").replace(/\.vue$/, "") : baseName;
|
|
22065
22187
|
const cssKey = `${pascalName}CSS`;
|
|
22066
22188
|
const cssUrl = manifest[cssKey] || null;
|
|
22067
22189
|
const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
|
|
22068
|
-
const hmrMeta = vueHmrMetadata2.get(
|
|
22190
|
+
const hmrMeta = vueHmrMetadata2.get(resolve39(vuePagePath));
|
|
22069
22191
|
const changeType = hmrMeta?.changeType ?? "full";
|
|
22070
22192
|
if (changeType === "style-only") {
|
|
22071
22193
|
broadcastVueStyleOnly(state, vuePagePath, baseName, cssUrl, hmrId, manifest, duration);
|
|
@@ -22250,7 +22372,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22250
22372
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmxPages, "*.html") : htmxPageFiles;
|
|
22251
22373
|
await runSequentially(pageFilesToUpdate, async (htmxPageFile) => {
|
|
22252
22374
|
const htmxPageName = basename12(htmxPageFile);
|
|
22253
|
-
const builtHtmxPagePath =
|
|
22375
|
+
const builtHtmxPagePath = resolve39(outputHtmxPages, htmxPageName);
|
|
22254
22376
|
await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration);
|
|
22255
22377
|
});
|
|
22256
22378
|
}, collectUpdatedModulePaths = (allModuleUpdates) => {
|
|
@@ -22359,7 +22481,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22359
22481
|
html = html.slice(0, bodyClose.index) + hmrScript + html.slice(bodyClose.index);
|
|
22360
22482
|
writeFs(destPath, html);
|
|
22361
22483
|
}, processMarkupFileFastPath = async (state, sourceFile, outputDir, framework, startTime, updateAssetPaths2, handleUpdate, readFs, writeFs) => {
|
|
22362
|
-
const destPath =
|
|
22484
|
+
const destPath = resolve39(outputDir, basename12(sourceFile));
|
|
22363
22485
|
const hmrScript = extractHmrScript(destPath, readFs);
|
|
22364
22486
|
const source = await Bun.file(sourceFile).text();
|
|
22365
22487
|
await Bun.write(destPath, source);
|
|
@@ -22649,7 +22771,7 @@ __export(exports_buildDepVendor, {
|
|
|
22649
22771
|
buildDepVendor: () => buildDepVendor
|
|
22650
22772
|
});
|
|
22651
22773
|
import { mkdirSync as mkdirSync13 } from "fs";
|
|
22652
|
-
import { join as
|
|
22774
|
+
import { join as join31 } from "path";
|
|
22653
22775
|
import { rm as rm10 } from "fs/promises";
|
|
22654
22776
|
var {build: bunBuild9, Glob: Glob9 } = globalThis.Bun;
|
|
22655
22777
|
var toSafeFileName6 = (specifier) => {
|
|
@@ -22662,12 +22784,12 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22662
22784
|
} catch {
|
|
22663
22785
|
return false;
|
|
22664
22786
|
}
|
|
22665
|
-
}, 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,
|
|
22787
|
+
}, 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) => {
|
|
22666
22788
|
const dep = [];
|
|
22667
22789
|
const framework = [];
|
|
22668
22790
|
try {
|
|
22669
22791
|
const content = await Bun.file(file5).text();
|
|
22670
|
-
for (const imp of
|
|
22792
|
+
for (const imp of transpiler6.scanImports(content)) {
|
|
22671
22793
|
if (isDepSpecifier(imp.path))
|
|
22672
22794
|
dep.push(imp.path);
|
|
22673
22795
|
else if (isFrameworkRootCandidate(imp.path))
|
|
@@ -22684,9 +22806,9 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22684
22806
|
} catch {
|
|
22685
22807
|
return empty;
|
|
22686
22808
|
}
|
|
22687
|
-
}, collectDirSpecifiers = async (dir,
|
|
22809
|
+
}, collectDirSpecifiers = async (dir, transpiler6, dep, framework) => {
|
|
22688
22810
|
const files = await scanDirFiles(dir);
|
|
22689
|
-
const results = await Promise.all(files.map((file5) => readFileSpecifiers(file5,
|
|
22811
|
+
const results = await Promise.all(files.map((file5) => readFileSpecifiers(file5, transpiler6)));
|
|
22690
22812
|
for (const result of results) {
|
|
22691
22813
|
for (const spec of result.dep)
|
|
22692
22814
|
dep.add(spec);
|
|
@@ -22696,15 +22818,15 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22696
22818
|
}, scanBareImports = async (directories) => {
|
|
22697
22819
|
const dep = new Set;
|
|
22698
22820
|
const framework = new Set;
|
|
22699
|
-
const
|
|
22700
|
-
await Promise.all(directories.map((dir) => collectDirSpecifiers(dir,
|
|
22821
|
+
const transpiler6 = new Bun.Transpiler({ loader: "tsx" });
|
|
22822
|
+
await Promise.all(directories.map((dir) => collectDirSpecifiers(dir, transpiler6, dep, framework)));
|
|
22701
22823
|
return {
|
|
22702
22824
|
dep: Array.from(dep).filter(isResolvable4),
|
|
22703
22825
|
framework: Array.from(framework).filter(isResolvable4)
|
|
22704
22826
|
};
|
|
22705
22827
|
}, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
|
|
22706
22828
|
const { readFileSync: readFileSync21 } = await import("fs");
|
|
22707
|
-
const
|
|
22829
|
+
const transpiler6 = new Bun.Transpiler({ loader: "js" });
|
|
22708
22830
|
const newSpecs = new Set;
|
|
22709
22831
|
for (const spec of specs) {
|
|
22710
22832
|
if (alreadyScanned.has(spec))
|
|
@@ -22724,7 +22846,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22724
22846
|
}
|
|
22725
22847
|
let imports;
|
|
22726
22848
|
try {
|
|
22727
|
-
imports =
|
|
22849
|
+
imports = transpiler6.scanImports(content);
|
|
22728
22850
|
} catch {
|
|
22729
22851
|
continue;
|
|
22730
22852
|
}
|
|
@@ -22760,7 +22882,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22760
22882
|
}), buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
|
|
22761
22883
|
const entries = await Promise.all(specifiers.map(async (specifier) => {
|
|
22762
22884
|
const safeName = toSafeFileName6(specifier);
|
|
22763
|
-
const entryPath =
|
|
22885
|
+
const entryPath = join31(tmpDir, `${safeName}.ts`);
|
|
22764
22886
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
22765
22887
|
return { entryPath, specifier };
|
|
22766
22888
|
}));
|
|
@@ -22821,9 +22943,9 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22821
22943
|
const { dep: initialSpecs, framework: frameworkRoots } = await scanBareImports(directories);
|
|
22822
22944
|
if (initialSpecs.length === 0 && frameworkRoots.length === 0)
|
|
22823
22945
|
return {};
|
|
22824
|
-
const vendorDir =
|
|
22946
|
+
const vendorDir = join31(buildDir, "vendor");
|
|
22825
22947
|
mkdirSync13(vendorDir, { recursive: true });
|
|
22826
|
-
const tmpDir =
|
|
22948
|
+
const tmpDir = join31(buildDir, "_dep_vendor_tmp");
|
|
22827
22949
|
mkdirSync13(tmpDir, { recursive: true });
|
|
22828
22950
|
const allSpecs = new Set(initialSpecs);
|
|
22829
22951
|
const alreadyScanned = new Set;
|
|
@@ -22906,7 +23028,7 @@ __export(exports_devBuild, {
|
|
|
22906
23028
|
});
|
|
22907
23029
|
import { readdir as readdir5 } from "fs/promises";
|
|
22908
23030
|
import { statSync as statSync5 } from "fs";
|
|
22909
|
-
import { resolve as
|
|
23031
|
+
import { resolve as resolve40 } from "path";
|
|
22910
23032
|
var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
22911
23033
|
const configuredDirs = [
|
|
22912
23034
|
config.reactDirectory,
|
|
@@ -22929,7 +23051,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
22929
23051
|
return Object.keys(config).length > 0 ? config : null;
|
|
22930
23052
|
}, reloadConfig = async () => {
|
|
22931
23053
|
try {
|
|
22932
|
-
const configPath2 =
|
|
23054
|
+
const configPath2 = resolve40(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
22933
23055
|
const source = await Bun.file(configPath2).text();
|
|
22934
23056
|
return parseDirectoryConfig(source);
|
|
22935
23057
|
} catch {
|
|
@@ -23014,7 +23136,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
23014
23136
|
state.fileChangeQueue.clear();
|
|
23015
23137
|
}
|
|
23016
23138
|
}, handleCachedReload = async () => {
|
|
23017
|
-
const serverMtime = statSync5(
|
|
23139
|
+
const serverMtime = statSync5(resolve40(Bun.main)).mtimeMs;
|
|
23018
23140
|
const lastMtime = globalThis.__hmrServerMtime;
|
|
23019
23141
|
globalThis.__hmrServerMtime = serverMtime;
|
|
23020
23142
|
const cached = globalThis.__hmrDevResult;
|
|
@@ -23051,8 +23173,8 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
23051
23173
|
return true;
|
|
23052
23174
|
}, resolveAbsoluteVersion2 = async () => {
|
|
23053
23175
|
const candidates = [
|
|
23054
|
-
|
|
23055
|
-
|
|
23176
|
+
resolve40(import.meta.dir, "..", "..", "package.json"),
|
|
23177
|
+
resolve40(import.meta.dir, "..", "package.json")
|
|
23056
23178
|
];
|
|
23057
23179
|
const [candidate, ...remaining] = candidates;
|
|
23058
23180
|
if (!candidate) {
|
|
@@ -23078,7 +23200,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
23078
23200
|
const entries = await readdir5(vendorDir).catch(() => emptyStringArray);
|
|
23079
23201
|
await Promise.all(entries.filter((entry) => entry.endsWith(".js")).map(async (entry) => {
|
|
23080
23202
|
const webPath = `/${framework}/vendor/${entry}`;
|
|
23081
|
-
const bytes = await Bun.file(
|
|
23203
|
+
const bytes = await Bun.file(resolve40(vendorDir, entry)).bytes();
|
|
23082
23204
|
assetStore.set(webPath, bytes);
|
|
23083
23205
|
}));
|
|
23084
23206
|
}, devBuild = async (config) => {
|
|
@@ -23146,11 +23268,11 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
23146
23268
|
cleanStaleAssets(state.assetStore, manifest, state.resolvedPaths.buildDir);
|
|
23147
23269
|
recordStep("populate asset store", stepStartedAt);
|
|
23148
23270
|
stepStartedAt = performance.now();
|
|
23149
|
-
const reactVendorDir =
|
|
23150
|
-
const angularVendorDir =
|
|
23151
|
-
const svelteVendorDir =
|
|
23152
|
-
const vueVendorDir =
|
|
23153
|
-
const depVendorDir =
|
|
23271
|
+
const reactVendorDir = resolve40(state.resolvedPaths.buildDir, "react", "vendor");
|
|
23272
|
+
const angularVendorDir = resolve40(state.resolvedPaths.buildDir, "angular", "vendor");
|
|
23273
|
+
const svelteVendorDir = resolve40(state.resolvedPaths.buildDir, "svelte", "vendor");
|
|
23274
|
+
const vueVendorDir = resolve40(state.resolvedPaths.buildDir, "vue", "vendor");
|
|
23275
|
+
const depVendorDir = resolve40(state.resolvedPaths.buildDir, "vendor");
|
|
23154
23276
|
const { buildDepVendor: buildDepVendor2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
|
|
23155
23277
|
const [, angularSpecs, , , , , depPaths] = await Promise.all([
|
|
23156
23278
|
config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
|
|
@@ -23228,7 +23350,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
23228
23350
|
manifest
|
|
23229
23351
|
};
|
|
23230
23352
|
globalThis.__hmrDevResult = result;
|
|
23231
|
-
globalThis.__hmrServerMtime = statSync5(
|
|
23353
|
+
globalThis.__hmrServerMtime = statSync5(resolve40(Bun.main)).mtimeMs;
|
|
23232
23354
|
return result;
|
|
23233
23355
|
};
|
|
23234
23356
|
var init_devBuild = __esm(() => {
|
|
@@ -23373,8 +23495,8 @@ var STORE_KEY = "__elysiaStore", getGlobalValue = (key) => Reflect.get(globalThi
|
|
|
23373
23495
|
return null;
|
|
23374
23496
|
if (!pathname.startsWith("/"))
|
|
23375
23497
|
return null;
|
|
23376
|
-
const { resolve:
|
|
23377
|
-
const candidate =
|
|
23498
|
+
const { resolve: resolve41, normalize } = await import("path");
|
|
23499
|
+
const candidate = resolve41(buildDir, pathname.slice(1));
|
|
23378
23500
|
const normalizedBuild = normalize(buildDir);
|
|
23379
23501
|
if (!candidate.startsWith(normalizedBuild))
|
|
23380
23502
|
return null;
|
|
@@ -23458,12 +23580,12 @@ __export(exports_devtoolsJson, {
|
|
|
23458
23580
|
devtoolsJson: () => devtoolsJson
|
|
23459
23581
|
});
|
|
23460
23582
|
import { existsSync as existsSync28, mkdirSync as mkdirSync14, readFileSync as readFileSync21, writeFileSync as writeFileSync9 } from "fs";
|
|
23461
|
-
import { dirname as
|
|
23583
|
+
import { dirname as dirname23, join as join32, resolve as resolve41 } from "path";
|
|
23462
23584
|
import { Elysia as Elysia3 } from "elysia";
|
|
23463
23585
|
var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_KEY = "__absoluteDevtoolsWorkspaceUuid", getGlobalUuid = () => Reflect.get(globalThis, UUID_CACHE_KEY), setGlobalUuid = (uuid) => {
|
|
23464
23586
|
Reflect.set(globalThis, UUID_CACHE_KEY, uuid);
|
|
23465
23587
|
return uuid;
|
|
23466
|
-
}, 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) =>
|
|
23588
|
+
}, 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) => {
|
|
23467
23589
|
if (!existsSync28(cachePath))
|
|
23468
23590
|
return null;
|
|
23469
23591
|
try {
|
|
@@ -23485,11 +23607,11 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
|
|
|
23485
23607
|
if (cachedUuid)
|
|
23486
23608
|
return setGlobalUuid(cachedUuid);
|
|
23487
23609
|
const uuid = crypto.randomUUID();
|
|
23488
|
-
mkdirSync14(
|
|
23610
|
+
mkdirSync14(dirname23(cachePath), { recursive: true });
|
|
23489
23611
|
writeFileSync9(cachePath, uuid, "utf-8");
|
|
23490
23612
|
return setGlobalUuid(uuid);
|
|
23491
23613
|
}, devtoolsJson = (buildDir, options = {}) => {
|
|
23492
|
-
const rootPath =
|
|
23614
|
+
const rootPath = resolve41(options.projectRoot ?? process.cwd());
|
|
23493
23615
|
const root = options.normalizeForWindowsContainer === false ? rootPath : normalizeDevtoolsWorkspaceRoot(rootPath);
|
|
23494
23616
|
const uuid = getOrCreateUuid(buildDir, options);
|
|
23495
23617
|
return new Elysia3({ name: "absolute-devtools-json" }).get(ENDPOINT, () => ({
|
|
@@ -23502,11 +23624,11 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
|
|
|
23502
23624
|
if (process.env.WSL_DISTRO_NAME) {
|
|
23503
23625
|
const distro = process.env.WSL_DISTRO_NAME;
|
|
23504
23626
|
const withoutLeadingSlash = root.replace(/^\//, "");
|
|
23505
|
-
return
|
|
23627
|
+
return join32("\\\\wsl.localhost", distro, withoutLeadingSlash).replace(/\//g, "\\");
|
|
23506
23628
|
}
|
|
23507
23629
|
if (process.env.DOCKER_DESKTOP && !root.startsWith("\\\\")) {
|
|
23508
23630
|
const withoutLeadingSlash = root.replace(/^\//, "");
|
|
23509
|
-
return
|
|
23631
|
+
return join32("\\\\wsl.localhost", "docker-desktop-data", withoutLeadingSlash).replace(/\//g, "\\");
|
|
23510
23632
|
}
|
|
23511
23633
|
return root;
|
|
23512
23634
|
};
|
|
@@ -23518,7 +23640,7 @@ __export(exports_imageOptimizer, {
|
|
|
23518
23640
|
imageOptimizer: () => imageOptimizer
|
|
23519
23641
|
});
|
|
23520
23642
|
import { existsSync as existsSync29 } from "fs";
|
|
23521
|
-
import { resolve as
|
|
23643
|
+
import { resolve as resolve42 } from "path";
|
|
23522
23644
|
import { Elysia as Elysia4 } from "elysia";
|
|
23523
23645
|
var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avifInProgress, safeResolve = (path, baseDir) => {
|
|
23524
23646
|
try {
|
|
@@ -23531,7 +23653,7 @@ var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avi
|
|
|
23531
23653
|
}
|
|
23532
23654
|
}, resolveLocalImage = (url, buildDir) => {
|
|
23533
23655
|
const cleanPath = url.startsWith("/") ? url.slice(1) : url;
|
|
23534
|
-
return safeResolve(cleanPath, buildDir) ?? safeResolve(cleanPath,
|
|
23656
|
+
return safeResolve(cleanPath, buildDir) ?? safeResolve(cleanPath, resolve42(process.cwd()));
|
|
23535
23657
|
}, parseQueryParams = (query, allowedSizes, defaultQuality) => {
|
|
23536
23658
|
const url = typeof query["url"] === "string" ? query["url"] : undefined;
|
|
23537
23659
|
const wParam = typeof query["w"] === "string" ? query["w"] : undefined;
|
|
@@ -23823,7 +23945,7 @@ __export(exports_prerender, {
|
|
|
23823
23945
|
PRERENDER_BYPASS_HEADER: () => PRERENDER_BYPASS_HEADER
|
|
23824
23946
|
});
|
|
23825
23947
|
import { mkdirSync as mkdirSync15, readFileSync as readFileSync22 } from "fs";
|
|
23826
|
-
import { join as
|
|
23948
|
+
import { join as join33 } from "path";
|
|
23827
23949
|
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) => {
|
|
23828
23950
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
23829
23951
|
await Bun.write(metaPath, String(Date.now()));
|
|
@@ -23889,7 +24011,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
|
|
|
23889
24011
|
return false;
|
|
23890
24012
|
const html = await res.text();
|
|
23891
24013
|
const fileName = routeToFilename(route);
|
|
23892
|
-
const filePath =
|
|
24014
|
+
const filePath = join33(prerenderDir, fileName);
|
|
23893
24015
|
await Bun.write(filePath, html);
|
|
23894
24016
|
await writeTimestamp(filePath);
|
|
23895
24017
|
return true;
|
|
@@ -23915,13 +24037,13 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
|
|
|
23915
24037
|
}
|
|
23916
24038
|
const html = await res.text();
|
|
23917
24039
|
const fileName = routeToFilename(route);
|
|
23918
|
-
const filePath =
|
|
24040
|
+
const filePath = join33(prerenderDir, fileName);
|
|
23919
24041
|
await Bun.write(filePath, html);
|
|
23920
24042
|
await writeTimestamp(filePath);
|
|
23921
24043
|
result.routes.set(route, filePath);
|
|
23922
24044
|
log2?.(` Pre-rendered ${route} \u2192 ${fileName} (${html.length} bytes)`);
|
|
23923
24045
|
}, prerender = async (port, outDir, staticConfig, log2) => {
|
|
23924
|
-
const prerenderDir =
|
|
24046
|
+
const prerenderDir = join33(outDir, "_prerendered");
|
|
23925
24047
|
mkdirSync15(prerenderDir, { recursive: true });
|
|
23926
24048
|
const baseUrl = `http://localhost:${port}`;
|
|
23927
24049
|
let routes;
|
|
@@ -24520,11 +24642,11 @@ var handleHTMXPageRequest = async (pagePath) => {
|
|
|
24520
24642
|
};
|
|
24521
24643
|
// src/core/prepare.ts
|
|
24522
24644
|
import { existsSync as existsSync30, readdirSync as readdirSync3, readFileSync as readFileSync23 } from "fs";
|
|
24523
|
-
import { basename as basename13, join as
|
|
24645
|
+
import { basename as basename13, join as join34, relative as relative17, resolve as resolve43 } from "path";
|
|
24524
24646
|
import { Elysia as Elysia5 } from "elysia";
|
|
24525
24647
|
|
|
24526
24648
|
// src/utils/loadConfig.ts
|
|
24527
|
-
import { resolve as
|
|
24649
|
+
import { resolve as resolve8 } from "path";
|
|
24528
24650
|
var RESERVED_TOP_LEVEL_KEYS = new Set([
|
|
24529
24651
|
"assetsDirectory",
|
|
24530
24652
|
"astroDirectory",
|
|
@@ -24617,7 +24739,7 @@ var loadConfig = async (configPath) => {
|
|
|
24617
24739
|
return config;
|
|
24618
24740
|
};
|
|
24619
24741
|
var loadRawConfig = async (configPath) => {
|
|
24620
|
-
const resolved =
|
|
24742
|
+
const resolved = resolve8(configPath ?? process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
24621
24743
|
const mod = await import(resolved);
|
|
24622
24744
|
const config = mod.default ?? mod.config;
|
|
24623
24745
|
if (!config) {
|
|
@@ -24632,7 +24754,7 @@ Expected: export default defineConfig({ ... })`);
|
|
|
24632
24754
|
|
|
24633
24755
|
// src/core/loadIslandRegistry.ts
|
|
24634
24756
|
init_islandEntries();
|
|
24635
|
-
import { resolve as
|
|
24757
|
+
import { resolve as resolve9 } from "path";
|
|
24636
24758
|
var isRecord6 = (value) => typeof value === "object" && value !== null;
|
|
24637
24759
|
var resolveRegistryExport2 = (mod) => {
|
|
24638
24760
|
if (isRecord6(mod.islandRegistry))
|
|
@@ -24644,7 +24766,7 @@ var resolveRegistryExport2 = (mod) => {
|
|
|
24644
24766
|
var isRegistryModuleExport = (value) => isRecord6(value);
|
|
24645
24767
|
var isIslandRegistryInput = (value) => isRecord6(value);
|
|
24646
24768
|
var loadIslandRegistry = async (registryPath) => {
|
|
24647
|
-
const resolvedRegistryPath =
|
|
24769
|
+
const resolvedRegistryPath = resolve9(registryPath);
|
|
24648
24770
|
const buildInfo = await loadIslandRegistryBuildInfo(resolvedRegistryPath);
|
|
24649
24771
|
if (buildInfo.definitions.length > 0) {
|
|
24650
24772
|
return buildInfo.registry;
|
|
@@ -24943,7 +25065,7 @@ var collectPrewarmFiles = async (prewarmDirs) => {
|
|
|
24943
25065
|
for (const { dir, pattern } of prewarmDirs) {
|
|
24944
25066
|
const glob = new Glob10(pattern);
|
|
24945
25067
|
const matches = [
|
|
24946
|
-
...glob.scanSync({ absolute: true, cwd:
|
|
25068
|
+
...glob.scanSync({ absolute: true, cwd: resolve43(dir) })
|
|
24947
25069
|
];
|
|
24948
25070
|
files.push(...matches);
|
|
24949
25071
|
}
|
|
@@ -24954,7 +25076,7 @@ var warmPrewarmDirs = async (prewarmDirs, warmCache2, SRC_URL_PREFIX2) => {
|
|
|
24954
25076
|
for (const file5 of files) {
|
|
24955
25077
|
if (file5.includes("/node_modules/"))
|
|
24956
25078
|
continue;
|
|
24957
|
-
const rel =
|
|
25079
|
+
const rel = relative17(process.cwd(), file5).replace(/\\/g, "/");
|
|
24958
25080
|
warmCache2(`${SRC_URL_PREFIX2}${rel}`);
|
|
24959
25081
|
}
|
|
24960
25082
|
};
|
|
@@ -24979,10 +25101,10 @@ var patchManifestIndexes = (manifest, devIndexDir, SRC_URL_PREFIX2) => {
|
|
|
24979
25101
|
const fileName = resolveDevIndexFileName(manifest[key], baseName);
|
|
24980
25102
|
if (!fileName)
|
|
24981
25103
|
continue;
|
|
24982
|
-
const srcPath =
|
|
25104
|
+
const srcPath = resolve43(devIndexDir, fileName);
|
|
24983
25105
|
if (!existsSync30(srcPath))
|
|
24984
25106
|
continue;
|
|
24985
|
-
const rel =
|
|
25107
|
+
const rel = relative17(process.cwd(), srcPath).replace(/\\/g, "/");
|
|
24986
25108
|
manifest[key] = `${SRC_URL_PREFIX2}${rel}`;
|
|
24987
25109
|
}
|
|
24988
25110
|
};
|
|
@@ -25052,7 +25174,7 @@ var prepareDev = async (config, buildDir) => {
|
|
|
25052
25174
|
stepStartedAt = performance.now();
|
|
25053
25175
|
const hmrPlugin = hmr2(result.hmrState, result.manifest, moduleHandler);
|
|
25054
25176
|
const { devtoolsJson: devtoolsJson2 } = await Promise.resolve().then(() => (init_devtoolsJson(), exports_devtoolsJson));
|
|
25055
|
-
const devIndexDir =
|
|
25177
|
+
const devIndexDir = resolve43(buildDir, "_src_indexes");
|
|
25056
25178
|
patchManifestIndexes(result.manifest, devIndexDir, SRC_URL_PREFIX2);
|
|
25057
25179
|
recordStep("configure dev plugins", stepStartedAt);
|
|
25058
25180
|
stepStartedAt = performance.now();
|
|
@@ -25101,7 +25223,7 @@ var loadPrerenderMap = (prerenderDir) => {
|
|
|
25101
25223
|
continue;
|
|
25102
25224
|
const name = basename13(entry, ".html");
|
|
25103
25225
|
const route = name === "index" ? "/" : `/${name}`;
|
|
25104
|
-
map.set(route,
|
|
25226
|
+
map.set(route, join34(prerenderDir, entry));
|
|
25105
25227
|
}
|
|
25106
25228
|
return map;
|
|
25107
25229
|
};
|
|
@@ -25133,7 +25255,7 @@ var prepare = async (configOrPath) => {
|
|
|
25133
25255
|
recordStep("load config", stepStartedAt);
|
|
25134
25256
|
const nodeEnv = process.env["NODE_ENV"];
|
|
25135
25257
|
const isDev3 = nodeEnv === "development";
|
|
25136
|
-
const buildDir =
|
|
25258
|
+
const buildDir = resolve43(process.env.ABSOLUTE_BUILD_DIR ?? config.buildDirectory ?? "build");
|
|
25137
25259
|
if (isDev3) {
|
|
25138
25260
|
stepStartedAt = performance.now();
|
|
25139
25261
|
const result = await prepareDev(config, buildDir);
|
|
@@ -25150,7 +25272,7 @@ var prepare = async (configOrPath) => {
|
|
|
25150
25272
|
setCurrentPageIslandMetadata(await loadPageIslandMetadata(config));
|
|
25151
25273
|
recordStep("load production manifest and island metadata", stepStartedAt);
|
|
25152
25274
|
stepStartedAt = performance.now();
|
|
25153
|
-
const conventionsPath =
|
|
25275
|
+
const conventionsPath = join34(buildDir, "conventions.json");
|
|
25154
25276
|
if (existsSync30(conventionsPath)) {
|
|
25155
25277
|
const conventions2 = JSON.parse(readFileSync23(conventionsPath, "utf-8"));
|
|
25156
25278
|
setConventions(conventions2);
|
|
@@ -25166,7 +25288,7 @@ var prepare = async (configOrPath) => {
|
|
|
25166
25288
|
});
|
|
25167
25289
|
recordStep("create static plugin", stepStartedAt);
|
|
25168
25290
|
stepStartedAt = performance.now();
|
|
25169
|
-
const prerenderDir =
|
|
25291
|
+
const prerenderDir = join34(buildDir, "_prerendered");
|
|
25170
25292
|
const prerenderMap = loadPrerenderMap(prerenderDir);
|
|
25171
25293
|
recordStep("load prerender map", stepStartedAt);
|
|
25172
25294
|
if (prerenderMap.size > 0) {
|
|
@@ -25225,10 +25347,10 @@ var {env: env4 } = globalThis.Bun;
|
|
|
25225
25347
|
|
|
25226
25348
|
// src/dev/devCert.ts
|
|
25227
25349
|
import { existsSync as existsSync31, mkdirSync as mkdirSync16, readFileSync as readFileSync24, rmSync as rmSync3 } from "fs";
|
|
25228
|
-
import { join as
|
|
25229
|
-
var CERT_DIR =
|
|
25230
|
-
var CERT_PATH =
|
|
25231
|
-
var KEY_PATH =
|
|
25350
|
+
import { join as join35 } from "path";
|
|
25351
|
+
var CERT_DIR = join35(process.cwd(), ".absolutejs");
|
|
25352
|
+
var CERT_PATH = join35(CERT_DIR, "cert.pem");
|
|
25353
|
+
var KEY_PATH = join35(CERT_DIR, "key.pem");
|
|
25232
25354
|
var CERT_VALIDITY_DAYS = 365;
|
|
25233
25355
|
var devLog = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[36m[dev]\x1B[0m ${msg}`);
|
|
25234
25356
|
var devWarn = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[33m[dev]\x1B[0m \x1B[33m${msg}\x1B[0m`);
|
|
@@ -25561,7 +25683,7 @@ var jsonLd2 = (schema) => {
|
|
|
25561
25683
|
// src/utils/defineEnv.ts
|
|
25562
25684
|
var {env: bunEnv } = globalThis.Bun;
|
|
25563
25685
|
import { existsSync as existsSync32, readFileSync as readFileSync25 } from "fs";
|
|
25564
|
-
import { resolve as
|
|
25686
|
+
import { resolve as resolve44 } from "path";
|
|
25565
25687
|
|
|
25566
25688
|
// node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
|
|
25567
25689
|
var exports_value = {};
|
|
@@ -31596,7 +31718,7 @@ ${lines.join(`
|
|
|
31596
31718
|
};
|
|
31597
31719
|
var checkEnvFileSecurity = (properties) => {
|
|
31598
31720
|
const cwd2 = process.cwd();
|
|
31599
|
-
const envPath =
|
|
31721
|
+
const envPath = resolve44(cwd2, ".env");
|
|
31600
31722
|
if (!existsSync32(envPath))
|
|
31601
31723
|
return;
|
|
31602
31724
|
const sensitiveKeys = Object.keys(properties).filter(isSensitive);
|
|
@@ -31606,7 +31728,7 @@ var checkEnvFileSecurity = (properties) => {
|
|
|
31606
31728
|
const presentKeys = sensitiveKeys.filter((key) => envContent.includes(`${key}=`));
|
|
31607
31729
|
if (presentKeys.length === 0)
|
|
31608
31730
|
return;
|
|
31609
|
-
const gitignorePath =
|
|
31731
|
+
const gitignorePath = resolve44(cwd2, ".gitignore");
|
|
31610
31732
|
if (existsSync32(gitignorePath)) {
|
|
31611
31733
|
const gitignore = readFileSync25(gitignorePath, "utf-8");
|
|
31612
31734
|
if (gitignore.split(`
|
|
@@ -31846,5 +31968,5 @@ export {
|
|
|
31846
31968
|
ANGULAR_INIT_TIMEOUT_MS
|
|
31847
31969
|
};
|
|
31848
31970
|
|
|
31849
|
-
//# debugId=
|
|
31971
|
+
//# debugId=89B8F1AE650871F764756E2164756E21
|
|
31850
31972
|
//# sourceMappingURL=index.js.map
|