Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7a03836b9 | ||
|
|
172cfca95c | ||
|
|
b3517d3864 | ||
|
|
6595d42f86 |
@@ -80,12 +80,6 @@ tasks:
|
|||||||
OPEN: '{{.OPEN | default ""}}'
|
OPEN: '{{.OPEN | default ""}}'
|
||||||
env:
|
env:
|
||||||
BACKEND_URL: '{{.BACKEND_URL}}'
|
BACKEND_URL: '{{.BACKEND_URL}}'
|
||||||
# Dev-only browser-tab label so concurrent worktrees are distinguishable.
|
|
||||||
# Only the worktree folder basename (e.g. "wt1") is exposed — never the
|
|
||||||
# full path, hostname, or user. Consumed at dev-serve time by vite.config
|
|
||||||
# and dropped from production builds.
|
|
||||||
STIRLING_DEV_LABEL:
|
|
||||||
sh: basename "$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
|
|
||||||
cmds:
|
cmds:
|
||||||
- npx vite editor --mode {{.MODE}} --port {{.PORT}}{{if .OPEN}} --open{{end}}
|
- npx vite editor --mode {{.MODE}} --port {{.PORT}}{{if .OPEN}} --open{{end}}
|
||||||
|
|
||||||
|
|||||||
+16
-8
@@ -47,11 +47,15 @@ ext {
|
|||||||
modernJavaVersion = 25
|
modernJavaVersion = 25
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def buildJavaMajorVersion = (project.findProperty('javaVersion') ?: ext.modernJavaVersion).toString().toInteger()
|
||||||
|
def buildJavaLanguageVersion = JavaLanguageVersion.of(buildJavaMajorVersion)
|
||||||
|
def buildJavaVersion = JavaVersion.toVersion(buildJavaMajorVersion.toString())
|
||||||
|
|
||||||
java {
|
java {
|
||||||
sourceCompatibility = JavaVersion.VERSION_25
|
sourceCompatibility = buildJavaVersion
|
||||||
targetCompatibility = JavaVersion.VERSION_25
|
targetCompatibility = buildJavaVersion
|
||||||
toolchain {
|
toolchain {
|
||||||
languageVersion = JavaLanguageVersion.of(project.findProperty('javaVersion')?.toString() ?: '25')
|
languageVersion = buildJavaLanguageVersion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,10 +175,10 @@ subprojects {
|
|||||||
apply plugin: 'jacoco'
|
apply plugin: 'jacoco'
|
||||||
|
|
||||||
java {
|
java {
|
||||||
sourceCompatibility = JavaVersion.VERSION_25
|
sourceCompatibility = buildJavaVersion
|
||||||
targetCompatibility = JavaVersion.VERSION_25
|
targetCompatibility = buildJavaVersion
|
||||||
toolchain {
|
toolchain {
|
||||||
languageVersion = JavaLanguageVersion.of(25)
|
languageVersion = buildJavaLanguageVersion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,7 +266,7 @@ subprojects {
|
|||||||
|
|
||||||
tasks.withType(JavaCompile).configureEach {
|
tasks.withType(JavaCompile).configureEach {
|
||||||
options.encoding = "UTF-8"
|
options.encoding = "UTF-8"
|
||||||
options.release = rootProject.ext.modernJavaVersion
|
options.release = buildJavaMajorVersion
|
||||||
if (!project.hasProperty("noSpotless")) {
|
if (!project.hasProperty("noSpotless")) {
|
||||||
dependsOn "spotlessApply"
|
dependsOn "spotlessApply"
|
||||||
}
|
}
|
||||||
@@ -657,10 +661,14 @@ tasks.register('compileRestartHelper', JavaCompile) {
|
|||||||
source = fileTree(dir: 'scripts', include: 'RestartHelper.java')
|
source = fileTree(dir: 'scripts', include: 'RestartHelper.java')
|
||||||
classpath = files()
|
classpath = files()
|
||||||
destinationDirectory = layout.buildDirectory.dir("restart-helper-classes")
|
destinationDirectory = layout.buildDirectory.dir("restart-helper-classes")
|
||||||
def restartMajorVersion = project.ext.modernJavaVersion
|
def restartMajorVersion = buildJavaMajorVersion
|
||||||
|
def restartLanguageVersion = JavaLanguageVersion.of(restartMajorVersion)
|
||||||
def restartCompatibility = JavaVersion.toVersion(restartMajorVersion.toString())
|
def restartCompatibility = JavaVersion.toVersion(restartMajorVersion.toString())
|
||||||
sourceCompatibility = restartCompatibility
|
sourceCompatibility = restartCompatibility
|
||||||
targetCompatibility = restartCompatibility
|
targetCompatibility = restartCompatibility
|
||||||
|
javaCompiler = javaToolchains.compilerFor {
|
||||||
|
languageVersion = restartLanguageVersion
|
||||||
|
}
|
||||||
options.release.set(restartMajorVersion)
|
options.release.set(restartMajorVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
/**
|
|
||||||
* Prefixes the browser tab title with the current worktree name during local
|
|
||||||
* development so multiple concurrently-running worktrees (e.g. wt1, wt2, spdf1)
|
|
||||||
* are distinguishable at a glance instead of all showing "Stirling PDF".
|
|
||||||
*
|
|
||||||
* The label is injected as a build-time constant by vite.config, sourced from
|
|
||||||
* the top-level dev tasks. It is an empty string in production builds, so this
|
|
||||||
* whole feature compiles away to a no-op outside `vite` dev-serve.
|
|
||||||
*/
|
|
||||||
|
|
||||||
const LABEL =
|
|
||||||
typeof __DEV_WORKTREE_LABEL__ === "string" ? __DEV_WORKTREE_LABEL__ : "";
|
|
||||||
|
|
||||||
export function applyDevWorktreeLabel(): void {
|
|
||||||
if (!LABEL || typeof document === "undefined") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const prefix = `[${LABEL}] `;
|
|
||||||
|
|
||||||
const ensurePrefixed = () => {
|
|
||||||
if (!document.title.startsWith(prefix)) {
|
|
||||||
// The app rewrites document.title on route/tool changes; re-apply the
|
|
||||||
// prefix on top of whatever the app just set.
|
|
||||||
document.title = prefix + document.title;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ensurePrefixed();
|
|
||||||
|
|
||||||
const titleEl = document.querySelector("title");
|
|
||||||
if (titleEl) {
|
|
||||||
new MutationObserver(ensurePrefixed).observe(titleEl, {
|
|
||||||
childList: true,
|
|
||||||
characterData: true,
|
|
||||||
subtree: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -14,12 +14,9 @@ import { BrowserRouter } from "react-router-dom";
|
|||||||
import App from "@app/App";
|
import App from "@app/App";
|
||||||
import "@app/i18n"; // Initialize i18next
|
import "@app/i18n"; // Initialize i18next
|
||||||
import { BASE_PATH } from "@app/constants/app";
|
import { BASE_PATH } from "@app/constants/app";
|
||||||
import { applyDevWorktreeLabel } from "@app/utils/applyDevWorktreeLabel";
|
|
||||||
|
|
||||||
import { startEagerWasmCompilation } from "@app/services/wasmPrecompiler";
|
import { startEagerWasmCompilation } from "@app/services/wasmPrecompiler";
|
||||||
|
|
||||||
applyDevWorktreeLabel();
|
|
||||||
|
|
||||||
if (typeof window !== "undefined") {
|
if (typeof window !== "undefined") {
|
||||||
const scheduleCompilation = () => {
|
const scheduleCompilation = () => {
|
||||||
if (typeof requestIdleCallback === "function") {
|
if (typeof requestIdleCallback === "function") {
|
||||||
|
|||||||
Vendored
-7
@@ -29,10 +29,3 @@ interface ImportMetaEnv {
|
|||||||
interface ImportMeta {
|
interface ImportMeta {
|
||||||
readonly env: ImportMetaEnv;
|
readonly env: ImportMetaEnv;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Dev-only worktree folder basename injected by vite.config at dev-serve time
|
|
||||||
* (empty string in production builds). Used to prefix the browser tab title so
|
|
||||||
* concurrent worktrees are distinguishable.
|
|
||||||
*/
|
|
||||||
declare const __DEV_WORKTREE_LABEL__: string;
|
|
||||||
|
|||||||
@@ -182,13 +182,7 @@ const TSCONFIG_MAP: Record<BuildMode, string> = {
|
|||||||
prototypes: "./tsconfig.prototypes.vite.json",
|
prototypes: "./tsconfig.prototypes.vite.json",
|
||||||
};
|
};
|
||||||
|
|
||||||
export default defineConfig(async ({ mode, command }) => {
|
export default defineConfig(async ({ mode }) => {
|
||||||
// Dev-only browser-tab label (worktree folder basename) surfaced by the
|
|
||||||
// top-level dev tasks so concurrent worktrees have distinguishable tabs.
|
|
||||||
// Only injected during `vite` (dev serve) — never baked into a production
|
|
||||||
// build — and carries only the folder name, no path/host/user info.
|
|
||||||
const devWorktreeLabel =
|
|
||||||
command === "serve" ? (process.env.STIRLING_DEV_LABEL ?? "") : "";
|
|
||||||
// Load env files relative to this config (frontend/editor/), regardless of
|
// Load env files relative to this config (frontend/editor/), regardless of
|
||||||
// where the build was invoked from. The previous `process.cwd()` worked when
|
// where the build was invoked from. The previous `process.cwd()` worked when
|
||||||
// this file lived at frontend/, but after the editor was moved under
|
// this file lived at frontend/, but after the editor was moved under
|
||||||
@@ -256,9 +250,6 @@ export default defineConfig(async ({ mode, command }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
define: {
|
|
||||||
__DEV_WORKTREE_LABEL__: JSON.stringify(devWorktreeLabel),
|
|
||||||
},
|
|
||||||
plugins: [
|
plugins: [
|
||||||
react(),
|
react(),
|
||||||
...(runSubpath ? [subpathBareRedirectPlugin(runSubpath)] : []),
|
...(runSubpath ? [subpathBareRedirectPlugin(runSubpath)] : []),
|
||||||
|
|||||||
Reference in New Issue
Block a user