@absolutejs/absolute 0.19.0-beta.686 → 0.19.0-beta.688

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/build.js CHANGED
@@ -2447,11 +2447,120 @@ var init_lowerAwaitSlotSyntax = __esm(() => {
2447
2447
  AWAIT_BLOCK_RE = /\{#await\s+([^}]+)\}([\s\S]*?)\{:then(?:\s+([A-Za-z_$][\w$]*))?\}([\s\S]*?)(?:\{:catch(?:\s+([A-Za-z_$][\w$]*))?\}([\s\S]*?))?\{\/await\}/g;
2448
2448
  });
2449
2449
 
2450
+ // src/build/stylePreprocessor.ts
2451
+ import { readFile } from "fs/promises";
2452
+ import { dirname as dirname3, extname as extname3 } from "path";
2453
+ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATTERN, importOptionalPeer, 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) => {
2454
+ const normalized = filePathOrLanguage.toLowerCase();
2455
+ if (normalized === "scss" || normalized.endsWith(".scss"))
2456
+ return "scss";
2457
+ if (normalized === "sass" || normalized.endsWith(".sass"))
2458
+ return "sass";
2459
+ if (normalized === "less" || normalized.endsWith(".less"))
2460
+ return "less";
2461
+ return null;
2462
+ }, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`), compileStyleSource = async (filePath, source, languageHint) => {
2463
+ const language = getStyleLanguage(languageHint ?? filePath);
2464
+ const contents = source ?? await readFile(filePath, "utf-8");
2465
+ if (language === "scss" || language === "sass") {
2466
+ let sass;
2467
+ try {
2468
+ sass = await importOptionalPeer("sass");
2469
+ } catch {
2470
+ throw missingDependencyError("sass", filePath);
2471
+ }
2472
+ const result = sass.compileString(contents, {
2473
+ loadPaths: [dirname3(filePath), process.cwd()],
2474
+ style: "expanded",
2475
+ syntax: language === "sass" ? "indented" : "scss",
2476
+ url: new URL(`file://${filePath}`)
2477
+ });
2478
+ return result.css;
2479
+ }
2480
+ if (language === "less") {
2481
+ let lessModule;
2482
+ try {
2483
+ lessModule = await importOptionalPeer("less");
2484
+ } catch {
2485
+ throw missingDependencyError("less", filePath);
2486
+ }
2487
+ const less = lessModule.render ? lessModule : lessModule.default;
2488
+ const render = less?.render;
2489
+ if (!render)
2490
+ throw missingDependencyError("less", filePath);
2491
+ const result = await render(contents, {
2492
+ filename: filePath,
2493
+ paths: [dirname3(filePath), process.cwd()]
2494
+ });
2495
+ return result.css;
2496
+ }
2497
+ return contents;
2498
+ }, stylePreprocessorPlugin, createSvelteStylePreprocessor = () => ({
2499
+ style: async ({
2500
+ attributes,
2501
+ content,
2502
+ filename
2503
+ }) => {
2504
+ const language = typeof attributes.lang === "string" ? attributes.lang : typeof attributes.type === "string" ? attributes.type.replace(/^text\//, "") : null;
2505
+ if (!language || !STYLE_LANGUAGE_PATTERN.test(language))
2506
+ return;
2507
+ const path = filename ?? `style.${language}`;
2508
+ return {
2509
+ code: await compileStyleSource(path, content, language)
2510
+ };
2511
+ }
2512
+ }), compileStyleFileIfNeeded = async (filePath) => {
2513
+ if (!isPreprocessableStylePath(filePath)) {
2514
+ return readFile(filePath, "utf-8");
2515
+ }
2516
+ return compileStyleSource(filePath);
2517
+ };
2518
+ var init_stylePreprocessor = __esm(() => {
2519
+ STYLE_EXTENSION_PATTERN = /\.(s[ac]ss|less)$/i;
2520
+ STYLE_MODULE_EXTENSION_PATTERN = /\.module\.(s[ac]ss|less)$/i;
2521
+ STYLE_LANGUAGE_PATTERN = /^(s[ac]ss|less)$/i;
2522
+ importOptionalPeer = new Function("specifier", "return import(specifier)");
2523
+ stylePreprocessorPlugin = {
2524
+ name: "absolute-style-preprocessor",
2525
+ setup(build) {
2526
+ const cssModuleSources = new Map;
2527
+ build.onResolve({ filter: /^absolute-style-module:/ }, ({ path }) => ({
2528
+ namespace: "absolute-style-module",
2529
+ path: path.slice("absolute-style-module:".length)
2530
+ }));
2531
+ build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
2532
+ const sourcePath = cssModuleSources.get(path);
2533
+ if (!sourcePath) {
2534
+ throw new Error(`Unable to resolve CSS module source for ${path}`);
2535
+ }
2536
+ return {
2537
+ contents: await compileStyleSource(sourcePath),
2538
+ loader: "css"
2539
+ };
2540
+ });
2541
+ build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
2542
+ if (isStyleModulePath(path)) {
2543
+ const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
2544
+ cssModuleSources.set(cssModulePath, path);
2545
+ return {
2546
+ contents: `export { default } from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)};`,
2547
+ loader: "js"
2548
+ };
2549
+ }
2550
+ return {
2551
+ contents: await compileStyleSource(path),
2552
+ loader: "css"
2553
+ };
2554
+ });
2555
+ }
2556
+ };
2557
+ });
2558
+
2450
2559
  // src/core/svelteServerModule.ts
2451
2560
  import { mkdir, readdir as readdir2 } from "fs/promises";
2452
- import { basename as basename2, dirname as dirname3, extname as extname3, join as join5, relative as relative3, resolve as resolve6 } from "path";
2561
+ import { basename as basename2, dirname as dirname4, extname as extname4, join as join5, relative as relative3, resolve as resolve6 } from "path";
2453
2562
  var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
2454
- const importPath = relative3(dirname3(from), target).replace(/\\/g, "/");
2563
+ const importPath = relative3(dirname4(from), target).replace(/\\/g, "/");
2455
2564
  return importPath.startsWith(".") ? importPath : `./${importPath}`;
