Lines 20-101javascript
20 ownKeys = Object.getOwnPropertyNames || function (o) {
22 for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
27 return function (mod) {
28 if (mod && mod.__esModule) return mod;
30 if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31 __setModuleDefault(result, mod);
35var __importDefault = (this && this.__importDefault) || function (mod) {
36 return (mod && mod.__esModule) ? mod : { "default": mod };
38Object.defineProperty(exports, "__esModule", { value: true });
39const chokidar = __importStar(require("chokidar"));
40const esbuild = __importStar(require("esbuild"));
41const node_child_process_1 = require("node:child_process");
42const fs = __importStar(require("node:fs"));
HighChild Process
Package source references child process execution.
dist/commands/develop/index.jsView on unpkg · L40 43const fsp = __importStar(require("node:fs/promises"));
44const path = __importStar(require("node:path"));
45const manifest_js_1 = __importDefault(require("../../schemas/manifest.js"));
46const extension_types_js_1 = require("../../utils/extension-types.js");
47const logger_js_1 = require("../../utils/logger.js");
48const tail_js_1 = require("../../utils/tail.js");
49const utils_js_1 = require("../../utils/utils.js");
50const vicinae_js_1 = require("../../utils/vicinae.js");
52 description: "Start an extension development session",
56 description: "Path to the extension directory",
57 default: process.cwd(),
61 const logger = new logger_js_1.Logger();
62 const target = flags.target ?? process.cwd();
63 const pkgPath = path.join(target, "package.json");
64 const parseManifest = () => {
65 if (!fs.existsSync(pkgPath)) {
66 logger.logError(`No package.json found at ${pkgPath}. Does this location point to a valid extension repository?`);
69 const json = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
70 const e = manifest_js_1.default.safeParse(json);
72 logger.logError(`${pkgPath} is not a valid extension manifest: ${e.error}`);
77 let manifest = parseManifest();
78 const vicinae = new vicinae_js_1.VicinaeClient();
79 logger.logInfo("Generating extension types...");
80 (0, extension_types_js_1.updateExtensionTypes)(manifest, target);
81 const typeCheck = async () => {
82 const spawned = (0, node_child_process_1.spawn)("npx", ["tsc", "--noEmit"]);
83 let stderr = Buffer.from("");
HighRuntime Package Install
Package source invokes a package manager install command at runtime.
dist/commands/develop/index.jsView on unpkg · L81 84 return new Promise((resolve) => {
85 spawned.stderr.on("data", (buf) => {
86 stderr = Buffer.concat([stderr, buf]);
88 spawned.on("exit", (status) => resolve({ error: stderr.toString(), ok: status === 0 }));
91 const build = async (outDir) => {
92 const entryPoints = manifest.commands
93 .map((cmd) => path.join("src", `${cmd.name}.tsx`))
94 .filter(fs.existsSync);
95 logger.logInfo(`entrypoints [${entryPoints.join(", ")}]`);
96 const promises = manifest.commands.map((cmd) => {
97 const base = path.join(process.cwd(), "src", `${cmd.name}`);
98 const tsxSource = `${base}.tsx`;
99 const tsSource = `${base}.ts`;
100 let source = tsxSource;
101 if (cmd.mode === "view" && !fs.existsSync(tsxSource)) {