UNPKG

@umijs/plugins

Version:
67 lines (65 loc) 2.04 kB
var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; 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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/confetti.ts var confetti_exports = {}; __export(confetti_exports, { default: () => confetti_default }); module.exports = __toCommonJS(confetti_exports); var import_plugin_utils = require("umi/plugin-utils"); var handleConfetti = () => { const confettiShell = ` open raycast://confetti; exit; `; const confetti = (0, import_plugin_utils.crossSpawn)(confettiShell, [], { stdio: "pipe", shell: true }); confetti.on("error", (err) => { const errStr = "[confetti] " + err; import_plugin_utils.logger.error(errStr); }); confetti.stderr && confetti.stderr.on("data", () => { const err = `[confetti] 未安装 Raycast , 请安装后尝试 https://www.raycast.com`; import_plugin_utils.logger.error(err); }); }; var confetti_default = (api) => { api.describe({ key: "confetti", config: { schema({ zod }) { return zod.object({}); } }, enableBy: api.EnableBy.config }); api.onBuildComplete(({ err }) => { if (!err) { handleConfetti(); } }); api.onDevCompileDone(({ isFirstCompile }) => { if (isFirstCompile) { handleConfetti(); } }); }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = {});