klenod-plugin-javascript 0.0.14 → 0.0.15
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3c8464e3833b7ea07785ee149f36573ef7eecaa594cbaa0e80db676b23f7b24e
|
|
4
|
+
data.tar.gz: 04a644220d927ccb75dce5da97368b2f6fda74a40b2fc442899da229bce261fa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f5e7232182b2f214b46a9f6416700d8db21f1bada0c8b2c9abbd22a9d5b8d6abc6776d3c0e789add63ffcfbf41525bfad38214d2bb8d1a299001675843628c1f
|
|
7
|
+
data.tar.gz: 5f1d84b30baefca55d175f3350008850af922c6b9113230c4fc558154908f423684008f0d07071d8ce0c725fe4ae53453cdc042cc24d2e03fa6fe961c71d6764
|
|
@@ -73,6 +73,8 @@ module Klenod
|
|
|
73
73
|
return super unless EXTENSIONS.include?(module_id.extname)
|
|
74
74
|
|
|
75
75
|
custom_element = custom_element_module?(module_id)
|
|
76
|
+
return analysis_transform(module_id, code, custom_element) if context.analysis?
|
|
77
|
+
|
|
76
78
|
jsx_runtime_namespace = custom_element ? jsx_runtime_namespace(module_id) : nil
|
|
77
79
|
transform =
|
|
78
80
|
begin
|
|
@@ -109,6 +111,22 @@ module Klenod
|
|
|
109
111
|
)
|
|
110
112
|
end
|
|
111
113
|
|
|
114
|
+
# Analysis only needs the module graph: imports are scanned without
|
|
115
|
+
# compiling, and the missing javascript_source makes finalize skip
|
|
116
|
+
# import rewriting and asset emission.
|
|
117
|
+
def analysis_transform(module_id, code, custom_element)
|
|
118
|
+
imports = Parser::FallbackScanner.new(code, module_id.to_s).imports
|
|
119
|
+
|
|
120
|
+
Klenod::Build::TransformResult.new(
|
|
121
|
+
module_source(nil),
|
|
122
|
+
build_dependencies(module_id, imports),
|
|
123
|
+
nil,
|
|
124
|
+
[],
|
|
125
|
+
[],
|
|
126
|
+
{javascript_imports: imports, javascript_custom_element: custom_element}
|
|
127
|
+
)
|
|
128
|
+
end
|
|
129
|
+
|
|
112
130
|
def finalize(module_id, result, resolved_dependencies, dependency_records, context)
|
|
113
131
|
source = result.metadata[:javascript_source]
|
|
114
132
|
original_source = result.metadata[:javascript_original_source]
|
|
@@ -90,7 +90,7 @@ module Klenod
|
|
|
90
90
|
return nil unless module_id.scheme == SCHEME
|
|
91
91
|
|
|
92
92
|
path = absolute_path(module_id, context)
|
|
93
|
-
LoadResult.new(path.read(encoding: "UTF-8"), Hashing.file_hexdigest(path), nil)
|
|
93
|
+
LoadResult.new(path.read(encoding: "UTF-8"), context.analysis? ? Hashing.file_key(path) : Hashing.file_hexdigest(path), nil)
|
|
94
94
|
end
|
|
95
95
|
|
|
96
96
|
private
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: klenod-plugin-javascript
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.15
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrés Alin
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - '='
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.0.
|
|
18
|
+
version: 0.0.15
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - '='
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.0.
|
|
25
|
+
version: 0.0.15
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: rb_sys
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|