@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/build.js
CHANGED
|
@@ -43311,6 +43311,37 @@ var computeConfigHash = () => {
|
|
|
43311
43311
|
} catch {
|
|
43312
43312
|
return "";
|
|
43313
43313
|
}
|
|
43314
|
+
}, readTsconfigPathAliases = () => {
|
|
43315
|
+
try {
|
|
43316
|
+
const configPath2 = resolve16(process.cwd(), "tsconfig.json");
|
|
43317
|
+
const config = ts2.readConfigFile(configPath2, ts2.sys.readFile).config;
|
|
43318
|
+
const compilerOptions = config?.compilerOptions ?? {};
|
|
43319
|
+
const baseUrl = resolve16(process.cwd(), compilerOptions.baseUrl ?? ".");
|
|
43320
|
+
const aliases = Object.entries(compilerOptions.paths ?? {}).map(([pattern, replacements]) => ({ pattern, replacements }));
|
|
43321
|
+
return { aliases, baseUrl };
|
|
43322
|
+
} catch {
|
|
43323
|
+
return { aliases: [], baseUrl: process.cwd() };
|
|
43324
|
+
}
|
|
43325
|
+
}, matchTsconfigAlias = (specifier, aliases, baseUrl, resolveSourceFile) => {
|
|
43326
|
+
for (const alias of aliases) {
|
|
43327
|
+
const wildcardIndex = alias.pattern.indexOf("*");
|
|
43328
|
+
const exactMatch = wildcardIndex === -1;
|
|
43329
|
+
if (exactMatch && specifier !== alias.pattern)
|
|
43330
|
+
continue;
|
|
43331
|
+
const prefix = exactMatch ? alias.pattern : alias.pattern.slice(0, wildcardIndex);
|
|
43332
|
+
const suffix = exactMatch ? "" : alias.pattern.slice(wildcardIndex + 1);
|
|
43333
|
+
if (!exactMatch && (!specifier.startsWith(prefix) || !specifier.endsWith(suffix))) {
|
|
43334
|
+
continue;
|
|
43335
|
+
}
|
|
43336
|
+
const wildcardValue = exactMatch ? "" : specifier.slice(prefix.length, specifier.length - suffix.length);
|
|
43337
|
+
for (const replacement of alias.replacements) {
|
|
43338
|
+
const candidate = replacement.replace("*", wildcardValue);
|
|
43339
|
+
const resolved = resolveSourceFile(resolve16(baseUrl, candidate));
|
|
43340
|
+
if (resolved)
|
|
43341
|
+
return resolved;
|
|
43342
|
+
}
|
|
43343
|
+
}
|
|
43344
|
+
return;
|
|
43314
43345
|
}, resolveDevClientDir4 = () => {
|
|
43315
43346
|
const projectRoot = process.cwd();
|
|
43316
43347
|
const fromSource = resolve16(import.meta.dir, "../dev/client");
|
|
@@ -43676,8 +43707,9 @@ ${slot.resolvedBindings.map((binding) => ` "${binding.key}": this.__absoluteDef
|
|
|
43676
43707
|
${fields}
|
|
43677
43708
|
`);
|
|
43678
43709
|
}, readAndEscapeFile = async (filePath, stylePreprocessors) => {
|
|
43679
|
-
if (!existsSync16(filePath))
|
|
43680
|
-
|
|
43710
|
+
if (!existsSync16(filePath)) {
|
|
43711
|
+
throw new Error(`Unable to inline Angular style resource: file not found at ${filePath}`);
|
|
43712
|
+
}
|
|
43681
43713
|
const content = await compileStyleFileIfNeeded(filePath, stylePreprocessors);
|
|
43682
43714
|
return escapeTemplateContent(content);
|
|
43683
43715
|
}, inlineTemplateAndLowerDefer = async (source, fileDir) => {
|
|
@@ -43685,7 +43717,7 @@ ${fields}
|
|
|
43685
43717
|
if (templateUrlMatch?.[1]) {
|
|
43686
43718
|
const templatePath = join15(fileDir, templateUrlMatch[1]);
|
|
43687
43719
|
if (!existsSync16(templatePath)) {
|
|
43688
|
-
|
|
43720
|
+
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
43689
43721
|
}
|
|
43690
43722
|
const templateRaw2 = await fs2.readFile(templatePath, "utf-8");
|
|
43691
43723
|
const lowered2 = lowerAngularDeferSyntax(templateRaw2);
|
|
@@ -43716,7 +43748,7 @@ ${fields}
|
|
|
43716
43748
|
if (templateUrlMatch?.[1]) {
|
|
43717
43749
|
const templatePath = join15(fileDir, templateUrlMatch[1]);
|
|
43718
43750
|
if (!existsSync16(templatePath)) {
|
|
43719
|
-
|
|
43751
|
+
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
43720
43752
|
}
|
|
43721
43753
|
const templateRaw2 = readFileSync9(templatePath, "utf-8");
|
|
43722
43754
|
const lowered2 = lowerAngularDeferSyntax(templateRaw2);
|
|
@@ -43789,9 +43821,52 @@ ${fields}
|
|
|
43789
43821
|
}
|
|
43790
43822
|
})
|
|
43791
43823
|
});
|
|
43792
|
-
const
|
|
43824
|
+
const tsconfigAliases = readTsconfigPathAliases();
|
|
43825
|
+
const resolveSourceFile = (candidate) => {
|
|
43826
|
+
const candidates = candidate.match(/\.[cm]?[tj]sx?$/) ? [candidate] : [
|
|
43827
|
+
`${candidate}.ts`,
|
|
43828
|
+
`${candidate}.tsx`,
|
|
43829
|
+
`${candidate}.js`,
|
|
43830
|
+
`${candidate}.jsx`,
|
|
43831
|
+
join15(candidate, "index.ts"),
|
|
43832
|
+
join15(candidate, "index.tsx"),
|
|
43833
|
+
join15(candidate, "index.js"),
|
|
43834
|
+
join15(candidate, "index.jsx")
|
|
43835
|
+
];
|
|
43836
|
+
return candidates.find((file3) => existsSync16(file3));
|
|
43837
|
+
};
|
|
43838
|
+
const resolveLocalImport = (specifier, fromDir) => {
|
|
43839
|
+
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
43840
|
+
return resolveSourceFile(resolve16(fromDir, specifier));
|
|
43841
|
+
}
|
|
43842
|
+
const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile);
|
|
43843
|
+
if (aliased)
|
|
43844
|
+
return aliased;
|
|
43845
|
+
try {
|
|
43846
|
+
const resolved = Bun.resolveSync(specifier, fromDir);
|
|
43847
|
+
if (resolved.includes("/node_modules/"))
|
|
43848
|
+
return;
|
|
43849
|
+
const absolute = resolve16(resolved);
|
|
43850
|
+
if (!absolute.startsWith(baseDir))
|
|
43851
|
+
return;
|
|
43852
|
+
return resolveSourceFile(absolute);
|
|
43853
|
+
} catch {
|
|
43854
|
+
return;
|
|
43855
|
+
}
|
|
43856
|
+
};
|
|
43857
|
+
const toOutputPath = (sourcePath) => {
|
|
43858
|
+
const inputDir = dirname10(sourcePath);
|
|
43859
|
+
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
43860
|
+
const fileBase = basename6(sourcePath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
43861
|
+
return join15(outDir, relativeDir, fileBase);
|
|
43862
|
+
};
|
|
43863
|
+
const transpileAndRewrite = (sourceCode, relativeDir, actualPath, importRewrites) => {
|
|
43793
43864
|
let processedContent = angularTranspiler.transformSync(sourceCode);
|
|
43794
43865
|
const rewriteBareImport = (prefix, specifier, suffix) => {
|
|
43866
|
+
const rewritten = importRewrites.get(specifier);
|
|
43867
|
+
if (rewritten) {
|
|
43868
|
+
return `${prefix}${rewritten}${suffix}`;
|
|
43869
|
+
}
|
|
43795
43870
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
43796
43871
|
return `${prefix}${specifier}${suffix}`;
|
|
43797
43872
|
}
|
|
@@ -43836,12 +43911,13 @@ ${fields}
|
|
|
43836
43911
|
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname10(actualPath)).source;
|
|
43837
43912
|
const inputDir = dirname10(actualPath);
|
|
43838
43913
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
43839
|
-
const fileBase = basename6(actualPath).replace(/\.
|
|
43914
|
+
const fileBase = basename6(actualPath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
43840
43915
|
const targetDir = join15(outDir, relativeDir);
|
|
43841
|
-
const targetPath =
|
|
43916
|
+
const targetPath = toOutputPath(actualPath);
|
|
43842
43917
|
const localImports = [];
|
|
43843
|
-
const
|
|
43844
|
-
const
|
|
43918
|
+
const importRewrites = new Map;
|
|
43919
|
+
const fromRegex = /(?:from|import)\s+['"]([^'".][^'"]*|\.\.?\/[^'"]+)['"]/g;
|
|
43920
|
+
const dynamicImportRegex = /import\(\s*['"]([^'".][^'"]*|\.\.?\/[^'"]+)['"]\s*\)/g;
|
|
43845
43921
|
let importMatch;
|
|
43846
43922
|
while ((importMatch = fromRegex.exec(sourceCode)) !== null) {
|
|
43847
43923
|
if (importMatch[1])
|
|
@@ -43851,22 +43927,26 @@ ${fields}
|
|
|
43851
43927
|
if (importMatch[1])
|
|
43852
43928
|
localImports.push(importMatch[1]);
|
|
43853
43929
|
}
|
|
43930
|
+
const localImportPaths = localImports.map((specifier) => {
|
|
43931
|
+
const resolved2 = resolveLocalImport(specifier, inputDir);
|
|
43932
|
+
if (!resolved2)
|
|
43933
|
+
return null;
|
|
43934
|
+
const relativeImport = relative9(targetDir, toOutputPath(resolved2)).replace(/\\/g, "/").replace(/\.js$/, "");
|
|
43935
|
+
importRewrites.set(specifier, relativeImport.startsWith(".") ? relativeImport : `./${relativeImport}`);
|
|
43936
|
+
return resolved2;
|
|
43937
|
+
}).filter((path2) => Boolean(path2));
|
|
43854
43938
|
const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
|
|
43855
43939
|
const cacheKey2 = actualPath;
|
|
43856
43940
|
if (jitContentCache.get(cacheKey2) === contentHash && existsSync16(targetPath)) {
|
|
43857
43941
|
allOutputs.push(targetPath);
|
|
43858
43942
|
} else {
|
|
43859
|
-
const processedContent = transpileAndRewrite(sourceCode, relativeDir, actualPath);
|
|
43943
|
+
const processedContent = transpileAndRewrite(sourceCode, relativeDir, actualPath, importRewrites);
|
|
43860
43944
|
await fs2.mkdir(targetDir, { recursive: true });
|
|
43861
43945
|
await fs2.writeFile(targetPath, processedContent, "utf-8");
|
|
43862
43946
|
allOutputs.push(targetPath);
|
|
43863
43947
|
jitContentCache.set(cacheKey2, contentHash);
|
|
43864
43948
|
}
|
|
43865
|
-
|
|
43866
|
-
await Promise.all(localImports.map((imp) => {
|
|
43867
|
-
const importPath = resolve16(inputDirForResolve, imp);
|
|
43868
|
-
return transpileFile(importPath);
|
|
43869
|
-
}));
|
|
43949
|
+
await Promise.all(localImportPaths.map((importPath) => transpileFile(importPath)));
|
|
43870
43950
|
};
|
|
43871
43951
|
await transpileFile(inputPath);
|
|
43872
43952
|
return allOutputs;
|
|
@@ -49370,5 +49450,5 @@ export {
|
|
|
49370
49450
|
build
|
|
49371
49451
|
};
|
|
49372
49452
|
|
|
49373
|
-
//# debugId=
|
|
49453
|
+
//# debugId=0A7D6E8A4383D37264756E2164756E21
|
|
49374
49454
|
//# sourceMappingURL=build.js.map
|