@seshuk/payload-plugin-openapi 0.2.1 → 0.2.3

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 (2) hide show
  1. package/dist/ui/html.js +2 -2
  2. package/package.json +27 -39
package/dist/ui/html.js CHANGED
@@ -1,8 +1,8 @@
1
1
  const escapeHtml = (value)=>value.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
2
- const jsonForScript = (value)=>JSON.stringify(value ?? {}).replace(/</g, '\\u003c');
2
+ const jsonForScript = (value)=>JSON.stringify(value ?? {}).replace(/[<>&\u2028\u2029]/g, (char)=>`\\u${char.charCodeAt(0).toString(16).padStart(4, '0')}`);
3
3
  const htmlPage = ({ title, head, body })=>`<!doctype html><html><head><meta charset="utf-8"/><title>${escapeHtml(title)}</title><meta name="viewport" content="width=device-width, initial-scale=1"/>${head}</head><body>${body}</body></html>`;
4
4
  const specUrlExpr = (specUrl)=>{
5
- const u = JSON.stringify(specUrl);
5
+ const u = jsonForScript(specUrl);
6
6
  return `(function(){var l=new URLSearchParams(location.search).get('lang');return ${u}+(l?((${u}.indexOf('?')>-1?'&':'?')+'lang='+encodeURIComponent(l)):'')})()`;
7
7
  };
8
8
  export { escapeHtml, htmlPage, jsonForScript, specUrlExpr };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seshuk/payload-plugin-openapi",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "OpenAPI 3.0/3.1/3.2 spec generator for Payload CMS, with Scalar/Swagger UI.",
5
5
  "keywords": [
6
6
  "api-docs",
@@ -28,47 +28,15 @@
28
28
  "dist"
29
29
  ],
30
30
  "type": "module",
31
- "main": "./src/index.ts",
32
- "types": "./src/index.ts",
31
+ "main": "./dist/index.js",
32
+ "types": "./dist/index.d.ts",
33
33
  "exports": {
34
34
  ".": {
35
- "import": "./src/index.ts",
36
- "types": "./src/index.ts",
37
- "default": "./src/index.ts"
38
- },
39
- "./*": "./*"
40
- },
41
- "publishConfig": {
42
- "main": "./dist/index.js",
43
- "types": "./dist/index.d.ts",
44
- "exports": {
45
- ".": {
46
- "import": "./dist/index.js",
47
- "types": "./dist/index.d.ts",
48
- "default": "./dist/index.js"
49
- }
35
+ "import": "./dist/index.js",
36
+ "types": "./dist/index.d.ts",
37
+ "default": "./dist/index.js"
50
38
  }
51
39
  },
52
- "scripts": {
53
- "build": "rslib build",
54
- "build:watch": "rslib build --watch",
55
- "dev": "cross-env PAYLOAD_CONFIG_PATH=./tests/payload.config.ts next dev tests --turbo",
56
- "dev:safe": "rm -rf .next && cross-env PAYLOAD_CONFIG_PATH=./tests/payload.config.ts next dev tests --turbo --port 3001",
57
- "dev:generate-importmap": "cd tests && cross-env PAYLOAD_CONFIG_PATH=./payload.config.ts payload generate:importmap",
58
- "docs:check-links": "pnpm --dir docs check-links",
59
- "docs:dev": "pnpm --dir docs dev",
60
- "docs:validate": "pnpm --dir docs validate",
61
- "lint": "oxlint src tests",
62
- "lint:fix": "oxlint src tests --fix",
63
- "format": "oxfmt .",
64
- "format:check": "oxfmt --check .",
65
- "test": "vitest run",
66
- "test:watch": "vitest",
67
- "typecheck": "tsc --noEmit",
68
- "release:patch": "pnpm version patch -m \"chore(release): v%s\"",
69
- "release:minor": "pnpm version minor -m \"chore(release): v%s\"",
70
- "release:major": "pnpm version major -m \"chore(release): v%s\""
71
- },
72
40
  "dependencies": {
73
41
  "@scalar/openapi-types": "^0.9.1"
74
42
  },
@@ -95,5 +63,25 @@
95
63
  },
96
64
  "engines": {
97
65
  "node": ">=20.9.0"
66
+ },
67
+ "scripts": {
68
+ "build": "rslib build",
69
+ "build:watch": "rslib build --watch",
70
+ "dev": "cross-env PAYLOAD_CONFIG_PATH=./tests/payload.config.ts next dev tests --turbo",
71
+ "dev:safe": "rm -rf .next && cross-env PAYLOAD_CONFIG_PATH=./tests/payload.config.ts next dev tests --turbo --port 3001",
72
+ "dev:generate-importmap": "cd tests && cross-env PAYLOAD_CONFIG_PATH=./payload.config.ts payload generate:importmap",
73
+ "docs:check-links": "pnpm --dir docs check-links",
74
+ "docs:dev": "pnpm --dir docs dev",
75
+ "docs:validate": "pnpm --dir docs validate",
76
+ "lint": "oxlint src tests",
77
+ "lint:fix": "oxlint src tests --fix",
78
+ "format": "oxfmt .",
79
+ "format:check": "oxfmt --check .",
80
+ "test": "vitest run",
81
+ "test:watch": "vitest",
82
+ "typecheck": "tsc --noEmit",
83
+ "release:patch": "pnpm version patch -m \"chore(release): v%s\"",
84
+ "release:minor": "pnpm version minor -m \"chore(release): v%s\"",
85
+ "release:major": "pnpm version major -m \"chore(release): v%s\""
98
86
  }
99
- }
87
+ }