@absolutejs/absolute 0.19.0-beta.931 → 0.19.0-beta.933
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +285 -136
- package/dist/angular/index.js.map +6 -5
- package/dist/angular/server.js +267 -118
- package/dist/angular/server.js.map +6 -5
- package/dist/build.js +807 -584
- package/dist/build.js.map +17 -16
- package/dist/dev/client/handlers/angularHmrShim.ts +4 -1
- package/dist/dev/client/handlers/angularRemount.ts +2 -2
- package/dist/dev/client/handlers/angularRemountWiring.ts +1 -4
- package/dist/dev/client/vendor/lview/lViewOps.ts +8 -6
- package/dist/index.js +925 -651
- package/dist/index.js.map +21 -19
- package/dist/islands/index.js +105 -2
- package/dist/islands/index.js.map +5 -4
- package/dist/react/index.js +167 -18
- package/dist/react/index.js.map +6 -5
- package/dist/react/server.js +63 -17
- package/dist/react/server.js.map +3 -3
- package/dist/src/core/normalizeIslandProps.d.ts +15 -0
- package/dist/src/core/vueServerModule.d.ts +1 -0
- package/dist/src/utils/defineConvention.d.ts +3 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/vue/Island.browser.d.ts +36 -12
- package/dist/src/vue/Island.d.ts +35 -11
- package/dist/src/vue/pageHandler.d.ts +8 -0
- package/dist/svelte/index.js +167 -18
- package/dist/svelte/index.js.map +6 -5
- package/dist/svelte/server.js +63 -17
- package/dist/svelte/server.js.map +3 -3
- package/dist/types/conventions.d.ts +5 -0
- package/dist/vue/browser.js +57 -4
- package/dist/vue/browser.js.map +5 -4
- package/dist/vue/index.js +234 -24
- package/dist/vue/index.js.map +9 -7
- package/dist/vue/server.js +73 -20
- package/dist/vue/server.js.map +4 -4
- package/package.json +1 -1
package/dist/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,14 +12871,14 @@ 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
|
});
|
|
12773
12878
|
|
|
12774
12879
|
// node_modules/content-tag/pkg/node/content_tag.cjs
|
|
12775
12880
|
var require_content_tag = __commonJS((exports, module) => {
|
|
12776
|
-
var __dirname = "/
|
|
12881
|
+
var __dirname = "/home/alexkahn/abs/absolutejs/node_modules/content-tag/pkg/node";
|
|
12777
12882
|
var imports = {};
|
|
12778
12883
|
imports["__wbindgen_placeholder__"] = exports;
|
|
12779
12884
|
var wasm;
|
|
@@ -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
|
}));
|
|
@@ -14700,6 +14805,15 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14700
14805
|
conventions: undefined,
|
|
14701
14806
|
pageFiles: []
|
|
14702
14807
|
};
|
|
14808
|
+
const htmlConventionDirs = [
|
|
14809
|
+
reactPagesPath,
|
|
14810
|
+
sveltePagesPath,
|
|
14811
|
+
vuePagesPath,
|
|
14812
|
+
angularPagesPath,
|
|
14813
|
+
emberPagesPath,
|
|
14814
|
+
htmlPagesPath,
|
|
14815
|
+
htmxPagesPath
|
|
14816
|
+
].filter((path) => Boolean(path));
|
|
14703
14817
|
const [
|
|
14704
14818
|
,
|
|
14705
14819
|
allReactEntries,
|
|
@@ -14709,6 +14823,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14709
14823
|
vueConventionResult,
|
|
14710
14824
|
angularConventionResult,
|
|
14711
14825
|
emberConventionResult,
|
|
14826
|
+
htmlConventionResults,
|
|
14712
14827
|
allGlobalCssEntries
|
|
14713
14828
|
] = await Promise.all([
|
|
14714
14829
|
tailwindPromise,
|
|
@@ -14719,6 +14834,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14719
14834
|
vuePagesPath ? tracePhase("scan/vue-conventions", () => scanConventions(vuePagesPath, "*.vue")) : emptyConventionResult,
|
|
14720
14835
|
angularPagesPath ? tracePhase("scan/angular-conventions", () => scanConventions(angularPagesPath, "*.ts")) : emptyConventionResult,
|
|
14721
14836
|
emberPagesPath ? tracePhase("scan/ember-conventions", () => scanConventions(emberPagesPath, "*.{gjs,gts,ts}")) : emptyConventionResult,
|
|
14837
|
+
tracePhase("scan/html-conventions", async () => Promise.all(htmlConventionDirs.map((dir) => scanConventions(dir, "*.html")))),
|
|
14722
14838
|
stylesDir ? tracePhase("scan/css", () => scanCssEntryPoints(stylesDir, stylesIgnore)) : []
|
|
14723
14839
|
]);
|
|
14724
14840
|
const allSvelteEntries = svelteConventionResult.pageFiles;
|
|
@@ -14736,15 +14852,99 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14736
14852
|
conventionsMap.angular = angularConventionResult.conventions;
|
|
14737
14853
|
if (emberConventionResult.conventions)
|
|
14738
14854
|
conventionsMap.ember = emberConventionResult.conventions;
|
|
14739
|
-
const
|
|
14855
|
+
const htmlDefaults = {};
|
|
14856
|
+
const htmlPages = {};
|
|
14857
|
+
const htmlConventionSources = [];
|
|
14858
|
+
for (let idx = 0;idx < htmlConventionResults.length; idx++) {
|
|
14859
|
+
const result = htmlConventionResults[idx];
|
|
14860
|
+
if (!result?.conventions)
|
|
14861
|
+
continue;
|
|
14862
|
+
const dirLabel = htmlConventionDirs[idx] ?? "<unknown>";
|
|
14863
|
+
const { defaults: scannedDefaults, pages: scannedPages } = result.conventions;
|
|
14864
|
+
if (scannedDefaults?.error) {
|
|
14865
|
+
if (htmlDefaults.error) {
|
|
14866
|
+
logWarn(`Multiple error.html files found; using ${htmlDefaults.error} and ignoring ${scannedDefaults.error} (${dirLabel}).`);
|
|
14867
|
+
} else {
|
|
14868
|
+
htmlDefaults.error = scannedDefaults.error;
|
|
14869
|
+
htmlConventionSources.push(scannedDefaults.error);
|
|
14870
|
+
}
|
|
14871
|
+
}
|
|
14872
|
+
if (scannedDefaults?.notFound) {
|
|
14873
|
+
if (htmlDefaults.notFound) {
|
|
14874
|
+
logWarn(`Multiple not-found.html files found; using ${htmlDefaults.notFound} and ignoring ${scannedDefaults.notFound} (${dirLabel}).`);
|
|
14875
|
+
} else {
|
|
14876
|
+
htmlDefaults.notFound = scannedDefaults.notFound;
|
|
14877
|
+
htmlConventionSources.push(scannedDefaults.notFound);
|
|
14878
|
+
}
|
|
14879
|
+
}
|
|
14880
|
+
if (scannedDefaults?.loading && !htmlDefaults.loading) {
|
|
14881
|
+
htmlDefaults.loading = scannedDefaults.loading;
|
|
14882
|
+
htmlConventionSources.push(scannedDefaults.loading);
|
|
14883
|
+
}
|
|
14884
|
+
if (scannedPages) {
|
|
14885
|
+
for (const [pageName, page] of Object.entries(scannedPages)) {
|
|
14886
|
+
if (!htmlPages[pageName])
|
|
14887
|
+
htmlPages[pageName] = {};
|
|
14888
|
+
if (page.error && !htmlPages[pageName].error) {
|
|
14889
|
+
htmlPages[pageName].error = page.error;
|
|
14890
|
+
htmlConventionSources.push(page.error);
|
|
14891
|
+
}
|
|
14892
|
+
if (page.loading && !htmlPages[pageName].loading) {
|
|
14893
|
+
htmlPages[pageName].loading = page.loading;
|
|
14894
|
+
htmlConventionSources.push(page.loading);
|
|
14895
|
+
}
|
|
14896
|
+
}
|
|
14897
|
+
}
|
|
14898
|
+
}
|
|
14899
|
+
if (htmlDefaults.error || htmlDefaults.notFound || htmlDefaults.loading || Object.keys(htmlPages).length > 0) {
|
|
14900
|
+
const htmlConventionsOutDir = join25(buildPath, "conventions", "html");
|
|
14901
|
+
mkdirSync11(htmlConventionsOutDir, { recursive: true });
|
|
14902
|
+
const htmlPathRemap = new Map;
|
|
14903
|
+
for (const sourcePath of htmlConventionSources) {
|
|
14904
|
+
const dest = join25(htmlConventionsOutDir, basename8(sourcePath));
|
|
14905
|
+
cpSync(sourcePath, dest, { force: true });
|
|
14906
|
+
htmlPathRemap.set(sourcePath, dest);
|
|
14907
|
+
}
|
|
14908
|
+
const remap = (path) => path ? htmlPathRemap.get(path) ?? path : undefined;
|
|
14909
|
+
const htmlConventions = {};
|
|
14910
|
+
const remappedDefaults = {};
|
|
14911
|
+
const errorRemap = remap(htmlDefaults.error);
|
|
14912
|
+
if (errorRemap)
|
|
14913
|
+
remappedDefaults.error = errorRemap;
|
|
14914
|
+
const notFoundRemap = remap(htmlDefaults.notFound);
|
|
14915
|
+
if (notFoundRemap)
|
|
14916
|
+
remappedDefaults.notFound = notFoundRemap;
|
|
14917
|
+
const loadingRemap = remap(htmlDefaults.loading);
|
|
14918
|
+
if (loadingRemap)
|
|
14919
|
+
remappedDefaults.loading = loadingRemap;
|
|
14920
|
+
if (remappedDefaults.error || remappedDefaults.notFound || remappedDefaults.loading) {
|
|
14921
|
+
htmlConventions.defaults = remappedDefaults;
|
|
14922
|
+
}
|
|
14923
|
+
if (Object.keys(htmlPages).length > 0) {
|
|
14924
|
+
const remappedPages = {};
|
|
14925
|
+
for (const [pageName, page] of Object.entries(htmlPages)) {
|
|
14926
|
+
const entry = {};
|
|
14927
|
+
const errorPath = remap(page.error);
|
|
14928
|
+
if (errorPath)
|
|
14929
|
+
entry.error = errorPath;
|
|
14930
|
+
const loadingPath = remap(page.loading);
|
|
14931
|
+
if (loadingPath)
|
|
14932
|
+
entry.loading = loadingPath;
|
|
14933
|
+
remappedPages[pageName] = entry;
|
|
14934
|
+
}
|
|
14935
|
+
htmlConventions.pages = remappedPages;
|
|
14936
|
+
}
|
|
14937
|
+
conventionsMap.html = htmlConventions;
|
|
14938
|
+
}
|
|
14939
|
+
const notFoundFrameworks = ["react", "svelte", "vue", "angular", "ember", "html"].filter((framework) => conventionsMap[framework]?.defaults?.notFound);
|
|
14740
14940
|
if (notFoundFrameworks.length > 1) {
|
|
14741
14941
|
logWarn(`Multiple frameworks define not-found convention files: ${notFoundFrameworks.join(", ")}. Only one will be used (priority: ${notFoundFrameworks[0]}). Remove not-found files from other frameworks to avoid ambiguity.`);
|
|
14742
14942
|
}
|
|
14743
14943
|
const shouldIncludeHtmlAssets = !isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/html/") && (f2.endsWith(".html") || isStylePath(f2)));
|
|
14744
14944
|
const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
|
|
14745
|
-
if (entry.startsWith(
|
|
14945
|
+
if (entry.startsWith(resolve22(reactIndexesPath))) {
|
|
14746
14946
|
const pageName = basename8(entry, ".tsx");
|
|
14747
|
-
return
|
|
14947
|
+
return join25(reactPagesPath, `${pageName}.tsx`);
|
|
14748
14948
|
}
|
|
14749
14949
|
return null;
|
|
14750
14950
|
}) : allReactEntries;
|
|
@@ -14821,7 +15021,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14821
15021
|
const clientPath = islandSvelteClientPaths[idx];
|
|
14822
15022
|
if (!sourcePath || !clientPath)
|
|
14823
15023
|
continue;
|
|
14824
|
-
islandSvelteClientPathMap.set(
|
|
15024
|
+
islandSvelteClientPathMap.set(resolve22(sourcePath), clientPath);
|
|
14825
15025
|
}
|
|
14826
15026
|
const islandVueClientPathMap = new Map;
|
|
14827
15027
|
for (let idx = 0;idx < islandVueSources.length; idx++) {
|
|
@@ -14829,7 +15029,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14829
15029
|
const clientPath = islandVueClientPaths[idx];
|
|
14830
15030
|
if (!sourcePath || !clientPath)
|
|
14831
15031
|
continue;
|
|
14832
|
-
islandVueClientPathMap.set(
|
|
15032
|
+
islandVueClientPathMap.set(resolve22(sourcePath), clientPath);
|
|
14833
15033
|
}
|
|
14834
15034
|
const islandAngularClientPathMap = new Map;
|
|
14835
15035
|
for (let idx = 0;idx < islandAngularSources.length; idx++) {
|
|
@@ -14837,7 +15037,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14837
15037
|
const clientPath = islandAngularClientPaths[idx];
|
|
14838
15038
|
if (!sourcePath || !clientPath)
|
|
14839
15039
|
continue;
|
|
14840
|
-
islandAngularClientPathMap.set(
|
|
15040
|
+
islandAngularClientPathMap.set(resolve22(sourcePath), clientPath);
|
|
14841
15041
|
}
|
|
14842
15042
|
const reactConventionSources = collectConventionSourceFiles(conventionsMap.react);
|
|
14843
15043
|
const svelteConventionSources = collectConventionSourceFiles(conventionsMap.svelte);
|
|
@@ -14848,7 +15048,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14848
15048
|
const compileReactConventions = async () => {
|
|
14849
15049
|
if (reactConventionSources.length === 0)
|
|
14850
15050
|
return emptyStringArray;
|
|
14851
|
-
const destDir =
|
|
15051
|
+
const destDir = join25(buildPath, "conventions", "react");
|
|
14852
15052
|
rmSync2(destDir, { force: true, recursive: true });
|
|
14853
15053
|
mkdirSync11(destDir, { recursive: true });
|
|
14854
15054
|
const destPaths = [];
|
|
@@ -14864,7 +15064,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14864
15064
|
naming: `${idx}-[name].[ext]`,
|
|
14865
15065
|
outdir: destDir,
|
|
14866
15066
|
plugins: [stylePreprocessorPlugin2],
|
|
14867
|
-
root:
|
|
15067
|
+
root: dirname14(source),
|
|
14868
15068
|
target: "bun",
|
|
14869
15069
|
throw: false,
|
|
14870
15070
|
tsconfig: "./tsconfig.json"
|
|
@@ -14892,7 +15092,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14892
15092
|
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
15093
|
]);
|
|
14894
15094
|
const bundleConventionFiles = async (framework, compiledPaths) => {
|
|
14895
|
-
const destDir =
|
|
15095
|
+
const destDir = join25(buildPath, "conventions", framework);
|
|
14896
15096
|
rmSync2(destDir, { force: true, recursive: true });
|
|
14897
15097
|
mkdirSync11(destDir, { recursive: true });
|
|
14898
15098
|
const destPaths = [];
|
|
@@ -14966,7 +15166,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14966
15166
|
}
|
|
14967
15167
|
})) : {
|
|
14968
15168
|
entries: [],
|
|
14969
|
-
generatedRoot:
|
|
15169
|
+
generatedRoot: join25(buildPath, "_island_entries")
|
|
14970
15170
|
};
|
|
14971
15171
|
const islandClientEntryPoints = islandEntryResult.entries.map((entry) => entry.entryPath);
|
|
14972
15172
|
if (serverEntryPoints.length === 0 && reactClientEntryPoints.length === 0 && nonReactClientEntryPoints.length === 0 && islandClientEntryPoints.length === 0 && htmxDir === undefined && htmlDir === undefined) {
|
|
@@ -15002,7 +15202,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15002
15202
|
return {};
|
|
15003
15203
|
}
|
|
15004
15204
|
if (hmr && reactIndexesPath && reactClientEntryPoints.length > 0) {
|
|
15005
|
-
const refreshEntry =
|
|
15205
|
+
const refreshEntry = join25(reactIndexesPath, "_refresh.tsx");
|
|
15006
15206
|
if (!reactClientEntryPoints.includes(refreshEntry))
|
|
15007
15207
|
reactClientEntryPoints.push(refreshEntry);
|
|
15008
15208
|
}
|
|
@@ -15101,19 +15301,19 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15101
15301
|
throw: false
|
|
15102
15302
|
}, resolveBunBuildOverride(bunBuildConfig, "reactClient")) : undefined;
|
|
15103
15303
|
if (reactDir && reactClientEntryPoints.length > 0) {
|
|
15104
|
-
rmSync2(
|
|
15304
|
+
rmSync2(join25(buildPath, "react", "generated", "indexes"), {
|
|
15105
15305
|
force: true,
|
|
15106
15306
|
recursive: true
|
|
15107
15307
|
});
|
|
15108
15308
|
}
|
|
15109
15309
|
if (angularDir && angularClientPaths.length > 0) {
|
|
15110
|
-
rmSync2(
|
|
15310
|
+
rmSync2(join25(buildPath, "angular", "indexes"), {
|
|
15111
15311
|
force: true,
|
|
15112
15312
|
recursive: true
|
|
15113
15313
|
});
|
|
15114
15314
|
}
|
|
15115
15315
|
if (islandClientEntryPoints.length > 0) {
|
|
15116
|
-
rmSync2(
|
|
15316
|
+
rmSync2(join25(buildPath, "islands"), {
|
|
15117
15317
|
force: true,
|
|
15118
15318
|
recursive: true
|
|
15119
15319
|
});
|
|
@@ -15196,7 +15396,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15196
15396
|
globalCssEntries.length > 0 ? tracePhase("bun/global-css", () => bunBuild7(mergeBunBuildConfig({
|
|
15197
15397
|
entrypoints: globalCssEntries,
|
|
15198
15398
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
15199
|
-
outdir: stylesDir ?
|
|
15399
|
+
outdir: stylesDir ? join25(buildPath, basename8(stylesDir)) : buildPath,
|
|
15200
15400
|
plugins: [stylePreprocessorPlugin2],
|
|
15201
15401
|
root: stylesDir || clientRoot,
|
|
15202
15402
|
target: "browser",
|
|
@@ -15205,7 +15405,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15205
15405
|
vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () => bunBuild7(mergeBunBuildConfig({
|
|
15206
15406
|
entrypoints: vueCssPaths,
|
|
15207
15407
|
naming: `[name].[hash].[ext]`,
|
|
15208
|
-
outdir:
|
|
15408
|
+
outdir: join25(buildPath, assetsPath ? basename8(assetsPath) : "assets", "css"),
|
|
15209
15409
|
target: "browser",
|
|
15210
15410
|
throw: false
|
|
15211
15411
|
}, resolveBunBuildOverride(bunBuildConfig, "vueCss")))) : undefined
|
|
@@ -15272,10 +15472,10 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15272
15472
|
if (serverOutputs.length > 0 && angularServerVendorPaths2 && Object.keys(angularServerVendorPaths2).length > 0) {
|
|
15273
15473
|
const { rewriteBuildOutputsWith: rewriteBuildOutputsWith2 } = await Promise.resolve().then(() => (init_rewriteImportsPlugin(), exports_rewriteImportsPlugin));
|
|
15274
15474
|
await tracePhase("postprocess/server-angular-vendor-imports", () => rewriteBuildOutputsWith2(serverOutputs, (artifact) => {
|
|
15275
|
-
const fileDir =
|
|
15475
|
+
const fileDir = dirname14(artifact.path);
|
|
15276
15476
|
const relativePaths = {};
|
|
15277
15477
|
for (const [specifier, absolute] of Object.entries(angularServerVendorPaths2)) {
|
|
15278
|
-
const rel =
|
|
15478
|
+
const rel = relative12(fileDir, absolute);
|
|
15279
15479
|
relativePaths[specifier] = rel.startsWith(".") ? rel : `./${rel}`;
|
|
15280
15480
|
}
|
|
15281
15481
|
return relativePaths;
|
|
@@ -15344,7 +15544,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15344
15544
|
if (skipAngularClientBundle) {
|
|
15345
15545
|
for (const clientPath of angularClientPaths) {
|
|
15346
15546
|
const fileBase = basename8(clientPath, ".js");
|
|
15347
|
-
const relFromCwd =
|
|
15547
|
+
const relFromCwd = relative12(projectRoot, clientPath).replace(/\\/g, "/");
|
|
15348
15548
|
manifest[`${toPascal(fileBase)}Index`] = `/@src/${relFromCwd}`;
|
|
15349
15549
|
}
|
|
15350
15550
|
}
|
|
@@ -15366,7 +15566,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15366
15566
|
const processHtmlPages = async () => {
|
|
15367
15567
|
if (!(htmlDir && htmlPagesPath))
|
|
15368
15568
|
return;
|
|
15369
|
-
const outputHtmlPages = isSingle ?
|
|
15569
|
+
const outputHtmlPages = isSingle ? join25(buildPath, "pages") : join25(buildPath, basename8(htmlDir), "pages");
|
|
15370
15570
|
mkdirSync11(outputHtmlPages, { recursive: true });
|
|
15371
15571
|
cpSync(htmlPagesPath, outputHtmlPages, {
|
|
15372
15572
|
force: true,
|
|
@@ -15388,14 +15588,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15388
15588
|
const processHtmxPages = async () => {
|
|
15389
15589
|
if (!(htmxDir && htmxPagesPath))
|
|
15390
15590
|
return;
|
|
15391
|
-
const outputHtmxPages = isSingle ?
|
|
15591
|
+
const outputHtmxPages = isSingle ? join25(buildPath, "pages") : join25(buildPath, basename8(htmxDir), "pages");
|
|
15392
15592
|
mkdirSync11(outputHtmxPages, { recursive: true });
|
|
15393
15593
|
cpSync(htmxPagesPath, outputHtmxPages, {
|
|
15394
15594
|
force: true,
|
|
15395
15595
|
recursive: true
|
|
15396
15596
|
});
|
|
15397
15597
|
if (shouldCopyHtmx) {
|
|
15398
|
-
const htmxDestDir = isSingle ? buildPath :
|
|
15598
|
+
const htmxDestDir = isSingle ? buildPath : join25(buildPath, basename8(htmxDir));
|
|
15399
15599
|
copyHtmxVendor(htmxDir, htmxDestDir);
|
|
15400
15600
|
}
|
|
15401
15601
|
if (shouldUpdateHtmxAssetPaths) {
|
|
@@ -15457,9 +15657,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15457
15657
|
writeBuildTrace(buildPath);
|
|
15458
15658
|
return { conventions: conventionsMap, manifest };
|
|
15459
15659
|
}
|
|
15460
|
-
writeFileSync7(
|
|
15660
|
+
writeFileSync7(join25(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
|
|
15461
15661
|
if (Object.keys(conventionsMap).length > 0) {
|
|
15462
|
-
writeFileSync7(
|
|
15662
|
+
writeFileSync7(join25(buildPath, "conventions.json"), JSON.stringify(conventionsMap, null, "\t"));
|
|
15463
15663
|
}
|
|
15464
15664
|
writeBuildTrace(buildPath);
|
|
15465
15665
|
if (tailwind && mode === "production") {
|
|
@@ -15560,7 +15760,7 @@ var init_build = __esm(() => {
|
|
|
15560
15760
|
|
|
15561
15761
|
// src/build/buildEmberVendor.ts
|
|
15562
15762
|
import { mkdirSync as mkdirSync12, existsSync as existsSync20 } from "fs";
|
|
15563
|
-
import { join as
|
|
15763
|
+
import { join as join26 } from "path";
|
|
15564
15764
|
import { rm as rm9 } from "fs/promises";
|
|
15565
15765
|
var {build: bunBuild8 } = globalThis.Bun;
|
|
15566
15766
|
var toSafeFileName5 = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_"), generateMacrosShim = () => `// Generated shim for @embroider/macros \u2014 provides minimal runtime
|
|
@@ -15612,7 +15812,7 @@ export const importSync = (specifier) => {
|
|
|
15612
15812
|
if (standaloneSpecifiers.has(specifier)) {
|
|
15613
15813
|
return { resolveTo: specifier, specifier };
|
|
15614
15814
|
}
|
|
15615
|
-
const emberInternalPath =
|
|
15815
|
+
const emberInternalPath = join26(cwd2, "node_modules/ember-source/dist/packages", specifier, "index.js");
|
|
15616
15816
|
if (!existsSync20(emberInternalPath)) {
|
|
15617
15817
|
throw new Error(`Ember vendor build: cannot find ${specifier} at ${emberInternalPath}. ` + `Is ember-source installed and at least 6.12?`);
|
|
15618
15818
|
}
|
|
@@ -15644,7 +15844,7 @@ export const importSync = (specifier) => {
|
|
|
15644
15844
|
if (standalonePackages.has(args.path)) {
|
|
15645
15845
|
return;
|
|
15646
15846
|
}
|
|
15647
|
-
const internal =
|
|
15847
|
+
const internal = join26(cwd2, "node_modules/ember-source/dist/packages", args.path, "index.js");
|
|
15648
15848
|
if (existsSync20(internal)) {
|
|
15649
15849
|
return { path: internal };
|
|
15650
15850
|
}
|
|
@@ -15652,16 +15852,16 @@ export const importSync = (specifier) => {
|
|
|
15652
15852
|
});
|
|
15653
15853
|
}
|
|
15654
15854
|
}), buildEmberVendor = async (buildDir, cwd2 = process.cwd()) => {
|
|
15655
|
-
const vendorDir =
|
|
15855
|
+
const vendorDir = join26(buildDir, "ember", "vendor");
|
|
15656
15856
|
mkdirSync12(vendorDir, { recursive: true });
|
|
15657
|
-
const tmpDir =
|
|
15857
|
+
const tmpDir = join26(buildDir, "_ember_vendor_tmp");
|
|
15658
15858
|
mkdirSync12(tmpDir, { recursive: true });
|
|
15659
|
-
const macrosShimPath =
|
|
15859
|
+
const macrosShimPath = join26(tmpDir, "embroider_macros_shim.js");
|
|
15660
15860
|
await Bun.write(macrosShimPath, generateMacrosShim());
|
|
15661
15861
|
const resolutions = REQUIRED_EMBER_SPECIFIERS.map((specifier) => resolveEmberSpecifier(specifier, cwd2));
|
|
15662
15862
|
const entrypoints = await Promise.all(resolutions.map(async (resolution) => {
|
|
15663
15863
|
const safeName = toSafeFileName5(resolution.specifier);
|
|
15664
|
-
const entryPath =
|
|
15864
|
+
const entryPath = join26(tmpDir, `${safeName}.js`);
|
|
15665
15865
|
const source = resolution.specifier === "@embroider/macros" ? `export * from ${JSON.stringify(macrosShimPath)};
|
|
15666
15866
|
` : generateVendorEntrySource2(resolution);
|
|
15667
15867
|
await Bun.write(entryPath, source);
|
|
@@ -15707,7 +15907,7 @@ var init_buildEmberVendor = __esm(() => {
|
|
|
15707
15907
|
// src/dev/dependencyGraph.ts
|
|
15708
15908
|
import { existsSync as existsSync21, readFileSync as readFileSync13 } from "fs";
|
|
15709
15909
|
var {Glob: Glob8 } = globalThis.Bun;
|
|
15710
|
-
import { resolve as
|
|
15910
|
+
import { resolve as resolve23 } from "path";
|
|
15711
15911
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
15712
15912
|
const lower = filePath.toLowerCase();
|
|
15713
15913
|
if (lower.endsWith(".ts") || lower.endsWith(".tsx") || lower.endsWith(".jsx"))
|
|
@@ -15721,8 +15921,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15721
15921
|
if (!importPath.startsWith(".") && !importPath.startsWith("/")) {
|
|
15722
15922
|
return null;
|
|
15723
15923
|
}
|
|
15724
|
-
const fromDir =
|
|
15725
|
-
const normalized =
|
|
15924
|
+
const fromDir = resolve23(fromFile, "..");
|
|
15925
|
+
const normalized = resolve23(fromDir, importPath);
|
|
15726
15926
|
const extensions = [
|
|
15727
15927
|
".ts",
|
|
15728
15928
|
".tsx",
|
|
@@ -15752,7 +15952,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15752
15952
|
dependents.delete(normalizedPath);
|
|
15753
15953
|
}
|
|
15754
15954
|
}, addFileToGraph = (graph, filePath) => {
|
|
15755
|
-
const normalizedPath =
|
|
15955
|
+
const normalizedPath = resolve23(filePath);
|
|
15756
15956
|
if (!existsSync21(normalizedPath))
|
|
15757
15957
|
return;
|
|
15758
15958
|
const dependencies = extractDependencies(normalizedPath);
|
|
@@ -15769,10 +15969,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15769
15969
|
}, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
|
|
15770
15970
|
const processedFiles = new Set;
|
|
15771
15971
|
const glob = new Glob8("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
|
|
15772
|
-
const resolvedDirs = directories.map((dir) =>
|
|
15972
|
+
const resolvedDirs = directories.map((dir) => resolve23(dir)).filter((dir) => existsSync21(dir));
|
|
15773
15973
|
const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
|
|
15774
15974
|
for (const file4 of allFiles) {
|
|
15775
|
-
const fullPath =
|
|
15975
|
+
const fullPath = resolve23(file4);
|
|
15776
15976
|
if (IGNORED_SEGMENTS.some((seg) => fullPath.includes(seg)))
|
|
15777
15977
|
continue;
|
|
15778
15978
|
if (processedFiles.has(fullPath))
|
|
@@ -15827,8 +16027,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15827
16027
|
resolveRegexMatches(styleUrlSingularRegex, content, filePath, dependencies);
|
|
15828
16028
|
extractStyleUrlsDependencies(content, filePath, dependencies);
|
|
15829
16029
|
}, extractJsDependencies = (filePath, content, loader) => {
|
|
15830
|
-
const
|
|
15831
|
-
const imports =
|
|
16030
|
+
const transpiler6 = loader === "tsx" ? tsTranspiler : jsTranspiler;
|
|
16031
|
+
const imports = transpiler6.scanImports(content);
|
|
15832
16032
|
const dependencies = [];
|
|
15833
16033
|
for (const imp of imports) {
|
|
15834
16034
|
const resolved = resolveImportPath2(imp.path, filePath);
|
|
@@ -15885,7 +16085,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15885
16085
|
return [];
|
|
15886
16086
|
}
|
|
15887
16087
|
}, getAffectedFiles = (graph, changedFile) => {
|
|
15888
|
-
const normalizedPath =
|
|
16088
|
+
const normalizedPath = resolve23(changedFile);
|
|
15889
16089
|
const affected = new Set;
|
|
15890
16090
|
const toProcess = [normalizedPath];
|
|
15891
16091
|
const processNode = (current) => {
|
|
@@ -15925,7 +16125,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15925
16125
|
}
|
|
15926
16126
|
graph.dependents.delete(normalizedPath);
|
|
15927
16127
|
}, removeFileFromGraph = (graph, filePath) => {
|
|
15928
|
-
const normalizedPath =
|
|
16128
|
+
const normalizedPath = resolve23(filePath);
|
|
15929
16129
|
removeDepsForFile(graph, normalizedPath);
|
|
15930
16130
|
removeDependentsForFile(graph, normalizedPath);
|
|
15931
16131
|
};
|
|
@@ -15968,12 +16168,12 @@ var globalVersionCounter = 0, createModuleVersionTracker = () => new Map, getNex
|
|
|
15968
16168
|
};
|
|
15969
16169
|
|
|
15970
16170
|
// src/dev/configResolver.ts
|
|
15971
|
-
import { resolve as
|
|
16171
|
+
import { resolve as resolve24 } from "path";
|
|
15972
16172
|
var resolveBuildPaths = (config) => {
|
|
15973
16173
|
const cwd2 = process.cwd();
|
|
15974
16174
|
const normalize = (path) => path.replace(/\\/g, "/");
|
|
15975
|
-
const withDefault = (value, fallback) => normalize(
|
|
15976
|
-
const optional = (value) => value ? normalize(
|
|
16175
|
+
const withDefault = (value, fallback) => normalize(resolve24(cwd2, value ?? fallback));
|
|
16176
|
+
const optional = (value) => value ? normalize(resolve24(cwd2, value)) : undefined;
|
|
15977
16177
|
return {
|
|
15978
16178
|
angularDir: optional(config.angularDirectory),
|
|
15979
16179
|
assetsDir: optional(config.assetsDirectory),
|
|
@@ -16026,7 +16226,7 @@ var init_clientManager = __esm(() => {
|
|
|
16026
16226
|
|
|
16027
16227
|
// src/dev/pathUtils.ts
|
|
16028
16228
|
import { existsSync as existsSync22, readdirSync, readFileSync as readFileSync14 } from "fs";
|
|
16029
|
-
import { dirname as
|
|
16229
|
+
import { dirname as dirname15, resolve as resolve25 } from "path";
|
|
16030
16230
|
var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
16031
16231
|
if (shouldIgnorePath(filePath, resolved)) {
|
|
16032
16232
|
return "ignored";
|
|
@@ -16102,7 +16302,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
16102
16302
|
return "unknown";
|
|
16103
16303
|
}, collectAngularResourceDirs = (angularDir) => {
|
|
16104
16304
|
const out = new Set;
|
|
16105
|
-
const angularRoot =
|
|
16305
|
+
const angularRoot = resolve25(angularDir);
|
|
16106
16306
|
const angularRootNormalized = normalizePath(angularRoot);
|
|
16107
16307
|
const walk = (dir) => {
|
|
16108
16308
|
let entries;
|
|
@@ -16115,7 +16315,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
16115
16315
|
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
16116
16316
|
continue;
|
|
16117
16317
|
}
|
|
16118
|
-
const full =
|
|
16318
|
+
const full = resolve25(dir, entry.name);
|
|
16119
16319
|
if (entry.isDirectory()) {
|
|
16120
16320
|
walk(full);
|
|
16121
16321
|
continue;
|
|
@@ -16154,10 +16354,10 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
16154
16354
|
refs.push(strMatch[1]);
|
|
16155
16355
|
}
|
|
16156
16356
|
}
|
|
16157
|
-
const componentDir =
|
|
16357
|
+
const componentDir = dirname15(full);
|
|
16158
16358
|
for (const ref of refs) {
|
|
16159
|
-
const refAbs = normalizePath(
|
|
16160
|
-
const refDir = normalizePath(
|
|
16359
|
+
const refAbs = normalizePath(resolve25(componentDir, ref));
|
|
16360
|
+
const refDir = normalizePath(dirname15(refAbs));
|
|
16161
16361
|
if (refDir === angularRootNormalized || refDir.startsWith(angularRootNormalized + "/")) {
|
|
16162
16362
|
continue;
|
|
16163
16363
|
}
|
|
@@ -16173,7 +16373,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
16173
16373
|
const push = (path) => {
|
|
16174
16374
|
if (!path)
|
|
16175
16375
|
return;
|
|
16176
|
-
const abs = normalizePath(
|
|
16376
|
+
const abs = normalizePath(resolve25(cwd2, path));
|
|
16177
16377
|
if (!roots.includes(abs))
|
|
16178
16378
|
roots.push(abs);
|
|
16179
16379
|
};
|
|
@@ -16198,7 +16398,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
16198
16398
|
push(cfg.assetsDir);
|
|
16199
16399
|
push(cfg.stylesDir);
|
|
16200
16400
|
for (const candidate of ["src", "db", "assets", "styles"]) {
|
|
16201
|
-
const abs = normalizePath(
|
|
16401
|
+
const abs = normalizePath(resolve25(cwd2, candidate));
|
|
16202
16402
|
if (existsSync22(abs) && !roots.includes(abs))
|
|
16203
16403
|
roots.push(abs);
|
|
16204
16404
|
}
|
|
@@ -16269,7 +16469,7 @@ var init_pathUtils = __esm(() => {
|
|
|
16269
16469
|
// src/dev/fileWatcher.ts
|
|
16270
16470
|
import { watch } from "fs";
|
|
16271
16471
|
import { existsSync as existsSync23 } from "fs";
|
|
16272
|
-
import { join as
|
|
16472
|
+
import { join as join27, resolve as resolve26 } from "path";
|
|
16273
16473
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
16274
16474
|
try {
|
|
16275
16475
|
removeFileFromGraph(graph, fullPath);
|
|
@@ -16296,7 +16496,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
16296
16496
|
if (shouldSkipFilename(filename, isStylesDir)) {
|
|
16297
16497
|
return;
|
|
16298
16498
|
}
|
|
16299
|
-
const fullPath =
|
|
16499
|
+
const fullPath = join27(absolutePath, filename).replace(/\\/g, "/");
|
|
16300
16500
|
if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
|
|
16301
16501
|
return;
|
|
16302
16502
|
}
|
|
@@ -16314,7 +16514,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
16314
16514
|
}, addFileWatchers = (state, paths, onFileChange) => {
|
|
16315
16515
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
16316
16516
|
paths.forEach((path) => {
|
|
16317
|
-
const absolutePath =
|
|
16517
|
+
const absolutePath = resolve26(path).replace(/\\/g, "/");
|
|
16318
16518
|
if (!existsSync23(absolutePath)) {
|
|
16319
16519
|
return;
|
|
16320
16520
|
}
|
|
@@ -16325,7 +16525,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
16325
16525
|
const watchPaths = getWatchPaths(config, state.resolvedPaths);
|
|
16326
16526
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
16327
16527
|
watchPaths.forEach((path) => {
|
|
16328
|
-
const absolutePath =
|
|
16528
|
+
const absolutePath = resolve26(path).replace(/\\/g, "/");
|
|
16329
16529
|
if (!existsSync23(absolutePath)) {
|
|
16330
16530
|
return;
|
|
16331
16531
|
}
|
|
@@ -16340,13 +16540,13 @@ var init_fileWatcher = __esm(() => {
|
|
|
16340
16540
|
});
|
|
16341
16541
|
|
|
16342
16542
|
// src/dev/assetStore.ts
|
|
16343
|
-
import { resolve as
|
|
16543
|
+
import { resolve as resolve27 } from "path";
|
|
16344
16544
|
import { readdir as readdir4, unlink } from "fs/promises";
|
|
16345
16545
|
var mimeTypes, getMimeType = (filePath) => {
|
|
16346
16546
|
const ext = filePath.slice(filePath.lastIndexOf("."));
|
|
16347
16547
|
return mimeTypes[ext] ?? "application/octet-stream";
|
|
16348
16548
|
}, HASHED_FILE_RE, stripHash = (webPath) => webPath.replace(/\.[a-z0-9]{8}(\.(js|css|mjs))$/, "$1"), processWalkEntry = (entry, dir, liveByIdentity, walkAndClean) => {
|
|
16349
|
-
const fullPath =
|
|
16549
|
+
const fullPath = resolve27(dir, entry.name);
|
|
16350
16550
|
if (entry.isDirectory()) {
|
|
16351
16551
|
return walkAndClean(fullPath);
|
|
16352
16552
|
}
|
|
@@ -16362,10 +16562,10 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
16362
16562
|
}, cleanStaleAssets = async (store, manifest, buildDir) => {
|
|
16363
16563
|
const liveByIdentity = new Map;
|
|
16364
16564
|
for (const webPath of store.keys()) {
|
|
16365
|
-
const diskPath =
|
|
16565
|
+
const diskPath = resolve27(buildDir, webPath.slice(1));
|
|
16366
16566
|
liveByIdentity.set(stripHash(diskPath), diskPath);
|
|
16367
16567
|
}
|
|
16368
|
-
const absBuildDir =
|
|
16568
|
+
const absBuildDir = resolve27(buildDir);
|
|
16369
16569
|
Object.values(manifest).forEach((val) => {
|
|
16370
16570
|
if (!HASHED_FILE_RE.test(val))
|
|
16371
16571
|
return;
|
|
@@ -16383,7 +16583,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
16383
16583
|
} catch {}
|
|
16384
16584
|
}, lookupAsset = (store, path) => store.get(path), processScanEntry = (entry, dir, prefix, store, scanDir) => {
|
|
16385
16585
|
if (entry.isDirectory()) {
|
|
16386
|
-
return scanDir(
|
|
16586
|
+
return scanDir(resolve27(dir, entry.name), `${prefix}${entry.name}/`);
|
|
16387
16587
|
}
|
|
16388
16588
|
if (!entry.name.startsWith("chunk-")) {
|
|
16389
16589
|
return null;
|
|
@@ -16392,7 +16592,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
16392
16592
|
if (store.has(webPath)) {
|
|
16393
16593
|
return null;
|
|
16394
16594
|
}
|
|
16395
|
-
return Bun.file(
|
|
16595
|
+
return Bun.file(resolve27(dir, entry.name)).bytes().then((bytes) => {
|
|
16396
16596
|
store.set(webPath, bytes);
|
|
16397
16597
|
return;
|
|
16398
16598
|
}).catch(() => {});
|
|
@@ -16414,7 +16614,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
16414
16614
|
for (const webPath of newIdentities.values()) {
|
|
16415
16615
|
if (store.has(webPath))
|
|
16416
16616
|
continue;
|
|
16417
|
-
loadPromises.push(Bun.file(
|
|
16617
|
+
loadPromises.push(Bun.file(resolve27(buildDir, webPath.slice(1))).bytes().then((bytes) => {
|
|
16418
16618
|
store.set(webPath, bytes);
|
|
16419
16619
|
return;
|
|
16420
16620
|
}).catch(() => {}));
|
|
@@ -16445,7 +16645,7 @@ var init_assetStore = __esm(() => {
|
|
|
16445
16645
|
|
|
16446
16646
|
// src/islands/pageMetadata.ts
|
|
16447
16647
|
import { readFileSync as readFileSync15 } from "fs";
|
|
16448
|
-
import { dirname as
|
|
16648
|
+
import { dirname as dirname16, resolve as resolve28 } from "path";
|
|
16449
16649
|
var pagePatterns, getPageDirs = (config) => [
|
|
16450
16650
|
{ dir: config.angularDirectory, framework: "angular" },
|
|
16451
16651
|
{ dir: config.emberDirectory, framework: "ember" },
|
|
@@ -16465,15 +16665,15 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
16465
16665
|
const source = definition.buildReference?.source;
|
|
16466
16666
|
if (!source)
|
|
16467
16667
|
continue;
|
|
16468
|
-
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname :
|
|
16469
|
-
lookup.set(`${definition.framework}:${definition.component}`,
|
|
16668
|
+
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve28(dirname16(buildInfo.resolvedRegistryPath), source);
|
|
16669
|
+
lookup.set(`${definition.framework}:${definition.component}`, resolve28(resolvedSource));
|
|
16470
16670
|
}
|
|
16471
16671
|
return lookup;
|
|
16472
16672
|
}, getCurrentPageIslandMetadata = () => globalThis.__absolutePageIslandMetadata ?? new Map, metadataUsesSource = (metadata, target) => metadata.islands.some((usage) => {
|
|
16473
16673
|
const candidate = usage.source;
|
|
16474
|
-
return candidate ?
|
|
16674
|
+
return candidate ? resolve28(candidate) === target : false;
|
|
16475
16675
|
}), getPagesUsingIslandSource = (sourcePath) => {
|
|
16476
|
-
const target =
|
|
16676
|
+
const target = resolve28(sourcePath);
|
|
16477
16677
|
return [...getCurrentPageIslandMetadata().values()].filter((metadata) => metadataUsesSource(metadata, target)).map((metadata) => metadata.pagePath);
|
|
16478
16678
|
}, resolveIslandUsages = (islands, islandSourceLookup) => islands.map((usage) => {
|
|
16479
16679
|
const sourcePath = islandSourceLookup.get(`${usage.framework}:${usage.component}`);
|
|
@@ -16485,13 +16685,13 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
16485
16685
|
const pattern = pagePatterns[entry.framework];
|
|
16486
16686
|
if (!pattern)
|
|
16487
16687
|
return;
|
|
16488
|
-
const files = await scanEntryPoints(
|
|
16688
|
+
const files = await scanEntryPoints(resolve28(entry.dir), pattern);
|
|
16489
16689
|
for (const filePath of files) {
|
|
16490
16690
|
const source = readFileSync15(filePath, "utf-8");
|
|
16491
16691
|
const islands = extractIslandUsagesFromSource(source);
|
|
16492
|
-
pageMetadata.set(
|
|
16692
|
+
pageMetadata.set(resolve28(filePath), {
|
|
16493
16693
|
islands: resolveIslandUsages(islands, islandSourceLookup),
|
|
16494
|
-
pagePath:
|
|
16694
|
+
pagePath: resolve28(filePath)
|
|
16495
16695
|
});
|
|
16496
16696
|
}
|
|
16497
16697
|
}, loadPageIslandMetadata = async (config) => {
|
|
@@ -16614,9 +16814,9 @@ var init_transformCache = __esm(() => {
|
|
|
16614
16814
|
});
|
|
16615
16815
|
|
|
16616
16816
|
// src/dev/reactComponentClassifier.ts
|
|
16617
|
-
import { resolve as
|
|
16817
|
+
import { resolve as resolve29 } from "path";
|
|
16618
16818
|
var classifyComponent = (filePath) => {
|
|
16619
|
-
const normalizedPath =
|
|
16819
|
+
const normalizedPath = resolve29(filePath);
|
|
16620
16820
|
if (normalizedPath.includes("/react/pages/")) {
|
|
16621
16821
|
return "server";
|
|
16622
16822
|
}
|
|
@@ -16628,7 +16828,7 @@ var classifyComponent = (filePath) => {
|
|
|
16628
16828
|
var init_reactComponentClassifier = () => {};
|
|
16629
16829
|
|
|
16630
16830
|
// src/dev/moduleMapper.ts
|
|
16631
|
-
import { basename as basename9, resolve as
|
|
16831
|
+
import { basename as basename9, resolve as resolve30 } from "path";
|
|
16632
16832
|
var buildModulePaths = (moduleKeys, manifest) => {
|
|
16633
16833
|
const modulePaths = {};
|
|
16634
16834
|
moduleKeys.forEach((key) => {
|
|
@@ -16638,7 +16838,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
16638
16838
|
});
|
|
16639
16839
|
return modulePaths;
|
|
16640
16840
|
}, processChangedFile = (sourceFile, framework, manifest, resolvedPaths, processedFiles) => {
|
|
16641
|
-
const normalizedFile =
|
|
16841
|
+
const normalizedFile = resolve30(sourceFile);
|
|
16642
16842
|
const normalizedPath = normalizedFile.replace(/\\/g, "/");
|
|
16643
16843
|
if (processedFiles.has(normalizedFile)) {
|
|
16644
16844
|
return null;
|
|
@@ -16674,7 +16874,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
16674
16874
|
});
|
|
16675
16875
|
return grouped;
|
|
16676
16876
|
}, mapSourceFileToManifestKeys = (sourceFile, framework, resolvedPaths) => {
|
|
16677
|
-
const normalizedFile =
|
|
16877
|
+
const normalizedFile = resolve30(sourceFile);
|
|
16678
16878
|
const fileName = basename9(normalizedFile);
|
|
16679
16879
|
const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|css|html)$/, "");
|
|
16680
16880
|
const pascalName = toPascal(baseName);
|
|
@@ -16870,7 +17070,7 @@ __export(exports_moduleServer, {
|
|
|
16870
17070
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
16871
17071
|
});
|
|
16872
17072
|
import { existsSync as existsSync24, readFileSync as readFileSync17, statSync as statSync2 } from "fs";
|
|
16873
|
-
import { basename as basename10, dirname as
|
|
17073
|
+
import { basename as basename10, dirname as dirname17, extname as extname8, join as join28, resolve as resolve31, relative as relative13 } from "path";
|
|
16874
17074
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
16875
17075
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
16876
17076
|
const allExports = [];
|
|
@@ -16890,7 +17090,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
|
|
|
16890
17090
|
${stubs}
|
|
16891
17091
|
`;
|
|
16892
17092
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
16893
|
-
const found = extensions.find((ext) => existsSync24(
|
|
17093
|
+
const found = extensions.find((ext) => existsSync24(resolve31(projectRoot, srcPath + ext)));
|
|
16894
17094
|
return found ? srcPath + found : srcPath;
|
|
16895
17095
|
}, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
16896
17096
|
const entries = Object.entries(vendorPaths).sort(([a], [b2]) => b2.length - a.length);
|
|
@@ -16905,7 +17105,7 @@ ${stubs}
|
|
|
16905
17105
|
return invalidationVersion > 0 ? `${mtime}.${invalidationVersion}` : `${mtime}`;
|
|
16906
17106
|
}, srcUrl = (relPath, projectRoot) => {
|
|
16907
17107
|
const base = `${SRC_PREFIX}${relPath.replace(/\\/g, "/")}`;
|
|
16908
|
-
const absPath =
|
|
17108
|
+
const absPath = resolve31(projectRoot, relPath);
|
|
16909
17109
|
const cached = mtimeCache.get(absPath);
|
|
16910
17110
|
if (cached !== undefined)
|
|
16911
17111
|
return `${base}?v=${buildVersion(cached, absPath)}`;
|
|
@@ -16917,12 +17117,12 @@ ${stubs}
|
|
|
16917
17117
|
return base;
|
|
16918
17118
|
}
|
|
16919
17119
|
}, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
|
|
16920
|
-
const absPath =
|
|
16921
|
-
const rel =
|
|
17120
|
+
const absPath = resolve31(fileDir, relPath);
|
|
17121
|
+
const rel = relative13(projectRoot, absPath);
|
|
16922
17122
|
const extension = extname8(rel);
|
|
16923
17123
|
let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
|
|
16924
17124
|
if (extname8(srcPath) === ".svelte") {
|
|
16925
|
-
srcPath =
|
|
17125
|
+
srcPath = relative13(projectRoot, resolveSvelteModulePath(resolve31(projectRoot, srcPath)));
|
|
16926
17126
|
}
|
|
16927
17127
|
return srcUrl(srcPath, projectRoot);
|
|
16928
17128
|
}, NODE_BUILTIN_RE, resolveAbsoluteSpecifier = (specifier, projectRoot) => {
|
|
@@ -16934,27 +17134,27 @@ ${stubs}
|
|
|
16934
17134
|
"import"
|
|
16935
17135
|
]);
|
|
16936
17136
|
if (fromExports)
|
|
16937
|
-
return
|
|
17137
|
+
return relative13(projectRoot, fromExports);
|
|
16938
17138
|
try {
|
|
16939
17139
|
const isScoped = specifier.startsWith("@");
|
|
16940
17140
|
const parts = specifier.split("/");
|
|
16941
17141
|
const packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];
|
|
16942
17142
|
const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
|
|
16943
17143
|
if (!subpath) {
|
|
16944
|
-
const pkgDir =
|
|
16945
|
-
const pkgJsonPath =
|
|
17144
|
+
const pkgDir = resolve31(projectRoot, "node_modules", packageName ?? "");
|
|
17145
|
+
const pkgJsonPath = join28(pkgDir, "package.json");
|
|
16946
17146
|
if (existsSync24(pkgJsonPath)) {
|
|
16947
17147
|
const pkg = JSON.parse(readFileSync17(pkgJsonPath, "utf-8"));
|
|
16948
17148
|
const esmEntry = typeof pkg.module === "string" && pkg.module || typeof pkg.browser === "string" && pkg.browser;
|
|
16949
17149
|
if (esmEntry) {
|
|
16950
|
-
const resolved =
|
|
17150
|
+
const resolved = resolve31(pkgDir, esmEntry);
|
|
16951
17151
|
if (existsSync24(resolved))
|
|
16952
|
-
return
|
|
17152
|
+
return relative13(projectRoot, resolved);
|
|
16953
17153
|
}
|
|
16954
17154
|
}
|
|
16955
17155
|
}
|
|
16956
17156
|
} catch {}
|
|
16957
|
-
return
|
|
17157
|
+
return relative13(projectRoot, Bun.resolveSync(specifier, projectRoot));
|
|
16958
17158
|
} catch {
|
|
16959
17159
|
return;
|
|
16960
17160
|
}
|
|
@@ -16979,28 +17179,28 @@ ${stubs}
|
|
|
16979
17179
|
};
|
|
16980
17180
|
result = result.replace(/^((?:import\s+[\s\S]+?\s+from|export\s+[\s\S]+?\s+from|import)\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
|
|
16981
17181
|
result = result.replace(/(import\s*\(\s*["'])([^"'./][^"']*)(["']\s*\))/g, stubReplace);
|
|
16982
|
-
const fileDir =
|
|
17182
|
+
const fileDir = dirname17(filePath);
|
|
16983
17183
|
result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
16984
17184
|
result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
16985
17185
|
result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}`);
|
|
16986
17186
|
const rewriteAbsoluteToSrc = (_match, prefix, absPath, _ext, suffix) => {
|
|
16987
17187
|
if (absPath.startsWith(projectRoot)) {
|
|
16988
|
-
const rel2 =
|
|
17188
|
+
const rel2 = relative13(projectRoot, absPath).replace(/\\/g, "/");
|
|
16989
17189
|
return `${prefix}${srcUrl(rel2, projectRoot)}${suffix}`;
|
|
16990
17190
|
}
|
|
16991
|
-
const rel =
|
|
17191
|
+
const rel = relative13(projectRoot, absPath).replace(/\\/g, "/");
|
|
16992
17192
|
return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
|
|
16993
17193
|
};
|
|
16994
17194
|
result = result.replace(/((?:from|import)\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["'])/g, rewriteAbsoluteToSrc);
|
|
16995
17195
|
result = result.replace(/(import\s*\(\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["']\s*\))/g, rewriteAbsoluteToSrc);
|
|
16996
17196
|
result = result.replace(/new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g, (_match, relPath) => {
|
|
16997
|
-
const absPath =
|
|
16998
|
-
const rel =
|
|
17197
|
+
const absPath = resolve31(fileDir, relPath);
|
|
17198
|
+
const rel = relative13(projectRoot, absPath);
|
|
16999
17199
|
return `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;
|
|
17000
17200
|
});
|
|
17001
17201
|
result = result.replace(/import\.meta\.resolve\(\s*["'](\.\.?\/[^"']+)["']\s*\)/g, (_match, relPath) => {
|
|
17002
|
-
const absPath =
|
|
17003
|
-
const rel =
|
|
17202
|
+
const absPath = resolve31(fileDir, relPath);
|
|
17203
|
+
const rel = relative13(projectRoot, absPath);
|
|
17004
17204
|
return `'${srcUrl(rel, projectRoot)}'`;
|
|
17005
17205
|
});
|
|
17006
17206
|
return result;
|
|
@@ -17056,7 +17256,7 @@ ${code}`;
|
|
|
17056
17256
|
transpiled = `var $RefreshReg$ = window.$RefreshReg$ || function(){};
|
|
17057
17257
|
` + `var $RefreshSig$ = window.$RefreshSig$ || function(){ return function(t){ return t; }; };
|
|
17058
17258
|
${transpiled}`;
|
|
17059
|
-
const relPath =
|
|
17259
|
+
const relPath = relative13(projectRoot, filePath).replace(/\\/g, "/");
|
|
17060
17260
|
transpiled = transpiled.replace(/\binput\.tsx:/g, `${relPath}:`);
|
|
17061
17261
|
transpiled += buildIslandMetadataExports(raw);
|
|
17062
17262
|
return rewriteImports(transpiled, filePath, projectRoot, rewriter);
|
|
@@ -17065,13 +17265,13 @@ ${transpiled}`;
|
|
|
17065
17265
|
const ext = extname8(filePath);
|
|
17066
17266
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
17067
17267
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
17068
|
-
let
|
|
17268
|
+
let transpiler6 = jsTranspiler2;
|
|
17069
17269
|
if (isTSX)
|
|
17070
|
-
|
|
17270
|
+
transpiler6 = tsxTranspiler;
|
|
17071
17271
|
else if (isTS)
|
|
17072
|
-
|
|
17073
|
-
const valueExports = isTS ?
|
|
17074
|
-
let transpiled =
|
|
17272
|
+
transpiler6 = tsTranspiler2;
|
|
17273
|
+
const valueExports = isTS ? transpiler6.scan(raw).exports : [];
|
|
17274
|
+
let transpiled = transpiler6.transformSync(raw);
|
|
17075
17275
|
if (isTS) {
|
|
17076
17276
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
17077
17277
|
}
|
|
@@ -17217,11 +17417,11 @@ ${code}`;
|
|
|
17217
17417
|
if (compiled.css?.code) {
|
|
17218
17418
|
const cssPath = `${filePath}.css`;
|
|
17219
17419
|
svelteExternalCss.set(cssPath, compiled.css.code);
|
|
17220
|
-
const cssUrl = srcUrl(
|
|
17420
|
+
const cssUrl = srcUrl(relative13(projectRoot, cssPath), projectRoot);
|
|
17221
17421
|
code = `import "${cssUrl}";
|
|
17222
17422
|
${code}`;
|
|
17223
17423
|
}
|
|
17224
|
-
const moduleUrl = `${SRC_PREFIX}${
|
|
17424
|
+
const moduleUrl = `${SRC_PREFIX}${relative13(projectRoot, filePath).replace(/\\/g, "/")}`;
|
|
17225
17425
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
17226
17426
|
` + ` if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
17227
17427
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
@@ -17247,6 +17447,8 @@ ${code}`;
|
|
|
17247
17447
|
const templateResult = compiler.compileTemplate({
|
|
17248
17448
|
compilerOptions: {
|
|
17249
17449
|
bindingMetadata: compiledScript.bindings,
|
|
17450
|
+
expressionPlugins: ["typescript"],
|
|
17451
|
+
isCustomElement: (tag) => tag === "absolute-island",
|
|
17250
17452
|
prefixIdentifiers: true
|
|
17251
17453
|
},
|
|
17252
17454
|
filename: filePath,
|
|
@@ -17310,8 +17512,8 @@ ${code}`;
|
|
|
17310
17512
|
code = injectVueHmr(code, filePath, projectRoot, vueDir);
|
|
17311
17513
|
return rewriteImports(code, filePath, projectRoot, rewriter);
|
|
17312
17514
|
}, injectVueHmr = (code, filePath, projectRoot, vueDir) => {
|
|
17313
|
-
const hmrBase = vueDir ?
|
|
17314
|
-
const hmrId =
|
|
17515
|
+
const hmrBase = vueDir ? resolve31(vueDir) : projectRoot;
|
|
17516
|
+
const hmrId = relative13(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
|
|
17315
17517
|
let result = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
|
|
17316
17518
|
result += [
|
|
17317
17519
|
"",
|
|
@@ -17474,7 +17676,7 @@ export default {};
|
|
|
17474
17676
|
const escaped = virtualCss.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
17475
17677
|
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);`);
|
|
17476
17678
|
}, resolveSourcePath = (relPath, projectRoot) => {
|
|
17477
|
-
const filePath =
|
|
17679
|
+
const filePath = resolve31(projectRoot, relPath);
|
|
17478
17680
|
const ext = extname8(filePath);
|
|
17479
17681
|
if (ext === ".svelte")
|
|
17480
17682
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
@@ -17501,7 +17703,7 @@ export default {};
|
|
|
17501
17703
|
if (!TRANSPILABLE.has(ext))
|
|
17502
17704
|
return;
|
|
17503
17705
|
const stat3 = statSync2(filePath);
|
|
17504
|
-
const resolvedVueDir = vueDir ?
|
|
17706
|
+
const resolvedVueDir = vueDir ? resolve31(vueDir) : undefined;
|
|
17505
17707
|
let content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
|
|
17506
17708
|
const isComponentJs = ext === ".js" && filePath.endsWith(".component.js") && filePath.replace(/\\/g, "/").includes("/.absolutejs/generated/angular/");
|
|
17507
17709
|
if (isComponentJs) {
|
|
@@ -17560,7 +17762,7 @@ export default {};
|
|
|
17560
17762
|
const relPath = pathname.slice(SRC_PREFIX.length);
|
|
17561
17763
|
if (relPath === "bun:wrap" || relPath.startsWith("bun:wrap?"))
|
|
17562
17764
|
return handleBunWrapRequest();
|
|
17563
|
-
const virtualCssResponse = handleVirtualSvelteCss(
|
|
17765
|
+
const virtualCssResponse = handleVirtualSvelteCss(resolve31(projectRoot, relPath));
|
|
17564
17766
|
if (virtualCssResponse)
|
|
17565
17767
|
return virtualCssResponse;
|
|
17566
17768
|
const { filePath, ext } = resolveSourcePath(relPath, projectRoot);
|
|
@@ -17576,11 +17778,11 @@ export default {};
|
|
|
17576
17778
|
SRC_IMPORT_RE.lastIndex = 0;
|
|
17577
17779
|
while ((match = SRC_IMPORT_RE.exec(content)) !== null) {
|
|
17578
17780
|
if (match[1])
|
|
17579
|
-
files.push(
|
|
17781
|
+
files.push(resolve31(projectRoot, match[1]));
|
|
17580
17782
|
}
|
|
17581
17783
|
return files;
|
|
17582
17784
|
}, invalidateModule = (filePath) => {
|
|
17583
|
-
const resolved =
|
|
17785
|
+
const resolved = resolve31(filePath);
|
|
17584
17786
|
invalidate(filePath);
|
|
17585
17787
|
if (resolved !== filePath)
|
|
17586
17788
|
invalidate(resolved);
|
|
@@ -17727,7 +17929,7 @@ __export(exports_resolveOwningComponents, {
|
|
|
17727
17929
|
invalidateResourceIndex: () => invalidateResourceIndex
|
|
17728
17930
|
});
|
|
17729
17931
|
import { readdirSync as readdirSync2, readFileSync as readFileSync18, statSync as statSync3 } from "fs";
|
|
17730
|
-
import { dirname as
|
|
17932
|
+
import { dirname as dirname18, extname as extname9, join as join29, resolve as resolve32 } from "path";
|
|
17731
17933
|
import ts3 from "typescript";
|
|
17732
17934
|
var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") || file4.endsWith(".tsx"), walkAngularSourceFiles = (root) => {
|
|
17733
17935
|
const out = [];
|
|
@@ -17742,7 +17944,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
17742
17944
|
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
17743
17945
|
continue;
|
|
17744
17946
|
}
|
|
17745
|
-
const full =
|
|
17947
|
+
const full = join29(dir, entry.name);
|
|
17746
17948
|
if (entry.isDirectory()) {
|
|
17747
17949
|
visit(full);
|
|
17748
17950
|
} else if (entry.isFile() && isAngularSourceFile(entry.name)) {
|
|
@@ -17840,7 +18042,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
17840
18042
|
};
|
|
17841
18043
|
visit(sourceFile);
|
|
17842
18044
|
return out;
|
|
17843
|
-
}, safeNormalize = (path) =>
|
|
18045
|
+
}, safeNormalize = (path) => resolve32(path).replace(/\\/g, "/"), resolveOwningComponents = (params) => {
|
|
17844
18046
|
const { changedFilePath, userAngularRoot } = params;
|
|
17845
18047
|
const changedAbs = safeNormalize(changedFilePath);
|
|
17846
18048
|
const out = [];
|
|
@@ -17881,7 +18083,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
17881
18083
|
return null;
|
|
17882
18084
|
}
|
|
17883
18085
|
const sf = ts3.createSourceFile(childFilePath, source, ts3.ScriptTarget.ES2022, true, ts3.ScriptKind.TS);
|
|
17884
|
-
const childDir =
|
|
18086
|
+
const childDir = dirname18(childFilePath);
|
|
17885
18087
|
for (const stmt of sf.statements) {
|
|
17886
18088
|
if (!ts3.isImportDeclaration(stmt))
|
|
17887
18089
|
continue;
|
|
@@ -17909,7 +18111,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
17909
18111
|
if (!spec.startsWith(".") && !spec.startsWith("/")) {
|
|
17910
18112
|
return null;
|
|
17911
18113
|
}
|
|
17912
|
-
const base =
|
|
18114
|
+
const base = resolve32(childDir, spec);
|
|
17913
18115
|
const candidates = [
|
|
17914
18116
|
`${base}.ts`,
|
|
17915
18117
|
`${base}.tsx`,
|
|
@@ -17938,7 +18140,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
17938
18140
|
const parentFile = new Map;
|
|
17939
18141
|
for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
|
|
17940
18142
|
const classes = parseDecoratedClasses(tsPath);
|
|
17941
|
-
const componentDir =
|
|
18143
|
+
const componentDir = dirname18(tsPath);
|
|
17942
18144
|
for (const cls of classes) {
|
|
17943
18145
|
const entity = {
|
|
17944
18146
|
className: cls.className,
|
|
@@ -17947,7 +18149,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
17947
18149
|
};
|
|
17948
18150
|
if (cls.kind === "component") {
|
|
17949
18151
|
for (const url of [...cls.templateUrls, ...cls.styleUrls]) {
|
|
17950
|
-
const abs = safeNormalize(
|
|
18152
|
+
const abs = safeNormalize(resolve32(componentDir, url));
|
|
17951
18153
|
const existing = resource.get(abs);
|
|
17952
18154
|
if (existing)
|
|
17953
18155
|
existing.push(entity);
|
|
@@ -18027,8 +18229,6 @@ class Context {
|
|
|
18027
18229
|
}
|
|
18028
18230
|
|
|
18029
18231
|
// src/dev/angular/vendor/translator/translator.ts
|
|
18030
|
-
import * as o from "@angular/compiler";
|
|
18031
|
-
|
|
18032
18232
|
class ExpressionTranslatorVisitor {
|
|
18033
18233
|
factory;
|
|
18034
18234
|
imports;
|
|
@@ -18084,7 +18284,9 @@ class ExpressionTranslatorVisitor {
|
|
|
18084
18284
|
return this.setSourceMapRange(this.factory.createRegularExpressionLiteral(ast.body, ast.flags), ast.sourceSpan);
|
|
18085
18285
|
}
|
|
18086
18286
|
visitLocalizedString(ast, context) {
|
|
18087
|
-
const elements = [
|
|
18287
|
+
const elements = [
|
|
18288
|
+
createTemplateElement(ast.serializeI18nHead())
|
|
18289
|
+
];
|
|
18088
18290
|
const expressions = [];
|
|
18089
18291
|
for (let i = 0;i < ast.expressions.length; i++) {
|
|
18090
18292
|
const placeholder = this.setSourceMapRange(ast.expressions[i].visitExpression(this, context), ast.getPlaceholderSourceSpan(i));
|
|
@@ -18092,7 +18294,10 @@ class ExpressionTranslatorVisitor {
|
|
|
18092
18294
|
elements.push(createTemplateElement(ast.serializeI18nTemplatePart(i + 1)));
|
|
18093
18295
|
}
|
|
18094
18296
|
const localizeTag = this.factory.createIdentifier("$localize");
|
|
18095
|
-
return this.setSourceMapRange(this.createTaggedTemplateExpression(localizeTag, {
|
|
18297
|
+
return this.setSourceMapRange(this.createTaggedTemplateExpression(localizeTag, {
|
|
18298
|
+
elements,
|
|
18299
|
+
expressions
|
|
18300
|
+
}), ast.sourceSpan);
|
|
18096
18301
|
}
|
|
18097
18302
|
visitBuiltinType(ast) {
|
|
18098
18303
|
let builtInType;
|
|
@@ -18149,7 +18354,10 @@ class ExpressionTranslatorVisitor {
|
|
|
18149
18354
|
cooked.push(this.factory.setSourceMapRange(this.factory.createLiteral(element.cooked), element.range));
|
|
18150
18355
|
raw.push(this.factory.setSourceMapRange(this.factory.createLiteral(element.raw), element.range));
|
|
18151
18356
|
}
|
|
18152
|
-
const templateHelperCall = this.factory.createCallExpression(__makeTemplateObjectHelper, [
|
|
18357
|
+
const templateHelperCall = this.factory.createCallExpression(__makeTemplateObjectHelper, [
|
|
18358
|
+
this.factory.createArrayLiteral(cooked),
|
|
18359
|
+
this.factory.createArrayLiteral(raw)
|
|
18360
|
+
], false);
|
|
18153
18361
|
return this.factory.createCallExpression(tagHandler, [templateHelperCall, ...expressions], false);
|
|
18154
18362
|
}
|
|
18155
18363
|
visitExternalExpr(ast, _context) {
|
|
@@ -18179,7 +18387,9 @@ class ExpressionTranslatorVisitor {
|
|
|
18179
18387
|
visitDynamicImportExpr(ast, context) {
|
|
18180
18388
|
const urlExpression = typeof ast.url === "string" ? this.factory.createLiteral(ast.url) : ast.url.visitExpression(this, context);
|
|
18181
18389
|
if (ast.urlComment) {
|
|
18182
|
-
this.factory.attachComments(urlExpression, [
|
|
18390
|
+
this.factory.attachComments(urlExpression, [
|
|
18391
|
+
o.leadingComment(ast.urlComment, true)
|
|
18392
|
+
]);
|
|
18183
18393
|
}
|
|
18184
18394
|
return this.factory.createDynamicImport(urlExpression);
|
|
18185
18395
|
}
|
|
@@ -18319,8 +18529,16 @@ function createRange(span) {
|
|
|
18319
18529
|
end: { offset: end.offset, line: end.line, column: end.col }
|
|
18320
18530
|
};
|
|
18321
18531
|
}
|
|
18322
|
-
var UNARY_OPERATORS, BINARY_OPERATORS;
|
|
18532
|
+
var o, UNARY_OPERATORS, BINARY_OPERATORS;
|
|
18323
18533
|
var init_translator = __esm(() => {
|
|
18534
|
+
o = (() => {
|
|
18535
|
+
try {
|
|
18536
|
+
return __require("@angular/compiler");
|
|
18537
|
+
} catch {
|
|
18538
|
+
const stub = new Proxy(function() {}, { apply: () => stub, construct: () => stub, get: () => stub });
|
|
18539
|
+
return stub;
|
|
18540
|
+
}
|
|
18541
|
+
})();
|
|
18324
18542
|
UNARY_OPERATORS = /* @__PURE__ */ new Map([
|
|
18325
18543
|
[o.UnaryOperator.Minus, "-"],
|
|
18326
18544
|
[o.UnaryOperator.Plus, "+"]
|
|
@@ -18455,7 +18673,9 @@ class TypeScriptAstFactory {
|
|
|
18455
18673
|
createElementAccess = ts6.factory.createElementAccessExpression;
|
|
18456
18674
|
createExpressionStatement = ts6.factory.createExpressionStatement;
|
|
18457
18675
|
createDynamicImport(url) {
|
|
18458
|
-
return ts6.factory.createCallExpression(ts6.factory.createToken(ts6.SyntaxKind.ImportKeyword), undefined, [
|
|
18676
|
+
return ts6.factory.createCallExpression(ts6.factory.createToken(ts6.SyntaxKind.ImportKeyword), undefined, [
|
|
18677
|
+
typeof url === "string" ? ts6.factory.createStringLiteral(url) : url
|
|
18678
|
+
]);
|
|
18459
18679
|
}
|
|
18460
18680
|
createFunctionDeclaration(functionName, parameters, body) {
|
|
18461
18681
|
if (!ts6.isBlock(body)) {
|
|
@@ -18658,9 +18878,18 @@ var init_typescript_ast_factory = __esm(() => {
|
|
|
18658
18878
|
function translateStatement(contextFile, statement, imports, options = {}) {
|
|
18659
18879
|
return statement.visitStatement(new ExpressionTranslatorVisitor(new TypeScriptAstFactory(options.annotateForClosureCompiler === true), imports, contextFile, options), new Context(true));
|
|
18660
18880
|
}
|
|
18881
|
+
var o2;
|
|
18661
18882
|
var init_typescript_translator = __esm(() => {
|
|
18662
18883
|
init_translator();
|
|
18663
18884
|
init_typescript_ast_factory();
|
|
18885
|
+
o2 = (() => {
|
|
18886
|
+
try {
|
|
18887
|
+
return __require("@angular/compiler");
|
|
18888
|
+
} catch {
|
|
18889
|
+
const stub = new Proxy(function() {}, { apply: () => stub, construct: () => stub, get: () => stub });
|
|
18890
|
+
return stub;
|
|
18891
|
+
}
|
|
18892
|
+
})();
|
|
18664
18893
|
});
|
|
18665
18894
|
|
|
18666
18895
|
// src/dev/angular/fastHmrCompiler.ts
|
|
@@ -18672,7 +18901,7 @@ __export(exports_fastHmrCompiler, {
|
|
|
18672
18901
|
invalidateFingerprintCache: () => invalidateFingerprintCache
|
|
18673
18902
|
});
|
|
18674
18903
|
import { existsSync as existsSync25, readFileSync as readFileSync19, statSync as statSync4 } from "fs";
|
|
18675
|
-
import { dirname as
|
|
18904
|
+
import { dirname as dirname19, extname as extname10, relative as relative14, resolve as resolve33 } from "path";
|
|
18676
18905
|
import ts7 from "typescript";
|
|
18677
18906
|
var fail = (reason, detail, location) => ({
|
|
18678
18907
|
ok: false,
|
|
@@ -18894,7 +19123,7 @@ var fail = (reason, detail, location) => ({
|
|
|
18894
19123
|
if (!spec.startsWith(".") && !spec.startsWith("/")) {
|
|
18895
19124
|
return true;
|
|
18896
19125
|
}
|
|
18897
|
-
const base =
|
|
19126
|
+
const base = resolve33(componentDir, spec);
|
|
18898
19127
|
const candidates = [
|
|
18899
19128
|
`${base}.ts`,
|
|
18900
19129
|
`${base}.tsx`,
|
|
@@ -19469,7 +19698,10 @@ var fail = (reason, detail, location) => ({
|
|
|
19469
19698
|
try {
|
|
19470
19699
|
source = readFileSync19(filePath, "utf-8");
|
|
19471
19700
|
} catch {
|
|
19472
|
-
childComponentInfoCache.set(cacheKey2, {
|
|
19701
|
+
childComponentInfoCache.set(cacheKey2, {
|
|
19702
|
+
info: null,
|
|
19703
|
+
mtimeMs: stat3.mtimeMs
|
|
19704
|
+
});
|
|
19473
19705
|
return null;
|
|
19474
19706
|
}
|
|
19475
19707
|
const sf = ts7.createSourceFile(filePath, source, ts7.ScriptTarget.Latest, true);
|
|
@@ -19657,7 +19889,7 @@ var fail = (reason, detail, location) => ({
|
|
|
19657
19889
|
});
|
|
19658
19890
|
if (!names.includes(className))
|
|
19659
19891
|
continue;
|
|
19660
|
-
const nextDts = resolveDtsFromSpec(fromPath,
|
|
19892
|
+
const nextDts = resolveDtsFromSpec(fromPath, dirname19(startDtsPath));
|
|
19661
19893
|
if (!nextDts)
|
|
19662
19894
|
continue;
|
|
19663
19895
|
const found = findDtsContainingClass(nextDts, className, visited);
|
|
@@ -19667,7 +19899,7 @@ var fail = (reason, detail, location) => ({
|
|
|
19667
19899
|
const starReExportRe = /export\s*\*\s*from\s*["']([^"']+)["']/g;
|
|
19668
19900
|
while ((m = starReExportRe.exec(content)) !== null) {
|
|
19669
19901
|
const fromPath = m[1] || "";
|
|
19670
|
-
const nextDts = resolveDtsFromSpec(fromPath,
|
|
19902
|
+
const nextDts = resolveDtsFromSpec(fromPath, dirname19(startDtsPath));
|
|
19671
19903
|
if (!nextDts)
|
|
19672
19904
|
continue;
|
|
19673
19905
|
const found = findDtsContainingClass(nextDts, className, visited);
|
|
@@ -19677,7 +19909,7 @@ var fail = (reason, detail, location) => ({
|
|
|
19677
19909
|
return null;
|
|
19678
19910
|
}, resolveDtsFromSpec = (spec, fromDir) => {
|
|
19679
19911
|
const stripped = spec.replace(/\.[mc]?js$/, "");
|
|
19680
|
-
const base =
|
|
19912
|
+
const base = resolve33(fromDir, stripped);
|
|
19681
19913
|
const candidates = [
|
|
19682
19914
|
`${base}.d.ts`,
|
|
19683
19915
|
`${base}.d.mts`,
|
|
@@ -19701,7 +19933,7 @@ var fail = (reason, detail, location) => ({
|
|
|
19701
19933
|
return null;
|
|
19702
19934
|
}, resolveChildComponentInfo = (className, spec, componentDir, projectRoot) => {
|
|
19703
19935
|
if (spec.startsWith(".") || spec.startsWith("/")) {
|
|
19704
|
-
const base =
|
|
19936
|
+
const base = resolve33(componentDir, spec);
|
|
19705
19937
|
const candidates = [
|
|
19706
19938
|
`${base}.ts`,
|
|
19707
19939
|
`${base}.tsx`,
|
|
@@ -19871,13 +20103,13 @@ var fail = (reason, detail, location) => ({
|
|
|
19871
20103
|
}
|
|
19872
20104
|
if (!matches)
|
|
19873
20105
|
continue;
|
|
19874
|
-
const resolved =
|
|
20106
|
+
const resolved = resolve33(componentDir, spec);
|
|
19875
20107
|
for (const ext of TS_EXTENSIONS) {
|
|
19876
20108
|
const candidate = resolved + ext;
|
|
19877
20109
|
if (existsSync25(candidate))
|
|
19878
20110
|
return candidate;
|
|
19879
20111
|
}
|
|
19880
|
-
const indexCandidate =
|
|
20112
|
+
const indexCandidate = resolve33(resolved, "index.ts");
|
|
19881
20113
|
if (existsSync25(indexCandidate))
|
|
19882
20114
|
return indexCandidate;
|
|
19883
20115
|
}
|
|
@@ -20064,7 +20296,7 @@ ${transpiled}
|
|
|
20064
20296
|
}
|
|
20065
20297
|
}${staticPatch}`;
|
|
20066
20298
|
}, STYLE_PREPROCESSED_EXT, resolveAndReadStyleResource = (componentDir, url) => {
|
|
20067
|
-
const abs =
|
|
20299
|
+
const abs = resolve33(componentDir, url);
|
|
20068
20300
|
if (!existsSync25(abs))
|
|
20069
20301
|
return null;
|
|
20070
20302
|
const ext = extname10(abs).toLowerCase();
|
|
@@ -20104,7 +20336,7 @@ ${block}
|
|
|
20104
20336
|
const cached = projectOptionsCache.get(projectRoot);
|
|
20105
20337
|
if (cached !== undefined)
|
|
20106
20338
|
return cached;
|
|
20107
|
-
const tsconfigPath =
|
|
20339
|
+
const tsconfigPath = resolve33(projectRoot, "tsconfig.json");
|
|
20108
20340
|
const opts = {};
|
|
20109
20341
|
if (existsSync25(tsconfigPath)) {
|
|
20110
20342
|
try {
|
|
@@ -20150,7 +20382,7 @@ ${block}
|
|
|
20150
20382
|
}
|
|
20151
20383
|
const kind = params.kind ?? "component";
|
|
20152
20384
|
if (kind !== "component") {
|
|
20153
|
-
const entityId = encodeURIComponent(`${
|
|
20385
|
+
const entityId = encodeURIComponent(`${relative14(projectRoot, componentFilePath).replace(/\\/g, "/")}@${className}`);
|
|
20154
20386
|
const currentEntityFingerprint = extractEntityFingerprint(classNode, className, sourceFile);
|
|
20155
20387
|
const cachedEntityFingerprint = entityFingerprintCache.get(entityId);
|
|
20156
20388
|
if (cachedEntityFingerprint !== undefined && !entityFingerprintsEqual(cachedEntityFingerprint, currentEntityFingerprint)) {
|
|
@@ -20168,7 +20400,7 @@ ${block}
|
|
|
20168
20400
|
ok: true
|
|
20169
20401
|
};
|
|
20170
20402
|
}
|
|
20171
|
-
if (inheritsDecoratedClass(classNode, sourceFile,
|
|
20403
|
+
if (inheritsDecoratedClass(classNode, sourceFile, dirname19(componentFilePath), projectRoot)) {
|
|
20172
20404
|
return fail("inherits-decorated-class");
|
|
20173
20405
|
}
|
|
20174
20406
|
const decorator = findComponentDecorator(classNode);
|
|
@@ -20180,14 +20412,14 @@ ${block}
|
|
|
20180
20412
|
const projectDefaults = readProjectAngularCompilerOptions(projectRoot);
|
|
20181
20413
|
const decoratorMeta = readDecoratorMeta(decoratorArgs, projectDefaults);
|
|
20182
20414
|
const advancedMetadata = extractAdvancedMetadata(classNode, decoratorArgs, compiler);
|
|
20183
|
-
const componentDir =
|
|
20415
|
+
const componentDir = dirname19(componentFilePath);
|
|
20184
20416
|
let templateText;
|
|
20185
20417
|
let templatePath;
|
|
20186
20418
|
if (decoratorMeta.template !== null) {
|
|
20187
20419
|
templateText = decoratorMeta.template;
|
|
20188
20420
|
templatePath = componentFilePath;
|
|
20189
20421
|
} else if (decoratorMeta.templateUrl) {
|
|
20190
|
-
const tplAbs =
|
|
20422
|
+
const tplAbs = resolve33(componentDir, decoratorMeta.templateUrl);
|
|
20191
20423
|
if (!existsSync25(tplAbs)) {
|
|
20192
20424
|
return fail("template-resource-not-found", `Template file not found: ${tplAbs}`, { file: componentFilePath });
|
|
20193
20425
|
}
|
|
@@ -20232,13 +20464,8 @@ ${block}
|
|
|
20232
20464
|
if (!className_)
|
|
20233
20465
|
return fail("class-not-found", "anonymous class");
|
|
20234
20466
|
const wrappedClass = new compiler.WrappedNodeExpr(className_);
|
|
20235
|
-
const {
|
|
20236
|
-
|
|
20237
|
-
outputs,
|
|
20238
|
-
hasDecoratorIO,
|
|
20239
|
-
hasSignalIO
|
|
20240
|
-
} = extractInputsAndOutputs(classNode, compiler);
|
|
20241
|
-
const projectRelPath = relative13(projectRoot, componentFilePath).replace(/\\/g, "/");
|
|
20467
|
+
const { inputs, outputs, hasDecoratorIO, hasSignalIO } = extractInputsAndOutputs(classNode, compiler);
|
|
20468
|
+
const projectRelPath = relative14(projectRoot, componentFilePath).replace(/\\/g, "/");
|
|
20242
20469
|
const fingerprintId = encodeURIComponent(`${projectRelPath}@${className}`);
|
|
20243
20470
|
const currentFingerprint = extractFingerprint(classNode, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
|
|
20244
20471
|
const cachedFingerprint = fingerprintCache.get(fingerprintId);
|
|
@@ -20441,11 +20668,7 @@ var init_fastHmrCompiler = __esm(() => {
|
|
|
20441
20668
|
fingerprintCache = new Map;
|
|
20442
20669
|
pendingModuleCache = new Map;
|
|
20443
20670
|
entityFingerprintCache = new Map;
|
|
20444
|
-
ENTITY_DECORATOR_NAMES = new Set([
|
|
20445
|
-
"Pipe",
|
|
20446
|
-
"Directive",
|
|
20447
|
-
"Injectable"
|
|
20448
|
-
]);
|
|
20671
|
+
ENTITY_DECORATOR_NAMES = new Set(["Pipe", "Directive", "Injectable"]);
|
|
20449
20672
|
VIEW_ENCAPSULATION_VALUES = {
|
|
20450
20673
|
Emulated: 0,
|
|
20451
20674
|
ExperimentalIsolatedShadowDom: 4,
|
|
@@ -20492,7 +20715,7 @@ __export(exports_hmrCompiler, {
|
|
|
20492
20715
|
getApplyMetadataModule: () => getApplyMetadataModule,
|
|
20493
20716
|
encodeHmrComponentId: () => encodeHmrComponentId
|
|
20494
20717
|
});
|
|
20495
|
-
import { dirname as
|
|
20718
|
+
import { dirname as dirname20, relative as relative15, resolve as resolve34 } from "path";
|
|
20496
20719
|
import { performance as performance2 } from "perf_hooks";
|
|
20497
20720
|
var getApplyMetadataModule = async (encodedId) => {
|
|
20498
20721
|
const decoded = decodeURIComponent(encodedId);
|
|
@@ -20501,8 +20724,8 @@ var getApplyMetadataModule = async (encodedId) => {
|
|
|
20501
20724
|
return null;
|
|
20502
20725
|
const filePathRel = decoded.slice(0, at2);
|
|
20503
20726
|
const className = decoded.slice(at2 + 1);
|
|
20504
|
-
const componentFilePath =
|
|
20505
|
-
const projectRelPath =
|
|
20727
|
+
const componentFilePath = resolve34(process.cwd(), filePathRel);
|
|
20728
|
+
const projectRelPath = relative15(process.cwd(), componentFilePath).replace(/\\/g, "/");
|
|
20506
20729
|
const cacheKey2 = encodeURIComponent(`${projectRelPath}@${className}`);
|
|
20507
20730
|
const { takePendingModule: takePendingModule2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
|
|
20508
20731
|
const cached = takePendingModule2(cacheKey2);
|
|
@@ -20512,9 +20735,9 @@ var getApplyMetadataModule = async (encodedId) => {
|
|
|
20512
20735
|
const { resolveOwningComponents: resolveOwningComponents2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
|
|
20513
20736
|
const owners = resolveOwningComponents2({
|
|
20514
20737
|
changedFilePath: componentFilePath,
|
|
20515
|
-
userAngularRoot:
|
|
20738
|
+
userAngularRoot: dirname20(componentFilePath)
|
|
20516
20739
|
});
|
|
20517
|
-
const owner = owners.find((
|
|
20740
|
+
const owner = owners.find((o3) => o3.className === className);
|
|
20518
20741
|
const kind = owner?.kind ?? "component";
|
|
20519
20742
|
const fastStart = performance2.now();
|
|
20520
20743
|
const fast = await tryFastHmr({ className, componentFilePath, kind });
|
|
@@ -20524,7 +20747,7 @@ var getApplyMetadataModule = async (encodedId) => {
|
|
|
20524
20747
|
}
|
|
20525
20748
|
return null;
|
|
20526
20749
|
}, encodeHmrComponentId = (absoluteFilePath, className) => {
|
|
20527
|
-
const projectRel =
|
|
20750
|
+
const projectRel = relative15(process.cwd(), absoluteFilePath).replace(/\\/g, "/");
|
|
20528
20751
|
return `${projectRel}@${className}`;
|
|
20529
20752
|
};
|
|
20530
20753
|
var init_hmrCompiler = __esm(() => {
|
|
@@ -20663,11 +20886,11 @@ var exports_simpleHTMLHMR = {};
|
|
|
20663
20886
|
__export(exports_simpleHTMLHMR, {
|
|
20664
20887
|
handleHTMLUpdate: () => handleHTMLUpdate
|
|
20665
20888
|
});
|
|
20666
|
-
import { resolve as
|
|
20889
|
+
import { resolve as resolve35 } from "path";
|
|
20667
20890
|
var handleHTMLUpdate = async (htmlFilePath) => {
|
|
20668
20891
|
let htmlContent;
|
|
20669
20892
|
try {
|
|
20670
|
-
const resolvedPath =
|
|
20893
|
+
const resolvedPath = resolve35(htmlFilePath);
|
|
20671
20894
|
const file4 = Bun.file(resolvedPath);
|
|
20672
20895
|
if (!await file4.exists()) {
|
|
20673
20896
|
return null;
|
|
@@ -20693,11 +20916,11 @@ var exports_simpleHTMXHMR = {};
|
|
|
20693
20916
|
__export(exports_simpleHTMXHMR, {
|
|
20694
20917
|
handleHTMXUpdate: () => handleHTMXUpdate
|
|
20695
20918
|
});
|
|
20696
|
-
import { resolve as
|
|
20919
|
+
import { resolve as resolve36 } from "path";
|
|
20697
20920
|
var handleHTMXUpdate = async (htmxFilePath) => {
|
|
20698
20921
|
let htmlContent;
|
|
20699
20922
|
try {
|
|
20700
|
-
const resolvedPath =
|
|
20923
|
+
const resolvedPath = resolve36(htmxFilePath);
|
|
20701
20924
|
const file4 = Bun.file(resolvedPath);
|
|
20702
20925
|
if (!await file4.exists()) {
|
|
20703
20926
|
return null;
|
|
@@ -20720,7 +20943,7 @@ var init_simpleHTMXHMR = () => {};
|
|
|
20720
20943
|
|
|
20721
20944
|
// src/dev/rebuildTrigger.ts
|
|
20722
20945
|
import { existsSync as existsSync26 } from "fs";
|
|
20723
|
-
import { basename as basename11, dirname as
|
|
20946
|
+
import { basename as basename11, dirname as dirname21, relative as relative16, resolve as resolve37, sep as sep4 } from "path";
|
|
20724
20947
|
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) => {
|
|
20725
20948
|
if (!config.tailwind)
|
|
20726
20949
|
return;
|
|
@@ -20812,7 +21035,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20812
21035
|
state.fileHashes.delete(filePathInSet);
|
|
20813
21036
|
try {
|
|
20814
21037
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, filePathInSet);
|
|
20815
|
-
const deletedPathResolved =
|
|
21038
|
+
const deletedPathResolved = resolve37(filePathInSet);
|
|
20816
21039
|
affectedFiles.forEach((affectedFile) => {
|
|
20817
21040
|
if (isValidDeletedAffectedFile(affectedFile, deletedPathResolved, processedFiles)) {
|
|
20818
21041
|
validFiles.push(affectedFile);
|
|
@@ -20856,7 +21079,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20856
21079
|
if (storedHash !== undefined && storedHash === fileHash) {
|
|
20857
21080
|
return;
|
|
20858
21081
|
}
|
|
20859
|
-
const normalizedFilePath =
|
|
21082
|
+
const normalizedFilePath = resolve37(filePathInSet);
|
|
20860
21083
|
if (!processedFiles.has(normalizedFilePath)) {
|
|
20861
21084
|
validFiles.push(normalizedFilePath);
|
|
20862
21085
|
processedFiles.add(normalizedFilePath);
|
|
@@ -20960,8 +21183,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20960
21183
|
return;
|
|
20961
21184
|
}
|
|
20962
21185
|
if (framework === "unknown") {
|
|
20963
|
-
invalidate(
|
|
20964
|
-
const relPath =
|
|
21186
|
+
invalidate(resolve37(filePath));
|
|
21187
|
+
const relPath = relative16(process.cwd(), filePath);
|
|
20965
21188
|
logHmrUpdate(relPath);
|
|
20966
21189
|
return;
|
|
20967
21190
|
}
|
|
@@ -20987,7 +21210,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20987
21210
|
const userEditedFiles = new Set;
|
|
20988
21211
|
state.fileChangeQueue.forEach((filePaths) => {
|
|
20989
21212
|
for (const filePath2 of filePaths) {
|
|
20990
|
-
userEditedFiles.add(
|
|
21213
|
+
userEditedFiles.add(resolve37(filePath2));
|
|
20991
21214
|
}
|
|
20992
21215
|
});
|
|
20993
21216
|
state.lastUserEditedFiles = userEditedFiles;
|
|
@@ -21016,7 +21239,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21016
21239
|
}
|
|
21017
21240
|
if (!graph)
|
|
21018
21241
|
return componentFile;
|
|
21019
|
-
const dependents = graph.dependents.get(
|
|
21242
|
+
const dependents = graph.dependents.get(resolve37(componentFile));
|
|
21020
21243
|
if (!dependents)
|
|
21021
21244
|
return componentFile;
|
|
21022
21245
|
for (const dep of dependents) {
|
|
@@ -21025,7 +21248,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21025
21248
|
}
|
|
21026
21249
|
return componentFile;
|
|
21027
21250
|
}, resolveAngularPageEntries = (state, angularFiles, angularPagesPath) => {
|
|
21028
|
-
const pageEntries = angularFiles.filter((file4) => file4.endsWith(".ts") &&
|
|
21251
|
+
const pageEntries = angularFiles.filter((file4) => file4.endsWith(".ts") && resolve37(file4).startsWith(angularPagesPath));
|
|
21029
21252
|
if (pageEntries.length > 0 || !state.dependencyGraph) {
|
|
21030
21253
|
return pageEntries;
|
|
21031
21254
|
}
|
|
@@ -21034,7 +21257,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21034
21257
|
const lookupFile = resolveComponentLookupFile(componentFile, state.dependencyGraph);
|
|
21035
21258
|
const affected = getAffectedFiles(state.dependencyGraph, lookupFile);
|
|
21036
21259
|
affected.forEach((file4) => {
|
|
21037
|
-
if (file4.endsWith(".ts") &&
|
|
21260
|
+
if (file4.endsWith(".ts") && resolve37(file4).startsWith(angularPagesPath)) {
|
|
21038
21261
|
resolvedPages.add(file4);
|
|
21039
21262
|
}
|
|
21040
21263
|
});
|
|
@@ -21306,16 +21529,16 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21306
21529
|
};
|
|
21307
21530
|
const fire = () => {
|
|
21308
21531
|
ctx.debounceTimer = null;
|
|
21309
|
-
const
|
|
21532
|
+
const resolve38 = ctx.debouncedResolve;
|
|
21310
21533
|
ctx.debouncedResolve = null;
|
|
21311
21534
|
ctx.debouncedPromise = null;
|
|
21312
21535
|
if (ctx.inFlight) {
|
|
21313
21536
|
ctx.pending = true;
|
|
21314
|
-
ctx.inFlight.finally(() =>
|
|
21537
|
+
ctx.inFlight.finally(() => resolve38?.());
|
|
21315
21538
|
return;
|
|
21316
21539
|
}
|
|
21317
21540
|
ctx.inFlight = drive();
|
|
21318
|
-
ctx.inFlight.finally(() =>
|
|
21541
|
+
ctx.inFlight.finally(() => resolve38?.());
|
|
21319
21542
|
};
|
|
21320
21543
|
return ({ immediate = false } = {}) => {
|
|
21321
21544
|
if (!ctx.debouncedPromise) {
|
|
@@ -21342,9 +21565,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21342
21565
|
const diskRefreshPromise = (async () => {
|
|
21343
21566
|
if (!angularDir || editedFiles.size === 0)
|
|
21344
21567
|
return;
|
|
21345
|
-
const angularDirAbs =
|
|
21568
|
+
const angularDirAbs = resolve37(angularDir);
|
|
21346
21569
|
const filesUnderAngular = Array.from(editedFiles).filter((file4) => {
|
|
21347
|
-
const abs =
|
|
21570
|
+
const abs = resolve37(file4);
|
|
21348
21571
|
return abs === angularDirAbs || abs.startsWith(angularDirAbs + sep4);
|
|
21349
21572
|
});
|
|
21350
21573
|
if (filesUnderAngular.length === 0)
|
|
@@ -21366,7 +21589,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21366
21589
|
if (!ext)
|
|
21367
21590
|
continue;
|
|
21368
21591
|
if (ext === ".ts" || ext === ".tsx") {
|
|
21369
|
-
tsFilesToRefresh.add(
|
|
21592
|
+
tsFilesToRefresh.add(resolve37(file4));
|
|
21370
21593
|
continue;
|
|
21371
21594
|
}
|
|
21372
21595
|
const owners = resolveOwningComponents2({
|
|
@@ -21374,7 +21597,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21374
21597
|
userAngularRoot: angularDirAbs
|
|
21375
21598
|
});
|
|
21376
21599
|
for (const owner of owners) {
|
|
21377
|
-
tsFilesToRefresh.add(
|
|
21600
|
+
tsFilesToRefresh.add(resolve37(owner.componentFilePath));
|
|
21378
21601
|
}
|
|
21379
21602
|
}
|
|
21380
21603
|
if (tsFilesToRefresh.size === 0)
|
|
@@ -21385,8 +21608,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21385
21608
|
try {
|
|
21386
21609
|
const { invalidateModule: invalidateModule2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
21387
21610
|
for (const tsFile of tsFilesToRefresh) {
|
|
21388
|
-
const rel =
|
|
21389
|
-
const compiledFile =
|
|
21611
|
+
const rel = relative16(angularDirAbs, tsFile).replace(/\\/g, "/").replace(/\.[tj]sx?$/, ".js");
|
|
21612
|
+
const compiledFile = resolve37(compiledRoot, rel);
|
|
21390
21613
|
invalidateModule2(compiledFile);
|
|
21391
21614
|
}
|
|
21392
21615
|
} catch {}
|
|
@@ -21415,7 +21638,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21415
21638
|
serverPaths.forEach((serverPath, idx) => {
|
|
21416
21639
|
const fileBase = basename11(serverPath, ".js");
|
|
21417
21640
|
const ssrPath = ssrPaths[idx] ?? serverPath;
|
|
21418
|
-
state.manifest[toPascal(fileBase)] =
|
|
21641
|
+
state.manifest[toPascal(fileBase)] = resolve37(ssrPath);
|
|
21419
21642
|
});
|
|
21420
21643
|
if (clientPaths.length > 0) {
|
|
21421
21644
|
await bundleAngularClient(state, clientPaths, state.resolvedPaths.buildDir, angularDir);
|
|
@@ -21424,9 +21647,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21424
21647
|
const angularDir = config.angularDirectory ?? "";
|
|
21425
21648
|
const angularFiles = filesToRebuild.filter((file4) => detectFramework(file4, state.resolvedPaths) === "angular");
|
|
21426
21649
|
for (const file4 of angularFiles) {
|
|
21427
|
-
state.fileHashes.set(
|
|
21650
|
+
state.fileHashes.set(resolve37(file4), computeFileHash(file4));
|
|
21428
21651
|
}
|
|
21429
|
-
const angularPagesPath =
|
|
21652
|
+
const angularPagesPath = resolve37(angularDir, "pages");
|
|
21430
21653
|
const pageEntries = resolveAngularPageEntries(state, angularFiles, angularPagesPath);
|
|
21431
21654
|
const tierStart = performance.now();
|
|
21432
21655
|
const verdict = await decideAngularTier(state, angularDir);
|
|
@@ -21456,7 +21679,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21456
21679
|
}, getModuleUrl = async (pageFile) => {
|
|
21457
21680
|
const { invalidateModule: invalidateModule2, warmCache: warmCache2, SRC_URL_PREFIX: SRC_URL_PREFIX2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
21458
21681
|
invalidateModule2(pageFile);
|
|
21459
|
-
const rel =
|
|
21682
|
+
const rel = relative16(process.cwd(), pageFile).replace(/\\/g, "/");
|
|
21460
21683
|
const url = `${SRC_URL_PREFIX2}${rel}`;
|
|
21461
21684
|
warmCache2(url);
|
|
21462
21685
|
return url;
|
|
@@ -21465,11 +21688,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21465
21688
|
if (isComponentFile2)
|
|
21466
21689
|
return primaryFile;
|
|
21467
21690
|
const { findNearestComponent: findNearestComponent2 } = await Promise.resolve().then(() => (init_transformCache(), exports_transformCache));
|
|
21468
|
-
const nearest = findNearestComponent2(
|
|
21691
|
+
const nearest = findNearestComponent2(resolve37(primaryFile));
|
|
21469
21692
|
return nearest ?? primaryFile;
|
|
21470
21693
|
}, handleReactModuleServerPath = async (state, reactFiles, startTime, onRebuildComplete) => {
|
|
21471
21694
|
for (const file4 of reactFiles) {
|
|
21472
|
-
state.fileHashes.set(
|
|
21695
|
+
state.fileHashes.set(resolve37(file4), computeFileHash(file4));
|
|
21473
21696
|
}
|
|
21474
21697
|
markSsrCacheDirty("react");
|
|
21475
21698
|
const primaryFile = reactFiles.find((file4) => !file4.replace(/\\/g, "/").includes("/pages/")) ?? reactFiles[0];
|
|
@@ -21488,7 +21711,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21488
21711
|
const pageModuleUrl = await getReactModuleUrl(broadcastTarget);
|
|
21489
21712
|
if (pageModuleUrl) {
|
|
21490
21713
|
const serverDuration = Date.now() - startTime;
|
|
21491
|
-
state.lastHmrPath =
|
|
21714
|
+
state.lastHmrPath = relative16(process.cwd(), primaryFile).replace(/\\/g, "/");
|
|
21492
21715
|
state.lastHmrFramework = "react";
|
|
21493
21716
|
broadcastToClients(state, {
|
|
21494
21717
|
data: {
|
|
@@ -21551,7 +21774,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21551
21774
|
});
|
|
21552
21775
|
}, handleSvelteModuleServerPath = async (state, svelteFiles, startTime, onRebuildComplete) => {
|
|
21553
21776
|
for (const file4 of svelteFiles) {
|
|
21554
|
-
state.fileHashes.set(
|
|
21777
|
+
state.fileHashes.set(resolve37(file4), computeFileHash(file4));
|
|
21555
21778
|
}
|
|
21556
21779
|
markSsrCacheDirty("svelte");
|
|
21557
21780
|
const serverDuration = Date.now() - startTime;
|
|
@@ -21576,8 +21799,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21576
21799
|
const serverEntries = [...svelteServerPaths];
|
|
21577
21800
|
const clientEntries = [...svelteIndexPaths, ...svelteClientPaths];
|
|
21578
21801
|
const { getFrameworkGeneratedDir: getFrameworkGeneratedDir2 } = await Promise.resolve().then(() => (init_generatedDir(), exports_generatedDir));
|
|
21579
|
-
const serverRoot =
|
|
21580
|
-
const serverOutDir =
|
|
21802
|
+
const serverRoot = resolve37(getFrameworkGeneratedDir2("svelte"), "server");
|
|
21803
|
+
const serverOutDir = resolve37(buildDir, basename11(svelteDir));
|
|
21581
21804
|
const [serverResult, clientResult] = await Promise.all([
|
|
21582
21805
|
serverEntries.length > 0 ? bunBuild9({
|
|
21583
21806
|
entrypoints: serverEntries,
|
|
@@ -21674,7 +21897,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21674
21897
|
});
|
|
21675
21898
|
}, handleVueModuleServerPath = async (state, vueFiles, nonVueFiles, startTime, onRebuildComplete) => {
|
|
21676
21899
|
for (const file4 of [...vueFiles, ...nonVueFiles]) {
|
|
21677
|
-
state.fileHashes.set(
|
|
21900
|
+
state.fileHashes.set(resolve37(file4), computeFileHash(file4));
|
|
21678
21901
|
}
|
|
21679
21902
|
markSsrCacheDirty("vue");
|
|
21680
21903
|
await invalidateNonVueModules(nonVueFiles);
|
|
@@ -21702,7 +21925,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21702
21925
|
recursive: true,
|
|
21703
21926
|
withFileTypes: true
|
|
21704
21927
|
});
|
|
21705
|
-
return entries.filter((entry) => entry.isFile() && EMBER_PAGE_EXTENSIONS.some((ext) => entry.name.endsWith(ext))).map((entry) =>
|
|
21928
|
+
return entries.filter((entry) => entry.isFile() && EMBER_PAGE_EXTENSIONS.some((ext) => entry.name.endsWith(ext))).map((entry) => resolve37(emberPagesPath, entry.name));
|
|
21706
21929
|
} catch {
|
|
21707
21930
|
return [];
|
|
21708
21931
|
}
|
|
@@ -21714,10 +21937,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21714
21937
|
return state.manifest;
|
|
21715
21938
|
}
|
|
21716
21939
|
for (const file4 of emberFiles) {
|
|
21717
|
-
state.fileHashes.set(
|
|
21940
|
+
state.fileHashes.set(resolve37(file4), computeFileHash(file4));
|
|
21718
21941
|
}
|
|
21719
|
-
const emberPagesPath =
|
|
21720
|
-
const directPageEntries = emberFiles.filter((file4) =>
|
|
21942
|
+
const emberPagesPath = resolve37(emberDir, "pages");
|
|
21943
|
+
const directPageEntries = emberFiles.filter((file4) => resolve37(file4).startsWith(emberPagesPath));
|
|
21721
21944
|
const allPageEntries = directPageEntries.length > 0 ? directPageEntries : await collectAllEmberPages(emberPagesPath);
|
|
21722
21945
|
if (allPageEntries.length === 0) {
|
|
21723
21946
|
onRebuildComplete({ hmrState: state, manifest: state.manifest });
|
|
@@ -21727,14 +21950,14 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21727
21950
|
const { serverPaths } = await compileEmber2(allPageEntries, emberDir, process.cwd(), true);
|
|
21728
21951
|
for (const serverPath of serverPaths) {
|
|
21729
21952
|
const fileBase = basename11(serverPath, ".js");
|
|
21730
|
-
state.manifest[toPascal(fileBase)] =
|
|
21953
|
+
state.manifest[toPascal(fileBase)] = resolve37(serverPath);
|
|
21731
21954
|
}
|
|
21732
21955
|
const { invalidateEmberSsrCache: invalidateEmberSsrCache2 } = await Promise.resolve().then(() => (init_ember(), exports_ember));
|
|
21733
21956
|
invalidateEmberSsrCache2();
|
|
21734
21957
|
const duration = Date.now() - startTime;
|
|
21735
21958
|
const [primary] = emberFiles;
|
|
21736
21959
|
if (primary) {
|
|
21737
|
-
state.lastHmrPath =
|
|
21960
|
+
state.lastHmrPath = relative16(process.cwd(), primary).replace(/\\/g, "/");
|
|
21738
21961
|
state.lastHmrFramework = "ember";
|
|
21739
21962
|
logHmrUpdate(primary, "ember", duration);
|
|
21740
21963
|
}
|
|
@@ -21819,8 +22042,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21819
22042
|
if (!buildReference?.source) {
|
|
21820
22043
|
return;
|
|
21821
22044
|
}
|
|
21822
|
-
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname :
|
|
21823
|
-
islandFiles.add(
|
|
22045
|
+
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve37(dirname21(buildInfo.resolvedRegistryPath), buildReference.source);
|
|
22046
|
+
islandFiles.add(resolve37(sourcePath));
|
|
21824
22047
|
}, resolveIslandSourceFiles = async (config) => {
|
|
21825
22048
|
const registryPath = config.islands?.registry;
|
|
21826
22049
|
if (!registryPath) {
|
|
@@ -21828,7 +22051,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21828
22051
|
}
|
|
21829
22052
|
const buildInfo = await loadIslandRegistryBuildInfo(registryPath);
|
|
21830
22053
|
const islandFiles = new Set([
|
|
21831
|
-
|
|
22054
|
+
resolve37(buildInfo.resolvedRegistryPath)
|
|
21832
22055
|
]);
|
|
21833
22056
|
for (const definition of buildInfo.definitions) {
|
|
21834
22057
|
resolveIslandDefinitionSource(definition, buildInfo, islandFiles);
|
|
@@ -21839,7 +22062,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21839
22062
|
if (islandFiles.size === 0) {
|
|
21840
22063
|
return false;
|
|
21841
22064
|
}
|
|
21842
|
-
return filesToRebuild.some((file4) => islandFiles.has(
|
|
22065
|
+
return filesToRebuild.some((file4) => islandFiles.has(resolve37(file4)));
|
|
21843
22066
|
}, handleIslandSourceReload = async (state, config, filesToRebuild, manifest) => {
|
|
21844
22067
|
const shouldReload = await didStaticPagesNeedIslandRefresh(config, filesToRebuild);
|
|
21845
22068
|
if (!shouldReload) {
|
|
@@ -21874,10 +22097,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21874
22097
|
}, computeOutputPagesDir = (state, config, framework) => {
|
|
21875
22098
|
const isSingle = !config.reactDirectory && !config.svelteDirectory && !config.vueDirectory && (framework === "html" ? !config.htmxDirectory : !config.htmlDirectory);
|
|
21876
22099
|
if (isSingle) {
|
|
21877
|
-
return
|
|
22100
|
+
return resolve37(state.resolvedPaths.buildDir, "pages");
|
|
21878
22101
|
}
|
|
21879
22102
|
const dirName = framework === "html" ? basename11(config.htmlDirectory ?? "html") : basename11(config.htmxDirectory ?? "htmx");
|
|
21880
|
-
return
|
|
22103
|
+
return resolve37(state.resolvedPaths.buildDir, dirName, "pages");
|
|
21881
22104
|
}, processHtmlPageUpdate = async (state, pageFile, builtHtmlPagePath, manifest, duration) => {
|
|
21882
22105
|
try {
|
|
21883
22106
|
const { handleHTMLUpdate: handleHTMLUpdate2 } = await Promise.resolve().then(() => (init_simpleHTMLHMR(), exports_simpleHTMLHMR));
|
|
@@ -21916,7 +22139,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21916
22139
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmlPages, "*.html") : htmlPageFiles;
|
|
21917
22140
|
await runSequentially(pageFilesToUpdate, async (pageFile) => {
|
|
21918
22141
|
const htmlPageName = basename11(pageFile);
|
|
21919
|
-
const builtHtmlPagePath =
|
|
22142
|
+
const builtHtmlPagePath = resolve37(outputHtmlPages, htmlPageName);
|
|
21920
22143
|
await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration);
|
|
21921
22144
|
});
|
|
21922
22145
|
}, handleVueCssOnlyUpdate = (state, vueCssFiles, manifest, duration) => {
|
|
@@ -21977,11 +22200,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21977
22200
|
const baseName = fileName.replace(/\.vue$/, "");
|
|
21978
22201
|
const pascalName = toPascal(baseName);
|
|
21979
22202
|
const vueRoot = config.vueDirectory;
|
|
21980
|
-
const hmrId = vueRoot ?
|
|
22203
|
+
const hmrId = vueRoot ? relative16(vueRoot, vuePagePath).replace(/\\/g, "/").replace(/\.vue$/, "") : baseName;
|
|
21981
22204
|
const cssKey = `${pascalName}CSS`;
|
|
21982
22205
|
const cssUrl = manifest[cssKey] || null;
|
|
21983
22206
|
const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
|
|
21984
|
-
const hmrMeta = vueHmrMetadata2.get(
|
|
22207
|
+
const hmrMeta = vueHmrMetadata2.get(resolve37(vuePagePath));
|
|
21985
22208
|
const changeType = hmrMeta?.changeType ?? "full";
|
|
21986
22209
|
if (changeType === "style-only") {
|
|
21987
22210
|
broadcastVueStyleOnly(state, vuePagePath, baseName, cssUrl, hmrId, manifest, duration);
|
|
@@ -22166,7 +22389,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22166
22389
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmxPages, "*.html") : htmxPageFiles;
|
|
22167
22390
|
await runSequentially(pageFilesToUpdate, async (htmxPageFile) => {
|
|
22168
22391
|
const htmxPageName = basename11(htmxPageFile);
|
|
22169
|
-
const builtHtmxPagePath =
|
|
22392
|
+
const builtHtmxPagePath = resolve37(outputHtmxPages, htmxPageName);
|
|
22170
22393
|
await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration);
|
|
22171
22394
|
});
|
|
22172
22395
|
}, collectUpdatedModulePaths = (allModuleUpdates) => {
|
|
@@ -22275,7 +22498,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22275
22498
|
html = html.slice(0, bodyClose.index) + hmrScript + html.slice(bodyClose.index);
|
|
22276
22499
|
writeFs(destPath, html);
|
|
22277
22500
|
}, processMarkupFileFastPath = async (state, sourceFile, outputDir, framework, startTime, updateAssetPaths2, handleUpdate, readFs, writeFs) => {
|
|
22278
|
-
const destPath =
|
|
22501
|
+
const destPath = resolve37(outputDir, basename11(sourceFile));
|
|
22279
22502
|
const hmrScript = extractHmrScript(destPath, readFs);
|
|
22280
22503
|
const source = await Bun.file(sourceFile).text();
|
|
22281
22504
|
await Bun.write(destPath, source);
|
|
@@ -22585,7 +22808,7 @@ __export(exports_buildDepVendor, {
|
|
|
22585
22808
|
buildDepVendor: () => buildDepVendor
|
|
22586
22809
|
});
|
|
22587
22810
|
import { mkdirSync as mkdirSync13 } from "fs";
|
|
22588
|
-
import { join as
|
|
22811
|
+
import { join as join30 } from "path";
|
|
22589
22812
|
import { rm as rm10 } from "fs/promises";
|
|
22590
22813
|
var {build: bunBuild9, Glob: Glob9 } = globalThis.Bun;
|
|
22591
22814
|
var toSafeFileName6 = (specifier) => {
|
|
@@ -22598,12 +22821,12 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22598
22821
|
} catch {
|
|
22599
22822
|
return false;
|
|
22600
22823
|
}
|
|
22601
|
-
}, 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,
|
|
22824
|
+
}, 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) => {
|
|
22602
22825
|
const dep = [];
|
|
22603
22826
|
const framework = [];
|
|
22604
22827
|
try {
|
|
22605
22828
|
const content = await Bun.file(file4).text();
|
|
22606
|
-
for (const imp of
|
|
22829
|
+
for (const imp of transpiler6.scanImports(content)) {
|
|
22607
22830
|
if (isDepSpecifier(imp.path))
|
|
22608
22831
|
dep.push(imp.path);
|
|
22609
22832
|
else if (isFrameworkRootCandidate(imp.path))
|
|
@@ -22620,9 +22843,9 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22620
22843
|
} catch {
|
|
22621
22844
|
return empty;
|
|
22622
22845
|
}
|
|
22623
|
-
}, collectDirSpecifiers = async (dir,
|
|
22846
|
+
}, collectDirSpecifiers = async (dir, transpiler6, dep, framework) => {
|
|
22624
22847
|
const files = await scanDirFiles(dir);
|
|
22625
|
-
const results = await Promise.all(files.map((file4) => readFileSpecifiers(file4,
|
|
22848
|
+
const results = await Promise.all(files.map((file4) => readFileSpecifiers(file4, transpiler6)));
|
|
22626
22849
|
for (const result of results) {
|
|
22627
22850
|
for (const spec of result.dep)
|
|
22628
22851
|
dep.add(spec);
|
|
@@ -22632,15 +22855,15 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22632
22855
|
}, scanBareImports = async (directories) => {
|
|
22633
22856
|
const dep = new Set;
|
|
22634
22857
|
const framework = new Set;
|
|
22635
|
-
const
|
|
22636
|
-
await Promise.all(directories.map((dir) => collectDirSpecifiers(dir,
|
|
22858
|
+
const transpiler6 = new Bun.Transpiler({ loader: "tsx" });
|
|
22859
|
+
await Promise.all(directories.map((dir) => collectDirSpecifiers(dir, transpiler6, dep, framework)));
|
|
22637
22860
|
return {
|
|
22638
22861
|
dep: Array.from(dep).filter(isResolvable4),
|
|
22639
22862
|
framework: Array.from(framework).filter(isResolvable4)
|
|
22640
22863
|
};
|
|
22641
22864
|
}, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
|
|
22642
22865
|
const { readFileSync: readFileSync20 } = await import("fs");
|
|
22643
|
-
const
|
|
22866
|
+
const transpiler6 = new Bun.Transpiler({ loader: "js" });
|
|
22644
22867
|
const newSpecs = new Set;
|
|
22645
22868
|
for (const spec of specs) {
|
|
22646
22869
|
if (alreadyScanned.has(spec))
|
|
@@ -22660,7 +22883,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22660
22883
|
}
|
|
22661
22884
|
let imports;
|
|
22662
22885
|
try {
|
|
22663
|
-
imports =
|
|
22886
|
+
imports = transpiler6.scanImports(content);
|
|
22664
22887
|
} catch {
|
|
22665
22888
|
continue;
|
|
22666
22889
|
}
|
|
@@ -22696,7 +22919,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22696
22919
|
}), buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
|
|
22697
22920
|
const entries = await Promise.all(specifiers.map(async (specifier) => {
|
|
22698
22921
|
const safeName = toSafeFileName6(specifier);
|
|
22699
|
-
const entryPath =
|
|
22922
|
+
const entryPath = join30(tmpDir, `${safeName}.ts`);
|
|
22700
22923
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
22701
22924
|
return { entryPath, specifier };
|
|
22702
22925
|
}));
|
|
@@ -22757,9 +22980,9 @@ var toSafeFileName6 = (specifier) => {
|
|
|
22757
22980
|
const { dep: initialSpecs, framework: frameworkRoots } = await scanBareImports(directories);
|
|
22758
22981
|
if (initialSpecs.length === 0 && frameworkRoots.length === 0)
|
|
22759
22982
|
return {};
|
|
22760
|
-
const vendorDir =
|
|
22983
|
+
const vendorDir = join30(buildDir, "vendor");
|
|
22761
22984
|
mkdirSync13(vendorDir, { recursive: true });
|
|
22762
|
-
const tmpDir =
|
|
22985
|
+
const tmpDir = join30(buildDir, "_dep_vendor_tmp");
|
|
22763
22986
|
mkdirSync13(tmpDir, { recursive: true });
|
|
22764
22987
|
const allSpecs = new Set(initialSpecs);
|
|
22765
22988
|
const alreadyScanned = new Set;
|
|
@@ -22842,7 +23065,7 @@ __export(exports_devBuild, {
|
|
|
22842
23065
|
});
|
|
22843
23066
|
import { readdir as readdir5 } from "fs/promises";
|
|
22844
23067
|
import { statSync as statSync5 } from "fs";
|
|
22845
|
-
import { resolve as
|
|
23068
|
+
import { resolve as resolve38 } from "path";
|
|
22846
23069
|
var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
22847
23070
|
const configuredDirs = [
|
|
22848
23071
|
config.reactDirectory,
|
|
@@ -22865,7 +23088,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
22865
23088
|
return Object.keys(config).length > 0 ? config : null;
|
|
22866
23089
|
}, reloadConfig = async () => {
|
|
22867
23090
|
try {
|
|
22868
|
-
const configPath2 =
|
|
23091
|
+
const configPath2 = resolve38(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
22869
23092
|
const source = await Bun.file(configPath2).text();
|
|
22870
23093
|
return parseDirectoryConfig(source);
|
|
22871
23094
|
} catch {
|
|
@@ -22950,7 +23173,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
22950
23173
|
state.fileChangeQueue.clear();
|
|
22951
23174
|
}
|
|
22952
23175
|
}, handleCachedReload = async () => {
|
|
22953
|
-
const serverMtime = statSync5(
|
|
23176
|
+
const serverMtime = statSync5(resolve38(Bun.main)).mtimeMs;
|
|
22954
23177
|
const lastMtime = globalThis.__hmrServerMtime;
|
|
22955
23178
|
globalThis.__hmrServerMtime = serverMtime;
|
|
22956
23179
|
const cached = globalThis.__hmrDevResult;
|
|
@@ -22987,8 +23210,8 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
22987
23210
|
return true;
|
|
22988
23211
|
}, resolveAbsoluteVersion2 = async () => {
|
|
22989
23212
|
const candidates = [
|
|
22990
|
-
|
|
22991
|
-
|
|
23213
|
+
resolve38(import.meta.dir, "..", "..", "package.json"),
|
|
23214
|
+
resolve38(import.meta.dir, "..", "package.json")
|
|
22992
23215
|
];
|
|
22993
23216
|
const [candidate, ...remaining] = candidates;
|
|
22994
23217
|
if (!candidate) {
|
|
@@ -23014,7 +23237,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
23014
23237
|
const entries = await readdir5(vendorDir).catch(() => emptyStringArray);
|
|
23015
23238
|
await Promise.all(entries.filter((entry) => entry.endsWith(".js")).map(async (entry) => {
|
|
23016
23239
|
const webPath = `/${framework}/vendor/${entry}`;
|
|
23017
|
-
const bytes = await Bun.file(
|
|
23240
|
+
const bytes = await Bun.file(resolve38(vendorDir, entry)).bytes();
|
|
23018
23241
|
assetStore.set(webPath, bytes);
|
|
23019
23242
|
}));
|
|
23020
23243
|
}, devBuild = async (config) => {
|
|
@@ -23082,11 +23305,11 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
23082
23305
|
cleanStaleAssets(state.assetStore, manifest, state.resolvedPaths.buildDir);
|
|
23083
23306
|
recordStep("populate asset store", stepStartedAt);
|
|
23084
23307
|
stepStartedAt = performance.now();
|
|
23085
|
-
const reactVendorDir =
|
|
23086
|
-
const angularVendorDir =
|
|
23087
|
-
const svelteVendorDir =
|
|
23088
|
-
const vueVendorDir =
|
|
23089
|
-
const depVendorDir =
|
|
23308
|
+
const reactVendorDir = resolve38(state.resolvedPaths.buildDir, "react", "vendor");
|
|
23309
|
+
const angularVendorDir = resolve38(state.resolvedPaths.buildDir, "angular", "vendor");
|
|
23310
|
+
const svelteVendorDir = resolve38(state.resolvedPaths.buildDir, "svelte", "vendor");
|
|
23311
|
+
const vueVendorDir = resolve38(state.resolvedPaths.buildDir, "vue", "vendor");
|
|
23312
|
+
const depVendorDir = resolve38(state.resolvedPaths.buildDir, "vendor");
|
|
23090
23313
|
const { buildDepVendor: buildDepVendor2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
|
|
23091
23314
|
const [, angularSpecs, , , , , depPaths] = await Promise.all([
|
|
23092
23315
|
config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
|
|
@@ -23164,7 +23387,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
23164
23387
|
manifest
|
|
23165
23388
|
};
|
|
23166
23389
|
globalThis.__hmrDevResult = result;
|
|
23167
|
-
globalThis.__hmrServerMtime = statSync5(
|
|
23390
|
+
globalThis.__hmrServerMtime = statSync5(resolve38(Bun.main)).mtimeMs;
|
|
23168
23391
|
return result;
|
|
23169
23392
|
};
|
|
23170
23393
|
var init_devBuild = __esm(() => {
|
|
@@ -23201,5 +23424,5 @@ export {
|
|
|
23201
23424
|
build
|
|
23202
23425
|
};
|
|
23203
23426
|
|
|
23204
|
-
//# debugId=
|
|
23427
|
+
//# debugId=3B26BE8AA231F38A64756E2164756E21
|
|
23205
23428
|
//# sourceMappingURL=build.js.map
|