@globalbrain/sefirot 4.33.0 → 4.34.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/config/nuxt.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { fileURLToPath } from 'node:url'
4
4
  import icons from 'unplugin-icons/nuxt'
5
- import { mergeConfig } from 'vite'
5
+ import * as vite from 'vite'
6
6
  import { baseConfig as baseViteConfig } from './vite.js'
7
7
 
8
8
  export const baseConfig = {
@@ -26,9 +26,27 @@ export const baseConfig = {
26
26
  plugins: baseViteConfig.plugins?.filter(
27
27
  (plugin) => plugin && 'name' in plugin && plugin.name !== 'unplugin-icons'
28
28
  )
29
+ },
30
+ nitro: {
31
+ rollupConfig: {
32
+ plugins: [{
33
+ name: 'custom:transpile-ts',
34
+ /**
35
+ * @param {string} code
36
+ * @param {string} id
37
+ */
38
+ transform(code, id) {
39
+ if (id.endsWith('.ts')) {
40
+ // @ts-ignore
41
+ if (vite.rolldownVersion) { return vite.transformWithOxc(code, id, { sourcemap: true }) }
42
+ return vite.transformWithEsbuild(code, id, { sourcemap: true, loader: 'ts' })
43
+ }
44
+ }
45
+ }]
46
+ }
29
47
  }
30
48
  }
31
49
 
32
50
  export function defineConfig(config = {}) {
33
- return mergeConfig(baseConfig, config)
51
+ return vite.mergeConfig(baseConfig, config)
34
52
  }
