@parcel/utils
Advanced tools
Comparing version 2.0.0-nightly.88 to 2.0.0-nightly.92
@@ -8,2 +8,4 @@ "use strict"; | ||
var _glob = require("./glob"); | ||
const path = require('path'); | ||
@@ -16,2 +18,3 @@ | ||
let parsed = path.parse(file); | ||
parsed.dir = findGlobRoot(parsed.dir); | ||
@@ -40,2 +43,16 @@ if (!cur) { | ||
return cur ? cur.dir : process.cwd(); | ||
} // Transforms a path like `packages/*/src/index.js` to the root of the glob, `packages/` | ||
function findGlobRoot(dir) { | ||
let parts = dir.split(path.sep); | ||
let last = parts.length; | ||
for (let i = parts.length - 1; i >= 0; i--) { | ||
if ((0, _glob.isGlob)(parts[i])) { | ||
last = i; | ||
} | ||
} | ||
return parts.slice(0, last).join(path.sep); | ||
} |
{ | ||
"name": "@parcel/utils", | ||
"version": "2.0.0-nightly.88+7f447bec", | ||
"version": "2.0.0-nightly.92+c0655c56", | ||
"description": "Blazing fast, zero configuration web application bundler", | ||
@@ -20,6 +20,6 @@ "license": "MIT", | ||
"@iarna/toml": "^2.2.0", | ||
"@parcel/codeframe": "2.0.0-nightly.88+7f447bec", | ||
"@parcel/diagnostic": "2.0.0-nightly.88+7f447bec", | ||
"@parcel/logger": "2.0.0-nightly.88+7f447bec", | ||
"@parcel/markdown-ansi": "2.0.0-nightly.88+7f447bec", | ||
"@parcel/codeframe": "2.0.0-nightly.92+c0655c56", | ||
"@parcel/diagnostic": "2.0.0-nightly.92+c0655c56", | ||
"@parcel/logger": "2.0.0-nightly.92+c0655c56", | ||
"@parcel/markdown-ansi": "2.0.0-nightly.92+c0655c56", | ||
"ansi-html": "^0.0.7", | ||
@@ -44,3 +44,3 @@ "chalk": "^2.4.2", | ||
}, | ||
"gitHead": "7f447bec1eaf6d16b64114658b0be67ae042bea5" | ||
"gitHead": "c0655c56f7973492fdb28671029ddd923f17a244" | ||
} |
// @flow strict-local | ||
import type {FilePath} from '@parcel/types'; | ||
import {isGlob} from './glob'; | ||
@@ -12,2 +13,3 @@ const path = require('path'); | ||
let parsed = path.parse(file); | ||
parsed.dir = findGlobRoot(parsed.dir); | ||
if (!cur) { | ||
@@ -35,1 +37,14 @@ cur = parsed; | ||
} | ||
// Transforms a path like `packages/*/src/index.js` to the root of the glob, `packages/` | ||
function findGlobRoot(dir: FilePath) { | ||
let parts = dir.split(path.sep); | ||
let last = parts.length; | ||
for (let i = parts.length - 1; i >= 0; i--) { | ||
if (isGlob(parts[i])) { | ||
last = i; | ||
} | ||
} | ||
return parts.slice(0, last).join(path.sep); | ||
} |
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
130352
4087