@vanilla-extract/integration
Advanced tools
Comparing version 1.0.0 to 1.0.1
# @vanilla-extract/integration | ||
## 1.0.1 | ||
### Patch Changes | ||
- [#176](https://github.com/seek-oss/vanilla-extract/pull/176) [`cbfe0de`](https://github.com/seek-oss/vanilla-extract/commit/cbfe0def098dcf820fb710388cdc82b48436bdca) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Continue searching for package.json if one is found with no name | ||
## 1.0.0 | ||
@@ -4,0 +10,0 @@ |
@@ -167,2 +167,20 @@ 'use strict'; | ||
function getClosestPackageInfo(directory) { | ||
const packageJsonPath = findUp__default['default'].sync('package.json', { | ||
cwd: directory | ||
}); | ||
if (packageJsonPath) { | ||
const { | ||
name | ||
} = require(packageJsonPath); | ||
return { | ||
name, | ||
path: packageJsonPath, | ||
dirname: path__default['default'].dirname(packageJsonPath) | ||
}; | ||
} | ||
} | ||
const packageInfoCache = new Map(); | ||
@@ -177,19 +195,12 @@ function getPackageInfo(cwd) { | ||
const packageJsonPath = findUp__default['default'].sync('package.json', { | ||
cwd: resolvedCwd | ||
}); | ||
let packageInfo = getClosestPackageInfo(resolvedCwd); | ||
if (!packageJsonPath) { | ||
throw new Error(`Can't find package.json`); | ||
while (packageInfo && !packageInfo.name) { | ||
packageInfo = getClosestPackageInfo(path__default['default'].resolve(packageInfo.dirname, '..')); | ||
} | ||
const { | ||
name | ||
} = require(packageJsonPath); | ||
if (!packageInfo || !packageInfo.name) { | ||
throw new Error(`Couldn't find parent package.json with a name field from '${resolvedCwd}'`); | ||
} | ||
const packageInfo = { | ||
name, | ||
path: packageJsonPath, | ||
dirname: path__default['default'].dirname(packageJsonPath) | ||
}; | ||
packageInfoCache.set(resolvedCwd, packageInfo); | ||
@@ -196,0 +207,0 @@ return packageInfo; |
@@ -167,2 +167,20 @@ 'use strict'; | ||
function getClosestPackageInfo(directory) { | ||
const packageJsonPath = findUp__default['default'].sync('package.json', { | ||
cwd: directory | ||
}); | ||
if (packageJsonPath) { | ||
const { | ||
name | ||
} = require(packageJsonPath); | ||
return { | ||
name, | ||
path: packageJsonPath, | ||
dirname: path__default['default'].dirname(packageJsonPath) | ||
}; | ||
} | ||
} | ||
const packageInfoCache = new Map(); | ||
@@ -177,19 +195,12 @@ function getPackageInfo(cwd) { | ||
const packageJsonPath = findUp__default['default'].sync('package.json', { | ||
cwd: resolvedCwd | ||
}); | ||
let packageInfo = getClosestPackageInfo(resolvedCwd); | ||
if (!packageJsonPath) { | ||
throw new Error(`Can't find package.json`); | ||
while (packageInfo && !packageInfo.name) { | ||
packageInfo = getClosestPackageInfo(path__default['default'].resolve(packageInfo.dirname, '..')); | ||
} | ||
const { | ||
name | ||
} = require(packageJsonPath); | ||
if (!packageInfo || !packageInfo.name) { | ||
throw new Error(`Couldn't find parent package.json with a name field from '${resolvedCwd}'`); | ||
} | ||
const packageInfo = { | ||
name, | ||
path: packageJsonPath, | ||
dirname: path__default['default'].dirname(packageJsonPath) | ||
}; | ||
packageInfoCache.set(resolvedCwd, packageInfo); | ||
@@ -196,0 +207,0 @@ return packageInfo; |
@@ -154,2 +154,20 @@ import { setAdapter } from '@vanilla-extract/css/adapter'; | ||
function getClosestPackageInfo(directory) { | ||
const packageJsonPath = findUp.sync('package.json', { | ||
cwd: directory | ||
}); | ||
if (packageJsonPath) { | ||
const { | ||
name | ||
} = require(packageJsonPath); | ||
return { | ||
name, | ||
path: packageJsonPath, | ||
dirname: path.dirname(packageJsonPath) | ||
}; | ||
} | ||
} | ||
const packageInfoCache = new Map(); | ||
@@ -164,19 +182,12 @@ function getPackageInfo(cwd) { | ||
const packageJsonPath = findUp.sync('package.json', { | ||
cwd: resolvedCwd | ||
}); | ||
let packageInfo = getClosestPackageInfo(resolvedCwd); | ||
if (!packageJsonPath) { | ||
throw new Error(`Can't find package.json`); | ||
while (packageInfo && !packageInfo.name) { | ||
packageInfo = getClosestPackageInfo(path.resolve(packageInfo.dirname, '..')); | ||
} | ||
const { | ||
name | ||
} = require(packageJsonPath); | ||
if (!packageInfo || !packageInfo.name) { | ||
throw new Error(`Couldn't find parent package.json with a name field from '${resolvedCwd}'`); | ||
} | ||
const packageInfo = { | ||
name, | ||
path: packageJsonPath, | ||
dirname: path.dirname(packageJsonPath) | ||
}; | ||
packageInfoCache.set(resolvedCwd, packageInfo); | ||
@@ -183,0 +194,0 @@ return packageInfo; |
{ | ||
"name": "@vanilla-extract/integration", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Zero-runtime Stylesheets-in-TypeScript", | ||
@@ -5,0 +5,0 @@ "main": "dist/vanilla-extract-integration.cjs.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31770
747