@kong/spec-renderer 1.117.4 → 1.117.5-pr.1073.102030a.0

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/dist/cli/index.js CHANGED
File without changes
@@ -1,10 +1,191 @@
1
+ import { nodePathFromUrl, parseSavedScrollPosition, SCROLL_STORAGE_KEY, } from './preview-state.js';
2
+ const SCROLL_POLL_INTERVAL_MS = 100;
3
+ /**
4
+ * The first restore can trigger more `scrollY` shifts: the renderer lazily
5
+ * mounts sections around the viewport, and the browser's scroll anchoring
6
+ * compensates. Re-assert the offset once more after this delay, then reveal
7
+ * the page. Everything is hidden until then.
8
+ */
9
+ const SCROLL_REASSERT_DELAY_MS = 800;
10
+ /**
11
+ * Give up on restoring after this long. The spec can shrink below the
12
+ * saved offset.
13
+ */
14
+ const SCROLL_RESTORE_TIMEOUT_MS = 4000;
15
+ /**
16
+ * Set by the `path-not-found` handler. The saved position belongs to a
17
+ * section the latest spec edit removed, so a running restore must stop.
18
+ * A scroll-driven hash update must not set this flag. Only a removed
19
+ * section does.
20
+ */
21
+ let scrollRestoreCancelled = false;
22
+ function readSavedScrollPosition() {
23
+ try {
24
+ return parseSavedScrollPosition(sessionStorage.getItem(SCROLL_STORAGE_KEY));
25
+ }
26
+ catch {
27
+ return undefined;
28
+ }
29
+ }
30
+ /**
31
+ * Finds the section the viewport is in, plus the offset within it. See
32
+ * `SavedSection` for why the anchor is needed.
33
+ */
34
+ function findActiveSection() {
35
+ const root = document.getElementById('preview')?.shadowRoot;
36
+ if (!root) {
37
+ return undefined;
38
+ }
39
+ const y = window.scrollY;
40
+ let active;
41
+ for (const el of Array.from(root.querySelectorAll('[id$="-nodecontainer"]'))) {
42
+ if (el.getBoundingClientRect().top + window.scrollY <= y + 1) {
43
+ active = el;
44
+ }
45
+ }
46
+ if (!active) {
47
+ return undefined;
48
+ }
49
+ return {
50
+ id: active.id,
51
+ heading: active.querySelector('h2')?.textContent?.trim() ?? '',
52
+ offsetIn: Math.max(0, Math.round(y - (active.getBoundingClientRect().top + window.scrollY))),
53
+ };
54
+ }
55
+ function rememberScrollPosition() {
56
+ try {
57
+ sessionStorage.setItem(SCROLL_STORAGE_KEY, JSON.stringify({
58
+ href: location.href,
59
+ y: window.scrollY,
60
+ section: findActiveSection(),
61
+ }));
62
+ }
63
+ catch {
64
+ // Skip when sessionStorage is unavailable (Safari private mode).
65
+ }
66
+ }
67
+ /**
68
+ * Finds the saved section again: by id when the spec is unchanged, else by
69
+ * heading text when a spec edit shifted the indices.
70
+ */
71
+ function findSavedSection(savedSection) {
72
+ const root = document.getElementById('preview')?.shadowRoot;
73
+ if (!root) {
74
+ return null;
75
+ }
76
+ const byId = root.querySelector(`#${CSS.escape(savedSection.id)}`);
77
+ if (byId && (byId.querySelector('h2')?.textContent?.trim() ?? '') === savedSection.heading) {
78
+ return byId;
79
+ }
80
+ if (savedSection.heading) {
81
+ for (const el of Array.from(root.querySelectorAll('[id$="-nodecontainer"]'))) {
82
+ if ((el.querySelector('h2')?.textContent?.trim() ?? '') === savedSection.heading) {
83
+ return el;
84
+ }
85
+ }
86
+ }
87
+ return null;
88
+ }
89
+ /**
90
+ * Where to scroll to: the saved section's live position plus the offset
91
+ * within it, measured at call time. The offset within a section always
92
+ * points at the same content. Falls back to the raw `y` when the section
93
+ * is gone.
94
+ */
95
+ function scrollTarget(saved) {
96
+ if (saved.section === undefined) {
97
+ return saved.y;
98
+ }
99
+ const section = findSavedSection(saved.section);
100
+ if (section === null) {
101
+ return saved.y;
102
+ }
103
+ return section.getBoundingClientRect().top + window.scrollY + saved.section.offsetIn;
104
+ }
105
+ /**
106
+ * Restores the scroll offset saved by `rememberScrollPosition`. The content
107
+ * renders asynchronously, so the browser's own scroll restoration cannot
108
+ * work. The settling moves the page several times, so the caller keeps the
109
+ * renderer hidden until the offset is final.
110
+ */
111
+ function restoreScrollPosition(el) {
112
+ const saved = readSavedScrollPosition();
113
+ // The saved entry must belong to the current URL. A deep link must not
114
+ // inherit an older scroll offset.
115
+ if (!saved || saved.href !== location.href) {
116
+ // The caller hides the element when the entry matches at hide time.
117
+ // The URL can move on during the load, so reveal here. The page must
118
+ // never stay hidden.
119
+ el.style.visibility = '';
120
+ return;
121
+ }
122
+ let hasInteracted = false;
123
+ const reveal = () => {
124
+ el.style.visibility = '';
125
+ };
126
+ // User input wins over the restore. Reveal the page and do not move it
127
+ // while the user reads or scrolls.
128
+ for (const type of ['pointerdown', 'wheel', 'keydown', 'touchstart']) {
129
+ window.addEventListener(type, () => {
130
+ hasInteracted = true;
131
+ reveal();
132
+ }, { once: true });
133
+ }
134
+ const restore = () => {
135
+ const target = scrollTarget(saved);
136
+ if (!scrollRestoreCancelled && !hasInteracted && Math.abs(window.scrollY - target) > 2) {
137
+ window.scrollTo(0, target);
138
+ }
139
+ };
140
+ const startedAt = performance.now();
141
+ let hasRendered = false;
142
+ const poll = () => {
143
+ // The URL-restored path is invalid. The fallback handler already reset
144
+ // the URL and remounted the overview.
145
+ if (scrollRestoreCancelled) {
146
+ reveal();
147
+ return;
148
+ }
149
+ // Gate on the anchored target, or on the raw `y` when no anchor applies.
150
+ // A spec edit can shrink the document above the section. Then the raw
151
+ // `y` is unreachable, but the target is fine. The target is measured
152
+ // live, so sections not yet rendered still fall back to the raw `y`.
153
+ const isRendered = document.documentElement.scrollHeight > Math.min(scrollTarget(saved), saved.y);
154
+ if (isRendered) {
155
+ hasRendered = true;
156
+ }
157
+ if (hasRendered) {
158
+ // Restore, wait out the adjustments (see SCROLL_REASSERT_DELAY_MS),
159
+ // then re-assert and show the page. Each re-assert measures the
160
+ // target live, so virtualization differences self-correct.
161
+ restore();
162
+ setTimeout(() => {
163
+ restore();
164
+ reveal();
165
+ }, SCROLL_REASSERT_DELAY_MS);
166
+ }
167
+ else if (performance.now() - startedAt < SCROLL_RESTORE_TIMEOUT_MS) {
168
+ setTimeout(poll, SCROLL_POLL_INTERVAL_MS);
169
+ }
170
+ else {
171
+ // Best effort after `SCROLL_RESTORE_TIMEOUT_MS`. When the document
172
+ // never rendered past the target, leave the viewport where the
173
+ // renderer put it.
174
+ if (isRendered) {
175
+ restore();
176
+ }
177
+ reveal();
178
+ }
179
+ };
180
+ poll();
181
+ }
1
182
  /**
2
183
  * Fetches the spec/config and assigns them onto the `<kong-spec-renderer>`
3
184
  * element, then registers (and upgrades) the custom element - deliberately
4
185
  * in that order.
5
186
  *
6
- * Vue's `defineCustomElement` reads any already-present own properties on the
7
- * element as its *initial* prop values at construction/upgrade time; props
187
+ * Vue's `defineCustomElement` reads any already-present own properties on
188
+ * the element as its *initial* prop values at construction/upgrade time; props
8
189
  * assigned afterwards (e.g. `currentPath`) reach the underlying component
9
190
  * reactively for props it actively watches, but some - like `currentPath` -
10
191
  * are only snapshotted into local refs once at setup and never re-synced.
@@ -24,30 +205,52 @@ async function loadAndApply() {
24
205
  for (const [key, value] of Object.entries(config)) {
25
206
  el[key] = value;
26
207
  }
27
- const requestedPath = typeof config.currentPath === 'string' ? config.currentPath : undefined;
28
- // Matches how the component's own click-driven navigation builds the URL
29
- // for each `navigationType` (there's no `basePath` here - the CLI's preview
30
- // page is always served from `/`).
31
- const toAddressBarUrl = (path) => config.navigationType === 'hash' ? `#${path}` : path;
208
+ // Narrow the parsed JSON instead of trusting its shape.
209
+ const navigationType = config.navigationType === 'path' ? 'path' : 'hash';
210
+ // Builds the URL for a node path, the same way the component does (no
211
+ // `basePath`, because the preview page is always served from `/`)...
212
+ const toAddressBarUrl = (path) => navigationType === 'hash' ? `#${path}` : path;
213
+ // ...and `nodePathFromUrl` is the inverse: it reads the user's last
214
+ // location back out of the URL after a reload.
215
+ // The URL holds the user's latest location. The `--path` flag only sets
216
+ // the first load's starting point.
217
+ const urlPath = nodePathFromUrl(navigationType, location);
218
+ const flagPath = typeof config.currentPath === 'string' ? config.currentPath : undefined;
219
+ const requestedPath = urlPath ?? flagPath;
220
+ const pathSource = urlPath === undefined ? 'flag' : 'url';
221
+ // `config` carries `currentPath` only when `--path` was passed. A URL
222
+ // path must be set on the element itself before registration. This
223
+ // includes the overview: the config loop above already set the flag
224
+ // value, so a skipped assignment lets a stale `--path` outlive a click
225
+ // on "Overview".
226
+ if (urlPath !== undefined) {
227
+ el.currentPath = urlPath;
228
+ }
32
229
  if (requestedPath && requestedPath !== '/') {
33
- // The component only pushes address-bar updates from its own click-driven
34
- // navigation, not for an initial `currentPath` prop supplied externally -
35
- // reflect the requested deep link ourselves so the URL matches what's
36
- // actually rendered. Optimistic: rolled back below if the path turns out
37
- // to be invalid.
38
- history.replaceState({}, '', toAddressBarUrl(requestedPath));
39
- // `--path` has to match this library's internal node URI scheme
40
- // (`/operations/{operationId}`, `/schemas/{SchemaName}`), not the raw OAS
41
- // path - there's no other feedback if it doesn't match anything, so warn
42
- // loudly rather than silently rendering a blank document pane.
230
+ // The component reflects only its own navigation into the address bar,
231
+ // not an initial `currentPath` prop. Reflect a flag path here. A URL
232
+ // path is already in the address bar.
233
+ if (pathSource === 'flag') {
234
+ history.replaceState({}, '', toAddressBarUrl(requestedPath));
235
+ }
236
+ // The path must match the library's node URI scheme
237
+ // (`/operations/{operationId}`, `/schemas/{SchemaName}`), not the raw
238
+ // OAS path. Warn loudly. A wrong path otherwise renders a blank pane.
43
239
  el.addEventListener('path-not-found', ((event) => {
44
- console.warn(`[kong-spec-renderer] --path "${String(event.detail?.[0] ?? requestedPath)}" doesn't match any operation or schema in this spec. ` +
240
+ const requested = String(event.detail?.[0] ?? requestedPath);
241
+ const source = pathSource === 'url'
242
+ ? `The path "${requested}" (restored from the URL) doesn't match any operation or schema in this spec - it may have been renamed or removed since. `
243
+ : `--path "${requested}" doesn't match any operation or schema in this spec. `;
244
+ console.warn(`[kong-spec-renderer] ${source}` +
45
245
  'Expected format: "/operations/{operationId}" or "/schemas/{SchemaName}" - check the spec\'s operationId/schema names, not its raw OAS paths. ' +
46
246
  'Falling back to the overview.');
247
+ // The saved offset belongs to the invalid section. Cancel its
248
+ // restore, so it cannot move the page during the fallback.
249
+ scrollRestoreCancelled = true;
47
250
  history.replaceState({}, '', '/');
48
- // `currentPath` is only read once, at the component's initial setup -
49
- // an invalid path can't be corrected by reassigning the property on
50
- // the existing element, so replace it with a fresh one instead.
251
+ // The component reads `currentPath` only once, at setup. An invalid
252
+ // path cannot be fixed in place, so replace the element with a fresh
253
+ // one.
51
254
  const fallback = document.createElement(el.tagName);
52
255
  fallback.id = el.id;
53
256
  fallback.spec = spec;
@@ -57,13 +260,32 @@ async function loadAndApply() {
57
260
  el.replaceWith(fallback);
58
261
  }));
59
262
  }
263
+ // A matching saved offset means this load settles mid-document. Hide the
264
+ // renderer before its content renders. Reveal it once the offset is final
265
+ // (see `restoreScrollPosition`).
266
+ if (readSavedScrollPosition()?.href === location.href) {
267
+ el.style.visibility = 'hidden';
268
+ }
60
269
  // A variable (rather than a string literal) module specifier so TypeScript
61
270
  // treats this as an untyped dynamic import instead of trying to resolve
62
271
  // `/assets/...` at typecheck time - it only exists once the CLI serves it.
63
272
  const bundlePath = '/assets/kong-spec-renderer.web-component.es.js';
64
- const { registerKongSpecRenderer } = await import(bundlePath);
65
- registerKongSpecRenderer();
273
+ try {
274
+ const { registerKongSpecRenderer } = await import(bundlePath);
275
+ registerKongSpecRenderer();
276
+ }
277
+ catch (error) {
278
+ // A failed bundle load must not leave the hidden page blank forever.
279
+ el.style.visibility = '';
280
+ console.error(`[kong-spec-renderer] Failed to load the renderer bundle: ${error instanceof Error ? error.message : String(error)}`);
281
+ return;
282
+ }
283
+ restoreScrollPosition(el);
66
284
  }
285
+ // The renderer renders asynchronously, so the browser's own scroll
286
+ // restoration cannot work across reloads. Take it over manually.
287
+ history.scrollRestoration = 'manual';
288
+ window.addEventListener('pagehide', rememberScrollPosition);
67
289
  void loadAndApply();
68
290
  const RECONNECT_DELAY_MS = 1000;
69
291
  /**
@@ -85,5 +307,4 @@ function connect() {
85
307
  });
86
308
  }
87
309
  connect();
88
- export {};
89
310
  //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
-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AAQ,GAAG,QAAQ,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAA;IAC9D,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,GAAG,QAAQ,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAA;IAE9D,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;QAC3C,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAc,CAAqB,CAAA;QAEpE,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC9B,QAAQ,CAAC,MAAM,EAAE,CAAA;QACnB,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE;QACpC,UAAU,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAA;IACzC,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,OAAO,EAAE,CAAA"}
@@ -0,0 +1,71 @@
1
+ /** sessionStorage key for the preview page's saved scroll position. */
2
+ export const SCROLL_STORAGE_KEY = 'kong-spec-renderer:scroll-position';
3
+ function isSavedSection(value) {
4
+ if (typeof value !== 'object' || value === null) {
5
+ return false;
6
+ }
7
+ const { id, heading, offsetIn } = value;
8
+ return typeof id === 'string'
9
+ && typeof heading === 'string'
10
+ && typeof offsetIn === 'number'
11
+ && Number.isFinite(offsetIn)
12
+ && offsetIn >= 0;
13
+ }
14
+ /**
15
+ * Parses the saved scroll position from its sessionStorage form. Returns
16
+ * `undefined` when the entry is absent, malformed, or not restorable (`y`
17
+ * must be past the top). A malformed `section` drops only the anchor. The
18
+ * entry then still restores by its raw `y`.
19
+ */
20
+ export function parseSavedScrollPosition(raw) {
21
+ let saved;
22
+ try {
23
+ saved = JSON.parse(raw ?? '{}');
24
+ }
25
+ catch {
26
+ return undefined;
27
+ }
28
+ if (typeof saved !== 'object' || saved === null) {
29
+ return undefined;
30
+ }
31
+ const { href, y, section } = saved;
32
+ if (typeof href !== 'string' || typeof y !== 'number' || !Number.isFinite(y) || y <= 0) {
33
+ return undefined;
34
+ }
35
+ return isSavedSection(section)
36
+ ? { href, y, section }
37
+ : { href, y };
38
+ }
39
+ /** Decodes a URL part, tolerating malformed input by returning it as-is. */
40
+ export function safeDecode(value) {
41
+ try {
42
+ return decodeURIComponent(value);
43
+ }
44
+ catch {
45
+ return value;
46
+ }
47
+ }
48
+ /**
49
+ * Reads the node path back out of the URL, the inverse of the component's
50
+ * address-bar updates. The URL holds the user's last location, because it
51
+ * survives both live reload and a manual refresh.
52
+ *
53
+ * Returns `undefined` when the URL holds no node path.
54
+ */
55
+ export function nodePathFromUrl(navigationType, url) {
56
+ let raw;
57
+ if (navigationType === 'path') {
58
+ raw = url.pathname === '/' ? undefined : url.pathname;
59
+ }
60
+ else {
61
+ raw = url.hash ? url.hash.slice(1) : undefined;
62
+ }
63
+ if (raw === undefined) {
64
+ return undefined;
65
+ }
66
+ const path = safeDecode(raw);
67
+ // The component writes node URIs with a leading `/`. Accept one without
68
+ // (from a hand-edited URL) instead of failing to match.
69
+ return path.startsWith('/') ? path : `/${path}`;
70
+ }
71
+ //# sourceMappingURL=preview-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preview-state.js","sourceRoot":"","sources":["../../../cli/preview-page/preview-state.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,MAAM,CAAC,MAAM,kBAAkB,GAAG,oCAAoC,CAAA;AAsBtE,SAAS,cAAc,CAAC,KAAc;IACpC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,KAAgC,CAAA;IAElE,OAAO,OAAO,EAAE,KAAK,QAAQ;WACxB,OAAO,OAAO,KAAK,QAAQ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AG,GAAG,CAAC,QAAQ,KAAK,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAA;IACvD,CAAC;SAAM,CAAC;QACN,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAChD,CAAC;IAED,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,CAAA;IAE5B,wEAAwE;IACxE,wDAAwD;IACxD,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAA;AACjD,CAAC"}
@@ -4,11 +4,10 @@
4
4
  *
