Skip to content

Commit 6066606

Browse files
authored
integration: Remove lodash dependency (#1388)
1 parent 2232ef4 commit 6066606

File tree

4 files changed

+24
-10
lines changed

4 files changed

+24
-10
lines changed

.changeset/afraid-planets-mix.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@vanilla-extract/integration': patch
3+
---
4+
5+
Remove `lodash` dependency

packages/integration/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,12 @@
2222
"eval": "0.1.8",
2323
"find-up": "^5.0.0",
2424
"javascript-stringify": "^2.0.1",
25-
"lodash": "^4.17.21",
2625
"mlly": "^1.4.2",
2726
"outdent": "^0.8.0",
2827
"vite": "^5.0.11",
2928
"vite-node": "^1.2.0"
3029
},
3130
"devDependencies": {
32-
"@types/babel__core": "^7.20.5",
33-
"@types/lodash": "^4.14.168"
31+
"@types/babel__core": "^7.20.5"
3432
}
3533
}

packages/integration/src/processVanillaFile.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { FileScope, Adapter } from '@vanilla-extract/css';
22
import { transformCss } from '@vanilla-extract/css/transformCss';
33
import evalCode from 'eval';
44
import { stringify } from 'javascript-stringify';
5-
import isPlainObject from 'lodash/isPlainObject';
65
import outdent from 'outdent';
76

87
import { hash } from './hash';
@@ -11,6 +10,24 @@ import type { IdentifierOption } from './types';
1110

1211
const originalNodeEnv = process.env.NODE_ENV;
1312

13+
function isPlainObject(value: unknown) {
14+
if (typeof value !== 'object' || value === null) return false;
15+
16+
if (Object.prototype.toString.call(value) !== '[object Object]') return false;
17+
18+
const proto = Object.getPrototypeOf(value);
19+
if (proto === null) return true;
20+
21+
const Ctor =
22+
Object.prototype.hasOwnProperty.call(proto, 'constructor') &&
23+
proto.constructor;
24+
return (
25+
typeof Ctor === 'function' &&
26+
Ctor instanceof Ctor &&
27+
Function.prototype.call(Ctor) === Function.prototype.call(value)
28+
);
29+
}
30+
1431
export function stringifyFileScope({
1532
packageName,
1633
filePath,

pnpm-lock.yaml

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)