@absolutejs/absolute 0.19.0-beta.927 → 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/build.js
CHANGED
|
@@ -3381,6 +3381,100 @@ var init_svelteServerModule = __esm(() => {
|
|
|
3381
3381
|
});
|
|
3382
3382
|
});
|
|
3383
3383
|
|
|
3384
|
+
// src/core/vueServerModule.ts
|
|
3385
|
+
import { mkdir as mkdir2 } from "fs/promises";
|
|
3386
|
+
import { dirname as dirname4, join as join7, relative as relative5, resolve as resolve8 } from "path";
|
|
3387
|
+
var {Transpiler } = globalThis.Bun;
|
|
3388
|
+
var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, transpiler2, ensureRelativeImportPath2 = (from, target) => {
|
|
3389
|
+
const importPath = relative5(dirname4(from), target).replace(/\\/g, "/");
|
|
3390
|
+
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
3391
|
+
}, getCachedModulePath2 = (sourcePath) => {
|
|
3392
|
+
const relativeSourcePath = relative5(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
3393
|
+
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
3394
|
+
return join7(serverCacheRoot2, `${normalizedSourcePath}.server.js`);
|
|
3395
|
+
}, writeIfChanged2 = async (path, content) => {
|
|
3396
|
+
const targetFile = Bun.file(path);
|
|
3397
|
+
if (await targetFile.exists()) {
|
|
3398
|
+
const currentContent = await targetFile.text();
|
|
3399
|
+
if (currentContent === content)
|
|
3400
|
+
return;
|
|
3401
|
+
}
|
|
3402
|
+
await Bun.write(path, content);
|
|
3403
|
+
}, stripExports = (code) => code.replace(/export\s+default/, "const script ="), mergeVueImports = (code) => {
|
|
3404
|
+
const lines = code.split(`
|
|
3405
|
+
`);
|
|
3406
|
+
const specifierSet = new Set;
|
|
3407
|
+
const vueImportRegex = /^import\s+{([^}]+)}\s+from\s+['"]vue['"];?$/;
|
|
3408
|
+
lines.forEach((line) => {
|
|
3409
|
+
const match = line.match(vueImportRegex);
|
|
3410
|
+
if (match?.[1])
|
|
3411
|
+
match[1].split(",").forEach((importSpecifier) => specifierSet.add(importSpecifier.trim()));
|
|
3412
|
+
});
|
|
3413
|
+
const nonVueLines = lines.filter((line) => !vueImportRegex.test(line));
|
|
3414
|
+
return specifierSet.size ? [
|
|
3415
|
+
`import { ${[...specifierSet].join(", ")} } from "vue";`,
|
|
3416
|
+
...nonVueLines
|
|
3417
|
+
].join(`
|
|
3418
|
+
`) : nonVueLines.join(`
|
|
3419
|
+
`);
|
|
3420
|
+
}, 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) => {
|
|
3421
|
+
const cachedModulePath = compiledModuleCache2.get(sourcePath);
|
|
3422
|
+
if (cachedModulePath)
|
|
3423
|
+
return cachedModulePath;
|
|
3424
|
+
const compiler = await import("@vue/compiler-sfc");
|
|
3425
|
+
const source = await Bun.file(sourcePath).text();
|
|
3426
|
+
const { descriptor } = compiler.parse(source, { filename: sourcePath });
|
|
3427
|
+
const componentId = Bun.hash(sourcePath).toString(BASE_36_RADIX).slice(0, ISLAND_COMPONENT_ID_LENGTH);
|
|
3428
|
+
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
3429
|
+
const compiledScript = hasScript ? compiler.compileScript(descriptor, {
|
|
3430
|
+
id: componentId,
|
|
3431
|
+
inlineTemplate: false
|
|
3432
|
+
}) : { bindings: {}, content: "export default {};" };
|
|
3433
|
+
const renderCode = descriptor.template ? compiler.compileTemplate({
|
|
3434
|
+
compilerOptions: {
|
|
3435
|
+
bindingMetadata: compiledScript.bindings,
|
|
3436
|
+
expressionPlugins: ["typescript"],
|
|
3437
|
+
prefixIdentifiers: true,
|
|
3438
|
+
isCustomElement: (tag) => tag === "absolute-island"
|
|
3439
|
+
},
|
|
3440
|
+
filename: sourcePath,
|
|
3441
|
+
id: componentId,
|
|
3442
|
+
scoped: descriptor.styles.some((styleBlock) => styleBlock.scoped),
|
|
3443
|
+
source: descriptor.template.content,
|
|
3444
|
+
ssr: true,
|
|
3445
|
+
ssrCssVars: descriptor.cssVars
|
|
3446
|
+
}).code : "const ssrRender = () => {};";
|
|
3447
|
+
const childImportPaths = extractRelativeVueImports(compiledScript.content);
|
|
3448
|
+
const compiledChildren = await Promise.all(childImportPaths.map(async (relativeImport) => ({
|
|
3449
|
+
compiledPath: await compileVueServerModule(resolve8(dirname4(sourcePath), relativeImport)),
|
|
3450
|
+
spec: relativeImport
|
|
3451
|
+
})));
|
|
3452
|
+
const strippedScript = stripExports(compiledScript.content);
|
|
3453
|
+
const transpiledScript = transpiler2.transformSync(strippedScript);
|
|
3454
|
+
const assembled = mergeVueImports([
|
|
3455
|
+
transpiledScript,
|
|
3456
|
+
renderCode,
|
|
3457
|
+
"script.ssrRender = ssrRender;",
|
|
3458
|
+
"export default script;"
|
|
3459
|
+
].join(`
|
|
3460
|
+
`));
|
|
3461
|
+
const compiledModulePath = getCachedModulePath2(sourcePath);
|
|
3462
|
+
let rewritten = assembled;
|
|
3463
|
+
for (const child of compiledChildren) {
|
|
3464
|
+
rewritten = rewritten.replaceAll(child.spec, ensureRelativeImportPath2(compiledModulePath, child.compiledPath));
|
|
3465
|
+
}
|
|
3466
|
+
await mkdir2(dirname4(compiledModulePath), { recursive: true });
|
|
3467
|
+
await writeIfChanged2(compiledModulePath, rewritten);
|
|
3468
|
+
compiledModuleCache2.set(sourcePath, compiledModulePath);
|
|
3469
|
+
return compiledModulePath;
|
|
3470
|
+
};
|
|
3471
|
+
var init_vueServerModule = __esm(() => {
|
|
3472
|
+
init_constants();
|
|
3473
|
+
serverCacheRoot2 = join7(process.cwd(), ".absolutejs", "islands", "vue");
|
|
3474
|
+
compiledModuleCache2 = new Map;
|
|
3475
|
+
transpiler2 = new Transpiler({ loader: "ts", target: "browser" });
|
|
3476
|
+
});
|
|
3477
|
+
|
|
3384
3478
|
// src/core/islandMarkupAttributes.ts
|
|
3385
3479
|
var getIslandMarkerAttributes = (props, islandId) => ({
|
|
3386
3480
|
"data-component": props.component,
|
|
@@ -3416,9 +3510,17 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
|
|
|
3416
3510
|
const loadPromise = loadAndCompileServerBuildComponent(buildReferencePath);
|
|
3417
3511
|
resolvedServerBuildComponentCache.set(buildReferencePath, loadPromise);
|
|
3418
3512
|
return loadPromise;
|
|
3513
|
+
}, resolveRuntimeImportTarget = async (resolvedModulePath) => {
|
|
3514
|
+
if (resolvedModulePath.endsWith(".svelte")) {
|
|
3515
|
+
return compileSvelteServerModule(resolvedModulePath);
|
|
3516
|
+
}
|
|
3517
|
+
if (resolvedModulePath.endsWith(".vue")) {
|
|
3518
|
+
return compileVueServerModule(resolvedModulePath);
|
|
3519
|
+
}
|
|
3520
|
+
return resolvedModulePath;
|
|
3419
3521
|
}, loadServerImportComponent = async (resolvedComponent, exportName) => {
|
|
3420
3522
|
const resolvedModulePath = resolvedComponent.startsWith(".") ? new URL(resolvedComponent, import.meta.url).pathname : resolvedComponent;
|
|
3421
|
-
const importTarget =
|
|
3523
|
+
const importTarget = await resolveRuntimeImportTarget(resolvedModulePath);
|
|
3422
3524
|
const loadedModule = await import(importTarget);
|
|
3423
3525
|
if (exportName && exportName !== "default" && exportName in loadedModule) {
|
|
3424
3526
|
return loadedModule[exportName];
|
|
@@ -3522,6 +3624,7 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
|
|
|
3522
3624
|
var init_renderIslandMarkup = __esm(() => {
|
|
3523
3625
|
init_islandSsr();
|
|
3524
3626
|
init_svelteServerModule();
|
|
3627
|
+
init_vueServerModule();
|
|
3525
3628
|
init_islandMarkupAttributes();
|
|
3526
3629
|
init_islands();
|
|
3527
3630
|
resolvedServerComponentCache = new Map;
|
|
@@ -8752,7 +8855,7 @@ __export(exports_tailwindCompiler, {
|
|
|
8752
8855
|
import { createHash as createHash2 } from "crypto";
|
|
8753
8856
|
import { existsSync as existsSync8, readFileSync as readFileSync5 } from "fs";
|
|
8754
8857
|
import { readFile as readFile2, stat } from "fs/promises";
|
|
8755
|
-
import { dirname as
|
|
8858
|
+
import { dirname as dirname5, isAbsolute as isAbsolute2, resolve as resolve9 } from "path";
|
|
8756
8859
|
var compilerCache, cachedTailwindCompile = null, loadTailwindCompile = async () => {
|
|
8757
8860
|
if (cachedTailwindCompile)
|
|
8758
8861
|
return cachedTailwindCompile;
|
|
@@ -8783,7 +8886,7 @@ var compilerCache, cachedTailwindCompile = null, loadTailwindCompile = async ()
|
|
|
8783
8886
|
} catch {
|
|
8784
8887
|
return Bun.resolveSync(id, base);
|
|
8785
8888
|
}
|
|
8786
|
-
const pkgDir =
|
|
8889
|
+
const pkgDir = dirname5(pkgJsonPath);
|
|
8787
8890
|
let pkg = {};
|
|
8788
8891
|
try {
|
|
8789
8892
|
pkg = JSON.parse(readFileSync5(pkgJsonPath, "utf-8"));
|
|
@@ -8799,29 +8902,29 @@ var compilerCache, cachedTailwindCompile = null, loadTailwindCompile = async ()
|
|
|
8799
8902
|
"dist/index.css"
|
|
8800
8903
|
].filter((entry) => typeof entry === "string");
|
|
8801
8904
|
for (const candidate of candidates) {
|
|
8802
|
-
const candidatePath =
|
|
8905
|
+
const candidatePath = resolve9(pkgDir, candidate);
|
|
8803
8906
|
if (existsSync8(candidatePath))
|
|
8804
8907
|
return candidatePath;
|
|
8805
8908
|
}
|
|
8806
8909
|
return Bun.resolveSync(id, base);
|
|
8807
8910
|
}, createLoadStylesheet = (deps) => async (id, base) => {
|
|
8808
|
-
const path = id.startsWith(".") || isAbsolute2(id) ?
|
|
8911
|
+
const path = id.startsWith(".") || isAbsolute2(id) ? resolve9(base, id) : resolveBareCssImport(id, base);
|
|
8809
8912
|
const content = await readFile2(path, "utf-8");
|
|
8810
8913
|
await recordDependency(deps, path);
|
|
8811
|
-
return { base:
|
|
8914
|
+
return { base: dirname5(path), content, path };
|
|
8812
8915
|
}, loadModule = async (id, base, _kind) => {
|
|
8813
|
-
const path = id.startsWith(".") || isAbsolute2(id) ?
|
|
8916
|
+
const path = id.startsWith(".") || isAbsolute2(id) ? resolve9(base, id) : Bun.resolveSync(id, base);
|
|
8814
8917
|
const module = await import(path);
|
|
8815
|
-
return { base:
|
|
8918
|
+
return { base: dirname5(path), module, path };
|
|
8816
8919
|
}, buildCompilerEntry = async (cssPath) => {
|
|
8817
8920
|
const compile = await loadTailwindCompile();
|
|
8818
|
-
const absPath =
|
|
8921
|
+
const absPath = resolve9(cssPath);
|
|
8819
8922
|
const css = await readFile2(absPath, "utf-8");
|
|
8820
8923
|
const cssMtimeMs = (await stat(absPath)).mtimeMs;
|
|
8821
8924
|
const cssDependencies = new Map;
|
|
8822
8925
|
cssDependencies.set(absPath, cssMtimeMs);
|
|
8823
8926
|
const compiler = await compile(css, {
|
|
8824
|
-
base:
|
|
8927
|
+
base: dirname5(absPath),
|
|
8825
8928
|
loadModule,
|
|
8826
8929
|
loadStylesheet: createLoadStylesheet(cssDependencies)
|
|
8827
8930
|
});
|
|
@@ -8844,11 +8947,11 @@ var compilerCache, cachedTailwindCompile = null, loadTailwindCompile = async ()
|
|
|
8844
8947
|
}, hashCss = (css) => createHash2("sha1").update(css).digest("hex"), fileMatchesSources = (file, sources) => {
|
|
8845
8948
|
if (sources.length === 0)
|
|
8846
8949
|
return true;
|
|
8847
|
-
const absFile =
|
|
8950
|
+
const absFile = resolve9(file);
|
|
8848
8951
|
for (const source of sources) {
|
|
8849
8952
|
if (source.negated)
|
|
8850
8953
|
continue;
|
|
8851
|
-
const absolutePattern =
|
|
8954
|
+
const absolutePattern = resolve9(source.base, source.pattern);
|
|
8852
8955
|
if (!/[*?{[]/.test(absolutePattern)) {
|
|
8853
8956
|
if (absolutePattern === absFile)
|
|
8854
8957
|
return true;
|
|
@@ -8893,7 +8996,7 @@ var compilerCache, cachedTailwindCompile = null, loadTailwindCompile = async ()
|
|
|
8893
8996
|
const seen = new Set;
|
|
8894
8997
|
const collected = [];
|
|
8895
8998
|
const scans = sources.filter((source) => !source.negated).map(async (source) => {
|
|
8896
|
-
const absolutePattern =
|
|
8999
|
+
const absolutePattern = resolve9(source.base, source.pattern);
|
|
8897
9000
|
const { glob: relativePattern, root } = splitGlobAtFirstMeta(absolutePattern);
|
|
8898
9001
|
if (!relativePattern) {
|
|
8899
9002
|
try {
|
|
@@ -8905,12 +9008,12 @@ var compilerCache, cachedTailwindCompile = null, loadTailwindCompile = async ()
|
|
|
8905
9008
|
}
|
|
8906
9009
|
const glob = new Bun.Glob(relativePattern);
|
|
8907
9010
|
const matches = [];
|
|
8908
|
-
for await (const
|
|
9011
|
+
for await (const relative6 of glob.scan({
|
|
8909
9012
|
absolute: false,
|
|
8910
9013
|
cwd: root,
|
|
8911
9014
|
onlyFiles: true
|
|
8912
9015
|
})) {
|
|
8913
|
-
matches.push(
|
|
9016
|
+
matches.push(resolve9(root, relative6));
|
|
8914
9017
|
}
|
|
8915
9018
|
return matches;
|
|
8916
9019
|
});
|
|
@@ -8942,7 +9045,7 @@ var compilerCache, cachedTailwindCompile = null, loadTailwindCompile = async ()
|
|
|
8942
9045
|
const results = await Promise.all(checks);
|
|
8943
9046
|
return results.some(Boolean);
|
|
8944
9047
|
}, getCompilerEntry = async (cssPath) => {
|
|
8945
|
-
const key =
|
|
9048
|
+
const key = resolve9(cssPath);
|
|
8946
9049
|
const cached = compilerCache.get(key);
|
|
8947
9050
|
if (cached && !await isCompilerStale(cached))
|
|
8948
9051
|
return cached;
|
|
@@ -8955,14 +9058,14 @@ var compilerCache, cachedTailwindCompile = null, loadTailwindCompile = async ()
|
|
|
8955
9058
|
compilerCache.clear();
|
|
8956
9059
|
return;
|
|
8957
9060
|
}
|
|
8958
|
-
compilerCache.delete(
|
|
9061
|
+
compilerCache.delete(resolve9(cssPath));
|
|
8959
9062
|
}, incrementalTailwindBuild = async (tailwind, buildPath, changedFiles, styleTransformConfig) => {
|
|
8960
9063
|
const startedAt = performance.now();
|
|
8961
9064
|
const entry = await getCompilerEntry(tailwind.input);
|
|
8962
9065
|
const inputAbs = entry.cssPath;
|
|
8963
9066
|
const filesToRescan = [];
|
|
8964
9067
|
for (const file of changedFiles) {
|
|
8965
|
-
const abs =
|
|
9068
|
+
const abs = resolve9(file);
|
|
8966
9069
|
if (abs === inputAbs)
|
|
8967
9070
|
continue;
|
|
8968
9071
|
if (!fileMatchesSources(abs, entry.sources))
|
|
@@ -8971,7 +9074,7 @@ var compilerCache, cachedTailwindCompile = null, loadTailwindCompile = async ()
|
|
|
8971
9074
|
}
|
|
8972
9075
|
await Promise.all(filesToRescan.map((file) => ingestFile(entry, file)));
|
|
8973
9076
|
const rawCss = entry.compiler.build([...entry.candidateCounts.keys()]);
|
|
8974
|
-
const outputPath =
|
|
9077
|
+
const outputPath = resolve9(buildPath, tailwind.output);
|
|
8975
9078
|
const finalCss = await compileStyleSource(outputPath, rawCss, "css", styleTransformConfig);
|
|
8976
9079
|
const hash = hashCss(finalCss);
|
|
8977
9080
|
const durationMs = performance.now() - startedAt;
|
|
@@ -8991,11 +9094,11 @@ var init_tailwindCompiler = __esm(() => {
|
|
|
8991
9094
|
});
|
|
8992
9095
|
|
|
8993
9096
|
// src/build/compileTailwind.ts
|
|
8994
|
-
import { mkdir as
|
|
8995
|
-
import { dirname as
|
|
9097
|
+
import { mkdir as mkdir3 } from "fs/promises";
|
|
9098
|
+
import { dirname as dirname6, join as join8 } from "path";
|
|
8996
9099
|
var TAILWIND_CANDIDATE_EXTENSION_PATTERN, isTailwindCandidate = (filePath) => TAILWIND_CANDIDATE_EXTENSION_PATTERN.test(filePath), compileTailwind = async (input, output, buildPath, styleTransformConfig) => {
|
|
8997
|
-
const outputPath =
|
|
8998
|
-
await
|
|
9100
|
+
const outputPath = join8(buildPath, output);
|
|
9101
|
+
await mkdir3(dirname6(outputPath), { recursive: true });
|
|
8999
9102
|
await incrementalTailwindBuild({ input, output }, buildPath, [], styleTransformConfig);
|
|
9000
9103
|
}, compileTailwindConfig = async (tailwind, buildPath, styleTransformConfig) => compileTailwind(tailwind.input, tailwind.output, buildPath, styleTransformConfig);
|
|
9001
9104
|
var init_compileTailwind = __esm(() => {
|
|
@@ -9005,7 +9108,7 @@ var init_compileTailwind = __esm(() => {
|
|
|
9005
9108
|
|
|
9006
9109
|
// src/utils/imageProcessing.ts
|
|
9007
9110
|
import { existsSync as existsSync9, mkdirSync as mkdirSync3, readFileSync as readFileSync6, writeFileSync as writeFileSync3 } from "fs";
|
|
9008
|
-
import { join as
|
|
9111
|
+
import { join as join9, resolve as resolve10 } from "path";
|
|
9009
9112
|
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) => {
|
|
9010
9113
|
for (const size of sizes) {
|
|
9011
9114
|
if (size >= target)
|
|
@@ -9060,7 +9163,7 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
|
|
|
9060
9163
|
const image = config?.imageSizes ?? DEFAULT_IMAGE_SIZES;
|
|
9061
9164
|
return [...device, ...image].sort((left, right) => left - right);
|
|
9062
9165
|
}, getCacheDir = (buildDir) => {
|
|
9063
|
-
const dir =
|
|
9166
|
+
const dir = join9(buildDir, ".cache", "images");
|
|
9064
9167
|
if (!existsSync9(dir))
|
|
9065
9168
|
mkdirSync3(dir, { recursive: true });
|
|
9066
9169
|
return dir;
|
|
@@ -9117,8 +9220,8 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
|
|
|
9117
9220
|
return toBuffer(buffer);
|
|
9118
9221
|
}
|
|
9119
9222
|
}, readFromCache = (cacheDir, cacheKey) => {
|
|
9120
|
-
const metaPath =
|
|
9121
|
-
const dataPath =
|
|
9223
|
+
const metaPath = join9(cacheDir, `${cacheKey}.meta`);
|
|
9224
|
+
const dataPath = join9(cacheDir, `${cacheKey}.data`);
|
|
9122
9225
|
if (!existsSync9(metaPath) || !existsSync9(dataPath))
|
|
9123
9226
|
return null;
|
|
9124
9227
|
try {
|
|
@@ -9133,7 +9236,7 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
|
|
|
9133
9236
|
return sharpModule;
|
|
9134
9237
|
sharpLoaded = true;
|
|
9135
9238
|
try {
|
|
9136
|
-
const sharpPath =
|
|
9239
|
+
const sharpPath = resolve10(process.cwd(), "node_modules/sharp");
|
|
9137
9240
|
const mod = await import(sharpPath);
|
|
9138
9241
|
sharpModule = mod.default ?? mod;
|
|
9139
9242
|
return sharpModule;
|
|
@@ -9145,8 +9248,8 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
|
|
|
9145
9248
|
return null;
|
|
9146
9249
|
}
|
|
9147
9250
|
}, writeToCache = (cacheDir, cacheKey, buffer, meta) => {
|
|
9148
|
-
const metaPath =
|
|
9149
|
-
const dataPath =
|
|
9251
|
+
const metaPath = join9(cacheDir, `${cacheKey}.meta`);
|
|
9252
|
+
const dataPath = join9(cacheDir, `${cacheKey}.data`);
|
|
9150
9253
|
writeFileSync3(dataPath, buffer);
|
|
9151
9254
|
writeFileSync3(metaPath, JSON.stringify(meta));
|
|
9152
9255
|
};
|
|
@@ -9234,7 +9337,7 @@ var init_optimizeHtmlImages = __esm(() => {
|
|
|
9234
9337
|
// src/cli/scripts/telemetry.ts
|
|
9235
9338
|
import { existsSync as existsSync10, mkdirSync as mkdirSync4, readFileSync as readFileSync7, writeFileSync as writeFileSync4 } from "fs";
|
|
9236
9339
|
import { homedir } from "os";
|
|
9237
|
-
import { join as
|
|
9340
|
+
import { join as join10 } from "path";
|
|
9238
9341
|
var configDir, configPath, getTelemetryConfig = () => {
|
|
9239
9342
|
try {
|
|
9240
9343
|
if (!existsSync10(configPath))
|
|
@@ -9247,14 +9350,14 @@ var configDir, configPath, getTelemetryConfig = () => {
|
|
|
9247
9350
|
}
|
|
9248
9351
|
};
|
|
9249
9352
|
var init_telemetry = __esm(() => {
|
|
9250
|
-
configDir =
|
|
9251
|
-
configPath =
|
|
9353
|
+
configDir = join10(homedir(), ".absolutejs");
|
|
9354
|
+
configPath = join10(configDir, "telemetry.json");
|
|
9252
9355
|
});
|
|
9253
9356
|
|
|
9254
9357
|
// src/cli/telemetryEvent.ts
|
|
9255
9358
|
import { existsSync as existsSync11, readFileSync as readFileSync8 } from "fs";
|
|
9256
9359
|
import { arch, platform } from "os";
|
|
9257
|
-
import { dirname as
|
|
9360
|
+
import { dirname as dirname7, join as join11, parse } from "path";
|
|
9258
9361
|
var checkCandidate = (candidate) => {
|
|
9259
9362
|
if (!existsSync11(candidate)) {
|
|
9260
9363
|
return null;
|
|
@@ -9274,12 +9377,12 @@ var checkCandidate = (candidate) => {
|
|
|
9274
9377
|
}, findPackageVersion = () => {
|
|
9275
9378
|
let { dir } = import.meta;
|
|
9276
9379
|
while (dir !== parse(dir).root) {
|
|
9277
|
-
const candidate =
|
|
9380
|
+
const candidate = join11(dir, "package.json");
|
|
9278
9381
|
const version = checkCandidate(candidate);
|
|
9279
9382
|
if (version) {
|
|
9280
9383
|
return version;
|
|
9281
9384
|
}
|
|
9282
|
-
dir =
|
|
9385
|
+
dir = dirname7(dir);
|
|
9283
9386
|
}
|
|
9284
9387
|
return "unknown";
|
|
9285
9388
|
}, sendTelemetryEvent = (event, payload) => {
|
|
@@ -9365,18 +9468,18 @@ var init_updateAssetPaths = __esm(() => {
|
|
|
9365
9468
|
|
|
9366
9469
|
// src/dev/buildHMRClient.ts
|
|
9367
9470
|
import { existsSync as existsSync12 } from "fs";
|
|
9368
|
-
import { resolve as
|
|
9471
|
+
import { resolve as resolve11 } from "path";
|
|
9369
9472
|
var {build: bunBuild } = globalThis.Bun;
|
|
9370
9473
|
var resolveHmrClientPath = () => {
|
|
9371
9474
|
const projectRoot = process.cwd();
|
|
9372
|
-
const fromSource =
|
|
9475
|
+
const fromSource = resolve11(import.meta.dir, "client/hmrClient.ts");
|
|
9373
9476
|
if (existsSync12(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
9374
9477
|
return fromSource;
|
|
9375
9478
|
}
|
|
9376
|
-
const fromNodeModules =
|
|
9479
|
+
const fromNodeModules = resolve11(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client/hmrClient.ts");
|
|
9377
9480
|
if (existsSync12(fromNodeModules))
|
|
9378
9481
|
return fromNodeModules;
|
|
9379
|
-
return
|
|
9482
|
+
return resolve11(import.meta.dir, "dev/client/hmrClient.ts");
|
|
9380
9483
|
}, hmrClientPath2, buildHMRClient = async () => {
|
|
9381
9484
|
const entryPoint = hmrClientPath2;
|
|
9382
9485
|
const result = await bunBuild({
|
|
@@ -9406,7 +9509,7 @@ var init_buildHMRClient = __esm(() => {
|
|
|
9406
9509
|
// src/build/nativeRewrite.ts
|
|
9407
9510
|
import { dlopen, FFIType, ptr } from "bun:ffi";
|
|
9408
9511
|
import { platform as platform2, arch as arch2 } from "os";
|
|
9409
|
-
import { resolve as
|
|
9512
|
+
import { resolve as resolve12 } from "path";
|
|
9410
9513
|
var ffiDefinition, nativeLib = null, loadNative = () => {
|
|
9411
9514
|
if (nativeLib !== null)
|
|
9412
9515
|
return nativeLib;
|
|
@@ -9424,7 +9527,7 @@ var ffiDefinition, nativeLib = null, loadNative = () => {
|
|
|
9424
9527
|
if (!libPath)
|
|
9425
9528
|
return null;
|
|
9426
9529
|
try {
|
|
9427
|
-
const fullPath =
|
|
9530
|
+
const fullPath = resolve12(import.meta.dir, "../../native/packages", libPath);
|
|
9428
9531
|
const lib = dlopen(fullPath, ffiDefinition);
|
|
9429
9532
|
nativeLib = lib.symbols;
|
|
9430
9533
|
return nativeLib;
|
|
@@ -9570,7 +9673,7 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
|
|
|
9570
9673
|
|
|
9571
9674
|
// src/build/angularLinkerPlugin.ts
|
|
9572
9675
|
import { existsSync as existsSync13, mkdirSync as mkdirSync5, readFileSync as readFileSync9, writeFileSync as writeFileSync5 } from "fs";
|
|
9573
|
-
import { dirname as
|
|
9676
|
+
import { dirname as dirname8, join as join12, relative as relative6, resolve as resolve13 } from "path";
|
|
9574
9677
|
import { createHash as createHash3 } from "crypto";
|
|
9575
9678
|
var CACHE_ROOT, createAngularLinkerPlugin = (linkerJitMode) => ({
|
|
9576
9679
|
name: "angular-linker",
|
|
@@ -9578,7 +9681,7 @@ var CACHE_ROOT, createAngularLinkerPlugin = (linkerJitMode) => ({
|
|
|
9578
9681
|
let needsLinking;
|
|
9579
9682
|
let babelTransform;
|
|
9580
9683
|
let linkerPlugin;
|
|
9581
|
-
const cacheDir =
|
|
9684
|
+
const cacheDir = join12(CACHE_ROOT, linkerJitMode ? "jit" : "aot");
|
|
9582
9685
|
bld.onLoad({ filter: /[\\/]@angular[\\/].*\.m?js$/ }, async (args) => {
|
|
9583
9686
|
const source = await Bun.file(args.path).text();
|
|
9584
9687
|
if (!needsLinking) {
|
|
@@ -9591,7 +9694,7 @@ var CACHE_ROOT, createAngularLinkerPlugin = (linkerJitMode) => ({
|
|
|
9591
9694
|
return;
|
|
9592
9695
|
}
|
|
9593
9696
|
const hash = createHash3("md5").update(source).digest("hex");
|
|
9594
|
-
const cachePath =
|
|
9697
|
+
const cachePath = join12(cacheDir, `${hash}.js`);
|
|
9595
9698
|
if (existsSync13(cachePath)) {
|
|
9596
9699
|
return {
|
|
9597
9700
|
contents: readFileSync9(cachePath, "utf-8"),
|
|
@@ -9608,11 +9711,11 @@ var CACHE_ROOT, createAngularLinkerPlugin = (linkerJitMode) => ({
|
|
|
9608
9711
|
const mod = await import(linkerSpecifier);
|
|
9609
9712
|
linkerPlugin = mod.createEs2015LinkerPlugin({
|
|
9610
9713
|
fileSystem: {
|
|
9611
|
-
dirname:
|
|
9714
|
+
dirname: dirname8,
|
|
9612
9715
|
exists: existsSync13,
|
|
9613
9716
|
readFile: readFileSync9,
|
|
9614
|
-
relative:
|
|
9615
|
-
resolve:
|
|
9717
|
+
relative: relative6,
|
|
9718
|
+
resolve: resolve13
|
|
9616
9719
|
},
|
|
9617
9720
|
linkerJitMode,
|
|
9618
9721
|
logger: {
|
|
@@ -9643,7 +9746,7 @@ var CACHE_ROOT, createAngularLinkerPlugin = (linkerJitMode) => ({
|
|
|
9643
9746
|
}
|
|
9644
9747
|
}), angularLinkerPlugin;
|
|
9645
9748
|
var init_angularLinkerPlugin = __esm(() => {
|
|
9646
|
-
CACHE_ROOT =
|
|
9749
|
+
CACHE_ROOT = resolve13(".absolutejs", "cache", "angular-linker");
|
|
9647
9750
|
angularLinkerPlugin = createAngularLinkerPlugin(false);
|
|
9648
9751
|
});
|
|
9649
9752
|
|
|
@@ -9654,7 +9757,7 @@ __export(exports_hmrInjectionPlugin, {
|
|
|
9654
9757
|
applyAngularHmrInjection: () => applyAngularHmrInjection
|
|
9655
9758
|
});
|
|
9656
9759
|
import { readFile as readFile5 } from "fs/promises";
|
|
9657
|
-
import { relative as
|
|
9760
|
+
import { relative as relative7, resolve as resolve14 } from "path";
|
|
9658
9761
|
var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames = (jsSource) => {
|
|
9659
9762
|
const names = new Set;
|
|
9660
9763
|
IMPORT_RE.lastIndex = 0;
|
|
@@ -9817,7 +9920,7 @@ var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames =
|
|
|
9817
9920
|
}
|
|
9818
9921
|
`, applyAngularHmrInjection = (jsSource, componentJsAbsPath, params) => {
|
|
9819
9922
|
const { generatedAngularRoot, userAngularRoot, projectRoot } = params;
|
|
9820
|
-
const normalizedGenRoot =
|
|
9923
|
+
const normalizedGenRoot = resolve14(generatedAngularRoot).replace(/\\/g, "/");
|
|
9821
9924
|
const normalizedPath = componentJsAbsPath.replace(/\\/g, "/");
|
|
9822
9925
|
if (!normalizedPath.startsWith(normalizedGenRoot + "/"))
|
|
9823
9926
|
return;
|
|
@@ -9834,9 +9937,9 @@ var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames =
|
|
|
9834
9937
|
}
|
|
9835
9938
|
if (classNames.length === 0)
|
|
9836
9939
|
return;
|
|
9837
|
-
const relFromGenRoot =
|
|
9838
|
-
const userTsPath =
|
|
9839
|
-
const projectRel =
|
|
9940
|
+
const relFromGenRoot = relative7(generatedAngularRoot, componentJsAbsPath).replace(/\\/g, "/");
|
|
9941
|
+
const userTsPath = resolve14(userAngularRoot, relFromGenRoot.replace(/\.js$/, ".ts"));
|
|
9942
|
+
const projectRel = relative7(projectRoot, userTsPath).replace(/\\/g, "/");
|
|
9840
9943
|
const tail = classNames.map((className) => {
|
|
9841
9944
|
const id = `${projectRel}@${className}`;
|
|
9842
9945
|
return buildHmrTail(className, JSON.stringify(id));
|
|
@@ -9870,17 +9973,17 @@ var init_hmrInjectionPlugin = __esm(() => {
|
|
|
9870
9973
|
|
|
9871
9974
|
// src/utils/cleanStaleOutputs.ts
|
|
9872
9975
|
import { rm as rm2 } from "fs/promises";
|
|
9873
|
-
import { resolve as
|
|
9976
|
+
import { resolve as resolve15 } from "path";
|
|
9874
9977
|
var {Glob: Glob5 } = globalThis.Bun;
|
|
9875
9978
|
var HASHED_FILE_PATTERN, cleanStaleOutputs = async (buildPath, currentOutputPaths) => {
|
|
9876
|
-
const currentPaths = new Set(currentOutputPaths.map((path) =>
|
|
9979
|
+
const currentPaths = new Set(currentOutputPaths.map((path) => resolve15(path)));
|
|
9877
9980
|
const glob = new Glob5("**/*");
|
|
9878
9981
|
const removals = [];
|
|
9879
|
-
for (const
|
|
9880
|
-
const absolute =
|
|
9982
|
+
for (const relative8 of glob.scanSync({ cwd: buildPath })) {
|
|
9983
|
+
const absolute = resolve15(buildPath, relative8);
|
|
9881
9984
|
if (currentPaths.has(absolute))
|
|
9882
9985
|
continue;
|
|
9883
|
-
if (!HASHED_FILE_PATTERN.test(
|
|
9986
|
+
if (!HASHED_FILE_PATTERN.test(relative8))
|
|
9884
9987
|
continue;
|
|
9885
9988
|
removals.push(rm2(absolute, { force: true }));
|
|
9886
9989
|
}
|
|
@@ -9896,20 +9999,20 @@ __export(exports_generatedDir, {
|
|
|
9896
9999
|
getGeneratedRoot: () => getGeneratedRoot,
|
|
9897
10000
|
getFrameworkGeneratedDir: () => getFrameworkGeneratedDir
|
|
9898
10001
|
});
|
|
9899
|
-
import { join as
|
|
9900
|
-
var GENERATED_DIR_NAME = "generated", ABSOLUTE_CACHE_DIR_NAME = ".absolutejs", getGeneratedRoot = (projectRoot = process.cwd()) =>
|
|
10002
|
+
import { join as join13 } from "path";
|
|
10003
|
+
var GENERATED_DIR_NAME = "generated", ABSOLUTE_CACHE_DIR_NAME = ".absolutejs", getGeneratedRoot = (projectRoot = process.cwd()) => join13(projectRoot, ABSOLUTE_CACHE_DIR_NAME, GENERATED_DIR_NAME), getFrameworkGeneratedDir = (framework, projectRoot = process.cwd()) => join13(getGeneratedRoot(projectRoot), framework);
|
|
9901
10004
|
var init_generatedDir = () => {};
|
|
9902
10005
|
|
|
9903
10006
|
// src/utils/cleanup.ts
|
|
9904
10007
|
import { rm as rm3 } from "fs/promises";
|
|
9905
|
-
import { join as
|
|
10008
|
+
import { join as join14 } from "path";
|
|
9906
10009
|
var removeIfExists = (path) => rm3(path, { force: true, recursive: true }), cleanFramework = (framework, frameworkDir, skipGenerated = false) => {
|
|
9907
10010
|
const tasks = [];
|
|
9908
10011
|
if (!skipGenerated) {
|
|
9909
10012
|
tasks.push(removeIfExists(getFrameworkGeneratedDir(framework)));
|
|
9910
10013
|
}
|
|
9911
10014
|
if (frameworkDir)
|
|
9912
|
-
tasks.push(removeIfExists(
|
|
10015
|
+
tasks.push(removeIfExists(join14(frameworkDir, "generated")));
|
|
9913
10016
|
return Promise.all(tasks);
|
|
9914
10017
|
}, cleanup = async ({
|
|
9915
10018
|
angularDir,
|
|
@@ -9948,7 +10051,7 @@ var init_commonAncestor = () => {};
|
|
|
9948
10051
|
|
|
9949
10052
|
// src/utils/buildDirectoryLock.ts
|
|
9950
10053
|
import { mkdirSync as mkdirSync6, unlinkSync, writeFileSync as writeFileSync6, readFileSync as readFileSync10 } from "fs";
|
|
9951
|
-
import { dirname as
|
|
10054
|
+
import { dirname as dirname9, join as join15 } from "path";
|
|
9952
10055
|
var heldLocks, HELD_LOCKS_ENV = "ABSOLUTE_HELD_BUILD_DIRECTORY_LOCKS", exitHandlersRegistered = false, registerExitHandlersOnce = () => {
|
|
9953
10056
|
if (exitHandlersRegistered)
|
|
9954
10057
|
return;
|
|
@@ -9974,7 +10077,7 @@ var heldLocks, HELD_LOCKS_ENV = "ABSOLUTE_HELD_BUILD_DIRECTORY_LOCKS", exitHandl
|
|
|
9974
10077
|
releaseAllSync();
|
|
9975
10078
|
throw err;
|
|
9976
10079
|
});
|
|
9977
|
-
}, isAlreadyExistsError = (error) => error instanceof Error && ("code" in error) && error.code === "EEXIST", lockPathForBuildDirectory = (buildDirectory) =>
|
|
10080
|
+
}, isAlreadyExistsError = (error) => error instanceof Error && ("code" in error) && error.code === "EEXIST", lockPathForBuildDirectory = (buildDirectory) => join15(dirname9(buildDirectory), ".absolutejs", "build.lock"), readHeldLockEnv = () => new Set((process.env[HELD_LOCKS_ENV] ?? "").split(`
|
|
9978
10081
|
`).filter((entry) => entry.length > 0)), writeHeldLockEnv = (locks) => {
|
|
9979
10082
|
if (locks.size === 0) {
|
|
9980
10083
|
delete process.env[HELD_LOCKS_ENV];
|
|
@@ -9991,7 +10094,7 @@ var heldLocks, HELD_LOCKS_ENV = "ABSOLUTE_HELD_BUILD_DIRECTORY_LOCKS", exitHandl
|
|
|
9991
10094
|
locks.delete(buildDirectory);
|
|
9992
10095
|
writeHeldLockEnv(locks);
|
|
9993
10096
|
}, writeLockFileSync = (lockPath, metadata) => {
|
|
9994
|
-
mkdirSync6(
|
|
10097
|
+
mkdirSync6(dirname9(lockPath), { recursive: true });
|
|
9995
10098
|
writeFileSync6(lockPath, JSON.stringify(metadata, null, 2), { flag: "wx" });
|
|
9996
10099
|
}, readLockMetadata = (lockPath) => {
|
|
9997
10100
|
try {
|
|
@@ -10111,11 +10214,11 @@ var init_buildDirectoryLock = __esm(() => {
|
|
|
10111
10214
|
});
|
|
10112
10215
|
|
|
10113
10216
|
// src/utils/validateSafePath.ts
|
|
10114
|
-
import { resolve as
|
|
10217
|
+
import { resolve as resolve16, relative as relative8 } from "path";
|
|
10115
10218
|
var validateSafePath = (targetPath, baseDirectory) => {
|
|
10116
|
-
const absoluteBase =
|
|
10117
|
-
const absoluteTarget =
|
|
10118
|
-
const relativePath = normalizePath(
|
|
10219
|
+
const absoluteBase = resolve16(baseDirectory);
|
|
10220
|
+
const absoluteTarget = resolve16(baseDirectory, targetPath);
|
|
10221
|
+
const relativePath = normalizePath(relative8(absoluteBase, absoluteTarget));
|
|
10119
10222
|
if (relativePath.startsWith("../") || relativePath === "..") {
|
|
10120
10223
|
throw new Error(`Unsafe path: ${targetPath}`);
|
|
10121
10224
|
}
|
|
@@ -10263,32 +10366,32 @@ __export(exports_compileSvelte, {
|
|
|
10263
10366
|
clearSvelteCompilerCache: () => clearSvelteCompilerCache
|
|
10264
10367
|
});
|
|
10265
10368
|
import { existsSync as existsSync14 } from "fs";
|
|
10266
|
-
import { mkdir as
|
|
10369
|
+
import { mkdir as mkdir4, stat as stat2 } from "fs/promises";
|
|
10267
10370
|
import {
|
|
10268
|
-
dirname as
|
|
10269
|
-
join as
|
|
10371
|
+
dirname as dirname10,
|
|
10372
|
+
join as join16,
|
|
10270
10373
|
basename as basename4,
|
|
10271
10374
|
extname as extname5,
|
|
10272
|
-
resolve as
|
|
10273
|
-
relative as
|
|
10375
|
+
resolve as resolve17,
|
|
10376
|
+
relative as relative9,
|
|
10274
10377
|
sep as sep2
|
|
10275
10378
|
} from "path";
|
|
10276
10379
|
import { env } from "process";
|
|
10277
|
-
var {write, file, Transpiler } = globalThis.Bun;
|
|
10380
|
+
var {write, file, Transpiler: Transpiler2 } = globalThis.Bun;
|
|
10278
10381
|
var resolveDevClientDir2 = () => {
|
|
10279
10382
|
const projectRoot = process.cwd();
|
|
10280
|
-
const fromSource =
|
|
10383
|
+
const fromSource = resolve17(import.meta.dir, "../dev/client");
|
|
10281
10384
|
if (existsSync14(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
10282
10385
|
return fromSource;
|
|
10283
10386
|
}
|
|
10284
|
-
const fromNodeModules =
|
|
10387
|
+
const fromNodeModules = resolve17(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
10285
10388
|
if (existsSync14(fromNodeModules))
|
|
10286
10389
|
return fromNodeModules;
|
|
10287
|
-
return
|
|
10390
|
+
return resolve17(import.meta.dir, "./dev/client");
|
|
10288
10391
|
}, devClientDir2, hmrClientPath3, persistentCache, sourceHashCache, clearSvelteCompilerCache = () => {
|
|
10289
10392
|
persistentCache.clear();
|
|
10290
10393
|
sourceHashCache.clear();
|
|
10291
|
-
},
|
|
10394
|
+
}, transpiler3, removeUnusedRequireHelper = (code) => {
|
|
10292
10395
|
const helperStart = code.indexOf("var __require = /* @__PURE__ */");
|
|
10293
10396
|
if (helperStart === -1) {
|
|
10294
10397
|
return code;
|
|
@@ -10314,7 +10417,7 @@ var resolveDevClientDir2 = () => {
|
|
|
10314
10417
|
}, resolveRelativeModule2 = async (spec, from) => {
|
|
10315
10418
|
if (!spec.startsWith("."))
|
|
10316
10419
|
return null;
|
|
10317
|
-
const basePath =
|
|
10420
|
+
const basePath = resolve17(dirname10(from), spec);
|
|
10318
10421
|
const candidates = [
|
|
10319
10422
|
basePath,
|
|
10320
10423
|
`${basePath}.ts`,
|
|
@@ -10325,14 +10428,14 @@ var resolveDevClientDir2 = () => {
|
|
|
10325
10428
|
`${basePath}.svelte`,
|
|
10326
10429
|
`${basePath}.svelte.ts`,
|
|
10327
10430
|
`${basePath}.svelte.js`,
|
|
10328
|
-
|
|
10329
|
-
|
|
10330
|
-
|
|
10331
|
-
|
|
10332
|
-
|
|
10333
|
-
|
|
10334
|
-
|
|
10335
|
-
|
|
10431
|
+
join16(basePath, "index.ts"),
|
|
10432
|
+
join16(basePath, "index.js"),
|
|
10433
|
+
join16(basePath, "index.mjs"),
|
|
10434
|
+
join16(basePath, "index.cjs"),
|
|
10435
|
+
join16(basePath, "index.json"),
|
|
10436
|
+
join16(basePath, "index.svelte"),
|
|
10437
|
+
join16(basePath, "index.svelte.ts"),
|
|
10438
|
+
join16(basePath, "index.svelte.js")
|
|
10336
10439
|
];
|
|
10337
10440
|
const checks = await Promise.all(candidates.map(exists));
|
|
10338
10441
|
return candidates.find((_2, index) => checks[index]) ?? null;
|
|
@@ -10341,7 +10444,7 @@ var resolveDevClientDir2 = () => {
|
|
|
10341
10444
|
const resolved = resolvePackageImport(spec);
|
|
10342
10445
|
return resolved && /\.svelte(\.(?:ts|js))?$/.test(resolved) ? resolved : null;
|
|
10343
10446
|
}
|
|
10344
|
-
const basePath =
|
|
10447
|
+
const basePath = resolve17(dirname10(from), spec);
|
|
10345
10448
|
const explicit = /\.(svelte|svelte\.(?:ts|js))$/.test(basePath);
|
|
10346
10449
|
if (!explicit) {
|
|
10347
10450
|
const extensions = [".svelte", ".svelte.ts", ".svelte.js"];
|
|
@@ -10362,8 +10465,8 @@ var resolveDevClientDir2 = () => {
|
|
|
10362
10465
|
return jsPath;
|
|
10363
10466
|
return null;
|
|
10364
10467
|
}, addModuleRewrite = (rewrites, rawSpec, resolvedModule, ssrOutputDir, clientOutputDir) => {
|
|
10365
|
-
const toServer =
|
|
10366
|
-
const toClient =
|
|
10468
|
+
const toServer = relative9(ssrOutputDir, resolvedModule).replace(/\\/g, "/");
|
|
10469
|
+
const toClient = relative9(clientOutputDir, resolvedModule).replace(/\\/g, "/");
|
|
10367
10470
|
rewrites.set(rawSpec, {
|
|
10368
10471
|
client: toClient.startsWith(".") || toClient.startsWith("/") ? toClient : `./${toClient}`,
|
|
10369
10472
|
server: toServer.startsWith(".") ? toServer : `./${toServer}`
|
|
@@ -10371,10 +10474,10 @@ var resolveDevClientDir2 = () => {
|
|
|
10371
10474
|
}, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev = false, stylePreprocessors) => {
|
|
10372
10475
|
const { compile, compileModule, preprocess } = await import("svelte/compiler");
|
|
10373
10476
|
const generatedDir = getFrameworkGeneratedDir("svelte");
|
|
10374
|
-
const clientDir =
|
|
10375
|
-
const indexDir =
|
|
10376
|
-
const serverDir =
|
|
10377
|
-
await Promise.all([clientDir, indexDir, serverDir].map((dir) =>
|
|
10477
|
+
const clientDir = join16(generatedDir, "client");
|
|
10478
|
+
const indexDir = join16(generatedDir, "indexes");
|
|
10479
|
+
const serverDir = join16(generatedDir, "server");
|
|
10480
|
+
await Promise.all([clientDir, indexDir, serverDir].map((dir) => mkdir4(dir, { recursive: true })));
|
|
10378
10481
|
const dev = env.NODE_ENV !== "production";
|
|
10379
10482
|
const build = async (src) => {
|
|
10380
10483
|
const memoized = cache.get(src);
|
|
@@ -10399,10 +10502,10 @@ var resolveDevClientDir2 = () => {
|
|
|
10399
10502
|
const svelteStylePreprocessor = createSvelteStylePreprocessor(stylePreprocessors);
|
|
10400
10503
|
const preprocessedServer = isModule ? loweredServerSource.code : (await preprocess(loweredServerSource.code, svelteStylePreprocessor)).code;
|
|
10401
10504
|
const preprocessedClient = isModule ? loweredClientSource.code : (await preprocess(loweredClientSource.code, svelteStylePreprocessor)).code;
|
|
10402
|
-
const transpiledServer = src.endsWith(".ts") || src.endsWith(".svelte.ts") ?
|
|
10403
|
-
const transpiledClient = src.endsWith(".ts") || src.endsWith(".svelte.ts") ?
|
|
10404
|
-
const rawRel =
|
|
10405
|
-
const relDir = rawRel.startsWith("..") ? `_ext/${
|
|
10505
|
+
const transpiledServer = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler3.transformSync(preprocessedServer) : preprocessedServer;
|
|
10506
|
+
const transpiledClient = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler3.transformSync(preprocessedClient) : preprocessedClient;
|
|
10507
|
+
const rawRel = dirname10(relative9(svelteRoot, src)).replace(/\\/g, "/");
|
|
10508
|
+
const relDir = rawRel.startsWith("..") ? `_ext/${relative9(process.cwd(), dirname10(src)).replace(/\\/g, "/")}` : rawRel;
|
|
10406
10509
|
const baseName = basename4(src).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
10407
10510
|
const importPaths = Array.from(transpiledServer.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((path) => path !== undefined);
|
|
10408
10511
|
const resolvedModuleImports = await Promise.all(importPaths.map((importPath) => resolveRelativeModule2(importPath, src)));
|
|
@@ -10411,8 +10514,8 @@ var resolveDevClientDir2 = () => {
|
|
|
10411
10514
|
const childBuilt = await Promise.all(childSources.map((child) => build(child)));
|
|
10412
10515
|
const hasAwaitSlotFromChildren = childBuilt.some((child) => child.hasAwaitSlot);
|
|
10413
10516
|
const externalRewrites = new Map;
|
|
10414
|
-
const ssrOutputDir =
|
|
10415
|
-
const clientOutputDir =
|
|
10517
|
+
const ssrOutputDir = dirname10(join16(serverDir, relDir, `${baseName}.js`));
|
|
10518
|
+
const clientOutputDir = dirname10(join16(clientDir, relDir, `${baseName}.js`));
|
|
10416
10519
|
for (let idx = 0;idx < importPaths.length; idx++) {
|
|
10417
10520
|
const rawSpec = importPaths[idx];
|
|
10418
10521
|
if (!rawSpec)
|
|
@@ -10423,15 +10526,15 @@ var resolveDevClientDir2 = () => {
|
|
|
10423
10526
|
addModuleRewrite(externalRewrites, rawSpec, resolvedModule, ssrOutputDir, clientOutputDir);
|
|
10424
10527
|
if (!resolved)
|
|
10425
10528
|
continue;
|
|
10426
|
-
const childRel =
|
|
10529
|
+
const childRel = relative9(svelteRoot, resolved).replace(/\\/g, "/");
|
|
10427
10530
|
if (!childRel.startsWith(".."))
|
|
10428
10531
|
continue;
|
|
10429
10532
|
const childBuilt2 = cache.get(resolved);
|
|
10430
10533
|
if (!childBuilt2)
|
|
10431
10534
|
continue;
|
|
10432
10535
|
const origSpec = rawSpec.replace(/\.svelte(?:\.(?:ts|js))?$/, ".js");
|
|
10433
|
-
const toServer =
|
|
10434
|
-
const toClient =
|
|
10536
|
+
const toServer = relative9(ssrOutputDir, childBuilt2.ssr).replace(/\\/g, "/");
|
|
10537
|
+
const toClient = relative9(clientOutputDir, childBuilt2.client).replace(/\\/g, "/");
|
|
10435
10538
|
externalRewrites.set(origSpec, {
|
|
10436
10539
|
client: toClient.startsWith(".") ? toClient : `./${toClient}`,
|
|
10437
10540
|
server: toServer.startsWith(".") ? toServer : `./${toServer}`
|
|
@@ -10465,7 +10568,7 @@ var resolveDevClientDir2 = () => {
|
|
|
10465
10568
|
}).js.code;
|
|
10466
10569
|
let code = compiled.replace(/\.svelte(?:\.(?:ts|js))?(['"])/g, ".js$1");
|
|
10467
10570
|
if (mode === "client" && isDev) {
|
|
10468
|
-
const moduleKey = `/@src/${
|
|
10571
|
+
const moduleKey = `/@src/${relative9(process.cwd(), src).replace(/\\/g, "/")}`;
|
|
10469
10572
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
10470
10573
|
if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
10471
10574
|
var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleKey)}] = cb; };`);
|
|
@@ -10477,11 +10580,11 @@ var resolveDevClientDir2 = () => {
|
|
|
10477
10580
|
code += islandMetadataExports;
|
|
10478
10581
|
return code;
|
|
10479
10582
|
};
|
|
10480
|
-
const ssrPath =
|
|
10481
|
-
const clientPath =
|
|
10583
|
+
const ssrPath = join16(serverDir, relDir, `${baseName}.js`);
|
|
10584
|
+
const clientPath = join16(clientDir, relDir, `${baseName}.js`);
|
|
10482
10585
|
await Promise.all([
|
|
10483
|
-
|
|
10484
|
-
|
|
10586
|
+
mkdir4(dirname10(ssrPath), { recursive: true }),
|
|
10587
|
+
mkdir4(dirname10(clientPath), { recursive: true })
|
|
10485
10588
|
]);
|
|
10486
10589
|
if (isModule) {
|
|
10487
10590
|
const bundle = rewriteExternalImports(generate("client"), "client");
|
|
@@ -10508,10 +10611,10 @@ var resolveDevClientDir2 = () => {
|
|
|
10508
10611
|
};
|
|
10509
10612
|
const roots = await Promise.all(entryPoints.map(build));
|
|
10510
10613
|
await Promise.all(roots.map(async ({ client, hasAwaitSlot }) => {
|
|
10511
|
-
const relClientDir =
|
|
10614
|
+
const relClientDir = dirname10(relative9(clientDir, client));
|
|
10512
10615
|
const name = basename4(client, extname5(client));
|
|
10513
|
-
const indexPath =
|
|
10514
|
-
const importRaw =
|
|
10616
|
+
const indexPath = join16(indexDir, relClientDir, `${name}.js`);
|
|
10617
|
+
const importRaw = relative9(dirname10(indexPath), client).split(sep2).join("/");
|
|
10515
10618
|
const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
|
|
10516
10619
|
const hmrImports = isDev ? `window.__HMR_FRAMEWORK__ = "svelte";
|
|
10517
10620
|
import "${hmrClientPath3}";
|
|
@@ -10582,14 +10685,14 @@ if (typeof window !== "undefined") {
|
|
|
10582
10685
|
setTimeout(releaseStreamingSlots, 0);
|
|
10583
10686
|
}
|
|
10584
10687
|
}`;
|
|
10585
|
-
await
|
|
10688
|
+
await mkdir4(dirname10(indexPath), { recursive: true });
|
|
10586
10689
|
return write(indexPath, bootstrap);
|
|
10587
10690
|
}));
|
|
10588
10691
|
return {
|
|
10589
10692
|
svelteClientPaths: roots.map(({ client }) => client),
|
|
10590
10693
|
svelteIndexPaths: roots.map(({ client }) => {
|
|
10591
|
-
const rel =
|
|
10592
|
-
return
|
|
10694
|
+
const rel = dirname10(relative9(clientDir, client));
|
|
10695
|
+
return join16(indexDir, rel, basename4(client));
|
|
10593
10696
|
}),
|
|
10594
10697
|
svelteServerPaths: roots.map(({ ssr }) => ssr)
|
|
10595
10698
|
};
|
|
@@ -10604,10 +10707,10 @@ var init_compileSvelte = __esm(() => {
|
|
|
10604
10707
|
init_lowerAwaitSlotSyntax();
|
|
10605
10708
|
init_renderToReadableStream();
|
|
10606
10709
|
devClientDir2 = resolveDevClientDir2();
|
|
10607
|
-
hmrClientPath3 =
|
|
10710
|
+
hmrClientPath3 = join16(devClientDir2, "hmrClient.ts").replace(/\\/g, "/");
|
|
10608
10711
|
persistentCache = new Map;
|
|
10609
10712
|
sourceHashCache = new Map;
|
|
10610
|
-
|
|
10713
|
+
transpiler3 = new Transpiler2({ loader: "ts", target: "browser" });
|
|
10611
10714
|
});
|
|
10612
10715
|
|
|
10613
10716
|
// src/build/vueAutoRouterTransform.ts
|
|
@@ -10671,27 +10774,27 @@ __export(exports_compileVue, {
|
|
|
10671
10774
|
clearVueHmrCaches: () => clearVueHmrCaches
|
|
10672
10775
|
});
|
|
10673
10776
|
import { existsSync as existsSync15 } from "fs";
|
|
10674
|
-
import { mkdir as
|
|
10777
|
+
import { mkdir as mkdir5 } from "fs/promises";
|
|
10675
10778
|
import {
|
|
10676
10779
|
basename as basename5,
|
|
10677
|
-
dirname as
|
|
10780
|
+
dirname as dirname11,
|
|
10678
10781
|
isAbsolute as isAbsolute3,
|
|
10679
|
-
join as
|
|
10680
|
-
relative as
|
|
10681
|
-
resolve as
|
|
10782
|
+
join as join17,
|
|
10783
|
+
relative as relative10,
|
|
10784
|
+
resolve as resolve18
|
|
10682
10785
|
} from "path";
|
|
10683
|
-
var {file: file2, write: write2, Transpiler:
|
|
10786
|
+
var {file: file2, write: write2, Transpiler: Transpiler3 } = globalThis.Bun;
|
|
10684
10787
|
var resolveDevClientDir3 = () => {
|
|
10685
10788
|
const projectRoot = process.cwd();
|
|
10686
|
-
const fromSource =
|
|
10789
|
+
const fromSource = resolve18(import.meta.dir, "../dev/client");
|
|
10687
10790
|
if (existsSync15(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
10688
10791
|
return fromSource;
|
|
10689
10792
|
}
|
|
10690
|
-
const fromNodeModules =
|
|
10793
|
+
const fromNodeModules = resolve18(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
10691
10794
|
if (existsSync15(fromNodeModules))
|
|
10692
10795
|
return fromNodeModules;
|
|
10693
|
-
return
|
|
10694
|
-
}, devClientDir3, hmrClientPath4,
|
|
10796
|
+
return resolve18(import.meta.dir, "./dev/client");
|
|
10797
|
+
}, devClientDir3, hmrClientPath4, transpiler4, scriptCache, scriptSetupCache, templateCache, styleCache, persistentBuildCache, vueSourceHashCache, vueHmrMetadata, clearVueHmrCaches = () => {
|
|
10695
10798
|
scriptCache.clear();
|
|
10696
10799
|
scriptSetupCache.clear();
|
|
10697
10800
|
templateCache.clear();
|
|
@@ -10729,19 +10832,19 @@ var resolveDevClientDir3 = () => {
|
|
|
10729
10832
|
return "template-only";
|
|
10730
10833
|
}
|
|
10731
10834
|
return "full";
|
|
10732
|
-
}, generateVueHmrId = (sourceFilePath, vueRootDir) =>
|
|
10835
|
+
}, 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) => {
|
|
10733
10836
|
if (filePath.endsWith(".vue"))
|
|
10734
10837
|
return filePath.replace(/\.vue$/, ".js");
|
|
10735
10838
|
if (filePath.endsWith(".ts"))
|
|
10736
10839
|
return filePath.replace(/\.ts$/, ".js");
|
|
10737
10840
|
if (isStylePath(filePath)) {
|
|
10738
10841
|
if (sourceDir && (filePath.startsWith("./") || filePath.startsWith("../"))) {
|
|
10739
|
-
return
|
|
10842
|
+
return resolve18(sourceDir, filePath);
|
|
10740
10843
|
}
|
|
10741
10844
|
return filePath;
|
|
10742
10845
|
}
|
|
10743
10846
|
return `${filePath}.js`;
|
|
10744
|
-
},
|
|
10847
|
+
}, stripExports2 = (code) => code.replace(/export\s+default/, "const script ="), mergeVueImports2 = (code) => {
|
|
10745
10848
|
const lines = code.split(`
|
|
10746
10849
|
`);
|
|
10747
10850
|
const specifierSet = new Set;
|
|
@@ -10762,7 +10865,7 @@ var resolveDevClientDir3 = () => {
|
|
|
10762
10865
|
const cachedResult = cacheMap.get(sourceFilePath);
|
|
10763
10866
|
if (cachedResult)
|
|
10764
10867
|
return cachedResult;
|
|
10765
|
-
const relativeFilePath =
|
|
10868
|
+
const relativeFilePath = relative10(vueRootDir, sourceFilePath).replace(/\\/g, "/");
|
|
10766
10869
|
const relativeWithoutExtension = relativeFilePath.replace(/\.vue$/, "");
|
|
10767
10870
|
const fileBaseName = basename5(sourceFilePath, ".vue");
|
|
10768
10871
|
const componentId = toKebab(fileBaseName);
|
|
@@ -10800,12 +10903,12 @@ var resolveDevClientDir3 = () => {
|
|
|
10800
10903
|
const childComponentPaths = importPaths.filter((path) => path.startsWith(".") && path.endsWith(".vue"));
|
|
10801
10904
|
const packageComponentPaths = Array.from(resolvedPackageVueImports.entries());
|
|
10802
10905
|
const helperModulePaths = importPaths.filter((path) => path.startsWith(".") && !path.endsWith(".vue") && !isStylePath(path));
|
|
10803
|
-
const stylePathsImported = importPaths.filter((path) => (path.startsWith(".") || isAbsolute3(path)) && isStylePath(path)).map((path) => isAbsolute3(path) ? path :
|
|
10906
|
+
const stylePathsImported = importPaths.filter((path) => (path.startsWith(".") || isAbsolute3(path)) && isStylePath(path)).map((path) => isAbsolute3(path) ? path : resolve18(dirname11(sourceFilePath), path));
|
|
10804
10907
|
for (const stylePath of stylePathsImported) {
|
|
10805
10908
|
addStyleImporter(sourceFilePath, stylePath);
|
|
10806
10909
|
}
|
|
10807
10910
|
const childBuildResults = await Promise.all([
|
|
10808
|
-
...childComponentPaths.map((relativeChildPath) => compileVueFile(
|
|
10911
|
+
...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve18(dirname11(sourceFilePath), relativeChildPath), outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors)),
|
|
10809
10912
|
...packageComponentPaths.map(([, absolutePath]) => compileVueFile(absolutePath, outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors))
|
|
10810
10913
|
]);
|
|
10811
10914
|
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
@@ -10813,9 +10916,9 @@ var resolveDevClientDir3 = () => {
|
|
|
10813
10916
|
id: componentId,
|
|
10814
10917
|
inlineTemplate: false
|
|
10815
10918
|
}) : { bindings: {}, content: "export default {};" };
|
|
10816
|
-
const strippedScript =
|
|
10817
|
-
const sourceDir =
|
|
10818
|
-
const transpiledScript =
|
|
10919
|
+
const strippedScript = stripExports2(compiledScript.content);
|
|
10920
|
+
const sourceDir = dirname11(sourceFilePath);
|
|
10921
|
+
const transpiledScript = transpiler4.transformSync(strippedScript).replace(/(['"])(\.{1,2}\/[^'"]+)(['"])/g, (_2, quoteStart, relativeImport, quoteEnd) => `${quoteStart}${toJs(relativeImport, sourceDir)}${quoteEnd}`);
|
|
10819
10922
|
const packageImportRewrites = new Map;
|
|
10820
10923
|
for (const [bareImport, absolutePath] of packageComponentPaths) {
|
|
10821
10924
|
const childResult = cacheMap.get(absolutePath);
|
|
@@ -10829,6 +10932,8 @@ var resolveDevClientDir3 = () => {
|
|
|
10829
10932
|
const generateRenderFunction = (ssr) => compiler.compileTemplate({
|
|
10830
10933
|
compilerOptions: {
|
|
10831
10934
|
bindingMetadata: compiledScript.bindings,
|
|
10935
|
+
expressionPlugins: ["typescript"],
|
|
10936
|
+
isCustomElement: (tag) => tag === "absolute-island",
|
|
10832
10937
|
prefixIdentifiers: true
|
|
10833
10938
|
},
|
|
10834
10939
|
filename: sourceFilePath,
|
|
@@ -10851,8 +10956,8 @@ var resolveDevClientDir3 = () => {
|
|
|
10851
10956
|
];
|
|
10852
10957
|
let cssOutputPaths = [];
|
|
10853
10958
|
if (isEntryPoint && allCss.length) {
|
|
10854
|
-
const cssOutputFile =
|
|
10855
|
-
await
|
|
10959
|
+
const cssOutputFile = join17(outputDirs.css, `${toKebab(fileBaseName)}-compiled.css`);
|
|
10960
|
+
await mkdir5(dirname11(cssOutputFile), { recursive: true });
|
|
10856
10961
|
await write2(cssOutputFile, allCss.join(`
|
|
10857
10962
|
`));
|
|
10858
10963
|
cssOutputPaths = [cssOutputFile];
|
|
@@ -10870,7 +10975,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10870
10975
|
window.__VUE_HMR_COMPONENTS__[script.__hmrId] = script;
|
|
10871
10976
|
}
|
|
10872
10977
|
}` : "";
|
|
10873
|
-
return
|
|
10978
|
+
return mergeVueImports2([
|
|
10874
10979
|
transpiledScript,
|
|
10875
10980
|
renderCode,
|
|
10876
10981
|
`script.${renderFnName} = ${renderFnName};`,
|
|
@@ -10882,9 +10987,9 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10882
10987
|
};
|
|
10883
10988
|
const clientCode = assembleModule(generateRenderFunction(false), "render", true) + islandMetadataExports;
|
|
10884
10989
|
const serverCode = assembleModule(generateRenderFunction(true), "ssrRender", false) + islandMetadataExports;
|
|
10885
|
-
const clientOutputPath =
|
|
10886
|
-
const serverOutputPath =
|
|
10887
|
-
const relDir =
|
|
10990
|
+
const clientOutputPath = join17(outputDirs.client, `${relativeWithoutExtension}.js`);
|
|
10991
|
+
const serverOutputPath = join17(outputDirs.server, `${relativeWithoutExtension}.js`);
|
|
10992
|
+
const relDir = dirname11(relativeFilePath);
|
|
10888
10993
|
const relDepth = relDir === "." ? 0 : relDir.split("/").length;
|
|
10889
10994
|
const adjustImports = (code) => code.replace(/(from\s+['"])(\.\.\/(?:\.\.\/)*)/g, (_2, prefix, dots) => {
|
|
10890
10995
|
const upCount = dots.split("/").length - 1;
|
|
@@ -10896,15 +11001,15 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10896
11001
|
let result2 = code;
|
|
10897
11002
|
for (const [bareImport, paths] of packageImportRewrites) {
|
|
10898
11003
|
const targetPath = mode === "server" ? paths.server : paths.client;
|
|
10899
|
-
let rel =
|
|
11004
|
+
let rel = relative10(dirname11(outputPath), targetPath).replace(/\\/g, "/");
|
|
10900
11005
|
if (!rel.startsWith("."))
|
|
10901
11006
|
rel = `./${rel}`;
|
|
10902
11007
|
result2 = result2.replaceAll(bareImport, rel);
|
|
10903
11008
|
}
|
|
10904
11009
|
return result2;
|
|
10905
11010
|
};
|
|
10906
|
-
await
|
|
10907
|
-
await
|
|
11011
|
+
await mkdir5(dirname11(clientOutputPath), { recursive: true });
|
|
11012
|
+
await mkdir5(dirname11(serverOutputPath), { recursive: true });
|
|
10908
11013
|
await write2(clientOutputPath, rewritePackageImports(adjustImports(clientCode), clientOutputPath, "client"));
|
|
10909
11014
|
await write2(serverOutputPath, rewritePackageImports(adjustImports(serverCode), serverOutputPath, "server"));
|
|
10910
11015
|
const result = {
|
|
@@ -10914,7 +11019,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10914
11019
|
hmrId,
|
|
10915
11020
|
serverPath: serverOutputPath,
|
|
10916
11021
|
tsHelperPaths: [
|
|
10917
|
-
...helperModulePaths.map((helper) =>
|
|
11022
|
+
...helperModulePaths.map((helper) => resolve18(dirname11(sourceFilePath), helper.endsWith(".ts") ? helper : `${helper}.ts`)),
|
|
10918
11023
|
...childBuildResults.flatMap((child) => child.tsHelperPaths)
|
|
10919
11024
|
]
|
|
10920
11025
|
};
|
|
@@ -10924,36 +11029,36 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10924
11029
|
}, compileVue = async (entryPoints, vueRootDir, isDev = false, stylePreprocessors) => {
|
|
10925
11030
|
const compiler = await import("@vue/compiler-sfc");
|
|
10926
11031
|
const generatedDir = getFrameworkGeneratedDir("vue");
|
|
10927
|
-
const clientOutputDir =
|
|
10928
|
-
const indexOutputDir =
|
|
10929
|
-
const serverOutputDir =
|
|
10930
|
-
const cssOutputDir =
|
|
11032
|
+
const clientOutputDir = join17(generatedDir, "client");
|
|
11033
|
+
const indexOutputDir = join17(generatedDir, "indexes");
|
|
11034
|
+
const serverOutputDir = join17(generatedDir, "server");
|
|
11035
|
+
const cssOutputDir = join17(generatedDir, "compiled");
|
|
10931
11036
|
await Promise.all([
|
|
10932
|
-
|
|
10933
|
-
|
|
10934
|
-
|
|
10935
|
-
|
|
11037
|
+
mkdir5(clientOutputDir, { recursive: true }),
|
|
11038
|
+
mkdir5(indexOutputDir, { recursive: true }),
|
|
11039
|
+
mkdir5(serverOutputDir, { recursive: true }),
|
|
11040
|
+
mkdir5(cssOutputDir, { recursive: true })
|
|
10936
11041
|
]);
|
|
10937
11042
|
const buildCache = new Map;
|
|
10938
11043
|
const allTsHelperPaths = new Set;
|
|
10939
11044
|
const compiledPages = await Promise.all(entryPoints.map(async (entryPath) => {
|
|
10940
|
-
const result = await compileVueFile(
|
|
11045
|
+
const result = await compileVueFile(resolve18(entryPath), {
|
|
10941
11046
|
client: clientOutputDir,
|
|
10942
11047
|
css: cssOutputDir,
|
|
10943
11048
|
server: serverOutputDir
|
|
10944
11049
|
}, buildCache, true, vueRootDir, compiler, stylePreprocessors);
|
|
10945
11050
|
result.tsHelperPaths.forEach((path) => allTsHelperPaths.add(path));
|
|
10946
11051
|
const entryBaseName = basename5(entryPath, ".vue");
|
|
10947
|
-
const indexOutputFile =
|
|
10948
|
-
const clientOutputFile =
|
|
10949
|
-
await
|
|
11052
|
+
const indexOutputFile = join17(indexOutputDir, `${entryBaseName}.js`);
|
|
11053
|
+
const clientOutputFile = join17(clientOutputDir, relative10(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
|
|
11054
|
+
await mkdir5(dirname11(indexOutputFile), { recursive: true });
|
|
10950
11055
|
const vueHmrImports = isDev ? [
|
|
10951
11056
|
`window.__HMR_FRAMEWORK__ = "vue";`,
|
|
10952
11057
|
`import "${hmrClientPath4}";`
|
|
10953
11058
|
] : [];
|
|
10954
11059
|
await write2(indexOutputFile, [
|
|
10955
11060
|
...vueHmrImports,
|
|
10956
|
-
`import Comp, * as PageModule from "${
|
|
11061
|
+
`import Comp, * as PageModule from "${relative10(dirname11(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
|
|
10957
11062
|
'import { createSSRApp, createApp } from "vue";',
|
|
10958
11063
|
"",
|
|
10959
11064
|
"// HMR State Preservation: Check for preserved state from HMR",
|
|
@@ -11096,12 +11201,12 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
11096
11201
|
}));
|
|
11097
11202
|
await Promise.all(Array.from(allTsHelperPaths).map(async (tsPath) => {
|
|
11098
11203
|
const sourceCode = await file2(tsPath).text();
|
|
11099
|
-
const transpiledCode =
|
|
11100
|
-
const relativeJsPath =
|
|
11101
|
-
const outClientPath =
|
|
11102
|
-
const outServerPath =
|
|
11103
|
-
await
|
|
11104
|
-
await
|
|
11204
|
+
const transpiledCode = transpiler4.transformSync(sourceCode);
|
|
11205
|
+
const relativeJsPath = relative10(vueRootDir, tsPath).replace(/\.ts$/, ".js");
|
|
11206
|
+
const outClientPath = join17(clientOutputDir, relativeJsPath);
|
|
11207
|
+
const outServerPath = join17(serverOutputDir, relativeJsPath);
|
|
11208
|
+
await mkdir5(dirname11(outClientPath), { recursive: true });
|
|
11209
|
+
await mkdir5(dirname11(outServerPath), { recursive: true });
|
|
11105
11210
|
await write2(outClientPath, transpiledCode);
|
|
11106
11211
|
await write2(outServerPath, transpiledCode);
|
|
11107
11212
|
}));
|
|
@@ -11121,8 +11226,8 @@ var init_compileVue = __esm(() => {
|
|
|
11121
11226
|
init_vueAutoRouterTransform();
|
|
11122
11227
|
init_stylePreprocessor();
|
|
11123
11228
|
devClientDir3 = resolveDevClientDir3();
|
|
11124
|
-
hmrClientPath4 =
|
|
11125
|
-
|
|
11229
|
+
hmrClientPath4 = join17(devClientDir3, "hmrClient.ts").replace(/\\/g, "/");
|
|
11230
|
+
transpiler4 = new Transpiler3({ loader: "ts", target: "browser" });
|
|
11126
11231
|
scriptCache = new Map;
|
|
11127
11232
|
scriptSetupCache = new Map;
|
|
11128
11233
|
templateCache = new Map;
|
|
@@ -11602,17 +11707,17 @@ __export(exports_compileAngular, {
|
|
|
11602
11707
|
compileAngular: () => compileAngular
|
|
11603
11708
|
});
|
|
11604
11709
|
import { existsSync as existsSync16, readFileSync as readFileSync11, promises as fs } from "fs";
|
|
11605
|
-
import { join as
|
|
11710
|
+
import { join as join18, basename as basename6, sep as sep3, dirname as dirname12, resolve as resolve19, relative as relative11 } from "path";
|
|
11606
11711
|
import ts2 from "typescript";
|
|
11607
11712
|
var traceAngularPhase = async (name, fn2, metadata) => {
|
|
11608
11713
|
const tracePhase = globalThis.__absoluteBuildTracePhase;
|
|
11609
11714
|
return tracePhase ? tracePhase(`compile/angular/${name}`, fn2, metadata) : await fn2();
|
|
11610
11715
|
}, readTsconfigPathAliases = () => {
|
|
11611
11716
|
try {
|
|
11612
|
-
const configPath2 =
|
|
11717
|
+
const configPath2 = resolve19(process.cwd(), "tsconfig.json");
|
|
11613
11718
|
const config = ts2.readConfigFile(configPath2, ts2.sys.readFile).config;
|
|
11614
11719
|
const compilerOptions = config?.compilerOptions ?? {};
|
|
11615
|
-
const baseUrl =
|
|
11720
|
+
const baseUrl = resolve19(process.cwd(), compilerOptions.baseUrl ?? ".");
|
|
11616
11721
|
const aliases = Object.entries(compilerOptions.paths ?? {}).map(([pattern, replacements]) => ({ pattern, replacements }));
|
|
11617
11722
|
return { aliases, baseUrl };
|
|
11618
11723
|
} catch {
|
|
@@ -11632,7 +11737,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11632
11737
|
const wildcardValue = exactMatch ? "" : specifier.slice(prefix.length, specifier.length - suffix.length);
|
|
11633
11738
|
for (const replacement of alias.replacements) {
|
|
11634
11739
|
const candidate = replacement.replace("*", wildcardValue);
|
|
11635
|
-
const resolved = resolveSourceFile(
|
|
11740
|
+
const resolved = resolveSourceFile(resolve19(baseUrl, candidate));
|
|
11636
11741
|
if (resolved)
|
|
11637
11742
|
return resolved;
|
|
11638
11743
|
}
|
|
@@ -11644,20 +11749,20 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11644
11749
|
`${candidate}.tsx`,
|
|
11645
11750
|
`${candidate}.js`,
|
|
11646
11751
|
`${candidate}.jsx`,
|
|
11647
|
-
|
|
11648
|
-
|
|
11649
|
-
|
|
11650
|
-
|
|
11752
|
+
join18(candidate, "index.ts"),
|
|
11753
|
+
join18(candidate, "index.tsx"),
|
|
11754
|
+
join18(candidate, "index.js"),
|
|
11755
|
+
join18(candidate, "index.jsx")
|
|
11651
11756
|
];
|
|
11652
11757
|
return candidates.find((file3) => existsSync16(file3));
|
|
11653
11758
|
}, createLegacyAngularAnimationUsageResolver = (rootDir) => {
|
|
11654
|
-
const baseDir =
|
|
11759
|
+
const baseDir = resolve19(rootDir);
|
|
11655
11760
|
const tsconfigAliases = readTsconfigPathAliases();
|
|
11656
|
-
const
|
|
11761
|
+
const transpiler5 = new Bun.Transpiler({ loader: "tsx" });
|
|
11657
11762
|
const scanCache = new Map;
|
|
11658
11763
|
const resolveLocalImport = (specifier, fromDir) => {
|
|
11659
11764
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
11660
|
-
return resolveSourceFile(
|
|
11765
|
+
return resolveSourceFile(resolve19(fromDir, specifier));
|
|
11661
11766
|
}
|
|
11662
11767
|
const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile);
|
|
11663
11768
|
if (aliased)
|
|
@@ -11666,7 +11771,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11666
11771
|
const resolved = Bun.resolveSync(specifier, fromDir);
|
|
11667
11772
|
if (resolved.includes("/node_modules/"))
|
|
11668
11773
|
return;
|
|
11669
|
-
const absolute =
|
|
11774
|
+
const absolute = resolve19(resolved);
|
|
11670
11775
|
if (!absolute.startsWith(baseDir))
|
|
11671
11776
|
return;
|
|
11672
11777
|
return resolveSourceFile(absolute);
|
|
@@ -11682,7 +11787,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11682
11787
|
usesLegacyAnimations: false
|
|
11683
11788
|
});
|
|
11684
11789
|
}
|
|
11685
|
-
const resolved =
|
|
11790
|
+
const resolved = resolve19(actualPath);
|
|
11686
11791
|
const cached = scanCache.get(resolved);
|
|
11687
11792
|
if (cached)
|
|
11688
11793
|
return cached;
|
|
@@ -11695,7 +11800,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11695
11800
|
}
|
|
11696
11801
|
let imports;
|
|
11697
11802
|
try {
|
|
11698
|
-
imports =
|
|
11803
|
+
imports = transpiler5.scanImports(sourceCode);
|
|
11699
11804
|
} catch {
|
|
11700
11805
|
return { imports: [], usesLegacyAnimations: false };
|
|
11701
11806
|
}
|
|
@@ -11711,7 +11816,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11711
11816
|
const actualPath = resolveSourceFile(filePath);
|
|
11712
11817
|
if (!actualPath)
|
|
11713
11818
|
return false;
|
|
11714
|
-
const resolved =
|
|
11819
|
+
const resolved = resolve19(actualPath);
|
|
11715
11820
|
if (visited.has(resolved))
|
|
11716
11821
|
return false;
|
|
11717
11822
|
visited.add(resolved);
|
|
@@ -11719,7 +11824,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11719
11824
|
if (scan.usesLegacyAnimations)
|
|
11720
11825
|
return true;
|
|
11721
11826
|
for (const specifier of scan.imports) {
|
|
11722
|
-
const importedPath = resolveLocalImport(specifier,
|
|
11827
|
+
const importedPath = resolveLocalImport(specifier, dirname12(resolved));
|
|
11723
11828
|
if (importedPath && await visit(importedPath, visited)) {
|
|
11724
11829
|
return true;
|
|
11725
11830
|
}
|
|
@@ -11729,14 +11834,14 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11729
11834
|
return (entryPath) => visit(entryPath);
|
|
11730
11835
|
}, resolveDevClientDir4 = () => {
|
|
11731
11836
|
const projectRoot = process.cwd();
|
|
11732
|
-
const fromSource =
|
|
11837
|
+
const fromSource = resolve19(import.meta.dir, "../dev/client");
|
|
11733
11838
|
if (existsSync16(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
11734
11839
|
return fromSource;
|
|
11735
11840
|
}
|
|
11736
|
-
const fromNodeModules =
|
|
11841
|
+
const fromNodeModules = resolve19(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
11737
11842
|
if (existsSync16(fromNodeModules))
|
|
11738
11843
|
return fromNodeModules;
|
|
11739
|
-
return
|
|
11844
|
+
return resolve19(import.meta.dir, "./dev/client");
|
|
11740
11845
|
}, devClientDir4, hmrClientPath5, formatDiagnosticMessage = (diagnostic) => {
|
|
11741
11846
|
try {
|
|
11742
11847
|
return ts2.flattenDiagnosticMessageText(diagnostic.messageText, `
|
|
@@ -11778,12 +11883,12 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11778
11883
|
return `${path.replace(/\.ts$/, ".js")}${query}`;
|
|
11779
11884
|
if (hasJsLikeExtension(path))
|
|
11780
11885
|
return `${path}${query}`;
|
|
11781
|
-
const importerDir =
|
|
11782
|
-
const fileCandidate =
|
|
11886
|
+
const importerDir = dirname12(importerOutputPath);
|
|
11887
|
+
const fileCandidate = resolve19(importerDir, `${path}.js`);
|
|
11783
11888
|
if (outputFiles?.has(fileCandidate) || existsSync16(fileCandidate)) {
|
|
11784
11889
|
return `${path}.js${query}`;
|
|
11785
11890
|
}
|
|
11786
|
-
const indexCandidate =
|
|
11891
|
+
const indexCandidate = resolve19(importerDir, path, "index.js");
|
|
11787
11892
|
if (outputFiles?.has(indexCandidate) || existsSync16(indexCandidate)) {
|
|
11788
11893
|
return `${path}/index.js${query}`;
|
|
11789
11894
|
}
|
|
@@ -11811,18 +11916,18 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11811
11916
|
}, resolveLocalTsImport = (fromFile, specifier) => {
|
|
11812
11917
|
if (!isRelativeModuleSpecifier(specifier))
|
|
11813
11918
|
return null;
|
|
11814
|
-
const basePath =
|
|
11919
|
+
const basePath = resolve19(dirname12(fromFile), specifier);
|
|
11815
11920
|
const candidates = /\.[cm]?[tj]sx?$/.test(basePath) ? [basePath] : [
|
|
11816
11921
|
`${basePath}.ts`,
|
|
11817
11922
|
`${basePath}.tsx`,
|
|
11818
11923
|
`${basePath}.mts`,
|
|
11819
11924
|
`${basePath}.cts`,
|
|
11820
|
-
|
|
11821
|
-
|
|
11822
|
-
|
|
11823
|
-
|
|
11925
|
+
join18(basePath, "index.ts"),
|
|
11926
|
+
join18(basePath, "index.tsx"),
|
|
11927
|
+
join18(basePath, "index.mts"),
|
|
11928
|
+
join18(basePath, "index.cts")
|
|
11824
11929
|
];
|
|
11825
|
-
return candidates.map((candidate) =>
|
|
11930
|
+
return candidates.map((candidate) => resolve19(candidate)).find((candidate) => existsSync16(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
11826
11931
|
}, readFileForAotTransform = async (fileName, readFile6) => {
|
|
11827
11932
|
const hostSource = readFile6?.(fileName);
|
|
11828
11933
|
if (typeof hostSource === "string")
|
|
@@ -11846,18 +11951,18 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11846
11951
|
const paths = [];
|
|
11847
11952
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
11848
11953
|
if (templateUrlMatch?.[1])
|
|
11849
|
-
paths.push(
|
|
11954
|
+
paths.push(join18(fileDir, templateUrlMatch[1]));
|
|
11850
11955
|
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
11851
11956
|
if (styleUrlMatch?.[1])
|
|
11852
|
-
paths.push(
|
|
11957
|
+
paths.push(join18(fileDir, styleUrlMatch[1]));
|
|
11853
11958
|
const styleUrlsMatch = findUncommentedMatch(source, /styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
11854
11959
|
const urlMatches = styleUrlsMatch?.[1]?.match(/['"]([^'"]+)['"]/g);
|
|
11855
11960
|
if (urlMatches) {
|
|
11856
11961
|
for (const urlMatch of urlMatches) {
|
|
11857
|
-
paths.push(
|
|
11962
|
+
paths.push(join18(fileDir, urlMatch.replace(/['"]/g, "")));
|
|
11858
11963
|
}
|
|
11859
11964
|
}
|
|
11860
|
-
return paths.map((path) =>
|
|
11965
|
+
return paths.map((path) => resolve19(path));
|
|
11861
11966
|
}, readResourceCacheFile = async (cachePath) => {
|
|
11862
11967
|
try {
|
|
11863
11968
|
const entry = JSON.parse(await fs.readFile(cachePath, "utf-8"));
|
|
@@ -11869,13 +11974,13 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11869
11974
|
return null;
|
|
11870
11975
|
}
|
|
11871
11976
|
}, writeResourceCacheFile = async (cachePath, source) => {
|
|
11872
|
-
await fs.mkdir(
|
|
11977
|
+
await fs.mkdir(dirname12(cachePath), { recursive: true });
|
|
11873
11978
|
await fs.writeFile(cachePath, JSON.stringify({
|
|
11874
11979
|
source,
|
|
11875
11980
|
version: 1
|
|
11876
11981
|
}), "utf-8");
|
|
11877
11982
|
}, resolveResourceTransformCachePath = async (filePath, source, stylePreprocessors) => {
|
|
11878
|
-
const resourcePaths = collectAngularResourcePaths(source,
|
|
11983
|
+
const resourcePaths = collectAngularResourcePaths(source, dirname12(filePath));
|
|
11879
11984
|
const resourceContents = await Promise.all(resourcePaths.map(async (resourcePath) => {
|
|
11880
11985
|
const content = await fs.readFile(resourcePath, "utf-8");
|
|
11881
11986
|
return `${resourcePath}\x00${content}`;
|
|
@@ -11888,7 +11993,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11888
11993
|
safeStableStringify(stylePreprocessors ?? null)
|
|
11889
11994
|
].join("\x00");
|
|
11890
11995
|
const cacheKey2 = Bun.hash(cacheInput).toString(BASE_36_RADIX);
|
|
11891
|
-
return
|
|
11996
|
+
return join18(process.cwd(), ".absolutejs", "cache", "angular-resources", `${cacheKey2}.json`);
|
|
11892
11997
|
}, precomputeAotResourceTransforms = async (inputPaths, readFile6, stylePreprocessors) => {
|
|
11893
11998
|
const transformedSources = new Map;
|
|
11894
11999
|
const visited = new Set;
|
|
@@ -11899,7 +12004,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11899
12004
|
transformedFiles: 0
|
|
11900
12005
|
};
|
|
11901
12006
|
const transformFile = async (filePath) => {
|
|
11902
|
-
const resolvedPath =
|
|
12007
|
+
const resolvedPath = resolve19(filePath);
|
|
11903
12008
|
if (visited.has(resolvedPath))
|
|
11904
12009
|
return;
|
|
11905
12010
|
visited.add(resolvedPath);
|
|
@@ -11915,7 +12020,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11915
12020
|
transformedSource = cached.source;
|
|
11916
12021
|
} else {
|
|
11917
12022
|
stats.cacheMisses += 1;
|
|
11918
|
-
const transformed = await inlineResources(source,
|
|
12023
|
+
const transformed = await inlineResources(source, dirname12(resolvedPath), stylePreprocessors);
|
|
11919
12024
|
transformedSource = transformed.source;
|
|
11920
12025
|
await writeResourceCacheFile(cachePath, transformedSource);
|
|
11921
12026
|
}
|
|
@@ -11934,7 +12039,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11934
12039
|
return { stats, transformedSources };
|
|
11935
12040
|
}, compileAngularFiles = async (inputPaths, outDir, stylePreprocessors) => {
|
|
11936
12041
|
const islandMetadataByOutputPath = await traceAngularPhase("aot/island-metadata", () => new Map(inputPaths.map((inputPath) => {
|
|
11937
|
-
const outputPath =
|
|
12042
|
+
const outputPath = resolve19(join18(outDir, relative11(process.cwd(), resolve19(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
|
|
11938
12043
|
return [
|
|
11939
12044
|
outputPath,
|
|
11940
12045
|
buildIslandMetadataExports(readFileSync11(inputPath, "utf-8"))
|
|
@@ -11944,8 +12049,8 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11944
12049
|
const { readConfiguration, performCompilation, EmitFlags } = await traceAngularPhase("aot/import-compiler-cli", () => import("@angular/compiler-cli"));
|
|
11945
12050
|
const tsLibDir = await traceAngularPhase("aot/resolve-typescript-lib", () => {
|
|
11946
12051
|
const tsPath = __require.resolve("typescript");
|
|
11947
|
-
const tsRootDir =
|
|
11948
|
-
return tsRootDir.endsWith("lib") ? tsRootDir :
|
|
12052
|
+
const tsRootDir = dirname12(tsPath);
|
|
12053
|
+
return tsRootDir.endsWith("lib") ? tsRootDir : resolve19(tsRootDir, "lib");
|
|
11949
12054
|
});
|
|
11950
12055
|
const config = await traceAngularPhase("aot/read-configuration", () => readConfiguration("./tsconfig.json"));
|
|
11951
12056
|
const options = {
|
|
@@ -11981,13 +12086,13 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11981
12086
|
const originalGetSourceFile = host.getSourceFile;
|
|
11982
12087
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
11983
12088
|
if (fileName.startsWith("lib.") && fileName.endsWith(".d.ts") && tsLibDir) {
|
|
11984
|
-
const resolvedPath =
|
|
12089
|
+
const resolvedPath = join18(tsLibDir, fileName);
|
|
11985
12090
|
return originalGetSourceFile?.call(host, resolvedPath, languageVersion, onError);
|
|
11986
12091
|
}
|
|
11987
12092
|
return originalGetSourceFile?.call(host, fileName, languageVersion, onError);
|
|
11988
12093
|
};
|
|
11989
12094
|
const emitted = {};
|
|
11990
|
-
const resolvedOutDir =
|
|
12095
|
+
const resolvedOutDir = resolve19(outDir);
|
|
11991
12096
|
host.writeFile = (fileName, text) => {
|
|
11992
12097
|
const relativePath = resolveRelativePath(fileName, resolvedOutDir, outDir);
|
|
11993
12098
|
emitted[relativePath] = text;
|
|
@@ -12009,12 +12114,12 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
12009
12114
|
if (!fileName.endsWith(".ts") || fileName.endsWith(".d.ts")) {
|
|
12010
12115
|
return source;
|
|
12011
12116
|
}
|
|
12012
|
-
const resolvedPath =
|
|
12117
|
+
const resolvedPath = resolve19(fileName);
|
|
12013
12118
|
return transformedSources.get(resolvedPath) ?? source;
|
|
12014
12119
|
};
|
|
12015
12120
|
const originalGetSourceFileForCompile = host.getSourceFile;
|
|
12016
12121
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
12017
|
-
const source = transformedSources.get(
|
|
12122
|
+
const source = transformedSources.get(resolve19(fileName));
|
|
12018
12123
|
if (source) {
|
|
12019
12124
|
return ts2.createSourceFile(fileName, source, languageVersion, true);
|
|
12020
12125
|
}
|
|
@@ -12036,9 +12141,9 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
12036
12141
|
const entries = await traceAngularPhase("aot/postprocess-emitted-js", () => {
|
|
12037
12142
|
const rawEntries = Object.entries(emitted).filter(([fileName]) => fileName.endsWith(".js")).map(([fileName, content]) => ({
|
|
12038
12143
|
content,
|
|
12039
|
-
target:
|
|
12144
|
+
target: join18(outDir, fileName)
|
|
12040
12145
|
}));
|
|
12041
|
-
const outputFiles = new Set(rawEntries.map(({ target }) =>
|
|
12146
|
+
const outputFiles = new Set(rawEntries.map(({ target }) => resolve19(target)));
|
|
12042
12147
|
return rawEntries.map(({ content, target }) => {
|
|
12043
12148
|
let processedContent = content.replace(/from\s+(['"])(\.\.?\/[^'"]+)(\1)/g, (match, quote, path) => {
|
|
12044
12149
|
const rewritten = rewriteRelativeJsSpecifier(target, path, outputFiles);
|
|
@@ -12053,12 +12158,12 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
12053
12158
|
return cleaned ? `import { ${cleaned}, InternalInjectFlags } from '@angular/core'` : `import { InternalInjectFlags } from '@angular/core'`;
|
|
12054
12159
|
});
|
|
12055
12160
|
processedContent = processedContent.replace(/\b(?<!Internal)InjectFlags\b/g, "InternalInjectFlags");
|
|
12056
|
-
processedContent += islandMetadataByOutputPath.get(
|
|
12161
|
+
processedContent += islandMetadataByOutputPath.get(resolve19(target)) ?? "";
|
|
12057
12162
|
return { content: processedContent, target };
|
|
12058
12163
|
});
|
|
12059
12164
|
});
|
|
12060
12165
|
await traceAngularPhase("aot/write-output", () => Promise.all(entries.map(async ({ target, content }) => {
|
|
12061
|
-
await fs.mkdir(
|
|
12166
|
+
await fs.mkdir(dirname12(target), { recursive: true });
|
|
12062
12167
|
await fs.writeFile(target, content, "utf-8");
|
|
12063
12168
|
})), { outputs: entries.length });
|
|
12064
12169
|
return await traceAngularPhase("aot/collect-output-paths", () => entries.map(({ target }) => target), { outputs: entries.length });
|
|
@@ -12074,7 +12179,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
12074
12179
|
}
|
|
12075
12180
|
return null;
|
|
12076
12181
|
}, resolveAngularDeferImportSpecifier = () => {
|
|
12077
|
-
const sourceEntry =
|
|
12182
|
+
const sourceEntry = resolve19(import.meta.dir, "../angular/components/index.ts");
|
|
12078
12183
|
if (existsSync16(sourceEntry)) {
|
|
12079
12184
|
return sourceEntry.replace(/\\/g, "/");
|
|
12080
12185
|
}
|
|
@@ -12211,7 +12316,7 @@ ${fields}
|
|
|
12211
12316
|
}, inlineTemplateAndLowerDefer = async (source, fileDir) => {
|
|
12212
12317
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
12213
12318
|
if (templateUrlMatch?.[1]) {
|
|
12214
|
-
const templatePath =
|
|
12319
|
+
const templatePath = join18(fileDir, templateUrlMatch[1]);
|
|
12215
12320
|
if (!existsSync16(templatePath)) {
|
|
12216
12321
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
12217
12322
|
}
|
|
@@ -12242,7 +12347,7 @@ ${fields}
|
|
|
12242
12347
|
}, inlineTemplateAndLowerDeferSync = (source, fileDir) => {
|
|
12243
12348
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
12244
12349
|
if (templateUrlMatch?.[1]) {
|
|
12245
|
-
const templatePath =
|
|
12350
|
+
const templatePath = join18(fileDir, templateUrlMatch[1]);
|
|
12246
12351
|
if (!existsSync16(templatePath)) {
|
|
12247
12352
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
12248
12353
|
}
|
|
@@ -12279,7 +12384,7 @@ ${fields}
|
|
|
12279
12384
|
return source;
|
|
12280
12385
|
const stylePromises = urlMatches.map((urlMatch) => {
|
|
12281
12386
|
const styleUrl = urlMatch.replace(/['"]/g, "");
|
|
12282
|
-
return readAndEscapeFile(
|
|
12387
|
+
return readAndEscapeFile(join18(fileDir, styleUrl), stylePreprocessors);
|
|
12283
12388
|
});
|
|
12284
12389
|
const results = await Promise.all(stylePromises);
|
|
12285
12390
|
const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
|
|
@@ -12290,7 +12395,7 @@ ${fields}
|
|
|
12290
12395
|
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
12291
12396
|
if (!styleUrlMatch?.[1])
|
|
12292
12397
|
return source;
|
|
12293
|
-
const escaped = await readAndEscapeFile(
|
|
12398
|
+
const escaped = await readAndEscapeFile(join18(fileDir, styleUrlMatch[1]), stylePreprocessors);
|
|
12294
12399
|
if (!escaped)
|
|
12295
12400
|
return source;
|
|
12296
12401
|
return source.slice(0, styleUrlMatch.index) + `styles: [\`${escaped}\`]` + source.slice(styleUrlMatch.index + styleUrlMatch[0].length);
|
|
@@ -12304,10 +12409,10 @@ ${fields}
|
|
|
12304
12409
|
source: result
|
|
12305
12410
|
};
|
|
12306
12411
|
}, compileAngularFileJIT = async (inputPath, outDir, rootDir, stylePreprocessors, cacheBuster) => {
|
|
12307
|
-
const entryPath =
|
|
12412
|
+
const entryPath = resolve19(inputPath);
|
|
12308
12413
|
const allOutputs = [];
|
|
12309
12414
|
const visited = new Set;
|
|
12310
|
-
const baseDir =
|
|
12415
|
+
const baseDir = resolve19(rootDir ?? process.cwd());
|
|
12311
12416
|
let usesLegacyAnimations = false;
|
|
12312
12417
|
const angularTranspiler = new Bun.Transpiler({
|
|
12313
12418
|
loader: "ts",
|
|
@@ -12325,16 +12430,16 @@ ${fields}
|
|
|
12325
12430
|
`${candidate}.tsx`,
|
|
12326
12431
|
`${candidate}.js`,
|
|
12327
12432
|
`${candidate}.jsx`,
|
|
12328
|
-
|
|
12329
|
-
|
|
12330
|
-
|
|
12331
|
-
|
|
12433
|
+
join18(candidate, "index.ts"),
|
|
12434
|
+
join18(candidate, "index.tsx"),
|
|
12435
|
+
join18(candidate, "index.js"),
|
|
12436
|
+
join18(candidate, "index.jsx")
|
|
12332
12437
|
];
|
|
12333
12438
|
return candidates.find((file3) => existsSync16(file3));
|
|
12334
12439
|
};
|
|
12335
12440
|
const resolveLocalImport = (specifier, fromDir) => {
|
|
12336
12441
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
12337
|
-
return resolveSourceFile2(
|
|
12442
|
+
return resolveSourceFile2(resolve19(fromDir, specifier));
|
|
12338
12443
|
}
|
|
12339
12444
|
const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile2);
|
|
12340
12445
|
if (aliased)
|
|
@@ -12343,7 +12448,7 @@ ${fields}
|
|
|
12343
12448
|
const resolved = Bun.resolveSync(specifier, fromDir);
|
|
12344
12449
|
if (resolved.includes("/node_modules/"))
|
|
12345
12450
|
return;
|
|
12346
|
-
const absolute =
|
|
12451
|
+
const absolute = resolve19(resolved);
|
|
12347
12452
|
if (!absolute.startsWith(baseDir))
|
|
12348
12453
|
return;
|
|
12349
12454
|
return resolveSourceFile2(absolute);
|
|
@@ -12352,10 +12457,10 @@ ${fields}
|
|
|
12352
12457
|
}
|
|
12353
12458
|
};
|
|
12354
12459
|
const toOutputPath = (sourcePath) => {
|
|
12355
|
-
const inputDir =
|
|
12460
|
+
const inputDir = dirname12(sourcePath);
|
|
12356
12461
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
12357
12462
|
const fileBase = basename6(sourcePath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
12358
|
-
return
|
|
12463
|
+
return join18(outDir, relativeDir, fileBase);
|
|
12359
12464
|
};
|
|
12360
12465
|
const withCacheBuster = (specifier) => {
|
|
12361
12466
|
if (!cacheBuster)
|
|
@@ -12392,13 +12497,13 @@ ${fields}
|
|
|
12392
12497
|
return `${prefix}${dots}`;
|
|
12393
12498
|
return `${prefix}../${dots}`;
|
|
12394
12499
|
});
|
|
12395
|
-
if (
|
|
12500
|
+
if (resolve19(actualPath) === entryPath) {
|
|
12396
12501
|
processedContent += buildIslandMetadataExports(sourceCode);
|
|
12397
12502
|
}
|
|
12398
12503
|
return processedContent;
|
|
12399
12504
|
};
|
|
12400
12505
|
const transpileFile = async (filePath) => {
|
|
12401
|
-
const resolved =
|
|
12506
|
+
const resolved = resolve19(filePath);
|
|
12402
12507
|
if (visited.has(resolved))
|
|
12403
12508
|
return;
|
|
12404
12509
|
visited.add(resolved);
|
|
@@ -12408,12 +12513,12 @@ ${fields}
|
|
|
12408
12513
|
if (!existsSync16(actualPath))
|
|
12409
12514
|
return;
|
|
12410
12515
|
let sourceCode = await fs.readFile(actualPath, "utf-8");
|
|
12411
|
-
const inlined = await inlineResources(sourceCode,
|
|
12412
|
-
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source,
|
|
12413
|
-
const inputDir =
|
|
12516
|
+
const inlined = await inlineResources(sourceCode, dirname12(actualPath), stylePreprocessors);
|
|
12517
|
+
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname12(actualPath)).source;
|
|
12518
|
+
const inputDir = dirname12(actualPath);
|
|
12414
12519
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
12415
12520
|
const fileBase = basename6(actualPath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
12416
|
-
const targetDir =
|
|
12521
|
+
const targetDir = join18(outDir, relativeDir);
|
|
12417
12522
|
const targetPath = toOutputPath(actualPath);
|
|
12418
12523
|
const localImports = [];
|
|
12419
12524
|
const importRewrites = new Map;
|
|
@@ -12435,12 +12540,12 @@ ${fields}
|
|
|
12435
12540
|
const resolved2 = resolveLocalImport(specifier, inputDir);
|
|
12436
12541
|
if (!resolved2)
|
|
12437
12542
|
return null;
|
|
12438
|
-
const relativeImport =
|
|
12543
|
+
const relativeImport = relative11(targetDir, toOutputPath(resolved2)).replace(/\\/g, "/").replace(/\.js$/, "");
|
|
12439
12544
|
const relativeRewrite = relativeImport.startsWith(".") ? relativeImport : `./${relativeImport}`;
|
|
12440
12545
|
importRewrites.set(specifier, relativeRewrite);
|
|
12441
12546
|
return resolved2;
|
|
12442
12547
|
}).filter((path) => Boolean(path));
|
|
12443
|
-
const isEntry =
|
|
12548
|
+
const isEntry = resolve19(actualPath) === resolve19(entryPath);
|
|
12444
12549
|
const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
|
|
12445
12550
|
const cacheKey2 = actualPath;
|
|
12446
12551
|
const shouldWriteFile = cacheBuster && isEntry ? true : jitContentCache.get(cacheKey2) !== contentHash || !existsSync16(targetPath);
|
|
@@ -12474,13 +12579,13 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
12474
12579
|
return { clientPaths: [...emptyPaths], serverPaths: [...emptyPaths] };
|
|
12475
12580
|
}
|
|
12476
12581
|
const compiledRoot = compiledParent;
|
|
12477
|
-
const indexesDir =
|
|
12582
|
+
const indexesDir = join18(compiledParent, "indexes");
|
|
12478
12583
|
await traceAngularPhase("setup/create-indexes-dir", () => fs.mkdir(indexesDir, { recursive: true }));
|
|
12479
|
-
const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) =>
|
|
12584
|
+
const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) => resolve19(entry)), compiledRoot, stylePreprocessors), { entries: entryPoints.length });
|
|
12480
12585
|
const usesLegacyAngularAnimations = await traceAngularPhase("setup/legacy-animation-resolver", () => createLegacyAngularAnimationUsageResolver(outRoot));
|
|
12481
12586
|
const compileTasks = entryPoints.map(async (entry) => {
|
|
12482
|
-
const resolvedEntry =
|
|
12483
|
-
const relativeEntry =
|
|
12587
|
+
const resolvedEntry = resolve19(entry);
|
|
12588
|
+
const relativeEntry = relative11(outRoot, resolvedEntry).replace(/\.[tj]s$/, ".js");
|
|
12484
12589
|
const compileEntry = () => compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot, stylePreprocessors);
|
|
12485
12590
|
let outputs = hmr ? await traceAngularPhase("jit/compile-entry", compileEntry, {
|
|
12486
12591
|
entry: resolvedEntry
|
|
@@ -12488,13 +12593,13 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
12488
12593
|
const fileBase = basename6(resolvedEntry).replace(/\.[tj]s$/, "");
|
|
12489
12594
|
const jsName = `${fileBase}.js`;
|
|
12490
12595
|
const compiledFallbackPaths = [
|
|
12491
|
-
|
|
12492
|
-
|
|
12493
|
-
|
|
12494
|
-
].map((file3) =>
|
|
12596
|
+
join18(compiledRoot, relativeEntry),
|
|
12597
|
+
join18(compiledRoot, "pages", jsName),
|
|
12598
|
+
join18(compiledRoot, jsName)
|
|
12599
|
+
].map((file3) => resolve19(file3));
|
|
12495
12600
|
const resolveRawServerFile = (candidatePaths) => {
|
|
12496
12601
|
const normalizedCandidates = [
|
|
12497
|
-
...candidatePaths.map((file3) =>
|
|
12602
|
+
...candidatePaths.map((file3) => resolve19(file3)),
|
|
12498
12603
|
...compiledFallbackPaths
|
|
12499
12604
|
];
|
|
12500
12605
|
let candidate = normalizedCandidates.find((file3) => existsSync16(file3) && file3.endsWith(`${sep3}pages${sep3}${jsName}`));
|
|
@@ -12535,7 +12640,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
12535
12640
|
const usesLegacyAnimations = await traceAngularPhase("wrapper/detect-legacy-animations", () => usesLegacyAngularAnimations(resolvedEntry), { entry: resolvedEntry });
|
|
12536
12641
|
const serverContentHash = Bun.hash(original).toString(BASE_36_RADIX);
|
|
12537
12642
|
const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
|
|
12538
|
-
const clientFile =
|
|
12643
|
+
const clientFile = join18(indexesDir, jsName);
|
|
12539
12644
|
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync16(clientFile) && (usesLegacyAnimations || !original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__")) && (!usesLegacyAnimations || original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__"))) {
|
|
12540
12645
|
return {
|
|
12541
12646
|
clientPath: clientFile,
|
|
@@ -12562,7 +12667,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
12562
12667
|
`;
|
|
12563
12668
|
}
|
|
12564
12669
|
await traceAngularPhase("wrapper/write-server-output", () => fs.writeFile(rawServerFile, rewritten, "utf-8"), { entry: resolvedEntry });
|
|
12565
|
-
const relativePath =
|
|
12670
|
+
const relativePath = relative11(indexesDir, rawServerFile).replace(/\\/g, "/");
|
|
12566
12671
|
const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
12567
12672
|
const hmrPreamble = hmr ? `window.__HMR_FRAMEWORK__ = "angular";
|
|
12568
12673
|
import "${hmrClientPath5}";
|
|
@@ -12766,7 +12871,7 @@ var init_compileAngular = __esm(() => {
|
|
|
12766
12871
|
init_stylePreprocessor();
|
|
12767
12872
|
init_generatedDir();
|
|
12768
12873
|
devClientDir4 = resolveDevClientDir4();
|
|
12769
|
-
hmrClientPath5 =
|
|
12874
|
+
hmrClientPath5 = join18(devClientDir4, "hmrClient.ts").replace(/\\/g, "/");
|
|
12770
12875
|
jitContentCache = new Map;
|
|
12771
12876
|
wrapperOutputCache = new Map;
|
|
12772
12877
|
});
|
|
@@ -13211,7 +13316,7 @@ __export(exports_compileEmber, {
|
|
|
13211
13316
|
getEmberServerCompiledDir: () => getEmberServerCompiledDir,
|
|
13212
13317
|
getEmberCompiledRoot: () => getEmberCompiledRoot,
|
|
13213
13318
|
getEmberClientCompiledDir: () => getEmberClientCompiledDir,
|
|
13214
|
-
dirname: () =>
|
|
13319
|
+
dirname: () => dirname13,
|
|
13215
13320
|
compileEmberFileSource: () => compileEmberFileSource,
|
|
13216
13321
|
compileEmberFile: () => compileEmberFile,
|
|
13217
13322
|
compileEmber: () => compileEmber,
|
|
@@ -13219,16 +13324,16 @@ __export(exports_compileEmber, {
|
|
|
13219
13324
|
basename: () => basename7
|
|
13220
13325
|
});
|
|
13221
13326
|
import { existsSync as existsSync17 } from "fs";
|
|
13222
|
-
import { mkdir as
|
|
13223
|
-
import { basename as basename7, dirname as
|
|
13224
|
-
var {build: bunBuild2, Transpiler:
|
|
13327
|
+
import { mkdir as mkdir6, rm as rm4 } from "fs/promises";
|
|
13328
|
+
import { basename as basename7, dirname as dirname13, extname as extname6, join as join19, resolve as resolve20 } from "path";
|
|
13329
|
+
var {build: bunBuild2, Transpiler: Transpiler4, write: write3, file: file3 } = globalThis.Bun;
|
|
13225
13330
|
var cachedPreprocessor = null, getPreprocessor = async () => {
|
|
13226
13331
|
if (cachedPreprocessor)
|
|
13227
13332
|
return cachedPreprocessor;
|
|
13228
13333
|
const module = await Promise.resolve().then(() => __toESM(require_node(), 1));
|
|
13229
13334
|
cachedPreprocessor = new module.Preprocessor;
|
|
13230
13335
|
return cachedPreprocessor;
|
|
13231
|
-
},
|
|
13336
|
+
}, transpiler5, isTemplateTagFile = (entry) => {
|
|
13232
13337
|
const ext = extname6(entry);
|
|
13233
13338
|
return ext === ".gjs" || ext === ".gts";
|
|
13234
13339
|
}, rewriteTemplateEvalToScope = (source) => {
|
|
@@ -13316,7 +13421,7 @@ export const importSync = (specifier) => {
|
|
|
13316
13421
|
const originalImporter = stagedSourceMap.get(args.importer);
|
|
13317
13422
|
if (!originalImporter)
|
|
13318
13423
|
return;
|
|
13319
|
-
const candidateBase =
|
|
13424
|
+
const candidateBase = resolve20(dirname13(originalImporter), args.path);
|
|
13320
13425
|
const extensionsToTry = ["", ".gts", ".gjs", ".ts", ".js"];
|
|
13321
13426
|
for (const ext of extensionsToTry) {
|
|
13322
13427
|
const candidate = candidateBase + ext;
|
|
@@ -13333,13 +13438,13 @@ export const importSync = (specifier) => {
|
|
|
13333
13438
|
filename: args.path
|
|
13334
13439
|
});
|
|
13335
13440
|
const rewritten = rewriteTemplateEvalToScope(result.code);
|
|
13336
|
-
const transpiled =
|
|
13441
|
+
const transpiled = transpiler5.transformSync(rewritten);
|
|
13337
13442
|
return { contents: transpiled, loader: "js" };
|
|
13338
13443
|
});
|
|
13339
13444
|
build.onResolve({ filter: /^@(?:ember|glimmer|simple-dom)\// }, (args) => {
|
|
13340
13445
|
if (standalonePackages.has(args.path))
|
|
13341
13446
|
return;
|
|
13342
|
-
const internal =
|
|
13447
|
+
const internal = join19(cwd, "node_modules/ember-source/dist/packages", args.path, "index.js");
|
|
13343
13448
|
if (existsSync17(internal))
|
|
13344
13449
|
return { path: internal };
|
|
13345
13450
|
return;
|
|
@@ -13375,7 +13480,7 @@ export const renderToHTML = (props = {}) => {
|
|
|
13375
13480
|
export { PageComponent };
|
|
13376
13481
|
export default PageComponent;
|
|
13377
13482
|
`, compileEmberFile = async (entry, compiledRoot, cwd = process.cwd()) => {
|
|
13378
|
-
const resolvedEntry =
|
|
13483
|
+
const resolvedEntry = resolve20(entry);
|
|
13379
13484
|
const source = await file3(resolvedEntry).text();
|
|
13380
13485
|
let preprocessed = source;
|
|
13381
13486
|
if (isTemplateTagFile(resolvedEntry)) {
|
|
@@ -13385,18 +13490,18 @@ export default PageComponent;
|
|
|
13385
13490
|
});
|
|
13386
13491
|
preprocessed = rewriteTemplateEvalToScope(result.code);
|
|
13387
13492
|
}
|
|
13388
|
-
const transpiled =
|
|
13493
|
+
const transpiled = transpiler5.transformSync(preprocessed);
|
|
13389
13494
|
const baseName = basename7(resolvedEntry).replace(/\.(gjs|gts|ts|js)$/, "");
|
|
13390
|
-
const tmpDir =
|
|
13391
|
-
const serverDir =
|
|
13392
|
-
const clientDir =
|
|
13495
|
+
const tmpDir = join19(compiledRoot, "_tmp");
|
|
13496
|
+
const serverDir = join19(compiledRoot, "server");
|
|
13497
|
+
const clientDir = join19(compiledRoot, "client");
|
|
13393
13498
|
await Promise.all([
|
|
13394
|
-
|
|
13395
|
-
|
|
13396
|
-
|
|
13499
|
+
mkdir6(tmpDir, { recursive: true }),
|
|
13500
|
+
mkdir6(serverDir, { recursive: true }),
|
|
13501
|
+
mkdir6(clientDir, { recursive: true })
|
|
13397
13502
|
]);
|
|
13398
|
-
const tmpPagePath =
|
|
13399
|
-
const tmpHarnessPath =
|
|
13503
|
+
const tmpPagePath = resolve20(join19(tmpDir, `${baseName}.module.js`));
|
|
13504
|
+
const tmpHarnessPath = resolve20(join19(tmpDir, `${baseName}.harness.js`));
|
|
13400
13505
|
await Promise.all([
|
|
13401
13506
|
write3(tmpPagePath, transpiled),
|
|
13402
13507
|
write3(tmpHarnessPath, generateServerHarness(tmpPagePath))
|
|
@@ -13404,7 +13509,7 @@ export default PageComponent;
|
|
|
13404
13509
|
const stagedSourceMap = new Map([
|
|
13405
13510
|
[tmpPagePath, resolvedEntry]
|
|
13406
13511
|
]);
|
|
13407
|
-
const serverPath =
|
|
13512
|
+
const serverPath = join19(serverDir, `${baseName}.js`);
|
|
13408
13513
|
const buildResult = await bunBuild2({
|
|
13409
13514
|
entrypoints: [tmpHarnessPath],
|
|
13410
13515
|
format: "esm",
|
|
@@ -13421,7 +13526,7 @@ export default PageComponent;
|
|
|
13421
13526
|
console.warn(`\u26A0\uFE0F Ember server build for ${baseName} had errors:`, buildResult.logs);
|
|
13422
13527
|
}
|
|
13423
13528
|
await rm4(tmpDir, { force: true, recursive: true });
|
|
13424
|
-
const clientPath =
|
|
13529
|
+
const clientPath = join19(clientDir, `${baseName}.js`);
|
|
13425
13530
|
await write3(clientPath, transpiled);
|
|
13426
13531
|
return { clientPath, serverPath };
|
|
13427
13532
|
}, compileEmber = async (entries, emberDir, cwd = process.cwd(), _hmr = false) => {
|
|
@@ -13438,7 +13543,7 @@ export default PageComponent;
|
|
|
13438
13543
|
serverPaths: outputs.map((o) => o.serverPath)
|
|
13439
13544
|
};
|
|
13440
13545
|
}, compileEmberFileSource = async (entry) => {
|
|
13441
|
-
const resolvedEntry =
|
|
13546
|
+
const resolvedEntry = resolve20(entry);
|
|
13442
13547
|
const source = await file3(resolvedEntry).text();
|
|
13443
13548
|
let preprocessed = source;
|
|
13444
13549
|
if (isTemplateTagFile(resolvedEntry)) {
|
|
@@ -13448,11 +13553,11 @@ export default PageComponent;
|
|
|
13448
13553
|
});
|
|
13449
13554
|
preprocessed = rewriteTemplateEvalToScope(result.code);
|
|
13450
13555
|
}
|
|
13451
|
-
return
|
|
13452
|
-
}, clearEmberCompilerCache = () => {}, getEmberCompiledRoot = (_emberDir) => getFrameworkGeneratedDir("ember"), getEmberServerCompiledDir = (emberDir) =>
|
|
13556
|
+
return transpiler5.transformSync(preprocessed);
|
|
13557
|
+
}, clearEmberCompilerCache = () => {}, getEmberCompiledRoot = (_emberDir) => getFrameworkGeneratedDir("ember"), getEmberServerCompiledDir = (emberDir) => join19(getEmberCompiledRoot(emberDir), "server"), getEmberClientCompiledDir = (emberDir) => join19(getEmberCompiledRoot(emberDir), "client");
|
|
13453
13558
|
var init_compileEmber = __esm(() => {
|
|
13454
13559
|
init_generatedDir();
|
|
13455
|
-
|
|
13560
|
+
transpiler5 = new Transpiler4({
|
|
13456
13561
|
loader: "ts",
|
|
13457
13562
|
target: "browser",
|
|
13458
13563
|
tsconfig: JSON.stringify({
|
|
@@ -13471,24 +13576,24 @@ __export(exports_buildReactVendor, {
|
|
|
13471
13576
|
buildReactVendor: () => buildReactVendor
|
|
13472
13577
|
});
|
|
13473
13578
|
import { existsSync as existsSync18, mkdirSync as mkdirSync7 } from "fs";
|
|
13474
|
-
import { join as
|
|
13579
|
+
import { join as join20, resolve as resolve21 } from "path";
|
|
13475
13580
|
import { rm as rm5 } from "fs/promises";
|
|
13476
13581
|
var {build: bunBuild3 } = globalThis.Bun;
|
|
13477
13582
|
var resolveJsxDevRuntimeCompatPath = () => {
|
|
13478
13583
|
const candidates = [
|
|
13479
|
-
|
|
13480
|
-
|
|
13481
|
-
|
|
13482
|
-
|
|
13483
|
-
|
|
13484
|
-
|
|
13584
|
+
resolve21(import.meta.dir, "react", "jsxDevRuntimeCompat.js"),
|
|
13585
|
+
resolve21(import.meta.dir, "src", "react", "jsxDevRuntimeCompat.ts"),
|
|
13586
|
+
resolve21(import.meta.dir, "..", "react", "jsxDevRuntimeCompat.js"),
|
|
13587
|
+
resolve21(import.meta.dir, "..", "src", "react", "jsxDevRuntimeCompat.ts"),
|
|
13588
|
+
resolve21(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
13589
|
+
resolve21(import.meta.dir, "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
13485
13590
|
];
|
|
13486
13591
|
for (const candidate of candidates) {
|
|
13487
13592
|
if (existsSync18(candidate)) {
|
|
13488
13593
|
return candidate.replace(/\\/g, "/");
|
|
13489
13594
|
}
|
|
13490
13595
|
}
|
|
13491
|
-
return (candidates[0] ??
|
|
13596
|
+
return (candidates[0] ?? resolve21(import.meta.dir, "react", "jsxDevRuntimeCompat.js")).replace(/\\/g, "/");
|
|
13492
13597
|
}, jsxDevRuntimeCompatPath, reactSpecifiers, isResolvable = (specifier) => {
|
|
13493
13598
|
try {
|
|
13494
13599
|
Bun.resolveSync(specifier, process.cwd());
|
|
@@ -13525,14 +13630,14 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
13525
13630
|
`)}
|
|
13526
13631
|
`;
|
|
13527
13632
|
}, buildReactVendor = async (buildDir) => {
|
|
13528
|
-
const vendorDir =
|
|
13633
|
+
const vendorDir = join20(buildDir, "react", "vendor");
|
|
13529
13634
|
mkdirSync7(vendorDir, { recursive: true });
|
|
13530
|
-
const tmpDir =
|
|
13635
|
+
const tmpDir = join20(buildDir, "_vendor_tmp");
|
|
13531
13636
|
mkdirSync7(tmpDir, { recursive: true });
|
|
13532
13637
|
const specifiers = resolveVendorSpecifiers();
|
|
13533
13638
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
13534
13639
|
const safeName = toSafeFileName(specifier);
|
|
13535
|
-
const entryPath =
|
|
13640
|
+
const entryPath = join20(tmpDir, `${safeName}.ts`);
|
|
13536
13641
|
const source = await generateEntrySource(specifier);
|
|
13537
13642
|
await Bun.write(entryPath, source);
|
|
13538
13643
|
return entryPath;
|
|
@@ -13597,7 +13702,7 @@ __export(exports_buildAngularVendor, {
|
|
|
13597
13702
|
buildAngularServerVendor: () => buildAngularServerVendor
|
|
13598
13703
|
});
|
|
13599
13704
|
import { mkdirSync as mkdirSync8 } from "fs";
|
|
13600
|
-
import { join as
|
|
13705
|
+
import { join as join21 } from "path";
|
|
13601
13706
|
import { rm as rm6 } from "fs/promises";
|
|
13602
13707
|
var {build: bunBuild4, Glob: Glob6 } = globalThis.Bun;
|
|
13603
13708
|
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) => {
|
|
@@ -13610,7 +13715,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
13610
13715
|
}, 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) => {
|
|
13611
13716
|
const angular = new Set;
|
|
13612
13717
|
const transitiveRoots = new Set;
|
|
13613
|
-
const
|
|
13718
|
+
const transpiler6 = new Bun.Transpiler({ loader: "tsx" });
|
|
13614
13719
|
const glob = new Glob6("**/*.{ts,tsx,js,jsx}");
|
|
13615
13720
|
for (const dir of directories) {
|
|
13616
13721
|
try {
|
|
@@ -13621,7 +13726,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
13621
13726
|
continue;
|
|
13622
13727
|
try {
|
|
13623
13728
|
const content = await Bun.file(file4).text();
|
|
13624
|
-
for (const imp of
|
|
13729
|
+
for (const imp of transpiler6.scanImports(content)) {
|
|
13625
13730
|
if (isAngularBrowserSpecifier(imp.path)) {
|
|
13626
13731
|
angular.add(imp.path);
|
|
13627
13732
|
} else if (isBareSpecifier(imp.path)) {
|
|
@@ -13635,7 +13740,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
13635
13740
|
return { angular, transitiveRoots };
|
|
13636
13741
|
}, PARTIAL_DECL_MARKERS, containsPartialDeclarations = (source) => PARTIAL_DECL_MARKERS.some((marker) => source.includes(marker)), collectTransitiveAngularSpecs = async (roots, angularFound) => {
|
|
13637
13742
|
const { readFileSync: readFileSync12 } = await import("fs");
|
|
13638
|
-
const
|
|
13743
|
+
const transpiler6 = new Bun.Transpiler({ loader: "js" });
|
|
13639
13744
|
const visited = new Set;
|
|
13640
13745
|
const frontier = [];
|
|
13641
13746
|
for (const r of roots)
|
|
@@ -13664,7 +13769,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
13664
13769
|
}
|
|
13665
13770
|
let imports;
|
|
13666
13771
|
try {
|
|
13667
|
-
imports =
|
|
13772
|
+
imports = transpiler6.scanImports(content);
|
|
13668
13773
|
} catch {
|
|
13669
13774
|
continue;
|
|
13670
13775
|
}
|
|
@@ -13694,14 +13799,14 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
13694
13799
|
await collectTransitiveAngularSpecs([...angular, ...transitiveRoots], angular);
|
|
13695
13800
|
return Array.from(angular).filter(isResolvable2);
|
|
13696
13801
|
}, buildAngularVendor = async (buildDir, directories = [], linkerJitMode = false, depVendorSpecifiers = []) => {
|
|
13697
|
-
const vendorDir =
|
|
13802
|
+
const vendorDir = join21(buildDir, "angular", "vendor");
|
|
13698
13803
|
mkdirSync8(vendorDir, { recursive: true });
|
|
13699
|
-
const tmpDir =
|
|
13804
|
+
const tmpDir = join21(buildDir, "_angular_vendor_tmp");
|
|
13700
13805
|
mkdirSync8(tmpDir, { recursive: true });
|
|
13701
13806
|
const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
13702
13807
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
13703
13808
|
const safeName = toSafeFileName2(specifier);
|
|
13704
|
-
const entryPath =
|
|
13809
|
+
const entryPath = join21(tmpDir, `${safeName}.ts`);
|
|
13705
13810
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
13706
13811
|
return entryPath;
|
|
13707
13812
|
}));
|
|
@@ -13732,9 +13837,9 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
13732
13837
|
const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
13733
13838
|
return computeAngularVendorPaths(specifiers);
|
|
13734
13839
|
}, buildAngularServerVendor = async (buildDir, directories = [], linkerJitMode = false) => {
|
|
13735
|
-
const vendorDir =
|
|
13840
|
+
const vendorDir = join21(buildDir, "angular", "vendor", "server");
|
|
13736
13841
|
mkdirSync8(vendorDir, { recursive: true });
|
|
13737
|
-
const tmpDir =
|
|
13842
|
+
const tmpDir = join21(buildDir, "_angular_server_vendor_tmp");
|
|
13738
13843
|
mkdirSync8(tmpDir, { recursive: true });
|
|
13739
13844
|
const browserSpecs = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
13740
13845
|
const allSpecs = new Set(browserSpecs);
|
|
@@ -13745,7 +13850,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
13745
13850
|
const specifiers = Array.from(allSpecs);
|
|
13746
13851
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
13747
13852
|
const safeName = toSafeFileName2(specifier);
|
|
13748
|
-
const entryPath =
|
|
13853
|
+
const entryPath = join21(tmpDir, `${safeName}.ts`);
|
|
13749
13854
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
13750
13855
|
return entryPath;
|
|
13751
13856
|
}));
|
|
@@ -13767,9 +13872,9 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
13767
13872
|
return specifiers;
|
|
13768
13873
|
}, computeAngularServerVendorPaths = (buildDir, specifiers) => {
|
|
13769
13874
|
const paths = {};
|
|
13770
|
-
const vendorDir =
|
|
13875
|
+
const vendorDir = join21(buildDir, "angular", "vendor", "server");
|
|
13771
13876
|
for (const specifier of specifiers) {
|
|
13772
|
-
paths[specifier] =
|
|
13877
|
+
paths[specifier] = join21(vendorDir, `${toSafeFileName2(specifier)}.js`);
|
|
13773
13878
|
}
|
|
13774
13879
|
return paths;
|
|
13775
13880
|
}, computeAngularServerVendorPathsAsync = async (buildDir, directories = [], linkerJitMode = true) => {
|
|
@@ -13825,17 +13930,17 @@ __export(exports_buildVueVendor, {
|
|
|
13825
13930
|
buildVueVendor: () => buildVueVendor
|
|
13826
13931
|
});
|
|
13827
13932
|
import { mkdirSync as mkdirSync9 } from "fs";
|
|
13828
|
-
import { join as
|
|
13933
|
+
import { join as join22 } from "path";
|
|
13829
13934
|
import { rm as rm7 } from "fs/promises";
|
|
13830
13935
|
var {build: bunBuild5 } = globalThis.Bun;
|
|
13831
13936
|
var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"), buildVueVendor = async (buildDir) => {
|
|
13832
|
-
const vendorDir =
|
|
13937
|
+
const vendorDir = join22(buildDir, "vue", "vendor");
|
|
13833
13938
|
mkdirSync9(vendorDir, { recursive: true });
|
|
13834
|
-
const tmpDir =
|
|
13939
|
+
const tmpDir = join22(buildDir, "_vue_vendor_tmp");
|
|
13835
13940
|
mkdirSync9(tmpDir, { recursive: true });
|
|
13836
13941
|
const entrypoints = await Promise.all(vueSpecifiers.map(async (specifier) => {
|
|
13837
13942
|
const safeName = toSafeFileName3(specifier);
|
|
13838
|
-
const entryPath =
|
|
13943
|
+
const entryPath = join22(tmpDir, `${safeName}.ts`);
|
|
13839
13944
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
13840
13945
|
`);
|
|
13841
13946
|
return entryPath;
|
|
@@ -13863,7 +13968,7 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
|
|
|
13863
13968
|
const { readFileSync: readFileSync12, writeFileSync: writeFileSync7, readdirSync } = await import("fs");
|
|
13864
13969
|
const files = readdirSync(vendorDir).filter((f2) => f2.endsWith(".js"));
|
|
13865
13970
|
for (const file4 of files) {
|
|
13866
|
-
const filePath =
|
|
13971
|
+
const filePath = join22(vendorDir, file4);
|
|
13867
13972
|
const content = readFileSync12(filePath, "utf-8");
|
|
13868
13973
|
if (!content.includes("__VUE_HMR_RUNTIME__"))
|
|
13869
13974
|
continue;
|
|
@@ -13890,7 +13995,7 @@ __export(exports_buildSvelteVendor, {
|
|
|
13890
13995
|
buildSvelteVendor: () => buildSvelteVendor
|
|
13891
13996
|
});
|
|
13892
13997
|
import { mkdirSync as mkdirSync10 } from "fs";
|
|
13893
|
-
import { join as
|
|
13998
|
+
import { join as join23 } from "path";
|
|
13894
13999
|
import { rm as rm8 } from "fs/promises";
|
|
13895
14000
|
var {build: bunBuild6 } = globalThis.Bun;
|
|
13896
14001
|
var svelteSpecifiers, isResolvable3 = (specifier) => {
|
|
@@ -13904,13 +14009,13 @@ var svelteSpecifiers, isResolvable3 = (specifier) => {
|
|
|
13904
14009
|
const specifiers = resolveVendorSpecifiers2();
|
|
13905
14010
|
if (specifiers.length === 0)
|
|
13906
14011
|
return;
|
|
13907
|
-
const vendorDir =
|
|
14012
|
+
const vendorDir = join23(buildDir, "svelte", "vendor");
|
|
13908
14013
|
mkdirSync10(vendorDir, { recursive: true });
|
|
13909
|
-
const tmpDir =
|
|
14014
|
+
const tmpDir = join23(buildDir, "_svelte_vendor_tmp");
|
|
13910
14015
|
mkdirSync10(tmpDir, { recursive: true });
|
|
13911
14016
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
13912
14017
|
const safeName = toSafeFileName4(specifier);
|
|
13913
|
-
const entryPath =
|
|
14018
|
+
const entryPath = join23(tmpDir, `${safeName}.ts`);
|
|
13914
14019
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
13915
14020
|
`);
|
|
13916
14021
|
return entryPath;
|
|
@@ -13960,7 +14065,7 @@ __export(exports_rewriteImportsPlugin, {
|
|
|
13960
14065
|
buildWithImportRewrite: () => buildWithImportRewrite
|
|
13961
14066
|
});
|
|
13962
14067
|
import { readdir as readdir3 } from "fs/promises";
|
|
13963
|
-
import { join as
|
|
14068
|
+
import { join as join24 } from "path";
|
|
13964
14069
|
var escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewriteImports = (content, replacements) => {
|
|
13965
14070
|
let result = content;
|
|
13966
14071
|
for (const [specifier, webPath] of replacements) {
|
|
@@ -14089,7 +14194,7 @@ ${content}`;
|
|
|
14089
14194
|
const entries = await readdir3(dir);
|
|
14090
14195
|
for (const entry of entries) {
|
|
14091
14196
|
if (entry.endsWith(".js"))
|
|
14092
|
-
allFiles.push(
|
|
14197
|
+
allFiles.push(join24(dir, entry));
|
|
14093
14198
|
}
|
|
14094
14199
|
} catch {}
|
|
14095
14200
|
}
|
|
@@ -14138,7 +14243,7 @@ import {
|
|
|
14138
14243
|
statSync,
|
|
14139
14244
|
writeFileSync as writeFileSync7
|
|
14140
14245
|
} from "fs";
|
|
14141
|
-
import { basename as basename8, dirname as
|
|
14246
|
+
import { basename as basename8, dirname as dirname14, extname as extname7, join as join25, relative as relative12, resolve as resolve22 } from "path";
|
|
14142
14247
|
import { cwd, env as env2, exit } from "process";
|
|
14143
14248
|
var {build: bunBuild7, Glob: Glob7 } = globalThis.Bun;
|
|
14144
14249
|
var isDev, isBuildTraceEnabled = () => {
|
|
@@ -14216,8 +14321,8 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
14216
14321
|
mkdirSync11(htmxDestDir, { recursive: true });
|
|
14217
14322
|
const glob = new Glob7("htmx*.min.js");
|
|
14218
14323
|
for (const relPath of glob.scanSync({ cwd: htmxDir })) {
|
|
14219
|
-
const src =
|
|
14220
|
-
const dest =
|
|
14324
|
+
const src = join25(htmxDir, relPath);
|
|
14325
|
+
const dest = join25(htmxDestDir, "htmx.min.js");
|
|
14221
14326
|
copyFileSync(src, dest);
|
|
14222
14327
|
return;
|
|
14223
14328
|
}
|
|
@@ -14229,8 +14334,8 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
14229
14334
|
}
|
|
14230
14335
|
}, resolveAbsoluteVersion = async () => {
|
|
14231
14336
|
const candidates = [
|
|
14232
|
-
|
|
14233
|
-
|
|
14337
|
+
resolve22(import.meta.dir, "..", "..", "package.json"),
|
|
14338
|
+
resolve22(import.meta.dir, "..", "package.json")
|
|
14234
14339
|
];
|
|
14235
14340
|
const resolveCandidate = async (remaining) => {
|
|
14236
14341
|
const [candidate, ...rest] = remaining;
|
|
@@ -14246,7 +14351,7 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
14246
14351
|
};
|
|
14247
14352
|
await resolveCandidate(candidates);
|
|
14248
14353
|
}, SKIP_DIRS, addWorkerPathIfExists = (file4, relPath, workerPaths) => {
|
|
14249
|
-
const absPath =
|
|
14354
|
+
const absPath = resolve22(file4, "..", relPath);
|
|
14250
14355
|
try {
|
|
14251
14356
|
statSync(absPath);
|
|
14252
14357
|
workerPaths.add(absPath);
|
|
@@ -14292,7 +14397,7 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
14292
14397
|
vuePagesPath
|
|
14293
14398
|
}) => {
|
|
14294
14399
|
const { readdirSync: readDir } = await import("fs");
|
|
14295
|
-
const devIndexDir =
|
|
14400
|
+
const devIndexDir = join25(buildPath, "_src_indexes");
|
|
14296
14401
|
mkdirSync11(devIndexDir, { recursive: true });
|
|
14297
14402
|
if (reactIndexesPath && reactPagesPath) {
|
|
14298
14403
|
copyReactDevIndexes(reactIndexesPath, reactPagesPath, devIndexDir, readDir);
|
|
@@ -14308,37 +14413,37 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
14308
14413
|
return;
|
|
14309
14414
|
}
|
|
14310
14415
|
const indexFiles = readDir(reactIndexesPath).filter((file4) => file4.endsWith(".tsx"));
|
|
14311
|
-
const pagesRel =
|
|
14416
|
+
const pagesRel = relative12(process.cwd(), resolve22(reactPagesPath)).replace(/\\/g, "/");
|
|
14312
14417
|
for (const file4 of indexFiles) {
|
|
14313
|
-
let content = readFileSync12(
|
|
14418
|
+
let content = readFileSync12(join25(reactIndexesPath, file4), "utf-8");
|
|
14314
14419
|
content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
|
|
14315
|
-
writeFileSync7(
|
|
14420
|
+
writeFileSync7(join25(devIndexDir, file4), content);
|
|
14316
14421
|
}
|
|
14317
14422
|
}, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
|
|
14318
|
-
const svelteIndexDir =
|
|
14319
|
-
const sveltePageEntries = svelteEntries.filter((file4) =>
|
|
14423
|
+
const svelteIndexDir = join25(getFrameworkGeneratedDir("svelte"), "indexes");
|
|
14424
|
+
const sveltePageEntries = svelteEntries.filter((file4) => resolve22(file4).startsWith(resolve22(sveltePagesPath)));
|
|
14320
14425
|
for (const entry of sveltePageEntries) {
|
|
14321
14426
|
const name = basename8(entry).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
14322
|
-
const indexFile =
|
|
14427
|
+
const indexFile = join25(svelteIndexDir, "pages", `${name}.js`);
|
|
14323
14428
|
if (!existsSync19(indexFile))
|
|
14324
14429
|
continue;
|
|
14325
14430
|
let content = readFileSync12(indexFile, "utf-8");
|
|
14326
|
-
const srcRel =
|
|
14431
|
+
const srcRel = relative12(process.cwd(), resolve22(entry)).replace(/\\/g, "/");
|
|
14327
14432
|
content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
|
|
14328
|
-
writeFileSync7(
|
|
14433
|
+
writeFileSync7(join25(devIndexDir, `${name}.svelte.js`), content);
|
|
14329
14434
|
}
|
|
14330
14435
|
}, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
|
|
14331
|
-
const vueIndexDir =
|
|
14332
|
-
const vuePageEntries = vueEntries.filter((file4) =>
|
|
14436
|
+
const vueIndexDir = join25(getFrameworkGeneratedDir("vue"), "indexes");
|
|
14437
|
+
const vuePageEntries = vueEntries.filter((file4) => resolve22(file4).startsWith(resolve22(vuePagesPath)));
|
|
14333
14438
|
for (const entry of vuePageEntries) {
|
|
14334
14439
|
const name = basename8(entry, ".vue");
|
|
14335
|
-
const indexFile =
|
|
14440
|
+
const indexFile = join25(vueIndexDir, `${name}.js`);
|
|
14336
14441
|
if (!existsSync19(indexFile))
|
|
14337
14442
|
continue;
|
|
14338
14443
|
let content = readFileSync12(indexFile, "utf-8");
|
|
14339
|
-
const srcRel =
|
|
14444
|
+
const srcRel = relative12(process.cwd(), resolve22(entry)).replace(/\\/g, "/");
|
|
14340
14445
|
content = content.replace(/import\s+Comp(?:\s*,\s*\*\s+as\s+\w+)?\s+from\s+['"]([^'"]+)['"]/, (match) => match.replace(/from\s+['"][^'"]+['"]/, `from "/@src/${srcRel}"`));
|
|
14341
|
-
writeFileSync7(
|
|
14446
|
+
writeFileSync7(join25(devIndexDir, `${name}.vue.js`), content);
|
|
14342
14447
|
}
|
|
14343
14448
|
}, resolveVueRuntimeId = (content, firstUseName, outputPath, projectRoot) => {
|
|
14344
14449
|
const varIdx = content.indexOf(`var ${firstUseName} =`);
|
|
@@ -14349,7 +14454,7 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
14349
14454
|
const last = allComments[allComments.length - 1];
|
|
14350
14455
|
if (!last?.[1])
|
|
14351
14456
|
return JSON.stringify(outputPath);
|
|
14352
|
-
const srcPath =
|
|
14457
|
+
const srcPath = resolve22(projectRoot, last[1].replace("/client/", "/").replace(/\.js$/, ".ts"));
|
|
14353
14458
|
return JSON.stringify(srcPath);
|
|
14354
14459
|
}, QUOTE_CHARS, OPEN_BRACES, CLOSE_BRACES, findFunctionExpressionEnd = (content, startPos) => {
|
|
14355
14460
|
let depth = 0;
|
|
@@ -14411,7 +14516,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14411
14516
|
}, buildDevUrlFileMap = (urlReferencedFiles, projectRoot) => {
|
|
14412
14517
|
const urlFileMap = new Map;
|
|
14413
14518
|
for (const srcPath of urlReferencedFiles) {
|
|
14414
|
-
const rel =
|
|
14519
|
+
const rel = relative12(projectRoot, srcPath).replace(/\\/g, "/");
|
|
14415
14520
|
const name = basename8(srcPath);
|
|
14416
14521
|
const mtime = Math.round(statSync(srcPath).mtimeMs);
|
|
14417
14522
|
const url = `/@src/${rel}?v=${mtime}`;
|
|
@@ -14426,7 +14531,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14426
14531
|
const output = nonReactClientOutputs.find((artifact) => basename8(artifact.path).startsWith(`${srcBase}.`));
|
|
14427
14532
|
if (!output)
|
|
14428
14533
|
continue;
|
|
14429
|
-
urlFileMap.set(basename8(srcPath), `/${
|
|
14534
|
+
urlFileMap.set(basename8(srcPath), `/${relative12(buildPath, output.path).replace(/\\/g, "/")}`);
|
|
14430
14535
|
}
|
|
14431
14536
|
return urlFileMap;
|
|
14432
14537
|
}, buildUrlFileMap = (urlReferencedFiles, hmr, projectRoot, buildPath, nonReactClientOutputs) => {
|
|
@@ -14560,10 +14665,10 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14560
14665
|
restoreTracePhase();
|
|
14561
14666
|
return;
|
|
14562
14667
|
}
|
|
14563
|
-
const traceDir =
|
|
14668
|
+
const traceDir = join25(buildPath2, ".absolute-trace");
|
|
14564
14669
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
14565
14670
|
mkdirSync11(traceDir, { recursive: true });
|
|
14566
|
-
writeFileSync7(
|
|
14671
|
+
writeFileSync7(join25(traceDir, `build-trace-${timestamp}.json`), JSON.stringify({
|
|
14567
14672
|
events: traceEvents,
|
|
14568
14673
|
frameworks: traceFrameworkNames,
|
|
14569
14674
|
generatedAt: new Date().toISOString(),
|
|
@@ -14594,15 +14699,15 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14594
14699
|
const stylesPath = typeof stylesConfig === "string" ? stylesConfig : stylesConfig?.path;
|
|
14595
14700
|
const stylesIgnore = typeof stylesConfig === "object" ? stylesConfig.ignore : undefined;
|
|
14596
14701
|
const stylesDir = stylesPath && validateSafePath(stylesPath, projectRoot);
|
|
14597
|
-
const reactIndexesPath = reactDir &&
|
|
14598
|
-
const reactPagesPath = reactDir &&
|
|
14599
|
-
const htmlPagesPath = htmlDir &&
|
|
14600
|
-
const htmlScriptsPath = htmlDir &&
|
|
14601
|
-
const sveltePagesPath = svelteDir &&
|
|
14602
|
-
const vuePagesPath = vueDir &&
|
|
14603
|
-
const htmxPagesPath = htmxDir &&
|
|
14604
|
-
const angularPagesPath = angularDir &&
|
|
14605
|
-
const emberPagesPath = emberDir &&
|
|
14702
|
+
const reactIndexesPath = reactDir && join25(getFrameworkGeneratedDir("react"), "indexes");
|
|
14703
|
+
const reactPagesPath = reactDir && join25(reactDir, "pages");
|
|
14704
|
+
const htmlPagesPath = htmlDir && join25(htmlDir, "pages");
|
|
14705
|
+
const htmlScriptsPath = htmlDir && join25(htmlDir, "scripts");
|
|
14706
|
+
const sveltePagesPath = svelteDir && join25(svelteDir, "pages");
|
|
14707
|
+
const vuePagesPath = vueDir && join25(vueDir, "pages");
|
|
14708
|
+
const htmxPagesPath = htmxDir && join25(htmxDir, "pages");
|
|
14709
|
+
const angularPagesPath = angularDir && join25(angularDir, "pages");
|
|
14710
|
+
const emberPagesPath = emberDir && join25(emberDir, "pages");
|
|
14606
14711
|
const frontends = [
|
|
14607
14712
|
reactDir,
|
|
14608
14713
|
htmlDir,
|
|
@@ -14633,7 +14738,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14633
14738
|
const sourceClientRoots = [
|
|
14634
14739
|
htmlDir,
|
|
14635
14740
|
htmxDir,
|
|
14636
|
-
islandBootstrapPath &&
|
|
14741
|
+
islandBootstrapPath && dirname14(islandBootstrapPath)
|
|
14637
14742
|
].filter((dir) => Boolean(dir));
|
|
14638
14743
|
const usesGenerated = Boolean(reactDir) || Boolean(svelteDir) || Boolean(vueDir) || Boolean(angularDir);
|
|
14639
14744
|
if (usesGenerated)
|
|
@@ -14661,8 +14766,8 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14661
14766
|
const [firstEntry] = serverDirMap;
|
|
14662
14767
|
if (!firstEntry)
|
|
14663
14768
|
throw new Error("Expected at least one server directory entry");
|
|
14664
|
-
serverRoot =
|
|
14665
|
-
serverOutDir =
|
|
14769
|
+
serverRoot = join25(firstEntry.dir, firstEntry.subdir);
|
|
14770
|
+
serverOutDir = join25(buildPath, basename8(firstEntry.dir));
|
|
14666
14771
|
} else if (serverDirMap.length > 1) {
|
|
14667
14772
|
serverRoot = commonAncestor(serverDirMap.map((entry) => entry.dir), projectRoot);
|
|
14668
14773
|
serverOutDir = buildPath;
|
|
@@ -14674,13 +14779,13 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14674
14779
|
const filterToIncrementalEntries = (entryPoints, mapToSource) => {
|
|
14675
14780
|
if (!isIncremental || !incrementalFiles)
|
|
14676
14781
|
return entryPoints;
|
|
14677
|
-
const normalizedIncremental = new Set(incrementalFiles.map((f2) =>
|
|
14782
|
+
const normalizedIncremental = new Set(incrementalFiles.map((f2) => resolve22(f2)));
|
|
14678
14783
|
const matchingEntries = [];
|
|
14679
14784
|
for (const entry of entryPoints) {
|
|
14680
14785
|
const sourceFile = mapToSource(entry);
|
|
14681
14786
|
if (!sourceFile)
|
|
14682
14787
|
continue;
|
|
14683
|
-
if (!normalizedIncremental.has(
|
|
14788
|
+
if (!normalizedIncremental.has(resolve22(sourceFile)))
|
|
14684
14789
|
continue;
|
|
14685
14790
|
matchingEntries.push(entry);
|
|
14686
14791
|
}
|
|
@@ -14690,7 +14795,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14690
14795
|
await tracePhase("react/index-generation", () => generateReactIndexFiles(reactPagesPath, reactIndexesPath, hmr));
|
|
14691
14796
|
}
|
|
14692
14797
|
if (assetsPath && (!isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/assets/")))) {
|
|
14693
|
-
await tracePhase("assets/copy", () => cpSync(assetsPath,
|
|
14798
|
+
await tracePhase("assets/copy", () => cpSync(assetsPath, join25(buildPath, "assets"), {
|
|
14694
14799
|
force: true,
|
|
14695
14800
|
recursive: true
|
|
14696
14801
|
}));
|
|
@@ -14742,9 +14847,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14742
14847
|
}
|
|
14743
14848
|
const shouldIncludeHtmlAssets = !isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/html/") && (f2.endsWith(".html") || isStylePath(f2)));
|
|
14744
14849
|
const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
|
|
14745
|
-
if (entry.startsWith(
|
|
14850
|
+
if (entry.startsWith(resolve22(reactIndexesPath))) {
|
|
14746
14851
|
const pageName = basename8(entry, ".tsx");
|
|
14747
|
-
return
|
|
14852
|
+
return join25(reactPagesPath, `${pageName}.tsx`);
|
|
14748
14853
|
}
|
|
14749
14854
|
return null;
|
|
14750
14855
|
}) : allReactEntries;
|
|
@@ -14821,7 +14926,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14821
14926
|
const clientPath = islandSvelteClientPaths[idx];
|
|
14822
14927
|
if (!sourcePath || !clientPath)
|
|
14823
14928
|
continue;
|
|
14824
|
-
islandSvelteClientPathMap.set(
|
|
14929
|
+
islandSvelteClientPathMap.set(resolve22(sourcePath), clientPath);
|
|
14825
14930
|
}
|
|
14826
14931
|
const islandVueClientPathMap = new Map;
|
|
14827
14932
|
for (let idx = 0;idx < islandVueSources.length; idx++) {
|
|
@@ -14829,7 +14934,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14829
14934
|
const clientPath = islandVueClientPaths[idx];
|
|
14830
14935
|
if (!sourcePath || !clientPath)
|
|
14831
14936
|
continue;
|
|
14832
|
-
islandVueClientPathMap.set(
|
|
14937
|
+
islandVueClientPathMap.set(resolve22(sourcePath), clientPath);
|
|
14833
14938
|
}
|
|
14834
14939
|
const islandAngularClientPathMap = new Map;
|
|
14835
14940
|
for (let idx = 0;idx < islandAngularSources.length; idx++) {
|
|
@@ -14837,7 +14942,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14837
14942
|
const clientPath = islandAngularClientPaths[idx];
|
|
14838
14943
|
if (!sourcePath || !clientPath)
|
|
14839
14944
|
continue;
|
|
14840
|
-
islandAngularClientPathMap.set(
|
|
14945
|
+
islandAngularClientPathMap.set(resolve22(sourcePath), clientPath);
|
|
14841
14946
|
}
|
|
14842
14947
|
const reactConventionSources = collectConventionSourceFiles(conventionsMap.react);
|
|
14843
14948
|
const svelteConventionSources = collectConventionSourceFiles(conventionsMap.svelte);
|
|
@@ -14848,7 +14953,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14848
14953
|
const compileReactConventions = async () => {
|
|
14849
14954
|
if (reactConventionSources.length === 0)
|
|
14850
14955
|
return emptyStringArray;
|
|
14851
|
-
const destDir =
|
|
14956
|
+
const destDir = join25(buildPath, "conventions", "react");
|
|
14852
14957
|
rmSync2(destDir, { force: true, recursive: true });
|
|
14853
14958
|
mkdirSync11(destDir, { recursive: true });
|
|
14854
14959
|
const destPaths = [];
|
|
@@ -14864,7 +14969,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14864
14969
|
naming: `${idx}-[name].[ext]`,
|
|
14865
14970
|
outdir: destDir,
|
|
14866
14971
|
plugins: [stylePreprocessorPlugin2],
|
|
14867
|
-
root:
|
|
14972
|
+
root: dirname14(source),
|
|
14868
14973
|
target: "bun",
|
|
14869
14974
|
throw: false,
|
|
14870
14975
|
tsconfig: "./tsconfig.json"
|
|
@@ -14892,7 +14997,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14892
14997
|
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 }
|
|
14893
14998
|
]);
|
|
14894
14999
|
const bundleConventionFiles = async (framework, compiledPaths) => {
|
|
14895
|
-
const destDir =
|
|
15000
|
+
const destDir = join25(buildPath, "conventions", framework);
|
|
14896
15001
|
rmSync2(destDir, { force: true, recursive: true });
|
|
14897
15002
|
mkdirSync11(destDir, { recursive: true });
|
|
14898
15003
|
const destPaths = [];
|
|
@@ -14966,7 +15071,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14966
15071
|
}
|
|
14967
15072
|
})) : {
|
|
14968
15073
|
entries: [],
|
|
14969
|
-
generatedRoot:
|
|
15074
|
+
generatedRoot: join25(buildPath, "_island_entries")
|
|
14970
15075
|
};
|
|
14971
15076
|
const islandClientEntryPoints = islandEntryResult.entries.map((entry) => entry.entryPath);
|
|
14972
15077
|
if (serverEntryPoints.length === 0 && reactClientEntryPoints.length === 0 && nonReactClientEntryPoints.length === 0 && islandClientEntryPoints.length === 0 && htmxDir === undefined && htmlDir === undefined) {
|
|
@@ -15002,7 +15107,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15002
15107
|
return {};
|
|
15003
15108
|
}
|
|
15004
15109
|
if (hmr && reactIndexesPath && reactClientEntryPoints.length > 0) {
|
|
15005
|
-
const refreshEntry =
|
|
15110
|
+
const refreshEntry = join25(reactIndexesPath, "_refresh.tsx");
|
|
15006
15111
|
if (!reactClientEntryPoints.includes(refreshEntry))
|
|
15007
15112
|
reactClientEntryPoints.push(refreshEntry);
|
|
15008
15113
|
}
|
|
@@ -15101,19 +15206,19 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15101
15206
|
throw: false
|
|
15102
15207
|
}, resolveBunBuildOverride(bunBuildConfig, "reactClient")) : undefined;
|
|
15103
15208
|
if (reactDir && reactClientEntryPoints.length > 0) {
|
|
15104
|
-
rmSync2(
|
|
15209
|
+
rmSync2(join25(buildPath, "react", "generated", "indexes"), {
|
|
15105
15210
|
force: true,
|
|
15106
15211
|
recursive: true
|
|
15107
15212
|
});
|
|
15108
15213
|
}
|
|
15109
15214
|
if (angularDir && angularClientPaths.length > 0) {
|
|
15110
|
-
rmSync2(
|
|
15215
|
+
rmSync2(join25(buildPath, "angular", "indexes"), {
|
|
15111
15216
|
force: true,
|
|
15112
15217
|
recursive: true
|
|
15113
15218
|
});
|
|
15114
15219
|
}
|
|
15115
15220
|
if (islandClientEntryPoints.length > 0) {
|
|
15116
|
-
rmSync2(
|
|
15221
|
+
rmSync2(join25(buildPath, "islands"), {
|
|
15117
15222
|
force: true,
|
|
15118
15223
|
recursive: true
|
|
15119
15224
|
});
|
|
@@ -15196,7 +15301,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15196
15301
|
globalCssEntries.length > 0 ? tracePhase("bun/global-css", () => bunBuild7(mergeBunBuildConfig({
|
|
15197
15302
|
entrypoints: globalCssEntries,
|
|
15198
15303
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
15199
|
-
outdir: stylesDir ?
|
|
15304
|
+
outdir: stylesDir ? join25(buildPath, basename8(stylesDir)) : buildPath,
|
|
15200
15305
|
plugins: [stylePreprocessorPlugin2],
|
|
15201
15306
|
root: stylesDir || clientRoot,
|
|
15202
15307
|
target: "browser",
|
|
@@ -15205,7 +15310,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15205
15310
|
vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () => bunBuild7(mergeBunBuildConfig({
|
|
15206
15311
|
entrypoints: vueCssPaths,
|
|
15207
15312
|
naming: `[name].[hash].[ext]`,
|
|
15208
|
-
outdir:
|
|
15313
|
+
outdir: join25(buildPath, assetsPath ? basename8(assetsPath) : "assets", "css"),
|
|
15209
15314
|
target: "browser",
|
|
15210
15315
|
throw: false
|
|
15211
15316
|
}, resolveBunBuildOverride(bunBuildConfig, "vueCss")))) : undefined
|
|
@@ -15272,10 +15377,10 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15272
15377
|
if (serverOutputs.length > 0 && angularServerVendorPaths2 && Object.keys(angularServerVendorPaths2).length > 0) {
|
|
15273
15378
|
const { rewriteBuildOutputsWith: rewriteBuildOutputsWith2 } = await Promise.resolve().then(() => (init_rewriteImportsPlugin(), exports_rewriteImportsPlugin));
|
|
15274
15379
|
await tracePhase("postprocess/server-angular-vendor-imports", () => rewriteBuildOutputsWith2(serverOutputs, (artifact) => {
|
|
15275
|
-
const fileDir =
|
|
15380
|
+
const fileDir = dirname14(artifact.path);
|
|
15276
15381
|
const relativePaths = {};
|
|
15277
15382
|
for (const [specifier, absolute] of Object.entries(angularServerVendorPaths2)) {
|
|
15278
|
-
const rel =
|
|
15383
|
+
const rel = relative12(fileDir, absolute);
|
|
15279
15384
|
relativePaths[specifier] = rel.startsWith(".") ? rel : `./${rel}`;
|
|
15280
15385
|
}
|
|
15281
15386
|
return relativePaths;
|
|
@@ -15344,7 +15449,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15344
15449
|
if (skipAngularClientBundle) {
|
|
15345
15450
|
for (const clientPath of angularClientPaths) {
|
|
15346
15451
|
const fileBase = basename8(clientPath, ".js");
|
|
15347
|
-
const relFromCwd =
|
|
15452
|
+
const relFromCwd = relative12(projectRoot, clientPath).replace(/\\/g, "/");
|
|
15348
15453
|
manifest[`${toPascal(fileBase)}Index`] = `/@src/${relFromCwd}`;
|
|
15349
15454
|
}
|
|
15350
15455
|
}
|
|
@@ -15366,7 +15471,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15366
15471
|
const processHtmlPages = async () => {
|
|
15367
15472
|
if (!(htmlDir && htmlPagesPath))
|
|
15368
15473
|
return;
|
|
15369
|
-
const outputHtmlPages = isSingle ?
|
|
15474
|
+
const outputHtmlPages = isSingle ? join25(buildPath, "pages") : join25(buildPath, basename8(htmlDir), "pages");
|
|
15370
15475
|
mkdirSync11(outputHtmlPages, { recursive: true });
|
|
15371
15476
|
cpSync(htmlPagesPath, outputHtmlPages, {
|
|
15372
15477
|
force: true,
|
|
@@ -15388,14 +15493,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15388
15493
|
const processHtmxPages = async () => {
|
|
15389
15494
|
if (!(htmxDir && htmxPagesPath))
|
|
15390
15495
|
return;
|
|
15391
|
-
const outputHtmxPages = isSingle ?
|
|
15496
|
+
const outputHtmxPages = isSingle ? join25(buildPath, "pages") : join25(buildPath, basename8(htmxDir), "pages");
|
|
15392
15497
|
mkdirSync11(outputHtmxPages, { recursive: true });
|
|
15393
15498
|
cpSync(htmxPagesPath, outputHtmxPages, {
|
|
15394
15499
|
force: true,
|
|
15395
15500
|
recursive: true
|
|
15396
15501
|
});
|
|
15397
15502
|
if (shouldCopyHtmx) {
|
|
15398
|
-
const htmxDestDir = isSingle ? buildPath :
|
|
15503
|
+
const htmxDestDir = isSingle ? buildPath : join25(buildPath, basename8(htmxDir));
|
|
15399
15504
|
copyHtmxVendor(htmxDir, htmxDestDir);
|
|
15400
15505
|
}
|
|
15401
15506
|
if (shouldUpdateHtmxAssetPaths) {
|
|
@@ -15457,9 +15562,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15457
15562
|
writeBuildTrace(buildPath);
|
|
15458
15563
|
return { conventions: conventionsMap, manifest };
|
|
15459
15564
|
}
|
|
15460
|
-
writeFileSync7(
|
|
15565
|
+
writeFileSync7(join25(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
|
|
15461
15566
|
if (Object.keys(conventionsMap).length > 0) {
|
|
15462
|
-
writeFileSync7(
|
|
15567
|
+
writeFileSync7(join25(buildPath, "conventions.json"), JSON.stringify(conventionsMap, null, "\t"));
|
|
15463
15568
|
}
|
|
15464
15569
|
writeBuildTrace(buildPath);
|
|
15465
15570
|
if (tailwind && mode === "production") {
|
|
@@ -15560,7 +15665,7 @@ var init_build = __esm(() => {
|
|
|
15560
15665
|
|
|
15561
15666
|
// src/build/buildEmberVendor.ts
|
|
15562
15667
|
import { mkdirSync as mkdirSync12, existsSync as existsSync20 } from "fs";
|
|
15563
|
-
import { join as
|
|
15668
|
+
import { join as join26 } from "path";
|
|
15564
15669
|
import { rm as rm9 } from "fs/promises";
|
|
15565
15670
|
var {build: bunBuild8 } = globalThis.Bun;
|
|
15566
15671
|
var toSafeFileName5 = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_"), generateMacrosShim = () => `// Generated shim for @embroider/macros \u2014 provides minimal runtime
|
|
@@ -15612,7 +15717,7 @@ export const importSync = (specifier) => {
|
|
|
15612
15717
|
if (standaloneSpecifiers.has(specifier)) {
|
|
15613
15718
|
return { resolveTo: specifier, specifier };
|
|
15614
15719
|
}
|
|
15615
|
-
const emberInternalPath =
|
|
15720
|
+
const emberInternalPath = join26(cwd2, "node_modules/ember-source/dist/packages", specifier, "index.js");
|
|
15616
15721
|
if (!existsSync20(emberInternalPath)) {
|
|
15617
15722
|
throw new Error(`Ember vendor build: cannot find ${specifier} at ${emberInternalPath}. ` + `Is ember-source installed and at least 6.12?`);
|
|
15618
15723
|
}
|
|
@@ -15644,7 +15749,7 @@ export const importSync = (specifier) => {
|
|
|
15644
15749
|
if (standalonePackages.has(args.path)) {
|
|
15645
15750
|
return;
|
|
15646
15751
|
}
|
|
15647
|
-
const internal =
|
|
15752
|
+
const internal = join26(cwd2, "node_modules/ember-source/dist/packages", args.path, "index.js");
|
|
15648
15753
|
if (existsSync20(internal)) {
|
|
15649
15754
|
return { path: internal };
|
|
15650
15755
|
}
|
|
@@ -15652,16 +15757,16 @@ export const importSync = (specifier) => {
|
|
|
15652
15757
|
});
|
|
15653
15758
|
}
|
|
15654
15759
|
}), buildEmberVendor = async (buildDir, cwd2 = process.cwd()) => {
|
|
15655
|
-
const vendorDir =
|
|
15760
|
+
const vendorDir = join26(buildDir, "ember", "vendor");
|
|
15656
15761
|
mkdirSync12(vendorDir, { recursive: true });
|
|
15657
|
-
const tmpDir =
|
|
15762
|
+
const tmpDir = join26(buildDir, "_ember_vendor_tmp");
|
|
15658
15763
|
mkdirSync12(tmpDir, { recursive: true });
|
|
15659
|
-
const macrosShimPath =
|
|
15764
|
+
const macrosShimPath = join26(tmpDir, "embroider_macros_shim.js");
|
|
15660
15765
|
await Bun.write(macrosShimPath, generateMacrosShim());
|
|
15661
15766
|
const resolutions = REQUIRED_EMBER_SPECIFIERS.map((specifier) => resolveEmberSpecifier(specifier, cwd2));
|
|
15662
15767
|
const entrypoints = await Promise.all(resolutions.map(async (resolution) => {
|
|
15663
15768
|
const safeName = toSafeFileName5(resolution.specifier);
|
|
15664
|
-
const entryPath =
|
|
15769
|
+
const entryPath = join26(tmpDir, `${safeName}.js`);
|
|
15665
15770
|
const source = resolution.specifier === "@embroider/macros" ? `export * from ${JSON.stringify(macrosShimPath)};
|
|
15666
15771
|
` : generateVendorEntrySource2(resolution);
|
|
15667
15772
|
await Bun.write(entryPath, source);
|
|
@@ -15707,7 +15812,7 @@ var init_buildEmberVendor = __esm(() => {
|
|
|
15707
15812
|
// src/dev/dependencyGraph.ts
|
|
15708
15813
|
import { existsSync as existsSync21, readFileSync as readFileSync13 } from "fs";
|
|
15709
15814
|
var {Glob: Glob8 } = globalThis.Bun;
|
|
15710
|
-
import { resolve as
|
|
15815
|
+
import { resolve as resolve23 } from "path";
|
|
15711
15816
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
15712
15817
|
const lower = filePath.toLowerCase();
|
|
15713
15818
|
if (lower.endsWith(".ts") || lower.endsWith(".tsx") || lower.endsWith(".jsx"))
|
|
@@ -15721,8 +15826,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15721
15826
|
if (!importPath.startsWith(".") && !importPath.startsWith("/")) {
|
|
15722
15827
|
return null;
|
|
15723
15828
|
}
|
|
15724
|
-
const fromDir =
|
|
15725
|
-
const normalized =
|
|
15829
|
+
const fromDir = resolve23(fromFile, "..");
|
|
15830
|
+
const normalized = resolve23(fromDir, importPath);
|
|
15726
15831
|
const extensions = [
|
|
15727
15832
|
".ts",
|
|
15728
15833
|
".tsx",
|
|
@@ -15752,7 +15857,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15752
15857
|
dependents.delete(normalizedPath);
|
|
15753
15858
|
}
|
|
15754
15859
|
}, addFileToGraph = (graph, filePath) => {
|
|
15755
|
-
const normalizedPath =
|
|
15860
|
+
const normalizedPath = resolve23(filePath);
|
|
15756
15861
|
if (!existsSync21(normalizedPath))
|
|
15757
15862
|
return;
|
|
15758
15863
|
const dependencies = extractDependencies(normalizedPath);
|
|
@@ -15769,10 +15874,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15769
15874
|
}, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
|
|
15770
15875
|
const processedFiles = new Set;
|
|
15771
15876
|
const glob = new Glob8("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
|
|
15772
|
-
const resolvedDirs = directories.map((dir) =>
|
|
15877
|
+
const resolvedDirs = directories.map((dir) => resolve23(dir)).filter((dir) => existsSync21(dir));
|
|
15773
15878
|
const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
|
|
15774
15879
|
for (const file4 of allFiles) {
|
|
15775
|
-
const fullPath =
|
|
15880
|
+
const fullPath = resolve23(file4);
|
|
15776
15881
|
if (IGNORED_SEGMENTS.some((seg) => fullPath.includes(seg)))
|
|
15777
15882
|
continue;
|
|
15778
15883
|
if (processedFiles.has(fullPath))
|
|
@@ -15827,8 +15932,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15827
15932
|
resolveRegexMatches(styleUrlSingularRegex, content, filePath, dependencies);
|
|
15828
15933
|
extractStyleUrlsDependencies(content, filePath, dependencies);
|
|
15829
15934
|
}, extractJsDependencies = (filePath, content, loader) => {
|
|
15830
|
-
const
|
|
15831
|
-
const imports =
|
|
15935
|
+
const transpiler6 = loader === "tsx" ? tsTranspiler : jsTranspiler;
|
|
15936
|
+
const imports = transpiler6.scanImports(content);
|
|
15832
15937
|
const dependencies = [];
|
|
15833
15938
|
for (const imp of imports) {
|
|
15834
15939
|
const resolved = resolveImportPath2(imp.path, filePath);
|
|
@@ -15885,7 +15990,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15885
15990
|
return [];
|
|
15886
15991
|
}
|
|
15887
15992
|
}, getAffectedFiles = (graph, changedFile) => {
|
|
15888
|
-
const normalizedPath =
|
|
15993
|
+
const normalizedPath = resolve23(changedFile);
|
|
15889
15994
|
const affected = new Set;
|
|
15890
15995
|
const toProcess = [normalizedPath];
|
|
15891
15996
|
const processNode = (current) => {
|
|
@@ -15925,7 +16030,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15925
16030
|
}
|
|
15926
16031
|
graph.dependents.delete(normalizedPath);
|
|
15927
16032
|
}, removeFileFromGraph = (graph, filePath) => {
|
|
15928
|
-
const normalizedPath =
|
|
16033
|
+
const normalizedPath = resolve23(filePath);
|
|
15929
16034
|
removeDepsForFile(graph, normalizedPath);
|
|
15930
16035
|
removeDependentsForFile(graph, normalizedPath);
|
|
15931
16036
|
};
|
|
@@ -15968,12 +16073,12 @@ var globalVersionCounter = 0, createModuleVersionTracker = () => new Map, getNex
|
|
|
15968
16073
|
};
|
|
15969
16074
|
|
|
15970
16075
|
// src/dev/configResolver.ts
|
|
15971
|
-
import { resolve as
|
|
16076
|
+
import { resolve as resolve24 } from "path";
|
|
15972
16077
|
var resolveBuildPaths = (config) => {
|
|
15973
16078
|
const cwd2 = process.cwd();
|
|
15974
16079
|
const normalize = (path) => path.replace(/\\/g, "/");
|
|
15975
|
-
const withDefault = (value, fallback) => normalize(
|
|
15976
|
-
const optional = (value) => value ? normalize(
|
|
16080
|
+
const withDefault = (value, fallback) => normalize(resolve24(cwd2, value ?? fallback));
|
|
16081
|
+
const optional = (value) => value ? normalize(resolve24(cwd2, value)) : undefined;
|
|
15977
16082
|
return {
|
|
15978
16083
|
angularDir: optional(config.angularDirectory),
|
|
15979
16084
|
assetsDir: optional(config.assetsDirectory),
|
|
@@ -16026,7 +16131,7 @@ var init_clientManager = __esm(() => {
|
|
|
16026
16131
|
|
|
16027
16132
|
// src/dev/pathUtils.ts
|
|
16028
16133
|
import { existsSync as existsSync22, readdirSync, readFileSync as readFileSync14 } from "fs";
|
|
16029
|
-
import { dirname as
|
|
16134
|
+
import { dirname as dirname15, resolve as resolve25 } from "path";
|
|
16030
16135
|
var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
16031
16136
|
if (shouldIgnorePath(filePath, resolved)) {
|
|
16032
16137
|
return "ignored";
|
|
@@ -16102,7 +16207,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
16102
16207
|
return "unknown";
|
|
16103
16208
|
}, collectAngularResourceDirs = (angularDir) => {
|
|
16104
16209
|
const out = new Set;
|
|
16105
|
-
const angularRoot =
|
|
16210
|
+
const angularRoot = resolve25(angularDir);
|
|
16106
16211
|
const angularRootNormalized = normalizePath(angularRoot);
|
|
16107
16212
|
const walk = (dir) => {
|
|
16108
16213
|
let entries;
|
|
@@ -16115,7 +16220,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
16115
16220
|
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
16116
16221
|
continue;
|
|
16117
16222
|
}
|
|
16118
|
-
const full =
|
|
16223
|
+
const full = resolve25(dir, entry.name);
|
|
16119
16224
|
if (entry.isDirectory()) {
|
|
16120
16225
|
walk(full);
|
|
16121
16226
|
continue;
|
|
@@ -16154,10 +16259,10 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
16154
16259
|
refs.push(strMatch[1]);
|
|
16155
16260
|
}
|
|
16156
16261
|
}
|
|
16157
|
-
const componentDir =
|
|
16262
|
+
const componentDir = dirname15(full);
|
|
16158
16263
|
for (const ref of refs) {
|
|
16159
|
-
const refAbs = normalizePath(
|
|
16160
|
-
const refDir = normalizePath(
|
|
16264
|
+
const refAbs = normalizePath(resolve25(componentDir, ref));
|
|
16265
|
+
const refDir = normalizePath(dirname15(refAbs));
|
|
16161
16266
|
if (refDir === angularRootNormalized || refDir.startsWith(angularRootNormalized + "/")) {
|
|
16162
16267
|
continue;
|
|
16163
16268
|
}
|
|
@@ -16173,7 +16278,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
16173
16278
|
const push = (path) => {
|
|
16174
16279
|
if (!path)
|
|
16175
16280
|
return;
|
|
16176
|
-
const abs = normalizePath(
|
|
16281
|
+
const abs = normalizePath(resolve25(cwd2, path));
|
|
16177
16282
|
if (!roots.includes(abs))
|
|
16178
16283
|
roots.push(abs);
|
|
16179
16284
|
};
|
|
@@ -16198,7 +16303,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
16198
16303
|
push(cfg.assetsDir);
|
|
16199
16304
|
push(cfg.stylesDir);
|
|
16200
16305
|
for (const candidate of ["src", "db", "assets", "styles"]) {
|
|
16201
|
-
const abs = normalizePath(
|
|
16306
|
+
const abs = normalizePath(resolve25(cwd2, candidate));
|
|
16202
16307
|
if (existsSync22(abs) && !roots.includes(abs))
|
|
16203
16308
|
roots.push(abs);
|
|
16204
16309
|
}
|
|
@@ -16269,7 +16374,7 @@ var init_pathUtils = __esm(() => {
|
|
|
16269
16374
|
// src/dev/fileWatcher.ts
|
|
16270
16375
|
import { watch } from "fs";
|
|
16271
16376
|
import { existsSync as existsSync23 } from "fs";
|
|
16272
|
-
import { join as
|
|
16377
|
+
import { join as join27, resolve as resolve26 } from "path";
|
|
16273
16378
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
16274
16379
|
try {
|
|
16275
16380
|
removeFileFromGraph(graph, fullPath);
|
|
@@ -16296,7 +16401,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
16296
16401
|
if (shouldSkipFilename(filename, isStylesDir)) {
|
|
16297
16402
|
return;
|
|
16298
16403
|
}
|
|
16299
|
-
const fullPath =
|
|
16404
|
+
const fullPath = join27(absolutePath, filename).replace(/\\/g, "/");
|
|
16300
16405
|
if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
|
|
16301
16406
|
return;
|
|
16302
16407
|
}
|
|
@@ -16314,7 +16419,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
16314
16419
|
}, addFileWatchers = (state, paths, onFileChange) => {
|
|
16315
16420
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
16316
16421
|
paths.forEach((path) => {
|
|
16317
|
-
const absolutePath =
|
|
16422
|
+
const absolutePath = resolve26(path).replace(/\\/g, "/");
|
|
16318
16423
|
if (!existsSync23(absolutePath)) {
|
|
16319
16424
|
return;
|
|
16320
16425
|
}
|
|
@@ -16325,7 +16430,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
16325
16430
|
const watchPaths = getWatchPaths(config, state.resolvedPaths);
|
|
16326
16431
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
16327
16432
|
watchPaths.forEach((path) => {
|
|
16328
|
-
const absolutePath =
|
|
16433
|
+
const absolutePath = resolve26(path).replace(/\\/g, "/");
|
|
16329
16434
|
if (!existsSync23(absolutePath)) {
|
|
16330
16435
|
return;
|
|
16331
16436
|
}
|
|
@@ -16340,13 +16445,13 @@ var init_fileWatcher = __esm(() => {
|
|
|
16340
16445
|
});
|
|
16341
16446
|
|
|
16342
16447
|
// src/dev/assetStore.ts
|
|
16343
|
-
import { resolve as
|
|
16448
|
+
import { resolve as resolve27 } from "path";
|
|
16344
16449
|
import { readdir as readdir4, unlink } from "fs/promises";
|
|
16345
16450
|
var mimeTypes, getMimeType = (filePath) => {
|
|
16346
16451
|
const ext = filePath.slice(filePath.lastIndexOf("."));
|
|
16347
16452
|
return mimeTypes[ext] ?? "application/octet-stream";
|
|
16348
16453
|
}, HASHED_FILE_RE, stripHash = (webPath) => webPath.replace(/\.[a-z0-9]{8}(\.(js|css|mjs))$/, "$1"), processWalkEntry = (entry, dir, liveByIdentity, walkAndClean) => {
|
|
16349
|
-
const fullPath =
|
|
16454
|
+
const fullPath = resolve27(dir, entry.name);
|
|
16350
16455
|
if (entry.isDirectory()) {
|
|
16351
16456
|
return walkAndClean(fullPath);
|
|
16352
16457
|
}
|
|
@@ -16362,10 +16467,10 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
16362
16467
|
}, cleanStaleAssets = async (store, manifest, buildDir) => {
|
|
16363
16468
|
const liveByIdentity = new Map;
|
|
16364
16469
|
for (const webPath of store.keys()) {
|
|
16365
|
-
const diskPath =
|
|
16470
|
+
const diskPath = resolve27(buildDir, webPath.slice(1));
|
|
16366
16471
|
liveByIdentity.set(stripHash(diskPath), diskPath);
|
|
16367
16472
|
}
|
|
16368
|
-
const absBuildDir =
|
|
16473
|
+
const absBuildDir = resolve27(buildDir);
|
|
16369
16474
|
Object.values(manifest).forEach((val) => {
|
|
16370
16475
|
if (!HASHED_FILE_RE.test(val))
|
|
16371
16476
|
return;
|
|
@@ -16383,7 +16488,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
16383
16488
|
} catch {}
|
|
16384
16489
|
}, lookupAsset = (store, path) => store.get(path), processScanEntry = (entry, dir, prefix, store, scanDir) => {
|
|
16385
16490
|
if (entry.isDirectory()) {
|
|
16386
|
-
return scanDir(
|
|
16491
|
+
return scanDir(resolve27(dir, entry.name), `${prefix}${entry.name}/`);
|
|
16387
16492
|
}
|
|
16388
16493
|
if (!entry.name.startsWith("chunk-")) {
|
|
16389
16494
|
return null;
|
|
@@ -16392,7 +16497,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
16392
16497
|
if (store.has(webPath)) {
|
|
16393
16498
|
return null;
|
|
16394
16499
|
}
|
|
16395
|
-
return Bun.file(
|
|
16500
|
+
return Bun.file(resolve27(dir, entry.name)).bytes().then((bytes) => {
|
|
16396
16501
|
store.set(webPath, bytes);
|
|
16397
16502
|
return;
|
|
16398
16503
|
}).catch(() => {});
|
|
@@ -16414,7 +16519,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
16414
16519
|
for (const webPath of newIdentities.values()) {
|
|
16415
16520
|
if (store.has(webPath))
|
|
16416
16521
|
continue;
|
|
16417
|
-
loadPromises.push(Bun.file(
|
|
16522
|
+
loadPromises.push(Bun.file(resolve27(buildDir, webPath.slice(1))).bytes().then((bytes) => {
|
|
16418
16523
|
store.set(webPath, bytes);
|
|
16419
16524
|
return;
|
|
16420
16525
|
}).catch(() => {}));
|
|
@@ -16445,7 +16550,7 @@ var init_assetStore = __esm(() => {
|
|
|
16445
16550
|
|
|
16446
16551
|
// src/islands/pageMetadata.ts
|
|
16447
16552
|
import { readFileSync as readFileSync15 } from "fs";
|
|
16448
|
-
import { dirname as
|
|
16553
|
+
import { dirname as dirname16, resolve as resolve28 } from "path";
|
|
16449
16554
|
var pagePatterns, getPageDirs = (config) => [
|
|
16450
16555
|
{ dir: config.angularDirectory, framework: "angular" },
|
|
16451
16556
|
{ dir: config.emberDirectory, framework: "ember" },
|
|
@@ -16465,15 +16570,15 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
16465
16570
|
const source = definition.buildReference?.source;
|
|
16466
16571
|
if (!source)
|
|
16467
16572
|
continue;
|
|
16468
|
-
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname :
|
|
16469
|
-
lookup.set(`${definition.framework}:${definition.component}`,
|
|
16573
|
+
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve28(dirname16(buildInfo.resolvedRegistryPath), source);
|
|
16574
|
+
lookup.set(`${definition.framework}:${definition.component}`, resolve28(resolvedSource));
|
|
16470
16575
|
}
|
|
16471
16576
|
return lookup;
|
|
16472
16577
|
}, getCurrentPageIslandMetadata = () => globalThis.__absolutePageIslandMetadata ?? new Map, metadataUsesSource = (metadata, target) => metadata.islands.some((usage) => {
|
|
16473
16578
|
const candidate = usage.source;
|
|
16474
|
-
return candidate ?
|
|
16579
|
+
return candidate ? resolve28(candidate) === target : false;
|
|
16475
16580
|
}), getPagesUsingIslandSource = (sourcePath) => {
|
|
16476
|
-
const target =
|
|
16581
|
+
const target = resolve28(sourcePath);
|
|
16477
16582
|
return [...getCurrentPageIslandMetadata().values()].filter((metadata) => metadataUsesSource(metadata, target)).map((metadata) => metadata.pagePath);
|
|
16478
16583
|
}, resolveIslandUsages = (islands, islandSourceLookup) => islands.map((usage) => {
|
|
16479
16584
|
const sourcePath = islandSourceLookup.get(`${usage.framework}:${usage.component}`);
|
|
@@ -16485,13 +16590,13 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
16485
16590
|
const pattern = pagePatterns[entry.framework];
|
|
16486
16591
|
if (!pattern)
|
|
16487
16592
|
return;
|
|
16488
|
-
const files = await scanEntryPoints(
|
|
16593
|
+
const files = await scanEntryPoints(resolve28(entry.dir), pattern);
|
|
16489
16594
|
for (const filePath of files) {
|
|
16490
16595
|
const source = readFileSync15(filePath, "utf-8");
|
|
16491
16596
|
const islands = extractIslandUsagesFromSource(source);
|
|
16492
|
-
pageMetadata.set(
|
|
16597
|
+
pageMetadata.set(resolve28(filePath), {
|
|
16493
16598
|
islands: resolveIslandUsages(islands, islandSourceLookup),
|
|
16494
|
-
pagePath:
|
|
16599
|
+
pagePath: resolve28(filePath)
|
|
16495
16600
|
});
|
|
16496
16601
|
}
|
|
16497
16602
|
}, loadPageIslandMetadata = async (config) => {
|
|
@@ -16601,9 +16706,9 @@ var init_transformCache = __esm(() => {
|
|
|
16601
16706
|
});
|
|
16602
16707
|
|
|
16603
16708
|
// src/dev/reactComponentClassifier.ts
|
|
16604
|
-
import { resolve as
|
|
16709
|
+
import { resolve as resolve29 } from "path";
|
|
16605
16710
|
var classifyComponent = (filePath) => {
|
|
16606
|
-
const normalizedPath =
|
|
16711
|
+
const normalizedPath = resolve29(filePath);
|
|
16607
16712
|
if (normalizedPath.includes("/react/pages/")) {
|
|
16608
16713
|
return "server";
|
|
16609
16714
|
}
|
|
@@ -16615,7 +16720,7 @@ var classifyComponent = (filePath) => {
|
|
|
16615
16720
|
var init_reactComponentClassifier = () => {};
|
|
16616
16721
|
|
|
16617
16722
|
// src/dev/moduleMapper.ts
|
|
16618
|
-
import { basename as basename9, resolve as
|
|
16723
|
+
import { basename as basename9, resolve as resolve30 } from "path";
|
|
16619
16724
|
var buildModulePaths = (moduleKeys, manifest) => {
|
|
16620
16725
|
const modulePaths = {};
|
|
16621
16726
|
moduleKeys.forEach((key) => {
|
|
@@ -16625,7 +16730,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
16625
16730
|
});
|
|
16626
16731
|
return modulePaths;
|
|
16627
16732
|
}, processChangedFile = (sourceFile, framework, manifest, resolvedPaths, processedFiles) => {
|
|
16628
|
-
const normalizedFile =
|
|
16733
|
+
const normalizedFile = resolve30(sourceFile);
|
|
16629
16734
|
const normalizedPath = normalizedFile.replace(/\\/g, "/");
|
|
16630
16735
|
if (processedFiles.has(normalizedFile)) {
|
|
16631
16736
|
return null;
|
|
@@ -16661,7 +16766,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
16661
16766
|
});
|
|
16662
16767
|
return grouped;
|
|
16663
16768
|
}, mapSourceFileToManifestKeys = (sourceFile, framework, resolvedPaths) => {
|
|
16664
|
-
const normalizedFile =
|
|
16769
|
+
const normalizedFile = resolve30(sourceFile);
|
|
16665
16770
|
const fileName = basename9(normalizedFile);
|
|
16666
16771
|
const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|css|html)$/, "");
|
|
16667
16772
|
const pascalName = toPascal(baseName);
|
|
@@ -16857,7 +16962,7 @@ __export(exports_moduleServer, {
|
|
|
16857
16962
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
16858
16963
|
});
|
|
16859
16964
|
import { existsSync as existsSync24, readFileSync as readFileSync17, statSync as statSync2 } from "fs";
|
|
16860
|
-
import { basename as basename10, dirname as
|
|
16965
|
+
import { basename as basename10, dirname as dirname17, extname as extname8, join as join28, resolve as resolve31, relative as relative13 } from "path";
|
|
16861
16966
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
16862
16967
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
16863
16968
|
const allExports = [];
|
|
@@ -16877,7 +16982,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
|
|
|
16877
16982
|
${stubs}
|
|
16878
16983
|
`;
|
|
16879
16984
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
16880
|
-
const found = extensions.find((ext) => existsSync24(
|
|
16985
|
+
const found = extensions.find((ext) => existsSync24(resolve31(projectRoot, srcPath + ext)));
|
|
16881
16986
|
return found ? srcPath + found : srcPath;
|
|
16882
16987
|
}, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
16883
16988
|
const entries = Object.entries(vendorPaths).sort(([a], [b2]) => b2.length - a.length);
|
|
@@ -16892,7 +16997,7 @@ ${stubs}
|
|
|
16892
16997
|
return invalidationVersion > 0 ? `${mtime}.${invalidationVersion}` : `${mtime}`;
|
|
16893
16998
|
}, srcUrl = (relPath, projectRoot) => {
|
|
16894
16999
|
const base = `${SRC_PREFIX}${relPath.replace(/\\/g, "/")}`;
|
|
16895
|
-
const absPath =
|
|
17000
|
+
const absPath = resolve31(projectRoot, relPath);
|
|
16896
17001
|
const cached = mtimeCache.get(absPath);
|
|
16897
17002
|
if (cached !== undefined)
|
|
16898
17003
|
return `${base}?v=${buildVersion(cached, absPath)}`;
|
|
@@ -16904,12 +17009,12 @@ ${stubs}
|
|
|
16904
17009
|
return base;
|
|
16905
17010
|
}
|
|
16906
17011
|
}, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
|
|
16907
|
-
const absPath =
|
|
16908
|
-
const rel =
|
|
17012
|
+
const absPath = resolve31(fileDir, relPath);
|
|
17013
|
+
const rel = relative13(projectRoot, absPath);
|
|
16909
17014
|
const extension = extname8(rel);
|
|
16910
17015
|
let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
|
|
16911
17016
|
if (extname8(srcPath) === ".svelte") {
|
|
16912
|
-
srcPath =
|
|
17017
|
+
srcPath = relative13(projectRoot, resolveSvelteModulePath(resolve31(projectRoot, srcPath)));
|
|
16913
17018
|
}
|
|
16914
17019
|
return srcUrl(srcPath, projectRoot);
|
|
16915
17020
|
}, NODE_BUILTIN_RE, resolveAbsoluteSpecifier = (specifier, projectRoot) => {
|
|
@@ -16921,27 +17026,27 @@ ${stubs}
|
|
|
16921
17026
|
"import"
|
|
16922
17027
|
]);
|
|
16923
17028
|
if (fromExports)
|
|
16924
|
-
return
|
|
17029
|
+
return relative13(projectRoot, fromExports);
|
|
16925
17030
|
try {
|
|
16926
17031
|
const isScoped = specifier.startsWith("@");
|
|
16927
17032
|
const parts = specifier.split("/");
|
|
16928
17033
|
const packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];
|
|
16929
17034
|
const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
|
|
16930
17035
|
if (!subpath) {
|
|
16931
|
-
const pkgDir =
|
|
16932
|
-
const pkgJsonPath =
|
|
17036
|
+
const pkgDir = resolve31(projectRoot, "node_modules", packageName ?? "");
|
|
17037
|
+
const pkgJsonPath = join28(pkgDir, "package.json");
|
|
16933
17038
|
if (existsSync24(pkgJsonPath)) {
|
|
16934
17039
|
const pkg = JSON.parse(readFileSync17(pkgJsonPath, "utf-8"));
|
|
16935
17040
|
const esmEntry = typeof pkg.module === "string" && pkg.module || typeof pkg.browser === "string" && pkg.browser;
|
|
16936
17041
|
if (esmEntry) {
|
|
16937
|
-
const resolved =
|
|
17042
|
+
const resolved = resolve31(pkgDir, esmEntry);
|
|
16938
17043
|
if (existsSync24(resolved))
|
|
16939
|
-
return
|
|
17044
|
+
return relative13(projectRoot, resolved);
|
|
16940
17045
|
}
|
|
16941
17046
|
}
|
|
16942
17047
|
}
|
|
16943
17048
|
} catch {}
|
|
16944
|
-
return
|
|
17049
|
+
return relative13(projectRoot, Bun.resolveSync(specifier, projectRoot));
|
|
16945
17050
|
} catch {
|
|
16946
17051
|
return;
|
|
16947
17052
|
}
|
|
@@ -16966,28 +17071,28 @@ ${stubs}
|
|
|
16966
17071
|
};
|
|
16967
17072
|
result = result.replace(/^((?:import\s+[\s\S]+?\s+from|export\s+[\s\S]+?\s+from|import)\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
|
|
16968
17073
|
result = result.replace(/(import\s*\(\s*["'])([^"'./][^"']*)(["']\s*\))/g, stubReplace);
|
|
16969
|
-
const fileDir =
|
|
17074
|
+
const fileDir = dirname17(filePath);
|
|
16970
17075
|
result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
16971
17076
|
result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
16972
17077
|
result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}`);
|
|
16973
17078
|
const rewriteAbsoluteToSrc = (_match, prefix, absPath, _ext, suffix) => {
|
|
16974
17079
|
if (absPath.startsWith(projectRoot)) {
|
|
16975
|
-
const rel2 =
|
|
17080
|
+
const rel2 = relative13(projectRoot, absPath).replace(/\\/g, "/");
|
|
16976
17081
|
return `${prefix}${srcUrl(rel2, projectRoot)}${suffix}`;
|
|
16977
17082
|
}
|
|
16978
|
-
const rel =
|
|
17083
|
+
const rel = relative13(projectRoot, absPath).replace(/\\/g, "/");
|
|
16979
17084
|
return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
|
|
16980
17085
|
};
|
|
16981
17086
|
result = result.replace(/((?:from|import)\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["'])/g, rewriteAbsoluteToSrc);
|
|
16982
17087
|
result = result.replace(/(import\s*\(\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["']\s*\))/g, rewriteAbsoluteToSrc);
|
|
16983
17088
|
result = result.replace(/new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g, (_match, relPath) => {
|
|
16984
|
-
const absPath =
|
|
16985
|
-
const rel =
|
|
17089
|
+
const absPath = resolve31(fileDir, relPath);
|
|
17090
|
+
const rel = relative13(projectRoot, absPath);
|
|
16986
17091
|
return `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;
|
|
16987
17092
|
});
|
|
16988
17093
|
result = result.replace(/import\.meta\.resolve\(\s*["'](\.\.?\/[^"']+)["']\s*\)/g, (_match, relPath) => {
|
|
16989
|
-
const absPath =
|
|
16990
|
-
const rel =
|
|
17094
|
+
const absPath = resolve31(fileDir, relPath);
|
|
17095
|
+
const rel = relative13(projectRoot, absPath);
|
|
16991
17096
|
return `'${srcUrl(rel, projectRoot)}'`;
|
|
16992
17097
|
});
|
|
16993
17098
|
return result;
|
|
@@ -17043,7 +17148,7 @@ ${code}`;
|
|
|
17043
17148
|
transpiled = `var $RefreshReg$ = window.$RefreshReg$ || function(){};
|
|
17044
17149
|
` + `var $RefreshSig$ = window.$RefreshSig$ || function(){ return function(t){ return t; }; };
|
|
17045
17150
|
${transpiled}`;
|
|
17046
|
-
const relPath =
|
|
17151
|
+
const relPath = relative13(projectRoot, filePath).replace(/\\/g, "/");
|
|
17047
17152
|
transpiled = transpiled.replace(/\binput\.tsx:/g, `${relPath}:`);
|
|
17048
17153
|
transpiled += buildIslandMetadataExports(raw);
|
|
17049
17154
|
return rewriteImports(transpiled, filePath, projectRoot, rewriter);
|
|
@@ -17052,13 +17157,13 @@ ${transpiled}`;
|
|
|
17052
17157
|
const ext = extname8(filePath);
|
|
17053
17158
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
17054
17159
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
17055
|
-
let
|
|
17160
|
+
let transpiler6 = jsTranspiler2;
|
|
17056
17161
|
if (isTSX)
|
|
17057
|
-
|
|
17162
|
+
transpiler6 = tsxTranspiler;
|
|
17058
17163
|
else if (isTS)
|
|
17059
|
-
|
|
17060
|
-
const valueExports = isTS ?
|
|
17061
|
-
let transpiled =
|
|
17164
|
+
transpiler6 = tsTranspiler2;
|
|
17165
|
+
const valueExports = isTS ? transpiler6.scan(raw).exports : [];
|
|
17166
|
+
let transpiled = transpiler6.transformSync(raw);
|
|
17062
17167
|
if (isTS) {
|
|
17063
17168
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
17064
17169
|
}
|
|
@@ -17204,11 +17309,11 @@ ${code}`;
|
|
|
17204
17309
|
if (compiled.css?.code) {
|
|
17205
17310
|
const cssPath = `${filePath}.css`;
|
|
17206
17311
|
svelteExternalCss.set(cssPath, compiled.css.code);
|
|
17207
|
-
const cssUrl = srcUrl(
|
|
17312
|
+
const cssUrl = srcUrl(relative13(projectRoot, cssPath), projectRoot);
|
|
17208
17313
|
code = `import "${cssUrl}";
|
|
17209
17314
|
${code}`;
|
|
17210
17315
|
}
|
|
17211
|
-
const moduleUrl = `${SRC_PREFIX}${
|
|
17316
|
+
const moduleUrl = `${SRC_PREFIX}${relative13(projectRoot, filePath).replace(/\\/g, "/")}`;
|
|
17212
17317
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
17213
17318
|
` + ` if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
17214
17319
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
@@ -17234,6 +17339,8 @@ ${code}`;
|
|
|
17234
17339
|
const templateResult = compiler.compileTemplate({
|
|
17235
17340
|
compilerOptions: {
|
|
17236
17341
|
bindingMetadata: compiledScript.bindings,
|
|
17342
|
+
expressionPlugins: ["typescript"],
|
|
17343
|
+
isCustomElement: (tag) => tag === "absolute-island",
|
|
17237
17344
|
prefixIdentifiers: true
|
|
17238
17345
|
},
|
|
17239
17346
|
filename: filePath,
|
|
@@ -17297,8 +17404,8 @@ ${code}`;
|
|
|
17297
17404
|
code = injectVueHmr(code, filePath, projectRoot, vueDir);
|
|
17298
17405
|
return rewriteImports(code, filePath, projectRoot, rewriter);
|
|
17299
17406
|
}, injectVueHmr = (code, filePath, projectRoot, vueDir) => {
|
|
17300
|
-
const hmrBase = vueDir ?
|
|
17301
|
-
const hmrId =
|
|
17407
|
+
const hmrBase = vueDir ? resolve31(vueDir) : projectRoot;
|
|
17408
|
+
const hmrId = relative13(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
|
|
17302
17409
|
let result = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
|
|
17303
17410
|
result += [
|
|
17304
17411
|
"",
|
|
@@ -17461,7 +17568,7 @@ export default {};
|
|
|
17461
17568
|
const escaped = virtualCss.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
17462
17569
|
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);`);
|
|
17463
17570
|
}, resolveSourcePath = (relPath, projectRoot) => {
|
|
17464
|
-
const filePath =
|
|
17571
|
+
const filePath = resolve31(projectRoot, relPath);
|
|
17465
17572
|
const ext = extname8(filePath);
|
|
17466
17573
|
if (ext === ".svelte")
|
|
17467
17574
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
@@ -17488,7 +17595,7 @@ export default {};
|
|
|
17488
17595
|
if (!TRANSPILABLE.has(ext))
|
|
17489
17596
|
return;
|
|
17490
17597
|
const stat3 = statSync2(filePath);
|
|
17491
|
-
const resolvedVueDir = vueDir ?
|
|
17598
|
+
const resolvedVueDir = vueDir ? resolve31(vueDir) : undefined;
|
|
17492
17599
|
let content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
|
|
17493
17600
|
const isComponentJs = ext === ".js" && filePath.endsWith(".component.js") && filePath.replace(/\\/g, "/").includes("/.absolutejs/generated/angular/");
|
|
17494
17601
|
if (isComponentJs) {
|
|
@@ -17547,7 +17654,7 @@ export default {};
|
|
|
17547
17654
|
const relPath = pathname.slice(SRC_PREFIX.length);
|
|
17548
17655
|
if (relPath === "bun:wrap" || relPath.startsWith("bun:wrap?"))
|
|
17549
17656
|
return handleBunWrapRequest();
|
|
17550
|
-
const virtualCssResponse = handleVirtualSvelteCss(
|
|
17657
|
+
const virtualCssResponse = handleVirtualSvelteCss(resolve31(projectRoot, relPath));
|
|
17551
17658
|
if (virtualCssResponse)
|
|
17552
17659
|
return virtualCssResponse;
|
|
17553
17660
|
const { filePath, ext } = resolveSourcePath(relPath, projectRoot);
|
|
@@ -17563,11 +17670,11 @@ export default {};
|
|
|
17563
17670
|
SRC_IMPORT_RE.lastIndex = 0;
|
|
17564
17671
|
while ((match = SRC_IMPORT_RE.exec(content)) !== null) {
|
|
17565
17672
|
if (match[1])
|
|
17566
|
-
files.push(
|
|
17673
|
+
files.push(resolve31(projectRoot, match[1]));
|
|
17567
17674
|
}
|
|
17568
17675
|
return files;
|
|
17569
17676
|
}, invalidateModule = (filePath) => {
|
|
17570
|
-
const resolved =
|
|
17677
|
+
const resolved = resolve31(filePath);
|
|
17571
17678
|
invalidate(filePath);
|
|
17572
17679
|
if (resolved !== filePath)
|
|
17573
17680
|
invalidate(resolved);
|
|
@@ -17714,7 +17821,7 @@ __export(exports_resolveOwningComponents, {
|
|
|
17714
17821
|
invalidateResourceIndex: () => invalidateResourceIndex
|
|
17715
17822
|
});
|
|
17716
17823
|
import { readdirSync as readdirSync2, readFileSync as readFileSync18, statSync as statSync3 } from "fs";
|
|
17717
|
-
import { dirname as
|
|
17824
|
+
import { dirname as dirname18, extname as extname9, join as join29, resolve as resolve32 } from "path";
|
|
17718
17825
|
import ts3 from "typescript";
|
|
17719
17826
|
var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") || file4.endsWith(".tsx"), walkAngularSourceFiles = (root) => {
|
|
17720
17827
|
const out = [];
|
|
@@ -17729,7 +17836,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
17729
17836
|
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
17730
17837
|
continue;
|
|
17731
17838
|
}
|
|
17732
|
-
const full =
|
|
17839
|
+
const full = join29(dir, entry.name);
|
|
17733
17840
|
if (entry.isDirectory()) {
|
|
17734
17841
|
visit(full);
|
|
17735
17842
|
} else if (entry.isFile() && isAngularSourceFile(entry.name)) {
|
|
@@ -17827,7 +17934,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
17827
17934
|
};
|
|
17828
17935
|
visit(sourceFile);
|
|
17829
17936
|
return out;
|
|
17830
|
-
}, safeNormalize = (path) =>
|
|
17937
|
+
}, safeNormalize = (path) => resolve32(path).replace(/\\/g, "/"), resolveOwningComponents = (params) => {
|
|
17831
17938
|
const { changedFilePath, userAngularRoot } = params;
|
|
17832
17939
|
const changedAbs = safeNormalize(changedFilePath);
|
|
17833
17940
|
const out = [];
|
|
@@ -17868,7 +17975,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
17868
17975
|
return null;
|
|
17869
17976
|
}
|
|
17870
17977
|
const sf = ts3.createSourceFile(childFilePath, source, ts3.ScriptTarget.ES2022, true, ts3.ScriptKind.TS);
|
|
17871
|
-
const childDir =
|
|
17978
|
+
const childDir = dirname18(childFilePath);
|
|
17872
17979
|
for (const stmt of sf.statements) {
|
|
17873
17980
|
if (!ts3.isImportDeclaration(stmt))
|
|
17874
17981
|
continue;
|
|
@@ -17896,7 +18003,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
17896
18003
|
if (!spec.startsWith(".") && !spec.startsWith("/")) {
|
|
17897
18004
|
return null;
|
|
17898
18005
|
}
|
|
17899
|
-
const base =
|
|
18006
|
+
const base = resolve32(childDir, spec);
|
|
17900
18007
|
const candidates = [
|
|
17901
18008
|
`${base}.ts`,
|
|
17902
18009
|
`${base}.tsx`,
|
|
@@ -17925,7 +18032,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
17925
18032
|
const parentFile = new Map;
|
|
17926
18033
|
for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
|
|
17927
18034
|
const classes = parseDecoratedClasses(tsPath);
|
|
17928
|
-
const componentDir =
|
|
18035
|
+
const componentDir = dirname18(tsPath);
|
|
17929
18036
|
for (const cls of classes) {
|
|
17930
18037
|
const entity = {
|
|
17931
18038
|
className: cls.className,
|
|
@@ -17934,7 +18041,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
17934
18041
|
};
|
|
17935
18042
|
if (cls.kind === "component") {
|
|
17936
18043
|
for (const url of [...cls.templateUrls, ...cls.styleUrls]) {
|
|
17937
|
-
const abs = safeNormalize(
|
|
18044
|
+
const abs = safeNormalize(resolve32(componentDir, url));
|
|
17938
18045
|
const existing = resource.get(abs);
|
|
17939
18046
|
if (existing)
|
|
17940
18047
|
existing.push(entity);
|
|
@@ -18014,8 +18121,6 @@ class Context {
|
|
|
18014
18121
|
}
|
|
18015
18122
|
|
|
18016
18123
|
// src/dev/angular/vendor/translator/translator.ts
|
|
18017
|
-
import * as o from "@angular/compiler";
|
|
18018
|
-
|
|
18019
18124
|
class ExpressionTranslatorVisitor {
|
|
18020
18125
|
factory;
|
|
18021
18126
|
imports;
|
|
@@ -18306,8 +18411,16 @@ function createRange(span) {
|
|
|
18306
18411
|
end: { offset: end.offset, line: end.line, column: end.col }
|
|
18307
18412
|
};
|
|
18308
18413
|
}
|
|
18309
|
-
var UNARY_OPERATORS, BINARY_OPERATORS;
|
|
18414
|
+
var o, UNARY_OPERATORS, BINARY_OPERATORS;
|
|
18310
18415
|
var init_translator = __esm(() => {
|
|
18416
|
+
o = (() => {
|
|
18417
|
+
try {
|
|
18418
|
+
return __require("@angular/compiler");
|
|
18419
|
+
} catch {
|
|
18420
|
+
const stub = new Proxy(function() {}, { apply: () => stub, construct: () => stub, get: () => stub });
|
|
18421
|
+
return stub;
|
|
18422
|
+
}
|
|
18423
|
+
})();
|
|
18311
18424
|
UNARY_OPERATORS = /* @__PURE__ */ new Map([
|
|
18312
18425
|
[o.UnaryOperator.Minus, "-"],
|
|
18313
18426
|
[o.UnaryOperator.Plus, "+"]
|
|
@@ -18645,9 +18758,18 @@ var init_typescript_ast_factory = __esm(() => {
|
|
|
18645
18758
|
function translateStatement(contextFile, statement, imports, options = {}) {
|
|
18646
18759
|
return statement.visitStatement(new ExpressionTranslatorVisitor(new TypeScriptAstFactory(options.annotateForClosureCompiler === true), imports, contextFile, options), new Context(true));
|
|
18647
18760
|
}
|
|
18761
|
+
var o2;
|
|
18648
18762
|
var init_typescript_translator = __esm(() => {
|
|
18649
18763
|
init_translator();
|
|
18650
18764
|
init_typescript_ast_factory();
|
|
18765
|
+
o2 = (() => {
|
|
18766
|
+
try {
|
|
18767
|
+
return __require("@angular/compiler");
|
|
18768
|
+
} catch {
|
|
18769
|
+
const stub = new Proxy(function() {}, { apply: () => stub, construct: () => stub, get: () => stub });
|
|
18770
|
+
return stub;
|
|
18771
|
+
}
|
|
18772
|
+
})();
|
|
18651
18773
|
});
|
|
18652
18774
|
|
|
18653
18775
|
// src/dev/angular/fastHmrCompiler.ts
|
|
@@ -18659,7 +18781,7 @@ __export(exports_fastHmrCompiler, {
|
|
|
18659
18781
|
invalidateFingerprintCache: () => invalidateFingerprintCache
|
|
18660
18782
|
});
|
|
18661
18783
|
import { existsSync as existsSync25, readFileSync as readFileSync19, statSync as statSync4 } from "fs";
|
|
18662
|
-
import { dirname as
|
|
18784
|
+
import { dirname as dirname19, extname as extname10, relative as relative14, resolve as resolve33 } from "path";
|
|
18663
18785
|
import ts7 from "typescript";
|
|
18664
18786
|
var fail = (reason, detail, location) => ({
|
|
18665
18787
|
ok: false,
|
|
@@ -18881,7 +19003,7 @@ var fail = (reason, detail, location) => ({
|
|
|
18881
19003
|
if (!spec.startsWith(".") && !spec.startsWith("/")) {
|
|
18882
19004
|
return true;
|
|
18883
19005
|
}
|
|
18884
|
-
const base =
|
|
19006
|
+
const base = resolve33(componentDir, spec);
|
|
18885
19007
|
const candidates = [
|
|
18886
19008
|
`${base}.ts`,
|
|
18887
19009
|
`${base}.tsx`,
|
|
@@ -19644,7 +19766,7 @@ var fail = (reason, detail, location) => ({
|
|
|
19644
19766
|
});
|
|
19645
19767
|
if (!names.includes(className))
|
|
19646
19768
|
continue;
|
|
19647
|
-
const nextDts = resolveDtsFromSpec(fromPath,
|
|
19769
|
+
const nextDts = resolveDtsFromSpec(fromPath, dirname19(startDtsPath));
|
|
19648
19770
|
if (!nextDts)
|
|
19649
19771
|
continue;
|
|
19650
19772
|
const found = findDtsContainingClass(nextDts, className, visited);
|
|
@@ -19654,7 +19776,7 @@ var fail = (reason, detail, location) => ({
|
|
|
19654
19776
|
const starReExportRe = /export\s*\*\s*from\s*["']([^"']+)["']/g;
|
|
19655
19777
|
while ((m = starReExportRe.exec(content)) !== null) {
|
|
19656
19778
|
const fromPath = m[1] || "";
|
|
19657
|
-
const nextDts = resolveDtsFromSpec(fromPath,
|
|
19779
|
+
const nextDts = resolveDtsFromSpec(fromPath, dirname19(startDtsPath));
|
|
19658
19780
|
if (!nextDts)
|
|
19659
19781
|
continue;
|
|
19660
19782
|
const found = findDtsContainingClass(nextDts, className, visited);
|
|
@@ -19664,7 +19786,7 @@ var fail = (reason, detail, location) => ({
|
|
|
19664
19786
|
return null;
|
|
19665
19787
|
}, resolveDtsFromSpec = (spec, fromDir) => {
|
|
19666
19788
|
const stripped = spec.replace(/\.[mc]?js$/, "");
|
|
19667
|
-
const base =
|
|
19789
|
+
const base = resolve33(fromDir, stripped);
|
|
19668
19790
|
const candidates = [
|
|
19669
19791
|
`${base}.d.ts`,
|
|
19670
19792
|
`${base}.d.mts`,
|
|
@@ -19688,7 +19810,7 @@ var fail = (reason, detail, location) => ({
|
|
|
19688
19810
|
return null;
|
|
19689
19811
|
}, resolveChildComponentInfo = (className, spec, componentDir, projectRoot) => {
|
|
19690
19812
|
if (spec.startsWith(".") || spec.startsWith("/")) {
|
|
19691
|
-
const base =
|
|
19813
|
+
const base = resolve33(componentDir, spec);
|
|
19692
19814
|
const candidates = [
|
|
19693
19815
|
`${base}.ts`,
|
|
19694
19816
|
`${base}.tsx`,
|
|
@@ -19858,13 +19980,13 @@ var fail = (reason, detail, location) => ({
|
|
|
19858
19980
|
}
|
|
19859
19981
|
if (!matches)
|
|
19860
19982
|
continue;
|
|
19861
|
-
const resolved =
|
|
19983
|
+
const resolved = resolve33(componentDir, spec);
|
|
19862
19984
|
for (const ext of TS_EXTENSIONS) {
|
|
19863
19985
|
const candidate = resolved + ext;
|
|
19864
19986
|
if (existsSync25(candidate))
|
|
19865
19987
|
return candidate;
|
|
19866
19988
|
}
|
|
19867
|
-
const indexCandidate =
|
|
19989
|
+
const indexCandidate = resolve33(resolved, "index.ts");
|
|
19868
19990
|
if (existsSync25(indexCandidate))
|
|
19869
19991
|
return indexCandidate;
|
|
19870
19992
|
}
|
|
@@ -20051,7 +20173,7 @@ ${transpiled}
|
|
|
20051
20173
|
}
|
|
20052
20174
|
}${staticPatch}`;
|
|
20053
20175
|
}, STYLE_PREPROCESSED_EXT, resolveAndReadStyleResource = (componentDir, url) => {
|
|
20054
|
-
const abs =
|
|
20176
|
+
const abs = resolve33(componentDir, url);
|
|
20055
20177
|
if (!existsSync25(abs))
|
|
20056
20178
|
return null;
|
|
20057
20179
|
const ext = extname10(abs).toLowerCase();
|
|
@@ -20091,7 +20213,7 @@ ${block}
|
|
|
20091
20213
|
const cached = projectOptionsCache.get(projectRoot);
|
|
20092
20214
|
if (cached !== undefined)
|
|
20093
20215
|
return cached;
|
|
20094
|
-
const tsconfigPath =
|
|
20216
|
+
const tsconfigPath = resolve33(projectRoot, "tsconfig.json");
|
|
20095
20217
|
const opts = {};
|
|
20096
20218
|
if (existsSync25(tsconfigPath)) {
|
|
20097
20219
|
try {
|
|
@@ -20137,7 +20259,7 @@ ${block}
|
|
|
20137
20259
|
}
|
|
20138
20260
|
const kind = params.kind ?? "component";
|
|
20139
20261
|
if (kind !== "component") {
|
|
20140
|
-
const entityId = encodeURIComponent(`${
|
|
20262
|
+
const entityId = encodeURIComponent(`${relative14(projectRoot, componentFilePath).replace(/\\/g, "/")}@${className}`);
|
|
20141
20263
|
const currentEntityFingerprint = extractEntityFingerprint(classNode, className, sourceFile);
|
|
20142
20264
|
const cachedEntityFingerprint = entityFingerprintCache.get(entityId);
|
|
20143
20265
|
if (cachedEntityFingerprint !== undefined && !entityFingerprintsEqual(cachedEntityFingerprint, currentEntityFingerprint)) {
|
|
@@ -20155,7 +20277,7 @@ ${block}
|
|
|
20155
20277
|
ok: true
|
|
20156
20278
|
};
|
|
20157
20279
|
}
|
|
20158
|
-
if (inheritsDecoratedClass(classNode, sourceFile,
|
|
20280
|
+
if (inheritsDecoratedClass(classNode, sourceFile, dirname19(componentFilePath), projectRoot)) {
|
|
20159
20281
|
return fail("inherits-decorated-class");
|
|
20160
20282
|
}
|
|
20161
20283
|
const decorator = findComponentDecorator(classNode);
|
|
@@ -20167,14 +20289,14 @@ ${block}
|
|
|
20167
20289
|
const projectDefaults = readProjectAngularCompilerOptions(projectRoot);
|
|
20168
20290
|
const decoratorMeta = readDecoratorMeta(decoratorArgs, projectDefaults);
|
|
20169
20291
|
const advancedMetadata = extractAdvancedMetadata(classNode, decoratorArgs, compiler);
|
|
20170
|
-
const componentDir =
|
|
20292
|
+
const componentDir = dirname19(componentFilePath);
|
|
20171
20293
|
let templateText;
|
|
20172
20294
|
let templatePath;
|
|
20173
20295
|
if (decoratorMeta.template !== null) {
|
|
20174
20296
|
templateText = decoratorMeta.template;
|
|
20175
20297
|
templatePath = componentFilePath;
|
|
20176
20298
|
} else if (decoratorMeta.templateUrl) {
|
|
20177
|
-
const tplAbs =
|
|
20299
|
+
const tplAbs = resolve33(componentDir, decoratorMeta.templateUrl);
|
|
20178
20300
|
if (!existsSync25(tplAbs)) {
|
|
20179
20301
|
return fail("template-resource-not-found", `Template file not found: ${tplAbs}`, { file: componentFilePath });
|
|
20180
20302
|
}
|
|
@@ -20225,7 +20347,7 @@ ${block}
|
|
|
20225
20347
|
hasDecoratorIO,
|
|
20226
20348
|
hasSignalIO
|
|
20227
20349
|
} = extractInputsAndOutputs(classNode, compiler);
|
|
20228
|
-
const projectRelPath =
|
|
20350
|
+
const projectRelPath = relative14(projectRoot, componentFilePath).replace(/\\/g, "/");
|
|
20229
20351
|
const fingerprintId = encodeURIComponent(`${projectRelPath}@${className}`);
|
|
20230
20352
|
const currentFingerprint = extractFingerprint(classNode, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
|
|
20231
20353
|
const cachedFingerprint = fingerprintCache.get(fingerprintId);
|
|
@@ -20479,7 +20601,7 @@ __export(exports_hmrCompiler, {
|
|
|
20479
20601
|
getApplyMetadataModule: () => getApplyMetadataModule,
|
|
20480
20602
|
encodeHmrComponentId: () => encodeHmrComponentId
|
|
20481
20603
|
});
|
|
20482
|
-
import { dirname as
|
|
20604
|
+
import { dirname as dirname20, relative as relative15, resolve as resolve34 } from "path";
|
|
20483
20605
|
import { performance as performance2 } from "perf_hooks";
|
|
20484
20606
|
var getApplyMetadataModule = async (encodedId) => {
|
|
20485
20607
|
const decoded = decodeURIComponent(encodedId);
|
|
@@ -20488,8 +20610,8 @@ var getApplyMetadataModule = async (encodedId) => {
|
|
|
20488
20610
|
return null;
|
|
20489
20611
|
const filePathRel = decoded.slice(0, at2);
|
|
20490
20612
|
const className = decoded.slice(at2 + 1);
|
|
20491
|
-
const componentFilePath =
|
|
20492
|
-
const projectRelPath =
|
|
20613
|
+
const componentFilePath = resolve34(process.cwd(), filePathRel);
|
|
20614
|
+
const projectRelPath = relative15(process.cwd(), componentFilePath).replace(/\\/g, "/");
|
|
20493
20615
|
const cacheKey2 = encodeURIComponent(`${projectRelPath}@${className}`);
|
|
20494
20616
|
const { takePendingModule: takePendingModule2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
|
|
20495
20617
|
const cached = takePendingModule2(cacheKey2);
|
|
@@ -20499,9 +20621,9 @@ var getApplyMetadataModule = async (encodedId) => {
|
|
|
20499
20621
|
const { resolveOwningComponents: resolveOwningComponents2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
|
|
20500
20622
|
const owners = resolveOwningComponents2({
|
|
20501
20623
|
changedFilePath: componentFilePath,
|
|
20502
|
-
userAngularRoot:
|
|
20624
|
+
userAngularRoot: dirname20(componentFilePath)
|
|
20503
20625
|
});
|
|
20504
|
-
const owner = owners.find((
|
|
20626
|
+
const owner = owners.find((o3) => o3.className === className);
|
|
20505
20627
|
const kind = owner?.kind ?? "component";
|
|
20506
20628
|
const fastStart = performance2.now();
|
|
20507
20629
|
const fast = await tryFastHmr({ className, componentFilePath, kind });
|
|
@@ -20511,7 +20633,7 @@ var getApplyMetadataModule = async (encodedId) => {
|
|
|
20511
20633
|
}
|
|
20512
20634
|
return null;
|
|
20513
20635
|
}, encodeHmrComponentId = (absoluteFilePath, className) => {
|
|
20514
|
-
const projectRel =
|
|
20636
|
+
const projectRel = relative15(process.cwd(), absoluteFilePath).replace(/\\/g, "/");
|
|
20515
20637
|
return `${projectRel}@${className}`;
|
|
20516
20638
|
};
|
|
20517
20639
|
var init_hmrCompiler = __esm(() => {
|
|
@@ -20650,11 +20772,11 @@ var exports_simpleHTMLHMR = {};
|
|
|
20650
20772
|
__export(exports_simpleHTMLHMR, {
|
|
20651
20773
|
handleHTMLUpdate: () => handleHTMLUpdate
|
|
20652
20774
|
});
|
|
20653
|
-
import { resolve as
|
|
20775
|
+
import { resolve as resolve35 } from "path";
|
|
20654
20776
|
var handleHTMLUpdate = async (htmlFilePath) => {
|
|
20655
20777
|
let htmlContent;
|
|
20656
20778
|
try {
|
|
20657
|
-
const resolvedPath =
|
|
20779
|
+
const resolvedPath = resolve35(htmlFilePath);
|
|
20658
20780
|
const file4 = Bun.file(resolvedPath);
|
|
20659
20781
|
if (!await file4.exists()) {
|
|
20660
20782
|
return null;
|
|
@@ -20680,11 +20802,11 @@ var exports_simpleHTMXHMR = {};
|
|
|
20680
20802
|
__export(exports_simpleHTMXHMR, {
|
|
20681
20803
|
handleHTMXUpdate: () => handleHTMXUpdate
|
|
20682
20804
|
});
|
|
20683
|
-
import { resolve as
|
|
20805
|
+
import { resolve as resolve36 } from "path";
|
|
20684
20806
|
var handleHTMXUpdate = async (htmxFilePath) => {
|
|
20685
20807
|
let htmlContent;
|
|
20686
20808
|
try {
|
|
20687
|
-
const resolvedPath =
|
|
20809
|
+
const resolvedPath = resolve36(htmxFilePath);
|
|
20688
20810
|
const file4 = Bun.file(resolvedPath);
|
|
20689
20811
|
if (!await file4.exists()) {
|
|
20690
20812
|
return null;
|
|
@@ -20707,7 +20829,7 @@ var init_simpleHTMXHMR = () => {};
|
|
|
20707
20829
|
|
|
20708
20830
|
// src/dev/rebuildTrigger.ts
|
|
20709
20831
|
import { existsSync as existsSync26 } from "fs";
|
|
20710
|
-
import { basename as basename11, dirname as
|
|
20832
|
+
import { basename as basename11, dirname as dirname21, relative as relative16, resolve as resolve37, sep as sep4 } from "path";
|
|
20711
20833
|
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) => {
|
|
20712
20834
|
if (!config.tailwind)
|
|
20713
20835
|
return;
|
|
@@ -20799,7 +20921,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20799
20921
|
state.fileHashes.delete(filePathInSet);
|
|
20800
20922
|
try {
|
|
20801
20923
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, filePathInSet);
|
|
20802
|
-
const deletedPathResolved =
|
|
20924
|
+
const deletedPathResolved = resolve37(filePathInSet);
|
|
20803
20925
|
affectedFiles.forEach((affectedFile) => {
|
|
20804
20926
|
if (isValidDeletedAffectedFile(affectedFile, deletedPathResolved, processedFiles)) {
|
|
20805
20927
|
validFiles.push(affectedFile);
|
|
@@ -20843,7 +20965,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20843
20965
|
if (storedHash !== undefined && storedHash === fileHash) {
|
|
20844
20966
|
return;
|
|
20845
20967
|
}
|
|
20846
|
-
const normalizedFilePath =
|
|
20968
|
+
const normalizedFilePath = resolve37(filePathInSet);
|
|
20847
20969
|
if (!processedFiles.has(normalizedFilePath)) {
|
|
20848
20970
|
validFiles.push(normalizedFilePath);
|
|
20849
20971
|
processedFiles.add(normalizedFilePath);
|
|
@@ -20947,8 +21069,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20947
21069
|
return;
|
|
20948
21070
|
}
|
|
20949
21071
|
if (framework === "unknown") {
|
|
20950
|
-
invalidate(
|
|
20951
|
-
const relPath =
|
|
21072
|
+
invalidate(resolve37(filePath));
|
|
21073
|
+
const relPath = relative16(process.cwd(), filePath);
|
|
20952
21074
|
logHmrUpdate(relPath);
|
|
20953
21075
|
return;
|
|
20954
21076
|
}
|
|
@@ -20974,7 +21096,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20974
21096
|
const userEditedFiles = new Set;
|
|
20975
21097
|
state.fileChangeQueue.forEach((filePaths) => {
|
|
20976
21098
|
for (const filePath2 of filePaths) {
|
|
20977
|
-
userEditedFiles.add(
|
|
21099
|
+
userEditedFiles.add(resolve37(filePath2));
|
|
20978
21100
|
}
|
|
20979
21101
|
});
|
|
20980
21102
|
state.lastUserEditedFiles = userEditedFiles;
|
|
@@ -21003,7 +21125,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21003
21125
|
}
|
|
21004
21126
|
if (!graph)
|
|
21005
21127
|
return componentFile;
|
|
21006
|
-
const dependents = graph.dependents.get(
|
|
21128
|
+
const dependents = graph.dependents.get(resolve37(componentFile));
|
|
21007
21129
|
if (!dependents)
|
|
21008
21130
|
return componentFile;
|
|
21009
21131
|
for (const dep of dependents) {
|
|
@@ -21012,7 +21134,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21012
21134
|
}
|
|
21013
21135
|
return componentFile;
|
|
21014
21136
|
}, resolveAngularPageEntries = (state, angularFiles, angularPagesPath) => {
|
|
21015
|
-
const pageEntries = angularFiles.filter((file4) => file4.endsWith(".ts") &&
|
|
21137
|
+
const pageEntries = angularFiles.filter((file4) => file4.endsWith(".ts") && resolve37(file4).startsWith(angularPagesPath));
|
|
21016
21138
|
if (pageEntries.length > 0 || !state.dependencyGraph) {
|
|
21017
21139
|
return pageEntries;
|
|
21018
21140
|
}
|
|
@@ -21021,7 +21143,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21021
21143
|
const lookupFile = resolveComponentLookupFile(componentFile, state.dependencyGraph);
|
|
21022
21144
|
const affected = getAffectedFiles(state.dependencyGraph, lookupFile);
|
|
21023
21145
|
affected.forEach((file4) => {
|
|
21024
|
-
if (file4.endsWith(".ts") &&
|
|
21146
|
+
if (file4.endsWith(".ts") && resolve37(file4).startsWith(angularPagesPath)) {
|
|
21025
21147
|
resolvedPages.add(file4);
|
|
21026
21148
|
}
|
|
21027
21149
|
});
|
|
@@ -21293,16 +21415,16 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21293
21415
|
};
|
|
21294
21416
|
const fire = () => {
|
|
21295
21417
|
ctx.debounceTimer = null;
|
|
21296
|
-
const
|
|
21418
|
+
const resolve38 = ctx.debouncedResolve;
|
|
21297
21419
|
ctx.debouncedResolve = null;
|
|
21298
21420
|
ctx.debouncedPromise = null;
|
|
21299
21421
|
if (ctx.inFlight) {
|
|
21300
21422
|
ctx.pending = true;
|
|
21301
|
-
ctx.inFlight.finally(() =>
|
|
21423
|
+
ctx.inFlight.finally(() => resolve38?.());
|
|
21302
21424
|
return;
|
|
21303
21425
|
}
|
|
21304
21426
|
ctx.inFlight = drive();
|
|
21305
|
-
ctx.inFlight.finally(() =>
|
|
21427
|
+
ctx.inFlight.finally(() => resolve38?.());
|
|
21306
21428
|
};
|
|
21307
21429
|
return ({ immediate = false } = {}) => {
|
|
21308
21430
|
if (!ctx.debouncedPromise) {
|
|
@@ -21329,9 +21451,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21329
21451
|
const diskRefreshPromise = (async () => {
|
|
21330
21452
|
if (!angularDir || editedFiles.size === 0)
|
|
21331
21453
|
return;
|
|
21332
|
-
const angularDirAbs =
|
|
21454
|
+
const angularDirAbs = resolve37(angularDir);
|
|
21333
21455
|
const filesUnderAngular = Array.from(editedFiles).filter((file4) => {
|
|
21334
|
-
const abs =
|
|
21456
|
+
const abs = resolve37(file4);
|
|
21335
21457
|
return abs === angularDirAbs || abs.startsWith(angularDirAbs + sep4);
|
|
21336
21458
|
});
|
|
21337
21459
|
if (filesUnderAngular.length === 0)
|
|
@@ -21353,7 +21475,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21353
21475
|
if (!ext)
|
|
21354
21476
|
continue;
|
|
21355
21477
|
if (ext === ".ts" || ext === ".tsx") {
|
|
21356
|
-
tsFilesToRefresh.add(
|
|
21478
|
+
tsFilesToRefresh.add(resolve37(file4));
|
|
21357
21479
|
continue;
|
|
21358
21480
|
}
|
|
21359
21481
|
const owners = resolveOwningComponents2({
|
|
@@ -21361,7 +21483,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21361
21483
|
userAngularRoot: angularDirAbs
|
|
21362
21484
|
});
|
|
21363
21485
|
for (const owner of owners) {
|
|
21364
|
-
tsFilesToRefresh.add(
|
|
21486
|
+
tsFilesToRefresh.add(resolve37(owner.componentFilePath));
|
|
21365
21487
|
}
|
|
21366
21488
|
}
|
|
21367
21489
|
if (tsFilesToRefresh.size === 0)
|
|
@@ -21372,8 +21494,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21372
21494
|
try {
|
|
21373
21495
|
const { invalidateModule: invalidateModule2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
21374
21496
|
for (const tsFile of tsFilesToRefresh) {
|
|
21375
|
-
const rel =
|
|
21376
|
-
const compiledFile =
|
|
21497
|
+
const rel = relative16(angularDirAbs, tsFile).replace(/\\/g, "/").replace(/\.[tj]sx?$/, ".js");
|
|
21498
|
+
const compiledFile = resolve37(compiledRoot, rel);
|
|
21377
21499
|
invalidateModule2(compiledFile);
|
|
21378
21500
|
}
|
|
21379
21501
|
} catch {}
|
|
@@ -21402,7 +21524,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21402
21524
|
serverPaths.forEach((serverPath, idx) => {
|
|
21403
21525
|
const fileBase = basename11(serverPath, ".js");
|
|
21404
21526
|
const ssrPath = ssrPaths[idx] ?? serverPath;
|
|
21405
|
-
state.manifest[toPascal(fileBase)] =
|
|
21527
|
+
state.manifest[toPascal(fileBase)] = resolve37(ssrPath);
|
|
21406
21528
|
});
|
|
21407
21529
|
if (clientPaths.length > 0) {
|
|
21408
21530
|
await bundleAngularClient(state, clientPaths, state.resolvedPaths.buildDir, angularDir);
|
|
@@ -21411,9 +21533,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21411
21533
|
const angularDir = config.angularDirectory ?? "";
|
|
21412
21534
|
const angularFiles = filesToRebuild.filter((file4) => detectFramework(file4, state.resolvedPaths) === "angular");
|
|
21413
21535
|
for (const file4 of angularFiles) {
|
|
21414
|
-
state.fileHashes.set(
|
|
21536
|
+
state.fileHashes.set(resolve37(file4), computeFileHash(file4));
|
|
21415
21537
|
}
|
|
21416
|
-
const angularPagesPath =
|
|
21538
|
+
const angularPagesPath = resolve37(angularDir, "pages");
|
|
21417
21539
|
const pageEntries = resolveAngularPageEntries(state, angularFiles, angularPagesPath);
|
|
21418
21540
|
const tierStart = performance.now();
|
|
21419
21541
|
const verdict = await decideAngularTier(state, angularDir);
|
|
@@ -21443,7 +21565,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21443
21565
|
}, getModuleUrl = async (pageFile) => {
|
|
21444
21566
|
const { invalidateModule: invalidateModule2, warmCache: warmCache2, SRC_URL_PREFIX: SRC_URL_PREFIX2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
21445
21567
|
invalidateModule2(pageFile);
|
|
21446
|
-
const rel =
|
|
21568
|
+
const rel = relative16(process.cwd(), pageFile).replace(/\\/g, "/");
|
|
21447
21569
|
const url = `${SRC_URL_PREFIX2}${rel}`;
|
|
21448
21570
|
warmCache2(url);
|
|
21449
21571
|
return url;
|
|
@@ -21452,11 +21574,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21452
21574
|
if (isComponentFile2)
|
|
21453
21575
|
return primaryFile;
|
|
21454
21576
|
const { findNearestComponent: findNearestComponent2 } = await Promise.resolve().then(() => (init_transformCache(), exports_transformCache));
|
|
21455
|
-
const nearest = findNearestComponent2(
|
|
21577
|
+
const nearest = findNearestComponent2(resolve37(primaryFile));
|
|
21456
21578
|
return nearest ?? primaryFile;
|
|
21457
21579
|
}, handleReactModuleServerPath = async (state, reactFiles, startTime, onRebuildComplete) => {
|
|
21458
21580
|
for (const file4 of reactFiles) {
|
|
21459
|
-
state.fileHashes.set(
|
|
21581
|
+
state.fileHashes.set(resolve37(file4), computeFileHash(file4));
|
|
21460
21582
|
}
|
|
21461
21583
|
markSsrCacheDirty("react");
|
|
21462
21584
|
const primaryFile = reactFiles.find((file4) => !file4.replace(/\\/g, "/").includes("/pages/")) ?? reactFiles[0];
|
|
@@ -21475,7 +21597,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21475
21597
|
const pageModuleUrl = await getReactModuleUrl(broadcastTarget);
|
|
21476
21598
|
if (pageModuleUrl) {
|
|
21477
21599
|
const serverDuration = Date.now() - startTime;
|
|
21478
|
-
state.lastHmrPath =
|
|
21600
|
+
state.lastHmrPath = relative16(process.cwd(), primaryFile).replace(/\\/g, "/");
|
|
21479
21601
|
state.lastHmrFramework = "react";
|
|
21480
21602
|
broadcastToClients(state, {
|
|
21481
21603
|
data: {
|
|
@@ -21538,7 +21660,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21538
21660
|
});
|
|
21539
21661
|
}, handleSvelteModuleServerPath = async (state, svelteFiles, startTime, onRebuildComplete) => {
|
|
21540
21662
|
for (const file4 of svelteFiles) {
|
|
21541
|
-
state.fileHashes.set(
|
|
21663
|
+
state.fileHashes.set(resolve37(file4), computeFileHash(file4));
|
|
21542
21664
|
}
|
|
21543
21665
|
markSsrCacheDirty("svelte");
|
|
21544
21666
|
const serverDuration = Date.now() - startTime;
|
|
@@ -21563,8 +21685,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21563
21685
|
const serverEntries = [...svelteServerPaths];
|
|
21564
21686
|
const clientEntries = [...svelteIndexPaths, ...svelteClientPaths];
|
|
21565
21687
|
const { getFrameworkGeneratedDir: getFrameworkGeneratedDir2 } = await Promise.resolve().then(() => (init_generatedDir(), exports_generatedDir));
|
|
21566
|
-
const serverRoot =
|
|
21567
|
-
const serverOutDir =
|
|
21688
|
+
const serverRoot = resolve37(getFrameworkGeneratedDir2("svelte"), "server");
|
|
21689
|
+
const serverOutDir = resolve37(buildDir, basename11(svelteDir));
|
|
21568
21690
|
const [serverResult, clientResult] = await Promise.all([
|
|
21569
21691
|
serverEntries.length > 0 ? bunBuild9({
|
|
21570
21692
|
entrypoints: serverEntries,
|
|
@@ -21661,7 +21783,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21661
21783
|
});
|
|
21662
21784
|
}, handleVueModuleServerPath = async (state, vueFiles, nonVueFiles, startTime, onRebuildComplete) => {
|
|
21663
21785
|
for (const file4 of [...vueFiles, ...nonVueFiles]) {
|
|
21664
|
-
state.fileHashes.set(
|
|
21786
|
+
state.fileHashes.set(resolve37(file4), computeFileHash(file4));
|
|
21665
21787
|
}
|
|
21666
21788
|
markSsrCacheDirty("vue");
|
|
21667
21789
|
await invalidateNonVueModules(nonVueFiles);
|
|
@@ -21689,7 +21811,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21689
21811
|
recursive: true,
|
|
21690
21812
|
withFileTypes: true
|
|
21691
21813
|
});
|
|
21692
|
-
return entries.filter((entry) => entry.isFile() && EMBER_PAGE_EXTENSIONS.some((ext) => entry.name.endsWith(ext))).map((entry) =>
|
|
21814
|
+
return entries.filter((entry) => entry.isFile() && EMBER_PAGE_EXTENSIONS.some((ext) => entry.name.endsWith(ext))).map((entry) => resolve37(emberPagesPath, entry.name));
|
|
21693
21815
|
} catch {
|
|
21694
21816
|
return [];
|
|
21695
21817
|
}
|
|
@@ -21701,10 +21823,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21701
21823
|
return state.manifest;
|
|
21702
21824
|
}
|
|
21703
21825
|
for (const file4 of emberFiles) {
|
|
21704
|
-
state.fileHashes.set(
|
|
21826
|
+
state.fileHashes.set(resolve37(file4), computeFileHash(file4));
|
|
21705
21827
|
}
|
|
21706
|
-
const emberPagesPath =
|
|
21707
|
-
const directPageEntries = emberFiles.filter((file4) =>
|
|
21828
|
+
const emberPagesPath = resolve37(emberDir, "pages");
|
|
21829
|
+
const directPageEntries = emberFiles.filter((file4) => resolve37(file4).startsWith(emberPagesPath));
|
|
21708
21830
|
const allPageEntries = directPageEntries.length > 0 ? directPageEntries : await collectAllEmberPages(emberPagesPath);
|
|
21709
21831
|
if (allPageEntries.length === 0) {
|
|
21710
21832
|
onRebuildComplete({ hmrState: state, manifest: state.manifest });
|
|
@@ -21714,14 +21836,14 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21714
21836
|
const { serverPaths } = await compileEmber2(allPageEntries, emberDir, process.cwd(), true);
|
|
21715
21837
|
for (const serverPath of serverPaths) {
|
|
21716
21838
|
const fileBase = basename11(serverPath, ".js");
|
|
21717
|
-
state.manifest[toPascal(fileBase)] =
|
|
21839
|
+
state.manifest[toPascal(fileBase)] = resolve37(serverPath);
|
|
21718
21840
|
}
|
|
21719
21841
|
const { invalidateEmberSsrCache: invalidateEmberSsrCache2 } = await Promise.resolve().then(() => (init_ember(), exports_ember));
|
|
21720
21842
|
invalidateEmberSsrCache2();
|
|
21721
21843
|
const duration = Date.now() - startTime;
|
|
21722
21844
|
const [primary] = emberFiles;
|
|
21723
21845
|
if (primary) {
|
|
21724
|
-
state.lastHmrPath =
|
|
21846
|
+
state.lastHmrPath = relative16(process.cwd(), primary).replace(/\\/g, "/");
|
|
21725
21847
|
state.lastHmrFramework = "ember";
|
|
21726
21848
|
logHmrUpdate(primary, "ember", duration);
|
|
21727
21849
|
}
|
|
@@ -21806,8 +21928,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21806
21928
|
if (!buildReference?.source) {
|
|
21807
21929
|
return;
|
|
21808
21930
|
}
|
|
21809
|
-
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname :
|
|
21810
|
-
islandFiles.add(
|
|
21931
|
+
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve37(dirname21(buildInfo.resolvedRegistryPath), buildReference.source);
|
|
21932
|
+
islandFiles.add(resolve37(sourcePath));
|
|
21811
21933
|
}, resolveIslandSourceFiles = async (config) => {
|
|
21812
21934
|
const registryPath = config.islands?.registry;
|
|
21813
21935
|
if (!registryPath) {
|
|
@@ -21815,7 +21937,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21815
21937
|
}
|
|
21816
21938
|
const buildInfo = await loadIslandRegistryBuildInfo(registryPath);
|
|
21817
21939
|
const islandFiles = new Set([
|
|
21818
|
-
|
|
21940
|
+
resolve37(buildInfo.resolvedRegistryPath)
|
|
21819
21941
|
]);
|
|
21820
21942
|
for (const definition of buildInfo.definitions) {
|
|
21821
21943
|
resolveIslandDefinitionSource(definition, buildInfo, islandFiles);
|
|
@@ -21826,7 +21948,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21826
21948
|
if (islandFiles.size === 0) {
|
|
21827
21949
|
return false;
|
|
21828
21950
|
}
|
|
21829
|
-
return filesToRebuild.some((file4) => islandFiles.has(
|
|
21951
|
+
return filesToRebuild.some((file4) => islandFiles.has(resolve37(file4)));
|
|
21830
21952
|
}, handleIslandSourceReload = async (state, config, filesToRebuild, manifest) => {
|
|
21831
21953
|
const shouldReload = await didStaticPagesNeedIslandRefresh(config, filesToRebuild);
|
|
21832
21954
|
if (!shouldReload) {
|
|
@@ -21861,10 +21983,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21861
21983
|
}, computeOutputPagesDir = (state, config, framework) => {
|
|
21862
21984
|
const isSingle = !config.reactDirectory && !config.svelteDirectory && !config.vueDirectory && (framework === "html" ? !config.htmxDirectory : !config.htmlDirectory);
|
|
21863
21985
|
if (isSingle) {
|
|
21864
|
-
return
|
|
21986
|
+
return resolve37(state.resolvedPaths.buildDir, "pages");
|
|
21865
21987
|
}
|
|
21866
21988
|
const dirName = framework === "html" ? basename11(config.htmlDirectory ?? "html") : basename11(config.htmxDirectory ?? "htmx");
|
|
21867
|
-
return
|
|
21989
|
+
return resolve37(state.resolvedPaths.buildDir, dirName, "pages");
|
|
21868
21990
|
}, processHtmlPageUpdate = async (state, pageFile, builtHtmlPagePath, manifest, duration) => {
|
|
21869
21991
|
try {
|
|
21870
21992
|
const { handleHTMLUpdate: handleHTMLUpdate2 } = await Promise.resolve().then(() => (init_simpleHTMLHMR(), exports_simpleHTMLHMR));
|
|
@@ -21903,7 +22025,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21903
22025
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmlPages, "*.html") : htmlPageFiles;
|
|
21904
22026
|
await runSequentially(pageFilesToUpdate, async (pageFile) => {
|
|
21905
22027
|
const htmlPageName = basename11(pageFile);
|
|
21906
|
-
const builtHtmlPagePath =
|
|
22028
|
+
const builtHtmlPagePath = resolve37(outputHtmlPages, htmlPageName);
|
|
21907
22029
|
await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration);
|
|
21908
22030
|
});
|
|
21909
22031
|
}, handleVueCssOnlyUpdate = (state, vueCssFiles, manifest, duration) => {
|
|
@@ -21964,11 +22086,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21964
22086
|
const baseName = fileName.replace(/\.vue$/, "");
|
|
21965
22087
|
const pascalName = toPascal(baseName);
|
|
21966
22088
|
const vueRoot = config.vueDirectory;
|
|
21967
|
-
const hmrId = vueRoot ?
|
|
22089
|
+
const hmrId = vueRoot ? relative16(vueRoot, vuePagePath).replace(/\\/g, "/").replace(/\.vue$/, "") : baseName;
|
|
21968
22090
|
const cssKey = `${pascalName}CSS`;
|
|
21969
22091
|
const cssUrl = manifest[cssKey] || null;
|
|
21970
22092
|
const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
|
|
21971
|
-
const hmrMeta = vueHmrMetadata2.get(
|
|
22093
|
+
const hmrMeta = vueHmrMetadata2.get(resolve37(vuePagePath));
|
|
21972
22094
|
const changeType = hmrMeta?.changeType ?? "full";
|
|
21973
22095
|
if (changeType === "style-only") {
|
|
21974
22096
|
broadcastVueStyleOnly(state, vuePagePath, baseName, cssUrl, hmrId, manifest, duration);
|
|
@@ -22153,7 +22275,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22153
22275
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmxPages, "*.html") : htmxPageFiles;
|
|
22154
22276
|
await runSequentially(pageFilesToUpdate, async (htmxPageFile) => {
|
|
22155
22277
|
const htmxPageName = basename11(htmxPageFile);
|
|
22156
|
-
const builtHtmxPagePath =
|
|
22278
|
+
const builtHtmxPagePath = resolve37(outputHtmxPages, htmxPageName);
|
|
22157
22279
|
await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration);
|
|
22158
22280
|
});
|
|
22159
22281
|
}, collectUpdatedModulePaths = (allModuleUpdates) => {
|
|
@@ -22262,7 +22384,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22262
22384
|
html = html.slice(0, bodyClose.index) + hmrScript + html.slice(bodyClose.index);
|
|
22263
22385
|
writeFs(destPath, html);
|
|
22264
22386
|
}, processMarkupFileFastPath = async (state, sourceFile, outputDir, framework, startTime, updateAssetPaths2, handleUpdate, readFs, writeFs) => {
|
|
22265
|
-
const destPath =
|
|
22387
|
+
const destPath = resolve37(outputDir, basename11(sourceFile));
|
|
22266
22388
|
const hmrScript = extractHmrScript(destPath, readFs);
|
|
22267
22389
|
const source = await Bun.file(sourceFile).text();
|
|
22268
22390
|
await Bun.write(destPath, source);
|
|
@@ -22572,7 +22694,7 @@ __export(exports_buildDepVendor, {
|
|
|
22572
22694
|
buildDepVendor: () => buildDepVendor
|
|
22573
22695
|
});
|
|
22574
22696
|
import { mkdirSync as mkdirSync13 } from "fs";
|
|
22575
|
-
import { join as
|
|
22697
|
+
import { join as join30 } from "path";
|
|
22576
22698
|
import { rm as rm10 } from "fs/promises";
|
|
22577
22699
|
var {build: bunBuild9, Glob: Glob9 } = globalThis.Bun;
|
|
22578
22700
|
var toSafeFileName6 = (specifier) => {
|
|
@@ -22585,12 +22707,12 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22585
22707
|
} catch {
|
|
22586
22708
|
return false;
|
|
22587
22709
|
}
|
|
22588
|
-
}, 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 = (file4) => file4.includes("node_modules") || file4.includes("/build/") || file4.includes("/dist/") || file4.includes("/indexes/"), isDepSpecifier = (path) => isBareSpecifier2(path) && !isFrameworkSpecifier(path) && !isAbsolutePackageSpecifier(path), isFrameworkRootCandidate = (path) => isBareSpecifier2(path) && isFrameworkSpecifier(path) && !isAbsolutePackageSpecifier(path), readFileSpecifiers = async (file4,
|
|
22710
|
+
}, 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 = (file4) => file4.includes("node_modules") || file4.includes("/build/") || file4.includes("/dist/") || file4.includes("/indexes/"), isDepSpecifier = (path) => isBareSpecifier2(path) && !isFrameworkSpecifier(path) && !isAbsolutePackageSpecifier(path), isFrameworkRootCandidate = (path) => isBareSpecifier2(path) && isFrameworkSpecifier(path) && !isAbsolutePackageSpecifier(path), readFileSpecifiers = async (file4, transpiler6) => {
|
|
22589
22711
|
const dep = [];
|
|
22590
22712
|
const framework = [];
|
|
22591
22713
|
try {
|
|
22592
22714
|
const content = await Bun.file(file4).text();
|
|
22593
|
-
for (const imp of
|
|
22715
|
+
for (const imp of transpiler6.scanImports(content)) {
|
|
22594
22716
|
if (isDepSpecifier(imp.path))
|
|
22595
22717
|
dep.push(imp.path);
|
|
22596
22718
|
else if (isFrameworkRootCandidate(imp.path))
|
|
@@ -22607,9 +22729,9 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22607
22729
|
} catch {
|
|
22608
22730
|
return empty;
|
|
22609
22731
|
}
|
|
22610
|
-
}, collectDirSpecifiers = async (dir,
|
|
22732
|
+
}, collectDirSpecifiers = async (dir, transpiler6, dep, framework) => {
|
|
22611
22733
|
const files = await scanDirFiles(dir);
|
|
22612
|
-
const results = await Promise.all(files.map((file4) => readFileSpecifiers(file4,
|
|
22734
|
+
const results = await Promise.all(files.map((file4) => readFileSpecifiers(file4, transpiler6)));
|
|
22613
22735
|
for (const result of results) {
|
|
22614
22736
|
for (const spec of result.dep)
|
|
22615
22737
|
dep.add(spec);
|
|
@@ -22619,15 +22741,15 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22619
22741
|
}, scanBareImports = async (directories) => {
|
|
22620
22742
|
const dep = new Set;
|
|
22621
22743
|
const framework = new Set;
|
|
22622
|
-
const
|
|
22623
|
-
await Promise.all(directories.map((dir) => collectDirSpecifiers(dir,
|
|
22744
|
+
const transpiler6 = new Bun.Transpiler({ loader: "tsx" });
|
|
22745
|
+
await Promise.all(directories.map((dir) => collectDirSpecifiers(dir, transpiler6, dep, framework)));
|
|
22624
22746
|
return {
|
|
22625
22747
|
dep: Array.from(dep).filter(isResolvable4),
|
|
22626
22748
|
framework: Array.from(framework).filter(isResolvable4)
|
|
22627
22749
|
};
|
|
22628
22750
|
}, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
|
|
22629
22751
|
const { readFileSync: readFileSync20 } = await import("fs");
|
|
22630
|
-
const
|
|
22752
|
+
const transpiler6 = new Bun.Transpiler({ loader: "js" });
|
|
22631
22753
|
const newSpecs = new Set;
|
|
22632
22754
|
for (const spec of specs) {
|
|
22633
22755
|
if (alreadyScanned.has(spec))
|
|
@@ -22647,7 +22769,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22647
22769
|
}
|
|
22648
22770
|
let imports;
|
|
22649
22771
|
try {
|
|
22650
|
-
imports =
|
|
22772
|
+
imports = transpiler6.scanImports(content);
|
|
22651
22773
|
} catch {
|
|
22652
22774
|
continue;
|
|
22653
22775
|
}
|
|
@@ -22683,7 +22805,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22683
22805
|
}), buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
|
|
22684
22806
|
const entries = await Promise.all(specifiers.map(async (specifier) => {
|
|
22685
22807
|
const safeName = toSafeFileName6(specifier);
|
|
22686
|
-
const entryPath =
|
|
22808
|
+
const entryPath = join30(tmpDir, `${safeName}.ts`);
|
|
22687
22809
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
22688
22810
|
return { entryPath, specifier };
|
|
22689
22811
|
}));
|
|
@@ -22744,9 +22866,9 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22744
22866
|
const { dep: initialSpecs, framework: frameworkRoots } = await scanBareImports(directories);
|
|
22745
22867
|
if (initialSpecs.length === 0 && frameworkRoots.length === 0)
|
|
22746
22868
|
return {};
|
|
22747
|
-
const vendorDir =
|
|
22869
|
+
const vendorDir = join30(buildDir, "vendor");
|
|
22748
22870
|
mkdirSync13(vendorDir, { recursive: true });
|
|
22749
|
-
const tmpDir =
|
|
22871
|
+
const tmpDir = join30(buildDir, "_dep_vendor_tmp");
|
|
22750
22872
|
mkdirSync13(tmpDir, { recursive: true });
|
|
22751
22873
|
const allSpecs = new Set(initialSpecs);
|
|
22752
22874
|
const alreadyScanned = new Set;
|
|
@@ -22829,7 +22951,7 @@ __export(exports_devBuild, {
|
|
|
22829
22951
|
});
|
|
22830
22952
|
import { readdir as readdir5 } from "fs/promises";
|
|
22831
22953
|
import { statSync as statSync5 } from "fs";
|
|
22832
|
-
import { resolve as
|
|
22954
|
+
import { resolve as resolve38 } from "path";
|
|
22833
22955
|
var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
22834
22956
|
const configuredDirs = [
|
|
22835
22957
|
config.reactDirectory,
|
|
@@ -22852,7 +22974,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
22852
22974
|
return Object.keys(config).length > 0 ? config : null;
|
|
22853
22975
|
}, reloadConfig = async () => {
|
|
22854
22976
|
try {
|
|
22855
|
-
const configPath2 =
|
|
22977
|
+
const configPath2 = resolve38(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
22856
22978
|
const source = await Bun.file(configPath2).text();
|
|
22857
22979
|
return parseDirectoryConfig(source);
|
|
22858
22980
|
} catch {
|
|
@@ -22937,7 +23059,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
22937
23059
|
state.fileChangeQueue.clear();
|
|
22938
23060
|
}
|
|
22939
23061
|
}, handleCachedReload = async () => {
|
|
22940
|
-
const serverMtime = statSync5(
|
|
23062
|
+
const serverMtime = statSync5(resolve38(Bun.main)).mtimeMs;
|
|
22941
23063
|
const lastMtime = globalThis.__hmrServerMtime;
|
|
22942
23064
|
globalThis.__hmrServerMtime = serverMtime;
|
|
22943
23065
|
const cached = globalThis.__hmrDevResult;
|
|
@@ -22974,8 +23096,8 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
22974
23096
|
return true;
|
|
22975
23097
|
}, resolveAbsoluteVersion2 = async () => {
|
|
22976
23098
|
const candidates = [
|
|
22977
|
-
|
|
22978
|
-
|
|
23099
|
+
resolve38(import.meta.dir, "..", "..", "package.json"),
|
|
23100
|
+
resolve38(import.meta.dir, "..", "package.json")
|
|
22979
23101
|
];
|
|
22980
23102
|
const [candidate, ...remaining] = candidates;
|
|
22981
23103
|
if (!candidate) {
|
|
@@ -23001,7 +23123,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
23001
23123
|
const entries = await readdir5(vendorDir).catch(() => emptyStringArray);
|
|
23002
23124
|
await Promise.all(entries.filter((entry) => entry.endsWith(".js")).map(async (entry) => {
|
|
23003
23125
|
const webPath = `/${framework}/vendor/${entry}`;
|
|
23004
|
-
const bytes = await Bun.file(
|
|
23126
|
+
const bytes = await Bun.file(resolve38(vendorDir, entry)).bytes();
|
|
23005
23127
|
assetStore.set(webPath, bytes);
|
|
23006
23128
|
}));
|
|
23007
23129
|
}, devBuild = async (config) => {
|
|
@@ -23069,11 +23191,11 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
23069
23191
|
cleanStaleAssets(state.assetStore, manifest, state.resolvedPaths.buildDir);
|
|
23070
23192
|
recordStep("populate asset store", stepStartedAt);
|
|
23071
23193
|
stepStartedAt = performance.now();
|
|
23072
|
-
const reactVendorDir =
|
|
23073
|
-
const angularVendorDir =
|
|
23074
|
-
const svelteVendorDir =
|
|
23075
|
-
const vueVendorDir =
|
|
23076
|
-
const depVendorDir =
|
|
23194
|
+
const reactVendorDir = resolve38(state.resolvedPaths.buildDir, "react", "vendor");
|
|
23195
|
+
const angularVendorDir = resolve38(state.resolvedPaths.buildDir, "angular", "vendor");
|
|
23196
|
+
const svelteVendorDir = resolve38(state.resolvedPaths.buildDir, "svelte", "vendor");
|
|
23197
|
+
const vueVendorDir = resolve38(state.resolvedPaths.buildDir, "vue", "vendor");
|
|
23198
|
+
const depVendorDir = resolve38(state.resolvedPaths.buildDir, "vendor");
|
|
23077
23199
|
const { buildDepVendor: buildDepVendor2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
|
|
23078
23200
|
const [, angularSpecs, , , , , depPaths] = await Promise.all([
|
|
23079
23201
|
config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
|
|
@@ -23151,7 +23273,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
23151
23273
|
manifest
|
|
23152
23274
|
};
|
|
23153
23275
|
globalThis.__hmrDevResult = result;
|
|
23154
|
-
globalThis.__hmrServerMtime = statSync5(
|
|
23276
|
+
globalThis.__hmrServerMtime = statSync5(resolve38(Bun.main)).mtimeMs;
|
|
23155
23277
|
return result;
|
|
23156
23278
|
};
|
|
23157
23279
|
var init_devBuild = __esm(() => {
|
|
@@ -23188,5 +23310,5 @@ export {
|
|
|
23188
23310
|
build
|
|
23189
23311
|
};
|
|
23190
23312
|
|
|
23191
|
-
//# debugId=
|
|
23313
|
+
//# debugId=6984146CF45D981964756E2164756E21
|
|
23192
23314
|
//# sourceMappingURL=build.js.map
|