5
5
  * `controlAddressBar` is always hardcoded true - the CLI, not the user, owns
6
6
  * the single-page preview environment that prop governs. `navigationType`
7
- * defaults to `'hash'` rather than the component's own `'path'` default -
8
- * with `'path'`, the CLI's server would need to fall back to the preview page
9
- * for arbitrary unmatched routes to support a browser refresh at a deep link,
10
- * which it doesn't do, so refreshing 404s; `'hash'` keeps the path client-side
11
- * only, so a refresh always hits `/`. `showPoweredBy` defaults to `true` here
7
+ * defaults to `'hash'`, not the component's own `'path'` default. The
8
+ * server serves the preview page for unknown non-asset routes, so both modes
9
+ * refresh at a deep link. `hash` also works under static hosting.
10
+ * `showPoweredBy` defaults to `true` here
12
11
  * even though the component prop itself defaults to `false` - the CLI wants
13
12
  * branding visible unless a user opts out with `--hide-powered-by`.
14
13
  * `hideNavigationButtons` defaults to `true` (hidden), matching the
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-render-options.js","sourceRoot":"","sources":["../../cli/resolve-render-options.ts"],"names":[],"mappings":"AA2DA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM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, options, distDir, previewPageDir) {
116
116
  const body = await readFile(join(previewPageDir, 'index.html'), 'utf-8');
117
117
  return { status: 200, body, contentType: 'text/html; charset=utf-8' };
118
118
  }
