@stryke/capnp 0.9.13 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/capnp",
3
- "version": "0.9.13",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "description": "A package to assist in running the Cap'n Proto compiler and creating Cap'n Proto serialization protocol schemas.",
6
6
  "repository": {
@@ -62,6 +62,20 @@
62
62
  },
63
63
  "default": { "types": "./dts/index.d.ts", "default": "./dist/index.js" }
64
64
  },
65
+ "./helpers": {
66
+ "import": {
67
+ "types": "./dist/helpers.d.ts",
68
+ "default": "./dist/helpers.js"
69
+ },
70
+ "require": {
71
+ "types": "./dist/helpers.d.cts",
72
+ "default": "./dist/helpers.cjs"
73
+ },
74
+ "default": {
75
+ "types": "./dist/helpers.d.ts",
76
+ "default": "./dist/helpers.js"
77
+ }
78
+ },
65
79
  "./compile": {
66
80
  "import": {
67
81
  "types": "./dist/compile.d.ts",
@@ -115,9 +129,11 @@
115
129
  "peerDependencies": { "typescript": ">=4.0.0" },
116
130
  "peerDependenciesMeta": { "typescript": { "optional": false } },
117
131
  "dependencies": {
118
- "@stryke/fs": "^0.23.0",
119
- "@stryke/path": "^0.12.1",
120
- "hex2dec": "^1.1.2"
132
+ "@stryke/fs": "^0.23.1",
133
+ "@stryke/path": "^0.12.2",
134
+ "defu": "^6.1.4",
135
+ "hex2dec": "^1.1.2",
136
+ "nanotar": "^0.2.0"
121
137
  },
122
138
  "devDependencies": {
123
139
  "@storm-software/config": "latest",
@@ -132,5 +148,5 @@
132
148
  "tsx": "^4.20.1"
133
149
  },
134
150
  "publishConfig": { "access": "public" },
135
- "gitHead": "57da58e3434302b35f798674d9f18f92ca7f7ac9"
151
+ "gitHead": "9ad3e3608ebc05bf2f02848ad83d50f5476c9f6f"
136
152
  }
@@ -4068,6 +4068,602 @@ var Uint64List = class extends List {
4068
4068
  var VoidList = PointerList(Void);
4069
4069
  var ConnWeakRefRegistry = globalThis.FinalizationRegistry ? new FinalizationRegistry((cb) => cb()) : void 0;
4070
4070
 
4071
+ // src/compile.ts
4072
+ import { writeWarning as writeWarning2 } from "@storm-software/config-tools/logger/console";
4073
+ import defu2 from "defu";
4074
+ import { Buffer as Buffer2 } from "node:buffer";
4075
+ import { exec } from "node:child_process";
4076
+
4077
+ // src/helpers.ts
4078
+ import { writeFatal, writeWarning } from "@storm-software/config-tools/logger/console";
4079
+
4080
+ // ../type-checks/src/get-object-tag.ts
4081
+ var getObjectTag = /* @__PURE__ */ __name((value) => {
4082
+ if (value == null) {
4083
+ return value === void 0 ? "[object Undefined]" : "[object Null]";
4084
+ }
4085
+ return Object.prototype.toString.call(value);
4086
+ }, "getObjectTag");
4087
+
4088
+ // ../type-checks/src/is-plain-object.ts
4089
+ var isObjectLike = /* @__PURE__ */ __name((obj) => {
4090
+ return typeof obj === "object" && obj !== null;
4091
+ }, "isObjectLike");
4092
+ var isPlainObject = /* @__PURE__ */ __name((obj) => {
4093
+ if (!isObjectLike(obj) || getObjectTag(obj) !== "[object Object]") {
4094
+ return false;
4095
+ }
4096
+ if (Object.getPrototypeOf(obj) === null) {
4097
+ return true;
4098
+ }
4099
+ let proto = obj;
4100
+ while (Object.getPrototypeOf(proto) !== null) {
4101
+ proto = Object.getPrototypeOf(proto);
4102
+ }
4103
+ return Object.getPrototypeOf(obj) === proto;
4104
+ }, "isPlainObject");
4105
+
4106
+ // ../type-checks/src/is-object.ts
4107
+ var isObject = /* @__PURE__ */ __name((value) => {
4108
+ try {
4109
+ return typeof value === "object" || Boolean(value) && value?.constructor === Object || isPlainObject(value);
4110
+ } catch {
4111
+ return false;
4112
+ }
4113
+ }, "isObject");
4114
+
4115
+ // ../type-checks/src/is-string.ts
4116
+ var isString = /* @__PURE__ */ __name((value) => {
4117
+ try {
4118
+ return typeof value === "string";
4119
+ } catch {
4120
+ return false;
4121
+ }
4122
+ }, "isString");
4123
+
4124
+ // ../json/src/storm-json.ts
4125
+ import { parse as parse2 } from "jsonc-parser";
4126
+ import { Buffer } from "node:buffer";
4127
+ import SuperJSON from "superjson";
4128
+
4129
+ // ../types/src/base.ts
4130
+ var EMPTY_STRING = "";
4131
+ var $NestedValue = Symbol("NestedValue");
4132
+
4133
+ // ../json/src/utils/strip-comments.ts
4134
+ var singleComment = Symbol("singleComment");
4135
+ var multiComment = Symbol("multiComment");
4136
+ function stripWithoutWhitespace() {
4137
+ return "";
4138
+ }
4139
+ __name(stripWithoutWhitespace, "stripWithoutWhitespace");
4140
+ function stripWithWhitespace(value, start, end) {
4141
+ return value.slice(start, end).replace(/\S/g, " ");
4142
+ }
4143
+ __name(stripWithWhitespace, "stripWithWhitespace");
4144
+ function isEscaped(value, quotePosition) {
4145
+ let index = quotePosition - 1;
4146
+ let backslashCount = 0;
4147
+ while (value[index] === "\\") {
4148
+ index -= 1;
4149
+ backslashCount += 1;
4150
+ }
4151
+ return Boolean(backslashCount % 2);
4152
+ }
4153
+ __name(isEscaped, "isEscaped");
4154
+ function stripComments(value, { whitespace = true, trailingCommas = false } = {}) {
4155
+ if (typeof value !== "string") {
4156
+ throw new TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof value}\``);
4157
+ }
4158
+ const strip = whitespace ? stripWithWhitespace : stripWithoutWhitespace;
4159
+ let isInsideString = false;
4160
+ let isInsideComment = false;
4161
+ let offset = 0;
4162
+ let buffer = "";
4163
+ let result = "";
4164
+ let commaIndex = -1;
4165
+ for (let index = 0; index < value.length; index++) {
4166
+ const currentCharacter = value[index];
4167
+ const nextCharacter = value[index + 1];
4168
+ if (!isInsideComment && currentCharacter === '"') {
4169
+ const escaped = isEscaped(value, index);
4170
+ if (!escaped) {
4171
+ isInsideString = !isInsideString;
4172
+ }
4173
+ }
4174
+ if (isInsideString) {
4175
+ continue;
4176
+ }
4177
+ if (!isInsideComment && currentCharacter + (nextCharacter ?? EMPTY_STRING) === "//") {
4178
+ buffer += value.slice(offset, index);
4179
+ offset = index;
4180
+ isInsideComment = singleComment;
4181
+ index++;
4182
+ } else if (isInsideComment === singleComment && currentCharacter + (nextCharacter ?? EMPTY_STRING) === "\r\n") {
4183
+ index++;
4184
+ isInsideComment = false;
4185
+ buffer += strip(value, offset, index);
4186
+ offset = index;
4187
+ } else if (isInsideComment === singleComment && currentCharacter === "\n") {
4188
+ isInsideComment = false;
4189
+ buffer += strip(value, offset, index);
4190
+ offset = index;
4191
+ } else if (!isInsideComment && currentCharacter + (nextCharacter ?? EMPTY_STRING) === "/*") {
4192
+ buffer += value.slice(offset, index);
4193
+ offset = index;
4194
+ isInsideComment = multiComment;
4195
+ index++;
4196
+ } else if (isInsideComment === multiComment && currentCharacter + (nextCharacter ?? EMPTY_STRING) === "*/") {
4197
+ index++;
4198
+ isInsideComment = false;
4199
+ buffer += strip(value, offset, index + 1);
4200
+ offset = index + 1;
4201
+ } else if (trailingCommas && !isInsideComment) {
4202
+ if (commaIndex !== -1) {
4203
+ if (currentCharacter === "}" || currentCharacter === "]") {
4204
+ buffer += value.slice(offset, index);
4205
+ result += strip(buffer, 0, 1) + buffer.slice(1);
4206
+ buffer = "";
4207
+ offset = index;
4208
+ commaIndex = -1;
4209
+ } else if (currentCharacter !== " " && currentCharacter !== " " && currentCharacter !== "\r" && currentCharacter !== "\n") {
4210
+ buffer += value.slice(offset, index);
4211
+ offset = index;
4212
+ commaIndex = -1;
4213
+ }
4214
+ } else if (currentCharacter === ",") {
4215
+ result += buffer + value.slice(offset, index);
4216
+ buffer = "";
4217
+ offset = index;
4218
+ commaIndex = index;
4219
+ }
4220
+ }
4221
+ }
4222
+ return result + buffer + (isInsideComment ? strip(value.slice(offset)) : value.slice(offset));
4223
+ }
4224
+ __name(stripComments, "stripComments");
4225
+
4226
+ // ../json/src/utils/parse.ts
4227
+ var suspectProtoRx = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/;
4228
+ var suspectConstructorRx = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
4229
+ var JsonSigRx = /^\s*["[{]|^\s*-?\d{1,16}(?:\.\d{1,17})?(?:E[+-]?\d+)?\s*$/i;
4230
+ function jsonParseTransform(key, value) {
4231
+ if (key === "__proto__" || key === "constructor" && value && typeof value === "object" && "prototype" in value) {
4232
+ console.warn(`Dropping "${key}" key to prevent prototype pollution.`);
4233
+ return;
4234
+ }
4235
+ return value;
4236
+ }
4237
+ __name(jsonParseTransform, "jsonParseTransform");
4238
+ function parse(value, options = {}) {
4239
+ if (typeof value !== "string") {
4240
+ return value;
4241
+ }
4242
+ let stripped = stripComments(value);
4243
+ if (stripped[0] === '"' && stripped[stripped.length - 1] === '"' && !stripped.includes("\\")) {
4244
+ return stripped.slice(1, -1);
4245
+ }
4246
+ stripped = stripped.trim();
4247
+ if (stripped.length <= 9) {
4248
+ switch (stripped.toLowerCase()) {
4249
+ case "true": {
4250
+ return true;
4251
+ }
4252
+ case "false": {
4253
+ return false;
4254
+ }
4255
+ case "undefined": {
4256
+ return void 0;
4257
+ }
4258
+ case "null": {
4259
+ return null;
4260
+ }
4261
+ case "nan": {
4262
+ return Number.NaN;
4263
+ }
4264
+ case "infinity": {
4265
+ return Number.POSITIVE_INFINITY;
4266
+ }
4267
+ case "-infinity": {
4268
+ return Number.NEGATIVE_INFINITY;
4269
+ }
4270
+ }
4271
+ }
4272
+ if (!JsonSigRx.test(stripped)) {
4273
+ if (options.strict) {
4274
+ throw new Error("Invalid JSON");
4275
+ }
4276
+ return stripped;
4277
+ }
4278
+ try {
4279
+ if (suspectProtoRx.test(stripped) || suspectConstructorRx.test(stripped)) {
4280
+ if (options.strict) {
4281
+ throw new Error("Possible prototype pollution");
4282
+ }
4283
+ return JSON.parse(stripped, jsonParseTransform);
4284
+ }
4285
+ return JSON.parse(stripped);
4286
+ } catch (error) {
4287
+ if (options.strict) {
4288
+ throw error;
4289
+ }
4290
+ return value;
4291
+ }
4292
+ }
4293
+ __name(parse, "parse");
4294
+
4295
+ // ../json/src/utils/parse-error.ts
4296
+ import { printParseErrorCode } from "jsonc-parser";
4297
+ import { LinesAndColumns } from "lines-and-columns";
4298
+
4299
+ // ../json/src/utils/code-frames.ts
4300
+ var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
4301
+ function getMarkerLines(loc, source, opts = {}) {
4302
+ const startLoc = {
4303
+ column: 0,
4304
+ line: -1,
4305
+ ...loc.start
4306
+ };
4307
+ const endLoc = {
4308
+ ...startLoc,
4309
+ ...loc.end
4310
+ };
4311
+ const { linesAbove = 2, linesBelow = 3 } = opts || {};
4312
+ const startLine = startLoc.line;
4313
+ const startColumn = startLoc.column;
4314
+ const endLine = endLoc.line;
4315
+ const endColumn = endLoc.column;
4316
+ let start = Math.max(startLine - (linesAbove + 1), 0);
4317
+ let end = Math.min(source.length, endLine + linesBelow);
4318
+ if (startLine === -1) {
4319
+ start = 0;
4320
+ }
4321
+ if (endLine === -1) {
4322
+ end = source.length;
4323
+ }
4324
+ const lineDiff = endLine - startLine;
4325
+ const markerLines = {};
4326
+ if (lineDiff) {
4327
+ for (let i = 0; i <= lineDiff; i++) {
4328
+ const lineNumber = i + startLine;
4329
+ if (!startColumn) {
4330
+ markerLines[lineNumber] = true;
4331
+ } else if (i === 0) {
4332
+ const sourceLength = source[lineNumber - 1]?.length ?? 0;
4333
+ markerLines[lineNumber] = [
4334
+ startColumn,
4335
+ sourceLength - startColumn + 1
4336
+ ];
4337
+ } else if (i === lineDiff) {
4338
+ markerLines[lineNumber] = [
4339
+ 0,
4340
+ endColumn
4341
+ ];
4342
+ } else {
4343
+ const sourceLength = source[lineNumber - i]?.length ?? 0;
4344
+ markerLines[lineNumber] = [
4345
+ 0,
4346
+ sourceLength
4347
+ ];
4348
+ }
4349
+ }
4350
+ } else if (startColumn === endColumn) {
4351
+ markerLines[startLine] = startColumn ? [
4352
+ startColumn,
4353
+ 0
4354
+ ] : true;
4355
+ } else {
4356
+ markerLines[startLine] = [
4357
+ startColumn,
4358
+ endColumn - startColumn
4359
+ ];
4360
+ }
4361
+ return {
4362
+ start,
4363
+ end,
4364
+ markerLines
4365
+ };
4366
+ }
4367
+ __name(getMarkerLines, "getMarkerLines");
4368
+ function codeFrameColumns(rawLines, loc, opts = {}) {
4369
+ const lines = rawLines.split(NEWLINE);
4370
+ const { start, end, markerLines } = getMarkerLines(loc, lines, opts);
4371
+ const numberMaxWidth = String(end).length;
4372
+ const highlightedLines = opts.highlight ? opts.highlight(rawLines) : rawLines;
4373
+ const frame = highlightedLines.split(NEWLINE).slice(start, end).map((line, index) => {
4374
+ const number = start + 1 + index;
4375
+ const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
4376
+ const gutter = ` ${paddedNumber} | `;
4377
+ const hasMarker = Boolean(markerLines[number] ?? false);
4378
+ if (hasMarker) {
4379
+ let markerLine = "";
4380
+ if (Array.isArray(hasMarker)) {
4381
+ const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
4382
+ const numberOfMarkers = hasMarker[1] || 1;
4383
+ markerLine = [
4384
+ "\n ",
4385
+ gutter.replace(/\d/g, " "),
4386
+ markerSpacing,
4387
+ "^".repeat(numberOfMarkers)
4388
+ ].join("");
4389
+ }
4390
+ return [
4391
+ ">",
4392
+ gutter,
4393
+ line,
4394
+ markerLine
4395
+ ].join("");
4396
+ }
4397
+ return ` ${gutter}${line}`;
4398
+ }).join("\n");
4399
+ return frame;
4400
+ }
4401
+ __name(codeFrameColumns, "codeFrameColumns");
4402
+
4403
+ // ../json/src/utils/parse-error.ts
4404
+ function formatParseError(input, parseError) {
4405
+ const { error, offset, length } = parseError;
4406
+ const result = new LinesAndColumns(input).locationForIndex(offset);
4407
+ let line = result?.line ?? 0;
4408
+ let column = result?.column ?? 0;
4409
+ line++;
4410
+ column++;
4411
+ return `${printParseErrorCode(error)} in JSON at ${line}:${column}
4412
+ ${codeFrameColumns(input, {
4413
+ start: {
4414
+ line,
4415
+ column
4416
+ },
4417
+ end: {
4418
+ line,
4419
+ column: column + length
4420
+ }
4421
+ })}
4422
+ `;
4423
+ }
4424
+ __name(formatParseError, "formatParseError");
4425
+
4426
+ // ../type-checks/src/is-number.ts
4427
+ var isNumber = /* @__PURE__ */ __name((value) => {
4428
+ try {
4429
+ return value instanceof Number || typeof value === "number" || Number(value) === value;
4430
+ } catch {
4431
+ return false;
4432
+ }
4433
+ }, "isNumber");
4434
+
4435
+ // ../type-checks/src/is-undefined.ts
4436
+ var isUndefined = /* @__PURE__ */ __name((value) => {
4437
+ return value === void 0;
4438
+ }, "isUndefined");
4439
+
4440
+ // ../json/src/utils/stringify.ts
4441
+ var invalidKeyChars = [
4442
+ "@",
4443
+ "/",
4444
+ "#",
4445
+ "$",
4446
+ " ",
4447
+ ":",
4448
+ ";",
4449
+ ",",
4450
+ ".",
4451
+ "!",
4452
+ "?",
4453
+ "&",
4454
+ "=",
4455
+ "+",
4456
+ "-",
4457
+ "*",
4458
+ "%",
4459
+ "^",
4460
+ "~",
4461
+ "|",
4462
+ "\\",
4463
+ '"',
4464
+ "'",
4465
+ "`",
4466
+ "{",
4467
+ "}",
4468
+ "[",
4469
+ "]",
4470
+ "(",
4471
+ ")",
4472
+ "<",
4473
+ ">"
4474
+ ];
4475
+ var stringify = /* @__PURE__ */ __name((value, spacing = 2) => {
4476
+ const space = isNumber(spacing) ? " ".repeat(spacing) : spacing;
4477
+ switch (value) {
4478
+ case null: {
4479
+ return "null";
4480
+ }
4481
+ case void 0: {
4482
+ return '"undefined"';
4483
+ }
4484
+ case true: {
4485
+ return "true";
4486
+ }
4487
+ case false: {
4488
+ return "false";
4489
+ }
4490
+ case Number.POSITIVE_INFINITY: {
4491
+ return "infinity";
4492
+ }
4493
+ case Number.NEGATIVE_INFINITY: {
4494
+ return "-infinity";
4495
+ }
4496
+ }
4497
+ if (Array.isArray(value)) {
4498
+ return `[${space}${value.map((v) => stringify(v, space)).join(`,${space}`)}${space}]`;
4499
+ }
4500
+ if (value instanceof Uint8Array) {
4501
+ return value.toString();
4502
+ }
4503
+ switch (typeof value) {
4504
+ case "number": {
4505
+ return `${value}`;
4506
+ }
4507
+ case "string": {
4508
+ return JSON.stringify(value);
4509
+ }
4510
+ case "object": {
4511
+ const keys = Object.keys(value).filter((key) => !isUndefined(value[key]));
4512
+ return `{${space}${keys.map((key) => `${invalidKeyChars.some((invalidKeyChar) => key.includes(invalidKeyChar)) ? `"${key}"` : key}: ${space}${stringify(value[key], space)}`).join(`,${space}`)}${space}}`;
4513
+ }
4514
+ default:
4515
+ return "null";
4516
+ }
4517
+ }, "stringify");
4518
+
4519
+ // ../json/src/storm-json.ts
4520
+ var StormJSON = class _StormJSON extends SuperJSON {
4521
+ static {
4522
+ __name(this, "StormJSON");
4523
+ }
4524
+ static #instance;
4525
+ static get instance() {
4526
+ if (!_StormJSON.#instance) {
4527
+ _StormJSON.#instance = new _StormJSON();
4528
+ }
4529
+ return _StormJSON.#instance;
4530
+ }
4531
+ /**
4532
+ * Deserialize the given value with superjson using the given metadata
4533
+ */
4534
+ static deserialize(payload) {
4535
+ return _StormJSON.instance.deserialize(payload);
4536
+ }
4537
+ /**
4538
+ * Serialize the given value with superjson
4539
+ */
4540
+ static serialize(object) {
4541
+ return _StormJSON.instance.serialize(object);
4542
+ }
4543
+ /**
4544
+ * Parse the given string value with superjson using the given metadata
4545
+ *
4546
+ * @param value - The string value to parse
4547
+ * @returns The parsed data
4548
+ */
4549
+ static parse(value) {
4550
+ return parse(value);
4551
+ }
4552
+ /**
4553
+ * Serializes the given data to a JSON string.
4554
+ * By default the JSON string is formatted with a 2 space indentation to be easy readable.
4555
+ *
4556
+ * @param value - Object which should be serialized to JSON
4557
+ * @param _options - JSON serialize options
4558
+ * @returns the formatted JSON representation of the object
4559
+ */
4560
+ static stringify(value, _options) {
4561
+ const customTransformer = _StormJSON.instance.customTransformerRegistry.findApplicable(value);
4562
+ let result = value;
4563
+ if (customTransformer && customTransformer.isApplicable(value)) {
4564
+ result = customTransformer.serialize(result);
4565
+ }
4566
+ return stringify(result);
4567
+ }
4568
+ /**
4569
+ * Parses the given JSON string and returns the object the JSON content represents.
4570
+ * By default javascript-style comments and trailing commas are allowed.
4571
+ *
4572
+ * @param strData - JSON content as string
4573
+ * @param options - JSON parse options
4574
+ * @returns Object the JSON content represents
4575
+ */
4576
+ static parseJson(strData, options) {
4577
+ try {
4578
+ if (options?.expectComments === false) {
4579
+ return _StormJSON.instance.parse(strData);
4580
+ }
4581
+ } catch {
4582
+ }
4583
+ const errors = [];
4584
+ const opts = {
4585
+ allowTrailingComma: true,
4586
+ ...options
4587
+ };
4588
+ const result = parse2(strData, errors, opts);
4589
+ if (errors.length > 0 && errors[0]) {
4590
+ throw new Error(formatParseError(strData, errors[0]));
4591
+ }
4592
+ return result;
4593
+ }
4594
+ /**
4595
+ * Register a custom schema with superjson
4596
+ *
4597
+ * @param name - The name of the schema
4598
+ * @param serialize - The function to serialize the schema
4599
+ * @param deserialize - The function to deserialize the schema
4600
+ * @param isApplicable - The function to check if the schema is applicable
4601
+ */
4602
+ static register(name, serialize, deserialize, isApplicable) {
4603
+ _StormJSON.instance.registerCustom({
4604
+ isApplicable,
4605
+ serialize,
4606
+ deserialize
4607
+ }, name);
4608
+ }
4609
+ /**
4610
+ * Register a class with superjson
4611
+ *
4612
+ * @param classConstructor - The class constructor to register
4613
+ */
4614
+ static registerClass(classConstructor, options) {
4615
+ _StormJSON.instance.registerClass(classConstructor, {
4616
+ identifier: isString(options) ? options : options?.identifier || classConstructor.name,
4617
+ allowProps: options && isObject(options) && options?.allowProps && Array.isArray(options.allowProps) ? options.allowProps : [
4618
+ "__typename"
4619
+ ]
4620
+ });
4621
+ }
4622
+ constructor() {
4623
+ super({
4624
+ dedupe: true
4625
+ });
4626
+ }
4627
+ };
4628
+ StormJSON.instance.registerCustom({
4629
+ isApplicable: /* @__PURE__ */ __name((v) => Buffer.isBuffer(v), "isApplicable"),
4630
+ serialize: /* @__PURE__ */ __name((v) => v.toString("base64"), "serialize"),
4631
+ deserialize: /* @__PURE__ */ __name((v) => Buffer.from(v, "base64"), "deserialize")
4632
+ }, "Bytes");
4633
+
4634
+ // ../fs/src/read-file.ts
4635
+ import { existsSync, readFileSync as readFileSyncFs } from "node:fs";
4636
+ import { readFile as readFileFs } from "node:fs/promises";
4637
+
4638
+ // ../path/src/is-file.ts
4639
+ import { lstatSync, statSync } from "node:fs";
4640
+
4641
+ // ../path/src/exists.ts
4642
+ import { existsSync as existsSyncFs } from "node:fs";
4643
+ import { access, constants } from "node:fs/promises";
4644
+
4645
+ // ../path/src/file-path-fns.ts
4646
+ import { relative } from "node:path";
4647
+
4648
+ // ../path/src/get-workspace-root.ts
4649
+ import { findWorkspaceRootSafe } from "@storm-software/config-tools";
4650
+
4651
+ // ../fs/src/write-file.ts
4652
+ import { writeFileSync as writeFileSyncFs } from "node:fs";
4653
+ import { writeFile as writeFileFs } from "node:fs/promises";
4654
+
4655
+ // ../fs/src/helpers.ts
4656
+ import { parseTar, parseTarGzip } from "nanotar";
4657
+ import { createWriteStream, mkdirSync, rmSync } from "node:fs";
4658
+ import { mkdir, readFile, rm } from "node:fs/promises";
4659
+
4660
+ // ../fs/src/list-files.ts
4661
+ import defu from "defu";
4662
+ import { glob } from "glob";
4663
+
4664
+ // src/helpers.ts
4665
+ import { parseJsonConfigFileContent, sys } from "typescript";
4666
+
4071
4667
  // src/rpc.ts
4072
4668
  import { MessageChannel } from "node:worker_threads";
4073
4669