minipack 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc8eca1d1f23c89720efbc82ceaa6afe4b914295e42be8edd661a22bdedafe43
4
- data.tar.gz: b8fa5684228e7d29882f98c1cff298414f48cb8df94929ee215560b081e355a3
3
+ metadata.gz: d47e53dced7bb9112a2b25cc87e72afc8b46d6f8e0094e3e45ebad30658025b3
4
+ data.tar.gz: 501f45243494b6eb9d0923d77f5556176b37b9b285c22222d734a46aba14b6c9
5
5
  SHA512:
6
- metadata.gz: ccd21785cac03e000600d35917f51f5a263b01c356ad07cb74ed6c26a9fc8fdee2620856416769405560308c3b8a5f4d501827399ebde570b0444c71868fe642
7
- data.tar.gz: 90f9e18cdf3b56ce4d102ad7603579799398cbd44496e673950a717c7af5d7fa5db0211df571bb09edf44da3dbfe4d4fa13db6ba0a3b9ce203e1fe67aebf282a
6
+ metadata.gz: 8657e7b6dc81587b777a8308bf92df6167ba941b778b2549dc52b4e013ea28aeb414a97142597aaf88d7999f3868cf502e123dd7b9fe086020c249e831615883
7
+ data.tar.gz: 15c4be737e9477a05ae44bcb3873761ccea785159930f2c07ac9604d0d86c5670fd4f4b6ea78279de381776f10dea7d662d2690222faa59baa1b8e2546d8526f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 0.3.4 / 2020-01-26
2
+
3
+ ## Bug fixes
4
+
5
+ * Add support for integrity attribute when using experimental splitChunks (#27) by @Jukejc
6
+
1
7
  # 0.3.3 / 2019-09-12
2
8
 
3
9
  ## Enhancements:
@@ -41,7 +41,9 @@ module Minipack::Helper
41
41
  # <%= javascript_bundles_with_chunks_tag 'calendar' %>
42
42
  # <%= javascript_bundles_with_chunks_tag 'map' %>
43
43
  def javascript_bundles_with_chunks_tag(*names, manifest: nil, **options)
44
- javascript_include_tag(*sources_from_manifest_entrypoints(names, 'js', key: manifest), **options)
44
+ sources_from_manifest_entrypoints(names, 'js', key: manifest).map { |entry|
45
+ javascript_include_tag(entry.path, **options_for(entry, options))
46
+ }.join("\n").html_safe
45
47
  end
46
48
 
47
49
  # Examples:
@@ -76,7 +78,9 @@ module Minipack::Helper
76
78
  # <%= stylesheet_bundles_with_chunks_tag 'map' %>
77
79
  def stylesheet_bundles_with_chunks_tag(*names, manifest: nil, **options)
78
80
  if Minipack.configuration.extract_css?
79
- stylesheet_link_tag(*sources_from_manifest_entrypoints(names, 'css', key: manifest), **options)
81
+ sources_from_manifest_entrypoints(names, 'css', key: manifest).map { |entry|
82
+ stylesheet_link_tag(entry.path, **options_for(entry, options))
83
+ }.join("\n").html_safe
80
84
  end
81
85
  end
82
86
 
@@ -101,7 +105,7 @@ module Minipack::Helper
101
105
 
102
106
  def sources_from_manifest_entrypoints(names, type, key: nil)
103
107
  manifest = get_manifest_by_key(key)
104
- names.map { |name| manifest.lookup_pack_with_chunks!(name, type: type).entries.map(&:path) }.flatten.uniq
108
+ names.map { |name| manifest.lookup_pack_with_chunks!(name, type: type).entries }.flatten.uniq
105
109
  end
106
110
 
107
111
  def get_manifest_by_key(key = nil)
@@ -51,7 +51,12 @@ module Minipack
51
51
  manifest_pack_type = manifest_type(name, type)
52
52
  manifest_pack_name = manifest_name(name, manifest_pack_type)
53
53
  paths = data['entrypoints']&.dig(manifest_pack_name, manifest_pack_type) || handle_missing_entry(name)
54
- ChunkGroup.new(paths)
54
+
55
+ entries = data['entrypoints']&.dig(manifest_pack_name, manifest_pack_type).map do |source|
56
+ entry_from_source(source) || handle_missing_entry(name)
57
+ end
58
+
59
+ ChunkGroup.new(entries)
55
60
  end
56
61
 
57
62
  def lookup!(name)
@@ -122,5 +127,16 @@ module Minipack
122
127
  #{JSON.pretty_generate(@data)}
123
128
  MSG
124
129
  end
130
+
131
+ # Find an entry by its source
132
+ #
133
+ # @param [String] source
134
+ # @return [Minipack::Entry,nil]
135
+ def entry_from_source(source)
136
+ entry = assets.find { |entry| entry.is_a?(String) ? entry == source : entry['src'] == source }
137
+ return unless entry
138
+ entry.is_a?(String) ? Entry.new(entry) : Entry.new(entry['src'], integrity: entry['integrity'])
139
+ end
125
140
  end
126
141
  end
142
+
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Minipack
4
- VERSION = "0.3.3"
4
+ VERSION = "0.3.4"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minipack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nobuhiro Nikushi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-12 00:00:00.000000000 Z
11
+ date: 2020-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview