mirror of
https://github.com/fluencelabs/fluence-js.git
synced 2025-06-27 06:41:32 +00:00
feat(npm-aqua-compiler): create package (#401)
* Add npm-aqua-compiler package * Release new package * Remove noUncheckedIndexedAccess from tsconfig.json * Fix a test script * Fix length checks * Fix * Update error description * Try to choose a nicer err message * New import format and API * Fix error message * Improve test * Don't add empty string key when globalImports prop is empty * Fix exports
This commit is contained in:
@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import assert from "assert";
|
||||
import { readFile } from "fs/promises";
|
||||
import { join } from "path";
|
||||
|
||||
@ -86,7 +85,7 @@ export function recursiveRenameLaquaProps(obj: JSONValue): unknown {
|
||||
// Last part of the property separated by "_" is a correct name
|
||||
const refinedProperty = prop.split("_").pop();
|
||||
|
||||
if (refinedProperty == null) {
|
||||
if (refinedProperty === undefined) {
|
||||
throw new Error(`Bad property name: ${prop}.`);
|
||||
}
|
||||
|
||||
@ -95,11 +94,15 @@ export function recursiveRenameLaquaProps(obj: JSONValue): unknown {
|
||||
}
|
||||
}
|
||||
|
||||
assert(accessProp in obj);
|
||||
const laquaProp = obj[accessProp];
|
||||
|
||||
if (laquaProp === undefined) {
|
||||
return acc;
|
||||
}
|
||||
|
||||
return {
|
||||
...acc,
|
||||
[accessProp]: recursiveRenameLaquaProps(obj[accessProp]),
|
||||
[accessProp]: recursiveRenameLaquaProps(laquaProp),
|
||||
};
|
||||
}, {});
|
||||
}
|
||||
|
Reference in New Issue
Block a user