@absolutejs/absolute 0.19.0-beta.134 → 0.19.0-beta.136
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/.absolutejs/tsconfig.tsbuildinfo +1 -1
- package/dist/build.js +36 -82
- package/dist/build.js.map +3 -3
- package/dist/index.js +36 -82
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/build.js
CHANGED
|
@@ -171179,7 +171179,7 @@ import {
|
|
|
171179
171179
|
statSync,
|
|
171180
171180
|
writeFileSync as writeFileSync3
|
|
171181
171181
|
} from "fs";
|
|
171182
|
-
import { basename as basename5,
|
|
171182
|
+
import { basename as basename5, join as join13, relative as relative7, resolve as resolve10 } from "path";
|
|
171183
171183
|
import { cwd, env as env2, exit } from "process";
|
|
171184
171184
|
var {build: bunBuild6, Glob: Glob5 } = globalThis.Bun;
|
|
171185
171185
|
var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental, throwOnError) => {
|
|
@@ -171459,13 +171459,23 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
|
|
|
171459
171459
|
...angularServerPaths
|
|
171460
171460
|
];
|
|
171461
171461
|
const reactClientEntryPoints = [...reactEntries];
|
|
171462
|
+
const allFrameworkDirs = [
|
|
171463
|
+
reactDir,
|
|
171464
|
+
svelteDir,
|
|
171465
|
+
vueDir,
|
|
171466
|
+
angularDir,
|
|
171467
|
+
htmlDir,
|
|
171468
|
+
htmxDir
|
|
171469
|
+
].filter((d) => Boolean(d));
|
|
171470
|
+
const urlReferencedFiles = await scanWorkerReferences(allFrameworkDirs);
|
|
171462
171471
|
const nonReactClientEntryPoints = [
|
|
171463
171472
|
...svelteIndexPaths,
|
|
171464
171473
|
...svelteClientPaths,
|
|
171465
171474
|
...htmlEntries,
|
|
171466
171475
|
...vueIndexPaths,
|
|
171467
171476
|
...vueClientPaths,
|
|
171468
|
-
...angularClientPaths
|
|
171477
|
+
...angularClientPaths,
|
|
171478
|
+
...urlReferencedFiles
|
|
171469
171479
|
];
|
|
171470
171480
|
if (serverEntryPoints.length === 0 && reactClientEntryPoints.length === 0 && nonReactClientEntryPoints.length === 0 && htmxDir === undefined && htmlDir === undefined) {
|
|
171471
171481
|
logWarn("No entry points found, manifest will be empty");
|
|
@@ -171640,15 +171650,6 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
|
|
|
171640
171650
|
if (hmr && reactClientOutputPaths.length > 0) {
|
|
171641
171651
|
await patchRefreshGlobals(reactClientOutputPaths);
|
|
171642
171652
|
}
|
|
171643
|
-
const frameworkDirs = [
|
|
171644
|
-
reactDir,
|
|
171645
|
-
svelteDir,
|
|
171646
|
-
vueDir,
|
|
171647
|
-
angularDir,
|
|
171648
|
-
htmlDir,
|
|
171649
|
-
htmxDir
|
|
171650
|
-
].filter((d) => Boolean(d));
|
|
171651
|
-
const workerEntryPoints = await scanWorkerReferences(frameworkDirs);
|
|
171652
171653
|
const nonReactClientLogs = nonReactClientResult?.logs ?? [];
|
|
171653
171654
|
const nonReactClientOutputs = nonReactClientResult?.outputs ?? [];
|
|
171654
171655
|
if (nonReactClientResult && !nonReactClientResult.success && nonReactClientLogs.length > 0) {
|
|
@@ -171679,32 +171680,39 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
|
|
|
171679
171680
|
if (vueCssResult && !vueCssResult.success && vueCssResult.logs.length > 0) {
|
|
171680
171681
|
extractBuildError(vueCssResult.logs, "vue-css", "Vue CSS", frameworkNames, isIncremental, throwOnError);
|
|
171681
171682
|
}
|
|
171682
|
-
if (
|
|
171683
|
+
if (urlReferencedFiles.length > 0) {
|
|
171683
171684
|
const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
|
|
171684
171685
|
const allClientOutputPaths = [
|
|
171685
171686
|
...reactClientOutputPaths,
|
|
171686
171687
|
...nonReactClientOutputs.map((a) => a.path)
|
|
171687
171688
|
];
|
|
171688
|
-
const
|
|
171689
|
-
|
|
171690
|
-
for (const
|
|
171691
|
-
const
|
|
171692
|
-
|
|
171693
|
-
|
|
171694
|
-
|
|
171695
|
-
|
|
171696
|
-
|
|
171689
|
+
const urlFileMap = new Map;
|
|
171690
|
+
if (hmr) {
|
|
171691
|
+
for (const srcPath of urlReferencedFiles) {
|
|
171692
|
+
const rel = relative7(projectRoot, srcPath).replace(/\\/g, "/");
|
|
171693
|
+
const name = basename5(srcPath);
|
|
171694
|
+
const url = `/@src/${rel}`;
|
|
171695
|
+
urlFileMap.set(name, url);
|
|
171696
|
+
urlFileMap.set(name.replace(/\.tsx?$/, ".js"), url);
|
|
171697
|
+
}
|
|
171698
|
+
} else {
|
|
171699
|
+
for (const srcPath of urlReferencedFiles) {
|
|
171700
|
+
const srcBase = basename5(srcPath).replace(/\.[^.]+$/, "");
|
|
171701
|
+
const output = nonReactClientOutputs.find((a) => basename5(a.path).startsWith(srcBase + "."));
|
|
171702
|
+
if (output) {
|
|
171703
|
+
urlFileMap.set(basename5(srcPath), "/" + relative7(buildPath, output.path).replace(/\\/g, "/"));
|
|
171704
|
+
}
|
|
171705
|
+
}
|
|
171706
|
+
}
|
|
171697
171707
|
for (const outputPath of allClientOutputPaths) {
|
|
171698
171708
|
let content = readFileSync5(outputPath, "utf-8");
|
|
171699
171709
|
let changed = false;
|
|
171700
|
-
const frameworkDir = detectFramework(outputPath);
|
|
171701
171710
|
content = content.replace(urlPattern, (_match, relPath) => {
|
|
171702
171711
|
const targetName = basename5(relPath);
|
|
171703
|
-
const
|
|
171704
|
-
if (
|
|
171705
|
-
const rel = relative7(projectRoot, workerSrc);
|
|
171712
|
+
const resolvedPath = urlFileMap.get(targetName);
|
|
171713
|
+
if (resolvedPath) {
|
|
171706
171714
|
changed = true;
|
|
171707
|
-
return `new URL('
|
|
171715
|
+
return `new URL('${resolvedPath}', import.meta.url)`;
|
|
171708
171716
|
}
|
|
171709
171717
|
return _match;
|
|
171710
171718
|
});
|
|
@@ -171712,59 +171720,6 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
|
|
|
171712
171720
|
writeFileSync3(outputPath, content);
|
|
171713
171721
|
}
|
|
171714
171722
|
}
|
|
171715
|
-
let workerOutputs = [];
|
|
171716
|
-
if (workerEntryPoints.length > 0) {
|
|
171717
|
-
const workerResult = await bunBuild6({
|
|
171718
|
-
entrypoints: workerEntryPoints,
|
|
171719
|
-
format: "esm",
|
|
171720
|
-
minify: !isDev,
|
|
171721
|
-
naming: "[dir]/[name].[hash].[ext]",
|
|
171722
|
-
outdir: buildPath,
|
|
171723
|
-
root: commonAncestor(workerEntryPoints.map((p) => dirname6(p))),
|
|
171724
|
-
target: "browser",
|
|
171725
|
-
throw: false
|
|
171726
|
-
});
|
|
171727
|
-
if (workerResult.success) {
|
|
171728
|
-
workerOutputs = workerResult.outputs;
|
|
171729
|
-
const workerUrlMap = new Map;
|
|
171730
|
-
for (const artifact of workerOutputs) {
|
|
171731
|
-
for (const ep of workerEntryPoints) {
|
|
171732
|
-
const epBase = basename5(ep).replace(/\.[^.]+$/, "");
|
|
171733
|
-
if (basename5(artifact.path).startsWith(epBase)) {
|
|
171734
|
-
workerUrlMap.set(ep, "/" + relative7(buildPath, artifact.path));
|
|
171735
|
-
}
|
|
171736
|
-
}
|
|
171737
|
-
}
|
|
171738
|
-
const allClientOutputPaths = [
|
|
171739
|
-
...reactClientOutputPaths,
|
|
171740
|
-
...nonReactClientOutputs.map((a) => a.path)
|
|
171741
|
-
];
|
|
171742
|
-
for (const outputPath of allClientOutputPaths) {
|
|
171743
|
-
let content = readFileSync5(outputPath, "utf-8");
|
|
171744
|
-
let changed = false;
|
|
171745
|
-
for (const [srcPath, hashedPath] of workerUrlMap) {
|
|
171746
|
-
const srcRelPatterns = [
|
|
171747
|
-
"./" + relative7(buildPath, srcPath),
|
|
171748
|
-
"../" + relative7(buildPath, srcPath),
|
|
171749
|
-
relative7(buildPath, srcPath)
|
|
171750
|
-
];
|
|
171751
|
-
for (const pattern of srcRelPatterns) {
|
|
171752
|
-
if (content.includes(pattern)) {
|
|
171753
|
-
content = content.replaceAll(pattern, hashedPath);
|
|
171754
|
-
changed = true;
|
|
171755
|
-
}
|
|
171756
|
-
}
|
|
171757
|
-
}
|
|
171758
|
-
if (changed)
|
|
171759
|
-
writeFileSync3(outputPath, content);
|
|
171760
|
-
}
|
|
171761
|
-
} else {
|
|
171762
|
-
const workerLogs = workerResult.logs;
|
|
171763
|
-
if (workerLogs.length > 0) {
|
|
171764
|
-
extractBuildError(workerLogs, "worker", "Worker", frameworkNames, isIncremental, throwOnError);
|
|
171765
|
-
}
|
|
171766
|
-
}
|
|
171767
|
-
}
|
|
171768
171723
|
const allLogs = [
|
|
171769
171724
|
...serverLogs,
|
|
171770
171725
|
...reactClientLogs,
|
|
@@ -171778,8 +171733,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
|
|
|
171778
171733
|
...serverOutputs,
|
|
171779
171734
|
...reactClientOutputs,
|
|
171780
171735
|
...nonReactClientOutputs,
|
|
171781
|
-
...cssOutputs
|
|
171782
|
-
...workerOutputs
|
|
171736
|
+
...cssOutputs
|
|
171783
171737
|
], buildPath)
|
|
171784
171738
|
};
|
|
171785
171739
|
for (const artifact of serverOutputs) {
|
|
@@ -205083,5 +205037,5 @@ export {
|
|
|
205083
205037
|
build
|
|
205084
205038
|
};
|
|
205085
205039
|
|
|
205086
|
-
//# debugId=
|
|
205040
|
+
//# debugId=1438AD2CFD737EC464756E2164756E21
|
|
205087
205041
|
//# sourceMappingURL=build.js.map
|