@r_masseater/masseater-utils 0.0.0 → 0.1.2

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.
Files changed (130) hide show
  1. package/LICENSE +87 -0
  2. package/README.md +97 -1
  3. package/dist/context-B_4aJtEC.mjs +6 -0
  4. package/dist/context-B_4aJtEC.mjs.map +1 -0
  5. package/dist/failure-CjeINRVu.mjs +19 -0
  6. package/dist/failure-CjeINRVu.mjs.map +1 -0
  7. package/dist/github-workflow.d.mts +77 -0
  8. package/dist/github-workflow.mjs +110 -0
  9. package/dist/github-workflow.mjs.map +1 -0
  10. package/dist/index-CUo4CRam.d.mts +1 -0
  11. package/dist/index-Cb8YSEwo.d.mts +31 -0
  12. package/dist/index-DudHILTn.d.mts +6 -0
  13. package/dist/index-KNezbJnC.d.mts +121 -0
  14. package/dist/kestrion-node.d.mts +6 -0
  15. package/dist/kestrion-node.mjs +9 -0
  16. package/dist/kestrion-node.mjs.map +1 -0
  17. package/dist/kestrion-npm.d.mts +25 -0
  18. package/dist/kestrion-npm.mjs +54 -0
  19. package/dist/kestrion-npm.mjs.map +1 -0
  20. package/dist/kestrion-pnpm.d.mts +29 -0
  21. package/dist/kestrion-pnpm.mjs +68 -0
  22. package/dist/kestrion-pnpm.mjs.map +1 -0
  23. package/dist/kestrion.d.mts +2 -0
  24. package/dist/kestrion.mjs +46 -0
  25. package/dist/kestrion.mjs.map +1 -0
  26. package/dist/mapped-import-mapper.d.mts +24 -0
  27. package/dist/mapped-import-mapper.mjs +34 -0
  28. package/dist/mapped-import-mapper.mjs.map +1 -0
  29. package/dist/mapped-import-vite.d.mts +21 -0
  30. package/dist/mapped-import-vite.mjs +49 -0
  31. package/dist/mapped-import-vite.mjs.map +1 -0
  32. package/dist/mapped-import.d.mts +2 -0
  33. package/dist/mapped-import.mjs +36 -0
  34. package/dist/mapped-import.mjs.map +1 -0
  35. package/dist/node-main.d.mts +19 -0
  36. package/dist/node-main.mjs +59 -0
  37. package/dist/node-main.mjs.map +1 -0
  38. package/dist/normalize-CogX79EO.mjs +76 -0
  39. package/dist/normalize-CogX79EO.mjs.map +1 -0
  40. package/dist/otlp-ohapzeFh.mjs +18 -0
  41. package/dist/otlp-ohapzeFh.mjs.map +1 -0
  42. package/dist/otlp-schema-CDBPGJ5s.mjs +125 -0
  43. package/dist/otlp-schema-CDBPGJ5s.mjs.map +1 -0
  44. package/dist/otlp-spans-D88555DO.mjs +52 -0
  45. package/dist/otlp-spans-D88555DO.mjs.map +1 -0
  46. package/dist/package-json-CYRyaF9U.mjs +58 -0
  47. package/dist/package-json-CYRyaF9U.mjs.map +1 -0
  48. package/dist/plugin-kit.d.mts +5663 -0
  49. package/dist/plugin-kit.mjs +11501 -0
  50. package/dist/plugin-kit.mjs.map +1 -0
  51. package/dist/receive-S2txZwcV.mjs +61 -0
  52. package/dist/receive-S2txZwcV.mjs.map +1 -0
  53. package/dist/route-handlers-Cn3O2hmf.mjs +14 -0
  54. package/dist/route-handlers-Cn3O2hmf.mjs.map +1 -0
  55. package/dist/route-handlers-E2lwhaAf.d.mts +14 -0
  56. package/dist/run-Cc5W9mi8.mjs +13 -0
  57. package/dist/run-Cc5W9mi8.mjs.map +1 -0
  58. package/dist/run-D59Owiv1.d.mts +5 -0
  59. package/dist/skerm.d.mts +6 -0
  60. package/dist/skerm.mjs +128 -0
  61. package/dist/skerm.mjs.map +1 -0
  62. package/dist/span-BKjRu617.mjs +60 -0
  63. package/dist/span-BKjRu617.mjs.map +1 -0
  64. package/dist/telemetry-BEWIE8tU.d.mts +51 -0
  65. package/dist/vitest-otlp-collector-files.d.mts +8 -0
  66. package/dist/vitest-otlp-collector-files.mjs +13 -0
  67. package/dist/vitest-otlp-collector-files.mjs.map +1 -0
  68. package/dist/vitest-otlp-current-receiver-8c7rIP1N.mjs +13 -0
  69. package/dist/vitest-otlp-current-receiver-8c7rIP1N.mjs.map +1 -0
  70. package/dist/vitest-otlp-current-receiver-DphmM9Ha.d.mts +10 -0
  71. package/dist/vitest-otlp-semconv.d.mts +3 -0
  72. package/dist/vitest-otlp-semconv.mjs +92 -0
  73. package/dist/vitest-otlp-semconv.mjs.map +1 -0
  74. package/dist/vitest-otlp-setup.d.mts +1 -0
  75. package/dist/vitest-otlp-setup.mjs +295 -0
  76. package/dist/vitest-otlp-setup.mjs.map +1 -0
  77. package/dist/vitest-otlp-tail-to-otlp.mjs +271 -0
  78. package/dist/vitest-otlp-tail-to-otlp.mjs.map +1 -0
  79. package/dist/vitest-otlp-workers.d.mts +26 -0
  80. package/dist/vitest-otlp-workers.mjs +54 -0
  81. package/dist/vitest-otlp-workers.mjs.map +1 -0
  82. package/dist/vitest-otlp.d.mts +51 -0
  83. package/dist/vitest-otlp.mjs +66 -0
  84. package/dist/vitest-otlp.mjs.map +1 -0
  85. package/dist/workers-tracing-alchemy.d.mts +22 -0
  86. package/dist/workers-tracing-alchemy.mjs +124 -0
  87. package/dist/workers-tracing-alchemy.mjs.map +1 -0
  88. package/dist/workers-tracing-browser-logs.d.mts +4 -0
  89. package/dist/workers-tracing-browser-logs.mjs +67 -0
  90. package/dist/workers-tracing-browser-logs.mjs.map +1 -0
  91. package/dist/workers-tracing-browser-spans.d.mts +4 -0
  92. package/dist/workers-tracing-browser-spans.mjs +13 -0
  93. package/dist/workers-tracing-browser-spans.mjs.map +1 -0
  94. package/dist/workers-tracing-effect-tracing.d.mts +8 -0
  95. package/dist/workers-tracing-effect-tracing.mjs +68 -0
  96. package/dist/workers-tracing-effect-tracing.mjs.map +1 -0
  97. package/dist/workers-tracing-effect-tracing.plain.d.mts +7 -0
  98. package/dist/workers-tracing-effect-tracing.plain.mjs +9 -0
  99. package/dist/workers-tracing-effect-tracing.plain.mjs.map +1 -0
  100. package/dist/workers-tracing-elysia.d.mts +5 -0
  101. package/dist/workers-tracing-elysia.mjs +53 -0
  102. package/dist/workers-tracing-elysia.mjs.map +1 -0
  103. package/dist/workers-tracing-elysia.plain.d.mts +3 -0
  104. package/dist/workers-tracing-elysia.plain.mjs +3 -0
  105. package/dist/workers-tracing-oxlint.d.mts +6 -0
  106. package/dist/workers-tracing-oxlint.mjs +8 -0
  107. package/dist/workers-tracing-oxlint.mjs.map +1 -0
  108. package/dist/workers-tracing-tanstack-start.d.mts +22 -0
  109. package/dist/workers-tracing-tanstack-start.mjs +28 -0
  110. package/dist/workers-tracing-tanstack-start.mjs.map +1 -0
  111. package/dist/workers-tracing-tanstack-start.plain.d.mts +9 -0
  112. package/dist/workers-tracing-tanstack-start.plain.mjs +10 -0
  113. package/dist/workers-tracing-tanstack-start.plain.mjs.map +1 -0
  114. package/dist/workers-tracing-trace-sink.d.mts +7 -0
  115. package/dist/workers-tracing-trace-sink.mjs +29 -0
  116. package/dist/workers-tracing-trace-sink.mjs.map +1 -0
  117. package/dist/workers-tracing-workers-ai.d.mts +33 -0
  118. package/dist/workers-tracing-workers-ai.mjs +108 -0
  119. package/dist/workers-tracing-workers-ai.mjs.map +1 -0
  120. package/package.json +252 -5
  121. package/skills/add-scroll-chip-row/SKILL.md +59 -0
  122. package/skills/assert-exported-telemetry/SKILL.md +131 -0
  123. package/skills/find-cache-folder/SKILL.md +36 -0
  124. package/skills/import-custom-format/SKILL.md +76 -0
  125. package/skills/read-hook-input/SKILL.md +39 -0
  126. package/skills/read-node-ecosystem/SKILL.md +131 -0
  127. package/skills/run-effect-main/SKILL.md +82 -0
  128. package/skills/trace-workers/SKILL.md +152 -0
  129. package/skills/write-actions-steps/SKILL.md +76 -0
  130. package/src/app/skerm.css +139 -0
