@teambit/snapping 1.0.1155 → 1.0.1156

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.
@@ -0,0 +1,74 @@
1
+ import type { Registries, Registry } from '@teambit/pkg.entities.registry';
2
+ /**
3
+ * npm publish runs as the last task of the tag build pipeline, which is *before* the export (see
4
+ * `bit ci merge`). when an export fails after the packages were already published, the registry is
5
+ * left ahead of both the remote scope and .bitmap. the next run then computes the exact same
6
+ * version again, and npm rejects it with "You cannot publish over the previously published
7
+ * versions" (E403), so the release stays stuck until someone bumps the CI config by hand with
8
+ * `--increment-by`.
9
+ *
10
+ * skipping the versions the registry already has lets that retry pick the next free version on its
11
+ * own. it's done per-component, so unlike `--increment-by` it only bumps the components that
12
+ * actually collide.
13
+ */
14
+ export type IsVersionPublished = (packageName: string, version: string, registryUrl?: string) => Promise<boolean>;
15
+ /**
16
+ * a collision means a previous run published this component and then failed, so the number of
17
+ * versions to skip is the number of such runs. anything beyond this is not a stuck release but a
18
+ * broken setup (e.g. the wrong package name), and hammering the registry won't fix it.
19
+ */
20
+ export declare const MAX_PUBLISHED_VERSIONS_TO_SKIP = 20;
21
+ export type VersionCandidate = {
22
+ /** component id, used to report back which versions changed */
23
+ id: string;
24
+ packageName: string;
25
+ version: string;
26
+ /**
27
+ * the registry `npm publish` will target for this component, when it is not the one configured
28
+ * for the package's scope. asking any other registry would say "free" about a taken version.
29
+ */
30
+ registryUrl?: string;
31
+ };
32
+ export type SkippedVersion = VersionCandidate & {
33
+ versionToTag: string;
34
+ };
35
+ /**
36
+ * the version right after `version`, keeping its pre-release identifier when it has one.
37
+ * e.g. "1.2.3" => "1.2.4", "1.2.3-dev.1" => "1.2.3-dev.2".
38
+ */
39
+ export declare function getNextVersion(version: string): string;
40
+ /**
41
+ * return the candidate's version, or - when it was already published to the registry - the next
42
+ * version that wasn't.
43
+ */
44
+ export declare function findVersionNotPublished(candidate: VersionCandidate, isPublished: IsVersionPublished): Promise<string>;
45
+ /**
46
+ * resolve the version to tag for each candidate.
47
+ *
48
+ * every candidate is checked, rather than a sample of them: a publish that failed midway (npm rate
49
+ * limiting is the usual reason) leaves only *some* of the components published, so there is no
50
+ * component whose answer can be taken to hold for the rest. it is cheap enough to be thorough -
51
+ * measured against registry.npmjs.org, 400 checks take ~11s, against a merge job that runs for
52
+ * close to an hour.
53
+ *
54
+ * @returns the candidates whose version changed.
55
+ */
56
+ export declare function skipPublishedVersions(candidates: VersionCandidate[], isPublished: IsVersionPublished): Promise<SkippedVersion[]>;
57
+ /**
58
+ * ask the registry for one specific version rather than for the package document. the packument of
59
+ * a component that publishes on every snap is tens of megabytes (over 20MB for some of bit's own
60
+ * components), while this endpoint answers the same question in a few kilobytes - or 29 bytes for
61
+ * the "not published" answer, which is the common one.
62
+ *
63
+ * the request goes through the same agent bit uses elsewhere, so a configured proxy, CA, client
64
+ * certificate and strict-ssl setting all apply. without them the request would fail, and a failure
65
+ * reads here as "not published" - it would quietly defeat the check rather than report anything.
66
+ */
67
+ export declare function createIsVersionPublished(registries: Registries, logger: {
68
+ debug: (message: string) => void;
69
+ }): IsVersionPublished;
70
+ /**
71
+ * `registryUrl` is where the publish is actually going for this component, so it wins over the
72
+ * registry configured for the package's scope.
73
+ */
74
+ export declare function getRegistryForPackage(registries: Registries, packageName: string, registryUrl?: string): Pick<Registry, 'uri' | 'authHeaderValue'>;
@@ -0,0 +1,236 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.MAX_PUBLISHED_VERSIONS_TO_SKIP = void 0;
7
+ exports.createIsVersionPublished = createIsVersionPublished;
8
+ exports.findVersionNotPublished = findVersionNotPublished;
9
+ exports.getNextVersion = getNextVersion;
10
+ exports.getRegistryForPackage = getRegistryForPackage;
11
+ exports.skipPublishedVersions = skipPublishedVersions;
12
+ function _semver() {
13
+ const data = require("semver");
14
+ _semver = function () {
15
+ return data;
16
+ };
17
+ return data;
18
+ }
19
+ function _lodash() {
20
+ const data = require("lodash");
21
+ _lodash = function () {
22
+ return data;
23
+ };
24
+ return data;
25
+ }
26
+ function _scope() {
27
+ const data = require("@teambit/scope.network");
28
+ _scope = function () {
29
+ return data;
30
+ };
31
+ return data;
32
+ }
33
+ function _bitError() {
34
+ const data = require("@teambit/bit-error");
35
+ _bitError = function () {
36
+ return data;
37
+ };
38
+ return data;
39
+ }
40
+ function _toolboxPromise() {
41
+ const data = require("@teambit/toolbox.promise.map-pool");
42
+ _toolboxPromise = function () {
43
+ return data;
44
+ };
45
+ return data;
46
+ }
47
+ function _harmonyModules() {
48
+ const data = require("@teambit/harmony.modules.concurrency");
49
+ _harmonyModules = function () {
50
+ return data;
51
+ };
52
+ return data;
53
+ }
54
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
55
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
56
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
57
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
58
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
59
+ /**
60
+ * npm publish runs as the last task of the tag build pipeline, which is *before* the export (see
61
+ * `bit ci merge`). when an export fails after the packages were already published, the registry is
62
+ * left ahead of both the remote scope and .bitmap. the next run then computes the exact same
63
+ * version again, and npm rejects it with "You cannot publish over the previously published
64
+ * versions" (E403), so the release stays stuck until someone bumps the CI config by hand with
65
+ * `--increment-by`.
66
+ *
67
+ * skipping the versions the registry already has lets that retry pick the next free version on its
68
+ * own. it's done per-component, so unlike `--increment-by` it only bumps the components that
69
+ * actually collide.
70
+ */
71
+
72
+ /**
73
+ * a collision means a previous run published this component and then failed, so the number of
74
+ * versions to skip is the number of such runs. anything beyond this is not a stuck release but a
75
+ * broken setup (e.g. the wrong package name), and hammering the registry won't fix it.
76
+ */
77
+ const MAX_PUBLISHED_VERSIONS_TO_SKIP = exports.MAX_PUBLISHED_VERSIONS_TO_SKIP = 20;
78
+ const REGISTRY_REQUEST_TIMEOUT = 10000;
79
+ /**
80
+ * the version right after `version`, keeping its pre-release identifier when it has one.
81
+ * e.g. "1.2.3" => "1.2.4", "1.2.3-dev.1" => "1.2.3-dev.2".
82
+ */
83
+ function getNextVersion(version) {
84
+ const semver = new (_semver().SemVer)(version);
85
+ const preReleaseId = typeof semver.prerelease[0] === 'string' ? semver.prerelease[0] : undefined;
86
+ const releaseType = semver.prerelease.length ? 'prerelease' : 'patch';
87
+ return semver.inc(releaseType, preReleaseId).version;
88
+ }
89
+
90
+ /**
91
+ * return the candidate's version, or - when it was already published to the registry - the next
92
+ * version that wasn't.
93
+ */
94
+ async function findVersionNotPublished(candidate, isPublished) {
95
+ const {
96
+ packageName,
97
+ version,
98
+ registryUrl
99
+ } = candidate;
100
+ let versionToTag = version;
101
+ for (let skipped = 0; skipped <= MAX_PUBLISHED_VERSIONS_TO_SKIP; skipped += 1) {
102
+ if (!(await isPublished(packageName, versionToTag, registryUrl))) return versionToTag;
103
+ versionToTag = getNextVersion(versionToTag);
104
+ }
105
+ throw new (_bitError().BitError)(`unable to find an unpublished version for ${packageName}, the ${MAX_PUBLISHED_VERSIONS_TO_SKIP} versions following ${version} are all in the registry.
106
+ this is unlikely to be a stuck release. make sure the package name is correct and that the registry is not returning stale data`);
107
+ }
108
+
109
+ /**
110
+ * resolve the version to tag for each candidate.
111
+ *
112
+ * every candidate is checked, rather than a sample of them: a publish that failed midway (npm rate
113
+ * limiting is the usual reason) leaves only *some* of the components published, so there is no
114
+ * component whose answer can be taken to hold for the rest. it is cheap enough to be thorough -
115
+ * measured against registry.npmjs.org, 400 checks take ~11s, against a merge job that runs for
116
+ * close to an hour.
117
+ *
118
+ * @returns the candidates whose version changed.
119
+ */
120
+ async function skipPublishedVersions(candidates, isPublished) {
121
+ const resolved = await (0, _toolboxPromise().pMapPool)(candidates, async candidate => _objectSpread(_objectSpread({}, candidate), {}, {
122
+ versionToTag: await findVersionNotPublished(candidate, isPublished)
123
+ }), {
124
+ concurrency: (0, _harmonyModules().concurrentFetchLimit)()
125
+ });
126
+ return resolved.filter(candidate => candidate.versionToTag !== candidate.version);
127
+ }
128
+
129
+ /**
130
+ * ask the registry for one specific version rather than for the package document. the packument of
131
+ * a component that publishes on every snap is tens of megabytes (over 20MB for some of bit's own
132
+ * components), while this endpoint answers the same question in a few kilobytes - or 29 bytes for
133
+ * the "not published" answer, which is the common one.
134
+ *
135
+ * the request goes through the same agent bit uses elsewhere, so a configured proxy, CA, client
136
+ * certificate and strict-ssl setting all apply. without them the request would fail, and a failure
137
+ * reads here as "not published" - it would quietly defeat the check rather than report anything.
138
+ */
139
+ function createIsVersionPublished(registries, logger) {
140
+ // one fetcher per registry: building it reads bit's global config, no need to redo that per request
141
+ const getFetcher = (0, _lodash().memoize)(_scope().getFetcherWithAgent);
142
+ return async (packageName, version, registryUrl) => {
143
+ const registry = getRegistryForPackage(registries, packageName, registryUrl);
144
+ const url = `${registry.uri.replace(/\/+$/, '')}/${packageName.replace('/', '%2f')}/${encodeURIComponent(version)}`;
145
+ try {
146
+ const fetcher = await getFetcher(registry.uri);
147
+ const response = await fetcher(url, {
148
+ headers: registry.authHeaderValue ? {
149
+ authorization: registry.authHeaderValue
150
+ } : {},
151
+ signal: AbortSignal.timeout(REGISTRY_REQUEST_TIMEOUT)
152
+ });
153
+ await response.text().catch(() => undefined); // release the connection, the body is not needed
154
+ if (response.ok) return true;
155
+ if (response.status !== 404) {
156
+ // an unreachable or unauthenticated registry can't tell us the version is taken. treated as
157
+ // "not published" on purpose: only a positive answer is allowed to move a version forward.
158
+ logger.debug(`got ${response.status} when asking ${url} whether ${version} is published`);
159
+ }
160
+ return false;
161
+ } catch (err) {
162
+ logger.debug(`failed asking ${url} whether ${version} is published: ${err.message}`);
163
+ return false;
164
+ }
165
+ };
166
+ }
167
+
168
+ /**
169
+ * `registryUrl` is where the publish is actually going for this component, so it wins over the
170
+ * registry configured for the package's scope.
171
+ */
172
+ function getRegistryForPackage(registries, packageName, registryUrl) {
173
+ const scope = packageName.startsWith('@') ? packageName.slice(1).split('/')[0] : undefined;
174
+ const byScope = scope && registries.scopes[scope] || registries.defaultRegistry;
175
+ if (!registryUrl || isSameRegistry(registryUrl, byScope.uri)) return byScope;
176
+ return {
177
+ uri: registryUrl,
178
+ authHeaderValue: findAuthHeaderForUrl(registries, registryUrl)
179
+ };
180
+ }
181
+
182
+ /**
183
+ * npmrc keys its credentials by url prefix (`//host/path/:_authToken`), and bit's registry model
184
+ * carries them on the entries it knows about. so the credential for an explicit publish registry is
185
+ * the one from the entry that covers its url: the very same url, or the closest one above it.
186
+ *
187
+ * a url no entry covers is probed without authorization. a private version then reads as free,
188
+ * which leaves the publish to fail exactly as it does without this check - never a wrong version.
189
+ */
190
+ function findAuthHeaderForUrl(registries, registryUrl) {
191
+ const target = toUrl(registryUrl);
192
+ if (!target) return undefined;
193
+ const covering = [registries.defaultRegistry, ...Object.values(registries.scopes)].flatMap(registry => {
194
+ const uri = registry.authHeaderValue ? toUrl(registry.uri) : undefined;
195
+ return uri && covers(uri, target) ? [{
196
+ registry,
197
+ uri
198
+ }] : [];
199
+ })
200
+ // the most specific path wins, the way npm resolves the nearest matching npmrc key
201
+ .sort((a, b) => b.uri.pathname.length - a.uri.pathname.length);
202
+ return covering[0]?.registry.authHeaderValue;
203
+ }
204
+
205
+ /**
206
+ * the same origin, so a credential never crosses to another host or protocol, and the target path
207
+ * is the registry's path or nested under it: `/npm/` covers `/npm/internal/` but not `/npm-private/`.
208
+ */
209
+ function covers(registry, target) {
210
+ if (registry.origin !== target.origin) return false;
211
+ return withTrailingSlash(target.pathname).startsWith(withTrailingSlash(registry.pathname));
212
+ }
213
+ function withTrailingSlash(path) {
214
+ return path.endsWith('/') ? path : `${path}/`;
215
+ }
216
+ function toUrl(uri) {
217
+ try {
218
+ return new URL(uri);
219
+ } catch {
220
+ return undefined;
221
+ }
222
+ }
223
+
224
+ /**
225
+ * the case of the scheme and host and a trailing slash don't make a different registry. the path
226
+ * does, in its exact case, like in any url.
227
+ */
228
+ function isSameRegistry(a, b) {
229
+ const normalize = uri => {
230
+ const url = toUrl(uri);
231
+ return (url ? `${url.origin}${url.pathname}` : uri).replace(/\/+$/, '');
232
+ };
233
+ return normalize(a) === normalize(b);
234
+ }
235
+
236
+ //# sourceMappingURL=published-versions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_semver","data","require","_lodash","_scope","_bitError","_toolboxPromise","_harmonyModules","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","MAX_PUBLISHED_VERSIONS_TO_SKIP","exports","REGISTRY_REQUEST_TIMEOUT","getNextVersion","version","semver","SemVer","preReleaseId","prerelease","undefined","releaseType","inc","findVersionNotPublished","candidate","isPublished","packageName","registryUrl","versionToTag","skipped","BitError","skipPublishedVersions","candidates","resolved","pMapPool","concurrency","concurrentFetchLimit","createIsVersionPublished","registries","logger","getFetcher","memoize","getFetcherWithAgent","registry","getRegistryForPackage","url","uri","replace","encodeURIComponent","fetcher","response","headers","authHeaderValue","authorization","signal","AbortSignal","timeout","text","catch","ok","status","debug","err","message","scope","startsWith","slice","split","byScope","scopes","defaultRegistry","isSameRegistry","findAuthHeaderForUrl","target","toUrl","covering","values","flatMap","covers","sort","a","b","pathname","origin","withTrailingSlash","path","endsWith","URL","normalize"],"sources":["published-versions.ts"],"sourcesContent":["import { SemVer } from 'semver';\nimport { memoize } from 'lodash';\nimport { getFetcherWithAgent } from '@teambit/scope.network';\nimport { BitError } from '@teambit/bit-error';\nimport { pMapPool } from '@teambit/toolbox.promise.map-pool';\nimport { concurrentFetchLimit } from '@teambit/harmony.modules.concurrency';\nimport type { Registries, Registry } from '@teambit/pkg.entities.registry';\n\n/**\n * npm publish runs as the last task of the tag build pipeline, which is *before* the export (see\n * `bit ci merge`). when an export fails after the packages were already published, the registry is\n * left ahead of both the remote scope and .bitmap. the next run then computes the exact same\n * version again, and npm rejects it with \"You cannot publish over the previously published\n * versions\" (E403), so the release stays stuck until someone bumps the CI config by hand with\n * `--increment-by`.\n *\n * skipping the versions the registry already has lets that retry pick the next free version on its\n * own. it's done per-component, so unlike `--increment-by` it only bumps the components that\n * actually collide.\n */\n\nexport type IsVersionPublished = (packageName: string, version: string, registryUrl?: string) => Promise<boolean>;\n\n/**\n * a collision means a previous run published this component and then failed, so the number of\n * versions to skip is the number of such runs. anything beyond this is not a stuck release but a\n * broken setup (e.g. the wrong package name), and hammering the registry won't fix it.\n */\nexport const MAX_PUBLISHED_VERSIONS_TO_SKIP = 20;\n\nconst REGISTRY_REQUEST_TIMEOUT = 10000;\n\nexport type VersionCandidate = {\n /** component id, used to report back which versions changed */\n id: string;\n packageName: string;\n version: string;\n /**\n * the registry `npm publish` will target for this component, when it is not the one configured\n * for the package's scope. asking any other registry would say \"free\" about a taken version.\n */\n registryUrl?: string;\n};\n\nexport type SkippedVersion = VersionCandidate & { versionToTag: string };\n\n/**\n * the version right after `version`, keeping its pre-release identifier when it has one.\n * e.g. \"1.2.3\" => \"1.2.4\", \"1.2.3-dev.1\" => \"1.2.3-dev.2\".\n */\nexport function getNextVersion(version: string): string {\n const semver = new SemVer(version);\n const preReleaseId = typeof semver.prerelease[0] === 'string' ? semver.prerelease[0] : undefined;\n const releaseType = semver.prerelease.length ? 'prerelease' : 'patch';\n return semver.inc(releaseType, preReleaseId).version;\n}\n\n/**\n * return the candidate's version, or - when it was already published to the registry - the next\n * version that wasn't.\n */\nexport async function findVersionNotPublished(\n candidate: VersionCandidate,\n isPublished: IsVersionPublished\n): Promise<string> {\n const { packageName, version, registryUrl } = candidate;\n let versionToTag = version;\n for (let skipped = 0; skipped <= MAX_PUBLISHED_VERSIONS_TO_SKIP; skipped += 1) {\n if (!(await isPublished(packageName, versionToTag, registryUrl))) return versionToTag;\n versionToTag = getNextVersion(versionToTag);\n }\n throw new BitError(\n `unable to find an unpublished version for ${packageName}, the ${MAX_PUBLISHED_VERSIONS_TO_SKIP} versions following ${version} are all in the registry.\nthis is unlikely to be a stuck release. make sure the package name is correct and that the registry is not returning stale data`\n );\n}\n\n/**\n * resolve the version to tag for each candidate.\n *\n * every candidate is checked, rather than a sample of them: a publish that failed midway (npm rate\n * limiting is the usual reason) leaves only *some* of the components published, so there is no\n * component whose answer can be taken to hold for the rest. it is cheap enough to be thorough -\n * measured against registry.npmjs.org, 400 checks take ~11s, against a merge job that runs for\n * close to an hour.\n *\n * @returns the candidates whose version changed.\n */\nexport async function skipPublishedVersions(\n candidates: VersionCandidate[],\n isPublished: IsVersionPublished\n): Promise<SkippedVersion[]> {\n const resolved = await pMapPool(\n candidates,\n async (candidate: VersionCandidate): Promise<SkippedVersion> => ({\n ...candidate,\n versionToTag: await findVersionNotPublished(candidate, isPublished),\n }),\n { concurrency: concurrentFetchLimit() }\n );\n return resolved.filter((candidate) => candidate.versionToTag !== candidate.version);\n}\n\n/**\n * ask the registry for one specific version rather than for the package document. the packument of\n * a component that publishes on every snap is tens of megabytes (over 20MB for some of bit's own\n * components), while this endpoint answers the same question in a few kilobytes - or 29 bytes for\n * the \"not published\" answer, which is the common one.\n *\n * the request goes through the same agent bit uses elsewhere, so a configured proxy, CA, client\n * certificate and strict-ssl setting all apply. without them the request would fail, and a failure\n * reads here as \"not published\" - it would quietly defeat the check rather than report anything.\n */\nexport function createIsVersionPublished(\n registries: Registries,\n logger: { debug: (message: string) => void }\n): IsVersionPublished {\n // one fetcher per registry: building it reads bit's global config, no need to redo that per request\n const getFetcher = memoize(getFetcherWithAgent);\n\n return async (packageName: string, version: string, registryUrl?: string) => {\n const registry = getRegistryForPackage(registries, packageName, registryUrl);\n const url = `${registry.uri.replace(/\\/+$/, '')}/${packageName.replace('/', '%2f')}/${encodeURIComponent(version)}`;\n try {\n const fetcher = await getFetcher(registry.uri);\n const response = await fetcher(url, {\n headers: registry.authHeaderValue ? { authorization: registry.authHeaderValue } : {},\n signal: AbortSignal.timeout(REGISTRY_REQUEST_TIMEOUT),\n });\n await response.text().catch(() => undefined); // release the connection, the body is not needed\n if (response.ok) return true;\n if (response.status !== 404) {\n // an unreachable or unauthenticated registry can't tell us the version is taken. treated as\n // \"not published\" on purpose: only a positive answer is allowed to move a version forward.\n logger.debug(`got ${response.status} when asking ${url} whether ${version} is published`);\n }\n return false;\n } catch (err: any) {\n logger.debug(`failed asking ${url} whether ${version} is published: ${err.message}`);\n return false;\n }\n };\n}\n\n/**\n * `registryUrl` is where the publish is actually going for this component, so it wins over the\n * registry configured for the package's scope.\n */\nexport function getRegistryForPackage(\n registries: Registries,\n packageName: string,\n registryUrl?: string\n): Pick<Registry, 'uri' | 'authHeaderValue'> {\n const scope = packageName.startsWith('@') ? packageName.slice(1).split('/')[0] : undefined;\n const byScope = (scope && registries.scopes[scope]) || registries.defaultRegistry;\n if (!registryUrl || isSameRegistry(registryUrl, byScope.uri)) return byScope;\n return { uri: registryUrl, authHeaderValue: findAuthHeaderForUrl(registries, registryUrl) };\n}\n\n/**\n * npmrc keys its credentials by url prefix (`//host/path/:_authToken`), and bit's registry model\n * carries them on the entries it knows about. so the credential for an explicit publish registry is\n * the one from the entry that covers its url: the very same url, or the closest one above it.\n *\n * a url no entry covers is probed without authorization. a private version then reads as free,\n * which leaves the publish to fail exactly as it does without this check - never a wrong version.\n */\nfunction findAuthHeaderForUrl(registries: Registries, registryUrl: string): string | undefined {\n const target = toUrl(registryUrl);\n if (!target) return undefined;\n const covering = [registries.defaultRegistry, ...Object.values(registries.scopes)]\n .flatMap((registry) => {\n const uri = registry.authHeaderValue ? toUrl(registry.uri) : undefined;\n return uri && covers(uri, target) ? [{ registry, uri }] : [];\n })\n // the most specific path wins, the way npm resolves the nearest matching npmrc key\n .sort((a, b) => b.uri.pathname.length - a.uri.pathname.length);\n return covering[0]?.registry.authHeaderValue;\n}\n\n/**\n * the same origin, so a credential never crosses to another host or protocol, and the target path\n * is the registry's path or nested under it: `/npm/` covers `/npm/internal/` but not `/npm-private/`.\n */\nfunction covers(registry: URL, target: URL): boolean {\n if (registry.origin !== target.origin) return false;\n return withTrailingSlash(target.pathname).startsWith(withTrailingSlash(registry.pathname));\n}\n\nfunction withTrailingSlash(path: string): string {\n return path.endsWith('/') ? path : `${path}/`;\n}\n\nfunction toUrl(uri: string): URL | undefined {\n try {\n return new URL(uri);\n } catch {\n return undefined;\n }\n}\n\n/**\n * the case of the scheme and host and a trailing slash don't make a different registry. the path\n * does, in its exact case, like in any url.\n */\nfunction isSameRegistry(a: string, b: string): boolean {\n const normalize = (uri: string) => {\n const url = toUrl(uri);\n return (url ? `${url.origin}${url.pathname}` : uri).replace(/\\/+$/, '');\n };\n return normalize(a) === normalize(b);\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,I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AACA;AACA,SAASmD,cAAcA,CAACS,CAAS,EAAEC,CAAS,EAAW;EACrD,MAAMO,SAAS,GAAI1C,GAAW,IAAK;IACjC,MAAMD,GAAG,GAAG6B,KAAK,CAAC5B,GAAG,CAAC;IACtB,OAAO,CAACD,GAAG,GAAG,GAAGA,GAAG,CAACsC,MAAM,GAAGtC,GAAG,CAACqC,QAAQ,EAAE,GAAGpC,GAAG,EAAEC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;EACzE,CAAC;EACD,OAAOyC,SAAS,CAACR,CAAC,CAAC,KAAKQ,SAAS,CAACP,CAAC,CAAC;AACtC","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+
3
+ function _chai() {
4
+ const data = require("chai");
5
+ _chai = function () {
6
+ return data;
7
+ };
8
+ return data;
9
+ }
10
+ function _pkgEntities() {
11
+ const data = require("@teambit/pkg.entities.registry");
12
+ _pkgEntities = function () {
13
+ return data;
14
+ };
15
+ return data;
16
+ }
17
+ function _publishedVersions() {
18
+ const data = require("./published-versions");
19
+ _publishedVersions = function () {
20
+ return data;
21
+ };
22
+ return data;
23
+ }
24
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
25
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
26
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
27
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
28
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
29
+ function candidate(id) {
30
+ return {
31
+ id,
32
+ packageName: `@teambit/${id}`,
33
+ version: '1.0.0'
34
+ };
35
+ }
36
+ const candidatesOf = count => Array.from({
37
+ length: count
38
+ }, (_, index) => candidate(`comp${index}`));
39
+ describe('published-versions', () => {
40
+ describe('getNextVersion', () => {
41
+ it('should bump the patch of a release version', () => {
42
+ (0, _chai().expect)((0, _publishedVersions().getNextVersion)('1.2.3')).to.equal('1.2.4');
43
+ });
44
+ it('should keep the pre-release identifier of a pre-release version', () => {
45
+ (0, _chai().expect)((0, _publishedVersions().getNextVersion)('1.2.3-dev.1')).to.equal('1.2.3-dev.2');
46
+ });
47
+ it('should bump a numeric pre-release', () => {
48
+ (0, _chai().expect)((0, _publishedVersions().getNextVersion)('1.2.3-0')).to.equal('1.2.3-1');
49
+ });
50
+ });
51
+ describe('findVersionNotPublished', () => {
52
+ const findVersion = (version, published) => (0, _publishedVersions().findVersionNotPublished)(_objectSpread(_objectSpread({}, candidate('some-comp')), {}, {
53
+ version
54
+ }), async (_pkgName, ver) => published.includes(ver));
55
+ it('should return the version as is when it is not in the registry', async () => {
56
+ (0, _chai().expect)(await findVersion('1.2.3', ['1.2.2'])).to.equal('1.2.3');
57
+ });
58
+ it('should skip a version that is in the registry, querying each candidate once', async () => {
59
+ const queried = [];
60
+ const result = await (0, _publishedVersions().findVersionNotPublished)(_objectSpread(_objectSpread({}, candidate('some-comp')), {}, {
61
+ version: '1.2.3'
62
+ }), async (_, ver) => {
63
+ queried.push(ver);
64
+ return ver === '1.2.3';
65
+ });
66
+ (0, _chai().expect)(result).to.equal('1.2.4');
67
+ (0, _chai().expect)(queried).to.deep.equal(['1.2.3', '1.2.4']);
68
+ });
69
+ it('should skip multiple consecutive versions that are in the registry', async () => {
70
+ (0, _chai().expect)(await findVersion('1.2.3', ['1.2.3', '1.2.4', '1.2.5'])).to.equal('1.2.6');
71
+ });
72
+ it('should keep the pre-release identifier when skipping', async () => {
73
+ (0, _chai().expect)(await findVersion('1.2.3-dev.1', ['1.2.3-dev.1'])).to.equal('1.2.3-dev.2');
74
+ });
75
+ it('should throw when too many consecutive versions are in the registry', async () => {
76
+ const published = Array.from({
77
+ length: _publishedVersions().MAX_PUBLISHED_VERSIONS_TO_SKIP + 1
78
+ }, (_, index) => `1.2.${3 + index}`);
79
+ let error;
80
+ try {
81
+ await findVersion('1.2.3', published);
82
+ } catch (err) {
83
+ error = err;
84
+ }
85
+ (0, _chai().expect)(error?.message).to.have.string('unable to find an unpublished version');
86
+ });
87
+ });
88
+ describe('skipPublishedVersions', () => {
89
+ it('should query every candidate, so a partial publish is not missed', async () => {
90
+ const queried = new Set();
91
+ // npm rate-limited the previous run halfway through, so only one component got published
92
+ const skipped = await (0, _publishedVersions().skipPublishedVersions)(candidatesOf(50), async (packageName, version) => {
93
+ queried.add(packageName);
94
+ return packageName === '@teambit/comp49' && version === '1.0.0';
95
+ });
96
+ (0, _chai().expect)(queried.size).to.equal(50);
97
+ (0, _chai().expect)(skipped.map(({
98
+ id,
99
+ versionToTag
100
+ }) => [id, versionToTag])).to.deep.equal([['comp49', '1.0.1']]);
101
+ });
102
+ it('should skip every component when the whole run collided', async () => {
103
+ const skipped = await (0, _publishedVersions().skipPublishedVersions)(candidatesOf(50), async (_packageName, version) => version === '1.0.0');
104
+ (0, _chai().expect)(skipped.length).to.equal(50);
105
+ (0, _chai().expect)(skipped[0]).to.include({
106
+ id: 'comp0',
107
+ versionToTag: '1.0.1'
108
+ });
109
+ });
110
+ it('should report nothing when no version is in the registry', async () => {
111
+ const skipped = await (0, _publishedVersions().skipPublishedVersions)(candidatesOf(10), async () => false);
112
+ (0, _chai().expect)(skipped).to.deep.equal([]);
113
+ });
114
+ it('should ask the registry the component publishes to, not the scope default', async () => {
115
+ const asked = [];
116
+ const candidates = [_objectSpread(_objectSpread({}, candidate('comp0')), {}, {
117
+ registryUrl: 'https://my-registry.example.com'
118
+ }), candidate('comp1')];
119
+ await (0, _publishedVersions().skipPublishedVersions)(candidates, async (_packageName, _version, registryUrl) => {
120
+ asked.push(registryUrl);
121
+ return false;
122
+ });
123
+ (0, _chai().expect)(asked).to.have.members(['https://my-registry.example.com', undefined]);
124
+ });
125
+ });
126
+ describe('getRegistryForPackage', () => {
127
+ const registries = new (_pkgEntities().Registries)(new (_pkgEntities().Registry)('https://registry.npmjs.org/', true, 'Bearer default-token'), {
128
+ teambit: new (_pkgEntities().Registry)('https://node.bit.cloud/', true, 'Bearer bit-token'),
129
+ acme: new (_pkgEntities().Registry)('https://private.example.com/npm/', true, 'Bearer acme-token')
130
+ });
131
+ it('should use the registry of the package scope', () => {
132
+ (0, _chai().expect)((0, _publishedVersions().getRegistryForPackage)(registries, '@teambit/some-comp').authHeaderValue).to.equal('Bearer bit-token');
133
+ });
134
+ it('should fall back to the default registry for an unmapped scope', () => {
135
+ (0, _chai().expect)((0, _publishedVersions().getRegistryForPackage)(registries, '@other/some-comp').authHeaderValue).to.equal('Bearer default-token');
136
+ });
137
+ it('should fall back to the default registry for an unscoped package', () => {
138
+ (0, _chai().expect)((0, _publishedVersions().getRegistryForPackage)(registries, 'some-comp').uri).to.equal('https://registry.npmjs.org/');
139
+ });
140
+ it('should prefer an explicit publish registry over the scope one', () => {
141
+ const registry = (0, _publishedVersions().getRegistryForPackage)(registries, '@teambit/some-comp', 'https://private.example.com/npm/');
142
+ (0, _chai().expect)(registry.uri).to.equal('https://private.example.com/npm/');
143
+ (0, _chai().expect)(registry.authHeaderValue).to.equal('Bearer acme-token');
144
+ });
145
+ it('should reuse the credentials of a configured registry that covers the url', () => {
146
+ // npmrc keys credentials by url prefix, so the /npm/ entry covers /npm/internal/ too
147
+ const registry = (0, _publishedVersions().getRegistryForPackage)(registries, '@teambit/x', 'https://private.example.com/npm/internal/');
148
+ (0, _chai().expect)(registry.authHeaderValue).to.equal('Bearer acme-token');
149
+ });
150
+ it('should not borrow credentials from a different host', () => {
151
+ const registry = (0, _publishedVersions().getRegistryForPackage)(registries, '@teambit/x', 'https://elsewhere.example.com/npm/');
152
+ (0, _chai().expect)(registry.uri).to.equal('https://elsewhere.example.com/npm/');
153
+ (0, _chai().expect)(registry.authHeaderValue).to.equal(undefined);
154
+ });
155
+ it('should not borrow credentials from a sibling path that only shares a prefix', () => {
156
+ const registry = (0, _publishedVersions().getRegistryForPackage)(registries, '@teambit/x', 'https://private.example.com/npm-private/');
157
+ (0, _chai().expect)(registry.authHeaderValue).to.equal(undefined);
158
+ });
159
+ it('should not send credentials over another protocol', () => {
160
+ const registry = (0, _publishedVersions().getRegistryForPackage)(registries, '@teambit/x', 'http://private.example.com/npm/');
161
+ (0, _chai().expect)(registry.authHeaderValue).to.equal(undefined);
162
+ });
163
+ it('should treat a registry path as case-sensitive, unlike the host', () => {
164
+ (0, _chai().expect)((0, _publishedVersions().getRegistryForPackage)(registries, '@teambit/x', 'https://PRIVATE.example.com/npm').authHeaderValue).to.equal('Bearer acme-token');
165
+ const otherPath = (0, _publishedVersions().getRegistryForPackage)(registries, '@teambit/x', 'https://private.example.com/NPM/');
166
+ (0, _chai().expect)(otherPath.uri).to.equal('https://private.example.com/NPM/');
167
+ (0, _chai().expect)(otherPath.authHeaderValue).to.equal(undefined);
168
+ });
169
+ });
170
+ });
171
+
172
+ //# sourceMappingURL=published-versions.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_chai","data","require","_pkgEntities","_publishedVersions","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","candidate","id","packageName","version","candidatesOf","count","Array","from","_","index","describe","it","expect","getNextVersion","to","equal","findVersion","published","findVersionNotPublished","_pkgName","ver","includes","queried","result","deep","MAX_PUBLISHED_VERSIONS_TO_SKIP","error","err","message","have","string","Set","skipped","skipPublishedVersions","add","size","map","versionToTag","_packageName","include","asked","candidates","registryUrl","_version","members","undefined","registries","Registries","Registry","teambit","acme","getRegistryForPackage","authHeaderValue","uri","registry","otherPath"],"sources":["published-versions.spec.ts"],"sourcesContent":["import { expect } from 'chai';\nimport { Registries, Registry } from '@teambit/pkg.entities.registry';\nimport type { VersionCandidate } from './published-versions';\nimport {\n MAX_PUBLISHED_VERSIONS_TO_SKIP,\n findVersionNotPublished,\n getNextVersion,\n getRegistryForPackage,\n skipPublishedVersions,\n} from './published-versions';\n\nfunction candidate(id: string): VersionCandidate {\n return { id, packageName: `@teambit/${id}`, version: '1.0.0' };\n}\n\nconst candidatesOf = (count: number): VersionCandidate[] =>\n Array.from({ length: count }, (_, index) => candidate(`comp${index}`));\n\ndescribe('published-versions', () => {\n describe('getNextVersion', () => {\n it('should bump the patch of a release version', () => {\n expect(getNextVersion('1.2.3')).to.equal('1.2.4');\n });\n it('should keep the pre-release identifier of a pre-release version', () => {\n expect(getNextVersion('1.2.3-dev.1')).to.equal('1.2.3-dev.2');\n });\n it('should bump a numeric pre-release', () => {\n expect(getNextVersion('1.2.3-0')).to.equal('1.2.3-1');\n });\n });\n\n describe('findVersionNotPublished', () => {\n const findVersion = (version: string, published: string[]) =>\n findVersionNotPublished({ ...candidate('some-comp'), version }, async (_pkgName, ver) => published.includes(ver));\n\n it('should return the version as is when it is not in the registry', async () => {\n expect(await findVersion('1.2.3', ['1.2.2'])).to.equal('1.2.3');\n });\n it('should skip a version that is in the registry, querying each candidate once', async () => {\n const queried: string[] = [];\n const result = await findVersionNotPublished({ ...candidate('some-comp'), version: '1.2.3' }, async (_, ver) => {\n queried.push(ver);\n return ver === '1.2.3';\n });\n expect(result).to.equal('1.2.4');\n expect(queried).to.deep.equal(['1.2.3', '1.2.4']);\n });\n it('should skip multiple consecutive versions that are in the registry', async () => {\n expect(await findVersion('1.2.3', ['1.2.3', '1.2.4', '1.2.5'])).to.equal('1.2.6');\n });\n it('should keep the pre-release identifier when skipping', async () => {\n expect(await findVersion('1.2.3-dev.1', ['1.2.3-dev.1'])).to.equal('1.2.3-dev.2');\n });\n it('should throw when too many consecutive versions are in the registry', async () => {\n const published = Array.from({ length: MAX_PUBLISHED_VERSIONS_TO_SKIP + 1 }, (_, index) => `1.2.${3 + index}`);\n let error: Error | undefined;\n try {\n await findVersion('1.2.3', published);\n } catch (err: any) {\n error = err;\n }\n expect(error?.message).to.have.string('unable to find an unpublished version');\n });\n });\n\n describe('skipPublishedVersions', () => {\n it('should query every candidate, so a partial publish is not missed', async () => {\n const queried = new Set<string>();\n // npm rate-limited the previous run halfway through, so only one component got published\n const skipped = await skipPublishedVersions(candidatesOf(50), async (packageName, version) => {\n queried.add(packageName);\n return packageName === '@teambit/comp49' && version === '1.0.0';\n });\n expect(queried.size).to.equal(50);\n expect(skipped.map(({ id, versionToTag }) => [id, versionToTag])).to.deep.equal([['comp49', '1.0.1']]);\n });\n\n it('should skip every component when the whole run collided', async () => {\n const skipped = await skipPublishedVersions(\n candidatesOf(50),\n async (_packageName, version) => version === '1.0.0'\n );\n expect(skipped.length).to.equal(50);\n expect(skipped[0]).to.include({ id: 'comp0', versionToTag: '1.0.1' });\n });\n\n it('should report nothing when no version is in the registry', async () => {\n const skipped = await skipPublishedVersions(candidatesOf(10), async () => false);\n expect(skipped).to.deep.equal([]);\n });\n\n it('should ask the registry the component publishes to, not the scope default', async () => {\n const asked: (string | undefined)[] = [];\n const candidates = [\n { ...candidate('comp0'), registryUrl: 'https://my-registry.example.com' },\n candidate('comp1'),\n ];\n await skipPublishedVersions(candidates, async (_packageName, _version, registryUrl) => {\n asked.push(registryUrl);\n return false;\n });\n expect(asked).to.have.members(['https://my-registry.example.com', undefined]);\n });\n });\n\n describe('getRegistryForPackage', () => {\n const registries = new Registries(new Registry('https://registry.npmjs.org/', true, 'Bearer default-token'), {\n teambit: new Registry('https://node.bit.cloud/', true, 'Bearer bit-token'),\n acme: new Registry('https://private.example.com/npm/', true, 'Bearer acme-token'),\n });\n\n it('should use the registry of the package scope', () => {\n expect(getRegistryForPackage(registries, '@teambit/some-comp').authHeaderValue).to.equal('Bearer bit-token');\n });\n it('should fall back to the default registry for an unmapped scope', () => {\n expect(getRegistryForPackage(registries, '@other/some-comp').authHeaderValue).to.equal('Bearer default-token');\n });\n it('should fall back to the default registry for an unscoped package', () => {\n expect(getRegistryForPackage(registries, 'some-comp').uri).to.equal('https://registry.npmjs.org/');\n });\n it('should prefer an explicit publish registry over the scope one', () => {\n const registry = getRegistryForPackage(registries, '@teambit/some-comp', 'https://private.example.com/npm/');\n expect(registry.uri).to.equal('https://private.example.com/npm/');\n expect(registry.authHeaderValue).to.equal('Bearer acme-token');\n });\n it('should reuse the credentials of a configured registry that covers the url', () => {\n // npmrc keys credentials by url prefix, so the /npm/ entry covers /npm/internal/ too\n const registry = getRegistryForPackage(registries, '@teambit/x', 'https://private.example.com/npm/internal/');\n expect(registry.authHeaderValue).to.equal('Bearer acme-token');\n });\n it('should not borrow credentials from a different host', () => {\n const registry = getRegistryForPackage(registries, '@teambit/x', 'https://elsewhere.example.com/npm/');\n expect(registry.uri).to.equal('https://elsewhere.example.com/npm/');\n expect(registry.authHeaderValue).to.equal(undefined);\n });\n it('should not borrow credentials from a sibling path that only shares a prefix', () => {\n const registry = getRegistryForPackage(registries, '@teambit/x', 'https://private.example.com/npm-private/');\n expect(registry.authHeaderValue).to.equal(undefined);\n });\n it('should not send credentials over another protocol', () => {\n const registry = getRegistryForPackage(registries, '@teambit/x', 'http://private.example.com/npm/');\n expect(registry.authHeaderValue).to.equal(undefined);\n });\n it('should treat a registry path as case-sensitive, unlike the host', () => {\n expect(\n getRegistryForPackage(registries, '@teambit/x', 'https://PRIVATE.example.com/npm').authHeaderValue\n ).to.equal('Bearer acme-token');\n const otherPath = getRegistryForPackage(registries, '@teambit/x', 'https://private.example.com/NPM/');\n expect(otherPath.uri).to.equal('https://private.example.com/NPM/');\n expect(otherPath.authHeaderValue).to.equal(undefined);\n });\n });\n});\n"],"mappings":";;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,aAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,mBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,kBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAM8B,SAAAI,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,QAAAA,CAAA,OAAAF,OAAA,CAAAI,MAAA,CAAAD,CAAA,OAA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AAM,EAAC2C,SAAS,CAACF,GAAG,CAAC,CAACvC,EAAE,CAACC,KAAK,CAAC,kCAAkC,CAAC;MAClE,IAAAH,cAAM,EAAC2C,SAAS,CAACH,eAAe,CAAC,CAACtC,EAAE,CAACC,KAAK,CAAC8B,SAAS,CAAC;IACvD,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -113,7 +113,7 @@ export declare class SnappingMain {
113
113
  * with a valid semver to that version.
