Make Git a native feature with an off switch
- Add the native feature runtime in src/lib/features/: the catalog, the switches, the first-start migration, the loader, and the feature sessions. - Add Settings → Features and the features settings section. - Add features_legacy. It reads the old plugin packages and changes nothing. - Move Git from the plugin into src/lib/features/git/, on host internals. - Remove api.git, the git contribution key, and the SDK Git types. - Add pnpm check:features. It fails when a feature module loads at start. - Update the tests, the menu inventory, the docs, and UI-055.
This commit is contained in:
+22
-2
@@ -2,7 +2,7 @@ import { defineConfig } from "vite";
|
||||
import { sveltekit } from "@sveltejs/kit/vite";
|
||||
import process from "node:process";
|
||||
import { createHash } from "node:crypto";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { readFileSync, writeFileSync } from "node:fs";
|
||||
|
||||
// The installer build sets RUNESTONE_VERSION. It writes package.json only after the build completes.
|
||||
const packageVersion = JSON.parse(readFileSync(new URL("./package.json", import.meta.url), "utf8")).version;
|
||||
@@ -77,8 +77,28 @@ function contentSecurityPolicy() {
|
||||
}
|
||||
|
||||
// https://vite.dev/config/
|
||||
/**
|
||||
* The chunk report for `pnpm check:features` (scripts/featureChunks.mjs). With RUNESTONE_FEATURE_CHUNKS set, the client build
|
||||
* writes its chunks to that file: names, entry flags, static imports, and module IDs. Other builds do not use it.
|
||||
* @returns {import("vite").Plugin}
|
||||
*/
|
||||
function featureChunkReport() {
|
||||
return {
|
||||
name: "runestone-feature-chunks",
|
||||
apply: "build",
|
||||
generateBundle(_options, bundle) {
|
||||
if (this.environment?.name === "ssr") return;
|
||||
const chunks = Object.values(bundle).filter(item => item.type === "chunk").map(chunk => ({
|
||||
fileName: chunk.fileName, isEntry: chunk.isEntry, isDynamicEntry: chunk.isDynamicEntry,
|
||||
facadeModuleId: chunk.facadeModuleId, imports: chunk.imports, moduleIds: chunk.moduleIds, size: chunk.code.length,
|
||||
}));
|
||||
writeFileSync(/** @type {string} */ (process.env.RUNESTONE_FEATURE_CHUNKS), JSON.stringify(chunks));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default defineConfig(() => ({
|
||||
plugins: [...(process.env.RUNESTONE_CSP === "1" ? [contentSecurityPolicy()] : []), sveltekit()],
|
||||
plugins: [...(process.env.RUNESTONE_CSP === "1" ? [contentSecurityPolicy()] : []), ...(process.env.RUNESTONE_FEATURE_CHUNKS ? [featureChunkReport()] : []), sveltekit()],
|
||||
define: {
|
||||
__RUNESTONE_VERSION__: JSON.stringify(appVersion),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user