klenod-runtime 0.0.6 → 0.0.8
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: b7d30cadc8f70335c697f2974ee29843b6cf5baea08820c41779df984f3da013
|
|
4
|
+
data.tar.gz: 5d3d22a5164b695fc990df065b9ba7eacd56e2dfc555514b9882d4d3eeb2012e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 42933525078e0f9e8b574050bf42fa97bde62f61fff6c41cd7c6e8eb639465edecc3fd801c2dc5d7d25dea6289779e13a2856cded9e5c18bd5a6aa73de3f3f38
|
|
7
|
+
data.tar.gz: 4d96112ca70266198b4eb991acff14449ae3744d32a9e448a8f202f732fe2fbf05f085d34f13385edd41381f1ba4ccb7ec674c20d4ccc78760cf774bc9abe0a7
|
|
@@ -125,7 +125,9 @@ module Klenod
|
|
|
125
125
|
next unless mod.respond_to?(:constant_name)
|
|
126
126
|
|
|
127
127
|
display_path = mod.respond_to?(:path) ? mod.path : key
|
|
128
|
-
|
|
128
|
+
display_name = "Mod[#{display_path.inspect}]"
|
|
129
|
+
index["Klenod::Runtime::Generated::#{mod.constant_name}"] = display_name
|
|
130
|
+
index[mod.constant_name] = display_name
|
|
129
131
|
end
|
|
130
132
|
end
|
|
131
133
|
|
|
@@ -26,7 +26,7 @@ module Klenod
|
|
|
26
26
|
AssetReference = Data.define(:index, :asset)
|
|
27
27
|
|
|
28
28
|
class Bundle
|
|
29
|
-
attr_reader :entrypoints, :modules, :assets, :source_root, :base
|
|
29
|
+
attr_reader :entrypoints, :modules, :assets, :source_root, :base, :asset_origin, :namespace
|
|
30
30
|
|
|
31
31
|
def self.load(source, source_root: nil)
|
|
32
32
|
BundleFormat.load(source, source_root: source_root)
|
|
@@ -36,12 +36,14 @@ module Klenod
|
|
|
36
36
|
load(path, source_root: source_root)
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
def initialize(entrypoints, modules, assets, source_root: nil, base: AssetUrl::DEFAULT_BASE)
|
|
39
|
+
def initialize(entrypoints, modules, assets, source_root: nil, base: AssetUrl::DEFAULT_BASE, namespace: Module.new)
|
|
40
40
|
@entrypoints = entrypoints
|
|
41
41
|
@modules = modules
|
|
42
42
|
@source_root = source_root
|
|
43
43
|
@base = AssetUrl.normalize(base)
|
|
44
|
+
@asset_origin = AssetUrl.origin(@base)
|
|
44
45
|
@assets = bind_asset_urls(assets)
|
|
46
|
+
@namespace = namespace
|
|
45
47
|
@mods = {}
|
|
46
48
|
end
|
|
47
49
|
|
|
@@ -152,7 +154,9 @@ module Klenod
|
|
|
152
154
|
def marshal_load(data)
|
|
153
155
|
@entrypoints, @modules, assets, @source_root, base = data
|
|
154
156
|
@base = AssetUrl.normalize(base)
|
|
157
|
+
@asset_origin = AssetUrl.origin(@base)
|
|
155
158
|
@assets = bind_asset_urls(assets)
|
|
159
|
+
@namespace = Module.new
|
|
156
160
|
@mods = {}
|
|
157
161
|
end
|
|
158
162
|
|
|
@@ -313,7 +317,8 @@ module Klenod
|
|
|
313
317
|
source_map: spec.source_map,
|
|
314
318
|
version: spec.version,
|
|
315
319
|
constant_name: spec.constant_name,
|
|
316
|
-
eval_path: eval_path_for(spec)
|
|
320
|
+
eval_path: eval_path_for(spec),
|
|
321
|
+
namespace: namespace
|
|
317
322
|
)
|
|
318
323
|
end
|
|
319
324
|
|
data/lib/klenod/runtime/mod.rb
CHANGED
|
@@ -55,7 +55,7 @@ module Klenod
|
|
|
55
55
|
end
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
-
attr_reader :path, :source, :source_map, :version, :constant_name, :eval_path
|
|
58
|
+
attr_reader :path, :source, :source_map, :version, :constant_name, :eval_path, :namespace
|
|
59
59
|
|
|
60
60
|
def self.constant_name_for(path)
|
|
61
61
|
"Mod_#{Digest::SHA256.hexdigest(path)[0, 24]}"
|
|
@@ -65,7 +65,7 @@ module Klenod
|
|
|
65
65
|
"Mod(#{path.inspect})"
|
|
66
66
|
end
|
|
67
67
|
|
|
68
|
-
def initialize(path, source, imports: {}, source_map: nil, version: 0, constant_name: nil, eval_path: nil)
|
|
68
|
+
def initialize(path, source, imports: {}, source_map: nil, version: 0, constant_name: nil, eval_path: nil, namespace: Generated)
|
|
69
69
|
@path = path
|
|
70
70
|
@source = source
|
|
71
71
|
@imports = imports
|
|
@@ -73,6 +73,7 @@ module Klenod
|
|
|
73
73
|
@version = version
|
|
74
74
|
@constant_name = constant_name || self.class.constant_name_for(path)
|
|
75
75
|
@eval_path = eval_path || path
|
|
76
|
+
@namespace = namespace
|
|
76
77
|
register_constant
|
|
77
78
|
create_exports
|
|
78
79
|
end
|
|
@@ -84,6 +85,7 @@ module Klenod
|
|
|
84
85
|
def marshal_load(data)
|
|
85
86
|
@path, @source, @source_map, @version, @constant_name, @eval_path = data
|
|
86
87
|
@eval_path ||= @path
|
|
88
|
+
@namespace = Generated
|
|
87
89
|
@imports = {}
|
|
88
90
|
register_constant
|
|
89
91
|
create_exports
|
|
@@ -96,8 +98,8 @@ module Klenod
|
|
|
96
98
|
private
|
|
97
99
|
|
|
98
100
|
def register_constant
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
@namespace.__send__(:remove_const, @constant_name) if @namespace.const_defined?(@constant_name, false)
|
|
102
|
+
@namespace.const_set(@constant_name, self)
|
|
101
103
|
end
|
|
102
104
|
|
|
103
105
|
def create_exports
|