@lls/vitescripts 1.1.9 → 1.1.11
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
|
@@ -2,6 +2,7 @@ const llsLinariaImports = ({ client } = {}) => {
|
|
|
2
2
|
return {
|
|
3
3
|
name: 'lls:linaria-imports',
|
|
4
4
|
load(id) {
|
|
5
|
+
console.log('llsLinariaImports plugin is deprecated, remove usage. Already handled by llsSideRefreshMetaPlugin')
|
|
5
6
|
if (client) return
|
|
6
7
|
if (id.endsWith('@lls/viewer/lib/assets/viewer.css')) { return '' }
|
|
7
8
|
if (id.endsWith('@lls/superkit/lib/assets/superkit.css')) { return '' }
|
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',
|
|
@@ -8,15 +8,16 @@ const pwd = process.cwd()
|
|
|
8
8
|
* @returns a plugin to pass to vite and aliases for sideRefreshed packages
|
|
9
9
|
*/
|
|
10
10
|
const llsSideRefreshMetaPlugin = ({ viewer: iViewer, superkit: iSuperkit, kit: iKit, utils: iUtils, core: iCore }, { client, publicDir='ladleassets' } = {}) => {
|
|
11
|
-
if (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
if ([iViewer, iSuperkit, iKit, iUtils, iCore].some(x => x)) {
|
|
12
|
+
// eslint-disable-next-line no-console
|
|
13
|
+
console.log('sideResfresh: ', [
|
|
14
|
+
iViewer && 'viewer',
|
|
15
|
+
iSuperkit && 'superkit',
|
|
16
|
+
iKit && 'kit',
|
|
17
|
+
iUtils && 'utils',
|
|
18
|
+
iCore && 'core'
|
|
19
|
+
].filter(Boolean))
|
|
20
|
+
}
|
|
20
21
|
|
|
21
22
|
const makeResolver = (dirname, aliasImport) => {
|
|
22
23
|
const projectPath = path.resolve(pwd, '../', dirname)
|
|
@@ -62,9 +63,14 @@ const llsSideRefreshMetaPlugin = ({ viewer: iViewer, superkit: iSuperkit, kit: i
|
|
|
62
63
|
const VIRTUAL_ID = 'sideRefresh/node_modules' // specify node_modules to bypass linaria plugin parsing css file... (cant tweak exclude regex)
|
|
63
64
|
const key = basename => path.join(pwd, publicDir, 'assets', basename)
|
|
64
65
|
const loads = new Map(['core.css', 'viewer.css', 'superkit.css', 'lls-kit.css', 'lls-kit-fonts.css'].map(basename => {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
let promise = ''
|
|
67
|
+
const getPromise = () => {
|
|
68
|
+
if (client && !pwd.includes(basename.replace('.css', ''))) {
|
|
69
|
+
promise = fs.promises.readFile(key(basename))
|
|
70
|
+
}
|
|
71
|
+
return promise
|
|
72
|
+
}
|
|
73
|
+
return [VIRTUAL_ID + key(basename), getPromise]
|
|
68
74
|
}))
|
|
69
75
|
const plugin = () => ({
|
|
70
76
|
name: 'lls:sideRefresh',
|
|
@@ -83,7 +89,7 @@ const llsSideRefreshMetaPlugin = ({ viewer: iViewer, superkit: iSuperkit, kit: i
|
|
|
83
89
|
|
|
84
90
|
async load(id) {
|
|
85
91
|
if (loads.has(id)) {
|
|
86
|
-
return loads.get(id)
|
|
92
|
+
return loads.get(id)()
|
|
87
93
|
}
|
|
88
94
|
}
|
|
89
95
|
})
|