2456
2565
  }, processDirectoryEntries = (entries, dir, targetFileName, stack) => {
2457
2566
  for (const entry of entries) {
@@ -2497,7 +2606,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
2497
2606
  if (!spec.startsWith(".")) {
2498
2607
  return null;
2499
2608
  }
2500
- const basePath = resolve6(dirname3(from), spec);
2609
+ const basePath = resolve6(dirname4(from), spec);
2501
2610
  const candidates = [
2502
2611
  basePath,
2503
2612
  `${basePath}.ts`,
@@ -2529,8 +2638,8 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
2529
2638
  if (!spec.startsWith(".")) {
2530
2639
  return null;
2531
2640
  }
2532
- const explicitPath = resolve6(dirname3(from), spec);
2533
- if (extname3(explicitPath) === ".svelte") {
2641
+ const explicitPath = resolve6(dirname4(from), spec);
2642
+ if (extname4(explicitPath) === ".svelte") {
2534
2643
  return explicitPath;
2535
2644
  }
2536
2645
  const candidate = `${explicitPath}.svelte`;
@@ -2558,7 +2667,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
2558
2667
  const { compile, preprocess } = await import("svelte/compiler");
2559
2668
  const loweredAwaitSource = lowerSvelteAwaitSlotSyntax(source);
2560
2669
  const loweredSource = lowerSvelteIslandSyntax(loweredAwaitSource.code, "server");
2561
- const preprocessed = await preprocess(loweredSource.code, {});
2670
+ const preprocessed = await preprocess(loweredSource.code, createSvelteStylePreprocessor());
2562
2671
  let transpiled = sourcePath.endsWith(".ts") || sourcePath.endsWith(".svelte.ts") ? transpiler.transformSync(preprocessed.code) : preprocessed.code;
2563
2672
  const childImportSpecs = Array.from(transpiled.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((value) => value !== undefined);
2564
2673
  const resolvedChildModules = await Promise.all(childImportSpecs.map((spec) => resolveSvelteImport(spec, resolutionSourcePath)));
@@ -2608,7 +2717,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
2608
2717
  compiledCode = compiledCode.replaceAll(spec, resolvedModuleImport);
2609
2718
  }
2610
2719
  const compiledModulePath = getCachedModulePath(sourcePath);
2611
- await mkdir(dirname3(compiledModulePath), { recursive: true });
2720
+ await mkdir(dirname4(compiledModulePath), { recursive: true });
2612
2721
  await writeIfChanged(compiledModulePath, compiledCode);
2613
2722
  compiledModuleCache.set(sourcePath, compiledModulePath);
2614
2723
  return compiledModulePath;
@@ -2617,6 +2726,7 @@ var init_svelteServerModule = __esm(() => {
2617
2726
  init_resolvePackageImport();
2618
2727
  init_lowerIslandSyntax();
2619
2728
  init_lowerAwaitSlotSyntax();
2729
+ init_stylePreprocessor();
2620
2730
  serverCacheRoot = join5(process.cwd(), ".absolutejs", "islands", "svelte");
2621
2731
  compiledModuleCache = new Map;
2622
2732
  originalSourcePathCache = new Map;
@@ -3087,16 +3197,18 @@ var scanCssEntryPoints = async (dir, ignore) => {
3087
3197
  if (!existsSync7(dir))
3088
3198
  return [];
3089
3199
  const entryPaths = [];
3090
- const glob = new Glob4("**/*.css");
3200
+ const glob = new Glob4("**/*.{css,scss,sass,less}");
3091
3201
  for await (const file of glob.scan({ absolute: true, cwd: dir })) {
3092
3202
  const normalized = normalizePath(file);
3093
- if (ignore?.some((pattern) => normalized.includes(pattern)))
3203
+ if (isStyleModulePath(normalized) || ignore?.some((pattern) => normalized.includes(pattern)))
3094
3204
  continue;
3095
3205
  entryPaths.push(file);
3096
3206
  }
3097
3207
  return entryPaths;
3098
3208
  };
3099
- var init_scanCssEntryPoints = () => {};
3209
+ var init_scanCssEntryPoints = __esm(() => {
3210
+ init_stylePreprocessor();
3211
+ });
3100
3212
 
3101
3213
  // src/utils/imageProcessing.ts
3102
3214
  import { existsSync as existsSync8, mkdirSync as mkdirSync3, readFileSync as readFileSync4, writeFileSync as writeFileSync4 } from "fs";
@@ -3268,7 +3380,7 @@ var exports_optimizeHtmlImages = {};
3268
3380
  __export(exports_optimizeHtmlImages, {
3269
3381
  optimizeHtmlImages: () => optimizeHtmlImages
3270
3382
  });
3271
- import { readFile, writeFile as writeFile2 } from "fs/promises";
3383
+ import { readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
3272
3384
  var IMG_REGEX, getAttr = (attrs, name) => {
3273
3385
  const regex = new RegExp(`${name}\\s*=\\s*["']([^"']*)["']`, "i");
3274
3386
  const match = regex.exec(attrs);
@@ -3314,7 +3426,7 @@ var IMG_REGEX, getAttr = (attrs, name) => {
3314
3426
  }, optimizeHtmlImages = async (directory, config) => {
3315
3427
  const htmlFiles = await scanEntryPoints(directory, "*.html");
3316
3428
  const tasks = htmlFiles.map(async (filePath) => {
3317
- const original = await readFile(filePath, "utf8");
3429
+ const original = await readFile2(filePath, "utf8");
3318
3430
  if (!original.includes("data-optimized"))
3319
3431
  return;
3320
3432
  const updated = original.replace(IMG_REGEX, (match, before, after) => transformImgTag(match, before, after, config));
@@ -3353,7 +3465,7 @@ var init_telemetry = __esm(() => {
3353
3465
  // src/cli/telemetryEvent.ts
3354
3466
  import { existsSync as existsSync10, readFileSync as readFileSync6 } from "fs";
3355
3467
  import { arch, platform } from "os";
3356
- import { dirname as dirname4, join as join8, parse } from "path";
3468
+ import { dirname as dirname5, join as join8, parse } from "path";
3357
3469
  var checkCandidate = (candidate) => {
3358
3470
  if (!existsSync10(candidate)) {
3359
3471
  return null;
@@ -3378,7 +3490,7 @@ var checkCandidate = (candidate) => {
3378
3490
  if (version) {
3379
3491
  return version;
3380
3492
  }
3381
- dir = dirname4(dir);
3493
+ dir = dirname5(dir);
3382
3494
  }
3383
3495
  return "unknown";
3384
3496
  }, sendTelemetryEvent = (event, payload) => {
@@ -3416,7 +3528,7 @@ var exports_updateAssetPaths = {};
3416
3528
  __export(exports_updateAssetPaths, {
3417
3529
  updateAssetPaths: () => updateAssetPaths
3418
3530
  });
3419
- import { readFile as readFile2, writeFile as writeFile3 } from "fs/promises";
3531
+ import { readFile as readFile3, writeFile as writeFile3 } from "fs/promises";
3420
3532
  var replaceAssetRef = (match, prefix, dir, name, ext, suffix, manifest, filePath) => {
3421
3533
  if (/data-external(?:\s*=\s*["'][^"']*["'])?/i.test(match)) {
3422
3534
  return match;
@@ -3451,7 +3563,7 @@ var replaceAssetRef = (match, prefix, dir, name, ext, suffix, manifest, filePath
3451
3563
  const htmlFiles = await scanEntryPoints(directory, "*.html");
3452
3564
  const assetRegex = /((?:<script[^>]+src=|<link[^>]*?rel=["']stylesheet["'][^>]*?href=)["'])(?!\/?(?:.*\/)?htmx\.min\.js)(\/?(?:.*\/)?)([^./"']+)(?:\.[^."'/]+)?(\.(?:js|ts|css))(["'][^>]*>)/g;
3453
3565
  const tasks = htmlFiles.map(async (filePath) => {
3454
- const original = await readFile2(filePath, "utf8");
3566
+ const original = await readFile3(filePath, "utf8");
3455
3567
  const updated = original.replace(assetRegex, (match, prefix, dir, name, ext, suffix) => replaceAssetRef(match, prefix, dir, name, ext, suffix, manifest, filePath));
3456
3568
  await writeFile3(filePath, updated, "utf8");
3457
3569
  });
@@ -3666,7 +3778,7 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
3666
3778
 
3667
3779
  // src/build/angularLinkerPlugin.ts
3668
3780
  import { existsSync as existsSync12, mkdirSync as mkdirSync5, readFileSync as readFileSync7, writeFileSync as writeFileSync6 } from "fs";
3669
- import { dirname as dirname5, join as join9, relative as relative4, resolve as resolve10 } from "path";
3781
+ import { dirname as dirname6, join as join9, relative as relative4, resolve as resolve10 } from "path";
3670
3782
  import { createHash } from "crypto";
3671
3783
  var CACHE_DIR, angularLinkerPlugin;
3672
3784
  var init_angularLinkerPlugin = __esm(() => {
@@ -3706,7 +3818,7 @@ var init_angularLinkerPlugin = __esm(() => {
3706
3818
  const mod = await import(linkerSpecifier);
3707
3819
  linkerPlugin = mod.createEs2015LinkerPlugin({
3708
3820
  fileSystem: {
3709
- dirname: dirname5,
3821
+ dirname: dirname6,
3710
3822
  exists: existsSync12,
3711
3823
  readFile: readFileSync7,
3712
3824
  relative: relative4,
@@ -3965,10 +4077,10 @@ __export(exports_compileSvelte, {
3965
4077
  import { existsSync as existsSync13 } from "fs";
3966
4078
  import { mkdir as mkdir2, stat } from "fs/promises";
3967
4079
  import {
3968
- dirname as dirname6,
4080
+ dirname as dirname7,
3969
4081
  join as join11,
3970
4082
  basename as basename4,
3971
- extname as extname4,
4083
+ extname as extname5,
3972
4084
  resolve as resolve13,
3973
4085
  relative as relative6,
3974
4086
  sep as sep2
@@ -4014,7 +4126,7 @@ var resolveDevClientDir2 = () => {
4014
4126
  }, resolveRelativeModule2 = async (spec, from) => {
4015
4127
  if (!spec.startsWith("."))
4016
4128
  return null;
4017
- const basePath = resolve13(dirname6(from), spec);
4129
+ const basePath = resolve13(dirname7(from), spec);
4018
4130
  const candidates = [
4019
4131
  basePath,
4020
4132
  `${basePath}.ts`,
@@ -4041,7 +4153,7 @@ var resolveDevClientDir2 = () => {
4041
4153
  const resolved = resolvePackageImport(spec);
4042
4154
  return resolved && /\.svelte(\.(?:ts|js))?$/.test(resolved) ? resolved : null;
4043
4155
  }
4044
- const basePath = resolve13(dirname6(from), spec);
4156
+ const basePath = resolve13(dirname7(from), spec);
4045
4157
  const explicit = /\.(svelte|svelte\.(?:ts|js))$/.test(basePath);
4046
4158
  if (!explicit) {
4047
4159
  const extensions = [".svelte", ".svelte.ts", ".svelte.js"];
@@ -4096,12 +4208,13 @@ var resolveDevClientDir2 = () => {
4096
4208
  const loweredServerSource = isModule ? loweredAwaitServerSource : lowerSvelteIslandSyntax(loweredAwaitServerSource.code, "server");
4097
4209
  const loweredClientSource = isModule ? loweredAwaitClientSource : lowerSvelteIslandSyntax(loweredAwaitClientSource.code, "client");
4098
4210
  const transformedByLowering = loweredAwaitServerSource.transformed || loweredAwaitClientSource.transformed || loweredServerSource.transformed || loweredClientSource.transformed;
4099
- const preprocessedServer = isModule ? loweredServerSource.code : (await preprocess(loweredServerSource.code, {})).code;
4100
- const preprocessedClient = isModule ? loweredClientSource.code : (await preprocess(loweredClientSource.code, {})).code;
4211
+ const svelteStylePreprocessor = createSvelteStylePreprocessor();
4212
+ const preprocessedServer = isModule ? loweredServerSource.code : (await preprocess(loweredServerSource.code, svelteStylePreprocessor)).code;
4213
+ const preprocessedClient = isModule ? loweredClientSource.code : (await preprocess(loweredClientSource.code, svelteStylePreprocessor)).code;
4101
4214
  const transpiledServer = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler2.transformSync(preprocessedServer) : preprocessedServer;
4102
4215
  const transpiledClient = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler2.transformSync(preprocessedClient) : preprocessedClient;
4103
- const rawRel = dirname6(relative6(svelteRoot, src)).replace(/\\/g, "/");
4104
- const relDir = rawRel.startsWith("..") ? `_ext/${relative6(process.cwd(), dirname6(src)).replace(/\\/g, "/")}` : rawRel;
4216
+ const rawRel = dirname7(relative6(svelteRoot, src)).replace(/\\/g, "/");
4217
+ const relDir = rawRel.startsWith("..") ? `_ext/${relative6(process.cwd(), dirname7(src)).replace(/\\/g, "/")}` : rawRel;
4105
4218
  const baseName = basename4(src).replace(/\.svelte(\.(ts|js))?$/, "");
4106
4219
  const importPaths = Array.from(transpiledServer.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((path) => path !== undefined);
4107
4220
  const resolvedModuleImports = await Promise.all(importPaths.map((importPath) => resolveRelativeModule2(importPath, src)));
@@ -4110,8 +4223,8 @@ var resolveDevClientDir2 = () => {
4110
4223
  const childBuilt = await Promise.all(childSources.map((child) => build(child)));
4111
4224
  const hasAwaitSlotFromChildren = childBuilt.some((child) => child.hasAwaitSlot);
4112
4225
  const externalRewrites = new Map;
4113
- const ssrOutputDir = dirname6(join11(serverDir, relDir, `${baseName}.js`));
4114
- const clientOutputDir = dirname6(join11(clientDir, relDir, `${baseName}.js`));
4226
+ const ssrOutputDir = dirname7(join11(serverDir, relDir, `${baseName}.js`));
4227
+ const clientOutputDir = dirname7(join11(clientDir, relDir, `${baseName}.js`));
4115
4228
  for (let idx = 0;idx < importPaths.length; idx++) {
4116
4229
  const rawSpec = importPaths[idx];
4117
4230
  if (!rawSpec)
@@ -4180,8 +4293,8 @@ var resolveDevClientDir2 = () => {
4180
4293
  const ssrPath = join11(serverDir, relDir, `${baseName}.js`);
4181
4294
  const clientPath = join11(clientDir, relDir, `${baseName}.js`);
4182
4295
  await Promise.all([
4183
- mkdir2(dirname6(ssrPath), { recursive: true }),
4184
- mkdir2(dirname6(clientPath), { recursive: true })
4296
+ mkdir2(dirname7(ssrPath), { recursive: true }),
4297
+ mkdir2(dirname7(clientPath), { recursive: true })
4185
4298
  ]);
4186
4299
  if (isModule) {
4187
4300
  const bundle = rewriteExternalImports(generate("client"), "client");
@@ -4208,10 +4321,10 @@ var resolveDevClientDir2 = () => {
4208
4321
  };
4209
4322
  const roots = await Promise.all(entryPoints.map(build));
4210
4323
  await Promise.all(roots.map(async ({ client, hasAwaitSlot }) => {
4211
- const relClientDir = dirname6(relative6(clientDir, client));
4212
- const name = basename4(client, extname4(client));
4324
+ const relClientDir = dirname7(relative6(clientDir, client));
4325
+ const name = basename4(client, extname5(client));
4213
4326
  const indexPath = join11(indexDir, relClientDir, `${name}.js`);
4214
- const importRaw = relative6(dirname6(indexPath), client).split(sep2).join("/");
4327
+ const importRaw = relative6(dirname7(indexPath), client).split(sep2).join("/");
4215
4328
  const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
4216
4329
  const hmrImports = isDev ? `window.__HMR_FRAMEWORK__ = "svelte";
4217
4330
  import "${hmrClientPath3}";
@@ -4282,13 +4395,13 @@ if (typeof window !== "undefined") {
4282
4395
  setTimeout(releaseStreamingSlots, 0);
4283
4396
  }
4284
4397
  }`;
4285
- await mkdir2(dirname6(indexPath), { recursive: true });
4398
+ await mkdir2(dirname7(indexPath), { recursive: true });
4286
4399
  return write(indexPath, bootstrap);
4287
4400
  }));
4288
4401
  return {
4289
4402
  svelteClientPaths: roots.map(({ client }) => client),
4290
4403
  svelteIndexPaths: roots.map(({ client }) => {
4291
- const rel = dirname6(relative6(clientDir, client));
4404
+ const rel = dirname7(relative6(clientDir, client));
4292
4405
  return join11(indexDir, rel, basename4(client));
4293
4406
  }),
4294
4407
  svelteServerPaths: roots.map(({ ssr }) => ssr)
@@ -4298,6 +4411,7 @@ var init_compileSvelte = __esm(() => {
4298
4411
  init_constants();
4299
4412
  init_resolvePackageImport();
4300
4413
  init_sourceMetadata();
4414
+ init_stylePreprocessor();
4301
4415
  init_lowerIslandSyntax();
4302
4416
  init_lowerAwaitSlotSyntax();
4303
4417
  init_renderToReadableStream();
@@ -4319,7 +4433,7 @@ __export(exports_compileVue, {
4319
4433
  });
4320
4434
  import { existsSync as existsSync14 } from "fs";
4321
4435
  import { mkdir as mkdir3 } from "fs/promises";
4322
- import { basename as basename5, dirname as dirname7, join as join12, relative as relative7, resolve as resolve14 } from "path";
4436
+ import { basename as basename5, dirname as dirname8, join as join12, relative as relative7, resolve as resolve14 } from "path";
4323
4437
  var {file: file2, write: write2, Transpiler: Transpiler2 } = globalThis.Bun;
4324
4438
  var resolveDevClientDir3 = () => {
4325
4439
  const projectRoot = process.cwd();
@@ -4430,7 +4544,7 @@ var resolveDevClientDir3 = () => {
4430
4544
  const packageComponentPaths = Array.from(resolvedPackageVueImports.entries());
4431
4545
  const helperModulePaths = importPaths.filter((path) => path.startsWith(".") && !path.endsWith(".vue"));
4432
4546
  const childBuildResults = await Promise.all([
4433
- ...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve14(dirname7(sourceFilePath), relativeChildPath), outputDirs, cacheMap, false, vueRootDir, compiler)),
4547
+ ...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve14(dirname8(sourceFilePath), relativeChildPath), outputDirs, cacheMap, false, vueRootDir, compiler)),
4434
4548
  ...packageComponentPaths.map(([, absolutePath]) => compileVueFile(absolutePath, outputDirs, cacheMap, false, vueRootDir, compiler))
4435
4549
  ]);
4436
4550
  const hasScript = descriptor.script || descriptor.scriptSetup;
@@ -4462,13 +4576,13 @@ var resolveDevClientDir3 = () => {
4462
4576
  ssr,
4463
4577
  ssrCssVars: descriptor.cssVars
4464
4578
  }).code.replace(/(['"])(\.{1,2}\/[^'"]+)(['"])/g, (_, quoteStart, relativeImport, quoteEnd) => `${quoteStart}${toJs(relativeImport)}${quoteEnd}`);
4465
- const localCss = descriptor.styles.map((styleBlock) => compiler.compileStyle({
4579
+ const localCss = await Promise.all(descriptor.styles.map(async (styleBlock) => compiler.compileStyle({
4466
4580
  filename: sourceFilePath,
4467
4581
  id: componentId,
4468
4582
  scoped: styleBlock.scoped,
4469
- source: styleBlock.content,
4583
+ source: styleBlock.lang ? await compileStyleSource(sourceFilePath, styleBlock.content, styleBlock.lang) : styleBlock.content,
4470
4584
  trim: true
4471
- }).code);
4585
+ }).code));
4472
4586
  const allCss = [
4473
4587
  ...localCss,
4474
4588
  ...childBuildResults.flatMap((result2) => result2.cssCodes)
@@ -4476,7 +4590,7 @@ var resolveDevClientDir3 = () => {
4476
4590
  let cssOutputPaths = [];
4477
4591
  if (isEntryPoint && allCss.length) {
4478
4592
  const cssOutputFile = join12(outputDirs.css, `${toKebab(fileBaseName)}-compiled.css`);
4479
- await mkdir3(dirname7(cssOutputFile), { recursive: true });
4593
+ await mkdir3(dirname8(cssOutputFile), { recursive: true });
4480
4594
  await write2(cssOutputFile, allCss.join(`
4481
4595
  `));
4482
4596
  cssOutputPaths = [cssOutputFile];
@@ -4508,7 +4622,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
4508
4622
  const serverCode = assembleModule(generateRenderFunction(true), "ssrRender", false) + islandMetadataExports;
4509
4623
  const clientOutputPath = join12(outputDirs.client, `${relativeWithoutExtension}.js`);
4510
4624
  const serverOutputPath = join12(outputDirs.server, `${relativeWithoutExtension}.js`);
4511
- const relDir = dirname7(relativeFilePath);
4625
+ const relDir = dirname8(relativeFilePath);
4512
4626
  const relDepth = relDir === "." ? 0 : relDir.split("/").length;
4513
4627
  const adjustImports = (code) => code.replace(/(from\s+['"])(\.\.\/(?:\.\.\/)*)/g, (_, prefix, dots) => {
4514
4628
  const upCount = dots.split("/").length - 1;
@@ -4520,15 +4634,15 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
4520
4634
  let result2 = code;
4521
4635
  for (const [bareImport, paths] of packageImportRewrites) {
4522
4636
  const targetPath = mode === "server" ? paths.server : paths.client;
4523
- let rel = relative7(dirname7(outputPath), targetPath).replace(/\\/g, "/");
4637
+ let rel = relative7(dirname8(outputPath), targetPath).replace(/\\/g, "/");
4524
4638
  if (!rel.startsWith("."))
4525
4639
  rel = `./${rel}`;
4526
4640
  result2 = result2.replaceAll(bareImport, rel);
4527
4641
  }
4528
4642
  return result2;
4529
4643
  };
4530
- await mkdir3(dirname7(clientOutputPath), { recursive: true });
4531
- await mkdir3(dirname7(serverOutputPath), { recursive: true });
4644
+ await mkdir3(dirname8(clientOutputPath), { recursive: true });
4645
+ await mkdir3(dirname8(serverOutputPath), { recursive: true });
4532
4646
  await write2(clientOutputPath, rewritePackageImports(adjustImports(clientCode), clientOutputPath, "client"));
4533
4647
  await write2(serverOutputPath, rewritePackageImports(adjustImports(serverCode), serverOutputPath, "server"));
4534
4648
  const result = {
@@ -4538,7 +4652,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
4538
4652
  hmrId,
4539
4653
  serverPath: serverOutputPath,
4540
4654
  tsHelperPaths: [
4541
- ...helperModulePaths.map((helper) => resolve14(dirname7(sourceFilePath), helper.endsWith(".ts") ? helper : `${helper}.ts`)),
4655
+ ...helperModulePaths.map((helper) => resolve14(dirname8(sourceFilePath), helper.endsWith(".ts") ? helper : `${helper}.ts`)),
4542
4656
  ...childBuildResults.flatMap((child) => child.tsHelperPaths)
4543
4657
  ]
4544
4658
  };
@@ -4570,14 +4684,14 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
4570
4684
  const entryBaseName = basename5(entryPath, ".vue");
4571
4685
  const indexOutputFile = join12(indexOutputDir, `${entryBaseName}.js`);
4572
4686
  const clientOutputFile = join12(clientOutputDir, relative7(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
4573
- await mkdir3(dirname7(indexOutputFile), { recursive: true });
4687
+ await mkdir3(dirname8(indexOutputFile), { recursive: true });
4574
4688
  const vueHmrImports = isDev ? [
4575
4689
  `window.__HMR_FRAMEWORK__ = "vue";`,
4576
4690
  `import "${hmrClientPath4}";`
4577
4691
  ] : [];
4578
4692
  await write2(indexOutputFile, [
4579
4693
  ...vueHmrImports,
4580
- `import Comp from "${relative7(dirname7(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
4694
+ `import Comp from "${relative7(dirname8(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
4581
4695
  'import { createSSRApp, createApp } from "vue";',
4582
4696
  "",
4583
4697
  "// HMR State Preservation: Check for preserved state from HMR",
@@ -4700,8 +4814,8 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
4700
4814
  const relativeJsPath = relative7(vueRootDir, tsPath).replace(/\.ts$/, ".js");
4701
4815
  const outClientPath = join12(clientOutputDir, relativeJsPath);
4702
4816
  const outServerPath = join12(serverOutputDir, relativeJsPath);
4703
- await mkdir3(dirname7(outClientPath), { recursive: true });
4704
- await mkdir3(dirname7(outServerPath), { recursive: true });
4817
+ await mkdir3(dirname8(outClientPath), { recursive: true });
4818
+ await mkdir3(dirname8(outServerPath), { recursive: true });
4705
4819
  await write2(outClientPath, transpiledCode);
4706
4820
  await write2(outServerPath, transpiledCode);
4707
4821
  }));
@@ -4717,6 +4831,7 @@ var init_compileVue = __esm(() => {
4717
4831
  init_constants();
4718
4832
  init_resolvePackageImport();
4719
4833
  init_sourceMetadata();
4834
+ init_stylePreprocessor();
4720
4835
  devClientDir3 = resolveDevClientDir3();
4721
4836
  hmrClientPath4 = join12(devClientDir3, "hmrClient.ts").replace(/\\/g, "/");
4722
4837
  transpiler3 = new Transpiler2({ loader: "ts", target: "browser" });
@@ -5198,7 +5313,7 @@ __export(exports_compileAngular, {
5198
5313
  compileAngular: () => compileAngular
5199
5314
  });
5200
5315
  import { existsSync as existsSync15, readFileSync as readFileSync8, promises as fs } from "fs";
5201
- import { join as join13, basename as basename6, sep as sep3, dirname as dirname8, resolve as resolve15, relative as relative8 } from "path";
5316
+ import { join as join13, basename as basename6, sep as sep3, dirname as dirname9, resolve as resolve15, relative as relative8 } from "path";
5202
5317
  import ts2 from "typescript";
5203
5318
  import { createHash as createHash2 } from "crypto";
5204
5319
  var computeConfigHash = () => {
@@ -5262,11 +5377,7 @@ ${registrations}
5262
5377
  return fileName;
5263
5378
  }, compileAngularFile = async (inputPath, outDir) => {
5264
5379
  const islandMetadataExports = buildIslandMetadataExports(readFileSync8(inputPath, "utf-8"));
5265
- const {
5266
- readConfiguration,
5267
- performCompilation,
5268
- EmitFlags
5269
- } = await import("@angular/compiler-cli");
5380
+ const { readConfiguration, performCompilation, EmitFlags } = await import("@angular/compiler-cli");
5270
5381
  const configHash = computeConfigHash();
5271
5382
  const cached = globalThis.__angularCompilerCache;
5272
5383
  let host;
@@ -5279,7 +5390,7 @@ ${registrations}
5279
5390
  cached.lastUsed = Date.now();
5280
5391
  } else {
5281
5392
  const tsPath = __require.resolve("typescript");
5282
- const tsRootDir = dirname8(tsPath);
5393
+ const tsRootDir = dirname9(tsPath);
5283
5394
  tsLibDir = tsRootDir.endsWith("lib") ? tsRootDir : resolve15(tsRootDir, "lib");
5284
5395
  const config = readConfiguration("./tsconfig.json");
5285
5396
  options = {
@@ -5345,7 +5456,7 @@ ${registrations}
5345
5456
  const cached2 = aotTransformCache.get(resolvedPath);
5346
5457
  if (cached2 !== undefined)
5347
5458
  return cached2;
5348
- const transformed = inlineTemplateAndLowerDeferSync(source, dirname8(resolvedPath)).source;
5459
+ const transformed = inlineTemplateAndLowerDeferSync(source, dirname9(resolvedPath)).source;
5349
5460
  aotTransformCache.set(resolvedPath, transformed);
5350
5461
  return transformed;
5351
5462
  };
@@ -5387,7 +5498,7 @@ ${registrations}
5387
5498
  processedContent += islandMetadataExports;
5388
5499
  return { content: processedContent, target };
5389
5500
  });
5390
- await Promise.all(entries.map(({ target }) => fs.mkdir(dirname8(target), { recursive: true })));
5501
+ await Promise.all(entries.map(({ target }) => fs.mkdir(dirname9(target), { recursive: true })));
5391
5502
  await Promise.all(entries.map(({ target, content }) => fs.writeFile(target, content, "utf-8")));
5392
5503
  return entries.map(({ target }) => target);
5393
5504
  }, jitContentCache, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), resolveAngularDeferImportSpecifier = () => {
@@ -5522,7 +5633,7 @@ ${fields}
5522
5633
  }, readAndEscapeFile = async (filePath) => {
5523
5634
  if (!existsSync15(filePath))
5524
5635
  return null;
5525
- const content = await fs.readFile(filePath, "utf-8");
5636
+ const content = await compileStyleFileIfNeeded(filePath);
5526
5637
  return escapeTemplateContent(content);
5527
5638
  }, inlineTemplateAndLowerDefer = async (source, fileDir) => {
5528
5639
  const templateUrlMatch = source.match(/templateUrl\s*:\s*['"]([^'"]+)['"]/);
@@ -5676,9 +5787,9 @@ ${fields}
5676
5787
  if (!existsSync15(actualPath))
5677
5788
  return;
5678
5789
  let sourceCode = await fs.readFile(actualPath, "utf-8");
5679
- const inlined = await inlineResources(sourceCode, dirname8(actualPath));
5680
- sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname8(actualPath)).source;
5681
- const inputDir = dirname8(actualPath);
5790
+ const inlined = await inlineResources(sourceCode, dirname9(actualPath));
5791
+ sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname9(actualPath)).source;
5792
+ const inputDir = dirname9(actualPath);
5682
5793
  const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
5683
5794
  const fileBase = basename6(actualPath).replace(/\.ts$/, ".js");
5684
5795
  const targetDir = join13(outDir, relativeDir);
@@ -5706,7 +5817,7 @@ ${fields}
5706
5817
  allOutputs.push(targetPath);
5707
5818
  jitContentCache.set(cacheKey2, contentHash);
5708
5819
  }
5709
- const inputDirForResolve = dirname8(actualPath);
5820
+ const inputDirForResolve = dirname9(actualPath);
5710
5821
  await Promise.all(localImports.map((imp) => {
5711
5822
  const importPath = resolve15(inputDirForResolve, imp);
5712
5823
  return transpileFile(importPath);
@@ -5769,7 +5880,11 @@ ${fields}
5769
5880
  const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
5770
5881
  const clientFile = join13(indexesDir, jsName);
5771
5882
  if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync15(clientFile)) {
5772
- return { clientPath: clientFile, indexUnchanged: true, serverPath: rawServerFile };
5883
+ return {
5884
+ clientPath: clientFile,
5885
+ indexUnchanged: true,
5886
+ serverPath: rawServerFile
5887
+ };
5773
5888
  }
5774
5889
  let rewritten = original;
5775
5890
  if (!rewritten.includes(`import '@angular/compiler';`)) {
@@ -5926,8 +6041,15 @@ if (pageHasRawStreamingSlots) {
5926
6041
  const indexHash = Bun.hash(hydration).toString(BASE_36_RADIX);
5927
6042
  const indexUnchanged = cachedWrapper?.indexHash === indexHash;
5928
6043
  await fs.writeFile(clientFile, hydration, "utf-8");
5929
- wrapperOutputCache.set(resolvedEntry, { indexHash, serverHash: serverContentHash });
5930
- return { clientPath: clientFile, indexUnchanged, serverPath: rawServerFile };
6044
+ wrapperOutputCache.set(resolvedEntry, {
6045
+ indexHash,
6046
+ serverHash: serverContentHash
6047
+ });
6048
+ return {
6049
+ clientPath: clientFile,
6050
+ indexUnchanged,
6051
+ serverPath: rawServerFile
6052
+ };
5931
6053
  });
5932
6054
  const results = await Promise.all(compileTasks);
5933
6055
  const serverPaths = results.map((r) => r.serverPath);
@@ -5942,6 +6064,7 @@ var init_compileAngular = __esm(() => {
5942
6064
  init_constants();
5943
6065
  init_sourceMetadata();
5944
6066
  init_lowerDeferSyntax();
6067
+ init_stylePreprocessor();
5945
6068
  devClientDir4 = resolveDevClientDir4();
5946
6069
  hmrClientPath5 = join13(devClientDir4, "hmrClient.ts").replace(/\\/g, "/");
5947
6070
  hmrRuntimePath = join13(devClientDir4, "handlers", "angularRuntime.ts").replace(/\\/g, "/");
@@ -6279,7 +6402,7 @@ import {
6279
6402
  statSync,
6280
6403
  writeFileSync as writeFileSync7
6281
6404
  } from "fs";
6282
- import { basename as basename7, dirname as dirname9, join as join18, relative as relative9, resolve as resolve17 } from "path";
6405
+ import { basename as basename7, dirname as dirname10, join as join18, relative as relative9, resolve as resolve17 } from "path";
6283
6406
  import { cwd, env as env2, exit } from "process";
6284
6407
  var {build: bunBuild6, Glob: Glob6 } = globalThis.Bun;
6285
6408
  var isDev, collectConventionSourceFiles = (entry) => {
@@ -6659,7 +6782,7 @@ ${content.slice(firstUseIdx)}`;
6659
6782
  htmlDir,
6660
6783
  vueDir,
6661
6784
  angularDir,
6662
- islandBootstrapPath && dirname9(islandBootstrapPath)
6785
+ islandBootstrapPath && dirname10(islandBootstrapPath)
6663
6786
  ].filter((dir) => Boolean(dir));
6664
6787
  const clientRoot = isSingle ? sourceClientRoots[0] ?? projectRoot : commonAncestor(sourceClientRoots, projectRoot);
6665
6788
  const serverDirMap = [];
@@ -6727,7 +6850,7 @@ ${content.slice(firstUseIdx)}`;
6727
6850
  const proc = Bun.spawn(["bun", binPath, "-i", input, "-o", join18(buildPath, output)], { stderr: "pipe", stdout: "pipe" });
6728
6851
  await proc.exited;
6729
6852
  };
6730
- const tailwindPromise = tailwind && (!isIncremental || normalizedIncrementalFiles?.some((file3) => file3.endsWith(".css"))) ? compileTailwind(tailwind.input, tailwind.output) : undefined;
6853
+ const tailwindPromise = tailwind && (!isIncremental || normalizedIncrementalFiles?.some(isStylePath)) ? compileTailwind(tailwind.input, tailwind.output) : undefined;
6731
6854
  const emptyConventionResult = {
6732
6855
  conventions: undefined,
6733
6856
  pageFiles: []
@@ -6767,7 +6890,7 @@ ${content.slice(firstUseIdx)}`;
6767
6890
  if (notFoundFrameworks.length > 1) {
6768
6891
  logWarn(`Multiple frameworks define not-found convention files: ${notFoundFrameworks.join(", ")}. Only one will be used (priority: ${notFoundFrameworks[0]}). Remove not-found files from other frameworks to avoid ambiguity.`);
6769
6892
  }
6770
- const shouldIncludeHtmlAssets = !isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/html/") && (f.endsWith(".html") || f.endsWith(".css")));
6893
+ const shouldIncludeHtmlAssets = !isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/html/") && (f.endsWith(".html") || isStylePath(f)));
6771
6894
  const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
6772
6895
  if (entry.startsWith(resolve17(reactIndexesPath))) {
6773
6896
  const pageName = basename7(entry, ".tsx");
@@ -6991,7 +7114,7 @@ ${content.slice(firstUseIdx)}`;
6991
7114
  naming: `[dir]/[name].[hash].[ext]`,
6992
7115
  outdir: buildPath,
6993
7116
  ...hmr ? { jsx: { development: true }, reactFastRefresh: true } : {},
6994
- plugins: [],
7117
+ plugins: [stylePreprocessorPlugin],
6995
7118
  root: clientRoot,
6996
7119
  splitting: true,
6997
7120
  target: "browser",
@@ -7049,7 +7172,7 @@ ${content.slice(firstUseIdx)}`;
7049
7172
  format: "esm",
7050
7173
  naming: `[dir]/[name].[hash].[ext]`,
7051
7174
  outdir: serverOutDir,
7052
- plugins: [],
7175
+ plugins: [stylePreprocessorPlugin],
7053
7176
  root: serverRoot,
7054
7177
  target: "bun",
7055
7178
  throw: false,
@@ -7065,6 +7188,7 @@ ${content.slice(firstUseIdx)}`;
7065
7188
  naming: `[dir]/[name].[hash].[ext]`,
7066
7189
  outdir: buildPath,
7067
7190
  plugins: [
7191
+ stylePreprocessorPlugin,
7068
7192
  ...angularDir && !isDev ? [angularLinkerPlugin] : [],
7069
7193
  ...htmlScriptPlugin ? [htmlScriptPlugin] : []
7070
7194
  ],
@@ -7083,6 +7207,7 @@ ${content.slice(firstUseIdx)}`;
7083
7207
  naming: `[dir]/[name].[hash].[ext]`,
7084
7208
  outdir: buildPath,
7085
7209
  plugins: [
7210
+ stylePreprocessorPlugin,
7086
7211
  ...angularDir && !isDev ? [angularLinkerPlugin] : []
7087
7212
  ],
7088
7213
  root: islandEntryResult.generatedRoot,
@@ -7097,6 +7222,7 @@ ${content.slice(firstUseIdx)}`;
7097
7222
  outdir: stylesDir ? join18(buildPath, basename7(stylesDir)) : buildPath,
7098
7223
  root: stylesDir || clientRoot,
7099
7224
  target: "browser",
7225
+ plugins: [stylePreprocessorPlugin],
7100
7226
  throw: false
7101
7227
  }) : undefined,
7102
7228
  vueCssPaths.length > 0 ? bunBuild6({
@@ -7218,8 +7344,8 @@ ${content.slice(firstUseIdx)}`;
7218
7344
  manifest[toPascal(baseName)] = artifact.path;
7219
7345
  }
7220
7346
  const shouldCopyHtmx = !isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/htmx/") && f.endsWith(".html"));
7221
- const shouldUpdateHtmlAssetPaths = !isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/html/") && (f.endsWith(".html") || f.endsWith(".css")));
7222
- const shouldUpdateHtmxAssetPaths = !isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/htmx/") && (f.endsWith(".html") || f.endsWith(".css")));
7347
+ const shouldUpdateHtmlAssetPaths = !isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/html/") && (f.endsWith(".html") || isStylePath(f)));
7348
+ const shouldUpdateHtmxAssetPaths = !isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/htmx/") && (f.endsWith(".html") || isStylePath(f)));
7223
7349
  const hmrClientBundle = hmrClientBundlePromise ? await hmrClientBundlePromise : null;
7224
7350
  const injectHMRIntoHTMLFile = (filePath, framework) => {
7225
7351
  if (!hmrClientBundle)
@@ -7336,6 +7462,7 @@ var init_build = __esm(() => {
7336
7462
  init_scanEntryPoints();
7337
7463
  init_scanConventions();
7338
7464
  init_scanCssEntryPoints();
7465
+ init_stylePreprocessor();
7339
7466
  init_optimizeHtmlImages();
7340
7467
  init_updateAssetPaths();
7341
7468
  init_buildHMRClient();
@@ -7704,7 +7831,7 @@ var init_clientManager = __esm(() => {
7704
7831
 
7705
7832
  // src/dev/pathUtils.ts
7706
7833
  import { readdirSync } from "fs";
7707
- var detectFramework = (filePath, resolved) => {
7834
+ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
7708
7835
  if (shouldIgnorePath(filePath, resolved)) {
7709
7836
  return "ignored";
7710
7837
  }
@@ -7753,7 +7880,7 @@ var detectFramework = (filePath, resolved) => {
7753
7880
  return "angular";
7754
7881
  if (normalized.includes("/assets/"))
7755
7882
  return "assets";
7756
- if (normalized.endsWith(".css")) {
7883
+ if (STYLE_EXTENSION_PATTERN2.test(normalized)) {
7757
7884
  if (normalized.includes("/vue/") || normalized.includes("/vue-"))
7758
7885
  return "vue";
7759
7886
  if (normalized.includes("/svelte/") || normalized.includes("/svelte-"))
@@ -7836,6 +7963,7 @@ var detectFramework = (filePath, resolved) => {
7836
7963
  };
7837
7964
  var init_pathUtils = __esm(() => {
7838
7965
  init_commonAncestor();
7966
+ STYLE_EXTENSION_PATTERN2 = /\.(css|s[ac]ss|less)$/i;
7839
7967
  });
7840
7968
 
7841
7969
  // src/dev/fileWatcher.ts
@@ -8020,7 +8148,7 @@ var init_assetStore = __esm(() => {
8020
8148
 
8021
8149
  // src/islands/pageMetadata.ts
8022
8150
  import { readFileSync as readFileSync11 } from "fs";
8023
- import { dirname as dirname10, resolve as resolve22 } from "path";
8151
+ import { dirname as dirname11, resolve as resolve22 } from "path";
8024
8152
  var pagePatterns, getPageDirs = (config) => [
8025
8153
  { dir: config.angularDirectory, framework: "angular" },
8026
8154
  { dir: config.reactDirectory, framework: "react" },
@@ -8039,7 +8167,7 @@ var pagePatterns, getPageDirs = (config) => [
8039
8167
  const source = definition.buildReference?.source;
8040
8168
  if (!source)
8041
8169
  continue;
8042
- const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve22(dirname10(buildInfo.resolvedRegistryPath), source);
8170
+ const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve22(dirname11(buildInfo.resolvedRegistryPath), source);
8043
8171
  lookup.set(`${definition.framework}:${definition.component}`, resolve22(resolvedSource));
8044
8172
  }
8045
8173
  return lookup;
@@ -8214,7 +8342,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
8214
8342
  case "htmx":
8215
8343
  break;
8216
8344
  case "assets":
8217
- if (normalizedFile.endsWith(".css")) {
8345
+ if (isStylePath(normalizedFile)) {
8218
8346
  keys.push(`${pascalName}CSS`);
8219
8347
  }
8220
8348
  break;
@@ -8222,6 +8350,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
8222
8350
  return keys;
8223
8351
  };
8224
8352
  var init_moduleMapper = __esm(() => {
8353
+ init_stylePreprocessor();
8225
8354
  init_reactComponentClassifier();
8226
8355
  });
8227
8356
 
@@ -9111,14 +9240,14 @@ var init_streamingSlotWarningScope = __esm(() => {
9111
9240
  import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
9112
9241
  import { mkdir as mkdir4, symlink } from "fs/promises";
9113
9242
  import { tmpdir } from "os";
9114
- import { basename as basename10, dirname as dirname11, join as join20, resolve as resolve25 } from "path";
9243
+ import { basename as basename10, dirname as dirname12, join as join20, resolve as resolve25 } from "path";
9115
9244
  var ssrDirty = false, lastSelector = "angular-page", isRecord7 = (value) => typeof value === "object" && value !== null, isAngularComponent = (value) => typeof value === "function", compilerImportPromise = null, ensureAngularCompiler = () => {
9116
9245
  if (!compilerImportPromise) {
9117
9246
  compilerImportPromise = import("@angular/compiler");
9118
9247
  }
9119
9248
  return compilerImportPromise;
9120
9249
  }, readAngularPageModule = (value) => isRecord7(value) ? value : null, resolveAngularSsrOutDir = () => process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR ?? join20(tmpdir(), "absolutejs", "generated", "angular-ssr"), ensureAngularSsrNodeModules = async (outDir) => {
9121
- const outRoot = resolve25(dirname11(dirname11(outDir)));
9250
+ const outRoot = resolve25(dirname12(dirname12(outDir)));
9122
9251
  const nodeModulesLink = join20(outRoot, "node_modules");
9123
9252
  if (process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR) {
9124
9253
  return;
@@ -9440,14 +9569,14 @@ var init_pageHandler3 = __esm(() => {
9440
9569
 
9441
9570
  // src/vue/pageHandler.ts
9442
9571
  import { readdir as readdir4 } from "fs/promises";
9443
- import { basename as basename11, dirname as dirname12 } from "path";
9572
+ import { basename as basename11, dirname as dirname13 } from "path";
9444
9573
  var ssrDirty4 = false, isRecord9 = (value) => typeof value === "object" && value !== null, isGenericVueComponent = (value) => typeof value === "function" || isRecord9(value), readHasIslands2 = (value) => {
9445
9574
  if (!isRecord9(value))
9446
9575
  return false;
9447
9576
  const hasIslands = value["__ABSOLUTE_PAGE_HAS_ISLANDS__"];
9448
9577
  return typeof hasIslands === "boolean" ? hasIslands : false;
9449
9578
  }, readDefaultExport2 = (value) => isRecord9(value) ? value.default : undefined, resolveCurrentGeneratedVueModulePath = async (pagePath) => {
9450
- const pageDirectory = dirname12(pagePath);
9579
+ const pageDirectory = dirname13(pagePath);
9451
9580
  const expectedPrefix = `${basename11(pagePath, ".js").split(".")[0]}.`;
9452
9581
  try {
9453
9582
  const pageEntries = await readdir4(pageDirectory, {
@@ -9651,7 +9780,7 @@ __export(exports_moduleServer, {
9651
9780
  SRC_URL_PREFIX: () => SRC_URL_PREFIX
9652
9781
  });
9653
9782
  import { existsSync as existsSync20, readFileSync as readFileSync13, statSync as statSync2 } from "fs";
9654
- import { basename as basename12, dirname as dirname13, extname as extname5, resolve as resolve26, relative as relative10 } from "path";
9783
+ import { basename as basename12, dirname as dirname14, extname as extname6, resolve as resolve26, relative as relative10 } from "path";
9655
9784
  var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
9656
9785
  const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
9657
9786
  const allExports = [];
@@ -9700,9 +9829,9 @@ ${stubs}
9700
9829
  }, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
9701
9830
  const absPath = resolve26(fileDir, relPath);
9702
9831
  const rel = relative10(projectRoot, absPath);
9703
- const extension = extname5(rel);
9832
+ const extension = extname6(rel);
9704
9833
  let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
9705
- if (extname5(srcPath) === ".svelte") {
9834
+ if (extname6(srcPath) === ".svelte") {
9706
9835
  srcPath = relative10(projectRoot, resolveSvelteModulePath(resolve26(projectRoot, srcPath)));
9707
9836
  }
9708
9837
  return srcUrl(srcPath, projectRoot);
@@ -9736,7 +9865,7 @@ ${stubs}
9736
9865
  };
9737
9866
  result = result.replace(/^((?:import\s+[\s\S]+?\s+from|export\s+[\s\S]+?\s+from|import)\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
9738
9867
  result = result.replace(/(import\s*\(\s*["'])([^"'./][^"']*)(["']\s*\))/g, stubReplace);
9739
- const fileDir = dirname13(filePath);
9868
+ const fileDir = dirname14(filePath);
9740
9869
  result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
9741
9870
  result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
9742
9871
  result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}`);
@@ -9800,7 +9929,7 @@ ${transpiled}`;
9800
9929
  return rewriteImports2(transpiled, filePath, projectRoot, rewriter);
9801
9930
  }, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
9802
9931
  const raw = readFileSync13(filePath, "utf-8");
9803
- const ext = extname5(filePath);
9932
+ const ext = extname6(filePath);
9804
9933
  const isTS = ext === ".ts" || ext === ".tsx";
9805
9934
  const isTSX = ext === ".tsx" || ext === ".jsx";
9806
9935
  let transpiler4 = jsTranspiler2;
@@ -10190,7 +10319,7 @@ export default {};
10190
10319
  return jsResponse(`var s=document.createElement('style');s.textContent=\`${escaped}\`;s.dataset.svelteHmr=${JSON.stringify(cssCheckPath)};var p=document.querySelector('style[data-svelte-hmr="${cssCheckPath}"]');if(p)p.remove();document.head.appendChild(s);`);
10191
10320
  }, resolveSourcePath = (relPath, projectRoot) => {
10192
10321
  const filePath = resolve26(projectRoot, relPath);
10193
- const ext = extname5(filePath);
10322
+ const ext = extname6(filePath);
10194
10323
  if (ext === ".svelte")
10195
10324
  return { ext, filePath: resolveSvelteModulePath(filePath) };
10196
10325
  if (ext)
@@ -10400,7 +10529,7 @@ var init_simpleHTMXHMR = () => {};
10400
10529
 
10401
10530
  // src/dev/rebuildTrigger.ts
10402
10531
  import { existsSync as existsSync21 } from "fs";
10403
- import { basename as basename13, dirname as dirname14, relative as relative11, resolve as resolve29 } from "path";
10532
+ import { basename as basename13, dirname as dirname15, relative as relative11, resolve as resolve29 } from "path";
10404
10533
  var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseErrorLocationFromMessage = (msg) => {
10405
10534
  const pathLineCol = msg.match(/^([^\s:]+):(\d+)(?::(\d+))?/);
10406
10535
  if (pathLineCol) {
@@ -10708,7 +10837,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
10708
10837
  format: "esm",
10709
10838
  naming: "[dir]/[name].[hash].[ext]",
10710
10839
  outdir: buildDir,
10711
- plugins: [],
10840
+ plugins: [stylePreprocessorPlugin],
10712
10841
  root: clientRoot,
10713
10842
  target: "browser",
10714
10843
  throw: false
@@ -10841,7 +10970,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
10841
10970
  jsx: { development: true },
10842
10971
  naming: "[dir]/[name].[hash].[ext]",
10843
10972
  outdir: buildDir,
10844
- plugins: [],
10973
+ plugins: [stylePreprocessorPlugin],
10845
10974
  reactFastRefresh: true,
10846
10975
  root: clientRoot,
10847
10976
  splitting: true,
@@ -11033,6 +11162,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
11033
11162
  format: "esm",
11034
11163
  naming: "[dir]/[name].[hash].[ext]",
11035
11164
  outdir: serverOutDir,
11165
+ plugins: [stylePreprocessorPlugin],
11036
11166
  root: serverRoot,
11037
11167
  target: "bun",
11038
11168
  throw: false
@@ -11042,6 +11172,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
11042
11172
  format: "esm",
11043
11173
  naming: "[dir]/[name].[hash].[ext]",
11044
11174
  outdir: buildDir,
11175
+ plugins: [stylePreprocessorPlugin],
11045
11176
  root: clientRoot,
11046
11177
  target: "browser",
11047
11178
  throw: false
@@ -11162,7 +11293,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
11162
11293
  const [primarySource] = sourceFiles;
11163
11294
  try {
11164
11295
  const hasComponentChanges = reactFiles.some((file3) => file3.endsWith(".tsx") || file3.endsWith(".ts") || file3.endsWith(".jsx"));
11165
- const hasCSSChanges = reactFiles.some((file3) => file3.endsWith(".css"));
11296
+ const hasCSSChanges = reactFiles.some(isStylePath);
11166
11297
  logHmrUpdate(primarySource ?? reactFiles[0] ?? "", "react", duration);
11167
11298
  broadcastToClients(state, {
11168
11299
  data: {
@@ -11204,7 +11335,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
11204
11335
  if (!buildReference?.source) {
11205
11336
  return;
11206
11337
  }
11207
- const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve29(dirname14(buildInfo.resolvedRegistryPath), buildReference.source);
11338
+ const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve29(dirname15(buildInfo.resolvedRegistryPath), buildReference.source);
11208
11339
  islandFiles.add(resolve29(sourcePath));
11209
11340
  }, resolveIslandSourceFiles = async (config) => {
11210
11341
  const registryPath = config.islands?.registry;
@@ -11309,7 +11440,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
11309
11440
  if (!cssFile) {
11310
11441
  return;
11311
11442
  }
11312
- const cssBaseName = basename13(cssFile, ".css");
11443
+ const cssBaseName = basename13(getStyleBaseName(cssFile));
11313
11444
  const cssPascalName = toPascal(cssBaseName);
11314
11445
  const cssKey = `${cssPascalName}CSS`;
11315
11446
  const cssUrl = manifest[cssKey] || null;
@@ -11391,7 +11522,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
11391
11522
  return;
11392
11523
  }
11393
11524
  const vueComponentFiles = vueFiles.filter((file3) => file3.endsWith(".vue"));
11394
- const vueCssFiles = vueFiles.filter((file3) => file3.endsWith(".css"));
11525
+ const vueCssFiles = vueFiles.filter(isStylePath);
11395
11526
  const isCssOnlyChange = vueComponentFiles.length === 0 && vueCssFiles.length > 0;
11396
11527
  const vuePageFiles = vueFiles.filter((file3) => file3.replace(/\\/g, "/").includes("/pages/"));
11397
11528
  const pagesToUpdate = vuePageFiles.length > 0 ? vuePageFiles : vueComponentFiles;
@@ -11406,7 +11537,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
11406
11537
  if (!cssFile) {
11407
11538
  return;
11408
11539
  }
11409
- const cssBaseName = basename13(cssFile, ".css");
11540
+ const cssBaseName = basename13(getStyleBaseName(cssFile));
11410
11541
  const cssPascalName = toPascal(cssBaseName);
11411
11542
  const cssKey = `${cssPascalName}CSS`;
11412
11543
  const cssUrl = manifest[cssKey] || null;
@@ -11457,7 +11588,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
11457
11588
  return;
11458
11589
  }
11459
11590
  const svelteComponentFiles = svelteFiles.filter((file3) => file3.endsWith(".svelte"));
11460
- const svelteCssFiles = svelteFiles.filter((file3) => file3.endsWith(".css"));
11591
+ const svelteCssFiles = svelteFiles.filter(isStylePath);
11461
11592
  const isCssOnlyChange = svelteComponentFiles.length === 0 && svelteCssFiles.length > 0;
11462
11593
  const sveltePageFiles = svelteFiles.filter((file3) => file3.replace(/\\/g, "/").includes("/pages/"));
11463
11594
  const pagesToUpdate = sveltePageFiles.length > 0 ? sveltePageFiles : svelteComponentFiles;
@@ -11486,7 +11617,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
11486
11617
  if (!cssFile) {
11487
11618
  return;
11488
11619
  }
11489
- const cssBaseName = basename13(cssFile, ".css");
11620
+ const cssBaseName = basename13(getStyleBaseName(cssFile));
11490
11621
  const cssPascalName = toPascal(cssBaseName);
11491
11622
  const cssKey = `${cssPascalName}CSS`;
11492
11623
  const cssUrl = manifest[cssKey] || null;
@@ -11535,8 +11666,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
11535
11666
  if (angularFiles.length === 0) {
11536
11667
  return;
11537
11668
  }
11538
- const angularCssFiles = angularFiles.filter((file3) => file3.endsWith(".css"));
11539
- const isCssOnlyChange = angularFiles.every((file3) => file3.endsWith(".css")) && angularCssFiles.length > 0;
11669
+ const angularCssFiles = angularFiles.filter(isStylePath);
11670
+ const isCssOnlyChange = angularFiles.every(isStylePath) && angularCssFiles.length > 0;
11540
11671
  const angularPageFiles = angularFiles.filter((file3) => file3.replace(/\\/g, "/").includes("/pages/"));
11541
11672
  let pagesToUpdate = angularPageFiles;
11542
11673
  if (pagesToUpdate.length === 0 && state.dependencyGraph) {
@@ -11933,6 +12064,7 @@ var init_rebuildTrigger = __esm(() => {
11933
12064
  init_assetStore();
11934
12065
  init_pathUtils();
11935
12066
  init_webSocket();
12067
+ init_stylePreprocessor();
11936
12068
  init_pageHandler();
11937
12069
  init_pageHandler2();
11938
12070
  init_pageHandler3();
@@ -12107,7 +12239,7 @@ __export(exports_devBuild, {
12107
12239
  });
12108
12240
  import { readdir as readdir5 } from "fs/promises";
12109
12241
  import { statSync as statSync3 } from "fs";
12110
- import { dirname as dirname15, resolve as resolve30 } from "path";
12242
+ import { dirname as dirname16, resolve as resolve30 } from "path";
12111
12243
  var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
12112
12244
  const configuredDirs = [
12113
12245
  config.reactDirectory,
@@ -12117,7 +12249,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
12117
12249
  config.htmlDirectory,
12118
12250
  config.htmxDirectory
12119
12251
  ].filter((dir) => Boolean(dir));
12120
- return Array.from(new Set(configuredDirs.flatMap((dir) => [dir, dirname15(dir)])));
12252
+ return Array.from(new Set(configuredDirs.flatMap((dir) => [dir, dirname16(dir)])));
12121
12253
  }, parseDirectoryConfig = (source) => {
12122
12254
  const config = {};
12123
12255
  const dirPattern = /(\w+Directory)\s*:\s*['"]([^'"]+)['"]/g;
@@ -12419,5 +12551,5 @@ export {
12419
12551
  build
12420
12552
  };
12421
12553
 
12422
- //# debugId=DF5146A94CD1A84F64756E2164756E21
12554
+ //# debugId=A12D2C8CF2A14BB064756E2164756E21
12423
12555
  //# sourceMappingURL=build.js.map