mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-11-04 16:14:07 +00:00
Merge branch 'feat/desktop-offline' into feat/do-policies
This commit is contained in:
@@ -49,6 +49,13 @@ export const LITE_REMOVED_PATHS = [
|
||||
"public/sqlite3mc",
|
||||
];
|
||||
|
||||
/** The local store's engine in an export: Lite has no offline mode, and must not ship or load it. */
|
||||
export function unexpectedEngineFiles(files) {
|
||||
return files
|
||||
.map((file) => file.replace(/\\/g, "/"))
|
||||
.filter((file) => /(^|\/)store-worker\.js$/.test(file) || /(^|\/)sqlite3mc\//.test(file) || /(^|\/)sqlite3\.(wasm|mjs)$/.test(file));
|
||||
}
|
||||
|
||||
/** Test trees are pruned too: they import the routes removed above. */
|
||||
export const LITE_TEST_DIR_NAME = "__tests__";
|
||||
export const LITE_TEST_FILE_PATTERN = /\.test\.[cm]?[jt]sx?$/;
|
||||
|
||||
@@ -10,7 +10,7 @@ import { existsSync, readFileSync, statSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import {
|
||||
LITE_PENDING_PATH_KEY, STALWART_EXCLUDED_FILES, STALWART_MAX_BUNDLE_BYTES, STALWART_SAFE_BUNDLE_BYTES, STALWART_ZIP_NAME,
|
||||
collectApiStrings, collectZipEntries, discoverBuiltLocales, flightTextRowsWithNeedles, inlineScriptHashes, isMainModule, listZipEntries, parseLiteTarget, resolveRepoRoot, stalwartEntryProblems, stalwartZipEntryProblems, unexpectedApiStrings,
|
||||
collectApiStrings, collectZipEntries, discoverBuiltLocales, flightTextRowsWithNeedles, inlineScriptHashes, isMainModule, listZipEntries, parseLiteTarget, resolveRepoRoot, stalwartEntryProblems, stalwartZipEntryProblems, unexpectedApiStrings, unexpectedEngineFiles,
|
||||
} from "./lib.mjs";
|
||||
|
||||
const repoRoot = resolveRepoRoot(import.meta.url);
|
||||
@@ -83,6 +83,10 @@ export function verifyExport({ root = repoRoot, target, safeBundleBytes = STALWA
|
||||
const unexpected = unexpectedApiStrings(apiStrings);
|
||||
for (const s of unexpected) problems.push(`client chunk references undocumented server endpoint ${s} (add an IS_LITE gate or document it in scripts/lite/lib.mjs)`);
|
||||
|
||||
if (existsSync(outDir)) {
|
||||
for (const file of unexpectedEngineFiles(collectZipEntries(outDir).map(({ name }) => name))) problems.push(`out/${file} is the local store's engine, which Lite must not ship`);
|
||||
}
|
||||
|
||||
let zipBytes = 0;
|
||||
if (resolvedTarget === "stalwart") {
|
||||
const entry = join(outDir, "index.html");
|
||||
|
||||
Reference in New Issue
Block a user