@jini-ai/devops 0.6.15-rc.2 → 0.6.16

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.
Files changed (50) hide show
  1. package/README.md +2 -2
  2. package/dist/agent-jobs/jobs.js +3 -2
  3. package/dist/checks/hardwiring-node.js +16 -6
  4. package/dist/checks/hardwiring.js +38 -16
  5. package/dist/checks/memory-soak.js +2 -1
  6. package/dist/checks/node.d.ts +0 -1
  7. package/dist/checks/node.js +7 -1
  8. package/dist/checks/published-types/index.js +5 -2
  9. package/dist/core/deploy-types.d.ts +8 -0
  10. package/dist/deploy/naming.js +4 -5
  11. package/dist/deploy/node.js +4 -2
  12. package/dist/deploy/reachability.js +26 -23
  13. package/dist/dns/plan.js +2 -1
  14. package/dist/dns/records.js +7 -3
  15. package/dist/dns/registry.js +4 -2
  16. package/dist/local-dev/index.js +7 -3
  17. package/dist/packaging/electron/entry.d.ts +3 -0
  18. package/dist/packaging/electron/entry.js +3 -0
  19. package/dist/packaging/electron/imports.js +5 -3
  20. package/dist/packaging/electron/node.js +7 -1
  21. package/dist/packaging/electron/optional-peers.d.ts +22 -0
  22. package/dist/packaging/electron/optional-peers.js +16 -0
  23. package/dist/packaging/electron/ports.d.ts +16 -0
  24. package/dist/packaging/electron/staged-closure-node.d.ts +7 -0
  25. package/dist/packaging/electron/staged-closure-node.js +17 -0
  26. package/dist/packaging/electron/staged-closure.d.ts +27 -0
  27. package/dist/packaging/electron/staged-closure.js +128 -0
  28. package/dist/packaging/electron/staging.d.ts +28 -4
  29. package/dist/packaging/electron/staging.js +69 -27
  30. package/dist/packaging/electron/typescript.d.ts +15 -2
  31. package/dist/packaging/electron/typescript.js +101 -16
  32. package/dist/source-control/commit.js +23 -5
  33. package/dist/source-control/contracts.d.ts +11 -1
  34. package/dist/source-control/entry.d.ts +1 -0
  35. package/dist/source-control/entry.js +1 -0
  36. package/dist/source-control/kit.js +2 -0
  37. package/dist/source-control/registry.d.ts +5 -0
  38. package/dist/source-control/registry.js +5 -2
  39. package/dist/source-control/repository-path.d.ts +28 -0
  40. package/dist/source-control/repository-path.js +52 -0
  41. package/dist/source-control/repository-target.js +6 -3
  42. package/dist/static-export/contracts.d.ts +4 -5
  43. package/dist/static-export/css-urls.d.ts +16 -0
  44. package/dist/static-export/css-urls.js +66 -0
  45. package/dist/static-export/html-url-locations.d.ts +2 -1
  46. package/dist/static-export/html-url-locations.js +23 -3
  47. package/dist/static-export/node-adapters.js +8 -3
  48. package/dist/static-export/runner.js +47 -30
  49. package/dist/static-export/transforms.js +45 -29
  50. package/package.json +12 -6
@@ -1,15 +1,22 @@
1
1
  import { htmlUrlLocations } from './html-url-locations.js';
2
2
  export { exportUrlLocations } from './html-url-locations.js';
3
3
  import { ExportPathError } from './contracts.js';
