1
0
mirror of https://github.com/desktop/desktop synced 2024-07-05 00:58:57 +00:00

Merge pull request #14022 from desktop/one-less-dependency

Use built-in fileURLToPath
This commit is contained in:
Markus Olsson 2022-03-02 14:05:54 +00:00 committed by GitHub
commit 32e6639626
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 10 deletions

View File

@ -35,7 +35,6 @@
"electron-window-state": "^5.0.3",
"event-kit": "^2.0.0",
"file-metadata": "^1.0.0",
"file-uri-to-path": "^2.0.0",
"file-url": "^2.0.2",
"focus-trap-react": "^8.1.0",
"fs-admin": "^0.19.0",

View File

@ -1,7 +1,7 @@
import { INodeFilter } from './node-filter'
import * as FSE from 'fs-extra'
import { escapeRegExp } from '../helpers/regex'
import uri2path from 'file-uri-to-path'
import { fileURLToPath } from 'url'
/**
* The Emoji Markdown filter will take a text node and create multiple text and
@ -122,7 +122,7 @@ export class EmojiFilter implements INodeFilter {
if (cached !== undefined) {
return cached
}
const imageBuffer = await FSE.readFile(uri2path(filePath))
const imageBuffer = await FSE.readFile(fileURLToPath(filePath))
const b64src = imageBuffer.toString('base64')
const uri = `data:image/png;base64,${b64src}`
this.emojiBase64URICache.set(filePath, uri)

View File

@ -1,7 +1,7 @@
import * as Path from 'path'
import * as Fs from 'fs'
import fileUriToPath from 'file-uri-to-path'
import sourceMapSupport from 'source-map-support'
import { fileURLToPath } from 'url'
/**
* This array tells the source map logic which files that we can expect to
@ -23,7 +23,7 @@ function retrieveSourceMap(source: string) {
// We get a file uri when we're inside a renderer, convert to a path
if (source.startsWith('file://')) {
source = fileUriToPath(source)
source = fileURLToPath(source)
}
// We store our source maps right next to the bundle

View File

@ -597,11 +597,6 @@ file-stream-rotator@^0.6.1:
dependencies:
moment "^2.29.1"
file-uri-to-path@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-2.0.0.tgz#7b415aeba227d575851e0a5b0c640d7656403fba"
integrity sha512-hjPFI8oE/2iQPVe4gbrJ73Pp+Xfub2+WI2LlXDbsaJBwT5wuMh35WNWVYYTpnz895shtwfyutMFLFywpQAFdLg==
file-url@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/file-url/-/file-url-2.0.2.tgz#e951784d79095127d3713029ab063f40818ca2ae"