typescript-merge 7.0.0 → 7.1.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
- checksums.yaml.gz.sig +0 -0
- data/LICENSE.md +13 -0
- data/README.md +294 -0
- data/lib/typescript/merge/version.rb +5 -3
- data/lib/typescript/merge.rb +149 -41
- data/lib/typescript-merge.rb +7 -1
- data/sig/typescript/merge.rbs +8 -0
- data.tar.gz.sig +0 -0
- metadata +252 -15
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 21ec9f6ce57ba276ee2cd6713ce86001d78c65b8c4aabade24693ef11bbf4f03
|
|
4
|
+
data.tar.gz: 48a163ba332882e39cf8e67190d29ef4a01c1ede53a68c3126f0466b32f8ff4a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d49657661f31655f72f27836e503529209465c037be78d323fb4606e78612a2b35061013ccf67d74589cba1f3c41b915e83d86e0963bc9a5ebb1d9e61675c869
|
|
7
|
+
data.tar.gz: 8584890377190ece90ac9f04ce895c039b4062da51a1f08699b3c7d24e305d463e7d6dfa381be195664526cacecf384bdecb368a1a55adb416cf5d975769b581
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/LICENSE.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# License
|
|
2
|
+
|
|
3
|
+
This project is made available under the following licenses.
|
|
4
|
+
Choose the option that best fits your use case:
|
|
5
|
+
|
|
6
|
+
- [AGPL-3.0-only](https://github.com/structuredmerge/structuredmerge-ruby/blob/main/AGPL-3.0-only.md)
|
|
7
|
+
- [PolyForm-Small-Business-1.0.0](https://github.com/structuredmerge/structuredmerge-ruby/blob/main/PolyForm-Small-Business-1.0.0.md)
|
|
8
|
+
|
|
9
|
+
If none of the above licenses fit your use case, please [contact us](mailto:floss@galtzo.com) to discuss a custom commercial license.
|
|
10
|
+
|
|
11
|
+
## Copyright Notice
|
|
12
|
+
|
|
13
|
+
- Required Notice: Copyright (c) 2026 Peter H. Boling
|
data/README.md
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
<a href="https://github.com/structuredmerge"><img alt="structuredmerge Logo by GitHub" src="https://github.com/structuredmerge.png?size=192" width="14%" align="right"/></a>
|
|
2
|
+
|
|
3
|
+
# ☯️ TypeScript::Merge
|
|
4
|
+
|
|
5
|
+
[![Version][👽versioni]][👽version] [![Ruby Users Forum][✉️ruby-forum-top-img]][✉️ruby-forum] [![GitHub tag (latest SemVer)][⛳️tag-img]][⛳️tag] [![License: AGPL-3.0-only OR PolyForm-Small-Business-1.0.0][📄license-img]][📄license] [![Total downloads][👽dl-ranki]][👽dl-rank] [![CI Current][🚎11-c-wfi]][🚎11-c-wf]
|
|
6
|
+
|
|
7
|
+
`if ci_badges.map(&:color).detect { it != "green"}` ☝️ [let me know on Discord][✉️discord-invite] or [RubyForum][✉️ruby-forum], as I may have missed the notification.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
`if ci_badges.map(&:color).all? { it == "green"}` 👇️ send money so I can do more of this. FLOSS maintenance is now my full-time job.
|
|
12
|
+
|
|
13
|
+
[![Sponsor Me on Github][🖇sponsor-img]][🖇sponsor] [![Liberapay Goal Progress][⛳liberapay-img]][⛳liberapay] [![Donate on PayPal][🖇paypal-img]][🖇paypal] [![Buy me a coffee][🖇buyme-small-img]][🖇buyme] [![Donate at ko-fi.com][🖇kofi-img]][🖇kofi]
|
|
14
|
+
|
|
15
|
+
<details markdown="1">
|
|
16
|
+
<summary>👣 How will this project approach the September 2025 hostile takeover of RubyGems? 🚑️</summary>
|
|
17
|
+
|
|
18
|
+
I've summarized my thoughts in [this blog post](https://dev.to/galtzo/hostile-takeover-of-rubygems-my-thoughts-5hlo).
|
|
19
|
+
|
|
20
|
+
</details>
|
|
21
|
+
|
|
22
|
+
## 🌻 Synopsis <a href="https://discord.gg/3qme4XHNKN"><img alt="Galtzo FLOSS Logo by Aboling0, CC BY-SA 4.0" src="https://logos.galtzo.com/assets/images/galtzo-floss/avatar-128px.svg" width="8%" align="right"/></a> <a href="https://ruby-toolbox.com"><img alt="ruby-lang Logo, Yukihiro Matsumoto, Ruby Visual Identity Team, CC BY-SA 2.5" src="https://logos.galtzo.com/assets/images/ruby-lang/avatar-128px.svg" width="8%" align="right"/></a>
|
|
23
|
+
|
|
24
|
+
`Typescript::Merge` merges TypeScript source files through the shared tree-sitter language-pack backend. It preserves destination declarations and appends template-only declarations when structural paths do not already exist.
|
|
25
|
+
|
|
26
|
+
### Key Features
|
|
27
|
+
|
|
28
|
+
- TypeScript dialect feature profile and backend capability reporting.
|
|
29
|
+
- Declaration ownership for imports, exports, functions, classes, interfaces, types, enums, and variables as exposed by the language pack.
|
|
30
|
+
- Destination parse diagnostics with the common result shape.
|
|
31
|
+
- Module-level APIs for fixture runners and Git integrations.
|
|
32
|
+
|
|
33
|
+
## 💡 Info you can shake a stick at
|
|
34
|
+
|
|
35
|
+
| Tokens to Remember | [![Gem name][⛳️name-img]][⛳️gem-name] [![Gem namespace][⛳️namespace-img]][⛳️gem-namespace] |
|
|
36
|
+
|-------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
37
|
+
| Works with MRI Ruby 4 | [![Ruby current Compat][💎ruby-c-i]][🚎11-c-wf]|
|
|
38
|
+
| Support & Community | [![Join Me on Daily.dev's RubyFriends][✉️ruby-friends-img]][✉️ruby-friends] [![Get help from RubyForum][✉️ruby-forum-img]][✉️ruby-forum] [![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite] [![Get help from me on Upwork][👨🏼🏫expsup-upwork-img]][👨🏼🏫expsup-upwork] [![Get help from me on Codementor][👨🏼🏫expsup-codementor-img]][👨🏼🏫expsup-codementor] |
|
|
39
|
+
| Source | [![Source on GitLab.com][📜src-gl-img]][📜src-gl] [![Source on CodeBerg.org][📜src-cb-img]][📜src-cb] [![Source on GitHub.com][📜src-gh-img]][📜src-gh] [![The best SHA: dQw4w9WgXcQ!][🧮kloc-img]][🧮kloc] |
|
|
40
|
+
| Documentation | [![Current release on RubyDoc.info][📜docs-cr-rd-img]][🚎yard-current] [![YARD on Galtzo.com][📜docs-head-rd-img]][🚎yard-head] [![Maintainer Blog][🚂maint-blog-img]][🚂maint-blog] [![GitLab Wiki][📜gl-wiki-img]][📜gl-wiki] [![GitHub Wiki][📜gh-wiki-img]][📜gh-wiki] |
|
|
41
|
+
| Compliance | [![License: AGPL-3.0-only OR PolyForm-Small-Business-1.0.0][📄license-img]][📄license] [![Apache license compatibility: Category X][📄license-compat-img]][📄license-compat] [![📄ilo-declaration-img]][📄ilo-declaration] [![Security Policy][🔐security-img]][🔐security] [![Contributor Covenant 2.1][🪇conduct-img]][🪇conduct] [![SemVer 2.0.0][📌semver-img]][📌semver] |
|
|
42
|
+
| Style | [![Enforced Code Style Linter][💎rlts-img]][💎rlts] [![Keep-A-Changelog 1.0.0][📗keep-changelog-img]][📗keep-changelog] [![Gitmoji Commits][📌gitmoji-img]][📌gitmoji] [![Compatibility appraised by: appraisal2][💎appraisal2-img]][💎appraisal2] |
|
|
43
|
+
| Maintainer 🎖️ | [![Follow Me on LinkedIn][💖🖇linkedin-img]][💖🖇linkedin] [![Follow Me on Ruby.Social][💖🐘ruby-mast-img]][💖🐘ruby-mast] [![Follow Me on Bluesky][💖🦋bluesky-img]][💖🦋bluesky] [![Contact Maintainer][🚂maint-contact-img]][🚂maint-contact] [![My technical writing][💖💁🏼♂️devto-img]][💖💁🏼♂️devto] |
|
|
44
|
+
| `...` 💖 | [![Find Me on WellFound:][💖✌️wellfound-img]][💖✌️wellfound] [![Find Me on CrunchBase][💖💲crunchbase-img]][💖💲crunchbase] [![My LinkTree][💖🌳linktree-img]][💖🌳linktree] [![More About Me][💖💁🏼♂️aboutme-img]][💖💁🏼♂️aboutme] [🧊][💖🧊berg] [🐙][💖🐙hub] [🛖][💖🛖hut] [🧪][💖🧪lab] |
|
|
45
|
+
|
|
46
|
+
### Compatibility
|
|
47
|
+
|
|
48
|
+
Compatible with MRI Ruby 4.0.0+, and concordant releases of JRuby, and TruffleRuby.
|
|
49
|
+
CI workflows and Appraisals are generated for MRI Ruby 4.0.0+.
|
|
50
|
+
This test floor is configured by `ruby.test_minimum` in `.kettle-jem.yml` and
|
|
51
|
+
may be higher than the gem's runtime compatibility floor when legacy Rubies are
|
|
52
|
+
not practical for the current toolchain.
|
|
53
|
+
|
|
54
|
+
<a href="https://github.com/kettle-dev"><img alt="kettle-dev Logo by Aboling0, CC BY-SA 4.0" src="https://logos.galtzo.com/assets/images/kettle-dev/avatar-128px.svg" width="14%" align="right"/></a>
|
|
55
|
+
|
|
56
|
+
The _amazing_ test matrix is powered by the kettle-dev stack.
|
|
57
|
+
|
|
58
|
+
<details markdown="1">
|
|
59
|
+
<summary>How kettle-dev manages complexity in tests</summary>
|
|
60
|
+
|
|
61
|
+
| Gem | Source | Role | Total downloads |
|
|
62
|
+
|-----|--------|------|---------------------|
|
|
63
|
+
| [appraisal2](https://clickgems.clickhouse.com/dashboard/appraisal2) | [GitHub](https://github.com/appraisal-rb/appraisal2) | multi-dependency Appraisal matrix generation | [](https://clickgems.clickhouse.com/dashboard/appraisal2) |
|
|
64
|
+
| [appraisal2-rubocop](https://clickgems.clickhouse.com/dashboard/appraisal2-rubocop) | [GitHub](https://github.com/appraisal-rb/appraisal2-rubocop) | RuboCop Appraisal generator integration | [](https://clickgems.clickhouse.com/dashboard/appraisal2-rubocop) |
|
|
65
|
+
| [kettle-dev](https://clickgems.clickhouse.com/dashboard/kettle-dev) | [GitHub](https://github.com/kettle-dev/kettle-dev) | development, release, and CI workflow tooling | [](https://clickgems.clickhouse.com/dashboard/kettle-dev) |
|
|
66
|
+
| [kettle-jem](https://clickgems.clickhouse.com/dashboard/kettle-jem) | [GitHub](https://github.com/kettle-dev/kettle-jem) | Appraisals & CI workflow templates | [](https://clickgems.clickhouse.com/dashboard/kettle-jem) |
|
|
67
|
+
| [kettle-soup-cover](https://clickgems.clickhouse.com/dashboard/kettle-soup-cover) | [GitHub](https://github.com/kettle-dev/kettle-soup-cover) | SimpleCov coverage policy and reporting | [](https://clickgems.clickhouse.com/dashboard/kettle-soup-cover) |
|
|
68
|
+
| [kettle-test](https://clickgems.clickhouse.com/dashboard/kettle-test) | [GitHub](https://github.com/kettle-dev/kettle-test) | standard test runner and coverage harness | [](https://clickgems.clickhouse.com/dashboard/kettle-test) |
|
|
69
|
+
| [rubocop-lts](https://clickgems.clickhouse.com/dashboard/rubocop-lts) | [GitHub](https://github.com/rubocop-lts/rubocop-lts) | Ruby-version-aware linting | [](https://clickgems.clickhouse.com/dashboard/rubocop-lts) |
|
|
70
|
+
| [turbo_tests2](https://clickgems.clickhouse.com/dashboard/turbo_tests2) | [GitHub](https://github.com/galtzo-floss/turbo_tests2) | parallel test execution | [](https://clickgems.clickhouse.com/dashboard/turbo_tests2) |
|
|
71
|
+
|
|
72
|
+
</details>
|
|
73
|
+
|
|
74
|
+
## ✨ Installation
|
|
75
|
+
|
|
76
|
+
Install the gem and add to the application's Gemfile by executing:
|
|
77
|
+
|
|
78
|
+
```console
|
|
79
|
+
bundle add typescript-merge
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
|
83
|
+
|
|
84
|
+
```console
|
|
85
|
+
gem install typescript-merge
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## ⚙️ Configuration
|
|
89
|
+
|
|
90
|
+
```ruby
|
|
91
|
+
profile = Typescript::Merge.type_script_backend_feature_profile
|
|
92
|
+
context = Typescript::Merge.type_script_plan_context
|
|
93
|
+
backends = Typescript::Merge.available_type_script_backends
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The public method names use `type_script` to avoid relying on a lower-case acronym split in generated Ruby identifiers.
|
|
97
|
+
|
|
98
|
+
## 🔧 Basic Usage
|
|
99
|
+
|
|
100
|
+
```ruby
|
|
101
|
+
require "typescript/merge"
|
|
102
|
+
|
|
103
|
+
result = Typescript::Merge.merge_type_script(
|
|
104
|
+
File.read("template.ts"),
|
|
105
|
+
File.read("index.ts"),
|
|
106
|
+
"typescript",
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
abort result.fetch(:diagnostics).inspect unless result.fetch(:ok)
|
|
110
|
+
File.write("index.ts", result.fetch(:output))
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Most module-level merge methods return a Hash with `:ok`, `:diagnostics`, `:output`, and `:policies`. Check `:ok` before writing the result; diagnostics are structured for CI output and fixture conformance reports.
|
|
114
|
+
|
|
115
|
+
## 🔐 Security
|
|
116
|
+
|
|
117
|
+
See [SECURITY.md][🔐security].
|
|
118
|
+
|
|
119
|
+
## 🤝 Contributing
|
|
120
|
+
|
|
121
|
+
If you need some ideas of where to help, you could work on adding more code coverage,
|
|
122
|
+
or if it is already 💯 (see [below](#code-coverage)) check [issues][🤝gh-issues] or [PRs][🤝gh-pulls],
|
|
123
|
+
or use the gem and think about how it could be better.
|
|
124
|
+
|
|
125
|
+
We [![Keep A Changelog][📗keep-changelog-img]][📗keep-changelog] so if you make changes, remember to update it.
|
|
126
|
+
|
|
127
|
+
See [CONTRIBUTING.md][🤝contributing] for more detailed instructions.
|
|
128
|
+
|
|
129
|
+
### Code Coverage
|
|
130
|
+
|
|
131
|
+
<details markdown="1">
|
|
132
|
+
<summary>Coverage service badges</summary>
|
|
133
|
+
|
|
134
|
+
</details>
|
|
135
|
+
|
|
136
|
+
## 📌 Versioning
|
|
137
|
+
|
|
138
|
+
This library follows [![Semantic Versioning 2.0.0][📌semver-img]][📌semver] for its public API where practical.
|
|
139
|
+
For most applications, prefer the [Pessimistic Version Constraint][📌pvc] with two digits of precision.
|
|
140
|
+
|
|
141
|
+
For example:
|
|
142
|
+
|
|
143
|
+
```ruby
|
|
144
|
+
spec.add_dependency("typescript-merge", "~> 7.0")
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
<details markdown="1">
|
|
148
|
+
<summary>📌 Is "Platform Support" part of the public API? More details inside.</summary>
|
|
149
|
+
|
|
150
|
+
Dropping support for a platform can be a breaking change for affected users.
|
|
151
|
+
If a release changes supported platforms, it should be called out clearly in the changelog and versioned with that impact in mind.
|
|
152
|
+
|
|
153
|
+
To get a better understanding of how SemVer is intended to work over a project's lifetime,
|
|
154
|
+
read this article from the creator of SemVer:
|
|
155
|
+
|
|
156
|
+
- ["Major Version Numbers are Not Sacred"][📌major-versions-not-sacred]
|
|
157
|
+
|
|
158
|
+
</details>
|
|
159
|
+
|
|
160
|
+
See [CHANGELOG.md][📌changelog] for a list of releases.
|
|
161
|
+
|
|
162
|
+
## 📄 License
|
|
163
|
+
|
|
164
|
+
The gem is available under the following licenses: [AGPL-3.0-only](https://github.com/structuredmerge/structuredmerge-ruby/blob/main/AGPL-3.0-only.md), [PolyForm-Small-Business-1.0.0](https://github.com/structuredmerge/structuredmerge-ruby/blob/main/PolyForm-Small-Business-1.0.0.md).
|
|
165
|
+
See [LICENSE.md][📄license] for details.
|
|
166
|
+
|
|
167
|
+
If none of the available licenses suit your use case, please [contact us](mailto:floss@galtzo.com) to discuss a custom commercial license.
|
|
168
|
+
|
|
169
|
+
[⛳liberapay-img]: https://img.shields.io/liberapay/goal/pboling.svg?logo=liberapay&color=a51611&style=flat
|
|
170
|
+
[⛳liberapay-bottom-img]: https://img.shields.io/liberapay/goal/pboling.svg?style=for-the-badge&logo=liberapay&color=a51611
|
|
171
|
+
[⛳liberapay]: https://liberapay.com/pboling/donate
|
|
172
|
+
[🖇sponsor-img]: https://img.shields.io/badge/Sponsor_Me!-pboling.svg?style=social&logo=github
|
|
173
|
+
[🖇sponsor-bottom-img]: https://img.shields.io/badge/Sponsor_Me!-pboling-blue?style=for-the-badge&logo=github
|
|
174
|
+
[🖇sponsor]: https://github.com/sponsors/pboling
|
|
175
|
+
[🖇kofi-img]: https://img.shields.io/badge/ko--fi-%E2%9C%93-a51611.svg?style=flat
|
|
176
|
+
[🖇kofi]: https://ko-fi.com/pboling
|
|
177
|
+
[🖇buyme-small-img]: https://img.shields.io/badge/buy_me_a_coffee-%E2%9C%93-a51611.svg?style=flat
|
|
178
|
+
[🖇buyme-img]: https://img.buymeacoffee.com/button-api/?text=Buy%20me%20a%20latte&emoji=&slug=pboling&button_colour=FFDD00&font_colour=000000&font_family=Cookie&outline_colour=000000&coffee_colour=ffffff
|
|
179
|
+
[🖇buyme]: https://www.buymeacoffee.com/pboling
|
|
180
|
+
[🖇paypal-img]: https://img.shields.io/badge/donate-paypal-a51611.svg?style=flat&logo=paypal
|
|
181
|
+
[🖇paypal-bottom-img]: https://img.shields.io/badge/donate-paypal-a51611.svg?style=for-the-badge&logo=paypal&color=0A0A0A
|
|
182
|
+
[🖇paypal]: https://www.paypal.com/paypalme/peterboling
|
|
183
|
+
[🖇floss-funding.dev]: https://floss-funding.dev
|
|
184
|
+
[🖇floss-funding-gem]: https://github.com/galtzo-floss/floss_funding
|
|
185
|
+
[✉️discord-invite]: https://discord.gg/3qme4XHNKN
|
|
186
|
+
[✉️discord-invite-img-ftb]: https://img.shields.io/discord/1373797679469170758?style=for-the-badge&logo=discord
|
|
187
|
+
[✉️ruby-friends-img]: https://img.shields.io/badge/daily.dev-%F0%9F%92%8E_Ruby_Friends-0A0A0A?style=for-the-badge&logo=dailydotdev&logoColor=white
|
|
188
|
+
[✉️ruby-friends]: https://app.daily.dev/squads/rubyfriends
|
|
189
|
+
[✉️ruby-forum-top-img]: https://img.shields.io/discourse/topics?server=https%3A%2F%2Fwww.rubyforum.org&style=flat&logo=discourse&label=Ruby%20Users%20Forum
|
|
190
|
+
[✉️ruby-forum-img]: https://img.shields.io/discourse/topics?server=https%3A%2F%2Fwww.rubyforum.org&style=for-the-badge&logo=discourse&label=Ruby%20Users%20Forum
|
|
191
|
+
[✉️ruby-forum]: https://www.rubyforum.org/tag/structuredmerge
|
|
192
|
+
[✇bundle-group-pattern]: https://gist.github.com/pboling/4564780
|
|
193
|
+
[⛳️gem-namespace]: https://github.com/structuredmerge/structuredmerge-ruby/tree/main/gems/typescript-merge
|
|
194
|
+
[⛳️namespace-img]: https://img.shields.io/badge/namespace-TypeScript::Merge-3C2D2D.svg?style=square&logo=ruby&logoColor=white
|
|
195
|
+
[⛳️gem-name]: https://clickgems.clickhouse.com/dashboard/typescript-merge
|
|
196
|
+
[⛳️name-img]: https://img.shields.io/badge/name-typescript--merge-3C2D2D.svg?style=square&logo=rubygems&logoColor=red
|
|
197
|
+
[⛳️tag-img]: https://img.shields.io/github/tag/structuredmerge/structuredmerge-ruby.svg
|
|
198
|
+
[⛳️tag]: https://github.com/structuredmerge/structuredmerge-ruby/releases
|
|
199
|
+
[🚂maint-blog]: http://www.railsbling.com/tags/typescript-merge
|
|
200
|
+
[🚂maint-blog-img]: https://img.shields.io/badge/blog-railsbling-0093D0.svg?style=for-the-badge&logo=rubyonrails&logoColor=orange
|
|
201
|
+
[🚂maint-contact]: http://www.railsbling.com/contact
|
|
202
|
+
[🚂maint-contact-img]: https://img.shields.io/badge/Contact-Maintainer-0093D0.svg?style=flat&logo=rubyonrails&logoColor=red
|
|
203
|
+
[💖🖇linkedin]: http://www.linkedin.com/in/peterboling
|
|
204
|
+
[💖🖇linkedin-img]: https://img.shields.io/badge/LinkedIn-Profile-0B66C2?style=flat&logo=newjapanprowrestling
|
|
205
|
+
[💖✌️wellfound]: https://wellfound.com/u/peter-boling
|
|
206
|
+
[💖✌️wellfound-img]: https://img.shields.io/badge/peter--boling-orange?style=flat&logo=wellfound
|
|
207
|
+
[💖💲crunchbase]: https://www.crunchbase.com/person/peter-boling
|
|
208
|
+
[💖💲crunchbase-img]: https://img.shields.io/badge/peter--boling-purple?style=flat&logo=crunchbase
|
|
209
|
+
[💖🐘ruby-mast]: https://ruby.social/@galtzo
|
|
210
|
+
[💖🐘ruby-mast-img]: https://img.shields.io/mastodon/follow/109447111526622197?domain=https://ruby.social&style=flat&logo=mastodon&label=Ruby%20@galtzo
|
|
211
|
+
[💖🦋bluesky]: https://bsky.app/profile/galtzo.com
|
|
212
|
+
[💖🦋bluesky-img]: https://img.shields.io/badge/@galtzo.com-0285FF?style=flat&logo=bluesky&logoColor=white
|
|
213
|
+
[💖🌳linktree]: https://linktr.ee/galtzo
|
|
214
|
+
[💖🌳linktree-img]: https://img.shields.io/badge/galtzo-purple?style=flat&logo=linktree
|
|
215
|
+
[💖💁🏼♂️devto]: https://dev.to/galtzo
|
|
216
|
+
[💖💁🏼♂️devto-img]: https://img.shields.io/badge/dev.to-0A0A0A?style=flat&logo=devdotto&logoColor=white
|
|
217
|
+
[💖💁🏼♂️aboutme]: https://about.me/peter.boling
|
|
218
|
+
[💖💁🏼♂️aboutme-img]: https://img.shields.io/badge/about.me-0A0A0A?style=flat&logo=aboutme&logoColor=white
|
|
219
|
+
[💖🧊berg]: https://codeberg.org/pboling
|
|
220
|
+
[💖🐙hub]: https://github.org/pboling
|
|
221
|
+
[💖🛖hut]: https://sr.ht/~galtzo/
|
|
222
|
+
[💖🧪lab]: https://gitlab.com/pboling
|
|
223
|
+
[👨🏼🏫expsup-upwork]: https://www.upwork.com/freelancers/~014942e9b056abdf86?mp_source=share
|
|
224
|
+
[👨🏼🏫expsup-upwork-img]: https://img.shields.io/badge/UpWork-13544E?style=for-the-badge&logo=Upwork&logoColor=white
|
|
225
|
+
[👨🏼🏫expsup-codementor]: https://www.codementor.io/peterboling?utm_source=github&utm_medium=button&utm_term=peterboling&utm_campaign=github
|
|
226
|
+
[👨🏼🏫expsup-codementor-img]: https://img.shields.io/badge/CodeMentor-Get_Help-1abc9c?style=for-the-badge&logo=CodeMentor&logoColor=white
|
|
227
|
+
[🏙️entsup-tidelift]: https://tidelift.com/subscription/pkg/rubygems-typescript-merge?utm_source=rubygems-typescript-merge&utm_medium=referral&utm_campaign=readme
|
|
228
|
+
[🏙️entsup-tidelift-img]: https://img.shields.io/badge/Tidelift_and_Sonar-Enterprise_Support-FD3456?style=for-the-badge&logo=sonar&logoColor=white
|
|
229
|
+
[🏙️entsup-tidelift-sonar]: https://blog.tidelift.com/tidelift-joins-sonar
|
|
230
|
+
[💁🏼♂️peterboling]: http://www.peterboling.com
|
|
231
|
+
[🚂railsbling]: http://www.railsbling.com
|
|
232
|
+
[📜src-gl-img]: https://img.shields.io/badge/GitLab-FBA326?style=for-the-badge&logo=Gitlab&logoColor=orange
|
|
233
|
+
[📜src-gl]: https://gitlab.com/structuredmerge/structuredmerge-ruby/-/tree/main/gems/typescript-merge
|
|
234
|
+
[📜src-cb-img]: https://img.shields.io/badge/CodeBerg-4893CC?style=for-the-badge&logo=CodeBerg&logoColor=blue
|
|
235
|
+
[📜src-cb]: https://codeberg.org/structuredmerge/structuredmerge-ruby/src/branch/main/gems/typescript-merge
|
|
236
|
+
[📜src-gh-img]: https://img.shields.io/badge/GitHub-238636?style=for-the-badge&logo=GitHub&logoColor=green
|
|
237
|
+
[📜src-gh]: https://github.com/structuredmerge/structuredmerge-ruby/tree/main/gems/typescript-merge
|
|
238
|
+
[📜docs-cr-rd-img]: https://img.shields.io/badge/RubyDoc-Current_Release-943CD2?style=for-the-badge&logo=readthedocs&logoColor=white
|
|
239
|
+
[📜docs-head-rd-img]: https://img.shields.io/badge/YARD_on_Galtzo.com-HEAD-943CD2?style=for-the-badge&logo=readthedocs&logoColor=white
|
|
240
|
+
[📜gl-wiki]: https://gitlab.com/structuredmerge/structuredmerge-ruby/-/wikis/home
|
|
241
|
+
[📜gh-wiki]: https://github.com/structuredmerge/structuredmerge-ruby/wiki
|
|
242
|
+
[📜gl-wiki-img]: https://img.shields.io/badge/wiki-gitlab-943CD2.svg?style=for-the-badge&logo=gitlab&logoColor=white
|
|
243
|
+
[📜gh-wiki-img]: https://img.shields.io/badge/wiki-github-943CD2.svg?style=for-the-badge&logo=github&logoColor=white
|
|
244
|
+
[👽dl-rank]: https://clickgems.clickhouse.com/dashboard/typescript-merge
|
|
245
|
+
[👽dl-ranki]: https://img.shields.io/gem/dt/typescript-merge.svg
|
|
246
|
+
[👽version]: https://clickgems.clickhouse.com/dashboard/typescript-merge
|
|
247
|
+
[👽versioni]: https://img.shields.io/gem/v/typescript-merge.svg
|
|
248
|
+
[🚎11-c-wf]: https://github.com/structuredmerge/structuredmerge-ruby/actions/workflows/current.yml
|
|
249
|
+
[🚎11-c-wfi]: https://github.com/structuredmerge/structuredmerge-ruby/actions/workflows/current.yml/badge.svg
|
|
250
|
+
[💎ruby-c-i]: https://img.shields.io/badge/Ruby-current-CC342D?style=for-the-badge&logo=ruby&logoColor=green
|
|
251
|
+
[🤝gh-issues]: https://github.com/structuredmerge/structuredmerge-ruby/issues
|
|
252
|
+
[🤝gh-pulls]: https://github.com/structuredmerge/structuredmerge-ruby/pulls
|
|
253
|
+
[🤝gl-issues]: https://gitlab.com/structuredmerge/structuredmerge-ruby/-/issues
|
|
254
|
+
[🤝gl-pulls]: https://gitlab.com/structuredmerge/structuredmerge-ruby/-/merge_requests
|
|
255
|
+
[🤝cb-issues]: https://codeberg.org/structuredmerge/structuredmerge-ruby/issues
|
|
256
|
+
[🤝cb-pulls]: https://codeberg.org/structuredmerge/structuredmerge-ruby/pulls
|
|
257
|
+
[🤝cb-donate]: https://donate.codeberg.org/
|
|
258
|
+
[🤝contributing]: https://github.com/structuredmerge/structuredmerge-ruby/blob/main/CONTRIBUTING.md
|
|
259
|
+
[🖐contrib-rocks]: https://contrib.rocks
|
|
260
|
+
[🖐contributors]: https://github.com/structuredmerge/structuredmerge-ruby/graphs/contributors
|
|
261
|
+
[🖐contributors-img]: https://contrib.rocks/image?repo=structuredmerge/structuredmerge-ruby
|
|
262
|
+
[🪇conduct]: https://github.com/structuredmerge/structuredmerge-ruby/blob/main/CODE_OF_CONDUCT.md
|
|
263
|
+
[🪇conduct-img]: https://img.shields.io/badge/Contributor_Covenant-2.1-259D6C.svg
|
|
264
|
+
[📌pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
|
|
265
|
+
[📌semver]: https://semver.org/spec/v2.0.0.html
|
|
266
|
+
[📌semver-img]: https://img.shields.io/badge/semver-2.0.0-259D6C.svg?style=flat
|
|
267
|
+
[📌semver-breaking]: https://github.com/semver/semver/issues/716#issuecomment-869336139
|
|
268
|
+
[📌major-versions-not-sacred]: https://tom.preston-werner.com/2022/05/23/major-version-numbers-are-not-sacred.html
|
|
269
|
+
[📌changelog]: https://github.com/structuredmerge/structuredmerge-ruby/blob/main/CHANGELOG.md
|
|
270
|
+
[📗keep-changelog]: https://keepachangelog.com/en/1.0.0/
|
|
271
|
+
[📗keep-changelog-img]: https://img.shields.io/badge/keep--a--changelog-1.0.0-34495e.svg?style=flat
|
|
272
|
+
[📌gitmoji]: https://gitmoji.dev
|
|
273
|
+
[📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
|
|
274
|
+
[🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
|
275
|
+
[🧮kloc-img]: https://img.shields.io/badge/KLOC-0.135-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
|
|
276
|
+
[🔐security]: https://github.com/structuredmerge/structuredmerge-ruby/blob/main/SECURITY.md
|
|
277
|
+
[🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
|
|
278
|
+
[📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
|
|
279
|
+
[📄license]: LICENSE.md
|
|
280
|
+
[📄license-ref]: LICENSE.md
|
|
281
|
+
[📄license-img]: https://img.shields.io/badge/License-AGPL--3.0--only_OR_PolyForm--Small--Business--1.0.0-259D6C.svg
|
|
282
|
+
[📄license-compat]: https://www.apache.org/legal/resolved.html#category-x
|
|
283
|
+
[📄license-compat-img]: https://img.shields.io/badge/Apache_Incompatible:_Category_X-%E2%9C%97-C0392B.svg?style=flat&logo=Apache
|
|
284
|
+
[📄ilo-declaration]: https://www.ilo.org/declaration/lang--en/index.htm
|
|
285
|
+
[📄ilo-declaration-img]: https://img.shields.io/badge/ILO_Fundamental_Principles-✓-259D6C.svg?style=flat
|
|
286
|
+
[🚎yard-current]: http://rubydoc.info/gems/typescript-merge
|
|
287
|
+
[🚎yard-head]: https://typescript-merge.galtzo.com
|
|
288
|
+
[💎stone_checksums]: https://github.com/galtzo-floss/stone_checksums
|
|
289
|
+
[💎SHA_checksums]: https://gitlab.com/structuredmerge/structuredmerge-ruby/-/tree/main/checksums
|
|
290
|
+
[💎rlts]: https://github.com/rubocop-lts/rubocop-lts
|
|
291
|
+
[💎rlts-img]: https://img.shields.io/badge/code_style_&_linting-rubocop--lts-34495e.svg?plastic&logo=ruby&logoColor=white
|
|
292
|
+
[💎appraisal2]: https://github.com/appraisal-rb/appraisal2
|
|
293
|
+
[💎appraisal2-img]: https://img.shields.io/badge/appraised_by-appraisal2-34495e.svg?plastic&logo=ruby&logoColor=white
|
|
294
|
+
[💎d-in-dvcs]: https://railsbling.com/posts/dvcs/put_the_d_in_dvcs/
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
module TypeScript
|
|
4
4
|
module Merge
|
|
5
|
+
# Version namespace for this gem.
|
|
5
6
|
module Version
|
|
6
|
-
|
|
7
|
+
# Current gem version.
|
|
8
|
+
VERSION = '7.1.1'
|
|
7
9
|
end
|
|
8
|
-
|
|
9
|
-
VERSION = Version::VERSION
|
|
10
|
+
# Current gem version exposed at the traditional constant location.
|
|
11
|
+
VERSION = Version::VERSION # Traditional Constant Location
|
|
10
12
|
end
|
|
11
13
|
end
|
data/lib/typescript/merge.rb
CHANGED
|
@@ -1,27 +1,44 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require
|
|
4
|
-
require
|
|
3
|
+
require 'tree_haver'
|
|
4
|
+
require 'ast/merge'
|
|
5
|
+
require_relative 'merge/version'
|
|
5
6
|
|
|
6
7
|
module TypeScript
|
|
7
8
|
module Merge
|
|
8
|
-
|
|
9
|
+
module_function
|
|
9
10
|
|
|
10
|
-
PACKAGE_NAME =
|
|
11
|
+
PACKAGE_NAME = 'typescript-merge'
|
|
11
12
|
TREE_SITTER_BACKEND = TreeHaver::KREUZBERG_LANGUAGE_PACK_BACKEND
|
|
12
|
-
DESTINATION_WINS_ARRAY_POLICY = { surface:
|
|
13
|
+
DESTINATION_WINS_ARRAY_POLICY = { surface: 'array', name: 'destination_wins_array' }.freeze
|
|
14
|
+
BACKEND_REGISTRY = Struct.new(:registered, :mutex).new(false, Mutex.new)
|
|
15
|
+
|
|
16
|
+
def register_backend!
|
|
17
|
+
BACKEND_REGISTRY.mutex.synchronize do
|
|
18
|
+
return if BACKEND_REGISTRY.registered
|
|
19
|
+
|
|
20
|
+
TreeHaver::BackendRegistry.register(TREE_SITTER_BACKEND)
|
|
21
|
+
|
|
22
|
+
grammar_finder = TreeHaver::GrammarFinder.new(:typescript)
|
|
23
|
+
grammar_finder.register! if grammar_finder.available?
|
|
24
|
+
|
|
25
|
+
BACKEND_REGISTRY.registered = true
|
|
26
|
+
end
|
|
27
|
+
end
|
|
13
28
|
|
|
14
29
|
def type_script_feature_profile
|
|
15
|
-
{ family:
|
|
30
|
+
{ family: 'typescript', supported_dialects: ['typescript'], supported_policies: [DESTINATION_WINS_ARRAY_POLICY] }
|
|
16
31
|
end
|
|
17
32
|
|
|
18
33
|
def available_type_script_backends
|
|
19
|
-
[TREE_SITTER_BACKEND]
|
|
34
|
+
type_script_backend_available_for_analysis?(TREE_SITTER_BACKEND.id) ? [TREE_SITTER_BACKEND] : []
|
|
20
35
|
end
|
|
21
36
|
|
|
22
37
|
def type_script_backend_feature_profile(backend: nil)
|
|
23
|
-
requested = backend
|
|
24
|
-
|
|
38
|
+
requested = requested_tree_sitter_backend_id(backend)
|
|
39
|
+
unless type_script_backend_available_for_analysis?(requested)
|
|
40
|
+
return unsupported_feature_result("Unsupported TypeScript backend #{requested}.")
|
|
41
|
+
end
|
|
25
42
|
|
|
26
43
|
type_script_feature_profile.merge(
|
|
27
44
|
backend: requested,
|
|
@@ -45,76 +62,161 @@ module TypeScript
|
|
|
45
62
|
end
|
|
46
63
|
|
|
47
64
|
def parse_type_script(source, dialect)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
65
|
+
unless type_script_backend_available_for_analysis?(nil)
|
|
66
|
+
diagnostic_backend = TreeHaver.current_backend_id || 'tree-sitter'
|
|
67
|
+
return unsupported_feature_result("Unsupported TypeScript backend #{diagnostic_backend}.")
|
|
68
|
+
end
|
|
69
|
+
return analyze_type_script_module(source) if dialect == 'typescript'
|
|
51
70
|
|
|
52
|
-
{ ok: false,
|
|
71
|
+
{ ok: false,
|
|
72
|
+
diagnostics: [{ severity: 'error', category: 'unsupported_feature', message: "Unsupported TypeScript dialect #{dialect}." }], policies: [] }
|
|
53
73
|
end
|
|
54
74
|
|
|
75
|
+
def type_script_backend_available_for_analysis?(backend_id)
|
|
76
|
+
register_backend!
|
|
77
|
+
|
|
78
|
+
if backend_id.to_s.empty?
|
|
79
|
+
TreeHaver.parser_for(:typescript, backend_type: :tree_sitter)
|
|
80
|
+
else
|
|
81
|
+
TreeHaver.with_backend(backend_id) { TreeHaver.parser_for(:typescript, backend_type: :tree_sitter) }
|
|
82
|
+
end
|
|
83
|
+
true
|
|
84
|
+
rescue TreeHaver::Error, ArgumentError
|
|
85
|
+
false
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def requested_tree_sitter_backend_id(backend)
|
|
89
|
+
return backend.to_s unless backend.to_s.empty?
|
|
90
|
+
|
|
91
|
+
contextual = TreeHaver.current_backend_id || ENV['TREE_HAVER_BACKEND']
|
|
92
|
+
contextual.to_s.empty? || contextual.to_s == 'auto' ? TREE_SITTER_BACKEND.id : contextual.to_s
|
|
93
|
+
end
|
|
94
|
+
private_class_method :requested_tree_sitter_backend_id
|
|
95
|
+
|
|
55
96
|
def match_type_script_owners(template, destination)
|
|
56
|
-
|
|
57
|
-
template_paths = template[:owners].to_h { |owner| [owner[:path], true] }
|
|
58
|
-
{
|
|
59
|
-
matched: template[:owners].filter { |owner| destination_paths[owner[:path]] }.map { |owner| { template_path: owner[:path], destination_path: owner[:path] } },
|
|
60
|
-
unmatched_template: template[:owners].map { |owner| owner[:path] }.reject { |path| destination_paths[path] },
|
|
61
|
-
unmatched_destination: destination[:owners].map { |owner| owner[:path] }.reject { |path| template_paths[path] }
|
|
62
|
-
}
|
|
97
|
+
Ast::Merge::OwnerSelection.match_by_path(template, destination)
|
|
63
98
|
end
|
|
64
99
|
|
|
65
100
|
def merge_type_script(template_source, destination_source, dialect)
|
|
66
101
|
template = parse_type_script(template_source, dialect)
|
|
67
102
|
return { ok: false, diagnostics: template[:diagnostics], policies: [] } unless template[:ok]
|
|
103
|
+
|
|
68
104
|
destination = parse_type_script(destination_source, dialect)
|
|
69
105
|
unless destination[:ok]
|
|
70
106
|
return {
|
|
71
107
|
ok: false,
|
|
72
|
-
diagnostics: destination[:diagnostics].map
|
|
108
|
+
diagnostics: destination[:diagnostics].map do |diagnostic|
|
|
109
|
+
diagnostic[:category] == 'parse_error' ? diagnostic.merge(category: 'destination_parse_error') : diagnostic
|
|
110
|
+
end,
|
|
73
111
|
policies: []
|
|
74
112
|
}
|
|
75
113
|
end
|
|
76
114
|
|
|
77
115
|
destination_declarations = destination.dig(:analysis, :declarations).to_h { |item| [item[:path], item] }
|
|
78
116
|
merged_declaration_texts = destination.dig(:analysis, :declarations).map { |item| item[:text] } +
|
|
79
|
-
|
|
117
|
+
template.dig(:analysis, :declarations).reject do |item|
|
|
118
|
+
destination_declarations[item[:path]]
|
|
119
|
+
end.map { |item| item[:text] }
|
|
80
120
|
import_block = destination.dig(:analysis, :imports).map { |item| item[:text] }.join
|
|
81
121
|
declaration_block = merged_declaration_texts.join("\n").rstrip
|
|
82
122
|
sections = [import_block.rstrip, declaration_block].reject(&:empty?)
|
|
83
123
|
|
|
84
|
-
{ ok: true, diagnostics: [], output: "#{sections.join("\n\n").rstrip}\n",
|
|
124
|
+
{ ok: true, diagnostics: [], output: "#{sections.join("\n\n").rstrip}\n",
|
|
125
|
+
policies: [DESTINATION_WINS_ARRAY_POLICY] }
|
|
85
126
|
end
|
|
86
127
|
|
|
87
128
|
def analyze_type_script_module(source)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
129
|
+
parser = TreeHaver.parser_for(:typescript, backend_type: :tree_sitter)
|
|
130
|
+
tree = parser.parse(source)
|
|
131
|
+
collect_parse_errors(tree.root_node)
|
|
132
|
+
|
|
133
|
+
imports = []
|
|
134
|
+
declarations = []
|
|
135
|
+
tree.root_node.children.each do |node|
|
|
136
|
+
case node.type
|
|
137
|
+
when 'import_statement'
|
|
138
|
+
import_source = line_anchored_slice(source, node)
|
|
139
|
+
imports << {
|
|
140
|
+
path: "/imports/#{imports.length}",
|
|
141
|
+
owner_kind: 'import',
|
|
142
|
+
match_key: normalize_type_script_import_path(import_source),
|
|
143
|
+
text: import_text(source, node)
|
|
144
|
+
}
|
|
145
|
+
when 'export_statement', 'function_declaration', 'class_declaration', 'interface_declaration',
|
|
146
|
+
'lexical_declaration', 'variable_declaration'
|
|
147
|
+
name = first_named_descendant_text(source, node, %w[identifier type_identifier])
|
|
148
|
+
next unless name
|
|
149
|
+
|
|
150
|
+
declarations << {
|
|
151
|
+
path: "/declarations/#{name}",
|
|
152
|
+
owner_kind: 'declaration',
|
|
153
|
+
match_key: name,
|
|
154
|
+
text: declaration_text(source, node)
|
|
155
|
+
}
|
|
156
|
+
end
|
|
95
157
|
end
|
|
96
|
-
declarations = processed[:analysis].structure
|
|
97
|
-
.select { |item| item.name }
|
|
98
|
-
.map { |item| { path: "/declarations/#{item.name}", match_key: item.name, text: declaration_text(source, item.span) } }
|
|
99
|
-
.sort_by { |item| item[:path] }
|
|
100
158
|
|
|
101
159
|
{
|
|
102
160
|
ok: true,
|
|
103
161
|
diagnostics: [],
|
|
104
162
|
analysis: {
|
|
105
|
-
kind:
|
|
106
|
-
dialect:
|
|
107
|
-
source: source,
|
|
108
|
-
owners: imports.map { |item| { path: item[:path], owner_kind: "import", match_key: item[:match_key] } } +
|
|
109
|
-
declarations.map { |item| { path: item[:path], owner_kind: "declaration", match_key: item[:match_key] } },
|
|
163
|
+
kind: 'typescript',
|
|
164
|
+
dialect: 'typescript',
|
|
110
165
|
imports: imports,
|
|
111
|
-
declarations: declarations
|
|
166
|
+
declarations: declarations,
|
|
167
|
+
owners: owner_views(imports + declarations)
|
|
112
168
|
},
|
|
113
169
|
policies: []
|
|
114
170
|
}
|
|
171
|
+
rescue TreeHaver::Error, StandardError => e
|
|
172
|
+
parse_failure_result(e)
|
|
115
173
|
end
|
|
116
174
|
private_class_method :analyze_type_script_module
|
|
117
175
|
|
|
176
|
+
def collect_parse_errors(node)
|
|
177
|
+
raise TreeHaver::NotAvailable, 'TypeScript parse returned no root node' unless node
|
|
178
|
+
return unless node.respond_to?(:has_error?) && node.has_error?
|
|
179
|
+
|
|
180
|
+
raise TreeHaver::NotAvailable,
|
|
181
|
+
'TypeScript parse contains syntax errors'
|
|
182
|
+
end
|
|
183
|
+
private_class_method :collect_parse_errors
|
|
184
|
+
|
|
185
|
+
def parse_failure_result(error)
|
|
186
|
+
{ ok: false,
|
|
187
|
+
diagnostics: [{ severity: 'error', category: 'parse_error', message: error.message }],
|
|
188
|
+
policies: [] }
|
|
189
|
+
end
|
|
190
|
+
private_class_method :parse_failure_result
|
|
191
|
+
|
|
192
|
+
def normalize_type_script_import_path(import_source)
|
|
193
|
+
match = import_source.match(/from\s+['"]([^'"]+)['"]/) || import_source.match(/import\s+['"]([^'"]+)['"]/)
|
|
194
|
+
match ? match[1] : import_source.sub(/\Aimport\s+/, '').strip
|
|
195
|
+
end
|
|
196
|
+
private_class_method :normalize_type_script_import_path
|
|
197
|
+
|
|
198
|
+
def first_named_descendant_text(source, node, types)
|
|
199
|
+
return slice_span(source, node) if types.include?(node.type)
|
|
200
|
+
|
|
201
|
+
node.children.each do |child|
|
|
202
|
+
value = first_named_descendant_text(source, child, types)
|
|
203
|
+
return value if value && !value.empty?
|
|
204
|
+
end
|
|
205
|
+
nil
|
|
206
|
+
end
|
|
207
|
+
private_class_method :first_named_descendant_text
|
|
208
|
+
|
|
209
|
+
def owner_view(item)
|
|
210
|
+
item.slice(:path, :owner_kind, :match_key)
|
|
211
|
+
end
|
|
212
|
+
private_class_method :owner_view
|
|
213
|
+
|
|
214
|
+
def owner_views(items)
|
|
215
|
+
imports, declarations = items.partition { |item| item.fetch(:owner_kind) == 'import' }
|
|
216
|
+
(imports + declarations.sort_by { |item| item.fetch(:path) }).map { |item| owner_view(item) }
|
|
217
|
+
end
|
|
218
|
+
private_class_method :owner_views
|
|
219
|
+
|
|
118
220
|
def import_text(source, span)
|
|
119
221
|
"#{slice_span(source, span)}\n"
|
|
120
222
|
end
|
|
@@ -138,8 +240,14 @@ module TypeScript
|
|
|
138
240
|
private_class_method :line_anchored_slice
|
|
139
241
|
|
|
140
242
|
def unsupported_feature_result(message)
|
|
141
|
-
|
|
243
|
+
{
|
|
244
|
+
ok: false,
|
|
245
|
+
diagnostics: [{ severity: 'error', category: 'unsupported_feature', message: message }],
|
|
246
|
+
policies: []
|
|
247
|
+
}
|
|
142
248
|
end
|
|
143
249
|
private_class_method :unsupported_feature_result
|
|
144
250
|
end
|
|
145
251
|
end
|
|
252
|
+
|
|
253
|
+
TypeScript::Merge.register_backend!
|
data/lib/typescript-merge.rb
CHANGED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: typescript-merge
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 7.
|
|
4
|
+
version: 7.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Peter H. Boling
|
|
8
|
-
bindir:
|
|
8
|
+
bindir: exe
|
|
9
9
|
cert_chain:
|
|
10
10
|
- |
|
|
11
11
|
-----BEGIN CERTIFICATE-----
|
|
@@ -43,54 +43,291 @@ dependencies:
|
|
|
43
43
|
requirements:
|
|
44
44
|
- - '='
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: 7.
|
|
46
|
+
version: 7.1.1
|
|
47
47
|
type: :runtime
|
|
48
48
|
prerelease: false
|
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
51
|
- - '='
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: 7.
|
|
53
|
+
version: 7.1.1
|
|
54
54
|
- !ruby/object:Gem::Dependency
|
|
55
55
|
name: tree_haver
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
|
57
57
|
requirements:
|
|
58
58
|
- - '='
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: 7.
|
|
60
|
+
version: 7.1.1
|
|
61
61
|
type: :runtime
|
|
62
62
|
prerelease: false
|
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
64
64
|
requirements:
|
|
65
65
|
- - '='
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: 7.
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
version: 7.1.1
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: version_gem
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - "~>"
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '1.1'
|
|
75
|
+
- - ">="
|
|
76
|
+
- !ruby/object:Gem::Version
|
|
77
|
+
version: 1.1.15
|
|
78
|
+
type: :runtime
|
|
79
|
+
prerelease: false
|
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
81
|
+
requirements:
|
|
82
|
+
- - "~>"
|
|
83
|
+
- !ruby/object:Gem::Version
|
|
84
|
+
version: '1.1'
|
|
85
|
+
- - ">="
|
|
86
|
+
- !ruby/object:Gem::Version
|
|
87
|
+
version: 1.1.15
|
|
88
|
+
- !ruby/object:Gem::Dependency
|
|
89
|
+
name: kettle-dev
|
|
90
|
+
requirement: !ruby/object:Gem::Requirement
|
|
91
|
+
requirements:
|
|
92
|
+
- - "~>"
|
|
93
|
+
- !ruby/object:Gem::Version
|
|
94
|
+
version: '2.5'
|
|
95
|
+
- - ">="
|
|
96
|
+
- !ruby/object:Gem::Version
|
|
97
|
+
version: 2.5.17
|
|
98
|
+
type: :development
|
|
99
|
+
prerelease: false
|
|
100
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
101
|
+
requirements:
|
|
102
|
+
- - "~>"
|
|
103
|
+
- !ruby/object:Gem::Version
|
|
104
|
+
version: '2.5'
|
|
105
|
+
- - ">="
|
|
106
|
+
- !ruby/object:Gem::Version
|
|
107
|
+
version: 2.5.17
|
|
108
|
+
- !ruby/object:Gem::Dependency
|
|
109
|
+
name: bundler-audit
|
|
110
|
+
requirement: !ruby/object:Gem::Requirement
|
|
111
|
+
requirements:
|
|
112
|
+
- - "~>"
|
|
113
|
+
- !ruby/object:Gem::Version
|
|
114
|
+
version: 0.9.3
|
|
115
|
+
type: :development
|
|
116
|
+
prerelease: false
|
|
117
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
118
|
+
requirements:
|
|
119
|
+
- - "~>"
|
|
120
|
+
- !ruby/object:Gem::Version
|
|
121
|
+
version: 0.9.3
|
|
122
|
+
- !ruby/object:Gem::Dependency
|
|
123
|
+
name: rake
|
|
124
|
+
requirement: !ruby/object:Gem::Requirement
|
|
125
|
+
requirements:
|
|
126
|
+
- - "~>"
|
|
127
|
+
- !ruby/object:Gem::Version
|
|
128
|
+
version: '13.0'
|
|
129
|
+
type: :development
|
|
130
|
+
prerelease: false
|
|
131
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
132
|
+
requirements:
|
|
133
|
+
- - "~>"
|
|
134
|
+
- !ruby/object:Gem::Version
|
|
135
|
+
version: '13.0'
|
|
136
|
+
- !ruby/object:Gem::Dependency
|
|
137
|
+
name: require_bench
|
|
138
|
+
requirement: !ruby/object:Gem::Requirement
|
|
139
|
+
requirements:
|
|
140
|
+
- - "~>"
|
|
141
|
+
- !ruby/object:Gem::Version
|
|
142
|
+
version: '1.0'
|
|
143
|
+
- - ">="
|
|
144
|
+
- !ruby/object:Gem::Version
|
|
145
|
+
version: 1.0.4
|
|
146
|
+
type: :development
|
|
147
|
+
prerelease: false
|
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
149
|
+
requirements:
|
|
150
|
+
- - "~>"
|
|
151
|
+
- !ruby/object:Gem::Version
|
|
152
|
+
version: '1.0'
|
|
153
|
+
- - ">="
|
|
154
|
+
- !ruby/object:Gem::Version
|
|
155
|
+
version: 1.0.4
|
|
156
|
+
- !ruby/object:Gem::Dependency
|
|
157
|
+
name: anonymous_loader
|
|
158
|
+
requirement: !ruby/object:Gem::Requirement
|
|
159
|
+
requirements:
|
|
160
|
+
- - "~>"
|
|
161
|
+
- !ruby/object:Gem::Version
|
|
162
|
+
version: '0.1'
|
|
163
|
+
- - ">="
|
|
164
|
+
- !ruby/object:Gem::Version
|
|
165
|
+
version: 0.1.3
|
|
166
|
+
type: :development
|
|
167
|
+
prerelease: false
|
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
169
|
+
requirements:
|
|
170
|
+
- - "~>"
|
|
171
|
+
- !ruby/object:Gem::Version
|
|
172
|
+
version: '0.1'
|
|
173
|
+
- - ">="
|
|
174
|
+
- !ruby/object:Gem::Version
|
|
175
|
+
version: 0.1.3
|
|
176
|
+
- !ruby/object:Gem::Dependency
|
|
177
|
+
name: appraisal2
|
|
178
|
+
requirement: !ruby/object:Gem::Requirement
|
|
179
|
+
requirements:
|
|
180
|
+
- - "~>"
|
|
181
|
+
- !ruby/object:Gem::Version
|
|
182
|
+
version: '3.2'
|
|
183
|
+
- - ">="
|
|
184
|
+
- !ruby/object:Gem::Version
|
|
185
|
+
version: 3.2.0
|
|
186
|
+
type: :development
|
|
187
|
+
prerelease: false
|
|
188
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
189
|
+
requirements:
|
|
190
|
+
- - "~>"
|
|
191
|
+
- !ruby/object:Gem::Version
|
|
192
|
+
version: '3.2'
|
|
193
|
+
- - ">="
|
|
194
|
+
- !ruby/object:Gem::Version
|
|
195
|
+
version: 3.2.0
|
|
196
|
+
- !ruby/object:Gem::Dependency
|
|
197
|
+
name: kettle-test
|
|
198
|
+
requirement: !ruby/object:Gem::Requirement
|
|
199
|
+
requirements:
|
|
200
|
+
- - "~>"
|
|
201
|
+
- !ruby/object:Gem::Version
|
|
202
|
+
version: '2.0'
|
|
203
|
+
- - ">="
|
|
204
|
+
- !ruby/object:Gem::Version
|
|
205
|
+
version: 2.0.19
|
|
206
|
+
type: :development
|
|
207
|
+
prerelease: false
|
|
208
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
209
|
+
requirements:
|
|
210
|
+
- - "~>"
|
|
211
|
+
- !ruby/object:Gem::Version
|
|
212
|
+
version: '2.0'
|
|
213
|
+
- - ">="
|
|
214
|
+
- !ruby/object:Gem::Version
|
|
215
|
+
version: 2.0.19
|
|
216
|
+
- !ruby/object:Gem::Dependency
|
|
217
|
+
name: turbo_tests2
|
|
218
|
+
requirement: !ruby/object:Gem::Requirement
|
|
219
|
+
requirements:
|
|
220
|
+
- - "~>"
|
|
221
|
+
- !ruby/object:Gem::Version
|
|
222
|
+
version: '3.2'
|
|
223
|
+
- - ">="
|
|
224
|
+
- !ruby/object:Gem::Version
|
|
225
|
+
version: 3.2.4
|
|
226
|
+
type: :development
|
|
227
|
+
prerelease: false
|
|
228
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
229
|
+
requirements:
|
|
230
|
+
- - "~>"
|
|
231
|
+
- !ruby/object:Gem::Version
|
|
232
|
+
version: '3.2'
|
|
233
|
+
- - ">="
|
|
234
|
+
- !ruby/object:Gem::Version
|
|
235
|
+
version: 3.2.4
|
|
236
|
+
- !ruby/object:Gem::Dependency
|
|
237
|
+
name: ruby-progressbar
|
|
238
|
+
requirement: !ruby/object:Gem::Requirement
|
|
239
|
+
requirements:
|
|
240
|
+
- - "~>"
|
|
241
|
+
- !ruby/object:Gem::Version
|
|
242
|
+
version: '1.13'
|
|
243
|
+
type: :development
|
|
244
|
+
prerelease: false
|
|
245
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
246
|
+
requirements:
|
|
247
|
+
- - "~>"
|
|
248
|
+
- !ruby/object:Gem::Version
|
|
249
|
+
version: '1.13'
|
|
250
|
+
- !ruby/object:Gem::Dependency
|
|
251
|
+
name: stone_checksums
|
|
252
|
+
requirement: !ruby/object:Gem::Requirement
|
|
253
|
+
requirements:
|
|
254
|
+
- - "~>"
|
|
255
|
+
- !ruby/object:Gem::Version
|
|
256
|
+
version: '1.0'
|
|
257
|
+
- - ">="
|
|
258
|
+
- !ruby/object:Gem::Version
|
|
259
|
+
version: 1.0.8
|
|
260
|
+
type: :development
|
|
261
|
+
prerelease: false
|
|
262
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
263
|
+
requirements:
|
|
264
|
+
- - "~>"
|
|
265
|
+
- !ruby/object:Gem::Version
|
|
266
|
+
version: '1.0'
|
|
267
|
+
- - ">="
|
|
268
|
+
- !ruby/object:Gem::Version
|
|
269
|
+
version: 1.0.8
|
|
270
|
+
- !ruby/object:Gem::Dependency
|
|
271
|
+
name: gitmoji-regex
|
|
272
|
+
requirement: !ruby/object:Gem::Requirement
|
|
273
|
+
requirements:
|
|
274
|
+
- - "~>"
|
|
275
|
+
- !ruby/object:Gem::Version
|
|
276
|
+
version: '2.0'
|
|
277
|
+
- - ">="
|
|
278
|
+
- !ruby/object:Gem::Version
|
|
279
|
+
version: 2.0.11
|
|
280
|
+
type: :development
|
|
281
|
+
prerelease: false
|
|
282
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
283
|
+
requirements:
|
|
284
|
+
- - "~>"
|
|
285
|
+
- !ruby/object:Gem::Version
|
|
286
|
+
version: '2.0'
|
|
287
|
+
- - ">="
|
|
288
|
+
- !ruby/object:Gem::Version
|
|
289
|
+
version: 2.0.11
|
|
290
|
+
description: "☯️ Portable TypeScript module owner analysis and merge behavior for
|
|
291
|
+
Structured Merge."
|
|
70
292
|
email:
|
|
71
|
-
-
|
|
293
|
+
- floss@galtzo.com
|
|
72
294
|
executables: []
|
|
73
295
|
extensions: []
|
|
74
296
|
extra_rdoc_files: []
|
|
75
297
|
files:
|
|
298
|
+
- LICENSE.md
|
|
299
|
+
- README.md
|
|
76
300
|
- lib/typescript-merge.rb
|
|
77
301
|
- lib/typescript/merge.rb
|
|
78
302
|
- lib/typescript/merge/version.rb
|
|
303
|
+
- sig/typescript/merge.rbs
|
|
79
304
|
homepage: https://github.com/structuredmerge/structuredmerge-ruby
|
|
80
305
|
licenses:
|
|
81
306
|
- AGPL-3.0-only
|
|
82
307
|
- PolyForm-Small-Business-1.0.0
|
|
83
308
|
metadata:
|
|
84
309
|
homepage_uri: https://structuredmerge.org
|
|
85
|
-
source_code_uri: https://github.com/structuredmerge/structuredmerge-ruby/tree/v7.
|
|
86
|
-
changelog_uri: https://github.com/structuredmerge/structuredmerge-ruby/blob/v7.
|
|
310
|
+
source_code_uri: https://github.com/structuredmerge/structuredmerge-ruby/tree/v7.1.1
|
|
311
|
+
changelog_uri: https://github.com/structuredmerge/structuredmerge-ruby/blob/v7.1.1/CHANGELOG.md
|
|
87
312
|
bug_tracker_uri: https://github.com/structuredmerge/structuredmerge-ruby/issues
|
|
88
|
-
documentation_uri: https://www.rubydoc.info/gems/typescript-merge/7.
|
|
313
|
+
documentation_uri: https://www.rubydoc.info/gems/typescript-merge/7.1.1
|
|
89
314
|
funding_uri: https://github.com/sponsors/pboling
|
|
90
315
|
wiki_uri: https://github.com/structuredmerge/structuredmerge-ruby/wiki
|
|
316
|
+
news_uri: https://www.railsbling.com/tags/typescript-merge
|
|
91
317
|
discord_uri: https://discord.gg/3qme4XHNKN
|
|
318
|
+
mailing_list_uri: https://www.rubyforum.org/tag/structuredmerge
|
|
92
319
|
rubygems_mfa_required: 'true'
|
|
93
|
-
rdoc_options:
|
|
320
|
+
rdoc_options:
|
|
321
|
+
- "--title"
|
|
322
|
+
- typescript-merge - ☯️ Structured Merge TypeScript module analysis and merge for
|
|
323
|
+
Ruby
|
|
324
|
+
- "--main"
|
|
325
|
+
- README.md
|
|
326
|
+
- "--exclude"
|
|
327
|
+
- "^sig/"
|
|
328
|
+
- "--line-numbers"
|
|
329
|
+
- "--inline-source"
|
|
330
|
+
- "--quiet"
|
|
94
331
|
require_paths:
|
|
95
332
|
- lib
|
|
96
333
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
@@ -104,7 +341,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
104
341
|
- !ruby/object:Gem::Version
|
|
105
342
|
version: '0'
|
|
106
343
|
requirements: []
|
|
107
|
-
rubygems_version: 4.0.
|
|
344
|
+
rubygems_version: 4.0.17
|
|
108
345
|
specification_version: 4
|
|
109
|
-
summary: Structured Merge TypeScript module analysis and merge for Ruby
|
|
346
|
+
summary: "☯️ Structured Merge TypeScript module analysis and merge for Ruby"
|
|
110
347
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|