119
+ // The compiled client modules, served through literal branches: the
120
+ // request URL is only compared, never used as a path. Aikido taints every
121
+ // `readFile` in a function that holds the request URL, so these reads
122
+ // carry a `// nosec` false-positive suppression. Do not make these paths
123
+ // request-derived. The suppression will hide a real vulnerability then.
119
124
  if (url === '/client.js') {
120
- const body = await readFile(join(previewPageDir, 'client.js'));
125
+ const body = await readFile(join(previewPageDir, 'client.js')); // nosec
126
+ return { status: 200, body, contentType: 'text/javascript' };
127
+ }
128
+ if (url === '/preview-state.js') {
129
+ const body = await readFile(join(previewPageDir, 'preview-state.js')); // nosec
121
130
  return { status: 200, body, contentType: 'text/javascript' };
122
131
  }
123
132
  if (url?.startsWith('/assets/')) {
@@ -131,7 +140,19 @@ async function handleRequest(url, options, distDir, previewPageDir) {
131
140
  // Fall through to 404 below - e.g. the file doesn't exist.
132
141
  }
133
142
  }
143
+ // A missing asset must stay a 404. The fallback below serves HTML as
144
+ // JavaScript and hides the failure.
145
+ return { status: 404, body: 'Not found', contentType: 'text/plain' };
146
+ }
147
+ // The browser requests /favicon.ico on every load. It is not a document,
148
+ // so answer 404. The fallback would serve HTML that fails to decode as
149
+ // an image.
150
+ if (url === '/favicon.ico') {
151
+ return { status: 404, body: 'Not found', contentType: 'text/plain' };
134
152
  }
