mbeditor 0.5.3 → 0.7.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/CHANGELOG.md +77 -0
- data/README.md +7 -0
- data/app/assets/javascripts/mbeditor/application.js +3 -0
- data/app/assets/javascripts/mbeditor/components/ChangelogView.js +145 -0
- data/app/assets/javascripts/mbeditor/components/DiffViewer.js +1 -1
- data/app/assets/javascripts/mbeditor/components/EditorPanel.js +359 -31
- data/app/assets/javascripts/mbeditor/components/FileTree.js +177 -116
- data/app/assets/javascripts/mbeditor/components/MbeditorApp.js +952 -143
- data/app/assets/javascripts/mbeditor/components/TabBar.js +9 -0
- data/app/assets/javascripts/mbeditor/conflict_parser.js +48 -0
- data/app/assets/javascripts/mbeditor/editor_plugins.js +420 -67
- data/app/assets/javascripts/mbeditor/editor_store.js +1 -0
- data/app/assets/javascripts/mbeditor/file_service.js +34 -6
- data/app/assets/javascripts/mbeditor/git_service.js +2 -1
- data/app/assets/javascripts/mbeditor/history_service.js +177 -0
- data/app/assets/javascripts/mbeditor/search_service.js +1 -0
- data/app/assets/javascripts/mbeditor/tab_manager.js +8 -5
- data/app/assets/stylesheets/mbeditor/application.css +112 -0
- data/app/assets/stylesheets/mbeditor/editor.css +443 -78
- data/app/channels/mbeditor/editor_channel.rb +5 -41
- data/app/controllers/mbeditor/application_controller.rb +8 -1
- data/app/controllers/mbeditor/editors_controller.rb +276 -654
- data/app/controllers/mbeditor/git_controller.rb +2 -61
- data/app/services/mbeditor/availability_probe.rb +83 -0
- data/app/services/mbeditor/code_search_service.rb +42 -0
- data/app/services/mbeditor/editor_state_service.rb +91 -0
- data/app/services/mbeditor/exclusion_matcher.rb +23 -0
- data/app/services/mbeditor/file_operation_service.rb +68 -0
- data/app/services/mbeditor/file_tree_service.rb +69 -0
- data/app/services/mbeditor/git_combined_diff_service.rb +43 -0
- data/app/services/mbeditor/git_commit_detail_service.rb +46 -0
- data/app/services/mbeditor/git_info_service.rb +151 -0
- data/app/services/mbeditor/git_service.rb +36 -26
- data/app/services/mbeditor/js_definition_service.rb +59 -0
- data/app/services/mbeditor/js_members_service.rb +62 -0
- data/app/services/mbeditor/process_runner.rb +48 -0
- data/app/services/mbeditor/rails_related_files_service.rb +282 -0
- data/app/services/mbeditor/ruby_definition_service.rb +77 -101
- data/app/services/mbeditor/schema_service.rb +270 -0
- data/app/services/mbeditor/search_replace_service.rb +184 -0
- data/app/services/mbeditor/test_runner_service.rb +5 -27
- data/app/views/layouts/mbeditor/application.html.erb +2 -2
- data/config/routes.rb +8 -1
- data/lib/mbeditor/configuration.rb +4 -2
- data/lib/mbeditor/version.rb +1 -1
- data/public/monaco-editor/vs/language/css/cssMode.js +13 -0
- data/public/monaco-editor/vs/language/css/cssWorker.js +77 -0
- data/public/monaco-editor/vs/language/html/htmlMode.js +13 -0
- data/public/monaco-editor/vs/language/html/htmlWorker.js +454 -0
- data/public/monaco-editor/vs/language/json/jsonMode.js +19 -0
- data/public/monaco-editor/vs/language/json/jsonWorker.js +42 -0
- metadata +26 -3
- data/app/services/mbeditor/unused_methods_service.rb +0 -139
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0b7a1448f753b338a539d853fc6bebeba0960d5e2652273f69a725b25773b505
|
|
4
|
+
data.tar.gz: c20c3da8f5f8a27f3b3d3cd2a8d1038ac5451d2b1508c82ffe1e0eb272673070
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7ff05b972124d55ba7074c9d2afe2c7fc82648b2b88ff884126832d57e9cf232712dd814768728ad1799eae448663845555b9ccf4cd696a06d4351406aeeed59
|
|
7
|
+
data.tar.gz: c61f528b91b20203b6667c53abb58e1e02dc7230d91b251e039bc1bf5f99cd660836921437c1c23e9295162dd8aded1fec11acc3972455f6ebfb767c5f2df76f
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,83 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.7.0] - 2026-05-21
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Model schema modal** — click the table icon next to any resource in the Rails panel to view its database columns, types, constraints, and indexes parsed from `db/schema.rb`.
|
|
12
|
+
- **Changelog tab** — click the version number in the status bar to open a formatted changelog tab. Upgrades automatically open "What's New" on first boot after a version bump.
|
|
13
|
+
- **Rails panel: concerns** — model and controller concerns appear as a dedicated group in the Rails panel.
|
|
14
|
+
- **Rails panel: file kind labels** — each entry shows a dim label (Controller, Model, View, Test, Concern, Helper) on the right so you can distinguish files with similar names at a glance.
|
|
15
|
+
- **Rails panel: custom-path awareness** — files living outside the standard `app/` tree (configured via `related_files_custom_paths`) now show related files in the panel.
|
|
16
|
+
- **SQL/HTML heredoc highlighting** — Ruby heredocs with `<<~SQL`, `<<~HTML`, etc. tokenize their body with SQL/HTML keyword colours in the Monaco Monarch tokenizer.
|
|
17
|
+
- **Rake file syntax** — `.rake` files now use Ruby syntax highlighting.
|
|
18
|
+
- **Middle-click to close tab** — scroll-wheel click on any tab closes it (matching browser and VS Code behaviour).
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
- **Format button on Ruby files** — the Format button now correctly converts space-indented buffers to tabs before sending to RuboCop, so `Layout/IndentationStyle` offenses are fixed rather than silently ignored.
|
|
22
|
+
- **Hover highlight position** — hovering a JS/JSX global or component name now highlights the exact word under the cursor instead of text on a different line. The hover cache now stores only the popup contents and rebuilds the Monaco `Range` fresh per hover call so the same symbol on different lines highlights correctly.
|
|
23
|
+
- **`<MyComponent/>` hover** — components defined as `const MyComponent = () => {}` resolve correctly on hover; the JsDefinitionService grep pattern no longer uses `\s` inside character classes, which was silently failing under macOS BSD grep.
|
|
24
|
+
- **"Edited externally" false positives** — a `recentSavesRef` map suppresses external-edit warnings for 3 s after a successful save, preventing the warning triggered by the WebSocket `files_changed` broadcast that follows every save.
|
|
25
|
+
- **Branch detection race during save** — saving a file no longer triggers a false branch-switch (which was closing all tabs) by guarding the branch-change subscriber with `isSavingRef`.
|
|
26
|
+
- **File creation performance** — `GitInfoService.invalidate` is now called in a background thread so create-file and create-directory requests respond immediately.
|
|
27
|
+
- **Explorer type-ahead jump during rename/create** — global key-down handler returns early while a rename or create input is active.
|
|
28
|
+
- **Authlogic SHA512 console spam** — optional `authentication_cache_ttl` config (default 0 = disabled) caches successful authentication results in the session, reducing per-request auth lambda calls to at most once per TTL window.
|
|
29
|
+
- **Unused-method false positives in test files** — the unused-methods overlay is suppressed when the active file lives under `test/` or `spec/`.
|
|
30
|
+
- **JSX "defined twice" errors** — TS2300/TS2451 diagnostics are filtered out; they are structural false positives caused by Monaco treating all open JS files as a shared global script context.
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
- **Dirty marker in Rails panel** now uses the same orange (`#e5c07b`) as the tab bar dirty dot.
|
|
34
|
+
- **Rails panel branch-switch UX** — tabs stay visible (read-only) during a branch switch instead of disappearing immediately; a `branch_state_restore` setting (default `true`) controls whether tab state is saved/restored across branch switches.
|
|
35
|
+
|
|
36
|
+
## [Unreleased] — internal refactor (2026-05-23)
|
|
37
|
+
|
|
38
|
+
### Changed (no user-visible behavior change)
|
|
39
|
+
- **`AvailabilityProbe` extracted** — tool-availability checks (`rg`, `rubocop`, `haml_lint`, `git`, etc.) pulled out of `EditorsController` into `AvailabilityProbe`. Closes #22, #23, #24.
|
|
40
|
+
- **`FileTreeService` extracted** — directory-tree construction pulled out of `EditorsController` into `FileTreeService`. Closes #22, #23, #24.
|
|
41
|
+
- **`SearchReplaceService` extracted** — `rg`/`grep` detection, flag building, ReDoS guards, per-file timeout (`5 s`), size cap, encoding handling, and replace-in-files all unified in one service. `stream_search_results`, `count_search_results`, `RG_AVAILABLE`, and the inline 95-line `replace_in_files` action removed from the controller; replaced by thin delegators. Closes #25, #26, #27, #28.
|
|
42
|
+
- **`EditorStateService` extracted** — JSON state persistence (file locking, size limits, error handling) was duplicated between `EditorsController` and `EditorChannel`. Both protocol layers now delegate to `EditorStateService`; fixing a locking bug requires editing one file. Closes #29, #30, #31, #32.
|
|
43
|
+
- **`RubyDefinitionService` cache encapsulated** — `load_disk_cache_once`, `persist_cache`, `scan`, `file_cache`, and `mutex` removed from the public interface. `defs_in_file` and `includes_in_file` self-warm on cache miss; callers no longer need to manage lifecycle. Warmup hack in `UnusedMethodsService` removed. Closes #33, #34, #35, #36.
|
|
44
|
+
- **`GitCommitDetailService` and `GitCombinedDiffService` extracted** — the two `GitController` actions that contained raw `Open3.capture3` calls (`commit_detail`, `combined_diff`) are now thin delegators. No `EditorsController` action contains subprocess logic. Closes #37, #38, #41.
|
|
45
|
+
|
|
46
|
+
### Tests
|
|
47
|
+
- 92 new tests and 256 new assertions across 6 new service test files; suite now at 495 tests / 1681 assertions (up from 403 / 1425).
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## [Unreleased] — internal refactor (2026-05-17)
|
|
52
|
+
|
|
53
|
+
### Changed (no user-visible behavior change)
|
|
54
|
+
- **`GitInfoService` extracted** — the 139-line concurrent wave-orchestration block in `EditorsController#git_info` is now `GitInfoService.call(repo_path)` with a 5 s TTL cache and `invalidate` hook. Controller action is a single `render json:` call. `parse_porcelain_status` and `parse_name_status` promoted to `GitService` module functions. Closes #4, #5, #6.
|
|
55
|
+
- **`CodeSearchService` extracted** — `rg`/`grep` subprocess execution, fallback, ReDoS guards, and result parsing unified in one place. `JsDefinitionService` and `JsMembersService` are now thin wrappers. Closes #7, #8, #9, #10.
|
|
56
|
+
- **`ExclusionMatcher` extracted** — four diverged implementations of "should this path be excluded?" replaced by `ExclusionMatcher.new(config.excluded_paths).excluded?(path)`. `EditorsController`, `RubyDefinitionService`, and `UnusedMethodsService` all delegate to it. Closes #11, #12, #13, #14.
|
|
57
|
+
- **`FileOperationService` extracted** — ~200 LOC of inline file-CRUD logic in `EditorsController` moved to `FileOperationService` (save, create_file, create_dir, rename, destroy_path). Each controller action is now: resolve path → block-check → call service → broadcast → render. Closes #15, #16, #17.
|
|
58
|
+
- **`ProcessRunner` extracted** — three copies of "Open3 + timeout thread + SIGKILL" unified in `ProcessRunner.call(cmd, timeout:, env: {}, stdin_data: nil, chdir: nil)`. `GitService`, `TestRunnerService`, and the `EditorsController` lint path all delegate to it. Fixes the latent popen deadlock in `TestRunnerService`. Closes #18, #19, #20, #21.
|
|
59
|
+
|
|
60
|
+
### Tests
|
|
61
|
+
- 271 new tests and 845 new assertions across 10 new service test files; suite now at 403 tests / 1425 assertions (up from 132 / 580).
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## [0.6.0] - 2026-05-11
|
|
66
|
+
|
|
67
|
+
### Added
|
|
68
|
+
- **Virtual scrolling in FileTree** — only visible rows are rendered, dramatically improving performance with large file trees.
|
|
69
|
+
- **Multi-resource Rails panel** — the sidebar Rails panel now shows related files for up to 10 open Rails resources simultaneously, grouped by resource name with a dirty-file dot indicator.
|
|
70
|
+
- **Vim `:split` / `:vsplit` commands** — split the current file into the other pane using standard Vim command-line syntax.
|
|
71
|
+
- **Format changed-line highlighting** — after running Format Document, changed lines are highlighted with a green background for 3 seconds.
|
|
72
|
+
- **Sidebar panel titles** — "Explorer", "Search", and "Rails" labels now appear at the top of each sidebar panel.
|
|
73
|
+
- **Dirty-file indicators in Rails panel** — a small dot appears next to related files with unsaved changes.
|
|
74
|
+
|
|
75
|
+
### Changed
|
|
76
|
+
- Rails activity bar icon updated from text "R" to a Font Awesome gem icon.
|
|
77
|
+
- Monaco model cache size raised from 15 to 25 (`MAX_MODELS`).
|
|
78
|
+
- `wordBasedSuggestions` default changed to `'currentDocument'`; `linkedEditing` now respects user preferences.
|
|
79
|
+
- Git file comparison uses a lightweight signature function instead of `JSON.stringify`.
|
|
80
|
+
- Window-globals detection improved: symbols found on `window` at runtime are declared as globals to suppress TS2304 errors.
|
|
81
|
+
|
|
82
|
+
### Removed
|
|
83
|
+
- JSON auto-pretty-print on file open (files now display raw content).
|
|
84
|
+
|
|
8
85
|
## [0.5.1] - 2026-04-30
|
|
9
86
|
|
|
10
87
|
### Added
|
data/README.md
CHANGED
|
@@ -67,6 +67,10 @@ Mbeditor.configure do |config|
|
|
|
67
67
|
# config.redmine_url = "https://redmine.example.com/"
|
|
68
68
|
# config.redmine_api_key = "optional_api_key_override"
|
|
69
69
|
# config.redmine_ticket_source = :commit # :commit (scan recent commit messages for #123) or :branch (leading digits of branch name)
|
|
70
|
+
|
|
71
|
+
# Optional Ruby/Rails side panel tuning
|
|
72
|
+
# config.ruby_def_include_dirs = %w[app/models app/controllers app/helpers app/concerns]
|
|
73
|
+
# config.related_files_custom_paths = %w[app/assets/javascripts/app app/policies]
|
|
70
74
|
end
|
|
71
75
|
```
|
|
72
76
|
|
|
@@ -74,6 +78,7 @@ Available options:
|
|
|
74
78
|
|
|
75
79
|
- `allowed_environments` controls which Rails environments can access the engine. Default: `[:development]`.
|
|
76
80
|
- `authenticate_with` accepts a proc that runs as a `before_action` in all engine controllers. Use it to plug in the host app's authentication. The proc executes via `instance_exec` inside the engine controller, so it has access to `session`, `cookies`, `redirect_to`, and auth library class methods (e.g. Authlogic's `UserSession.find`), but not helper methods defined in the host app's `ApplicationController`. Default: `nil` (no authentication).
|
|
81
|
+
- `authentication_cache_ttl` caches the authentication result in the session for the given number of seconds (default: `0`, no caching). Set to e.g. `300` to avoid calling `authenticate_with` on every request — useful when the lambda is expensive (e.g. calls Authlogic's `current_user`). Trade-off: if the user logs out of the host app, mbeditor remains accessible for up to TTL seconds.
|
|
77
82
|
- `workspace_root` sets the root directory exposed by Mbeditor. Default: `Rails.root` from the host app.
|
|
78
83
|
- `excluded_paths` hides files and directories from the tree and path-based operations. Entries without `/` match names anywhere in the workspace path; entries with `/` match relative paths and their descendants. Default: `%w[.git tmp log node_modules .bundle coverage vendor/bundle]`.
|
|
79
84
|
- `rubocop_command` sets the command used for inline Ruby linting and formatting. Default: `"rubocop"`.
|
|
@@ -84,6 +89,8 @@ Available options:
|
|
|
84
89
|
- `redmine_url` sets the Redmine base URL. Required when `redmine_enabled` is `true`.
|
|
85
90
|
- `redmine_api_key` sets the Redmine API key. Required when `redmine_enabled` is `true`.
|
|
86
91
|
- `redmine_ticket_source` controls how the current Redmine ticket is identified. `:commit` scans the 100 most recent branch commits for a `#123` reference in the commit message. `:branch` reads the leading digits from the branch name (e.g. `123-my-feature` → ticket 123). Default: `:commit`.
|
|
92
|
+
- `ruby_def_include_dirs` sets which workspace-relative directories are searched when resolving Ruby go-to-definition jumps (e.g. clicking a class name). Add any extra directories that hold Ruby source files you want the engine to index. Default: `%w[app/models app/controllers app/helpers app/concerns]`.
|
|
93
|
+
- `related_files_custom_paths` adds extra base directories to the Rails related-files side panel. For each entry the panel looks for a subdirectory named after the current resource (plural or singular) and lists its files. For example, `"app/assets/javascripts/app"` will surface `app/assets/javascripts/app/users/` when you are editing a `users` resource. Default: `[]`.
|
|
87
94
|
|
|
88
95
|
## Test Runner
|
|
89
96
|
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
//= require mbeditor/editor_store
|
|
3
3
|
//= require mbeditor/file_icon
|
|
4
4
|
//= require mbeditor/file_service
|
|
5
|
+
//= require mbeditor/history_service
|
|
5
6
|
//= require mbeditor/websocket_service
|
|
6
7
|
//= require mbeditor/git_service
|
|
8
|
+
//= require mbeditor/conflict_parser
|
|
7
9
|
//= require mbeditor/search_service
|
|
8
10
|
//= require mbeditor/tab_manager
|
|
9
11
|
//= require mbeditor/editor_plugins
|
|
@@ -12,6 +14,7 @@
|
|
|
12
14
|
//= require mbeditor/components/DiffViewer
|
|
13
15
|
//= require mbeditor/components/CombinedDiffViewer
|
|
14
16
|
//= require mbeditor/components/CommitGraph
|
|
17
|
+
//= require mbeditor/components/ChangelogView
|
|
15
18
|
//= require mbeditor/components/FileHistoryPanel
|
|
16
19
|
//= require mbeditor/components/TestResultsPanel
|
|
17
20
|
//= require mbeditor/components/CodeReviewPanel
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// ChangelogView — renders the gem's CHANGELOG.md inside a styled editor tab.
|
|
4
|
+
// Receives `changelogState` ({ loading, content, error }) from MbeditorApp and
|
|
5
|
+
// calls `onLoad` when first mounted so the parent can trigger a fetch.
|
|
6
|
+
|
|
7
|
+
(function() {
|
|
8
|
+
var _React = React;
|
|
9
|
+
var useEffect = _React.useEffect;
|
|
10
|
+
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
// Lightweight markdown → React elements renderer, tuned for CHANGELOG format.
|
|
13
|
+
// Handles: h1/h2/h3, bullet lists, blank lines, horizontal rules, inline **bold**.
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
function parseInline(text) {
|
|
16
|
+
// Split on **bold** markers and return a mixed array of strings + bold spans.
|
|
17
|
+
var parts = text.split(/\*\*([^*]+)\*\*/g);
|
|
18
|
+
return parts.map(function(part, i) {
|
|
19
|
+
return i % 2 === 1
|
|
20
|
+
? React.createElement('strong', { key: i }, part)
|
|
21
|
+
: part;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function renderMarkdown(markdown) {
|
|
26
|
+
var lines = markdown.split('\n');
|
|
27
|
+
var elements = [];
|
|
28
|
+
var listBuffer = [];
|
|
29
|
+
var key = 0;
|
|
30
|
+
|
|
31
|
+
function flushList() {
|
|
32
|
+
if (!listBuffer.length) return;
|
|
33
|
+
elements.push(React.createElement(
|
|
34
|
+
'ul', { key: 'ul' + key++, className: 'changelog-list' },
|
|
35
|
+
listBuffer.slice()
|
|
36
|
+
));
|
|
37
|
+
listBuffer = [];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
lines.forEach(function(line) {
|
|
41
|
+
// H1
|
|
42
|
+
if (/^# /.test(line)) {
|
|
43
|
+
flushList();
|
|
44
|
+
elements.push(React.createElement('h1', { key: key++, className: 'changelog-h1' }, line.slice(2).trim()));
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
// H2 — version line, e.g. "## [0.7.0] - 2026-05-21"
|
|
48
|
+
if (/^## /.test(line)) {
|
|
49
|
+
flushList();
|
|
50
|
+
var raw = line.slice(3).trim();
|
|
51
|
+
// Parse "[X.Y.Z] - DATE" or "[Unreleased]..." patterns
|
|
52
|
+
var vMatch = raw.match(/^\[([^\]]+)\](?:\s*-\s*(.+))?/);
|
|
53
|
+
if (vMatch) {
|
|
54
|
+
elements.push(React.createElement(
|
|
55
|
+
'div', { key: key++, className: 'changelog-version-row' },
|
|
56
|
+
React.createElement('span', { className: 'changelog-version-badge' }, vMatch[1]),
|
|
57
|
+
vMatch[2] && React.createElement('span', { className: 'changelog-version-date' }, vMatch[2].trim())
|
|
58
|
+
));
|
|
59
|
+
} else {
|
|
60
|
+
elements.push(React.createElement('div', { key: key++, className: 'changelog-version-row' },
|
|
61
|
+
React.createElement('span', { className: 'changelog-version-badge' }, raw)
|
|
62
|
+
));
|
|
63
|
+
}
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
// H3 — section name, e.g. "### Added"
|
|
67
|
+
if (/^### /.test(line)) {
|
|
68
|
+
flushList();
|
|
69
|
+
var section = line.slice(4).trim();
|
|
70
|
+
var iconMap = { Added: 'fas fa-plus-circle', Fixed: 'fas fa-wrench', Changed: 'fas fa-exchange-alt', Removed: 'fas fa-minus-circle', Performance: 'fas fa-bolt', Tests: 'fas fa-vial', Security: 'fas fa-shield-alt' };
|
|
71
|
+
var iconClass = iconMap[section] || 'fas fa-tag';
|
|
72
|
+
elements.push(React.createElement(
|
|
73
|
+
'div', { key: key++, className: 'changelog-section changelog-section-' + section.toLowerCase() },
|
|
74
|
+
React.createElement('i', { className: iconClass }),
|
|
75
|
+
' ',
|
|
76
|
+
section
|
|
77
|
+
));
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
// Horizontal rule
|
|
81
|
+
if (/^---+$/.test(line.trim())) {
|
|
82
|
+
flushList();
|
|
83
|
+
elements.push(React.createElement('hr', { key: key++, className: 'changelog-rule' }));
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
// Bullet list item
|
|
87
|
+
if (/^- /.test(line)) {
|
|
88
|
+
listBuffer.push(React.createElement('li', { key: key++ }, parseInline(line.slice(2).trim())));
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
// Blank line
|
|
92
|
+
if (line.trim() === '') {
|
|
93
|
+
flushList();
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
// Plain paragraph (links, prose)
|
|
97
|
+
flushList();
|
|
98
|
+
if (/^\[.+\]: /.test(line)) return; // skip reference-style link defs
|
|
99
|
+
elements.push(React.createElement('p', { key: key++, className: 'changelog-p' }, parseInline(line.trim())));
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
flushList();
|
|
103
|
+
return elements;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// ---------------------------------------------------------------------------
|
|
107
|
+
// Component
|
|
108
|
+
// ---------------------------------------------------------------------------
|
|
109
|
+
var ChangelogView = function ChangelogView(props) {
|
|
110
|
+
var changelogState = props.changelogState;
|
|
111
|
+
var onLoad = props.onLoad;
|
|
112
|
+
|
|
113
|
+
useEffect(function() {
|
|
114
|
+
if (onLoad) onLoad();
|
|
115
|
+
}, []);
|
|
116
|
+
|
|
117
|
+
if (!changelogState || changelogState.loading) {
|
|
118
|
+
return React.createElement(
|
|
119
|
+
'div', { className: 'changelog-loading' },
|
|
120
|
+
React.createElement('i', { className: 'fas fa-spinner fa-spin', style: { marginRight: '8px' } }),
|
|
121
|
+
'Loading changelog…'
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (changelogState.error) {
|
|
126
|
+
return React.createElement(
|
|
127
|
+
'div', { className: 'changelog-error' },
|
|
128
|
+
React.createElement('i', { className: 'fas fa-exclamation-circle', style: { marginRight: '8px' } }),
|
|
129
|
+
changelogState.error
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
var content = changelogState.content || '';
|
|
134
|
+
|
|
135
|
+
return React.createElement(
|
|
136
|
+
'div', { className: 'changelog-view' },
|
|
137
|
+
React.createElement(
|
|
138
|
+
'div', { className: 'changelog-body' },
|
|
139
|
+
renderMarkdown(content)
|
|
140
|
+
)
|
|
141
|
+
);
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
window.ChangelogView = ChangelogView;
|
|
145
|
+
})();
|
|
@@ -106,7 +106,7 @@ var DiffViewer = function DiffViewer(_ref) {
|
|
|
106
106
|
if (/\.css\.erb$/.test(fileName)) return 'css';
|
|
107
107
|
var ext = fileName.split('.').pop();
|
|
108
108
|
var map = {
|
|
109
|
-
'rb': 'ruby', 'gemspec': 'ruby',
|
|
109
|
+
'rb': 'ruby', 'gemspec': 'ruby', 'rake': 'ruby',
|
|
110
110
|
'js': 'javascript', 'jsx': 'javascript',
|
|
111
111
|
'ts': 'typescript', 'tsx': 'typescript',
|
|
112
112
|
'json': 'json', 'yml': 'yaml', 'yaml': 'yaml',
|