@fairgarden/distribution 0.1.0-alpha.1 → 0.1.0-alpha.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.
- package/Readme.md +3 -3
- package/dist/add-module.d.ts +4 -0
- package/dist/add-module.d.ts.map +1 -1
- package/dist/add-module.js +29 -0
- package/dist/add-module.js.map +1 -1
- package/dist/calver.d.ts +65 -0
- package/dist/calver.d.ts.map +1 -0
- package/dist/calver.js +115 -0
- package/dist/calver.js.map +1 -0
- package/dist/canary.d.ts.map +1 -1
- package/dist/canary.js +15 -2
- package/dist/canary.js.map +1 -1
- package/dist/changelog.d.ts +111 -0
- package/dist/changelog.d.ts.map +1 -0
- package/dist/changelog.js +285 -0
- package/dist/changelog.js.map +1 -0
- package/dist/cli.js +299 -12
- package/dist/cli.js.map +1 -1
- package/dist/extends.d.ts +3 -2
- package/dist/extends.d.ts.map +1 -1
- package/dist/extends.js +12 -2
- package/dist/extends.js.map +1 -1
- package/dist/forks.d.ts +116 -0
- package/dist/forks.d.ts.map +1 -0
- package/dist/forks.js +357 -0
- package/dist/forks.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/inherit.d.ts +18 -0
- package/dist/inherit.d.ts.map +1 -0
- package/dist/inherit.js +84 -0
- package/dist/inherit.js.map +1 -0
- package/dist/manifest.d.ts +43 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +64 -0
- package/dist/manifest.js.map +1 -0
- package/dist/policy.d.ts +5 -1
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +14 -6
- package/dist/policy.js.map +1 -1
- package/dist/readme.d.ts +2 -0
- package/dist/readme.d.ts.map +1 -1
- package/dist/readme.js +6 -1
- package/dist/readme.js.map +1 -1
- package/dist/release.d.ts +24 -0
- package/dist/release.d.ts.map +1 -1
- package/dist/release.js +51 -6
- package/dist/release.js.map +1 -1
- package/dist/scaffold.d.ts +3 -5
- package/dist/scaffold.d.ts.map +1 -1
- package/dist/scaffold.js +116 -64
- package/dist/scaffold.js.map +1 -1
- package/dist/submodules.d.ts +49 -0
- package/dist/submodules.d.ts.map +1 -1
- package/dist/submodules.js +94 -4
- package/dist/submodules.js.map +1 -1
- package/dist/workflows.d.ts +46 -1
- package/dist/workflows.d.ts.map +1 -1
- package/dist/workflows.js +372 -20
- package/dist/workflows.js.map +1 -1
- package/package.json +14 -12
package/Readme.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- fg:version -->
|
|
4
4
|
|
|
5
|
-
Version **0.1.0-alpha.
|
|
5
|
+
Version **0.1.0-alpha.2**
|
|
6
6
|
|
|
7
7
|
<!-- /fg:version -->
|
|
8
8
|
|
|
@@ -10,13 +10,13 @@ Version **0.1.0-alpha.1**
|
|
|
10
10
|
|
|
11
11
|
## Releasing
|
|
12
12
|
|
|
13
|
-
This module releases on its own. `0.1.0-alpha.
|
|
13
|
+
This module releases on its own. `0.1.0-alpha.2` is what main is working towards,
|
|
14
14
|
not what is published — the version here is always the next one.
|
|
15
15
|
|
|
16
16
|
1. **Publish it.** Run the *Publish* workflow from the Actions tab, picking the
|
|
17
17
|
dist tag. It refuses if that version is already on npm.
|
|
18
18
|
2. **Move it on.** `pnpm release` — opens a pull request bumping this branch
|
|
19
|
-
to `0.1.0-alpha.
|
|
19
|
+
to `0.1.0-alpha.3`, or `pnpm release --id rc` to change
|
|
20
20
|
identifier. A prerelease gets no maintenance branch; there is no released
|
|
21
21
|
line behind it yet.
|
|
22
22
|
|
package/dist/add-module.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export interface AddModuleOptions {
|
|
|
12
12
|
* when nothing but a developer's machine will ever clone the submodule.
|
|
13
13
|
*/
|
|
14
14
|
ssh?: boolean;
|
|
15
|
+
/** Note the module in the distribution's changelog. On by default. */
|
|
16
|
+
changelog?: boolean;
|
|
15
17
|
}
|
|
16
18
|
/**
|
|
17
19
|
* The app that composes the modules, or undefined when there is none.
|
|
@@ -45,6 +47,8 @@ export interface AddModuleResult {
|
|
|
45
47
|
rewritten: boolean;
|
|
46
48
|
/** Whether the module has routes, and so is mounted rather than depended on. */
|
|
47
49
|
isApp: boolean;
|
|
50
|
+
/** Whether turbo.json was told the monolith compiles this app from its source. */
|
|
51
|
+
turbo: boolean;
|
|
48
52
|
}
|
|
49
53
|
/**
|
|
50
54
|
* Add a module repository as a submodule and wire it into the monolith.
|
package/dist/add-module.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-module.d.ts","sourceRoot":"","sources":["../src/add-module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-module.d.ts","sourceRoot":"","sources":["../src/add-module.ts"],"names":[],"mappings":"AAiCA,8EAA8E;AAC9E,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,KAAG,MAGzC,CAAA;AAED,MAAM,WAAW,gBAAgB;IAC/B,uFAAuF;IACvF,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,kFAAkF;IAClF,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,gFAAgF;IAChF,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,sEAAsE;IACtE,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAgBD;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GACvB,MAAM,MAAM,EACZ,MAAM,MAAM,KACX,OAAO,CAAC,MAAM,GAAG,SAAS,CAiB5B,CAAA;AAED,MAAM,WAAW,eAAe;IAC9B,2EAA2E;IAC3E,SAAS,EAAE,OAAO,CAAA;IAClB,iEAAiE;IACjE,cAAc,EAAE,MAAM,GAAG,SAAS,CAAA;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,uDAAuD;IACvD,MAAM,EAAE,OAAO,CAAA;IACf,iEAAiE;IACjE,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAA;IACvC,6CAA6C;IAC7C,cAAc,EAAE,MAAM,GAAG,SAAS,CAAA;IAClC,uEAAuE;IACvE,OAAO,EAAE,OAAO,CAAA;IAChB,gEAAgE;IAChE,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;IAC9B,4EAA4E;IAC5E,GAAG,EAAE,MAAM,CAAA;IACX,+CAA+C;IAC/C,SAAS,EAAE,OAAO,CAAA;IAClB,gFAAgF;IAChF,KAAK,EAAE,OAAO,CAAA;IACd,kFAAkF;IAClF,KAAK,EAAE,OAAO,CAAA;CACf;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,GACpB,KAAK,MAAM,EACX,KAAK,MAAM,EACX,UAAS,gBAAqB,KAC7B,OAAO,CAAC,eAAe,CAmHzB,CAAA"}
|
package/dist/add-module.js
CHANGED
|
@@ -6,6 +6,7 @@ import { repositoryRoot } from "./submodules.js";
|
|
|
6
6
|
import { readPackageName } from "./scaffold.js";
|
|
7
7
|
import { addMount, ConfigEditError, declaresMonolith } from "./config-edit.js";
|
|
8
8
|
import { toHttps } from "./git-url.js";
|
|
9
|
+
import { noteInDistribution, repositoryLink } from "./changelog.js";
|
|
9
10
|
const CONFIG_FILES = [
|
|
10
11
|
'next.config.ts',
|
|
11
12
|
'next.config.mts',
|
|
@@ -139,6 +140,7 @@ export const addModule = async (cwd, url, options = {}) => {
|
|
|
139
140
|
'Give it one, or mount it by path yourself.',
|
|
140
141
|
}
|
|
141
142
|
: { config: undefined, mounted: false, error: undefined };
|
|
143
|
+
const turbo = monolithRoot && isApp && packageName ? await compileFromSource(root, packageName) : false;
|
|
142
144
|
// The distribution resolves its own modules from the tree, not from their
|
|
143
145
|
// declared ranges — which stop matching as soon as a submodule is bumped
|
|
144
146
|
// past them.
|
|
@@ -149,6 +151,9 @@ export const addModule = async (cwd, url, options = {}) => {
|
|
|
149
151
|
// mount is written by now, so a workspace this cannot edit — a sibling with
|
|
150
152
|
// no checkout, an `overrides:` key someone else wrote — is something to
|
|
151
153
|
// report, not something to fail the whole command over.
|
|
154
|
+
if (options.changelog !== false && packageName) {
|
|
155
|
+
noteInDistribution(root, `\`${packageName}\`${version ? ` ${version}` : ''} added, from ${repositoryLink(recorded)}`);
|
|
156
|
+
}
|
|
152
157
|
const overrides = await writeOverrides(repositoryRoot(cwd) ?? cwd).catch((error) => ({
|
|
153
158
|
changed: false,
|
|
154
159
|
error: error instanceof Error ? error.message : String(error),
|
|
@@ -168,8 +173,32 @@ export const addModule = async (cwd, url, options = {}) => {
|
|
|
168
173
|
url: recorded,
|
|
169
174
|
rewritten,
|
|
170
175
|
isApp,
|
|
176
|
+
turbo,
|
|
171
177
|
};
|
|
172
178
|
};
|
|
179
|
+
const BUILD_LIBS = 'build:libs';
|
|
180
|
+
/**
|
|
181
|
+
* Have the monolith's build wait for this app's libraries rather than for the
|
|
182
|
+
* app's own build: the monolith compiles it from source, so building it on its
|
|
183
|
+
* own as well would only take time. Only where turbo.json has the
|
|
184
|
+
* `build:libs` task this relies on.
|
|
185
|
+
*/
|
|
186
|
+
const compileFromSource = async (root, packageName) => {
|
|
187
|
+
const file = path.join(root, 'turbo.json');
|
|
188
|
+
let turbo;
|
|
189
|
+
try {
|
|
190
|
+
turbo = JSON.parse(await readFile(file, 'utf8'));
|
|
191
|
+
}
|
|
192
|
+
catch {
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
const key = `${packageName}#${BUILD_LIBS}`;
|
|
196
|
+
if (!turbo.tasks?.[BUILD_LIBS] || turbo.tasks[key])
|
|
197
|
+
return false;
|
|
198
|
+
turbo.tasks[key] = { dependsOn: [`^${BUILD_LIBS}`] };
|
|
199
|
+
await writeFile(file, `${JSON.stringify(turbo, null, 2)}\n`);
|
|
200
|
+
return true;
|
|
201
|
+
};
|
|
173
202
|
/**
|
|
174
203
|
* Write the mount into the monolith's Next config.
|
|
175
204
|
*
|
package/dist/add-module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-module.js","sourceRoot":"","sources":["../src/add-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAE5E,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAC9E,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"add-module.js","sourceRoot":"","sources":["../src/add-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAE5E,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAC9E,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,kBAAkB,EAAE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,CAAA;IAClC,GAAG,CAAC,YAAY,GAAG,MAAM,CAAC,WAAW,CACnC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CACpE,CAAA;IAED,MAAM,SAAS,CAAC,eAAe,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAA;IACrE,OAAO,IAAI,CAAA;AACb,CAAC,CAAA"}
|
package/dist/calver.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A distribution's version: `YY.MM.NN`, and a prerelease stage on the way.
|
|
3
|
+
*
|
|
4
|
+
* `26.09.01-alpha.0` is the first release of September 2026, at its first
|
|
5
|
+
* alpha. A release goes through its stages — alpha, beta, then stable — and the
|
|
6
|
+
* next release that month is `26.09.02`. The month is when it is published, so
|
|
7
|
+
* a new month starts again at `.01`, stage counter at 0, whatever was
|
|
8
|
+
* unfinished before: a distribution still in alpha publishes `alpha.0`,
|
|
9
|
+
* `alpha.1`, … until the month turns.
|
|
10
|
+
*
|
|
11
|
+
* End users read the month: `26.03` against `26.09` says six months, where
|
|
12
|
+
* `1.1.1` against `1.2.1` says nothing. The day is not in it — it says nothing
|
|
13
|
+
* a reader needs — and neither is `20`.
|
|
14
|
+
*
|
|
15
|
+
* npm takes semver only, which allows no leading zeros, so the registry spells
|
|
16
|
+
* it `26.9.1-alpha.0`: the same version, which sorts the same way. The
|
|
17
|
+
* distribution — its manifest, its tags — keeps the padded form.
|
|
18
|
+
*/
|
|
19
|
+
export interface CalendarVersion {
|
|
20
|
+
/** Two digits: 26 for 2026. */
|
|
21
|
+
year: number;
|
|
22
|
+
month: number;
|
|
23
|
+
/** Which release of the month, from 1. */
|
|
24
|
+
release: number;
|
|
25
|
+
/** The stage it is at, until it is stable. */
|
|
26
|
+
prerelease: {
|
|
27
|
+
id: string;
|
|
28
|
+
number: number;
|
|
29
|
+
} | undefined;
|
|
30
|
+
}
|
|
31
|
+
export declare const parseCalendarVersion: (version: string) => CalendarVersion | undefined;
|
|
32
|
+
export declare const formatCalendarVersion: (version: CalendarVersion) => string;
|
|
33
|
+
/** Throw unless `version` is a distribution's; the message says what one looks like. */
|
|
34
|
+
export declare const assertCalendarVersion: (version: string) => CalendarVersion;
|
|
35
|
+
/** How npm spells it: the same version, without the zeros semver does not allow. */
|
|
36
|
+
export declare const npmVersion: (version: string) => string;
|
|
37
|
+
/** The year and month a release is published in, which the version names. UTC, as CI is. */
|
|
38
|
+
export declare const monthOf: (on?: Date) => {
|
|
39
|
+
year: number;
|
|
40
|
+
month: number;
|
|
41
|
+
};
|
|
42
|
+
/** The first release of the month: `26.09.01-alpha.0`, or with `false`, stable. */
|
|
43
|
+
export declare const firstRelease: (on?: Date, id?: string | false) => string;
|
|
44
|
+
export interface NextOptions {
|
|
45
|
+
/** Whether `current` has been published already. */
|
|
46
|
+
published: boolean;
|
|
47
|
+
on?: Date;
|
|
48
|
+
/** Move to this stage — alpha, beta, rc. */
|
|
49
|
+
id?: string;
|
|
50
|
+
/** Leave the prerelease stages: this release is stable. */
|
|
51
|
+
stable?: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The version a distribution publishes next.
|
|
55
|
+
*
|
|
56
|
+
* Published, it moves on: the next attempt at the same stage, the next stage
|
|
57
|
+
* when one is asked for, stable with `stable`, or — once stable — the month's
|
|
58
|
+
* next release. Not yet published, it stays what it is, unless a stage is
|
|
59
|
+
* asked for. Either way, a version from a month already over becomes this
|
|
60
|
+
* month's first release, at the stage it was at or the one asked for.
|
|
61
|
+
*/
|
|
62
|
+
export declare const nextCalendarVersion: (current: string, options: NextOptions) => string;
|
|
63
|
+
/** Whether `version` names a month before the one it is now. */
|
|
64
|
+
export declare const isFromPastMonth: (version: string, on?: Date) => boolean;
|
|
65
|
+
//# sourceMappingURL=calver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calver.d.ts","sourceRoot":"","sources":["../src/calver.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,eAAe;IAC9B,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAA;IACf,8CAA8C;IAC9C,UAAU,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAA;CACvD;AAID,eAAO,MAAM,oBAAoB,GAAI,SAAS,MAAM,KAAG,eAAe,GAAG,SAYxE,CAAA;AAID,eAAO,MAAM,qBAAqB,GAAI,SAAS,eAAe,KAAG,MAEqB,CAAA;AAEtF,wFAAwF;AACxF,eAAO,MAAM,qBAAqB,GAAI,SAAS,MAAM,KAAG,eASvD,CAAA;AAED,oFAAoF;AACpF,eAAO,MAAM,UAAU,GAAI,SAAS,MAAM,KAAG,MAI5C,CAAA;AAED,4FAA4F;AAC5F,eAAO,MAAM,OAAO,GAAI,KAAI,IAAiB,KAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAG3E,CAAA;AAEF,mFAAmF;AACnF,eAAO,MAAM,YAAY,GAAI,KAAI,IAAiB,EAAE,KAAI,MAAM,GAAG,KAAe,KAAG,MACoB,CAAA;AAEvG,MAAM,WAAW,WAAW;IAC1B,oDAAoD;IACpD,SAAS,EAAE,OAAO,CAAA;IAClB,EAAE,CAAC,EAAE,IAAI,CAAA;IACT,4CAA4C;IAC5C,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,2DAA2D;IAC3D,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAKD;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,EAAE,SAAS,WAAW,KAAG,MAqD3E,CAAA;AAED,gEAAgE;AAChE,eAAO,MAAM,eAAe,GAAI,SAAS,MAAM,EAAE,KAAI,IAAiB,KAAG,OAKxE,CAAA"}
|
package/dist/calver.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import semver from 'semver';
|
|
2
|
+
const PATTERN = /^(\d{2})\.(\d{2})\.(\d{2,})(?:-([a-z]+)\.(\d+))?$/;
|
|
3
|
+
export const parseCalendarVersion = (version) => {
|
|
4
|
+
const match = PATTERN.exec(version);
|
|
5
|
+
if (!match)
|
|
6
|
+
return undefined;
|
|
7
|
+
const [, year, month, release, id, number] = match;
|
|
8
|
+
const parsed = {
|
|
9
|
+
year: Number(year),
|
|
10
|
+
month: Number(month),
|
|
11
|
+
release: Number(release),
|
|
12
|
+
prerelease: id ? { id, number: Number(number) } : undefined,
|
|
13
|
+
};
|
|
14
|
+
if (parsed.month < 1 || parsed.month > 12 || parsed.release < 1)
|
|
15
|
+
return undefined;
|
|
16
|
+
return parsed;
|
|
17
|
+
};
|
|
18
|
+
const pad = (value) => String(value).padStart(2, '0');
|
|
19
|
+
export const formatCalendarVersion = (version) => `${pad(version.year)}.${pad(version.month)}.${pad(version.release)}` +
|
|
20
|
+
(version.prerelease ? `-${version.prerelease.id}.${version.prerelease.number}` : '');
|
|
21
|
+
/** Throw unless `version` is a distribution's; the message says what one looks like. */
|
|
22
|
+
export const assertCalendarVersion = (version) => {
|
|
23
|
+
const parsed = parseCalendarVersion(version);
|
|
24
|
+
if (!parsed) {
|
|
25
|
+
throw new Error(`${version} is not a distribution version. One is YY.MM.NN — the year, the month, ` +
|
|
26
|
+
'and which release of the month — with a stage until it is stable: 26.09.01-alpha.0.');
|
|
27
|
+
}
|
|
28
|
+
return parsed;
|
|
29
|
+
};
|
|
30
|
+
/** How npm spells it: the same version, without the zeros semver does not allow. */
|
|
31
|
+
export const npmVersion = (version) => {
|
|
32
|
+
const cleaned = semver.clean(version, { loose: true });
|
|
33
|
+
if (!cleaned)
|
|
34
|
+
throw new Error(`${version} is not a version npm can publish.`);
|
|
35
|
+
return cleaned;
|
|
36
|
+
};
|
|
37
|
+
/** The year and month a release is published in, which the version names. UTC, as CI is. */
|
|
38
|
+
export const monthOf = (on = new Date()) => ({
|
|
39
|
+
year: on.getUTCFullYear() % 100,
|
|
40
|
+
month: on.getUTCMonth() + 1,
|
|
41
|
+
});
|
|
42
|
+
/** The first release of the month: `26.09.01-alpha.0`, or with `false`, stable. */
|
|
43
|
+
export const firstRelease = (on = new Date(), id = 'alpha') => formatCalendarVersion({ ...monthOf(on), release: 1, prerelease: id ? { id, number: 0 } : undefined });
|
|
44
|
+
const compareStages = (a, b) => semver.compare(`1.0.0-${a}.0`, `1.0.0-${b}.0`);
|
|
45
|
+
/**
|
|
46
|
+
* The version a distribution publishes next.
|
|
47
|
+
*
|
|
48
|
+
* Published, it moves on: the next attempt at the same stage, the next stage
|
|
49
|
+
* when one is asked for, stable with `stable`, or — once stable — the month's
|
|
50
|
+
* next release. Not yet published, it stays what it is, unless a stage is
|
|
51
|
+
* asked for. Either way, a version from a month already over becomes this
|
|
52
|
+
* month's first release, at the stage it was at or the one asked for.
|
|
53
|
+
*/
|
|
54
|
+
export const nextCalendarVersion = (current, options) => {
|
|
55
|
+
const version = assertCalendarVersion(current);
|
|
56
|
+
const { published, id, stable = false } = options;
|
|
57
|
+
const now = monthOf(options.on);
|
|
58
|
+
if (id && stable)
|
|
59
|
+
throw new Error('Ask for a stage or for stable, not both.');
|
|
60
|
+
const newMonth = now.year > version.year || (now.year === version.year && now.month > version.month);
|
|
61
|
+
if (!newMonth && (now.year !== version.year || now.month !== version.month)) {
|
|
62
|
+
throw new Error(`${current} is in a month still to come; it cannot be moved on from yet.`);
|
|
63
|
+
}
|
|
64
|
+
const stageAfter = stable ? undefined : (id ?? version.prerelease?.id);
|
|
65
|
+
if (newMonth) {
|
|
66
|
+
return formatCalendarVersion({
|
|
67
|
+
...now,
|
|
68
|
+
release: 1,
|
|
69
|
+
prerelease: stageAfter ? { id: stageAfter, number: 0 } : undefined,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
const same = { ...version };
|
|
73
|
+
const pre = version.prerelease;
|
|
74
|
+
// Moving to another stage of the same release: only ever forward.
|
|
75
|
+
const toStage = (next) => {
|
|
76
|
+
if (pre && compareStages(next, pre.id) < 0) {
|
|
77
|
+
throw new Error(`${current} is at ${pre.id} already, which is past ${next}.`);
|
|
78
|
+
}
|
|
79
|
+
if (!pre && !published) {
|
|
80
|
+
// An unpublished stable release can still be taken back to a stage.
|
|
81
|
+
return formatCalendarVersion({ ...same, prerelease: { id: next, number: 0 } });
|
|
82
|
+
}
|
|
83
|
+
if (!pre) {
|
|
84
|
+
return formatCalendarVersion({ ...same, release: same.release + 1, prerelease: { id: next, number: 0 } });
|
|
85
|
+
}
|
|
86
|
+
return formatCalendarVersion({ ...same, prerelease: { id: next, number: 0 } });
|
|
87
|
+
};
|
|
88
|
+
if (!published) {
|
|
89
|
+
if (stable)
|
|
90
|
+
return formatCalendarVersion({ ...same, prerelease: undefined });
|
|
91
|
+
if (id && id !== pre?.id)
|
|
92
|
+
return toStage(id);
|
|
93
|
+
return current;
|
|
94
|
+
}
|
|
95
|
+
if (stable) {
|
|
96
|
+
if (!pre)
|
|
97
|
+
return formatCalendarVersion({ ...same, release: same.release + 1 });
|
|
98
|
+
return formatCalendarVersion({ ...same, prerelease: undefined });
|
|
99
|
+
}
|
|
100
|
+
if (id && id !== pre?.id)
|
|
101
|
+
return toStage(id);
|
|
102
|
+
if (pre)
|
|
103
|
+
return formatCalendarVersion({ ...same, prerelease: { id: pre.id, number: pre.number + 1 } });
|
|
104
|
+
// Stable, and published: the month's next release.
|
|
105
|
+
return formatCalendarVersion({ ...same, release: same.release + 1 });
|
|
106
|
+
};
|
|
107
|
+
/** Whether `version` names a month before the one it is now. */
|
|
108
|
+
export const isFromPastMonth = (version, on = new Date()) => {
|
|
109
|
+
const parsed = parseCalendarVersion(version);
|
|
110
|
+
if (!parsed)
|
|
111
|
+
return false;
|
|
112
|
+
const now = monthOf(on);
|
|
113
|
+
return now.year > parsed.year || (now.year === parsed.year && now.month > parsed.month);
|
|
114
|
+
};
|
|
115
|
+
//# sourceMappingURL=calver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calver.js","sourceRoot":"","sources":["../src/calver.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AA8B3B,MAAM,OAAO,GAAG,mDAAmD,CAAA;AAEnE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,OAAe,EAA+B,EAAE;IACnF,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACnC,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAA;IAC5B,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,KAAK,CAAA;IAClD,MAAM,MAAM,GAAG;QACb,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC;QAClB,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;QACpB,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC;QACxB,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;KAC5D,CAAA;IACD,IAAI,MAAM,CAAC,KAAK,GAAG,CAAC,IAAI,MAAM,CAAC,KAAK,GAAG,EAAE,IAAI,MAAM,CAAC,OAAO,GAAG,CAAC;QAAE,OAAO,SAAS,CAAA;IACjF,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAED,MAAM,GAAG,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC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oBAAoB,CAAC,OAAO,CAAC,CAAA;IAC5C,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAA;IACzB,MAAM,GAAG,GAAG,OAAO,CAAC,EAAE,CAAC,CAAA;IACvB,OAAO,GAAG,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,IAAI,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;AACzF,CAAC,CAAA"}
|
package/dist/canary.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canary.d.ts","sourceRoot":"","sources":["../src/canary.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"canary.d.ts","sourceRoot":"","sources":["../src/canary.ts"],"names":[],"mappings":"AAuBA,uCAAuC;AACvC,MAAM,WAAW,SAAS;IACxB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,GAAI,SAAS,MAAM,EAAE,WAAW,MAAM,GAAG,SAAS,KAAG,MA8B3E,CAAA;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ;;;OAGG;IACH,UAAU,EAAE,OAAO,CAAA;IACnB,2EAA2E;IAC3E,OAAO,EAAE,MAAM,CAAA;IACf,qFAAqF;IACrF,IAAI,EAAE,OAAO,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,aAAa;IAC5B,wDAAwD;IACxD,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,yDAAyD;IACzD,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,yEAAyE;IACzE,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GACtB,MAAM,MAAM,EACZ,6BAAmE,aAAkB,KACpF,OAAO,CAAC,YAAY,CA6CtB,CAAA;AAED,0EAA0E;AAC1E,eAAO,MAAM,eAAe,GAAU,QAAQ,YAAY,KAAG,OAAO,CAAC,IAAI,CAUxE,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAI,UAAU;IACjC,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB,KAAG,OASH,CAAA"}
|
package/dist/canary.js
CHANGED
|
@@ -2,6 +2,9 @@ import { execFileSync } from 'node:child_process';
|
|
|
2
2
|
import { appendFile, readFile, writeFile } from 'node:fs/promises';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import semver from 'semver';
|
|
5
|
+
import { assertCalendarVersion, npmVersion } from "./calver.js";
|
|
6
|
+
import { stampModules } from "./manifest.js";
|
|
7
|
+
import { isDistribution } from "./submodules.js";
|
|
5
8
|
/** Ask npm about a published version, returning undefined when it says nothing. */
|
|
6
9
|
const view = (spec, field) => {
|
|
7
10
|
try {
|
|
@@ -81,9 +84,19 @@ export const stampCanary = async (root, { sha = process.env.GITHUB_SHA ?? '', pu
|
|
|
81
84
|
sha,
|
|
82
85
|
};
|
|
83
86
|
}
|
|
84
|
-
|
|
87
|
+
// A distribution's version is spelled as npm does, and it records what it
|
|
88
|
+
// ships as it is published.
|
|
89
|
+
const distribution = isDistribution(root);
|
|
90
|
+
if (distribution)
|
|
91
|
+
assertCalendarVersion(manifest.version);
|
|
92
|
+
const version = nextCanary(distribution ? npmVersion(manifest.version) : manifest.version, current.version);
|
|
85
93
|
if (!dryRun) {
|
|
86
|
-
|
|
94
|
+
if (distribution) {
|
|
95
|
+
await stampModules(root, { version, gitSha: sha });
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
await writeFile(file, `${JSON.stringify({ ...manifest, version, gitSha: sha }, null, 2)}\n`);
|
|
99
|
+
}
|
|
87
100
|
}
|
|
88
101
|
return { name: manifest.name, version, skip: false, provenance, sha };
|
|
89
102
|
};
|
package/dist/canary.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canary.js","sourceRoot":"","sources":["../src/canary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAClE,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,MAAM,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"canary.js","sourceRoot":"","sources":["../src/canary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAClE,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAEhD,mFAAmF;AACnF,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,KAAa,EAAsB,EAAE;IAC/D,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE;YACvD,QAAQ,EAAE,MAAM;YAChB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;SACpC,CAAC,CAAC,IAAI,EAAE,CAAA;QACT,OAAO,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAA;IACzC,CAAC;IAAC,MAAM,CAAC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CAAA;IAEzC,wEAAwE;IACxE,OAAO,OAAO,QAAQ,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;AAC5E,CAAC,CAAA"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Changelogs.
|
|
3
|
+
*
|
|
4
|
+
* Every module keeps a CHANGELOG.md. Its top section is the version its main
|
|
5
|
+
* carries — the next to be released — and every pull request adds a line to
|
|
6
|
+
* it that links the pull request, which CI checks before it can merge. When
|
|
7
|
+
* the version is published its notes are written already, and committed: the
|
|
8
|
+
* release takes them as they are, and `release` opens the next section.
|
|
9
|
+
*
|
|
10
|
+
* A distribution's changelog is mostly written for it. fg-dist notes each
|
|
11
|
+
* module it bumps, with a link to that release's notes, and each module it
|
|
12
|
+
* adds, forks, or takes back to upstream. What people change in it by hand —
|
|
13
|
+
* the organization's policy — is checked like a module's.
|
|
14
|
+
*/
|
|
15
|
+
export declare const CHANGELOG = "CHANGELOG.md";
|
|
16
|
+
/** Where a pull request that needs no entry — a lockfile bump — says so. */
|
|
17
|
+
export declare const SKIP_LABEL = "skip changelog";
|
|
18
|
+
/**
|
|
19
|
+
* A new changelog, opened at `version`.
|
|
20
|
+
*
|
|
21
|
+
* Nothing but the heading: a changelog is for whoever uses a release, and how
|
|
22
|
+
* lines get into it is for contributors, who hear it from the check that asks
|
|
23
|
+
* for one.
|
|
24
|
+
*/
|
|
25
|
+
export declare const newChangelog: (version: string) => string;
|
|
26
|
+
/** The version of the top section, which is the one being worked on. */
|
|
27
|
+
export declare const topVersion: (text: string) => string | undefined;
|
|
28
|
+
/** What `version`'s section says, without its heading; undefined when there is none, or nothing in it. */
|
|
29
|
+
export declare const notesFor: (text: string, version: string) => string | undefined;
|
|
30
|
+
/** `text` with `version` as its top section, added above the others unless it is there. */
|
|
31
|
+
export declare const withSection: (text: string, version: string) => string;
|
|
32
|
+
/** `text` with its top section, `from`, called `to` instead: a release moved before it was published. */
|
|
33
|
+
export declare const renameTop: (text: string, from: string, to: string) => string;
|
|
34
|
+
/** `text` with `entry` as a line at the end of `version`'s section, the top one. */
|
|
35
|
+
export declare const withEntry: (text: string, version: string, entry: string) => string;
|
|
36
|
+
/**
|
|
37
|
+
* Open the section for the version a repository now carries, when it keeps a
|
|
38
|
+
* changelog: what `release` does as it moves main on.
|
|
39
|
+
*/
|
|
40
|
+
export declare const openSection: (root: string, version?: string | undefined) => Promise<boolean>;
|
|
41
|
+
/**
|
|
42
|
+
* Add a line to a repository's changelog, under the version it carries,
|
|
43
|
+
* starting the changelog when there is none: what fg-dist writes into a
|
|
44
|
+
* distribution's as it changes what the distribution ships.
|
|
45
|
+
*/
|
|
46
|
+
export declare const addEntry: (root: string, entry: string) => void;
|
|
47
|
+
/** Note a change to what a distribution ships in its changelog; anywhere else, nothing. */
|
|
48
|
+
export declare const noteInDistribution: (root: string, entry: string) => void;
|
|
49
|
+
/** A module's name and version, as its checkout states them, for a changelog line. */
|
|
50
|
+
export declare const moduleLabel: (checkout: string) => {
|
|
51
|
+
name: string;
|
|
52
|
+
version: string | undefined;
|
|
53
|
+
};
|
|
54
|
+
/** The top section called `to` rather than `from`, or a new one when `from` was published. */
|
|
55
|
+
export declare const moveSection: (root: string, from: string, to: string, { published }: {
|
|
56
|
+
published: boolean;
|
|
57
|
+
}) => Promise<void>;
|
|
58
|
+
export interface ChangelogCheck {
|
|
59
|
+
/** The pull request's number. */
|
|
60
|
+
pullRequest: number;
|
|
61
|
+
/** `owner/name`, which the link names. */
|
|
62
|
+
repository: string;
|
|
63
|
+
/** What it merges into: a commit, or a ref such as `origin/main`. */
|
|
64
|
+
base: string;
|
|
65
|
+
/** Whether this is a distribution, which checks only its policy. */
|
|
66
|
+
distribution: boolean;
|
|
67
|
+
labels?: string[];
|
|
68
|
+
/** The host links point at. */
|
|
69
|
+
server?: string;
|
|
70
|
+
}
|
|
71
|
+
export interface ChangelogCheckResult {
|
|
72
|
+
ok: boolean;
|
|
73
|
+
/** Whether this pull request needed an entry at all. */
|
|
74
|
+
required: boolean;
|
|
75
|
+
message: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Whether a pull request has added its changelog entry.
|
|
79
|
+
*
|
|
80
|
+
* It needs a line under the top section, linking it. In a module that is
|
|
81
|
+
* every pull request; in a distribution only one that changes the
|
|
82
|
+
* organization's policy — what else changes there, fg-dist notes itself.
|
|
83
|
+
*/
|
|
84
|
+
export declare const checkChangelog: (root: string, check: ChangelogCheck) => ChangelogCheckResult;
|
|
85
|
+
/** What a GitHub Actions `pull_request` run says about itself. */
|
|
86
|
+
export declare const pullRequestFromActions: () => Partial<ChangelogCheck>;
|
|
87
|
+
/** Where a repository's release of `tag` is described, when it is on GitHub. */
|
|
88
|
+
export declare const releaseNotesUrl: (repository: string, tag: string) => string | undefined;
|
|
89
|
+
/** A repository as a markdown link to it, or its url when it has no web page. */
|
|
90
|
+
export declare const repositoryLink: (repository: string) => string;
|
|
91
|
+
/** `v1.2.0` as `1.2.0`, for reading; anything else as it is. */
|
|
92
|
+
export declare const shown: (version: string) => string;
|
|
93
|
+
/**
|
|
94
|
+
* The releases a module moving to `to` takes in, oldest first: every one past
|
|
95
|
+
* where it was, up to and including `to`, prereleases too. Each release's
|
|
96
|
+
* notes are its own, so skipping one would hide what it changed.
|
|
97
|
+
*/
|
|
98
|
+
export declare const crossedReleases: (newer: string[], to: string) => string[];
|
|
99
|
+
/** Links to the notes of each release, for a changelog line: one, or each in turn. */
|
|
100
|
+
export declare const releaseNotesLinks: (repository: string, releases: string[]) => string;
|
|
101
|
+
/** A module moved from one release to another, linking the notes of each it takes in. */
|
|
102
|
+
export declare const bumpEntry: (name: string, from: string, to: string, repository: string, releases: string[], how?: string) => string;
|
|
103
|
+
/**
|
|
104
|
+
* A module shipped ahead of its next release: what the change is, and where it
|
|
105
|
+
* can be read about — its pull request, or its commit.
|
|
106
|
+
*/
|
|
107
|
+
export declare const aheadEntry: (name: string, change: string, link?: {
|
|
108
|
+
text: string;
|
|
109
|
+
url: string;
|
|
110
|
+
}) => string;
|
|
111
|
+
//# sourceMappingURL=changelog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changelog.d.ts","sourceRoot":"","sources":["../src/changelog.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,SAAS,iBAAiB,CAAA;AAEvC,4EAA4E;AAC5E,eAAO,MAAM,UAAU,mBAAmB,CAAA;AAE1C;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,GAAI,SAAS,MAAM,KAAG,MAA0C,CAAA;AA+BzF,wEAAwE;AACxE,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,KAAG,MAAM,GAAG,SAAqD,CAAA;AAExG,0GAA0G;AAC1G,eAAO,MAAM,QAAQ,GAAI,MAAM,MAAM,EAAE,SAAS,MAAM,KAAG,MAAM,GAAG,SAMjE,CAAA;AAED,2FAA2F;AAC3F,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,SAAS,MAAM,KAAG,MAQ3D,CAAA;AAED,yGAAyG;AACzG,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,MAAM,MAAM,EAAE,IAAI,MAAM,KAAG,MAMlE,CAAA;AAED,oFAAoF;AACpF,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,SAAS,MAAM,EAAE,OAAO,MAAM,KAAG,MAcxE,CAAA;AAWD;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAU,MAAM,MAAM,EAAE,4BAA2B,KAAG,OAAO,CAAC,OAAO,CAQ5F,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,QAAQ,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,KAAG,IAMtD,CAAA;AAED,2FAA2F;AAC3F,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,KAAG,IAEhE,CAAA;AA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