135
- return { status: 404, body: 'Not found', contentType: 'text/plain' };
153
+ // Any remaining route serves the single preview page. The client reads
154
+ // the node path back out of the URL, so deep links survive a refresh.
155
+ const body = await readFile(join(previewPageDir, 'index.html'), 'utf-8');
156
+ return { status: 200, body, contentType: 'text/html; charset=utf-8' };
136
157
  }
137
158
  //# sourceMappingURL=server.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../cli/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAA6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;QAC3B,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,CAAA;IACtE,CAAC;IAED,uEAAuE;IACvE,sEAAsE;IACtE,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC,EAAE,OAAO,CAAC,CAAA;IAExE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,0BAA0B,EAAE,CAAA;AACvE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kong/spec-renderer",
3
- "version": "1.117.4",
3
+ "version": "1.117.5-pr.1073.102030a.0",
4
4
  "description": "Kong's open-source spec renderer",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -32,30 +32,6 @@
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
- "scripts": {
36
- "dev": "cross-env USE_SANDBOX=true vite",
37
- "build": "pnpm run typecheck && pnpm run build:package && pnpm run build:webcomponent && pnpm run build:types && pnpm run build:aliases && pnpm run build:cli",
38
- "build:package": "vite build -m production",
39
- "build:webcomponent": "cross-env VITE_AS_WEB_COMPONENT='true' vite build -m production",
40
- "build:types": "vue-tsc -p './tsconfig.build.json' --emitDeclarationOnly",
41
- "build:aliases": "tsc-alias -p './tsconfig.build.json'",
42
- "build:cli": "tsc -p './tsconfig.cli.build.json' && node ./scripts/build-cli-assets.js && node ./scripts/generate-kongctl-manifest.mjs",
43
- "generate:kongctl-manifest": "pnpm run build:cli",
44
- "build:analyzer": "BUILD_VISUALIZER='true' vite build -m production",
45
- "build:sandbox": "cross-env USE_SANDBOX=true vite build -m production",
46
- "preview": "pnpm run build:sandbox && cross-env USE_SANDBOX=true vite preview",
47
- "typecheck": "vue-tsc -p './tsconfig.build.json' --noEmit && pnpm run typecheck:cli && pnpm run typecheck:scripts",
48
- "typecheck:cli": "tsc -p './tsconfig.cli.json' --noEmit",
49
- "typecheck:scripts": "tsc -p './tsconfig.scripts.json' --noEmit",
50
- "stylelint": "stylelint --allow-empty-input './src/**/*.{css,scss,vue}'",
51
- "stylelint:fix": "stylelint --allow-empty-input './src/**/*.{css,scss,sass,vue}' --fix",
52
- "lint": "eslint",
53
- "lint:fix": "eslint --fix",
54
- "test": "cross-env FORCE_COLOR=1 vitest run",
55
- "test:open": "cross-env FORCE_COLOR=1 vitest --ui",
56
- "semantic-release": "semantic-release",
57
- "commit": "cz"
58
- },
59
35
  "peerDependencies": {
60
36
  "vue": ">= 3.3.13 < 4"
61
37
  },
