mirror of
https://github.com/vale981/tridactyl
synced 2025-03-04 17:11:40 -05:00
Merge branch 'reorganize-directories'
This commit is contained in:
commit
3ec27fd40c
60 changed files with 260 additions and 259 deletions
28
package-lock.json
generated
28
package-lock.json
generated
|
@ -5046,14 +5046,12 @@
|
|||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
|
@ -5068,20 +5066,17 @@
|
|||
"code-point-at": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"console-control-strings": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
|
@ -5198,8 +5193,7 @@
|
|||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"ini": {
|
||||
"version": "1.3.5",
|
||||
|
@ -5211,7 +5205,6 @@
|
|||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"number-is-nan": "^1.0.0"
|
||||
}
|
||||
|
@ -5226,7 +5219,6 @@
|
|||
"version": "3.0.4",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
|
@ -5234,14 +5226,12 @@
|
|||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"minipass": {
|
||||
"version": "2.2.4",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"safe-buffer": "^5.1.1",
|
||||
"yallist": "^3.0.0"
|
||||
|
@ -5260,7 +5250,6 @@
|
|||
"version": "0.5.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
}
|
||||
|
@ -5341,8 +5330,7 @@
|
|||
"number-is-nan": {
|
||||
"version": "1.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"object-assign": {
|
||||
"version": "4.1.1",
|
||||
|
@ -5354,7 +5342,6 @@
|
|||
"version": "1.4.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
|
@ -5476,7 +5463,6 @@
|
|||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"code-point-at": "^1.0.0",
|
||||
"is-fullwidth-code-point": "^1.0.0",
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
},
|
||||
"jest": {
|
||||
"transform": {
|
||||
"^.+\\.tsx?$": "<rootDir>/node_modules/ts-jest/preprocessor.js"
|
||||
"^.+\\.tsx?$": "ts-jest"
|
||||
},
|
||||
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
|
||||
"moduleFileExtensions": [
|
||||
|
@ -58,7 +58,10 @@
|
|||
"js",
|
||||
"jsx",
|
||||
"json"
|
||||
]
|
||||
],
|
||||
"moduleNameMapper": {
|
||||
"@src/(.*)": "<rootDir>/src/$1"
|
||||
}
|
||||
},
|
||||
"author": "Colin Caine",
|
||||
"repository": {
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
/** Background script entry point. */
|
||||
|
||||
import * as BackgroundController from "./controller_background"
|
||||
import "./lib/browser_proxy_background"
|
||||
import * as BackgroundController from "@src/background/controller_background"
|
||||
import "@src/lib/browser_proxy_background"
|
||||
|
||||
// Add various useful modules to the window for debugging
|
||||
import * as messaging from "./messaging"
|
||||
import * as excmds from "./.excmds_background.generated"
|
||||
import * as commandline_background from "./commandline_background"
|
||||
import * as convert from "./convert"
|
||||
import * as config from "./config"
|
||||
import * as dom from "./dom"
|
||||
import * as download_background from "./download_background"
|
||||
import * as itertools from "./itertools"
|
||||
import * as keyseq from "./keyseq"
|
||||
import * as request from "./requests"
|
||||
import * as native from "./native_background"
|
||||
import state from "./state"
|
||||
import * as webext from "./lib/webext"
|
||||
import { AutoContain } from "./lib/autocontainers"
|
||||
import * as perf from "./perf"
|
||||
import { listenForCounters } from "./perf";
|
||||
window.tri = Object.assign(window.tri || Object.create(null), {
|
||||
import * as perf from "@src/perf"
|
||||
import { listenForCounters } from "@src/perf"
|
||||
import * as messaging from "@src/lib/messaging"
|
||||
import * as excmds from "@src/.excmds_background.generated"
|
||||
import * as commandline_background from "@src/background/commandline_background"
|
||||
import * as convert from "@src/lib/convert"
|
||||
import * as config from "@src/lib/config"
|
||||
import * as dom from "@src/lib/dom"
|
||||
import * as download_background from "@src/background/download_background"
|
||||
import * as itertools from "@src/lib/itertools"
|
||||
import * as keyseq from "@src/lib/keyseq"
|
||||
import * as request from "@src/lib/requests"
|
||||
import * as native from "@src/background/native_background"
|
||||
import state from "@src/state"
|
||||
import * as webext from "@src/lib/webext"
|
||||
import { AutoContain } from "@src/lib/autocontainers"
|
||||
;(window as any).tri = Object.assign(Object.create(null), {
|
||||
messaging,
|
||||
excmds,
|
||||
commandline_background,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { activeTabId } from "./lib/webext"
|
||||
import * as Messaging from "./messaging"
|
||||
import { activeTabId } from "@src/lib/webext"
|
||||
import * as Messaging from "@src/lib/messaging"
|
||||
|
||||
export type onLineCallback = (exStr: string) => void
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import * as Controller from "./controller_background"
|
||||
import * as Native from "./native_background"
|
||||
import Logger from "./logging"
|
||||
import * as Controller from "@src/background/controller_background"
|
||||
import * as Native from "@src/background/native_background"
|
||||
import Logger from "@src/lib/logging"
|
||||
const logger = new Logger("rc")
|
||||
|
||||
export async function source(filename = "auto") {
|
|
@ -1,7 +1,7 @@
|
|||
import { parser as exmode_parser } from "./parsers/exmode"
|
||||
import { repeat } from "./.excmds_background.generated"
|
||||
import { parser as exmode_parser } from "@src/parsers/exmode"
|
||||
import { repeat } from "@src/.excmds_background.generated"
|
||||
|
||||
import Logger from "./logging"
|
||||
import Logger from "@src/lib/logging"
|
||||
|
||||
const logger = new Logger("controller")
|
||||
|
||||
|
@ -27,7 +27,7 @@ export async function acceptExCmd(exstr: string): Promise<any> {
|
|||
}
|
||||
}
|
||||
|
||||
import * as Messaging from "./messaging"
|
||||
import * as Messaging from "@src/lib/messaging"
|
||||
|
||||
// Get messages from content
|
||||
Messaging.addListener(
|
|
@ -2,8 +2,8 @@
|
|||
* Background download-related functions
|
||||
*/
|
||||
|
||||
import { getDownloadFilenameForUrl } from "./url_util"
|
||||
import * as Native from "./native_background"
|
||||
import * as Native from "@src/background/native_background"
|
||||
import { getDownloadFilenameForUrl } from "@src/lib/url_util"
|
||||
|
||||
/** Construct an object URL string from a given data URL
|
||||
*
|
||||
|
@ -147,7 +147,7 @@ export async function downloadUrlAs(url: string, saveAs: string) {
|
|||
})
|
||||
}
|
||||
|
||||
import * as Messaging from "./messaging"
|
||||
import * as Messaging from "@src/lib/messaging"
|
||||
|
||||
// Get messages from content
|
||||
Messaging.addListener(
|
|
@ -3,10 +3,10 @@
|
|||
*/
|
||||
|
||||
import * as semverCompare from "semver-compare"
|
||||
import * as config from "./config"
|
||||
import { browserBg } from "./lib/webext"
|
||||
import * as config from "@src/lib/config"
|
||||
import { browserBg } from "@src/lib/webext"
|
||||
|
||||
import Logger from "./logging"
|
||||
import Logger from "@src/lib/logging"
|
||||
const logger = new Logger("native")
|
||||
|
||||
const NATIVE_NAME = "tridactyl"
|
|
@ -1,22 +1,23 @@
|
|||
/** Script used in the commandline iframe. Communicates with background. */
|
||||
|
||||
import "./lib/html-tagged-template"
|
||||
import * as perf from "@src/perf"
|
||||
import "@src/lib/number.clamp"
|
||||
import "@src/lib/html-tagged-template"
|
||||
import * as Completions from "@src/completions"
|
||||
import { BufferAllCompletionSource } from "@src/completions/BufferAll"
|
||||
import { BufferCompletionSource } from "@src/completions/Buffer"
|
||||
import { BmarkCompletionSource } from "@src/completions/Bmark"
|
||||
import { ExcmdCompletionSource } from "@src/completions/Excmd"
|
||||
import { HistoryCompletionSource } from "@src/completions/History"
|
||||
import { SettingsCompletionSource } from "@src/completions/Settings"
|
||||
import * as Messaging from "@src/lib/messaging"
|
||||
import * as Config from "@src/lib/config"
|
||||
import * as SELF from "@src/commandline_frame"
|
||||
import "@src/lib/number.clamp"
|
||||
import state from "@src/state"
|
||||
import Logger from "@src/lib/logging"
|
||||
import { theme } from "@src/content/styling"
|
||||
|
||||
import * as Completions from "./completions"
|
||||
import { BufferAllCompletionSource } from "./completions/BufferAll"
|
||||
import { BufferCompletionSource } from "./completions/Buffer"
|
||||
import { BmarkCompletionSource } from "./completions/Bmark"
|
||||
import { ExcmdCompletionSource } from "./completions/Excmd"
|
||||
import { HistoryCompletionSource } from "./completions/History"
|
||||
import { SettingsCompletionSource } from "./completions/Settings"
|
||||
import * as Messaging from "./messaging"
|
||||
import * as Config from "./config"
|
||||
import * as SELF from "./commandline_frame"
|
||||
import "./number.clamp"
|
||||
import state from "./state"
|
||||
import Logger from "./logging"
|
||||
import { theme } from "./styling"
|
||||
import * as perf from "./perf"
|
||||
const logger = new Logger("cmdline")
|
||||
|
||||
let activeCompletions: Completions.CompletionSource[] = undefined
|
||||
|
@ -388,7 +389,6 @@ export function getContent() {
|
|||
|
||||
Messaging.addListener("commandline_frame", Messaging.attributeCaller(SELF))
|
||||
|
||||
|
||||
// Listen for statistics from the commandline iframe and send them to
|
||||
// the background for collection. Attach the observer to the window
|
||||
// object since there's apparently a bug that causes performance
|
||||
|
|
|
@ -11,10 +11,10 @@ Concrete completion classes have been moved to src/completions/.
|
|||
*/
|
||||
|
||||
import * as Fuse from "fuse.js"
|
||||
import { enumerate } from "./itertools"
|
||||
import { toNumber } from "./convert"
|
||||
import * as config from "./config"
|
||||
import * as aliases from "./aliases"
|
||||
import { enumerate } from "@src/lib/itertools"
|
||||
import { toNumber } from "@src/lib/convert"
|
||||
import * as config from "@src/lib/config"
|
||||
import * as aliases from "@src/lib/aliases"
|
||||
|
||||
export const DEFAULT_FAVICON = browser.extension.getURL(
|
||||
"static/defaultFavicon.svg",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { browserBg } from "../lib/webext"
|
||||
import * as Completions from "../completions"
|
||||
import { browserBg } from "@src/lib/webext"
|
||||
import * as Completions from "@src/completions"
|
||||
|
||||
class BmarkCompletionOption extends Completions.CompletionOptionHTML
|
||||
implements Completions.CompletionOptionFuse {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { enumerate } from "../itertools"
|
||||
import * as Containers from "../lib/containers"
|
||||
import * as Messaging from "../messaging"
|
||||
import * as Completions from "../completions"
|
||||
import * as Perf from "../perf"
|
||||
import * as Perf from "@src/perf"
|
||||
import { enumerate } from "@src/lib/itertools"
|
||||
import * as Containers from "@src/lib/containers"
|
||||
import * as Messaging from "@src/lib/messaging"
|
||||
import * as Completions from "@src/completions"
|
||||
|
||||
class BufferCompletionOption extends Completions.CompletionOptionHTML
|
||||
implements Completions.CompletionOptionFuse {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { browserBg } from "../lib/webext"
|
||||
import * as Containers from "../lib/containers"
|
||||
import * as Messaging from "../messaging"
|
||||
import * as Completions from "../completions"
|
||||
import * as Perf from "../perf"
|
||||
import * as Perf from "@src/perf"
|
||||
import { browserBg } from "@src/lib/webext"
|
||||
import * as Containers from "@src/lib/containers"
|
||||
import * as Messaging from "@src/lib/messaging"
|
||||
import * as Completions from "@src/completions"
|
||||
|
||||
class BufferAllCompletionOption extends Completions.CompletionOptionHTML
|
||||
implements Completions.CompletionOptionFuse {
|
||||
|
@ -58,8 +58,8 @@ export class BufferAllCompletionSource extends Completions.CompletionSourceFuse
|
|||
*/
|
||||
private async getWindows() {
|
||||
const windows = await browserBg.windows.getAll()
|
||||
const response: {[windowId: number]: browser.windows.Window} = {}
|
||||
windows.forEach(win => response[win.id] = win)
|
||||
const response: { [windowId: number]: browser.windows.Window } = {}
|
||||
windows.forEach(win => (response[win.id] = win))
|
||||
return response
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import * as Completions from "../completions"
|
||||
import { typeToSimpleString } from "../metadata"
|
||||
import * as Metadata from "../.metadata.generated"
|
||||
import state from "../state"
|
||||
import * as config from "../config"
|
||||
import * as aliases from "../aliases"
|
||||
import * as Completions from "@src/completions"
|
||||
import { typeToSimpleString } from "@src/lib/metadata"
|
||||
import * as Metadata from "@src/.metadata.generated"
|
||||
import state from "@src/state"
|
||||
import * as config from "@src/lib/config"
|
||||
import * as aliases from "@src/lib/aliases"
|
||||
|
||||
class ExcmdCompletionOption extends Completions.CompletionOptionHTML
|
||||
implements Completions.CompletionOptionFuse {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import * as Completions from "../completions"
|
||||
import * as config from "../config"
|
||||
import { browserBg } from "../lib/webext"
|
||||
import * as Completions from "@src/completions"
|
||||
import * as config from "@src/lib/config"
|
||||
import { browserBg } from "@src/lib/webext"
|
||||
|
||||
class HistoryCompletionOption extends Completions.CompletionOptionHTML
|
||||
implements Completions.CompletionOptionFuse {
|
||||
|
@ -14,7 +14,7 @@ class HistoryCompletionOption extends Completions.CompletionOptionHTML
|
|||
|
||||
// Push properties we want to fuzmatch on
|
||||
this.fuseKeys.push(page.title, page.url) // weight by page.visitCount
|
||||
|
||||
|
||||
// Create HTMLElement
|
||||
// need to download favicon
|
||||
const favIconUrl = Completions.DEFAULT_FAVICON
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import * as Completions from "../completions"
|
||||
import * as config from "../config"
|
||||
import { browserBg } from "../lib/webext"
|
||||
import * as metadata from "../.metadata.generated"
|
||||
import { typeToString } from "../metadata"
|
||||
import * as Completions from "@src/completions"
|
||||
import * as config from "@src/lib/config"
|
||||
import { browserBg } from "@src/lib/webext"
|
||||
import * as metadata from "@src/.metadata.generated"
|
||||
import { typeToString } from "@src/lib/metadata"
|
||||
|
||||
class SettingsCompletionOption extends Completions.CompletionOptionHTML
|
||||
implements Completions.CompletionOptionFuse {
|
||||
|
|
|
@ -3,20 +3,23 @@
|
|||
// Be careful: typescript elides imports that appear not to be used if they're
|
||||
// assigned to a name. If you want an import just for its side effects, make
|
||||
// sure you import it like this:
|
||||
import "./lib/html-tagged-template"
|
||||
/* import "./commandline_content" */
|
||||
/* import "./excmds_content" */
|
||||
/* import "./hinting" */
|
||||
import * as Logging from "./logging"
|
||||
import "@src/lib/html-tagged-template"
|
||||
/* import "@src/content/commandline_content" */
|
||||
/* import "@src/excmds_content" */
|
||||
/* import "@src/content/hinting" */
|
||||
import * as Logging from "@src/lib/logging"
|
||||
const logger = new Logging.Logger("content")
|
||||
logger.debug("Tridactyl content script loaded, boss!")
|
||||
|
||||
// Our local state
|
||||
import { contentState, addContentStateChangedListener } from "./state_content"
|
||||
import {
|
||||
contentState,
|
||||
addContentStateChangedListener,
|
||||
} from "@src/content/state_content"
|
||||
|
||||
// Hook the keyboard up to the controller
|
||||
import * as ContentController from "./controller_content"
|
||||
import { getAllDocumentFrames } from "./dom"
|
||||
import * as ContentController from "@src/content/controller_content"
|
||||
import { getAllDocumentFrames } from "@src/lib/dom"
|
||||
window.addEventListener("keydown", ContentController.acceptKey, true)
|
||||
document.addEventListener("readystatechange", ev =>
|
||||
getAllDocumentFrames().map(frame => {
|
||||
|
@ -34,22 +37,22 @@ document.addEventListener("readystatechange", ev =>
|
|||
)
|
||||
|
||||
// Add various useful modules to the window for debugging
|
||||
import * as commandline_content from "./commandline_content"
|
||||
import * as convert from "./convert"
|
||||
import * as config from "./config"
|
||||
import * as dom from "./dom"
|
||||
import * as excmds from "./.excmds_content.generated"
|
||||
import * as hinting_content from "./hinting"
|
||||
import * as finding_content from "./finding"
|
||||
import * as itertools from "./itertools"
|
||||
import * as messaging from "./messaging"
|
||||
import state from "./state"
|
||||
import * as webext from "./lib/webext"
|
||||
import * as commandline_content from "@src/content/commandline_content"
|
||||
import * as convert from "@src/lib/convert"
|
||||
import * as config from "@src/lib/config"
|
||||
import * as dom from "@src/lib/dom"
|
||||
import * as excmds from "@src/.excmds_content.generated"
|
||||
import * as hinting_content from "@src/content/hinting"
|
||||
import * as finding_content from "@src/content/finding"
|
||||
import * as itertools from "@src/lib/itertools"
|
||||
import * as messaging from "@src/lib/messaging"
|
||||
import state from "@src/state"
|
||||
import * as webext from "@src/lib/webext"
|
||||
import Mark from "mark.js"
|
||||
import * as keyseq from "./keyseq"
|
||||
import * as native from "./native_background"
|
||||
import * as styling from "./styling"
|
||||
import * as perf from "./perf"
|
||||
import * as perf from "@src/perf"
|
||||
import * as keyseq from "@src/lib/keyseq"
|
||||
import * as native from "@src/background/native_background"
|
||||
import * as styling from "@src/content/styling"
|
||||
;(window as any).tri = Object.assign(Object.create(null), {
|
||||
browserBg: webext.browserBg,
|
||||
commandline_content,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/** Inject an input element into unsuspecting webpages and provide an API for interaction with tridactyl */
|
||||
|
||||
import Logger from "./logging"
|
||||
import * as config from "./config"
|
||||
import { theme } from "./styling"
|
||||
import Logger from "@src/lib/logging"
|
||||
import * as config from "@src/lib/config"
|
||||
import { theme } from "@src/content/styling"
|
||||
const logger = new Logger("messaging")
|
||||
const cmdline_logger = new Logger("cmdline")
|
||||
|
||||
|
@ -117,6 +117,6 @@ export function executeWithoutCommandLine(fn) {
|
|||
return result
|
||||
}
|
||||
|
||||
import * as Messaging from "./messaging"
|
||||
import * as SELF from "./commandline_content"
|
||||
import * as Messaging from "@src/lib/messaging"
|
||||
import * as SELF from "@src/content/commandline_content"
|
||||
Messaging.addListener("commandline_content", Messaging.attributeCaller(SELF))
|
|
@ -1,14 +1,14 @@
|
|||
import { isTextEditable } from "./dom"
|
||||
import { contentState, ModeName } from "./state_content"
|
||||
import { repeat } from "./.excmds_background.generated"
|
||||
import Logger from "./logging"
|
||||
import * as messaging from "./messaging"
|
||||
import { isTextEditable } from "@src/lib/dom"
|
||||
import { contentState, ModeName } from "@src/content/state_content"
|
||||
import { repeat } from "@src/.excmds_background.generated"
|
||||
import Logger from "@src/lib/logging"
|
||||
import * as messaging from "@src/lib/messaging"
|
||||
|
||||
import { parser as exmode_parser } from "./parsers/exmode"
|
||||
import * as hinting from "./hinting"
|
||||
import * as finding from "./finding"
|
||||
import * as gobblemode from "./parsers/gobblemode"
|
||||
import * as generic from "./parsers/genericmode"
|
||||
import { parser as exmode_parser } from "@src/parsers/exmode"
|
||||
import * as hinting from "@src/content/hinting"
|
||||
import * as finding from "@src/content/finding"
|
||||
import * as gobblemode from "@src/parsers/gobblemode"
|
||||
import * as generic from "@src/parsers/genericmode"
|
||||
|
||||
const logger = new Logger("controller")
|
||||
|
|
@ -10,12 +10,12 @@
|
|||
allow spaces
|
||||
*/
|
||||
|
||||
import * as DOM from "./dom"
|
||||
import { hasModifiers } from "./keyseq"
|
||||
import { contentState } from "./state_content"
|
||||
import { messageActiveTab, message } from "./messaging"
|
||||
import * as config from "./config"
|
||||
import Logger from "./logging"
|
||||
import * as DOM from "@src/lib/dom"
|
||||
import { hasModifiers } from "@src/lib/keyseq"
|
||||
import { contentState } from "@src/content/state_content"
|
||||
import { messageActiveTab, message } from "@src/lib/messaging"
|
||||
import * as config from "@src/lib/config"
|
||||
import Logger from "@src/lib/logging"
|
||||
import Mark from "mark.js"
|
||||
const logger = new Logger("finding")
|
||||
|
||||
|
@ -106,7 +106,7 @@ function mode(mode: "nav" | "search") {
|
|||
}
|
||||
}
|
||||
|
||||
import "./number.mod"
|
||||
import "@src/lib/number.mod"
|
||||
export function navigate(n: number = 1) {
|
||||
// also - really - should probably actually make this be an excmd
|
||||
// people will want to be able to scroll and stuff.
|
|
@ -10,22 +10,22 @@
|
|||
Redraw on reflow
|
||||
*/
|
||||
|
||||
import * as DOM from "./dom"
|
||||
import { log } from "./math"
|
||||
import * as DOM from "@src/lib/dom"
|
||||
import { log } from "@src/lib/math"
|
||||
import {
|
||||
permutationsWithReplacement,
|
||||
islice,
|
||||
izip,
|
||||
map,
|
||||
unique,
|
||||
} from "./itertools"
|
||||
import { hasModifiers } from "./keyseq"
|
||||
import { contentState } from "./state_content"
|
||||
import { messageActiveTab, message } from "./messaging"
|
||||
import * as config from "./config"
|
||||
import * as TTS from "./text_to_speech"
|
||||
import Logger from "./logging"
|
||||
import * as Messaging from "./messaging"
|
||||
} from "@src/lib/itertools"
|
||||
import { hasModifiers } from "@src/lib/keyseq"
|
||||
import { contentState } from "@src/content/state_content"
|
||||
import { messageActiveTab, message } from "@src/lib/messaging"
|
||||
import * as config from "@src/lib/config"
|
||||
import * as TTS from "@src/lib/text_to_speech"
|
||||
import Logger from "@src/lib/logging"
|
||||
import * as Messaging from "@src/lib/messaging"
|
||||
const logger = new Logger("hinting")
|
||||
|
||||
/** Simple container for the state of a single frame's hints. */
|
||||
|
@ -521,8 +521,8 @@ export function killables() {
|
|||
])
|
||||
}
|
||||
|
||||
import { openInNewTab, activeTabContainerId } from "./lib/webext"
|
||||
import { openInNewWindow } from "./lib/webext"
|
||||
import { openInNewTab, activeTabContainerId } from "@src/lib/webext"
|
||||
import { openInNewWindow } from "@src/lib/webext"
|
||||
|
||||
export function pipe(
|
||||
selectors = DOM.HINTTAGS_selectors,
|
|
@ -1,5 +1,5 @@
|
|||
import * as Native from "./native_background"
|
||||
import * as config from "./config"
|
||||
import * as Native from "@src/background/native_background"
|
||||
import * as config from "@src/lib/config"
|
||||
|
||||
type scrollingDirection = "scrollLeft" | "scrollTop"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import Logger from "./logging"
|
||||
import Logger from "@src/lib/logging"
|
||||
const logger = new Logger("state")
|
||||
|
||||
export type ModeName =
|
|
@ -1,6 +1,6 @@
|
|||
import { staticThemes } from "./.metadata.generated"
|
||||
import * as config from "./config"
|
||||
import * as Logging from "./logging"
|
||||
import { staticThemes } from "@src/.metadata.generated"
|
||||
import * as config from "@src/lib/config"
|
||||
import * as Logging from "@src/lib/logging"
|
||||
|
||||
const logger = new Logging.Logger("styling")
|
||||
|
|
@ -91,47 +91,47 @@
|
|||
// {{{ setup
|
||||
|
||||
// Shared
|
||||
import * as Messaging from "./messaging"
|
||||
import { browserBg, activeTabId, activeTabContainerId, openInNewTab, openInNewWindow } from "./lib/webext"
|
||||
import * as Container from "./lib/containers"
|
||||
import state from "./state"
|
||||
import { contentState, ModeName } from "./state_content"
|
||||
import * as UrlUtil from "./url_util"
|
||||
import * as config from "./config"
|
||||
import * as aliases from "./aliases"
|
||||
import * as Logging from "./logging"
|
||||
import * as Messaging from "@src/lib/messaging"
|
||||
import { browserBg, activeTabId, activeTabContainerId, openInNewTab, openInNewWindow } from "@src/lib/webext"
|
||||
import * as Container from "@src/lib/containers"
|
||||
import state from "@src/state"
|
||||
import { contentState, ModeName } from "@src/content/state_content"
|
||||
import * as UrlUtil from "@src/lib/url_util"
|
||||
import * as config from "@src/lib/config"
|
||||
import * as aliases from "@src/lib/aliases"
|
||||
import * as Logging from "@src/lib/logging"
|
||||
/** @hidden */
|
||||
const logger = new Logging.Logger("excmds")
|
||||
import Mark from "mark.js"
|
||||
import * as CSS from "css"
|
||||
import * as Metadata from "./.metadata.generated"
|
||||
import { fitsType, typeToString } from "./metadata"
|
||||
import * as Perf from "./perf"
|
||||
import * as Perf from "@src/perf"
|
||||
import * as Metadata from "@src/.metadata.generated"
|
||||
import { fitsType, typeToString } from "@src/lib/metadata"
|
||||
|
||||
//#content_helper
|
||||
// {
|
||||
import "./number.clamp"
|
||||
import * as SELF from "./.excmds_content.generated"
|
||||
import "@src/lib/number.clamp"
|
||||
import * as SELF from "@src/.excmds_content.generated"
|
||||
Messaging.addListener("excmd_content", Messaging.attributeCaller(SELF))
|
||||
import * as DOM from "./dom"
|
||||
import { executeWithoutCommandLine } from "./commandline_content"
|
||||
import * as scrolling from "./scrolling"
|
||||
import * as DOM from "@src/lib/dom"
|
||||
import { executeWithoutCommandLine } from "@src/content/commandline_content"
|
||||
import * as scrolling from "@src/content/scrolling"
|
||||
// }
|
||||
|
||||
//#background_helper
|
||||
// {
|
||||
/** Message excmds_content.ts in the active tab of the currentWindow */
|
||||
import { messageTab, messageActiveTab } from "./messaging"
|
||||
import { flatten } from "./itertools"
|
||||
import "./number.mod"
|
||||
import { activeTab, firefoxVersionAtLeast } from "./lib/webext"
|
||||
import * as CommandLineBackground from "./commandline_background"
|
||||
import * as rc from "./config_rc"
|
||||
import * as excmd_parser from "./parsers/exmode"
|
||||
import { mapstrToKeyseq } from "./keyseq"
|
||||
import { messageTab, messageActiveTab } from "@src/lib/messaging"
|
||||
import { flatten } from "@src/lib/itertools"
|
||||
import "@src/lib/number.mod"
|
||||
import { activeTab, firefoxVersionAtLeast } from "@src/lib/webext"
|
||||
import * as CommandLineBackground from "@src/background/commandline_background"
|
||||
import * as rc from "@src/background/config_rc"
|
||||
import * as excmd_parser from "@src/parsers/exmode"
|
||||
import { mapstrToKeyseq } from "@src/lib/keyseq"
|
||||
|
||||
//#background_helper
|
||||
import * as Native from "./native_background"
|
||||
import * as Native from "@src/background/native_background"
|
||||
|
||||
/** @hidden */
|
||||
export const cmd_params = new Map<string, Map<string, string>>()
|
||||
|
@ -673,7 +673,7 @@ export function im_backward_word() {
|
|||
}
|
||||
|
||||
//#background_helper
|
||||
import * as css_util from "./css_util"
|
||||
import * as css_util from "@src/lib/css_util"
|
||||
|
||||
/**
|
||||
* Like [[guiset]] but quieter.
|
||||
|
@ -1232,7 +1232,7 @@ export function scrollpage(n = 1) {
|
|||
}
|
||||
|
||||
//#content_helper
|
||||
import * as finding from "./finding"
|
||||
import * as finding from "@src/content/finding"
|
||||
|
||||
/** Start find mode. Work in progress.
|
||||
*
|
||||
|
@ -2562,7 +2562,7 @@ async function getnexttabs(tabid: number, n?: number) {
|
|||
// {{{ CMDLINE
|
||||
|
||||
//#background_helper
|
||||
import * as controller from "./controller_background"
|
||||
import * as controller from "@src/background/controller_background"
|
||||
|
||||
/** Repeats a `cmd` `n` times.
|
||||
Falls back to the last executed command if `cmd` doesn't exist.
|
||||
|
@ -3469,7 +3469,7 @@ export function unset(...keys: string[]) {
|
|||
// {{{ HINTMODE
|
||||
|
||||
//#content_helper
|
||||
import * as hinting from "./hinting"
|
||||
import * as hinting from "@src/content/hinting"
|
||||
|
||||
/** Hint a page.
|
||||
|
||||
|
@ -3806,7 +3806,7 @@ export function run_exstr(...commands: string[]) {
|
|||
// {{{ GOBBLE mode
|
||||
|
||||
//#content_helper
|
||||
import * as gobbleMode from "./parsers/gobblemode"
|
||||
import * as gobbleMode from "@src/parsers/gobblemode"
|
||||
|
||||
/** Initialize gobble mode.
|
||||
|
||||
|
@ -3823,7 +3823,7 @@ export async function gobble(nChars: number, endCmd: string) {
|
|||
|
||||
// {{{TEXT TO SPEECH
|
||||
|
||||
import * as TTS from "./text_to_speech"
|
||||
import * as TTS from "@src/lib/text_to_speech"
|
||||
|
||||
/**
|
||||
* Read text content of elements matching the given selector
|
||||
|
@ -3963,7 +3963,7 @@ export async function perfhistogram(...filters: string[]) {
|
|||
filterconfigs.push({ kind: "eventType", eventType: "measure" })
|
||||
const entries = window.tri.statsLogger.getEntries(...filterconfigs)
|
||||
if (entries.length == 0) {
|
||||
fillcmdline_tmp(3000, "perfhistogram: No samples found.");
|
||||
fillcmdline_tmp(3000, "perfhistogram: No samples found.")
|
||||
return
|
||||
}
|
||||
const histogram = Perf.renderStatsHistogram(entries)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// This file is only loaded in tridacyl's help pages
|
||||
|
||||
import * as config from "./config"
|
||||
import * as config from "@src/lib/config"
|
||||
|
||||
/** Create the element that should contain keybinding information */
|
||||
function initTridactylSettingElem(
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as config from "./config"
|
||||
import * as config from "@src/lib/config"
|
||||
|
||||
/**
|
||||
* Expands the alias in the provided exstr recursively. Does nothing if
|
|
@ -24,9 +24,9 @@
|
|||
|
||||
*/
|
||||
|
||||
import * as Config from "../config"
|
||||
import * as Container from "./containers"
|
||||
import * as Logging from "../logging"
|
||||
import * as Config from "@src/lib/config"
|
||||
import * as Container from "@src/lib/containers"
|
||||
import * as Logging from "@src/lib/logging"
|
||||
|
||||
const logger = new Logging.Logger("containers")
|
||||
|
||||
|
@ -76,7 +76,7 @@ export class AutoContain implements IAutoContain {
|
|||
if (Object.keys(aucons).length === 0) return { cancel: false }
|
||||
|
||||
// Do not handle private tabs or invalid tabIds.
|
||||
if (details.tabId === -1) return { cancel: false}
|
||||
if (details.tabId === -1) return { cancel: false }
|
||||
let tab = await browser.tabs.get(details.tabId)
|
||||
if (tab.incognito) return { cancel: false }
|
||||
|
||||
|
@ -115,7 +115,10 @@ export class AutoContain implements IAutoContain {
|
|||
} else {
|
||||
let cancel = false
|
||||
|
||||
if (this.cancelledRequests[tab.id].requestIds[details.requestId] || this.cancelledRequests[tab.id].urls[details.url]) {
|
||||
if (
|
||||
this.cancelledRequests[tab.id].requestIds[details.requestId] ||
|
||||
this.cancelledRequests[tab.id].urls[details.url]
|
||||
) {
|
||||
cancel = true
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { message } from "../messaging"
|
||||
import { message } from "@src/lib/messaging"
|
||||
|
||||
const browserProxy = new Proxy(Object.create(null), {
|
||||
get: function(target, api) {
|
||||
|
|
|
@ -4,7 +4,7 @@ function shim(api, func, args) {
|
|||
return browser[api][func](...args)
|
||||
}
|
||||
|
||||
import { addListener, attributeCaller, MessageType } from "../messaging"
|
||||
import { addListener, attributeCaller, MessageType } from "@src/lib/messaging"
|
||||
addListener(
|
||||
"browser_proxy_background" as MessageType,
|
||||
attributeCaller({ shim }),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { browserBg } from "./webext"
|
||||
import { browserBg } from "@src/lib/webext"
|
||||
import * as Fuse from "fuse.js"
|
||||
import * as Logging from "../logging"
|
||||
import * as Logging from "@src/lib/logging"
|
||||
const logger = new Logging.Logger("containers")
|
||||
|
||||
// As per Mozilla specification: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/contextualIdentities/ContextualIdentity
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import * as config from "./config"
|
||||
import { flatten } from "./itertools"
|
||||
import state from "./state"
|
||||
import * as Logging from "./logging"
|
||||
import { activeTabId, openInNewTab, activeTabContainerId } from "./lib/webext"
|
||||
import * as config from "@src/lib/config"
|
||||
import { flatten } from "@src/lib/itertools"
|
||||
import state from "@src/state"
|
||||
import * as Logging from "@src/lib/logging"
|
||||
import { activeTabId, openInNewTab, activeTabContainerId } from "@src/lib/webext"
|
||||
const logger = new Logging.Logger("dom")
|
||||
|
||||
// From saka-key lib/dom.js, under Apachev2
|
|
@ -1,4 +1,4 @@
|
|||
import "./number.mod"
|
||||
import "@src/lib/number.mod"
|
||||
|
||||
export function head(iter) {
|
||||
iter = iter[Symbol.iterator]()
|
|
@ -1,6 +1,6 @@
|
|||
import { testAll, testAllNoError, testAllObject } from "./test_utils"
|
||||
import * as ks from "./keyseq"
|
||||
import { mapstrToKeyseq as mks } from "./keyseq"
|
||||
import { testAll, testAllNoError, testAllObject } from "@src/lib/test_utils"
|
||||
import * as ks from "@src/lib/keyseq"
|
||||
import { mapstrToKeyseq as mks } from "@src/lib/keyseq"
|
||||
|
||||
function mk(k, mod?: ks.KeyModifiers) {
|
||||
return new ks.MinimalKey(k, mod)
|
|
@ -21,9 +21,9 @@
|
|||
*/
|
||||
|
||||
/** */
|
||||
import { find, filter, izip } from "./itertools"
|
||||
import { Parser } from "./nearley_utils"
|
||||
import * as bracketexpr_grammar from "./grammars/.bracketexpr.generated"
|
||||
import { find, filter, izip } from "@src/lib/itertools"
|
||||
import { Parser } from "@src/background/nearley_utils"
|
||||
import * as bracketexpr_grammar from "@src/grammars/.bracketexpr.generated"
|
||||
const bracketexpr_parser = new Parser(bracketexpr_grammar)
|
||||
|
||||
// {{{ General types
|
|
@ -2,7 +2,7 @@
|
|||
* Helper functions for logging
|
||||
*/
|
||||
|
||||
import * as Config from "./config"
|
||||
import * as Config from "@src/lib/config"
|
||||
|
||||
const LevelToNum = new Map<Config.LoggingLevel, number>()
|
||||
LevelToNum.set("never", 0)
|
|
@ -1,5 +1,5 @@
|
|||
import { browserBg, activeTabId, ownTabId } from "./lib/webext"
|
||||
import Logger from "./logging"
|
||||
import { browserBg, activeTabId, ownTabId } from "@src/lib/webext"
|
||||
import Logger from "@src/lib/logging"
|
||||
const logger = new Logger("messaging")
|
||||
|
||||
export type TabMessageType =
|
|
@ -1,6 +1,6 @@
|
|||
/** Some real tests for mod and also an example of how to unit test. */
|
||||
|
||||
import { euclid_mod, knuth_mod, my_mod } from "./number.mod"
|
||||
import { euclid_mod, knuth_mod, my_mod } from "@src/lib/number.mod"
|
||||
|
||||
expect.extend({
|
||||
/** Expect equal to all values in array */
|
|
@ -1,9 +1,9 @@
|
|||
import * as Messaging from "./messaging"
|
||||
import * as Container from "./lib/containers"
|
||||
import * as UrlUtil from "./url_util"
|
||||
import * as config from "./config"
|
||||
import * as Messaging from "@src/lib/messaging"
|
||||
import * as Container from "@src/lib/containers"
|
||||
import * as UrlUtil from "@src/lib/url_util"
|
||||
import * as config from "@src/lib/config"
|
||||
import * as csp from "csp-serdes"
|
||||
import Logger from "./logging"
|
||||
import Logger from "@src/lib/logging"
|
||||
|
||||
const logger = new Logger("requests")
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/** Functions to deal with text to speech in Tridactyl
|
||||
*/
|
||||
|
||||
import * as Config from "./config"
|
||||
import * as Config from "@src/lib/config"
|
||||
|
||||
/** Find the voice object for a voice name
|
||||
*
|
|
@ -1,6 +1,6 @@
|
|||
/** Some tests for URL utilities */
|
||||
|
||||
import * as UrlUtil from "./url_util"
|
||||
import * as UrlUtil from "@src/lib/url_util"
|
||||
|
||||
function test_increment() {
|
||||
let cases = [
|
|
@ -1,6 +1,6 @@
|
|||
import * as convert from "../convert"
|
||||
import browserProxy from "./browser_proxy"
|
||||
import * as config from "../config"
|
||||
import * as convert from "@src/lib/convert"
|
||||
import browserProxy from "@src/lib/browser_proxy"
|
||||
import * as config from "@src/lib/config"
|
||||
|
||||
export function inContentScript() {
|
||||
return getContext() == "content"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// This file is only included in newtab.html, after content.js has been loaded
|
||||
|
||||
import * as config from "./config"
|
||||
import * as config from "@src/lib/config"
|
||||
|
||||
// These functions work with the elements created by tridactyl/scripts/newtab.md.sh
|
||||
function getChangelogDiv() {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/** Ex Mode (AKA cmd mode) */
|
||||
|
||||
import * as ExCmds from "../.excmds_background.generated"
|
||||
import * as convert from "../convert"
|
||||
import * as Config from "../config"
|
||||
import * as aliases from "../aliases"
|
||||
import * as Logging from "../logging"
|
||||
import { enumerate, head, izip } from "../itertools"
|
||||
import * as ExCmds from "@src/.excmds_background.generated"
|
||||
import * as convert from "@src/lib/convert"
|
||||
import * as Config from "@src/lib/config"
|
||||
import * as aliases from "@src/lib/aliases"
|
||||
import * as Logging from "@src/lib/logging"
|
||||
import { enumerate, head, izip } from "@src/lib/itertools"
|
||||
const logger = new Logging.Logger("exmode")
|
||||
|
||||
/* Converts numbers, boolean, string[].
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** Tridactyl helper mode */
|
||||
|
||||
import * as config from "../config"
|
||||
import * as keyseq from "../keyseq"
|
||||
import * as config from "@src/lib/config"
|
||||
import * as keyseq from "@src/lib/keyseq"
|
||||
|
||||
export function parser(conf, keys): keyseq.ParserResponse {
|
||||
let maps: any = config.get(conf)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { contentState } from "../state_content"
|
||||
import { isSimpleKey } from "../keyseq"
|
||||
import { contentState } from "@src/content/state_content"
|
||||
import { isSimpleKey } from "@src/lib/keyseq"
|
||||
|
||||
/** Simple container for the gobble state. */
|
||||
class GobbleState {
|
||||
|
|
10
src/perf.ts
10
src/perf.ts
|
@ -17,11 +17,11 @@
|
|||
* 6. Use getEntries to retrieve data from the statsLogger.
|
||||
*/
|
||||
|
||||
import * as messaging from "./messaging"
|
||||
import * as config from "./config"
|
||||
import * as math from "./math"
|
||||
import * as itertools from "./itertools"
|
||||
import * as logging from "./logging"
|
||||
import * as messaging from "@src/lib/messaging"
|
||||
import * as config from "@src/lib/config"
|
||||
import * as math from "@src/lib/math"
|
||||
import * as itertools from "@src/lib/itertools"
|
||||
import * as logging from "@src/lib/logging"
|
||||
|
||||
const logger = new logging.Logger("performance")
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
If this turns out to be expensive there are improvements available.
|
||||
*/
|
||||
|
||||
import Logger from "./logging"
|
||||
import Logger from "@src/lib/logging"
|
||||
const logger = new Logger("state")
|
||||
|
||||
class State {
|
||||
|
|
|
@ -8,13 +8,17 @@
|
|||
"target": "ES2017",
|
||||
"lib": ["ES2017","dom", "dom.iterable"],
|
||||
"typeRoots": ["node_modules/@types", "node_modules/web-ext-types/"],
|
||||
"alwaysStrict": true,
|
||||
"experimentalDecorators": true,
|
||||
"alwaysStrict": true,
|
||||
"baseUrl": "src/",
|
||||
"paths": {
|
||||
"@src/*": ["*"]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"./src/**/*"
|
||||
],
|
||||
"exclude": [
|
||||
"./src/**/*.test.ts"
|
||||
"./src/**/*.test.ts"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
const { TsConfigPathsPlugin } = require("awesome-typescript-loader")
|
||||
const UglifyJSPlugin = require("uglifyjs-webpack-plugin")
|
||||
const CopyWebPackPlugin = require("copy-webpack-plugin")
|
||||
// const WebpackShellPlugin = require('webpack-shell-plugin')
|
||||
|
@ -22,6 +23,7 @@ module.exports = {
|
|||
resolve: {
|
||||
// Add '.ts' and '.tsx' as resolvable extensions.
|
||||
extensions: [".ts", ".tsx", ".js", ".json"],
|
||||
plugins: [new TsConfigPathsPlugin()],
|
||||
},
|
||||
|
||||
module: {
|
||||
|
|
Loading…
Add table
Reference in a new issue