package/config/vite.js CHANGED
@@ -54,7 +54,6 @@ export const baseConfig = {
54
54
  'file-saver',
55
55
  'fuse.js',
56
56
  'html2canvas',
57
- 'isomorphic-dompurify',
58
57
  'lodash-es',
59
58
  'markdown-it',
60
59
  'normalize.css',
@@ -71,13 +70,13 @@ export const baseConfig = {
71
70
 
72
71
  optimizeDeps: {
73
72
  include: [
73
+ '@globalbrain/sefirot/dompurify',
74
74
  'dayjs',
75
75
  'dayjs/plugin/relativeTime',
76
76
  'dayjs/plugin/timezone',
77
77
  'dayjs/plugin/utc',
78
78
  'dompurify',
79
79
  'file-saver',
80
- 'isomorphic-dompurify',
81
80
  'markdown-it > argparse',
82
81
  'markdown-it > entities'
83
82
  ],
@@ -1,4 +1,4 @@
1
- import DOMPurify, { type Config } from 'isomorphic-dompurify'
1
+ import { type DOMPurifyConfig, type DOMPurifyI, createDompurify } from '@globalbrain/sefirot/dompurify'
2
2
  import MarkdownIt from 'markdown-it'
3
3
 
4
4
  export type UseMarkdown = (source: string, inline?: boolean) => string
@@ -70,31 +70,40 @@ export interface UseMarkdownOptions extends MarkdownItOptions {
70
70
  config?: (md: MarkdownIt) => void
71
71
  /** @default false */
72
72
  inline?: boolean
73
- domPurifyOptions?: Config
73
+ domPurifyInstance?: DOMPurifyI
74
+ domPurifyOptions?: DOMPurifyConfig
74
75
  }
75
76
 
76
77
  const EXTERNAL_URL_RE = /^(?:[a-z]+:|\/\/)/i
77
78
 
78
- DOMPurify.addHook('afterSanitizeAttributes', (node) => {
79
- if (node.tagName === 'A') {
80
- const target = node.getAttribute('target')
81
- if (target && target !== '_blank' && target !== '_self') {
82
- node.removeAttribute('target')
79
+ let DOMPurify: DOMPurifyI | undefined
80
+
81
+ export function getDomPurifySingleton(): DOMPurifyI {
82
+ if (DOMPurify) { return DOMPurify }
83
+ DOMPurify = createDompurify()
84
+ DOMPurify.addHook('afterSanitizeAttributes', (node) => {
85
+ if (node.tagName === 'A') {
86
+ const target = node.getAttribute('target')
87
+ if (target && target !== '_blank' && target !== '_self') {
88
+ node.removeAttribute('target')
89
+ }
90
+
91
+ const href = node.getAttribute('href')
92
+ if (href && EXTERNAL_URL_RE.test(href)) {
93
+ node.setAttribute('target', '_blank')
94
+ node.setAttribute('rel', 'noreferrer')
95
+ }
96
+
97
+ node.classList.add('SMarkdown-link')
83
98
  }
84
-
85
- const href = node.getAttribute('href')
86
- if (href && EXTERNAL_URL_RE.test(href)) {
87
- node.setAttribute('target', '_blank')
88
- node.setAttribute('rel', 'noreferrer')
89
- }
90
-
91
- node.classList.add('SMarkdown-link')
92
- }
93
- })
99
+ })
100
+ return DOMPurify
101
+ }
94
102
 
95
103
  export function useMarkdown({
96
104
  config,
97
105
  inline: _inline,
106
+ domPurifyInstance,
98
107
  domPurifyOptions,
99
108
  ...options
100
109
  }: UseMarkdownOptions = {}): UseMarkdown {
@@ -115,7 +124,7 @@ export function useMarkdown({
115
124
 
116
125
  return (source, inline = _inline) => {
117
126
  const html = inline ? md.renderInline(source) : md.render(source)
118
- return DOMPurify.sanitize(html, {
127
+ return (domPurifyInstance || getDomPurifySingleton()).sanitize(html, {
119
128
  USE_PROFILES: { html: true },
120
129
  ADD_ATTR: ['target'],
121
130
  ...domPurifyOptions
@@ -0,0 +1,5 @@
1
+ import dompurify from 'dompurify'
2
+
3
+ export function createDompurify() {
4
+ return dompurify(window)
5
+ }
@@ -0,0 +1,6 @@
1
+ // must be imported from `@globalbrain/sefirot/dompurify`
2
+ // otherwise conditional exports in package.json won't work
3
+
4
+ export declare function createDompurify(): import('dompurify').DOMPurify
5
+
6
+ export type { Config as DOMPurifyConfig, DOMPurify as DOMPurifyI } from 'dompurify'
@@ -0,0 +1,6 @@
1
+ import dompurify from 'dompurify'
2
+ import { JSDOM } from 'jsdom'
3
+
4
+ export function createDompurify() {
5
+ return dompurify(new JSDOM(`<!DOCTYPE html>`).window)
6
+ }
package/package.json CHANGED
@@ -1,23 +1,45 @@
1
1
  {
2
2
  "name": "@globalbrain/sefirot",
3
- "type": "module",
4
- "version": "4.33.0",
5
- "packageManager": "pnpm@10.28.0",
3
+ "version": "4.34.0",
6
4
  "description": "Vue Components for Global Brain Design System.",
7
- "author": "Kia Ishii <ka.ishii@globalbrains.com>",
8
- "license": "MIT",
5
+ "keywords": [
6
+ "vue",
7
+ "vue3",
8
+ "components",
9
+ "design-system",
10
+ "ui-library",
11
+ "globalbrain"
12
+ ],
13
+ "homepage": "https://sefirot.globalbrains.com/",
9
14
  "repository": {
10
15
  "type": "git",
11
- "url": "git@github.com:globalbrain/sefirot.git"
16
+ "url": "git+https://github.com/globalbrain/sefirot.git"
12
17
  },
13
- "bugs": {
14
- "url": "https://github.com/globalbrain/sefirot/issues"
18
+ "license": "MIT",
19
+ "author": "Kia Ishii <ka.ishii@globalbrains.com>",
20
+ "type": "module",
21
+ "exports": {
22
+ "./client": {
23
+ "types": "./client.d.ts"
24
+ },
25
+ "./config/nuxt": {
26
+ "types": "./config/nuxt.d.ts",
27
+ "import": "./config/nuxt.js"
28
+ },
29
+ "./config/vite": {
30
+ "types": "./config/vite.d.ts",
31
+ "import": "./config/vite.js"
32
+ },
33
+ "./dompurify": {
34
+ "types": "./lib/dompurify/index.d.ts",
35
+ "browser": "./lib/dompurify/browser.js",
36
+ "default": "./lib/dompurify/node.js"
37
+ },
38
+ "./shared": {
39
+ "types": "./shared.d.ts"
40
+ },
41
+ "./*": "./*"
15
42
  },
16
- "keywords": [
17
- "sefirot",
18
- "vue",
19
- "vue component"
20
- ],
21
43
  "files": [
22
44
  "lib",
23
45
  "config",
@@ -50,13 +72,12 @@
50
72
  "@types/body-scroll-lock": "^3.1.2",
51
73
  "@types/lodash-es": "^4.17.12",
52
74
  "@types/markdown-it": "^14.1.2",
53
- "@vue/reactivity": "^3.5.26",
75
+ "@vue/reactivity": "^3.5.27",
54
76
  "@vuelidate/core": "^2.0.3",
55
77
  "@vuelidate/validators": "^2.0.4",
56
78
  "@vueuse/core": "^12 || ^13 || ^14",
57
79
  "body-scroll-lock": "4.0.0-beta.0",
58
80
  "dayjs": "^1.11.19",
59
- "dompurify": "^3.3.1",
60
81
  "fuse.js": "^7.1.0",
61
82
  "lodash-es": "^4.17.22",
62
83
  "markdown-it": "^14.1.0",
@@ -65,12 +86,12 @@
65
86
  "postcss": "^8.5.6",
66
87
  "postcss-nested": "^7.0.2",
67
88
  "v-calendar": "3.0.1",
68
- "vue": "^3.5.26",
89
+ "vue": "^3.5.27",
69
90
  "vue-router": "^4.6.4"
70
91
  },
71
92
  "dependencies": {
72
- "@sentry/browser": "^10.33.0",
73
- "@sentry/vue": "^10.33.0",
93
+ "@sentry/browser": "^10.35.0",
94
+ "@sentry/vue": "^10.35.0",
74
95
  "@tanstack/vue-virtual": "3.0.0-beta.62",
75
96
  "@tinyhttp/content-disposition": "^2.2.2",
76
97
  "@tinyhttp/cookie": "^2.1.1",
@@ -79,13 +100,14 @@
79
100
  "@types/file-saver": "^2.0.7",
80
101
  "@types/qs": "^6.14.0",
81
102
  "d3": "^7.9.0",
103
+ "dompurify": "^3.3.1",
82
104
  "file-saver": "^2.0.5",
83
105
  "html2canvas": "^1.4.1",
84
- "isomorphic-dompurify": "^2.35.0",
106
+ "jsdom": "^27.4.0",
85
107
  "magic-string": "^0.30.21",
86
108
  "ofetch": "^1.5.1",
87
109
  "qs": "^6.14.1",
88
- "unplugin-icons": "^22.5.0"
110
+ "unplugin-icons": "^23.0.1"
89
111
  },
90
112
  "devDependencies": {
91
113
  "@globalbrain/eslint-config": "^2.1.0",
@@ -95,22 +117,22 @@
95
117
  "@popperjs/core": "^2.11.8",
96
118
  "@release-it/conventional-changelog": "^10.0.4",
97
119
  "@types/body-scroll-lock": "^3.1.2",
120
+ "@types/jsdom": "^27.0.0",
98
121
  "@types/lodash-es": "^4.17.12",
99
122
  "@types/markdown-it": "^14.1.2",
100
- "@types/node": "^25.0.7",
123
+ "@types/node": "^25.0.9",
101
124
  "@vitejs/plugin-vue": "^6.0.3",
102
125
  "@vitest/coverage-v8": "^3.2.4",
103
- "@vue/reactivity": "^3.5.26",
126
+ "@vue/reactivity": "^3.5.27",
104
127
  "@vue/test-utils": "^2.4.6",
105
128
  "@vuelidate/core": "^2.0.3",
106
129
  "@vuelidate/validators": "^2.0.4",
107
130
  "@vueuse/core": "^14.1.0",
108
131
  "body-scroll-lock": "4.0.0-beta.0",
109
132
  "dayjs": "^1.11.19",
110
- "dompurify": "^3.3.1",
111
133
  "eslint": "^9.39.2",
112
134
  "fuse.js": "^7.1.0",
113
- "happy-dom": "^20.1.0",
135
+ "happy-dom": "^20.3.3",
114
136
  "histoire": "0.16.5",
115
137
  "lodash-es": "^4.17.22",
116
138
  "markdown-it": "^14.1.0",
@@ -125,8 +147,9 @@
125
147
  "vite": "^6.4.1",
126
148
  "vitepress": "^2.0.0-alpha.15",
127
149
  "vitest": "^3.2.4",
128
- "vue": "^3.5.26",
150
+ "vue": "^3.5.27",
129
151
  "vue-router": "^4.6.4",
130
152
  "vue-tsc": "^3.2.2"
131
- }
153
+ },
154
+ "packageManager": "pnpm@10.28.1"
132
155
  }