dsh-typst-plugin 0.0.0-stage → 0.1.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.
Files changed (129) hide show
  1. package/LICENSE +21 -0
  2. package/README.en.md +121 -0
  3. package/README.md +120 -2
  4. package/cordis.patch.yml +6 -0
  5. package/docs/images/icon.png +0 -0
  6. package/docs/plugin-detail.en.md +2 -0
  7. package/docs/plugin-detail.md +2 -0
  8. package/lib/client.js +41996 -0
  9. package/lib/client.js.map +7 -0
  10. package/lib/config.d.ts +107 -0
  11. package/lib/config.d.ts.map +1 -0
  12. package/lib/config.js +167 -0
  13. package/lib/config.js.map +1 -0
  14. package/lib/constants.d.ts +77 -0
  15. package/lib/constants.d.ts.map +1 -0
  16. package/lib/constants.js +85 -0
  17. package/lib/constants.js.map +1 -0
  18. package/lib/contract.d.ts +263 -0
  19. package/lib/contract.d.ts.map +1 -0
  20. package/lib/contract.js +9 -0
  21. package/lib/contract.js.map +1 -0
  22. package/lib/diagnostic-text.d.ts +13 -0
  23. package/lib/diagnostic-text.d.ts.map +1 -0
  24. package/lib/diagnostic-text.js +28 -0
  25. package/lib/diagnostic-text.js.map +1 -0
  26. package/lib/errors.d.ts +119 -0
  27. package/lib/errors.d.ts.map +1 -0
  28. package/lib/errors.js +161 -0
  29. package/lib/errors.js.map +1 -0
  30. package/lib/host/facts.d.ts +31 -0
  31. package/lib/host/facts.d.ts.map +1 -0
  32. package/lib/host/facts.js +145 -0
  33. package/lib/host/facts.js.map +1 -0
  34. package/lib/host/which.d.ts +20 -0
  35. package/lib/host/which.d.ts.map +1 -0
  36. package/lib/host/which.js +50 -0
  37. package/lib/host/which.js.map +1 -0
  38. package/lib/index.d.ts +2 -0
  39. package/lib/index.d.ts.map +1 -0
  40. package/lib/index.js +2 -0
  41. package/lib/index.js.map +1 -0
  42. package/lib/remote.d.ts +70 -0
  43. package/lib/remote.d.ts.map +1 -0
  44. package/lib/remote.js +156 -0
  45. package/lib/remote.js.map +1 -0
  46. package/lib/service.d.ts +71 -0
  47. package/lib/service.d.ts.map +1 -0
  48. package/lib/service.js +213 -0
  49. package/lib/service.js.map +1 -0
  50. package/lib/skills/typst.d.ts +13 -0
  51. package/lib/skills/typst.d.ts.map +1 -0
  52. package/lib/skills/typst.js +78 -0
  53. package/lib/skills/typst.js.map +1 -0
  54. package/lib/status-codec.d.ts +11 -0
  55. package/lib/status-codec.d.ts.map +1 -0
  56. package/lib/status-codec.js +11 -0
  57. package/lib/status-codec.js.map +1 -0
  58. package/lib/tools/registration.d.ts +23 -0
  59. package/lib/tools/registration.d.ts.map +1 -0
  60. package/lib/tools/registration.js +758 -0
  61. package/lib/tools/registration.js.map +1 -0
  62. package/lib/tools/shared.d.ts +30 -0
  63. package/lib/tools/shared.d.ts.map +1 -0
  64. package/lib/tools/shared.js +79 -0
  65. package/lib/tools/shared.js.map +1 -0
  66. package/lib/typert.d.ts +25 -0
  67. package/lib/typert.d.ts.map +1 -0
  68. package/lib/typert.js +116 -0
  69. package/lib/typert.js.map +1 -0
  70. package/lib/typst/diagnostics.d.ts +58 -0
  71. package/lib/typst/diagnostics.d.ts.map +1 -0
  72. package/lib/typst/diagnostics.js +237 -0
  73. package/lib/typst/diagnostics.js.map +1 -0
  74. package/lib/typst/flags.d.ts +8 -0
  75. package/lib/typst/flags.d.ts.map +1 -0
  76. package/lib/typst/flags.js +8 -0
  77. package/lib/typst/flags.js.map +1 -0
  78. package/lib/typst/locate.d.ts +61 -0
  79. package/lib/typst/locate.d.ts.map +1 -0
  80. package/lib/typst/locate.js +152 -0
  81. package/lib/typst/locate.js.map +1 -0
  82. package/lib/typst/mainfile.d.ts +40 -0
  83. package/lib/typst/mainfile.d.ts.map +1 -0
  84. package/lib/typst/mainfile.js +136 -0
  85. package/lib/typst/mainfile.js.map +1 -0
  86. package/lib/typst/match.d.ts +67 -0
  87. package/lib/typst/match.d.ts.map +1 -0
  88. package/lib/typst/match.js +227 -0
  89. package/lib/typst/match.js.map +1 -0
  90. package/lib/typst/oneshot.d.ts +48 -0
  91. package/lib/typst/oneshot.d.ts.map +1 -0
  92. package/lib/typst/oneshot.js +86 -0
  93. package/lib/typst/oneshot.js.map +1 -0
  94. package/lib/typst/owners.d.ts +28 -0
  95. package/lib/typst/owners.d.ts.map +1 -0
  96. package/lib/typst/owners.js +98 -0
  97. package/lib/typst/owners.js.map +1 -0
  98. package/lib/typst/pdf-extract.d.ts +28 -0
  99. package/lib/typst/pdf-extract.d.ts.map +1 -0
  100. package/lib/typst/pdf-extract.js +111 -0
  101. package/lib/typst/pdf-extract.js.map +1 -0
  102. package/lib/typst/process.d.ts +73 -0
  103. package/lib/typst/process.d.ts.map +1 -0
  104. package/lib/typst/process.js +147 -0
  105. package/lib/typst/process.js.map +1 -0
  106. package/lib/typst/text.d.ts +62 -0
  107. package/lib/typst/text.d.ts.map +1 -0
  108. package/lib/typst/text.js +282 -0
  109. package/lib/typst/text.js.map +1 -0
  110. package/lib/typst/watcher.d.ts +76 -0
  111. package/lib/typst/watcher.d.ts.map +1 -0
  112. package/lib/typst/watcher.js +210 -0
  113. package/lib/typst/watcher.js.map +1 -0
  114. package/lib/wire-schemas.d.ts +433 -0
  115. package/lib/wire-schemas.d.ts.map +1 -0
  116. package/lib/wire-schemas.js +428 -0
  117. package/lib/wire-schemas.js.map +1 -0
  118. package/lib/workspace/containment.d.ts +25 -0
  119. package/lib/workspace/containment.d.ts.map +1 -0
  120. package/lib/workspace/containment.js +54 -0
  121. package/lib/workspace/containment.js.map +1 -0
  122. package/lib/workspace/session.d.ts +268 -0
  123. package/lib/workspace/session.d.ts.map +1 -0
  124. package/lib/workspace/session.js +1576 -0
  125. package/lib/workspace/session.js.map +1 -0
  126. package/locale/en.json +15 -0
  127. package/locale/zh.json +15 -0
  128. package/package.json +113 -4
  129. package/release-provenance.json +137 -0
