From 883e691efe50d8c2dfe4d216cf07b0915b655104 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Sat, 9 Sep 2023 14:33:02 +0200 Subject: [PATCH] WIP, some builtins, some fixes for new parser version --- .gitignore | 1 + package.json | 4 +- src/builtins/README.md | 3 + src/builtins/remove-attrs.js | 11 ++ src/builtins/seq.js | 9 + src/builtins/split-version.js | 49 ++++++ src/evaluate.js | 61 +------ src/prepare-ast.js | 113 ++++++++---- src/transformers/attribute-sets.js | 7 +- src/transformers/desugar-attrsets.js | 10 +- src/transformers/desugar-inherits.js | 11 +- src/transformers/desugar-let-attribute-set.js | 4 +- src/transformers/index.js | 60 ++++++- src/transformers/let-in.js | 2 +- src/transformers/lists.js | 19 ++ src/transformers/literals.js | 8 +- src/transformers/mangle-identifiers.js | 2 +- src/transformers/templates/object-literal.js | 1 + src/transformers/util/nix-types.js | 4 +- tests/upstream-nix.js | 82 ++++----- yarn.lock | 162 +++++++++--------- 21 files changed, 389 insertions(+), 234 deletions(-) create mode 100644 src/builtins/README.md create mode 100644 src/builtins/remove-attrs.js create mode 100644 src/builtins/seq.js create mode 100644 src/builtins/split-version.js create mode 100644 src/transformers/lists.js diff --git a/.gitignore b/.gitignore index 1907e34..deb7225 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules +node_modules.bak private-notes.txt old diff --git a/package.json b/package.json index 808db8a..f00e9bc 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "main": "index.js", "scripts": { "test": "tape tests/**/* | tap-difflet", + "test-raw": "tape tests/**/*", "eval": "DEBUG_NIX=1 node run.js" }, "repository": { @@ -35,8 +36,9 @@ "split-filter": "^1.1.3", "tap-difflet": "^0.7.2", "tape": "^5.5.0", + "tree-sitter": "^0.20.2", "tree-sitter-javascript": "^0.19.0", - "tree-sitter-nix": "cstrahan/tree-sitter-nix" + "tree-sitter-nix": "^0.0.2" }, "devDependencies": { "@joepie91/eslint-config": "^1.1.0", diff --git a/src/builtins/README.md b/src/builtins/README.md new file mode 100644 index 0000000..00adf26 --- /dev/null +++ b/src/builtins/README.md @@ -0,0 +1,3 @@ +This folder contains implementations of the various `builtins` in Nix. + +The way the exported functions are expressed here is subtly different from the rest of the codebase; arrow functions are used instead of regular functions. This is because Nix does not *really** have multi-argument functions, and so multi-argument functions need to be expressed as single-argument functions that return other single-argument functions. The only way to ergonomically express this is with nested arrow functions. diff --git a/src/builtins/remove-attrs.js b/src/builtins/remove-attrs.js new file mode 100644 index 0000000..ef1d7f0 --- /dev/null +++ b/src/builtins/remove-attrs.js @@ -0,0 +1,11 @@ +"use strict"; + +module.exports = ($attributeSet) => ($attributesToRemove) => { + let newAttributeSet = { ... $attributeSet() }; + + for (let $attribute of $attributesToRemove()) { + delete newAttributeSet[$attribute()]; + } + + return newAttributeSet; +}; diff --git a/src/builtins/seq.js b/src/builtins/seq.js new file mode 100644 index 0000000..7bcf1fb --- /dev/null +++ b/src/builtins/seq.js @@ -0,0 +1,9 @@ +"use strict"; + +module.exports = ($a) => ($b) => { + // First evaluate the first argument... + $a(); + + // ... then evaluate and return the second argument. + return $b(); +}; diff --git a/src/builtins/split-version.js b/src/builtins/split-version.js new file mode 100644 index 0000000..3599d35 --- /dev/null +++ b/src/builtins/split-version.js @@ -0,0 +1,49 @@ +"use strict"; + +module.exports = ($version) => { + let version = $version(); + + // FIXME: assert string + let parts = []; + let currentPart = ""; + let isNumber = null; + + function finalizePart() { + if (currentPart !== "") { + // NOTE: Numbers get added to the list as strings anyway. This is really weird considering `nix-env -u`s comparison logic, but it's how upstream Nix works too. + parts.push(currentPart); + currentPart = ""; + isNumber = null; + } + } + + // SPEC: Is it correct to assume that only the ASCII character set is supported here? + // TODO: Replace this with a proper parser some day; maybe use it as a testcase for protocolkit? + for (let i = 0; i < version.length; i++) { + let code = version.charCodeAt(i); + + if (code >= 48 && code <= 57) { + // Digit + if (isNumber !== true) { + finalizePart(); + isNumber = true; + } + + currentPart += version[i]; + } else if ((code >= 65 && code <= 90) || (code >= 97 && code <= 122)) { + // Letter (uppercase and lowercase respectively) + if (isNumber !== false) { + finalizePart(); + isNumber = false; + } + + currentPart += version[i]; + } else { + finalizePart(); + } + } + + finalizePart(); + + return parts; +}; diff --git a/src/evaluate.js b/src/evaluate.js index 9d9ea69..5782246 100644 --- a/src/evaluate.js +++ b/src/evaluate.js @@ -11,64 +11,15 @@ module.exports = function evaluate(nixCode) { } const builtins = { - seq: lazyWrap(($a) => ($b) => { - // First evaluate the first argument... - $a(); - - // ... then evaluate and return the second argument. - return $b(); - }), - splitVersion: lazyWrap(($version) => { - let version = $version(); - - // FIXME: assert string - let parts = []; - let currentPart = ""; - let isNumber = null; - - function finalizePart() { - if (currentPart !== "") { - // NOTE: Numbers get added to the list as strings anyway. This is really weird considering `nix-env -u`s comparison logic, but it's how upstream Nix works too. - parts.push(currentPart); - currentPart = ""; - isNumber = null; - } - } - - // FIXME: Is it correct to assume that only the ASCII character set is supported here? - // TODO: Replace this with a proper parser some day - for (let i = 0; i < version.length; i++) { - let code = version.charCodeAt(i); - - if (code >= 48 && code <= 57) { - // Digit - if (isNumber !== true) { - finalizePart(); - isNumber = true; - } - - currentPart += version[i]; - } else if ((code >= 65 && code <= 90) || (code >= 97 && code <= 122)) { - // Letter (uppercase and lowercase respectively) - if (isNumber !== false) { - finalizePart(); - isNumber = false; - } - - currentPart += version[i]; - } else { - finalizePart(); - } - } - - finalizePart(); - - return parts; - }) + seq: lazyWrap(require("./builtins/seq")), + splitVersion: lazyWrap(require("./builtins/split-version")), + removeAttrs: lazyWrap(require("./builtins/remove-attrs")), }; const api = { - builtins: () => builtins, + builtins: lazyWrap(builtins), + // NOTE: `builtins` properties are already lazy-wrapped + removeAttrs: builtins.removeAttrs, $memoize: function (func) { let isCalled = false; let storedResult; diff --git a/src/prepare-ast.js b/src/prepare-ast.js index f7f3302..20718f8 100644 --- a/src/prepare-ast.js +++ b/src/prepare-ast.js @@ -3,6 +3,24 @@ const matchValue = require("match-value"); const asExpression = require("as-expression"); +const FIELD_MAPPINGS = { + attrset_expression: { + binding_set: "MERGE" + }, + rec_attrset_expression: { + binding_set: "MERGE" + }, + let_attrset_expression: { + binding_set: "MERGE" + }, +}; + +function mergeNode(parent, child) { + // NOTE: Mutates parent! + let { type, ... childArgs } = child; + Object.assign(parent, childArgs); +} + // TODO: Refactor this function convertStringNodeParts(node) { let fullText = node.text; @@ -65,6 +83,7 @@ function convertNode(node) { : { type: "token", text: node.text } if (node.fields != null) { + // console.log({ node, fields: node.fields, children: node.children }); for (let field of node.fields) { let children = node[field]; let fieldName = field.replace(/Nodes?$/, ""); @@ -79,10 +98,26 @@ function convertNode(node) { } }); } + + let nodeFieldMappings = FIELD_MAPPINGS[node.type]; + + if (nodeFieldMappings != null) { + node.children.forEach((child, i) => { + let mapTo = nodeFieldMappings[child.type]; + + if (mapTo === "MERGE") { + // This means we should elide the child node, and merge it into the node we're currently processing; this is used to deal with non-hidden layers of indirection + mergeNode(result, convertNode(child)); + } else if (mapTo != null) { + // TODO: Support for multi-child fields? + result[mapTo] = convertNode(child); + } + }); + } } // Special case: if we don't provide a Babel-compatible top-level Program entry, traversal will fail - if (type === "source_expression") { + if (type === "source_code") { return { type: "Program", sourceType: "script", @@ -90,73 +125,91 @@ function convertNode(node) { }; } + // Special case: this is just a wrapper for an identifier, and we don't really want to keep this wrapper + if (type === "variable_expression") { + return convertNode(node.nameNode); + } + // The below section is based on `alias` expressions throughout the grammar, and the rules in https://github.com/cstrahan/tree-sitter-nix/blob/83ee5993560bf15854c69b77d92e34456f8fb655/grammar.js#L53-L59 if (type === "identifier" || type === "attr_identifier") { + // FIXME: attr_identifier gone? result.name = node.text; - } else if (type === "integer" || type === "float") { + } else if (type === "integer_expression" || type === "float_expression") { result.value = node.text; - } else if (type === "string") { + } else if (type === "string_expression") { result.parts = convertStringNodeParts(node); - } else if (type === "path" || type === "hpath") { + } else if (type === "path_expression" || type === "hpath_expression") { result.path = node.text; - } else if (type === "spath") { + } else if (type === "spath_expression") { // Strip the < and > result.path = node.text.slice(1, -1); - } else if (type === "uri") { + } else if (type === "uri_expression") { result.uri = node.text; } - if (type === "binary") { + if (type === "binary_expression") { // Unpack the anonymous token result.operator = result.operator.text; } - if (type === "rec_attrset") { + if (type === "rec_attrset_expression") { result.recursive = true; } else if (type === "attrset") { result.recursive = false; } + // FIXME: Is this code still needed after the parser updates? if (type === "inherit") { // We're inheriting from scope here, so the source expression is explicitly not set - result.expression = null; + result.expression = result.expression ?? null; } else if (type === "inherit_from") { // Already set } + if (type === "list_expression") { + // TODO: Can this sort of renaming be done more neatly? + result.elements = result.element; + delete result.element; + } + // console.log(result); result.type = matchValue(result.type, { - source_expression: "NixProgram", + source_code: "NixProgram", token: "NixAnonymousToken", - path: "NixPathLiteral", - hpath: "NixHomePathLiteral", - spath: "NixEnvironmentPathLiteral", - uri: "NixURILiteral", - integer: "NixIntegerLiteral", - float: "NixFloatLiteral", - string: "NixStringLiteral", - parenthesized: "NixParenthesizedExpression", - attrset: "NixAttributeSet", - rec_attrset: "NixAttributeSet", - let: "NixLetIn", - let_attrset: "NixLetAttributeSet", + path_expression: "NixPathLiteral", + hpath_expression: "NixHomePathLiteral", /* FIXME: Do we have interpolation support here yet? */ + spath_expression: "NixEnvironmentPathLiteral", + uri_expression: "NixURILiteral", + integer_expression: "NixIntegerLiteral", + float_expression: "NixFloatLiteral", + string_expression: "NixStringLiteral", + parenthesized_expression: "NixParenthesizedExpression", + attrset_expression: "NixAttributeSet", + rec_attrset_expression: "NixAttributeSet", + binding_set: "NixAttributeSetBindings", + let_expression: "NixLetIn", + let_attrset_expression: "NixLetAttributeSet", identifier: "NixIdentifier", - attr_identifier: "NixAttributeIdentifier", + attr_identifier: "NixAttributeIdentifier", // FIXME: Gone? attrpath: "NixAttributePath", inherit: "NixInherit", inherit_from: "NixInherit", - attrs_inherited: "NixInheritAttributes", - attrs_inherited_from: "NixInheritAttributes", - bind: "NixBinding", - binary: "NixBinaryOperation", - app: "NixFunctionCall", - select: "NixAttributeSelection", + inherited_attrs: "NixInheritAttributes", + attrs_inherited_from: "NixInheritAttributes", // FIXME: Gone? + binding: "NixBinding", + binary_expression: "NixBinaryOperation", + apply_expression: "NixFunctionCall", + select_expression: "NixAttributeSelection", interpolation: "NixInterpolationExpression", + list_expression: "NixListLiteral", + with_expression: "NixWithExpression", // Function definitions - function: "NixFunctionDefinition", + function_expression: "NixFunctionDefinition", formals: "NixUnpackedAttributes", formal: "NixUnpackedAttribute", + // _: (value) => value + // FIXME: assert_expression? if_expression? unary_expression? has_attr_expression? apply_expression? indented_string_expression? binding_set? }); return result; diff --git a/src/transformers/attribute-sets.js b/src/transformers/attribute-sets.js index 846ffb7..5733395 100644 --- a/src/transformers/attribute-sets.js +++ b/src/transformers/attribute-sets.js @@ -59,7 +59,7 @@ let tmplRecursiveBinding = template(` function isDynamicBinding(binding) { - return binding.attrpath.attr[0].type !== "NixAttributeIdentifier"; + return binding.attrpath.attr[0].type !== "NixIdentifier"; } function objectNormal(bindings) { @@ -126,8 +126,7 @@ module.exports = { assert(node.attrpath.type === "NixAttributePath"); return node.attrpath.attr.reduce((last, identifier) => { - assert(identifier.type === "NixAttributeIdentifier"); - + // console.log({identifier}); return callLazyWrapper(types.memberExpression(last, types.identifier(identifier.name))); }, node.expression); }); @@ -151,7 +150,7 @@ module.exports = { // }; // }); - let bindings = node.bind.map((binding) => { + let bindings = node.binding.map((binding) => { assert(binding.attrpath.attr.length === 1); // Nested attributes should have been desugared by this point return { diff --git a/src/transformers/desugar-attrsets.js b/src/transformers/desugar-attrsets.js index f33a3f8..83d083d 100644 --- a/src/transformers/desugar-attrsets.js +++ b/src/transformers/desugar-attrsets.js @@ -4,21 +4,21 @@ const unreachable = require("@joepie91/unreachable")("jsNix"); const NoChange = require("astformer/actions/no-change"); // FIXME -const { NixAttributeIdentifier, NixAttributeSet, NixBinding } = require("./util/nix-types"); +const { NixIdentifier, NixAttributeSet, NixBinding } = require("./util/nix-types"); function isAttributeSet(node) { return (node.type === "NixAttributeSet"); } function mergeAttributeSets(a, b) { - return NixAttributeSet([ ... a.bind, ... b.bind ]); + return NixAttributeSet([ ... a.binding, ... b.binding ]); } function mergeBindings(name, a, b) { let attributes = mergeAttributeSets(unpackBindingValue(a), unpackBindingValue(b)); return NixBinding( - [ NixAttributeIdentifier(name) ], + [ NixIdentifier(name) ], attributes ); } @@ -51,14 +51,14 @@ module.exports = { let newStaticBindings = {}; let dynamicBindings = []; - for (let binding of node.bind) { + for (let binding of node.binding) { if (binding.type === "NixBinding") { if (binding.attrpath.attr.length > 1) { neededDesugaring = true; } let firstAttribute = binding.attrpath.attr[0]; - let isStaticAttribute = firstAttribute.type === "NixAttributeIdentifier"; + let isStaticAttribute = firstAttribute.type === "NixIdentifier"; if (isStaticAttribute) { let attributeName = firstAttribute.name; diff --git a/src/transformers/desugar-inherits.js b/src/transformers/desugar-inherits.js index 2b84c48..42dc7a9 100644 --- a/src/transformers/desugar-inherits.js +++ b/src/transformers/desugar-inherits.js @@ -10,7 +10,8 @@ module.exports = { name: "desugar-inherits", visitors: { NixAttributeSet: (node) => { - let [ inherits, regularBindings ] = splitFilter(node.bind, (binding) => binding.type === "NixInherit"); + // console.dir(node, {depth:null}) + let [ inherits, regularBindings ] = splitFilter(node.binding, (binding) => binding.type === "NixInherit"); if (inherits.length === 0) { return NoChange; @@ -21,7 +22,7 @@ module.exports = { tempName: `$temp$${tempCounter++}`, sourceExpression: inherit.expression, names: inherit.attrs.attr.map((attribute) => { - assert(attribute.type === "NixAttributeIdentifier"); + assert(attribute.type === "NixIdentifier"); return attribute.name; }) }; @@ -29,7 +30,7 @@ module.exports = { let letBindings = inherits_.map((inherit) => { return nixTypes.NixBinding( - [ nixTypes.NixAttributeIdentifier(inherit.tempName) ], + [ nixTypes.NixIdentifier(inherit.tempName) ], inherit.sourceExpression ); }); @@ -37,10 +38,10 @@ module.exports = { let inheritedAttributeBindings = inherits_.flatMap((inherit) => { return inherit.names.map((name) => { return nixTypes.NixBinding( - [ nixTypes.NixAttributeIdentifier(name) ], + [ nixTypes.NixIdentifier(name) ], nixTypes.NixAttributeSelection( nixTypes.NixIdentifier(inherit.tempName), - [ nixTypes.NixAttributeIdentifier(name) ] + [ nixTypes.NixIdentifier(name) ] ) ); }); diff --git a/src/transformers/desugar-let-attribute-set.js b/src/transformers/desugar-let-attribute-set.js index 180eda0..0f5b7e1 100644 --- a/src/transformers/desugar-let-attribute-set.js +++ b/src/transformers/desugar-let-attribute-set.js @@ -8,7 +8,7 @@ const _nixTypes = require("./util/nix-types"); function isValidBodyAttribute(binding) { assert(binding.attrpath.type === "NixAttributePath"); assert(binding.attrpath.attr.length > 0); - assert(binding.attrpath.attr[0].type === "NixAttributeIdentifier"); + assert(binding.attrpath.attr[0].type === "NixIdentifier"); if (binding.attrpath.attr[0].name === "body") { if (binding.attrpath.attr.length > 1) { @@ -27,7 +27,7 @@ module.exports = { NixLetAttributeSet: (node) => { // We save a bunch of complexity here by directly translating to a recursive attribute set instead of `let..in`; our JS representation of `let..in` is *functionally* identical to how a LetAttributeSet works. We just use a different attribute name to represent the returned evaluation. - let [ bodyBindings, actualBindings ] = splitFilter(node.bind, (binding) => isValidBodyAttribute(binding)); + let [ bodyBindings, actualBindings ] = splitFilter(node.binding, (binding) => isValidBodyAttribute(binding)); if (bodyBindings.length === 0) { // TODO: Display source code position + snippet diff --git a/src/transformers/index.js b/src/transformers/index.js index 60ebd08..423d7d4 100644 --- a/src/transformers/index.js +++ b/src/transformers/index.js @@ -5,10 +5,11 @@ const types = require("@babel/types"); const template = require("@babel/template").default; const templateExpression = require("./util/template-expression"); +const NoChange = require("astformer/actions/no-change"); // FIXME: Auto-generate argument list based on exposed API surface? let tmplModule = template(` - module.exports = function({ builtins, $memoize, $handleArgument, $assertUniqueKeys }) { + module.exports = function({ builtins, removeAttrs, $memoize, $handleArgument, $assertUniqueKeys }) { return %%contents%%; }; `); @@ -17,6 +18,24 @@ let tmplIdentifierReference = templateExpression(`( %%name%%() )`); +let tmplWithWrapper = templateExpression(` + (() => { + const %%contextName%% = %%setupCode%%; + + return %%body%%; + })() +`); + +let tmplImplicitContextNested = templateExpression(` + Object.assign(Object.create(%%parent%%), %%environment%%) +`); + +let tmplImplicitContextTop = templateExpression(` + Object.assign({}, %%environment%%) +`); + +let implicitContextCounter = 0; + let trivial = { name: "trivial-transforms", visitors: { @@ -30,24 +49,58 @@ let trivial = { return tmplModule({ contents: node.body[0] }); }); }, + NixAttributePath: (_node, { setContext }) => { + // This ensures that attribute paths get excluded from being processed as an identifier, now that the parser no longer distinguishes between attribute identifiers and regular identifiers + setContext([ "attr" ], "identifierType", "attributePath"); + return NoChange; + }, NixIdentifier: (node, { getContext }) => { // FIXME: Mangle reserved keywords like `const` + let safeName = (node.name === "import") + ? "$import" + : node.name; + if (getContext("identifierType") === "define") { - return types.identifier(node.name); + return types.identifier(safeName); + } else if (getContext("identifierType") === "attributePath") { + // Do nothing, this will get removed from the tree in attribute set handling + return NoChange; } else { // reference - return tmplIdentifierReference({ name: node.name }); + return tmplIdentifierReference({ name: safeName }); } }, NixBinaryOperation: (_node, { defer }) => { return defer((node) => { // FIXME: Verify that all the 'operator' values match between Nix and JS! + // FIXME: Need to replace this with utility functions to deal with eg. paths return types.binaryExpression(node.operator, node.left, node.right); }); + }, + NixWithExpression: (node, { defer, setContext, getContext }) => { + // TODO: Can we optimize for the fast case (no nested `with`) by referencing the source attrset directly? + let parentContext = getContext("implicitContext"); + let hasParent = (parentContext != null); + + let contextName = `$implicit${implicitContextCounter++}`; + setContext(null, "implicitContext", contextName); + + let setupCode = (hasParent) + ? tmplImplicitContextNested({ environment: node.environment, parent: parentContext }) + : tmplImplicitContextTop({ environment: node.environment }); + + return defer((node) => { + return tmplWithWrapper({ + contextName: contextName, + setupCode: setupCode, + body: node.body + }); + }); } } }; module.exports = [ + // FIXME: desugar-search-path require("./desugar-inherits"), require("./desugar-attrsets"), require("./desugar-let-attribute-set"), @@ -55,6 +108,7 @@ module.exports = [ require("./mangle-identifiers"), require("./let-in"), require("./literals"), + require("./lists"), require("./functions"), require("./attribute-sets"), trivial, diff --git a/src/transformers/let-in.js b/src/transformers/let-in.js index 083027d..04c00bf 100644 --- a/src/transformers/let-in.js +++ b/src/transformers/let-in.js @@ -7,7 +7,7 @@ module.exports = { visitors: { NixLetIn: (node) => { return nixTypes.JSNixLet( - node.bind, + node.binding, node.body ); } diff --git a/src/transformers/lists.js b/src/transformers/lists.js new file mode 100644 index 0000000..ab393f7 --- /dev/null +++ b/src/transformers/lists.js @@ -0,0 +1,19 @@ +"use strict"; + +const types = require("@babel/types"); +const lazyWrapper = require("./templates/lazy-wrapper"); + +module.exports = { + name: "lists", + visitors: { + NixListLiteral: (_node, { defer }) => { + return defer((node) => { + return types.arrayExpression( + node.elements.map((element) => { + return lazyWrapper(element); + }) + ); + }); + } + } +}; diff --git a/src/transformers/literals.js b/src/transformers/literals.js index fa8aeac..3e5c222 100644 --- a/src/transformers/literals.js +++ b/src/transformers/literals.js @@ -2,12 +2,18 @@ const types = require("@babel/types"); const splitFilter = require("split-filter"); +const templateExpression = require("./util/template-expression"); + +let tmplPathLiteral = templateExpression(` + $path(%%path%%) +`); module.exports = { name: "literals", visitors: { NixIntegerLiteral: (node) => types.numericLiteral(parseInt(node.value)), NixFloatLiteral: (node) => types.numericLiteral(parseFloat(node.value)), + NixPathLiteral: (node) => tmplPathLiteral({ path: types.stringLiteral(node.path) }), NixStringLiteral: (node, { defer }) => { if (node.parts.length === 1 && node.parts[0].type === "NixInterpolationLiteral") { // Fast case; just a simple, non-interpolated string literal @@ -22,6 +28,6 @@ module.exports = { ); }); } - } + }, } }; diff --git a/src/transformers/mangle-identifiers.js b/src/transformers/mangle-identifiers.js index a7e6216..d8050ce 100644 --- a/src/transformers/mangle-identifiers.js +++ b/src/transformers/mangle-identifiers.js @@ -18,7 +18,7 @@ function mangleNode(node) { module.exports = { name: "mangle-identifiers", visitors: { - NixAttributeIdentifier: mangleNode, + // NixAttributeIdentifier: mangleNode, NixIdentifier: mangleNode } }; diff --git a/src/transformers/templates/object-literal.js b/src/transformers/templates/object-literal.js index 2e5549f..747edf3 100644 --- a/src/transformers/templates/object-literal.js +++ b/src/transformers/templates/object-literal.js @@ -8,6 +8,7 @@ module.exports = function objectLiteral(entries) { if (typeof key === "string") { return types.objectProperty(types.stringLiteral(key), value, false); } else { + // console.dir({entries}, {depth:null}); return types.objectProperty(key, value, true); } }) diff --git a/src/transformers/util/nix-types.js b/src/transformers/util/nix-types.js index 418bc96..32375d1 100644 --- a/src/transformers/util/nix-types.js +++ b/src/transformers/util/nix-types.js @@ -71,11 +71,11 @@ let types = module.exports = { types.NixAttributeSet([ ... bindings, types.NixBinding( - [ types.NixAttributeIdentifier("$letBody") ], + [ types.NixIdentifier("$letBody") ], body ) ], true), - [ types.NixAttributeIdentifier("$letBody") ] + [ types.NixIdentifier("$letBody") ] ); } }; diff --git a/tests/upstream-nix.js b/tests/upstream-nix.js index 09d1fba..09e8d71 100644 --- a/tests/upstream-nix.js +++ b/tests/upstream-nix.js @@ -1,51 +1,55 @@ "use strict"; -const tape = require("tape-catch"); -const fs = require("fs"); -const path = require("path"); -const util = require("util"); -const evaluate = require("../src/evaluate"); +try { + const tape = require("tape-catch"); + const fs = require("fs"); + const path = require("path"); + const util = require("util"); + const evaluate = require("../src/evaluate"); -const NIX_SOURCE_REPO = process.env.NIX_SOURCE_REPO; + const NIX_SOURCE_REPO = process.env.NIX_SOURCE_REPO; -if (NIX_SOURCE_REPO == null) { - throw new Error(`To run the upstream Nix language tests, you must specify a NIX_SOURCE_REPO environment variable, that points at the root of a local checkout of the Git repository for Nix`); -} - -const testsPath = path.join(NIX_SOURCE_REPO, "tests/lang"); - -let tests = fs.readdirSync(testsPath) - .filter((entry) => entry.endsWith(".exp")) - .map((entry) => entry.replace(/\.exp$/, "")); - -function formatResultNode(node) { - if (typeof node === "string") { - return `"${node.replace(/"/g, '\\"')}"`; - } else if (Array.isArray(node)) { - return `[ ${node.map(formatResultNode).join(" ")} ]`; - } else { - return node.toString(); + if (NIX_SOURCE_REPO == null) { + throw new Error(`To run the upstream Nix language tests, you must specify a NIX_SOURCE_REPO environment variable, that points at the root of a local checkout of the Git repository for Nix`); } -} -for (let test of tests) { - try { - let expression = fs.readFileSync(path.join(testsPath, `${test}.nix`), "utf8"); - let expectedResult = fs.readFileSync(path.join(testsPath, `${test}.exp`), "utf8").replace(/\n$/, ""); + const testsPath = path.join(NIX_SOURCE_REPO, "tests/lang"); - tape(`Nix upstream language tests - ${test}`, (test) => { - test.plan(1); + let tests = fs.readdirSync(testsPath) + .filter((entry) => entry.endsWith(".exp")) + .map((entry) => entry.replace(/\.exp$/, "")); - let result = formatResultNode(evaluate(expression).value); - - test.equals(expectedResult, result); - }); - } catch (error) { - // FIXME: This would currently cause ENOENTs during evaluation (eg. reading a file from Nix itself) to be ignored - if (error.code === "ENOENT") { - // skip + function formatResultNode(node) { + if (typeof node === "string") { + return `"${node.replace(/"/g, '\\"')}"`; + } else if (Array.isArray(node)) { + return `[ ${node.map(formatResultNode).join(" ")} ]`; } else { - throw error; + return node.toString(); + } + } + + for (let test of tests) { + try { + let expression = fs.readFileSync(path.join(testsPath, `${test}.nix`), "utf8"); + let expectedResult = fs.readFileSync(path.join(testsPath, `${test}.exp`), "utf8").replace(/\n$/, ""); + + tape(`Nix upstream language tests - ${test}`, (test) => { + test.plan(1); + + let result = formatResultNode(evaluate(expression).value); + + test.equals(expectedResult, result); + }); + } catch (error) { + // FIXME: This would currently cause ENOENTs during evaluation (eg. reading a file from Nix itself) to be ignored + if (error.code === "ENOENT") { + // skip + } else { + throw error; + } } } +} catch (error) { + console.error(error); } diff --git a/yarn.lock b/yarn.lock index b040cd0..c6ec858 100644 --- a/yarn.lock +++ b/yarn.lock @@ -487,12 +487,7 @@ ajv@^6.10.0, ajv@^6.12.4: ansi-regex@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" - integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= - -ansi-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" - integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= + integrity sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA== ansi-regex@^5.0.1: version "5.0.1" @@ -689,7 +684,7 @@ chownr@^1.1.1: code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" - integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= + integrity sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA== color-convert@^1.9.0: version "1.9.3" @@ -733,7 +728,7 @@ concat-map@0.0.1: console-control-strings@^1.0.0, console-control-strings@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" - integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4= + integrity sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ== convert-source-map@^1.7.0: version "1.8.0" @@ -842,12 +837,12 @@ defined@^1.0.0: delegates@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" - integrity sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= + integrity sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ== detect-libc@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" - integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= + integrity sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg== diff@1.0: version "1.0.8" @@ -897,6 +892,11 @@ electron-to-chromium@^1.3.830: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.842.tgz#641e414012dded277468892c0156cb01984f4f6f" integrity sha512-P/nDMPIYdb2PyqCQwhTXNi5JFjX1AsDVR0y6FrHw752izJIAJ+Pn5lugqyBq4tXeRSZBMBb2ZGvRGB1djtELEQ== +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + end-of-stream@^1.1.0, end-of-stream@^1.4.1: version "1.4.4" resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" @@ -1193,7 +1193,7 @@ functional-red-black-tree@^1.0.1: gauge@~2.7.3: version "2.7.4" resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" - integrity sha1-LANAXHU4w51+s3sxcCLjJfsBi/c= + integrity sha512-14x4kjc6lkD3ltw589k0NrPD6cCNTD6CWoVUNpB85+DrtONoZn+Rug6xZU5RvSC4+TZPxA5AnBibQYAvZn41Hg== dependencies: aproba "^1.0.3" console-control-strings "^1.0.0" @@ -1239,7 +1239,7 @@ get-symbol-description@^1.0.0: github-from-package@0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce" - integrity sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4= + integrity sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw== glob-parent@^6.0.1: version "6.0.2" @@ -1323,7 +1323,7 @@ has-tostringtag@^1.0.0: has-unicode@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" - integrity sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk= + integrity sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ== has@^1.0.3: version "1.0.3" @@ -1464,14 +1464,14 @@ is-finite@^1.0.0, is-finite@^1.0.1: is-fullwidth-code-point@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" - integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= + integrity sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw== dependencies: number-is-nan "^1.0.0" -is-fullwidth-code-point@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" - integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== is-glob@^4.0.0, is-glob@^4.0.3: version "4.0.3" @@ -1583,7 +1583,7 @@ isarray@^2.0.5: isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= + integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== isexe@^2.0.0: version "2.0.0" @@ -1719,11 +1719,16 @@ minimist@^0.2.0: resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.2.1.tgz#827ba4e7593464e7c221e8c5bed930904ee2c455" integrity sha512-GY8fANSrTMfBVfInqJAY41QkOM+upUTytK1jZ0c8+3HdHrJxBJ3rF5i9moClXTE8uUSnUo8cAsCoxDXvSY4DHg== -minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.5: +minimist@^1.1.3, minimist@^1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== +minimist@^1.2.0, minimist@^1.2.3: + version "1.2.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" + integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== + mkdirp-classic@^0.5.2, mkdirp-classic@^0.5.3: version "0.5.3" resolved "https://registry.yarnpkg.com/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz#fa10c9115cc6d8865be221ba47ee9bed78601113" @@ -1734,11 +1739,16 @@ ms@2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -nan@^2.12.1, nan@^2.14.0, nan@^2.14.2: +nan@^2.12.1: version "2.15.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.15.0.tgz#3f34a473ff18e15c1b5626b62903b5ad6e665fee" integrity sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ== +nan@^2.14.0, nan@^2.17.0: + version "2.17.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.17.0.tgz#c0150a2368a182f033e9aa5195ec76ea41a199cb" + integrity sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ== + napi-build-utils@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/napi-build-utils/-/napi-build-utils-1.0.2.tgz#b1fddc0b2c46e380a0b7a76f984dd47c41a13806" @@ -1749,7 +1759,7 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= -node-abi@^2.7.0: +node-abi@^2.21.0: version "2.30.1" resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-2.30.1.tgz#c437d4b1fe0e285aaf290d45b45d4d7afedac4cf" integrity sha512-/2D0wOQPgaUWzVSVgRMx+trKJRC2UG4SUc4oCJoXx9Uxjtp0Vy3/kt7zcbxHF8+Z/pK3UloLWzBISg72brfy1w== @@ -1761,11 +1771,6 @@ node-releases@^1.1.75: resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.75.tgz#6dd8c876b9897a1b8e5a02de26afa79bb54ebbfe" integrity sha512-Qe5OUajvqrqDSy6wrWFmMwfJ0jVgwiw4T3KqmbTcZ62qW0gQkheXYhcFM1+lOVcGUoRxcEcfyvFMAnDgaF1VWw== -noop-logger@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/noop-logger/-/noop-logger-0.1.1.tgz#94a2b1633c4f1317553007d8966fd0e841b6a4c2" - integrity sha1-lKKxYzxPExdVMAfYlm/Q6EG2pMI= - normalize-package-data@^2.3.2, normalize-package-data@^2.3.4: version "2.5.0" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" @@ -1789,7 +1794,7 @@ npmlog@^4.0.1: number-is-nan@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" - integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= + integrity sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ== object-assign@^4.0.1, object-assign@^4.1.0: version "4.1.1" @@ -1915,10 +1920,10 @@ plur@^1.0.0: resolved "https://registry.yarnpkg.com/plur/-/plur-1.0.0.tgz#db85c6814f5e5e5a3b49efc28d604fec62975156" integrity sha1-24XGgU9eXlo7Se/CjWBP7GKXUVY= -prebuild-install@^5.0.0: - version "5.3.6" - resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-5.3.6.tgz#7c225568d864c71d89d07f8796042733a3f54291" - integrity sha512-s8Aai8++QQGi4sSbs/M1Qku62PFK49Jm1CbgXklGz4nmHveDq0wzJkg7Na5QbnO1uNH8K7iqx2EQ/mV0MZEmOg== +prebuild-install@^6.0.1: + version "6.1.4" + resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-6.1.4.tgz#ae3c0142ad611d58570b89af4986088a4937e00f" + integrity sha512-Z4vpywnK1lBg+zdPCVCsKq0xO66eEV9rWo2zrROGGiRS4JtueBOdlB1FnY8lcy7JsUud/Q3ijUxyWN26Ika0vQ== dependencies: detect-libc "^1.0.3" expand-template "^2.0.3" @@ -1926,15 +1931,13 @@ prebuild-install@^5.0.0: minimist "^1.2.3" mkdirp-classic "^0.5.3" napi-build-utils "^1.0.1" - node-abi "^2.7.0" - noop-logger "^0.1.1" + node-abi "^2.21.0" npmlog "^4.0.1" pump "^3.0.0" rc "^1.2.7" simple-get "^3.0.3" tar-fs "^2.0.0" tunnel-agent "^0.6.0" - which-pm-runs "^1.0.0" prelude-ls@^1.2.1: version "1.2.1" @@ -2013,9 +2016,9 @@ read-pkg@^1.0.0: string_decoder "~0.10.x" readable-stream@^2.0.6: - version "2.3.7" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" - integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== + version "2.3.8" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b" + integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA== dependencies: core-util-is "~1.0.0" inherits "~2.0.3" @@ -2026,9 +2029,9 @@ readable-stream@^2.0.6: util-deprecate "~1.0.1" readable-stream@^3.1.1, readable-stream@^3.4.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" - integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== + version "3.6.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" + integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== dependencies: inherits "^2.0.3" string_decoder "^1.1.1" @@ -2131,7 +2134,7 @@ semver@^6.3.0: set-blocking@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" - integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= + integrity sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw== shebang-command@^2.0.0: version "2.0.0" @@ -2155,9 +2158,9 @@ side-channel@^1.0.3, side-channel@^1.0.4: object-inspect "^1.9.0" signal-exit@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" - integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA== + version "3.0.7" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" + integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== simple-concat@^1.0.0: version "1.0.1" @@ -2165,9 +2168,9 @@ simple-concat@^1.0.0: integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q== simple-get@^3.0.3: - version "3.1.0" - resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-3.1.0.tgz#b45be062435e50d159540b576202ceec40b9c6b3" - integrity sha512-bCR6cP+aTdScaQCnQKbPKtJOKDp/hj9EDLJo3Nw4y1QksqaovlW/bnptB6/c1e+qmNIDHRK+oXFDdEqBT8WzUA== + version "3.1.1" + resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-3.1.1.tgz#cc7ba77cfbe761036fbfce3d021af25fc5584d55" + integrity sha512-CQ5LTKGfCpvE1K0n2us+kuMPbk/q0EKl82s4aheV9oXjFEz6W/Y7oQFVJuU6QG77hRT4Ghb5RURteF5vnWjupA== dependencies: decompress-response "^4.2.0" once "^1.3.1" @@ -2217,19 +2220,20 @@ sprintf-js@~1.0.2: string-width@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" - integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= + integrity sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw== dependencies: code-point-at "^1.0.0" is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -"string-width@^1.0.2 || 2": - version "2.1.1" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" - integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== +"string-width@^1.0.2 || 2 || 3 || 4": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== dependencies: - is-fullwidth-code-point "^2.0.0" - strip-ansi "^4.0.0" + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" string.prototype.trim@^1.2.5: version "1.2.5" @@ -2278,17 +2282,10 @@ string_decoder@~1.1.1: strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" - integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= + integrity sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg== dependencies: ansi-regex "^2.0.0" -strip-ansi@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" - integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= - dependencies: - ansi-regex "^3.0.0" - strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" @@ -2318,7 +2315,7 @@ strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" - integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= + integrity sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ== supports-color@^5.3.0: version "5.5.0" @@ -2454,20 +2451,20 @@ tree-sitter-javascript@^0.19.0: dependencies: nan "^2.12.1" -tree-sitter-nix@cstrahan/tree-sitter-nix: +tree-sitter-nix@^0.0.2: version "0.0.2" - resolved "https://codeload.github.com/cstrahan/tree-sitter-nix/tar.gz/83ee5993560bf15854c69b77d92e34456f8fb655" + resolved "https://registry.yarnpkg.com/tree-sitter-nix/-/tree-sitter-nix-0.0.2.tgz#f40176270961a1d969a6d36e43a08526e2bde94f" + integrity sha512-rPYc7NUi6hPOyFSoVdCVC9feqBk0kJ0Z3ftTWXo1ubyyKzPM5tJP6mD6xYl0gN45oh9GHGzvTbOmmwIk0XOj5A== dependencies: - nan "^2.14.2" - tree-sitter "^0.19.0" + nan "^2.17.0" -tree-sitter@^0.19.0: - version "0.19.0" - resolved "https://registry.yarnpkg.com/tree-sitter/-/tree-sitter-0.19.0.tgz#68c4cfa12b34752d69162b81ad233f3e6fc4a70d" - integrity sha512-jw/BNCCRB9RCq/GFGU0VuhchGlIIlYRQFnjXgPKG3fBIo+c3ImuPITtAHJJ4XgTBNfeAQmt8XC4wShgBw8tgdg== +tree-sitter@^0.20.2: + version "0.20.2" + resolved "https://registry.yarnpkg.com/tree-sitter/-/tree-sitter-0.20.2.tgz#d5227966635d5e27dabd6744b28618d5c43cea77" + integrity sha512-xyaEOl3zgsYWfZ9LfByPZBFfllsOoccm0Y2DY564iYuzmjg4vWd9nd0hcjh5qhq4uIG5LvSACTHcB5RPu9iuxQ== dependencies: nan "^2.14.0" - prebuild-install "^5.0.0" + prebuild-install "^6.0.1" trim-newlines@^1.0.0: version "1.0.0" @@ -2477,7 +2474,7 @@ trim-newlines@^1.0.0: tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" - integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= + integrity sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w== dependencies: safe-buffer "^5.0.1" @@ -2513,7 +2510,7 @@ uri-js@^4.2.2: util-deprecate@^1.0.1, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" - integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= + integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== v8-compile-cache@^2.0.3: version "2.3.0" @@ -2549,11 +2546,6 @@ which-collection@^1.0.1: is-weakmap "^2.0.1" is-weakset "^2.0.1" -which-pm-runs@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/which-pm-runs/-/which-pm-runs-1.0.0.tgz#670b3afbc552e0b55df6b7780ca74615f23ad1cb" - integrity sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs= - which-typed-array@^1.1.2: version "1.1.7" resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.7.tgz#2761799b9a22d4b8660b3c1b40abaa7739691793" @@ -2574,11 +2566,11 @@ which@^2.0.1: isexe "^2.0.0" wide-align@^1.1.0: - version "1.1.3" - resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" - integrity sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA== + version "1.1.5" + resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.5.tgz#df1d4c206854369ecf3c9a4898f1b23fbd9d15d3" + integrity sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg== dependencies: - string-width "^1.0.2 || 2" + string-width "^1.0.2 || 2 || 3 || 4" word-wrap@^1.2.3: version "1.2.3" @@ -2588,7 +2580,7 @@ word-wrap@^1.2.3: wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= + integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== "xtend@>=4.0.0 <4.1.0-0": version "4.0.2"