@@ -226,5 +202,28 @@
226
202
  "jiraAppend": "]"
227
203
  }
228
204
  },
229
- "packageManager": "pnpm@12.12.0"
230
- }
205
+ "scripts": {
206
+ "dev": "cross-env USE_SANDBOX=true vite",
207
+ "build": "pnpm run typecheck && pnpm run build:package && pnpm run build:webcomponent && pnpm run build:types && pnpm run build:aliases && pnpm run build:cli",
208
+ "build:package": "vite build -m production",
209
+ "build:webcomponent": "cross-env VITE_AS_WEB_COMPONENT='true' vite build -m production",
210
+ "build:types": "vue-tsc -p './tsconfig.build.json' --emitDeclarationOnly",
211
+ "build:aliases": "tsc-alias -p './tsconfig.build.json'",
212
+ "build:cli": "tsc -p './tsconfig.cli.build.json' && node ./scripts/build-cli-assets.js && node ./scripts/generate-kongctl-manifest.mjs",
213
+ "generate:kongctl-manifest": "pnpm run build:cli",
214
+ "build:analyzer": "BUILD_VISUALIZER='true' vite build -m production",
215
+ "build:sandbox": "cross-env USE_SANDBOX=true vite build -m production",
216
+ "preview": "pnpm run build:sandbox && cross-env USE_SANDBOX=true vite preview",
217
+ "typecheck": "vue-tsc -p './tsconfig.build.json' --noEmit && pnpm run typecheck:cli && pnpm run typecheck:scripts",
218
+ "typecheck:cli": "tsc -p './tsconfig.cli.json' --noEmit",
219
+ "typecheck:scripts": "tsc -p './tsconfig.scripts.json' --noEmit",
220
+ "stylelint": "stylelint --allow-empty-input './src/**/*.{css,scss,vue}'",
221
+ "stylelint:fix": "stylelint --allow-empty-input './src/**/*.{css,scss,sass,vue}' --fix",
222
+ "lint": "eslint",
223
+ "lint:fix": "eslint --fix",
224
+ "test": "cross-env FORCE_COLOR=1 vitest run",
225
+ "test:open": "cross-env FORCE_COLOR=1 vitest --ui",
226
+ "semantic-release": "semantic-release",
227
+ "commit": "cz"
228
+ }
229
+ }