Skip to content

Commit

Permalink
chore: vendor proper-lockfile dependency
Browse files Browse the repository at this point in the history
This patch vendors the https://github.com/moxystudio/node-proper-lockfile
project we rely to manage Playwright Registry.

The reason to vender is the following upstream issue that
didn't get resolved in almost a month: moxystudio/node-proper-lockfile#111

Follow-up will apply the fix for the issue to the vendored file.

NOTE: this patch also inlines all code in a single file.

References microsoft#19418
  • Loading branch information
aslushnikov committed Jan 9, 2023
1 parent 7bbaf2a commit fe49e95
Show file tree
Hide file tree
Showing 7 changed files with 466 additions and 90 deletions.
35 changes: 4 additions & 31 deletions packages/playwright-core/ThirdPartyNotices.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ This project incorporates components from the projects listed below. The origina
- pend@1.2.0 (https://github.com/andrewrk/node-pend)
- pngjs@6.0.0 (https://github.com/lukeapage/pngjs)
- progress@2.0.3 (https://github.com/visionmedia/node-progress)
- proper-lockfile@4.1.2 (https://github.com/moxystudio/node-proper-lockfile)
- proxy-from-env@1.1.0 (https://github.com/Rob--W/proxy-from-env)
- pump@3.0.0 (https://github.com/mafintosh/pump)
- retry@0.12.0 (https://github.com/tim-kos/node-retry)
- retry@0.13.1 (https://github.com/tim-kos/node-retry)
- rimraf@3.0.2 (https://github.com/isaacs/rimraf)
- signal-exit@3.0.7 (https://github.com/tapjs/signal-exit)
- smart-buffer@4.2.0 (https://github.com/JoshGlazebrook/smart-buffer)
Expand Down Expand Up @@ -1166,32 +1165,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
=========================================
END OF progress@2.0.3 AND INFORMATION

%% proper-lockfile@4.1.2 NOTICES AND INFORMATION BEGIN HERE
=========================================
The MIT License (MIT)

Copyright (c) 2018 Made With MOXY Lda <hello@moxy.studio>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
=========================================
END OF proper-lockfile@4.1.2 AND INFORMATION

%% proxy-from-env@1.1.0 NOTICES AND INFORMATION BEGIN HERE
=========================================
The MIT License
Expand Down Expand Up @@ -1243,7 +1216,7 @@ THE SOFTWARE.
=========================================
END OF pump@3.0.0 AND INFORMATION

%% retry@0.12.0 NOTICES AND INFORMATION BEGIN HERE
%% retry@0.13.1 NOTICES AND INFORMATION BEGIN HERE
=========================================
Copyright (c) 2011:
Tim Koschützki (tim@debuggable.com)
Expand All @@ -1267,7 +1240,7 @@ Felix Geisendörfer (felix@debuggable.com)
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
=========================================
END OF retry@0.12.0 AND INFORMATION
END OF retry@0.13.1 AND INFORMATION

%% rimraf@3.0.2 NOTICES AND INFORMATION BEGIN HERE
=========================================
Expand Down Expand Up @@ -1641,6 +1614,6 @@ END OF yazl@2.5.1 AND INFORMATION

SUMMARY BEGIN HERE
=========================================
Total Packages: 46
Total Packages: 45
=========================================
END OF SUMMARY
100 changes: 48 additions & 52 deletions packages/playwright-core/bundles/utils/package-lock.json

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

8 changes: 6 additions & 2 deletions packages/playwright-core/bundles/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,33 @@
"commander": "8.3.0",
"debug": "^4.3.4",
"glob": "^7.1.3",
"graceful-fs": "^4.2.10",
"https-proxy-agent": "5.0.0",
"jpeg-js": "0.4.4",
"mime": "^3.0.0",
"minimatch": "^3.1.2",
"pngjs": "6.0.0",
"progress": "2.0.3",
"proper-lockfile": "4.1.2",
"proxy-from-env": "1.1.0",
"retry": "^0.13.1",
"rimraf": "^3.0.2",
"signal-exit": "^3.0.7",
"socks-proxy-agent": "6.1.1",
"stack-utils": "2.0.5",
"ws": "8.4.2"
},
"devDependencies": {
"@types/debug": "^4.1.7",
"@types/glob": "^7.2.0",
"@types/graceful-fs": "^4.1.6",
"@types/mime": "^2.0.3",
"@types/minimatch": "^3.0.5",
"@types/pngjs": "^6.0.1",
"@types/progress": "^2.0.5",
"@types/proper-lockfile": "^4.1.2",
"@types/proxy-from-env": "^1.0.1",
"@types/retry": "^0.12.2",
"@types/rimraf": "^3.0.2",
"@types/signal-exit": "^3.0.1",
"@types/stack-utils": "^2.0.1",
"@types/ws": "8.2.2"
}
Expand Down
10 changes: 8 additions & 2 deletions packages/playwright-core/bundles/utils/src/utilsBundleImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,14 @@ export { HttpsProxyAgent } from 'https-proxy-agent';
import jpegLibrary from 'jpeg-js';
export const jpegjs = jpegLibrary;

import lockfileLibrary from 'proper-lockfile';
export const lockfile = lockfileLibrary;
import gracefulfsLibrary from 'graceful-fs';
export const gracefulfs = gracefulfsLibrary;

import retryLibrary from 'retry';
export const retry = retryLibrary;

import signalExitLibrary from 'signal-exit';
export const signalExit = signalExitLibrary;

import mimeLibrary from 'mime';
export const mime = mimeLibrary;
Expand Down
4 changes: 2 additions & 2 deletions packages/playwright-core/src/server/registry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import * as os from 'os';
import path from 'path';
import * as util from 'util';
import * as fs from 'fs';
import { lockfile } from '../../utilsBundle';
import { getLinuxDistributionInfo } from '../../utils/linuxUtils';
import { fetchData } from '../../common/netUtils';
import { getEmbedderName } from '../../common/userAgent';
Expand All @@ -33,6 +32,7 @@ import { installDependenciesLinux, installDependenciesWindows, validateDependenc
import { downloadBrowserWithProgressBar, logPolitely } from './browserFetcher';
export { writeDockerVersion } from './dependencies';

const { lock } = require('../../third_party/lockfile.js');
const PACKAGE_PATH = path.join(__dirname, '..', '..', '..');
const BIN_PATH = path.join(__dirname, '..', '..', '..', 'bin');

Expand Down Expand Up @@ -689,7 +689,7 @@ export class Registry {

let releaseLock;
try {
releaseLock = await lockfile.lock(registryDirectory, {
releaseLock = await lock(registryDirectory, {
retries: {
// Retry 20 times during 10 minutes with
// exponential back-off.
Expand Down

0 comments on commit fe49e95

Please sign in to comment.