@absolutejs/absolute 0.19.0-beta.691 → 0.19.0-beta.692
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 +70 -77
- package/dist/angular/index.js.map +3 -3
- package/dist/angular/server.js +70 -77
- package/dist/angular/server.js.map +3 -3
- package/dist/build.js +108 -115
- package/dist/build.js.map +3 -3
- package/dist/index.js +122 -129
- package/dist/index.js.map +3 -3
- package/dist/islands/index.js +2 -30
- package/dist/islands/index.js.map +2 -2
- package/dist/react/index.js +2 -30
- package/dist/react/index.js.map +2 -2
- package/dist/svelte/index.js +4 -32
- package/dist/svelte/index.js.map +2 -2
- package/dist/svelte/server.js +2 -30
- package/dist/svelte/server.js.map +2 -2
- package/dist/vue/index.js +2 -30
- package/dist/vue/index.js.map +2 -2
- package/package.json +7 -7
package/dist/angular/index.js
CHANGED
|
@@ -1352,7 +1352,6 @@ var init_lowerAwaitSlotSyntax = __esm(() => {
|
|
|
1352
1352
|
});
|
|
1353
1353
|
|
|
1354
1354
|
// src/build/stylePreprocessor.ts
|
|
1355
|
-
import { readFileSync as readFileSync3 } from "fs";
|
|
1356
1355
|
import { readFile } from "fs/promises";
|
|
1357
1356
|
import { createRequire } from "module";
|
|
1358
1357
|
import { dirname as dirname2, extname, join as join3 } from "path";
|
|
@@ -1365,13 +1364,7 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
1365
1364
|
if (normalized === "less" || normalized.endsWith(".less"))
|
|
1366
1365
|
return "less";
|
|
1367
1366
|
return null;
|
|
1368
|
-
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`),
|
|
1369
|
-
try {
|
|
1370
|
-
return requireFromCwd(specifier);
|
|
1371
|
-
} catch {
|
|
1372
|
-
return requireOptionalPeer(specifier);
|
|
1373
|
-
}
|
|
1374
|
-
}, compileStyleSource = async (filePath, source, languageHint) => {
|
|
1367
|
+
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`), compileStyleSource = async (filePath, source, languageHint) => {
|
|
1375
1368
|
const language = getStyleLanguage(languageHint ?? filePath);
|
|
1376
1369
|
const contents = source ?? await readFile(filePath, "utf-8");
|
|
1377
1370
|
if (language === "scss" || language === "sass") {
|
|
@@ -1426,27 +1419,6 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
1426
1419
|
return readFile(filePath, "utf-8");
|
|
1427
1420
|
}
|
|
1428
1421
|
return compileStyleSource(filePath);
|
|
1429
|
-
}, compileStyleFileIfNeededSync = (filePath) => {
|
|
1430
|
-
const contents = readFileSync3(filePath, "utf-8");
|
|
1431
|
-
const language = getStyleLanguage(filePath);
|
|
1432
|
-
if (language === "scss" || language === "sass") {
|
|
1433
|
-
let sass;
|
|
1434
|
-
try {
|
|
1435
|
-
sass = requireOptionalPeerSync("sass");
|
|
1436
|
-
} catch {
|
|
1437
|
-
throw missingDependencyError("sass", filePath);
|
|
1438
|
-
}
|
|
1439
|
-
return sass.compileString(contents, {
|
|
1440
|
-
loadPaths: [dirname2(filePath), process.cwd()],
|
|
1441
|
-
style: "expanded",
|
|
1442
|
-
syntax: language === "sass" ? "indented" : "scss",
|
|
1443
|
-
url: new URL(`file://${filePath}`)
|
|
1444
|
-
}).css;
|
|
1445
|
-
}
|
|
1446
|
-
if (language === "less") {
|
|
1447
|
-
throw new Error(`Unable to compile ${filePath}: Less styleUrl preprocessing is async-only. Import the Less file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
|
|
1448
|
-
}
|
|
1449
|
-
return contents;
|
|
1450
1422
|
};
|
|
1451
1423
|
var init_stylePreprocessor = __esm(() => {
|
|
1452
1424
|
STYLE_EXTENSION_PATTERN = /\.(s[ac]ss|less)$/i;
|
|
@@ -3546,13 +3518,13 @@ __export(exports_compileAngular, {
|
|
|
3546
3518
|
compileAngularFile: () => compileAngularFile,
|
|
3547
3519
|
compileAngular: () => compileAngular
|
|
3548
3520
|
});
|
|
3549
|
-
import { existsSync as existsSync4, readFileSync as
|
|
3521
|
+
import { existsSync as existsSync4, readFileSync as readFileSync3, promises as fs } from "fs";
|
|
3550
3522
|
import { join as join5, basename as basename3, sep, dirname as dirname4, resolve as resolve5, relative as relative2 } from "path";
|
|
3551
3523
|
import ts from "typescript";
|
|
3552
3524
|
import { createHash } from "crypto";
|
|
3553
3525
|
var computeConfigHash = () => {
|
|
3554
3526
|
try {
|
|
3555
|
-
const content =
|
|
3527
|
+
const content = readFileSync3("./tsconfig.json", "utf-8");
|
|
3556
3528
|
return createHash("md5").update(content).digest("hex");
|
|
3557
3529
|
} catch {
|
|
3558
3530
|
return "";
|
|
@@ -3609,8 +3581,70 @@ ${registrations}
|
|
|
3609
3581
|
if (fileName.startsWith(outDir))
|
|
3610
3582
|
return fileName.substring(outDir.length + 1);
|
|
3611
3583
|
return fileName;
|
|
3584
|
+
}, isRelativeModuleSpecifier = (specifier) => specifier.startsWith("./") || specifier.startsWith("../"), extractLocalImportSpecifiers = (source, fileName) => {
|
|
3585
|
+
const sourceFile = ts.createSourceFile(fileName, source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
3586
|
+
const specifiers = [];
|
|
3587
|
+
const addSpecifier = (node) => {
|
|
3588
|
+
if (!node || !ts.isStringLiteralLike(node))
|
|
3589
|
+
return;
|
|
3590
|
+
const specifier = node.text;
|
|
3591
|
+
if (isRelativeModuleSpecifier(specifier))
|
|
3592
|
+
specifiers.push(specifier);
|
|
3593
|
+
};
|
|
3594
|
+
const visit = (node) => {
|
|
3595
|
+
if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) {
|
|
3596
|
+
addSpecifier(node.moduleSpecifier);
|
|
3597
|
+
} else if (ts.isCallExpression(node) && node.expression.kind === ts.SyntaxKind.ImportKeyword) {
|
|
3598
|
+
addSpecifier(node.arguments[0]);
|
|
3599
|
+
}
|
|
3600
|
+
ts.forEachChild(node, visit);
|
|
3601
|
+
};
|
|
3602
|
+
visit(sourceFile);
|
|
3603
|
+
return specifiers;
|
|
3604
|
+
}, resolveLocalTsImport = (fromFile, specifier) => {
|
|
3605
|
+
if (!isRelativeModuleSpecifier(specifier))
|
|
3606
|
+
return null;
|
|
3607
|
+
const basePath = resolve5(dirname4(fromFile), specifier);
|
|
3608
|
+
const candidates = /\.[cm]?[tj]sx?$/.test(basePath) ? [basePath] : [
|
|
3609
|
+
`${basePath}.ts`,
|
|
3610
|
+
`${basePath}.tsx`,
|
|
3611
|
+
`${basePath}.mts`,
|
|
3612
|
+
`${basePath}.cts`,
|
|
3613
|
+
join5(basePath, "index.ts"),
|
|
3614
|
+
join5(basePath, "index.tsx"),
|
|
3615
|
+
join5(basePath, "index.mts"),
|
|
3616
|
+
join5(basePath, "index.cts")
|
|
3617
|
+
];
|
|
3618
|
+
return candidates.map((candidate) => resolve5(candidate)).find((candidate) => existsSync4(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
3619
|
+
}, readFileForAotTransform = async (fileName, readFile2) => {
|
|
3620
|
+
const hostSource = readFile2?.(fileName);
|
|
3621
|
+
if (typeof hostSource === "string")
|
|
3622
|
+
return hostSource;
|
|
3623
|
+
return fs.readFile(fileName, "utf-8");
|
|
3624
|
+
}, precomputeAotResourceTransforms = async (inputPath, readFile2) => {
|
|
3625
|
+
const transformedSources = new Map;
|
|
3626
|
+
const visited = new Set;
|
|
3627
|
+
const transformFile = async (filePath) => {
|
|
3628
|
+
const resolvedPath = resolve5(filePath);
|
|
3629
|
+
if (visited.has(resolvedPath))
|
|
3630
|
+
return;
|
|
3631
|
+
visited.add(resolvedPath);
|
|
3632
|
+
if (!existsSync4(resolvedPath) || resolvedPath.endsWith(".d.ts"))
|
|
3633
|
+
return;
|
|
3634
|
+
const source = await readFileForAotTransform(resolvedPath, readFile2);
|
|
3635
|
+
const transformed = await inlineResources(source, dirname4(resolvedPath));
|
|
3636
|
+
transformedSources.set(resolvedPath, transformed.source);
|
|
3637
|
+
const imports = extractLocalImportSpecifiers(source, resolvedPath);
|
|
3638
|
+
await Promise.all(imports.map(async (specifier) => {
|
|
3639
|
+
const resolvedImport = resolveLocalTsImport(resolvedPath, specifier);
|
|
3640
|
+
if (resolvedImport)
|
|
3641
|
+
await transformFile(resolvedImport);
|
|
3642
|
+
}));
|
|
3643
|
+
};
|
|
3644
|
+
await transformFile(inputPath);
|
|
3645
|
+
return transformedSources;
|
|
3612
3646
|
}, compileAngularFile = async (inputPath, outDir) => {
|
|
3613
|
-
const islandMetadataExports = buildIslandMetadataExports(
|
|
3647
|
+
const islandMetadataExports = buildIslandMetadataExports(readFileSync3(inputPath, "utf-8"));
|
|
3614
3648
|
const { readConfiguration, performCompilation, EmitFlags } = await import("@angular/compiler-cli");
|
|
3615
3649
|
const configHash = computeConfigHash();
|
|
3616
3650
|
const cached = globalThis.__angularCompilerCache;
|
|
@@ -3678,7 +3712,7 @@ ${registrations}
|
|
|
3678
3712
|
emitted[relativePath] = text;
|
|
3679
3713
|
};
|
|
3680
3714
|
const originalReadFile = host.readFile;
|
|
3681
|
-
const
|
|
3715
|
+
const aotTransformedSources = await precomputeAotResourceTransforms(inputPath, originalReadFile?.bind(host));
|
|
3682
3716
|
host.readFile = (fileName) => {
|
|
3683
3717
|
const source = originalReadFile ? originalReadFile.call(host, fileName) : undefined;
|
|
3684
3718
|
if (typeof source !== "string")
|
|
@@ -3687,12 +3721,7 @@ ${registrations}
|
|
|
3687
3721
|
return source;
|
|
3688
3722
|
}
|
|
3689
3723
|
const resolvedPath = resolve5(fileName);
|
|
3690
|
-
|
|
3691
|
-
if (cached2 !== undefined)
|
|
3692
|
-
return cached2;
|
|
3693
|
-
const transformed = inlineResourcesSync(source, dirname4(resolvedPath)).source;
|
|
3694
|
-
aotTransformCache.set(resolvedPath, transformed);
|
|
3695
|
-
return transformed;
|
|
3724
|
+
return aotTransformedSources.get(resolvedPath) ?? source;
|
|
3696
3725
|
};
|
|
3697
3726
|
const originalGetSourceFileForCompile = host.getSourceFile;
|
|
3698
3727
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
@@ -3907,7 +3936,7 @@ ${fields}
|
|
|
3907
3936
|
if (!existsSync4(templatePath)) {
|
|
3908
3937
|
return { deferSlots: [], source };
|
|
3909
3938
|
}
|
|
3910
|
-
const templateRaw2 =
|
|
3939
|
+
const templateRaw2 = readFileSync3(templatePath, "utf-8");
|
|
3911
3940
|
const lowered2 = lowerAngularDeferSyntax(templateRaw2);
|
|
3912
3941
|
const escaped2 = escapeTemplateContent(lowered2.template);
|
|
3913
3942
|
const replacedSource2 = source.replace(/templateUrl\s*:\s*['"][^'"]+['"]/, `template: \`${escaped2}\``);
|
|
@@ -3931,42 +3960,6 @@ ${fields}
|
|
|
3931
3960
|
deferSlots: lowered.slots,
|
|
3932
3961
|
source: injectDeferSlotFields(replacedSource, lowered.slots, resolveAngularDeferImportSpecifier())
|
|
3933
3962
|
};
|
|
3934
|
-
}, readAndEscapeFileSync = (filePath) => {
|
|
3935
|
-
if (!existsSync4(filePath))
|
|
3936
|
-
return null;
|
|
3937
|
-
const content = compileStyleFileIfNeededSync(filePath);
|
|
3938
|
-
return escapeTemplateContent(content);
|
|
3939
|
-
}, inlineStyleUrlsSync = (source, fileDir) => {
|
|
3940
|
-
const styleUrlsMatch = source.match(/styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
3941
|
-
if (!styleUrlsMatch?.[1])
|
|
3942
|
-
return source;
|
|
3943
|
-
const urlMatches = styleUrlsMatch[1].match(/['"]([^'"]+)['"]/g);
|
|
3944
|
-
if (!urlMatches)
|
|
3945
|
-
return source;
|
|
3946
|
-
const inlinedStyles = urlMatches.map((urlMatch) => {
|
|
3947
|
-
const styleUrl = urlMatch.replace(/['"]/g, "");
|
|
3948
|
-
return readAndEscapeFileSync(join5(fileDir, styleUrl));
|
|
3949
|
-
}).filter(Boolean).map((escaped) => `\`${escaped}\``);
|
|
3950
|
-
if (inlinedStyles.length === 0)
|
|
3951
|
-
return source;
|
|
3952
|
-
return source.replace(/styleUrls\s*:\s*\[[^\]]+\]/, `styles: [${inlinedStyles.join(", ")}]`);
|
|
3953
|
-
}, inlineSingleStyleUrlSync = (source, fileDir) => {
|
|
3954
|
-
const styleUrlMatch = source.match(/styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
3955
|
-
if (!styleUrlMatch?.[1])
|
|
3956
|
-
return source;
|
|
3957
|
-
const escaped = readAndEscapeFileSync(join5(fileDir, styleUrlMatch[1]));
|
|
3958
|
-
if (!escaped)
|
|
3959
|
-
return source;
|
|
3960
|
-
return source.replace(/styleUrl\s*:\s*['"][^'"]+['"]/, `styles: [\`${escaped}\`]`);
|
|
3961
|
-
}, inlineResourcesSync = (source, fileDir) => {
|
|
3962
|
-
const inlinedTemplate = inlineTemplateAndLowerDeferSync(source, fileDir);
|
|
3963
|
-
let result = inlinedTemplate.source;
|
|
3964
|
-
result = inlineStyleUrlsSync(result, fileDir);
|
|
3965
|
-
result = inlineSingleStyleUrlSync(result, fileDir);
|
|
3966
|
-
return {
|
|
3967
|
-
deferSlots: inlinedTemplate.deferSlots,
|
|
3968
|
-
source: result
|
|
3969
|
-
};
|
|
3970
3963
|
}, inlineStyleUrls = async (source, fileDir) => {
|
|
3971
3964
|
const styleUrlsMatch = source.match(/styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
3972
3965
|
if (!styleUrlsMatch?.[1])
|
|
@@ -13729,5 +13722,5 @@ export {
|
|
|
13729
13722
|
Island
|
|
13730
13723
|
};
|
|
13731
13724
|
|
|
13732
|
-
//# debugId=
|
|
13725
|
+
//# debugId=F6C2AE0EB325322564756E2164756E21
|
|
13733
13726
|
//# sourceMappingURL=index.js.map
|