@jini-ai/devops 0.5.4 → 0.5.5
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/CHANGELOG.md +4 -0
- package/dist/packaging/electron/archive.js +1 -1
- package/dist/packaging/electron/imports.d.ts +1 -1
- package/dist/static-export/contracts.d.ts +9 -0
- package/dist/static-export/runner.js +56 -1
- package/dist/static-export/transforms.d.ts +8 -1
- package/dist/static-export/transforms.js +21 -3
- package/package.json +10 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# @jini-ai/devops
|
|
2
2
|
|
|
3
|
+
## 0.5.5 — 2026-10-16
|
|
4
|
+
|
|
5
|
+
- Static export crawls `<video poster>` images and reports what it dropped (0de2f161).
|
|
6
|
+
|
|
3
7
|
## 0.5.3 — 2026-10-08
|
|
4
8
|
|
|
5
9
|
- Desktop 0.1.13 release fixes: see commits a2659d24 (admin), 5695a7c3 (chat, agent-runtime), 8ad4ac5c (devops).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Preserved
|
|
1
|
+
// Preserved host rationale below: VERIFIED_PREFIXES and scripts/verify-package.ts are host-owned;
|
|
2
2
|
// archivePath/entryPath/separator and filesystem/archive ports replace the old SDK parameters.
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
function safeEntry(value) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PackagingFilesystemPort, ImportReaderPort, ImportAliasPort } from './ports.js';
|
|
2
2
|
export interface DistImportInput {
|
|
3
|
-
/** The built tree's root (`dist/`),
|
|
3
|
+
/** The built tree's root (`dist/`), passed to ImportAliasPort for host alias resolution. */
|
|
4
4
|
distDir: string;
|
|
5
5
|
/** Absolute path of the file the walk starts from (the CLI entry). */
|
|
6
6
|
entry: string;
|
|
@@ -79,6 +79,12 @@ export interface FailedAsset {
|
|
|
79
79
|
url: string;
|
|
80
80
|
reason: string;
|
|
81
81
|
}
|
|
82
|
+
export interface DroppedReference {
|
|
83
|
+
page: string;
|
|
84
|
+
url: string;
|
|
85
|
+
attribute: string;
|
|
86
|
+
reason: 'not-exported' | 'needs-server';
|
|
87
|
+
}
|
|
82
88
|
export interface ExportReport {
|
|
83
89
|
outputDir: string;
|
|
84
90
|
routes: {
|
|
@@ -91,6 +97,9 @@ export interface ExportReport {
|
|
|
91
97
|
};
|
|
92
98
|
skippedManifestEntries: ManifestSkip[];
|
|
93
99
|
unreferencedThemeFiles: string[];
|
|
100
|
+
/** Site-relative references missing from written HTML's output, deduped per page + URL (ignoring
|
|
101
|
+
* queries/fragments and the export base path). At most 200 entries; a full list may be truncated at that cap. */
|
|
102
|
+
droppedReferences: DroppedReference[];
|
|
94
103
|
basePath?: string;
|
|
95
104
|
basePathRewriteWarning?: string;
|
|
96
105
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExportPathError } from "./contracts.js";
|
|
2
|
-
import { extractAssetUrls, extractCssUrls, normalizeBasePath, outputFileForUrl, redirectOutcomeFor, renderRedirectStub, rewriteRouteBodyForBasePath, safeRelativeOutputFile } from './transforms.js';
|
|
2
|
+
import { extractAssetUrls, extractHtmlReferences, extractCssUrls, normalizeBasePath, outputFileForUrl, redirectOutcomeFor, renderRedirectStub, rewriteRouteBodyForBasePath, safeRelativeOutputFile } from './transforms.js';
|
|
3
3
|
const BASE_PATH_REWRITE_WARNING = "base-path rewriting is a best-effort TEXT rewrite over already-rendered responses — it cannot rewrite a path a theme's own JavaScript constructs at runtime from a string (same category of gap as the unreferenced-theme-file warning, just invisible to this rewrite instead of to the asset crawl).";
|
|
4
4
|
async function request(ctx, url) {
|
|
5
5
|
// Redirects are observed, never followed off the caller's app, for routes and assets alike.
|
|
@@ -127,6 +127,60 @@ async function unreferenced(ctx, manifest, assets) {
|
|
|
127
127
|
}
|
|
128
128
|
return [...await ctx.args.assetSource.listThemeFiles({ theme })].filter(file => !accounted.has(file)).sort();
|
|
129
129
|
}
|
|
130
|
+
/** Compare written HTML with this run's outputs only; no requests or filesystem reads.
|
|
131
|
+
* At most 200 drops are retained. O(output count + scanned HTML bytes) time; output paths plus
|
|
132
|
+
* at most 200 dedupe keys are retained. Forms take precedence over links to the same URL.
|
|
133
|
+
*/
|
|
134
|
+
function droppedReferences(required) {
|
|
135
|
+
const origin = required.baseUrl;
|
|
136
|
+
const normalize = (url) => new URL(url, origin).pathname.replace(/\/+$/, '') || '/';
|
|
137
|
+
const written = new Set();
|
|
138
|
+
for (const item of [...required.routes, ...required.assets]) {
|
|
139
|
+
const file = '/' + item.outputFile;
|
|
140
|
+
written.add(normalize(file));
|
|
141
|
+
if (file.endsWith('/index.html'))
|
|
142
|
+
written.add(normalize(file.slice(0, -10)));
|
|
143
|
+
}
|
|
144
|
+
for (const route of required.routes)
|
|
145
|
+
if (route.kind !== 'not-found')
|
|
146
|
+
written.add(normalize(route.path));
|
|
147
|
+
for (const asset of required.assets)
|
|
148
|
+
written.add(normalize(asset.url));
|
|
149
|
+
const dropped = new Map();
|
|
150
|
+
for (const route of required.routes) {
|
|
151
|
+
if (!/^text\/html\b/i.test(route.contentType ?? '') && !route.outputFile.endsWith('.html'))
|
|
152
|
+
continue;
|
|
153
|
+
for (const reference of extractHtmlReferences({ html: route.data })) {
|
|
154
|
+
const value = reference.url.trim();
|
|
155
|
+
if (((!value || value.startsWith('?')) && reference.attribute !== 'action') || value.startsWith('#'))
|
|
156
|
+
continue;
|
|
157
|
+
let url;
|
|
158
|
+
try {
|
|
159
|
+
url = new URL(value, origin + required.basePath + route.path);
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
if (url.origin !== origin)
|
|
165
|
+
continue;
|
|
166
|
+
let pathname = url.pathname;
|
|
167
|
+
if (required.basePath && (pathname === required.basePath || pathname.startsWith(required.basePath + '/')))
|
|
168
|
+
pathname = pathname.slice(required.basePath.length) || '/';
|
|
169
|
+
pathname = normalize(pathname);
|
|
170
|
+
const reason = reference.attribute === 'action' ? 'needs-server' : 'not-exported';
|
|
171
|
+
if (reason === 'not-exported' && written.has(pathname))
|
|
172
|
+
continue;
|
|
173
|
+
const key = route.path + '\n' + pathname;
|
|
174
|
+
if (dropped.has(key)) {
|
|
175
|
+
if (reason === 'needs-server')
|
|
176
|
+
dropped.set(key, { page: route.path, url: pathname, attribute: reference.attribute, reason });
|
|
177
|
+
}
|
|
178
|
+
else if (dropped.size < 200)
|
|
179
|
+
dropped.set(key, { page: route.path, url: pathname, attribute: reference.attribute, reason });
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return [...dropped.values()];
|
|
183
|
+
}
|
|
130
184
|
/** Drive the caller's actual app, retaining exact written bytes and reporting each failed item.
|
|
131
185
|
* Startup/output/inventory errors throw; an opened app always closes. No singleton state is used.
|
|
132
186
|
*/
|
|
@@ -146,6 +200,7 @@ export async function exportSite(required, optional = {}) {
|
|
|
146
200
|
const routes = await writeRoutes(ctx, manifest.routes);
|
|
147
201
|
const assets = await writeAssets(ctx, [...routes.assets]);
|
|
148
202
|
return { outputDir: required.outputDir, routes: { succeeded: routes.succeeded, failed: routes.failed }, assets, skippedManifestEntries: [...manifest.skipped, ...routes.skipped],
|
|
203
|
+
droppedReferences: droppedReferences({ routes: routes.succeeded, assets: assets.succeeded, basePath, baseUrl: ctx.baseUrl }),
|
|
149
204
|
unreferencedThemeFiles: await unreferenced(ctx, manifest, assets.succeeded), ...(basePath ? { basePath, basePathRewriteWarning: BASE_PATH_REWRITE_WARNING } : {}) };
|
|
150
205
|
}
|
|
151
206
|
finally {
|
|
@@ -28,7 +28,14 @@ export declare function renderRedirectStub(required: {
|
|
|
28
28
|
}, optional?: {
|
|
29
29
|
basePath?: string;
|
|
30
30
|
}): string;
|
|
31
|
-
/**
|
|
31
|
+
/** HTML URL attributes; form actions are diagnostic references, never crawled as assets. */
|
|
32
|
+
export declare function extractHtmlReferences(required: {
|
|
33
|
+
html: string;
|
|
34
|
+
}, _optional?: Record<string, never>): Generator<{
|
|
35
|
+
url: string;
|
|
36
|
+
attribute: string;
|
|
37
|
+
}>;
|
|
38
|
+
/** Shared href/src/srcset/poster scan, preserving data-URL commas and ignoring external references. */
|
|
32
39
|
export declare function extractAssetUrls(required: {
|
|
33
40
|
html: string;
|
|
34
41
|
prefixes: readonly string[];
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { ExportPathError } from './contracts.js';
|
|
2
|
+
// Crawling and rewriting must recognize the same URL attributes.
|
|
3
|
+
const HTML_URL_ATTRIBUTES = ['href', 'src', 'srcset', 'poster'];
|
|
4
|
+
const HTML_URL_REWRITE = new RegExp(`\\b(${HTML_URL_ATTRIBUTES.join('|')})=(["'])([^"']*)\\2`, 'g');
|
|
5
|
+
const HTML_URL_SCAN = new RegExp(`\\b(${HTML_URL_ATTRIBUTES.join('|')})=(["'])([^"']+)\\2`, 'g');
|
|
2
6
|
function escapeHtml(value) { return value.replace(/[&<>"']/g, char => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[char]); }
|
|
3
7
|
function safeHref(value) {
|
|
4
8
|
const href = value.trim();
|
|
@@ -73,7 +77,7 @@ function rewriteJson(body, basePath) {
|
|
|
73
77
|
function rewriteHtml(html, basePath) {
|
|
74
78
|
if (!basePath)
|
|
75
79
|
return html;
|
|
76
|
-
return html.replace(
|
|
80
|
+
return html.replace(HTML_URL_REWRITE, (_match, attr, quote, value) => {
|
|
77
81
|
if (attr !== 'srcset')
|
|
78
82
|
return `${attr}=${quote}${prefix(value, basePath)}${quote}`;
|
|
79
83
|
for (const { start, end } of srcsetRanges(value).reverse())
|
|
@@ -109,10 +113,24 @@ export function renderRedirectStub(required, optional = {}) {
|
|
|
109
113
|
const safeTarget = escapeHtml(safeHref(location));
|
|
110
114
|
return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="refresh" content="0; url=${safeTarget}"><link rel="canonical" href="${safeTarget}"><title>Redirecting…</title></head><body>Redirecting to <a href="${safeTarget}">${escapeHtml(location)}</a>.</body></html>\n`;
|
|
111
115
|
}
|
|
112
|
-
/**
|
|
116
|
+
/** HTML URL attributes; form actions are diagnostic references, never crawled as assets. */
|
|
117
|
+
export function* extractHtmlReferences(required, _optional = {}) {
|
|
118
|
+
const references = [...required.html.matchAll(HTML_URL_SCAN)]
|
|
119
|
+
.filter(match => required.html[match.index - 1] !== '-')
|
|
120
|
+
.map(match => ({ index: match.index, attribute: match[1], value: match[3] }));
|
|
121
|
+
for (const match of required.html.matchAll(/<form\b[^>]*?\baction=(["'])([^"']*)\1/g)) {
|
|
122
|
+
references.push({ index: match.index, attribute: 'action', value: match[2] });
|
|
123
|
+
}
|
|
124
|
+
for (const { attribute, value } of references.sort((a, b) => a.index - b.index)) {
|
|
125
|
+
const values = attribute === 'srcset' ? srcsetRanges(value).map(({ start, end }) => value.slice(start, end)) : [value];
|
|
126
|
+
for (const url of values)
|
|
127
|
+
yield { url, attribute };
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/** Shared href/src/srcset/poster scan, preserving data-URL commas and ignoring external references. */
|
|
113
131
|
export function extractAssetUrls(required) {
|
|
114
132
|
const found = new Set();
|
|
115
|
-
for (const match of required.html.matchAll(
|
|
133
|
+
for (const match of required.html.matchAll(HTML_URL_SCAN)) {
|
|
116
134
|
const value = match[3];
|
|
117
135
|
const values = match[1] === 'srcset' ? srcsetRanges(value).map(({ start, end }) => value.slice(start, end)) : [value];
|
|
118
136
|
for (const url of values)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jini-ai/devops",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "DevOps capabilities for deployment, source control, and CI/CD, exposed through independent subpaths.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -27,6 +27,11 @@
|
|
|
27
27
|
"./local-dev": "node",
|
|
28
28
|
"./deploy/node": "node",
|
|
29
29
|
"./static-export/failure-summary": "universal"
|
|
30
|
+
},
|
|
31
|
+
"isolation": {
|
|
32
|
+
"shared": [
|
|
33
|
+
"src/core/export-failure-summary.ts"
|
|
34
|
+
]
|
|
30
35
|
}
|
|
31
36
|
},
|
|
32
37
|
"type": "module",
|
|
@@ -124,12 +129,12 @@
|
|
|
124
129
|
"devDependencies": {
|
|
125
130
|
"@vitest/coverage-v8": "^2.1.9",
|
|
126
131
|
"undici": "^7.25.0",
|
|
127
|
-
"@jini-ai/daemon": "0.6.
|
|
128
|
-
"@jini-ai/platform": "^0.5.
|
|
129
|
-
"@jini-ai/core": "^0.4.
|
|
132
|
+
"@jini-ai/daemon": "0.6.8",
|
|
133
|
+
"@jini-ai/platform": "^0.5.9",
|
|
134
|
+
"@jini-ai/core": "^0.4.7"
|
|
130
135
|
},
|
|
131
136
|
"dependencies": {
|
|
132
|
-
"@jini-ai/core": "^0.4.
|
|
137
|
+
"@jini-ai/core": "^0.4.7"
|
|
133
138
|
},
|
|
134
139
|
"peerDependencies": {
|
|
135
140
|
"typescript": "^5.6.0",
|