@parcel/core
Advanced tools
Comparing version 2.0.0-nightly.247 to 2.0.0-nightly.248
@@ -92,2 +92,3 @@ "use strict"; | ||
}); | ||
let validatorResults = []; | ||
@@ -97,3 +98,3 @@ try { | ||
if (plugin.validateAll && this.dedicatedThread) { | ||
let validatorResults = await plugin.validateAll({ | ||
validatorResults = await plugin.validateAll({ | ||
assets: assets.map(asset => new _Asset.Asset(asset)), | ||
@@ -104,6 +105,2 @@ options: pluginOptions, | ||
}); | ||
for (let validatorResult of validatorResults) { | ||
this.handleResult(validatorResult); | ||
} | ||
} // Otherwise, pass the assets one-at-a-time | ||
@@ -129,5 +126,7 @@ else if (plugin.validate && !this.dedicatedThread) { | ||
}); | ||
this.handleResult(validatorResult); | ||
validatorResults.push(validatorResult); | ||
})); | ||
} | ||
this.handleResults(validatorResults); | ||
} catch (e) { | ||
@@ -164,19 +163,21 @@ throw new _diagnostic.default({ | ||
handleResult(validatorResult) { | ||
if (validatorResult) { | ||
let { | ||
warnings, | ||
errors | ||
} = validatorResult; | ||
if (errors.length > 0) { | ||
throw new _diagnostic.default({ | ||
diagnostic: errors | ||
}); | ||
handleResults(validatorResults) { | ||
let warnings = []; | ||
let errors = []; | ||
validatorResults.forEach(result => { | ||
if (result) { | ||
warnings.push(...result.warnings); | ||
errors.push(...result.errors); | ||
} | ||
}); | ||
if (warnings.length > 0) { | ||
_logger.default.warn(warnings); | ||
} | ||
if (errors.length > 0) { | ||
throw new _diagnostic.default({ | ||
diagnostic: errors | ||
}); | ||
} | ||
if (warnings.length > 0) { | ||
_logger.default.warn(warnings); | ||
} | ||
} | ||
@@ -183,0 +184,0 @@ |
{ | ||
"name": "@parcel/core", | ||
"version": "2.0.0-nightly.247+e63c77c8", | ||
"version": "2.0.0-nightly.248+d3e9d809", | ||
"license": "MIT", | ||
@@ -19,13 +19,13 @@ "publishConfig": { | ||
"dependencies": { | ||
"@parcel/cache": "2.0.0-nightly.249+e63c77c8", | ||
"@parcel/diagnostic": "2.0.0-nightly.249+e63c77c8", | ||
"@parcel/events": "2.0.0-nightly.249+e63c77c8", | ||
"@parcel/fs": "2.0.0-nightly.249+e63c77c8", | ||
"@parcel/logger": "2.0.0-nightly.249+e63c77c8", | ||
"@parcel/package-manager": "2.0.0-nightly.249+e63c77c8", | ||
"@parcel/plugin": "2.0.0-nightly.249+e63c77c8", | ||
"@parcel/cache": "2.0.0-nightly.250+d3e9d809", | ||
"@parcel/diagnostic": "2.0.0-nightly.250+d3e9d809", | ||
"@parcel/events": "2.0.0-nightly.250+d3e9d809", | ||
"@parcel/fs": "2.0.0-nightly.250+d3e9d809", | ||
"@parcel/logger": "2.0.0-nightly.250+d3e9d809", | ||
"@parcel/package-manager": "2.0.0-nightly.250+d3e9d809", | ||
"@parcel/plugin": "2.0.0-nightly.250+d3e9d809", | ||
"@parcel/source-map": "2.0.0-alpha.4.9", | ||
"@parcel/types": "2.0.0-nightly.249+e63c77c8", | ||
"@parcel/utils": "2.0.0-nightly.249+e63c77c8", | ||
"@parcel/workers": "2.0.0-nightly.249+e63c77c8", | ||
"@parcel/types": "2.0.0-nightly.250+d3e9d809", | ||
"@parcel/utils": "2.0.0-nightly.250+d3e9d809", | ||
"@parcel/workers": "2.0.0-nightly.250+d3e9d809", | ||
"abortcontroller-polyfill": "^1.1.9", | ||
@@ -46,3 +46,3 @@ "browserslist": "^4.6.6", | ||
}, | ||
"gitHead": "e63c77c800f95d64b835212632d1a9ed2db9f381" | ||
"gitHead": "d3e9d8093c0d5848d1a01469ffa9f0ff77b604e4" | ||
} |
@@ -11,2 +11,3 @@ // @flow strict-local | ||
import type {Validator, ValidateResult} from '@parcel/types'; | ||
import type {Diagnostic} from '@parcel/diagnostic'; | ||
@@ -77,6 +78,7 @@ import path from 'path'; | ||
let validatorLogger = new PluginLogger({origin: validatorName}); | ||
let validatorResults: Array<?ValidateResult> = []; | ||
try { | ||
// If the plugin supports the single-threading validateAll method, pass all assets to it. | ||
if (plugin.validateAll && this.dedicatedThread) { | ||
let validatorResults = await plugin.validateAll({ | ||
validatorResults = await plugin.validateAll({ | ||
assets: assets.map(asset => new Asset(asset)), | ||
@@ -95,5 +97,2 @@ options: pluginOptions, | ||
}); | ||
for (let validatorResult of validatorResults) { | ||
this.handleResult(validatorResult); | ||
} | ||
} | ||
@@ -126,6 +125,7 @@ | ||
}); | ||
this.handleResult(validatorResult); | ||
validatorResults.push(validatorResult); | ||
}), | ||
); | ||
} | ||
this.handleResults(validatorResults); | ||
} catch (e) { | ||
@@ -168,16 +168,21 @@ throw new ThrowableDiagnostic({ | ||
handleResult(validatorResult: ?ValidateResult) { | ||
if (validatorResult) { | ||
let {warnings, errors} = validatorResult; | ||
if (errors.length > 0) { | ||
throw new ThrowableDiagnostic({ | ||
diagnostic: errors, | ||
}); | ||
handleResults(validatorResults: Array<?ValidateResult>) { | ||
let warnings: Array<Diagnostic> = []; | ||
let errors: Array<Diagnostic> = []; | ||
validatorResults.forEach(result => { | ||
if (result) { | ||
warnings.push(...result.warnings); | ||
errors.push(...result.errors); | ||
} | ||
}); | ||
if (warnings.length > 0) { | ||
logger.warn(warnings); | ||
} | ||
if (errors.length > 0) { | ||
throw new ThrowableDiagnostic({ | ||
diagnostic: errors, | ||
}); | ||
} | ||
if (warnings.length > 0) { | ||
logger.warn(warnings); | ||
} | ||
} | ||
@@ -184,0 +189,0 @@ |
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
709355
20754