Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove and update dependencies as in upstream #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14,784 changes: 3,901 additions & 10,883 deletions package-lock.json

Large diffs are not rendered by default.

46 changes: 22 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,59 +49,57 @@
"opera"
],
"dependencies": {
"@babel/runtime": "7.24.7",
"@devicefarmer/adbkit": "3.2.6",
"bunyan": "1.8.15",
"chrome-launcher": "1.1.0",
"@babel/runtime": "7.26.0",
"@devicefarmer/adbkit": "3.3.8",
"chrome-launcher": "1.1.2",
"debounce": "1.2.1",
"es6-error": "4.1.1",
"firefox-profile": "4.6.0",
"fs-extra": "11.2.0",
"firefox-profile": "4.7.0",
"fx-runner": "1.4.0",
"mkdirp": "3.0.1",
"multimatch": "6.0.0",
"mz": "2.7.0",
"node-notifier": "10.0.1",
"parse-json": "7.1.1",
"pino": "9.4.0",
"promise-toolbox": "0.21.0",
"set-value": "4.1.0",
"source-map-support": "0.5.21",
"strip-bom": "5.0.0",
"strip-json-comments": "5.0.1",
"tmp": "0.2.3",
"update-notifier": "6.0.2",
"watchpack": "2.4.1",
"update-notifier": "7.3.1",
"watchpack": "2.4.2",
"ws": "8.18.0",
"zip-dir": "2.0.0"
},
"devDependencies": {
"@babel/cli": "7.24.7",
"@babel/core": "7.24.7",
"@babel/eslint-parser": "7.24.7",
"@babel/preset-env": "7.24.7",
"@babel/register": "7.24.6",
"@commitlint/cli": "19.3.0",
"@commitlint/config-conventional": "19.2.2",
"babel-plugin-istanbul": "6.1.1",
"@babel/cli": "7.26.4",
"@babel/core": "7.26.0",
"@babel/eslint-parser": "7.25.9",
"@babel/preset-env": "7.26.0",
"@babel/register": "7.25.9",
"@commitlint/cli": "19.6.1",
"@commitlint/config-conventional": "19.6.0",
"babel-plugin-istanbul": "7.0.0",
"babel-plugin-transform-inline-environment-variables": "0.4.4",
"chai": "4.3.10",
"chai": "5.1.2",
"chai-as-promised": "8.0.0",
"copy-dir": "1.3.0",
"crc-32": "1.2.2",
"cross-env": "7.0.3",
"deepcopy": "2.1.0",
"eslint": "8.57.0",
"eslint-plugin-async-await": "0.0.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-import": "2.31.0",
"fs-extra": "11.2.0",
"git-rev-sync": "3.0.2",
"html-entities": "2.5.2",
"mocha": "10.6.0",
"nyc": "17.0.0",
"prettier": "3.3.2",
"mocha": "11.0.1",
"nyc": "17.1.0",
"prettier": "3.4.2",
"pretty-quick": "4.0.0",
"prettyjson": "1.2.5",
"shelljs": "0.8.5",
"sinon": "18.0.0",
"sinon": "19.0.2",
"testdouble": "3.20.2",
"yauzl": "2.10.0"
},
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/build.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'path';
import { createWriteStream } from 'fs';
import fs from 'fs/promises';

import { fs } from 'mz';
import parseJSON from 'parse-json';
import stripBom from 'strip-bom';
import defaultFromEvent from 'promise-toolbox/fromEvent';
Expand Down
7 changes: 5 additions & 2 deletions src/cmd/run.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { fs } from 'mz';
import path from 'path';
import fs from 'fs/promises';
import nodeFs from 'fs';

