@absolutejs/absolute 0.19.0-beta.762 → 0.19.0-beta.764
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/index.js +98 -8
- package/dist/angular/index.js.map +3 -3
- package/dist/angular/server.js +98 -8
- package/dist/angular/server.js.map +3 -3
- package/dist/build.js +98 -8
- package/dist/build.js.map +3 -3
- package/dist/index.js +98 -8
- package/dist/index.js.map +3 -3
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -43931,9 +43931,76 @@ ${registrations}
|
|
|
43931
43931
|
if (typeof hostSource === "string")
|
|
43932
43932
|
return hostSource;
|
|
43933
43933
|
return fs2.readFile(fileName, "utf-8");
|
|
43934
|
+
}, safeStableStringify = (value2) => {
|
|
43935
|
+
const seen = new WeakSet;
|
|
43936
|
+
return JSON.stringify(value2, (_key, entry) => {
|
|
43937
|
+
if (typeof entry === "function")
|
|
43938
|
+
return `[Function:${entry.name}]`;
|
|
43939
|
+
if (!entry || typeof entry !== "object")
|
|
43940
|
+
return entry;
|
|
43941
|
+
if (seen.has(entry))
|
|
43942
|
+
return "[Circular]";
|
|
43943
|
+
seen.add(entry);
|
|
43944
|
+
if (Array.isArray(entry))
|
|
43945
|
+
return entry;
|
|
43946
|
+
return Object.fromEntries(Object.entries(entry).sort(([left], [right]) => left.localeCompare(right)));
|
|
43947
|
+
});
|
|
43948
|
+
}, collectAngularResourcePaths = (source, fileDir) => {
|
|
43949
|
+
const paths = [];
|
|
43950
|
+
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
43951
|
+
if (templateUrlMatch?.[1])
|
|
43952
|
+
paths.push(join15(fileDir, templateUrlMatch[1]));
|
|
43953
|
+
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
43954
|
+
if (styleUrlMatch?.[1])
|
|
43955
|
+
paths.push(join15(fileDir, styleUrlMatch[1]));
|
|
43956
|
+
const styleUrlsMatch = findUncommentedMatch(source, /styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
43957
|
+
const urlMatches = styleUrlsMatch?.[1]?.match(/['"]([^'"]+)['"]/g);
|
|
43958
|
+
if (urlMatches) {
|
|
43959
|
+
for (const urlMatch of urlMatches) {
|
|
43960
|
+
paths.push(join15(fileDir, urlMatch.replace(/['"]/g, "")));
|
|
43961
|
+
}
|
|
43962
|
+
}
|
|
43963
|
+
return paths.map((path2) => resolve19(path2));
|
|
43964
|
+
}, readResourceCacheFile = async (cachePath) => {
|
|
43965
|
+
try {
|
|
43966
|
+
const entry = JSON.parse(await fs2.readFile(cachePath, "utf-8"));
|
|
43967
|
+
if (entry.version !== 1 || typeof entry.source !== "string") {
|
|
43968
|
+
return null;
|
|
43969
|
+
}
|
|
43970
|
+
return entry;
|
|
43971
|
+
} catch {
|
|
43972
|
+
return null;
|
|
43973
|
+
}
|
|
43974
|
+
}, writeResourceCacheFile = async (cachePath, source) => {
|
|
43975
|
+
await fs2.mkdir(dirname11(cachePath), { recursive: true });
|
|
43976
|
+
await fs2.writeFile(cachePath, JSON.stringify({
|
|
43977
|
+
source,
|
|
43978
|
+
version: 1
|
|
43979
|
+
}), "utf-8");
|
|
43980
|
+
}, resolveResourceTransformCachePath = async (filePath, source, stylePreprocessors) => {
|
|
43981
|
+
const resourcePaths = collectAngularResourcePaths(source, dirname11(filePath));
|
|
43982
|
+
const resourceContents = await Promise.all(resourcePaths.map(async (resourcePath) => {
|
|
43983
|
+
const content = await fs2.readFile(resourcePath, "utf-8");
|
|
43984
|
+
return `${resourcePath}\x00${content}`;
|
|
43985
|
+
}));
|
|
43986
|
+
const cacheInput = [
|
|
43987
|
+
"v1",
|
|
43988
|
+
filePath,
|
|
43989
|
+
source,
|
|
43990
|
+
...resourceContents,
|
|
43991
|
+
safeStableStringify(stylePreprocessors ?? null)
|
|
43992
|
+
].join("\x00");
|
|
43993
|
+
const cacheKey2 = Bun.hash(cacheInput).toString(BASE_36_RADIX);
|
|
43994
|
+
return join15(process.cwd(), ".absolutejs", "cache", "angular-resources", `${cacheKey2}.json`);
|
|
43934
43995
|
}, precomputeAotResourceTransforms = async (inputPaths, readFile4, stylePreprocessors) => {
|
|
43935
43996
|
const transformedSources = new Map;
|
|
43936
43997
|
const visited = new Set;
|
|
43998
|
+
const stats = {
|
|
43999
|
+
cacheHits: 0,
|
|
44000
|
+
cacheMisses: 0,
|
|
44001
|
+
filesVisited: 0,
|
|
44002
|
+
transformedFiles: 0
|
|
44003
|
+
};
|
|
43937
44004
|
const transformFile = async (filePath) => {
|
|
43938
44005
|
const resolvedPath = resolve19(filePath);
|
|
43939
44006
|
if (visited.has(resolvedPath))
|
|
@@ -43941,9 +44008,24 @@ ${registrations}
|
|
|
43941
44008
|
visited.add(resolvedPath);
|
|
43942
44009
|
if (!existsSync16(resolvedPath) || resolvedPath.endsWith(".d.ts"))
|
|
43943
44010
|
return;
|
|
44011
|
+
stats.filesVisited += 1;
|
|
43944
44012
|
const source = await readFileForAotTransform(resolvedPath, readFile4);
|
|
43945
|
-
const
|
|
43946
|
-
|
|
44013
|
+
const cachePath = await resolveResourceTransformCachePath(resolvedPath, source, stylePreprocessors);
|
|
44014
|
+
const cached = await readResourceCacheFile(cachePath);
|
|
44015
|
+
let transformedSource;
|
|
44016
|
+
if (cached) {
|
|
44017
|
+
stats.cacheHits += 1;
|
|
44018
|
+
transformedSource = cached.source;
|
|
44019
|
+
} else {
|
|
44020
|
+
stats.cacheMisses += 1;
|
|
44021
|
+
const transformed = await inlineResources(source, dirname11(resolvedPath), stylePreprocessors);
|
|
44022
|
+
transformedSource = transformed.source;
|
|
44023
|
+
await writeResourceCacheFile(cachePath, transformedSource);
|
|
44024
|
+
}
|
|
44025
|
+
if (transformedSource !== source) {
|
|
44026
|
+
stats.transformedFiles += 1;
|
|
44027
|
+
transformedSources.set(resolvedPath, transformedSource);
|
|
44028
|
+
}
|
|
43947
44029
|
const imports = extractLocalImportSpecifiers(source, resolvedPath);
|
|
43948
44030
|
await Promise.all(imports.map(async (specifier) => {
|
|
43949
44031
|
const resolvedImport = resolveLocalTsImport(resolvedPath, specifier);
|
|
@@ -43952,7 +44034,7 @@ ${registrations}
|
|
|
43952
44034
|
}));
|
|
43953
44035
|
};
|
|
43954
44036
|
await Promise.all(inputPaths.map((inputPath) => transformFile(inputPath)));
|
|
43955
|
-
return transformedSources;
|
|
44037
|
+
return { stats, transformedSources };
|
|
43956
44038
|
}, compileAngularFiles = async (inputPaths, outDir, stylePreprocessors) => {
|
|
43957
44039
|
const islandMetadataByOutputPath = await traceAngularPhase("aot/island-metadata", () => new Map(inputPaths.map((inputPath) => {
|
|
43958
44040
|
const outputPath = resolve19(join15(outDir, relative9(process.cwd(), resolve19(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
|
|
@@ -44013,7 +44095,15 @@ ${registrations}
|
|
|
44013
44095
|
emitted[relativePath] = text;
|
|
44014
44096
|
};
|
|
44015
44097
|
const originalReadFile = host.readFile;
|
|
44016
|
-
const
|
|
44098
|
+
const { stats: aotResourceTransformStats, transformedSources } = await traceAngularPhase("aot/precompute-resources", () => precomputeAotResourceTransforms(inputPaths, originalReadFile?.bind(host), stylePreprocessors), { entries: inputPaths.length });
|
|
44099
|
+
await traceAngularPhase("aot/resource-cache-summary", () => {
|
|
44100
|
+
return;
|
|
44101
|
+
}, {
|
|
44102
|
+
cacheHits: aotResourceTransformStats.cacheHits,
|
|
44103
|
+
cacheMisses: aotResourceTransformStats.cacheMisses,
|
|
44104
|
+
filesVisited: aotResourceTransformStats.filesVisited,
|
|
44105
|
+
transformedFiles: aotResourceTransformStats.transformedFiles
|
|
44106
|
+
});
|
|
44017
44107
|
host.readFile = (fileName) => {
|
|
44018
44108
|
const source = originalReadFile ? originalReadFile.call(host, fileName) : undefined;
|
|
44019
44109
|
if (typeof source !== "string")
|
|
@@ -44022,12 +44112,12 @@ ${registrations}
|
|
|
44022
44112
|
return source;
|
|
44023
44113
|
}
|
|
44024
44114
|
const resolvedPath = resolve19(fileName);
|
|
44025
|
-
return
|
|
44115
|
+
return transformedSources.get(resolvedPath) ?? source;
|
|
44026
44116
|
};
|
|
44027
44117
|
const originalGetSourceFileForCompile = host.getSourceFile;
|
|
44028
44118
|
host.getSourceFile = (fileName, languageVersion, onError2) => {
|
|
44029
|
-
const source =
|
|
44030
|
-
if (
|
|
44119
|
+
const source = transformedSources.get(resolve19(fileName));
|
|
44120
|
+
if (source) {
|
|
44031
44121
|
return ts2.createSourceFile(fileName, source, languageVersion, true);
|
|
44032
44122
|
}
|
|
44033
44123
|
return originalGetSourceFileForCompile?.call(host, fileName, languageVersion, onError2);
|
|
@@ -58673,5 +58763,5 @@ export {
|
|
|
58673
58763
|
ANGULAR_INIT_TIMEOUT_MS
|
|
58674
58764
|
};
|
|
58675
58765
|
|
|
58676
|
-
//# debugId=
|
|
58766
|
+
//# debugId=076CED2F51B54E1564756E2164756E21
|
|
58677
58767
|
//# sourceMappingURL=index.js.map
|