1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
//! What: Which repository paths the dependent-version planner reads: workspace manifests,
//! the registry configuration, and a package's non-test source files.
//! Why: The planner selects these from the tracked-path list itself, so the provider needs
//! no pathspec support. The rules are the incumbent's: `isWorkspaceManifestPath`
//! (`dependent-version-bump-policy.ts:66-73`), the manifest pathspec
//! `:(glob)package/*/*/package.json`, `PNPR_CONFIG_PATH`
//! (`publishable-names.ts:10`) and `isNonTestSourcePath` (`source-imports.ts:38-55`).
//!
//! In TS you'd write (pseudocode):
//! ```ts
//! // isWorkspaceManifestPath(path); packageDirectory(manifestPath); isNonTestSourcePath({ directory, path });
//! ```
/// What: The generated registry configuration whose OIDC package list is the publish set.
/// `&[u8]` is a borrowed list of bytes baked into the program.
/// Why: Only packages listed there receive a dependent bump.
///
/// In TS you'd write (pseudocode):
/// ```ts
/// export const PNPR_CONFIG_PATH = 'package/config/pnpr/config.yaml';
/// ```
pub const PNPR_CONFIG_PATH: & = b"package/config/pnpr/config.yaml";
/// What: The file name every workspace manifest has, with the separator before it.
/// Why: A package's directory is its manifest path without this suffix.
///
/// In TS you'd write (pseudocode):
/// ```ts
/// const MANIFEST_SUFFIX = '/package.json';
/// ```
const MANIFEST_SUFFIX: & = b"/package.json";
/// What: Extensions of source files a bundler follows imports from.
/// Why: A development dependency counts as bundled only when such a file imports it.
///
/// In TS you'd write (pseudocode):
/// ```ts
/// const SOURCE_EXTENSIONS = ['.ts', '.tsx', '.mts', '.cts', '.js', '.jsx', '.mjs', '.cjs'];
/// ```
const SOURCE_EXTENSIONS: & = &;
/// What: The file-name segment that marks a test file.
/// Why: Test files are not bundled, so their imports decide nothing.
///
/// In TS you'd write (pseudocode):
/// ```ts
/// const TEST_MARKER = '.test.';
/// ```
const TEST_MARKER: & = b".test.";
/// What: Whether one byte is the path separator `/`. `&u8` borrows the byte, as `split` hands it over.
/// Why: `split` and `rsplit` take this function by path where a closure would otherwise stand.
///
/// In TS you'd write (pseudocode):
/// ```ts
/// const isSlashByte = (byte: number) => byte === '/'.charCodeAt(0);
/// ```
/// What: Whether a path is `package/<category>/<name>/package.json`. `.split(...)` yields the
/// `/`-separated segments; `Vec<&[u8]>` collects borrowed views of them.
/// Why: Only such a manifest is a workspace package; the incumbent's candidate test and
/// its tracked-file pathspec both select exactly these paths.
///
/// In TS you'd write (pseudocode):
/// ```ts
/// const segments = path.split('/'); return segments.length === 4 && segments[0] === 'package' && segments[3] === 'package.json';
/// ```
/// What: The package directory of a workspace manifest path. `.strip_suffix(...)` returns
/// the bytes before the suffix, or nothing when the path does not end with it.
/// Why: Source files are looked up under `<directory>/src/`.
///
/// In TS you'd write (pseudocode):
/// ```ts
/// const directory = manifestPath.slice(0, -'/package.json'.length);
/// ```
/// What: Whether a path is non-test source of the package in `directory`.
/// Why: The file must sit under the package's `src/`, end with a source extension, and
/// its name must not contain `.test.`. A sibling directory sharing a prefix
/// (`package/module/ab` for `package/module/a`) does not count.
///
/// In TS you'd write (pseudocode):
/// ```ts
/// return path.startsWith(`${directory}/src/`) && SOURCE_EXTENSIONS.some(e => name.endsWith(e)) && !name.includes('.test.');
/// ```
/// Manifest, configuration and source path selection.