proscenium 0.15.0.beta.1-arm64-darwin → 0.15.0.beta.3-arm64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/proscenium/core_ext/object/css_module_ivars.rb +19 -0
- data/lib/proscenium/css_module/rewriter.rb +28 -0
- data/lib/proscenium/css_module.rb +16 -1
- data/lib/proscenium/ext/proscenium +0 -0
- data/lib/proscenium/railtie.rb +1 -5
- data/lib/proscenium/side_load.rb +6 -2
- data/lib/proscenium/version.rb +1 -1
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2999799368693e6ba1039debcea252c4aa08acb4f11691926da72f4d8a534468
|
4
|
+
data.tar.gz: 943329f79a8cad3aa6c54f932aaba3e2c6aa864340b0471c4efe184709c09579
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b83e31089cedad0ee04a9cd349814a5648d91d702df0f54ef32bbf28eeb6b5adf81d52469afa648575033253df78f1ef804dd9f13f7dae4472d01f1e2a4ad16
|
7
|
+
data.tar.gz: 9cfba29b9b6632641582d96ea4fa3eaedb9da232a797d5d53f2add5a4a36d9d5d1723191766d4340d6a5a0dc9fe90601c577ad058543d799668a2c84418f7df2
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Object
|
4
|
+
def instance_variable_get(name)
|
5
|
+
name.is_a?(::Proscenium::CssModule::Name) ? super(name.to_sym) : super
|
6
|
+
end
|
7
|
+
|
8
|
+
def instance_variable_set(name, obj)
|
9
|
+
name.is_a?(::Proscenium::CssModule::Name) ? super(name.to_sym, obj) : super
|
10
|
+
end
|
11
|
+
|
12
|
+
def instance_variable_defined?(name)
|
13
|
+
name.is_a?(::Proscenium::CssModule::Name) ? super(name.to_sym) : super
|
14
|
+
end
|
15
|
+
|
16
|
+
def remove_instance_variable(name)
|
17
|
+
name.is_a?(::Proscenium::CssModule::Name) ? super(name.to_sym) : super
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ruby-next/language'
|
4
|
+
require 'proscenium/core_ext/object/css_module_ivars'
|
5
|
+
|
6
|
+
module Proscenium
|
7
|
+
module CssModule
|
8
|
+
class Rewriter < RubyNext::Language::Rewriters::Text
|
9
|
+
NAME = 'proscenium-css-module'
|
10
|
+
|
11
|
+
def safe_rewrite(source)
|
12
|
+
source.gsub(/:@([\w_]+)/) do |_|
|
13
|
+
context.track! self
|
14
|
+
|
15
|
+
match = ::Regexp.last_match(1)
|
16
|
+
"Proscenium::CssModule::Name.new(:@#{match}, css_module(:#{match}))"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
RubyNext::Language.send :include_patterns=, []
|
24
|
+
RubyNext::Language.include_patterns << "#{Rails.root.join('app', 'components')}/*.rb"
|
25
|
+
RubyNext::Language.include_patterns << "#{Rails.root.join('app', 'views')}/*.rb"
|
26
|
+
RubyNext::Language.rewriters = [Proscenium::CssModule::Rewriter]
|
27
|
+
|
28
|
+
require 'ruby-next/language/runtime'
|
@@ -11,7 +11,22 @@ module Proscenium::CssModule
|
|
11
11
|
msg = "Failed to transform CSS module `#{name}`"
|
12
12
|
msg << ' - ' << additional_msg if additional_msg
|
13
13
|
|
14
|
-
super
|
14
|
+
super(msg)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class Name
|
19
|
+
def initialize(name, transform)
|
20
|
+
@name = name
|
21
|
+
@transform = transform
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_s
|
25
|
+
@transform
|
26
|
+
end
|
27
|
+
|
28
|
+
def to_sym
|
29
|
+
@name
|
15
30
|
end
|
16
31
|
end
|
17
32
|
|
Binary file
|
data/lib/proscenium/railtie.rb
CHANGED
@@ -16,11 +16,7 @@ module Proscenium
|
|
16
16
|
|
17
17
|
# Cache asset paths when building to path. Enabled by default in production.
|
18
18
|
# @see Proscenium::Builder#build_to_path
|
19
|
-
config.proscenium.cache = if Rails.env.
|
20
|
-
ActiveSupport::Cache::NullStore.new
|
21
|
-
else
|
22
|
-
ActiveSupport::Cache::MemoryStore.new
|
23
|
-
end
|
19
|
+
config.proscenium.cache = ActiveSupport::Cache::MemoryStore.new if Rails.env.production?
|
24
20
|
|
25
21
|
# TODO: implement!
|
26
22
|
config.proscenium.cache_query_string = Rails.env.production? && ENV.fetch('REVISION', nil)
|
data/lib/proscenium/side_load.rb
CHANGED
@@ -20,7 +20,8 @@ module Proscenium
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
def capture_and_replace_proscenium_stylesheets # rubocop:disable Metrics
|
23
|
+
def capture_and_replace_proscenium_stylesheets # rubocop:disable Metrics/*
|
24
|
+
return if response_body.nil?
|
24
25
|
return if response_body.first.blank? || !Proscenium::Importer.css_imported?
|
25
26
|
return unless response_body.first.include? '<!-- [PROSCENIUM_STYLESHEETS] -->'
|
26
27
|
|
@@ -43,13 +44,16 @@ module Proscenium
|
|
43
44
|
|
44
45
|
import = imports[inpath]
|
45
46
|
opts = import[:css].is_a?(Hash) ? import[:css] : {}
|
47
|
+
opts[:data] ||= {}
|
48
|
+
opts[:data][:original_href] = inpath
|
46
49
|
out << helpers.stylesheet_link_tag(outpath, extname: false, **opts)
|
47
50
|
end
|
48
51
|
|
49
52
|
response_body.first.gsub! '<!-- [PROSCENIUM_STYLESHEETS] -->', out.join.html_safe
|
50
53
|
end
|
51
54
|
|
52
|
-
def capture_and_replace_proscenium_javascripts # rubocop:disable Metrics
|
55
|
+
def capture_and_replace_proscenium_javascripts # rubocop:disable Metrics/*
|
56
|
+
return if response_body.nil?
|
53
57
|
return if response_body.first.blank? || !Proscenium::Importer.js_imported?
|
54
58
|
|
55
59
|
imports = Proscenium::Importer.imported.dup
|
data/lib/proscenium/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: proscenium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.15.0.beta.
|
4
|
+
version: 0.15.0.beta.3
|
5
5
|
platform: arm64-darwin
|
6
6
|
authors:
|
7
7
|
- Joel Moss
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -78,6 +78,20 @@ dependencies:
|
|
78
78
|
- - "<"
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '8.0'
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: ruby-next
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - "~>"
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 1.0.1
|
88
|
+
type: :runtime
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - "~>"
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 1.0.1
|
81
95
|
description:
|
82
96
|
email:
|
83
97
|
- joel@developwithstyle.com
|
@@ -90,8 +104,10 @@ files:
|
|
90
104
|
- README.md
|
91
105
|
- lib/proscenium.rb
|
92
106
|
- lib/proscenium/builder.rb
|
107
|
+
- lib/proscenium/core_ext/object/css_module_ivars.rb
|
93
108
|
- lib/proscenium/css_module.rb
|
94
109
|
- lib/proscenium/css_module/path.rb
|
110
|
+
- lib/proscenium/css_module/rewriter.rb
|
95
111
|
- lib/proscenium/css_module/transformer.rb
|
96
112
|
- lib/proscenium/ensure_loaded.rb
|
97
113
|
- lib/proscenium/ext/proscenium
|