srcpack 0.3.0 → 1.0.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/README.md +22 -5
- package/dist/args.d.ts +26 -0
- package/dist/bundle.d.ts +0 -21
- package/dist/cli.js +4846 -14943
- package/dist/config.d.ts +43 -3
- package/dist/fs.d.ts +41 -0
- package/dist/index.js +423 -10459
- package/dist/plan.d.ts +64 -0
- package/dist/screenshot.d.ts +113 -0
- package/package.json +10 -1
- package/src/args.ts +221 -0
- package/src/bundle.ts +1 -24
- package/src/cli.ts +238 -340
- package/src/config.ts +79 -9
- package/src/fs.ts +80 -0
- package/src/plan.ts +238 -0
- package/src/screenshot.ts +545 -0
package/dist/config.d.ts
CHANGED
|
@@ -25,6 +25,26 @@ declare const LinearSourceSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<
|
|
|
25
25
|
project: z.ZodOptional<z.ZodString>;
|
|
26
26
|
includeClosed: z.ZodDefault<z.ZodBoolean>;
|
|
27
27
|
}, z.core.$strict>]>;
|
|
28
|
+
/**
|
|
29
|
+
* A rendered page as numbered PNGs in `outDir`, independent of the text
|
|
30
|
+
* output path. See ADR 006 for why it is a separate source key.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* bundles: {
|
|
35
|
+
* home: { screenshot: "http://localhost:5173/", onDemand: true },
|
|
36
|
+
* phone: { screenshot: { url: "http://localhost:5173/", viewport: "mobile" } },
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
declare const ScreenshotSourceSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
41
|
+
url: z.ZodString;
|
|
42
|
+
viewport: z.ZodOptional<z.ZodEnum<{
|
|
43
|
+
desktop: "desktop";
|
|
44
|
+
mobile: "mobile";
|
|
45
|
+
}>>;
|
|
46
|
+
hide: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
47
|
+
}, z.core.$strict>]>;
|
|
28
48
|
/**
|
|
29
49
|
* Bundle configuration. Accepts a string pattern, array of patterns, or object.
|
|
30
50
|
* Patterns prefixed with `!` are exclusions. Patterns prefixed with `+` force
|
|
@@ -34,7 +54,8 @@ declare const LinearSourceSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<
|
|
|
34
54
|
* `git:unstaged`, `git:untracked`, `git:dirty`, or `git:<rev>` (e.g.
|
|
35
55
|
* `git:main`, `git:HEAD~3`).
|
|
36
56
|
*
|
|
37
|
-
* The object form takes files (`include`), Linear issues (`linear`),
|
|
57
|
+
* The object form takes files (`include`), Linear issues (`linear`), page
|
|
58
|
+
* screenshots (`screenshot`), or any combination.
|
|
38
59
|
*
|
|
39
60
|
* @example
|
|
40
61
|
* ```ts
|
|
@@ -51,9 +72,18 @@ declare const BundleConfigSchema: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z
|
|
|
51
72
|
project: z.ZodOptional<z.ZodString>;
|
|
52
73
|
includeClosed: z.ZodDefault<z.ZodBoolean>;
|
|
53
74
|
}, z.core.$strict>]>>;
|
|
75
|
+
screenshot: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
76
|
+
url: z.ZodString;
|
|
77
|
+
viewport: z.ZodOptional<z.ZodEnum<{
|
|
78
|
+
desktop: "desktop";
|
|
79
|
+
mobile: "mobile";
|
|
80
|
+
}>>;
|
|
81
|
+
hide: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
82
|
+
}, z.core.$strict>]>>;
|
|
54
83
|
outfile: z.ZodOptional<z.ZodString>;
|
|
55
|
-
index: z.
|
|
84
|
+
index: z.ZodOptional<z.ZodBoolean>;
|
|
56
85
|
prompt: z.ZodOptional<z.ZodString>;
|
|
86
|
+
onDemand: z.ZodOptional<z.ZodBoolean>;
|
|
57
87
|
}, z.core.$strict>]>;
|
|
58
88
|
/**
|
|
59
89
|
* Upload destination configuration.
|
|
@@ -101,13 +131,23 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
101
131
|
project: z.ZodOptional<z.ZodString>;
|
|
102
132
|
includeClosed: z.ZodDefault<z.ZodBoolean>;
|
|
103
133
|
}, z.core.$strict>]>>;
|
|
134
|
+
screenshot: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
135
|
+
url: z.ZodString;
|
|
136
|
+
viewport: z.ZodOptional<z.ZodEnum<{
|
|
137
|
+
desktop: "desktop";
|
|
138
|
+
mobile: "mobile";
|
|
139
|
+
}>>;
|
|
140
|
+
hide: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
141
|
+
}, z.core.$strict>]>>;
|
|
104
142
|
outfile: z.ZodOptional<z.ZodString>;
|
|
105
|
-
index: z.
|
|
143
|
+
index: z.ZodOptional<z.ZodBoolean>;
|
|
106
144
|
prompt: z.ZodOptional<z.ZodString>;
|
|
145
|
+
onDemand: z.ZodOptional<z.ZodBoolean>;
|
|
107
146
|
}, z.core.$strict>]>>;
|
|
108
147
|
}, z.core.$strict>;
|
|
109
148
|
export type UploadConfig = z.infer<typeof UploadConfigSchema>;
|
|
110
149
|
export type LinearSourceInput = z.input<typeof LinearSourceSchema>;
|
|
150
|
+
export type ScreenshotSource = z.infer<typeof ScreenshotSourceSchema>;
|
|
111
151
|
export type BundleConfig = z.infer<typeof BundleConfigSchema>;
|
|
112
152
|
export type BundleConfigInput = z.input<typeof BundleConfigSchema>;
|
|
113
153
|
export type Config = z.infer<typeof ConfigSchema>;
|
package/dist/fs.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compare paths using Unicode NFC followed by lowercase, on every platform.
|
|
3
|
+
* Normalizing first gives equivalent spellings the same input to lowercasing.
|
|
4
|
+
* This catches case and normalization collisions even for unwritten outputs
|
|
5
|
+
* and unresolved final entries, where realpath cannot canonicalize spelling.
|
|
6
|
+
* Applying one rule everywhere prevents a config from passing on Linux and
|
|
7
|
+
* overwriting a bundle on a case-insensitive filesystem (ADR 004).
|
|
8
|
+
*
|
|
9
|
+
* Comparison only: I/O retains the original spelling. Ownership and deletion
|
|
10
|
+
* use exact matches so folding cannot widen what srcpack removes.
|
|
11
|
+
*/
|
|
12
|
+
export declare function pathKey(path: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Where a path physically is, with symlinks resolved. Destructive decisions are
|
|
15
|
+
* made on this rather than the lexical path: `.srcpack -> ../shared` is inside
|
|
16
|
+
* the project by name and somewhere else in fact, and it is the somewhere else
|
|
17
|
+
* whose contents `rm` would take.
|
|
18
|
+
*
|
|
19
|
+
* Resolves as much of the path as exists, however deep that is. Stopping at the
|
|
20
|
+
* immediate parent would call `.srcpack/nested/x.txt` and `alias/nested/x.txt`
|
|
21
|
+
* different files until `mkdir -p` runs, which is one step too late to still be
|
|
22
|
+
* a check: aliasing is a property of the ancestors, not of when they were made.
|
|
23
|
+
*/
|
|
24
|
+
export declare function physicalPath(path: string): Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Where `rename` puts a directory entry: ancestors resolved, the entry itself
|
|
27
|
+
* left alone. Writing replaces the entry instead of following it, so a bundle
|
|
28
|
+
* whose output is a symlink is identified as the link rather than its target —
|
|
29
|
+
* writing to the link path and to its target produces two separate files.
|
|
30
|
+
*/
|
|
31
|
+
export declare function entryPath(path: string): Promise<string>;
|
|
32
|
+
export declare function isInside(path: string, dir: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Write a file by replacing the directory entry rather than the file behind
|
|
35
|
+
* it. Writing in place follows a symlink sitting at the output path, so
|
|
36
|
+
* `.srcpack/web.txt -> ~/.ssh/config` would be written through; rename replaces
|
|
37
|
+
* the link itself. It also makes each file appear whole or not at all.
|
|
38
|
+
*
|
|
39
|
+
* The temp name carries the pid so two runs can't rename each other's file.
|
|
40
|
+
*/
|
|
41
|
+
export declare function writeFileAtomic(path: string, data: string | Uint8Array): Promise<void>;
|