4
+ import { cssUrlTokens } from './css-urls.js';
5
+ import { trimCharsEnd } from '@jini-ai/core/primitives';
6
+ // Reserved `.invalid` origins used only to resolve and compare URLs locally; never fetched. Both
7
+ // schemes are "special" to the URL parser, so https resolves exactly as http did.
8
+ const SAFE_HREF_ORIGIN = 'https://export-safehref.invalid';
9
+ const LOCAL_CSS_ORIGIN = 'https://export-local.invalid';
10
+ /** JSON keys whose string values are links. */
11
+ const LINK_KEYS = new Set(['href', 'url', 'src']);
4
12
  function escapeHtml(value) { return value.replace(/[&<>"']/g, char => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[char]); }
5
13
  function safeHref(value) {
6
14
  const href = value.trim();
7
15
  if (href.startsWith('#') || /^https?:\/\//i.test(href) || /^mailto:/i.test(href))
8
16
  return href;
9
17
  if (href.startsWith('/')) {
10
- // eslint-disable-next-line sonarjs/no-clear-text-protocols -- Reserved .invalid sentinel used only for local URL resolution/origin comparison; never fetched.
11
18
  try {
12
- if (new URL(href, 'http://export-safehref.invalid/').origin === 'http://export-safehref.invalid')
19
+ if (new URL(href, `${SAFE_HREF_ORIGIN}/`).origin === SAFE_HREF_ORIGIN)
13
20
  return href;
14
21
  }
15
22
  catch {
@@ -20,7 +27,7 @@ function safeHref(value) {
20
27
  }
21
28
  /** Normalize the optional output URL prefix; no product layout is implied. */
22
29
  export function normalizeBasePath(required) {
23
- const trimmed = required.raw.trim().replace(/\/+$/, '');
30
+ const trimmed = trimCharsEnd({ text: required.raw.trim(), chars: '/' });
24
31
  if (trimmed === '' || trimmed === '/')
25
32
  return '';
26
33
  if (/[\\\x00-\x20\x7f?#"'<>]/.test(trimmed) || trimmed.startsWith('//'))
@@ -77,7 +84,7 @@ function rewriteJson(body, basePath) {
77
84
  catch {
78
85
  return body;
79
86
  }
80
- return JSON.stringify(parsed, (key, value) => (typeof value === 'string' && (key === 'href' || key === 'url' || key === 'src') ? prefix(value, basePath) : value));
87
+ return JSON.stringify(parsed, (key, value) => (typeof value === 'string' && LINK_KEYS.has(key) ? prefix(value, basePath) : value));
81
88
  }
82
89
  function rewriteHtml(html, basePath) {
83
90
  const output = [];
@@ -102,7 +109,14 @@ function rewriteHtml(html, basePath) {
102
109
  }
103
110
  /** Root-relative CSS URLs keep working in inline styles and stylesheets under an export prefix. */
104
111
  function rewriteCss(body, basePath) {
105
- return body.replace(/url\(\s*(['"]?)([^'")]+)\1\s*\)/g, (_match, quote, value) => `url(${quote}${prefix(value.trim(), basePath)}${quote})`);
112
+ const output = [];
113
+ let offset = 0;
114
+ for (const { start, end, quote, value } of cssUrlTokens(body)) {
115
+ output.push(body.slice(offset, start), `url(${quote}${prefix(value.trim(), basePath)}${quote})`);
116
+ offset = end;
117
+ }
118
+ output.push(body.slice(offset));
119
+ return output.join('');
106
120
  }
107
121
  /** Same bounded text transforms as the exporter origin; crawl the raw body before applying these. */
108
122
  export function rewriteRouteBodyForBasePath(required, _optional = {}) {
@@ -157,7 +171,7 @@ function jsonUrls({ body }, _optional = {}) {
157
171
  const urls = [];
158
172
  try {
159
173
  JSON.parse(body, (key, value) => {
160
- if (typeof value === 'string' && ['src', 'url', 'href'].includes(key))
174
+ if (typeof value === 'string' && LINK_KEYS.has(key))
161
175
  urls.push(value);
162
176
  return value;
163
177
  });
@@ -173,11 +187,10 @@ function assetCandidates(required, optional = {}) {
173
187
  return [...required.html.matchAll(/<(?:[\w-]+:)?(?:loc|url)>([^<]+)<\//g)].map(match => match[1]);
174
188
  const candidates = [];
175
189
  for (const { start, end, kind } of htmlUrlLocations(required)) {
190
+ if (kind === 'action')
191
+ continue;
176
192
  const value = required.html.slice(start, end);
177
- if (kind === 'css')
178
- candidates.push(...extractCssUrls({ css: value, cssUrl: '/', prefixes: required.prefixes }));
179
- else if (kind !== 'action')
180
- candidates.push(...attributeUrls(kind, value));
193
+ candidates.push(...(kind === 'css' ? extractCssUrls({ css: value, cssUrl: '/', prefixes: required.prefixes }) : attributeUrls(kind, value)));
181
194
  }
182
195
  return candidates;
183
196
  }
@@ -193,26 +206,26 @@ export function extractAssetUrls(required, optional = {}) {
193
206
  /** A single CSS hop, resolved against the stylesheet URL and restricted to the same synthetic origin. */
194
207
  export function extractCssUrls(required) {
195
208
  const found = new Set();
196
- for (const match of required.css.matchAll(/url\(\s*(['"]?)([^'")]+)\1\s*\)/g)) {
197
- const ref = match[2].trim();
198
- if (!ref || ref.startsWith('data:'))
199
- continue;
200
- let resolved;
201
- // eslint-disable-next-line sonarjs/no-clear-text-protocols -- Reserved .invalid sentinel used only for local URL resolution/origin comparison; never fetched.
202
- try {
203
- resolved = new URL(ref, 'http://export-local.invalid' + required.cssUrl);
204
- }
205
- catch {
206
- continue;
207
- }
208
- // eslint-disable-next-line sonarjs/no-clear-text-protocols -- Reserved .invalid sentinel used only for local URL resolution/origin comparison; never fetched.
209
- if (resolved.origin !== 'http://export-local.invalid')
210
- continue;
211
- if (required.prefixes.some(prefix => resolved.pathname.startsWith(prefix)))
212
- found.add(resolved.pathname);
209
+ for (const { value } of cssUrlTokens(required.css)) {
210
+ const pathname = localCssPath({ ref: value.trim(), cssUrl: required.cssUrl });
211
+ if (pathname !== undefined && required.prefixes.some(prefix => pathname.startsWith(prefix)))
212
+ found.add(pathname);
213
213
  }
214
214
  return [...found];
215
215
  }
216
+ /** The same-origin path a stylesheet reference resolves to; data URIs, unparsable and foreign refs have none. */
217
+ function localCssPath({ ref, cssUrl }) {
218
+ if (!ref || ref.startsWith('data:'))
219
+ return undefined;
220
+ let resolved;
221
+ try {
222
+ resolved = new URL(ref, LOCAL_CSS_ORIGIN + cssUrl);
223
+ }
224
+ catch {
225
+ return undefined;
226
+ }
227
+ return resolved.origin === LOCAL_CSS_ORIGIN ? resolved.pathname : undefined;
228
+ }
216
229
  /** Reject path escapes and separators before HTTP or writing; returns forward-slash relative output. */
217
230
  export function safeRelativeOutputFile(required) {
218
231
  const { value } = required;
@@ -222,6 +235,9 @@ export function safeRelativeOutputFile(required) {
222
235
  throw new ExportPathError('Output path resolved outside the output directory — refused');
223
236
  return value;
224
237
  }
238
+ function contentIndexFile(relative) {
239
+ return relative ? relative + '/index.html' : 'index.html';
240
+ }
225
241
  /** URL request path to portable artifact path, with decoded traversal refusal. */
226
242
  export function outputFileForUrl(required, optional = {}) {
227
243
  if (!required.url.startsWith('/') || required.url.startsWith('//') || /[\\\x00-\x1f\x7f]/.test(required.url))
@@ -233,10 +249,10 @@ export function outputFileForUrl(required, optional = {}) {
233
249
  catch {
234
250
  throw new ExportPathError('Invalid URL encoding — refused');
235
251
  }
236
- const relative = decoded.replace(/^\//, '').replace(/\/+$/, '');
252
+ const relative = trimCharsEnd({ text: decoded.startsWith('/') ? decoded.slice(1) : decoded, chars: '/' });
237
253
  if (relative)
238
254
  safeRelativeOutputFile({ value: relative });
239
- const output = optional.contentRoute && !isJsonRoute(relative) ? (relative ? relative + '/index.html' : 'index.html') : relative;
255
+ const output = optional.contentRoute && !isJsonRoute(relative) ? contentIndexFile(relative) : relative;
240
256
  return safeRelativeOutputFile({ value: output });
241
257
  }
242
258
  //# sourceMappingURL=transforms.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jini-ai/devops",
3
- "version": "0.6.15-rc.2",
3
+ "version": "0.6.16",
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": {
@@ -35,6 +35,12 @@
35
35
  "shared": [
36
36
  "src/core/export-failure-summary.ts"
37
37
  ]
38
+ },
39
+ "optionalPeers": {
40
+ "parse5": "opt-in: html parsing; import @jini-ai/devops/static-export — HTML parsing could not load parse5. Install parse5 to enable this feature, or check its installed version and native binaries.",
41
+ "typescript": "opt-in: typescript source analysis — TypeScript source analysis could not load typescript. Install typescript to enable this feature, or check its installed version and native binaries.",
42
+ "@jini-ai/platform": "opt-in: platform-backed adapters; import @jini-ai/devops/deploy/node — Platform-backed adapters could not load @jini-ai/platform. Install @jini-ai/platform to enable this feature, or check its installed version and native binaries.",
43
+ "undici": "opt-in: custom http dispatchers; import @jini-ai/devops/deploy/node — Custom HTTP dispatchers could not load undici. Install undici to enable this feature, or check its installed version and native binaries."
38
44
  }
39
45
  },
40
46
  "type": "module",
@@ -148,16 +154,16 @@
148
154
  "@vitest/coverage-v8": "^2.1.9",
149
155
  "undici": "^7.25.0",
150
156
  "parse5": "7.3.0",
151
- "@jini-ai/core": "^0.6.15-rc.2",
152
- "@jini-ai/daemon": "0.6.15-rc.2",
153
- "@jini-ai/platform": "^0.6.15-rc.2"
157
+ "@jini-ai/daemon": "0.6.16",
158
+ "@jini-ai/platform": "^0.6.16",
159
+ "@jini-ai/core": "^0.6.16"
154
160
  },
155
161
  "dependencies": {
156
- "@jini-ai/core": "^0.6.15-rc.2"
162
+ "@jini-ai/core": "^0.6.16"
157
163
  },
158
164
  "peerDependencies": {
159
165
  "typescript": "^5.6.0",
160
- "@jini-ai/platform": "^0.6.15-rc.2",
166
+ "@jini-ai/platform": "^0.6.10",
161
167
  "undici": "^7.25.0",
162
168
  "parse5": "7.3.0"
163
169
  },