@constela/start 1.2.10 → 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,50 +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
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
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
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
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 {
|
|
2296
2312
|
const result = await postcss([
|
|
2297
2313
|
tailwindPostcss({
|
|
2298
|
-
base
|
|
2299
|
-
|
|
2314
|
+
// base determines where to look for source files and resolve paths
|
|
2315
|
+
base: sourceDir,
|
|
2316
|
+
optimize: shouldMinify
|
|
2300
2317
|
})
|
|
2301
2318
|
]).process(processedCssInput, {
|
|
2302
|
-
//
|
|
2303
|
-
|
|
2304
|
-
from: isWithinProject ? firstCssFile : join8(projectRoot, "styles.css")
|
|
2319
|
+
// from must be the actual CSS file path for correct package resolution
|
|
2320
|
+
from: firstCssFile
|
|
2305
2321
|
});
|
|
2306
2322
|
await esbuild.build({
|
|
2307
2323
|
stdin: {
|
|
@@ -2311,7 +2327,7 @@ async function bundleCSS(options) {
|
|
|
2311
2327
|
},
|
|
2312
2328
|
bundle: true,
|
|
2313
2329
|
outfile: outFile,
|
|
2314
|
-
minify:
|
|
2330
|
+
minify: shouldMinify,
|
|
2315
2331
|
conditions: ["style"]
|
|
2316
2332
|
});
|
|
2317
2333
|
} catch (error) {
|
|
@@ -2325,7 +2341,7 @@ async function bundleCSS(options) {
|
|
|
2325
2341
|
entryPoints: resolvedCssFiles,
|
|
2326
2342
|
bundle: true,
|
|
2327
2343
|
outfile: outFile,
|
|
2328
|
-
minify:
|
|
2344
|
+
minify: shouldMinify,
|
|
2329
2345
|
loader: { ".css": "css" },
|
|
2330
2346
|
conditions: ["style"]
|
|
2331
2347
|
});
|
|
@@ -2339,7 +2355,7 @@ async function bundleCSS(options) {
|
|
|
2339
2355
|
},
|
|
2340
2356
|
bundle: true,
|
|
2341
2357
|
outfile: outFile,
|
|
2342
|
-
minify:
|
|
2358
|
+
minify: shouldMinify,
|
|
2343
2359
|
conditions: ["style"]
|
|
2344
2360
|
});
|
|
2345
2361
|
}
|
package/dist/cli/index.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constela/start",
|
|
3
|
-
"version": "1.2.
|
|
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/
|
|
48
|
-
"@constela/server": "3.0.1",
|
|
47
|
+
"@constela/core": "0.7.0",
|
|
49
48
|
"@constela/runtime": "0.10.1",
|
|
50
|
-
"@constela/
|
|
49
|
+
"@constela/router": "8.0.0",
|
|
50
|
+
"@constela/server": "3.0.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/mdast": "^4.0.4",
|