package/LICENSE ADDED
@@ -0,0 +1,87 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 masseater
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ @tanstack/eslint-plugin-start
26
+
27
+ MIT License
28
+
29
+ Copyright (c) 2021-present Tanner Linsley
30
+
31
+ Permission is hereby granted, free of charge, to any person obtaining a copy
32
+ of this software and associated documentation files (the "Software"), to deal
33
+ in the Software without restriction, including without limitation the rights
34
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
35
+ copies of the Software, and to permit persons to whom the Software is
36
+ furnished to do so, subject to the following conditions:
37
+
38
+ The above copyright notice and this permission notice shall be included in all
39
+ copies or substantial portions of the Software.
40
+
41
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
42
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
43
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
44
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
45
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
46
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
47
+ SOFTWARE.
48
+
49
+ ---
50
+
51
+ @typescript-eslint/utils
52
+
53
+ MIT License
54
+
55
+ Copyright (c) 2019 typescript-eslint and other contributors
56
+
57
+ Permission is hereby granted, free of charge, to any person obtaining a copy
58
+ of this software and associated documentation files (the "Software"), to deal
59
+ in the Software without restriction, including without limitation the rights
60
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
61
+ copies of the Software, and to permit persons to whom the Software is
62
+ furnished to do so, subject to the following conditions:
63
+
64
+ The above copyright notice and this permission notice shall be included in all
65
+ copies or substantial portions of the Software.
66
+
67
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
68
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
69
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
70
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
71
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
72
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
73
+ SOFTWARE.
74
+
75
+ ---
76
+
77
+ globals
78
+
79
+ MIT License
80
+
81
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
82
+
83
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
84
+
85
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
86
+
87
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,99 @@
1
1
  # @r_masseater/masseater-utils
2
2
 
