middleman-importmap 0.1.0
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 +7 -0
- data/.gitignore +61 -0
- data/Gemfile +18 -0
- data/LICENSE +21 -0
- data/README.md +26 -0
- data/Rakefile +16 -0
- data/features/support/env.rb +4 -0
- data/lib/middleman-importmap/extension.rb +21 -0
- data/lib/middleman-importmap/helpers.rb +38 -0
- data/lib/middleman-importmap/version.rb +7 -0
- data/lib/middleman-importmap/views/javascript_impotmap_shim_tag.html.erb +6 -0
- data/lib/middleman-importmap/views/javascript_inline_impotmap_tag.html.erb +3 -0
- data/lib/middleman-importmap/views/javascript_inline_module_tag.html.erb +4 -0
- data/lib/middleman-importmap.rb +8 -0
- data/lib/middleman_extension.rb +3 -0
- data/middleman-importmap.gemspec +28 -0
- metadata +72 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fa6a34d5c0c79ece0369c0dabbc30bf59493a998a9e353a9b6609d5f46797ae8
|
4
|
+
data.tar.gz: a1dc98ff572e075939f0eefe0707a3e84230bef30d0bcd179946bf5f46468616
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 67fb7f8e7eb827bc60d497b8a232f5b6f707c7140bf1498c081d568840831d16d7b1ac1a6fffa67f3aae365b7faa868e54689b3bc80848d5f6516da066726c15
|
7
|
+
data.tar.gz: d0f1899ee1eac2caa92600d4960d5cb85957562fc3649217390df583513bca3a4167b1b009f8cef5c5479e05e9455a5d20149fcf6ba0b158ca72a9f7e1e6cf8f
|
data/.gitignore
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
# Ignore Byebug command history file.
|
17
|
+
.byebug_history
|
18
|
+
|
19
|
+
## Specific to RubyMotion:
|
20
|
+
.dat*
|
21
|
+
.repl_history
|
22
|
+
build/
|
23
|
+
*.bridgesupport
|
24
|
+
build-iPhoneOS/
|
25
|
+
build-iPhoneSimulator/
|
26
|
+
|
27
|
+
## Specific to RubyMotion (use of CocoaPods):
|
28
|
+
#
|
29
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
30
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
31
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
32
|
+
#
|
33
|
+
# vendor/Pods/
|
34
|
+
|
35
|
+
## Documentation cache and generated files:
|
36
|
+
/.yardoc/
|
37
|
+
/_yardoc/
|
38
|
+
/doc/
|
39
|
+
/rdoc/
|
40
|
+
|
41
|
+
## Environment normalization:
|
42
|
+
/.bundle/
|
43
|
+
/vendor/bundle
|
44
|
+
/lib/bundler/man/
|
45
|
+
|
46
|
+
# for a library or gem, you might want to ignore these files since the code is
|
47
|
+
# intended to run in multiple environments; otherwise, check them in:
|
48
|
+
# Gemfile.lock
|
49
|
+
# .ruby-version
|
50
|
+
# .ruby-gemset
|
51
|
+
|
52
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
53
|
+
.rvmrc
|
54
|
+
|
55
|
+
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
56
|
+
# .rubocop-https?--*
|
57
|
+
# Ignore bundler lock file
|
58
|
+
/Gemfile.lock
|
59
|
+
|
60
|
+
# Ignore pkg folder
|
61
|
+
/pkg
|
data/Gemfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# If you do not have OpenSSL installed, update
|
2
|
+
# the following line to use "http://" instead
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in middleman-importmap.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
group :development do
|
9
|
+
gem 'rake'
|
10
|
+
gem 'rdoc'
|
11
|
+
gem 'yard'
|
12
|
+
end
|
13
|
+
|
14
|
+
group :test do
|
15
|
+
gem 'cucumber'
|
16
|
+
gem 'aruba'
|
17
|
+
gem 'rspec'
|
18
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2022 Daniel Vinciguerra
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
# middleman-importmap
|
3
|
+
|
4
|
+
An Importmap extension for Middleman.
|
5
|
+
|
6
|
+
|
7
|
+
## Install
|
8
|
+
|
9
|
+
**Add gem to `Gemfile`**
|
10
|
+
|
11
|
+
`gem 'middleman-importmap'`
|
12
|
+
|
13
|
+
**Create the `importmap.yml` file at middleman root path**
|
14
|
+
|
15
|
+
`cd middleman_project && touch importmap.yml`
|
16
|
+
|
17
|
+
The importmap.yml file keep the same structure of importmap in HTML
|
18
|
+
|
19
|
+
|
20
|
+
## License
|
21
|
+
|
22
|
+
See `./LICENSE` file for more details.
|
23
|
+
|
24
|
+
## Author
|
25
|
+
|
26
|
+
Daniel Vinciguerra
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler"
|
4
|
+
Bundler::GemHelper.install_tasks
|
5
|
+
|
6
|
+
require "cucumber/rake/task"
|
7
|
+
|
8
|
+
Cucumber::Rake::Task.new(:cucumber, "Run features that should pass") do |t|
|
9
|
+
t.cucumber_opts = "--color --tags not @wip --strict"
|
10
|
+
end
|
11
|
+
|
12
|
+
require "rake/clean"
|
13
|
+
|
14
|
+
task test: ["cucumber"]
|
15
|
+
|
16
|
+
task default: :test
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "middleman-core"
|
4
|
+
require "moddleman-importmap/helpers"
|
5
|
+
|
6
|
+
module Middleman
|
7
|
+
class ImportmapExtension < Extension
|
8
|
+
option :entrypoint, "site", "define js entrypoint file"
|
9
|
+
option :use_shim, true, "use importmapdefine js entrypoint file"
|
10
|
+
|
11
|
+
def initialize(app, options_hash = {}, &block)
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
def after_configuration; end
|
16
|
+
|
17
|
+
helpers do
|
18
|
+
include ::Middleman::Importmap::Helpers
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "erb"
|
4
|
+
require "yaml"
|
5
|
+
|
6
|
+
module Middleman
|
7
|
+
module Importmap
|
8
|
+
module Helpers
|
9
|
+
def javascript_importmap_tags(entrypoint = "site", shim: true)
|
10
|
+
[
|
11
|
+
javascript_importmap_shim_tag,
|
12
|
+
javascript_inline_importmap_tag,
|
13
|
+
javascript_inline_module_tag(entrypoint),
|
14
|
+
].join
|
15
|
+
end
|
16
|
+
|
17
|
+
def javascript_importmap_shim_tag
|
18
|
+
template = File.join(File.dirname(__FILE__), "views/javascript_impotmap_shim_tag.html.erb")
|
19
|
+
erb = ERB.new(File.read(template))
|
20
|
+
erb.result
|
21
|
+
end
|
22
|
+
|
23
|
+
def javascript_inline_importmap_tag(importmap = "importmap.yml")
|
24
|
+
template = File.join(File.dirname(__FILE__), "views/javascript_inline_impotmap_tag.html.erb")
|
25
|
+
importmap_config = YAML.load_file(File.join(app.root_path, importmap), symbolize_names: true)
|
26
|
+
|
27
|
+
erb = ERB.new(File.read(template))
|
28
|
+
erb.result_with_hash(importmap: importmap_config)
|
29
|
+
end
|
30
|
+
|
31
|
+
def javascript_inline_module_tag(entrypoint)
|
32
|
+
template = File.join(File.dirname(__FILE__), "views/javascript_inline_module_tag.html.erb")
|
33
|
+
erb = ERB.new(File.read(template))
|
34
|
+
erb.result_with_hash(entrypoint: entrypoint)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
$LOAD_PATH.push(File.expand_path("../lib", __FILE__))
|
5
|
+
|
6
|
+
require "middleman-importmap/version"
|
7
|
+
|
8
|
+
Gem::Specification.new do |s|
|
9
|
+
s.name = "middleman-importmap"
|
10
|
+
s.version = Middleman::Importmap::VERSION
|
11
|
+
s.platform = Gem::Platform::RUBY
|
12
|
+
s.authors = ["Daniel Vinciguerra"]
|
13
|
+
s.email = ["daniel.vinciguerra@bivee.com.br"]
|
14
|
+
s.homepage = "https://github.com/dvinciguerra/middleman-importmap"
|
15
|
+
s.summary = "Middleman Importmap extension"
|
16
|
+
s.description = "An extension to port importmap assets to Middleman"
|
17
|
+
|
18
|
+
s.files = %x(git ls-files).split("\n")
|
19
|
+
s.test_files = %x(git ls-files -- {test,spec,features}/*).split("\n")
|
20
|
+
s.executables = %x(git ls-files -- bin/*).split("\n").map { |f| File.basename(f) }
|
21
|
+
s.require_paths = ["lib"]
|
22
|
+
|
23
|
+
# The version of middleman-core your extension depends on
|
24
|
+
s.add_runtime_dependency("middleman-core", [">= 4.4.2"])
|
25
|
+
|
26
|
+
# Additional dependencies
|
27
|
+
# s.add_runtime_dependency("gem-name", "gem-version")
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: middleman-importmap
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel Vinciguerra
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-03-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: middleman-core
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.4.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.4.2
|
27
|
+
description: An extension to port importmap assets to Middleman
|
28
|
+
email:
|
29
|
+
- daniel.vinciguerra@bivee.com.br
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".gitignore"
|
35
|
+
- Gemfile
|
36
|
+
- LICENSE
|
37
|
+
- README.md
|
38
|
+
- Rakefile
|
39
|
+
- features/support/env.rb
|
40
|
+
- lib/middleman-importmap.rb
|
41
|
+
- lib/middleman-importmap/extension.rb
|
42
|
+
- lib/middleman-importmap/helpers.rb
|
43
|
+
- lib/middleman-importmap/version.rb
|
44
|
+
- lib/middleman-importmap/views/javascript_impotmap_shim_tag.html.erb
|
45
|
+
- lib/middleman-importmap/views/javascript_inline_impotmap_tag.html.erb
|
46
|
+
- lib/middleman-importmap/views/javascript_inline_module_tag.html.erb
|
47
|
+
- lib/middleman_extension.rb
|
48
|
+
- middleman-importmap.gemspec
|
49
|
+
homepage: https://github.com/dvinciguerra/middleman-importmap
|
50
|
+
licenses: []
|
51
|
+
metadata: {}
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
requirements: []
|
67
|
+
rubygems_version: 3.2.15
|
68
|
+
signing_key:
|
69
|
+
specification_version: 4
|
70
|
+
summary: Middleman Importmap extension
|
71
|
+
test_files:
|
72
|
+
- features/support/env.rb
|