Lines 7774-7814javascript
7776 clearTimeout(this.timer);
7781async function devCommand(options) {
7782 const logger = createLogger(true);
7783 logger.header("ChainCSS Dev Server");
7784 const config = await loadConfig(options.config);
7785 const PORT = options.port || config.dev?.port || 3e3;
7786 const publicDir = config.dev?.publicDir || ".";
7787 const distDir = typeof config.output === "object" ? path9.dirname(config.output.cssFile || "dist/styles.css") : typeof config.output === "string" ? config.output : "dist";
7788 const entryFile = resolveEntry();
7789 const jsBundlePath = entryFile ? path9.join(distDir, "bundle.js") : null;
7790 const deps = getDeps();
7791 const locations = [path9.join(process.cwd(), publicDir, "index.html"), path9.join(process.cwd(), "index.html"), path9.join(process.cwd(), "public", "index.html")];
7792 const indexHtml = locations.find((l) => fs10.existsSync(l)) || null;
7793 if (indexHtml) logger.info(`\u{1F4C4} Serving: ${path9.relative(process.cwd(), indexHtml)}`);
7794 logger.info("\u{1F3A8} Starting CSS compiler...");
7795 const cssWatcher = spawn("npx", ["chaincss", "build", "--watch", ...options.config ? ["--config", options.config] : []], { stdio: ["inherit", "pipe", "pipe"], shell: true, env: { ...process.env, NODE_ENV: "development" } });
7796 const cssReady = new Promise((resolve) => {
HighRuntime Package Install
Package source invokes a package manager install command at runtime.
dist/cli/index.jsView on unpkg · L7794 7797 if (!entryFile) return resolve();
7798 const artifact = path9.join(process.cwd(), entryFile.replace(/\.(ts|js)x?$/, ".class.js"));
7799 const start = Date.now();
7802 if (fs10.existsSync(artifact) && fs10.readFileSync(artifact, "utf8").trim().length > 0) {
7803 logger.info(`\u2705 CSS ready`);
7808 if (Date.now() - start > 1e4) return resolve();
7809 setTimeout(poll, 30);
7813 let esbuildAvailable = false;