@absolutejs/absolute 0.19.0-beta.763 → 0.19.0-beta.765
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 +96 -8
- package/dist/angular/index.js.map +3 -3
- package/dist/angular/server.js +96 -8
- package/dist/angular/server.js.map +3 -3
- package/dist/build.js +179 -23
- package/dist/build.js.map +5 -5
- package/dist/cli/index.js +1 -0
- package/dist/index.js +182 -25
- package/dist/index.js.map +6 -6
- package/dist/src/build/generateManifest.d.ts +1 -1
- package/dist/src/core/build.d.ts +7 -2
- package/dist/src/utils/loadConfig.d.ts +1 -0
- package/dist/types/build.d.ts +15 -0
- package/package.json +7 -7
package/dist/build.js
CHANGED
|
@@ -289,6 +289,15 @@ var getManifestKey = (folder, pascalName, isClientComponent, isReact, isVue, isS
|
|
|
289
289
|
if (isFromReact || isFromVue || isFromSvelte || isFromAngular)
|
|
290
290
|
return `${pascalName}BundledCSS`;
|
|
291
291
|
return `${pascalName}CSS`;
|
|
292
|
+
}, getArtifactBaseName = (fileName, hash) => {
|
|
293
|
+
const ext = extname(fileName);
|
|
294
|
+
const stem = ext ? fileName.slice(0, -ext.length) : fileName;
|
|
295
|
+
if (!hash)
|
|
296
|
+
return stem;
|
|
297
|
+
const hashSuffix = `.${hash}`;
|
|
298
|
+
if (stem.endsWith(hashSuffix))
|
|
299
|
+
return stem.slice(0, -hashSuffix.length);
|
|
300
|
+
return stem;
|
|
292
301
|
}, generateManifest = (outputs, buildPath) => outputs.reduce((manifest, artifact) => {
|
|
293
302
|
const normalizedArtifactPath = normalizePath(artifact.path);
|
|
294
303
|
const normalizedBuildPath = normalizePath(buildPath);
|
|
@@ -298,7 +307,7 @@ var getManifestKey = (folder, pascalName, isClientComponent, isReact, isVue, isS
|
|
|
298
307
|
const fileWithHash = segments.pop();
|
|
299
308
|
if (!fileWithHash)
|
|
300
309
|
return manifest;
|
|
301
|
-
const
|
|
310
|
+
const baseName = getArtifactBaseName(fileWithHash, artifact.hash);
|
|
302
311
|
if (!baseName)
|
|
303
312
|
return manifest;
|
|
304
313
|
const pascalName = toPascal(baseName);
|
|
@@ -43739,9 +43748,76 @@ ${registrations}
|
|
|
43739
43748
|
if (typeof hostSource === "string")
|
|
43740
43749
|
return hostSource;
|
|
43741
43750
|
return fs2.readFile(fileName, "utf-8");
|
|
43751
|
+
}, safeStableStringify = (value2) => {
|
|
43752
|
+
const seen = new WeakSet;
|
|
43753
|
+
return JSON.stringify(value2, (_key, entry) => {
|
|
43754
|
+
if (typeof entry === "function")
|
|
43755
|
+
return `[Function:${entry.name}]`;
|
|
43756
|
+
if (!entry || typeof entry !== "object")
|
|
43757
|
+
return entry;
|
|
43758
|
+
if (seen.has(entry))
|
|
43759
|
+
return "[Circular]";
|
|
43760
|
+
seen.add(entry);
|
|
43761
|
+
if (Array.isArray(entry))
|
|
43762
|
+
return entry;
|
|
43763
|
+
return Object.fromEntries(Object.entries(entry).sort(([left], [right]) => left.localeCompare(right)));
|
|
43764
|
+
});
|
|
43765
|
+
}, collectAngularResourcePaths = (source, fileDir) => {
|
|
43766
|
+
const paths = [];
|
|
43767
|
+
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
43768
|
+
if (templateUrlMatch?.[1])
|
|
43769
|
+
paths.push(join15(fileDir, templateUrlMatch[1]));
|
|
43770
|
+
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
43771
|
+
if (styleUrlMatch?.[1])
|
|
43772
|
+
paths.push(join15(fileDir, styleUrlMatch[1]));
|
|
43773
|
+
const styleUrlsMatch = findUncommentedMatch(source, /styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
43774
|
+
const urlMatches = styleUrlsMatch?.[1]?.match(/['"]([^'"]+)['"]/g);
|
|
43775
|
+
if (urlMatches) {
|
|
43776
|
+
for (const urlMatch of urlMatches) {
|
|
43777
|
+
paths.push(join15(fileDir, urlMatch.replace(/['"]/g, "")));
|
|
43778
|
+
}
|
|
43779
|
+
}
|
|
43780
|
+
return paths.map((path2) => resolve16(path2));
|
|
43781
|
+
}, readResourceCacheFile = async (cachePath) => {
|
|
43782
|
+
try {
|
|
43783
|
+
const entry = JSON.parse(await fs2.readFile(cachePath, "utf-8"));
|
|
43784
|
+
if (entry.version !== 1 || typeof entry.source !== "string") {
|
|
43785
|
+
return null;
|
|
43786
|
+
}
|
|
43787
|
+
return entry;
|
|
43788
|
+
} catch {
|
|
43789
|
+
return null;
|
|
43790
|
+
}
|
|
43791
|
+
}, writeResourceCacheFile = async (cachePath, source) => {
|
|
43792
|
+
await fs2.mkdir(dirname10(cachePath), { recursive: true });
|
|
43793
|
+
await fs2.writeFile(cachePath, JSON.stringify({
|
|
43794
|
+
source,
|
|
43795
|
+
version: 1
|
|
43796
|
+
}), "utf-8");
|
|
43797
|
+
}, resolveResourceTransformCachePath = async (filePath, source, stylePreprocessors) => {
|
|
43798
|
+
const resourcePaths = collectAngularResourcePaths(source, dirname10(filePath));
|
|
43799
|
+
const resourceContents = await Promise.all(resourcePaths.map(async (resourcePath) => {
|
|
43800
|
+
const content = await fs2.readFile(resourcePath, "utf-8");
|
|
43801
|
+
return `${resourcePath}\x00${content}`;
|
|
43802
|
+
}));
|
|
43803
|
+
const cacheInput = [
|
|
43804
|
+
"v1",
|
|
43805
|
+
filePath,
|
|
43806
|
+
source,
|
|
43807
|
+
...resourceContents,
|
|
43808
|
+
safeStableStringify(stylePreprocessors ?? null)
|
|
43809
|
+
].join("\x00");
|
|
43810
|
+
const cacheKey2 = Bun.hash(cacheInput).toString(BASE_36_RADIX);
|
|
43811
|
+
return join15(process.cwd(), ".absolutejs", "cache", "angular-resources", `${cacheKey2}.json`);
|
|
43742
43812
|
}, precomputeAotResourceTransforms = async (inputPaths, readFile4, stylePreprocessors) => {
|
|
43743
43813
|
const transformedSources = new Map;
|
|
43744
43814
|
const visited = new Set;
|
|
43815
|
+
const stats = {
|
|
43816
|
+
cacheHits: 0,
|
|
43817
|
+
cacheMisses: 0,
|
|
43818
|
+
filesVisited: 0,
|
|
43819
|
+
transformedFiles: 0
|
|
43820
|
+
};
|
|
43745
43821
|
const transformFile = async (filePath) => {
|
|
43746
43822
|
const resolvedPath = resolve16(filePath);
|
|
43747
43823
|
if (visited.has(resolvedPath))
|
|
@@ -43749,10 +43825,23 @@ ${registrations}
|
|
|
43749
43825
|
visited.add(resolvedPath);
|
|
43750
43826
|
if (!existsSync16(resolvedPath) || resolvedPath.endsWith(".d.ts"))
|
|
43751
43827
|
return;
|
|
43828
|
+
stats.filesVisited += 1;
|
|
43752
43829
|
const source = await readFileForAotTransform(resolvedPath, readFile4);
|
|
43753
|
-
const
|
|
43754
|
-
|
|
43755
|
-
|
|
43830
|
+
const cachePath = await resolveResourceTransformCachePath(resolvedPath, source, stylePreprocessors);
|
|
43831
|
+
const cached = await readResourceCacheFile(cachePath);
|
|
43832
|
+
let transformedSource;
|
|
43833
|
+
if (cached) {
|
|
43834
|
+
stats.cacheHits += 1;
|
|
43835
|
+
transformedSource = cached.source;
|
|
43836
|
+
} else {
|
|
43837
|
+
stats.cacheMisses += 1;
|
|
43838
|
+
const transformed = await inlineResources(source, dirname10(resolvedPath), stylePreprocessors);
|
|
43839
|
+
transformedSource = transformed.source;
|
|
43840
|
+
await writeResourceCacheFile(cachePath, transformedSource);
|
|
43841
|
+
}
|
|
43842
|
+
if (transformedSource !== source) {
|
|
43843
|
+
stats.transformedFiles += 1;
|
|
43844
|
+
transformedSources.set(resolvedPath, transformedSource);
|
|
43756
43845
|
}
|
|
43757
43846
|
const imports = extractLocalImportSpecifiers(source, resolvedPath);
|
|
43758
43847
|
await Promise.all(imports.map(async (specifier) => {
|
|
@@ -43762,7 +43851,7 @@ ${registrations}
|
|
|
43762
43851
|
}));
|
|
43763
43852
|
};
|
|
43764
43853
|
await Promise.all(inputPaths.map((inputPath) => transformFile(inputPath)));
|
|
43765
|
-
return transformedSources;
|
|
43854
|
+
return { stats, transformedSources };
|
|
43766
43855
|
}, compileAngularFiles = async (inputPaths, outDir, stylePreprocessors) => {
|
|
43767
43856
|
const islandMetadataByOutputPath = await traceAngularPhase("aot/island-metadata", () => new Map(inputPaths.map((inputPath) => {
|
|
43768
43857
|
const outputPath = resolve16(join15(outDir, relative9(process.cwd(), resolve16(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
|
|
@@ -43823,7 +43912,15 @@ ${registrations}
|
|
|
43823
43912
|
emitted[relativePath] = text;
|
|
43824
43913
|
};
|
|
43825
43914
|
const originalReadFile = host.readFile;
|
|
43826
|
-
const
|
|
43915
|
+
const { stats: aotResourceTransformStats, transformedSources } = await traceAngularPhase("aot/precompute-resources", () => precomputeAotResourceTransforms(inputPaths, originalReadFile?.bind(host), stylePreprocessors), { entries: inputPaths.length });
|
|
43916
|
+
await traceAngularPhase("aot/resource-cache-summary", () => {
|
|
43917
|
+
return;
|
|
43918
|
+
}, {
|
|
43919
|
+
cacheHits: aotResourceTransformStats.cacheHits,
|
|
43920
|
+
cacheMisses: aotResourceTransformStats.cacheMisses,
|
|
43921
|
+
filesVisited: aotResourceTransformStats.filesVisited,
|
|
43922
|
+
transformedFiles: aotResourceTransformStats.transformedFiles
|
|
43923
|
+
});
|
|
43827
43924
|
host.readFile = (fileName) => {
|
|
43828
43925
|
const source = originalReadFile ? originalReadFile.call(host, fileName) : undefined;
|
|
43829
43926
|
if (typeof source !== "string")
|
|
@@ -43832,11 +43929,11 @@ ${registrations}
|
|
|
43832
43929
|
return source;
|
|
43833
43930
|
}
|
|
43834
43931
|
const resolvedPath = resolve16(fileName);
|
|
43835
|
-
return
|
|
43932
|
+
return transformedSources.get(resolvedPath) ?? source;
|
|
43836
43933
|
};
|
|
43837
43934
|
const originalGetSourceFileForCompile = host.getSourceFile;
|
|
43838
43935
|
host.getSourceFile = (fileName, languageVersion, onError2) => {
|
|
43839
|
-
const source =
|
|
43936
|
+
const source = transformedSources.get(resolve16(fileName));
|
|
43840
43937
|
if (source) {
|
|
43841
43938
|
return ts2.createSourceFile(fileName, source, languageVersion, true);
|
|
43842
43939
|
}
|
|
@@ -45427,7 +45524,43 @@ ${content.slice(firstUseIdx)}`;
|
|
|
45427
45524
|
if (changed)
|
|
45428
45525
|
writeFileSync7(outputPath, content);
|
|
45429
45526
|
}
|
|
45430
|
-
}, vueFeatureFlags,
|
|
45527
|
+
}, vueFeatureFlags, bunBuildPassKeys, bunBuildPassKeySet, reservedBunBuildConfigKeys, isObject = (value2) => typeof value2 === "object" && value2 !== null, isBunBuildPassConfig = (config) => isObject(config) && Object.keys(config).some((key) => bunBuildPassKeySet.has(key)), sanitizeBunBuildOverride = (override) => {
|
|
45528
|
+
if (!override)
|
|
45529
|
+
return {};
|
|
45530
|
+
const sanitized = { ...override };
|
|
45531
|
+
for (const key of reservedBunBuildConfigKeys) {
|
|
45532
|
+
delete sanitized[key];
|
|
45533
|
+
}
|
|
45534
|
+
return sanitized;
|
|
45535
|
+
}, resolveBunBuildOverride = (config, pass) => {
|
|
45536
|
+
if (!config)
|
|
45537
|
+
return {};
|
|
45538
|
+
if (!isBunBuildPassConfig(config)) {
|
|
45539
|
+
return sanitizeBunBuildOverride(config);
|
|
45540
|
+
}
|
|
45541
|
+
return sanitizeBunBuildOverride({
|
|
45542
|
+
...config.default ?? {},
|
|
45543
|
+
...config[pass] ?? {}
|
|
45544
|
+
});
|
|
45545
|
+
}, dedupe = (values) => [...new Set(values)], mergeBunBuildConfig = (base, override) => {
|
|
45546
|
+
const sanitized = sanitizeBunBuildOverride(override);
|
|
45547
|
+
const merged = {
|
|
45548
|
+
...base,
|
|
45549
|
+
...sanitized
|
|
45550
|
+
};
|
|
45551
|
+
return {
|
|
45552
|
+
...merged,
|
|
45553
|
+
define: base.define || sanitized.define ? {
|
|
45554
|
+
...sanitized.define ?? {},
|
|
45555
|
+
...base.define ?? {}
|
|
45556
|
+
} : undefined,
|
|
45557
|
+
external: dedupe([
|
|
45558
|
+
...base.external ?? [],
|
|
45559
|
+
...sanitized.external ?? []
|
|
45560
|
+
]),
|
|
45561
|
+
plugins: [...base.plugins ?? [], ...sanitized.plugins ?? []]
|
|
45562
|
+
};
|
|
45563
|
+
}, build = async ({
|
|
45431
45564
|
buildDirectory = "build",
|
|
45432
45565
|
assetsDirectory,
|
|
45433
45566
|
publicDirectory,
|
|
@@ -45442,6 +45575,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
45442
45575
|
stylePreprocessors,
|
|
45443
45576
|
postcss,
|
|
45444
45577
|
tailwind,
|
|
45578
|
+
bunBuild: bunBuildConfig,
|
|
45445
45579
|
options,
|
|
45446
45580
|
incrementalFiles,
|
|
45447
45581
|
mode
|
|
@@ -45881,20 +46015,23 @@ ${content.slice(firstUseIdx)}`;
|
|
|
45881
46015
|
...svelteVendorPaths2 ?? {}
|
|
45882
46016
|
};
|
|
45883
46017
|
const htmlScriptPlugin = hmr ? createHTMLScriptHMRPlugin(htmlDir, htmxDir) : undefined;
|
|
45884
|
-
const reactBuildConfig = reactClientEntryPoints.length > 0 ? {
|
|
46018
|
+
const reactBuildConfig = reactClientEntryPoints.length > 0 ? mergeBunBuildConfig({
|
|
45885
46019
|
entrypoints: reactClientEntryPoints,
|
|
45886
46020
|
...Object.keys(reactExternalPaths).length > 0 ? { external: Object.keys(reactExternalPaths) } : {},
|
|
45887
46021
|
format: "esm",
|
|
45888
46022
|
minify: !isDev,
|
|
45889
46023
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
45890
46024
|
outdir: buildPath,
|
|
45891
|
-
...hmr ? {
|
|
46025
|
+
...hmr ? {
|
|
46026
|
+
jsx: { development: true },
|
|
46027
|
+
reactFastRefresh: true
|
|
46028
|
+
} : {},
|
|
45892
46029
|
plugins: [stylePreprocessorPlugin2],
|
|
45893
46030
|
root: clientRoot,
|
|
45894
46031
|
splitting: true,
|
|
45895
46032
|
target: "browser",
|
|
45896
46033
|
throw: false
|
|
45897
|
-
} : undefined;
|
|
46034
|
+
}, resolveBunBuildOverride(bunBuildConfig, "reactClient")) : undefined;
|
|
45898
46035
|
if (reactDir && reactClientEntryPoints.length > 0) {
|
|
45899
46036
|
rmSync2(join20(buildPath, "react", "generated", "indexes"), {
|
|
45900
46037
|
force: true,
|
|
@@ -45921,7 +46058,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
45921
46058
|
globalCssResult,
|
|
45922
46059
|
vueCssResult
|
|
45923
46060
|
] = await Promise.all([
|
|
45924
|
-
serverEntryPoints.length > 0 ? tracePhase("bun/server", () => bunBuild7({
|
|
46061
|
+
serverEntryPoints.length > 0 ? tracePhase("bun/server", () => bunBuild7(mergeBunBuildConfig({
|
|
45925
46062
|
entrypoints: serverEntryPoints,
|
|
45926
46063
|
external: [
|
|
45927
46064
|
"react",
|
|
@@ -45943,9 +46080,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
45943
46080
|
target: "bun",
|
|
45944
46081
|
throw: false,
|
|
45945
46082
|
tsconfig: "./tsconfig.json"
|
|
45946
|
-
})) : undefined,
|
|
46083
|
+
}, resolveBunBuildOverride(bunBuildConfig, "server")))) : undefined,
|
|
45947
46084
|
reactBuildConfig ? tracePhase("bun/react-client", () => bunBuild7(reactBuildConfig)) : undefined,
|
|
45948
|
-
nonReactClientEntryPoints.length > 0 ? tracePhase("bun/non-react-client", () => bunBuild7({
|
|
46085
|
+
nonReactClientEntryPoints.length > 0 ? tracePhase("bun/non-react-client", () => bunBuild7(mergeBunBuildConfig({
|
|
45949
46086
|
define: vueDirectory ? vueFeatureFlags : undefined,
|
|
45950
46087
|
entrypoints: nonReactClientEntryPoints,
|
|
45951
46088
|
external: Object.keys(nonReactExternalPaths),
|
|
@@ -45963,8 +46100,8 @@ ${content.slice(firstUseIdx)}`;
|
|
|
45963
46100
|
target: "browser",
|
|
45964
46101
|
throw: false,
|
|
45965
46102
|
tsconfig: "./tsconfig.json"
|
|
45966
|
-
})) : undefined,
|
|
45967
|
-
islandClientEntryPoints.length > 0 ? tracePhase("bun/island-client", () => bunBuild7({
|
|
46103
|
+
}, resolveBunBuildOverride(bunBuildConfig, "nonReactClient")))) : undefined,
|
|
46104
|
+
islandClientEntryPoints.length > 0 ? tracePhase("bun/island-client", () => bunBuild7(mergeBunBuildConfig({
|
|
45968
46105
|
define: vueDirectory ? vueFeatureFlags : undefined,
|
|
45969
46106
|
entrypoints: islandClientEntryPoints,
|
|
45970
46107
|
external: Object.keys(nonReactExternalPaths),
|
|
@@ -45981,8 +46118,8 @@ ${content.slice(firstUseIdx)}`;
|
|
|
45981
46118
|
target: "browser",
|
|
45982
46119
|
throw: false,
|
|
45983
46120
|
tsconfig: "./tsconfig.json"
|
|
45984
|
-
})) : undefined,
|
|
45985
|
-
globalCssEntries.length > 0 ? tracePhase("bun/global-css", () => bunBuild7({
|
|
46121
|
+
}, resolveBunBuildOverride(bunBuildConfig, "islandClient")))) : undefined,
|
|
46122
|
+
globalCssEntries.length > 0 ? tracePhase("bun/global-css", () => bunBuild7(mergeBunBuildConfig({
|
|
45986
46123
|
entrypoints: globalCssEntries,
|
|
45987
46124
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
45988
46125
|
outdir: stylesDir ? join20(buildPath, basename7(stylesDir)) : buildPath,
|
|
@@ -45990,14 +46127,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
45990
46127
|
root: stylesDir || clientRoot,
|
|
45991
46128
|
target: "browser",
|
|
45992
46129
|
throw: false
|
|
45993
|
-
})) : undefined,
|
|
45994
|
-
vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () => bunBuild7({
|
|
46130
|
+
}, resolveBunBuildOverride(bunBuildConfig, "globalCss")))) : undefined,
|
|
46131
|
+
vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () => bunBuild7(mergeBunBuildConfig({
|
|
45995
46132
|
entrypoints: vueCssPaths,
|
|
45996
46133
|
naming: `[name].[hash].[ext]`,
|
|
45997
46134
|
outdir: join20(buildPath, assetsPath ? basename7(assetsPath) : "assets", "css"),
|
|
45998
46135
|
target: "browser",
|
|
45999
46136
|
throw: false
|
|
46000
|
-
})) : undefined
|
|
46137
|
+
}, resolveBunBuildOverride(bunBuildConfig, "vueCss")))) : undefined
|
|
46001
46138
|
]);
|
|
46002
46139
|
const serverLogs = serverResult?.logs ?? [];
|
|
46003
46140
|
const serverOutputs = serverResult?.outputs ?? [];
|
|
@@ -46281,6 +46418,25 @@ var init_build = __esm(() => {
|
|
|
46281
46418
|
__VUE_PROD_DEVTOOLS__: isDev ? "true" : "false",
|
|
46282
46419
|
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: isDev ? "true" : "false"
|
|
46283
46420
|
};
|
|
46421
|
+
bunBuildPassKeys = [
|
|
46422
|
+
"server",
|
|
46423
|
+
"reactClient",
|
|
46424
|
+
"nonReactClient",
|
|
46425
|
+
"islandClient",
|
|
46426
|
+
"globalCss",
|
|
46427
|
+
"vueCss"
|
|
46428
|
+
];
|
|
46429
|
+
bunBuildPassKeySet = new Set(["default", ...bunBuildPassKeys]);
|
|
46430
|
+
reservedBunBuildConfigKeys = new Set([
|
|
46431
|
+
"entrypoints",
|
|
46432
|
+
"outdir",
|
|
46433
|
+
"outfile",
|
|
46434
|
+
"root",
|
|
46435
|
+
"target",
|
|
46436
|
+
"format",
|
|
46437
|
+
"throw",
|
|
46438
|
+
"compile"
|
|
46439
|
+
]);
|
|
46284
46440
|
});
|
|
46285
46441
|
|
|
46286
46442
|
// src/dev/dependencyGraph.ts
|
|
@@ -50215,5 +50371,5 @@ export {
|
|
|
50215
50371
|
build
|
|
50216
50372
|
};
|
|
50217
50373
|
|
|
50218
|
-
//# debugId=
|
|
50374
|
+
//# debugId=3403097BC857C88064756E2164756E21
|
|
50219
50375
|
//# sourceMappingURL=build.js.map
|