@absolutejs/absolute 0.19.0-beta.696 → 0.19.0-beta.698
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 +91 -12
- package/dist/angular/index.js.map +3 -3
- package/dist/angular/server.js +91 -12
- package/dist/angular/server.js.map +3 -3
- package/dist/build.js +92 -13
- package/dist/build.js.map +4 -4
- package/dist/cli/index.js +8 -1
- package/dist/index.js +92 -13
- package/dist/index.js.map +4 -4
- package/package.json +7 -7
package/dist/cli/index.js
CHANGED
|
@@ -1336,7 +1336,14 @@ var init_typecheck = __esm(() => {
|
|
|
1336
1336
|
"../**/dist/**/*",
|
|
1337
1337
|
"../**/generated/**/*"
|
|
1338
1338
|
];
|
|
1339
|
-
TYPECHECK_INCLUDE = [
|
|
1339
|
+
TYPECHECK_INCLUDE = [
|
|
1340
|
+
"../src/**/*",
|
|
1341
|
+
"../types/**/*",
|
|
1342
|
+
"../example/**/*",
|
|
1343
|
+
"../tests/**/*",
|
|
1344
|
+
"../test/**/*",
|
|
1345
|
+
"../scripts/**/*"
|
|
1346
|
+
];
|
|
1340
1347
|
});
|
|
1341
1348
|
|
|
1342
1349
|
// src/cli/scripts/dev.ts
|
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");
|
|
@@ -43990,9 +44021,52 @@ ${fields}
|
|
|
43990
44021
|
}
|
|
43991
44022
|
})
|
|
43992
44023
|
});
|
|
43993
|
-
const
|
|
44024
|
+
const tsconfigAliases = readTsconfigPathAliases();
|
|
44025
|
+
const resolveSourceFile = (candidate) => {
|
|
44026
|
+
const candidates = candidate.match(/\.[cm]?[tj]sx?$/) ? [candidate] : [
|
|
44027
|
+
`${candidate}.ts`,
|
|
44028
|
+
`${candidate}.tsx`,
|
|
44029
|
+
`${candidate}.js`,
|
|
44030
|
+
`${candidate}.jsx`,
|
|
44031
|
+
join15(candidate, "index.ts"),
|
|
44032
|
+
join15(candidate, "index.tsx"),
|
|
44033
|
+
join15(candidate, "index.js"),
|
|
44034
|
+
join15(candidate, "index.jsx")
|
|
44035
|
+
];
|
|
44036
|
+
return candidates.find((file4) => existsSync16(file4));
|
|
44037
|
+
};
|
|
44038
|
+
const resolveLocalImport = (specifier, fromDir) => {
|
|
44039
|
+
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
44040
|
+
return resolveSourceFile(resolve19(fromDir, specifier));
|
|
44041
|
+
}
|
|
44042
|
+
const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile);
|
|
44043
|
+
if (aliased)
|
|
44044
|
+
return aliased;
|
|
44045
|
+
try {
|
|
44046
|
+
const resolved = Bun.resolveSync(specifier, fromDir);
|
|
44047
|
+
if (resolved.includes("/node_modules/"))
|
|
44048
|
+
return;
|
|
44049
|
+
const absolute = resolve19(resolved);
|
|
44050
|
+
if (!absolute.startsWith(baseDir))
|
|
44051
|
+
return;
|
|
44052
|
+
return resolveSourceFile(absolute);
|
|
44053
|
+
} catch {
|
|
44054
|
+
return;
|
|
44055
|
+
}
|
|
44056
|
+
};
|
|
44057
|
+
const toOutputPath = (sourcePath) => {
|
|
44058
|
+
const inputDir = dirname11(sourcePath);
|
|
44059
|
+
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
44060
|
+
const fileBase = basename7(sourcePath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
44061
|
+
return join15(outDir, relativeDir, fileBase);
|
|
44062
|
+
};
|
|
44063
|
+
const transpileAndRewrite = (sourceCode, relativeDir, actualPath, importRewrites) => {
|
|
43994
44064
|
let processedContent = angularTranspiler.transformSync(sourceCode);
|
|
43995
44065
|
const rewriteBareImport = (prefix, specifier, suffix) => {
|
|
44066
|
+
const rewritten = importRewrites.get(specifier);
|
|
44067
|
+
if (rewritten) {
|
|
44068
|
+
return `${prefix}${rewritten}${suffix}`;
|
|
44069
|
+
}
|
|
43996
44070
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
43997
44071
|
return `${prefix}${specifier}${suffix}`;
|
|
43998
44072
|
}
|
|
@@ -44037,12 +44111,13 @@ ${fields}
|
|
|
44037
44111
|
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname11(actualPath)).source;
|
|
44038
44112
|
const inputDir = dirname11(actualPath);
|
|
44039
44113
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
44040
|
-
const fileBase = basename7(actualPath).replace(/\.
|
|
44114
|
+
const fileBase = basename7(actualPath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
44041
44115
|
const targetDir = join15(outDir, relativeDir);
|
|
44042
|
-
const targetPath =
|
|
44116
|
+
const targetPath = toOutputPath(actualPath);
|
|
44043
44117
|
const localImports = [];
|
|
44044
|
-
const
|
|
44045
|
-
const
|
|
44118
|
+
const importRewrites = new Map;
|
|
44119
|
+
const fromRegex = /(?:from|import)\s+['"]([^'".][^'"]*|\.\.?\/[^'"]+)['"]/g;
|
|
44120
|
+
const dynamicImportRegex = /import\(\s*['"]([^'".][^'"]*|\.\.?\/[^'"]+)['"]\s*\)/g;
|
|
44046
44121
|
let importMatch;
|
|
44047
44122
|
while ((importMatch = fromRegex.exec(sourceCode)) !== null) {
|
|
44048
44123
|
if (importMatch[1])
|
|
@@ -44052,22 +44127,26 @@ ${fields}
|
|
|
44052
44127
|
if (importMatch[1])
|
|
44053
44128
|
localImports.push(importMatch[1]);
|
|
44054
44129
|
}
|
|
44130
|
+
const localImportPaths = localImports.map((specifier) => {
|
|
44131
|
+
const resolved2 = resolveLocalImport(specifier, inputDir);
|
|
44132
|
+
if (!resolved2)
|
|
44133
|
+
return null;
|
|
44134
|
+
const relativeImport = relative9(targetDir, toOutputPath(resolved2)).replace(/\\/g, "/").replace(/\.js$/, "");
|
|
44135
|
+
importRewrites.set(specifier, relativeImport.startsWith(".") ? relativeImport : `./${relativeImport}`);
|
|
44136
|
+
return resolved2;
|
|
44137
|
+
}).filter((path2) => Boolean(path2));
|
|
44055
44138
|
const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
|
|
44056
44139
|
const cacheKey2 = actualPath;
|
|
44057
44140
|
if (jitContentCache.get(cacheKey2) === contentHash && existsSync16(targetPath)) {
|
|
44058
44141
|
allOutputs.push(targetPath);
|
|
44059
44142
|
} else {
|
|
44060
|
-
const processedContent = transpileAndRewrite(sourceCode, relativeDir, actualPath);
|
|
44143
|
+
const processedContent = transpileAndRewrite(sourceCode, relativeDir, actualPath, importRewrites);
|
|
44061
44144
|
await fs2.mkdir(targetDir, { recursive: true });
|
|
44062
44145
|
await fs2.writeFile(targetPath, processedContent, "utf-8");
|
|
44063
44146
|
allOutputs.push(targetPath);
|
|
44064
44147
|
jitContentCache.set(cacheKey2, contentHash);
|
|
44065
44148
|
}
|
|
44066
|
-
|
|
44067
|
-
await Promise.all(localImports.map((imp) => {
|
|
44068
|
-
const importPath = resolve19(inputDirForResolve, imp);
|
|
44069
|
-
return transpileFile(importPath);
|
|
44070
|
-
}));
|
|
44149
|
+
await Promise.all(localImportPaths.map((importPath) => transpileFile(importPath)));
|
|
44071
44150
|
};
|
|
44072
44151
|
await transpileFile(inputPath);
|
|
44073
44152
|
return allOutputs;
|
|
@@ -49016,7 +49095,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
49016
49095
|
} catch {
|
|
49017
49096
|
return false;
|
|
49018
49097
|
}
|
|
49019
|
-
}, isBareSpecifier = (spec) => !spec.startsWith(".") && !spec.startsWith("/") && !spec.startsWith("@src/"), FRAMEWORK_SPECIFIERS, isSkippedFile = (file4) => file4.includes("node_modules") || file4.includes("/build/") || file4.includes("/dist/") || file4.includes("/indexes/"), isDepSpecifier = (path2) => isBareSpecifier(path2) && !FRAMEWORK_SPECIFIERS.has(path2), readFileSpecifiers = async (file4, transpiler4) => {
|
|
49098
|
+
}, isBareSpecifier = (spec) => !spec.startsWith(".") && !spec.startsWith("/") && !spec.startsWith("@src/"), isAbsolutePackageSpecifier = (spec) => spec === "@absolutejs/absolute" || spec.startsWith("@absolutejs/absolute/"), FRAMEWORK_SPECIFIERS, isSkippedFile = (file4) => file4.includes("node_modules") || file4.includes("/build/") || file4.includes("/dist/") || file4.includes("/indexes/"), isDepSpecifier = (path2) => isBareSpecifier(path2) && !FRAMEWORK_SPECIFIERS.has(path2) && !isAbsolutePackageSpecifier(path2), readFileSpecifiers = async (file4, transpiler4) => {
|
|
49020
49099
|
const empty = [];
|
|
49021
49100
|
try {
|
|
49022
49101
|
const content = await Bun.file(file4).text();
|
|
@@ -57733,5 +57812,5 @@ export {
|
|
|
57733
57812
|
ANGULAR_INIT_TIMEOUT_MS
|
|
57734
57813
|
};
|
|
57735
57814
|
|
|
57736
|
-
//# debugId=
|
|
57815
|
+
//# debugId=E0B6115364277BC264756E2164756E21
|
|
57737
57816
|
//# sourceMappingURL=index.js.map
|