Skip to content

Commit 8636ce7

Browse files
pringelmannnextcloud-command
authored andcommitted
feat(core): load AppMenu as a deferred core script
Register the core/appmenu entry in the user layout so the waffle launcher mounts like every other core script. Signed-off-by: Peter Ringelmann <peter.ringelmann@nextcloud.com> Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
1 parent c968e27 commit 8636ce7

11 files changed

Lines changed: 99 additions & 18 deletions

File tree

core/src/appmenu/main.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
*
55
* Standalone entry for the waffle launcher (AppMenu). Mounts independently of
66
* core-main so the app grid lives in its own chunk.
7-
*
8-
* Uses Vue 2 syntax because the legacy webpack pipeline (build/frontend-legacy/)
9-
* still resolves `vue` to 2.7.16. The modern Vite pipeline ships Vue 3 but does
10-
* not currently include core; migrating core is out of scope for this work.
117
*/
128
import Vue from 'vue'
139
import AppMenu from './AppMenu.vue'
@@ -17,12 +13,14 @@ interface AppMenuInstance {
1713
}
1814

1915
declare global {
20-
// eslint-disable-next-line no-var
2116
var OC: {
2217
setNavigationCounter?: (id: string, counter: number) => void
2318
}
2419
}
2520

21+
/**
22+
* Mount the AppMenu into the header container, if present on this layout.
23+
*/
2624
function mount(): void {
2725
const container = document.getElementById('header-start__appmenu')
2826
if (!container) {
@@ -38,6 +36,4 @@ function mount(): void {
3836
}
3937
}
4038

41-
// Loaded as a deferred core script, so the document is already parsed and the
42-
// nav container exists by the time this runs.
4339
mount()

core/src/tests/appmenu/main.spec.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
*/
55
import { beforeEach, describe, expect, it, vi } from 'vitest'
66

7-
// Match every transitive dependency reachable from AppMenu.vue so its module
8-
// graph resolves cleanly inside JSDOM. We do NOT mock `vue`: the legacy Vitest
9-
// config aliases `vue` to Vue 2.7, which matches what the production webpack
10-
// bundle resolves to. Using the real Vue exercises the actual mount path.
117
vi.mock('@nextcloud/initial-state', () => ({
128
loadState: () => [],
139
}))
@@ -29,7 +25,6 @@ vi.mock('@nextcloud/router', () => ({
2925
}))
3026

3127
declare global {
32-
// eslint-disable-next-line no-var
3328
var OC: { setNavigationCounter?: (id: string, count: number) => void }
3429
}
3530

dist/core-appmenu.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/core-appmenu.js.license

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
SPDX-License-Identifier: MIT
2+
SPDX-License-Identifier: ISC
3+
SPDX-License-Identifier: GPL-3.0-or-later
4+
SPDX-License-Identifier: AGPL-3.0-or-later
5+
SPDX-License-Identifier: (MPL-2.0 OR Apache-2.0)
6+
SPDX-FileCopyrightText: escape-html developers
7+
SPDX-FileCopyrightText: Tobias Koppers @sokra
8+
SPDX-FileCopyrightText: Roman Shtylman <shtylman@gmail.com>
9+
SPDX-FileCopyrightText: Rob Cresswell <robcresswell@pm.me>
10+
SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors
11+
SPDX-FileCopyrightText: Guillaume Chau <guillaume.b.chau@gmail.com>
12+
SPDX-FileCopyrightText: GitHub Inc.
13+
SPDX-FileCopyrightText: Evan You
14+
SPDX-FileCopyrightText: Dr.-Ing. Mario Heiderich, Cure53 <mario@cure53.de> (https://cure53.de/)
15+
SPDX-FileCopyrightText: David Clark
16+
17+
18+
This file is generated from multiple sources. Included packages:
19+
- @nextcloud/auth
20+
- version: 2.6.0
21+
- license: GPL-3.0-or-later
22+
- @nextcloud/browser-storage
23+
- version: 0.5.0
24+
- license: GPL-3.0-or-later
25+
- semver
26+
- version: 7.7.2
27+
- license: ISC
28+
- @nextcloud/event-bus
29+
- version: 3.3.3
30+
- license: GPL-3.0-or-later
31+
- @nextcloud/initial-state
32+
- version: 3.0.0
33+
- license: GPL-3.0-or-later
34+
- @nextcloud/l10n
35+
- version: 3.4.1
36+
- license: GPL-3.0-or-later
37+
- @nextcloud/logger
38+
- version: 3.0.3
39+
- license: GPL-3.0-or-later
40+
- @nextcloud/router
41+
- version: 3.1.0
42+
- license: GPL-3.0-or-later
43+
- focus-trap
44+
- version: 7.8.0
45+
- license: MIT
46+
- @nextcloud/vue
47+
- version: 8.39.0
48+
- license: AGPL-3.0-or-later
49+
- css-loader
50+
- version: 7.1.2
51+
- license: MIT
52+
- dompurify
53+
- version: 3.4.2
54+
- license: (MPL-2.0 OR Apache-2.0)
55+
- escape-html
56+
- version: 1.0.3
57+
- license: MIT
58+
- floating-vue
59+
- version: 1.0.0-beta.19
60+
- license: MIT
61+
- process
62+
- version: 0.11.10
63+
- license: MIT
64+
- style-loader
65+
- version: 4.0.0
66+
- license: MIT
67+
- tabbable
68+
- version: 6.4.0
69+
- license: MIT
70+
- vue-loader
71+
- version: 15.11.1
72+
- license: MIT
73+
- vue-material-design-icons
74+
- version: 5.3.1
75+
- license: MIT
76+
- vue
77+
- version: 2.7.16
78+
- license: MIT
79+
- webpack
80+
- version: 5.106.2
81+
- license: MIT
82+
- nextcloud
83+
- version: 1.0.0
84+
- license: AGPL-3.0-or-later

dist/core-appmenu.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/core-appmenu.js.map.license

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
core-appmenu.js.license

dist/core-common.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/core-common.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/core-main.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/core-main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)