@constela/start 1.2.9 → 1.2.12

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.
@@ -2217,6 +2217,7 @@ import { join as join9, dirname as dirname5, relative as relative3, basename as
2217
2217
  import * as esbuild from "esbuild";
2218
2218
  import { existsSync as existsSync7 } from "fs";
2219
2219
  import { mkdir, readFile } from "fs/promises";
2220
+ import { createRequire } from "module";
2220
2221
  import { join as join8, dirname as dirname4, isAbsolute as isAbsolute2, relative as relative2 } from "path";
2221
2222
  import { fileURLToPath } from "url";
2222
2223
  var __dirname = dirname4(fileURLToPath(import.meta.url));
@@ -2250,6 +2251,7 @@ async function bundleRuntime(options) {
2250
2251
  async function bundleCSS(options) {
2251
2252
  const cssFiles = Array.isArray(options.css) ? options.css : [options.css];
2252
2253
  const outFile = join8(options.outDir, "_constela", "styles.css");
2254
+ const shouldMinify = options.minify ?? true;
2253
2255
  await mkdir(dirname4(outFile), { recursive: true });
2254
2256
  const resolvedCssFiles = cssFiles.map((f) => isAbsolute2(f) ? f : join8(process.cwd(), f));
2255
2257
  for (const fullPath of resolvedCssFiles) {
@@ -2258,46 +2260,64 @@ async function bundleCSS(options) {
2258
2260
  }
2259
2261
  }
2260
2262
  if (options.content !== void 0) {
2263
+ const firstCssFile = resolvedCssFiles[0];
2264
+ if (!firstCssFile) {
2265
+ throw new Error("No CSS files provided");
2266
+ }
2267
+ let cssContent;
2268
+ if (resolvedCssFiles.length === 1) {
2269
+ cssContent = await readFile(firstCssFile, "utf-8");
2270
+ } else {
2271
+ cssContent = resolvedCssFiles.map((f) => `@import "${f}";`).join("\n");
2272
+ }
2273
+ const require2 = createRequire(import.meta.url);
2261
2274
  try {
2262
- const firstCssFile = resolvedCssFiles[0];
2263
- if (!firstCssFile) {
2264
- throw new Error("No CSS files provided");
2265
- }
2266
- let cssContent;
2267
- if (resolvedCssFiles.length === 1) {
2268
- cssContent = await readFile(firstCssFile, "utf-8");
2269
- } else {
2270
- cssContent = resolvedCssFiles.map((f) => `@import "${f}";`).join("\n");
2271
- }
2272
- if (options.content.length > 0) {
2273
- const fg4 = (await import("fast-glob")).default;
2274
- const resolvedContentPaths = options.content.map(
2275
- (p) => isAbsolute2(p) ? p : join8(process.cwd(), p)
2275
+ const tailwindcssCssPath = require2.resolve("tailwindcss/index.css");
2276
+ cssContent = cssContent.replace(
2277
+ /@import\s+["']tailwindcss["']/g,
2278
+ `@import "${tailwindcssCssPath}"`
2279
+ );
2280
+ } catch {
2281
+ }
2282
+ if (options.content.length > 0) {
2283
+ const fg4 = (await import("fast-glob")).default;
2284
+ const resolvedContentPaths = options.content.map(
2285
+ (p) => isAbsolute2(p) ? p : join8(process.cwd(), p)
2286
+ );
2287
+ const matchedFiles = await fg4(resolvedContentPaths, { onlyFiles: true });
2288
+ if (matchedFiles.length === 0) {
2289
+ throw new Error(
2290
+ `No content files matched the provided patterns: ${options.content.join(", ")}`
2276
2291
  );
2277
- const matchedFiles = await fg4(resolvedContentPaths, { onlyFiles: true });
2278
- if (matchedFiles.length === 0) {
2279
- throw new Error(
2280
- `No content files matched the provided patterns: ${options.content.join(", ")}`
2281
- );
2282
- }
2283
2292
  }
2284
- const sourceDir = dirname4(firstCssFile);
2285
- const sourceDirectives = options.content.map((contentPath) => {
2286
- const absolutePath = isAbsolute2(contentPath) ? contentPath : join8(process.cwd(), contentPath);
2287
- const relativePath = relative2(sourceDir, absolutePath);
2288
- return `@source "${relativePath}";`;
2289
- }).join("\n");
2290
- const processedCssInput = sourceDirectives + "\n" + cssContent;
2291
- const postcss = (await import("postcss")).default;
2292
- const tailwindPostcss = (await import("@tailwindcss/postcss")).default;
2293
+ }
2294
+ const sourceDir = dirname4(firstCssFile);
2295
+ const sourceDirectives = options.content.map((contentPath) => {
2296
+ const absolutePath = isAbsolute2(contentPath) ? contentPath : join8(process.cwd(), contentPath);
2297
+ const srcPath = absolutePath.includes("*") ? dirname4(absolutePath.split("*")[0] ?? absolutePath) : absolutePath;
2298
+ const relativePath = relative2(sourceDir, srcPath);
2299
+ return `@source "${relativePath}";`;
2300
+ }).join("\n");
2301
+ const processedCssInput = sourceDirectives + "\n" + cssContent;
2302
+ const postcss = (await import("postcss")).default;
2303
+ let tailwindPostcss;
2304
+ try {
2305
+ tailwindPostcss = (await import("@tailwindcss/postcss")).default;
2306
+ } catch {
2307
+ throw new Error(
2308
+ "PostCSS processing requires @tailwindcss/postcss. Please install it: npm install @tailwindcss/postcss"
2309
+ );
2310
+ }
2311
+ try {
2293
2312
  const result = await postcss([
2294
2313
  tailwindPostcss({
2314
+ // base determines where to look for source files and resolve paths
2295
2315
  base: sourceDir,
2296
- optimize: options.minify ?? true
2316
+ optimize: shouldMinify
2297
2317
  })
2298
2318
  ]).process(processedCssInput, {
2299
- // Use __dirname for package resolution (tailwindcss is a peer dependency of this package)
2300
- from: join8(__dirname, "styles.css")
2319
+ // from must be the actual CSS file path for correct package resolution
2320
+ from: firstCssFile
2301
2321
  });
2302
2322
  await esbuild.build({
2303
2323
  stdin: {
@@ -2307,7 +2327,7 @@ async function bundleCSS(options) {
2307
2327
  },
2308
2328
  bundle: true,
2309
2329
  outfile: outFile,
2310
- minify: options.minify ?? true,
2330
+ minify: shouldMinify,
2311
2331
  conditions: ["style"]
2312
2332
  });
2313
2333
  } catch (error) {
@@ -2321,7 +2341,7 @@ async function bundleCSS(options) {
2321
2341
  entryPoints: resolvedCssFiles,
2322
2342
  bundle: true,
2323
2343
  outfile: outFile,
2324
- minify: options.minify ?? true,
2344
+ minify: shouldMinify,
2325
2345
  loader: { ".css": "css" },
2326
2346
  conditions: ["style"]
2327
2347
  });
@@ -2335,7 +2355,7 @@ async function bundleCSS(options) {
2335
2355
  },
2336
2356
  bundle: true,
2337
2357
  outfile: outFile,
2338
- minify: options.minify ?? true,
2358
+ minify: shouldMinify,
2339
2359
  conditions: ["style"]
2340
2360
  });
2341
2361
  }
package/dist/cli/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  createDevServer,
4
4
  loadConfig,
5
5
  resolveConfig
6
- } from "../chunk-APCF5VWN.js";
6
+ } from "../chunk-323JPB5R.js";
7
7
  import "../chunk-PUTC5BCP.js";
8
8
 
9
9
  // src/cli/index.ts
package/dist/index.js CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  transformCsv,
24
24
  transformMdx,
25
25
  transformYaml
26
- } from "./chunk-APCF5VWN.js";
26
+ } from "./chunk-323JPB5R.js";
27
27
  import {
28
28
  generateHydrationScript,
29
29
  renderPage,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constela/start",
3
- "version": "1.2.9",
3
+ "version": "1.2.12",
4
4
  "description": "Meta-framework for Constela applications",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -44,10 +44,10 @@
44
44
  "@tailwindcss/postcss": "^4.0.0",
45
45
  "tailwindcss": "^4.0.0",
46
46
  "@constela/compiler": "0.7.0",
47
- "@constela/server": "3.0.1",
48
47
  "@constela/core": "0.7.0",
49
48
  "@constela/runtime": "0.10.1",
50
- "@constela/router": "8.0.0"
49
+ "@constela/router": "8.0.0",
50
+ "@constela/server": "3.0.1"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/mdast": "^4.0.4",