@absolutejs/absolute 0.17.17-beta.11 → 0.17.17-beta.12
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 +110 -38
- package/dist/build.js.map +7 -7
- package/dist/index.js +110 -38
- package/dist/index.js.map +7 -7
- package/dist/src/dev/clientManager.d.ts +1 -0
- package/package.json +1 -1
package/dist/build.js
CHANGED
|
@@ -240238,7 +240238,8 @@ var createHMRState = (config) => ({
|
|
|
240238
240238
|
config,
|
|
240239
240239
|
resolvedPaths: resolveBuildPaths(config),
|
|
240240
240240
|
vueChangeTypes: new Map,
|
|
240241
|
-
assetStore: new Map
|
|
240241
|
+
assetStore: new Map,
|
|
240242
|
+
manifest: {}
|
|
240242
240243
|
}), incrementSourceFileVersion = (state, filePath) => {
|
|
240243
240244
|
const currentVersion = state.sourceFileVersions.get(filePath) || 0;
|
|
240244
240245
|
const newVersion = currentVersion + 1;
|
|
@@ -240748,37 +240749,6 @@ var handleClientConnect = (state, client, manifest) => {
|
|
|
240748
240749
|
};
|
|
240749
240750
|
var init_webSocket = () => {};
|
|
240750
240751
|
|
|
240751
|
-
// src/dev/simpleHTMLHMR.ts
|
|
240752
|
-
var exports_simpleHTMLHMR = {};
|
|
240753
|
-
__export(exports_simpleHTMLHMR, {
|
|
240754
|
-
handleHTMLUpdate: () => handleHTMLUpdate
|
|
240755
|
-
});
|
|
240756
|
-
import { readFileSync as readFileSync8, existsSync as existsSync11 } from "fs";
|
|
240757
|
-
import { resolve as resolve16 } from "path";
|
|
240758
|
-
var handleHTMLUpdate = async (htmlFilePath) => {
|
|
240759
|
-
try {
|
|
240760
|
-
const resolvedPath = resolve16(htmlFilePath);
|
|
240761
|
-
if (!existsSync11(resolvedPath)) {
|
|
240762
|
-
return null;
|
|
240763
|
-
}
|
|
240764
|
-
const htmlContent = readFileSync8(resolvedPath, "utf-8");
|
|
240765
|
-
const headMatch = htmlContent.match(/<head[^>]*>([\s\S]*?)<\/head>/i);
|
|
240766
|
-
const bodyMatch = htmlContent.match(/<body[^>]*>([\s\S]*)<\/body>/i);
|
|
240767
|
-
if (bodyMatch && bodyMatch[1]) {
|
|
240768
|
-
const bodyContent = bodyMatch[1].trim();
|
|
240769
|
-
const headContent = headMatch && headMatch[1] ? headMatch[1].trim() : null;
|
|
240770
|
-
return {
|
|
240771
|
-
body: bodyContent,
|
|
240772
|
-
head: headContent
|
|
240773
|
-
};
|
|
240774
|
-
}
|
|
240775
|
-
return htmlContent;
|
|
240776
|
-
} catch {
|
|
240777
|
-
return null;
|
|
240778
|
-
}
|
|
240779
|
-
};
|
|
240780
|
-
var init_simpleHTMLHMR = () => {};
|
|
240781
|
-
|
|
240782
240752
|
// src/utils/ssrErrorPage.ts
|
|
240783
240753
|
var ssrErrorPage = (framework, error) => {
|
|
240784
240754
|
const frameworkColors2 = {
|
|
@@ -269862,13 +269832,13 @@ __export(exports_pageHandler, {
|
|
|
269862
269832
|
getCachedRouteData: () => getCachedRouteData
|
|
269863
269833
|
});
|
|
269864
269834
|
import { AsyncLocalStorage } from "async_hooks";
|
|
269865
|
-
import { readFileSync as
|
|
269835
|
+
import { readFileSync as readFileSync8, writeFileSync as writeFileSync4 } from "fs";
|
|
269866
269836
|
import { dirname as dirname6, join as join12 } from "path";
|
|
269867
269837
|
var angularSsrContext, patchAngularInjectorSingleton = () => {
|
|
269868
269838
|
try {
|
|
269869
269839
|
const coreDir = dirname6(__require.resolve("@angular/core/package.json"));
|
|
269870
269840
|
const chunkPath = join12(coreDir, "fesm2022", "_not_found-chunk.mjs");
|
|
269871
|
-
const content =
|
|
269841
|
+
const content = readFileSync8(chunkPath, "utf-8");
|
|
269872
269842
|
if (content.includes('Symbol.for("angular.currentInjector")')) {
|
|
269873
269843
|
return;
|
|
269874
269844
|
}
|
|
@@ -270210,10 +270180,10 @@ var exports_simpleAngularHMR = {};
|
|
|
270210
270180
|
__export(exports_simpleAngularHMR, {
|
|
270211
270181
|
handleAngularUpdate: () => handleAngularUpdate
|
|
270212
270182
|
});
|
|
270213
|
-
import { basename as basename7, isAbsolute, resolve as
|
|
270183
|
+
import { basename as basename7, isAbsolute, resolve as resolve16 } from "path";
|
|
270214
270184
|
var handleAngularUpdate = async (angularFilePath, manifest, buildDir) => {
|
|
270215
270185
|
try {
|
|
270216
|
-
const resolvedPath =
|
|
270186
|
+
const resolvedPath = resolve16(angularFilePath);
|
|
270217
270187
|
const fileName = basename7(resolvedPath);
|
|
270218
270188
|
const baseName = fileName.replace(/\.[tj]s$/, "");
|
|
270219
270189
|
const pascalName = toPascal(baseName);
|
|
@@ -270232,7 +270202,7 @@ var handleAngularUpdate = async (angularFilePath, manifest, buildDir) => {
|
|
|
270232
270202
|
return null;
|
|
270233
270203
|
}
|
|
270234
270204
|
const cacheBuster = `?t=${Date.now()}`;
|
|
270235
|
-
const absoluteServerPath = isAbsolute(serverPath) ? serverPath :
|
|
270205
|
+
const absoluteServerPath = isAbsolute(serverPath) ? serverPath : resolve16(buildDir || process.cwd(), serverPath.replace(/^\//, ""));
|
|
270236
270206
|
const serverPathWithCacheBuster = `${absoluteServerPath}${cacheBuster}`;
|
|
270237
270207
|
const { handleAngularPageRequest: handleAngularPageRequest2, getCachedRouteData: getCachedRouteData2 } = await Promise.resolve().then(() => (init_pageHandler(), exports_pageHandler));
|
|
270238
270208
|
const { generateHeadElement: generateHeadElement2 } = await Promise.resolve().then(() => exports_generateHeadElement);
|
|
@@ -270284,6 +270254,37 @@ var handleAngularUpdate = async (angularFilePath, manifest, buildDir) => {
|
|
|
270284
270254
|
};
|
|
270285
270255
|
var init_simpleAngularHMR = () => {};
|
|
270286
270256
|
|
|
270257
|
+
// src/dev/simpleHTMLHMR.ts
|
|
270258
|
+
var exports_simpleHTMLHMR = {};
|
|
270259
|
+
__export(exports_simpleHTMLHMR, {
|
|
270260
|
+
handleHTMLUpdate: () => handleHTMLUpdate
|
|
270261
|
+
});
|
|
270262
|
+
import { readFileSync as readFileSync9, existsSync as existsSync11 } from "fs";
|
|
270263
|
+
import { resolve as resolve17 } from "path";
|
|
270264
|
+
var handleHTMLUpdate = async (htmlFilePath) => {
|
|
270265
|
+
try {
|
|
270266
|
+
const resolvedPath = resolve17(htmlFilePath);
|
|
270267
|
+
if (!existsSync11(resolvedPath)) {
|
|
270268
|
+
return null;
|
|
270269
|
+
}
|
|
270270
|
+
const htmlContent = readFileSync9(resolvedPath, "utf-8");
|
|
270271
|
+
const headMatch = htmlContent.match(/<head[^>]*>([\s\S]*?)<\/head>/i);
|
|
270272
|
+
const bodyMatch = htmlContent.match(/<body[^>]*>([\s\S]*)<\/body>/i);
|
|
270273
|
+
if (bodyMatch && bodyMatch[1]) {
|
|
270274
|
+
const bodyContent = bodyMatch[1].trim();
|
|
270275
|
+
const headContent = headMatch && headMatch[1] ? headMatch[1].trim() : null;
|
|
270276
|
+
return {
|
|
270277
|
+
body: bodyContent,
|
|
270278
|
+
head: headContent
|
|
270279
|
+
};
|
|
270280
|
+
}
|
|
270281
|
+
return htmlContent;
|
|
270282
|
+
} catch {
|
|
270283
|
+
return null;
|
|
270284
|
+
}
|
|
270285
|
+
};
|
|
270286
|
+
var init_simpleHTMLHMR = () => {};
|
|
270287
|
+
|
|
270287
270288
|
// src/dev/simpleHTMXHMR.ts
|
|
270288
270289
|
var exports_simpleHTMXHMR = {};
|
|
270289
270290
|
__export(exports_simpleHTMXHMR, {
|
|
@@ -270494,6 +270495,75 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
270494
270495
|
type: "rebuild-start"
|
|
270495
270496
|
});
|
|
270496
270497
|
try {
|
|
270498
|
+
const isAngularOnlyChange = affectedFrameworks.length === 1 && affectedFrameworks[0] === "angular" && config.angularDirectory && Object.keys(state.manifest).length > 0 && filesToRebuild && filesToRebuild.length > 0 && !filesToRebuild.some((f) => f.endsWith(".css"));
|
|
270499
|
+
if (isAngularOnlyChange) {
|
|
270500
|
+
const angularDir = config.angularDirectory;
|
|
270501
|
+
const angularFiles = filesToRebuild.filter((file3) => detectFramework(file3, state.resolvedPaths) === "angular");
|
|
270502
|
+
const angularPagesPath = resolve19(angularDir, "pages");
|
|
270503
|
+
let pageEntries = angularFiles.filter((f) => f.endsWith(".ts") && resolve19(f).startsWith(angularPagesPath));
|
|
270504
|
+
if (pageEntries.length === 0 && state.dependencyGraph) {
|
|
270505
|
+
const resolvedPages = new Set;
|
|
270506
|
+
for (const componentFile of angularFiles) {
|
|
270507
|
+
let lookupFile = componentFile;
|
|
270508
|
+
if (componentFile.endsWith(".html")) {
|
|
270509
|
+
const tsCounterpart = componentFile.replace(/\.html$/, ".ts");
|
|
270510
|
+
if (existsSync13(tsCounterpart))
|
|
270511
|
+
lookupFile = tsCounterpart;
|
|
270512
|
+
}
|
|
270513
|
+
const affected = getAffectedFiles(state.dependencyGraph, lookupFile);
|
|
270514
|
+
for (const file3 of affected) {
|
|
270515
|
+
if (file3.endsWith(".ts") && resolve19(file3).startsWith(angularPagesPath)) {
|
|
270516
|
+
resolvedPages.add(file3);
|
|
270517
|
+
}
|
|
270518
|
+
}
|
|
270519
|
+
}
|
|
270520
|
+
pageEntries = Array.from(resolvedPages);
|
|
270521
|
+
}
|
|
270522
|
+
if (pageEntries.length > 0) {
|
|
270523
|
+
const { compileAngular: compileAngular2 } = await Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular));
|
|
270524
|
+
const { serverPaths } = await compileAngular2(pageEntries, angularDir, true);
|
|
270525
|
+
for (const serverPath of serverPaths) {
|
|
270526
|
+
const fileBase = basename8(serverPath, ".js");
|
|
270527
|
+
state.manifest[toPascal(fileBase)] = resolve19(serverPath);
|
|
270528
|
+
}
|
|
270529
|
+
}
|
|
270530
|
+
const duration2 = Date.now() - startTime;
|
|
270531
|
+
const manifest2 = state.manifest;
|
|
270532
|
+
const angularHmrFiles = angularFiles.filter((f) => f.endsWith(".ts") || f.endsWith(".html"));
|
|
270533
|
+
const angularPageFiles = angularHmrFiles.filter((f) => f.replace(/\\/g, "/").includes("/pages/"));
|
|
270534
|
+
let pagesToUpdate = angularPageFiles.length > 0 ? angularPageFiles : pageEntries;
|
|
270535
|
+
for (const angularPagePath of pagesToUpdate) {
|
|
270536
|
+
try {
|
|
270537
|
+
const fileName = basename8(angularPagePath);
|
|
270538
|
+
const baseName = fileName.replace(/\.[tj]s$/, "");
|
|
270539
|
+
const pascalName = toPascal(baseName);
|
|
270540
|
+
const cssKey = `${pascalName}CSS`;
|
|
270541
|
+
const cssUrl = manifest2[cssKey] || null;
|
|
270542
|
+
const { handleAngularUpdate: handleAngularUpdate2 } = await Promise.resolve().then(() => (init_simpleAngularHMR(), exports_simpleAngularHMR));
|
|
270543
|
+
const newHTML = await handleAngularUpdate2(angularPagePath, manifest2, state.resolvedPaths.buildDir);
|
|
270544
|
+
logger.hmrUpdate(angularPagePath, "angular", duration2);
|
|
270545
|
+
broadcastToClients(state, {
|
|
270546
|
+
data: {
|
|
270547
|
+
framework: "angular",
|
|
270548
|
+
html: newHTML,
|
|
270549
|
+
cssUrl,
|
|
270550
|
+
cssBaseName: baseName,
|
|
270551
|
+
updateType: "logic",
|
|
270552
|
+
manifest: manifest2,
|
|
270553
|
+
sourceFile: angularPagePath
|
|
270554
|
+
},
|
|
270555
|
+
type: "angular-update"
|
|
270556
|
+
});
|
|
270557
|
+
} catch (err) {
|
|
270558
|
+
sendTelemetryEvent("hmr:error", {
|
|
270559
|
+
framework: "angular",
|
|
270560
|
+
message: err instanceof Error ? err.message : String(err)
|
|
270561
|
+
});
|
|
270562
|
+
}
|
|
270563
|
+
}
|
|
270564
|
+
onRebuildComplete({ manifest: manifest2, hmrState: state });
|
|
270565
|
+
return manifest2;
|
|
270566
|
+
}
|
|
270497
270567
|
const manifest = await build({
|
|
270498
270568
|
...config,
|
|
270499
270569
|
incrementalFiles: filesToRebuild && filesToRebuild.length > 0 ? filesToRebuild : undefined,
|
|
@@ -271106,9 +271176,11 @@ var devBuild = async (config) => {
|
|
|
271106
271176
|
}
|
|
271107
271177
|
} catch {}
|
|
271108
271178
|
}
|
|
271179
|
+
state.manifest = manifest;
|
|
271109
271180
|
startFileWatching(state, config, (filePath) => {
|
|
271110
271181
|
queueFileChange(state, filePath, config, (newBuildResult) => {
|
|
271111
271182
|
Object.assign(manifest, newBuildResult.manifest);
|
|
271183
|
+
state.manifest = manifest;
|
|
271112
271184
|
});
|
|
271113
271185
|
});
|
|
271114
271186
|
globalThis.__hmrBuildDuration = performance.now() - buildStart;
|
|
@@ -271140,5 +271212,5 @@ export {
|
|
|
271140
271212
|
build
|
|
271141
271213
|
};
|
|
271142
271214
|
|
|
271143
|
-
//# debugId=
|
|
271215
|
+
//# debugId=E0EE0799C026CC4664756E2164756E21
|
|
271144
271216
|
//# sourceMappingURL=build.js.map
|