@lls/vitescripts 1.1.1 → 1.1.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/README.md
CHANGED
package/package.json
CHANGED
|
@@ -9,6 +9,8 @@ const llsLinariaSsrCollectPlugin = () => {
|
|
|
9
9
|
let linariaPlugin
|
|
10
10
|
return {
|
|
11
11
|
name: 'lls:llsLinariaSsrCollect',
|
|
12
|
+
/* we enforce pre because if vite-plugin-linaria resolves id, vite4 won't call us. Since we do not resolve, we can be put before */
|
|
13
|
+
enforce: 'pre',
|
|
12
14
|
config(config) {
|
|
13
15
|
linariaPlugin = config.plugins.find(plugin => plugin.name === 'linaria')
|
|
14
16
|
},
|
|
@@ -7,15 +7,16 @@ const pwd = process.cwd()
|
|
|
7
7
|
* @param {*} param specifies which dependency is beign sideRefreshed
|
|
8
8
|
* @returns a plugin to pass to vite and aliases for sideRefreshed packages
|
|
9
9
|
*/
|
|
10
|
-
const llsSideRefreshMetaPlugin = ({ viewer: iViewer, superkit: iSuperkit, kit: iKit, utils: iUtils }) => {
|
|
11
|
-
if (!iViewer && !iSuperkit && !iKit && !iUtils) { return { plugin: () => false, alias: {} } }
|
|
10
|
+
const llsSideRefreshMetaPlugin = ({ viewer: iViewer, superkit: iSuperkit, kit: iKit, utils: iUtils, core: iCore }) => {
|
|
11
|
+
if (!iViewer && !iSuperkit && !iKit && !iUtils && !iCore) { return { plugin: () => false, alias: {} } }
|
|
12
12
|
// eslint-disable-next-line no-console
|
|
13
13
|
console.log('sideResfresh: ', [
|
|
14
14
|
iViewer && 'viewer',
|
|
15
15
|
iSuperkit && 'superkit',
|
|
16
16
|
iKit && 'kit',
|
|
17
|
-
iUtils && 'utils'
|
|
18
|
-
|
|
17
|
+
iUtils && 'utils',
|
|
18
|
+
iCore && 'core'
|
|
19
|
+
].filter(Boolean))
|
|
19
20
|
|
|
20
21
|
const makeResolver = (dirname, aliasImport) => {
|
|
21
22
|
const projectPath = path.resolve(pwd, '../', dirname)
|
|
@@ -56,6 +57,7 @@ const llsSideRefreshMetaPlugin = ({ viewer: iViewer, superkit: iSuperkit, kit: i
|
|
|
56
57
|
const superkit = (iSuperkit && makeResolver('superkit')) || makeNoopResolver()
|
|
57
58
|
const kit = (iKit && makeResolver('lls-kit', '@kit')) || makeNoopResolver()
|
|
58
59
|
const utils = (iUtils && makeResolver('utils', 'commons')) || makeNoopResolver()
|
|
60
|
+
const core = (iCore && makeResolver('lls-core', '@core')) || makeNoopResolver()
|
|
59
61
|
|
|
60
62
|
const plugin = () => ({
|
|
61
63
|
name: 'lls:sideRefresh',
|
|
@@ -64,12 +66,14 @@ const llsSideRefreshMetaPlugin = ({ viewer: iViewer, superkit: iSuperkit, kit: i
|
|
|
64
66
|
if (id.endsWith('viewer.css') && from.includes('viewer')) { return 'llslinaria' }
|
|
65
67
|
if (id.endsWith('superkit.css') && from.includes('superkit')) { return 'llslinaria' }
|
|
66
68
|
if ((id.endsWith('lls-kit.css') || id.endsWith('lls-kit-fonts.css')) && from.includes('lls-kit')) { return 'llslinaria' }
|
|
69
|
+
if (id.endsWith('core.css') && from.includes('core')) { return 'llslinaria' }
|
|
67
70
|
|
|
68
71
|
if (id.includes('@linaria-cache')) { return }
|
|
69
72
|
if (viewer.shouldResolve(from)) { return viewer.resolve.call(this, id, from) }
|
|
70
73
|
if (superkit.shouldResolve(from)) { return superkit.resolve.call(this, id, from) }
|
|
71
74
|
if (kit.shouldResolve(from)) { return kit.resolve.call(this, id, from) }
|
|
72
75
|
if (utils.shouldResolve(from)) { return utils.resolve.call(this, id, from) }
|
|
76
|
+
if (core.shouldResolve(from)) { return core.resolve.call(this, id, from) }
|
|
73
77
|
},
|
|
74
78
|
|
|
75
79
|
load(id) {
|
|
@@ -80,7 +84,8 @@ const llsSideRefreshMetaPlugin = ({ viewer: iViewer, superkit: iSuperkit, kit: i
|
|
|
80
84
|
...viewer.alias,
|
|
81
85
|
...superkit.alias,
|
|
82
86
|
...kit.alias,
|
|
83
|
-
...utils.alias
|
|
87
|
+
...utils.alias,
|
|
88
|
+
...core.alias
|
|
84
89
|
}
|
|
85
90
|
return { plugin, alias }
|
|
86
91
|
}
|