Skip to content

Commit

Permalink
refactor(node-resolve): remove deep-freeze from dependencies
Browse files Browse the repository at this point in the history
`deep-freeze` is licensed as Public Domain, which might be problematic for some 3rd parties such as the Angular CLI.

In Angular CLI we have a license validator that validates direct and transitive dependencies, and Public Domain is a problematic license becuse it falls under the "unencumbered' group which requires legal audit.

More context: https://opensource.google/docs/thirdparty/licenses/#unencumbered
  • Loading branch information
alan-agius4 committed Aug 5, 2020
1 parent b819a0f commit 54a3a52
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
1 change: 0 additions & 1 deletion packages/node-resolve/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
"@rollup/pluginutils": "^3.1.0",
"@types/resolve": "1.17.1",
"builtin-modules": "^3.1.0",
"deep-freeze": "^0.0.1",
"deepmerge": "^4.2.2",
"is-module": "^1.0.0",
"resolve": "^1.17.0"
Expand Down
12 changes: 11 additions & 1 deletion packages/node-resolve/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import { dirname, normalize, resolve, sep } from 'path';

import builtinList from 'builtin-modules';
import deepFreeze from 'deep-freeze';
import deepMerge from 'deepmerge';
import isModule from 'is-module';

Expand All @@ -19,6 +18,17 @@ import {
const builtins = new Set(builtinList);
const ES6_BROWSER_EMPTY = '\0node-resolve:empty.js';
const nullFn = () => null;
const deepFreeze = object => {
Object.freeze(object);

for (const value of Object.values(object)) {
if (typeof value === 'object' && !Object.isFrozen(value)) {
deepFreeze(value);
}
}

return object;
};
const defaults = {
customResolveOptions: {},
dedupe: [],
Expand Down
5 changes: 1 addition & 4 deletions pnpm-lock.yaml

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

0 comments on commit 54a3a52

Please sign in to comment.