Files
webstudio/packages/sdk-components-react/package.json
T
Oleg Isonen b113399021 fix: Restore Vercel sanitizer compatibility (#6103)
## Summary

Pin `sanitize-html` to 2.17.5 so deployed server bundles continue using
the CommonJS-compatible `htmlparser2@10`.

## Root cause

`sanitize-html@2.17.6` is still a CommonJS package but upgraded its
parser dependency to ESM-only `htmlparser2@12`. Vercel's Node function
loader rejects the resulting `require("htmlparser2")` call with
`ERR_REQUIRE_ESM`.

## Technical choice

Downgrade one patch release instead of patching third-party code or
adding a repository-wide parser override. This keeps the compatibility
constraint local to the package that owns `sanitize-html` and preserves
the existing sanitization API.

There are no migrations or public API changes.

## Todo

- [x] Pin `sanitize-html` to 2.17.5
- [x] Regenerate the pnpm lockfile
- [x] Verify CommonJS loading and sanitization
- [x] Run the affected package tests
- [x] Run the affected package typecheck
- [x] Check formatting
- [x] Run a Vercel standalone build and production-start smoke test
- [x] Review documentation impact — no user-facing documentation changes
are required
- [x] Review fixture impact — no fixture inputs or outputs are affected

## Verification

- CommonJS load and sanitization smoke test
- `pnpm test` in `packages/sdk-components-react`: 126 passed, 1 skipped
- `pnpm typecheck` in `packages/sdk-components-react`
- `pnpm exec oxfmt --check packages/sdk-components-react/package.json
pnpm-lock.yaml`
- Vercel CLI 58.9.3 standalone build with a forced `MarkdownEmbed`
server-render path
- Production SSR startup and `GET /`: HTTP 200 with the sanitized
Markdown heading rendered

## Known limitations

This intentionally stays on 2.17.5 until `sanitize-html` and the
deployment bundler have a compatible CommonJS/ESM integration.
2026-08-11 22:44:29 +02:00

118 lines
3.9 KiB
JSON

{
"name": "@webstudio-is/sdk-components-react",
"version": "0.0.0-webstudio-version",
"description": "Webstudio default library for react",
"author": "Webstudio <github@webstudio.is>",
"homepage": "https://webstudio.is",
"license": "AGPL-3.0-or-later",
"private": false,
"type": "module",
"sideEffects": false,
"files": [
"lib/*",
"!*.{test,stories}.*"
],
"exports": {
".": {
"webstudio": "./src/index.ts",
"types": "./lib/types/index.d.ts",
"import": "./lib/index.js"
},
"./components": {
"webstudio": "./src/components.ts",
"types": "./lib/types/components.d.ts",
"import": "./lib/components.js"
},
"./code-text": {
"webstudio": "./src/code-text/index.tsx",
"types": "./lib/types/code-text/index.d.ts",
"import": "./lib/code-text/index.js"
},
"./code-text/build": {
"webstudio": "./src/code-text/build.ts",
"types": "./lib/types/code-text/build.d.ts",
"import": "./lib/code-text/build.js"
},
"./build-hooks": {
"webstudio": "./src/build-hooks.ts",
"types": "./lib/types/build-hooks.d.ts",
"import": "./lib/build-hooks.js"
},
"./canvas-components": {
"webstudio": "./src/canvas-components.ts",
"types": "./lib/types/canvas-components.d.ts",
"import": "./lib/canvas-components.js"
},
"./metas": {
"webstudio": "./src/metas.ts",
"types": "./lib/types/metas.d.ts",
"import": "./lib/metas.js"
},
"./hooks": {
"webstudio": "./src/hooks.ts",
"types": "./lib/types/hooks.d.ts",
"import": "./lib/hooks.js"
},
"./markdown": {
"webstudio": "./src/markdown.ts",
"types": "./lib/types/markdown.d.ts",
"import": "./lib/markdown.js"
},
"./templates": {
"webstudio": "./src/templates.ts",
"types": "./lib/types/templates.d.ts",
"import": "./lib/templates.js"
}
},
"scripts": {
"build": "vite build --config ../../vite.sdk-components.config.ts",
"build:args": "NODE_OPTIONS=--conditions=webstudio generate-arg-types './src/*.tsx !./src/*.stories.tsx !./src/*.test.{ts,tsx} !./src/*.ws.ts !./src/*.template.tsx' && oxfmt \"**/*.props.ts\"",
"build:stories": "tsx --conditions=webstudio src/generate-stories.ts && oxfmt \"src/__generated__/*.stories.tsx\"",
"dts": "tsc --project tsconfig.dts.json",
"test": "vitest run",
"typecheck": "tsc --noEmit"
},
"peerDependencies": {
"react": "18.3.0-canary-14898b6a9-20240318",
"react-dom": "18.3.0-canary-14898b6a9-20240318"
},
"dependencies": {
"@react-aria/utils": "^3.27.0",
"@shikijs/langs": "4.4.1",
"@shikijs/themes": "4.4.1",
"@webstudio-is/icons": "workspace:*",
"@webstudio-is/image": "workspace:*",
"@webstudio-is/react-sdk": "workspace:*",
"@webstudio-is/sdk": "workspace:*",
"await-interaction-response": "^0.0.2",
"colord": "^2.9.3",
"github-slugger": "2.0.0",
"hast-util-to-jsx-runtime": "^2.3.6",
"mdast-util-from-markdown": "2.0.3",
"mdast-util-frontmatter": "2.0.1",
"mdast-util-to-string": "4.0.0",
"micromark": "^4.0.2",
"micromark-extension-frontmatter": "2.0.0",
"micromark-extension-gfm": "^3.0.0",
"sanitize-html": "2.17.5",
"shiki": "4.4.1"
},
"devDependencies": {
"@testing-library/dom": "^10.4.0",
"@testing-library/react": "^16.2.0",
"@types/react": "^18.2.70",
"@types/react-dom": "^18.2.25",
"@types/sanitize-html": "2.16.1",
"@webstudio-is/design-system": "workspace:*",
"@webstudio-is/generate-arg-types": "workspace:*",
"@webstudio-is/sdk-cli": "workspace:*",
"@webstudio-is/template": "workspace:*",
"@webstudio-is/tsconfig": "workspace:*",
"micromark-util-types": "2.0.2",
"nanostores": "^0.11.3",
"react": "18.3.0-canary-14898b6a9-20240318",
"react-dom": "18.3.0-canary-14898b6a9-20240318",
"vitest": "^3.1.2"
}
}