Skip to content

Commit

Permalink
Removing path dependency.
Browse files Browse the repository at this point in the history
  • Loading branch information
tokenshift committed Nov 8, 2022
1 parent 6383d5e commit 10443dd
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 68 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [0.1.1] - 2022-11-08

### Modified

* Removed `path` dependency.

## [0.1.0] - 2022-11-03

### Added
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "obsidian-page-gallery",
"name": "Page Gallery",
"version": "0.1.0",
"version": "0.1.1",
"minAppVersion": "0.15.0",
"description": "Creates an embeddable gallery based on selected page contents.",
"author": "Nathan Clark",
Expand Down
64 changes: 2 additions & 62 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-page-gallery",
"version": "0.1.0",
"version": "0.1.1",
"description": "Creates an embeddable gallery based on selected page contents.",
"main": "./src/PageGalleryPlugin.ts",
"type": "module",
Expand Down Expand Up @@ -40,7 +40,6 @@
"deepmerge": "^4.2.2",
"mime-types": "^2.1.35",
"object-path": "^0.11.8",
"path": "^0.12.7",
"toml": "^3.0.0",
"ulid": "^2.3.0"
}
Expand Down
6 changes: 4 additions & 2 deletions src/PageGalleryRenderChild.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import debounce from 'debounce'
import mime from 'mime-types'
import objectPath from 'object-path'
import path from 'path'
import { ulid } from 'ulid'

import { MarkdownPreviewView, MarkdownRenderChild, TFile } from 'obsidian';
Expand Down Expand Up @@ -181,7 +180,10 @@ export default class PageGalleryRenderChild extends MarkdownRenderChild {
return src
}

const mimeType = mime.lookup(path.parse(src).ext)
const ext = src.split('.').pop()
if (!ext) { continue }

const mimeType = mime.lookup(ext)
if (!mimeType || !IMG_MIME_TYPES.contains(mimeType)) { continue }

const file = this.plugin.app.vault.getFiles().find(f => f.path.endsWith(src))
Expand Down
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"0.0.1": "0.15.0",
"0.0.2": "0.15.0",
"0.0.3": "0.15.0",
"0.1.0": "0.15.0"
"0.1.0": "0.15.0",
"0.1.1": "0.15.0"
}

0 comments on commit 10443dd

Please sign in to comment.