klenod-plugin-javascript 0.0.13-x86_64-linux-gnu → 0.0.14-x86_64-linux-gnu
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: 7d3bf070459553ba46cd5b6ef4f9112590bbf99625eee553cb99a414e729a6bd
|
|
4
|
+
data.tar.gz: c60b3bc9411bfd09c0ec669e24fd5cbf601c04e6e684c04359c5440d7178aaa3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a13f41f4925c0699d22fdccceb285e1e50b58d9d3d9fe69c526be956668dd8f4f3a635593ca75f70503b2a2ab26e316023f87251bff26f54b575b0f9eb77ba5e
|
|
7
|
+
data.tar.gz: cee3c244fe255b05b278874ba6b80d18b3985604dd163ffd770da08a4be1856d21f6bb97d7bbc0a414c207b07706e3cda55e3a37bb1d8da5a154f51d84509236
|
|
@@ -12,6 +12,7 @@ require "klenod/build/source_map"
|
|
|
12
12
|
require "klenod/build/transform_result"
|
|
13
13
|
require "klenod/runtime"
|
|
14
14
|
|
|
15
|
+
require_relative "../../plugin/javascript/errors"
|
|
15
16
|
require_relative "../../plugin/javascript/parser"
|
|
16
17
|
|
|
17
18
|
module Klenod
|
|
@@ -73,13 +74,18 @@ module Klenod
|
|
|
73
74
|
|
|
74
75
|
custom_element = custom_element_module?(module_id)
|
|
75
76
|
jsx_runtime_namespace = custom_element ? jsx_runtime_namespace(module_id) : nil
|
|
76
|
-
transform =
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
transform =
|
|
78
|
+
begin
|
|
79
|
+
Parser.transform(
|
|
80
|
+
code,
|
|
81
|
+
filename: module_id.to_s,
|
|
82
|
+
source_kind: source_kind(module_id),
|
|
83
|
+
minify: minify_enabled?(context),
|
|
84
|
+
jsx_runtime_namespace: jsx_runtime_namespace
|
|
85
|
+
)
|
|
86
|
+
rescue ScriptError => e
|
|
87
|
+
raise ParseError.new(e, source: code, module_id: module_id)
|
|
88
|
+
end
|
|
83
89
|
javascript_source, imports =
|
|
84
90
|
if custom_element
|
|
85
91
|
inject_jsx_runtime(transform.code, transform.imports, module_id, jsx_runtime_namespace)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "klenod/build/source_error"
|
|
4
|
+
|
|
5
|
+
module Klenod
|
|
6
|
+
module Build
|
|
7
|
+
module Plugins
|
|
8
|
+
module JavaScriptPlugin
|
|
9
|
+
# The native parser raises a bare SyntaxError, which is a ScriptError
|
|
10
|
+
# rather than a StandardError, so it escapes every `rescue => e` in the
|
|
11
|
+
# build and takes the watcher thread down with it. Wrapping it in a
|
|
12
|
+
# SourceError that carries the source lets it be collected like a Haml
|
|
13
|
+
# parse error and rendered in the browser error dialog.
|
|
14
|
+
class ParseError < Klenod::Build::SourceError
|
|
15
|
+
# "app:/pages/thing.tsx:33:9: Expected '</', got ':'"
|
|
16
|
+
LOCATION = /\A(?<file>.+?):(?<line>\d+):(?<column>\d+):\s*(?<message>.*)\z/m
|
|
17
|
+
|
|
18
|
+
def kind
|
|
19
|
+
"JavaScript parse error"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def location(error)
|
|
25
|
+
found = LOCATION.match(error.message)
|
|
26
|
+
return nil unless found
|
|
27
|
+
|
|
28
|
+
# One-based, matching HamlPlugin::ParseError#line and the column the
|
|
29
|
+
# native parser reports.
|
|
30
|
+
Location.new(
|
|
31
|
+
line: found[:line].to_i,
|
|
32
|
+
column: found[:column].to_i,
|
|
33
|
+
detail: found[:message]
|
|
34
|
+
)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
Binary file
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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.14
|
|
5
5
|
platform: x86_64-linux-gnu
|
|
6
6
|
authors:
|
|
7
7
|
- Andrés Alin
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-09-
|
|
11
|
+
date: 2026-09-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: klenod-build
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - '='
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.0.
|
|
19
|
+
version: 0.0.14
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - '='
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 0.0.
|
|
26
|
+
version: 0.0.14
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: rake-compiler
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -50,6 +50,7 @@ files:
|
|
|
50
50
|
- lib/klenod/build/plugins/node_modules_plugin.rb
|
|
51
51
|
- lib/klenod/build/plugins/node_modules_plugin/package_exports.rb
|
|
52
52
|
- lib/klenod/plugin/javascript.rb
|
|
53
|
+
- lib/klenod/plugin/javascript/errors.rb
|
|
53
54
|
- lib/klenod/plugin/javascript/native.so
|
|
54
55
|
- lib/klenod/plugin/javascript/parser.rb
|
|
55
56
|
- lib/klenod/plugin/javascript/version.rb
|