@brillout/vite-plugin-server-entry
Advanced tools
Comparing version
@@ -154,2 +154,3 @@ "use strict"; | ||
return; | ||
(0, utils_1.assertUsage)(typeof configUnresolved.build.ssr !== 'string', "Setting the server build entry over the Vite configuration `build.ssr` (i.e. `--ssr path/to/entry.js`) isn't supported (because of a Vite bug), see workaround at https://github.com/brillout/vite-plugin-server-entry/issues/9#issuecomment-2027641624"); | ||
const resolved = resolveConfig(configUnresolved, pluginConfigProvidedByLibrary); | ||
@@ -337,3 +338,8 @@ config = resolved.config; | ||
(0, utils_1.findRollupBundleEntry)(indexEntryName, bundle); | ||
(0, utils_1.assert)(entry); | ||
(0, utils_1.assertUsage)(entry, errMsgEntryRemoved([ | ||
// | ||
serverEntryFileNameBase_1.serverEntryFileNameBase, | ||
serverEntryFileNameBase_1.serverEntryFileNameBaseAlternative, | ||
indexEntryName | ||
], Object.keys(bundle))); | ||
return entry; | ||
@@ -346,6 +352,4 @@ } | ||
if (!serverEntryFilePath) { | ||
const entryNames = Object.keys(entries) | ||
.map((e) => `'${e}'`) | ||
.join(', '); | ||
(0, utils_1.assertUsage)(false, `Cannot find server entry '${indexEntryName}'. Make sure your Rollup config doesn't remove the entry '${indexEntryName}' of your server build ${config.build.outDir}. (Found server entries: [${entryNames}].)`); | ||
const entryNames = Object.keys(entries); | ||
(0, utils_1.assertUsage)(false, errMsgEntryRemoved([indexEntryName], entryNames)); | ||
} | ||
@@ -358,1 +362,11 @@ serverEntryFilePath = require.resolve(serverEntryFilePath); | ||
} | ||
function errMsgEntryRemoved(entriesMissing, entriesExisting) { | ||
const list = (items) => '[' + items.map((e) => `'${e}'`).join(', ') + ']'; | ||
return [ | ||
entriesMissing.length === 1 | ||
? `Cannot find build server entry '${entriesMissing[0]}'.` | ||
: `Cannot find build server entry, searching for: ${list(entriesMissing)} (none of them exist, but one of these should exist).`, | ||
`Make sure your Vite config (or that of a Vite plugin) doesn't remove/overwrite server build entries.`, | ||
`(Found server entries: ${list(entriesExisting)}.)` | ||
].join(' '); | ||
} |
export { assert }; | ||
export { assertUsage }; | ||
export { logLabel }; | ||
declare const logLabel: "[@brillout/vite-plugin-server-entry@0.4.4]"; | ||
declare const logLabel: "[@brillout/vite-plugin-server-entry@0.4.5]"; | ||
declare function assert(condition: unknown, debugInfo?: unknown): asserts condition; | ||
declare function assertUsage(condition: unknown, errorMessage: string): asserts condition; |
export declare const projectInfo: { | ||
projectName: "@brillout/vite-plugin-server-entry"; | ||
npmPackageName: "@brillout/vite-plugin-server-entry"; | ||
projectVersion: "0.4.4"; | ||
projectVersion: "0.4.5"; | ||
githubRepository: "https://github.com/brillout/vite-plugin-server-entry"; | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.projectInfo = void 0; | ||
const PROJECT_VERSION = '0.4.4'; | ||
const PROJECT_VERSION = '0.4.5'; | ||
exports.projectInfo = { | ||
@@ -6,0 +6,0 @@ projectName: '@brillout/vite-plugin-server-entry', |
{ | ||
"name": "@brillout/vite-plugin-server-entry", | ||
"version": "0.4.4", | ||
"version": "0.4.5", | ||
"dependencies": { | ||
@@ -5,0 +5,0 @@ "@brillout/import": "^0.2.3" |
52862
1.8%1104
1.38%