@nullplatform/ui-plugin-sdk 0.10.0 → 0.11.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/README.md +32 -0
- package/bin/ui-plugin-sdk.mjs +49 -0
- package/cli/devServer.mjs +99 -0
- package/dist/contract/allowlist.d.ts +2 -0
- package/dist/contract/allowlist.js +1 -1
- package/dist/contract/fixtures.d.ts +17 -0
- package/dist/contract/fixtures.js +27 -0
- package/dist/contract/index.d.ts +1 -0
- package/dist/contract/index.js +1 -0
- package/dist/contract-cjs/allowlist.js +1 -0
- package/dist/contract-cjs/fixtures.js +30 -0
- package/dist/contract-cjs/index.js +3 -1
- package/package.json +15 -3
package/README.md
CHANGED
|
@@ -36,3 +36,35 @@ The SDK carries no API keys. Publish your plugin bundle through the UI API, pin
|
|
|
36
36
|
as a `ui_bundle` component of a central nullplatform Package, and install the exact
|
|
37
37
|
package revision on the desired NRN. Installing this npm SDK does not publish or
|
|
38
38
|
install a plugin in nullplatform.
|
|
39
|
+
|
|
40
|
+
## Local development
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm install --save-dev vite @vitejs/plugin-react
|
|
44
|
+
npx ui-plugin-sdk dev --https
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`ui-plugin-sdk dev` rebuilds the plugin with your project's Vite on every change and
|
|
48
|
+
serves `manifest.json`, `dist/plugin.js` and `fixtures.json` on `localhost:4300`
|
|
49
|
+
(`--port` to change it). The nullplatform dashboard only loads `https://localhost`,
|
|
50
|
+
so serve with `--https` and a locally trusted certificate, by default
|
|
51
|
+
`.certs/localhost.pem` and `.certs/localhost-key.pem`:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
mkcert -install
|
|
55
|
+
mkcert -cert-file .certs/localhost.pem -key-file .certs/localhost-key.pem localhost 127.0.0.1
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`fixtures.json` holds test answers for the plugin's API calls, keyed like the
|
|
59
|
+
manifest's `permissions.api`. A preview answers from it instead of the API, and a
|
|
60
|
+
call with no fixture fails as a 404:
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"GET /application/{id}": { "id": 42, "name": "checkout-api" },
|
|
65
|
+
"GET /scope": { "results": [{ "id": 1, "name": "production" }] }
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The query string is not part of the key, and a key with more literal segments wins
|
|
70
|
+
(`/application/me` over `/application/{id}`).
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { parseArgs } from 'node:util';
|
|
3
|
+
import { resolve } from 'node:path';
|
|
4
|
+
import { startDevServer } from '../cli/devServer.mjs';
|
|
5
|
+
|
|
6
|
+
const HELP = `Usage: ui-plugin-sdk dev [options]
|
|
7
|
+
|
|
8
|
+
Rebuilds your plugin on every change and serves manifest.json, dist/plugin.js and
|
|
9
|
+
fixtures.json on localhost, ready to load from the nullplatform dashboard.
|
|
10
|
+
|
|
11
|
+
Options:
|
|
12
|
+
--port <n> port to serve on (default: $PORT or 4300)
|
|
13
|
+
--https serve over https; the deployed dashboard only loads https://localhost
|
|
14
|
+
--cert <file> certificate for --https (default: $DEV_TLS_CERT or .certs/localhost.pem)
|
|
15
|
+
--key <file> key for --https (default: $DEV_TLS_KEY or .certs/localhost-key.pem)
|
|
16
|
+
--root <dir> the plugin's folder (default: the current one)
|
|
17
|
+
-h, --help show this help
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
const { values, positionals } = parseArgs({
|
|
21
|
+
allowPositionals: true,
|
|
22
|
+
options: {
|
|
23
|
+
port: { type: 'string' },
|
|
24
|
+
https: { type: 'boolean' },
|
|
25
|
+
cert: { type: 'string' },
|
|
26
|
+
key: { type: 'string' },
|
|
27
|
+
root: { type: 'string' },
|
|
28
|
+
help: { type: 'boolean', short: 'h' },
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
if (values.help || positionals[0] !== 'dev') {
|
|
33
|
+
console.log(HELP);
|
|
34
|
+
process.exit(values.help ? 0 : 1);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const port = Number(values.port ?? process.env.PORT ?? 4300);
|
|
38
|
+
if (!Number.isInteger(port) || port <= 0) {
|
|
39
|
+
console.error(`[plugin dev] invalid port: ${values.port ?? process.env.PORT}`);
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
await startDevServer({
|
|
44
|
+
root: resolve(values.root ?? process.cwd()),
|
|
45
|
+
port,
|
|
46
|
+
https: values.https || ['1', 'true'].includes(String(process.env.HTTPS ?? '').toLowerCase()),
|
|
47
|
+
cert: values.cert,
|
|
48
|
+
key: values.key,
|
|
49
|
+
});
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ui-plugin-sdk dev`: rebuilds the plugin on every change (Vite, from the plugin's own project)
|
|
3
|
+
* and serves `manifest.json`, `dist/plugin.js` and `fixtures.json` on localhost, with the CORS,
|
|
4
|
+
* private-network and ETag headers a host needs to load and reload it.
|
|
5
|
+
*
|
|
6
|
+
* The deployed dashboard only reaches `https://localhost` (its CSP allows `https:` and scheme-less
|
|
7
|
+
* `localhost:*`, which inherits the page's https), so loading a plugin there needs `--https` and a
|
|
8
|
+
* locally trusted certificate, e.g. from mkcert.
|
|
9
|
+
*/
|
|
10
|
+
import { createServer as createHttpServer } from 'node:http';
|
|
11
|
+
import { createServer as createHttpsServer } from 'node:https';
|
|
12
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
13
|
+
import { readFile, stat } from 'node:fs/promises';
|
|
14
|
+
import { createRequire } from 'node:module';
|
|
15
|
+
import { dirname, join, resolve } from 'node:path';
|
|
16
|
+
import { pathToFileURL } from 'node:url';
|
|
17
|
+
|
|
18
|
+
const FILES = {
|
|
19
|
+
'/manifest.json': { path: 'manifest.json', type: 'application/json' },
|
|
20
|
+
'/plugin.js': { path: 'dist/plugin.js', type: 'text/javascript' },
|
|
21
|
+
'/fixtures.json': { path: 'fixtures.json', type: 'application/json', optional: true },
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/** The request handler, on its own so it can be tested without a build. */
|
|
25
|
+
export function createDevHandler({ root }) {
|
|
26
|
+
return async (req, res) => {
|
|
27
|
+
const url = new URL(req.url ?? '/', 'http://localhost');
|
|
28
|
+
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
29
|
+
res.setHeader('Access-Control-Allow-Headers', '*');
|
|
30
|
+
res.setHeader('Access-Control-Expose-Headers', 'ETag');
|
|
31
|
+
// Chrome asks before a public page (the deployed dashboard) reaches localhost.
|
|
32
|
+
res.setHeader('Access-Control-Allow-Private-Network', 'true');
|
|
33
|
+
res.setHeader('Cache-Control', 'no-store');
|
|
34
|
+
if (req.method === 'OPTIONS') return res.writeHead(204).end();
|
|
35
|
+
const file = FILES[url.pathname];
|
|
36
|
+
if (!file) return res.writeHead(404).end('not found');
|
|
37
|
+
const path = resolve(root, file.path);
|
|
38
|
+
const info = await stat(path).catch(() => null);
|
|
39
|
+
// A plugin without fixtures has none; a missing bundle is one Vite has not finished yet.
|
|
40
|
+
if (!info) return file.optional ? res.writeHead(404).end('no fixtures') : res.writeHead(503).end('not built yet');
|
|
41
|
+
const etag = `"${info.mtimeMs}"`;
|
|
42
|
+
res.setHeader('ETag', etag);
|
|
43
|
+
res.setHeader('Content-Type', file.type);
|
|
44
|
+
if (req.method === 'HEAD') return res.writeHead(200).end();
|
|
45
|
+
if (req.headers['if-none-match'] === etag) return res.writeHead(304).end();
|
|
46
|
+
res.writeHead(200).end(await readFile(path));
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** `--cert`/`--key`, then DEV_TLS_CERT/DEV_TLS_KEY, then `.certs/` in the plugin or any folder above it. */
|
|
51
|
+
export function findCertificate({ root, cert, key }) {
|
|
52
|
+
if (cert || key) return { cert, key };
|
|
53
|
+
if (process.env.DEV_TLS_CERT || process.env.DEV_TLS_KEY) return { cert: process.env.DEV_TLS_CERT, key: process.env.DEV_TLS_KEY };
|
|
54
|
+
for (let dir = resolve(root); ; dir = dirname(dir)) {
|
|
55
|
+
const candidate = { cert: join(dir, '.certs/localhost.pem'), key: join(dir, '.certs/localhost-key.pem') };
|
|
56
|
+
if (existsSync(candidate.cert) && existsSync(candidate.key)) return candidate;
|
|
57
|
+
if (dirname(dir) === dir) return { cert: join(resolve(root), '.certs/localhost.pem'), key: join(resolve(root), '.certs/localhost-key.pem') };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** The plugin's own Vite: the SDK ships inside every plugin bundle, so it never depends on a build tool. */
|
|
62
|
+
export async function loadVite(root) {
|
|
63
|
+
const require = createRequire(join(resolve(root), 'package.json'));
|
|
64
|
+
let manifestPath;
|
|
65
|
+
try {
|
|
66
|
+
manifestPath = require.resolve('vite/package.json');
|
|
67
|
+
} catch {
|
|
68
|
+
throw new Error('ui-plugin-sdk dev builds your plugin with Vite. Add it to the plugin: npm install --save-dev vite');
|
|
69
|
+
}
|
|
70
|
+
const { exports } = JSON.parse(await readFile(manifestPath, 'utf8'));
|
|
71
|
+
// Vite 7 exports `.` as a plain path; 5 and 6 nest it under `import`.
|
|
72
|
+
const main = exports?.['.'];
|
|
73
|
+
const entry = typeof main === 'string' ? main : (main?.import?.default ?? main?.import ?? main?.default);
|
|
74
|
+
if (typeof entry !== 'string') throw new Error(`Can't find Vite's ESM entry in ${manifestPath}`);
|
|
75
|
+
return import(pathToFileURL(join(dirname(manifestPath), entry)).href);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export async function startDevServer({ root, port, https, cert, key }) {
|
|
79
|
+
let tls;
|
|
80
|
+
if (https) {
|
|
81
|
+
const paths = findCertificate({ root, cert, key });
|
|
82
|
+
if (!paths.cert || !paths.key || !existsSync(paths.cert) || !existsSync(paths.key)) {
|
|
83
|
+
console.error(`[plugin dev] --https needs a trusted localhost certificate (looked for ${paths.cert} and ${paths.key}).`);
|
|
84
|
+
console.error('[plugin dev] mkcert -install');
|
|
85
|
+
console.error(`[plugin dev] mkcert -cert-file ${paths.cert} -key-file ${paths.key} localhost 127.0.0.1`);
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
tls = { cert: readFileSync(paths.cert), key: readFileSync(paths.key) };
|
|
89
|
+
}
|
|
90
|
+
const { build } = await loadVite(root);
|
|
91
|
+
const handler = createDevHandler({ root });
|
|
92
|
+
const server = tls ? createHttpsServer(tls, handler) : createHttpServer(handler);
|
|
93
|
+
const origin = `${tls ? 'https' : 'http'}://localhost:${port}`;
|
|
94
|
+
server.listen(port, () => {
|
|
95
|
+
console.log(`[plugin dev] serving manifest.json, plugin.js and fixtures.json on ${origin}`);
|
|
96
|
+
if (!tls) console.log('[plugin dev] the deployed dashboard only loads https://localhost: run with --https');
|
|
97
|
+
});
|
|
98
|
+
await build({ root, build: { watch: {} }, logLevel: 'info' });
|
|
99
|
+
}
|
|
@@ -7,6 +7,8 @@ export declare function normalizePath(path: string): string[] | null;
|
|
|
7
7
|
* that nothing downstream can resolve a path other than the authorized one.
|
|
8
8
|
*/
|
|
9
9
|
export declare function canonicalizePath(path: string): string | null;
|
|
10
|
+
/** `{param}` placeholders match exactly one non-empty segment. */
|
|
11
|
+
export declare function pathMatches(pattern: string, requestSegments: string[]): boolean;
|
|
10
12
|
/**
|
|
11
13
|
* Decides whether a plugin API request (a nullplatform public API path) is covered
|
|
12
14
|
* by its declared `permissions.api`. Query strings are never part of the decision.
|
|
@@ -31,7 +31,7 @@ export function canonicalizePath(path) {
|
|
|
31
31
|
return segments ? '/' + segments.map(encodeURIComponent).join('/') : null;
|
|
32
32
|
}
|
|
33
33
|
/** `{param}` placeholders match exactly one non-empty segment. */
|
|
34
|
-
function pathMatches(pattern, requestSegments) {
|
|
34
|
+
export function pathMatches(pattern, requestSegments) {
|
|
35
35
|
const patternSegments = normalizePath(pattern);
|
|
36
36
|
if (!patternSegments || patternSegments.length !== requestSegments.length)
|
|
37
37
|
return false;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A plugin's local test data: response bodies keyed by `"METHOD /path"`, in the manifest's own
|
|
3
|
+
* permission syntax, so `"GET /application/{id}"` answers any application id. The query string is
|
|
4
|
+
* never part of the key; a list response carries its own paging.
|
|
5
|
+
*/
|
|
6
|
+
export type Fixtures = Record<string, unknown>;
|
|
7
|
+
export interface FixtureMatch {
|
|
8
|
+
/** The key that answered, as written in the fixtures. */
|
|
9
|
+
key: string;
|
|
10
|
+
body: unknown;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The fixture that answers a plugin API request, or null. A key with more literal segments beats
|
|
14
|
+
* one with more placeholders (`/application/me` over `/application/{id}`); between equals, the
|
|
15
|
+
* first one written wins. Keys that are not `METHOD /path` never match.
|
|
16
|
+
*/
|
|
17
|
+
export declare function matchFixture(fixtures: Fixtures, method: string, path: string): FixtureMatch | null;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { normalizePath, pathMatches } from './allowlist.js';
|
|
2
|
+
const KEY = /^([A-Z]+|\*) (\/\S*)$/;
|
|
3
|
+
const literalSegments = (segments) => segments.filter((segment) => !(segment.startsWith('{') && segment.endsWith('}'))).length;
|
|
4
|
+
/**
|
|
5
|
+
* The fixture that answers a plugin API request, or null. A key with more literal segments beats
|
|
6
|
+
* one with more placeholders (`/application/me` over `/application/{id}`); between equals, the
|
|
7
|
+
* first one written wins. Keys that are not `METHOD /path` never match.
|
|
8
|
+
*/
|
|
9
|
+
export function matchFixture(fixtures, method, path) {
|
|
10
|
+
const requestSegments = normalizePath(path);
|
|
11
|
+
if (!requestSegments || !fixtures || typeof fixtures !== 'object')
|
|
12
|
+
return null;
|
|
13
|
+
const requestMethod = method.toUpperCase();
|
|
14
|
+
let best = null;
|
|
15
|
+
for (const key of Object.keys(fixtures)) {
|
|
16
|
+
const parsed = KEY.exec(key);
|
|
17
|
+
if (!parsed || (parsed[1] !== '*' && parsed[1] !== requestMethod))
|
|
18
|
+
continue;
|
|
19
|
+
const patternSegments = normalizePath(parsed[2]);
|
|
20
|
+
if (!patternSegments || !pathMatches(parsed[2], requestSegments))
|
|
21
|
+
continue;
|
|
22
|
+
const literals = literalSegments(patternSegments);
|
|
23
|
+
if (!best || literals > best.literals)
|
|
24
|
+
best = { key, literals };
|
|
25
|
+
}
|
|
26
|
+
return best ? { key: best.key, body: fixtures[best.key] } : null;
|
|
27
|
+
}
|
package/dist/contract/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { PROTOCOL_VERSION, validateManifest, isSectionSlot, ManifestError, type PluginManifest, type Contribution, type ApiPermission, type HttpPermission, type HttpMethod, } from './manifest.js';
|
|
2
2
|
export { isApiRequestAllowed, isHttpRequestAllowed, isRequestAllowed, normalizePath, canonicalizePath } from './allowlist.js';
|
|
3
|
+
export { matchFixture, type Fixtures, type FixtureMatch } from './fixtures.js';
|
|
3
4
|
export { CONTEXT_ROOTS, extractRoots, validateWhen, evaluateWhen, rolloutIncludes, WhenError, type WhenQuery, type ContextRoot, type Rollout, } from './when.js';
|
|
4
5
|
export { PLUGIN_STORAGE_ORIGIN, validateStorageUrl, resolveAssetUrl } from './storage.js';
|
|
5
6
|
export { TOPIC_VALUE_MAX_CHARS, isTopicName, isHostTopic, topicOwner, isFieldPath, consumeGrant, canProvideTopic, projectFields, redactBySchema, assertTopicValue, type TopicPermissions, type TopicConsumePermission, type TopicProvidePermission, } from './topics.js';
|
package/dist/contract/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { PROTOCOL_VERSION, validateManifest, isSectionSlot, ManifestError, } from './manifest.js';
|
|
2
2
|
export { isApiRequestAllowed, isHttpRequestAllowed, isRequestAllowed, normalizePath, canonicalizePath } from './allowlist.js';
|
|
3
|
+
export { matchFixture } from './fixtures.js';
|
|
3
4
|
export { CONTEXT_ROOTS, extractRoots, validateWhen, evaluateWhen, rolloutIncludes, WhenError, } from './when.js';
|
|
4
5
|
export { PLUGIN_STORAGE_ORIGIN, validateStorageUrl, resolveAssetUrl } from './storage.js';
|
|
5
6
|
export { TOPIC_VALUE_MAX_CHARS, isTopicName, isHostTopic, topicOwner, isFieldPath, consumeGrant, canProvideTopic, projectFields, redactBySchema, assertTopicValue, } from './topics.js';
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.isRequestAllowed = void 0;
|
|
4
4
|
exports.normalizePath = normalizePath;
|
|
5
5
|
exports.canonicalizePath = canonicalizePath;
|
|
6
|
+
exports.pathMatches = pathMatches;
|
|
6
7
|
exports.isApiRequestAllowed = isApiRequestAllowed;
|
|
7
8
|
exports.isHttpRequestAllowed = isHttpRequestAllowed;
|
|
8
9
|
/** Splits a path into segments; rejects traversal, empty segments and query/hash fragments. */
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.matchFixture = matchFixture;
|
|
4
|
+
const allowlist_1 = require("./allowlist");
|
|
5
|
+
const KEY = /^([A-Z]+|\*) (\/\S*)$/;
|
|
6
|
+
const literalSegments = (segments) => segments.filter((segment) => !(segment.startsWith('{') && segment.endsWith('}'))).length;
|
|
7
|
+
/**
|
|
8
|
+
* The fixture that answers a plugin API request, or null. A key with more literal segments beats
|
|
9
|
+
* one with more placeholders (`/application/me` over `/application/{id}`); between equals, the
|
|
10
|
+
* first one written wins. Keys that are not `METHOD /path` never match.
|
|
11
|
+
*/
|
|
12
|
+
function matchFixture(fixtures, method, path) {
|
|
13
|
+
const requestSegments = (0, allowlist_1.normalizePath)(path);
|
|
14
|
+
if (!requestSegments || !fixtures || typeof fixtures !== 'object')
|
|
15
|
+
return null;
|
|
16
|
+
const requestMethod = method.toUpperCase();
|
|
17
|
+
let best = null;
|
|
18
|
+
for (const key of Object.keys(fixtures)) {
|
|
19
|
+
const parsed = KEY.exec(key);
|
|
20
|
+
if (!parsed || (parsed[1] !== '*' && parsed[1] !== requestMethod))
|
|
21
|
+
continue;
|
|
22
|
+
const patternSegments = (0, allowlist_1.normalizePath)(parsed[2]);
|
|
23
|
+
if (!patternSegments || !(0, allowlist_1.pathMatches)(parsed[2], requestSegments))
|
|
24
|
+
continue;
|
|
25
|
+
const literals = literalSegments(patternSegments);
|
|
26
|
+
if (!best || literals > best.literals)
|
|
27
|
+
best = { key, literals };
|
|
28
|
+
}
|
|
29
|
+
return best ? { key: best.key, body: fixtures[best.key] } : null;
|
|
30
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assertTopicValue = exports.redactBySchema = exports.projectFields = exports.canProvideTopic = exports.consumeGrant = exports.isFieldPath = exports.topicOwner = exports.isHostTopic = exports.isTopicName = exports.TOPIC_VALUE_MAX_CHARS = exports.resolveAssetUrl = exports.validateStorageUrl = exports.PLUGIN_STORAGE_ORIGIN = exports.WhenError = exports.rolloutIncludes = exports.evaluateWhen = exports.validateWhen = exports.extractRoots = exports.CONTEXT_ROOTS = exports.canonicalizePath = exports.normalizePath = exports.isRequestAllowed = exports.isHttpRequestAllowed = exports.isApiRequestAllowed = exports.ManifestError = exports.isSectionSlot = exports.validateManifest = exports.PROTOCOL_VERSION = void 0;
|
|
3
|
+
exports.assertTopicValue = exports.redactBySchema = exports.projectFields = exports.canProvideTopic = exports.consumeGrant = exports.isFieldPath = exports.topicOwner = exports.isHostTopic = exports.isTopicName = exports.TOPIC_VALUE_MAX_CHARS = exports.resolveAssetUrl = exports.validateStorageUrl = exports.PLUGIN_STORAGE_ORIGIN = exports.WhenError = exports.rolloutIncludes = exports.evaluateWhen = exports.validateWhen = exports.extractRoots = exports.CONTEXT_ROOTS = exports.matchFixture = exports.canonicalizePath = exports.normalizePath = exports.isRequestAllowed = exports.isHttpRequestAllowed = exports.isApiRequestAllowed = exports.ManifestError = exports.isSectionSlot = exports.validateManifest = exports.PROTOCOL_VERSION = void 0;
|
|
4
4
|
var manifest_1 = require("./manifest");
|
|
5
5
|
Object.defineProperty(exports, "PROTOCOL_VERSION", { enumerable: true, get: function () { return manifest_1.PROTOCOL_VERSION; } });
|
|
6
6
|
Object.defineProperty(exports, "validateManifest", { enumerable: true, get: function () { return manifest_1.validateManifest; } });
|
|
@@ -12,6 +12,8 @@ Object.defineProperty(exports, "isHttpRequestAllowed", { enumerable: true, get:
|
|
|
12
12
|
Object.defineProperty(exports, "isRequestAllowed", { enumerable: true, get: function () { return allowlist_1.isRequestAllowed; } });
|
|
13
13
|
Object.defineProperty(exports, "normalizePath", { enumerable: true, get: function () { return allowlist_1.normalizePath; } });
|
|
14
14
|
Object.defineProperty(exports, "canonicalizePath", { enumerable: true, get: function () { return allowlist_1.canonicalizePath; } });
|
|
15
|
+
var fixtures_1 = require("./fixtures");
|
|
16
|
+
Object.defineProperty(exports, "matchFixture", { enumerable: true, get: function () { return fixtures_1.matchFixture; } });
|
|
15
17
|
var when_1 = require("./when");
|
|
16
18
|
Object.defineProperty(exports, "CONTEXT_ROOTS", { enumerable: true, get: function () { return when_1.CONTEXT_ROOTS; } });
|
|
17
19
|
Object.defineProperty(exports, "extractRoots", { enumerable: true, get: function () { return when_1.extractRoots; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nullplatform/ui-plugin-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "SDK for nullplatform UI plugins: catalog components, bridge client and defineUI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -27,8 +27,14 @@
|
|
|
27
27
|
"require": "./dist/contract-cjs/index.js"
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
|
+
"bin": {
|
|
31
|
+
"ui-plugin-sdk": "./bin/ui-plugin-sdk.mjs"
|
|
32
|
+
},
|
|
30
33
|
"files": [
|
|
31
|
-
"dist"
|
|
34
|
+
"dist",
|
|
35
|
+
"bin",
|
|
36
|
+
"cli",
|
|
37
|
+
"!cli/*.test.mjs"
|
|
32
38
|
],
|
|
33
39
|
"scripts": {
|
|
34
40
|
"build": "tsc -p tsconfig.json && tsc -p tsconfig.contract.cjs.json && node scripts/finish-build.mjs && node scripts/check-node-imports.mjs",
|
|
@@ -44,7 +50,13 @@
|
|
|
44
50
|
},
|
|
45
51
|
"peerDependencies": {
|
|
46
52
|
"react": "^18.2.0",
|
|
47
|
-
"react-dom": "^18.2.0"
|
|
53
|
+
"react-dom": "^18.2.0",
|
|
54
|
+
"vite": ">=5"
|
|
55
|
+
},
|
|
56
|
+
"peerDependenciesMeta": {
|
|
57
|
+
"vite": {
|
|
58
|
+
"optional": true
|
|
59
|
+
}
|
|
48
60
|
},
|
|
49
61
|
"devDependencies": {
|
|
50
62
|
"react": "18.2.0",
|