parcel-codegen-loader
Advanced tools
Comparing version 0.8.2 to 0.8.3
@@ -53,3 +53,3 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var options, name, compiler, callback, generator, content; | ||
var options, name, compiler, callback, generator, content, err_1; | ||
var _this = this; | ||
@@ -67,2 +67,5 @@ return __generator(this, function (_c) { | ||
callback = this.async(); | ||
_c.label = 1; | ||
case 1: | ||
_c.trys.push([1, 3, , 4]); | ||
generator = reloadGenerator(name); | ||
@@ -80,3 +83,3 @@ return [4 /*yield*/, generator.call({ | ||
})]; | ||
case 1: | ||
case 2: | ||
content = _c.sent(); | ||
@@ -89,3 +92,8 @@ if (typeof content === 'string') { | ||
} | ||
return [2 /*return*/]; | ||
return [3 /*break*/, 4]; | ||
case 3: | ||
err_1 = _c.sent(); | ||
callback(err_1, source); | ||
return [3 /*break*/, 4]; | ||
case 4: return [2 /*return*/]; | ||
} | ||
@@ -92,0 +100,0 @@ }); |
{ | ||
"name": "parcel-codegen-loader", | ||
"version": "0.8.2", | ||
"version": "0.8.3", | ||
"description": "A loader for .codegen files to auto-generate modules on the fly.", | ||
@@ -39,3 +39,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "b03ec9ab419f7fdfdabd0c46558b1993229067c4" | ||
"gitHead": "92b498c1b830f38f120573b8be16c477529cf39a" | ||
} |
@@ -31,17 +31,22 @@ import * as validateOptions from 'schema-utils'; | ||
const callback = this.async(); | ||
const generator = reloadGenerator(name); | ||
const content = await generator.call({ | ||
name, | ||
options: { | ||
outDir: compiler?.options?.output?.path, | ||
rootDir: process.cwd(), | ||
}, | ||
addDependency: (file: string, options: DependencyOptions = {}) => this.addDependency(file), | ||
}); | ||
if (typeof content === 'string') { | ||
callback(null, content, map, meta); | ||
} else { | ||
callback(new Error('Unsupported return type from codegen.'), source); | ||
try { | ||
const generator = reloadGenerator(name); | ||
const content = await generator.call({ | ||
name, | ||
options: { | ||
outDir: compiler?.options?.output?.path, | ||
rootDir: process.cwd(), | ||
}, | ||
addDependency: (file: string, options: DependencyOptions = {}) => this.addDependency(file), | ||
}); | ||
if (typeof content === 'string') { | ||
callback(null, content, map, meta); | ||
} else { | ||
callback(new Error('Unsupported return type from codegen.'), source); | ||
} | ||
} catch (err) { | ||
callback(err, source); | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
13395
155