@absolutejs/absolute 0.19.0-beta.693 → 0.19.0-beta.694
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 +247 -47
- package/dist/angular/index.js.map +3 -3
- package/dist/angular/server.js +247 -47
- package/dist/angular/server.js.map +3 -3
- package/dist/build.js +386 -186
- package/dist/build.js.map +5 -5
- package/dist/index.js +433 -233
- package/dist/index.js.map +5 -5
- package/dist/islands/index.js +219 -19
- package/dist/islands/index.js.map +3 -3
- package/dist/react/index.js +219 -19
- package/dist/react/index.js.map +3 -3
- package/dist/svelte/index.js +229 -29
- package/dist/svelte/index.js.map +3 -3
- package/dist/svelte/server.js +224 -24
- package/dist/svelte/server.js.map +3 -3
- package/dist/types/build.d.ts +17 -0
- package/dist/vue/index.js +219 -19
- package/dist/vue/index.js.map +3 -3
- package/package.json +12 -7
package/dist/angular/index.js
CHANGED
|
@@ -1352,10 +1352,12 @@ var init_lowerAwaitSlotSyntax = __esm(() => {
|
|
|
1352
1352
|
});
|
|
1353
1353
|
|
|
1354
1354
|
// src/build/stylePreprocessor.ts
|
|
1355
|
+
import { existsSync as existsSync4, readFileSync as readFileSync3 } from "fs";
|
|
1355
1356
|
import { readFile } from "fs/promises";
|
|
1356
1357
|
import { createRequire } from "module";
|
|
1357
|
-
import { dirname as dirname2, extname, join as join3, resolve as resolve4 } from "path";
|
|
1358
|
-
|
|
1358
|
+
import { dirname as dirname2, extname, isAbsolute, join as join3, relative, resolve as resolve4 } from "path";
|
|
1359
|
+
import { fileURLToPath } from "url";
|
|
1360
|
+
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|styl(?:us)?)$/i.test(filePath), getStyleBaseName = (filePath) => filePath.replace(/\.(css|s[ac]ss|less|styl(?:us)?)$/i, ""), getStyleLanguage = (filePathOrLanguage) => {
|
|
1359
1361
|
const normalized = filePathOrLanguage.toLowerCase();
|
|
1360
1362
|
if (normalized === "scss" || normalized.endsWith(".scss"))
|
|
1361
1363
|
return "scss";
|
|
@@ -1363,16 +1365,196 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
1363
1365
|
return "sass";
|
|
1364
1366
|
if (normalized === "less" || normalized.endsWith(".less"))
|
|
1365
1367
|
return "less";
|
|
1368
|
+
if (normalized === "styl" || normalized === "stylus" || normalized.endsWith(".styl") || normalized.endsWith(".stylus"))
|
|
1369
|
+
return "stylus";
|
|
1366
1370
|
return null;
|
|
1367
1371
|
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`), normalizeLoadPaths = (filePath, paths = []) => [
|
|
1368
1372
|
dirname2(filePath),
|
|
1369
1373
|
process.cwd(),
|
|
1370
1374
|
...paths.map((path) => resolve4(process.cwd(), path))
|
|
1371
|
-
],
|
|
1375
|
+
], tsconfigAliasCache, stripJsonComments = (source) => source.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:])\/\/.*$/gm, "$1"), normalizeAliasEntries = (aliases) => Object.entries(aliases ?? {}).map(([pattern, value]) => ({
|
|
1376
|
+
pattern,
|
|
1377
|
+
replacements: Array.isArray(value) ? value : [value]
|
|
1378
|
+
})), readTsconfigAliases = () => {
|
|
1379
|
+
const cwd = process.cwd();
|
|
1380
|
+
if (tsconfigAliasCache?.cwd === cwd)
|
|
1381
|
+
return tsconfigAliasCache;
|
|
1382
|
+
const tsconfigPath = resolve4(cwd, "tsconfig.json");
|
|
1383
|
+
const empty = { aliases: [], baseUrl: cwd, cwd };
|
|
1384
|
+
if (!existsSync4(tsconfigPath)) {
|
|
1385
|
+
tsconfigAliasCache = empty;
|
|
1386
|
+
return empty;
|
|
1387
|
+
}
|
|
1388
|
+
try {
|
|
1389
|
+
const parsed = JSON.parse(stripJsonComments(readFileSync3(tsconfigPath, "utf-8")));
|
|
1390
|
+
const compilerOptions = parsed.compilerOptions ?? {};
|
|
1391
|
+
const baseUrl = resolve4(cwd, compilerOptions.baseUrl ?? ".");
|
|
1392
|
+
tsconfigAliasCache = {
|
|
1393
|
+
aliases: normalizeAliasEntries(compilerOptions.paths),
|
|
1394
|
+
baseUrl,
|
|
1395
|
+
cwd
|
|
1396
|
+
};
|
|
1397
|
+
} catch {
|
|
1398
|
+
tsconfigAliasCache = empty;
|
|
1399
|
+
}
|
|
1400
|
+
return tsconfigAliasCache;
|
|
1401
|
+
}, getAliasEntries = (config) => {
|
|
1402
|
+
const tsconfig = readTsconfigAliases();
|
|
1403
|
+
return {
|
|
1404
|
+
aliases: [...normalizeAliasEntries(config?.aliases), ...tsconfig.aliases],
|
|
1405
|
+
baseUrl: tsconfig.baseUrl
|
|
1406
|
+
};
|
|
1407
|
+
}, aliasPatternToRegExp = (pattern) => new RegExp(`^${pattern.split("*").map((part) => part.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("(.+)")}$`), resolveAliasTargets = (specifier, config) => {
|
|
1408
|
+
const { aliases, baseUrl } = getAliasEntries(config);
|
|
1409
|
+
const targets = [];
|
|
1410
|
+
for (const alias of aliases) {
|
|
1411
|
+
const match = specifier.match(aliasPatternToRegExp(alias.pattern));
|
|
1412
|
+
if (!match)
|
|
1413
|
+
continue;
|
|
1414
|
+
const wildcard = match[1] ?? "";
|
|
1415
|
+
for (const replacement of alias.replacements) {
|
|
1416
|
+
targets.push(resolve4(baseUrl, replacement.replace("*", wildcard)));
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
return targets;
|
|
1420
|
+
}, getLanguageExtensions = (language) => {
|
|
1421
|
+
if (language === "less")
|
|
1422
|
+
return [".less", ".css"];
|
|
1423
|
+
if (language === "stylus")
|
|
1424
|
+
return [".styl", ".stylus", ".css"];
|
|
1425
|
+
return [".scss", ".sass", ".css"];
|
|
1426
|
+
}, getCandidatePaths = (basePath, language) => {
|
|
1427
|
+
const ext = extname(basePath);
|
|
1428
|
+
const paths = ext ? [basePath] : getLanguageExtensions(language).flatMap((extension) => [
|
|
1429
|
+
`${basePath}${extension}`,
|
|
1430
|
+
join3(basePath, `index${extension}`)
|
|
1431
|
+
]);
|
|
1432
|
+
if (language === "scss" || language === "sass") {
|
|
1433
|
+
return paths.flatMap((path) => {
|
|
1434
|
+
const dir = dirname2(path);
|
|
1435
|
+
const base = path.slice(dir.length + 1);
|
|
1436
|
+
return [path, join3(dir, `_${base}`)];
|
|
1437
|
+
});
|
|
1438
|
+
}
|
|
1439
|
+
return paths;
|
|
1440
|
+
}, resolveImportPath = (specifier, fromDirectory, loadPaths, language, config) => {
|
|
1441
|
+
const rawCandidates = [
|
|
1442
|
+
...resolveAliasTargets(specifier, config),
|
|
1443
|
+
isAbsolute(specifier) ? specifier : resolve4(fromDirectory, specifier),
|
|
1444
|
+
...loadPaths.map((path) => resolve4(path, specifier))
|
|
1445
|
+
];
|
|
1446
|
+
for (const candidate of rawCandidates.flatMap((path) => getCandidatePaths(path, language))) {
|
|
1447
|
+
if (existsSync4(candidate))
|
|
1448
|
+
return candidate;
|
|
1449
|
+
}
|
|
1450
|
+
return null;
|
|
1451
|
+
}, isExternalCssUrl = (url) => /^(?:[a-z][a-z0-9+.-]*:|\/\/|#|\/)/i.test(url), splitCssUrl = (url) => {
|
|
1452
|
+
const markerIndex = url.search(/[?#]/);
|
|
1453
|
+
if (markerIndex === -1)
|
|
1454
|
+
return { marker: "", path: url };
|
|
1455
|
+
return {
|
|
1456
|
+
marker: url.slice(markerIndex),
|
|
1457
|
+
path: url.slice(0, markerIndex)
|
|
1458
|
+
};
|
|
1459
|
+
}, rebaseCssUrls = (contents, sourceFile, entryFile) => {
|
|
1460
|
+
const sourceDir = dirname2(sourceFile);
|
|
1461
|
+
const entryDir = dirname2(entryFile);
|
|
1462
|
+
if (sourceDir === entryDir)
|
|
1463
|
+
return contents;
|
|
1464
|
+
return contents.replace(/url\(\s*(['"]?)([^'")]+)\1\s*\)/gi, (match, quote, rawUrl) => {
|
|
1465
|
+
const trimmedUrl = rawUrl.trim();
|
|
1466
|
+
if (!trimmedUrl || isExternalCssUrl(trimmedUrl))
|
|
1467
|
+
return match;
|
|
1468
|
+
const { marker, path } = splitCssUrl(trimmedUrl);
|
|
1469
|
+
const rebased = relative(entryDir, resolve4(sourceDir, path)).replace(/\\/g, "/");
|
|
1470
|
+
const normalized = rebased.startsWith(".") ? rebased : `./${rebased}`;
|
|
1471
|
+
const nextQuote = quote || '"';
|
|
1472
|
+
return `url(${nextQuote}${normalized}${marker}${nextQuote})`;
|
|
1473
|
+
});
|
|
1474
|
+
}, rewriteAliasedStyleImports = (contents, sourceFile, loadPaths, language, config) => contents.replace(/(@(?:use|forward|import|require)\s+)(["'])([^"']+)\2/g, (match, prefix, quote, specifier) => {
|
|
1475
|
+
if (specifier.startsWith(".") || isAbsolute(specifier) || isExternalCssUrl(specifier))
|
|
1476
|
+
return match;
|
|
1477
|
+
const resolved = resolveImportPath(specifier, dirname2(sourceFile), loadPaths, language, config);
|
|
1478
|
+
return resolved ? `${prefix}${quote}${resolved}${quote}` : match;
|
|
1479
|
+
}), preprocessLoadedStyle = (contents, sourceFile, entryFile, loadPaths = [], language, config) => {
|
|
1480
|
+
const rebased = rebaseCssUrls(contents, sourceFile, entryFile);
|
|
1481
|
+
return language ? rewriteAliasedStyleImports(rebased, sourceFile, loadPaths, language, config) : rebased;
|
|
1482
|
+
}, extractCssModuleExports = (css) => {
|
|
1483
|
+
const exports = {};
|
|
1484
|
+
const nextCss = css.replace(/:export\s*\{([^}]*)\}/g, (_, body) => {
|
|
1485
|
+
for (const declaration of body.split(";")) {
|
|
1486
|
+
const separator = declaration.indexOf(":");
|
|
1487
|
+
if (separator === -1)
|
|
1488
|
+
continue;
|
|
1489
|
+
const key = declaration.slice(0, separator).trim();
|
|
1490
|
+
const value = declaration.slice(separator + 1).trim();
|
|
1491
|
+
if (key && value)
|
|
1492
|
+
exports[key] = value;
|
|
1493
|
+
}
|
|
1494
|
+
return "";
|
|
1495
|
+
});
|
|
1496
|
+
return { css: nextCss, exports };
|
|
1497
|
+
}, getSassOptions = (config, language) => ({
|
|
1372
1498
|
...config?.sass ?? {},
|
|
1373
1499
|
...language === "scss" ? config?.scss ?? {} : {}
|
|
1374
|
-
}), getLessOptions = (config) => config?.less ?? {}, withAdditionalData = (contents, additionalData) => additionalData ? `${additionalData}
|
|
1375
|
-
${contents}` : contents,
|
|
1500
|
+
}), getLessOptions = (config) => config?.less ?? {}, getStylusOptions = (config) => config?.stylus ?? {}, withAdditionalData = (contents, additionalData) => additionalData ? `${additionalData}
|
|
1501
|
+
${contents}` : contents, createSassImporter = (entryFile, loadPaths, language, config) => ({
|
|
1502
|
+
canonicalize(specifier, options) {
|
|
1503
|
+
const fromDirectory = options.containingUrl ? dirname2(fileURLToPath(options.containingUrl)) : dirname2(entryFile);
|
|
1504
|
+
const resolved = resolveImportPath(specifier, fromDirectory, loadPaths, language, config);
|
|
1505
|
+
return resolved ? new URL(`file://${resolved}`) : null;
|
|
1506
|
+
},
|
|
1507
|
+
load(canonicalUrl) {
|
|
1508
|
+
const filePath = fileURLToPath(canonicalUrl);
|
|
1509
|
+
const fileLanguage = getStyleLanguage(filePath);
|
|
1510
|
+
if (fileLanguage !== "scss" && fileLanguage !== "sass" && fileLanguage !== null)
|
|
1511
|
+
return null;
|
|
1512
|
+
return {
|
|
1513
|
+
contents: preprocessLoadedStyle(readFileSync3(filePath, "utf-8"), filePath, entryFile, loadPaths, language, config),
|
|
1514
|
+
syntax: filePath.endsWith(".sass") ? "indented" : "scss"
|
|
1515
|
+
};
|
|
1516
|
+
}
|
|
1517
|
+
}), createLessFileManager = (entryFile, loadPaths, config) => ({
|
|
1518
|
+
install(less, pluginManager) {
|
|
1519
|
+
const baseManager = new less.FileManager;
|
|
1520
|
+
const manager = Object.create(baseManager);
|
|
1521
|
+
manager.supports = (filename, currentDirectory) => Boolean(resolveImportPath(filename, resolve4(currentDirectory), loadPaths, "less", config));
|
|
1522
|
+
manager.loadFile = async (filename, currentDirectory) => {
|
|
1523
|
+
const resolved = resolveImportPath(filename, resolve4(currentDirectory), loadPaths, "less", config);
|
|
1524
|
+
if (!resolved) {
|
|
1525
|
+
throw new Error(`Unable to resolve Less import "${filename}"`);
|
|
1526
|
+
}
|
|
1527
|
+
return {
|
|
1528
|
+
contents: preprocessLoadedStyle(await readFile(resolved, "utf-8"), resolved, entryFile, loadPaths, "less", config),
|
|
1529
|
+
filename: resolved
|
|
1530
|
+
};
|
|
1531
|
+
};
|
|
1532
|
+
pluginManager.addFileManager(manager);
|
|
1533
|
+
}
|
|
1534
|
+
}), renderStylus = async (contents, filePath, loadPaths, options) => {
|
|
1535
|
+
let stylus;
|
|
1536
|
+
try {
|
|
1537
|
+
const stylusModule = await importOptionalPeer("stylus");
|
|
1538
|
+
stylus = stylusModule.default ?? stylusModule;
|
|
1539
|
+
} catch {
|
|
1540
|
+
throw missingDependencyError("stylus", filePath);
|
|
1541
|
+
}
|
|
1542
|
+
return new Promise((resolveCss, reject) => {
|
|
1543
|
+
const renderer = stylus(contents);
|
|
1544
|
+
renderer.set("filename", filePath);
|
|
1545
|
+
for (const [key, value] of Object.entries(options.options ?? {})) {
|
|
1546
|
+
renderer.set(key, value);
|
|
1547
|
+
}
|
|
1548
|
+
for (const path of loadPaths)
|
|
1549
|
+
renderer.include(path);
|
|
1550
|
+
renderer.render((error, css) => {
|
|
1551
|
+
if (error)
|
|
1552
|
+
reject(error);
|
|
1553
|
+
else
|
|
1554
|
+
resolveCss(css ?? "");
|
|
1555
|
+
});
|
|
1556
|
+
});
|
|
1557
|
+
}, compileStyleSource = async (filePath, source, languageHint, config) => {
|
|
1376
1558
|
const language = getStyleLanguage(languageHint ?? filePath);
|
|
1377
1559
|
const rawContents = source ?? await readFile(filePath, "utf-8");
|
|
1378
1560
|
if (language === "scss" || language === "sass") {
|
|
@@ -1385,8 +1567,12 @@ ${contents}` : contents, compileStyleSource = async (filePath, source, languageH
|
|
|
1385
1567
|
throw missingDependencyError(packageName, filePath);
|
|
1386
1568
|
}
|
|
1387
1569
|
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
1570
|
+
const loadPaths = normalizeLoadPaths(filePath, options.loadPaths);
|
|
1388
1571
|
const result = sass.compileString(contents, {
|
|
1389
|
-
|
|
1572
|
+
importers: [
|
|
1573
|
+
createSassImporter(filePath, loadPaths, language, config)
|
|
1574
|
+
],
|
|
1575
|
+
loadPaths,
|
|
1390
1576
|
style: "expanded",
|
|
1391
1577
|
syntax: language === "sass" ? "indented" : "scss",
|
|
1392
1578
|
url: new URL(`file://${filePath}`)
|
|
@@ -1406,13 +1592,24 @@ ${contents}` : contents, compileStyleSource = async (filePath, source, languageH
|
|
|
1406
1592
|
if (!render)
|
|
1407
1593
|
throw missingDependencyError("less", filePath);
|
|
1408
1594
|
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
1595
|
+
const loadPaths = normalizeLoadPaths(filePath, options.paths);
|
|
1409
1596
|
const result = await render(contents, {
|
|
1410
1597
|
...options.options ?? {},
|
|
1411
1598
|
filename: filePath,
|
|
1412
|
-
paths:
|
|
1599
|
+
paths: loadPaths,
|
|
1600
|
+
plugins: [
|
|
1601
|
+
...options.options?.plugins ?? [],
|
|
1602
|
+
createLessFileManager(filePath, loadPaths, config)
|
|
1603
|
+
]
|
|
1413
1604
|
});
|
|
1414
1605
|
return result.css;
|
|
1415
1606
|
}
|
|
1607
|
+
if (language === "stylus") {
|
|
1608
|
+
const options = getStylusOptions(config);
|
|
1609
|
+
const loadPaths = normalizeLoadPaths(filePath, options.paths);
|
|
1610
|
+
const contents = withAdditionalData(preprocessLoadedStyle(rawContents, filePath, filePath, loadPaths, "stylus", config), options.additionalData);
|
|
1611
|
+
return renderStylus(contents, filePath, loadPaths, options);
|
|
1612
|
+
}
|
|
1416
1613
|
return rawContents;
|
|
1417
1614
|
}, createStylePreprocessorPlugin = (config) => ({
|
|
1418
1615
|
name: "absolute-style-preprocessor",
|
|
@@ -1423,21 +1620,24 @@ ${contents}` : contents, compileStyleSource = async (filePath, source, languageH
|
|
|
1423
1620
|
path: path.slice("absolute-style-module:".length)
|
|
1424
1621
|
}));
|
|
1425
1622
|
build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
|
|
1426
|
-
const
|
|
1427
|
-
if (!
|
|
1623
|
+
const source = cssModuleSources.get(path);
|
|
1624
|
+
if (!source) {
|
|
1428
1625
|
throw new Error(`Unable to resolve CSS module source for ${path}`);
|
|
1429
1626
|
}
|
|
1430
1627
|
return {
|
|
1431
|
-
contents:
|
|
1628
|
+
contents: source.css,
|
|
1432
1629
|
loader: "css"
|
|
1433
1630
|
};
|
|
1434
1631
|
});
|
|
1435
1632
|
build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
|
|
1436
1633
|
if (isStyleModulePath(path)) {
|
|
1437
1634
|
const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
|
|
1438
|
-
|
|
1635
|
+
const compiled = await compileStyleSource(path, undefined, undefined, config);
|
|
1636
|
+
const { css, exports } = extractCssModuleExports(compiled);
|
|
1637
|
+
cssModuleSources.set(cssModulePath, { css, exports });
|
|
1638
|
+
const exportSource = Object.keys(exports).length > 0 ? `import styles from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)}; export default Object.assign({}, styles, ${JSON.stringify(exports)});` : `export { default } from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)};`;
|
|
1439
1639
|
return {
|
|
1440
|
-
contents:
|
|
1640
|
+
contents: exportSource,
|
|
1441
1641
|
loader: "js"
|
|
1442
1642
|
};
|
|
1443
1643
|
}
|
|
@@ -1468,9 +1668,9 @@ ${contents}` : contents, compileStyleSource = async (filePath, source, languageH
|
|
|
1468
1668
|
return compileStyleSource(filePath, undefined, undefined, config);
|
|
1469
1669
|
};
|
|
1470
1670
|
var init_stylePreprocessor = __esm(() => {
|
|
1471
|
-
STYLE_EXTENSION_PATTERN = /\.(s[ac]ss|less)$/i;
|
|
1472
|
-
STYLE_MODULE_EXTENSION_PATTERN = /\.module\.(s[ac]ss|less)$/i;
|
|
1473
|
-
STYLE_LANGUAGE_PATTERN = /^(s[ac]ss|less)$/i;
|
|
1671
|
+
STYLE_EXTENSION_PATTERN = /\.(s[ac]ss|less|styl(?:us)?)$/i;
|
|
1672
|
+
STYLE_MODULE_EXTENSION_PATTERN = /\.module\.(s[ac]ss|less|styl(?:us)?)$/i;
|
|
1673
|
+
STYLE_LANGUAGE_PATTERN = /^(s[ac]ss|less|styl(?:us)?)$/i;
|
|
1474
1674
|
importOptionalPeer = new Function("specifier", "return import(specifier)");
|
|
1475
1675
|
requireOptionalPeer = new Function("specifier", "return require(specifier)");
|
|
1476
1676
|
requireFromCwd = createRequire(join3(process.cwd(), "package.json"));
|
|
@@ -1479,9 +1679,9 @@ var init_stylePreprocessor = __esm(() => {
|
|
|
1479
1679
|
|
|
1480
1680
|
// src/core/svelteServerModule.ts
|
|
1481
1681
|
import { mkdir, readdir } from "fs/promises";
|
|
1482
|
-
import { basename as basename2, dirname as dirname3, extname as extname2, join as join4, relative, resolve as resolve5 } from "path";
|
|
1682
|
+
import { basename as basename2, dirname as dirname3, extname as extname2, join as join4, relative as relative2, resolve as resolve5 } from "path";
|
|
1483
1683
|
var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
|
|
1484
|
-
const importPath =
|
|
1684
|
+
const importPath = relative2(dirname3(from), target).replace(/\\/g, "/");
|
|
1485
1685
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
1486
1686
|
}, processDirectoryEntries = (entries, dir, targetFileName, stack) => {
|
|
1487
1687
|
for (const entry of entries) {
|
|
@@ -1545,7 +1745,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
1545
1745
|
const foundIndex = existResults.indexOf(true);
|
|
1546
1746
|
return foundIndex >= 0 ? candidates[foundIndex] ?? null : null;
|
|
1547
1747
|
}, getCachedModulePath = (sourcePath) => {
|
|
1548
|
-
const relativeSourcePath =
|
|
1748
|
+
const relativeSourcePath = relative2(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
1549
1749
|
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
1550
1750
|
return join4(serverCacheRoot, `${normalizedSourcePath}.server.js`);
|
|
1551
1751
|
}, resolveSvelteImport = async (spec, from) => {
|
|
@@ -2865,12 +3065,12 @@ var init_startupBanner = __esm(() => {
|
|
|
2865
3065
|
// src/utils/logger.ts
|
|
2866
3066
|
var colors2, frameworkColors, formatPath = (filePath) => {
|
|
2867
3067
|
const cwd = process.cwd();
|
|
2868
|
-
let
|
|
2869
|
-
|
|
2870
|
-
if (!
|
|
2871
|
-
|
|
3068
|
+
let relative3 = filePath.startsWith(cwd) ? filePath.slice(cwd.length + 1) : filePath;
|
|
3069
|
+
relative3 = relative3.replace(/\\/g, "/");
|
|
3070
|
+
if (!relative3.startsWith("/")) {
|
|
3071
|
+
relative3 = `/${relative3}`;
|
|
2872
3072
|
}
|
|
2873
|
-
return
|
|
3073
|
+
return relative3;
|
|
2874
3074
|
}, getFrameworkColor = (framework) => frameworkColors[framework] || colors2.white, log = (action, options) => {
|
|
2875
3075
|
const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
|
|
2876
3076
|
const tag = `${colors2.cyan}[hmr]${colors2.reset}`;
|
|
@@ -3532,13 +3732,13 @@ __export(exports_compileAngular, {
|
|
|
3532
3732
|
compileAngularFile: () => compileAngularFile,
|
|
3533
3733
|
compileAngular: () => compileAngular
|
|
3534
3734
|
});
|
|
3535
|
-
import { existsSync as
|
|
3536
|
-
import { join as join5, basename as basename3, sep, dirname as dirname4, resolve as resolve6, relative as
|
|
3735
|
+
import { existsSync as existsSync5, readFileSync as readFileSync4, promises as fs } from "fs";
|
|
3736
|
+
import { join as join5, basename as basename3, sep, dirname as dirname4, resolve as resolve6, relative as relative3 } from "path";
|
|
3537
3737
|
import ts from "typescript";
|
|
3538
3738
|
import { createHash } from "crypto";
|
|
3539
3739
|
var computeConfigHash = () => {
|
|
3540
3740
|
try {
|
|
3541
|
-
const content =
|
|
3741
|
+
const content = readFileSync4("./tsconfig.json", "utf-8");
|
|
3542
3742
|
return createHash("md5").update(content).digest("hex");
|
|
3543
3743
|
} catch {
|
|
3544
3744
|
return "";
|
|
@@ -3546,11 +3746,11 @@ var computeConfigHash = () => {
|
|
|
3546
3746
|
}, resolveDevClientDir = () => {
|
|
3547
3747
|
const projectRoot = process.cwd();
|
|
3548
3748
|
const fromSource = resolve6(import.meta.dir, "../dev/client");
|
|
3549
|
-
if (
|
|
3749
|
+
if (existsSync5(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
3550
3750
|
return fromSource;
|
|
3551
3751
|
}
|
|
3552
3752
|
const fromNodeModules = resolve6(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
3553
|
-
if (
|
|
3753
|
+
if (existsSync5(fromNodeModules))
|
|
3554
3754
|
return fromNodeModules;
|
|
3555
3755
|
return resolve6(import.meta.dir, "./dev/client");
|
|
3556
3756
|
}, devClientDir, hmrClientPath, hmrRuntimePath, injectHMRRegistration = (content, sourceId) => {
|
|
@@ -3629,7 +3829,7 @@ ${registrations}
|
|
|
3629
3829
|
join5(basePath, "index.mts"),
|
|
3630
3830
|
join5(basePath, "index.cts")
|
|
3631
3831
|
];
|
|
3632
|
-
return candidates.map((candidate) => resolve6(candidate)).find((candidate) =>
|
|
3832
|
+
return candidates.map((candidate) => resolve6(candidate)).find((candidate) => existsSync5(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
3633
3833
|
}, readFileForAotTransform = async (fileName, readFile2) => {
|
|
3634
3834
|
const hostSource = readFile2?.(fileName);
|
|
3635
3835
|
if (typeof hostSource === "string")
|
|
@@ -3643,7 +3843,7 @@ ${registrations}
|
|
|
3643
3843
|
if (visited.has(resolvedPath))
|
|
3644
3844
|
return;
|
|
3645
3845
|
visited.add(resolvedPath);
|
|
3646
|
-
if (!
|
|
3846
|
+
if (!existsSync5(resolvedPath) || resolvedPath.endsWith(".d.ts"))
|
|
3647
3847
|
return;
|
|
3648
3848
|
const source = await readFileForAotTransform(resolvedPath, readFile2);
|
|
3649
3849
|
const transformed = await inlineResources(source, dirname4(resolvedPath), stylePreprocessors);
|
|
@@ -3658,7 +3858,7 @@ ${registrations}
|
|
|
3658
3858
|
await transformFile(inputPath);
|
|
3659
3859
|
return transformedSources;
|
|
3660
3860
|
}, compileAngularFile = async (inputPath, outDir, stylePreprocessors) => {
|
|
3661
|
-
const islandMetadataExports = buildIslandMetadataExports(
|
|
3861
|
+
const islandMetadataExports = buildIslandMetadataExports(readFileSync4(inputPath, "utf-8"));
|
|
3662
3862
|
const { readConfiguration, performCompilation, EmitFlags } = await import("@angular/compiler-cli");
|
|
3663
3863
|
const configHash = computeConfigHash();
|
|
3664
3864
|
const cached = globalThis.__angularCompilerCache;
|
|
@@ -3780,7 +3980,7 @@ ${registrations}
|
|
|
3780
3980
|
return entries.map(({ target }) => target);
|
|
3781
3981
|
}, jitContentCache, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), resolveAngularDeferImportSpecifier = () => {
|
|
3782
3982
|
const sourceEntry = resolve6(import.meta.dir, "../angular/components/index.ts");
|
|
3783
|
-
if (
|
|
3983
|
+
if (existsSync5(sourceEntry)) {
|
|
3784
3984
|
return sourceEntry.replace(/\\/g, "/");
|
|
3785
3985
|
}
|
|
3786
3986
|
return "@absolutejs/absolute/angular/components";
|
|
@@ -3908,7 +4108,7 @@ ${slot.resolvedBindings.map((binding) => ` "${binding.key}": this.__absoluteDef
|
|
|
3908
4108
|
${fields}
|
|
3909
4109
|
`);
|
|
3910
4110
|
}, readAndEscapeFile = async (filePath, stylePreprocessors) => {
|
|
3911
|
-
if (!
|
|
4111
|
+
if (!existsSync5(filePath))
|
|
3912
4112
|
return null;
|
|
3913
4113
|
const content = await compileStyleFileIfNeeded(filePath, stylePreprocessors);
|
|
3914
4114
|
return escapeTemplateContent(content);
|
|
@@ -3916,7 +4116,7 @@ ${fields}
|
|
|
3916
4116
|
const templateUrlMatch = source.match(/templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
3917
4117
|
if (templateUrlMatch?.[1]) {
|
|
3918
4118
|
const templatePath = join5(fileDir, templateUrlMatch[1]);
|
|
3919
|
-
if (!
|
|
4119
|
+
if (!existsSync5(templatePath)) {
|
|
3920
4120
|
return { deferSlots: [], source };
|
|
3921
4121
|
}
|
|
3922
4122
|
const templateRaw2 = await fs.readFile(templatePath, "utf-8");
|
|
@@ -3947,10 +4147,10 @@ ${fields}
|
|
|
3947
4147
|
const templateUrlMatch = source.match(/templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
3948
4148
|
if (templateUrlMatch?.[1]) {
|
|
3949
4149
|
const templatePath = join5(fileDir, templateUrlMatch[1]);
|
|
3950
|
-
if (!
|
|
4150
|
+
if (!existsSync5(templatePath)) {
|
|
3951
4151
|
return { deferSlots: [], source };
|
|
3952
4152
|
}
|
|
3953
|
-
const templateRaw2 =
|
|
4153
|
+
const templateRaw2 = readFileSync4(templatePath, "utf-8");
|
|
3954
4154
|
const lowered2 = lowerAngularDeferSyntax(templateRaw2);
|
|
3955
4155
|
const escaped2 = escapeTemplateContent(lowered2.template);
|
|
3956
4156
|
const replacedSource2 = source.replace(/templateUrl\s*:\s*['"][^'"]+['"]/, `template: \`${escaped2}\``);
|
|
@@ -4061,7 +4261,7 @@ ${fields}
|
|
|
4061
4261
|
let actualPath = resolved;
|
|
4062
4262
|
if (!actualPath.endsWith(".ts"))
|
|
4063
4263
|
actualPath += ".ts";
|
|
4064
|
-
if (!
|
|
4264
|
+
if (!existsSync5(actualPath))
|
|
4065
4265
|
return;
|
|
4066
4266
|
let sourceCode = await fs.readFile(actualPath, "utf-8");
|
|
4067
4267
|
const inlined = await inlineResources(sourceCode, dirname4(actualPath), stylePreprocessors);
|
|
@@ -4085,7 +4285,7 @@ ${fields}
|
|
|
4085
4285
|
}
|
|
4086
4286
|
const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
|
|
4087
4287
|
const cacheKey = actualPath;
|
|
4088
|
-
if (jitContentCache.get(cacheKey) === contentHash &&
|
|
4288
|
+
if (jitContentCache.get(cacheKey) === contentHash && existsSync5(targetPath)) {
|
|
4089
4289
|
allOutputs.push(targetPath);
|
|
4090
4290
|
} else {
|
|
4091
4291
|
const processedContent = transpileAndRewrite(sourceCode, relativeDir, actualPath);
|
|
@@ -4113,7 +4313,7 @@ ${fields}
|
|
|
4113
4313
|
await fs.mkdir(indexesDir, { recursive: true });
|
|
4114
4314
|
const compileTasks = entryPoints.map(async (entry) => {
|
|
4115
4315
|
const resolvedEntry = resolve6(entry);
|
|
4116
|
-
const relativeEntry =
|
|
4316
|
+
const relativeEntry = relative3(outRoot, resolvedEntry).replace(/\.[tj]s$/, ".js");
|
|
4117
4317
|
const compileEntry = () => hmr ? compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot, stylePreprocessors) : compileAngularFile(resolvedEntry, compiledRoot, stylePreprocessors);
|
|
4118
4318
|
let outputs = await compileEntry();
|
|
4119
4319
|
const fileBase = basename3(resolvedEntry).replace(/\.[tj]s$/, "");
|
|
@@ -4128,12 +4328,12 @@ ${fields}
|
|
|
4128
4328
|
...candidatePaths.map((file) => resolve6(file)),
|
|
4129
4329
|
...compiledFallbackPaths
|
|
4130
4330
|
];
|
|
4131
|
-
let candidate = normalizedCandidates.find((file) =>
|
|
4331
|
+
let candidate = normalizedCandidates.find((file) => existsSync5(file) && file.endsWith(`${sep}pages${sep}${jsName}`));
|
|
4132
4332
|
if (!candidate) {
|
|
4133
|
-
candidate = normalizedCandidates.find((file) =>
|
|
4333
|
+
candidate = normalizedCandidates.find((file) => existsSync5(file) && file.endsWith(`${sep}${jsName}`));
|
|
4134
4334
|
}
|
|
4135
4335
|
if (!candidate) {
|
|
4136
|
-
candidate = normalizedCandidates.find((file) =>
|
|
4336
|
+
candidate = normalizedCandidates.find((file) => existsSync5(file));
|
|
4137
4337
|
}
|
|
4138
4338
|
return candidate;
|
|
4139
4339
|
};
|
|
@@ -4141,11 +4341,11 @@ ${fields}
|
|
|
4141
4341
|
if (!rawServerFile) {
|
|
4142
4342
|
rawServerFile = resolveRawServerFile([]);
|
|
4143
4343
|
}
|
|
4144
|
-
if (rawServerFile && !
|
|
4344
|
+
if (rawServerFile && !existsSync5(rawServerFile)) {
|
|
4145
4345
|
outputs = await compileEntry();
|
|
4146
4346
|
rawServerFile = resolveRawServerFile(outputs);
|
|
4147
4347
|
}
|
|
4148
|
-
if (!rawServerFile || !
|
|
4348
|
+
if (!rawServerFile || !existsSync5(rawServerFile)) {
|
|
4149
4349
|
throw new Error(`Compiled output not found for ${entry}. Looking for: ${jsName}. Available: ${[
|
|
4150
4350
|
...outputs,
|
|
4151
4351
|
...compiledFallbackPaths
|
|
@@ -4156,7 +4356,7 @@ ${fields}
|
|
|
4156
4356
|
const serverContentHash = Bun.hash(original).toString(BASE_36_RADIX);
|
|
4157
4357
|
const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
|
|
4158
4358
|
const clientFile = join5(indexesDir, jsName);
|
|
4159
|
-
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash &&
|
|
4359
|
+
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync5(clientFile)) {
|
|
4160
4360
|
return {
|
|
4161
4361
|
clientPath: clientFile,
|
|
4162
4362
|
indexUnchanged: true,
|
|
@@ -4190,7 +4390,7 @@ export default ${componentClassName};
|
|
|
4190
4390
|
await fs.writeFile(ssrDepsFile, ssrDepsContent, "utf-8");
|
|
4191
4391
|
}
|
|
4192
4392
|
await fs.writeFile(rawServerFile, rewritten, "utf-8");
|
|
4193
|
-
const relativePath =
|
|
4393
|
+
const relativePath = relative3(indexesDir, rawServerFile).replace(/\\/g, "/");
|
|
4194
4394
|
const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
4195
4395
|
const hmrPreamble = hmr ? `window.__HMR_FRAMEWORK__ = "angular";
|
|
4196
4396
|
import "${hmrRuntimePath}";
|
|
@@ -13736,5 +13936,5 @@ export {
|
|
|
13736
13936
|
Island
|
|
13737
13937
|
};
|
|
13738
13938
|
|
|
13739
|
-
//# debugId=
|
|
13939
|
+
//# debugId=996E4E3B3568CFA564756E2164756E21
|
|
13740
13940
|
//# sourceMappingURL=index.js.map
|