# HG changeset patch # User nanaya # Date 1673890446 -32400 # Node ID 361ab9e7ffad7102518460887a320b188ac85353 # Parent 994ae0349aded4faff633ff4681db8236666c39c Replace webpacker with esbuild and use plain js instead of coffee diff -r 994ae0349ade -r 361ab9e7ffad .browserslistrc --- a/.browserslistrc Tue Jan 17 01:53:36 2023 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -defaults diff -r 994ae0349ade -r 361ab9e7ffad .hgignore --- a/.hgignore Tue Jan 17 01:53:36 2023 +0900 +++ b/.hgignore Tue Jan 17 02:34:06 2023 +0900 @@ -1,4 +1,5 @@ ^\.bundle$ +^app/assets/builds$ ^config/config_local_(\w+)\.rb$ ^config/database\.yml$ ^config/newrelic\.yml$ @@ -7,7 +8,6 @@ ^node_modules$ ^public/assets$ ^public/cache$ -^public/packs$ ^public/robots\.txt$ ^tmp$ ^vendor/bundle$ diff -r 994ae0349ade -r 361ab9e7ffad Gemfile --- a/Gemfile Tue Jan 17 01:53:36 2023 +0900 +++ b/Gemfile Tue Jan 17 02:34:06 2023 +0900 @@ -3,7 +3,8 @@ gem "rails", "~> 7.0.1" gem "sass-rails" gem "autoprefixer-rails" -gem "webpacker" +gem "sprockets-rails" +gem "jsbundling-rails" # Bundle edge Rails instead: # gem "rails", :git => "git://github.com/rails/rails.git" diff -r 994ae0349ade -r 361ab9e7ffad Gemfile.lock --- a/Gemfile.lock Tue Jan 17 01:53:36 2023 +0900 +++ b/Gemfile.lock Tue Jan 17 02:34:06 2023 +0900 @@ -79,6 +79,8 @@ activesupport (>= 5.0) i18n (1.12.0) concurrent-ruby (~> 1.0) + jsbundling-rails (1.1.1) + railties (>= 6.0.0) loofah (2.19.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) @@ -111,8 +113,6 @@ nio4r (~> 2.0) racc (1.6.2) rack (2.2.5) - rack-proxy (0.7.4) - rack rack-test (2.0.2) rack (>= 1.3) rails (7.0.4) @@ -152,7 +152,6 @@ sprockets (> 3.0) sprockets-rails tilt - semantic_range (3.0.0) sprockets (4.2.0) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) @@ -165,11 +164,6 @@ timeout (0.3.1) tzinfo (2.0.5) concurrent-ruby (~> 1.0) - webpacker (5.4.3) - activesupport (>= 5.2) - rack-proxy (>= 0.6.1) - railties (>= 5.2) - semantic_range (>= 2.3.0) websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) @@ -180,12 +174,13 @@ DEPENDENCIES autoprefixer-rails + jsbundling-rails newrelic_rpm pg puma rails (~> 7.0.1) sass-rails - webpacker + sprockets-rails BUNDLED WITH 2.4.3 diff -r 994ae0349ade -r 361ab9e7ffad app/assets/config/manifest.js --- a/app/assets/config/manifest.js Tue Jan 17 01:53:36 2023 +0900 +++ b/app/assets/config/manifest.js Tue Jan 17 02:34:06 2023 +0900 @@ -1,1 +1,3 @@ +//= link application.js +//= link application_classic.js //= link_directory ../stylesheets .css diff -r 994ae0349ade -r 361ab9e7ffad app/assets/javascripts/application_classic.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/assets/javascripts/application_classic.js Tue Jan 17 02:34:06 2023 +0900 @@ -0,0 +1,5 @@ +//= require jquery/dist/jquery +//= require bootstrap/js/dist/util +//= require bootstrap/js/dist/collapse +//= require bootstrap/js/dist/modal +//= require bootstrap/js/dist/tab diff -r 994ae0349ade -r 361ab9e7ffad app/javascript/application.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/javascript/application.js Tue Jan 17 02:34:06 2023 +0900 @@ -0,0 +1,89 @@ +import 'bootstrap'; +import hljs from 'highlight.js'; +import * as commonmark from 'commonmark'; + +/* global $ */ +$(document).on('click', '.js-paste-clear', (e) => { + e.preventDefault(); + $('.js-paste-paste') + .val('') + .focus(); +}); + +function loadLanguageItems () { + const $languageSelectBox = $('#paste_language'); + if ($languageSelectBox.length === 0) return; + + for (const language of hljs.listLanguages().sort()) { + $languageSelectBox.append($( + '