@@ -0,0 +1,428 @@
1
+ /**
2
+ * The wire boundary's single source: every zod schema the `typst` namespace
3
+ * validates with, and the one shared invocation list both halves register.
4
+ * `TYPST_INVOCATIONS` materializes each schema once through `strictCodec()`;
5
+ * the host manifest aliases it in `src/status-codec.ts` and the browser face
6
+ * aliases it in `src/client/status-codec.ts`. Neither half imports the
7
+ * other's module or builds its own descriptor list, so the two sides cannot
8
+ * disagree about a boundary.
9
+ *
10
+ * Client-safe: its imports are `zod`, the contract's own types, and the
11
+ * runtime constants module, all of which
12
+ * `scripts/client-graph-authority.mjs` allowlists.
13
+ * @module dsh-typst/wire-schemas
14
+ */
15
+ import { z } from "zod";
16
+ import { TYPST_LOCATE_SOURCE_METHOD, TYPST_READ_PREVIEW_METHOD, TYPST_REMOTE_PACKAGE, TYPST_SCOPE_WIRE_SYMBOL, TYPST_SET_MAIN_METHOD, TYPST_STATUS_METHOD, TYPST_STATUS_SERVICE_KEY, TYPST_SETTINGS_NAMESPACE, TYPST_WATCH_METHOD, } from "./constants.js";
17
+ /**
18
+ * Wrap a wire schema in the strict codec arm Typert expects. The strict arm
19
+ * is exactly `{ mode, typeSymbol, create }` (plus optional `encode`/`decode`
20
+ * for byte-carrying results, which the preview result adds), so no live
21
+ * schema property is carried and `create()` materializes on first use.
22
+ * @param typeSymbol - the boundary type identity the manifest declares.
23
+ * @param schema - the shared wire schema both halves validate through.
24
+ * @returns the strict codec arm.
25
+ */
26
+ export function strictCodec(typeSymbol, schema) {
27
+ return { mode: "strict", typeSymbol, create: () => schema };
28
+ }
29
+ /** The boundary symbol of a type this package owns. */
30
+ function typstTypeSymbol(name) {
31
+ return `${TYPST_REMOTE_PACKAGE}#${name}`;
32
+ }
33
+ // ---------------------------------------------------------------------------
34
+ // Schemas
35
+ // ---------------------------------------------------------------------------
36
+ export const typstSourceSchema = z.enum(["setting", "path", "common", "shell"]);
37
+ export const toolchainSchema = z.discriminatedUnion("state", [
38
+ z
39
+ .object({
40
+ state: z.literal("ready"),
41
+ version: z.string(),
42
+ path: z.string(),
43
+ source: typstSourceSchema,
44
+ })
45
+ .strict(),
46
+ z.object({ state: z.literal("missing") }).strict(),
47
+ z
48
+ .object({
49
+ state: z.literal("too_old"),
50
+ version: z.string(),
51
+ path: z.string(),
52
+ source: typstSourceSchema,
53
+ error: z.string(),
54
+ })
55
+ .strict(),
56
+ z
57
+ .object({
58
+ state: z.literal("error"),
59
+ path: z.string().optional(),
60
+ source: typstSourceSchema.optional(),
61
+ error: z.string(),
62
+ })
63
+ .strict(),
64
+ ]);
65
+ export const diagnosticLocationSchema = z
66
+ .object({
67
+ file: z.string(),
68
+ line: z.number().int(),
69
+ column: z.number().int(),
70
+ })
71
+ .strict();
72
+ export const diagnosticPointSchema = z
73
+ .object({
74
+ message: z.string(),
75
+ location: diagnosticLocationSchema.nullable(),
76
+ })
77
+ .strict();
78
+ export const diagnosticSchema = z
79
+ .object({
80
+ severity: z.enum(["error", "warning"]),
81
+ message: z.string(),
82
+ location: diagnosticLocationSchema.nullable(),
83
+ excerpt: z.string().optional(),
84
+ hints: z.array(z.string()),
85
+ trace: z.array(diagnosticPointSchema),
86
+ })
87
+ .strict();
88
+ export const compilePhaseSchema = z.enum([
89
+ "idle",
90
+ "starting",
91
+ "compiling",
92
+ "ok",
93
+ "warnings",
94
+ "error",
95
+ "crashed",
96
+ ]);
97
+ export const statusSchema = z
98
+ .object({
99
+ phase: compilePhaseSchema,
100
+ run: z.number().int(),
101
+ durationMs: z.number().optional(),
102
+ error: z.string().optional(),
103
+ finishedAt: z.number().optional(),
104
+ })
105
+ .strict();
106
+ export const previewIdentitySchema = z
107
+ .object({
108
+ generation: z.number().int(),
109
+ seq: z.number().int(),
110
+ sha256: z.string(),
111
+ })
112
+ .strict();
113
+ export const snapshotSchema = z
114
+ .object({
115
+ generation: z.number().int(),
116
+ main: z.string(),
117
+ run: z.number().int(),
118
+ seq: z.number().int(),
119
+ bytes: z.number().int(),
120
+ pages: z.number().int(),
121
+ sha256: z.string(),
122
+ createdAt: z.number(),
123
+ })
124
+ .strict();
125
+ export const sourceRefSchema = z
126
+ .object({
127
+ file: z.string(),
128
+ line: z.number().int(),
129
+ endLine: z.number().int(),
130
+ })
131
+ .strict();
132
+ export const highlightSchema = z
133
+ .object({
134
+ id: z.string(),
135
+ identity: previewIdentitySchema,
136
+ quote: z.string(),
137
+ comment: z.string(),
138
+ source: sourceRefSchema.optional(),
139
+ seq: z.number().int(),
140
+ pageIndex: z.number().int(),
141
+ startOffset: z.number().int().optional(),
142
+ occurrence: z.number().int().optional(),
143
+ rects: z.array(z.array(z.number())),
144
+ stale: z.boolean(),
145
+ createdAt: z.number(),
146
+ })
147
+ .strict();
148
+ export const panelViewSchema = z.discriminatedUnion("kind", [
149
+ z
150
+ .object({
151
+ kind: z.literal("page"),
152
+ pageIndex: z.number().int(),
153
+ identity: previewIdentitySchema,
154
+ })
155
+ .strict(),
156
+ z
157
+ .object({
158
+ kind: z.literal("highlight"),
159
+ id: z.string(),
160
+ identity: previewIdentitySchema,
161
+ })
162
+ .strict(),
163
+ ]);
164
+ export const packageManagerSchema = z
165
+ .object({
166
+ name: z.string(),
167
+ version: z.string().optional(),
168
+ path: z.string(),
169
+ })
170
+ .strict();
171
+ export const hostFactsSchema = z
172
+ .object({
173
+ os: z.enum(["macos", "windows", "linux", "other"]),
174
+ osName: z.string(),
175
+ arch: z.string(),
176
+ tools: z.array(packageManagerSchema),
177
+ })
178
+ .strict();
179
+ export const setupSchema = z
180
+ .object({
181
+ facts: hostFactsSchema.nullable(),
182
+ searched: z.array(z.string()),
183
+ })
184
+ .strict();
185
+ export const typstStateFrameSchema = z
186
+ .object({
187
+ version: z.number().int(),
188
+ generation: z.number().int(),
189
+ previewError: z.string().nullable(),
190
+ discovery: z
191
+ .object({
192
+ scanning: z.boolean(),
193
+ includeExcluded: z.boolean(),
194
+ visited: z.number().int(),
195
+ errors: z.array(z.string()),
196
+ })
197
+ .strict(),
198
+ toolchain: toolchainSchema,
199
+ workspace: z.string(),
200
+ workspaceRoot: z.string(),
201
+ main: z.string().nullable(),
202
+ candidates: z.array(z.string()),
203
+ fragments: z.array(z.string()),
204
+ status: statusSchema,
205
+ diagnostics: z.array(diagnosticSchema),
206
+ diagnosticsTotal: z.number().int(),
207
+ diagnosticsTruncated: z.boolean(),
208
+ snapshot: snapshotSchema.nullable(),
209
+ highlights: z.array(highlightSchema),
210
+ view: z.union([panelViewSchema, z.null()]),
211
+ viewSeq: z.number().int(),
212
+ setup: setupSchema,
213
+ })
214
+ .strict();
215
+ export const setMainResultSchema = z.object({ main: z.string() }).strict();
216
+ export const sourceMatchSchema = z
217
+ .object({
218
+ file: z.string(),
219
+ line: z.number().int(),
220
+ column: z.number().int(),
221
+ endLine: z.number().int(),
222
+ excerpt: z.string(),
223
+ score: z.number(),
224
+ })
225
+ .strict();
226
+ export const locateSourceResultSchema = z
227
+ .object({ matches: z.array(sourceMatchSchema) })
228
+ .strict();
229
+ export const previewBytesSchema = z
230
+ .object({
231
+ generation: z.number().int(),
232
+ seq: z.number().int(),
233
+ sha256: z.string(),
234
+ data: z.instanceof(Uint8Array),
235
+ })
236
+ .strict();
237
+ // ---------------------------------------------------------------------------
238
+ // Invocation descriptors
239
+ // ---------------------------------------------------------------------------
240
+ const SERVICE = TYPST_STATUS_SERVICE_KEY;
241
+ const NAMESPACE = TYPST_SETTINGS_NAMESPACE;
242
+ /** One strict result codec keyed to the manifest's declared symbol. */
243
+ function resultCodec(typeSymbol, schema) {
244
+ return strictCodec(typeSymbol, schema);
245
+ }
246
+ /**
247
+ * Strict result codec that projects one typed binary field into the RPC's
248
+ * byte attachments: the preview PDF never rides JSON as base64.
249
+ */
250
+ function bytesCodec(typeSymbol, schema, byteField) {
251
+ return {
252
+ mode: "strict",
253
+ typeSymbol,
254
+ create: () => schema,
255
+ encode: (value, writeBytes) => {
256
+ const record = value;
257
+ const { [byteField]: data, ...rest } = record;
258
+ return {
259
+ ...rest,
260
+ [byteField]: writeBytes(data, [byteField]),
261
+ };
262
+ },
263
+ decode: (value) => schema.parse(value),
264
+ };
265
+ }
266
+ /** The scope lookup parameter every endpoint takes (registered by the service). */
267
+ function scopeParameter() {
268
+ return {
269
+ name: "typstScope",
270
+ wire: "typstScopeId",
271
+ source: "lookup",
272
+ lookup: "typstScope",
273
+ codec: strictCodec(TYPST_SCOPE_WIRE_SYMBOL, z.string()),
274
+ };
275
+ }
276
+ /** The typst state frame result codec, shared by `status`, `watch`, and `recheck`. */
277
+ export const stateFrameCodec = resultCodec(typstTypeSymbol("TypstStateFrame"), typstStateFrameSchema);
278
+ /** `status`: the current state frame, first push of the panel's data. */
279
+ export const typstStatusInvocation = {
280
+ id: "dsh-typst/status",
281
+ service: SERVICE,
282
+ namespace: NAMESPACE,
283
+ method: TYPST_STATUS_METHOD,
284
+ invocation: { kind: "direct" },
285
+ cancellation: { parameter: "signal" },
286
+ parameters: [scopeParameter()],
287
+ result: stateFrameCodec,
288
+ };
289
+ /** `setMain`: choose the main `.typ` file; the frame updates follow on the stream. */
290
+ export const typstSetMainInvocation = {
291
+ id: "dsh-typst/setMain",
292
+ service: SERVICE,
293
+ namespace: NAMESPACE,
294
+ method: TYPST_SET_MAIN_METHOD,
295
+ invocation: { kind: "direct" },
296
+ cancellation: { parameter: "signal" },
297
+ parameters: [
298
+ scopeParameter(),
299
+ {
300
+ name: "path",
301
+ wire: "path",
302
+ source: "json",
303
+ codec: strictCodec(typstTypeSymbol("typst/setMain:path"), z.string().min(1).max(1024)),
304
+ },
305
+ ],
306
+ result: resultCodec(typstTypeSymbol("typst/setMain:result"), setMainResultSchema),
307
+ };
308
+ /**
309
+ * `watch`: the live state stream. `mode: 'stream'`: the first yielded frame
310
+ * is the current state, one frame follows every relevant change.
311
+ */
312
+ export const typstWatchInvocation = {
313
+ id: "dsh-typst/watch",
314
+ service: SERVICE,
315
+ namespace: NAMESPACE,
316
+ method: TYPST_WATCH_METHOD,
317
+ mode: "stream",
318
+ invocation: { kind: "direct" },
319
+ cancellation: { parameter: "signal" },
320
+ parameters: [scopeParameter()],
321
+ result: stateFrameCodec,
322
+ };
323
+ /**
324
+ * `readPreview`: the current preview PDF's bytes. The strict codec projects
325
+ * the `data` field into the RPC's byte attachments on the wire.
326
+ */
327
+ export const typstReadPreviewInvocation = {
328
+ id: "dsh-typst/readPreview",
329
+ service: SERVICE,
330
+ namespace: NAMESPACE,
331
+ method: TYPST_READ_PREVIEW_METHOD,
332
+ invocation: { kind: "direct" },
333
+ cancellation: { parameter: "signal" },
334
+ parameters: [
335
+ scopeParameter(),
336
+ {
337
+ name: "identity",
338
+ wire: "identity",
339
+ source: "json",
340
+ codec: strictCodec(typstTypeSymbol("PreviewIdentity"), previewIdentitySchema),
341
+ },
342
+ ],
343
+ result: bytesCodec(typstTypeSymbol("PreviewBytes"), previewBytesSchema, "data"),
344
+ };
345
+ /** `locateSource`: match rendered text against the workspace's sources. */
346
+ export const typstLocateSourceInvocation = {
347
+ id: "dsh-typst/locateSource",
348
+ service: SERVICE,
349
+ namespace: NAMESPACE,
350
+ method: TYPST_LOCATE_SOURCE_METHOD,
351
+ invocation: { kind: "direct" },
352
+ cancellation: { parameter: "signal" },
353
+ parameters: [
354
+ scopeParameter(),
355
+ {
356
+ name: "text",
357
+ wire: "text",
358
+ source: "json",
359
+ codec: strictCodec(typstTypeSymbol("typst/locateSource:text"), z.string().min(1).max(20_000)),
360
+ },
361
+ {
362
+ name: "focus",
363
+ wire: "focus",
364
+ source: "json",
365
+ codec: strictCodec(typstTypeSymbol("typst/locateSource:focus"), z.string().min(1).max(20_000).nullable()),
366
+ },
367
+ ],
368
+ result: resultCodec(typstTypeSymbol("typst/locateSource:result"), locateSourceResultSchema),
369
+ };
370
+ /** `recheck`: look Typst up again (the setup page's refresh), returning the new frame. */
371
+ export const typstRecheckInvocation = {
372
+ id: "dsh-typst/recheck",
373
+ service: SERVICE,
374
+ namespace: NAMESPACE,
375
+ method: "recheck",
376
+ invocation: { kind: "direct" },
377
+ cancellation: { parameter: "signal" },
378
+ parameters: [scopeParameter()],
379
+ result: stateFrameCodec,
380
+ };
381
+ /** `restart`: stop the watch, relocate typst, rescan, restart (the panel's restart button). */
382
+ export const typstRestartInvocation = {
383
+ id: "dsh-typst/restart",
384
+ service: SERVICE,
385
+ namespace: NAMESPACE,
386
+ method: "restart",
387
+ invocation: { kind: "direct" },
388
+ cancellation: { parameter: "signal" },
389
+ parameters: [scopeParameter()],
390
+ result: stateFrameCodec,
391
+ };
392
+ /** Explicit index refresh; the stream reports incremental progress. */
393
+ export const typstDiscoverInvocation = {
394
+ id: "dsh-typst/discover",
395
+ service: SERVICE,
396
+ namespace: NAMESPACE,
397
+ method: "discover",
398
+ invocation: { kind: "direct" },
399
+ cancellation: { parameter: "signal" },
400
+ parameters: [
401
+ scopeParameter(),
402
+ {
403
+ name: "includeExcluded",
404
+ wire: "includeExcluded",
405
+ source: "json",
406
+ codec: strictCodec(typstTypeSymbol("typst/discover:includeExcluded"), z.boolean()),
407
+ },
408
+ ],
409
+ result: resultCodec(typstTypeSymbol("typst/discover:result"), z
410
+ .object({
411
+ candidates: z.number().int(),
412
+ includeExcluded: z.boolean(),
413
+ errors: z.array(z.string()),
414
+ })
415
+ .strict()),
416
+ };
417
+ /** Both halves register exactly this list. */
418
+ export const TYPST_INVOCATIONS = [
419
+ typstStatusInvocation,
420
+ typstSetMainInvocation,
421
+ typstWatchInvocation,
422
+ typstReadPreviewInvocation,
423
+ typstLocateSourceInvocation,
424
+ typstRecheckInvocation,
425
+ typstRestartInvocation,
426
+ typstDiscoverInvocation,
427
+ ];
428
+ //# sourceMappingURL=wire-schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wire-schemas.js","sourceRoot":"","sources":["../src/wire-schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiBxB,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,mBAAmB,EACnB,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;A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C,OAAO,EAAE;QAC5B,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;KAC5B,CAAC;SACD,MAAM,EAAE,CACZ;CACF,CAAC;AAEF,8CAA8C;AAC9C,MAAM,CAAC,MAAM,iBAAiB,GAAoC;IAChE,qBAAqB;IACrB,sBAAsB;IACtB,oBAAoB;IACpB,0BAA0B;IAC1B,2BAA2B;IAC3B,sBAAsB;IACtB,sBAAsB;IACtB,uBAAuB;CACxB,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Workspace path containment. A path is resolved against the workspace root,
3
+ * the deepest existing ancestor is canonicalized (`realpath`), and the
4
+ * nonexistent tail is appended to that canonical ancestor. The result is the
5
+ * canonical absolute path a caller should use — not the lexical spelling it
6
+ * passed in — so a casing alias, a `/var` → `/private/var` symlink, or a
7
+ * symlinked directory cannot make the checked path differ from the used path.
8
+ *
9
+ * A target that exists and resolves outside the root is refused. A dangling
10
+ * symlink resolves to its lexical in-workspace location here; callers that
11
+ * write (exportPdf) must additionally refuse a symlink target.
12
+ * @module dsh-typst/workspace/containment
13
+ */
14
+ /** Whether `target` is the root or lives under it, using path segments. */
15
+ export declare function isWithin(root: string, target: string): boolean;
16
+ /**
17
+ * Resolve one path inside a canonical workspace root.
18
+ * @param root - the canonical workspace root (already `realpath`ed).
19
+ * @param input - absolute or root-relative input path.
20
+ * @returns the canonical absolute path.
21
+ * @throws an Error whose `code` is `TYPST_PATH_OUTSIDE_WORKSPACE` when the
22
+ * resolved target escapes the root.
23
+ */
24
+ export declare function resolveInside(root: string, input: string): Promise<string>;
25
+ //# sourceMappingURL=containment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"containment.d.ts","sourceRoot":"","sources":["../../src/workspace/containment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAaH,2EAA2E;AAC3E,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAM9D;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,CAAC,CAoBjB"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Workspace path containment. A path is resolved against the workspace root,
3
+ * the deepest existing ancestor is canonicalized (`realpath`), and the
4
+ * nonexistent tail is appended to that canonical ancestor. The result is the
5
+ * canonical absolute path a caller should use — not the lexical spelling it
6
+ * passed in — so a casing alias, a `/var` → `/private/var` symlink, or a
7
+ * symlinked directory cannot make the checked path differ from the used path.
8
+ *
9
+ * A target that exists and resolves outside the root is refused. A dangling
10
+ * symlink resolves to its lexical in-workspace location here; callers that
11
+ * write (exportPdf) must additionally refuse a symlink target.
12
+ * @module dsh-typst/workspace/containment
13
+ */
14
+ import { realpath } from "node:fs/promises";
15
+ import { basename, dirname, isAbsolute, join, relative, resolve, sep, } from "node:path";
16
+ /** Whether `target` is the root or lives under it, using path segments. */
17
+ export function isWithin(root, target) {
18
+ const rel = relative(root, target);
19
+ return (rel === "" ||
20
+ (rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute(rel)));
21
+ }
22
+ /**
23
+ * Resolve one path inside a canonical workspace root.
24
+ * @param root - the canonical workspace root (already `realpath`ed).
25
+ * @param input - absolute or root-relative input path.
26
+ * @returns the canonical absolute path.
27
+ * @throws an Error whose `code` is `TYPST_PATH_OUTSIDE_WORKSPACE` when the
28
+ * resolved target escapes the root.
29
+ */
30
+ export async function resolveInside(root, input) {
31
+ const absolute = resolve(root, input);
32
+ let existing = absolute;
33
+ const tail = [];
34
+ for (;;) {
35
+ try {
36
+ const canonical = await realpath(existing);
37
+ const target = tail.length === 0 ? canonical : join(canonical, ...tail);
38
+ if (!isWithin(root, target))
39
+ break;
40
+ return target;
41
+ }
42
+ catch {
43
+ const parent = dirname(existing);
44
+ if (parent === existing)
45
+ break;
46
+ tail.unshift(basename(existing));
47
+ existing = parent;
48
+ }
49
+ }
50
+ const error = new Error(`${input} is outside the workspace.`);
51
+ error.code = "TYPST_PATH_OUTSIDE_WORKSPACE";
52
+ throw error;
53
+ }
54
+ //# sourceMappingURL=containment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"containment.js","sourceRoot":"","sources":["../../src/workspace/containment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EACL,QAAQ,EACR,OAAO,EACP,UAAU,EACV,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,GAAG,GACJ,MAAM,WAAW,CAAC;AAEnB,2EAA2E;AAC3E,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,MAAc;IACnD,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACnC,OAAO,CACL,GAAG,KAAK,EAAE;QACV,CAAC,GAAG,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAClE,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,IAAY,EACZ,KAAa;IAEb,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACtC,IAAI,QAAQ,GAAG,QAAQ,CAAC;IACxB,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,SAAS,CAAC;QACR,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAC3C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,CAAC;YACxE,IAAI,CAAC,QAAQ,C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