Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: bundle with vite #9757

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ tests/clover*.xml
node_modules/

/js
/css

# packaged app
build/artifacts
Expand Down
8 changes: 8 additions & 0 deletions babel.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

const babelConfig = require('@nextcloud/babel-config')

module.exports = babelConfig
15 changes: 0 additions & 15 deletions babel.config.js

This file was deleted.

4 changes: 3 additions & 1 deletion jest.config.js → jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ module.exports = {
require.resolve('jest-transform-stub'),
'^.+\\.jsx?$': require.resolve('babel-jest'),
},
// support the same @ -> src alias mapping in source code
moduleNameMapper: {
// support the same @ -> src alias mapping in source code
'^@/(.*)$': '<rootDir>/src/$1',
// trim "?raw" suffixes from svg imports
'(.*\\.svg)\\?raw$': '$1',
},
// serializer for snapshots
snapshotSerializers: [
Expand Down
4 changes: 2 additions & 2 deletions lib/Controller/MessagesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -601,8 +601,8 @@ public function getHtmlBody(int $id, bool $plain = false): Response {
$html,
$this->nonceManager->getNonce(),
$this->urlGenerator->getAbsoluteURL(
$this->urlGenerator->linkTo('mail', 'js/htmlresponse.js')
)
$this->urlGenerator->linkTo('mail', 'js/nextcloud-mail-htmlresponse.mjs')
),
);

// Harden the default security policy
Expand Down
3 changes: 2 additions & 1 deletion lib/Dashboard/MailWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ public function getUrl(): ?string {
* @inheritDoc
*/
public function load(): void {
Util::addScript(Application::APP_ID, 'dashboard');
Util::addScript(Application::APP_ID, 'nextcloud-mail-dashboard');
Util::addStyle(Application::APP_ID, 'nextcloud-mail-style');

$this->initialState->provideInitialState(
'mail-accounts',
Expand Down
2 changes: 1 addition & 1 deletion lib/Http/HtmlResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@ public function render(): string {
return $this->content;
}

return '<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><script nonce="' . $this->nonce . '" src="' . $this->scriptUrl . '"></script></head><body>' . $this->content . '<div data-iframe-height></div></body></html>';
return '<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><script nonce="' . $this->nonce . '" src="' . $this->scriptUrl . '" type="module"></script></head><body>' . $this->content . '<div data-iframe-height></div></body></html>';
}
}
Loading
Loading