moxml 0.5.178 → 0.6.1
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 +4 -4
- data/.github/workflows/nightly-fuzz.yml +0 -14
- data/.github/workflows/performance-release.yml +0 -13
- data/.github/workflows/performance.yml +0 -17
- data/.github/workflows/rake.yml +0 -38
- data/.github/workflows/round-trip.yml +0 -45
- data/.github/workflows/windows.yml +0 -12
- data/Gemfile +4 -14
- data/README.adoc +5 -388
- data/Rakefile +2 -179
- data/docs/_references/processing-model.adoc +3 -2
- data/lib/moxml/adapter/customized_oga.rb +6 -4
- data/lib/moxml/adapter/customized_rexml/entity_reference.rb +3 -2
- data/lib/moxml/adapter/customized_rexml/formatter.rb +2 -2
- data/lib/moxml/adapter/customized_rexml.rb +5 -3
- data/lib/moxml/adapter/headed_ox.rb +0 -2
- data/lib/moxml/adapter/leptris.rb +0 -2
- data/lib/moxml/adapter/libxml.rb +0 -2
- data/lib/moxml/adapter/nokogiri.rb +0 -2
- data/lib/moxml/adapter/ox.rb +0 -2
- data/lib/moxml/adapter/rexml.rb +1 -3
- data/lib/moxml/adapter.rb +1 -11
- data/lib/moxml/config.rb +2 -26
- data/lib/moxml/entity_registry.rb +1 -5
- data/lib/moxml/native_attachment.rb +1 -3
- data/lib/moxml/reference/parser.rb +1 -2
- data/lib/moxml/reference/writer.rb +2 -2
- data/lib/moxml/reference.rb +1 -1
- data/lib/moxml/version.rb +1 -1
- data/lib/moxml/xml_utils.rb +1 -1
- data/lib/moxml.rb +1 -4
- data/spec/moxml/adapter/platform_spec.rb +2 -47
- data/spec/moxml/native_attachment_spec.rb +4 -50
- data/spec/moxml/signature/edge_cases_spec.rb +0 -1
- data/spec/spec_helper.rb +13 -31
- metadata +2 -22
- data/.github/workflows/opal.yml +0 -61
- data/.gitmodules +0 -6
- data/lib/compat/opal/moxml_boot.rb +0 -68
- data/lib/compat/opal/rexml/namespace.rb +0 -59
- data/lib/compat/opal/rexml/parsers/baseparser.rb +0 -1016
- data/lib/compat/opal/rexml/source.rb +0 -214
- data/lib/compat/opal/rexml/text.rb +0 -426
- data/lib/compat/opal/rexml/xmltokens.rb +0 -45
- data/lib/compat/opal/rexml_compat.rb +0 -77
- data/lib/moxml/entity_registry_opal_data.rb +0 -2138
- data/lib/moxml/native_attachment/opal.rb +0 -38
- data/spec/moxml/native_attachment/opal_spec.rb +0 -66
- data/spec/moxml/opal_oga_adapter_spec.rb +0 -20
- data/spec/moxml/opal_oga_features_spec.rb +0 -212
- data/spec/moxml/opal_oga_smoke_spec.rb +0 -35
- data/spec/moxml/opal_rexml_adapter_spec.rb +0 -14
- data/spec/moxml/opal_smoke_spec.rb +0 -61
- data/spec/moxml/reference_opal_spec.rb +0 -29
- data/spec/moxml/signature_autoload_spec.rb +0 -52
- data/spec/support/opal.rb +0 -16
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
module Moxml
|
|
4
4
|
module Adapter
|
|
5
5
|
# Lifecycle record (#495): engine-gap shims for the :rexml
|
|
6
|
-
# adapter
|
|
7
|
-
# moxml#489 phase 4)
|
|
8
|
-
#
|
|
6
|
+
# adapter. The Opal surface (this adapter's historical fallback
|
|
7
|
+
# role) is deleted (moxml#489 phase 4, 2026-10-31); the shims
|
|
8
|
+
# remain because the CRuby :rexml adapter calls them. The
|
|
9
|
+
# adapter's fate -- the owner's removal decision, consumer
|
|
10
|
+
# evidence in moxml#490 -- governs this file.
|
|
9
11
|
module CustomizedRexml
|
|
10
12
|
autoload :EntityReference,
|
|
11
13
|
"moxml/adapter/customized_rexml/entity_reference"
|
data/lib/moxml/adapter/libxml.rb
CHANGED
data/lib/moxml/adapter/ox.rb
CHANGED
data/lib/moxml/adapter/rexml.rb
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
require "rexml/document"
|
|
4
4
|
require "rexml/xpath"
|
|
5
5
|
require "rexml/streamlistener"
|
|
6
|
-
require "set"
|
|
7
|
-
require "stringio" if RUBY_ENGINE == "opal"
|
|
6
|
+
require "set"
|
|
8
7
|
|
|
9
8
|
module Moxml
|
|
10
9
|
module Adapter
|
|
@@ -697,7 +696,6 @@ module Moxml
|
|
|
697
696
|
end
|
|
698
697
|
|
|
699
698
|
def serialize(node, options = {})
|
|
700
|
-
output = StringIO.new("") if RUBY_ENGINE == "opal"
|
|
701
699
|
output ||= +""
|
|
702
700
|
|
|
703
701
|
if node.is_a?(::REXML::Document)
|
data/lib/moxml/adapter.rb
CHANGED
|
@@ -24,13 +24,6 @@ module Moxml
|
|
|
24
24
|
|
|
25
25
|
AVAILABLE_ADAPTERS = %i[nokogiri oga rexml ox headed_ox libxml leptris].freeze
|
|
26
26
|
|
|
27
|
-
# Adapters that work under the Opal (JavaScript) runtime.
|
|
28
|
-
# Oga is pure Ruby and designed with Opal compatibility in mind — it is the
|
|
29
|
-
# canonical XML parser for the JavaScript runtime. REXML is also pure Ruby
|
|
30
|
-
# but requires extensive runtime compat shims (regex features like /n,
|
|
31
|
-
# \u{...}, (?-mix:...) don't transpile cleanly), so it is opt-in only.
|
|
32
|
-
OPAL_AVAILABLE_ADAPTERS = %i[oga rexml].freeze
|
|
33
|
-
|
|
34
27
|
# Registry mapping adapter names to their class name suffixes.
|
|
35
28
|
# Special cases (like :headed_ox → "HeadedOx") live here instead of
|
|
36
29
|
# a case statement, keeping the dispatch open for extension.
|
|
@@ -78,7 +71,7 @@ module Moxml
|
|
|
78
71
|
end
|
|
79
72
|
|
|
80
73
|
def platform_adapters
|
|
81
|
-
|
|
74
|
+
AVAILABLE_ADAPTERS
|
|
82
75
|
end
|
|
83
76
|
|
|
84
77
|
private
|
|
@@ -99,9 +92,6 @@ module Moxml
|
|
|
99
92
|
end
|
|
100
93
|
|
|
101
94
|
def require_adapter(name)
|
|
102
|
-
# Opal pre-loads all dependencies via the Rakefile; skip runtime require.
|
|
103
|
-
return if RUBY_ENGINE == "opal"
|
|
104
|
-
|
|
105
95
|
require "moxml/adapter/base"
|
|
106
96
|
require "moxml/adapter/#{name}"
|
|
107
97
|
rescue LoadError
|
data/lib/moxml/config.rb
CHANGED
|
@@ -11,13 +11,9 @@ module Moxml
|
|
|
11
11
|
# when the installed leptris supports programmatic document
|
|
12
12
|
# construction (Leptris::XML::Document.create); otherwise moxml
|
|
13
13
|
# falls back to FALLBACK_ADAPTER so released-gem environments keep
|
|
14
|
-
# working.
|
|
15
|
-
# pure-Ruby fork was compiled into the bundle — stock oga requires
|
|
16
|
-
# its C extension and cannot load there; otherwise rexml.
|
|
14
|
+
# working.
|
|
17
15
|
PREFERRED_ADAPTER = :leptris
|
|
18
16
|
FALLBACK_ADAPTER = :nokogiri
|
|
19
|
-
OPAL_DEFAULT_ADAPTER = :oga
|
|
20
|
-
OPAL_FALLBACK_ADAPTER = :rexml
|
|
21
17
|
|
|
22
18
|
# Entity loading modes:
|
|
23
19
|
# - :required - Must load entities, raise error if unavailable (default)
|
|
@@ -45,8 +41,6 @@ module Moxml
|
|
|
45
41
|
end
|
|
46
42
|
|
|
47
43
|
def runtime_default_adapter
|
|
48
|
-
return opal_runtime_adapter if RUBY_ENGINE == "opal"
|
|
49
|
-
|
|
50
44
|
preferred = leptris_preferred_available?
|
|
51
45
|
return PREFERRED_ADAPTER if preferred == true
|
|
52
46
|
|
|
@@ -68,19 +62,6 @@ module Moxml
|
|
|
68
62
|
detect_loaded_adapter || FALLBACK_ADAPTER
|
|
69
63
|
end
|
|
70
64
|
|
|
71
|
-
# Stock oga requires its C extension, so under Opal the oga
|
|
72
|
-
# adapter can only come from the vendored pure-Ruby fork — a
|
|
73
|
-
# repo-only artifact the released gem does not ship. Bundles
|
|
74
|
-
# that compiled it in (moxml's own harness) keep oga; everyone
|
|
75
|
-
# else gets the rexml adapter, whose Opal compat ships in-gem.
|
|
76
|
-
# `defined?` is safe here: this branch never runs under MRI,
|
|
77
|
-
# where it would trigger autoload resolution.
|
|
78
|
-
def opal_runtime_adapter
|
|
79
|
-
return OPAL_DEFAULT_ADAPTER if defined?(Moxml::Adapter::Oga)
|
|
80
|
-
|
|
81
|
-
OPAL_FALLBACK_ADAPTER
|
|
82
|
-
end
|
|
83
|
-
|
|
84
65
|
# True when the leptris gem is installed AND meets the adapter's
|
|
85
66
|
# binding floor (issue #149; 1.9.32 — traverse bounding #89,
|
|
86
67
|
# built-docs parts #91, and every capability surface the adapter
|
|
@@ -92,12 +73,7 @@ module Moxml
|
|
|
92
73
|
|
|
93
74
|
@leptris_preferred_available =
|
|
94
75
|
begin
|
|
95
|
-
|
|
96
|
-
# resolves literal requires statically and dies on native-only
|
|
97
|
-
# gems (leptris is FFI; lutaml/moxml#475) before this rescue
|
|
98
|
-
# can degrade the adapter. The runtime require still raises
|
|
99
|
-
# LoadError under Opal, which the rescue below handles.
|
|
100
|
-
__send__(:require, "leptris")
|
|
76
|
+
require "leptris"
|
|
101
77
|
Moxml::Adapter.load(:leptris)
|
|
102
78
|
Gem::Version.new(::Leptris::VERSION) >=
|
|
103
79
|
Gem::Version.new(Moxml::Adapter::Leptris::MINIMUM_BINDING_VERSION)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "json"
|
|
3
|
+
require "json"
|
|
4
4
|
require "set"
|
|
5
5
|
|
|
6
6
|
module Moxml
|
|
@@ -107,10 +107,6 @@ module Moxml
|
|
|
107
107
|
# Load entity data from bundled gem data or local file
|
|
108
108
|
# @return [Hash{String => String}]
|
|
109
109
|
def load_entity_data
|
|
110
|
-
if RUBY_ENGINE == "opal"
|
|
111
|
-
return OPAL_ENTITY_DATA
|
|
112
|
-
end
|
|
113
|
-
|
|
114
110
|
# Try multiple paths in order of priority
|
|
115
111
|
paths_to_try = []
|
|
116
112
|
|
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
module Moxml
|
|
4
4
|
class NativeAttachment
|
|
5
|
-
autoload :Opal, "moxml/native_attachment/opal"
|
|
6
5
|
autoload :Native, "moxml/native_attachment/native"
|
|
7
6
|
|
|
8
7
|
def self.default_backend
|
|
9
|
-
|
|
10
|
-
const_get(constant).new
|
|
8
|
+
const_get(:Native).new
|
|
11
9
|
end
|
|
12
10
|
|
|
13
11
|
attr_reader :backend
|
|
@@ -4,8 +4,7 @@ module Moxml
|
|
|
4
4
|
module Reference
|
|
5
5
|
# A small, total XML reader for the model's input taxonomy. No
|
|
6
6
|
# recovery: malformed input raises a named ParseError. The only
|
|
7
|
-
# dependencies are Ruby's String and Regexp
|
|
8
|
-
# transpiles to the Opal lane.
|
|
7
|
+
# dependencies are Ruby's String and Regexp alone.
|
|
9
8
|
class Parser
|
|
10
9
|
NAME = /[A-Za-z_:][-A-Za-z0-9_:.]*/
|
|
11
10
|
XML_WHITESPACE = /[ \t\n\r]/
|
|
@@ -9,8 +9,8 @@ module Moxml
|
|
|
9
9
|
# declaration).
|
|
10
10
|
#
|
|
11
11
|
# Output is assembled as an array of parts and joined: the
|
|
12
|
-
# reference
|
|
13
|
-
#
|
|
12
|
+
# reference stays off mutable String#<< by design (cheap total
|
|
13
|
+
# behavior, no per-call buffer semantics).
|
|
14
14
|
class Writer
|
|
15
15
|
VOID_ELEMENTS = %w[
|
|
16
16
|
area base br col embed hr img input link meta param source
|
data/lib/moxml/reference.rb
CHANGED
|
@@ -5,7 +5,7 @@ module Moxml
|
|
|
5
5
|
# reader, writer, and normalizer that answer the processing model
|
|
6
6
|
# without any native engine. Adapters are differentially tested
|
|
7
7
|
# against these answers; the reference is also the lane for
|
|
8
|
-
# engine-free environments
|
|
8
|
+
# engine-free environments.
|
|
9
9
|
#
|
|
10
10
|
# The reference is deliberately small and total over the model's
|
|
11
11
|
# declared input taxonomy — every well-formed document the model
|
data/lib/moxml/version.rb
CHANGED
data/lib/moxml/xml_utils.rb
CHANGED
|
@@ -87,7 +87,7 @@ module Moxml
|
|
|
87
87
|
if defined?(URI::RFC3986_PARSER)
|
|
88
88
|
URI::RFC3986_PARSER.split(uri)
|
|
89
89
|
elsif uri.match?(/\A[a-zA-Z][a-zA-Z0-9+\-.]*:[^\x00-\x20]*\z/)
|
|
90
|
-
# Minimal
|
|
90
|
+
# Minimal validation where URI::RFC3986_PARSER is unavailable
|
|
91
91
|
else
|
|
92
92
|
# Accept relative references and bare paths
|
|
93
93
|
return unless uri.match?(/[\x00-\x08\x0B\x0C\x0E-\x1F]/)
|
data/lib/moxml.rb
CHANGED
|
@@ -89,9 +89,6 @@ module Moxml
|
|
|
89
89
|
autoload :Builder, "moxml/builder"
|
|
90
90
|
autoload :Entity, "moxml/entity"
|
|
91
91
|
autoload :EntityRegistry, "moxml/entity_registry"
|
|
92
|
-
# Opal has no autoload; the compat boot file requires this eagerly
|
|
93
|
-
# alongside the registry.
|
|
94
|
-
autoload :EntityRegistryOpalData, "moxml/entity_registry_opal_data"
|
|
95
92
|
autoload :NativeAttachment, "moxml/native_attachment"
|
|
96
93
|
autoload :XmlUtils, "moxml/xml_utils"
|
|
97
94
|
autoload :XmlEmitter, "moxml/xml_emitter"
|
|
@@ -101,7 +98,7 @@ module Moxml
|
|
|
101
98
|
autoload :Adapter, "moxml/adapter"
|
|
102
99
|
autoload :XPath, "moxml/xpath"
|
|
103
100
|
autoload :SAX, "moxml/sax"
|
|
104
|
-
autoload :Signature, "moxml/signature"
|
|
101
|
+
autoload :Signature, "moxml/signature"
|
|
105
102
|
autoload :C14n, "moxml/c14n"
|
|
106
103
|
autoload :Reference, "moxml/reference"
|
|
107
104
|
autoload :XSLT, "moxml/xslt"
|
|
@@ -9,7 +9,7 @@ RSpec.describe Moxml::Adapter do
|
|
|
9
9
|
:rexml, :ox)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
it "uses the AVAILABLE_ADAPTERS constant
|
|
12
|
+
it "uses the AVAILABLE_ADAPTERS constant" do
|
|
13
13
|
expect(described_class.platform_adapters).to eq(Moxml::Adapter::AVAILABLE_ADAPTERS)
|
|
14
14
|
end
|
|
15
15
|
end
|
|
@@ -19,49 +19,9 @@ RSpec.describe Moxml::Adapter do
|
|
|
19
19
|
expect(described_class.available?(:oga)).to be true
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
it "returns true for :nokogiri
|
|
22
|
+
it "returns true for :nokogiri" do
|
|
23
23
|
expect(described_class.available?(:nokogiri)).to be true
|
|
24
24
|
end
|
|
25
|
-
|
|
26
|
-
context "when Opal platform adapters are in effect" do
|
|
27
|
-
before do
|
|
28
|
-
allow(described_class).to receive(:platform_adapters)
|
|
29
|
-
.and_return(Moxml::Adapter::OPAL_AVAILABLE_ADAPTERS)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
it "returns false for :nokogiri" do
|
|
33
|
-
expect(described_class.available?(:nokogiri)).to be false
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
it "returns true for :oga" do
|
|
37
|
-
expect(described_class.available?(:oga)).to be true
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
it "returns true for :rexml" do
|
|
41
|
-
expect(described_class.available?(:rexml)).to be true
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
describe ".load" do
|
|
47
|
-
context "when Opal platform adapters are in effect" do
|
|
48
|
-
before do
|
|
49
|
-
allow(described_class).to receive(:platform_adapters)
|
|
50
|
-
.and_return(Moxml::Adapter::OPAL_AVAILABLE_ADAPTERS)
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
it "raises AdapterError for :nokogiri" do
|
|
54
|
-
expect { described_class.load(:nokogiri) }.to raise_error(
|
|
55
|
-
Moxml::AdapterError, /not available on this platform/
|
|
56
|
-
)
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
describe "OPAL_AVAILABLE_ADAPTERS" do
|
|
62
|
-
it "lists :oga as the primary Opal adapter, with :rexml as opt-in" do
|
|
63
|
-
expect(Moxml::Adapter::OPAL_AVAILABLE_ADAPTERS).to eq(%i[oga rexml])
|
|
64
|
-
end
|
|
65
25
|
end
|
|
66
26
|
|
|
67
27
|
describe "CONST_NAME_MAP" do
|
|
@@ -101,10 +61,5 @@ RSpec.describe Moxml::Adapter do
|
|
|
101
61
|
expect(Gem::Version.new(Leptris::VERSION))
|
|
102
62
|
.to be >= Gem::Version.new(adapter::MINIMUM_BINDING_VERSION)
|
|
103
63
|
end
|
|
104
|
-
|
|
105
|
-
it "OPAL_DEFAULT_ADAPTER is a member of OPAL_AVAILABLE_ADAPTERS" do
|
|
106
|
-
expect(Moxml::Adapter::OPAL_AVAILABLE_ADAPTERS)
|
|
107
|
-
.to include(Moxml::Config::OPAL_DEFAULT_ADAPTER)
|
|
108
|
-
end
|
|
109
64
|
end
|
|
110
65
|
end
|
|
@@ -6,15 +6,7 @@ require "spec_helper"
|
|
|
6
6
|
|
|
7
7
|
RSpec.describe Moxml::NativeAttachment do
|
|
8
8
|
describe ".default_backend" do
|
|
9
|
-
it "uses the
|
|
10
|
-
stub_const("RUBY_ENGINE", "opal")
|
|
11
|
-
|
|
12
|
-
expect(described_class.default_backend).to be_a(described_class::Opal)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
it "uses the native backend under non-Opal Ruby engines" do
|
|
16
|
-
stub_const("RUBY_ENGINE", "ruby")
|
|
17
|
-
|
|
9
|
+
it "uses the native backend" do
|
|
18
10
|
expect(described_class.default_backend).to be_a(described_class::Native)
|
|
19
11
|
end
|
|
20
12
|
end
|
|
@@ -69,13 +61,7 @@ RSpec.describe Moxml::NativeAttachment do
|
|
|
69
61
|
end
|
|
70
62
|
|
|
71
63
|
it "uses the selected runtime backend" do
|
|
72
|
-
|
|
73
|
-
described_class::Opal
|
|
74
|
-
else
|
|
75
|
-
described_class::Native
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
expect(attachments.backend).to be_a(expected_class)
|
|
64
|
+
expect(attachments.backend).to be_a(described_class::Native)
|
|
79
65
|
end
|
|
80
66
|
end
|
|
81
67
|
|
|
@@ -109,7 +95,7 @@ RSpec.describe Moxml::NativeAttachment do
|
|
|
109
95
|
expect(stdout).to eq("true\n")
|
|
110
96
|
end
|
|
111
97
|
|
|
112
|
-
it "registers backend
|
|
98
|
+
it "registers the backend implementation with a require-style autoload path" do
|
|
113
99
|
stdout, stderr, status = Open3.capture3(
|
|
114
100
|
ruby,
|
|
115
101
|
"-I",
|
|
@@ -118,16 +104,12 @@ RSpec.describe Moxml::NativeAttachment do
|
|
|
118
104
|
<<~RUBY,
|
|
119
105
|
require "moxml/native_attachment"
|
|
120
106
|
|
|
121
|
-
puts Moxml::NativeAttachment.autoload?(:Opal)
|
|
122
107
|
puts Moxml::NativeAttachment.autoload?(:Native)
|
|
123
108
|
RUBY
|
|
124
109
|
)
|
|
125
110
|
|
|
126
111
|
expect(status.success?).to be(true), stderr
|
|
127
|
-
expect(stdout).to eq(
|
|
128
|
-
"moxml/native_attachment/opal\n" \
|
|
129
|
-
"moxml/native_attachment/native\n",
|
|
130
|
-
)
|
|
112
|
+
expect(stdout).to eq("moxml/native_attachment/native\n")
|
|
131
113
|
end
|
|
132
114
|
|
|
133
115
|
it "loads the native backend lazily when selected" do
|
|
@@ -142,7 +124,6 @@ RSpec.describe Moxml::NativeAttachment do
|
|
|
142
124
|
puts $LOADED_FEATURES.grep(%r{/native_attachment/native\.rb\z}).empty?
|
|
143
125
|
puts Moxml::NativeAttachment.new.backend.class
|
|
144
126
|
puts !$LOADED_FEATURES.grep(%r{/native_attachment/native\.rb\z}).empty?
|
|
145
|
-
puts $LOADED_FEATURES.grep(%r{/native_attachment/opal\.rb\z}).empty?
|
|
146
127
|
RUBY
|
|
147
128
|
)
|
|
148
129
|
|
|
@@ -150,33 +131,6 @@ RSpec.describe Moxml::NativeAttachment do
|
|
|
150
131
|
expect(stdout).to eq(
|
|
151
132
|
"true\n" \
|
|
152
133
|
"Moxml::NativeAttachment::Native\n" \
|
|
153
|
-
"true\n" \
|
|
154
|
-
"true\n",
|
|
155
|
-
)
|
|
156
|
-
end
|
|
157
|
-
|
|
158
|
-
it "does not load the native backend when Opal is selected" do
|
|
159
|
-
stdout, stderr, status = Open3.capture3(
|
|
160
|
-
ruby,
|
|
161
|
-
"-I",
|
|
162
|
-
lib_dir,
|
|
163
|
-
"-e",
|
|
164
|
-
<<~'RUBY',
|
|
165
|
-
Object.send(:remove_const, :RUBY_ENGINE)
|
|
166
|
-
RUBY_ENGINE = "opal"
|
|
167
|
-
|
|
168
|
-
require "moxml/native_attachment"
|
|
169
|
-
|
|
170
|
-
puts Moxml::NativeAttachment.autoload?(:Native)
|
|
171
|
-
puts Moxml::NativeAttachment.new.backend.class
|
|
172
|
-
puts $LOADED_FEATURES.grep(%r{/native_attachment/native\.rb\z}).empty?
|
|
173
|
-
RUBY
|
|
174
|
-
)
|
|
175
|
-
|
|
176
|
-
expect(status.success?).to be(true), stderr
|
|
177
|
-
expect(stdout).to eq(
|
|
178
|
-
"moxml/native_attachment/native\n" \
|
|
179
|
-
"Moxml::NativeAttachment::Opal\n" \
|
|
180
134
|
"true\n",
|
|
181
135
|
)
|
|
182
136
|
end
|
|
@@ -253,7 +253,6 @@ RSpec.describe "Moxml::Signature edge cases and defense" do
|
|
|
253
253
|
end
|
|
254
254
|
|
|
255
255
|
describe "adapter portability" do
|
|
256
|
-
# Skip on Opal — adapter switching is the whole point of moxml.
|
|
257
256
|
it "verifies a signature produced under one adapter with another", :adapter_portability do
|
|
258
257
|
skip "Only Nokogiri available in CI" unless defined?(Nokogiri)
|
|
259
258
|
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# SimpleCov must be loaded before application code
|
|
4
|
-
if ENV.fetch("COVERAGE", nil) == "true"
|
|
4
|
+
if ENV.fetch("COVERAGE", nil) == "true"
|
|
5
5
|
require "simplecov"
|
|
6
6
|
|
|
7
7
|
SimpleCov.start do
|
|
@@ -25,25 +25,21 @@ if ENV.fetch("COVERAGE", nil) == "true" && RUBY_ENGINE != "opal"
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
require "moxml"
|
|
28
|
-
require "nokogiri"
|
|
28
|
+
require "nokogiri"
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
require f
|
|
39
|
-
end
|
|
30
|
+
# Load shared examples from new locations
|
|
31
|
+
Dir[File.expand_path("integration/shared_examples/**/*.rb",
|
|
32
|
+
__dir__)].each do |f|
|
|
33
|
+
require f
|
|
34
|
+
end
|
|
35
|
+
Dir[File.expand_path("moxml/adapter/shared_examples/**/*.rb",
|
|
36
|
+
__dir__)].each do |f|
|
|
37
|
+
require f
|
|
40
38
|
end
|
|
41
39
|
Dir[File.expand_path("support/**/*.rb", __dir__)].each { |f| require f }
|
|
42
40
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
Dir[File.expand_path("examples/*.rb", __dir__)].each { |f| require f }
|
|
46
|
-
end
|
|
41
|
+
Dir[File.expand_path("performance/*.rb", __dir__)].each { |f| require f }
|
|
42
|
+
Dir[File.expand_path("examples/*.rb", __dir__)].each { |f| require f }
|
|
47
43
|
|
|
48
44
|
# Clear XPath caches immediately to ensure fresh compilation
|
|
49
45
|
# This is critical when code changes affect compiled XPath expressions
|
|
@@ -83,19 +79,6 @@ RSpec.configure do |config|
|
|
|
83
79
|
# Configure to skip examples unless explicitly run
|
|
84
80
|
config.filter_run_excluding examples: true unless ENV["RUN_EXAMPLES"]
|
|
85
81
|
|
|
86
|
-
# Under Opal, exclude specs that require native-only adapters or filesystem
|
|
87
|
-
if RUBY_ENGINE == "opal"
|
|
88
|
-
config.filter_run_excluding(
|
|
89
|
-
:native_adapter,
|
|
90
|
-
:native_fs,
|
|
91
|
-
:subprocess,
|
|
92
|
-
:xpath_native,
|
|
93
|
-
:performance,
|
|
94
|
-
:examples,
|
|
95
|
-
:consistency,
|
|
96
|
-
)
|
|
97
|
-
end
|
|
98
|
-
|
|
99
82
|
config.order = :random
|
|
100
83
|
Kernel.srand config.seed
|
|
101
84
|
end
|
|
@@ -105,8 +88,7 @@ Moxml.configure do |config|
|
|
|
105
88
|
# reproducible regardless of whether the local environment has a
|
|
106
89
|
# leptris new enough to win the runtime-default probe. Leptris gets
|
|
107
90
|
# full coverage through its explicit adapter/integration matrices.
|
|
108
|
-
config.adapter =
|
|
91
|
+
config.adapter = Moxml::Config::FALLBACK_ADAPTER
|
|
109
92
|
config.strict_parsing = true
|
|
110
93
|
config.default_encoding = "UTF-8"
|
|
111
|
-
config.entity_load_mode = :optional if RUBY_ENGINE == "opal"
|
|
112
94
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: moxml
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-11-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: |
|
|
14
14
|
Moxml is a unified XML manipulation library that provides a common API
|
|
@@ -25,7 +25,6 @@ files:
|
|
|
25
25
|
- ".github/workflows/dependent-tests.yml"
|
|
26
26
|
- ".github/workflows/docs.yml"
|
|
27
27
|
- ".github/workflows/nightly-fuzz.yml"
|
|
28
|
-
- ".github/workflows/opal.yml"
|
|
29
28
|
- ".github/workflows/performance-release.yml"
|
|
30
29
|
- ".github/workflows/performance.yml"
|
|
31
30
|
- ".github/workflows/rake.yml"
|
|
@@ -33,7 +32,6 @@ files:
|
|
|
33
32
|
- ".github/workflows/round-trip.yml"
|
|
34
33
|
- ".github/workflows/windows.yml"
|
|
35
34
|
- ".gitignore"
|
|
36
|
-
- ".gitmodules"
|
|
37
35
|
- ".rspec"
|
|
38
36
|
- ".rspec-opal"
|
|
39
37
|
- ".rubocop.yml"
|
|
@@ -134,13 +132,6 @@ files:
|
|
|
134
132
|
- examples/web_scraper/README.md
|
|
135
133
|
- examples/web_scraper/example_page.html
|
|
136
134
|
- examples/web_scraper/web_scraper.rb
|
|
137
|
-
- lib/compat/opal/moxml_boot.rb
|
|
138
|
-
- lib/compat/opal/rexml/namespace.rb
|
|
139
|
-
- lib/compat/opal/rexml/parsers/baseparser.rb
|
|
140
|
-
- lib/compat/opal/rexml/source.rb
|
|
141
|
-
- lib/compat/opal/rexml/text.rb
|
|
142
|
-
- lib/compat/opal/rexml/xmltokens.rb
|
|
143
|
-
- lib/compat/opal/rexml_compat.rb
|
|
144
135
|
- lib/moxml.rb
|
|
145
136
|
- lib/moxml/adapter.rb
|
|
146
137
|
- lib/moxml/adapter/base.rb
|
|
@@ -225,7 +216,6 @@ files:
|
|
|
225
216
|
- lib/moxml/entity/restorer.rb
|
|
226
217
|
- lib/moxml/entity_reference.rb
|
|
227
218
|
- lib/moxml/entity_registry.rb
|
|
228
|
-
- lib/moxml/entity_registry_opal_data.rb
|
|
229
219
|
- lib/moxml/error.rb
|
|
230
220
|
- lib/moxml/html_fragment.rb
|
|
231
221
|
- lib/moxml/lazy_bulk_rows.rb
|
|
@@ -234,7 +224,6 @@ files:
|
|
|
234
224
|
- lib/moxml/namespace.rb
|
|
235
225
|
- lib/moxml/native_attachment.rb
|
|
236
226
|
- lib/moxml/native_attachment/native.rb
|
|
237
|
-
- lib/moxml/native_attachment/opal.rb
|
|
238
227
|
- lib/moxml/node.rb
|
|
239
228
|
- lib/moxml/node_set.rb
|
|
240
229
|
- lib/moxml/plan.rb
|
|
@@ -569,7 +558,6 @@ files:
|
|
|
569
558
|
- spec/moxml/namespace_spec.rb
|
|
570
559
|
- spec/moxml/namespace_uri_validation_spec.rb
|
|
571
560
|
- spec/moxml/native_attachment/native_spec.rb
|
|
572
|
-
- spec/moxml/native_attachment/opal_spec.rb
|
|
573
561
|
- spec/moxml/native_attachment/shared_examples.rb
|
|
574
562
|
- spec/moxml/native_attachment_spec.rb
|
|
575
563
|
- spec/moxml/node_cache_spec.rb
|
|
@@ -577,17 +565,11 @@ files:
|
|
|
577
565
|
- spec/moxml/node_set_spec.rb
|
|
578
566
|
- spec/moxml/node_spec.rb
|
|
579
567
|
- spec/moxml/node_type_map_spec.rb
|
|
580
|
-
- spec/moxml/opal_oga_adapter_spec.rb
|
|
581
|
-
- spec/moxml/opal_oga_features_spec.rb
|
|
582
|
-
- spec/moxml/opal_oga_smoke_spec.rb
|
|
583
|
-
- spec/moxml/opal_rexml_adapter_spec.rb
|
|
584
|
-
- spec/moxml/opal_smoke_spec.rb
|
|
585
568
|
- spec/moxml/plan_conformance_spec.rb
|
|
586
569
|
- spec/moxml/plan_spec.rb
|
|
587
570
|
- spec/moxml/processing_instruction_spec.rb
|
|
588
571
|
- spec/moxml/readonly_parse_spec.rb
|
|
589
572
|
- spec/moxml/recover_mode_spec.rb
|
|
590
|
-
- spec/moxml/reference_opal_spec.rb
|
|
591
573
|
- spec/moxml/reference_spec.rb
|
|
592
574
|
- spec/moxml/relax_ng_spec.rb
|
|
593
575
|
- spec/moxml/sax/namespace_splitter_spec.rb
|
|
@@ -607,7 +589,6 @@ files:
|
|
|
607
589
|
- spec/moxml/signature/key_extractor_spec.rb
|
|
608
590
|
- spec/moxml/signature/model_spec.rb
|
|
609
591
|
- spec/moxml/signature/round_trip_spec.rb
|
|
610
|
-
- spec/moxml/signature_autoload_spec.rb
|
|
611
592
|
- spec/moxml/struct_plan_spec.rb
|
|
612
593
|
- spec/moxml/struct_plan_typed_spec.rb
|
|
613
594
|
- spec/moxml/text_spec.rb
|
|
@@ -665,7 +646,6 @@ files:
|
|
|
665
646
|
- spec/support/input_generator.rb
|
|
666
647
|
- spec/support/input_taxonomy.rb
|
|
667
648
|
- spec/support/model_coverage.rb
|
|
668
|
-
- spec/support/opal.rb
|
|
669
649
|
- spec/support/w3c_namespace_helpers.rb
|
|
670
650
|
- spec/support/xml_generator.rb
|
|
671
651
|
- spec/support/xml_matchers.rb
|