@absolutejs/absolute 0.19.0-beta.318 → 0.19.0-beta.319
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/build.js +183 -111
- package/dist/build.js.map +3 -3
- package/dist/cli/index.js +74 -2
- package/dist/index.js +204 -132
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/build.js
CHANGED
|
@@ -505,8 +505,14 @@ var exports_generateIslandBindings = {};
|
|
|
505
505
|
__export(exports_generateIslandBindings, {
|
|
506
506
|
generateIslandBindings: () => generateIslandBindings
|
|
507
507
|
});
|
|
508
|
-
import {
|
|
509
|
-
|
|
508
|
+
import {
|
|
509
|
+
existsSync,
|
|
510
|
+
mkdirSync as mkdirSync2,
|
|
511
|
+
readFileSync,
|
|
512
|
+
rmSync as rmSync2,
|
|
513
|
+
writeFileSync as writeFileSync2
|
|
514
|
+
} from "fs";
|
|
515
|
+
import { dirname as dirname2, relative as relative2, resolve as resolve2 } from "path";
|
|
510
516
|
var ensureDir = (filePath) => {
|
|
511
517
|
mkdirSync2(dirname2(filePath), { recursive: true });
|
|
512
518
|
}, writeIfChanged = (filePath, content) => {
|
|
@@ -516,11 +522,77 @@ var ensureDir = (filePath) => {
|
|
|
516
522
|
if (existsSync(filePath)) {
|
|
517
523
|
rmSync2(filePath, { force: true });
|
|
518
524
|
}
|
|
525
|
+
}, writeHTMLCustomData = (projectRoot) => {
|
|
526
|
+
const customDataPath = resolve2(projectRoot, ".absolutejs", "html-custom-data.json");
|
|
527
|
+
const vscodeSettingsPath = resolve2(projectRoot, ".vscode", "settings.json");
|
|
528
|
+
const customDataRelativePath = relative2(dirname2(vscodeSettingsPath), customDataPath).replace(/\\/g, "/");
|
|
529
|
+
const customData = {
|
|
530
|
+
version: 1.1,
|
|
531
|
+
tags: [
|
|
532
|
+
{
|
|
533
|
+
name: "absolute-island",
|
|
534
|
+
description: "Platform-native AbsoluteJS island element for HTML and HTMX host pages. AbsoluteJS server rendering lowers this element into SSR island markup and the client bootstrap hydrates it according to the `hydrate` mode.",
|
|
535
|
+
attributes: [
|
|
536
|
+
{
|
|
537
|
+
name: "framework",
|
|
538
|
+
description: "Target framework runtime for this island component.",
|
|
539
|
+
values: [
|
|
540
|
+
{ name: "react" },
|
|
541
|
+
{ name: "svelte" },
|
|
542
|
+
{ name: "vue" },
|
|
543
|
+
{ name: "angular" }
|
|
544
|
+
]
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
name: "component",
|
|
548
|
+
description: "Registry component name to render for this island."
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
name: "hydrate",
|
|
552
|
+
description: "Client hydration timing. `load` hydrates immediately, `idle` waits for idle time, `visible` waits for intersection, and `none` renders static HTML only.",
|
|
553
|
+
values: [
|
|
554
|
+
{ name: "load" },
|
|
555
|
+
{ name: "idle" },
|
|
556
|
+
{ name: "visible" },
|
|
557
|
+
{ name: "none" }
|
|
558
|
+
]
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
name: "props",
|
|
562
|
+
description: "JSON-serialized props payload passed to the target island component. In HTML, prefer single quotes around the attribute so the JSON can keep its double quotes."
|
|
563
|
+
}
|
|
564
|
+
]
|
|
565
|
+
}
|
|
566
|
+
]
|
|
567
|
+
};
|
|
568
|
+
writeIfChanged(customDataPath, `${JSON.stringify(customData, null, 2)}
|
|
569
|
+
`);
|
|
570
|
+
let settings = {};
|
|
571
|
+
if (existsSync(vscodeSettingsPath)) {
|
|
572
|
+
try {
|
|
573
|
+
const parsed = JSON.parse(readFileSync(vscodeSettingsPath, "utf-8"));
|
|
574
|
+
if (parsed && typeof parsed === "object") {
|
|
575
|
+
settings = parsed;
|
|
576
|
+
}
|
|
577
|
+
} catch {
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
const currentCustomData = Array.isArray(settings["html.customData"]) ? settings["html.customData"].filter((value) => typeof value === "string") : [];
|
|
582
|
+
if (!currentCustomData.includes(customDataRelativePath)) {
|
|
583
|
+
settings["html.customData"] = [
|
|
584
|
+
...currentCustomData,
|
|
585
|
+
customDataRelativePath
|
|
586
|
+
];
|
|
587
|
+
writeIfChanged(vscodeSettingsPath, `${JSON.stringify(settings, null, 2)}
|
|
588
|
+
`);
|
|
589
|
+
}
|
|
519
590
|
}, generateIslandBindings = (projectRoot, config) => {
|
|
520
591
|
const registryPath = config.islands?.registry;
|
|
521
592
|
if (!registryPath) {
|
|
522
593
|
return;
|
|
523
594
|
}
|
|
595
|
+
writeHTMLCustomData(projectRoot);
|
|
524
596
|
const resolvedRegistryPath = resolve2(projectRoot, registryPath);
|
|
525
597
|
removeIfExists(resolve2(dirname2(resolvedRegistryPath), "absolute-islands.d.ts"));
|
|
526
598
|
if (config.reactDirectory) {
|
|
@@ -561,7 +633,7 @@ __export(exports_generateReactIndexes, {
|
|
|
561
633
|
});
|
|
562
634
|
import { existsSync as existsSync2, mkdirSync as mkdirSync3 } from "fs";
|
|
563
635
|
import { readdir, rm, writeFile } from "fs/promises";
|
|
564
|
-
import { basename, join as join2, relative as
|
|
636
|
+
import { basename, join as join2, relative as relative3, resolve as resolve3, sep } from "path";
|
|
565
637
|
var {Glob } = globalThis.Bun;
|
|
566
638
|
var indexContentCache, resolveDevClientDir = () => {
|
|
567
639
|
const projectRoot = process.cwd();
|
|
@@ -600,7 +672,7 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
600
672
|
});
|
|
601
673
|
}));
|
|
602
674
|
}
|
|
603
|
-
const pagesRelPath =
|
|
675
|
+
const pagesRelPath = relative3(resolve3(reactIndexesDirectory), resolve3(reactPagesDirectory)).split(sep).join("/");
|
|
604
676
|
const promises = files.map(async (file) => {
|
|
605
677
|
const fileName = basename(file);
|
|
606
678
|
const [componentName] = fileName.split(".");
|
|
@@ -871,7 +943,7 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
871
943
|
`
|
|
872
944
|
// Pre-warm: import the page module from the module server`,
|
|
873
945
|
`// immediately so the browser caches all /@src/ URLs.`,
|
|
874
|
-
`import('/@src/${
|
|
946
|
+
`import('/@src/${relative3(process.cwd(), resolve3(reactPagesDirectory, `${componentName}.tsx`)).replace(/\\/g, "/")}').catch(() => {});`
|
|
875
947
|
] : []
|
|
876
948
|
].join(`
|
|
877
949
|
`);
|
|
@@ -1012,7 +1084,7 @@ var init_htmlScriptHMRPlugin = __esm(() => {
|
|
|
1012
1084
|
});
|
|
1013
1085
|
|
|
1014
1086
|
// src/angular/injectorPatch.ts
|
|
1015
|
-
import { existsSync as existsSync3, readFileSync, writeFileSync as writeFileSync3 } from "fs";
|
|
1087
|
+
import { existsSync as existsSync3, readFileSync as readFileSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
1016
1088
|
import { dirname as dirname3, join as join3, resolve as resolve5 } from "path";
|
|
1017
1089
|
var applyInjectorPatch = (chunkPath, content) => {
|
|
1018
1090
|
if (content.includes('Symbol.for("angular.currentInjector")')) {
|
|
@@ -1058,7 +1130,7 @@ var applyInjectorPatch = (chunkPath, content) => {
|
|
|
1058
1130
|
try {
|
|
1059
1131
|
const coreDir = resolveAngularCoreDir();
|
|
1060
1132
|
const chunkPath = join3(coreDir, "fesm2022", "_not_found-chunk.mjs");
|
|
1061
|
-
const content =
|
|
1133
|
+
const content = readFileSync2(chunkPath, "utf-8");
|
|
1062
1134
|
applyInjectorPatch(chunkPath, content);
|
|
1063
1135
|
} catch {}
|
|
1064
1136
|
};
|
|
@@ -30831,9 +30903,9 @@ var init_lowerIslandSyntax = __esm(() => {
|
|
|
30831
30903
|
|
|
30832
30904
|
// src/core/svelteServerModule.ts
|
|
30833
30905
|
import { mkdir } from "fs/promises";
|
|
30834
|
-
import { dirname as dirname4, extname as extname3, join as join4, relative as
|
|
30906
|
+
import { dirname as dirname4, extname as extname3, join as join4, relative as relative4, resolve as resolve7 } from "path";
|
|
30835
30907
|
var serverCacheRoot, compiledModuleCache, transpiler, ensureRelativeImportPath = (from, to) => {
|
|
30836
|
-
const importPath =
|
|
30908
|
+
const importPath = relative4(dirname4(from), to).replace(/\\/g, "/");
|
|
30837
30909
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
30838
30910
|
}, resolveRelativeModule = async (spec, from) => {
|
|
30839
30911
|
if (!spec.startsWith(".")) {
|
|
@@ -30860,7 +30932,7 @@ var serverCacheRoot, compiledModuleCache, transpiler, ensureRelativeImportPath =
|
|
|
30860
30932
|
}
|
|
30861
30933
|
return null;
|
|
30862
30934
|
}, getCachedModulePath = (sourcePath) => {
|
|
30863
|
-
const relativeSourcePath =
|
|
30935
|
+
const relativeSourcePath = relative4(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
30864
30936
|
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
30865
30937
|
return join4(serverCacheRoot, `${normalizedSourcePath}.server.js`);
|
|
30866
30938
|
}, resolveSvelteImport = async (spec, from) => {
|
|
@@ -31098,7 +31170,7 @@ var setCurrentIslandRegistry = (registry) => {
|
|
|
31098
31170
|
};
|
|
31099
31171
|
|
|
31100
31172
|
// src/build/staticIslandPages.ts
|
|
31101
|
-
import { readFileSync as
|
|
31173
|
+
import { readFileSync as readFileSync3, writeFileSync as writeFileSync4 } from "fs";
|
|
31102
31174
|
var ISLAND_TAG_RE_SOURCE = "<(?:absolute-island|island)\\b([^>]*?)(?:\\/\\>|>(?:[\\s\\S]*?)<\\/(?:absolute-island|island)>)", ATTRIBUTE_RE_SOURCE = `([A-Za-z_:][-A-Za-z0-9_:.]*)\\s*=\\s*(?:"([^"]*)"|'([^']*)')`, islandFrameworks, islandHydrationModes, isRecord4 = (value) => typeof value === "object" && value !== null, isIslandFramework = (value) => islandFrameworks.some((framework) => framework === value), isIslandHydrationMode = (value) => islandHydrationModes.some((mode) => mode === value), parseIslandAttributes = (attributeString) => {
|
|
31103
31175
|
const attributeRe = new RegExp(ATTRIBUTE_RE_SOURCE, "g");
|
|
31104
31176
|
const attributes = new Map;
|
|
@@ -31166,7 +31238,7 @@ var ISLAND_TAG_RE_SOURCE = "<(?:absolute-island|island)\\b([^>]*?)(?:\\/\\>|>(?:
|
|
|
31166
31238
|
transformedHtml += originalHtml.slice(lastIndex);
|
|
31167
31239
|
return transformedHtml;
|
|
31168
31240
|
}, transformStaticPage = async (pagePath, registry) => {
|
|
31169
|
-
const originalHtml =
|
|
31241
|
+
const originalHtml = readFileSync3(pagePath, "utf-8");
|
|
31170
31242
|
const transformedHtml = await transformStaticPageHtml(originalHtml, registry);
|
|
31171
31243
|
if (transformedHtml !== originalHtml) {
|
|
31172
31244
|
writeFileSync4(pagePath, transformedHtml);
|
|
@@ -31291,7 +31363,7 @@ var scanCssEntryPoints = async (dir, ignore) => {
|
|
|
31291
31363
|
var init_scanCssEntryPoints = () => {};
|
|
31292
31364
|
|
|
31293
31365
|
// src/utils/imageProcessing.ts
|
|
31294
|
-
import { existsSync as existsSync8, mkdirSync as mkdirSync4, readFileSync as
|
|
31366
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync5 } from "fs";
|
|
31295
31367
|
import { join as join5, resolve as resolve8 } from "path";
|
|
31296
31368
|
var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATION_ENDPOINT = "/_absolute/image", BLUR_DEVIATION = 20, sharpModule = undefined, sharpLoaded = false, sharpWarned = false, snapToSize = (target, sizes) => {
|
|
31297
31369
|
for (const size of sizes) {
|
|
@@ -31407,8 +31479,8 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATIO
|
|
|
31407
31479
|
if (!existsSync8(metaPath) || !existsSync8(dataPath))
|
|
31408
31480
|
return null;
|
|
31409
31481
|
try {
|
|
31410
|
-
const meta = JSON.parse(
|
|
31411
|
-
const buffer =
|
|
31482
|
+
const meta = JSON.parse(readFileSync4(metaPath, "utf-8"));
|
|
31483
|
+
const buffer = readFileSync4(dataPath);
|
|
31412
31484
|
return { buffer, meta };
|
|
31413
31485
|
} catch {
|
|
31414
31486
|
return null;
|
|
@@ -31523,14 +31595,14 @@ var init_optimizeHtmlImages = __esm(() => {
|
|
|
31523
31595
|
});
|
|
31524
31596
|
|
|
31525
31597
|
// src/cli/scripts/telemetry.ts
|
|
31526
|
-
import { existsSync as existsSync9, mkdirSync as mkdirSync5, readFileSync as
|
|
31598
|
+
import { existsSync as existsSync9, mkdirSync as mkdirSync5, readFileSync as readFileSync5, writeFileSync as writeFileSync6 } from "fs";
|
|
31527
31599
|
import { homedir } from "os";
|
|
31528
31600
|
import { join as join6 } from "path";
|
|
31529
31601
|
var configDir, configPath, getTelemetryConfig = () => {
|
|
31530
31602
|
try {
|
|
31531
31603
|
if (!existsSync9(configPath))
|
|
31532
31604
|
return null;
|
|
31533
|
-
const raw =
|
|
31605
|
+
const raw = readFileSync5(configPath, "utf-8");
|
|
31534
31606
|
const config = JSON.parse(raw);
|
|
31535
31607
|
return config;
|
|
31536
31608
|
} catch {
|
|
@@ -31543,14 +31615,14 @@ var init_telemetry = __esm(() => {
|
|
|
31543
31615
|
});
|
|
31544
31616
|
|
|
31545
31617
|
// src/cli/telemetryEvent.ts
|
|
31546
|
-
import { existsSync as existsSync10, readFileSync as
|
|
31618
|
+
import { existsSync as existsSync10, readFileSync as readFileSync6 } from "fs";
|
|
31547
31619
|
import { arch, platform } from "os";
|
|
31548
31620
|
import { dirname as dirname5, join as join7, parse as parse2 } from "path";
|
|
31549
31621
|
var checkCandidate = (candidate) => {
|
|
31550
31622
|
if (!existsSync10(candidate)) {
|
|
31551
31623
|
return null;
|
|
31552
31624
|
}
|
|
31553
|
-
const pkg = JSON.parse(
|
|
31625
|
+
const pkg = JSON.parse(readFileSync6(candidate, "utf-8"));
|
|
31554
31626
|
if (pkg.name === "@absolutejs/absolute") {
|
|
31555
31627
|
const ver = pkg.version;
|
|
31556
31628
|
return ver;
|
|
@@ -31854,8 +31926,8 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
|
|
|
31854
31926
|
};
|
|
31855
31927
|
|
|
31856
31928
|
// src/build/angularLinkerPlugin.ts
|
|
31857
|
-
import { existsSync as existsSync12, mkdirSync as mkdirSync6, readFileSync as
|
|
31858
|
-
import { dirname as dirname6, join as join8, relative as
|
|
31929
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync6, readFileSync as readFileSync7, writeFileSync as writeFileSync7 } from "fs";
|
|
31930
|
+
import { dirname as dirname6, join as join8, relative as relative5, resolve as resolve11 } from "path";
|
|
31859
31931
|
import { createHash } from "crypto";
|
|
31860
31932
|
var CACHE_DIR, angularLinkerPlugin;
|
|
31861
31933
|
var init_angularLinkerPlugin = __esm(() => {
|
|
@@ -31881,7 +31953,7 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
31881
31953
|
const cachePath = join8(CACHE_DIR, `${hash}.js`);
|
|
31882
31954
|
if (existsSync12(cachePath)) {
|
|
31883
31955
|
return {
|
|
31884
|
-
contents:
|
|
31956
|
+
contents: readFileSync7(cachePath, "utf-8"),
|
|
31885
31957
|
loader: "js"
|
|
31886
31958
|
};
|
|
31887
31959
|
}
|
|
@@ -31897,8 +31969,8 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
31897
31969
|
fileSystem: {
|
|
31898
31970
|
dirname: dirname6,
|
|
31899
31971
|
exists: existsSync12,
|
|
31900
|
-
readFile:
|
|
31901
|
-
relative:
|
|
31972
|
+
readFile: readFileSync7,
|
|
31973
|
+
relative: relative5,
|
|
31902
31974
|
resolve: resolve11
|
|
31903
31975
|
},
|
|
31904
31976
|
linkerJitMode: false,
|
|
@@ -31939,11 +32011,11 @@ var HASHED_FILE_PATTERN, cleanStaleOutputs = async (buildPath, currentOutputPath
|
|
|
31939
32011
|
const currentPaths = new Set(currentOutputPaths.map((path) => resolve12(path)));
|
|
31940
32012
|
const glob = new Glob5("**/*");
|
|
31941
32013
|
const removals = [];
|
|
31942
|
-
for (const
|
|
31943
|
-
const absolute = resolve12(buildPath,
|
|
32014
|
+
for (const relative6 of glob.scanSync({ cwd: buildPath })) {
|
|
32015
|
+
const absolute = resolve12(buildPath, relative6);
|
|
31944
32016
|
if (currentPaths.has(absolute))
|
|
31945
32017
|
continue;
|
|
31946
|
-
if (!HASHED_FILE_PATTERN.test(
|
|
32018
|
+
if (!HASHED_FILE_PATTERN.test(relative6))
|
|
31947
32019
|
continue;
|
|
31948
32020
|
removals.push(rm2(absolute, { force: true }));
|
|
31949
32021
|
}
|
|
@@ -32001,11 +32073,11 @@ var commonAncestor = (paths, fallback) => {
|
|
|
32001
32073
|
var init_commonAncestor = () => {};
|
|
32002
32074
|
|
|
32003
32075
|
// src/utils/validateSafePath.ts
|
|
32004
|
-
import { resolve as resolve13, relative as
|
|
32076
|
+
import { resolve as resolve13, relative as relative6 } from "path";
|
|
32005
32077
|
var validateSafePath = (targetPath, baseDirectory) => {
|
|
32006
32078
|
const absoluteBase = resolve13(baseDirectory);
|
|
32007
32079
|
const absoluteTarget = resolve13(baseDirectory, targetPath);
|
|
32008
|
-
const relativePath = normalizePath(
|
|
32080
|
+
const relativePath = normalizePath(relative6(absoluteBase, absoluteTarget));
|
|
32009
32081
|
if (relativePath.startsWith("../") || relativePath === "..") {
|
|
32010
32082
|
throw new Error(`Unsafe path: ${targetPath}`);
|
|
32011
32083
|
}
|
|
@@ -32015,7 +32087,7 @@ var init_validateSafePath = () => {};
|
|
|
32015
32087
|
|
|
32016
32088
|
// src/build/resolvePackageImport.ts
|
|
32017
32089
|
import { resolve as resolve14, join as join10 } from "path";
|
|
32018
|
-
import { existsSync as existsSync13, readFileSync as
|
|
32090
|
+
import { existsSync as existsSync13, readFileSync as readFileSync8 } from "fs";
|
|
32019
32091
|
var resolveExportPath = (entry, conditions) => {
|
|
32020
32092
|
if (typeof entry === "string")
|
|
32021
32093
|
return entry;
|
|
@@ -32041,7 +32113,7 @@ var resolveExportPath = (entry, conditions) => {
|
|
|
32041
32113
|
if (!existsSync13(packageJsonPath))
|
|
32042
32114
|
return null;
|
|
32043
32115
|
try {
|
|
32044
|
-
const packageJson = JSON.parse(
|
|
32116
|
+
const packageJson = JSON.parse(readFileSync8(packageJsonPath, "utf-8"));
|
|
32045
32117
|
const { exports } = packageJson;
|
|
32046
32118
|
if (!exports)
|
|
32047
32119
|
return null;
|
|
@@ -32145,7 +32217,7 @@ import {
|
|
|
32145
32217
|
basename as basename3,
|
|
32146
32218
|
extname as extname4,
|
|
32147
32219
|
resolve as resolve15,
|
|
32148
|
-
relative as
|
|
32220
|
+
relative as relative7,
|
|
32149
32221
|
sep as sep2
|
|
32150
32222
|
} from "path";
|
|
32151
32223
|
import { env } from "process";
|
|
@@ -32249,8 +32321,8 @@ var resolveDevClientDir2 = () => {
|
|
|
32249
32321
|
const preprocessedClient = isModule ? loweredClientSource.code : (await preprocess(loweredClientSource.code, {})).code;
|
|
32250
32322
|
const transpiledServer = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler2.transformSync(preprocessedServer) : preprocessedServer;
|
|
32251
32323
|
const transpiledClient = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler2.transformSync(preprocessedClient) : preprocessedClient;
|
|
32252
|
-
const rawRel = dirname7(
|
|
32253
|
-
const relDir = rawRel.startsWith("..") ? `_ext/${
|
|
32324
|
+
const rawRel = dirname7(relative7(svelteRoot, src)).replace(/\\/g, "/");
|
|
32325
|
+
const relDir = rawRel.startsWith("..") ? `_ext/${relative7(process.cwd(), dirname7(src)).replace(/\\/g, "/")}` : rawRel;
|
|
32254
32326
|
const baseName = basename3(src).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
32255
32327
|
const importPaths = Array.from(transpiledServer.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((path) => path !== undefined);
|
|
32256
32328
|
const resolvedModuleImports = await Promise.all(importPaths.map((importPath) => resolveRelativeModule2(importPath, src)));
|
|
@@ -32267,15 +32339,15 @@ var resolveDevClientDir2 = () => {
|
|
|
32267
32339
|
const resolved = resolvedImports[idx];
|
|
32268
32340
|
const resolvedModule = resolvedModuleImports[idx];
|
|
32269
32341
|
if (resolved) {
|
|
32270
|
-
const childRel =
|
|
32342
|
+
const childRel = relative7(svelteRoot, resolved).replace(/\\/g, "/");
|
|
32271
32343
|
if (!childRel.startsWith(".."))
|
|
32272
32344
|
continue;
|
|
32273
32345
|
const childBuilt = cache.get(resolved);
|
|
32274
32346
|
if (!childBuilt)
|
|
32275
32347
|
continue;
|
|
32276
32348
|
const origSpec = rawSpec.replace(/\.svelte(?:\.(?:ts|js))?$/, ".js");
|
|
32277
|
-
const toServer2 =
|
|
32278
|
-
const toClient2 =
|
|
32349
|
+
const toServer2 = relative7(ssrOutputDir, childBuilt.ssr).replace(/\\/g, "/");
|
|
32350
|
+
const toClient2 = relative7(clientOutputDir, childBuilt.client).replace(/\\/g, "/");
|
|
32279
32351
|
externalRewrites.set(origSpec, {
|
|
32280
32352
|
client: toClient2.startsWith(".") ? toClient2 : `./${toClient2}`,
|
|
32281
32353
|
server: toServer2.startsWith(".") ? toServer2 : `./${toServer2}`
|
|
@@ -32284,8 +32356,8 @@ var resolveDevClientDir2 = () => {
|
|
|
32284
32356
|
}
|
|
32285
32357
|
if (!resolvedModule)
|
|
32286
32358
|
continue;
|
|
32287
|
-
const toServer =
|
|
32288
|
-
const toClient =
|
|
32359
|
+
const toServer = relative7(ssrOutputDir, resolvedModule).replace(/\\/g, "/");
|
|
32360
|
+
const toClient = relative7(clientOutputDir, resolvedModule).replace(/\\/g, "/");
|
|
32289
32361
|
externalRewrites.set(rawSpec, {
|
|
32290
32362
|
client: toClient.startsWith(".") || toClient.startsWith("/") ? toClient : `./${toClient}`,
|
|
32291
32363
|
server: toServer.startsWith(".") ? toServer : `./${toServer}`
|
|
@@ -32320,7 +32392,7 @@ var resolveDevClientDir2 = () => {
|
|
|
32320
32392
|
}).js.code;
|
|
32321
32393
|
let code = compiled.replace(/\.svelte(?:\.(?:ts|js))?(['"])/g, ".js$1");
|
|
32322
32394
|
if (mode === "client" && isDev) {
|
|
32323
|
-
const moduleKey = `/@src/${
|
|
32395
|
+
const moduleKey = `/@src/${relative7(process.cwd(), src).replace(/\\/g, "/")}`;
|
|
32324
32396
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
32325
32397
|
if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
32326
32398
|
var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleKey)}] = cb; };`);
|
|
@@ -32356,10 +32428,10 @@ var resolveDevClientDir2 = () => {
|
|
|
32356
32428
|
};
|
|
32357
32429
|
const roots = await Promise.all(entryPoints.map(build));
|
|
32358
32430
|
await Promise.all(roots.map(async ({ client }) => {
|
|
32359
|
-
const relClientDir = dirname7(
|
|
32431
|
+
const relClientDir = dirname7(relative7(clientDir, client));
|
|
32360
32432
|
const name = basename3(client, extname4(client));
|
|
32361
32433
|
const indexPath = join11(indexDir, relClientDir, `${name}.js`);
|
|
32362
|
-
const importRaw =
|
|
32434
|
+
const importRaw = relative7(dirname7(indexPath), client).split(sep2).join("/");
|
|
32363
32435
|
const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
|
|
32364
32436
|
const hmrImports = isDev ? `window.__HMR_FRAMEWORK__ = "svelte";
|
|
32365
32437
|
import "${hmrClientPath3}";
|
|
@@ -32416,7 +32488,7 @@ if (typeof window !== "undefined") {
|
|
|
32416
32488
|
return {
|
|
32417
32489
|
svelteClientPaths: roots.map(({ client }) => client),
|
|
32418
32490
|
svelteIndexPaths: roots.map(({ client }) => {
|
|
32419
|
-
const rel = dirname7(
|
|
32491
|
+
const rel = dirname7(relative7(clientDir, client));
|
|
32420
32492
|
return join11(indexDir, rel, basename3(client));
|
|
32421
32493
|
}),
|
|
32422
32494
|
svelteServerPaths: roots.map(({ ssr }) => ssr)
|
|
@@ -32445,7 +32517,7 @@ __export(exports_compileVue, {
|
|
|
32445
32517
|
});
|
|
32446
32518
|
import { existsSync as existsSync15 } from "fs";
|
|
32447
32519
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
32448
|
-
import { basename as basename4, dirname as dirname8, join as join12, relative as
|
|
32520
|
+
import { basename as basename4, dirname as dirname8, join as join12, relative as relative8, resolve as resolve16 } from "path";
|
|
32449
32521
|
var {file: file2, write: write2, Transpiler: Transpiler2 } = globalThis.Bun;
|
|
32450
32522
|
var resolveDevClientDir3 = () => {
|
|
32451
32523
|
const projectRoot = process.cwd();
|
|
@@ -32495,7 +32567,7 @@ var resolveDevClientDir3 = () => {
|
|
|
32495
32567
|
return "template-only";
|
|
32496
32568
|
}
|
|
32497
32569
|
return "full";
|
|
32498
|
-
}, generateVueHmrId = (sourceFilePath, vueRootDir) =>
|
|
32570
|
+
}, generateVueHmrId = (sourceFilePath, vueRootDir) => relative8(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) => {
|
|
32499
32571
|
if (filePath.endsWith(".vue"))
|
|
32500
32572
|
return filePath.replace(/\.vue$/, ".js");
|
|
32501
32573
|
if (filePath.endsWith(".ts"))
|
|
@@ -32522,7 +32594,7 @@ var resolveDevClientDir3 = () => {
|
|
|
32522
32594
|
const cachedResult = cacheMap.get(sourceFilePath);
|
|
32523
32595
|
if (cachedResult)
|
|
32524
32596
|
return cachedResult;
|
|
32525
|
-
const relativeFilePath =
|
|
32597
|
+
const relativeFilePath = relative8(vueRootDir, sourceFilePath).replace(/\\/g, "/");
|
|
32526
32598
|
const relativeWithoutExtension = relativeFilePath.replace(/\.vue$/, "");
|
|
32527
32599
|
const fileBaseName = basename4(sourceFilePath, ".vue");
|
|
32528
32600
|
const componentId = toKebab(fileBaseName);
|
|
@@ -32646,7 +32718,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
32646
32718
|
let result2 = code;
|
|
32647
32719
|
for (const [bareImport, paths] of packageImportRewrites) {
|
|
32648
32720
|
const targetPath = mode === "server" ? paths.server : paths.client;
|
|
32649
|
-
let rel =
|
|
32721
|
+
let rel = relative8(dirname8(outputPath), targetPath).replace(/\\/g, "/");
|
|
32650
32722
|
if (!rel.startsWith("."))
|
|
32651
32723
|
rel = `./${rel}`;
|
|
32652
32724
|
result2 = result2.replaceAll(bareImport, rel);
|
|
@@ -32695,7 +32767,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
32695
32767
|
result.tsHelperPaths.forEach((path) => allTsHelperPaths.add(path));
|
|
32696
32768
|
const entryBaseName = basename4(entryPath, ".vue");
|
|
32697
32769
|
const indexOutputFile = join12(indexOutputDir, `${entryBaseName}.js`);
|
|
32698
|
-
const clientOutputFile = join12(clientOutputDir,
|
|
32770
|
+
const clientOutputFile = join12(clientOutputDir, relative8(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
|
|
32699
32771
|
await mkdir3(dirname8(indexOutputFile), { recursive: true });
|
|
32700
32772
|
const vueHmrImports = isDev ? [
|
|
32701
32773
|
`window.__HMR_FRAMEWORK__ = "vue";`,
|
|
@@ -32703,7 +32775,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
32703
32775
|
] : [];
|
|
32704
32776
|
await write2(indexOutputFile, [
|
|
32705
32777
|
...vueHmrImports,
|
|
32706
|
-
`import Comp from "${
|
|
32778
|
+
`import Comp from "${relative8(dirname8(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
|
|
32707
32779
|
'import { createSSRApp, createApp } from "vue";',
|
|
32708
32780
|
"",
|
|
32709
32781
|
"// HMR State Preservation: Check for preserved state from HMR",
|
|
@@ -32804,7 +32876,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
32804
32876
|
await Promise.all(Array.from(allTsHelperPaths).map(async (tsPath) => {
|
|
32805
32877
|
const sourceCode = await file2(tsPath).text();
|
|
32806
32878
|
const transpiledCode = transpiler3.transformSync(sourceCode);
|
|
32807
|
-
const relativeJsPath =
|
|
32879
|
+
const relativeJsPath = relative8(vueRootDir, tsPath).replace(/\.ts$/, ".js");
|
|
32808
32880
|
const outClientPath = join12(clientOutputDir, relativeJsPath);
|
|
32809
32881
|
const outServerPath = join12(serverOutputDir, relativeJsPath);
|
|
32810
32882
|
await mkdir3(dirname8(outClientPath), { recursive: true });
|
|
@@ -41697,11 +41769,11 @@ ${lanes.join(`
|
|
|
41697
41769
|
return toComponents;
|
|
41698
41770
|
}
|
|
41699
41771
|
const components = toComponents.slice(start);
|
|
41700
|
-
const
|
|
41772
|
+
const relative9 = [];
|
|
41701
41773
|
for (;start < fromComponents.length; start++) {
|
|
41702
|
-
|
|
41774
|
+
relative9.push("..");
|
|
41703
41775
|
}
|
|
41704
|
-
return ["", ...
|
|
41776
|
+
return ["", ...relative9, ...components];
|
|
41705
41777
|
}
|
|
41706
41778
|
function getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileNameOrIgnoreCase) {
|
|
41707
41779
|
Debug.assert(getRootLength(fromDirectory) > 0 === getRootLength(to) > 0, "Paths must either both be absolute or both be relative");
|
|
@@ -78997,9 +79069,9 @@ ${lanes.join(`
|
|
|
78997
79069
|
if (!startsWithDirectory(target, realPathDirectory, getCanonicalFileName)) {
|
|
78998
79070
|
return;
|
|
78999
79071
|
}
|
|
79000
|
-
const
|
|
79072
|
+
const relative9 = getRelativePathFromDirectory(realPathDirectory, target, getCanonicalFileName);
|
|
79001
79073
|
for (const symlinkDirectory of symlinkDirectories) {
|
|
79002
|
-
const option = resolvePath(symlinkDirectory,
|
|
79074
|
+
const option = resolvePath(symlinkDirectory, relative9);
|
|
79003
79075
|
const result2 = cb(option, target === referenceRedirect);
|
|
79004
79076
|
shouldFilterIgnoredPaths = true;
|
|
79005
79077
|
if (result2)
|
|
@@ -201564,12 +201636,12 @@ __export(exports_compileAngular, {
|
|
|
201564
201636
|
compileAngularFile: () => compileAngularFile,
|
|
201565
201637
|
compileAngular: () => compileAngular
|
|
201566
201638
|
});
|
|
201567
|
-
import { existsSync as existsSync16, readFileSync as
|
|
201568
|
-
import { join as join13, basename as basename5, sep as sep3, dirname as dirname9, resolve as resolve17, relative as
|
|
201639
|
+
import { existsSync as existsSync16, readFileSync as readFileSync9, promises as fs } from "fs";
|
|
201640
|
+
import { join as join13, basename as basename5, sep as sep3, dirname as dirname9, resolve as resolve17, relative as relative9 } from "path";
|
|
201569
201641
|
import { createHash as createHash2 } from "crypto";
|
|
201570
201642
|
var import_typescript, computeConfigHash = () => {
|
|
201571
201643
|
try {
|
|
201572
|
-
const content =
|
|
201644
|
+
const content = readFileSync9("./tsconfig.json", "utf-8");
|
|
201573
201645
|
return createHash2("md5").update(content).digest("hex");
|
|
201574
201646
|
} catch {
|
|
201575
201647
|
return "";
|
|
@@ -201627,7 +201699,7 @@ ${registrations}
|
|
|
201627
201699
|
return fileName.substring(outDir.length + 1);
|
|
201628
201700
|
return fileName;
|
|
201629
201701
|
}, compileAngularFile = async (inputPath, outDir) => {
|
|
201630
|
-
const islandMetadataExports = buildIslandMetadataExports(
|
|
201702
|
+
const islandMetadataExports = buildIslandMetadataExports(readFileSync9(inputPath, "utf-8"));
|
|
201631
201703
|
const {
|
|
201632
201704
|
readConfiguration,
|
|
201633
201705
|
performCompilation,
|
|
@@ -201897,7 +201969,7 @@ export default ${componentClassName};
|
|
|
201897
201969
|
await fs.writeFile(ssrDepsFile, ssrDepsContent, "utf-8");
|
|
201898
201970
|
}
|
|
201899
201971
|
await fs.writeFile(rawServerFile, rewritten, "utf-8");
|
|
201900
|
-
const relativePath =
|
|
201972
|
+
const relativePath = relative9(indexesDir, rawServerFile).replace(/\\/g, "/");
|
|
201901
201973
|
const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
201902
201974
|
const hmrPreamble = hmr ? `window.__HMR_FRAMEWORK__ = "angular";
|
|
201903
201975
|
import "${hmrRuntimePath}";
|
|
@@ -202178,11 +202250,11 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
|
|
|
202178
202250
|
console.warn("\u26A0\uFE0F Vue vendor build had errors:", result.logs);
|
|
202179
202251
|
return;
|
|
202180
202252
|
}
|
|
202181
|
-
const { readFileSync:
|
|
202253
|
+
const { readFileSync: readFileSync10, writeFileSync: writeFileSync8, readdirSync } = await import("fs");
|
|
202182
202254
|
const files = readdirSync(vendorDir).filter((f) => f.endsWith(".js"));
|
|
202183
202255
|
for (const file3 of files) {
|
|
202184
202256
|
const filePath = join16(vendorDir, file3);
|
|
202185
|
-
const content =
|
|
202257
|
+
const content = readFileSync10(filePath, "utf-8");
|
|
202186
202258
|
if (!content.includes("__VUE_HMR_RUNTIME__"))
|
|
202187
202259
|
continue;
|
|
202188
202260
|
const patched = content.replace(/getGlobalThis\(\)\.__VUE_HMR_RUNTIME__\s*=\s*\{/, "getGlobalThis().__VUE_HMR_RUNTIME__ = getGlobalThis().__VUE_HMR_RUNTIME__ || {");
|
|
@@ -202306,12 +202378,12 @@ import {
|
|
|
202306
202378
|
cpSync,
|
|
202307
202379
|
existsSync as existsSync17,
|
|
202308
202380
|
mkdirSync as mkdirSync11,
|
|
202309
|
-
readFileSync as
|
|
202381
|
+
readFileSync as readFileSync10,
|
|
202310
202382
|
rmSync as rmSync3,
|
|
202311
202383
|
statSync,
|
|
202312
202384
|
writeFileSync as writeFileSync8
|
|
202313
202385
|
} from "fs";
|
|
202314
|
-
import { basename as basename6, dirname as dirname10, join as join18, relative as
|
|
202386
|
+
import { basename as basename6, dirname as dirname10, join as join18, relative as relative10, resolve as resolve18 } from "path";
|
|
202315
202387
|
import { cwd, env as env2, exit } from "process";
|
|
202316
202388
|
var {build: bunBuild6, Glob: Glob6 } = globalThis.Bun;
|
|
202317
202389
|
var isDev, collectConventionSourceFiles = (entry) => {
|
|
@@ -202427,7 +202499,7 @@ var isDev, collectConventionSourceFiles = (entry) => {
|
|
|
202427
202499
|
addWorkerPathIfExists(file3, relPath, workerPaths);
|
|
202428
202500
|
}
|
|
202429
202501
|
}, collectWorkerPathsFromFile = (file3, patterns, workerPaths) => {
|
|
202430
|
-
const content =
|
|
202502
|
+
const content = readFileSync10(file3, "utf-8");
|
|
202431
202503
|
for (const pattern of patterns) {
|
|
202432
202504
|
collectWorkerPathsFromContent(content, pattern, file3, workerPaths);
|
|
202433
202505
|
}
|
|
@@ -202473,9 +202545,9 @@ var isDev, collectConventionSourceFiles = (entry) => {
|
|
|
202473
202545
|
}
|
|
202474
202546
|
}, copyReactDevIndexes = (reactIndexesPath, reactPagesPath, devIndexDir, readDir) => {
|
|
202475
202547
|
const indexFiles = readDir(reactIndexesPath).filter((file3) => file3.endsWith(".tsx"));
|
|
202476
|
-
const pagesRel =
|
|
202548
|
+
const pagesRel = relative10(process.cwd(), resolve18(reactPagesPath)).replace(/\\/g, "/");
|
|
202477
202549
|
for (const file3 of indexFiles) {
|
|
202478
|
-
let content =
|
|
202550
|
+
let content = readFileSync10(join18(reactIndexesPath, file3), "utf-8");
|
|
202479
202551
|
content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
|
|
202480
202552
|
writeFileSync8(join18(devIndexDir, file3), content);
|
|
202481
202553
|
}
|
|
@@ -202487,8 +202559,8 @@ var isDev, collectConventionSourceFiles = (entry) => {
|
|
|
202487
202559
|
const indexFile = join18(svelteIndexDir, "pages", `${name}.js`);
|
|
202488
202560
|
if (!existsSync17(indexFile))
|
|
202489
202561
|
continue;
|
|
202490
|
-
let content =
|
|
202491
|
-
const srcRel =
|
|
202562
|
+
let content = readFileSync10(indexFile, "utf-8");
|
|
202563
|
+
const srcRel = relative10(process.cwd(), resolve18(entry)).replace(/\\/g, "/");
|
|
202492
202564
|
content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
|
|
202493
202565
|
writeFileSync8(join18(devIndexDir, `${name}.svelte.js`), content);
|
|
202494
202566
|
}
|
|
@@ -202500,8 +202572,8 @@ var isDev, collectConventionSourceFiles = (entry) => {
|
|
|
202500
202572
|
const indexFile = join18(vueIndexDir, `${name}.js`);
|
|
202501
202573
|
if (!existsSync17(indexFile))
|
|
202502
202574
|
continue;
|
|
202503
|
-
let content =
|
|
202504
|
-
const srcRel =
|
|
202575
|
+
let content = readFileSync10(indexFile, "utf-8");
|
|
202576
|
+
const srcRel = relative10(process.cwd(), resolve18(entry)).replace(/\\/g, "/");
|
|
202505
202577
|
content = content.replace(/import\s+Comp\s+from\s+['"]([^'"]+)['"]/, `import Comp from "/@src/${srcRel}"`);
|
|
202506
202578
|
writeFileSync8(join18(devIndexDir, `${name}.vue.js`), content);
|
|
202507
202579
|
}
|
|
@@ -202551,7 +202623,7 @@ var isDev, collectConventionSourceFiles = (entry) => {
|
|
|
202551
202623
|
}
|
|
202552
202624
|
return result;
|
|
202553
202625
|
}, VUE_HMR_RUNTIME, injectVueComposableTracking = (outputPath, projectRoot) => {
|
|
202554
|
-
let content =
|
|
202626
|
+
let content = readFileSync10(outputPath, "utf-8");
|
|
202555
202627
|
const usePattern = /^var\s+(use[A-Z]\w*)\s*=/gm;
|
|
202556
202628
|
const useNames = [];
|
|
202557
202629
|
let match;
|
|
@@ -202576,7 +202648,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
202576
202648
|
}, buildDevUrlFileMap = (urlReferencedFiles, projectRoot) => {
|
|
202577
202649
|
const urlFileMap = new Map;
|
|
202578
202650
|
for (const srcPath of urlReferencedFiles) {
|
|
202579
|
-
const rel =
|
|
202651
|
+
const rel = relative10(projectRoot, srcPath).replace(/\\/g, "/");
|
|
202580
202652
|
const name = basename6(srcPath);
|
|
202581
202653
|
const mtime = Math.round(statSync(srcPath).mtimeMs);
|
|
202582
202654
|
const url = `/@src/${rel}?v=${mtime}`;
|
|
@@ -202591,7 +202663,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
202591
202663
|
const output = nonReactClientOutputs.find((artifact) => basename6(artifact.path).startsWith(`${srcBase}.`));
|
|
202592
202664
|
if (!output)
|
|
202593
202665
|
continue;
|
|
202594
|
-
urlFileMap.set(basename6(srcPath), `/${
|
|
202666
|
+
urlFileMap.set(basename6(srcPath), `/${relative10(buildPath, output.path).replace(/\\/g, "/")}`);
|
|
202595
202667
|
}
|
|
202596
202668
|
return urlFileMap;
|
|
202597
202669
|
}, buildUrlFileMap = (urlReferencedFiles, hmr, projectRoot, buildPath, nonReactClientOutputs) => {
|
|
@@ -202601,7 +202673,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
202601
202673
|
}, rewriteUrlReferences = (outputPaths, urlFileMap) => {
|
|
202602
202674
|
const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
|
|
202603
202675
|
for (const outputPath of outputPaths) {
|
|
202604
|
-
let content =
|
|
202676
|
+
let content = readFileSync10(outputPath, "utf-8");
|
|
202605
202677
|
let changed = false;
|
|
202606
202678
|
content = content.replace(urlPattern, (_match, relPath) => {
|
|
202607
202679
|
const targetName = basename6(relPath);
|
|
@@ -203258,7 +203330,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
203258
203330
|
const injectHMRIntoHTMLFile = (filePath, framework) => {
|
|
203259
203331
|
if (!hmrClientBundle)
|
|
203260
203332
|
return;
|
|
203261
|
-
let html =
|
|
203333
|
+
let html = readFileSync10(filePath, "utf-8");
|
|
203262
203334
|
if (html.includes("data-hmr-client"))
|
|
203263
203335
|
return;
|
|
203264
203336
|
const tag = `<script>window.__HMR_FRAMEWORK__="${framework}";</script><script data-hmr-client>${hmrClientBundle}</script>`;
|
|
@@ -203420,7 +203492,7 @@ var init_build = __esm(() => {
|
|
|
203420
203492
|
});
|
|
203421
203493
|
|
|
203422
203494
|
// src/dev/dependencyGraph.ts
|
|
203423
|
-
import { existsSync as existsSync18, readFileSync as
|
|
203495
|
+
import { existsSync as existsSync18, readFileSync as readFileSync11 } from "fs";
|
|
203424
203496
|
var {Glob: Glob7 } = globalThis.Bun;
|
|
203425
203497
|
import { resolve as resolve19 } from "path";
|
|
203426
203498
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
@@ -203581,15 +203653,15 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
203581
203653
|
const lowerPath = filePath.toLowerCase();
|
|
203582
203654
|
const isSvelteOrVue = lowerPath.endsWith(".svelte") || lowerPath.endsWith(".vue");
|
|
203583
203655
|
if (loader === "html") {
|
|
203584
|
-
const content =
|
|
203656
|
+
const content = readFileSync11(filePath, "utf-8");
|
|
203585
203657
|
return extractHtmlDependencies(filePath, content);
|
|
203586
203658
|
}
|
|
203587
203659
|
if (loader === "tsx" || loader === "js") {
|
|
203588
|
-
const content =
|
|
203660
|
+
const content = readFileSync11(filePath, "utf-8");
|
|
203589
203661
|
return extractJsDependencies(filePath, content, loader);
|
|
203590
203662
|
}
|
|
203591
203663
|
if (isSvelteOrVue) {
|
|
203592
|
-
const content =
|
|
203664
|
+
const content = readFileSync11(filePath, "utf-8");
|
|
203593
203665
|
return extractSvelteVueDependencies(filePath, content);
|
|
203594
203666
|
}
|
|
203595
203667
|
return [];
|
|
@@ -204055,7 +204127,7 @@ var init_assetStore = __esm(() => {
|
|
|
204055
204127
|
});
|
|
204056
204128
|
|
|
204057
204129
|
// src/islands/pageMetadata.ts
|
|
204058
|
-
import { readFileSync as
|
|
204130
|
+
import { readFileSync as readFileSync12 } from "fs";
|
|
204059
204131
|
import { dirname as dirname11, resolve as resolve23 } from "path";
|
|
204060
204132
|
var pagePatterns, getPageDirs = (config) => [
|
|
204061
204133
|
{ dir: config.angularDirectory, framework: "angular" },
|
|
@@ -204088,7 +204160,7 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
204088
204160
|
continue;
|
|
204089
204161
|
const files = await scanEntryPoints(resolve23(entry.dir), pattern);
|
|
204090
204162
|
for (const filePath of files) {
|
|
204091
|
-
const source =
|
|
204163
|
+
const source = readFileSync12(filePath, "utf-8");
|
|
204092
204164
|
const islands = extractIslandUsagesFromSource(source);
|
|
204093
204165
|
pageMetadata.set(resolve23(filePath), {
|
|
204094
204166
|
islands: islands.map((usage) => {
|
|
@@ -204134,10 +204206,10 @@ var init_pageMetadata = __esm(() => {
|
|
|
204134
204206
|
});
|
|
204135
204207
|
|
|
204136
204208
|
// src/dev/fileHashTracker.ts
|
|
204137
|
-
import { readFileSync as
|
|
204209
|
+
import { readFileSync as readFileSync13 } from "fs";
|
|
204138
204210
|
var computeFileHash = (filePath) => {
|
|
204139
204211
|
try {
|
|
204140
|
-
const fileContent =
|
|
204212
|
+
const fileContent = readFileSync13(filePath);
|
|
204141
204213
|
return Number(Bun.hash(fileContent));
|
|
204142
204214
|
} catch {
|
|
204143
204215
|
return UNFOUND_INDEX;
|
|
@@ -205290,8 +205362,8 @@ __export(exports_moduleServer, {
|
|
|
205290
205362
|
createModuleServer: () => createModuleServer,
|
|
205291
205363
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
205292
205364
|
});
|
|
205293
|
-
import { existsSync as existsSync20, readFileSync as
|
|
205294
|
-
import { basename as basename10, dirname as dirname13, extname as extname5, resolve as resolve26, relative as
|
|
205365
|
+
import { existsSync as existsSync20, readFileSync as readFileSync14, statSync as statSync2 } from "fs";
|
|
205366
|
+
import { basename as basename10, dirname as dirname13, extname as extname5, resolve as resolve26, relative as relative11 } from "path";
|
|
205295
205367
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
205296
205368
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
205297
205369
|
const allExports = [];
|
|
@@ -205339,23 +205411,23 @@ ${stubs}
|
|
|
205339
205411
|
}
|
|
205340
205412
|
}, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
|
|
205341
205413
|
const absPath = resolve26(fileDir, relPath);
|
|
205342
|
-
const rel =
|
|
205414
|
+
const rel = relative11(projectRoot, absPath);
|
|
205343
205415
|
const extension = extname5(rel);
|
|
205344
205416
|
let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
|
|
205345
205417
|
if (extname5(srcPath) === ".svelte") {
|
|
205346
|
-
srcPath =
|
|
205418
|
+
srcPath = relative11(projectRoot, resolveSvelteModulePath(resolve26(projectRoot, srcPath)));
|
|
205347
205419
|
}
|
|
205348
205420
|
return srcUrl(srcPath, projectRoot);
|
|
205349
205421
|
}, resolveAbsoluteSpecifier = (specifier, projectRoot, importer, frameworkDirs) => {
|
|
205350
205422
|
if (importer && frameworkDirs) {
|
|
205351
205423
|
const compatModule = resolveIslandCompatModule(specifier, importer, frameworkDirs);
|
|
205352
205424
|
if (compatModule) {
|
|
205353
|
-
return
|
|
205425
|
+
return relative11(projectRoot, compatModule);
|
|
205354
205426
|
}
|
|
205355
205427
|
}
|
|
205356
205428
|
try {
|
|
205357
205429
|
const target = resolvePackageImport(specifier, ["browser", "import"]) ?? Bun.resolveSync(specifier, projectRoot);
|
|
205358
|
-
return
|
|
205430
|
+
return relative11(projectRoot, target);
|
|
205359
205431
|
} catch {
|
|
205360
205432
|
return;
|
|
205361
205433
|
}
|
|
@@ -205388,10 +205460,10 @@ ${stubs}
|
|
|
205388
205460
|
result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}`);
|
|
205389
205461
|
result = result.replace(/((?:from|import)\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["'])/g, (_match, prefix, absPath, _ext, suffix) => {
|
|
205390
205462
|
if (absPath.startsWith(projectRoot)) {
|
|
205391
|
-
const rel2 =
|
|
205463
|
+
const rel2 = relative11(projectRoot, absPath).replace(/\\/g, "/");
|
|
205392
205464
|
return `${prefix}${srcUrl(rel2, projectRoot)}${suffix}`;
|
|
205393
205465
|
}
|
|
205394
|
-
const rel =
|
|
205466
|
+
const rel = relative11(projectRoot, absPath).replace(/\\/g, "/");
|
|
205395
205467
|
if (!rel.startsWith("..")) {
|
|
205396
205468
|
return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
|
|
205397
205469
|
}
|
|
@@ -205399,12 +205471,12 @@ ${stubs}
|
|
|
205399
205471
|
});
|
|
205400
205472
|
result = result.replace(/new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g, (_match, relPath) => {
|
|
205401
205473
|
const absPath = resolve26(fileDir, relPath);
|
|
205402
|
-
const rel =
|
|
205474
|
+
const rel = relative11(projectRoot, absPath);
|
|
205403
205475
|
return `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;
|
|
205404
205476
|
});
|
|
205405
205477
|
result = result.replace(/import\.meta\.resolve\(\s*["'](\.\.?\/[^"']+)["']\s*\)/g, (_match, relPath) => {
|
|
205406
205478
|
const absPath = resolve26(fileDir, relPath);
|
|
205407
|
-
const rel =
|
|
205479
|
+
const rel = relative11(projectRoot, absPath);
|
|
205408
205480
|
return `'${srcUrl(rel, projectRoot)}'`;
|
|
205409
205481
|
});
|
|
205410
205482
|
return result;
|
|
@@ -205432,7 +205504,7 @@ ${stubs}
|
|
|
205432
205504
|
`)}
|
|
205433
205505
|
${code}`;
|
|
205434
205506
|
}, reactTranspilerOptions, reactTranspiler, transformReactFile = (filePath, projectRoot, rewriter, frameworkDirs) => {
|
|
205435
|
-
const raw =
|
|
205507
|
+
const raw = readFileSync14(filePath, "utf-8");
|
|
205436
205508
|
const valueExports = tsxTranspiler.scan(raw).exports;
|
|
205437
205509
|
let transpiled = reactTranspiler.transformSync(raw);
|
|
205438
205510
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
@@ -205443,12 +205515,12 @@ ${code}`;
|
|
|
205443
205515
|
transpiled = `var $RefreshReg$ = window.$RefreshReg$ || function(){};
|
|
205444
205516
|
` + `var $RefreshSig$ = window.$RefreshSig$ || function(){ return function(t){ return t; }; };
|
|
205445
205517
|
${transpiled}`;
|
|
205446
|
-
const relPath =
|
|
205518
|
+
const relPath = relative11(projectRoot, filePath).replace(/\\/g, "/");
|
|
205447
205519
|
transpiled = transpiled.replace(/\binput\.tsx:/g, `${relPath}:`);
|
|
205448
205520
|
transpiled += buildIslandMetadataExports(raw);
|
|
205449
205521
|
return rewriteImports2(transpiled, filePath, projectRoot, rewriter, frameworkDirs);
|
|
205450
205522
|
}, transformPlainFile = (filePath, projectRoot, rewriter, vueDir, frameworkDirs) => {
|
|
205451
|
-
const raw =
|
|
205523
|
+
const raw = readFileSync14(filePath, "utf-8");
|
|
205452
205524
|
const ext = extname5(filePath);
|
|
205453
205525
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
205454
205526
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
@@ -205594,17 +205666,17 @@ ${code}`;
|
|
|
205594
205666
|
if (compiled.css?.code) {
|
|
205595
205667
|
const cssPath = `${filePath}.css`;
|
|
205596
205668
|
svelteExternalCss.set(cssPath, compiled.css.code);
|
|
205597
|
-
const cssUrl = srcUrl(
|
|
205669
|
+
const cssUrl = srcUrl(relative11(projectRoot, cssPath), projectRoot);
|
|
205598
205670
|
code = `import "${cssUrl}";
|
|
205599
205671
|
${code}`;
|
|
205600
205672
|
}
|
|
205601
|
-
const moduleUrl = `${SRC_PREFIX}${
|
|
205673
|
+
const moduleUrl = `${SRC_PREFIX}${relative11(projectRoot, filePath).replace(/\\/g, "/")}`;
|
|
205602
205674
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
205603
205675
|
` + ` if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
205604
205676
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
205605
205677
|
return code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
|
|
205606
205678
|
}, transformSvelteFile = async (filePath, projectRoot, rewriter, frameworkDirs) => {
|
|
205607
|
-
const raw =
|
|
205679
|
+
const raw = readFileSync14(filePath, "utf-8");
|
|
205608
205680
|
if (!svelteCompiler) {
|
|
205609
205681
|
svelteCompiler = await import("svelte/compiler");
|
|
205610
205682
|
}
|
|
@@ -205660,7 +205732,7 @@ export default __script__;`;
|
|
|
205660
205732
|
return `${cssInjection}
|
|
205661
205733
|
${code}`;
|
|
205662
205734
|
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir, frameworkDirs) => {
|
|
205663
|
-
const raw =
|
|
205735
|
+
const raw = readFileSync14(filePath, "utf-8");
|
|
205664
205736
|
if (!vueCompiler) {
|
|
205665
205737
|
vueCompiler = await import("@vue/compiler-sfc");
|
|
205666
205738
|
}
|
|
@@ -205678,7 +205750,7 @@ ${code}`;
|
|
|
205678
205750
|
return rewriteImports2(code, filePath, projectRoot, rewriter, frameworkDirs);
|
|
205679
205751
|
}, injectVueHmr = (code, filePath, projectRoot, vueDir) => {
|
|
205680
205752
|
const hmrBase = vueDir ? resolve26(vueDir) : projectRoot;
|
|
205681
|
-
const hmrId =
|
|
205753
|
+
const hmrId = relative11(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
|
|
205682
205754
|
let result = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
|
|
205683
205755
|
result += [
|
|
205684
205756
|
"",
|
|
@@ -205709,7 +205781,7 @@ ${code}`;
|
|
|
205709
205781
|
}
|
|
205710
205782
|
});
|
|
205711
205783
|
}, handleCssRequest = (filePath) => {
|
|
205712
|
-
const raw =
|
|
205784
|
+
const raw = readFileSync14(filePath, "utf-8");
|
|
205713
205785
|
const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
205714
205786
|
return [
|
|
205715
205787
|
`const style = document.createElement('style');`,
|
|
@@ -206047,7 +206119,7 @@ var init_simpleHTMXHMR = () => {};
|
|
|
206047
206119
|
// src/dev/rebuildTrigger.ts
|
|
206048
206120
|
import { existsSync as existsSync21 } from "fs";
|
|
206049
206121
|
import { rm as rm8 } from "fs/promises";
|
|
206050
|
-
import { basename as basename11, dirname as dirname14, relative as
|
|
206122
|
+
import { basename as basename11, dirname as dirname14, relative as relative12, resolve as resolve29 } from "path";
|
|
206051
206123
|
var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseErrorLocationFromMessage = (msg) => {
|
|
206052
206124
|
const pathLineCol = msg.match(/^([^\s:]+):(\d+)(?::(\d+))?/);
|
|
206053
206125
|
if (pathLineCol) {
|
|
@@ -206242,7 +206314,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
206242
206314
|
if (framework === "unknown") {
|
|
206243
206315
|
const { invalidate: invalidate2 } = (init_transformCache(), __toCommonJS(exports_transformCache));
|
|
206244
206316
|
invalidate2(resolve29(filePath));
|
|
206245
|
-
const relPath =
|
|
206317
|
+
const relPath = relative12(process.cwd(), filePath);
|
|
206246
206318
|
logHmrUpdate(relPath);
|
|
206247
206319
|
return;
|
|
206248
206320
|
}
|
|
@@ -206515,7 +206587,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
206515
206587
|
}, getModuleUrl = async (pageFile) => {
|
|
206516
206588
|
const { invalidateModule: invalidateModule2, warmCache: warmCache2, SRC_URL_PREFIX: SRC_URL_PREFIX2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
206517
206589
|
invalidateModule2(pageFile);
|
|
206518
|
-
const rel =
|
|
206590
|
+
const rel = relative12(process.cwd(), pageFile).replace(/\\/g, "/");
|
|
206519
206591
|
const url = `${SRC_URL_PREFIX2}${rel}`;
|
|
206520
206592
|
warmCache2(url);
|
|
206521
206593
|
return url;
|
|
@@ -206547,7 +206619,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
206547
206619
|
const pageModuleUrl = await getReactModuleUrl(broadcastTarget);
|
|
206548
206620
|
if (pageModuleUrl) {
|
|
206549
206621
|
const serverDuration = Date.now() - startTime;
|
|
206550
|
-
state.lastHmrPath =
|
|
206622
|
+
state.lastHmrPath = relative12(process.cwd(), primaryFile).replace(/\\/g, "/");
|
|
206551
206623
|
state.lastHmrFramework = "react";
|
|
206552
206624
|
broadcastToClients(state, {
|
|
206553
206625
|
data: {
|
|
@@ -206999,7 +207071,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
206999
207071
|
const baseName = fileName.replace(/\.vue$/, "");
|
|
207000
207072
|
const pascalName = toPascal(baseName);
|
|
207001
207073
|
const vueRoot = config.vueDirectory;
|
|
207002
|
-
const hmrId = vueRoot ?
|
|
207074
|
+
const hmrId = vueRoot ? relative12(vueRoot, vuePagePath).replace(/\\/g, "/").replace(/\.vue$/, "") : baseName;
|
|
207003
207075
|
const cssKey = `${pascalName}CSS`;
|
|
207004
207076
|
const cssUrl = manifest[cssKey] || null;
|
|
207005
207077
|
const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
|
|
@@ -207625,7 +207697,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
207625
207697
|
return Array.from(specifiers).filter(isResolvable3);
|
|
207626
207698
|
}, generateEntrySource2 = (specifier) => `export * from '${specifier}';
|
|
207627
207699
|
`, rewriteVendorFiles = async (vendorDir) => {
|
|
207628
|
-
const { readdirSync: readdirSync2, readFileSync:
|
|
207700
|
+
const { readdirSync: readdirSync2, readFileSync: readFileSync15, writeFileSync: writeFileSync9 } = await import("fs");
|
|
207629
207701
|
const { computeVendorPaths: computeVendorPaths2 } = await Promise.resolve().then(() => (init_buildReactVendor(), exports_buildReactVendor));
|
|
207630
207702
|
const reactPaths = Object.entries(computeVendorPaths2());
|
|
207631
207703
|
const rewriteContent = (content) => reactPaths.reduce((acc, [specifier, webPath]) => {
|
|
@@ -207636,7 +207708,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
207636
207708
|
const files = readdirSync2(vendorDir).filter((f) => f.endsWith(".js"));
|
|
207637
207709
|
for (const file3 of files) {
|
|
207638
207710
|
const filePath = join20(vendorDir, file3);
|
|
207639
|
-
const original =
|
|
207711
|
+
const original = readFileSync15(filePath, "utf-8");
|
|
207640
207712
|
const rewritten = rewriteContent(original);
|
|
207641
207713
|
if (rewritten !== original)
|
|
207642
207714
|
writeFileSync9(filePath, rewritten);
|
|
@@ -208003,5 +208075,5 @@ export {
|
|
|
208003
208075
|
build
|
|
208004
208076
|
};
|
|
208005
208077
|
|
|
208006
|
-
//# debugId=
|
|
208078
|
+
//# debugId=818655A4466EF21D64756E2164756E21
|
|
208007
208079
|
//# sourceMappingURL=build.js.map
|