@parcel/core
Advanced tools
Comparing version 2.0.0-nightly.165 to 2.0.0-nightly.171
@@ -34,2 +34,6 @@ "use strict"; | ||
var _Validation = _interopRequireDefault(require("./Validation")); | ||
var _ReporterRunner = require("./ReporterRunner"); | ||
var _dumpGraphToGraphViz = _interopRequireDefault(require("./dumpGraphToGraphViz")); | ||
@@ -265,7 +269,19 @@ | ||
async validate() { | ||
let promises = this.assetRequests.map(request => this.runValidate({ | ||
request, | ||
let trackedRequestsDesc = this.assetRequests.filter(request => this.requestTracker.isTracked(request.id)).map(({ | ||
request | ||
}) => request); // Schedule validations on workers for all plugins that implement the one-asset-at-a-time "validate" method. | ||
let promises = trackedRequestsDesc.map(request => this.runValidate({ | ||
requests: [request], | ||
optionsRef: this.optionsRef, | ||
configRef: this.configRef | ||
})); | ||
})); // Schedule validations on the main thread for all validation plugins that implement "validateAll". | ||
promises.push(new _Validation.default({ | ||
requests: trackedRequestsDesc, | ||
options: this.options, | ||
config: this.config, | ||
report: _ReporterRunner.report, | ||
dedicatedThread: true | ||
}).run()); | ||
this.assetRequests = []; | ||
@@ -302,3 +318,3 @@ await Promise.all(promises); | ||
{ | ||
this.assetRequests.push(request.request); | ||
this.assetRequests.push(request); | ||
let result = await this.assetRequestRunner.runRequest(request.request, runOpts); | ||
@@ -305,0 +321,0 @@ |
@@ -67,3 +67,3 @@ "use strict"; | ||
content, | ||
map, | ||
mapBuffer, | ||
ast, | ||
@@ -78,3 +78,3 @@ idBase | ||
_defineProperty(this, "map", void 0); | ||
_defineProperty(this, "mapBuffer", void 0); | ||
@@ -88,3 +88,3 @@ _defineProperty(this, "ast", void 0); | ||
this.content = content || ''; | ||
this.map = map; | ||
this.mapBuffer = mapBuffer; | ||
this.ast = ast; | ||
@@ -119,3 +119,4 @@ this.idBase = idBase; | ||
hash.update(buf); | ||
}))), this.map == null ? Promise.resolve() : this.options.cache.set(this.getCacheKey('map' + pipelineKey), this.map)]); | ||
}))), this.mapBuffer == null ? Promise.resolve() : this.options.cache.setBlob(this.getCacheKey('map' + pipelineKey), // $FlowFixMe strange that this occurs | ||
this.mapBuffer)]); | ||
this.value.contentKey = contentKey; | ||
@@ -174,12 +175,27 @@ this.value.mapKey = mapKey; | ||
async getMapBuffer() { | ||
if (!this.mapBuffer && this.value.mapKey != null) { | ||
this.mapBuffer = await this.options.cache.getBlob(this.value.mapKey); | ||
} | ||
return this.mapBuffer; | ||
} | ||
async getMap() { | ||
if (this.value.mapKey != null) { | ||
this.map = await this.options.cache.get(this.value.mapKey); | ||
if (!this.mapBuffer) { | ||
await this.getMapBuffer(); | ||
} | ||
return this.map; | ||
if (this.mapBuffer) { | ||
// Get sourcemap from flatbuffer | ||
let map = new _sourceMap.default(); | ||
map.addBufferMappings(this.mapBuffer); | ||
return map; | ||
} | ||
} | ||
setMap(map) { | ||
this.map = map; | ||
if (map) { | ||
this.mapBuffer = map.toBuffer(); | ||
} | ||
} | ||
@@ -271,3 +287,3 @@ | ||
ast: result.ast, | ||
map: result.map, | ||
mapBuffer: result.map ? result.map.toBuffer() : null, | ||
idBase: this.idBase | ||
@@ -274,0 +290,0 @@ }); |
@@ -149,2 +149,6 @@ "use strict"; | ||
getMapBuffer() { | ||
return _classPrivateFieldGet(this, _asset).getMapBuffer(); | ||
} | ||
} | ||
@@ -219,3 +223,3 @@ | ||
setMap(map) { | ||
_classPrivateFieldGet(this, _asset3).map = map; | ||
_classPrivateFieldGet(this, _asset3).setMap(map); | ||
} | ||
@@ -222,0 +226,0 @@ |
@@ -514,3 +514,3 @@ "use strict"; | ||
ast: result.ast, | ||
map: internalAsset.map, | ||
mapBuffer: internalAsset.mapBuffer, | ||
// $FlowFixMe | ||
@@ -517,0 +517,0 @@ dependencies: [...internalAsset.value.dependencies.values()], |
@@ -38,10 +38,15 @@ "use strict"; | ||
constructor({ | ||
request, | ||
config, | ||
dedicatedThread, | ||
options, | ||
requests, | ||
report, | ||
options, | ||
config, | ||
workerApi | ||
}) { | ||
_defineProperty(this, "request", void 0); | ||
_defineProperty(this, "allAssets", {}); | ||
_defineProperty(this, "allValidators", {}); | ||
_defineProperty(this, "dedicatedThread", void 0); | ||
_defineProperty(this, "configRequests", void 0); | ||
@@ -51,12 +56,14 @@ | ||
_defineProperty(this, "impactfulOptions", void 0); | ||
_defineProperty(this, "options", void 0); | ||
_defineProperty(this, "impactfulOptions", void 0); | ||
_defineProperty(this, "parcelConfig", void 0); | ||
_defineProperty(this, "report", void 0); | ||
_defineProperty(this, "requests", void 0); | ||
_defineProperty(this, "workerApi", void 0); | ||
_defineProperty(this, "parcelConfig", void 0); | ||
this.configLoader = new _ConfigLoader.default({ | ||
@@ -66,6 +73,7 @@ options, | ||
}); | ||
this.dedicatedThread = dedicatedThread !== null && dedicatedThread !== void 0 ? dedicatedThread : false; | ||
this.options = options; | ||
this.parcelConfig = config; | ||
this.options = options; | ||
this.report = report; | ||
this.request = request; | ||
this.requests = requests; | ||
this.workerApi = workerApi; | ||
@@ -75,59 +83,100 @@ } | ||
async run() { | ||
this.report({ | ||
type: 'validation', | ||
filePath: this.request.filePath | ||
}); | ||
let asset = await this.loadAsset(); | ||
let validators = await this.parcelConfig.getValidators(this.request.filePath); | ||
let pluginOptions = new _PluginOptions.default(this.options); | ||
await this.buildAssetsAndValidators(); | ||
await Promise.all(Object.keys(this.allValidators).map(async validatorName => { | ||
let assets = this.allAssets[validatorName]; | ||
for (let validator of validators) { | ||
let validatorLogger = new _logger.PluginLogger({ | ||
origin: validator.name | ||
}); | ||
if (assets) { | ||
let plugin = this.allValidators[validatorName]; | ||
let validatorLogger = new _logger.PluginLogger({ | ||
origin: validatorName | ||
}); | ||
try { | ||
let config = null; | ||
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({ | ||
assets: assets.map(asset => new _Asset.Asset(asset)), | ||
options: pluginOptions, | ||
logger: validatorLogger, | ||
resolveConfigWithPath: (configNames, assetFilePath) => (0, _utils.resolveConfig)(this.options.inputFS, assetFilePath, configNames) | ||
}); | ||
if (validator.plugin.getConfig) { | ||
config = await validator.plugin.getConfig({ | ||
asset: new _Asset.Asset(asset), | ||
options: pluginOptions, | ||
logger: validatorLogger, | ||
resolveConfig: configNames => (0, _utils.resolveConfig)(this.options.inputFS, asset.value.filePath, configNames) | ||
for (let validatorResult of validatorResults) { | ||
this.handleResult(validatorResult); | ||
} | ||
} // Otherwise, pass the assets one-at-a-time | ||
else if (plugin.validate && !this.dedicatedThread) { | ||
await Promise.all(assets.map(async asset => { | ||
let config = null; | ||
if (plugin.getConfig) { | ||
config = await plugin.getConfig({ | ||
asset: new _Asset.Asset(asset), | ||
options: pluginOptions, | ||
logger: validatorLogger, | ||
resolveConfig: configNames => (0, _utils.resolveConfig)(this.options.inputFS, asset.value.filePath, configNames) | ||
}); | ||
} | ||
let validatorResult = await plugin.validate({ | ||
asset: new _Asset.Asset(asset), | ||
options: pluginOptions, | ||
config, | ||
logger: validatorLogger | ||
}); | ||
this.handleResult(validatorResult); | ||
})); | ||
} | ||
} catch (e) { | ||
throw new _diagnostic.default({ | ||
diagnostic: (0, _diagnostic.errorToDiagnostic)(e, validatorName) | ||
}); | ||
} | ||
} | ||
})); | ||
} | ||
let validatorResult = await validator.plugin.validate({ | ||
asset: new _Asset.Asset(asset), | ||
options: pluginOptions, | ||
config, | ||
logger: validatorLogger | ||
}); | ||
async buildAssetsAndValidators() { | ||
// Figure out what validators need to be run, and group the assets by the relevant validators. | ||
await Promise.all(this.requests.map(async request => { | ||
this.report({ | ||
type: 'validation', | ||
filePath: request.filePath | ||
}); | ||
let asset = await this.loadAsset(request); | ||
let validators = await this.parcelConfig.getValidators(request.filePath); | ||
if (validatorResult) { | ||
let { | ||
warnings, | ||
errors | ||
} = validatorResult; | ||
for (let validator of validators) { | ||
this.allValidators[validator.name] = validator.plugin; | ||
if (errors.length > 0) { | ||
throw new _diagnostic.default({ | ||
diagnostic: errors | ||
}); | ||
} | ||
if (this.allAssets[validator.name]) { | ||
this.allAssets[validator.name].push(asset); | ||
} else { | ||
this.allAssets[validator.name] = [asset]; | ||
} | ||
} | ||
})); | ||
} | ||
if (warnings.length > 0) { | ||
_logger.default.warn(warnings); | ||
} | ||
} | ||
} catch (e) { | ||
handleResult(validatorResult) { | ||
if (validatorResult) { | ||
let { | ||
warnings, | ||
errors | ||
} = validatorResult; | ||
if (errors.length > 0) { | ||
throw new _diagnostic.default({ | ||
diagnostic: (0, _diagnostic.errorToDiagnostic)(e, validator.name) | ||
diagnostic: errors | ||
}); | ||
} | ||
if (warnings.length > 0) { | ||
_logger.default.warn(warnings); | ||
} | ||
} | ||
} | ||
async loadAsset() { | ||
async loadAsset(request) { | ||
let { | ||
@@ -138,3 +187,3 @@ filePath, | ||
sideEffects | ||
} = this.request; | ||
} = request; | ||
let { | ||
@@ -145,3 +194,3 @@ content, | ||
isSource | ||
} = await (0, _summarizeRequest.default)(this.options.inputFS, this.request); // If the transformer request passed code rather than a filename, | ||
} = await (0, _summarizeRequest.default)(this.options.inputFS, request); // If the transformer request passed code rather than a filename, | ||
// use a hash as the base for the id to ensure it is unique. | ||
@@ -148,0 +197,0 @@ |
{ | ||
"name": "@parcel/core", | ||
"version": "2.0.0-nightly.165+b9e4105c", | ||
"version": "2.0.0-nightly.171+bac3f05f", | ||
"license": "MIT", | ||
@@ -19,13 +19,13 @@ "publishConfig": { | ||
"dependencies": { | ||
"@parcel/cache": "2.0.0-nightly.167+b9e4105c", | ||
"@parcel/diagnostic": "2.0.0-nightly.167+b9e4105c", | ||
"@parcel/events": "2.0.0-nightly.167+b9e4105c", | ||
"@parcel/fs": "2.0.0-nightly.167+b9e4105c", | ||
"@parcel/logger": "2.0.0-nightly.167+b9e4105c", | ||
"@parcel/package-manager": "2.0.0-nightly.167+b9e4105c", | ||
"@parcel/plugin": "2.0.0-nightly.167+b9e4105c", | ||
"@parcel/source-map": "2.0.0-nightly.167+b9e4105c", | ||
"@parcel/types": "2.0.0-nightly.167+b9e4105c", | ||
"@parcel/utils": "2.0.0-nightly.167+b9e4105c", | ||
"@parcel/workers": "2.0.0-nightly.167+b9e4105c", | ||
"@parcel/cache": "2.0.0-nightly.173+bac3f05f", | ||
"@parcel/diagnostic": "2.0.0-nightly.173+bac3f05f", | ||
"@parcel/events": "2.0.0-nightly.173+bac3f05f", | ||
"@parcel/fs": "2.0.0-nightly.173+bac3f05f", | ||
"@parcel/logger": "2.0.0-nightly.173+bac3f05f", | ||
"@parcel/package-manager": "2.0.0-nightly.173+bac3f05f", | ||
"@parcel/plugin": "2.0.0-nightly.173+bac3f05f", | ||
"@parcel/source-map": "^2.0.0-alpha.4.3", | ||
"@parcel/types": "2.0.0-nightly.173+bac3f05f", | ||
"@parcel/utils": "2.0.0-nightly.173+bac3f05f", | ||
"@parcel/workers": "2.0.0-nightly.173+bac3f05f", | ||
"abortcontroller-polyfill": "^1.1.9", | ||
@@ -46,3 +46,3 @@ "browserslist": "^4.6.6", | ||
}, | ||
"gitHead": "b9e4105c50576ed22a99860e08e65491d4659a43" | ||
"gitHead": "bac3f05fa31574338f14ab9cd2c9bd78fb1c22ee" | ||
} |
@@ -37,2 +37,5 @@ // @flow strict-local | ||
import Validation from './Validation'; | ||
import {report} from './ReporterRunner'; | ||
import dumpToGraphViz from './dumpGraphToGraphViz'; | ||
@@ -70,3 +73,3 @@ | ||
configRequestRunner: ParcelConfigRequestRunner; | ||
assetRequests: Array<AssetRequestDesc>; | ||
assetRequests: Array<AssetRequest>; | ||
runValidate: ValidationOpts => Promise<void>; | ||
@@ -254,5 +257,10 @@ queue: PromiseQueue<mixed>; | ||
async validate(): Promise<void> { | ||
let promises = this.assetRequests.map(request => | ||
let trackedRequestsDesc = this.assetRequests | ||
.filter(request => this.requestTracker.isTracked(request.id)) | ||
.map(({request}) => request); | ||
// Schedule validations on workers for all plugins that implement the one-asset-at-a-time "validate" method. | ||
let promises = trackedRequestsDesc.map(request => | ||
this.runValidate({ | ||
request, | ||
requests: [request], | ||
optionsRef: this.optionsRef, | ||
@@ -262,2 +270,14 @@ configRef: this.configRef, | ||
); | ||
// Schedule validations on the main thread for all validation plugins that implement "validateAll". | ||
promises.push( | ||
new Validation({ | ||
requests: trackedRequestsDesc, | ||
options: this.options, | ||
config: this.config, | ||
report, | ||
dedicatedThread: true, | ||
}).run(), | ||
); | ||
this.assetRequests = []; | ||
@@ -289,3 +309,3 @@ await Promise.all(promises); | ||
case 'asset_request': { | ||
this.assetRequests.push(request.request); | ||
this.assetRequests.push(request); | ||
let result = await this.assetRequestRunner.runRequest( | ||
@@ -292,0 +312,0 @@ request.request, |
@@ -92,3 +92,3 @@ // @flow strict-local | ||
content?: Blob, | ||
map?: ?SourceMap, | ||
mapBuffer?: ?Buffer, | ||
ast?: ?AST, | ||
@@ -102,3 +102,3 @@ idBase?: ?string, | ||
content: Blob; | ||
map: ?SourceMap; | ||
mapBuffer: ?Buffer; | ||
ast: ?AST; | ||
@@ -111,3 +111,3 @@ idBase: ?string; | ||
content, | ||
map, | ||
mapBuffer, | ||
ast, | ||
@@ -119,3 +119,3 @@ idBase, | ||
this.content = content || ''; | ||
this.map = map; | ||
this.mapBuffer = mapBuffer; | ||
this.ast = ast; | ||
@@ -160,7 +160,8 @@ this.idBase = idBase; | ||
), | ||
this.map == null | ||
this.mapBuffer == null | ||
? Promise.resolve() | ||
: this.options.cache.set( | ||
: this.options.cache.setBlob( | ||
this.getCacheKey('map' + pipelineKey), | ||
this.map, | ||
// $FlowFixMe strange that this occurs | ||
this.mapBuffer, | ||
), | ||
@@ -221,12 +222,27 @@ ]); | ||
async getMapBuffer(): Promise<?Buffer> { | ||
if (!this.mapBuffer && this.value.mapKey != null) { | ||
this.mapBuffer = await this.options.cache.getBlob(this.value.mapKey); | ||
} | ||
return this.mapBuffer; | ||
} | ||
async getMap(): Promise<?SourceMap> { | ||
if (this.value.mapKey != null) { | ||
this.map = await this.options.cache.get(this.value.mapKey); | ||
if (!this.mapBuffer) { | ||
await this.getMapBuffer(); | ||
} | ||
return this.map; | ||
if (this.mapBuffer) { | ||
// Get sourcemap from flatbuffer | ||
let map = new SourceMap(); | ||
map.addBufferMappings(this.mapBuffer); | ||
return map; | ||
} | ||
} | ||
setMap(map: ?SourceMap): void { | ||
this.map = map; | ||
if (map) { | ||
this.mapBuffer = map.toBuffer(); | ||
} | ||
} | ||
@@ -321,3 +337,3 @@ | ||
ast: result.ast, | ||
map: result.map, | ||
mapBuffer: result.map ? result.map.toBuffer() : null, | ||
idBase: this.idBase, | ||
@@ -324,0 +340,0 @@ }); |
@@ -159,2 +159,6 @@ // @flow strict-local | ||
} | ||
getMapBuffer(): Promise<?Buffer> { | ||
return this.#asset.getMapBuffer(); | ||
} | ||
} | ||
@@ -208,3 +212,3 @@ | ||
setMap(map: ?SourceMap): void { | ||
this.#asset.map = map; | ||
this.#asset.setMap(map); | ||
} | ||
@@ -211,0 +215,0 @@ |
@@ -609,3 +609,3 @@ // @flow strict-local | ||
ast: result.ast, | ||
map: internalAsset.map, | ||
mapBuffer: internalAsset.mapBuffer, | ||
// $FlowFixMe | ||
@@ -612,0 +612,0 @@ dependencies: [...internalAsset.value.dependencies.values()], |
@@ -355,3 +355,3 @@ // @flow strict-local | ||
export type ValidationOpts = {| | ||
request: AssetRequestDesc, | ||
requests: AssetRequestDesc[], | ||
optionsRef: number, | ||
@@ -358,0 +358,0 @@ configRef: number, |
@@ -10,2 +10,3 @@ // @flow strict-local | ||
} from './types'; | ||
import type {Validator, ValidateResult} from '@parcel/types'; | ||
@@ -24,25 +25,41 @@ import path from 'path'; | ||
export type ValidationOpts = {| | ||
config: ParcelConfig, | ||
/** | ||
* If true, this Validation instance will run all validators that implement the single-threaded "validateAll" method. | ||
* If falsy, it will run validators that implement the one-asset-at-a-time "validate" method. | ||
*/ | ||
dedicatedThread?: boolean, | ||
options: ParcelOptions, | ||
config: ParcelConfig, | ||
request: AssetRequestDesc, | ||
requests: AssetRequestDesc[], | ||
report: ReportFn, | ||
workerApi: WorkerApi, | ||
workerApi?: WorkerApi, | ||
|}; | ||
export default class Validation { | ||
request: AssetRequestDesc; | ||
allAssets: {[validatorName: string]: InternalAsset[], ...} = {}; | ||
allValidators: {[validatorName: string]: Validator, ...} = {}; | ||
dedicatedThread: boolean; | ||
configRequests: Array<ConfigRequestDesc>; | ||
configLoader: ConfigLoader; | ||
impactfulOptions: $Shape<ParcelOptions>; | ||
options: ParcelOptions; | ||
impactfulOptions: $Shape<ParcelOptions>; | ||
parcelConfig: ParcelConfig; | ||
report: ReportFn; | ||
workerApi: WorkerApi; | ||
parcelConfig: ParcelConfig; | ||
requests: AssetRequestDesc[]; | ||
workerApi: ?WorkerApi; | ||
constructor({request, report, options, config, workerApi}: ValidationOpts) { | ||
constructor({ | ||
config, | ||
dedicatedThread, | ||
options, | ||
requests, | ||
report, | ||
workerApi, | ||
}: ValidationOpts) { | ||
this.configLoader = new ConfigLoader({options, config}); | ||
this.dedicatedThread = dedicatedThread ?? false; | ||
this.options = options; | ||
this.parcelConfig = config; | ||
this.options = options; | ||
this.report = report; | ||
this.request = request; | ||
this.requests = requests; | ||
this.workerApi = workerApi; | ||
@@ -52,65 +69,119 @@ } | ||
async run(): Promise<void> { | ||
this.report({ | ||
type: 'validation', | ||
filePath: this.request.filePath, | ||
}); | ||
let pluginOptions = new PluginOptions(this.options); | ||
await this.buildAssetsAndValidators(); | ||
await Promise.all( | ||
Object.keys(this.allValidators).map(async validatorName => { | ||
let assets = this.allAssets[validatorName]; | ||
if (assets) { | ||
let plugin = this.allValidators[validatorName]; | ||
let validatorLogger = new PluginLogger({origin: validatorName}); | ||
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({ | ||
assets: assets.map(asset => new Asset(asset)), | ||
options: pluginOptions, | ||
logger: validatorLogger, | ||
resolveConfigWithPath: ( | ||
configNames: Array<string>, | ||
assetFilePath: string, | ||
) => | ||
resolveConfig( | ||
this.options.inputFS, | ||
assetFilePath, | ||
configNames, | ||
), | ||
}); | ||
for (let validatorResult of validatorResults) { | ||
this.handleResult(validatorResult); | ||
} | ||
} | ||
let asset = await this.loadAsset(); | ||
// Otherwise, pass the assets one-at-a-time | ||
else if (plugin.validate && !this.dedicatedThread) { | ||
await Promise.all( | ||
assets.map(async asset => { | ||
let config = null; | ||
if (plugin.getConfig) { | ||
config = await plugin.getConfig({ | ||
asset: new Asset(asset), | ||
options: pluginOptions, | ||
logger: validatorLogger, | ||
resolveConfig: (configNames: Array<string>) => | ||
resolveConfig( | ||
this.options.inputFS, | ||
asset.value.filePath, | ||
configNames, | ||
), | ||
}); | ||
} | ||
let validators = await this.parcelConfig.getValidators( | ||
this.request.filePath, | ||
let validatorResult = await plugin.validate({ | ||
asset: new Asset(asset), | ||
options: pluginOptions, | ||
config, | ||
logger: validatorLogger, | ||
}); | ||
this.handleResult(validatorResult); | ||
}), | ||
); | ||
} | ||
} catch (e) { | ||
throw new ThrowableDiagnostic({ | ||
diagnostic: errorToDiagnostic(e, validatorName), | ||
}); | ||
} | ||
} | ||
}), | ||
); | ||
let pluginOptions = new PluginOptions(this.options); | ||
} | ||
for (let validator of validators) { | ||
let validatorLogger = new PluginLogger({origin: validator.name}); | ||
try { | ||
let config = null; | ||
if (validator.plugin.getConfig) { | ||
config = await validator.plugin.getConfig({ | ||
asset: new Asset(asset), | ||
options: pluginOptions, | ||
logger: validatorLogger, | ||
resolveConfig: (configNames: Array<string>) => | ||
resolveConfig( | ||
this.options.inputFS, | ||
asset.value.filePath, | ||
configNames, | ||
), | ||
}); | ||
} | ||
let validatorResult = await validator.plugin.validate({ | ||
asset: new Asset(asset), | ||
options: pluginOptions, | ||
config, | ||
logger: validatorLogger, | ||
async buildAssetsAndValidators() { | ||
// Figure out what validators need to be run, and group the assets by the relevant validators. | ||
await Promise.all( | ||
this.requests.map(async request => { | ||
this.report({ | ||
type: 'validation', | ||
filePath: request.filePath, | ||
}); | ||
if (validatorResult) { | ||
let {warnings, errors} = validatorResult; | ||
let asset = await this.loadAsset(request); | ||
if (errors.length > 0) { | ||
throw new ThrowableDiagnostic({ | ||
diagnostic: errors, | ||
}); | ||
} | ||
let validators = await this.parcelConfig.getValidators( | ||
request.filePath, | ||
); | ||
if (warnings.length > 0) { | ||
logger.warn(warnings); | ||
for (let validator of validators) { | ||
this.allValidators[validator.name] = validator.plugin; | ||
if (this.allAssets[validator.name]) { | ||
this.allAssets[validator.name].push(asset); | ||
} else { | ||
this.allAssets[validator.name] = [asset]; | ||
} | ||
} | ||
} catch (e) { | ||
}), | ||
); | ||
} | ||
handleResult(validatorResult: ?ValidateResult) { | ||
if (validatorResult) { | ||
let {warnings, errors} = validatorResult; | ||
if (errors.length > 0) { | ||
throw new ThrowableDiagnostic({ | ||
diagnostic: errorToDiagnostic(e, validator.name), | ||
diagnostic: errors, | ||
}); | ||
} | ||
if (warnings.length > 0) { | ||
logger.warn(warnings); | ||
} | ||
} | ||
} | ||
async loadAsset(): Promise<InternalAsset> { | ||
let {filePath, env, code, sideEffects} = this.request; | ||
async loadAsset(request: AssetRequestDesc): Promise<InternalAsset> { | ||
let {filePath, env, code, sideEffects} = request; | ||
let {content, size, hash, isSource} = await summarizeRequest( | ||
this.options.inputFS, | ||
this.request, | ||
request, | ||
); | ||
@@ -117,0 +188,0 @@ |
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
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
683736
19559
+ Added@parcel/source-map@2.1.1(transitive)
+ Addeddetect-libc@1.0.3(transitive)