@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/react/index.js
CHANGED
|
@@ -1940,11 +1940,14 @@ var init_lowerAwaitSlotSyntax = __esm(() => {
|
|
|
1940
1940
|
var exports_stylePreprocessor = {};
|
|
1941
1941
|
__export(exports_stylePreprocessor, {
|
|
1942
1942
|
stylePreprocessorPlugin: () => stylePreprocessorPlugin,
|
|
1943
|
+
recordStyleOutput: () => recordStyleOutput,
|
|
1943
1944
|
isStylePath: () => isStylePath,
|
|
1944
1945
|
isStyleModulePath: () => isStyleModulePath,
|
|
1945
1946
|
isPreprocessableStylePath: () => isPreprocessableStylePath,
|
|
1946
1947
|
getStyleBaseName: () => getStyleBaseName,
|
|
1947
1948
|
getCssOutputExtension: () => getCssOutputExtension,
|
|
1949
|
+
forgetStyleEntry: () => forgetStyleEntry,
|
|
1950
|
+
findStyleEntriesImporting: () => findStyleEntriesImporting,
|
|
1948
1951
|
createSvelteStylePreprocessor: () => createSvelteStylePreprocessor,
|
|
1949
1952
|
createStyleTransformConfig: () => createStyleTransformConfig,
|
|
1950
1953
|
createStylePreprocessorPlugin: () => createStylePreprocessorPlugin,
|
|
@@ -1952,10 +1955,18 @@ __export(exports_stylePreprocessor, {
|
|
|
1952
1955
|
compileStyleFileIfNeededSync: () => compileStyleFileIfNeededSync,
|
|
1953
1956
|
compileStyleFileIfNeeded: () => compileStyleFileIfNeeded
|
|
1954
1957
|
});
|
|
1958
|
+
import { createHash } from "crypto";
|
|
1955
1959
|
import { existsSync as existsSync4, readFileSync as readFileSync4 } from "fs";
|
|
1956
1960
|
import { readFile } from "fs/promises";
|
|
1957
1961
|
import { createRequire } from "module";
|
|
1958
|
-
import {
|
|
1962
|
+
import {
|
|
1963
|
+
dirname as dirname2,
|
|
1964
|
+
extname,
|
|
1965
|
+
isAbsolute,
|
|
1966
|
+
join as join4,
|
|
1967
|
+
relative,
|
|
1968
|
+
resolve as resolve3
|
|
1969
|
+
} from "path";
|
|
1959
1970
|
import { fileURLToPath } from "url";
|
|
1960
1971
|
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) => {
|
|
1961
1972
|
const normalized = filePathOrLanguage.toLowerCase();
|
|
@@ -1968,7 +1979,22 @@ var CSS_EXTENSION_PATTERN, STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTE
|
|
|
1968
1979
|
if (normalized === "styl" || normalized === "stylus" || normalized.endsWith(".styl") || normalized.endsWith(".stylus"))
|
|
1969
1980
|
return "stylus";
|
|
1970
1981
|
return null;
|
|
1971
|
-
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`),
|
|
1982
|
+
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`), throwPreprocessorError = (error, filePath, language) => {
|
|
1983
|
+
if (!(error instanceof Error)) {
|
|
1984
|
+
throw new Error(`${language} compile failed in ${filePath}: ${String(error)}`);
|
|
1985
|
+
}
|
|
1986
|
+
const detail = error;
|
|
1987
|
+
const sassLine = detail.span?.start?.line;
|
|
1988
|
+
const sassCol = detail.span?.start?.column;
|
|
1989
|
+
const line = detail.line ?? sassLine;
|
|
1990
|
+
const column = detail.column ?? sassCol;
|
|
1991
|
+
const location = typeof line === "number" ? `:${line}${typeof column === "number" ? `:${column}` : ""}` : "";
|
|
1992
|
+
const message = detail.formatted ?? detail.message;
|
|
1993
|
+
const wrapped = new Error(`${language} compile failed in ${filePath}${location}
|
|
1994
|
+
${message}`);
|
|
1995
|
+
wrapped.cause = error;
|
|
1996
|
+
throw wrapped;
|
|
1997
|
+
}, requireOptionalPeerSync = (specifier) => {
|
|
1972
1998
|
try {
|
|
1973
1999
|
return requireFromCwd(specifier);
|
|
1974
2000
|
} catch {
|
|
@@ -2007,7 +2033,10 @@ var CSS_EXTENSION_PATTERN, STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTE
|
|
|
2007
2033
|
}, getAliasEntries = (config) => {
|
|
2008
2034
|
const tsconfig = readTsconfigAliases();
|
|
2009
2035
|
return {
|
|
2010
|
-
aliases: [
|
|
2036
|
+
aliases: [
|
|
2037
|
+
...normalizeAliasEntries(config?.aliases),
|
|
2038
|
+
...tsconfig.aliases
|
|
2039
|
+
],
|
|
2011
2040
|
baseUrl: tsconfig.baseUrl
|
|
2012
2041
|
};
|
|
2013
2042
|
}, aliasPatternToRegExp = (pattern) => new RegExp(`^${pattern.split("*").map((part) => part.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("(.+)")}$`), resolveAliasTargets = (specifier, config) => {
|
|
@@ -2168,7 +2197,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2168
2197
|
...postcssConfig.options
|
|
2169
2198
|
});
|
|
2170
2199
|
return result.css;
|
|
2171
|
-
}, createSassImporter = (entryFile, loadPaths, language, config) => ({
|
|
2200
|
+
}, createSassImporter = (entryFile, loadPaths, language, config, deps) => ({
|
|
2172
2201
|
canonicalize(specifier, options) {
|
|
2173
2202
|
const fromDirectory = options.containingUrl ? dirname2(fileURLToPath(options.containingUrl)) : dirname2(entryFile);
|
|
2174
2203
|
const resolved = resolveImportPath(specifier, fromDirectory, loadPaths, language, config);
|
|
@@ -2176,6 +2205,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2176
2205
|
},
|
|
2177
2206
|
load(canonicalUrl) {
|
|
2178
2207
|
const filePath = fileURLToPath(canonicalUrl);
|
|
2208
|
+
deps?.add(filePath);
|
|
2179
2209
|
const fileLanguage = getStyleLanguage(filePath);
|
|
2180
2210
|
if (fileLanguage !== "scss" && fileLanguage !== "sass" && fileLanguage !== null)
|
|
2181
2211
|
return null;
|
|
@@ -2184,7 +2214,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2184
2214
|
syntax: filePath.endsWith(".sass") ? "indented" : "scss"
|
|
2185
2215
|
};
|
|
2186
2216
|
}
|
|
2187
|
-
}), createLessFileManager = (entryFile, loadPaths, config) => ({
|
|
2217
|
+
}), createLessFileManager = (entryFile, loadPaths, config, deps) => ({
|
|
2188
2218
|
install(less, pluginManager) {
|
|
2189
2219
|
const baseManager = new less.FileManager;
|
|
2190
2220
|
const manager = Object.create(baseManager);
|
|
@@ -2194,6 +2224,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2194
2224
|
if (!resolved) {
|
|
2195
2225
|
throw new Error(`Unable to resolve Less import "${filename}"`);
|
|
2196
2226
|
}
|
|
2227
|
+
deps?.add(resolved);
|
|
2197
2228
|
return {
|
|
2198
2229
|
contents: preprocessLoadedStyle(await readFile(resolved, "utf-8"), resolved, entryFile, loadPaths, "less", config),
|
|
2199
2230
|
filename: resolved
|
|
@@ -2201,7 +2232,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2201
2232
|
};
|
|
2202
2233
|
pluginManager.addFileManager(manager);
|
|
2203
2234
|
}
|
|
2204
|
-
}), renderStylus = async (contents, filePath, loadPaths, options) => {
|
|
2235
|
+
}), renderStylus = async (contents, filePath, loadPaths, options, deps) => {
|
|
2205
2236
|
let stylus;
|
|
2206
2237
|
try {
|
|
2207
2238
|
const stylusModule = await importOptionalPeer("stylus");
|
|
@@ -2218,15 +2249,51 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2218
2249
|
for (const path of loadPaths)
|
|
2219
2250
|
renderer.include(path);
|
|
2220
2251
|
renderer.render((error, css) => {
|
|
2221
|
-
if (error)
|
|
2252
|
+
if (error) {
|
|
2222
2253
|
reject(error);
|
|
2223
|
-
|
|
2224
|
-
|
|
2254
|
+
return;
|
|
2255
|
+
}
|
|
2256
|
+
if (deps) {
|
|
2257
|
+
const stylusDeps = renderer.deps?.();
|
|
2258
|
+
if (Array.isArray(stylusDeps)) {
|
|
2259
|
+
for (const dep of stylusDeps)
|
|
2260
|
+
deps.add(resolve3(dep));
|
|
2261
|
+
}
|
|
2262
|
+
}
|
|
2263
|
+
resolveCss(css ?? "");
|
|
2225
2264
|
});
|
|
2226
2265
|
});
|
|
2266
|
+
}, styleDependencyGraph, styleOutputHashes, recordStyleDeps = (entry, deps) => {
|
|
2267
|
+
const key = resolve3(entry);
|
|
2268
|
+
const stripped = new Set;
|
|
2269
|
+
for (const dep of deps) {
|
|
2270
|
+
const resolved = resolve3(dep);
|
|
2271
|
+
if (resolved !== key)
|
|
2272
|
+
stripped.add(resolved);
|
|
2273
|
+
}
|
|
2274
|
+
styleDependencyGraph.set(key, stripped);
|
|
2275
|
+
}, findStyleEntriesImporting = (changedPath) => {
|
|
2276
|
+
const target = resolve3(changedPath);
|
|
2277
|
+
const importers = [];
|
|
2278
|
+
for (const [entry, deps] of styleDependencyGraph) {
|
|
2279
|
+
if (deps.has(target))
|
|
2280
|
+
importers.push(entry);
|
|
2281
|
+
}
|
|
2282
|
+
return importers;
|
|
2283
|
+
}, recordStyleOutput = (entry, css) => {
|
|
2284
|
+
const key = resolve3(entry);
|
|
2285
|
+
const hash = createHash("sha1").update(css).digest("hex");
|
|
2286
|
+
const previous = styleOutputHashes.get(key);
|
|
2287
|
+
styleOutputHashes.set(key, hash);
|
|
2288
|
+
return previous !== hash;
|
|
2289
|
+
}, forgetStyleEntry = (entry) => {
|
|
2290
|
+
const key = resolve3(entry);
|
|
2291
|
+
styleDependencyGraph.delete(key);
|
|
2292
|
+
styleOutputHashes.delete(key);
|
|
2227
2293
|
}, compileStyleSource = async (filePath, source, languageHint, config) => {
|
|
2228
2294
|
const language = getStyleLanguage(languageHint ?? filePath);
|
|
2229
2295
|
const rawContents = source ?? await readFile(filePath, "utf-8");
|
|
2296
|
+
const deps = new Set;
|
|
2230
2297
|
if (language === "scss" || language === "sass") {
|
|
2231
2298
|
const options = getSassOptions(config, language);
|
|
2232
2299
|
const packageName = options.implementation ?? "sass";
|
|
@@ -2238,16 +2305,22 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2238
2305
|
}
|
|
2239
2306
|
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
2240
2307
|
const loadPaths = normalizeLoadPaths(filePath, options.loadPaths);
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2308
|
+
try {
|
|
2309
|
+
const result = sass.compileString(contents, {
|
|
2310
|
+
importers: [
|
|
2311
|
+
createSassImporter(filePath, loadPaths, language, config, deps)
|
|
2312
|
+
],
|
|
2313
|
+
loadPaths,
|
|
2314
|
+
style: "expanded",
|
|
2315
|
+
syntax: language === "sass" ? "indented" : "scss",
|
|
2316
|
+
url: new URL(`file://${filePath}`)
|
|
2317
|
+
});
|
|
2318
|
+
const css = await runPostcss(result.css, filePath, config);
|
|
2319
|
+
recordStyleDeps(filePath, deps);
|
|
2320
|
+
return css;
|
|
2321
|
+
} catch (error) {
|
|
2322
|
+
throwPreprocessorError(error, filePath, language);
|
|
2323
|
+
}
|
|
2251
2324
|
}
|
|
2252
2325
|
if (language === "less") {
|
|
2253
2326
|
const options = getLessOptions(config);
|
|
@@ -2263,22 +2336,34 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2263
2336
|
throw missingDependencyError("less", filePath);
|
|
2264
2337
|
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
2265
2338
|
const loadPaths = normalizeLoadPaths(filePath, options.paths);
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2339
|
+
try {
|
|
2340
|
+
const result = await render(contents, {
|
|
2341
|
+
...options.options ?? {},
|
|
2342
|
+
filename: filePath,
|
|
2343
|
+
paths: loadPaths,
|
|
2344
|
+
plugins: [
|
|
2345
|
+
...options.options?.plugins ?? [],
|
|
2346
|
+
createLessFileManager(filePath, loadPaths, config, deps)
|
|
2347
|
+
]
|
|
2348
|
+
});
|
|
2349
|
+
const css = await runPostcss(result.css, filePath, config);
|
|
2350
|
+
recordStyleDeps(filePath, deps);
|
|
2351
|
+
return css;
|
|
2352
|
+
} catch (error) {
|
|
2353
|
+
throwPreprocessorError(error, filePath, "less");
|
|
2354
|
+
}
|
|
2276
2355
|
}
|
|
2277
2356
|
if (language === "stylus") {
|
|
2278
2357
|
const options = getStylusOptions(config);
|
|
2279
2358
|
const loadPaths = normalizeLoadPaths(filePath, options.paths);
|
|
2280
2359
|
const contents = withAdditionalData(preprocessLoadedStyle(rawContents, filePath, filePath, loadPaths, "stylus", config), options.additionalData);
|
|
2281
|
-
|
|
2360
|
+
try {
|
|
2361
|
+
const css = await runPostcss(await renderStylus(contents, filePath, loadPaths, options, deps), filePath, config);
|
|
2362
|
+
recordStyleDeps(filePath, deps);
|
|
2363
|
+
return css;
|
|
2364
|
+
} catch (error) {
|
|
2365
|
+
throwPreprocessorError(error, filePath, "stylus");
|
|
2366
|
+
}
|
|
2282
2367
|
}
|
|
2283
2368
|
return runPostcss(rawContents, filePath, config);
|
|
2284
2369
|
}, createStylePreprocessorPlugin = (config) => ({
|
|
@@ -2383,6 +2468,8 @@ var init_stylePreprocessor = __esm(() => {
|
|
|
2383
2468
|
importOptionalPeer = new Function("specifier", "return import(specifier)");
|
|
2384
2469
|
requireOptionalPeer = new Function("specifier", "return require(specifier)");
|
|
2385
2470
|
requireFromCwd = createRequire(join4(process.cwd(), "package.json"));
|
|
2471
|
+
styleDependencyGraph = new Map;
|
|
2472
|
+
styleOutputHashes = new Map;
|
|
2386
2473
|
stylePreprocessorPlugin = createStylePreprocessorPlugin();
|
|
2387
2474
|
});
|
|
2388
2475
|
|
|
@@ -3657,5 +3744,5 @@ export {
|
|
|
3657
3744
|
Island
|
|
3658
3745
|
};
|
|
3659
3746
|
|
|
3660
|
-
//# debugId=
|
|
3747
|
+
//# debugId=951D96E3EBACAD2564756E2164756E21
|
|
3661
3748
|
//# sourceMappingURL=index.js.map
|