@absolutejs/absolute 0.19.0-beta.756 → 0.19.0-beta.757
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 +72 -78
- package/dist/angular/index.js.map +3 -3
- package/dist/angular/server.js +72 -78
- package/dist/angular/server.js.map +3 -3
- package/dist/build.js +72 -78
- package/dist/build.js.map +3 -3
- package/dist/index.js +72 -78
- package/dist/index.js.map +3 -3
- package/dist/src/build/compileAngular.d.ts +0 -13
- package/package.json +7 -7
package/dist/angular/index.js
CHANGED
|
@@ -3226,15 +3226,7 @@ __export(exports_compileAngular, {
|
|
|
3226
3226
|
import { existsSync as existsSync5, readFileSync as readFileSync4, promises as fs } from "fs";
|
|
3227
3227
|
import { join as join5, basename as basename3, sep, dirname as dirname4, resolve as resolve6, relative as relative3 } from "path";
|
|
3228
3228
|
import ts from "typescript";
|
|
3229
|
-
|
|
3230
|
-
var computeConfigHash = () => {
|
|
3231
|
-
try {
|
|
3232
|
-
const content = readFileSync4("./tsconfig.json", "utf-8");
|
|
3233
|
-
return createHash("md5").update(content).digest("hex");
|
|
3234
|
-
} catch {
|
|
3235
|
-
return "";
|
|
3236
|
-
}
|
|
3237
|
-
}, readTsconfigPathAliases = () => {
|
|
3229
|
+
var readTsconfigPathAliases = () => {
|
|
3238
3230
|
try {
|
|
3239
3231
|
const configPath = resolve6(process.cwd(), "tsconfig.json");
|
|
3240
3232
|
const config = ts.readConfigFile(configPath, ts.sys.readFile).config;
|
|
@@ -3385,6 +3377,21 @@ ${registrations}
|
|
|
3385
3377
|
if (fileName.startsWith(outDir))
|
|
3386
3378
|
return fileName.substring(outDir.length + 1);
|
|
3387
3379
|
return fileName;
|
|
3380
|
+
}, hasJsLikeExtension = (path) => /\.(js|ts|mjs|cjs)$/.test(path), rewriteRelativeJsSpecifier = (importerOutputPath, specifier, outputFiles) => {
|
|
3381
|
+
if (specifier.endsWith(".ts"))
|
|
3382
|
+
return specifier.replace(/\.ts$/, ".js");
|
|
3383
|
+
if (hasJsLikeExtension(specifier))
|
|
3384
|
+
return specifier;
|
|
3385
|
+
const importerDir = dirname4(importerOutputPath);
|
|
3386
|
+
const fileCandidate = resolve6(importerDir, `${specifier}.js`);
|
|
3387
|
+
if (outputFiles?.has(fileCandidate) || existsSync5(fileCandidate)) {
|
|
3388
|
+
return `${specifier}.js`;
|
|
3389
|
+
}
|
|
3390
|
+
const indexCandidate = resolve6(importerDir, specifier, "index.js");
|
|
3391
|
+
if (outputFiles?.has(indexCandidate) || existsSync5(indexCandidate)) {
|
|
3392
|
+
return `${specifier}/index.js`;
|
|
3393
|
+
}
|
|
3394
|
+
return `${specifier}.js`;
|
|
3388
3395
|
}, isRelativeModuleSpecifier = (specifier) => specifier.startsWith("./") || specifier.startsWith("../"), extractLocalImportSpecifiers = (source, fileName) => {
|
|
3389
3396
|
const sourceFile = ts.createSourceFile(fileName, source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
3390
3397
|
const specifiers = [];
|
|
@@ -3450,65 +3457,48 @@ ${registrations}
|
|
|
3450
3457
|
}, compileAngularFile = async (inputPath, outDir, stylePreprocessors) => {
|
|
3451
3458
|
const islandMetadataExports = buildIslandMetadataExports(readFileSync4(inputPath, "utf-8"));
|
|
3452
3459
|
const { readConfiguration, performCompilation, EmitFlags } = await import("@angular/compiler-cli");
|
|
3453
|
-
const
|
|
3454
|
-
const
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
options
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
};
|
|
3496
|
-
const originalGetSourceFile = host.getSourceFile;
|
|
3497
|
-
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
3498
|
-
if (fileName.startsWith("lib.") && fileName.endsWith(".d.ts") && tsLibDir) {
|
|
3499
|
-
const resolvedPath = join5(tsLibDir, fileName);
|
|
3500
|
-
return originalGetSourceFile?.call(host, resolvedPath, languageVersion, onError);
|
|
3501
|
-
}
|
|
3502
|
-
return originalGetSourceFile?.call(host, fileName, languageVersion, onError);
|
|
3503
|
-
};
|
|
3504
|
-
globalThis.__angularCompilerCache = {
|
|
3505
|
-
configHash,
|
|
3506
|
-
host,
|
|
3507
|
-
lastUsed: Date.now(),
|
|
3508
|
-
options: { ...options },
|
|
3509
|
-
tsLibDir
|
|
3510
|
-
};
|
|
3511
|
-
}
|
|
3460
|
+
const tsPath = __require.resolve("typescript");
|
|
3461
|
+
const tsRootDir = dirname4(tsPath);
|
|
3462
|
+
const tsLibDir = tsRootDir.endsWith("lib") ? tsRootDir : resolve6(tsRootDir, "lib");
|
|
3463
|
+
const config = readConfiguration("./tsconfig.json");
|
|
3464
|
+
const options = {
|
|
3465
|
+
emitDecoratorMetadata: true,
|
|
3466
|
+
esModuleInterop: true,
|
|
3467
|
+
experimentalDecorators: true,
|
|
3468
|
+
module: ts.ModuleKind.ESNext,
|
|
3469
|
+
moduleResolution: ts.ModuleResolutionKind.Bundler,
|
|
3470
|
+
newLine: ts.NewLineKind.LineFeed,
|
|
3471
|
+
noLib: false,
|
|
3472
|
+
outDir,
|
|
3473
|
+
skipLibCheck: true,
|
|
3474
|
+
target: ts.ScriptTarget.ES2022,
|
|
3475
|
+
...config.options
|
|
3476
|
+
};
|
|
3477
|
+
options.target = ts.ScriptTarget.ES2022;
|
|
3478
|
+
options.experimentalDecorators = true;
|
|
3479
|
+
options.emitDecoratorMetadata = true;
|
|
3480
|
+
options.newLine = ts.NewLineKind.LineFeed;
|
|
3481
|
+
options.outDir = outDir;
|
|
3482
|
+
options.noEmit = false;
|
|
3483
|
+
options.incremental = false;
|
|
3484
|
+
options.tsBuildInfoFile = undefined;
|
|
3485
|
+
options.rootDir = process.cwd();
|
|
3486
|
+
const host = ts.createCompilerHost(options);
|
|
3487
|
+
const originalGetDefaultLibLocation = host.getDefaultLibLocation;
|
|
3488
|
+
host.getDefaultLibLocation = () => tsLibDir || (originalGetDefaultLibLocation ? originalGetDefaultLibLocation() : "");
|
|
3489
|
+
const originalGetDefaultLibFileName = host.getDefaultLibFileName;
|
|
3490
|
+
host.getDefaultLibFileName = (opts) => {
|
|
3491
|
+
const fileName = originalGetDefaultLibFileName ? originalGetDefaultLibFileName(opts) : "lib.d.ts";
|
|
3492
|
+
return basename3(fileName);
|
|
3493
|
+
};
|
|
3494
|
+
const originalGetSourceFile = host.getSourceFile;
|
|
3495
|
+
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
3496
|
+
if (fileName.startsWith("lib.") && fileName.endsWith(".d.ts") && tsLibDir) {
|
|
3497
|
+
const resolvedPath = join5(tsLibDir, fileName);
|
|
3498
|
+
return originalGetSourceFile?.call(host, resolvedPath, languageVersion, onError);
|
|
3499
|
+
}
|
|
3500
|
+
return originalGetSourceFile?.call(host, fileName, languageVersion, onError);
|
|
3501
|
+
};
|
|
3512
3502
|
const emitted = {};
|
|
3513
3503
|
const resolvedOutDir = resolve6(outDir);
|
|
3514
3504
|
host.writeFile = (fileName, text) => {
|
|
@@ -3548,11 +3538,16 @@ ${registrations}
|
|
|
3548
3538
|
host.getSourceFile = originalGetSourceFileForCompile;
|
|
3549
3539
|
}
|
|
3550
3540
|
throwOnCompilationErrors(diagnostics);
|
|
3551
|
-
const
|
|
3552
|
-
|
|
3541
|
+
const rawEntries = Object.entries(emitted).filter(([fileName]) => fileName.endsWith(".js")).map(([fileName, content]) => ({
|
|
3542
|
+
content,
|
|
3543
|
+
target: join5(outDir, fileName)
|
|
3544
|
+
}));
|
|
3545
|
+
const outputFiles = new Set(rawEntries.map(({ target }) => resolve6(target)));
|
|
3546
|
+
const entries = rawEntries.map(({ content, target }) => {
|
|
3553
3547
|
let processedContent = content.replace(/from\s+(['"])(\.\.?\/[^'"]+)(\1)/g, (match, quote, path) => {
|
|
3554
|
-
|
|
3555
|
-
|
|
3548
|
+
const rewritten = rewriteRelativeJsSpecifier(target, path, outputFiles);
|
|
3549
|
+
if (rewritten !== path) {
|
|
3550
|
+
return `from ${quote}${rewritten}${quote}`;
|
|
3556
3551
|
}
|
|
3557
3552
|
return match;
|
|
3558
3553
|
});
|
|
@@ -3865,6 +3860,7 @@ ${fields}
|
|
|
3865
3860
|
};
|
|
3866
3861
|
const transpileAndRewrite = (sourceCode, relativeDir, actualPath, importRewrites) => {
|
|
3867
3862
|
let processedContent = angularTranspiler.transformSync(sourceCode);
|
|
3863
|
+
const outputPath = toOutputPath(actualPath);
|
|
3868
3864
|
const rewriteBareImport = (prefix, specifier, suffix) => {
|
|
3869
3865
|
const rewritten = importRewrites.get(specifier);
|
|
3870
3866
|
if (rewritten) {
|
|
@@ -3879,11 +3875,9 @@ ${fields}
|
|
|
3879
3875
|
processedContent = processedContent.replace(/(import\s+['"])([^'"]+)(['"])/g, (_, prefix, specifier, suffix) => rewriteBareImport(prefix, specifier, suffix));
|
|
3880
3876
|
processedContent = processedContent.replace(/(import\(\s*['"])([^'"]+)(['"]\s*\))/g, (_, prefix, specifier, suffix) => rewriteBareImport(prefix, specifier, suffix));
|
|
3881
3877
|
processedContent = processedContent.replace(/from\s+(['"])(\.\.?\/[^'"]+)(\1)/g, (match, quote, path) => {
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
if (path.endsWith(".ts")) {
|
|
3886
|
-
return `from ${quote}${path.replace(/\.ts$/, ".js")}${quote}`;
|
|
3878
|
+
const rewritten = rewriteRelativeJsSpecifier(outputPath, path);
|
|
3879
|
+
if (rewritten !== path) {
|
|
3880
|
+
return `from ${quote}${rewritten}${quote}`;
|
|
3887
3881
|
}
|
|
3888
3882
|
return match;
|
|
3889
3883
|
});
|
|
@@ -14773,5 +14767,5 @@ export {
|
|
|
14773
14767
|
ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER
|
|
14774
14768
|
};
|
|
14775
14769
|
|
|
14776
|
-
//# debugId=
|
|
14770
|
+
//# debugId=272B12BE4516B59464756E2164756E21
|
|
14777
14771
|
//# sourceMappingURL=index.js.map
|