ipc.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. "use strict";
  2. var __create = Object.create;
  3. var __defProp = Object.defineProperty;
  4. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  5. var __getOwnPropNames = Object.getOwnPropertyNames;
  6. var __getProtoOf = Object.getPrototypeOf;
  7. var __hasOwnProp = Object.prototype.hasOwnProperty;
  8. var __export = (target, all) => {
  9. for (var name in all)
  10. __defProp(target, name, { get: all[name], enumerable: true });
  11. };
  12. var __copyProps = (to, from, except, desc) => {
  13. if (from && typeof from === "object" || typeof from === "function") {
  14. for (let key of __getOwnPropNames(from))
  15. if (!__hasOwnProp.call(to, key) && key !== except)
  16. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  17. }
  18. return to;
  19. };
  20. var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  21. // If the importer is in node compatibility mode or this is not an ESM
  22. // file that has been converted to a CommonJS file using a Babel-
  23. // compatible transform (i.e. "__esModule" has not been set), then set
  24. // "default" to the CommonJS "module.exports" for node compatibility.
  25. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  26. mod
  27. ));
  28. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  29. var ipc_exports = {};
  30. __export(ipc_exports, {
  31. serializeConfig: () => serializeConfig,
  32. stdioChunkToParams: () => stdioChunkToParams
  33. });
  34. module.exports = __toCommonJS(ipc_exports);
  35. var import_util = __toESM(require("util"));
  36. var import_compilationCache = require("../transform/compilationCache");
  37. function serializeConfig(config, passCompilationCache) {
  38. const result = {
  39. location: { configDir: config.configDir, resolvedConfigFile: config.config.configFile },
  40. configCLIOverrides: config.configCLIOverrides,
  41. compilationCache: passCompilationCache ? (0, import_compilationCache.serializeCompilationCache)() : void 0
  42. };
  43. try {
  44. result.metadata = JSON.stringify(config.config.metadata);
  45. } catch (error) {
  46. }
  47. return result;
  48. }
  49. function stdioChunkToParams(chunk) {
  50. if (chunk instanceof Uint8Array)
  51. return { buffer: Buffer.from(chunk).toString("base64") };
  52. if (typeof chunk !== "string")
  53. return { text: import_util.default.inspect(chunk) };
  54. return { text: chunk };
  55. }
  56. // Annotate the CommonJS export names for ESM import in node:
  57. 0 && (module.exports = {
  58. serializeConfig,
  59. stdioChunkToParams
  60. });