vitrify 0.11.2 → 0.11.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/dist/index.js +47 -18
- package/dist/types/vitrify-config.d.ts +4 -0
- package/package.json +1 -1
- package/src/node/index.ts +48 -19
- package/src/node/vitrify-config.ts +4 -0
package/dist/index.js
CHANGED
|
@@ -43,23 +43,52 @@ const moduleChunks = {
|
|
|
43
43
|
vue: ['vue', '@vue', 'vue-router'],
|
|
44
44
|
quasar: ['quasar', '@quasar']
|
|
45
45
|
};
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
else if (VIRTUAL_MODULES.some((virtualModule) => id.includes(virtualModule))) {
|
|
54
|
-
return VIRTUAL_MODULES.find((name) => id.includes(name));
|
|
55
|
-
}
|
|
56
|
-
else if (id.includes('node_modules')) {
|
|
57
|
-
if (matchedModule) {
|
|
58
|
-
return matchedModule[0];
|
|
46
|
+
const manualChunksFn = (manualChunkList) => {
|
|
47
|
+
return (id) => {
|
|
48
|
+
const matchedModule = Object.entries(moduleChunks).find(([chunkName, moduleNames]) => moduleNames.some((moduleName) => id.includes(moduleName + '/')));
|
|
49
|
+
if (id.includes('vitrify/src/')) {
|
|
50
|
+
const name = id.split('/').at(-1)?.split('.').at(0);
|
|
51
|
+
if (name && manualChunkNames.includes(name))
|
|
52
|
+
return name;
|
|
59
53
|
}
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
else if (VIRTUAL_MODULES.some((virtualModule) => id.includes(virtualModule))) {
|
|
55
|
+
return VIRTUAL_MODULES.find((name) => id.includes(name));
|
|
56
|
+
}
|
|
57
|
+
else if (manualChunkList?.some((file) => id.includes(file))) {
|
|
58
|
+
return manualChunkList.find((file) => id.includes(file));
|
|
59
|
+
}
|
|
60
|
+
else if (id.includes('node_modules')) {
|
|
61
|
+
if (matchedModule) {
|
|
62
|
+
return matchedModule[0];
|
|
63
|
+
}
|
|
64
|
+
return 'vendor';
|
|
65
|
+
}
|
|
66
|
+
};
|
|
62
67
|
};
|
|
68
|
+
// const manualChunks: ManualChunksOption = (
|
|
69
|
+
// id: string,
|
|
70
|
+
// manualChunkList?: string[]
|
|
71
|
+
// ) => {
|
|
72
|
+
// const matchedModule = Object.entries(moduleChunks).find(
|
|
73
|
+
// ([chunkName, moduleNames]) =>
|
|
74
|
+
// moduleNames.some((moduleName) => id.includes(moduleName + '/'))
|
|
75
|
+
// )
|
|
76
|
+
// if (id.includes('vitrify/src/')) {
|
|
77
|
+
// const name = id.split('/').at(-1)?.split('.').at(0)
|
|
78
|
+
// if (name && manualChunkNames.includes(name)) return name
|
|
79
|
+
// } else if (
|
|
80
|
+
// VIRTUAL_MODULES.some((virtualModule) => id.includes(virtualModule))
|
|
81
|
+
// ) {
|
|
82
|
+
// return VIRTUAL_MODULES.find((name) => id.includes(name))
|
|
83
|
+
// } else if (manualChunkList?.some((file) => id.includes(file))) {
|
|
84
|
+
// return manualChunkList.find((file) => id.includes(file))
|
|
85
|
+
// } else if (id.includes('node_modules')) {
|
|
86
|
+
// if (matchedModule) {
|
|
87
|
+
// return matchedModule[0]
|
|
88
|
+
// }
|
|
89
|
+
// return 'vendor'
|
|
90
|
+
// }
|
|
91
|
+
// }
|
|
63
92
|
export const VIRTUAL_MODULES = [
|
|
64
93
|
'virtual:vitrify-hooks',
|
|
65
94
|
'virtual:static-imports',
|
|
@@ -448,7 +477,7 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
448
477
|
entryFileNames: '[name].mjs',
|
|
449
478
|
chunkFileNames: '[name].mjs',
|
|
450
479
|
format: 'es',
|
|
451
|
-
manualChunks
|
|
480
|
+
manualChunks: manualChunksFn(vitrifyConfig?.vitrify?.manualChunks)
|
|
452
481
|
}
|
|
453
482
|
};
|
|
454
483
|
// Create a SSR bundle
|
|
@@ -466,7 +495,7 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
466
495
|
entryFileNames: '[name].mjs',
|
|
467
496
|
chunkFileNames: '[name].mjs',
|
|
468
497
|
format: 'es',
|
|
469
|
-
manualChunks
|
|
498
|
+
manualChunks: manualChunksFn(vitrifyConfig?.vitrify?.manualChunks)
|
|
470
499
|
}
|
|
471
500
|
};
|
|
472
501
|
// Create a SSR bundle
|
|
@@ -483,7 +512,7 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
483
512
|
entryFileNames: '[name].mjs',
|
|
484
513
|
chunkFileNames: '[name].mjs',
|
|
485
514
|
format: 'es',
|
|
486
|
-
manualChunks
|
|
515
|
+
manualChunks: manualChunksFn(vitrifyConfig?.vitrify?.manualChunks)
|
|
487
516
|
}
|
|
488
517
|
};
|
|
489
518
|
}
|
package/package.json
CHANGED
package/src/node/index.ts
CHANGED
|
@@ -69,26 +69,55 @@ const moduleChunks = {
|
|
|
69
69
|
vue: ['vue', '@vue', 'vue-router'],
|
|
70
70
|
quasar: ['quasar', '@quasar']
|
|
71
71
|
}
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
(
|
|
75
|
-
moduleNames
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (
|
|
86
|
-
return
|
|
72
|
+
const manualChunksFn = (manualChunkList?: string[]): ManualChunksOption => {
|
|
73
|
+
return (id: string) => {
|
|
74
|
+
const matchedModule = Object.entries(moduleChunks).find(
|
|
75
|
+
([chunkName, moduleNames]) =>
|
|
76
|
+
moduleNames.some((moduleName) => id.includes(moduleName + '/'))
|
|
77
|
+
)
|
|
78
|
+
if (id.includes('vitrify/src/')) {
|
|
79
|
+
const name = id.split('/').at(-1)?.split('.').at(0)
|
|
80
|
+
if (name && manualChunkNames.includes(name)) return name
|
|
81
|
+
} else if (
|
|
82
|
+
VIRTUAL_MODULES.some((virtualModule) => id.includes(virtualModule))
|
|
83
|
+
) {
|
|
84
|
+
return VIRTUAL_MODULES.find((name) => id.includes(name))
|
|
85
|
+
} else if (manualChunkList?.some((file) => id.includes(file))) {
|
|
86
|
+
return manualChunkList.find((file) => id.includes(file))
|
|
87
|
+
} else if (id.includes('node_modules')) {
|
|
88
|
+
if (matchedModule) {
|
|
89
|
+
return matchedModule[0]
|
|
90
|
+
}
|
|
91
|
+
return 'vendor'
|
|
87
92
|
}
|
|
88
|
-
return 'vendor'
|
|
89
93
|
}
|
|
90
94
|
}
|
|
91
95
|
|
|
96
|
+
// const manualChunks: ManualChunksOption = (
|
|
97
|
+
// id: string,
|
|
98
|
+
// manualChunkList?: string[]
|
|
99
|
+
// ) => {
|
|
100
|
+
// const matchedModule = Object.entries(moduleChunks).find(
|
|
101
|
+
// ([chunkName, moduleNames]) =>
|
|
102
|
+
// moduleNames.some((moduleName) => id.includes(moduleName + '/'))
|
|
103
|
+
// )
|
|
104
|
+
// if (id.includes('vitrify/src/')) {
|
|
105
|
+
// const name = id.split('/').at(-1)?.split('.').at(0)
|
|
106
|
+
// if (name && manualChunkNames.includes(name)) return name
|
|
107
|
+
// } else if (
|
|
108
|
+
// VIRTUAL_MODULES.some((virtualModule) => id.includes(virtualModule))
|
|
109
|
+
// ) {
|
|
110
|
+
// return VIRTUAL_MODULES.find((name) => id.includes(name))
|
|
111
|
+
// } else if (manualChunkList?.some((file) => id.includes(file))) {
|
|
112
|
+
// return manualChunkList.find((file) => id.includes(file))
|
|
113
|
+
// } else if (id.includes('node_modules')) {
|
|
114
|
+
// if (matchedModule) {
|
|
115
|
+
// return matchedModule[0]
|
|
116
|
+
// }
|
|
117
|
+
// return 'vendor'
|
|
118
|
+
// }
|
|
119
|
+
// }
|
|
120
|
+
|
|
92
121
|
export const VIRTUAL_MODULES = [
|
|
93
122
|
'virtual:vitrify-hooks',
|
|
94
123
|
'virtual:static-imports',
|
|
@@ -546,7 +575,7 @@ export const baseConfig = async ({
|
|
|
546
575
|
entryFileNames: '[name].mjs',
|
|
547
576
|
chunkFileNames: '[name].mjs',
|
|
548
577
|
format: 'es',
|
|
549
|
-
manualChunks
|
|
578
|
+
manualChunks: manualChunksFn(vitrifyConfig?.vitrify?.manualChunks)
|
|
550
579
|
}
|
|
551
580
|
}
|
|
552
581
|
// Create a SSR bundle
|
|
@@ -563,7 +592,7 @@ export const baseConfig = async ({
|
|
|
563
592
|
entryFileNames: '[name].mjs',
|
|
564
593
|
chunkFileNames: '[name].mjs',
|
|
565
594
|
format: 'es',
|
|
566
|
-
manualChunks
|
|
595
|
+
manualChunks: manualChunksFn(vitrifyConfig?.vitrify?.manualChunks)
|
|
567
596
|
}
|
|
568
597
|
}
|
|
569
598
|
// Create a SSR bundle
|
|
@@ -579,7 +608,7 @@ export const baseConfig = async ({
|
|
|
579
608
|
entryFileNames: '[name].mjs',
|
|
580
609
|
chunkFileNames: '[name].mjs',
|
|
581
610
|
format: 'es',
|
|
582
|
-
manualChunks
|
|
611
|
+
manualChunks: manualChunksFn(vitrifyConfig?.vitrify?.manualChunks)
|
|
583
612
|
}
|
|
584
613
|
}
|
|
585
614
|
}
|