Convert from Webpack to Vite (#34450)

Co-authored-by: Renaud Chaput <renchap@gmail.com>
This commit is contained in:
Echo 2025-05-16 15:26:12 +02:00 committed by GitHub
parent a5a2c6dc7e
commit c4f47adb49
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
100 changed files with 2031 additions and 7424 deletions

View file

@ -1,7 +1,7 @@
- content_for :page_title do
= t('auth.login')
= javascript_pack_tag 'two_factor_authentication', crossorigin: 'anonymous'
= vite_typescript_tag 'two_factor_authentication.ts', crossorigin: 'anonymous'
- if webauthn_enabled?
= render partial: 'auth/sessions/two_factor/webauthn_form', locals: { hidden: @scheme_type != 'webauthn' }

View file

@ -1,7 +1,7 @@
- content_for :page_title do
= t('auth.setup.title')
= javascript_pack_tag 'sign_up', crossorigin: 'anonymous'
= vite_typescript_tag 'sign_up.ts', crossorigin: 'anonymous'
= simple_form_for(@user, url: auth_setup_path) do |f|
= render 'auth/shared/progress', stage: 'confirm'

View file

@ -1,7 +1,7 @@
- content_for :header_tags do
= render_initial_state
= javascript_pack_tag 'public', crossorigin: 'anonymous'
= javascript_pack_tag 'admin', async: true, crossorigin: 'anonymous'
= vite_typescript_tag 'public.tsx', crossorigin: 'anonymous'
= vite_typescript_tag 'admin.tsx', crossorigin: 'anonymous'
- content_for :body_classes, 'admin'

View file

@ -26,11 +26,13 @@
%title= html_title
= theme_style_tags current_theme
= vite_client_tag
= vite_react_refresh_tag
-# Needed for the wicg-inert polyfill. It needs to be on it's own <style> tag, with this `id`
= stylesheet_pack_tag 'inert', media: 'all', crossorigin: 'anonymous', id: 'inert-style'
= vite_stylesheet_tag 'styles/entrypoints/inert.scss', media: 'all', id: 'inert-style'
= vite_typescript_tag 'common.ts', crossorigin: 'anonymous'
= javascript_pack_tag 'common', crossorigin: 'anonymous'
= preload_pack_asset "locale/#{I18n.locale}-json.js"
= vite_preload_file_tag "mastodon/locales/#{I18n.locale}.json"
= csrf_meta_tags unless skip_csrf_meta_tags?
%meta{ name: 'style-nonce', content: request.content_security_policy_nonce }

View file

@ -1,5 +1,5 @@
- content_for :header_tags do
= javascript_pack_tag 'public', crossorigin: 'anonymous'
= vite_typescript_tag 'public.tsx', crossorigin: 'anonymous'
- content_for :content do
.container-alt

View file

@ -11,11 +11,12 @@
- if storage_host?
%link{ rel: 'dns-prefetch', href: storage_host }/
= vite_client_tag
= vite_react_refresh_tag
= theme_style_tags 'mastodon-light'
= javascript_pack_tag 'common', integrity: true, crossorigin: 'anonymous'
= preload_pack_asset "locale/#{I18n.locale}-json.js"
= vite_preload_file_tag "mastodon/locales/#{I18n.locale}.json"
= render_initial_state
= javascript_pack_tag 'embed', integrity: true, crossorigin: 'anonymous'
= vite_typescript_tag 'embed.tsx', integrity: true, crossorigin: 'anonymous'
%body.embed
= yield

View file

@ -5,9 +5,10 @@
%meta{ charset: 'utf-8' }/
%title= safe_join([yield(:page_title), Setting.default_settings['site_title']], ' - ')
%meta{ content: 'width=device-width,initial-scale=1', name: 'viewport' }/
= vite_client_tag
= vite_react_refresh_tag
= theme_style_tags Setting.default_settings['theme']
= javascript_pack_tag 'common', crossorigin: 'anonymous'
= javascript_pack_tag 'error', crossorigin: 'anonymous'
= vite_typescript_tag 'error.ts', crossorigin: 'anonymous'
%body.error
.dialog
.dialog__illustration

View file

@ -3,6 +3,4 @@
%head
%meta{ charset: 'utf-8' }/
= javascript_pack_tag 'common', crossorigin: 'anonymous'
= yield :header_tags

View file

@ -18,7 +18,7 @@
<o:PixelsPerInch>96</o:PixelsPerInch>
</o:OfficeDocumentSettings>
</xml>
= stylesheet_pack_tag 'mailer'
= vite_stylesheet_tag 'styles/entrypoints/mailer.scss'
%body
.email{ dir: locale_direction }
%table.email-w-full{ cellspacing: 0, cellpadding: 0, border: 0, role: 'presentation' }

View file

@ -1,5 +1,5 @@
- content_for :header_tags do
= javascript_pack_tag 'public', crossorigin: 'anonymous'
= vite_typescript_tag 'public.tsx', crossorigin: 'anonymous'
- content_for :body_classes, 'modal-layout compose-standalone'

View file

@ -1,6 +1,6 @@
- content_for :header_tags do
= render_initial_state
= javascript_pack_tag 'public', crossorigin: 'anonymous'
= vite_typescript_tag 'public.tsx', crossorigin: 'anonymous'
- content_for :body_classes, 'player'

View file

@ -2,7 +2,7 @@
= t('settings.relationships')
- content_for :header_tags do
= javascript_pack_tag 'admin', async: true, crossorigin: 'anonymous'
= vite_typescript_tag 'admin.tsx', crossorigin: 'anonymous'
.filters
.filter-subset

View file

@ -1,4 +1,4 @@
- content_for :header_tags do
%meta{ name: 'robots', content: 'noindex' }/
= javascript_pack_tag 'remote_interaction_helper', crossorigin: 'anonymous'
= vite_typescript_tag 'remote_interaction_helper.ts', crossorigin: 'anonymous'

View file

@ -13,4 +13,4 @@
.actions
= f.button :button, t('webauthn_credentials.add'), class: 'js-webauthn', type: :submit
= javascript_pack_tag 'two_factor_authentication', crossorigin: 'anonymous'
= vite_typescript_tag 'two_factor_authentication.ts', crossorigin: 'anonymous'

View file

@ -1,15 +1,12 @@
- content_for :body_classes, 'app-body'
- content_for :header_tags do
- if user_signed_in?
= preload_pack_asset 'features/compose.js'
= preload_pack_asset 'features/home_timeline.js'
= preload_pack_asset 'features/notifications.js'
%meta{ name: 'initialPath', content: request.path }
%meta{ name: 'applicationServerKey', content: Rails.configuration.x.vapid_public_key }
= render_initial_state
= javascript_pack_tag 'application', crossorigin: 'anonymous'
= vite_typescript_tag 'application.ts', crossorigin: 'anonymous'
.notranslate.app-holder#mastodon{ data: { props: Oj.dump(default_props) } }
%noscript

View file

@ -1,5 +1,5 @@
- content_for :header_tags do
= render_initial_state
= javascript_pack_tag 'share', crossorigin: 'anonymous'
= vite_typescript_tag 'share.tsx', crossorigin: 'anonymous'
#mastodon-compose{ data: { props: Oj.dump(default_props) } }