@absolutejs/absolute 0.19.0-beta.694 → 0.19.0-beta.695
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 +135 -11
- package/dist/angular/index.js.map +3 -3
- package/dist/angular/server.js +135 -11
- package/dist/angular/server.js.map +3 -3
- package/dist/build.js +158 -27
- package/dist/build.js.map +5 -5
- package/dist/cli/index.js +1 -0
- package/dist/index.js +1562 -1586
- package/dist/index.js.map +26 -33
- package/dist/islands/index.js +135 -11
- package/dist/islands/index.js.map +3 -3
- package/dist/react/index.js +140 -11
- package/dist/react/index.js.map +3 -3
- package/dist/react/server.js +6 -1
- package/dist/react/server.js.map +2 -2
- package/dist/src/build/stylePreprocessor.d.ts +2 -1
- package/dist/src/core/build.d.ts +1 -1
- package/dist/src/core/pageHandlers.d.ts +2 -1
- package/dist/svelte/index.js +135 -11
- package/dist/svelte/index.js.map +3 -3
- package/dist/svelte/server.js +135 -11
- package/dist/svelte/server.js.map +3 -3
- package/dist/types/build.d.ts +13 -0
- package/dist/vue/index.js +135 -11
- package/dist/vue/index.js.map +3 -3
- package/package.json +11 -7
package/dist/angular/index.js
CHANGED
|
@@ -1352,12 +1352,27 @@ var init_lowerAwaitSlotSyntax = __esm(() => {
|
|
|
1352
1352
|
});
|
|
1353
1353
|
|
|
1354
1354
|
// src/build/stylePreprocessor.ts
|
|
1355
|
+
var exports_stylePreprocessor = {};
|
|
1356
|
+
__export(exports_stylePreprocessor, {
|
|
1357
|
+
stylePreprocessorPlugin: () => stylePreprocessorPlugin,
|
|
1358
|
+
isStylePath: () => isStylePath,
|
|
1359
|
+
isStyleModulePath: () => isStyleModulePath,
|
|
1360
|
+
isPreprocessableStylePath: () => isPreprocessableStylePath,
|
|
1361
|
+
getStyleBaseName: () => getStyleBaseName,
|
|
1362
|
+
getCssOutputExtension: () => getCssOutputExtension,
|
|
1363
|
+
createSvelteStylePreprocessor: () => createSvelteStylePreprocessor,
|
|
1364
|
+
createStyleTransformConfig: () => createStyleTransformConfig,
|
|
1365
|
+
createStylePreprocessorPlugin: () => createStylePreprocessorPlugin,
|
|
1366
|
+
compileStyleSource: () => compileStyleSource,
|
|
1367
|
+
compileStyleFileIfNeededSync: () => compileStyleFileIfNeededSync,
|
|
1368
|
+
compileStyleFileIfNeeded: () => compileStyleFileIfNeeded
|
|
1369
|
+
});
|
|
1355
1370
|
import { existsSync as existsSync4, readFileSync as readFileSync3 } from "fs";
|
|
1356
1371
|
import { readFile } from "fs/promises";
|
|
1357
1372
|
import { createRequire } from "module";
|
|
1358
1373
|
import { dirname as dirname2, extname, isAbsolute, join as join3, relative, resolve as resolve4 } from "path";
|
|
1359
1374
|
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) => {
|
|
1375
|
+
var CSS_EXTENSION_PATTERN, 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) => {
|
|
1361
1376
|
const normalized = filePathOrLanguage.toLowerCase();
|
|
1362
1377
|
if (normalized === "scss" || normalized.endsWith(".scss"))
|
|
1363
1378
|
return "scss";
|
|
@@ -1368,7 +1383,13 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
1368
1383
|
if (normalized === "styl" || normalized === "stylus" || normalized.endsWith(".styl") || normalized.endsWith(".stylus"))
|
|
1369
1384
|
return "stylus";
|
|
1370
1385
|
return null;
|
|
1371
|
-
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`),
|
|
1386
|
+
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`), requireOptionalPeerSync = (specifier) => {
|
|
1387
|
+
try {
|
|
1388
|
+
return requireFromCwd(specifier);
|
|
1389
|
+
} catch {
|
|
1390
|
+
return requireOptionalPeer(specifier);
|
|
1391
|
+
}
|
|
1392
|
+
}, normalizeLoadPaths = (filePath, paths = []) => [
|
|
1372
1393
|
dirname2(filePath),
|
|
1373
1394
|
process.cwd(),
|
|
1374
1395
|
...paths.map((path) => resolve4(process.cwd(), path))
|
|
@@ -1497,8 +1518,72 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
1497
1518
|
}, getSassOptions = (config, language) => ({
|
|
1498
1519
|
...config?.sass ?? {},
|
|
1499
1520
|
...language === "scss" ? config?.scss ?? {} : {}
|
|
1500
|
-
}), getLessOptions = (config) => config?.less ?? {}, getStylusOptions = (config) => config?.stylus ?? {}, withAdditionalData = (contents, additionalData) => additionalData ? `${additionalData}
|
|
1501
|
-
${contents}` : contents,
|
|
1521
|
+
}), getLessOptions = (config) => config?.less ?? {}, getStylusOptions = (config) => config?.stylus ?? {}, createStyleTransformConfig = (stylePreprocessors, postcss) => postcss === undefined ? stylePreprocessors : { ...stylePreprocessors ?? {}, postcss }, withAdditionalData = (contents, additionalData) => additionalData ? `${additionalData}
|
|
1522
|
+
${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
1523
|
+
if (mod && typeof mod === "object" && "default" in mod) {
|
|
1524
|
+
return mod.default ?? mod;
|
|
1525
|
+
}
|
|
1526
|
+
return mod;
|
|
1527
|
+
}, loadPostcssConfigFile = async (configPath) => {
|
|
1528
|
+
const resolved = resolve4(process.cwd(), configPath);
|
|
1529
|
+
const loaded = resolved.endsWith(".cjs") || resolved.endsWith(".cts") ? requireOptionalPeerSync(resolved) : await importOptionalPeer(`${new URL(`file://${resolved}`).href}?t=${Date.now()}`);
|
|
1530
|
+
const config = normalizePostcssModule(loaded);
|
|
1531
|
+
const value = typeof config === "function" ? await config({
|
|
1532
|
+
cwd: process.cwd(),
|
|
1533
|
+
env: "development"
|
|
1534
|
+
}) : config;
|
|
1535
|
+
return normalizePostcssModule(value) ?? {};
|
|
1536
|
+
}, normalizePostcssPlugins = (plugins) => {
|
|
1537
|
+
if (!plugins)
|
|
1538
|
+
return [];
|
|
1539
|
+
if (Array.isArray(plugins))
|
|
1540
|
+
return plugins.filter(Boolean);
|
|
1541
|
+
const resolved = [];
|
|
1542
|
+
for (const [specifier, options] of Object.entries(plugins)) {
|
|
1543
|
+
if (options === false)
|
|
1544
|
+
continue;
|
|
1545
|
+
const mod = normalizePostcssModule(requireOptionalPeerSync(specifier));
|
|
1546
|
+
const plugin = typeof mod === "function" ? mod(options === true ? undefined : options) : mod;
|
|
1547
|
+
if (plugin)
|
|
1548
|
+
resolved.push(plugin);
|
|
1549
|
+
}
|
|
1550
|
+
return resolved;
|
|
1551
|
+
}, resolvePostcssConfig = async (config) => {
|
|
1552
|
+
const inlineConfig = config?.postcss;
|
|
1553
|
+
if (!inlineConfig)
|
|
1554
|
+
return null;
|
|
1555
|
+
const fileConfig = inlineConfig.config ? await loadPostcssConfigFile(inlineConfig.config) : {};
|
|
1556
|
+
const plugins = [
|
|
1557
|
+
...normalizePostcssPlugins(fileConfig.plugins),
|
|
1558
|
+
...normalizePostcssPlugins(inlineConfig.plugins)
|
|
1559
|
+
];
|
|
1560
|
+
if (plugins.length === 0)
|
|
1561
|
+
return null;
|
|
1562
|
+
return {
|
|
1563
|
+
options: {
|
|
1564
|
+
...fileConfig.options ?? {},
|
|
1565
|
+
...inlineConfig.options ?? {}
|
|
1566
|
+
},
|
|
1567
|
+
plugins
|
|
1568
|
+
};
|
|
1569
|
+
}, runPostcss = async (css, filePath, config) => {
|
|
1570
|
+
const postcssConfig = await resolvePostcssConfig(config);
|
|
1571
|
+
if (!postcssConfig)
|
|
1572
|
+
return css;
|
|
1573
|
+
let postcssModule;
|
|
1574
|
+
try {
|
|
1575
|
+
postcssModule = await importOptionalPeer("postcss");
|
|
1576
|
+
} catch {
|
|
1577
|
+
throw missingDependencyError("postcss", filePath);
|
|
1578
|
+
}
|
|
1579
|
+
const postcss = postcssModule.default ?? postcssModule;
|
|
1580
|
+
const result = await postcss(postcssConfig.plugins).process(css, {
|
|
1581
|
+
from: filePath,
|
|
1582
|
+
map: false,
|
|
1583
|
+
...postcssConfig.options
|
|
1584
|
+
});
|
|
1585
|
+
return result.css;
|
|
1586
|
+
}, createSassImporter = (entryFile, loadPaths, language, config) => ({
|
|
1502
1587
|
canonicalize(specifier, options) {
|
|
1503
1588
|
const fromDirectory = options.containingUrl ? dirname2(fileURLToPath(options.containingUrl)) : dirname2(entryFile);
|
|
1504
1589
|
const resolved = resolveImportPath(specifier, fromDirectory, loadPaths, language, config);
|
|
@@ -1577,7 +1662,7 @@ ${contents}` : contents, createSassImporter = (entryFile, loadPaths, language, c
|
|
|
1577
1662
|
syntax: language === "sass" ? "indented" : "scss",
|
|
1578
1663
|
url: new URL(`file://${filePath}`)
|
|
1579
1664
|
});
|
|
1580
|
-
return result.css;
|
|
1665
|
+
return runPostcss(result.css, filePath, config);
|
|
1581
1666
|
}
|
|
1582
1667
|
if (language === "less") {
|
|
1583
1668
|
const options = getLessOptions(config);
|
|
@@ -1602,15 +1687,15 @@ ${contents}` : contents, createSassImporter = (entryFile, loadPaths, language, c
|
|
|
1602
1687
|
createLessFileManager(filePath, loadPaths, config)
|
|
1603
1688
|
]
|
|
1604
1689
|
});
|
|
1605
|
-
return result.css;
|
|
1690
|
+
return runPostcss(result.css, filePath, config);
|
|
1606
1691
|
}
|
|
1607
1692
|
if (language === "stylus") {
|
|
1608
1693
|
const options = getStylusOptions(config);
|
|
1609
1694
|
const loadPaths = normalizeLoadPaths(filePath, options.paths);
|
|
1610
1695
|
const contents = withAdditionalData(preprocessLoadedStyle(rawContents, filePath, filePath, loadPaths, "stylus", config), options.additionalData);
|
|
1611
|
-
return renderStylus(contents, filePath, loadPaths, options);
|
|
1696
|
+
return runPostcss(await renderStylus(contents, filePath, loadPaths, options), filePath, config);
|
|
1612
1697
|
}
|
|
1613
|
-
return rawContents;
|
|
1698
|
+
return runPostcss(rawContents, filePath, config);
|
|
1614
1699
|
}, createStylePreprocessorPlugin = (config) => ({
|
|
1615
1700
|
name: "absolute-style-preprocessor",
|
|
1616
1701
|
setup(build) {
|
|
@@ -1646,6 +1731,10 @@ ${contents}` : contents, createSassImporter = (entryFile, loadPaths, language, c
|
|
|
1646
1731
|
loader: "css"
|
|
1647
1732
|
};
|
|
1648
1733
|
});
|
|
1734
|
+
build.onLoad({ filter: CSS_EXTENSION_PATTERN }, async ({ path }) => ({
|
|
1735
|
+
contents: await compileStyleSource(path, undefined, undefined, config),
|
|
1736
|
+
loader: "css"
|
|
1737
|
+
}));
|
|
1649
1738
|
}
|
|
1650
1739
|
}), stylePreprocessorPlugin, createSvelteStylePreprocessor = (config) => ({
|
|
1651
1740
|
style: async ({
|
|
@@ -1663,11 +1752,46 @@ ${contents}` : contents, createSassImporter = (entryFile, loadPaths, language, c
|
|
|
1663
1752
|
}
|
|
1664
1753
|
}), compileStyleFileIfNeeded = async (filePath, config) => {
|
|
1665
1754
|
if (!isPreprocessableStylePath(filePath)) {
|
|
1666
|
-
return readFile(filePath, "utf-8");
|
|
1755
|
+
return runPostcss(await readFile(filePath, "utf-8"), filePath, config);
|
|
1667
1756
|
}
|
|
1668
1757
|
return compileStyleSource(filePath, undefined, undefined, config);
|
|
1669
|
-
}
|
|
1758
|
+
}, compileStyleFileIfNeededSync = (filePath, config) => {
|
|
1759
|
+
const rawContents = readFileSync3(filePath, "utf-8");
|
|
1760
|
+
const language = getStyleLanguage(filePath);
|
|
1761
|
+
if (config?.postcss) {
|
|
1762
|
+
throw new Error(`Unable to compile ${filePath}: PostCSS preprocessing is async-only.`);
|
|
1763
|
+
}
|
|
1764
|
+
if (language === "scss" || language === "sass") {
|
|
1765
|
+
const options = getSassOptions(config, language);
|
|
1766
|
+
const packageName = options.implementation ?? "sass";
|
|
1767
|
+
let sass;
|
|
1768
|
+
try {
|
|
1769
|
+
sass = requireOptionalPeerSync(packageName);
|
|
1770
|
+
} catch {
|
|
1771
|
+
throw missingDependencyError(packageName, filePath);
|
|
1772
|
+
}
|
|
1773
|
+
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
1774
|
+
const loadPaths = normalizeLoadPaths(filePath, options.loadPaths);
|
|
1775
|
+
return sass.compileString(contents, {
|
|
1776
|
+
importers: [
|
|
1777
|
+
createSassImporter(filePath, loadPaths, language, config)
|
|
1778
|
+
],
|
|
1779
|
+
loadPaths,
|
|
1780
|
+
style: "expanded",
|
|
1781
|
+
syntax: language === "sass" ? "indented" : "scss",
|
|
1782
|
+
url: new URL(`file://${filePath}`)
|
|
1783
|
+
}).css;
|
|
1784
|
+
}
|
|
1785
|
+
if (language === "less") {
|
|
1786
|
+
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.`);
|
|
1787
|
+
}
|
|
1788
|
+
if (language === "stylus") {
|
|
1789
|
+
throw new Error(`Unable to compile ${filePath}: Stylus styleUrl preprocessing is async-only. Import the Stylus file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
|
|
1790
|
+
}
|
|
1791
|
+
return rawContents;
|
|
1792
|
+
}, getCssOutputExtension = (filePath) => isPreprocessableStylePath(filePath) ? ".css" : extname(filePath);
|
|
1670
1793
|
var init_stylePreprocessor = __esm(() => {
|
|
1794
|
+
CSS_EXTENSION_PATTERN = /\.css$/i;
|
|
1671
1795
|
STYLE_EXTENSION_PATTERN = /\.(s[ac]ss|less|styl(?:us)?)$/i;
|
|
1672
1796
|
STYLE_MODULE_EXTENSION_PATTERN = /\.module\.(s[ac]ss|less|styl(?:us)?)$/i;
|
|
1673
1797
|
STYLE_LANGUAGE_PATTERN = /^(s[ac]ss|less|styl(?:us)?)$/i;
|
|
@@ -13936,5 +14060,5 @@ export {
|
|
|
13936
14060
|
Island
|
|
13937
14061
|
};
|
|
13938
14062
|
|
|
13939
|
-
//# debugId=
|
|
14063
|
+
//# debugId=7891B9A2E603847264756E2164756E21
|
|
13940
14064
|
//# sourceMappingURL=index.js.map
|