@globalbrain/sefirot 4.40.2 → 4.40.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.
- package/config/vite.js +15 -20
- package/package.json +1 -1
package/config/vite.js
CHANGED
|
@@ -13,6 +13,13 @@ const files = (await Array.fromAsync(glob(`**/*.ts`, { cwd: lib })))
|
|
|
13
13
|
.filter((file) => !file.endsWith('.d.ts'))
|
|
14
14
|
.map((file) => `sefirot/${file}`.replace(/(?:\/index)?\.ts$/, ''))
|
|
15
15
|
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
const isRolldown = !!vite.rolldownVersion
|
|
18
|
+
|
|
19
|
+
const define = {
|
|
20
|
+
'navigator.userAgent': '""'
|
|
21
|
+
}
|
|
22
|
+
|
|
16
23
|
/** @type {import('vite').UserConfig} */
|
|
17
24
|
export const baseConfig = {
|
|
18
25
|
plugins: [
|
|
@@ -20,17 +27,17 @@ export const baseConfig = {
|
|
|
20
27
|
{
|
|
21
28
|
enforce: 'pre',
|
|
22
29
|
name: 'sefirot:patch-linkify-it',
|
|
23
|
-
transform
|
|
24
|
-
|
|
30
|
+
transform: {
|
|
31
|
+
filter: {
|
|
32
|
+
id: /linkify-it[\\/]lib[\\/]re\.m?js(?:$|\?)/
|
|
33
|
+
},
|
|
34
|
+
handler(code, id) {
|
|
25
35
|
const s = new MagicString(code)
|
|
26
36
|
|
|
27
37
|
const search = 'const text_separators = \'[><\\uff5c]\''
|
|
28
38
|
const replace = 'const text_separators = \'[><\\uff00-\\uffef]\''
|
|
29
39
|
|
|
30
|
-
|
|
31
|
-
if (index !== -1) {
|
|
32
|
-
s.overwrite(index, index + search.length, replace)
|
|
33
|
-
}
|
|
40
|
+
s.replace(search, replace)
|
|
34
41
|
|
|
35
42
|
return { code: s.toString(), map: s.generateMap({ source: id }) }
|
|
36
43
|
}
|
|
@@ -53,21 +60,9 @@ export const baseConfig = {
|
|
|
53
60
|
'file-saver'
|
|
54
61
|
],
|
|
55
62
|
// @ts-ignore
|
|
56
|
-
|
|
57
|
-
esbuildOptions: vite.rolldownVersion ? undefined : {
|
|
58
|
-
define: {
|
|
59
|
-
'navigator.userAgent': '""'
|
|
60
|
-
}
|
|
61
|
-
},
|
|
63
|
+
esbuildOptions: isRolldown ? undefined : { define },
|
|
62
64
|
// @ts-ignore
|
|
63
|
-
|
|
64
|
-
rolldownOptions: vite.rolldownVersion ? {
|
|
65
|
-
transform: {
|
|
66
|
-
define: {
|
|
67
|
-
'navigator.userAgent': '""'
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
} : undefined
|
|
65
|
+
rolldownOptions: isRolldown ? { transform: { define } } : undefined
|
|
71
66
|
}
|
|
72
67
|
},
|
|
73
68
|
|