@pandacss/studio
Version:
The automated token documentation for Panda CSS
108 lines (106 loc) • 3.83 kB
JavaScript
;
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// scripts/studio.ts
var studio_exports = {};
__export(studio_exports, {
buildStudio: () => buildStudio,
previewStudio: () => previewStudio,
printUrls: () => printUrls,
serveStudio: () => serveStudio
});
module.exports = __toCommonJS(studio_exports);
var import_logger = require("@pandacss/logger");
var import_node_path = require("path");
var appPath = (0, import_node_path.join)(__dirname, "..");
async function buildStudio({ outDir, configPath, base }) {
const astro = await import("astro");
const { default: react } = await import("@astrojs/react");
const { default: studio } = await import("@pandacss/astro-plugin-studio");
try {
process.env.PUBLIC_CONFIG_PATH = configPath;
await astro.build({
outDir,
root: appPath,
integrations: [react(), studio()],
devToolbar: { enabled: false },
base
});
} catch (error) {
console.log(error);
}
}
async function serveStudio({ configPath, port, host, outDir, base }) {
const astro = await import("astro");
const { default: react } = await import("@astrojs/react");
const { default: studio } = await import("@pandacss/astro-plugin-studio");
try {
process.env.PUBLIC_CONFIG_PATH = configPath;
await astro.dev({
outDir,
root: appPath,
integrations: [react(), studio()],
server: {
port: port ? Number(port) : void 0,
host
},
base,
devToolbar: { enabled: false }
});
} catch (error) {
console.log(error);
}
}
async function previewStudio({ outDir, base }) {
const astro = await import("astro");
const { default: react } = await import("@astrojs/react");
const { default: studio } = await import("@pandacss/astro-plugin-studio");
try {
await astro.preview({
outDir,
root: appPath,
integrations: [react(), studio()],
devToolbar: { enabled: false },
base
});
} catch (error) {
console.log(error);
}
}
function printUrls(options) {
const protocol = options.https ? "https" : "http";
const localUrl = `${protocol}://${options.host}:${options.port}`;
import_logger.logger.log(` ${import_logger.colors.cyan("\u279C")} ${import_logger.colors.bold("Previewed at")}: ${import_logger.colors.reset(import_logger.colors.green(localUrl))} `);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
buildStudio,
previewStudio,
printUrls,
serveStudio
});