@lls/vitescripts 1.1.13 → 1.1.15
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,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const llsCssModuleMacroPlugin = async (cname) => {
|
|
2
2
|
const { buildThemeIsFreeMode, buildThemeIsDarkMode, buildThemeIsNotDarkMode } = await import('@lls/lls-kit')
|
|
3
3
|
const cssMacroTheme = {
|
|
4
4
|
themeIsFreeMode: buildThemeIsFreeMode(cname),
|
|
@@ -6,15 +6,16 @@ const llsCssModuleMacro = async (cname) => {
|
|
|
6
6
|
themeIsNotDarkMode: buildThemeIsNotDarkMode(cname)
|
|
7
7
|
}
|
|
8
8
|
return {// TODO remove, pending https://github.com/vitejs/vite/pull/14024
|
|
9
|
+
enforce: 'pre',
|
|
9
10
|
transform(src, id) {
|
|
10
11
|
if (!id.endsWith('module.css')) {
|
|
11
12
|
return src
|
|
12
13
|
}
|
|
13
14
|
return src
|
|
14
15
|
.replace(/getTruePx\((.*?)\)/g, 'calc(var(--size-index, 1) * $1 * 1px)')
|
|
15
|
-
.replace(
|
|
16
|
+
.replace(/\${(themeIsFreeMode|themeIsDarkMode|themeIsNotDarkMode)}/g, (__, cap) => cssMacroTheme[cap])
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
export default
|
|
21
|
+
export default llsCssModuleMacroPlugin
|
package/src/llsRequirePlugin.mjs
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import VitePluginRequireTransform from 'vite-plugin-require-transform'
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Plugin using vite-plugin-require-transform, used to transform require syntax to import
|
|
5
3
|
* Needed when we use viewer in sideRefresh
|
|
6
4
|
* @returns the plugin with its transform method
|
|
7
5
|
*/
|
|
8
|
-
const llsSsrRequirePlugin = () => {
|
|
6
|
+
const llsSsrRequirePlugin = async () => {
|
|
7
|
+
const VitePluginRequireTransform = await import('vite-plugin-require-transform').then(m => m.default)
|
|
9
8
|
// Lazy loaded viewer modules that are using require syntax
|
|
10
9
|
const fileRegex = /(?:(Audio|Playlist|Recorder|Python|Video|QuestionRich|CodemirrorEditor|useLazyModule)\.jsx$|@lls_lls-code)/
|
|
11
10
|
const back = VitePluginRequireTransform({ fileRegex })
|