114
114
  * tag can be done only on main, not on a lane.
115
115
  */
116
- tag({ ids, message, version, editor, versionsFile, snapped, unmerged, releaseType, autoTagReleaseType, preReleaseId, ignoreIssues, ignoreNewestVersion, skipTests, skipTasks, skipAutoTag, build, unmodified, soft, persist, ignoreBuildErrors, rebuildDepsGraph, noLockDeps, incrementBy, disableTagAndSnapPipelines, failFast, detachHead, overrideHead, loose, }: {
116
+ tag({ ids, message, version, editor, versionsFile, snapped, unmerged, releaseType, autoTagReleaseType, preReleaseId, ignoreIssues, ignoreNewestVersion, skipTests, skipTasks, skipAutoTag, build, unmodified, soft, persist, ignoreBuildErrors, rebuildDepsGraph, noLockDeps, incrementBy, skipPublishedVersions, disableTagAndSnapPipelines, failFast, detachHead, overrideHead, loose, }: {
117
117
  ids?: string[];
118
118
  all?: boolean | string;
119
119
  snapped?: boolean;
@@ -376,6 +376,7 @@ class SnappingMain {
376
376
  rebuildDepsGraph,
377
377
  noLockDeps = false,
378
378
  incrementBy = 1,
379
+ skipPublishedVersions = false,
379
380
  disableTagAndSnapPipelines = false,
380
381
  failFast = false,
381
382
  detachHead,
@@ -426,6 +427,7 @@ class SnappingMain {
426
427
  rebuildDepsGraph,
427
428
  noLockDeps,
428
429
  incrementBy,
430
+ skipPublishedVersions,
429
431
  packageManagerConfigRootDir: this.workspace.path,
430
432
  exitOnFirstFailedTask: failFast,
431
433
  detachHead,