import defaultBuildExtension from './build.js';
import { showDesktopNotification as defaultDesktopNotifications } from '../util/desktop-notifier.js';
Expand Down Expand Up @@ -63,6 +65,7 @@ export default async function run(
getValidatedManifest = defaultGetValidatedManifest,
} = {},
) {
sourceDir = path.resolve(sourceDir);
log.info(`Running web extension from ${sourceDir}`);
if (preInstall) {
log.info(
Expand Down Expand Up @@ -99,7 +102,7 @@ export default async function run(
'--firefox-profile or --chromium-profile',
);
}
const isDir = fs.existsSync(profileDir);
const isDir = nodeFs.existsSync(profileDir);
if (isDir) {
log.info(`Profile directory ${profileDir} already exists`);
} else {
Expand Down
10 changes: 5 additions & 5 deletions src/extension-runners/chromium.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
* in a Chromium-based browser instance.
*/

import fs from 'fs/promises';
import path from 'path';

import fs from 'fs-extra';
import { mkdirp as asyncMkdirp } from 'mkdirp';
import {
Launcher as ChromeLauncher,
launch as defaultChromiumLaunch,
Expand Down Expand Up @@ -190,12 +189,13 @@ export class ChromiumExtensionRunner {

if (userDataDir && profileDirName) {
// copy profile dir to this temp user data dir.
await fs.copy(
await fs.cp(
path.join(userDataDir, profileDirName),
path.join(tmpDirPath, profileDirName),
{ recursive: true },
);
} else if (userDataDir) {
await fs.copy(userDataDir, tmpDirPath);
await fs.cp(userDataDir, tmpDirPath, { recursive: true });
}
userDataDir = tmpDirPath;
}
Expand Down Expand Up @@ -292,7 +292,7 @@ export class ChromiumExtensionRunner {

log.debug(`Creating reload-manager-extension in ${extPath}`);

await asyncMkdirp(extPath);
await fs.mkdir(extPath, { recursive: true });

await fs.writeFile(
path.join(extPath, 'manifest.json'),
Expand Down
2 changes: 1 addition & 1 deletion src/firefox/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import nodeFs from 'fs';
import path from 'path';
import { promisify } from 'util';
import fs from 'fs/promises';

import { default as defaultFxRunner } from 'fx-runner';
import FirefoxProfile from 'firefox-profile';
import { fs } from 'mz';
import fromEvent from 'promise-toolbox/fromEvent';

import isDirectory from '../util/is-directory.js';
Expand Down
7 changes: 3 additions & 4 deletions src/util/artifacts.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { fs } from 'mz';
import { mkdirp as defaultAsyncMkdirp } from 'mkdirp';
import fs from 'fs/promises';

import { UsageError, isErrorWithCode } from '../errors.js';
import { createLogger } from './logger.js';
Expand All @@ -11,7 +10,7 @@ const defaultAsyncFsAccess = fs.access.bind(fs);
export async function prepareArtifactsDir(
artifactsDir,
{
asyncMkdirp = defaultAsyncMkdirp,
asyncMkdirp = (dirPath) => fs.mkdir(dirPath, { recursive: true }),
asyncFsAccess = defaultAsyncFsAccess,
} = {},
) {
Expand All @@ -24,7 +23,7 @@ export async function prepareArtifactsDir(
}
// If the artifactsDir already exists, check that we have the write permissions on it.
try {
await asyncFsAccess(artifactsDir, fs.W_OK);
await asyncFsAccess(artifactsDir, fs.constants.W_OK);
} catch (accessErr) {
if (isErrorWithCode('EACCES', accessErr)) {
throw new UsageError(
Expand Down
2 changes: 1 addition & 1 deletion src/util/file-exists.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fs } from 'mz';
import fs from 'fs/promises';

import { isErrorWithCode } from '../errors.js';

Expand Down
2 changes: 1 addition & 1 deletion src/util/is-directory.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fs } from 'mz';
import fs from 'fs/promises';

import { onlyErrorsWithCode } from '../errors.js';

Expand Down
48 changes: 21 additions & 27 deletions src/util/logger.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { fileURLToPath } from 'url';

import bunyan, {
nameFromLevel,
createLogger as defaultLogCreator,
} from 'bunyan';
import pino, { levels as logLevels } from 'pino';

export class ConsoleStream {
verbose;
Expand All @@ -17,21 +14,24 @@ export class ConsoleStream {
}

format({ name, msg, level }) {
const prefix = this.verbose ? `[${name}][${nameFromLevel[level]}] ` : '';
const prefix = this.verbose ? `[${name}][${logLevels.labels[level]}] ` : '';
return `${prefix}${msg}\n`;
}

makeVerbose() {
this.verbose = true;
}

write(packet, { localProcess = process } = {}) {
const thisLevel = this.verbose ? bunyan.TRACE : bunyan.INFO;
write(jsonString, { localProcess = process } = {}) {
const packet = JSON.parse(jsonString);
const thisLevel = this.verbose
? logLevels.values.trace
: logLevels.values.info;
if (packet.level >= thisLevel) {
const msg = this.format(packet);
if (this.isCapturing) {
this.capturedMessages.push(msg);
} else if (packet.level > bunyan.INFO) {
} else if (packet.level > logLevels.values.info) {
localProcess.stderr.write(msg);
} else {
localProcess.stdout.write(msg);
Expand Down Expand Up @@ -60,23 +60,17 @@ export const consoleStream = new ConsoleStream();

// createLogger types and implementation.

export function createLogger(
moduleURL,
{ createBunyanLog = defaultLogCreator } = {},
) {
return createBunyanLog({
// Strip the leading src/ from file names (which is in all file names) to
// make the name less redundant.
name: moduleURL
? fileURLToPath(moduleURL).replace(/^src\//, '')
: 'unknown-module',
// Capture all log levels and let the stream filter them.
level: bunyan.TRACE,
streams: [
{
type: 'raw',
stream: consoleStream,
},
],
});
export function createLogger(moduleURL, { createPinoLog = pino } = {}) {
return createPinoLog(
{
// Strip the leading src/ from file names (which is in all file names) to
// make the name less redundant.
name: moduleURL
? fileURLToPath(moduleURL).replace(/^src\//, '')
: 'unknown-module',
// Capture all log levels and let the stream filter them.
level: logLevels.values.trace,
},
consoleStream,
);
}
2 changes: 1 addition & 1 deletion src/util/manifest.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'path';
import fs from 'fs/promises';

import { fs } from 'mz';
import parseJSON from 'parse-json';
import stripBom from 'strip-bom';
import stripJsonComments from 'strip-json-comments';
Expand Down
5 changes: 3 additions & 2 deletions src/watcher.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { fs } from 'mz';
import { existsSync, lstatSync } from 'fs';

import Watchpack from 'watchpack';
import debounce from 'debounce';

Expand Down Expand Up @@ -46,7 +47,7 @@ export default function onSourceChange({

if (watchFile) {
for (const filePath of watchFile) {
if (fs.existsSync(filePath) && !fs.lstatSync(filePath).isFile()) {
if (existsSync(filePath) && !lstatSync(filePath).isFile()) {
throw new UsageError(
'Invalid --watch-file value: ' + `"${filePath}" is not a file.`,
);
Expand Down
10 changes: 5 additions & 5 deletions tests/functional/test.cli.run.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import path from 'path';
import { writeFileSync } from 'fs';

import { describe, it } from 'mocha';
import { assert } from 'chai';
import { fs } from 'mz';

import {
minimalAddonPath,
Expand All @@ -29,10 +29,10 @@ describe('web-ext run', () => {
);
const watchIgnoredFile = path.join(srcDir, 'ignoredFile3.txt');

fs.writeFileSync(watchedFile, '');
watchedFilesArr.forEach((file) => fs.writeFileSync(file, ''));
watchIgnoredArr.forEach((file) => fs.writeFileSync(file, ''));
fs.writeFileSync(watchIgnoredFile, '');
writeFileSync(watchedFile, '');
watchedFilesArr.forEach((file) => writeFileSync(file, ''));
watchIgnoredArr.forEach((file) => writeFileSync(file, ''));
writeFileSync(watchIgnoredFile, '');

const argv = [
'run',
Expand Down
4 changes: 2 additions & 2 deletions tests/setup.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import chai from 'chai';
import { use as chaiUse } from 'chai';
import chaiAsPromised from 'chai-as-promised';

// Enable chai-as-promised plugin.
chai.use(chaiAsPromised);
chaiUse(chaiAsPromised);
11 changes: 6 additions & 5 deletions tests/unit/test-cmd/test.build.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import path from 'path';
import fs from 'fs/promises';
import { writeFileSync } from 'fs';

import { fs } from 'mz';
import { it, describe } from 'mocha';
import { assert } from 'chai';
import * as sinon from 'sinon';
Expand Down Expand Up @@ -192,7 +193,7 @@ describe('build', () => {
it('handles repeating localization keys', () => {
return withTempDir((tmpDir) => {
const messageFileName = path.join(tmpDir.path(), 'messages.json');
fs.writeFileSync(
writeFileSync(
messageFileName,
`{"extensionName": {
"message": "example extension",
Expand Down Expand Up @@ -233,7 +234,7 @@ describe('build', () => {
it('handles comments in messages.json', () => {
return withTempDir((tmpDir) => {
const messageFileName = path.join(tmpDir.path(), 'messages.json');
fs.writeFileSync(
writeFileSync(
messageFileName,
`{"extensionName": {
"message": "example extension", // comments
Expand All @@ -257,7 +258,7 @@ describe('build', () => {
it('checks locale file for malformed json', () => {
return withTempDir((tmpDir) => {
const messageFileName = path.join(tmpDir.path(), 'messages.json');
fs.writeFileSync(messageFileName, '{"simulated:" "json syntax error"');
writeFileSync(messageFileName, '{"simulated:" "json syntax error"');

return getDefaultLocalizedName({
messageFile: messageFileName,
Expand Down Expand Up @@ -285,7 +286,7 @@ describe('build', () => {
return withTempDir((tmpDir) => {
const messageFileName = path.join(tmpDir.path(), 'messages.json');
//This is missing the 'message' key
fs.writeFileSync(
writeFileSync(
messageFileName,
`{"extensionName": {
"description": "example extension"
Expand Down
Loading