@absolutejs/absolute 0.19.0-beta.782 → 0.19.0-beta.783
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 +118 -31
- package/dist/angular/index.js.map +3 -3
- package/dist/angular/server.js +118 -31
- package/dist/angular/server.js.map +3 -3
- package/dist/build.js +159 -40
- package/dist/build.js.map +5 -5
- package/dist/cli/index.js +6 -3
- package/dist/index.js +165 -43
- package/dist/index.js.map +6 -6
- package/dist/islands/index.js +118 -31
- package/dist/islands/index.js.map +3 -3
- package/dist/react/index.js +118 -31
- package/dist/react/index.js.map +3 -3
- package/dist/src/build/stylePreprocessor.d.ts +3 -0
- package/dist/svelte/index.js +118 -31
- package/dist/svelte/index.js.map +3 -3
- package/dist/svelte/server.js +118 -31
- package/dist/svelte/server.js.map +3 -3
- package/dist/vue/index.js +118 -31
- package/dist/vue/index.js.map +3 -3
- package/package.json +1 -1
package/dist/angular/index.js
CHANGED
|
@@ -969,11 +969,14 @@ var init_lowerAwaitSlotSyntax = __esm(() => {
|
|
|
969
969
|
var exports_stylePreprocessor = {};
|
|
970
970
|
__export(exports_stylePreprocessor, {
|
|
971
971
|
stylePreprocessorPlugin: () => stylePreprocessorPlugin,
|
|
972
|
+
recordStyleOutput: () => recordStyleOutput,
|
|
972
973
|
isStylePath: () => isStylePath,
|
|
973
974
|
isStyleModulePath: () => isStyleModulePath,
|
|
974
975
|
isPreprocessableStylePath: () => isPreprocessableStylePath,
|
|
975
976
|
getStyleBaseName: () => getStyleBaseName,
|
|
976
977
|
getCssOutputExtension: () => getCssOutputExtension,
|
|
978
|
+
forgetStyleEntry: () => forgetStyleEntry,
|
|
979
|
+
findStyleEntriesImporting: () => findStyleEntriesImporting,
|
|
977
980
|
createSvelteStylePreprocessor: () => createSvelteStylePreprocessor,
|
|
978
981
|
createStyleTransformConfig: () => createStyleTransformConfig,
|
|
979
982
|
createStylePreprocessorPlugin: () => createStylePreprocessorPlugin,
|
|
@@ -981,10 +984,18 @@ __export(exports_stylePreprocessor, {
|
|
|
981
984
|
compileStyleFileIfNeededSync: () => compileStyleFileIfNeededSync,
|
|
982
985
|
compileStyleFileIfNeeded: () => compileStyleFileIfNeeded
|
|
983
986
|
});
|
|
987
|
+
import { createHash } from "crypto";
|
|
984
988
|
import { existsSync as existsSync4, readFileSync as readFileSync4 } from "fs";
|
|
985
989
|
import { readFile } from "fs/promises";
|
|
986
990
|
import { createRequire } from "module";
|
|
987
|
-
import {
|
|
991
|
+
import {
|
|
992
|
+
dirname as dirname2,
|
|
993
|
+
extname,
|
|
994
|
+
isAbsolute,
|
|
995
|
+
join as join4,
|
|
996
|
+
relative,
|
|
997
|
+
resolve as resolve3
|
|
998
|
+
} from "path";
|
|
988
999
|
import { fileURLToPath } from "url";
|
|
989
1000
|
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) => {
|
|
990
1001
|
const normalized = filePathOrLanguage.toLowerCase();
|
|
@@ -997,7 +1008,22 @@ var CSS_EXTENSION_PATTERN, STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTE
|
|
|
997
1008
|
if (normalized === "styl" || normalized === "stylus" || normalized.endsWith(".styl") || normalized.endsWith(".stylus"))
|
|
998
1009
|
return "stylus";
|
|
999
1010
|
return null;
|
|
1000
|
-
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`),
|
|
1011
|
+
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`), throwPreprocessorError = (error, filePath, language) => {
|
|
1012
|
+
if (!(error instanceof Error)) {
|
|
1013
|
+
throw new Error(`${language} compile failed in ${filePath}: ${String(error)}`);
|
|
1014
|
+
}
|
|
1015
|
+
const detail = error;
|
|
1016
|
+
const sassLine = detail.span?.start?.line;
|
|
1017
|
+
const sassCol = detail.span?.start?.column;
|
|
1018
|
+
const line = detail.line ?? sassLine;
|
|
1019
|
+
const column = detail.column ?? sassCol;
|
|
1020
|
+
const location = typeof line === "number" ? `:${line}${typeof column === "number" ? `:${column}` : ""}` : "";
|
|
1021
|
+
const message = detail.formatted ?? detail.message;
|
|
1022
|
+
const wrapped = new Error(`${language} compile failed in ${filePath}${location}
|
|
1023
|
+
${message}`);
|
|
1024
|
+
wrapped.cause = error;
|
|
1025
|
+
throw wrapped;
|
|
1026
|
+
}, requireOptionalPeerSync = (specifier) => {
|
|
1001
1027
|
try {
|
|
1002
1028
|
return requireFromCwd(specifier);
|
|
1003
1029
|
} catch {
|
|
@@ -1036,7 +1062,10 @@ var CSS_EXTENSION_PATTERN, STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTE
|
|
|
1036
1062
|
}, getAliasEntries = (config) => {
|
|
1037
1063
|
const tsconfig = readTsconfigAliases();
|
|
1038
1064
|
return {
|
|
1039
|
-
aliases: [
|
|
1065
|
+
aliases: [
|
|
1066
|
+
...normalizeAliasEntries(config?.aliases),
|
|
1067
|
+
...tsconfig.aliases
|
|
1068
|
+
],
|
|
1040
1069
|
baseUrl: tsconfig.baseUrl
|
|
1041
1070
|
};
|
|
1042
1071
|
}, aliasPatternToRegExp = (pattern) => new RegExp(`^${pattern.split("*").map((part) => part.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("(.+)")}$`), resolveAliasTargets = (specifier, config) => {
|
|
@@ -1197,7 +1226,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
1197
1226
|
...postcssConfig.options
|
|
1198
1227
|
});
|
|
1199
1228
|
return result.css;
|
|
1200
|
-
}, createSassImporter = (entryFile, loadPaths, language, config) => ({
|
|
1229
|
+
}, createSassImporter = (entryFile, loadPaths, language, config, deps) => ({
|
|
1201
1230
|
canonicalize(specifier, options) {
|
|
1202
1231
|
const fromDirectory = options.containingUrl ? dirname2(fileURLToPath(options.containingUrl)) : dirname2(entryFile);
|
|
1203
1232
|
const resolved = resolveImportPath(specifier, fromDirectory, loadPaths, language, config);
|
|
@@ -1205,6 +1234,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
1205
1234
|
},
|
|
1206
1235
|
load(canonicalUrl) {
|
|
1207
1236
|
const filePath = fileURLToPath(canonicalUrl);
|
|
1237
|
+
deps?.add(filePath);
|
|
1208
1238
|
const fileLanguage = getStyleLanguage(filePath);
|
|
1209
1239
|
if (fileLanguage !== "scss" && fileLanguage !== "sass" && fileLanguage !== null)
|
|
1210
1240
|
return null;
|
|
@@ -1213,7 +1243,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
1213
1243
|
syntax: filePath.endsWith(".sass") ? "indented" : "scss"
|
|
1214
1244
|
};
|
|
1215
1245
|
}
|
|
1216
|
-
}), createLessFileManager = (entryFile, loadPaths, config) => ({
|
|
1246
|
+
}), createLessFileManager = (entryFile, loadPaths, config, deps) => ({
|
|
1217
1247
|
install(less, pluginManager) {
|
|
1218
1248
|
const baseManager = new less.FileManager;
|
|
1219
1249
|
const manager = Object.create(baseManager);
|
|
@@ -1223,6 +1253,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
1223
1253
|
if (!resolved) {
|
|
1224
1254
|
throw new Error(`Unable to resolve Less import "${filename}"`);
|
|
1225
1255
|
}
|
|
1256
|
+
deps?.add(resolved);
|
|
1226
1257
|
return {
|
|
1227
1258
|
contents: preprocessLoadedStyle(await readFile(resolved, "utf-8"), resolved, entryFile, loadPaths, "less", config),
|
|
1228
1259
|
filename: resolved
|
|
@@ -1230,7 +1261,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
1230
1261
|
};
|
|
1231
1262
|
pluginManager.addFileManager(manager);
|
|
1232
1263
|
}
|
|
1233
|
-
}), renderStylus = async (contents, filePath, loadPaths, options) => {
|
|
1264
|
+
}), renderStylus = async (contents, filePath, loadPaths, options, deps) => {
|
|
1234
1265
|
let stylus;
|
|
1235
1266
|
try {
|
|
1236
1267
|
const stylusModule = await importOptionalPeer("stylus");
|
|
@@ -1247,15 +1278,51 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
1247
1278
|
for (const path of loadPaths)
|
|
1248
1279
|
renderer.include(path);
|
|
1249
1280
|
renderer.render((error, css) => {
|
|
1250
|
-
if (error)
|
|
1281
|
+
if (error) {
|
|
1251
1282
|
reject(error);
|
|
1252
|
-
|
|
1253
|
-
|
|
1283
|
+
return;
|
|
1284
|
+
}
|
|
1285
|
+
if (deps) {
|
|
1286
|
+
const stylusDeps = renderer.deps?.();
|
|
1287
|
+
if (Array.isArray(stylusDeps)) {
|
|
1288
|
+
for (const dep of stylusDeps)
|
|
1289
|
+
deps.add(resolve3(dep));
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
resolveCss(css ?? "");
|
|
1254
1293
|
});
|
|
1255
1294
|
});
|
|
1295
|
+
}, styleDependencyGraph, styleOutputHashes, recordStyleDeps = (entry, deps) => {
|
|
1296
|
+
const key = resolve3(entry);
|
|
1297
|
+
const stripped = new Set;
|
|
1298
|
+
for (const dep of deps) {
|
|
1299
|
+
const resolved = resolve3(dep);
|
|
1300
|
+
if (resolved !== key)
|
|
1301
|
+
stripped.add(resolved);
|
|
1302
|
+
}
|
|
1303
|
+
styleDependencyGraph.set(key, stripped);
|
|
1304
|
+
}, findStyleEntriesImporting = (changedPath) => {
|
|
1305
|
+
const target = resolve3(changedPath);
|
|
1306
|
+
const importers = [];
|
|
1307
|
+
for (const [entry, deps] of styleDependencyGraph) {
|
|
1308
|
+
if (deps.has(target))
|
|
1309
|
+
importers.push(entry);
|
|
1310
|
+
}
|
|
1311
|
+
return importers;
|
|
1312
|
+
}, recordStyleOutput = (entry, css) => {
|
|
1313
|
+
const key = resolve3(entry);
|
|
1314
|
+
const hash = createHash("sha1").update(css).digest("hex");
|
|
1315
|
+
const previous = styleOutputHashes.get(key);
|
|
1316
|
+
styleOutputHashes.set(key, hash);
|
|
1317
|
+
return previous !== hash;
|
|
1318
|
+
}, forgetStyleEntry = (entry) => {
|
|
1319
|
+
const key = resolve3(entry);
|
|
1320
|
+
styleDependencyGraph.delete(key);
|
|
1321
|
+
styleOutputHashes.delete(key);
|
|
1256
1322
|
}, compileStyleSource = async (filePath, source, languageHint, config) => {
|
|
1257
1323
|
const language = getStyleLanguage(languageHint ?? filePath);
|
|
1258
1324
|
const rawContents = source ?? await readFile(filePath, "utf-8");
|
|
1325
|
+
const deps = new Set;
|
|
1259
1326
|
if (language === "scss" || language === "sass") {
|
|
1260
1327
|
const options = getSassOptions(config, language);
|
|
1261
1328
|
const packageName = options.implementation ?? "sass";
|
|
@@ -1267,16 +1334,22 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
1267
1334
|
}
|
|
1268
1335
|
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
1269
1336
|
const loadPaths = normalizeLoadPaths(filePath, options.loadPaths);
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1337
|
+
try {
|
|
1338
|
+
const result = sass.compileString(contents, {
|
|
1339
|
+
importers: [
|
|
1340
|
+
createSassImporter(filePath, loadPaths, language, config, deps)
|
|
1341
|
+
],
|
|
1342
|
+
loadPaths,
|
|
1343
|
+
style: "expanded",
|
|
1344
|
+
syntax: language === "sass" ? "indented" : "scss",
|
|
1345
|
+
url: new URL(`file://${filePath}`)
|
|
1346
|
+
});
|
|
1347
|
+
const css = await runPostcss(result.css, filePath, config);
|
|
1348
|
+
recordStyleDeps(filePath, deps);
|
|
1349
|
+
return css;
|
|
1350
|
+
} catch (error) {
|
|
1351
|
+
throwPreprocessorError(error, filePath, language);
|
|
1352
|
+
}
|
|
1280
1353
|
}
|
|
1281
1354
|
if (language === "less") {
|
|
1282
1355
|
const options = getLessOptions(config);
|
|
@@ -1292,22 +1365,34 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
1292
1365
|
throw missingDependencyError("less", filePath);
|
|
1293
1366
|
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
1294
1367
|
const loadPaths = normalizeLoadPaths(filePath, options.paths);
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1368
|
+
try {
|
|
1369
|
+
const result = await render(contents, {
|
|
1370
|
+
...options.options ?? {},
|
|
1371
|
+
filename: filePath,
|
|
1372
|
+
paths: loadPaths,
|
|
1373
|
+
plugins: [
|
|
1374
|
+
...options.options?.plugins ?? [],
|
|
1375
|
+
createLessFileManager(filePath, loadPaths, config, deps)
|
|
1376
|
+
]
|
|
1377
|
+
});
|
|
1378
|
+
const css = await runPostcss(result.css, filePath, config);
|
|
1379
|
+
recordStyleDeps(filePath, deps);
|
|
1380
|
+
return css;
|
|
1381
|
+
} catch (error) {
|
|
1382
|
+
throwPreprocessorError(error, filePath, "less");
|
|
1383
|
+
}
|
|
1305
1384
|
}
|
|
1306
1385
|
if (language === "stylus") {
|
|
1307
1386
|
const options = getStylusOptions(config);
|
|
1308
1387
|
const loadPaths = normalizeLoadPaths(filePath, options.paths);
|
|
1309
1388
|
const contents = withAdditionalData(preprocessLoadedStyle(rawContents, filePath, filePath, loadPaths, "stylus", config), options.additionalData);
|
|
1310
|
-
|
|
1389
|
+
try {
|
|
1390
|
+
const css = await runPostcss(await renderStylus(contents, filePath, loadPaths, options, deps), filePath, config);
|
|
1391
|
+
recordStyleDeps(filePath, deps);
|
|
1392
|
+
return css;
|
|
1393
|
+
} catch (error) {
|
|
1394
|
+
throwPreprocessorError(error, filePath, "stylus");
|
|
1395
|
+
}
|
|
1311
1396
|
}
|
|
1312
1397
|
return runPostcss(rawContents, filePath, config);
|
|
1313
1398
|
}, createStylePreprocessorPlugin = (config) => ({
|
|
@@ -1412,6 +1497,8 @@ var init_stylePreprocessor = __esm(() => {
|
|
|
1412
1497
|
importOptionalPeer = new Function("specifier", "return import(specifier)");
|
|
1413
1498
|
requireOptionalPeer = new Function("specifier", "return require(specifier)");
|
|
1414
1499
|
requireFromCwd = createRequire(join4(process.cwd(), "package.json"));
|
|
1500
|
+
styleDependencyGraph = new Map;
|
|
1501
|
+
styleOutputHashes = new Map;
|
|
1415
1502
|
stylePreprocessorPlugin = createStylePreprocessorPlugin();
|
|
1416
1503
|
});
|
|
1417
1504
|
|
|
@@ -14951,5 +15038,5 @@ export {
|
|
|
14951
15038
|
ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER
|
|
14952
15039
|
};
|
|
14953
15040
|
|
|
14954
|
-
//# debugId=
|
|
15041
|
+
//# debugId=A1258FF43E3F125764756E2164756E21
|
|
14955
15042
|
//# sourceMappingURL=index.js.map
|