diff --git a/Gemfile.lock b/Gemfile.lock index 603dc190..e4ebb230 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -88,6 +88,8 @@ GEM railties (>= 4.1.0) responders warden (~> 1.2.3) + dry-cli (0.6.0) + concurrent-ruby (~> 1.0) erubi (1.10.0) factory_bot (6.1.0) activesupport (>= 5.0.0) @@ -231,10 +233,12 @@ GEM tzinfo (2.0.4) concurrent-ruby (~> 1.0) unicode-display_width (2.0.0) - vite_rails (1.0.12) - activesupport (>= 5.1) - rack-proxy (>= 0.6.1) + vite_rails (2.0.2) railties (>= 5.1) + vite_ruby + vite_ruby (1.0.2) + dry-cli (~> 0.6) + rack-proxy (>= 0.6.1) zeitwerk warden (1.2.9) rack (>= 2.0.9) diff --git a/bin/vite b/bin/vite index 07df4088..11fb801e 100755 --- a/bin/vite +++ b/bin/vite @@ -1,17 +1,29 @@ #!/usr/bin/env ruby # frozen_string_literal: true -ENV['RAILS_ENV'] ||= ENV['RACK_ENV'] || 'development' -ENV['NODE_ENV'] ||= ENV['RAILS_ENV'] == 'development' ? 'development' : 'production' +# +# This file was generated by Bundler. +# +# The application 'vite' is installed as part of a gem, and +# this file is here to facilitate running it. +# -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', Pathname.new(__FILE__).realpath) +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) -require 'bundler/setup' +bundle_binstub = File.expand_path("../bundle", __FILE__) -require 'vite_rails' - -APP_ROOT = File.expand_path('..', __dir__) -Dir.chdir(APP_ROOT) do - ViteRails.run(ARGV) +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("vite_ruby", "vite") diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index a5f672ba..4a122012 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -14,10 +14,10 @@ if Rails.env.development? # If you are using webpack-dev-server then specify webpack-dev-server host - policy.connect_src :self, "http://#{ ViteRails.config.host_with_port }", "ws://#{ ViteRails.config.host_with_port }" + policy.connect_src :self, "http://#{ ViteRuby.config.host_with_port }", "ws://#{ ViteRuby.config.host_with_port }" # Inertia.js uses inline scripts to display error modal in development - policy.script_src :self, :unsafe_eval, "http://#{ ViteRails.config.host_with_port }", :unsafe_inline, 'https://polyfill.io' + policy.script_src :self, :unsafe_eval, "http://#{ ViteRuby.config.host_with_port }", :unsafe_inline, 'https://polyfill.io' else policy.connect_src(*[:self, ENV['MATOMO_HOST']].compact) policy.script_src(*[:self, 'https://polyfill.io', ENV['MATOMO_HOST'], :blob].compact) diff --git a/package.json b/package.json index 803fc5e4..1e902ce5 100644 --- a/package.json +++ b/package.json @@ -30,8 +30,8 @@ "postcss": "^8", "postcss-nested": "^5.0.3", "sass": "^1.32.6", - "vite": "^2.0.0-beta.65", - "vite-plugin-ruby": "^1.0.8", + "vite": "^2.0.0-beta.69", + "vite-plugin-ruby": "^1.0.11", "vite-plugin-vue2": "^1.2.0" }, "resolutions": { diff --git a/yarn.lock b/yarn.lock index 1fd00ee6..858cca0d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2103,11 +2103,6 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= -fsevents@~2.1.2: - version "2.1.3" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.3.tgz#fb738703ae8d2f9fe900c33836ddebee8b97f23e" - integrity sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ== - fsevents@~2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.1.tgz#b209ab14c61012636c8863507edf7fb68cc54e9f" @@ -3275,6 +3270,13 @@ rollup@^2.35.1: optionalDependencies: fsevents "~2.3.1" +rollup@^2.38.5: + version "2.39.0" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.39.0.tgz#be4f98c9e421793a8fec82c854fb567c35e22ab6" + integrity sha512-+WR3bttcq7zE+BntH09UxaW3bQo3vItuYeLsyk4dL2tuwbeSKJuvwiawyhEnvRdRgrII0Uzk00FpctHO/zB1kw== + optionalDependencies: + fsevents "~2.3.1" + run-parallel@^1.1.9: version "1.1.10" resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.1.10.tgz#60a51b2ae836636c81377df16cb107351bcd13ef" @@ -3646,11 +3648,12 @@ validate-npm-package-license@^3.0.1: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" -vite-plugin-ruby@^1.0.8: - version "1.0.8" - resolved "https://registry.yarnpkg.com/vite-plugin-ruby/-/vite-plugin-ruby-1.0.8.tgz#321410c2afa5ecee1a83a61a91cf0b93165a611a" - integrity sha512-mE61pWBpRaku/Yp4wEYNu4MM4Z5a3kaWEBT71sbXXK/AFclS6Xe3x6UdxruQFR2vR+LqgAB3pXAX1w1LYp7ivQ== +vite-plugin-ruby@^1.0.11: + version "1.0.11" + resolved "https://registry.yarnpkg.com/vite-plugin-ruby/-/vite-plugin-ruby-1.0.11.tgz#8ea87357d9a6e05160e489f7ec455fda5a2878cf" + integrity sha512-o9DCiBRIdtKl0Eda7iL1HlQstlOsMRBv8143XgAMOBKMqCSQqaDI01x0p+eUJ9QOIImSiUOL24cfHLv6tRilWg== dependencies: + debug "^4.3.1" fast-glob "^3.2.4" vite-plugin-vue2@^1.2.0: @@ -3677,17 +3680,17 @@ vite-plugin-vue2@^1.2.0: vue "^2.6.11" vue-template-compiler "^2.6.11" -vite@^2.0.0-beta.65: - version "2.0.0-beta.65" - resolved "https://registry.yarnpkg.com/vite/-/vite-2.0.0-beta.65.tgz#e4e4576c01b9906d5fb3568e4068c80354107a70" - integrity sha512-mdHNTP6fGeb8m8lWAM3UbSPw1+un1lUv0i4MQJcNiK2/P01RHIY02VjQeXBv3NemkExkgLji88LN9ySFMUQpIw== +vite@^2.0.0-beta.69: + version "2.0.0-beta.69" + resolved "https://registry.yarnpkg.com/vite/-/vite-2.0.0-beta.69.tgz#dd10b4c366d64e670a0da612097fe9645c40212b" + integrity sha512-Wf4bWOK/b6Q+06Wyk7uJIBy/LiENGx26do6tn9gOMRRZLEuLizN/cDzGqnQkGVVevbb18xdilyxhnTes0lFjZg== dependencies: esbuild "^0.8.34" postcss "^8.2.1" resolve "^1.19.0" - rollup "^2.35.1" + rollup "^2.38.5" optionalDependencies: - fsevents "~2.1.2" + fsevents "~2.3.1" vue-eslint-parser@^7.1.1, vue-eslint-parser@^7.4.1: version "7.4.1"