Skip to content

Commit

Permalink
fix: bump graceful-fs and don't modify global (#258)
Browse files Browse the repository at this point in the history
* fix: bump graceful-fs and don't modify global

* Remove global monkeypatch

* Remove util.promisify in favor of fs.promises

* Bump react prop-types so that it works without a lockfile too
  • Loading branch information
styfle authored Jan 5, 2022
1 parent c6731e3 commit cf453a5
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 22 deletions.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"bindings": "^1.4.0",
"estree-walker": "2.0.2",
"glob": "^7.1.3",
"graceful-fs": "^4.1.15",
"graceful-fs": "^4.2.9",
"micromatch": "^4.0.2",
"mkdirp": "^0.5.1",
"node-gyp-build": "^4.2.2",
Expand All @@ -44,6 +44,7 @@
"@types/bindings": "^1.3.0",
"@types/estree": "^0.0.47",
"@types/glob": "^7.1.2",
"@types/graceful-fs": "^4.1.5",
"@types/micromatch": "^4.0.1",
"@types/node": "^14.14.37",
"analytics-node": "^3.4.0-beta.1",
Expand Down Expand Up @@ -103,8 +104,8 @@
"polyfill-library": "3.93.0",
"prismjs": "^1.25.0",
"pug": "^3.0.1",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"redis": "^3.1.1",
"remark-parse": "^10.0.0",
"remark-prism": "^1.3.6",
Expand Down
2 changes: 1 addition & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node

import { join, dirname } from 'path';
import { promises, statSync, lstatSync } from 'fs';
import { promises, statSync, lstatSync } from 'graceful-fs';
const { copyFile, mkdir } = promises;
const rimraf = require('rimraf');
import { nodeFileTrace } from './node-file-trace';
Expand Down
12 changes: 4 additions & 8 deletions src/node-file-trace.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import { NodeFileTraceOptions, NodeFileTraceResult, NodeFileTraceReasons, Stats } from './types';
import { basename, dirname, extname, relative, resolve, sep } from 'path';
import fs from 'fs';
import { promisify } from 'util'
import fs from 'graceful-fs';
import analyze, { AnalyzeResult } from './analyze';
import resolveDependency from './resolve-dependency';
import { isMatch } from 'micromatch';
import { sharedLibEmit } from './utils/sharedlib-emit';
import { join } from 'path';

const fsReadFile = promisify(fs.readFile)
const fsReadlink = promisify(fs.readlink)
const fsStat = promisify(fs.stat)

const { gracefulify } = require('graceful-fs');
gracefulify(fs);
const fsReadFile = fs.promises.readFile;
const fsReadlink = fs.promises.readlink;
const fsStat = fs.promises.stat;

function inPath (path: string, parent: string) {
const pathWithSep = join(parent, sep);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/binary-locators.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'path';
import fs from 'fs';
import fs from 'graceful-fs';

// pregyp
const versioning = require("node-pre-gyp/lib/util/versioning.js");
Expand Down
2 changes: 1 addition & 1 deletion src/utils/special-cases.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { resolve, dirname, relative } from 'path';
import resolveDependency from '../resolve-dependency';
import { getPackageName } from './get-package-base';
import { readFileSync } from 'fs';
import { readFileSync } from 'graceful-fs';
import { Job } from '../node-file-trace';
import { Ast } from './types';
type Node = Ast['body'][0]
Expand Down
1 change: 1 addition & 0 deletions test/unit/webpack-wrapper-strs-namespaces-large/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"node_modules/prop-types/factoryWithTypeCheckers.js",
"node_modules/prop-types/index.js",
"node_modules/prop-types/lib/ReactPropTypesSecret.js",
"node_modules/prop-types/lib/has.js",
"node_modules/prop-types/package.json",
"node_modules/react-is/cjs/react-is.development.js",
"node_modules/react-is/cjs/react-is.production.min.js",
Expand Down
21 changes: 13 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2145,7 +2145,7 @@
"@types/minimatch" "*"
"@types/node" "*"

"@types/graceful-fs@^4.1.2":
"@types/graceful-fs@^4.1.2", "@types/graceful-fs@^4.1.5":
version "4.1.5"
resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.5.tgz#21ffba0d98da4350db64891f92a9e5db3cdb4e15"
integrity sha512-anKkLmZZ+xm4p8JWBf4hElkM4XR+EZeA2M9BAkkTldmcyDY4mbdIJnRghDJH3Ov5ooY7/UAoENtmdMSkaAd7Cw==
Expand Down Expand Up @@ -7119,6 +7119,11 @@ graceful-fs@^4.1.10, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.6.tgz#ff040b2b0853b23c3d31027523706f1885d76bee"
integrity sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==

graceful-fs@^4.2.9:
version "4.2.9"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.9.tgz#041b05df45755e587a24942279b9d113146e1c96"
integrity sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==

graphql-extensions@^0.12.8:
version "0.12.8"
resolved "https://registry.yarnpkg.com/graphql-extensions/-/graphql-extensions-0.12.8.tgz#9cdc2c43d8fe5e0f6c3177a004ac011da2a8aa0f"
Expand Down Expand Up @@ -12672,13 +12677,13 @@ promzard@^0.3.0:
read "1"

prop-types@^15.6.2:
version "15.7.2"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5"
integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==
version "15.8.1"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5"
integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==
dependencies:
loose-envify "^1.4.0"
object-assign "^4.1.1"
react-is "^16.8.1"
react-is "^16.13.1"

proper-lockfile@^4.1.1:
version "4.1.2"
Expand Down Expand Up @@ -13139,7 +13144,7 @@ rdf-normalize@^1.0.0:
resolved "https://registry.yarnpkg.com/rdf-normalize/-/rdf-normalize-1.0.0.tgz#53496baf362cce9d9fca1f2216c6c30007f99cca"
integrity sha1-U0lrrzYszp2fyh8iFsbDAAf5nMo=

react-dom@^16.8.6:
react-dom@^16.14.0:
version "16.14.0"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.14.0.tgz#7ad838ec29a777fb3c75c3a190f661cf92ab8b89"
integrity sha512-1gCeQXDLoIqMgqD3IO2Ah9bnf0w9kzhwN5q4FGnHZ67hBm9yePzB5JJAIQCc8x3pFnNlwFq4RidZggNAAkzWWw==
Expand All @@ -13149,7 +13154,7 @@ react-dom@^16.8.6:
prop-types "^15.6.2"
scheduler "^0.19.1"

react-is@^16.8.1:
react-is@^16.13.1:
version "16.13.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
Expand All @@ -13159,7 +13164,7 @@ react-is@^17.0.1:
resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0"
integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==

react@^16.8.6:
react@^16.14.0:
version "16.14.0"
resolved "https://registry.yarnpkg.com/react/-/react-16.14.0.tgz#94d776ddd0aaa37da3eda8fc5b6b18a4c9a3114d"
integrity sha512-0X2CImDkJGApiAlcf0ODKIneSwBPhqJawOa5wCtKbu7ZECrmS26NvtSILynQ66cgkT/RJ4LidJOc3bUESwmU8g==
Expand Down

0 comments on commit cf453a5

Please sign in to comment.