@absolutejs/absolute 0.19.0-beta.692 → 0.19.0-beta.693
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 +122 -108
- package/dist/angular/index.js.map +4 -4
- package/dist/angular/server.js +104 -90
- package/dist/angular/server.js.map +4 -4
- package/dist/build.js +309 -284
- package/dist/build.js.map +9 -9
- package/dist/index.js +336 -310
- package/dist/index.js.map +10 -10
- package/dist/islands/index.js +64 -50
- package/dist/islands/index.js.map +3 -3
- package/dist/react/index.js +64 -50
- package/dist/react/index.js.map +3 -3
- package/dist/src/build/compileAngular.d.ts +4 -3
- package/dist/src/build/compileSvelte.d.ts +2 -1
- package/dist/src/build/compileVue.d.ts +2 -1
- package/dist/src/build/stylePreprocessor.d.ts +6 -4
- package/dist/src/core/build.d.ts +1 -1
- package/dist/src/dev/moduleServer.d.ts +2 -0
- package/dist/svelte/index.js +68 -54
- package/dist/svelte/index.js.map +3 -3
- package/dist/svelte/server.js +64 -50
- package/dist/svelte/server.js.map +3 -3
- package/dist/types/build.d.ts +28 -0
- package/dist/vue/index.js +64 -50
- package/dist/vue/index.js.map +3 -3
- package/package.json +7 -7
package/dist/angular/index.js
CHANGED
|
@@ -1354,7 +1354,7 @@ var init_lowerAwaitSlotSyntax = __esm(() => {
|
|
|
1354
1354
|
// src/build/stylePreprocessor.ts
|
|
1355
1355
|
import { readFile } from "fs/promises";
|
|
1356
1356
|
import { createRequire } from "module";
|
|
1357
|
-
import { dirname as dirname2, extname, join as join3 } from "path";
|
|
1357
|
+
import { dirname as dirname2, extname, join as join3, resolve as resolve4 } from "path";
|
|
1358
1358
|
var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATTERN, importOptionalPeer, requireOptionalPeer, requireFromCwd, isPreprocessableStylePath = (filePath) => STYLE_EXTENSION_PATTERN.test(filePath), isStyleModulePath = (filePath) => STYLE_MODULE_EXTENSION_PATTERN.test(filePath), isStylePath = (filePath) => /\.(css|s[ac]ss|less)$/i.test(filePath), getStyleBaseName = (filePath) => filePath.replace(/\.(css|s[ac]ss|less)$/i, ""), getStyleLanguage = (filePathOrLanguage) => {
|
|
1359
1359
|
const normalized = filePathOrLanguage.toLowerCase();
|
|
1360
1360
|
if (normalized === "scss" || normalized.endsWith(".scss"))
|
|
@@ -1364,18 +1364,29 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
1364
1364
|
if (normalized === "less" || normalized.endsWith(".less"))
|
|
1365
1365
|
return "less";
|
|
1366
1366
|
return null;
|
|
1367
|
-
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`),
|
|
1367
|
+
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`), normalizeLoadPaths = (filePath, paths = []) => [
|
|
1368
|
+
dirname2(filePath),
|
|
1369
|
+
process.cwd(),
|
|
1370
|
+
...paths.map((path) => resolve4(process.cwd(), path))
|
|
1371
|
+
], getSassOptions = (config, language) => ({
|
|
1372
|
+
...config?.sass ?? {},
|
|
1373
|
+
...language === "scss" ? config?.scss ?? {} : {}
|
|
1374
|
+
}), getLessOptions = (config) => config?.less ?? {}, withAdditionalData = (contents, additionalData) => additionalData ? `${additionalData}
|
|
1375
|
+
${contents}` : contents, compileStyleSource = async (filePath, source, languageHint, config) => {
|
|
1368
1376
|
const language = getStyleLanguage(languageHint ?? filePath);
|
|
1369
|
-
const
|
|
1377
|
+
const rawContents = source ?? await readFile(filePath, "utf-8");
|
|
1370
1378
|
if (language === "scss" || language === "sass") {
|
|
1379
|
+
const options = getSassOptions(config, language);
|
|
1380
|
+
const packageName = options.implementation ?? "sass";
|
|
1371
1381
|
let sass;
|
|
1372
1382
|
try {
|
|
1373
|
-
sass = await importOptionalPeer(
|
|
1383
|
+
sass = await importOptionalPeer(packageName);
|
|
1374
1384
|
} catch {
|
|
1375
|
-
throw missingDependencyError(
|
|
1385
|
+
throw missingDependencyError(packageName, filePath);
|
|
1376
1386
|
}
|
|
1387
|
+
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
1377
1388
|
const result = sass.compileString(contents, {
|
|
1378
|
-
loadPaths:
|
|
1389
|
+
loadPaths: normalizeLoadPaths(filePath, options.loadPaths),
|
|
1379
1390
|
style: "expanded",
|
|
1380
1391
|
syntax: language === "sass" ? "indented" : "scss",
|
|
1381
1392
|
url: new URL(`file://${filePath}`)
|
|
@@ -1383,6 +1394,7 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
1383
1394
|
return result.css;
|
|
1384
1395
|
}
|
|
1385
1396
|
if (language === "less") {
|
|
1397
|
+
const options = getLessOptions(config);
|
|
1386
1398
|
let lessModule;
|
|
1387
1399
|
try {
|
|
1388
1400
|
lessModule = await importOptionalPeer("less");
|
|
@@ -1393,14 +1405,49 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
1393
1405
|
const render = less?.render;
|
|
1394
1406
|
if (!render)
|
|
1395
1407
|
throw missingDependencyError("less", filePath);
|
|
1408
|
+
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
1396
1409
|
const result = await render(contents, {
|
|
1410
|
+
...options.options ?? {},
|
|
1397
1411
|
filename: filePath,
|
|
1398
|
-
paths:
|
|
1412
|
+
paths: normalizeLoadPaths(filePath, options.paths)
|
|
1399
1413
|
});
|
|
1400
1414
|
return result.css;
|
|
1401
1415
|
}
|
|
1402
|
-
return
|
|
1403
|
-
},
|
|
1416
|
+
return rawContents;
|
|
1417
|
+
}, createStylePreprocessorPlugin = (config) => ({
|
|
1418
|
+
name: "absolute-style-preprocessor",
|
|
1419
|
+
setup(build) {
|
|
1420
|
+
const cssModuleSources = new Map;
|
|
1421
|
+
build.onResolve({ filter: /^absolute-style-module:/ }, ({ path }) => ({
|
|
1422
|
+
namespace: "absolute-style-module",
|
|
1423
|
+
path: path.slice("absolute-style-module:".length)
|
|
1424
|
+
}));
|
|
1425
|
+
build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
|
|
1426
|
+
const sourcePath = cssModuleSources.get(path);
|
|
1427
|
+
if (!sourcePath) {
|
|
1428
|
+
throw new Error(`Unable to resolve CSS module source for ${path}`);
|
|
1429
|
+
}
|
|
1430
|
+
return {
|
|
1431
|
+
contents: await compileStyleSource(sourcePath, undefined, undefined, config),
|
|
1432
|
+
loader: "css"
|
|
1433
|
+
};
|
|
1434
|
+
});
|
|
1435
|
+
build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
|
|
1436
|
+
if (isStyleModulePath(path)) {
|
|
1437
|
+
const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
|
|
1438
|
+
cssModuleSources.set(cssModulePath, path);
|
|
1439
|
+
return {
|
|
1440
|
+
contents: `export { default } from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)};`,
|
|
1441
|
+
loader: "js"
|
|
1442
|
+
};
|
|
1443
|
+
}
|
|
1444
|
+
return {
|
|
1445
|
+
contents: await compileStyleSource(path, undefined, undefined, config),
|
|
1446
|
+
loader: "css"
|
|
1447
|
+
};
|
|
1448
|
+
});
|
|
1449
|
+
}
|
|
1450
|
+
}), stylePreprocessorPlugin, createSvelteStylePreprocessor = (config) => ({
|
|
1404
1451
|
style: async ({
|
|
1405
1452
|
attributes,
|
|
1406
1453
|
content,
|
|
@@ -1411,14 +1458,14 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
1411
1458
|
return;
|
|
1412
1459
|
const path = filename ?? `style.${language}`;
|
|
1413
1460
|
return {
|
|
1414
|
-
code: await compileStyleSource(path, content, language)
|
|
1461
|
+
code: await compileStyleSource(path, content, language, config)
|
|
1415
1462
|
};
|
|
1416
1463
|
}
|
|
1417
|
-
}), compileStyleFileIfNeeded = async (filePath) => {
|
|
1464
|
+
}), compileStyleFileIfNeeded = async (filePath, config) => {
|
|
1418
1465
|
if (!isPreprocessableStylePath(filePath)) {
|
|
1419
1466
|
return readFile(filePath, "utf-8");
|
|
1420
1467
|
}
|
|
1421
|
-
return compileStyleSource(filePath);
|
|
1468
|
+
return compileStyleSource(filePath, undefined, undefined, config);
|
|
1422
1469
|
};
|
|
1423
1470
|
var init_stylePreprocessor = __esm(() => {
|
|
1424
1471
|
STYLE_EXTENSION_PATTERN = /\.(s[ac]ss|less)$/i;
|
|
@@ -1427,45 +1474,12 @@ var init_stylePreprocessor = __esm(() => {
|
|
|
1427
1474
|
importOptionalPeer = new Function("specifier", "return import(specifier)");
|
|
1428
1475
|
requireOptionalPeer = new Function("specifier", "return require(specifier)");
|
|
1429
1476
|
requireFromCwd = createRequire(join3(process.cwd(), "package.json"));
|
|
1430
|
-
stylePreprocessorPlugin =
|
|
1431
|
-
name: "absolute-style-preprocessor",
|
|
1432
|
-
setup(build) {
|
|
1433
|
-
const cssModuleSources = new Map;
|
|
1434
|
-
build.onResolve({ filter: /^absolute-style-module:/ }, ({ path }) => ({
|
|
1435
|
-
namespace: "absolute-style-module",
|
|
1436
|
-
path: path.slice("absolute-style-module:".length)
|
|
1437
|
-
}));
|
|
1438
|
-
build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
|
|
1439
|
-
const sourcePath = cssModuleSources.get(path);
|
|
1440
|
-
if (!sourcePath) {
|
|
1441
|
-
throw new Error(`Unable to resolve CSS module source for ${path}`);
|
|
1442
|
-
}
|
|
1443
|
-
return {
|
|
1444
|
-
contents: await compileStyleSource(sourcePath),
|
|
1445
|
-
loader: "css"
|
|
1446
|
-
};
|
|
1447
|
-
});
|
|
1448
|
-
build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
|
|
1449
|
-
if (isStyleModulePath(path)) {
|
|
1450
|
-
const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
|
|
1451
|
-
cssModuleSources.set(cssModulePath, path);
|
|
1452
|
-
return {
|
|
1453
|
-
contents: `export { default } from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)};`,
|
|
1454
|
-
loader: "js"
|
|
1455
|
-
};
|
|
1456
|
-
}
|
|
1457
|
-
return {
|
|
1458
|
-
contents: await compileStyleSource(path),
|
|
1459
|
-
loader: "css"
|
|
1460
|
-
};
|
|
1461
|
-
});
|
|
1462
|
-
}
|
|
1463
|
-
};
|
|
1477
|
+
stylePreprocessorPlugin = createStylePreprocessorPlugin();
|
|
1464
1478
|
});
|
|
1465
1479
|
|
|
1466
1480
|
// src/core/svelteServerModule.ts
|
|
1467
1481
|
import { mkdir, readdir } from "fs/promises";
|
|
1468
|
-
import { basename as basename2, dirname as dirname3, extname as extname2, join as join4, relative, resolve as
|
|
1482
|
+
import { basename as basename2, dirname as dirname3, extname as extname2, join as join4, relative, resolve as resolve5 } from "path";
|
|
1469
1483
|
var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
|
|
1470
1484
|
const importPath = relative(dirname3(from), target).replace(/\\/g, "/");
|
|
1471
1485
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
@@ -1513,7 +1527,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
1513
1527
|
if (!spec.startsWith(".")) {
|
|
1514
1528
|
return null;
|
|
1515
1529
|
}
|
|
1516
|
-
const basePath =
|
|
1530
|
+
const basePath = resolve5(dirname3(from), spec);
|
|
1517
1531
|
const candidates = [
|
|
1518
1532
|
basePath,
|
|
1519
1533
|
`${basePath}.ts`,
|
|
@@ -1545,7 +1559,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
1545
1559
|
if (!spec.startsWith(".")) {
|
|
1546
1560
|
return null;
|
|
1547
1561
|
}
|
|
1548
|
-
const explicitPath =
|
|
1562
|
+
const explicitPath = resolve5(dirname3(from), spec);
|
|
1549
1563
|
if (extname2(explicitPath) === ".svelte") {
|
|
1550
1564
|
return explicitPath;
|
|
1551
1565
|
}
|
|
@@ -3519,7 +3533,7 @@ __export(exports_compileAngular, {
|
|
|
3519
3533
|
compileAngular: () => compileAngular
|
|
3520
3534
|
});
|
|
3521
3535
|
import { existsSync as existsSync4, readFileSync as readFileSync3, promises as fs } from "fs";
|
|
3522
|
-
import { join as join5, basename as basename3, sep, dirname as dirname4, resolve as
|
|
3536
|
+
import { join as join5, basename as basename3, sep, dirname as dirname4, resolve as resolve6, relative as relative2 } from "path";
|
|
3523
3537
|
import ts from "typescript";
|
|
3524
3538
|
import { createHash } from "crypto";
|
|
3525
3539
|
var computeConfigHash = () => {
|
|
@@ -3531,14 +3545,14 @@ var computeConfigHash = () => {
|
|
|
3531
3545
|
}
|
|
3532
3546
|
}, resolveDevClientDir = () => {
|
|
3533
3547
|
const projectRoot = process.cwd();
|
|
3534
|
-
const fromSource =
|
|
3548
|
+
const fromSource = resolve6(import.meta.dir, "../dev/client");
|
|
3535
3549
|
if (existsSync4(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
3536
3550
|
return fromSource;
|
|
3537
3551
|
}
|
|
3538
|
-
const fromNodeModules =
|
|
3552
|
+
const fromNodeModules = resolve6(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
3539
3553
|
if (existsSync4(fromNodeModules))
|
|
3540
3554
|
return fromNodeModules;
|
|
3541
|
-
return
|
|
3555
|
+
return resolve6(import.meta.dir, "./dev/client");
|
|
3542
3556
|
}, devClientDir, hmrClientPath, hmrRuntimePath, injectHMRRegistration = (content, sourceId) => {
|
|
3543
3557
|
const componentClassRegex = /(?:export\s+)?class\s+(\w+Component)\s/g;
|
|
3544
3558
|
const componentNames = [];
|
|
@@ -3604,7 +3618,7 @@ ${registrations}
|
|
|
3604
3618
|
}, resolveLocalTsImport = (fromFile, specifier) => {
|
|
3605
3619
|
if (!isRelativeModuleSpecifier(specifier))
|
|
3606
3620
|
return null;
|
|
3607
|
-
const basePath =
|
|
3621
|
+
const basePath = resolve6(dirname4(fromFile), specifier);
|
|
3608
3622
|
const candidates = /\.[cm]?[tj]sx?$/.test(basePath) ? [basePath] : [
|
|
3609
3623
|
`${basePath}.ts`,
|
|
3610
3624
|
`${basePath}.tsx`,
|
|
@@ -3615,24 +3629,24 @@ ${registrations}
|
|
|
3615
3629
|
join5(basePath, "index.mts"),
|
|
3616
3630
|
join5(basePath, "index.cts")
|
|
3617
3631
|
];
|
|
3618
|
-
return candidates.map((candidate) =>
|
|
3632
|
+
return candidates.map((candidate) => resolve6(candidate)).find((candidate) => existsSync4(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
3619
3633
|
}, readFileForAotTransform = async (fileName, readFile2) => {
|
|
3620
3634
|
const hostSource = readFile2?.(fileName);
|
|
3621
3635
|
if (typeof hostSource === "string")
|
|
3622
3636
|
return hostSource;
|
|
3623
3637
|
return fs.readFile(fileName, "utf-8");
|
|
3624
|
-
}, precomputeAotResourceTransforms = async (inputPath, readFile2) => {
|
|
3638
|
+
}, precomputeAotResourceTransforms = async (inputPath, readFile2, stylePreprocessors) => {
|
|
3625
3639
|
const transformedSources = new Map;
|
|
3626
3640
|
const visited = new Set;
|
|
3627
3641
|
const transformFile = async (filePath) => {
|
|
3628
|
-
const resolvedPath =
|
|
3642
|
+
const resolvedPath = resolve6(filePath);
|
|
3629
3643
|
if (visited.has(resolvedPath))
|
|
3630
3644
|
return;
|
|
3631
3645
|
visited.add(resolvedPath);
|
|
3632
3646
|
if (!existsSync4(resolvedPath) || resolvedPath.endsWith(".d.ts"))
|
|
3633
3647
|
return;
|
|
3634
3648
|
const source = await readFileForAotTransform(resolvedPath, readFile2);
|
|
3635
|
-
const transformed = await inlineResources(source, dirname4(resolvedPath));
|
|
3649
|
+
const transformed = await inlineResources(source, dirname4(resolvedPath), stylePreprocessors);
|
|
3636
3650
|
transformedSources.set(resolvedPath, transformed.source);
|
|
3637
3651
|
const imports = extractLocalImportSpecifiers(source, resolvedPath);
|
|
3638
3652
|
await Promise.all(imports.map(async (specifier) => {
|
|
@@ -3643,7 +3657,7 @@ ${registrations}
|
|
|
3643
3657
|
};
|
|
3644
3658
|
await transformFile(inputPath);
|
|
3645
3659
|
return transformedSources;
|
|
3646
|
-
}, compileAngularFile = async (inputPath, outDir) => {
|
|
3660
|
+
}, compileAngularFile = async (inputPath, outDir, stylePreprocessors) => {
|
|
3647
3661
|
const islandMetadataExports = buildIslandMetadataExports(readFileSync3(inputPath, "utf-8"));
|
|
3648
3662
|
const { readConfiguration, performCompilation, EmitFlags } = await import("@angular/compiler-cli");
|
|
3649
3663
|
const configHash = computeConfigHash();
|
|
@@ -3659,7 +3673,7 @@ ${registrations}
|
|
|
3659
3673
|
} else {
|
|
3660
3674
|
const tsPath = __require.resolve("typescript");
|
|
3661
3675
|
const tsRootDir = dirname4(tsPath);
|
|
3662
|
-
tsLibDir = tsRootDir.endsWith("lib") ? tsRootDir :
|
|
3676
|
+
tsLibDir = tsRootDir.endsWith("lib") ? tsRootDir : resolve6(tsRootDir, "lib");
|
|
3663
3677
|
const config = readConfiguration("./tsconfig.json");
|
|
3664
3678
|
options = {
|
|
3665
3679
|
emitDecoratorMetadata: true,
|
|
@@ -3706,13 +3720,13 @@ ${registrations}
|
|
|
3706
3720
|
};
|
|
3707
3721
|
}
|
|
3708
3722
|
const emitted = {};
|
|
3709
|
-
const resolvedOutDir =
|
|
3723
|
+
const resolvedOutDir = resolve6(outDir);
|
|
3710
3724
|
host.writeFile = (fileName, text) => {
|
|
3711
3725
|
const relativePath = resolveRelativePath(fileName, resolvedOutDir, outDir);
|
|
3712
3726
|
emitted[relativePath] = text;
|
|
3713
3727
|
};
|
|
3714
3728
|
const originalReadFile = host.readFile;
|
|
3715
|
-
const aotTransformedSources = await precomputeAotResourceTransforms(inputPath, originalReadFile?.bind(host));
|
|
3729
|
+
const aotTransformedSources = await precomputeAotResourceTransforms(inputPath, originalReadFile?.bind(host), stylePreprocessors);
|
|
3716
3730
|
host.readFile = (fileName) => {
|
|
3717
3731
|
const source = originalReadFile ? originalReadFile.call(host, fileName) : undefined;
|
|
3718
3732
|
if (typeof source !== "string")
|
|
@@ -3720,7 +3734,7 @@ ${registrations}
|
|
|
3720
3734
|
if (!fileName.endsWith(".ts") || fileName.endsWith(".d.ts")) {
|
|
3721
3735
|
return source;
|
|
3722
3736
|
}
|
|
3723
|
-
const resolvedPath =
|
|
3737
|
+
const resolvedPath = resolve6(fileName);
|
|
3724
3738
|
return aotTransformedSources.get(resolvedPath) ?? source;
|
|
3725
3739
|
};
|
|
3726
3740
|
const originalGetSourceFileForCompile = host.getSourceFile;
|
|
@@ -3765,7 +3779,7 @@ ${registrations}
|
|
|
3765
3779
|
await Promise.all(entries.map(({ target, content }) => fs.writeFile(target, content, "utf-8")));
|
|
3766
3780
|
return entries.map(({ target }) => target);
|
|
3767
3781
|
}, jitContentCache, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), resolveAngularDeferImportSpecifier = () => {
|
|
3768
|
-
const sourceEntry =
|
|
3782
|
+
const sourceEntry = resolve6(import.meta.dir, "../angular/components/index.ts");
|
|
3769
3783
|
if (existsSync4(sourceEntry)) {
|
|
3770
3784
|
return sourceEntry.replace(/\\/g, "/");
|
|
3771
3785
|
}
|
|
@@ -3893,10 +3907,10 @@ ${slot.resolvedBindings.map((binding) => ` "${binding.key}": this.__absoluteDef
|
|
|
3893
3907
|
return rewritten.replace(/export(?:\s+default)?\s+class\s+([A-Za-z_$][\w$]*)\s*{/, (match) => `${match}
|
|
3894
3908
|
${fields}
|
|
3895
3909
|
`);
|
|
3896
|
-
}, readAndEscapeFile = async (filePath) => {
|
|
3910
|
+
}, readAndEscapeFile = async (filePath, stylePreprocessors) => {
|
|
3897
3911
|
if (!existsSync4(filePath))
|
|
3898
3912
|
return null;
|
|
3899
|
-
const content = await compileStyleFileIfNeeded(filePath);
|
|
3913
|
+
const content = await compileStyleFileIfNeeded(filePath, stylePreprocessors);
|
|
3900
3914
|
return escapeTemplateContent(content);
|
|
3901
3915
|
}, inlineTemplateAndLowerDefer = async (source, fileDir) => {
|
|
3902
3916
|
const templateUrlMatch = source.match(/templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
@@ -3960,7 +3974,7 @@ ${fields}
|
|
|
3960
3974
|
deferSlots: lowered.slots,
|
|
3961
3975
|
source: injectDeferSlotFields(replacedSource, lowered.slots, resolveAngularDeferImportSpecifier())
|
|
3962
3976
|
};
|
|
3963
|
-
}, inlineStyleUrls = async (source, fileDir) => {
|
|
3977
|
+
}, inlineStyleUrls = async (source, fileDir, stylePreprocessors) => {
|
|
3964
3978
|
const styleUrlsMatch = source.match(/styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
3965
3979
|
if (!styleUrlsMatch?.[1])
|
|
3966
3980
|
return source;
|
|
@@ -3969,35 +3983,35 @@ ${fields}
|
|
|
3969
3983
|
return source;
|
|
3970
3984
|
const stylePromises = urlMatches.map((urlMatch) => {
|
|
3971
3985
|
const styleUrl = urlMatch.replace(/['"]/g, "");
|
|
3972
|
-
return readAndEscapeFile(join5(fileDir, styleUrl));
|
|
3986
|
+
return readAndEscapeFile(join5(fileDir, styleUrl), stylePreprocessors);
|
|
3973
3987
|
});
|
|
3974
3988
|
const results = await Promise.all(stylePromises);
|
|
3975
3989
|
const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
|
|
3976
3990
|
if (inlinedStyles.length === 0)
|
|
3977
3991
|
return source;
|
|
3978
3992
|
return source.replace(/styleUrls\s*:\s*\[[^\]]+\]/, `styles: [${inlinedStyles.join(", ")}]`);
|
|
3979
|
-
}, inlineSingleStyleUrl = async (source, fileDir) => {
|
|
3993
|
+
}, inlineSingleStyleUrl = async (source, fileDir, stylePreprocessors) => {
|
|
3980
3994
|
const styleUrlMatch = source.match(/styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
3981
3995
|
if (!styleUrlMatch?.[1])
|
|
3982
3996
|
return source;
|
|
3983
|
-
const escaped = await readAndEscapeFile(join5(fileDir, styleUrlMatch[1]));
|
|
3997
|
+
const escaped = await readAndEscapeFile(join5(fileDir, styleUrlMatch[1]), stylePreprocessors);
|
|
3984
3998
|
if (!escaped)
|
|
3985
3999
|
return source;
|
|
3986
4000
|
return source.replace(/styleUrl\s*:\s*['"][^'"]+['"]/, `styles: [\`${escaped}\`]`);
|
|
3987
|
-
}, inlineResources = async (source, fileDir) => {
|
|
4001
|
+
}, inlineResources = async (source, fileDir, stylePreprocessors) => {
|
|
3988
4002
|
const inlinedTemplate = await inlineTemplateAndLowerDefer(source, fileDir);
|
|
3989
4003
|
let result = inlinedTemplate.source;
|
|
3990
|
-
result = await inlineStyleUrls(result, fileDir);
|
|
3991
|
-
result = await inlineSingleStyleUrl(result, fileDir);
|
|
4004
|
+
result = await inlineStyleUrls(result, fileDir, stylePreprocessors);
|
|
4005
|
+
result = await inlineSingleStyleUrl(result, fileDir, stylePreprocessors);
|
|
3992
4006
|
return {
|
|
3993
4007
|
deferSlots: inlinedTemplate.deferSlots,
|
|
3994
4008
|
source: result
|
|
3995
4009
|
};
|
|
3996
|
-
}, compileAngularFileJIT = async (inputPath, outDir, rootDir) => {
|
|
3997
|
-
const entryPath =
|
|
4010
|
+
}, compileAngularFileJIT = async (inputPath, outDir, rootDir, stylePreprocessors) => {
|
|
4011
|
+
const entryPath = resolve6(inputPath);
|
|
3998
4012
|
const allOutputs = [];
|
|
3999
4013
|
const visited = new Set;
|
|
4000
|
-
const baseDir =
|
|
4014
|
+
const baseDir = resolve6(rootDir ?? process.cwd());
|
|
4001
4015
|
const angularTranspiler = new Bun.Transpiler({
|
|
4002
4016
|
loader: "ts",
|
|
4003
4017
|
tsconfig: JSON.stringify({
|
|
@@ -4034,13 +4048,13 @@ ${fields}
|
|
|
4034
4048
|
return `${prefix}${dots}`;
|
|
4035
4049
|
return `${prefix}../${dots}`;
|
|
4036
4050
|
});
|
|
4037
|
-
if (
|
|
4051
|
+
if (resolve6(actualPath) === entryPath) {
|
|
4038
4052
|
processedContent += buildIslandMetadataExports(sourceCode);
|
|
4039
4053
|
}
|
|
4040
4054
|
return processedContent;
|
|
4041
4055
|
};
|
|
4042
4056
|
const transpileFile = async (filePath) => {
|
|
4043
|
-
const resolved =
|
|
4057
|
+
const resolved = resolve6(filePath);
|
|
4044
4058
|
if (visited.has(resolved))
|
|
4045
4059
|
return;
|
|
4046
4060
|
visited.add(resolved);
|
|
@@ -4050,7 +4064,7 @@ ${fields}
|
|
|
4050
4064
|
if (!existsSync4(actualPath))
|
|
4051
4065
|
return;
|
|
4052
4066
|
let sourceCode = await fs.readFile(actualPath, "utf-8");
|
|
4053
|
-
const inlined = await inlineResources(sourceCode, dirname4(actualPath));
|
|
4067
|
+
const inlined = await inlineResources(sourceCode, dirname4(actualPath), stylePreprocessors);
|
|
4054
4068
|
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname4(actualPath)).source;
|
|
4055
4069
|
const inputDir = dirname4(actualPath);
|
|
4056
4070
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
@@ -4082,13 +4096,13 @@ ${fields}
|
|
|
4082
4096
|
}
|
|
4083
4097
|
const inputDirForResolve = dirname4(actualPath);
|
|
4084
4098
|
await Promise.all(localImports.map((imp) => {
|
|
4085
|
-
const importPath =
|
|
4099
|
+
const importPath = resolve6(inputDirForResolve, imp);
|
|
4086
4100
|
return transpileFile(importPath);
|
|
4087
4101
|
}));
|
|
4088
4102
|
};
|
|
4089
4103
|
await transpileFile(inputPath);
|
|
4090
4104
|
return allOutputs;
|
|
4091
|
-
}, compileAngular = async (entryPoints, outRoot, hmr = false) => {
|
|
4105
|
+
}, compileAngular = async (entryPoints, outRoot, hmr = false, stylePreprocessors) => {
|
|
4092
4106
|
const compiledParent = join5(outRoot, "generated");
|
|
4093
4107
|
if (entryPoints.length === 0) {
|
|
4094
4108
|
const emptyPaths = [];
|
|
@@ -4098,9 +4112,9 @@ ${fields}
|
|
|
4098
4112
|
const indexesDir = join5(compiledParent, "indexes");
|
|
4099
4113
|
await fs.mkdir(indexesDir, { recursive: true });
|
|
4100
4114
|
const compileTasks = entryPoints.map(async (entry) => {
|
|
4101
|
-
const resolvedEntry =
|
|
4115
|
+
const resolvedEntry = resolve6(entry);
|
|
4102
4116
|
const relativeEntry = relative2(outRoot, resolvedEntry).replace(/\.[tj]s$/, ".js");
|
|
4103
|
-
const compileEntry = () => hmr ? compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot) : compileAngularFile(resolvedEntry, compiledRoot);
|
|
4117
|
+
const compileEntry = () => hmr ? compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot, stylePreprocessors) : compileAngularFile(resolvedEntry, compiledRoot, stylePreprocessors);
|
|
4104
4118
|
let outputs = await compileEntry();
|
|
4105
4119
|
const fileBase = basename3(resolvedEntry).replace(/\.[tj]s$/, "");
|
|
4106
4120
|
const jsName = `${fileBase}.js`;
|
|
@@ -4108,10 +4122,10 @@ ${fields}
|
|
|
4108
4122
|
join5(compiledRoot, relativeEntry),
|
|
4109
4123
|
join5(compiledRoot, "pages", jsName),
|
|
4110
4124
|
join5(compiledRoot, jsName)
|
|
4111
|
-
].map((file) =>
|
|
4125
|
+
].map((file) => resolve6(file));
|
|
4112
4126
|
const resolveRawServerFile = (candidatePaths) => {
|
|
4113
4127
|
const normalizedCandidates = [
|
|
4114
|
-
...candidatePaths.map((file) =>
|
|
4128
|
+
...candidatePaths.map((file) => resolve6(file)),
|
|
4115
4129
|
...compiledFallbackPaths
|
|
4116
4130
|
];
|
|
4117
4131
|
let candidate = normalizedCandidates.find((file) => existsSync4(file) && file.endsWith(`${sep}pages${sep}${jsName}`));
|
|
@@ -4339,19 +4353,19 @@ var init_compileAngular = __esm(() => {
|
|
|
4339
4353
|
import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
|
|
4340
4354
|
import { mkdir as mkdir2, symlink } from "fs/promises";
|
|
4341
4355
|
import { tmpdir } from "os";
|
|
4342
|
-
import { basename as basename4, dirname as dirname5, join as join6, resolve as
|
|
4356
|
+
import { basename as basename4, dirname as dirname5, join as join6, resolve as resolve7 } from "path";
|
|
4343
4357
|
var ssrDirty = false, lastSelector = "angular-page", isRecord5 = (value) => typeof value === "object" && value !== null, isAngularComponent = (value) => typeof value === "function", compilerImportPromise = null, ensureAngularCompiler = () => {
|
|
4344
4358
|
if (!compilerImportPromise) {
|
|
4345
4359
|
compilerImportPromise = import("@angular/compiler");
|
|
4346
4360
|
}
|
|
4347
4361
|
return compilerImportPromise;
|
|
4348
4362
|
}, readAngularPageModule = (value) => isRecord5(value) ? value : null, resolveAngularSsrOutDir = () => process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR ?? join6(tmpdir(), "absolutejs", "generated", "angular-ssr"), ensureAngularSsrNodeModules = async (outDir) => {
|
|
4349
|
-
const outRoot =
|
|
4363
|
+
const outRoot = resolve7(dirname5(dirname5(outDir)));
|
|
4350
4364
|
const nodeModulesLink = join6(outRoot, "node_modules");
|
|
4351
4365
|
if (process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR) {
|
|
4352
4366
|
return;
|
|
4353
4367
|
}
|
|
4354
|
-
if (nodeModulesLink ===
|
|
4368
|
+
if (nodeModulesLink === resolve7(process.cwd(), "node_modules")) {
|
|
4355
4369
|
return;
|
|
4356
4370
|
}
|
|
4357
4371
|
if (await Bun.file(nodeModulesLink).exists()) {
|
|
@@ -4359,7 +4373,7 @@ var ssrDirty = false, lastSelector = "angular-page", isRecord5 = (value) => type
|
|
|
4359
4373
|
}
|
|
4360
4374
|
await mkdir2(outRoot, { recursive: true });
|
|
4361
4375
|
try {
|
|
4362
|
-
await symlink(
|
|
4376
|
+
await symlink(resolve7(process.cwd(), "node_modules"), nodeModulesLink, "dir");
|
|
4363
4377
|
} catch (error) {
|
|
4364
4378
|
if (!(error instanceof Error) || !("code" in error) || error.code !== "EEXIST") {
|
|
4365
4379
|
throw error;
|
|
@@ -5158,7 +5172,7 @@ var require_Observable = __commonJS((exports) => {
|
|
|
5158
5172
|
Observable2.prototype.forEach = function(next, promiseCtor) {
|
|
5159
5173
|
var _this = this;
|
|
5160
5174
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
5161
|
-
return new promiseCtor(function(
|
|
5175
|
+
return new promiseCtor(function(resolve8, reject) {
|
|
5162
5176
|
var subscriber = new Subscriber_1.SafeSubscriber({
|
|
5163
5177
|
next: function(value) {
|
|
5164
5178
|
try {
|
|
@@ -5169,7 +5183,7 @@ var require_Observable = __commonJS((exports) => {
|
|
|
5169
5183
|
}
|
|
5170
5184
|
},
|
|
5171
5185
|
error: reject,
|
|
5172
|
-
complete:
|
|
5186
|
+
complete: resolve8
|
|
5173
5187
|
});
|
|
5174
5188
|
_this.subscribe(subscriber);
|
|
5175
5189
|
});
|
|
@@ -5191,14 +5205,14 @@ var require_Observable = __commonJS((exports) => {
|
|
|
5191
5205
|
Observable2.prototype.toPromise = function(promiseCtor) {
|
|
5192
5206
|
var _this = this;
|
|
5193
5207
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
5194
|
-
return new promiseCtor(function(
|
|
5208
|
+
return new promiseCtor(function(resolve8, reject) {
|
|
5195
5209
|
var value;
|
|
5196
5210
|
_this.subscribe(function(x) {
|
|
5197
5211
|
return value = x;
|
|
5198
5212
|
}, function(err) {
|
|
5199
5213
|
return reject(err);
|
|
5200
5214
|
}, function() {
|
|
5201
|
-
return
|
|
5215
|
+
return resolve8(value);
|
|
5202
5216
|
});
|
|
5203
5217
|
});
|
|
5204
5218
|
};
|
|
@@ -7226,11 +7240,11 @@ var require_isReadableStreamLike = __commonJS((exports) => {
|
|
|
7226
7240
|
var require_innerFrom = __commonJS((exports) => {
|
|
7227
7241
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
7228
7242
|
function adopt(value) {
|
|
7229
|
-
return value instanceof P ? value : new P(function(
|
|
7230
|
-
|
|
7243
|
+
return value instanceof P ? value : new P(function(resolve8) {
|
|
7244
|
+
resolve8(value);
|
|
7231
7245
|
});
|
|
7232
7246
|
}
|
|
7233
|
-
return new (P || (P = Promise))(function(
|
|
7247
|
+
return new (P || (P = Promise))(function(resolve8, reject) {
|
|
7234
7248
|
function fulfilled(value) {
|
|
7235
7249
|
try {
|
|
7236
7250
|
step(generator.next(value));
|
|
@@ -7246,7 +7260,7 @@ var require_innerFrom = __commonJS((exports) => {
|
|
|
7246
7260
|
}
|
|
7247
7261
|
}
|
|
7248
7262
|
function step(result) {
|
|
7249
|
-
result.done ?
|
|
7263
|
+
result.done ? resolve8(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
7250
7264
|
}
|
|
7251
7265
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
7252
7266
|
});
|
|
@@ -7336,14 +7350,14 @@ var require_innerFrom = __commonJS((exports) => {
|
|
|
7336
7350
|
}, i);
|
|
7337
7351
|
function verb(n) {
|
|
7338
7352
|
i[n] = o[n] && function(v) {
|
|
7339
|
-
return new Promise(function(
|
|
7340
|
-
v = o[n](v), settle(
|
|
7353
|
+
return new Promise(function(resolve8, reject) {
|
|
7354
|
+
v = o[n](v), settle(resolve8, reject, v.done, v.value);
|
|
7341
7355
|
});
|
|
7342
7356
|
};
|
|
7343
7357
|
}
|
|
7344
|
-
function settle(
|
|
7358
|
+
function settle(resolve8, reject, d, v) {
|
|
7345
7359
|
Promise.resolve(v).then(function(v2) {
|
|
7346
|
-
|
|
7360
|
+
resolve8({ value: v2, done: d });
|
|
7347
7361
|
}, reject);
|
|
7348
7362
|
}
|
|
7349
7363
|
};
|
|
@@ -7919,7 +7933,7 @@ var require_lastValueFrom = __commonJS((exports) => {
|
|
|
7919
7933
|
var EmptyError_1 = require_EmptyError();
|
|
7920
7934
|
function lastValueFrom(source, config) {
|
|
7921
7935
|
var hasConfig = typeof config === "object";
|
|
7922
|
-
return new Promise(function(
|
|
7936
|
+
return new Promise(function(resolve8, reject) {
|
|
7923
7937
|
var _hasValue = false;
|
|
7924
7938
|
var _value;
|
|
7925
7939
|
source.subscribe({
|
|
@@ -7930,9 +7944,9 @@ var require_lastValueFrom = __commonJS((exports) => {
|
|
|
7930
7944
|
error: reject,
|
|
7931
7945
|
complete: function() {
|
|
7932
7946
|
if (_hasValue) {
|
|
7933
|
-
|
|
7947
|
+
resolve8(_value);
|
|
7934
7948
|
} else if (hasConfig) {
|
|
7935
|
-
|
|
7949
|
+
resolve8(config.defaultValue);
|
|
7936
7950
|
} else {
|
|
7937
7951
|
reject(new EmptyError_1.EmptyError);
|
|
7938
7952
|
}
|
|
@@ -7951,16 +7965,16 @@ var require_firstValueFrom = __commonJS((exports) => {
|
|
|
7951
7965
|
var Subscriber_1 = require_Subscriber();
|
|
7952
7966
|
function firstValueFrom(source, config) {
|
|
7953
7967
|
var hasConfig = typeof config === "object";
|
|
7954
|
-
return new Promise(function(
|
|
7968
|
+
return new Promise(function(resolve8, reject) {
|
|
7955
7969
|
var subscriber = new Subscriber_1.SafeSubscriber({
|
|
7956
7970
|
next: function(value) {
|
|
7957
|
-
|
|
7971
|
+
resolve8(value);
|
|
7958
7972
|
subscriber.unsubscribe();
|
|
7959
7973
|
},
|
|
7960
7974
|
error: reject,
|
|
7961
7975
|
complete: function() {
|
|
7962
7976
|
if (hasConfig) {
|
|
7963
|
-
|
|
7977
|
+
resolve8(config.defaultValue);
|
|
7964
7978
|
} else {
|
|
7965
7979
|
reject(new EmptyError_1.EmptyError);
|
|
7966
7980
|
}
|
|
@@ -13722,5 +13736,5 @@ export {
|
|
|
13722
13736
|
Island
|
|
13723
13737
|
};
|
|
13724
13738
|
|
|
13725
|
-
//# debugId=
|
|
13739
|
+
//# debugId=616C70E79D1443DD64756E2164756E21
|
|
13726
13740
|
//# sourceMappingURL=index.js.map
|