vite_ruby 3.0.0.beta.2 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b5eacc1f40e589613a5804a54aaf8f09a6b4000da7e8bd3ce05ae225fb76dc3
4
- data.tar.gz: 6dc5725316ed7aa13b5ca4531ea2ca2fd999c6fbe0d33770a9cbf7d479128b76
3
+ metadata.gz: 9cdcbf5bc964a78456156b8cd05e946e9f737a20832af1077fc5821c3340b135
4
+ data.tar.gz: 87bbae5376b7873a420e802df908c8fb0f544dd18d6c7b32d9464248acf08bcd
5
5
  SHA512:
6
- metadata.gz: c7c69993fb89ad7cd0d6f6a50d2a3a0bfe828c4be21875eb7c16c9f18cee13a15a7a7055876cb5b382c9db2c9f4f2b25a2e7178089374505bae7865265efb213
7
- data.tar.gz: 10f64b31dbd0120e00661a30350668b8a622b79111f575d244bf2f5c55ec0cba28e3269cccec7337244154b434188c290889f88a5874168aab6637f0000cfd28
6
+ metadata.gz: c7fdecb430b866c5fcfeca1b93389c35483a2937739b45cbccc15366bfe4f52792e9c3218db44357bbeaa41631894599da44ea22efcf0dcf24a00d25a1448277
7
+ data.tar.gz: d91ec79eb0d1e1f81e4eeb32d3f9a660b76ae5bdf4ed02b393a2b6289bcc2a8627ca4a6e997acd375c05c51a18910269bd01fd86cc588bbd3687aede5864017b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ ## [3.0.2](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@3.0.1...vite_ruby@3.0.2) (2021-10-29)
2
+
3
+
4
+ ### Features
5
+
6
+ * enable hmr when running tests in development with vite dev server ([e253bba](https://github.com/ElMassimo/vite_ruby/commit/e253bba26d164aabc7a9526df504c207ad2cf6f9))
7
+
8
+
9
+
10
+ ## [3.0.1](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@3.0.0...vite_ruby@3.0.1) (2021-10-27)
11
+
12
+
13
+ ### Features
14
+
15
+ * expose the `--watch` flag for the build command ([4e20d0a](https://github.com/ElMassimo/vite_ruby/commit/4e20d0a7b697b535e13335dac5a75fb8a193a133))
16
+
17
+
18
+
19
+ # [3.0.0](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@1.2.20...vite_ruby@3.0.0) (2021-08-16)
20
+
21
+ See https://github.com/ElMassimo/vite_ruby/pull/116 for features and breaking changes.
22
+
1
23
  ## [1.2.20](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@1.2.18...vite_ruby@1.2.20) (2021-07-30)
2
24
 
3
25
 
data/default.vite.json CHANGED
@@ -10,6 +10,7 @@
10
10
  "publicDir": "public",
11
11
  "entrypointsDir": "entrypoints",
12
12
  "sourceCodeDir": "app/frontend",
13
+ "skipCompatibilityCheck": false,
13
14
  "host": "localhost",
14
15
  "https": null,
15
16
  "port": 3036,
data/lib/tasks/vite.rake CHANGED
@@ -40,13 +40,15 @@ namespace :vite do
40
40
  end
41
41
  end
42
42
 
43
- if Rake::Task.task_defined?('assets:precompile')
44
- Rake::Task['assets:precompile'].enhance do |task|
45
- prefix = task.name.split(/#|assets:precompile/).first
46
- Rake::Task["#{ prefix }vite:build"].invoke
43
+ unless ENV['VITE_RUBY_SKIP_ASSETS_PRECOMPILE_EXTENSION'] == 'true'
44
+ if Rake::Task.task_defined?('assets:precompile')
45
+ Rake::Task['assets:precompile'].enhance do |task|
46
+ prefix = task.name.split(/#|assets:precompile/).first
47
+ Rake::Task["#{ prefix }vite:build"].invoke
48
+ end
49
+ else
50
+ Rake::Task.define_task('assets:precompile' => ['vite:install_dependencies', 'vite:build'])
47
51
  end
48
- else
49
- Rake::Task.define_task('assets:precompile' => ['vite:install_dependencies', 'vite:build'])
50
52
  end
51
53
 
52
54
  # Any prerequisite task that installs packages should also install build dependencies.
@@ -6,6 +6,7 @@ class ViteRuby::CLI::Build < ViteRuby::CLI::Vite
6
6
  desc 'Bundle all entrypoints using Vite.'
7
7
  shared_options
8
8
  option(:force, desc: 'Force the build even if assets have not changed', type: :boolean)
9
+ option(:watch, desc: 'Start the Rollup watcher and rebuild on files changes', type: :boolean)
9
10
 
10
11
  def call(**options)
11
12
  super { |args| ViteRuby.commands.build_from_task(*args) }
@@ -71,7 +71,7 @@ class ViteRuby::Commands
71
71
  warn <<~WARN
72
72
 
73
73
  vite binstub not found.
74
- Have you run `bundle binstub vite`?
74
+ Have you run `bundle binstub vite_ruby`?
75
75
  Make sure the bin directory and bin/vite are not included in .gitignore
76
76
  WARN
77
77
  end
@@ -147,7 +147,7 @@ private
147
147
  multi_env_config.fetch('all', {})
148
148
  .merge(multi_env_config.fetch(mode, {}))
149
149
  rescue Errno::ENOENT => error
150
- warn "Check that your vite.json configuration file is available in the load path:\n\n\t#{ error.message }\n\n"
150
+ $stderr << "Check that your vite.json configuration file is available in the load path:\n\n\t#{ error.message }\n\n"
151
151
  {}
152
152
  end
153
153
  end
@@ -159,7 +159,7 @@ private
159
159
  NOT_CONFIGURABLE_WITH_ENV = %w[additional_entrypoints watch_additional_paths].freeze
160
160
 
161
161
  # Internal: Configuration options that can be provided as env vars.
162
- CONFIGURABLE_WITH_ENV = (DEFAULT_CONFIG.keys + %w[mode root skip_compatibility_check] - NOT_CONFIGURABLE_WITH_ENV).freeze
162
+ CONFIGURABLE_WITH_ENV = (DEFAULT_CONFIG.keys + %w[mode root] - NOT_CONFIGURABLE_WITH_ENV).freeze
163
163
 
164
164
  # Internal: If any of these files is modified the build won't be skipped.
165
165
  DEFAULT_WATCHED_PATHS = %w[
@@ -149,20 +149,28 @@ private
149
149
  def resolve_entry_name(name, type: nil)
150
150
  name = with_file_extension(name.to_s, type)
151
151
 
152
- raise ArgumentError, "Asset names can not be relative. Found: #{ name }" if name.start_with?('.')
152
+ raise ArgumentError, "Asset names can not be relative. Found: #{ name }" if name.start_with?('.') && !name.include?('legacy-polyfills')
153
153
 
154
154
  # Explicit path, relative to the source_code_dir.
155
155
  name.sub(%r{^~/(.+)$}) { return Regexp.last_match(1) }
156
156
 
157
157
  # Explicit path, relative to the project root.
158
- name.sub(%r{^/(.+)$}) {
159
- return dev_server_running? ? File.join(FS_PREFIX, config.root, Regexp.last_match(1)) : Regexp.last_match(1)
160
- }
158
+ name.sub(%r{^/(.+)$}) { return resolve_absolute_entry(Regexp.last_match(1)) }
161
159
 
162
160
  # Sugar: Prefix with the entrypoints dir if the path is not nested.
163
161
  name.include?('/') ? name : File.join(config.entrypoints_dir, name)
164
162
  end
165
163
 
164
+ # Internal: Entry names in the manifest are relative to the Vite.js.
165
+ # During develoment, files outside the root must be requested explicitly.
166
+ def resolve_absolute_entry(name)
167
+ if dev_server_running?
168
+ File.join(FS_PREFIX, config.root, name)
169
+ else
170
+ config.root.join(name).relative_path_from(config.vite_root_dir).to_s
171
+ end
172
+ end
173
+
166
174
  # Internal: Adds a file extension to the file name, unless it already has one.
167
175
  def with_file_extension(name, entry_type)
168
176
  if File.extname(name).empty? && (ext = extension_for_type(entry_type))
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ViteRuby
4
- VERSION = '3.0.0.beta.2'
4
+ VERSION = '3.0.2'
5
5
 
6
6
  # Internal: Versions used by default when running `vite install`.
7
- DEFAULT_VITE_VERSION = '^2.5.0'
8
- DEFAULT_PLUGIN_VERSION = '^3.0.0-beta.3'
7
+ DEFAULT_VITE_VERSION = '^2.6.13'
8
+ DEFAULT_PLUGIN_VERSION = '^3.0.2'
9
9
  end
data/lib/vite_ruby.rb CHANGED
@@ -97,7 +97,7 @@ class ViteRuby
97
97
 
98
98
  # Public: The proxy for assets should only run in development mode.
99
99
  def run_proxy?
100
- config.mode == 'development'
100
+ config.mode == 'development' || (config.mode == 'test' && !ENV['CI'])
101
101
  rescue StandardError => error
102
102
  logger.error("Failed to check mode for Vite: #{ error.message }")
103
103
  false
@@ -10,6 +10,7 @@
10
10
  },
11
11
  "test": {
12
12
  "autoBuild": true,
13
- "publicOutputDir": "vite-test"
13
+ "publicOutputDir": "vite-test",
14
+ "port": 3037
14
15
  }
15
16
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vite_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.beta.2
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Máximo Mussini
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-16 00:00:00.000000000 Z
11
+ date: 2021-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-cli
@@ -201,8 +201,8 @@ homepage: https://github.com/ElMassimo/vite_ruby
201
201
  licenses:
202
202
  - MIT
203
203
  metadata:
204
- source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_ruby@3.0.0.beta.2/vite_ruby
205
- changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_ruby@3.0.0.beta.2/vite_ruby/CHANGELOG.md
204
+ source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_ruby@3.0.2/vite_ruby
205
+ changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_ruby@3.0.2/vite_ruby/CHANGELOG.md
206
206
  post_install_message: "Thanks for installing Vite Ruby!\n\nIf you upgraded the gem
207
207
  manually, please run:\n\tbundle exec vite upgrade"
208
208
  rdoc_options: []
@@ -215,9 +215,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
215
215
  version: '2.4'
216
216
  required_rubygems_version: !ruby/object:Gem::Requirement
217
217
  requirements:
218
- - - ">"
218
+ - - ">="
219
219
  - !ruby/object:Gem::Version
220
- version: 1.3.1
220
+ version: '0'
221
221
  requirements: []
222
222
  rubygems_version: 3.1.4
223
223
  signing_key: