-
-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove old intances of browser/reload plugins
- Loading branch information
1 parent
9dd8ef3
commit 3c4b87f
Showing
14 changed files
with
664 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
{ | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/cezaraugusto/webpack-run-chromium-extension.git" | ||
}, | ||
"engines": { | ||
"node": ">=18" | ||
}, | ||
"name": "webpack-run-chromium-extension", | ||
"version": "1.3.0", | ||
"description": "Run your extension on any Chromium-based browser", | ||
"main": "./dist/module.js", | ||
"types": "./dist/module.d.ts", | ||
"author": { | ||
"name": "Cezar Augusto", | ||
"email": "boss@cezaraugusto.net", | ||
"url": "https://cezaraugusto.com" | ||
}, | ||
"scripts": { | ||
"clean": "rm -rf dist", | ||
"compile:plugin": "tsup-node ./module.ts ./loaders/* --format cjs --dts --target=node18 --minify && node ./copyExtensions.js", | ||
"compile:web": "tsup-node ./minimum-background-file.ts --format esm --dts --target=node18 --minify --config=tsconfig.web.json", | ||
"compile": "yarn compile:plugin && yarn compile:web", | ||
"lint": "eslint \"./**/*.ts*\"", | ||
"test": "echo \"Note: no test specified\" && exit 0", | ||
"test:fixture": "yarn --cwd=./fixtures/dev-server-no-hmr dev", | ||
"demo": "yarn test:fixture" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"keywords": [ | ||
"webpack", | ||
"plugin", | ||
"chromium", | ||
"run", | ||
"open", | ||
"plugin", | ||
"browser", | ||
"web", | ||
"extension", | ||
"web-ext", | ||
"webextension" | ||
], | ||
"peerDependencies": { | ||
"webpack": "^5.00.0" | ||
}, | ||
"dependencies": { | ||
"@colors/colors": "^1.6.0", | ||
"browser-extension-manifest-fields": "*", | ||
"chromium-location": "^1.2.1", | ||
"content-security-policy-parser": "^0.6.0", | ||
"loader-utils": "^3.3.1", | ||
"prefers-yarn": "^1.0.1", | ||
"progress": "^2.0.3", | ||
"schema-utils": "^4.2.0", | ||
"webpack-target-webextension": "^1.1.2", | ||
"ws": "^8.17.1" | ||
}, | ||
"devDependencies": { | ||
"@types/loader-utils": "^2.0.6", | ||
"copy-webpack-plugin": "^12.0.2", | ||
"eslint": "^8.56.0", | ||
"eslint-config-extension-create": "*", | ||
"html-webpack-plugin": "^5.6.0", | ||
"tsconfig": "*", | ||
"tsup": "^8.1.0", | ||
"webpack": "~5.92.0", | ||
"webpack-cli": "^5.1.4" | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
programs/develop/webpack/plugin-browsers/browser-lib/add-progress-bar.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// @ts-ignore | ||
import ProgressBar from 'progress'; | ||
|
||
export function addProgressBar(text: string, completionCallback: () => void) { | ||
const contentLength = 128 * 1024; | ||
const bar = new ProgressBar(`${text} [:bar] :percent :etas`, { | ||
complete: '=', | ||
incomplete: ' ', | ||
width: 50, | ||
total: contentLength, | ||
}); | ||
|
||
const timer = setInterval(() => { | ||
const chunk = Math.random() * 10 * 1024; | ||
bar.tick(chunk); | ||
|
||
if (bar.complete) { | ||
clearInterval(timer); | ||
completionCallback(); | ||
} | ||
}, 50); | ||
} |
29 changes: 29 additions & 0 deletions
29
programs/develop/webpack/plugin-browsers/browser-lib/messages.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { bold, bgWhite, red } from '@colors/colors/safe'; | ||
|
||
export function watchModeClosed(browser: string, code: number, reason: Buffer) { | ||
const message = reason.toString(); | ||
return ( | ||
`[😓] ${bgWhite(bold(` ${browser}-browser `))} ${red('✖︎✖︎✖︎')} Watch mode closed (code ${code}). ` + | ||
`${message && '\n\nReason ' + message + '\n'}Exiting...\n` | ||
); | ||
} | ||
|
||
export function browserNotFound(browser: string, binaryPath: string) { | ||
const capitalize = (str: string) => | ||
str.charAt(0).toUpperCase() + str.slice(1); | ||
return `${bgWhite(bold(` ${browser}-browser `))} ${red('✖︎✖︎✖︎')} ${capitalize(browser)} not found at ${binaryPath}`; | ||
} | ||
|
||
export function webSocketError(browser: string, error: any) { | ||
error( | ||
`[⛔️] ${bgWhite(bold(` ${browser}-browser `))} ${red('✖︎✖︎✖︎')} WebSocket error`, | ||
error, | ||
); | ||
} | ||
|
||
export function parseFileError(browser: string, error: any, filepath: string) { | ||
return ( | ||
`[⛔️] ${bgWhite(bold(` ${browser}-browser `))} ${red('✖︎✖︎✖︎')} ` + | ||
`Error parsing file: ${filepath}. Reason: ${error.message}` | ||
); | ||
} |
17 changes: 17 additions & 0 deletions
17
programs/develop/webpack/plugin-browsers/browser-lib/utils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { type Compilation } from 'webpack'; | ||
import { type Manifest } from '../../types'; | ||
|
||
export function getManifestContent( | ||
compilation: Compilation, | ||
manifestPath: string, | ||
): Manifest { | ||
if ( | ||
compilation.getAsset('manifest.json') || | ||
compilation.assets['manifest.json'] | ||
) { | ||
const manifest = compilation.assets['manifest.json'].source().toString(); | ||
return JSON.parse(manifest || '{}'); | ||
} | ||
|
||
return require(manifestPath); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.