run402 4.109.0 → 4.109.1
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/lib/deploy-v2.mjs +46 -5
- package/lib/sdk-errors.mjs +8 -1
- package/package.json +1 -1
- package/sdk/dist/errors.d.ts +1 -1
- package/sdk/dist/errors.d.ts.map +1 -1
- package/sdk/dist/errors.js.map +1 -1
- package/sdk/dist/index.d.ts +1 -0
- package/sdk/dist/index.d.ts.map +1 -1
- package/sdk/dist/index.js.map +1 -1
- package/sdk/dist/namespaces/deploy.d.ts.map +1 -1
- package/sdk/dist/namespaces/deploy.js +79 -21
- package/sdk/dist/namespaces/deploy.js.map +1 -1
- package/sdk/dist/namespaces/site-removal-summary.d.ts +48 -0
- package/sdk/dist/namespaces/site-removal-summary.d.ts.map +1 -0
- package/sdk/dist/namespaces/site-removal-summary.js +107 -0
- package/sdk/dist/namespaces/site-removal-summary.js.map +1 -0
- package/vault-surface.json +1 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client-side breakdown of the paths a `DESTRUCTIVE_SITE_BULK_REMOVAL`
|
|
3
|
+
* warning lists in `affected`.
|
|
4
|
+
*
|
|
5
|
+
* The gateway counts every removed static path toward its bulk-removal
|
|
6
|
+
* threshold. A framework rebuild renames every content-hashed bundle
|
|
7
|
+
* (`_astro/Foo.Ds5BwtTY.js` → `_astro/Foo.<newhash>.js`), so a routine
|
|
8
|
+
* redeploy can trip the warning without removing a single page. This
|
|
9
|
+
* summary lets a reviewer tell the two cases apart without diffing
|
|
10
|
+
* releases by hand. It is a heuristic and never changes whether the
|
|
11
|
+
* warning blocks; the gateway stays authoritative.
|
|
12
|
+
*/
|
|
13
|
+
import type { WarningEntry } from "./deploy.types.js";
|
|
14
|
+
export declare const SITE_BULK_REMOVAL_WARNING_CODE = "DESTRUCTIVE_SITE_BULK_REMOVAL";
|
|
15
|
+
export interface SiteRemovalSummary {
|
|
16
|
+
/** Number of removed paths the warning listed. */
|
|
17
|
+
total: number;
|
|
18
|
+
/** Removed `.html` / `.htm` files — pages that stop being served. */
|
|
19
|
+
pages: number;
|
|
20
|
+
/** Removed files whose name carries a build content hash (bundler output). */
|
|
21
|
+
content_hashed_build_assets: number;
|
|
22
|
+
/** Removed files that are neither pages nor content-hashed build assets. */
|
|
23
|
+
other: number;
|
|
24
|
+
/** True when every removed path is a content-hashed build asset. */
|
|
25
|
+
only_content_hashed_build_assets: boolean;
|
|
26
|
+
/** Removed path count per top-level directory (`"."` for root files). */
|
|
27
|
+
by_top_level_dir: Record<string, number>;
|
|
28
|
+
/** Up to 20 removed page paths. */
|
|
29
|
+
page_paths: string[];
|
|
30
|
+
/** Up to 20 removed paths that are neither pages nor hashed assets. */
|
|
31
|
+
other_paths: string[];
|
|
32
|
+
confidence: "heuristic";
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A content hash is a `.`- or `-`-separated basename segment of at least
|
|
36
|
+
* eight `[A-Za-z0-9_]` characters that contains a digit or mixes upper
|
|
37
|
+
* and lower case (`Ds5BwtTY`, `CzEebLVq`, `a3f9c2e1`). Plain words such as
|
|
38
|
+
* `component` or `profile` do not qualify.
|
|
39
|
+
*/
|
|
40
|
+
export declare function isContentHashedPath(path: string): boolean;
|
|
41
|
+
export declare function summarizeSiteRemoval(paths: readonly string[]): SiteRemovalSummary;
|
|
42
|
+
/**
|
|
43
|
+
* Adds `details.removed_paths_summary` to each bulk-removal warning that
|
|
44
|
+
* lists its paths and does not already carry a summary. Other warnings
|
|
45
|
+
* pass through untouched.
|
|
46
|
+
*/
|
|
47
|
+
export declare function withSiteRemovalSummaries(warnings: WarningEntry[]): WarningEntry[];
|
|
48
|
+
//# sourceMappingURL=site-removal-summary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site-removal-summary.d.ts","sourceRoot":"","sources":["../../src/namespaces/site-removal-summary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,eAAO,MAAM,8BAA8B,kCAAkC,CAAC;AAK9E,MAAM,WAAW,kBAAkB;IACjC,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,KAAK,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,2BAA2B,EAAE,MAAM,CAAC;IACpC,4EAA4E;IAC5E,KAAK,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,gCAAgC,EAAE,OAAO,CAAC;IAC1C,yEAAyE;IACzE,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,mCAAmC;IACnC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,uEAAuE;IACvE,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,EAAE,WAAW,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAWzD;AAYD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,kBAAkB,CA+BjF;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CAgBjF"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client-side breakdown of the paths a `DESTRUCTIVE_SITE_BULK_REMOVAL`
|
|
3
|
+
* warning lists in `affected`.
|
|
4
|
+
*
|
|
5
|
+
* The gateway counts every removed static path toward its bulk-removal
|
|
6
|
+
* threshold. A framework rebuild renames every content-hashed bundle
|
|
7
|
+
* (`_astro/Foo.Ds5BwtTY.js` → `_astro/Foo.<newhash>.js`), so a routine
|
|
8
|
+
* redeploy can trip the warning without removing a single page. This
|
|
9
|
+
* summary lets a reviewer tell the two cases apart without diffing
|
|
10
|
+
* releases by hand. It is a heuristic and never changes whether the
|
|
11
|
+
* warning blocks; the gateway stays authoritative.
|
|
12
|
+
*/
|
|
13
|
+
export const SITE_BULK_REMOVAL_WARNING_CODE = "DESTRUCTIVE_SITE_BULK_REMOVAL";
|
|
14
|
+
const PAGE_PATH_SAMPLE_LIMIT = 20;
|
|
15
|
+
const OTHER_PATH_SAMPLE_LIMIT = 20;
|
|
16
|
+
/**
|
|
17
|
+
* A content hash is a `.`- or `-`-separated basename segment of at least
|
|
18
|
+
* eight `[A-Za-z0-9_]` characters that contains a digit or mixes upper
|
|
19
|
+
* and lower case (`Ds5BwtTY`, `CzEebLVq`, `a3f9c2e1`). Plain words such as
|
|
20
|
+
* `component` or `profile` do not qualify.
|
|
21
|
+
*/
|
|
22
|
+
export function isContentHashedPath(path) {
|
|
23
|
+
const base = path.slice(path.lastIndexOf("/") + 1);
|
|
24
|
+
const dot = base.lastIndexOf(".");
|
|
25
|
+
if (dot <= 0)
|
|
26
|
+
return false;
|
|
27
|
+
const stem = base.slice(0, dot);
|
|
28
|
+
if (/\.html?$/i.test(base))
|
|
29
|
+
return false;
|
|
30
|
+
for (const segment of stem.split(/[.-]/).slice(1)) {
|
|
31
|
+
if (!/^[A-Za-z0-9_]{8,}$/.test(segment))
|
|
32
|
+
continue;
|
|
33
|
+
if (/\d/.test(segment) || (/[a-z]/.test(segment) && /[A-Z]/.test(segment)))
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
function isPagePath(path) {
|
|
39
|
+
return /\.html?$/i.test(path);
|
|
40
|
+
}
|
|
41
|
+
function topLevelDir(path) {
|
|
42
|
+
const trimmed = path.replace(/^\/+/, "");
|
|
43
|
+
const slash = trimmed.indexOf("/");
|
|
44
|
+
return slash === -1 ? "." : trimmed.slice(0, slash);
|
|
45
|
+
}
|
|
46
|
+
export function summarizeSiteRemoval(paths) {
|
|
47
|
+
const byDir = {};
|
|
48
|
+
const pagePaths = [];
|
|
49
|
+
const otherPaths = [];
|
|
50
|
+
let pages = 0;
|
|
51
|
+
let hashed = 0;
|
|
52
|
+
let other = 0;
|
|
53
|
+
for (const path of paths) {
|
|
54
|
+
const dir = topLevelDir(path);
|
|
55
|
+
byDir[dir] = (byDir[dir] ?? 0) + 1;
|
|
56
|
+
if (isPagePath(path)) {
|
|
57
|
+
pages += 1;
|
|
58
|
+
if (pagePaths.length < PAGE_PATH_SAMPLE_LIMIT)
|
|
59
|
+
pagePaths.push(path);
|
|
60
|
+
}
|
|
61
|
+
else if (isContentHashedPath(path)) {
|
|
62
|
+
hashed += 1;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
other += 1;
|
|
66
|
+
if (otherPaths.length < OTHER_PATH_SAMPLE_LIMIT)
|
|
67
|
+
otherPaths.push(path);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
total: paths.length,
|
|
72
|
+
pages,
|
|
73
|
+
content_hashed_build_assets: hashed,
|
|
74
|
+
other,
|
|
75
|
+
only_content_hashed_build_assets: paths.length > 0 && hashed === paths.length,
|
|
76
|
+
by_top_level_dir: byDir,
|
|
77
|
+
page_paths: pagePaths,
|
|
78
|
+
other_paths: otherPaths,
|
|
79
|
+
confidence: "heuristic",
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Adds `details.removed_paths_summary` to each bulk-removal warning that
|
|
84
|
+
* lists its paths and does not already carry a summary. Other warnings
|
|
85
|
+
* pass through untouched.
|
|
86
|
+
*/
|
|
87
|
+
export function withSiteRemovalSummaries(warnings) {
|
|
88
|
+
let changed = false;
|
|
89
|
+
const next = warnings.map((warning) => {
|
|
90
|
+
if (warning?.code !== SITE_BULK_REMOVAL_WARNING_CODE)
|
|
91
|
+
return warning;
|
|
92
|
+
if (!Array.isArray(warning.affected) || warning.affected.length === 0)
|
|
93
|
+
return warning;
|
|
94
|
+
if (warning.details && "removed_paths_summary" in warning.details)
|
|
95
|
+
return warning;
|
|
96
|
+
changed = true;
|
|
97
|
+
return {
|
|
98
|
+
...warning,
|
|
99
|
+
details: {
|
|
100
|
+
...(warning.details ?? {}),
|
|
101
|
+
removed_paths_summary: summarizeSiteRemoval(warning.affected.filter((p) => typeof p === "string")),
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
});
|
|
105
|
+
return changed ? next : warnings;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=site-removal-summary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site-removal-summary.js","sourceRoot":"","sources":["../../src/namespaces/site-removal-summary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,MAAM,CAAC,MAAM,8BAA8B,GAAG,+BAA+B,CAAC;AAE9E,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAClC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAsBnC;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IACnD,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,GAAG,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAChC,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACzC,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QAClD,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC;YAAE,SAAS;QAClD,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,C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