@absolutejs/absolute 0.19.0-beta.697 → 0.19.0-beta.699
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/browser.js.map +1 -1
- package/dist/angular/index.js +96 -16
- package/dist/angular/index.js.map +3 -3
- package/dist/angular/server.js +96 -16
- package/dist/angular/server.js.map +3 -3
- package/dist/build.js +96 -16
- package/dist/build.js.map +3 -3
- package/dist/index.js +97 -17
- package/dist/index.js.map +4 -4
- package/dist/src/angular/components/defer-slot.component.d.ts +1 -1
- package/dist/src/core/prepare.d.ts +18 -0
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -43512,6 +43512,37 @@ var computeConfigHash = () => {
|
|
|
43512
43512
|
} catch {
|
|
43513
43513
|
return "";
|
|
43514
43514
|
}
|
|
43515
|
+
}, readTsconfigPathAliases = () => {
|
|
43516
|
+
try {
|
|
43517
|
+
const configPath2 = resolve19(process.cwd(), "tsconfig.json");
|
|
43518
|
+
const config = ts2.readConfigFile(configPath2, ts2.sys.readFile).config;
|
|
43519
|
+
const compilerOptions = config?.compilerOptions ?? {};
|
|
43520
|
+
const baseUrl = resolve19(process.cwd(), compilerOptions.baseUrl ?? ".");
|
|
43521
|
+
const aliases = Object.entries(compilerOptions.paths ?? {}).map(([pattern, replacements]) => ({ pattern, replacements }));
|
|
43522
|
+
return { aliases, baseUrl };
|
|
43523
|
+
} catch {
|
|
43524
|
+
return { aliases: [], baseUrl: process.cwd() };
|
|
43525
|
+
}
|
|
43526
|
+
}, matchTsconfigAlias = (specifier, aliases, baseUrl, resolveSourceFile) => {
|
|
43527
|
+
for (const alias of aliases) {
|
|
43528
|
+
const wildcardIndex = alias.pattern.indexOf("*");
|
|
43529
|
+
const exactMatch = wildcardIndex === -1;
|
|
43530
|
+
if (exactMatch && specifier !== alias.pattern)
|
|
43531
|
+
continue;
|
|
43532
|
+
const prefix = exactMatch ? alias.pattern : alias.pattern.slice(0, wildcardIndex);
|
|
43533
|
+
const suffix = exactMatch ? "" : alias.pattern.slice(wildcardIndex + 1);
|
|
43534
|
+
if (!exactMatch && (!specifier.startsWith(prefix) || !specifier.endsWith(suffix))) {
|
|
43535
|
+
continue;
|
|
43536
|
+
}
|
|
43537
|
+
const wildcardValue = exactMatch ? "" : specifier.slice(prefix.length, specifier.length - suffix.length);
|
|
43538
|
+
for (const replacement of alias.replacements) {
|
|
43539
|
+
const candidate = replacement.replace("*", wildcardValue);
|
|
43540
|
+
const resolved = resolveSourceFile(resolve19(baseUrl, candidate));
|
|
43541
|
+
if (resolved)
|
|
43542
|
+
return resolved;
|
|
43543
|
+
}
|
|
43544
|
+
}
|
|
43545
|
+
return;
|
|
43515
43546
|
}, resolveDevClientDir4 = () => {
|
|
43516
43547
|
const projectRoot = process.cwd();
|
|
43517
43548
|
const fromSource = resolve19(import.meta.dir, "../dev/client");
|
|
@@ -43877,8 +43908,9 @@ ${slot.resolvedBindings.map((binding) => ` "${binding.key}": this.__absoluteDef
|
|
|
43877
43908
|
${fields}
|
|
43878
43909
|
`);
|
|
43879
43910
|
}, readAndEscapeFile = async (filePath, stylePreprocessors) => {
|
|
43880
|
-
if (!existsSync16(filePath))
|
|
43881
|
-
|
|
43911
|
+
if (!existsSync16(filePath)) {
|
|
43912
|
+
throw new Error(`Unable to inline Angular style resource: file not found at ${filePath}`);
|
|
43913
|
+
}
|
|
43882
43914
|
const content = await compileStyleFileIfNeeded(filePath, stylePreprocessors);
|
|
43883
43915
|
return escapeTemplateContent(content);
|
|
43884
43916
|
}, inlineTemplateAndLowerDefer = async (source, fileDir) => {
|
|
@@ -43886,7 +43918,7 @@ ${fields}
|
|
|
43886
43918
|
if (templateUrlMatch?.[1]) {
|
|
43887
43919
|
const templatePath = join15(fileDir, templateUrlMatch[1]);
|
|
43888
43920
|
if (!existsSync16(templatePath)) {
|
|
43889
|
-
|
|
43921
|
+
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
43890
43922
|
}
|
|
43891
43923
|
const templateRaw2 = await fs2.readFile(templatePath, "utf-8");
|
|
43892
43924
|
const lowered2 = lowerAngularDeferSyntax(templateRaw2);
|
|
@@ -43917,7 +43949,7 @@ ${fields}
|
|
|
43917
43949
|
if (templateUrlMatch?.[1]) {
|
|
43918
43950
|
const templatePath = join15(fileDir, templateUrlMatch[1]);
|
|
43919
43951
|
if (!existsSync16(templatePath)) {
|
|
43920
|
-
|
|
43952
|
+
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
43921
43953
|
}
|
|
43922
43954
|
const templateRaw2 = readFileSync10(templatePath, "utf-8");
|
|
43923
43955
|
const lowered2 = lowerAngularDeferSyntax(templateRaw2);
|
|
@@ -43990,9 +44022,52 @@ ${fields}
|
|
|
43990
44022
|
}
|
|
43991
44023
|
})
|
|
43992
44024
|
});
|
|
43993
|
-
const
|
|
44025
|
+
const tsconfigAliases = readTsconfigPathAliases();
|
|
44026
|
+
const resolveSourceFile = (candidate) => {
|
|
44027
|
+
const candidates = candidate.match(/\.[cm]?[tj]sx?$/) ? [candidate] : [
|
|
44028
|
+
`${candidate}.ts`,
|
|
44029
|
+
`${candidate}.tsx`,
|
|
44030
|
+
`${candidate}.js`,
|
|
44031
|
+
`${candidate}.jsx`,
|
|
44032
|
+
join15(candidate, "index.ts"),
|
|
44033
|
+
join15(candidate, "index.tsx"),
|
|
44034
|
+
join15(candidate, "index.js"),
|
|
44035
|
+
join15(candidate, "index.jsx")
|
|
44036
|
+
];
|
|
44037
|
+
return candidates.find((file4) => existsSync16(file4));
|
|
44038
|
+
};
|
|
44039
|
+
const resolveLocalImport = (specifier, fromDir) => {
|
|
44040
|
+
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
44041
|
+
return resolveSourceFile(resolve19(fromDir, specifier));
|
|
44042
|
+
}
|
|
44043
|
+
const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile);
|
|
44044
|
+
if (aliased)
|
|
44045
|
+
return aliased;
|
|
44046
|
+
try {
|
|
44047
|
+
const resolved = Bun.resolveSync(specifier, fromDir);
|
|
44048
|
+
if (resolved.includes("/node_modules/"))
|
|
44049
|
+
return;
|
|
44050
|
+
const absolute = resolve19(resolved);
|
|
44051
|
+
if (!absolute.startsWith(baseDir))
|
|
44052
|
+
return;
|
|
44053
|
+
return resolveSourceFile(absolute);
|
|
44054
|
+
} catch {
|
|
44055
|
+
return;
|
|
44056
|
+
}
|
|
44057
|
+
};
|
|
44058
|
+
const toOutputPath = (sourcePath) => {
|
|
44059
|
+
const inputDir = dirname11(sourcePath);
|
|
44060
|
+
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
44061
|
+
const fileBase = basename7(sourcePath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
44062
|
+
return join15(outDir, relativeDir, fileBase);
|
|
44063
|
+
};
|
|
44064
|
+
const transpileAndRewrite = (sourceCode, relativeDir, actualPath, importRewrites) => {
|
|
43994
44065
|
let processedContent = angularTranspiler.transformSync(sourceCode);
|
|
43995
44066
|
const rewriteBareImport = (prefix, specifier, suffix) => {
|
|
44067
|
+
const rewritten = importRewrites.get(specifier);
|
|
44068
|
+
if (rewritten) {
|
|
44069
|
+
return `${prefix}${rewritten}${suffix}`;
|
|
44070
|
+
}
|
|
43996
44071
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
43997
44072
|
return `${prefix}${specifier}${suffix}`;
|
|
43998
44073
|
}
|
|
@@ -44037,12 +44112,13 @@ ${fields}
|
|
|
44037
44112
|
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname11(actualPath)).source;
|
|
44038
44113
|
const inputDir = dirname11(actualPath);
|
|
44039
44114
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
44040
|
-
const fileBase = basename7(actualPath).replace(/\.
|
|
44115
|
+
const fileBase = basename7(actualPath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
44041
44116
|
const targetDir = join15(outDir, relativeDir);
|
|
44042
|
-
const targetPath =
|
|
44117
|
+
const targetPath = toOutputPath(actualPath);
|
|
44043
44118
|
const localImports = [];
|
|
44044
|
-
const
|
|
44045
|
-
const
|
|
44119
|
+
const importRewrites = new Map;
|
|
44120
|
+
const fromRegex = /(?:from|import)\s+['"]([^'".][^'"]*|\.\.?\/[^'"]+)['"]/g;
|
|
44121
|
+
const dynamicImportRegex = /import\(\s*['"]([^'".][^'"]*|\.\.?\/[^'"]+)['"]\s*\)/g;
|
|
44046
44122
|
let importMatch;
|
|
44047
44123
|
while ((importMatch = fromRegex.exec(sourceCode)) !== null) {
|
|
44048
44124
|
if (importMatch[1])
|
|
@@ -44052,22 +44128,26 @@ ${fields}
|
|
|
44052
44128
|
if (importMatch[1])
|
|
44053
44129
|
localImports.push(importMatch[1]);
|
|
44054
44130
|
}
|
|
44131
|
+
const localImportPaths = localImports.map((specifier) => {
|
|
44132
|
+
const resolved2 = resolveLocalImport(specifier, inputDir);
|
|
44133
|
+
if (!resolved2)
|
|
44134
|
+
return null;
|
|
44135
|
+
const relativeImport = relative9(targetDir, toOutputPath(resolved2)).replace(/\\/g, "/").replace(/\.js$/, "");
|
|
44136
|
+
importRewrites.set(specifier, relativeImport.startsWith(".") ? relativeImport : `./${relativeImport}`);
|
|
44137
|
+
return resolved2;
|
|
44138
|
+
}).filter((path2) => Boolean(path2));
|
|
44055
44139
|
const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
|
|
44056
44140
|
const cacheKey2 = actualPath;
|
|
44057
44141
|
if (jitContentCache.get(cacheKey2) === contentHash && existsSync16(targetPath)) {
|
|
44058
44142
|
allOutputs.push(targetPath);
|
|
44059
44143
|
} else {
|
|
44060
|
-
const processedContent = transpileAndRewrite(sourceCode, relativeDir, actualPath);
|
|
44144
|
+
const processedContent = transpileAndRewrite(sourceCode, relativeDir, actualPath, importRewrites);
|
|
44061
44145
|
await fs2.mkdir(targetDir, { recursive: true });
|
|
44062
44146
|
await fs2.writeFile(targetPath, processedContent, "utf-8");
|
|
44063
44147
|
allOutputs.push(targetPath);
|
|
44064
44148
|
jitContentCache.set(cacheKey2, contentHash);
|
|
44065
44149
|
}
|
|
44066
|
-
|
|
44067
|
-
await Promise.all(localImports.map((imp) => {
|
|
44068
|
-
const importPath = resolve19(inputDirForResolve, imp);
|
|
44069
|
-
return transpileFile(importPath);
|
|
44070
|
-
}));
|
|
44150
|
+
await Promise.all(localImportPaths.map((importPath) => transpileFile(importPath)));
|
|
44071
44151
|
};
|
|
44072
44152
|
await transpileFile(inputPath);
|
|
44073
44153
|
return allOutputs;
|
|
@@ -51036,7 +51116,7 @@ var createSitemapPlugin = (buildDir, sitemapConfig) => new Elysia5({ name: "abso
|
|
|
51036
51116
|
return;
|
|
51037
51117
|
Promise.resolve().then(() => (init_generateSitemap(), exports_generateSitemap)).then(({ generateSitemap: generateSitemap2 }) => generateSitemap2(started.routes, server.url.origin, buildDir, sitemapConfig)).catch((err) => console.error("[sitemap] Generation failed:", err));
|
|
51038
51118
|
});
|
|
51039
|
-
var createNotFoundPlugin = () => new Elysia5({ name: "absolutejs-not-found" }).onError(async ({ code }) => {
|
|
51119
|
+
var createNotFoundPlugin = () => new Elysia5({ name: "absolutejs-not-found" }).onError({ as: "global" }, async ({ code }) => {
|
|
51040
51120
|
if (code !== "NOT_FOUND")
|
|
51041
51121
|
return;
|
|
51042
51122
|
const response = await renderFirstNotFound();
|
|
@@ -57733,5 +57813,5 @@ export {
|
|
|
57733
57813
|
ANGULAR_INIT_TIMEOUT_MS
|
|
57734
57814
|
};
|
|
57735
57815
|
|
|
57736
|
-
//# debugId=
|
|
57816
|
+
//# debugId=DC45D0D20A29B90464756E2164756E21
|
|
57737
57817
|
//# sourceMappingURL=index.js.map
|