3
- This version only reserves the name. Releases come from CI.
3
+ The small shared libraries of masseater's repositories in one package. Each library is a subpath, so you import only the one you need and install no more than that library asks for: every dependency a subpath needs besides `effect` is an optional peer dependency.
4
+
5
+ It requires Node.js 26 or later.
6
+
7
+ ```sh
8
+ vp add @r_masseater/masseater-utils
9
+ ```
10
+
11
+ | Subpath | What it does |
12
+ | ---------------------------------------------- | --------------------------------------------------------------------- |
13
+ | `@r_masseater/masseater-utils/skerm` | A horizontally scrolling row of chips for React. |
14
+ | `@r_masseater/masseater-utils/plugin-kit` | Shared code for Claude Code plugin hooks and scripts. |
15
+ | `@r_masseater/masseater-utils/node-main` | Runs an Effect program as a Node.js entry point. |
16
+ | `@r_masseater/masseater-utils/github-workflow` | Helpers for GitHub Actions steps written with Effect. |
17
+ | `@r_masseater/masseater-utils/mapped-import` | Imports files in your own format from TypeScript. |
18
+ | `@r_masseater/masseater-utils/kestrion` | The Node.js package ecosystem as Effect. |
19
+ | `@r_masseater/masseater-utils/vitest-otlp` | A Vitest plugin that receives OTLP telemetry during tests. |
20
+ | `@r_masseater/masseater-utils/workers-tracing` | Effect, TanStack Start and Elysia spans in Cloudflare Workers traces. |
21
+
22
+ ## Install what a subpath needs
23
+
24
+ Install the peer dependencies of the subpath you import, and nothing else. A subpath that needs no extra package, such as `plugin-kit` (which bundles what it needs of Effect), installs this package alone.
25
+
26
+ | Subpath | Install besides this package |
27
+ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
28
+ | `skerm` | `react` |
29
+ | `plugin-kit` | Nothing. |
30
+ | `node-main` | `effect` and `@effect/platform-node` |
31
+ | `github-workflow` | `effect` |
32
+ | `mapped-import` | `effect` and `ts-content-mapper`, plus `vite-plus` for `mapped-import/vite` |
33
+ | `kestrion` | `effect`, plus the readers of the entry you use: `@npmcli/package-json` for `kestrion/npm`, the `@pnpm/*` readers for `kestrion/pnpm` |
34
+ | `vitest-otlp` | `effect`, `@bufbuild/protobuf` and `vite-plus` |
35
+ | `workers-tracing` | `effect`, plus `@tanstack/react-start`, `elysia`, `alchemy` or `@alchemy.run/cloudflare` for the entry that wraps them |
36
+
37
+ The `peerDependencies` of `package.json` are the exact list with ranges.
38
+
39
+ ## Examples
40
+
41
+ Import an entry and call it. Each snippet is the shortest working use.
42
+
43
+ ```ts
44
+ import { runMain } from "@r_masseater/masseater-utils/node-main";
45
+ import { Console } from "effect";
46
+
47
+ runMain("my-tool")(Console.log("hello"));
48
+ ```
49
+
50
+ ```ts
51
+ import { isRecord, parseJson } from "@r_masseater/masseater-utils/plugin-kit";
52
+
53
+ const parsed = parseJson(text);
54
+ if (parsed._tag === "Some" && isRecord(parsed.value)) {
55
+ console.log(parsed.value["tool_name"]);
56
+ }
57
+ ```
58
+
59
+ ```ts
60
+ import { ScrollChipRow } from "@r_masseater/masseater-utils/skerm";
61
+
62
+ import "@r_masseater/masseater-utils/skerm.css";
63
+ ```
64
+
65
+ ```ts
66
+ import { otlp } from "@r_masseater/masseater-utils/vitest-otlp";
67
+ import { defineConfig } from "vite-plus";
68
+
69
+ export default defineConfig({ plugins: [otlp()] });
70
+ ```
71
+
72
+ ```ts
73
+ import { providers } from "@alchemy.run/cloudflare";
74
+ import { withWorkersTracing } from "@r_masseater/masseater-utils/workers-tracing/alchemy";
75
+
76
+ const traced = withWorkersTracing()(providers());
77
+ ```
78
+
79
+ The agent skills below describe every subpath in full: its API, the failures it reports and the recipes that go with it.
80
+
81
+ ## Agent skills
82
+
83
+ The package ships agent skills in `skills/`, one per library. Add `permissions: { "@r_masseater/masseater-utils": { skills: true } }` to `pnpm-workspace.yaml` and `vp install` links them into the skill directories of your agents.
84
+
85
+ | Skill | Library |
86
+ | --------------------------- | ----------------- |
87
+ | `add-scroll-chip-row` | `skerm` |
88
+ | `read-hook-input` | `plugin-kit` |
89
+ | `find-cache-folder` | `plugin-kit` |
90
+ | `run-effect-main` | `node-main` |
91
+ | `write-actions-steps` | `github-workflow` |
92
+ | `import-custom-format` | `mapped-import` |
93
+ | `read-node-ecosystem` | `kestrion` |
94
+ | `assert-exported-telemetry` | `vitest-otlp` |
95
+ | `trace-workers` | `workers-tracing` |
96
+
97
+ ## License
98
+
99
+ [MIT](LICENSE)
@@ -0,0 +1,6 @@
1
+ // src/entities/semconv/model/context.ts
2
+ const SEMCONV_KEY = "vitest-otlp:semconv";
3
+ const FORWARD_KEY = "vitest-otlp:forward";
4
+ export { SEMCONV_KEY as n, FORWARD_KEY as t };
5
+
6
+ //# sourceMappingURL=context-B_4aJtEC.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-B_4aJtEC.mjs","names":[],"sources":["../src/entities/semconv/model/context.ts"],"sourcesContent":["export type SemconvLevel = \"violation\" | \"improvement\" | \"information\";\n\nexport interface SemconvOptions {\n readonly registry?: string;\n readonly weaver?: string;\n readonly failOn?: SemconvLevel;\n}\n\nexport interface ResolvedSemconv {\n readonly registry: string;\n readonly weaver: string;\n readonly failOn: SemconvLevel;\n}\n\nexport const SEMCONV_KEY = \"vitest-otlp:semconv\";\nexport const FORWARD_KEY = \"vitest-otlp:forward\";\n\ndeclare module \"vite-plus/test\" {\n interface ProvidedContext {\n readonly [SEMCONV_KEY]?: ResolvedSemconv;\n readonly [FORWARD_KEY]?: readonly string[];\n }\n}\n"],"mappings":";AAcA,MAAa,cAAc;AAC3B,MAAa,cAAc"}
@@ -0,0 +1,19 @@
1
+ import { Array, Cause, Function, Option, Predicate, pipe } from "effect";
2
+ // src/shared/lib/failure.ts
3
+ const NOT_FOUND = 404;
4
+ const SERVER_ERROR = 500;
5
+ const isNotFound = (thrown) => Predicate.hasProperty(thrown, "isNotFound") && thrown.isNotFound === true;
6
+ const responseStatus = (thrown) => {
7
+ if (thrown instanceof Response) return Option.some(thrown.status);
8
+ if (isNotFound(thrown)) return Option.some(NOT_FOUND);
9
+ return Option.none();
10
+ };
11
+ const isServerError = (status) => status >= SERVER_ERROR;
12
+ const isFailure = (thrown) => pipe(responseStatus(thrown), Option.match({
13
+ onNone: Function.constTrue,
14
+ onSome: isServerError
15
+ }));
16
+ const failures = (cause) => pipe(cause.reasons, Array.filter((reason) => Cause.isFailReason(reason) && isFailure(reason.error) || Cause.isDieReason(reason) && isFailure(reason.defect)), Option.liftPredicate(Array.isReadonlyArrayNonEmpty), Option.map(Cause.fromReasons));
17
+ export { isServerError as n, responseStatus as r, failures as t };
18
+
19
+ //# sourceMappingURL=failure-CjeINRVu.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"failure-CjeINRVu.mjs","names":[],"sources":["../src/shared/lib/failure.ts"],"sourcesContent":["import { Array, Cause, Function, Option, Predicate, pipe } from \"effect\";\n\nconst NOT_FOUND = 404;\nconst SERVER_ERROR = 500;\n\nconst isNotFound = (thrown: unknown): boolean =>\n Predicate.hasProperty(thrown, \"isNotFound\") && thrown.isNotFound === true;\n\nexport const responseStatus = (thrown: unknown): Option.Option<number> => {\n if (thrown instanceof Response) {\n return Option.some(thrown.status);\n }\n if (isNotFound(thrown)) {\n return Option.some(NOT_FOUND);\n }\n return Option.none();\n};\n\nexport const isServerError = (status: number): boolean => status >= SERVER_ERROR;\n\nconst isFailure = (thrown: unknown): boolean =>\n pipe(responseStatus(thrown), Option.match({ onNone: Function.constTrue, onSome: isServerError }));\n\nexport const failures = (cause: Cause.Cause<unknown>): Option.Option<Cause.Cause<unknown>> =>\n pipe(\n cause.reasons,\n Array.filter(\n (reason) =>\n (Cause.isFailReason(reason) && isFailure(reason.error)) ||\n (Cause.isDieReason(reason) && isFailure(reason.defect)),\n ),\n Option.liftPredicate(Array.isReadonlyArrayNonEmpty),\n Option.map(Cause.fromReasons),\n );\n"],"mappings":";;AAEA,MAAM,YAAY;AAClB,MAAM,eAAe;AAErB,MAAM,cAAc,WAClB,UAAU,YAAY,QAAQ,YAAY,KAAK,OAAO,eAAe;AAEvE,MAAa,kBAAkB,WAA2C;CACxE,IAAI,kBAAkB,UACpB,OAAO,OAAO,KAAK,OAAO,MAAM;CAElC,IAAI,WAAW,MAAM,GACnB,OAAO,OAAO,KAAK,SAAS;CAE9B,OAAO,OAAO,KAAK;AACrB;AAEA,MAAa,iBAAiB,WAA4B,UAAU;AAEpE,MAAM,aAAa,WACjB,KAAK,eAAe,MAAM,GAAG,OAAO,MAAM;CAAE,QAAQ,SAAS;CAAW,QAAQ;AAAc,CAAC,CAAC;AAElG,MAAa,YAAY,UACvB,KACE,MAAM,SACN,MAAM,QACH,WACE,MAAM,aAAa,MAAM,KAAK,UAAU,OAAO,KAAK,KACpD,MAAM,YAAY,MAAM,KAAK,UAAU,OAAO,MAAM,CACzD,GACA,OAAO,cAAc,MAAM,uBAAuB,GAClD,OAAO,IAAI,MAAM,WAAW,CAC9B"}
@@ -0,0 +1,77 @@
1
+ import { Config, Duration, Effect, FileSystem, PlatformError, Schema } from "effect";
2
+ import { HttpBody, HttpClient, HttpClientError } from "effect/http";
3
+ import { ChildProcessSpawner } from "effect/process";
4
+ /** @internal */
5
+ type Failure = Config.ConfigError | HttpBody.HttpBodyError | HttpClientError.HttpClientError;
6
+ /** @internal */
7
+ type Sent<Success> = Effect.Effect<Success, Failure, HttpClient.HttpClient>;
8
+ declare const getJsonOf: <Codec extends Schema.Constraint>(schema: Codec) => (path: string) => Effect.Effect<Codec["Type"], Failure | Schema.SchemaError, HttpClient.HttpClient | Codec["DecodingServices"]>;
9
+ declare const postJsonOf: <Codec extends Schema.Constraint>(schema: Codec) => ({ path, body }: Write) => Effect.Effect<Codec["Type"], Failure | Schema.SchemaError, HttpClient.HttpClient | Codec["DecodingServices"]>;
10
+ declare const removeAt: (path: string) => Sent<void>;
11
+ /** @internal */
12
+ interface Write {
13
+ readonly path: string;
14
+ readonly body: unknown;
15
+ }
16
+ declare const postTo: ({ path, body }: Write) => Sent<void>;
17
+ declare const patchAt: ({ path, body }: Write) => Sent<void>;
18
+ /** @internal */
19
+ export declare const getJson: typeof getJsonOf;
20
+ /** @internal */
21
+ export declare const remove: typeof removeAt;
22
+ /** @internal */
23
+ export declare const post: typeof postTo;
24
+ /** @internal */
25
+ export declare const patch: typeof patchAt;
26
+ /** @internal */
27
+ export declare const postJson: typeof postJsonOf;
28
+ declare const CommandFailed_base: Schema.Class<CommandFailed, Schema.TaggedStruct<"CommandFailed", {
29
+ readonly message: Schema.String;
30
+ }>, import("effect/Cause").YieldableError & {
31
+ readonly brand: unique symbol;
32
+ }>;
33
+ export declare class CommandFailed extends CommandFailed_base {}
34
+ interface Command {
35
+ readonly command: string;
36
+ readonly args: readonly string[];
37
+ readonly env?: Readonly<Record<string, string>>;
38
+ readonly cwd?: string;
39
+ readonly forceKillAfter?: Duration.Input;
40
+ }
41
+ /** @internal */
42
+ type Spawned<Success> = Effect.Effect<Success, CommandFailed | PlatformError.PlatformError, ChildProcessSpawner.ChildProcessSpawner>;
43
+ declare const succeedsWith: (command: Command) => Spawned<boolean>;
44
+ declare const mustSucceedWith: (command: Command) => Spawned<void>;
45
+ declare const outputWith: (command: Command) => Spawned<string>;
46
+ /** @internal */
47
+ export declare const succeeds: typeof succeedsWith;
48
+ /** @internal */
49
+ export declare const mustSucceed: typeof mustSucceedWith;
50
+ declare const finishedWith: (command: Command) => Spawned<Readonly<{
51
+ output: string;
52
+ code: number;
53
+ }>>;
54
+ /** @internal */
55
+ export declare const outputOf: typeof outputWith;
56
+ /** @internal */
57
+ export declare const finished: typeof finishedWith;
58
+ /** @internal */
59
+ type Appended = Effect.Effect<void, Config.ConfigError | PlatformError.PlatformError, FileSystem.FileSystem>;
60
+ declare const WorkflowFailed_base: Schema.Class<WorkflowFailed, Schema.TaggedStruct<"WorkflowFailed", {
61
+ readonly message: Schema.String;
62
+ }>, import("effect/Cause").YieldableError & {
63
+ readonly brand: unique symbol;
64
+ }>;
65
+ export declare class WorkflowFailed extends WorkflowFailed_base {}
66
+ declare const outputsOf: (outputs: Readonly<Record<string, string>>) => Appended;
67
+ declare const envOf: (variables: Readonly<Record<string, string>>) => Appended;
68
+ /** @internal */
69
+ export declare const writeOutputs: typeof outputsOf;
70
+ /** @internal */
71
+ export declare const setEnv: typeof envOf;
72
+ export declare const warn: (message: string) => Effect.Effect<void>;
73
+ export declare const mask: (value: string) => Effect.Effect<void>;
74
+ export declare const fail: (message: string) => Effect.Effect<never, WorkflowFailed, never>;
75
+ export declare const sha256Of: (parts: readonly Uint8Array[]) => Effect.Effect<string>;
76
+ export type { Command };
77
+ //# sourceMappingURL=github-workflow.d.mts.map
@@ -0,0 +1,110 @@
1
+ import { Array, Config, Console, Duration, Effect, FileSystem, Record, Redacted, Schema, Stream, String, pipe } from "effect";
2
+ import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/http";
3
+ import { ChildProcess, ChildProcessSpawner } from "effect/process";
4
+ import { Hex } from "effect/encoding";
5
+ // src/shared/api/github/github.ts
6
+ const API = "https://api.github.com";
7
+ const HEADERS = {
8
+ accept: "application/vnd.github+json",
9
+ "user-agent": "@r_masseater/masseater-utils/github-workflow",
10
+ "x-github-api-version": "2022-11-28"
11
+ };
12
+ const requestTo = Effect.fn("requestTo")(function* requestTo(method, path) {
13
+ const repository = yield* Config.String("GITHUB_REPOSITORY");
14
+ const token = yield* Config.Redacted("GH_TOKEN").pipe(Config.orElse(() => Config.Redacted("GITHUB_TOKEN")));
15
+ return HttpClientRequest.make(method)(`${API}/repos/${repository}/${path}`).pipe(HttpClientRequest.bearerToken(Redacted.value(token)), HttpClientRequest.setHeaders(HEADERS));
16
+ });
17
+ const execute = Effect.fn("execute")(function* execute(request) {
18
+ const response = yield* (yield* HttpClient.HttpClient).execute(request);
19
+ return yield* HttpClientResponse.filterStatusOk(response);
20
+ });
21
+ const withBody = Effect.fn("withBody")(function* withBody(method, path, body) {
22
+ const request = yield* requestTo(method, path);
23
+ const filled = yield* HttpClientRequest.bodyJson(request, body);
24
+ return yield* execute(filled);
25
+ });
26
+ const getJsonOf = (schema) => (path) => requestTo("GET", path).pipe(Effect.flatMap(execute), Effect.flatMap(HttpClientResponse.schemaBodyJson(schema)));
27
+ const postJsonOf = (schema) => ({ path, body }) => withBody("POST", path, body).pipe(Effect.flatMap(HttpClientResponse.schemaBodyJson(schema)));
28
+ const removeAt = (path) => requestTo("DELETE", path).pipe(Effect.flatMap(execute), Effect.asVoid);
29
+ const postTo = ({ path, body }) => withBody("POST", path, body).pipe(Effect.asVoid);
30
+ const patchAt = ({ path, body }) => withBody("PATCH", path, body).pipe(Effect.asVoid);
31
+ /** @internal */
32
+ const getJson = getJsonOf;
33
+ /** @internal */
34
+ const remove = removeAt;
35
+ /** @internal */
36
+ const post = postTo;
37
+ /** @internal */
38
+ const patch = patchAt;
39
+ /** @internal */
40
+ const postJson = postJsonOf;
41
+ // src/shared/lib/process.ts
42
+ const SUCCESS = 0;
43
+ const FORCE_KILL_AFTER = Duration.seconds(10);
44
+ const taggedError$1 = Schema.TaggedError;
45
+ var CommandFailed = class extends taggedError$1()("CommandFailed", { message: Schema.String }) {};
46
+ const failed = ({ command, args }) => CommandFailed.make({ message: `${command} ${Array.join(args, " ")} failed` });
47
+ const exitCodeOf = Effect.fn("exitCodeOf")(function* exitCodeOf({ command, args, env, cwd, forceKillAfter = FORCE_KILL_AFTER }) {
48
+ return yield* (yield* ChildProcessSpawner.ChildProcessSpawner).exitCode(ChildProcess.make(command, args, {
49
+ cwd,
50
+ env,
51
+ extendEnv: true,
52
+ stdin: "ignore",
53
+ stdout: "inherit",
54
+ stderr: "inherit",
55
+ forceKillAfter
56
+ }));
57
+ });
58
+ const succeedsWith = (command) => exitCodeOf(command).pipe(Effect.map((code) => code === SUCCESS));
59
+ const mustSucceedWith = (command) => succeedsWith(command).pipe(Effect.filterOrFail((passed) => passed, () => failed(command)), Effect.asVoid);
60
+ const collected = Effect.fn("collected")(function* collected({ command, args, env, cwd, forceKillAfter = FORCE_KILL_AFTER }) {
61
+ const handle = yield* ChildProcess.make(command, args, {
62
+ cwd,
63
+ env,
64
+ extendEnv: true,
65
+ stdin: "ignore",
66
+ stderr: "inherit",
67
+ forceKillAfter
68
+ });
69
+ const [output, code] = yield* Effect.all([handle.stdout.pipe(Stream.decodeText(), Stream.mkString), handle.exitCode], { concurrency: "unbounded" });
70
+ return {
71
+ output,
72
+ code
73
+ };
74
+ });
75
+ const outputWith = (command) => collected(command).pipe(Effect.scoped, Effect.filterOrFail(({ code }) => code === SUCCESS, () => failed(command)), Effect.map(({ output }) => String.trim(output)));
76
+ /** @internal */
77
+ const succeeds = succeedsWith;
78
+ /** @internal */
79
+ const mustSucceed = mustSucceedWith;
80
+ const finishedWith = (command) => Effect.scoped(collected(command));
81
+ /** @internal */
82
+ const outputOf = outputWith;
83
+ /** @internal */
84
+ const finished = finishedWith;
85
+ // src/shared/lib/workflow.ts
86
+ const taggedError = Schema.TaggedError;
87
+ var WorkflowFailed = class extends taggedError()("WorkflowFailed", { message: Schema.String }) {};
88
+ const appendTo = (variable, entries) => Effect.gen(function* appended() {
89
+ const path = yield* Config.String(variable);
90
+ const fs = yield* FileSystem.FileSystem;
91
+ const lines = pipe(Record.toEntries(entries), Array.map(([name, value]) => `${name}=${value}\n`), Array.join(""));
92
+ yield* fs.writeFileString(path, lines, { flag: "a" });
93
+ });
94
+ const outputsOf = (outputs) => appendTo("GITHUB_OUTPUT", outputs);
95
+ const envOf = (variables) => appendTo("GITHUB_ENV", variables);
96
+ /** @internal */
97
+ const writeOutputs = outputsOf;
98
+ /** @internal */
99
+ const setEnv = envOf;
100
+ const warn = (message) => Console.log(`::warning::${message}`);
101
+ const mask = (value) => Console.log(`::add-mask::${value}`);
102
+ const fail = Effect.fn("fail")(function* fail(message) {
103
+ yield* Console.log(`::error::${message}`);
104
+ return yield* WorkflowFailed.make({ message });
105
+ });
106
+ // src/shared/lib/digest.ts
107
+ const sha256Of = (parts) => Effect.promise(() => new Blob(pipe(parts, Array.map((part) => new Uint8Array(part)))).arrayBuffer()).pipe(Effect.flatMap((bytes) => Effect.promise(() => crypto.subtle.digest("SHA-256", bytes))), Effect.map((digest) => Hex.encode(new Uint8Array(digest))));
108
+ export { CommandFailed, WorkflowFailed, fail, finished, getJson, mask, mustSucceed, outputOf, patch, post, postJson, remove, setEnv, sha256Of, succeeds, warn, writeOutputs };
109
+
110
+ //# sourceMappingURL=github-workflow.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-workflow.mjs","names":["taggedError","Arr","Str","Rec","Arr","Arr"],"sources":["../src/shared/api/github/github.ts","../src/shared/lib/process.ts","../src/shared/lib/workflow.ts","../src/shared/lib/digest.ts"],"sourcesContent":["import { Config, Effect, Redacted } from \"effect\";\nimport type { Schema } from \"effect\";\nimport { HttpClient, HttpClientRequest, HttpClientResponse } from \"effect/http\";\nimport type { HttpBody, HttpClientError, HttpMethod } from \"effect/http\";\n\nconst API = \"https://api.github.com\";\nconst HEADERS = {\n accept: \"application/vnd.github+json\",\n \"user-agent\": \"@r_masseater/masseater-utils/github-workflow\",\n \"x-github-api-version\": \"2022-11-28\",\n};\n\n/** @internal */\nexport type Failure = Config.ConfigError | HttpBody.HttpBodyError | HttpClientError.HttpClientError;\n\n/** @internal */\nexport type Sent<Success> = Effect.Effect<Success, Failure, HttpClient.HttpClient>;\n\nconst requestTo = Effect.fn(\"requestTo\")(function* requestTo(\n method: HttpMethod.HttpMethod,\n path: string,\n) {\n const repository = yield* Config.String(\"GITHUB_REPOSITORY\");\n const token = yield* Config.Redacted(\"GH_TOKEN\").pipe(\n Config.orElse(() => Config.Redacted(\"GITHUB_TOKEN\")),\n );\n return HttpClientRequest.make(method)(`${API}/repos/${repository}/${path}`).pipe(\n HttpClientRequest.bearerToken(Redacted.value(token)),\n HttpClientRequest.setHeaders(HEADERS),\n );\n});\n\nconst execute = Effect.fn(\"execute\")(function* execute(\n request: HttpClientRequest.HttpClientRequest,\n) {\n const client = yield* HttpClient.HttpClient;\n const response = yield* client.execute(request);\n return yield* HttpClientResponse.filterStatusOk(response);\n});\n\nconst withBody = Effect.fn(\"withBody\")(function* withBody(\n method: HttpMethod.HttpMethod.WithBody,\n path: string,\n body: unknown,\n) {\n const request = yield* requestTo(method, path);\n const filled = yield* HttpClientRequest.bodyJson(request, body);\n return yield* execute(filled);\n});\n\nconst getJsonOf =\n <Codec extends Schema.Constraint>(schema: Codec) =>\n (\n path: string,\n ): Effect.Effect<\n Codec[\"Type\"],\n Failure | Schema.SchemaError,\n HttpClient.HttpClient | Codec[\"DecodingServices\"]\n > =>\n requestTo(\"GET\", path).pipe(\n Effect.flatMap(execute),\n Effect.flatMap(HttpClientResponse.schemaBodyJson(schema)),\n );\n\nconst postJsonOf =\n <Codec extends Schema.Constraint>(schema: Codec) =>\n ({\n path,\n body,\n }: Write): Effect.Effect<\n Codec[\"Type\"],\n Failure | Schema.SchemaError,\n HttpClient.HttpClient | Codec[\"DecodingServices\"]\n > =>\n withBody(\"POST\", path, body).pipe(Effect.flatMap(HttpClientResponse.schemaBodyJson(schema)));\n\nconst removeAt = (path: string): Sent<void> =>\n requestTo(\"DELETE\", path).pipe(Effect.flatMap(execute), Effect.asVoid);\n\n/** @internal */\nexport interface Write {\n readonly path: string;\n readonly body: unknown;\n}\n\nconst postTo = ({ path, body }: Write): Sent<void> =>\n withBody(\"POST\", path, body).pipe(Effect.asVoid);\n\nconst patchAt = ({ path, body }: Write): Sent<void> =>\n withBody(\"PATCH\", path, body).pipe(Effect.asVoid);\n\n/** @internal */\nexport const getJson = getJsonOf;\n\n/** @internal */\nexport const remove = removeAt;\n\n/** @internal */\nexport const post = postTo;\n\n/** @internal */\nexport const patch = patchAt;\n\n/** @internal */\nexport const postJson = postJsonOf;\n","import { Array as Arr, Duration, Effect, Schema, Stream, String as Str } from \"effect\";\nimport type { PlatformError } from \"effect\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\nconst SUCCESS = 0;\nconst FORCE_KILL_AFTER_SECONDS = 10;\nconst FORCE_KILL_AFTER = Duration.seconds(FORCE_KILL_AFTER_SECONDS);\n\nconst taggedError = Schema.TaggedError;\n\nexport class CommandFailed extends taggedError<CommandFailed, { readonly brand: unique symbol }>()(\n \"CommandFailed\",\n { message: Schema.String },\n) {}\n\nexport interface Command {\n readonly command: string;\n readonly args: readonly string[];\n readonly env?: Readonly<Record<string, string>>;\n readonly cwd?: string;\n readonly forceKillAfter?: Duration.Input;\n}\n\n/** @internal */\nexport type Spawned<Success> = Effect.Effect<\n Success,\n CommandFailed | PlatformError.PlatformError,\n ChildProcessSpawner.ChildProcessSpawner\n>;\n\nconst failed = ({ command, args }: Command): CommandFailed =>\n CommandFailed.make({ message: `${command} ${Arr.join(args, \" \")} failed` });\n\nconst exitCodeOf = Effect.fn(\"exitCodeOf\")(function* exitCodeOf({\n command,\n args,\n env,\n cwd,\n forceKillAfter = FORCE_KILL_AFTER,\n}: Command) {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n return yield* spawner.exitCode(\n ChildProcess.make(command, args, {\n cwd,\n env,\n extendEnv: true,\n stdin: \"ignore\",\n stdout: \"inherit\",\n stderr: \"inherit\",\n forceKillAfter,\n }),\n );\n});\n\nconst succeedsWith = (command: Command): Spawned<boolean> =>\n exitCodeOf(command).pipe(Effect.map((code) => code === SUCCESS));\n\nconst mustSucceedWith = (command: Command): Spawned<void> =>\n succeedsWith(command).pipe(\n Effect.filterOrFail(\n (passed) => passed,\n () => failed(command),\n ),\n Effect.asVoid,\n );\n\nconst collected = Effect.fn(\"collected\")(function* collected({\n command,\n args,\n env,\n cwd,\n forceKillAfter = FORCE_KILL_AFTER,\n}: Command) {\n const handle = yield* ChildProcess.make(command, args, {\n cwd,\n env,\n extendEnv: true,\n stdin: \"ignore\",\n stderr: \"inherit\",\n forceKillAfter,\n });\n const [output, code] = yield* Effect.all(\n [handle.stdout.pipe(Stream.decodeText(), Stream.mkString), handle.exitCode],\n { concurrency: \"unbounded\" },\n );\n return { output, code };\n});\n\nconst outputWith = (command: Command): Spawned<string> =>\n collected(command).pipe(\n Effect.scoped,\n Effect.filterOrFail(\n ({ code }) => code === SUCCESS,\n () => failed(command),\n ),\n Effect.map(({ output }) => Str.trim(output)),\n );\n\n/** @internal */\nexport const succeeds = succeedsWith;\n\n/** @internal */\nexport const mustSucceed = mustSucceedWith;\n\nconst finishedWith = (command: Command): Spawned<Readonly<{ output: string; code: number }>> =>\n Effect.scoped(collected(command));\n\n/** @internal */\nexport const outputOf = outputWith;\n\n/** @internal */\nexport const finished = finishedWith;\n","import {\n Array as Arr,\n Config,\n Console,\n Effect,\n FileSystem,\n Record as Rec,\n Schema,\n pipe,\n} from \"effect\";\nimport type { PlatformError } from \"effect\";\n\n/** @internal */\nexport type Appended = Effect.Effect<\n void,\n Config.ConfigError | PlatformError.PlatformError,\n FileSystem.FileSystem\n>;\n\nconst taggedError = Schema.TaggedError;\n\nexport class WorkflowFailed extends taggedError<\n WorkflowFailed,\n { readonly brand: unique symbol }\n>()(\"WorkflowFailed\", { message: Schema.String }) {}\n\nconst appendTo = (variable: string, entries: Readonly<Record<string, string>>): Appended =>\n Effect.gen(function* appended() {\n const path = yield* Config.String(variable);\n const fs = yield* FileSystem.FileSystem;\n const lines = pipe(\n Rec.toEntries(entries),\n Arr.map(([name, value]) => `${name}=${value}\\n`),\n Arr.join(\"\"),\n );\n yield* fs.writeFileString(path, lines, { flag: \"a\" });\n });\n\nconst outputsOf = (outputs: Readonly<Record<string, string>>): Appended =>\n appendTo(\"GITHUB_OUTPUT\", outputs);\n\nconst envOf = (variables: Readonly<Record<string, string>>): Appended =>\n appendTo(\"GITHUB_ENV\", variables);\n\n/** @internal */\nexport const writeOutputs = outputsOf;\n\n/** @internal */\nexport const setEnv = envOf;\n\nexport const warn = (message: string): Effect.Effect<void> => Console.log(`::warning::${message}`);\n\nexport const mask = (value: string): Effect.Effect<void> => Console.log(`::add-mask::${value}`);\n\nexport const fail = Effect.fn(\"fail\")(function* fail(message: string) {\n yield* Console.log(`::error::${message}`);\n return yield* WorkflowFailed.make({ message });\n});\n","import { Array as Arr, Effect, pipe } from \"effect\";\nimport { Hex } from \"effect/encoding\";\n\nexport const sha256Of = (parts: readonly Uint8Array[]): Effect.Effect<string> =>\n Effect.promise(() =>\n new Blob(\n pipe(\n parts,\n Arr.map((part) => new Uint8Array(part)),\n ),\n ).arrayBuffer(),\n ).pipe(\n Effect.flatMap((bytes) => Effect.promise(() => crypto.subtle.digest(\"SHA-256\", bytes))),\n Effect.map((digest) => Hex.encode(new Uint8Array(digest))),\n );\n"],"mappings":"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"}
@@ -0,0 +1 @@
1
+ import { Effect, Schema } from "effect";
@@ -0,0 +1,31 @@
1
+ import { Option } from "effect";
2
+ type Span = Readonly<{
3
+ start: number;
4
+ end: number;
5
+ }>;
6
+ type Segment = Readonly<{
7
+ kind: "text";
8
+ text: string;
9
+ }> | (Span & Readonly<{
10
+ kind: "verbatim";
11
+ }>) | (Span & Readonly<{
12
+ kind: "alias";
13
+ text: string;
14
+ }>) | (Span & Readonly<{
15
+ kind: "atom";
16
+ text: string;
17
+ }>);
18
+ type Rendering = Readonly<{
19
+ content: string;
20
+ segments: readonly Segment[];
21
+ }>;
22
+ type Named = Readonly<{
23
+ name: string;
24
+ span: Option.Option<Span>;
25
+ }>;
26
+ declare const quoted: (value: string) => string;
27
+ declare const text: (value: string) => Segment;
28
+ declare const nameLiteral: ({ name, span }: Named) => readonly Segment[];
29
+ declare const renderSegments: ({ content, segments }: Rendering) => string;
30
+ export { nameLiteral as a, text as c, Span as i, Rendering as n, quoted as o, Segment as r, renderSegments as s, Named as t };
31
+ //# sourceMappingURL=index-Cb8YSEwo.d.mts.map
@@ -0,0 +1,6 @@
1
+ import { Effect, Schema } from "effect";
2
+ interface BrowserOptions {
3
+ readonly service: string;
4
+ }
5
+ export { BrowserOptions as t };
6
+ //# sourceMappingURL=index-DudHILTn.d.mts.map
@@ -0,0 +1,121 @@
1
+ import { Schema } from "effect";
2
+ declare const Bin: Schema.Union<readonly [Schema.String, Schema.$Record<Schema.String, Schema.String>]>;
3
+ declare const Repository: Schema.Union<readonly [Schema.String, Schema.Struct<{
4
+ readonly url: Schema.String;
5
+ readonly directory: Schema.optional<Schema.String>;
6
+ }>]>;
7
+ declare const Native: Schema.Struct<{
8
+ readonly binary: Schema.String;
9
+ readonly targets: Schema.$Array<Schema.String>;
10
+ }>;
11
+ declare const PublishConfig: Schema.Struct<{
12
+ readonly exports: Schema.optional<Schema.Unknown>;
13
+ readonly bin: Schema.optional<Schema.Union<readonly [Schema.String, Schema.$Record<Schema.String, Schema.String>]>>;
14
+ }>;
15
+ declare const PackageJsonSchema: Schema.Struct<{
16
+ name: Schema.optional<Schema.String>;
17
+ version: Schema.optional<Schema.String>;
18
+ private: Schema.optional<Schema.Boolean>;
19
+ description: Schema.optional<Schema.String>;
20
+ keywords: Schema.optional<Schema.$Array<Schema.String>>;
21
+ homepage: Schema.optional<Schema.String>;
22
+ repository: Schema.optional<Schema.Union<readonly [Schema.String, Schema.Struct<{
23
+ readonly url: Schema.String;
24
+ readonly directory: Schema.optional<Schema.String>;
25
+ }>]>>;
26
+ files: Schema.optional<Schema.$Array<Schema.String>>;
27
+ main: Schema.optional<Schema.String>;
28
+ types: Schema.optional<Schema.String>;
29
+ typings: Schema.optional<Schema.String>;
30
+ bin: Schema.optional<Schema.Union<readonly [Schema.String, Schema.$Record<Schema.String, Schema.String>]>>;
31
+ exports: Schema.optional<Schema.Unknown>;
32
+ imports: Schema.optional<Schema.Unknown>;
33
+ sideEffects: Schema.optional<Schema.Unknown>;
34
+ publishConfig: Schema.optional<Schema.Struct<{
35
+ readonly exports: Schema.optional<Schema.Unknown>;
36
+ readonly bin: Schema.optional<Schema.Union<readonly [Schema.String, Schema.$Record<Schema.String, Schema.String>]>>;
37
+ }>>;
38
+ native: Schema.optional<Schema.Struct<{
39
+ readonly binary: Schema.String;
40
+ readonly targets: Schema.$Array<Schema.String>;
41
+ }>>;
42
+ scripts: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
43
+ engines: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
44
+ dependencies: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
45
+ devDependencies: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
46
+ peerDependencies: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
47
+ optionalDependencies: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
48
+ peerDependenciesMeta: Schema.optional<Schema.$Record<Schema.String, Schema.Struct<{
49
+ readonly optional: Schema.optional<Schema.Boolean>;
50
+ }>>>;
51
+ pnpm: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
52
+ overrides: Schema.optional<Schema.Unknown>;
53
+ resolutions: Schema.optional<Schema.Unknown>;
54
+ "size-limit": Schema.optional<Schema.Unknown>;
55
+ }>;
56
+ type PackageJson = typeof PackageJsonSchema.Type;
57
+ declare const VersionedPackageJsonSchema: Schema.Struct<{
58
+ readonly private: Schema.optional<Schema.Boolean>;
59
+ readonly description: Schema.optional<Schema.String>;
60
+ readonly keywords: Schema.optional<Schema.$Array<Schema.String>>;
61
+ readonly homepage: Schema.optional<Schema.String>;
62
+ readonly repository: Schema.optional<Schema.Union<readonly [Schema.String, Schema.Struct<{
63
+ readonly url: Schema.String;
64
+ readonly directory: Schema.optional<Schema.String>;
65
+ }>]>>;
66
+ readonly files: Schema.optional<Schema.$Array<Schema.String>>;
67
+ readonly main: Schema.optional<Schema.String>;
68
+ readonly types: Schema.optional<Schema.String>;
69
+ readonly typings: Schema.optional<Schema.String>;
70
+ readonly bin: Schema.optional<Schema.Union<readonly [Schema.String, Schema.$Record<Schema.String, Schema.String>]>>;
71
+ readonly exports: Schema.optional<Schema.Unknown>;
72
+ readonly imports: Schema.optional<Schema.Unknown>;
73
+ readonly sideEffects: Schema.optional<Schema.Unknown>;
74
+ readonly publishConfig: Schema.optional<Schema.Struct<{
75
+ readonly exports: Schema.optional<Schema.Unknown>;
76
+ readonly bin: Schema.optional<Schema.Union<readonly [Schema.String, Schema.$Record<Schema.String, Schema.String>]>>;
77
+ }>>;
78
+ readonly native: Schema.optional<Schema.Struct<{
79
+ readonly binary: Schema.String;
80
+ readonly targets: Schema.$Array<Schema.String>;
81
+ }>>;
82
+ readonly scripts: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
83
+ readonly engines: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
84
+ readonly dependencies: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
85
+ readonly devDependencies: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
86
+ readonly peerDependencies: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
87
+ readonly optionalDependencies: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
88
+ readonly peerDependenciesMeta: Schema.optional<Schema.$Record<Schema.String, Schema.Struct<{
89
+ readonly optional: Schema.optional<Schema.Boolean>;
90
+ }>>>;
91
+ readonly pnpm: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
92
+ readonly overrides: Schema.optional<Schema.Unknown>;
93
+ readonly resolutions: Schema.optional<Schema.Unknown>;
94
+ readonly "size-limit": Schema.optional<Schema.Unknown>;
95
+ readonly name: Schema.String;
96
+ readonly version: Schema.String;
97
+ }>;
98
+ type VersionedPackageJson = typeof VersionedPackageJsonSchema.Type;
99
+ declare const PACKAGE_JSON_FILE = "package.json";
100
+ declare const DEPENDENCY_SECTIONS: readonly ["dependencies", "devDependencies", "optionalDependencies", "peerDependencies"];
101
+ type DependencySection = (typeof DEPENDENCY_SECTIONS)[number];
102
+ declare const RUNTIME_SECTIONS: readonly ["dependencies", "peerDependencies", "optionalDependencies"];
103
+ type DependencyManifest = Pick<PackageJson, DependencySection>;
104
+ declare const namesIn: {
105
+ (sections: readonly DependencySection[]): (manifest: DependencyManifest) => readonly string[];
106
+ (manifest: DependencyManifest, sections: readonly DependencySection[]): readonly string[];
107
+ };
108
+ declare const runtimeDependencyNames: (manifest: PackageJson) => readonly string[];
109
+ declare const optionalPeerNames: ({ peerDependenciesMeta }: PackageJson) => readonly string[];
110
+ declare const ROOT_SUBPATH = ".";
111
+ declare const SUBPATH_PREFIX = "./";
112
+ declare const unscopedNameOf: (name: string) => string;
113
+ declare const importSpecifierOf: {
114
+ (subpath: string): (importName: string) => string;
115
+ (importName: string, subpath: string): string;
116
+ };
117
+ declare const exportEntriesOf: (exportsField: unknown) => readonly (readonly [string, unknown])[];
118
+ declare const targetsIn: (held: unknown) => readonly string[];
119
+ declare const binEntriesOf: ({ name, bin }: Pick<PackageJson, "name" | "bin">) => readonly (readonly [string, string])[];
120
+ export { VersionedPackageJsonSchema as C, VersionedPackageJson as S, PACKAGE_JSON_FILE as _, importSpecifierOf as a, PublishConfig as b, DEPENDENCY_SECTIONS as c, RUNTIME_SECTIONS as d, namesIn as f, Native as g, Bin as h, exportEntriesOf as i, DependencyManifest as l, runtimeDependencyNames as m, SUBPATH_PREFIX as n, targetsIn as o, optionalPeerNames as p, binEntriesOf as r, unscopedNameOf as s, ROOT_SUBPATH as t, DependencySection as u, PackageJson as v, Repository as x, PackageJsonSchema as y };
121
+ //# sourceMappingURL=index-KNezbJnC.d.mts.map
@@ -0,0 +1,6 @@
1
+ import { Option } from "effect";
2
+ export declare const findPackageJson: {
3
+ (base: string | URL): (specifier: string) => Option.Option<string>;
4
+ (specifier: string, base: string | URL): Option.Option<string>;
5
+ };
6
+ //# sourceMappingURL=kestrion-node.d.mts.map
@@ -0,0 +1,9 @@
1
+ import { findPackageJSON } from "node:module";
2
+ import { Function, Option } from "effect";
3
+ // src/features/find-node-package/model/find.ts
4
+ const DATA_FIRST_ARITY = 2;
5
+ const found = Option.liftThrowable(findPackageJSON);
6
+ const findPackageJson = Function.dual(DATA_FIRST_ARITY, (specifier, base) => Option.flatMap(found(specifier, base), Option.fromNullishOr));
7
+ export { findPackageJson };
8
+
9
+ //# sourceMappingURL=kestrion-node.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kestrion-node.mjs","names":["Fn"],"sources":["../src/features/find-node-package/model/find.ts"],"sourcesContent":["import { findPackageJSON } from \"node:module\";\n\nimport { Function as Fn, Option } from \"effect\";\n\nconst DATA_FIRST_ARITY = 2;\n\nconst found = Option.liftThrowable(findPackageJSON);\n\nexport const findPackageJson: {\n (base: string | URL): (specifier: string) => Option.Option<string>;\n (specifier: string, base: string | URL): Option.Option<string>;\n} = Fn.dual(DATA_FIRST_ARITY, (specifier: string, base: string | URL): Option.Option<string> =>\n Option.flatMap(found(specifier, base), Option.fromNullishOr),\n);\n"],"mappings":";;;AAIA,MAAM,mBAAmB;AAEzB,MAAM,QAAQ,OAAO,cAAc,eAAe;AAElD,MAAa,kBAGTA,SAAG,KAAK,mBAAmB,WAAmB,SAChD,OAAO,QAAQ,MAAM,WAAW,IAAI,GAAG,OAAO,aAAa,CAC7D"}