@lls/vitescripts 1.1.10 → 1.1.12
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lls/vitescripts",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.12",
|
|
4
4
|
"description": "lls vite plugins",
|
|
5
5
|
"main": "src/index.mjs",
|
|
6
6
|
"files": [
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"
|
|
13
|
+
"lightningcss": "1.21.5"
|
|
14
14
|
},
|
|
15
15
|
"type": "module",
|
|
16
16
|
"author": "",
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* resolveId() method that filters files to be added to css set
|
|
5
5
|
* flushStyles() method that generates and return <style> tag with refreshed style
|
|
6
6
|
*/
|
|
7
|
+
import { transform } from 'lightningcss'
|
|
7
8
|
const llsLinariaSsrCollectPlugin = () => {
|
|
8
9
|
const cssIds = new Set()
|
|
9
10
|
let linariaPlugin
|
|
@@ -18,12 +19,12 @@ const llsLinariaSsrCollectPlugin = () => {
|
|
|
18
19
|
if (id.includes('@linaria-cache')) { cssIds.add(id) }
|
|
19
20
|
},
|
|
20
21
|
flushStyles() {
|
|
21
|
-
const
|
|
22
|
-
// linaria plugin keeps cache. But we dont want to keep ids which have changed (updating a css component)
|
|
23
|
-
// css is removed from client anyway but still be accurate
|
|
24
|
-
cssIds.clear()
|
|
22
|
+
const css = [...cssIds].map(linariaPlugin.load).join('\n')
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
// when hmr, id changes but not css-selector so we get two rules with the same css-selector
|
|
25
|
+
// we dedupe the rules so old rule is now stripped.
|
|
26
|
+
const { code } = transform({ code: Buffer.from(css) })
|
|
27
|
+
return `<style id="linaria-ssr-collect-plugin">${code.toString()}</style>`
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
}
|
package/src/llsRequirePlugin.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import VitePluginRequireTransform from 'vite-plugin-require-transform'
|
|
|
7
7
|
*/
|
|
8
8
|
const llsSsrRequirePlugin = () => {
|
|
9
9
|
// Lazy loaded viewer modules that are using require syntax
|
|
10
|
-
const fileRegex = /(?:(Audio|Recorder|Python|Video|QuestionRich|CodemirrorEditor|useLazyModule)\.jsx$|@lls_lls-code)/
|
|
10
|
+
const fileRegex = /(?:(Audio|Playlist|Recorder|Python|Video|QuestionRich|CodemirrorEditor|useLazyModule)\.jsx$|@lls_lls-code)/
|
|
11
11
|
const back = VitePluginRequireTransform({ fileRegex })
|
|
12
12
|
return {
|
|
13
13
|
name: 'lls:require',
|