@redocly/portal-plugin-async-api 1.0.264 → 1.0.265
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 +11 -0
- package/lib/.tsbuildinfo +1 -1
- package/lib/plugin.js +4 -8
- package/lib/plugin.js.map +1 -1
- package/package.json +15 -3
- package/src/plugin.ts +5 -7
package/lib/plugin.js
CHANGED
|
@@ -7,11 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
// FIXME: think of a way to make these imports shorter?
|
|
11
|
-
import { withPathPrefix } from '@redocly/realm/dist/shared/urls.js';
|
|
12
10
|
import * as asyncApi from '@asyncapi/parser';
|
|
13
|
-
import { Feature } from '@redocly/realm/dist/server/entitlements/entitlements.types.js';
|
|
14
|
-
import { logger } from '@redocly/realm/dist/server/utils/index.js';
|
|
15
11
|
import path from 'node:path';
|
|
16
12
|
import { asyncApiDocsConfigSchema } from './config.js';
|
|
17
13
|
const ASYNCAPI_TEMPLATE_ID = 'asyncapi-docs';
|
|
@@ -20,10 +16,10 @@ export default function asyncAPIDocsPlugin() {
|
|
|
20
16
|
const parser = new asyncApi.Parser();
|
|
21
17
|
return {
|
|
22
18
|
id: 'asyncapi',
|
|
23
|
-
requiredEntitlements: [
|
|
19
|
+
requiredEntitlements: ['asyncapi'],
|
|
24
20
|
redoclyConfigSchema: asyncApiDocsConfigSchema,
|
|
25
21
|
loaders: {
|
|
26
|
-
asyncapi: (relativePath, { fs, cache }) => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
asyncapi: (relativePath, { fs, cache, logger }) => __awaiter(this, void 0, void 0, function* () {
|
|
27
23
|
const absolutePath = path.join(fs.cwd, relativePath);
|
|
28
24
|
const { data: yaml } = yield cache.load(relativePath, 'yaml');
|
|
29
25
|
if (!yaml.asyncapi)
|
|
@@ -53,7 +49,7 @@ export default function asyncAPIDocsPlugin() {
|
|
|
53
49
|
actions.addRoute({
|
|
54
50
|
fsPath: relativePath,
|
|
55
51
|
templateId: asyncAPITemplateId,
|
|
56
|
-
getStaticData: buildGetStaticDataFn(globalSettings),
|
|
52
|
+
getStaticData: buildGetStaticDataFn(globalSettings, context.withPathPrefix),
|
|
57
53
|
metadata: Object.assign({ type: 'asyncapi', title: (_d = (_c = (_b = document === null || document === void 0 ? void 0 : document.json()) === null || _b === void 0 ? void 0 : _b.info) === null || _c === void 0 ? void 0 : _c.title) !== null && _d !== void 0 ? _d : 'AsyncAPI', description: (_g = (_f = (_e = document === null || document === void 0 ? void 0 : document.json()) === null || _e === void 0 ? void 0 : _e.info) === null || _f === void 0 ? void 0 : _f.description) !== null && _g !== void 0 ? _g : '' }, ((_k = (_j = (_h = document === null || document === void 0 ? void 0 : document.json()) === null || _h === void 0 ? void 0 : _h.info) === null || _j === void 0 ? void 0 : _j['x-metadata']) !== null && _k !== void 0 ? _k : {})),
|
|
58
54
|
sharedData: [{ key: 'AsyncApiDefinition', id: sharedDataId }],
|
|
59
55
|
});
|
|
@@ -64,7 +60,7 @@ export default function asyncAPIDocsPlugin() {
|
|
|
64
60
|
}
|
|
65
61
|
}),
|
|
66
62
|
};
|
|
67
|
-
function buildGetStaticDataFn(settings) {
|
|
63
|
+
function buildGetStaticDataFn(settings, withPathPrefix) {
|
|
68
64
|
return function (route, _context) {
|
|
69
65
|
return __awaiter(this, void 0, void 0, function* () {
|
|
70
66
|
return {
|
package/lib/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":";;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,O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,MAAA,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,EAAE,0CAAE,IAAI,0CAAE,WAAW,mCAAI,EAAE,IACnD,CAAC,MAAA,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,EAAE,0CAAE,IAAI,0CAAG,YAAY,CAAC,mCAAI,EAAE,CAAC,CAClD;wBACD,UAAU,EAAE,CAAC,EAAE,GAAG,EAAE,oBAAoB,EAAE,EAAE,EAAE,YAAY,EAAE,CAAC;qBAC9D,CAAC,CAAC;iBACJ;gBAAC,OAAO,CAAC,EAAE;oBACV,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;iBAClB;aACF;QACH,CAAC,CAAA;KACF,CAAC;IAEF,SAAS,oBAAoB,CAC3B,QAA8B,EAC9B,cAAuC;QAEvC,OAAO,UAAgB,KAAK,EAAE,QAAQ;;gBACpC,OAAO;oBACL,KAAK,EAAE;wBACL,QAAQ,kCACH,QAAQ,KACX,WAAW,EAAE,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,GACxC;qBACF;iBACF,CAAC;YACJ,CAAC;SAAA,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/portal-plugin-async-api",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Async API plugin for
|
|
3
|
+
"version": "1.0.265",
|
|
4
|
+
"description": "Async API plugin for Redocly products",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./lib/plugin.js",
|
|
@@ -36,12 +36,24 @@
|
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"react": "^18.0.0",
|
|
38
38
|
"react-dom": "^18.0.0",
|
|
39
|
-
"@redocly/
|
|
39
|
+
"@redocly/redoc": "0.100.5",
|
|
40
|
+
"@redocly/redoc-reef": "0.100.5",
|
|
41
|
+
"@redocly/redoc-revel": "0.100.5",
|
|
42
|
+
"@redocly/realm": "0.100.5",
|
|
40
43
|
"@redocly/theme": "0.42.3"
|
|
41
44
|
},
|
|
42
45
|
"peerDependenciesMeta": {
|
|
43
46
|
"@redocly/realm": {
|
|
44
47
|
"optional": true
|
|
48
|
+
},
|
|
49
|
+
"@redocly/redoc": {
|
|
50
|
+
"optional": true
|
|
51
|
+
},
|
|
52
|
+
"@redocly/redoc-reef": {
|
|
53
|
+
"optional": true
|
|
54
|
+
},
|
|
55
|
+
"@redocly/redoc-revel": {
|
|
56
|
+
"optional": true
|
|
45
57
|
}
|
|
46
58
|
},
|
|
47
59
|
"overrides": {
|
package/src/plugin.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
// FIXME: think of a way to make these imports shorter?
|
|
2
|
-
import { withPathPrefix } from '@redocly/realm/dist/shared/urls.js';
|
|
3
1
|
import * as asyncApi from '@asyncapi/parser';
|
|
4
|
-
import { Feature } from '@redocly/realm/dist/server/entitlements/entitlements.types.js';
|
|
5
|
-
import { logger } from '@redocly/realm/dist/server/utils/index.js';
|
|
6
2
|
import path from 'node:path';
|
|
7
3
|
|
|
8
4
|
import type { AsyncAPIDocumentInterface } from '@asyncapi/parser';
|
|
9
5
|
import type { PageStaticData } from '@redocly/realm/dist/shared/types';
|
|
6
|
+
import type { Feature } from '@redocly/realm/dist/server/entitlements/entitlements.types';
|
|
10
7
|
import type {
|
|
11
8
|
GetStaticDataFn,
|
|
12
9
|
PageRouteDetails,
|
|
@@ -24,10 +21,10 @@ export default function asyncAPIDocsPlugin(): ExternalPlugin {
|
|
|
24
21
|
|
|
25
22
|
return {
|
|
26
23
|
id: 'asyncapi',
|
|
27
|
-
requiredEntitlements: [Feature
|
|
24
|
+
requiredEntitlements: ['asyncapi' as Feature],
|
|
28
25
|
redoclyConfigSchema: asyncApiDocsConfigSchema as any,
|
|
29
26
|
loaders: {
|
|
30
|
-
asyncapi: async (relativePath, { fs, cache }) => {
|
|
27
|
+
asyncapi: async (relativePath, { fs, cache, logger }) => {
|
|
31
28
|
const absolutePath = path.join(fs.cwd, relativePath);
|
|
32
29
|
const { data: yaml } = await cache.load<any>(relativePath, 'yaml');
|
|
33
30
|
if (!yaml.asyncapi) return undefined;
|
|
@@ -73,7 +70,7 @@ export default function asyncAPIDocsPlugin(): ExternalPlugin {
|
|
|
73
70
|
actions.addRoute({
|
|
74
71
|
fsPath: relativePath,
|
|
75
72
|
templateId: asyncAPITemplateId,
|
|
76
|
-
getStaticData: buildGetStaticDataFn(globalSettings),
|
|
73
|
+
getStaticData: buildGetStaticDataFn(globalSettings, context.withPathPrefix),
|
|
77
74
|
metadata: {
|
|
78
75
|
type: 'asyncapi',
|
|
79
76
|
title: document?.json()?.info?.title ?? 'AsyncAPI',
|
|
@@ -91,6 +88,7 @@ export default function asyncAPIDocsPlugin(): ExternalPlugin {
|
|
|
91
88
|
|
|
92
89
|
function buildGetStaticDataFn(
|
|
93
90
|
settings: AsyncApiDocsSettings,
|
|
91
|
+
withPathPrefix: (url: string) => string,
|
|
94
92
|
): GetStaticDataFn<PageRouteDetails, PageStaticData> {
|
|
95
93
|
return async function (route, _context) {
|
|
96
94
|
return {
|